@latticexyz/config 2.0.0-next.13 → 2.0.0-next.15

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,40 @@
1
+ interface MUDCoreUserConfig {
2
+ }
3
+ interface MUDCoreConfig {
4
+ }
5
+ type MUDConfigExtender = (config: MUDCoreConfig) => Record<string, unknown>;
6
+ /** Resolver that sequentially passes the config through all the plugins */
7
+ declare function mudCoreConfig(config: MUDCoreUserConfig): MUDCoreConfig;
8
+ /** Utility for plugin developers to extend the core config */
9
+ declare function extendMUDCoreConfig(extender: MUDConfigExtender): void;
10
+
11
+ declare enum DynamicResolutionType {
12
+ TABLE_ID = 0,
13
+ SYSTEM_ADDRESS = 1
14
+ }
15
+ type DynamicResolution = {
16
+ type: DynamicResolutionType;
17
+ input: string;
18
+ };
19
+ type ValueWithType = {
20
+ value: string | number | Uint8Array;
21
+ type: string;
22
+ };
23
+ /**
24
+ * Dynamically resolve a table name to a table id at deploy time
25
+ */
26
+ declare function resolveTableId(tableName: string): {
27
+ type: DynamicResolutionType;
28
+ input: string;
29
+ };
30
+ /** Type guard for DynamicResolution */
31
+ declare function isDynamicResolution(value: unknown): value is DynamicResolution;
32
+ /**
33
+ * Turn a DynamicResolution object into a ValueWithType based on the provided context
34
+ */
35
+ declare function resolveWithContext(unresolved: any, context: {
36
+ systemAddresses?: Record<string, Promise<string>>;
37
+ tableIds?: Record<string, Uint8Array>;
38
+ }): ValueWithType;
39
+
40
+ 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 };
@@ -0,0 +1,69 @@
1
+ import { z, ZodError, RefinementCtx } from 'zod';
2
+ import { M as MUDConfigExtender } from '../dynamicResolution-d10c23a8.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-d10c23a8.js';
4
+ import * as zod_validation_error from 'zod-validation-error';
5
+
6
+ /** Capitalized names of objects, like tables and systems */
7
+ declare const zObjectName: z.ZodEffects<z.ZodString, string, string>;
8
+ /** Uncapitalized names of values, like keys and columns */
9
+ declare const zValueName: z.ZodEffects<z.ZodString, string, string>;
10
+ /** Name that can start with any case */
11
+ declare const zName: z.ZodEffects<z.ZodString, string, string>;
12
+ /** A namespace */
13
+ declare const zNamespace: z.ZodEffects<z.ZodString, string, string>;
14
+ /** List of unique enum member names and 0 < length < 256 */
15
+ declare const zUserEnum: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">, string[], string[]>;
16
+ /** Ordinary routes */
17
+ declare const zOrdinaryRoute: z.ZodEffects<z.ZodString, string, string>;
18
+ /** Routes with exactly 1 non-empty level */
19
+ declare const zSingleLevelRoute: z.ZodEffects<z.ZodString, string, string>;
20
+ /** Base routes (can be an empty string) */
21
+ declare const zBaseRoute: z.ZodEffects<z.ZodString, string, string>;
22
+ /** A valid Ethereum address */
23
+ declare const zEthereumAddress: z.ZodEffects<z.ZodString, string, string>;
24
+
25
+ type GlobalWithMUDCoreContext = typeof global & {
26
+ __mudCoreContext: MUDCoreContext;
27
+ };
28
+ declare class MUDCoreContext {
29
+ static _global: typeof globalThis;
30
+ static isCreated(): boolean;
31
+ static createContext(): MUDCoreContext;
32
+ static getContext(): MUDCoreContext;
33
+ readonly configExtenders: MUDConfigExtender[];
34
+ }
35
+
36
+ declare class MUDContextAlreadyCreatedError extends Error {
37
+ name: string;
38
+ message: string;
39
+ }
40
+ declare class MUDContextNotCreatedError extends Error {
41
+ name: string;
42
+ message: string;
43
+ }
44
+ declare function fromZodErrorCustom(error: ZodError, prefix: string): zod_validation_error.ValidationError;
45
+ declare class NotInsideProjectError extends Error {
46
+ name: string;
47
+ message: string;
48
+ }
49
+ declare function UnrecognizedSystemErrorFactory(path: string[], systemName: string): z.ZodError<any>;
50
+
51
+ declare const STORE_NAME_MAX_LENGTH = 16;
52
+ declare const STORE_NAMESPACE_MAX_LENGTH = 14;
53
+ declare function validateName(name: string, ctx: RefinementCtx): void;
54
+ declare function validateCapitalizedName(name: string, ctx: RefinementCtx): void;
55
+ declare function validateUncapitalizedName(name: string, ctx: RefinementCtx): void;
56
+ declare function validateEnum(members: string[], ctx: RefinementCtx): void;
57
+ declare const validateRoute: (route: string, ctx: RefinementCtx) => void;
58
+ declare const validateBaseRoute: (route: string, ctx: RefinementCtx) => void;
59
+ declare const validateSingleLevelRoute: (route: string, ctx: RefinementCtx) => void;
60
+ declare function validateEthereumAddress(address: string, ctx: RefinementCtx): void;
61
+ declare function getDuplicates<T>(array: T[]): T[];
62
+ declare function validateNamespace(name: string, ctx: RefinementCtx): void;
63
+ /** Returns null if the type does not look like a static array, otherwise element and length data */
64
+ declare function parseStaticArray(abiType: string): {
65
+ elementType: string;
66
+ staticLength: number;
67
+ } | null;
68
+
69
+ export { GlobalWithMUDCoreContext, MUDConfigExtender, MUDContextAlreadyCreatedError, MUDContextNotCreatedError, MUDCoreContext, NotInsideProjectError, STORE_NAMESPACE_MAX_LENGTH, STORE_NAME_MAX_LENGTH, UnrecognizedSystemErrorFactory, fromZodErrorCustom, getDuplicates, parseStaticArray, validateBaseRoute, validateCapitalizedName, validateEnum, validateEthereumAddress, validateName, validateNamespace, validateRoute, validateSingleLevelRoute, validateUncapitalizedName, zBaseRoute, zEthereumAddress, zName, zNamespace, zObjectName, zOrdinaryRoute, zSingleLevelRoute, zUserEnum, zValueName };
@@ -0,0 +1,4 @@
1
+ declare function loadConfig(configPath?: string): Promise<unknown>;
2
+ declare function resolveConfigPath(configPath: string | undefined, toFileURL?: boolean): Promise<string>;
3
+
4
+ export { loadConfig, resolveConfigPath };
@@ -0,0 +1 @@
1
+ export { m as mudCoreConfig, r as resolveTableId } from '../dynamicResolution-d10c23a8.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/config",
3
- "version": "2.0.0-next.13",
3
+ "version": "2.0.0-next.15",
4
4
  "description": "Config for Store and World",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,8 +33,8 @@
33
33
  "viem": "1.14.0",
34
34
  "zod": "^3.21.4",
35
35
  "zod-validation-error": "^1.3.0",
36
- "@latticexyz/common": "2.0.0-next.13",
37
- "@latticexyz/schema-type": "2.0.0-next.13"
36
+ "@latticexyz/common": "2.0.0-next.15",
37
+ "@latticexyz/schema-type": "2.0.0-next.15"
38
38
  },
39
39
  "devDependencies": {
40
40
  "tsup": "^6.7.0"