primitive-admin 1.1.0-alpha.82 → 1.1.0-alpha.83
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/documents.js +333 -42
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/functions.js +302 -120
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/locks.js +15 -1
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/sync.d.ts +50 -0
- package/dist/src/commands/sync.js +560 -312
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +75 -2
- package/dist/src/lib/api-client.js +122 -7
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/config-object-descriptor.js +5 -5
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/document-ingest-artifact.d.ts +120 -0
- package/dist/src/lib/document-ingest-artifact.js +505 -0
- package/dist/src/lib/document-ingest-artifact.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +51 -0
- package/dist/src/lib/document-ingest-input.js +132 -0
- package/dist/src/lib/document-ingest-input.js.map +1 -0
- package/dist/src/lib/document-ingest.d.ts +78 -0
- package/dist/src/lib/document-ingest.js +231 -0
- package/dist/src/lib/document-ingest.js.map +1 -0
- package/dist/src/lib/function-bundle.d.ts +6 -0
- package/dist/src/lib/function-bundle.js +8 -0
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +1 -1
- package/dist/src/lib/function-collect.js +16 -0
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +4 -0
- package/dist/src/lib/function-db-types.js +31 -2
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-document-types.d.ts +83 -0
- package/dist/src/lib/function-document-types.js +133 -0
- package/dist/src/lib/function-document-types.js.map +1 -1
- package/dist/src/lib/function-grants-preflight.js +5 -0
- package/dist/src/lib/function-grants-preflight.js.map +1 -1
- package/dist/src/lib/function-log-lines.d.ts +76 -0
- package/dist/src/lib/function-log-lines.js +160 -0
- package/dist/src/lib/function-log-lines.js.map +1 -0
- package/dist/src/lib/function-log-row.d.ts +29 -0
- package/dist/src/lib/function-log-row.js +73 -0
- package/dist/src/lib/function-log-row.js.map +1 -0
- package/dist/src/lib/function-run.d.ts +53 -35
- package/dist/src/lib/function-run.js +55 -44
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +6 -9
- package/dist/src/lib/function-schema-codegen.js +22 -35
- package/dist/src/lib/function-schema-codegen.js.map +1 -1
- package/dist/src/lib/function-sync.d.ts +226 -35
- package/dist/src/lib/function-sync.js +731 -99
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-versions.d.ts +122 -0
- package/dist/src/lib/function-versions.js +182 -0
- package/dist/src/lib/function-versions.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +390 -146
- package/dist/src/lib/generated-config-surfaces.js +1207 -401
- 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/log-inspection.d.ts +2 -0
- package/dist/src/lib/log-inspection.js +4 -0
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/output.d.ts +15 -0
- package/dist/src/lib/output.js +28 -0
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/snapshot-audit-source.d.ts +45 -0
- package/dist/src/lib/snapshot-audit-source.js +58 -0
- package/dist/src/lib/snapshot-audit-source.js.map +1 -0
- package/dist/src/lib/snapshot-audit-store.d.ts +52 -0
- package/dist/src/lib/snapshot-audit-store.js +196 -0
- package/dist/src/lib/snapshot-audit-store.js.map +1 -0
- package/dist/src/lib/snapshot-audit.d.ts +207 -0
- package/dist/src/lib/snapshot-audit.js +431 -0
- package/dist/src/lib/snapshot-audit.js.map +1 -0
- package/dist/src/lib/snapshot-build-rows.d.ts +60 -0
- package/dist/src/lib/snapshot-build-rows.js +87 -0
- package/dist/src/lib/snapshot-build-rows.js.map +1 -0
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +23 -16
- package/dist/src/lib/swift-codegen/functionGenerator.js +34 -33
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +45 -2
- package/dist/src/lib/sync-selectors.js +66 -5
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/package.json +2 -2
|
@@ -849,14 +849,41 @@ export declare class ApiClient {
|
|
|
849
849
|
invokeFunction(appId: string, functionKey: string, body: Record<string, unknown>, options?: {
|
|
850
850
|
bearer?: string;
|
|
851
851
|
asSystem?: boolean;
|
|
852
|
+
/**
|
|
853
|
+
* Which runtime this call means — #3482. The ROUTE is the selector:
|
|
854
|
+
* `POST functions/{key}` runs the function inside the request and
|
|
855
|
+
* `POST functions/{key}/start` runs it as a task. The admin-only system
|
|
856
|
+
* door is ONE route for both, so `--as system` keeps naming its runtime
|
|
857
|
+
* in the body (F-3482-007); phase 7's rename may fold it.
|
|
858
|
+
*/
|
|
859
|
+
runtime?: "request" | "task";
|
|
852
860
|
}): Promise<{
|
|
853
861
|
httpStatus: number;
|
|
854
862
|
retryAfterSeconds: number | null;
|
|
855
863
|
body: any;
|
|
856
864
|
}>;
|
|
857
|
-
|
|
865
|
+
/**
|
|
866
|
+
* A function's versions, newest first (#3462).
|
|
867
|
+
*
|
|
868
|
+
* Paging is opt-in on the server: with no `limit` and no `cursor` every
|
|
869
|
+
* version comes back, which is what this method did before paging existed and
|
|
870
|
+
* what an already-installed CLI still asks for. A caller that passes either
|
|
871
|
+
* gets the shared `{ items, hasMore, nextCursor }` page.
|
|
872
|
+
*/
|
|
873
|
+
listFunctionConfigs(appId: string, functionId: string, options?: {
|
|
874
|
+
limit?: number;
|
|
875
|
+
cursor?: string;
|
|
876
|
+
}): Promise<{
|
|
858
877
|
items: any[];
|
|
878
|
+
hasMore: boolean;
|
|
879
|
+
nextCursor?: string | null;
|
|
859
880
|
}>;
|
|
881
|
+
/**
|
|
882
|
+
* Point the function at one of its OWN existing versions (#3462). Creates no
|
|
883
|
+
* version; the activated version's capabilities, limits and triggers apply
|
|
884
|
+
* from the next call.
|
|
885
|
+
*/
|
|
886
|
+
activateFunctionConfig(appId: string, functionId: string, configId: string): Promise<any>;
|
|
860
887
|
getFunctionConfig(appId: string, functionId: string, configId: string): Promise<any>;
|
|
861
888
|
/**
|
|
862
889
|
* The stored envelope: the authored TOML bytes, every source file and the
|
|
@@ -925,7 +952,11 @@ export declare class ApiClient {
|
|
|
925
952
|
locks: any[];
|
|
926
953
|
}>;
|
|
927
954
|
getLockStatus(appId: string, key: string): Promise<any>;
|
|
928
|
-
|
|
955
|
+
/**
|
|
956
|
+
* #3562 — `owner` is sent only when one was given, so a call that names none
|
|
957
|
+
* composes byte for byte the body it always did.
|
|
958
|
+
*/
|
|
959
|
+
acquireLock(appId: string, key: string, ttlMs: number, owner?: string): Promise<any>;
|
|
929
960
|
releaseLock(appId: string, key: string, handleId: string): Promise<any>;
|
|
930
961
|
listCronTriggers(appId: string): Promise<{
|
|
931
962
|
items: any[];
|
|
@@ -2057,6 +2088,48 @@ export declare class ApiClient {
|
|
|
2057
2088
|
hasMore: boolean;
|
|
2058
2089
|
nextCursor?: string;
|
|
2059
2090
|
}>;
|
|
2091
|
+
/**
|
|
2092
|
+
* A large document's bulk-load sessions, newest first (#3434, criterion 9).
|
|
2093
|
+
*
|
|
2094
|
+
* Read-only, through the document read helper's app-admin arm — the same
|
|
2095
|
+
* door the snapshot readers use. The action verb `documents ingest` is
|
|
2096
|
+
* #3435's; these two are the operator's window onto what a session did.
|
|
2097
|
+
*/
|
|
2098
|
+
listDocumentIngests(appId: string, documentId: string, options?: {
|
|
2099
|
+
limit?: number;
|
|
2100
|
+
cursor?: string;
|
|
2101
|
+
}): Promise<{
|
|
2102
|
+
items: any[];
|
|
2103
|
+
hasMore: boolean;
|
|
2104
|
+
nextCursor?: string;
|
|
2105
|
+
}>;
|
|
2106
|
+
/** One bulk-load session's status (#3434). */
|
|
2107
|
+
getDocumentIngest(appId: string, documentId: string, sessionId: string): Promise<any>;
|
|
2108
|
+
/** Open a bulk-load session on a large document (#3435, criterion 9). */
|
|
2109
|
+
createDocumentIngest(appId: string, documentId: string): Promise<any>;
|
|
2110
|
+
/**
|
|
2111
|
+
* Upload one chunk of a bulk-load session's artifact (#3435).
|
|
2112
|
+
*
|
|
2113
|
+
* `multipart/form-data`: the eight descriptor fields as text parts and the
|
|
2114
|
+
* gzipped bytes as one file part named `chunk`. No `Content-Type` is set on
|
|
2115
|
+
* the request — fetch supplies the boundary, and a header written by hand
|
|
2116
|
+
* would name one the body does not use.
|
|
2117
|
+
*/
|
|
2118
|
+
uploadDocumentIngestChunk(appId: string, documentId: string, sessionId: string, chunk: {
|
|
2119
|
+
model: string;
|
|
2120
|
+
index: number;
|
|
2121
|
+
rows: number;
|
|
2122
|
+
bytes: number;
|
|
2123
|
+
rawBytes: number;
|
|
2124
|
+
sha256: string;
|
|
2125
|
+
firstId: string;
|
|
2126
|
+
lastId: string;
|
|
2127
|
+
body: Buffer;
|
|
2128
|
+
}): Promise<any>;
|
|
2129
|
+
/** Freeze a session's manifest and hand it to the pipeline (#3435). */
|
|
2130
|
+
commitDocumentIngest(appId: string, documentId: string, sessionId: string): Promise<any>;
|
|
2131
|
+
/** Give a session up; allowed until the swap (#3435). */
|
|
2132
|
+
abortDocumentIngest(appId: string, documentId: string, sessionId: string): Promise<any>;
|
|
2060
2133
|
/** One snapshot build with its verification result (#3432). */
|
|
2061
2134
|
getDocumentSnapshot(appId: string, documentId: string, buildId: string): Promise<any>;
|
|
2062
2135
|
/**
|
|
@@ -871,9 +871,12 @@ export class ApiClient {
|
|
|
871
871
|
*/
|
|
872
872
|
async invokeFunction(appId, functionKey, body, options) {
|
|
873
873
|
const credentials = await this.ensureAuthenticated();
|
|
874
|
+
const base = `/app/${appId}/api/functions/${encodeURIComponent(functionKey)}`;
|
|
874
875
|
const path = options?.asSystem
|
|
875
|
-
?
|
|
876
|
-
:
|
|
876
|
+
? `${base}/invoke-as-system`
|
|
877
|
+
: options?.runtime === "task"
|
|
878
|
+
? `${base}/start`
|
|
879
|
+
: base;
|
|
877
880
|
const headers = {
|
|
878
881
|
Authorization: `Bearer ${options?.bearer ?? credentials.accessToken}`,
|
|
879
882
|
"Content-Type": "application/json",
|
|
@@ -907,9 +910,35 @@ export class ApiClient {
|
|
|
907
910
|
body: parsed,
|
|
908
911
|
};
|
|
909
912
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
+
/**
|
|
914
|
+
* A function's versions, newest first (#3462).
|
|
915
|
+
*
|
|
916
|
+
* Paging is opt-in on the server: with no `limit` and no `cursor` every
|
|
917
|
+
* version comes back, which is what this method did before paging existed and
|
|
918
|
+
* what an already-installed CLI still asks for. A caller that passes either
|
|
919
|
+
* gets the shared `{ items, hasMore, nextCursor }` page.
|
|
920
|
+
*/
|
|
921
|
+
async listFunctionConfigs(appId, functionId, options = {}) {
|
|
922
|
+
const query = new URLSearchParams();
|
|
923
|
+
if (options.limit !== undefined)
|
|
924
|
+
query.set("limit", String(options.limit));
|
|
925
|
+
if (options.cursor)
|
|
926
|
+
query.set("cursor", options.cursor);
|
|
927
|
+
const suffix = query.toString() ? `?${query.toString()}` : "";
|
|
928
|
+
const result = await this.get(`/admin/api/apps/${appId}/functions/${functionId}/configs${suffix}`);
|
|
929
|
+
return {
|
|
930
|
+
items: result?.items ?? [],
|
|
931
|
+
hasMore: result?.hasMore === true,
|
|
932
|
+
nextCursor: result?.nextCursor ?? null,
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Point the function at one of its OWN existing versions (#3462). Creates no
|
|
937
|
+
* version; the activated version's capabilities, limits and triggers apply
|
|
938
|
+
* from the next call.
|
|
939
|
+
*/
|
|
940
|
+
async activateFunctionConfig(appId, functionId, configId) {
|
|
941
|
+
return this.post(`/admin/api/apps/${appId}/functions/${functionId}/configs/${configId}/activate`, {});
|
|
913
942
|
}
|
|
914
943
|
async getFunctionConfig(appId, functionId, configId) {
|
|
915
944
|
return this.get(`/admin/api/apps/${appId}/functions/${functionId}/configs/${configId}`);
|
|
@@ -1001,8 +1030,16 @@ export class ApiClient {
|
|
|
1001
1030
|
async getLockStatus(appId, key) {
|
|
1002
1031
|
return this.post(`/app/${appId}/api/locks/status`, { key });
|
|
1003
1032
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1033
|
+
/**
|
|
1034
|
+
* #3562 — `owner` is sent only when one was given, so a call that names none
|
|
1035
|
+
* composes byte for byte the body it always did.
|
|
1036
|
+
*/
|
|
1037
|
+
async acquireLock(appId, key, ttlMs, owner) {
|
|
1038
|
+
return this.post(`/app/${appId}/api/locks/acquire`, {
|
|
1039
|
+
key,
|
|
1040
|
+
ttlMs,
|
|
1041
|
+
...(owner !== undefined ? { owner } : {}),
|
|
1042
|
+
});
|
|
1006
1043
|
}
|
|
1007
1044
|
async releaseLock(appId, key, handleId) {
|
|
1008
1045
|
return this.post(`/app/${appId}/api/locks/release`, {
|
|
@@ -2560,6 +2597,84 @@ export class ApiClient {
|
|
|
2560
2597
|
const query = params.toString();
|
|
2561
2598
|
return this.get(`/app/${appId}/api/documents/${documentId}/snapshots${query ? `?${query}` : ""}`);
|
|
2562
2599
|
}
|
|
2600
|
+
/**
|
|
2601
|
+
* A large document's bulk-load sessions, newest first (#3434, criterion 9).
|
|
2602
|
+
*
|
|
2603
|
+
* Read-only, through the document read helper's app-admin arm — the same
|
|
2604
|
+
* door the snapshot readers use. The action verb `documents ingest` is
|
|
2605
|
+
* #3435's; these two are the operator's window onto what a session did.
|
|
2606
|
+
*/
|
|
2607
|
+
async listDocumentIngests(appId, documentId, options = {}) {
|
|
2608
|
+
const params = new URLSearchParams();
|
|
2609
|
+
if (options.limit !== undefined)
|
|
2610
|
+
params.set("limit", String(options.limit));
|
|
2611
|
+
if (options.cursor)
|
|
2612
|
+
params.set("cursor", options.cursor);
|
|
2613
|
+
const query = params.toString();
|
|
2614
|
+
return this.get(`/app/${appId}/api/documents/${documentId}/ingest${query ? `?${query}` : ""}`);
|
|
2615
|
+
}
|
|
2616
|
+
/** One bulk-load session's status (#3434). */
|
|
2617
|
+
async getDocumentIngest(appId, documentId, sessionId) {
|
|
2618
|
+
return this.get(`/app/${appId}/api/documents/${documentId}/ingest/${encodeURIComponent(sessionId)}`);
|
|
2619
|
+
}
|
|
2620
|
+
/** Open a bulk-load session on a large document (#3435, criterion 9). */
|
|
2621
|
+
async createDocumentIngest(appId, documentId) {
|
|
2622
|
+
return this.post(`/app/${appId}/api/documents/${documentId}/ingest`, {});
|
|
2623
|
+
}
|
|
2624
|
+
/**
|
|
2625
|
+
* Upload one chunk of a bulk-load session's artifact (#3435).
|
|
2626
|
+
*
|
|
2627
|
+
* `multipart/form-data`: the eight descriptor fields as text parts and the
|
|
2628
|
+
* gzipped bytes as one file part named `chunk`. No `Content-Type` is set on
|
|
2629
|
+
* the request — fetch supplies the boundary, and a header written by hand
|
|
2630
|
+
* would name one the body does not use.
|
|
2631
|
+
*/
|
|
2632
|
+
async uploadDocumentIngestChunk(appId, documentId, sessionId, chunk) {
|
|
2633
|
+
const credentials = await this.ensureAuthenticated();
|
|
2634
|
+
const form = new FormData();
|
|
2635
|
+
form.set("model", chunk.model);
|
|
2636
|
+
form.set("index", String(chunk.index));
|
|
2637
|
+
form.set("rows", String(chunk.rows));
|
|
2638
|
+
form.set("bytes", String(chunk.bytes));
|
|
2639
|
+
form.set("rawBytes", String(chunk.rawBytes));
|
|
2640
|
+
form.set("sha256", chunk.sha256);
|
|
2641
|
+
form.set("firstId", chunk.firstId);
|
|
2642
|
+
form.set("lastId", chunk.lastId);
|
|
2643
|
+
form.set("chunk", new Blob([chunk.body]), `${chunk.index}.ndjson.gz`);
|
|
2644
|
+
const headers = {
|
|
2645
|
+
Authorization: `Bearer ${credentials.accessToken}`,
|
|
2646
|
+
};
|
|
2647
|
+
if (credentials.globalAdminAppId) {
|
|
2648
|
+
headers["X-Global-Admin-App-Id"] = credentials.globalAdminAppId;
|
|
2649
|
+
}
|
|
2650
|
+
const url = `${credentials.serverUrl}/app/${appId}/api/documents/${documentId}` +
|
|
2651
|
+
`/ingest/${encodeURIComponent(sessionId)}/chunks`;
|
|
2652
|
+
const response = await fetchWithTLS(url, {
|
|
2653
|
+
method: "POST",
|
|
2654
|
+
headers,
|
|
2655
|
+
body: form,
|
|
2656
|
+
});
|
|
2657
|
+
const text = await response.text();
|
|
2658
|
+
let result = {};
|
|
2659
|
+
try {
|
|
2660
|
+
result = text ? JSON.parse(text) : {};
|
|
2661
|
+
}
|
|
2662
|
+
catch {
|
|
2663
|
+
result = { error: text };
|
|
2664
|
+
}
|
|
2665
|
+
if (!response.ok) {
|
|
2666
|
+
throw new ApiError(result?.error || `Failed to upload chunk: ${response.statusText}`, response.status, result?.code, result?.details);
|
|
2667
|
+
}
|
|
2668
|
+
return result;
|
|
2669
|
+
}
|
|
2670
|
+
/** Freeze a session's manifest and hand it to the pipeline (#3435). */
|
|
2671
|
+
async commitDocumentIngest(appId, documentId, sessionId) {
|
|
2672
|
+
return this.post(`/app/${appId}/api/documents/${documentId}/ingest/${encodeURIComponent(sessionId)}/commit`, {});
|
|
2673
|
+
}
|
|
2674
|
+
/** Give a session up; allowed until the swap (#3435). */
|
|
2675
|
+
async abortDocumentIngest(appId, documentId, sessionId) {
|
|
2676
|
+
return this.post(`/app/${appId}/api/documents/${documentId}/ingest/${encodeURIComponent(sessionId)}/abort`, {});
|
|
2677
|
+
}
|
|
2563
2678
|
/** One snapshot build with its verification result (#3432). */
|
|
2564
2679
|
async getDocumentSnapshot(appId, documentId, buildId) {
|
|
2565
2680
|
return this.get(`/app/${appId}/api/documents/${documentId}/snapshots/${encodeURIComponent(buildId)}`);
|