@lucern/sdk 0.2.0-alpha.6 → 0.2.0-alpha.7
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/.turbo/turbo-build.log +7 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +13 -0
- package/examples/README.md +69 -0
- package/examples/contradiction.ts +94 -0
- package/examples/investigation-context.ts +118 -0
- package/examples/questions-and-tasks.ts +55 -0
- package/examples/quickstart.ts +97 -0
- package/examples/shared.ts +318 -0
- package/examples/strict-public-types.ts +143 -0
- package/examples/worktree-lifecycle.ts +79 -0
- package/package.json +16 -58
- package/src/README.md +6 -0
- package/src/adminClient.ts +789 -0
- package/{dist/lib/platform/sdk/answersClient.d.ts → src/answersClient.ts} +17 -4
- package/src/audiencesClient.ts +209 -0
- package/src/auditClient.ts +50 -0
- package/src/beliefsClient.ts +319 -0
- package/src/client.ts +2647 -0
- package/src/contextClient.ts +130 -0
- package/{dist/lib/platform/sdk/contextFacade.d.ts → src/contextFacade.ts} +6 -1
- package/src/contextPackCompiler.ts +828 -0
- package/src/contextPackSchema.ts +251 -0
- package/src/contextTypes.ts +153 -0
- package/src/contracts/api-enums.contract.ts +202 -0
- package/src/contracts/auth-session.contract.ts +109 -0
- package/src/contracts/context-pack.contract.ts +700 -0
- package/src/contracts/contextPack.ts +1 -0
- package/src/contracts/index.ts +10 -0
- package/src/contracts/lens-filter.contract.ts +183 -0
- package/src/contracts/lens-workflow.contract.ts +162 -0
- package/src/contracts/lensFilter.ts +1 -0
- package/src/contracts/lensWorkflow.ts +1 -0
- package/src/contracts/mcp-tools.contract.ts +3636 -0
- package/src/contracts/mcpTools.ts +1 -0
- package/src/contracts/prompt.contract.ts +50 -0
- package/src/contracts/prompt.ts +1 -0
- package/src/contracts/sdk-tools.contract.ts +1457 -0
- package/src/contracts/sdkTools.ts +1 -0
- package/src/contracts/workflow-runtime.contract.ts +440 -0
- package/src/contracts/workflowRuntime.ts +1 -0
- package/src/controlObjectOwnership.ts +286 -0
- package/src/coreClient.ts +570 -0
- package/src/customTools.ts +398 -0
- package/src/decisionsClient.ts +286 -0
- package/src/domainContext.ts +15 -0
- package/src/events.ts +531 -0
- package/src/eventsCore.ts +168 -0
- package/src/facade/beliefs.ts +83 -0
- package/src/facade/context.ts +110 -0
- package/src/facade/contradictions.ts +29 -0
- package/src/facade/edges.ts +30 -0
- package/src/facade/events.ts +23 -0
- package/src/facade/evidence.ts +41 -0
- package/src/facade/graph.ts +38 -0
- package/src/facade/identity.ts +16 -0
- package/src/facade/ontologies.ts +34 -0
- package/src/facade/questions.ts +59 -0
- package/src/facade/search.ts +16 -0
- package/src/facade/tasks.ts +37 -0
- package/src/facade/topics.ts +42 -0
- package/src/facade/webhooks.ts +58 -0
- package/src/facade/worktrees.ts +51 -0
- package/src/gatewayFacades.ts +1666 -0
- package/src/graphClient.ts +529 -0
- package/src/harnessClient.ts +585 -0
- package/src/identityClient.ts +278 -0
- package/src/learningClient.ts +95 -0
- package/src/mcpParityClient.ts +240 -0
- package/src/mcpParitySurface.ts +70 -0
- package/src/ontologyClient.ts +275 -0
- package/src/packRuntime.ts +3 -0
- package/src/packsClient.ts +260 -0
- package/src/policyClient.ts +572 -0
- package/src/realtime/index.ts +51 -0
- package/src/realtime/refs.ts +17 -0
- package/src/reportsClient.ts +99 -0
- package/src/schemaClient.ts +129 -0
- package/src/sdkSurface.ts +190 -0
- package/src/topicsClient.ts +243 -0
- package/src/types.ts +807 -0
- package/src/workflowClient.ts +826 -0
- package/tsconfig.json +9 -0
- package/dist/.generated +0 -2
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/lib/platform/auth/credentials.d.ts +0 -5
- package/dist/lib/platform/auth/credentials.js +0 -40
- package/dist/lib/platform/sdk/adminClient.d.ts +0 -404
- package/dist/lib/platform/sdk/adminClient.js +0 -384
- package/dist/lib/platform/sdk/answersClient.js +0 -21
- package/dist/lib/platform/sdk/audiencesClient.d.ts +0 -93
- package/dist/lib/platform/sdk/audiencesClient.js +0 -111
- package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
- package/dist/lib/platform/sdk/auditClient.js +0 -21
- package/dist/lib/platform/sdk/beliefsClient.d.ts +0 -157
- package/dist/lib/platform/sdk/beliefsClient.js +0 -124
- package/dist/lib/platform/sdk/client.d.ts +0 -2369
- package/dist/lib/platform/sdk/client.js +0 -1831
- package/dist/lib/platform/sdk/contextClient.d.ts +0 -21
- package/dist/lib/platform/sdk/contextClient.js +0 -86
- package/dist/lib/platform/sdk/contextFacade.js +0 -10
- package/dist/lib/platform/sdk/contextPackCompiler.d.ts +0 -100
- package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
- package/dist/lib/platform/sdk/contextTypes.d.ts +0 -133
- package/dist/lib/platform/sdk/contextTypes.js +0 -1
- package/dist/lib/platform/sdk/controlObjectOwnership.d.ts +0 -308
- package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
- package/dist/lib/platform/sdk/coreClient.d.ts +0 -139
- package/dist/lib/platform/sdk/coreClient.js +0 -366
- package/dist/lib/platform/sdk/customTools.d.ts +0 -83
- package/dist/lib/platform/sdk/customTools.js +0 -247
- package/dist/lib/platform/sdk/decisionsClient.d.ts +0 -106
- package/dist/lib/platform/sdk/decisionsClient.js +0 -129
- package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
- package/dist/lib/platform/sdk/domainContext.js +0 -1
- package/dist/lib/platform/sdk/events.d.ts +0 -176
- package/dist/lib/platform/sdk/events.js +0 -261
- package/dist/lib/platform/sdk/eventsCore.d.ts +0 -13
- package/dist/lib/platform/sdk/eventsCore.js +0 -13
- package/dist/lib/platform/sdk/gatewayFacades.d.ts +0 -586
- package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
- package/dist/lib/platform/sdk/graphClient.d.ts +0 -266
- package/dist/lib/platform/sdk/graphClient.js +0 -235
- package/dist/lib/platform/sdk/harnessClient.d.ts +0 -309
- package/dist/lib/platform/sdk/harnessClient.js +0 -219
- package/dist/lib/platform/sdk/identityClient.d.ts +0 -134
- package/dist/lib/platform/sdk/identityClient.js +0 -131
- package/dist/lib/platform/sdk/index.js +0 -49
- package/dist/lib/platform/sdk/learningClient.d.ts +0 -40
- package/dist/lib/platform/sdk/learningClient.js +0 -53
- package/dist/lib/platform/sdk/mcpParityClient.d.ts +0 -69
- package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
- package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
- package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
- package/dist/lib/platform/sdk/ontologyClient.d.ts +0 -131
- package/dist/lib/platform/sdk/ontologyClient.js +0 -161
- package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
- package/dist/lib/platform/sdk/packRuntime.js +0 -1
- package/dist/lib/platform/sdk/packsClient.d.ts +0 -126
- package/dist/lib/platform/sdk/packsClient.js +0 -157
- package/dist/lib/platform/sdk/policyClient.d.ts +0 -293
- package/dist/lib/platform/sdk/policyClient.js +0 -277
- package/dist/lib/platform/sdk/promptCatalog.js +0 -1
- package/dist/lib/platform/sdk/reportsClient.d.ts +0 -34
- package/dist/lib/platform/sdk/reportsClient.js +0 -64
- package/dist/lib/platform/sdk/schemaClient.d.ts +0 -59
- package/dist/lib/platform/sdk/schemaClient.js +0 -71
- package/dist/lib/platform/sdk/sdkSurface.d.ts +0 -56
- package/dist/lib/platform/sdk/sdkSurface.js +0 -140
- package/dist/lib/platform/sdk/topicsClient.d.ts +0 -78
- package/dist/lib/platform/sdk/topicsClient.js +0 -118
- package/dist/lib/platform/sdk/types.d.ts +0 -692
- package/dist/lib/platform/sdk/types.js +0 -1
- package/dist/lib/platform/sdk/version.d.ts +0 -2
- package/dist/lib/platform/sdk/workflowClient.d.ts +0 -313
- package/dist/lib/platform/sdk/workflowClient.js +0 -366
- package/dist/lucern/contracts/src/api-enums.contract.d.ts +0 -58
- package/dist/lucern/contracts/src/api-enums.contract.js +0 -147
- package/dist/lucern/contracts/src/auth-context.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/auth-context.contract.js +0 -8
- package/dist/lucern/contracts/src/auth-session.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/auth-session.contract.js +0 -8
- package/dist/lucern/contracts/src/auth.contract.d.ts +0 -88
- package/dist/lucern/contracts/src/auth.contract.js +0 -57
- package/dist/lucern/contracts/src/context-pack.contract.d.ts +0 -494
- package/dist/lucern/contracts/src/context-pack.contract.js +0 -169
- package/dist/lucern/contracts/src/convex-admin.contract.d.ts +0 -5
- package/dist/lucern/contracts/src/convex-admin.contract.js +0 -1
- package/dist/lucern/contracts/src/events-types.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/events-types.contract.js +0 -8
- package/dist/lucern/contracts/src/events.contract.d.ts +0 -176
- package/dist/lucern/contracts/src/events.contract.js +0 -159
- package/dist/lucern/contracts/src/gateway.contract.d.ts +0 -74
- package/dist/lucern/contracts/src/gateway.contract.js +0 -19
- package/dist/lucern/contracts/src/ids.contract.d.ts +0 -7
- package/dist/lucern/contracts/src/ids.contract.js +0 -24
- package/dist/lucern/contracts/src/index.d.ts +0 -29
- package/dist/lucern/contracts/src/index.js +0 -29
- package/dist/lucern/contracts/src/lens-filter.contract.d.ts +0 -70
- package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
- package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
- package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
- package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
- package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
- package/dist/lucern/contracts/src/ontology-matching.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/ontology-matching.contract.js +0 -8
- package/dist/lucern/contracts/src/prompt.contract.d.ts +0 -24
- package/dist/lucern/contracts/src/prompt.contract.js +0 -24
- package/dist/lucern/contracts/src/sdk-methods.contract.d.ts +0 -358
- package/dist/lucern/contracts/src/sdk-methods.contract.js +0 -19
- package/dist/lucern/contracts/src/sdk-tools.contract.d.ts +0 -92
- package/dist/lucern/contracts/src/sdk-tools.contract.js +0 -1398
- package/dist/lucern/contracts/src/text-matching.contract.d.ts +0 -53
- package/dist/lucern/contracts/src/text-matching.contract.js +0 -277
- package/dist/lucern/contracts/src/topic-scope.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/topic-scope.contract.js +0 -8
- package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +0 -161
- package/dist/lucern/contracts/src/workflow-runtime.contract.js +0 -257
- package/dist/realtime-refs.d.ts +0 -1
- package/dist/realtime-refs.js +0 -1
- package/dist/realtime.d.ts +0 -1
- package/dist/realtime.js +0 -1
- /package/{dist/lib/platform/sdk/index.d.ts → src/index.ts} +0 -0
- /package/{dist/lib/platform/sdk/promptCatalog.d.ts → src/promptCatalog.ts} +0 -0
- /package/{dist/lib/platform/sdk/version.js → src/version.ts} +0 -0
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
/** All recognized control object kinds in the ownership model. */
|
|
2
|
-
export declare const CONTROL_OBJECT_KINDS: readonly ["tenant", "workspace", "principal", "tool", "pack", "ontology", "belief", "policy_rule"];
|
|
3
|
-
/** A kind of control object (tenant, workspace, principal, tool, etc.). */
|
|
4
|
-
export type ControlObjectKind = (typeof CONTROL_OBJECT_KINDS)[number];
|
|
5
|
-
/** Canonical ownership scopes: platform, tenant, workspace, or resource. */
|
|
6
|
-
export declare const CONTROL_OBJECT_OWNER_SCOPES: readonly ["platform", "tenant", "workspace", "resource"];
|
|
7
|
-
/** The scope level that canonically owns a control object. */
|
|
8
|
-
export type ControlObjectOwnerScope = (typeof CONTROL_OBJECT_OWNER_SCOPES)[number];
|
|
9
|
-
/** UI surfaces authorized to edit control objects. */
|
|
10
|
-
export declare const CONTROL_OBJECT_EDIT_SURFACES: readonly ["platform_admin", "tenant_admin", "workspace_admin", "graph_worktree"];
|
|
11
|
-
/** A UI surface authorized to mutate a control object (platform admin, tenant admin, etc.). */
|
|
12
|
-
export type ControlObjectEditSurface = (typeof CONTROL_OBJECT_EDIT_SURFACES)[number];
|
|
13
|
-
/** Rules governing how control object configuration flows through the scope hierarchy. */
|
|
14
|
-
export declare const CONTROL_OBJECT_INHERITANCE_RULES: readonly ["none", "platform_seed_to_tenant", "tenant_default_to_workspace", "workspace_narrowing_only", "pack_overlay_to_tenant", "topic_lineage_to_resource"];
|
|
15
|
-
/** How a control object's configuration propagates through scope hierarchy. */
|
|
16
|
-
export type ControlObjectInheritanceRule = (typeof CONTROL_OBJECT_INHERITANCE_RULES)[number];
|
|
17
|
-
/** Scope of impact when a control object is modified. */
|
|
18
|
-
export declare const CONTROL_OBJECT_BLAST_RADII: readonly ["platform", "tenant", "workspace", "resource"];
|
|
19
|
-
/** The furthest scope impacted by a mutation to a control object. */
|
|
20
|
-
export type ControlObjectBlastRadius = (typeof CONTROL_OBJECT_BLAST_RADII)[number];
|
|
21
|
-
/** A single row in the ownership matrix describing who owns, edits, and inherits a control object. */
|
|
22
|
-
export type ControlObjectOwnershipCase = {
|
|
23
|
-
caseKey: string;
|
|
24
|
-
caseLabel: string;
|
|
25
|
-
kind: ControlObjectKind;
|
|
26
|
-
canonicalOwnerScope: ControlObjectOwnerScope;
|
|
27
|
-
editSurface: ControlObjectEditSurface;
|
|
28
|
-
inheritanceRule: ControlObjectInheritanceRule;
|
|
29
|
-
blastRadius: ControlObjectBlastRadius;
|
|
30
|
-
};
|
|
31
|
-
/** Full ownership matrix keyed by control object kind. */
|
|
32
|
-
export type ControlObjectOwnershipMatrix = Record<ControlObjectKind, readonly ControlObjectOwnershipCase[]>;
|
|
33
|
-
/** Versioned ownership contract bundling all enums, the matrix, and flattened rows. */
|
|
34
|
-
export type ControlObjectOwnershipContract = {
|
|
35
|
-
version: "1.0.0";
|
|
36
|
-
kinds: readonly ControlObjectKind[];
|
|
37
|
-
ownerScopes: readonly ControlObjectOwnerScope[];
|
|
38
|
-
editSurfaces: readonly ControlObjectEditSurface[];
|
|
39
|
-
inheritanceRules: readonly ControlObjectInheritanceRule[];
|
|
40
|
-
blastRadii: readonly ControlObjectBlastRadius[];
|
|
41
|
-
matrix: ControlObjectOwnershipMatrix;
|
|
42
|
-
rows: readonly ControlObjectOwnershipCase[];
|
|
43
|
-
};
|
|
44
|
-
/** Static ownership matrix mapping each control object kind to its ownership cases. */
|
|
45
|
-
export declare const CONTROL_OBJECT_OWNERSHIP_MATRIX: {
|
|
46
|
-
readonly tenant: readonly [{
|
|
47
|
-
readonly caseKey: "platform-record";
|
|
48
|
-
readonly caseLabel: "Platform Record";
|
|
49
|
-
readonly kind: "tenant";
|
|
50
|
-
readonly canonicalOwnerScope: "platform";
|
|
51
|
-
readonly editSurface: "platform_admin";
|
|
52
|
-
readonly inheritanceRule: "none";
|
|
53
|
-
readonly blastRadius: "tenant";
|
|
54
|
-
}];
|
|
55
|
-
readonly workspace: readonly [{
|
|
56
|
-
readonly caseKey: "tenant-workspace";
|
|
57
|
-
readonly caseLabel: "Tenant Workspace";
|
|
58
|
-
readonly kind: "workspace";
|
|
59
|
-
readonly canonicalOwnerScope: "tenant";
|
|
60
|
-
readonly editSurface: "tenant_admin";
|
|
61
|
-
readonly inheritanceRule: "tenant_default_to_workspace";
|
|
62
|
-
readonly blastRadius: "workspace";
|
|
63
|
-
}];
|
|
64
|
-
readonly principal: readonly [{
|
|
65
|
-
readonly caseKey: "tenant-principal";
|
|
66
|
-
readonly caseLabel: "Tenant Principal";
|
|
67
|
-
readonly kind: "principal";
|
|
68
|
-
readonly canonicalOwnerScope: "tenant";
|
|
69
|
-
readonly editSurface: "tenant_admin";
|
|
70
|
-
readonly inheritanceRule: "workspace_narrowing_only";
|
|
71
|
-
readonly blastRadius: "resource";
|
|
72
|
-
}];
|
|
73
|
-
readonly tool: readonly [{
|
|
74
|
-
readonly caseKey: "platform-core";
|
|
75
|
-
readonly caseLabel: "Platform Core";
|
|
76
|
-
readonly kind: "tool";
|
|
77
|
-
readonly canonicalOwnerScope: "platform";
|
|
78
|
-
readonly editSurface: "platform_admin";
|
|
79
|
-
readonly inheritanceRule: "platform_seed_to_tenant";
|
|
80
|
-
readonly blastRadius: "platform";
|
|
81
|
-
}, {
|
|
82
|
-
readonly caseKey: "tenant-custom";
|
|
83
|
-
readonly caseLabel: "Tenant Custom";
|
|
84
|
-
readonly kind: "tool";
|
|
85
|
-
readonly canonicalOwnerScope: "tenant";
|
|
86
|
-
readonly editSurface: "tenant_admin";
|
|
87
|
-
readonly inheritanceRule: "tenant_default_to_workspace";
|
|
88
|
-
readonly blastRadius: "tenant";
|
|
89
|
-
}];
|
|
90
|
-
readonly pack: readonly [{
|
|
91
|
-
readonly caseKey: "platform-definition";
|
|
92
|
-
readonly caseLabel: "Platform Definition";
|
|
93
|
-
readonly kind: "pack";
|
|
94
|
-
readonly canonicalOwnerScope: "platform";
|
|
95
|
-
readonly editSurface: "platform_admin";
|
|
96
|
-
readonly inheritanceRule: "platform_seed_to_tenant";
|
|
97
|
-
readonly blastRadius: "platform";
|
|
98
|
-
}, {
|
|
99
|
-
readonly caseKey: "tenant-installation";
|
|
100
|
-
readonly caseLabel: "Tenant Installation";
|
|
101
|
-
readonly kind: "pack";
|
|
102
|
-
readonly canonicalOwnerScope: "tenant";
|
|
103
|
-
readonly editSurface: "tenant_admin";
|
|
104
|
-
readonly inheritanceRule: "platform_seed_to_tenant";
|
|
105
|
-
readonly blastRadius: "tenant";
|
|
106
|
-
}];
|
|
107
|
-
readonly ontology: readonly [{
|
|
108
|
-
readonly caseKey: "platform-base";
|
|
109
|
-
readonly caseLabel: "Platform Base";
|
|
110
|
-
readonly kind: "ontology";
|
|
111
|
-
readonly canonicalOwnerScope: "platform";
|
|
112
|
-
readonly editSurface: "platform_admin";
|
|
113
|
-
readonly inheritanceRule: "platform_seed_to_tenant";
|
|
114
|
-
readonly blastRadius: "platform";
|
|
115
|
-
}, {
|
|
116
|
-
readonly caseKey: "pack-overlay";
|
|
117
|
-
readonly caseLabel: "Pack Overlay";
|
|
118
|
-
readonly kind: "ontology";
|
|
119
|
-
readonly canonicalOwnerScope: "platform";
|
|
120
|
-
readonly editSurface: "platform_admin";
|
|
121
|
-
readonly inheritanceRule: "pack_overlay_to_tenant";
|
|
122
|
-
readonly blastRadius: "platform";
|
|
123
|
-
}, {
|
|
124
|
-
readonly caseKey: "tenant-extension";
|
|
125
|
-
readonly caseLabel: "Tenant Extension";
|
|
126
|
-
readonly kind: "ontology";
|
|
127
|
-
readonly canonicalOwnerScope: "tenant";
|
|
128
|
-
readonly editSurface: "tenant_admin";
|
|
129
|
-
readonly inheritanceRule: "topic_lineage_to_resource";
|
|
130
|
-
readonly blastRadius: "tenant";
|
|
131
|
-
}];
|
|
132
|
-
readonly belief: readonly [{
|
|
133
|
-
readonly caseKey: "topic-resource";
|
|
134
|
-
readonly caseLabel: "Topic Resource";
|
|
135
|
-
readonly kind: "belief";
|
|
136
|
-
readonly canonicalOwnerScope: "resource";
|
|
137
|
-
readonly editSurface: "graph_worktree";
|
|
138
|
-
readonly inheritanceRule: "topic_lineage_to_resource";
|
|
139
|
-
readonly blastRadius: "resource";
|
|
140
|
-
}];
|
|
141
|
-
readonly policy_rule: readonly [{
|
|
142
|
-
readonly caseKey: "platform-baseline";
|
|
143
|
-
readonly caseLabel: "Platform Baseline";
|
|
144
|
-
readonly kind: "policy_rule";
|
|
145
|
-
readonly canonicalOwnerScope: "platform";
|
|
146
|
-
readonly editSurface: "platform_admin";
|
|
147
|
-
readonly inheritanceRule: "platform_seed_to_tenant";
|
|
148
|
-
readonly blastRadius: "platform";
|
|
149
|
-
}, {
|
|
150
|
-
readonly caseKey: "tenant-bundle";
|
|
151
|
-
readonly caseLabel: "Tenant Bundle";
|
|
152
|
-
readonly kind: "policy_rule";
|
|
153
|
-
readonly canonicalOwnerScope: "tenant";
|
|
154
|
-
readonly editSurface: "tenant_admin";
|
|
155
|
-
readonly inheritanceRule: "tenant_default_to_workspace";
|
|
156
|
-
readonly blastRadius: "tenant";
|
|
157
|
-
}, {
|
|
158
|
-
readonly caseKey: "workspace-override";
|
|
159
|
-
readonly caseLabel: "Workspace Override";
|
|
160
|
-
readonly kind: "policy_rule";
|
|
161
|
-
readonly canonicalOwnerScope: "workspace";
|
|
162
|
-
readonly editSurface: "workspace_admin";
|
|
163
|
-
readonly inheritanceRule: "none";
|
|
164
|
-
readonly blastRadius: "workspace";
|
|
165
|
-
}];
|
|
166
|
-
};
|
|
167
|
-
/** Flattened array of all ownership cases across all control object kinds. */
|
|
168
|
-
export declare const CONTROL_OBJECT_OWNERSHIP_ROWS: readonly ControlObjectOwnershipCase[];
|
|
169
|
-
/** The canonical ownership contract exposed by the SDK. */
|
|
170
|
-
export declare const CONTROL_OBJECT_OWNERSHIP_CONTRACT: {
|
|
171
|
-
readonly version: "1.0.0";
|
|
172
|
-
readonly kinds: readonly ["tenant", "workspace", "principal", "tool", "pack", "ontology", "belief", "policy_rule"];
|
|
173
|
-
readonly ownerScopes: readonly ["platform", "tenant", "workspace", "resource"];
|
|
174
|
-
readonly editSurfaces: readonly ["platform_admin", "tenant_admin", "workspace_admin", "graph_worktree"];
|
|
175
|
-
readonly inheritanceRules: readonly ["none", "platform_seed_to_tenant", "tenant_default_to_workspace", "workspace_narrowing_only", "pack_overlay_to_tenant", "topic_lineage_to_resource"];
|
|
176
|
-
readonly blastRadii: readonly ["platform", "tenant", "workspace", "resource"];
|
|
177
|
-
readonly matrix: {
|
|
178
|
-
readonly tenant: readonly [{
|
|
179
|
-
readonly caseKey: "platform-record";
|
|
180
|
-
readonly caseLabel: "Platform Record";
|
|
181
|
-
readonly kind: "tenant";
|
|
182
|
-
readonly canonicalOwnerScope: "platform";
|
|
183
|
-
readonly editSurface: "platform_admin";
|
|
184
|
-
readonly inheritanceRule: "none";
|
|
185
|
-
readonly blastRadius: "tenant";
|
|
186
|
-
}];
|
|
187
|
-
readonly workspace: readonly [{
|
|
188
|
-
readonly caseKey: "tenant-workspace";
|
|
189
|
-
readonly caseLabel: "Tenant Workspace";
|
|
190
|
-
readonly kind: "workspace";
|
|
191
|
-
readonly canonicalOwnerScope: "tenant";
|
|
192
|
-
readonly editSurface: "tenant_admin";
|
|
193
|
-
readonly inheritanceRule: "tenant_default_to_workspace";
|
|
194
|
-
readonly blastRadius: "workspace";
|
|
195
|
-
}];
|
|
196
|
-
readonly principal: readonly [{
|
|
197
|
-
readonly caseKey: "tenant-principal";
|
|
198
|
-
readonly caseLabel: "Tenant Principal";
|
|
199
|
-
readonly kind: "principal";
|
|
200
|
-
readonly canonicalOwnerScope: "tenant";
|
|
201
|
-
readonly editSurface: "tenant_admin";
|
|
202
|
-
readonly inheritanceRule: "workspace_narrowing_only";
|
|
203
|
-
readonly blastRadius: "resource";
|
|
204
|
-
}];
|
|
205
|
-
readonly tool: readonly [{
|
|
206
|
-
readonly caseKey: "platform-core";
|
|
207
|
-
readonly caseLabel: "Platform Core";
|
|
208
|
-
readonly kind: "tool";
|
|
209
|
-
readonly canonicalOwnerScope: "platform";
|
|
210
|
-
readonly editSurface: "platform_admin";
|
|
211
|
-
readonly inheritanceRule: "platform_seed_to_tenant";
|
|
212
|
-
readonly blastRadius: "platform";
|
|
213
|
-
}, {
|
|
214
|
-
readonly caseKey: "tenant-custom";
|
|
215
|
-
readonly caseLabel: "Tenant Custom";
|
|
216
|
-
readonly kind: "tool";
|
|
217
|
-
readonly canonicalOwnerScope: "tenant";
|
|
218
|
-
readonly editSurface: "tenant_admin";
|
|
219
|
-
readonly inheritanceRule: "tenant_default_to_workspace";
|
|
220
|
-
readonly blastRadius: "tenant";
|
|
221
|
-
}];
|
|
222
|
-
readonly pack: readonly [{
|
|
223
|
-
readonly caseKey: "platform-definition";
|
|
224
|
-
readonly caseLabel: "Platform Definition";
|
|
225
|
-
readonly kind: "pack";
|
|
226
|
-
readonly canonicalOwnerScope: "platform";
|
|
227
|
-
readonly editSurface: "platform_admin";
|
|
228
|
-
readonly inheritanceRule: "platform_seed_to_tenant";
|
|
229
|
-
readonly blastRadius: "platform";
|
|
230
|
-
}, {
|
|
231
|
-
readonly caseKey: "tenant-installation";
|
|
232
|
-
readonly caseLabel: "Tenant Installation";
|
|
233
|
-
readonly kind: "pack";
|
|
234
|
-
readonly canonicalOwnerScope: "tenant";
|
|
235
|
-
readonly editSurface: "tenant_admin";
|
|
236
|
-
readonly inheritanceRule: "platform_seed_to_tenant";
|
|
237
|
-
readonly blastRadius: "tenant";
|
|
238
|
-
}];
|
|
239
|
-
readonly ontology: readonly [{
|
|
240
|
-
readonly caseKey: "platform-base";
|
|
241
|
-
readonly caseLabel: "Platform Base";
|
|
242
|
-
readonly kind: "ontology";
|
|
243
|
-
readonly canonicalOwnerScope: "platform";
|
|
244
|
-
readonly editSurface: "platform_admin";
|
|
245
|
-
readonly inheritanceRule: "platform_seed_to_tenant";
|
|
246
|
-
readonly blastRadius: "platform";
|
|
247
|
-
}, {
|
|
248
|
-
readonly caseKey: "pack-overlay";
|
|
249
|
-
readonly caseLabel: "Pack Overlay";
|
|
250
|
-
readonly kind: "ontology";
|
|
251
|
-
readonly canonicalOwnerScope: "platform";
|
|
252
|
-
readonly editSurface: "platform_admin";
|
|
253
|
-
readonly inheritanceRule: "pack_overlay_to_tenant";
|
|
254
|
-
readonly blastRadius: "platform";
|
|
255
|
-
}, {
|
|
256
|
-
readonly caseKey: "tenant-extension";
|
|
257
|
-
readonly caseLabel: "Tenant Extension";
|
|
258
|
-
readonly kind: "ontology";
|
|
259
|
-
readonly canonicalOwnerScope: "tenant";
|
|
260
|
-
readonly editSurface: "tenant_admin";
|
|
261
|
-
readonly inheritanceRule: "topic_lineage_to_resource";
|
|
262
|
-
readonly blastRadius: "tenant";
|
|
263
|
-
}];
|
|
264
|
-
readonly belief: readonly [{
|
|
265
|
-
readonly caseKey: "topic-resource";
|
|
266
|
-
readonly caseLabel: "Topic Resource";
|
|
267
|
-
readonly kind: "belief";
|
|
268
|
-
readonly canonicalOwnerScope: "resource";
|
|
269
|
-
readonly editSurface: "graph_worktree";
|
|
270
|
-
readonly inheritanceRule: "topic_lineage_to_resource";
|
|
271
|
-
readonly blastRadius: "resource";
|
|
272
|
-
}];
|
|
273
|
-
readonly policy_rule: readonly [{
|
|
274
|
-
readonly caseKey: "platform-baseline";
|
|
275
|
-
readonly caseLabel: "Platform Baseline";
|
|
276
|
-
readonly kind: "policy_rule";
|
|
277
|
-
readonly canonicalOwnerScope: "platform";
|
|
278
|
-
readonly editSurface: "platform_admin";
|
|
279
|
-
readonly inheritanceRule: "platform_seed_to_tenant";
|
|
280
|
-
readonly blastRadius: "platform";
|
|
281
|
-
}, {
|
|
282
|
-
readonly caseKey: "tenant-bundle";
|
|
283
|
-
readonly caseLabel: "Tenant Bundle";
|
|
284
|
-
readonly kind: "policy_rule";
|
|
285
|
-
readonly canonicalOwnerScope: "tenant";
|
|
286
|
-
readonly editSurface: "tenant_admin";
|
|
287
|
-
readonly inheritanceRule: "tenant_default_to_workspace";
|
|
288
|
-
readonly blastRadius: "tenant";
|
|
289
|
-
}, {
|
|
290
|
-
readonly caseKey: "workspace-override";
|
|
291
|
-
readonly caseLabel: "Workspace Override";
|
|
292
|
-
readonly kind: "policy_rule";
|
|
293
|
-
readonly canonicalOwnerScope: "workspace";
|
|
294
|
-
readonly editSurface: "workspace_admin";
|
|
295
|
-
readonly inheritanceRule: "none";
|
|
296
|
-
readonly blastRadius: "workspace";
|
|
297
|
-
}];
|
|
298
|
-
};
|
|
299
|
-
readonly rows: readonly ControlObjectOwnershipCase[];
|
|
300
|
-
};
|
|
301
|
-
/**
|
|
302
|
-
* List ownership cases for one control-object kind or the full matrix.
|
|
303
|
-
*/
|
|
304
|
-
export declare function listControlObjectOwnershipCases(kind?: ControlObjectKind): readonly ControlObjectOwnershipCase[];
|
|
305
|
-
/**
|
|
306
|
-
* Get a specific ownership case by kind and case key.
|
|
307
|
-
*/
|
|
308
|
-
export declare function getControlObjectOwnershipCase(kind: ControlObjectKind, caseKey: string): ControlObjectOwnershipCase | undefined;
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
/** All recognized control object kinds in the ownership model. */
|
|
2
|
-
export const CONTROL_OBJECT_KINDS = [
|
|
3
|
-
"tenant",
|
|
4
|
-
"workspace",
|
|
5
|
-
"principal",
|
|
6
|
-
"tool",
|
|
7
|
-
"pack",
|
|
8
|
-
"ontology",
|
|
9
|
-
"belief",
|
|
10
|
-
"policy_rule",
|
|
11
|
-
];
|
|
12
|
-
/** Canonical ownership scopes: platform, tenant, workspace, or resource. */
|
|
13
|
-
export const CONTROL_OBJECT_OWNER_SCOPES = [
|
|
14
|
-
"platform",
|
|
15
|
-
"tenant",
|
|
16
|
-
"workspace",
|
|
17
|
-
"resource",
|
|
18
|
-
];
|
|
19
|
-
/** UI surfaces authorized to edit control objects. */
|
|
20
|
-
export const CONTROL_OBJECT_EDIT_SURFACES = [
|
|
21
|
-
"platform_admin",
|
|
22
|
-
"tenant_admin",
|
|
23
|
-
"workspace_admin",
|
|
24
|
-
"graph_worktree",
|
|
25
|
-
];
|
|
26
|
-
/** Rules governing how control object configuration flows through the scope hierarchy. */
|
|
27
|
-
export const CONTROL_OBJECT_INHERITANCE_RULES = [
|
|
28
|
-
"none",
|
|
29
|
-
"platform_seed_to_tenant",
|
|
30
|
-
"tenant_default_to_workspace",
|
|
31
|
-
"workspace_narrowing_only",
|
|
32
|
-
"pack_overlay_to_tenant",
|
|
33
|
-
"topic_lineage_to_resource",
|
|
34
|
-
];
|
|
35
|
-
/** Scope of impact when a control object is modified. */
|
|
36
|
-
export const CONTROL_OBJECT_BLAST_RADII = [
|
|
37
|
-
"platform",
|
|
38
|
-
"tenant",
|
|
39
|
-
"workspace",
|
|
40
|
-
"resource",
|
|
41
|
-
];
|
|
42
|
-
function defineCases(cases) {
|
|
43
|
-
return cases;
|
|
44
|
-
}
|
|
45
|
-
/** Static ownership matrix mapping each control object kind to its ownership cases. */
|
|
46
|
-
export const CONTROL_OBJECT_OWNERSHIP_MATRIX = {
|
|
47
|
-
tenant: defineCases([
|
|
48
|
-
{
|
|
49
|
-
caseKey: "platform-record",
|
|
50
|
-
caseLabel: "Platform Record",
|
|
51
|
-
kind: "tenant",
|
|
52
|
-
canonicalOwnerScope: "platform",
|
|
53
|
-
editSurface: "platform_admin",
|
|
54
|
-
inheritanceRule: "none",
|
|
55
|
-
blastRadius: "tenant",
|
|
56
|
-
},
|
|
57
|
-
]),
|
|
58
|
-
workspace: defineCases([
|
|
59
|
-
{
|
|
60
|
-
caseKey: "tenant-workspace",
|
|
61
|
-
caseLabel: "Tenant Workspace",
|
|
62
|
-
kind: "workspace",
|
|
63
|
-
canonicalOwnerScope: "tenant",
|
|
64
|
-
editSurface: "tenant_admin",
|
|
65
|
-
inheritanceRule: "tenant_default_to_workspace",
|
|
66
|
-
blastRadius: "workspace",
|
|
67
|
-
},
|
|
68
|
-
]),
|
|
69
|
-
principal: defineCases([
|
|
70
|
-
{
|
|
71
|
-
caseKey: "tenant-principal",
|
|
72
|
-
caseLabel: "Tenant Principal",
|
|
73
|
-
kind: "principal",
|
|
74
|
-
canonicalOwnerScope: "tenant",
|
|
75
|
-
editSurface: "tenant_admin",
|
|
76
|
-
inheritanceRule: "workspace_narrowing_only",
|
|
77
|
-
blastRadius: "resource",
|
|
78
|
-
},
|
|
79
|
-
]),
|
|
80
|
-
tool: defineCases([
|
|
81
|
-
{
|
|
82
|
-
caseKey: "platform-core",
|
|
83
|
-
caseLabel: "Platform Core",
|
|
84
|
-
kind: "tool",
|
|
85
|
-
canonicalOwnerScope: "platform",
|
|
86
|
-
editSurface: "platform_admin",
|
|
87
|
-
inheritanceRule: "platform_seed_to_tenant",
|
|
88
|
-
blastRadius: "platform",
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
caseKey: "tenant-custom",
|
|
92
|
-
caseLabel: "Tenant Custom",
|
|
93
|
-
kind: "tool",
|
|
94
|
-
canonicalOwnerScope: "tenant",
|
|
95
|
-
editSurface: "tenant_admin",
|
|
96
|
-
inheritanceRule: "tenant_default_to_workspace",
|
|
97
|
-
blastRadius: "tenant",
|
|
98
|
-
},
|
|
99
|
-
]),
|
|
100
|
-
pack: defineCases([
|
|
101
|
-
{
|
|
102
|
-
caseKey: "platform-definition",
|
|
103
|
-
caseLabel: "Platform Definition",
|
|
104
|
-
kind: "pack",
|
|
105
|
-
canonicalOwnerScope: "platform",
|
|
106
|
-
editSurface: "platform_admin",
|
|
107
|
-
inheritanceRule: "platform_seed_to_tenant",
|
|
108
|
-
blastRadius: "platform",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
caseKey: "tenant-installation",
|
|
112
|
-
caseLabel: "Tenant Installation",
|
|
113
|
-
kind: "pack",
|
|
114
|
-
canonicalOwnerScope: "tenant",
|
|
115
|
-
editSurface: "tenant_admin",
|
|
116
|
-
inheritanceRule: "platform_seed_to_tenant",
|
|
117
|
-
blastRadius: "tenant",
|
|
118
|
-
},
|
|
119
|
-
]),
|
|
120
|
-
ontology: defineCases([
|
|
121
|
-
{
|
|
122
|
-
caseKey: "platform-base",
|
|
123
|
-
caseLabel: "Platform Base",
|
|
124
|
-
kind: "ontology",
|
|
125
|
-
canonicalOwnerScope: "platform",
|
|
126
|
-
editSurface: "platform_admin",
|
|
127
|
-
inheritanceRule: "platform_seed_to_tenant",
|
|
128
|
-
blastRadius: "platform",
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
caseKey: "pack-overlay",
|
|
132
|
-
caseLabel: "Pack Overlay",
|
|
133
|
-
kind: "ontology",
|
|
134
|
-
canonicalOwnerScope: "platform",
|
|
135
|
-
editSurface: "platform_admin",
|
|
136
|
-
inheritanceRule: "pack_overlay_to_tenant",
|
|
137
|
-
blastRadius: "platform",
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
caseKey: "tenant-extension",
|
|
141
|
-
caseLabel: "Tenant Extension",
|
|
142
|
-
kind: "ontology",
|
|
143
|
-
canonicalOwnerScope: "tenant",
|
|
144
|
-
editSurface: "tenant_admin",
|
|
145
|
-
inheritanceRule: "topic_lineage_to_resource",
|
|
146
|
-
blastRadius: "tenant",
|
|
147
|
-
},
|
|
148
|
-
]),
|
|
149
|
-
belief: defineCases([
|
|
150
|
-
{
|
|
151
|
-
caseKey: "topic-resource",
|
|
152
|
-
caseLabel: "Topic Resource",
|
|
153
|
-
kind: "belief",
|
|
154
|
-
canonicalOwnerScope: "resource",
|
|
155
|
-
editSurface: "graph_worktree",
|
|
156
|
-
inheritanceRule: "topic_lineage_to_resource",
|
|
157
|
-
blastRadius: "resource",
|
|
158
|
-
},
|
|
159
|
-
]),
|
|
160
|
-
policy_rule: defineCases([
|
|
161
|
-
{
|
|
162
|
-
caseKey: "platform-baseline",
|
|
163
|
-
caseLabel: "Platform Baseline",
|
|
164
|
-
kind: "policy_rule",
|
|
165
|
-
canonicalOwnerScope: "platform",
|
|
166
|
-
editSurface: "platform_admin",
|
|
167
|
-
inheritanceRule: "platform_seed_to_tenant",
|
|
168
|
-
blastRadius: "platform",
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
caseKey: "tenant-bundle",
|
|
172
|
-
caseLabel: "Tenant Bundle",
|
|
173
|
-
kind: "policy_rule",
|
|
174
|
-
canonicalOwnerScope: "tenant",
|
|
175
|
-
editSurface: "tenant_admin",
|
|
176
|
-
inheritanceRule: "tenant_default_to_workspace",
|
|
177
|
-
blastRadius: "tenant",
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
caseKey: "workspace-override",
|
|
181
|
-
caseLabel: "Workspace Override",
|
|
182
|
-
kind: "policy_rule",
|
|
183
|
-
canonicalOwnerScope: "workspace",
|
|
184
|
-
editSurface: "workspace_admin",
|
|
185
|
-
inheritanceRule: "none",
|
|
186
|
-
blastRadius: "workspace",
|
|
187
|
-
},
|
|
188
|
-
]),
|
|
189
|
-
};
|
|
190
|
-
function flattenOwnershipMatrix(matrix) {
|
|
191
|
-
return CONTROL_OBJECT_KINDS.flatMap((kind) => [...matrix[kind]]);
|
|
192
|
-
}
|
|
193
|
-
/** Flattened array of all ownership cases across all control object kinds. */
|
|
194
|
-
export const CONTROL_OBJECT_OWNERSHIP_ROWS = Object.freeze(flattenOwnershipMatrix(CONTROL_OBJECT_OWNERSHIP_MATRIX));
|
|
195
|
-
/** The canonical ownership contract exposed by the SDK. */
|
|
196
|
-
export const CONTROL_OBJECT_OWNERSHIP_CONTRACT = {
|
|
197
|
-
version: "1.0.0",
|
|
198
|
-
kinds: CONTROL_OBJECT_KINDS,
|
|
199
|
-
ownerScopes: CONTROL_OBJECT_OWNER_SCOPES,
|
|
200
|
-
editSurfaces: CONTROL_OBJECT_EDIT_SURFACES,
|
|
201
|
-
inheritanceRules: CONTROL_OBJECT_INHERITANCE_RULES,
|
|
202
|
-
blastRadii: CONTROL_OBJECT_BLAST_RADII,
|
|
203
|
-
matrix: CONTROL_OBJECT_OWNERSHIP_MATRIX,
|
|
204
|
-
rows: CONTROL_OBJECT_OWNERSHIP_ROWS,
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* List ownership cases for one control-object kind or the full matrix.
|
|
208
|
-
*/
|
|
209
|
-
export function listControlObjectOwnershipCases(kind) {
|
|
210
|
-
if (!kind) {
|
|
211
|
-
return CONTROL_OBJECT_OWNERSHIP_ROWS;
|
|
212
|
-
}
|
|
213
|
-
return CONTROL_OBJECT_OWNERSHIP_MATRIX[kind];
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Get a specific ownership case by kind and case key.
|
|
217
|
-
*/
|
|
218
|
-
export function getControlObjectOwnershipCase(kind, caseKey) {
|
|
219
|
-
return CONTROL_OBJECT_OWNERSHIP_MATRIX[kind].find((ownershipCase) => ownershipCase.caseKey === caseKey);
|
|
220
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import type { JsonObject, JsonValue } from "./types";
|
|
2
|
-
/** Tenant and workspace identifiers used to scope gateway requests. */
|
|
3
|
-
export type GatewayScope = {
|
|
4
|
-
tenantId?: string;
|
|
5
|
-
workspaceId?: string;
|
|
6
|
-
};
|
|
7
|
-
/** Successful response envelope from the platform gateway with correlation metadata. */
|
|
8
|
-
export type PlatformGatewaySuccess<T> = {
|
|
9
|
-
success: true;
|
|
10
|
-
data: T;
|
|
11
|
-
correlationId: string;
|
|
12
|
-
policyTraceId: string | null;
|
|
13
|
-
idempotentReplay: boolean;
|
|
14
|
-
};
|
|
15
|
-
/** Failed response envelope with structured error codes and optional invariant references. */
|
|
16
|
-
export type PlatformGatewayFailure = {
|
|
17
|
-
success: false;
|
|
18
|
-
/**
|
|
19
|
-
* Error string is the canonical envelope field.
|
|
20
|
-
* Object form is legacy-only compatibility for older gateway responses.
|
|
21
|
-
*/
|
|
22
|
-
error: string | {
|
|
23
|
-
code: string;
|
|
24
|
-
message: string;
|
|
25
|
-
details?: JsonValue;
|
|
26
|
-
};
|
|
27
|
-
code?: string;
|
|
28
|
-
invariant?: string | null;
|
|
29
|
-
suggestion?: string | null;
|
|
30
|
-
details?: JsonValue;
|
|
31
|
-
legacyError?: {
|
|
32
|
-
code: string;
|
|
33
|
-
message: string;
|
|
34
|
-
details?: JsonValue;
|
|
35
|
-
};
|
|
36
|
-
correlationId: string;
|
|
37
|
-
policyTraceId: string | null;
|
|
38
|
-
};
|
|
39
|
-
/** Discriminated union of success and failure gateway responses. */
|
|
40
|
-
export type PlatformGatewayEnvelope<T> = PlatformGatewaySuccess<T> | PlatformGatewayFailure;
|
|
41
|
-
/**
|
|
42
|
-
* Structured error thrown when a platform API request fails.
|
|
43
|
-
*
|
|
44
|
-
* Includes HTTP status, machine-readable error code, optional invariant
|
|
45
|
-
* reference, and actionable suggestions for common failure modes.
|
|
46
|
-
*/
|
|
47
|
-
export declare class LucernApiError extends Error {
|
|
48
|
-
readonly code: string;
|
|
49
|
-
readonly status: number;
|
|
50
|
-
readonly invariant?: string | null;
|
|
51
|
-
readonly suggestion?: string | null;
|
|
52
|
-
readonly details?: JsonValue;
|
|
53
|
-
readonly requestId?: string;
|
|
54
|
-
readonly correlationId?: string;
|
|
55
|
-
readonly policyTraceId?: string | null;
|
|
56
|
-
constructor(args: {
|
|
57
|
-
code: string;
|
|
58
|
-
message: string;
|
|
59
|
-
status: number;
|
|
60
|
-
invariant?: string | null;
|
|
61
|
-
suggestion?: string | null;
|
|
62
|
-
details?: JsonValue;
|
|
63
|
-
requestId?: string;
|
|
64
|
-
correlationId?: string;
|
|
65
|
-
policyTraceId?: string | null;
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
/** Supported HTTP methods for gateway requests. */
|
|
69
|
-
export type GatewayHttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
70
|
-
type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
71
|
-
/** Context passed to the `onRequest` hook before each gateway request attempt. */
|
|
72
|
-
export type GatewayRequestHookContext = {
|
|
73
|
-
requestId: string;
|
|
74
|
-
attempt: number;
|
|
75
|
-
maxRetries: number;
|
|
76
|
-
method: GatewayHttpMethod;
|
|
77
|
-
path: string;
|
|
78
|
-
url: string;
|
|
79
|
-
headers: Headers;
|
|
80
|
-
body?: string;
|
|
81
|
-
timeoutMs: number;
|
|
82
|
-
};
|
|
83
|
-
/** Context passed to the `onResponse` hook after each gateway request attempt (including retries and failures). */
|
|
84
|
-
export type GatewayResponseHookContext = GatewayRequestHookContext & {
|
|
85
|
-
durationMs: number;
|
|
86
|
-
status?: number;
|
|
87
|
-
response?: Response;
|
|
88
|
-
error?: unknown;
|
|
89
|
-
correlationId?: string;
|
|
90
|
-
policyTraceId?: string | null;
|
|
91
|
-
idempotentReplay?: boolean;
|
|
92
|
-
retryAfterMs?: number | null;
|
|
93
|
-
willRetry: boolean;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Low-level transport configuration for the platform gateway client.
|
|
97
|
-
*
|
|
98
|
-
* Most developers should use {@link createLucernClient} instead, which wraps
|
|
99
|
-
* this config with higher-level conveniences like `apiKey` and `environment`.
|
|
100
|
-
*/
|
|
101
|
-
export type GatewayClientConfig = {
|
|
102
|
-
baseUrl?: string;
|
|
103
|
-
fetchImpl?: FetchLike;
|
|
104
|
-
getAuthHeaders?: (() => Promise<Record<string, string>>) | (() => Record<string, string>);
|
|
105
|
-
/** Max retries for transient errors (5xx, network). Defaults to 2. */
|
|
106
|
-
maxRetries?: number;
|
|
107
|
-
/** Request timeout in ms. Defaults to 15000. */
|
|
108
|
-
timeoutMs?: number;
|
|
109
|
-
/** Optional timeout overrides by HTTP method. */
|
|
110
|
-
timeoutMsByMethod?: Partial<Record<GatewayHttpMethod, number>>;
|
|
111
|
-
/** Optional request ID factory used for correlation headers. */
|
|
112
|
-
requestIdFactory?: () => string;
|
|
113
|
-
/** Invoked before each request attempt, including retries. */
|
|
114
|
-
onRequest?: ((context: GatewayRequestHookContext) => void) | ((context: GatewayRequestHookContext) => Promise<void>);
|
|
115
|
-
/** Invoked after each request attempt, including retries and failures. */
|
|
116
|
-
onResponse?: ((context: GatewayResponseHookContext) => void) | ((context: GatewayResponseHookContext) => Promise<void>);
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Serialize a gateway query object into a URL query string.
|
|
120
|
-
*/
|
|
121
|
-
export declare function toQueryString(scope: GatewayScope & Record<string, string | number | boolean | undefined>): string;
|
|
122
|
-
/**
|
|
123
|
-
* Generate a random idempotency key for retry-safe writes.
|
|
124
|
-
*/
|
|
125
|
-
export declare function randomIdempotencyKey(): string;
|
|
126
|
-
/**
|
|
127
|
-
* Create the transport client used by all SDK modules.
|
|
128
|
-
*/
|
|
129
|
-
export declare function createGatewayRequestClient(config?: GatewayClientConfig): {
|
|
130
|
-
request: <T>(args: {
|
|
131
|
-
path: string;
|
|
132
|
-
method?: GatewayHttpMethod;
|
|
133
|
-
body?: JsonObject;
|
|
134
|
-
idempotencyKey?: string;
|
|
135
|
-
requestId?: string;
|
|
136
|
-
timeoutMs?: number;
|
|
137
|
-
}) => Promise<PlatformGatewaySuccess<T>>;
|
|
138
|
-
};
|
|
139
|
-
export {};
|