@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,423 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export type ResourceJsonValue = null | boolean | number | string | readonly ResourceJsonValue[] | Readonly<{
|
|
4
|
+
[key: string]: ResourceJsonValue;
|
|
5
|
+
}>;
|
|
6
|
+
/** Opaque wire identity. Callers must not infer or concatenate its internals. */
|
|
7
|
+
export type ResourceId = string;
|
|
8
|
+
export type ResourceRecordId = ResourceId;
|
|
9
|
+
/** Opaque concurrency token independent from source timestamps. */
|
|
10
|
+
export type ResourceRevision = string;
|
|
11
|
+
/** Opaque pagination position issued and consumed only by a resource adapter. */
|
|
12
|
+
export type ResourceCursor = string;
|
|
13
|
+
export type IdempotencyKey = string;
|
|
14
|
+
export type ResourceIdentityField = Readonly<{
|
|
15
|
+
name: string;
|
|
16
|
+
type: "number" | "string";
|
|
17
|
+
}>;
|
|
18
|
+
export type ResourceCapabilities = Readonly<{
|
|
19
|
+
create?: boolean;
|
|
20
|
+
/** Common entity deletion is always soft deletion. */
|
|
21
|
+
delete?: boolean;
|
|
22
|
+
get?: boolean;
|
|
23
|
+
hardDelete?: boolean;
|
|
24
|
+
includeDeleted?: boolean;
|
|
25
|
+
restore?: boolean;
|
|
26
|
+
search: true;
|
|
27
|
+
softDelete?: boolean;
|
|
28
|
+
update?: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
export type ResourcePaginationMode = "cursor" | "page";
|
|
31
|
+
export type PortableResourceSchema = Readonly<Record<string, ResourceJsonValue>>;
|
|
32
|
+
export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>> = Readonly<{
|
|
33
|
+
capabilities: ResourceCapabilities;
|
|
34
|
+
concurrency: "revision";
|
|
35
|
+
id: string;
|
|
36
|
+
identity: Readonly<{
|
|
37
|
+
fields: readonly [
|
|
38
|
+
ResourceIdentityField,
|
|
39
|
+
...ResourceIdentityField[]
|
|
40
|
+
];
|
|
41
|
+
}>;
|
|
42
|
+
query: Readonly<{
|
|
43
|
+
filterableFields: readonly string[];
|
|
44
|
+
pagination: Readonly<{
|
|
45
|
+
modes: readonly ResourcePaginationMode[];
|
|
46
|
+
}>;
|
|
47
|
+
sortableFields: readonly string[];
|
|
48
|
+
textSearchFields?: readonly string[];
|
|
49
|
+
}>;
|
|
50
|
+
schemas: Readonly<{
|
|
51
|
+
create?: PortableResourceSchema;
|
|
52
|
+
entity: PortableResourceSchema;
|
|
53
|
+
update?: PortableResourceSchema;
|
|
54
|
+
}>;
|
|
55
|
+
version: string;
|
|
56
|
+
/** Portable UI metadata; required/enum/nullability remain in schemas. */
|
|
57
|
+
metadata?: Readonly<Record<string, ResourceJsonValue>>;
|
|
58
|
+
/** Type-only slots keep definition values portable and serializable. */
|
|
59
|
+
readonly __types?: Readonly<{
|
|
60
|
+
create: Create;
|
|
61
|
+
entity: Entity;
|
|
62
|
+
update: Update;
|
|
63
|
+
}>;
|
|
64
|
+
}>;
|
|
65
|
+
export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
|
|
66
|
+
export type ResourceFilter = Readonly<{
|
|
67
|
+
field: string;
|
|
68
|
+
operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
69
|
+
value: FilterValue;
|
|
70
|
+
}> | Readonly<{
|
|
71
|
+
field: string;
|
|
72
|
+
operator: "is_not_null" | "is_null";
|
|
73
|
+
}> | Readonly<{
|
|
74
|
+
filters: readonly ResourceFilter[];
|
|
75
|
+
operator: "and" | "or";
|
|
76
|
+
}> | Readonly<{
|
|
77
|
+
filter: ResourceFilter;
|
|
78
|
+
operator: "not";
|
|
79
|
+
}>;
|
|
80
|
+
export type ResourceSort = Readonly<{
|
|
81
|
+
direction: "asc" | "desc";
|
|
82
|
+
field: string;
|
|
83
|
+
}>;
|
|
84
|
+
export type ResourcePagination = Readonly<{
|
|
85
|
+
mode: "cursor";
|
|
86
|
+
cursor?: ResourceCursor;
|
|
87
|
+
limit: number;
|
|
88
|
+
}> | Readonly<{
|
|
89
|
+
mode: "page";
|
|
90
|
+
page: number;
|
|
91
|
+
pageSize: number;
|
|
92
|
+
}>;
|
|
93
|
+
export type ResourceListQuery = Readonly<{
|
|
94
|
+
filter?: ResourceFilter;
|
|
95
|
+
includeDeleted?: boolean;
|
|
96
|
+
pagination: ResourcePagination;
|
|
97
|
+
sort?: readonly ResourceSort[];
|
|
98
|
+
textSearch?: string;
|
|
99
|
+
}>;
|
|
100
|
+
export type ResourceRecord<Entity> = Readonly<{
|
|
101
|
+
deletedAt?: string;
|
|
102
|
+
id: ResourceRecordId;
|
|
103
|
+
revision: ResourceRevision;
|
|
104
|
+
value: Entity;
|
|
105
|
+
}>;
|
|
106
|
+
export type ResourceListResult<Entity> = Readonly<{
|
|
107
|
+
items: readonly ResourceRecord<Entity>[];
|
|
108
|
+
nextCursor?: ResourceCursor;
|
|
109
|
+
pagination: "cursor";
|
|
110
|
+
}> | Readonly<{
|
|
111
|
+
items: readonly ResourceRecord<Entity>[];
|
|
112
|
+
page: number;
|
|
113
|
+
pageSize: number;
|
|
114
|
+
pagination: "page";
|
|
115
|
+
totalItems: number;
|
|
116
|
+
totalPages: number;
|
|
117
|
+
}>;
|
|
118
|
+
export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable";
|
|
119
|
+
export type ResourceError = Readonly<{
|
|
120
|
+
code: ResourceErrorCode;
|
|
121
|
+
/** Client-observed dispatch outcome; uncertainty never proves rollback. */
|
|
122
|
+
outcome?: "not_dispatched" | "rejected" | "uncertain";
|
|
123
|
+
details?: Readonly<Record<string, ResourceJsonValue>>;
|
|
124
|
+
message: string;
|
|
125
|
+
retryable: boolean;
|
|
126
|
+
}>;
|
|
127
|
+
export type ResourceResult<Value> = Readonly<{
|
|
128
|
+
correlationId: string;
|
|
129
|
+
ok: true;
|
|
130
|
+
value: Value;
|
|
131
|
+
}> | Readonly<{
|
|
132
|
+
correlationId: string;
|
|
133
|
+
error: ResourceError;
|
|
134
|
+
ok: false;
|
|
135
|
+
}>;
|
|
136
|
+
export type ResourceListRequest = Readonly<{
|
|
137
|
+
operation: "list";
|
|
138
|
+
query: ResourceListQuery;
|
|
139
|
+
requestId: string;
|
|
140
|
+
resourceId: string;
|
|
141
|
+
}>;
|
|
142
|
+
export type ResourceGetRequest = Readonly<{
|
|
143
|
+
id: ResourceRecordId;
|
|
144
|
+
includeDeleted?: boolean;
|
|
145
|
+
operation: "get";
|
|
146
|
+
requestId: string;
|
|
147
|
+
resourceId: string;
|
|
148
|
+
}>;
|
|
149
|
+
export type ResourceCreateRequest<Create> = Readonly<{
|
|
150
|
+
idempotencyKey: IdempotencyKey;
|
|
151
|
+
operation: "create";
|
|
152
|
+
requestId: string;
|
|
153
|
+
resourceId: string;
|
|
154
|
+
value: Create;
|
|
155
|
+
}>;
|
|
156
|
+
export type ResourceUpdateRequest<Update> = Readonly<{
|
|
157
|
+
expectedRevision: ResourceRevision;
|
|
158
|
+
id: ResourceRecordId;
|
|
159
|
+
idempotencyKey?: IdempotencyKey;
|
|
160
|
+
operation: "update";
|
|
161
|
+
requestId: string;
|
|
162
|
+
resourceId: string;
|
|
163
|
+
value: Update;
|
|
164
|
+
}>;
|
|
165
|
+
export type ResourceLifecycleRequest = Readonly<{
|
|
166
|
+
expectedRevision: ResourceRevision;
|
|
167
|
+
id: ResourceRecordId;
|
|
168
|
+
idempotencyKey?: IdempotencyKey;
|
|
169
|
+
operation: "hard_delete" | "restore" | "soft_delete";
|
|
170
|
+
requestId: string;
|
|
171
|
+
resourceId: string;
|
|
172
|
+
}>;
|
|
173
|
+
export type ResourceTransportRequest = ResourceCreateRequest<unknown> | ResourceGetRequest | ResourceLifecycleRequest | ResourceListRequest | ResourceUpdateRequest<unknown>;
|
|
174
|
+
export type ResourceMutationInput<Value> = Readonly<{
|
|
175
|
+
expectedRevision: ResourceRevision;
|
|
176
|
+
id: ResourceRecordId;
|
|
177
|
+
idempotencyKey?: IdempotencyKey;
|
|
178
|
+
value: Value;
|
|
179
|
+
}>;
|
|
180
|
+
export type ResourceLifecycleInput = Readonly<{
|
|
181
|
+
expectedRevision: ResourceRevision;
|
|
182
|
+
id: ResourceRecordId;
|
|
183
|
+
idempotencyKey?: IdempotencyKey;
|
|
184
|
+
}>;
|
|
185
|
+
export type ResourceCreateInput<Value> = Readonly<{
|
|
186
|
+
idempotencyKey: IdempotencyKey;
|
|
187
|
+
value: Value;
|
|
188
|
+
}>;
|
|
189
|
+
/** Common entity operations. Generic resource lifecycle/cursor APIs remain separate. */
|
|
190
|
+
export type EntityOperation = "list" | "get" | "create" | "update" | "delete";
|
|
191
|
+
export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
|
|
192
|
+
pagination: Extract<ResourcePagination, {
|
|
193
|
+
mode: "page";
|
|
194
|
+
}>;
|
|
195
|
+
}>;
|
|
196
|
+
export type EntityPage<Value> = Extract<ResourceListResult<Value>, {
|
|
197
|
+
pagination: "page";
|
|
198
|
+
}>;
|
|
199
|
+
export type EntityCreateInput<Value> = ResourceCreateInput<Value>;
|
|
200
|
+
export type EntityUpdateInput<Patch> = ResourceMutationInput<Patch> & Readonly<{
|
|
201
|
+
idempotencyKey: IdempotencyKey;
|
|
202
|
+
}>;
|
|
203
|
+
export type EntityDeleteInput = ResourceLifecycleInput & Readonly<{
|
|
204
|
+
idempotencyKey: IdempotencyKey;
|
|
205
|
+
}>;
|
|
206
|
+
export type EntityRequestIdentity = Readonly<{
|
|
207
|
+
requestId: string;
|
|
208
|
+
resourceId: string;
|
|
209
|
+
}>;
|
|
210
|
+
export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIdentity & (Readonly<{
|
|
211
|
+
operation: "list";
|
|
212
|
+
query: EntityListQuery;
|
|
213
|
+
}> | Readonly<{
|
|
214
|
+
operation: "get";
|
|
215
|
+
id: ResourceRecordId;
|
|
216
|
+
}> | (Readonly<{
|
|
217
|
+
operation: "create";
|
|
218
|
+
}> & EntityCreateInput<Create>) | (Readonly<{
|
|
219
|
+
operation: "update";
|
|
220
|
+
}> & EntityUpdateInput<Patch>) | (Readonly<{
|
|
221
|
+
operation: "delete";
|
|
222
|
+
}> & EntityDeleteInput));
|
|
223
|
+
/** Application login identities are separate from gateway machine callers. */
|
|
224
|
+
export type ApplicationUserIdentity = Readonly<{
|
|
225
|
+
kind: "local_user";
|
|
226
|
+
id: string;
|
|
227
|
+
email: string;
|
|
228
|
+
name: string | null;
|
|
229
|
+
} | {
|
|
230
|
+
kind: "ci_user";
|
|
231
|
+
id: string;
|
|
232
|
+
email: string | null;
|
|
233
|
+
name: string | null;
|
|
234
|
+
issuer: string;
|
|
235
|
+
organizationId: string;
|
|
236
|
+
}>;
|
|
237
|
+
/** Constructed only after user/app/organization authorization at server ingress.
|
|
238
|
+
* Canonical identities survive proxy hops and scope mutation receipts; credentials
|
|
239
|
+
* and request/correlation IDs are deliberately not part of that logical identity.
|
|
240
|
+
*/
|
|
241
|
+
export type EntityInvocationContext = Readonly<{
|
|
242
|
+
applicationId: string;
|
|
243
|
+
issuer: string;
|
|
244
|
+
organizationId: string;
|
|
245
|
+
resourceId: string;
|
|
246
|
+
roles: readonly string[];
|
|
247
|
+
scopes: readonly string[];
|
|
248
|
+
teamIds: readonly string[];
|
|
249
|
+
user: ApplicationUserIdentity;
|
|
250
|
+
}>;
|
|
251
|
+
export type PrincipalKind = "detached_user" | "service_principal";
|
|
252
|
+
export type DelegatedSubjectPolicy = "allowed" | "forbidden" | "required";
|
|
253
|
+
export type AuthorizationRequirement = Readonly<{
|
|
254
|
+
delegatedSubject?: DelegatedSubjectPolicy;
|
|
255
|
+
organization: "required";
|
|
256
|
+
principalKinds: readonly PrincipalKind[];
|
|
257
|
+
scopes: readonly string[];
|
|
258
|
+
}>;
|
|
259
|
+
export type ExternalAuditSubject = Readonly<{
|
|
260
|
+
issuer: string;
|
|
261
|
+
mappedCiUserId?: string;
|
|
262
|
+
subject: string;
|
|
263
|
+
}>;
|
|
264
|
+
export type GatewayCallerIdentity = Readonly<{
|
|
265
|
+
audience: readonly string[];
|
|
266
|
+
binding: string;
|
|
267
|
+
expiresAt: number;
|
|
268
|
+
installationId: string;
|
|
269
|
+
issuer: string;
|
|
270
|
+
organizationId: string;
|
|
271
|
+
principalKind: PrincipalKind;
|
|
272
|
+
requestId: string;
|
|
273
|
+
scopes: readonly string[];
|
|
274
|
+
subject: string;
|
|
275
|
+
}>;
|
|
276
|
+
export type GatewayInvocationContext = Readonly<{
|
|
277
|
+
caller: GatewayCallerIdentity;
|
|
278
|
+
correlationId: string;
|
|
279
|
+
externalAuditSubject?: ExternalAuditSubject;
|
|
280
|
+
organizationId: string;
|
|
281
|
+
}>;
|
|
282
|
+
/** Common CRUD port. Implementations own atomic revisions, receipts and soft deletion. */
|
|
283
|
+
export interface EntityRepository<Value, Create = Value, Patch = Partial<Value>> {
|
|
284
|
+
readonly list: (query: EntityListQuery, context: EntityInvocationContext) => Promise<EntityPage<Value>>;
|
|
285
|
+
readonly get?: (id: string, context: EntityInvocationContext) => Promise<ResourceRecord<Value>>;
|
|
286
|
+
readonly create?: (input: EntityCreateInput<Create>, context: EntityInvocationContext) => Promise<ResourceRecord<Value>>;
|
|
287
|
+
readonly update?: (input: EntityUpdateInput<Patch>, context: EntityInvocationContext) => Promise<ResourceRecord<Value>>;
|
|
288
|
+
readonly delete?: (input: EntityDeleteInput, context: EntityInvocationContext) => Promise<ResourceRecord<Value>>;
|
|
289
|
+
}
|
|
290
|
+
export type ResourceChange<Entity> = Readonly<{
|
|
291
|
+
kind: "upsert";
|
|
292
|
+
record: ResourceRecord<Entity>;
|
|
293
|
+
}> | Readonly<{
|
|
294
|
+
kind: "tombstone";
|
|
295
|
+
id: string;
|
|
296
|
+
revision: string;
|
|
297
|
+
deletedAt: string;
|
|
298
|
+
}>;
|
|
299
|
+
export type ResourceChangePage<Entity> = Readonly<{
|
|
300
|
+
changes: readonly ResourceChange<Entity>[];
|
|
301
|
+
nextCursor?: string;
|
|
302
|
+
}>;
|
|
303
|
+
/** Full inventory only: no filters, text search or caller-selected ordering.
|
|
304
|
+
* Continue consecutive pages with the first watermark. A conflict requires restart.
|
|
305
|
+
*/
|
|
306
|
+
export type ResourceInventoryRequest = Readonly<{
|
|
307
|
+
page: number;
|
|
308
|
+
pageSize: number;
|
|
309
|
+
watermark?: string;
|
|
310
|
+
}>;
|
|
311
|
+
export type ResourceInventoryPage<Entity> = Extract<ResourceListResult<Entity>, {
|
|
312
|
+
pagination: "page";
|
|
313
|
+
}> & Readonly<{
|
|
314
|
+
/** Resource-scoped committed change cursor; consume deltas strictly after it. */
|
|
315
|
+
watermark: string;
|
|
316
|
+
}>;
|
|
317
|
+
export type ResourceMutation = Readonly<{
|
|
318
|
+
id: string;
|
|
319
|
+
expectedRevision: string;
|
|
320
|
+
}>;
|
|
321
|
+
export interface CrudRepository<Entity, Create = Entity, Update = Partial<Entity>> {
|
|
322
|
+
readonly list: (query: ResourceListQuery, context?: EntityInvocationContext) => Promise<ResourceListResult<Entity>>;
|
|
323
|
+
readonly scan?: (request: ResourceInventoryRequest) => Promise<ResourceInventoryPage<Entity>>;
|
|
324
|
+
readonly get?: (id: string, includeDeleted?: boolean, context?: EntityInvocationContext) => Promise<ResourceRecord<Entity>>;
|
|
325
|
+
readonly create?: (value: Create, idempotencyKey: string, context?: EntityInvocationContext) => Promise<ResourceRecord<Entity>>;
|
|
326
|
+
readonly update?: (input: ResourceMutation & Readonly<{
|
|
327
|
+
value: Update;
|
|
328
|
+
}>, context?: EntityInvocationContext) => Promise<ResourceRecord<Entity>>;
|
|
329
|
+
readonly hardDelete?: (input: ResourceMutation, context?: EntityInvocationContext) => Promise<void>;
|
|
330
|
+
readonly softDelete?: (input: ResourceMutation, context?: EntityInvocationContext) => Promise<ResourceRecord<Entity>>;
|
|
331
|
+
readonly restore?: (input: ResourceMutation, context?: EntityInvocationContext) => Promise<ResourceRecord<Entity>>;
|
|
332
|
+
readonly changes?: (input: Readonly<{
|
|
333
|
+
cursor?: string;
|
|
334
|
+
limit: number;
|
|
335
|
+
}>) => Promise<ResourceChangePage<Entity>>;
|
|
336
|
+
}
|
|
337
|
+
declare const repositoryErrorBrand: unique symbol;
|
|
338
|
+
declare class ResourceRepositoryError extends Error {
|
|
339
|
+
readonly [repositoryErrorBrand] = true;
|
|
340
|
+
readonly code: ResourceErrorCode;
|
|
341
|
+
readonly retryable: boolean;
|
|
342
|
+
readonly details: ResourceError["details"];
|
|
343
|
+
constructor(code: ResourceErrorCode, message: string, retryable?: boolean, details?: ResourceError["details"]);
|
|
344
|
+
}
|
|
345
|
+
/** A configured local or CI-backed binding; no storage policy is exposed to browsers. */
|
|
346
|
+
export type EntityResourceDefinition<Value = unknown, Create = Value, Patch = Partial<Value>> = Readonly<{
|
|
347
|
+
definition: ResourceDefinition<Value, Create, Patch>;
|
|
348
|
+
execute: (request: EntityRequest<Create, Patch>, context: EntityInvocationContext, options?: Readonly<{
|
|
349
|
+
signal?: AbortSignal;
|
|
350
|
+
}>) => Promise<ResourceResult<EntityPage<Value> | ResourceRecord<Value>>>;
|
|
351
|
+
}>;
|
|
352
|
+
export type GatewayResourceOperation = ResourceTransportRequest["operation"];
|
|
353
|
+
export type GatewayResourceAuthorization = Readonly<Partial<Record<GatewayResourceOperation, AuthorizationRequirement>>>;
|
|
354
|
+
export type GatewayResourceDefinition<Entity = unknown, Create = Entity, Update = Partial<Entity>> = Readonly<{
|
|
355
|
+
authorization: GatewayResourceAuthorization;
|
|
356
|
+
definition: ResourceDefinition<Entity, Create, Update>;
|
|
357
|
+
execute: (request: ResourceTransportRequest, context: GatewayInvocationContext, options?: Readonly<{
|
|
358
|
+
signal?: AbortSignal;
|
|
359
|
+
}>) => Promise<ResourceResult<unknown>>;
|
|
360
|
+
scan?: (request: ResourceInventoryRequest & Readonly<{
|
|
361
|
+
requestId: string;
|
|
362
|
+
resourceId: string;
|
|
363
|
+
}>, context: GatewayInvocationContext, options?: Readonly<{
|
|
364
|
+
signal?: AbortSignal;
|
|
365
|
+
}>) => Promise<ResourceResult<unknown>>;
|
|
366
|
+
changes?: (request: Readonly<{
|
|
367
|
+
cursor?: string;
|
|
368
|
+
limit: number;
|
|
369
|
+
requestId: string;
|
|
370
|
+
resourceId: string;
|
|
371
|
+
}>, context: GatewayInvocationContext, options?: Readonly<{
|
|
372
|
+
signal?: AbortSignal;
|
|
373
|
+
}>) => Promise<ResourceResult<unknown>>;
|
|
374
|
+
}>;
|
|
375
|
+
export type CrudResource<Entity = unknown, Create = Entity, Update = Partial<Entity>> = GatewayResourceDefinition<Entity, Create, Update> & Readonly<{
|
|
376
|
+
executeCrud: (request: ResourceTransportRequest, context: EntityInvocationContext) => Promise<ResourceResult<unknown>>;
|
|
377
|
+
}>;
|
|
378
|
+
export type ResourceHttpHandlerOptions<Value = unknown, Create = Value, Patch = Partial<Value>> = Readonly<{
|
|
379
|
+
resource: CrudResource<Value, Create, Patch> | EntityResourceDefinition<Value, Create, Patch>;
|
|
380
|
+
/** Mount path including the entity name, e.g. /api/leads. */
|
|
381
|
+
basePath: string;
|
|
382
|
+
/** Host verifies the current CI session and resource policy; no browser identity is trusted. */
|
|
383
|
+
authorize: (request: Request, operation: ResourceTransportRequest["operation"] | EntityOperation) => Promise<EntityInvocationContext | Response>;
|
|
384
|
+
maxBodyBytes?: number;
|
|
385
|
+
}>;
|
|
386
|
+
export type EntityHttpRoute = {
|
|
387
|
+
readonly kind: "search";
|
|
388
|
+
} | {
|
|
389
|
+
readonly kind: "collection";
|
|
390
|
+
} | {
|
|
391
|
+
readonly kind: "record";
|
|
392
|
+
readonly id: string;
|
|
393
|
+
} | {
|
|
394
|
+
readonly kind: "soft_delete";
|
|
395
|
+
readonly id: string;
|
|
396
|
+
};
|
|
397
|
+
export declare const createResourceHttpHandler: <Value, Create = Value, Patch = Partial<Value>>(options: ResourceHttpHandlerOptions<Value, Create, Patch>) => (request: Request) => Promise<Response>;
|
|
398
|
+
export declare const matchEntityHttpRoute: (pathname: string, basePath: string) => EntityHttpRoute | null;
|
|
399
|
+
export declare const defineCrudResource: <Entity, Create = Entity, Update = Partial<Entity>>(input: Readonly<{
|
|
400
|
+
definition: ResourceDefinition<Entity, Create, Update>;
|
|
401
|
+
repository: CrudRepository<Entity, Create, Update>;
|
|
402
|
+
authorization: GatewayResourceAuthorization;
|
|
403
|
+
}>) => CrudResource<Entity, Create, Update>;
|
|
404
|
+
export declare const defineEntityResource: <Value, Create = Value, Patch = Partial<Value>>(input: Readonly<{
|
|
405
|
+
definition: ResourceDefinition<Value, Create, Patch>;
|
|
406
|
+
repository: EntityRepository<Value, Create, Patch>;
|
|
407
|
+
}>) => EntityResourceDefinition<Value, Create, Patch>;
|
|
408
|
+
export declare const defineCiEntityResource: <Value, Create = Value, Patch = Partial<Value>>(input: Readonly<{
|
|
409
|
+
definition: ResourceDefinition<Value, Create, Patch>;
|
|
410
|
+
tenantUrl: string;
|
|
411
|
+
schemaFqn: string;
|
|
412
|
+
organizationId: string;
|
|
413
|
+
fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
414
|
+
}>) => EntityResourceDefinition<Value, Create, Patch>;
|
|
415
|
+
export declare const defineGatewayResource: <Entity, Create = Entity, Update = Partial<Entity>>(resource: GatewayResourceDefinition<Entity, Create, Update>) => GatewayResourceDefinition<Entity, Create, Update>;
|
|
416
|
+
declare const ResourceRepositoryError$1: typeof ResourceRepositoryError;
|
|
417
|
+
type ResourceRepositoryError$1 = ResourceRepositoryError;
|
|
418
|
+
|
|
419
|
+
export {
|
|
420
|
+
ResourceRepositoryError$1 as ResourceRepositoryError,
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
export {};
|