@dcupl/cli 2.0.4 → 2.0.5
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.d.ts +4 -1
- package/dist/cli.js +78 -46
- package/dist/cli.js.map +1 -1
- package/dist/functions/app/commands/fn/_fn-helpers.d.ts +3 -0
- package/dist/functions/app/commands/fn/_fn-helpers.js +24 -13
- package/dist/functions/app/commands/fn/_fn-helpers.js.map +1 -1
- package/dist/functions/app/commands/fn/aggregate.js +4 -0
- package/dist/functions/app/commands/fn/aggregate.js.map +1 -1
- package/dist/functions/app/commands/fn/facets.js +2 -0
- package/dist/functions/app/commands/fn/facets.js.map +1 -1
- package/dist/functions/app/commands/fn/group-by.js +5 -0
- package/dist/functions/app/commands/fn/group-by.js.map +1 -1
- package/dist/functions/app/daemon/controllers/models.controller.js +1 -1
- package/dist/functions/app/daemon/controllers/models.controller.js.map +1 -1
- package/dist/functions/app/daemon/services/dcupl-host.service.d.ts +2 -1
- package/dist/functions/app/daemon/services/dcupl-host.service.js +15 -7
- package/dist/functions/app/daemon/services/dcupl-host.service.js.map +1 -1
- package/dist/functions/app/daemon/services/normalize-query.js +56 -1
- package/dist/functions/app/daemon/services/normalize-query.js.map +1 -1
- package/dist/functions/helper/help-wrap.d.ts +15 -0
- package/dist/functions/helper/help-wrap.js +179 -0
- package/dist/functions/helper/help-wrap.js.map +1 -0
- package/dist/functions/helper/parse-fail.d.ts +7 -0
- package/dist/functions/helper/parse-fail.js +106 -2
- package/dist/functions/helper/parse-fail.js.map +1 -1
- package/dist/functions/schemas/bundle.d.ts +32 -0
- package/dist/functions/schemas/bundle.js +72 -0
- package/dist/functions/schemas/bundle.js.map +1 -0
- package/dist/functions/schemas/command.d.ts +2 -2
- package/dist/functions/schemas/command.js +6 -6
- package/dist/functions/schemas/command.js.map +1 -1
- package/dist/functions/schemas/extract.d.ts +3 -1
- package/dist/functions/schemas/extract.js +60 -36
- package/dist/functions/schemas/extract.js.map +1 -1
- package/dist/functions/schemas/resolve.d.ts +4 -0
- package/dist/functions/schemas/resolve.js +31 -11
- package/dist/functions/schemas/resolve.js.map +1 -1
- package/dist/functions/schemas/schemas.bundle.json +1 -0
- package/package.json +8 -7
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
2
|
export declare const APP_SCRIPTS_TRUST_NOTE: string;
|
|
3
3
|
export declare const FILES_PUSH_NAME_UNSUPPORTED = "Named versions are created in the console; `--name` is not supported by `files push`";
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function attachDashValues(args: string[]): string[];
|
|
5
|
+
export declare function buildCli(cliArgs: string[], options?: {
|
|
6
|
+
helpWidth?: number | null;
|
|
7
|
+
}): yargs.Argv<{
|
|
5
8
|
json: boolean;
|
|
6
9
|
}>;
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FILES_PUSH_NAME_UNSUPPORTED = exports.APP_SCRIPTS_TRUST_NOTE = void 0;
|
|
4
|
+
exports.attachDashValues = attachDashValues;
|
|
4
5
|
exports.buildCli = buildCli;
|
|
5
6
|
const tslib_1 = require("tslib");
|
|
6
7
|
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
@@ -8,6 +9,7 @@ const common_1 = require("@dcupl/common");
|
|
|
8
9
|
const api_client_1 = require("./functions/helper/api-client");
|
|
9
10
|
const output_1 = require("./functions/helper/output");
|
|
10
11
|
const parse_fail_1 = require("./functions/helper/parse-fail");
|
|
12
|
+
const help_wrap_1 = require("./functions/helper/help-wrap");
|
|
11
13
|
const command_js_1 = require("./functions/schemas/command.js");
|
|
12
14
|
const workflow_presets_js_1 = require("./functions/generate/files/workflow-presets.js");
|
|
13
15
|
const script_starters_js_1 = require("./functions/generate/files/script-starters.js");
|
|
@@ -48,6 +50,7 @@ const MODEL_KEY_OPTION = {
|
|
|
48
50
|
describe: 'Model key, case-sensitive (see `dcupl app models keys`), e.g. Article',
|
|
49
51
|
};
|
|
50
52
|
const QUERY_EXAMPLE = `'{"operator":"eq","attribute":"brand","value":"Nike"}'`;
|
|
53
|
+
const QUERY_GROUP_EXAMPLE = `'{"groupType":"or","queries":[{"operator":"eq","attribute":"brand","value":"Nike"},{"operator":"gt","attribute":"price","value":100}]}'`;
|
|
51
54
|
const QUERY_OPERATORS = common_1.DcuplQueryOperatorsAsArray.join(', ');
|
|
52
55
|
const QUERY_OPTION = {
|
|
53
56
|
type: 'string',
|
|
@@ -58,13 +61,43 @@ const QUERY_NOTES = [
|
|
|
58
61
|
' eq is the equality operator (the whole value); there is no "equal", "equals" or "contains"',
|
|
59
62
|
` in takes an array and matches any of its entries: '{"operator":"in","attribute":"brand","value":["Nike","Adidas"]}'`,
|
|
60
63
|
` 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:
|
|
64
|
+
` a group combines conditions: ${QUERY_GROUP_EXAMPLE}`,
|
|
62
65
|
].join('\n');
|
|
66
|
+
const queryGroupNotes = (takers, verbHelp, more = []) => [
|
|
67
|
+
`Filters (--query on ${takers}):`,
|
|
68
|
+
` built-in operators: ${QUERY_OPERATORS}`,
|
|
69
|
+
` a condition is { operator, attribute, value }: ${QUERY_EXAMPLE}`,
|
|
70
|
+
` a group is { groupType, queries } (groupType "and" or "or"): ${QUERY_GROUP_EXAMPLE}`,
|
|
71
|
+
' there is no "equal", "equals", "contains" or "startsWith": eq matches the whole value, find with a "/.../" string is a regex (the substring match)',
|
|
72
|
+
...more,
|
|
73
|
+
` every option with an example: \`${verbHelp}\``,
|
|
74
|
+
].join('\n');
|
|
75
|
+
const noEffectDescribe = (verb) => `Deprecated, no effect on ${verb} (the SDK ignores it): passing it warns and it will be removed in the next major version; leave records out with --query`;
|
|
76
|
+
const NO_EFFECT_ON_AGGREGATE = noEffectDescribe('aggregate');
|
|
77
|
+
const NO_EFFECT_ON_GROUP_BY = noEffectDescribe('groupBy');
|
|
63
78
|
const QUERY_FILE_OPTION = {
|
|
64
79
|
type: 'string',
|
|
65
80
|
describe: 'Path to a JSON file with the filter, same shapes as --query (--query wins if both are given), e.g. filter.json',
|
|
66
81
|
};
|
|
67
|
-
|
|
82
|
+
const DASH_VALUE_OPTIONS = new Set(['--bins']);
|
|
83
|
+
function attachDashValues(args) {
|
|
84
|
+
const out = [];
|
|
85
|
+
for (let i = 0; i < args.length; i++) {
|
|
86
|
+
const next = args[i + 1];
|
|
87
|
+
if (DASH_VALUE_OPTIONS.has(args[i]) && next !== undefined && /^-+[\d.]/.test(next)) {
|
|
88
|
+
out.push(`${args[i]}=${next}`);
|
|
89
|
+
i++;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
out.push(args[i]);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
function buildCli(cliArgs, options = {}) {
|
|
98
|
+
const rawArgs = attachDashValues(cliArgs);
|
|
99
|
+
const helpStream = rawArgs.includes('--help') ? process.stdout : process.stderr;
|
|
100
|
+
const help = (0, help_wrap_1.helpWrapper)(options.helpWidth === undefined ? (0, help_wrap_1.terminalWidth)(helpStream) : options.helpWidth);
|
|
68
101
|
const instance = (0, yargs_1.default)(rawArgs);
|
|
69
102
|
return (instance
|
|
70
103
|
.version(false)
|
|
@@ -1441,9 +1474,9 @@ function buildCli(rawArgs) {
|
|
|
1441
1474
|
})
|
|
1442
1475
|
.demandCommand(1);
|
|
1443
1476
|
})
|
|
1444
|
-
.command('query <verb>', 'Query records', (yyy) => yyy
|
|
1445
|
-
.
|
|
1446
|
-
.
|
|
1477
|
+
.command('query <verb>', 'Query records', (yyy) => help.page(yyy
|
|
1478
|
+
.epilog(help.notes(queryGroupNotes('execute', 'dcupl app query execute --help')))
|
|
1479
|
+
.command('one', 'Fetch single record', (a) => help.page(a
|
|
1447
1480
|
.option('app', APP_ID_OPTION)
|
|
1448
1481
|
.option('model', MODEL_KEY_OPTION)
|
|
1449
1482
|
.option('item-key', {
|
|
@@ -1451,7 +1484,7 @@ function buildCli(rawArgs) {
|
|
|
1451
1484
|
demandOption: true,
|
|
1452
1485
|
describe: 'Key of the record (the value of its key property), e.g. 1001',
|
|
1453
1486
|
})
|
|
1454
|
-
.example('dcupl app query one --model Article --item-key 1001'
|
|
1487
|
+
.example(...help.example('dcupl app query one --model Article --item-key 1001'))), async (argv) => {
|
|
1455
1488
|
const { oneCommand } = await import('./functions/app/commands/query/one.js');
|
|
1456
1489
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1457
1490
|
try {
|
|
@@ -1461,18 +1494,20 @@ function buildCli(rawArgs) {
|
|
|
1461
1494
|
output.error(err.message, err.code || 'QUERY_ONE_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1462
1495
|
}
|
|
1463
1496
|
})
|
|
1464
|
-
.command('execute', 'Filter+sort+paginate records', (a) => a
|
|
1465
|
-
.wrap(null)
|
|
1497
|
+
.command('execute', 'Filter+sort+paginate records', (a) => help.page(a
|
|
1466
1498
|
.option('app', APP_ID_OPTION)
|
|
1467
1499
|
.option('model', MODEL_KEY_OPTION)
|
|
1468
1500
|
.option('query', QUERY_OPTION)
|
|
1469
1501
|
.option('query-file', QUERY_FILE_OPTION)
|
|
1470
|
-
.epilog(QUERY_NOTES)
|
|
1502
|
+
.epilog(help.notes(QUERY_NOTES))
|
|
1471
1503
|
.option('sort', {
|
|
1472
1504
|
type: 'string',
|
|
1473
1505
|
describe: 'Order as <attribute>[:ASC|DESC], comma-separated, ASC by default, e.g. price:DESC or price:DESC,productName:ASC',
|
|
1474
1506
|
})
|
|
1475
|
-
.option('limit', {
|
|
1507
|
+
.option('limit', {
|
|
1508
|
+
type: 'number',
|
|
1509
|
+
describe: 'Maximum number of records to return, e.g. 10',
|
|
1510
|
+
})
|
|
1476
1511
|
.option('start', {
|
|
1477
1512
|
type: 'number',
|
|
1478
1513
|
describe: '0-based offset of the first record to return, e.g. 20',
|
|
@@ -1481,7 +1516,7 @@ function buildCli(rawArgs) {
|
|
|
1481
1516
|
type: 'string',
|
|
1482
1517
|
describe: 'Attributes to return (the key always comes back): comma list, JSON array or JSON object, e.g. productName,price',
|
|
1483
1518
|
})
|
|
1484
|
-
.example(`dcupl app query execute --model Article --query ${QUERY_EXAMPLE} --sort price:DESC --limit 10 --projection productName,price
|
|
1519
|
+
.example(...help.example(`dcupl app query execute --model Article --query ${QUERY_EXAMPLE} --sort price:DESC --limit 10 --projection productName,price`))), async (argv) => {
|
|
1485
1520
|
const { executeCommand } = await import('./functions/app/commands/query/execute.js');
|
|
1486
1521
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1487
1522
|
try {
|
|
@@ -1500,10 +1535,12 @@ function buildCli(rawArgs) {
|
|
|
1500
1535
|
output.error(err.message, err.code || 'QUERY_EXEC_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1501
1536
|
}
|
|
1502
1537
|
})
|
|
1503
|
-
.demandCommand(1))
|
|
1504
|
-
.command('fn <verb>', 'Run analytical functions', (yyy) => yyy
|
|
1505
|
-
.
|
|
1506
|
-
|
|
1538
|
+
.demandCommand(1)))
|
|
1539
|
+
.command('fn <verb>', 'Run analytical functions', (yyy) => help.page(yyy
|
|
1540
|
+
.epilog(help.notes(queryGroupNotes('every verb', 'dcupl app fn <verb> --help', [
|
|
1541
|
+
' a record count is currentSize of `dcupl app fn metadata --model <key>`, with --query the count of the matches',
|
|
1542
|
+
])))
|
|
1543
|
+
.command('facets', 'Value distribution on attribute', (a) => help.page(a
|
|
1507
1544
|
.option('app', APP_ID_OPTION)
|
|
1508
1545
|
.option('model', MODEL_KEY_OPTION)
|
|
1509
1546
|
.option('attribute', {
|
|
@@ -1525,7 +1562,7 @@ function buildCli(rawArgs) {
|
|
|
1525
1562
|
})
|
|
1526
1563
|
.option('query', QUERY_OPTION)
|
|
1527
1564
|
.option('query-file', QUERY_FILE_OPTION)
|
|
1528
|
-
.epilog(QUERY_NOTES)
|
|
1565
|
+
.epilog(help.notes(QUERY_NOTES))
|
|
1529
1566
|
.option('limit', {
|
|
1530
1567
|
type: 'number',
|
|
1531
1568
|
describe: 'Maximum number of values; a top-N needs --sort as well, e.g. 10',
|
|
@@ -1545,7 +1582,7 @@ function buildCli(rawArgs) {
|
|
|
1545
1582
|
default: false,
|
|
1546
1583
|
describe: 'Add resultKeys (the keys of the matching records) to each value',
|
|
1547
1584
|
})
|
|
1548
|
-
.example('dcupl app fn facets --model Article --attribute brand --sort size-desc --limit 10'
|
|
1585
|
+
.example(...help.example('dcupl app fn facets --model Article --attribute brand --sort size-desc --limit 10'))), async (argv) => {
|
|
1549
1586
|
const { facetsCommand } = await import('./functions/app/commands/fn/facets.js');
|
|
1550
1587
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1551
1588
|
try {
|
|
@@ -1568,8 +1605,7 @@ function buildCli(rawArgs) {
|
|
|
1568
1605
|
output.error(err.message, err.code || 'FN_FACETS_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1569
1606
|
}
|
|
1570
1607
|
})
|
|
1571
|
-
.command('aggregate', 'Aggregate stats on attribute', (a) => a
|
|
1572
|
-
.wrap(null)
|
|
1608
|
+
.command('aggregate', 'Aggregate stats on attribute', (a) => help.page(a
|
|
1573
1609
|
.option('app', APP_ID_OPTION)
|
|
1574
1610
|
.option('model', MODEL_KEY_OPTION)
|
|
1575
1611
|
.option('attribute', {
|
|
@@ -1583,7 +1619,7 @@ function buildCli(rawArgs) {
|
|
|
1583
1619
|
})
|
|
1584
1620
|
.option('query', QUERY_OPTION)
|
|
1585
1621
|
.option('query-file', QUERY_FILE_OPTION)
|
|
1586
|
-
.epilog(QUERY_NOTES)
|
|
1622
|
+
.epilog(help.notes(QUERY_NOTES))
|
|
1587
1623
|
.option('include-keys', {
|
|
1588
1624
|
type: 'boolean',
|
|
1589
1625
|
default: false,
|
|
@@ -1591,11 +1627,11 @@ function buildCli(rawArgs) {
|
|
|
1591
1627
|
})
|
|
1592
1628
|
.option('bins', {
|
|
1593
1629
|
type: 'string',
|
|
1594
|
-
describe: 'Numeric ranges <from>-<to> for a histogram, comma-separated (adds the group type).
|
|
1630
|
+
describe: 'Numeric ranges <from>-<to> for a histogram, comma-separated (adds the group type). A bin holds from <= value < to; leave a bound out for an open end, e.g. 0-50,50-100,100- ; negative bounds work too, e.g. -10-0,0-10',
|
|
1595
1631
|
})
|
|
1596
1632
|
.option('group-options', {
|
|
1597
1633
|
type: 'string',
|
|
1598
|
-
describe: `groupOptions as JSON, instead of --bins (
|
|
1634
|
+
describe: `groupOptions as JSON, instead of --bins (a group holds from <= value < to; leave out from or to for an open end), e.g. '{"groups":[{"from":0,"to":50},{"from":50,"to":100},{"from":100}]}'`,
|
|
1599
1635
|
})
|
|
1600
1636
|
.option('group-options-file', {
|
|
1601
1637
|
type: 'string',
|
|
@@ -1607,7 +1643,7 @@ function buildCli(rawArgs) {
|
|
|
1607
1643
|
})
|
|
1608
1644
|
.option('exclude-zeros', {
|
|
1609
1645
|
type: 'boolean',
|
|
1610
|
-
describe:
|
|
1646
|
+
describe: NO_EFFECT_ON_AGGREGATE,
|
|
1611
1647
|
})
|
|
1612
1648
|
.option('exclude-undefineds', {
|
|
1613
1649
|
type: 'boolean',
|
|
@@ -1615,10 +1651,10 @@ function buildCli(rawArgs) {
|
|
|
1615
1651
|
})
|
|
1616
1652
|
.option('exclude-unresolved', {
|
|
1617
1653
|
type: 'boolean',
|
|
1618
|
-
describe:
|
|
1654
|
+
describe: NO_EFFECT_ON_AGGREGATE,
|
|
1619
1655
|
})
|
|
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', '(
|
|
1656
|
+
.example(...help.example('dcupl app fn aggregate --model Article --attribute price --types sum,avg'))
|
|
1657
|
+
.example(...help.example('dcupl app fn aggregate --model Article --attribute price --bins 0-50,50-100,100-', '(bins 0 <= price < 50, 50 <= price < 100, price >= 100)'))), async (argv) => {
|
|
1622
1658
|
const { aggregateCommand } = await import('./functions/app/commands/fn/aggregate.js');
|
|
1623
1659
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1624
1660
|
try {
|
|
@@ -1643,8 +1679,7 @@ function buildCli(rawArgs) {
|
|
|
1643
1679
|
output.error(err.message, err.code || 'FN_AGGREGATE_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1644
1680
|
}
|
|
1645
1681
|
})
|
|
1646
|
-
.command('groupBy', 'Group records by attribute value', (a) => a
|
|
1647
|
-
.wrap(null)
|
|
1682
|
+
.command('groupBy', 'Group records by attribute value', (a) => help.page(a
|
|
1648
1683
|
.option('app', APP_ID_OPTION)
|
|
1649
1684
|
.option('model', MODEL_KEY_OPTION)
|
|
1650
1685
|
.option('attribute', {
|
|
@@ -1654,22 +1689,22 @@ function buildCli(rawArgs) {
|
|
|
1654
1689
|
})
|
|
1655
1690
|
.option('query', QUERY_OPTION)
|
|
1656
1691
|
.option('query-file', QUERY_FILE_OPTION)
|
|
1657
|
-
.epilog(QUERY_NOTES)
|
|
1692
|
+
.epilog(help.notes(QUERY_NOTES))
|
|
1658
1693
|
.option('aggregate', {
|
|
1659
1694
|
type: 'array',
|
|
1660
1695
|
describe: 'Aggregate per group as <attribute>:<type[,type...]> (count,sum,avg,min,max,distinct); repeat to combine, e.g. inStock:sum',
|
|
1661
1696
|
})
|
|
1662
1697
|
.option('exclude-zeros', {
|
|
1663
1698
|
type: 'boolean',
|
|
1664
|
-
describe:
|
|
1699
|
+
describe: NO_EFFECT_ON_GROUP_BY,
|
|
1665
1700
|
})
|
|
1666
1701
|
.option('exclude-undefineds', {
|
|
1667
1702
|
type: 'boolean',
|
|
1668
|
-
describe:
|
|
1703
|
+
describe: `${NO_EFFECT_ON_GROUP_BY} (records without a value never form a group)`,
|
|
1669
1704
|
})
|
|
1670
1705
|
.option('exclude-unresolved', {
|
|
1671
1706
|
type: 'boolean',
|
|
1672
|
-
describe:
|
|
1707
|
+
describe: NO_EFFECT_ON_GROUP_BY,
|
|
1673
1708
|
})
|
|
1674
1709
|
.option('sort', {
|
|
1675
1710
|
type: 'string',
|
|
@@ -1677,7 +1712,7 @@ function buildCli(rawArgs) {
|
|
|
1677
1712
|
})
|
|
1678
1713
|
.option('limit', { type: 'number', describe: 'Maximum number of groups, e.g. 10' })
|
|
1679
1714
|
.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'
|
|
1715
|
+
.example(...help.example('dcupl app fn groupBy --model Article --attribute brand --aggregate inStock:sum --sort inStock_sum:DESC'))), async (argv) => {
|
|
1681
1716
|
const { groupByCommand } = await import('./functions/app/commands/fn/group-by.js');
|
|
1682
1717
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1683
1718
|
try {
|
|
@@ -1700,14 +1735,13 @@ function buildCli(rawArgs) {
|
|
|
1700
1735
|
output.error(err.message, err.code || 'FN_GROUPBY_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1701
1736
|
}
|
|
1702
1737
|
})
|
|
1703
|
-
.command('metadata', 'List metadata + currentSize for model', (a) => a
|
|
1704
|
-
.wrap(null)
|
|
1738
|
+
.command('metadata', 'List metadata + currentSize for model', (a) => help.page(a
|
|
1705
1739
|
.option('app', APP_ID_OPTION)
|
|
1706
1740
|
.option('model', MODEL_KEY_OPTION)
|
|
1707
1741
|
.option('query', QUERY_OPTION)
|
|
1708
1742
|
.option('query-file', QUERY_FILE_OPTION)
|
|
1709
|
-
.epilog(QUERY_NOTES)
|
|
1710
|
-
.example('dcupl app fn metadata --model Article'
|
|
1743
|
+
.epilog(help.notes(QUERY_NOTES))
|
|
1744
|
+
.example(...help.example('dcupl app fn metadata --model Article'))), async (argv) => {
|
|
1711
1745
|
const { metadataCommand } = await import('./functions/app/commands/fn/metadata.js');
|
|
1712
1746
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1713
1747
|
try {
|
|
@@ -1722,8 +1756,7 @@ function buildCli(rawArgs) {
|
|
|
1722
1756
|
output.error(err.message, err.code || 'FN_METADATA_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1723
1757
|
}
|
|
1724
1758
|
})
|
|
1725
|
-
.command('pivot', 'Multi-dimensional cross-tab (rows x columns x values)', (a) => a
|
|
1726
|
-
.wrap(null)
|
|
1759
|
+
.command('pivot', 'Multi-dimensional cross-tab (rows x columns x values)', (a) => help.page(a
|
|
1727
1760
|
.option('app', APP_ID_OPTION)
|
|
1728
1761
|
.option('model', MODEL_KEY_OPTION)
|
|
1729
1762
|
.option('rows', {
|
|
@@ -1749,8 +1782,8 @@ function buildCli(rawArgs) {
|
|
|
1749
1782
|
})
|
|
1750
1783
|
.option('query', QUERY_OPTION)
|
|
1751
1784
|
.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'
|
|
1785
|
+
.epilog(help.notes(QUERY_NOTES))
|
|
1786
|
+
.example(...help.example('dcupl app fn pivot --model Article --rows category --columns brand --values price:avg'))), async (argv) => {
|
|
1754
1787
|
const { pivotCommand } = await import('./functions/app/commands/fn/pivot.js');
|
|
1755
1788
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1756
1789
|
try {
|
|
@@ -1771,8 +1804,7 @@ function buildCli(rawArgs) {
|
|
|
1771
1804
|
output.error(err.message, err.code || 'FN_PIVOT_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1772
1805
|
}
|
|
1773
1806
|
})
|
|
1774
|
-
.command('suggest', 'Typeahead suggestions for an attribute value', (a) => a
|
|
1775
|
-
.wrap(null)
|
|
1807
|
+
.command('suggest', 'Typeahead suggestions for an attribute value', (a) => help.page(a
|
|
1776
1808
|
.option('app', APP_ID_OPTION)
|
|
1777
1809
|
.option('model', MODEL_KEY_OPTION)
|
|
1778
1810
|
.option('attribute', {
|
|
@@ -1816,8 +1848,8 @@ function buildCli(rawArgs) {
|
|
|
1816
1848
|
})
|
|
1817
1849
|
.option('query', QUERY_OPTION)
|
|
1818
1850
|
.option('query-file', QUERY_FILE_OPTION)
|
|
1819
|
-
.epilog(QUERY_NOTES)
|
|
1820
|
-
.example('dcupl app fn suggest --model Article --attribute brand --value ni'
|
|
1851
|
+
.epilog(help.notes(QUERY_NOTES))
|
|
1852
|
+
.example(...help.example('dcupl app fn suggest --model Article --attribute brand --value ni'))), async (argv) => {
|
|
1821
1853
|
const { suggestCommand } = await import('./functions/app/commands/fn/suggest.js');
|
|
1822
1854
|
const output = (0, output_1.createOutput)(argv.json);
|
|
1823
1855
|
try {
|
|
@@ -1841,7 +1873,7 @@ function buildCli(rawArgs) {
|
|
|
1841
1873
|
output.error(err.message, err.code || 'FN_SUGGEST_FAILED', err.details === undefined ? undefined : { details: err.details });
|
|
1842
1874
|
}
|
|
1843
1875
|
})
|
|
1844
|
-
.demandCommand(1))
|
|
1876
|
+
.demandCommand(1)))
|
|
1845
1877
|
.command('loaders <subcommand>', 'Manage loaders on a daemon', (yyy) => yyy
|
|
1846
1878
|
.command('add', 'Register a loader source', (a) => a
|
|
1847
1879
|
.option('app', { type: 'string', describe: 'App id' })
|