@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.
@@ -426,13 +426,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
426
426
  }>;
427
427
  }>;
428
428
  export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
429
+ /**
430
+ * A filter predicate. `field` names a declared filterable field, or a path
431
+ * through at most three fields that hold Entity References to a field of
432
+ * the last target, such as `company.industry` or
433
+ * `contacts.company.parent.industry`. On a field that holds Entity
434
+ * References, `is_empty` means no reference, and `contains_any` and
435
+ * `contains_all` compare the ids of a field that holds many.
436
+ */
429
437
  export type ResourceFilter = Readonly<{
430
438
  field: string;
431
- operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
439
+ operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
432
440
  value: FilterValue;
433
441
  }> | Readonly<{
434
442
  field: string;
435
- operator: "is_not_null" | "is_null";
443
+ operator: "is_empty" | "is_not_null" | "is_null";
436
444
  }> | Readonly<{
437
445
  filters: readonly ResourceFilter[];
438
446
  operator: "and" | "or";
@@ -455,6 +463,11 @@ export type ResourcePagination = Readonly<{
455
463
  }>;
456
464
  export type ResourceListQuery = Readonly<{
457
465
  filter?: ResourceFilter;
466
+ /**
467
+ * Include Paths, such as `["company", "contacts.company"]`: relation
468
+ * fields whose records each item carries in `included`.
469
+ */
470
+ include?: readonly string[];
458
471
  includeDeleted?: boolean;
459
472
  pagination: ResourcePagination;
460
473
  sort?: readonly ResourceSort[];
@@ -67,13 +67,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
67
67
  }>;
68
68
  }>;
69
69
  export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
70
+ /**
71
+ * A filter predicate. `field` names a declared filterable field, or a path
72
+ * through at most three fields that hold Entity References to a field of
73
+ * the last target, such as `company.industry` or
74
+ * `contacts.company.parent.industry`. On a field that holds Entity
75
+ * References, `is_empty` means no reference, and `contains_any` and
76
+ * `contains_all` compare the ids of a field that holds many.
77
+ */
70
78
  export type ResourceFilter = Readonly<{
71
79
  field: string;
72
- operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
80
+ operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
73
81
  value: FilterValue;
74
82
  }> | Readonly<{
75
83
  field: string;
76
- operator: "is_not_null" | "is_null";
84
+ operator: "is_empty" | "is_not_null" | "is_null";
77
85
  }> | Readonly<{
78
86
  filters: readonly ResourceFilter[];
79
87
  operator: "and" | "or";
@@ -96,6 +104,11 @@ export type ResourcePagination = Readonly<{
96
104
  }>;
97
105
  export type ResourceListQuery = Readonly<{
98
106
  filter?: ResourceFilter;
107
+ /**
108
+ * Include Paths, such as `["company", "contacts.company"]`: relation
109
+ * fields whose records each item carries in `included`.
110
+ */
111
+ include?: readonly string[];
99
112
  includeDeleted?: boolean;
100
113
  pagination: ResourcePagination;
101
114
  sort?: readonly ResourceSort[];
@@ -104,7 +117,15 @@ export type ResourceListQuery = Readonly<{
104
117
  export type ResourceRecord<Entity> = Readonly<{
105
118
  deletedAt?: string;
106
119
  id: ResourceRecordId;
120
+ /**
121
+ * The records of the read's Include Paths by relation field key: one
122
+ * record, or the records of a `many` field in reference order. Untyped:
123
+ * the target schemas are CI's.
124
+ */
125
+ included?: Readonly<Record<string, ResourceJsonValue>>;
107
126
  revision: ResourceRevision;
127
+ /** The keys whose included records were cut to the first 100. */
128
+ truncated?: readonly string[];
108
129
  value: Entity;
109
130
  }>;
110
131
  export type ResourceListResult<Entity> = Readonly<{
@@ -193,7 +214,7 @@ export type ResourceCreateInput<Value> = Readonly<{
193
214
  value: Value;
194
215
  }>;
195
216
  /** Common entity operations. Generic resource lifecycle/cursor APIs remain separate. */
196
- export type EntityOperation = "list" | "get" | "create" | "update" | "delete" | "upload";
217
+ export type EntityOperation = "list_members" | "list" | "get" | "create" | "update" | "delete" | "upload";
197
218
  export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
198
219
  pagination: Extract<ResourcePagination, {
199
220
  mode: "page";
@@ -202,6 +223,8 @@ export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDel
202
223
  export type EntityPage<Value> = Extract<ResourceListResult<Value>, {
203
224
  pagination: "page";
204
225
  }>;
226
+ /** Member schemas are resolved by CI, independently of the parent resource. */
227
+ export type EntityMemberValue = Readonly<Record<string, ResourceJsonValue>>;
205
228
  export type EntityCreateInput<Value> = ResourceCreateInput<Value>;
206
229
  export type EntityUpdateInput<Patch> = ResourceMutationInput<Patch> & Readonly<{
207
230
  idempotencyKey: IdempotencyKey;
@@ -229,9 +252,15 @@ export type EntityRequestIdentity = Readonly<{
229
252
  export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIdentity & (Readonly<{
230
253
  operation: "list";
231
254
  query: EntityListQuery;
255
+ }> | Readonly<{
256
+ operation: "list_members";
257
+ parentId: ResourceRecordId;
258
+ field: string;
259
+ query: EntityListQuery;
232
260
  }> | Readonly<{
233
261
  operation: "get";
234
262
  id: ResourceRecordId;
263
+ include?: readonly string[];
235
264
  }> | (Readonly<{
236
265
  operation: "create";
237
266
  }> & EntityCreateInput<Create>) | (Readonly<{
@@ -241,7 +270,7 @@ export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIden
241
270
  }> & EntityDeleteInput) | (Readonly<{
242
271
  operation: "upload";
243
272
  }> & EntityUploadInput));
244
- export type EntityOperationResult<Value, Operation extends EntityOperation> = Operation extends "list" ? EntityPage<Value> : Operation extends "upload" ? EntityUploadSlot : ResourceRecord<Value>;
273
+ export type EntityOperationResult<Value, Operation extends EntityOperation> = Operation extends "list_members" ? EntityPage<EntityMemberValue> : Operation extends "list" ? EntityPage<Value> : Operation extends "upload" ? EntityUploadSlot : ResourceRecord<Value>;
245
274
  /** Application login identities are separate from gateway machine callers. */
246
275
  export type ApplicationUserIdentity = Readonly<{
247
276
  kind: "local_user";
@@ -261,13 +290,15 @@ export type ApplicationUserIdentity = Readonly<{
261
290
  * and request/correlation IDs are deliberately not part of that logical identity.
262
291
  */
263
292
  export type EntityInvocationContext = Readonly<{
293
+ /** The App Permissions of the user's effective roles on the app. */
294
+ appPermissions: readonly string[];
264
295
  applicationId: string;
265
296
  issuer: string;
266
297
  organizationId: string;
267
298
  resourceId: string;
299
+ /** The user's effective roles on the app, read from CI at this lookup. */
268
300
  roles: readonly string[];
269
301
  scopes: readonly string[];
270
- groupIds: readonly string[];
271
302
  user: ApplicationUserIdentity;
272
303
  }>;
273
304
  export type PrincipalKind = "detached_user" | "service_principal";