primitive-admin 1.2.0-alpha.3 → 1.2.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/commands/agent-sessions.js +4 -0
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/databases.js +13 -38
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +1 -1
- package/dist/src/commands/documents.js +70 -33
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/prompts.d.ts +7 -0
- package/dist/src/commands/prompts.js +44 -0
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/sync.d.ts +12 -29
- package/dist/src/commands/sync.js +128 -138
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/lib/aggregate-output.d.ts +25 -0
- package/dist/src/lib/aggregate-output.js +53 -0
- package/dist/src/lib/aggregate-output.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +29 -16
- package/dist/src/lib/api-client.js +30 -28
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/config-object-descriptor.js +14 -5
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/db-codegen/dbGenerator.js +5 -16
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +3 -12
- package/dist/src/lib/db-codegen/dbNaming.js +3 -16
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +7 -56
- package/dist/src/lib/db-codegen/dbTemplates.js +25 -125
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +1 -1
- package/dist/src/lib/function-sync.d.ts +3 -16
- package/dist/src/lib/function-sync.js +14 -18
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +172 -47
- package/dist/src/lib/generated-config-surfaces.js +599 -90
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/prompt-schema-codegen.js +5 -2
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +4 -3
- package/dist/src/lib/swift-codegen/dbGenerator.js +14 -117
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/generator.d.ts +5 -5
- package/dist/src/lib/swift-codegen/generator.js +8 -13
- package/dist/src/lib/swift-codegen/generator.js.map +1 -1
- package/dist/src/lib/workflow-codegen/generator.d.ts +7 -7
- package/dist/src/lib/workflow-codegen/generator.js +16 -23
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +6 -12
- package/dist/src/lib/workflow-codegen/invokerIR.js +4 -5
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
- package/dist/src/lib/workflow-toml-validator.d.ts +2 -0
- package/dist/src/lib/workflow-toml-validator.js +13 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/package.json +2 -2
|
@@ -4,6 +4,7 @@ import { ingestClientRows, ingestSessionRows, } from "../lib/document-ingest-row
|
|
|
4
4
|
import { ApiClient } from "../lib/api-client.js";
|
|
5
5
|
import { resolveAppId } from "../lib/config.js";
|
|
6
6
|
import { success, error, info, formatTable, formatId, formatDate, json, keyValue, result as printResult, warn, flushOutput, } from "../lib/output.js";
|
|
7
|
+
import { renderAggregateResult } from "../lib/aggregate-output.js";
|
|
7
8
|
import { confirmPrompt } from "../lib/confirm-prompt.js";
|
|
8
9
|
import { resolveOwnerUserId } from "../lib/resolve-owner.js";
|
|
9
10
|
import { pageCursorOption, pageLimitOption, parsePageLimit, printEmptyPage, printPageHint, } from "../lib/list-options.js";
|
|
@@ -57,7 +58,8 @@ export function describeRecordsFailure(err) {
|
|
|
57
58
|
return `${message}${code ? ` [${code}]` : ""}${status !== undefined ? ` (${status})` : ""}`;
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
|
-
* Report a document's format (#2816) — but only when it is a large
|
|
61
|
+
* Report a document's format (#2816) — but only when it is a large (2) or a
|
|
62
|
+
* record-log (3, #4306) document.
|
|
61
63
|
*
|
|
62
64
|
* The format is chosen at creation and never migrated, so an operator has to
|
|
63
65
|
* be able to read it back: `--large` that the server ignored would otherwise
|
|
@@ -66,9 +68,13 @@ export function describeRecordsFailure(err) {
|
|
|
66
68
|
* stored row spells the format (absent, null or 1).
|
|
67
69
|
*/
|
|
68
70
|
function printDocumentFormat(doc) {
|
|
69
|
-
|
|
71
|
+
const format = Number(doc?.documentFormat);
|
|
72
|
+
if (format === 2) {
|
|
70
73
|
keyValue("Format", "2 (large document)");
|
|
71
74
|
}
|
|
75
|
+
else if (format === 3) {
|
|
76
|
+
keyValue("Format", "3 (record log)");
|
|
77
|
+
}
|
|
72
78
|
}
|
|
73
79
|
/**
|
|
74
80
|
* The `--document-format` an operator stated, or the refusal (#3764, E10).
|
|
@@ -86,12 +92,14 @@ export function parseDocumentFormatOption(value) {
|
|
|
86
92
|
return 1;
|
|
87
93
|
if (text === "2")
|
|
88
94
|
return 2;
|
|
95
|
+
if (text === "3")
|
|
96
|
+
return 3;
|
|
89
97
|
throw new Error(`Invalid --document-format "${String(value)}". Expected 1 (an ordinary ` +
|
|
90
|
-
`document)
|
|
98
|
+
`document), 2 (a large document) or 3 (a record-log document).`);
|
|
91
99
|
}
|
|
92
|
-
/** The `--document-format <1|2>` flag, said once for every records verb. */
|
|
93
|
-
const DOCUMENT_FORMAT_FLAG = "--document-format <1|2>";
|
|
94
|
-
const DOCUMENT_FORMAT_HELP = "The document format you expect: 1 (ordinary)
|
|
100
|
+
/** The `--document-format <1|2|3>` flag, said once for every records verb. */
|
|
101
|
+
const DOCUMENT_FORMAT_FLAG = "--document-format <1|2|3>";
|
|
102
|
+
const DOCUMENT_FORMAT_HELP = "The document format you expect: 1 (ordinary), 2 (large) or 3 (record log). A disagreement " +
|
|
95
103
|
"with the platform's own answer is refused with DOCUMENT_FORMAT_MISMATCH " +
|
|
96
104
|
"rather than answered out of the wrong tables";
|
|
97
105
|
/**
|
|
@@ -882,35 +890,18 @@ Permissions (enforced by the server, not the CLI):
|
|
|
882
890
|
json(response);
|
|
883
891
|
return;
|
|
884
892
|
}
|
|
885
|
-
|
|
886
|
-
//
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
:
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
if (groupBy.length === 0) {
|
|
895
|
-
const value = (aggregated ?? {})[options.op === "count" ? "count" : `${options.op}_${options.field}`];
|
|
896
|
-
keyValue(scalarLabel, value === null || value === undefined ? "—" : String(value));
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
if (aggregated &&
|
|
900
|
-
typeof aggregated === "object" &&
|
|
901
|
-
!Array.isArray(aggregated) &&
|
|
902
|
-
Object.values(aggregated).every((v) => typeof v !== "object" || v === null)) {
|
|
903
|
-
const rows = Object.entries(aggregated).map(([group, value]) => ({
|
|
904
|
-
group,
|
|
905
|
-
value: value === null || value === undefined ? "—" : String(value),
|
|
906
|
-
}));
|
|
907
|
-
console.log(formatTable(rows, [
|
|
908
|
-
{ header: "GROUP", key: "group" },
|
|
909
|
-
{ header: valueLabel, key: "value" },
|
|
910
|
-
]));
|
|
893
|
+
// The route answers rows (#4265): one key/value line when
|
|
894
|
+
// ungrouped, a table with one column per group key when grouped.
|
|
895
|
+
const rendered = renderAggregateResult(response?.result, {
|
|
896
|
+
groupBy,
|
|
897
|
+
op: options.op,
|
|
898
|
+
field: options.field,
|
|
899
|
+
});
|
|
900
|
+
if (rendered.kind === "scalar") {
|
|
901
|
+
keyValue(rendered.label, rendered.value);
|
|
911
902
|
}
|
|
912
903
|
else {
|
|
913
|
-
console.log(
|
|
904
|
+
console.log(rendered.text);
|
|
914
905
|
}
|
|
915
906
|
}
|
|
916
907
|
catch (err) {
|
|
@@ -1189,6 +1180,52 @@ Permissions (enforced by the server, not the CLI):
|
|
|
1189
1180
|
process.exit(1);
|
|
1190
1181
|
}
|
|
1191
1182
|
});
|
|
1183
|
+
// #4306 — a record-log document's room: the inspection route's payload.
|
|
1184
|
+
documents
|
|
1185
|
+
.command("inspect")
|
|
1186
|
+
.description("Show a record-log document's room: epochs, log number, floors, writers and checkpoint")
|
|
1187
|
+
.argument("<document-id>", "Document ID")
|
|
1188
|
+
.option("--app <app-id>", "App ID")
|
|
1189
|
+
.option("--json", "Output as JSON")
|
|
1190
|
+
.action(async (documentId, options) => {
|
|
1191
|
+
const resolvedAppId = resolveAppId(undefined, options);
|
|
1192
|
+
const client = new ApiClient();
|
|
1193
|
+
try {
|
|
1194
|
+
const result = await client.getDocumentRoom(resolvedAppId, documentId);
|
|
1195
|
+
if (options.json) {
|
|
1196
|
+
json(result);
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
keyValue("Document ID", result.documentId);
|
|
1200
|
+
printDocumentFormat(result);
|
|
1201
|
+
const room = result.room;
|
|
1202
|
+
if (!room) {
|
|
1203
|
+
keyValue("Room", `no record room (format ${result.documentFormat ?? 1})`);
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
keyValue("Log number", room.lsn);
|
|
1207
|
+
keyValue("Epochs", `current ${room.epochs.current}, next ${room.epochs.next}, high ${room.epochs.high}`);
|
|
1208
|
+
keyValue("Epoch floor", room.epochs.floor);
|
|
1209
|
+
keyValue("Cursor floor", room.cursorFloor);
|
|
1210
|
+
keyValue("Entries since rotation", room.epochs.entriesSinceRotation);
|
|
1211
|
+
keyValue("Rotated", room.epochs.rotatedAt ? formatDate(room.epochs.rotatedAt) : "—");
|
|
1212
|
+
keyValue("Writers", `${room.writers.count} (${room.writers.connected} connected)`);
|
|
1213
|
+
keyValue("Subscribers", room.subscribers);
|
|
1214
|
+
keyValue("Held entries", room.held.entries);
|
|
1215
|
+
keyValue("Load", room.load ? JSON.stringify(room.load) : "none");
|
|
1216
|
+
keyValue("Last checkpoint", room.checkpoint
|
|
1217
|
+
? `${formatDate(room.checkpoint.at)} (${room.checkpoint.durationMs} ms, ` +
|
|
1218
|
+
`${room.checkpoint.pruned} pruned, ${room.checkpoint.dropped} dropped, ` +
|
|
1219
|
+
`${room.checkpoint.writersDropped} writers dropped)`
|
|
1220
|
+
: "none yet");
|
|
1221
|
+
keyValue("Next alarm", room.nextAlarmAt ? formatDate(room.nextAlarmAt) : "—");
|
|
1222
|
+
keyValue("Storage (bytes)", room.storage?.databaseSize ?? "—");
|
|
1223
|
+
}
|
|
1224
|
+
catch (err) {
|
|
1225
|
+
error(err.message);
|
|
1226
|
+
process.exit(1);
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1192
1229
|
// The action verb (#3435, criterion 9): a directory of records becomes a
|
|
1193
1230
|
// chunked, digested, uploaded artifact and one atomic swap of the
|
|
1194
1231
|
// document's tables. `documents ingests list|get` below is how an operator
|