@sdlcworks/components 0.0.26 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +69 -27
- package/dist/index.js +164 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
import { Input as PulumiInput, Output as PulumiOutput } from '@pulumi/pulumi';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
+
declare const BranchMetadataCloudCredentialGCPSchema = z.object({
|
|
7
|
+
GCP_PROJECT_ID: z.string().describe("Required GCP Project ID"),
|
|
8
|
+
GCP_SERVICE_ACCOUNT_KEY: z.string()
|
|
9
|
+
.describe("Required GCP Service Account Key"),
|
|
10
|
+
});
|
|
11
|
+
export type BranchMetadataCloudCredentialGCP = z.infer<typeof BranchMetadataCloudCredentialGCPSchema>;
|
|
12
|
+
declare const BranchMetadataCloudCredentialAWSSchema = z.object({
|
|
13
|
+
AWS_ACCESS_KEY_ID: z.string().describe("Required AWS Access Key ID"),
|
|
14
|
+
AWS_SECRET_ACCESS_KEY: z.string().describe("Required AWS Secret Access Key"),
|
|
15
|
+
AWS_REGION: z.string().describe("Required AWS Region"),
|
|
16
|
+
});
|
|
17
|
+
export type BranchMetadataCloudCredentialAWS = z.infer<typeof BranchMetadataCloudCredentialAWSSchema>;
|
|
18
|
+
declare const BranchMetadataCloudCredentialCloudflareSchema = z.object({
|
|
19
|
+
CLOUDFLARE_API_TOKEN: z.string().describe("Required Cloudflare API Token"),
|
|
20
|
+
CLOUDFLARE_ACCOUNT_ID: z.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Optional Cloudflare Account ID (required for account-scoped resources like Workers, R2, Pages)"),
|
|
23
|
+
});
|
|
24
|
+
export type BranchMetadataCloudCredentialCloudflare = z.infer<typeof BranchMetadataCloudCredentialCloudflareSchema>;
|
|
6
25
|
export declare enum CloudProvider {
|
|
7
26
|
aws = "aws",
|
|
8
27
|
gcloud = "gcloud",
|
|
@@ -11,6 +30,23 @@ export declare enum CloudProvider {
|
|
|
11
30
|
hetzner = "hetzner",
|
|
12
31
|
cloudflare = "cloudflare"
|
|
13
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Maps each CloudProvider to its corresponding credential type.
|
|
35
|
+
* Used to provide fully-typed credentials in handler contexts.
|
|
36
|
+
*/
|
|
37
|
+
export type ProviderCredentialsMap = {
|
|
38
|
+
[CloudProvider.gcloud]: BranchMetadataCloudCredentialGCP;
|
|
39
|
+
[CloudProvider.aws]: BranchMetadataCloudCredentialAWS;
|
|
40
|
+
[CloudProvider.cloudflare]: BranchMetadataCloudCredentialCloudflare;
|
|
41
|
+
[CloudProvider.azure]: Record<string, unknown>;
|
|
42
|
+
[CloudProvider.linode]: Record<string, unknown>;
|
|
43
|
+
[CloudProvider.hetzner]: Record<string, unknown>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Function type for getCredentials.
|
|
47
|
+
* Returns the typed credentials for the specified provider.
|
|
48
|
+
*/
|
|
49
|
+
export type GetCredentialsFn<P extends CloudProvider> = () => ProviderCredentialsMap[P];
|
|
14
50
|
export declare enum TCPUrlType {
|
|
15
51
|
ipv4 = "ipv4",
|
|
16
52
|
ipv6 = "ipv6",
|
|
@@ -161,7 +197,7 @@ export type DeploymentInfo = {
|
|
|
161
197
|
type: DeploymentArtifactType;
|
|
162
198
|
};
|
|
163
199
|
};
|
|
164
|
-
export type ProviderPulumiCtx<I, S> = {
|
|
200
|
+
export type ProviderPulumiCtx<I, S, P extends CloudProvider = CloudProvider> = {
|
|
165
201
|
componentName: string;
|
|
166
202
|
$: {
|
|
167
203
|
(name: string, ...values: any[]): string;
|
|
@@ -171,16 +207,18 @@ export type ProviderPulumiCtx<I, S> = {
|
|
|
171
207
|
state: S;
|
|
172
208
|
declareConnectionInterfaces: DeclareConnectionInterfacesFn;
|
|
173
209
|
buildArtifacts: Record<string, ArtifactInfo>;
|
|
210
|
+
getCredentials: GetCredentialsFn<P>;
|
|
174
211
|
};
|
|
175
212
|
/**
|
|
176
213
|
* Context passed to connection handlers.
|
|
177
214
|
* Contains the provider state, typed data from the connecting component,
|
|
178
|
-
*
|
|
215
|
+
* the connection type chosen by the orchestrator, and getCredentials function.
|
|
179
216
|
*/
|
|
180
|
-
export type ConnectionHandlerCtx<S, ConnectorData, ConnectionType extends string = string> = {
|
|
217
|
+
export type ConnectionHandlerCtx<S, ConnectorData, ConnectionType extends string = string, P extends CloudProvider = CloudProvider> = {
|
|
181
218
|
state: S;
|
|
182
219
|
connectionData: ConnectorData;
|
|
183
220
|
connectionType: ConnectionType;
|
|
221
|
+
getCredentials: GetCredentialsFn<P>;
|
|
184
222
|
};
|
|
185
223
|
/**
|
|
186
224
|
* Result returned by connection handlers.
|
|
@@ -190,9 +228,9 @@ export type ConnectionHandlerResult = Record<string, PulumiOutput<string>>;
|
|
|
190
228
|
/**
|
|
191
229
|
* A connection handler entry mapping a ConnectionInterfaceDef to its handler function.
|
|
192
230
|
*/
|
|
193
|
-
export type ConnectionHandlerEntry<S, ConnectionType extends string, D extends ConnectionInterfaceDef> = {
|
|
231
|
+
export type ConnectionHandlerEntry<S, ConnectionType extends string, D extends ConnectionInterfaceDef, P extends CloudProvider = CloudProvider> = {
|
|
194
232
|
interface: D;
|
|
195
|
-
handler: (ctx: ConnectionHandlerCtx<S, InferConnectionData<D>, ConnectionType>) => Promise<ConnectionHandlerResult>;
|
|
233
|
+
handler: (ctx: ConnectionHandlerCtx<S, InferConnectionData<D>, ConnectionType, P>) => Promise<ConnectionHandlerResult>;
|
|
196
234
|
};
|
|
197
235
|
/**
|
|
198
236
|
* Type definition for a connection handler entry.
|
|
@@ -203,10 +241,11 @@ export type ConnectionHandlerDef<D extends ConnectionInterfaceDef> = {
|
|
|
203
241
|
handler: (ctx: ConnectionHandlerCtx<any, InferConnectionData<D>, any>) => Promise<ConnectionHandlerResult>;
|
|
204
242
|
};
|
|
205
243
|
export declare function connectionHandler<D extends ConnectionInterfaceDef>(entry: ConnectionHandlerDef<D>): ConnectionHandlerDef<D>;
|
|
206
|
-
export type ProviderDeployCtx<D, S> = {
|
|
244
|
+
export type ProviderDeployCtx<D, S, P extends CloudProvider = CloudProvider> = {
|
|
207
245
|
state: S;
|
|
246
|
+
getCredentials: GetCredentialsFn<P>;
|
|
208
247
|
} & Record<string, DeploymentInfo>;
|
|
209
|
-
export type ProviderAllocateCtx<S> = {
|
|
248
|
+
export type ProviderAllocateCtx<S, P extends CloudProvider = CloudProvider> = {
|
|
210
249
|
name: string;
|
|
211
250
|
deploymentConfig: Record<string, any>;
|
|
212
251
|
state: S;
|
|
@@ -214,8 +253,9 @@ export type ProviderAllocateCtx<S> = {
|
|
|
214
253
|
(name: string, ...values: any[]): string;
|
|
215
254
|
(strings: TemplateStringsArray, ...values: any[]): string;
|
|
216
255
|
};
|
|
256
|
+
getCredentials: GetCredentialsFn<P>;
|
|
217
257
|
};
|
|
218
|
-
export type ProviderDeallocateCtx<S> = {
|
|
258
|
+
export type ProviderDeallocateCtx<S, P extends CloudProvider = CloudProvider> = {
|
|
219
259
|
name: string;
|
|
220
260
|
deploymentConfig: Record<string, any>;
|
|
221
261
|
state: S;
|
|
@@ -223,16 +263,18 @@ export type ProviderDeallocateCtx<S> = {
|
|
|
223
263
|
(name: string, ...values: any[]): string;
|
|
224
264
|
(strings: TemplateStringsArray, ...values: any[]): string;
|
|
225
265
|
};
|
|
266
|
+
getCredentials: GetCredentialsFn<P>;
|
|
226
267
|
};
|
|
227
|
-
export type ProviderUpsertArtifactsCtx<S> = {
|
|
268
|
+
export type ProviderUpsertArtifactsCtx<S, P extends CloudProvider = CloudProvider> = {
|
|
228
269
|
buildArtifacts: Record<string, ArtifactInfo>;
|
|
229
270
|
state: S;
|
|
271
|
+
getCredentials: GetCredentialsFn<P>;
|
|
230
272
|
};
|
|
231
|
-
export type ProviderPulumiFn<I, S, O> = (ctx: ProviderPulumiCtx<I, S>) => Promise<O>;
|
|
232
|
-
export type ProviderDeployFn<D, S> = (ctx: ProviderDeployCtx<D, S>) => Promise<void>;
|
|
233
|
-
export type ProviderAllocateFn<S> = (ctx: ProviderAllocateCtx<S>) => Promise<void>;
|
|
234
|
-
export type ProviderDeallocateFn<S> = (ctx: ProviderDeallocateCtx<S>) => Promise<void>;
|
|
235
|
-
export type ProviderUpsertArtifactsFn<S> = (ctx: ProviderUpsertArtifactsCtx<S>) => Promise<void>;
|
|
273
|
+
export type ProviderPulumiFn<I, S, O, P extends CloudProvider = CloudProvider> = (ctx: ProviderPulumiCtx<I, S, P>) => Promise<O>;
|
|
274
|
+
export type ProviderDeployFn<D, S, P extends CloudProvider = CloudProvider> = (ctx: ProviderDeployCtx<D, S, P>) => Promise<void>;
|
|
275
|
+
export type ProviderAllocateFn<S, P extends CloudProvider = CloudProvider> = (ctx: ProviderAllocateCtx<S, P>) => Promise<void>;
|
|
276
|
+
export type ProviderDeallocateFn<S, P extends CloudProvider = CloudProvider> = (ctx: ProviderDeallocateCtx<S, P>) => Promise<void>;
|
|
277
|
+
export type ProviderUpsertArtifactsFn<S, P extends CloudProvider = CloudProvider> = (ctx: ProviderUpsertArtifactsCtx<S, P>) => Promise<void>;
|
|
236
278
|
declare const emptyStateSchema: z.ZodObject<{}, z.core.$strip>;
|
|
237
279
|
export type EmptyStateShape = typeof emptyStateSchema.shape;
|
|
238
280
|
export type InferredState<SShape extends z.ZodRawShape> = z.infer<z.ZodObject<SShape>>;
|
|
@@ -247,15 +289,15 @@ export type InferredState<SShape extends z.ZodRawShape> = z.infer<z.ZodObject<SS
|
|
|
247
289
|
export type RuntimeState<SShape extends z.ZodRawShape> = {
|
|
248
290
|
[K in keyof InferredState<SShape>]: InferredState<SShape>[K] | PulumiOutput<InferredState<SShape>[K]>;
|
|
249
291
|
};
|
|
250
|
-
export type ProviderFnsDef<I, D, O, SShape extends z.ZodRawShape = EmptyStateShape, ConnectionType extends string = string, S = RuntimeState<SShape>> = {
|
|
292
|
+
export type ProviderFnsDef<I, D, O, SShape extends z.ZodRawShape = EmptyStateShape, ConnectionType extends string = string, P extends CloudProvider = CloudProvider, S = RuntimeState<SShape>> = {
|
|
251
293
|
stateSchema?: z.ZodObject<SShape>;
|
|
252
294
|
initialState?: Partial<S>;
|
|
253
|
-
pulumi: ProviderPulumiFn<I, S, O>;
|
|
295
|
+
pulumi: ProviderPulumiFn<I, S, O, P>;
|
|
254
296
|
connect?: readonly ConnectionHandlerEntry<S, ConnectionType, any>[];
|
|
255
|
-
deploy?: ProviderDeployFn<D, S>;
|
|
256
|
-
allocateComponent?: ProviderAllocateFn<S>;
|
|
257
|
-
deallocateComponent?: ProviderDeallocateFn<S>;
|
|
258
|
-
upsertArtifacts?: ProviderUpsertArtifactsFn<S>;
|
|
297
|
+
deploy?: ProviderDeployFn<D, S, P>;
|
|
298
|
+
allocateComponent?: ProviderAllocateFn<S, P>;
|
|
299
|
+
deallocateComponent?: ProviderDeallocateFn<S, P>;
|
|
300
|
+
upsertArtifacts?: ProviderUpsertArtifactsFn<S, P>;
|
|
259
301
|
};
|
|
260
302
|
/**
|
|
261
303
|
* Stored version of ConnectionHandlerEntry that preserves ConnectionInterfaceDef type.
|
|
@@ -264,17 +306,17 @@ export type ProviderFnsDef<I, D, O, SShape extends z.ZodRawShape = EmptyStateSha
|
|
|
264
306
|
*/
|
|
265
307
|
export type StoredConnectionHandlerEntry = {
|
|
266
308
|
interface: ConnectionInterfaceDef;
|
|
267
|
-
handler: (ctx: ConnectionHandlerCtx<any, any, any>) => Promise<ConnectionHandlerResult>;
|
|
309
|
+
handler: (ctx: ConnectionHandlerCtx<any, any, any, any>) => Promise<ConnectionHandlerResult>;
|
|
268
310
|
};
|
|
269
311
|
export type StoredProviderFns = {
|
|
270
312
|
stateSchema: z.ZodObject<any>;
|
|
271
313
|
initialState?: any;
|
|
272
|
-
pulumi: ProviderPulumiFn<any, any, any>;
|
|
314
|
+
pulumi: ProviderPulumiFn<any, any, any, any>;
|
|
273
315
|
connect?: readonly StoredConnectionHandlerEntry[];
|
|
274
|
-
deploy?: ProviderDeployFn<any, any>;
|
|
275
|
-
allocateComponent?: ProviderAllocateFn<any>;
|
|
276
|
-
deallocateComponent?: ProviderDeallocateFn<any>;
|
|
277
|
-
upsertArtifacts?: ProviderUpsertArtifactsFn<any>;
|
|
316
|
+
deploy?: ProviderDeployFn<any, any, any>;
|
|
317
|
+
allocateComponent?: ProviderAllocateFn<any, any>;
|
|
318
|
+
deallocateComponent?: ProviderDeallocateFn<any, any>;
|
|
319
|
+
upsertArtifacts?: ProviderUpsertArtifactsFn<any, any>;
|
|
278
320
|
};
|
|
279
321
|
export type ProviderRegistry = Partial<Record<CloudProvider, StoredProviderFns>>;
|
|
280
322
|
/**
|
|
@@ -297,7 +339,7 @@ export declare class InfraComponent<CShape extends z.ZodRawShape, DShape extends
|
|
|
297
339
|
validationDeploymentInputSchema: z.ZodTypeAny;
|
|
298
340
|
private declaredConnectionInterfaces;
|
|
299
341
|
constructor(opts: InfraComponentOpts<CShape, DShape, OShape, ConnTypes>);
|
|
300
|
-
implement<SShape extends z.ZodRawShape = EmptyStateShape>(provider:
|
|
342
|
+
implement<P extends CloudProvider, SShape extends z.ZodRawShape = EmptyStateShape>(provider: P, fns: ProviderFnsDef<InferZodType<CShape>, InferZodType<DShape>, InferOutputType<OShape>, SShape, keyof ConnTypes & string, P>): this;
|
|
301
343
|
/**
|
|
302
344
|
* Get the schema for a specific connection interface.
|
|
303
345
|
* Used by the orchestrator at runtime.
|
package/dist/index.js
CHANGED
|
@@ -1 +1,164 @@
|
|
|
1
|
-
|
|
1
|
+
// src/infra.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
4
|
+
var CloudProvider;
|
|
5
|
+
((CloudProvider2) => {
|
|
6
|
+
CloudProvider2["aws"] = "aws";
|
|
7
|
+
CloudProvider2["gcloud"] = "gcloud";
|
|
8
|
+
CloudProvider2["azure"] = "azure";
|
|
9
|
+
CloudProvider2["linode"] = "linode";
|
|
10
|
+
CloudProvider2["hetzner"] = "hetzner";
|
|
11
|
+
CloudProvider2["cloudflare"] = "cloudflare";
|
|
12
|
+
})(CloudProvider ||= {});
|
|
13
|
+
var TCPUrlType;
|
|
14
|
+
((TCPUrlType2) => {
|
|
15
|
+
TCPUrlType2["ipv4"] = "ipv4";
|
|
16
|
+
TCPUrlType2["ipv6"] = "ipv6";
|
|
17
|
+
TCPUrlType2["domain"] = "domain";
|
|
18
|
+
})(TCPUrlType ||= {});
|
|
19
|
+
var DeploymentArtifactType;
|
|
20
|
+
((DeploymentArtifactType2) => {
|
|
21
|
+
DeploymentArtifactType2["container_image"] = "container_image";
|
|
22
|
+
})(DeploymentArtifactType ||= {});
|
|
23
|
+
var connectionInterfaceRegistry = new Map;
|
|
24
|
+
function toCanonicalInterfaceName(name) {
|
|
25
|
+
return name.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]+/g, "-").toLowerCase().replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
26
|
+
}
|
|
27
|
+
function registerInterfaceName(name) {
|
|
28
|
+
const canonical = toCanonicalInterfaceName(name);
|
|
29
|
+
if (canonical.length === 0) {
|
|
30
|
+
throw new Error(`Connection interface name cannot be empty`);
|
|
31
|
+
}
|
|
32
|
+
const existing = connectionInterfaceRegistry.get(canonical);
|
|
33
|
+
if (existing !== undefined && existing !== name) {
|
|
34
|
+
throw new Error(`Connection interface name collision: '${name}' resolves to '${canonical}' which is already registered by '${existing}'`);
|
|
35
|
+
}
|
|
36
|
+
connectionInterfaceRegistry.set(canonical, name);
|
|
37
|
+
return canonical;
|
|
38
|
+
}
|
|
39
|
+
function defineConnectionInterface(name, schema) {
|
|
40
|
+
const canonicalName = registerInterfaceName(name);
|
|
41
|
+
return {
|
|
42
|
+
name: canonicalName,
|
|
43
|
+
schema
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function extendSchema(parentDef, additionalSchema) {
|
|
47
|
+
return parentDef.schema.merge(additionalSchema);
|
|
48
|
+
}
|
|
49
|
+
var TCPCI = defineConnectionInterface("tcp", z.object({
|
|
50
|
+
url: z.object({
|
|
51
|
+
type: z.nativeEnum(TCPUrlType),
|
|
52
|
+
value: z.string()
|
|
53
|
+
}),
|
|
54
|
+
publicAccess: z.boolean()
|
|
55
|
+
}));
|
|
56
|
+
var emptyOutputSchema = z.object({});
|
|
57
|
+
function transformSchemaToAcceptOutputs(schema) {
|
|
58
|
+
if (schema instanceof z.ZodObject) {
|
|
59
|
+
const shape = schema.shape;
|
|
60
|
+
const newShape = {};
|
|
61
|
+
for (const key in shape) {
|
|
62
|
+
newShape[key] = transformSchemaToAcceptOutputs(shape[key]);
|
|
63
|
+
}
|
|
64
|
+
return z.object(newShape);
|
|
65
|
+
}
|
|
66
|
+
if (schema instanceof z.ZodOptional) {
|
|
67
|
+
return transformSchemaToAcceptOutputs(schema.unwrap()).optional();
|
|
68
|
+
}
|
|
69
|
+
if (schema instanceof z.ZodNullable) {
|
|
70
|
+
return transformSchemaToAcceptOutputs(schema.unwrap()).nullable();
|
|
71
|
+
}
|
|
72
|
+
if (schema instanceof z.ZodDefault) {
|
|
73
|
+
return transformSchemaToAcceptOutputs(schema._def.innerType).default(schema._def.defaultValue);
|
|
74
|
+
}
|
|
75
|
+
if (schema instanceof z.ZodArray) {
|
|
76
|
+
return z.array(transformSchemaToAcceptOutputs(schema.element));
|
|
77
|
+
}
|
|
78
|
+
if (schema instanceof z.ZodDiscriminatedUnion) {
|
|
79
|
+
const transformedOptions = schema._def.options.map((option) => transformSchemaToAcceptOutputs(option));
|
|
80
|
+
return z.discriminatedUnion(schema._def.discriminator, transformedOptions);
|
|
81
|
+
}
|
|
82
|
+
if (schema instanceof z.ZodRecord) {
|
|
83
|
+
const keyType = schema._def.keyType;
|
|
84
|
+
const valueType = schema._def.valueType;
|
|
85
|
+
const transformedKey = keyType ? transformSchemaToAcceptOutputs(keyType) : z.string();
|
|
86
|
+
const transformedValue = valueType ? transformSchemaToAcceptOutputs(valueType) : z.any();
|
|
87
|
+
return z.record(transformedKey, transformedValue);
|
|
88
|
+
}
|
|
89
|
+
return z.union([
|
|
90
|
+
schema,
|
|
91
|
+
z.custom((val) => pulumi.Output.isInstance(val))
|
|
92
|
+
]);
|
|
93
|
+
}
|
|
94
|
+
var InfraComponentOptsSchema = z.object({
|
|
95
|
+
metadata: z.object({
|
|
96
|
+
stateful: z.boolean(),
|
|
97
|
+
proxiable: z.boolean()
|
|
98
|
+
}),
|
|
99
|
+
connectionTypes: z.record(z.string(), z.object({
|
|
100
|
+
description: z.string().min(5)
|
|
101
|
+
})),
|
|
102
|
+
configSchema: z.custom(),
|
|
103
|
+
deploymentInputSchema: z.custom(),
|
|
104
|
+
outputSchema: z.custom()
|
|
105
|
+
});
|
|
106
|
+
function connectionHandler(entry) {
|
|
107
|
+
return entry;
|
|
108
|
+
}
|
|
109
|
+
var emptyStateSchema = z.object({});
|
|
110
|
+
|
|
111
|
+
class InfraComponent {
|
|
112
|
+
opts;
|
|
113
|
+
providers;
|
|
114
|
+
validationSchema;
|
|
115
|
+
validationDeploymentInputSchema;
|
|
116
|
+
declaredConnectionInterfaces = new Map;
|
|
117
|
+
constructor(opts) {
|
|
118
|
+
this.opts = InfraComponentOptsSchema.parse(opts);
|
|
119
|
+
this.providers = {};
|
|
120
|
+
this.validationSchema = transformSchemaToAcceptOutputs(opts.configSchema);
|
|
121
|
+
this.validationDeploymentInputSchema = transformSchemaToAcceptOutputs(opts.deploymentInputSchema);
|
|
122
|
+
}
|
|
123
|
+
implement(provider, fns) {
|
|
124
|
+
this.providers[provider] = {
|
|
125
|
+
...fns,
|
|
126
|
+
stateSchema: fns.stateSchema ?? emptyStateSchema,
|
|
127
|
+
initialState: fns.initialState
|
|
128
|
+
};
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
getConnectionSchema(interfaceDef) {
|
|
132
|
+
return interfaceDef.schema;
|
|
133
|
+
}
|
|
134
|
+
createDeclareConnectionInterfacesFn() {
|
|
135
|
+
return (entries) => {
|
|
136
|
+
for (const entry of entries) {
|
|
137
|
+
const schema = entry.interface.schema;
|
|
138
|
+
const transformedSchema = transformSchemaToAcceptOutputs(schema);
|
|
139
|
+
const parseResult = transformedSchema.safeParse(entry.data);
|
|
140
|
+
if (!parseResult.success) {
|
|
141
|
+
throw new Error(`Invalid data for connection interface '${entry.interface.name}': ${parseResult.error.message}`);
|
|
142
|
+
}
|
|
143
|
+
this.declaredConnectionInterfaces.set(entry.interface.name, {
|
|
144
|
+
schema: transformedSchema,
|
|
145
|
+
data: entry.data
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
getDeclaredInterfaces() {
|
|
151
|
+
return this.declaredConnectionInterfaces;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
toCanonicalInterfaceName,
|
|
156
|
+
extendSchema,
|
|
157
|
+
defineConnectionInterface,
|
|
158
|
+
connectionHandler,
|
|
159
|
+
TCPUrlType,
|
|
160
|
+
TCPCI,
|
|
161
|
+
InfraComponent,
|
|
162
|
+
DeploymentArtifactType,
|
|
163
|
+
CloudProvider
|
|
164
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdlcworks/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"module": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"typescript": "^5.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@sdlc/types": "workspace:*",
|
|
34
35
|
"zod": "4.1.13"
|
|
35
36
|
}
|
|
36
37
|
}
|