@eide/foir-cli 0.1.34 → 0.1.36
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/dist/cli.js +7469 -81
- package/dist/config/types.d.ts +7 -6
- package/dist/config/types.js +6 -14
- package/dist/generated-CPsQ9jfu.d.ts +195 -0
- package/dist/lib/extension-helpers.d.ts +10 -7
- package/dist/lib/extension-helpers.js +15 -85
- package/dist/lib/hook-helpers.d.ts +9 -6
- package/dist/lib/hook-helpers.js +12 -105
- package/dist/lib/seed-helpers.d.ts +10 -8
- package/dist/lib/seed-helpers.js +18 -124
- package/package.json +9 -7
- package/dist/auth/credentials.d.ts +0 -31
- package/dist/auth/credentials.d.ts.map +0 -1
- package/dist/auth/credentials.js +0 -139
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/codegen/fetch-customer-profile-schema.d.ts +0 -12
- package/dist/codegen/fetch-customer-profile-schema.d.ts.map +0 -1
- package/dist/codegen/fetch-customer-profile-schema.js +0 -21
- package/dist/codegen/fetch-models.d.ts +0 -58
- package/dist/codegen/fetch-models.d.ts.map +0 -1
- package/dist/codegen/fetch-models.js +0 -96
- package/dist/codegen/field-mapping.d.ts +0 -34
- package/dist/codegen/field-mapping.d.ts.map +0 -1
- package/dist/codegen/field-mapping.js +0 -250
- package/dist/codegen/generators/config.d.ts +0 -5
- package/dist/codegen/generators/config.d.ts.map +0 -1
- package/dist/codegen/generators/config.js +0 -82
- package/dist/codegen/generators/customer-profile-documents.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-documents.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-documents.js +0 -42
- package/dist/codegen/generators/customer-profile-hooks.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-hooks.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-hooks.js +0 -78
- package/dist/codegen/generators/customer-profile-loaders.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-loaders.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-loaders.js +0 -67
- package/dist/codegen/generators/customer-profile-operations.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-operations.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-operations.js +0 -126
- package/dist/codegen/generators/customer-profile-types.d.ts +0 -6
- package/dist/codegen/generators/customer-profile-types.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-types.js +0 -45
- package/dist/codegen/generators/documents.d.ts +0 -12
- package/dist/codegen/generators/documents.d.ts.map +0 -1
- package/dist/codegen/generators/documents.js +0 -178
- package/dist/codegen/generators/field-types.d.ts +0 -5
- package/dist/codegen/generators/field-types.d.ts.map +0 -1
- package/dist/codegen/generators/field-types.js +0 -346
- package/dist/codegen/generators/model-index.d.ts +0 -6
- package/dist/codegen/generators/model-index.d.ts.map +0 -1
- package/dist/codegen/generators/model-index.js +0 -26
- package/dist/codegen/generators/model-types.d.ts +0 -12
- package/dist/codegen/generators/model-types.d.ts.map +0 -1
- package/dist/codegen/generators/model-types.js +0 -176
- package/dist/codegen/generators/public-schema-content.d.ts +0 -14
- package/dist/codegen/generators/public-schema-content.d.ts.map +0 -1
- package/dist/codegen/generators/public-schema-content.js +0 -22
- package/dist/codegen/generators/react-hooks-index.d.ts +0 -6
- package/dist/codegen/generators/react-hooks-index.d.ts.map +0 -1
- package/dist/codegen/generators/react-hooks-index.js +0 -20
- package/dist/codegen/generators/react-hooks.d.ts +0 -7
- package/dist/codegen/generators/react-hooks.d.ts.map +0 -1
- package/dist/codegen/generators/react-hooks.js +0 -139
- package/dist/codegen/generators/remix-loaders-index.d.ts +0 -6
- package/dist/codegen/generators/remix-loaders-index.d.ts.map +0 -1
- package/dist/codegen/generators/remix-loaders-index.js +0 -20
- package/dist/codegen/generators/remix-loaders.d.ts +0 -7
- package/dist/codegen/generators/remix-loaders.d.ts.map +0 -1
- package/dist/codegen/generators/remix-loaders.js +0 -107
- package/dist/codegen/generators/static-documents.d.ts +0 -14
- package/dist/codegen/generators/static-documents.d.ts.map +0 -1
- package/dist/codegen/generators/static-documents.js +0 -771
- package/dist/codegen/generators/swift-customer-profile.d.ts +0 -9
- package/dist/codegen/generators/swift-customer-profile.d.ts.map +0 -1
- package/dist/codegen/generators/swift-customer-profile.js +0 -152
- package/dist/codegen/generators/swift-field-types.d.ts +0 -5
- package/dist/codegen/generators/swift-field-types.d.ts.map +0 -1
- package/dist/codegen/generators/swift-field-types.js +0 -151
- package/dist/codegen/generators/swift-model-keys.d.ts +0 -6
- package/dist/codegen/generators/swift-model-keys.d.ts.map +0 -1
- package/dist/codegen/generators/swift-model-keys.js +0 -25
- package/dist/codegen/generators/swift-types.d.ts +0 -13
- package/dist/codegen/generators/swift-types.d.ts.map +0 -1
- package/dist/codegen/generators/swift-types.js +0 -188
- package/dist/codegen/generators/typed-operations-common.d.ts +0 -6
- package/dist/codegen/generators/typed-operations-common.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations-common.js +0 -84
- package/dist/codegen/generators/typed-operations-index.d.ts +0 -6
- package/dist/codegen/generators/typed-operations-index.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations-index.js +0 -22
- package/dist/codegen/generators/typed-operations.d.ts +0 -11
- package/dist/codegen/generators/typed-operations.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations.js +0 -263
- package/dist/codegen/swift-field-mapping.d.ts +0 -30
- package/dist/codegen/swift-field-mapping.d.ts.map +0 -1
- package/dist/codegen/swift-field-mapping.js +0 -150
- package/dist/codegen/write-files.d.ts +0 -15
- package/dist/codegen/write-files.d.ts.map +0 -1
- package/dist/codegen/write-files.js +0 -36
- package/dist/commands/api-keys.d.ts +0 -4
- package/dist/commands/api-keys.d.ts.map +0 -1
- package/dist/commands/api-keys.js +0 -129
- package/dist/commands/auth-config.d.ts +0 -4
- package/dist/commands/auth-config.d.ts.map +0 -1
- package/dist/commands/auth-config.js +0 -38
- package/dist/commands/auth-providers.d.ts +0 -4
- package/dist/commands/auth-providers.d.ts.map +0 -1
- package/dist/commands/auth-providers.js +0 -207
- package/dist/commands/context.d.ts +0 -4
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -91
- package/dist/commands/create-extension.d.ts +0 -4
- package/dist/commands/create-extension.d.ts.map +0 -1
- package/dist/commands/create-extension.js +0 -60
- package/dist/commands/customer-profiles.d.ts +0 -4
- package/dist/commands/customer-profiles.d.ts.map +0 -1
- package/dist/commands/customer-profiles.js +0 -99
- package/dist/commands/customers.d.ts +0 -4
- package/dist/commands/customers.d.ts.map +0 -1
- package/dist/commands/customers.js +0 -126
- package/dist/commands/embeddings.d.ts +0 -4
- package/dist/commands/embeddings.d.ts.map +0 -1
- package/dist/commands/embeddings.js +0 -145
- package/dist/commands/experiments.d.ts +0 -4
- package/dist/commands/experiments.d.ts.map +0 -1
- package/dist/commands/experiments.js +0 -196
- package/dist/commands/extensions.d.ts +0 -4
- package/dist/commands/extensions.d.ts.map +0 -1
- package/dist/commands/extensions.js +0 -210
- package/dist/commands/files.d.ts +0 -4
- package/dist/commands/files.d.ts.map +0 -1
- package/dist/commands/files.js +0 -143
- package/dist/commands/hooks.d.ts +0 -4
- package/dist/commands/hooks.d.ts.map +0 -1
- package/dist/commands/hooks.js +0 -228
- package/dist/commands/locales.d.ts +0 -4
- package/dist/commands/locales.d.ts.map +0 -1
- package/dist/commands/locales.js +0 -140
- package/dist/commands/login.d.ts +0 -4
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -124
- package/dist/commands/logout.d.ts +0 -4
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -16
- package/dist/commands/media.d.ts +0 -4
- package/dist/commands/media.d.ts.map +0 -1
- package/dist/commands/media.js +0 -44
- package/dist/commands/models.d.ts +0 -4
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js +0 -153
- package/dist/commands/notes.d.ts +0 -4
- package/dist/commands/notes.d.ts.map +0 -1
- package/dist/commands/notes.js +0 -132
- package/dist/commands/notifications.d.ts +0 -4
- package/dist/commands/notifications.d.ts.map +0 -1
- package/dist/commands/notifications.js +0 -73
- package/dist/commands/operations.d.ts +0 -4
- package/dist/commands/operations.d.ts.map +0 -1
- package/dist/commands/operations.js +0 -341
- package/dist/commands/pull.d.ts +0 -4
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -300
- package/dist/commands/records.d.ts +0 -4
- package/dist/commands/records.d.ts.map +0 -1
- package/dist/commands/records.js +0 -314
- package/dist/commands/schedules.d.ts +0 -4
- package/dist/commands/schedules.d.ts.map +0 -1
- package/dist/commands/schedules.js +0 -155
- package/dist/commands/search.d.ts +0 -4
- package/dist/commands/search.d.ts.map +0 -1
- package/dist/commands/search.js +0 -60
- package/dist/commands/segments.d.ts +0 -4
- package/dist/commands/segments.d.ts.map +0 -1
- package/dist/commands/segments.js +0 -155
- package/dist/commands/select-project.d.ts +0 -4
- package/dist/commands/select-project.d.ts.map +0 -1
- package/dist/commands/select-project.js +0 -144
- package/dist/commands/settings.d.ts +0 -4
- package/dist/commands/settings.d.ts.map +0 -1
- package/dist/commands/settings.js +0 -115
- package/dist/commands/variant-catalog.d.ts +0 -4
- package/dist/commands/variant-catalog.d.ts.map +0 -1
- package/dist/commands/variant-catalog.js +0 -118
- package/dist/commands/whoami.d.ts +0 -4
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -51
- package/dist/config/pull-config.d.ts +0 -33
- package/dist/config/pull-config.d.ts.map +0 -1
- package/dist/config/pull-config.js +0 -119
- package/dist/config/types.d.ts.map +0 -1
- package/dist/graphql/generated.d.ts +0 -8330
- package/dist/graphql/generated.d.ts.map +0 -1
- package/dist/graphql/generated.js +0 -135
- package/dist/lib/client.d.ts +0 -18
- package/dist/lib/client.d.ts.map +0 -1
- package/dist/lib/client.js +0 -64
- package/dist/lib/config-loader.d.ts +0 -28
- package/dist/lib/config-loader.d.ts.map +0 -1
- package/dist/lib/config-loader.js +0 -49
- package/dist/lib/config.d.ts +0 -12
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -8
- package/dist/lib/errors.d.ts +0 -6
- package/dist/lib/errors.d.ts.map +0 -1
- package/dist/lib/errors.js +0 -76
- package/dist/lib/extension-helpers.d.ts.map +0 -1
- package/dist/lib/hook-helpers.d.ts.map +0 -1
- package/dist/lib/input.d.ts +0 -38
- package/dist/lib/input.d.ts.map +0 -1
- package/dist/lib/input.js +0 -108
- package/dist/lib/output.d.ts +0 -31
- package/dist/lib/output.d.ts.map +0 -1
- package/dist/lib/output.js +0 -107
- package/dist/lib/seed-helpers.d.ts.map +0 -1
- package/dist/scaffold/package-manager.d.ts +0 -12
- package/dist/scaffold/package-manager.d.ts.map +0 -1
- package/dist/scaffold/package-manager.js +0 -51
- package/dist/scaffold/scaffold.d.ts +0 -4
- package/dist/scaffold/scaffold.d.ts.map +0 -1
- package/dist/scaffold/scaffold.js +0 -462
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { withErrorHandler } from '../lib/errors.js';
|
|
2
|
-
import { createClient } from '../lib/client.js';
|
|
3
|
-
import { formatOutput, formatList, timeAgo, success } from '../lib/output.js';
|
|
4
|
-
import { ListNotificationsDocument, MarkNotificationReadDocument, MarkAllNotificationsReadDocument, } from '../graphql/generated.js';
|
|
5
|
-
export function registerNotificationsCommands(program, globalOpts) {
|
|
6
|
-
const notifications = program
|
|
7
|
-
.command('notifications')
|
|
8
|
-
.description('Manage notifications');
|
|
9
|
-
// list
|
|
10
|
-
notifications
|
|
11
|
-
.command('list')
|
|
12
|
-
.description('List notifications')
|
|
13
|
-
.option('--unread', 'Only unread notifications')
|
|
14
|
-
.option('--limit <n>', 'Max results', '20')
|
|
15
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
16
|
-
const opts = globalOpts();
|
|
17
|
-
const client = await createClient(opts);
|
|
18
|
-
const data = await client.request(ListNotificationsDocument, {
|
|
19
|
-
unreadOnly: !!cmdOpts.unread,
|
|
20
|
-
limit: parseInt(String(cmdOpts.limit ?? '20'), 10),
|
|
21
|
-
});
|
|
22
|
-
if (!(opts.json || opts.jsonl || opts.quiet)) {
|
|
23
|
-
console.log(`Unread: ${data.notifications.unreadCount}\n`);
|
|
24
|
-
}
|
|
25
|
-
formatList(data.notifications.items, opts, {
|
|
26
|
-
columns: [
|
|
27
|
-
{ key: 'id', header: 'ID', width: 28 },
|
|
28
|
-
{ key: 'type', header: 'Type', width: 16 },
|
|
29
|
-
{ key: 'title', header: 'Title', width: 32 },
|
|
30
|
-
{
|
|
31
|
-
key: 'isRead',
|
|
32
|
-
header: 'Read',
|
|
33
|
-
width: 6,
|
|
34
|
-
format: (v) => (v ? 'yes' : 'no'),
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
key: 'createdAt',
|
|
38
|
-
header: 'When',
|
|
39
|
-
width: 12,
|
|
40
|
-
format: (v) => timeAgo(v),
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
total: data.notifications.total,
|
|
44
|
-
});
|
|
45
|
-
}));
|
|
46
|
-
// read
|
|
47
|
-
notifications
|
|
48
|
-
.command('read <id>')
|
|
49
|
-
.description('Mark a notification as read')
|
|
50
|
-
.action(withErrorHandler(globalOpts, async (id) => {
|
|
51
|
-
const opts = globalOpts();
|
|
52
|
-
const client = await createClient(opts);
|
|
53
|
-
const data = await client.request(MarkNotificationReadDocument, { id });
|
|
54
|
-
formatOutput(data.markNotificationRead, opts);
|
|
55
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
56
|
-
success('Marked as read');
|
|
57
|
-
}));
|
|
58
|
-
// read-all
|
|
59
|
-
notifications
|
|
60
|
-
.command('read-all')
|
|
61
|
-
.description('Mark all notifications as read')
|
|
62
|
-
.action(withErrorHandler(globalOpts, async () => {
|
|
63
|
-
const opts = globalOpts();
|
|
64
|
-
const client = await createClient(opts);
|
|
65
|
-
const data = await client.request(MarkAllNotificationsReadDocument);
|
|
66
|
-
if (opts.json || opts.jsonl) {
|
|
67
|
-
formatOutput({ marked: data.markAllNotificationsRead }, opts);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
success(`Marked ${data.markAllNotificationsRead} notifications as read`);
|
|
71
|
-
}
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/commands/operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAkBtD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CA8ZN"}
|
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { withErrorHandler } from '../lib/errors.js';
|
|
2
|
-
import { createClient } from '../lib/client.js';
|
|
3
|
-
import { formatOutput, formatList, timeAgo, success } from '../lib/output.js';
|
|
4
|
-
import { parseInputData, confirmAction } from '../lib/input.js';
|
|
5
|
-
import { ListOperationsDocument, GetOperationDocument, ExecuteOperationDocument, OperationExecutionStatsDocument, DeadLetterOperationsDocument, RetryDeadLetterDocument, DismissDeadLetterDocument, CreateOperationDocument, UpdateOperationDocument, DeleteOperationDocument, } from '../graphql/generated.js';
|
|
6
|
-
export function registerOperationsCommands(program, globalOpts) {
|
|
7
|
-
const operations = program
|
|
8
|
-
.command('operations')
|
|
9
|
-
.description('Manage operations');
|
|
10
|
-
// list
|
|
11
|
-
operations
|
|
12
|
-
.command('list')
|
|
13
|
-
.description('List operations')
|
|
14
|
-
.option('--category <cat>', 'Filter by category')
|
|
15
|
-
.option('--active', 'Only active operations')
|
|
16
|
-
.option('--search <term>', 'Search by name')
|
|
17
|
-
.option('--limit <n>', 'Max results', '50')
|
|
18
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
19
|
-
const opts = globalOpts();
|
|
20
|
-
const client = await createClient(opts);
|
|
21
|
-
const data = await client.request(ListOperationsDocument, {
|
|
22
|
-
category: cmdOpts.category,
|
|
23
|
-
isActive: cmdOpts.active ? true : undefined,
|
|
24
|
-
search: cmdOpts.search,
|
|
25
|
-
limit: parseInt(String(cmdOpts.limit ?? '50'), 10),
|
|
26
|
-
});
|
|
27
|
-
formatList(data.operations.items, opts, {
|
|
28
|
-
columns: [
|
|
29
|
-
{ key: 'key', header: 'Key', width: 24 },
|
|
30
|
-
{ key: 'name', header: 'Name', width: 24 },
|
|
31
|
-
{ key: 'category', header: 'Category', width: 14 },
|
|
32
|
-
{
|
|
33
|
-
key: 'isActive',
|
|
34
|
-
header: 'Active',
|
|
35
|
-
width: 8,
|
|
36
|
-
format: (v) => (v ? 'yes' : 'no'),
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
key: 'updatedAt',
|
|
40
|
-
header: 'Updated',
|
|
41
|
-
width: 12,
|
|
42
|
-
format: (v) => timeAgo(v),
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
total: data.operations.total,
|
|
46
|
-
});
|
|
47
|
-
}));
|
|
48
|
-
// get
|
|
49
|
-
operations
|
|
50
|
-
.command('get <key>')
|
|
51
|
-
.description('Get an operation by key')
|
|
52
|
-
.action(withErrorHandler(globalOpts, async (key) => {
|
|
53
|
-
const opts = globalOpts();
|
|
54
|
-
const client = await createClient(opts);
|
|
55
|
-
const data = await client.request(GetOperationDocument, { key });
|
|
56
|
-
if (!data.operation)
|
|
57
|
-
throw new Error(`Operation "${key}" not found.`);
|
|
58
|
-
formatOutput(data.operation, opts);
|
|
59
|
-
}));
|
|
60
|
-
// execute
|
|
61
|
-
operations
|
|
62
|
-
.command('execute <key>')
|
|
63
|
-
.description('Execute an operation')
|
|
64
|
-
.option('-d, --data <json>', 'Input data as JSON')
|
|
65
|
-
.option('-f, --file <path>', 'Read input from file')
|
|
66
|
-
.option('--async', 'Execute asynchronously (shorthand for --mode async)')
|
|
67
|
-
.option('--mode <mode>', 'Execution mode: sync, async, or stream')
|
|
68
|
-
.action(withErrorHandler(globalOpts, async (key, cmdOpts) => {
|
|
69
|
-
const opts = globalOpts();
|
|
70
|
-
const client = await createClient(opts);
|
|
71
|
-
let inputData = {};
|
|
72
|
-
if (cmdOpts.data || cmdOpts.file) {
|
|
73
|
-
inputData = await parseInputData(cmdOpts);
|
|
74
|
-
}
|
|
75
|
-
// Resolve execution mode: --mode takes precedence, --async is shorthand
|
|
76
|
-
let mode;
|
|
77
|
-
if (cmdOpts.mode) {
|
|
78
|
-
mode = cmdOpts.mode.toUpperCase();
|
|
79
|
-
}
|
|
80
|
-
else if (cmdOpts.async) {
|
|
81
|
-
mode = 'ASYNC';
|
|
82
|
-
}
|
|
83
|
-
const data = await client.request(ExecuteOperationDocument, {
|
|
84
|
-
input: {
|
|
85
|
-
operationKey: key,
|
|
86
|
-
input: inputData,
|
|
87
|
-
...(mode ? { mode } : {}),
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
// For stream mode, connect to SSE endpoint and print events
|
|
91
|
-
if (mode === 'STREAM' && data.executeOperation.executionId) {
|
|
92
|
-
const executionId = data.executeOperation.executionId;
|
|
93
|
-
if (!(opts.json || opts.jsonl || opts.quiet)) {
|
|
94
|
-
console.log(`Streaming execution ${executionId}…`);
|
|
95
|
-
}
|
|
96
|
-
const baseUrl = opts.apiUrl ??
|
|
97
|
-
process.env.FOIR_API_URL ??
|
|
98
|
-
'http://localhost:4000';
|
|
99
|
-
const sseUrl = `${baseUrl}/api/operations/${executionId}/stream`;
|
|
100
|
-
const response = await fetch(sseUrl);
|
|
101
|
-
if (!response.ok || !response.body) {
|
|
102
|
-
throw new Error(`Failed to connect to stream: ${response.status}`);
|
|
103
|
-
}
|
|
104
|
-
const reader = response.body.getReader();
|
|
105
|
-
const decoder = new TextDecoder();
|
|
106
|
-
let buffer = '';
|
|
107
|
-
while (true) {
|
|
108
|
-
const { done, value } = await reader.read();
|
|
109
|
-
if (done)
|
|
110
|
-
break;
|
|
111
|
-
buffer += decoder.decode(value, { stream: true });
|
|
112
|
-
const lines = buffer.split('\n');
|
|
113
|
-
buffer = lines.pop() ?? '';
|
|
114
|
-
for (const line of lines) {
|
|
115
|
-
if (line.startsWith('data: ')) {
|
|
116
|
-
const eventData = JSON.parse(line.slice(6));
|
|
117
|
-
if (opts.json || opts.jsonl) {
|
|
118
|
-
console.log(JSON.stringify(eventData));
|
|
119
|
-
}
|
|
120
|
-
else if (!opts.quiet) {
|
|
121
|
-
const ev = eventData;
|
|
122
|
-
if (ev.event === 'chunk') {
|
|
123
|
-
process.stdout.write(String(ev.data ?? ''));
|
|
124
|
-
}
|
|
125
|
-
else if (ev.event === 'progress') {
|
|
126
|
-
console.log(`[progress] ${JSON.stringify(ev.data)}`);
|
|
127
|
-
}
|
|
128
|
-
else if (ev.event === 'error') {
|
|
129
|
-
console.error(`[error] ${JSON.stringify(ev.data)}`);
|
|
130
|
-
}
|
|
131
|
-
else if (ev.event === 'result') {
|
|
132
|
-
console.log(JSON.stringify(ev.data, null, 2));
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (eventData.done)
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
if (!(opts.json || opts.jsonl || opts.quiet)) {
|
|
141
|
-
success('Stream completed');
|
|
142
|
-
}
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
formatOutput(data.executeOperation, opts);
|
|
146
|
-
if (!(opts.json || opts.jsonl || opts.quiet)) {
|
|
147
|
-
const result = data.executeOperation;
|
|
148
|
-
if (result.success) {
|
|
149
|
-
success(`Operation completed in ${result.durationMs}ms`);
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
const err = result.error;
|
|
153
|
-
console.error(`Operation failed: ${err?.message ?? 'Unknown error'}`);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}));
|
|
157
|
-
// quota
|
|
158
|
-
operations
|
|
159
|
-
.command('quota <key>')
|
|
160
|
-
.description('Show quota usage for an operation')
|
|
161
|
-
.option('--json', 'JSON output')
|
|
162
|
-
.action(withErrorHandler(globalOpts, async (key) => {
|
|
163
|
-
const opts = globalOpts();
|
|
164
|
-
const client = await createClient(opts);
|
|
165
|
-
// First get the operation to see its quota rules
|
|
166
|
-
const opData = await client.request(GetOperationDocument, { key });
|
|
167
|
-
if (!opData.operation)
|
|
168
|
-
throw new Error(`Operation "${key}" not found.`);
|
|
169
|
-
const quotas = opData.operation.quotas;
|
|
170
|
-
if (!quotas || quotas.length === 0) {
|
|
171
|
-
if (opts.json || opts.jsonl)
|
|
172
|
-
formatOutput({
|
|
173
|
-
operationKey: key,
|
|
174
|
-
quotas: [],
|
|
175
|
-
message: 'No quotas configured',
|
|
176
|
-
}, opts);
|
|
177
|
-
else
|
|
178
|
-
console.log('No quotas configured for this operation.');
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
if (opts.json || opts.jsonl) {
|
|
182
|
-
formatOutput({ operationKey: key, quotas }, opts);
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
console.log(`\nQuota rules for "${key}":\n`);
|
|
186
|
-
const header = [
|
|
187
|
-
'Segment'.padEnd(20),
|
|
188
|
-
'Scope'.padEnd(10),
|
|
189
|
-
'Limit'.padEnd(8),
|
|
190
|
-
'Window'.padEnd(10),
|
|
191
|
-
].join(' | ');
|
|
192
|
-
console.log(header);
|
|
193
|
-
console.log('-'.repeat(header.length));
|
|
194
|
-
for (const q of quotas) {
|
|
195
|
-
const segment = q.segmentKey ?? '(default)';
|
|
196
|
-
const limit = q.points === 0 ? '\u221e' : String(q.points);
|
|
197
|
-
const window = q.duration >= 86400
|
|
198
|
-
? `${q.duration / 86400}d`
|
|
199
|
-
: q.duration >= 3600
|
|
200
|
-
? `${q.duration / 3600}h`
|
|
201
|
-
: `${q.duration}s`;
|
|
202
|
-
console.log([
|
|
203
|
-
segment.padEnd(20),
|
|
204
|
-
q.scope.padEnd(10),
|
|
205
|
-
limit.padEnd(8),
|
|
206
|
-
window.padEnd(10),
|
|
207
|
-
].join(' | '));
|
|
208
|
-
}
|
|
209
|
-
console.log('');
|
|
210
|
-
}
|
|
211
|
-
}));
|
|
212
|
-
// stats
|
|
213
|
-
operations
|
|
214
|
-
.command('stats <key>')
|
|
215
|
-
.description('Get execution statistics for an operation')
|
|
216
|
-
.action(withErrorHandler(globalOpts, async (key) => {
|
|
217
|
-
const opts = globalOpts();
|
|
218
|
-
const client = await createClient(opts);
|
|
219
|
-
const data = await client.request(OperationExecutionStatsDocument, {
|
|
220
|
-
operationKey: key,
|
|
221
|
-
});
|
|
222
|
-
formatOutput(data.operationExecutionStats, opts);
|
|
223
|
-
}));
|
|
224
|
-
// dead-letters
|
|
225
|
-
operations
|
|
226
|
-
.command('dead-letters')
|
|
227
|
-
.description('List failed operations in the dead letter queue')
|
|
228
|
-
.option('--operation <key>', 'Filter by operation key')
|
|
229
|
-
.option('--status <status>', 'Filter by status (PENDING, RETRIED, DISMISSED)')
|
|
230
|
-
.option('--limit <n>', 'Max results', '20')
|
|
231
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
232
|
-
const opts = globalOpts();
|
|
233
|
-
const client = await createClient(opts);
|
|
234
|
-
const data = await client.request(DeadLetterOperationsDocument, {
|
|
235
|
-
operationKey: cmdOpts.operation,
|
|
236
|
-
status: cmdOpts.status,
|
|
237
|
-
limit: parseInt(cmdOpts.limit ?? '20', 10),
|
|
238
|
-
});
|
|
239
|
-
formatList(data.deadLetterOperations.items, opts, {
|
|
240
|
-
columns: [
|
|
241
|
-
{ key: 'id', header: 'ID', width: 28 },
|
|
242
|
-
{ key: 'operationKey', header: 'Operation', width: 20 },
|
|
243
|
-
{ key: 'attempts', header: 'Tries', width: 6 },
|
|
244
|
-
{ key: 'lastError', header: 'Error', width: 36 },
|
|
245
|
-
{ key: 'status', header: 'Status', width: 10 },
|
|
246
|
-
{
|
|
247
|
-
key: 'failedAt',
|
|
248
|
-
header: 'Failed',
|
|
249
|
-
width: 12,
|
|
250
|
-
format: (v) => timeAgo(v),
|
|
251
|
-
},
|
|
252
|
-
],
|
|
253
|
-
total: data.deadLetterOperations.total,
|
|
254
|
-
});
|
|
255
|
-
}));
|
|
256
|
-
// retry-dead-letter
|
|
257
|
-
operations
|
|
258
|
-
.command('retry-dead-letter <id>')
|
|
259
|
-
.description('Retry a failed dead letter operation')
|
|
260
|
-
.action(withErrorHandler(globalOpts, async (id) => {
|
|
261
|
-
const opts = globalOpts();
|
|
262
|
-
const client = await createClient(opts);
|
|
263
|
-
const data = await client.request(RetryDeadLetterDocument, { id });
|
|
264
|
-
formatOutput(data.retryDeadLetterOperation, opts);
|
|
265
|
-
if (!(opts.json || opts.jsonl || opts.quiet)) {
|
|
266
|
-
const r = data.retryDeadLetterOperation;
|
|
267
|
-
if (r.success)
|
|
268
|
-
success('Retry succeeded');
|
|
269
|
-
else
|
|
270
|
-
console.error('Retry failed');
|
|
271
|
-
}
|
|
272
|
-
}));
|
|
273
|
-
// dismiss-dead-letter
|
|
274
|
-
operations
|
|
275
|
-
.command('dismiss-dead-letter <id>')
|
|
276
|
-
.description('Dismiss a dead letter operation without retrying')
|
|
277
|
-
.action(withErrorHandler(globalOpts, async (id) => {
|
|
278
|
-
const opts = globalOpts();
|
|
279
|
-
const client = await createClient(opts);
|
|
280
|
-
const data = await client.request(DismissDeadLetterDocument, { id });
|
|
281
|
-
formatOutput(data.dismissDeadLetterOperation, opts);
|
|
282
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
283
|
-
success(`Dismissed dead letter ${id}`);
|
|
284
|
-
}));
|
|
285
|
-
// create
|
|
286
|
-
operations
|
|
287
|
-
.command('create')
|
|
288
|
-
.description('Create an operation')
|
|
289
|
-
.option('-d, --data <json>', 'Operation data as JSON')
|
|
290
|
-
.option('-f, --file <path>', 'Read input from file')
|
|
291
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
292
|
-
const opts = globalOpts();
|
|
293
|
-
const client = await createClient(opts);
|
|
294
|
-
const input = await parseInputData(cmdOpts);
|
|
295
|
-
const data = await client.request(CreateOperationDocument, {
|
|
296
|
-
input,
|
|
297
|
-
});
|
|
298
|
-
formatOutput(data.createOperation, opts);
|
|
299
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
300
|
-
success(`Created operation "${data.createOperation.key}"`);
|
|
301
|
-
}));
|
|
302
|
-
// update
|
|
303
|
-
operations
|
|
304
|
-
.command('update <key>')
|
|
305
|
-
.description('Update an operation')
|
|
306
|
-
.option('-d, --data <json>', 'Update data as JSON')
|
|
307
|
-
.option('-f, --file <path>', 'Read input from file')
|
|
308
|
-
.action(withErrorHandler(globalOpts, async (key, cmdOpts) => {
|
|
309
|
-
const opts = globalOpts();
|
|
310
|
-
const client = await createClient(opts);
|
|
311
|
-
const input = await parseInputData(cmdOpts);
|
|
312
|
-
const data = await client.request(UpdateOperationDocument, {
|
|
313
|
-
key,
|
|
314
|
-
input,
|
|
315
|
-
});
|
|
316
|
-
formatOutput(data.updateOperation, opts);
|
|
317
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
318
|
-
success(`Updated operation "${key}"`);
|
|
319
|
-
}));
|
|
320
|
-
// delete
|
|
321
|
-
operations
|
|
322
|
-
.command('delete <key>')
|
|
323
|
-
.description('Delete an operation')
|
|
324
|
-
.option('--confirm', 'Skip confirmation prompt')
|
|
325
|
-
.action(withErrorHandler(globalOpts, async (key, cmdOpts) => {
|
|
326
|
-
const opts = globalOpts();
|
|
327
|
-
const confirmed = await confirmAction(`Delete operation "${key}"?`, {
|
|
328
|
-
confirm: !!cmdOpts.confirm,
|
|
329
|
-
});
|
|
330
|
-
if (!confirmed) {
|
|
331
|
-
console.log('Aborted.');
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
const client = await createClient(opts);
|
|
335
|
-
await client.request(DeleteOperationDocument, { key });
|
|
336
|
-
if (opts.json || opts.jsonl)
|
|
337
|
-
formatOutput({ deleted: true, key }, opts);
|
|
338
|
-
else
|
|
339
|
-
success(`Deleted operation "${key}"`);
|
|
340
|
-
}));
|
|
341
|
-
}
|
package/dist/commands/pull.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/commands/pull.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAyCtD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAyUN"}
|