@opengeni/sdk 0.52.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1078 -33
- package/dist/accounts.d.ts +153 -0
- package/dist/accounts.js +307 -0
- package/dist/accounts.js.map +1 -0
- package/dist/adapters/express.d.ts +31 -0
- package/dist/adapters/express.js +87 -0
- package/dist/adapters/express.js.map +1 -0
- package/dist/adapters/hono.d.ts +16 -0
- package/dist/adapters/hono.js +8 -0
- package/dist/adapters/hono.js.map +1 -0
- package/dist/adapters/next.d.ts +29 -0
- package/dist/adapters/next.js +22 -0
- package/dist/adapters/next.js.map +1 -0
- package/dist/allowance-refusal.d.ts +2 -0
- package/dist/allowance-refusal.js +50 -0
- package/dist/allowance-refusal.js.map +1 -0
- package/dist/artifact-catalog.d.ts +31 -0
- package/dist/artifact-client.d.ts +23 -11
- package/dist/artifacts.d.ts +1 -1
- package/dist/artifacts.js +7 -5
- package/dist/automations-client.d.ts +17 -0
- package/dist/automations.d.ts +3 -0
- package/dist/automations.js +84 -0
- package/dist/automations.js.map +1 -0
- package/dist/browser.d.ts +11 -0
- package/dist/browser.js +47 -0
- package/dist/browser.js.map +1 -0
- package/dist/chat/fold.d.ts +75 -0
- package/dist/chat/handler.d.ts +41 -0
- package/dist/chat/http.d.ts +67 -0
- package/dist/chat/ids.d.ts +34 -0
- package/dist/chat/index.d.ts +9 -0
- package/dist/chat/index.js +1694 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/openai.d.ts +30 -0
- package/dist/chat/opengeni.d.ts +128 -0
- package/dist/chat/types.d.ts +207 -0
- package/dist/chat/vercel.d.ts +49 -0
- package/dist/chats.d.ts +8 -0
- package/dist/{chunk-KIHGPM7H.js → chunk-2UXZUCEZ.js} +309 -46
- package/dist/chunk-2UXZUCEZ.js.map +1 -0
- package/dist/chunk-4SMEOV3P.js +246 -0
- package/dist/chunk-4SMEOV3P.js.map +1 -0
- package/dist/{chunk-FHI4DFIG.js → chunk-AH5D5Q5V.js} +31 -35
- package/dist/chunk-AH5D5Q5V.js.map +1 -0
- package/dist/chunk-APXVSSSY.js +301 -0
- package/dist/chunk-APXVSSSY.js.map +1 -0
- package/dist/chunk-DUVIYER4.js +639 -0
- package/dist/chunk-DUVIYER4.js.map +1 -0
- package/dist/{chunk-ILQZR5N6.js → chunk-FG3OO5LM.js} +3484 -750
- package/dist/chunk-FG3OO5LM.js.map +1 -0
- package/dist/chunk-GZYZT22T.js +260 -0
- package/dist/chunk-GZYZT22T.js.map +1 -0
- package/dist/chunk-HMGADJGZ.js +150 -0
- package/dist/chunk-HMGADJGZ.js.map +1 -0
- package/dist/{chunk-DXDL7EEW.js → chunk-KWADQ227.js} +198 -114
- package/dist/chunk-KWADQ227.js.map +1 -0
- package/dist/chunk-LY2K6ELJ.js +126 -0
- package/dist/chunk-LY2K6ELJ.js.map +1 -0
- package/dist/chunk-MOTJYIYL.js +340 -0
- package/dist/chunk-MOTJYIYL.js.map +1 -0
- package/dist/{chunk-MZWTWOX6.js → chunk-NC57YMUO.js} +447 -3
- package/dist/chunk-NC57YMUO.js.map +1 -0
- package/dist/chunk-RWKB6YZG.js +1270 -0
- package/dist/chunk-RWKB6YZG.js.map +1 -0
- package/dist/chunk-U6CV2SXO.js +195 -0
- package/dist/chunk-U6CV2SXO.js.map +1 -0
- package/dist/chunk-UM4ZXXJR.js +9 -0
- package/dist/chunk-UM4ZXXJR.js.map +1 -0
- package/dist/chunk-V6GIY62B.js +229 -0
- package/dist/chunk-V6GIY62B.js.map +1 -0
- package/dist/chunk-WU6GQG25.js +268 -0
- package/dist/chunk-WU6GQG25.js.map +1 -0
- package/dist/{chunk-VWE2QIVO.js → chunk-XNG7YGR3.js} +23 -6
- package/dist/chunk-XNG7YGR3.js.map +1 -0
- package/dist/{chunk-FRJFNDIR.js → chunk-YIKA2QT4.js} +37 -2
- package/dist/chunk-YIKA2QT4.js.map +1 -0
- package/dist/chunk-ZKPY6YAJ.js +135 -0
- package/dist/chunk-ZKPY6YAJ.js.map +1 -0
- package/dist/client.d.ts +843 -107
- package/dist/codex-realtime-controller.d.ts +6 -0
- package/dist/codex-realtime-controller.js +2 -2
- package/dist/codex-realtime-v3.d.ts +13 -2
- package/dist/company-brain.d.ts +22 -0
- package/dist/company-profile.d.ts +14 -1
- package/dist/core.d.ts +9 -3
- package/dist/core.js +28 -9
- package/dist/deprecation.d.ts +47 -0
- package/dist/desktop.d.ts +8 -0
- package/dist/document-authority-client.d.ts +51 -0
- package/dist/document-authority.d.ts +2 -0
- package/dist/document-authority.js +12 -0
- package/dist/document-authority.js.map +1 -0
- package/dist/editable-artifacts/browser-session.d.ts +7 -3
- package/dist/editable-artifacts/controller.d.ts +4 -1
- package/dist/editable-artifacts/errors.d.ts +1 -1
- package/dist/editable-artifacts/http-live-transport.d.ts +6 -2
- package/dist/editable-artifacts/index.d.ts +2 -0
- package/dist/editable-artifacts/open-failure.d.ts +9 -0
- package/dist/editable-artifacts/types.d.ts +6 -3
- package/dist/editable-artifacts/worker/kernel-adapter.d.ts +1 -1
- package/dist/editable-artifacts-worker.js +44 -17
- package/dist/editable-artifacts-worker.js.map +1 -1
- package/dist/editable-artifacts.js +243 -124
- package/dist/editable-artifacts.js.map +1 -1
- package/dist/embedding-client.d.ts +129 -0
- package/dist/errors.d.ts +36 -1
- package/dist/feedback.d.ts +23 -0
- package/dist/gateway-realtime-transport.d.ts +1 -0
- package/dist/gateway-realtime-transport.js +5 -3
- package/dist/github-repositories.d.ts +10 -0
- package/dist/github-repositories.js +36 -0
- package/dist/github-repositories.js.map +1 -0
- package/dist/index.d.ts +61 -12
- package/dist/index.js +277 -126
- package/dist/index.js.map +1 -1
- package/dist/interaction-revision-stream.d.ts +11 -0
- package/dist/interaction.d.ts +687 -5
- package/dist/interaction.js +32 -1
- package/dist/knowledge.d.ts +7 -0
- package/dist/knowledge.js +20 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/message-links.d.ts +68 -0
- package/dist/model-context.d.ts +68 -0
- package/dist/model-display.d.ts +2 -0
- package/dist/model-display.js +15 -0
- package/dist/model-display.js.map +1 -0
- package/dist/model-picker-order.d.ts +1 -0
- package/dist/model-picker-order.js +10 -0
- package/dist/model-picker-order.js.map +1 -0
- package/dist/organization-integration-policy.d.ts +26 -0
- package/dist/organization-integration-policy.js +26 -0
- package/dist/organization-integration-policy.js.map +1 -0
- package/dist/organization-private-session-settings.d.ts +6 -0
- package/dist/organization-private-session-settings.js +22 -0
- package/dist/organization-private-session-settings.js.map +1 -0
- package/dist/organization-user-setup.d.ts +8 -0
- package/dist/organization-user-setup.js +16 -0
- package/dist/organization-user-setup.js.map +1 -0
- package/dist/pr-review-client.d.ts +16 -0
- package/dist/pr-review.d.ts +4 -0
- package/dist/pr-review.js +62 -0
- package/dist/pr-review.js.map +1 -0
- package/dist/preference-registry.d.ts +9 -1
- package/dist/proxy.d.ts +7 -5
- package/dist/realtime.d.ts +6 -4
- package/dist/realtime.js +10 -6
- package/dist/realtime.js.map +1 -1
- package/dist/retained-artifacts.d.ts +5 -1
- package/dist/session-history-import.d.ts +22 -0
- package/dist/session-history-import.js +36 -0
- package/dist/session-history-import.js.map +1 -0
- package/dist/session-list-entries.d.ts +1 -0
- package/dist/session-list-entries.js +7 -0
- package/dist/session-list-entries.js.map +1 -0
- package/dist/session-message-search.d.ts +53 -0
- package/dist/session-proxy-client.d.ts +24 -0
- package/dist/session-proxy.d.ts +245 -0
- package/dist/session-proxy.js +24 -0
- package/dist/session-proxy.js.map +1 -0
- package/dist/session-titles.d.ts +2 -0
- package/dist/site-browser-entry.d.ts +1 -0
- package/dist/site-browser-runtime.gen.d.ts +1 -0
- package/dist/site-document.d.ts +5 -0
- package/dist/site-document.js +20 -0
- package/dist/site-document.js.map +1 -0
- package/dist/site-document.test.d.ts +1 -0
- package/dist/site-http.d.ts +16 -0
- package/dist/site-tool-bridge.d.ts +44 -0
- package/dist/site.d.ts +101 -0
- package/dist/site.js +49 -0
- package/dist/site.js.map +1 -0
- package/dist/skills.d.ts +75 -0
- package/dist/stream.d.ts +2 -0
- package/dist/tenant-workspaces.d.ts +47 -0
- package/dist/tenant-workspaces.js +8 -0
- package/dist/tenant-workspaces.js.map +1 -0
- package/dist/tool-auth.d.ts +87 -0
- package/dist/tool-auth.js +23 -0
- package/dist/tool-auth.js.map +1 -0
- package/dist/tool-display-metadata.d.ts +3 -0
- package/dist/tools-FXBLUWAE.js +12 -0
- package/dist/tools-FXBLUWAE.js.map +1 -0
- package/dist/tools.d.ts +61 -0
- package/dist/types.d.ts +3048 -406
- package/dist/usage-allowances.d.ts +36 -0
- package/dist/usage-allowances.js +80 -0
- package/dist/usage-allowances.js.map +1 -0
- package/dist/workspace-artifacts.d.ts +33 -5
- package/dist/workspace-instruction-policies.d.ts +24 -2
- package/dist/workspace-integrations.d.ts +74 -0
- package/dist/workspace-integrations.js +65 -0
- package/dist/workspace-integrations.js.map +1 -0
- package/dist/workspace-learning.d.ts +124 -0
- package/dist/workspace-live-stream.d.ts +14 -0
- package/dist/workspace-state.d.ts +8 -71
- package/package.json +108 -3
- package/src/accounts.ts +443 -0
- package/src/adapters/express.ts +136 -0
- package/src/adapters/hono.ts +18 -0
- package/src/adapters/next.ts +42 -0
- package/src/allowance-refusal.ts +5 -0
- package/src/artifact-catalog.ts +41 -0
- package/src/artifact-client.ts +43 -52
- package/src/artifacts.ts +7 -1
- package/src/automations-client.ts +124 -0
- package/src/automations.ts +15 -0
- package/src/browser.ts +54 -0
- package/src/chat/fold.ts +431 -0
- package/src/chat/handler.ts +240 -0
- package/src/chat/http.ts +257 -0
- package/src/chat/ids.ts +85 -0
- package/src/chat/index.ts +87 -0
- package/src/chat/openai.ts +439 -0
- package/src/chat/opengeni.ts +722 -0
- package/src/chat/types.ts +219 -0
- package/src/chat/vercel.ts +204 -0
- package/src/chats.ts +16 -0
- package/src/client.ts +5162 -792
- package/src/codex-realtime-controller.ts +260 -12
- package/src/codex-realtime-lifecycle.ts +1 -0
- package/src/codex-realtime-v3.ts +162 -31
- package/src/codex-realtime.ts +1 -1
- package/src/company-brain.ts +59 -0
- package/src/company-profile.ts +17 -1
- package/src/core.ts +23 -1
- package/src/deprecation.ts +149 -0
- package/src/desktop.ts +11 -1
- package/src/document-authority-client.ts +219 -0
- package/src/document-authority.ts +17 -0
- package/src/editable-artifacts/browser-session.ts +36 -22
- package/src/editable-artifacts/controller.ts +102 -47
- package/src/editable-artifacts/errors.ts +2 -0
- package/src/editable-artifacts/http-live-transport.ts +62 -37
- package/src/editable-artifacts/index.ts +6 -0
- package/src/editable-artifacts/open-failure.ts +79 -0
- package/src/editable-artifacts/storage.ts +31 -40
- package/src/editable-artifacts/types.ts +6 -3
- package/src/editable-artifacts/worker/kernel-adapter.ts +23 -7
- package/src/editable-artifacts/worker/runtime.ts +26 -13
- package/src/editable-artifacts/worker/wire-codec.ts +23 -5
- package/src/embedding-client.ts +519 -0
- package/src/errors.ts +185 -4
- package/src/feedback.ts +20 -0
- package/src/gateway-realtime-transport.ts +253 -110
- package/src/github-repositories.ts +60 -0
- package/src/index.ts +603 -54
- package/src/interaction-revision-stream.ts +117 -0
- package/src/interaction.ts +1367 -51
- package/src/knowledge.ts +72 -0
- package/src/message-links.ts +178 -0
- package/src/model-context.ts +112 -0
- package/src/model-display.ts +10 -0
- package/src/model-picker-order.ts +6 -0
- package/src/organization-integration-policy.ts +54 -0
- package/src/organization-private-session-settings.ts +33 -0
- package/src/organization-user-setup.ts +31 -0
- package/src/pr-review-client.ts +92 -0
- package/src/pr-review.ts +17 -0
- package/src/preference-registry.ts +11 -0
- package/src/proxy.ts +17 -6
- package/src/realtime.ts +15 -4
- package/src/retained-artifacts.ts +101 -0
- package/src/session-history-import.ts +84 -0
- package/src/session-list-entries.ts +1 -0
- package/src/session-message-search.ts +47 -0
- package/src/session-proxy-client.ts +64 -0
- package/src/session-proxy.ts +1473 -0
- package/src/session-titles.ts +10 -0
- package/src/site-browser-entry.ts +6 -0
- package/src/site-browser-runtime.gen.ts +2 -0
- package/src/site-document.test.ts +64 -0
- package/src/site-document.ts +18 -0
- package/src/site-http.ts +162 -0
- package/src/site-tool-bridge.ts +146 -0
- package/src/site.ts +585 -0
- package/src/skills.ts +69 -0
- package/src/sse.ts +8 -2
- package/src/stream.ts +38 -4
- package/src/tenant-workspaces.ts +148 -0
- package/src/tool-auth.ts +301 -0
- package/src/tool-display-metadata.ts +19 -0
- package/src/tools.ts +396 -0
- package/src/types.ts +3607 -493
- package/src/usage-allowances.ts +189 -0
- package/src/workspace-artifacts.ts +40 -6
- package/src/workspace-instruction-policies.ts +26 -1
- package/src/workspace-integrations.ts +402 -0
- package/src/workspace-learning.ts +138 -0
- package/src/workspace-live-stream.ts +137 -0
- package/src/workspace-state.ts +8 -82
- package/dist/chunk-DXDL7EEW.js.map +0 -1
- package/dist/chunk-FHI4DFIG.js.map +0 -1
- package/dist/chunk-FRJFNDIR.js.map +0 -1
- package/dist/chunk-ILQZR5N6.js.map +0 -1
- package/dist/chunk-KIHGPM7H.js.map +0 -1
- package/dist/chunk-MZWTWOX6.js.map +0 -1
- package/dist/chunk-V5F253OG.js +0 -116
- package/dist/chunk-V5F253OG.js.map +0 -1
- package/dist/chunk-VWE2QIVO.js.map +0 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import type { CompanyBrainOkfDownload, CompanyBrainOkfPackage } from "./company-brain";
|
|
2
|
+
import { OpenGeniClient as OpenGeniCoreClient } from "./client";
|
|
3
|
+
import type {
|
|
4
|
+
ApiKey,
|
|
5
|
+
UpdateOrganizationApiKeyRequest,
|
|
6
|
+
Document,
|
|
7
|
+
IssueUserResourceGrantRequest,
|
|
8
|
+
UserResourceGrantMutationResponse,
|
|
9
|
+
DocumentBase,
|
|
10
|
+
FileDownloadUrlResponse,
|
|
11
|
+
DocumentAuthorityReclassification,
|
|
12
|
+
DocumentDefaultCollectionBackfill,
|
|
13
|
+
DocumentDefaultCollectionBackfillAudit,
|
|
14
|
+
GetDocumentDefaultCollectionBackfillAuditOptions,
|
|
15
|
+
ListDocumentAuthorityReclassificationsOptions,
|
|
16
|
+
ListDocumentAuthorityReclassificationsResponse,
|
|
17
|
+
ListDocumentDefaultCollectionBackfillRunsResponse,
|
|
18
|
+
ListOrganizationDocumentAuthorityReclassificationsResponse,
|
|
19
|
+
ReclassifyDocumentAuthorityRequest,
|
|
20
|
+
RunDocumentDefaultCollectionBackfillRequest,
|
|
21
|
+
} from "./types";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Operator-only authority administration and Document tenancy-backfill surface.
|
|
25
|
+
*
|
|
26
|
+
* The public root and legacy `core` clients extend this class for compatibility.
|
|
27
|
+
* Browser consoles that import `@opengeni/sdk/browser` do not retain these
|
|
28
|
+
* methods or their routes.
|
|
29
|
+
*/
|
|
30
|
+
export class OpenGeniDocumentAuthorityClient extends OpenGeniCoreClient {
|
|
31
|
+
/** Read organization-key metadata and policy; never returns the secret token. */
|
|
32
|
+
async getOrganizationApiKey(organizationId: string, apiKeyId: string): Promise<ApiKey> {
|
|
33
|
+
return await this.requestJson<ApiKey>(
|
|
34
|
+
"GET",
|
|
35
|
+
`/v1/organizations/${organizationId}/api-keys/${apiKeyId}`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Update metadata or replace the policy. Policy narrowing applies on the next request. */
|
|
40
|
+
async updateOrganizationApiKey(
|
|
41
|
+
organizationId: string,
|
|
42
|
+
apiKeyId: string,
|
|
43
|
+
request: UpdateOrganizationApiKeyRequest,
|
|
44
|
+
): Promise<ApiKey> {
|
|
45
|
+
return await this.requestJson<ApiKey>(
|
|
46
|
+
"PATCH",
|
|
47
|
+
`/v1/organizations/${organizationId}/api-keys/${apiKeyId}`,
|
|
48
|
+
request,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Issue an exact-session or standing personal-resource grant. */
|
|
53
|
+
async issueUserResourceGrant(
|
|
54
|
+
workspaceId: string,
|
|
55
|
+
authorityId: string,
|
|
56
|
+
request: IssueUserResourceGrantRequest,
|
|
57
|
+
): Promise<UserResourceGrantMutationResponse> {
|
|
58
|
+
return await this.requestJson<UserResourceGrantMutationResponse>(
|
|
59
|
+
"POST",
|
|
60
|
+
`/v1/workspaces/${workspaceId}/user-resource-authorities/${authorityId}/grants`,
|
|
61
|
+
request,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async listDocumentBases(workspaceId: string): Promise<DocumentBase[]> {
|
|
66
|
+
return await this.requestJson<DocumentBase[]>(
|
|
67
|
+
"GET",
|
|
68
|
+
`/v1/workspaces/${workspaceId}/document-bases`,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* List every Document the current human can manage from this workspace,
|
|
74
|
+
* including portable personal and organization-scoped Documents whose
|
|
75
|
+
* immutable ingestion workspace is different.
|
|
76
|
+
*/
|
|
77
|
+
async listAccessibleDocuments(workspaceId: string): Promise<Document[]> {
|
|
78
|
+
return await this.requestJson<Document[]>("GET", `/v1/workspaces/${workspaceId}/documents`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Mint a source-file URL through the Document's effective authority. */
|
|
82
|
+
async createDocumentOriginalFileDownloadUrl(
|
|
83
|
+
workspaceId: string,
|
|
84
|
+
documentId: string,
|
|
85
|
+
): Promise<FileDownloadUrlResponse> {
|
|
86
|
+
return await this.requestJson<FileDownloadUrlResponse>(
|
|
87
|
+
"POST",
|
|
88
|
+
`/v1/workspaces/${workspaceId}/documents/${documentId}/original-file/download-url`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Retry indexing for a failed document. */
|
|
93
|
+
async reindexDocument(
|
|
94
|
+
workspaceId: string,
|
|
95
|
+
baseId: string,
|
|
96
|
+
documentId: string,
|
|
97
|
+
): Promise<Document> {
|
|
98
|
+
return await this.requestJson<Document>(
|
|
99
|
+
"POST",
|
|
100
|
+
`/v1/workspaces/${workspaceId}/document-bases/${baseId}/documents/${documentId}/reindex`,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Permission-filtered Company Brain package with authorized guidance bodies. */
|
|
105
|
+
getCompanyBrain(workspaceId: string): Promise<CompanyBrainOkfPackage> {
|
|
106
|
+
return this.requestJson<CompanyBrainOkfPackage>(
|
|
107
|
+
"GET",
|
|
108
|
+
`/v1/workspaces/${workspaceId}/company-brain`,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Download the deterministic Markdown/YAML Company Brain package. */
|
|
113
|
+
async exportCompanyBrainOkf(workspaceId: string): Promise<CompanyBrainOkfDownload> {
|
|
114
|
+
const response = await this.requestResponse(
|
|
115
|
+
"GET",
|
|
116
|
+
`/v1/workspaces/${workspaceId}/company-brain/export`,
|
|
117
|
+
);
|
|
118
|
+
const headers = response.headers;
|
|
119
|
+
return {
|
|
120
|
+
content: await response.text(),
|
|
121
|
+
contentType: headers.get("content-type") ?? "text/markdown",
|
|
122
|
+
filename: headers.get("content-disposition")?.split('"')[1] ?? "company-brain.okf.md",
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Atomically reclassify a Document's authority and every indexed chunk.
|
|
128
|
+
* The operation is replay-safe and rejects a stale expected authority tuple.
|
|
129
|
+
*/
|
|
130
|
+
async reclassifyDocumentAuthority(
|
|
131
|
+
workspaceId: string,
|
|
132
|
+
documentId: string,
|
|
133
|
+
request: ReclassifyDocumentAuthorityRequest,
|
|
134
|
+
): Promise<DocumentAuthorityReclassification> {
|
|
135
|
+
return await this.requestJson<DocumentAuthorityReclassification>(
|
|
136
|
+
"POST",
|
|
137
|
+
`/v1/workspaces/${workspaceId}/documents/${documentId}/authority-reclassifications`,
|
|
138
|
+
request,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** List the current actor's durable authority-reclassification receipts. */
|
|
143
|
+
async listDocumentAuthorityReclassifications(
|
|
144
|
+
workspaceId: string,
|
|
145
|
+
documentId: string,
|
|
146
|
+
options: ListDocumentAuthorityReclassificationsOptions = {},
|
|
147
|
+
): Promise<ListDocumentAuthorityReclassificationsResponse> {
|
|
148
|
+
const params = new URLSearchParams();
|
|
149
|
+
if (options.limit !== undefined) params.set("limit", String(options.limit));
|
|
150
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
151
|
+
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
152
|
+
return await this.requestJson<ListDocumentAuthorityReclassificationsResponse>(
|
|
153
|
+
"GET",
|
|
154
|
+
`/v1/workspaces/${workspaceId}/documents/${documentId}/authority-reclassifications${query}`,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Advance one resumable, organization-scoped Default collection backfill.
|
|
160
|
+
* Reusing an operation ID is idempotent; keep the run ID across batches.
|
|
161
|
+
*/
|
|
162
|
+
async runDocumentDefaultCollectionBackfill(
|
|
163
|
+
workspaceId: string,
|
|
164
|
+
request: RunDocumentDefaultCollectionBackfillRequest,
|
|
165
|
+
): Promise<DocumentDefaultCollectionBackfill> {
|
|
166
|
+
return await this.requestJson<DocumentDefaultCollectionBackfill>(
|
|
167
|
+
"POST",
|
|
168
|
+
`/v1/workspaces/${workspaceId}/document-default-collection-backfills`,
|
|
169
|
+
request,
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** List organization-scoped Default collection backfill runs (organization admin only). */
|
|
174
|
+
async listDocumentDefaultCollectionBackfillRuns(
|
|
175
|
+
workspaceId: string,
|
|
176
|
+
options: ListDocumentAuthorityReclassificationsOptions = {},
|
|
177
|
+
): Promise<ListDocumentDefaultCollectionBackfillRunsResponse> {
|
|
178
|
+
const params = new URLSearchParams();
|
|
179
|
+
if (options.limit !== undefined) params.set("limit", String(options.limit));
|
|
180
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
181
|
+
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
182
|
+
return await this.requestJson<ListDocumentDefaultCollectionBackfillRunsResponse>(
|
|
183
|
+
"GET",
|
|
184
|
+
`/v1/workspaces/${workspaceId}/document-default-collection-backfills${query}`,
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Read bounded operation and workspace receipts for one Default-collection backfill run. */
|
|
189
|
+
async getDocumentDefaultCollectionBackfillAudit(
|
|
190
|
+
workspaceId: string,
|
|
191
|
+
runId: string,
|
|
192
|
+
options: GetDocumentDefaultCollectionBackfillAuditOptions = {},
|
|
193
|
+
): Promise<DocumentDefaultCollectionBackfillAudit> {
|
|
194
|
+
const params = new URLSearchParams();
|
|
195
|
+
if (options.limit !== undefined) params.set("limit", String(options.limit));
|
|
196
|
+
if (options.operationCursor) params.set("operationCursor", options.operationCursor);
|
|
197
|
+
if (options.receiptCursor) params.set("receiptCursor", options.receiptCursor);
|
|
198
|
+
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
199
|
+
return await this.requestJson<DocumentDefaultCollectionBackfillAudit>(
|
|
200
|
+
"GET",
|
|
201
|
+
`/v1/workspaces/${workspaceId}/document-default-collection-backfills/${runId}${query}`,
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** List organization-wide Document authority changes (organization admin only). */
|
|
206
|
+
async listOrganizationDocumentAuthorityReclassifications(
|
|
207
|
+
workspaceId: string,
|
|
208
|
+
options: ListDocumentAuthorityReclassificationsOptions = {},
|
|
209
|
+
): Promise<ListOrganizationDocumentAuthorityReclassificationsResponse> {
|
|
210
|
+
const params = new URLSearchParams();
|
|
211
|
+
if (options.limit !== undefined) params.set("limit", String(options.limit));
|
|
212
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
213
|
+
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
214
|
+
return await this.requestJson<ListOrganizationDocumentAuthorityReclassificationsResponse>(
|
|
215
|
+
"GET",
|
|
216
|
+
`/v1/workspaces/${workspaceId}/document-authority-reclassifications${query}`,
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { OpenGeniDocumentAuthorityClient } from "./document-authority-client";
|
|
2
|
+
export type {
|
|
3
|
+
DocumentAuthorityReclassification,
|
|
4
|
+
DocumentDefaultCollectionBackfill,
|
|
5
|
+
DocumentDefaultCollectionBackfillAudit,
|
|
6
|
+
DocumentDefaultCollectionBackfillOperationAudit,
|
|
7
|
+
DocumentDefaultCollectionBackfillReceiptAudit,
|
|
8
|
+
DocumentDefaultCollectionBackfillRunAudit,
|
|
9
|
+
GetDocumentDefaultCollectionBackfillAuditOptions,
|
|
10
|
+
ListDocumentAuthorityReclassificationsOptions,
|
|
11
|
+
ListDocumentAuthorityReclassificationsResponse,
|
|
12
|
+
ListDocumentDefaultCollectionBackfillRunsResponse,
|
|
13
|
+
ListOrganizationDocumentAuthorityReclassificationsResponse,
|
|
14
|
+
OrganizationDocumentAuthorityReclassification,
|
|
15
|
+
ReclassifyDocumentAuthorityRequest,
|
|
16
|
+
RunDocumentDefaultCollectionBackfillRequest,
|
|
17
|
+
} from "./types";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { EDITABLE_ARTIFACT_LIVE_WIRE_VERSION } from "@opengeni/contracts/editable-artifact-live";
|
|
2
|
+
import {
|
|
3
|
+
EDITABLE_ARTIFACT_INTENT_PROTOCOL_VERSION,
|
|
4
|
+
currentEditableArtifactCompatibility,
|
|
5
|
+
} from "@opengeni/contracts/editable-artifacts";
|
|
4
6
|
|
|
5
7
|
import type { EditableArtifactCacheAuthority } from "./controller";
|
|
6
8
|
import {
|
|
@@ -10,6 +12,7 @@ import {
|
|
|
10
12
|
import { createEditableArtifactSession, type EditableArtifactSession } from "./session";
|
|
11
13
|
import type { EditableArtifactStoragePort } from "./storage";
|
|
12
14
|
import type { EditableArtifactModality } from "./types";
|
|
15
|
+
import type { EditableArtifactOpenFailureReporter } from "./open-failure";
|
|
13
16
|
import {
|
|
14
17
|
createBrowserEditableArtifactWorkerKernel,
|
|
15
18
|
type CreateBrowserEditableArtifactWorkerKernelOptions,
|
|
@@ -20,10 +23,11 @@ export type EditableArtifactBrowserRuntime = Omit<
|
|
|
20
23
|
"modality" | "kernelVersion" | "protocolVersion" | "modelSchemaVersion" | "commandVersion"
|
|
21
24
|
> &
|
|
22
25
|
Readonly<{
|
|
23
|
-
/** Exact
|
|
26
|
+
/** Exact package/executable build identity; the API records but does not compatibility-gate it. */
|
|
24
27
|
kernelVersion: string;
|
|
25
28
|
modelSchemaVersion: number;
|
|
26
|
-
|
|
29
|
+
/** Exact OGATX001 intent protocol version. */
|
|
30
|
+
protocolVersion: number;
|
|
27
31
|
commandVersion: number;
|
|
28
32
|
}>;
|
|
29
33
|
|
|
@@ -36,11 +40,21 @@ export type CreateBrowserEditableArtifactSessionOptions = Readonly<{
|
|
|
36
40
|
runtime: EditableArtifactBrowserRuntime;
|
|
37
41
|
transport?: Omit<
|
|
38
42
|
CreateEditableArtifactHttpLiveTransportOptions,
|
|
39
|
-
|
|
43
|
+
| "baseUrl"
|
|
44
|
+
| "workspaceId"
|
|
45
|
+
| "modality"
|
|
46
|
+
| "liveProtocolVersion"
|
|
47
|
+
| "kernelVersion"
|
|
48
|
+
| "modelSchemaVersion"
|
|
49
|
+
| "snapshotVersion"
|
|
50
|
+
| "commandProtocolVersion"
|
|
51
|
+
| "committedTransactionProtocolVersion"
|
|
40
52
|
>;
|
|
41
53
|
storage?: EditableArtifactStoragePort;
|
|
42
54
|
/** Reuse the replica used to create the artifact when opening it immediately. */
|
|
43
55
|
replicaId?: string;
|
|
56
|
+
/** Receives bounded categories/codes only; never workbook or formula content. */
|
|
57
|
+
onOpenFailure?: EditableArtifactOpenFailureReporter;
|
|
44
58
|
}>;
|
|
45
59
|
|
|
46
60
|
/**
|
|
@@ -53,17 +67,23 @@ export function createBrowserEditableArtifactSession(
|
|
|
53
67
|
const baseUrl = canonicalBaseUrl(options.baseUrl);
|
|
54
68
|
const workspaceId = boundedIdentity(options.workspaceId, "workspaceId");
|
|
55
69
|
assertCacheAuthority(options.storageAuthority, baseUrl, workspaceId);
|
|
56
|
-
const protocolVersion = positiveVersion(options.runtime.protocolVersion
|
|
70
|
+
const protocolVersion = positiveVersion(options.runtime.protocolVersion, "protocolVersion");
|
|
71
|
+
if (protocolVersion !== EDITABLE_ARTIFACT_INTENT_PROTOCOL_VERSION) {
|
|
72
|
+
throw new TypeError("protocolVersion is incompatible with the current intent protocol");
|
|
73
|
+
}
|
|
57
74
|
const modelSchemaVersion = positiveVersion(
|
|
58
75
|
options.runtime.modelSchemaVersion,
|
|
59
76
|
"modelSchemaVersion",
|
|
60
77
|
);
|
|
61
78
|
const kernelVersion = boundedIdentity(options.runtime.kernelVersion, "kernelVersion", 512);
|
|
62
79
|
const commandVersion = positiveVersion(options.runtime.commandVersion, "commandVersion");
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
80
|
+
const current = currentEditableArtifactCompatibility(options.artifact.modality);
|
|
81
|
+
if (
|
|
82
|
+
modelSchemaVersion !== current.modelSchemaVersion ||
|
|
83
|
+
commandVersion !== current.commandProtocolVersion
|
|
84
|
+
) {
|
|
65
85
|
throw new TypeError(
|
|
66
|
-
`
|
|
86
|
+
`runtime versions are incompatible with current ${options.artifact.modality} compatibility`,
|
|
67
87
|
);
|
|
68
88
|
}
|
|
69
89
|
const {
|
|
@@ -87,9 +107,13 @@ export function createBrowserEditableArtifactSession(
|
|
|
87
107
|
...options.transport,
|
|
88
108
|
baseUrl,
|
|
89
109
|
workspaceId,
|
|
90
|
-
|
|
110
|
+
modality: options.artifact.modality,
|
|
111
|
+
liveProtocolVersion: EDITABLE_ARTIFACT_LIVE_WIRE_VERSION,
|
|
91
112
|
kernelVersion,
|
|
92
113
|
modelSchemaVersion,
|
|
114
|
+
snapshotVersion: current.snapshotVersion,
|
|
115
|
+
commandProtocolVersion: current.commandProtocolVersion,
|
|
116
|
+
committedTransactionProtocolVersion: current.committedTransactionProtocolVersion,
|
|
93
117
|
});
|
|
94
118
|
return createEditableArtifactSession({
|
|
95
119
|
artifactId: options.artifact.id,
|
|
@@ -102,6 +126,7 @@ export function createBrowserEditableArtifactSession(
|
|
|
102
126
|
modelSchemaVersion,
|
|
103
127
|
commandVersion,
|
|
104
128
|
protocolVersion,
|
|
129
|
+
...(options.onOpenFailure ? { onOpenFailure: options.onOpenFailure } : {}),
|
|
105
130
|
...(replicaId ? { writerReplicaIdFactory: () => replicaId } : {}),
|
|
106
131
|
ownsWorker: true,
|
|
107
132
|
});
|
|
@@ -121,17 +146,6 @@ export function createEditableArtifactReplicaId(): string {
|
|
|
121
146
|
}
|
|
122
147
|
}
|
|
123
148
|
|
|
124
|
-
function commandVersionFor(modality: EditableArtifactModality): number {
|
|
125
|
-
switch (modality) {
|
|
126
|
-
case "spreadsheet":
|
|
127
|
-
return SPREADSHEET_ARTIFACT_COMMAND_VERSION;
|
|
128
|
-
case "document":
|
|
129
|
-
return DOCUMENT_ARTIFACT_COMMAND_VERSION;
|
|
130
|
-
case "presentation":
|
|
131
|
-
return PRESENTATION_ARTIFACT_COMMAND_VERSION;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
149
|
function canonicalBaseUrl(value: string | URL): URL {
|
|
136
150
|
const url = new URL(value);
|
|
137
151
|
if (url.username || url.password || url.search || url.hash) {
|