@latticexyz/world 2.0.13-main-978df93f2 → 2.0.13-main-e0c9eaaf2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import{a as c}from"./chunk-E5NQ4W4F.js";import{extendedScope as E,get as A,resolveTable as _,validateTable as N,mergeIfUndefined as a,resolveStore as C,hasOwnKey as W,validateStore as M}from"@latticexyz/store/config/v2";var i={root:!1,args:[],artifactPath:void 0},t={worldInterfaceName:"IWorld",worldgenDirectory:"world",worldImportPath:"@latticexyz/world/src/"},r={customWorldContract:void 0,postDeployScript:"PostDeploy",deploysDirectory:"./deploys",worldsFile:"./worlds.json",upgradeableWorldImplementation:!1},n={systems:{},tables:{},excludeSystems:[],modules:[],codegen:t,deploy:r};import{mapObject as D}from"@latticexyz/common/utils";import{mergeIfUndefined as g}from"@latticexyz/store/config/v2";function y(e){return D(e,s=>g(s,c))}import{validateTables as k,isObject as b,hasOwnKey as I}from"@latticexyz/store/config/v2";function U(e,s){I(e,"tables")&&k(e.tables,s)}function f(e,s){if(!b(e))throw new Error(`Expected namespaces, received ${JSON.stringify(e)}`);for(let p of Object.values(e))U(p,s)}import{isObject as L,mergeIfUndefined as w}from"@latticexyz/store/config/v2";function S(e){return L(e)?w(e,t):t}import{mergeIfUndefined as F,isObject as O}from"@latticexyz/store/config/v2";function u(e){return O(e)?F(e,r):r}function P(e){let s=E(e);M(e),W(e,"namespaces")&&f(e.namespaces,s)}function G(e){let s=E(e),p=e.namespaces??{},x=Object.fromEntries(Object.entries(p).map(([o,T])=>Object.entries(T.tables??{}).map(([l,m])=>(N(m,s),[`${o}__${l}`,_(a(m,{namespace:o,name:l}),s)]))).flat()),d=C(e),v=(e.modules??n.modules).map(o=>a(o,i));return a({...d,tables:{...d.tables,...x},codegen:a(d.codegen,S(e.codegen)),deploy:u(e.deploy),systems:y(e.systems??n.systems),excludeSystems:A(e,"excludeSystems"),modules:v},n)}function fe(e){return P(e),G(e)}export{P as a,G as b,fe as c};
2
+ //# sourceMappingURL=chunk-AHES67HT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../ts/config/v2/world.ts","../ts/config/v2/defaults.ts","../ts/config/v2/systems.ts","../ts/config/v2/namespaces.ts","../ts/config/v2/codegen.ts","../ts/config/v2/deploy.ts"],"sourcesContent":["import { ErrorMessage, conform, evaluate, narrow } from \"@arktype/util\";\nimport {\n UserTypes,\n extendedScope,\n get,\n resolveTable,\n validateTable,\n mergeIfUndefined,\n validateTables,\n resolveStore,\n Store,\n hasOwnKey,\n validateStore,\n} from \"@latticexyz/store/config/v2\";\nimport { SystemsInput, WorldInput } from \"./input\";\nimport { CONFIG_DEFAULTS, MODULE_DEFAULTS } from \"./defaults\";\nimport { Tables } from \"@latticexyz/store/internal\";\nimport { resolveSystems } from \"./systems\";\nimport { resolveNamespacedTables, validateNamespaces } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\n\nexport type validateWorld<world> = {\n readonly [key in keyof world]: key extends \"tables\"\n ? validateTables<world[key], extendedScope<world>>\n : key extends \"userTypes\"\n ? UserTypes\n : key extends \"enums\"\n ? narrow<world[key]>\n : key extends \"namespaces\"\n ? // ? validateNamespaces<world[key], extendedScope<world>>\n ErrorMessage<`Namespaces config will be enabled soon.`>\n : key extends keyof WorldInput\n ? conform<world[key], WorldInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid World config option.`>;\n};\n\nexport function validateWorld(world: unknown): asserts world is WorldInput {\n const scope = extendedScope(world);\n validateStore(world);\n\n if (hasOwnKey(world, \"namespaces\")) {\n validateNamespaces(world.namespaces, scope);\n }\n}\n\nexport type resolveWorld<world> = evaluate<\n resolveStore<world> &\n mergeIfUndefined<\n { tables: resolveNamespacedTables<world> } & Omit<\n {\n [key in keyof world]: key extends \"systems\"\n ? resolveSystems<world[key] & SystemsInput>\n : key extends \"deploy\"\n ? resolveDeploy<world[key]>\n : key extends \"codegen\"\n ? resolveCodegen<world[key]>\n : world[key];\n },\n \"namespaces\" | keyof Store\n >,\n CONFIG_DEFAULTS\n >\n>;\n\nexport function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world> {\n const scope = extendedScope(world);\n const namespaces = world.namespaces ?? {};\n\n const resolvedNamespacedTables = Object.fromEntries(\n Object.entries(namespaces)\n .map(([namespaceKey, namespace]) =>\n Object.entries(namespace.tables ?? {}).map(([tableKey, table]) => {\n validateTable(table, scope);\n return [\n `${namespaceKey}__${tableKey}`,\n resolveTable(mergeIfUndefined(table, { namespace: namespaceKey, name: tableKey }), scope),\n ];\n }),\n )\n .flat(),\n ) as Tables;\n\n const resolvedStore = resolveStore(world);\n\n const modules = (world.modules ?? CONFIG_DEFAULTS.modules).map((mod) => mergeIfUndefined(mod, MODULE_DEFAULTS));\n\n return mergeIfUndefined(\n {\n ...resolvedStore,\n tables: { ...resolvedStore.tables, ...resolvedNamespacedTables },\n codegen: mergeIfUndefined(resolvedStore.codegen, resolveCodegen(world.codegen)),\n deploy: resolveDeploy(world.deploy),\n systems: resolveSystems(world.systems ?? CONFIG_DEFAULTS.systems),\n excludeSystems: get(world, \"excludeSystems\"),\n modules,\n },\n CONFIG_DEFAULTS,\n ) as never;\n}\n\nexport function defineWorld<const world>(world: validateWorld<world>): resolveWorld<world> {\n validateWorld(world);\n return resolveWorld(world) as never;\n}\n","import { CodegenInput, DeployInput, ModuleInput, SystemInput, WorldInput } from \"./input\";\n\nexport const SYSTEM_DEFAULTS = {\n registerFunctionSelectors: true,\n openAccess: true,\n accessList: [],\n} as const satisfies SystemInput;\n\nexport type SYSTEM_DEFAULTS = typeof SYSTEM_DEFAULTS;\n\nexport const MODULE_DEFAULTS = {\n root: false,\n args: [],\n artifactPath: undefined,\n} as const satisfies Pick<ModuleInput, \"root\" | \"args\" | \"artifactPath\">;\n\nexport type MODULE_DEFAULTS = typeof MODULE_DEFAULTS;\n\nexport const CODEGEN_DEFAULTS = {\n worldInterfaceName: \"IWorld\",\n worldgenDirectory: \"world\",\n worldImportPath: \"@latticexyz/world/src/\",\n} as const satisfies CodegenInput;\n\nexport type CODEGEN_DEFAULTS = typeof CODEGEN_DEFAULTS;\n\nexport const DEPLOY_DEFAULTS = {\n customWorldContract: undefined,\n postDeployScript: \"PostDeploy\",\n deploysDirectory: \"./deploys\",\n worldsFile: \"./worlds.json\",\n upgradeableWorldImplementation: false,\n} as const satisfies DeployInput;\n\nexport type DEPLOY_DEFAULTS = typeof DEPLOY_DEFAULTS;\n\nexport const CONFIG_DEFAULTS = {\n systems: {},\n tables: {},\n excludeSystems: [],\n modules: [],\n codegen: CODEGEN_DEFAULTS,\n deploy: DEPLOY_DEFAULTS,\n} as const satisfies WorldInput;\n\nexport type CONFIG_DEFAULTS = typeof CONFIG_DEFAULTS;\n","import { mapObject } from \"@latticexyz/common/utils\";\nimport { SYSTEM_DEFAULTS } from \"../defaults\";\nimport { SystemsInput } from \"./input\";\nimport { mergeIfUndefined } from \"@latticexyz/store/config/v2\";\n\nexport type resolveSystems<systems extends SystemsInput> = {\n [system in keyof systems]: mergeIfUndefined<systems[system], typeof SYSTEM_DEFAULTS>;\n};\n\nexport function resolveSystems<systems extends SystemsInput>(systems: systems): resolveSystems<systems> {\n return mapObject(systems, (system) => mergeIfUndefined(system, SYSTEM_DEFAULTS));\n}\n","import {\n Scope,\n AbiTypeScope,\n validateTables,\n isObject,\n hasOwnKey,\n resolveTable,\n mergeIfUndefined,\n extendedScope,\n getPath,\n} from \"@latticexyz/store/config/v2\";\nimport { NamespaceInput, NamespacesInput } from \"./input\";\nimport { ErrorMessage, conform } from \"@arktype/util\";\n\nexport type namespacedTableKeys<world> = world extends { namespaces: infer namespaces }\n ? {\n [k in keyof namespaces]: namespaces[k] extends { tables: infer tables }\n ? `${k & string}__${keyof tables & string}`\n : never;\n }[keyof namespaces]\n : never;\n\nexport type validateNamespace<namespace, scope extends Scope = AbiTypeScope> = {\n readonly [key in keyof namespace]: key extends \"tables\"\n ? validateTables<namespace[key], scope>\n : key extends keyof NamespaceInput\n ? conform<namespace[key], NamespaceInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid namespace config option.`>;\n};\n\nexport function validateNamespace<scope extends Scope = AbiTypeScope>(\n namespace: unknown,\n scope: scope,\n): asserts namespace is NamespaceInput {\n if (hasOwnKey(namespace, \"tables\")) {\n validateTables(namespace.tables, scope);\n }\n}\n\nexport type validateNamespaces<namespaces, scope extends Scope = AbiTypeScope> = {\n [namespace in keyof namespaces]: validateNamespace<namespaces[namespace], scope>;\n};\n\nexport function validateNamespaces<scope extends Scope = AbiTypeScope>(\n namespaces: unknown,\n scope: scope,\n): asserts namespaces is NamespacesInput {\n if (!isObject(namespaces)) {\n throw new Error(`Expected namespaces, received ${JSON.stringify(namespaces)}`);\n }\n for (const namespace of Object.values(namespaces)) {\n validateNamespace(namespace, scope);\n }\n}\n\nexport type resolveNamespacedTables<world> = \"namespaces\" extends keyof world\n ? {\n readonly [key in namespacedTableKeys<world>]: key extends `${infer namespace}__${infer table}`\n ? resolveTable<\n mergeIfUndefined<\n getPath<world, [\"namespaces\", namespace, \"tables\", table]>,\n { name: table; namespace: namespace }\n >,\n extendedScope<world>\n >\n : never;\n }\n : {};\n","import { isObject, mergeIfUndefined } from \"@latticexyz/store/config/v2\";\nimport { CODEGEN_DEFAULTS } from \"./defaults\";\n\nexport type resolveCodegen<codegen> = codegen extends {}\n ? mergeIfUndefined<codegen, CODEGEN_DEFAULTS>\n : CODEGEN_DEFAULTS;\n\nexport function resolveCodegen<codegen>(codegen: codegen): resolveCodegen<codegen> {\n return (isObject(codegen) ? mergeIfUndefined(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS) as never;\n}\n","import { mergeIfUndefined, isObject } from \"@latticexyz/store/config/v2\";\nimport { DEPLOY_DEFAULTS } from \"./defaults\";\n\nexport type resolveDeploy<deploy> = deploy extends {} ? mergeIfUndefined<deploy, DEPLOY_DEFAULTS> : DEPLOY_DEFAULTS;\n\nexport function resolveDeploy<deploy>(deploy: deploy): resolveDeploy<deploy> {\n return (isObject(deploy) ? mergeIfUndefined(deploy, DEPLOY_DEFAULTS) : DEPLOY_DEFAULTS) as never;\n}\n"],"mappings":"wCACA,OAEE,iBAAAA,EACA,OAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,oBAAAC,EAEA,gBAAAC,EAEA,aAAAC,EACA,iBAAAC,MACK,8BCHA,IAAMC,EAAkB,CAC7B,KAAM,GACN,KAAM,CAAC,EACP,aAAc,MAChB,EAIaC,EAAmB,CAC9B,mBAAoB,SACpB,kBAAmB,QACnB,gBAAiB,wBACnB,EAIaC,EAAkB,CAC7B,oBAAqB,OACrB,iBAAkB,aAClB,iBAAkB,YAClB,WAAY,gBACZ,+BAAgC,EAClC,EAIaC,EAAkB,CAC7B,QAAS,CAAC,EACV,OAAQ,CAAC,EACT,eAAgB,CAAC,EACjB,QAAS,CAAC,EACV,QAASF,EACT,OAAQC,CACV,EC3CA,OAAS,aAAAE,MAAiB,2BAG1B,OAAS,oBAAAC,MAAwB,8BAM1B,SAASC,EAA6CC,EAA2C,CACtG,OAAOC,EAAUD,EAAUE,GAAWJ,EAAiBI,EAAQC,CAAe,CAAC,CACjF,CCXA,OAGE,kBAAAC,EACA,YAAAC,EACA,aAAAC,MAKK,8BAoBA,SAASC,EACdC,EACAC,EACqC,CACjCH,EAAUE,EAAW,QAAQ,GAC/BJ,EAAeI,EAAU,OAAQC,CAAK,CAE1C,CAMO,SAASC,EACdC,EACAF,EACuC,CACvC,GAAI,CAACJ,EAASM,CAAU,EACtB,MAAM,IAAI,MAAM,iCAAiC,KAAK,UAAUA,CAAU,GAAG,EAE/E,QAAWH,KAAa,OAAO,OAAOG,CAAU,EAC9CJ,EAAkBC,EAAWC,CAAK,CAEtC,CCrDA,OAAS,YAAAG,EAAU,oBAAAC,MAAwB,8BAOpC,SAASC,EAAwBC,EAA2C,CACjF,OAAQC,EAASD,CAAO,EAAIE,EAAiBF,EAASG,CAAgB,EAAIA,CAC5E,CCTA,OAAS,oBAAAC,EAAkB,YAAAC,MAAgB,8BAKpC,SAASC,EAAsBC,EAAuC,CAC3E,OAAQC,EAASD,CAAM,EAAIE,EAAiBF,EAAQG,CAAe,EAAIA,CACzE,CL8BO,SAASC,EAAcC,EAA6C,CACzE,IAAMC,EAAQC,EAAcF,CAAK,EACjCG,EAAcH,CAAK,EAEfI,EAAUJ,EAAO,YAAY,GAC/BK,EAAmBL,EAAM,WAAYC,CAAK,CAE9C,CAqBO,SAASK,EAA6CN,EAAmC,CAC9F,IAAMC,EAAQC,EAAcF,CAAK,EAC3BO,EAAaP,EAAM,YAAc,CAAC,EAElCQ,EAA2B,OAAO,YACtC,OAAO,QAAQD,CAAU,EACtB,IAAI,CAAC,CAACE,EAAcC,CAAS,IAC5B,OAAO,QAAQA,EAAU,QAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAACC,EAAUC,CAAK,KAC1DC,EAAcD,EAAOX,CAAK,EACnB,CACL,GAAGQ,MAAiBE,IACpBG,EAAaC,EAAiBH,EAAO,CAAE,UAAWH,EAAc,KAAME,CAAS,CAAC,EAAGV,CAAK,CAC1F,EACD,CACH,EACC,KAAK,CACV,EAEMe,EAAgBC,EAAajB,CAAK,EAElCkB,GAAWlB,EAAM,SAAWmB,EAAgB,SAAS,IAAKC,GAAQL,EAAiBK,EAAKC,CAAe,CAAC,EAE9G,OAAON,EACL,CACE,GAAGC,EACH,OAAQ,CAAE,GAAGA,EAAc,OAAQ,GAAGR,CAAyB,EAC/D,QAASO,EAAiBC,EAAc,QAASM,EAAetB,EAAM,OAAO,CAAC,EAC9E,OAAQuB,EAAcvB,EAAM,MAAM,EAClC,QAASwB,EAAexB,EAAM,SAAWmB,EAAgB,OAAO,EAChE,eAAgBM,EAAIzB,EAAO,gBAAgB,EAC3C,QAAAkB,CACF,EACAC,CACF,CACF,CAEO,SAASO,GAAyB1B,EAAkD,CACzF,OAAAD,EAAcC,CAAK,EACZM,EAAaN,CAAK,CAC3B","names":["extendedScope","get","resolveTable","validateTable","mergeIfUndefined","resolveStore","hasOwnKey","validateStore","MODULE_DEFAULTS","CODEGEN_DEFAULTS","DEPLOY_DEFAULTS","CONFIG_DEFAULTS","mapObject","mergeIfUndefined","resolveSystems","systems","mapObject","system","SYSTEM_DEFAULTS","validateTables","isObject","hasOwnKey","validateNamespace","namespace","scope","validateNamespaces","namespaces","isObject","mergeIfUndefined","resolveCodegen","codegen","isObject","mergeIfUndefined","CODEGEN_DEFAULTS","mergeIfUndefined","isObject","resolveDeploy","deploy","isObject","mergeIfUndefined","DEPLOY_DEFAULTS","validateWorld","world","scope","extendedScope","validateStore","hasOwnKey","validateNamespaces","resolveWorld","namespaces","resolvedNamespacedTables","namespaceKey","namespace","tableKey","table","validateTable","resolveTable","mergeIfUndefined","resolvedStore","resolveStore","modules","CONFIG_DEFAULTS","mod","MODULE_DEFAULTS","resolveCodegen","resolveDeploy","resolveSystems","get","defineWorld"]}
@@ -1,2 +1,2 @@
1
- import{c as e}from"./chunk-UMWFUO6H.js";var a=e({codegen:{worldImportPath:"../../",worldgenDirectory:"interfaces",worldInterfaceName:"IBaseWorld"},namespace:"world",userTypes:{ResourceId:{filePath:"@latticexyz/store/src/ResourceId.sol",type:"bytes32"}},tables:{NamespaceOwner:{schema:{namespaceId:"ResourceId",owner:"address"},key:["namespaceId"]},ResourceAccess:{schema:{resourceId:"ResourceId",caller:"address",access:"bool"},key:["resourceId","caller"]},InstalledModules:{schema:{moduleAddress:"address",argumentsHash:"bytes32",isInstalled:"bool"},key:["moduleAddress","argumentsHash"]},UserDelegationControl:{schema:{delegator:"address",delegatee:"address",delegationControlId:"ResourceId"},key:["delegator","delegatee"]},NamespaceDelegationControl:{schema:{namespaceId:"ResourceId",delegationControlId:"ResourceId"},key:["namespaceId"]},Balances:{schema:{namespaceId:"ResourceId",balance:"uint256"},key:["namespaceId"]},Systems:{schema:{systemId:"ResourceId",system:"address",publicAccess:"bool"},key:["systemId"],codegen:{dataStruct:!1}},SystemRegistry:{schema:{system:"address",systemId:"ResourceId"},key:["system"]},SystemHooks:{schema:{systemId:"ResourceId",value:"bytes21[]"},key:["systemId"]},FunctionSelectors:{schema:{worldFunctionSelector:"bytes4",systemId:"ResourceId",systemFunctionSelector:"bytes4"},key:["worldFunctionSelector"],codegen:{dataStruct:!1}},FunctionSignatures:{type:"offchainTable",schema:{functionSelector:"bytes4",functionSignature:"string"},key:["functionSelector"]},InitModuleAddress:{schema:{value:"address"},key:[]}},excludeSystems:["StoreRegistrationSystem"]});export{a};
2
- //# sourceMappingURL=chunk-ZUIIMEYR.js.map
1
+ import{c as e}from"./chunk-AHES67HT.js";var a=e({codegen:{worldImportPath:"../../",worldgenDirectory:"interfaces",worldInterfaceName:"IBaseWorld"},namespace:"world",userTypes:{ResourceId:{filePath:"@latticexyz/store/src/ResourceId.sol",type:"bytes32"}},tables:{NamespaceOwner:{schema:{namespaceId:"ResourceId",owner:"address"},key:["namespaceId"]},ResourceAccess:{schema:{resourceId:"ResourceId",caller:"address",access:"bool"},key:["resourceId","caller"]},InstalledModules:{schema:{moduleAddress:"address",argumentsHash:"bytes32",isInstalled:"bool"},key:["moduleAddress","argumentsHash"]},UserDelegationControl:{schema:{delegator:"address",delegatee:"address",delegationControlId:"ResourceId"},key:["delegator","delegatee"]},NamespaceDelegationControl:{schema:{namespaceId:"ResourceId",delegationControlId:"ResourceId"},key:["namespaceId"]},Balances:{schema:{namespaceId:"ResourceId",balance:"uint256"},key:["namespaceId"]},Systems:{schema:{systemId:"ResourceId",system:"address",publicAccess:"bool"},key:["systemId"],codegen:{dataStruct:!1}},SystemRegistry:{schema:{system:"address",systemId:"ResourceId"},key:["system"]},SystemHooks:{schema:{systemId:"ResourceId",value:"bytes21[]"},key:["systemId"]},FunctionSelectors:{schema:{worldFunctionSelector:"bytes4",systemId:"ResourceId",systemFunctionSelector:"bytes4"},key:["worldFunctionSelector"],codegen:{dataStruct:!1}},FunctionSignatures:{type:"offchainTable",schema:{functionSelector:"bytes4",functionSignature:"string"},key:["functionSelector"]},InitModuleAddress:{schema:{value:"address"},key:[]}},excludeSystems:["StoreRegistrationSystem"]});export{a};
2
+ //# sourceMappingURL=chunk-MN3OGYI5.js.map
@@ -1,4 +1,4 @@
1
- export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-487f256a.js';
1
+ export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-d7197095.js';
2
2
  import { W as World, S as Systems } from '../dynamicResolution-1a0cabb0.js';
3
3
  export { C as Codegen, c as Deploy, M as Module, b as System } from '../dynamicResolution-1a0cabb0.js';
4
4
  import { conform } from '@arktype/util';
package/dist/config/v2.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as o,b as r,c as e}from"../chunk-UMWFUO6H.js";import"../chunk-E5NQ4W4F.js";import{a as f}from"../chunk-MTFNNV27.js";export{e as defineWorld,r as resolveWorld,o as validateWorld,f as worldToV1};
1
+ import{a as o,b as r,c as e}from"../chunk-AHES67HT.js";import"../chunk-E5NQ4W4F.js";import{a as f}from"../chunk-MTFNNV27.js";export{e as defineWorld,r as resolveWorld,o as validateWorld,f as worldToV1};
2
2
  //# sourceMappingURL=v2.js.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { validateTablesWithShorthands, extendedScope, Scope, AbiTypeScope, resolveTablesWithShorthands } from '@latticexyz/store/config/v2';
2
- import { v as validateWorld, a as validateNamespaces, r as resolveWorld, W as WorldWithShorthandsInput } from './world-487f256a.js';
2
+ import { v as validateWorld, a as validateNamespace, r as resolveWorld, W as WorldWithShorthandsInput } from './world-d7197095.js';
3
3
  export { W as World } from './dynamicResolution-1a0cabb0.js';
4
4
  import '@arktype/util';
5
5
  import './defaults-1be1ffd2.js';
@@ -13,7 +13,7 @@ type validateWorldWithShorthands<world> = {
13
13
  };
14
14
  type validateNamespacesWithShorthands<namespaces, scope extends Scope = AbiTypeScope> = {
15
15
  [namespace in keyof namespaces]: {
16
- [key in keyof namespaces[namespace]]: key extends "tables" ? validateTablesWithShorthands<namespaces[namespace][key], scope> : validateNamespaces<namespaces[namespace], scope>[key];
16
+ [key in keyof namespaces[namespace]]: key extends "tables" ? validateTablesWithShorthands<namespaces[namespace][key], scope> : validateNamespace<namespaces[namespace], scope>[key];
17
17
  };
18
18
  };
19
19
  type resolveWorldWithShorthands<world> = resolveWorld<{
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as d,b as l}from"./chunk-UMWFUO6H.js";import"./chunk-E5NQ4W4F.js";var W="event WorldDeployed(address indexed newContract, uint256 salt)",v="event HelloWorld(bytes32 indexed worldVersion)";import{mapObject as r}from"@latticexyz/common/utils";import{extendedScope as m,getPath as S,hasOwnKey as p,isObject as f,isTableShorthandInput as h,resolveTableShorthand as i,validateTablesWithShorthands as c}from"@latticexyz/store/config/v2";function k(e){let t=m(e);if(p(e,"tables")&&c(e.tables,t),p(e,"namespaces")&&f(e.namespaces))for(let s of Object.keys(e.namespaces))c(S(e.namespaces,[s,"tables"])??{},t)}function x(e){let t=m(e),s=r(e.tables??{},o=>h(o)?i(o,t):o),y=r(e.namespaces??{},o=>({...o,tables:r(o.tables??{},a=>h(a)?i(a,t):a)})),n={...e,tables:s,namespaces:y};return d(n),l(n)}function b(e){return k(e),x(e)}export{b as defineWorld,v as helloWorldEvent,W as worldDeployedEvent};
1
+ import{a as d,b as l}from"./chunk-AHES67HT.js";import"./chunk-E5NQ4W4F.js";var W="event WorldDeployed(address indexed newContract, uint256 salt)",v="event HelloWorld(bytes32 indexed worldVersion)";import{mapObject as r}from"@latticexyz/common/utils";import{extendedScope as m,getPath as S,hasOwnKey as p,isObject as f,isTableShorthandInput as h,resolveTableShorthand as i,validateTablesWithShorthands as c}from"@latticexyz/store/config/v2";function k(e){let t=m(e);if(p(e,"tables")&&c(e.tables,t),p(e,"namespaces")&&f(e.namespaces))for(let a of Object.keys(e.namespaces))c(S(e.namespaces,[a,"tables"])??{},t)}function x(e){let t=m(e),a=r(e.tables??{},o=>h(o)?i(o,t):o),y=r(e.namespaces??{},o=>({...o,tables:r(o.tables??{},s=>h(s)?i(s,t):s)})),n={...e,tables:a,namespaces:y};return d(n),l(n)}function b(e){return k(e),x(e)}export{b as defineWorld,v as helloWorldEvent,W as worldDeployedEvent};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../ts/worldEvents.ts","../ts/config/v2/worldWithShorthands.ts"],"sourcesContent":["// from WorldFactory\nexport const worldDeployedEvent = \"event WorldDeployed(address indexed newContract, uint256 salt)\";\n\n// from World\nexport const helloWorldEvent = \"event HelloWorld(bytes32 indexed worldVersion)\";\n","import { mapObject } from \"@latticexyz/common/utils\";\nimport {\n AbiTypeScope,\n Scope,\n extendedScope,\n getPath,\n hasOwnKey,\n isObject,\n isTableShorthandInput,\n resolveTableShorthand,\n resolveTablesWithShorthands,\n validateTablesWithShorthands,\n} from \"@latticexyz/store/config/v2\";\nimport { WorldWithShorthandsInput } from \"./input\";\nimport { validateNamespaces } from \"./namespaces\";\nimport { resolveWorld, validateWorld } from \"./world\";\n\nexport type resolveWorldWithShorthands<world> = resolveWorld<{\n [key in keyof world]: key extends \"tables\"\n ? resolveTablesWithShorthands<world[key], extendedScope<world>>\n : key extends \"namespaces\"\n ? {\n [namespaceKey in keyof world[key]]: {\n [namespaceProp in keyof world[key][namespaceKey]]: namespaceProp extends \"tables\"\n ? resolveTablesWithShorthands<world[key][namespaceKey][namespaceProp], extendedScope<world>>\n : world[key][namespaceKey][namespaceProp];\n };\n }\n : world[key];\n}>;\n\nexport type validateWorldWithShorthands<world> = {\n [key in keyof world]: key extends \"tables\"\n ? validateTablesWithShorthands<world[key], extendedScope<world>>\n : key extends \"namespaces\"\n ? validateNamespacesWithShorthands<world[key], extendedScope<world>>\n : validateWorld<world>[key];\n};\n\nfunction validateWorldWithShorthands(world: unknown): asserts world is WorldWithShorthandsInput {\n const scope = extendedScope(world);\n if (hasOwnKey(world, \"tables\")) {\n validateTablesWithShorthands(world.tables, scope);\n }\n\n if (hasOwnKey(world, \"namespaces\") && isObject(world.namespaces)) {\n for (const namespaceKey of Object.keys(world.namespaces)) {\n validateTablesWithShorthands(getPath(world.namespaces, [namespaceKey, \"tables\"]) ?? {}, scope);\n }\n }\n}\n\nexport type validateNamespacesWithShorthands<namespaces, scope extends Scope = AbiTypeScope> = {\n [namespace in keyof namespaces]: {\n [key in keyof namespaces[namespace]]: key extends \"tables\"\n ? validateTablesWithShorthands<namespaces[namespace][key], scope>\n : validateNamespaces<namespaces[namespace], scope>[key];\n };\n};\n\nexport function resolveWorldWithShorthands<world extends WorldWithShorthandsInput>(\n world: world,\n): resolveWorldWithShorthands<world> {\n const scope = extendedScope(world);\n const tables = mapObject(world.tables ?? {}, (table) => {\n return isTableShorthandInput(table) ? resolveTableShorthand(table, scope) : table;\n });\n const namespaces = mapObject(world.namespaces ?? {}, (namespace) => ({\n ...namespace,\n tables: mapObject(namespace.tables ?? {}, (table) => {\n return isTableShorthandInput(table) ? resolveTableShorthand(table, scope) : table;\n }),\n }));\n\n const fullConfig = { ...world, tables, namespaces };\n validateWorld(fullConfig);\n\n return resolveWorld(fullConfig) as never;\n}\n\nexport function defineWorldWithShorthands<world>(\n world: validateWorldWithShorthands<world>,\n): resolveWorldWithShorthands<world> {\n validateWorldWithShorthands(world);\n return resolveWorldWithShorthands(world) as never;\n}\n"],"mappings":"2EACO,IAAMA,EAAqB,iEAGrBC,EAAkB,iDCJ/B,OAAS,aAAAC,MAAiB,2BAC1B,OAGE,iBAAAC,EACA,WAAAC,EACA,aAAAC,EACA,YAAAC,EACA,yBAAAC,EACA,yBAAAC,EAEA,gCAAAC,MACK,8BA2BP,SAASC,EAA4BC,EAA2D,CAC9F,IAAMC,EAAQC,EAAcF,CAAK,EAKjC,GAJIG,EAAUH,EAAO,QAAQ,GAC3BI,EAA6BJ,EAAM,OAAQC,CAAK,EAG9CE,EAAUH,EAAO,YAAY,GAAKK,EAASL,EAAM,UAAU,EAC7D,QAAWM,KAAgB,OAAO,KAAKN,EAAM,UAAU,EACrDI,EAA6BG,EAAQP,EAAM,WAAY,CAACM,EAAc,QAAQ,CAAC,GAAK,CAAC,EAAGL,CAAK,CAGnG,CAUO,SAASO,EACdR,EACmC,CACnC,IAAMC,EAAQC,EAAcF,CAAK,EAC3BS,EAASC,EAAUV,EAAM,QAAU,CAAC,EAAIW,GACrCC,EAAsBD,CAAK,EAAIE,EAAsBF,EAAOV,CAAK,EAAIU,CAC7E,EACKG,EAAaJ,EAAUV,EAAM,YAAc,CAAC,EAAIe,IAAe,CACnE,GAAGA,EACH,OAAQL,EAAUK,EAAU,QAAU,CAAC,EAAIJ,GAClCC,EAAsBD,CAAK,EAAIE,EAAsBF,EAAOV,CAAK,EAAIU,CAC7E,CACH,EAAE,EAEIK,EAAa,CAAE,GAAGhB,EAAO,OAAAS,EAAQ,WAAAK,CAAW,EAClD,OAAAG,EAAcD,CAAU,EAEjBE,EAAaF,CAAU,CAChC,CAEO,SAASG,EACdnB,EACmC,CACnC,OAAAD,EAA4BC,CAAK,EAC1BQ,EAA2BR,CAAK,CACzC","names":["worldDeployedEvent","helloWorldEvent","mapObject","extendedScope","getPath","hasOwnKey","isObject","isTableShorthandInput","resolveTableShorthand","validateTablesWithShorthands","validateWorldWithShorthands","world","scope","extendedScope","hasOwnKey","validateTablesWithShorthands","isObject","namespaceKey","getPath","resolveWorldWithShorthands","tables","mapObject","table","isTableShorthandInput","resolveTableShorthand","namespaces","namespace","fullConfig","validateWorld","resolveWorld","defineWorldWithShorthands"]}
1
+ {"version":3,"sources":["../ts/worldEvents.ts","../ts/config/v2/worldWithShorthands.ts"],"sourcesContent":["// from WorldFactory\nexport const worldDeployedEvent = \"event WorldDeployed(address indexed newContract, uint256 salt)\";\n\n// from World\nexport const helloWorldEvent = \"event HelloWorld(bytes32 indexed worldVersion)\";\n","import { mapObject } from \"@latticexyz/common/utils\";\nimport {\n AbiTypeScope,\n Scope,\n extendedScope,\n getPath,\n hasOwnKey,\n isObject,\n isTableShorthandInput,\n resolveTableShorthand,\n resolveTablesWithShorthands,\n validateTablesWithShorthands,\n} from \"@latticexyz/store/config/v2\";\nimport { WorldWithShorthandsInput } from \"./input\";\nimport { validateNamespace } from \"./namespaces\";\nimport { resolveWorld, validateWorld } from \"./world\";\n\nexport type resolveWorldWithShorthands<world> = resolveWorld<{\n [key in keyof world]: key extends \"tables\"\n ? resolveTablesWithShorthands<world[key], extendedScope<world>>\n : key extends \"namespaces\"\n ? {\n [namespaceKey in keyof world[key]]: {\n [namespaceProp in keyof world[key][namespaceKey]]: namespaceProp extends \"tables\"\n ? resolveTablesWithShorthands<world[key][namespaceKey][namespaceProp], extendedScope<world>>\n : world[key][namespaceKey][namespaceProp];\n };\n }\n : world[key];\n}>;\n\nexport type validateWorldWithShorthands<world> = {\n [key in keyof world]: key extends \"tables\"\n ? validateTablesWithShorthands<world[key], extendedScope<world>>\n : key extends \"namespaces\"\n ? validateNamespacesWithShorthands<world[key], extendedScope<world>>\n : validateWorld<world>[key];\n};\n\nfunction validateWorldWithShorthands(world: unknown): asserts world is WorldWithShorthandsInput {\n const scope = extendedScope(world);\n if (hasOwnKey(world, \"tables\")) {\n validateTablesWithShorthands(world.tables, scope);\n }\n\n if (hasOwnKey(world, \"namespaces\") && isObject(world.namespaces)) {\n for (const namespaceKey of Object.keys(world.namespaces)) {\n validateTablesWithShorthands(getPath(world.namespaces, [namespaceKey, \"tables\"]) ?? {}, scope);\n }\n }\n}\n\nexport type validateNamespacesWithShorthands<namespaces, scope extends Scope = AbiTypeScope> = {\n [namespace in keyof namespaces]: {\n [key in keyof namespaces[namespace]]: key extends \"tables\"\n ? validateTablesWithShorthands<namespaces[namespace][key], scope>\n : validateNamespace<namespaces[namespace], scope>[key];\n };\n};\n\nexport function resolveWorldWithShorthands<world extends WorldWithShorthandsInput>(\n world: world,\n): resolveWorldWithShorthands<world> {\n const scope = extendedScope(world);\n const tables = mapObject(world.tables ?? {}, (table) => {\n return isTableShorthandInput(table) ? resolveTableShorthand(table, scope) : table;\n });\n const namespaces = mapObject(world.namespaces ?? {}, (namespace) => ({\n ...namespace,\n tables: mapObject(namespace.tables ?? {}, (table) => {\n return isTableShorthandInput(table) ? resolveTableShorthand(table, scope) : table;\n }),\n }));\n\n const fullConfig = { ...world, tables, namespaces };\n validateWorld(fullConfig);\n\n return resolveWorld(fullConfig) as never;\n}\n\nexport function defineWorldWithShorthands<world>(\n world: validateWorldWithShorthands<world>,\n): resolveWorldWithShorthands<world> {\n validateWorldWithShorthands(world);\n return resolveWorldWithShorthands(world) as never;\n}\n"],"mappings":"2EACO,IAAMA,EAAqB,iEAGrBC,EAAkB,iDCJ/B,OAAS,aAAAC,MAAiB,2BAC1B,OAGE,iBAAAC,EACA,WAAAC,EACA,aAAAC,EACA,YAAAC,EACA,yBAAAC,EACA,yBAAAC,EAEA,gCAAAC,MACK,8BA2BP,SAASC,EAA4BC,EAA2D,CAC9F,IAAMC,EAAQC,EAAcF,CAAK,EAKjC,GAJIG,EAAUH,EAAO,QAAQ,GAC3BI,EAA6BJ,EAAM,OAAQC,CAAK,EAG9CE,EAAUH,EAAO,YAAY,GAAKK,EAASL,EAAM,UAAU,EAC7D,QAAWM,KAAgB,OAAO,KAAKN,EAAM,UAAU,EACrDI,EAA6BG,EAAQP,EAAM,WAAY,CAACM,EAAc,QAAQ,CAAC,GAAK,CAAC,EAAGL,CAAK,CAGnG,CAUO,SAASO,EACdR,EACmC,CACnC,IAAMC,EAAQC,EAAcF,CAAK,EAC3BS,EAASC,EAAUV,EAAM,QAAU,CAAC,EAAIW,GACrCC,EAAsBD,CAAK,EAAIE,EAAsBF,EAAOV,CAAK,EAAIU,CAC7E,EACKG,EAAaJ,EAAUV,EAAM,YAAc,CAAC,EAAIe,IAAe,CACnE,GAAGA,EACH,OAAQL,EAAUK,EAAU,QAAU,CAAC,EAAIJ,GAClCC,EAAsBD,CAAK,EAAIE,EAAsBF,EAAOV,CAAK,EAAIU,CAC7E,CACH,EAAE,EAEIK,EAAa,CAAE,GAAGhB,EAAO,OAAAS,EAAQ,WAAAK,CAAW,EAClD,OAAAG,EAAcD,CAAU,EAEjBE,EAAaF,CAAU,CAChC,CAEO,SAASG,EACdnB,EACmC,CACnC,OAAAD,EAA4BC,CAAK,EAC1BQ,EAA2BR,CAAK,CACzC","names":["worldDeployedEvent","helloWorldEvent","mapObject","extendedScope","getPath","hasOwnKey","isObject","isTableShorthandInput","resolveTableShorthand","validateTablesWithShorthands","validateWorldWithShorthands","world","scope","extendedScope","hasOwnKey","validateTablesWithShorthands","isObject","namespaceKey","getPath","resolveWorldWithShorthands","tables","mapObject","table","isTableShorthandInput","resolveTableShorthand","namespaces","namespace","fullConfig","validateWorld","resolveWorld","defineWorldWithShorthands"]}
package/dist/internal.js CHANGED
@@ -1,3 +1,3 @@
1
- import{a as m}from"./chunk-ZUIIMEYR.js";import{a as K,b as O}from"./chunk-NXAGBVBE.js";import"./chunk-UMWFUO6H.js";import{a as M,b as H}from"./chunk-E5NQ4W4F.js";import{a as V,b as j}from"./chunk-LZTXZFCC.js";import{encodeFunctionData as C}from"viem";function c({abi:e,systemId:a,functionName:t,args:n}){return[a,C({abi:e,functionName:t,args:n})]}import{encodeFunctionData as x}from"viem";function p({abi:e,from:a,systemId:t,functionName:n,args:i}){return[a,t,x({abi:e,functionName:n,args:i})]}function ee(e,a){return a.map(t=>c({...t,abi:e}))}function ie(e,a,t){return t.map(n=>p({...n,abi:e,from:a}))}import{slice as S,concat as F}from"viem";import{getAction as d,encodeFunctionData as A}from"viem/utils";import{writeContract as b}from"viem/actions";import{readHex as g}from"@latticexyz/common";import{getKeySchema as h,getValueSchema as P,getSchemaTypes as f,decodeValueArgs as w,encodeKey as N}from"@latticexyz/protocol-parser/internal";var u=[{type:"function",name:"getDynamicField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getDynamicFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getDynamicFieldSlice",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"},{name:"start",type:"uint256",internalType:"uint256"},{name:"end",type:"uint256",internalType:"uint256"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getFieldLayout",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],stateMutability:"view"},{type:"function",name:"getFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getKeySchema",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"keySchema",type:"bytes32",internalType:"Schema"}],stateMutability:"view"},{type:"function",name:"getRecord",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"staticData",type:"bytes",internalType:"bytes"},{name:"encodedLengths",type:"bytes32",internalType:"EncodedLengths"},{name:"dynamicData",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getRecord",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"}],outputs:[{name:"staticData",type:"bytes",internalType:"bytes"},{name:"encodedLengths",type:"bytes32",internalType:"EncodedLengths"},{name:"dynamicData",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getStaticField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getValueSchema",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"valueSchema",type:"bytes32",internalType:"Schema"}],stateMutability:"view"}];function be(e){return a=>({writeContract:async t=>{if(t.address!==e.worldAddress||t.functionName==="call"||t.functionName==="callFrom"||t.functionName==="callWithSignature")return d(a,b,"writeContract")(t);let n=A({abi:t.abi,functionName:t.functionName,args:t.args}),i=S(n,0,4),{systemId:o,systemFunctionSelector:r}=await v(e,i),y=F([r,g(n,4)]),s={...t,functionName:"callFrom",args:[e.delegatorAddress,o,y]};return d(a,b,"writeContract")(s)}})}var T=new Map;async function v(e,a){let t=F([e.worldAddress,a]),n=T.get(t);if(n)return n;let i=e.worldFunctionToSystemFunction?await e.worldFunctionToSystemFunction(a):await D(e.publicClient,e.worldAddress,a);return T.set(t,i),i}async function D(e,a,t){let n=m.tables.world__FunctionSelectors,i=f(h(n)),o=f(P(n)),[r,y,s]=await e.readContract({address:a,abi:u,functionName:"getRecord",args:[n.tableId,N(i,{worldFunctionSelector:t})]}),l=w(o,{staticData:r,encodedLengths:y,dynamicData:s});return{systemId:l.systemId,systemFunctionSelector:l.systemFunctionSelector}}var Te={Call:[{name:"signer",type:"address"},{name:"systemNamespace",type:"string"},{name:"systemName",type:"string"},{name:"callData",type:"bytes"},{name:"nonce",type:"uint256"}]};function R(e){return{type:"tableId",input:e}}function W(e){return typeof e=="object"&&e!==null&&"type"in e&&"input"in e}function E(e){return typeof e=="object"&&e!==null&&"type"in e&&"value"in e}function k(e,a){if(E(e))return e;if(W(e)&&e.type==="tableId"){let t=Object.entries(a.config.tables).filter(([n,i])=>n===e.input||i.name===e.input);if(t.length>1)throw new Error(`Found more than one table with name "${e.input}". Try using one of the following table names instead: ${t.map(([n])=>n).join(", ")}`);if(t.length===1){let[n]=t,[,i]=n;return{type:"bytes32",value:i.tableId}}}throw new Error(`Could not resolve dynamic resolution:
1
+ import{a as m}from"./chunk-MN3OGYI5.js";import{a as K,b as O}from"./chunk-NXAGBVBE.js";import"./chunk-AHES67HT.js";import{a as M,b as H}from"./chunk-E5NQ4W4F.js";import{a as V,b as j}from"./chunk-LZTXZFCC.js";import{encodeFunctionData as C}from"viem";function c({abi:e,systemId:a,functionName:t,args:n}){return[a,C({abi:e,functionName:t,args:n})]}import{encodeFunctionData as x}from"viem";function p({abi:e,from:a,systemId:t,functionName:n,args:i}){return[a,t,x({abi:e,functionName:n,args:i})]}function ee(e,a){return a.map(t=>c({...t,abi:e}))}function ie(e,a,t){return t.map(n=>p({...n,abi:e,from:a}))}import{slice as S,concat as F}from"viem";import{getAction as d,encodeFunctionData as A}from"viem/utils";import{writeContract as b}from"viem/actions";import{readHex as g}from"@latticexyz/common";import{getKeySchema as h,getValueSchema as P,getSchemaTypes as f,decodeValueArgs as w,encodeKey as N}from"@latticexyz/protocol-parser/internal";var u=[{type:"function",name:"getDynamicField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getDynamicFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getDynamicFieldSlice",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"},{name:"start",type:"uint256",internalType:"uint256"},{name:"end",type:"uint256",internalType:"uint256"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getFieldLayout",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],stateMutability:"view"},{type:"function",name:"getFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getKeySchema",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"keySchema",type:"bytes32",internalType:"Schema"}],stateMutability:"view"},{type:"function",name:"getRecord",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"staticData",type:"bytes",internalType:"bytes"},{name:"encodedLengths",type:"bytes32",internalType:"EncodedLengths"},{name:"dynamicData",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getRecord",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"}],outputs:[{name:"staticData",type:"bytes",internalType:"bytes"},{name:"encodedLengths",type:"bytes32",internalType:"EncodedLengths"},{name:"dynamicData",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getStaticField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getValueSchema",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"valueSchema",type:"bytes32",internalType:"Schema"}],stateMutability:"view"}];function be(e){return a=>({writeContract:async t=>{if(t.address!==e.worldAddress||t.functionName==="call"||t.functionName==="callFrom"||t.functionName==="callWithSignature")return d(a,b,"writeContract")(t);let n=A({abi:t.abi,functionName:t.functionName,args:t.args}),i=S(n,0,4),{systemId:o,systemFunctionSelector:r}=await v(e,i),y=F([r,g(n,4)]),s={...t,functionName:"callFrom",args:[e.delegatorAddress,o,y]};return d(a,b,"writeContract")(s)}})}var T=new Map;async function v(e,a){let t=F([e.worldAddress,a]),n=T.get(t);if(n)return n;let i=e.worldFunctionToSystemFunction?await e.worldFunctionToSystemFunction(a):await D(e.publicClient,e.worldAddress,a);return T.set(t,i),i}async function D(e,a,t){let n=m.tables.world__FunctionSelectors,i=f(h(n)),o=f(P(n)),[r,y,s]=await e.readContract({address:a,abi:u,functionName:"getRecord",args:[n.tableId,N(i,{worldFunctionSelector:t})]}),l=w(o,{staticData:r,encodedLengths:y,dynamicData:s});return{systemId:l.systemId,systemFunctionSelector:l.systemFunctionSelector}}var Te={Call:[{name:"signer",type:"address"},{name:"systemNamespace",type:"string"},{name:"systemName",type:"string"},{name:"callData",type:"bytes"},{name:"nonce",type:"uint256"}]};function R(e){return{type:"tableId",input:e}}function W(e){return typeof e=="object"&&e!==null&&"type"in e&&"input"in e}function E(e){return typeof e=="object"&&e!==null&&"type"in e&&"value"in e}function k(e,a){if(E(e))return e;if(W(e)&&e.type==="tableId"){let t=Object.entries(a.config.tables).filter(([n,i])=>n===e.input||i.name===e.input);if(t.length>1)throw new Error(`Found more than one table with name "${e.input}". Try using one of the following table names instead: ${t.map(([n])=>n).join(", ")}`);if(t.length===1){let[n]=t,[,i]=n;return{type:"bytes32",value:i.tableId}}}throw new Error(`Could not resolve dynamic resolution:
2
2
  ${JSON.stringify(e,null,2)}`)}export{M as SYSTEM_DEFAULTS,H as WORLD_DEFAULTS,be as callFrom,Te as callWithSignatureTypes,c as encodeSystemCall,p as encodeSystemCallFrom,ee as encodeSystemCalls,ie as encodeSystemCallsFrom,j as resolveSystemConfig,R as resolveTableId,k as resolveWithContext,V as resolveWorldConfig,O as zPluginWorldConfig,K as zWorldConfig};
3
3
  //# sourceMappingURL=internal.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-ZUIIMEYR.js";import"./chunk-UMWFUO6H.js";import"./chunk-E5NQ4W4F.js";export{a as default};
1
+ import{a}from"./chunk-MN3OGYI5.js";import"./chunk-AHES67HT.js";import"./chunk-E5NQ4W4F.js";export{a as default};
2
2
  //# sourceMappingURL=mud.config.js.map
@@ -1,4 +1,4 @@
1
- import { evaluate, narrow, ErrorMessage, conform } from '@arktype/util';
1
+ import { evaluate, conform, ErrorMessage, narrow } from '@arktype/util';
2
2
  import { StoreInput, StoreWithShorthandsInput, resolveTable, mergeIfUndefined, getPath, extendedScope, Scope, AbiTypeScope, validateTables, UserTypes, resolveStore, Store } from '@latticexyz/store/config/v2';
3
3
  import { V as ValueWithType, D as DynamicResolution } from './dynamicResolution-1a0cabb0.js';
4
4
  import { S as SYSTEM_DEFAULTS } from './defaults-1be1ffd2.js';
@@ -105,12 +105,10 @@ type namespacedTableKeys<world> = world extends {
105
105
  tables: infer tables;
106
106
  } ? `${k & string}__${keyof tables & string}` : never;
107
107
  }[keyof namespaces] : never;
108
- type validateNamespaces<namespaces, scope extends Scope = AbiTypeScope> = {
109
- [namespace in keyof namespaces]: {
110
- [key in keyof namespaces[namespace]]: key extends "tables" ? validateTables<namespaces[namespace][key], scope> : namespaces[namespace][key];
111
- };
108
+ type validateNamespace<namespace, scope extends Scope = AbiTypeScope> = {
109
+ readonly [key in keyof namespace]: key extends "tables" ? validateTables<namespace[key], scope> : key extends keyof NamespaceInput ? conform<namespace[key], NamespaceInput[key]> : ErrorMessage<`\`${key & string}\` is not a valid namespace config option.`>;
112
110
  };
113
- declare function validateNamespaces<scope extends Scope = AbiTypeScope>(namespaces: unknown, scope: scope): asserts namespaces is NamespacesInput;
111
+ declare function validateNamespace<scope extends Scope = AbiTypeScope>(namespace: unknown, scope: scope): asserts namespace is NamespaceInput;
114
112
  type resolveNamespacedTables<world> = "namespaces" extends keyof world ? {
115
113
  readonly [key in namespacedTableKeys<world>]: key extends `${infer namespace}__${infer table}` ? resolveTable<mergeIfUndefined<getPath<world, ["namespaces", namespace, "tables", table]>, {
116
114
  name: table;
@@ -175,4 +173,4 @@ type resolveWorld<world> = evaluate<resolveStore<world> & mergeIfUndefined<{
175
173
  declare function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world>;
176
174
  declare function defineWorld<const world>(world: validateWorld<world>): resolveWorld<world>;
177
175
 
178
- export { WorldWithShorthandsInput as W, validateNamespaces as a, defineWorld as d, resolveWorld as r, validateWorld as v };
176
+ export { WorldWithShorthandsInput as W, validateNamespace as a, defineWorld as d, resolveWorld as r, validateWorld as v };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/world",
3
- "version": "2.0.13-main-978df93f2",
3
+ "version": "2.0.13-main-e0c9eaaf2",
4
4
  "description": "World framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,11 +52,11 @@
52
52
  "arktype": "1.0.29-alpha",
53
53
  "viem": "2.9.20",
54
54
  "zod": "^3.22.2",
55
- "@latticexyz/common": "2.0.13-main-978df93f2",
56
- "@latticexyz/config": "2.0.13-main-978df93f2",
57
- "@latticexyz/protocol-parser": "2.0.13-main-978df93f2",
58
- "@latticexyz/schema-type": "2.0.13-main-978df93f2",
59
- "@latticexyz/store": "2.0.13-main-978df93f2"
55
+ "@latticexyz/common": "2.0.13-main-e0c9eaaf2",
56
+ "@latticexyz/config": "2.0.13-main-e0c9eaaf2",
57
+ "@latticexyz/protocol-parser": "2.0.13-main-e0c9eaaf2",
58
+ "@latticexyz/schema-type": "2.0.13-main-e0c9eaaf2",
59
+ "@latticexyz/store": "2.0.13-main-e0c9eaaf2"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/ejs": "^3.1.1",
@@ -71,8 +71,8 @@
71
71
  "tsup": "^6.7.0",
72
72
  "tsx": "^3.12.6",
73
73
  "vitest": "0.34.6",
74
- "@latticexyz/abi-ts": "2.0.13-main-978df93f2",
75
- "@latticexyz/gas-report": "2.0.13-main-978df93f2"
74
+ "@latticexyz/abi-ts": "2.0.13-main-e0c9eaaf2",
75
+ "@latticexyz/gas-report": "2.0.13-main-e0c9eaaf2"
76
76
  },
77
77
  "scripts": {
78
78
  "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts && pnpm run build:js",
@@ -1,2 +0,0 @@
1
- import{a as y}from"./chunk-E5NQ4W4F.js";import{extendedScope as u,get as O,resolveTable as _,validateTable as A,mergeIfUndefined as d,validateTables as b,resolveStore as k,hasOwnKey as E,validateStore as w,isObject as C}from"@latticexyz/store/config/v2";var i={root:!1,args:[],artifactPath:void 0},r={worldInterfaceName:"IWorld",worldgenDirectory:"world",worldImportPath:"@latticexyz/world/src/"},n={customWorldContract:void 0,postDeployScript:"PostDeploy",deploysDirectory:"./deploys",worldsFile:"./worlds.json",upgradeableWorldImplementation:!1},p={systems:{},tables:{},excludeSystems:[],modules:[],codegen:r,deploy:n};import{mapObject as x}from"@latticexyz/common/utils";import{mergeIfUndefined as U}from"@latticexyz/store/config/v2";function c(e){return x(e,o=>U(o,y))}import{isObject as g,mergeIfUndefined as I}from"@latticexyz/store/config/v2";function f(e){return g(e)?I(e,r):r}import{mergeIfUndefined as L,isObject as F}from"@latticexyz/store/config/v2";function S(e){return F(e)?L(e,n):n}function W(e){let o=u(e);if(w(e),E(e,"namespaces")){if(!C(e.namespaces))throw new Error(`Expected namespaces, received ${JSON.stringify(e.namespaces)}`);for(let s of Object.values(e.namespaces))E(s,"tables")&&b(s.tables,o)}}function N(e){let o=u(e),s=e.namespaces??{},D=Object.fromEntries(Object.entries(s).map(([t,v])=>Object.entries(v.tables??{}).map(([a,m])=>(A(m,o),[`${t}__${a}`,_(d(m,{namespace:t,name:a}),o)]))).flat()),l=k(e),T=(e.modules??p.modules).map(t=>d(t,i));return d({...l,tables:{...l.tables,...D},codegen:d(l.codegen,f(e.codegen)),deploy:S(e.deploy),systems:c(e.systems??p.systems),excludeSystems:O(e,"excludeSystems"),modules:T},p)}function ee(e){return W(e),N(e)}export{W as a,N as b,ee as c};
2
- //# sourceMappingURL=chunk-UMWFUO6H.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../ts/config/v2/world.ts","../ts/config/v2/defaults.ts","../ts/config/v2/systems.ts","../ts/config/v2/codegen.ts","../ts/config/v2/deploy.ts"],"sourcesContent":["import { ErrorMessage, conform, evaluate, narrow } from \"@arktype/util\";\nimport {\n UserTypes,\n extendedScope,\n get,\n resolveTable,\n validateTable,\n mergeIfUndefined,\n validateTables,\n resolveStore,\n Store,\n hasOwnKey,\n validateStore,\n isObject,\n} from \"@latticexyz/store/config/v2\";\nimport { SystemsInput, WorldInput } from \"./input\";\nimport { CONFIG_DEFAULTS, MODULE_DEFAULTS } from \"./defaults\";\nimport { Tables } from \"@latticexyz/store/internal\";\nimport { resolveSystems } from \"./systems\";\nimport { resolveNamespacedTables } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\n\nexport type validateWorld<world> = {\n readonly [key in keyof world]: key extends \"tables\"\n ? validateTables<world[key], extendedScope<world>>\n : key extends \"userTypes\"\n ? UserTypes\n : key extends \"enums\"\n ? narrow<world[key]>\n : key extends \"namespaces\"\n ? // ? validateNamespaces<world[key], extendedScope<world>>\n ErrorMessage<`Namespaces config will be enabled soon.`>\n : key extends keyof WorldInput\n ? conform<world[key], WorldInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid World config option.`>;\n};\n\nexport function validateWorld(world: unknown): asserts world is WorldInput {\n const scope = extendedScope(world);\n validateStore(world);\n\n if (hasOwnKey(world, \"namespaces\")) {\n if (!isObject(world.namespaces)) {\n throw new Error(`Expected namespaces, received ${JSON.stringify(world.namespaces)}`);\n }\n for (const namespace of Object.values(world.namespaces)) {\n if (hasOwnKey(namespace, \"tables\")) {\n validateTables(namespace.tables, scope);\n }\n }\n }\n}\n\nexport type resolveWorld<world> = evaluate<\n resolveStore<world> &\n mergeIfUndefined<\n { tables: resolveNamespacedTables<world> } & Omit<\n {\n [key in keyof world]: key extends \"systems\"\n ? resolveSystems<world[key] & SystemsInput>\n : key extends \"deploy\"\n ? resolveDeploy<world[key]>\n : key extends \"codegen\"\n ? resolveCodegen<world[key]>\n : world[key];\n },\n \"namespaces\" | keyof Store\n >,\n CONFIG_DEFAULTS\n >\n>;\n\nexport function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world> {\n const scope = extendedScope(world);\n const namespaces = world.namespaces ?? {};\n\n const resolvedNamespacedTables = Object.fromEntries(\n Object.entries(namespaces)\n .map(([namespaceKey, namespace]) =>\n Object.entries(namespace.tables ?? {}).map(([tableKey, table]) => {\n validateTable(table, scope);\n return [\n `${namespaceKey}__${tableKey}`,\n resolveTable(mergeIfUndefined(table, { namespace: namespaceKey, name: tableKey }), scope),\n ];\n }),\n )\n .flat(),\n ) as Tables;\n\n const resolvedStore = resolveStore(world);\n\n const modules = (world.modules ?? CONFIG_DEFAULTS.modules).map((mod) => mergeIfUndefined(mod, MODULE_DEFAULTS));\n\n return mergeIfUndefined(\n {\n ...resolvedStore,\n tables: { ...resolvedStore.tables, ...resolvedNamespacedTables },\n codegen: mergeIfUndefined(resolvedStore.codegen, resolveCodegen(world.codegen)),\n deploy: resolveDeploy(world.deploy),\n systems: resolveSystems(world.systems ?? CONFIG_DEFAULTS.systems),\n excludeSystems: get(world, \"excludeSystems\"),\n modules,\n },\n CONFIG_DEFAULTS,\n ) as never;\n}\n\nexport function defineWorld<const world>(world: validateWorld<world>): resolveWorld<world> {\n validateWorld(world);\n return resolveWorld(world) as never;\n}\n","import { CodegenInput, DeployInput, ModuleInput, SystemInput, WorldInput } from \"./input\";\n\nexport const SYSTEM_DEFAULTS = {\n registerFunctionSelectors: true,\n openAccess: true,\n accessList: [],\n} as const satisfies SystemInput;\n\nexport type SYSTEM_DEFAULTS = typeof SYSTEM_DEFAULTS;\n\nexport const MODULE_DEFAULTS = {\n root: false,\n args: [],\n artifactPath: undefined,\n} as const satisfies Pick<ModuleInput, \"root\" | \"args\" | \"artifactPath\">;\n\nexport type MODULE_DEFAULTS = typeof MODULE_DEFAULTS;\n\nexport const CODEGEN_DEFAULTS = {\n worldInterfaceName: \"IWorld\",\n worldgenDirectory: \"world\",\n worldImportPath: \"@latticexyz/world/src/\",\n} as const satisfies CodegenInput;\n\nexport type CODEGEN_DEFAULTS = typeof CODEGEN_DEFAULTS;\n\nexport const DEPLOY_DEFAULTS = {\n customWorldContract: undefined,\n postDeployScript: \"PostDeploy\",\n deploysDirectory: \"./deploys\",\n worldsFile: \"./worlds.json\",\n upgradeableWorldImplementation: false,\n} as const satisfies DeployInput;\n\nexport type DEPLOY_DEFAULTS = typeof DEPLOY_DEFAULTS;\n\nexport const CONFIG_DEFAULTS = {\n systems: {},\n tables: {},\n excludeSystems: [],\n modules: [],\n codegen: CODEGEN_DEFAULTS,\n deploy: DEPLOY_DEFAULTS,\n} as const satisfies WorldInput;\n\nexport type CONFIG_DEFAULTS = typeof CONFIG_DEFAULTS;\n","import { mapObject } from \"@latticexyz/common/utils\";\nimport { SYSTEM_DEFAULTS } from \"../defaults\";\nimport { SystemsInput } from \"./input\";\nimport { mergeIfUndefined } from \"@latticexyz/store/config/v2\";\n\nexport type resolveSystems<systems extends SystemsInput> = {\n [system in keyof systems]: mergeIfUndefined<systems[system], typeof SYSTEM_DEFAULTS>;\n};\n\nexport function resolveSystems<systems extends SystemsInput>(systems: systems): resolveSystems<systems> {\n return mapObject(systems, (system) => mergeIfUndefined(system, SYSTEM_DEFAULTS));\n}\n","import { isObject, mergeIfUndefined } from \"@latticexyz/store/config/v2\";\nimport { CODEGEN_DEFAULTS } from \"./defaults\";\n\nexport type resolveCodegen<codegen> = codegen extends {}\n ? mergeIfUndefined<codegen, CODEGEN_DEFAULTS>\n : CODEGEN_DEFAULTS;\n\nexport function resolveCodegen<codegen>(codegen: codegen): resolveCodegen<codegen> {\n return (isObject(codegen) ? mergeIfUndefined(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS) as never;\n}\n","import { mergeIfUndefined, isObject } from \"@latticexyz/store/config/v2\";\nimport { DEPLOY_DEFAULTS } from \"./defaults\";\n\nexport type resolveDeploy<deploy> = deploy extends {} ? mergeIfUndefined<deploy, DEPLOY_DEFAULTS> : DEPLOY_DEFAULTS;\n\nexport function resolveDeploy<deploy>(deploy: deploy): resolveDeploy<deploy> {\n return (isObject(deploy) ? mergeIfUndefined(deploy, DEPLOY_DEFAULTS) : DEPLOY_DEFAULTS) as never;\n}\n"],"mappings":"wCACA,OAEE,iBAAAA,EACA,OAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,oBAAAC,EACA,kBAAAC,EACA,gBAAAC,EAEA,aAAAC,EACA,iBAAAC,EACA,YAAAC,MACK,8BCJA,IAAMC,EAAkB,CAC7B,KAAM,GACN,KAAM,CAAC,EACP,aAAc,MAChB,EAIaC,EAAmB,CAC9B,mBAAoB,SACpB,kBAAmB,QACnB,gBAAiB,wBACnB,EAIaC,EAAkB,CAC7B,oBAAqB,OACrB,iBAAkB,aAClB,iBAAkB,YAClB,WAAY,gBACZ,+BAAgC,EAClC,EAIaC,EAAkB,CAC7B,QAAS,CAAC,EACV,OAAQ,CAAC,EACT,eAAgB,CAAC,EACjB,QAAS,CAAC,EACV,QAASF,EACT,OAAQC,CACV,EC3CA,OAAS,aAAAE,MAAiB,2BAG1B,OAAS,oBAAAC,MAAwB,8BAM1B,SAASC,EAA6CC,EAA2C,CACtG,OAAOC,EAAUD,EAAUE,GAAWJ,EAAiBI,EAAQC,CAAe,CAAC,CACjF,CCXA,OAAS,YAAAC,EAAU,oBAAAC,MAAwB,8BAOpC,SAASC,EAAwBC,EAA2C,CACjF,OAAQC,EAASD,CAAO,EAAIE,EAAiBF,EAASG,CAAgB,EAAIA,CAC5E,CCTA,OAAS,oBAAAC,EAAkB,YAAAC,MAAgB,8BAKpC,SAASC,EAAsBC,EAAuC,CAC3E,OAAQC,EAASD,CAAM,EAAIE,EAAiBF,EAAQG,CAAe,EAAIA,CACzE,CJ+BO,SAASC,EAAcC,EAA6C,CACzE,IAAMC,EAAQC,EAAcF,CAAK,EAGjC,GAFAG,EAAcH,CAAK,EAEfI,EAAUJ,EAAO,YAAY,EAAG,CAClC,GAAI,CAACK,EAASL,EAAM,UAAU,EAC5B,MAAM,IAAI,MAAM,iCAAiC,KAAK,UAAUA,EAAM,UAAU,GAAG,EAErF,QAAWM,KAAa,OAAO,OAAON,EAAM,UAAU,EAChDI,EAAUE,EAAW,QAAQ,GAC/BC,EAAeD,EAAU,OAAQL,CAAK,EAI9C,CAqBO,SAASO,EAA6CR,EAAmC,CAC9F,IAAMC,EAAQC,EAAcF,CAAK,EAC3BS,EAAaT,EAAM,YAAc,CAAC,EAElCU,EAA2B,OAAO,YACtC,OAAO,QAAQD,CAAU,EACtB,IAAI,CAAC,CAACE,EAAcL,CAAS,IAC5B,OAAO,QAAQA,EAAU,QAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAACM,EAAUC,CAAK,KAC1DC,EAAcD,EAAOZ,CAAK,EACnB,CACL,GAAGU,MAAiBC,IACpBG,EAAaC,EAAiBH,EAAO,CAAE,UAAWF,EAAc,KAAMC,CAAS,CAAC,EAAGX,CAAK,CAC1F,EACD,CACH,EACC,KAAK,CACV,EAEMgB,EAAgBC,EAAalB,CAAK,EAElCmB,GAAWnB,EAAM,SAAWoB,EAAgB,SAAS,IAAKC,GAAQL,EAAiBK,EAAKC,CAAe,CAAC,EAE9G,OAAON,EACL,CACE,GAAGC,EACH,OAAQ,CAAE,GAAGA,EAAc,OAAQ,GAAGP,CAAyB,EAC/D,QAASM,EAAiBC,EAAc,QAASM,EAAevB,EAAM,OAAO,CAAC,EAC9E,OAAQwB,EAAcxB,EAAM,MAAM,EAClC,QAASyB,EAAezB,EAAM,SAAWoB,EAAgB,OAAO,EAChE,eAAgBM,EAAI1B,EAAO,gBAAgB,EAC3C,QAAAmB,CACF,EACAC,CACF,CACF,CAEO,SAASO,GAAyB3B,EAAkD,CACzF,OAAAD,EAAcC,CAAK,EACZQ,EAAaR,CAAK,CAC3B","names":["extendedScope","get","resolveTable","validateTable","mergeIfUndefined","validateTables","resolveStore","hasOwnKey","validateStore","isObject","MODULE_DEFAULTS","CODEGEN_DEFAULTS","DEPLOY_DEFAULTS","CONFIG_DEFAULTS","mapObject","mergeIfUndefined","resolveSystems","systems","mapObject","system","SYSTEM_DEFAULTS","isObject","mergeIfUndefined","resolveCodegen","codegen","isObject","mergeIfUndefined","CODEGEN_DEFAULTS","mergeIfUndefined","isObject","resolveDeploy","deploy","isObject","mergeIfUndefined","DEPLOY_DEFAULTS","validateWorld","world","scope","extendedScope","validateStore","hasOwnKey","isObject","namespace","validateTables","resolveWorld","namespaces","resolvedNamespacedTables","namespaceKey","tableKey","table","validateTable","resolveTable","mergeIfUndefined","resolvedStore","resolveStore","modules","CONFIG_DEFAULTS","mod","MODULE_DEFAULTS","resolveCodegen","resolveDeploy","resolveSystems","get","defineWorld"]}