From 1cf3923e86398e2c6510c1575043c593d6db45da Mon Sep 17 00:00:00 2001 From: alvrs Date: Wed, 20 Mar 2024 20:04:18 +0000 Subject: [PATCH] disable definition of namespaces on external config for now --- packages/world/ts/config/v2/world.test.ts | 13 ++++++++++++- packages/world/ts/config/v2/world.ts | 8 ++++++++ packages/world/ts/exports/index.ts | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/world/ts/config/v2/world.test.ts b/packages/world/ts/config/v2/world.test.ts index 7895da0405..918c66cf0a 100644 --- a/packages/world/ts/config/v2/world.test.ts +++ b/packages/world/ts/config/v2/world.test.ts @@ -1,5 +1,5 @@ import { describe, it } from "vitest"; -import { defineWorld } from "./world"; +import { defineWorld, defineWorldWithoutNamespaces } from "./world"; import { attest } from "@arktype/attest"; import { resourceToHex } from "@latticexyz/common"; import { @@ -715,3 +715,14 @@ describe("defineWorld", () => { ).throwsAndHasTypeError("Overrides of `name` and `namespace` are not allowed for tables in a store config"); }); }); + +describe("defineWorldWithoutNamespaces", () => { + it("should throw if namespaces are defined", () => { + attest(() => + defineWorldWithoutNamespaces({ + // @ts-expect-error Namespaces will be enabled soon + namespaces: {}, + }), + ).type.errors("Namespaces will be enabled soon"); + }); +}); diff --git a/packages/world/ts/config/v2/world.ts b/packages/world/ts/config/v2/world.ts index d7cfb74355..546bbd900c 100644 --- a/packages/world/ts/config/v2/world.ts +++ b/packages/world/ts/config/v2/world.ts @@ -108,3 +108,11 @@ export function defineWorld(world: validateWorld): resolveWo validateWorld(world); return resolveWorld(world) as unknown as resolveWorld; } + +// Temporary external export of defineWorld with namespaces disabled +export function defineWorldWithoutNamespaces( + world: validateWorld & { namespaces: `Namespaces will be enabled soon` }, +): resolveWorld { + validateWorld(world); + return resolveWorld(world) as unknown as resolveWorld; +} diff --git a/packages/world/ts/exports/index.ts b/packages/world/ts/exports/index.ts index 283c71b3e1..b844472298 100644 --- a/packages/world/ts/exports/index.ts +++ b/packages/world/ts/exports/index.ts @@ -6,5 +6,5 @@ export { helloWorldEvent, worldDeployedEvent } from "../worldEvents"; -export { defineWorld } from "../config/v2/world"; +export { defineWorldWithoutNamespaces as defineWorld } from "../config/v2/world"; export type { World } from "../config/v2/output";