@collective-intelligence/external-apps-server-sdk 0.1.8 → 0.1.10
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 +150 -0
- package/dist/admin.d.ts +423 -25
- package/dist/express.d.ts +20 -3
- package/dist/gateway/contracts.d.ts +20 -3
- package/dist/gateway.d.ts +20 -3
- package/dist/gateway.js +2 -1
- package/dist/index.d.ts +113 -1
- package/dist/index.js +3 -3
- package/dist/knowledge-sources/payload.d.ts +28 -3
- package/dist/knowledge-sources/strapi.d.ts +28 -3
- package/dist/persistence/drizzle.d.ts +42 -3
- package/dist/persistence/drizzle.js +4 -3
- package/dist/resources.d.ts +50 -6
- package/dist/resources.js +3 -3
- package/dist/runtime/effect.d.ts +105 -6
- package/dist/runtime/effect.js +4 -3
- package/dist/runtime/express.d.ts +20 -3
- package/dist/runtime/nestjs.d.ts +48 -6
- package/dist/runtime/nestjs.js +1 -1
- package/dist/runtime/next.d.ts +48 -6
- package/dist/runtime/next.js +1 -1
- package/dist/runtime/web.d.ts +20 -3
- package/dist/runtime/web.js +1 -1
- package/dist/tools/ai-sdk.js +2 -1
- package/package.json +3 -3
package/dist/resources.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export type ResourceCapabilities = Readonly<{
|
|
|
26
26
|
search: true;
|
|
27
27
|
softDelete?: boolean;
|
|
28
28
|
update?: boolean;
|
|
29
|
+
/** File uploads for the File fields of a common entity resource. */
|
|
30
|
+
upload?: boolean;
|
|
29
31
|
}>;
|
|
30
32
|
export type ResourcePaginationMode = "cursor" | "page";
|
|
31
33
|
export type PortableResourceSchema = Readonly<Record<string, ResourceJsonValue>>;
|
|
@@ -63,13 +65,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
|
|
|
63
65
|
}>;
|
|
64
66
|
}>;
|
|
65
67
|
export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
|
|
68
|
+
/**
|
|
69
|
+
* A filter predicate. `field` names a declared filterable field, or a path
|
|
70
|
+
* through at most three fields that hold Entity References to a field of
|
|
71
|
+
* the last target, such as `company.industry` or
|
|
72
|
+
* `contacts.company.parent.industry`. On a field that holds Entity
|
|
73
|
+
* References, `is_empty` means no reference, and `contains_any` and
|
|
74
|
+
* `contains_all` compare the ids of a field that holds many.
|
|
75
|
+
*/
|
|
66
76
|
export type ResourceFilter = Readonly<{
|
|
67
77
|
field: string;
|
|
68
|
-
operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
78
|
+
operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
69
79
|
value: FilterValue;
|
|
70
80
|
}> | Readonly<{
|
|
71
81
|
field: string;
|
|
72
|
-
operator: "is_not_null" | "is_null";
|
|
82
|
+
operator: "is_empty" | "is_not_null" | "is_null";
|
|
73
83
|
}> | Readonly<{
|
|
74
84
|
filters: readonly ResourceFilter[];
|
|
75
85
|
operator: "and" | "or";
|
|
@@ -92,6 +102,11 @@ export type ResourcePagination = Readonly<{
|
|
|
92
102
|
}>;
|
|
93
103
|
export type ResourceListQuery = Readonly<{
|
|
94
104
|
filter?: ResourceFilter;
|
|
105
|
+
/**
|
|
106
|
+
* Include Paths, such as `["company", "contacts.company"]`: relation
|
|
107
|
+
* fields whose records each item carries in `included`.
|
|
108
|
+
*/
|
|
109
|
+
include?: readonly string[];
|
|
95
110
|
includeDeleted?: boolean;
|
|
96
111
|
pagination: ResourcePagination;
|
|
97
112
|
sort?: readonly ResourceSort[];
|
|
@@ -100,7 +115,15 @@ export type ResourceListQuery = Readonly<{
|
|
|
100
115
|
export type ResourceRecord<Entity> = Readonly<{
|
|
101
116
|
deletedAt?: string;
|
|
102
117
|
id: ResourceRecordId;
|
|
118
|
+
/**
|
|
119
|
+
* The records of the read's Include Paths by relation field key: one
|
|
120
|
+
* record, or the records of a `many` field in reference order. Untyped:
|
|
121
|
+
* the target schemas are CI's.
|
|
122
|
+
*/
|
|
123
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
103
124
|
revision: ResourceRevision;
|
|
125
|
+
/** The keys whose included records were cut to the first 100. */
|
|
126
|
+
truncated?: readonly string[];
|
|
104
127
|
value: Entity;
|
|
105
128
|
}>;
|
|
106
129
|
export type ResourceListResult<Entity> = Readonly<{
|
|
@@ -115,7 +138,9 @@ export type ResourceListResult<Entity> = Readonly<{
|
|
|
115
138
|
totalItems: number;
|
|
116
139
|
totalPages: number;
|
|
117
140
|
}>;
|
|
118
|
-
export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable"
|
|
141
|
+
export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable" |
|
|
142
|
+
/** The CI Organization storage can not take a presigned File upload. */
|
|
143
|
+
"upload_not_supported";
|
|
119
144
|
export type ResourceError = Readonly<{
|
|
120
145
|
code: ResourceErrorCode;
|
|
121
146
|
/** Client-observed dispatch outcome; uncertainty never proves rollback. */
|
|
@@ -187,7 +212,7 @@ export type ResourceCreateInput<Value> = Readonly<{
|
|
|
187
212
|
value: Value;
|
|
188
213
|
}>;
|
|
189
214
|
/** Common entity operations. Generic resource lifecycle/cursor APIs remain separate. */
|
|
190
|
-
export type EntityOperation = "list" | "get" | "create" | "update" | "delete";
|
|
215
|
+
export type EntityOperation = "list" | "get" | "create" | "update" | "delete" | "upload";
|
|
191
216
|
export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
|
|
192
217
|
pagination: Extract<ResourcePagination, {
|
|
193
218
|
mode: "page";
|
|
@@ -203,6 +228,19 @@ export type EntityUpdateInput<Patch> = ResourceMutationInput<Patch> & Readonly<{
|
|
|
203
228
|
export type EntityDeleteInput = ResourceLifecycleInput & Readonly<{
|
|
204
229
|
idempotencyKey: IdempotencyKey;
|
|
205
230
|
}>;
|
|
231
|
+
/** A File upload request for one File field of the entity schema. */
|
|
232
|
+
export type EntityUploadInput = Readonly<{
|
|
233
|
+
field: string;
|
|
234
|
+
filename: string;
|
|
235
|
+
mimeType: string;
|
|
236
|
+
}>;
|
|
237
|
+
/** PUT the file bytes to `url` with `headers`; then write `{ upload: uploadId }`. */
|
|
238
|
+
export type EntityUploadSlot = Readonly<{
|
|
239
|
+
headers: Readonly<Record<string, string>>;
|
|
240
|
+
method: "PUT";
|
|
241
|
+
uploadId: string;
|
|
242
|
+
url: string;
|
|
243
|
+
}>;
|
|
206
244
|
export type EntityRequestIdentity = Readonly<{
|
|
207
245
|
requestId: string;
|
|
208
246
|
resourceId: string;
|
|
@@ -213,13 +251,17 @@ export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIden
|
|
|
213
251
|
}> | Readonly<{
|
|
214
252
|
operation: "get";
|
|
215
253
|
id: ResourceRecordId;
|
|
254
|
+
include?: readonly string[];
|
|
216
255
|
}> | (Readonly<{
|
|
217
256
|
operation: "create";
|
|
218
257
|
}> & EntityCreateInput<Create>) | (Readonly<{
|
|
219
258
|
operation: "update";
|
|
220
259
|
}> & EntityUpdateInput<Patch>) | (Readonly<{
|
|
221
260
|
operation: "delete";
|
|
222
|
-
}> & EntityDeleteInput)
|
|
261
|
+
}> & EntityDeleteInput) | (Readonly<{
|
|
262
|
+
operation: "upload";
|
|
263
|
+
}> & EntityUploadInput));
|
|
264
|
+
export type EntityOperationResult<Value, Operation extends EntityOperation> = Operation extends "list" ? EntityPage<Value> : Operation extends "upload" ? EntityUploadSlot : ResourceRecord<Value>;
|
|
223
265
|
/** Application login identities are separate from gateway machine callers. */
|
|
224
266
|
export type ApplicationUserIdentity = Readonly<{
|
|
225
267
|
kind: "local_user";
|
|
@@ -347,7 +389,7 @@ export type EntityResourceDefinition<Value = unknown, Create = Value, Patch = Pa
|
|
|
347
389
|
definition: ResourceDefinition<Value, Create, Patch>;
|
|
348
390
|
execute: (request: EntityRequest<Create, Patch>, context: EntityInvocationContext, options?: Readonly<{
|
|
349
391
|
signal?: AbortSignal;
|
|
350
|
-
}>) => Promise<ResourceResult<
|
|
392
|
+
}>) => Promise<ResourceResult<EntityOperationResult<Value, EntityOperation>>>;
|
|
351
393
|
}>;
|
|
352
394
|
export type GatewayResourceOperation = ResourceTransportRequest["operation"];
|
|
353
395
|
export type GatewayResourceAuthorization = Readonly<Partial<Record<GatewayResourceOperation, AuthorizationRequirement>>>;
|
|
@@ -393,6 +435,8 @@ export type EntityHttpRoute = {
|
|
|
393
435
|
} | {
|
|
394
436
|
readonly kind: "soft_delete";
|
|
395
437
|
readonly id: string;
|
|
438
|
+
} | {
|
|
439
|
+
readonly kind: "uploads";
|
|
396
440
|
};
|
|
397
441
|
export declare const createResourceHttpHandler: <Value, Create = Value, Patch = Partial<Value>>(options: ResourceHttpHandlerOptions<Value, Create, Patch>) => (request: Request) => Promise<Response>;
|
|
398
442
|
export declare const matchEntityHttpRoute: (pathname: string, basePath: string) => EntityHttpRoute | null;
|