@latticexyz/config 2.0.12-main-d7526607 → 2.0.12-main-9be2bb86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import{a as m,b as f,c as p}from"./chunk-JORWOKR3.js";import{z as r}from"zod";import{ZodIssueCode as n}from"zod";import{isAddress as E}from"viem";var I=16,g=14;function d(t,e){/^\w+$/.test(t)||e.addIssue({code:n.custom,message:"Name must contain only alphanumeric & underscore characters"})}function C(t,e){d(t,e),/^[A-Z]/.test(t)||e.addIssue({code:n.custom,message:"Name must start with a capital letter"})}function x(t,e){d(t,e),/^[a-z]/.test(t)||e.addIssue({code:n.custom,message:"Name must start with a lowercase letter"})}function h(t,e){t.length===0&&e.addIssue({code:n.custom,message:"Enum must not be empty"}),t.length>=256&&e.addIssue({code:n.custom,message:"Length of enum must be < 256"});let o=D(t);o.length>0&&e.addIssue({code:n.custom,message:`Enum must not have duplicate names for: ${o.join(", ")}`})}function c(t,e){return(o,s)=>{if(o===""){t&&s.addIssue({code:n.custom,message:"Route must not be empty"});return}o[0]!=="/"&&s.addIssue({code:n.custom,message:'Route must start with "/"'}),o[o.length-1]==="/"&&s.addIssue({code:n.custom,message:'Route must not end with "/"'});let i=o.split("/");e&&i.length>2&&s.addIssue({code:n.custom,message:'Route must only have one level (e.g. "/foo")'});for(let u=1;u<i.length;u++)i[u]===""&&s.addIssue({code:n.custom,message:'Route must not contain empty route fragments (e.g. "//")'}),/^\w+$/.test(i[u])||s.addIssue({code:n.custom,message:"Route must contain only alphanumeric & underscore characters"})}}var R=c(!0,!1),b=c(!1,!1),U=c(!0,!0);function M(t,e){E(t)||e.addIssue({code:n.custom,message:"Address must be a valid Ethereum address"})}function D(t){let e=new Set,o=new Set;for(let s of t)e.has(s)&&o.add(s),e.add(s);return[...o]}function v(t,e){t.length>g&&e.addIssue({code:n.custom,message:`Namespace must be <= ${g} characters`}),/^\w*$/.test(t)||e.addIssue({code:n.custom,message:"Selector must contain only alphanumeric & underscore characters"})}function z(t){let e=t.match(/^(\w+)\[(\d+)\]$/);return e?{elementType:e[1],staticLength:Number.parseInt(e[2])}:null}var N=r.string().superRefine(C),W=r.string().superRefine(x),L=r.string().superRefine(d),G=r.string().superRefine(v),$=r.array(N).superRefine(h),O=r.string().superRefine(R),B=r.string().superRefine(U),j=r.string().superRefine(b),k=r.string().superRefine(M);var l=class{static isCreated(){return this._global.__mudCoreContext!==void 0}static createContext(){if(this.isCreated())throw new f;let e=this._global,o=new l;return e.__mudCoreContext=o,o}static getContext(){let o=this._global.__mudCoreContext;if(o===void 0)throw new p;return o}configExtenders=[]},a=l;m(a,"_global",typeof global>"u"?window.global??{}:global);function P(t){let e=t,o=a.getContext();for(let s of o.configExtenders)e=s(e);return e}function q(t){a.getContext().configExtenders.push(t)}export{I as a,g as b,d as c,C as d,x as e,h as f,R as g,b as h,U as i,M as j,D as k,v as l,z as m,N as n,W as o,L as p,G as q,$ as r,O as s,B as t,j as u,k as v,a as w,P as x,q as y};
2
+ //# sourceMappingURL=chunk-A6KUSP7R.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/deprecated/library/commonSchemas.ts","../src/deprecated/library/validation.ts","../src/deprecated/library/context.ts","../src/deprecated/library/core.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n validateBaseRoute,\n validateCapitalizedName,\n validateEthereumAddress,\n validateEnum,\n validateName,\n validateRoute,\n validateSingleLevelRoute,\n validateUncapitalizedName,\n validateNamespace,\n} from \"./validation\";\n\n/**\n * Capitalized names of objects, like tables and systems\n * @deprecated\n */\nexport const zObjectName = z.string().superRefine(validateCapitalizedName);\n/**\n * Uncapitalized names of values, like keys and columns\n * @deprecated\n */\nexport const zValueName = z.string().superRefine(validateUncapitalizedName);\n/** Name that can start with any case\n * @deprecated\n */\nexport const zName = z.string().superRefine(validateName);\n/** A namespace\n * @deprecated\n */\nexport const zNamespace = z.string().superRefine(validateNamespace);\n\n/** List of unique enum member names and 0 < length < 256\n * @deprecated\n */\nexport const zUserEnum = z.array(zObjectName).superRefine(validateEnum);\n\n/** Ordinary routes\n * @deprecated\n */\nexport const zOrdinaryRoute = z.string().superRefine(validateRoute);\n/** Routes with exactly 1 non-empty level\n * @deprecated\n */\nexport const zSingleLevelRoute = z.string().superRefine(validateSingleLevelRoute);\n/** Base routes (can be an empty string)\n * @deprecated\n */\nexport const zBaseRoute = z.string().superRefine(validateBaseRoute);\n\n/** A valid Ethereum address\n * @deprecated\n */\nexport const zEthereumAddress = z.string().superRefine(validateEthereumAddress);\n","import { ZodIssueCode, RefinementCtx } from \"zod\";\nimport { isAddress } from \"viem\";\n\n/** @deprecated */\nexport const STORE_NAME_MAX_LENGTH = 16;\n/** @deprecated */\nexport const STORE_NAMESPACE_MAX_LENGTH = 14;\n\n/** @deprecated */\nexport function validateName(name: string, ctx: RefinementCtx) {\n if (!/^\\w+$/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Name must contain only alphanumeric & underscore characters`,\n });\n }\n}\n\n/** @deprecated */\nexport function validateCapitalizedName(name: string, ctx: RefinementCtx) {\n validateName(name, ctx);\n\n if (!/^[A-Z]/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Name must start with a capital letter`,\n });\n }\n}\n\n/** @deprecated */\nexport function validateUncapitalizedName(name: string, ctx: RefinementCtx) {\n validateName(name, ctx);\n\n if (!/^[a-z]/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Name must start with a lowercase letter`,\n });\n }\n}\n\n/**\n * validates only the enum array, not the names of enum members\n * @deprecated\n */\nexport function validateEnum(members: string[], ctx: RefinementCtx) {\n if (members.length === 0) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Enum must not be empty`,\n });\n }\n if (members.length >= 256) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Length of enum must be < 256`,\n });\n }\n\n const duplicates = getDuplicates(members);\n if (duplicates.length > 0) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Enum must not have duplicate names for: ${duplicates.join(\", \")}`,\n });\n }\n}\n\n/** @deprecated */\nfunction _factoryForValidateRoute(requireNonEmpty: boolean, requireSingleLevel: boolean) {\n return (route: string, ctx: RefinementCtx) => {\n if (route === \"\") {\n if (requireNonEmpty) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must not be empty`,\n });\n }\n // we can skip further validation for empty routes\n return;\n }\n\n if (route[0] !== \"/\") {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must start with \"/\"`,\n });\n }\n\n if (route[route.length - 1] === \"/\") {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must not end with \"/\"`,\n });\n }\n\n const parts = route.split(\"/\");\n if (requireSingleLevel && parts.length > 2) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must only have one level (e.g. \"/foo\")`,\n });\n }\n\n // start at 1 to skip the first empty part\n for (let i = 1; i < parts.length; i++) {\n if (parts[i] === \"\") {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must not contain empty route fragments (e.g. \"//\")`,\n });\n }\n\n if (!/^\\w+$/.test(parts[i])) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must contain only alphanumeric & underscore characters`,\n });\n }\n }\n };\n}\n\n/** @deprecated */\nexport const validateRoute = _factoryForValidateRoute(true, false);\n\n/** @deprecated */\nexport const validateBaseRoute = _factoryForValidateRoute(false, false);\n\n/** @deprecated */\nexport const validateSingleLevelRoute = _factoryForValidateRoute(true, true);\n\n/** @deprecated */\nexport function validateEthereumAddress(address: string, ctx: RefinementCtx) {\n if (!isAddress(address)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Address must be a valid Ethereum address`,\n });\n }\n}\n\n/** @deprecated */\nexport function getDuplicates<T>(array: T[]) {\n const checked = new Set<T>();\n const duplicates = new Set<T>();\n for (const element of array) {\n if (checked.has(element)) {\n duplicates.add(element);\n }\n checked.add(element);\n }\n return [...duplicates];\n}\n\n/** @deprecated */\nexport function validateNamespace(name: string, ctx: RefinementCtx) {\n if (name.length > STORE_NAMESPACE_MAX_LENGTH) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Namespace must be <= ${STORE_NAMESPACE_MAX_LENGTH} characters`,\n });\n }\n if (!/^\\w*$/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Selector must contain only alphanumeric & underscore characters`,\n });\n }\n}\n\n/**\n * Returns null if the type does not look like a static array, otherwise element and length data\n * @deprecated\n */\nexport function parseStaticArray(abiType: string) {\n const matches = abiType.match(/^(\\w+)\\[(\\d+)\\]$/);\n if (!matches) return null;\n return {\n elementType: matches[1],\n staticLength: Number.parseInt(matches[2]),\n };\n}\n","import { MUDConfigExtender } from \"./core\";\nimport { MUDContextAlreadyCreatedError, MUDContextNotCreatedError } from \"./errors\";\n\n/** @deprecated */\nexport type GlobalWithMUDCoreContext = typeof global & {\n __mudCoreContext: MUDCoreContext;\n};\n\n/** @deprecated */\nexport class MUDCoreContext {\n /** @deprecated */\n static _global = typeof global === \"undefined\" ? window.global ?? {} : global;\n\n /** @deprecated */\n public static isCreated(): boolean {\n const globalWithMUDCoreContext = this._global as GlobalWithMUDCoreContext;\n return globalWithMUDCoreContext.__mudCoreContext !== undefined;\n }\n\n /** @deprecated */\n public static createContext(): MUDCoreContext {\n if (this.isCreated()) {\n throw new MUDContextAlreadyCreatedError();\n }\n const globalWithMUDCoreContext = this._global as GlobalWithMUDCoreContext;\n const context = new MUDCoreContext();\n globalWithMUDCoreContext.__mudCoreContext = context;\n return context;\n }\n\n /** @deprecated */\n public static getContext(): MUDCoreContext {\n const globalWithMUDCoreContext = this._global as GlobalWithMUDCoreContext;\n const context = globalWithMUDCoreContext.__mudCoreContext;\n if (context === undefined) {\n throw new MUDContextNotCreatedError();\n }\n return context;\n }\n\n /** @deprecated */\n public readonly configExtenders: MUDConfigExtender[] = [];\n}\n","import { MUDCoreContext } from \"./context\";\n\n/** @deprecated */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MUDCoreUserConfig {}\n\n/** @deprecated */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MUDCoreConfig {}\n\n/** @deprecated */\nexport type MUDConfigExtender = (config: MUDCoreConfig) => Record<string, unknown>;\n\n/**\n * Resolver that sequentially passes the config through all the plugins\n * @deprecated\n */\nexport function mudCoreConfig(config: MUDCoreUserConfig): MUDCoreConfig {\n // config types can change with plugins, `any` helps avoid errors when typechecking dependencies\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let configAsAny = config as any;\n const context = MUDCoreContext.getContext();\n for (const extender of context.configExtenders) {\n configAsAny = extender(configAsAny);\n }\n return configAsAny;\n}\n\n/**\n * Utility for plugin developers to extend the core config\n * @deprecated\n */\nexport function extendMUDCoreConfig(extender: MUDConfigExtender) {\n const context = MUDCoreContext.getContext();\n context.configExtenders.push(extender);\n}\n"],"mappings":"sDAAA,OAAS,KAAAA,MAAS,MCAlB,OAAS,gBAAAC,MAAmC,MAC5C,OAAS,aAAAC,MAAiB,OAGnB,IAAMC,EAAwB,GAExBC,EAA6B,GAGnC,SAASC,EAAaC,EAAcC,EAAoB,CACxD,QAAQ,KAAKD,CAAI,GACpBC,EAAI,SAAS,CACX,KAAMN,EAAa,OACnB,QAAS,6DACX,CAAC,CAEL,CAGO,SAASO,EAAwBF,EAAcC,EAAoB,CACxEF,EAAaC,EAAMC,CAAG,EAEjB,SAAS,KAAKD,CAAI,GACrBC,EAAI,SAAS,CACX,KAAMN,EAAa,OACnB,QAAS,uCACX,CAAC,CAEL,CAGO,SAASQ,EAA0BH,EAAcC,EAAoB,CAC1EF,EAAaC,EAAMC,CAAG,EAEjB,SAAS,KAAKD,CAAI,GACrBC,EAAI,SAAS,CACX,KAAMN,EAAa,OACnB,QAAS,yCACX,CAAC,CAEL,CAMO,SAASS,EAAaC,EAAmBJ,EAAoB,CAC9DI,EA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,KAAK,UAAU,EACjB,MAAM,IAAIC,EAEZ,IAAMC,EAA2B,KAAK,QAChCC,EAAU,IAAIH,EACpB,OAAAE,EAAyB,iBAAmBC,EACrCA,CACT,CAGA,OAAc,YAA6B,CAEzC,IAAMA,EAD2B,KAAK,QACG,iBACzC,GAAIA,IAAY,OACd,MAAM,IAAIC,EAEZ,OAAOD,CACT,CAGgB,gBAAuC,CAAC,CAC1D,EAjCaE,EAANL,EAELM,EAFWD,EAEJ,UAAU,OAAO,OAAW,IAAc,OAAO,QAAU,CAAC,EAAI,QCMlE,SAASE,EAAcC,EAA0C,CAGtE,IAAIC,EAAcD,EACZE,EAAUC,EAAe,WAAW,EAC1C,QAAWC,KAAYF,EAAQ,gBAC7BD,EAAcG,EAASH,CAAW,EAEpC,OAAOA,CACT,CAMO,SAASI,EAAoBD,EAA6B,CAC/CD,EAAe,WAAW,EAClC,gBAAgB,KAAKC,CAAQ,CACvC","names":["z","ZodIssueCode","isAddress","STORE_NAME_MAX_LENGTH","STORE_NAMESPACE_MAX_LENGTH","validateName","name","ctx","validateCapitalizedName","validateUncapitalizedName","validateEnum","members","duplicates","getDuplicates","_factoryForValidateRoute","requireNonEmpty","requireSingleLevel","route","parts","i","validateRoute","validateBaseRoute","validateSingleLevelRoute","validateEthereumAddress","address","array","checked","element","validateNamespace","parseStaticArray","abiType","matches","zObjectName","z","validateCapitalizedName","zValueName","validateUncapitalizedName","zName","validateName","zNamespace","validateNamespace","zUserEnum","validateEnum","zOrdinaryRoute","validateRoute","zSingleLevelRoute","validateSingleLevelRoute","zBaseRoute","validateBaseRoute","zEthereumAddress","validateEthereumAddress","_MUDCoreContext","MUDContextAlreadyCreatedError","globalWithMUDCoreContext","context","MUDContextNotCreatedError","MUDCoreContext","__publicField","mudCoreConfig","config","configAsAny","context","MUDCoreContext","extender","extendMUDCoreConfig"]}
@@ -0,0 +1,20 @@
1
+ /** @deprecated */
2
+ interface MUDCoreUserConfig {
3
+ }
4
+ /** @deprecated */
5
+ interface MUDCoreConfig {
6
+ }
7
+ /** @deprecated */
8
+ type MUDConfigExtender = (config: MUDCoreConfig) => Record<string, unknown>;
9
+ /**
10
+ * Resolver that sequentially passes the config through all the plugins
11
+ * @deprecated
12
+ */
13
+ declare function mudCoreConfig(config: MUDCoreUserConfig): MUDCoreConfig;
14
+ /**
15
+ * Utility for plugin developers to extend the core config
16
+ * @deprecated
17
+ */
18
+ declare function extendMUDCoreConfig(extender: MUDConfigExtender): void;
19
+
20
+ export { MUDConfigExtender as M, MUDCoreUserConfig as a, MUDCoreConfig as b, extendMUDCoreConfig as e, mudCoreConfig as m };
@@ -1,6 +1,6 @@
1
1
  import { z, ZodError, RefinementCtx } from 'zod';
2
- import { M as MUDConfigExtender } from '../dynamicResolution-ac143cd8.js';
3
- export { c as DynamicResolution, D as DynamicResolutionType, b as MUDCoreConfig, a as MUDCoreUserConfig, V as ValueWithType, e as extendMUDCoreConfig, i as isDynamicResolution, m as mudCoreConfig, r as resolveTableId, d as resolveWithContext } from '../dynamicResolution-ac143cd8.js';
2
+ import { M as MUDConfigExtender } from '../core-cd251f25.js';
3
+ export { b as MUDCoreConfig, a as MUDCoreUserConfig, e as extendMUDCoreConfig, m as mudCoreConfig } from '../core-cd251f25.js';
4
4
  import * as zod_validation_error from 'zod-validation-error';
5
5
 
6
6
  /**
@@ -1,2 +1,2 @@
1
- import{A as F,B as G,C as H,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w as B,x as C,y as D,z as E}from"../chunk-MG7VRERG.js";import{b as w,c as x,d as y,e as z,f as A}from"../chunk-JORWOKR3.js";export{E as DynamicResolutionType,w as MUDContextAlreadyCreatedError,x as MUDContextNotCreatedError,B as MUDCoreContext,z as NotInsideProjectError,b as STORE_NAMESPACE_MAX_LENGTH,a as STORE_NAME_MAX_LENGTH,A as UnrecognizedSystemErrorFactory,D as extendMUDCoreConfig,y as fromZodErrorCustom,k as getDuplicates,G as isDynamicResolution,C as mudCoreConfig,m as parseStaticArray,F as resolveTableId,H as resolveWithContext,h as validateBaseRoute,d as validateCapitalizedName,f as validateEnum,j as validateEthereumAddress,c as validateName,l as validateNamespace,g as validateRoute,i as validateSingleLevelRoute,e as validateUncapitalizedName,u as zBaseRoute,v as zEthereumAddress,p as zName,q as zNamespace,n as zObjectName,s as zOrdinaryRoute,t as zSingleLevelRoute,r as zUserEnum,o as zValueName};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w as B,x as C,y as D}from"../chunk-A6KUSP7R.js";import{b as w,c as x,d as y,e as z,f as A}from"../chunk-JORWOKR3.js";export{w as MUDContextAlreadyCreatedError,x as MUDContextNotCreatedError,B as MUDCoreContext,z as NotInsideProjectError,b as STORE_NAMESPACE_MAX_LENGTH,a as STORE_NAME_MAX_LENGTH,A as UnrecognizedSystemErrorFactory,D as extendMUDCoreConfig,y as fromZodErrorCustom,k as getDuplicates,C as mudCoreConfig,m as parseStaticArray,h as validateBaseRoute,d as validateCapitalizedName,f as validateEnum,j as validateEthereumAddress,c as validateName,l as validateNamespace,g as validateRoute,i as validateSingleLevelRoute,e as validateUncapitalizedName,u as zBaseRoute,v as zEthereumAddress,p as zName,q as zNamespace,n as zObjectName,s as zOrdinaryRoute,t as zSingleLevelRoute,r as zUserEnum,o as zValueName};
2
2
  //# sourceMappingURL=library.js.map
@@ -1 +1 @@
1
- export { m as mudCoreConfig, r as resolveTableId } from '../dynamicResolution-ac143cd8.js';
1
+ export { m as mudCoreConfig } from '../core-cd251f25.js';
@@ -1,2 +1,2 @@
1
- import{A as r,w as e,x as o}from"../chunk-MG7VRERG.js";import"../chunk-JORWOKR3.js";e.isCreated()||e.createContext();export{o as mudCoreConfig,r as resolveTableId};
1
+ import{w as o,x as e}from"../chunk-A6KUSP7R.js";import"../chunk-JORWOKR3.js";o.isCreated()||o.createContext();export{e as mudCoreConfig};
2
2
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/deprecated/register/index.ts"],"sourcesContent":["import { mudCoreConfig, resolveTableId } from \"../library\";\nimport { MUDCoreContext } from \"../library/context\";\n\nexport { mudCoreConfig, resolveTableId };\n\n// Importing this file has side-effects, and it should always be imported before MUD plugins.\n// Use this import for defining a MUD config.\n// Use the library endpoint instead when writing MUD-based libraries or plugins.\nif (!MUDCoreContext.isCreated()) {\n MUDCoreContext.createContext();\n}\n"],"mappings":"oFAQKA,EAAe,UAAU,GAC5BA,EAAe,cAAc","names":["MUDCoreContext"]}
1
+ {"version":3,"sources":["../../src/deprecated/register/index.ts"],"sourcesContent":["import { mudCoreConfig } from \"../library\";\nimport { MUDCoreContext } from \"../library/context\";\n\nexport { mudCoreConfig };\n\n// Importing this file has side-effects, and it should always be imported before MUD plugins.\n// Use this import for defining a MUD config.\n// Use the library endpoint instead when writing MUD-based libraries or plugins.\nif (!MUDCoreContext.isCreated()) {\n MUDCoreContext.createContext();\n}\n"],"mappings":"6EAQKA,EAAe,UAAU,GAC5BA,EAAe,cAAc","names":["MUDCoreContext"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/config",
3
- "version": "2.0.12-main-d7526607",
3
+ "version": "2.0.12-main-9be2bb86",
4
4
  "description": "Config for Store and World",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,8 +41,8 @@
41
41
  "viem": "2.9.20",
42
42
  "zod": "^3.22.2",
43
43
  "zod-validation-error": "^1.3.0",
44
- "@latticexyz/common": "2.0.12-main-d7526607",
45
- "@latticexyz/schema-type": "2.0.12-main-d7526607"
44
+ "@latticexyz/common": "2.0.12-main-9be2bb86",
45
+ "@latticexyz/schema-type": "2.0.12-main-9be2bb86"
46
46
  },
47
47
  "devDependencies": {
48
48
  "tsup": "^6.7.0"
@@ -3,6 +3,5 @@
3
3
  export * from "./commonSchemas";
4
4
  export * from "./context";
5
5
  export * from "./core";
6
- export * from "./dynamicResolution";
7
6
  export * from "./errors";
8
7
  export * from "./validation";
@@ -1,7 +1,7 @@
1
- import { mudCoreConfig, resolveTableId } from "../library";
1
+ import { mudCoreConfig } from "../library";
2
2
  import { MUDCoreContext } from "../library/context";
3
3
 
4
- export { mudCoreConfig, resolveTableId };
4
+ export { mudCoreConfig };
5
5
 
6
6
  // Importing this file has side-effects, and it should always be imported before MUD plugins.
7
7
  // Use this import for defining a MUD config.
@@ -1,3 +0,0 @@
1
- import{a as m,b as f,c as p}from"./chunk-JORWOKR3.js";import{z as r}from"zod";import{ZodIssueCode as s}from"zod";import{isAddress as U}from"viem";var z=16,g=14;function d(e,t){/^\w+$/.test(e)||t.addIssue({code:s.custom,message:"Name must contain only alphanumeric & underscore characters"})}function x(e,t){d(e,t),/^[A-Z]/.test(e)||t.addIssue({code:s.custom,message:"Name must start with a capital letter"})}function C(e,t){d(e,t),/^[a-z]/.test(e)||t.addIssue({code:s.custom,message:"Name must start with a lowercase letter"})}function h(e,t){e.length===0&&t.addIssue({code:s.custom,message:"Enum must not be empty"}),e.length>=256&&t.addIssue({code:s.custom,message:"Length of enum must be < 256"});let o=M(e);o.length>0&&t.addIssue({code:s.custom,message:`Enum must not have duplicate names for: ${o.join(", ")}`})}function c(e,t){return(o,n)=>{if(o===""){e&&n.addIssue({code:s.custom,message:"Route must not be empty"});return}o[0]!=="/"&&n.addIssue({code:s.custom,message:'Route must start with "/"'}),o[o.length-1]==="/"&&n.addIssue({code:s.custom,message:'Route must not end with "/"'});let a=o.split("/");t&&a.length>2&&n.addIssue({code:s.custom,message:'Route must only have one level (e.g. "/foo")'});for(let u=1;u<a.length;u++)a[u]===""&&n.addIssue({code:s.custom,message:'Route must not contain empty route fragments (e.g. "//")'}),/^\w+$/.test(a[u])||n.addIssue({code:s.custom,message:"Route must contain only alphanumeric & underscore characters"})}}var R=c(!0,!1),y=c(!1,!1),b=c(!0,!0);function D(e,t){U(e)||t.addIssue({code:s.custom,message:"Address must be a valid Ethereum address"})}function M(e){let t=new Set,o=new Set;for(let n of e)t.has(n)&&o.add(n),t.add(n);return[...o]}function E(e,t){e.length>g&&t.addIssue({code:s.custom,message:`Namespace must be <= ${g} characters`}),/^\w*$/.test(e)||t.addIssue({code:s.custom,message:"Selector must contain only alphanumeric & underscore characters"})}function S(e){let t=e.match(/^(\w+)\[(\d+)\]$/);return t?{elementType:t[1],staticLength:Number.parseInt(t[2])}:null}var v=r.string().superRefine(x),B=r.string().superRefine(C),G=r.string().superRefine(d),O=r.string().superRefine(E),V=r.array(v).superRefine(h),j=r.string().superRefine(R),k=r.string().superRefine(b),H=r.string().superRefine(y),P=r.string().superRefine(D);var l=class{static isCreated(){return this._global.__mudCoreContext!==void 0}static createContext(){if(this.isCreated())throw new f;let t=this._global,o=new l;return t.__mudCoreContext=o,o}static getContext(){let o=this._global.__mudCoreContext;if(o===void 0)throw new p;return o}configExtenders=[]},i=l;m(i,"_global",typeof global>"u"?window.global??{}:global);function q(e){let t=e,o=i.getContext();for(let n of o.configExtenders)t=n(t);return t}function K(e){i.getContext().configExtenders.push(e)}import{MUDError as I}from"@latticexyz/common/errors";var N=(o=>(o[o.TABLE_ID=0]="TABLE_ID",o[o.SYSTEM_ADDRESS=1]="SYSTEM_ADDRESS",o))(N||{});function te(e){return{type:0,input:e}}function w(e){return typeof e=="object"&&e!==null&&"type"in e&&"input"in e}function oe(e,t){if(!w(e))return e;let o;if(e.type===0){let n=t.tableIds?.[e.input];o=n&&{value:n,type:"bytes32"}}if(o===void 0)throw new I(`Could not resolve dynamic resolution:
2
- ${JSON.stringify(e,null,2)}`);return o}export{z as a,g as b,d as c,x as d,C as e,h as f,R as g,y as h,b as i,D as j,M as k,E as l,S as m,v as n,B as o,G as p,O as q,V as r,j as s,k as t,H as u,P as v,i as w,q as x,K as y,N as z,te as A,w as B,oe as C};
3
- //# sourceMappingURL=chunk-MG7VRERG.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/deprecated/library/commonSchemas.ts","../src/deprecated/library/validation.ts","../src/deprecated/library/context.ts","../src/deprecated/library/core.ts","../src/deprecated/library/dynamicResolution.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n validateBaseRoute,\n validateCapitalizedName,\n validateEthereumAddress,\n validateEnum,\n validateName,\n validateRoute,\n validateSingleLevelRoute,\n validateUncapitalizedName,\n validateNamespace,\n} from \"./validation\";\n\n/**\n * Capitalized names of objects, like tables and systems\n * @deprecated\n */\nexport const zObjectName = z.string().superRefine(validateCapitalizedName);\n/**\n * Uncapitalized names of values, like keys and columns\n * @deprecated\n */\nexport const zValueName = z.string().superRefine(validateUncapitalizedName);\n/** Name that can start with any case\n * @deprecated\n */\nexport const zName = z.string().superRefine(validateName);\n/** A namespace\n * @deprecated\n */\nexport const zNamespace = z.string().superRefine(validateNamespace);\n\n/** List of unique enum member names and 0 < length < 256\n * @deprecated\n */\nexport const zUserEnum = z.array(zObjectName).superRefine(validateEnum);\n\n/** Ordinary routes\n * @deprecated\n */\nexport const zOrdinaryRoute = z.string().superRefine(validateRoute);\n/** Routes with exactly 1 non-empty level\n * @deprecated\n */\nexport const zSingleLevelRoute = z.string().superRefine(validateSingleLevelRoute);\n/** Base routes (can be an empty string)\n * @deprecated\n */\nexport const zBaseRoute = z.string().superRefine(validateBaseRoute);\n\n/** A valid Ethereum address\n * @deprecated\n */\nexport const zEthereumAddress = z.string().superRefine(validateEthereumAddress);\n","import { ZodIssueCode, RefinementCtx } from \"zod\";\nimport { isAddress } from \"viem\";\n\n/** @deprecated */\nexport const STORE_NAME_MAX_LENGTH = 16;\n/** @deprecated */\nexport const STORE_NAMESPACE_MAX_LENGTH = 14;\n\n/** @deprecated */\nexport function validateName(name: string, ctx: RefinementCtx) {\n if (!/^\\w+$/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Name must contain only alphanumeric & underscore characters`,\n });\n }\n}\n\n/** @deprecated */\nexport function validateCapitalizedName(name: string, ctx: RefinementCtx) {\n validateName(name, ctx);\n\n if (!/^[A-Z]/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Name must start with a capital letter`,\n });\n }\n}\n\n/** @deprecated */\nexport function validateUncapitalizedName(name: string, ctx: RefinementCtx) {\n validateName(name, ctx);\n\n if (!/^[a-z]/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Name must start with a lowercase letter`,\n });\n }\n}\n\n/**\n * validates only the enum array, not the names of enum members\n * @deprecated\n */\nexport function validateEnum(members: string[], ctx: RefinementCtx) {\n if (members.length === 0) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Enum must not be empty`,\n });\n }\n if (members.length >= 256) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Length of enum must be < 256`,\n });\n }\n\n const duplicates = getDuplicates(members);\n if (duplicates.length > 0) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Enum must not have duplicate names for: ${duplicates.join(\", \")}`,\n });\n }\n}\n\n/** @deprecated */\nfunction _factoryForValidateRoute(requireNonEmpty: boolean, requireSingleLevel: boolean) {\n return (route: string, ctx: RefinementCtx) => {\n if (route === \"\") {\n if (requireNonEmpty) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must not be empty`,\n });\n }\n // we can skip further validation for empty routes\n return;\n }\n\n if (route[0] !== \"/\") {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must start with \"/\"`,\n });\n }\n\n if (route[route.length - 1] === \"/\") {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must not end with \"/\"`,\n });\n }\n\n const parts = route.split(\"/\");\n if (requireSingleLevel && parts.length > 2) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must only have one level (e.g. \"/foo\")`,\n });\n }\n\n // start at 1 to skip the first empty part\n for (let i = 1; i < parts.length; i++) {\n if (parts[i] === \"\") {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must not contain empty route fragments (e.g. \"//\")`,\n });\n }\n\n if (!/^\\w+$/.test(parts[i])) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Route must contain only alphanumeric & underscore characters`,\n });\n }\n }\n };\n}\n\n/** @deprecated */\nexport const validateRoute = _factoryForValidateRoute(true, false);\n\n/** @deprecated */\nexport const validateBaseRoute = _factoryForValidateRoute(false, false);\n\n/** @deprecated */\nexport const validateSingleLevelRoute = _factoryForValidateRoute(true, true);\n\n/** @deprecated */\nexport function validateEthereumAddress(address: string, ctx: RefinementCtx) {\n if (!isAddress(address)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Address must be a valid Ethereum address`,\n });\n }\n}\n\n/** @deprecated */\nexport function getDuplicates<T>(array: T[]) {\n const checked = new Set<T>();\n const duplicates = new Set<T>();\n for (const element of array) {\n if (checked.has(element)) {\n duplicates.add(element);\n }\n checked.add(element);\n }\n return [...duplicates];\n}\n\n/** @deprecated */\nexport function validateNamespace(name: string, ctx: RefinementCtx) {\n if (name.length > STORE_NAMESPACE_MAX_LENGTH) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Namespace must be <= ${STORE_NAMESPACE_MAX_LENGTH} characters`,\n });\n }\n if (!/^\\w*$/.test(name)) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message: `Selector must contain only alphanumeric & underscore characters`,\n });\n }\n}\n\n/**\n * Returns null if the type does not look like a static array, otherwise element and length data\n * @deprecated\n */\nexport function parseStaticArray(abiType: string) {\n const matches = abiType.match(/^(\\w+)\\[(\\d+)\\]$/);\n if (!matches) return null;\n return {\n elementType: matches[1],\n staticLength: Number.parseInt(matches[2]),\n };\n}\n","import { MUDConfigExtender } from \"./core\";\nimport { MUDContextAlreadyCreatedError, MUDContextNotCreatedError } from \"./errors\";\n\n/** @deprecated */\nexport type GlobalWithMUDCoreContext = typeof global & {\n __mudCoreContext: MUDCoreContext;\n};\n\n/** @deprecated */\nexport class MUDCoreContext {\n /** @deprecated */\n static _global = typeof global === \"undefined\" ? window.global ?? {} : global;\n\n /** @deprecated */\n public static isCreated(): boolean {\n const globalWithMUDCoreContext = this._global as GlobalWithMUDCoreContext;\n return globalWithMUDCoreContext.__mudCoreContext !== undefined;\n }\n\n /** @deprecated */\n public static createContext(): MUDCoreContext {\n if (this.isCreated()) {\n throw new MUDContextAlreadyCreatedError();\n }\n const globalWithMUDCoreContext = this._global as GlobalWithMUDCoreContext;\n const context = new MUDCoreContext();\n globalWithMUDCoreContext.__mudCoreContext = context;\n return context;\n }\n\n /** @deprecated */\n public static getContext(): MUDCoreContext {\n const globalWithMUDCoreContext = this._global as GlobalWithMUDCoreContext;\n const context = globalWithMUDCoreContext.__mudCoreContext;\n if (context === undefined) {\n throw new MUDContextNotCreatedError();\n }\n return context;\n }\n\n /** @deprecated */\n public readonly configExtenders: MUDConfigExtender[] = [];\n}\n","import { MUDCoreContext } from \"./context\";\n\n/** @deprecated */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MUDCoreUserConfig {}\n\n/** @deprecated */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MUDCoreConfig {}\n\n/** @deprecated */\nexport type MUDConfigExtender = (config: MUDCoreConfig) => Record<string, unknown>;\n\n/**\n * Resolver that sequentially passes the config through all the plugins\n * @deprecated\n */\nexport function mudCoreConfig(config: MUDCoreUserConfig): MUDCoreConfig {\n // config types can change with plugins, `any` helps avoid errors when typechecking dependencies\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let configAsAny = config as any;\n const context = MUDCoreContext.getContext();\n for (const extender of context.configExtenders) {\n configAsAny = extender(configAsAny);\n }\n return configAsAny;\n}\n\n/**\n * Utility for plugin developers to extend the core config\n * @deprecated\n */\nexport function extendMUDCoreConfig(extender: MUDConfigExtender) {\n const context = MUDCoreContext.getContext();\n context.configExtenders.push(extender);\n}\n","import { MUDError } from \"@latticexyz/common/errors\";\n\nexport enum DynamicResolutionType {\n TABLE_ID,\n SYSTEM_ADDRESS,\n}\n\nexport type DynamicResolution = {\n type: DynamicResolutionType;\n input: string;\n};\n\nexport type ValueWithType = {\n value: string | number | Uint8Array;\n type: string;\n};\n\n/**\n * Dynamically resolve a table name to a table id at deploy time\n */\nexport function resolveTableId(tableName: string) {\n return {\n type: DynamicResolutionType.TABLE_ID,\n input: tableName,\n };\n}\n\n/** Type guard for DynamicResolution */\nexport function isDynamicResolution(value: unknown): value is DynamicResolution {\n return typeof value === \"object\" && value !== null && \"type\" in value && \"input\" in value;\n}\n\n/**\n * Turn a DynamicResolution object into a ValueWithType based on the provided context\n * @deprecated\n */\nexport function resolveWithContext(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n unresolved: any,\n context: { systemAddresses?: Record<string, Promise<string>>; tableIds?: Record<string, Uint8Array> },\n): ValueWithType {\n if (!isDynamicResolution(unresolved)) return unresolved;\n let resolved: ValueWithType | undefined = undefined;\n\n if (unresolved.type === DynamicResolutionType.TABLE_ID) {\n const tableId = context.tableIds?.[unresolved.input];\n resolved = tableId && { value: tableId, type: \"bytes32\" };\n }\n\n if (resolved === undefined) {\n throw new MUDError(`Could not resolve dynamic resolution: \\n${JSON.stringify(unresolved, null, 2)}`);\n }\n\n return resolved;\n}\n"],"mappings":"sDAAA,OAAS,KAAAA,MAAS,MCAlB,OAAS,gBAAAC,MAAmC,MAC5C,OAAS,aAAAC,MAAiB,OAGnB,IAAMC,EAAwB,GAExBC,EAA6B,GAGnC,SAASC,EAAaC,EAAcC,EAAoB,CACxD,QAAQ,KAAKD,CAAI,GACpBC,EAAI,SAAS,CACX,KAAMN,EAAa,OACnB,QAAS,6DACX,CAAC,CAEL,CAGO,SAASO,EAAwBF,EAAcC,EAAoB,CACxEF,EAAaC,EAAMC,CAAG,EAEjB,SAAS,KAAKD,CAAI,GACrBC,EAAI,SAAS,CACX,KAAMN,EAAa,OACnB,QAAS,uCACX,CAAC,CAEL,CAGO,SAASQ,EAA0BH,EAAcC,EAAoB,CAC1EF,EAAaC,EAAMC,CAAG,EAEjB,SAAS,KAAKD,CAAI,GACrBC,EAAI,SAAS,CACX,KAAMN,EAAa,OACnB,QAAS,yCACX,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z","ZodIssueCode","isAddress","STORE_NAME_MAX_LENGTH","STORE_NAMESPACE_MAX_LENGTH","validateName","name","ctx","validateCapitalizedName","validateUncapitalizedName","validateEnum","members","duplicates","getDuplicates","_factoryForValidateRoute","requireNonEmpty","requireSingleLevel","route","parts","i","validateRoute","validateBaseRoute","validateSingleLevelRoute","validateEthereumAddress","address","array","checked","element","validateNamespace","parseStaticArray","abiType","matches","zObjectName","z","validateCapitalizedName","zValueName","validateUncapitalizedName","zName","validateName","zNamespace","validateNamespace","zUserEnum","validateEnum","zOrdinaryRoute","validateRoute","zSingleLevelRoute","validateSingleLevelRoute","zBaseRoute","validateBaseRoute","zEthereumAddress","validateEthereumAddress","_MUDCoreContext","MUDContextAlreadyCreatedError","globalWithMUDCoreContext","context","MUDContextNotCreatedError","MUDCoreContext","__publicField","mudCoreConfig","config","configAsAny","context","MUDCoreContext","extender","extendMUDCoreConfig","MUDError","DynamicResolutionType","resolveTableId","tableName","isDynamicResolution","value","resolveWithContext","unresolved","context","resolved","tableId"]}
@@ -1,50 +0,0 @@
1
- /** @deprecated */
2
- interface MUDCoreUserConfig {
3
- }
4
- /** @deprecated */
5
- interface MUDCoreConfig {
6
- }
7
- /** @deprecated */
8
- type MUDConfigExtender = (config: MUDCoreConfig) => Record<string, unknown>;
9
- /**
10
- * Resolver that sequentially passes the config through all the plugins
11
- * @deprecated
12
- */
13
- declare function mudCoreConfig(config: MUDCoreUserConfig): MUDCoreConfig;
14
- /**
15
- * Utility for plugin developers to extend the core config
16
- * @deprecated
17
- */
18
- declare function extendMUDCoreConfig(extender: MUDConfigExtender): void;
19
-
20
- declare enum DynamicResolutionType {
21
- TABLE_ID = 0,
22
- SYSTEM_ADDRESS = 1
23
- }
24
- type DynamicResolution = {
25
- type: DynamicResolutionType;
26
- input: string;
27
- };
28
- type ValueWithType = {
29
- value: string | number | Uint8Array;
30
- type: string;
31
- };
32
- /**
33
- * Dynamically resolve a table name to a table id at deploy time
34
- */
35
- declare function resolveTableId(tableName: string): {
36
- type: DynamicResolutionType;
37
- input: string;
38
- };
39
- /** Type guard for DynamicResolution */
40
- declare function isDynamicResolution(value: unknown): value is DynamicResolution;
41
- /**
42
- * Turn a DynamicResolution object into a ValueWithType based on the provided context
43
- * @deprecated
44
- */
45
- declare function resolveWithContext(unresolved: any, context: {
46
- systemAddresses?: Record<string, Promise<string>>;
47
- tableIds?: Record<string, Uint8Array>;
48
- }): ValueWithType;
49
-
50
- export { DynamicResolutionType as D, MUDConfigExtender as M, ValueWithType as V, MUDCoreUserConfig as a, MUDCoreConfig as b, DynamicResolution as c, resolveWithContext as d, extendMUDCoreConfig as e, isDynamicResolution as i, mudCoreConfig as m, resolveTableId as r };
@@ -1,55 +0,0 @@
1
- import { MUDError } from "@latticexyz/common/errors";
2
-
3
- export enum DynamicResolutionType {
4
- TABLE_ID,
5
- SYSTEM_ADDRESS,
6
- }
7
-
8
- export type DynamicResolution = {
9
- type: DynamicResolutionType;
10
- input: string;
11
- };
12
-
13
- export type ValueWithType = {
14
- value: string | number | Uint8Array;
15
- type: string;
16
- };
17
-
18
- /**
19
- * Dynamically resolve a table name to a table id at deploy time
20
- */
21
- export function resolveTableId(tableName: string) {
22
- return {
23
- type: DynamicResolutionType.TABLE_ID,
24
- input: tableName,
25
- };
26
- }
27
-
28
- /** Type guard for DynamicResolution */
29
- export function isDynamicResolution(value: unknown): value is DynamicResolution {
30
- return typeof value === "object" && value !== null && "type" in value && "input" in value;
31
- }
32
-
33
- /**
34
- * Turn a DynamicResolution object into a ValueWithType based on the provided context
35
- * @deprecated
36
- */
37
- export function resolveWithContext(
38
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
- unresolved: any,
40
- context: { systemAddresses?: Record<string, Promise<string>>; tableIds?: Record<string, Uint8Array> },
41
- ): ValueWithType {
42
- if (!isDynamicResolution(unresolved)) return unresolved;
43
- let resolved: ValueWithType | undefined = undefined;
44
-
45
- if (unresolved.type === DynamicResolutionType.TABLE_ID) {
46
- const tableId = context.tableIds?.[unresolved.input];
47
- resolved = tableId && { value: tableId, type: "bytes32" };
48
- }
49
-
50
- if (resolved === undefined) {
51
- throw new MUDError(`Could not resolve dynamic resolution: \n${JSON.stringify(unresolved, null, 2)}`);
52
- }
53
-
54
- return resolved;
55
- }