@madewithremy/admin 0.1.62 → 0.1.64
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/CHANGELOG.md +27 -0
- package/dist/http.d.ts +1 -1
- package/dist/index.js +79 -65
- package/dist/index.js.map +2 -2
- package/dist/ops/dataSources.d.ts +15 -7
- package/dist/ops/domains.d.ts +4 -2
- package/dist/ops/infra.d.ts +29 -21
- package/dist/ops/issues.d.ts +3 -1
- package/dist/ops/releases.d.ts +4 -2
- package/dist/ops/usage.d.ts +24 -12
- package/dist/output.d.ts +1 -1
- package/dist/parseJsonConfig.d.ts +1 -1
- package/dist/poll.d.ts +1 -1
- package/dist/prod.js +498 -421
- package/dist/types/infra.d.ts +60 -16
- package/dist/types/usage.d.ts +8 -1
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -78,7 +78,7 @@ var Args = class {
|
|
|
78
78
|
positionals;
|
|
79
79
|
flags;
|
|
80
80
|
/** A required positional. Presence was validated at parse time. */
|
|
81
|
-
|
|
81
|
+
required(name) {
|
|
82
82
|
const value = this.positionals[this.indexOf(name)];
|
|
83
83
|
if (value === void 0) {
|
|
84
84
|
throw new UsageError(
|
|
@@ -89,7 +89,7 @@ var Args = class {
|
|
|
89
89
|
return value;
|
|
90
90
|
}
|
|
91
91
|
/** An optional positional. */
|
|
92
|
-
|
|
92
|
+
optional(name) {
|
|
93
93
|
return this.positionals[this.indexOf(name)];
|
|
94
94
|
}
|
|
95
95
|
/** The variadic tail. */
|
|
@@ -270,7 +270,7 @@ function isTransientError(err) {
|
|
|
270
270
|
return err instanceof TypeError;
|
|
271
271
|
}
|
|
272
272
|
var REPORT_TIMEOUT_MS = 6e4;
|
|
273
|
-
function
|
|
273
|
+
function encodePathSegment(value) {
|
|
274
274
|
return encodeURIComponent(String(value));
|
|
275
275
|
}
|
|
276
276
|
function qs(params) {
|
|
@@ -361,7 +361,7 @@ function get(ctx, requestId) {
|
|
|
361
361
|
return call(
|
|
362
362
|
ctx,
|
|
363
363
|
"GET",
|
|
364
|
-
`/_internal/v2/apps/${ctx.appId}/requests/${
|
|
364
|
+
`/_internal/v2/apps/${ctx.appId}/requests/${encodePathSegment(requestId)}`
|
|
365
365
|
);
|
|
366
366
|
}
|
|
367
367
|
function statsSummary(ctx, params = {}) {
|
|
@@ -375,7 +375,7 @@ function statsForMethod(ctx, methodId, params = {}) {
|
|
|
375
375
|
return call(
|
|
376
376
|
ctx,
|
|
377
377
|
"GET",
|
|
378
|
-
`/_internal/v2/apps/${ctx.appId}/metrics/methods/${
|
|
378
|
+
`/_internal/v2/apps/${ctx.appId}/metrics/methods/${encodePathSegment(methodId)}${qs(params)}`
|
|
379
379
|
);
|
|
380
380
|
}
|
|
381
381
|
|
|
@@ -431,13 +431,13 @@ async function pollUntil(read, isSettled, options) {
|
|
|
431
431
|
function elapsedSeconds(start2) {
|
|
432
432
|
return Math.round((Date.now() - start2) / 1e3);
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function timeoutMessage(timeoutMs, still) {
|
|
435
435
|
return `Timed out after ${Math.round(timeoutMs / 1e3)}s ${still}`;
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
// src/output.ts
|
|
439
439
|
var PRETTY = process.stdout.isTTY === true;
|
|
440
|
-
function
|
|
440
|
+
function printJson(data) {
|
|
441
441
|
process.stdout.write(`${JSON.stringify(data, null, PRETTY ? 2 : 0)}
|
|
442
442
|
`);
|
|
443
443
|
}
|
|
@@ -496,7 +496,7 @@ var requestsSpecs = {
|
|
|
496
496
|
}
|
|
497
497
|
};
|
|
498
498
|
async function requestsList(ctx, a) {
|
|
499
|
-
|
|
499
|
+
printJson(
|
|
500
500
|
await list(ctx, {
|
|
501
501
|
methodId: a.str("method"),
|
|
502
502
|
status: a.str("status"),
|
|
@@ -506,15 +506,15 @@ async function requestsList(ctx, a) {
|
|
|
506
506
|
);
|
|
507
507
|
}
|
|
508
508
|
async function requestsGet(ctx, a) {
|
|
509
|
-
|
|
509
|
+
printJson(await get(ctx, a.required("requestId")));
|
|
510
510
|
}
|
|
511
511
|
async function requestsStats(ctx, a) {
|
|
512
512
|
const window = { start: a.str("start"), end: a.str("end") };
|
|
513
513
|
const method = a.str("method");
|
|
514
514
|
if (method) {
|
|
515
|
-
|
|
515
|
+
printJson(await statsForMethod(ctx, method, window));
|
|
516
516
|
} else {
|
|
517
|
-
|
|
517
|
+
printJson(await statsSummary(ctx, window));
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
520
|
var requestsHandlers = {
|
|
@@ -559,14 +559,14 @@ function occurrences(ctx, fingerprint, params = {}) {
|
|
|
559
559
|
return call(
|
|
560
560
|
ctx,
|
|
561
561
|
"GET",
|
|
562
|
-
`/_internal/v2/apps/${ctx.appId}/frontend-errors/${
|
|
562
|
+
`/_internal/v2/apps/${ctx.appId}/frontend-errors/${encodePathSegment(fingerprint)}/events${qs(params)}`
|
|
563
563
|
);
|
|
564
564
|
}
|
|
565
565
|
function get2(ctx, eventId) {
|
|
566
566
|
return call(
|
|
567
567
|
ctx,
|
|
568
568
|
"GET",
|
|
569
|
-
`/_internal/v2/apps/${ctx.appId}/frontend-errors/events/${
|
|
569
|
+
`/_internal/v2/apps/${ctx.appId}/frontend-errors/events/${encodePathSegment(eventId)}`
|
|
570
570
|
);
|
|
571
571
|
}
|
|
572
572
|
function stats(ctx, params = {}) {
|
|
@@ -612,7 +612,7 @@ var crashesSpecs = {
|
|
|
612
612
|
}
|
|
613
613
|
};
|
|
614
614
|
async function crashesList(ctx, a) {
|
|
615
|
-
|
|
615
|
+
printJson(
|
|
616
616
|
await list2(ctx, {
|
|
617
617
|
releaseId: a.str("release"),
|
|
618
618
|
sort: a.str("sort"),
|
|
@@ -623,8 +623,8 @@ async function crashesList(ctx, a) {
|
|
|
623
623
|
);
|
|
624
624
|
}
|
|
625
625
|
async function crashesOccurrences(ctx, a) {
|
|
626
|
-
|
|
627
|
-
await occurrences(ctx, a.
|
|
626
|
+
printJson(
|
|
627
|
+
await occurrences(ctx, a.required("fingerprint"), {
|
|
628
628
|
releaseId: a.str("release"),
|
|
629
629
|
cursor: a.str("cursor"),
|
|
630
630
|
limit: a.num("limit"),
|
|
@@ -634,10 +634,10 @@ async function crashesOccurrences(ctx, a) {
|
|
|
634
634
|
);
|
|
635
635
|
}
|
|
636
636
|
async function crashesGet(ctx, a) {
|
|
637
|
-
|
|
637
|
+
printJson(await get2(ctx, a.required("eventId")));
|
|
638
638
|
}
|
|
639
639
|
async function crashesStats(ctx, a) {
|
|
640
|
-
|
|
640
|
+
printJson(
|
|
641
641
|
await stats(ctx, {
|
|
642
642
|
releaseId: a.str("release"),
|
|
643
643
|
start: a.str("start"),
|
|
@@ -747,7 +747,7 @@ function crawlers(ctx, params) {
|
|
|
747
747
|
return call(
|
|
748
748
|
ctx,
|
|
749
749
|
"GET",
|
|
750
|
-
`/_internal/v2/apps/${ctx.appId}/insights/crawlers/${
|
|
750
|
+
`/_internal/v2/apps/${ctx.appId}/insights/crawlers/${encodePathSegment(kind)}${qs(rest)}`
|
|
751
751
|
);
|
|
752
752
|
}
|
|
753
753
|
|
|
@@ -835,7 +835,7 @@ var analyticsSpecs = {
|
|
|
835
835
|
}
|
|
836
836
|
};
|
|
837
837
|
async function analyticsQuery(ctx, a) {
|
|
838
|
-
const raw = a.
|
|
838
|
+
const raw = a.required("body");
|
|
839
839
|
let body;
|
|
840
840
|
try {
|
|
841
841
|
body = JSON.parse(raw);
|
|
@@ -845,10 +845,10 @@ async function analyticsQuery(ctx, a) {
|
|
|
845
845
|
analyticsSpecs["analytics query"].usage
|
|
846
846
|
);
|
|
847
847
|
}
|
|
848
|
-
|
|
848
|
+
printJson(await query(ctx, body));
|
|
849
849
|
}
|
|
850
850
|
async function analyticsBatch(ctx, a) {
|
|
851
|
-
const raw = a.
|
|
851
|
+
const raw = a.required("body");
|
|
852
852
|
let body;
|
|
853
853
|
try {
|
|
854
854
|
body = JSON.parse(raw);
|
|
@@ -859,9 +859,9 @@ async function analyticsBatch(ctx, a) {
|
|
|
859
859
|
);
|
|
860
860
|
}
|
|
861
861
|
const queries = Array.isArray(body) ? body : body?.queries;
|
|
862
|
-
|
|
862
|
+
printJson(await batch(ctx, queries));
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function readFunnelOrPathsBody(raw, command) {
|
|
865
865
|
if (raw === void 0) {
|
|
866
866
|
return {};
|
|
867
867
|
}
|
|
@@ -877,20 +877,23 @@ function visitReadBody(raw, command) {
|
|
|
877
877
|
return body;
|
|
878
878
|
}
|
|
879
879
|
async function analyticsFunnel(ctx, a) {
|
|
880
|
-
|
|
880
|
+
printJson(
|
|
881
881
|
await funnel(
|
|
882
882
|
ctx,
|
|
883
|
-
|
|
883
|
+
readFunnelOrPathsBody(a.required("body"), "analytics funnel")
|
|
884
884
|
)
|
|
885
885
|
);
|
|
886
886
|
}
|
|
887
887
|
async function analyticsPaths(ctx, a) {
|
|
888
|
-
|
|
889
|
-
await paths(
|
|
888
|
+
printJson(
|
|
889
|
+
await paths(
|
|
890
|
+
ctx,
|
|
891
|
+
readFunnelOrPathsBody(a.str("body"), "analytics paths")
|
|
892
|
+
)
|
|
890
893
|
);
|
|
891
894
|
}
|
|
892
895
|
async function analyticsSources(ctx, a) {
|
|
893
|
-
|
|
896
|
+
printJson(
|
|
894
897
|
await sources(ctx, {
|
|
895
898
|
releaseId: a.str("release"),
|
|
896
899
|
start: a.str("start"),
|
|
@@ -912,7 +915,7 @@ async function analyticsSources(ctx, a) {
|
|
|
912
915
|
);
|
|
913
916
|
}
|
|
914
917
|
async function analyticsMap(ctx, a) {
|
|
915
|
-
|
|
918
|
+
printJson(
|
|
916
919
|
await map(ctx, {
|
|
917
920
|
releaseId: a.str("release"),
|
|
918
921
|
start: a.str("start"),
|
|
@@ -934,10 +937,10 @@ async function analyticsMap(ctx, a) {
|
|
|
934
937
|
);
|
|
935
938
|
}
|
|
936
939
|
async function analyticsLive(ctx) {
|
|
937
|
-
|
|
940
|
+
printJson(await live(ctx));
|
|
938
941
|
}
|
|
939
942
|
async function analyticsAiSources(ctx, a) {
|
|
940
|
-
|
|
943
|
+
printJson(
|
|
941
944
|
await aiSources(ctx, {
|
|
942
945
|
releaseId: a.str("release"),
|
|
943
946
|
start: a.str("start"),
|
|
@@ -947,9 +950,9 @@ async function analyticsAiSources(ctx, a) {
|
|
|
947
950
|
);
|
|
948
951
|
}
|
|
949
952
|
async function analyticsCrawlers(ctx, a) {
|
|
950
|
-
|
|
953
|
+
printJson(
|
|
951
954
|
await crawlers(ctx, {
|
|
952
|
-
kind: a.
|
|
955
|
+
kind: a.required("sub"),
|
|
953
956
|
releaseId: a.str("release"),
|
|
954
957
|
start: a.str("start"),
|
|
955
958
|
end: a.str("end"),
|
|
@@ -1113,14 +1116,14 @@ function get3(ctx, releaseId) {
|
|
|
1113
1116
|
return call(
|
|
1114
1117
|
ctx,
|
|
1115
1118
|
"GET",
|
|
1116
|
-
`/_internal/v2/apps/${ctx.appId}/releases/${
|
|
1119
|
+
`/_internal/v2/apps/${ctx.appId}/releases/${encodePathSegment(releaseId)}`
|
|
1117
1120
|
);
|
|
1118
1121
|
}
|
|
1119
|
-
function
|
|
1122
|
+
function getByCommit(ctx, commitSha) {
|
|
1120
1123
|
return tryCall(
|
|
1121
1124
|
ctx,
|
|
1122
1125
|
"GET",
|
|
1123
|
-
`/_internal/v2/apps/${ctx.appId}/releases/by-commit/${
|
|
1126
|
+
`/_internal/v2/apps/${ctx.appId}/releases/by-commit/${encodePathSegment(commitSha)}`
|
|
1124
1127
|
);
|
|
1125
1128
|
}
|
|
1126
1129
|
async function dashboardLive(ctx) {
|
|
@@ -1177,7 +1180,7 @@ async function waitForCommit(ctx, params) {
|
|
|
1177
1180
|
const start2 = Date.now();
|
|
1178
1181
|
let release;
|
|
1179
1182
|
while (true) {
|
|
1180
|
-
const r = await
|
|
1183
|
+
const r = await getByCommit(ctx, commitSha);
|
|
1181
1184
|
if (r.ok) {
|
|
1182
1185
|
release = r.body;
|
|
1183
1186
|
break;
|
|
@@ -1227,7 +1230,7 @@ async function waitForCommit(ctx, params) {
|
|
|
1227
1230
|
`${release.status}\u2026 (${Math.round((Date.now() - start2) / 1e3)}s)`
|
|
1228
1231
|
);
|
|
1229
1232
|
await sleep(POLL_MS);
|
|
1230
|
-
const r = await
|
|
1233
|
+
const r = await getByCommit(ctx, commitSha);
|
|
1231
1234
|
if (r.ok) {
|
|
1232
1235
|
release = r.body;
|
|
1233
1236
|
}
|
|
@@ -1283,26 +1286,26 @@ function expandCommitSha(sha) {
|
|
|
1283
1286
|
return sha;
|
|
1284
1287
|
}
|
|
1285
1288
|
}
|
|
1286
|
-
function
|
|
1287
|
-
|
|
1289
|
+
function printWaitResult(data, code) {
|
|
1290
|
+
printJson(data);
|
|
1288
1291
|
process.exitCode = code;
|
|
1289
1292
|
}
|
|
1290
1293
|
async function releasesList(ctx, a) {
|
|
1291
1294
|
const result = await list3(ctx, { limit: a.num("limit") });
|
|
1292
|
-
|
|
1295
|
+
printJson(result.releases ?? []);
|
|
1293
1296
|
}
|
|
1294
1297
|
async function releasesGet(ctx, a) {
|
|
1295
|
-
|
|
1298
|
+
printJson(await get3(ctx, a.required("releaseId")));
|
|
1296
1299
|
}
|
|
1297
1300
|
async function releasesCurrent(ctx) {
|
|
1298
1301
|
const live2 = await dashboardLive(ctx);
|
|
1299
1302
|
if (!live2) {
|
|
1300
1303
|
fatal("No live release \u2014 publish first.");
|
|
1301
1304
|
}
|
|
1302
|
-
|
|
1305
|
+
printJson(live2);
|
|
1303
1306
|
}
|
|
1304
1307
|
async function releasesStatus(ctx, a) {
|
|
1305
|
-
const releaseId = a.
|
|
1308
|
+
const releaseId = a.required("releaseId");
|
|
1306
1309
|
const wait = a.bool("wait");
|
|
1307
1310
|
const timeout = (a.num("timeout") ?? 120) * 1e3;
|
|
1308
1311
|
const startTime = Date.now();
|
|
@@ -1314,13 +1317,13 @@ async function releasesStatus(ctx, a) {
|
|
|
1314
1317
|
"superseded"
|
|
1315
1318
|
]);
|
|
1316
1319
|
if (!wait) {
|
|
1317
|
-
|
|
1320
|
+
printJson(await get3(ctx, releaseId));
|
|
1318
1321
|
return;
|
|
1319
1322
|
}
|
|
1320
1323
|
while (true) {
|
|
1321
1324
|
const release = await get3(ctx, releaseId);
|
|
1322
1325
|
if (TERMINAL.has(release.status)) {
|
|
1323
|
-
|
|
1326
|
+
printJson(release);
|
|
1324
1327
|
return;
|
|
1325
1328
|
}
|
|
1326
1329
|
if (Date.now() - startTime > timeout) {
|
|
@@ -1350,7 +1353,7 @@ async function releasesWait(ctx, a) {
|
|
|
1350
1353
|
});
|
|
1351
1354
|
switch (result.outcome) {
|
|
1352
1355
|
case "not_found":
|
|
1353
|
-
|
|
1356
|
+
printWaitResult(
|
|
1354
1357
|
{
|
|
1355
1358
|
status: "not_found",
|
|
1356
1359
|
commitSha: commit,
|
|
@@ -1360,7 +1363,7 @@ async function releasesWait(ctx, a) {
|
|
|
1360
1363
|
);
|
|
1361
1364
|
return;
|
|
1362
1365
|
case "timeout":
|
|
1363
|
-
|
|
1366
|
+
printWaitResult(
|
|
1364
1367
|
{
|
|
1365
1368
|
...result.summary,
|
|
1366
1369
|
error: result.error
|
|
@@ -1370,13 +1373,13 @@ async function releasesWait(ctx, a) {
|
|
|
1370
1373
|
return;
|
|
1371
1374
|
case "live":
|
|
1372
1375
|
case "preview":
|
|
1373
|
-
|
|
1376
|
+
printWaitResult(result.summary, EXIT.ok);
|
|
1374
1377
|
return;
|
|
1375
1378
|
case "failed":
|
|
1376
|
-
|
|
1379
|
+
printWaitResult(result.summary, EXIT.buildFailed);
|
|
1377
1380
|
return;
|
|
1378
1381
|
case "superseded":
|
|
1379
|
-
|
|
1382
|
+
printWaitResult(result.summary, EXIT.superseded);
|
|
1380
1383
|
return;
|
|
1381
1384
|
}
|
|
1382
1385
|
}
|
|
@@ -1449,7 +1452,7 @@ function revoke(ctx, shareId) {
|
|
|
1449
1452
|
return call(
|
|
1450
1453
|
ctx,
|
|
1451
1454
|
"POST",
|
|
1452
|
-
`/_internal/v2/apps/${ctx.appId}/preview/shares/${
|
|
1455
|
+
`/_internal/v2/apps/${ctx.appId}/preview/shares/${encodePathSegment(shareId)}/revoke`
|
|
1453
1456
|
);
|
|
1454
1457
|
}
|
|
1455
1458
|
|
|
@@ -1473,19 +1476,19 @@ var previewsSpecs = {
|
|
|
1473
1476
|
}
|
|
1474
1477
|
};
|
|
1475
1478
|
async function previewsShare(ctx, a) {
|
|
1476
|
-
|
|
1479
|
+
printJson(
|
|
1477
1480
|
await share(ctx, {
|
|
1478
|
-
branch: a.
|
|
1481
|
+
branch: a.required("branch"),
|
|
1479
1482
|
days: a.num("days"),
|
|
1480
1483
|
label: a.str("label")
|
|
1481
1484
|
})
|
|
1482
1485
|
);
|
|
1483
1486
|
}
|
|
1484
1487
|
async function previewsList(ctx, a) {
|
|
1485
|
-
|
|
1488
|
+
printJson(await list4(ctx, a.required("branch")));
|
|
1486
1489
|
}
|
|
1487
1490
|
async function previewsRevoke(ctx, a) {
|
|
1488
|
-
|
|
1491
|
+
printJson(await revoke(ctx, a.required("shareId")));
|
|
1489
1492
|
}
|
|
1490
1493
|
var previewsHandlers = {
|
|
1491
1494
|
"previews share": previewsShare,
|
|
@@ -1505,8 +1508,9 @@ Usage:
|
|
|
1505
1508
|
remy-admin previews revoke <shareId> <shareId> is a link's id, from 'list'
|
|
1506
1509
|
|
|
1507
1510
|
Notes:
|
|
1508
|
-
- A
|
|
1509
|
-
for what needs it, with the shortest --days that
|
|
1511
|
+
- A link opens the app itself, running with its secrets and real effects, so it is
|
|
1512
|
+
a credential: make one only for what needs it, with the shortest --days that
|
|
1513
|
+
serves, and revoke it when done.
|
|
1510
1514
|
- 'share' returns { link, url, token, previewUrl }, once. A person opens url. A
|
|
1511
1515
|
client with no cookie jar (curl, git, CI, a test run) sends token as the
|
|
1512
1516
|
X-Remy-Preview header on each request to previewUrl, beside the app's own
|
|
@@ -1531,7 +1535,7 @@ function getRelease(ctx, releaseId) {
|
|
|
1531
1535
|
return call(
|
|
1532
1536
|
ctx,
|
|
1533
1537
|
"GET",
|
|
1534
|
-
`/_internal/v2/apps/${ctx.appId}/releases/${
|
|
1538
|
+
`/_internal/v2/apps/${ctx.appId}/releases/${encodePathSegment(releaseId)}`
|
|
1535
1539
|
);
|
|
1536
1540
|
}
|
|
1537
1541
|
async function fetchReport(url) {
|
|
@@ -1586,28 +1590,28 @@ async function diagnosticsGet(ctx, a) {
|
|
|
1586
1590
|
while (true) {
|
|
1587
1591
|
const release2 = await getRelease(ctx, releaseId);
|
|
1588
1592
|
if (release2.diagnostics) {
|
|
1589
|
-
|
|
1593
|
+
printJson(release2.diagnostics);
|
|
1590
1594
|
return;
|
|
1591
1595
|
}
|
|
1592
1596
|
if (Date.now() - start2 > timeout) {
|
|
1593
|
-
|
|
1597
|
+
printJson(DIAGNOSTICS_PENDING);
|
|
1594
1598
|
return;
|
|
1595
1599
|
}
|
|
1596
1600
|
await sleep(3e3);
|
|
1597
1601
|
}
|
|
1598
1602
|
}
|
|
1599
1603
|
const release = await getRelease(ctx, releaseId);
|
|
1600
|
-
|
|
1604
|
+
printJson(release.diagnostics ?? DIAGNOSTICS_PENDING);
|
|
1601
1605
|
}
|
|
1602
1606
|
async function diagnosticsReport(ctx, a) {
|
|
1603
1607
|
const releaseId = await resolveReleaseId(ctx, a);
|
|
1604
1608
|
const release = await getRelease(ctx, releaseId);
|
|
1605
1609
|
const url = release.diagnostics?.lighthouseJsonUrl;
|
|
1606
1610
|
if (!url) {
|
|
1607
|
-
|
|
1611
|
+
printJson(DIAGNOSTICS_PENDING);
|
|
1608
1612
|
return;
|
|
1609
1613
|
}
|
|
1610
|
-
|
|
1614
|
+
printJson(await fetchReport(url));
|
|
1611
1615
|
}
|
|
1612
1616
|
var diagnosticsHandlers = {
|
|
1613
1617
|
"diagnostics get": diagnosticsGet,
|
|
@@ -1708,7 +1712,7 @@ async function customRemove(ctx, hostname) {
|
|
|
1708
1712
|
return call(
|
|
1709
1713
|
ctx,
|
|
1710
1714
|
"POST",
|
|
1711
|
-
`/_internal/v2/apps/${ctx.appId}/settings/custom-domains/${
|
|
1715
|
+
`/_internal/v2/apps/${ctx.appId}/settings/custom-domains/${encodePathSegment(id)}/delete`
|
|
1712
1716
|
);
|
|
1713
1717
|
}
|
|
1714
1718
|
async function customRetry(ctx, hostname) {
|
|
@@ -1716,7 +1720,7 @@ async function customRetry(ctx, hostname) {
|
|
|
1716
1720
|
return call(
|
|
1717
1721
|
ctx,
|
|
1718
1722
|
"POST",
|
|
1719
|
-
`/_internal/v2/apps/${ctx.appId}/settings/custom-domains/${
|
|
1723
|
+
`/_internal/v2/apps/${ctx.appId}/settings/custom-domains/${encodePathSegment(id)}/retry`
|
|
1720
1724
|
);
|
|
1721
1725
|
}
|
|
1722
1726
|
var REGISTERED = (ctx) => `/_internal/v2/apps/${ctx.appId}/settings/registered-domains`;
|
|
@@ -1744,12 +1748,12 @@ function buy(ctx, params) {
|
|
|
1744
1748
|
{ name: params.name, expectedPrice: params.price, acceptTerms: true }
|
|
1745
1749
|
);
|
|
1746
1750
|
}
|
|
1747
|
-
function
|
|
1751
|
+
function listOwned(ctx) {
|
|
1748
1752
|
return call(ctx, "GET", REGISTERED(ctx));
|
|
1749
1753
|
}
|
|
1750
1754
|
async function findOwned(ctx, name) {
|
|
1751
1755
|
const wanted = name.toLowerCase();
|
|
1752
|
-
const { domains } = await
|
|
1756
|
+
const { domains } = await listOwned(ctx);
|
|
1753
1757
|
const domain = domains.find(
|
|
1754
1758
|
(d) => d.name === wanted && (d.status === "active" || d.status === "expired" || d.status === "pending")
|
|
1755
1759
|
);
|
|
@@ -1778,7 +1782,7 @@ async function zone(ctx, name) {
|
|
|
1778
1782
|
return call(
|
|
1779
1783
|
ctx,
|
|
1780
1784
|
"GET",
|
|
1781
|
-
`${REGISTERED(ctx)}/${
|
|
1785
|
+
`${REGISTERED(ctx)}/${encodePathSegment(domain.id)}/records`
|
|
1782
1786
|
);
|
|
1783
1787
|
}
|
|
1784
1788
|
async function zoneAdd(ctx, name, record) {
|
|
@@ -1786,7 +1790,7 @@ async function zoneAdd(ctx, name, record) {
|
|
|
1786
1790
|
return call(
|
|
1787
1791
|
ctx,
|
|
1788
1792
|
"POST",
|
|
1789
|
-
`${REGISTERED(ctx)}/${
|
|
1793
|
+
`${REGISTERED(ctx)}/${encodePathSegment(domain.id)}/records`,
|
|
1790
1794
|
{ ...record }
|
|
1791
1795
|
);
|
|
1792
1796
|
}
|
|
@@ -1795,7 +1799,7 @@ async function zoneUpdate(ctx, name, recordId, record) {
|
|
|
1795
1799
|
return call(
|
|
1796
1800
|
ctx,
|
|
1797
1801
|
"POST",
|
|
1798
|
-
`${REGISTERED(ctx)}/${
|
|
1802
|
+
`${REGISTERED(ctx)}/${encodePathSegment(domain.id)}/records/${encodePathSegment(recordId)}`,
|
|
1799
1803
|
{ ...record }
|
|
1800
1804
|
);
|
|
1801
1805
|
}
|
|
@@ -1804,7 +1808,7 @@ async function zoneDelete(ctx, name, recordId) {
|
|
|
1804
1808
|
return call(
|
|
1805
1809
|
ctx,
|
|
1806
1810
|
"POST",
|
|
1807
|
-
`${REGISTERED(ctx)}/${
|
|
1811
|
+
`${REGISTERED(ctx)}/${encodePathSegment(domain.id)}/records/${encodePathSegment(recordId)}/delete`
|
|
1808
1812
|
);
|
|
1809
1813
|
}
|
|
1810
1814
|
|
|
@@ -1940,34 +1944,34 @@ var domainsSpecs = {
|
|
|
1940
1944
|
}
|
|
1941
1945
|
};
|
|
1942
1946
|
async function domainsGet(ctx) {
|
|
1943
|
-
|
|
1947
|
+
printJson(await get4(ctx));
|
|
1944
1948
|
}
|
|
1945
1949
|
async function domainsSet(ctx, a) {
|
|
1946
|
-
|
|
1950
|
+
printJson(await set(ctx, a.required("subdomain")));
|
|
1947
1951
|
}
|
|
1948
1952
|
async function domainsCheck(ctx, a) {
|
|
1949
|
-
|
|
1953
|
+
printJson(await check(ctx, a.required("subdomain")));
|
|
1950
1954
|
}
|
|
1951
1955
|
async function customDomainsList(ctx) {
|
|
1952
|
-
|
|
1956
|
+
printJson(await customList(ctx));
|
|
1953
1957
|
}
|
|
1954
1958
|
async function customDomainsAdd(ctx, a) {
|
|
1955
|
-
|
|
1959
|
+
printJson(await customAdd(ctx, a.required("hostname")));
|
|
1956
1960
|
}
|
|
1957
1961
|
async function customDomainsCheck(ctx, a) {
|
|
1958
|
-
|
|
1962
|
+
printJson(await customCheck(ctx, a.required("hostname")));
|
|
1959
1963
|
}
|
|
1960
1964
|
async function customDomainsRecords(ctx, a) {
|
|
1961
|
-
const { entry } = await findHostname(ctx, a.
|
|
1962
|
-
|
|
1965
|
+
const { entry } = await findHostname(ctx, a.required("hostname"));
|
|
1966
|
+
printJson({
|
|
1963
1967
|
hostname: entry.hostname,
|
|
1964
1968
|
isApex: entry.isApex,
|
|
1965
1969
|
dnsInstructions: entry.dnsInstructions
|
|
1966
1970
|
});
|
|
1967
1971
|
}
|
|
1968
1972
|
async function customDomainsStatus(ctx, a) {
|
|
1969
|
-
const { entry } = await findHostname(ctx, a.
|
|
1970
|
-
|
|
1973
|
+
const { entry } = await findHostname(ctx, a.required("hostname"));
|
|
1974
|
+
printJson({
|
|
1971
1975
|
hostname: entry.hostname,
|
|
1972
1976
|
uiStatus: entry.uiStatus,
|
|
1973
1977
|
verificationErrors: entry.verificationErrors ?? null,
|
|
@@ -1976,33 +1980,33 @@ async function customDomainsStatus(ctx, a) {
|
|
|
1976
1980
|
});
|
|
1977
1981
|
}
|
|
1978
1982
|
async function customDomainsRemove(ctx, a) {
|
|
1979
|
-
|
|
1983
|
+
printJson(await customRemove(ctx, a.required("hostname")));
|
|
1980
1984
|
}
|
|
1981
1985
|
async function customDomainsRetry(ctx, a) {
|
|
1982
|
-
|
|
1986
|
+
printJson(await customRetry(ctx, a.required("hostname")));
|
|
1983
1987
|
}
|
|
1984
1988
|
async function domainsSearch(ctx, a) {
|
|
1985
|
-
|
|
1989
|
+
printJson(await search(ctx, a.rest("query").join(" ")));
|
|
1986
1990
|
}
|
|
1987
1991
|
async function domainsQuote(ctx, a) {
|
|
1988
|
-
|
|
1992
|
+
printJson(await quote(ctx, a.required("name")));
|
|
1989
1993
|
}
|
|
1990
1994
|
async function domainsBuy(ctx, a) {
|
|
1991
|
-
|
|
1995
|
+
printJson(
|
|
1992
1996
|
await buy(ctx, {
|
|
1993
|
-
name: a.
|
|
1997
|
+
name: a.required("name"),
|
|
1994
1998
|
price: Number(a.str("price"))
|
|
1995
1999
|
})
|
|
1996
2000
|
);
|
|
1997
2001
|
}
|
|
1998
2002
|
async function domainsOwned(ctx) {
|
|
1999
|
-
|
|
2003
|
+
printJson(await listOwned(ctx));
|
|
2000
2004
|
}
|
|
2001
2005
|
async function domainsContactGet(ctx) {
|
|
2002
|
-
|
|
2006
|
+
printJson(await contactGet(ctx));
|
|
2003
2007
|
}
|
|
2004
2008
|
async function domainsContactSet(ctx, a) {
|
|
2005
|
-
|
|
2009
|
+
printJson(
|
|
2006
2010
|
await contactSet(ctx, {
|
|
2007
2011
|
firstName: a.str("first-name") ?? "",
|
|
2008
2012
|
lastName: a.str("last-name") ?? "",
|
|
@@ -2029,23 +2033,29 @@ function zoneRecord(a) {
|
|
|
2029
2033
|
};
|
|
2030
2034
|
}
|
|
2031
2035
|
async function domainsZoneList(ctx, a) {
|
|
2032
|
-
|
|
2036
|
+
printJson(await zone(ctx, a.required("name")));
|
|
2033
2037
|
}
|
|
2034
2038
|
async function domainsZoneAdd(ctx, a) {
|
|
2035
|
-
|
|
2039
|
+
printJson(await zoneAdd(ctx, a.required("name"), zoneRecord(a)));
|
|
2036
2040
|
}
|
|
2037
2041
|
async function domainsZoneUpdate(ctx, a) {
|
|
2038
|
-
|
|
2042
|
+
printJson(
|
|
2039
2043
|
await zoneUpdate(
|
|
2040
2044
|
ctx,
|
|
2041
|
-
a.
|
|
2042
|
-
Number(a.
|
|
2045
|
+
a.required("name"),
|
|
2046
|
+
Number(a.required("recordId")),
|
|
2043
2047
|
zoneRecord(a)
|
|
2044
2048
|
)
|
|
2045
2049
|
);
|
|
2046
2050
|
}
|
|
2047
2051
|
async function domainsZoneDelete(ctx, a) {
|
|
2048
|
-
|
|
2052
|
+
printJson(
|
|
2053
|
+
await zoneDelete(
|
|
2054
|
+
ctx,
|
|
2055
|
+
a.required("name"),
|
|
2056
|
+
Number(a.required("recordId"))
|
|
2057
|
+
)
|
|
2058
|
+
);
|
|
2049
2059
|
}
|
|
2050
2060
|
var domainsHandlers = {
|
|
2051
2061
|
"domains get": domainsGet,
|
|
@@ -2167,7 +2177,7 @@ function setRole(ctx, userId, role) {
|
|
|
2167
2177
|
return call(
|
|
2168
2178
|
ctx,
|
|
2169
2179
|
"POST",
|
|
2170
|
-
`/_internal/v2/apps/${ctx.appId}/users/${
|
|
2180
|
+
`/_internal/v2/apps/${ctx.appId}/users/${encodePathSegment(userId)}/roles`,
|
|
2171
2181
|
{ roles: [role] }
|
|
2172
2182
|
);
|
|
2173
2183
|
}
|
|
@@ -2175,14 +2185,14 @@ function createApiKey(ctx, userId) {
|
|
|
2175
2185
|
return call(
|
|
2176
2186
|
ctx,
|
|
2177
2187
|
"POST",
|
|
2178
|
-
`/_internal/v2/apps/${ctx.appId}/users/${
|
|
2188
|
+
`/_internal/v2/apps/${ctx.appId}/users/${encodePathSegment(userId)}/api-key`
|
|
2179
2189
|
);
|
|
2180
2190
|
}
|
|
2181
2191
|
function revokeApiKey(ctx, userId) {
|
|
2182
2192
|
return call(
|
|
2183
2193
|
ctx,
|
|
2184
2194
|
"DELETE",
|
|
2185
|
-
`/_internal/v2/apps/${ctx.appId}/users/${
|
|
2195
|
+
`/_internal/v2/apps/${ctx.appId}/users/${encodePathSegment(userId)}/api-key`
|
|
2186
2196
|
);
|
|
2187
2197
|
}
|
|
2188
2198
|
|
|
@@ -2209,7 +2219,7 @@ var usersSpecs = {
|
|
|
2209
2219
|
}
|
|
2210
2220
|
};
|
|
2211
2221
|
async function usersList(ctx, a) {
|
|
2212
|
-
|
|
2222
|
+
printJson(
|
|
2213
2223
|
await list5(ctx, {
|
|
2214
2224
|
limit: a.num("limit"),
|
|
2215
2225
|
offset: a.num("offset")
|
|
@@ -2217,13 +2227,13 @@ async function usersList(ctx, a) {
|
|
|
2217
2227
|
);
|
|
2218
2228
|
}
|
|
2219
2229
|
async function usersSetRole(ctx, a) {
|
|
2220
|
-
|
|
2230
|
+
printJson(await setRole(ctx, a.required("userId"), a.required("role")));
|
|
2221
2231
|
}
|
|
2222
2232
|
async function usersCreateApiKey(ctx, a) {
|
|
2223
|
-
|
|
2233
|
+
printJson(await createApiKey(ctx, a.required("userId")));
|
|
2224
2234
|
}
|
|
2225
2235
|
async function usersRevokeApiKey(ctx, a) {
|
|
2226
|
-
|
|
2236
|
+
printJson(await revokeApiKey(ctx, a.required("userId")));
|
|
2227
2237
|
}
|
|
2228
2238
|
var usersHandlers = {
|
|
2229
2239
|
"users list": usersList,
|
|
@@ -2333,24 +2343,28 @@ var dbSpecs = {
|
|
|
2333
2343
|
}
|
|
2334
2344
|
};
|
|
2335
2345
|
async function dbQuery(ctx, a) {
|
|
2336
|
-
|
|
2346
|
+
printJson(await query2(ctx, a.required("sql")));
|
|
2337
2347
|
}
|
|
2338
2348
|
async function dbHistory(ctx, a) {
|
|
2339
|
-
|
|
2349
|
+
printJson(
|
|
2340
2350
|
await history(ctx, { limit: a.num("limit"), cursor: a.str("cursor") })
|
|
2341
2351
|
);
|
|
2342
2352
|
}
|
|
2343
2353
|
async function dbHistoryQuery(ctx, a) {
|
|
2344
|
-
|
|
2354
|
+
printJson(
|
|
2355
|
+
await historyQuery(ctx, a.required("releaseId"), a.required("sql"))
|
|
2356
|
+
);
|
|
2345
2357
|
}
|
|
2346
2358
|
async function dbHistoryAttach(ctx, a) {
|
|
2347
|
-
|
|
2359
|
+
printJson(
|
|
2360
|
+
await historyAttach(ctx, a.required("releaseId"), a.required("sql"))
|
|
2361
|
+
);
|
|
2348
2362
|
}
|
|
2349
2363
|
async function dbHistoryPurge(ctx) {
|
|
2350
|
-
|
|
2364
|
+
printJson(await historyPurge(ctx));
|
|
2351
2365
|
}
|
|
2352
2366
|
async function dbTables(ctx) {
|
|
2353
|
-
|
|
2367
|
+
printJson(
|
|
2354
2368
|
await query2(
|
|
2355
2369
|
ctx,
|
|
2356
2370
|
"SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name"
|
|
@@ -2480,7 +2494,7 @@ function set2(ctx, key, params) {
|
|
|
2480
2494
|
return call(
|
|
2481
2495
|
ctx,
|
|
2482
2496
|
"PUT",
|
|
2483
|
-
`/_internal/v2/apps/${ctx.appId}/secrets/${
|
|
2497
|
+
`/_internal/v2/apps/${ctx.appId}/secrets/${encodePathSegment(key)}`,
|
|
2484
2498
|
body
|
|
2485
2499
|
);
|
|
2486
2500
|
}
|
|
@@ -2488,7 +2502,7 @@ function del(ctx, key) {
|
|
|
2488
2502
|
return call(
|
|
2489
2503
|
ctx,
|
|
2490
2504
|
"DELETE",
|
|
2491
|
-
`/_internal/v2/apps/${ctx.appId}/secrets/${
|
|
2505
|
+
`/_internal/v2/apps/${ctx.appId}/secrets/${encodePathSegment(key)}`
|
|
2492
2506
|
);
|
|
2493
2507
|
}
|
|
2494
2508
|
|
|
@@ -2517,10 +2531,10 @@ var secretsSpecs = {
|
|
|
2517
2531
|
}
|
|
2518
2532
|
};
|
|
2519
2533
|
async function secretsList(ctx) {
|
|
2520
|
-
|
|
2534
|
+
printJson(await list6(ctx));
|
|
2521
2535
|
}
|
|
2522
2536
|
async function secretsSet(ctx, a) {
|
|
2523
|
-
const key = a.
|
|
2537
|
+
const key = a.required("key");
|
|
2524
2538
|
const dev = a.str("dev");
|
|
2525
2539
|
const prod = a.str("prod");
|
|
2526
2540
|
const devClear = a.bool("dev-clear");
|
|
@@ -2541,10 +2555,10 @@ async function secretsSet(ctx, a) {
|
|
|
2541
2555
|
"At least one of --dev <value>, --prod <value>, --dev-clear, or --prod-clear is required"
|
|
2542
2556
|
);
|
|
2543
2557
|
}
|
|
2544
|
-
|
|
2558
|
+
printJson(await set2(ctx, key, params));
|
|
2545
2559
|
}
|
|
2546
2560
|
async function secretsDelete(ctx, a) {
|
|
2547
|
-
|
|
2561
|
+
printJson(await del(ctx, a.required("key")));
|
|
2548
2562
|
}
|
|
2549
2563
|
var secretsHandlers = {
|
|
2550
2564
|
"secrets list": secretsList,
|
|
@@ -2647,7 +2661,7 @@ async function streamToStdout(ctx, apiPath, body) {
|
|
|
2647
2661
|
return;
|
|
2648
2662
|
}
|
|
2649
2663
|
try {
|
|
2650
|
-
|
|
2664
|
+
printJson(JSON.parse(line.slice(6)));
|
|
2651
2665
|
} catch {
|
|
2652
2666
|
}
|
|
2653
2667
|
};
|
|
@@ -2720,7 +2734,7 @@ async function tailSseToStdout(ctx, apiPath) {
|
|
|
2720
2734
|
complete = true;
|
|
2721
2735
|
return;
|
|
2722
2736
|
}
|
|
2723
|
-
|
|
2737
|
+
printJson(value);
|
|
2724
2738
|
} catch {
|
|
2725
2739
|
}
|
|
2726
2740
|
};
|
|
@@ -2772,7 +2786,7 @@ async function list7(ctx) {
|
|
|
2772
2786
|
function invoke(ctx, params) {
|
|
2773
2787
|
const { methodId, input, impersonate } = params;
|
|
2774
2788
|
const useImpersonate = impersonate !== void 0 && (impersonate.roles !== void 0 || impersonate.userId !== void 0);
|
|
2775
|
-
const apiPath = useImpersonate ? `/_internal/v2/apps/${ctx.appId}/methods/${
|
|
2789
|
+
const apiPath = useImpersonate ? `/_internal/v2/apps/${ctx.appId}/methods/${encodePathSegment(methodId)}/invoke-as` : `/_internal/v2/apps/${ctx.appId}/methods/${encodePathSegment(methodId)}/invoke`;
|
|
2776
2790
|
const body = useImpersonate ? { input, impersonate } : { input };
|
|
2777
2791
|
return call(
|
|
2778
2792
|
ctx,
|
|
@@ -2800,10 +2814,10 @@ var methodsSpecs = {
|
|
|
2800
2814
|
}
|
|
2801
2815
|
};
|
|
2802
2816
|
async function methodsList(ctx) {
|
|
2803
|
-
|
|
2817
|
+
printJson(await list7(ctx));
|
|
2804
2818
|
}
|
|
2805
2819
|
async function methodsInvoke(ctx, a) {
|
|
2806
|
-
const methodId = a.
|
|
2820
|
+
const methodId = a.required("methodId");
|
|
2807
2821
|
const inputRaw = a.str("input");
|
|
2808
2822
|
let input = {};
|
|
2809
2823
|
if (inputRaw) {
|
|
@@ -2824,14 +2838,14 @@ async function methodsInvoke(ctx, a) {
|
|
|
2824
2838
|
}
|
|
2825
2839
|
const useImpersonate = impersonate.roles !== void 0 || impersonate.userId !== void 0;
|
|
2826
2840
|
const stream = a.bool("stream");
|
|
2827
|
-
const apiPath = useImpersonate ? `/_internal/v2/apps/${ctx.appId}/methods/${
|
|
2841
|
+
const apiPath = useImpersonate ? `/_internal/v2/apps/${ctx.appId}/methods/${encodePathSegment(methodId)}/invoke-as` : `/_internal/v2/apps/${ctx.appId}/methods/${encodePathSegment(methodId)}/invoke`;
|
|
2828
2842
|
const body = useImpersonate ? { input, impersonate } : { input };
|
|
2829
2843
|
if (stream) {
|
|
2830
2844
|
await streamToStdout(ctx, apiPath, { ...body, stream: true });
|
|
2831
2845
|
return;
|
|
2832
2846
|
}
|
|
2833
2847
|
try {
|
|
2834
|
-
|
|
2848
|
+
printJson(
|
|
2835
2849
|
await invoke(ctx, {
|
|
2836
2850
|
methodId,
|
|
2837
2851
|
input,
|
|
@@ -2929,16 +2943,16 @@ var dataSpecs = {
|
|
|
2929
2943
|
}
|
|
2930
2944
|
};
|
|
2931
2945
|
async function dataLiftFromDev(ctx, a) {
|
|
2932
|
-
const given = a.
|
|
2946
|
+
const given = a.required("appId");
|
|
2933
2947
|
if (given !== ctx.appId) {
|
|
2934
2948
|
fatal(
|
|
2935
2949
|
`appId "${given}" does not match this workspace's app \u2014 re-run with the exact appId from mindstudio.json.`
|
|
2936
2950
|
);
|
|
2937
2951
|
}
|
|
2938
|
-
|
|
2952
|
+
printJson(await liftFromDev(ctx, { releaseId: a.str("release-id") }));
|
|
2939
2953
|
}
|
|
2940
2954
|
async function dataLiftFromLive(ctx, a) {
|
|
2941
|
-
|
|
2955
|
+
printJson(
|
|
2942
2956
|
await liftFromLive(ctx, {
|
|
2943
2957
|
truncate: a.bool("truncate"),
|
|
2944
2958
|
releaseId: a.str("release-id")
|
|
@@ -3016,7 +3030,7 @@ function list8(ctx, params = {}) {
|
|
|
3016
3030
|
`/_internal/v2/apps/${ctx.appId}/issues${listQuery(params)}`
|
|
3017
3031
|
);
|
|
3018
3032
|
}
|
|
3019
|
-
function
|
|
3033
|
+
function listFiled(ctx, params = {}) {
|
|
3020
3034
|
return call(
|
|
3021
3035
|
ctx,
|
|
3022
3036
|
"GET",
|
|
@@ -3027,7 +3041,7 @@ function get5(ctx, number) {
|
|
|
3027
3041
|
return call(
|
|
3028
3042
|
ctx,
|
|
3029
3043
|
"GET",
|
|
3030
|
-
`/_internal/v2/apps/${ctx.appId}/issues/${
|
|
3044
|
+
`/_internal/v2/apps/${ctx.appId}/issues/${encodePathSegment(number)}`
|
|
3031
3045
|
);
|
|
3032
3046
|
}
|
|
3033
3047
|
function create(ctx, params) {
|
|
@@ -3056,7 +3070,7 @@ function comment(ctx, number, body) {
|
|
|
3056
3070
|
return call(
|
|
3057
3071
|
ctx,
|
|
3058
3072
|
"POST",
|
|
3059
|
-
`/_internal/v2/apps/${ctx.appId}/issues/${
|
|
3073
|
+
`/_internal/v2/apps/${ctx.appId}/issues/${encodePathSegment(number)}/comments`,
|
|
3060
3074
|
{ body, authorKind: "agent", ...authorship(ctx) }
|
|
3061
3075
|
);
|
|
3062
3076
|
}
|
|
@@ -3072,7 +3086,7 @@ function close(ctx, number, comment2) {
|
|
|
3072
3086
|
return call(
|
|
3073
3087
|
ctx,
|
|
3074
3088
|
"POST",
|
|
3075
|
-
`/_internal/v2/apps/${ctx.appId}/issues/${
|
|
3089
|
+
`/_internal/v2/apps/${ctx.appId}/issues/${encodePathSegment(number)}/update`,
|
|
3076
3090
|
requestBody
|
|
3077
3091
|
);
|
|
3078
3092
|
}
|
|
@@ -3080,7 +3094,7 @@ function reopen(ctx, number) {
|
|
|
3080
3094
|
return call(
|
|
3081
3095
|
ctx,
|
|
3082
3096
|
"POST",
|
|
3083
|
-
`/_internal/v2/apps/${ctx.appId}/issues/${
|
|
3097
|
+
`/_internal/v2/apps/${ctx.appId}/issues/${encodePathSegment(number)}/update`,
|
|
3084
3098
|
{ status: "open", authorKind: "agent", ...authorship(ctx) }
|
|
3085
3099
|
);
|
|
3086
3100
|
}
|
|
@@ -3104,7 +3118,7 @@ function edit(ctx, number, params) {
|
|
|
3104
3118
|
return call(
|
|
3105
3119
|
ctx,
|
|
3106
3120
|
"POST",
|
|
3107
|
-
`/_internal/v2/apps/${ctx.appId}/issues/${
|
|
3121
|
+
`/_internal/v2/apps/${ctx.appId}/issues/${encodePathSegment(number)}/update`,
|
|
3108
3122
|
requestBody
|
|
3109
3123
|
);
|
|
3110
3124
|
}
|
|
@@ -3112,7 +3126,7 @@ function del2(ctx, number) {
|
|
|
3112
3126
|
return call(
|
|
3113
3127
|
ctx,
|
|
3114
3128
|
"POST",
|
|
3115
|
-
`/_internal/v2/apps/${ctx.appId}/issues/${
|
|
3129
|
+
`/_internal/v2/apps/${ctx.appId}/issues/${encodePathSegment(number)}/delete`
|
|
3116
3130
|
);
|
|
3117
3131
|
}
|
|
3118
3132
|
|
|
@@ -3214,7 +3228,7 @@ function readStateFilter(a) {
|
|
|
3214
3228
|
return state === "all" ? void 0 : state;
|
|
3215
3229
|
}
|
|
3216
3230
|
async function issuesList(ctx, a) {
|
|
3217
|
-
|
|
3231
|
+
printJson(
|
|
3218
3232
|
await list8(ctx, {
|
|
3219
3233
|
status: readStateFilter(a),
|
|
3220
3234
|
labels: a.list("label"),
|
|
@@ -3225,8 +3239,8 @@ async function issuesList(ctx, a) {
|
|
|
3225
3239
|
);
|
|
3226
3240
|
}
|
|
3227
3241
|
async function issuesFiled(ctx, a) {
|
|
3228
|
-
|
|
3229
|
-
await
|
|
3242
|
+
printJson(
|
|
3243
|
+
await listFiled(ctx, {
|
|
3230
3244
|
status: readStateFilter(a),
|
|
3231
3245
|
labels: a.list("label"),
|
|
3232
3246
|
limit: a.num("limit"),
|
|
@@ -3235,32 +3249,34 @@ async function issuesFiled(ctx, a) {
|
|
|
3235
3249
|
);
|
|
3236
3250
|
}
|
|
3237
3251
|
async function issuesGet(ctx, a) {
|
|
3238
|
-
|
|
3252
|
+
printJson(await get5(ctx, a.required("number")));
|
|
3239
3253
|
}
|
|
3240
3254
|
async function issuesCreate(ctx, a) {
|
|
3241
3255
|
const issueBody = readBodyFlag(a);
|
|
3242
|
-
|
|
3256
|
+
printJson(
|
|
3243
3257
|
await create(ctx, {
|
|
3244
|
-
title: a.
|
|
3258
|
+
title: a.required("title"),
|
|
3245
3259
|
body: issueBody,
|
|
3246
3260
|
labels: a.list("label")
|
|
3247
3261
|
})
|
|
3248
3262
|
);
|
|
3249
3263
|
}
|
|
3250
3264
|
async function issuesComment(ctx, a) {
|
|
3251
|
-
const commentBody = readBodyFlag(a) ?? a.
|
|
3252
|
-
|
|
3265
|
+
const commentBody = readBodyFlag(a) ?? a.required("body");
|
|
3266
|
+
printJson(await comment(ctx, a.required("number"), commentBody));
|
|
3253
3267
|
}
|
|
3254
3268
|
async function issuesClose(ctx, a) {
|
|
3255
|
-
|
|
3269
|
+
printJson(
|
|
3270
|
+
await close(ctx, a.required("number"), readStdinFlag(a, "comment"))
|
|
3271
|
+
);
|
|
3256
3272
|
}
|
|
3257
3273
|
async function issuesReopen(ctx, a) {
|
|
3258
|
-
|
|
3274
|
+
printJson(await reopen(ctx, a.required("number")));
|
|
3259
3275
|
}
|
|
3260
3276
|
async function issuesEdit(ctx, a) {
|
|
3261
3277
|
const editBody = readBodyFlag(a);
|
|
3262
|
-
|
|
3263
|
-
await edit(ctx, a.
|
|
3278
|
+
printJson(
|
|
3279
|
+
await edit(ctx, a.required("number"), {
|
|
3264
3280
|
title: a.str("title"),
|
|
3265
3281
|
body: editBody,
|
|
3266
3282
|
labels: a.list("label"),
|
|
@@ -3269,7 +3285,7 @@ async function issuesEdit(ctx, a) {
|
|
|
3269
3285
|
);
|
|
3270
3286
|
}
|
|
3271
3287
|
async function issuesDelete(ctx, a) {
|
|
3272
|
-
|
|
3288
|
+
printJson(await del2(ctx, a.required("number")));
|
|
3273
3289
|
}
|
|
3274
3290
|
var issuesHandlers = {
|
|
3275
3291
|
"issues list": issuesList,
|
|
@@ -3371,7 +3387,7 @@ var appsSpecs = {
|
|
|
3371
3387
|
}
|
|
3372
3388
|
};
|
|
3373
3389
|
async function appsList(ctx, a) {
|
|
3374
|
-
|
|
3390
|
+
printJson(
|
|
3375
3391
|
await list9(ctx, {
|
|
3376
3392
|
search: a.str("search"),
|
|
3377
3393
|
status: a.str("status")
|
|
@@ -3460,14 +3476,14 @@ var prerenderSpecs = {
|
|
|
3460
3476
|
}
|
|
3461
3477
|
};
|
|
3462
3478
|
async function prerenderInvalidate(ctx, a) {
|
|
3463
|
-
|
|
3479
|
+
printJson(
|
|
3464
3480
|
await invalidate(ctx, {
|
|
3465
3481
|
paths: a.bool("all") ? void 0 : a.rest("path")
|
|
3466
3482
|
})
|
|
3467
3483
|
);
|
|
3468
3484
|
}
|
|
3469
3485
|
async function prerenderGet(ctx, a) {
|
|
3470
|
-
const rawPath = a.
|
|
3486
|
+
const rawPath = a.required("path");
|
|
3471
3487
|
const normalized = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
|
|
3472
3488
|
const host = a.str("host")?.replace(/^https?:\/\//, "").replace(/\/+$/, "");
|
|
3473
3489
|
const origin = host ? `https://${host}` : new URL(await primaryUrl(ctx)).origin;
|
|
@@ -3484,16 +3500,16 @@ async function prerenderGet(ctx, a) {
|
|
|
3484
3500
|
);
|
|
3485
3501
|
const html = await res.text();
|
|
3486
3502
|
const result = { url, status: res.status, html };
|
|
3487
|
-
|
|
3503
|
+
printJson(result);
|
|
3488
3504
|
}
|
|
3489
3505
|
async function prerenderPages(ctx, a) {
|
|
3490
|
-
|
|
3506
|
+
printJson(await pages(ctx, { cursor: a.str("cursor") }));
|
|
3491
3507
|
}
|
|
3492
3508
|
async function prerenderView(ctx, a) {
|
|
3493
|
-
const rawPath = a.
|
|
3509
|
+
const rawPath = a.required("path");
|
|
3494
3510
|
const normalized = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
|
|
3495
3511
|
const host = a.str("host")?.replace(/^https?:\/\//, "").replace(/\/+$/, "");
|
|
3496
|
-
|
|
3512
|
+
printJson(await view(ctx, { path: normalized, host }));
|
|
3497
3513
|
}
|
|
3498
3514
|
var prerenderHandlers = {
|
|
3499
3515
|
"prerender invalidate": prerenderInvalidate,
|
|
@@ -3765,7 +3781,7 @@ async function refOf(ctx, a, key) {
|
|
|
3765
3781
|
return { store: storeOf(a), access: await readAccess(ctx, a, key), key };
|
|
3766
3782
|
}
|
|
3767
3783
|
async function filesPut(ctx, a) {
|
|
3768
|
-
const file = a.
|
|
3784
|
+
const file = a.required("file");
|
|
3769
3785
|
const abs = path2.isAbsolute(file) ? file : path2.join(WORKSPACE_DIR, file);
|
|
3770
3786
|
let bytes;
|
|
3771
3787
|
try {
|
|
@@ -3773,7 +3789,7 @@ async function filesPut(ctx, a) {
|
|
|
3773
3789
|
} catch (err) {
|
|
3774
3790
|
fatal(`Could not read file "${file}": ${err.message}`);
|
|
3775
3791
|
}
|
|
3776
|
-
|
|
3792
|
+
printJson(
|
|
3777
3793
|
await put(ctx, {
|
|
3778
3794
|
content: bytes,
|
|
3779
3795
|
store: storeOf(a),
|
|
@@ -3787,7 +3803,7 @@ async function filesPut(ctx, a) {
|
|
|
3787
3803
|
);
|
|
3788
3804
|
}
|
|
3789
3805
|
async function filesGet(ctx, a) {
|
|
3790
|
-
const key = a.
|
|
3806
|
+
const key = a.required("key");
|
|
3791
3807
|
const ref = await refOf(ctx, a, key);
|
|
3792
3808
|
const { url } = await sign(
|
|
3793
3809
|
ctx,
|
|
@@ -3806,18 +3822,18 @@ async function filesGet(ctx, a) {
|
|
|
3806
3822
|
Readable.fromWeb(res.body),
|
|
3807
3823
|
fs2.createWriteStream(abs)
|
|
3808
3824
|
);
|
|
3809
|
-
|
|
3825
|
+
printJson({ path: abs, size: fs2.statSync(abs).size });
|
|
3810
3826
|
}
|
|
3811
3827
|
async function filesSign(ctx, a) {
|
|
3812
|
-
|
|
3828
|
+
printJson(
|
|
3813
3829
|
await sign(ctx, await refOf(ctx, a, requireKeyFlag(a)), a.num("ttl"))
|
|
3814
3830
|
);
|
|
3815
3831
|
}
|
|
3816
3832
|
async function filesStat(ctx, a) {
|
|
3817
|
-
|
|
3833
|
+
printJson(await stat(ctx, await refOf(ctx, a, requireKeyFlag(a))));
|
|
3818
3834
|
}
|
|
3819
3835
|
async function filesLs(ctx, a) {
|
|
3820
|
-
|
|
3836
|
+
printJson(
|
|
3821
3837
|
await ls(ctx, {
|
|
3822
3838
|
store: storeOf(a),
|
|
3823
3839
|
access: await readAccess(ctx, a),
|
|
@@ -3829,7 +3845,7 @@ async function filesLs(ctx, a) {
|
|
|
3829
3845
|
);
|
|
3830
3846
|
}
|
|
3831
3847
|
async function filesList(ctx) {
|
|
3832
|
-
|
|
3848
|
+
printJson(await summary(ctx));
|
|
3833
3849
|
}
|
|
3834
3850
|
async function filesRm(ctx, a) {
|
|
3835
3851
|
const store = a.str("store");
|
|
@@ -3840,7 +3856,7 @@ async function filesRm(ctx, a) {
|
|
|
3840
3856
|
if (!key) {
|
|
3841
3857
|
fatal("--key is required.");
|
|
3842
3858
|
}
|
|
3843
|
-
|
|
3859
|
+
printJson(
|
|
3844
3860
|
await remove(ctx, {
|
|
3845
3861
|
store,
|
|
3846
3862
|
access: await readAccess(ctx, a, key),
|
|
@@ -4011,7 +4027,7 @@ async function waitForIngest(ctx, params) {
|
|
|
4011
4027
|
return {
|
|
4012
4028
|
status: "timeout",
|
|
4013
4029
|
documents: tracked.map(summarize),
|
|
4014
|
-
error:
|
|
4030
|
+
error: timeoutMessage(
|
|
4015
4031
|
timeoutMs,
|
|
4016
4032
|
`with ${pendingOf(tracked).length} document(s) still processing`
|
|
4017
4033
|
)
|
|
@@ -4055,7 +4071,7 @@ async function waitForCandidate(ctx, params) {
|
|
|
4055
4071
|
status: "timeout",
|
|
4056
4072
|
counts,
|
|
4057
4073
|
documents: failed,
|
|
4058
|
-
error:
|
|
4074
|
+
error: timeoutMessage(
|
|
4059
4075
|
timeoutMs,
|
|
4060
4076
|
`with ${counts?.processing ?? 0} document(s) still building`
|
|
4061
4077
|
)
|
|
@@ -4089,7 +4105,7 @@ async function allDocuments(ctx, params) {
|
|
|
4089
4105
|
{ length: Math.ceil(params.ids.length / DOCUMENTS_IDS_MAX) },
|
|
4090
4106
|
(_, i) => params.ids.slice(i * DOCUMENTS_IDS_MAX, (i + 1) * DOCUMENTS_IDS_MAX)
|
|
4091
4107
|
) : [void 0];
|
|
4092
|
-
const
|
|
4108
|
+
const out = [];
|
|
4093
4109
|
for (const ids of groups) {
|
|
4094
4110
|
let cursor;
|
|
4095
4111
|
do {
|
|
@@ -4103,11 +4119,11 @@ async function allDocuments(ctx, params) {
|
|
|
4103
4119
|
status: params.status,
|
|
4104
4120
|
filename: params.filename
|
|
4105
4121
|
});
|
|
4106
|
-
|
|
4122
|
+
out.push(...page.documents ?? []);
|
|
4107
4123
|
cursor = page.nextCursor ?? void 0;
|
|
4108
4124
|
} while (cursor);
|
|
4109
4125
|
}
|
|
4110
|
-
return
|
|
4126
|
+
return out;
|
|
4111
4127
|
}
|
|
4112
4128
|
function list10(ctx) {
|
|
4113
4129
|
return call(ctx, "GET", base(ctx.appId));
|
|
@@ -4254,7 +4270,7 @@ async function waitForMove(ctx, params) {
|
|
|
4254
4270
|
return {
|
|
4255
4271
|
status: "timeout",
|
|
4256
4272
|
source,
|
|
4257
|
-
error:
|
|
4273
|
+
error: timeoutMessage(
|
|
4258
4274
|
timeoutMs,
|
|
4259
4275
|
`with ${migration.copied}/${migration.total} documents copied`
|
|
4260
4276
|
)
|
|
@@ -4288,7 +4304,7 @@ function promote(ctx, params) {
|
|
|
4288
4304
|
}
|
|
4289
4305
|
);
|
|
4290
4306
|
}
|
|
4291
|
-
function
|
|
4307
|
+
function dropPipelineVersion(ctx, params) {
|
|
4292
4308
|
return call(
|
|
4293
4309
|
ctx,
|
|
4294
4310
|
"POST",
|
|
@@ -4299,7 +4315,7 @@ function drop(ctx, params) {
|
|
|
4299
4315
|
}
|
|
4300
4316
|
);
|
|
4301
4317
|
}
|
|
4302
|
-
function
|
|
4318
|
+
function deleteDocument(ctx, params) {
|
|
4303
4319
|
return call(
|
|
4304
4320
|
ctx,
|
|
4305
4321
|
"POST",
|
|
@@ -4310,7 +4326,7 @@ function rm(ctx, params) {
|
|
|
4310
4326
|
}
|
|
4311
4327
|
);
|
|
4312
4328
|
}
|
|
4313
|
-
function
|
|
4329
|
+
function deleteDocumentsWhere(ctx, params) {
|
|
4314
4330
|
return call(
|
|
4315
4331
|
ctx,
|
|
4316
4332
|
"POST",
|
|
@@ -4318,10 +4334,10 @@ function rmWhere(ctx, params) {
|
|
|
4318
4334
|
{ slug: params.slug, filter: params.filter }
|
|
4319
4335
|
);
|
|
4320
4336
|
}
|
|
4321
|
-
async function
|
|
4337
|
+
async function deleteAllDocumentsWhere(ctx, params) {
|
|
4322
4338
|
let deleted = 0;
|
|
4323
4339
|
while (true) {
|
|
4324
|
-
const page = await
|
|
4340
|
+
const page = await deleteDocumentsWhere(ctx, params);
|
|
4325
4341
|
deleted += page.deleted;
|
|
4326
4342
|
if (page.remaining === 0 || page.deleted === 0) {
|
|
4327
4343
|
return { deleted };
|
|
@@ -4517,7 +4533,7 @@ async function settle(ctx, params, isSettled) {
|
|
|
4517
4533
|
return {
|
|
4518
4534
|
status: "timeout",
|
|
4519
4535
|
job,
|
|
4520
|
-
error:
|
|
4536
|
+
error: timeoutMessage(timeoutMs, `; job is still ${job.state}`)
|
|
4521
4537
|
};
|
|
4522
4538
|
}
|
|
4523
4539
|
if (job.state === "failed" || job.state === "cancelled") {
|
|
@@ -4595,7 +4611,7 @@ var timeoutOf = (a) => {
|
|
|
4595
4611
|
const seconds = a.str("timeout");
|
|
4596
4612
|
return seconds ? { timeoutMs: Number(seconds) * 1e3 } : {};
|
|
4597
4613
|
};
|
|
4598
|
-
function
|
|
4614
|
+
function throwIfWaitFailed(result) {
|
|
4599
4615
|
if (result.status === "timeout") {
|
|
4600
4616
|
throw new CliError(result.error ?? "Timed out.", EXIT.timeout);
|
|
4601
4617
|
}
|
|
@@ -4612,8 +4628,8 @@ function failOnWait(result) {
|
|
|
4612
4628
|
async function waitAndReport(ctx, a, id, mode, summary4) {
|
|
4613
4629
|
const wait = mode === "plan" ? waitForPlan : waitForJob;
|
|
4614
4630
|
const result = await wait(ctx, { id, ...timeoutOf(a), onProgress: progress });
|
|
4615
|
-
|
|
4616
|
-
|
|
4631
|
+
printJson({ ...summary4, ...result });
|
|
4632
|
+
throwIfWaitFailed(result);
|
|
4617
4633
|
}
|
|
4618
4634
|
|
|
4619
4635
|
// src/ops/dataSourceConnectors.ts
|
|
@@ -4748,7 +4764,7 @@ async function connect2(ctx, a) {
|
|
|
4748
4764
|
...deletions ? { deletions } : {},
|
|
4749
4765
|
...budget !== void 0 ? { budgetDollarsPerSync: budget } : {}
|
|
4750
4766
|
});
|
|
4751
|
-
|
|
4767
|
+
printJson({
|
|
4752
4768
|
dataSource: slug,
|
|
4753
4769
|
connector,
|
|
4754
4770
|
note: "Connected. Run `datasources sync --source " + slug + " --wait` to load the bucket; the first sync plans first and stops for `datasources jobs approve <id>` when the plan is over the per-sync budget."
|
|
@@ -4756,7 +4772,7 @@ async function connect2(ctx, a) {
|
|
|
4756
4772
|
}
|
|
4757
4773
|
async function show(ctx, a) {
|
|
4758
4774
|
const slug = sourceOf(a);
|
|
4759
|
-
|
|
4775
|
+
printJson({ dataSource: slug, ...await get7(ctx, { slug }) });
|
|
4760
4776
|
}
|
|
4761
4777
|
async function disconnect2(ctx, a) {
|
|
4762
4778
|
const slug = a.str("source");
|
|
@@ -4766,7 +4782,7 @@ async function disconnect2(ctx, a) {
|
|
|
4766
4782
|
);
|
|
4767
4783
|
}
|
|
4768
4784
|
const result = await disconnect(ctx, { slug });
|
|
4769
|
-
|
|
4785
|
+
printJson({
|
|
4770
4786
|
dataSource: slug,
|
|
4771
4787
|
...result,
|
|
4772
4788
|
note: "The documents stay. Connect again to follow a bucket; unchanged files are recognised by content and cost nothing to re-sync."
|
|
@@ -4785,7 +4801,7 @@ async function sync2(ctx, a) {
|
|
|
4785
4801
|
...a.bool("priority") ? { priority: true } : {}
|
|
4786
4802
|
});
|
|
4787
4803
|
if (!a.bool("wait")) {
|
|
4788
|
-
|
|
4804
|
+
printJson({
|
|
4789
4805
|
dataSource: slug,
|
|
4790
4806
|
job,
|
|
4791
4807
|
note: "Syncing. Poll `datasources jobs status <id>`, or re-run with --wait. A plan over the per-sync budget waits in `planned` for `datasources jobs approve <id>`."
|
|
@@ -4892,7 +4908,7 @@ async function waitForHydration(ctx, params) {
|
|
|
4892
4908
|
return {
|
|
4893
4909
|
status: "timeout",
|
|
4894
4910
|
source,
|
|
4895
|
-
error:
|
|
4911
|
+
error: timeoutMessage(
|
|
4896
4912
|
timeoutMs,
|
|
4897
4913
|
`with ${hydration.copied}/${hydration.total} documents loaded`
|
|
4898
4914
|
)
|
|
@@ -5029,7 +5045,7 @@ async function waitForRun(ctx, params) {
|
|
|
5029
5045
|
return {
|
|
5030
5046
|
status: "timeout",
|
|
5031
5047
|
run: run3,
|
|
5032
|
-
error:
|
|
5048
|
+
error: timeoutMessage(
|
|
5033
5049
|
timeoutMs,
|
|
5034
5050
|
`; run is ${run3.state} (${run3.completed}/${run3.total})`
|
|
5035
5051
|
)
|
|
@@ -5057,7 +5073,7 @@ async function waitForSet(ctx, params) {
|
|
|
5057
5073
|
return {
|
|
5058
5074
|
status: "timeout",
|
|
5059
5075
|
set: set3,
|
|
5060
|
-
error:
|
|
5076
|
+
error: timeoutMessage(timeoutMs, `; set is still ${set3.state}`)
|
|
5061
5077
|
};
|
|
5062
5078
|
}
|
|
5063
5079
|
if (set3.state === "failed") {
|
|
@@ -5245,7 +5261,7 @@ async function hydrate2(ctx, a) {
|
|
|
5245
5261
|
const slug = a.str("source") || DEFAULT_SOURCE;
|
|
5246
5262
|
const started = await hydrate(ctx, { slug });
|
|
5247
5263
|
if (started.resident || !a.bool("wait")) {
|
|
5248
|
-
|
|
5264
|
+
printJson({
|
|
5249
5265
|
dataSource: slug,
|
|
5250
5266
|
...started,
|
|
5251
5267
|
...started.resident ? { note: "The index is already loaded." } : {
|
|
@@ -5259,14 +5275,14 @@ async function hydrate2(ctx, a) {
|
|
|
5259
5275
|
...timeoutOf(a),
|
|
5260
5276
|
onProgress: progress
|
|
5261
5277
|
});
|
|
5262
|
-
|
|
5263
|
-
|
|
5278
|
+
printJson({ dataSource: slug, action: "hydrate", ...result });
|
|
5279
|
+
throwIfWaitFailed(result);
|
|
5264
5280
|
}
|
|
5265
5281
|
async function reindex2(ctx, a) {
|
|
5266
5282
|
const slug = a.str("source") || DEFAULT_SOURCE;
|
|
5267
5283
|
const started = await reindex(ctx, { slug });
|
|
5268
5284
|
if (!a.bool("wait")) {
|
|
5269
|
-
|
|
5285
|
+
printJson({
|
|
5270
5286
|
dataSource: slug,
|
|
5271
5287
|
...started,
|
|
5272
5288
|
note: "The collection was recreated and is refilling from stored vectors in the background. `datasources list` shows progress; re-run with --wait to block."
|
|
@@ -5278,8 +5294,8 @@ async function reindex2(ctx, a) {
|
|
|
5278
5294
|
...timeoutOf(a),
|
|
5279
5295
|
onProgress: progress
|
|
5280
5296
|
});
|
|
5281
|
-
|
|
5282
|
-
|
|
5297
|
+
printJson({ dataSource: slug, action: "reindex", ...result });
|
|
5298
|
+
throwIfWaitFailed(result);
|
|
5283
5299
|
}
|
|
5284
5300
|
async function sampleCmd(ctx, a) {
|
|
5285
5301
|
const slug = a.str("source");
|
|
@@ -5297,7 +5313,7 @@ async function sampleCmd(ctx, a) {
|
|
|
5297
5313
|
...placement !== void 0 ? { placement } : {}
|
|
5298
5314
|
});
|
|
5299
5315
|
if (!a.bool("wait")) {
|
|
5300
|
-
|
|
5316
|
+
printJson({
|
|
5301
5317
|
...result,
|
|
5302
5318
|
note: `Sampling into "${result.dataSource.slug}". Poll \`datasources jobs status ${result.job.id}\` or re-run with --wait.`
|
|
5303
5319
|
});
|
|
@@ -5328,7 +5344,7 @@ async function evalCreate(ctx, a) {
|
|
|
5328
5344
|
});
|
|
5329
5345
|
const generating = set3.state === "queued" || set3.state === "generating";
|
|
5330
5346
|
if (!generating || !a.bool("wait")) {
|
|
5331
|
-
|
|
5347
|
+
printJson({
|
|
5332
5348
|
dataSource: slug,
|
|
5333
5349
|
set: set3,
|
|
5334
5350
|
note: generating ? "Generating in the background. `datasources eval get <id>` shows the state; re-run with --wait to block." : "Empty set. Add queries with `datasources eval add` or `eval import`."
|
|
@@ -5340,23 +5356,23 @@ async function evalCreate(ctx, a) {
|
|
|
5340
5356
|
...timeoutOf(a),
|
|
5341
5357
|
onProgress: progress
|
|
5342
5358
|
});
|
|
5343
|
-
|
|
5344
|
-
|
|
5359
|
+
printJson({ dataSource: slug, action: "create", ...result });
|
|
5360
|
+
throwIfWaitFailed(result);
|
|
5345
5361
|
}
|
|
5346
5362
|
async function evalList(ctx, a) {
|
|
5347
5363
|
const slug = a.str("source");
|
|
5348
|
-
|
|
5364
|
+
printJson(await listSets(ctx, slug ? { slug } : void 0));
|
|
5349
5365
|
}
|
|
5350
5366
|
async function evalGet(ctx, a) {
|
|
5351
|
-
|
|
5367
|
+
printJson(
|
|
5352
5368
|
await getSet(ctx, {
|
|
5353
|
-
id: a.
|
|
5369
|
+
id: a.required("id"),
|
|
5354
5370
|
...a.bool("queries") ? { queries: true } : {}
|
|
5355
5371
|
})
|
|
5356
5372
|
);
|
|
5357
5373
|
}
|
|
5358
5374
|
async function evalDelete(ctx, a) {
|
|
5359
|
-
|
|
5375
|
+
printJson(await deleteSet(ctx, { id: a.required("id") }));
|
|
5360
5376
|
}
|
|
5361
5377
|
function expectFromFlags(a) {
|
|
5362
5378
|
const expect = {};
|
|
@@ -5394,11 +5410,11 @@ async function evalAdd(ctx, a) {
|
|
|
5394
5410
|
}
|
|
5395
5411
|
]
|
|
5396
5412
|
});
|
|
5397
|
-
|
|
5413
|
+
printJson({ set: id, ...result });
|
|
5398
5414
|
}
|
|
5399
5415
|
async function evalImport(ctx, a) {
|
|
5400
5416
|
const id = requireSet(a);
|
|
5401
|
-
const file = a.
|
|
5417
|
+
const file = a.required("file");
|
|
5402
5418
|
const abs = path3.isAbsolute(file) ? file : path3.join(WORKSPACE_DIR, file);
|
|
5403
5419
|
let content;
|
|
5404
5420
|
try {
|
|
@@ -5439,16 +5455,16 @@ async function evalImport(ctx, a) {
|
|
|
5439
5455
|
added += result.added;
|
|
5440
5456
|
queryCount = result.queryCount;
|
|
5441
5457
|
}
|
|
5442
|
-
|
|
5458
|
+
printJson({ set: id, added, queryCount });
|
|
5443
5459
|
}
|
|
5444
5460
|
async function evalQueries(ctx, a) {
|
|
5445
|
-
|
|
5461
|
+
printJson(await listQueries(ctx, { id: requireSet(a) }));
|
|
5446
5462
|
}
|
|
5447
5463
|
async function evalRm(ctx, a) {
|
|
5448
|
-
|
|
5464
|
+
printJson(
|
|
5449
5465
|
await deleteQuery(ctx, {
|
|
5450
5466
|
id: requireSet(a),
|
|
5451
|
-
queryId: a.
|
|
5467
|
+
queryId: a.required("queryId")
|
|
5452
5468
|
})
|
|
5453
5469
|
);
|
|
5454
5470
|
}
|
|
@@ -5482,7 +5498,7 @@ async function evalRun(ctx, a) {
|
|
|
5482
5498
|
retrieval
|
|
5483
5499
|
});
|
|
5484
5500
|
if (!a.bool("wait")) {
|
|
5485
|
-
|
|
5501
|
+
printJson({
|
|
5486
5502
|
run: run3,
|
|
5487
5503
|
note: "Running in the background. `datasources eval result <id>` shows the numbers when it is done; re-run with --wait to block."
|
|
5488
5504
|
});
|
|
@@ -5493,13 +5509,13 @@ async function evalRun(ctx, a) {
|
|
|
5493
5509
|
...timeoutOf(a),
|
|
5494
5510
|
onProgress: progress
|
|
5495
5511
|
});
|
|
5496
|
-
|
|
5497
|
-
|
|
5512
|
+
printJson({ action: "run", ...result });
|
|
5513
|
+
throwIfWaitFailed(result);
|
|
5498
5514
|
}
|
|
5499
5515
|
async function evalRuns(ctx, a) {
|
|
5500
5516
|
const setId = a.str("set");
|
|
5501
5517
|
const slug = a.str("source");
|
|
5502
|
-
|
|
5518
|
+
printJson(
|
|
5503
5519
|
await listRuns(ctx, {
|
|
5504
5520
|
...setId ? { setId } : {},
|
|
5505
5521
|
...slug ? { slug } : {}
|
|
@@ -5508,16 +5524,18 @@ async function evalRuns(ctx, a) {
|
|
|
5508
5524
|
}
|
|
5509
5525
|
async function evalResult(ctx, a) {
|
|
5510
5526
|
const worst = a.num("worst");
|
|
5511
|
-
|
|
5527
|
+
printJson(
|
|
5512
5528
|
await getRun(ctx, {
|
|
5513
|
-
id: a.
|
|
5529
|
+
id: a.required("id"),
|
|
5514
5530
|
...a.bool("queries") ? { queries: true } : {},
|
|
5515
5531
|
...worst !== void 0 ? { worst } : {}
|
|
5516
5532
|
})
|
|
5517
5533
|
);
|
|
5518
5534
|
}
|
|
5519
5535
|
async function evalCompare(ctx, a) {
|
|
5520
|
-
|
|
5536
|
+
printJson(
|
|
5537
|
+
await compare(ctx, { a: a.required("a"), b: a.required("b") })
|
|
5538
|
+
);
|
|
5521
5539
|
}
|
|
5522
5540
|
var dataSourceEvalsHandlers = {
|
|
5523
5541
|
"datasources hydrate": hydrate2,
|
|
@@ -5663,9 +5681,9 @@ function readEntries(file) {
|
|
|
5663
5681
|
return entries;
|
|
5664
5682
|
}
|
|
5665
5683
|
async function dictionaryPush(ctx, a) {
|
|
5666
|
-
const entries = readEntries(a.
|
|
5684
|
+
const entries = readEntries(a.required("file"));
|
|
5667
5685
|
const linkerVersion = a.num("linker-version");
|
|
5668
|
-
|
|
5686
|
+
printJson(
|
|
5669
5687
|
await pushDictionary(ctx, {
|
|
5670
5688
|
slug: sourceOf(a),
|
|
5671
5689
|
entries,
|
|
@@ -5675,10 +5693,15 @@ async function dictionaryPush(ctx, a) {
|
|
|
5675
5693
|
);
|
|
5676
5694
|
}
|
|
5677
5695
|
async function dictionaryStatus(ctx, a) {
|
|
5678
|
-
|
|
5696
|
+
printJson(await dictionary(ctx, { slug: sourceOf(a) }));
|
|
5679
5697
|
}
|
|
5680
5698
|
async function link2(ctx, a) {
|
|
5681
|
-
|
|
5699
|
+
printJson(
|
|
5700
|
+
await link(ctx, {
|
|
5701
|
+
slug: sourceOf(a),
|
|
5702
|
+
text: a.required("text")
|
|
5703
|
+
})
|
|
5704
|
+
);
|
|
5682
5705
|
}
|
|
5683
5706
|
var dataSourceDictionaryHandlers = {
|
|
5684
5707
|
"datasources dictionary push": dictionaryPush,
|
|
@@ -5830,7 +5853,7 @@ async function jobsStart(ctx, a) {
|
|
|
5830
5853
|
...limit !== void 0 ? { limit } : {}
|
|
5831
5854
|
});
|
|
5832
5855
|
if (!a.bool("wait")) {
|
|
5833
|
-
|
|
5856
|
+
printJson({
|
|
5834
5857
|
dataSource: slug,
|
|
5835
5858
|
job,
|
|
5836
5859
|
note: job.autoApprove ? "Planning, then running once the plan passes the gates. Poll `datasources jobs status <id>` or re-run with --wait." : "Planning. When the plan is ready, review it with `datasources jobs status <id>` and run `datasources jobs approve <id>`."
|
|
@@ -5845,18 +5868,18 @@ async function jobsStart(ctx, a) {
|
|
|
5845
5868
|
}
|
|
5846
5869
|
async function jobsList(ctx, a) {
|
|
5847
5870
|
const slug = a.str("source");
|
|
5848
|
-
|
|
5871
|
+
printJson(await list11(ctx, slug ? { slug } : void 0));
|
|
5849
5872
|
}
|
|
5850
5873
|
async function jobsStatus(ctx, a) {
|
|
5851
|
-
const id = a.
|
|
5874
|
+
const id = a.required("id");
|
|
5852
5875
|
if (!a.bool("wait")) {
|
|
5853
|
-
|
|
5876
|
+
printJson(await get6(ctx, { id }));
|
|
5854
5877
|
return;
|
|
5855
5878
|
}
|
|
5856
5879
|
await waitAndReport(ctx, a, id, "job", { action: "status" });
|
|
5857
5880
|
}
|
|
5858
5881
|
async function jobsApprove(ctx, a) {
|
|
5859
|
-
const id = a.
|
|
5882
|
+
const id = a.required("id");
|
|
5860
5883
|
const concurrency = a.num("concurrency");
|
|
5861
5884
|
const { job } = await approve(ctx, {
|
|
5862
5885
|
id,
|
|
@@ -5864,7 +5887,7 @@ async function jobsApprove(ctx, a) {
|
|
|
5864
5887
|
...a.bool("priority") ? { priority: true } : {}
|
|
5865
5888
|
});
|
|
5866
5889
|
if (!a.bool("wait")) {
|
|
5867
|
-
|
|
5890
|
+
printJson({
|
|
5868
5891
|
job,
|
|
5869
5892
|
note: "Running. Poll `datasources jobs status <id>` or re-run with --wait."
|
|
5870
5893
|
});
|
|
@@ -5873,10 +5896,10 @@ async function jobsApprove(ctx, a) {
|
|
|
5873
5896
|
await waitAndReport(ctx, a, id, "job", { action: "approve" });
|
|
5874
5897
|
}
|
|
5875
5898
|
async function jobsPause(ctx, a) {
|
|
5876
|
-
|
|
5899
|
+
printJson(await pause(ctx, { id: a.required("id") }));
|
|
5877
5900
|
}
|
|
5878
5901
|
async function jobsResume(ctx, a) {
|
|
5879
|
-
const id = a.
|
|
5902
|
+
const id = a.required("id");
|
|
5880
5903
|
const concurrency = a.num("concurrency");
|
|
5881
5904
|
const { job } = await resume(ctx, {
|
|
5882
5905
|
id,
|
|
@@ -5884,22 +5907,22 @@ async function jobsResume(ctx, a) {
|
|
|
5884
5907
|
...a.bool("priority") ? { priority: true } : {}
|
|
5885
5908
|
});
|
|
5886
5909
|
if (!a.bool("wait")) {
|
|
5887
|
-
|
|
5910
|
+
printJson({ job });
|
|
5888
5911
|
return;
|
|
5889
5912
|
}
|
|
5890
5913
|
await waitAndReport(ctx, a, id, "job", { action: "resume" });
|
|
5891
5914
|
}
|
|
5892
5915
|
async function jobsRetry(ctx, a) {
|
|
5893
|
-
const id = a.
|
|
5916
|
+
const id = a.required("id");
|
|
5894
5917
|
const { job } = await retry(ctx, { id });
|
|
5895
5918
|
if (!a.bool("wait")) {
|
|
5896
|
-
|
|
5919
|
+
printJson({ job });
|
|
5897
5920
|
return;
|
|
5898
5921
|
}
|
|
5899
5922
|
await waitAndReport(ctx, a, id, "job", { action: "retry" });
|
|
5900
5923
|
}
|
|
5901
5924
|
async function jobsCancel(ctx, a) {
|
|
5902
|
-
|
|
5925
|
+
printJson(await cancel(ctx, { id: a.required("id") }));
|
|
5903
5926
|
}
|
|
5904
5927
|
var dataSourceJobsHandlers = {
|
|
5905
5928
|
"datasources jobs start": jobsStart,
|
|
@@ -6183,7 +6206,7 @@ async function inspect2(ctx, a) {
|
|
|
6183
6206
|
...keysOf(a) ? { keys: keysOf(a) } : {},
|
|
6184
6207
|
...limit !== void 0 ? { limit } : {}
|
|
6185
6208
|
});
|
|
6186
|
-
|
|
6209
|
+
printJson({
|
|
6187
6210
|
...slug ? { dataSource: slug } : {},
|
|
6188
6211
|
...result,
|
|
6189
6212
|
note: result.report.truncated ? `Listed the first ${result.report.objects.toLocaleString()} objects; raise --limit to see more of the shape.` : `Listed every object (${result.report.objects.toLocaleString()}).`
|
|
@@ -6212,7 +6235,7 @@ async function mapTest2(ctx, a) {
|
|
|
6212
6235
|
}
|
|
6213
6236
|
} : r
|
|
6214
6237
|
);
|
|
6215
|
-
|
|
6238
|
+
printJson({
|
|
6216
6239
|
dataSource: slug,
|
|
6217
6240
|
...result,
|
|
6218
6241
|
results,
|
|
@@ -6234,7 +6257,7 @@ async function mapDeploy2(ctx, a) {
|
|
|
6234
6257
|
});
|
|
6235
6258
|
const { mapper } = result;
|
|
6236
6259
|
const from = `${mapper.branch ?? "release"} @ ${(mapper.commitSha ?? "").slice(0, 7)}`;
|
|
6237
|
-
|
|
6260
|
+
printJson({
|
|
6238
6261
|
dataSource: slug,
|
|
6239
6262
|
mapper,
|
|
6240
6263
|
changed: result.changed,
|
|
@@ -6251,7 +6274,7 @@ async function remap2(ctx, a) {
|
|
|
6251
6274
|
...limit !== void 0 ? { limit } : {}
|
|
6252
6275
|
});
|
|
6253
6276
|
if (!a.bool("wait")) {
|
|
6254
|
-
|
|
6277
|
+
printJson({
|
|
6255
6278
|
dataSource: slug,
|
|
6256
6279
|
job,
|
|
6257
6280
|
mapper,
|
|
@@ -6266,7 +6289,7 @@ async function remap2(ctx, a) {
|
|
|
6266
6289
|
});
|
|
6267
6290
|
}
|
|
6268
6291
|
async function quarantine2(ctx, a) {
|
|
6269
|
-
const id = a.
|
|
6292
|
+
const id = a.required("id");
|
|
6270
6293
|
const limit = a.num("limit");
|
|
6271
6294
|
const kind = kindOf(a);
|
|
6272
6295
|
const stage = a.str("stage");
|
|
@@ -6292,20 +6315,20 @@ async function quarantine2(ctx, a) {
|
|
|
6292
6315
|
`Reading: fix the reader and publish, then \`datasources reader retry --source ${result.dataSource.slug} --job ${id}\` reads these again.`
|
|
6293
6316
|
] : []
|
|
6294
6317
|
];
|
|
6295
|
-
|
|
6318
|
+
printJson({
|
|
6296
6319
|
...result,
|
|
6297
6320
|
note: notes.length === 0 ? "Nothing quarantined: the mapper produced documents (or deletions) for every object, and the reader read every document." : notes.join(" ")
|
|
6298
6321
|
});
|
|
6299
6322
|
}
|
|
6300
6323
|
async function replay2(ctx, a) {
|
|
6301
|
-
const id = a.
|
|
6324
|
+
const id = a.required("id");
|
|
6302
6325
|
const kind = kindOf(a);
|
|
6303
6326
|
const { job, mapper, dataSource } = await replay(ctx, {
|
|
6304
6327
|
id,
|
|
6305
6328
|
...kind ? { kind } : {}
|
|
6306
6329
|
});
|
|
6307
6330
|
if (!a.bool("wait")) {
|
|
6308
|
-
|
|
6331
|
+
printJson({
|
|
6309
6332
|
dataSource: dataSource.slug,
|
|
6310
6333
|
fromJob: id,
|
|
6311
6334
|
job,
|
|
@@ -6495,7 +6518,7 @@ async function readerTest2(ctx, a) {
|
|
|
6495
6518
|
...limit !== void 0 ? { limit } : {},
|
|
6496
6519
|
...a.str("release") ? { releaseId: a.str("release") } : {}
|
|
6497
6520
|
});
|
|
6498
|
-
|
|
6521
|
+
printJson({
|
|
6499
6522
|
dataSource: slug,
|
|
6500
6523
|
...result,
|
|
6501
6524
|
note: "Ran the LOCAL reader through the dev session, writing into the dev session's database. Query its tables to check what it wrote; publish to make it the live reader, then `datasources reread --unread` reads what it has not."
|
|
@@ -6511,7 +6534,7 @@ async function readerStatus2(ctx, a) {
|
|
|
6511
6534
|
const slug = sourceOf(a);
|
|
6512
6535
|
const result = await readerStatus(ctx, { slug });
|
|
6513
6536
|
const { reader, deliveries, documents: documents2 } = result;
|
|
6514
|
-
|
|
6537
|
+
printJson({
|
|
6515
6538
|
dataSource: slug,
|
|
6516
6539
|
...result,
|
|
6517
6540
|
note: !reader ? `The live release declares no reader for "${slug}". Declare one in mindstudio.json's dataSources and publish.` : deliveries.parked > 0 ? `${deliveries.parked} delivery(ies) failed six times and parked. Fix the reader and publish, then \`datasources reader retry\`.` : documents2.unread > 0 ? `${documents2.unread.toLocaleString()} live document(s) not read yet. \`datasources reread --unread\` plans reading them.` : "Every live document has been read."
|
|
@@ -6524,7 +6547,7 @@ async function readerRetry2(ctx, a) {
|
|
|
6524
6547
|
slug,
|
|
6525
6548
|
...jobId ? { jobId } : {}
|
|
6526
6549
|
});
|
|
6527
|
-
|
|
6550
|
+
printJson({
|
|
6528
6551
|
dataSource: slug,
|
|
6529
6552
|
...jobId ? { job: jobId } : {},
|
|
6530
6553
|
...result,
|
|
@@ -6544,7 +6567,7 @@ async function reread2(ctx, a) {
|
|
|
6544
6567
|
...limit !== void 0 ? { limit } : {}
|
|
6545
6568
|
});
|
|
6546
6569
|
if (!a.bool("wait")) {
|
|
6547
|
-
|
|
6570
|
+
printJson({
|
|
6548
6571
|
dataSource: slug,
|
|
6549
6572
|
job,
|
|
6550
6573
|
note: `Planning: the reread prices reading from the reader's history, or reads a first slice for real to measure it. \`datasources jobs status ${job.id}\` shows the plan; \`datasources jobs approve ${job.id}\` runs it.`
|
|
@@ -6840,7 +6863,7 @@ async function dataSourcesAdd(ctx, a) {
|
|
|
6840
6863
|
timeoutMs,
|
|
6841
6864
|
onProgress: progress
|
|
6842
6865
|
});
|
|
6843
|
-
|
|
6866
|
+
printJson({
|
|
6844
6867
|
dataSource: slug,
|
|
6845
6868
|
status: result.status,
|
|
6846
6869
|
...result.error ? { error: result.error } : {},
|
|
@@ -6855,14 +6878,14 @@ async function dataSourcesAdd(ctx, a) {
|
|
|
6855
6878
|
}
|
|
6856
6879
|
return;
|
|
6857
6880
|
}
|
|
6858
|
-
|
|
6881
|
+
printJson({
|
|
6859
6882
|
dataSource: slug,
|
|
6860
6883
|
documents: results.map(({ job, ...r }) => r),
|
|
6861
6884
|
...jobs.length > 0 ? { jobs } : {}
|
|
6862
6885
|
});
|
|
6863
6886
|
}
|
|
6864
6887
|
async function dataSourcesList(ctx) {
|
|
6865
|
-
|
|
6888
|
+
printJson(await list10(ctx));
|
|
6866
6889
|
}
|
|
6867
6890
|
async function dataSourcesStatus(ctx, a) {
|
|
6868
6891
|
const slug = sourceOf(a);
|
|
@@ -6875,7 +6898,7 @@ async function dataSourcesStatus(ctx, a) {
|
|
|
6875
6898
|
slug,
|
|
6876
6899
|
...status2 ? { status: "error" } : {}
|
|
6877
6900
|
});
|
|
6878
|
-
|
|
6901
|
+
printJson({
|
|
6879
6902
|
dataSource: slug,
|
|
6880
6903
|
documents: documents2.map(summarize)
|
|
6881
6904
|
});
|
|
@@ -6884,7 +6907,7 @@ async function dataSourcesStatus(ctx, a) {
|
|
|
6884
6907
|
const { dataSources: sources2 } = await list10(ctx);
|
|
6885
6908
|
const source = sources2.find((s) => s.slug === slug);
|
|
6886
6909
|
if (!source) {
|
|
6887
|
-
|
|
6910
|
+
printJson({ dataSource: slug, exists: false });
|
|
6888
6911
|
return;
|
|
6889
6912
|
}
|
|
6890
6913
|
const failures = status2 === "error" || source.counts.error > 0 ? await documents(ctx, {
|
|
@@ -6892,7 +6915,7 @@ async function dataSourcesStatus(ctx, a) {
|
|
|
6892
6915
|
status: "error",
|
|
6893
6916
|
limit: FAILURES_PAGE
|
|
6894
6917
|
}) : null;
|
|
6895
|
-
|
|
6918
|
+
printJson({
|
|
6896
6919
|
dataSource: slug,
|
|
6897
6920
|
counts: source.counts,
|
|
6898
6921
|
chunkCount: source.chunkCount,
|
|
@@ -6912,18 +6935,18 @@ async function dataSourcesRm(ctx, a) {
|
|
|
6912
6935
|
fatal("Give --document or --filter, not both.");
|
|
6913
6936
|
}
|
|
6914
6937
|
if (documentId) {
|
|
6915
|
-
await
|
|
6916
|
-
|
|
6938
|
+
await deleteDocument(ctx, { slug: sourceOf(a), documentId });
|
|
6939
|
+
printJson({ deleted: documentId });
|
|
6917
6940
|
return;
|
|
6918
6941
|
}
|
|
6919
6942
|
const filter = documentSelectorOf(rawFilter);
|
|
6920
6943
|
const slug = sourceOf(a);
|
|
6921
|
-
const result = await
|
|
6944
|
+
const result = await deleteAllDocumentsWhere(ctx, {
|
|
6922
6945
|
slug,
|
|
6923
6946
|
filter,
|
|
6924
6947
|
onProgress: progress
|
|
6925
6948
|
});
|
|
6926
|
-
|
|
6949
|
+
printJson({ dataSource: slug, filter, ...result });
|
|
6927
6950
|
}
|
|
6928
6951
|
async function dataSourcesDelete(ctx, a) {
|
|
6929
6952
|
const slug = a.str("source");
|
|
@@ -6933,7 +6956,7 @@ async function dataSourcesDelete(ctx, a) {
|
|
|
6933
6956
|
);
|
|
6934
6957
|
}
|
|
6935
6958
|
const result = await deleteSource(ctx, slug);
|
|
6936
|
-
|
|
6959
|
+
printJson({ dataSource: slug, ...result });
|
|
6937
6960
|
}
|
|
6938
6961
|
async function dataSourcesSearch(ctx, a) {
|
|
6939
6962
|
const topK = a.num("top-k");
|
|
@@ -6947,10 +6970,10 @@ async function dataSourcesSearch(ctx, a) {
|
|
|
6947
6970
|
}
|
|
6948
6971
|
const filter = filterFromFlags(a);
|
|
6949
6972
|
const maxPerDocument = a.num("max-per-document");
|
|
6950
|
-
|
|
6973
|
+
printJson(
|
|
6951
6974
|
await search2(ctx, {
|
|
6952
6975
|
slug: sourceOf(a),
|
|
6953
|
-
query: a.
|
|
6976
|
+
query: a.required("query"),
|
|
6954
6977
|
...topK ? { topK } : {},
|
|
6955
6978
|
...mode ? { mode } : {},
|
|
6956
6979
|
...filter ? { filter } : {},
|
|
@@ -6963,7 +6986,7 @@ async function dataSourcesSearch(ctx, a) {
|
|
|
6963
6986
|
}
|
|
6964
6987
|
async function dataSourcesCount(ctx, a) {
|
|
6965
6988
|
const filter = filterFromFlags(a);
|
|
6966
|
-
|
|
6989
|
+
printJson(
|
|
6967
6990
|
await count(ctx, {
|
|
6968
6991
|
slug: sourceOf(a),
|
|
6969
6992
|
...filter ? { filter } : {},
|
|
@@ -6974,7 +6997,7 @@ async function dataSourcesCount(ctx, a) {
|
|
|
6974
6997
|
async function dataSourcesEntities(ctx, a) {
|
|
6975
6998
|
const filter = filterFromFlags(a);
|
|
6976
6999
|
const limit = a.num("limit");
|
|
6977
|
-
|
|
7000
|
+
printJson(
|
|
6978
7001
|
await entities(ctx, {
|
|
6979
7002
|
slug: sourceOf(a),
|
|
6980
7003
|
...filter ? { filter } : {},
|
|
@@ -6994,7 +7017,7 @@ async function dataSourcesPassages(ctx, a) {
|
|
|
6994
7017
|
...limit !== void 0 ? { limit } : {},
|
|
6995
7018
|
...a.bool("candidate") ? { candidate: true } : {}
|
|
6996
7019
|
});
|
|
6997
|
-
|
|
7020
|
+
printJson({
|
|
6998
7021
|
...result,
|
|
6999
7022
|
...result.nextCursor ? { note: `More: pass --cursor ${result.nextCursor} for the next page.` } : {}
|
|
7000
7023
|
});
|
|
@@ -7134,7 +7157,7 @@ async function dataSourcesCreate(ctx, a) {
|
|
|
7134
7157
|
...ingest ? { ingest } : {},
|
|
7135
7158
|
...placement !== void 0 ? { placement } : {}
|
|
7136
7159
|
});
|
|
7137
|
-
|
|
7160
|
+
printJson(
|
|
7138
7161
|
result.migration && !result.migration.error ? { ...result, note: MOVE_NOTE } : result
|
|
7139
7162
|
);
|
|
7140
7163
|
}
|
|
@@ -7143,7 +7166,7 @@ async function dataSourcesConfig(ctx, a) {
|
|
|
7143
7166
|
const { ingest, retrieval } = configFromFlags(a);
|
|
7144
7167
|
const placement = placementOf(a);
|
|
7145
7168
|
if (!ingest && !retrieval && placement === void 0) {
|
|
7146
|
-
|
|
7169
|
+
printJson(await configGet(ctx, slug));
|
|
7147
7170
|
return;
|
|
7148
7171
|
}
|
|
7149
7172
|
const result = await configSet(ctx, {
|
|
@@ -7152,14 +7175,14 @@ async function dataSourcesConfig(ctx, a) {
|
|
|
7152
7175
|
...retrieval ? { retrieval } : {},
|
|
7153
7176
|
...placement !== void 0 ? { placement } : {}
|
|
7154
7177
|
});
|
|
7155
|
-
|
|
7178
|
+
printJson(
|
|
7156
7179
|
result.placementChanged && result.migration && !result.migration.error ? { ...result, note: MOVE_NOTE } : result
|
|
7157
7180
|
);
|
|
7158
7181
|
}
|
|
7159
7182
|
async function dataSourcesMove(ctx, a) {
|
|
7160
7183
|
const slug = sourceOf(a);
|
|
7161
7184
|
if (a.bool("stop")) {
|
|
7162
|
-
|
|
7185
|
+
printJson({
|
|
7163
7186
|
dataSource: slug,
|
|
7164
7187
|
...await stopMove(ctx, { slug }),
|
|
7165
7188
|
note: "Stopped; the chains halt at their next checkpoint. Re-run `datasources move --to <same target>` to resume from where they were."
|
|
@@ -7176,7 +7199,7 @@ async function dataSourcesMove(ctx, a) {
|
|
|
7176
7199
|
...chains !== void 0 ? { chains } : {}
|
|
7177
7200
|
});
|
|
7178
7201
|
if (!started.migration || !a.bool("wait")) {
|
|
7179
|
-
|
|
7202
|
+
printJson({
|
|
7180
7203
|
dataSource: slug,
|
|
7181
7204
|
...started,
|
|
7182
7205
|
...started.migration ? { note: MOVE_NOTE } : {}
|
|
@@ -7189,7 +7212,7 @@ async function dataSourcesMove(ctx, a) {
|
|
|
7189
7212
|
...timeoutSec ? { timeoutMs: timeoutSec * 1e3 } : {},
|
|
7190
7213
|
onProgress: progress
|
|
7191
7214
|
});
|
|
7192
|
-
|
|
7215
|
+
printJson({
|
|
7193
7216
|
dataSource: slug,
|
|
7194
7217
|
status: result.status,
|
|
7195
7218
|
placement: result.source.placement,
|
|
@@ -7211,7 +7234,11 @@ async function dataSourcesRevectorize(ctx, a) {
|
|
|
7211
7234
|
...ingest ? { ingest } : {}
|
|
7212
7235
|
});
|
|
7213
7236
|
if (!a.bool("wait")) {
|
|
7214
|
-
|
|
7237
|
+
printJson({
|
|
7238
|
+
dataSource: slug,
|
|
7239
|
+
...started,
|
|
7240
|
+
note: "Run `promote` when ready."
|
|
7241
|
+
});
|
|
7215
7242
|
return;
|
|
7216
7243
|
}
|
|
7217
7244
|
const timeoutSec = a.num("timeout");
|
|
@@ -7221,10 +7248,10 @@ async function dataSourcesRevectorize(ctx, a) {
|
|
|
7221
7248
|
onProgress: progress
|
|
7222
7249
|
});
|
|
7223
7250
|
if (result.status === "timeout") {
|
|
7224
|
-
|
|
7251
|
+
printJson({ dataSource: slug, status: "timeout", error: result.error });
|
|
7225
7252
|
throw new CliError(result.error ?? "Timed out.", EXIT.timeout);
|
|
7226
7253
|
}
|
|
7227
|
-
|
|
7254
|
+
printJson({
|
|
7228
7255
|
dataSource: slug,
|
|
7229
7256
|
candidateVersion: started.candidateVersion,
|
|
7230
7257
|
status: result.status,
|
|
@@ -7237,7 +7264,7 @@ async function dataSourcesRevectorize(ctx, a) {
|
|
|
7237
7264
|
}
|
|
7238
7265
|
}
|
|
7239
7266
|
async function dataSourcesPromote(ctx, a) {
|
|
7240
|
-
|
|
7267
|
+
printJson(
|
|
7241
7268
|
await promote(ctx, {
|
|
7242
7269
|
slug: sourceOf(a),
|
|
7243
7270
|
...a.bool("force") ? { force: true } : {}
|
|
@@ -7246,8 +7273,8 @@ async function dataSourcesPromote(ctx, a) {
|
|
|
7246
7273
|
}
|
|
7247
7274
|
async function dataSourcesDrop(ctx, a) {
|
|
7248
7275
|
const version = a.str("version");
|
|
7249
|
-
|
|
7250
|
-
await
|
|
7276
|
+
printJson(
|
|
7277
|
+
await dropPipelineVersion(ctx, {
|
|
7251
7278
|
slug: sourceOf(a),
|
|
7252
7279
|
...version ? { version: Number(version) } : {}
|
|
7253
7280
|
})
|
|
@@ -7572,7 +7599,7 @@ async function numbersRelease(ctx, e164) {
|
|
|
7572
7599
|
return call(
|
|
7573
7600
|
ctx,
|
|
7574
7601
|
"POST",
|
|
7575
|
-
`/_internal/v2/apps/${ctx.appId}/settings/voice-phone-numbers/${
|
|
7602
|
+
`/_internal/v2/apps/${ctx.appId}/settings/voice-phone-numbers/${encodePathSegment(id)}/release`
|
|
7576
7603
|
);
|
|
7577
7604
|
}
|
|
7578
7605
|
async function numbersSetName(ctx, e164, displayName) {
|
|
@@ -7580,7 +7607,7 @@ async function numbersSetName(ctx, e164, displayName) {
|
|
|
7580
7607
|
return call(
|
|
7581
7608
|
ctx,
|
|
7582
7609
|
"POST",
|
|
7583
|
-
`/_internal/v2/apps/${ctx.appId}/settings/voice-phone-numbers/${
|
|
7610
|
+
`/_internal/v2/apps/${ctx.appId}/settings/voice-phone-numbers/${encodePathSegment(id)}/display-name`,
|
|
7584
7611
|
{ displayName }
|
|
7585
7612
|
);
|
|
7586
7613
|
}
|
|
@@ -7595,7 +7622,7 @@ function sessionsGet(ctx, sessionId) {
|
|
|
7595
7622
|
return call(
|
|
7596
7623
|
ctx,
|
|
7597
7624
|
"GET",
|
|
7598
|
-
`/_internal/v2/apps/${ctx.appId}/voice-sessions/${
|
|
7625
|
+
`/_internal/v2/apps/${ctx.appId}/voice-sessions/${encodePathSegment(sessionId)}`
|
|
7599
7626
|
);
|
|
7600
7627
|
}
|
|
7601
7628
|
function settingsGet(ctx) {
|
|
@@ -7693,10 +7720,10 @@ var voiceSpecs = {
|
|
|
7693
7720
|
}
|
|
7694
7721
|
};
|
|
7695
7722
|
async function numbersList2(ctx) {
|
|
7696
|
-
|
|
7723
|
+
printJson(await numbersList(ctx));
|
|
7697
7724
|
}
|
|
7698
7725
|
async function numbersSearch2(ctx, a) {
|
|
7699
|
-
|
|
7726
|
+
printJson(
|
|
7700
7727
|
await numbersSearch(ctx, {
|
|
7701
7728
|
areaCode: a.str("area-code"),
|
|
7702
7729
|
locality: a.str("locality"),
|
|
@@ -7706,9 +7733,9 @@ async function numbersSearch2(ctx, a) {
|
|
|
7706
7733
|
);
|
|
7707
7734
|
}
|
|
7708
7735
|
async function numbersBuy2(ctx, a) {
|
|
7709
|
-
|
|
7736
|
+
printJson(
|
|
7710
7737
|
await numbersBuy(ctx, {
|
|
7711
|
-
phoneNumber: a.
|
|
7738
|
+
phoneNumber: a.required("e164"),
|
|
7712
7739
|
locality: a.str("locality"),
|
|
7713
7740
|
administrativeArea: a.str("state"),
|
|
7714
7741
|
monthlyCost: a.str("monthly-cost")
|
|
@@ -7716,14 +7743,14 @@ async function numbersBuy2(ctx, a) {
|
|
|
7716
7743
|
);
|
|
7717
7744
|
}
|
|
7718
7745
|
async function numbersRelease2(ctx, a) {
|
|
7719
|
-
|
|
7746
|
+
printJson(await numbersRelease(ctx, a.required("e164")));
|
|
7720
7747
|
}
|
|
7721
7748
|
async function numbersSetName2(ctx, a) {
|
|
7722
7749
|
const displayName = a.bool("clear") ? "" : a.str("name") ?? "";
|
|
7723
|
-
|
|
7750
|
+
printJson(await numbersSetName(ctx, a.required("e164"), displayName));
|
|
7724
7751
|
}
|
|
7725
7752
|
async function sessionsList2(ctx, a) {
|
|
7726
|
-
|
|
7753
|
+
printJson(
|
|
7727
7754
|
await sessionsList(ctx, {
|
|
7728
7755
|
limit: a.num("limit"),
|
|
7729
7756
|
cursor: a.str("cursor")
|
|
@@ -7731,13 +7758,13 @@ async function sessionsList2(ctx, a) {
|
|
|
7731
7758
|
);
|
|
7732
7759
|
}
|
|
7733
7760
|
async function sessionsGet2(ctx, a) {
|
|
7734
|
-
|
|
7761
|
+
printJson(await sessionsGet(ctx, a.required("sessionId")));
|
|
7735
7762
|
}
|
|
7736
7763
|
async function settingsGet2(ctx) {
|
|
7737
|
-
|
|
7764
|
+
printJson(await settingsGet(ctx));
|
|
7738
7765
|
}
|
|
7739
7766
|
async function settingsSet2(ctx, a) {
|
|
7740
|
-
|
|
7767
|
+
printJson(
|
|
7741
7768
|
await settingsSet(ctx, {
|
|
7742
7769
|
maxConcurrentSessions: a.num("max-concurrent-sessions"),
|
|
7743
7770
|
maxConcurrentSessionsPerVisitor: a.num("max-per-visitor"),
|
|
@@ -7809,7 +7836,7 @@ function threadsGet(ctx, threadId) {
|
|
|
7809
7836
|
return call(
|
|
7810
7837
|
ctx,
|
|
7811
7838
|
"GET",
|
|
7812
|
-
`/_internal/v2/apps/${ctx.appId}/agent-threads/${
|
|
7839
|
+
`/_internal/v2/apps/${ctx.appId}/agent-threads/${encodePathSegment(threadId)}`
|
|
7813
7840
|
);
|
|
7814
7841
|
}
|
|
7815
7842
|
|
|
@@ -7828,7 +7855,7 @@ var agentSpecs = {
|
|
|
7828
7855
|
}
|
|
7829
7856
|
};
|
|
7830
7857
|
async function threadsList2(ctx, a) {
|
|
7831
|
-
|
|
7858
|
+
printJson(
|
|
7832
7859
|
await threadsList(ctx, {
|
|
7833
7860
|
limit: a.num("limit"),
|
|
7834
7861
|
cursor: a.str("cursor")
|
|
@@ -7836,7 +7863,7 @@ async function threadsList2(ctx, a) {
|
|
|
7836
7863
|
);
|
|
7837
7864
|
}
|
|
7838
7865
|
async function threadsGet2(ctx, a) {
|
|
7839
|
-
|
|
7866
|
+
printJson(await threadsGet(ctx, a.required("threadId")));
|
|
7840
7867
|
}
|
|
7841
7868
|
var agentHandlers = {
|
|
7842
7869
|
"agent threads list": threadsList2,
|
|
@@ -7886,7 +7913,7 @@ function get8(ctx, traceId) {
|
|
|
7886
7913
|
return call(
|
|
7887
7914
|
ctx,
|
|
7888
7915
|
"GET",
|
|
7889
|
-
`/_internal/v2/apps/${ctx.appId}/task-traces/${
|
|
7916
|
+
`/_internal/v2/apps/${ctx.appId}/task-traces/${encodePathSegment(traceId)}`
|
|
7890
7917
|
);
|
|
7891
7918
|
}
|
|
7892
7919
|
|
|
@@ -7905,7 +7932,7 @@ var tasksSpecs = {
|
|
|
7905
7932
|
}
|
|
7906
7933
|
};
|
|
7907
7934
|
async function list13(ctx, a) {
|
|
7908
|
-
|
|
7935
|
+
printJson(
|
|
7909
7936
|
await list12(ctx, {
|
|
7910
7937
|
limit: a.num("limit"),
|
|
7911
7938
|
cursor: a.str("cursor")
|
|
@@ -7913,7 +7940,7 @@ async function list13(ctx, a) {
|
|
|
7913
7940
|
);
|
|
7914
7941
|
}
|
|
7915
7942
|
async function get9(ctx, a) {
|
|
7916
|
-
|
|
7943
|
+
printJson(await get8(ctx, a.required("traceId")));
|
|
7917
7944
|
}
|
|
7918
7945
|
var tasksHandlers = {
|
|
7919
7946
|
"tasks list": list13,
|
|
@@ -7971,9 +7998,11 @@ function summary2(ctx, params) {
|
|
|
7971
7998
|
var DEFAULT_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
7972
7999
|
var usageSpecs = {
|
|
7973
8000
|
"usage summary": {
|
|
7974
|
-
usage: "Usage: remy-admin usage summary [--start <iso>] [--end <iso>] [--by method|model|step]",
|
|
8001
|
+
usage: "Usage: remy-admin usage summary [--scope run|build] [--start <iso>] [--end <iso>] [--by method|model|step] [--app <appId>]",
|
|
7975
8002
|
flags: {
|
|
7976
8003
|
...WINDOW,
|
|
8004
|
+
...APP,
|
|
8005
|
+
scope: { type: "string", choices: ["run", "build"] },
|
|
7977
8006
|
by: { type: "string", choices: ["method", "model", "step"] }
|
|
7978
8007
|
}
|
|
7979
8008
|
}
|
|
@@ -7981,10 +8010,11 @@ var usageSpecs = {
|
|
|
7981
8010
|
async function summary3(ctx, a) {
|
|
7982
8011
|
const end = a.str("end") ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
7983
8012
|
const start2 = a.str("start") ?? new Date(new Date(end).getTime() - DEFAULT_WINDOW_MS).toISOString();
|
|
7984
|
-
|
|
8013
|
+
printJson(
|
|
7985
8014
|
await summary2(ctx, {
|
|
7986
8015
|
startTime: start2,
|
|
7987
8016
|
endTime: end,
|
|
8017
|
+
scope: a.str("scope"),
|
|
7988
8018
|
groupBy: a.str("by")
|
|
7989
8019
|
})
|
|
7990
8020
|
);
|
|
@@ -7992,25 +8022,33 @@ async function summary3(ctx, a) {
|
|
|
7992
8022
|
var usageHandlers = {
|
|
7993
8023
|
"usage summary": summary3
|
|
7994
8024
|
};
|
|
7995
|
-
var usageHelp = `remy-admin usage \u2014 What the app costs to run.
|
|
8025
|
+
var usageHelp = `remy-admin usage \u2014 What the app costs to run, and what building it cost.
|
|
7996
8026
|
|
|
7997
8027
|
Subcommands:
|
|
7998
|
-
summary The app's
|
|
8028
|
+
summary The app's spend over a window, run or build, broken down one way
|
|
7999
8029
|
|
|
8000
8030
|
Usage:
|
|
8001
|
-
remy-admin usage summary [--start <iso>] [--end <iso>] [--by method|model|step]
|
|
8031
|
+
remy-admin usage summary [--scope run|build] [--start <iso>] [--end <iso>] [--by method|model|step] [--app <appId>]
|
|
8002
8032
|
|
|
8003
8033
|
Notes:
|
|
8004
|
-
Costs are in dollars.
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8034
|
+
Costs are in dollars. --scope run (the default) is the app serving people, on
|
|
8035
|
+
its live release and its previews. --scope build is your own work on the app:
|
|
8036
|
+
building it, testing it in the sandbox, and its security assessments. The two
|
|
8037
|
+
never overlap.
|
|
8038
|
+
--by method is the spend each method drove, model the models' share, step the
|
|
8039
|
+
whole spend by action, models and everything else. It defaults to method for
|
|
8040
|
+
run and model for build, since build spend is mostly the builder's, which no
|
|
8041
|
+
method drove. The window defaults to the 30 days before --end, and --end to
|
|
8042
|
+
now. An app's own method can read both scopes with the 'usage.view' admin
|
|
8043
|
+
permission.
|
|
8044
|
+
'--app <appId>' reads another app in the workspace with this credential;
|
|
8045
|
+
'remy-admin apps list' gives the ids. Outside an app's workspace (a laptop,
|
|
8046
|
+
CI) it's how you name the app.
|
|
8010
8047
|
|
|
8011
8048
|
Examples:
|
|
8012
8049
|
remy-admin usage summary
|
|
8013
|
-
remy-admin usage summary --by model --start 2026-10-01T00:00:00Z
|
|
8050
|
+
remy-admin usage summary --by model --start 2026-10-01T00:00:00Z
|
|
8051
|
+
remy-admin usage summary --scope build --start 2026-11-01T00:00:00Z --end 2026-11-08T00:00:00Z`;
|
|
8014
8052
|
|
|
8015
8053
|
// src/ops/events.ts
|
|
8016
8054
|
function channelsList(ctx, params = {}) {
|
|
@@ -8077,23 +8115,23 @@ async function eventsTail(ctx, a) {
|
|
|
8077
8115
|
);
|
|
8078
8116
|
}
|
|
8079
8117
|
async function eventsPublish(ctx, a) {
|
|
8080
|
-
const raw = a.
|
|
8118
|
+
const raw = a.required("json");
|
|
8081
8119
|
let data;
|
|
8082
8120
|
try {
|
|
8083
8121
|
data = JSON.parse(raw);
|
|
8084
8122
|
} catch {
|
|
8085
8123
|
fatal(`Invalid JSON payload: ${raw}`);
|
|
8086
8124
|
}
|
|
8087
|
-
|
|
8125
|
+
printJson(
|
|
8088
8126
|
await publish(ctx, {
|
|
8089
|
-
channels: a.
|
|
8127
|
+
channels: a.required("channel"),
|
|
8090
8128
|
data,
|
|
8091
8129
|
scope: a.str("scope")
|
|
8092
8130
|
})
|
|
8093
8131
|
);
|
|
8094
8132
|
}
|
|
8095
8133
|
async function eventsChannelsList(ctx, a) {
|
|
8096
|
-
|
|
8134
|
+
printJson(await channelsList(ctx, { scope: a.str("scope") }));
|
|
8097
8135
|
}
|
|
8098
8136
|
var eventsHandlers = {
|
|
8099
8137
|
"events tail": eventsTail,
|
|
@@ -8170,7 +8208,7 @@ function pair(ctx, pairId) {
|
|
|
8170
8208
|
return call(
|
|
8171
8209
|
ctx,
|
|
8172
8210
|
"GET",
|
|
8173
|
-
`/_internal/v2/apps/${ctx.appId}/jewels/pairs/${
|
|
8211
|
+
`/_internal/v2/apps/${ctx.appId}/jewels/pairs/${encodePathSegment(pairId)}`
|
|
8174
8212
|
);
|
|
8175
8213
|
}
|
|
8176
8214
|
function queue(ctx, params = {}) {
|
|
@@ -8200,7 +8238,7 @@ function dryrun(ctx, params) {
|
|
|
8200
8238
|
return call(
|
|
8201
8239
|
ctx,
|
|
8202
8240
|
"POST",
|
|
8203
|
-
`/_internal/v2/apps/${ctx.appId}/jewels/${
|
|
8241
|
+
`/_internal/v2/apps/${ctx.appId}/jewels/${encodePathSegment(params.methodId)}/dryrun`,
|
|
8204
8242
|
{ subject: params.subject },
|
|
8205
8243
|
JEWEL_RUN_TIMEOUT_MS
|
|
8206
8244
|
);
|
|
@@ -8234,14 +8272,14 @@ function getRun2(ctx, runId) {
|
|
|
8234
8272
|
return call(
|
|
8235
8273
|
ctx,
|
|
8236
8274
|
"GET",
|
|
8237
|
-
`/_internal/v2/apps/${ctx.appId}/jewels/training-runs/${
|
|
8275
|
+
`/_internal/v2/apps/${ctx.appId}/jewels/training-runs/${encodePathSegment(runId)}`
|
|
8238
8276
|
);
|
|
8239
8277
|
}
|
|
8240
8278
|
function grade(ctx, runId) {
|
|
8241
8279
|
return call(
|
|
8242
8280
|
ctx,
|
|
8243
8281
|
"POST",
|
|
8244
|
-
`/_internal/v2/apps/${ctx.appId}/jewels/training-runs/${
|
|
8282
|
+
`/_internal/v2/apps/${ctx.appId}/jewels/training-runs/${encodePathSegment(runId)}/grade`,
|
|
8245
8283
|
void 0,
|
|
8246
8284
|
JEWEL_RUN_TIMEOUT_MS
|
|
8247
8285
|
);
|
|
@@ -8348,7 +8386,7 @@ function parseJsonFlag(a, flag) {
|
|
|
8348
8386
|
return value;
|
|
8349
8387
|
}
|
|
8350
8388
|
async function jewelsOverview(ctx, a) {
|
|
8351
|
-
|
|
8389
|
+
printJson(
|
|
8352
8390
|
await overview(ctx, {
|
|
8353
8391
|
start: a.str("start"),
|
|
8354
8392
|
end: a.str("end")
|
|
@@ -8356,7 +8394,7 @@ async function jewelsOverview(ctx, a) {
|
|
|
8356
8394
|
);
|
|
8357
8395
|
}
|
|
8358
8396
|
async function jewelsPairs(ctx, a) {
|
|
8359
|
-
|
|
8397
|
+
printJson(
|
|
8360
8398
|
await pairs(ctx, {
|
|
8361
8399
|
methodId: a.str("method-id"),
|
|
8362
8400
|
verdict: a.str("verdict"),
|
|
@@ -8369,10 +8407,10 @@ async function jewelsPairs(ctx, a) {
|
|
|
8369
8407
|
);
|
|
8370
8408
|
}
|
|
8371
8409
|
async function jewelsPair(ctx, a) {
|
|
8372
|
-
|
|
8410
|
+
printJson(await pair(ctx, a.required("pairId")));
|
|
8373
8411
|
}
|
|
8374
8412
|
async function jewelsQueue(ctx, a) {
|
|
8375
|
-
|
|
8413
|
+
printJson(
|
|
8376
8414
|
await queue(ctx, {
|
|
8377
8415
|
methodId: a.str("method-id"),
|
|
8378
8416
|
limit: a.num("limit")
|
|
@@ -8380,7 +8418,7 @@ async function jewelsQueue(ctx, a) {
|
|
|
8380
8418
|
);
|
|
8381
8419
|
}
|
|
8382
8420
|
async function jewelsTimeseries(ctx, a) {
|
|
8383
|
-
|
|
8421
|
+
printJson(
|
|
8384
8422
|
await timeseries(ctx, {
|
|
8385
8423
|
methodId: a.str("method-id"),
|
|
8386
8424
|
start: a.str("start"),
|
|
@@ -8399,37 +8437,37 @@ async function jewelsResolve(ctx, a) {
|
|
|
8399
8437
|
fatal("--input only applies to --approve.");
|
|
8400
8438
|
}
|
|
8401
8439
|
const params = {
|
|
8402
|
-
itemId: a.
|
|
8440
|
+
itemId: a.required("itemId"),
|
|
8403
8441
|
action: approve2 ? "approve" : "dismiss"
|
|
8404
8442
|
};
|
|
8405
8443
|
if (a.str("input") !== void 0) {
|
|
8406
8444
|
params.input = parseJsonFlag(a, "input");
|
|
8407
8445
|
}
|
|
8408
|
-
|
|
8446
|
+
printJson(await resolve(ctx, params));
|
|
8409
8447
|
}
|
|
8410
8448
|
async function jewelsExport(ctx, a) {
|
|
8411
8449
|
const apiPath = `/_internal/v2/apps/${ctx.appId}/jewels/export${qs({
|
|
8412
8450
|
file: a.str("file"),
|
|
8413
8451
|
start: a.str("start"),
|
|
8414
8452
|
end: a.str("end"),
|
|
8415
|
-
methodId: a.
|
|
8453
|
+
methodId: a.required("methodId")
|
|
8416
8454
|
})}`;
|
|
8417
8455
|
if (a.str("file")) {
|
|
8418
8456
|
await rawToStdout(ctx, "GET", apiPath, JEWEL_RUN_TIMEOUT_MS);
|
|
8419
8457
|
return;
|
|
8420
8458
|
}
|
|
8421
|
-
|
|
8459
|
+
printJson(
|
|
8422
8460
|
await exportSummary(ctx, {
|
|
8423
|
-
methodId: a.
|
|
8461
|
+
methodId: a.required("methodId"),
|
|
8424
8462
|
start: a.str("start"),
|
|
8425
8463
|
end: a.str("end")
|
|
8426
8464
|
})
|
|
8427
8465
|
);
|
|
8428
8466
|
}
|
|
8429
8467
|
async function jewelsDryrun(ctx, a) {
|
|
8430
|
-
|
|
8468
|
+
printJson(
|
|
8431
8469
|
await dryrun(ctx, {
|
|
8432
|
-
methodId: a.
|
|
8470
|
+
methodId: a.required("methodId"),
|
|
8433
8471
|
subject: parseJsonFlag(a, "subject")
|
|
8434
8472
|
})
|
|
8435
8473
|
);
|
|
@@ -8437,12 +8475,12 @@ async function jewelsDryrun(ctx, a) {
|
|
|
8437
8475
|
var TRAIN_POLL_MS = 15e3;
|
|
8438
8476
|
var TRAIN_WAIT_LIMIT_MS = 45 * 6e4;
|
|
8439
8477
|
async function jewelsTrain(ctx, a) {
|
|
8440
|
-
const started = await train(ctx, { methodId: a.
|
|
8478
|
+
const started = await train(ctx, { methodId: a.required("methodId") });
|
|
8441
8479
|
if (!a.bool("wait")) {
|
|
8442
|
-
|
|
8480
|
+
printJson(started);
|
|
8443
8481
|
return;
|
|
8444
8482
|
}
|
|
8445
|
-
|
|
8483
|
+
printJson({ runId: started.run?.id, summary: started.summary });
|
|
8446
8484
|
const runId = started.run?.id;
|
|
8447
8485
|
const deadline = Date.now() + TRAIN_WAIT_LIMIT_MS;
|
|
8448
8486
|
let lastLogLen = 0;
|
|
@@ -8455,20 +8493,20 @@ async function jewelsTrain(ctx, a) {
|
|
|
8455
8493
|
const isStatus = (x) => x?.kind === "status";
|
|
8456
8494
|
const isLoss = (x) => x?.kind === "loss";
|
|
8457
8495
|
for (const e of fresh.filter(isStatus)) {
|
|
8458
|
-
|
|
8496
|
+
printJson({ status: run3.status, at: e.ts, message: e.message });
|
|
8459
8497
|
}
|
|
8460
8498
|
const losses = fresh.filter(isLoss);
|
|
8461
8499
|
if (losses.length) {
|
|
8462
8500
|
const last = losses[losses.length - 1];
|
|
8463
8501
|
const p = run3.progress;
|
|
8464
|
-
|
|
8502
|
+
printJson({
|
|
8465
8503
|
status: run3.status,
|
|
8466
8504
|
step: `${last.step}/${p?.totalSteps ?? "?"}`,
|
|
8467
8505
|
loss: last.loss
|
|
8468
8506
|
});
|
|
8469
8507
|
}
|
|
8470
8508
|
if (run3.status === "complete" || run3.status === "failed") {
|
|
8471
|
-
|
|
8509
|
+
printJson(compactRunLog(run3));
|
|
8472
8510
|
if (run3.status === "failed") {
|
|
8473
8511
|
process.exitCode = 1;
|
|
8474
8512
|
}
|
|
@@ -8480,15 +8518,15 @@ async function jewelsTrain(ctx, a) {
|
|
|
8480
8518
|
);
|
|
8481
8519
|
}
|
|
8482
8520
|
function compactRunLog(run3) {
|
|
8483
|
-
let
|
|
8521
|
+
let out = { ...run3 };
|
|
8484
8522
|
if (Array.isArray(run3.log)) {
|
|
8485
8523
|
const statusEntries = run3.log.filter((e) => e?.kind === "status");
|
|
8486
8524
|
const lossPoints = run3.log.length - statusEntries.length;
|
|
8487
|
-
|
|
8525
|
+
out = { ...out, log: { statusEntries, lossPoints } };
|
|
8488
8526
|
}
|
|
8489
8527
|
if (Array.isArray(run3.report?.candidates)) {
|
|
8490
|
-
|
|
8491
|
-
...
|
|
8528
|
+
out = {
|
|
8529
|
+
...out,
|
|
8492
8530
|
report: {
|
|
8493
8531
|
...run3.report,
|
|
8494
8532
|
candidates: run3.report.candidates.map(
|
|
@@ -8497,10 +8535,10 @@ function compactRunLog(run3) {
|
|
|
8497
8535
|
}
|
|
8498
8536
|
};
|
|
8499
8537
|
}
|
|
8500
|
-
return
|
|
8538
|
+
return out;
|
|
8501
8539
|
}
|
|
8502
8540
|
async function jewelsRuns(ctx, a) {
|
|
8503
|
-
|
|
8541
|
+
printJson(
|
|
8504
8542
|
await runs(ctx, {
|
|
8505
8543
|
methodId: a.str("method-id"),
|
|
8506
8544
|
limit: a.num("limit")
|
|
@@ -8508,11 +8546,11 @@ async function jewelsRuns(ctx, a) {
|
|
|
8508
8546
|
);
|
|
8509
8547
|
}
|
|
8510
8548
|
async function jewelsRunGet(ctx, a) {
|
|
8511
|
-
const { run: run3 } = await getRun2(ctx, a.
|
|
8512
|
-
|
|
8549
|
+
const { run: run3 } = await getRun2(ctx, a.required("runId"));
|
|
8550
|
+
printJson({ run: compactRunLog(run3) });
|
|
8513
8551
|
}
|
|
8514
8552
|
async function jewelsGrade(ctx, a) {
|
|
8515
|
-
|
|
8553
|
+
printJson(await grade(ctx, a.required("runId")));
|
|
8516
8554
|
}
|
|
8517
8555
|
var jewelsHandlers = {
|
|
8518
8556
|
"jewels overview": jewelsOverview,
|
|
@@ -8703,18 +8741,20 @@ function normalizeOrigin(raw) {
|
|
|
8703
8741
|
return trimmed.includes("://") ? trimmed : `https://${trimmed}`;
|
|
8704
8742
|
}
|
|
8705
8743
|
async function settingsGet3(ctx) {
|
|
8706
|
-
|
|
8744
|
+
printJson({ settings: await getSettings(ctx) });
|
|
8707
8745
|
}
|
|
8708
8746
|
async function settingsSet3(ctx, a) {
|
|
8709
|
-
const key = a.
|
|
8710
|
-
const raw = a.
|
|
8747
|
+
const key = a.required("key");
|
|
8748
|
+
const raw = a.required("value");
|
|
8711
8749
|
let value;
|
|
8712
8750
|
try {
|
|
8713
8751
|
value = JSON.parse(raw);
|
|
8714
8752
|
} catch {
|
|
8715
8753
|
value = raw;
|
|
8716
8754
|
}
|
|
8717
|
-
|
|
8755
|
+
printJson({
|
|
8756
|
+
settings: await updateSettings(ctx, { [key]: value })
|
|
8757
|
+
});
|
|
8718
8758
|
}
|
|
8719
8759
|
function allowlistView(s) {
|
|
8720
8760
|
return {
|
|
@@ -8723,7 +8763,7 @@ function allowlistView(s) {
|
|
|
8723
8763
|
};
|
|
8724
8764
|
}
|
|
8725
8765
|
async function allowlistList(ctx) {
|
|
8726
|
-
|
|
8766
|
+
printJson(allowlistView(await getSettings(ctx)));
|
|
8727
8767
|
}
|
|
8728
8768
|
async function allowlistEnable(ctx) {
|
|
8729
8769
|
const updated = await updateSettings(ctx, {
|
|
@@ -8733,17 +8773,17 @@ async function allowlistEnable(ctx) {
|
|
|
8733
8773
|
if (view2.entries.length === 0) {
|
|
8734
8774
|
view2.note = "The allowlist is enabled but empty \u2014 an empty list allows everyone. Add entries to enforce it.";
|
|
8735
8775
|
}
|
|
8736
|
-
|
|
8776
|
+
printJson(view2);
|
|
8737
8777
|
}
|
|
8738
8778
|
async function allowlistDisable(ctx) {
|
|
8739
|
-
|
|
8779
|
+
printJson(
|
|
8740
8780
|
allowlistView(
|
|
8741
8781
|
await updateSettings(ctx, { signupAllowlistEnabled: false })
|
|
8742
8782
|
)
|
|
8743
8783
|
);
|
|
8744
8784
|
}
|
|
8745
8785
|
async function allowlistAdd(ctx, a) {
|
|
8746
|
-
const entry = a.
|
|
8786
|
+
const entry = a.required("entry").trim().toLowerCase();
|
|
8747
8787
|
const current = await getSettings(ctx);
|
|
8748
8788
|
const entries = current.signupAllowlist ?? [];
|
|
8749
8789
|
const next = entries.includes(entry) ? entries : [...entries, entry];
|
|
@@ -8754,10 +8794,10 @@ async function allowlistAdd(ctx, a) {
|
|
|
8754
8794
|
if (!view2.enabled) {
|
|
8755
8795
|
view2.note = "signupAllowlistEnabled is off, so this list is not being enforced. Enable it with: remy-admin settings allowlist enable";
|
|
8756
8796
|
}
|
|
8757
|
-
|
|
8797
|
+
printJson(view2);
|
|
8758
8798
|
}
|
|
8759
8799
|
async function allowlistRemove(ctx, a) {
|
|
8760
|
-
const entry = a.
|
|
8800
|
+
const entry = a.required("entry").trim().toLowerCase();
|
|
8761
8801
|
const current = await getSettings(ctx);
|
|
8762
8802
|
const entries = current.signupAllowlist ?? [];
|
|
8763
8803
|
if (!entries.includes(entry)) {
|
|
@@ -8771,7 +8811,7 @@ async function allowlistRemove(ctx, a) {
|
|
|
8771
8811
|
if (view2.enabled && view2.entries.length === 0) {
|
|
8772
8812
|
view2.note = "The allowlist is now empty while enabled \u2014 an empty list allows everyone.";
|
|
8773
8813
|
}
|
|
8774
|
-
|
|
8814
|
+
printJson(view2);
|
|
8775
8815
|
}
|
|
8776
8816
|
function testAccountsView(s) {
|
|
8777
8817
|
return {
|
|
@@ -8780,25 +8820,25 @@ function testAccountsView(s) {
|
|
|
8780
8820
|
};
|
|
8781
8821
|
}
|
|
8782
8822
|
async function testAccountsList(ctx) {
|
|
8783
|
-
|
|
8823
|
+
printJson(testAccountsView(await getSettings(ctx)));
|
|
8784
8824
|
}
|
|
8785
8825
|
async function testAccountsEnable(ctx) {
|
|
8786
|
-
|
|
8826
|
+
printJson(
|
|
8787
8827
|
testAccountsView(
|
|
8788
8828
|
await updateSettings(ctx, { testAccountsEnabled: true })
|
|
8789
8829
|
)
|
|
8790
8830
|
);
|
|
8791
8831
|
}
|
|
8792
8832
|
async function testAccountsDisable(ctx) {
|
|
8793
|
-
|
|
8833
|
+
printJson(
|
|
8794
8834
|
testAccountsView(
|
|
8795
8835
|
await updateSettings(ctx, { testAccountsEnabled: false })
|
|
8796
8836
|
)
|
|
8797
8837
|
);
|
|
8798
8838
|
}
|
|
8799
8839
|
async function testAccountsAdd(ctx, a) {
|
|
8800
|
-
const identifier = normalizeIdentifier(a.
|
|
8801
|
-
const code = a.
|
|
8840
|
+
const identifier = normalizeIdentifier(a.required("identifier"));
|
|
8841
|
+
const code = a.required("code").trim();
|
|
8802
8842
|
const current = await getSettings(ctx);
|
|
8803
8843
|
const accounts = current.testAccounts ?? [];
|
|
8804
8844
|
const next = [
|
|
@@ -8810,17 +8850,17 @@ async function testAccountsAdd(ctx, a) {
|
|
|
8810
8850
|
if (!view2.enabled) {
|
|
8811
8851
|
view2.note = "testAccountsEnabled is off, so fixed-code login is not active. Enable it with: remy-admin settings test-accounts enable";
|
|
8812
8852
|
}
|
|
8813
|
-
|
|
8853
|
+
printJson(view2);
|
|
8814
8854
|
}
|
|
8815
8855
|
async function testAccountsRemove(ctx, a) {
|
|
8816
|
-
const identifier = normalizeIdentifier(a.
|
|
8856
|
+
const identifier = normalizeIdentifier(a.required("identifier"));
|
|
8817
8857
|
const current = await getSettings(ctx);
|
|
8818
8858
|
const accounts = current.testAccounts ?? [];
|
|
8819
8859
|
if (!accounts.some((t) => t.identifier === identifier)) {
|
|
8820
8860
|
fatal(`"${identifier}" is not a configured test account`);
|
|
8821
8861
|
}
|
|
8822
8862
|
const next = accounts.filter((t) => t.identifier !== identifier);
|
|
8823
|
-
|
|
8863
|
+
printJson(
|
|
8824
8864
|
testAccountsView(
|
|
8825
8865
|
await updateSettings(ctx, { testAccounts: next })
|
|
8826
8866
|
)
|
|
@@ -8828,20 +8868,20 @@ async function testAccountsRemove(ctx, a) {
|
|
|
8828
8868
|
}
|
|
8829
8869
|
async function frameAncestorsList(ctx) {
|
|
8830
8870
|
const s = await getSettings(ctx);
|
|
8831
|
-
|
|
8871
|
+
printJson({ origins: s.additionalFrameAncestors ?? [] });
|
|
8832
8872
|
}
|
|
8833
8873
|
async function frameAncestorsAdd(ctx, a) {
|
|
8834
|
-
const origin = normalizeOrigin(a.
|
|
8874
|
+
const origin = normalizeOrigin(a.required("origin"));
|
|
8835
8875
|
const current = await getSettings(ctx);
|
|
8836
8876
|
const origins = current.additionalFrameAncestors ?? [];
|
|
8837
8877
|
const next = origins.includes(origin) ? origins : [...origins, origin];
|
|
8838
8878
|
const updated = await updateSettings(ctx, {
|
|
8839
8879
|
additionalFrameAncestors: next
|
|
8840
8880
|
});
|
|
8841
|
-
|
|
8881
|
+
printJson({ origins: updated.additionalFrameAncestors ?? [] });
|
|
8842
8882
|
}
|
|
8843
8883
|
async function frameAncestorsRemove(ctx, a) {
|
|
8844
|
-
const origin = normalizeOrigin(a.
|
|
8884
|
+
const origin = normalizeOrigin(a.required("origin"));
|
|
8845
8885
|
const current = await getSettings(ctx);
|
|
8846
8886
|
const origins = current.additionalFrameAncestors ?? [];
|
|
8847
8887
|
if (!origins.includes(origin)) {
|
|
@@ -8851,7 +8891,7 @@ async function frameAncestorsRemove(ctx, a) {
|
|
|
8851
8891
|
const updated = await updateSettings(ctx, {
|
|
8852
8892
|
additionalFrameAncestors: next
|
|
8853
8893
|
});
|
|
8854
|
-
|
|
8894
|
+
printJson({ origins: updated.additionalFrameAncestors ?? [] });
|
|
8855
8895
|
}
|
|
8856
8896
|
var settingsHandlers = {
|
|
8857
8897
|
"settings get": settingsGet3,
|
|
@@ -8967,7 +9007,7 @@ function get10(ctx, messageId) {
|
|
|
8967
9007
|
return call(
|
|
8968
9008
|
ctx,
|
|
8969
9009
|
"GET",
|
|
8970
|
-
`/_internal/v2/apps/${ctx.appId}/outbound-email/messages/${
|
|
9010
|
+
`/_internal/v2/apps/${ctx.appId}/outbound-email/messages/${encodePathSegment(messageId)}`
|
|
8971
9011
|
);
|
|
8972
9012
|
}
|
|
8973
9013
|
function stats2(ctx, params = {}) {
|
|
@@ -8995,7 +9035,7 @@ function batch2(ctx, batchId) {
|
|
|
8995
9035
|
return call(
|
|
8996
9036
|
ctx,
|
|
8997
9037
|
"GET",
|
|
8998
|
-
`/_internal/v2/apps/${ctx.appId}/outbound-email/batches/${
|
|
9038
|
+
`/_internal/v2/apps/${ctx.appId}/outbound-email/batches/${encodePathSegment(batchId)}`
|
|
8999
9039
|
);
|
|
9000
9040
|
}
|
|
9001
9041
|
function suppressions(ctx, params = {}) {
|
|
@@ -9046,7 +9086,7 @@ async function verifyDomain(ctx, direction, domain) {
|
|
|
9046
9086
|
return call(
|
|
9047
9087
|
ctx,
|
|
9048
9088
|
"POST",
|
|
9049
|
-
`${domainsPath(ctx, direction)}/${
|
|
9089
|
+
`${domainsPath(ctx, direction)}/${encodePathSegment(id)}/retry`
|
|
9050
9090
|
);
|
|
9051
9091
|
}
|
|
9052
9092
|
async function removeDomain(ctx, direction, domain) {
|
|
@@ -9054,7 +9094,7 @@ async function removeDomain(ctx, direction, domain) {
|
|
|
9054
9094
|
return call(
|
|
9055
9095
|
ctx,
|
|
9056
9096
|
"POST",
|
|
9057
|
-
`${domainsPath(ctx, direction)}/${
|
|
9097
|
+
`${domainsPath(ctx, direction)}/${encodePathSegment(id)}/delete`
|
|
9058
9098
|
);
|
|
9059
9099
|
}
|
|
9060
9100
|
|
|
@@ -9154,7 +9194,7 @@ var emailSpecs = {
|
|
|
9154
9194
|
}
|
|
9155
9195
|
};
|
|
9156
9196
|
async function emailList(ctx, a) {
|
|
9157
|
-
|
|
9197
|
+
printJson(
|
|
9158
9198
|
await list14(ctx, {
|
|
9159
9199
|
status: a.str("status"),
|
|
9160
9200
|
kind: a.str("kind"),
|
|
@@ -9169,16 +9209,18 @@ async function emailList(ctx, a) {
|
|
|
9169
9209
|
);
|
|
9170
9210
|
}
|
|
9171
9211
|
async function emailGet(ctx, a) {
|
|
9172
|
-
|
|
9212
|
+
printJson(await get10(ctx, a.required("messageId")));
|
|
9173
9213
|
}
|
|
9174
9214
|
async function emailStats(ctx, a) {
|
|
9175
|
-
|
|
9215
|
+
printJson(
|
|
9216
|
+
await stats2(ctx, { start: a.str("start"), end: a.str("end") })
|
|
9217
|
+
);
|
|
9176
9218
|
}
|
|
9177
9219
|
async function emailStatus(ctx) {
|
|
9178
|
-
|
|
9220
|
+
printJson(await status(ctx));
|
|
9179
9221
|
}
|
|
9180
9222
|
async function emailBatches(ctx, a) {
|
|
9181
|
-
|
|
9223
|
+
printJson(
|
|
9182
9224
|
await batches(ctx, {
|
|
9183
9225
|
start: a.str("start"),
|
|
9184
9226
|
end: a.str("end"),
|
|
@@ -9188,10 +9230,10 @@ async function emailBatches(ctx, a) {
|
|
|
9188
9230
|
);
|
|
9189
9231
|
}
|
|
9190
9232
|
async function emailBatch(ctx, a) {
|
|
9191
|
-
|
|
9233
|
+
printJson(await batch2(ctx, a.required("batchId")));
|
|
9192
9234
|
}
|
|
9193
9235
|
async function emailSuppressions(ctx, a) {
|
|
9194
|
-
|
|
9236
|
+
printJson(
|
|
9195
9237
|
await suppressions(ctx, {
|
|
9196
9238
|
limit: a.num("limit"),
|
|
9197
9239
|
offset: a.num("offset")
|
|
@@ -9199,7 +9241,7 @@ async function emailSuppressions(ctx, a) {
|
|
|
9199
9241
|
);
|
|
9200
9242
|
}
|
|
9201
9243
|
async function emailSuppress(ctx, a) {
|
|
9202
|
-
|
|
9244
|
+
printJson(await suppress(ctx, a.required("email")));
|
|
9203
9245
|
}
|
|
9204
9246
|
async function emailUnsuppress(ctx, a) {
|
|
9205
9247
|
if (!a.bool("confirm")) {
|
|
@@ -9207,23 +9249,23 @@ async function emailUnsuppress(ctx, a) {
|
|
|
9207
9249
|
"Refusing without --confirm: resubscribing sends mail to someone who opted out."
|
|
9208
9250
|
);
|
|
9209
9251
|
}
|
|
9210
|
-
const result = await unsuppress(ctx, a.
|
|
9211
|
-
|
|
9252
|
+
const result = await unsuppress(ctx, a.required("email"));
|
|
9253
|
+
printJson(result);
|
|
9212
9254
|
if (result?.platformSuppression) {
|
|
9213
9255
|
const { reason, at } = result.platformSuppression;
|
|
9214
9256
|
console.error(
|
|
9215
9257
|
`
|
|
9216
|
-
Note: removed from this app's list, but ${a.
|
|
9258
|
+
Note: removed from this app's list, but ${a.required("email")} is still on the ACCOUNT-wide suppression list (${reason}${at ? ` since ${at}` : ""}). Mail to it will still be blocked \u2014 that list is shared by every app and is not cleared.`
|
|
9217
9259
|
);
|
|
9218
9260
|
} else if (result?.tenantEntryRemoved) {
|
|
9219
9261
|
console.error(
|
|
9220
9262
|
`
|
|
9221
|
-
Note: also cleared this app's provider-side bounce/complaint record for ${a.
|
|
9263
|
+
Note: also cleared this app's provider-side bounce/complaint record for ${a.required("email")}. Mail will be attempted again \u2014 another hard bounce re-suppresses it automatically.`
|
|
9222
9264
|
);
|
|
9223
9265
|
}
|
|
9224
9266
|
}
|
|
9225
9267
|
async function emailInbox(ctx, a) {
|
|
9226
|
-
|
|
9268
|
+
printJson(
|
|
9227
9269
|
await inbox(ctx, {
|
|
9228
9270
|
status: a.str("status"),
|
|
9229
9271
|
search: a.str("search"),
|
|
@@ -9236,19 +9278,19 @@ async function emailInbox(ctx, a) {
|
|
|
9236
9278
|
}
|
|
9237
9279
|
var domainCommands = (direction) => ({
|
|
9238
9280
|
list: async (ctx) => {
|
|
9239
|
-
|
|
9281
|
+
printJson(await listDomains(ctx, direction));
|
|
9240
9282
|
},
|
|
9241
9283
|
check: async (ctx, a) => {
|
|
9242
|
-
|
|
9284
|
+
printJson(await checkDomain(ctx, direction, a.required("domain")));
|
|
9243
9285
|
},
|
|
9244
9286
|
add: async (ctx, a) => {
|
|
9245
|
-
|
|
9287
|
+
printJson(await addDomain(ctx, direction, a.required("domain")));
|
|
9246
9288
|
},
|
|
9247
9289
|
verify: async (ctx, a) => {
|
|
9248
|
-
|
|
9290
|
+
printJson(await verifyDomain(ctx, direction, a.required("domain")));
|
|
9249
9291
|
},
|
|
9250
9292
|
remove: async (ctx, a) => {
|
|
9251
|
-
|
|
9293
|
+
printJson(await removeDomain(ctx, direction, a.required("domain")));
|
|
9252
9294
|
}
|
|
9253
9295
|
});
|
|
9254
9296
|
var sendingDomains = domainCommands("sending");
|
|
@@ -9369,7 +9411,7 @@ function run2(ctx, route) {
|
|
|
9369
9411
|
return call(
|
|
9370
9412
|
ctx,
|
|
9371
9413
|
"POST",
|
|
9372
|
-
`/_internal/v2/apps/${ctx.appId}/cron/${
|
|
9414
|
+
`/_internal/v2/apps/${ctx.appId}/cron/${encodePathSegment(route)}/run`
|
|
9373
9415
|
);
|
|
9374
9416
|
}
|
|
9375
9417
|
|
|
@@ -9387,10 +9429,10 @@ var cronSpecs = {
|
|
|
9387
9429
|
}
|
|
9388
9430
|
};
|
|
9389
9431
|
async function cronList(ctx, a) {
|
|
9390
|
-
|
|
9432
|
+
printJson(await list15(ctx, { runs: a.num("runs") }));
|
|
9391
9433
|
}
|
|
9392
9434
|
async function cronRun(ctx, a) {
|
|
9393
|
-
|
|
9435
|
+
printJson(await run2(ctx, a.required("route")));
|
|
9394
9436
|
}
|
|
9395
9437
|
var cronHandlers = {
|
|
9396
9438
|
"cron list": cronList,
|
|
@@ -9448,8 +9490,8 @@ var feedbackSpecs = {
|
|
|
9448
9490
|
};
|
|
9449
9491
|
async function feedbackDraft(ctx, a) {
|
|
9450
9492
|
const flag = a.str("message");
|
|
9451
|
-
const message = flag === "-" ? fs7.readFileSync(0, "utf-8") : flag ?? a.
|
|
9452
|
-
|
|
9493
|
+
const message = flag === "-" ? fs7.readFileSync(0, "utf-8") : flag ?? a.required("message");
|
|
9494
|
+
printJson(await draft(ctx, message));
|
|
9453
9495
|
}
|
|
9454
9496
|
var feedbackHandlers = {
|
|
9455
9497
|
"feedback draft": feedbackDraft
|
|
@@ -9586,7 +9628,7 @@ async function waitForPhase(ctx, params) {
|
|
|
9586
9628
|
return {
|
|
9587
9629
|
status: "timeout",
|
|
9588
9630
|
resource,
|
|
9589
|
-
error:
|
|
9631
|
+
error: timeoutMessage(timeoutMs, `; resource is still ${resource.phase}`)
|
|
9590
9632
|
};
|
|
9591
9633
|
}
|
|
9592
9634
|
if (arrived(resource)) {
|
|
@@ -9671,7 +9713,7 @@ async function waitAndReport2(ctx, a, id, phases, summary4, until) {
|
|
|
9671
9713
|
...timeoutSec ? { timeoutMs: Number(timeoutSec) * 1e3 } : {},
|
|
9672
9714
|
onProgress: progress
|
|
9673
9715
|
});
|
|
9674
|
-
|
|
9716
|
+
printJson({ ...summary4, ...result });
|
|
9675
9717
|
if (result.status === "failed") {
|
|
9676
9718
|
throw new CliError(result.error, EXIT.buildFailed);
|
|
9677
9719
|
}
|
|
@@ -9680,18 +9722,20 @@ async function waitAndReport2(ctx, a, id, phases, summary4, until) {
|
|
|
9680
9722
|
}
|
|
9681
9723
|
}
|
|
9682
9724
|
async function infraList(ctx, a) {
|
|
9683
|
-
|
|
9725
|
+
printJson(
|
|
9726
|
+
await list16(ctx, { includeDestroyed: a.bool("include-destroyed") })
|
|
9727
|
+
);
|
|
9684
9728
|
}
|
|
9685
9729
|
async function infraGet(ctx, a) {
|
|
9686
|
-
|
|
9730
|
+
printJson(await get11(ctx, { id: a.required("id") }));
|
|
9687
9731
|
}
|
|
9688
9732
|
var FOLLOW_POLL_MS = 4e3;
|
|
9689
9733
|
async function infraLogs(ctx, a) {
|
|
9690
|
-
const id = a.
|
|
9734
|
+
const id = a.required("id");
|
|
9691
9735
|
const limitRaw = a.str("limit");
|
|
9692
9736
|
const limit = limitRaw ? Number(limitRaw) : void 0;
|
|
9693
9737
|
let { logs: logs2 } = await logs(ctx, { id, ...limit ? { limit } : {} });
|
|
9694
|
-
|
|
9738
|
+
printJson({ logs: logs2 });
|
|
9695
9739
|
if (!a.bool("follow")) {
|
|
9696
9740
|
return;
|
|
9697
9741
|
}
|
|
@@ -9704,7 +9748,7 @@ async function infraLogs(ctx, a) {
|
|
|
9704
9748
|
limit: 500
|
|
9705
9749
|
}));
|
|
9706
9750
|
if (logs2.length > 0) {
|
|
9707
|
-
|
|
9751
|
+
printJson({ logs: logs2 });
|
|
9708
9752
|
after = logs2[logs2.length - 1].id;
|
|
9709
9753
|
}
|
|
9710
9754
|
}
|
|
@@ -9730,7 +9774,7 @@ async function infraProvision(ctx, a) {
|
|
|
9730
9774
|
});
|
|
9731
9775
|
const pricing = pricingOf(resource);
|
|
9732
9776
|
if (!a.bool("wait")) {
|
|
9733
|
-
|
|
9777
|
+
printJson({
|
|
9734
9778
|
resource,
|
|
9735
9779
|
pricing,
|
|
9736
9780
|
note: "Provisioning; poll `infra get <id>` or re-run with --wait."
|
|
@@ -9743,42 +9787,42 @@ async function infraProvision(ctx, a) {
|
|
|
9743
9787
|
});
|
|
9744
9788
|
}
|
|
9745
9789
|
async function infraHibernate(ctx, a) {
|
|
9746
|
-
const id = a.
|
|
9790
|
+
const id = a.required("id");
|
|
9747
9791
|
const { resource } = await hibernate(ctx, { id });
|
|
9748
9792
|
if (!a.bool("wait")) {
|
|
9749
|
-
|
|
9793
|
+
printJson({ resource });
|
|
9750
9794
|
return;
|
|
9751
9795
|
}
|
|
9752
9796
|
await waitAndReport2(ctx, a, id, ["hibernated"], { action: "hibernate" });
|
|
9753
9797
|
}
|
|
9754
9798
|
async function infraResume(ctx, a) {
|
|
9755
|
-
const id = a.
|
|
9799
|
+
const id = a.required("id");
|
|
9756
9800
|
const { resource } = await resume2(ctx, { id });
|
|
9757
9801
|
if (!a.bool("wait")) {
|
|
9758
|
-
|
|
9802
|
+
printJson({ resource });
|
|
9759
9803
|
return;
|
|
9760
9804
|
}
|
|
9761
9805
|
await waitAndReport2(ctx, a, id, ["active"], { action: "resume" });
|
|
9762
9806
|
}
|
|
9763
9807
|
async function infraDestroy(ctx, a) {
|
|
9764
|
-
const id = a.
|
|
9808
|
+
const id = a.required("id");
|
|
9765
9809
|
const { resource } = await destroy(ctx, { id });
|
|
9766
9810
|
if (!a.bool("wait")) {
|
|
9767
|
-
|
|
9811
|
+
printJson({ resource });
|
|
9768
9812
|
return;
|
|
9769
9813
|
}
|
|
9770
9814
|
await waitAndReport2(ctx, a, id, ["destroyed"], { action: "destroy" });
|
|
9771
9815
|
}
|
|
9772
9816
|
async function infraRename(ctx, a) {
|
|
9773
|
-
|
|
9817
|
+
printJson(
|
|
9774
9818
|
await rename(ctx, {
|
|
9775
|
-
id: a.
|
|
9819
|
+
id: a.required("id"),
|
|
9776
9820
|
name: a.str("name")
|
|
9777
9821
|
})
|
|
9778
9822
|
);
|
|
9779
9823
|
}
|
|
9780
9824
|
async function infraResize(ctx, a) {
|
|
9781
|
-
const id = a.
|
|
9825
|
+
const id = a.required("id");
|
|
9782
9826
|
const { resource } = await resize(ctx, {
|
|
9783
9827
|
id,
|
|
9784
9828
|
offeringId: a.str("offering")
|
|
@@ -9788,7 +9832,7 @@ async function infraResize(ctx, a) {
|
|
|
9788
9832
|
offering: resource.resizingTo ?? resource.offering
|
|
9789
9833
|
});
|
|
9790
9834
|
if (!a.bool("wait")) {
|
|
9791
|
-
|
|
9835
|
+
printJson({
|
|
9792
9836
|
resource,
|
|
9793
9837
|
pricing,
|
|
9794
9838
|
note: "Resizing; searches on its sources pause while it is parked and restored. Poll `infra get <id>` or re-run with --wait."
|
|
@@ -9817,9 +9861,11 @@ var infraHandlers = {
|
|
|
9817
9861
|
};
|
|
9818
9862
|
var infraHelp = `remy-admin infra \u2014 Dedicated infrastructure your app leases from the platform.
|
|
9819
9863
|
|
|
9820
|
-
|
|
9821
|
-
for data sources,
|
|
9822
|
-
|
|
9864
|
+
Two kinds, each isolated from the shared pool: \`retrieval\`, the app's own
|
|
9865
|
+
vector-store capacity for data sources, and \`database\`, a database server of
|
|
9866
|
+
the app's own for databases past the shared pool's limit. Sizes and prices come
|
|
9867
|
+
from the platform catalog (\`infra list\` prints them, by kind); nothing is
|
|
9868
|
+
priced client-side.
|
|
9823
9869
|
|
|
9824
9870
|
A resource bills by the clock hour at the active rate for every hour it is
|
|
9825
9871
|
active in, including the hour a resume lands in, and costs nothing while
|
|
@@ -9831,13 +9877,15 @@ audited.
|
|
|
9831
9877
|
|
|
9832
9878
|
Subcommands:
|
|
9833
9879
|
list Resources on this app, plus the offerings you can provision
|
|
9834
|
-
get One resource: billing to date, state timeline, recent log,
|
|
9880
|
+
get One resource: billing to date, state timeline, recent log, what it holds
|
|
9835
9881
|
logs The platform's log for a resource (--follow to keep reading)
|
|
9836
|
-
provision Lease a new resource (needs a month's credits; prints the price
|
|
9837
|
-
|
|
9882
|
+
provision Lease a new resource (needs a month's credits; prints the price;
|
|
9883
|
+
one database server an app)
|
|
9884
|
+
hibernate Park it: data kept, its searches or queries paused, the charge stops
|
|
9838
9885
|
resume Bring a hibernated resource back (needs a month's credits)
|
|
9839
9886
|
resize Change its size, data intact (passes through hibernated)
|
|
9840
|
-
destroy Delete it (refused while data sources are placed on it
|
|
9887
|
+
destroy Delete it (retrieval: refused while data sources are placed on it;
|
|
9888
|
+
database: while a database is too large for the shared pool)
|
|
9841
9889
|
rename Change the display name
|
|
9842
9890
|
|
|
9843
9891
|
Usage:
|
|
@@ -9872,8 +9920,36 @@ Placing a data source on a resource:
|
|
|
9872
9920
|
progress. The messages are written for the app's end user; the stable code
|
|
9873
9921
|
is what to act on.
|
|
9874
9922
|
|
|
9923
|
+
Dedicated databases:
|
|
9924
|
+
A database server takes the app's live databases as it first becomes active,
|
|
9925
|
+
each one let go by the shared pool and served there from then on, under the
|
|
9926
|
+
size's own limit (\`maxDatabaseGiB\` on the offering) in place of the shared
|
|
9927
|
+
pool's. A release the app deploys keeps its databases there. Nothing in the
|
|
9928
|
+
app changes: the same queries, routed to it by the platform. An app has one:
|
|
9929
|
+
a second is refused with database_server_exists (422); resize the one it has.
|
|
9930
|
+
|
|
9931
|
+
Its databases live on the server's own disk and are backed up hourly when
|
|
9932
|
+
they've changed, so \`databases\` on \`infra get\` shows each one's size against
|
|
9933
|
+
its limit, whether it has writes its backup hasn't had (dirty) and when it
|
|
9934
|
+
was last backed up. Sizes read from elsewhere (the dashboard, metering) can
|
|
9935
|
+
run up to an hour behind it; an export or a database download backs up
|
|
9936
|
+
first.
|
|
9937
|
+
|
|
9938
|
+
Parking backs up every database and drops the server's disk, so a parked
|
|
9939
|
+
server costs nothing; queries answer database_lease_parked (503) until it
|
|
9940
|
+
resumes, and a resume downloads each database again. Destroying hands the
|
|
9941
|
+
databases back to the shared pool, so it's refused with
|
|
9942
|
+
resource_holds_large_databases while any is too large for the pool to take
|
|
9943
|
+
back. The check reads each database's file, which deleting rows doesn't
|
|
9944
|
+
shrink, and its backup: delete rows, compact with \`db query\` (VACUUM),
|
|
9945
|
+
then destroy after its next hourly backup, or keep the server.
|
|
9946
|
+
|
|
9875
9947
|
Resizing:
|
|
9876
|
-
A resize
|
|
9948
|
+
A database server's resize parks it, every database backed up, and resumes it
|
|
9949
|
+
at the new size; shrinking is refused below its largest database's file
|
|
9950
|
+
(resize_too_small), which deleting rows doesn't shrink.
|
|
9951
|
+
|
|
9952
|
+
A retrieval resize keeps the documents: the resource is parked, its spec is swapped,
|
|
9877
9953
|
and it comes back up with its sources' indexes rebuilt from durable storage
|
|
9878
9954
|
in the background (nothing is re-embedded). Searches on those sources answer
|
|
9879
9955
|
index_warming until the rebuild lands. A hibernated resource swaps in place
|
|
@@ -9885,8 +9961,9 @@ Phases and timing:
|
|
|
9885
9961
|
requested \u2192 provisioning \u2192 active \u21C4 hibernated \u2192 destroyed, with hibernating /
|
|
9886
9962
|
resuming / decommissioning in between and failed when a change cannot complete
|
|
9887
9963
|
(retried automatically; resume or hibernate to retry by hand). A transition
|
|
9888
|
-
takes a minute or two
|
|
9889
|
-
|
|
9964
|
+
takes a minute or two, but a database server's park backs up every database
|
|
9965
|
+
first, which for a large one takes minutes; the rebuild that follows a
|
|
9966
|
+
retrieval resume runs under its own progress with a measured ETA. --wait gives up only after --timeout (default
|
|
9890
9967
|
600s) WITHOUT movement, so a long rebuild is waited out while it moves.
|
|
9891
9968
|
|
|
9892
9969
|
Billing and the log:
|
|
@@ -10079,7 +10156,7 @@ var qaRecordingsSpecs = {
|
|
|
10079
10156
|
}
|
|
10080
10157
|
};
|
|
10081
10158
|
async function qaRecordingsLs(ctx, a) {
|
|
10082
|
-
|
|
10159
|
+
printJson(
|
|
10083
10160
|
await ls2(ctx, {
|
|
10084
10161
|
sessionId: a.str("session"),
|
|
10085
10162
|
cursor: a.str("cursor"),
|
|
@@ -10110,7 +10187,7 @@ async function qaRecordingsExport(ctx, a) {
|
|
|
10110
10187
|
if (result.status !== "completed") {
|
|
10111
10188
|
fatal(result.error ?? `Export ${result.status}.`);
|
|
10112
10189
|
}
|
|
10113
|
-
|
|
10190
|
+
printJson(result);
|
|
10114
10191
|
}
|
|
10115
10192
|
var qaRecordingsHandlers = {
|
|
10116
10193
|
"qa-recordings ls": qaRecordingsLs,
|
|
@@ -10270,7 +10347,7 @@ import path7 from "node:path";
|
|
|
10270
10347
|
|
|
10271
10348
|
// src/parseJsonConfig.ts
|
|
10272
10349
|
import JSON5 from "json5";
|
|
10273
|
-
function
|
|
10350
|
+
function errorMessage(err) {
|
|
10274
10351
|
return err instanceof Error ? err.message : String(err);
|
|
10275
10352
|
}
|
|
10276
10353
|
function parseJsonConfig(raw) {
|
|
@@ -10278,7 +10355,7 @@ function parseJsonConfig(raw) {
|
|
|
10278
10355
|
try {
|
|
10279
10356
|
return { ok: true, value: JSON.parse(raw), repaired: false };
|
|
10280
10357
|
} catch (err) {
|
|
10281
|
-
strictError =
|
|
10358
|
+
strictError = errorMessage(err);
|
|
10282
10359
|
}
|
|
10283
10360
|
try {
|
|
10284
10361
|
return {
|
|
@@ -10288,7 +10365,7 @@ function parseJsonConfig(raw) {
|
|
|
10288
10365
|
error: strictError
|
|
10289
10366
|
};
|
|
10290
10367
|
} catch (err) {
|
|
10291
|
-
return { ok: false, error:
|
|
10368
|
+
return { ok: false, error: errorMessage(err), notFound: false };
|
|
10292
10369
|
}
|
|
10293
10370
|
}
|
|
10294
10371
|
|
|
@@ -10341,14 +10418,14 @@ Commands:
|
|
|
10341
10418
|
voice Phone numbers, voice call log + transcripts, voice policy settings
|
|
10342
10419
|
agent Agent (chat) conversation log + transcripts
|
|
10343
10420
|
tasks Task agent (runTask) log + transcripts
|
|
10344
|
-
usage What the app costs to run,
|
|
10421
|
+
usage What the app costs to run, and what building it cost
|
|
10345
10422
|
events Realtime events \u2014 live tail, test publish, channel activity
|
|
10346
10423
|
jewels Monitor jewel shadowing; review + approve the proposal queue
|
|
10347
10424
|
settings App settings \u2014 signup allowlist, test accounts, embed origins, toggles
|
|
10348
10425
|
email Email \u2014 delivery log, blast stats, unsubscribes, inbox, custom domains
|
|
10349
10426
|
cron Scheduled jobs \u2014 schedules, run history, manual trigger
|
|
10350
10427
|
feedback Tell the Remy team about a problem or gap in Remy, for the user to review and send
|
|
10351
|
-
infra Dedicated infrastructure \u2014 provision, hibernate, resize + destroy retrieval
|
|
10428
|
+
infra Dedicated infrastructure \u2014 provision, hibernate, resize + destroy retrieval and database servers
|
|
10352
10429
|
qa-recordings Browser-QA session replays \u2014 list them, render one as an mp4
|
|
10353
10430
|
|
|
10354
10431
|
Run 'remy-admin <command> --help' for details on each command.
|
|
@@ -10535,6 +10612,6 @@ async function main() {
|
|
|
10535
10612
|
return HANDLERS[route.key](ctx, a);
|
|
10536
10613
|
}
|
|
10537
10614
|
main().catch((err) => {
|
|
10538
|
-
|
|
10615
|
+
printJson({ error: err?.message ?? String(err) });
|
|
10539
10616
|
process.exitCode = err instanceof CliError ? err.code : EXIT.generic;
|
|
10540
10617
|
});
|