@latticexyz/world 3.0.0-main-61895408d → 3.0.0-main-3440a86b5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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{a as l,b as n}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=e.tables?p(e.tables,r=>f(r)?y(r,o):r):null,d={...e,...t?{tables:t}:null};return l(d),n(d)}function u(e){return S(e),m(e)}export{u as defineWorld,W as helloWorldEvent,i 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","../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 = world.tables\n ? mapObject(world.tables, (table) => {\n return isTableShorthandInput(table) ? resolveTableShorthand(table, scope) : table;\n })\n : null;\n\n const fullConfig = {\n ...world,\n ...(tables ? { tables } : null),\n };\n\n validateWorld(fullConfig);\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,EAAST,EAAM,OACjBU,EAAUV,EAAM,OAASW,GAChBC,EAAsBD,CAAK,EAAIE,EAAsBF,EAAOV,CAAK,EAAIU,CAC7E,EACD,KAEEG,EAAa,CACjB,GAAGd,EACH,GAAIS,EAAS,CAAE,OAAAA,CAAO,EAAI,IAC5B,EAEA,OAAAM,EAAcD,CAAU,EACjBE,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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/world",
3
- "version": "3.0.0-main-61895408d",
3
+ "version": "3.0.0-main-3440a86b5",
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/common": "3.0.0-main-61895408d",
51
- "@latticexyz/protocol-parser": "3.0.0-main-61895408d",
52
- "@latticexyz/store": "3.0.0-main-61895408d",
53
- "@latticexyz/config": "3.0.0-main-61895408d",
54
- "@latticexyz/schema-type": "3.0.0-main-61895408d"
50
+ "@latticexyz/protocol-parser": "3.0.0-main-3440a86b5",
51
+ "@latticexyz/config": "3.0.0-main-3440a86b5",
52
+ "@latticexyz/common": "3.0.0-main-3440a86b5",
53
+ "@latticexyz/store": "3.0.0-main-3440a86b5",
54
+ "@latticexyz/schema-type": "3.0.0-main-3440a86b5"
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-61895408d",
70
- "@latticexyz/gas-report": "3.0.0-main-61895408d"
69
+ "@latticexyz/abi-ts": "3.0.0-main-3440a86b5",
70
+ "@latticexyz/gas-report": "3.0.0-main-3440a86b5"
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",