@dcupl/cli 2.0.1 → 2.0.3
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 +225 -73
- package/dist/cli.js.map +1 -1
- package/dist/functions/app/daemon/body-handling.d.ts +8 -0
- package/dist/functions/app/daemon/body-handling.js +29 -0
- package/dist/functions/app/daemon/body-handling.js.map +1 -0
- package/dist/functions/app/daemon/controllers/models.controller.js +7 -2
- package/dist/functions/app/daemon/controllers/models.controller.js.map +1 -1
- package/dist/functions/app/daemon/filters/envelope-exception.filter.d.ts +4 -0
- package/dist/functions/app/daemon/filters/envelope-exception.filter.js +20 -2
- package/dist/functions/app/daemon/filters/envelope-exception.filter.js.map +1 -1
- package/dist/functions/app/daemon/main.js +2 -4
- package/dist/functions/app/daemon/main.js.map +1 -1
- package/dist/functions/app/daemon/services/dcupl-host.service.d.ts +1 -0
- package/dist/functions/app/daemon/services/dcupl-host.service.js +11 -2
- package/dist/functions/app/daemon/services/dcupl-host.service.js.map +1 -1
- package/dist/functions/app/daemon/services/loaders.service.d.ts +1 -0
- package/dist/functions/app/daemon/services/loaders.service.js +44 -6
- package/dist/functions/app/daemon/services/loaders.service.js.map +1 -1
- package/dist/functions/files/commands/write.js +1 -1
- package/dist/functions/files/commands/write.js.map +1 -1
- package/dist/functions/files/helper/text-policy.d.ts +2 -0
- package/dist/functions/files/helper/text-policy.js +26 -0
- package/dist/functions/files/helper/text-policy.js.map +1 -1
- package/dist/functions/files/sync/transfer.js +1 -1
- package/dist/functions/files/sync/transfer.js.map +1 -1
- package/dist/functions/generate/files/generate-files.d.ts +1 -0
- package/dist/functions/generate/files/generate-files.js +65 -9
- package/dist/functions/generate/files/generate-files.js.map +1 -1
- package/dist/functions/generate/model-from-data/generate-model-from-data.js +5 -2
- package/dist/functions/generate/model-from-data/generate-model-from-data.js.map +1 -1
- package/dist/functions/generate/model-from-data/infer-key.d.ts +14 -0
- package/dist/functions/generate/model-from-data/infer-key.js +88 -5
- package/dist/functions/generate/model-from-data/infer-key.js.map +1 -1
- package/dist/functions/generate/model-from-data/infer-to-model.js +1 -1
- package/dist/functions/generate/model-from-data/infer-to-model.js.map +1 -1
- package/dist/functions/generate/projects/generate-project.js +17 -6
- package/dist/functions/generate/projects/generate-project.js.map +1 -1
- package/dist/functions/helper/api-client.d.ts +10 -1
- package/dist/functions/helper/api-client.js +101 -4
- package/dist/functions/helper/api-client.js.map +1 -1
- package/dist/functions/serve/dev-server/dev-server.service.js +8 -0
- package/dist/functions/serve/dev-server/dev-server.service.js.map +1 -1
- package/dist/functions/testing/tests/reporter.d.ts +1 -0
- package/dist/functions/testing/tests/reporter.js +26 -1
- package/dist/functions/testing/tests/reporter.js.map +1 -1
- package/dist/functions/workflow/commands/run.d.ts +4 -2
- package/dist/functions/workflow/commands/run.js +23 -6
- package/dist/functions/workflow/commands/run.js.map +1 -1
- package/dist/functions/workflow/commands/test.d.ts +4 -2
- package/dist/functions/workflow/commands/test.js +19 -6
- package/dist/functions/workflow/commands/test.js.map +1 -1
- package/dist/functions/workflow/full-run.d.ts +15 -0
- package/dist/functions/workflow/full-run.js +72 -0
- package/dist/functions/workflow/full-run.js.map +1 -0
- package/dist/functions/workflow/run-failure.d.ts +2 -0
- package/dist/functions/workflow/run-failure.js +24 -10
- package/dist/functions/workflow/run-failure.js.map +1 -1
- package/dist/functions/workflow/trace.js.map +1 -1
- package/dist/functions/workflow/workflow-api.d.ts +10 -2
- package/dist/functions/workflow/workflow-api.js +17 -2
- package/dist/functions/workflow/workflow-api.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.FILES_PUSH_NAME_UNSUPPORTED = exports.APP_SCRIPTS_TRUST_NOTE = void 0;
|
|
|
4
4
|
exports.buildCli = buildCli;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
7
|
+
const common_1 = require("@dcupl/common");
|
|
7
8
|
const api_client_1 = require("./functions/helper/api-client");
|
|
8
9
|
const output_1 = require("./functions/helper/output");
|
|
9
10
|
const parse_fail_1 = require("./functions/helper/parse-fail");
|
|
@@ -37,6 +38,32 @@ const CDN_BASE_URL_DESCRIBE = 'CDN base url for the remote source. Default: deri
|
|
|
37
38
|
' also DCUPL_CDN_BASE_URL env or `cdnBaseUrl` in dcupl.config.json. Overrides the workspace consoleApiUrl' +
|
|
38
39
|
' even with an explicit --project-id. api-key + cache-busting only apply to dcupl CDN hosts (cdn*.dcupl.com, cdn.dev.dcupl.com);' +
|
|
39
40
|
' see docs/flows/workflow-app-remote.md';
|
|
41
|
+
const APP_ID_OPTION = {
|
|
42
|
+
type: 'string',
|
|
43
|
+
describe: 'App id (see `dcupl app list`); needed only when more than one app is running, e.g. swift-otter-3a1f',
|
|
44
|
+
};
|
|
45
|
+
const MODEL_KEY_OPTION = {
|
|
46
|
+
type: 'string',
|
|
47
|
+
demandOption: true,
|
|
48
|
+
describe: 'Model key, case-sensitive (see `dcupl app models keys`), e.g. Article',
|
|
49
|
+
};
|
|
50
|
+
const QUERY_EXAMPLE = `'{"operator":"eq","attribute":"brand","value":"Nike"}'`;
|
|
51
|
+
const QUERY_OPERATORS = common_1.DcuplQueryOperatorsAsArray.join(', ');
|
|
52
|
+
const QUERY_OPTION = {
|
|
53
|
+
type: 'string',
|
|
54
|
+
describe: `Filter as JSON: a condition { operator, attribute, value } or a group { groupType, queries } (groupType "and" or "or"); built-in operators: ${QUERY_OPERATORS} (notes below), e.g. ${QUERY_EXAMPLE}`,
|
|
55
|
+
};
|
|
56
|
+
const QUERY_NOTES = [
|
|
57
|
+
'Query notes:',
|
|
58
|
+
' eq is the equality operator (the whole value); there is no "equal", "equals" or "contains"',
|
|
59
|
+
` in takes an array and matches any of its entries: '{"operator":"in","attribute":"brand","value":["Nike","Adidas"]}'`,
|
|
60
|
+
` find with a plain string matches the whole value exactly; a "/.../" string is a regex, the substring match (case-sensitive unless "options":{"regexFlags":"i"}): '{"operator":"find","attribute":"productName","value":"/shoe/"}'`,
|
|
61
|
+
` a group combines conditions: '{"groupType":"or","queries":[{"operator":"eq","attribute":"brand","value":"Nike"},{"operator":"gt","attribute":"price","value":100}]}'`,
|
|
62
|
+
].join('\n');
|
|
63
|
+
const QUERY_FILE_OPTION = {
|
|
64
|
+
type: 'string',
|
|
65
|
+
describe: 'Path to a JSON file with the filter, same shapes as --query (--query wins if both are given), e.g. filter.json',
|
|
66
|
+
};
|
|
40
67
|
function buildCli(rawArgs) {
|
|
41
68
|
const instance = (0, yargs_1.default)(rawArgs);
|
|
42
69
|
return (instance
|
|
@@ -172,6 +199,10 @@ function buildCli(rawArgs) {
|
|
|
172
199
|
.option('force', {
|
|
173
200
|
describe: 'Overwrite a file that already exists (`generate api`, `generate script`); without it the file is kept and reported as skipped',
|
|
174
201
|
type: 'boolean',
|
|
202
|
+
})
|
|
203
|
+
.option('app', {
|
|
204
|
+
describe: 'Application key whose resourceTags the resource carries (`generate script`, `generate operator`, `generate transformer`); default: the only application in dcupl.lc.json',
|
|
205
|
+
type: 'string',
|
|
175
206
|
})
|
|
176
207
|
.option('operator', { describe: 'Operator name for operator generation', type: 'string' })
|
|
177
208
|
.option('template', {
|
|
@@ -1412,9 +1443,15 @@ function buildCli(rawArgs) {
|
|
|
1412
1443
|
})
|
|
1413
1444
|
.command('query <verb>', 'Query records', (yyy) => yyy
|
|
1414
1445
|
.command('one', 'Fetch single record', (a) => a
|
|
1415
|
-
.
|
|
1416
|
-
.option('
|
|
1417
|
-
.option('
|
|
1446
|
+
.wrap(null)
|
|
1447
|
+
.option('app', APP_ID_OPTION)
|
|
1448
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1449
|
+
.option('item-key', {
|
|
1450
|
+
type: 'string',
|
|
1451
|
+
demandOption: true,
|
|
1452
|
+
describe: 'Key of the record (the value of its key property), e.g. 1001',
|
|
1453
|
+
})
|
|
1454
|
+
.example('dcupl app query one --model Article --item-key 1001', ''), async (argv) => {
|
|
1418
1455
|
const { oneCommand } = await import('./functions/app/commands/query/one.js');
|
|
1419
1456
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1420
1457
|
try {
|
|
@@ -1425,14 +1462,26 @@ function buildCli(rawArgs) {
|
|
|
1425
1462
|
}
|
|
1426
1463
|
})
|
|
1427
1464
|
.command('execute', 'Filter+sort+paginate records', (a) => a
|
|
1428
|
-
.
|
|
1429
|
-
.option('
|
|
1430
|
-
.option('
|
|
1431
|
-
.option('query
|
|
1432
|
-
.option('
|
|
1433
|
-
.
|
|
1434
|
-
.option('
|
|
1435
|
-
|
|
1465
|
+
.wrap(null)
|
|
1466
|
+
.option('app', APP_ID_OPTION)
|
|
1467
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1468
|
+
.option('query', QUERY_OPTION)
|
|
1469
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1470
|
+
.epilog(QUERY_NOTES)
|
|
1471
|
+
.option('sort', {
|
|
1472
|
+
type: 'string',
|
|
1473
|
+
describe: 'Order as <attribute>[:ASC|DESC], comma-separated, ASC by default, e.g. price:DESC or price:DESC,productName:ASC',
|
|
1474
|
+
})
|
|
1475
|
+
.option('limit', { type: 'number', describe: 'Maximum number of records to return, e.g. 10' })
|
|
1476
|
+
.option('start', {
|
|
1477
|
+
type: 'number',
|
|
1478
|
+
describe: '0-based offset of the first record to return, e.g. 20',
|
|
1479
|
+
})
|
|
1480
|
+
.option('projection', {
|
|
1481
|
+
type: 'string',
|
|
1482
|
+
describe: 'Attributes to return (the key always comes back): comma list, JSON array or JSON object, e.g. productName,price',
|
|
1483
|
+
})
|
|
1484
|
+
.example(`dcupl app query execute --model Article --query ${QUERY_EXAMPLE} --sort price:DESC --limit 10 --projection productName,price`, ''), async (argv) => {
|
|
1436
1485
|
const { executeCommand } = await import('./functions/app/commands/query/execute.js');
|
|
1437
1486
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1438
1487
|
try {
|
|
@@ -1454,19 +1503,37 @@ function buildCli(rawArgs) {
|
|
|
1454
1503
|
.demandCommand(1))
|
|
1455
1504
|
.command('fn <verb>', 'Run analytical functions', (yyy) => yyy
|
|
1456
1505
|
.command('facets', 'Value distribution on attribute', (a) => a
|
|
1457
|
-
.
|
|
1458
|
-
.option('
|
|
1459
|
-
.option('
|
|
1460
|
-
.option('
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
.option('
|
|
1506
|
+
.wrap(null)
|
|
1507
|
+
.option('app', APP_ID_OPTION)
|
|
1508
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1509
|
+
.option('attribute', {
|
|
1510
|
+
type: 'string',
|
|
1511
|
+
demandOption: true,
|
|
1512
|
+
describe: 'Attribute whose values are counted, e.g. brand',
|
|
1513
|
+
})
|
|
1514
|
+
.option('exclude-zeros', {
|
|
1515
|
+
type: 'boolean',
|
|
1516
|
+
describe: 'Leave out values that no record matching --query has (on by default; --no-exclude-zeros keeps them)',
|
|
1517
|
+
})
|
|
1518
|
+
.option('exclude-undefineds', {
|
|
1519
|
+
type: 'boolean',
|
|
1520
|
+
describe: 'Leave out the records without a value (on by default; --no-exclude-undefineds counts them)',
|
|
1521
|
+
})
|
|
1522
|
+
.option('exclude-unresolved', {
|
|
1523
|
+
type: 'boolean',
|
|
1524
|
+
describe: 'Leave out reference values that resolve to no record (on by default; --no-exclude-unresolved keeps them)',
|
|
1525
|
+
})
|
|
1526
|
+
.option('query', QUERY_OPTION)
|
|
1527
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1528
|
+
.epilog(QUERY_NOTES)
|
|
1529
|
+
.option('limit', {
|
|
1530
|
+
type: 'number',
|
|
1531
|
+
describe: 'Maximum number of values; a top-N needs --sort as well, e.g. 10',
|
|
1532
|
+
})
|
|
1466
1533
|
.option('sort', {
|
|
1467
1534
|
type: 'string',
|
|
1468
1535
|
choices: ['size-desc', 'size-asc', 'value-asc', 'value-desc'],
|
|
1469
|
-
describe: '
|
|
1536
|
+
describe: 'Order of the values (walks all of them); without it the order is not guaranteed, e.g. size-desc',
|
|
1470
1537
|
})
|
|
1471
1538
|
.option('full', {
|
|
1472
1539
|
type: 'boolean',
|
|
@@ -1476,8 +1543,9 @@ function buildCli(rawArgs) {
|
|
|
1476
1543
|
.option('include-results', {
|
|
1477
1544
|
type: 'boolean',
|
|
1478
1545
|
default: false,
|
|
1479
|
-
describe: '
|
|
1480
|
-
})
|
|
1546
|
+
describe: 'Add resultKeys (the keys of the matching records) to each value',
|
|
1547
|
+
})
|
|
1548
|
+
.example('dcupl app fn facets --model Article --attribute brand --sort size-desc --limit 10', ''), async (argv) => {
|
|
1481
1549
|
const { facetsCommand } = await import('./functions/app/commands/fn/facets.js');
|
|
1482
1550
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1483
1551
|
try {
|
|
@@ -1501,30 +1569,56 @@ function buildCli(rawArgs) {
|
|
|
1501
1569
|
}
|
|
1502
1570
|
})
|
|
1503
1571
|
.command('aggregate', 'Aggregate stats on attribute', (a) => a
|
|
1504
|
-
.
|
|
1505
|
-
.option('
|
|
1506
|
-
.option('
|
|
1572
|
+
.wrap(null)
|
|
1573
|
+
.option('app', APP_ID_OPTION)
|
|
1574
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1575
|
+
.option('attribute', {
|
|
1576
|
+
type: 'string',
|
|
1577
|
+
demandOption: true,
|
|
1578
|
+
describe: 'Attribute to aggregate, e.g. price',
|
|
1579
|
+
})
|
|
1507
1580
|
.option('types', {
|
|
1508
1581
|
type: 'string',
|
|
1509
|
-
describe: '
|
|
1582
|
+
describe: 'Aggregations, comma-separated: distinct,count,sum,avg,min,max,group (group needs --bins or --group-options(-file), without one it returns an empty list), e.g. sum,avg. Required unless --bins or --group-options(-file) is given',
|
|
1510
1583
|
})
|
|
1511
|
-
.option('query',
|
|
1512
|
-
.option('query-file',
|
|
1584
|
+
.option('query', QUERY_OPTION)
|
|
1585
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1586
|
+
.epilog(QUERY_NOTES)
|
|
1513
1587
|
.option('include-keys', {
|
|
1514
1588
|
type: 'boolean',
|
|
1515
1589
|
default: false,
|
|
1516
|
-
describe: '
|
|
1590
|
+
describe: 'Add the keys of the matching records to each distinct value',
|
|
1517
1591
|
})
|
|
1518
1592
|
.option('bins', {
|
|
1519
1593
|
type: 'string',
|
|
1520
|
-
describe: 'Numeric ranges for
|
|
1594
|
+
describe: 'Numeric ranges <from>-<to> for a histogram, comma-separated (adds the group type). Both bounds are exclusive today: a value equal to a bound lands in no bin, so give both bounds and keep them off values that occur (dcupl/dcupl#511), e.g. 0-50,50-100 (a price of exactly 0, 50 or 100 is not counted)',
|
|
1595
|
+
})
|
|
1596
|
+
.option('group-options', {
|
|
1597
|
+
type: 'string',
|
|
1598
|
+
describe: `groupOptions as JSON, instead of --bins (same rule: both bounds exclusive, give both, dcupl/dcupl#511), e.g. '{"groups":[{"from":0,"to":50},{"from":50,"to":100}]}'`,
|
|
1599
|
+
})
|
|
1600
|
+
.option('group-options-file', {
|
|
1601
|
+
type: 'string',
|
|
1602
|
+
describe: 'Path to a JSON file with the groupOptions, e.g. groups.json',
|
|
1603
|
+
})
|
|
1604
|
+
.option('distinct-limit', {
|
|
1605
|
+
type: 'number',
|
|
1606
|
+
describe: 'Maximum number of distinct values, e.g. 20',
|
|
1607
|
+
})
|
|
1608
|
+
.option('exclude-zeros', {
|
|
1609
|
+
type: 'boolean',
|
|
1610
|
+
describe: 'No effect on aggregate (the SDK ignores it); leave records out with --query',
|
|
1521
1611
|
})
|
|
1522
|
-
.option('
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
.option('exclude-
|
|
1527
|
-
|
|
1612
|
+
.option('exclude-undefineds', {
|
|
1613
|
+
type: 'boolean',
|
|
1614
|
+
describe: 'Leave the records without a value out of distinct (the other types ignore it)',
|
|
1615
|
+
})
|
|
1616
|
+
.option('exclude-unresolved', {
|
|
1617
|
+
type: 'boolean',
|
|
1618
|
+
describe: 'No effect on aggregate (the SDK ignores it); leave records out with --query',
|
|
1619
|
+
})
|
|
1620
|
+
.example('dcupl app fn aggregate --model Article --attribute price --types sum,avg', '')
|
|
1621
|
+
.example('dcupl app fn aggregate --model Article --attribute price --bins 0-50,50-100', '(a price of exactly 0, 50 or 100 is in no bin, dcupl/dcupl#511)'), async (argv) => {
|
|
1528
1622
|
const { aggregateCommand } = await import('./functions/app/commands/fn/aggregate.js');
|
|
1529
1623
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1530
1624
|
try {
|
|
@@ -1550,24 +1644,40 @@ function buildCli(rawArgs) {
|
|
|
1550
1644
|
}
|
|
1551
1645
|
})
|
|
1552
1646
|
.command('groupBy', 'Group records by attribute value', (a) => a
|
|
1553
|
-
.
|
|
1554
|
-
.option('
|
|
1555
|
-
.option('
|
|
1556
|
-
.option('
|
|
1557
|
-
|
|
1647
|
+
.wrap(null)
|
|
1648
|
+
.option('app', APP_ID_OPTION)
|
|
1649
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1650
|
+
.option('attribute', {
|
|
1651
|
+
type: 'string',
|
|
1652
|
+
demandOption: true,
|
|
1653
|
+
describe: 'Attribute to group by, e.g. brand',
|
|
1654
|
+
})
|
|
1655
|
+
.option('query', QUERY_OPTION)
|
|
1656
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1657
|
+
.epilog(QUERY_NOTES)
|
|
1558
1658
|
.option('aggregate', {
|
|
1559
1659
|
type: 'array',
|
|
1560
|
-
describe: '
|
|
1660
|
+
describe: 'Aggregate per group as <attribute>:<type[,type...]> (count,sum,avg,min,max,distinct); repeat to combine, e.g. inStock:sum',
|
|
1661
|
+
})
|
|
1662
|
+
.option('exclude-zeros', {
|
|
1663
|
+
type: 'boolean',
|
|
1664
|
+
describe: 'No effect on groupBy (the SDK ignores it); groups come from the matching records',
|
|
1665
|
+
})
|
|
1666
|
+
.option('exclude-undefineds', {
|
|
1667
|
+
type: 'boolean',
|
|
1668
|
+
describe: 'No effect on groupBy (the SDK ignores it); records without a value never form a group',
|
|
1669
|
+
})
|
|
1670
|
+
.option('exclude-unresolved', {
|
|
1671
|
+
type: 'boolean',
|
|
1672
|
+
describe: 'No effect on groupBy (the SDK ignores it); groups come from the matching records',
|
|
1561
1673
|
})
|
|
1562
|
-
.option('exclude-zeros', { type: 'boolean' })
|
|
1563
|
-
.option('exclude-undefineds', { type: 'boolean' })
|
|
1564
|
-
.option('exclude-unresolved', { type: 'boolean' })
|
|
1565
1674
|
.option('sort', {
|
|
1566
1675
|
type: 'string',
|
|
1567
1676
|
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
1677
|
})
|
|
1569
|
-
.option('limit', { type: 'number' })
|
|
1570
|
-
.option('start', { type: 'number', describe: '0-based offset
|
|
1678
|
+
.option('limit', { type: 'number', describe: 'Maximum number of groups, e.g. 10' })
|
|
1679
|
+
.option('start', { type: 'number', describe: '0-based offset of the first group, e.g. 10' })
|
|
1680
|
+
.example('dcupl app fn groupBy --model Article --attribute brand --aggregate inStock:sum --sort inStock_sum:DESC', ''), async (argv) => {
|
|
1571
1681
|
const { groupByCommand } = await import('./functions/app/commands/fn/group-by.js');
|
|
1572
1682
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1573
1683
|
try {
|
|
@@ -1591,10 +1701,13 @@ function buildCli(rawArgs) {
|
|
|
1591
1701
|
}
|
|
1592
1702
|
})
|
|
1593
1703
|
.command('metadata', 'List metadata + currentSize for model', (a) => a
|
|
1594
|
-
.
|
|
1595
|
-
.option('
|
|
1596
|
-
.option('
|
|
1597
|
-
.option('query
|
|
1704
|
+
.wrap(null)
|
|
1705
|
+
.option('app', APP_ID_OPTION)
|
|
1706
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1707
|
+
.option('query', QUERY_OPTION)
|
|
1708
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1709
|
+
.epilog(QUERY_NOTES)
|
|
1710
|
+
.example('dcupl app fn metadata --model Article', ''), async (argv) => {
|
|
1598
1711
|
const { metadataCommand } = await import('./functions/app/commands/fn/metadata.js');
|
|
1599
1712
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1600
1713
|
try {
|
|
@@ -1610,25 +1723,34 @@ function buildCli(rawArgs) {
|
|
|
1610
1723
|
}
|
|
1611
1724
|
})
|
|
1612
1725
|
.command('pivot', 'Multi-dimensional cross-tab (rows x columns x values)', (a) => a
|
|
1613
|
-
.
|
|
1614
|
-
.option('
|
|
1726
|
+
.wrap(null)
|
|
1727
|
+
.option('app', APP_ID_OPTION)
|
|
1728
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1615
1729
|
.option('rows', {
|
|
1616
1730
|
type: 'array',
|
|
1617
|
-
describe: 'Row attribute(s); append :totals for
|
|
1731
|
+
describe: 'Row attribute(s), comma-separated or repeated; append :totals for totals of that attribute, e.g. category',
|
|
1618
1732
|
})
|
|
1619
1733
|
.option('columns', {
|
|
1620
1734
|
type: 'array',
|
|
1621
|
-
describe: 'Column attribute(s); append :totals.
|
|
1735
|
+
describe: 'Column attribute(s), comma-separated or repeated; append :totals for totals of that attribute, e.g. brand',
|
|
1736
|
+
})
|
|
1737
|
+
.option('values', {
|
|
1738
|
+
type: 'array',
|
|
1739
|
+
describe: 'Cell aggregations as <attribute>:<type[,type...]>; repeat to combine, e.g. price:avg. Required unless --spec or --spec-file is given',
|
|
1622
1740
|
})
|
|
1623
|
-
.option('values', { type: 'array', describe: 'Aggregations <attr>:<type[,type]>. Repeatable.' })
|
|
1624
1741
|
.option('totals', { type: 'boolean', describe: 'Compute grand totals' })
|
|
1625
1742
|
.option('spec', {
|
|
1626
1743
|
type: 'string',
|
|
1627
|
-
describe:
|
|
1744
|
+
describe: `Full PivotOptions JSON, instead of --rows/--columns/--values/--totals, e.g. '{"rows":[{"attribute":"category"}],"columns":[{"attribute":"brand"}],"values":[{"attribute":"price","types":["avg"]}]}'`,
|
|
1745
|
+
})
|
|
1746
|
+
.option('spec-file', {
|
|
1747
|
+
type: 'string',
|
|
1748
|
+
describe: 'Path to a JSON file with the PivotOptions, e.g. pivot.json',
|
|
1628
1749
|
})
|
|
1629
|
-
.option('
|
|
1630
|
-
.option('query',
|
|
1631
|
-
.
|
|
1750
|
+
.option('query', QUERY_OPTION)
|
|
1751
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1752
|
+
.epilog(QUERY_NOTES)
|
|
1753
|
+
.example('dcupl app fn pivot --model Article --rows category --columns brand --values price:avg', ''), async (argv) => {
|
|
1632
1754
|
const { pivotCommand } = await import('./functions/app/commands/fn/pivot.js');
|
|
1633
1755
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1634
1756
|
try {
|
|
@@ -1650,22 +1772,52 @@ function buildCli(rawArgs) {
|
|
|
1650
1772
|
}
|
|
1651
1773
|
})
|
|
1652
1774
|
.command('suggest', 'Typeahead suggestions for an attribute value', (a) => a
|
|
1653
|
-
.
|
|
1654
|
-
.option('
|
|
1655
|
-
.option('
|
|
1656
|
-
.option('
|
|
1657
|
-
|
|
1775
|
+
.wrap(null)
|
|
1776
|
+
.option('app', APP_ID_OPTION)
|
|
1777
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1778
|
+
.option('attribute', {
|
|
1779
|
+
type: 'string',
|
|
1780
|
+
demandOption: true,
|
|
1781
|
+
describe: 'Attribute whose values are searched, e.g. brand',
|
|
1782
|
+
})
|
|
1783
|
+
.option('value', {
|
|
1784
|
+
type: 'string',
|
|
1785
|
+
demandOption: true,
|
|
1786
|
+
describe: 'Text to match: a plain value is a case-insensitive prefix, /pattern/ a regular expression, e.g. ni',
|
|
1787
|
+
})
|
|
1788
|
+
.option('max', {
|
|
1789
|
+
type: 'number',
|
|
1790
|
+
describe: 'Maximum number of suggestions (default 20), e.g. 5',
|
|
1791
|
+
})
|
|
1658
1792
|
.option('relevant-data', {
|
|
1659
1793
|
type: 'string',
|
|
1660
1794
|
choices: ['filtered', 'all', 'excludeQuery'],
|
|
1795
|
+
describe: 'Records to search: filtered = matching --query (default), all = every record, excludeQuery = --query without the group named by --exclude-query, e.g. all',
|
|
1796
|
+
})
|
|
1797
|
+
.option('calculate-result-keys', {
|
|
1798
|
+
type: 'boolean',
|
|
1799
|
+
describe: 'Return the keys of the matching records per suggestion (on by default; --no-calculate-result-keys leaves them empty)',
|
|
1800
|
+
})
|
|
1801
|
+
.option('exclude-undefineds', {
|
|
1802
|
+
type: 'boolean',
|
|
1803
|
+
describe: 'Leave out the records without a value (on by default; --no-exclude-undefineds suggests them too)',
|
|
1804
|
+
})
|
|
1805
|
+
.option('exclude-nulls', {
|
|
1806
|
+
type: 'boolean',
|
|
1807
|
+
describe: 'Leave out null values (on by default; --no-exclude-nulls suggests them too)',
|
|
1808
|
+
})
|
|
1809
|
+
.option('exclude-query', {
|
|
1810
|
+
type: 'string',
|
|
1811
|
+
describe: `Group of --query to ignore, by its groupKey; only with --relevant-data excludeQuery, e.g. '{"groupKey":"brandGroup"}'`,
|
|
1812
|
+
})
|
|
1813
|
+
.option('exclude-query-file', {
|
|
1814
|
+
type: 'string',
|
|
1815
|
+
describe: 'Path to a JSON file with the --exclude-query value, e.g. exclude.json',
|
|
1661
1816
|
})
|
|
1662
|
-
.option('
|
|
1663
|
-
.option('
|
|
1664
|
-
.
|
|
1665
|
-
.
|
|
1666
|
-
.option('exclude-query-file', { type: 'string' })
|
|
1667
|
-
.option('query', { type: 'string' })
|
|
1668
|
-
.option('query-file', { type: 'string' }), async (argv) => {
|
|
1817
|
+
.option('query', QUERY_OPTION)
|
|
1818
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1819
|
+
.epilog(QUERY_NOTES)
|
|
1820
|
+
.example('dcupl app fn suggest --model Article --attribute brand --value ni', ''), async (argv) => {
|
|
1669
1821
|
const { suggestCommand } = await import('./functions/app/commands/fn/suggest.js');
|
|
1670
1822
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1671
1823
|
try {
|