@latticexyz/world 2.0.0-main-9aa5e786 → 2.0.0-main-c191cfd1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/ts/config/v2/world.test.ts +12 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latticexyz/world",
|
|
3
|
-
"version": "2.0.0-main-
|
|
3
|
+
"version": "2.0.0-main-c191cfd1",
|
|
4
4
|
"description": "World framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"arktype": "1.0.29-alpha",
|
|
36
36
|
"viem": "2.7.12",
|
|
37
37
|
"zod": "^3.21.4",
|
|
38
|
-
"@latticexyz/common": "2.0.0-main-
|
|
39
|
-
"@latticexyz/config": "2.0.0-main-
|
|
40
|
-
"@latticexyz/
|
|
41
|
-
"@latticexyz/
|
|
38
|
+
"@latticexyz/common": "2.0.0-main-c191cfd1",
|
|
39
|
+
"@latticexyz/config": "2.0.0-main-c191cfd1",
|
|
40
|
+
"@latticexyz/store": "2.0.0-main-c191cfd1",
|
|
41
|
+
"@latticexyz/schema-type": "2.0.0-main-c191cfd1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/ejs": "^3.1.1",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"tsup": "^6.7.0",
|
|
54
54
|
"tsx": "^3.12.6",
|
|
55
55
|
"vitest": "0.34.6",
|
|
56
|
-
"@latticexyz/abi-ts": "2.0.0-main-
|
|
57
|
-
"@latticexyz/gas-report": "2.0.0-main-
|
|
56
|
+
"@latticexyz/abi-ts": "2.0.0-main-c191cfd1",
|
|
57
|
+
"@latticexyz/gas-report": "2.0.0-main-c191cfd1"
|
|
58
58
|
},
|
|
59
59
|
"gitHead": "914a1e0ae4a573d685841ca2ea921435057deb8f",
|
|
60
60
|
"scripts": {
|
|
@@ -257,7 +257,7 @@ describe("resolveWorldConfig", () => {
|
|
|
257
257
|
attest<typeof config>(expected);
|
|
258
258
|
});
|
|
259
259
|
|
|
260
|
-
it("
|
|
260
|
+
it("should accept a user type as input and expand it", () => {
|
|
261
261
|
const config = resolveWorldConfig({ tables: { Name: "CustomType" }, userTypes: { CustomType: "address" } });
|
|
262
262
|
const expected = {
|
|
263
263
|
tables: {
|
|
@@ -391,7 +391,7 @@ describe("resolveWorldConfig", () => {
|
|
|
391
391
|
});
|
|
392
392
|
|
|
393
393
|
it("throw an error if the shorthand doesn't include a key field", () => {
|
|
394
|
-
attest(
|
|
394
|
+
attest(() =>
|
|
395
395
|
resolveWorldConfig({
|
|
396
396
|
tables: {
|
|
397
397
|
// @ts-expect-error Provide a `key` field with static ABI type or a full config with explicit primaryKey override.
|
|
@@ -401,14 +401,18 @@ describe("resolveWorldConfig", () => {
|
|
|
401
401
|
},
|
|
402
402
|
},
|
|
403
403
|
}),
|
|
404
|
-
).type.errors(
|
|
404
|
+
).type.errors(
|
|
405
|
+
"Invalid schema. Expected a `key` field with a static ABI type or an explicit `primaryKey` option.",
|
|
406
|
+
);
|
|
405
407
|
});
|
|
406
408
|
|
|
407
409
|
it("throw an error if the shorthand config includes a non-static key field", () => {
|
|
408
410
|
attest(
|
|
409
411
|
// @ts-expect-error Provide a `key` field with static ABI type or a full config with explicit primaryKey override.
|
|
410
412
|
resolveWorldConfig({ tables: { Example: { key: "string", name: "string", age: "uint256" } } }),
|
|
411
|
-
).type.errors(
|
|
413
|
+
).type.errors(
|
|
414
|
+
"Invalid schema. Expected a `key` field with a static ABI type or an explicit `primaryKey` option.",
|
|
415
|
+
);
|
|
412
416
|
});
|
|
413
417
|
|
|
414
418
|
it("throw an error if the shorthand config includes a non-static user type as key field", () => {
|
|
@@ -418,7 +422,9 @@ describe("resolveWorldConfig", () => {
|
|
|
418
422
|
tables: { Example: { key: "dynamic", name: "string", age: "uint256" } },
|
|
419
423
|
userTypes: { dynamic: "string", static: "address" },
|
|
420
424
|
}),
|
|
421
|
-
).type.errors(
|
|
425
|
+
).type.errors(
|
|
426
|
+
"Invalid schema. Expected a `key` field with a static ABI type or an explicit `primaryKey` option.",
|
|
427
|
+
);
|
|
422
428
|
});
|
|
423
429
|
|
|
424
430
|
it("should return the full config given a full config with one key", () => {
|
|
@@ -530,7 +536,7 @@ describe("resolveWorldConfig", () => {
|
|
|
530
536
|
attest<typeof expected>(config);
|
|
531
537
|
});
|
|
532
538
|
|
|
533
|
-
it("
|
|
539
|
+
it("should return the full config given a full config with two primaryKey", () => {
|
|
534
540
|
const config = resolveWorldConfig({
|
|
535
541
|
tables: {
|
|
536
542
|
Example: {
|