@collective-intelligence/external-apps-server-sdk 0.1.9 → 0.1.11
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 +131 -39
- package/dist/admin.d.ts +537 -319
- package/dist/admin.js +1 -1
- package/dist/auth/better-auth.d.ts +4 -2
- package/dist/auth/federated.d.ts +17 -7
- package/dist/auth/federated.js +1 -1
- package/dist/auth.d.ts +3 -1
- package/dist/express.d.ts +15 -2
- package/dist/gateway/contracts.d.ts +15 -2
- package/dist/gateway.d.ts +15 -2
- package/dist/gateway.js +2 -2
- package/dist/index.d.ts +232 -73
- package/dist/index.js +3 -3
- package/dist/knowledge-sources/payload.d.ts +23 -2
- package/dist/knowledge-sources/strapi.d.ts +23 -2
- package/dist/persistence/drizzle.d.ts +43 -4
- package/dist/persistence/drizzle.js +4 -4
- package/dist/resources.d.ts +39 -5
- package/dist/resources.js +3 -3
- package/dist/runtime/effect.d.ts +93 -5
- package/dist/runtime/effect.js +4 -4
- package/dist/runtime/express.d.ts +15 -2
- package/dist/runtime/nestjs.d.ts +36 -5
- package/dist/runtime/nestjs.js +2 -2
- package/dist/runtime/next.d.ts +37 -6
- package/dist/runtime/next.js +2 -2
- package/dist/runtime/web.d.ts +19 -4
- package/dist/runtime/web.js +2 -2
- package/dist/tools/ai-sdk.js +2 -2
- package/package.json +3 -3
package/dist/resources.d.ts
CHANGED
|
@@ -65,13 +65,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
|
|
|
65
65
|
}>;
|
|
66
66
|
}>;
|
|
67
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
|
+
*/
|
|
68
76
|
export type ResourceFilter = Readonly<{
|
|
69
77
|
field: string;
|
|
70
|
-
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";
|
|
71
79
|
value: FilterValue;
|
|
72
80
|
}> | Readonly<{
|
|
73
81
|
field: string;
|
|
74
|
-
operator: "is_not_null" | "is_null";
|
|
82
|
+
operator: "is_empty" | "is_not_null" | "is_null";
|
|
75
83
|
}> | Readonly<{
|
|
76
84
|
filters: readonly ResourceFilter[];
|
|
77
85
|
operator: "and" | "or";
|
|
@@ -94,6 +102,11 @@ export type ResourcePagination = Readonly<{
|
|
|
94
102
|
}>;
|
|
95
103
|
export type ResourceListQuery = Readonly<{
|
|
96
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[];
|
|
97
110
|
includeDeleted?: boolean;
|
|
98
111
|
pagination: ResourcePagination;
|
|
99
112
|
sort?: readonly ResourceSort[];
|
|
@@ -102,7 +115,15 @@ export type ResourceListQuery = Readonly<{
|
|
|
102
115
|
export type ResourceRecord<Entity> = Readonly<{
|
|
103
116
|
deletedAt?: string;
|
|
104
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>>;
|
|
105
124
|
revision: ResourceRevision;
|
|
125
|
+
/** The keys whose included records were cut to the first 100. */
|
|
126
|
+
truncated?: readonly string[];
|
|
106
127
|
value: Entity;
|
|
107
128
|
}>;
|
|
108
129
|
export type ResourceListResult<Entity> = Readonly<{
|
|
@@ -191,7 +212,7 @@ export type ResourceCreateInput<Value> = Readonly<{
|
|
|
191
212
|
value: Value;
|
|
192
213
|
}>;
|
|
193
214
|
/** Common entity operations. Generic resource lifecycle/cursor APIs remain separate. */
|
|
194
|
-
export type EntityOperation = "list" | "get" | "create" | "update" | "delete" | "upload";
|
|
215
|
+
export type EntityOperation = "list_members" | "list" | "get" | "create" | "update" | "delete" | "upload";
|
|
195
216
|
export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
|
|
196
217
|
pagination: Extract<ResourcePagination, {
|
|
197
218
|
mode: "page";
|
|
@@ -200,6 +221,8 @@ export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDel
|
|
|
200
221
|
export type EntityPage<Value> = Extract<ResourceListResult<Value>, {
|
|
201
222
|
pagination: "page";
|
|
202
223
|
}>;
|
|
224
|
+
/** Member schemas are resolved by CI, independently of the parent resource. */
|
|
225
|
+
export type EntityMemberValue = Readonly<Record<string, ResourceJsonValue>>;
|
|
203
226
|
export type EntityCreateInput<Value> = ResourceCreateInput<Value>;
|
|
204
227
|
export type EntityUpdateInput<Patch> = ResourceMutationInput<Patch> & Readonly<{
|
|
205
228
|
idempotencyKey: IdempotencyKey;
|
|
@@ -227,9 +250,15 @@ export type EntityRequestIdentity = Readonly<{
|
|
|
227
250
|
export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIdentity & (Readonly<{
|
|
228
251
|
operation: "list";
|
|
229
252
|
query: EntityListQuery;
|
|
253
|
+
}> | Readonly<{
|
|
254
|
+
operation: "list_members";
|
|
255
|
+
parentId: ResourceRecordId;
|
|
256
|
+
field: string;
|
|
257
|
+
query: EntityListQuery;
|
|
230
258
|
}> | Readonly<{
|
|
231
259
|
operation: "get";
|
|
232
260
|
id: ResourceRecordId;
|
|
261
|
+
include?: readonly string[];
|
|
233
262
|
}> | (Readonly<{
|
|
234
263
|
operation: "create";
|
|
235
264
|
}> & EntityCreateInput<Create>) | (Readonly<{
|
|
@@ -239,7 +268,7 @@ export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIden
|
|
|
239
268
|
}> & EntityDeleteInput) | (Readonly<{
|
|
240
269
|
operation: "upload";
|
|
241
270
|
}> & EntityUploadInput));
|
|
242
|
-
export type EntityOperationResult<Value, Operation extends EntityOperation> = Operation extends "list" ? EntityPage<Value> : Operation extends "upload" ? EntityUploadSlot : ResourceRecord<Value>;
|
|
271
|
+
export type EntityOperationResult<Value, Operation extends EntityOperation> = Operation extends "list_members" ? EntityPage<EntityMemberValue> : Operation extends "list" ? EntityPage<Value> : Operation extends "upload" ? EntityUploadSlot : ResourceRecord<Value>;
|
|
243
272
|
/** Application login identities are separate from gateway machine callers. */
|
|
244
273
|
export type ApplicationUserIdentity = Readonly<{
|
|
245
274
|
kind: "local_user";
|
|
@@ -259,13 +288,15 @@ export type ApplicationUserIdentity = Readonly<{
|
|
|
259
288
|
* and request/correlation IDs are deliberately not part of that logical identity.
|
|
260
289
|
*/
|
|
261
290
|
export type EntityInvocationContext = Readonly<{
|
|
291
|
+
/** The App Permissions of the user's effective roles on the app. */
|
|
292
|
+
appPermissions: readonly string[];
|
|
262
293
|
applicationId: string;
|
|
263
294
|
issuer: string;
|
|
264
295
|
organizationId: string;
|
|
265
296
|
resourceId: string;
|
|
297
|
+
/** The user's effective roles on the app, read from CI at this lookup. */
|
|
266
298
|
roles: readonly string[];
|
|
267
299
|
scopes: readonly string[];
|
|
268
|
-
groupIds: readonly string[];
|
|
269
300
|
user: ApplicationUserIdentity;
|
|
270
301
|
}>;
|
|
271
302
|
export type PrincipalKind = "detached_user" | "service_principal";
|
|
@@ -405,6 +436,9 @@ export type ResourceHttpHandlerOptions<Value = unknown, Create = Value, Patch =
|
|
|
405
436
|
}>;
|
|
406
437
|
export type EntityHttpRoute = {
|
|
407
438
|
readonly kind: "search";
|
|
439
|
+
} | {
|
|
440
|
+
readonly kind: "relation_members";
|
|
441
|
+
readonly id: string;
|
|
408
442
|
} | {
|
|
409
443
|
readonly kind: "collection";
|
|
410
444
|
} | {
|