@collective-intelligence/external-apps-server-sdk 0.1.10 → 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.
@@ -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 or no current role/group policy supplied by CI.
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. */
@@ -261,7 +263,7 @@ export type ResourceCreateInput<Value> = Readonly<{
261
263
  value: Value;
262
264
  }>;
263
265
  /** Common entity operations. Generic resource lifecycle/cursor APIs remain separate. */
264
- export type EntityOperation = "list" | "get" | "create" | "update" | "delete" | "upload";
266
+ export type EntityOperation = "list_members" | "list" | "get" | "create" | "update" | "delete" | "upload";
265
267
  export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
266
268
  pagination: Extract<ResourcePagination, {
267
269
  mode: "page";
@@ -270,6 +272,8 @@ export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDel
270
272
  export type EntityPage<Value> = Extract<ResourceListResult<Value>, {
271
273
  pagination: "page";
272
274
  }>;
275
+ /** Member schemas are resolved by CI, independently of the parent resource. */
276
+ export type EntityMemberValue = Readonly<Record<string, ResourceJsonValue>>;
273
277
  export type EntityCreateInput<Value> = ResourceCreateInput<Value>;
274
278
  export type EntityUpdateInput<Patch> = ResourceMutationInput<Patch> & Readonly<{
275
279
  idempotencyKey: IdempotencyKey;
@@ -297,6 +301,11 @@ export type EntityRequestIdentity = Readonly<{
297
301
  export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIdentity & (Readonly<{
298
302
  operation: "list";
299
303
  query: EntityListQuery;
304
+ }> | Readonly<{
305
+ operation: "list_members";
306
+ parentId: ResourceRecordId;
307
+ field: string;
308
+ query: EntityListQuery;
300
309
  }> | Readonly<{
301
310
  operation: "get";
302
311
  id: ResourceRecordId;
@@ -310,7 +319,7 @@ export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIden
310
319
  }> & EntityDeleteInput) | (Readonly<{
311
320
  operation: "upload";
312
321
  }> & EntityUploadInput));
313
- 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>;
314
323
  export interface ConfidentialCredentials {
315
324
  readonly clientId: string;
316
325
  readonly clientSecret: string;