Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

const oclif = require('@oclif/core')

oclif.run()
.then(require('@oclif/core/flush'))
.catch(require('@oclif/core/handle'))
// eslint-disable-next-line node/shebang
(async () => {
const oclif = await import('@oclif/core')
await oclif.execute({ type: 'cjs', dir: __dirname })
})()
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@adobe/aio-lib-env": "^3",
"@adobe/aio-lib-events": "^4",
"@adobe/aio-lib-ims": "^7",
"@oclif/core": "^1.5.2",
"@oclif/core": "^2.8.12",
"inquirer": "^8.2.5",
"js-yaml": "^4.1.0"
},
Expand Down
11 changes: 7 additions & 4 deletions src/commands/event/eventmetadata/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Args, Flags, ux: cli } = require('@oclif/core')
const { sentenceValidatorWithMinOneChar, eventCodeValidator } = require('../../../utils/validator')
const inquirer = require('inquirer')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:eventmetadata:create', { provider: 'debug' })
Expand Down Expand Up @@ -61,9 +61,12 @@ class EventmetadataCreateCommand extends BaseCommand {

EventmetadataCreateCommand.description = 'Create an Event Metadata for a Provider'

EventmetadataCreateCommand.args = [
{ name: 'providerId', required: true, description: 'The requested eventmetadata event code' }
]
EventmetadataCreateCommand.args = {
providerId: Args.string({
required: true,
description: 'The requested provider ID'
})
}

EventmetadataCreateCommand.flags = {
...BaseCommand.flags,
Expand Down
16 changes: 11 additions & 5 deletions src/commands/event/eventmetadata/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { CliUx: { ux: cli } } = require('@oclif/core')
const { Args, ux: cli } = require('@oclif/core')
const inquirer = require('inquirer')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:eventmetadata:delete', { provider: 'debug' })

Expand Down Expand Up @@ -64,10 +64,16 @@ class EventmetadataDeleteCommand extends BaseCommand {

EventmetadataDeleteCommand.description = 'Delete Event Metadata for a Provider'

EventmetadataDeleteCommand.args = [
{ name: 'providerId', required: true, description: 'The requested provider ID' },
{ name: 'eventCode', required: false, description: 'The requested eventmetadata event code' }
]
EventmetadataDeleteCommand.args = {
providerId: Args.string({
required: true,
description: 'The requested provider ID'
}),
eventCode: Args.string({
required: false,
description: 'The requested event code'
})
}

EventmetadataDeleteCommand.flags = {
...BaseCommand.flags
Expand Down
16 changes: 11 additions & 5 deletions src/commands/event/eventmetadata/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Args, Flags, ux: cli } = require('@oclif/core')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:eventmetadata:get', { provider: 'debug' })

class EventmetadataGetCommand extends BaseCommand {
Expand Down Expand Up @@ -41,10 +41,16 @@ class EventmetadataGetCommand extends BaseCommand {

EventmetadataGetCommand.description = 'Get details of an Event Code of a Provider'

EventmetadataGetCommand.args = [
{ name: 'providerId', required: true, description: 'The requested provider ID' },
{ name: 'eventCode', required: true, description: 'The requested eventmetadata event code' }
]
EventmetadataGetCommand.args = {
providerId: Args.string({
required: true,
description: 'The requested provider ID'
}),
eventCode: Args.string({
required: true,
description: 'The requested event code'
})
}

EventmetadataGetCommand.flags = {
...BaseCommand.flags,
Expand Down
11 changes: 7 additions & 4 deletions src/commands/event/eventmetadata/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Args, Flags, ux: cli } = require('@oclif/core')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:eventmetadata:list', { provider: 'debug' })

class EventmetadataListCommand extends BaseCommand {
Expand Down Expand Up @@ -58,9 +58,12 @@ EventmetadataListCommand.aliases = [
'event:eventmetadata:ls'
]

EventmetadataListCommand.args = [
{ name: 'providerId', required: true, description: 'The requested provider ID' }
]
EventmetadataListCommand.args = {
providerId: Args.string({
required: true,
description: 'The requested provider ID'
})
}

EventmetadataListCommand.flags = {
...BaseCommand.flags,
Expand Down
16 changes: 11 additions & 5 deletions src/commands/event/eventmetadata/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Args, Flags, ux: cli } = require('@oclif/core')
const { sentenceValidatorWithMinOneChar } = require('../../../utils/validator')
const inquirer = require('inquirer')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:eventmetadata:update', { provider: 'debug' })
Expand Down Expand Up @@ -56,10 +56,16 @@ class EventmetadataUpdateCommand extends BaseCommand {

EventmetadataUpdateCommand.description = 'Update an Event Metadata for a Provider'

EventmetadataUpdateCommand.args = [
{ name: 'providerId', required: true, description: 'The requested provider ID' },
{ name: 'eventCode', required: true, description: 'The requested eventmetadata event code' }
]
EventmetadataUpdateCommand.args = {
providerId: Args.string({
required: true,
description: 'The requested provider ID'
}),
eventCode: Args.string({
required: true,
description: 'The requested event code'
})
}

EventmetadataUpdateCommand.flags = {
...BaseCommand.flags,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/event/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ class IndexCommand extends BaseCommand {

IndexCommand.description = 'Manage your Adobe I/O Events'

IndexCommand.args = []
IndexCommand.args = {}

module.exports = IndexCommand
2 changes: 1 addition & 1 deletion src/commands/event/provider/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Flags, ux: cli } = require('@oclif/core')
const { sentenceValidatorWithMinOneChar, sentenceValidatorWithMinZeroChar } = require('../../../utils/validator')
const inquirer = require('inquirer')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:provider:create', { provider: 'debug' })
Expand Down
11 changes: 7 additions & 4 deletions src/commands/event/provider/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { CliUx: { ux: cli } } = require('@oclif/core')
const { Args, ux: cli } = require('@oclif/core')
const inquirer = require('inquirer')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:provider:delete', { provider: 'debug' })

Expand Down Expand Up @@ -46,9 +46,12 @@ class ProviderDeleteCommand extends BaseCommand {

ProviderDeleteCommand.description = 'Delete Provider by id'

ProviderDeleteCommand.args = [
{ name: 'providerId', required: true, description: 'The requested provider ID' }
]
ProviderDeleteCommand.args = {
providerId: Args.string({
required: true,
description: 'The requested provider ID'
})
}

ProviderDeleteCommand.flags = {
...BaseCommand.flags
Expand Down
11 changes: 7 additions & 4 deletions src/commands/event/provider/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Args, Flags, ux: cli } = require('@oclif/core')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:provider:get', { provider: 'debug' })

class ProviderGetCommand extends BaseCommand {
Expand Down Expand Up @@ -41,9 +41,12 @@ class ProviderGetCommand extends BaseCommand {

ProviderGetCommand.description = 'Get details of Provider by id'

ProviderGetCommand.args = [
{ name: 'providerId', required: true, description: 'The requested provider ID' }
]
ProviderGetCommand.args = {
providerId: Args.string({
required: true,
description: 'The requested provider ID'
})
}

ProviderGetCommand.flags = {
...BaseCommand.flags,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/event/provider/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Flags, ux: cli } = require('@oclif/core')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:provider:list', { provider: 'debug' })

class ProviderListCommand extends BaseCommand {
Expand Down
11 changes: 7 additions & 4 deletions src/commands/event/provider/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Args, Flags, ux: cli } = require('@oclif/core')
const { sentenceValidatorWithMinOneChar, sentenceValidatorWithMinZeroChar } = require('../../../utils/validator')
const inquirer = require('inquirer')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:provider:update', { provider: 'debug' })
Expand Down Expand Up @@ -59,9 +59,12 @@ class ProviderUpdateCommand extends BaseCommand {

ProviderUpdateCommand.description = 'Update an existing Provider'

ProviderUpdateCommand.args = [
{ name: 'providerId', required: true, description: 'The requested provider ID' }
]
ProviderUpdateCommand.args = {
providerId: Args.string({
required: true,
description: 'The requested provider ID'
})
}

ProviderUpdateCommand.flags = {
...BaseCommand.flags,
Expand Down
11 changes: 5 additions & 6 deletions src/commands/event/registration/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Args, Flags, ux: cli } = require('@oclif/core')
const fs = require('fs')

const BaseCommand = require('../../../BaseCommand')
Expand Down Expand Up @@ -81,9 +81,8 @@ CreateCommand.flags = {
})
}

CreateCommand.args = [
{
name: 'bodyJSONFile',
CreateCommand.args = {
bodyJSONFile: Args.file({
required: true,
description: `Path to a file in JSON format with the information to create a new Event Registration.
The JSON should follow the following format:
Expand All @@ -97,7 +96,7 @@ The JSON should follow the following format:
"event_code": "<event provider event_code metadata>"
}, { /* ...more events */ }]
}`
}
]
})
}

module.exports = CreateCommand
11 changes: 7 additions & 4 deletions src/commands/event/registration/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const BaseCommand = require('../../../BaseCommand.js')
const { CliUx: { ux: cli } } = require('@oclif/core')
const { Args, ux: cli } = require('@oclif/core')
const inquirer = require('inquirer')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:registration:delete', { provider: 'debug' })

Expand Down Expand Up @@ -50,9 +50,12 @@ DeleteCommand.aliases = [
'event:reg:delete'
]

DeleteCommand.args = [
{ name: 'registrationId', required: true, description: 'The requested registration ID' }
]
DeleteCommand.args = {
registrationId: Args.string({
required: true,
description: 'The requested registration ID'
})
}

DeleteCommand.flags = {
...BaseCommand.flags
Expand Down
11 changes: 7 additions & 4 deletions src/commands/event/registration/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Args, Flags, ux: cli } = require('@oclif/core')

const BaseCommand = require('../../../BaseCommand')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:registration:get', { provider: 'debug' })
Expand Down Expand Up @@ -63,8 +63,11 @@ GetCommand.flags = {
})
}

GetCommand.args = [
{ name: 'registrationId', required: true, description: 'The requested registration ID' }
]
GetCommand.args = {
registrationId: Args.string({
required: true,
description: 'The requested registration ID'
})
}

module.exports = GetCommand
2 changes: 1 addition & 1 deletion src/commands/event/registration/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
const { Flags, CliUx: { ux: cli } } = require('@oclif/core')
const { Flags, ux: cli } = require('@oclif/core')

const BaseCommand = require('../../../BaseCommand')
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-events:registration:list', { provider: 'debug' })
Expand Down
4 changes: 2 additions & 2 deletions test/commands/event/eventmetadata/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ test('flags', async () => {
})

test('args', async () => {
expect(EventmetadataCreateCommand.args[0].required).toBe(true)
expect(EventmetadataCreateCommand.args[0].description).toBeDefined()
expect(EventmetadataCreateCommand.args.providerId.required).toBe(true)
expect(EventmetadataCreateCommand.args.providerId.description).toBeDefined()
})

describe('console:eventmetadata:create', () => {
Expand Down
11 changes: 7 additions & 4 deletions test/commands/event/eventmetadata/delete.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ test('flags', async () => {
expect(EventmetadataDeleteCommand.flags.verbose.type).toBe('boolean')
})
test('args', async () => {
expect(EventmetadataDeleteCommand.args[0].required).toBe(true)
expect(EventmetadataDeleteCommand.args[0].description).toBeDefined()
expect(EventmetadataDeleteCommand.args[1].required).toBe(false)
expect(EventmetadataDeleteCommand.args[1].description).toBeDefined()
expect(EventmetadataDeleteCommand.args.providerId.required).toBe(true)
expect(EventmetadataDeleteCommand.args.providerId.description).toBeDefined()
expect(EventmetadataDeleteCommand.args.eventCode.required).toBe(false)
expect(EventmetadataDeleteCommand.args.eventCode.description).toBeDefined()
})

describe('console:eventmetadata:delete', () => {
let command

beforeEach(async () => {
jest.useRealTimers()
command = new EventmetadataDeleteCommand([])
inquirer.prompt = jest.fn()
command.conf = {
Expand All @@ -56,6 +57,8 @@ describe('console:eventmetadata:delete', () => {

afterEach(() => {
jest.clearAllMocks()

jest.useFakeTimers()
})

test('exists', async () => {
Expand Down
Loading
Loading