@collective-intelligence/external-apps-client-sdk 0.1.36 → 0.1.38
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 +106 -12
- package/dist/effect.d.ts +104 -5
- package/dist/effect.js +32 -2
- package/dist/index-D_Ctkuhr.d.ts +1029 -0
- package/dist/index.d.ts +3 -877
- package/dist/index.js +178 -626
- package/dist/resources-BhOgbxg5.js +113 -0
- package/dist/{resources-Czlu8xAB.d.ts → resources-CftkAwlJ.d.ts} +285 -7
- package/dist/resources.d.ts +2 -2
- package/dist/resources.js +2 -1
- package/dist/{resources-BFJrm_N2.js → service-D-18nBUU.js} +607 -280
- package/dist/service-DD58W3in.js +1439 -0
- package/package.json +7 -4
- package/dist/event-stream-Djqhj56G.d.ts +0 -63
- package/dist/federated-auth-lotz7RGT.d.ts +0 -94
- package/dist/rolldown-runtime-DC62tzP2.js +0 -31
- package/dist/service-4l3X16iR.js +0 -750
package/README.md
CHANGED
|
@@ -221,15 +221,24 @@ correlation IDs.
|
|
|
221
221
|
A File field holds files of a CI entity. The browser sends the file bytes
|
|
222
222
|
straight to storage; they never pass through CI or a BFF:
|
|
223
223
|
|
|
224
|
-
1. `upload({ field, filename, mimeType })` requests a File upload for
|
|
225
|
-
File field. The definition must
|
|
226
|
-
otherwise the call fails with
|
|
227
|
-
|
|
224
|
+
1. `upload({ field, filename, mimeType, size })` requests a File upload for
|
|
225
|
+
one File field; `size` is the file size in bytes. The definition must
|
|
226
|
+
declare `capabilities.upload: true`; otherwise the call fails with
|
|
227
|
+
`capability_not_supported` and sends nothing. CI refuses a `size` over the
|
|
228
|
+
field's `maxBytes` or the platform limit with `invalid_request` and
|
|
229
|
+
`details.reason: "file_too_large"`.
|
|
230
|
+
2. PUT the bytes to the returned `url` with the returned `headers`. Where the
|
|
231
|
+
storage can, the URL takes only a body of the declared size.
|
|
228
232
|
3. Write the entity with `{ upload: uploadId }` for that File field key.
|
|
229
233
|
|
|
230
234
|
```ts
|
|
231
235
|
const slot = await leads.upload(
|
|
232
|
-
{
|
|
236
|
+
{
|
|
237
|
+
field: "resume",
|
|
238
|
+
filename: file.name,
|
|
239
|
+
mimeType: file.type,
|
|
240
|
+
size: file.size
|
|
241
|
+
},
|
|
233
242
|
{ signal }
|
|
234
243
|
)
|
|
235
244
|
if (slot.ok) {
|
|
@@ -419,24 +428,109 @@ try {
|
|
|
419
428
|
|
|
420
429
|
`.` and `./effect` export the same classes, so `instanceof` gives the same
|
|
421
430
|
result for both entries. `./effect` also exports the wire Schemas `CiErrorCode`
|
|
422
|
-
and `FederatedAuthErrorCode
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
431
|
+
and `FederatedAuthErrorCode`, and the envelope Schemas `CiErrorEnvelope`,
|
|
432
|
+
`CiResult(value)` and `CiStreamPage`, whose Types are the `.` types `CiError`,
|
|
433
|
+
`CiResult` and `CiStreamPage`.
|
|
434
|
+
|
|
435
|
+
### What each operation gives
|
|
436
|
+
|
|
437
|
+
Every capability runs on one Effect Core. The `.` entry is a Vanilla Facade
|
|
438
|
+
over it: each client holds one Effect runtime and keeps its Promise
|
|
439
|
+
signatures. `close()` disposes that runtime: it cancels the calls in flight,
|
|
440
|
+
and a later call rejects. The clients of `createClient`,
|
|
441
|
+
`createDirectTransport`, `createProxyTransport`, `createFederatedAuth`,
|
|
442
|
+
`createServerSessionAuth`, `createFixedWorkflowClient`,
|
|
443
|
+
`createDelegatedApplicationRuntime` (also for its `client` and `auth`),
|
|
444
|
+
`createEntityHttpTransport` and `createResourceClient` have `close()`.
|
|
445
|
+
`followRun` is a function, not a client: it runs on the default Effect
|
|
446
|
+
runtime. A failure gives one of these outcomes:
|
|
447
|
+
|
|
448
|
+
| Failure | `.` operation that returns `CiResult` | `.` operation that rejects | `./effect` |
|
|
449
|
+
| ----------------------------------- | ------------------------------------------------------- | --------------------------------------------------------- | ----------------------------- |
|
|
450
|
+
| CI returns an error | resolves `{ ok: false, error }`; `error` is a `CiError` | rejects with `CiError` (`FederatedAuthError` for sign-in) | fails with the same class |
|
|
451
|
+
| The request does not reach CI | rejects with `CiTransportError` | rejects with `CiTransportError` | fails with `CiTransportError` |
|
|
452
|
+
| The caller aborts its `AbortSignal` | rejects with `signal.reason` | rejects with `signal.reason` | interruption |
|
|
453
|
+
| Bad SDK input | throws `TypeError` | throws `TypeError` | dies with `TypeError` |
|
|
454
|
+
|
|
455
|
+
- The operations that return `CiResult` are the domain methods of
|
|
456
|
+
`createClient`, `client.execute` and the `execute` of
|
|
457
|
+
`createDirectTransport` and `createProxyTransport`.
|
|
458
|
+
- An operation outside the client registry, or a call without an
|
|
459
|
+
`organizationId`, still resolves `CiResult` `invalid_request`;
|
|
460
|
+
`forOrganization("")` throws `TypeError`.
|
|
461
|
+
- `followRun` and `client.runs.follow` reject with the `CiError` of the failed
|
|
462
|
+
read. A run that does not finish before `deadlineMs` rejects with `CiError`
|
|
463
|
+
`unavailable` (`retryable: true`, message "Run did not finish").
|
|
464
|
+
- `createFixedWorkflowClient().invoke` rejects with `CiError`: the code that
|
|
465
|
+
the route names, else the code of its HTTP status.
|
|
466
|
+
- `createFederatedAuth` and `createServerSessionAuth` reject with
|
|
467
|
+
`FederatedAuthError`. A bad option throws `FederatedAuthError`
|
|
468
|
+
`configuration_error` when you create the client.
|
|
469
|
+
- `createDelegatedApplicationRuntime().followRun` without a session rejects
|
|
470
|
+
with `FederatedAuthError` `reauthorization_required`.
|
|
471
|
+
- `createResourceClient` and `createEntityHttpTransport` keep the
|
|
472
|
+
`ResourceResult` envelope: a transport failure or an abort in flight resolves
|
|
473
|
+
`transport_error`, with `outcome` `rejected` for a read and `uncertain` for a
|
|
474
|
+
write.
|
|
475
|
+
|
|
476
|
+
The `error` of a failed `CiResult` is a `CiError` instance, so it has
|
|
477
|
+
`_tag: "CiError"` and its JSON form includes `_tag`. Decode a wire code with
|
|
478
|
+
its code Schema:
|
|
427
479
|
|
|
428
480
|
```ts
|
|
429
481
|
import { CiError } from "@collective-intelligence/external-apps-client-sdk"
|
|
430
482
|
import { CiErrorCode } from "@collective-intelligence/external-apps-client-sdk/effect"
|
|
431
483
|
import * as Schema from "effect/Schema"
|
|
432
484
|
|
|
433
|
-
if (!result.ok) {
|
|
434
|
-
throw
|
|
485
|
+
if (!result.ok && result.error instanceof CiError) {
|
|
486
|
+
throw result.error
|
|
435
487
|
}
|
|
436
488
|
|
|
437
489
|
const code = Schema.decodeUnknownSync(CiErrorCode)(value)
|
|
438
490
|
```
|
|
439
491
|
|
|
492
|
+
### `./effect` services
|
|
493
|
+
|
|
494
|
+
`./effect` exports one `Context.Service` per client, a layer constructor and
|
|
495
|
+
a layer that reads Effect `Config`:
|
|
496
|
+
|
|
497
|
+
| Service | Layers | Same capability at `.` |
|
|
498
|
+
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
499
|
+
| `CiClient` (`execute`, `executeResult`) | `layerCiClientDirect`, `layerCiClientProxy`, `layerCiClientFromExecutor`, `layerCiClientDirectConfig`, `layerCiClientProxyConfig` | `createClient`, `createDirectTransport`, `createProxyTransport` |
|
|
500
|
+
| `Runs` (`follow`) | `layerRuns` (needs `CiClient`) | `followRun`, `client.runs.follow` |
|
|
501
|
+
| `FederatedAuth` | `layerFederatedAuth`, `layerServerSessionAuth`, and their `…Config` forms | `createFederatedAuth`, `createServerSessionAuth` |
|
|
502
|
+
| `FixedWorkflows` (`invoke`) | `layerFixedWorkflows`, `layerFixedWorkflowsConfig` | `createFixedWorkflowClient` |
|
|
503
|
+
| `DelegatedRuntime` | `layerDelegatedRuntime`, `layerDelegatedRuntimeConfig` | `createDelegatedApplicationRuntime` |
|
|
504
|
+
| `Resources` (`bind(definition)`) | `layerResources`, `layerResourcesConfig`, `layerResourcesFromEntityTransport` | `createResourceClient` with `protocol: "entity"`, `createEntityHttpTransport` |
|
|
505
|
+
| `LegacyResources` (`bind(definition)`) | `layerLegacyResources`, `layerLegacyResourcesConfig` | `createResourceClient` over a `ResourceTransport` |
|
|
506
|
+
| `RealtimeClient` | `layerRealtimeClient`, `layerRealtimeClientConfig` | `createRealtimeClient` |
|
|
507
|
+
|
|
508
|
+
`CiClient.execute` puts the `CiError` of CI in the typed error channel;
|
|
509
|
+
`executeResult` keeps the `CiResult` envelope with the correlation id of CI. A
|
|
510
|
+
`Resources` or `LegacyResources` client fails with `CiError`, whose `details`
|
|
511
|
+
hold the resource `resourceCode` and `outcome`, or with `CiTransportError`
|
|
512
|
+
when the answer was not readable or the transport rejected.
|
|
513
|
+
`layerResourcesFromEntityTransport({ transport })` binds an `EntityTransport`
|
|
514
|
+
of the app, and `layerLegacyResources({ transport })` a `ResourceTransport`
|
|
515
|
+
with its lifecycle operations (`softDelete`, `restore`, `hardDelete`). A `…Config` layer takes `Config.Wrap` of the layer options: give
|
|
516
|
+
each field as a `Config`, for example `Config.String("CI_TENANT_URL")`, and a
|
|
517
|
+
function field as `Config.succeed(fn)`.
|
|
518
|
+
|
|
519
|
+
```ts
|
|
520
|
+
import * as Effect from "effect/Effect"
|
|
521
|
+
import {
|
|
522
|
+
CiClient,
|
|
523
|
+
layerCiClientDirect
|
|
524
|
+
} from "@collective-intelligence/external-apps-client-sdk/effect"
|
|
525
|
+
|
|
526
|
+
const program = CiClient.use((ci) =>
|
|
527
|
+
ci.execute("context_get", {}, { organizationId })
|
|
528
|
+
).pipe(
|
|
529
|
+
Effect.catchTag("CiError", (error) => Effect.succeed(error.code)),
|
|
530
|
+
Effect.provide(layerCiClientDirect({ auth, tenantUrl }))
|
|
531
|
+
)
|
|
532
|
+
```
|
|
533
|
+
|
|
440
534
|
At `.`, the `CiError` type stays the envelope shape that `CiResult` carries,
|
|
441
535
|
and every `CiError` instance has that shape. `new FederatedAuthError(code,
|
|
442
536
|
message)` still works beside `new FederatedAuthError({ code, message })`.
|
package/dist/effect.d.ts
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import {
|
|
1
|
+
import { $t as layerFederated, Gt as ClientFetch, Qt as FederatedAuthValue, Zt as FederatedAuth, _ as layerLegacyConfig, a as LegacyResources, an as CiError, c as ResourceEntityClient, cn as FederatedAuthError, d as ResourcesLayerOptions, en as layerFederatedConfig, f as ResourcesValue, g as layerLegacy, h as layerFromEntityTransport, i as LegacyResourceClient, l as Resources, ln as FederatedAuthErrorCode, m as layerConfig$3, nn as layerServerSessionConfig, o as LegacyResourcesLayerOptions, on as CiErrorCode, p as layer$3, s as LegacyResourcesValue, sn as CiTransportError, tn as layerServerSession, u as ResourcesFromEntityTransportOptions } from "./resources-CftkAwlJ.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-D_Ctkuhr.js";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import * as Config from "effect/Config";
|
|
3
5
|
import * as Context from "effect/Context";
|
|
4
|
-
import "effect/Effect";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
5
7
|
import "effect/http/HttpClient";
|
|
6
8
|
import * as Layer from "effect/Layer";
|
|
7
9
|
import * as Stream from "effect/Stream";
|
|
10
|
+
/** An Expected Error as the `CiResult` envelope carries it: the fields of `CiError`, without `_tag`. */
|
|
11
|
+
declare const CiErrorEnvelope: Schema.Struct<{
|
|
12
|
+
readonly code: Schema.Literals<readonly ["unauthenticated", "forbidden", "not_found", "conflict", "invalid_request", "rate_limited", "unavailable", "internal"]>;
|
|
13
|
+
readonly details: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
14
|
+
readonly message: Schema.String;
|
|
15
|
+
readonly retryable: Schema.Boolean;
|
|
16
|
+
}>;
|
|
17
|
+
/** The `CiResult` envelope of one CI operation; `value` is the Schema of its success value. */
|
|
18
|
+
declare const CiResult: <Value extends Schema.Top>(value: Value) => Schema.Union<readonly [Schema.Struct<{
|
|
19
|
+
readonly correlationId: Schema.String;
|
|
20
|
+
readonly ok: Schema.Literal<true>;
|
|
21
|
+
readonly value: Value;
|
|
22
|
+
}>, Schema.Struct<{
|
|
23
|
+
readonly correlationId: Schema.String;
|
|
24
|
+
readonly error: Schema.Struct<{
|
|
25
|
+
readonly code: Schema.Literals<readonly ["unauthenticated", "forbidden", "not_found", "conflict", "invalid_request", "rate_limited", "unavailable", "internal"]>;
|
|
26
|
+
readonly details: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
27
|
+
readonly message: Schema.String;
|
|
28
|
+
readonly retryable: Schema.Boolean;
|
|
29
|
+
}>;
|
|
30
|
+
readonly ok: Schema.Literal<false>;
|
|
31
|
+
}>]>;
|
|
32
|
+
/** One page of the events of a run: the output of `runs_stream`. */
|
|
33
|
+
declare const CiStreamPage: Schema.Struct<{
|
|
34
|
+
readonly events: Schema.mutableKey<Schema.mutable<Schema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>>;
|
|
35
|
+
readonly nextCursor: Schema.mutableKey<Schema.NullOr<Schema.String>>;
|
|
36
|
+
}>;
|
|
8
37
|
/** Refetch every subscribed topic: the changes of a delivery could not be named. */
|
|
9
38
|
type RealtimeResync = Readonly<{
|
|
10
39
|
op: "resync";
|
|
@@ -27,7 +56,77 @@ type RealtimeClientLayerOptions = Readonly<{
|
|
|
27
56
|
ticketUrl: string;
|
|
28
57
|
}>;
|
|
29
58
|
/** `RealtimeClient` with the `fetch` of `FetchHttpClient.Fetch` and the page of this runtime. */
|
|
30
|
-
declare const layer: (options: RealtimeClientLayerOptions) => Layer.Layer<RealtimeClient, never, never>;
|
|
59
|
+
declare const layer$2: (options: RealtimeClientLayerOptions) => Layer.Layer<RealtimeClient, never, never>;
|
|
60
|
+
/** `layer` with options that Effect `Config` reads. */
|
|
61
|
+
declare const layerConfig$2: (config: Config.Wrap<RealtimeClientLayerOptions>) => Layer.Layer<RealtimeClient, Config.ConfigError, never>;
|
|
31
62
|
/** The changes and Resyncs of `topic` from the `RealtimeClient` of the context. */
|
|
32
63
|
declare const subscribe: (topic: RealtimeTopic) => Stream.Stream<RealtimeUpdate, never, RealtimeClient>;
|
|
33
|
-
|
|
64
|
+
type FixedWorkflowRequest = Readonly<{
|
|
65
|
+
/** The body of the route; `JSON.stringify` writes it. */
|
|
66
|
+
body: unknown;
|
|
67
|
+
/** The Fixed workflow route, e.g. `/api/leads/lead-1/convert`. */
|
|
68
|
+
url: string;
|
|
69
|
+
}>;
|
|
70
|
+
type FixedWorkflowsValue = Readonly<{
|
|
71
|
+
/** Posts `request` once, with a new idempotency key, and succeeds with the admitted run id. */
|
|
72
|
+
invoke: (request: FixedWorkflowRequest) => Effect.Effect<Readonly<{
|
|
73
|
+
runId: string;
|
|
74
|
+
}>, CiError | CiTransportError>;
|
|
75
|
+
}>;
|
|
76
|
+
declare const FixedWorkflows_base: Context.ServiceClass<FixedWorkflows, "@collective-intelligence/external-apps-client-sdk/FixedWorkflows", Readonly<{
|
|
77
|
+
/** Posts `request` once, with a new idempotency key, and succeeds with the admitted run id. */
|
|
78
|
+
invoke: (request: FixedWorkflowRequest) => Effect.Effect<Readonly<{
|
|
79
|
+
runId: string;
|
|
80
|
+
}>, CiError | CiTransportError>;
|
|
81
|
+
}>>;
|
|
82
|
+
declare class FixedWorkflows extends FixedWorkflows_base {}
|
|
83
|
+
type FixedWorkflowsLayerOptions = Readonly<{
|
|
84
|
+
fetch?: ClientFetch;
|
|
85
|
+
}>;
|
|
86
|
+
/** `FixedWorkflows` over the `fetch` of `options`. */
|
|
87
|
+
declare const layer$1: (options?: FixedWorkflowsLayerOptions) => Layer.Layer<FixedWorkflows, never, never>;
|
|
88
|
+
/** `layer` with options that Effect `Config` reads. */
|
|
89
|
+
declare const layerConfig$1: (config: Config.Wrap<FixedWorkflowsLayerOptions>) => Layer.Layer<FixedWorkflows, Config.ConfigError, never>;
|
|
90
|
+
type FollowError = CiError | CiTransportError | FederatedAuthError;
|
|
91
|
+
type DelegatedRuntimeValue = Readonly<{
|
|
92
|
+
applicationId: string;
|
|
93
|
+
getSnapshot: () => DelegatedRuntimeState;
|
|
94
|
+
/** Calls `notify` at each state change, in the call that changes it. */
|
|
95
|
+
subscribe: (notify: () => void) => () => void;
|
|
96
|
+
/** Each state, from the subscription on. */
|
|
97
|
+
changes: Stream.Stream<DelegatedRuntimeState>;
|
|
98
|
+
/** Reads the session again; a read that fails makes the state `unavailable`. */
|
|
99
|
+
refresh: Effect.Effect<void>;
|
|
100
|
+
/** Refreshes, then starts a login when the session is anonymous or expired. */
|
|
101
|
+
initialize: (url: string) => Effect.Effect<void, FederatedAuthError>;
|
|
102
|
+
login: (returnTo: string) => Effect.Effect<void, FederatedAuthError>;
|
|
103
|
+
logout: Effect.Effect<void>;
|
|
104
|
+
/** Follows a run of the session's organization; without a session, `reauthorization_required`. */
|
|
105
|
+
followRun: (runId: string) => Effect.Effect<CiStreamPage$1, FollowError>;
|
|
106
|
+
}>;
|
|
107
|
+
declare const DelegatedRuntime_base: Context.ServiceClass<DelegatedRuntime, "@collective-intelligence/external-apps-client-sdk/DelegatedRuntime", Readonly<{
|
|
108
|
+
applicationId: string;
|
|
109
|
+
getSnapshot: () => DelegatedRuntimeState;
|
|
110
|
+
/** Calls `notify` at each state change, in the call that changes it. */
|
|
111
|
+
subscribe: (notify: () => void) => () => void;
|
|
112
|
+
/** Each state, from the subscription on. */
|
|
113
|
+
changes: Stream.Stream<DelegatedRuntimeState>;
|
|
114
|
+
/** Reads the session again; a read that fails makes the state `unavailable`. */
|
|
115
|
+
refresh: Effect.Effect<void>;
|
|
116
|
+
/** Refreshes, then starts a login when the session is anonymous or expired. */
|
|
117
|
+
initialize: (url: string) => Effect.Effect<void, FederatedAuthError>;
|
|
118
|
+
login: (returnTo: string) => Effect.Effect<void, FederatedAuthError>;
|
|
119
|
+
logout: Effect.Effect<void>;
|
|
120
|
+
/** Follows a run of the session's organization; without a session, `reauthorization_required`. */
|
|
121
|
+
followRun: (runId: string) => Effect.Effect<CiStreamPage$1, FollowError>;
|
|
122
|
+
}>>;
|
|
123
|
+
declare class DelegatedRuntime extends DelegatedRuntime_base {}
|
|
124
|
+
/**
|
|
125
|
+
* `DelegatedRuntime` for a sealed-cookie BFF, merged with its own
|
|
126
|
+
* `FederatedAuth`, `CiClient` and `Runs`. A bad `authBasePath` fails with
|
|
127
|
+
* `configuration_error`; a bad `origin` or `proxyPath` dies with `TypeError`.
|
|
128
|
+
*/
|
|
129
|
+
declare const layer: (options: DelegatedApplicationRuntimeOptions) => Layer.Layer<FederatedAuth | CiClient | Runs | DelegatedRuntime, FederatedAuthError, never>;
|
|
130
|
+
/** `layer` with options that Effect `Config` reads. */
|
|
131
|
+
declare const layerConfig: (config: Config.Wrap<DelegatedApplicationRuntimeOptions>) => Layer.Layer<FederatedAuth | CiClient | Runs | DelegatedRuntime, FederatedAuthError | Config.ConfigError, never>;
|
|
132
|
+
export { CiClient, type CiClientValue, CiError, CiErrorCode, CiErrorEnvelope, CiResult, CiStreamPage, CiTransportError, DEFAULT_FOLLOW_RUN_DEADLINE_MS, DelegatedRuntime, type DelegatedRuntimeValue, type ExecuteResult, FederatedAuth, FederatedAuthError, FederatedAuthErrorCode, type FederatedAuthValue, type FixedWorkflowRequest, FixedWorkflows, type FixedWorkflowsLayerOptions, type FixedWorkflowsValue, type LegacyResourceClient, LegacyResources, type LegacyResourcesLayerOptions, type LegacyResourcesValue, type RealtimeChange, RealtimeClient, type RealtimeClientLayerOptions, type RealtimeResync, type RealtimeTopic, type RealtimeTopicFilter, type RealtimeUpdate, type ResourceEntityClient, Resources, type ResourcesFromEntityTransportOptions, type ResourcesLayerOptions, type ResourcesValue, type RunFollowOptions, Runs, type RunsValue, layerDirect as layerCiClientDirect, layerDirectConfig as layerCiClientDirectConfig, layerFromExecutor as layerCiClientFromExecutor, layerProxy as layerCiClientProxy, layerProxyConfig as layerCiClientProxyConfig, layer as layerDelegatedRuntime, layerConfig as layerDelegatedRuntimeConfig, layerFederated as layerFederatedAuth, layerFederatedConfig as layerFederatedAuthConfig, layer$1 as layerFixedWorkflows, layerConfig$1 as layerFixedWorkflowsConfig, layerLegacy as layerLegacyResources, layerLegacyConfig as layerLegacyResourcesConfig, layer$2 as layerRealtimeClient, layerConfig$2 as layerRealtimeClientConfig, layer$3 as layerResources, layerConfig$3 as layerResourcesConfig, layerFromEntityTransport as layerResourcesFromEntityTransport, layer$4 as layerRuns, layerServerSession as layerServerSessionAuth, layerServerSessionConfig as layerServerSessionAuthConfig, subscribe };
|
package/dist/effect.js
CHANGED
|
@@ -1,2 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { C as CiError, D as FederatedAuthErrorCode, E as FederatedAuthError, T as CiTransportError, a as layerConfig$3, c as layerLegacyConfig, i as layer$3, n as Resources, o as layerFromEntityTransport, s as layerLegacy, t as LegacyResources, w as CiErrorCode } from "./service-D-18nBUU.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-DD58W3in.js";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
/**
|
|
5
|
+
* The wire Schemas of the CI envelopes that `./effect` exports. The Type of
|
|
6
|
+
* each Schema is the type of `.` that the code uses (`./envelopes`,
|
|
7
|
+
* `./streaming`), with the same `readonly` and optional keys; the type test
|
|
8
|
+
* `type-tests/wire-schemas.ts` holds them equal.
|
|
9
|
+
*/
|
|
10
|
+
/** An Expected Error as the `CiResult` envelope carries it: the fields of `CiError`, without `_tag`. */
|
|
11
|
+
const CiErrorEnvelope = Schema.Struct({
|
|
12
|
+
code: CiError.fields.code,
|
|
13
|
+
details: CiError.fields.details,
|
|
14
|
+
message: CiError.fields.message,
|
|
15
|
+
retryable: CiError.fields.retryable
|
|
16
|
+
});
|
|
17
|
+
/** The `CiResult` envelope of one CI operation; `value` is the Schema of its success value. */
|
|
18
|
+
const CiResult = (value) => Schema.Union([Schema.Struct({
|
|
19
|
+
correlationId: Schema.String,
|
|
20
|
+
ok: Schema.Literal(true),
|
|
21
|
+
value
|
|
22
|
+
}), Schema.Struct({
|
|
23
|
+
correlationId: Schema.String,
|
|
24
|
+
error: CiErrorEnvelope,
|
|
25
|
+
ok: Schema.Literal(false)
|
|
26
|
+
})]);
|
|
27
|
+
/** One page of the events of a run: the output of `runs_stream`. */
|
|
28
|
+
const CiStreamPage = Schema.Struct({
|
|
29
|
+
events: Schema.mutableKey(Schema.mutable(Schema.Array(Schema.JsonObject))),
|
|
30
|
+
nextCursor: Schema.mutableKey(Schema.NullOr(Schema.String))
|
|
31
|
+
});
|
|
32
|
+
export { CiClient, CiError, CiErrorCode, CiErrorEnvelope, CiResult, CiStreamPage, CiTransportError, DEFAULT_FOLLOW_RUN_DEADLINE_MS, DelegatedRuntime, FederatedAuth, FederatedAuthError, FederatedAuthErrorCode, FixedWorkflows, LegacyResources, RealtimeClient, Resources, Runs, layerDirect as layerCiClientDirect, layerDirectConfig as layerCiClientDirectConfig, layerFromExecutor as layerCiClientFromExecutor, layerProxy as layerCiClientProxy, layerProxyConfig as layerCiClientProxyConfig, layer as layerDelegatedRuntime, layerConfig as layerDelegatedRuntimeConfig, layerFederated as layerFederatedAuth, layerFederatedConfig as layerFederatedAuthConfig, layer$1 as layerFixedWorkflows, layerConfig$1 as layerFixedWorkflowsConfig, layerLegacy as layerLegacyResources, layerLegacyConfig as layerLegacyResourcesConfig, layer$2 as layerRealtimeClient, layerConfig$2 as layerRealtimeClientConfig, layer$3 as layerResources, layerConfig$3 as layerResourcesConfig, layerFromEntityTransport as layerResourcesFromEntityTransport, layer$4 as layerRuns, layerServerSession as layerServerSessionAuth, layerServerSessionConfig as layerServerSessionAuthConfig, subscribe };
|