@collective-intelligence/external-apps-server-sdk 0.2.2 → 0.2.4
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/AGENTS.md +6 -0
- package/README.md +189 -80
- package/dist/admin.d.ts +85 -98
- package/dist/admin.js +2 -2
- package/dist/auth/better-auth.d.ts +15 -6
- package/dist/auth/federated.d.ts +70 -22
- package/dist/auth/federated.js +1 -1
- package/dist/auth.d.ts +7 -5
- package/dist/chunks/{index-qe1587f9.js → index-7pww93nd.js} +4 -4
- package/dist/effect.d.ts +78 -196
- package/dist/effect.js +1 -1
- package/dist/index.d.ts +1457 -251
- package/dist/index.js +1 -1
- package/dist/next.d.ts +24 -13
- package/dist/next.js +1 -1
- package/dist/persistence/drizzle.d.ts +6 -5
- package/dist/resources.d.ts +7 -5
- package/dist/resources.js +1 -1
- package/dist/runtime/nestjs.d.ts +6 -6
- package/dist/runtime/web.d.ts +24 -13
- package/dist/runtime/web.js +1 -1
- package/docs/effect.md +14 -6
- package/docs/next-cache.md +5 -0
- package/package.json +4 -4
package/dist/effect.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
import { EntityOperation, EntityOperationResult, EntityProtocol, EntityRequest, EntityUploadInput, EntityUploadSlot, ResourceDefinition, ResourceJsonValue, ResourceListQuery, ResourceListResult, ResourceRecord, ResourceResult, ResourceTransportRequest } from '@collective-intelligence/external-apps-client-sdk/resources';
|
|
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';
|
|
7
7
|
import * as Brand from 'effect/Brand';
|
|
8
8
|
import * as Context from 'effect/Context';
|
|
@@ -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";
|
|
@@ -367,120 +367,6 @@ export type ExternalApplicationsGetContextErrors = {
|
|
|
367
367
|
};
|
|
368
368
|
};
|
|
369
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
|
-
};
|
|
383
|
-
};
|
|
384
|
-
};
|
|
385
|
-
export type ExternalApplicationsListAppUsersResponse = ExternalApplicationsListAppUsersResponses[keyof ExternalApplicationsListAppUsersResponses];
|
|
386
|
-
export type ExternalApplicationsCreateOrGetAppUserData = {
|
|
387
|
-
body: {
|
|
388
|
-
email: string;
|
|
389
|
-
name: string;
|
|
390
|
-
roles: Array<string>;
|
|
391
|
-
};
|
|
392
|
-
headers: {
|
|
393
|
-
authorization?: string;
|
|
394
|
-
"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
|
-
};
|
|
402
|
-
path?: never;
|
|
403
|
-
query?: never;
|
|
404
|
-
url: "/application/v1/users";
|
|
405
|
-
};
|
|
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
|
-
};
|
|
419
|
-
};
|
|
420
|
-
};
|
|
421
|
-
export type ExternalApplicationsCreateOrGetAppUserResponse = ExternalApplicationsCreateOrGetAppUserResponses[keyof ExternalApplicationsCreateOrGetAppUserResponses];
|
|
422
|
-
export type ExternalApplicationsCheckAppUserEmailData = {
|
|
423
|
-
body: {
|
|
424
|
-
email: string;
|
|
425
|
-
};
|
|
426
|
-
headers: {
|
|
427
|
-
authorization?: string;
|
|
428
|
-
"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
|
-
};
|
|
436
|
-
path?: never;
|
|
437
|
-
query?: never;
|
|
438
|
-
url: "/application/v1/users/check-email";
|
|
439
|
-
};
|
|
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
|
-
};
|
|
452
|
-
};
|
|
453
|
-
};
|
|
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
|
-
};
|
|
466
|
-
};
|
|
467
|
-
};
|
|
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
|
-
};
|
|
481
|
-
};
|
|
482
|
-
};
|
|
483
|
-
export type ExternalApplicationsListAppRolesResponse = ExternalApplicationsListAppRolesResponses[keyof ExternalApplicationsListAppRolesResponses];
|
|
484
370
|
export type JsonValue = boolean | null | number | readonly JsonValue[] | Readonly<{
|
|
485
371
|
readonly [key: string]: JsonValue;
|
|
486
372
|
}> | string;
|
|
@@ -558,40 +444,6 @@ export type KnowledgeQuery = {
|
|
|
558
444
|
op: "autocomplete";
|
|
559
445
|
});
|
|
560
446
|
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
447
|
input: JsonObject | unknown[];
|
|
596
448
|
operationId: "context_get";
|
|
597
449
|
} | {
|
|
@@ -756,15 +608,7 @@ export interface EnvelopeSuccess<Id extends string, Result> {
|
|
|
756
608
|
operationId: Id;
|
|
757
609
|
result: Result;
|
|
758
610
|
}
|
|
759
|
-
export type ExternalApplicationOperationSuccess = EnvelopeSuccess<"
|
|
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", {
|
|
611
|
+
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
612
|
runId: string;
|
|
769
613
|
}> | EnvelopeSuccess<"skills_list", JsonObject> | EnvelopeSuccess<"skills_invoke", {
|
|
770
614
|
runId: string;
|
|
@@ -782,11 +626,6 @@ export type ExternalApplicationOperationSuccess = EnvelopeSuccess<"users_get", A
|
|
|
782
626
|
conversationId: string;
|
|
783
627
|
runId: string;
|
|
784
628
|
}> | 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
629
|
declare const storageFileIdBrand: unique symbol;
|
|
791
630
|
/** A durable private file of the application's Organization. */
|
|
792
631
|
export type StorageFileId = string & Readonly<{
|
|
@@ -802,19 +641,11 @@ export interface DurableFileUpload {
|
|
|
802
641
|
fileName: string;
|
|
803
642
|
sizeBytes: number;
|
|
804
643
|
}
|
|
805
|
-
export
|
|
806
|
-
input: ExternalApplicationsCheckAppUserEmailData["body"];
|
|
807
|
-
operationId: "users_check_email";
|
|
808
|
-
} | {
|
|
644
|
+
export interface ExternalApplicationServiceOperationRequest {
|
|
809
645
|
input: DurableFileUpload;
|
|
810
646
|
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", {
|
|
647
|
+
}
|
|
648
|
+
export type ExternalApplicationServiceOperationSuccess = EnvelopeSuccess<"files_upload", {
|
|
818
649
|
storageFileId: StorageFileId;
|
|
819
650
|
}>;
|
|
820
651
|
/** Every operation a confidential server client may invoke. */
|
|
@@ -968,7 +799,6 @@ declare const oauthErrorCodes: readonly [
|
|
|
968
799
|
"invalid_client",
|
|
969
800
|
"invalid_grant",
|
|
970
801
|
"invalid_request",
|
|
971
|
-
"invalid_scope",
|
|
972
802
|
"invalid_target",
|
|
973
803
|
"temporarily_unavailable",
|
|
974
804
|
"unauthorized_client",
|
|
@@ -987,7 +817,6 @@ declare const MemberSessionExchangeError_base: Schema.Class<MemberSessionExchang
|
|
|
987
817
|
"invalid_client",
|
|
988
818
|
"invalid_grant",
|
|
989
819
|
"invalid_request",
|
|
990
|
-
"invalid_scope",
|
|
991
820
|
"invalid_target",
|
|
992
821
|
"temporarily_unavailable",
|
|
993
822
|
"unauthorized_client",
|
|
@@ -1046,6 +875,11 @@ export interface ServerClientConfig<Secret extends ClientSecret = string> {
|
|
|
1046
875
|
readonly sleep?: (milliseconds: number) => Promise<void>;
|
|
1047
876
|
readonly tenantUrl: string;
|
|
1048
877
|
}
|
|
878
|
+
/**
|
|
879
|
+
* The config of `layerDelegatedServerClient`: a client config without
|
|
880
|
+
* `authentication`. The client sends the `DelegatedAccessToken` of the fiber.
|
|
881
|
+
*/
|
|
882
|
+
export type DelegatedServerClientConfig = Omit<ServerClientConfig, "authentication">;
|
|
1049
883
|
export interface ServerInvocationContext {
|
|
1050
884
|
readonly auditSubject?: ExternalApplicationExternalAuditSubject;
|
|
1051
885
|
/**
|
|
@@ -1056,8 +890,6 @@ export interface ServerInvocationContext {
|
|
|
1056
890
|
readonly callerKind?: "anonymous_visitor";
|
|
1057
891
|
readonly correlationId?: string;
|
|
1058
892
|
readonly organizationId: string;
|
|
1059
|
-
/** Selects a Server Role for this call; omission uses the credential default. */
|
|
1060
|
-
readonly serverRole?: string;
|
|
1061
893
|
readonly signal?: AbortSignal;
|
|
1062
894
|
readonly traceparent?: string;
|
|
1063
895
|
}
|
|
@@ -1123,12 +955,13 @@ export type ServerClientValue = Readonly<{
|
|
|
1123
955
|
/** The same call as its result, which keeps the error envelope of CI. */
|
|
1124
956
|
executeResult: <Id extends ExternalApplicationServerOperationId>(operationId: Id, request: ServerOperationRequest<Id>) => Effect.Effect<ExternalApplicationOperationResult<Id>, CiTransportError>;
|
|
1125
957
|
/**
|
|
1126
|
-
* The record writes of CI's resources API; a refusal of CI fails
|
|
1127
|
-
* `CiError`. After CI confirms a write, the `CacheInvalidation` of the
|
|
1128
|
-
* fiber gets the Entity Tag and the Schema Tag of its record.
|
|
958
|
+
* The record reads and writes of CI's resources API; a refusal of CI fails
|
|
959
|
+
* with `CiError`. After CI confirms a write, the `CacheInvalidation` of the
|
|
960
|
+
* fiber gets the Entity Tag and the Schema Tag of its record. A read
|
|
961
|
+
* invalidates nothing and adds no cache tag.
|
|
1129
962
|
*/
|
|
1130
963
|
records: ServerRecords;
|
|
1131
|
-
/** The same writes as their results, which keep the refusal of CI. */
|
|
964
|
+
/** The same reads and writes as their results, which keep the refusal of CI. */
|
|
1132
965
|
recordsResult: ServerRecordsResult;
|
|
1133
966
|
/** Sends one message; a refusal of CI is a value of the result. */
|
|
1134
967
|
sendMessage: (request: ServerMessageSendRequest) => Effect.Effect<MessageSendResult, CiTransportError>;
|
|
@@ -1141,12 +974,13 @@ declare const ServerClient_base: Context.ServiceClass<ServerClient, "@collective
|
|
|
1141
974
|
/** The same call as its result, which keeps the error envelope of CI. */
|
|
1142
975
|
executeResult: <Id extends ExternalApplicationServerOperationId>(operationId: Id, request: ServerOperationRequest<Id>) => Effect.Effect<ExternalApplicationOperationResult<Id>, CiTransportError>;
|
|
1143
976
|
/**
|
|
1144
|
-
* The record writes of CI's resources API; a refusal of CI fails
|
|
1145
|
-
* `CiError`. After CI confirms a write, the `CacheInvalidation` of the
|
|
1146
|
-
* fiber gets the Entity Tag and the Schema Tag of its record.
|
|
977
|
+
* The record reads and writes of CI's resources API; a refusal of CI fails
|
|
978
|
+
* with `CiError`. After CI confirms a write, the `CacheInvalidation` of the
|
|
979
|
+
* fiber gets the Entity Tag and the Schema Tag of its record. A read
|
|
980
|
+
* invalidates nothing and adds no cache tag.
|
|
1147
981
|
*/
|
|
1148
982
|
records: ServerRecords;
|
|
1149
|
-
/** The same writes as their results, which keep the refusal of CI. */
|
|
983
|
+
/** The same reads and writes as their results, which keep the refusal of CI. */
|
|
1150
984
|
recordsResult: ServerRecordsResult;
|
|
1151
985
|
/** Sends one message; a refusal of CI is a value of the result. */
|
|
1152
986
|
sendMessage: (request: ServerMessageSendRequest) => Effect.Effect<MessageSendResult, CiTransportError>;
|
|
@@ -1155,14 +989,39 @@ declare class ServerClient extends ServerClient_base {
|
|
|
1155
989
|
}
|
|
1156
990
|
/** The field values of a record: a JSON object. */
|
|
1157
991
|
export type ServerRecordValue = Readonly<Record<string, ResourceJsonValue>>;
|
|
1158
|
-
/** One record of an entity schema, as CI answers a write. */
|
|
992
|
+
/** One record of an entity schema, as CI answers a read or a write. */
|
|
1159
993
|
export type ServerResourceRecord = Readonly<{
|
|
1160
994
|
deletedAt?: string;
|
|
1161
995
|
id: string;
|
|
996
|
+
/**
|
|
997
|
+
* The records of the read's Include Paths by relation field key: one
|
|
998
|
+
* record, or the records of a `many` field in reference order. Untyped:
|
|
999
|
+
* the target schemas are CI's.
|
|
1000
|
+
*/
|
|
1001
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
1162
1002
|
/** The revision that the next update or delete of the record names. */
|
|
1163
1003
|
revision: string;
|
|
1004
|
+
/** The keys of `included` whose records CI cut to the first 100. */
|
|
1005
|
+
truncated?: readonly string[];
|
|
1164
1006
|
value: ServerRecordValue;
|
|
1165
1007
|
}>;
|
|
1008
|
+
/** One page of a record search. */
|
|
1009
|
+
export type ServerRecordPage = EntityPage<ServerRecordValue>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Reads the record `id`. `include` names Include Paths, such as
|
|
1012
|
+
* `["company", "contacts.company"]`; their records are in `included`.
|
|
1013
|
+
*/
|
|
1014
|
+
export type ServerRecordGetRequest = Readonly<{
|
|
1015
|
+
id: string;
|
|
1016
|
+
include?: readonly string[];
|
|
1017
|
+
schemaId: string;
|
|
1018
|
+
timeoutMs?: number;
|
|
1019
|
+
}> & ServerInvocationContext;
|
|
1020
|
+
/** Searches the records of a schema, one page at a time. */
|
|
1021
|
+
export type ServerRecordSearchRequest = Readonly<{
|
|
1022
|
+
schemaId: string;
|
|
1023
|
+
timeoutMs?: number;
|
|
1024
|
+
}> & EntityListQuery & ServerInvocationContext;
|
|
1166
1025
|
/** Creates a record with `value`; CI names its id. */
|
|
1167
1026
|
export type ServerRecordCreateRequest = Readonly<{
|
|
1168
1027
|
idempotencyKey?: string;
|
|
@@ -1198,15 +1057,32 @@ export type ServerRecordWriteResult = Readonly<{
|
|
|
1198
1057
|
result: ServerResourceRecord;
|
|
1199
1058
|
}>;
|
|
1200
1059
|
}>;
|
|
1060
|
+
/** The record that CI read, or the refusal of CI. */
|
|
1061
|
+
export type ServerRecordGetResult = ServerRecordWriteResult;
|
|
1062
|
+
/** The page that CI found, or the refusal of CI. */
|
|
1063
|
+
export type ServerRecordSearchResult = Readonly<{
|
|
1064
|
+
error: ServerResourceFailure;
|
|
1065
|
+
ok: false;
|
|
1066
|
+
}> | Readonly<{
|
|
1067
|
+
ok: true;
|
|
1068
|
+
value: Readonly<{
|
|
1069
|
+
correlationId: string;
|
|
1070
|
+
result: ServerRecordPage;
|
|
1071
|
+
}>;
|
|
1072
|
+
}>;
|
|
1201
1073
|
export type ServerRecordsResult = Readonly<{
|
|
1202
1074
|
create: (request: ServerRecordCreateRequest) => Effect.Effect<ServerRecordWriteResult, CiTransportError>;
|
|
1203
1075
|
delete: (request: ServerRecordDeleteRequest) => Effect.Effect<ServerRecordWriteResult, CiTransportError>;
|
|
1076
|
+
get: (request: ServerRecordGetRequest) => Effect.Effect<ServerRecordGetResult, CiTransportError>;
|
|
1077
|
+
search: (request: ServerRecordSearchRequest) => Effect.Effect<ServerRecordSearchResult, CiTransportError>;
|
|
1204
1078
|
update: (request: ServerRecordUpdateRequest) => Effect.Effect<ServerRecordWriteResult, CiTransportError>;
|
|
1205
1079
|
}>;
|
|
1206
|
-
/** The record writes with typed failures: a refusal of CI fails with `CiError`. */
|
|
1080
|
+
/** The record reads and writes with typed failures: a refusal of CI fails with `CiError`. */
|
|
1207
1081
|
export type ServerRecords = Readonly<{
|
|
1208
1082
|
create: (request: ServerRecordCreateRequest) => Effect.Effect<ServerResourceRecord, CiError | CiTransportError>;
|
|
1209
1083
|
delete: (request: ServerRecordDeleteRequest) => Effect.Effect<ServerResourceRecord, CiError | CiTransportError>;
|
|
1084
|
+
get: (request: ServerRecordGetRequest) => Effect.Effect<ServerResourceRecord, CiError | CiTransportError>;
|
|
1085
|
+
search: (request: ServerRecordSearchRequest) => Effect.Effect<ServerRecordPage, CiError | CiTransportError>;
|
|
1210
1086
|
update: (request: ServerRecordUpdateRequest) => Effect.Effect<ServerResourceRecord, CiError | CiTransportError>;
|
|
1211
1087
|
}>;
|
|
1212
1088
|
export type GatewayRuntimeKernel = Pick<GatewayKernel, "handle">;
|
|
@@ -1238,8 +1114,6 @@ export interface MemberSessionExchangeRequest {
|
|
|
1238
1114
|
readonly fetch?: typeof globalThis.fetch;
|
|
1239
1115
|
/** The Organization the member acts in; the application must be allowed in it. */
|
|
1240
1116
|
readonly organizationId: string;
|
|
1241
|
-
/** A subset of the application's scopes. */
|
|
1242
|
-
readonly scopes: readonly string[];
|
|
1243
1117
|
/** The member's CI session token, for example from `POST /auth/otp/verify`. */
|
|
1244
1118
|
readonly sessionToken: string;
|
|
1245
1119
|
/** Cancels the exchange; a cancelled exchange rejects with the signal's reason. */
|
|
@@ -1266,6 +1140,12 @@ export type RunAsApplicationConfig<Secret extends ClientSecret = string> = Reado
|
|
|
1266
1140
|
}>;
|
|
1267
1141
|
export type CiEntitiesOptions = Readonly<{
|
|
1268
1142
|
fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
1143
|
+
/**
|
|
1144
|
+
* Receives CI's answer to each forwarded call with the Access token that
|
|
1145
|
+
* made it; pass `auth.observeCiResponse` so a `401` or a changed
|
|
1146
|
+
* `x-access-version` drops the cached identity of the token at once.
|
|
1147
|
+
*/
|
|
1148
|
+
observeCiResponse?: (accessToken: string, response: Response) => Promise<void>;
|
|
1269
1149
|
organizationId: string;
|
|
1270
1150
|
tenantUrl: string;
|
|
1271
1151
|
}>;
|
|
@@ -1391,6 +1271,8 @@ declare const ServerClient$1: typeof ServerClient;
|
|
|
1391
1271
|
type ServerClient$1 = ServerClient;
|
|
1392
1272
|
export declare const layerServerClient: (config: ServerClientConfig<ClientSecret>) => import("effect/Layer").Layer<ServerClient, never, never>;
|
|
1393
1273
|
export declare const layerServerClientConfig: (config: import("effect/Config").Wrap<ServerClientConfig<import("effect/Redacted").Redacted<string>>>) => import("effect/Layer").Layer<ServerClient, import("effect/Config").ConfigError, never>;
|
|
1274
|
+
export declare const DelegatedAccessToken: import("effect/Context").Reference<import("effect/Option").Option<string>>;
|
|
1275
|
+
export declare const layerDelegatedServerClient: (config: DelegatedServerClientConfig) => import("effect/Layer").Layer<ServerClient, never, never>;
|
|
1394
1276
|
export declare const layerApplicationServerClient: (config: RunAsApplicationConfig<ClientSecret>) => import("effect/Layer").Layer<ServerClient, never, never>;
|
|
1395
1277
|
export declare const layerApplicationServerClientConfig: (config: import("effect/Config").Wrap<RunAsApplicationConfig<import("effect/Redacted").Redacted<string>>>) => import("effect/Layer").Layer<ServerClient, import("effect/Config").ConfigError, never>;
|
|
1396
1278
|
export declare const exchangeMemberSession: (request: MemberSessionExchangeRequest) => import("effect/Effect").Effect<MemberAccessToken, MemberSessionExchangeError, never>;
|