@collective-intelligence/external-apps-client-sdk 0.1.39 → 0.2.0
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 +2 -2
- package/dist/effect.js +2 -2
- package/dist/{index-DdmAyX_o.d.ts → index-CAYSljTO.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/{resources-Bz9fYAWz.d.ts → resources-CL3ZWaWz.d.ts} +63 -4
- package/dist/{resources-C87ZTpv3.js → resources-DJ1cTUBp.js} +5 -1
- package/dist/resources.d.ts +2 -2
- package/dist/resources.js +3 -3
- package/dist/{service-BGqbpJD2.js → service-8gveUQPI.js} +141 -54
- package/dist/{service-DAM3rze2.js → service-BJjQFasg.js} +1 -1
- package/package.json +2 -2
package/dist/effect.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as RealtimeTopicFilter, B as layerProxyConfig, D as RunsValue, E as Runs, F as ExecuteResult, I as layerDirect, L as layerDirectConfig, N as CiClient, O as layer$4, P as CiClientValue, Q as RealtimeTopic, R as layerFromExecutor, T as RunFollowOptions, Z as RealtimeChange, f as DelegatedApplicationRuntimeOptions, j as CiStreamPage$1, p as DelegatedRuntimeState, w as DEFAULT_FOLLOW_RUN_DEADLINE_MS, z as layerProxy } from "./index-
|
|
1
|
+
import { Zt as ClientFetch, _ as layerLegacy, a as LegacyResourceClient, an as layerFederated, c as LegacyResourcesValue, cn as layerServerSessionConfig, d as ResourcesFromEntityTransportOptions, dn as CiError, f as ResourcesLayerOptions, fn as CiErrorCode, g as layerFromEntityTransport, h as layerConfig$3, hn as FederatedAuthErrorCode, i as makeEntityHttpExecute, in as FederatedAuthValue, l as ResourceEntityClient, m as layer$3, mn as FederatedAuthError, o as LegacyResources, on as layerFederatedConfig, p as ResourcesValue, pn as CiTransportError, rn as FederatedAuth, s as LegacyResourcesLayerOptions, sn as layerServerSession, u as Resources, v as layerLegacyConfig } from "./resources-CL3ZWaWz.js";
|
|
2
|
+
import { $ as RealtimeTopicFilter, B as layerProxyConfig, D as RunsValue, E as Runs, F as ExecuteResult, I as layerDirect, L as layerDirectConfig, N as CiClient, O as layer$4, P as CiClientValue, Q as RealtimeTopic, R as layerFromExecutor, T as RunFollowOptions, Z as RealtimeChange, f as DelegatedApplicationRuntimeOptions, j as CiStreamPage$1, p as DelegatedRuntimeState, w as DEFAULT_FOLLOW_RUN_DEADLINE_MS, z as layerProxy } from "./index-CAYSljTO.js";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
import * as Config from "effect/Config";
|
|
5
5
|
import * as Context from "effect/Context";
|
package/dist/effect.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import { C as RealtimeClient, D as subscribe, T as layerConfig$2, _ as layerDirect, a as layer$1, b as layerProxy, c as layerFederated, d as layerServerSessionConfig, f as DEFAULT_FOLLOW_RUN_DEADLINE_MS, g as CiClient, h as layer$4, i as FixedWorkflows, l as layerFederatedConfig, n as layer, o as layerConfig$1, p as Runs, r as layerConfig, s as FederatedAuth, t as DelegatedRuntime, u as layerServerSession, v as layerDirectConfig, w as layer$2, x as layerProxyConfig, y as layerFromExecutor } from "./service-
|
|
1
|
+
import { D as CiTransportError, E as CiErrorCode, O as FederatedAuthError, T as CiError, a as layerConfig$3, c as layerLegacyConfig, f as makeEntityHttpExecute, i as layer$3, k as FederatedAuthErrorCode, n as Resources, o as layerFromEntityTransport, s as layerLegacy, t as LegacyResources } from "./service-8gveUQPI.js";
|
|
2
|
+
import { C as RealtimeClient, D as subscribe, T as layerConfig$2, _ as layerDirect, a as layer$1, b as layerProxy, c as layerFederated, d as layerServerSessionConfig, f as DEFAULT_FOLLOW_RUN_DEADLINE_MS, g as CiClient, h as layer$4, i as FixedWorkflows, l as layerFederatedConfig, n as layer, o as layerConfig$1, p as Runs, r as layerConfig, s as FederatedAuth, t as DelegatedRuntime, u as layerServerSession, v as layerDirectConfig, w as layer$2, x as layerProxyConfig, y as layerFromExecutor } from "./service-BJjQFasg.js";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
/**
|
|
5
5
|
* The wire Schemas of the CI envelopes that `./effect` exports. The Type of
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as
|
|
1
|
+
import { At as JsonValue, Dt as CiError$2, Ft as ClientOperationInput, Gt as ConversationHistory, Ht as AgentInvokeTarget, It as ClientOperationMap, Jt as QueryFilter, Kt as JsonObject, Lt as ClientOperationOutput, Nt as ClientOperationDefinition, Pt as ClientOperationId, Rt as OperationExecutionOptions, Tt as ProxyTransportOptions, Ut as ApplicationRole, Wt as ConversationContinueTarget, Xt as WorkflowInvokeTarget, Yt as SearchQuery, Zt as ClientFetch, dn as CiError$1, en as FederatedAuthState, kt as CiResult, pn as CiTransportError, qt as KnowledgeQuery, tn as FederatedSessionIdentity, zt as TypedOperationExecutor } from "./resources-CL3ZWaWz.js";
|
|
2
2
|
import "effect/Clock";
|
|
3
3
|
import * as Config from "effect/Config";
|
|
4
4
|
import * as Context from "effect/Context";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as RealtimeTopicFilter, A as CiStreamEvent, C as followRun, G as RealtimeStreamEnd, H as createDirectTransport, J as createFetchEventSourceFactory, K as RealtimeStreamEvent, M as nextStreamCursor, Q as RealtimeTopic, S as FollowRunSource, U as RealtimeEventSource, V as DirectTransportOptions, W as RealtimeEventSourceFactory, X as RealtimeWindow, Y as RealtimeDocument, Z as RealtimeChange, _ as ClientSdkEntrypoint, a as RealtimeClientStatus, b as createClient, c as FixedWorkflowClient, d as DelegatedApplicationRuntime, et as realtimeTopicKey, f as DelegatedApplicationRuntimeOptions, g as ClientSdkClient, h as ClientDomains, i as RealtimeClientState, j as CiStreamPage, k as CiRunCancellation, l as FixedWorkflowClientOptions, m as createDelegatedApplicationRuntime, n as RealtimeClient, o as RealtimeTimers, p as DelegatedRuntimeState, q as RealtimeStreamHandlers, r as RealtimeClientOptions, s as createRealtimeClient, t as CiError, u as createFixedWorkflowClient, v as OrganizationClient, w as DEFAULT_FOLLOW_RUN_DEADLINE_MS, x as FollowRunOptions, y as clientSdkProtocolVersion } from "./index-
|
|
3
|
-
export { CiError, type CiErrorCode, type CiResult, type CiRunCancellation, type CiStreamEvent, type CiStreamPage, CiTransportError, type ClientDomains, type ClientFetch, type ClientOperationDefinition, type ClientOperationId, type ClientOperationInput, type ClientOperationMap, type ClientOperationOutput, type ClientSdkClient, type ClientSdkEntrypoint, DEFAULT_FOLLOW_RUN_DEADLINE_MS, type DelegatedApplicationRuntime, type DelegatedApplicationRuntimeOptions, type DelegatedRuntimeState, type DirectTransportOptions, 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 EntityRestoreInput, type EntityTransport, type EntityUpdateInput, type EntityUploadInput, type EntityUploadSlot, type FederatedAuth, FederatedAuthError, type FederatedAuthErrorCode, type FederatedAuthOptions, type FederatedAuthState, type FederatedSessionIdentity, type FixedWorkflowClient, type FixedWorkflowClientOptions, type FollowRunOptions, type FollowRunSource, type IdempotencyKey, type JsonObject, type JsonValue, type KnowledgeQuery, type OperationExecutionOptions, type OperationRequest, type OperationSuccess, type OrganizationClient, type PortableResourceSchema, type ProxyAuthentication, type ProxyTransportOptions, type QueryFilter, type RealtimeChange, type RealtimeClient, type RealtimeClientOptions, type RealtimeClientState, type RealtimeClientStatus, type RealtimeDocument, type RealtimeEventSource, type RealtimeEventSourceFactory, type RealtimeStreamEnd, type RealtimeStreamEvent, type RealtimeStreamHandlers, type RealtimeTimers, type RealtimeTopic, type RealtimeTopicFilter, type RealtimeWindow, 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, type SearchQuery, type ServerSessionAuthOptions, type TypedOperationExecutor, type WorkflowInvokeTarget, clientOperationIds, clientSdkProtocolVersion, createClient, createDelegatedApplicationRuntime, createDirectTransport, createEntityHttpTransport, createEntityProtocol, createFederatedAuth, createFetchEventSourceFactory, createFixedWorkflowClient, createProxyTransport, createRealtimeClient, createResourceClient, createServerSessionAuth, followRun, isClientOperationId, isEntityReadLimitError, nextStreamCursor, realtimeTopicKey };
|
|
1
|
+
import { $ as ResourceDefinition, $t as FederatedAuthOptions, A as EntityFileFieldWrite, At as JsonValue, B as EntityRequest, Bt as clientOperationIds, C as EntityBatchInput, Ct as ResourceUpdateRequest, D as EntityClient, E as EntityBatchRefusedDetails, Et as createProxyTransport, F as EntityOperation, Ft as ClientOperationInput, G as EntityUploadSlot, H as EntityTransport, I as EntityOperationResult, It as ClientOperationMap, J as ResourceCapabilities, Jt as QueryFilter, K as IdempotencyKey, Kt as JsonObject, L as EntityPage, Lt as ClientOperationOutput, M as EntityFileWrite, Mt as OperationSuccess, N as EntityListQuery, Nt as ClientOperationDefinition, O as EntityCreateInput, Ot as CiErrorCode, P as EntityMemberValue, Pt as ClientOperationId, Q as ResourceCursor, Qt as FederatedAuth, R as EntityProtocol, Rt as OperationExecutionOptions, S as createResourceClient, St as ResourceTransportRequest, T as EntityBatchRefusal, Tt as ProxyTransportOptions, U as EntityUpdateInput, V as EntityRestoreInput, Vt as isClientOperationId, W as EntityUploadInput, X as ResourceCreateInput, Xt as WorkflowInvokeTarget, Y as ResourceClient, Yt as SearchQuery, Z as ResourceCreateRequest, Zt as ClientFetch, _t as ResourceRequestOptions, at as ResourceIdentityField, b as isEntityBatchRefusedError, bt as ResourceSort, ct as ResourceLifecycleRequest, dt as ResourceListResult, en as FederatedAuthState, et as ResourceError, ft as ResourceMutationInput, gt as ResourceRecordId, hn as FederatedAuthErrorCode, ht as ResourceRecord, it as ResourceId, j as EntityFileValue, jt as OperationRequest, k as EntityDeleteInput, kt as CiResult, ln as ServerSessionAuthOptions, lt as ResourceListQuery, mn as FederatedAuthError, mt as ResourcePaginationMode, n as EntityHttpTransportOptions, nn as createFederatedAuth, nt as ResourceFilter, ot as ResourceJsonValue, pn as CiTransportError, pt as ResourcePagination, q as PortableResourceSchema, qt as KnowledgeQuery, r as createEntityHttpTransport, rt as ResourceGetRequest, st as ResourceLifecycleInput, t as EntityHttpDestination, tn as FederatedSessionIdentity, tt as ResourceErrorCode, un as createServerSessionAuth, ut as ResourceListRequest, vt as ResourceResult, w as EntityBatchOp, wt as ProxyAuthentication, x as isEntityReadLimitError, xt as ResourceTransport, y as createEntityProtocol, yt as ResourceRevision, z as EntityReadLimitDetails, zt as TypedOperationExecutor } from "./resources-CL3ZWaWz.js";
|
|
2
|
+
import { $ as RealtimeTopicFilter, A as CiStreamEvent, C as followRun, G as RealtimeStreamEnd, H as createDirectTransport, J as createFetchEventSourceFactory, K as RealtimeStreamEvent, M as nextStreamCursor, Q as RealtimeTopic, S as FollowRunSource, U as RealtimeEventSource, V as DirectTransportOptions, W as RealtimeEventSourceFactory, X as RealtimeWindow, Y as RealtimeDocument, Z as RealtimeChange, _ as ClientSdkEntrypoint, a as RealtimeClientStatus, b as createClient, c as FixedWorkflowClient, d as DelegatedApplicationRuntime, et as realtimeTopicKey, f as DelegatedApplicationRuntimeOptions, g as ClientSdkClient, h as ClientDomains, i as RealtimeClientState, j as CiStreamPage, k as CiRunCancellation, l as FixedWorkflowClientOptions, m as createDelegatedApplicationRuntime, n as RealtimeClient, o as RealtimeTimers, p as DelegatedRuntimeState, q as RealtimeStreamHandlers, r as RealtimeClientOptions, s as createRealtimeClient, t as CiError, u as createFixedWorkflowClient, v as OrganizationClient, w as DEFAULT_FOLLOW_RUN_DEADLINE_MS, x as FollowRunOptions, y as clientSdkProtocolVersion } from "./index-CAYSljTO.js";
|
|
3
|
+
export { CiError, type CiErrorCode, type CiResult, type CiRunCancellation, type CiStreamEvent, type CiStreamPage, CiTransportError, type ClientDomains, type ClientFetch, type ClientOperationDefinition, type ClientOperationId, type ClientOperationInput, type ClientOperationMap, type ClientOperationOutput, type ClientSdkClient, type ClientSdkEntrypoint, DEFAULT_FOLLOW_RUN_DEADLINE_MS, type DelegatedApplicationRuntime, type DelegatedApplicationRuntimeOptions, type DelegatedRuntimeState, type DirectTransportOptions, type EntityBatchInput, type EntityBatchOp, type EntityBatchRefusal, type EntityBatchRefusedDetails, 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 EntityRestoreInput, type EntityTransport, type EntityUpdateInput, type EntityUploadInput, type EntityUploadSlot, type FederatedAuth, FederatedAuthError, type FederatedAuthErrorCode, type FederatedAuthOptions, type FederatedAuthState, type FederatedSessionIdentity, type FixedWorkflowClient, type FixedWorkflowClientOptions, type FollowRunOptions, type FollowRunSource, type IdempotencyKey, type JsonObject, type JsonValue, type KnowledgeQuery, type OperationExecutionOptions, type OperationRequest, type OperationSuccess, type OrganizationClient, type PortableResourceSchema, type ProxyAuthentication, type ProxyTransportOptions, type QueryFilter, type RealtimeChange, type RealtimeClient, type RealtimeClientOptions, type RealtimeClientState, type RealtimeClientStatus, type RealtimeDocument, type RealtimeEventSource, type RealtimeEventSourceFactory, type RealtimeStreamEnd, type RealtimeStreamEvent, type RealtimeStreamHandlers, type RealtimeTimers, type RealtimeTopic, type RealtimeTopicFilter, type RealtimeWindow, 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, type SearchQuery, type ServerSessionAuthOptions, type TypedOperationExecutor, type WorkflowInvokeTarget, clientOperationIds, clientSdkProtocolVersion, createClient, createDelegatedApplicationRuntime, createDirectTransport, createEntityHttpTransport, createEntityProtocol, createFederatedAuth, createFetchEventSourceFactory, createFixedWorkflowClient, createProxyTransport, createRealtimeClient, createResourceClient, createServerSessionAuth, followRun, isClientOperationId, isEntityBatchRefusedError, isEntityReadLimitError, nextStreamCursor, realtimeTopicKey };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as layerFromFactory, E as makeConnection, M as currentLink, N as createFetchEventSourceFactory, O as realtimeTopicKey, S as make, a as layer$2, c as layerFederated, f as DEFAULT_FOLLOW_RUN_DEADLINE_MS, g as CiClient, h as layer, i as FixedWorkflows, j as layerBrowser, k as layer$3, m as followSource, n as layer$1, p as Runs, s as FederatedAuth, t as DelegatedRuntime, u as layerServerSession, y as layerFromExecutor } from "./service-
|
|
3
|
-
import { t as createResourceClient } from "./resources-
|
|
1
|
+
import { A as errors_exports, C as isClientOperationId, D as CiTransportError, O as FederatedAuthError, b as proxyHttpOptions, d as createEntityHttpTransport, g as isEntityReadLimitError, h as isEntityBatchRefusedError, m as createEntityProtocol, v as directHttpOptions, w as toCiResult, x as clientOperationIds, y as makeHttpExecute } from "./service-8gveUQPI.js";
|
|
2
|
+
import { A as layerFromFactory, E as makeConnection, M as currentLink, N as createFetchEventSourceFactory, O as realtimeTopicKey, S as make, a as layer$2, c as layerFederated, f as DEFAULT_FOLLOW_RUN_DEADLINE_MS, g as CiClient, h as layer, i as FixedWorkflows, j as layerBrowser, k as layer$3, m as followSource, n as layer$1, p as Runs, s as FederatedAuth, t as DelegatedRuntime, u as layerServerSession, y as layerFromExecutor } from "./service-BJjQFasg.js";
|
|
3
|
+
import { t as createResourceClient } from "./resources-DJ1cTUBp.js";
|
|
4
4
|
import * as Clock from "effect/Clock";
|
|
5
5
|
import * as Context from "effect/Context";
|
|
6
6
|
import * as Duration from "effect/Duration";
|
|
@@ -472,4 +472,4 @@ const createRealtimeClient = (options) => {
|
|
|
472
472
|
};
|
|
473
473
|
/** The class of an Expected Error that CI returns. */
|
|
474
474
|
const { CiError } = errors_exports;
|
|
475
|
-
export { CiError, CiTransportError, DEFAULT_FOLLOW_RUN_DEADLINE_MS, FederatedAuthError, clientOperationIds, clientSdkProtocolVersion, createClient, createDelegatedApplicationRuntime, createDirectTransport, createEntityHttpTransport, createEntityProtocol, createFederatedAuth, createFetchEventSourceFactory, createFixedWorkflowClient, createProxyTransport, createRealtimeClient, createResourceClient, createServerSessionAuth, followRun, isClientOperationId, isEntityReadLimitError, nextStreamCursor, realtimeTopicKey };
|
|
475
|
+
export { CiError, CiTransportError, DEFAULT_FOLLOW_RUN_DEADLINE_MS, FederatedAuthError, clientOperationIds, clientSdkProtocolVersion, createClient, createDelegatedApplicationRuntime, createDirectTransport, createEntityHttpTransport, createEntityProtocol, createFederatedAuth, createFetchEventSourceFactory, createFixedWorkflowClient, createProxyTransport, createRealtimeClient, createResourceClient, createServerSessionAuth, followRun, isClientOperationId, isEntityBatchRefusedError, isEntityReadLimitError, nextStreamCursor, realtimeTopicKey };
|
|
@@ -701,6 +701,8 @@ type ResourceIdentityField = Readonly<{
|
|
|
701
701
|
type: "number" | "string";
|
|
702
702
|
}>;
|
|
703
703
|
type ResourceCapabilities = Readonly<{
|
|
704
|
+
/** All-or-nothing entity batches; each op also needs its own capability. */
|
|
705
|
+
batch?: boolean;
|
|
704
706
|
create?: boolean;
|
|
705
707
|
/** Common entity deletion is always soft deletion. */
|
|
706
708
|
delete?: boolean;
|
|
@@ -921,7 +923,7 @@ interface ResourceClient<Entity, Create = Entity, Update = Partial<Entity>> {
|
|
|
921
923
|
readonly update: (input: ResourceMutationInput<Update>, options?: ResourceRequestOptions) => Promise<ResourceResult<ResourceRecord<Entity>>>;
|
|
922
924
|
}
|
|
923
925
|
/** Common entity operations. Generic resource lifecycle/cursor APIs remain separate. */
|
|
924
|
-
type EntityOperation = "list_members" | "list" | "get" | "create" | "update" | "delete" | "restore" | "upload";
|
|
926
|
+
type EntityOperation = "list_members" | "list" | "get" | "create" | "update" | "delete" | "restore" | "upload" | "batch";
|
|
925
927
|
type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
|
|
926
928
|
pagination: Extract<ResourcePagination, {
|
|
927
929
|
mode: "page";
|
|
@@ -941,6 +943,46 @@ type EntityDeleteInput = ResourceLifecycleInput & Readonly<{
|
|
|
941
943
|
}>;
|
|
942
944
|
/** A restore of a soft-deleted record at the revision its delete gave. */
|
|
943
945
|
type EntityRestoreInput = EntityDeleteInput;
|
|
946
|
+
/** One op of an entity batch: the single write it stands for, without a key. */
|
|
947
|
+
type EntityBatchOp<Create = unknown, Patch = unknown> = Readonly<{
|
|
948
|
+
op: "create";
|
|
949
|
+
value: Create;
|
|
950
|
+
}> | Readonly<{
|
|
951
|
+
op: "update";
|
|
952
|
+
id: ResourceRecordId;
|
|
953
|
+
expectedRevision: ResourceRevision;
|
|
954
|
+
value: Patch;
|
|
955
|
+
}> | Readonly<{
|
|
956
|
+
op: "delete" | "restore";
|
|
957
|
+
id: ResourceRecordId;
|
|
958
|
+
expectedRevision: ResourceRevision;
|
|
959
|
+
}>;
|
|
960
|
+
/**
|
|
961
|
+
* 1 to 100 ops on the records of one resource, under one key. CI commits
|
|
962
|
+
* every op or none; the same key with the same ops replays the answer, and
|
|
963
|
+
* with other ops answers `conflict`.
|
|
964
|
+
*/
|
|
965
|
+
type EntityBatchInput<Create = unknown, Patch = unknown> = Readonly<{
|
|
966
|
+
idempotencyKey: IdempotencyKey;
|
|
967
|
+
ops: readonly EntityBatchOp<Create, Patch>[];
|
|
968
|
+
}>;
|
|
969
|
+
/** An op that CI refused; `id` is absent for a `create`. */
|
|
970
|
+
type EntityBatchRefusal = Readonly<{
|
|
971
|
+
index: number;
|
|
972
|
+
id?: ResourceRecordId;
|
|
973
|
+
reason: "conflict" | "forbidden" | "invalid_request" | "not_found";
|
|
974
|
+
}>;
|
|
975
|
+
/**
|
|
976
|
+
* The `details` of a refused batch, which CI wrote nothing for. The error
|
|
977
|
+
* `code` is the `reason` of the first refused op. `refused` holds the
|
|
978
|
+
* refused ops that CI found: CI checks the ops in stages and stops at the
|
|
979
|
+
* first stage that refuses an op, so an op that a later stage would refuse
|
|
980
|
+
* can be absent.
|
|
981
|
+
*/
|
|
982
|
+
type EntityBatchRefusedDetails = Readonly<{
|
|
983
|
+
reason: "batch_refused";
|
|
984
|
+
refused: readonly EntityBatchRefusal[];
|
|
985
|
+
}>;
|
|
944
986
|
/** A File upload request for one File field of the entity schema. */
|
|
945
987
|
type EntityUploadInput = Readonly<{
|
|
946
988
|
field: string;
|
|
@@ -1010,8 +1052,10 @@ type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIdentity &
|
|
|
1010
1052
|
operation: "restore";
|
|
1011
1053
|
}> & EntityRestoreInput) | (Readonly<{
|
|
1012
1054
|
operation: "upload";
|
|
1013
|
-
}> & EntityUploadInput)
|
|
1014
|
-
|
|
1055
|
+
}> & EntityUploadInput) | (Readonly<{
|
|
1056
|
+
operation: "batch";
|
|
1057
|
+
}> & EntityBatchInput<Create, Patch>));
|
|
1058
|
+
type EntityOperationResult<Value, Operation extends EntityOperation> = Operation extends "list_members" ? EntityPage<EntityMemberValue> : Operation extends "list" ? EntityPage<Value> : Operation extends "upload" ? EntityUploadSlot : Operation extends "batch" ? readonly ResourceRecord<Value>[] : ResourceRecord<Value>;
|
|
1015
1059
|
/** Codecs return safe typed failures without coercing values or performing I/O. */
|
|
1016
1060
|
type EntityProtocol<Value, Create = Value, Patch = Partial<Value>> = Readonly<{
|
|
1017
1061
|
decodeRequest: (input: unknown) => ResourceResult<EntityRequest<Create, Patch>>;
|
|
@@ -1042,6 +1086,15 @@ interface EntityClient<Value, Create = Value, Patch = Partial<Value>> {
|
|
|
1042
1086
|
readonly restore: (input: EntityRestoreInput) => Promise<ResourceResult<ResourceRecord<Value>>>;
|
|
1043
1087
|
/** A single-use File upload slot; requires the `upload` capability. */
|
|
1044
1088
|
readonly upload: (input: EntityUploadInput, options?: ResourceRequestOptions) => Promise<ResourceResult<EntityUploadSlot>>;
|
|
1089
|
+
/**
|
|
1090
|
+
* Commits every op or none, each by the rules of its single write;
|
|
1091
|
+
* requires the `batch` capability and the capability of each op. The
|
|
1092
|
+
* answer holds the record of each op in op order. A refused batch writes
|
|
1093
|
+
* nothing and lists the refused ops that CI found in
|
|
1094
|
+
* `EntityBatchRefusedDetails`. A second op on one record is `conflict`:
|
|
1095
|
+
* the caller cannot know the revision that the first op gives.
|
|
1096
|
+
*/
|
|
1097
|
+
readonly batch: (input: EntityBatchInput<Create, Patch>) => Promise<ResourceResult<readonly ResourceRecord<Value>[]>>;
|
|
1045
1098
|
}
|
|
1046
1099
|
type ClientOptions<Value, Create, Patch> = Readonly<{
|
|
1047
1100
|
definition: ResourceDefinition<Value, Create, Patch>;
|
|
@@ -1063,6 +1116,10 @@ declare const isEntityReadLimitError: (error: ResourceError) => error is Resourc
|
|
|
1063
1116
|
code: "invalid_request";
|
|
1064
1117
|
details: EntityReadLimitDetails;
|
|
1065
1118
|
}>;
|
|
1119
|
+
/** Narrow a decoded resource failure to a refused batch and its refused ops. */
|
|
1120
|
+
declare const isEntityBatchRefusedError: (error: ResourceError) => error is ResourceError & Readonly<{
|
|
1121
|
+
details: EntityBatchRefusedDetails;
|
|
1122
|
+
}>;
|
|
1066
1123
|
/** Common entity wire codec; transport and persistence remain with their owners. */
|
|
1067
1124
|
declare const createEntityProtocol: <Value, Create = Value, Patch = Partial<Value>>(definition: ResourceDefinition<Value, Create, Patch>) => EntityProtocol<Value, Create, Patch>;
|
|
1068
1125
|
/** One entity request as its envelope; only a transport failure fails. */
|
|
@@ -1082,6 +1139,8 @@ type ResourceEntityClient<Value, Create, Patch> = Readonly<{
|
|
|
1082
1139
|
delete: (input: EntityDeleteInput) => Effect.Effect<ResourceRecord<Value>, ResourceFailure>;
|
|
1083
1140
|
restore: (input: EntityRestoreInput) => Effect.Effect<ResourceRecord<Value>, ResourceFailure>;
|
|
1084
1141
|
upload: (input: EntityUploadInput) => Effect.Effect<EntityUploadSlot, ResourceFailure>;
|
|
1142
|
+
/** Every op or none; a refused batch fails with its refused ops in `details`. */
|
|
1143
|
+
batch: (input: EntityBatchInput<Create, Patch>) => Effect.Effect<readonly ResourceRecord<Value>[], ResourceFailure>;
|
|
1085
1144
|
}>;
|
|
1086
1145
|
type ResourcesValue = Readonly<{
|
|
1087
1146
|
/** The entity client of `definition`; a bad destination dies with `TypeError`. */
|
|
@@ -1179,4 +1238,4 @@ declare const makeEntityHttpExecute: (options: EntityHttpTransportOptions) => En
|
|
|
1179
1238
|
declare const createEntityHttpTransport: (options: EntityHttpTransportOptions) => EntityTransport & Readonly<{
|
|
1180
1239
|
close: () => Promise<void>;
|
|
1181
1240
|
}>;
|
|
1182
|
-
export {
|
|
1241
|
+
export { ResourceDefinition as $, FederatedAuthOptions as $t, EntityFileFieldWrite as A, JsonValue as At, EntityRequest as B, clientOperationIds as Bt, EntityBatchInput as C, ResourceUpdateRequest as Ct, EntityClient as D, CiError as Dt, EntityBatchRefusedDetails as E, createProxyTransport as Et, EntityOperation as F, ClientOperationInput as Ft, EntityUploadSlot as G, ConversationHistory as Gt, EntityTransport as H, AgentInvokeTarget as Ht, EntityOperationResult as I, ClientOperationMap as It, ResourceCapabilities as J, QueryFilter as Jt, IdempotencyKey as K, JsonObject as Kt, EntityPage as L, ClientOperationOutput as Lt, EntityFileWrite as M, OperationSuccess as Mt, EntityListQuery as N, ClientOperationDefinition as Nt, EntityCreateInput as O, CiErrorCode as Ot, EntityMemberValue as P, ClientOperationId as Pt, ResourceCursor as Q, FederatedAuth as Qt, EntityProtocol as R, OperationExecutionOptions as Rt, createResourceClient as S, ResourceTransportRequest as St, EntityBatchRefusal as T, ProxyTransportOptions as Tt, EntityUpdateInput as U, ApplicationRole as Ut, EntityRestoreInput as V, isClientOperationId as Vt, EntityUploadInput as W, ConversationContinueTarget as Wt, ResourceCreateInput as X, WorkflowInvokeTarget as Xt, ResourceClient as Y, SearchQuery as Yt, ResourceCreateRequest as Z, ClientFetch as Zt, layerLegacy as _, ResourceRequestOptions as _t, LegacyResourceClient as a, layerFederated as an, ResourceIdentityField as at, isEntityBatchRefusedError as b, ResourceSort as bt, LegacyResourcesValue as c, layerServerSessionConfig as cn, ResourceLifecycleRequest as ct, ResourcesFromEntityTransportOptions as d, CiError$1 as dn, ResourceListResult as dt, FederatedAuthState as en, ResourceError as et, ResourcesLayerOptions as f, CiErrorCode$1 as fn, ResourceMutationInput as ft, layerFromEntityTransport as g, ResourceRecordId as gt, layerConfig as h, FederatedAuthErrorCode as hn, ResourceRecord as ht, makeEntityHttpExecute as i, FederatedAuthValue as in, ResourceId as it, EntityFileValue as j, OperationRequest as jt, EntityDeleteInput as k, CiResult as kt, ResourceEntityClient as l, ServerSessionAuthOptions as ln, ResourceListQuery as lt, layer as m, FederatedAuthError as mn, ResourcePaginationMode as mt, EntityHttpTransportOptions as n, createFederatedAuth as nn, ResourceFilter as nt, LegacyResources as o, layerFederatedConfig as on, ResourceJsonValue as ot, ResourcesValue as p, CiTransportError as pn, ResourcePagination as pt, PortableResourceSchema as q, KnowledgeQuery as qt, createEntityHttpTransport as r, FederatedAuth$1 as rn, ResourceGetRequest as rt, LegacyResourcesLayerOptions as s, layerServerSession as sn, ResourceLifecycleInput as st, EntityHttpDestination as t, FederatedSessionIdentity as tn, ResourceErrorCode as tt, Resources as u, createServerSessionAuth as un, ResourceListRequest as ut, layerLegacyConfig as v, ResourceResult as vt, EntityBatchOp as w, ProxyAuthentication as wt, isEntityReadLimitError as x, ResourceTransport as xt, createEntityProtocol as y, ResourceRevision as yt, EntityReadLimitDetails as z, TypedOperationExecutor as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as CiTransportError, l as makeEntityCore, p as runEntityRequest, r as fromEntityTransport, u as makeLegacyResourceCore } from "./service-8gveUQPI.js";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
3
|
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
4
4
|
/**
|
|
@@ -24,6 +24,10 @@ const createCommonEntityClient = (options) => {
|
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
return {
|
|
27
|
+
batch: (input) => execute({
|
|
28
|
+
...input,
|
|
29
|
+
operation: "batch"
|
|
30
|
+
}),
|
|
27
31
|
close: () => runtime.dispose(),
|
|
28
32
|
create: (input) => execute({
|
|
29
33
|
...input,
|
package/dist/resources.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
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 EntityRestoreInput, 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 };
|
|
1
|
+
import { $ as ResourceDefinition, A as EntityFileFieldWrite, B as EntityRequest, C as EntityBatchInput, Ct as ResourceUpdateRequest, D as EntityClient, E as EntityBatchRefusedDetails, F as EntityOperation, G as EntityUploadSlot, H as EntityTransport, I as EntityOperationResult, J as ResourceCapabilities, K as IdempotencyKey, L as EntityPage, M as EntityFileWrite, N as EntityListQuery, O as EntityCreateInput, P as EntityMemberValue, Q as ResourceCursor, R as EntityProtocol, S as createResourceClient, St as ResourceTransportRequest, T as EntityBatchRefusal, U as EntityUpdateInput, V as EntityRestoreInput, W as EntityUploadInput, X as ResourceCreateInput, Y as ResourceClient, Z as ResourceCreateRequest, _t as ResourceRequestOptions, at as ResourceIdentityField, b as isEntityBatchRefusedError, bt as ResourceSort, ct as ResourceLifecycleRequest, dt as ResourceListResult, et as ResourceError, ft as ResourceMutationInput, gt as ResourceRecordId, ht as ResourceRecord, it as ResourceId, j as EntityFileValue, k as EntityDeleteInput, lt as ResourceListQuery, mt as ResourcePaginationMode, n as EntityHttpTransportOptions, nt as ResourceFilter, ot as ResourceJsonValue, pt as ResourcePagination, q as PortableResourceSchema, r as createEntityHttpTransport, rt as ResourceGetRequest, st as ResourceLifecycleInput, t as EntityHttpDestination, tt as ResourceErrorCode, ut as ResourceListRequest, vt as ResourceResult, w as EntityBatchOp, x as isEntityReadLimitError, xt as ResourceTransport, y as createEntityProtocol, yt as ResourceRevision, z as EntityReadLimitDetails } from "./resources-CL3ZWaWz.js";
|
|
2
|
+
export { type EntityBatchInput, type EntityBatchOp, type EntityBatchRefusal, type EntityBatchRefusedDetails, 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 EntityRestoreInput, 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, isEntityBatchRefusedError, isEntityReadLimitError };
|
package/dist/resources.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { d as createEntityHttpTransport,
|
|
2
|
-
import { t as createResourceClient } from "./resources-
|
|
3
|
-
export { createEntityHttpTransport, createEntityProtocol, createResourceClient, isEntityReadLimitError };
|
|
1
|
+
import { d as createEntityHttpTransport, g as isEntityReadLimitError, h as isEntityBatchRefusedError, m as createEntityProtocol } from "./service-8gveUQPI.js";
|
|
2
|
+
import { t as createResourceClient } from "./resources-DJ1cTUBp.js";
|
|
3
|
+
export { createEntityHttpTransport, createEntityProtocol, createResourceClient, isEntityBatchRefusedError, isEntityReadLimitError };
|
|
@@ -8043,6 +8043,18 @@ const memberQuerySchema = {
|
|
|
8043
8043
|
};
|
|
8044
8044
|
/** Narrow a decoded resource failure to its documented request-wide read limit. */
|
|
8045
8045
|
const isEntityReadLimitError = (error) => error.code === "invalid_request" && error.details?.reason === "read_limit_exceeded" && (error.details.budget === "work" || error.details.budget === "nodes" || error.details.budget === "relation_ids" || error.details.budget === "bytes");
|
|
8046
|
+
const batchRefusalReasons = [
|
|
8047
|
+
"conflict",
|
|
8048
|
+
"forbidden",
|
|
8049
|
+
"invalid_request",
|
|
8050
|
+
"not_found"
|
|
8051
|
+
];
|
|
8052
|
+
const isBatchRefusal = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && "index" in value && Number.isInteger(value.index) && "reason" in value && batchRefusalReasons.some((reason) => reason === value.reason);
|
|
8053
|
+
/** Narrow a decoded resource failure to a refused batch and its refused ops. */
|
|
8054
|
+
const isEntityBatchRefusedError = (error) => {
|
|
8055
|
+
const refused = error.details?.refused;
|
|
8056
|
+
return error.details?.reason === "batch_refused" && Array.isArray(refused) && refused.length > 0 && refused.every(isBatchRefusal);
|
|
8057
|
+
};
|
|
8046
8058
|
const operationKey = {
|
|
8047
8059
|
pattern: "^[\\w.-]{1,256}$",
|
|
8048
8060
|
type: "string"
|
|
@@ -8052,6 +8064,8 @@ const uploadText = {
|
|
|
8052
8064
|
minLength: 1,
|
|
8053
8065
|
type: "string"
|
|
8054
8066
|
};
|
|
8067
|
+
/** The most ops one entity batch takes. */
|
|
8068
|
+
const batchLimit = 100;
|
|
8055
8069
|
const requestSchema = (definition, operation, properties, optional = {}) => ({
|
|
8056
8070
|
additionalProperties: false,
|
|
8057
8071
|
properties: {
|
|
@@ -8090,6 +8104,10 @@ const createEntityProtocol = (definition) => {
|
|
|
8090
8104
|
strict: false
|
|
8091
8105
|
});
|
|
8092
8106
|
(0, import_dist.default)(ajv);
|
|
8107
|
+
const updateValue = { allOf: [{ $ref: "#/$defs/update" }, {
|
|
8108
|
+
minProperties: 1,
|
|
8109
|
+
type: "object"
|
|
8110
|
+
}] };
|
|
8093
8111
|
const validate = ajv.compile({
|
|
8094
8112
|
$defs: {
|
|
8095
8113
|
create: scopeSchema(definition.schemas.create ?? false, "#/$defs/create"),
|
|
@@ -8114,10 +8132,7 @@ const createEntityProtocol = (definition) => {
|
|
|
8114
8132
|
expectedRevision: identifier,
|
|
8115
8133
|
id: identifier,
|
|
8116
8134
|
idempotencyKey: operationKey,
|
|
8117
|
-
value:
|
|
8118
|
-
minProperties: 1,
|
|
8119
|
-
type: "object"
|
|
8120
|
-
}] }
|
|
8135
|
+
value: updateValue
|
|
8121
8136
|
}),
|
|
8122
8137
|
requestSchema(definition, "delete", {
|
|
8123
8138
|
expectedRevision: identifier,
|
|
@@ -8137,6 +8152,31 @@ const createEntityProtocol = (definition) => {
|
|
|
8137
8152
|
minimum: 0,
|
|
8138
8153
|
type: "integer"
|
|
8139
8154
|
}
|
|
8155
|
+
}),
|
|
8156
|
+
requestSchema(definition, "batch", {
|
|
8157
|
+
idempotencyKey: operationKey,
|
|
8158
|
+
ops: {
|
|
8159
|
+
items: { oneOf: [
|
|
8160
|
+
objectSchema({
|
|
8161
|
+
op: { const: "create" },
|
|
8162
|
+
value: { $ref: "#/$defs/create" }
|
|
8163
|
+
}),
|
|
8164
|
+
objectSchema({
|
|
8165
|
+
expectedRevision: identifier,
|
|
8166
|
+
id: identifier,
|
|
8167
|
+
op: { const: "update" },
|
|
8168
|
+
value: updateValue
|
|
8169
|
+
}),
|
|
8170
|
+
objectSchema({
|
|
8171
|
+
expectedRevision: identifier,
|
|
8172
|
+
id: identifier,
|
|
8173
|
+
op: { enum: ["delete", "restore"] }
|
|
8174
|
+
})
|
|
8175
|
+
] },
|
|
8176
|
+
maxItems: batchLimit,
|
|
8177
|
+
minItems: 1,
|
|
8178
|
+
type: "array"
|
|
8179
|
+
}
|
|
8140
8180
|
})
|
|
8141
8181
|
]
|
|
8142
8182
|
});
|
|
@@ -8158,55 +8198,83 @@ const createEntityProtocol = (definition) => {
|
|
|
8158
8198
|
"revision",
|
|
8159
8199
|
"value"
|
|
8160
8200
|
]);
|
|
8201
|
+
const errorFields = objectSchema({
|
|
8202
|
+
code: { enum: [
|
|
8203
|
+
"capability_not_supported",
|
|
8204
|
+
"conflict",
|
|
8205
|
+
"forbidden",
|
|
8206
|
+
"internal",
|
|
8207
|
+
"invalid_request",
|
|
8208
|
+
"not_found",
|
|
8209
|
+
"rate_limited",
|
|
8210
|
+
"transport_error",
|
|
8211
|
+
"unauthenticated",
|
|
8212
|
+
"unavailable",
|
|
8213
|
+
"upload_not_supported"
|
|
8214
|
+
] },
|
|
8215
|
+
details: { type: "object" },
|
|
8216
|
+
message: { type: "string" },
|
|
8217
|
+
outcome: { enum: [
|
|
8218
|
+
"not_dispatched",
|
|
8219
|
+
"rejected",
|
|
8220
|
+
"uncertain"
|
|
8221
|
+
] },
|
|
8222
|
+
retryable: { type: "boolean" }
|
|
8223
|
+
}, [
|
|
8224
|
+
"code",
|
|
8225
|
+
"message",
|
|
8226
|
+
"retryable"
|
|
8227
|
+
]);
|
|
8228
|
+
const errorConditions = [{
|
|
8229
|
+
if: {
|
|
8230
|
+
properties: { details: {
|
|
8231
|
+
properties: { reason: { const: "read_limit_exceeded" } },
|
|
8232
|
+
required: ["reason"]
|
|
8233
|
+
} },
|
|
8234
|
+
required: ["details"]
|
|
8235
|
+
},
|
|
8236
|
+
then: { properties: {
|
|
8237
|
+
code: { const: "invalid_request" },
|
|
8238
|
+
details: objectSchema({
|
|
8239
|
+
budget: { enum: [
|
|
8240
|
+
"work",
|
|
8241
|
+
"nodes",
|
|
8242
|
+
"relation_ids",
|
|
8243
|
+
"bytes"
|
|
8244
|
+
] },
|
|
8245
|
+
reason: { const: "read_limit_exceeded" }
|
|
8246
|
+
})
|
|
8247
|
+
} }
|
|
8248
|
+
}, {
|
|
8249
|
+
if: {
|
|
8250
|
+
properties: { details: {
|
|
8251
|
+
properties: { reason: { const: "batch_refused" } },
|
|
8252
|
+
required: ["reason"]
|
|
8253
|
+
} },
|
|
8254
|
+
required: ["details"]
|
|
8255
|
+
},
|
|
8256
|
+
then: { properties: {
|
|
8257
|
+
code: { enum: [...batchRefusalReasons] },
|
|
8258
|
+
details: objectSchema({
|
|
8259
|
+
reason: { const: "batch_refused" },
|
|
8260
|
+
refused: {
|
|
8261
|
+
items: objectSchema({
|
|
8262
|
+
id: identifier,
|
|
8263
|
+
index: {
|
|
8264
|
+
minimum: 0,
|
|
8265
|
+
type: "integer"
|
|
8266
|
+
},
|
|
8267
|
+
reason: { enum: [...batchRefusalReasons] }
|
|
8268
|
+
}, ["index", "reason"]),
|
|
8269
|
+
minItems: 1,
|
|
8270
|
+
type: "array"
|
|
8271
|
+
}
|
|
8272
|
+
})
|
|
8273
|
+
} }
|
|
8274
|
+
}];
|
|
8161
8275
|
const error = {
|
|
8162
|
-
...
|
|
8163
|
-
|
|
8164
|
-
"capability_not_supported",
|
|
8165
|
-
"conflict",
|
|
8166
|
-
"forbidden",
|
|
8167
|
-
"internal",
|
|
8168
|
-
"invalid_request",
|
|
8169
|
-
"not_found",
|
|
8170
|
-
"rate_limited",
|
|
8171
|
-
"transport_error",
|
|
8172
|
-
"unauthenticated",
|
|
8173
|
-
"unavailable",
|
|
8174
|
-
"upload_not_supported"
|
|
8175
|
-
] },
|
|
8176
|
-
details: { type: "object" },
|
|
8177
|
-
message: { type: "string" },
|
|
8178
|
-
outcome: { enum: [
|
|
8179
|
-
"not_dispatched",
|
|
8180
|
-
"rejected",
|
|
8181
|
-
"uncertain"
|
|
8182
|
-
] },
|
|
8183
|
-
retryable: { type: "boolean" }
|
|
8184
|
-
}, [
|
|
8185
|
-
"code",
|
|
8186
|
-
"message",
|
|
8187
|
-
"retryable"
|
|
8188
|
-
]),
|
|
8189
|
-
allOf: [{
|
|
8190
|
-
if: {
|
|
8191
|
-
properties: { details: {
|
|
8192
|
-
properties: { reason: { const: "read_limit_exceeded" } },
|
|
8193
|
-
required: ["reason"]
|
|
8194
|
-
} },
|
|
8195
|
-
required: ["details"]
|
|
8196
|
-
},
|
|
8197
|
-
then: { properties: {
|
|
8198
|
-
code: { const: "invalid_request" },
|
|
8199
|
-
details: objectSchema({
|
|
8200
|
-
budget: { enum: [
|
|
8201
|
-
"work",
|
|
8202
|
-
"nodes",
|
|
8203
|
-
"relation_ids",
|
|
8204
|
-
"bytes"
|
|
8205
|
-
] },
|
|
8206
|
-
reason: { const: "read_limit_exceeded" }
|
|
8207
|
-
})
|
|
8208
|
-
} }
|
|
8209
|
-
}]
|
|
8276
|
+
...errorFields,
|
|
8277
|
+
allOf: errorConditions
|
|
8210
8278
|
};
|
|
8211
8279
|
const liveRecord = {
|
|
8212
8280
|
...record,
|
|
@@ -8283,6 +8351,12 @@ const createEntityProtocol = (definition) => {
|
|
|
8283
8351
|
}
|
|
8284
8352
|
}));
|
|
8285
8353
|
const validateOperationResult = {
|
|
8354
|
+
batch: ajv.compile(resultSchema({
|
|
8355
|
+
items: record,
|
|
8356
|
+
maxItems: batchLimit,
|
|
8357
|
+
minItems: 1,
|
|
8358
|
+
type: "array"
|
|
8359
|
+
})),
|
|
8286
8360
|
create: validateRecord,
|
|
8287
8361
|
delete: validateDeleted,
|
|
8288
8362
|
get: validateRecord,
|
|
@@ -8399,6 +8473,14 @@ const encode = (request) => {
|
|
|
8399
8473
|
method: "POST",
|
|
8400
8474
|
path: "/uploads"
|
|
8401
8475
|
};
|
|
8476
|
+
case "batch": return {
|
|
8477
|
+
body: JSON.stringify({
|
|
8478
|
+
idempotencyKey: request.idempotencyKey,
|
|
8479
|
+
ops: request.ops
|
|
8480
|
+
}),
|
|
8481
|
+
method: "POST",
|
|
8482
|
+
path: "/records/batch"
|
|
8483
|
+
};
|
|
8402
8484
|
}
|
|
8403
8485
|
};
|
|
8404
8486
|
const failure$1 = (request, error) => ({
|
|
@@ -8545,6 +8627,7 @@ const createEntityHttpTransport = (options) => {
|
|
|
8545
8627
|
* moves each failed envelope to the typed channel for `./effect`.
|
|
8546
8628
|
*/
|
|
8547
8629
|
const capabilityOf = {
|
|
8630
|
+
batch: "batch",
|
|
8548
8631
|
create: "create",
|
|
8549
8632
|
delete: "delete",
|
|
8550
8633
|
get: "get",
|
|
@@ -8587,7 +8670,7 @@ const makeEntityCore = (options) => {
|
|
|
8587
8670
|
},
|
|
8588
8671
|
ok: false
|
|
8589
8672
|
});
|
|
8590
|
-
if (
|
|
8673
|
+
if ((request.value.operation === "batch" ? [capabilityOf.batch, ...request.value.ops.map(({ op }) => capabilityOf[op])] : [capabilityOf[request.value.operation]]).some((capability) => options.definition.capabilities[capability] !== true)) return Effect.succeed({
|
|
8591
8674
|
correlationId,
|
|
8592
8675
|
error: {
|
|
8593
8676
|
code: "capability_not_supported",
|
|
@@ -8735,6 +8818,10 @@ const makeResources = (executeOf, requestId) => Resources.of({ bind: (definition
|
|
|
8735
8818
|
});
|
|
8736
8819
|
const call = (effect) => Effect.flatMap(Effect.suspend(() => effect(core.requestId())), valueOf);
|
|
8737
8820
|
return {
|
|
8821
|
+
batch: (input) => call((id) => core.execute({
|
|
8822
|
+
...input,
|
|
8823
|
+
operation: "batch"
|
|
8824
|
+
}, id)),
|
|
8738
8825
|
create: (input) => call((id) => core.execute({
|
|
8739
8826
|
...input,
|
|
8740
8827
|
operation: "create"
|
|
@@ -8810,4 +8897,4 @@ const makeLegacy = (options) => LegacyResources.of({ bind: (definition) => {
|
|
|
8810
8897
|
const layerLegacy = (options) => Layer.succeed(LegacyResources, makeLegacy(options));
|
|
8811
8898
|
/** `layerLegacy` with options that Effect `Config` reads. */
|
|
8812
8899
|
const layerLegacyConfig = (config) => Layer.unwrap(Effect.map(Config.unwrap(config), layerLegacy));
|
|
8813
|
-
export {
|
|
8900
|
+
export { errors_exports as A, isClientOperationId as C, CiTransportError as D, CiErrorCode as E, FederatedAuthError as O, fromCiResult as S, CiError as T, backendErrorCode as _, layerConfig as a, proxyHttpOptions as b, layerLegacyConfig as c, createEntityHttpTransport as d, makeEntityHttpExecute as f, isEntityReadLimitError as g, isEntityBatchRefusedError as h, layer as i, ciErrorCodes as j, FederatedAuthErrorCode as k, makeEntityCore as l, createEntityProtocol as m, Resources as n, layerFromEntityTransport as o, runEntityRequest as p, fromEntityTransport as r, layerLegacy as s, LegacyResources as t, makeLegacyResourceCore as u, directHttpOptions as v, toCiResult as w, clientOperationIds as x, makeHttpExecute as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as CiTransportError, O as FederatedAuthError, S as fromCiResult, T as CiError, _ as backendErrorCode, b as proxyHttpOptions, j as ciErrorCodes, v as directHttpOptions, w as toCiResult, y as makeHttpExecute } from "./service-8gveUQPI.js";
|
|
2
2
|
import * as Predicate from "effect/Predicate";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
import * as Arr from "effect/Array";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@collective-intelligence/external-apps-client-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Framework-neutral client for Collective Intelligence external applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"ultracite": "7.10.7",
|
|
69
69
|
"vitest": "5.0.2"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "399369a97e85b54b43aeac887e7ba9c960cb7505"
|
|
72
72
|
}
|