@sdlcworks/components 0.0.23 → 0.0.24
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 +2 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -269,9 +269,10 @@ export type ProviderRegistry = Partial<Record<CloudProvider, StoredProviderFns>>
|
|
|
269
269
|
/**
|
|
270
270
|
* Map of interface name to its schema and declared data.
|
|
271
271
|
* Keyed by canonical interface name for cross-bundle matching.
|
|
272
|
+
* Schema is transformed to accept Pulumi Output types.
|
|
272
273
|
*/
|
|
273
274
|
export type DeclaredConnectionInterfaces = Map<string, {
|
|
274
|
-
schema: z.
|
|
275
|
+
schema: z.ZodTypeAny;
|
|
275
276
|
data: any;
|
|
276
277
|
}>;
|
|
277
278
|
export declare class InfraComponent<CShape extends z.ZodRawShape, DShape extends z.ZodRawShape, OShape extends z.ZodRawShape = EmptyOutputShape, ConnTypes extends Record<string, {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as q}from"zod";import*as L from"@pulumi/pulumi";var Q;((H)=>{H.aws="aws";H.gcloud="gcloud";H.azure="azure";H.linode="linode";H.hetzner="hetzner";H.cloudflare="cloudflare"})(Q||={});var M;((E)=>{E.ipv4="ipv4";E.ipv6="ipv6";E.domain="domain"})(M||={});var V;((j)=>j.container_image="container_image")(V||={});var K=new Map;function W(b){return b.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase().replace(/-+/g,"-").replace(/^-|-$/g,"")}function X(b){let j=W(b);if(j.length===0)throw new Error("Connection interface name cannot be empty");let B=K.get(j);if(B!==void 0&&B!==b)throw new Error(`Connection interface name collision: '${b}' resolves to '${j}' which is already registered by '${B}'`);return K.set(j,b),j}function Y(b,j){return{name:X(b),schema:j}}function k(b,j){return b.schema.merge(j)}var x=Y("tcp",q.object({url:q.object({type:q.nativeEnum(M),value:q.string()}),publicAccess:q.boolean()})),N=q.object({});function F(b){if(b instanceof q.ZodObject){let j=b.shape,B={};for(let E in j)B[E]=F(j[E]);return q.object(B)}if(b instanceof q.ZodOptional)return F(b.unwrap()).optional();if(b instanceof q.ZodNullable)return F(b.unwrap()).nullable();if(b instanceof q.ZodArray)return q.array(F(b.element));return q.union([b,q.custom((j)=>L.Output.isInstance(j))])}var Z=q.object({metadata:q.object({stateful:q.boolean(),proxiable:q.boolean()}),connectionTypes:q.record(q.string(),q.object({description:q.string().min(5)})),configSchema:q.custom(),deploymentInputSchema:q.custom(),outputSchema:q.custom()});function w(b){return b}var _=q.object({});class ${opts;providers;validationSchema;validationDeploymentInputSchema;declaredConnectionInterfaces=new Map;constructor(b){this.opts=Z.parse(b),this.providers={},this.validationSchema=F(b.configSchema),this.validationDeploymentInputSchema=F(b.deploymentInputSchema)}implement(b,j){return this.providers[b]={...j,stateSchema:j.stateSchema??_,initialState:j.initialState},this}getConnectionSchema(b){return b.schema}createDeclareConnectionInterfacesFn(){return(b)=>{for(let j of b){let B=j.interface.schema,
|
|
1
|
+
import{z as q}from"zod";import*as L from"@pulumi/pulumi";var Q;((H)=>{H.aws="aws";H.gcloud="gcloud";H.azure="azure";H.linode="linode";H.hetzner="hetzner";H.cloudflare="cloudflare"})(Q||={});var M;((E)=>{E.ipv4="ipv4";E.ipv6="ipv6";E.domain="domain"})(M||={});var V;((j)=>j.container_image="container_image")(V||={});var K=new Map;function W(b){return b.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase().replace(/-+/g,"-").replace(/^-|-$/g,"")}function X(b){let j=W(b);if(j.length===0)throw new Error("Connection interface name cannot be empty");let B=K.get(j);if(B!==void 0&&B!==b)throw new Error(`Connection interface name collision: '${b}' resolves to '${j}' which is already registered by '${B}'`);return K.set(j,b),j}function Y(b,j){return{name:X(b),schema:j}}function k(b,j){return b.schema.merge(j)}var x=Y("tcp",q.object({url:q.object({type:q.nativeEnum(M),value:q.string()}),publicAccess:q.boolean()})),N=q.object({});function F(b){if(b instanceof q.ZodObject){let j=b.shape,B={};for(let E in j)B[E]=F(j[E]);return q.object(B)}if(b instanceof q.ZodOptional)return F(b.unwrap()).optional();if(b instanceof q.ZodNullable)return F(b.unwrap()).nullable();if(b instanceof q.ZodArray)return q.array(F(b.element));return q.union([b,q.custom((j)=>L.Output.isInstance(j))])}var Z=q.object({metadata:q.object({stateful:q.boolean(),proxiable:q.boolean()}),connectionTypes:q.record(q.string(),q.object({description:q.string().min(5)})),configSchema:q.custom(),deploymentInputSchema:q.custom(),outputSchema:q.custom()});function w(b){return b}var _=q.object({});class ${opts;providers;validationSchema;validationDeploymentInputSchema;declaredConnectionInterfaces=new Map;constructor(b){this.opts=Z.parse(b),this.providers={},this.validationSchema=F(b.configSchema),this.validationDeploymentInputSchema=F(b.deploymentInputSchema)}implement(b,j){return this.providers[b]={...j,stateSchema:j.stateSchema??_,initialState:j.initialState},this}getConnectionSchema(b){return b.schema}createDeclareConnectionInterfacesFn(){return(b)=>{for(let j of b){let B=j.interface.schema,E=F(B),J=E.safeParse(j.data);if(!J.success)throw new Error(`Invalid data for connection interface '${j.interface.name}': ${J.error.message}`);this.declaredConnectionInterfaces.set(j.interface.name,{schema:E,data:j.data})}}}getDeclaredInterfaces(){return this.declaredConnectionInterfaces}}export{W as toCanonicalInterfaceName,k as extendSchema,Y as defineConnectionInterface,w as connectionHandler,M as TCPUrlType,x as TCPCI,$ as InfraComponent,V as DeploymentArtifactType,Q as CloudProvider};
|