@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/runtime/next.d.ts
CHANGED
|
@@ -23,13 +23,15 @@ export type ApplicationUserSession = Readonly<{
|
|
|
23
23
|
* and request/correlation IDs are deliberately not part of that logical identity.
|
|
24
24
|
*/
|
|
25
25
|
export type EntityInvocationContext = Readonly<{
|
|
26
|
+
/** The App Permissions of the user's effective roles on the app. */
|
|
27
|
+
appPermissions: readonly string[];
|
|
26
28
|
applicationId: string;
|
|
27
29
|
issuer: string;
|
|
28
30
|
organizationId: string;
|
|
29
31
|
resourceId: string;
|
|
32
|
+
/** The user's effective roles on the app, read from CI at this lookup. */
|
|
30
33
|
roles: readonly string[];
|
|
31
34
|
scopes: readonly string[];
|
|
32
|
-
groupIds: readonly string[];
|
|
33
35
|
user: ApplicationUserIdentity;
|
|
34
36
|
}>;
|
|
35
37
|
export type ApplicationUserAuth = Readonly<{
|
|
@@ -38,7 +40,7 @@ export type ApplicationUserAuth = Readonly<{
|
|
|
38
40
|
/** Returns null only when the request has no valid application session. */
|
|
39
41
|
getSession: (request: Request) => Promise<ApplicationUserSession | null>;
|
|
40
42
|
/** Server-only current CI authority. The host still owns resource/operation policy.
|
|
41
|
-
* Null means no valid CI session
|
|
43
|
+
* Null means no valid CI session, including a user without a role on the app.
|
|
42
44
|
*/
|
|
43
45
|
getEntityContext: (request: Request, resourceId: string) => Promise<EntityInvocationContext | null>;
|
|
44
46
|
/** Server-only Delegated access token. Absent for local application login. */
|
|
@@ -114,13 +116,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
|
|
|
114
116
|
}>;
|
|
115
117
|
}>;
|
|
116
118
|
export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
|
|
119
|
+
/**
|
|
120
|
+
* A filter predicate. `field` names a declared filterable field, or a path
|
|
121
|
+
* through at most three fields that hold Entity References to a field of
|
|
122
|
+
* the last target, such as `company.industry` or
|
|
123
|
+
* `contacts.company.parent.industry`. On a field that holds Entity
|
|
124
|
+
* References, `is_empty` means no reference, and `contains_any` and
|
|
125
|
+
* `contains_all` compare the ids of a field that holds many.
|
|
126
|
+
*/
|
|
117
127
|
export type ResourceFilter = Readonly<{
|
|
118
128
|
field: string;
|
|
119
|
-
operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
129
|
+
operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
120
130
|
value: FilterValue;
|
|
121
131
|
}> | Readonly<{
|
|
122
132
|
field: string;
|
|
123
|
-
operator: "is_not_null" | "is_null";
|
|
133
|
+
operator: "is_empty" | "is_not_null" | "is_null";
|
|
124
134
|
}> | Readonly<{
|
|
125
135
|
filters: readonly ResourceFilter[];
|
|
126
136
|
operator: "and" | "or";
|
|
@@ -143,6 +153,11 @@ export type ResourcePagination = Readonly<{
|
|
|
143
153
|
}>;
|
|
144
154
|
export type ResourceListQuery = Readonly<{
|
|
145
155
|
filter?: ResourceFilter;
|
|
156
|
+
/**
|
|
157
|
+
* Include Paths, such as `["company", "contacts.company"]`: relation
|
|
158
|
+
* fields whose records each item carries in `included`.
|
|
159
|
+
*/
|
|
160
|
+
include?: readonly string[];
|
|
146
161
|
includeDeleted?: boolean;
|
|
147
162
|
pagination: ResourcePagination;
|
|
148
163
|
sort?: readonly ResourceSort[];
|
|
@@ -151,7 +166,15 @@ export type ResourceListQuery = Readonly<{
|
|
|
151
166
|
export type ResourceRecord<Entity> = Readonly<{
|
|
152
167
|
deletedAt?: string;
|
|
153
168
|
id: ResourceRecordId;
|
|
169
|
+
/**
|
|
170
|
+
* The records of the read's Include Paths by relation field key: one
|
|
171
|
+
* record, or the records of a `many` field in reference order. Untyped:
|
|
172
|
+
* the target schemas are CI's.
|
|
173
|
+
*/
|
|
174
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
154
175
|
revision: ResourceRevision;
|
|
176
|
+
/** The keys whose included records were cut to the first 100. */
|
|
177
|
+
truncated?: readonly string[];
|
|
155
178
|
value: Entity;
|
|
156
179
|
}>;
|
|
157
180
|
export type ResourceListResult<Entity> = Readonly<{
|
|
@@ -240,7 +263,7 @@ export type ResourceCreateInput<Value> = Readonly<{
|
|
|
240
263
|
value: Value;
|
|
241
264
|
}>;
|
|
242
265
|
/** Common entity operations. Generic resource lifecycle/cursor APIs remain separate. */
|
|
243
|
-
export type EntityOperation = "list" | "get" | "create" | "update" | "delete" | "upload";
|
|
266
|
+
export type EntityOperation = "list_members" | "list" | "get" | "create" | "update" | "delete" | "upload";
|
|
244
267
|
export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
|
|
245
268
|
pagination: Extract<ResourcePagination, {
|
|
246
269
|
mode: "page";
|
|
@@ -249,6 +272,8 @@ export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDel
|
|
|
249
272
|
export type EntityPage<Value> = Extract<ResourceListResult<Value>, {
|
|
250
273
|
pagination: "page";
|
|
251
274
|
}>;
|
|
275
|
+
/** Member schemas are resolved by CI, independently of the parent resource. */
|
|
276
|
+
export type EntityMemberValue = Readonly<Record<string, ResourceJsonValue>>;
|
|
252
277
|
export type EntityCreateInput<Value> = ResourceCreateInput<Value>;
|
|
253
278
|
export type EntityUpdateInput<Patch> = ResourceMutationInput<Patch> & Readonly<{
|
|
254
279
|
idempotencyKey: IdempotencyKey;
|
|
@@ -276,9 +301,15 @@ export type EntityRequestIdentity = Readonly<{
|
|
|
276
301
|
export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIdentity & (Readonly<{
|
|
277
302
|
operation: "list";
|
|
278
303
|
query: EntityListQuery;
|
|
304
|
+
}> | Readonly<{
|
|
305
|
+
operation: "list_members";
|
|
306
|
+
parentId: ResourceRecordId;
|
|
307
|
+
field: string;
|
|
308
|
+
query: EntityListQuery;
|
|
279
309
|
}> | Readonly<{
|
|
280
310
|
operation: "get";
|
|
281
311
|
id: ResourceRecordId;
|
|
312
|
+
include?: readonly string[];
|
|
282
313
|
}> | (Readonly<{
|
|
283
314
|
operation: "create";
|
|
284
315
|
}> & EntityCreateInput<Create>) | (Readonly<{
|
|
@@ -288,7 +319,7 @@ export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIden
|
|
|
288
319
|
}> & EntityDeleteInput) | (Readonly<{
|
|
289
320
|
operation: "upload";
|
|
290
321
|
}> & EntityUploadInput));
|
|
291
|
-
export type EntityOperationResult<Value, Operation extends EntityOperation> = Operation extends "list" ? EntityPage<Value> : Operation extends "upload" ? EntityUploadSlot : ResourceRecord<Value>;
|
|
322
|
+
export type EntityOperationResult<Value, Operation extends EntityOperation> = Operation extends "list_members" ? EntityPage<EntityMemberValue> : Operation extends "list" ? EntityPage<Value> : Operation extends "upload" ? EntityUploadSlot : ResourceRecord<Value>;
|
|
292
323
|
export interface ConfidentialCredentials {
|
|
293
324
|
readonly clientId: string;
|
|
294
325
|
readonly clientSecret: string;
|