@latticexyz/world 3.0.0-main-2da9e48cd → 3.0.0-main-fb1cfef0c

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.
@@ -1,2 +1,2 @@
1
- import{c as e}from"./chunk-BH75YTBY.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-OZBNK257.js.map
1
+ import{c as e}from"./chunk-3EELS6P3.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-2DPDMM6H.js.map
@@ -0,0 +1,2 @@
1
+ import{h as c,i as p,j as l,k as a,l as i,m as y}from"./chunk-DK3XOTC2.js";import{extendedScope as k,get as A,resolveTable as j,validateTable as L,mergeIfUndefined as r,resolveStore as F,hasOwnKey as S,validateStore as $,expandTableShorthand as C}from"@latticexyz/store/config/v2";import{isObject as w}from"@latticexyz/store/config/v2";function f(e){if(w(e)){for(let s of Object.values(e))i(s,{inNamespace:!0});return}throw new Error(`Expected system config, received ${JSON.stringify(e)}`)}function v(e,s){return Object.fromEntries(Object.entries(e).map(([o,n])=>[o,y({...n,label:o,namespace:s})]))}import{validateTables as I,isObject as N,hasOwnKey as O}from"@latticexyz/store/config/v2";function D(e,s){O(e,"tables")&&I(e.tables,s)}function b(e,s){if(!N(e))throw new Error(`Expected namespaces, received ${JSON.stringify(e)}`);for(let o of Object.values(e))D(o,s)}import{isObject as U,mergeIfUndefined as W}from"@latticexyz/store/config/v2";function x(e){return U(e)?W(e,p):p}import{mergeIfUndefined as _,isObject as h}from"@latticexyz/store/config/v2";function u(e){return h(e)?_(e,l):l}function M(e){let s=k(e);$(e),S(e,"systems")&&f(e.systems),S(e,"namespaces")&&b(e.namespaces,s)}function G(e){let s=k(e),o=F(e),n=e.namespaces??{},g=Object.fromEntries(Object.entries(n).map(([t,E])=>Object.entries(E.tables??{}).map(([d,m])=>(L(m,s),[`${t}__${d}`,j(r(C(m,s),{namespace:t,label:d}),s)]))).flat()),T=(e.modules??a.modules).map(t=>r(t,c));return r({...o,tables:{...o.tables,...g},codegen:r(o.codegen,x(e.codegen)),deploy:u(e.deploy),systems:v(e.systems??a.systems,o.namespace),excludeSystems:A(e,"excludeSystems"),modules:T},a)}function ve(e){return M(e),G(e)}export{M as a,G as b,ve as c};
2
+ //# sourceMappingURL=chunk-3EELS6P3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../ts/config/v2/world.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, narrow, type withJsDoc } 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 expandTableShorthand,\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, validateSystems } from \"./systems\";\nimport { resolveNamespacedTables, validateNamespaces } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\nimport type { World } from \"./output.js\";\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 \"systems\"\n ? validateSystems<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, \"systems\")) {\n validateSystems(world.systems);\n }\n if (hasOwnKey(world, \"namespaces\")) {\n validateNamespaces(world.namespaces, scope);\n }\n}\n\nexport type resolveWorld<world, namespace = resolveStore<world>[\"namespace\"]> = withJsDoc<\n resolveStore<world> &\n mergeIfUndefined<\n { readonly tables: resolveNamespacedTables<world> } & {\n [key in Exclude<keyof world, keyof Store>]: key extends \"systems\"\n ? resolveSystems<world[key] & SystemsInput, namespace & string>\n : key extends \"deploy\"\n ? resolveDeploy<world[key]>\n : key extends \"codegen\"\n ? resolveCodegen<world[key]>\n : world[key];\n },\n CONFIG_DEFAULTS\n >,\n World\n>;\n\nexport function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world> {\n const scope = extendedScope(world);\n const resolvedStore = resolveStore(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(\n mergeIfUndefined(expandTableShorthand(table, scope), { namespace: namespaceKey, label: tableKey }),\n scope,\n ),\n ];\n }),\n )\n .flat(),\n ) as Tables;\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, resolvedStore.namespace),\n excludeSystems: get(world, \"excludeSystems\"),\n modules,\n },\n CONFIG_DEFAULTS,\n ) as never;\n}\n\nexport function defineWorld<const input>(input: validateWorld<input>): resolveWorld<input> {\n validateWorld(input);\n return resolveWorld(input) as never;\n}\n","import { ErrorMessage } from \"@arktype/util\";\nimport { isObject } from \"@latticexyz/store/config/v2\";\nimport { SystemsInput } from \"./input\";\nimport { resolveSystem, validateSystem } from \"./system\";\n\n// TODO: add nuance between \"in namespace\" (namespace provided in context) and \"in systems\" (label provided in context)\n\nexport type validateSystems<input> = {\n [label in keyof input]: input[label] extends object\n ? validateSystem<input[label], { inNamespace: true }>\n : ErrorMessage<`Expected a system config for ${label & string}.`>;\n};\n\nexport function validateSystems(input: unknown): asserts input is SystemsInput {\n if (isObject(input)) {\n for (const table of Object.values(input)) {\n validateSystem(table, { inNamespace: true });\n }\n return;\n }\n throw new Error(`Expected system config, received ${JSON.stringify(input)}`);\n}\n\nexport type resolveSystems<systems extends SystemsInput, namespace extends string> = {\n [label in keyof systems]: resolveSystem<systems[label] & { label: label; namespace: namespace }>;\n};\n\nexport function resolveSystems<systems extends SystemsInput, namespace extends string>(\n systems: systems,\n namespace: namespace,\n): resolveSystems<systems, namespace> {\n return Object.fromEntries(\n Object.entries(systems).map(([label, system]) => {\n return [label, resolveSystem({ ...system, label, namespace })];\n }),\n ) as never;\n}\n","import {\n Scope,\n AbiTypeScope,\n validateTables,\n isObject,\n hasOwnKey,\n resolveTable,\n mergeIfUndefined,\n extendedScope,\n getPath,\n expandTableShorthand,\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 [label in keyof namespaces]: validateNamespace<namespaces[label], 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 expandTableShorthand<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":"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","names":["extendedScope","get","resolveTable","validateTable","mergeIfUndefined","resolveStore","hasOwnKey","validateStore","expandTableShorthand","isObject","validateSystems","input","isObject","table","validateSystem","resolveSystems","systems","namespace","label","system","resolveSystem","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","validateSystems","validateNamespaces","resolveWorld","resolvedStore","resolveStore","namespaces","resolvedNamespacedTables","namespaceKey","namespace","tableKey","table","validateTable","resolveTable","mergeIfUndefined","expandTableShorthand","modules","CONFIG_DEFAULTS","mod","MODULE_DEFAULTS","resolveCodegen","resolveDeploy","resolveSystems","get","defineWorld","input"]}
@@ -1,4 +1,4 @@
1
- export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-6e8198d8.js';
1
+ export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-ae07544a.js';
2
2
  export { C as Codegen, D as Deploy, M as Module, S as System, b as Systems, W as World } from '../dynamicResolution-34391fca.js';
3
3
  import '@arktype/util';
4
4
  import '@latticexyz/store/config/v2';
package/dist/config/v2.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as o,b as r,c as e}from"../chunk-BH75YTBY.js";import"../chunk-DK3XOTC2.js";export{e as defineWorld,r as resolveWorld,o as validateWorld};
1
+ import{a as o,b as r,c as e}from"../chunk-3EELS6P3.js";import"../chunk-DK3XOTC2.js";export{e as defineWorld,r as resolveWorld,o as validateWorld};
2
2
  //# sourceMappingURL=v2.js.map
package/dist/index.d.ts CHANGED
@@ -1,20 +1,11 @@
1
- import { validateTablesWithShorthands, extendedScope, resolveTablesWithShorthands } from '@latticexyz/store/config/v2';
2
- import { v as validateWorld, r as resolveWorld, W as WorldWithShorthandsInput } from './world-6e8198d8.js';
1
+ export { d as defineWorld } from './world-ae07544a.js';
3
2
  export { W as World } from './dynamicResolution-34391fca.js';
4
3
  import '@arktype/util';
4
+ import '@latticexyz/store/config/v2';
5
5
  import 'viem';
6
6
  import '@latticexyz/store';
7
7
 
8
8
  declare const worldDeployedEvent = "event WorldDeployed(address indexed newContract, uint256 salt)";
9
9
  declare const helloWorldEvent = "event HelloWorld(bytes32 indexed worldVersion)";
10
10
 
11
- type validateWorldWithShorthands<world> = {
12
- [key in keyof world]: key extends "tables" ? validateTablesWithShorthands<world[key], extendedScope<world>> : validateWorld<world>[key];
13
- };
14
- type resolveWorldWithShorthands<world> = resolveWorld<{
15
- readonly [key in keyof world]: key extends "tables" ? resolveTablesWithShorthands<world[key], extendedScope<world>> : world[key];
16
- }>;
17
- declare function resolveWorldWithShorthands<world extends WorldWithShorthandsInput>(world: world): resolveWorldWithShorthands<world>;
18
- declare function defineWorldWithShorthands<world>(world: validateWorldWithShorthands<world>): resolveWorldWithShorthands<world>;
19
-
20
- export { defineWorldWithShorthands as defineWorld, helloWorldEvent, worldDeployedEvent };
11
+ export { helloWorldEvent, worldDeployedEvent };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as n,b as l}from"./chunk-BH75YTBY.js";import"./chunk-DK3XOTC2.js";var i="event WorldDeployed(address indexed newContract, uint256 salt)",W="event HelloWorld(bytes32 indexed worldVersion)";import{mapObject as p}from"@latticexyz/common/utils";import{extendedScope as h,getPath as c,hasOwnKey as s,isObject as v,isTableShorthandInput as f,resolveTableShorthand as y,validateTablesWithShorthands as a}from"@latticexyz/store/config/v2";function S(e){let o=h(e);if(s(e,"tables")&&a(e.tables,o),s(e,"namespaces")&&v(e.namespaces))for(let t of Object.keys(e.namespaces))a(c(e.namespaces,[t,"tables"])??{},o)}function m(e){let o=h(e),t=p(e.tables??{},r=>f(r)?y(r,o):r),d={...e,tables:t};return n(d),l(d)}function x(e){return S(e),m(e)}export{x as defineWorld,W as helloWorldEvent,i as worldDeployedEvent};
1
+ import{c as e}from"./chunk-3EELS6P3.js";import"./chunk-DK3XOTC2.js";var o="event WorldDeployed(address indexed newContract, uint256 salt)",t="event HelloWorld(bytes32 indexed worldVersion)";export{e as defineWorld,t as helloWorldEvent,o 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 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 { resolveWorld, validateWorld } from \"./world\";\n\nexport type validateWorldWithShorthands<world> = {\n [key in keyof world]: key extends \"tables\"\n ? validateTablesWithShorthands<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 resolveWorldWithShorthands<world> = resolveWorld<{\n readonly [key in keyof world]: key extends \"tables\"\n ? resolveTablesWithShorthands<world[key], extendedScope<world>>\n : world[key];\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\n const fullConfig = { ...world, tables };\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,OACE,iBAAAC,EACA,WAAAC,EACA,aAAAC,EACA,YAAAC,EACA,yBAAAC,EACA,yBAAAC,EAEA,gCAAAC,MACK,8BAUP,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,CAQO,SAASO,EACdR,EACmC,CACnC,IAAMC,EAAQC,EAAcF,CAAK,EAC3BS,EAASC,EAAUV,EAAM,QAAU,CAAC,EAAIW,GACrCC,EAAsBD,CAAK,EAAIE,EAAsBF,EAAOV,CAAK,EAAIU,CAC7E,EAEKG,EAAa,CAAE,GAAGd,EAAO,OAAAS,CAAO,EACtC,OAAAM,EAAcD,CAAU,EAEjBE,EAAaF,CAAU,CAChC,CAEO,SAASG,EACdjB,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","fullConfig","validateWorld","resolveWorld","defineWorldWithShorthands"]}
1
+ {"version":3,"sources":["../ts/worldEvents.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"],"mappings":"oEACO,IAAMA,EAAqB,iEAGrBC,EAAkB","names":["worldDeployedEvent","helloWorldEvent"]}
package/dist/internal.js CHANGED
@@ -1,3 +1,3 @@
1
- import{a as m}from"./chunk-OZBNK257.js";import"./chunk-BH75YTBY.js";import"./chunk-DK3XOTC2.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 u({abi:e,from:a,systemId:t,functionName:n,args:i}){return[a,t,x({abi:e,functionName:n,args:i})]}function z(e,a){return a.map(t=>c({...t,abi:e}))}function Y(e,a,t){return t.map(n=>u({...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 p=[{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 le(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:p,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 ce={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-2DPDMM6H.js";import"./chunk-3EELS6P3.js";import"./chunk-DK3XOTC2.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 u({abi:e,from:a,systemId:t,functionName:n,args:i}){return[a,t,x({abi:e,functionName:n,args:i})]}function z(e,a){return a.map(t=>c({...t,abi:e}))}function Y(e,a,t){return t.map(n=>u({...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 p=[{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 le(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:p,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 ce={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{le as callFrom,ce as callWithSignatureTypes,c as encodeSystemCall,u as encodeSystemCallFrom,z as encodeSystemCalls,Y as encodeSystemCallsFrom,R as resolveTableId,k as resolveWithContext};
3
3
  //# sourceMappingURL=internal.js.map
@@ -358,348 +358,329 @@ declare const _default: {
358
358
  readonly world: {
359
359
  readonly label: "world";
360
360
  readonly namespace: string;
361
- readonly tables: {
362
- readonly NamespaceOwner: {
363
- readonly label: "NamespaceOwner";
364
- readonly type: "table";
365
- readonly namespace: string;
366
- readonly name: string;
367
- readonly tableId: `0x${string}`;
361
+ readonly tables: _latticexyz_store_config_v2.resolveTables<{
362
+ readonly NamespaceOwner: _latticexyz_store_config_v2.mergeIfUndefined<{
368
363
  readonly schema: {
369
- readonly namespaceId: {
370
- readonly type: "bytes32";
371
- readonly internalType: "ResourceId";
372
- };
373
- readonly owner: {
374
- readonly type: "address";
375
- readonly internalType: "address";
376
- };
364
+ readonly namespaceId: "ResourceId";
365
+ readonly owner: "address";
377
366
  };
378
367
  readonly key: readonly ["namespaceId"];
379
- readonly codegen: {
380
- readonly outputDirectory: string;
381
- readonly tableIdArgument: false;
382
- readonly storeArgument: false;
383
- readonly dataStruct: boolean;
384
- };
385
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
386
- readonly disabled: false;
387
- }>;
388
- };
389
- readonly ResourceAccess: {
390
- readonly label: "ResourceAccess";
391
- readonly type: "table";
368
+ }, {
392
369
  readonly namespace: string;
393
- readonly name: string;
394
- readonly tableId: `0x${string}`;
370
+ }>;
371
+ readonly ResourceAccess: _latticexyz_store_config_v2.mergeIfUndefined<{
395
372
  readonly schema: {
396
- readonly resourceId: {
397
- readonly type: "bytes32";
398
- readonly internalType: "ResourceId";
399
- };
400
- readonly caller: {
401
- readonly type: "address";
402
- readonly internalType: "address";
403
- };
404
- readonly access: {
405
- readonly type: "bool";
406
- readonly internalType: "bool";
407
- };
373
+ readonly resourceId: "ResourceId";
374
+ readonly caller: "address";
375
+ readonly access: "bool";
408
376
  };
409
377
  readonly key: readonly ["resourceId", "caller"];
410
- readonly codegen: {
411
- readonly outputDirectory: string;
412
- readonly tableIdArgument: false;
413
- readonly storeArgument: false;
414
- readonly dataStruct: boolean;
415
- };
416
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
417
- readonly disabled: false;
418
- }>;
419
- };
420
- readonly InstalledModules: {
421
- readonly label: "InstalledModules";
422
- readonly type: "table";
378
+ }, {
423
379
  readonly namespace: string;
424
- readonly name: string;
425
- readonly tableId: `0x${string}`;
380
+ }>;
381
+ readonly InstalledModules: _latticexyz_store_config_v2.mergeIfUndefined<{
426
382
  readonly schema: {
427
- readonly moduleAddress: {
428
- readonly type: "address";
429
- readonly internalType: "address";
430
- };
431
- readonly argumentsHash: {
432
- readonly type: "bytes32";
433
- readonly internalType: "bytes32";
434
- };
435
- readonly isInstalled: {
436
- readonly type: "bool";
437
- readonly internalType: "bool";
438
- };
383
+ readonly moduleAddress: "address";
384
+ readonly argumentsHash: "bytes32";
385
+ readonly isInstalled: "bool";
439
386
  };
440
387
  readonly key: readonly ["moduleAddress", "argumentsHash"];
441
- readonly codegen: {
442
- readonly outputDirectory: string;
443
- readonly tableIdArgument: false;
444
- readonly storeArgument: false;
445
- readonly dataStruct: boolean;
446
- };
447
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
448
- readonly disabled: false;
449
- }>;
450
- };
451
- readonly UserDelegationControl: {
452
- readonly label: "UserDelegationControl";
453
- readonly type: "table";
388
+ }, {
454
389
  readonly namespace: string;
455
- readonly name: string;
456
- readonly tableId: `0x${string}`;
390
+ }>;
391
+ readonly UserDelegationControl: _latticexyz_store_config_v2.mergeIfUndefined<{
457
392
  readonly schema: {
458
- readonly delegator: {
459
- readonly type: "address";
460
- readonly internalType: "address";
461
- };
462
- readonly delegatee: {
463
- readonly type: "address";
464
- readonly internalType: "address";
465
- };
466
- readonly delegationControlId: {
467
- readonly type: "bytes32";
468
- readonly internalType: "ResourceId";
469
- };
393
+ readonly delegator: "address";
394
+ readonly delegatee: "address";
395
+ readonly delegationControlId: "ResourceId";
470
396
  };
471
397
  readonly key: readonly ["delegator", "delegatee"];
472
- readonly codegen: {
473
- readonly outputDirectory: string;
474
- readonly tableIdArgument: false;
475
- readonly storeArgument: false;
476
- readonly dataStruct: boolean;
477
- };
478
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
479
- readonly disabled: false;
480
- }>;
481
- };
482
- readonly NamespaceDelegationControl: {
483
- readonly label: "NamespaceDelegationControl";
484
- readonly type: "table";
398
+ }, {
485
399
  readonly namespace: string;
486
- readonly name: string;
487
- readonly tableId: `0x${string}`;
400
+ }>;
401
+ readonly NamespaceDelegationControl: _latticexyz_store_config_v2.mergeIfUndefined<{
488
402
  readonly schema: {
489
- readonly namespaceId: {
490
- readonly type: "bytes32";
491
- readonly internalType: "ResourceId";
492
- };
493
- readonly delegationControlId: {
494
- readonly type: "bytes32";
495
- readonly internalType: "ResourceId";
496
- };
403
+ readonly namespaceId: "ResourceId";
404
+ readonly delegationControlId: "ResourceId";
497
405
  };
498
406
  readonly key: readonly ["namespaceId"];
499
- readonly codegen: {
500
- readonly outputDirectory: string;
501
- readonly tableIdArgument: false;
502
- readonly storeArgument: false;
503
- readonly dataStruct: boolean;
504
- };
505
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
506
- readonly disabled: false;
507
- }>;
508
- };
509
- readonly Balances: {
510
- readonly label: "Balances";
511
- readonly type: "table";
407
+ }, {
512
408
  readonly namespace: string;
513
- readonly name: string;
514
- readonly tableId: `0x${string}`;
409
+ }>;
410
+ readonly Balances: _latticexyz_store_config_v2.mergeIfUndefined<{
515
411
  readonly schema: {
516
- readonly namespaceId: {
517
- readonly type: "bytes32";
518
- readonly internalType: "ResourceId";
519
- };
520
- readonly balance: {
521
- readonly type: "uint256";
522
- readonly internalType: "uint256";
523
- };
412
+ readonly namespaceId: "ResourceId";
413
+ readonly balance: "uint256";
524
414
  };
525
415
  readonly key: readonly ["namespaceId"];
526
- readonly codegen: {
527
- readonly outputDirectory: string;
528
- readonly tableIdArgument: false;
529
- readonly storeArgument: false;
530
- readonly dataStruct: boolean;
531
- };
532
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
533
- readonly disabled: false;
534
- }>;
535
- };
536
- readonly Systems: {
537
- readonly label: "Systems";
538
- readonly type: "table";
416
+ }, {
539
417
  readonly namespace: string;
540
- readonly name: string;
541
- readonly tableId: `0x${string}`;
418
+ }>;
419
+ readonly Systems: _latticexyz_store_config_v2.mergeIfUndefined<{
542
420
  readonly schema: {
543
- readonly systemId: {
544
- readonly type: "bytes32";
545
- readonly internalType: "ResourceId";
546
- };
547
- readonly system: {
548
- readonly type: "address";
549
- readonly internalType: "address";
550
- };
551
- readonly publicAccess: {
552
- readonly type: "bool";
553
- readonly internalType: "bool";
554
- };
421
+ readonly systemId: "ResourceId";
422
+ readonly system: "address";
423
+ readonly publicAccess: "bool";
555
424
  };
556
425
  readonly key: readonly ["systemId"];
557
426
  readonly codegen: {
558
- readonly outputDirectory: string;
559
- readonly tableIdArgument: false;
560
- readonly storeArgument: false;
561
427
  readonly dataStruct: false;
562
428
  };
563
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
564
- readonly disabled: false;
565
- }>;
566
- };
567
- readonly SystemRegistry: {
568
- readonly label: "SystemRegistry";
569
- readonly type: "table";
429
+ }, {
570
430
  readonly namespace: string;
571
- readonly name: string;
572
- readonly tableId: `0x${string}`;
431
+ }>;
432
+ readonly SystemRegistry: _latticexyz_store_config_v2.mergeIfUndefined<{
573
433
  readonly schema: {
574
- readonly system: {
575
- readonly type: "address";
576
- readonly internalType: "address";
577
- };
578
- readonly systemId: {
579
- readonly type: "bytes32";
580
- readonly internalType: "ResourceId";
581
- };
434
+ readonly system: "address";
435
+ readonly systemId: "ResourceId";
582
436
  };
583
437
  readonly key: readonly ["system"];
584
- readonly codegen: {
585
- readonly outputDirectory: string;
586
- readonly tableIdArgument: false;
587
- readonly storeArgument: false;
588
- readonly dataStruct: boolean;
589
- };
590
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
591
- readonly disabled: false;
592
- }>;
593
- };
594
- readonly SystemHooks: {
595
- readonly label: "SystemHooks";
596
- readonly type: "table";
438
+ }, {
597
439
  readonly namespace: string;
598
- readonly name: string;
599
- readonly tableId: `0x${string}`;
440
+ }>;
441
+ readonly SystemHooks: _latticexyz_store_config_v2.mergeIfUndefined<{
600
442
  readonly schema: {
601
- readonly systemId: {
602
- readonly type: "bytes32";
603
- readonly internalType: "ResourceId";
604
- };
605
- readonly value: {
606
- readonly type: "bytes21[]";
607
- readonly internalType: "bytes21[]";
608
- };
443
+ readonly systemId: "ResourceId";
444
+ readonly value: "bytes21[]";
609
445
  };
610
446
  readonly key: readonly ["systemId"];
611
- readonly codegen: {
612
- readonly outputDirectory: string;
613
- readonly tableIdArgument: false;
614
- readonly storeArgument: false;
615
- readonly dataStruct: boolean;
616
- };
617
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
618
- readonly disabled: false;
619
- }>;
620
- };
621
- readonly FunctionSelectors: {
622
- readonly label: "FunctionSelectors";
623
- readonly type: "table";
447
+ }, {
624
448
  readonly namespace: string;
625
- readonly name: string;
626
- readonly tableId: `0x${string}`;
449
+ }>;
450
+ readonly FunctionSelectors: _latticexyz_store_config_v2.mergeIfUndefined<{
627
451
  readonly schema: {
628
- readonly worldFunctionSelector: {
629
- readonly type: "bytes4";
630
- readonly internalType: "bytes4";
631
- };
632
- readonly systemId: {
633
- readonly type: "bytes32";
634
- readonly internalType: "ResourceId";
635
- };
636
- readonly systemFunctionSelector: {
637
- readonly type: "bytes4";
638
- readonly internalType: "bytes4";
639
- };
452
+ readonly worldFunctionSelector: "bytes4";
453
+ readonly systemId: "ResourceId";
454
+ readonly systemFunctionSelector: "bytes4";
640
455
  };
641
456
  readonly key: readonly ["worldFunctionSelector"];
642
457
  readonly codegen: {
643
- readonly outputDirectory: string;
644
- readonly tableIdArgument: false;
645
- readonly storeArgument: false;
646
458
  readonly dataStruct: false;
647
459
  };
648
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
649
- readonly disabled: false;
650
- }>;
651
- };
652
- readonly FunctionSignatures: {
653
- readonly label: "FunctionSignatures";
654
- readonly type: "offchainTable";
460
+ }, {
655
461
  readonly namespace: string;
656
- readonly name: string;
657
- readonly tableId: `0x${string}`;
462
+ }>;
463
+ readonly FunctionSignatures: _latticexyz_store_config_v2.mergeIfUndefined<{
464
+ readonly type: "offchainTable";
658
465
  readonly schema: {
659
- readonly functionSelector: {
660
- readonly type: "bytes4";
661
- readonly internalType: "bytes4";
662
- };
663
- readonly functionSignature: {
664
- readonly type: "string";
665
- readonly internalType: "string";
666
- };
466
+ readonly functionSelector: "bytes4";
467
+ readonly functionSignature: "string";
667
468
  };
668
469
  readonly key: readonly ["functionSelector"];
669
- readonly codegen: {
670
- readonly outputDirectory: string;
671
- readonly tableIdArgument: false;
672
- readonly storeArgument: false;
673
- readonly dataStruct: boolean;
674
- };
675
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
676
- readonly disabled: false;
677
- }>;
678
- };
679
- readonly InitModuleAddress: {
680
- readonly label: "InitModuleAddress";
681
- readonly type: "table";
470
+ }, {
682
471
  readonly namespace: string;
683
- readonly name: string;
684
- readonly tableId: `0x${string}`;
472
+ }>;
473
+ readonly InitModuleAddress: _latticexyz_store_config_v2.mergeIfUndefined<{
685
474
  readonly schema: {
686
- readonly value: {
687
- readonly type: "address";
688
- readonly internalType: "address";
689
- };
475
+ readonly value: "address";
690
476
  };
691
477
  readonly key: readonly [];
692
- readonly codegen: {
693
- readonly outputDirectory: string;
694
- readonly tableIdArgument: false;
695
- readonly storeArgument: false;
696
- readonly dataStruct: boolean;
697
- };
698
- readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
699
- readonly disabled: false;
700
- }>;
478
+ }, {
479
+ readonly namespace: string;
480
+ }>;
481
+ }, {
482
+ types: {
483
+ string: "string";
484
+ bytes32: "bytes32";
485
+ uint8: "uint8";
486
+ uint16: "uint16";
487
+ uint24: "uint24";
488
+ uint32: "uint32";
489
+ uint40: "uint40";
490
+ uint48: "uint48";
491
+ uint56: "uint56";
492
+ uint64: "uint64";
493
+ uint72: "uint72";
494
+ uint80: "uint80";
495
+ uint88: "uint88";
496
+ uint96: "uint96";
497
+ uint104: "uint104";
498
+ uint112: "uint112";
499
+ uint120: "uint120";
500
+ uint128: "uint128";
501
+ uint136: "uint136";
502
+ uint144: "uint144";
503
+ uint152: "uint152";
504
+ uint160: "uint160";
505
+ uint168: "uint168";
506
+ uint176: "uint176";
507
+ uint184: "uint184";
508
+ uint192: "uint192";
509
+ uint200: "uint200";
510
+ uint208: "uint208";
511
+ uint216: "uint216";
512
+ uint224: "uint224";
513
+ uint232: "uint232";
514
+ uint240: "uint240";
515
+ uint248: "uint248";
516
+ uint256: "uint256";
517
+ int8: "int8";
518
+ int16: "int16";
519
+ int24: "int24";
520
+ int32: "int32";
521
+ int40: "int40";
522
+ int48: "int48";
523
+ int56: "int56";
524
+ int64: "int64";
525
+ int72: "int72";
526
+ int80: "int80";
527
+ int88: "int88";
528
+ int96: "int96";
529
+ int104: "int104";
530
+ int112: "int112";
531
+ int120: "int120";
532
+ int128: "int128";
533
+ int136: "int136";
534
+ int144: "int144";
535
+ int152: "int152";
536
+ int160: "int160";
537
+ int168: "int168";
538
+ int176: "int176";
539
+ int184: "int184";
540
+ int192: "int192";
541
+ int200: "int200";
542
+ int208: "int208";
543
+ int216: "int216";
544
+ int224: "int224";
545
+ int232: "int232";
546
+ int240: "int240";
547
+ int248: "int248";
548
+ int256: "int256";
549
+ bytes1: "bytes1";
550
+ bytes2: "bytes2";
551
+ bytes3: "bytes3";
552
+ bytes4: "bytes4";
553
+ bytes5: "bytes5";
554
+ bytes6: "bytes6";
555
+ bytes7: "bytes7";
556
+ bytes8: "bytes8";
557
+ bytes9: "bytes9";
558
+ bytes10: "bytes10";
559
+ bytes11: "bytes11";
560
+ bytes12: "bytes12";
561
+ bytes13: "bytes13";
562
+ bytes14: "bytes14";
563
+ bytes15: "bytes15";
564
+ bytes16: "bytes16";
565
+ bytes17: "bytes17";
566
+ bytes18: "bytes18";
567
+ bytes19: "bytes19";
568
+ bytes20: "bytes20";
569
+ bytes21: "bytes21";
570
+ bytes22: "bytes22";
571
+ bytes23: "bytes23";
572
+ bytes24: "bytes24";
573
+ bytes25: "bytes25";
574
+ bytes26: "bytes26";
575
+ bytes27: "bytes27";
576
+ bytes28: "bytes28";
577
+ bytes29: "bytes29";
578
+ bytes30: "bytes30";
579
+ bytes31: "bytes31";
580
+ bool: "bool";
581
+ address: "address";
582
+ "uint8[]": "uint8[]";
583
+ "uint16[]": "uint16[]";
584
+ "uint24[]": "uint24[]";
585
+ "uint32[]": "uint32[]";
586
+ "uint40[]": "uint40[]";
587
+ "uint48[]": "uint48[]";
588
+ "uint56[]": "uint56[]";
589
+ "uint64[]": "uint64[]";
590
+ "uint72[]": "uint72[]";
591
+ "uint80[]": "uint80[]";
592
+ "uint88[]": "uint88[]";
593
+ "uint96[]": "uint96[]";
594
+ "uint104[]": "uint104[]";
595
+ "uint112[]": "uint112[]";
596
+ "uint120[]": "uint120[]";
597
+ "uint128[]": "uint128[]";
598
+ "uint136[]": "uint136[]";
599
+ "uint144[]": "uint144[]";
600
+ "uint152[]": "uint152[]";
601
+ "uint160[]": "uint160[]";
602
+ "uint168[]": "uint168[]";
603
+ "uint176[]": "uint176[]";
604
+ "uint184[]": "uint184[]";
605
+ "uint192[]": "uint192[]";
606
+ "uint200[]": "uint200[]";
607
+ "uint208[]": "uint208[]";
608
+ "uint216[]": "uint216[]";
609
+ "uint224[]": "uint224[]";
610
+ "uint232[]": "uint232[]";
611
+ "uint240[]": "uint240[]";
612
+ "uint248[]": "uint248[]";
613
+ "uint256[]": "uint256[]";
614
+ "int8[]": "int8[]";
615
+ "int16[]": "int16[]";
616
+ "int24[]": "int24[]";
617
+ "int32[]": "int32[]";
618
+ "int40[]": "int40[]";
619
+ "int48[]": "int48[]";
620
+ "int56[]": "int56[]";
621
+ "int64[]": "int64[]";
622
+ "int72[]": "int72[]";
623
+ "int80[]": "int80[]";
624
+ "int88[]": "int88[]";
625
+ "int96[]": "int96[]";
626
+ "int104[]": "int104[]";
627
+ "int112[]": "int112[]";
628
+ "int120[]": "int120[]";
629
+ "int128[]": "int128[]";
630
+ "int136[]": "int136[]";
631
+ "int144[]": "int144[]";
632
+ "int152[]": "int152[]";
633
+ "int160[]": "int160[]";
634
+ "int168[]": "int168[]";
635
+ "int176[]": "int176[]";
636
+ "int184[]": "int184[]";
637
+ "int192[]": "int192[]";
638
+ "int200[]": "int200[]";
639
+ "int208[]": "int208[]";
640
+ "int216[]": "int216[]";
641
+ "int224[]": "int224[]";
642
+ "int232[]": "int232[]";
643
+ "int240[]": "int240[]";
644
+ "int248[]": "int248[]";
645
+ "int256[]": "int256[]";
646
+ "bytes1[]": "bytes1[]";
647
+ "bytes2[]": "bytes2[]";
648
+ "bytes3[]": "bytes3[]";
649
+ "bytes4[]": "bytes4[]";
650
+ "bytes5[]": "bytes5[]";
651
+ "bytes6[]": "bytes6[]";
652
+ "bytes7[]": "bytes7[]";
653
+ "bytes8[]": "bytes8[]";
654
+ "bytes9[]": "bytes9[]";
655
+ "bytes10[]": "bytes10[]";
656
+ "bytes11[]": "bytes11[]";
657
+ "bytes12[]": "bytes12[]";
658
+ "bytes13[]": "bytes13[]";
659
+ "bytes14[]": "bytes14[]";
660
+ "bytes15[]": "bytes15[]";
661
+ "bytes16[]": "bytes16[]";
662
+ "bytes17[]": "bytes17[]";
663
+ "bytes18[]": "bytes18[]";
664
+ "bytes19[]": "bytes19[]";
665
+ "bytes20[]": "bytes20[]";
666
+ "bytes21[]": "bytes21[]";
667
+ "bytes22[]": "bytes22[]";
668
+ "bytes23[]": "bytes23[]";
669
+ "bytes24[]": "bytes24[]";
670
+ "bytes25[]": "bytes25[]";
671
+ "bytes26[]": "bytes26[]";
672
+ "bytes27[]": "bytes27[]";
673
+ "bytes28[]": "bytes28[]";
674
+ "bytes29[]": "bytes29[]";
675
+ "bytes30[]": "bytes30[]";
676
+ "bytes31[]": "bytes31[]";
677
+ "bytes32[]": "bytes32[]";
678
+ "bool[]": "bool[]";
679
+ "address[]": "address[]";
680
+ bytes: "bytes";
681
+ readonly ResourceId: "bytes32";
701
682
  };
702
- };
683
+ }>;
703
684
  };
704
685
  };
705
686
  readonly systems: {};
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-OZBNK257.js";import"./chunk-BH75YTBY.js";import"./chunk-DK3XOTC2.js";export{a as default};
1
+ import{a}from"./chunk-2DPDMM6H.js";import"./chunk-3EELS6P3.js";import"./chunk-DK3XOTC2.js";export{a as default};
2
2
  //# sourceMappingURL=mud.config.js.map
@@ -1,5 +1,5 @@
1
1
  import { show, ErrorMessage, narrow, requiredKeyOf, conform, withJsDoc } from '@arktype/util';
2
- import { StoreInput, StoreWithShorthandsInput, resolveTable, mergeIfUndefined, getPath, extendedScope, validateTables, UserTypes, resolveStore, Store } from '@latticexyz/store/config/v2';
2
+ import { StoreInput, resolveTable, mergeIfUndefined, expandTableShorthand, getPath, extendedScope, validateTables, UserTypes, resolveStore, Store } from '@latticexyz/store/config/v2';
3
3
  import { V as ValueWithType, c as DynamicResolution, W as World } from './dynamicResolution-34391fca.js';
4
4
  import { Hex } from 'viem';
5
5
 
@@ -108,8 +108,6 @@ type NamespacesInput = {
108
108
  readonly [label: string]: NamespaceInput;
109
109
  };
110
110
  type NamespaceInput = Pick<StoreInput, "tables">;
111
- /******** Variations with shorthands ********/
112
- type WorldWithShorthandsInput = Omit<WorldInput, "tables"> & Pick<StoreWithShorthandsInput, "tables">;
113
111
 
114
112
  declare const SYSTEM_DEFAULTS: {
115
113
  readonly namespace: "";
@@ -193,7 +191,7 @@ type namespacedTableKeys<world> = world extends {
193
191
  } ? `${k & string}__${keyof tables & string}` : never;
194
192
  }[keyof namespaces] : never;
195
193
  type resolveNamespacedTables<world> = "namespaces" extends keyof world ? {
196
- readonly [key in namespacedTableKeys<world>]: key extends `${infer namespace}__${infer table}` ? resolveTable<mergeIfUndefined<getPath<world, ["namespaces", namespace, "tables", table]>, {
194
+ readonly [key in namespacedTableKeys<world>]: key extends `${infer namespace}__${infer table}` ? resolveTable<mergeIfUndefined<expandTableShorthand<getPath<world, ["namespaces", namespace, "tables", table]>>, {
197
195
  name: table;
198
196
  namespace: namespace;
199
197
  }>, extendedScope<world>> : never;
@@ -217,4 +215,4 @@ type resolveWorld<world, namespace = resolveStore<world>["namespace"]> = withJsD
217
215
  declare function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world>;
218
216
  declare function defineWorld<const input>(input: validateWorld<input>): resolveWorld<input>;
219
217
 
220
- export { WorldWithShorthandsInput as W, defineWorld as d, resolveWorld as r, validateWorld as v };
218
+ export { 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": "3.0.0-main-2da9e48cd",
3
+ "version": "3.0.0-main-fb1cfef0c",
4
4
  "description": "World framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,11 +47,11 @@
47
47
  "abitype": "1.0.0",
48
48
  "arktype": "1.0.29-alpha",
49
49
  "viem": "2.9.20",
50
- "@latticexyz/config": "3.0.0-main-2da9e48cd",
51
- "@latticexyz/protocol-parser": "3.0.0-main-2da9e48cd",
52
- "@latticexyz/schema-type": "3.0.0-main-2da9e48cd",
53
- "@latticexyz/store": "3.0.0-main-2da9e48cd",
54
- "@latticexyz/common": "3.0.0-main-2da9e48cd"
50
+ "@latticexyz/common": "3.0.0-main-fb1cfef0c",
51
+ "@latticexyz/config": "3.0.0-main-fb1cfef0c",
52
+ "@latticexyz/protocol-parser": "3.0.0-main-fb1cfef0c",
53
+ "@latticexyz/store": "3.0.0-main-fb1cfef0c",
54
+ "@latticexyz/schema-type": "3.0.0-main-fb1cfef0c"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@arktype/attest": "0.7.5",
@@ -66,8 +66,8 @@
66
66
  "tsup": "^6.7.0",
67
67
  "tsx": "^3.12.6",
68
68
  "vitest": "0.34.6",
69
- "@latticexyz/abi-ts": "3.0.0-main-2da9e48cd",
70
- "@latticexyz/gas-report": "3.0.0-main-2da9e48cd"
69
+ "@latticexyz/abi-ts": "3.0.0-main-fb1cfef0c",
70
+ "@latticexyz/gas-report": "3.0.0-main-fb1cfef0c"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts && pnpm run build:js",
@@ -1,2 +0,0 @@
1
- import{h as c,i as p,j as l,k as r,l as i,m as y}from"./chunk-DK3XOTC2.js";import{extendedScope as k,get as j,resolveTable as L,validateTable as F,mergeIfUndefined as a,resolveStore as $,hasOwnKey as S,validateStore as C}from"@latticexyz/store/config/v2";import{isObject as w}from"@latticexyz/store/config/v2";function f(e){if(w(e)){for(let s of Object.values(e))i(s,{inNamespace:!0});return}throw new Error(`Expected system config, received ${JSON.stringify(e)}`)}function v(e,s){return Object.fromEntries(Object.entries(e).map(([o,n])=>[o,y({...n,label:o,namespace:s})]))}import{validateTables as I,isObject as N,hasOwnKey as O}from"@latticexyz/store/config/v2";function D(e,s){O(e,"tables")&&I(e.tables,s)}function b(e,s){if(!N(e))throw new Error(`Expected namespaces, received ${JSON.stringify(e)}`);for(let o of Object.values(e))D(o,s)}import{isObject as U,mergeIfUndefined as W}from"@latticexyz/store/config/v2";function u(e){return U(e)?W(e,p):p}import{mergeIfUndefined as _,isObject as A}from"@latticexyz/store/config/v2";function x(e){return A(e)?_(e,l):l}function h(e){let s=k(e);C(e),S(e,"systems")&&f(e.systems),S(e,"namespaces")&&b(e.namespaces,s)}function M(e){let s=k(e),o=$(e),n=e.namespaces??{},g=Object.fromEntries(Object.entries(n).map(([t,T])=>Object.entries(T.tables??{}).map(([m,d])=>(F(d,s),[`${t}__${m}`,L(a(d,{namespace:t,name:m}),s)]))).flat()),E=(e.modules??r.modules).map(t=>a(t,c));return a({...o,tables:{...o.tables,...g},codegen:a(o.codegen,u(e.codegen)),deploy:x(e.deploy),systems:v(e.systems??r.systems,o.namespace),excludeSystems:j(e,"excludeSystems"),modules:E},r)}function ye(e){return h(e),M(e)}export{h as a,M as b,ye as c};
2
- //# sourceMappingURL=chunk-BH75YTBY.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../ts/config/v2/world.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, narrow, type withJsDoc } 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, validateSystems } from \"./systems\";\nimport { resolveNamespacedTables, validateNamespaces } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\nimport type { World } from \"./output.js\";\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 \"systems\"\n ? validateSystems<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, \"systems\")) {\n validateSystems(world.systems);\n }\n if (hasOwnKey(world, \"namespaces\")) {\n validateNamespaces(world.namespaces, scope);\n }\n}\n\nexport type resolveWorld<world, namespace = resolveStore<world>[\"namespace\"]> = withJsDoc<\n resolveStore<world> &\n mergeIfUndefined<\n { readonly tables: resolveNamespacedTables<world> } & {\n [key in Exclude<keyof world, keyof Store>]: key extends \"systems\"\n ? resolveSystems<world[key] & SystemsInput, namespace & string>\n : key extends \"deploy\"\n ? resolveDeploy<world[key]>\n : key extends \"codegen\"\n ? resolveCodegen<world[key]>\n : world[key];\n },\n CONFIG_DEFAULTS\n >,\n World\n>;\n\nexport function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world> {\n const scope = extendedScope(world);\n const resolvedStore = resolveStore(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 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, resolvedStore.namespace),\n excludeSystems: get(world, \"excludeSystems\"),\n modules,\n },\n CONFIG_DEFAULTS,\n ) as never;\n}\n\nexport function defineWorld<const input>(input: validateWorld<input>): resolveWorld<input> {\n validateWorld(input);\n return resolveWorld(input) as never;\n}\n","import { ErrorMessage } from \"@arktype/util\";\nimport { isObject } from \"@latticexyz/store/config/v2\";\nimport { SystemsInput } from \"./input\";\nimport { resolveSystem, validateSystem } from \"./system\";\n\n// TODO: add nuance between \"in namespace\" (namespace provided in context) and \"in systems\" (label provided in context)\n\nexport type validateSystems<input> = {\n [label in keyof input]: input[label] extends object\n ? validateSystem<input[label], { inNamespace: true }>\n : ErrorMessage<`Expected a system config for ${label & string}.`>;\n};\n\nexport function validateSystems(input: unknown): asserts input is SystemsInput {\n if (isObject(input)) {\n for (const table of Object.values(input)) {\n validateSystem(table, { inNamespace: true });\n }\n return;\n }\n throw new Error(`Expected system config, received ${JSON.stringify(input)}`);\n}\n\nexport type resolveSystems<systems extends SystemsInput, namespace extends string> = {\n [label in keyof systems]: resolveSystem<systems[label] & { label: label; namespace: namespace }>;\n};\n\nexport function resolveSystems<systems extends SystemsInput, namespace extends string>(\n systems: systems,\n namespace: namespace,\n): resolveSystems<systems, namespace> {\n return Object.fromEntries(\n Object.entries(systems).map(([label, system]) => {\n return [label, resolveSystem({ ...system, label, namespace })];\n }),\n ) as never;\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 [label in keyof namespaces]: validateNamespace<namespaces[label], 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":"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","names":["extendedScope","get","resolveTable","validateTable","mergeIfUndefined","resolveStore","hasOwnKey","validateStore","isObject","validateSystems","input","isObject","table","validateSystem","resolveSystems","systems","namespace","label","system","resolveSystem","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","validateSystems","validateNamespaces","resolveWorld","resolvedStore","resolveStore","namespaces","resolvedNamespacedTables","namespaceKey","namespace","tableKey","table","validateTable","resolveTable","mergeIfUndefined","modules","CONFIG_DEFAULTS","mod","MODULE_DEFAULTS","resolveCodegen","resolveDeploy","resolveSystems","get","defineWorld","input"]}