@norbix.ai/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +121 -0
- package/bin/run.js +4 -0
- package/dist/base.js +100 -0
- package/dist/commands/account/billing-portal.js +21 -0
- package/dist/commands/account/profile.js +12 -0
- package/dist/commands/account/projects.js +12 -0
- package/dist/commands/account/regions.js +12 -0
- package/dist/commands/account/status.js +12 -0
- package/dist/commands/account/team.js +12 -0
- package/dist/commands/account/usage.js +12 -0
- package/dist/commands/api.js +87 -0
- package/dist/commands/apikeys/list.js +12 -0
- package/dist/commands/apikeys/regenerate.js +25 -0
- package/dist/commands/config/get.js +20 -0
- package/dist/commands/config/list.js +18 -0
- package/dist/commands/config/set.js +25 -0
- package/dist/commands/config/unset.js +20 -0
- package/dist/commands/db/aggregate.js +42 -0
- package/dist/commands/db/aggregates.js +16 -0
- package/dist/commands/db/count.js +26 -0
- package/dist/commands/db/delete.js +45 -0
- package/dist/commands/db/distinct.js +25 -0
- package/dist/commands/db/find.js +33 -0
- package/dist/commands/db/get.js +20 -0
- package/dist/commands/db/insert-many.js +29 -0
- package/dist/commands/db/insert.js +26 -0
- package/dist/commands/db/replace.js +25 -0
- package/dist/commands/db/schema.js +16 -0
- package/dist/commands/db/schemas.js +20 -0
- package/dist/commands/db/taxonomies.js +20 -0
- package/dist/commands/db/taxonomy.js +16 -0
- package/dist/commands/db/update.js +44 -0
- package/dist/commands/email/archive.js +16 -0
- package/dist/commands/email/campaign.js +21 -0
- package/dist/commands/email/campaigns.js +20 -0
- package/dist/commands/email/clone.js +16 -0
- package/dist/commands/email/delete.js +25 -0
- package/dist/commands/email/stop.js +31 -0
- package/dist/commands/email/template.js +16 -0
- package/dist/commands/email/templates.js +18 -0
- package/dist/commands/email/unarchive.js +16 -0
- package/dist/commands/env/delete.js +28 -0
- package/dist/commands/env/list.js +12 -0
- package/dist/commands/env/use.js +17 -0
- package/dist/commands/files/delete.js +34 -0
- package/dist/commands/files/download.js +45 -0
- package/dist/commands/files/info.js +27 -0
- package/dist/commands/files/list.js +30 -0
- package/dist/commands/files/sign.js +29 -0
- package/dist/commands/files/upload.js +62 -0
- package/dist/commands/integrations.js +34 -0
- package/dist/commands/login.js +65 -0
- package/dist/commands/logout.js +27 -0
- package/dist/commands/logs/list.js +38 -0
- package/dist/commands/logs/settings.js +12 -0
- package/dist/commands/logs/trail.js +18 -0
- package/dist/commands/module.js +48 -0
- package/dist/commands/payments/disable.js +16 -0
- package/dist/commands/payments/enable.js +16 -0
- package/dist/commands/payments/integrations.js +12 -0
- package/dist/commands/payments/trigger.js +16 -0
- package/dist/commands/payments/triggers.js +12 -0
- package/dist/commands/push/archive.js +16 -0
- package/dist/commands/push/campaign.js +21 -0
- package/dist/commands/push/campaigns.js +20 -0
- package/dist/commands/push/clone.js +16 -0
- package/dist/commands/push/delete.js +25 -0
- package/dist/commands/push/stop.js +30 -0
- package/dist/commands/push/template.js +16 -0
- package/dist/commands/push/templates.js +18 -0
- package/dist/commands/push/unarchive.js +16 -0
- package/dist/commands/scheduler/delete.js +25 -0
- package/dist/commands/scheduler/disable.js +16 -0
- package/dist/commands/scheduler/enable.js +16 -0
- package/dist/commands/scheduler/get.js +16 -0
- package/dist/commands/scheduler/list.js +20 -0
- package/dist/commands/sms/archive.js +16 -0
- package/dist/commands/sms/campaign.js +21 -0
- package/dist/commands/sms/campaigns.js +20 -0
- package/dist/commands/sms/clone.js +16 -0
- package/dist/commands/sms/delete.js +25 -0
- package/dist/commands/sms/stop.js +30 -0
- package/dist/commands/sms/template.js +16 -0
- package/dist/commands/sms/templates.js +18 -0
- package/dist/commands/sms/unarchive.js +16 -0
- package/dist/commands/users/block.js +16 -0
- package/dist/commands/users/delete.js +25 -0
- package/dist/commands/users/get.js +16 -0
- package/dist/commands/users/invite.js +16 -0
- package/dist/commands/users/list.js +27 -0
- package/dist/commands/users/policies.js +12 -0
- package/dist/commands/users/roles.js +12 -0
- package/dist/commands/users/unblock.js +16 -0
- package/dist/commands/webhooks/disable.js +18 -0
- package/dist/commands/webhooks/enable.js +18 -0
- package/dist/commands/webhooks/remove.js +30 -0
- package/dist/commands/webhooks/secret.js +34 -0
- package/dist/commands/webhooks/show.js +12 -0
- package/dist/commands/whoami.js +43 -0
- package/dist/lib/files.js +35 -0
- package/dist/lib/json.js +21 -0
- package/dist/lib/store.js +39 -0
- package/oclif.manifest.json +8497 -0
- package/package.json +114 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { confirm } from '@inquirer/prompts';
|
|
2
|
+
import { Args, Flags } from '@oclif/core';
|
|
3
|
+
import { BaseCommand } from '../../base.js';
|
|
4
|
+
export default class PushStop extends BaseCommand {
|
|
5
|
+
static description = 'Stop a running push campaign';
|
|
6
|
+
static examples = ['<%= config.bin %> push stop 66b2f0a1... --yes'];
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.string({ required: true, description: 'Campaign ID' }),
|
|
9
|
+
};
|
|
10
|
+
static flags = {
|
|
11
|
+
yes: Flags.boolean({ char: 'y', description: 'Skip the confirmation prompt', default: false }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(PushStop);
|
|
15
|
+
const client = this.client(flags);
|
|
16
|
+
if (!flags.yes && process.stdout.isTTY) {
|
|
17
|
+
const ok = await confirm({ message: `Stop push campaign ${args.id}?`, default: false });
|
|
18
|
+
if (!ok)
|
|
19
|
+
return this.print('Cancelled.');
|
|
20
|
+
}
|
|
21
|
+
const n = client.hub.notifications;
|
|
22
|
+
if (!n.stopPushCampaign) {
|
|
23
|
+
this.error('Your installed @norbix.ai/ts does not support stopping campaigns yet.\n' +
|
|
24
|
+
`Update the SDK, or run: norbix api "/{version}/notifications/push/campaigns/${args.id}/stop" --hub --method POST`);
|
|
25
|
+
}
|
|
26
|
+
const res = await n.stopPushCampaign({ id: args.id });
|
|
27
|
+
this.print(`Campaign ${args.id} stopped.`);
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class PushTemplate extends BaseCommand {
|
|
4
|
+
static description = 'Show one push template';
|
|
5
|
+
static examples = ['<%= config.bin %> push template 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'Template ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(PushTemplate);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.notifications.getPushTemplate({ id: args.id });
|
|
13
|
+
this.print(res);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class PushTemplates extends BaseCommand {
|
|
4
|
+
static description = 'List push notification templates';
|
|
5
|
+
static examples = ['<%= config.bin %> push templates --archived'];
|
|
6
|
+
static flags = {
|
|
7
|
+
archived: Flags.boolean({ description: 'Include archived templates', default: false }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags } = await this.parse(PushTemplates);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.notifications.getPushTemplates({
|
|
13
|
+
showArchived: flags.archived,
|
|
14
|
+
});
|
|
15
|
+
this.print(res);
|
|
16
|
+
return res;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class PushUnarchive extends BaseCommand {
|
|
4
|
+
static description = 'Restore an archived push template';
|
|
5
|
+
static examples = ['<%= config.bin %> push unarchive 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'Template ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(PushUnarchive);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.notifications.unArchivePushTemplate({ id: args.id });
|
|
13
|
+
this.print(`Template ${args.id} restored.`);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { confirm } from '@inquirer/prompts';
|
|
2
|
+
import { Args, Flags } from '@oclif/core';
|
|
3
|
+
import { BaseCommand } from '../../base.js';
|
|
4
|
+
export default class SchedulerDelete extends BaseCommand {
|
|
5
|
+
static description = 'Delete a scheduler task';
|
|
6
|
+
static examples = ['<%= config.bin %> scheduler delete 66b2f0a1... --yes'];
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.string({ required: true, description: 'Task ID' }),
|
|
9
|
+
};
|
|
10
|
+
static flags = {
|
|
11
|
+
yes: Flags.boolean({ char: 'y', description: 'Skip the confirmation prompt', default: false }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(SchedulerDelete);
|
|
15
|
+
const client = this.client(flags);
|
|
16
|
+
if (!flags.yes && process.stdout.isTTY) {
|
|
17
|
+
const ok = await confirm({ message: `Delete scheduler task ${args.id}?`, default: false });
|
|
18
|
+
if (!ok)
|
|
19
|
+
return this.print('Cancelled.');
|
|
20
|
+
}
|
|
21
|
+
const res = await client.hub.scheduler.deleteSchedulerTask({ id: args.id });
|
|
22
|
+
this.print(`Task ${args.id} deleted.`);
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SchedulerDisable extends BaseCommand {
|
|
4
|
+
static description = 'Disable a scheduler task';
|
|
5
|
+
static examples = ['<%= config.bin %> scheduler disable 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'Task ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(SchedulerDisable);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.scheduler.disableSchedulerTask({ id: args.id });
|
|
13
|
+
this.print(`Task ${args.id} disabled.`);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SchedulerEnable extends BaseCommand {
|
|
4
|
+
static description = 'Enable a scheduler task';
|
|
5
|
+
static examples = ['<%= config.bin %> scheduler enable 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'Task ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(SchedulerEnable);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.scheduler.enableSchedulerTask({ id: args.id });
|
|
13
|
+
this.print(`Task ${args.id} enabled.`);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SchedulerGet extends BaseCommand {
|
|
4
|
+
static description = 'Show one scheduler task';
|
|
5
|
+
static examples = ['<%= config.bin %> scheduler get 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'Task ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(SchedulerGet);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.scheduler.getSchedulerTask({ id: args.id });
|
|
13
|
+
this.print(res);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SchedulerList extends BaseCommand {
|
|
4
|
+
static description = 'List scheduler tasks';
|
|
5
|
+
static examples = ['<%= config.bin %> scheduler list'];
|
|
6
|
+
static flags = {
|
|
7
|
+
'page-size': Flags.integer({ description: 'Records per page' }),
|
|
8
|
+
after: Flags.string({ description: 'Cursor: fetch the page after this item' }),
|
|
9
|
+
};
|
|
10
|
+
async run() {
|
|
11
|
+
const { flags } = await this.parse(SchedulerList);
|
|
12
|
+
const client = this.client(flags);
|
|
13
|
+
const res = await client.hub.scheduler.getSchedulerTasks({
|
|
14
|
+
pageSize: flags['page-size'],
|
|
15
|
+
startingAfter: flags.after,
|
|
16
|
+
});
|
|
17
|
+
this.print(res);
|
|
18
|
+
return res;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SmsArchive extends BaseCommand {
|
|
4
|
+
static description = 'Archive an SMS template';
|
|
5
|
+
static examples = ['<%= config.bin %> sms archive 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'Template ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(SmsArchive);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.notifications.archiveSmsTemplate({ id: args.id });
|
|
13
|
+
this.print(`Template ${args.id} archived.`);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SmsCampaign extends BaseCommand {
|
|
4
|
+
static description = 'Show one SMS campaign (or its statistics with --stats)';
|
|
5
|
+
static examples = ['<%= config.bin %> sms campaign 66b2f0a1... --stats'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'Campaign ID' }),
|
|
8
|
+
};
|
|
9
|
+
static flags = {
|
|
10
|
+
stats: Flags.boolean({ description: 'Show delivery statistics instead of the campaign itself', default: false }),
|
|
11
|
+
};
|
|
12
|
+
async run() {
|
|
13
|
+
const { args, flags } = await this.parse(SmsCampaign);
|
|
14
|
+
const client = this.client(flags);
|
|
15
|
+
const res = flags.stats
|
|
16
|
+
? await client.hub.notifications.getSmsCampaignStatistics({ id: args.id })
|
|
17
|
+
: await client.hub.notifications.getSmsCampaign({ id: args.id });
|
|
18
|
+
this.print(res);
|
|
19
|
+
return res;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SmsCampaigns extends BaseCommand {
|
|
4
|
+
static description = 'List SMS campaigns';
|
|
5
|
+
static examples = ['<%= config.bin %> sms campaigns'];
|
|
6
|
+
static flags = {
|
|
7
|
+
'page-size': Flags.integer({ description: 'Records per page' }),
|
|
8
|
+
after: Flags.string({ description: 'Cursor: fetch the page after this item' }),
|
|
9
|
+
};
|
|
10
|
+
async run() {
|
|
11
|
+
const { flags } = await this.parse(SmsCampaigns);
|
|
12
|
+
const client = this.client(flags);
|
|
13
|
+
const res = await client.hub.notifications.getSmsCampaigns({
|
|
14
|
+
pageSize: flags['page-size'],
|
|
15
|
+
startingAfter: flags.after,
|
|
16
|
+
});
|
|
17
|
+
this.print(res);
|
|
18
|
+
return res;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SmsClone extends BaseCommand {
|
|
4
|
+
static description = 'Clone an SMS template';
|
|
5
|
+
static examples = ['<%= config.bin %> sms clone 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'Template ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(SmsClone);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.notifications.cloneSmsTemplate({ id: args.id });
|
|
13
|
+
this.print(`Template ${args.id} cloned.`);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { confirm } from '@inquirer/prompts';
|
|
2
|
+
import { Args, Flags } from '@oclif/core';
|
|
3
|
+
import { BaseCommand } from '../../base.js';
|
|
4
|
+
export default class SmsDelete extends BaseCommand {
|
|
5
|
+
static description = 'Delete an SMS template';
|
|
6
|
+
static examples = ['<%= config.bin %> sms delete 66b2f0a1... --yes'];
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.string({ required: true, description: 'Template ID' }),
|
|
9
|
+
};
|
|
10
|
+
static flags = {
|
|
11
|
+
yes: Flags.boolean({ char: 'y', description: 'Skip the confirmation prompt', default: false }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(SmsDelete);
|
|
15
|
+
const client = this.client(flags);
|
|
16
|
+
if (!flags.yes && process.stdout.isTTY) {
|
|
17
|
+
const ok = await confirm({ message: `Delete SMS template ${args.id}?`, default: false });
|
|
18
|
+
if (!ok)
|
|
19
|
+
return this.print('Cancelled.');
|
|
20
|
+
}
|
|
21
|
+
const res = await client.hub.notifications.deleteSmsTemplate({ id: args.id });
|
|
22
|
+
this.print(`Template ${args.id} deleted.`);
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { confirm } from '@inquirer/prompts';
|
|
2
|
+
import { Args, Flags } from '@oclif/core';
|
|
3
|
+
import { BaseCommand } from '../../base.js';
|
|
4
|
+
export default class SmsStop extends BaseCommand {
|
|
5
|
+
static description = 'Stop a running SMS campaign';
|
|
6
|
+
static examples = ['<%= config.bin %> sms stop 66b2f0a1... --yes'];
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.string({ required: true, description: 'Campaign ID' }),
|
|
9
|
+
};
|
|
10
|
+
static flags = {
|
|
11
|
+
yes: Flags.boolean({ char: 'y', description: 'Skip the confirmation prompt', default: false }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(SmsStop);
|
|
15
|
+
const client = this.client(flags);
|
|
16
|
+
if (!flags.yes && process.stdout.isTTY) {
|
|
17
|
+
const ok = await confirm({ message: `Stop SMS campaign ${args.id}?`, default: false });
|
|
18
|
+
if (!ok)
|
|
19
|
+
return this.print('Cancelled.');
|
|
20
|
+
}
|
|
21
|
+
const n = client.hub.notifications;
|
|
22
|
+
if (!n.stopSmsCampaign) {
|
|
23
|
+
this.error('Your installed @norbix.ai/ts does not support stopping campaigns yet.\n' +
|
|
24
|
+
`Update the SDK, or run: norbix api "/{version}/notifications/sms/campaigns/${args.id}/stop" --hub --method POST`);
|
|
25
|
+
}
|
|
26
|
+
const res = await n.stopSmsCampaign({ id: args.id });
|
|
27
|
+
this.print(`Campaign ${args.id} stopped.`);
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SmsTemplate extends BaseCommand {
|
|
4
|
+
static description = 'Show one SMS template';
|
|
5
|
+
static examples = ['<%= config.bin %> sms template 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'Template ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(SmsTemplate);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.notifications.getSmsTemplate({ id: args.id });
|
|
13
|
+
this.print(res);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SmsTemplates extends BaseCommand {
|
|
4
|
+
static description = 'List SMS templates';
|
|
5
|
+
static examples = ['<%= config.bin %> sms templates --archived'];
|
|
6
|
+
static flags = {
|
|
7
|
+
archived: Flags.boolean({ description: 'Include archived templates', default: false }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags } = await this.parse(SmsTemplates);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.notifications.getSmsTemplates({
|
|
13
|
+
showArchived: flags.archived,
|
|
14
|
+
});
|
|
15
|
+
this.print(res);
|
|
16
|
+
return res;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class SmsUnarchive extends BaseCommand {
|
|
4
|
+
static description = 'Restore an archived SMS template';
|
|
5
|
+
static examples = ['<%= config.bin %> sms unarchive 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'Template ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(SmsUnarchive);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.notifications.unArchiveSmsTemplate({ id: args.id });
|
|
13
|
+
this.print(`Template ${args.id} restored.`);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class UsersBlock extends BaseCommand {
|
|
4
|
+
static description = 'Block a user (they can no longer log in)';
|
|
5
|
+
static examples = ['<%= config.bin %> users block 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'User ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(UsersBlock);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.api.membership.blockUser({ id: args.id });
|
|
13
|
+
this.print(`User ${args.id} blocked.`);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { confirm } from '@inquirer/prompts';
|
|
2
|
+
import { Args, Flags } from '@oclif/core';
|
|
3
|
+
import { BaseCommand } from '../../base.js';
|
|
4
|
+
export default class UsersDelete extends BaseCommand {
|
|
5
|
+
static description = 'Delete a user';
|
|
6
|
+
static examples = ['<%= config.bin %> users delete 66b2f0a1... --yes'];
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.string({ required: true, description: 'User ID' }),
|
|
9
|
+
};
|
|
10
|
+
static flags = {
|
|
11
|
+
yes: Flags.boolean({ char: 'y', description: 'Skip the confirmation prompt', default: false }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(UsersDelete);
|
|
15
|
+
const client = this.client(flags);
|
|
16
|
+
if (!flags.yes && process.stdout.isTTY) {
|
|
17
|
+
const ok = await confirm({ message: `Delete user ${args.id}?`, default: false });
|
|
18
|
+
if (!ok)
|
|
19
|
+
return this.print('Cancelled.');
|
|
20
|
+
}
|
|
21
|
+
const res = await client.api.membership.deleteUser({ id: args.id });
|
|
22
|
+
this.print(`User ${args.id} deleted.`);
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class UsersGet extends BaseCommand {
|
|
4
|
+
static description = 'Show one user';
|
|
5
|
+
static examples = ['<%= config.bin %> users get 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'User ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(UsersGet);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.api.membership.getUser({ id: args.id });
|
|
13
|
+
this.print(res);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class UsersInvite extends BaseCommand {
|
|
4
|
+
static description = 'Invite a user by email';
|
|
5
|
+
static examples = ['<%= config.bin %> users invite alice@example.com'];
|
|
6
|
+
static args = {
|
|
7
|
+
email: Args.string({ required: true, description: 'Email address to invite' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(UsersInvite);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.api.membership.inviteUser({ email: args.email });
|
|
13
|
+
this.print(`Invitation sent to ${args.email}.`);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class UsersList extends BaseCommand {
|
|
4
|
+
static description = 'List project users';
|
|
5
|
+
static examples = [
|
|
6
|
+
'<%= config.bin %> users list',
|
|
7
|
+
'<%= config.bin %> users list --role admin --page-size 100',
|
|
8
|
+
];
|
|
9
|
+
static flags = {
|
|
10
|
+
role: Flags.string({ description: 'Only users with this role (repeatable)', multiple: true }),
|
|
11
|
+
permissions: Flags.boolean({ description: 'Include permissions in the output', default: false }),
|
|
12
|
+
'page-size': Flags.integer({ description: 'Records per page' }),
|
|
13
|
+
after: Flags.string({ description: 'Cursor: fetch the page after this item' }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags } = await this.parse(UsersList);
|
|
17
|
+
const client = this.client(flags);
|
|
18
|
+
const res = await client.api.membership.getUsers({
|
|
19
|
+
roleNames: flags.role,
|
|
20
|
+
includePermissions: flags.permissions,
|
|
21
|
+
pageSize: flags['page-size'],
|
|
22
|
+
startingAfter: flags.after,
|
|
23
|
+
});
|
|
24
|
+
this.print(res);
|
|
25
|
+
return res;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base.js';
|
|
2
|
+
export default class UsersPolicies extends BaseCommand {
|
|
3
|
+
static description = 'List membership policies';
|
|
4
|
+
static examples = ['<%= config.bin %> users policies'];
|
|
5
|
+
async run() {
|
|
6
|
+
const { flags } = await this.parse(UsersPolicies);
|
|
7
|
+
const client = this.client(flags);
|
|
8
|
+
const res = await client.hub.membership.getPolicies({});
|
|
9
|
+
this.print(res);
|
|
10
|
+
return res;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base.js';
|
|
2
|
+
export default class UsersRoles extends BaseCommand {
|
|
3
|
+
static description = 'List membership roles';
|
|
4
|
+
static examples = ['<%= config.bin %> users roles'];
|
|
5
|
+
async run() {
|
|
6
|
+
const { flags } = await this.parse(UsersRoles);
|
|
7
|
+
const client = this.client(flags);
|
|
8
|
+
const res = await client.hub.membership.getRoles({});
|
|
9
|
+
this.print(res);
|
|
10
|
+
return res;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class UsersUnblock extends BaseCommand {
|
|
4
|
+
static description = 'Unblock a user';
|
|
5
|
+
static examples = ['<%= config.bin %> users unblock 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({ required: true, description: 'User ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(UsersUnblock);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.api.membership.unblockUser({ id: args.id });
|
|
13
|
+
this.print(`User ${args.id} unblocked.`);
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class WebhooksDisable extends BaseCommand {
|
|
4
|
+
static description = 'Disable a webhook destination';
|
|
5
|
+
static examples = ['<%= config.bin %> webhooks disable 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
destinationId: Args.string({ required: true, description: 'Destination ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(WebhooksDisable);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.webhooks.disableWebhookDestination({
|
|
13
|
+
destinationId: args.destinationId,
|
|
14
|
+
});
|
|
15
|
+
this.print(`Destination ${args.destinationId} disabled.`);
|
|
16
|
+
return res;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base.js';
|
|
3
|
+
export default class WebhooksEnable extends BaseCommand {
|
|
4
|
+
static description = 'Enable a webhook destination';
|
|
5
|
+
static examples = ['<%= config.bin %> webhooks enable 66b2f0a1...'];
|
|
6
|
+
static args = {
|
|
7
|
+
destinationId: Args.string({ required: true, description: 'Destination ID' }),
|
|
8
|
+
};
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(WebhooksEnable);
|
|
11
|
+
const client = this.client(flags);
|
|
12
|
+
const res = await client.hub.webhooks.enableWebhookDestination({
|
|
13
|
+
destinationId: args.destinationId,
|
|
14
|
+
});
|
|
15
|
+
this.print(`Destination ${args.destinationId} enabled.`);
|
|
16
|
+
return res;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { confirm } from '@inquirer/prompts';
|
|
2
|
+
import { Args, Flags } from '@oclif/core';
|
|
3
|
+
import { BaseCommand } from '../../base.js';
|
|
4
|
+
export default class WebhooksRemove extends BaseCommand {
|
|
5
|
+
static description = 'Remove a webhook destination';
|
|
6
|
+
static examples = ['<%= config.bin %> webhooks remove 66b2f0a1... --yes'];
|
|
7
|
+
static args = {
|
|
8
|
+
destinationId: Args.string({ required: true, description: 'Destination ID' }),
|
|
9
|
+
};
|
|
10
|
+
static flags = {
|
|
11
|
+
yes: Flags.boolean({ char: 'y', description: 'Skip the confirmation prompt', default: false }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(WebhooksRemove);
|
|
15
|
+
const client = this.client(flags);
|
|
16
|
+
if (!flags.yes && process.stdout.isTTY) {
|
|
17
|
+
const ok = await confirm({
|
|
18
|
+
message: `Remove webhook destination ${args.destinationId}?`,
|
|
19
|
+
default: false,
|
|
20
|
+
});
|
|
21
|
+
if (!ok)
|
|
22
|
+
return this.print('Cancelled.');
|
|
23
|
+
}
|
|
24
|
+
const res = await client.hub.webhooks.removeWebhookDestination({
|
|
25
|
+
destinationId: args.destinationId,
|
|
26
|
+
});
|
|
27
|
+
this.print(`Destination ${args.destinationId} removed.`);
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { confirm } from '@inquirer/prompts';
|
|
2
|
+
import { Flags } from '@oclif/core';
|
|
3
|
+
import { BaseCommand } from '../../base.js';
|
|
4
|
+
export default class WebhooksSecret extends BaseCommand {
|
|
5
|
+
static description = 'Reveal the webhook signing secret, or rotate it with --rotate';
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> webhooks secret',
|
|
8
|
+
'<%= config.bin %> webhooks secret --rotate --yes',
|
|
9
|
+
];
|
|
10
|
+
static flags = {
|
|
11
|
+
rotate: Flags.boolean({ description: 'Rotate the secret (old secret stops working)', default: false }),
|
|
12
|
+
yes: Flags.boolean({ char: 'y', description: 'Skip the confirmation prompt', default: false }),
|
|
13
|
+
};
|
|
14
|
+
async run() {
|
|
15
|
+
const { flags } = await this.parse(WebhooksSecret);
|
|
16
|
+
const client = this.client(flags);
|
|
17
|
+
if (flags.rotate) {
|
|
18
|
+
if (!flags.yes && process.stdout.isTTY) {
|
|
19
|
+
const ok = await confirm({
|
|
20
|
+
message: 'Rotate the webhook secret? Consumers still verifying with the old secret will fail.',
|
|
21
|
+
default: false,
|
|
22
|
+
});
|
|
23
|
+
if (!ok)
|
|
24
|
+
return this.print('Cancelled.');
|
|
25
|
+
}
|
|
26
|
+
const res = await client.hub.webhooks.rotateWebhookIntegrationSecret();
|
|
27
|
+
this.print(res);
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
const res = await client.hub.webhooks.revealWebhookIntegrationSecret();
|
|
31
|
+
this.print(res);
|
|
32
|
+
return res;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base.js';
|
|
2
|
+
export default class WebhooksShow extends BaseCommand {
|
|
3
|
+
static description = "Show the project's webhook integration (destinations, settings)";
|
|
4
|
+
static examples = ['<%= config.bin %> webhooks show'];
|
|
5
|
+
async run() {
|
|
6
|
+
const { flags } = await this.parse(WebhooksShow);
|
|
7
|
+
const client = this.client(flags);
|
|
8
|
+
const res = await client.hub.webhooks.getWebhookIntegration();
|
|
9
|
+
this.print(res);
|
|
10
|
+
return res;
|
|
11
|
+
}
|
|
12
|
+
}
|