@trillboards/cli 0.1.0
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 +1288 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/base-command.d.ts +20 -0
- package/dist/base-command.js +60 -0
- package/dist/commands/api.d.ts +14 -0
- package/dist/commands/api.js +80 -0
- package/dist/commands/audience/live.d.ts +14 -0
- package/dist/commands/audience/live.js +117 -0
- package/dist/commands/billing/usage.d.ts +10 -0
- package/dist/commands/billing/usage.js +92 -0
- package/dist/commands/billing.d.ts +6 -0
- package/dist/commands/billing.js +49 -0
- package/dist/commands/debug.d.ts +10 -0
- package/dist/commands/debug.js +156 -0
- package/dist/commands/doctor.d.ts +6 -0
- package/dist/commands/doctor.js +145 -0
- package/dist/commands/earnings.d.ts +15 -0
- package/dist/commands/earnings.js +182 -0
- package/dist/commands/endpoints/index.d.ts +9 -0
- package/dist/commands/endpoints/index.js +35 -0
- package/dist/commands/errors/index.d.ts +9 -0
- package/dist/commands/errors/index.js +34 -0
- package/dist/commands/fill-rate.d.ts +12 -0
- package/dist/commands/fill-rate.js +141 -0
- package/dist/commands/generated/generated-changelog-query.d.ts +14 -0
- package/dist/commands/generated/generated-changelog-query.js +35 -0
- package/dist/commands/generated/generated-data-api-aggregate.d.ts +15 -0
- package/dist/commands/generated/generated-data-api-aggregate.js +38 -0
- package/dist/commands/generated/generated-data-api-list-screens.d.ts +16 -0
- package/dist/commands/generated/generated-data-api-list-screens.js +41 -0
- package/dist/commands/generated/generated-data-api-lookalike-screens.d.ts +15 -0
- package/dist/commands/generated/generated-data-api-lookalike-screens.js +38 -0
- package/dist/commands/generated/generated-data-api-query-dsl.d.ts +13 -0
- package/dist/commands/generated/generated-data-api-query-dsl.js +32 -0
- package/dist/commands/generated/generated-data-api-screen-audience-history.d.ts +17 -0
- package/dist/commands/generated/generated-data-api-screen-audience-history.js +41 -0
- package/dist/commands/generated/generated-data-api-screen-audience-live.d.ts +14 -0
- package/dist/commands/generated/generated-data-api-screen-audience-live.js +32 -0
- package/dist/commands/generated/generated-data-api-semantic-search.d.ts +16 -0
- package/dist/commands/generated/generated-data-api-semantic-search.js +41 -0
- package/dist/commands/generated/generated-data-api-stats.d.ts +12 -0
- package/dist/commands/generated/generated-data-api-stats.js +26 -0
- package/dist/commands/generated/generated-data-api-stream.d.ts +14 -0
- package/dist/commands/generated/generated-data-api-stream.js +35 -0
- package/dist/commands/generated/generated-data-api-usage.d.ts +13 -0
- package/dist/commands/generated/generated-data-api-usage.js +32 -0
- package/dist/commands/generated/generated-device-ota-manifest.d.ts +13 -0
- package/dist/commands/generated/generated-device-ota-manifest.js +32 -0
- package/dist/commands/generated/generated-example-healthcheck.d.ts +13 -0
- package/dist/commands/generated/generated-example-healthcheck.js +32 -0
- package/dist/commands/generated/generated-playground-dry-run.d.ts +14 -0
- package/dist/commands/generated/generated-playground-dry-run.js +32 -0
- package/dist/commands/generated/generated-request-metadata-get.d.ts +14 -0
- package/dist/commands/generated/generated-request-metadata-get.js +32 -0
- package/dist/commands/generated/generated-sdk-enrich.d.ts +13 -0
- package/dist/commands/generated/generated-sdk-enrich.js +32 -0
- package/dist/commands/generated/generated-sdk-impression.d.ts +13 -0
- package/dist/commands/generated/generated-sdk-impression.js +32 -0
- package/dist/commands/generated/generated-sdk-qr-beacon.d.ts +13 -0
- package/dist/commands/generated/generated-sdk-qr-beacon.js +32 -0
- package/dist/commands/generated/generated-sdk-qr-scan.d.ts +13 -0
- package/dist/commands/generated/generated-sdk-qr-scan.js +32 -0
- package/dist/commands/generated/generated-sensing-paired-training-upload.d.ts +13 -0
- package/dist/commands/generated/generated-sensing-paired-training-upload.js +32 -0
- package/dist/commands/listen.d.ts +39 -0
- package/dist/commands/listen.js +245 -0
- package/dist/commands/login.d.ts +7 -0
- package/dist/commands/login.js +68 -0
- package/dist/commands/logs/tail.d.ts +47 -0
- package/dist/commands/logs/tail.js +240 -0
- package/dist/commands/reconcile.d.ts +9 -0
- package/dist/commands/reconcile.js +58 -0
- package/dist/commands/sandbox/create.d.ts +6 -0
- package/dist/commands/sandbox/create.js +35 -0
- package/dist/commands/sandbox/emit.d.ts +12 -0
- package/dist/commands/sandbox/emit.js +57 -0
- package/dist/commands/sandbox/reset.d.ts +6 -0
- package/dist/commands/sandbox/reset.js +34 -0
- package/dist/commands/sandbox/status.d.ts +6 -0
- package/dist/commands/sandbox/status.js +58 -0
- package/dist/commands/screens/watch.d.ts +14 -0
- package/dist/commands/screens/watch.js +158 -0
- package/dist/commands/trigger.d.ts +9 -0
- package/dist/commands/trigger.js +53 -0
- package/dist/commands/validate.d.ts +12 -0
- package/dist/commands/validate.js +93 -0
- package/dist/commands/whoami.d.ts +6 -0
- package/dist/commands/whoami.js +39 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +32 -0
- package/dist/format-helpers.d.ts +46 -0
- package/dist/format-helpers.js +96 -0
- package/dist/http.d.ts +13 -0
- package/dist/http.js +51 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/output.d.ts +2 -0
- package/dist/output.js +78 -0
- package/oclif.manifest.json +2697 -0
- package/package.json +94 -0
package/dist/output.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export function formatOutput(data, format) {
|
|
2
|
+
switch (format) {
|
|
3
|
+
case 'json': {
|
|
4
|
+
return JSON.stringify(data, null, 2);
|
|
5
|
+
}
|
|
6
|
+
case 'yaml': {
|
|
7
|
+
return toYaml(data);
|
|
8
|
+
}
|
|
9
|
+
case 'table': {
|
|
10
|
+
return toTable(data);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function toYaml(data, indent = 0) {
|
|
15
|
+
const prefix = ' '.repeat(indent);
|
|
16
|
+
if (data === null || data === undefined) {
|
|
17
|
+
return `${prefix}null`;
|
|
18
|
+
}
|
|
19
|
+
if (typeof data === 'string' || typeof data === 'number' || typeof data === 'boolean') {
|
|
20
|
+
return `${prefix}${data}`;
|
|
21
|
+
}
|
|
22
|
+
if (Array.isArray(data)) {
|
|
23
|
+
if (data.length === 0)
|
|
24
|
+
return `${prefix}[]`;
|
|
25
|
+
return data.map((item) => {
|
|
26
|
+
if (typeof item === 'object' && item !== null) {
|
|
27
|
+
const inner = toYaml(item, indent + 1).trimStart();
|
|
28
|
+
return `${prefix}- ${inner}`;
|
|
29
|
+
}
|
|
30
|
+
return `${prefix}- ${item}`;
|
|
31
|
+
}).join('\n');
|
|
32
|
+
}
|
|
33
|
+
if (typeof data === 'object') {
|
|
34
|
+
const entries = Object.entries(data);
|
|
35
|
+
if (entries.length === 0)
|
|
36
|
+
return `${prefix}{}`;
|
|
37
|
+
return entries.map(([key, value]) => {
|
|
38
|
+
if (typeof value === 'object' && value !== null) {
|
|
39
|
+
return `${prefix}${key}:\n${toYaml(value, indent + 1)}`;
|
|
40
|
+
}
|
|
41
|
+
return `${prefix}${key}: ${value ?? 'null'}`;
|
|
42
|
+
}).join('\n');
|
|
43
|
+
}
|
|
44
|
+
return `${prefix}${String(data)}`;
|
|
45
|
+
}
|
|
46
|
+
function toTable(data) {
|
|
47
|
+
if (Array.isArray(data)) {
|
|
48
|
+
if (data.length === 0)
|
|
49
|
+
return '(empty)';
|
|
50
|
+
const first = data[0];
|
|
51
|
+
if (typeof first !== 'object' || first === null) {
|
|
52
|
+
return data.map(String).join('\n');
|
|
53
|
+
}
|
|
54
|
+
const keys = Object.keys(first);
|
|
55
|
+
const widths = keys.map((k) => {
|
|
56
|
+
const maxVal = Math.max(...data.map((row) => {
|
|
57
|
+
const v = row[k];
|
|
58
|
+
return String(v ?? '').length;
|
|
59
|
+
}));
|
|
60
|
+
return Math.max(k.length, maxVal);
|
|
61
|
+
});
|
|
62
|
+
const header = keys.map((k, i) => k.padEnd(widths[i])).join(' ');
|
|
63
|
+
const separator = widths.map((w) => '-'.repeat(w)).join(' ');
|
|
64
|
+
const rows = data.map((row) => keys.map((k, i) => {
|
|
65
|
+
const v = row[k];
|
|
66
|
+
return String(v ?? '').padEnd(widths[i]);
|
|
67
|
+
}).join(' '));
|
|
68
|
+
return [header, separator, ...rows].join('\n');
|
|
69
|
+
}
|
|
70
|
+
if (typeof data === 'object' && data !== null) {
|
|
71
|
+
const entries = Object.entries(data);
|
|
72
|
+
if (entries.length === 0)
|
|
73
|
+
return '(empty)';
|
|
74
|
+
const maxKeyLen = Math.max(...entries.map(([k]) => k.length));
|
|
75
|
+
return entries.map(([k, v]) => `${k.padEnd(maxKeyLen)} ${v ?? 'null'}`).join('\n');
|
|
76
|
+
}
|
|
77
|
+
return String(data);
|
|
78
|
+
}
|