@ted-galago/wave-cli 0.1.2 → 0.1.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/index.cjs +105 -55
- package/dist/index.js +105 -55
- package/package.json +2 -1
- package/scripts/verify-dev-api.mjs +302 -0
package/dist/index.cjs
CHANGED
|
@@ -181,6 +181,9 @@ function debugLog(config, message) {
|
|
|
181
181
|
function graphqlOperationName(command) {
|
|
182
182
|
return command.split(/[^a-zA-Z0-9]/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
|
|
183
183
|
}
|
|
184
|
+
function toCamelCase(value) {
|
|
185
|
+
return value.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
|
|
186
|
+
}
|
|
184
187
|
function inferStatusFromGraphqlErrors(errors) {
|
|
185
188
|
if (!Array.isArray(errors) || errors.length === 0) {
|
|
186
189
|
return 400;
|
|
@@ -227,18 +230,39 @@ function graphqlTypeForValue(value) {
|
|
|
227
230
|
}
|
|
228
231
|
return "JSON";
|
|
229
232
|
}
|
|
233
|
+
function graphqlTypeForVariable(name, value) {
|
|
234
|
+
if (name === "id" || name.endsWith("Id")) {
|
|
235
|
+
return "ID";
|
|
236
|
+
}
|
|
237
|
+
if (name.endsWith("Ids")) {
|
|
238
|
+
return "[ID!]";
|
|
239
|
+
}
|
|
240
|
+
return graphqlTypeForValue(value);
|
|
241
|
+
}
|
|
242
|
+
function withNonNull(typeName) {
|
|
243
|
+
return typeName.endsWith("!") ? typeName : `${typeName}!`;
|
|
244
|
+
}
|
|
245
|
+
function normalizeGraphqlVariables(variables) {
|
|
246
|
+
const normalized = {};
|
|
247
|
+
Object.entries(variables).forEach(([key, value]) => {
|
|
248
|
+
normalized[toCamelCase(key)] = value;
|
|
249
|
+
});
|
|
250
|
+
return normalized;
|
|
251
|
+
}
|
|
230
252
|
function buildGraphqlBody(input) {
|
|
253
|
+
const graphqlField = toCamelCase(input.field);
|
|
254
|
+
const graphqlVariables = normalizeGraphqlVariables(input.variables);
|
|
231
255
|
const operationName = graphqlOperationName(input.command);
|
|
232
|
-
const variableEntries = Object.entries(
|
|
233
|
-
const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${
|
|
256
|
+
const variableEntries = Object.entries(graphqlVariables).filter(([, value]) => value !== void 0);
|
|
257
|
+
const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${withNonNull(graphqlTypeForVariable(name, value))}`).join(", ");
|
|
234
258
|
const fieldArgs = variableEntries.map(([name]) => `${name}: $${name}`).join(", ");
|
|
235
259
|
const signature = variableDecl.length > 0 ? `(${variableDecl})` : "";
|
|
236
260
|
const args = fieldArgs.length > 0 ? `(${fieldArgs})` : "";
|
|
237
|
-
const query = `${input.operationType} ${operationName}${signature} { ${
|
|
261
|
+
const query = `${input.operationType} ${operationName}${signature} { ${graphqlField}${args} ${input.selectionSet} }`;
|
|
238
262
|
return {
|
|
239
263
|
operationName,
|
|
240
264
|
query,
|
|
241
|
-
variables:
|
|
265
|
+
variables: graphqlVariables
|
|
242
266
|
};
|
|
243
267
|
}
|
|
244
268
|
async function graphqlRequest(input) {
|
|
@@ -289,7 +313,7 @@ async function graphqlRequest(input) {
|
|
|
289
313
|
exitCode: mapStatusToExitCode(status)
|
|
290
314
|
};
|
|
291
315
|
}
|
|
292
|
-
const fieldPayload = gqlData[input.field];
|
|
316
|
+
const fieldPayload = gqlData[toCamelCase(input.field)];
|
|
293
317
|
if (input.operationType === "mutation") {
|
|
294
318
|
const mutationPayload = fieldPayload && typeof fieldPayload === "object" ? fieldPayload : {};
|
|
295
319
|
const ok = Boolean(mutationPayload.ok);
|
|
@@ -302,7 +326,9 @@ async function graphqlRequest(input) {
|
|
|
302
326
|
status,
|
|
303
327
|
data: null,
|
|
304
328
|
error: {
|
|
305
|
-
code: String(
|
|
329
|
+
code: String(
|
|
330
|
+
mutationPayload.errorCode ?? mutationPayload.error_code ?? `http_${status}`
|
|
331
|
+
),
|
|
306
332
|
message: "Mutation failed.",
|
|
307
333
|
details: {
|
|
308
334
|
errors: mutationPayload.errors ?? null,
|
|
@@ -405,10 +431,10 @@ function buildCliErrorEnvelope(params) {
|
|
|
405
431
|
}
|
|
406
432
|
function defaultQuerySelectionSet(field, isList) {
|
|
407
433
|
if (field === "organization") {
|
|
408
|
-
return "{ id slug
|
|
434
|
+
return "{ id slug membersCount organizationDetail { title name description timezone workspaceName } }";
|
|
409
435
|
}
|
|
410
436
|
if (isList) {
|
|
411
|
-
return "{ data { id type attributes } count
|
|
437
|
+
return "{ data { id type attributes } count currentPage totalPages }";
|
|
412
438
|
}
|
|
413
439
|
return "{ id type attributes }";
|
|
414
440
|
}
|
|
@@ -448,7 +474,7 @@ function normalizeGraphqlVariable(key, value) {
|
|
|
448
474
|
}
|
|
449
475
|
return parseBooleanMaybe(trimmed);
|
|
450
476
|
}
|
|
451
|
-
function
|
|
477
|
+
function normalizeGraphqlVariables2(raw) {
|
|
452
478
|
const normalized = {};
|
|
453
479
|
Object.entries(raw).forEach(([key, value]) => {
|
|
454
480
|
const next = normalizeGraphqlVariable(key, value);
|
|
@@ -505,7 +531,7 @@ async function runGraphqlMutationCommand(input) {
|
|
|
505
531
|
operationType: "mutation",
|
|
506
532
|
field: input.field,
|
|
507
533
|
variables: input.variables ?? {},
|
|
508
|
-
selectionSet: input.selectionSet ?? "{ ok status
|
|
534
|
+
selectionSet: input.selectionSet ?? "{ ok status errorCode data errors }"
|
|
509
535
|
});
|
|
510
536
|
printEnvelopeAndExit(result);
|
|
511
537
|
} catch (error) {
|
|
@@ -1155,6 +1181,21 @@ function buildDataJsonHelp(rootKey, mode) {
|
|
|
1155
1181
|
|
|
1156
1182
|
// src/commands/entityCrud.ts
|
|
1157
1183
|
var idSchema = import_zod2.z.string().min(1);
|
|
1184
|
+
function toSingularResourceName(resourcePath) {
|
|
1185
|
+
if (resourcePath === "organization_meta_profiles") {
|
|
1186
|
+
return "organization_meta_profile";
|
|
1187
|
+
}
|
|
1188
|
+
if (resourcePath === "key_metric_meta_profiles") {
|
|
1189
|
+
return "key_metric_meta_profile";
|
|
1190
|
+
}
|
|
1191
|
+
if (resourcePath.endsWith("ies")) {
|
|
1192
|
+
return resourcePath.slice(0, -3) + "y";
|
|
1193
|
+
}
|
|
1194
|
+
if (resourcePath.endsWith("s")) {
|
|
1195
|
+
return resourcePath.slice(0, -1);
|
|
1196
|
+
}
|
|
1197
|
+
return resourcePath;
|
|
1198
|
+
}
|
|
1158
1199
|
function parseJsonObject(raw) {
|
|
1159
1200
|
try {
|
|
1160
1201
|
const parsed = JSON.parse(raw);
|
|
@@ -1233,7 +1274,7 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1233
1274
|
return [param, opts[optionKey]];
|
|
1234
1275
|
})
|
|
1235
1276
|
);
|
|
1236
|
-
const variables =
|
|
1277
|
+
const variables = normalizeGraphqlVariables2({
|
|
1237
1278
|
organization_id: organizationId,
|
|
1238
1279
|
page: opts.page,
|
|
1239
1280
|
per: opts.per,
|
|
@@ -1255,8 +1296,8 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1255
1296
|
await runGraphqlQueryCommand({
|
|
1256
1297
|
command: `${config.command}.show`,
|
|
1257
1298
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1258
|
-
field: config.resourcePath === "
|
|
1259
|
-
variables:
|
|
1299
|
+
field: config.resourcePath === "feedback" ? "feedback" : toSingularResourceName(config.resourcePath),
|
|
1300
|
+
variables: normalizeGraphqlVariables2({
|
|
1260
1301
|
organization_id: organizationId,
|
|
1261
1302
|
id
|
|
1262
1303
|
}),
|
|
@@ -1271,10 +1312,10 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1271
1312
|
await runGraphqlMutationCommand({
|
|
1272
1313
|
command: `${config.command}.create`,
|
|
1273
1314
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1274
|
-
field:
|
|
1315
|
+
field: `create_${toSingularResourceName(config.resourcePath)}`,
|
|
1275
1316
|
variables: {
|
|
1276
1317
|
organization_id: organizationId,
|
|
1277
|
-
params: body
|
|
1318
|
+
params: body
|
|
1278
1319
|
}
|
|
1279
1320
|
});
|
|
1280
1321
|
});
|
|
@@ -1283,7 +1324,7 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1283
1324
|
const globalOpts = cmd.optsWithGlobals();
|
|
1284
1325
|
const organizationId = resolveOrganizationId(globalOpts.organizationId);
|
|
1285
1326
|
const body = normalizeBody(String(opts.dataJson), config.rootKey);
|
|
1286
|
-
const singular =
|
|
1327
|
+
const singular = toSingularResourceName(config.resourcePath);
|
|
1287
1328
|
await runGraphqlMutationCommand({
|
|
1288
1329
|
command: `${config.command}.update`,
|
|
1289
1330
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
@@ -1291,12 +1332,13 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1291
1332
|
variables: {
|
|
1292
1333
|
organization_id: organizationId,
|
|
1293
1334
|
[`${singular}_id`]: id,
|
|
1294
|
-
params: body
|
|
1335
|
+
params: body
|
|
1295
1336
|
}
|
|
1296
1337
|
});
|
|
1297
1338
|
});
|
|
1298
1339
|
}
|
|
1299
1340
|
var __testables = {
|
|
1341
|
+
toSingularResourceName,
|
|
1300
1342
|
parseJsonObject,
|
|
1301
1343
|
normalizeBody,
|
|
1302
1344
|
assertRequiredCreateFields,
|
|
@@ -1318,7 +1360,7 @@ function registerTaskCommands(program) {
|
|
|
1318
1360
|
command: "tasks.list",
|
|
1319
1361
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1320
1362
|
field: "tasks",
|
|
1321
|
-
variables:
|
|
1363
|
+
variables: normalizeGraphqlVariables2({
|
|
1322
1364
|
organization_id: organizationId,
|
|
1323
1365
|
page: opts.page,
|
|
1324
1366
|
per: opts.per,
|
|
@@ -1364,8 +1406,10 @@ function registerTaskCommands(program) {
|
|
|
1364
1406
|
variables: {
|
|
1365
1407
|
organization_id: organizationId,
|
|
1366
1408
|
params: {
|
|
1367
|
-
|
|
1368
|
-
|
|
1409
|
+
task: {
|
|
1410
|
+
project_id: projectId,
|
|
1411
|
+
summary
|
|
1412
|
+
}
|
|
1369
1413
|
}
|
|
1370
1414
|
}
|
|
1371
1415
|
});
|
|
@@ -1397,7 +1441,9 @@ function registerTaskCommands(program) {
|
|
|
1397
1441
|
variables: {
|
|
1398
1442
|
organization_id: organizationId,
|
|
1399
1443
|
task_id: id,
|
|
1400
|
-
params:
|
|
1444
|
+
params: {
|
|
1445
|
+
task: taskPayload
|
|
1446
|
+
}
|
|
1401
1447
|
}
|
|
1402
1448
|
});
|
|
1403
1449
|
});
|
|
@@ -1418,7 +1464,7 @@ function registerProjectCommands(program) {
|
|
|
1418
1464
|
command: "projects.list",
|
|
1419
1465
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1420
1466
|
field: "projects",
|
|
1421
|
-
variables:
|
|
1467
|
+
variables: normalizeGraphqlVariables2({
|
|
1422
1468
|
organization_id: organizationId,
|
|
1423
1469
|
page: opts.page,
|
|
1424
1470
|
per: opts.per,
|
|
@@ -1457,7 +1503,7 @@ function registerProjectCommands(program) {
|
|
|
1457
1503
|
field: "create_project",
|
|
1458
1504
|
variables: {
|
|
1459
1505
|
organization_id: organizationId,
|
|
1460
|
-
params: body
|
|
1506
|
+
params: body
|
|
1461
1507
|
}
|
|
1462
1508
|
});
|
|
1463
1509
|
});
|
|
@@ -1473,7 +1519,7 @@ function registerProjectCommands(program) {
|
|
|
1473
1519
|
variables: {
|
|
1474
1520
|
organization_id: organizationId,
|
|
1475
1521
|
project_id: id,
|
|
1476
|
-
params: body
|
|
1522
|
+
params: body
|
|
1477
1523
|
}
|
|
1478
1524
|
});
|
|
1479
1525
|
});
|
|
@@ -1497,7 +1543,7 @@ function registerRockCommands(program) {
|
|
|
1497
1543
|
command: "rocks.list",
|
|
1498
1544
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1499
1545
|
field: "rocks",
|
|
1500
|
-
variables:
|
|
1546
|
+
variables: normalizeGraphqlVariables2({
|
|
1501
1547
|
organization_id: organizationId,
|
|
1502
1548
|
page: opts.page,
|
|
1503
1549
|
per: opts.per,
|
|
@@ -1545,7 +1591,7 @@ function registerRockCommands(program) {
|
|
|
1545
1591
|
variables: {
|
|
1546
1592
|
organization_id: organizationId,
|
|
1547
1593
|
rock_id: id,
|
|
1548
|
-
params: { status }
|
|
1594
|
+
params: { rock: { status } }
|
|
1549
1595
|
}
|
|
1550
1596
|
});
|
|
1551
1597
|
});
|
|
@@ -1560,7 +1606,7 @@ function registerRockCommands(program) {
|
|
|
1560
1606
|
field: "create_rock",
|
|
1561
1607
|
variables: {
|
|
1562
1608
|
organization_id: organizationId,
|
|
1563
|
-
params: body
|
|
1609
|
+
params: body
|
|
1564
1610
|
}
|
|
1565
1611
|
});
|
|
1566
1612
|
});
|
|
@@ -1576,7 +1622,7 @@ function registerRockCommands(program) {
|
|
|
1576
1622
|
variables: {
|
|
1577
1623
|
organization_id: organizationId,
|
|
1578
1624
|
rock_id: id,
|
|
1579
|
-
params: body
|
|
1625
|
+
params: body
|
|
1580
1626
|
}
|
|
1581
1627
|
});
|
|
1582
1628
|
});
|
|
@@ -1598,7 +1644,7 @@ function registerMeetingCommands(program) {
|
|
|
1598
1644
|
command: "meetings.list",
|
|
1599
1645
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1600
1646
|
field: "meetings",
|
|
1601
|
-
variables:
|
|
1647
|
+
variables: normalizeGraphqlVariables2({
|
|
1602
1648
|
organization_id: organizationId,
|
|
1603
1649
|
per: opts.per,
|
|
1604
1650
|
date: opts.date,
|
|
@@ -1640,7 +1686,9 @@ function registerMeetingCommands(program) {
|
|
|
1640
1686
|
organization_id: organizationId,
|
|
1641
1687
|
meeting_id: id,
|
|
1642
1688
|
params: {
|
|
1643
|
-
|
|
1689
|
+
meeting: {
|
|
1690
|
+
notes
|
|
1691
|
+
}
|
|
1644
1692
|
}
|
|
1645
1693
|
}
|
|
1646
1694
|
});
|
|
@@ -1655,7 +1703,7 @@ function registerMeetingCommands(program) {
|
|
|
1655
1703
|
field: "create_meeting",
|
|
1656
1704
|
variables: {
|
|
1657
1705
|
organization_id: organizationId,
|
|
1658
|
-
params: body
|
|
1706
|
+
params: body
|
|
1659
1707
|
}
|
|
1660
1708
|
});
|
|
1661
1709
|
});
|
|
@@ -1671,7 +1719,7 @@ function registerMeetingCommands(program) {
|
|
|
1671
1719
|
variables: {
|
|
1672
1720
|
organization_id: organizationId,
|
|
1673
1721
|
meeting_id: id,
|
|
1674
|
-
params: body
|
|
1722
|
+
params: body
|
|
1675
1723
|
}
|
|
1676
1724
|
});
|
|
1677
1725
|
});
|
|
@@ -1692,7 +1740,7 @@ function registerMemberCommands(program) {
|
|
|
1692
1740
|
command: "members.list",
|
|
1693
1741
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1694
1742
|
field: "members",
|
|
1695
|
-
variables:
|
|
1743
|
+
variables: normalizeGraphqlVariables2({
|
|
1696
1744
|
organization_id: organizationId,
|
|
1697
1745
|
page: opts.page,
|
|
1698
1746
|
per: opts.per,
|
|
@@ -1726,7 +1774,7 @@ function registerMemberCommands(program) {
|
|
|
1726
1774
|
field: "create_member",
|
|
1727
1775
|
variables: {
|
|
1728
1776
|
organization_id: organizationId,
|
|
1729
|
-
params: body
|
|
1777
|
+
params: body
|
|
1730
1778
|
}
|
|
1731
1779
|
});
|
|
1732
1780
|
});
|
|
@@ -1742,7 +1790,7 @@ function registerMemberCommands(program) {
|
|
|
1742
1790
|
variables: {
|
|
1743
1791
|
organization_id: organizationId,
|
|
1744
1792
|
member_id: id,
|
|
1745
|
-
params: body
|
|
1793
|
+
params: body
|
|
1746
1794
|
}
|
|
1747
1795
|
});
|
|
1748
1796
|
});
|
|
@@ -1765,7 +1813,7 @@ function registerIssueCommands(program) {
|
|
|
1765
1813
|
command: "issues.list",
|
|
1766
1814
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1767
1815
|
field: "issues",
|
|
1768
|
-
variables:
|
|
1816
|
+
variables: normalizeGraphqlVariables2({
|
|
1769
1817
|
organization_id: organizationId,
|
|
1770
1818
|
page: opts.page,
|
|
1771
1819
|
per: opts.per,
|
|
@@ -1809,14 +1857,16 @@ function registerIssueCommands(program) {
|
|
|
1809
1857
|
variables: {
|
|
1810
1858
|
organization_id: organizationId,
|
|
1811
1859
|
params: {
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1860
|
+
issue: {
|
|
1861
|
+
issue_group_id: issueGroupId,
|
|
1862
|
+
name,
|
|
1863
|
+
issue_type: issueType,
|
|
1864
|
+
...opts.status ? { status: String(opts.status) } : {},
|
|
1865
|
+
...opts.priority ? { priority: String(opts.priority) } : {},
|
|
1866
|
+
...opts.description ? { description: String(opts.description) } : {},
|
|
1867
|
+
...opts.dueBy ? { due_by: String(opts.dueBy) } : {},
|
|
1868
|
+
...opts.memberId ? { member_id: String(opts.memberId) } : {}
|
|
1869
|
+
}
|
|
1820
1870
|
}
|
|
1821
1871
|
}
|
|
1822
1872
|
});
|
|
@@ -1833,7 +1883,7 @@ function registerIssueCommands(program) {
|
|
|
1833
1883
|
variables: {
|
|
1834
1884
|
organization_id: organizationId,
|
|
1835
1885
|
issue_id: id,
|
|
1836
|
-
params: body
|
|
1886
|
+
params: body
|
|
1837
1887
|
}
|
|
1838
1888
|
});
|
|
1839
1889
|
});
|
|
@@ -2048,7 +2098,7 @@ function registerTeamCommands(program) {
|
|
|
2048
2098
|
command: "teams.list",
|
|
2049
2099
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
2050
2100
|
field: "teams",
|
|
2051
|
-
variables:
|
|
2101
|
+
variables: normalizeGraphqlVariables2({
|
|
2052
2102
|
organization_id: organizationId,
|
|
2053
2103
|
page: opts.page,
|
|
2054
2104
|
per: opts.per,
|
|
@@ -2082,7 +2132,7 @@ function registerTeamCommands(program) {
|
|
|
2082
2132
|
field: "create_team",
|
|
2083
2133
|
variables: {
|
|
2084
2134
|
organization_id: organizationId,
|
|
2085
|
-
params: body
|
|
2135
|
+
params: body
|
|
2086
2136
|
}
|
|
2087
2137
|
});
|
|
2088
2138
|
});
|
|
@@ -2098,7 +2148,7 @@ function registerTeamCommands(program) {
|
|
|
2098
2148
|
variables: {
|
|
2099
2149
|
organization_id: organizationId,
|
|
2100
2150
|
team_id: id,
|
|
2101
|
-
params: body
|
|
2151
|
+
params: body
|
|
2102
2152
|
}
|
|
2103
2153
|
});
|
|
2104
2154
|
});
|
|
@@ -2135,7 +2185,7 @@ function registerOrganizationCommands(program) {
|
|
|
2135
2185
|
field: "update_organization",
|
|
2136
2186
|
variables: {
|
|
2137
2187
|
id,
|
|
2138
|
-
params: body
|
|
2188
|
+
params: body
|
|
2139
2189
|
}
|
|
2140
2190
|
});
|
|
2141
2191
|
});
|
|
@@ -2173,7 +2223,7 @@ function registerOrganizationCommands(program) {
|
|
|
2173
2223
|
variables: {
|
|
2174
2224
|
organization_id: organizationId,
|
|
2175
2225
|
organization_meta_profile_id: id,
|
|
2176
|
-
params: body
|
|
2226
|
+
params: body
|
|
2177
2227
|
}
|
|
2178
2228
|
});
|
|
2179
2229
|
});
|
|
@@ -2211,7 +2261,7 @@ function registerOrganizationCommands(program) {
|
|
|
2211
2261
|
variables: {
|
|
2212
2262
|
organization_id: organizationId,
|
|
2213
2263
|
key_metric_meta_profile_id: id,
|
|
2214
|
-
params: body
|
|
2264
|
+
params: body
|
|
2215
2265
|
}
|
|
2216
2266
|
});
|
|
2217
2267
|
});
|
|
@@ -2232,7 +2282,7 @@ function registerFoundationCommands(program) {
|
|
|
2232
2282
|
command: "foundation.strategic-plans.show",
|
|
2233
2283
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
2234
2284
|
field: "strategic_plan",
|
|
2235
|
-
variables:
|
|
2285
|
+
variables: normalizeGraphqlVariables2({
|
|
2236
2286
|
organization_id: organizationId,
|
|
2237
2287
|
id,
|
|
2238
2288
|
progress_scope: opts.progressScope,
|
|
@@ -2257,7 +2307,7 @@ function registerFoundationCommands(program) {
|
|
|
2257
2307
|
variables: {
|
|
2258
2308
|
organization_id: organizationId,
|
|
2259
2309
|
strategic_plan_id: id,
|
|
2260
|
-
params: body
|
|
2310
|
+
params: body
|
|
2261
2311
|
}
|
|
2262
2312
|
});
|
|
2263
2313
|
});
|
|
@@ -2269,7 +2319,7 @@ function registerFoundationCommands(program) {
|
|
|
2269
2319
|
command: "foundation.strategic-objectives.show",
|
|
2270
2320
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
2271
2321
|
field: "strategic_objective",
|
|
2272
|
-
variables:
|
|
2322
|
+
variables: normalizeGraphqlVariables2({
|
|
2273
2323
|
organization_id: organizationId,
|
|
2274
2324
|
id,
|
|
2275
2325
|
progress_scope: opts.progressScope,
|
|
@@ -2297,7 +2347,7 @@ function registerFoundationCommands(program) {
|
|
|
2297
2347
|
variables: {
|
|
2298
2348
|
organization_id: organizationId,
|
|
2299
2349
|
strategic_objective_id: id,
|
|
2300
|
-
params: body
|
|
2350
|
+
params: body
|
|
2301
2351
|
}
|
|
2302
2352
|
});
|
|
2303
2353
|
});
|
package/dist/index.js
CHANGED
|
@@ -180,6 +180,9 @@ function debugLog(config, message) {
|
|
|
180
180
|
function graphqlOperationName(command) {
|
|
181
181
|
return command.split(/[^a-zA-Z0-9]/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
|
|
182
182
|
}
|
|
183
|
+
function toCamelCase(value) {
|
|
184
|
+
return value.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
|
|
185
|
+
}
|
|
183
186
|
function inferStatusFromGraphqlErrors(errors) {
|
|
184
187
|
if (!Array.isArray(errors) || errors.length === 0) {
|
|
185
188
|
return 400;
|
|
@@ -226,18 +229,39 @@ function graphqlTypeForValue(value) {
|
|
|
226
229
|
}
|
|
227
230
|
return "JSON";
|
|
228
231
|
}
|
|
232
|
+
function graphqlTypeForVariable(name, value) {
|
|
233
|
+
if (name === "id" || name.endsWith("Id")) {
|
|
234
|
+
return "ID";
|
|
235
|
+
}
|
|
236
|
+
if (name.endsWith("Ids")) {
|
|
237
|
+
return "[ID!]";
|
|
238
|
+
}
|
|
239
|
+
return graphqlTypeForValue(value);
|
|
240
|
+
}
|
|
241
|
+
function withNonNull(typeName) {
|
|
242
|
+
return typeName.endsWith("!") ? typeName : `${typeName}!`;
|
|
243
|
+
}
|
|
244
|
+
function normalizeGraphqlVariables(variables) {
|
|
245
|
+
const normalized = {};
|
|
246
|
+
Object.entries(variables).forEach(([key, value]) => {
|
|
247
|
+
normalized[toCamelCase(key)] = value;
|
|
248
|
+
});
|
|
249
|
+
return normalized;
|
|
250
|
+
}
|
|
229
251
|
function buildGraphqlBody(input) {
|
|
252
|
+
const graphqlField = toCamelCase(input.field);
|
|
253
|
+
const graphqlVariables = normalizeGraphqlVariables(input.variables);
|
|
230
254
|
const operationName = graphqlOperationName(input.command);
|
|
231
|
-
const variableEntries = Object.entries(
|
|
232
|
-
const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${
|
|
255
|
+
const variableEntries = Object.entries(graphqlVariables).filter(([, value]) => value !== void 0);
|
|
256
|
+
const variableDecl = variableEntries.map(([name, value]) => `$${name}: ${withNonNull(graphqlTypeForVariable(name, value))}`).join(", ");
|
|
233
257
|
const fieldArgs = variableEntries.map(([name]) => `${name}: $${name}`).join(", ");
|
|
234
258
|
const signature = variableDecl.length > 0 ? `(${variableDecl})` : "";
|
|
235
259
|
const args = fieldArgs.length > 0 ? `(${fieldArgs})` : "";
|
|
236
|
-
const query = `${input.operationType} ${operationName}${signature} { ${
|
|
260
|
+
const query = `${input.operationType} ${operationName}${signature} { ${graphqlField}${args} ${input.selectionSet} }`;
|
|
237
261
|
return {
|
|
238
262
|
operationName,
|
|
239
263
|
query,
|
|
240
|
-
variables:
|
|
264
|
+
variables: graphqlVariables
|
|
241
265
|
};
|
|
242
266
|
}
|
|
243
267
|
async function graphqlRequest(input) {
|
|
@@ -288,7 +312,7 @@ async function graphqlRequest(input) {
|
|
|
288
312
|
exitCode: mapStatusToExitCode(status)
|
|
289
313
|
};
|
|
290
314
|
}
|
|
291
|
-
const fieldPayload = gqlData[input.field];
|
|
315
|
+
const fieldPayload = gqlData[toCamelCase(input.field)];
|
|
292
316
|
if (input.operationType === "mutation") {
|
|
293
317
|
const mutationPayload = fieldPayload && typeof fieldPayload === "object" ? fieldPayload : {};
|
|
294
318
|
const ok = Boolean(mutationPayload.ok);
|
|
@@ -301,7 +325,9 @@ async function graphqlRequest(input) {
|
|
|
301
325
|
status,
|
|
302
326
|
data: null,
|
|
303
327
|
error: {
|
|
304
|
-
code: String(
|
|
328
|
+
code: String(
|
|
329
|
+
mutationPayload.errorCode ?? mutationPayload.error_code ?? `http_${status}`
|
|
330
|
+
),
|
|
305
331
|
message: "Mutation failed.",
|
|
306
332
|
details: {
|
|
307
333
|
errors: mutationPayload.errors ?? null,
|
|
@@ -404,10 +430,10 @@ function buildCliErrorEnvelope(params) {
|
|
|
404
430
|
}
|
|
405
431
|
function defaultQuerySelectionSet(field, isList) {
|
|
406
432
|
if (field === "organization") {
|
|
407
|
-
return "{ id slug
|
|
433
|
+
return "{ id slug membersCount organizationDetail { title name description timezone workspaceName } }";
|
|
408
434
|
}
|
|
409
435
|
if (isList) {
|
|
410
|
-
return "{ data { id type attributes } count
|
|
436
|
+
return "{ data { id type attributes } count currentPage totalPages }";
|
|
411
437
|
}
|
|
412
438
|
return "{ id type attributes }";
|
|
413
439
|
}
|
|
@@ -447,7 +473,7 @@ function normalizeGraphqlVariable(key, value) {
|
|
|
447
473
|
}
|
|
448
474
|
return parseBooleanMaybe(trimmed);
|
|
449
475
|
}
|
|
450
|
-
function
|
|
476
|
+
function normalizeGraphqlVariables2(raw) {
|
|
451
477
|
const normalized = {};
|
|
452
478
|
Object.entries(raw).forEach(([key, value]) => {
|
|
453
479
|
const next = normalizeGraphqlVariable(key, value);
|
|
@@ -504,7 +530,7 @@ async function runGraphqlMutationCommand(input) {
|
|
|
504
530
|
operationType: "mutation",
|
|
505
531
|
field: input.field,
|
|
506
532
|
variables: input.variables ?? {},
|
|
507
|
-
selectionSet: input.selectionSet ?? "{ ok status
|
|
533
|
+
selectionSet: input.selectionSet ?? "{ ok status errorCode data errors }"
|
|
508
534
|
});
|
|
509
535
|
printEnvelopeAndExit(result);
|
|
510
536
|
} catch (error) {
|
|
@@ -1154,6 +1180,21 @@ function buildDataJsonHelp(rootKey, mode) {
|
|
|
1154
1180
|
|
|
1155
1181
|
// src/commands/entityCrud.ts
|
|
1156
1182
|
var idSchema = z2.string().min(1);
|
|
1183
|
+
function toSingularResourceName(resourcePath) {
|
|
1184
|
+
if (resourcePath === "organization_meta_profiles") {
|
|
1185
|
+
return "organization_meta_profile";
|
|
1186
|
+
}
|
|
1187
|
+
if (resourcePath === "key_metric_meta_profiles") {
|
|
1188
|
+
return "key_metric_meta_profile";
|
|
1189
|
+
}
|
|
1190
|
+
if (resourcePath.endsWith("ies")) {
|
|
1191
|
+
return resourcePath.slice(0, -3) + "y";
|
|
1192
|
+
}
|
|
1193
|
+
if (resourcePath.endsWith("s")) {
|
|
1194
|
+
return resourcePath.slice(0, -1);
|
|
1195
|
+
}
|
|
1196
|
+
return resourcePath;
|
|
1197
|
+
}
|
|
1157
1198
|
function parseJsonObject(raw) {
|
|
1158
1199
|
try {
|
|
1159
1200
|
const parsed = JSON.parse(raw);
|
|
@@ -1232,7 +1273,7 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1232
1273
|
return [param, opts[optionKey]];
|
|
1233
1274
|
})
|
|
1234
1275
|
);
|
|
1235
|
-
const variables =
|
|
1276
|
+
const variables = normalizeGraphqlVariables2({
|
|
1236
1277
|
organization_id: organizationId,
|
|
1237
1278
|
page: opts.page,
|
|
1238
1279
|
per: opts.per,
|
|
@@ -1254,8 +1295,8 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1254
1295
|
await runGraphqlQueryCommand({
|
|
1255
1296
|
command: `${config.command}.show`,
|
|
1256
1297
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1257
|
-
field: config.resourcePath === "
|
|
1258
|
-
variables:
|
|
1298
|
+
field: config.resourcePath === "feedback" ? "feedback" : toSingularResourceName(config.resourcePath),
|
|
1299
|
+
variables: normalizeGraphqlVariables2({
|
|
1259
1300
|
organization_id: organizationId,
|
|
1260
1301
|
id
|
|
1261
1302
|
}),
|
|
@@ -1270,10 +1311,10 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1270
1311
|
await runGraphqlMutationCommand({
|
|
1271
1312
|
command: `${config.command}.create`,
|
|
1272
1313
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1273
|
-
field:
|
|
1314
|
+
field: `create_${toSingularResourceName(config.resourcePath)}`,
|
|
1274
1315
|
variables: {
|
|
1275
1316
|
organization_id: organizationId,
|
|
1276
|
-
params: body
|
|
1317
|
+
params: body
|
|
1277
1318
|
}
|
|
1278
1319
|
});
|
|
1279
1320
|
});
|
|
@@ -1282,7 +1323,7 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1282
1323
|
const globalOpts = cmd.optsWithGlobals();
|
|
1283
1324
|
const organizationId = resolveOrganizationId(globalOpts.organizationId);
|
|
1284
1325
|
const body = normalizeBody(String(opts.dataJson), config.rootKey);
|
|
1285
|
-
const singular =
|
|
1326
|
+
const singular = toSingularResourceName(config.resourcePath);
|
|
1286
1327
|
await runGraphqlMutationCommand({
|
|
1287
1328
|
command: `${config.command}.update`,
|
|
1288
1329
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
@@ -1290,12 +1331,13 @@ function registerEntityCrudCommands(program, config) {
|
|
|
1290
1331
|
variables: {
|
|
1291
1332
|
organization_id: organizationId,
|
|
1292
1333
|
[`${singular}_id`]: id,
|
|
1293
|
-
params: body
|
|
1334
|
+
params: body
|
|
1294
1335
|
}
|
|
1295
1336
|
});
|
|
1296
1337
|
});
|
|
1297
1338
|
}
|
|
1298
1339
|
var __testables = {
|
|
1340
|
+
toSingularResourceName,
|
|
1299
1341
|
parseJsonObject,
|
|
1300
1342
|
normalizeBody,
|
|
1301
1343
|
assertRequiredCreateFields,
|
|
@@ -1317,7 +1359,7 @@ function registerTaskCommands(program) {
|
|
|
1317
1359
|
command: "tasks.list",
|
|
1318
1360
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1319
1361
|
field: "tasks",
|
|
1320
|
-
variables:
|
|
1362
|
+
variables: normalizeGraphqlVariables2({
|
|
1321
1363
|
organization_id: organizationId,
|
|
1322
1364
|
page: opts.page,
|
|
1323
1365
|
per: opts.per,
|
|
@@ -1363,8 +1405,10 @@ function registerTaskCommands(program) {
|
|
|
1363
1405
|
variables: {
|
|
1364
1406
|
organization_id: organizationId,
|
|
1365
1407
|
params: {
|
|
1366
|
-
|
|
1367
|
-
|
|
1408
|
+
task: {
|
|
1409
|
+
project_id: projectId,
|
|
1410
|
+
summary
|
|
1411
|
+
}
|
|
1368
1412
|
}
|
|
1369
1413
|
}
|
|
1370
1414
|
});
|
|
@@ -1396,7 +1440,9 @@ function registerTaskCommands(program) {
|
|
|
1396
1440
|
variables: {
|
|
1397
1441
|
organization_id: organizationId,
|
|
1398
1442
|
task_id: id,
|
|
1399
|
-
params:
|
|
1443
|
+
params: {
|
|
1444
|
+
task: taskPayload
|
|
1445
|
+
}
|
|
1400
1446
|
}
|
|
1401
1447
|
});
|
|
1402
1448
|
});
|
|
@@ -1417,7 +1463,7 @@ function registerProjectCommands(program) {
|
|
|
1417
1463
|
command: "projects.list",
|
|
1418
1464
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1419
1465
|
field: "projects",
|
|
1420
|
-
variables:
|
|
1466
|
+
variables: normalizeGraphqlVariables2({
|
|
1421
1467
|
organization_id: organizationId,
|
|
1422
1468
|
page: opts.page,
|
|
1423
1469
|
per: opts.per,
|
|
@@ -1456,7 +1502,7 @@ function registerProjectCommands(program) {
|
|
|
1456
1502
|
field: "create_project",
|
|
1457
1503
|
variables: {
|
|
1458
1504
|
organization_id: organizationId,
|
|
1459
|
-
params: body
|
|
1505
|
+
params: body
|
|
1460
1506
|
}
|
|
1461
1507
|
});
|
|
1462
1508
|
});
|
|
@@ -1472,7 +1518,7 @@ function registerProjectCommands(program) {
|
|
|
1472
1518
|
variables: {
|
|
1473
1519
|
organization_id: organizationId,
|
|
1474
1520
|
project_id: id,
|
|
1475
|
-
params: body
|
|
1521
|
+
params: body
|
|
1476
1522
|
}
|
|
1477
1523
|
});
|
|
1478
1524
|
});
|
|
@@ -1496,7 +1542,7 @@ function registerRockCommands(program) {
|
|
|
1496
1542
|
command: "rocks.list",
|
|
1497
1543
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1498
1544
|
field: "rocks",
|
|
1499
|
-
variables:
|
|
1545
|
+
variables: normalizeGraphqlVariables2({
|
|
1500
1546
|
organization_id: organizationId,
|
|
1501
1547
|
page: opts.page,
|
|
1502
1548
|
per: opts.per,
|
|
@@ -1544,7 +1590,7 @@ function registerRockCommands(program) {
|
|
|
1544
1590
|
variables: {
|
|
1545
1591
|
organization_id: organizationId,
|
|
1546
1592
|
rock_id: id,
|
|
1547
|
-
params: { status }
|
|
1593
|
+
params: { rock: { status } }
|
|
1548
1594
|
}
|
|
1549
1595
|
});
|
|
1550
1596
|
});
|
|
@@ -1559,7 +1605,7 @@ function registerRockCommands(program) {
|
|
|
1559
1605
|
field: "create_rock",
|
|
1560
1606
|
variables: {
|
|
1561
1607
|
organization_id: organizationId,
|
|
1562
|
-
params: body
|
|
1608
|
+
params: body
|
|
1563
1609
|
}
|
|
1564
1610
|
});
|
|
1565
1611
|
});
|
|
@@ -1575,7 +1621,7 @@ function registerRockCommands(program) {
|
|
|
1575
1621
|
variables: {
|
|
1576
1622
|
organization_id: organizationId,
|
|
1577
1623
|
rock_id: id,
|
|
1578
|
-
params: body
|
|
1624
|
+
params: body
|
|
1579
1625
|
}
|
|
1580
1626
|
});
|
|
1581
1627
|
});
|
|
@@ -1597,7 +1643,7 @@ function registerMeetingCommands(program) {
|
|
|
1597
1643
|
command: "meetings.list",
|
|
1598
1644
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1599
1645
|
field: "meetings",
|
|
1600
|
-
variables:
|
|
1646
|
+
variables: normalizeGraphqlVariables2({
|
|
1601
1647
|
organization_id: organizationId,
|
|
1602
1648
|
per: opts.per,
|
|
1603
1649
|
date: opts.date,
|
|
@@ -1639,7 +1685,9 @@ function registerMeetingCommands(program) {
|
|
|
1639
1685
|
organization_id: organizationId,
|
|
1640
1686
|
meeting_id: id,
|
|
1641
1687
|
params: {
|
|
1642
|
-
|
|
1688
|
+
meeting: {
|
|
1689
|
+
notes
|
|
1690
|
+
}
|
|
1643
1691
|
}
|
|
1644
1692
|
}
|
|
1645
1693
|
});
|
|
@@ -1654,7 +1702,7 @@ function registerMeetingCommands(program) {
|
|
|
1654
1702
|
field: "create_meeting",
|
|
1655
1703
|
variables: {
|
|
1656
1704
|
organization_id: organizationId,
|
|
1657
|
-
params: body
|
|
1705
|
+
params: body
|
|
1658
1706
|
}
|
|
1659
1707
|
});
|
|
1660
1708
|
});
|
|
@@ -1670,7 +1718,7 @@ function registerMeetingCommands(program) {
|
|
|
1670
1718
|
variables: {
|
|
1671
1719
|
organization_id: organizationId,
|
|
1672
1720
|
meeting_id: id,
|
|
1673
|
-
params: body
|
|
1721
|
+
params: body
|
|
1674
1722
|
}
|
|
1675
1723
|
});
|
|
1676
1724
|
});
|
|
@@ -1691,7 +1739,7 @@ function registerMemberCommands(program) {
|
|
|
1691
1739
|
command: "members.list",
|
|
1692
1740
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1693
1741
|
field: "members",
|
|
1694
|
-
variables:
|
|
1742
|
+
variables: normalizeGraphqlVariables2({
|
|
1695
1743
|
organization_id: organizationId,
|
|
1696
1744
|
page: opts.page,
|
|
1697
1745
|
per: opts.per,
|
|
@@ -1725,7 +1773,7 @@ function registerMemberCommands(program) {
|
|
|
1725
1773
|
field: "create_member",
|
|
1726
1774
|
variables: {
|
|
1727
1775
|
organization_id: organizationId,
|
|
1728
|
-
params: body
|
|
1776
|
+
params: body
|
|
1729
1777
|
}
|
|
1730
1778
|
});
|
|
1731
1779
|
});
|
|
@@ -1741,7 +1789,7 @@ function registerMemberCommands(program) {
|
|
|
1741
1789
|
variables: {
|
|
1742
1790
|
organization_id: organizationId,
|
|
1743
1791
|
member_id: id,
|
|
1744
|
-
params: body
|
|
1792
|
+
params: body
|
|
1745
1793
|
}
|
|
1746
1794
|
});
|
|
1747
1795
|
});
|
|
@@ -1764,7 +1812,7 @@ function registerIssueCommands(program) {
|
|
|
1764
1812
|
command: "issues.list",
|
|
1765
1813
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
1766
1814
|
field: "issues",
|
|
1767
|
-
variables:
|
|
1815
|
+
variables: normalizeGraphqlVariables2({
|
|
1768
1816
|
organization_id: organizationId,
|
|
1769
1817
|
page: opts.page,
|
|
1770
1818
|
per: opts.per,
|
|
@@ -1808,14 +1856,16 @@ function registerIssueCommands(program) {
|
|
|
1808
1856
|
variables: {
|
|
1809
1857
|
organization_id: organizationId,
|
|
1810
1858
|
params: {
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1859
|
+
issue: {
|
|
1860
|
+
issue_group_id: issueGroupId,
|
|
1861
|
+
name,
|
|
1862
|
+
issue_type: issueType,
|
|
1863
|
+
...opts.status ? { status: String(opts.status) } : {},
|
|
1864
|
+
...opts.priority ? { priority: String(opts.priority) } : {},
|
|
1865
|
+
...opts.description ? { description: String(opts.description) } : {},
|
|
1866
|
+
...opts.dueBy ? { due_by: String(opts.dueBy) } : {},
|
|
1867
|
+
...opts.memberId ? { member_id: String(opts.memberId) } : {}
|
|
1868
|
+
}
|
|
1819
1869
|
}
|
|
1820
1870
|
}
|
|
1821
1871
|
});
|
|
@@ -1832,7 +1882,7 @@ function registerIssueCommands(program) {
|
|
|
1832
1882
|
variables: {
|
|
1833
1883
|
organization_id: organizationId,
|
|
1834
1884
|
issue_id: id,
|
|
1835
|
-
params: body
|
|
1885
|
+
params: body
|
|
1836
1886
|
}
|
|
1837
1887
|
});
|
|
1838
1888
|
});
|
|
@@ -2047,7 +2097,7 @@ function registerTeamCommands(program) {
|
|
|
2047
2097
|
command: "teams.list",
|
|
2048
2098
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
2049
2099
|
field: "teams",
|
|
2050
|
-
variables:
|
|
2100
|
+
variables: normalizeGraphqlVariables2({
|
|
2051
2101
|
organization_id: organizationId,
|
|
2052
2102
|
page: opts.page,
|
|
2053
2103
|
per: opts.per,
|
|
@@ -2081,7 +2131,7 @@ function registerTeamCommands(program) {
|
|
|
2081
2131
|
field: "create_team",
|
|
2082
2132
|
variables: {
|
|
2083
2133
|
organization_id: organizationId,
|
|
2084
|
-
params: body
|
|
2134
|
+
params: body
|
|
2085
2135
|
}
|
|
2086
2136
|
});
|
|
2087
2137
|
});
|
|
@@ -2097,7 +2147,7 @@ function registerTeamCommands(program) {
|
|
|
2097
2147
|
variables: {
|
|
2098
2148
|
organization_id: organizationId,
|
|
2099
2149
|
team_id: id,
|
|
2100
|
-
params: body
|
|
2150
|
+
params: body
|
|
2101
2151
|
}
|
|
2102
2152
|
});
|
|
2103
2153
|
});
|
|
@@ -2134,7 +2184,7 @@ function registerOrganizationCommands(program) {
|
|
|
2134
2184
|
field: "update_organization",
|
|
2135
2185
|
variables: {
|
|
2136
2186
|
id,
|
|
2137
|
-
params: body
|
|
2187
|
+
params: body
|
|
2138
2188
|
}
|
|
2139
2189
|
});
|
|
2140
2190
|
});
|
|
@@ -2172,7 +2222,7 @@ function registerOrganizationCommands(program) {
|
|
|
2172
2222
|
variables: {
|
|
2173
2223
|
organization_id: organizationId,
|
|
2174
2224
|
organization_meta_profile_id: id,
|
|
2175
|
-
params: body
|
|
2225
|
+
params: body
|
|
2176
2226
|
}
|
|
2177
2227
|
});
|
|
2178
2228
|
});
|
|
@@ -2210,7 +2260,7 @@ function registerOrganizationCommands(program) {
|
|
|
2210
2260
|
variables: {
|
|
2211
2261
|
organization_id: organizationId,
|
|
2212
2262
|
key_metric_meta_profile_id: id,
|
|
2213
|
-
params: body
|
|
2263
|
+
params: body
|
|
2214
2264
|
}
|
|
2215
2265
|
});
|
|
2216
2266
|
});
|
|
@@ -2231,7 +2281,7 @@ function registerFoundationCommands(program) {
|
|
|
2231
2281
|
command: "foundation.strategic-plans.show",
|
|
2232
2282
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
2233
2283
|
field: "strategic_plan",
|
|
2234
|
-
variables:
|
|
2284
|
+
variables: normalizeGraphqlVariables2({
|
|
2235
2285
|
organization_id: organizationId,
|
|
2236
2286
|
id,
|
|
2237
2287
|
progress_scope: opts.progressScope,
|
|
@@ -2256,7 +2306,7 @@ function registerFoundationCommands(program) {
|
|
|
2256
2306
|
variables: {
|
|
2257
2307
|
organization_id: organizationId,
|
|
2258
2308
|
strategic_plan_id: id,
|
|
2259
|
-
params: body
|
|
2309
|
+
params: body
|
|
2260
2310
|
}
|
|
2261
2311
|
});
|
|
2262
2312
|
});
|
|
@@ -2268,7 +2318,7 @@ function registerFoundationCommands(program) {
|
|
|
2268
2318
|
command: "foundation.strategic-objectives.show",
|
|
2269
2319
|
runtimeOptions: pickRuntimeOptions(globalOpts),
|
|
2270
2320
|
field: "strategic_objective",
|
|
2271
|
-
variables:
|
|
2321
|
+
variables: normalizeGraphqlVariables2({
|
|
2272
2322
|
organization_id: organizationId,
|
|
2273
2323
|
id,
|
|
2274
2324
|
progress_scope: opts.progressScope,
|
|
@@ -2296,7 +2346,7 @@ function registerFoundationCommands(program) {
|
|
|
2296
2346
|
variables: {
|
|
2297
2347
|
organization_id: organizationId,
|
|
2298
2348
|
strategic_objective_id: id,
|
|
2299
|
-
params: body
|
|
2349
|
+
params: body
|
|
2300
2350
|
}
|
|
2301
2351
|
});
|
|
2302
2352
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ted-galago/wave-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"wave": "dist/index.js"
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
14
14
|
"dev": "tsx src/index.ts",
|
|
15
15
|
"test": "vitest run",
|
|
16
|
+
"verify:dev": "node scripts/verify-dev-api.mjs",
|
|
16
17
|
"postinstall": "node scripts/postinstall-local-bin.mjs"
|
|
17
18
|
},
|
|
18
19
|
"engines": {
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
|
|
6
|
+
function loadDotEnv(filePath) {
|
|
7
|
+
const raw = readFileSync(filePath, "utf8");
|
|
8
|
+
const env = {};
|
|
9
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
10
|
+
const trimmed = line.trim();
|
|
11
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
12
|
+
const match = trimmed.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);
|
|
13
|
+
if (!match) continue;
|
|
14
|
+
const [, key, value] = match;
|
|
15
|
+
env[key] = value;
|
|
16
|
+
}
|
|
17
|
+
return env;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function runWave(args, env) {
|
|
21
|
+
const child = spawnSync("node", ["dist/index.js", ...args], {
|
|
22
|
+
env: { ...process.env, ...env },
|
|
23
|
+
encoding: "utf8"
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const stdout = child.stdout?.trim() ?? "";
|
|
27
|
+
let parsed = null;
|
|
28
|
+
try {
|
|
29
|
+
parsed = JSON.parse(stdout);
|
|
30
|
+
} catch {
|
|
31
|
+
parsed = null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
args,
|
|
36
|
+
code: child.status ?? 1,
|
|
37
|
+
stdout,
|
|
38
|
+
stderr: child.stderr?.trim() ?? "",
|
|
39
|
+
parsed
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function firstId(parsed, field) {
|
|
44
|
+
const data = parsed?.data?.[field];
|
|
45
|
+
if (data?.data?.[0]?.id) return String(data.data[0].id);
|
|
46
|
+
if (data?.id) return String(data.id);
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function classify(result) {
|
|
51
|
+
if (!result.parsed) {
|
|
52
|
+
return { ok: false, reason: "non_json_output" };
|
|
53
|
+
}
|
|
54
|
+
if (result.parsed.ok === true) {
|
|
55
|
+
return { ok: true, reason: "ok" };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const code = result.parsed?.error?.code ?? "unknown";
|
|
59
|
+
const message = result.parsed?.error?.message ?? "";
|
|
60
|
+
const details = JSON.stringify(result.parsed?.error?.details ?? {});
|
|
61
|
+
const hardFailures = [
|
|
62
|
+
"network_error",
|
|
63
|
+
"missing_auth",
|
|
64
|
+
"generic_error"
|
|
65
|
+
];
|
|
66
|
+
if (hardFailures.includes(code)) {
|
|
67
|
+
return { ok: false, reason: code };
|
|
68
|
+
}
|
|
69
|
+
if (
|
|
70
|
+
details.includes("missingRequiredArguments") ||
|
|
71
|
+
details.includes("argumentNotAccepted") ||
|
|
72
|
+
details.includes("undefinedField") ||
|
|
73
|
+
details.includes("variableNotUsed")
|
|
74
|
+
) {
|
|
75
|
+
return { ok: false, reason: "graphql_contract_error" };
|
|
76
|
+
}
|
|
77
|
+
if (code === "invalid_args" && message.includes("Missing required create fields")) {
|
|
78
|
+
return { ok: true, reason: "skipped_missing_parent_dependency" };
|
|
79
|
+
}
|
|
80
|
+
if (code === "invalid_args") {
|
|
81
|
+
return { ok: false, reason: code };
|
|
82
|
+
}
|
|
83
|
+
return { ok: true, reason: `reachable_${code}` };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function payload(root, attrs) {
|
|
87
|
+
return JSON.stringify({ [root]: attrs });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const root = process.cwd();
|
|
91
|
+
const envFile = resolve(root, ".env");
|
|
92
|
+
const dot = loadDotEnv(envFile);
|
|
93
|
+
const env = {
|
|
94
|
+
WAVE_API_BASE_URL: dot.WAVE_API_BASE_URL,
|
|
95
|
+
WAVE_API_TOKEN: dot.WAVE_API_TOKEN,
|
|
96
|
+
WAVE_ORGANIZATION_ID: dot.WAVE_ORGANIZATION_ID,
|
|
97
|
+
WAVE_AGENT_NAME: dot.WAVE_AGENT_NAME || "cli-verifier",
|
|
98
|
+
WAVE_AGENT_RUN_ID: `verify-${Date.now()}`,
|
|
99
|
+
WAVE_TIMEOUT_MS: dot.WAVE_TIMEOUT_MS || "10000"
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const idLookup = {};
|
|
103
|
+
const listSeeds = [
|
|
104
|
+
["projects", ["projects", "list", "--page", "1", "--per", "2"]],
|
|
105
|
+
["tasks", ["tasks", "list", "--page", "1", "--per", "2"]],
|
|
106
|
+
["rocks", ["rocks", "list", "--page", "1", "--per", "2"]],
|
|
107
|
+
["meetings", ["meetings", "list", "--per", "2"]],
|
|
108
|
+
["members", ["members", "list", "--page", "1", "--per", "2"]],
|
|
109
|
+
["teams", ["teams", "list", "--page", "1", "--per", "2"]],
|
|
110
|
+
["issues", ["issues", "list", "--page", "1", "--per", "2"]],
|
|
111
|
+
["lists", ["lists", "list", "--page", "1", "--per", "2"]],
|
|
112
|
+
["listItems", ["list-items", "list", "--page", "1", "--per", "2"]],
|
|
113
|
+
["issueGroups", ["issue-groups", "list", "--page", "1", "--per", "2"]],
|
|
114
|
+
["todoGroups", ["todo-groups", "list", "--page", "1", "--per", "2"]],
|
|
115
|
+
["todos", ["todos", "list", "--page", "1", "--per", "2"]],
|
|
116
|
+
["rockCollections", ["rock-collections", "list", "--page", "1", "--per", "2"]],
|
|
117
|
+
["knowledge", ["knowledge", "list", "--page", "1", "--per", "2"]],
|
|
118
|
+
["standUps", ["stand-ups", "list", "--page", "1", "--per", "2"]],
|
|
119
|
+
["news", ["news", "list", "--page", "1", "--per", "2"]],
|
|
120
|
+
["questions", ["questions", "list", "--page", "1", "--per", "2"]],
|
|
121
|
+
["pulse", ["pulse", "list", "--page", "1", "--per", "2"]],
|
|
122
|
+
["surveys", ["surveys", "list", "--page", "1", "--per", "2"]],
|
|
123
|
+
["feedbacks", ["feedbacks", "list", "--page", "1", "--per", "2"]],
|
|
124
|
+
["accountability", ["accountability", "list", "--page", "1", "--per", "2"]],
|
|
125
|
+
["kpis", ["kpis", "list", "--page", "1", "--per", "2"]],
|
|
126
|
+
["scorecardGroups", ["scorecard-groups", "list", "--page", "1", "--per", "2"]],
|
|
127
|
+
["scorecards", ["scorecards", "list", "--page", "1", "--per", "2"]],
|
|
128
|
+
["customers", ["customers", "list", "--page", "1", "--per", "2"]],
|
|
129
|
+
["contacts", ["contacts", "list", "--page", "1", "--per", "2"]],
|
|
130
|
+
["annualObjectives", ["foundation", "annual-objectives", "list", "--page", "1", "--per", "2"]],
|
|
131
|
+
["quarterlyObjectives", ["foundation", "quarterly-objectives", "list", "--page", "1", "--per", "2"]]
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
const results = [];
|
|
135
|
+
for (const [key, args] of listSeeds) {
|
|
136
|
+
const res = runWave(args, env);
|
|
137
|
+
results.push(res);
|
|
138
|
+
if (res.parsed?.ok) {
|
|
139
|
+
const field = args[0] === "foundation" ? args[1].replace(/-([a-z])/g, (_, c) => c.toUpperCase()) : args[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
140
|
+
idLookup[key] = firstId(res.parsed, field);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const orgId = env.WAVE_ORGANIZATION_ID;
|
|
145
|
+
const projectId = idLookup.projects;
|
|
146
|
+
const taskId = idLookup.tasks;
|
|
147
|
+
const rockId = idLookup.rocks;
|
|
148
|
+
const meetingId = idLookup.meetings;
|
|
149
|
+
const memberId = idLookup.members;
|
|
150
|
+
const teamId = idLookup.teams;
|
|
151
|
+
const issueId = idLookup.issues;
|
|
152
|
+
const issueGroupId = idLookup.issueGroups;
|
|
153
|
+
const listId = idLookup.lists;
|
|
154
|
+
const listItemId = idLookup.listItems;
|
|
155
|
+
const todoGroupId = idLookup.todoGroups;
|
|
156
|
+
const todoId = idLookup.todos;
|
|
157
|
+
const rockCollectionId = idLookup.rockCollections;
|
|
158
|
+
const contentId = idLookup.knowledge;
|
|
159
|
+
const standUpId = idLookup.standUps;
|
|
160
|
+
const headlineId = idLookup.news;
|
|
161
|
+
const questionId = idLookup.questions;
|
|
162
|
+
const pulseId = idLookup.pulse;
|
|
163
|
+
const surveyId = idLookup.surveys;
|
|
164
|
+
const feedbackId = idLookup.feedbacks;
|
|
165
|
+
const responsibilityId = idLookup.accountability;
|
|
166
|
+
const kpiId = idLookup.kpis;
|
|
167
|
+
const measurableGroupId = idLookup.scorecardGroups;
|
|
168
|
+
const measurableId = idLookup.scorecards;
|
|
169
|
+
const customerId = idLookup.customers;
|
|
170
|
+
const contactId = idLookup.contacts;
|
|
171
|
+
const annualObjectiveId = idLookup.annualObjectives;
|
|
172
|
+
const quarterlyObjectiveId = idLookup.quarterlyObjectives;
|
|
173
|
+
|
|
174
|
+
const probes = [
|
|
175
|
+
["projects", "show", "--id", projectId],
|
|
176
|
+
["tasks", "show", "--id", taskId],
|
|
177
|
+
["rocks", "show", "--id", rockId],
|
|
178
|
+
["meetings", "show", "--id", meetingId],
|
|
179
|
+
["members", "show", "--id", memberId],
|
|
180
|
+
["teams", "show", "--id", teamId],
|
|
181
|
+
["issues", "show", "--id", issueId],
|
|
182
|
+
["lists", "show", "--id", listId],
|
|
183
|
+
["list-items", "show", "--id", listItemId],
|
|
184
|
+
["issue-groups", "show", "--id", issueGroupId],
|
|
185
|
+
["todo-groups", "show", "--id", todoGroupId],
|
|
186
|
+
["todos", "show", "--id", todoId],
|
|
187
|
+
["rock-collections", "show", "--id", rockCollectionId],
|
|
188
|
+
["knowledge", "show", "--id", contentId],
|
|
189
|
+
["stand-ups", "show", "--id", standUpId],
|
|
190
|
+
["news", "show", "--id", headlineId],
|
|
191
|
+
["questions", "show", "--id", questionId],
|
|
192
|
+
["pulse", "show", "--id", pulseId],
|
|
193
|
+
["surveys", "show", "--id", surveyId],
|
|
194
|
+
["feedbacks", "show", "--id", feedbackId],
|
|
195
|
+
["accountability", "show", "--id", responsibilityId],
|
|
196
|
+
["kpis", "show", "--id", kpiId],
|
|
197
|
+
["scorecard-groups", "show", "--id", measurableGroupId],
|
|
198
|
+
["scorecards", "show", "--id", measurableId],
|
|
199
|
+
["customers", "show", "--id", customerId],
|
|
200
|
+
["contacts", "show", "--id", contactId],
|
|
201
|
+
["organizations", "show", "--id", orgId],
|
|
202
|
+
["organizations", "meta-profile", "show", "--id", orgId],
|
|
203
|
+
["organizations", "key-metric-meta-profile", "show", "--id", orgId],
|
|
204
|
+
["foundation", "strategic-plans", "show", "--id", orgId],
|
|
205
|
+
["foundation", "strategic-objectives", "show", "--id", orgId],
|
|
206
|
+
["foundation", "annual-objectives", "show", "--id", annualObjectiveId],
|
|
207
|
+
["foundation", "quarterly-objectives", "show", "--id", quarterlyObjectiveId],
|
|
208
|
+
["projects", "create", "--data-json", payload("project", { name: "CLI Verify Project", status: "backlog", priority: "no_priority" })],
|
|
209
|
+
["projects", "update", "--id", projectId, "--data-json", payload("project", { description: "verify-update" })],
|
|
210
|
+
["tasks", "create", "--project-id", projectId, "--summary", "CLI verify task"],
|
|
211
|
+
["tasks", "update", "--id", taskId, "--summary", "CLI verify task update"],
|
|
212
|
+
["rocks", "update-status", "--id", rockId, "--status", "on_track"],
|
|
213
|
+
["rocks", "create", "--data-json", payload("rock", { name: "CLI Verify Rock", rock_collection_id: rockCollectionId, status: "on_track", priority: "no_priority", rock_type: "individual" })],
|
|
214
|
+
["rocks", "update", "--id", rockId, "--data-json", payload("rock", { description: "verify-update" })],
|
|
215
|
+
["meetings", "notes", "--id", meetingId, "--content", "CLI verify notes"],
|
|
216
|
+
["meetings", "create", "--data-json", payload("meeting", { name: "CLI Verify Meeting", status: "upcoming" })],
|
|
217
|
+
["meetings", "update", "--id", meetingId, "--data-json", payload("meeting", { notes: "verify-update" })],
|
|
218
|
+
["members", "create", "--data-json", payload("member", { email: `cli.verify.${Date.now()}@example.com` })],
|
|
219
|
+
["members", "update", "--id", memberId, "--data-json", payload("member", { first_name: "CLI" })],
|
|
220
|
+
["teams", "create", "--data-json", payload("team", { name: `CLI Verify Team ${Date.now()}` })],
|
|
221
|
+
["teams", "update", "--id", teamId, "--data-json", payload("team", { name: `CLI Verify Team Update ${Date.now()}` })],
|
|
222
|
+
["organizations", "update", "--id", orgId, "--data-json", payload("organization", { workspace_name: "Wave Verify" })],
|
|
223
|
+
["organizations", "meta-profile", "update", "--id", orgId, "--data-json", payload("organization_meta_profile", { title: "Verify Title" })],
|
|
224
|
+
["organizations", "key-metric-meta-profile", "update", "--id", orgId, "--data-json", payload("key_metric_meta_profile", { annual_revenue: "1000" })],
|
|
225
|
+
["issues", "create", "--issue-group-id", issueGroupId, "--name", "CLI Verify Issue", "--issue-type", "personal"],
|
|
226
|
+
["issues", "update", "--id", issueId, "--data-json", payload("issue", { description: "verify-update" })],
|
|
227
|
+
["lists", "create", "--data-json", payload("list", { name: "CLI Verify List", status: "in_progress", priority: "no_priority" })],
|
|
228
|
+
["lists", "update", "--id", listId, "--data-json", payload("list", { description: "verify-update" })],
|
|
229
|
+
["list-items", "create", "--data-json", payload("list_item", { list_id: listId, summary: "CLI Verify List Item" })],
|
|
230
|
+
["list-items", "update", "--id", listItemId, "--data-json", payload("list_item", { summary: "CLI Verify List Item Update" })],
|
|
231
|
+
["issue-groups", "create", "--data-json", payload("issue_group", { name: "CLI Verify Issue Group", status: "in_progress", priority: "no_priority" })],
|
|
232
|
+
["issue-groups", "update", "--id", issueGroupId, "--data-json", payload("issue_group", { description: "verify-update" })],
|
|
233
|
+
["todo-groups", "create", "--data-json", payload("todo_group", { name: "CLI Verify Todo Group", status: "in_progress", priority: "no_priority" })],
|
|
234
|
+
["todo-groups", "update", "--id", todoGroupId, "--data-json", payload("todo_group", { description: "verify-update" })],
|
|
235
|
+
["todos", "create", "--data-json", payload("todo", { todo_group_id: todoGroupId, name: "CLI Verify Todo", status: "to_do", priority: "no_priority" })],
|
|
236
|
+
["todos", "update", "--id", todoId, "--data-json", payload("todo", { description: "verify-update" })],
|
|
237
|
+
["rock-collections", "create", "--data-json", payload("rock_collection", { name: "CLI Verify Rock Collection", status: "in_progress", priority: "no_priority" })],
|
|
238
|
+
["rock-collections", "update", "--id", rockCollectionId, "--data-json", payload("rock_collection", { description: "verify-update" })],
|
|
239
|
+
["knowledge", "create", "--data-json", payload("content", { type: "normal", content_type: "knowledge", status: "draft", name: "CLI Verify Doc" })],
|
|
240
|
+
["knowledge", "update", "--id", contentId, "--data-json", payload("content", { name: "CLI Verify Doc Update" })],
|
|
241
|
+
["stand-ups", "create", "--data-json", payload("stand_up", { member_id: memberId, completed_date: "2026-04-06" })],
|
|
242
|
+
["stand-ups", "update", "--id", standUpId, "--data-json", payload("stand_up", { blockers: "verify-update" })],
|
|
243
|
+
["news", "create", "--data-json", payload("headline", { summary: "CLI Verify Headline", status: "draft", headline_type: "organizational" })],
|
|
244
|
+
["news", "update", "--id", headlineId, "--data-json", payload("headline", { description: "verify-update" })],
|
|
245
|
+
["questions", "create", "--data-json", payload("question", { summary: "CLI Verify Question" })],
|
|
246
|
+
["questions", "update", "--id", questionId, "--data-json", payload("question", { summary: "CLI Verify Question Update" })],
|
|
247
|
+
["pulse", "create", "--data-json", payload("health_update", { updatable_id: projectId, updatable_type: "Project", value: "on_track", status: "on_track" })],
|
|
248
|
+
["pulse", "update", "--id", pulseId, "--data-json", payload("health_update", { value: "verify-update" })],
|
|
249
|
+
["surveys", "create", "--data-json", payload("survey", { title: "CLI Verify Survey" })],
|
|
250
|
+
["surveys", "update", "--id", surveyId, "--data-json", payload("survey", { title: "CLI Verify Survey Update" })],
|
|
251
|
+
["feedbacks", "create", "--data-json", payload("feedback", { title: "CLI Verify Feedback" })],
|
|
252
|
+
["feedbacks", "update", "--id", feedbackId, "--data-json", payload("feedback", { title: "CLI Verify Feedback Update" })],
|
|
253
|
+
["accountability", "create", "--data-json", payload("responsibility", { summary: "CLI Verify Responsibility" })],
|
|
254
|
+
["accountability", "update", "--id", responsibilityId, "--data-json", payload("responsibility", { summary: "CLI Verify Responsibility Update" })],
|
|
255
|
+
["kpis", "create", "--data-json", payload("smart_kpi", { measurable_group_id: measurableGroupId, name: "CLI Verify KPI" })],
|
|
256
|
+
["kpis", "update", "--id", kpiId, "--data-json", payload("smart_kpi", { name: "CLI Verify KPI Update" })],
|
|
257
|
+
["scorecard-groups", "create", "--data-json", payload("measurable_group", { name: "CLI Verify Scorecard Group" })],
|
|
258
|
+
["scorecard-groups", "update", "--id", measurableGroupId, "--data-json", payload("measurable_group", { name: "CLI Verify Scorecard Group Update" })],
|
|
259
|
+
["scorecards", "create", "--data-json", payload("measurable", { measurable_group_id: measurableGroupId, name: "CLI Verify Scorecard" })],
|
|
260
|
+
["scorecards", "update", "--id", measurableId, "--data-json", payload("measurable", { name: "CLI Verify Scorecard Update" })],
|
|
261
|
+
["customers", "create", "--data-json", payload("customer", { name: "CLI Verify Customer" })],
|
|
262
|
+
["customers", "update", "--id", customerId, "--data-json", payload("customer", { name: "CLI Verify Customer Update" })],
|
|
263
|
+
["contacts", "create", "--data-json", payload("contact", { customer_id: customerId, name: "CLI Verify Contact" })],
|
|
264
|
+
["contacts", "update", "--id", contactId, "--data-json", payload("contact", { name: "CLI Verify Contact Update" })],
|
|
265
|
+
["foundation", "strategic-plans", "update", "--id", orgId, "--data-json", payload("strategic_plan", { title: "CLI Verify Strategic Plan" })],
|
|
266
|
+
["foundation", "strategic-objectives", "update", "--id", orgId, "--data-json", payload("strategic_objective", { title: "CLI Verify Strategic Objective" })],
|
|
267
|
+
["foundation", "annual-objectives", "create", "--data-json", payload("annual_objective", { strategic_objective_id: annualObjectiveId || orgId, title: "CLI Verify Annual Objective" })],
|
|
268
|
+
["foundation", "annual-objectives", "update", "--id", annualObjectiveId, "--data-json", payload("annual_objective", { title: "CLI Verify Annual Objective Update" })],
|
|
269
|
+
["foundation", "quarterly-objectives", "create", "--data-json", payload("quarterly_objective", { strategic_objective_id: annualObjectiveId || orgId, annual_objective_id: annualObjectiveId || orgId, title: "CLI Verify Quarterly Objective" })],
|
|
270
|
+
["foundation", "quarterly-objectives", "update", "--id", quarterlyObjectiveId, "--data-json", payload("quarterly_objective", { title: "CLI Verify Quarterly Objective Update" })]
|
|
271
|
+
];
|
|
272
|
+
|
|
273
|
+
for (const args of probes) {
|
|
274
|
+
if (args.includes(undefined)) {
|
|
275
|
+
results.push({
|
|
276
|
+
args,
|
|
277
|
+
code: 0,
|
|
278
|
+
stdout: JSON.stringify({
|
|
279
|
+
ok: false,
|
|
280
|
+
error: { code: "skipped_missing_id", details: {} }
|
|
281
|
+
}),
|
|
282
|
+
parsed: { ok: false, error: { code: "skipped_missing_id", details: {} } }
|
|
283
|
+
});
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
results.push(runWave(args, env));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const lines = [];
|
|
290
|
+
let failures = 0;
|
|
291
|
+
for (const res of results) {
|
|
292
|
+
const verdict = classify(res);
|
|
293
|
+
const cmd = res.args.join(" ");
|
|
294
|
+
const status = res.parsed?.status ?? "n/a";
|
|
295
|
+
const errCode = res.parsed?.error?.code ?? "none";
|
|
296
|
+
lines.push(`${verdict.ok ? "PASS" : "FAIL"} | status=${status} | err=${errCode} | ${cmd}`);
|
|
297
|
+
if (!verdict.ok) failures += 1;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
console.log(lines.join("\n"));
|
|
301
|
+
console.log(`\nSUMMARY total=${results.length} failures=${failures}`);
|
|
302
|
+
if (failures > 0) process.exit(1);
|