@collective-intelligence/external-apps-server-sdk 0.2.3 → 0.2.5

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/dist/effect.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- import { ConsumerProfileDiagnostic, DatasetDefinition, DatasetProviderCapabilities, DatasetProviderResult, DatasetResultPage, FormMetadata, JsonSchemaDocument, OperationDomainDeclaration, PackageSchemaProjection, PortableOperationDeclaration, QueryInput } from '@collective-intelligence/extensions-sdk';
3
+ import { AccessHeldCapability, ConsumerProfileDiagnostic, DatasetDefinition, DatasetProviderCapabilities, DatasetProviderResult, DatasetResultPage, FormMetadata, JsonSchemaDocument, OperationDomainDeclaration, PackageSchemaProjection, PortableOperationDeclaration, QueryInput } from '@collective-intelligence/extensions-sdk';
4
4
  import { CiError, CiErrorCode, CiTransportError, FederatedAuthError, FederatedAuthErrorCode } from '@collective-intelligence/external-apps-client-sdk/effect';
5
5
  import { EntityListQuery, EntityOperation, EntityOperationResult, EntityPage, EntityProtocol, EntityRequest, EntityUploadInput, EntityUploadSlot, ResourceDefinition, ResourceJsonValue, ResourceListQuery, ResourceListResult, ResourceRecord, ResourceResult, ResourceTransportRequest } from '@collective-intelligence/external-apps-client-sdk/resources';
6
6
  import * as DrizzleNodePostgres from 'drizzle-orm/node-postgres';
@@ -50,15 +50,15 @@ export type ApplicationUserIdentity = Readonly<{
50
50
  * and request/correlation IDs are deliberately not part of that logical identity.
51
51
  */
52
52
  export type EntityInvocationContext = Readonly<{
53
- /** The App Permissions of the user's effective roles on the app. */
54
- appPermissions: readonly string[];
55
53
  applicationId: string;
54
+ /**
55
+ * The app's slice of the user's access, as CI answered it: check
56
+ * capability Requirements against it with `evaluateAccessRequirement`.
57
+ */
58
+ capabilities: readonly AccessHeldCapability[];
56
59
  issuer: string;
57
60
  organizationId: string;
58
61
  resourceId: string;
59
- /** The user's effective roles on the app, read from CI at this lookup. */
60
- roles: readonly string[];
61
- scopes: readonly string[];
62
62
  user: ApplicationUserIdentity;
63
63
  }>;
64
64
  export type PrincipalKind = "detached_user" | "service_principal";
@@ -272,6 +272,454 @@ export interface GatewayKernel {
272
272
  readonly handle: (request: Request) => Promise<Response>;
273
273
  readonly manifest: DefinedGateway["manifest"];
274
274
  }
275
+ export type AccessExplanation = {
276
+ cut: {
277
+ credential: {
278
+ apiKeyId: string;
279
+ kind: "api_key";
280
+ } | {
281
+ applicationId: string;
282
+ kind: "application_token";
283
+ };
284
+ maxPrivileges: Array<{
285
+ code: string;
286
+ mode: "manage" | "on" | "read";
287
+ }>;
288
+ tuples: Array<{
289
+ capabilities: Array<{
290
+ code: string;
291
+ held: "manage" | "on" | "read";
292
+ kept: "manage" | "on" | "read" | null;
293
+ }>;
294
+ holder: {
295
+ grantId: string;
296
+ kind: "grant";
297
+ };
298
+ }>;
299
+ } | null;
300
+ grants: Array<{
301
+ grantId: string;
302
+ label: string;
303
+ profile: {
304
+ id: string;
305
+ label: string;
306
+ };
307
+ values: Array<{
308
+ axis: {
309
+ id: string;
310
+ label: string;
311
+ };
312
+ value: {
313
+ id: string;
314
+ label: string | null;
315
+ };
316
+ }>;
317
+ origin: "declared" | "manual" | "import" | "api" | "app_server" | "invitation" | "tenant" | null;
318
+ via: {
319
+ kind: "direct";
320
+ } | {
321
+ group: {
322
+ id: string;
323
+ label: string | null;
324
+ };
325
+ kind: "group";
326
+ } | {
327
+ group: {
328
+ id: string;
329
+ label: string | null;
330
+ };
331
+ kind: "inherited_group";
332
+ };
333
+ }>;
334
+ principal: {
335
+ kind: "service_principal" | "user";
336
+ tenantRole: "tenant_admin" | "tenant_operator" | null;
337
+ userId: string;
338
+ } | {
339
+ applicationId: string;
340
+ kind: "application_server" | "application_visitors";
341
+ };
342
+ target: {
343
+ allowed: boolean;
344
+ code: string;
345
+ holders: Array<{
346
+ grantId: string;
347
+ kind: "grant";
348
+ }>;
349
+ kind: "capability";
350
+ known: boolean;
351
+ mode: "manage" | "on" | "read";
352
+ } | {
353
+ admitted: boolean;
354
+ fields: {
355
+ hidden: Array<string>;
356
+ otherFields: "hidden" | "shown";
357
+ shown: Array<string>;
358
+ } | null;
359
+ kind: "record";
360
+ operation: "read" | "write";
361
+ policies: Array<{
362
+ capability: {
363
+ code: string;
364
+ mode: "manage" | "on" | "read";
365
+ };
366
+ fields: Array<string> | {
367
+ except: Array<string>;
368
+ } | null;
369
+ id: string;
370
+ kind: "package" | "core_tenant" | "core_admin" | "core_default";
371
+ purpose: "access" | "administration";
372
+ result: {
373
+ admitted: true;
374
+ grantIds: Array<string>;
375
+ } | {
376
+ admitted: false;
377
+ reason: "axes_not_bound" | "capability_not_held" | "record_not_matched";
378
+ };
379
+ }>;
380
+ recordId: string;
381
+ schemaId: string;
382
+ };
383
+ };
384
+ export type AccessExplainRequest = {
385
+ credential?: {
386
+ apiKeyId: string;
387
+ kind: "api_key";
388
+ } | {
389
+ applicationId: string;
390
+ kind: "application_token";
391
+ };
392
+ principal: {
393
+ kind: "user";
394
+ userId: string;
395
+ } | {
396
+ applicationId: string;
397
+ kind: "application_server" | "application_visitors";
398
+ };
399
+ target: {
400
+ code: string;
401
+ kind: "capability";
402
+ mode: "manage" | "on" | "read";
403
+ } | {
404
+ kind: "record";
405
+ operation: "read" | "write";
406
+ recordId: string;
407
+ };
408
+ };
409
+ export type AccessGrantAxis = {
410
+ entitySchemaId: string;
411
+ hierarchyFieldId: string | null;
412
+ id: string;
413
+ label: string;
414
+ packageInstallationId: string | null;
415
+ slug: string;
416
+ };
417
+ export type AccessCapabilityNode = {
418
+ area: "dashboard" | "studio" | "mcp" | "admin" | "platform" | "data" | "tenant" | "app" | "package";
419
+ code: string;
420
+ grantableBy: "admins" | "holders";
421
+ id: string;
422
+ key: string;
423
+ kind: "switch" | "read_manage";
424
+ parentId: string | null;
425
+ source: "core" | "application" | "package";
426
+ status: "active" | "retired";
427
+ };
428
+ export type AccessProfile = {
429
+ audience: "user" | "server" | "anonymous" | "max_privileges";
430
+ axisIds: Array<string>;
431
+ canGrant: "all" | Array<string>;
432
+ capabilities: Array<AccessProfileCapability>;
433
+ description: string | null;
434
+ displayName: string;
435
+ fqn: string | null;
436
+ id: string;
437
+ readonly: boolean;
438
+ source: "builtin" | "package" | "custom";
439
+ version: number;
440
+ };
441
+ export type AccessProfileCapability = {
442
+ code: string;
443
+ mode: "manage" | "on" | "read";
444
+ };
445
+ export type AccessMemberCreated = {
446
+ accountCreated: boolean;
447
+ grants: Array<AccessGrant>;
448
+ mode: "direct";
449
+ userId: string;
450
+ } | {
451
+ email: string;
452
+ invitationId: string;
453
+ mode: "invitation";
454
+ };
455
+ export type AccessGrant = {
456
+ active: boolean;
457
+ axes: Array<{
458
+ axisId: string;
459
+ entityId: string;
460
+ }>;
461
+ fqn: string | null;
462
+ id: string;
463
+ origin: "declared" | "manual" | "import" | "api" | "app_server" | "invitation" | "tenant";
464
+ profileId: string;
465
+ recipient: AccessGrantRecipient;
466
+ };
467
+ export type AccessGrantRecipient = {
468
+ kind: "user";
469
+ userId: string;
470
+ } | {
471
+ coverage: "direct" | "inherited";
472
+ groupId: string;
473
+ kind: "group";
474
+ } | {
475
+ applicationId: string;
476
+ kind: "application_server" | "application_visitors";
477
+ };
478
+ export type AccessMemberCreateRequest = {
479
+ email: string;
480
+ grants: Array<{
481
+ axes?: {
482
+ [key: string]: {
483
+ knowledgeEntity: {
484
+ field: string;
485
+ value: string;
486
+ };
487
+ } | string;
488
+ };
489
+ profile: string | {
490
+ id: string;
491
+ };
492
+ }>;
493
+ kind: "member" | "guest";
494
+ mode: "direct" | "invitation";
495
+ name?: string;
496
+ };
497
+ export type AccessGrantSyncResult = {
498
+ created: Array<string>;
499
+ deleted: Array<string>;
500
+ unchanged: Array<string>;
501
+ updated: Array<string>;
502
+ };
503
+ export type AccessSnapshot = {
504
+ accessVersion: number;
505
+ capabilities: Array<{
506
+ area: "admin" | "app" | "dashboard" | "data" | "mcp" | "package" | "platform" | "studio" | "tenant";
507
+ code: string;
508
+ mode: "manage" | "on" | "read";
509
+ path: Array<string>;
510
+ }>;
511
+ grants: Array<{
512
+ grantId: string;
513
+ label: string;
514
+ profile: {
515
+ id: string;
516
+ label: string;
517
+ };
518
+ values: Array<{
519
+ axis: {
520
+ id: string;
521
+ label: string;
522
+ };
523
+ value: {
524
+ id: string;
525
+ label: string | null;
526
+ };
527
+ }>;
528
+ }>;
529
+ schemas: Array<{
530
+ read: "all" | "none" | "some";
531
+ schemaId: string;
532
+ write: "all" | "none" | "some";
533
+ }>;
534
+ versionToken: string;
535
+ };
536
+ export type AccessGroup = {
537
+ description: string | null;
538
+ fqn: string | null;
539
+ id: string;
540
+ name: string;
541
+ package: {
542
+ fqn: string;
543
+ managed: boolean;
544
+ readonly: boolean;
545
+ } | null;
546
+ parentGroupId: string | null;
547
+ slug: string | null;
548
+ };
549
+ export type AccessGroupUpdateRequest = {
550
+ description?: string | null;
551
+ name?: string;
552
+ parentGroupId?: string | null;
553
+ slug?: string | null;
554
+ };
555
+ export type AccessGroupPage = {
556
+ items: Array<AccessGroup>;
557
+ next: number | null;
558
+ };
559
+ export type AccessGroupCreateRequest = {
560
+ description?: string | null;
561
+ name: string;
562
+ parentGroupId?: string | null;
563
+ slug?: string | null;
564
+ };
565
+ export type AccessSchemaKnowledgePolicies = {
566
+ read: Array<AccessKnowledgeDataPolicy>;
567
+ schemaId: string;
568
+ write: Array<AccessKnowledgeDataPolicy>;
569
+ };
570
+ export type AccessKnowledgeDataPolicy = {
571
+ axes: Array<{
572
+ axis: string;
573
+ byCondition: true;
574
+ } | {
575
+ axis: string;
576
+ map: {
577
+ field: string;
578
+ } | {
579
+ relation: {
580
+ field: string;
581
+ key: string;
582
+ };
583
+ } | {
584
+ self: true;
585
+ };
586
+ } | {
587
+ axis: string;
588
+ unscoped: true;
589
+ }>;
590
+ capability: AccessProfileCapability;
591
+ fqn: string | null;
592
+ id: string;
593
+ includesHostOwned: boolean;
594
+ kind: "package" | "core_tenant" | "core_admin" | "core_default";
595
+ operation: "read" | "write";
596
+ otherAxesUnscoped: boolean;
597
+ purpose: "access" | "administration";
598
+ readableFields: Array<string> | {
599
+ except: Array<string>;
600
+ } | null;
601
+ schemaId: string | null;
602
+ where: unknown | null;
603
+ writableFields: Array<string> | {
604
+ except: Array<string>;
605
+ } | null;
606
+ };
607
+ export type AccessGrantUpdateRequest = {
608
+ axes?: {
609
+ [key: string]: {
610
+ knowledgeEntity: {
611
+ field: string;
612
+ value: string;
613
+ };
614
+ } | string;
615
+ };
616
+ grantee: {
617
+ user: {
618
+ email: string;
619
+ };
620
+ } | {
621
+ coverage: "direct" | "inherited";
622
+ group: {
623
+ fqn: string;
624
+ };
625
+ } | {
626
+ servicePrincipal: string;
627
+ } | {
628
+ applicationServer: string;
629
+ } | {
630
+ applicationVisitors: string;
631
+ };
632
+ profile: string | {
633
+ id: string;
634
+ };
635
+ };
636
+ export type AccessGrantList = Array<AccessGrant>;
637
+ export type AccessGrantSyncRequest = {
638
+ grants: Array<{
639
+ axes?: {
640
+ [key: string]: {
641
+ knowledgeEntity: {
642
+ field: string;
643
+ value: string;
644
+ };
645
+ } | string;
646
+ };
647
+ grantee: {
648
+ user: {
649
+ email: string;
650
+ };
651
+ } | {
652
+ coverage: "direct" | "inherited";
653
+ group: {
654
+ fqn: string;
655
+ };
656
+ } | {
657
+ servicePrincipal: string;
658
+ } | {
659
+ applicationServer: string;
660
+ } | {
661
+ applicationVisitors: string;
662
+ };
663
+ profile: string | {
664
+ id: string;
665
+ };
666
+ fqn: string;
667
+ }>;
668
+ namespace: string;
669
+ };
670
+ export type AccessGrantCreateRequest = {
671
+ axes?: {
672
+ [key: string]: {
673
+ knowledgeEntity: {
674
+ field: string;
675
+ value: string;
676
+ };
677
+ } | string;
678
+ };
679
+ grantee: {
680
+ user: {
681
+ email: string;
682
+ };
683
+ } | {
684
+ coverage: "direct" | "inherited";
685
+ group: {
686
+ fqn: string;
687
+ };
688
+ } | {
689
+ servicePrincipal: string;
690
+ } | {
691
+ applicationServer: string;
692
+ } | {
693
+ applicationVisitors: string;
694
+ };
695
+ profile: string | {
696
+ id: string;
697
+ };
698
+ fqn: string;
699
+ };
700
+ export type AccessInvitationPage = {
701
+ items: Array<AccessInvitation>;
702
+ next: number | null;
703
+ };
704
+ export type AccessInvitation = {
705
+ createdAt: string | null;
706
+ email: string;
707
+ id: string;
708
+ invitedByUserId: string | null;
709
+ status: "pending" | "accepted" | "revoked";
710
+ };
711
+ export type AccessMember = {
712
+ email: string | null;
713
+ kind: "member" | "guest";
714
+ name: string | null;
715
+ originApplicationId: string | null;
716
+ suspended: boolean;
717
+ userId: string;
718
+ };
719
+ export type AccessMemberPage = {
720
+ items: Array<AccessMember>;
721
+ next: string | null;
722
+ };
275
723
  export type ExternalApplicationsGetContextErrors = {
276
724
  /**
277
725
  * Error
@@ -353,134 +801,418 @@ export type ExternalApplicationsGetContextErrors = {
353
801
  retryable: false;
354
802
  };
355
803
  };
356
- /**
357
- * Error
358
- */
359
- 503: {
360
- correlationId: string;
361
- error: {
362
- code: "temporarily_unavailable";
363
- message: string;
364
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
365
- retryable: true;
366
- };
804
+ /**
805
+ * Error
806
+ */
807
+ 503: {
808
+ correlationId: string;
809
+ error: {
810
+ code: "temporarily_unavailable";
811
+ message: string;
812
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
813
+ retryable: true;
814
+ };
815
+ };
816
+ };
817
+ export type ExternalApplicationsGetContextError = ExternalApplicationsGetContextErrors[keyof ExternalApplicationsGetContextErrors];
818
+ export type ApplicationAccessMembersListData = {
819
+ body?: never;
820
+ headers: {
821
+ authorization?: string;
822
+ "x-organization-id": string;
823
+ };
824
+ path?: never;
825
+ query?: {
826
+ after?: string;
827
+ email?: string;
828
+ limit?: string;
829
+ };
830
+ url: "/application/v1/access/members";
831
+ };
832
+ export type ApplicationAccessMembersCreateData = {
833
+ body: AccessMemberCreateRequest;
834
+ headers: {
835
+ authorization?: string;
836
+ "x-organization-id": string;
837
+ };
838
+ path?: never;
839
+ query?: never;
840
+ url: "/application/v1/access/members";
841
+ };
842
+ export type ApplicationAccessMembersDeleteData = {
843
+ body?: never;
844
+ headers: {
845
+ authorization?: string;
846
+ "x-organization-id": string;
847
+ };
848
+ path: {
849
+ userId: string;
850
+ };
851
+ query?: never;
852
+ url: "/application/v1/access/members/{userId}";
853
+ };
854
+ export type ApplicationAccessMembersGetData = {
855
+ body?: never;
856
+ headers: {
857
+ authorization?: string;
858
+ "x-organization-id": string;
859
+ };
860
+ path: {
861
+ userId: string;
862
+ };
863
+ query?: never;
864
+ url: "/application/v1/access/members/{userId}";
865
+ };
866
+ export type ApplicationAccessMembersSuspendData = {
867
+ body?: never;
868
+ headers: {
869
+ authorization?: string;
870
+ "x-organization-id": string;
871
+ };
872
+ path: {
873
+ userId: string;
874
+ };
875
+ query?: never;
876
+ url: "/application/v1/access/members/{userId}/suspend";
877
+ };
878
+ export type ApplicationAccessMembersResumeData = {
879
+ body?: never;
880
+ headers: {
881
+ authorization?: string;
882
+ "x-organization-id": string;
883
+ };
884
+ path: {
885
+ userId: string;
886
+ };
887
+ query?: never;
888
+ url: "/application/v1/access/members/{userId}/resume";
889
+ };
890
+ export type ApplicationAccessMembersListInvitationsData = {
891
+ body?: never;
892
+ headers: {
893
+ authorization?: string;
894
+ "x-organization-id": string;
895
+ };
896
+ path?: never;
897
+ query?: {
898
+ limit?: string;
899
+ page?: string;
900
+ status?: "pending" | "accepted" | "revoked";
901
+ };
902
+ url: "/application/v1/access/invitations";
903
+ };
904
+ export type ApplicationAccessMembersRevokeInvitationData = {
905
+ body?: never;
906
+ headers: {
907
+ authorization?: string;
908
+ "x-organization-id": string;
909
+ };
910
+ path: {
911
+ invitationId: string;
912
+ };
913
+ query?: never;
914
+ url: "/application/v1/access/invitations/{invitationId}";
915
+ };
916
+ export type ApplicationAccessGrantsListData = {
917
+ body?: never;
918
+ headers: {
919
+ authorization?: string;
920
+ "x-organization-id": string;
921
+ };
922
+ path?: never;
923
+ query?: {
924
+ groupId?: string;
925
+ namespace?: string;
926
+ userId?: string;
927
+ };
928
+ url: "/application/v1/access/grants";
929
+ };
930
+ export type ApplicationAccessGrantsCreateData = {
931
+ body: AccessGrantCreateRequest;
932
+ headers: {
933
+ authorization?: string;
934
+ "x-organization-id": string;
935
+ };
936
+ path?: never;
937
+ query?: never;
938
+ url: "/application/v1/access/grants";
939
+ };
940
+ export type ApplicationAccessGrantsSyncData = {
941
+ body: AccessGrantSyncRequest;
942
+ headers: {
943
+ authorization?: string;
944
+ "x-organization-id": string;
945
+ };
946
+ path?: never;
947
+ query?: never;
948
+ url: "/application/v1/access/grants/sync";
949
+ };
950
+ export type ApplicationAccessGrantsDeleteData = {
951
+ body?: never;
952
+ headers: {
953
+ authorization?: string;
954
+ "x-organization-id": string;
955
+ };
956
+ path: {
957
+ grantId: string;
958
+ };
959
+ query?: never;
960
+ url: "/application/v1/access/grants/{grantId}";
961
+ };
962
+ export type ApplicationAccessGrantsGetData = {
963
+ body?: never;
964
+ headers: {
965
+ authorization?: string;
966
+ "x-organization-id": string;
967
+ };
968
+ path: {
969
+ grantId: string;
970
+ };
971
+ query?: never;
972
+ url: "/application/v1/access/grants/{grantId}";
973
+ };
974
+ export type ApplicationAccessGrantsUpdateData = {
975
+ body: AccessGrantUpdateRequest;
976
+ headers: {
977
+ authorization?: string;
978
+ "x-organization-id": string;
979
+ };
980
+ path: {
981
+ grantId: string;
982
+ };
983
+ query?: never;
984
+ url: "/application/v1/access/grants/{grantId}";
985
+ };
986
+ export type ApplicationAccessGrantsDeleteByFqnData = {
987
+ body?: never;
988
+ headers: {
989
+ authorization?: string;
990
+ "x-organization-id": string;
991
+ };
992
+ path: {
993
+ fqn: string;
994
+ };
995
+ query?: never;
996
+ url: "/application/v1/access/grants/fqn/{fqn}";
997
+ };
998
+ export type ApplicationAccessGrantsGetByFqnData = {
999
+ body?: never;
1000
+ headers: {
1001
+ authorization?: string;
1002
+ "x-organization-id": string;
1003
+ };
1004
+ path: {
1005
+ fqn: string;
1006
+ };
1007
+ query?: never;
1008
+ url: "/application/v1/access/grants/fqn/{fqn}";
1009
+ };
1010
+ export type ApplicationAccessGrantsUpdateByFqnData = {
1011
+ body: AccessGrantUpdateRequest;
1012
+ headers: {
1013
+ authorization?: string;
1014
+ "x-organization-id": string;
1015
+ };
1016
+ path: {
1017
+ fqn: string;
1018
+ };
1019
+ query?: never;
1020
+ url: "/application/v1/access/grants/fqn/{fqn}";
1021
+ };
1022
+ export type ApplicationAccessDefinitionsListProfilesData = {
1023
+ body?: never;
1024
+ headers: {
1025
+ authorization?: string;
1026
+ "x-organization-id": string;
1027
+ };
1028
+ path?: never;
1029
+ query?: never;
1030
+ url: "/application/v1/access/profiles";
1031
+ };
1032
+ export type ApplicationAccessDefinitionsGetProfileData = {
1033
+ body?: never;
1034
+ headers: {
1035
+ authorization?: string;
1036
+ "x-organization-id": string;
1037
+ };
1038
+ path: {
1039
+ profileId: string;
1040
+ };
1041
+ query?: never;
1042
+ url: "/application/v1/access/profiles/{profileId}";
1043
+ };
1044
+ export type ApplicationAccessDefinitionsListCapabilitiesData = {
1045
+ body?: never;
1046
+ headers: {
1047
+ authorization?: string;
1048
+ "x-organization-id": string;
1049
+ };
1050
+ path?: never;
1051
+ query?: never;
1052
+ url: "/application/v1/access/catalog";
1053
+ };
1054
+ export type ApplicationAccessDefinitionsListAxesData = {
1055
+ body?: never;
1056
+ headers: {
1057
+ authorization?: string;
1058
+ "x-organization-id": string;
1059
+ };
1060
+ path?: never;
1061
+ query?: never;
1062
+ url: "/application/v1/access/axes";
1063
+ };
1064
+ export type ApplicationAccessDefinitionsListMaxPrivilegesData = {
1065
+ body?: never;
1066
+ headers: {
1067
+ authorization?: string;
1068
+ "x-organization-id": string;
1069
+ };
1070
+ path?: never;
1071
+ query?: never;
1072
+ url: "/application/v1/access/max-privileges";
1073
+ };
1074
+ export type ApplicationAccessDefinitionsGetMaxPrivilegesData = {
1075
+ body?: never;
1076
+ headers: {
1077
+ authorization?: string;
1078
+ "x-organization-id": string;
1079
+ };
1080
+ path: {
1081
+ profileId: string;
1082
+ };
1083
+ query?: never;
1084
+ url: "/application/v1/access/max-privileges/{profileId}";
1085
+ };
1086
+ export type ApplicationAccessDefinitionsListKnowledgePoliciesData = {
1087
+ body?: never;
1088
+ headers: {
1089
+ authorization?: string;
1090
+ "x-organization-id": string;
367
1091
  };
1092
+ path?: never;
1093
+ query?: never;
1094
+ url: "/application/v1/access/knowledge-policies";
368
1095
  };
369
- export type ExternalApplicationsGetContextError = ExternalApplicationsGetContextErrors[keyof ExternalApplicationsGetContextErrors];
370
- export type ExternalApplicationsListAppUsersResponses = {
371
- /**
372
- * Success
373
- */
374
- 200: {
375
- correlationId: string;
376
- result: {
377
- items: Array<{
378
- email: string | null;
379
- name: string | null;
380
- userId: string;
381
- }>;
382
- };
1096
+ export type ApplicationAccessDefinitionsGetSchemaKnowledgePoliciesData = {
1097
+ body?: never;
1098
+ headers: {
1099
+ authorization?: string;
1100
+ "x-organization-id": string;
1101
+ };
1102
+ path: {
1103
+ schemaFqn: string;
383
1104
  };
1105
+ query?: never;
1106
+ url: "/application/v1/access/knowledge-policies/schemas/{schemaFqn}";
384
1107
  };
385
- export type ExternalApplicationsListAppUsersResponse = ExternalApplicationsListAppUsersResponses[keyof ExternalApplicationsListAppUsersResponses];
386
- export type ExternalApplicationsCreateOrGetAppUserData = {
387
- body: {
388
- email: string;
389
- name: string;
390
- roles: Array<string>;
1108
+ export type ApplicationAccessGroupsListData = {
1109
+ body?: never;
1110
+ headers: {
1111
+ authorization?: string;
1112
+ "x-organization-id": string;
1113
+ };
1114
+ path?: never;
1115
+ query?: {
1116
+ limit?: string;
1117
+ page?: string;
391
1118
  };
1119
+ url: "/application/v1/access/groups";
1120
+ };
1121
+ export type ApplicationAccessGroupsCreateData = {
1122
+ body: AccessGroupCreateRequest;
392
1123
  headers: {
393
1124
  authorization?: string;
394
1125
  "x-organization-id": string;
395
- "x-correlation-id"?: string;
396
- "x-external-audit-issuer"?: string;
397
- "x-external-audit-subject"?: string;
398
- "x-external-caller-kind"?: "anonymous_visitor";
399
- "x-external-ci-user-id"?: string;
400
- "x-external-server-role"?: string;
401
1126
  };
402
1127
  path?: never;
403
1128
  query?: never;
404
- url: "/application/v1/users";
1129
+ url: "/application/v1/access/groups";
405
1130
  };
406
- export type ExternalApplicationsCreateOrGetAppUserResponses = {
407
- /**
408
- * Success
409
- */
410
- 200: {
411
- correlationId: string;
412
- result: {
413
- email: string | null;
414
- name: string | null;
415
- userId: string;
416
- created: boolean;
417
- kind: "member" | "external_app_user";
418
- };
1131
+ export type ApplicationAccessGroupsDeleteData = {
1132
+ body?: never;
1133
+ headers: {
1134
+ authorization?: string;
1135
+ "x-organization-id": string;
1136
+ };
1137
+ path: {
1138
+ groupId: string;
1139
+ };
1140
+ query?: never;
1141
+ url: "/application/v1/access/groups/{groupId}";
1142
+ };
1143
+ export type ApplicationAccessGroupsGetData = {
1144
+ body?: never;
1145
+ headers: {
1146
+ authorization?: string;
1147
+ "x-organization-id": string;
1148
+ };
1149
+ path: {
1150
+ groupId: string;
1151
+ };
1152
+ query?: never;
1153
+ url: "/application/v1/access/groups/{groupId}";
1154
+ };
1155
+ export type ApplicationAccessGroupsUpdateData = {
1156
+ body: AccessGroupUpdateRequest;
1157
+ headers: {
1158
+ authorization?: string;
1159
+ "x-organization-id": string;
1160
+ };
1161
+ path: {
1162
+ groupId: string;
419
1163
  };
1164
+ query?: never;
1165
+ url: "/application/v1/access/groups/{groupId}";
420
1166
  };
421
- export type ExternalApplicationsCreateOrGetAppUserResponse = ExternalApplicationsCreateOrGetAppUserResponses[keyof ExternalApplicationsCreateOrGetAppUserResponses];
422
- export type ExternalApplicationsCheckAppUserEmailData = {
1167
+ export type ApplicationAccessGroupsAddMemberData = {
423
1168
  body: {
424
- email: string;
1169
+ userId: string;
425
1170
  };
426
1171
  headers: {
427
1172
  authorization?: string;
428
1173
  "x-organization-id": string;
429
- "x-correlation-id"?: string;
430
- "x-external-audit-issuer"?: string;
431
- "x-external-audit-subject"?: string;
432
- "x-external-caller-kind"?: "anonymous_visitor";
433
- "x-external-ci-user-id"?: string;
434
- "x-external-server-role"?: string;
435
1174
  };
436
- path?: never;
1175
+ path: {
1176
+ groupId: string;
1177
+ };
437
1178
  query?: never;
438
- url: "/application/v1/users/check-email";
1179
+ url: "/application/v1/access/groups/{groupId}/members";
439
1180
  };
440
- export type ExternalApplicationsCheckAppUserEmailResponses = {
441
- /**
442
- * Success
443
- */
444
- 200: {
445
- correlationId: string;
446
- result: {
447
- usable: true;
448
- } | {
449
- reason: "user_unavailable" | "target_inactive";
450
- usable: false;
451
- };
1181
+ export type ApplicationAccessGroupsRemoveMemberData = {
1182
+ body?: never;
1183
+ headers: {
1184
+ authorization?: string;
1185
+ "x-organization-id": string;
1186
+ };
1187
+ path: {
1188
+ groupId: string;
1189
+ userId: string;
452
1190
  };
1191
+ query?: never;
1192
+ url: "/application/v1/access/groups/{groupId}/members/{userId}";
453
1193
  };
454
- export type ExternalApplicationsCheckAppUserEmailResponse = ExternalApplicationsCheckAppUserEmailResponses[keyof ExternalApplicationsCheckAppUserEmailResponses];
455
- export type ExternalApplicationsGetAppUserResponses = {
456
- /**
457
- * Success
458
- */
459
- 200: {
460
- correlationId: string;
461
- result: {
462
- email: string | null;
463
- name: string | null;
464
- userId: string;
465
- };
1194
+ export type ApplicationAccessPrincipalsSnapshotData = {
1195
+ body?: never;
1196
+ headers: {
1197
+ authorization?: string;
1198
+ "x-organization-id": string;
466
1199
  };
1200
+ path: {
1201
+ userId: string;
1202
+ };
1203
+ query?: never;
1204
+ url: "/application/v1/access/users/{userId}/snapshot";
467
1205
  };
468
- export type ExternalApplicationsGetAppUserResponse = ExternalApplicationsGetAppUserResponses[keyof ExternalApplicationsGetAppUserResponses];
469
- export type ExternalApplicationsListAppRolesResponses = {
470
- /**
471
- * Success
472
- */
473
- 200: {
474
- correlationId: string;
475
- result: {
476
- items: Array<{
477
- id: string;
478
- key: string;
479
- }>;
480
- };
1206
+ export type ApplicationAccessPrincipalsExplainData = {
1207
+ body: AccessExplainRequest;
1208
+ headers: {
1209
+ authorization?: string;
1210
+ "x-organization-id": string;
481
1211
  };
1212
+ path?: never;
1213
+ query?: never;
1214
+ url: "/application/v1/access/explain";
482
1215
  };
483
- export type ExternalApplicationsListAppRolesResponse = ExternalApplicationsListAppRolesResponses[keyof ExternalApplicationsListAppRolesResponses];
484
1216
  export type JsonValue = boolean | null | number | readonly JsonValue[] | Readonly<{
485
1217
  readonly [key: string]: JsonValue;
486
1218
  }> | string;
@@ -558,40 +1290,6 @@ export type KnowledgeQuery = {
558
1290
  op: "autocomplete";
559
1291
  });
560
1292
  export type ExternalApplicationOperationRequest = {
561
- input: {
562
- userId: string;
563
- };
564
- operationId: "users_get";
565
- } | {
566
- input: {
567
- page?: number;
568
- pageSize?: number;
569
- };
570
- operationId: "users_list";
571
- } | {
572
- input: {
573
- userId: string;
574
- };
575
- operationId: "users_deactivate";
576
- } | {
577
- input: Record<string, never>;
578
- operationId: "roles_list";
579
- } | {
580
- input: {
581
- userId: string;
582
- roles: string[];
583
- };
584
- operationId: "roles_assign";
585
- } | {
586
- input: {
587
- userId: string;
588
- roles: string[];
589
- };
590
- operationId: "roles_revoke";
591
- } | {
592
- input: ExternalApplicationsCreateOrGetAppUserData["body"];
593
- operationId: "users_create_or_get";
594
- } | {
595
1293
  input: JsonObject | unknown[];
596
1294
  operationId: "context_get";
597
1295
  } | {
@@ -756,15 +1454,7 @@ export interface EnvelopeSuccess<Id extends string, Result> {
756
1454
  operationId: Id;
757
1455
  result: Result;
758
1456
  }
759
- export type ExternalApplicationOperationSuccess = EnvelopeSuccess<"users_get", ApplicationUser> | EnvelopeSuccess<"users_list", ApplicationUserPage> | EnvelopeSuccess<"users_deactivate", {
760
- userId: string;
761
- }> | EnvelopeSuccess<"roles_list", {
762
- items: ApplicationRole[];
763
- }> | EnvelopeSuccess<"roles_assign", {
764
- userId: string;
765
- }> | EnvelopeSuccess<"roles_revoke", {
766
- userId: string;
767
- }> | EnvelopeSuccess<"users_create_or_get", ApplicationUserResolution> | EnvelopeSuccess<"context_get", JsonObject> | EnvelopeSuccess<"knowledge_query", JsonObject> | EnvelopeSuccess<"knowledge_get_entity_schema_snapshot", JsonObject> | EnvelopeSuccess<"knowledge_search_entities", JsonObject> | EnvelopeSuccess<"knowledge_facets", JsonObject> | EnvelopeSuccess<"knowledge_get_schema_query_context", JsonObject> | EnvelopeSuccess<"knowledge_autocomplete", JsonObject> | EnvelopeSuccess<"knowledge_get_entity", JsonObject> | EnvelopeSuccess<"knowledge_create_entity", JsonObject> | EnvelopeSuccess<"knowledge_update_entity", JsonObject> | EnvelopeSuccess<"knowledge_upsert_entity", JsonObject> | EnvelopeSuccess<"knowledge_delete_entity", JsonObject> | EnvelopeSuccess<"agents_list", JsonObject> | EnvelopeSuccess<"agents_invoke", {
1457
+ export type ExternalApplicationOperationSuccess = EnvelopeSuccess<"context_get", JsonObject> | EnvelopeSuccess<"knowledge_query", JsonObject> | EnvelopeSuccess<"knowledge_get_entity_schema_snapshot", JsonObject> | EnvelopeSuccess<"knowledge_search_entities", JsonObject> | EnvelopeSuccess<"knowledge_facets", JsonObject> | EnvelopeSuccess<"knowledge_get_schema_query_context", JsonObject> | EnvelopeSuccess<"knowledge_autocomplete", JsonObject> | EnvelopeSuccess<"knowledge_get_entity", JsonObject> | EnvelopeSuccess<"knowledge_create_entity", JsonObject> | EnvelopeSuccess<"knowledge_update_entity", JsonObject> | EnvelopeSuccess<"knowledge_upsert_entity", JsonObject> | EnvelopeSuccess<"knowledge_delete_entity", JsonObject> | EnvelopeSuccess<"agents_list", JsonObject> | EnvelopeSuccess<"agents_invoke", {
768
1458
  runId: string;
769
1459
  }> | EnvelopeSuccess<"skills_list", JsonObject> | EnvelopeSuccess<"skills_invoke", {
770
1460
  runId: string;
@@ -782,11 +1472,6 @@ export type ExternalApplicationOperationSuccess = EnvelopeSuccess<"users_get", A
782
1472
  conversationId: string;
783
1473
  runId: string;
784
1474
  }> | EnvelopeSuccess<"conversations_history", ConversationHistory>;
785
- /** User details returned by the application's user-management gateway. */
786
- export type ApplicationUser = ExternalApplicationsGetAppUserResponse["result"];
787
- export type ApplicationUserResolution = ExternalApplicationsCreateOrGetAppUserResponse["result"];
788
- export type ApplicationUserPage = ExternalApplicationsListAppUsersResponse["result"];
789
- export type ApplicationRole = ExternalApplicationsListAppRolesResponse["result"]["items"][number];
790
1475
  declare const storageFileIdBrand: unique symbol;
791
1476
  /** A durable private file of the application's Organization. */
792
1477
  export type StorageFileId = string & Readonly<{
@@ -802,19 +1487,11 @@ export interface DurableFileUpload {
802
1487
  fileName: string;
803
1488
  sizeBytes: number;
804
1489
  }
805
- export type ExternalApplicationServiceOperationRequest = {
806
- input: ExternalApplicationsCheckAppUserEmailData["body"];
807
- operationId: "users_check_email";
808
- } | {
1490
+ export interface ExternalApplicationServiceOperationRequest {
809
1491
  input: DurableFileUpload;
810
1492
  operationId: "files_upload";
811
- };
812
- /**
813
- * Whether `users_create_or_get` would accept an email, checked without
814
- * creating anything; an unknown email is usable.
815
- */
816
- export type ApplicationUserEmailCheck = ExternalApplicationsCheckAppUserEmailResponse["result"];
817
- export type ExternalApplicationServiceOperationSuccess = EnvelopeSuccess<"users_check_email", ApplicationUserEmailCheck> | EnvelopeSuccess<"files_upload", {
1493
+ }
1494
+ export type ExternalApplicationServiceOperationSuccess = EnvelopeSuccess<"files_upload", {
818
1495
  storageFileId: StorageFileId;
819
1496
  }>;
820
1497
  /** Every operation a confidential server client may invoke. */
@@ -952,6 +1629,385 @@ export type CacheInvalidationValue = Readonly<{
952
1629
  */
953
1630
  invalidate: (tags: readonly CiTag[]) => Effect.Effect<void>;
954
1631
  }>;
1632
+ export type AuthToken = string | undefined;
1633
+ export interface Auth {
1634
+ /**
1635
+ * Which part of the request do we use to send the auth?
1636
+ *
1637
+ * @default 'header'
1638
+ */
1639
+ in?: "header" | "query" | "cookie";
1640
+ /**
1641
+ * Header or query parameter name.
1642
+ *
1643
+ * @default 'Authorization'
1644
+ */
1645
+ name?: string;
1646
+ scheme?: "basic" | "bearer";
1647
+ type: "apiKey" | "http";
1648
+ }
1649
+ export interface SerializerOptions<T> {
1650
+ /**
1651
+ * @default true
1652
+ */
1653
+ explode: boolean;
1654
+ style: T;
1655
+ }
1656
+ export type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited";
1657
+ export type ObjectStyle = "form" | "deepObject";
1658
+ export type QuerySerializer = (query: Record<string, unknown>) => string;
1659
+ export type BodySerializer = (body: unknown) => unknown;
1660
+ export type QuerySerializerOptionsObject = {
1661
+ allowReserved?: boolean;
1662
+ array?: Partial<SerializerOptions<ArrayStyle>>;
1663
+ object?: Partial<SerializerOptions<ObjectStyle>>;
1664
+ };
1665
+ export type QuerySerializerOptions = QuerySerializerOptionsObject & {
1666
+ /**
1667
+ * Per-parameter serialization overrides. When provided, these settings
1668
+ * override the global array/object settings for specific parameter names.
1669
+ */
1670
+ parameters?: Record<string, QuerySerializerOptionsObject>;
1671
+ };
1672
+ export type HttpMethod = "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
1673
+ export type Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
1674
+ /**
1675
+ * Returns the final request URL.
1676
+ */
1677
+ buildUrl: BuildUrlFn;
1678
+ getConfig: () => Config;
1679
+ request: RequestFn;
1680
+ setConfig: (config: Config) => Config;
1681
+ } & {
1682
+ [K in HttpMethod]: MethodFn;
1683
+ } & ([
1684
+ SseFn
1685
+ ] extends [
1686
+ never
1687
+ ] ? {
1688
+ sse?: never;
1689
+ } : {
1690
+ sse: {
1691
+ [K in HttpMethod]: SseFn;
1692
+ };
1693
+ });
1694
+ export interface Config {
1695
+ /**
1696
+ * Auth token or a function returning auth token. The resolved value will be
1697
+ * added to the request payload as defined by its `security` array.
1698
+ */
1699
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
1700
+ /**
1701
+ * A function for serializing request body parameter. By default,
1702
+ * {@link JSON.stringify()} will be used.
1703
+ */
1704
+ bodySerializer?: BodySerializer | null;
1705
+ /**
1706
+ * An object containing any HTTP headers that you want to pre-populate your
1707
+ * `Headers` object with.
1708
+ *
1709
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
1710
+ */
1711
+ headers?: RequestInit["headers"] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
1712
+ /**
1713
+ * The request method.
1714
+ *
1715
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
1716
+ */
1717
+ method?: Uppercase<HttpMethod>;
1718
+ /**
1719
+ * A function for serializing request query parameters. By default, arrays
1720
+ * will be exploded in form style, objects will be exploded in deepObject
1721
+ * style, and reserved characters are percent-encoded.
1722
+ *
1723
+ * This method will have no effect if the native `paramsSerializer()` Axios
1724
+ * API function is used.
1725
+ *
1726
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
1727
+ */
1728
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
1729
+ /**
1730
+ * A function validating request data. This is useful if you want to ensure
1731
+ * the request conforms to the desired shape, so it can be safely sent to
1732
+ * the server.
1733
+ */
1734
+ requestValidator?: (data: unknown) => Promise<unknown>;
1735
+ /**
1736
+ * A function transforming response data before it's returned. This is useful
1737
+ * for post-processing data, e.g., converting ISO strings into Date objects.
1738
+ */
1739
+ responseTransformer?: (data: unknown) => Promise<unknown>;
1740
+ /**
1741
+ * A function validating response data. This is useful if you want to ensure
1742
+ * the response conforms to the desired shape, so it can be safely passed to
1743
+ * the transformers and returned to the user.
1744
+ */
1745
+ responseValidator?: (data: unknown) => Promise<unknown>;
1746
+ }
1747
+ export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, "body" | "method"> & Pick<Config, "method" | "responseTransformer" | "responseValidator"> & {
1748
+ /**
1749
+ * Fetch API implementation. You can use this option to provide a custom
1750
+ * fetch instance.
1751
+ *
1752
+ * @default globalThis.fetch
1753
+ */
1754
+ body?: RequestInit["body"] | undefined;
1755
+ fetch?: typeof fetch;
1756
+ /**
1757
+ * Implementing clients can call request interceptors inside this hook.
1758
+ */
1759
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
1760
+ /**
1761
+ * Callback invoked when a network or parsing error occurs during streaming.
1762
+ *
1763
+ * This option applies only if the endpoint returns a stream of events.
1764
+ *
1765
+ * @param error The error that occurred.
1766
+ */
1767
+ onSseError?: (error: unknown) => void;
1768
+ /**
1769
+ * Callback invoked when an event is streamed from the server.
1770
+ *
1771
+ * This option applies only if the endpoint returns a stream of events.
1772
+ *
1773
+ * @param event Event streamed from the server.
1774
+ * @returns Nothing (void).
1775
+ */
1776
+ onSseEvent?: (event: StreamEvent<TData>) => void;
1777
+ serializedBody?: RequestInit["body"] | undefined;
1778
+ /**
1779
+ * Default retry delay in milliseconds.
1780
+ *
1781
+ * This option applies only if the endpoint returns a stream of events.
1782
+ *
1783
+ * @default 3000
1784
+ */
1785
+ sseDefaultRetryDelay?: number;
1786
+ /**
1787
+ * Maximum number of retry attempts before giving up.
1788
+ */
1789
+ sseMaxRetryAttempts?: number;
1790
+ /**
1791
+ * Maximum retry delay in milliseconds.
1792
+ *
1793
+ * Applies only when exponential backoff is used.
1794
+ *
1795
+ * This option applies only if the endpoint returns a stream of events.
1796
+ *
1797
+ * @default 30000
1798
+ */
1799
+ sseMaxRetryDelay?: number;
1800
+ /**
1801
+ * Optional sleep function for retry backoff.
1802
+ *
1803
+ * Defaults to using `setTimeout`.
1804
+ */
1805
+ sseSleepFn?: (ms: number) => Promise<void>;
1806
+ url: string;
1807
+ };
1808
+ export interface StreamEvent<TData = unknown> {
1809
+ data: TData;
1810
+ event?: string | undefined;
1811
+ id?: string | undefined;
1812
+ retry?: number;
1813
+ }
1814
+ export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
1815
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
1816
+ };
1817
+ export type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
1818
+ export type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
1819
+ export type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
1820
+ declare class Interceptors<Interceptor> {
1821
+ fns: Array<Interceptor | null>;
1822
+ clear(): void;
1823
+ eject(id: number | Interceptor): void;
1824
+ exists(id: number | Interceptor): boolean;
1825
+ getInterceptorIndex(id: number | Interceptor): number;
1826
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
1827
+ use(fn: Interceptor): number;
1828
+ }
1829
+ export interface Middleware<Req, Res, Err, Options> {
1830
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
1831
+ request: Interceptors<ReqInterceptor<Req, Options>>;
1832
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
1833
+ }
1834
+ export type ResponseStyle = "data" | "fields";
1835
+ interface Config$1<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, "body" | "headers" | "method">, Config {
1836
+ /**
1837
+ * Base URL for all requests made by this client.
1838
+ */
1839
+ baseUrl?: T["baseUrl"];
1840
+ /**
1841
+ * Fetch API implementation. You can use this option to provide a custom
1842
+ * fetch instance.
1843
+ *
1844
+ * @default globalThis.fetch
1845
+ */
1846
+ fetch?: typeof fetch;
1847
+ /**
1848
+ * Please don't use the Fetch client for Next.js applications. The `next`
1849
+ * options won't have any effect.
1850
+ *
1851
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
1852
+ */
1853
+ next?: never;
1854
+ /**
1855
+ * Return the response data parsed in a specified format. By default, `auto`
1856
+ * will infer the appropriate method from the `Content-Type` response header.
1857
+ * You can override this behavior with any of the {@link Body} methods.
1858
+ * Select `stream` if you don't want to parse response data at all.
1859
+ *
1860
+ * @default 'auto'
1861
+ */
1862
+ parseAs?: "arrayBuffer" | "auto" | "blob" | "formData" | "json" | "stream" | "text";
1863
+ /**
1864
+ * Should we return only data or multiple fields (data, error, response, etc.)?
1865
+ *
1866
+ * @default 'fields'
1867
+ */
1868
+ responseStyle?: ResponseStyle;
1869
+ /**
1870
+ * Throw an error instead of returning it in the response?
1871
+ *
1872
+ * @default false
1873
+ */
1874
+ throwOnError?: T["throwOnError"];
1875
+ }
1876
+ export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string> extends Config$1<{
1877
+ responseStyle: TResponseStyle;
1878
+ throwOnError: ThrowOnError;
1879
+ }>, Pick<ServerSentEventsOptions<TData>, "onRequest" | "onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay"> {
1880
+ /**
1881
+ * Any body that you want to add to your request.
1882
+ *
1883
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
1884
+ */
1885
+ body?: unknown;
1886
+ path?: Record<string, unknown>;
1887
+ query?: Record<string, unknown>;
1888
+ /**
1889
+ * Security mechanism(s) to use for the request.
1890
+ */
1891
+ security?: ReadonlyArray<Auth>;
1892
+ url: Url;
1893
+ }
1894
+ export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
1895
+ headers: Headers;
1896
+ serializedBody?: string | undefined;
1897
+ }
1898
+ export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = "fields"> = ThrowOnError extends true ? Promise<TResponseStyle extends "data" ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
1899
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
1900
+ request: Request;
1901
+ response: Response;
1902
+ }> : Promise<TResponseStyle extends "data" ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
1903
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
1904
+ error: undefined;
1905
+ } | {
1906
+ data: undefined;
1907
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
1908
+ }) & {
1909
+ request: Request;
1910
+ response: Response;
1911
+ }>;
1912
+ export interface ClientOptions {
1913
+ baseUrl?: string;
1914
+ responseStyle?: ResponseStyle;
1915
+ throwOnError?: boolean;
1916
+ }
1917
+ export type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
1918
+ export type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, "method">) => Promise<ServerSentEventsResult<TData, TError>>;
1919
+ export type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method"> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
1920
+ export type BuildUrlFn = <TData extends {
1921
+ body?: unknown;
1922
+ path?: Record<string, unknown>;
1923
+ query?: Record<string, unknown>;
1924
+ url: string;
1925
+ }>(options: TData & Options<TData>) => string;
1926
+ type Client$1 = Client<RequestFn, Config$1, MethodFn, BuildUrlFn, SseFn> & {
1927
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
1928
+ };
1929
+ export interface TEndpointData {
1930
+ body?: unknown;
1931
+ headers?: unknown;
1932
+ path?: unknown;
1933
+ query?: unknown;
1934
+ url: string;
1935
+ }
1936
+ export type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
1937
+ export type Options<TData extends TEndpointData = TEndpointData, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = "fields"> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, "body" | "path" | "query" | "url"> & ([
1938
+ TData
1939
+ ] extends [
1940
+ never
1941
+ ] ? unknown : Omit<TData, "url">);
1942
+ type Options$1<TData extends TEndpointData = TEndpointData, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options<TData, ThrowOnError, TResponse> & {
1943
+ /**
1944
+ * You can provide a client instance returned by `createClient()` instead of
1945
+ * individual options. This might be also useful if you want to implement a
1946
+ * custom client.
1947
+ */
1948
+ client?: Client$1;
1949
+ /**
1950
+ * You can pass arbitrary values through the `meta` object. This can be
1951
+ * used to access values that aren't defined as part of the SDK function.
1952
+ */
1953
+ meta?: Record<string, unknown>;
1954
+ };
1955
+ export type EndpointOptions<OptionsType> = Pick<OptionsType, Extract<keyof OptionsType, "body" | "headers" | "path" | "query">>;
1956
+ declare const createApplicationAccessApi: (client: Client$1) => {
1957
+ axes: {
1958
+ list: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsListAxesData, false, unknown>>) => Promise<AccessGrantAxis[]>;
1959
+ };
1960
+ catalog: {
1961
+ list: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsListCapabilitiesData, false, unknown>>) => Promise<AccessCapabilityNode[]>;
1962
+ };
1963
+ explain: (options: EndpointOptions<Options$1<ApplicationAccessPrincipalsExplainData, false, unknown>>) => Promise<AccessExplanation>;
1964
+ grants: {
1965
+ create: (options: EndpointOptions<Options$1<ApplicationAccessGrantsCreateData, false, unknown>>) => Promise<AccessGrant>;
1966
+ delete: (options: EndpointOptions<Options$1<ApplicationAccessGrantsDeleteData, false, unknown>>) => Promise<void>;
1967
+ deleteByFqn: (options: EndpointOptions<Options$1<ApplicationAccessGrantsDeleteByFqnData, false, unknown>>) => Promise<void>;
1968
+ get: (options: EndpointOptions<Options$1<ApplicationAccessGrantsGetData, false, unknown>>) => Promise<AccessGrant>;
1969
+ getByFqn: (options: EndpointOptions<Options$1<ApplicationAccessGrantsGetByFqnData, false, unknown>>) => Promise<AccessGrant>;
1970
+ list: (options: EndpointOptions<Options$1<ApplicationAccessGrantsListData, false, unknown>>) => Promise<AccessGrantList>;
1971
+ sync: (options: EndpointOptions<Options$1<ApplicationAccessGrantsSyncData, false, unknown>>) => Promise<AccessGrantSyncResult>;
1972
+ update: (options: EndpointOptions<Options$1<ApplicationAccessGrantsUpdateData, false, unknown>>) => Promise<AccessGrant>;
1973
+ updateByFqn: (options: EndpointOptions<Options$1<ApplicationAccessGrantsUpdateByFqnData, false, unknown>>) => Promise<AccessGrant>;
1974
+ };
1975
+ groups: {
1976
+ addMember: (options: EndpointOptions<Options$1<ApplicationAccessGroupsAddMemberData, false, unknown>>) => Promise<void>;
1977
+ create: (options: EndpointOptions<Options$1<ApplicationAccessGroupsCreateData, false, unknown>>) => Promise<AccessGroup>;
1978
+ delete: (options: EndpointOptions<Options$1<ApplicationAccessGroupsDeleteData, false, unknown>>) => Promise<void>;
1979
+ get: (options: EndpointOptions<Options$1<ApplicationAccessGroupsGetData, false, unknown>>) => Promise<AccessGroup>;
1980
+ list: (options: EndpointOptions<Options$1<ApplicationAccessGroupsListData, false, unknown>>) => Promise<AccessGroupPage>;
1981
+ removeMember: (options: EndpointOptions<Options$1<ApplicationAccessGroupsRemoveMemberData, false, unknown>>) => Promise<void>;
1982
+ update: (options: EndpointOptions<Options$1<ApplicationAccessGroupsUpdateData, false, unknown>>) => Promise<AccessGroup>;
1983
+ };
1984
+ invitations: {
1985
+ list: (options: EndpointOptions<Options$1<ApplicationAccessMembersListInvitationsData, false, unknown>>) => Promise<AccessInvitationPage>;
1986
+ revoke: (options: EndpointOptions<Options$1<ApplicationAccessMembersRevokeInvitationData, false, unknown>>) => Promise<void>;
1987
+ };
1988
+ knowledgePolicies: {
1989
+ forSchema: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsGetSchemaKnowledgePoliciesData, false, unknown>>) => Promise<AccessSchemaKnowledgePolicies>;
1990
+ list: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsListKnowledgePoliciesData, false, unknown>>) => Promise<AccessKnowledgeDataPolicy[]>;
1991
+ };
1992
+ maxPrivileges: {
1993
+ get: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsGetMaxPrivilegesData, false, unknown>>) => Promise<AccessProfile>;
1994
+ list: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsListMaxPrivilegesData, false, unknown>>) => Promise<AccessProfile[]>;
1995
+ };
1996
+ members: {
1997
+ create: (options: EndpointOptions<Options$1<ApplicationAccessMembersCreateData, false, unknown>>) => Promise<AccessMemberCreated>;
1998
+ get: (options: EndpointOptions<Options$1<ApplicationAccessMembersGetData, false, unknown>>) => Promise<AccessMember>;
1999
+ list: (options: EndpointOptions<Options$1<ApplicationAccessMembersListData, false, unknown>>) => Promise<AccessMemberPage>;
2000
+ remove: (options: EndpointOptions<Options$1<ApplicationAccessMembersDeleteData, false, unknown>>) => Promise<void>;
2001
+ resume: (options: EndpointOptions<Options$1<ApplicationAccessMembersResumeData, false, unknown>>) => Promise<void>;
2002
+ suspend: (options: EndpointOptions<Options$1<ApplicationAccessMembersSuspendData, false, unknown>>) => Promise<void>;
2003
+ };
2004
+ profiles: {
2005
+ get: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsGetProfileData, false, unknown>>) => Promise<AccessProfile>;
2006
+ list: (options: EndpointOptions<Options$1<ApplicationAccessDefinitionsListProfilesData, false, unknown>>) => Promise<AccessProfile[]>;
2007
+ };
2008
+ snapshot: (options: EndpointOptions<Options$1<ApplicationAccessPrincipalsSnapshotData, false, unknown>>) => Promise<AccessSnapshot>;
2009
+ };
2010
+ export type ApplicationAccessApi = ReturnType<typeof createApplicationAccessApi>;
955
2011
  declare const GatewayEffectRuntimeError_base: Schema.Class<GatewayEffectRuntimeError, Schema.TaggedStruct<"GatewayEffectRuntimeError", {
956
2012
  readonly cause: Schema.Defect;
957
2013
  }>, import("effect/Cause").YieldableError>;
@@ -964,11 +2020,21 @@ declare class GatewayEffectRuntimeError extends GatewayEffectRuntimeError_base {
964
2020
  }>, options: Schema.MakeOptions | undefined);
965
2021
  get message(): string;
966
2022
  }
2023
+ declare const ServerAccessError_base: Schema.Class<ServerAccessError, Schema.TaggedStruct<"ServerAccessError", {
2024
+ readonly body: Schema.StructWithRest<Schema.Struct<{
2025
+ readonly _tag: Schema.String;
2026
+ }>, readonly [
2027
+ Schema.$Record<Schema.String, Schema.Unknown>
2028
+ ]>;
2029
+ readonly status: Schema.Int;
2030
+ }>, import("effect/Cause").YieldableError>;
2031
+ declare class ServerAccessError extends ServerAccessError_base {
2032
+ get message(): string;
2033
+ }
967
2034
  declare const oauthErrorCodes: readonly [
968
2035
  "invalid_client",
969
2036
  "invalid_grant",
970
2037
  "invalid_request",
971
- "invalid_scope",
972
2038
  "invalid_target",
973
2039
  "temporarily_unavailable",
974
2040
  "unauthorized_client",
@@ -987,7 +2053,6 @@ declare const MemberSessionExchangeError_base: Schema.Class<MemberSessionExchang
987
2053
  "invalid_client",
988
2054
  "invalid_grant",
989
2055
  "invalid_request",
990
- "invalid_scope",
991
2056
  "invalid_target",
992
2057
  "temporarily_unavailable",
993
2058
  "unauthorized_client",
@@ -1008,6 +2073,131 @@ declare class MemberSessionExchangeError extends MemberSessionExchangeError_base
1008
2073
  }>, options: Schema.MakeOptions | undefined);
1009
2074
  get message(): string;
1010
2075
  }
2076
+ /** The Organization a `ci.access` call acts in. */
2077
+ export type ServerAccessContext = Readonly<{
2078
+ organizationId: string;
2079
+ }>;
2080
+ export type OptionsOf<F> = F extends (options: infer Options) => PromiseLike<infer _> ? Options : never;
2081
+ export type BodyOf<F> = OptionsOf<F> extends {
2082
+ body: infer B;
2083
+ } ? B : never;
2084
+ export type PathOf<F> = OptionsOf<F> extends {
2085
+ path: infer P;
2086
+ } ? P : never;
2087
+ export type QueryOf<F> = OptionsOf<F> extends {
2088
+ query?: infer Q;
2089
+ } ? NonNullable<Q> : never;
2090
+ export type ResultOf<F> = F extends (options: never) => PromiseLike<infer Result> ? Result : never;
2091
+ export type Api = ApplicationAccessApi;
2092
+ export type WithBody<F> = ServerAccessContext & BodyOf<F>;
2093
+ export type WithPath<F> = ServerAccessContext & PathOf<F>;
2094
+ /** How a `ci.access` call fails. */
2095
+ export type ServerAccessFailure = CiTransportError | ServerAccessError;
2096
+ export type Call<Request, Result> = (request: Request) => Effect.Effect<Result, ServerAccessFailure>;
2097
+ export type Method<Request, F> = Call<Request, ResultOf<F>>;
2098
+ /** A grant named by its id or by its Access Grant FQN. */
2099
+ export type GrantReference = PathOf<Api["grants"]["get"]> | PathOf<Api["grants"]["getByFqn"]>;
2100
+ export type ServerAccessMember = ResultOf<Api["members"]["get"]>;
2101
+ export type ServerAccessGrant = ResultOf<Api["grants"]["get"]>;
2102
+ /** The `access` service of a `ServerClient`. */
2103
+ export interface ServerAccessService {
2104
+ /** The Grant Axes and the slugs that key Axis Values. Needs `admin.profiles` at read. */
2105
+ readonly axes: Readonly<{
2106
+ list: Method<ServerAccessContext, Api["axes"]["list"]>;
2107
+ }>;
2108
+ /** The Capability Catalog of the Organization. Needs `admin.profiles` at read. */
2109
+ readonly catalog: Readonly<{
2110
+ list: Method<ServerAccessContext, Api["catalog"]["list"]>;
2111
+ }>;
2112
+ /**
2113
+ * Why a principal may use a capability or act on a Knowledge record: its
2114
+ * grants with their path and the matching policies. Needs `admin.grants`
2115
+ * at read.
2116
+ */
2117
+ readonly explain: Method<WithBody<Api["explain"]>, Api["explain"]>;
2118
+ /**
2119
+ * Access Grants by id or Access Grant FQN. Writes need `admin.grants` at
2120
+ * manage and pass Grant Authority; `sync` makes the runtime grants below
2121
+ * a namespace exactly the list. Reads need `admin.grants` at read.
2122
+ */
2123
+ readonly grants: Readonly<{
2124
+ create: Method<WithBody<Api["grants"]["create"]>, Api["grants"]["create"]>;
2125
+ delete: Call<ServerAccessContext & GrantReference, void>;
2126
+ get: Call<ServerAccessContext & GrantReference, ServerAccessGrant>;
2127
+ /** The grants of a user or Group, or below a namespace; at least one of them. */
2128
+ list: Method<ServerAccessContext & QueryOf<Api["grants"]["list"]>, Api["grants"]["list"]>;
2129
+ sync: Method<WithBody<Api["grants"]["sync"]>, Api["grants"]["sync"]>;
2130
+ update: Call<ServerAccessContext & GrantReference & BodyOf<Api["grants"]["update"]>, ServerAccessGrant>;
2131
+ }>;
2132
+ /**
2133
+ * Groups. Reads need `admin.groups` at read, writes at manage; adding or
2134
+ * removing a member of a Group that a holders-only grant reaches also
2135
+ * needs Grant Authority over that grant. An app server reads Groups but
2136
+ * writes none.
2137
+ */
2138
+ readonly groups: Readonly<{
2139
+ addMember: Call<WithPath<Api["groups"]["addMember"]> & BodyOf<Api["groups"]["addMember"]>, void>;
2140
+ create: Method<WithBody<Api["groups"]["create"]>, Api["groups"]["create"]>;
2141
+ delete: Call<WithPath<Api["groups"]["delete"]>, void>;
2142
+ get: Method<WithPath<Api["groups"]["get"]>, Api["groups"]["get"]>;
2143
+ /** A page of Groups; pass `next` as `page` to read the page after it. */
2144
+ list: Method<ServerAccessContext & QueryOf<Api["groups"]["list"]>, Api["groups"]["list"]>;
2145
+ removeMember: Call<WithPath<Api["groups"]["removeMember"]>, void>;
2146
+ update: Method<WithPath<Api["groups"]["update"]> & BodyOf<Api["groups"]["update"]>, Api["groups"]["update"]>;
2147
+ }>;
2148
+ /**
2149
+ * Invitations that `members.create` sent with mode `invitation`, newest
2150
+ * first. Reads need `admin.users` at read, a revoke at manage. Only a
2151
+ * service principal invites, so an app server is refused.
2152
+ */
2153
+ readonly invitations: Readonly<{
2154
+ /** A page of invitations, optionally by `status`; pass `next` as `page` to read the page after it. */
2155
+ list: Method<ServerAccessContext & QueryOf<Api["invitations"]["list"]>, Api["invitations"]["list"]>;
2156
+ revoke: Call<WithPath<Api["invitations"]["revoke"]>, void>;
2157
+ }>;
2158
+ /**
2159
+ * The Knowledge Data Policies, read only: the core and packages declare
2160
+ * them. `forSchema` answers the policies that decide the reads and the
2161
+ * writes of one schema, by its FQN. Needs `admin.profiles` at read.
2162
+ */
2163
+ readonly knowledgePolicies: Readonly<{
2164
+ forSchema: Method<WithPath<Api["knowledgePolicies"]["forSchema"]>, Api["knowledgePolicies"]["forSchema"]>;
2165
+ list: Method<ServerAccessContext, Api["knowledgePolicies"]["list"]>;
2166
+ }>;
2167
+ /**
2168
+ * The Max Privileges templates, read only: the most an app's user tokens
2169
+ * or an API key may do. Needs `admin.profiles` at read.
2170
+ */
2171
+ readonly maxPrivileges: Readonly<{
2172
+ get: Method<WithPath<Api["maxPrivileges"]["get"]>, Api["maxPrivileges"]["get"]>;
2173
+ list: Method<ServerAccessContext, Api["maxPrivileges"]["list"]>;
2174
+ }>;
2175
+ /**
2176
+ * Members and guests. `create` needs `admin.grants` at manage and Grant
2177
+ * Authority over each grant; reads need `admin.users` at read for
2178
+ * members and `admin.guests` at read for guests; changes need the same at
2179
+ * manage. An app server sees and changes only the guests it created.
2180
+ */
2181
+ readonly members: Readonly<{
2182
+ create: Method<WithBody<Api["members"]["create"]>, Api["members"]["create"]>;
2183
+ /** The member with this address, or `null` when the caller sees none. */
2184
+ findByEmail: Call<ServerAccessContext & Readonly<{
2185
+ email: string;
2186
+ }>, ServerAccessMember | null>;
2187
+ get: Method<WithPath<Api["members"]["get"]>, Api["members"]["get"]>;
2188
+ list: Method<ServerAccessContext & QueryOf<Api["members"]["list"]>, Api["members"]["list"]>;
2189
+ remove: Method<WithPath<Api["members"]["remove"]>, Api["members"]["remove"]>;
2190
+ resume: Method<WithPath<Api["members"]["resume"]>, Api["members"]["resume"]>;
2191
+ suspend: Method<WithPath<Api["members"]["suspend"]>, Api["members"]["suspend"]>;
2192
+ }>;
2193
+ /** Access Profiles, read only. Needs `admin.profiles` at read. */
2194
+ readonly profiles: Readonly<{
2195
+ get: Method<WithPath<Api["profiles"]["get"]>, Api["profiles"]["get"]>;
2196
+ list: Method<ServerAccessContext, Api["profiles"]["list"]>;
2197
+ }>;
2198
+ /** A user's Access Snapshot in the Organization. Needs `admin.grants` at read. */
2199
+ readonly snapshot: Method<WithPath<Api["snapshot"]>, Api["snapshot"]>;
2200
+ }
1011
2201
  /**
1012
2202
  * A client secret: a string at `.`, or the `Redacted` string that Effect
1013
2203
  * `Config.Redacted` reads for the `./effect` layers.
@@ -1061,8 +2251,6 @@ export interface ServerInvocationContext {
1061
2251
  readonly callerKind?: "anonymous_visitor";
1062
2252
  readonly correlationId?: string;
1063
2253
  readonly organizationId: string;
1064
- /** Selects a Server Role for this call; omission uses the credential default. */
1065
- readonly serverRole?: string;
1066
2254
  readonly signal?: AbortSignal;
1067
2255
  readonly traceparent?: string;
1068
2256
  }
@@ -1121,6 +2309,12 @@ export type ServerResourceUploadResult = Readonly<{
1121
2309
  }>;
1122
2310
  }>;
1123
2311
  export type ServerClientValue = Readonly<{
2312
+ /**
2313
+ * Members and guests, Access Grants and the read-only access model of an
2314
+ * Organization (ARC-010). A refusal of CI fails with `ServerAccessError`.
2315
+ * Calls are not retried.
2316
+ */
2317
+ access: ServerAccessService;
1124
2318
  /** A File upload slot; a refusal of CI is a value of the result. */
1125
2319
  createUpload: (request: ServerResourceUploadRequest) => Effect.Effect<ServerResourceUploadResult, CiTransportError>;
1126
2320
  /** The value of one operation; an Expected Error of CI fails with `CiError`. */
@@ -1140,6 +2334,12 @@ export type ServerClientValue = Readonly<{
1140
2334
  sendMessage: (request: ServerMessageSendRequest) => Effect.Effect<MessageSendResult, CiTransportError>;
1141
2335
  }>;
1142
2336
  declare const ServerClient_base: Context.ServiceClass<ServerClient, "@collective-intelligence/external-apps-server-sdk/ServerClient", Readonly<{
2337
+ /**
2338
+ * Members and guests, Access Grants and the read-only access model of an
2339
+ * Organization (ARC-010). A refusal of CI fails with `ServerAccessError`.
2340
+ * Calls are not retried.
2341
+ */
2342
+ access: ServerAccessService;
1143
2343
  /** A File upload slot; a refusal of CI is a value of the result. */
1144
2344
  createUpload: (request: ServerResourceUploadRequest) => Effect.Effect<ServerResourceUploadResult, CiTransportError>;
1145
2345
  /** The value of one operation; an Expected Error of CI fails with `CiError`. */
@@ -1287,8 +2487,6 @@ export interface MemberSessionExchangeRequest {
1287
2487
  readonly fetch?: typeof globalThis.fetch;
1288
2488
  /** The Organization the member acts in; the application must be allowed in it. */
1289
2489
  readonly organizationId: string;
1290
- /** A subset of the application's scopes. */
1291
- readonly scopes: readonly string[];
1292
2490
  /** The member's CI session token, for example from `POST /auth/otp/verify`. */
1293
2491
  readonly sessionToken: string;
1294
2492
  /** Cancels the exchange; a cancelled exchange rejects with the signal's reason. */
@@ -1315,6 +2513,12 @@ export type RunAsApplicationConfig<Secret extends ClientSecret = string> = Reado
1315
2513
  }>;
1316
2514
  export type CiEntitiesOptions = Readonly<{
1317
2515
  fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
2516
+ /**
2517
+ * Receives CI's answer to each forwarded call with the Access token that
2518
+ * made it; pass `auth.observeCiResponse` so a `401` or a changed
2519
+ * `x-access-version` drops the cached identity of the token at once.
2520
+ */
2521
+ observeCiResponse?: (accessToken: string, response: Response) => Promise<void>;
1318
2522
  organizationId: string;
1319
2523
  tenantUrl: string;
1320
2524
  }>;
@@ -1436,6 +2640,8 @@ declare const GatewayEffectRuntimeError$1: typeof GatewayEffectRuntimeError;
1436
2640
  type GatewayEffectRuntimeError$1 = GatewayEffectRuntimeError;
1437
2641
  declare const MemberSessionExchangeError$1: typeof MemberSessionExchangeError;
1438
2642
  type MemberSessionExchangeError$1 = MemberSessionExchangeError;
2643
+ declare const ServerAccessError$1: typeof ServerAccessError;
2644
+ type ServerAccessError$1 = ServerAccessError;
1439
2645
  declare const ServerClient$1: typeof ServerClient;
1440
2646
  type ServerClient$1 = ServerClient;
1441
2647
  export declare const layerServerClient: (config: ServerClientConfig<ClientSecret>) => import("effect/Layer").Layer<ServerClient, never, never>;
@@ -1477,6 +2683,7 @@ export {
1477
2683
  FederatedAuthErrorCode$1 as FederatedAuthErrorCode,
1478
2684
  GatewayEffectRuntimeError$1 as GatewayEffectRuntimeError,
1479
2685
  MemberSessionExchangeError$1 as MemberSessionExchangeError,
2686
+ ServerAccessError$1 as ServerAccessError,
1480
2687
  ServerClient$1 as ServerClient,
1481
2688
  };
1482
2689