@collective-intelligence/external-apps-client-sdk 0.1.35 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -0
- package/dist/effect.d.ts +132 -0
- package/dist/effect.js +32 -0
- package/dist/index-BqdhzpcZ.d.ts +1029 -0
- package/dist/index.d.ts +3 -925
- package/dist/index.js +323 -1233
- package/dist/resources-DT-KqPTd.js +109 -0
- package/dist/{resources-GSZWfWkN.d.ts → resources-tBGn1Exi.d.ts} +208 -10
- package/dist/resources.d.ts +1 -1
- package/dist/resources.js +2 -1
- package/dist/{resources-DVME85iC.js → service-C7kswu6e.js} +560 -277
- package/dist/service-CxUyG8yF.js +1439 -0
- package/package.json +20 -4
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { T as CiTransportError, f as runEntityRequest, l as makeEntityCore, r as fromEntityTransport, u as makeLegacyResourceCore } from "./service-C7kswu6e.js";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
4
|
+
/**
|
|
5
|
+
* The `.` facade of the entity client core (`./service`), in a runtime of
|
|
6
|
+
* its own; `close` disposes it. A transport failure, or an abort in flight,
|
|
7
|
+
* resolves `transport_error`: `rejected` for a read, `uncertain` for a
|
|
8
|
+
* write.
|
|
9
|
+
*/
|
|
10
|
+
const createCommonEntityClient = (options) => {
|
|
11
|
+
const runtime = ManagedRuntime.make(Layer.empty);
|
|
12
|
+
const core = makeEntityCore({
|
|
13
|
+
definition: options.definition,
|
|
14
|
+
execute: fromEntityTransport(options.transport),
|
|
15
|
+
requestId: options.requestId
|
|
16
|
+
});
|
|
17
|
+
const execute = (input, requestOptions = {}) => {
|
|
18
|
+
const correlationId = core.requestId();
|
|
19
|
+
return runEntityRequest(runtime, core.execute(input, correlationId, requestOptions), {
|
|
20
|
+
correlationId,
|
|
21
|
+
message: "The entity transport failed",
|
|
22
|
+
operation: input.operation,
|
|
23
|
+
signal: requestOptions.signal
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
close: () => runtime.dispose(),
|
|
28
|
+
create: (input) => execute({
|
|
29
|
+
...input,
|
|
30
|
+
operation: "create"
|
|
31
|
+
}),
|
|
32
|
+
definition: options.definition,
|
|
33
|
+
delete: (input) => execute({
|
|
34
|
+
...input,
|
|
35
|
+
operation: "delete"
|
|
36
|
+
}),
|
|
37
|
+
get: (input, requestOptions) => execute({
|
|
38
|
+
...input,
|
|
39
|
+
operation: "get"
|
|
40
|
+
}, requestOptions),
|
|
41
|
+
list: (query, requestOptions) => execute({
|
|
42
|
+
operation: "list",
|
|
43
|
+
query
|
|
44
|
+
}, requestOptions),
|
|
45
|
+
listMembers: (parentId, field, query, requestOptions) => execute({
|
|
46
|
+
field,
|
|
47
|
+
operation: "list_members",
|
|
48
|
+
parentId,
|
|
49
|
+
query
|
|
50
|
+
}, requestOptions),
|
|
51
|
+
update: (input) => execute({
|
|
52
|
+
...input,
|
|
53
|
+
operation: "update"
|
|
54
|
+
}),
|
|
55
|
+
upload: (input, requestOptions) => execute({
|
|
56
|
+
...input,
|
|
57
|
+
operation: "upload"
|
|
58
|
+
}, requestOptions)
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const unavailable = (cause) => ({
|
|
62
|
+
code: "transport_error",
|
|
63
|
+
details: { cause: cause instanceof Error ? cause.message : String(cause) },
|
|
64
|
+
message: "The resource transport failed",
|
|
65
|
+
retryable: true
|
|
66
|
+
});
|
|
67
|
+
const defaultRequestId = () => globalThis.crypto.randomUUID();
|
|
68
|
+
/**
|
|
69
|
+
* The `.` facade of the resource core (`./service`), in a runtime of its
|
|
70
|
+
* own that holds no service: the core needs none. `close` disposes it. A
|
|
71
|
+
* transport that rejects resolves `transport_error`.
|
|
72
|
+
*/
|
|
73
|
+
const createLegacyResourceClient = (options) => {
|
|
74
|
+
const runtime = ManagedRuntime.make(Layer.empty);
|
|
75
|
+
const requestId = options.requestId ?? defaultRequestId;
|
|
76
|
+
const legacy = makeLegacyResourceCore({
|
|
77
|
+
definition: options.definition,
|
|
78
|
+
transport: options.transport
|
|
79
|
+
});
|
|
80
|
+
const run = async (call, requestOptions) => {
|
|
81
|
+
const correlationId = requestId();
|
|
82
|
+
try {
|
|
83
|
+
return await runtime.runPromise(call(correlationId, requestOptions));
|
|
84
|
+
} catch (error) {
|
|
85
|
+
if (!(error instanceof CiTransportError)) throw error;
|
|
86
|
+
return {
|
|
87
|
+
correlationId,
|
|
88
|
+
error: unavailable(error.cause),
|
|
89
|
+
ok: false
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
capabilities: options.definition.capabilities,
|
|
95
|
+
close: () => runtime.dispose(),
|
|
96
|
+
create: (input, requestOptions) => run(legacy.create(input), requestOptions),
|
|
97
|
+
definition: options.definition,
|
|
98
|
+
get: (input, requestOptions) => run(legacy.get(input), requestOptions),
|
|
99
|
+
hardDelete: (input, requestOptions) => run(legacy.hardDelete(input), requestOptions),
|
|
100
|
+
list: (query, requestOptions) => run(legacy.list(query), requestOptions),
|
|
101
|
+
restore: (input, requestOptions) => run(legacy.restore(input), requestOptions),
|
|
102
|
+
softDelete: (input, requestOptions) => run(legacy.softDelete(input), requestOptions),
|
|
103
|
+
update: (input, requestOptions) => run(legacy.update(input), requestOptions)
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
function createResourceClient(options) {
|
|
107
|
+
return options.protocol === "entity" ? createCommonEntityClient(options) : createLegacyResourceClient(options);
|
|
108
|
+
}
|
|
109
|
+
export { createResourceClient as t };
|
|
@@ -1,8 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import * as Config from "effect/Config";
|
|
3
|
+
import * as Context from "effect/Context";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
import * as Stream from "effect/Stream";
|
|
7
|
+
import "effect/ManagedRuntime";
|
|
8
|
+
/** Code of an Expected Error that CI returns for an operation. */
|
|
9
|
+
declare const CiErrorCode$1: Schema.Literals<readonly ["unauthenticated", "forbidden", "not_found", "conflict", "invalid_request", "rate_limited", "unavailable", "internal"]>;
|
|
10
|
+
type CiErrorCode$1 = typeof CiErrorCode$1.Type;
|
|
11
|
+
/** Code of an Expected Error of the federated sign-in flow. */
|
|
12
|
+
declare const FederatedAuthErrorCode: Schema.Literals<readonly ["configuration_error", "invalid_return_target", "invalid_callback", "invalid_state", "transaction_expired", "authorization_failed", "token_exchange_failed", "reauthorization_required"]>;
|
|
13
|
+
type FederatedAuthErrorCode = typeof FederatedAuthErrorCode.Type;
|
|
14
|
+
declare const CiError_base: Schema.Class<CiError$1, Schema.TaggedStruct<"CiError", {
|
|
15
|
+
readonly code: Schema.Literals<readonly ["unauthenticated", "forbidden", "not_found", "conflict", "invalid_request", "rate_limited", "unavailable", "internal"]>;
|
|
16
|
+
readonly details: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
17
|
+
readonly message: Schema.String;
|
|
18
|
+
readonly retryable: Schema.Boolean;
|
|
19
|
+
}>, import("effect/Cause").YieldableError>;
|
|
20
|
+
/** An Expected Error that CI returns for an operation. */
|
|
21
|
+
declare class CiError$1 extends CiError_base {}
|
|
22
|
+
type FederatedAuthErrorFields = Readonly<{
|
|
23
|
+
code: FederatedAuthErrorCode;
|
|
24
|
+
message: string;
|
|
25
|
+
}>;
|
|
26
|
+
declare const FederatedAuthError_base: Schema.Class<FederatedAuthError, Schema.TaggedStruct<"FederatedAuthError", {
|
|
27
|
+
readonly code: Schema.Literals<readonly ["configuration_error", "invalid_return_target", "invalid_callback", "invalid_state", "transaction_expired", "authorization_failed", "token_exchange_failed", "reauthorization_required"]>;
|
|
28
|
+
readonly message: Schema.String;
|
|
29
|
+
}>, import("effect/Cause").YieldableError>;
|
|
30
|
+
/** An Expected Error of the federated sign-in flow. */
|
|
31
|
+
declare class FederatedAuthError extends FederatedAuthError_base {
|
|
32
|
+
constructor(fields: FederatedAuthErrorFields, options?: Schema.MakeOptions);
|
|
33
|
+
/** The positional form that `.` callers used before the tagged class. */
|
|
4
34
|
constructor(code: FederatedAuthErrorCode, message: string);
|
|
5
35
|
}
|
|
36
|
+
declare const CiTransportError_base: Schema.Class<CiTransportError, Schema.TaggedStruct<"CiTransportError", {
|
|
37
|
+
readonly cause: Schema.Defect;
|
|
38
|
+
}>, import("effect/Cause").YieldableError>;
|
|
39
|
+
/** The request did not reach CI, or CI's response was not readable. */
|
|
40
|
+
declare class CiTransportError extends CiTransportError_base {}
|
|
41
|
+
type ServerSessionAuthOptions = Readonly<{
|
|
42
|
+
basePath: string;
|
|
43
|
+
fetch?: ClientFetch;
|
|
44
|
+
navigate?: (url: string) => void;
|
|
45
|
+
now?: () => number;
|
|
46
|
+
origin?: string;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Browser session client for a sealed-cookie BFF. The access token never
|
|
50
|
+
* leaves the server. A bad option throws `FederatedAuthError`
|
|
51
|
+
* `configuration_error`. `close` disposes the runtime of the client.
|
|
52
|
+
*/
|
|
53
|
+
declare const createServerSessionAuth: (options: ServerSessionAuthOptions) => FederatedAuth & Readonly<{
|
|
54
|
+
close: () => Promise<void>;
|
|
55
|
+
}>;
|
|
56
|
+
type ReturnTarget = Readonly<{
|
|
57
|
+
returnTo: string;
|
|
58
|
+
}>;
|
|
59
|
+
type FederatedAuthValue = Readonly<{
|
|
60
|
+
beginLogin: (options: ReturnTarget) => Effect.Effect<string, FederatedAuthError>;
|
|
61
|
+
completeLogin: (callbackUrl: string) => Effect.Effect<ReturnTarget, FederatedAuthError | CiTransportError>;
|
|
62
|
+
getAccessToken: Effect.Effect<string, FederatedAuthError>;
|
|
63
|
+
logout: Effect.Effect<void>;
|
|
64
|
+
reauthorize: (options?: Readonly<{
|
|
65
|
+
returnTo?: string;
|
|
66
|
+
}>) => Effect.Effect<string, FederatedAuthError>;
|
|
67
|
+
/** The current state, read at once. */
|
|
68
|
+
getState: () => FederatedAuthState;
|
|
69
|
+
/** Calls `listener` at each state change, in the call that changes it. */
|
|
70
|
+
subscribe: (listener: (state: FederatedAuthState) => void) => () => void;
|
|
71
|
+
/** Each state change, from the subscription on. */
|
|
72
|
+
changes: Stream.Stream<FederatedAuthState>;
|
|
73
|
+
}>;
|
|
74
|
+
declare const FederatedAuth_base: Context.ServiceClass<FederatedAuth$1, "@collective-intelligence/external-apps-client-sdk/FederatedAuth", Readonly<{
|
|
75
|
+
beginLogin: (options: ReturnTarget) => Effect.Effect<string, FederatedAuthError>;
|
|
76
|
+
completeLogin: (callbackUrl: string) => Effect.Effect<ReturnTarget, FederatedAuthError | CiTransportError>;
|
|
77
|
+
getAccessToken: Effect.Effect<string, FederatedAuthError>;
|
|
78
|
+
logout: Effect.Effect<void>;
|
|
79
|
+
reauthorize: (options?: Readonly<{
|
|
80
|
+
returnTo?: string;
|
|
81
|
+
}>) => Effect.Effect<string, FederatedAuthError>;
|
|
82
|
+
/** The current state, read at once. */
|
|
83
|
+
getState: () => FederatedAuthState;
|
|
84
|
+
/** Calls `listener` at each state change, in the call that changes it. */
|
|
85
|
+
subscribe: (listener: (state: FederatedAuthState) => void) => () => void;
|
|
86
|
+
/** Each state change, from the subscription on. */
|
|
87
|
+
changes: Stream.Stream<FederatedAuthState>;
|
|
88
|
+
}>>;
|
|
89
|
+
declare class FederatedAuth$1 extends FederatedAuth_base {}
|
|
90
|
+
/** `FederatedAuth` of browser federated sign-in; a bad option fails with `configuration_error`. */
|
|
91
|
+
declare const layerFederated: (options: FederatedAuthOptions) => Layer.Layer<FederatedAuth$1, FederatedAuthError, never>;
|
|
92
|
+
/** `FederatedAuth` of a sealed-cookie BFF session; a bad option fails with `configuration_error`. */
|
|
93
|
+
declare const layerServerSession: (options: ServerSessionAuthOptions) => Layer.Layer<FederatedAuth$1, FederatedAuthError, never>;
|
|
94
|
+
/** `layerFederated` with options that Effect `Config` reads. */
|
|
95
|
+
declare const layerFederatedConfig: (config: Config.Wrap<FederatedAuthOptions>) => Layer.Layer<FederatedAuth$1, FederatedAuthError | Config.ConfigError, never>;
|
|
96
|
+
/** `layerServerSession` with options that Effect `Config` reads. */
|
|
97
|
+
declare const layerServerSessionConfig: (config: Config.Wrap<ServerSessionAuthOptions>) => Layer.Layer<FederatedAuth$1, FederatedAuthError | Config.ConfigError, never>;
|
|
6
98
|
/**
|
|
7
99
|
* The signed-in CI user as the application's BFF reports it: the fields of
|
|
8
100
|
* CI's `/oauth/identity`, read live by the server, plus email and name.
|
|
@@ -61,7 +153,15 @@ type FederatedAuthOptions = Readonly<{
|
|
|
61
153
|
sessionStorage?: Pick<Storage, "getItem" | "removeItem" | "setItem">;
|
|
62
154
|
tenantUrl: string;
|
|
63
155
|
}>;
|
|
64
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Browser federated sign-in with PKCE; the access token stays in memory. A
|
|
158
|
+
* bad option throws `FederatedAuthError` `configuration_error`. Methods
|
|
159
|
+
* reject with `FederatedAuthError`, or with `CiTransportError` when the
|
|
160
|
+
* tenant cannot be reached. `close` disposes the runtime of the client.
|
|
161
|
+
*/
|
|
162
|
+
declare const createFederatedAuth: (options: FederatedAuthOptions) => FederatedAuth & Readonly<{
|
|
163
|
+
close: () => Promise<void>;
|
|
164
|
+
}>;
|
|
65
165
|
type ExternalApplicationsListAppUsersResponses = {
|
|
66
166
|
/**
|
|
67
167
|
* Success
|
|
@@ -543,7 +643,9 @@ interface TypedOperationExecutor<Operations extends ClientOperationMap> {
|
|
|
543
643
|
type JsonValue = null | boolean | number | string | readonly JsonValue[] | Readonly<{
|
|
544
644
|
[key: string]: JsonValue;
|
|
545
645
|
}>;
|
|
546
|
-
|
|
646
|
+
/** Codes of the Expected Errors that CI returns. The `CiErrorCode` Schema of `./effect` uses this list. */
|
|
647
|
+
declare const ciErrorCodes: readonly ["unauthenticated", "forbidden", "not_found", "conflict", "invalid_request", "rate_limited", "unavailable", "internal"];
|
|
648
|
+
type CiErrorCode = (typeof ciErrorCodes)[number];
|
|
547
649
|
type CiError = Readonly<{
|
|
548
650
|
code: CiErrorCode;
|
|
549
651
|
message: string;
|
|
@@ -576,7 +678,13 @@ type ProxyTransportOptions = Readonly<{
|
|
|
576
678
|
path: string;
|
|
577
679
|
serverUrl: string;
|
|
578
680
|
}>;
|
|
579
|
-
|
|
681
|
+
/**
|
|
682
|
+
* The Vanilla Facade of `CiClient.layerProxy`, in a runtime of its own;
|
|
683
|
+
* `close` disposes it. A bad `serverUrl` or `path` throws `TypeError`.
|
|
684
|
+
*/
|
|
685
|
+
declare const createProxyTransport: <Operations extends ClientOperationMap>(options: ProxyTransportOptions) => TypedOperationExecutor<Operations> & Readonly<{
|
|
686
|
+
close: () => Promise<void>;
|
|
687
|
+
}>;
|
|
580
688
|
type ResourceJsonValue = null | boolean | number | string | readonly ResourceJsonValue[] | Readonly<{
|
|
581
689
|
[key: string]: ResourceJsonValue;
|
|
582
690
|
}>;
|
|
@@ -924,10 +1032,14 @@ type ClientOptions<Value, Create, Patch> = Readonly<{
|
|
|
924
1032
|
declare function createResourceClient<Value, Create = Value, Patch = Partial<Value>>(options: ClientOptions<Value, Create, Patch> & Readonly<{
|
|
925
1033
|
protocol: "entity";
|
|
926
1034
|
transport: EntityTransport;
|
|
927
|
-
}>): EntityClient<Value, Create, Patch
|
|
1035
|
+
}>): EntityClient<Value, Create, Patch> & Readonly<{
|
|
1036
|
+
close: () => Promise<void>;
|
|
1037
|
+
}>;
|
|
928
1038
|
declare function createResourceClient<Value, Create = Value, Patch = Partial<Value>>(options: ClientOptions<Value, Create, Patch> & Readonly<{
|
|
929
1039
|
transport: ResourceTransport;
|
|
930
|
-
}>): ResourceClient<Value, Create, Patch
|
|
1040
|
+
}>): ResourceClient<Value, Create, Patch> & Readonly<{
|
|
1041
|
+
close: () => Promise<void>;
|
|
1042
|
+
}>;
|
|
931
1043
|
/** Narrow a decoded resource failure to its documented request-wide read limit. */
|
|
932
1044
|
declare const isEntityReadLimitError: (error: ResourceError) => error is ResourceError & Readonly<{
|
|
933
1045
|
code: "invalid_request";
|
|
@@ -935,6 +1047,86 @@ declare const isEntityReadLimitError: (error: ResourceError) => error is Resourc
|
|
|
935
1047
|
}>;
|
|
936
1048
|
/** Common entity wire codec; transport and persistence remain with their owners. */
|
|
937
1049
|
declare const createEntityProtocol: <Value, Create = Value, Patch = Partial<Value>>(definition: ResourceDefinition<Value, Create, Patch>) => EntityProtocol<Value, Create, Patch>;
|
|
1050
|
+
type ResourceFailure = CiError$1 | CiTransportError;
|
|
1051
|
+
/** The entity client of one Resource Definition for `./effect`. */
|
|
1052
|
+
type ResourceEntityClient<Value, Create, Patch> = Readonly<{
|
|
1053
|
+
definition: ResourceDefinition<Value, Create, Patch>;
|
|
1054
|
+
get: (input: Readonly<{
|
|
1055
|
+
id: ResourceRecordId;
|
|
1056
|
+
include?: readonly string[];
|
|
1057
|
+
}>) => Effect.Effect<ResourceRecord<Value>, ResourceFailure>;
|
|
1058
|
+
list: (query: EntityListQuery) => Effect.Effect<EntityPage<Value>, ResourceFailure>;
|
|
1059
|
+
listMembers: (parentId: ResourceRecordId, field: string, query: EntityListQuery) => Effect.Effect<EntityPage<EntityMemberValue>, ResourceFailure>;
|
|
1060
|
+
create: (input: EntityCreateInput<Create>) => Effect.Effect<ResourceRecord<Value>, ResourceFailure>;
|
|
1061
|
+
update: (input: EntityUpdateInput<Patch>) => Effect.Effect<ResourceRecord<Value>, ResourceFailure>;
|
|
1062
|
+
delete: (input: EntityDeleteInput) => Effect.Effect<ResourceRecord<Value>, ResourceFailure>;
|
|
1063
|
+
upload: (input: EntityUploadInput) => Effect.Effect<EntityUploadSlot, ResourceFailure>;
|
|
1064
|
+
}>;
|
|
1065
|
+
type ResourcesValue = Readonly<{
|
|
1066
|
+
/** The entity client of `definition`; a bad destination dies with `TypeError`. */
|
|
1067
|
+
bind: <Value, Create = Value, Patch = Partial<Value>>(definition: ResourceDefinition<Value, Create, Patch>) => ResourceEntityClient<Value, Create, Patch>;
|
|
1068
|
+
}>;
|
|
1069
|
+
declare const Resources_base: Context.ServiceClass<Resources, "@collective-intelligence/external-apps-client-sdk/Resources", Readonly<{
|
|
1070
|
+
/** The entity client of `definition`; a bad destination dies with `TypeError`. */
|
|
1071
|
+
bind: <Value, Create = Value, Patch = Partial<Value>>(definition: ResourceDefinition<Value, Create, Patch>) => ResourceEntityClient<Value, Create, Patch>;
|
|
1072
|
+
}>>;
|
|
1073
|
+
declare class Resources extends Resources_base {}
|
|
1074
|
+
type ResourcesLayerOptions = Readonly<{
|
|
1075
|
+
authentication: ProxyAuthentication;
|
|
1076
|
+
/** The HTTP destination of each Resource Definition, by its id. */
|
|
1077
|
+
destination: (resourceId: string) => EntityHttpDestination;
|
|
1078
|
+
fetch?: ClientFetch;
|
|
1079
|
+
requestId?: () => string;
|
|
1080
|
+
}>;
|
|
1081
|
+
/** `Resources` over the entity HTTP routes of `destination`. */
|
|
1082
|
+
declare const layer: (options: ResourcesLayerOptions) => Layer.Layer<Resources, never, never>;
|
|
1083
|
+
/** `layer` with options that Effect `Config` reads. */
|
|
1084
|
+
declare const layerConfig: (config: Config.Wrap<ResourcesLayerOptions>) => Layer.Layer<Resources, Config.ConfigError, never>;
|
|
1085
|
+
type ResourcesFromEntityTransportOptions = Readonly<{
|
|
1086
|
+
requestId?: () => string;
|
|
1087
|
+
transport: EntityTransport;
|
|
1088
|
+
}>;
|
|
1089
|
+
/**
|
|
1090
|
+
* `Resources` over an `EntityTransport` of the app, as
|
|
1091
|
+
* `createResourceClient` with `protocol: "entity"`. A rejection of the
|
|
1092
|
+
* transport fails with `CiTransportError`.
|
|
1093
|
+
*/
|
|
1094
|
+
declare const layerFromEntityTransport: (options: ResourcesFromEntityTransportOptions) => Layer.Layer<Resources, never, never>;
|
|
1095
|
+
/**
|
|
1096
|
+
* The legacy resource client of one Resource Definition for `./effect`,
|
|
1097
|
+
* with the lifecycle operations. It fails as a `Resources` client does.
|
|
1098
|
+
*/
|
|
1099
|
+
type LegacyResourceClient<Entity, Create, Update> = Readonly<{
|
|
1100
|
+
create: (input: ResourceCreateInput<Create>) => Effect.Effect<ResourceRecord<Entity>, ResourceFailure>;
|
|
1101
|
+
definition: ResourceDefinition<Entity, Create, Update>;
|
|
1102
|
+
get: (input: Readonly<{
|
|
1103
|
+
id: ResourceRecordId;
|
|
1104
|
+
includeDeleted?: boolean;
|
|
1105
|
+
}>) => Effect.Effect<ResourceRecord<Entity>, ResourceFailure>;
|
|
1106
|
+
hardDelete: (input: ResourceLifecycleInput) => Effect.Effect<void, ResourceFailure>;
|
|
1107
|
+
list: (query: ResourceListQuery) => Effect.Effect<ResourceListResult<Entity>, ResourceFailure>;
|
|
1108
|
+
restore: (input: ResourceLifecycleInput) => Effect.Effect<ResourceRecord<Entity>, ResourceFailure>;
|
|
1109
|
+
softDelete: (input: ResourceLifecycleInput) => Effect.Effect<ResourceRecord<Entity>, ResourceFailure>;
|
|
1110
|
+
update: (input: ResourceMutationInput<Update>) => Effect.Effect<ResourceRecord<Entity>, ResourceFailure>;
|
|
1111
|
+
}>;
|
|
1112
|
+
type LegacyResourcesValue = Readonly<{
|
|
1113
|
+
/** The legacy client of `definition` over the `ResourceTransport` of the layer. */
|
|
1114
|
+
bind: <Entity, Create = Entity, Update = Partial<Entity>>(definition: ResourceDefinition<Entity, Create, Update>) => LegacyResourceClient<Entity, Create, Update>;
|
|
1115
|
+
}>;
|
|
1116
|
+
declare const LegacyResources_base: Context.ServiceClass<LegacyResources, "@collective-intelligence/external-apps-client-sdk/LegacyResources", Readonly<{
|
|
1117
|
+
/** The legacy client of `definition` over the `ResourceTransport` of the layer. */
|
|
1118
|
+
bind: <Entity, Create = Entity, Update = Partial<Entity>>(definition: ResourceDefinition<Entity, Create, Update>) => LegacyResourceClient<Entity, Create, Update>;
|
|
1119
|
+
}>>;
|
|
1120
|
+
/** The `./effect` form of `createResourceClient` over a `ResourceTransport`. */
|
|
1121
|
+
declare class LegacyResources extends LegacyResources_base {}
|
|
1122
|
+
type LegacyResourcesLayerOptions = Readonly<{
|
|
1123
|
+
requestId?: () => string;
|
|
1124
|
+
transport: ResourceTransport;
|
|
1125
|
+
}>;
|
|
1126
|
+
/** `LegacyResources` over the `ResourceTransport` of `options`. */
|
|
1127
|
+
declare const layerLegacy: (options: LegacyResourcesLayerOptions) => Layer.Layer<LegacyResources, never, never>;
|
|
1128
|
+
/** `layerLegacy` with options that Effect `Config` reads. */
|
|
1129
|
+
declare const layerLegacyConfig: (config: Config.Wrap<LegacyResourcesLayerOptions>) => Layer.Layer<LegacyResources, Config.ConfigError, never>;
|
|
938
1130
|
type EntityHttpDestination = Readonly<{
|
|
939
1131
|
kind: "gateway";
|
|
940
1132
|
endpoint: string;
|
|
@@ -949,5 +1141,11 @@ type EntityHttpTransportOptions = Readonly<{
|
|
|
949
1141
|
authentication: ProxyAuthentication;
|
|
950
1142
|
fetch?: ClientFetch;
|
|
951
1143
|
}>;
|
|
952
|
-
|
|
953
|
-
|
|
1144
|
+
/**
|
|
1145
|
+
* The Vanilla Facade of the entity HTTP adapter, in a runtime of its own;
|
|
1146
|
+
* `close` disposes it.
|
|
1147
|
+
*/
|
|
1148
|
+
declare const createEntityHttpTransport: (options: EntityHttpTransportOptions) => EntityTransport & Readonly<{
|
|
1149
|
+
close: () => Promise<void>;
|
|
1150
|
+
}>;
|
|
1151
|
+
export { ResourceJsonValue as $, layerFederatedConfig as $t, EntityOperationResult as A, ClientOperationOutput as At, PortableResourceSchema as B, KnowledgeQuery as Bt, EntityDeleteInput as C, JsonValue as Ct, EntityListQuery as D, ClientOperationId as Dt, EntityFileWrite as E, ClientOperationDefinition as Et, EntityTransport as F, AgentInvokeTarget as Ft, ResourceCursor as G, FederatedAuth as Gt, ResourceClient as H, SearchQuery as Ht, EntityUpdateInput as I, ApplicationRole as It, ResourceErrorCode as J, FederatedSessionIdentity as Jt, ResourceDefinition as K, FederatedAuthOptions as Kt, EntityUploadInput as L, ConversationContinueTarget as Lt, EntityProtocol as M, TypedOperationExecutor as Mt, EntityReadLimitDetails as N, clientOperationIds as Nt, EntityMemberValue as O, ClientOperationInput as Ot, EntityRequest as P, isClientOperationId as Pt, ResourceIdentityField as Q, layerFederated as Qt, EntityUploadSlot as R, ConversationHistory as Rt, EntityCreateInput as S, CiResult as St, EntityFileValue as T, OperationSuccess as Tt, ResourceCreateInput as U, WorkflowInvokeTarget as Ut, ResourceCapabilities as V, QueryFilter as Vt, ResourceCreateRequest as W, ClientFetch as Wt, ResourceGetRequest as X, FederatedAuth$1 as Xt, ResourceFilter as Y, createFederatedAuth as Yt, ResourceId as Z, FederatedAuthValue as Zt, layerLegacyConfig as _, ProxyAuthentication as _t, LegacyResources as a, CiErrorCode$1 as an, ResourceMutationInput as at, createResourceClient as b, CiError as bt, ResourceEntityClient as c, FederatedAuthErrorCode as cn, ResourceRecord as ct, ResourcesLayerOptions as d, ResourceResult as dt, layerServerSession as en, ResourceLifecycleInput as et, ResourcesValue as f, ResourceRevision as ft, layerLegacy as g, ResourceUpdateRequest as gt, layerFromEntityTransport as h, ResourceTransportRequest as ht, LegacyResourceClient as i, CiError$1 as in, ResourceListResult as it, EntityPage as j, OperationExecutionOptions as jt, EntityOperation as k, ClientOperationMap as kt, Resources as l, ResourceRecordId as lt, layerConfig as m, ResourceTransport as mt, EntityHttpTransportOptions as n, ServerSessionAuthOptions as nn, ResourceListQuery as nt, LegacyResourcesLayerOptions as o, CiTransportError as on, ResourcePagination as ot, layer as p, ResourceSort as pt, ResourceError as q, FederatedAuthState as qt, createEntityHttpTransport as r, createServerSessionAuth as rn, ResourceListRequest as rt, LegacyResourcesValue as s, FederatedAuthError as sn, ResourcePaginationMode as st, EntityHttpDestination as t, layerServerSessionConfig as tn, ResourceLifecycleRequest as tt, ResourcesFromEntityTransportOptions as u, ResourceRequestOptions as ut, createEntityProtocol as v, ProxyTransportOptions as vt, EntityFileFieldWrite as w, OperationRequest as wt, EntityClient as x, CiErrorCode as xt, isEntityReadLimitError as y, createProxyTransport as yt, IdempotencyKey as z, JsonObject as zt };
|
package/dist/resources.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as ResourceJsonValue, A as EntityOperationResult, B as PortableResourceSchema, C as EntityDeleteInput, D as EntityListQuery, E as EntityFileWrite, F as EntityTransport, G as ResourceCursor, H as ResourceClient, I as EntityUpdateInput, J as ResourceErrorCode, K as ResourceDefinition, L as EntityUploadInput, M as EntityProtocol, N as EntityReadLimitDetails, O as EntityMemberValue, P as EntityRequest, Q as ResourceIdentityField, R as EntityUploadSlot, S as EntityCreateInput, T as EntityFileValue, U as ResourceCreateInput, V as ResourceCapabilities, W as ResourceCreateRequest, X as ResourceGetRequest, Y as ResourceFilter, Z as ResourceId, at as ResourceMutationInput, b as createResourceClient, ct as ResourceRecord, dt as ResourceResult, et as ResourceLifecycleInput, ft as ResourceRevision, gt as ResourceUpdateRequest, ht as ResourceTransportRequest, it as ResourceListResult, j as EntityPage, k as EntityOperation, lt as ResourceRecordId, mt as ResourceTransport, n as EntityHttpTransportOptions, nt as ResourceListQuery, ot as ResourcePagination, pt as ResourceSort, q as ResourceError, r as createEntityHttpTransport, rt as ResourceListRequest, st as ResourcePaginationMode, t as EntityHttpDestination, tt as ResourceLifecycleRequest, ut as ResourceRequestOptions, v as createEntityProtocol, w as EntityFileFieldWrite, x as EntityClient, y as isEntityReadLimitError, z as IdempotencyKey } from "./resources-tBGn1Exi.js";
|
|
2
2
|
export { type EntityClient, type EntityCreateInput, type EntityDeleteInput, type EntityFileFieldWrite, type EntityFileValue, type EntityFileWrite, type EntityHttpDestination, type EntityHttpTransportOptions, type EntityListQuery, type EntityMemberValue, type EntityOperation, type EntityOperationResult, type EntityPage, type EntityProtocol, type EntityReadLimitDetails, type EntityRequest, type EntityTransport, type EntityUpdateInput, type EntityUploadInput, type EntityUploadSlot, type IdempotencyKey, type PortableResourceSchema, type ResourceCapabilities, type ResourceClient, type ResourceCreateInput, type ResourceCreateRequest, type ResourceCursor, type ResourceDefinition, type ResourceError, type ResourceErrorCode, type ResourceFilter, type ResourceGetRequest, type ResourceId, type ResourceIdentityField, type ResourceJsonValue, type ResourceLifecycleInput, type ResourceLifecycleRequest, type ResourceListQuery, type ResourceListRequest, type ResourceListResult, type ResourceMutationInput, type ResourcePagination, type ResourcePaginationMode, type ResourceRecord, type ResourceRecordId, type ResourceRequestOptions, type ResourceResult, type ResourceRevision, type ResourceSort, type ResourceTransport, type ResourceTransportRequest, type ResourceUpdateRequest, createEntityHttpTransport, createEntityProtocol, createResourceClient, isEntityReadLimitError };
|
package/dist/resources.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as createEntityHttpTransport, m as isEntityReadLimitError, p as createEntityProtocol } from "./service-C7kswu6e.js";
|
|
2
|
+
import { t as createResourceClient } from "./resources-DT-KqPTd.js";
|
|
2
3
|
export { createEntityHttpTransport, createEntityProtocol, createResourceClient, isEntityReadLimitError };
|