@superdurable/connectors-sdk 0.0.0-stage → 0.1.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.
@@ -0,0 +1,445 @@
1
+ import { z } from 'zod';
2
+ import { AsyncContext, Stream, BufferedTextStreamOptions } from '@superdurable/dex';
3
+
4
+ /** Provider or local fact independent of retry policy. */
5
+ declare const FailureKindSchema: z.ZodEnum<{
6
+ VALIDATION: "VALIDATION";
7
+ AUTHENTICATION: "AUTHENTICATION";
8
+ AUTHORIZATION: "AUTHORIZATION";
9
+ NOT_FOUND: "NOT_FOUND";
10
+ CONFLICT: "CONFLICT";
11
+ RATE_LIMIT: "RATE_LIMIT";
12
+ QUOTA_EXHAUSTED: "QUOTA_EXHAUSTED";
13
+ AVAILABILITY: "AVAILABILITY";
14
+ PROVIDER_REJECTION: "PROVIDER_REJECTION";
15
+ TRANSPORT: "TRANSPORT";
16
+ RESPONSE_TOO_LARGE: "RESPONSE_TOO_LARGE";
17
+ PROTOCOL: "PROTOCOL";
18
+ LOCAL_DEFECT: "LOCAL_DEFECT";
19
+ }>;
20
+ /** Provider-neutral failure category. */
21
+ type FailureKind = z.infer<typeof FailureKindSchema>;
22
+ /** Secret-safe failure that may be persisted in a Flow. */
23
+ declare const FailureSchema: z.ZodObject<{
24
+ kind: z.ZodEnum<{
25
+ VALIDATION: "VALIDATION";
26
+ AUTHENTICATION: "AUTHENTICATION";
27
+ AUTHORIZATION: "AUTHORIZATION";
28
+ NOT_FOUND: "NOT_FOUND";
29
+ CONFLICT: "CONFLICT";
30
+ RATE_LIMIT: "RATE_LIMIT";
31
+ QUOTA_EXHAUSTED: "QUOTA_EXHAUSTED";
32
+ AVAILABILITY: "AVAILABILITY";
33
+ PROVIDER_REJECTION: "PROVIDER_REJECTION";
34
+ TRANSPORT: "TRANSPORT";
35
+ RESPONSE_TOO_LARGE: "RESPONSE_TOO_LARGE";
36
+ PROTOCOL: "PROTOCOL";
37
+ LOCAL_DEFECT: "LOCAL_DEFECT";
38
+ }>;
39
+ provider: z.ZodString;
40
+ operation: z.ZodString;
41
+ message: z.ZodString;
42
+ }, z.core.$strict>;
43
+ /** Safe provider failure without secret-bearing details. */
44
+ type Failure = z.infer<typeof FailureSchema>;
45
+ /** The only connector error that requests a Dex Step retry. */
46
+ declare class RetryError extends Error {
47
+ /** Validated provider fact behind the retry request. */
48
+ readonly failure: Failure;
49
+ /** Provider-requested retry delay in milliseconds; zero uses the Step policy. */
50
+ readonly retryAfterMs: number;
51
+ constructor(failure: Failure, retryAfterMs?: number);
52
+ }
53
+ /** Terminal credential failure requiring interactive authorization. */
54
+ declare class ReauthorizationRequiredError extends Error {
55
+ constructor();
56
+ }
57
+
58
+ /** Stable UUID for one provider call across Dex retries. */
59
+ declare const CallIDSchema: z.ZodUUID;
60
+ /** Stable UUID identity for one provider call. */
61
+ type CallID = z.infer<typeof CallIDSchema>;
62
+ /** UUIDv5 namespace shared with sdkgo for call derivation. */
63
+ declare const CallIDNamespace = "63281a42-70ad-5bc3-a289-728819af723f";
64
+ /** Provider-safe stable deduplication key. */
65
+ type IdempotencyKey = string;
66
+ /** Logical credential reference safe to persist in a Flow. */
67
+ declare const ConnectionRefSchema: z.ZodObject<{
68
+ provider: z.ZodString;
69
+ name: z.ZodString;
70
+ }, z.core.$strict>;
71
+ /** Logical credential identity safe for Flow state. */
72
+ type ConnectionRef = z.infer<typeof ConnectionRefSchema>;
73
+ /** Stable manifest identity of a connector operation. */
74
+ declare const OperationRefSchema: z.ZodObject<{
75
+ connectorId: z.ZodString;
76
+ operationId: z.ZodString;
77
+ }, z.core.$strict>;
78
+ /** Manifest operation identity. */
79
+ type OperationRef = z.infer<typeof OperationRefSchema>;
80
+ /** Derive the Go-compatible UUIDv5 identity from one Dex Step execution. */
81
+ declare function deriveCallID(flowId: string, stepExecutionId: string, operation: OperationRef): CallID;
82
+ /** Provider key fallback for an empty operation-specific idempotency key. */
83
+ declare function defaultIdempotencyKey(callId: CallID): IdempotencyKey;
84
+ /** Stable operation-defined process route. */
85
+ type BranchID = string;
86
+ /** Standard route for local connector defects. */
87
+ declare const DefectBranchID: BranchID;
88
+ /** Optional route for an unsafe, unconfirmable mutation outcome. */
89
+ declare const UncertainBranchID: BranchID;
90
+ /** One declared operation route; only the happy path is required. */
91
+ declare const BranchDefinitionSchema: z.ZodObject<{
92
+ id: z.ZodString;
93
+ description: z.ZodString;
94
+ optional: z.ZodOptional<z.ZodBoolean>;
95
+ }, z.core.$strict>;
96
+ /** One declared operation branch. */
97
+ type BranchDefinition = z.infer<typeof BranchDefinitionSchema>;
98
+ /** Go-compatible Step defaults wire form; durations are nanoseconds. */
99
+ declare const StepDefaultsWireSchema: z.ZodObject<{
100
+ executeMethodTimeout: z.ZodNumber;
101
+ heartbeatTimeout: z.ZodOptional<z.ZodNumber>;
102
+ executeRetry: z.ZodOptional<z.ZodObject<{
103
+ InitialInterval: z.ZodNumber;
104
+ BackoffCoefficient: z.ZodNumber;
105
+ MaximumInterval: z.ZodNumber;
106
+ MaximumAttempts: z.ZodNumber;
107
+ TotalDuration: z.ZodNumber;
108
+ }, z.core.$strict>>;
109
+ executeDurability: z.ZodNumber;
110
+ }, z.core.$strict>;
111
+ /** Wire defaults with durations in nanoseconds. */
112
+ type StepDefaultsWire = z.infer<typeof StepDefaultsWireSchema>;
113
+ /** Query operation definition shared with connector manifests. */
114
+ declare const QueryDefinitionWireSchema: z.ZodObject<{
115
+ operation: z.ZodObject<{
116
+ connectorId: z.ZodString;
117
+ operationId: z.ZodString;
118
+ }, z.core.$strict>;
119
+ branches: z.ZodNullable<z.ZodArray<z.ZodObject<{
120
+ id: z.ZodString;
121
+ description: z.ZodString;
122
+ optional: z.ZodOptional<z.ZodBoolean>;
123
+ }, z.core.$strict>>>;
124
+ stepDefaults: z.ZodObject<{
125
+ executeMethodTimeout: z.ZodNumber;
126
+ heartbeatTimeout: z.ZodOptional<z.ZodNumber>;
127
+ executeRetry: z.ZodOptional<z.ZodObject<{
128
+ InitialInterval: z.ZodNumber;
129
+ BackoffCoefficient: z.ZodNumber;
130
+ MaximumInterval: z.ZodNumber;
131
+ MaximumAttempts: z.ZodNumber;
132
+ TotalDuration: z.ZodNumber;
133
+ }, z.core.$strict>>;
134
+ executeDurability: z.ZodNumber;
135
+ }, z.core.$strict>;
136
+ }, z.core.$strict>;
137
+ /** Query definition wire value. */
138
+ type QueryDefinitionWire = z.infer<typeof QueryDefinitionWireSchema>;
139
+ /** Mutation operation definition shared with connector manifests. */
140
+ declare const MutationDefinitionWireSchema: z.ZodObject<{
141
+ operation: z.ZodObject<{
142
+ connectorId: z.ZodString;
143
+ operationId: z.ZodString;
144
+ }, z.core.$strict>;
145
+ branches: z.ZodNullable<z.ZodArray<z.ZodObject<{
146
+ id: z.ZodString;
147
+ description: z.ZodString;
148
+ optional: z.ZodOptional<z.ZodBoolean>;
149
+ }, z.core.$strict>>>;
150
+ stepDefaults: z.ZodObject<{
151
+ executeMethodTimeout: z.ZodNumber;
152
+ heartbeatTimeout: z.ZodOptional<z.ZodNumber>;
153
+ executeRetry: z.ZodOptional<z.ZodObject<{
154
+ InitialInterval: z.ZodNumber;
155
+ BackoffCoefficient: z.ZodNumber;
156
+ MaximumInterval: z.ZodNumber;
157
+ MaximumAttempts: z.ZodNumber;
158
+ TotalDuration: z.ZodNumber;
159
+ }, z.core.$strict>>;
160
+ executeDurability: z.ZodNumber;
161
+ }, z.core.$strict>;
162
+ }, z.core.$strict>;
163
+ /** Mutation definition wire value. */
164
+ type MutationDefinitionWire = QueryDefinitionWire;
165
+ /** Safe provider correlation data, never credential material. */
166
+ declare const ReceiptSchema: z.ZodObject<{
167
+ callId: z.ZodUUID;
168
+ idempotencyKey: z.ZodOptional<z.ZodString>;
169
+ provider: z.ZodString;
170
+ providerObjectId: z.ZodOptional<z.ZodString>;
171
+ providerRequestId: z.ZodOptional<z.ZodString>;
172
+ observedAt: z.ZodISODateTime;
173
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
174
+ }, z.core.$strict>;
175
+ /** Safe provider correlation receipt. */
176
+ type Receipt = z.infer<typeof ReceiptSchema>;
177
+ /** Receipt fields an operation may supply before the SDK fills call metadata. */
178
+ type ReceiptDraft = Partial<Receipt>;
179
+ /** Go-compatible JSON representation of sdkgo.Receipt{} before call completion. */
180
+ declare function zeroReceipt(): ReceiptDraft;
181
+ /** Validated terminal query result with Go-compatible JSON field names. */
182
+ declare const QueryResultSchema: <T>(valueSchema: z.ZodType<T>) => z.ZodObject<{
183
+ branch: z.ZodString;
184
+ value: z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>;
185
+ receipt: z.ZodObject<{
186
+ callId: z.ZodUUID;
187
+ idempotencyKey: z.ZodOptional<z.ZodString>;
188
+ provider: z.ZodString;
189
+ providerObjectId: z.ZodOptional<z.ZodString>;
190
+ providerRequestId: z.ZodOptional<z.ZodString>;
191
+ observedAt: z.ZodISODateTime;
192
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
193
+ }, z.core.$strict>;
194
+ failure: z.ZodOptional<z.ZodObject<{
195
+ kind: z.ZodEnum<{
196
+ VALIDATION: "VALIDATION";
197
+ AUTHENTICATION: "AUTHENTICATION";
198
+ AUTHORIZATION: "AUTHORIZATION";
199
+ NOT_FOUND: "NOT_FOUND";
200
+ CONFLICT: "CONFLICT";
201
+ RATE_LIMIT: "RATE_LIMIT";
202
+ QUOTA_EXHAUSTED: "QUOTA_EXHAUSTED";
203
+ AVAILABILITY: "AVAILABILITY";
204
+ PROVIDER_REJECTION: "PROVIDER_REJECTION";
205
+ TRANSPORT: "TRANSPORT";
206
+ RESPONSE_TOO_LARGE: "RESPONSE_TOO_LARGE";
207
+ PROTOCOL: "PROTOCOL";
208
+ LOCAL_DEFECT: "LOCAL_DEFECT";
209
+ }>;
210
+ provider: z.ZodString;
211
+ operation: z.ZodString;
212
+ message: z.ZodString;
213
+ }, z.core.$strict>>;
214
+ }, z.core.$strict>;
215
+ /** Terminal query value and its selected branch. */
216
+ type QueryResult<T> = {
217
+ branch: BranchID;
218
+ value: T;
219
+ receipt: Receipt;
220
+ failure?: Failure;
221
+ };
222
+ /** Validated terminal mutation result with Go-compatible JSON field names. */
223
+ declare const MutationResultSchema: <T>(valueSchema: z.ZodType<T>) => z.ZodObject<{
224
+ branch: z.ZodString;
225
+ value: z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>;
226
+ receipt: z.ZodObject<{
227
+ callId: z.ZodUUID;
228
+ idempotencyKey: z.ZodOptional<z.ZodString>;
229
+ provider: z.ZodString;
230
+ providerObjectId: z.ZodOptional<z.ZodString>;
231
+ providerRequestId: z.ZodOptional<z.ZodString>;
232
+ observedAt: z.ZodISODateTime;
233
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
234
+ }, z.core.$strict>;
235
+ failure: z.ZodOptional<z.ZodObject<{
236
+ kind: z.ZodEnum<{
237
+ VALIDATION: "VALIDATION";
238
+ AUTHENTICATION: "AUTHENTICATION";
239
+ AUTHORIZATION: "AUTHORIZATION";
240
+ NOT_FOUND: "NOT_FOUND";
241
+ CONFLICT: "CONFLICT";
242
+ RATE_LIMIT: "RATE_LIMIT";
243
+ QUOTA_EXHAUSTED: "QUOTA_EXHAUSTED";
244
+ AVAILABILITY: "AVAILABILITY";
245
+ PROVIDER_REJECTION: "PROVIDER_REJECTION";
246
+ TRANSPORT: "TRANSPORT";
247
+ RESPONSE_TOO_LARGE: "RESPONSE_TOO_LARGE";
248
+ PROTOCOL: "PROTOCOL";
249
+ LOCAL_DEFECT: "LOCAL_DEFECT";
250
+ }>;
251
+ provider: z.ZodString;
252
+ operation: z.ZodString;
253
+ message: z.ZodString;
254
+ }, z.core.$strict>>;
255
+ }, z.core.$strict>;
256
+ /** Terminal mutation value and its selected branch. */
257
+ type MutationResult<T> = QueryResult<T>;
258
+ /** One query invocation outcome; only constructors create valid attempts. */
259
+ type QueryAttempt<T> = {
260
+ readonly kind: 'branch';
261
+ readonly branch: BranchID;
262
+ readonly value: T;
263
+ readonly receipt: ReceiptDraft;
264
+ readonly failure?: Failure;
265
+ } | {
266
+ readonly kind: 'retry';
267
+ readonly failure: Failure;
268
+ readonly retryAfterMs: number;
269
+ };
270
+ /** One mutation invocation outcome; uncertainty is reserved for unsafe, unconfirmable writes. */
271
+ type MutationAttempt<T> = QueryAttempt<T> | {
272
+ readonly kind: 'uncertain';
273
+ readonly value: T;
274
+ readonly receipt: ReceiptDraft;
275
+ readonly failure: Failure;
276
+ };
277
+ /** Construct a terminal query branch. */
278
+ declare function newQueryBranch<T>(branch: BranchID, value: T, receipt?: ReceiptDraft, failure?: Failure): QueryAttempt<T>;
279
+ /** Construct a retryable query failure with an optional provider delay in milliseconds. */
280
+ declare function newQueryRetry<T>(failure: Failure, retryAfterMs?: number): QueryAttempt<T>;
281
+ /** Construct a terminal mutation branch. */
282
+ declare function newMutationBranch<T>(branch: BranchID, value: T, receipt?: ReceiptDraft, failure?: Failure): MutationAttempt<T>;
283
+ /** Construct a retryable mutation failure when repeating the effect is safe. */
284
+ declare function newMutationRetry<T>(failure: Failure, retryAfterMs?: number): MutationAttempt<T>;
285
+ /** Construct an uncertain mutation only after proving repeat and read-back are unsafe. */
286
+ declare function newMutationUncertain<T>(value: T, failure: Failure, receipt?: ReceiptDraft): MutationAttempt<T>;
287
+ /** Dex Execute retry policy using millisecond durations. */
288
+ interface RetryPolicy {
289
+ /** Delay before the first retry. */ initialIntervalMs: number;
290
+ /** Multiplier applied between attempts. */ backoffCoefficient: number;
291
+ /** Maximum delay between attempts. */ maximumIntervalMs: number;
292
+ /** Zero means unlimited attempts within total duration. */ maximumAttempts: number;
293
+ /** Overall bound including the first attempt. */ totalDurationMs: number;
294
+ }
295
+ /** Return a fresh one-hour connector retry policy. */
296
+ declare function defaultConnectorStepExecuteRetryPolicy(): RetryPolicy;
297
+ /** Encode the retry policy in Dex Go's nanosecond JSON wire form. */
298
+ declare function retryPolicyToGoWire(policy: RetryPolicy): Record<string, number>;
299
+ /** Connector-owned UI binding from a unit port to configuration JSON. */
300
+ declare const ConnectorUIBindingSchema: z.ZodObject<{
301
+ port: z.ZodString;
302
+ jsonPointer: z.ZodString;
303
+ }, z.core.$strict>;
304
+ /** Bind a UI port to a configuration JSON pointer. */
305
+ type ConnectorUIBinding = z.infer<typeof ConnectorUIBindingSchema>;
306
+ /** Reusable connector UI unit with contextual guidance and ordered bindings. */
307
+ declare const ConnectorUIUnitSchema: z.ZodObject<{
308
+ id: z.ZodString;
309
+ unitId: z.ZodString;
310
+ label: z.ZodString;
311
+ description: z.ZodString;
312
+ required: z.ZodBoolean;
313
+ bindings: z.ZodArray<z.ZodObject<{
314
+ port: z.ZodString;
315
+ jsonPointer: z.ZodString;
316
+ }, z.core.$strict>>;
317
+ }, z.core.$strict>;
318
+ /** Contextual connector UI unit. */
319
+ type ConnectorUIUnit = z.infer<typeof ConnectorUIUnitSchema>;
320
+ /** Ordered connector-owned UI units composed by Dex Web. */
321
+ declare const ConnectorConfigurationUISchema: z.ZodObject<{
322
+ units: z.ZodArray<z.ZodObject<{
323
+ id: z.ZodString;
324
+ unitId: z.ZodString;
325
+ label: z.ZodString;
326
+ description: z.ZodString;
327
+ required: z.ZodBoolean;
328
+ bindings: z.ZodArray<z.ZodObject<{
329
+ port: z.ZodString;
330
+ jsonPointer: z.ZodString;
331
+ }, z.core.$strict>>;
332
+ }, z.core.$strict>>;
333
+ }, z.core.$strict>;
334
+ /** Ordered connector UI configuration. */
335
+ type ConnectorConfigurationUI = z.infer<typeof ConnectorConfigurationUISchema>;
336
+ /** Stable Flow and Step use that owns one operation configuration. */
337
+ declare const ConnectorConfigurationRefSchema: z.ZodObject<{
338
+ connectorId: z.ZodString;
339
+ connectionName: z.ZodString;
340
+ operationId: z.ZodString;
341
+ flowType: z.ZodString;
342
+ stepType: z.ZodString;
343
+ }, z.core.$strict>;
344
+ /** Stable Flow and Step configuration owner. */
345
+ type ConnectorConfigurationRef = z.infer<typeof ConnectorConfigurationRefSchema>;
346
+
347
+ /** Provider-safe progress before Dex identity and sequence are added. */
348
+ interface Progress {
349
+ /** Provider-specific stable phase. */ phase: string;
350
+ /** Optional safe progress text. */ message?: string;
351
+ /** Optional inclusive fraction from zero to one. */ percent?: number;
352
+ /** Optional provider-owned monotonic sequence. */ providerSequence?: number;
353
+ }
354
+ /** Structured best-effort Dex Stream message. */
355
+ interface ProgressUpdate extends Progress {
356
+ /** Stable connector call ID. */ callId: CallID;
357
+ /** One-based Dex Execute attempt. */ attempt: number;
358
+ /** Connector-assigned monotonic sequence within this attempt. */ sequence: number;
359
+ }
360
+ /** Optional application-owned Streams for one connector invocation. */
361
+ interface CallProgressOptions {
362
+ /** Registered structured progress Stream. */ progressStream?: Stream<ProgressUpdate>;
363
+ /** Registered string Stream for ordered buffered text. */ textStream?: Stream<string>;
364
+ /** Flush interval and soft UTF-8 batch limit for text. */ textOptions?: BufferedTextStreamOptions;
365
+ }
366
+ /** Provider-safe call metadata with its live, non-serializable Dex Step context. */
367
+ interface Call {
368
+ /** Active Dex Execute context; Step factories attach it as a non-enumerable field. */ context: AsyncContext;
369
+ /** Stable identity across retries. */ id: CallID;
370
+ /** Provider deduplication key, when available. */ idempotencyKey?: string;
371
+ /** Logical named connection. */ connection: ConnectionRef;
372
+ /** Manifest operation identity. */ operation: OperationRef;
373
+ /** Append structured progress when a Stream is configured. */ reportProgress(progress: Progress): void;
374
+ /** Append text in order when a buffered Stream is configured. */ writeText(value: string): void;
375
+ /** Whether structured progress output is configured. */ hasProgressStream(): boolean;
376
+ /** Whether buffered text output is configured. */ hasTextStream(): boolean;
377
+ }
378
+ /** Bind a live Dex Execute context to a stable, provider-safe call identity. */
379
+ declare function createCall(context: AsyncContext, connection: ConnectionRef, operation: OperationRef, options?: CallProgressOptions): Call;
380
+ /** Resolve a credential at call time outside durable Flow state. */
381
+ interface CredentialProvider<C> {
382
+ /** Return current credentials, honoring cancellation. */
383
+ resolve(call: Call, signal?: AbortSignal): Promise<C>;
384
+ }
385
+ /** Resolve credentials outside a Dex Step, such as for a Trigger source. */
386
+ interface ContextCredentialProvider<C> extends CredentialProvider<C> {
387
+ /** Return current credentials under an explicit cancellation signal. */
388
+ resolveContext(call: Call, signal: AbortSignal): Promise<C>;
389
+ }
390
+ /** Current private material and decision time for a refresh driver. */
391
+ interface CredentialRefreshState<C> {
392
+ /** Current connector-specific credential. */ credentials: C;
393
+ /** Known access credential expiry. */ expiresAt?: Date;
394
+ /** Captured decision time. */ now: Date;
395
+ }
396
+ /** Complete replacement credential and mandatory access expiry. */
397
+ interface CredentialRefreshResult<C> {
398
+ /** Complete replacement, retaining omitted renewal material. */ credentials: C;
399
+ /** Replacement access expiry. */ expiresAt: Date;
400
+ }
401
+ /** Connector-specific provider refresh contract; persistence belongs to the host. */
402
+ interface CredentialRefreshDriver<C> {
403
+ /** Decide deterministically whether a credential needs provider renewal. */
404
+ refreshRequired(state: CredentialRefreshState<C>): boolean;
405
+ /** Make one provider refresh request after the host admits it durably. */
406
+ refresh(state: CredentialRefreshState<C>, signal: AbortSignal): Promise<CredentialRefreshResult<C>>;
407
+ }
408
+ /** Host adapter that refreshes and persists a connection atomically. */
409
+ interface RefreshingCredentialProvider<C> extends CredentialProvider<C> {
410
+ /** Serialize refresh for one connection, reload state, and persist replacement. */
411
+ resolveWithRefresh(call: Call, driver: CredentialRefreshDriver<C>, signal?: AbortSignal): Promise<C>;
412
+ }
413
+ /** Host adapter for one explicit provider authentication rejection. */
414
+ interface RejectedCredentialRefreshingProvider<C> {
415
+ /** Force one coordinated refresh after the provider rejects an access token. */
416
+ resolveAfterRejection(call: Call, driver: CredentialRefreshDriver<C>, signal?: AbortSignal): Promise<C>;
417
+ }
418
+ /** Resolve through host refresh support, then context-aware or ordinary lookup. */
419
+ declare function resolveCredential<C>(provider: CredentialProvider<C>, call: Call, driver: CredentialRefreshDriver<C>, signal?: AbortSignal): Promise<C>;
420
+ /** Force one coordinated refresh after a provider authentication rejection. */
421
+ declare function resolveCredentialAfterRejection<C>(provider: CredentialProvider<C>, call: Call, driver: CredentialRefreshDriver<C>, signal?: AbortSignal): Promise<C>;
422
+ /** In-memory named credentials for examples and tests; never persisted by this class. */
423
+ declare class StaticCredentialProvider<C> implements RefreshingCredentialProvider<C> {
424
+ #private;
425
+ /** Capture all connection values during construction. */
426
+ constructor(entries: Iterable<readonly [ConnectionRef, C]>);
427
+ /** Return the configured credential or reject a missing connection. */
428
+ resolve(call: Call): Promise<C>;
429
+ /** Static credentials never expire and therefore do not call the driver. */
430
+ resolveWithRefresh(call: Call): Promise<C>;
431
+ }
432
+ /** Wrap a secret that cannot be serialized or printed. */
433
+ declare class SecretString {
434
+ #private;
435
+ /** Hold one private value outside default stringification and inspection. */
436
+ constructor(value: string);
437
+ /** Reveal only at the provider request boundary. */
438
+ reveal(): string;
439
+ /** Return a fixed redaction for accidental string formatting. */
440
+ toString(): string;
441
+ /** Reject accidental JSON persistence. */
442
+ toJSON(): never;
443
+ }
444
+
445
+ export { StaticCredentialProvider as $, type MutationDefinitionWire as A, type BranchID as B, type Call as C, DefectBranchID as D, MutationDefinitionWireSchema as E, type Failure as F, MutationResultSchema as G, OperationRefSchema as H, type IdempotencyKey as I, type Progress as J, type QueryDefinitionWire as K, QueryDefinitionWireSchema as L, type MutationAttempt as M, QueryResultSchema as N, type OperationRef as O, type ProgressUpdate as P, type QueryAttempt as Q, ReauthorizationRequiredError as R, type Receipt as S, type ReceiptDraft as T, UncertainBranchID as U, ReceiptSchema as V, type RefreshingCredentialProvider as W, type RejectedCredentialRefreshingProvider as X, RetryError as Y, type RetryPolicy as Z, SecretString as _, type CallID as a, type StepDefaultsWire as a0, StepDefaultsWireSchema as a1, createCall as a2, defaultConnectorStepExecuteRetryPolicy as a3, defaultIdempotencyKey as a4, deriveCallID as a5, newMutationBranch as a6, newMutationRetry as a7, newMutationUncertain as a8, newQueryBranch as a9, newQueryRetry as aa, resolveCredential as ab, resolveCredentialAfterRejection as ac, retryPolicyToGoWire as ad, zeroReceipt as ae, type MutationResult as b, type QueryResult as c, type ConnectorConfigurationUI as d, type ConnectionRef as e, type BranchDefinition as f, BranchDefinitionSchema as g, CallIDNamespace as h, CallIDSchema as i, type CallProgressOptions as j, ConnectionRefSchema as k, type ConnectorConfigurationRef as l, ConnectorConfigurationRefSchema as m, ConnectorConfigurationUISchema as n, type ConnectorUIBinding as o, ConnectorUIBindingSchema as p, type ConnectorUIUnit as q, ConnectorUIUnitSchema as r, type ContextCredentialProvider as s, type CredentialProvider as t, type CredentialRefreshDriver as u, type CredentialRefreshResult as v, type CredentialRefreshState as w, type FailureKind as x, FailureKindSchema as y, FailureSchema as z };
@@ -0,0 +1,81 @@
1
+ import { C as Call, b as MutationResult, c as QueryResult, d as ConnectorConfigurationUI, e as ConnectionRef, P as ProgressUpdate } from './credentials-vrvW0d4j.js';
2
+ export { f as BranchDefinition, g as BranchDefinitionSchema, B as BranchID, a as CallID, h as CallIDNamespace, i as CallIDSchema, j as CallProgressOptions, k as ConnectionRefSchema, l as ConnectorConfigurationRef, m as ConnectorConfigurationRefSchema, n as ConnectorConfigurationUISchema, o as ConnectorUIBinding, p as ConnectorUIBindingSchema, q as ConnectorUIUnit, r as ConnectorUIUnitSchema, s as ContextCredentialProvider, t as CredentialProvider, u as CredentialRefreshDriver, v as CredentialRefreshResult, w as CredentialRefreshState, D as DefectBranchID, F as Failure, x as FailureKind, y as FailureKindSchema, z as FailureSchema, I as IdempotencyKey, M as MutationAttempt, A as MutationDefinitionWire, E as MutationDefinitionWireSchema, G as MutationResultSchema, O as OperationRef, H as OperationRefSchema, J as Progress, Q as QueryAttempt, K as QueryDefinitionWire, L as QueryDefinitionWireSchema, N as QueryResultSchema, R as ReauthorizationRequiredError, S as Receipt, T as ReceiptDraft, V as ReceiptSchema, W as RefreshingCredentialProvider, X as RejectedCredentialRefreshingProvider, Y as RetryError, Z as RetryPolicy, _ as SecretString, $ as StaticCredentialProvider, a0 as StepDefaultsWire, a1 as StepDefaultsWireSchema, U as UncertainBranchID, a2 as createCall, a3 as defaultConnectorStepExecuteRetryPolicy, a4 as defaultIdempotencyKey, a5 as deriveCallID, a6 as newMutationBranch, a7 as newMutationRetry, a8 as newMutationUncertain, a9 as newQueryBranch, aa as newQueryRetry, ab as resolveCredential, ac as resolveCredentialAfterRejection, ad as retryPolicyToGoWire, ae as zeroReceipt } from './credentials-vrvW0d4j.js';
3
+ import { M as Mutation, b as Query } from './operation-Ca8rfacf.js';
4
+ export { a as MutationDefinition, Q as QueryDefinition, S as StepDefaults, v as validateMutationDefinition, c as validateQueryDefinition } from './operation-Ca8rfacf.js';
5
+ import { StepTarget, Step, Codec, Attribute, Stream, BufferedTextStreamOptions, StepOptions, AsyncContext, StepDecision, StepRef } from '@superdurable/dex';
6
+ import 'zod';
7
+
8
+ /** Invoke a query once and validate its provider-safe terminal result. */
9
+ declare function runQuery<Input, Output>(operation: Query<Input, Output>, call: Call, input: Input): Promise<QueryResult<Output>>;
10
+ /** Invoke a mutation once with its stable key and validate the classified outcome. */
11
+ declare function runMutation<Input, Output>(operation: Mutation<Input, Output>, call: Call, input: Input): Promise<MutationResult<Output>>;
12
+
13
+ /** Stable Dex authoring metadata for one Connector Step. */
14
+ interface StepAnnotations {
15
+ /** Lowercase stable group identifier. */ groupId: string;
16
+ /** Human-readable group label. */ groupLabel: string;
17
+ /** One-sentence Step explanation. */ explanation: string;
18
+ }
19
+ /** Typed branch destination, including a registered Step instance or StepRef. */
20
+ interface BranchTarget<Result> {
21
+ /** Declared operation branch. */ branch: string;
22
+ /** Destination; an omitted target is allowed only for an optional branch. */ target?: StepTarget<Result>;
23
+ }
24
+ /** Bind one declared branch to a registered Step destination. */
25
+ declare function goToBranch<Result>(branch: string, target?: StepTarget<Result>): BranchTarget<Result>;
26
+ /** Address a registered Step by stable type without constructing its implementation. */
27
+ declare function stepRef(stepType: string): StepRef;
28
+ /** Configure an advanced generic Query Step; operation-specific generated factories are preferred. */
29
+ interface QueryStepConfig<StepInput, OperationInput, Output> {
30
+ /** Stable Dex Step type. */ stepType: string;
31
+ /** Group and explanation metadata. */ annotations: StepAnnotations;
32
+ /** Optional Connector Studio configuration UI. */ configurationUI?: ConnectorConfigurationUI;
33
+ /** Read-only provider operation. */ operation: Query<OperationInput, Output>;
34
+ /** Logical credential selection. */ connection: ConnectionRef;
35
+ /** Map the application's Step input to operation input. */ mapToOperationInput(input: StepInput): OperationInput;
36
+ /** Routes for every required branch and selected optional branches. */ branches: readonly BranchTarget<QueryResult<Output>>[];
37
+ /** Optional terminal result Attribute registered in the Flow schema. */ resultAttribute?: Attribute<QueryResult<Output>>;
38
+ /** Optional structured progress Stream registered in the Flow schema. */ progressStream?: Stream<ProgressUpdate>;
39
+ /** Optional buffered text Stream registered in the Flow schema. */ textStream?: Stream<string>;
40
+ /** Optional text batch sizing and flush interval. */ textOptions?: BufferedTextStreamOptions;
41
+ /** Optional codec for non-object Step input. */ inputCodec?: Codec<StepInput>;
42
+ /** Execute-only Dex options overriding manifest defaults. */ stepOptionsOverride?: StepOptions;
43
+ }
44
+ /** Configure an advanced generic Mutation Step. */
45
+ interface MutationStepConfig<StepInput, OperationInput, Output> extends Omit<QueryStepConfig<StepInput, OperationInput, Output>, 'operation' | 'branches' | 'resultAttribute'> {
46
+ /** Provider write operation. */ operation: Mutation<OperationInput, Output>;
47
+ /** Routes for every required branch and selected optional branches. */ branches: readonly BranchTarget<MutationResult<Output>>[];
48
+ /** Optional terminal result Attribute registered in the Flow schema. */ resultAttribute?: Attribute<MutationResult<Output>>;
49
+ }
50
+ /** Query Step that invokes one provider operation per Dex Execute attempt. */
51
+ declare class QueryStep<StepInput, OperationInput, Output> implements Step<StepInput> {
52
+ #private;
53
+ readonly inputCodec?: Codec<StepInput>;
54
+ /** Validate static wiring before registering the Step in a Flow. */
55
+ constructor(configuration: QueryStepConfig<StepInput, OperationInput, Output>);
56
+ /** Stable Dex Step type. */ getStepType(): string;
57
+ /** Isolated Execute options, including connector retry defaults. */ getStepOptions(): StepOptions;
58
+ /** Group metadata for Connector Studio. */ annotations(): StepAnnotations;
59
+ /** Isolated connector UI composition. */ configurationUI(): ConnectorConfigurationUI;
60
+ /** Invoke, persist the optional terminal Attribute, and route the selected branch. */
61
+ execute(context: AsyncContext, input: StepInput): Promise<StepDecision>;
62
+ }
63
+ /** Mutation Step that keeps stable provider identity across Dex retries. */
64
+ declare class MutationStep<StepInput, OperationInput, Output> implements Step<StepInput> {
65
+ #private;
66
+ readonly inputCodec?: Codec<StepInput>;
67
+ /** Validate static wiring before registering the Step in a Flow. */
68
+ constructor(configuration: MutationStepConfig<StepInput, OperationInput, Output>);
69
+ /** Stable Dex Step type. */ getStepType(): string;
70
+ /** Isolated Execute options, including connector retry defaults. */ getStepOptions(): StepOptions;
71
+ /** Group metadata for Connector Studio. */ annotations(): StepAnnotations;
72
+ /** Isolated connector UI composition. */ configurationUI(): ConnectorConfigurationUI;
73
+ /** Invoke, persist the optional terminal Attribute, and route the selected branch. */
74
+ execute(context: AsyncContext, input: StepInput): Promise<StepDecision>;
75
+ }
76
+ /** Construct a Query Step after validating its static routing. */
77
+ declare function newQueryStep<StepInput, OperationInput, Output>(configuration: QueryStepConfig<StepInput, OperationInput, Output>): QueryStep<StepInput, OperationInput, Output>;
78
+ /** Construct a Mutation Step after validating its static routing. */
79
+ declare function newMutationStep<StepInput, OperationInput, Output>(configuration: MutationStepConfig<StepInput, OperationInput, Output>): MutationStep<StepInput, OperationInput, Output>;
80
+
81
+ export { type BranchTarget, Call, ConnectionRef, ConnectorConfigurationUI, Mutation, MutationResult, MutationStep, type MutationStepConfig, ProgressUpdate, Query, QueryResult, QueryStep, type QueryStepConfig, type StepAnnotations, goToBranch, newMutationStep, newQueryStep, runMutation, runQuery, stepRef };