@collective-intelligence/external-apps-server-sdk 0.0.0-stage → 0.1.1
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 +1075 -2
- package/dist/admin.d.ts +7556 -0
- package/dist/admin.js +6 -0
- package/dist/auth/better-auth.d.ts +71 -0
- package/dist/auth/better-auth.js +1 -0
- package/dist/auth/federated.d.ts +135 -0
- package/dist/auth/federated.js +8 -0
- package/dist/auth.d.ts +162 -0
- package/dist/auth.js +1 -0
- package/dist/express.d.ts +644 -0
- package/dist/express.js +1 -0
- package/dist/gateway/contracts.d.ts +663 -0
- package/dist/gateway/contracts.js +0 -0
- package/dist/gateway.d.ts +762 -0
- package/dist/gateway.js +8 -0
- package/dist/index.d.ts +597 -0
- package/dist/index.js +9 -0
- package/dist/knowledge-sources/payload.d.ts +420 -0
- package/dist/knowledge-sources/payload.js +1 -0
- package/dist/knowledge-sources/strapi.d.ts +389 -0
- package/dist/knowledge-sources/strapi.js +1 -0
- package/dist/persistence/drizzle-effect.d.ts +38 -0
- package/dist/persistence/drizzle-effect.js +1 -0
- package/dist/persistence/drizzle.d.ts +1514 -0
- package/dist/persistence/drizzle.js +18 -0
- package/dist/resources.d.ts +423 -0
- package/dist/resources.js +15 -0
- package/dist/runtime/effect.d.ts +954 -0
- package/dist/runtime/effect.js +15 -0
- package/dist/runtime/express.d.ts +644 -0
- package/dist/runtime/express.js +1 -0
- package/dist/runtime/nestjs.d.ts +802 -0
- package/dist/runtime/nestjs.js +8 -0
- package/dist/runtime/next.d.ts +874 -0
- package/dist/runtime/next.js +8 -0
- package/dist/runtime/web.d.ts +776 -0
- package/dist/runtime/web.js +8 -0
- package/dist/tools/ai-sdk.d.ts +170 -0
- package/dist/tools/ai-sdk.js +8 -0
- package/package.json +242 -4
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export type PrincipalKind = "detached_user" | "service_principal";
|
|
4
|
+
export type DelegatedSubjectPolicy = "allowed" | "forbidden" | "required";
|
|
5
|
+
export type AuthorizationRequirement = Readonly<{
|
|
6
|
+
delegatedSubject?: DelegatedSubjectPolicy;
|
|
7
|
+
organization: "required";
|
|
8
|
+
principalKinds: readonly PrincipalKind[];
|
|
9
|
+
scopes: readonly string[];
|
|
10
|
+
}>;
|
|
11
|
+
export type ExternalAuditSubject = Readonly<{
|
|
12
|
+
issuer: string;
|
|
13
|
+
mappedCiUserId?: string;
|
|
14
|
+
subject: string;
|
|
15
|
+
}>;
|
|
16
|
+
export type GatewayCallerIdentity = Readonly<{
|
|
17
|
+
audience: readonly string[];
|
|
18
|
+
binding: string;
|
|
19
|
+
expiresAt: number;
|
|
20
|
+
installationId: string;
|
|
21
|
+
issuer: string;
|
|
22
|
+
organizationId: string;
|
|
23
|
+
principalKind: PrincipalKind;
|
|
24
|
+
requestId: string;
|
|
25
|
+
scopes: readonly string[];
|
|
26
|
+
subject: string;
|
|
27
|
+
}>;
|
|
28
|
+
export type GatewayInvocationContext = Readonly<{
|
|
29
|
+
caller: GatewayCallerIdentity;
|
|
30
|
+
correlationId: string;
|
|
31
|
+
externalAuditSubject?: ExternalAuditSubject;
|
|
32
|
+
organizationId: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type JsonPrimitive = boolean | null | number | string;
|
|
35
|
+
export type JsonValue = JsonObject | JsonPrimitive | readonly JsonValue[];
|
|
36
|
+
export interface JsonObject {
|
|
37
|
+
readonly [key: string]: JsonValue;
|
|
38
|
+
}
|
|
39
|
+
declare const Draft202012Dialect: "https://json-schema.org/draft/2020-12/schema";
|
|
40
|
+
/** JSON-compatible Draft 2020-12 vocabulary used for portable manifests. */
|
|
41
|
+
export type JsonSchemaDocument = JsonObject & Readonly<{
|
|
42
|
+
$anchor?: string;
|
|
43
|
+
$comment?: string;
|
|
44
|
+
$defs?: Readonly<Record<string, JsonSchemaDocument>>;
|
|
45
|
+
$dynamicAnchor?: string;
|
|
46
|
+
$dynamicRef?: string;
|
|
47
|
+
$id?: string;
|
|
48
|
+
$ref?: string;
|
|
49
|
+
$schema?: typeof Draft202012Dialect;
|
|
50
|
+
additionalProperties?: boolean | JsonSchemaDocument;
|
|
51
|
+
allOf?: readonly JsonSchemaDocument[];
|
|
52
|
+
anyOf?: readonly JsonSchemaDocument[];
|
|
53
|
+
const?: JsonValue;
|
|
54
|
+
contains?: JsonSchemaDocument;
|
|
55
|
+
default?: JsonValue;
|
|
56
|
+
dependentRequired?: Readonly<Record<string, readonly string[]>>;
|
|
57
|
+
description?: string;
|
|
58
|
+
else?: JsonSchemaDocument;
|
|
59
|
+
enum?: readonly JsonValue[];
|
|
60
|
+
exclusiveMaximum?: number;
|
|
61
|
+
exclusiveMinimum?: number;
|
|
62
|
+
format?: string;
|
|
63
|
+
if?: JsonSchemaDocument;
|
|
64
|
+
items?: JsonSchemaDocument;
|
|
65
|
+
maxItems?: number;
|
|
66
|
+
maxLength?: number;
|
|
67
|
+
maxProperties?: number;
|
|
68
|
+
maximum?: number;
|
|
69
|
+
minItems?: number;
|
|
70
|
+
minLength?: number;
|
|
71
|
+
minProperties?: number;
|
|
72
|
+
minimum?: number;
|
|
73
|
+
multipleOf?: number;
|
|
74
|
+
not?: JsonSchemaDocument;
|
|
75
|
+
oneOf?: readonly JsonSchemaDocument[];
|
|
76
|
+
pattern?: string;
|
|
77
|
+
patternProperties?: Readonly<Record<string, JsonSchemaDocument>>;
|
|
78
|
+
prefixItems?: readonly JsonSchemaDocument[];
|
|
79
|
+
properties?: Readonly<Record<string, JsonSchemaDocument>>;
|
|
80
|
+
required?: readonly string[];
|
|
81
|
+
then?: JsonSchemaDocument;
|
|
82
|
+
title?: string;
|
|
83
|
+
type?: "array" | "boolean" | "integer" | "null" | "number" | "object" | "string" | readonly ("array" | "boolean" | "integer" | "null" | "number" | "object" | "string")[];
|
|
84
|
+
unevaluatedItems?: boolean | JsonSchemaDocument;
|
|
85
|
+
unevaluatedProperties?: boolean | JsonSchemaDocument;
|
|
86
|
+
uniqueItems?: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
export type ProjectionFidelity = "exact" | "structural";
|
|
89
|
+
export type PackageSchemaProjection = Readonly<{
|
|
90
|
+
dialect: typeof Draft202012Dialect;
|
|
91
|
+
document: JsonSchemaDocument;
|
|
92
|
+
fidelity: ProjectionFidelity;
|
|
93
|
+
}>;
|
|
94
|
+
/** Closed public principal vocabulary accepted by a gateway operation. */
|
|
95
|
+
export type PortableOperationPrincipalKind = "detached_user" | "service_principal";
|
|
96
|
+
/** Explicit delegated-subject requirement reviewed with an operation. */
|
|
97
|
+
export type PortableOperationDelegatedSubjectPolicy = "allowed" | "forbidden" | "required";
|
|
98
|
+
/** Fully materialized authorization policy for one exposed operation. */
|
|
99
|
+
export type PortableOperationAuthorization = Readonly<{
|
|
100
|
+
delegatedSubject: PortableOperationDelegatedSubjectPolicy;
|
|
101
|
+
organization: "required";
|
|
102
|
+
principalKinds: readonly PortableOperationPrincipalKind[];
|
|
103
|
+
scopes: readonly string[];
|
|
104
|
+
}>;
|
|
105
|
+
/** Observable side-effect class reviewed before an operation becomes a tool. */
|
|
106
|
+
export type PortableOperationEffect = "external_side_effect" | "read" | "write";
|
|
107
|
+
/** The replay guarantee supplied by the operation implementation. */
|
|
108
|
+
export type PortableOperationIdempotency = "idempotent" | "requires_key" | "safe";
|
|
109
|
+
/** Explicit, bounded retry permission for callers of the operation. */
|
|
110
|
+
export type PortableOperationRetryPolicy = Readonly<{
|
|
111
|
+
mode: "never";
|
|
112
|
+
}> | Readonly<{
|
|
113
|
+
maxAttempts: number;
|
|
114
|
+
mode: "idempotent_only";
|
|
115
|
+
}>;
|
|
116
|
+
/** Execution lifecycle and maximum wall-clock duration. */
|
|
117
|
+
export type PortableOperationExecutionPolicy = Readonly<{
|
|
118
|
+
mode: "synchronous";
|
|
119
|
+
timeoutMs: number;
|
|
120
|
+
}>;
|
|
121
|
+
/** Per-invocation transport bounds. */
|
|
122
|
+
export type PortableOperationLimits = Readonly<{
|
|
123
|
+
maxRequestBytes: number;
|
|
124
|
+
maxResponseBytes: number;
|
|
125
|
+
}>;
|
|
126
|
+
/**
|
|
127
|
+
* Complete JSON-only operation contract reviewed by a host. Executable
|
|
128
|
+
* handlers remain in a server runtime sidecar and never enter this descriptor.
|
|
129
|
+
*/
|
|
130
|
+
export type PortableOperationDeclaration = Readonly<{
|
|
131
|
+
authorization: PortableOperationAuthorization;
|
|
132
|
+
description: string;
|
|
133
|
+
effects: PortableOperationEffect;
|
|
134
|
+
execution: PortableOperationExecutionPolicy;
|
|
135
|
+
id: string;
|
|
136
|
+
idempotency: PortableOperationIdempotency;
|
|
137
|
+
input: PackageSchemaProjection;
|
|
138
|
+
limits: PortableOperationLimits;
|
|
139
|
+
output: PackageSchemaProjection;
|
|
140
|
+
retry: PortableOperationRetryPolicy;
|
|
141
|
+
title: string;
|
|
142
|
+
version: string;
|
|
143
|
+
}>;
|
|
144
|
+
/** One catalog and identity namespace for an ordered operation list. */
|
|
145
|
+
export type OperationDomainDeclaration<Operation extends PortableOperationDeclaration = PortableOperationDeclaration> = Readonly<{
|
|
146
|
+
description?: string;
|
|
147
|
+
displayOrder?: number;
|
|
148
|
+
icon?: string;
|
|
149
|
+
id: string;
|
|
150
|
+
operations: readonly Operation[];
|
|
151
|
+
tags?: readonly string[];
|
|
152
|
+
title: string;
|
|
153
|
+
}>;
|
|
154
|
+
export type DatasetProviderResult<Value> = Readonly<{
|
|
155
|
+
status: "success";
|
|
156
|
+
value: Value;
|
|
157
|
+
}> | Readonly<{
|
|
158
|
+
status: "failure";
|
|
159
|
+
error: DatasetProviderError;
|
|
160
|
+
}>;
|
|
161
|
+
export type DatasetScalarType = "boolean" | "string" | "int64" | "float64" | "decimal" | "date" | "timestamp" | "duration" | "json";
|
|
162
|
+
export type DatasetValue = Readonly<{
|
|
163
|
+
kind: "null";
|
|
164
|
+
}> | Readonly<{
|
|
165
|
+
kind: "boolean";
|
|
166
|
+
value: boolean;
|
|
167
|
+
}> | Readonly<{
|
|
168
|
+
kind: "string";
|
|
169
|
+
value: string;
|
|
170
|
+
}> | Readonly<{
|
|
171
|
+
kind: "int64";
|
|
172
|
+
value: string;
|
|
173
|
+
}> | Readonly<{
|
|
174
|
+
kind: "float64";
|
|
175
|
+
value: number;
|
|
176
|
+
}> | Readonly<{
|
|
177
|
+
kind: "decimal";
|
|
178
|
+
value: string;
|
|
179
|
+
}> | Readonly<{
|
|
180
|
+
kind: "date";
|
|
181
|
+
value: string;
|
|
182
|
+
}> | Readonly<{
|
|
183
|
+
kind: "timestamp";
|
|
184
|
+
value: string;
|
|
185
|
+
}> | Readonly<{
|
|
186
|
+
kind: "duration";
|
|
187
|
+
value: string;
|
|
188
|
+
}> | Readonly<{
|
|
189
|
+
kind: "json";
|
|
190
|
+
value: JsonValue;
|
|
191
|
+
}>;
|
|
192
|
+
export type DatasetPredicateOperator = "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "is_null" | "is_not_null" | "contains" | "starts_with";
|
|
193
|
+
export type DatasetAggregateOperation = "count" | "count_distinct" | "sum" | "min" | "max" | "avg";
|
|
194
|
+
export type DatasetQueryIntent = "records" | "aggregate" | "time_series";
|
|
195
|
+
export type DatasetTimeBucket = "hour" | "day" | "week" | "month";
|
|
196
|
+
export type DatasetPredicate = Readonly<{
|
|
197
|
+
kind: "predicate";
|
|
198
|
+
fieldId: string;
|
|
199
|
+
operator: DatasetPredicateOperator;
|
|
200
|
+
values: readonly DatasetValue[];
|
|
201
|
+
}>;
|
|
202
|
+
export type DatasetFilter = DatasetPredicate | Readonly<{
|
|
203
|
+
kind: "and" | "or";
|
|
204
|
+
filters: readonly DatasetFilter[];
|
|
205
|
+
}> | Readonly<{
|
|
206
|
+
kind: "not";
|
|
207
|
+
filter: DatasetFilter;
|
|
208
|
+
}>;
|
|
209
|
+
export type DatasetOrder = Readonly<{
|
|
210
|
+
fieldOrAlias: string;
|
|
211
|
+
direction: "asc" | "desc";
|
|
212
|
+
}>;
|
|
213
|
+
export type DatasetOperation = Readonly<{
|
|
214
|
+
kind: "records";
|
|
215
|
+
projection: readonly string[];
|
|
216
|
+
filter?: DatasetFilter;
|
|
217
|
+
orderBy: readonly DatasetOrder[];
|
|
218
|
+
cursor?: string;
|
|
219
|
+
}> | Readonly<{
|
|
220
|
+
kind: "aggregate";
|
|
221
|
+
filter?: DatasetFilter;
|
|
222
|
+
groupBy: readonly string[];
|
|
223
|
+
measures: readonly Readonly<{
|
|
224
|
+
alias: string;
|
|
225
|
+
operation: DatasetAggregateOperation;
|
|
226
|
+
fieldId?: string;
|
|
227
|
+
}>[];
|
|
228
|
+
orderBy: readonly DatasetOrder[];
|
|
229
|
+
cursor?: string;
|
|
230
|
+
}> | Readonly<{
|
|
231
|
+
kind: "time_series";
|
|
232
|
+
timeFieldId: string;
|
|
233
|
+
measure: Readonly<{
|
|
234
|
+
alias: string;
|
|
235
|
+
operation: DatasetAggregateOperation;
|
|
236
|
+
fieldId?: string;
|
|
237
|
+
}>;
|
|
238
|
+
bucket: DatasetTimeBucket;
|
|
239
|
+
order: "asc" | "desc";
|
|
240
|
+
filter?: DatasetFilter;
|
|
241
|
+
cursor?: string;
|
|
242
|
+
}>;
|
|
243
|
+
export type DatasetProviderCapabilities = Readonly<{
|
|
244
|
+
intents: readonly DatasetQueryIntent[];
|
|
245
|
+
predicates: readonly DatasetPredicateOperator[];
|
|
246
|
+
aggregates: readonly DatasetAggregateOperation[];
|
|
247
|
+
grouping: boolean;
|
|
248
|
+
ordering: boolean;
|
|
249
|
+
pagination: boolean;
|
|
250
|
+
definitionRefresh: boolean;
|
|
251
|
+
limits: Readonly<{
|
|
252
|
+
maxRows: number;
|
|
253
|
+
maxBytes: number;
|
|
254
|
+
timeoutMs: number;
|
|
255
|
+
maxPageRows: number;
|
|
256
|
+
}>;
|
|
257
|
+
}>;
|
|
258
|
+
export type SafeDiagnostic = Readonly<{
|
|
259
|
+
code: string;
|
|
260
|
+
message: string;
|
|
261
|
+
fieldId?: string;
|
|
262
|
+
}>;
|
|
263
|
+
export type ConnectorContext = Readonly<{
|
|
264
|
+
correlationId: string;
|
|
265
|
+
deadlineEpochMs: number;
|
|
266
|
+
}>;
|
|
267
|
+
export type DatasetSourceLocation = Readonly<{
|
|
268
|
+
segments: readonly [
|
|
269
|
+
Readonly<{
|
|
270
|
+
kind: "container";
|
|
271
|
+
opaqueId: string;
|
|
272
|
+
label: string;
|
|
273
|
+
}>,
|
|
274
|
+
...Readonly<{
|
|
275
|
+
kind: "container" | "dataset";
|
|
276
|
+
opaqueId: string;
|
|
277
|
+
label: string;
|
|
278
|
+
}>[]
|
|
279
|
+
];
|
|
280
|
+
}>;
|
|
281
|
+
export type DatasetDefinition = Readonly<{
|
|
282
|
+
version: 1;
|
|
283
|
+
fields: readonly Readonly<{
|
|
284
|
+
id: string;
|
|
285
|
+
name: string;
|
|
286
|
+
type: DatasetScalarType;
|
|
287
|
+
nullable: boolean;
|
|
288
|
+
semantic?: string;
|
|
289
|
+
}>[];
|
|
290
|
+
measures: readonly Readonly<{
|
|
291
|
+
id: string;
|
|
292
|
+
name: string;
|
|
293
|
+
resultType: DatasetScalarType;
|
|
294
|
+
}>[];
|
|
295
|
+
relationships: readonly Readonly<{
|
|
296
|
+
id: string;
|
|
297
|
+
fromFieldId: string;
|
|
298
|
+
toFieldId: string;
|
|
299
|
+
cardinality: "one_to_one" | "one_to_many" | "many_to_one" | "many_to_many";
|
|
300
|
+
}>[];
|
|
301
|
+
}>;
|
|
302
|
+
export type Bounds = Readonly<{
|
|
303
|
+
maxRows: number;
|
|
304
|
+
maxBytes: number;
|
|
305
|
+
timeoutMs: number;
|
|
306
|
+
}>;
|
|
307
|
+
export type QueryInput = ConnectorContext & Readonly<{
|
|
308
|
+
location: DatasetSourceLocation;
|
|
309
|
+
definitionRevisionId: string;
|
|
310
|
+
definition: DatasetDefinition;
|
|
311
|
+
operation: DatasetOperation;
|
|
312
|
+
bounds: Bounds;
|
|
313
|
+
}>;
|
|
314
|
+
export type DatasetRecordPage = Readonly<{
|
|
315
|
+
columns: readonly Readonly<{
|
|
316
|
+
fieldId: string;
|
|
317
|
+
type: DatasetScalarType;
|
|
318
|
+
}>[];
|
|
319
|
+
rows: readonly (readonly DatasetValue[])[];
|
|
320
|
+
nextCursor?: string;
|
|
321
|
+
rowCount: number;
|
|
322
|
+
byteCount: number;
|
|
323
|
+
observedAt: string;
|
|
324
|
+
}>;
|
|
325
|
+
export type DatasetResultPage = (Readonly<{
|
|
326
|
+
kind: "records";
|
|
327
|
+
}> & DatasetRecordPage) | Readonly<{
|
|
328
|
+
kind: "aggregate";
|
|
329
|
+
columns: readonly Readonly<{
|
|
330
|
+
alias: string;
|
|
331
|
+
type: DatasetScalarType;
|
|
332
|
+
}>[];
|
|
333
|
+
rows: readonly (readonly DatasetValue[])[];
|
|
334
|
+
nextCursor?: string;
|
|
335
|
+
rowCount: number;
|
|
336
|
+
byteCount: number;
|
|
337
|
+
observedAt: string;
|
|
338
|
+
}> | Readonly<{
|
|
339
|
+
kind: "time_series";
|
|
340
|
+
valueType: DatasetScalarType;
|
|
341
|
+
points: readonly Readonly<{
|
|
342
|
+
time: string;
|
|
343
|
+
value: DatasetValue;
|
|
344
|
+
}>[];
|
|
345
|
+
nextCursor?: string;
|
|
346
|
+
pointCount: number;
|
|
347
|
+
byteCount: number;
|
|
348
|
+
observedAt: string;
|
|
349
|
+
}>;
|
|
350
|
+
export type DatasetProviderError = Readonly<{
|
|
351
|
+
kind: "not_ready" | "incompatible_source" | "unsupported_operation" | "policy_not_pushable" | "invalid_cursor" | "timeout" | "permission_denied" | "provider_unavailable" | "provider_rejected" | "invalid_provider_response";
|
|
352
|
+
diagnostics: readonly SafeDiagnostic[];
|
|
353
|
+
}> | Readonly<{
|
|
354
|
+
kind: "limit_exceeded";
|
|
355
|
+
limit: "rows" | "bytes" | "timeout";
|
|
356
|
+
diagnostics: readonly SafeDiagnostic[];
|
|
357
|
+
}> | Readonly<{
|
|
358
|
+
kind: "throttled";
|
|
359
|
+
retryAfterMs?: number;
|
|
360
|
+
diagnostics: readonly SafeDiagnostic[];
|
|
361
|
+
}>;
|
|
362
|
+
export type ResourceJsonValue = null | boolean | number | string | readonly ResourceJsonValue[] | Readonly<{
|
|
363
|
+
[key: string]: ResourceJsonValue;
|
|
364
|
+
}>;
|
|
365
|
+
/** Opaque wire identity. Callers must not infer or concatenate its internals. */
|
|
366
|
+
export type ResourceId = string;
|
|
367
|
+
export type ResourceRecordId = ResourceId;
|
|
368
|
+
/** Opaque concurrency token independent from source timestamps. */
|
|
369
|
+
export type ResourceRevision = string;
|
|
370
|
+
/** Opaque pagination position issued and consumed only by a resource adapter. */
|
|
371
|
+
export type ResourceCursor = string;
|
|
372
|
+
export type IdempotencyKey = string;
|
|
373
|
+
export type ResourceIdentityField = Readonly<{
|
|
374
|
+
name: string;
|
|
375
|
+
type: "number" | "string";
|
|
376
|
+
}>;
|
|
377
|
+
export type ResourceCapabilities = Readonly<{
|
|
378
|
+
create?: boolean;
|
|
379
|
+
/** Common entity deletion is always soft deletion. */
|
|
380
|
+
delete?: boolean;
|
|
381
|
+
get?: boolean;
|
|
382
|
+
hardDelete?: boolean;
|
|
383
|
+
includeDeleted?: boolean;
|
|
384
|
+
restore?: boolean;
|
|
385
|
+
search: true;
|
|
386
|
+
softDelete?: boolean;
|
|
387
|
+
update?: boolean;
|
|
388
|
+
}>;
|
|
389
|
+
export type ResourcePaginationMode = "cursor" | "page";
|
|
390
|
+
export type PortableResourceSchema = Readonly<Record<string, ResourceJsonValue>>;
|
|
391
|
+
export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>> = Readonly<{
|
|
392
|
+
capabilities: ResourceCapabilities;
|
|
393
|
+
concurrency: "revision";
|
|
394
|
+
id: string;
|
|
395
|
+
identity: Readonly<{
|
|
396
|
+
fields: readonly [
|
|
397
|
+
ResourceIdentityField,
|
|
398
|
+
...ResourceIdentityField[]
|
|
399
|
+
];
|
|
400
|
+
}>;
|
|
401
|
+
query: Readonly<{
|
|
402
|
+
filterableFields: readonly string[];
|
|
403
|
+
pagination: Readonly<{
|
|
404
|
+
modes: readonly ResourcePaginationMode[];
|
|
405
|
+
}>;
|
|
406
|
+
sortableFields: readonly string[];
|
|
407
|
+
textSearchFields?: readonly string[];
|
|
408
|
+
}>;
|
|
409
|
+
schemas: Readonly<{
|
|
410
|
+
create?: PortableResourceSchema;
|
|
411
|
+
entity: PortableResourceSchema;
|
|
412
|
+
update?: PortableResourceSchema;
|
|
413
|
+
}>;
|
|
414
|
+
version: string;
|
|
415
|
+
/** Portable UI metadata; required/enum/nullability remain in schemas. */
|
|
416
|
+
metadata?: Readonly<Record<string, ResourceJsonValue>>;
|
|
417
|
+
/** Type-only slots keep definition values portable and serializable. */
|
|
418
|
+
readonly __types?: Readonly<{
|
|
419
|
+
create: Create;
|
|
420
|
+
entity: Entity;
|
|
421
|
+
update: Update;
|
|
422
|
+
}>;
|
|
423
|
+
}>;
|
|
424
|
+
export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
|
|
425
|
+
export type ResourceFilter = Readonly<{
|
|
426
|
+
field: string;
|
|
427
|
+
operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
428
|
+
value: FilterValue;
|
|
429
|
+
}> | Readonly<{
|
|
430
|
+
field: string;
|
|
431
|
+
operator: "is_not_null" | "is_null";
|
|
432
|
+
}> | Readonly<{
|
|
433
|
+
filters: readonly ResourceFilter[];
|
|
434
|
+
operator: "and" | "or";
|
|
435
|
+
}> | Readonly<{
|
|
436
|
+
filter: ResourceFilter;
|
|
437
|
+
operator: "not";
|
|
438
|
+
}>;
|
|
439
|
+
export type ResourceSort = Readonly<{
|
|
440
|
+
direction: "asc" | "desc";
|
|
441
|
+
field: string;
|
|
442
|
+
}>;
|
|
443
|
+
export type ResourcePagination = Readonly<{
|
|
444
|
+
mode: "cursor";
|
|
445
|
+
cursor?: ResourceCursor;
|
|
446
|
+
limit: number;
|
|
447
|
+
}> | Readonly<{
|
|
448
|
+
mode: "page";
|
|
449
|
+
page: number;
|
|
450
|
+
pageSize: number;
|
|
451
|
+
}>;
|
|
452
|
+
export type ResourceListQuery = Readonly<{
|
|
453
|
+
filter?: ResourceFilter;
|
|
454
|
+
includeDeleted?: boolean;
|
|
455
|
+
pagination: ResourcePagination;
|
|
456
|
+
sort?: readonly ResourceSort[];
|
|
457
|
+
textSearch?: string;
|
|
458
|
+
}>;
|
|
459
|
+
export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable";
|
|
460
|
+
export type ResourceError = Readonly<{
|
|
461
|
+
code: ResourceErrorCode;
|
|
462
|
+
/** Client-observed dispatch outcome; uncertainty never proves rollback. */
|
|
463
|
+
outcome?: "not_dispatched" | "rejected" | "uncertain";
|
|
464
|
+
details?: Readonly<Record<string, ResourceJsonValue>>;
|
|
465
|
+
message: string;
|
|
466
|
+
retryable: boolean;
|
|
467
|
+
}>;
|
|
468
|
+
export type ResourceResult<Value> = Readonly<{
|
|
469
|
+
correlationId: string;
|
|
470
|
+
ok: true;
|
|
471
|
+
value: Value;
|
|
472
|
+
}> | Readonly<{
|
|
473
|
+
correlationId: string;
|
|
474
|
+
error: ResourceError;
|
|
475
|
+
ok: false;
|
|
476
|
+
}>;
|
|
477
|
+
export type ResourceListRequest = Readonly<{
|
|
478
|
+
operation: "list";
|
|
479
|
+
query: ResourceListQuery;
|
|
480
|
+
requestId: string;
|
|
481
|
+
resourceId: string;
|
|
482
|
+
}>;
|
|
483
|
+
export type ResourceGetRequest = Readonly<{
|
|
484
|
+
id: ResourceRecordId;
|
|
485
|
+
includeDeleted?: boolean;
|
|
486
|
+
operation: "get";
|
|
487
|
+
requestId: string;
|
|
488
|
+
resourceId: string;
|
|
489
|
+
}>;
|
|
490
|
+
export type ResourceCreateRequest<Create> = Readonly<{
|
|
491
|
+
idempotencyKey: IdempotencyKey;
|
|
492
|
+
operation: "create";
|
|
493
|
+
requestId: string;
|
|
494
|
+
resourceId: string;
|
|
495
|
+
value: Create;
|
|
496
|
+
}>;
|
|
497
|
+
export type ResourceUpdateRequest<Update> = Readonly<{
|
|
498
|
+
expectedRevision: ResourceRevision;
|
|
499
|
+
id: ResourceRecordId;
|
|
500
|
+
idempotencyKey?: IdempotencyKey;
|
|
501
|
+
operation: "update";
|
|
502
|
+
requestId: string;
|
|
503
|
+
resourceId: string;
|
|
504
|
+
value: Update;
|
|
505
|
+
}>;
|
|
506
|
+
export type ResourceLifecycleRequest = Readonly<{
|
|
507
|
+
expectedRevision: ResourceRevision;
|
|
508
|
+
id: ResourceRecordId;
|
|
509
|
+
idempotencyKey?: IdempotencyKey;
|
|
510
|
+
operation: "hard_delete" | "restore" | "soft_delete";
|
|
511
|
+
requestId: string;
|
|
512
|
+
resourceId: string;
|
|
513
|
+
}>;
|
|
514
|
+
export type ResourceTransportRequest = ResourceCreateRequest<unknown> | ResourceGetRequest | ResourceLifecycleRequest | ResourceListRequest | ResourceUpdateRequest<unknown>;
|
|
515
|
+
/** Application login identities are separate from gateway machine callers. */
|
|
516
|
+
export type ApplicationUserIdentity = Readonly<{
|
|
517
|
+
kind: "local_user";
|
|
518
|
+
id: string;
|
|
519
|
+
email: string;
|
|
520
|
+
name: string | null;
|
|
521
|
+
} | {
|
|
522
|
+
kind: "ci_user";
|
|
523
|
+
id: string;
|
|
524
|
+
email: string | null;
|
|
525
|
+
name: string | null;
|
|
526
|
+
issuer: string;
|
|
527
|
+
organizationId: string;
|
|
528
|
+
}>;
|
|
529
|
+
export type ApplicationUserSession = Readonly<{
|
|
530
|
+
identity: ApplicationUserIdentity;
|
|
531
|
+
expiresAt: Date;
|
|
532
|
+
}>;
|
|
533
|
+
/** Constructed only after user/app/organization authorization at server ingress.
|
|
534
|
+
* Canonical identities survive proxy hops and scope mutation receipts; credentials
|
|
535
|
+
* and request/correlation IDs are deliberately not part of that logical identity.
|
|
536
|
+
*/
|
|
537
|
+
export type EntityInvocationContext = Readonly<{
|
|
538
|
+
applicationId: string;
|
|
539
|
+
issuer: string;
|
|
540
|
+
organizationId: string;
|
|
541
|
+
resourceId: string;
|
|
542
|
+
roles: readonly string[];
|
|
543
|
+
scopes: readonly string[];
|
|
544
|
+
teamIds: readonly string[];
|
|
545
|
+
user: ApplicationUserIdentity;
|
|
546
|
+
}>;
|
|
547
|
+
export type ApplicationUserAuth = Readonly<{
|
|
548
|
+
mode: "federated" | "local";
|
|
549
|
+
handler: (request: Request) => Promise<Response>;
|
|
550
|
+
/** Returns null only when the request has no valid application session. */
|
|
551
|
+
getSession: (request: Request) => Promise<ApplicationUserSession | null>;
|
|
552
|
+
/** Server-only current CI authority. The host still owns resource/operation policy.
|
|
553
|
+
* Null means no valid CI session or no current role/team policy supplied by CI.
|
|
554
|
+
*/
|
|
555
|
+
getEntityContext: (request: Request, resourceId: string) => Promise<EntityInvocationContext | null>;
|
|
556
|
+
/** Server-only Delegated access token. Absent for local application login. */
|
|
557
|
+
getAccessToken?: (request: Request) => Promise<string | null>;
|
|
558
|
+
}>;
|
|
559
|
+
/** Full inventory only: no filters, text search or caller-selected ordering.
|
|
560
|
+
* Continue consecutive pages with the first watermark. A conflict requires restart.
|
|
561
|
+
*/
|
|
562
|
+
export type ResourceInventoryRequest = Readonly<{
|
|
563
|
+
page: number;
|
|
564
|
+
pageSize: number;
|
|
565
|
+
watermark?: string;
|
|
566
|
+
}>;
|
|
567
|
+
export type GatewayResourceOperation = ResourceTransportRequest["operation"];
|
|
568
|
+
export type GatewayResourceAuthorization = Readonly<Partial<Record<GatewayResourceOperation, AuthorizationRequirement>>>;
|
|
569
|
+
export type GatewayResourceDefinition<Entity = unknown, Create = Entity, Update = Partial<Entity>> = Readonly<{
|
|
570
|
+
authorization: GatewayResourceAuthorization;
|
|
571
|
+
definition: ResourceDefinition<Entity, Create, Update>;
|
|
572
|
+
execute: (request: ResourceTransportRequest, context: GatewayInvocationContext, options?: Readonly<{
|
|
573
|
+
signal?: AbortSignal;
|
|
574
|
+
}>) => Promise<ResourceResult<unknown>>;
|
|
575
|
+
scan?: (request: ResourceInventoryRequest & Readonly<{
|
|
576
|
+
requestId: string;
|
|
577
|
+
resourceId: string;
|
|
578
|
+
}>, context: GatewayInvocationContext, options?: Readonly<{
|
|
579
|
+
signal?: AbortSignal;
|
|
580
|
+
}>) => Promise<ResourceResult<unknown>>;
|
|
581
|
+
changes?: (request: Readonly<{
|
|
582
|
+
cursor?: string;
|
|
583
|
+
limit: number;
|
|
584
|
+
requestId: string;
|
|
585
|
+
resourceId: string;
|
|
586
|
+
}>, context: GatewayInvocationContext, options?: Readonly<{
|
|
587
|
+
signal?: AbortSignal;
|
|
588
|
+
}>) => Promise<ResourceResult<unknown>>;
|
|
589
|
+
}>;
|
|
590
|
+
/**
|
|
591
|
+
* Runtime dispatch validates the declared input schema before invoking a
|
|
592
|
+
* handler. The bivariant call signature lets domains retain heterogeneous,
|
|
593
|
+
* strongly typed handlers while exposing one erased operation collection.
|
|
594
|
+
*/
|
|
595
|
+
export type GatewayOperationHandler<Input = unknown, Output = unknown> = {
|
|
596
|
+
bivarianceHack(request: Readonly<{
|
|
597
|
+
context: GatewayInvocationContext;
|
|
598
|
+
/** Validated caller key; the handler owns durable replay storage. */
|
|
599
|
+
idempotencyKey?: string;
|
|
600
|
+
input: Input;
|
|
601
|
+
signal: AbortSignal;
|
|
602
|
+
}>): Promise<Output>;
|
|
603
|
+
}["bivarianceHack"];
|
|
604
|
+
export type GatewayOperationDefinition<Input = unknown, Output = unknown> = Omit<PortableOperationDeclaration, "input" | "output"> & Readonly<{
|
|
605
|
+
handler: GatewayOperationHandler<Input, Output>;
|
|
606
|
+
input: PackageSchemaProjection;
|
|
607
|
+
output: PackageSchemaProjection;
|
|
608
|
+
}>;
|
|
609
|
+
export type GatewayOperationManifest = Omit<GatewayOperationDefinition, "handler"> & Readonly<{
|
|
610
|
+
canonicalReference: string;
|
|
611
|
+
}>;
|
|
612
|
+
export type GatewayOperationDomainDefinition = OperationDomainDeclaration<GatewayOperationDefinition>;
|
|
613
|
+
export type GatewayOperationDomainManifest = OperationDomainDeclaration<GatewayOperationManifest>;
|
|
614
|
+
/** CI destination marker only; source records are shared across all connections. */
|
|
615
|
+
export type OrganizationBinding = Readonly<{
|
|
616
|
+
mode: "installed_organization";
|
|
617
|
+
}>;
|
|
618
|
+
export type GatewayKnowledgeResourceExposure = Readonly<{
|
|
619
|
+
resource: GatewayResourceDefinition;
|
|
620
|
+
access: "read" | "read_write";
|
|
621
|
+
}>;
|
|
622
|
+
export type GatewayDatasetBinding = Readonly<{
|
|
623
|
+
id: string;
|
|
624
|
+
title: string;
|
|
625
|
+
definition: DatasetDefinition;
|
|
626
|
+
authorization: AuthorizationRequirement;
|
|
627
|
+
providerFqn: string;
|
|
628
|
+
query: (input: QueryInput, context: GatewayInvocationContext, options: Readonly<{
|
|
629
|
+
signal: AbortSignal;
|
|
630
|
+
}>) => Promise<DatasetProviderResult<DatasetResultPage>>;
|
|
631
|
+
}>;
|
|
632
|
+
export type GatewayDatasetManifest = Omit<GatewayDatasetBinding, "query"> & Readonly<{
|
|
633
|
+
capabilities: DatasetProviderCapabilities;
|
|
634
|
+
}>;
|
|
635
|
+
export type GatewayDefinitionInput = Readonly<{
|
|
636
|
+
knowledge?: readonly GatewayKnowledgeResourceExposure[];
|
|
637
|
+
datasets?: readonly GatewayDatasetBinding[];
|
|
638
|
+
id: string;
|
|
639
|
+
operationDomains: readonly GatewayOperationDomainDefinition[];
|
|
640
|
+
organizationBinding?: OrganizationBinding;
|
|
641
|
+
protocolVersion?: "2";
|
|
642
|
+
version: string;
|
|
643
|
+
}>;
|
|
644
|
+
export type GatewayManifest = Readonly<{
|
|
645
|
+
capabilities: Readonly<{
|
|
646
|
+
resources: boolean;
|
|
647
|
+
}>;
|
|
648
|
+
datasets: readonly GatewayDatasetManifest[];
|
|
649
|
+
knowledge: readonly Readonly<{
|
|
650
|
+
id: string;
|
|
651
|
+
access: "read" | "read_write";
|
|
652
|
+
definition: GatewayResourceDefinition["definition"];
|
|
653
|
+
fullInventory: boolean;
|
|
654
|
+
incrementalChanges: boolean;
|
|
655
|
+
}>[];
|
|
656
|
+
contentHash: string;
|
|
657
|
+
id: string;
|
|
658
|
+
operationDomains: readonly GatewayOperationDomainManifest[];
|
|
659
|
+
organizationBinding: OrganizationBinding;
|
|
660
|
+
protocolVersion: "2";
|
|
661
|
+
revision: string;
|
|
662
|
+
version: string;
|
|
663
|
+
}>;
|
|
664
|
+
export type GatewayProposal = Readonly<{
|
|
665
|
+
gatewayId: string;
|
|
666
|
+
gatewayVersion: string;
|
|
667
|
+
knowledge: GatewayManifest["knowledge"];
|
|
668
|
+
operationDomains: readonly GatewayOperationDomainManifest[];
|
|
669
|
+
revision: string;
|
|
670
|
+
}>;
|
|
671
|
+
export interface DefinedGateway {
|
|
672
|
+
readonly input: GatewayDefinitionInput;
|
|
673
|
+
readonly resource: (id: string) => GatewayResourceDefinition | undefined;
|
|
674
|
+
readonly dataset: (id: string) => GatewayDatasetBinding | undefined;
|
|
675
|
+
readonly manifest: GatewayManifest;
|
|
676
|
+
readonly proposal: GatewayProposal;
|
|
677
|
+
}
|
|
678
|
+
export interface GatewayKernel {
|
|
679
|
+
readonly handle: (request: Request) => Promise<Response>;
|
|
680
|
+
readonly manifest: DefinedGateway["manifest"];
|
|
681
|
+
}
|
|
682
|
+
export interface ExternalApplicationExternalAuditSubject {
|
|
683
|
+
readonly issuer: string;
|
|
684
|
+
readonly mappedUserId?: string;
|
|
685
|
+
readonly subjectId: string;
|
|
686
|
+
}
|
|
687
|
+
export interface ConfidentialCredentials {
|
|
688
|
+
readonly clientId: string;
|
|
689
|
+
readonly clientSecret: string;
|
|
690
|
+
}
|
|
691
|
+
export interface RotatingConfidentialCredentialProvider {
|
|
692
|
+
readonly getCredentials: () => ConfidentialCredentials | Promise<ConfidentialCredentials>;
|
|
693
|
+
}
|
|
694
|
+
export type ConfidentialCredentialProvider = ConfidentialCredentials | RotatingConfidentialCredentialProvider;
|
|
695
|
+
export type ServiceServerAuthentication = Readonly<{
|
|
696
|
+
credentials: ConfidentialCredentialProvider;
|
|
697
|
+
mode: "service";
|
|
698
|
+
}>;
|
|
699
|
+
/** Application credentials authorize each call for a required Audit subject in one configured organization. */
|
|
700
|
+
export type ServiceCapabilityAuthorization = Readonly<{
|
|
701
|
+
authentication: ServiceServerAuthentication;
|
|
702
|
+
/**
|
|
703
|
+
* Who makes each forwarded call; defaults to `"service"`. `"anonymous_visitor"`
|
|
704
|
+
* marks each call as made by the anonymous visitor the Audit subject names:
|
|
705
|
+
* the backend then runs only the Agent's own bindings and never the
|
|
706
|
+
* application's service authority. A visitor is never a CI user, so an Audit
|
|
707
|
+
* subject carrying `mappedUserId` is refused with `401`.
|
|
708
|
+
*/
|
|
709
|
+
caller?: "anonymous_visitor" | "service";
|
|
710
|
+
getAuditSubject: (request: Request) => Promise<ExternalApplicationExternalAuditSubject | null>;
|
|
711
|
+
organizationId: string;
|
|
712
|
+
}>;
|
|
713
|
+
export type UserAuthScopePolicy = Readonly<{
|
|
714
|
+
readScope: string;
|
|
715
|
+
writeScope: string;
|
|
716
|
+
}>;
|
|
717
|
+
export type CiResourceBinding<Value = unknown, Create = Value, Patch = Partial<Value>> = Readonly<{
|
|
718
|
+
definition: ResourceDefinition<Value, Create, Patch>;
|
|
719
|
+
schemaFqn: string;
|
|
720
|
+
}>;
|
|
721
|
+
export type CiResourcesOptions = Readonly<{
|
|
722
|
+
auth: Pick<ApplicationUserAuth, "getEntityContext">;
|
|
723
|
+
bindings: readonly CiResourceBinding[];
|
|
724
|
+
fetch?: typeof globalThis.fetch;
|
|
725
|
+
organizationId: string;
|
|
726
|
+
policy?: UserAuthScopePolicy;
|
|
727
|
+
tenantUrl: string;
|
|
728
|
+
}>;
|
|
729
|
+
export type BffResourceMount = Readonly<{
|
|
730
|
+
basePath: string;
|
|
731
|
+
handler: (request: Request) => Promise<Response>;
|
|
732
|
+
}>;
|
|
733
|
+
/** Dedicated Capability forwarding: the user's delegated token by default, or service credentials with an Audit subject. */
|
|
734
|
+
export type ExternalApplicationBffCapabilities = Readonly<{
|
|
735
|
+
basePath?: string;
|
|
736
|
+
fetch?: typeof globalThis.fetch;
|
|
737
|
+
tenantUrl: string;
|
|
738
|
+
}> & (Readonly<{
|
|
739
|
+
authentication?: never;
|
|
740
|
+
}> | ServiceCapabilityAuthorization);
|
|
741
|
+
export type ExternalApplicationBffOptions = Readonly<{
|
|
742
|
+
auth: ApplicationUserAuth;
|
|
743
|
+
authBasePath?: string;
|
|
744
|
+
capabilities?: ExternalApplicationBffCapabilities;
|
|
745
|
+
ciResources?: Omit<CiResourcesOptions, "auth">;
|
|
746
|
+
publicOrigin: string;
|
|
747
|
+
resources?: readonly BffResourceMount[];
|
|
748
|
+
}>;
|
|
749
|
+
export type ExternalApplicationBff = (request: Request) => Promise<Response>;
|
|
750
|
+
export type WorkflowTarget = Readonly<{
|
|
751
|
+
workflowId: string;
|
|
752
|
+
workflowFqn?: never;
|
|
753
|
+
}> | Readonly<{
|
|
754
|
+
workflowFqn: string;
|
|
755
|
+
workflowId?: never;
|
|
756
|
+
}>;
|
|
757
|
+
export type FixedWorkflowRouteOptions<Input, Params = Record<string, never>> = Readonly<{
|
|
758
|
+
auth: Pick<ApplicationUserAuth, "getAccessToken" | "getEntityContext">;
|
|
759
|
+
fetch?: typeof globalThis.fetch;
|
|
760
|
+
publicOrigin: string;
|
|
761
|
+
tenantUrl: string;
|
|
762
|
+
validate: (body: unknown, params: Params) => Input;
|
|
763
|
+
resourceId: string;
|
|
764
|
+
requiredScopes?: readonly string[];
|
|
765
|
+
idempotencyKey?: (input: Input, context: EntityInvocationContext, request: Request) => string | null;
|
|
766
|
+
authorize?: (request: Request) => Promise<EntityInvocationContext | Response>;
|
|
767
|
+
getAccessToken?: (request: Request) => Promise<string | null>;
|
|
768
|
+
}> & WorkflowTarget;
|
|
769
|
+
export type GatewayWebHandler = (request: Request) => Promise<Response>;
|
|
770
|
+
export type GatewayRuntimeKernel = Pick<GatewayKernel, "handle">;
|
|
771
|
+
export declare const cookies: (request: Request) => string | null, createCiResourceMounts: (options: CiResourcesOptions) => {
|
|
772
|
+
basePath: string;
|
|
773
|
+
handler: (request: Request) => Promise<Response>;
|
|
774
|
+
}[], createExternalApplicationBff: (options: ExternalApplicationBffOptions) => ExternalApplicationBff, createFixedWorkflowRoute: <Input, Params = Record<string, never>>(options: FixedWorkflowRouteOptions<Input, Params>) => ((request: Request, params: Params) => Promise<Response>), createGatewayWebHandler: (kernel: GatewayRuntimeKernel) => GatewayWebHandler, headers: (request: Request) => Headers, publicOriginFromHeaders: (headerList: Headers, fallbackOrigin: string) => string, requestWithPublicOrigin: (request: Request, publicOrigin: string) => Request;
|
|
775
|
+
|
|
776
|
+
export {};
|