@layerzerolabs/dw-model 1.2.102 → 1.2.104
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/2WVSRK2J.js +59 -0
- package/dist/2WVSRK2J.js.map +1 -0
- package/dist/KU2DVBJJ.js +3 -0
- package/dist/KU2DVBJJ.js.map +1 -0
- package/dist/{BHJ6M5FG.js → N24RNS6I.js} +4 -3
- package/dist/N24RNS6I.js.map +1 -0
- package/dist/{7QV722N2.js → P4N5LZEM.js} +16 -7
- package/dist/P4N5LZEM.js.map +1 -0
- package/dist/deploy/index.d.ts +1 -0
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/index.js +4 -3
- package/dist/deploy/resourceBuilder.d.ts +1 -1
- package/dist/deploy/resourceBuilder.d.ts.map +1 -1
- package/dist/deploy/resourceBuilder.js +4 -1
- package/dist/deploy/resourceListChecks.d.ts +22 -0
- package/dist/deploy/resourceListChecks.d.ts.map +1 -0
- package/dist/deploy/resourceListChecks.js +7 -0
- package/dist/deploy/resourceListChecks.js.map +1 -0
- package/dist/deploy/resources.d.ts +1 -0
- package/dist/deploy/resources.d.ts.map +1 -1
- package/dist/deploy/resources.js +1 -1
- package/dist/index.js +6 -5
- package/package.json +10 -10
- package/dist/7QV722N2.js.map +0 -1
- package/dist/BHJ6M5FG.js.map +0 -1
- package/dist/V2SO4JCF.js +0 -3
- package/dist/V2SO4JCF.js.map +0 -1
package/dist/2WVSRK2J.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { extractContractResourceReferences, extractIdFromContractResourceReference } from './P4N5LZEM.js';
|
|
2
|
+
import { __name } from './VUOMXK5T.js';
|
|
3
|
+
|
|
4
|
+
// src/deploy/resourceListChecks.ts
|
|
5
|
+
var onChain = /* @__PURE__ */ __name(({ chainName }) => chainName === void 0 ? "" : ` on ${chainName}`, "onChain");
|
|
6
|
+
var checkContractResourceReferences = /* @__PURE__ */ __name((fields) => ({ resources }, ctx) => {
|
|
7
|
+
const fieldsByType = new Map(Object.entries(fields));
|
|
8
|
+
const resourcesById = new Map(resources.map((resource) => [
|
|
9
|
+
resource.id,
|
|
10
|
+
resource
|
|
11
|
+
]));
|
|
12
|
+
resources.forEach((resource, index) => {
|
|
13
|
+
const expectedTypes = new Map(Object.entries(fieldsByType.get(resource.type) ?? {}));
|
|
14
|
+
for (const [field, reference] of extractContractResourceReferences(resource)) {
|
|
15
|
+
const expectedType = expectedTypes.get(field);
|
|
16
|
+
if (expectedType === void 0) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const id = extractIdFromContractResourceReference(reference);
|
|
20
|
+
const referenced = resourcesById.get(id);
|
|
21
|
+
if (referenced?.type === expectedType && referenced.chainName === resource.chainName) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const found = referenced ? `${id} is a ${referenced.type}${onChain(referenced)}` : `${id} is not a resource of this config`;
|
|
25
|
+
ctx.addIssue({
|
|
26
|
+
code: "custom",
|
|
27
|
+
path: [
|
|
28
|
+
"resources",
|
|
29
|
+
index,
|
|
30
|
+
field
|
|
31
|
+
],
|
|
32
|
+
message: `${resource.id}: ${field} must reference a ${expectedType} resource${onChain(resource)}; ${found}`
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}, "checkContractResourceReferences");
|
|
37
|
+
var checkUniqueResourceIds = /* @__PURE__ */ __name(({ resources }, ctx) => {
|
|
38
|
+
const firstIndexById = /* @__PURE__ */ new Map();
|
|
39
|
+
resources.forEach(({ id }, index) => {
|
|
40
|
+
const firstIndex = firstIndexById.get(id);
|
|
41
|
+
if (firstIndex === void 0) {
|
|
42
|
+
firstIndexById.set(id, index);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
ctx.addIssue({
|
|
46
|
+
code: "custom",
|
|
47
|
+
path: [
|
|
48
|
+
"resources",
|
|
49
|
+
index,
|
|
50
|
+
"id"
|
|
51
|
+
],
|
|
52
|
+
message: `${id} is already the ID of resources.${firstIndex}; resource IDs must be unique across all chains`
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}, "checkUniqueResourceIds");
|
|
56
|
+
|
|
57
|
+
export { checkContractResourceReferences, checkUniqueResourceIds };
|
|
58
|
+
//# sourceMappingURL=2WVSRK2J.js.map
|
|
59
|
+
//# sourceMappingURL=2WVSRK2J.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/deploy/resourceListChecks.ts"],"names":["onChain","chainName","undefined","checkContractResourceReferences","fields","resources","ctx","fieldsByType","Map","Object","entries","resourcesById","map","resource","id","forEach","index","expectedTypes","get","type","field","reference","extractContractResourceReferences","expectedType","extractIdFromContractResourceReference","referenced","found","addIssue","code","path","message","checkUniqueResourceIds","firstIndexById","firstIndex","set"],"mappings":";;;;AAaA,IAAMA,OAAAA,mBAAU,MAAA,CAAA,CAAC,EAAEC,SAAAA,EAAS,KACxBA,cAAcC,MAAAA,GAAY,EAAA,GAAK,CAAA,IAAA,EAAOD,SAAAA,CAAAA,CAAAA,EAD1B,SAAA,CAAA;AAST,IAAME,kDACT,MAAA,CAAA,CAAiCC,MAAAA,KACjC,CAAC,EAAEC,SAAAA,IAAiDC,GAAAA,KAAAA;AAChD,EAAA,MAAMC,eAAe,IAAIC,GAAAA,CACrBC,MAAAA,CAAOC,OAAAA,CAAQN,MAAAA,CAAAA,CAAAA;AAEnB,EAAA,MAAMO,gBAAgB,IAAIH,GAAAA,CAAIH,SAAAA,CAAUO,GAAAA,CAAI,CAACC,QAAAA,KAAa;IAACA,QAAAA,CAASC,EAAAA;AAAID,IAAAA;GAAS,CAAA,CAAA;AACjFR,EAAAA,SAAAA,CAAUU,OAAAA,CAAQ,CAACF,QAAAA,EAAUG,KAAAA,KAAAA;AACzB,IAAA,MAAMC,aAAAA,GAAgB,IAAIT,GAAAA,CAAIC,MAAAA,CAAOC,OAAAA,CAAQH,YAAAA,CAAaW,GAAAA,CAAIL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CAClC,EAAE1B,SAAAA,IACFC,GAAAA,KAAAA;AAEA,EAAA,MAAM0B,cAAAA,uBAAqBxB,GAAAA,EAAAA;AAC3BH,EAAAA,SAAAA,CAAUU,OAAAA,CAAQ,CAAC,EAAED,EAAAA,IAAME,KAAAA,KAAAA;AACvB,IAAA,MAAMiB,UAAAA,GAAaD,cAAAA,CAAed,GAAAA,CAAIJ,EAAAA,CAAAA;AACtC,IAAA,IAAImB,eAAe/B,MAAAA,EAAW;AAC1B8B,MAAAA,cAAAA,CAAeE,GAAAA,CAAIpB,IAAIE,KAAAA,CAAAA;AACvB,MAAA;AACJ,IAAA;AACAV,IAAAA,GAAAA,CAAIqB,QAAAA,CAAS;MACTC,IAAAA,EAAM,QAAA;MACNC,IAAAA,EAAM;AAAC,QAAA,WAAA;AAAab,QAAAA,KAAAA;AAAO,QAAA;;MAC3Bc,OAAAA,EAAS,CAAA,EAAGhB,EAAAA,CAAAA,gCAAAA,EAAqCmB,UAAAA,CAAAA,+CAAAA;KACrD,CAAA;EACJ,CAAA,CAAA;AACJ,CAAA,EAjBsC,wBAAA","file":"2WVSRK2J.js","sourcesContent":["import type z from 'zod';\n\nimport type { ChainName } from '@layerzerolabs/layerzero-definitions';\n\nimport {\n type BaseContractResource,\n type BaseResource,\n extractContractResourceReferences,\n extractIdFromContractResourceReference,\n} from './resources';\n\ntype TypedResource = BaseResource & { type: string; chainName?: ChainName };\n\nconst onChain = ({ chainName }: TypedResource) =>\n chainName === undefined ? '' : ` on ${chainName}`;\n\nexport type ContractResourceReferenceFields<Resource extends TypedResource> = {\n readonly [Type in Extract<Resource, BaseContractResource>['type']]?: {\n readonly [Field in keyof Extract<Resource, { type: Type }>]?: Resource['type'];\n };\n};\n\nexport const checkContractResourceReferences =\n <Resource extends TypedResource>(fields: ContractResourceReferenceFields<Resource>) =>\n ({ resources }: { resources: readonly Resource[] }, ctx: z.RefinementCtx) => {\n const fieldsByType = new Map<string, Partial<Record<string, string>>>(\n Object.entries(fields),\n );\n const resourcesById = new Map(resources.map((resource) => [resource.id, resource]));\n resources.forEach((resource, index) => {\n const expectedTypes = new Map(Object.entries(fieldsByType.get(resource.type) ?? {}));\n for (const [field, reference] of extractContractResourceReferences(resource)) {\n const expectedType = expectedTypes.get(field);\n if (expectedType === undefined) {\n continue;\n }\n const id = extractIdFromContractResourceReference(reference);\n const referenced = resourcesById.get(id);\n if (\n referenced?.type === expectedType &&\n referenced.chainName === resource.chainName\n ) {\n continue;\n }\n const found = referenced\n ? `${id} is a ${referenced.type}${onChain(referenced)}`\n : `${id} is not a resource of this config`;\n ctx.addIssue({\n code: 'custom',\n path: ['resources', index, field],\n message: `${resource.id}: ${field} must reference a ${expectedType} resource${onChain(resource)}; ${found}`,\n });\n }\n });\n };\n\nexport const checkUniqueResourceIds = (\n { resources }: { resources: readonly BaseResource[] },\n ctx: z.RefinementCtx,\n) => {\n const firstIndexById = new Map<string, number>();\n resources.forEach(({ id }, index) => {\n const firstIndex = firstIndexById.get(id);\n if (firstIndex === undefined) {\n firstIndexById.set(id, index);\n return;\n }\n ctx.addIssue({\n code: 'custom',\n path: ['resources', index, 'id'],\n message: `${id} is already the ID of resources.${firstIndex}; resource IDs must be unique across all chains`,\n });\n });\n};\n"]}
|
package/dist/KU2DVBJJ.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"KU2DVBJJ.js"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CONTRACT_RESOURCE_REFERENCE_PREFIX } from './P4N5LZEM.js';
|
|
1
2
|
import { __name } from './VUOMXK5T.js';
|
|
2
3
|
import { throwError } from '@layerzerolabs/common-error-utils';
|
|
3
4
|
|
|
@@ -7,7 +8,7 @@ var createResourceBuilder = /* @__PURE__ */ __name((_resourceSchema, { resourceB
|
|
|
7
8
|
const addressArg = args[1];
|
|
8
9
|
const _INTRINSIC_normalizedAddress = addressArg && "nativeAddress" in addressArg ? throwError(`Native address is currently not supported, use normalizedAddress instead`) : addressArg?.normalizedAddress;
|
|
9
10
|
return {
|
|
10
|
-
ref: /* @__PURE__ */ __name(() =>
|
|
11
|
+
ref: /* @__PURE__ */ __name(() => `${CONTRACT_RESOURCE_REFERENCE_PREFIX}${resource.id}`, "ref"),
|
|
11
12
|
build: /* @__PURE__ */ __name(() => ({
|
|
12
13
|
...resource,
|
|
13
14
|
type,
|
|
@@ -30,5 +31,5 @@ var createResourceBuilder = /* @__PURE__ */ __name((_resourceSchema, { resourceB
|
|
|
30
31
|
}, "createResourceBuilder");
|
|
31
32
|
|
|
32
33
|
export { createResourceBuilder };
|
|
33
|
-
//# sourceMappingURL=
|
|
34
|
-
//# sourceMappingURL=
|
|
34
|
+
//# sourceMappingURL=N24RNS6I.js.map
|
|
35
|
+
//# sourceMappingURL=N24RNS6I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/deploy/resourceBuilder.ts"],"names":["createResourceBuilder","_resourceSchema","resourceBaseType","type","args","resource","addressArg","_INTRINSIC_normalizedAddress","throwError","normalizedAddress","ref","CONTRACT_RESOURCE_REFERENCE_PREFIX","id","build","Error"],"mappings":";;;;AAyBO,IAAMA,qBAAAA,2BAKLC,eAAAA,EACA,EACIC,kBACAC,IAAAA,EAAI,KAMZ,IACOC,IAAAA,KAAAA;AAWH,EAAA,MAAMC,QAAAA,GAAWD,KAAK,CAAA,CAAA;AACtB,EAAA,IAAIF,qBAAqB,UAAA,EAAY;AAEjC,IAAA,MAAMI,UAAAA,GAAaF,KAAK,CAAA,CAAA;AAGxB,IAAA,MAAMG,+BACFD,UAAAA,IAAc,eAAA,IAAmBA,aAC3BE,UAAAA,CACI,CAAA,wEAAA,CAA0E,IAE9EF,UAAAA,EAAYG,iBAAAA;AAEtB,IAAA,OAAO;AACHC,MAAAA,GAAAA,+BAAW,CAAA,EAAGC,kCAAAA,CAAAA,EAAqCN,QAAAA,CAASO,EAAE,CAAA,CAAA,EAAzD,KAAA,CAAA;AACLC,MAAAA,KAAAA,kBAAO,MAAA,CAAA,OAAO;QACV,GAAGR,QAAAA;AACHF,QAAAA,IAAAA;AACAD,QAAAA,gBAAAA;AACAK,QAAAA;OACJ,CAAA,EALO,OAAA;AAMX,KAAA;AACJ,EAAA;AAEA,EAAA,IAAIL,qBAAqB,MAAA,EAAQ;AAC7B,IAAA,OAAO;AACHQ,MAAAA,GAAAA,kBAAK,MAAA,CAAA,MAAM,CAAA,OAAA,EAAUL,QAAAA,CAASO,EAAE,CAAA,CAAA,EAA3B,KAAA,CAAA;AACLC,MAAAA,KAAAA,kBAAO,MAAA,CAAA,OAAO;QAAE,GAAGR,QAAAA;AAAUF,QAAAA,IAAAA;AAAMD,QAAAA;OAAiB,CAAA,EAA7C,OAAA;AACX,KAAA;AACJ,EAAA;AAEA,EAAA,MAAM,IAAIY,KAAAA,CAAM,CAAA,+BAAA,EAAkCZ,gBAAAA,CAAAA,CAAAA,CAAmB,CAAA;AACzE,CAAA,EAzDA,uBAAA","file":"N24RNS6I.js","sourcesContent":["import type { z } from 'zod';\n\nimport type { normalizedHexSchema } from '@layerzerolabs/common-chain-model';\nimport { throwError } from '@layerzerolabs/common-error-utils';\nimport type { NormalizedHexString } from '@layerzerolabs/typescript-utils';\n\nimport {\n type BaseContractResource,\n type BaseMeshResource,\n type baseResourceSchema,\n CONTRACT_RESOURCE_REFERENCE_PREFIX,\n type ContractResourceReference,\n type MeshResourceReference,\n} from './resources';\n\nexport type ContractResourceBuilderResult<Resource extends BaseContractResource> = {\n ref: () => ContractResourceReference<Resource>;\n build: () => Resource;\n};\n\nexport type MeshResourceBuilderResult<Resource extends BaseMeshResource> = {\n ref: () => MeshResourceReference<Resource>;\n build: () => Resource;\n};\n\nexport const createResourceBuilder =\n <\n T extends typeof baseResourceSchema,\n U extends Omit<z.infer<T>, 'type' | 'resourceBaseType' | '_INTRINSIC_normalizedAddress'>,\n >(\n _resourceSchema: T,\n {\n resourceBaseType,\n type,\n }: {\n resourceBaseType: 'CONTRACT' | 'MESH';\n type: T['shape'] extends { type: z.ZodType<infer Type> } ? Type : undefined;\n },\n ) =>\n (\n ...args: T extends z.ZodObject<{ _INTRINSIC_normalizedAddress: typeof normalizedHexSchema }>\n ? [\n resource: U,\n address: { nativeAddress: string } | { normalizedAddress: NormalizedHexString },\n ]\n : [resource: U]\n ): z.infer<T> extends BaseContractResource\n ? ContractResourceBuilderResult<z.infer<T>>\n : z.infer<T> extends BaseMeshResource\n ? MeshResourceBuilderResult<z.infer<T>>\n : never => {\n const resource = args[0];\n if (resourceBaseType === 'CONTRACT') {\n // cast because ts can't narrow T\n const addressArg = args[1 as number] as unknown as\n | { nativeAddress: string }\n | { normalizedAddress: NormalizedHexString };\n const _INTRINSIC_normalizedAddress: NormalizedHexString | undefined =\n addressArg && 'nativeAddress' in addressArg\n ? throwError(\n `Native address is currently not supported, use normalizedAddress instead`,\n )\n : addressArg?.normalizedAddress;\n\n return {\n ref: () => `${CONTRACT_RESOURCE_REFERENCE_PREFIX}${resource.id}` as any,\n build: () => ({\n ...resource,\n type,\n resourceBaseType,\n _INTRINSIC_normalizedAddress,\n }),\n } satisfies ContractResourceBuilderResult<any> as any;\n }\n\n if (resourceBaseType === 'MESH') {\n return {\n ref: () => `#M_REF:${resource.id}` as any,\n build: () => ({ ...resource, type, resourceBaseType }),\n } satisfies MeshResourceBuilderResult<any> as any;\n }\n\n throw new Error(`Can't handle resourceBaseType \"${resourceBaseType}\"`);\n };\n"]}
|
|
@@ -25,14 +25,23 @@ var withIntrinsicAddress = /* @__PURE__ */ __name((resourceSchema) => z.object({
|
|
|
25
25
|
...resourceSchema.shape,
|
|
26
26
|
_INTRINSIC_normalizedAddress: normalizedHexSchema
|
|
27
27
|
}), "withIntrinsicAddress");
|
|
28
|
-
var
|
|
29
|
-
var
|
|
28
|
+
var CONTRACT_RESOURCE_REFERENCE_PREFIX = "#C_REF:";
|
|
29
|
+
var findContractResourceReferenceId = /* @__PURE__ */ __name((value) => typeof value === "string" && value.startsWith(CONTRACT_RESOURCE_REFERENCE_PREFIX) && value.length > CONTRACT_RESOURCE_REFERENCE_PREFIX.length ? value.slice(CONTRACT_RESOURCE_REFERENCE_PREFIX.length) : void 0, "findContractResourceReferenceId");
|
|
30
|
+
var extractIdFromContractResourceReference = /* @__PURE__ */ __name((ref) => findContractResourceReferenceId(ref) ?? throwError(`Ref ${JSON.stringify(ref)} is not a contract resource ref`), "extractIdFromContractResourceReference");
|
|
31
|
+
var describeInput = /* @__PURE__ */ __name((input) => input === void 0 ? "it is not set" : typeof input === "string" ? `got ${JSON.stringify(input)}` : `got ${input === null ? "null" : typeof input}`, "describeInput");
|
|
32
|
+
var contractResourceReferenceError = /* @__PURE__ */ __name(({ input }) => `must be a contract resource reference ${CONTRACT_RESOURCE_REFERENCE_PREFIX}<resource id>, made with .ref(); ${describeInput(input)}`, "contractResourceReferenceError");
|
|
33
|
+
var contractResourceReferenceStringSchema = z.string({
|
|
34
|
+
error: contractResourceReferenceError
|
|
35
|
+
}).refine((value) => findContractResourceReferenceId(value) !== void 0, {
|
|
36
|
+
error: contractResourceReferenceError
|
|
37
|
+
});
|
|
38
|
+
var contractResourceReferenceSchema = contractResourceReferenceStringSchema.meta({
|
|
30
39
|
id: "contract-resource-dependency",
|
|
31
40
|
title: "Contract dependency to any",
|
|
32
41
|
description: "A reference to another contract resource (any)"
|
|
33
42
|
});
|
|
34
43
|
var contractResourceDependencyForSchemaZodMetaIdIdx = 0;
|
|
35
|
-
var contractResourceReferenceSchemaFor = /* @__PURE__ */ __name((_resource) =>
|
|
44
|
+
var contractResourceReferenceSchemaFor = /* @__PURE__ */ __name((_resource) => contractResourceReferenceStringSchema.meta({
|
|
36
45
|
id: `contract-resource-dependency-for-${++contractResourceDependencyForSchemaZodMetaIdIdx}`,
|
|
37
46
|
// We can't generate this properly yet because this function needs more information
|
|
38
47
|
// Will be fixed when we clean up the runtime dependency ID resolution
|
|
@@ -56,10 +65,10 @@ var meshResourceReferenceSchemaFor = /* @__PURE__ */ __name((_resource) => z.str
|
|
|
56
65
|
}), "meshResourceReferenceSchemaFor");
|
|
57
66
|
var extractIdFromMeshResourceReference = /* @__PURE__ */ __name((ref) => ref.startsWith("#M_REF:") && ref.slice("#M_REF:".length) || throwError(`Ref ${JSON.stringify(ref)} is not a mesh resource ref`), "extractIdFromMeshResourceReference");
|
|
58
67
|
var resolvedMeshResourceReferenceSchema = z.custom();
|
|
59
|
-
var extractContractResourceReferences = /* @__PURE__ */ __name((resource) => Object.entries(resource).filter(([,
|
|
68
|
+
var extractContractResourceReferences = /* @__PURE__ */ __name((resource) => Object.entries(resource).filter(([, value]) => findContractResourceReferenceId(value) !== void 0), "extractContractResourceReferences");
|
|
60
69
|
var extractMeshResourceReferences = /* @__PURE__ */ __name((resource) => Object.entries(resource).filter(([, id]) => typeof id === "string" && id.startsWith("#M_REF:")), "extractMeshResourceReferences");
|
|
61
70
|
var createResolvedResourceSchema = /* @__PURE__ */ __name((resource) => resource, "createResolvedResourceSchema");
|
|
62
71
|
|
|
63
|
-
export { baseContractResourceSchema, baseMeshResourceSchema, baseResourceSchema, contractResourceReferenceSchema, contractResourceReferenceSchemaFor, createResolvedResourceSchema, extractContractResourceReferences, extractIdFromContractResourceReference, extractIdFromMeshResourceReference, extractMeshResourceReferences, meshResourceReferenceSchema, meshResourceReferenceSchemaFor, resolvedContractResourceReferenceSchema, resolvedMeshResourceReferenceSchema, withIntrinsicAddress };
|
|
64
|
-
//# sourceMappingURL=
|
|
65
|
-
//# sourceMappingURL=
|
|
72
|
+
export { CONTRACT_RESOURCE_REFERENCE_PREFIX, baseContractResourceSchema, baseMeshResourceSchema, baseResourceSchema, contractResourceReferenceSchema, contractResourceReferenceSchemaFor, createResolvedResourceSchema, extractContractResourceReferences, extractIdFromContractResourceReference, extractIdFromMeshResourceReference, extractMeshResourceReferences, meshResourceReferenceSchema, meshResourceReferenceSchemaFor, resolvedContractResourceReferenceSchema, resolvedMeshResourceReferenceSchema, withIntrinsicAddress };
|
|
73
|
+
//# sourceMappingURL=P4N5LZEM.js.map
|
|
74
|
+
//# sourceMappingURL=P4N5LZEM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/deploy/resources.ts"],"names":["baseResourceSchema","z","object","id","string","resourceBaseType","baseMeshResourceSchema","shape","literal","baseContractResourceSchema","chainName","chainNameSchema","upgradeConfig","upgradeableConfigSchema","optional","verifyContract","boolean","chainConfig","any","withIntrinsicAddress","resourceSchema","_INTRINSIC_normalizedAddress","normalizedHexSchema","CONTRACT_RESOURCE_REFERENCE_PREFIX","findContractResourceReferenceId","value","startsWith","length","slice","undefined","extractIdFromContractResourceReference","ref","throwError","JSON","stringify","describeInput","input","contractResourceReferenceError","contractResourceReferenceStringSchema","error","refine","contractResourceReferenceSchema","meta","title","description","contractResourceDependencyForSchemaZodMetaIdIdx","contractResourceReferenceSchemaFor","_resource","resolvedContractResourceReferenceSchema","custom","meshResourceReferenceSchema","meshResourceDependencyForSchemaZodMetaIdIdx","meshResourceReferenceSchemaFor","extractIdFromMeshResourceReference","resolvedMeshResourceReferenceSchema","extractContractResourceReferences","resource","Object","entries","filter","extractMeshResourceReferences","createResolvedResourceSchema"],"mappings":";;;;;;;AASO,IAAMA,kBAAAA,GAAqBC,EAAEC,MAAAA,CAAO;AACvCC,EAAAA,EAAAA,EAAIF,EAAEG,MAAAA,EAAM;AACZC,EAAAA,gBAAAA,EAAkBJ,EAAEG,MAAAA;AACxB,CAAA;AAEO,IAAME,sBAAAA,GAAyBL,EAAEC,MAAAA,CAAO;AAC3C,EAAA,GAAGF,kBAAAA,CAAmBO,KAAAA;EACtBF,gBAAAA,EAAkBJ,CAAAA,CAAEO,QAAQ,MAAA;AAChC,CAAA;AAEO,IAAMC,0BAAAA,GAA6BR,EAAEC,MAAAA,CAAO;AAC/C,EAAA,GAAGF,kBAAAA,CAAmBO,KAAAA;EACtBF,gBAAAA,EAAkBJ,CAAAA,CAAEO,QAAQ,UAAA,CAAA;EAC5BE,SAA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8BAAA;EACPC,WAAAA,EAAa;AACjB,CAAA,CAAA,EAR0C,gCAAA;AAgBvC,IAAMS,qDAAqC,MAAA,CAAA,CAACtB,GAAAA,KAC7CA,IAA0BL,UAAAA,CAAW,SAAA,KAClCK,GAAAA,CAA0BH,KAAAA,CAAM,UAAUD,MAAM,CAAA,IACrDK,WAAW,CAAA,IAAA,EAAOC,IAAAA,CAAKC,UAAUH,GAAAA,CAAAA,6BAAiC,CAAA,EAHpB,oCAAA;AAS3C,IAAMuB,mCAAAA,GACTrD,EAAEgD,MAAAA;AA8CC,IAAMM,oDAAoC,MAAA,CAAA,CAC7CC,QAAAA,KAEAC,MAAAA,CAAOC,OAAAA,CAAQF,QAAAA,CAAAA,CAAUG,MAAAA,CACrB,CAAC,GAAGlC,KAAAA,CAAAA,KAAWD,gCAAgCC,KAAAA,CAAAA,KAAWI,MAAAA,CAAAA,EAJjB,mCAAA;AAO1C,IAAM+B,6BAAAA,2BAAgEJ,QAAAA,KACzEC,MAAAA,CAAOC,QAAQF,QAAAA,CAAAA,CAAUG,OACrB,CAAC,GAAGxD,EAAAA,CAAAA,KAAQ,OAAOA,EAAAA,KAAO,QAAA,IAAYA,GAAGuB,UAAAA,CAAW,SAAA,CAAA,CAAA,EAFf,+BAAA;AAMtC,IAAMmC,4BAAAA,mBAA+B,MAAA,CAAA,CACxCL,QAAAA,KACCA,QAAAA,EAFuC,8BAAA","file":"P4N5LZEM.js","sourcesContent":["import z from 'zod';\n\nimport { normalizedHexSchema, type NormalizedHexString } from '@layerzerolabs/common-chain-model';\nimport { throwError } from '@layerzerolabs/common-error-utils';\nimport { chainNameSchema } from '@layerzerolabs/layerzero-definitions';\nimport type { IsAny } from '@layerzerolabs/typescript-utils';\n\nimport { upgradeableConfigSchema } from '../upgrade';\n\nexport const baseResourceSchema = z.object({\n id: z.string(), // account-unique ID for this resource\n resourceBaseType: z.string() as z.ZodString | z.ZodLiteral,\n});\n\nexport const baseMeshResourceSchema = z.object({\n ...baseResourceSchema.shape,\n resourceBaseType: z.literal('MESH'),\n});\n\nexport const baseContractResourceSchema = z.object({\n ...baseResourceSchema.shape,\n resourceBaseType: z.literal('CONTRACT'),\n chainName: chainNameSchema,\n upgradeConfig: upgradeableConfigSchema.optional(),\n verifyContract: z.boolean().optional(),\n\n chainConfig: z.any().optional(),\n});\n\nexport const withIntrinsicAddress = <T extends typeof baseContractResourceSchema>(\n resourceSchema: T,\n) =>\n z.object({\n ...resourceSchema.shape,\n _INTRINSIC_normalizedAddress: normalizedHexSchema,\n }) as unknown as T['shape'] extends infer Shape extends Readonly<Record<string, z.ZodType>>\n ? z.ZodObject<\n {\n [K in\n | keyof Shape\n | '_INTRINSIC_normalizedAddress']: K extends '_INTRINSIC_normalizedAddress'\n ? typeof normalizedHexSchema\n : K extends keyof Shape\n ? Shape[K]\n : never;\n },\n z.core.$strip\n >\n : never;\n\nexport type BaseResource = z.infer<typeof baseResourceSchema>;\nexport type BaseMeshResource = z.infer<typeof baseMeshResourceSchema>;\nexport type BaseContractResource = z.infer<typeof baseContractResourceSchema>;\nexport type BaseIntrinsicAddressContractResource = z.infer<ReturnType<typeof withIntrinsicAddress>>;\n\nexport const CONTRACT_RESOURCE_REFERENCE_PREFIX = '#C_REF:';\n\n// The actual expected runtime value for this type is #C_REF:${id}\nexport type ContractResourceReference<T extends BaseContractResource = BaseContractResource> = {\n /** WARNING: these fields are not present at runtime */\n __resourceReferenceType: T;\n ['__CONTRACT_RESOURCE_REFERENCE']: true;\n};\n\nconst findContractResourceReferenceId = (value: unknown): string | undefined =>\n typeof value === 'string' &&\n value.startsWith(CONTRACT_RESOURCE_REFERENCE_PREFIX) &&\n value.length > CONTRACT_RESOURCE_REFERENCE_PREFIX.length\n ? value.slice(CONTRACT_RESOURCE_REFERENCE_PREFIX.length)\n : undefined;\n\nexport const extractIdFromContractResourceReference = (ref: ContractResourceReference) =>\n findContractResourceReferenceId(ref) ??\n throwError(`Ref ${JSON.stringify(ref)} is not a contract resource ref`);\n\nconst describeInput = (input: unknown) =>\n input === undefined\n ? 'it is not set'\n : typeof input === 'string'\n ? `got ${JSON.stringify(input)}`\n : `got ${input === null ? 'null' : typeof input}`;\n\nconst contractResourceReferenceError = ({ input }: { input: unknown }) =>\n `must be a contract resource reference ${CONTRACT_RESOURCE_REFERENCE_PREFIX}<resource id>, made with .ref(); ${describeInput(input)}`;\n\nconst contractResourceReferenceStringSchema = z\n .string({ error: contractResourceReferenceError })\n .refine((value) => findContractResourceReferenceId(value) !== undefined, {\n error: contractResourceReferenceError,\n });\n\n// Use z.ZodType<BaseContractResource> because we want to allow unions\nexport type ContractResourceReferenceSchema<T extends z.ZodType<BaseContractResource>> = z.ZodType<\n ContractResourceReference<z.infer<T>>\n>;\n\nexport const contractResourceReferenceSchema: ContractResourceReferenceSchema<\n z.ZodType<BaseContractResource>\n // At runtime, we expect a string\n> = contractResourceReferenceStringSchema.meta({\n id: 'contract-resource-dependency',\n title: 'Contract dependency to any',\n description: 'A reference to another contract resource (any)',\n}) as unknown as z.ZodType<ContractResourceReference>;\n\nlet contractResourceDependencyForSchemaZodMetaIdIdx = 0;\nexport const contractResourceReferenceSchemaFor = <T extends z.ZodType<BaseContractResource>>(\n // TODO: use resource parameter to generate a concrete schema\n _resource: T,\n): ContractResourceReferenceSchema<T> =>\n contractResourceReferenceStringSchema.meta({\n id: `contract-resource-dependency-for-${++contractResourceDependencyForSchemaZodMetaIdIdx}`,\n // We can't generate this properly yet because this function needs more information\n // Will be fixed when we clean up the runtime dependency ID resolution\n title: 'Contract dependency to (unknown)',\n description: 'A reference to another contract resource (unknown)',\n }) as unknown as z.ZodType<ContractResourceReference<z.infer<T>>>;\n\nexport type ResolvedContractResourceReference<T extends BaseContractResource> = {\n id: string;\n resource: T;\n address: NormalizedHexString;\n};\n\nexport type ResolvedContractResourceReferenceSchema<T extends z.ZodType<BaseContractResource>> =\n z.ZodType<ResolvedContractResourceReference<z.infer<T>>>;\n\nexport const resolvedContractResourceReferenceSchema: ResolvedContractResourceReferenceSchema<any> =\n // TODO: replace with a concrete zod schema\n z.custom<ResolvedContractResourceReference<any>>();\n\n// The actual expected runtime value for this type is #M_REF:${id}\nexport type MeshResourceReference<T extends BaseMeshResource = BaseMeshResource> = {\n /** WARNING: these fields are not present at runtime */\n __resourceReferenceType: T;\n ['__MESH_RESOURCE_REFERENCE']: true;\n};\n\nexport type MeshResourceReferenceSchema<T extends typeof baseMeshResourceSchema> = z.ZodType<\n MeshResourceReference<z.infer<T>>\n>;\n\nexport const meshResourceReferenceSchema: MeshResourceReferenceSchema<\n typeof baseMeshResourceSchema\n> = z.string().meta({\n id: 'mesh-resource-dependency',\n title: 'Mesh dependency to any',\n description: 'A reference to another mesh resource (any)',\n}) as unknown as z.ZodType<MeshResourceReference>;\n\nlet meshResourceDependencyForSchemaZodMetaIdIdx = 0;\nexport const meshResourceReferenceSchemaFor = <T extends typeof baseMeshResourceSchema>(\n // TODO: use resource parameter to generate a concrete schema\n _resource: T,\n): MeshResourceReferenceSchema<T> =>\n z.string().meta({\n id: `mesh-resource-dependency-for-${++meshResourceDependencyForSchemaZodMetaIdIdx}`,\n title: 'Mesh dependency to (unknown)',\n description: 'A reference to another mesh resource (unknown)',\n }) as unknown as z.ZodType<MeshResourceReference<z.infer<T>>>;\n\nexport type ResolvedMeshResourceReference<T extends BaseMeshResource> = {\n id: string;\n resource: T;\n // TODO: is there any other resolved information we want to inject here?\n};\n\nexport const extractIdFromMeshResourceReference = (ref: MeshResourceReference) =>\n ((ref as unknown as string).startsWith('#M_REF:') &&\n (ref as unknown as string).slice('#M_REF:'.length)) ||\n throwError(`Ref ${JSON.stringify(ref)} is not a mesh resource ref`);\n\nexport type ResolvedMeshResourceReferenceSchema<T extends typeof baseMeshResourceSchema> =\n // TODO: replace with a concrete zod schema\n z.ZodType<ResolvedMeshResourceReference<z.infer<T>>>;\n\nexport const resolvedMeshResourceReferenceSchema: ResolvedMeshResourceReferenceSchema<any> =\n z.custom<ResolvedMeshResourceReference<any>>();\n\nexport type ResolvedResourceSchema<Resource extends typeof baseResourceSchema> = z.ZodObject<\n {\n [K in Exclude<\n keyof Resource['shape'],\n '_INTRINSIC_normalizedAddress'\n >]: Resource['shape'][K] extends infer R extends z.ZodType\n ? R extends z.ZodAny\n ? R\n : R extends z.ZodOptional<z.ZodAny>\n ? R\n : R extends ContractResourceReferenceSchema<infer I>\n ? ResolvedContractResourceReferenceSchema<I>\n : R extends z.ZodOptional<ContractResourceReferenceSchema<infer I>>\n ? z.ZodOptional<ResolvedContractResourceReferenceSchema<I>>\n : R extends MeshResourceReferenceSchema<infer I>\n ? ResolvedMeshResourceReferenceSchema<I>\n : R extends z.ZodOptional<MeshResourceReferenceSchema<infer I>>\n ? z.ZodOptional<ResolvedMeshResourceReferenceSchema<I>>\n : R\n : never;\n },\n z.core.$strip\n>;\n\nexport type ResolvedResource<Resource extends BaseResource> = {\n [K in Exclude<keyof Resource, '_INTRINSIC_normalizedAddress'>]: Resource[K] extends infer R\n ? R extends undefined\n ? R\n : IsAny<R> extends true\n ? R\n : IsAny<Exclude<R, undefined>> extends true\n ? R\n : R extends ContractResourceReference<infer I>\n ? ResolvedContractResourceReference<I>\n : R extends ContractResourceReference<infer I> | undefined\n ? ResolvedContractResourceReference<I> | undefined\n : R extends MeshResourceReference<infer I>\n ? ResolvedMeshResourceReference<I>\n : R extends MeshResourceReference<infer I> | undefined\n ? ResolvedMeshResourceReference<I> | undefined\n : R\n : never;\n};\n\nexport const extractContractResourceReferences = <Resource extends BaseResource>(\n resource: Resource,\n) =>\n Object.entries(resource).filter(\n ([, value]) => findContractResourceReferenceId(value) !== undefined,\n ) as unknown as [prop: string, id: ContractResourceReference][];\n\nexport const extractMeshResourceReferences = <Resource extends BaseResource>(resource: Resource) =>\n Object.entries(resource).filter(\n ([, id]) => typeof id === 'string' && id.startsWith('#M_REF:'),\n ) as unknown as [prop: string, id: MeshResourceReference][];\n\n// TODO: implement runtime resolution — currently returns input schema as-is\nexport const createResolvedResourceSchema = <Resource extends typeof baseResourceSchema>(\n resource: Resource,\n) => resource as ResolvedResourceSchema<Resource>;\n"]}
|
package/dist/deploy/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './factoryInterfaces';
|
|
|
4
4
|
export * from './getResourceSet';
|
|
5
5
|
export * from './resourceBuilder';
|
|
6
6
|
export * from './resourceIdScope';
|
|
7
|
+
export * from './resourceListChecks';
|
|
7
8
|
export * from './resourceRef';
|
|
8
9
|
export * from './resources';
|
|
9
10
|
export * from './resourceSet';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deploy/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deploy/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
package/dist/deploy/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import '../
|
|
2
|
-
export { createResourceBuilder } from '../
|
|
1
|
+
import '../KU2DVBJJ.js';
|
|
2
|
+
export { createResourceBuilder } from '../N24RNS6I.js';
|
|
3
3
|
export { isCompositeResourceIdInScope } from '../JYX6YDJT.js';
|
|
4
|
-
export {
|
|
4
|
+
export { checkContractResourceReferences, checkUniqueResourceIds } from '../2WVSRK2J.js';
|
|
5
|
+
export { CONTRACT_RESOURCE_REFERENCE_PREFIX, baseContractResourceSchema, baseMeshResourceSchema, baseResourceSchema, contractResourceReferenceSchema, contractResourceReferenceSchemaFor, createResolvedResourceSchema, extractContractResourceReferences, extractIdFromContractResourceReference, extractIdFromMeshResourceReference, extractMeshResourceReferences, meshResourceReferenceSchema, meshResourceReferenceSchemaFor, resolvedContractResourceReferenceSchema, resolvedMeshResourceReferenceSchema, withIntrinsicAddress } from '../P4N5LZEM.js';
|
|
5
6
|
import '../ZCFXJFGI.js';
|
|
6
7
|
import '../I2SFLHPT.js';
|
|
7
8
|
export { deployWorkflowChainStateSchema, deployWorkflowOrchestratorStateSchema, extractVerificationArtifactBaseArgsSchema } from '../MQAXH3BY.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
2
|
import type { normalizedHexSchema } from '@layerzerolabs/common-chain-model';
|
|
3
3
|
import type { NormalizedHexString } from '@layerzerolabs/typescript-utils';
|
|
4
|
-
import type
|
|
4
|
+
import { type BaseContractResource, type BaseMeshResource, type baseResourceSchema, type ContractResourceReference, type MeshResourceReference } from './resources';
|
|
5
5
|
export type ContractResourceBuilderResult<Resource extends BaseContractResource> = {
|
|
6
6
|
ref: () => ContractResourceReference<Resource>;
|
|
7
7
|
build: () => Resource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceBuilder.d.ts","sourceRoot":"","sources":["../../src/deploy/resourceBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,OAAO,KAAK,
|
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AAC,GACtF,CACI,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,iBAAiB,EAAE,mBAAmB,CAAA;CAAE,CAClF,GACD,CAAC,QAAQ,EAAE,CAAC,CAAC,KACpB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,oBAAoB,GACpC,6BAA6B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GACzC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,gBAAgB,GACjC,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GACrC,KAiCP,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { createResourceBuilder } from '../
|
|
1
|
+
export { createResourceBuilder } from '../N24RNS6I.js';
|
|
2
|
+
import '../P4N5LZEM.js';
|
|
3
|
+
import '../ZCFXJFGI.js';
|
|
4
|
+
import '../I2SFLHPT.js';
|
|
2
5
|
import '../VUOMXK5T.js';
|
|
3
6
|
//# sourceMappingURL=resourceBuilder.js.map
|
|
4
7
|
//# sourceMappingURL=resourceBuilder.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type z from 'zod';
|
|
2
|
+
import type { ChainName } from '@layerzerolabs/layerzero-definitions';
|
|
3
|
+
import { type BaseContractResource, type BaseResource } from './resources';
|
|
4
|
+
type TypedResource = BaseResource & {
|
|
5
|
+
type: string;
|
|
6
|
+
chainName?: ChainName;
|
|
7
|
+
};
|
|
8
|
+
export type ContractResourceReferenceFields<Resource extends TypedResource> = {
|
|
9
|
+
readonly [Type in Extract<Resource, BaseContractResource>['type']]?: {
|
|
10
|
+
readonly [Field in keyof Extract<Resource, {
|
|
11
|
+
type: Type;
|
|
12
|
+
}>]?: Resource['type'];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const checkContractResourceReferences: <Resource extends TypedResource>(fields: ContractResourceReferenceFields<Resource>) => ({ resources }: {
|
|
16
|
+
resources: readonly Resource[];
|
|
17
|
+
}, ctx: z.RefinementCtx) => void;
|
|
18
|
+
export declare const checkUniqueResourceIds: ({ resources }: {
|
|
19
|
+
resources: readonly BaseResource[];
|
|
20
|
+
}, ctx: z.RefinementCtx) => void;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=resourceListChecks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceListChecks.d.ts","sourceRoot":"","sources":["../../src/deploy/resourceListChecks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EACH,KAAK,oBAAoB,EACzB,KAAK,YAAY,EAGpB,MAAM,aAAa,CAAC;AAErB,KAAK,aAAa,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAK5E,MAAM,MAAM,+BAA+B,CAAC,QAAQ,SAAS,aAAa,IAAI;IAC1E,QAAQ,EAAE,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QACjE,QAAQ,EAAE,KAAK,IAAI,MAAM,OAAO,CAAC,QAAQ,EAAE;YAAE,IAAI,EAAE,IAAI,CAAA;SAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC;KACjF;CACJ,CAAC;AAEF,eAAO,MAAM,+BAA+B,GACvC,QAAQ,SAAS,aAAa,UAAU,+BAA+B,CAAC,QAAQ,CAAC,qBAClE;IAAE,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAA;CAAE,OAAO,CAAC,CAAC,aAAa,SA8BvE,CAAC;AAEN,eAAO,MAAM,sBAAsB,kBAChB;IAAE,SAAS,EAAE,SAAS,YAAY,EAAE,CAAA;CAAE,OAChD,CAAC,CAAC,aAAa,SAevB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { checkContractResourceReferences, checkUniqueResourceIds } from '../2WVSRK2J.js';
|
|
2
|
+
import '../P4N5LZEM.js';
|
|
3
|
+
import '../ZCFXJFGI.js';
|
|
4
|
+
import '../I2SFLHPT.js';
|
|
5
|
+
import '../VUOMXK5T.js';
|
|
6
|
+
//# sourceMappingURL=resourceListChecks.js.map
|
|
7
|
+
//# sourceMappingURL=resourceListChecks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"resourceListChecks.js"}
|
|
@@ -36,6 +36,7 @@ export type BaseResource = z.infer<typeof baseResourceSchema>;
|
|
|
36
36
|
export type BaseMeshResource = z.infer<typeof baseMeshResourceSchema>;
|
|
37
37
|
export type BaseContractResource = z.infer<typeof baseContractResourceSchema>;
|
|
38
38
|
export type BaseIntrinsicAddressContractResource = z.infer<ReturnType<typeof withIntrinsicAddress>>;
|
|
39
|
+
export declare const CONTRACT_RESOURCE_REFERENCE_PREFIX = "#C_REF:";
|
|
39
40
|
export type ContractResourceReference<T extends BaseContractResource = BaseContractResource> = {
|
|
40
41
|
/** WARNING: these fields are not present at runtime */
|
|
41
42
|
__resourceReferenceType: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/deploy/resources.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGlG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAI7D,eAAO,MAAM,kBAAkB;;sBAEK,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,UAAU;iBAC5D,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;iBAGj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,SAAS,OAAO,kBAAkB,YACzE,QAAQ,KACL,sBAAsB,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/deploy/resources.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { baseContractResourceSchema, baseMeshResourceSchema, baseResourceSchema, contractResourceReferenceSchema, contractResourceReferenceSchemaFor, createResolvedResourceSchema, extractContractResourceReferences, extractIdFromContractResourceReference, extractIdFromMeshResourceReference, extractMeshResourceReferences, meshResourceReferenceSchema, meshResourceReferenceSchemaFor, resolvedContractResourceReferenceSchema, resolvedMeshResourceReferenceSchema, withIntrinsicAddress } from '../
|
|
1
|
+
export { CONTRACT_RESOURCE_REFERENCE_PREFIX, baseContractResourceSchema, baseMeshResourceSchema, baseResourceSchema, contractResourceReferenceSchema, contractResourceReferenceSchemaFor, createResolvedResourceSchema, extractContractResourceReferences, extractIdFromContractResourceReference, extractIdFromMeshResourceReference, extractMeshResourceReferences, meshResourceReferenceSchema, meshResourceReferenceSchemaFor, resolvedContractResourceReferenceSchema, resolvedMeshResourceReferenceSchema, withIntrinsicAddress } from '../P4N5LZEM.js';
|
|
2
2
|
import '../ZCFXJFGI.js';
|
|
3
3
|
import '../I2SFLHPT.js';
|
|
4
4
|
import '../VUOMXK5T.js';
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import './FHFFHJG6.js';
|
|
2
2
|
export { createWiringPlannerActivityFactorySchema } from './VFXMU3QC.js';
|
|
3
3
|
export { plannerBatchSizeArgSchema, plannerBatchSizeSchema, wireWorkflowChainResultSchema, wireWorkflowChainStateSchema, wireWorkflowFilterArgsSchema, wireWorkflowOrchestratorResultSchema, wireWorkflowOrchestratorStateSchema } from './SYVNYFS3.js';
|
|
4
|
+
export { PLANNER_CONCURRENCY } from './DIVNFLSP.js';
|
|
5
|
+
export { buildChainsFilter, buildOperationsFilter, filterChainsArgSchema, filterOperationsArgSchema, involvedChainFilter } from './LZEC4T5F.js';
|
|
4
6
|
import './SBZPLPCB.js';
|
|
5
7
|
export { generateThrowCreateSetRoleTransactions, generateThrowHasRole, generateThrowRoleManagement } from './45LWGDPP.js';
|
|
6
8
|
export { createAcceptAdminTransferTransactionsSchema, createAcceptAdminTransferTransactionsWithSpecializedInputSchema, createBeginAdminTransferTransactionsSchema, createBeginAdminTransferTransactionsWithSpecializedInputSchema, createSetRoleTransactionsWithSpecializedInputSchema, generateAdmin2StepSchemas, generateCreateSetRoleTransactionsSchema, generateEnumerableRoleManagementSchemas, generateGetRoleMembersSchema, generateHasRoleSchema, generateRoleManagementSchemas, getPendingAdminSchema, getPendingAdminWithSpecializedInputSchema, getRoleMembersWithSpecializedInputSchema, hasRoleWithSpecializedInputSchema } from './JBKF52KU.js';
|
|
7
9
|
export { BaseContractRole } from './JSK5QSWJ.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export { createResourceBuilder } from './BHJ6M5FG.js';
|
|
10
|
+
import './KU2DVBJJ.js';
|
|
11
|
+
export { createResourceBuilder } from './N24RNS6I.js';
|
|
11
12
|
export { isCompositeResourceIdInScope } from './JYX6YDJT.js';
|
|
12
|
-
export {
|
|
13
|
+
export { checkContractResourceReferences, checkUniqueResourceIds } from './2WVSRK2J.js';
|
|
14
|
+
export { CONTRACT_RESOURCE_REFERENCE_PREFIX, baseContractResourceSchema, baseMeshResourceSchema, baseResourceSchema, contractResourceReferenceSchema, contractResourceReferenceSchemaFor, createResolvedResourceSchema, extractContractResourceReferences, extractIdFromContractResourceReference, extractIdFromMeshResourceReference, extractMeshResourceReferences, meshResourceReferenceSchema, meshResourceReferenceSchemaFor, resolvedContractResourceReferenceSchema, resolvedMeshResourceReferenceSchema, withIntrinsicAddress } from './P4N5LZEM.js';
|
|
13
15
|
import './ZCFXJFGI.js';
|
|
14
16
|
export { EvmProxyType, ProxyType, SEPARATE_PROXY_ADMIN_TYPES, TUP_PROXY_TYPES, UUPS_PROXY_TYPES, UpgradeType, assertUpgradability, codeUpgradeableConfigSchema, initializeDataResultSchema, isTupProxy, isUupsProxy, notUpgradeableConfigSchema, proxyConfigSchema, proxyTypeSchema, requiresSeparateProxyAdminDeploy, upgradeTypeSchema, upgradeableConfigSchema, weakAssertUpgradability } from './I2SFLHPT.js';
|
|
15
17
|
export { deployWorkflowChainStateSchema, deployWorkflowOrchestratorStateSchema, extractVerificationArtifactBaseArgsSchema } from './MQAXH3BY.js';
|
|
16
|
-
export { buildChainsFilter, buildOperationsFilter, filterChainsArgSchema, filterOperationsArgSchema, involvedChainFilter } from './LZEC4T5F.js';
|
|
17
18
|
import './CJ2YJ43Z.js';
|
|
18
19
|
export { assertAccessControlConfig, findAccessControlIssues } from './NLSPXSU5.js';
|
|
19
20
|
export { getContractRoleCatalog } from './PI7HPVZS.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/dw-model",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.104",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,18 +16,18 @@
|
|
|
16
16
|
"dist/**/*"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@layerzerolabs/common-chain-model": "1.2.
|
|
20
|
-
"@layerzerolabs/common-error-utils": "1.2.
|
|
21
|
-
"@layerzerolabs/gated-transaction": "1.2.
|
|
22
|
-
"@layerzerolabs/layerzero-definitions": "1.2.
|
|
23
|
-
"@layerzerolabs/typescript-utils": "1.2.
|
|
24
|
-
"@layerzerolabs/zod-utils": "1.2.
|
|
19
|
+
"@layerzerolabs/common-chain-model": "1.2.104",
|
|
20
|
+
"@layerzerolabs/common-error-utils": "1.2.104",
|
|
21
|
+
"@layerzerolabs/gated-transaction": "1.2.104",
|
|
22
|
+
"@layerzerolabs/layerzero-definitions": "1.2.104",
|
|
23
|
+
"@layerzerolabs/typescript-utils": "1.2.104",
|
|
24
|
+
"@layerzerolabs/zod-utils": "1.2.104",
|
|
25
25
|
"zod": "4.3.5"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@layerzerolabs/chain-utils": "1.2.
|
|
29
|
-
"@layerzerolabs/tsup-configuration": "1.2.
|
|
30
|
-
"@layerzerolabs/typescript-configuration": "1.2.
|
|
28
|
+
"@layerzerolabs/chain-utils": "1.2.104",
|
|
29
|
+
"@layerzerolabs/tsup-configuration": "1.2.104",
|
|
30
|
+
"@layerzerolabs/typescript-configuration": "1.2.104",
|
|
31
31
|
"tsup": "^8.4.0",
|
|
32
32
|
"vitest": "^4.1.10"
|
|
33
33
|
},
|
package/dist/7QV722N2.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/deploy/resources.ts"],"names":["baseResourceSchema","z","object","id","string","resourceBaseType","baseMeshResourceSchema","shape","literal","baseContractResourceSchema","chainName","chainNameSchema","upgradeConfig","upgradeableConfigSchema","optional","verifyContract","boolean","chainConfig","any","withIntrinsicAddress","resourceSchema","_INTRINSIC_normalizedAddress","normalizedHexSchema","extractIdFromContractResourceReference","ref","startsWith","slice","length","throwError","JSON","stringify","contractResourceReferenceSchema","meta","title","description","contractResourceDependencyForSchemaZodMetaIdIdx","contractResourceReferenceSchemaFor","_resource","resolvedContractResourceReferenceSchema","custom","meshResourceReferenceSchema","meshResourceDependencyForSchemaZodMetaIdIdx","meshResourceReferenceSchemaFor","extractIdFromMeshResourceReference","resolvedMeshResourceReferenceSchema","extractContractResourceReferences","resource","Object","entries","filter","extractMeshResourceReferences","createResolvedResourceSchema"],"mappings":";;;;;;;AASO,IAAMA,kBAAAA,GAAqBC,EAAEC,MAAAA,CAAO;AACvCC,EAAAA,EAAAA,EAAIF,EAAEG,MAAAA,EAAM;AACZC,EAAAA,gBAAAA,EAAkBJ,EAAEG,MAAAA;AACxB,CAAA;AAEO,IAAME,sBAAAA,GAAyBL,EAAEC,MAAAA,CAAO;AAC3C,EAAA,GAAGF,k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,CAAAA,CAAUG,OACrB,CAAC,GAAG9C,EAAAA,CAAAA,KAAQ,OAAOA,EAAAA,KAAO,QAAA,IAAYA,GAAGsB,UAAAA,CAAW,SAAA,CAAA,CAAA,EAFf,+BAAA;AAMtC,IAAM0B,4BAAAA,mBAA+B,MAAA,CAAA,CACxCL,QAAAA,KACCA,QAAAA,EAFuC,8BAAA","file":"7QV722N2.js","sourcesContent":["import z from 'zod';\n\nimport { normalizedHexSchema, type NormalizedHexString } from '@layerzerolabs/common-chain-model';\nimport { throwError } from '@layerzerolabs/common-error-utils';\nimport { chainNameSchema } from '@layerzerolabs/layerzero-definitions';\nimport type { IsAny } from '@layerzerolabs/typescript-utils';\n\nimport { upgradeableConfigSchema } from '../upgrade';\n\nexport const baseResourceSchema = z.object({\n id: z.string(), // account-unique ID for this resource\n resourceBaseType: z.string() as z.ZodString | z.ZodLiteral,\n});\n\nexport const baseMeshResourceSchema = z.object({\n ...baseResourceSchema.shape,\n resourceBaseType: z.literal('MESH'),\n});\n\nexport const baseContractResourceSchema = z.object({\n ...baseResourceSchema.shape,\n resourceBaseType: z.literal('CONTRACT'),\n chainName: chainNameSchema,\n upgradeConfig: upgradeableConfigSchema.optional(),\n verifyContract: z.boolean().optional(),\n\n chainConfig: z.any().optional(),\n});\n\nexport const withIntrinsicAddress = <T extends typeof baseContractResourceSchema>(\n resourceSchema: T,\n) =>\n z.object({\n ...resourceSchema.shape,\n _INTRINSIC_normalizedAddress: normalizedHexSchema,\n }) as unknown as T['shape'] extends infer Shape extends Readonly<Record<string, z.ZodType>>\n ? z.ZodObject<\n {\n [K in\n | keyof Shape\n | '_INTRINSIC_normalizedAddress']: K extends '_INTRINSIC_normalizedAddress'\n ? typeof normalizedHexSchema\n : K extends keyof Shape\n ? Shape[K]\n : never;\n },\n z.core.$strip\n >\n : never;\n\nexport type BaseResource = z.infer<typeof baseResourceSchema>;\nexport type BaseMeshResource = z.infer<typeof baseMeshResourceSchema>;\nexport type BaseContractResource = z.infer<typeof baseContractResourceSchema>;\nexport type BaseIntrinsicAddressContractResource = z.infer<ReturnType<typeof withIntrinsicAddress>>;\n\n// The actual expected runtime value for this type is #C_REF:${id}\nexport type ContractResourceReference<T extends BaseContractResource = BaseContractResource> = {\n /** WARNING: these fields are not present at runtime */\n __resourceReferenceType: T;\n ['__CONTRACT_RESOURCE_REFERENCE']: true;\n};\n\nexport const extractIdFromContractResourceReference = (ref: ContractResourceReference) =>\n ((ref as unknown as string).startsWith('#C_REF:') &&\n (ref as unknown as string).slice('#C_REF:'.length)) ||\n throwError(`Ref ${JSON.stringify(ref)} is not a contract resource ref`);\n\n// Use z.ZodType<BaseContractResource> because we want to allow unions\nexport type ContractResourceReferenceSchema<T extends z.ZodType<BaseContractResource>> = z.ZodType<\n ContractResourceReference<z.infer<T>>\n>;\n\nexport const contractResourceReferenceSchema: ContractResourceReferenceSchema<\n z.ZodType<BaseContractResource>\n // At runtime, we expect a string\n> = z.string().meta({\n id: 'contract-resource-dependency',\n title: 'Contract dependency to any',\n description: 'A reference to another contract resource (any)',\n}) as unknown as z.ZodType<ContractResourceReference>;\n\nlet contractResourceDependencyForSchemaZodMetaIdIdx = 0;\nexport const contractResourceReferenceSchemaFor = <T extends z.ZodType<BaseContractResource>>(\n // TODO: use resource parameter to generate a concrete schema\n _resource: T,\n): ContractResourceReferenceSchema<T> =>\n z.string().meta({\n id: `contract-resource-dependency-for-${++contractResourceDependencyForSchemaZodMetaIdIdx}`,\n // We can't generate this properly yet because this function needs more information\n // Will be fixed when we clean up the runtime dependency ID resolution\n title: 'Contract dependency to (unknown)',\n description: 'A reference to another contract resource (unknown)',\n }) as unknown as z.ZodType<ContractResourceReference<z.infer<T>>>;\n\nexport type ResolvedContractResourceReference<T extends BaseContractResource> = {\n id: string;\n resource: T;\n address: NormalizedHexString;\n};\n\nexport type ResolvedContractResourceReferenceSchema<T extends z.ZodType<BaseContractResource>> =\n z.ZodType<ResolvedContractResourceReference<z.infer<T>>>;\n\nexport const resolvedContractResourceReferenceSchema: ResolvedContractResourceReferenceSchema<any> =\n // TODO: replace with a concrete zod schema\n z.custom<ResolvedContractResourceReference<any>>();\n\n// The actual expected runtime value for this type is #M_REF:${id}\nexport type MeshResourceReference<T extends BaseMeshResource = BaseMeshResource> = {\n /** WARNING: these fields are not present at runtime */\n __resourceReferenceType: T;\n ['__MESH_RESOURCE_REFERENCE']: true;\n};\n\nexport type MeshResourceReferenceSchema<T extends typeof baseMeshResourceSchema> = z.ZodType<\n MeshResourceReference<z.infer<T>>\n>;\n\nexport const meshResourceReferenceSchema: MeshResourceReferenceSchema<\n typeof baseMeshResourceSchema\n> = z.string().meta({\n id: 'mesh-resource-dependency',\n title: 'Mesh dependency to any',\n description: 'A reference to another mesh resource (any)',\n}) as unknown as z.ZodType<MeshResourceReference>;\n\nlet meshResourceDependencyForSchemaZodMetaIdIdx = 0;\nexport const meshResourceReferenceSchemaFor = <T extends typeof baseMeshResourceSchema>(\n // TODO: use resource parameter to generate a concrete schema\n _resource: T,\n): MeshResourceReferenceSchema<T> =>\n z.string().meta({\n id: `mesh-resource-dependency-for-${++meshResourceDependencyForSchemaZodMetaIdIdx}`,\n title: 'Mesh dependency to (unknown)',\n description: 'A reference to another mesh resource (unknown)',\n }) as unknown as z.ZodType<MeshResourceReference<z.infer<T>>>;\n\nexport type ResolvedMeshResourceReference<T extends BaseMeshResource> = {\n id: string;\n resource: T;\n // TODO: is there any other resolved information we want to inject here?\n};\n\nexport const extractIdFromMeshResourceReference = (ref: MeshResourceReference) =>\n ((ref as unknown as string).startsWith('#M_REF:') &&\n (ref as unknown as string).slice('#M_REF:'.length)) ||\n throwError(`Ref ${JSON.stringify(ref)} is not a mesh resource ref`);\n\nexport type ResolvedMeshResourceReferenceSchema<T extends typeof baseMeshResourceSchema> =\n // TODO: replace with a concrete zod schema\n z.ZodType<ResolvedMeshResourceReference<z.infer<T>>>;\n\nexport const resolvedMeshResourceReferenceSchema: ResolvedMeshResourceReferenceSchema<any> =\n z.custom<ResolvedMeshResourceReference<any>>();\n\nexport type ResolvedResourceSchema<Resource extends typeof baseResourceSchema> = z.ZodObject<\n {\n [K in Exclude<\n keyof Resource['shape'],\n '_INTRINSIC_normalizedAddress'\n >]: Resource['shape'][K] extends infer R extends z.ZodType\n ? R extends z.ZodAny\n ? R\n : R extends z.ZodOptional<z.ZodAny>\n ? R\n : R extends ContractResourceReferenceSchema<infer I>\n ? ResolvedContractResourceReferenceSchema<I>\n : R extends z.ZodOptional<ContractResourceReferenceSchema<infer I>>\n ? z.ZodOptional<ResolvedContractResourceReferenceSchema<I>>\n : R extends MeshResourceReferenceSchema<infer I>\n ? ResolvedMeshResourceReferenceSchema<I>\n : R extends z.ZodOptional<MeshResourceReferenceSchema<infer I>>\n ? z.ZodOptional<ResolvedMeshResourceReferenceSchema<I>>\n : R\n : never;\n },\n z.core.$strip\n>;\n\nexport type ResolvedResource<Resource extends BaseResource> = {\n [K in Exclude<keyof Resource, '_INTRINSIC_normalizedAddress'>]: Resource[K] extends infer R\n ? R extends undefined\n ? R\n : IsAny<R> extends true\n ? R\n : IsAny<Exclude<R, undefined>> extends true\n ? R\n : R extends ContractResourceReference<infer I>\n ? ResolvedContractResourceReference<I>\n : R extends ContractResourceReference<infer I> | undefined\n ? ResolvedContractResourceReference<I> | undefined\n : R extends MeshResourceReference<infer I>\n ? ResolvedMeshResourceReference<I>\n : R extends MeshResourceReference<infer I> | undefined\n ? ResolvedMeshResourceReference<I> | undefined\n : R\n : never;\n};\n\nexport const extractContractResourceReferences = <Resource extends BaseResource>(\n resource: Resource,\n) =>\n Object.entries(resource).filter(\n ([, id]) => typeof id === 'string' && id.startsWith('#C_REF:'),\n ) as unknown as [prop: string, id: ContractResourceReference][];\n\nexport const extractMeshResourceReferences = <Resource extends BaseResource>(resource: Resource) =>\n Object.entries(resource).filter(\n ([, id]) => typeof id === 'string' && id.startsWith('#M_REF:'),\n ) as unknown as [prop: string, id: MeshResourceReference][];\n\n// TODO: implement runtime resolution — currently returns input schema as-is\nexport const createResolvedResourceSchema = <Resource extends typeof baseResourceSchema>(\n resource: Resource,\n) => resource as ResolvedResourceSchema<Resource>;\n"]}
|
package/dist/BHJ6M5FG.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/deploy/resourceBuilder.ts"],"names":["createResourceBuilder","_resourceSchema","resourceBaseType","type","args","resource","addressArg","_INTRINSIC_normalizedAddress","throwError","normalizedAddress","ref","id","build","Error"],"mappings":";;;AAwBO,IAAMA,qBAAAA,2BAKLC,eAAAA,EACA,EACIC,kBACAC,IAAAA,EAAI,KAMZ,IACOC,IAAAA,KAAAA;AAWH,EAAA,MAAMC,QAAAA,GAAWD,KAAK,CAAA,CAAA;AACtB,EAAA,IAAIF,qBAAqB,UAAA,EAAY;AAEjC,IAAA,MAAMI,UAAAA,GAAaF,KAAK,CAAA,CAAA;AAGxB,IAAA,MAAMG,+BACFD,UAAAA,IAAc,eAAA,IAAmBA,aAC3BE,UAAAA,CACI,CAAA,wEAAA,CAA0E,IAE9EF,UAAAA,EAAYG,iBAAAA;AAEtB,IAAA,OAAO;AACHC,MAAAA,GAAAA,kBAAK,MAAA,CAAA,MAAM,CAAA,OAAA,EAAUL,QAAAA,CAASM,EAAE,CAAA,CAAA,EAA3B,KAAA,CAAA;AACLC,MAAAA,KAAAA,kBAAO,MAAA,CAAA,OAAO;QACV,GAAGP,QAAAA;AACHF,QAAAA,IAAAA;AACAD,QAAAA,gBAAAA;AACAK,QAAAA;OACJ,CAAA,EALO,OAAA;AAMX,KAAA;AACJ,EAAA;AAEA,EAAA,IAAIL,qBAAqB,MAAA,EAAQ;AAC7B,IAAA,OAAO;AACHQ,MAAAA,GAAAA,kBAAK,MAAA,CAAA,MAAM,CAAA,OAAA,EAAUL,QAAAA,CAASM,EAAE,CAAA,CAAA,EAA3B,KAAA,CAAA;AACLC,MAAAA,KAAAA,kBAAO,MAAA,CAAA,OAAO;QAAE,GAAGP,QAAAA;AAAUF,QAAAA,IAAAA;AAAMD,QAAAA;OAAiB,CAAA,EAA7C,OAAA;AACX,KAAA;AACJ,EAAA;AAEA,EAAA,MAAM,IAAIW,KAAAA,CAAM,CAAA,+BAAA,EAAkCX,gBAAAA,CAAAA,CAAAA,CAAmB,CAAA;AACzE,CAAA,EAzDA,uBAAA","file":"BHJ6M5FG.js","sourcesContent":["import type { z } from 'zod';\n\nimport type { normalizedHexSchema } from '@layerzerolabs/common-chain-model';\nimport { throwError } from '@layerzerolabs/common-error-utils';\nimport type { NormalizedHexString } from '@layerzerolabs/typescript-utils';\n\nimport type {\n BaseContractResource,\n BaseMeshResource,\n baseResourceSchema,\n ContractResourceReference,\n MeshResourceReference,\n} from './resources';\n\nexport type ContractResourceBuilderResult<Resource extends BaseContractResource> = {\n ref: () => ContractResourceReference<Resource>;\n build: () => Resource;\n};\n\nexport type MeshResourceBuilderResult<Resource extends BaseMeshResource> = {\n ref: () => MeshResourceReference<Resource>;\n build: () => Resource;\n};\n\nexport const createResourceBuilder =\n <\n T extends typeof baseResourceSchema,\n U extends Omit<z.infer<T>, 'type' | 'resourceBaseType' | '_INTRINSIC_normalizedAddress'>,\n >(\n _resourceSchema: T,\n {\n resourceBaseType,\n type,\n }: {\n resourceBaseType: 'CONTRACT' | 'MESH';\n type: T['shape'] extends { type: z.ZodType<infer Type> } ? Type : undefined;\n },\n ) =>\n (\n ...args: T extends z.ZodObject<{ _INTRINSIC_normalizedAddress: typeof normalizedHexSchema }>\n ? [\n resource: U,\n address: { nativeAddress: string } | { normalizedAddress: NormalizedHexString },\n ]\n : [resource: U]\n ): z.infer<T> extends BaseContractResource\n ? ContractResourceBuilderResult<z.infer<T>>\n : z.infer<T> extends BaseMeshResource\n ? MeshResourceBuilderResult<z.infer<T>>\n : never => {\n const resource = args[0];\n if (resourceBaseType === 'CONTRACT') {\n // cast because ts can't narrow T\n const addressArg = args[1 as number] as unknown as\n | { nativeAddress: string }\n | { normalizedAddress: NormalizedHexString };\n const _INTRINSIC_normalizedAddress: NormalizedHexString | undefined =\n addressArg && 'nativeAddress' in addressArg\n ? throwError(\n `Native address is currently not supported, use normalizedAddress instead`,\n )\n : addressArg?.normalizedAddress;\n\n return {\n ref: () => `#C_REF:${resource.id}` as any,\n build: () => ({\n ...resource,\n type,\n resourceBaseType,\n _INTRINSIC_normalizedAddress,\n }),\n } satisfies ContractResourceBuilderResult<any> as any;\n }\n\n if (resourceBaseType === 'MESH') {\n return {\n ref: () => `#M_REF:${resource.id}` as any,\n build: () => ({ ...resource, type, resourceBaseType }),\n } satisfies MeshResourceBuilderResult<any> as any;\n }\n\n throw new Error(`Can't handle resourceBaseType \"${resourceBaseType}\"`);\n };\n"]}
|
package/dist/V2SO4JCF.js
DELETED
package/dist/V2SO4JCF.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"V2SO4JCF.js"}
|