@dcupl/cli 2.0.1 → 2.0.2
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 +221 -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/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.js +11 -4
- package/dist/functions/generate/files/generate-files.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 +98 -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 +15 -5
- 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 +11 -5
- package/dist/functions/workflow/commands/test.js.map +1 -1
- package/dist/functions/workflow/full-run.d.ts +14 -0
- package/dist/functions/workflow/full-run.js +55 -0
- package/dist/functions/workflow/full-run.js.map +1 -0
- package/dist/functions/workflow/trace.js.map +1 -1
- package/dist/functions/workflow/workflow-api.d.ts +5 -1
- package/dist/functions/workflow/workflow-api.js +6 -1
- 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
|
|
@@ -1412,9 +1439,15 @@ function buildCli(rawArgs) {
|
|
|
1412
1439
|
})
|
|
1413
1440
|
.command('query <verb>', 'Query records', (yyy) => yyy
|
|
1414
1441
|
.command('one', 'Fetch single record', (a) => a
|
|
1415
|
-
.
|
|
1416
|
-
.option('
|
|
1417
|
-
.option('
|
|
1442
|
+
.wrap(null)
|
|
1443
|
+
.option('app', APP_ID_OPTION)
|
|
1444
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1445
|
+
.option('item-key', {
|
|
1446
|
+
type: 'string',
|
|
1447
|
+
demandOption: true,
|
|
1448
|
+
describe: 'Key of the record (the value of its key property), e.g. 1001',
|
|
1449
|
+
})
|
|
1450
|
+
.example('dcupl app query one --model Article --item-key 1001', ''), async (argv) => {
|
|
1418
1451
|
const { oneCommand } = await import('./functions/app/commands/query/one.js');
|
|
1419
1452
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1420
1453
|
try {
|
|
@@ -1425,14 +1458,26 @@ function buildCli(rawArgs) {
|
|
|
1425
1458
|
}
|
|
1426
1459
|
})
|
|
1427
1460
|
.command('execute', 'Filter+sort+paginate records', (a) => a
|
|
1428
|
-
.
|
|
1429
|
-
.option('
|
|
1430
|
-
.option('
|
|
1431
|
-
.option('query
|
|
1432
|
-
.option('
|
|
1433
|
-
.
|
|
1434
|
-
.option('
|
|
1435
|
-
|
|
1461
|
+
.wrap(null)
|
|
1462
|
+
.option('app', APP_ID_OPTION)
|
|
1463
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1464
|
+
.option('query', QUERY_OPTION)
|
|
1465
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1466
|
+
.epilog(QUERY_NOTES)
|
|
1467
|
+
.option('sort', {
|
|
1468
|
+
type: 'string',
|
|
1469
|
+
describe: 'Order as <attribute>[:ASC|DESC], comma-separated, ASC by default, e.g. price:DESC or price:DESC,productName:ASC',
|
|
1470
|
+
})
|
|
1471
|
+
.option('limit', { type: 'number', describe: 'Maximum number of records to return, e.g. 10' })
|
|
1472
|
+
.option('start', {
|
|
1473
|
+
type: 'number',
|
|
1474
|
+
describe: '0-based offset of the first record to return, e.g. 20',
|
|
1475
|
+
})
|
|
1476
|
+
.option('projection', {
|
|
1477
|
+
type: 'string',
|
|
1478
|
+
describe: 'Attributes to return (the key always comes back): comma list, JSON array or JSON object, e.g. productName,price',
|
|
1479
|
+
})
|
|
1480
|
+
.example(`dcupl app query execute --model Article --query ${QUERY_EXAMPLE} --sort price:DESC --limit 10 --projection productName,price`, ''), async (argv) => {
|
|
1436
1481
|
const { executeCommand } = await import('./functions/app/commands/query/execute.js');
|
|
1437
1482
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1438
1483
|
try {
|
|
@@ -1454,19 +1499,37 @@ function buildCli(rawArgs) {
|
|
|
1454
1499
|
.demandCommand(1))
|
|
1455
1500
|
.command('fn <verb>', 'Run analytical functions', (yyy) => yyy
|
|
1456
1501
|
.command('facets', 'Value distribution on attribute', (a) => a
|
|
1457
|
-
.
|
|
1458
|
-
.option('
|
|
1459
|
-
.option('
|
|
1460
|
-
.option('
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
.option('
|
|
1502
|
+
.wrap(null)
|
|
1503
|
+
.option('app', APP_ID_OPTION)
|
|
1504
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1505
|
+
.option('attribute', {
|
|
1506
|
+
type: 'string',
|
|
1507
|
+
demandOption: true,
|
|
1508
|
+
describe: 'Attribute whose values are counted, e.g. brand',
|
|
1509
|
+
})
|
|
1510
|
+
.option('exclude-zeros', {
|
|
1511
|
+
type: 'boolean',
|
|
1512
|
+
describe: 'Leave out values that no record matching --query has (on by default; --no-exclude-zeros keeps them)',
|
|
1513
|
+
})
|
|
1514
|
+
.option('exclude-undefineds', {
|
|
1515
|
+
type: 'boolean',
|
|
1516
|
+
describe: 'Leave out the records without a value (on by default; --no-exclude-undefineds counts them)',
|
|
1517
|
+
})
|
|
1518
|
+
.option('exclude-unresolved', {
|
|
1519
|
+
type: 'boolean',
|
|
1520
|
+
describe: 'Leave out reference values that resolve to no record (on by default; --no-exclude-unresolved keeps them)',
|
|
1521
|
+
})
|
|
1522
|
+
.option('query', QUERY_OPTION)
|
|
1523
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1524
|
+
.epilog(QUERY_NOTES)
|
|
1525
|
+
.option('limit', {
|
|
1526
|
+
type: 'number',
|
|
1527
|
+
describe: 'Maximum number of values; a top-N needs --sort as well, e.g. 10',
|
|
1528
|
+
})
|
|
1466
1529
|
.option('sort', {
|
|
1467
1530
|
type: 'string',
|
|
1468
1531
|
choices: ['size-desc', 'size-asc', 'value-asc', 'value-desc'],
|
|
1469
|
-
describe: '
|
|
1532
|
+
describe: 'Order of the values (walks all of them); without it the order is not guaranteed, e.g. size-desc',
|
|
1470
1533
|
})
|
|
1471
1534
|
.option('full', {
|
|
1472
1535
|
type: 'boolean',
|
|
@@ -1476,8 +1539,9 @@ function buildCli(rawArgs) {
|
|
|
1476
1539
|
.option('include-results', {
|
|
1477
1540
|
type: 'boolean',
|
|
1478
1541
|
default: false,
|
|
1479
|
-
describe: '
|
|
1480
|
-
})
|
|
1542
|
+
describe: 'Add resultKeys (the keys of the matching records) to each value',
|
|
1543
|
+
})
|
|
1544
|
+
.example('dcupl app fn facets --model Article --attribute brand --sort size-desc --limit 10', ''), async (argv) => {
|
|
1481
1545
|
const { facetsCommand } = await import('./functions/app/commands/fn/facets.js');
|
|
1482
1546
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1483
1547
|
try {
|
|
@@ -1501,30 +1565,56 @@ function buildCli(rawArgs) {
|
|
|
1501
1565
|
}
|
|
1502
1566
|
})
|
|
1503
1567
|
.command('aggregate', 'Aggregate stats on attribute', (a) => a
|
|
1504
|
-
.
|
|
1505
|
-
.option('
|
|
1506
|
-
.option('
|
|
1568
|
+
.wrap(null)
|
|
1569
|
+
.option('app', APP_ID_OPTION)
|
|
1570
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1571
|
+
.option('attribute', {
|
|
1572
|
+
type: 'string',
|
|
1573
|
+
demandOption: true,
|
|
1574
|
+
describe: 'Attribute to aggregate, e.g. price',
|
|
1575
|
+
})
|
|
1507
1576
|
.option('types', {
|
|
1508
1577
|
type: 'string',
|
|
1509
|
-
describe: '
|
|
1578
|
+
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
1579
|
})
|
|
1511
|
-
.option('query',
|
|
1512
|
-
.option('query-file',
|
|
1580
|
+
.option('query', QUERY_OPTION)
|
|
1581
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1582
|
+
.epilog(QUERY_NOTES)
|
|
1513
1583
|
.option('include-keys', {
|
|
1514
1584
|
type: 'boolean',
|
|
1515
1585
|
default: false,
|
|
1516
|
-
describe: '
|
|
1586
|
+
describe: 'Add the keys of the matching records to each distinct value',
|
|
1517
1587
|
})
|
|
1518
1588
|
.option('bins', {
|
|
1519
1589
|
type: 'string',
|
|
1520
|
-
describe: 'Numeric ranges for
|
|
1590
|
+
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)',
|
|
1521
1591
|
})
|
|
1522
|
-
.option('group-options', {
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
.option('
|
|
1527
|
-
|
|
1592
|
+
.option('group-options', {
|
|
1593
|
+
type: 'string',
|
|
1594
|
+
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}]}'`,
|
|
1595
|
+
})
|
|
1596
|
+
.option('group-options-file', {
|
|
1597
|
+
type: 'string',
|
|
1598
|
+
describe: 'Path to a JSON file with the groupOptions, e.g. groups.json',
|
|
1599
|
+
})
|
|
1600
|
+
.option('distinct-limit', {
|
|
1601
|
+
type: 'number',
|
|
1602
|
+
describe: 'Maximum number of distinct values, e.g. 20',
|
|
1603
|
+
})
|
|
1604
|
+
.option('exclude-zeros', {
|
|
1605
|
+
type: 'boolean',
|
|
1606
|
+
describe: 'No effect on aggregate (the SDK ignores it); leave records out with --query',
|
|
1607
|
+
})
|
|
1608
|
+
.option('exclude-undefineds', {
|
|
1609
|
+
type: 'boolean',
|
|
1610
|
+
describe: 'Leave the records without a value out of distinct (the other types ignore it)',
|
|
1611
|
+
})
|
|
1612
|
+
.option('exclude-unresolved', {
|
|
1613
|
+
type: 'boolean',
|
|
1614
|
+
describe: 'No effect on aggregate (the SDK ignores it); leave records out with --query',
|
|
1615
|
+
})
|
|
1616
|
+
.example('dcupl app fn aggregate --model Article --attribute price --types sum,avg', '')
|
|
1617
|
+
.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
1618
|
const { aggregateCommand } = await import('./functions/app/commands/fn/aggregate.js');
|
|
1529
1619
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1530
1620
|
try {
|
|
@@ -1550,24 +1640,40 @@ function buildCli(rawArgs) {
|
|
|
1550
1640
|
}
|
|
1551
1641
|
})
|
|
1552
1642
|
.command('groupBy', 'Group records by attribute value', (a) => a
|
|
1553
|
-
.
|
|
1554
|
-
.option('
|
|
1555
|
-
.option('
|
|
1556
|
-
.option('
|
|
1557
|
-
|
|
1643
|
+
.wrap(null)
|
|
1644
|
+
.option('app', APP_ID_OPTION)
|
|
1645
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1646
|
+
.option('attribute', {
|
|
1647
|
+
type: 'string',
|
|
1648
|
+
demandOption: true,
|
|
1649
|
+
describe: 'Attribute to group by, e.g. brand',
|
|
1650
|
+
})
|
|
1651
|
+
.option('query', QUERY_OPTION)
|
|
1652
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1653
|
+
.epilog(QUERY_NOTES)
|
|
1558
1654
|
.option('aggregate', {
|
|
1559
1655
|
type: 'array',
|
|
1560
|
-
describe: '
|
|
1656
|
+
describe: 'Aggregate per group as <attribute>:<type[,type...]> (count,sum,avg,min,max,distinct); repeat to combine, e.g. inStock:sum',
|
|
1657
|
+
})
|
|
1658
|
+
.option('exclude-zeros', {
|
|
1659
|
+
type: 'boolean',
|
|
1660
|
+
describe: 'No effect on groupBy (the SDK ignores it); groups come from the matching records',
|
|
1661
|
+
})
|
|
1662
|
+
.option('exclude-undefineds', {
|
|
1663
|
+
type: 'boolean',
|
|
1664
|
+
describe: 'No effect on groupBy (the SDK ignores it); records without a value never form a group',
|
|
1665
|
+
})
|
|
1666
|
+
.option('exclude-unresolved', {
|
|
1667
|
+
type: 'boolean',
|
|
1668
|
+
describe: 'No effect on groupBy (the SDK ignores it); groups come from the matching records',
|
|
1561
1669
|
})
|
|
1562
|
-
.option('exclude-zeros', { type: 'boolean' })
|
|
1563
|
-
.option('exclude-undefineds', { type: 'boolean' })
|
|
1564
|
-
.option('exclude-unresolved', { type: 'boolean' })
|
|
1565
1670
|
.option('sort', {
|
|
1566
1671
|
type: 'string',
|
|
1567
1672
|
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
1673
|
})
|
|
1569
|
-
.option('limit', { type: 'number' })
|
|
1570
|
-
.option('start', { type: 'number', describe: '0-based offset
|
|
1674
|
+
.option('limit', { type: 'number', describe: 'Maximum number of groups, e.g. 10' })
|
|
1675
|
+
.option('start', { type: 'number', describe: '0-based offset of the first group, e.g. 10' })
|
|
1676
|
+
.example('dcupl app fn groupBy --model Article --attribute brand --aggregate inStock:sum --sort inStock_sum:DESC', ''), async (argv) => {
|
|
1571
1677
|
const { groupByCommand } = await import('./functions/app/commands/fn/group-by.js');
|
|
1572
1678
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1573
1679
|
try {
|
|
@@ -1591,10 +1697,13 @@ function buildCli(rawArgs) {
|
|
|
1591
1697
|
}
|
|
1592
1698
|
})
|
|
1593
1699
|
.command('metadata', 'List metadata + currentSize for model', (a) => a
|
|
1594
|
-
.
|
|
1595
|
-
.option('
|
|
1596
|
-
.option('
|
|
1597
|
-
.option('query
|
|
1700
|
+
.wrap(null)
|
|
1701
|
+
.option('app', APP_ID_OPTION)
|
|
1702
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1703
|
+
.option('query', QUERY_OPTION)
|
|
1704
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1705
|
+
.epilog(QUERY_NOTES)
|
|
1706
|
+
.example('dcupl app fn metadata --model Article', ''), async (argv) => {
|
|
1598
1707
|
const { metadataCommand } = await import('./functions/app/commands/fn/metadata.js');
|
|
1599
1708
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1600
1709
|
try {
|
|
@@ -1610,25 +1719,34 @@ function buildCli(rawArgs) {
|
|
|
1610
1719
|
}
|
|
1611
1720
|
})
|
|
1612
1721
|
.command('pivot', 'Multi-dimensional cross-tab (rows x columns x values)', (a) => a
|
|
1613
|
-
.
|
|
1614
|
-
.option('
|
|
1722
|
+
.wrap(null)
|
|
1723
|
+
.option('app', APP_ID_OPTION)
|
|
1724
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1615
1725
|
.option('rows', {
|
|
1616
1726
|
type: 'array',
|
|
1617
|
-
describe: 'Row attribute(s); append :totals for
|
|
1727
|
+
describe: 'Row attribute(s), comma-separated or repeated; append :totals for totals of that attribute, e.g. category',
|
|
1618
1728
|
})
|
|
1619
1729
|
.option('columns', {
|
|
1620
1730
|
type: 'array',
|
|
1621
|
-
describe: 'Column attribute(s); append :totals.
|
|
1731
|
+
describe: 'Column attribute(s), comma-separated or repeated; append :totals for totals of that attribute, e.g. brand',
|
|
1732
|
+
})
|
|
1733
|
+
.option('values', {
|
|
1734
|
+
type: 'array',
|
|
1735
|
+
describe: 'Cell aggregations as <attribute>:<type[,type...]>; repeat to combine, e.g. price:avg. Required unless --spec or --spec-file is given',
|
|
1622
1736
|
})
|
|
1623
|
-
.option('values', { type: 'array', describe: 'Aggregations <attr>:<type[,type]>. Repeatable.' })
|
|
1624
1737
|
.option('totals', { type: 'boolean', describe: 'Compute grand totals' })
|
|
1625
1738
|
.option('spec', {
|
|
1626
1739
|
type: 'string',
|
|
1627
|
-
describe:
|
|
1740
|
+
describe: `Full PivotOptions JSON, instead of --rows/--columns/--values/--totals, e.g. '{"rows":[{"attribute":"category"}],"columns":[{"attribute":"brand"}],"values":[{"attribute":"price","types":["avg"]}]}'`,
|
|
1741
|
+
})
|
|
1742
|
+
.option('spec-file', {
|
|
1743
|
+
type: 'string',
|
|
1744
|
+
describe: 'Path to a JSON file with the PivotOptions, e.g. pivot.json',
|
|
1628
1745
|
})
|
|
1629
|
-
.option('
|
|
1630
|
-
.option('query',
|
|
1631
|
-
.
|
|
1746
|
+
.option('query', QUERY_OPTION)
|
|
1747
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1748
|
+
.epilog(QUERY_NOTES)
|
|
1749
|
+
.example('dcupl app fn pivot --model Article --rows category --columns brand --values price:avg', ''), async (argv) => {
|
|
1632
1750
|
const { pivotCommand } = await import('./functions/app/commands/fn/pivot.js');
|
|
1633
1751
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1634
1752
|
try {
|
|
@@ -1650,22 +1768,52 @@ function buildCli(rawArgs) {
|
|
|
1650
1768
|
}
|
|
1651
1769
|
})
|
|
1652
1770
|
.command('suggest', 'Typeahead suggestions for an attribute value', (a) => a
|
|
1653
|
-
.
|
|
1654
|
-
.option('
|
|
1655
|
-
.option('
|
|
1656
|
-
.option('
|
|
1657
|
-
|
|
1771
|
+
.wrap(null)
|
|
1772
|
+
.option('app', APP_ID_OPTION)
|
|
1773
|
+
.option('model', MODEL_KEY_OPTION)
|
|
1774
|
+
.option('attribute', {
|
|
1775
|
+
type: 'string',
|
|
1776
|
+
demandOption: true,
|
|
1777
|
+
describe: 'Attribute whose values are searched, e.g. brand',
|
|
1778
|
+
})
|
|
1779
|
+
.option('value', {
|
|
1780
|
+
type: 'string',
|
|
1781
|
+
demandOption: true,
|
|
1782
|
+
describe: 'Text to match: a plain value is a case-insensitive prefix, /pattern/ a regular expression, e.g. ni',
|
|
1783
|
+
})
|
|
1784
|
+
.option('max', {
|
|
1785
|
+
type: 'number',
|
|
1786
|
+
describe: 'Maximum number of suggestions (default 20), e.g. 5',
|
|
1787
|
+
})
|
|
1658
1788
|
.option('relevant-data', {
|
|
1659
1789
|
type: 'string',
|
|
1660
1790
|
choices: ['filtered', 'all', 'excludeQuery'],
|
|
1791
|
+
describe: 'Records to search: filtered = matching --query (default), all = every record, excludeQuery = --query without the group named by --exclude-query, e.g. all',
|
|
1792
|
+
})
|
|
1793
|
+
.option('calculate-result-keys', {
|
|
1794
|
+
type: 'boolean',
|
|
1795
|
+
describe: 'Return the keys of the matching records per suggestion (on by default; --no-calculate-result-keys leaves them empty)',
|
|
1796
|
+
})
|
|
1797
|
+
.option('exclude-undefineds', {
|
|
1798
|
+
type: 'boolean',
|
|
1799
|
+
describe: 'Leave out the records without a value (on by default; --no-exclude-undefineds suggests them too)',
|
|
1800
|
+
})
|
|
1801
|
+
.option('exclude-nulls', {
|
|
1802
|
+
type: 'boolean',
|
|
1803
|
+
describe: 'Leave out null values (on by default; --no-exclude-nulls suggests them too)',
|
|
1804
|
+
})
|
|
1805
|
+
.option('exclude-query', {
|
|
1806
|
+
type: 'string',
|
|
1807
|
+
describe: `Group of --query to ignore, by its groupKey; only with --relevant-data excludeQuery, e.g. '{"groupKey":"brandGroup"}'`,
|
|
1808
|
+
})
|
|
1809
|
+
.option('exclude-query-file', {
|
|
1810
|
+
type: 'string',
|
|
1811
|
+
describe: 'Path to a JSON file with the --exclude-query value, e.g. exclude.json',
|
|
1661
1812
|
})
|
|
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) => {
|
|
1813
|
+
.option('query', QUERY_OPTION)
|
|
1814
|
+
.option('query-file', QUERY_FILE_OPTION)
|
|
1815
|
+
.epilog(QUERY_NOTES)
|
|
1816
|
+
.example('dcupl app fn suggest --model Article --attribute brand --value ni', ''), async (argv) => {
|
|
1669
1817
|
const { suggestCommand } = await import('./functions/app/commands/fn/suggest.js');
|
|
1670
1818
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1671
1819
|
try {
|