@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.
- package/LICENSE +21 -0
- package/README.md +264 -2
- package/dist/chunk-2NBM7P4T.js +42 -0
- package/dist/chunk-IVJLNZVL.js +248 -0
- package/dist/chunk-KD5DYYSU.js +93 -0
- package/dist/chunk-SOXYPIMO.js +179 -0
- package/dist/connectormock/index.d.ts +181 -0
- package/dist/connectormock/index.js +350 -0
- package/dist/credentials-vrvW0d4j.d.ts +445 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +376 -0
- package/dist/oauthtoken/index.d.ts +90 -0
- package/dist/oauthtoken/index.js +236 -0
- package/dist/operation-Ca8rfacf.d.ts +34 -0
- package/dist/projectconfig/index.d.ts +569 -0
- package/dist/projectconfig/index.js +1433 -0
- package/dist/providerhttp/index.d.ts +57 -0
- package/dist/providerhttp/index.js +26 -0
- package/dist/singledispatch/index.d.ts +72 -0
- package/dist/singledispatch/index.js +178 -0
- package/package.json +73 -4
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { inspect } from 'node:util';
|
|
3
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
4
|
+
import { t as CredentialProvider$1, C as Call, W as RefreshingCredentialProvider$1, X as RejectedCredentialRefreshingProvider, u as CredentialRefreshDriver } from '../credentials-vrvW0d4j.js';
|
|
5
|
+
import '@superdurable/dex';
|
|
6
|
+
|
|
7
|
+
/** Current secret-free project configuration schema shared with Dex Web. */
|
|
8
|
+
declare const ConfigurationSchemaVersion = "connectors.dex.dev/project-configuration/v1alpha3";
|
|
9
|
+
/** Local Dex Web connections file schema. */
|
|
10
|
+
declare const LocalConnectionsSchemaVersion = "connectors.dex.dev/local-connections/v1alpha1";
|
|
11
|
+
/** RFC3339 timestamp with at most nanosecond precision. */
|
|
12
|
+
declare const RFC3339NanoSchema: z.ZodISODateTime;
|
|
13
|
+
/** Fixed project and Live or Preview credential boundary. */
|
|
14
|
+
declare const ScopeSchema: z.ZodObject<{
|
|
15
|
+
projectId: z.ZodString;
|
|
16
|
+
kind: z.ZodEnum<{
|
|
17
|
+
live: "live";
|
|
18
|
+
preview: "preview";
|
|
19
|
+
}>;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
/** Project ID and live or preview scope. */
|
|
22
|
+
type Scope = z.infer<typeof ScopeSchema>;
|
|
23
|
+
/** Return the canonical relative storage prefix for a trusted scope. */
|
|
24
|
+
declare function scopePrefix(scope: Scope): string;
|
|
25
|
+
/** Exact versioned private application secret reference. */
|
|
26
|
+
declare const ApplicationSecretRefSchema: z.ZodObject<{
|
|
27
|
+
key: z.ZodString;
|
|
28
|
+
version: z.ZodString;
|
|
29
|
+
digest: z.ZodString;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
/** Immutable private application secret reference. */
|
|
32
|
+
type ApplicationSecretRef = z.infer<typeof ApplicationSecretRefSchema>;
|
|
33
|
+
/** Ordinary or private application environment value. */
|
|
34
|
+
declare const EnvironmentValueSchema: z.ZodObject<{
|
|
35
|
+
value: z.ZodOptional<z.ZodString>;
|
|
36
|
+
secretRef: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
key: z.ZodString;
|
|
38
|
+
version: z.ZodString;
|
|
39
|
+
digest: z.ZodString;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
/** Ordinary value or private secret reference. */
|
|
43
|
+
type EnvironmentValue = z.infer<typeof EnvironmentValueSchema>;
|
|
44
|
+
/** Logical connection and manifest-validated ordinary settings. */
|
|
45
|
+
declare const ConnectionConfigurationSchema: z.ZodObject<{
|
|
46
|
+
connectorId: z.ZodString;
|
|
47
|
+
connectionName: z.ZodString;
|
|
48
|
+
modulePath: z.ZodString;
|
|
49
|
+
provider: z.ZodString;
|
|
50
|
+
authMethodId: z.ZodOptional<z.ZodString>;
|
|
51
|
+
sharedConnectionId: z.ZodOptional<z.ZodString>;
|
|
52
|
+
configuration: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
/** Ordinary connection configuration and optional shared identity. */
|
|
55
|
+
type ConnectionConfiguration = z.infer<typeof ConnectionConfigurationSchema>;
|
|
56
|
+
/** Connector Trigger binding startup settings. */
|
|
57
|
+
declare const TriggerConfigurationSchema: z.ZodObject<{
|
|
58
|
+
connectorId: z.ZodString;
|
|
59
|
+
connectionName: z.ZodString;
|
|
60
|
+
triggerName: z.ZodString;
|
|
61
|
+
bindingName: z.ZodString;
|
|
62
|
+
configuration: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
/** Trigger binding and ordinary configuration. */
|
|
65
|
+
type TriggerConfiguration = z.infer<typeof TriggerConfigurationSchema>;
|
|
66
|
+
/** Exact Flow and Step use configuration. */
|
|
67
|
+
declare const OperationConfigurationSchema: z.ZodObject<{
|
|
68
|
+
connectorId: z.ZodString;
|
|
69
|
+
connectionName: z.ZodString;
|
|
70
|
+
operationId: z.ZodString;
|
|
71
|
+
flowType: z.ZodString;
|
|
72
|
+
stepType: z.ZodString;
|
|
73
|
+
configuration: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
74
|
+
}, z.core.$strict>;
|
|
75
|
+
/** Operation configuration for one Flow and Step. */
|
|
76
|
+
type OperationConfiguration = z.infer<typeof OperationConfigurationSchema>;
|
|
77
|
+
/** Scope-owned credential broker endpoint and exact scope token reference. */
|
|
78
|
+
declare const CredentialBrokerConfigurationSchema: z.ZodObject<{
|
|
79
|
+
endpoint: z.ZodURL;
|
|
80
|
+
tokenSecretRef: z.ZodObject<{
|
|
81
|
+
key: z.ZodString;
|
|
82
|
+
version: z.ZodString;
|
|
83
|
+
digest: z.ZodString;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
}, z.core.$strict>;
|
|
86
|
+
/** Shared credential broker endpoint and token reference. */
|
|
87
|
+
type CredentialBrokerConfiguration = z.infer<typeof CredentialBrokerConfigurationSchema>;
|
|
88
|
+
/** Immutable ordinary project configuration snapshot. */
|
|
89
|
+
declare const ConfigurationSchema: z.ZodObject<{
|
|
90
|
+
schemaVersion: z.ZodEnum<{
|
|
91
|
+
"connectors.dex.dev/project-configuration/v1alpha3": "connectors.dex.dev/project-configuration/v1alpha3";
|
|
92
|
+
"connectors.dex.dev/project-configuration/v1alpha2": "connectors.dex.dev/project-configuration/v1alpha2";
|
|
93
|
+
}>;
|
|
94
|
+
scope: z.ZodObject<{
|
|
95
|
+
projectId: z.ZodString;
|
|
96
|
+
kind: z.ZodEnum<{
|
|
97
|
+
live: "live";
|
|
98
|
+
preview: "preview";
|
|
99
|
+
}>;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
revision: z.ZodNumber;
|
|
102
|
+
connections: z.ZodArray<z.ZodObject<{
|
|
103
|
+
connectorId: z.ZodString;
|
|
104
|
+
connectionName: z.ZodString;
|
|
105
|
+
modulePath: z.ZodString;
|
|
106
|
+
provider: z.ZodString;
|
|
107
|
+
authMethodId: z.ZodOptional<z.ZodString>;
|
|
108
|
+
sharedConnectionId: z.ZodOptional<z.ZodString>;
|
|
109
|
+
configuration: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
110
|
+
}, z.core.$strict>>;
|
|
111
|
+
triggerBindings: z.ZodArray<z.ZodObject<{
|
|
112
|
+
connectorId: z.ZodString;
|
|
113
|
+
connectionName: z.ZodString;
|
|
114
|
+
triggerName: z.ZodString;
|
|
115
|
+
bindingName: z.ZodString;
|
|
116
|
+
configuration: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
117
|
+
}, z.core.$strict>>;
|
|
118
|
+
operationConfigurations: z.ZodArray<z.ZodObject<{
|
|
119
|
+
connectorId: z.ZodString;
|
|
120
|
+
connectionName: z.ZodString;
|
|
121
|
+
operationId: z.ZodString;
|
|
122
|
+
flowType: z.ZodString;
|
|
123
|
+
stepType: z.ZodString;
|
|
124
|
+
configuration: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
125
|
+
}, z.core.$strict>>;
|
|
126
|
+
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
127
|
+
value: z.ZodOptional<z.ZodString>;
|
|
128
|
+
secretRef: z.ZodOptional<z.ZodObject<{
|
|
129
|
+
key: z.ZodString;
|
|
130
|
+
version: z.ZodString;
|
|
131
|
+
digest: z.ZodString;
|
|
132
|
+
}, z.core.$strict>>;
|
|
133
|
+
}, z.core.$strict>>>;
|
|
134
|
+
credentialBroker: z.ZodOptional<z.ZodObject<{
|
|
135
|
+
endpoint: z.ZodURL;
|
|
136
|
+
tokenSecretRef: z.ZodObject<{
|
|
137
|
+
key: z.ZodString;
|
|
138
|
+
version: z.ZodString;
|
|
139
|
+
digest: z.ZodString;
|
|
140
|
+
}, z.core.$strict>;
|
|
141
|
+
}, z.core.$strict>>;
|
|
142
|
+
}, z.core.$strict>;
|
|
143
|
+
/** Versioned ordinary project configuration. */
|
|
144
|
+
type Configuration = z.infer<typeof ConfigurationSchema>;
|
|
145
|
+
/** Exact immutable configuration object version and digest. */
|
|
146
|
+
declare const SnapshotRefSchema: z.ZodObject<{
|
|
147
|
+
key: z.ZodString;
|
|
148
|
+
version: z.ZodString;
|
|
149
|
+
digest: z.ZodString;
|
|
150
|
+
mediaType: z.ZodLiteral<"application/json">;
|
|
151
|
+
}, z.core.$strict>;
|
|
152
|
+
/** Exact immutable configuration snapshot reference. */
|
|
153
|
+
type SnapshotRef = z.infer<typeof SnapshotRefSchema>;
|
|
154
|
+
/** Local Dex Web record; credential contents remain private. */
|
|
155
|
+
declare const LocalConnectionSchema: z.ZodObject<{
|
|
156
|
+
connectorId: z.ZodString;
|
|
157
|
+
connectionName: z.ZodString;
|
|
158
|
+
modulePath: z.ZodString;
|
|
159
|
+
provider: z.ZodString;
|
|
160
|
+
authMethodId: z.ZodOptional<z.ZodString>;
|
|
161
|
+
authMethodIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
162
|
+
configuration: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
163
|
+
credentials: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
164
|
+
credentialExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
/** Private Dex Web connection record. */
|
|
167
|
+
type LocalConnection = z.infer<typeof LocalConnectionSchema>;
|
|
168
|
+
/** Dex Web local file, allowing future additive members. */
|
|
169
|
+
declare const LocalConnectionsFileSchema: z.ZodObject<{
|
|
170
|
+
schemaVersion: z.ZodLiteral<"connectors.dex.dev/local-connections/v1alpha1">;
|
|
171
|
+
connections: z.ZodArray<z.ZodObject<{
|
|
172
|
+
connectorId: z.ZodString;
|
|
173
|
+
connectionName: z.ZodString;
|
|
174
|
+
modulePath: z.ZodString;
|
|
175
|
+
provider: z.ZodString;
|
|
176
|
+
authMethodId: z.ZodOptional<z.ZodString>;
|
|
177
|
+
authMethodIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
178
|
+
configuration: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
179
|
+
credentials: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
180
|
+
credentialExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
181
|
+
}, z.core.$strip>>;
|
|
182
|
+
triggerBindings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
183
|
+
connectorId: z.ZodString;
|
|
184
|
+
connectionName: z.ZodString;
|
|
185
|
+
triggerName: z.ZodString;
|
|
186
|
+
bindingName: z.ZodString;
|
|
187
|
+
configuration: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
188
|
+
}, z.core.$strict>>>;
|
|
189
|
+
}, z.core.$strip>;
|
|
190
|
+
/** Private Dex Web local connections file. */
|
|
191
|
+
type LocalConnectionsFile = z.infer<typeof LocalConnectionsFileSchema>;
|
|
192
|
+
|
|
193
|
+
/** Object is absent at the requested key or exact version. */
|
|
194
|
+
declare class ObjectNotFoundError extends Error {
|
|
195
|
+
constructor();
|
|
196
|
+
}
|
|
197
|
+
/** Conditional write lost to another revision. */
|
|
198
|
+
declare class ConflictError extends Error {
|
|
199
|
+
constructor();
|
|
200
|
+
}
|
|
201
|
+
/** Write acceptance is unknown and must be reconciled before another mutation. */
|
|
202
|
+
declare class OutcomeUnknownError extends Error {
|
|
203
|
+
constructor();
|
|
204
|
+
}
|
|
205
|
+
/** Private object with exact version and compare-and-swap identity. */
|
|
206
|
+
declare class ProjectObject {
|
|
207
|
+
#private;
|
|
208
|
+
readonly key: string;
|
|
209
|
+
readonly version: string;
|
|
210
|
+
readonly etag: string;
|
|
211
|
+
/** Keep private bytes outside Node inspection; key, version, and ETag identify the exact object. */
|
|
212
|
+
constructor(key: string, version: string, etag: string, contents: Uint8Array);
|
|
213
|
+
/** Exact private bytes; callers must not log or persist them. */
|
|
214
|
+
get contents(): Uint8Array;
|
|
215
|
+
/** Never format private contents. */
|
|
216
|
+
toString(): string;
|
|
217
|
+
/** Keep Node inspection and console output secret-safe. */
|
|
218
|
+
[inspect.custom](): string;
|
|
219
|
+
/** Reject accidental JSON transport. */
|
|
220
|
+
toJSON(): never;
|
|
221
|
+
}
|
|
222
|
+
/** Strongly consistent versioned object store with conditional writes. */
|
|
223
|
+
interface ObjectStore {
|
|
224
|
+
/** Read current or exact object version. */
|
|
225
|
+
readObject(key: string, version?: string): Promise<ProjectObject>;
|
|
226
|
+
/** Create only when the key is absent. */
|
|
227
|
+
createObject(key: string, contents: Uint8Array): Promise<ProjectObject>;
|
|
228
|
+
/** Replace only if current ETag equals the expected value. */
|
|
229
|
+
compareAndSwapObject(key: string, expectedETag: string, contents: Uint8Array): Promise<ProjectObject>;
|
|
230
|
+
}
|
|
231
|
+
/** Process-local versioned store for Dex Web preview and deterministic tests. */
|
|
232
|
+
declare class InMemoryObjectStore implements ObjectStore {
|
|
233
|
+
#private;
|
|
234
|
+
/** Read the latest object or an exact immutable version. */
|
|
235
|
+
readObject(key: string, version?: string): Promise<ProjectObject>;
|
|
236
|
+
/** Create only when no object exists under this key. */
|
|
237
|
+
createObject(key: string, contents: Uint8Array): Promise<ProjectObject>;
|
|
238
|
+
/** Compare and swap the latest object by ETag. */
|
|
239
|
+
compareAndSwapObject(key: string, expectedETag: string, contents: Uint8Array): Promise<ProjectObject>;
|
|
240
|
+
}
|
|
241
|
+
/** Fixed S3 storage boundary with exact encryption configuration. */
|
|
242
|
+
interface S3StoreConfig {
|
|
243
|
+
/** Authenticated S3 client owned by the application. */ client: S3Client;
|
|
244
|
+
/** Existing private, versioned bucket. */ bucket: string;
|
|
245
|
+
/** Optional trusted key prefix. */ prefix?: string;
|
|
246
|
+
/** Exact KMS key ARN. */ kmsKeyId?: string;
|
|
247
|
+
/** Isolated local fixture only. */ allowUnencrypted?: boolean;
|
|
248
|
+
}
|
|
249
|
+
/** S3 implementation using If-Match and If-None-Match without write retries. */
|
|
250
|
+
declare class S3ObjectStore implements ObjectStore {
|
|
251
|
+
private readonly configuration;
|
|
252
|
+
private readonly prefix;
|
|
253
|
+
private constructor();
|
|
254
|
+
/** Verify bucket versioning before any application request. */
|
|
255
|
+
static create(configuration: S3StoreConfig): Promise<S3ObjectStore>;
|
|
256
|
+
/** Read bounded private bytes and validate exact version and KMS key. */
|
|
257
|
+
readObject(key: string, version?: string): Promise<ProjectObject>;
|
|
258
|
+
/** Write once with If-None-Match. */
|
|
259
|
+
createObject(key: string, contents: Uint8Array): Promise<ProjectObject>;
|
|
260
|
+
/** Write once with If-Match; ambiguous outcomes stay unknown. */
|
|
261
|
+
compareAndSwapObject(key: string, expectedETag: string, contents: Uint8Array): Promise<ProjectObject>;
|
|
262
|
+
private writeObject;
|
|
263
|
+
}
|
|
264
|
+
/** Configuration CAS and immutable snapshot reader. */
|
|
265
|
+
declare class ConfigurationStore {
|
|
266
|
+
#private;
|
|
267
|
+
private readonly objects;
|
|
268
|
+
private readonly scope;
|
|
269
|
+
/** Bind a private object store to one validated project scope. */
|
|
270
|
+
constructor(objects: ObjectStore, scope: Scope);
|
|
271
|
+
/** Read and validate current ordinary configuration. */
|
|
272
|
+
readConfiguration(): Promise<{
|
|
273
|
+
configuration: Configuration;
|
|
274
|
+
object: ProjectObject;
|
|
275
|
+
}>;
|
|
276
|
+
/** Conditionally replace ordinary settings using an expected revision. */
|
|
277
|
+
writeConfiguration(expectedRevision: number, document: Omit<Configuration, 'schemaVersion' | 'scope' | 'revision'>): Promise<Configuration>;
|
|
278
|
+
/** Read an exact pinned snapshot after checking its digest. */
|
|
279
|
+
readSnapshot(reference: SnapshotRef): Promise<Configuration>;
|
|
280
|
+
/** Pin the current version when its revision is still expected. */
|
|
281
|
+
freezeConfiguration(expectedRevision: number): Promise<SnapshotRef>;
|
|
282
|
+
private decodeConfiguration;
|
|
283
|
+
}
|
|
284
|
+
/** Validate a relative object key before accessing private storage. */
|
|
285
|
+
declare function validateObjectKey(key: string): void;
|
|
286
|
+
/** Return the scoped Go-compatible head key for a named connection. */
|
|
287
|
+
declare function connectionHeadKey(scope: Scope, connectorId: string, connectionName: string): string;
|
|
288
|
+
/** SHA-256 digest in Go projectconfig wire format. */
|
|
289
|
+
declare function digestBytes(contents: Uint8Array): string;
|
|
290
|
+
/** Encode Go-compatible compact JSON before hashing. Known structs use field-order heuristics; raw maps sort UTF-8 keys, unlike Go's preserved RawMessage order. Unpaired surrogates retain JavaScript escaping. */
|
|
291
|
+
declare function encodeGoCompatibleJSON(document: unknown): string;
|
|
292
|
+
|
|
293
|
+
/** Private connection head shared with the Go project store. */
|
|
294
|
+
declare const ConnectionRecordSchema: z.ZodObject<{
|
|
295
|
+
schemaVersion: z.ZodLiteral<"connectors.dex.dev/project-connection/v1alpha2">;
|
|
296
|
+
connection: z.ZodObject<{
|
|
297
|
+
connectorId: z.ZodString;
|
|
298
|
+
connectionName: z.ZodString;
|
|
299
|
+
}, z.core.$strict>;
|
|
300
|
+
scope: z.ZodObject<{
|
|
301
|
+
projectId: z.ZodString;
|
|
302
|
+
kind: z.ZodEnum<{
|
|
303
|
+
live: "live";
|
|
304
|
+
preview: "preview";
|
|
305
|
+
}>;
|
|
306
|
+
}, z.core.$strict>;
|
|
307
|
+
revision: z.ZodNumber;
|
|
308
|
+
fence: z.ZodNumber;
|
|
309
|
+
status: z.ZodEnum<{
|
|
310
|
+
READY: "READY";
|
|
311
|
+
AUTHORIZING: "AUTHORIZING";
|
|
312
|
+
REFRESHING: "REFRESHING";
|
|
313
|
+
REAUTHORIZATION_REQUIRED: "REAUTHORIZATION_REQUIRED";
|
|
314
|
+
REVOKED: "REVOKED";
|
|
315
|
+
}>;
|
|
316
|
+
authMethod: z.ZodString;
|
|
317
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
318
|
+
credential: z.ZodOptional<z.ZodObject<{
|
|
319
|
+
key: z.ZodString;
|
|
320
|
+
version: z.ZodString;
|
|
321
|
+
digest: z.ZodString;
|
|
322
|
+
}, z.core.$strict>>;
|
|
323
|
+
mutation: z.ZodOptional<z.ZodObject<{
|
|
324
|
+
kind: z.ZodString;
|
|
325
|
+
invocationId: z.ZodString;
|
|
326
|
+
id: z.ZodString;
|
|
327
|
+
fence: z.ZodNumber;
|
|
328
|
+
baseRevision: z.ZodNumber;
|
|
329
|
+
deadline: z.ZodISODateTime;
|
|
330
|
+
resultKey: z.ZodString;
|
|
331
|
+
}, z.core.$strict>>;
|
|
332
|
+
}, z.core.$strict>;
|
|
333
|
+
/** Private connection head. */
|
|
334
|
+
type ConnectionRecord = z.infer<typeof ConnectionRecordSchema>;
|
|
335
|
+
/** Immutable private credential material. */
|
|
336
|
+
declare const CredentialEnvelopeSchema: z.ZodObject<{
|
|
337
|
+
schemaVersion: z.ZodLiteral<"connectors.dex.dev/project-connection/v1alpha2">;
|
|
338
|
+
scope: z.ZodObject<{
|
|
339
|
+
projectId: z.ZodString;
|
|
340
|
+
kind: z.ZodEnum<{
|
|
341
|
+
live: "live";
|
|
342
|
+
preview: "preview";
|
|
343
|
+
}>;
|
|
344
|
+
}, z.core.$strict>;
|
|
345
|
+
connection: z.ZodObject<{
|
|
346
|
+
connectorId: z.ZodString;
|
|
347
|
+
connectionName: z.ZodString;
|
|
348
|
+
}, z.core.$strict>;
|
|
349
|
+
fence: z.ZodNumber;
|
|
350
|
+
attemptId: z.ZodOptional<z.ZodString>;
|
|
351
|
+
credentials: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
352
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
353
|
+
authMethod: z.ZodString;
|
|
354
|
+
}, z.core.$strict>;
|
|
355
|
+
|
|
356
|
+
/** Broker temporarily unavailable; another read may succeed. */
|
|
357
|
+
declare class CredentialBrokerUnavailableError extends Error {
|
|
358
|
+
constructor();
|
|
359
|
+
}
|
|
360
|
+
/** Broker rejected the scope or returned an invalid answer. */
|
|
361
|
+
declare class CredentialBrokerRejectedError extends Error {
|
|
362
|
+
constructor();
|
|
363
|
+
}
|
|
364
|
+
/** Loaded scope no longer selects this shared connection. */
|
|
365
|
+
declare class ConnectionNotSelectedError extends Error {
|
|
366
|
+
constructor();
|
|
367
|
+
}
|
|
368
|
+
/** Broker returned the same revision after provider rejection; the call must stop. */
|
|
369
|
+
declare class RejectedCredentialNotRefreshedError extends Error {
|
|
370
|
+
constructor();
|
|
371
|
+
}
|
|
372
|
+
/** Complete provider credential returned only at the private boundary. */
|
|
373
|
+
interface BrokerCredential {
|
|
374
|
+
/** Credential object without host-kept renewal secrets. */ credential: Record<string, unknown>;
|
|
375
|
+
/** Positive broker revision. */ revision: number;
|
|
376
|
+
/** Optional issuance time. */ issuedAt?: string;
|
|
377
|
+
/** Optional expiry time. */ expiresAt?: string | null;
|
|
378
|
+
}
|
|
379
|
+
/** Additive broker wire response, including terminal statuses. */
|
|
380
|
+
declare const BrokerAnswerSchema: z.ZodObject<{
|
|
381
|
+
status: z.ZodEnum<{
|
|
382
|
+
READY: "READY";
|
|
383
|
+
REAUTHORIZATION_REQUIRED: "REAUTHORIZATION_REQUIRED";
|
|
384
|
+
CONNECTION_NOT_SELECTED: "CONNECTION_NOT_SELECTED";
|
|
385
|
+
}>;
|
|
386
|
+
credential: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
387
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
388
|
+
issuedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
389
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
390
|
+
}, z.core.$strip>;
|
|
391
|
+
/** Client for one trusted credential broker endpoint and scope token source. */
|
|
392
|
+
declare class CredentialBrokerClient {
|
|
393
|
+
#private;
|
|
394
|
+
private readonly endpoint;
|
|
395
|
+
private readonly readToken;
|
|
396
|
+
private readonly transport;
|
|
397
|
+
/** Bind a trusted endpoint, token source, and optional transport; tokens renew only after 401. */
|
|
398
|
+
constructor(endpoint: string, readToken: (renew?: boolean) => Promise<string>, transport?: typeof fetch);
|
|
399
|
+
/** Read a shared credential; rejectedRevision is sent only when positive. */
|
|
400
|
+
read(sharedConnectionId: string, rejectedRevision?: number, signal?: AbortSignal): Promise<BrokerCredential>;
|
|
401
|
+
private readWithinDeadline;
|
|
402
|
+
private post;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/** Broker-backed shared selections fixed by the loaded project configuration. */
|
|
406
|
+
declare class SharedConnections {
|
|
407
|
+
#private;
|
|
408
|
+
private readonly broker;
|
|
409
|
+
/** Bind shared entries to the project's trusted credential broker. */
|
|
410
|
+
constructor(configuration: Configuration, broker: Pick<CredentialBrokerClient, 'read'>);
|
|
411
|
+
/** Whether a loaded connection resolves through the broker. */
|
|
412
|
+
has(key: ConnectionKey): boolean;
|
|
413
|
+
/** Read a current shared credential and remember the revision issued to this call. */
|
|
414
|
+
read(key: ConnectionKey, callId: string, signal?: AbortSignal): Promise<BrokerCredential>;
|
|
415
|
+
/** Ask the broker for a revision newer than the one issued to this call. */
|
|
416
|
+
readAfterRejection(key: ConnectionKey, callId: string, signal?: AbortSignal): Promise<BrokerCredential>;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/** Manifest connector ID and application-selected connection name. */
|
|
420
|
+
interface ConnectionKey {
|
|
421
|
+
/** Manifest connector ID. */ connectorId: string;
|
|
422
|
+
/** Static application connection name. */ connectionName: string;
|
|
423
|
+
}
|
|
424
|
+
/** Validate a connection key and return its scoped object prefix. */
|
|
425
|
+
declare function connectionPath(scope: Scope, key: ConnectionKey): string;
|
|
426
|
+
/** Private connector credential material outside Dex Flow state. */
|
|
427
|
+
declare class CredentialMaterial {
|
|
428
|
+
readonly credentials: Record<string, unknown>;
|
|
429
|
+
readonly expiresAt: Date | undefined;
|
|
430
|
+
readonly authMethod: string;
|
|
431
|
+
/** Capture complete private credentials and optional access expiry. */
|
|
432
|
+
constructor(credentials: Record<string, unknown>, expiresAt: Date | undefined, authMethod: string);
|
|
433
|
+
/** Reject accidental durable JSON serialization. */ toJSON(): never;
|
|
434
|
+
/** Redact private material in logs. */ [inspect.custom](): string;
|
|
435
|
+
}
|
|
436
|
+
/** Safe authoritative connection metadata without private credential bytes. */
|
|
437
|
+
interface Connection {
|
|
438
|
+
/** Connection identity. */ key: ConnectionKey;
|
|
439
|
+
/** Project scope. */ scope: Scope;
|
|
440
|
+
/** Head revision. */ revision: number;
|
|
441
|
+
/** Monotonic mutation fence. */ fence: number;
|
|
442
|
+
/** Authorization status. */ status: ConnectionRecord['status'];
|
|
443
|
+
/** Known access expiry. */ expiresAt?: Date;
|
|
444
|
+
/** Manifest authorization method. */ authMethod: string;
|
|
445
|
+
}
|
|
446
|
+
/** Versioned connection heads and immutable credential objects. */
|
|
447
|
+
declare class ConnectionStore {
|
|
448
|
+
#private;
|
|
449
|
+
readonly objects: ObjectStore;
|
|
450
|
+
readonly scope: Scope;
|
|
451
|
+
readonly shared?: SharedConnections | undefined;
|
|
452
|
+
/** Bind one object store and validated project scope. */
|
|
453
|
+
constructor(objects: ObjectStore, scope: Scope, shared?: SharedConnections | undefined);
|
|
454
|
+
/** Read safe connection metadata without credential material. */
|
|
455
|
+
readConnection(key: ConnectionKey): Promise<Connection>;
|
|
456
|
+
/** Read exact current private material from a READY connection. */
|
|
457
|
+
readCredentialMaterial(key: ConnectionKey): Promise<{
|
|
458
|
+
material: CredentialMaterial;
|
|
459
|
+
connection: Connection;
|
|
460
|
+
}>;
|
|
461
|
+
/** Read and validate a current head for refresh admission. */
|
|
462
|
+
readRecord(key: ConnectionKey): Promise<{
|
|
463
|
+
record: ConnectionRecord;
|
|
464
|
+
object: ProjectObject;
|
|
465
|
+
}>;
|
|
466
|
+
/** Read private material by an already validated head. */
|
|
467
|
+
readMaterial(key: ConnectionKey, record: ConnectionRecord): Promise<CredentialMaterial>;
|
|
468
|
+
/** Fence prior work and publish one complete immutable credential version. */
|
|
469
|
+
replaceCredential(key: ConnectionKey, expectedRevision: number, material: CredentialMaterial): Promise<Connection>;
|
|
470
|
+
/** Conditionally publish a new head and reconcile an unknown write outcome. */
|
|
471
|
+
writeHead(key: ConnectionKey, previous: ProjectObject | undefined, record: ConnectionRecord): Promise<ProjectObject>;
|
|
472
|
+
}
|
|
473
|
+
/** Build a Go-compatible private credential envelope. */
|
|
474
|
+
declare function credentialEnvelope(scope: Scope, key: ConnectionKey, fence: number, material: CredentialMaterial, attemptId?: string): Record<string, unknown>;
|
|
475
|
+
/** Build a Go-compatible connection head. */
|
|
476
|
+
declare function connectionRecord(scope: Scope, key: ConnectionKey, revision: number, fence: number, status: ConnectionRecord['status'], expiresAt: Date | undefined, authMethod: string, credential?: ConnectionRecord['credential'], mutation?: ConnectionRecord['mutation']): ConnectionRecord;
|
|
477
|
+
|
|
478
|
+
/** Selects the private local connections.json written by Dex Web. */
|
|
479
|
+
declare const LocalConnectionsFileEnvironment = "DEX_CONNECTOR_CONFIG_FILE";
|
|
480
|
+
/** Loaded ordinary configuration and private connection resolver. */
|
|
481
|
+
declare class LoadedProject {
|
|
482
|
+
#private;
|
|
483
|
+
/** Startup-pinned ordinary document. */ readonly configuration: Configuration;
|
|
484
|
+
/** Exact immutable document reference. */ readonly snapshot: SnapshotRef | undefined;
|
|
485
|
+
private readonly broker;
|
|
486
|
+
/** Versioned private connection store for generated provider adapters. */
|
|
487
|
+
readonly connections: ConnectionStore;
|
|
488
|
+
/** Bind startup-pinned configuration to exactly one private credential source. */
|
|
489
|
+
constructor(
|
|
490
|
+
/** Startup-pinned ordinary document. */ configuration: Configuration,
|
|
491
|
+
/** Exact immutable document reference. */ snapshot: SnapshotRef | undefined, objects: ObjectStore | undefined, _localFilePath: string | undefined, broker: CredentialBrokerClient | undefined);
|
|
492
|
+
/** Read a current private credential, never returning it through a Flow result. */
|
|
493
|
+
resolveCredential(connectorId: string, connectionName: string, signal?: AbortSignal): Promise<Record<string, unknown>>;
|
|
494
|
+
/** Resolve a newer shared credential after the provider rejected one revision. */
|
|
495
|
+
resolveCredentialAfterRejection(connectorId: string, connectionName: string, rejectedRevision: number, signal?: AbortSignal): Promise<Record<string, unknown>>;
|
|
496
|
+
}
|
|
497
|
+
/** Load trusted DEX_PROJECT_* settings or a local Dex Web file at startup. */
|
|
498
|
+
declare function loadFromEnvironment(environment?: NodeJS.ProcessEnv): Promise<LoadedProject>;
|
|
499
|
+
/** Read a mode-0600 regular file without exposing private values in errors. */
|
|
500
|
+
declare function readLocalConnectionsFile(path: string): Promise<{
|
|
501
|
+
connections: LocalConnection[];
|
|
502
|
+
triggerBindings?: Configuration['triggerBindings'];
|
|
503
|
+
}>;
|
|
504
|
+
|
|
505
|
+
/** Connector-owned validation of complete private credential JSON. */
|
|
506
|
+
type CredentialDecoder<C> = (document: Record<string, unknown>) => C;
|
|
507
|
+
/** Connector-owned encoding of complete replacement material. */
|
|
508
|
+
type CredentialEncoder<C> = (credentials: C) => Record<string, unknown>;
|
|
509
|
+
/** Decode broker material that omits secrets retained by the shared connection host. */
|
|
510
|
+
type SharedCredentialDecoder<C> = (document: Record<string, unknown>) => C;
|
|
511
|
+
/** Another invocation owns provider dispatch for this credential generation. */
|
|
512
|
+
declare class ExchangePendingError extends Error {
|
|
513
|
+
constructor();
|
|
514
|
+
}
|
|
515
|
+
/** Refresh failed without proving the prior authorization invalid. */
|
|
516
|
+
declare class RefreshFailedError extends Error {
|
|
517
|
+
constructor(message?: string);
|
|
518
|
+
}
|
|
519
|
+
/** Read a non-refreshing project credential on every connector invocation. */
|
|
520
|
+
declare class CredentialProvider<C> implements CredentialProvider$1<C> {
|
|
521
|
+
protected readonly store: ConnectionStore;
|
|
522
|
+
protected readonly key: ConnectionKey;
|
|
523
|
+
protected readonly decode: CredentialDecoder<C>;
|
|
524
|
+
protected readonly decodeShared?: SharedCredentialDecoder<C> | undefined;
|
|
525
|
+
/** Bind one validated project connection and a credential decoder. */
|
|
526
|
+
constructor(store: ConnectionStore, key: ConnectionKey, decode: CredentialDecoder<C>, decodeShared?: SharedCredentialDecoder<C> | undefined);
|
|
527
|
+
/** Read current private material without refreshing known-expired credentials. */
|
|
528
|
+
resolve(call: Call, signal?: AbortSignal): Promise<C>;
|
|
529
|
+
/** Read current material under an explicit cancellation signal. */
|
|
530
|
+
resolveContext(call: Call, signal: AbortSignal): Promise<C>;
|
|
531
|
+
/** Reject a call aimed at another configured connection. */
|
|
532
|
+
protected validateCall(call: Call): void;
|
|
533
|
+
/** Decode private material without leaking invalid values in errors. */
|
|
534
|
+
protected decodeMaterial(material: CredentialMaterial): C;
|
|
535
|
+
/** Decode a broker response with the connector's shared credential rules. */
|
|
536
|
+
protected decodeSharedMaterial(document: Record<string, unknown>): C;
|
|
537
|
+
}
|
|
538
|
+
/** Refresh and persist project credentials once per generation across replicas. */
|
|
539
|
+
declare class RefreshingCredentialProvider<C> extends CredentialProvider<C> implements RefreshingCredentialProvider$1<C>, RejectedCredentialRefreshingProvider<C> {
|
|
540
|
+
#private;
|
|
541
|
+
/** Bind a complete replacement encoder in addition to the decoder. */
|
|
542
|
+
constructor(store: ConnectionStore, key: ConnectionKey, decode: CredentialDecoder<C>, encode: CredentialEncoder<C>, decodeShared?: SharedCredentialDecoder<C>);
|
|
543
|
+
/** Admit a durable refresh before one provider request; observers recover its result. */
|
|
544
|
+
resolveWithRefresh(call: Call, driver: CredentialRefreshDriver<C>, signal?: AbortSignal): Promise<C>;
|
|
545
|
+
/** Force refresh only when stored expiry proves the rejected token expired. */
|
|
546
|
+
resolveAfterRejection(call: Call, driver: CredentialRefreshDriver<C>, signal?: AbortSignal): Promise<C>;
|
|
547
|
+
}
|
|
548
|
+
/** Bind an API-key or other non-refreshing credential to one project connection. */
|
|
549
|
+
declare function newCredentialProvider<C>(store: ConnectionStore, key: ConnectionKey, decode: CredentialDecoder<C>, decodeShared?: SharedCredentialDecoder<C>): CredentialProvider<C>;
|
|
550
|
+
/** Bind a renewable credential and complete replacement encoder to one connection. */
|
|
551
|
+
declare function newRefreshingCredentialProvider<C>(store: ConnectionStore, key: ConnectionKey, decode: CredentialDecoder<C>, encode: CredentialEncoder<C>, decodeShared?: SharedCredentialDecoder<C>): RefreshingCredentialProvider<C>;
|
|
552
|
+
|
|
553
|
+
/** Process-local Dex Web credential projection with guarded owner-only writeback. */
|
|
554
|
+
declare class DexWebObjectStore implements ObjectStore {
|
|
555
|
+
#private;
|
|
556
|
+
private readonly path;
|
|
557
|
+
/** Bind a mode-0600 connections.json file and local project scope. */
|
|
558
|
+
constructor(path: string, scope: Scope);
|
|
559
|
+
/** Import current Dex Web credentials before application registration. */
|
|
560
|
+
initialize(): Promise<void>;
|
|
561
|
+
/** Adopt Dex Web updates before reading a connection head. */
|
|
562
|
+
readObject(key: string, version?: string): Promise<ProjectObject>;
|
|
563
|
+
/** Create an immutable private object in process memory. */
|
|
564
|
+
createObject(key: string, contents: Uint8Array): Promise<ProjectObject>;
|
|
565
|
+
/** CAS a head, then write back a refreshed credential if the file is still current. */
|
|
566
|
+
compareAndSwapObject(key: string, expectedETag: string, contents: Uint8Array): Promise<ProjectObject>;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export { type ApplicationSecretRef, ApplicationSecretRefSchema, BrokerAnswerSchema, type BrokerCredential, type Configuration, ConfigurationSchema, ConfigurationSchemaVersion, ConfigurationStore, ConflictError, type Connection, type ConnectionConfiguration, ConnectionConfigurationSchema, type ConnectionKey, ConnectionNotSelectedError, ConnectionRecordSchema, ConnectionStore, CredentialBrokerClient, type CredentialBrokerConfiguration, CredentialBrokerConfigurationSchema, CredentialBrokerRejectedError, CredentialBrokerUnavailableError, type CredentialDecoder, type CredentialEncoder, CredentialEnvelopeSchema, CredentialMaterial, CredentialProvider, DexWebObjectStore, type EnvironmentValue, EnvironmentValueSchema, ExchangePendingError, InMemoryObjectStore, LoadedProject, type LocalConnection, LocalConnectionSchema, type LocalConnectionsFile, LocalConnectionsFileEnvironment, LocalConnectionsFileSchema, LocalConnectionsSchemaVersion, ObjectNotFoundError, type ObjectStore, type OperationConfiguration, OperationConfigurationSchema, OutcomeUnknownError, ProjectObject, RFC3339NanoSchema, RefreshFailedError, RefreshingCredentialProvider, RejectedCredentialNotRefreshedError, S3ObjectStore, type S3StoreConfig, type Scope, ScopeSchema, SharedConnections, type SharedCredentialDecoder, type SnapshotRef, SnapshotRefSchema, type TriggerConfiguration, TriggerConfigurationSchema, connectionHeadKey, connectionPath, connectionRecord, credentialEnvelope, digestBytes, encodeGoCompatibleJSON, loadFromEnvironment, newCredentialProvider, newRefreshingCredentialProvider, readLocalConnectionsFile, scopePrefix, validateObjectKey };
|