@latticexyz/store 3.0.0-main-fb1cfef0c → 3.0.0-main-570086e7b

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.
Files changed (60) hide show
  1. package/dist/chunk-7BUS2KVD.js +2 -0
  2. package/dist/chunk-7BUS2KVD.js.map +1 -0
  3. package/dist/codegen.d.ts +27 -13
  4. package/dist/codegen.js +177 -177
  5. package/dist/codegen.js.map +1 -1
  6. package/dist/config/v2.d.ts +3 -3
  7. package/dist/config/v2.js +1 -1
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +1 -1
  10. package/dist/{input-48d1368b.d.ts → input-e69ffb2f.d.ts} +9 -3
  11. package/dist/mud.config.d.ts +4 -4
  12. package/dist/mud.config.js +1 -1
  13. package/dist/mud.config.js.map +1 -1
  14. package/dist/{namespacedTables-8a81e0a2.d.ts → namespacedTables-264f21b1.d.ts} +2 -2
  15. package/dist/{store-6077eba5.d.ts → store-122dc6fd.d.ts} +9 -5
  16. package/out/Callbacks.sol/Callbacks.json +1 -1
  17. package/out/Callbacks.t.sol/CallbacksTest.json +1 -1
  18. package/out/Gas.t.sol/GasTest.json +1 -1
  19. package/out/Gas.t.sol/SolidityStorage.json +1 -1
  20. package/out/Gas.t.sol/SomeContract.json +1 -1
  21. package/out/GasStorageLoad.t.sol/GasStorageLoadTest.json +1 -1
  22. package/out/Hook.sol/HookInstance.json +1 -1
  23. package/out/Hook.sol/HookLib.json +1 -1
  24. package/out/Hook.t.sol/HookTest.json +1 -1
  25. package/out/Hooks.sol/Hooks.json +1 -1
  26. package/out/KeyEncoding.sol/KeyEncoding.json +1 -1
  27. package/out/KeyEncoding.t.sol/KeyEncodingTest.json +1 -1
  28. package/out/MirrorSubscriber.sol/MirrorSubscriber.json +1 -1
  29. package/out/Mixed.sol/Mixed.json +1 -1
  30. package/out/Mixed.t.sol/MixedTest.json +1 -1
  31. package/out/ResourceIds.sol/ResourceIds.json +1 -1
  32. package/out/Store.sol/Store.json +1 -1
  33. package/out/StoreCore.sol/StoreCore.json +1 -1
  34. package/out/StoreCore.sol/StoreCoreInternal.json +1 -1
  35. package/out/StoreCore.t.sol/StoreCoreTest.json +1 -1
  36. package/out/StoreCoreDynamic.t.sol/StoreCoreDynamicTest.json +1 -1
  37. package/out/StoreCoreGas.t.sol/StoreCoreGasTest.json +1 -1
  38. package/out/StoreHook.t.sol/StoreHookTest.json +1 -1
  39. package/out/StoreHooks.sol/StoreHooks.json +1 -1
  40. package/out/StoreHooks.t.sol/StoreHooksTest.json +1 -1
  41. package/out/StoreHooksColdLoad.t.sol/StoreHooksColdLoadTest.json +1 -1
  42. package/out/StoreKernel.sol/StoreKernel.json +1 -1
  43. package/out/StoreMock.sol/StoreMock.json +1 -1
  44. package/out/StoreMock.t.sol/StoreMockTest.json +1 -1
  45. package/out/StoreRead.sol/StoreRead.json +1 -1
  46. package/out/StoreSwitch.sol/StoreSwitch.json +1 -1
  47. package/out/StoreSwitch.t.sol/MockSystem.json +1 -1
  48. package/out/StoreSwitch.t.sol/StoreSwitchTest.json +1 -1
  49. package/out/StoreSwitch.t.sol/StoreSwitchTestStore.json +1 -1
  50. package/out/Tables.sol/Tables.json +1 -1
  51. package/out/Vector2.sol/Vector2.json +1 -1
  52. package/out/Vector2.t.sol/Vector2Test.json +1 -1
  53. package/out/build-info/{ab717ad6a3f348702f22d62ec82363af.json → 946dc2faf2e29137d1fd87e41e62942e.json} +1 -1
  54. package/package.json +7 -7
  55. package/src/codegen/tables/Hooks.sol +1 -1
  56. package/src/codegen/tables/ResourceIds.sol +1 -1
  57. package/src/codegen/tables/StoreHooks.sol +1 -1
  58. package/src/codegen/tables/Tables.sol +3 -3
  59. package/dist/chunk-JX6B2S4J.js +0 -2
  60. package/dist/chunk-JX6B2S4J.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ function a(e,t){return typeof e=="object"&&e!=null&&s(e,t)?e[t]:void 0}function M(e,t){return t.length?M(a(e,t[0]),t.slice(1)):e}function s(e,t){return typeof e=="object"&&e!==null&&e.hasOwnProperty(t)}function p(e){return e!=null&&typeof e=="object"}function c(e,t){let o=[...new Set([...Object.keys(e),...Object.keys(t)])];return Object.fromEntries(o.map(n=>[n,typeof e[n]>"u"?t[n]:e[n]]))}var T={storeImportPath:"@latticexyz/store/src",userTypesFilename:"common.sol",outputDirectory:"codegen",namespaceDirectories:!1,indexFilename:"index.sol"},u={outputDirectory:"tables",tableIdArgument:!1,storeArgument:!1},D={disabled:!1},S={namespace:"",type:"table"},h={sourceDirectory:"src",namespace:""};import{schemaAbiTypes as V}from"@latticexyz/schema-type/internal";var de={types:{}},r={types:Object.fromEntries(V.map(e=>[e,e]))};function b(e,t){return{types:{...e.types,...t}}}import{fixedArrayToArray as W,isFixedArrayAbiType as k}from"@latticexyz/schema-type/internal";function g(e,t=r){if(!p(e))throw new Error(`Expected schema, received ${JSON.stringify(e)}`);for(let o of Object.values(e))if(!k(o)&&!s(t.types,o))throw new Error(`"${String(o)}" is not a valid type in this scope.`)}function v(e,t=r){return Object.fromEntries(Object.entries(e).map(([o,n])=>[o,{type:k(n)?W(n):t.types[n],internalType:n}]))}function Se(e,t=r){return g(e,t),v(e,t)}function E(e,t=r){return typeof e=="object"&&e!=null&&Object.values(e).every(o=>k(o)||s(t.types,o))}import{isStaticAbiType as U}from"@latticexyz/schema-type/internal";import{resourceToHex as Y}from"@latticexyz/common";function q(e,t=r){return Object.entries(e).filter(([,o])=>s(t.types,o)&&U(t.types[o])).map(([o])=>o)}function J(e,t,o=r){return Array.isArray(e)&&e.every(n=>s(t,n)&&s(o.types,t[n])&&U(o.types[t[n]]))}function A(e,t=r,o={inStoreContext:!1}){if(typeof e!="object"||e==null)throw new Error(`Expected full table config, got \`${JSON.stringify(e)}\``);if(!s(e,"schema"))throw new Error("Missing schema input");if(g(e.schema,t),!s(e,"key")||!J(e.key,e.schema,t))throw new Error(`Invalid key. Expected \`(${q(e.schema,t).map(n=>`"${String(n)}"`).join(" | ")})[]\`, received \`${s(e,"key")&&Array.isArray(e.key)?`[${e.key.map(n=>`"${n}"`).join(", ")}]`:String(a(e,"key"))}\``);if(s(e,"namespace")&&typeof e.namespace=="string"&&e.namespace.length>14)throw new Error(`Table \`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);if(s(e,"name")&&typeof e.name=="string"&&e.name.length>16)throw new Error(`Table \`name\` must fit into a \`bytes16\`, but "${e.name}" is too long.`);if(o.inStoreContext&&(s(e,"label")||s(e,"namespace")))throw new Error("Overrides of `label` and `namespace` are not allowed for tables in a store config.")}function H(e){let t=e.codegen;return{outputDirectory:a(t,"outputDirectory")??u.outputDirectory,tableIdArgument:a(t,"tableIdArgument")??u.tableIdArgument,storeArgument:a(t,"storeArgument")??u.storeArgument,dataStruct:a(t,"dataStruct")??Object.keys(e.schema).length-e.key.length>1}}function I(e,t=r){let o=e.label,n=e.type??S.type,i=e.namespace??S.namespace,l=e.name??o.slice(0,16),f=Y({type:n,namespace:i,name:l});return{label:o,type:n,namespace:i,name:l,tableId:f,schema:v(e.schema,t),key:e.key,codegen:H(e),deploy:c(e.deploy??{},D)}}function De(e,t=r){return A(e,t),I(e,t)}import{isFixedArrayAbiType as R,isStaticAbiType as z}from"@latticexyz/schema-type/internal";var $e="Invalid schema. Expected an `id` field with a static ABI type or an explicit `key` option.";function L(e){return typeof e=="string"||p(e)&&Object.values(e).every(t=>typeof t=="string")}function w(e,t=r){if(typeof e=="string"){if(R(e)||s(t.types,e))return;throw new Error(`Invalid ABI type. \`${e}\` not found in scope.`)}if(typeof e=="object"&&e!==null){if(E(e,t)){if(s(e,"id")&&z(t.types[e.id]))return;throw new Error("Invalid schema. Expected an `id` field with a static ABI type or an explicit `key` option.")}throw new Error("Invalid schema. Are you using invalid types or missing types in your scope?")}throw new Error("Invalid table shorthand.")}function y(e,t){return typeof e=="string"?{schema:{id:"bytes32",value:e},key:["id"]}:E(e,t)?{schema:e,key:["id"]}:e}function Be(e,t=r){return w(e,t),y(e,t)}function d(e,t){if(p(e)){for(let o of Object.values(e))L(o)?w(o,t):A(o,t,{inStoreContext:!0});return}throw new Error(`Expected tables config, received ${JSON.stringify(e)}`)}function m(e,t){return Object.fromEntries(Object.entries(e).map(([o,n])=>[o,I(c(y(n,t),{label:o}),t)]))}function qe(e,t=r){return d(e,t),m(e,t)}import{mapObject as Q}from"@latticexyz/common/utils";import{isSchemaAbiType as X}from"@latticexyz/schema-type/internal";function Z(e){return Q(e,t=>t.type)}function ee(e){return p(e)&&Object.values(e).every(t=>X(t.type))}function N(e,t=r){return ee(e)?b(t,Z(e)):t}function F(e){if(!p(e))throw new Error(`Expected userTypes, received ${JSON.stringify(e)}`);for(let{type:t}of Object.values(e))if(!s(r.types,t))throw new Error(`"${String(t)}" is not a valid ABI type.`)}import{flatMorph as C}from"@arktype/util";function te(e){return typeof e=="object"&&e!=null&&Object.values(e).every(t=>Array.isArray(t)&&t.every(o=>typeof o=="string"))}function _(e,t=r){if(te(e)){let o=Object.fromEntries(Object.keys(e).map(n=>[n,"uint8"]));return b(t,o)}return t}function oe(e){return e}function j(e){return C(e,(t,o)=>[t,C(o,(n,i)=>[i,n])])}function K(e){return p(e)?c(e,T):T}import{flatMorph as ne}from"@arktype/util";function $(e,t){return ne(e,(o,n)=>[t===""?o:`${t}__${o}`,n])}import{flatMorph as se}from"@arktype/util";function bt(e,t){if(s(e,"namespace")&&typeof e.namespace=="string"&&e.namespace.length>14)throw new Error(`\`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);s(e,"tables")&&d(e.tables,t)}function B(e,t=r){let o=e.label,n=e.namespace??o.slice(0,14);return{label:o,namespace:n,tables:m(se(e.tables??{},(i,l)=>[i,c(y(l,t),{namespace:n})]),t)}}import{flatMorph as re}from"@arktype/util";function G(e){return _(a(e,"enums"),N(a(e,"userTypes")))}function pe(e){let t=G(e);if(s(e,"namespace")&&typeof e.namespace=="string"&&e.namespace.length>14)throw new Error(`\`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);s(e,"tables")&&d(e.tables,t),s(e,"userTypes")&&F(e.userTypes)}function ae(e){let t=G(e),o=e.namespace??h.namespace,n=K(e.codegen),i=re(e.tables??{},(O,P)=>{let x=y(P,t);return[O,{...x,label:O,namespace:o,codegen:{...x.codegen,outputDirectory:x.codegen?.outputDirectory??(n.namespaceDirectories&&o!==""?`${o}/tables`:"tables")}}]}),l={[o]:B({label:o,tables:i},t)},f=m(i,t);return{namespace:o,tables:$(f,o),namespaces:l,sourceDirectory:e.sourceDirectory??h.sourceDirectory,userTypes:e.userTypes??{},enums:e.enums??{},enumValues:j(e.enums??{}),codegen:n}}function Lt(e){return pe(e),ae(e)}export{a,M as b,s as c,p as d,c as e,T as f,u as g,D as h,S as i,h as j,de as k,r as l,b as m,g as n,v as o,Se as p,E as q,J as r,A as s,H as t,I as u,De as v,$e as w,L as x,w as y,y as z,Be as A,d as B,m as C,qe as D,Z as E,ee as F,N as G,F as H,_ as I,oe as J,j as K,K as L,$ as M,bt as N,B as O,G as P,pe as Q,ae as R,Lt as S};
2
+ //# sourceMappingURL=chunk-7BUS2KVD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../ts/config/v2/generics.ts","../ts/config/v2/defaults.ts","../ts/config/v2/scope.ts","../ts/config/v2/schema.ts","../ts/config/v2/table.ts","../ts/config/v2/tableShorthand.ts","../ts/config/v2/tables.ts","../ts/config/v2/userTypes.ts","../ts/config/v2/enums.ts","../ts/config/v2/codegen.ts","../ts/config/v2/namespacedTables.ts","../ts/config/v2/namespace.ts","../ts/config/v2/store.ts"],"sourcesContent":["export type get<input, key> = key extends keyof input ? input[key] : undefined;\n\nexport function get<input, key extends PropertyKey>(input: input, key: key): get<input, key> {\n return (typeof input === \"object\" && input != null && hasOwnKey(input, key) ? input[key] : undefined) as never;\n}\n\nexport type getPath<input, path extends readonly PropertyKey[]> = path extends readonly [\n infer head,\n ...infer tail extends PropertyKey[],\n]\n ? head extends keyof input\n ? getPath<input[head], tail>\n : undefined\n : input;\n\nexport function getPath<input, path extends readonly PropertyKey[]>(input: input, path: path): getPath<input, path> {\n return path.length ? (getPath(get(input, path[0]), path.slice(1)) as never) : (input as never);\n}\n\nexport function hasOwnKey<obj, const key extends PropertyKey>(\n object: obj,\n key: key,\n): object is { [k in key]: k extends keyof obj ? obj[k] : unknown } & obj {\n // eslint-disable-next-line no-prototype-builtins\n return typeof object === \"object\" && object !== null && object.hasOwnProperty(key);\n}\n\nexport function isObject<input>(input: input): input is input & object {\n return input != null && typeof input === \"object\";\n}\n\nexport type mergeIfUndefined<base, defaults> = {\n readonly [key in keyof base | keyof defaults]: key extends keyof base\n ? undefined extends base[key]\n ? key extends keyof defaults\n ? defaults[key]\n : base[key]\n : base[key]\n : key extends keyof defaults\n ? defaults[key]\n : never;\n};\n\nexport function mergeIfUndefined<base extends object, defaults extends object>(\n base: base,\n defaults: defaults,\n): mergeIfUndefined<base, defaults> {\n const keys = [...new Set([...Object.keys(base), ...Object.keys(defaults)])];\n return Object.fromEntries(\n keys.map((key) => [\n key,\n typeof base[key as keyof base] === \"undefined\" ? defaults[key as keyof defaults] : base[key as keyof base],\n ]),\n ) as never;\n}\n\nexport type parseNumber<T> = T extends `${infer N extends number}` ? N : never;\n","import { CodegenInput, StoreInput, TableCodegenInput, TableDeployInput, TableInput } from \"./input\";\n\nexport const CODEGEN_DEFAULTS = {\n storeImportPath: \"@latticexyz/store/src\",\n userTypesFilename: \"common.sol\",\n outputDirectory: \"codegen\",\n // TODO: default to true if using top-level `namespaces` key (once its migrated to store)\n namespaceDirectories: false,\n indexFilename: \"index.sol\",\n} as const satisfies CodegenInput;\n\nexport type CODEGEN_DEFAULTS = typeof CODEGEN_DEFAULTS;\n\nexport const TABLE_CODEGEN_DEFAULTS = {\n outputDirectory: \"tables\" as string,\n tableIdArgument: false,\n storeArgument: false,\n} as const satisfies TableCodegenInput;\n\nexport type TABLE_CODEGEN_DEFAULTS = typeof TABLE_CODEGEN_DEFAULTS;\n\nexport const TABLE_DEPLOY_DEFAULTS = {\n disabled: false,\n} as const satisfies TableDeployInput;\n\nexport type TABLE_DEPLOY_DEFAULTS = typeof TABLE_DEPLOY_DEFAULTS;\n\nexport const TABLE_DEFAULTS = {\n namespace: \"\",\n type: \"table\",\n} as const satisfies Pick<TableInput, \"namespace\" | \"type\">;\n\nexport type TABLE_DEFAULTS = typeof TABLE_DEFAULTS;\n\nexport const CONFIG_DEFAULTS = {\n sourceDirectory: \"src\",\n namespace: \"\",\n} as const satisfies StoreInput;\n\nexport type CONFIG_DEFAULTS = typeof CONFIG_DEFAULTS;\n","import { Dict, show } from \"@arktype/util\";\nimport { SchemaInput } from \"./input\";\nimport { StaticAbiType, schemaAbiTypes } from \"@latticexyz/schema-type/internal\";\nimport { AbiType } from \"./output\";\n\nexport const Scope = { types: {} } as const satisfies ScopeOptions;\nexport type Scope = typeof Scope;\n\nexport type AbiTypeScope = ScopeOptions<{ [t in AbiType]: t }>;\nexport const AbiTypeScope = {\n types: Object.fromEntries(schemaAbiTypes.map((abiType) => [abiType, abiType])),\n} as AbiTypeScope;\n\nexport type ScopeOptions<types extends Dict<string, AbiType> = Dict<string, AbiType>> = {\n types: types;\n};\n\nexport type getStaticAbiTypeKeys<\n schema extends SchemaInput,\n scope extends Scope = AbiTypeScope,\n> = SchemaInput extends schema\n ? string\n : {\n [key in keyof schema]: scope[\"types\"] extends { [_ in schema[key]]: StaticAbiType } ? key : never;\n }[keyof schema];\n\nexport type extendScope<scope extends ScopeOptions, additionalTypes extends Dict<string, AbiType>> = show<\n ScopeOptions<show<scope[\"types\"] & additionalTypes>>\n>;\n\nexport function extendScope<scope extends ScopeOptions, additionalTypes extends Dict<string, AbiType>>(\n scope: scope,\n additionalTypes: additionalTypes,\n): extendScope<scope, additionalTypes> {\n return {\n types: {\n ...scope.types,\n ...additionalTypes,\n },\n };\n}\n","import { conform, show } from \"@arktype/util\";\nimport { AbiTypeScope, Scope } from \"./scope\";\nimport { hasOwnKey, isObject } from \"./generics\";\nimport { SchemaInput } from \"./input\";\nimport { FixedArrayAbiType, fixedArrayToArray, isFixedArrayAbiType } from \"@latticexyz/schema-type/internal\";\n\nexport type validateSchema<schema, scope extends Scope = AbiTypeScope> = schema extends string\n ? SchemaInput\n : {\n [key in keyof schema]: schema[key] extends FixedArrayAbiType\n ? schema[key]\n : conform<schema[key], keyof scope[\"types\"]>;\n };\n\nexport function validateSchema<scope extends Scope = AbiTypeScope>(\n schema: unknown,\n scope: scope = AbiTypeScope as never,\n): asserts schema is SchemaInput {\n if (!isObject(schema)) {\n throw new Error(`Expected schema, received ${JSON.stringify(schema)}`);\n }\n\n for (const internalType of Object.values(schema)) {\n if (isFixedArrayAbiType(internalType)) continue;\n if (hasOwnKey(scope.types, internalType)) continue;\n throw new Error(`\"${String(internalType)}\" is not a valid type in this scope.`);\n }\n}\n\nexport type resolveSchema<schema, scope extends Scope> = show<{\n readonly [key in keyof schema]: {\n /** the Solidity primitive ABI type */\n readonly type: schema[key] extends FixedArrayAbiType\n ? fixedArrayToArray<schema[key]>\n : scope[\"types\"][schema[key] & keyof scope[\"types\"]];\n /** the user defined type or Solidity primitive ABI type */\n readonly internalType: schema[key];\n };\n}>;\n\nexport function resolveSchema<schema extends SchemaInput, scope extends Scope = AbiTypeScope>(\n schema: schema,\n scope: scope = AbiTypeScope as unknown as scope,\n): resolveSchema<schema, scope> {\n return Object.fromEntries(\n Object.entries(schema).map(([key, internalType]) => [\n key,\n {\n type: isFixedArrayAbiType(internalType) ? fixedArrayToArray(internalType) : scope.types[internalType as never],\n internalType,\n },\n ]),\n ) as never;\n}\n\nexport function defineSchema<schema, scope extends AbiTypeScope = AbiTypeScope>(\n schema: validateSchema<schema, scope>,\n scope: scope = AbiTypeScope as scope,\n): resolveSchema<schema, scope> {\n validateSchema(schema, scope);\n return resolveSchema(schema, scope) as never;\n}\n\nexport function isSchemaInput<scope extends Scope = AbiTypeScope>(\n input: unknown,\n scope: scope = AbiTypeScope as never,\n): input is SchemaInput {\n return (\n typeof input === \"object\" &&\n input != null &&\n Object.values(input).every((fieldType) => isFixedArrayAbiType(fieldType) || hasOwnKey(scope.types, fieldType))\n );\n}\n","import { ErrorMessage, conform, show, narrow, requiredKeyOf } from \"@arktype/util\";\nimport { isStaticAbiType } from \"@latticexyz/schema-type/internal\";\nimport { Hex } from \"viem\";\nimport { get, hasOwnKey, mergeIfUndefined } from \"./generics\";\nimport { resolveSchema, validateSchema } from \"./schema\";\nimport { AbiTypeScope, Scope, getStaticAbiTypeKeys } from \"./scope\";\nimport { TableCodegen } from \"./output\";\nimport { TABLE_CODEGEN_DEFAULTS, TABLE_DEFAULTS, TABLE_DEPLOY_DEFAULTS } from \"./defaults\";\nimport { resourceToHex } from \"@latticexyz/common\";\nimport { SchemaInput, TableInput } from \"./input\";\n\nexport type ValidKeys<schema extends SchemaInput, scope extends Scope> = readonly [\n getStaticAbiTypeKeys<schema, scope>,\n ...getStaticAbiTypeKeys<schema, scope>[],\n];\n\nfunction getValidKeys<schema extends SchemaInput, scope extends Scope = AbiTypeScope>(\n schema: schema,\n scope: scope = AbiTypeScope as unknown as scope,\n): ValidKeys<schema, scope> {\n return Object.entries(schema)\n .filter(([, internalType]) => hasOwnKey(scope.types, internalType) && isStaticAbiType(scope.types[internalType]))\n .map(([key]) => key) as never;\n}\n\nexport function isValidPrimaryKey<schema extends SchemaInput, scope extends Scope>(\n key: unknown,\n schema: schema,\n scope: scope = AbiTypeScope as unknown as scope,\n): key is ValidKeys<schema, scope> {\n return (\n Array.isArray(key) &&\n key.every(\n (key) =>\n hasOwnKey(schema, key) && hasOwnKey(scope.types, schema[key]) && isStaticAbiType(scope.types[schema[key]]),\n )\n );\n}\n\nexport type validateKeys<validKeys extends PropertyKey, keys> = keys extends readonly string[]\n ? {\n readonly [i in keyof keys]: keys[i] extends validKeys ? keys[i] : validKeys;\n }\n : readonly string[];\n\nexport type ValidateTableOptions = { inStoreContext: boolean };\n\nexport type requiredTableKey<inStoreContext extends boolean> = Exclude<\n requiredKeyOf<TableInput>,\n inStoreContext extends true ? \"label\" | \"namespace\" : \"\"\n>;\n\nexport type validateTable<\n input,\n scope extends Scope = AbiTypeScope,\n options extends ValidateTableOptions = { inStoreContext: false },\n> = {\n [key in keyof input | requiredTableKey<options[\"inStoreContext\"]>]: key extends \"key\"\n ? validateKeys<getStaticAbiTypeKeys<conform<get<input, \"schema\">, SchemaInput>, scope>, get<input, key>>\n : key extends \"schema\"\n ? validateSchema<get<input, key>, scope>\n : key extends \"label\" | \"namespace\"\n ? options[\"inStoreContext\"] extends true\n ? ErrorMessage<\"Overrides of `label` and `namespace` are not allowed for tables in a store config\">\n : key extends keyof input\n ? narrow<input[key]>\n : never\n : key extends keyof TableInput\n ? TableInput[key]\n : ErrorMessage<`Key \\`${key & string}\\` does not exist in TableInput`>;\n};\n\nexport function validateTable<input, scope extends Scope = AbiTypeScope>(\n input: input,\n scope: scope = AbiTypeScope as unknown as scope,\n options: ValidateTableOptions = { inStoreContext: false },\n): asserts input is TableInput & input {\n if (typeof input !== \"object\" || input == null) {\n throw new Error(`Expected full table config, got \\`${JSON.stringify(input)}\\``);\n }\n\n if (!hasOwnKey(input, \"schema\")) {\n throw new Error(\"Missing schema input\");\n }\n validateSchema(input.schema, scope);\n\n if (!hasOwnKey(input, \"key\") || !isValidPrimaryKey(input[\"key\"], input[\"schema\"], scope)) {\n throw new Error(\n `Invalid key. Expected \\`(${getValidKeys(input[\"schema\"], scope)\n .map((item) => `\"${String(item)}\"`)\n .join(\" | \")})[]\\`, received \\`${\n hasOwnKey(input, \"key\") && Array.isArray(input.key)\n ? `[${input.key.map((item) => `\"${item}\"`).join(\", \")}]`\n : String(get(input, \"key\"))\n }\\``,\n );\n }\n\n if (hasOwnKey(input, \"namespace\") && typeof input.namespace === \"string\" && input.namespace.length > 14) {\n throw new Error(`Table \\`namespace\\` must fit into a \\`bytes14\\`, but \"${input.namespace}\" is too long.`);\n }\n if (hasOwnKey(input, \"name\") && typeof input.name === \"string\" && input.name.length > 16) {\n throw new Error(`Table \\`name\\` must fit into a \\`bytes16\\`, but \"${input.name}\" is too long.`);\n }\n\n if (options.inStoreContext && (hasOwnKey(input, \"label\") || hasOwnKey(input, \"namespace\"))) {\n throw new Error(\"Overrides of `label` and `namespace` are not allowed for tables in a store config.\");\n }\n}\n\nexport type resolveTableCodegen<input extends TableInput> = show<{\n [key in keyof TableCodegen]-?: key extends keyof input[\"codegen\"]\n ? undefined extends input[\"codegen\"][key]\n ? key extends \"dataStruct\"\n ? boolean\n : key extends keyof TABLE_CODEGEN_DEFAULTS\n ? TABLE_CODEGEN_DEFAULTS[key]\n : never\n : input[\"codegen\"][key]\n : // dataStruct isn't narrowed, because its value is conditional on the number of value schema fields\n key extends \"dataStruct\"\n ? boolean\n : key extends keyof TABLE_CODEGEN_DEFAULTS\n ? TABLE_CODEGEN_DEFAULTS[key]\n : never;\n}>;\n\nexport function resolveTableCodegen<input extends TableInput>(input: input): resolveTableCodegen<input> {\n const options = input.codegen;\n return {\n outputDirectory: get(options, \"outputDirectory\") ?? TABLE_CODEGEN_DEFAULTS.outputDirectory,\n tableIdArgument: get(options, \"tableIdArgument\") ?? TABLE_CODEGEN_DEFAULTS.tableIdArgument,\n storeArgument: get(options, \"storeArgument\") ?? TABLE_CODEGEN_DEFAULTS.storeArgument,\n // dataStruct is true if there are at least 2 value fields\n dataStruct: get(options, \"dataStruct\") ?? Object.keys(input.schema).length - input.key.length > 1,\n } satisfies TableCodegen as never;\n}\n\nexport type resolveTable<input, scope extends Scope = Scope> = input extends TableInput\n ? {\n readonly label: input[\"label\"];\n readonly type: undefined extends input[\"type\"] ? typeof TABLE_DEFAULTS.type : input[\"type\"];\n readonly namespace: string;\n readonly name: string;\n readonly tableId: Hex;\n readonly schema: resolveSchema<input[\"schema\"], scope>;\n readonly key: Readonly<input[\"key\"]>;\n readonly codegen: resolveTableCodegen<input>;\n readonly deploy: mergeIfUndefined<\n undefined extends input[\"deploy\"] ? {} : input[\"deploy\"],\n TABLE_DEPLOY_DEFAULTS\n >;\n }\n : never;\n\nexport function resolveTable<input extends TableInput, scope extends Scope = AbiTypeScope>(\n input: input,\n scope: scope = AbiTypeScope as unknown as scope,\n): resolveTable<input, scope> {\n const label = input.label;\n const type = input.type ?? TABLE_DEFAULTS.type;\n const namespace = input.namespace ?? TABLE_DEFAULTS.namespace;\n const name = input.name ?? label.slice(0, 16);\n const tableId = resourceToHex({ type, namespace, name });\n\n return {\n label,\n type,\n namespace,\n name,\n tableId,\n schema: resolveSchema(input.schema, scope),\n key: input.key,\n codegen: resolveTableCodegen(input),\n deploy: mergeIfUndefined(input.deploy ?? {}, TABLE_DEPLOY_DEFAULTS),\n } as never;\n}\n\nexport function defineTable<input, scope extends Scope = AbiTypeScope>(\n input: validateTable<input, scope>,\n scope: scope = AbiTypeScope as unknown as scope,\n): resolveTable<input, scope> {\n validateTable(input, scope);\n return resolveTable(input, scope) as never;\n}\n","import { FixedArrayAbiType, isFixedArrayAbiType, isStaticAbiType } from \"@latticexyz/schema-type/internal\";\nimport { hasOwnKey, isObject } from \"./generics\";\nimport { SchemaInput, ScopedSchemaInput, TableShorthandInput } from \"./input\";\nimport { isSchemaInput } from \"./schema\";\nimport { AbiTypeScope, Scope, getStaticAbiTypeKeys } from \"./scope\";\nimport { ErrorMessage, conform } from \"@arktype/util\";\n\nexport const NoStaticKeyFieldError =\n \"Invalid schema. Expected an `id` field with a static ABI type or an explicit `key` option.\";\n\nexport type NoStaticKeyFieldError = ErrorMessage<typeof NoStaticKeyFieldError>;\n\nexport function isTableShorthandInput(shorthand: unknown): shorthand is TableShorthandInput {\n return (\n typeof shorthand === \"string\" ||\n (isObject(shorthand) && Object.values(shorthand).every((value) => typeof value === \"string\"))\n );\n}\n\n// We don't use `conform` here because the restrictions we're imposing here are not native to typescript\nexport type validateTableShorthand<input, scope extends Scope = AbiTypeScope> = input extends SchemaInput\n ? // If a shorthand schema is provided, require it to have a static `id` field\n \"id\" extends getStaticAbiTypeKeys<input, scope>\n ? // Require all values to be valid types in this scope\n conform<input, ScopedSchemaInput<scope>>\n : NoStaticKeyFieldError\n : // If a fixed array type or a valid type from the scope is provided, accept it\n input extends FixedArrayAbiType | keyof scope[\"types\"]\n ? input\n : // If the input is not a valid shorthand, return the expected type\n input extends string\n ? keyof scope[\"types\"]\n : ScopedSchemaInput<scope>;\n\nexport function validateTableShorthand<scope extends Scope = AbiTypeScope>(\n shorthand: unknown,\n scope: scope = AbiTypeScope as never,\n): asserts shorthand is TableShorthandInput {\n if (typeof shorthand === \"string\") {\n if (isFixedArrayAbiType(shorthand) || hasOwnKey(scope.types, shorthand)) {\n return;\n }\n throw new Error(`Invalid ABI type. \\`${shorthand}\\` not found in scope.`);\n }\n if (typeof shorthand === \"object\" && shorthand !== null) {\n if (isSchemaInput(shorthand, scope)) {\n if (hasOwnKey(shorthand, \"id\") && isStaticAbiType(scope.types[shorthand.id as keyof typeof scope.types])) {\n return;\n }\n throw new Error(`Invalid schema. Expected an \\`id\\` field with a static ABI type or an explicit \\`key\\` option.`);\n }\n throw new Error(`Invalid schema. Are you using invalid types or missing types in your scope?`);\n }\n throw new Error(`Invalid table shorthand.`);\n}\n\nexport type expandTableShorthand<shorthand> = shorthand extends string\n ? {\n readonly schema: {\n readonly id: \"bytes32\";\n readonly value: shorthand;\n };\n readonly key: [\"id\"];\n }\n : shorthand extends SchemaInput\n ? {\n readonly schema: shorthand;\n readonly key: [\"id\"];\n }\n : shorthand;\n\nexport function expandTableShorthand<shorthand, scope extends Scope = AbiTypeScope>(\n shorthand: shorthand,\n scope: scope,\n): expandTableShorthand<shorthand> {\n if (typeof shorthand === \"string\") {\n return {\n schema: {\n id: \"bytes32\",\n value: shorthand,\n },\n key: [\"id\"],\n } as never;\n }\n\n if (isSchemaInput(shorthand, scope)) {\n return {\n schema: shorthand,\n key: [\"id\"],\n } as never;\n }\n\n return shorthand as never;\n}\n\nexport function defineTableShorthand<input, scope extends Scope = AbiTypeScope>(\n input: validateTableShorthand<input, scope>,\n scope: scope = AbiTypeScope as unknown as scope,\n): expandTableShorthand<input> {\n validateTableShorthand(input, scope);\n return expandTableShorthand(input, scope) as never;\n}\n","import { ErrorMessage, show } from \"@arktype/util\";\nimport { isObject, mergeIfUndefined } from \"./generics\";\nimport { TableShorthandInput, TablesInput } from \"./input\";\nimport { Scope, AbiTypeScope } from \"./scope\";\nimport { validateTable, resolveTable } from \"./table\";\nimport { expandTableShorthand, isTableShorthandInput, validateTableShorthand } from \"./tableShorthand\";\n\nexport type validateTables<tables, scope extends Scope = AbiTypeScope> = {\n [label in keyof tables]: tables[label] extends TableShorthandInput\n ? validateTableShorthand<tables[label], scope>\n : tables[label] extends object\n ? validateTable<tables[label], scope, { inStoreContext: true }>\n : ErrorMessage<`Expected tables config.`>;\n};\n\nexport function validateTables<scope extends Scope = AbiTypeScope>(\n input: unknown,\n scope: scope,\n): asserts input is TablesInput {\n if (isObject(input)) {\n for (const table of Object.values(input)) {\n if (isTableShorthandInput(table)) {\n validateTableShorthand(table, scope);\n } else {\n validateTable(table, scope, { inStoreContext: true });\n }\n }\n return;\n }\n throw new Error(`Expected tables config, received ${JSON.stringify(input)}`);\n}\n\nexport type resolveTables<tables, scope extends Scope = AbiTypeScope> = {\n readonly [label in keyof tables]: resolveTable<\n mergeIfUndefined<expandTableShorthand<tables[label]>, { readonly label: label }>,\n scope\n >;\n};\n\nexport function resolveTables<tables extends TablesInput, scope extends Scope = AbiTypeScope>(\n tables: tables,\n scope: scope,\n): resolveTables<tables, scope> {\n return Object.fromEntries(\n Object.entries(tables).map(([label, table]) => {\n return [label, resolveTable(mergeIfUndefined(expandTableShorthand(table, scope), { label }), scope)];\n }),\n ) as never;\n}\n\nexport function defineTables<input, scope extends Scope = AbiTypeScope>(\n input: validateTables<input, scope>,\n scope: scope = AbiTypeScope as never,\n): show<resolveTables<input, scope>> {\n validateTables(input, scope);\n return resolveTables(input, scope) as never;\n}\n","import { mapObject } from \"@latticexyz/common/utils\";\nimport { UserTypes } from \"./output\";\nimport { isSchemaAbiType } from \"@latticexyz/schema-type/internal\";\nimport { AbiTypeScope, extendScope } from \"./scope\";\nimport { hasOwnKey, isObject } from \"./generics\";\n\nexport type extractInternalType<userTypes extends UserTypes> = { [key in keyof userTypes]: userTypes[key][\"type\"] };\n\nexport function extractInternalType<userTypes extends UserTypes>(userTypes: userTypes): extractInternalType<userTypes> {\n return mapObject(userTypes, (userType) => userType.type);\n}\n\nexport function isUserTypes(userTypes: unknown): userTypes is UserTypes {\n return isObject(userTypes) && Object.values(userTypes).every((userType) => isSchemaAbiType(userType.type));\n}\n\nexport type scopeWithUserTypes<userTypes, scope extends AbiTypeScope = AbiTypeScope> = UserTypes extends userTypes\n ? scope\n : userTypes extends UserTypes\n ? extendScope<scope, extractInternalType<userTypes>>\n : scope;\n\nexport function scopeWithUserTypes<userTypes, scope extends AbiTypeScope = AbiTypeScope>(\n userTypes: userTypes,\n scope: scope = AbiTypeScope as scope,\n): scopeWithUserTypes<userTypes, scope> {\n return (isUserTypes(userTypes) ? extendScope(scope, extractInternalType(userTypes)) : scope) as never;\n}\n\nexport function validateUserTypes(userTypes: unknown): asserts userTypes is UserTypes {\n if (!isObject(userTypes)) {\n throw new Error(`Expected userTypes, received ${JSON.stringify(userTypes)}`);\n }\n\n for (const { type } of Object.values(userTypes)) {\n if (!hasOwnKey(AbiTypeScope.types, type)) {\n throw new Error(`\"${String(type)}\" is not a valid ABI type.`);\n }\n }\n}\n","import { flatMorph } from \"@arktype/util\";\nimport { EnumsInput } from \"./input\";\nimport { AbiTypeScope, extendScope } from \"./scope\";\nimport { parseNumber } from \"./generics\";\n\nfunction isEnums(enums: unknown): enums is EnumsInput {\n return (\n typeof enums === \"object\" &&\n enums != null &&\n Object.values(enums).every((item) => Array.isArray(item) && item.every((element) => typeof element === \"string\"))\n );\n}\n\nexport type scopeWithEnums<enums, scope extends AbiTypeScope = AbiTypeScope> = EnumsInput extends enums\n ? scope\n : enums extends EnumsInput\n ? extendScope<scope, { [key in keyof enums]: \"uint8\" }>\n : scope;\n\nexport function scopeWithEnums<enums, scope extends AbiTypeScope = AbiTypeScope>(\n enums: enums,\n scope: scope = AbiTypeScope as scope,\n): scopeWithEnums<enums, scope> {\n if (isEnums(enums)) {\n const enumScope = Object.fromEntries(Object.keys(enums).map((key) => [key, \"uint8\" as const]));\n return extendScope(scope, enumScope) as never;\n }\n return scope as never;\n}\n\nexport type resolveEnums<enums> = {\n readonly [key in keyof enums]: Readonly<enums[key]>;\n};\n\nexport function resolveEnums<enums extends EnumsInput>(enums: enums): resolveEnums<enums> {\n return enums;\n}\n\nexport type mapEnums<enums> = {\n readonly [key in keyof enums]: {\n readonly [element in keyof enums[key] as enums[key][element] & string]: parseNumber<element>;\n };\n};\n\nexport function mapEnums<enums extends EnumsInput>(enums: enums): resolveEnums<enums> {\n return flatMorph(enums as EnumsInput, (enumName, enumElements) => [\n enumName,\n flatMorph(enumElements, (enumIndex, enumElement) => [enumElement, enumIndex]),\n ]) as never;\n}\n","import { CODEGEN_DEFAULTS } from \"./defaults\";\nimport { isObject, mergeIfUndefined } from \"./generics\";\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 (\n isObject(codegen) ? mergeIfUndefined(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS\n ) as resolveCodegen<codegen>;\n}\n","import { flatMorph, show } from \"@arktype/util\";\nimport { Tables } from \"./output\";\n\n/**\n * @internal Only kept for backwards compatibility\n */\nexport type resolveNamespacedTables<tables, namespace> = {\n readonly [label in keyof tables as namespace extends \"\"\n ? label\n : `${namespace & string}__${label & string}`]: tables[label];\n};\n\n/**\n * @internal Only kept for backwards compatibility\n */\nexport function resolveNamespacedTables<tables, namespace>(\n tables: tables,\n namespace: namespace,\n): show<resolveNamespacedTables<tables, namespace>> {\n return flatMorph(tables as Tables, (label, table) => [\n namespace === \"\" ? label : `${namespace}__${label}`,\n table,\n ]) as never;\n}\n","import { ErrorMessage, flatMorph } from \"@arktype/util\";\nimport { hasOwnKey, mergeIfUndefined } from \"./generics\";\nimport { NamespaceInput } from \"./input\";\nimport { resolveTables, validateTables } from \"./tables\";\nimport { AbiTypeScope, Scope } from \"./scope\";\nimport { expandTableShorthand } from \"./tableShorthand\";\n\nexport type validateNamespace<input, scope extends Scope = AbiTypeScope> = {\n [key in keyof input]: key extends \"tables\"\n ? validateTables<input[key], scope>\n : key extends keyof NamespaceInput\n ? NamespaceInput[key]\n : ErrorMessage<`\\`${key & string}\\` is not a valid namespace config option.`>;\n};\n\nexport function validateNamespace<scope extends Scope = AbiTypeScope>(\n input: unknown,\n scope: scope,\n): asserts input is NamespaceInput {\n if (hasOwnKey(input, \"namespace\") && typeof input.namespace === \"string\" && input.namespace.length > 14) {\n throw new Error(`\\`namespace\\` must fit into a \\`bytes14\\`, but \"${input.namespace}\" is too long.`);\n }\n if (hasOwnKey(input, \"tables\")) {\n validateTables(input.tables, scope);\n }\n}\n\nexport type resolveNamespace<input, scope extends Scope = AbiTypeScope> = input extends NamespaceInput\n ? {\n readonly label: input[\"label\"];\n readonly namespace: string;\n readonly tables: undefined extends input[\"tables\"]\n ? {}\n : resolveTables<\n {\n readonly [label in keyof input[\"tables\"]]: mergeIfUndefined<\n expandTableShorthand<input[\"tables\"][label]>,\n { readonly namespace: string }\n >;\n },\n scope\n >;\n }\n : never;\n\nexport function resolveNamespace<const input extends NamespaceInput, scope extends Scope = AbiTypeScope>(\n input: input,\n scope: scope = AbiTypeScope as never,\n): resolveNamespace<input, scope> {\n const label = input.label;\n const namespace = input.namespace ?? label.slice(0, 14);\n return {\n label,\n namespace,\n tables: resolveTables(\n flatMorph(input.tables ?? {}, (label, table) => {\n return [label, mergeIfUndefined(expandTableShorthand(table, scope), { namespace })];\n }),\n scope,\n ),\n } as never;\n}\n","import { ErrorMessage, show, flatMorph, narrow } from \"@arktype/util\";\nimport { get, hasOwnKey, mergeIfUndefined } from \"./generics\";\nimport { UserTypes } from \"./output\";\nimport { CONFIG_DEFAULTS } from \"./defaults\";\nimport { StoreInput, TableInput } from \"./input\";\nimport { resolveTables, validateTables } from \"./tables\";\nimport { scopeWithUserTypes, validateUserTypes } from \"./userTypes\";\nimport { mapEnums, resolveEnums, scopeWithEnums } from \"./enums\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveNamespacedTables } from \"./namespacedTables\";\nimport { resolveTable } from \"./table\";\nimport { resolveNamespace } from \"./namespace\";\nimport { expandTableShorthand } from \"./tableShorthand\";\n\nexport type extendedScope<input> = scopeWithEnums<get<input, \"enums\">, scopeWithUserTypes<get<input, \"userTypes\">>>;\n\nexport function extendedScope<input>(input: input): extendedScope<input> {\n return scopeWithEnums(get(input, \"enums\"), scopeWithUserTypes(get(input, \"userTypes\")));\n}\n\nexport type validateStore<input> = {\n [key in keyof input]: key extends \"tables\"\n ? validateTables<input[key], extendedScope<input>>\n : key extends \"userTypes\"\n ? UserTypes\n : key extends \"enums\"\n ? narrow<input[key]>\n : key extends keyof StoreInput\n ? StoreInput[key]\n : ErrorMessage<`\\`${key & string}\\` is not a valid Store config option.`>;\n};\n\nexport function validateStore(input: unknown): asserts input is StoreInput {\n const scope = extendedScope(input);\n\n if (hasOwnKey(input, \"namespace\") && typeof input.namespace === \"string\" && input.namespace.length > 14) {\n throw new Error(`\\`namespace\\` must fit into a \\`bytes14\\`, but \"${input.namespace}\" is too long.`);\n }\n\n if (hasOwnKey(input, \"tables\")) {\n validateTables(input.tables, scope);\n }\n\n if (hasOwnKey(input, \"userTypes\")) {\n validateUserTypes(input.userTypes);\n }\n}\n\nexport type resolveStore<\n input,\n namespace = \"namespace\" extends keyof input\n ? input[\"namespace\"] extends string\n ? input[\"namespace\"]\n : CONFIG_DEFAULTS[\"namespace\"]\n : CONFIG_DEFAULTS[\"namespace\"],\n> = {\n readonly namespace: string;\n readonly sourceDirectory: \"sourceDirectory\" extends keyof input\n ? input[\"sourceDirectory\"]\n : CONFIG_DEFAULTS[\"sourceDirectory\"];\n readonly tables: \"tables\" extends keyof input\n ? resolveNamespacedTables<\n {\n readonly [label in keyof input[\"tables\"]]: resolveTable<\n mergeIfUndefined<expandTableShorthand<input[\"tables\"][label]>, { label: label; namespace: namespace }>,\n extendedScope<input>\n >;\n },\n namespace\n >\n : {};\n readonly userTypes: \"userTypes\" extends keyof input ? input[\"userTypes\"] : {};\n readonly enums: \"enums\" extends keyof input ? show<resolveEnums<input[\"enums\"]>> : {};\n readonly enumValues: \"enums\" extends keyof input ? show<mapEnums<input[\"enums\"]>> : {};\n readonly codegen: \"codegen\" extends keyof input ? resolveCodegen<input[\"codegen\"]> : resolveCodegen<{}>;\n readonly namespaces: {\n readonly [label in namespace & string]: resolveNamespace<\n {\n readonly label: label;\n readonly tables: \"tables\" extends keyof input ? input[\"tables\"] : undefined;\n },\n extendedScope<input>\n >;\n };\n};\n\nexport function resolveStore<const input extends StoreInput>(input: input): resolveStore<input> {\n const scope = extendedScope(input);\n const namespace = input.namespace ?? CONFIG_DEFAULTS[\"namespace\"];\n const codegen = resolveCodegen(input.codegen);\n\n const tablesInput = flatMorph(input.tables ?? {}, (label, shorthand) => {\n const table = expandTableShorthand(shorthand, scope) as TableInput;\n return [\n label,\n {\n ...table,\n label,\n namespace,\n codegen: {\n ...table.codegen,\n outputDirectory:\n table.codegen?.outputDirectory ??\n (codegen.namespaceDirectories && namespace !== \"\" ? `${namespace}/tables` : \"tables\"),\n },\n },\n ];\n });\n\n const namespaces = {\n [namespace]: resolveNamespace({ label: namespace, tables: tablesInput }, scope),\n };\n\n const tables = resolveTables(tablesInput, scope);\n\n return {\n namespace,\n tables: resolveNamespacedTables(tables, namespace),\n namespaces,\n sourceDirectory: input.sourceDirectory ?? CONFIG_DEFAULTS[\"sourceDirectory\"],\n userTypes: input.userTypes ?? {},\n enums: resolveEnums(input.enums ?? {}),\n enumValues: mapEnums(input.enums ?? {}),\n codegen,\n } as never;\n}\n\nexport function defineStore<const input>(input: validateStore<input>): show<resolveStore<input>> {\n validateStore(input);\n return resolveStore(input) as never;\n}\n"],"mappings":"AAEO,SAASA,EAAoCC,EAAcC,EAA2B,CAC3F,OAAQ,OAAOD,GAAU,UAAYA,GAAS,MAAQE,EAAUF,EAAOC,CAAG,EAAID,EAAMC,CAAG,EAAI,MAC7F,CAWO,SAASE,EAAoDH,EAAcI,EAAkC,CAClH,OAAOA,EAAK,OAAUD,EAAQJ,EAAIC,EAAOI,EAAK,CAAC,CAAC,EAAGA,EAAK,MAAM,CAAC,CAAC,EAAeJ,CACjF,CAEO,SAASE,EACdG,EACAJ,EACwE,CAExE,OAAO,OAAOI,GAAW,UAAYA,IAAW,MAAQA,EAAO,eAAeJ,CAAG,CACnF,CAEO,SAASK,EAAgBN,EAAuC,CACrE,OAAOA,GAAS,MAAQ,OAAOA,GAAU,QAC3C,CAcO,SAASO,EACdC,EACAC,EACkC,CAClC,IAAMC,EAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,OAAO,KAAKF,CAAI,EAAG,GAAG,OAAO,KAAKC,CAAQ,CAAC,CAAC,CAAC,EAC1E,OAAO,OAAO,YACZC,EAAK,IAAKT,GAAQ,CAChBA,EACA,OAAOO,EAAKP,CAAiB,EAAM,IAAcQ,EAASR,CAAqB,EAAIO,EAAKP,CAAiB,CAC3G,CAAC,CACH,CACF,CCpDO,IAAMU,EAAmB,CAC9B,gBAAiB,wBACjB,kBAAmB,aACnB,gBAAiB,UAEjB,qBAAsB,GACtB,cAAe,WACjB,EAIaC,EAAyB,CACpC,gBAAiB,SACjB,gBAAiB,GACjB,cAAe,EACjB,EAIaC,EAAwB,CACnC,SAAU,EACZ,EAIaC,EAAiB,CAC5B,UAAW,GACX,KAAM,OACR,EAIaC,EAAkB,CAC7B,gBAAiB,MACjB,UAAW,EACb,ECnCA,OAAwB,kBAAAC,MAAsB,mCAGvC,IAAMC,GAAQ,CAAE,MAAO,CAAC,CAAE,EAIpBC,EAAe,CAC1B,MAAO,OA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,CAAC,CAAC,EACtC,QAAAY,CACF,CACF,CAEO,SAASc,GAAyB1B,EAAwD,CAC/F,OAAAI,GAAcJ,CAAK,EACZS,GAAaT,CAAK,CAC3B","names":["get","input","key","hasOwnKey","getPath","path","object","isObject","mergeIfUndefined","base","defaults","keys","CODEGEN_DEFAULTS","TABLE_CODEGEN_DEFAULTS","TABLE_DEPLOY_DEFAULTS","TABLE_DEFAULTS","CONFIG_DEFAULTS","schemaAbiTypes","Scope","AbiTypeScope","abiType","extendScope","scope","additionalTypes","fixedArrayToArray","isFixedArrayAbiType","validateSchema","schema","scope","AbiTypeScope","isObject","internalType","hasOwnKey","resolveSchema","key","defineSchema","isSchemaInput","input","fieldType","isStaticAbiType","resourceToHex","getValidKeys","schema","scope","AbiTypeScope","internalType","hasOwnKey","isStaticAbiType","key","isValidPrimaryKey","validateTable","input","options","validateSchema","item","get","resolveTableCodegen","TABLE_CODEGEN_DEFAULTS","resolveTable","label","type","TABLE_DEFAULTS","namespace","name","tableId","resolveSchema","mergeIfUndefined","TABLE_DEPLOY_DEFAULTS","defineTable","isFixedArrayAbiType","isStaticAbiType","NoStaticKeyFieldError","isTableShorthandInput","shorthand","isObject","value","validateTableShorthand","scope","AbiTypeScope","isFixedArrayAbiType","hasOwnKey","isSchemaInput","isStaticAbiType","expandTableShorthand","defineTableShorthand","input","validateTables","input","scope","isObject","table","isTableShorthandInput","validateTableShorthand","validateTable","resolveTables","tables","label","resolveTable","mergeIfUndefined","expandTableShorthand","defineTables","AbiTypeScope","mapObject","isSchemaAbiType","extractInternalType","userTypes","mapObject","userType","isUserTypes","isObject","isSchemaAbiType","scopeWithUserTypes","scope","AbiTypeScope","extendScope","validateUserTypes","type","hasOwnKey","flatMorph","isEnums","enums","item","element","scopeWithEnums","scope","AbiTypeScope","enumScope","key","extendScope","resolveEnums","mapEnums","flatMorph","enumName","enumElements","enumIndex","enumElement","resolveCodegen","codegen","isObject","mergeIfUndefined","CODEGEN_DEFAULTS","flatMorph","resolveNamespacedTables","tables","namespace","label","table","flatMorph","validateNamespace","input","scope","hasOwnKey","validateTables","resolveNamespace","AbiTypeScope","label","namespace","resolveTables","flatMorph","table","mergeIfUndefined","expandTableShorthand","flatMorph","extendedScope","input","scopeWithEnums","get","scopeWithUserTypes","validateStore","scope","hasOwnKey","validateTables","validateUserTypes","resolveStore","namespace","CONFIG_DEFAULTS","codegen","resolveCodegen","tablesInput","flatMorph","label","shorthand","table","expandTableShorthand","namespaces","resolveNamespace","tables","resolveTables","resolveNamespacedTables","mapEnums","defineStore"]}
package/dist/codegen.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { ImportDatum, StaticResourceData, RenderKeyTuple, RenderField, RenderStaticField, RenderDynamicField, RenderType, SolidityUserDefinedType } from '@latticexyz/common/codegen';
2
- import { S as Store } from './input-48d1368b.js';
1
+ import { ImportDatum, StaticResourceData, RenderKeyTuple, RenderField, RenderStaticField, RenderDynamicField, RenderType } from '@latticexyz/common/codegen';
2
+ import { S as Store, T as Table } from './input-e69ffb2f.js';
3
+ import { AbiType } from '@latticexyz/config';
3
4
  import { SchemaType } from '@latticexyz/schema-type/deprecated';
4
5
  import 'viem';
5
6
  import '@arktype/util';
6
- import '@latticexyz/config';
7
7
  import '@latticexyz/schema-type/internal';
8
8
 
9
9
  interface RenderTableOptions {
@@ -91,9 +91,19 @@ type TablegenOptions = {
91
91
  */
92
92
  rootDir: string;
93
93
  config: Store;
94
- remappings: [string, string][];
95
94
  };
96
- declare function tablegen({ rootDir, config, remappings }: TablegenOptions): Promise<void>;
95
+ declare function tablegen({ rootDir, config }: TablegenOptions): Promise<void>;
96
+
97
+ type UserType = {
98
+ readonly type: "enum" | "userType";
99
+ readonly name: string;
100
+ readonly abiType: AbiType;
101
+ /**
102
+ * Import path relative to the root dir or absolute path if importing from a package.
103
+ * Relative paths must start with a `.` to be treated as a relative path.
104
+ */
105
+ readonly importPath: string;
106
+ };
97
107
 
98
108
  interface TableOptions {
99
109
  /** Path where the file is expected to be written (relative to project root) */
@@ -106,7 +116,15 @@ interface TableOptions {
106
116
  /**
107
117
  * Transforms store config and available solidity user types into useful options for `tablegen` and `renderTable`
108
118
  */
109
- declare function getTableOptions(config: Store, solidityUserTypes: Record<string, SolidityUserDefinedType>): TableOptions[];
119
+ declare function getTableOptions({ tables, rootDir, codegenDir, userTypes, storeImportPath, }: {
120
+ readonly tables: Table[];
121
+ readonly rootDir: string;
122
+ /** namespace codegen output dir, relative to project root dir */
123
+ readonly codegenDir: string;
124
+ readonly userTypes: readonly UserType[];
125
+ /** absolute import path or, if starting with `.`, relative to project root dir */
126
+ readonly storeImportPath: string;
127
+ }): TableOptions[];
110
128
 
111
129
  /**
112
130
  * Renders `DecodeSlice` library with the necessary header and imports,
@@ -143,18 +161,14 @@ declare function renderTightCoderAutoTest(): string;
143
161
  /**
144
162
  * Resolve an abi or user type into a SchemaType and RenderType
145
163
  */
146
- declare function resolveAbiOrUserType(abiOrUserType: string, config: Store, solidityUserTypes: Record<string, SolidityUserDefinedType>): {
164
+ declare function resolveAbiOrUserType(abiOrUserType: string, userTypes: readonly UserType[]): {
147
165
  schemaType: SchemaType;
148
166
  renderType: RenderType;
149
167
  };
150
- /**
151
- * Get the required import for SchemaType|userType (`undefined` means that no import is required)
152
- */
153
- declare function importForAbiOrUserType(abiOrUserType: string, usedInDirectory: string, config: Store, solidityUserTypes: Record<string, SolidityUserDefinedType>): ImportDatum | undefined;
154
168
  declare function getSchemaTypeInfo(schemaType: SchemaType): RenderType;
155
- declare function getUserTypeInfo(userType: string, config: Store, solidityUserTypes: Record<string, SolidityUserDefinedType>): {
169
+ declare function getUserTypeInfo(userType: UserType): {
156
170
  schemaType: SchemaType;
157
171
  renderType: RenderType;
158
172
  };
159
173
 
160
- export { RenderTableOptions, TableOptions, TablegenOptions, getSchemaTypeInfo, getTableOptions, getUserTypeInfo, importForAbiOrUserType, renderDecodeSlice, renderDecodeValueType, renderDeleteRecordMethods, renderEncodeArray, renderEncodeFieldSingle, renderFieldMethods, renderRecordData, renderRecordMethods, renderTable, renderTightCoderAutoTest, renderTightCoderAutoTestFunction, renderTightCoderDecode, renderTightCoderEncode, renderTypesFromConfig, resolveAbiOrUserType, tablegen };
174
+ export { RenderTableOptions, TableOptions, TablegenOptions, getSchemaTypeInfo, getTableOptions, getUserTypeInfo, renderDecodeSlice, renderDecodeValueType, renderDeleteRecordMethods, renderEncodeArray, renderEncodeFieldSingle, renderFieldMethods, renderRecordData, renderRecordMethods, renderTable, renderTightCoderAutoTest, renderTightCoderAutoTestFunction, renderTightCoderDecode, renderTightCoderEncode, renderTypesFromConfig, resolveAbiOrUserType, tablegen };