@dcupl/cli 1.4.0-beta.9 → 1.4.1
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 +10 -3
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +73 -53
- package/dist/cli.js.map +1 -1
- package/dist/functions/app/commands/data/render.d.ts +3 -1
- package/dist/functions/app/commands/data/render.js +9 -1
- package/dist/functions/app/commands/data/render.js.map +1 -1
- package/dist/functions/app/commands/fn/group-by.js +4 -2
- package/dist/functions/app/commands/fn/group-by.js.map +1 -1
- package/dist/functions/app/commands/loaders/remove.js +2 -0
- package/dist/functions/app/commands/loaders/remove.js.map +1 -1
- package/dist/functions/app/commands/query/execute.js +2 -13
- package/dist/functions/app/commands/query/execute.js.map +1 -1
- package/dist/functions/app/commands/query-input.d.ts +1 -0
- package/dist/functions/app/commands/query-input.js +15 -2
- package/dist/functions/app/commands/query-input.js.map +1 -1
- package/dist/functions/app/commands/sort-input.d.ts +5 -0
- package/dist/functions/app/commands/sort-input.js +34 -0
- package/dist/functions/app/commands/sort-input.js.map +1 -0
- package/dist/functions/app/daemon/controllers/data.controller.d.ts +3 -4
- package/dist/functions/app/daemon/controllers/data.controller.js +2 -2
- package/dist/functions/app/daemon/controllers/data.controller.js.map +1 -1
- package/dist/functions/app/daemon/controllers/loaders.controller.js +1 -1
- package/dist/functions/app/daemon/controllers/loaders.controller.js.map +1 -1
- package/dist/functions/app/daemon/services/csv-delimiter.d.ts +15 -0
- package/dist/functions/app/daemon/services/csv-delimiter.js +99 -0
- package/dist/functions/app/daemon/services/csv-delimiter.js.map +1 -0
- package/dist/functions/app/daemon/services/dcupl-host.service.d.ts +15 -2
- package/dist/functions/app/daemon/services/dcupl-host.service.js +127 -13
- package/dist/functions/app/daemon/services/dcupl-host.service.js.map +1 -1
- package/dist/functions/app/daemon/services/group-sort.d.ts +25 -0
- package/dist/functions/app/daemon/services/group-sort.js +130 -0
- package/dist/functions/app/daemon/services/group-sort.js.map +1 -0
- package/dist/functions/app/daemon/services/ingest.service.d.ts +1 -0
- package/dist/functions/app/daemon/services/ingest.service.js +9 -7
- package/dist/functions/app/daemon/services/ingest.service.js.map +1 -1
- package/dist/functions/app/daemon/services/loaders.service.d.ts +1 -1
- package/dist/functions/app/daemon/services/loaders.service.js +7 -1
- package/dist/functions/app/daemon/services/loaders.service.js.map +1 -1
- package/dist/functions/app/daemon/services/normalize-query.d.ts +11 -2
- package/dist/functions/app/daemon/services/normalize-query.js +55 -4
- package/dist/functions/app/daemon/services/normalize-query.js.map +1 -1
- package/dist/functions/app/daemon/services/staged-keys.d.ts +12 -0
- package/dist/functions/app/daemon/services/staged-keys.js +72 -0
- package/dist/functions/app/daemon/services/staged-keys.js.map +1 -0
- package/dist/functions/config/commands/set.js +2 -2
- package/dist/functions/config/commands/set.js.map +1 -1
- package/dist/functions/config/prompts.d.ts +2 -1
- package/dist/functions/config/prompts.js.map +1 -1
- package/dist/functions/files/commands/pull.js +2 -3
- package/dist/functions/files/commands/pull.js.map +1 -1
- package/dist/functions/files/helper/confirm.js +2 -3
- package/dist/functions/files/helper/confirm.js.map +1 -1
- package/dist/functions/generate/files/generate-code.js +0 -1
- package/dist/functions/generate/files/generate-code.js.map +1 -1
- package/dist/functions/generate/files/generate-files.d.ts +10 -1
- package/dist/functions/generate/files/generate-files.js +155 -44
- package/dist/functions/generate/files/generate-files.js.map +1 -1
- package/dist/functions/generate/files/generate-schema.js +1 -1
- package/dist/functions/generate/files/generate-schema.js.map +1 -1
- package/dist/functions/generate/files/generate.helper.d.ts +9 -3
- package/dist/functions/generate/files/generate.helper.js +11 -8
- package/dist/functions/generate/files/generate.helper.js.map +1 -1
- package/dist/functions/generate/files/rest-api-template.d.ts +16 -0
- package/dist/functions/generate/files/rest-api-template.js +63 -0
- package/dist/functions/generate/files/rest-api-template.js.map +1 -0
- package/dist/functions/generate/files/script-starters.d.ts +7 -0
- package/dist/functions/generate/files/script-starters.js +75 -0
- package/dist/functions/generate/files/script-starters.js.map +1 -0
- package/dist/functions/generate/files/workflow-presets.js +2 -1
- package/dist/functions/generate/files/workflow-presets.js.map +1 -1
- package/dist/functions/generate/model-from-data/generate-model-from-data.d.ts +1 -0
- package/dist/functions/generate/model-from-data/generate-model-from-data.js +67 -4
- package/dist/functions/generate/model-from-data/generate-model-from-data.js.map +1 -1
- package/dist/functions/generate/projects/generate-project.js +9 -11
- package/dist/functions/generate/projects/generate-project.js.map +1 -1
- package/dist/functions/helper/api-client.d.ts +1 -0
- package/dist/functions/helper/api-client.js +8 -2
- package/dist/functions/helper/api-client.js.map +1 -1
- package/dist/functions/helper/config.helper.js +1 -1
- package/dist/functions/helper/config.helper.js.map +1 -1
- package/dist/functions/helper/prompt.d.ts +2 -0
- package/dist/functions/helper/prompt.js +8 -0
- package/dist/functions/helper/prompt.js.map +1 -0
- package/dist/functions/schemas/examples/ResponseScriptConfig.example.json +1 -1
- package/dist/functions/schemas/examples/RestApiTemplate.example.json +30 -0
- package/dist/functions/schemas/format.js +3 -1
- package/dist/functions/schemas/format.js.map +1 -1
- package/dist/functions/schemas/registry.d.ts +2 -1
- package/dist/functions/schemas/registry.js +15 -3
- package/dist/functions/schemas/registry.js.map +1 -1
- package/dist/functions/schemas/resolve.d.ts +1 -0
- package/dist/functions/schemas/resolve.js +32 -1
- package/dist/functions/schemas/resolve.js.map +1 -1
- package/dist/functions/serve/dev-server/request-security.js +1 -0
- package/dist/functions/serve/dev-server/request-security.js.map +1 -1
- package/dist/functions/workflow/commands/run.d.ts +2 -8
- package/dist/functions/workflow/commands/run.js +5 -14
- package/dist/functions/workflow/commands/run.js.map +1 -1
- package/dist/functions/workflow/commands/test.d.ts +2 -8
- package/dist/functions/workflow/commands/test.js +5 -12
- package/dist/functions/workflow/commands/test.js.map +1 -1
- package/dist/functions/workflow/wait-for-swap.js +1 -1
- package/dist/functions/workflow/wait-for-swap.js.map +1 -1
- package/dist/functions/workflow/workflow-api.d.ts +7 -7
- package/dist/functions/workflow/workflow-api.js +28 -15
- package/dist/functions/workflow/workflow-api.js.map +1 -1
- package/files/common/_gitignore +2 -1
- package/package.json +16 -17
package/README.md
CHANGED
|
@@ -10,9 +10,9 @@ sync.
|
|
|
10
10
|
|
|
11
11
|
### Commands
|
|
12
12
|
|
|
13
|
-
- `dcupl files status [--
|
|
14
|
-
- `dcupl files push [--
|
|
15
|
-
- `dcupl files pull [--
|
|
13
|
+
- `dcupl files status [--version <versionId>]` — show local vs server differences. Read-only.
|
|
14
|
+
- `dcupl files push [--version <versionId>] [--strict] [--yes] [--force]` — upload changed files to an existing version. Named versions are created in the console; `files push` does not create them and rejects `--name`.
|
|
15
|
+
- `dcupl files pull [--version <versionId>] [--strict] [--yes] [--force]` — download changed files. Switches versions when `--version` differs from the current HEAD.
|
|
16
16
|
|
|
17
17
|
### Flag convention
|
|
18
18
|
|
|
@@ -96,6 +96,13 @@ Provide `apiKey` / `projectId` via (highest priority first):
|
|
|
96
96
|
|
|
97
97
|
`dcupl config set` writes to `dcupl.secrets.json` if present, else to `.env`.
|
|
98
98
|
|
|
99
|
+
## Project scripts run in your own process
|
|
100
|
+
|
|
101
|
+
Project scripts (custom operators, sort scripts and `endpoint` scripts) run with
|
|
102
|
+
`new Function` in your own process when `dcupl app` loads a project, with the same
|
|
103
|
+
access to your files, network and environment as any npm script: only run projects
|
|
104
|
+
you trust. The hosted dcupl runners sandbox the same scripts; the CLI does not.
|
|
105
|
+
|
|
99
106
|
## CLI Lifecycle Contract
|
|
100
107
|
|
|
101
108
|
The dcupl CLI mirrors the dcupl SDK's declarative model: the SDK separates
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
+
export declare const APP_SCRIPTS_TRUST_NOTE: string;
|
|
3
|
+
export declare const FILES_PUSH_NAME_UNSUPPORTED = "Named versions are created in the console; `--name` is not supported by `files push`";
|
|
2
4
|
export declare function buildCli(rawArgs: string[]): yargs.Argv<{
|
|
3
5
|
json: boolean;
|
|
4
6
|
}>;
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FILES_PUSH_NAME_UNSUPPORTED = exports.APP_SCRIPTS_TRUST_NOTE = void 0;
|
|
3
4
|
exports.buildCli = buildCli;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
@@ -8,6 +9,7 @@ const output_1 = require("./functions/helper/output");
|
|
|
8
9
|
const parse_fail_1 = require("./functions/helper/parse-fail");
|
|
9
10
|
const command_js_1 = require("./functions/schemas/command.js");
|
|
10
11
|
const workflow_presets_js_1 = require("./functions/generate/files/workflow-presets.js");
|
|
12
|
+
const script_starters_js_1 = require("./functions/generate/files/script-starters.js");
|
|
11
13
|
const command_js_2 = require("./functions/version/command.js");
|
|
12
14
|
const init_options_js_1 = require("./functions/app/daemon/services/init-options.js");
|
|
13
15
|
function parseAutoServePort(raw) {
|
|
@@ -22,6 +24,14 @@ function parseAutoServePort(raw) {
|
|
|
22
24
|
}
|
|
23
25
|
return n;
|
|
24
26
|
}
|
|
27
|
+
exports.APP_SCRIPTS_TRUST_NOTE = 'Project scripts (custom operators, sort and endpoint scripts) run unsandboxed in this process ' +
|
|
28
|
+
'(the SDK compiles them with `new Function`), like an npm script: only load projects you trust. ' +
|
|
29
|
+
'The hosted dcupl runners sandbox the same scripts.';
|
|
30
|
+
exports.FILES_PUSH_NAME_UNSUPPORTED = 'Named versions are created in the console; `--name` is not supported by `files push`';
|
|
31
|
+
const FILES_DEFAULT_INCLUDE = ['**/*.json', '**/*.csv', '**/*.js'];
|
|
32
|
+
function warnNoFilesConfig(output) {
|
|
33
|
+
output.warn(`No dcupl.config.json in ${process.cwd()}; using the defaults (baseFolder "dcupl", include ${FILES_DEFAULT_INCLUDE.join(', ')}).`);
|
|
34
|
+
}
|
|
25
35
|
const CDN_BASE_URL_DESCRIBE = 'CDN base url for the remote source. Default: derived from consoleApiUrl in dcupl.config.json' +
|
|
26
36
|
' (api.dcupl.com → cdn.dcupl.com, api.dev.dcupl.com → cdn.dev.dcupl.com), else the prod CDN;' +
|
|
27
37
|
' also DCUPL_CDN_BASE_URL env or `cdnBaseUrl` in dcupl.config.json. Overrides the workspace consoleApiUrl' +
|
|
@@ -125,7 +135,7 @@ function buildCli(rawArgs) {
|
|
|
125
135
|
const { bootstrap } = await import('./functions/serve/main.js');
|
|
126
136
|
bootstrap(argv);
|
|
127
137
|
})
|
|
128
|
-
.command('generate [type]', 'Generate models, types, schemas and more from your data', (args) => {
|
|
138
|
+
.command('generate [type]', 'Generate models, scripts, REST API templates, types, schemas and more from your data', (args) => {
|
|
129
139
|
return args
|
|
130
140
|
.positional('type', {
|
|
131
141
|
describe: 'type of content to generate',
|
|
@@ -141,13 +151,28 @@ function buildCli(rawArgs) {
|
|
|
141
151
|
'test',
|
|
142
152
|
'test-config',
|
|
143
153
|
'workflow',
|
|
154
|
+
'api',
|
|
144
155
|
],
|
|
145
156
|
})
|
|
146
157
|
.option('name', {
|
|
147
|
-
describe: 'Name for model generation,
|
|
158
|
+
describe: 'Name for model generation, the workflow key for `generate workflow`, or the template key for `generate api`',
|
|
148
159
|
type: 'string',
|
|
149
160
|
})
|
|
150
161
|
.option('file-name', { describe: 'File name for generation', type: 'string' })
|
|
162
|
+
.option('mode', {
|
|
163
|
+
describe: `Script mode starter for \`generate script\` (default: ${script_starters_js_1.DEFAULT_SCRIPT_MODE}); the scriptKey is derived from --file-name`,
|
|
164
|
+
type: 'string',
|
|
165
|
+
choices: script_starters_js_1.SCRIPT_MODES,
|
|
166
|
+
})
|
|
167
|
+
.option('endpoint', {
|
|
168
|
+
describe: 'Scripted endpoint for `generate api` as "<GET|POST> <path>=<scriptKey>" (repeatable); unknown scripts are scaffolded in endpoint mode and registered',
|
|
169
|
+
type: 'string',
|
|
170
|
+
array: true,
|
|
171
|
+
})
|
|
172
|
+
.option('force', {
|
|
173
|
+
describe: 'Overwrite a file that already exists (`generate api`, `generate script`); without it the file is kept and reported as skipped',
|
|
174
|
+
type: 'boolean',
|
|
175
|
+
})
|
|
151
176
|
.option('operator', { describe: 'Operator name for operator generation', type: 'string' })
|
|
152
177
|
.option('template', {
|
|
153
178
|
describe: `Workflow preset (used by \`generate workflow\`, default: ${workflow_presets_js_1.WORKFLOW_PRESETS[0]})`,
|
|
@@ -156,6 +181,10 @@ function buildCli(rawArgs) {
|
|
|
156
181
|
})
|
|
157
182
|
.option('title', { describe: 'Test title (used by `generate test`)', type: 'string' })
|
|
158
183
|
.option('from', { describe: 'Data file (CSV/JSON/NDJSON) to infer a model from', type: 'string' })
|
|
184
|
+
.option('delimiter', {
|
|
185
|
+
describe: "CSV column delimiter for --from: ',' ';' tab '|' (default: detected from the header and first rows)",
|
|
186
|
+
type: 'string',
|
|
187
|
+
})
|
|
159
188
|
.option('register', {
|
|
160
189
|
describe: 'Register the generated model + data resource in dcupl.lc.json',
|
|
161
190
|
type: 'boolean',
|
|
@@ -216,7 +245,7 @@ function buildCli(rawArgs) {
|
|
|
216
245
|
})
|
|
217
246
|
.demandCommand(1);
|
|
218
247
|
}, () => { })
|
|
219
|
-
.command('workflow <subcommand>', 'Build, test, and deploy dcupl
|
|
248
|
+
.command('workflow <subcommand>', 'Build, test, and deploy dcupl workflow templates (TemplateV3). Auth: `dcupl config set` (projectId + apiKey).', (yy) => {
|
|
220
249
|
return yy
|
|
221
250
|
.command('validate', 'Validate a TemplateV3 file locally (and remotely if --runner is given).', (a) => a
|
|
222
251
|
.option('file', {
|
|
@@ -251,7 +280,7 @@ function buildCli(rawArgs) {
|
|
|
251
280
|
output.error(err.message, err.code || 'WORKFLOW_VALIDATE_FAILED');
|
|
252
281
|
}
|
|
253
282
|
})
|
|
254
|
-
.command('list', 'List deployed
|
|
283
|
+
.command('list', 'List deployed workflow instances (uid / key / runner / version).', () => { }, async (argv) => {
|
|
255
284
|
const { listCommand } = await import('./functions/workflow/commands/list.js');
|
|
256
285
|
const { createApiClient: mkClient } = await import('./functions/helper/api-client.js');
|
|
257
286
|
const output = (0, output_1.createOutput)(!!argv.json);
|
|
@@ -370,10 +399,7 @@ function buildCli(rawArgs) {
|
|
|
370
399
|
describe: 'Path to a JSON file: test-node inputData, or full-run request body',
|
|
371
400
|
})
|
|
372
401
|
.option('state', { type: 'string', describe: 'Path to a JSON file: $state seed for test-node' })
|
|
373
|
-
.option('trigger-key', {
|
|
374
|
-
type: 'string',
|
|
375
|
-
describe: 'api-key to pass to the runner if the trigger requires auth',
|
|
376
|
-
})
|
|
402
|
+
.option('trigger-key', { type: 'string', hidden: true })
|
|
377
403
|
.option('wait', {
|
|
378
404
|
type: 'boolean',
|
|
379
405
|
default: true,
|
|
@@ -425,10 +451,7 @@ function buildCli(rawArgs) {
|
|
|
425
451
|
type: 'string',
|
|
426
452
|
describe: 'Run a single node of the deployed workflow by id (uses test-node)',
|
|
427
453
|
})
|
|
428
|
-
.option('trigger-key', {
|
|
429
|
-
type: 'string',
|
|
430
|
-
describe: 'api-key to pass to the runner if the trigger requires auth',
|
|
431
|
-
}), async (argv) => {
|
|
454
|
+
.option('trigger-key', { type: 'string', hidden: true }), async (argv) => {
|
|
432
455
|
const { runCommand } = await import('./functions/workflow/commands/run.js');
|
|
433
456
|
const { createApiClient: mkClient } = await import('./functions/helper/api-client.js');
|
|
434
457
|
const output = (0, output_1.createOutput)(!!argv.json);
|
|
@@ -522,11 +545,13 @@ function buildCli(rawArgs) {
|
|
|
522
545
|
const output = (0, output_1.createOutput)(!!argv.json);
|
|
523
546
|
try {
|
|
524
547
|
const client = createApiClient();
|
|
525
|
-
const cfg = getConfigFileValue(process.cwd());
|
|
548
|
+
const cfg = getConfigFileValue(process.cwd(), undefined, { quiet: true });
|
|
549
|
+
if (!cfg)
|
|
550
|
+
warnNoFilesConfig(output);
|
|
526
551
|
await statusCommand(client, output, {
|
|
527
552
|
workspaceRoot: process.cwd(),
|
|
528
553
|
baseFolder: cfg?.baseFolder || 'dcupl',
|
|
529
|
-
include: cfg?.filesUpload?.include ||
|
|
554
|
+
include: cfg?.filesUpload?.include || FILES_DEFAULT_INCLUDE,
|
|
530
555
|
exclude: cfg?.filesUpload?.exclude || [],
|
|
531
556
|
versionArg: (argv.version ?? argv.name),
|
|
532
557
|
paths: argv.path,
|
|
@@ -567,19 +592,25 @@ function buildCli(rawArgs) {
|
|
|
567
592
|
type: 'number',
|
|
568
593
|
describe: 'Max parallel file transfers (default 4). Lower this for very large files or slow links.',
|
|
569
594
|
}), async (argv) => {
|
|
595
|
+
const output = (0, output_1.createOutput)(!!argv.json);
|
|
596
|
+
if (argv.name !== undefined) {
|
|
597
|
+
output.error(exports.FILES_PUSH_NAME_UNSUPPORTED, 'PUSH_NAME_NOT_SUPPORTED');
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
570
600
|
const { pushCommand } = await import('./functions/files/commands/push.js');
|
|
571
601
|
const { createApiClient } = await import('./functions/helper/api-client.js');
|
|
572
602
|
const { getConfigFileValue } = await import('./functions/helper/config.helper.js');
|
|
573
|
-
const output = (0, output_1.createOutput)(!!argv.json);
|
|
574
603
|
try {
|
|
575
604
|
const client = createApiClient();
|
|
576
|
-
const cfg = getConfigFileValue(process.cwd());
|
|
605
|
+
const cfg = getConfigFileValue(process.cwd(), undefined, { quiet: true });
|
|
606
|
+
if (!cfg)
|
|
607
|
+
warnNoFilesConfig(output);
|
|
577
608
|
await pushCommand(client, output, {
|
|
578
609
|
workspaceRoot: process.cwd(),
|
|
579
610
|
baseFolder: cfg?.baseFolder || 'dcupl',
|
|
580
|
-
include: cfg?.filesUpload?.include ||
|
|
611
|
+
include: cfg?.filesUpload?.include || FILES_DEFAULT_INCLUDE,
|
|
581
612
|
exclude: cfg?.filesUpload?.exclude || [],
|
|
582
|
-
versionArg:
|
|
613
|
+
versionArg: argv.version,
|
|
583
614
|
mode: argv.strict ? 'strict' : 'additive',
|
|
584
615
|
yes: argv.yes,
|
|
585
616
|
force: argv.force,
|
|
@@ -634,11 +665,13 @@ function buildCli(rawArgs) {
|
|
|
634
665
|
const output = (0, output_1.createOutput)(!!argv.json);
|
|
635
666
|
try {
|
|
636
667
|
const client = createApiClient();
|
|
637
|
-
const cfg = getConfigFileValue(process.cwd());
|
|
668
|
+
const cfg = getConfigFileValue(process.cwd(), undefined, { quiet: true });
|
|
669
|
+
if (!cfg)
|
|
670
|
+
warnNoFilesConfig(output);
|
|
638
671
|
await pullCommand(client, output, {
|
|
639
672
|
workspaceRoot: process.cwd(),
|
|
640
673
|
baseFolder: cfg?.baseFolder || 'dcupl',
|
|
641
|
-
include: cfg?.filesUpload?.include ||
|
|
674
|
+
include: cfg?.filesUpload?.include || FILES_DEFAULT_INCLUDE,
|
|
642
675
|
exclude: cfg?.filesUpload?.exclude || [],
|
|
643
676
|
versionArg: (argv.version ?? argv.name),
|
|
644
677
|
mode: argv.strict ? 'strict' : 'additive',
|
|
@@ -1316,7 +1349,10 @@ function buildCli(rawArgs) {
|
|
|
1316
1349
|
.option('content', { type: 'string', describe: 'Inline payload (use "-" to read from stdin)' })
|
|
1317
1350
|
.option('format', { type: 'string', choices: ['csv', 'json', 'ndjson'] })
|
|
1318
1351
|
.option('model', { type: 'string', demandOption: true })
|
|
1319
|
-
.option('key-property', {
|
|
1352
|
+
.option('key-property', {
|
|
1353
|
+
type: 'string',
|
|
1354
|
+
describe: 'Property holding the record key. Comma-separate for a composite key (a,b → "a::b")',
|
|
1355
|
+
})
|
|
1320
1356
|
.option('auto-generate-key', { type: 'boolean', default: false })
|
|
1321
1357
|
.option('auto-generate-properties', {
|
|
1322
1358
|
type: 'boolean',
|
|
@@ -1358,8 +1394,8 @@ function buildCli(rawArgs) {
|
|
|
1358
1394
|
}
|
|
1359
1395
|
};
|
|
1360
1396
|
return yyy
|
|
1361
|
-
.command('update', '
|
|
1362
|
-
.command('upsert', '
|
|
1397
|
+
.command('update', 'Update existing records by key; rows with unknown keys are skipped (use upsert to add them)', dataOpts, handler('update', 'updateCommand', 'DATA_UPDATE_FAILED'))
|
|
1398
|
+
.command('upsert', 'Add new records and update existing ones by key', dataOpts, handler('upsert', 'upsertCommand', 'DATA_UPSERT_FAILED'))
|
|
1363
1399
|
.command('set', 'Replace all records for model', dataOpts, handler('set', 'setCommand', 'DATA_SET_FAILED'))
|
|
1364
1400
|
.command('remove', 'Remove records by key', dataOpts, handler('remove', 'removeCommand', 'DATA_REMOVE_FAILED'))
|
|
1365
1401
|
.command('reset', 'Drop all data for model', (a) => a.option('app', { type: 'string' }).option('model', { type: 'string', demandOption: true }), async (argv) => {
|
|
@@ -1385,7 +1421,7 @@ function buildCli(rawArgs) {
|
|
|
1385
1421
|
await oneCommand(output, { appId: argv.app, model: argv.model, itemKey: argv.itemKey });
|
|
1386
1422
|
}
|
|
1387
1423
|
catch (err) {
|
|
1388
|
-
output.error(err.message, err.code || 'QUERY_ONE_FAILED');
|
|
1424
|
+
output.error(err.message, err.code || 'QUERY_ONE_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1389
1425
|
}
|
|
1390
1426
|
})
|
|
1391
1427
|
.command('execute', 'Filter+sort+paginate records', (a) => a
|
|
@@ -1412,7 +1448,7 @@ function buildCli(rawArgs) {
|
|
|
1412
1448
|
});
|
|
1413
1449
|
}
|
|
1414
1450
|
catch (err) {
|
|
1415
|
-
output.error(err.message, err.code || 'QUERY_EXEC_FAILED');
|
|
1451
|
+
output.error(err.message, err.code || 'QUERY_EXEC_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1416
1452
|
}
|
|
1417
1453
|
})
|
|
1418
1454
|
.demandCommand(1))
|
|
@@ -1461,7 +1497,7 @@ function buildCli(rawArgs) {
|
|
|
1461
1497
|
});
|
|
1462
1498
|
}
|
|
1463
1499
|
catch (err) {
|
|
1464
|
-
output.error(err.message, err.code || 'FN_FACETS_FAILED');
|
|
1500
|
+
output.error(err.message, err.code || 'FN_FACETS_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1465
1501
|
}
|
|
1466
1502
|
})
|
|
1467
1503
|
.command('aggregate', 'Aggregate stats on attribute', (a) => a
|
|
@@ -1510,7 +1546,7 @@ function buildCli(rawArgs) {
|
|
|
1510
1546
|
});
|
|
1511
1547
|
}
|
|
1512
1548
|
catch (err) {
|
|
1513
|
-
output.error(err.message, err.code || 'FN_AGGREGATE_FAILED');
|
|
1549
|
+
output.error(err.message, err.code || 'FN_AGGREGATE_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1514
1550
|
}
|
|
1515
1551
|
})
|
|
1516
1552
|
.command('groupBy', 'Group records by attribute value', (a) => a
|
|
@@ -1526,7 +1562,10 @@ function buildCli(rawArgs) {
|
|
|
1526
1562
|
.option('exclude-zeros', { type: 'boolean' })
|
|
1527
1563
|
.option('exclude-undefineds', { type: 'boolean' })
|
|
1528
1564
|
.option('exclude-unresolved', { type: 'boolean' })
|
|
1529
|
-
.option('sort', {
|
|
1565
|
+
.option('sort', {
|
|
1566
|
+
type: 'string',
|
|
1567
|
+
describe: 'Group order <key>[:ASC|DESC][,...]: key, size or <attribute>_<type> of a --aggregate (e.g. inStock_sum:DESC); a model attribute orders the items inside each group',
|
|
1568
|
+
})
|
|
1530
1569
|
.option('limit', { type: 'number' })
|
|
1531
1570
|
.option('start', { type: 'number', describe: '0-based offset' }), async (argv) => {
|
|
1532
1571
|
const { groupByCommand } = await import('./functions/app/commands/fn/group-by.js');
|
|
@@ -1548,7 +1587,7 @@ function buildCli(rawArgs) {
|
|
|
1548
1587
|
});
|
|
1549
1588
|
}
|
|
1550
1589
|
catch (err) {
|
|
1551
|
-
output.error(err.message, err.code || 'FN_GROUPBY_FAILED');
|
|
1590
|
+
output.error(err.message, err.code || 'FN_GROUPBY_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1552
1591
|
}
|
|
1553
1592
|
})
|
|
1554
1593
|
.command('metadata', 'List metadata + currentSize for model', (a) => a
|
|
@@ -1567,7 +1606,7 @@ function buildCli(rawArgs) {
|
|
|
1567
1606
|
});
|
|
1568
1607
|
}
|
|
1569
1608
|
catch (err) {
|
|
1570
|
-
output.error(err.message, err.code || 'FN_METADATA_FAILED');
|
|
1609
|
+
output.error(err.message, err.code || 'FN_METADATA_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1571
1610
|
}
|
|
1572
1611
|
})
|
|
1573
1612
|
.command('pivot', 'Multi-dimensional cross-tab (rows x columns x values)', (a) => a
|
|
@@ -1607,7 +1646,7 @@ function buildCli(rawArgs) {
|
|
|
1607
1646
|
});
|
|
1608
1647
|
}
|
|
1609
1648
|
catch (err) {
|
|
1610
|
-
output.error(err.message, err.code || 'FN_PIVOT_FAILED');
|
|
1649
|
+
output.error(err.message, err.code || 'FN_PIVOT_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1611
1650
|
}
|
|
1612
1651
|
})
|
|
1613
1652
|
.command('suggest', 'Typeahead suggestions for an attribute value', (a) => a
|
|
@@ -1647,7 +1686,7 @@ function buildCli(rawArgs) {
|
|
|
1647
1686
|
});
|
|
1648
1687
|
}
|
|
1649
1688
|
catch (err) {
|
|
1650
|
-
output.error(err.message, err.code || 'FN_SUGGEST_FAILED');
|
|
1689
|
+
output.error(err.message, err.code || 'FN_SUGGEST_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1651
1690
|
}
|
|
1652
1691
|
})
|
|
1653
1692
|
.demandCommand(1))
|
|
@@ -1777,7 +1816,8 @@ function buildCli(rawArgs) {
|
|
|
1777
1816
|
}
|
|
1778
1817
|
})
|
|
1779
1818
|
.demandCommand(1))
|
|
1780
|
-
.demandCommand(1)
|
|
1819
|
+
.demandCommand(1)
|
|
1820
|
+
.epilogue(exports.APP_SCRIPTS_TRUST_NOTE));
|
|
1781
1821
|
}, () => { })
|
|
1782
1822
|
.command('version', 'Print the CLI version and the resolved @dcupl/* package versions', () => { }, (argv) => {
|
|
1783
1823
|
(0, command_js_2.versionCommand)((0, output_1.createOutput)(argv.json));
|
|
@@ -1785,26 +1825,6 @@ function buildCli(rawArgs) {
|
|
|
1785
1825
|
.command(['welcome', 'hey', 'rocks', '🚀'], 'You are awesome!', () => { }, async (_argv) => {
|
|
1786
1826
|
const { welcomeFn } = await import('./functions/welcome.js');
|
|
1787
1827
|
welcomeFn();
|
|
1788
|
-
})
|
|
1789
|
-
.command('test', '[experimental] Run generic tests', (args) => {
|
|
1790
|
-
return args
|
|
1791
|
-
.option('base-url', {
|
|
1792
|
-
describe: 'Base URL of the running dcupl instance to test against',
|
|
1793
|
-
default: 'http://localhost:8083',
|
|
1794
|
-
})
|
|
1795
|
-
.option('loader-file-name', {
|
|
1796
|
-
describe: 'Loader configuration file name (dcupl.lc.json)',
|
|
1797
|
-
default: 'dcupl.lc.json',
|
|
1798
|
-
})
|
|
1799
|
-
.option('application-key', {
|
|
1800
|
-
describe: 'The App key you want to test',
|
|
1801
|
-
default: 'default',
|
|
1802
|
-
})
|
|
1803
|
-
.option('environment-key', {
|
|
1804
|
-
describe: 'Environment key to run the tests in (empty for the default environment)',
|
|
1805
|
-
default: '',
|
|
1806
|
-
});
|
|
1807
|
-
}, (_argv) => {
|
|
1808
1828
|
})
|
|
1809
1829
|
.command('files:push', 'Upload files — deprecated, use `dcupl files push`', (args) => {
|
|
1810
1830
|
return args.option('name', {
|