@instantkom/cli 3.129.2 → 3.131.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/README.md +29 -0
- package/bin/run.js +0 -0
- package/dist/api-client.js +28 -5
- package/dist/command-helpers/download.d.ts +10 -0
- package/dist/command-helpers/download.js +10 -0
- package/dist/command-helpers/json.d.ts +4 -0
- package/dist/command-helpers/json.js +37 -0
- package/dist/commands/account/get.d.ts +14 -0
- package/dist/commands/account/get.js +14 -0
- package/dist/commands/account/update.d.ts +23 -0
- package/dist/commands/account/update.js +37 -0
- package/dist/commands/auth/login.js +0 -2
- package/dist/commands/auth/logout.js +0 -2
- package/dist/commands/auth/tokens/create.js +0 -2
- package/dist/commands/auth/tokens/list.js +0 -2
- package/dist/commands/auth/tokens/revoke.js +0 -2
- package/dist/commands/bots/env-vars/create.d.ts +1 -1
- package/dist/commands/bots/env-vars/create.js +18 -11
- package/dist/commands/bots/filters/create.d.ts +5 -5
- package/dist/commands/bots/filters/create.js +33 -18
- package/dist/commands/broadcast/delete.d.ts +20 -0
- package/dist/commands/broadcast/delete.js +18 -0
- package/dist/commands/broadcast/get.d.ts +20 -0
- package/dist/commands/broadcast/get.js +18 -0
- package/dist/commands/broadcast/list.d.ts +21 -0
- package/dist/commands/broadcast/list.js +39 -0
- package/dist/commands/broadcast/send.d.ts +20 -0
- package/dist/commands/broadcast/send.js +18 -0
- package/dist/commands/broadcast/status.d.ts +20 -0
- package/dist/commands/broadcast/status.js +31 -0
- package/dist/commands/broadcast/update.d.ts +30 -0
- package/dist/commands/broadcast/update.js +47 -0
- package/dist/commands/chats/get.d.ts +20 -0
- package/dist/commands/chats/get.js +18 -0
- package/dist/commands/chats/list.d.ts +22 -0
- package/dist/commands/chats/list.js +40 -0
- package/dist/commands/config/get.js +0 -2
- package/dist/commands/config/set.js +0 -2
- package/dist/commands/config/unset.js +0 -2
- package/dist/commands/contacts/custom-fields/delete-value.d.ts +24 -0
- package/dist/commands/contacts/custom-fields/delete-value.js +32 -0
- package/dist/commands/contacts/custom-fields/list.d.ts +20 -0
- package/dist/commands/contacts/custom-fields/list.js +24 -0
- package/dist/commands/contacts/custom-fields/set-value.d.ts +25 -0
- package/dist/commands/contacts/custom-fields/set-value.js +32 -0
- package/dist/commands/contacts/custom-fields/set.d.ts +23 -0
- package/dist/commands/contacts/custom-fields/set.js +42 -0
- package/dist/commands/contacts/tags/add.d.ts +24 -0
- package/dist/commands/contacts/tags/add.js +30 -0
- package/dist/commands/contacts/tags/list.d.ts +20 -0
- package/dist/commands/contacts/tags/list.js +24 -0
- package/dist/commands/contacts/tags/remove.d.ts +24 -0
- package/dist/commands/contacts/tags/remove.js +32 -0
- package/dist/commands/custom-fields/bulk-delete.d.ts +15 -0
- package/dist/commands/custom-fields/bulk-delete.js +24 -0
- package/dist/commands/custom-fields/create.d.ts +21 -0
- package/dist/commands/custom-fields/create.js +47 -0
- package/dist/commands/custom-fields/delete.d.ts +20 -0
- package/dist/commands/custom-fields/delete.js +18 -0
- package/dist/commands/custom-fields/get.d.ts +20 -0
- package/dist/commands/custom-fields/get.js +18 -0
- package/dist/commands/custom-fields/list.d.ts +14 -0
- package/dist/commands/custom-fields/list.js +14 -0
- package/dist/commands/custom-fields/reorder.d.ts +15 -0
- package/dist/commands/custom-fields/reorder.js +22 -0
- package/dist/commands/custom-fields/update.d.ts +27 -0
- package/dist/commands/custom-fields/update.js +52 -0
- package/dist/commands/doctor.d.ts +14 -0
- package/dist/commands/doctor.js +56 -0
- package/dist/commands/features.d.ts +14 -0
- package/dist/commands/features.js +19 -0
- package/dist/commands/messages/bulk-spam.d.ts +16 -0
- package/dist/commands/messages/bulk-spam.js +30 -0
- package/dist/commands/messages/create-ticket.d.ts +23 -0
- package/dist/commands/messages/create-ticket.js +28 -0
- package/dist/commands/messages/delete.d.ts +20 -0
- package/dist/commands/messages/delete.js +18 -0
- package/dist/commands/messages/get.d.ts +20 -0
- package/dist/commands/messages/get.js +18 -0
- package/dist/commands/messages/list.d.ts +22 -0
- package/dist/commands/messages/list.js +35 -0
- package/dist/commands/messages/reactions.d.ts +20 -0
- package/dist/commands/messages/reactions.js +18 -0
- package/dist/commands/messages/spam.d.ts +21 -0
- package/dist/commands/messages/spam.js +27 -0
- package/dist/commands/messages/unread-count.d.ts +14 -0
- package/dist/commands/messages/unread-count.js +14 -0
- package/dist/commands/messages/update.d.ts +27 -0
- package/dist/commands/messages/update.js +43 -0
- package/dist/commands/permissions.d.ts +14 -0
- package/dist/commands/permissions.js +14 -0
- package/dist/commands/segments/create.d.ts +21 -0
- package/dist/commands/segments/create.js +33 -0
- package/dist/commands/segments/delete.d.ts +20 -0
- package/dist/commands/segments/delete.js +18 -0
- package/dist/commands/segments/get.d.ts +20 -0
- package/dist/commands/segments/get.js +18 -0
- package/dist/commands/segments/list.d.ts +20 -0
- package/dist/commands/segments/list.js +34 -0
- package/dist/commands/segments/tags/add.d.ts +24 -0
- package/dist/commands/segments/tags/add.js +21 -0
- package/dist/commands/segments/tags/list.d.ts +20 -0
- package/dist/commands/segments/tags/list.js +18 -0
- package/dist/commands/segments/tags/remove.d.ts +24 -0
- package/dist/commands/segments/tags/remove.js +23 -0
- package/dist/commands/segments/update.d.ts +26 -0
- package/dist/commands/segments/update.js +34 -0
- package/dist/commands/tags/create.d.ts +19 -0
- package/dist/commands/tags/create.js +29 -0
- package/dist/commands/tags/delete.d.ts +20 -0
- package/dist/commands/tags/delete.js +16 -0
- package/dist/commands/tags/export.d.ts +15 -0
- package/dist/commands/tags/export.js +27 -0
- package/dist/commands/tags/get.d.ts +20 -0
- package/dist/commands/tags/get.js +16 -0
- package/dist/commands/tags/import.d.ts +16 -0
- package/dist/commands/tags/import.js +29 -0
- package/dist/commands/tags/list.d.ts +18 -0
- package/dist/commands/tags/list.js +27 -0
- package/dist/commands/tags/recipients/add.d.ts +21 -0
- package/dist/commands/tags/recipients/add.js +27 -0
- package/dist/commands/tags/recipients/remove.d.ts +21 -0
- package/dist/commands/tags/recipients/remove.js +27 -0
- package/dist/commands/tags/update.d.ts +25 -0
- package/dist/commands/tags/update.js +30 -0
- package/dist/commands/tags/validate-import.d.ts +15 -0
- package/dist/commands/tags/validate-import.js +21 -0
- package/dist/commands/team/create.d.ts +23 -0
- package/dist/commands/team/create.js +37 -0
- package/dist/commands/team/delete.d.ts +20 -0
- package/dist/commands/team/delete.js +18 -0
- package/dist/commands/team/list.d.ts +14 -0
- package/dist/commands/team/list.js +14 -0
- package/dist/commands/templates/create.d.ts +24 -0
- package/dist/commands/templates/create.js +63 -0
- package/dist/commands/templates/delete.d.ts +20 -0
- package/dist/commands/templates/delete.js +18 -0
- package/dist/commands/templates/export.d.ts +16 -0
- package/dist/commands/templates/export.js +29 -0
- package/dist/commands/templates/import.d.ts +17 -0
- package/dist/commands/templates/import.js +34 -0
- package/dist/commands/templates/update.d.ts +30 -0
- package/dist/commands/templates/update.js +61 -0
- package/dist/commands/templates/validate-import.d.ts +16 -0
- package/dist/commands/templates/validate-import.js +28 -0
- package/dist/commands/tickets/reply.d.ts +22 -0
- package/dist/commands/tickets/reply.js +36 -0
- package/dist/commands/tickets/update.d.ts +2 -0
- package/dist/commands/tickets/update.js +16 -0
- package/dist/commands/webhooks/events.d.ts +14 -0
- package/dist/commands/webhooks/events.js +18 -0
- package/dist/commands/webhooks/logs.d.ts +14 -0
- package/dist/commands/webhooks/logs.js +11 -0
- package/dist/commands/webhooks/test.d.ts +17 -0
- package/dist/commands/webhooks/test.js +27 -0
- package/dist/commands/whoami.js +0 -2
- package/dist/crud/csv.js +2 -1
- package/dist/errors/api-error.d.ts +1 -1
- package/dist/errors/exit-codes.js +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +8672 -1602
- package/package.json +38 -5
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class WebhooksEvents extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
const EVENTS = [
|
|
3
|
+
'new_contact',
|
|
4
|
+
'new_message',
|
|
5
|
+
'broadcast_sent',
|
|
6
|
+
'contact_updated',
|
|
7
|
+
'contact_opted_out',
|
|
8
|
+
];
|
|
9
|
+
export default class WebhooksEvents extends BaseCommand {
|
|
10
|
+
static description = 'List supported webhook event names';
|
|
11
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
12
|
+
async run() {
|
|
13
|
+
const { flags } = await this.parse(WebhooksEvents);
|
|
14
|
+
this.flags = flags;
|
|
15
|
+
if (!flags.quiet)
|
|
16
|
+
this.log(this.toFormatted(EVENTS.map((event) => ({ event }))));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class WebhooksLogs extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
import { ApiError } from '../../errors/api-error.js';
|
|
3
|
+
export default class WebhooksLogs extends BaseCommand {
|
|
4
|
+
static description = 'Explain webhook log availability';
|
|
5
|
+
static flags = { ...BaseCommand.baseFlags };
|
|
6
|
+
async run() {
|
|
7
|
+
const { flags } = await this.parse(WebhooksLogs);
|
|
8
|
+
this.flags = flags;
|
|
9
|
+
throw new ApiError('user_error', 'Webhook delivery logs are not exposed by the Public API yet. Use webhooks test for endpoint validation and server logs for delivery forensics.');
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class WebhooksTest extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
url: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
event: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
payload: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
'no-color': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { ApiClient } from '../../api-client.js';
|
|
4
|
+
import { parseJsonValue } from '../../command-helpers/json.js';
|
|
5
|
+
export default class WebhooksTest extends BaseCommand {
|
|
6
|
+
static description = 'Send a test webhook payload to a URL';
|
|
7
|
+
static flags = {
|
|
8
|
+
...BaseCommand.baseFlags,
|
|
9
|
+
url: Flags.string({ description: 'Webhook URL to call', required: true }),
|
|
10
|
+
event: Flags.string({ description: 'Event name', default: 'cli.test' }),
|
|
11
|
+
payload: Flags.string({ description: 'Payload JSON' }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags } = await this.parse(WebhooksTest);
|
|
15
|
+
this.flags = flags;
|
|
16
|
+
const payload = flags.payload
|
|
17
|
+
? parseJsonValue(flags.payload, '--payload')
|
|
18
|
+
: {
|
|
19
|
+
event: flags.event,
|
|
20
|
+
source: 'instantkom-cli',
|
|
21
|
+
sentAt: new Date().toISOString(),
|
|
22
|
+
};
|
|
23
|
+
const result = await ApiClient.postRaw(flags.url, payload);
|
|
24
|
+
if (!flags.quiet)
|
|
25
|
+
this.log(this.toFormatted(result));
|
|
26
|
+
}
|
|
27
|
+
}
|
package/dist/commands/whoami.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BaseCommand } from '../base-command.js';
|
|
2
|
-
import { EXIT_CODES } from '../errors/exit-codes.js';
|
|
3
2
|
import { ApiError } from '../errors/api-error.js';
|
|
4
3
|
import { resolveToken } from '../auth/token-resolver.js';
|
|
5
4
|
import { ApiClient } from '../api-client.js';
|
|
@@ -35,6 +34,5 @@ export default class Whoami extends BaseCommand {
|
|
|
35
34
|
channel_count: me.channel_count ?? 0,
|
|
36
35
|
};
|
|
37
36
|
this.log(this.toFormatted(output));
|
|
38
|
-
this.exit(EXIT_CODES.OK);
|
|
39
37
|
}
|
|
40
38
|
}
|
package/dist/crud/csv.js
CHANGED
|
@@ -65,7 +65,8 @@ function serializeValue(value) {
|
|
|
65
65
|
if (value === undefined || value === null) {
|
|
66
66
|
return '';
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const rawText = typeof value === 'object' ? JSON.stringify(value) : String(value);
|
|
69
|
+
const text = /^[=+\-@\t\r]/.test(rawText) ? `'${rawText}` : rawText;
|
|
69
70
|
if (/[",\r\n]/.test(text)) {
|
|
70
71
|
return `"${text.replaceAll('"', '""')}"`;
|
|
71
72
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ApiErrorKind = 'unauthorized' | 'rate_limited' | 'server_error' | 'network' | 'user_error';
|
|
1
|
+
export type ApiErrorKind = 'unauthorized' | 'forbidden' | 'rate_limited' | 'server_error' | 'network' | 'user_error';
|
|
2
2
|
export declare class ApiError extends Error {
|
|
3
3
|
kind: ApiErrorKind;
|
|
4
4
|
status?: number | undefined;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instantkom/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.131.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@instantkom/cli",
|
|
9
|
-
"version": "3.
|
|
9
|
+
"version": "3.131.0",
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@oclif/core": "^4",
|