@collective-intelligence/external-apps-server-sdk 0.0.0-stage → 0.1.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 +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,954 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import * as Schema from 'effect/Schema';
|
|
5
|
+
|
|
6
|
+
/** Application login identities are separate from gateway machine callers. */
|
|
7
|
+
export type ApplicationUserIdentity = Readonly<{
|
|
8
|
+
kind: "local_user";
|
|
9
|
+
id: string;
|
|
10
|
+
email: string;
|
|
11
|
+
name: string | null;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "ci_user";
|
|
14
|
+
id: string;
|
|
15
|
+
email: string | null;
|
|
16
|
+
name: string | null;
|
|
17
|
+
issuer: string;
|
|
18
|
+
organizationId: string;
|
|
19
|
+
}>;
|
|
20
|
+
/** Constructed only after user/app/organization authorization at server ingress.
|
|
21
|
+
* Canonical identities survive proxy hops and scope mutation receipts; credentials
|
|
22
|
+
* and request/correlation IDs are deliberately not part of that logical identity.
|
|
23
|
+
*/
|
|
24
|
+
export type EntityInvocationContext = Readonly<{
|
|
25
|
+
applicationId: string;
|
|
26
|
+
issuer: string;
|
|
27
|
+
organizationId: string;
|
|
28
|
+
resourceId: string;
|
|
29
|
+
roles: readonly string[];
|
|
30
|
+
scopes: readonly string[];
|
|
31
|
+
teamIds: readonly string[];
|
|
32
|
+
user: ApplicationUserIdentity;
|
|
33
|
+
}>;
|
|
34
|
+
export type ResourceJsonValue = null | boolean | number | string | readonly ResourceJsonValue[] | Readonly<{
|
|
35
|
+
[key: string]: ResourceJsonValue;
|
|
36
|
+
}>;
|
|
37
|
+
/** Opaque wire identity. Callers must not infer or concatenate its internals. */
|
|
38
|
+
export type ResourceId = string;
|
|
39
|
+
export type ResourceRecordId = ResourceId;
|
|
40
|
+
/** Opaque concurrency token independent from source timestamps. */
|
|
41
|
+
export type ResourceRevision = string;
|
|
42
|
+
/** Opaque pagination position issued and consumed only by a resource adapter. */
|
|
43
|
+
export type ResourceCursor = string;
|
|
44
|
+
export type IdempotencyKey = string;
|
|
45
|
+
export type ResourceIdentityField = Readonly<{
|
|
46
|
+
name: string;
|
|
47
|
+
type: "number" | "string";
|
|
48
|
+
}>;
|
|
49
|
+
export type ResourceCapabilities = Readonly<{
|
|
50
|
+
create?: boolean;
|
|
51
|
+
/** Common entity deletion is always soft deletion. */
|
|
52
|
+
delete?: boolean;
|
|
53
|
+
get?: boolean;
|
|
54
|
+
hardDelete?: boolean;
|
|
55
|
+
includeDeleted?: boolean;
|
|
56
|
+
restore?: boolean;
|
|
57
|
+
search: true;
|
|
58
|
+
softDelete?: boolean;
|
|
59
|
+
update?: boolean;
|
|
60
|
+
}>;
|
|
61
|
+
export type ResourcePaginationMode = "cursor" | "page";
|
|
62
|
+
export type PortableResourceSchema = Readonly<Record<string, ResourceJsonValue>>;
|
|
63
|
+
export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>> = Readonly<{
|
|
64
|
+
capabilities: ResourceCapabilities;
|
|
65
|
+
concurrency: "revision";
|
|
66
|
+
id: string;
|
|
67
|
+
identity: Readonly<{
|
|
68
|
+
fields: readonly [
|
|
69
|
+
ResourceIdentityField,
|
|
70
|
+
...ResourceIdentityField[]
|
|
71
|
+
];
|
|
72
|
+
}>;
|
|
73
|
+
query: Readonly<{
|
|
74
|
+
filterableFields: readonly string[];
|
|
75
|
+
pagination: Readonly<{
|
|
76
|
+
modes: readonly ResourcePaginationMode[];
|
|
77
|
+
}>;
|
|
78
|
+
sortableFields: readonly string[];
|
|
79
|
+
textSearchFields?: readonly string[];
|
|
80
|
+
}>;
|
|
81
|
+
schemas: Readonly<{
|
|
82
|
+
create?: PortableResourceSchema;
|
|
83
|
+
entity: PortableResourceSchema;
|
|
84
|
+
update?: PortableResourceSchema;
|
|
85
|
+
}>;
|
|
86
|
+
version: string;
|
|
87
|
+
/** Portable UI metadata; required/enum/nullability remain in schemas. */
|
|
88
|
+
metadata?: Readonly<Record<string, ResourceJsonValue>>;
|
|
89
|
+
/** Type-only slots keep definition values portable and serializable. */
|
|
90
|
+
readonly __types?: Readonly<{
|
|
91
|
+
create: Create;
|
|
92
|
+
entity: Entity;
|
|
93
|
+
update: Update;
|
|
94
|
+
}>;
|
|
95
|
+
}>;
|
|
96
|
+
export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
|
|
97
|
+
export type ResourceFilter = Readonly<{
|
|
98
|
+
field: string;
|
|
99
|
+
operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
100
|
+
value: FilterValue;
|
|
101
|
+
}> | Readonly<{
|
|
102
|
+
field: string;
|
|
103
|
+
operator: "is_not_null" | "is_null";
|
|
104
|
+
}> | Readonly<{
|
|
105
|
+
filters: readonly ResourceFilter[];
|
|
106
|
+
operator: "and" | "or";
|
|
107
|
+
}> | Readonly<{
|
|
108
|
+
filter: ResourceFilter;
|
|
109
|
+
operator: "not";
|
|
110
|
+
}>;
|
|
111
|
+
export type ResourceSort = Readonly<{
|
|
112
|
+
direction: "asc" | "desc";
|
|
113
|
+
field: string;
|
|
114
|
+
}>;
|
|
115
|
+
export type ResourcePagination = Readonly<{
|
|
116
|
+
mode: "cursor";
|
|
117
|
+
cursor?: ResourceCursor;
|
|
118
|
+
limit: number;
|
|
119
|
+
}> | Readonly<{
|
|
120
|
+
mode: "page";
|
|
121
|
+
page: number;
|
|
122
|
+
pageSize: number;
|
|
123
|
+
}>;
|
|
124
|
+
export type ResourceListQuery = Readonly<{
|
|
125
|
+
filter?: ResourceFilter;
|
|
126
|
+
includeDeleted?: boolean;
|
|
127
|
+
pagination: ResourcePagination;
|
|
128
|
+
sort?: readonly ResourceSort[];
|
|
129
|
+
textSearch?: string;
|
|
130
|
+
}>;
|
|
131
|
+
export type ResourceRecord<Entity> = Readonly<{
|
|
132
|
+
deletedAt?: string;
|
|
133
|
+
id: ResourceRecordId;
|
|
134
|
+
revision: ResourceRevision;
|
|
135
|
+
value: Entity;
|
|
136
|
+
}>;
|
|
137
|
+
export type ResourceListResult<Entity> = Readonly<{
|
|
138
|
+
items: readonly ResourceRecord<Entity>[];
|
|
139
|
+
nextCursor?: ResourceCursor;
|
|
140
|
+
pagination: "cursor";
|
|
141
|
+
}> | Readonly<{
|
|
142
|
+
items: readonly ResourceRecord<Entity>[];
|
|
143
|
+
page: number;
|
|
144
|
+
pageSize: number;
|
|
145
|
+
pagination: "page";
|
|
146
|
+
totalItems: number;
|
|
147
|
+
totalPages: number;
|
|
148
|
+
}>;
|
|
149
|
+
export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable";
|
|
150
|
+
export type ResourceError = Readonly<{
|
|
151
|
+
code: ResourceErrorCode;
|
|
152
|
+
/** Client-observed dispatch outcome; uncertainty never proves rollback. */
|
|
153
|
+
outcome?: "not_dispatched" | "rejected" | "uncertain";
|
|
154
|
+
details?: Readonly<Record<string, ResourceJsonValue>>;
|
|
155
|
+
message: string;
|
|
156
|
+
retryable: boolean;
|
|
157
|
+
}>;
|
|
158
|
+
export type ResourceResult<Value> = Readonly<{
|
|
159
|
+
correlationId: string;
|
|
160
|
+
ok: true;
|
|
161
|
+
value: Value;
|
|
162
|
+
}> | Readonly<{
|
|
163
|
+
correlationId: string;
|
|
164
|
+
error: ResourceError;
|
|
165
|
+
ok: false;
|
|
166
|
+
}>;
|
|
167
|
+
export type ResourceListRequest = Readonly<{
|
|
168
|
+
operation: "list";
|
|
169
|
+
query: ResourceListQuery;
|
|
170
|
+
requestId: string;
|
|
171
|
+
resourceId: string;
|
|
172
|
+
}>;
|
|
173
|
+
export type ResourceGetRequest = Readonly<{
|
|
174
|
+
id: ResourceRecordId;
|
|
175
|
+
includeDeleted?: boolean;
|
|
176
|
+
operation: "get";
|
|
177
|
+
requestId: string;
|
|
178
|
+
resourceId: string;
|
|
179
|
+
}>;
|
|
180
|
+
export type ResourceCreateRequest<Create> = Readonly<{
|
|
181
|
+
idempotencyKey: IdempotencyKey;
|
|
182
|
+
operation: "create";
|
|
183
|
+
requestId: string;
|
|
184
|
+
resourceId: string;
|
|
185
|
+
value: Create;
|
|
186
|
+
}>;
|
|
187
|
+
export type ResourceUpdateRequest<Update> = Readonly<{
|
|
188
|
+
expectedRevision: ResourceRevision;
|
|
189
|
+
id: ResourceRecordId;
|
|
190
|
+
idempotencyKey?: IdempotencyKey;
|
|
191
|
+
operation: "update";
|
|
192
|
+
requestId: string;
|
|
193
|
+
resourceId: string;
|
|
194
|
+
value: Update;
|
|
195
|
+
}>;
|
|
196
|
+
export type ResourceLifecycleRequest = Readonly<{
|
|
197
|
+
expectedRevision: ResourceRevision;
|
|
198
|
+
id: ResourceRecordId;
|
|
199
|
+
idempotencyKey?: IdempotencyKey;
|
|
200
|
+
operation: "hard_delete" | "restore" | "soft_delete";
|
|
201
|
+
requestId: string;
|
|
202
|
+
resourceId: string;
|
|
203
|
+
}>;
|
|
204
|
+
export type ResourceTransportRequest = ResourceCreateRequest<unknown> | ResourceGetRequest | ResourceLifecycleRequest | ResourceListRequest | ResourceUpdateRequest<unknown>;
|
|
205
|
+
export type ResourceMutationInput<Value> = Readonly<{
|
|
206
|
+
expectedRevision: ResourceRevision;
|
|
207
|
+
id: ResourceRecordId;
|
|
208
|
+
idempotencyKey?: IdempotencyKey;
|
|
209
|
+
value: Value;
|
|
210
|
+
}>;
|
|
211
|
+
export type ResourceLifecycleInput = Readonly<{
|
|
212
|
+
expectedRevision: ResourceRevision;
|
|
213
|
+
id: ResourceRecordId;
|
|
214
|
+
idempotencyKey?: IdempotencyKey;
|
|
215
|
+
}>;
|
|
216
|
+
export type ResourceCreateInput<Value> = Readonly<{
|
|
217
|
+
idempotencyKey: IdempotencyKey;
|
|
218
|
+
value: Value;
|
|
219
|
+
}>;
|
|
220
|
+
/** Common entity operations. Generic resource lifecycle/cursor APIs remain separate. */
|
|
221
|
+
export type EntityOperation = "list" | "get" | "create" | "update" | "delete";
|
|
222
|
+
export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
|
|
223
|
+
pagination: Extract<ResourcePagination, {
|
|
224
|
+
mode: "page";
|
|
225
|
+
}>;
|
|
226
|
+
}>;
|
|
227
|
+
export type EntityPage<Value> = Extract<ResourceListResult<Value>, {
|
|
228
|
+
pagination: "page";
|
|
229
|
+
}>;
|
|
230
|
+
export type EntityCreateInput<Value> = ResourceCreateInput<Value>;
|
|
231
|
+
export type EntityUpdateInput<Patch> = ResourceMutationInput<Patch> & Readonly<{
|
|
232
|
+
idempotencyKey: IdempotencyKey;
|
|
233
|
+
}>;
|
|
234
|
+
export type EntityDeleteInput = ResourceLifecycleInput & Readonly<{
|
|
235
|
+
idempotencyKey: IdempotencyKey;
|
|
236
|
+
}>;
|
|
237
|
+
export type EntityRequestIdentity = Readonly<{
|
|
238
|
+
requestId: string;
|
|
239
|
+
resourceId: string;
|
|
240
|
+
}>;
|
|
241
|
+
export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIdentity & (Readonly<{
|
|
242
|
+
operation: "list";
|
|
243
|
+
query: EntityListQuery;
|
|
244
|
+
}> | Readonly<{
|
|
245
|
+
operation: "get";
|
|
246
|
+
id: ResourceRecordId;
|
|
247
|
+
}> | (Readonly<{
|
|
248
|
+
operation: "create";
|
|
249
|
+
}> & EntityCreateInput<Create>) | (Readonly<{
|
|
250
|
+
operation: "update";
|
|
251
|
+
}> & EntityUpdateInput<Patch>) | (Readonly<{
|
|
252
|
+
operation: "delete";
|
|
253
|
+
}> & EntityDeleteInput));
|
|
254
|
+
export type PrincipalKind = "detached_user" | "service_principal";
|
|
255
|
+
export type DelegatedSubjectPolicy = "allowed" | "forbidden" | "required";
|
|
256
|
+
export type AuthorizationRequirement = Readonly<{
|
|
257
|
+
delegatedSubject?: DelegatedSubjectPolicy;
|
|
258
|
+
organization: "required";
|
|
259
|
+
principalKinds: readonly PrincipalKind[];
|
|
260
|
+
scopes: readonly string[];
|
|
261
|
+
}>;
|
|
262
|
+
export type ExternalAuditSubject = Readonly<{
|
|
263
|
+
issuer: string;
|
|
264
|
+
mappedCiUserId?: string;
|
|
265
|
+
subject: string;
|
|
266
|
+
}>;
|
|
267
|
+
export type GatewayCallerIdentity = Readonly<{
|
|
268
|
+
audience: readonly string[];
|
|
269
|
+
binding: string;
|
|
270
|
+
expiresAt: number;
|
|
271
|
+
installationId: string;
|
|
272
|
+
issuer: string;
|
|
273
|
+
organizationId: string;
|
|
274
|
+
principalKind: PrincipalKind;
|
|
275
|
+
requestId: string;
|
|
276
|
+
scopes: readonly string[];
|
|
277
|
+
subject: string;
|
|
278
|
+
}>;
|
|
279
|
+
export type GatewayInvocationContext = Readonly<{
|
|
280
|
+
caller: GatewayCallerIdentity;
|
|
281
|
+
correlationId: string;
|
|
282
|
+
externalAuditSubject?: ExternalAuditSubject;
|
|
283
|
+
organizationId: string;
|
|
284
|
+
}>;
|
|
285
|
+
export type ResourceChange<Entity> = Readonly<{
|
|
286
|
+
kind: "upsert";
|
|
287
|
+
record: ResourceRecord<Entity>;
|
|
288
|
+
}> | Readonly<{
|
|
289
|
+
kind: "tombstone";
|
|
290
|
+
id: string;
|
|
291
|
+
revision: string;
|
|
292
|
+
deletedAt: string;
|
|
293
|
+
}>;
|
|
294
|
+
export type ResourceChangePage<Entity> = Readonly<{
|
|
295
|
+
changes: readonly ResourceChange<Entity>[];
|
|
296
|
+
nextCursor?: string;
|
|
297
|
+
}>;
|
|
298
|
+
/** Full inventory only: no filters, text search or caller-selected ordering.
|
|
299
|
+
* Continue consecutive pages with the first watermark. A conflict requires restart.
|
|
300
|
+
*/
|
|
301
|
+
export type ResourceInventoryRequest = Readonly<{
|
|
302
|
+
page: number;
|
|
303
|
+
pageSize: number;
|
|
304
|
+
watermark?: string;
|
|
305
|
+
}>;
|
|
306
|
+
export type ResourceInventoryPage<Entity> = Extract<ResourceListResult<Entity>, {
|
|
307
|
+
pagination: "page";
|
|
308
|
+
}> & Readonly<{
|
|
309
|
+
/** Resource-scoped committed change cursor; consume deltas strictly after it. */
|
|
310
|
+
watermark: string;
|
|
311
|
+
}>;
|
|
312
|
+
export type ResourceMutation = Readonly<{
|
|
313
|
+
id: string;
|
|
314
|
+
expectedRevision: string;
|
|
315
|
+
}>;
|
|
316
|
+
export interface CrudRepository<Entity, Create = Entity, Update = Partial<Entity>> {
|
|
317
|
+
readonly list: (query: ResourceListQuery, context?: EntityInvocationContext) => Promise<ResourceListResult<Entity>>;
|
|
318
|
+
readonly scan?: (request: ResourceInventoryRequest) => Promise<ResourceInventoryPage<Entity>>;
|
|
319
|
+
readonly get?: (id: string, includeDeleted?: boolean, context?: EntityInvocationContext) => Promise<ResourceRecord<Entity>>;
|
|
320
|
+
readonly create?: (value: Create, idempotencyKey: string, context?: EntityInvocationContext) => Promise<ResourceRecord<Entity>>;
|
|
321
|
+
readonly update?: (input: ResourceMutation & Readonly<{
|
|
322
|
+
value: Update;
|
|
323
|
+
}>, context?: EntityInvocationContext) => Promise<ResourceRecord<Entity>>;
|
|
324
|
+
readonly hardDelete?: (input: ResourceMutation, context?: EntityInvocationContext) => Promise<void>;
|
|
325
|
+
readonly softDelete?: (input: ResourceMutation, context?: EntityInvocationContext) => Promise<ResourceRecord<Entity>>;
|
|
326
|
+
readonly restore?: (input: ResourceMutation, context?: EntityInvocationContext) => Promise<ResourceRecord<Entity>>;
|
|
327
|
+
readonly changes?: (input: Readonly<{
|
|
328
|
+
cursor?: string;
|
|
329
|
+
limit: number;
|
|
330
|
+
}>) => Promise<ResourceChangePage<Entity>>;
|
|
331
|
+
}
|
|
332
|
+
/** A configured local or CI-backed binding; no storage policy is exposed to browsers. */
|
|
333
|
+
export type EntityResourceDefinition<Value = unknown, Create = Value, Patch = Partial<Value>> = Readonly<{
|
|
334
|
+
definition: ResourceDefinition<Value, Create, Patch>;
|
|
335
|
+
execute: (request: EntityRequest<Create, Patch>, context: EntityInvocationContext, options?: Readonly<{
|
|
336
|
+
signal?: AbortSignal;
|
|
337
|
+
}>) => Promise<ResourceResult<EntityPage<Value> | ResourceRecord<Value>>>;
|
|
338
|
+
}>;
|
|
339
|
+
export type GatewayResourceOperation = ResourceTransportRequest["operation"];
|
|
340
|
+
export type GatewayResourceAuthorization = Readonly<Partial<Record<GatewayResourceOperation, AuthorizationRequirement>>>;
|
|
341
|
+
export type GatewayResourceDefinition<Entity = unknown, Create = Entity, Update = Partial<Entity>> = Readonly<{
|
|
342
|
+
authorization: GatewayResourceAuthorization;
|
|
343
|
+
definition: ResourceDefinition<Entity, Create, Update>;
|
|
344
|
+
execute: (request: ResourceTransportRequest, context: GatewayInvocationContext, options?: Readonly<{
|
|
345
|
+
signal?: AbortSignal;
|
|
346
|
+
}>) => Promise<ResourceResult<unknown>>;
|
|
347
|
+
scan?: (request: ResourceInventoryRequest & Readonly<{
|
|
348
|
+
requestId: string;
|
|
349
|
+
resourceId: string;
|
|
350
|
+
}>, context: GatewayInvocationContext, options?: Readonly<{
|
|
351
|
+
signal?: AbortSignal;
|
|
352
|
+
}>) => Promise<ResourceResult<unknown>>;
|
|
353
|
+
changes?: (request: Readonly<{
|
|
354
|
+
cursor?: string;
|
|
355
|
+
limit: number;
|
|
356
|
+
requestId: string;
|
|
357
|
+
resourceId: string;
|
|
358
|
+
}>, context: GatewayInvocationContext, options?: Readonly<{
|
|
359
|
+
signal?: AbortSignal;
|
|
360
|
+
}>) => Promise<ResourceResult<unknown>>;
|
|
361
|
+
}>;
|
|
362
|
+
export type CrudResource<Entity = unknown, Create = Entity, Update = Partial<Entity>> = GatewayResourceDefinition<Entity, Create, Update> & Readonly<{
|
|
363
|
+
executeCrud: (request: ResourceTransportRequest, context: EntityInvocationContext) => Promise<ResourceResult<unknown>>;
|
|
364
|
+
}>;
|
|
365
|
+
export type ResourceHttpHandlerOptions<Value = unknown, Create = Value, Patch = Partial<Value>> = Readonly<{
|
|
366
|
+
resource: CrudResource<Value, Create, Patch> | EntityResourceDefinition<Value, Create, Patch>;
|
|
367
|
+
/** Mount path including the entity name, e.g. /api/leads. */
|
|
368
|
+
basePath: string;
|
|
369
|
+
/** Host verifies the current CI session and resource policy; no browser identity is trusted. */
|
|
370
|
+
authorize: (request: Request, operation: ResourceTransportRequest["operation"] | EntityOperation) => Promise<EntityInvocationContext | Response>;
|
|
371
|
+
maxBodyBytes?: number;
|
|
372
|
+
}>;
|
|
373
|
+
export type JsonPrimitive = boolean | null | number | string;
|
|
374
|
+
export type JsonValue = JsonObject | JsonPrimitive | readonly JsonValue[];
|
|
375
|
+
export interface JsonObject {
|
|
376
|
+
readonly [key: string]: JsonValue;
|
|
377
|
+
}
|
|
378
|
+
declare const Draft202012Dialect: "https://json-schema.org/draft/2020-12/schema";
|
|
379
|
+
/** JSON-compatible Draft 2020-12 vocabulary used for portable manifests. */
|
|
380
|
+
export type JsonSchemaDocument = JsonObject & Readonly<{
|
|
381
|
+
$anchor?: string;
|
|
382
|
+
$comment?: string;
|
|
383
|
+
$defs?: Readonly<Record<string, JsonSchemaDocument>>;
|
|
384
|
+
$dynamicAnchor?: string;
|
|
385
|
+
$dynamicRef?: string;
|
|
386
|
+
$id?: string;
|
|
387
|
+
$ref?: string;
|
|
388
|
+
$schema?: typeof Draft202012Dialect;
|
|
389
|
+
additionalProperties?: boolean | JsonSchemaDocument;
|
|
390
|
+
allOf?: readonly JsonSchemaDocument[];
|
|
391
|
+
anyOf?: readonly JsonSchemaDocument[];
|
|
392
|
+
const?: JsonValue;
|
|
393
|
+
contains?: JsonSchemaDocument;
|
|
394
|
+
default?: JsonValue;
|
|
395
|
+
dependentRequired?: Readonly<Record<string, readonly string[]>>;
|
|
396
|
+
description?: string;
|
|
397
|
+
else?: JsonSchemaDocument;
|
|
398
|
+
enum?: readonly JsonValue[];
|
|
399
|
+
exclusiveMaximum?: number;
|
|
400
|
+
exclusiveMinimum?: number;
|
|
401
|
+
format?: string;
|
|
402
|
+
if?: JsonSchemaDocument;
|
|
403
|
+
items?: JsonSchemaDocument;
|
|
404
|
+
maxItems?: number;
|
|
405
|
+
maxLength?: number;
|
|
406
|
+
maxProperties?: number;
|
|
407
|
+
maximum?: number;
|
|
408
|
+
minItems?: number;
|
|
409
|
+
minLength?: number;
|
|
410
|
+
minProperties?: number;
|
|
411
|
+
minimum?: number;
|
|
412
|
+
multipleOf?: number;
|
|
413
|
+
not?: JsonSchemaDocument;
|
|
414
|
+
oneOf?: readonly JsonSchemaDocument[];
|
|
415
|
+
pattern?: string;
|
|
416
|
+
patternProperties?: Readonly<Record<string, JsonSchemaDocument>>;
|
|
417
|
+
prefixItems?: readonly JsonSchemaDocument[];
|
|
418
|
+
properties?: Readonly<Record<string, JsonSchemaDocument>>;
|
|
419
|
+
required?: readonly string[];
|
|
420
|
+
then?: JsonSchemaDocument;
|
|
421
|
+
title?: string;
|
|
422
|
+
type?: "array" | "boolean" | "integer" | "null" | "number" | "object" | "string" | readonly ("array" | "boolean" | "integer" | "null" | "number" | "object" | "string")[];
|
|
423
|
+
unevaluatedItems?: boolean | JsonSchemaDocument;
|
|
424
|
+
unevaluatedProperties?: boolean | JsonSchemaDocument;
|
|
425
|
+
uniqueItems?: boolean;
|
|
426
|
+
}>;
|
|
427
|
+
export type ProjectionFidelity = "exact" | "structural";
|
|
428
|
+
export type PackageSchemaProjection = Readonly<{
|
|
429
|
+
dialect: typeof Draft202012Dialect;
|
|
430
|
+
document: JsonSchemaDocument;
|
|
431
|
+
fidelity: ProjectionFidelity;
|
|
432
|
+
}>;
|
|
433
|
+
export type FormLayout = "stacked" | "two_column";
|
|
434
|
+
/**
|
|
435
|
+
* Renderer identifier owned by the consuming product. It remains open so
|
|
436
|
+
* external packages can declare their own widget implementations.
|
|
437
|
+
*/
|
|
438
|
+
export type FormWidget = string;
|
|
439
|
+
export type FieldValidationRule = Readonly<{
|
|
440
|
+
type: "required";
|
|
441
|
+
code?: string;
|
|
442
|
+
message?: string;
|
|
443
|
+
}> | Readonly<{
|
|
444
|
+
type: "min_length" | "max_length" | "min" | "max";
|
|
445
|
+
value: number;
|
|
446
|
+
code?: string;
|
|
447
|
+
message?: string;
|
|
448
|
+
}> | Readonly<{
|
|
449
|
+
type: "pattern";
|
|
450
|
+
value: string;
|
|
451
|
+
code?: string;
|
|
452
|
+
message?: string;
|
|
453
|
+
}> | Readonly<{
|
|
454
|
+
type: "integer" | "json" | "non_empty_array";
|
|
455
|
+
code?: string;
|
|
456
|
+
message?: string;
|
|
457
|
+
}>;
|
|
458
|
+
export type SelectOption = Readonly<{
|
|
459
|
+
value: string;
|
|
460
|
+
label?: string;
|
|
461
|
+
locked?: boolean;
|
|
462
|
+
}>;
|
|
463
|
+
export type DynamicFormAiFillConfig = Readonly<{
|
|
464
|
+
prompt: string;
|
|
465
|
+
buttonLabel?: string;
|
|
466
|
+
retryable?: boolean;
|
|
467
|
+
}>;
|
|
468
|
+
/**
|
|
469
|
+
* Package-owned, serializable select-control options. The renderer may add
|
|
470
|
+
* runtime-only resolution metadata separately, but package declarations use
|
|
471
|
+
* only this protocol.
|
|
472
|
+
*/
|
|
473
|
+
export type SelectOptions<Field extends string = string> = Readonly<{
|
|
474
|
+
options?: readonly (string | SelectOption)[];
|
|
475
|
+
allowCustom?: boolean;
|
|
476
|
+
searchable?: boolean;
|
|
477
|
+
allowClear?: boolean;
|
|
478
|
+
dataSource?: string;
|
|
479
|
+
dependencies?: readonly Field[];
|
|
480
|
+
submit?: boolean;
|
|
481
|
+
readonlyOnUpdate?: boolean;
|
|
482
|
+
preventSaveWhenEmpty?: boolean;
|
|
483
|
+
selectionMetadataField?: Field;
|
|
484
|
+
aiFill?: DynamicFormAiFillConfig;
|
|
485
|
+
}>;
|
|
486
|
+
export type VisibilityCondition<Field extends string = string> = Readonly<{
|
|
487
|
+
field: Field;
|
|
488
|
+
equals?: JsonValue;
|
|
489
|
+
notEquals?: JsonValue;
|
|
490
|
+
in?: readonly JsonValue[];
|
|
491
|
+
notIn?: readonly JsonValue[];
|
|
492
|
+
isSet?: boolean;
|
|
493
|
+
isNotSet?: boolean;
|
|
494
|
+
}>;
|
|
495
|
+
export type FieldVisibilityRule<Field extends string = string> = Readonly<{
|
|
496
|
+
visibleWhen: VisibilityCondition<Field> | readonly VisibilityCondition<Field>[];
|
|
497
|
+
logic?: "and" | "or";
|
|
498
|
+
}>;
|
|
499
|
+
export type FieldUiSchema<Field extends string = string> = Readonly<{
|
|
500
|
+
"ui:widget"?: FormWidget;
|
|
501
|
+
"ui:placeholder"?: string;
|
|
502
|
+
"ui:help"?: string;
|
|
503
|
+
"ui:disabled"?: boolean;
|
|
504
|
+
"ui:readonly"?: boolean;
|
|
505
|
+
"ui:order"?: number;
|
|
506
|
+
"ui:suggestedName"?: string;
|
|
507
|
+
"ui:validation"?: readonly FieldValidationRule[];
|
|
508
|
+
"ui:options"?: SelectOptions<Field>;
|
|
509
|
+
}>;
|
|
510
|
+
export type FormMarkdownBlock = Readonly<{
|
|
511
|
+
md: string;
|
|
512
|
+
}>;
|
|
513
|
+
export type FormSectionItem<Field extends string = string> = Field | FormMarkdownBlock;
|
|
514
|
+
export type FormSection<Field extends string = string> = Readonly<{
|
|
515
|
+
title?: string | null;
|
|
516
|
+
description?: string | null;
|
|
517
|
+
items: readonly FormSectionItem<Field>[];
|
|
518
|
+
layout?: FormLayout | null;
|
|
519
|
+
}>;
|
|
520
|
+
export type FormStep<Field extends string = string> = Readonly<{
|
|
521
|
+
id: string;
|
|
522
|
+
title: string;
|
|
523
|
+
description?: string | null;
|
|
524
|
+
includeInBasicInfo?: boolean | null;
|
|
525
|
+
items: readonly FormSectionItem<Field>[];
|
|
526
|
+
visibility?: FieldVisibilityRule<Field> | null;
|
|
527
|
+
}>;
|
|
528
|
+
export type FormMetadata<Field extends string> = Readonly<{
|
|
529
|
+
createSteps?: readonly FormStep<Field>[];
|
|
530
|
+
layout?: FormLayout;
|
|
531
|
+
uiSchema?: Partial<Record<Field, FieldUiSchema<Field>>>;
|
|
532
|
+
updateSections?: readonly FormSection<Field>[];
|
|
533
|
+
visibility?: Partial<Record<Field, FieldVisibilityRule<Field>>>;
|
|
534
|
+
}>;
|
|
535
|
+
/** Closed public principal vocabulary accepted by a gateway operation. */
|
|
536
|
+
export type PortableOperationPrincipalKind = "detached_user" | "service_principal";
|
|
537
|
+
/** Explicit delegated-subject requirement reviewed with an operation. */
|
|
538
|
+
export type PortableOperationDelegatedSubjectPolicy = "allowed" | "forbidden" | "required";
|
|
539
|
+
/** Fully materialized authorization policy for one exposed operation. */
|
|
540
|
+
export type PortableOperationAuthorization = Readonly<{
|
|
541
|
+
delegatedSubject: PortableOperationDelegatedSubjectPolicy;
|
|
542
|
+
organization: "required";
|
|
543
|
+
principalKinds: readonly PortableOperationPrincipalKind[];
|
|
544
|
+
scopes: readonly string[];
|
|
545
|
+
}>;
|
|
546
|
+
/** Observable side-effect class reviewed before an operation becomes a tool. */
|
|
547
|
+
export type PortableOperationEffect = "external_side_effect" | "read" | "write";
|
|
548
|
+
/** The replay guarantee supplied by the operation implementation. */
|
|
549
|
+
export type PortableOperationIdempotency = "idempotent" | "requires_key" | "safe";
|
|
550
|
+
/** Explicit, bounded retry permission for callers of the operation. */
|
|
551
|
+
export type PortableOperationRetryPolicy = Readonly<{
|
|
552
|
+
mode: "never";
|
|
553
|
+
}> | Readonly<{
|
|
554
|
+
maxAttempts: number;
|
|
555
|
+
mode: "idempotent_only";
|
|
556
|
+
}>;
|
|
557
|
+
/** Execution lifecycle and maximum wall-clock duration. */
|
|
558
|
+
export type PortableOperationExecutionPolicy = Readonly<{
|
|
559
|
+
mode: "synchronous";
|
|
560
|
+
timeoutMs: number;
|
|
561
|
+
}>;
|
|
562
|
+
/** Per-invocation transport bounds. */
|
|
563
|
+
export type PortableOperationLimits = Readonly<{
|
|
564
|
+
maxRequestBytes: number;
|
|
565
|
+
maxResponseBytes: number;
|
|
566
|
+
}>;
|
|
567
|
+
/**
|
|
568
|
+
* Complete JSON-only operation contract reviewed by a host. Executable
|
|
569
|
+
* handlers remain in a server runtime sidecar and never enter this descriptor.
|
|
570
|
+
*/
|
|
571
|
+
export type PortableOperationDeclaration = Readonly<{
|
|
572
|
+
authorization: PortableOperationAuthorization;
|
|
573
|
+
description: string;
|
|
574
|
+
effects: PortableOperationEffect;
|
|
575
|
+
execution: PortableOperationExecutionPolicy;
|
|
576
|
+
id: string;
|
|
577
|
+
idempotency: PortableOperationIdempotency;
|
|
578
|
+
input: PackageSchemaProjection;
|
|
579
|
+
limits: PortableOperationLimits;
|
|
580
|
+
output: PackageSchemaProjection;
|
|
581
|
+
retry: PortableOperationRetryPolicy;
|
|
582
|
+
title: string;
|
|
583
|
+
version: string;
|
|
584
|
+
}>;
|
|
585
|
+
/** One catalog and identity namespace for an ordered operation list. */
|
|
586
|
+
export type OperationDomainDeclaration<Operation extends PortableOperationDeclaration = PortableOperationDeclaration> = Readonly<{
|
|
587
|
+
description?: string;
|
|
588
|
+
displayOrder?: number;
|
|
589
|
+
icon?: string;
|
|
590
|
+
id: string;
|
|
591
|
+
operations: readonly Operation[];
|
|
592
|
+
tags?: readonly string[];
|
|
593
|
+
title: string;
|
|
594
|
+
}>;
|
|
595
|
+
declare const ConsumerProfileIds: readonly [
|
|
596
|
+
"runtime_json",
|
|
597
|
+
"ai_function_input",
|
|
598
|
+
"interactive_form",
|
|
599
|
+
"workflow_value",
|
|
600
|
+
"studio_props",
|
|
601
|
+
"knowledge_record"
|
|
602
|
+
];
|
|
603
|
+
export type ConsumerProfileId = (typeof ConsumerProfileIds)[number];
|
|
604
|
+
export type ConsumerProfileDiagnostic = Readonly<{
|
|
605
|
+
code: "fidelity_not_supported" | "invalid_default" | "invalid_root" | "recursive_reference" | "remote_reference" | "unknown_vocabulary" | "unsupported_keyword";
|
|
606
|
+
location: string;
|
|
607
|
+
profile: ConsumerProfileId;
|
|
608
|
+
reason: string;
|
|
609
|
+
}>;
|
|
610
|
+
export type DatasetProviderResult<Value> = Readonly<{
|
|
611
|
+
status: "success";
|
|
612
|
+
value: Value;
|
|
613
|
+
}> | Readonly<{
|
|
614
|
+
status: "failure";
|
|
615
|
+
error: DatasetProviderError;
|
|
616
|
+
}>;
|
|
617
|
+
export type DatasetScalarType = "boolean" | "string" | "int64" | "float64" | "decimal" | "date" | "timestamp" | "duration" | "json";
|
|
618
|
+
export type DatasetValue = Readonly<{
|
|
619
|
+
kind: "null";
|
|
620
|
+
}> | Readonly<{
|
|
621
|
+
kind: "boolean";
|
|
622
|
+
value: boolean;
|
|
623
|
+
}> | Readonly<{
|
|
624
|
+
kind: "string";
|
|
625
|
+
value: string;
|
|
626
|
+
}> | Readonly<{
|
|
627
|
+
kind: "int64";
|
|
628
|
+
value: string;
|
|
629
|
+
}> | Readonly<{
|
|
630
|
+
kind: "float64";
|
|
631
|
+
value: number;
|
|
632
|
+
}> | Readonly<{
|
|
633
|
+
kind: "decimal";
|
|
634
|
+
value: string;
|
|
635
|
+
}> | Readonly<{
|
|
636
|
+
kind: "date";
|
|
637
|
+
value: string;
|
|
638
|
+
}> | Readonly<{
|
|
639
|
+
kind: "timestamp";
|
|
640
|
+
value: string;
|
|
641
|
+
}> | Readonly<{
|
|
642
|
+
kind: "duration";
|
|
643
|
+
value: string;
|
|
644
|
+
}> | Readonly<{
|
|
645
|
+
kind: "json";
|
|
646
|
+
value: JsonValue;
|
|
647
|
+
}>;
|
|
648
|
+
export type DatasetPredicateOperator = "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "is_null" | "is_not_null" | "contains" | "starts_with";
|
|
649
|
+
export type DatasetAggregateOperation = "count" | "count_distinct" | "sum" | "min" | "max" | "avg";
|
|
650
|
+
export type DatasetQueryIntent = "records" | "aggregate" | "time_series";
|
|
651
|
+
export type DatasetTimeBucket = "hour" | "day" | "week" | "month";
|
|
652
|
+
export type DatasetPredicate = Readonly<{
|
|
653
|
+
kind: "predicate";
|
|
654
|
+
fieldId: string;
|
|
655
|
+
operator: DatasetPredicateOperator;
|
|
656
|
+
values: readonly DatasetValue[];
|
|
657
|
+
}>;
|
|
658
|
+
export type DatasetFilter = DatasetPredicate | Readonly<{
|
|
659
|
+
kind: "and" | "or";
|
|
660
|
+
filters: readonly DatasetFilter[];
|
|
661
|
+
}> | Readonly<{
|
|
662
|
+
kind: "not";
|
|
663
|
+
filter: DatasetFilter;
|
|
664
|
+
}>;
|
|
665
|
+
export type DatasetOrder = Readonly<{
|
|
666
|
+
fieldOrAlias: string;
|
|
667
|
+
direction: "asc" | "desc";
|
|
668
|
+
}>;
|
|
669
|
+
export type DatasetOperation = Readonly<{
|
|
670
|
+
kind: "records";
|
|
671
|
+
projection: readonly string[];
|
|
672
|
+
filter?: DatasetFilter;
|
|
673
|
+
orderBy: readonly DatasetOrder[];
|
|
674
|
+
cursor?: string;
|
|
675
|
+
}> | Readonly<{
|
|
676
|
+
kind: "aggregate";
|
|
677
|
+
filter?: DatasetFilter;
|
|
678
|
+
groupBy: readonly string[];
|
|
679
|
+
measures: readonly Readonly<{
|
|
680
|
+
alias: string;
|
|
681
|
+
operation: DatasetAggregateOperation;
|
|
682
|
+
fieldId?: string;
|
|
683
|
+
}>[];
|
|
684
|
+
orderBy: readonly DatasetOrder[];
|
|
685
|
+
cursor?: string;
|
|
686
|
+
}> | Readonly<{
|
|
687
|
+
kind: "time_series";
|
|
688
|
+
timeFieldId: string;
|
|
689
|
+
measure: Readonly<{
|
|
690
|
+
alias: string;
|
|
691
|
+
operation: DatasetAggregateOperation;
|
|
692
|
+
fieldId?: string;
|
|
693
|
+
}>;
|
|
694
|
+
bucket: DatasetTimeBucket;
|
|
695
|
+
order: "asc" | "desc";
|
|
696
|
+
filter?: DatasetFilter;
|
|
697
|
+
cursor?: string;
|
|
698
|
+
}>;
|
|
699
|
+
export type DatasetProviderCapabilities = Readonly<{
|
|
700
|
+
intents: readonly DatasetQueryIntent[];
|
|
701
|
+
predicates: readonly DatasetPredicateOperator[];
|
|
702
|
+
aggregates: readonly DatasetAggregateOperation[];
|
|
703
|
+
grouping: boolean;
|
|
704
|
+
ordering: boolean;
|
|
705
|
+
pagination: boolean;
|
|
706
|
+
definitionRefresh: boolean;
|
|
707
|
+
limits: Readonly<{
|
|
708
|
+
maxRows: number;
|
|
709
|
+
maxBytes: number;
|
|
710
|
+
timeoutMs: number;
|
|
711
|
+
maxPageRows: number;
|
|
712
|
+
}>;
|
|
713
|
+
}>;
|
|
714
|
+
export type SafeDiagnostic = Readonly<{
|
|
715
|
+
code: string;
|
|
716
|
+
message: string;
|
|
717
|
+
fieldId?: string;
|
|
718
|
+
}>;
|
|
719
|
+
export type ConnectorContext = Readonly<{
|
|
720
|
+
correlationId: string;
|
|
721
|
+
deadlineEpochMs: number;
|
|
722
|
+
}>;
|
|
723
|
+
export type DatasetSourceLocation = Readonly<{
|
|
724
|
+
segments: readonly [
|
|
725
|
+
Readonly<{
|
|
726
|
+
kind: "container";
|
|
727
|
+
opaqueId: string;
|
|
728
|
+
label: string;
|
|
729
|
+
}>,
|
|
730
|
+
...Readonly<{
|
|
731
|
+
kind: "container" | "dataset";
|
|
732
|
+
opaqueId: string;
|
|
733
|
+
label: string;
|
|
734
|
+
}>[]
|
|
735
|
+
];
|
|
736
|
+
}>;
|
|
737
|
+
export type DatasetDefinition = Readonly<{
|
|
738
|
+
version: 1;
|
|
739
|
+
fields: readonly Readonly<{
|
|
740
|
+
id: string;
|
|
741
|
+
name: string;
|
|
742
|
+
type: DatasetScalarType;
|
|
743
|
+
nullable: boolean;
|
|
744
|
+
semantic?: string;
|
|
745
|
+
}>[];
|
|
746
|
+
measures: readonly Readonly<{
|
|
747
|
+
id: string;
|
|
748
|
+
name: string;
|
|
749
|
+
resultType: DatasetScalarType;
|
|
750
|
+
}>[];
|
|
751
|
+
relationships: readonly Readonly<{
|
|
752
|
+
id: string;
|
|
753
|
+
fromFieldId: string;
|
|
754
|
+
toFieldId: string;
|
|
755
|
+
cardinality: "one_to_one" | "one_to_many" | "many_to_one" | "many_to_many";
|
|
756
|
+
}>[];
|
|
757
|
+
}>;
|
|
758
|
+
export type Bounds = Readonly<{
|
|
759
|
+
maxRows: number;
|
|
760
|
+
maxBytes: number;
|
|
761
|
+
timeoutMs: number;
|
|
762
|
+
}>;
|
|
763
|
+
export type QueryInput = ConnectorContext & Readonly<{
|
|
764
|
+
location: DatasetSourceLocation;
|
|
765
|
+
definitionRevisionId: string;
|
|
766
|
+
definition: DatasetDefinition;
|
|
767
|
+
operation: DatasetOperation;
|
|
768
|
+
bounds: Bounds;
|
|
769
|
+
}>;
|
|
770
|
+
export type DatasetRecordPage = Readonly<{
|
|
771
|
+
columns: readonly Readonly<{
|
|
772
|
+
fieldId: string;
|
|
773
|
+
type: DatasetScalarType;
|
|
774
|
+
}>[];
|
|
775
|
+
rows: readonly (readonly DatasetValue[])[];
|
|
776
|
+
nextCursor?: string;
|
|
777
|
+
rowCount: number;
|
|
778
|
+
byteCount: number;
|
|
779
|
+
observedAt: string;
|
|
780
|
+
}>;
|
|
781
|
+
export type DatasetResultPage = (Readonly<{
|
|
782
|
+
kind: "records";
|
|
783
|
+
}> & DatasetRecordPage) | Readonly<{
|
|
784
|
+
kind: "aggregate";
|
|
785
|
+
columns: readonly Readonly<{
|
|
786
|
+
alias: string;
|
|
787
|
+
type: DatasetScalarType;
|
|
788
|
+
}>[];
|
|
789
|
+
rows: readonly (readonly DatasetValue[])[];
|
|
790
|
+
nextCursor?: string;
|
|
791
|
+
rowCount: number;
|
|
792
|
+
byteCount: number;
|
|
793
|
+
observedAt: string;
|
|
794
|
+
}> | Readonly<{
|
|
795
|
+
kind: "time_series";
|
|
796
|
+
valueType: DatasetScalarType;
|
|
797
|
+
points: readonly Readonly<{
|
|
798
|
+
time: string;
|
|
799
|
+
value: DatasetValue;
|
|
800
|
+
}>[];
|
|
801
|
+
nextCursor?: string;
|
|
802
|
+
pointCount: number;
|
|
803
|
+
byteCount: number;
|
|
804
|
+
observedAt: string;
|
|
805
|
+
}>;
|
|
806
|
+
export type DatasetProviderError = Readonly<{
|
|
807
|
+
kind: "not_ready" | "incompatible_source" | "unsupported_operation" | "policy_not_pushable" | "invalid_cursor" | "timeout" | "permission_denied" | "provider_unavailable" | "provider_rejected" | "invalid_provider_response";
|
|
808
|
+
diagnostics: readonly SafeDiagnostic[];
|
|
809
|
+
}> | Readonly<{
|
|
810
|
+
kind: "limit_exceeded";
|
|
811
|
+
limit: "rows" | "bytes" | "timeout";
|
|
812
|
+
diagnostics: readonly SafeDiagnostic[];
|
|
813
|
+
}> | Readonly<{
|
|
814
|
+
kind: "throttled";
|
|
815
|
+
retryAfterMs?: number;
|
|
816
|
+
diagnostics: readonly SafeDiagnostic[];
|
|
817
|
+
}>;
|
|
818
|
+
/**
|
|
819
|
+
* Runtime dispatch validates the declared input schema before invoking a
|
|
820
|
+
* handler. The bivariant call signature lets domains retain heterogeneous,
|
|
821
|
+
* strongly typed handlers while exposing one erased operation collection.
|
|
822
|
+
*/
|
|
823
|
+
export type GatewayOperationHandler<Input = unknown, Output = unknown> = {
|
|
824
|
+
bivarianceHack(request: Readonly<{
|
|
825
|
+
context: GatewayInvocationContext;
|
|
826
|
+
/** Validated caller key; the handler owns durable replay storage. */
|
|
827
|
+
idempotencyKey?: string;
|
|
828
|
+
input: Input;
|
|
829
|
+
signal: AbortSignal;
|
|
830
|
+
}>): Promise<Output>;
|
|
831
|
+
}["bivarianceHack"];
|
|
832
|
+
export type GatewayOperationDefinition<Input = unknown, Output = unknown> = Omit<PortableOperationDeclaration, "input" | "output"> & Readonly<{
|
|
833
|
+
handler: GatewayOperationHandler<Input, Output>;
|
|
834
|
+
input: PackageSchemaProjection;
|
|
835
|
+
output: PackageSchemaProjection;
|
|
836
|
+
}>;
|
|
837
|
+
export type GatewayOperationManifest = Omit<GatewayOperationDefinition, "handler"> & Readonly<{
|
|
838
|
+
canonicalReference: string;
|
|
839
|
+
}>;
|
|
840
|
+
export type GatewayOperationDomainDefinition = OperationDomainDeclaration<GatewayOperationDefinition>;
|
|
841
|
+
export type GatewayOperationDomainManifest = OperationDomainDeclaration<GatewayOperationManifest>;
|
|
842
|
+
/** CI destination marker only; source records are shared across all connections. */
|
|
843
|
+
export type OrganizationBinding = Readonly<{
|
|
844
|
+
mode: "installed_organization";
|
|
845
|
+
}>;
|
|
846
|
+
export type GatewayKnowledgeResourceExposure = Readonly<{
|
|
847
|
+
resource: GatewayResourceDefinition;
|
|
848
|
+
access: "read" | "read_write";
|
|
849
|
+
}>;
|
|
850
|
+
export type GatewayDatasetBinding = Readonly<{
|
|
851
|
+
id: string;
|
|
852
|
+
title: string;
|
|
853
|
+
definition: DatasetDefinition;
|
|
854
|
+
authorization: AuthorizationRequirement;
|
|
855
|
+
providerFqn: string;
|
|
856
|
+
query: (input: QueryInput, context: GatewayInvocationContext, options: Readonly<{
|
|
857
|
+
signal: AbortSignal;
|
|
858
|
+
}>) => Promise<DatasetProviderResult<DatasetResultPage>>;
|
|
859
|
+
}>;
|
|
860
|
+
export type GatewayDatasetManifest = Omit<GatewayDatasetBinding, "query"> & Readonly<{
|
|
861
|
+
capabilities: DatasetProviderCapabilities;
|
|
862
|
+
}>;
|
|
863
|
+
export type GatewayDefinitionInput = Readonly<{
|
|
864
|
+
knowledge?: readonly GatewayKnowledgeResourceExposure[];
|
|
865
|
+
datasets?: readonly GatewayDatasetBinding[];
|
|
866
|
+
id: string;
|
|
867
|
+
operationDomains: readonly GatewayOperationDomainDefinition[];
|
|
868
|
+
organizationBinding?: OrganizationBinding;
|
|
869
|
+
protocolVersion?: "2";
|
|
870
|
+
version: string;
|
|
871
|
+
}>;
|
|
872
|
+
export type GatewayManifest = Readonly<{
|
|
873
|
+
capabilities: Readonly<{
|
|
874
|
+
resources: boolean;
|
|
875
|
+
}>;
|
|
876
|
+
datasets: readonly GatewayDatasetManifest[];
|
|
877
|
+
knowledge: readonly Readonly<{
|
|
878
|
+
id: string;
|
|
879
|
+
access: "read" | "read_write";
|
|
880
|
+
definition: GatewayResourceDefinition["definition"];
|
|
881
|
+
fullInventory: boolean;
|
|
882
|
+
incrementalChanges: boolean;
|
|
883
|
+
}>[];
|
|
884
|
+
contentHash: string;
|
|
885
|
+
id: string;
|
|
886
|
+
operationDomains: readonly GatewayOperationDomainManifest[];
|
|
887
|
+
organizationBinding: OrganizationBinding;
|
|
888
|
+
protocolVersion: "2";
|
|
889
|
+
revision: string;
|
|
890
|
+
version: string;
|
|
891
|
+
}>;
|
|
892
|
+
export type GatewayProposal = Readonly<{
|
|
893
|
+
gatewayId: string;
|
|
894
|
+
gatewayVersion: string;
|
|
895
|
+
knowledge: GatewayManifest["knowledge"];
|
|
896
|
+
operationDomains: readonly GatewayOperationDomainManifest[];
|
|
897
|
+
revision: string;
|
|
898
|
+
}>;
|
|
899
|
+
export interface DefinedGateway {
|
|
900
|
+
readonly input: GatewayDefinitionInput;
|
|
901
|
+
readonly resource: (id: string) => GatewayResourceDefinition | undefined;
|
|
902
|
+
readonly dataset: (id: string) => GatewayDatasetBinding | undefined;
|
|
903
|
+
readonly manifest: GatewayManifest;
|
|
904
|
+
readonly proposal: GatewayProposal;
|
|
905
|
+
}
|
|
906
|
+
export interface GatewayKernel {
|
|
907
|
+
readonly handle: (request: Request) => Promise<Response>;
|
|
908
|
+
readonly manifest: DefinedGateway["manifest"];
|
|
909
|
+
}
|
|
910
|
+
export type GatewayRuntimeKernel = Pick<GatewayKernel, "handle">;
|
|
911
|
+
export type EffectCrudResourceOptions<Entity, Create, Update, Error, Requirements> = Readonly<{
|
|
912
|
+
definition: ResourceDefinition<Entity, Create, Update>;
|
|
913
|
+
authorization: GatewayResourceAuthorization;
|
|
914
|
+
repository: Effect.Effect<CrudRepository<Entity, Create, Update>, Error, Requirements>;
|
|
915
|
+
}>;
|
|
916
|
+
export type ResourceProjectionDiagnostic = Readonly<{
|
|
917
|
+
code: "unsupported_refinement" | "unsupported_transform" | "unsupported_schema" | ConsumerProfileDiagnostic["code"];
|
|
918
|
+
location: string;
|
|
919
|
+
reason: string;
|
|
920
|
+
}>;
|
|
921
|
+
export type ResourceSchemaProjection = Readonly<{
|
|
922
|
+
success: true;
|
|
923
|
+
schema: JsonSchemaDocument;
|
|
924
|
+
fidelity: "exact";
|
|
925
|
+
metadata?: FormMetadata<string>;
|
|
926
|
+
}> | Readonly<{
|
|
927
|
+
success: false;
|
|
928
|
+
diagnostics: readonly ResourceProjectionDiagnostic[];
|
|
929
|
+
}>;
|
|
930
|
+
declare class GatewayEffectRuntimeError extends Error {
|
|
931
|
+
readonly _tag = "GatewayEffectRuntimeError";
|
|
932
|
+
readonly name = "GatewayEffectRuntimeError";
|
|
933
|
+
readonly cause: unknown;
|
|
934
|
+
constructor(cause: unknown);
|
|
935
|
+
}
|
|
936
|
+
export type GatewayEffectHandler = (request: Request) => Effect.Effect<Response, GatewayEffectRuntimeError>;
|
|
937
|
+
export type ResourceEffectHandlerOptions<E = never, R = never, Value = unknown, Create = Value, Patch = Partial<Value>> = Omit<ResourceHttpHandlerOptions<Value, Create, Patch>, "authorize"> & Readonly<{
|
|
938
|
+
authorize: (request: Request, operation: Parameters<ResourceHttpHandlerOptions["authorize"]>[1]) => Effect.Effect<EntityInvocationContext | Response, E, R>;
|
|
939
|
+
}>;
|
|
940
|
+
export declare const createGatewayEffectHandler: (kernel: GatewayRuntimeKernel) => GatewayEffectHandler;
|
|
941
|
+
export declare const createResourceEffectHandler: <E, R, Value = unknown, Create = Value, Patch = Partial<Value>>(options: ResourceEffectHandlerOptions<E, R, Value, Create, Patch>) => (request: Request) => import("effect/Effect").Effect<Response, E | GatewayEffectRuntimeError, R>;
|
|
942
|
+
export declare const DateTimeString: import("effect/Schema").String;
|
|
943
|
+
declare const GatewayEffectRuntimeError$1: typeof GatewayEffectRuntimeError;
|
|
944
|
+
export declare const jsonSchema: (schema: import("effect/Schema").Top) => JsonSchemaDocument;
|
|
945
|
+
export declare const projectResourceSchema: (schema: import("effect/Schema").Top, metadata?: FormMetadata<string>) => ResourceSchemaProjection;
|
|
946
|
+
export declare const makeEffectCrudResource: <Entity, Create = Entity, Update = Partial<Entity>, Error = never, Requirements = never>(options: EffectCrudResourceOptions<Entity, Create, Update, Error, Requirements>) => import("effect/Effect").Effect<CrudResource<Entity, Create, Update>, Error, Requirements>;
|
|
947
|
+
export declare const UuidV7: import("effect/Schema").String;
|
|
948
|
+
type GatewayEffectRuntimeError$1 = GatewayEffectRuntimeError;
|
|
949
|
+
|
|
950
|
+
export {
|
|
951
|
+
GatewayEffectRuntimeError$1 as GatewayEffectRuntimeError,
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
export {};
|