@synnaxlabs/x 0.49.3 → 0.52.3
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/.turbo/turbo-build.log +10 -10
- package/dist/eslint.config.d.ts +2 -2
- package/dist/eslint.config.d.ts.map +1 -1
- package/dist/src/color/color.d.ts +26 -2
- package/dist/src/color/color.d.ts.map +1 -1
- package/dist/src/color/gradient.d.ts +10 -0
- package/dist/src/color/gradient.d.ts.map +1 -1
- package/dist/src/color/palette.d.ts +22 -2
- package/dist/src/color/palette.d.ts.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/kv/types.d.ts.map +1 -1
- package/dist/src/label/label.d.ts +15 -1
- package/dist/src/label/label.d.ts.map +1 -1
- package/dist/src/record/record.d.ts +23 -9
- package/dist/src/record/record.d.ts.map +1 -1
- package/dist/src/status/status.d.ts +5 -0
- package/dist/src/status/status.d.ts.map +1 -1
- package/dist/src/sync/mutex.d.ts +3 -3
- package/dist/src/zod/util.d.ts +2 -0
- package/dist/src/zod/util.d.ts.map +1 -1
- package/dist/x.cjs +11 -8
- package/dist/x.js +1106 -1129
- package/eslint.config.ts +3 -3
- package/package.json +9 -8
- package/src/array/external.ts +1 -1
- package/src/array/index.ts +1 -1
- package/src/array/nullable.ts +1 -1
- package/src/array/toArray.spec.ts +1 -1
- package/src/array/toArray.ts +1 -1
- package/src/array/update.spec.ts +1 -1
- package/src/array/update.ts +1 -1
- package/src/binary/codec.spec.ts +1 -1
- package/src/binary/codec.ts +1 -1
- package/src/binary/index.ts +1 -1
- package/src/breaker/breaker.spec.ts +1 -1
- package/src/breaker/breaker.ts +1 -1
- package/src/breaker/index.ts +1 -1
- package/src/caseconv/caseconv.spec.ts +1 -1
- package/src/caseconv/caseconv.ts +1 -1
- package/src/caseconv/index.ts +1 -1
- package/src/change/change.ts +1 -1
- package/src/change/index.ts +1 -1
- package/src/clamp/clamp.ts +1 -1
- package/src/color/color.spec.ts +27 -2
- package/src/color/color.ts +10 -4
- package/src/color/external.ts +1 -1
- package/src/color/gradient.ts +1 -1
- package/src/color/index.ts +1 -1
- package/src/color/palette.ts +1 -1
- package/src/compare/binary.spec.ts +1 -1
- package/src/compare/binary.ts +1 -1
- package/src/compare/compare.spec.ts +1 -1
- package/src/compare/compare.ts +1 -1
- package/src/compare/external.ts +1 -1
- package/src/compare/index.ts +1 -1
- package/src/control/control.ts +1 -1
- package/src/control/index.ts +1 -1
- package/src/csv/csv.spec.ts +1 -1
- package/src/csv/csv.ts +1 -1
- package/src/csv/index.ts +1 -1
- package/src/debounce/debounce.spec.ts +1 -1
- package/src/debounce/debounce.ts +1 -1
- package/src/debounce/index.ts +1 -1
- package/src/deep/copy.spec.ts +1 -1
- package/src/deep/copy.ts +1 -1
- package/src/deep/difference.spec.ts +1 -1
- package/src/deep/difference.ts +1 -1
- package/src/deep/equal.spec.ts +1 -1
- package/src/deep/equal.ts +1 -1
- package/src/deep/external.ts +1 -1
- package/src/deep/get.bench.ts +1 -1
- package/src/deep/get.spec.ts +1 -1
- package/src/deep/get.ts +1 -1
- package/src/deep/index.ts +1 -1
- package/src/deep/join.ts +1 -1
- package/src/deep/merge.spec.ts +1 -1
- package/src/deep/merge.ts +1 -1
- package/src/deep/partial.spec.ts +1 -1
- package/src/deep/partial.ts +1 -1
- package/src/deep/path.spec.ts +1 -1
- package/src/deep/path.ts +1 -1
- package/src/deep/remove.bench.ts +1 -1
- package/src/deep/remove.spec.ts +1 -1
- package/src/deep/remove.ts +1 -1
- package/src/deep/set.bench.ts +1 -1
- package/src/deep/set.spec.ts +1 -1
- package/src/deep/set.ts +1 -1
- package/src/destructor/destructor.ts +1 -1
- package/src/destructor/index.ts +1 -1
- package/src/errors/errors.spec.ts +1 -1
- package/src/errors/errors.ts +1 -1
- package/src/errors/index.ts +1 -1
- package/src/id/id.spec.ts +1 -1
- package/src/id/id.ts +1 -1
- package/src/id/index.ts +1 -1
- package/src/index.ts +1 -2
- package/src/instance/index.ts +1 -1
- package/src/instance/matcher.spec.ts +1 -1
- package/src/instance/matcher.ts +1 -1
- package/src/kv/external.ts +1 -1
- package/src/kv/index.ts +1 -1
- package/src/kv/mock.spec.ts +1 -1
- package/src/kv/mock.ts +1 -1
- package/src/kv/types.ts +2 -4
- package/src/label/index.ts +1 -1
- package/src/label/label.ts +4 -2
- package/src/link/index.ts +1 -1
- package/src/link/link.spec.ts +1 -1
- package/src/link/link.ts +1 -1
- package/src/map/index.ts +1 -1
- package/src/map/map.spec.ts +1 -1
- package/src/map/map.ts +1 -1
- package/src/math/constants.ts +1 -1
- package/src/math/external.ts +1 -1
- package/src/math/index.ts +1 -1
- package/src/math/math.spec.ts +1 -1
- package/src/math/math.ts +1 -1
- package/src/math/round.spec.ts +1 -1
- package/src/math/round.ts +1 -1
- package/src/migrate/index.ts +1 -1
- package/src/migrate/migrate.spec.ts +1 -1
- package/src/migrate/migrate.ts +5 -5
- package/src/mock/MockGLBufferController.ts +1 -1
- package/src/narrow/index.ts +1 -1
- package/src/narrow/narrow.spec.ts +1 -1
- package/src/narrow/narrow.ts +1 -1
- package/src/notation/index.ts +1 -1
- package/src/notation/notation.spec.ts +1 -1
- package/src/notation/notation.ts +1 -1
- package/src/numeric/index.ts +1 -1
- package/src/numeric/numeric.ts +1 -1
- package/src/observe/index.ts +1 -1
- package/src/observe/observe.ts +1 -1
- package/src/observe/obsever.spec.ts +1 -1
- package/src/optional/index.ts +1 -1
- package/src/optional/optional.ts +1 -1
- package/src/primitive/index.ts +1 -1
- package/src/primitive/primitive.spec.ts +1 -1
- package/src/primitive/primitive.ts +1 -1
- package/src/record/index.ts +1 -1
- package/src/record/record.spec.ts +32 -18
- package/src/record/record.ts +30 -14
- package/src/runtime/detect.ts +1 -1
- package/src/runtime/external.ts +1 -1
- package/src/runtime/index.ts +1 -1
- package/src/runtime/os.ts +1 -1
- package/src/scheduler/index.ts +1 -1
- package/src/scheduler/scheduler.spec.ts +1 -1
- package/src/scheduler/scheduler.ts +1 -1
- package/src/shallow/copy.spec.ts +1 -1
- package/src/shallow/copy.ts +1 -1
- package/src/shallow/index.ts +1 -1
- package/src/singleton/define.spec.ts +1 -1
- package/src/singleton/define.ts +1 -1
- package/src/singleton/index.ts +1 -1
- package/src/sleep/index.ts +1 -1
- package/src/sleep/sleep.ts +1 -1
- package/src/spatial/base.ts +1 -1
- package/src/spatial/bounds/bounds.spec.ts +1 -1
- package/src/spatial/bounds/bounds.ts +1 -1
- package/src/spatial/bounds/index.ts +1 -1
- package/src/spatial/box/box.spec.ts +1 -1
- package/src/spatial/box/box.ts +1 -1
- package/src/spatial/box/index.ts +1 -1
- package/src/spatial/dimensions/dimensions.spec.ts +1 -1
- package/src/spatial/dimensions/dimensions.ts +1 -1
- package/src/spatial/dimensions/index.ts +1 -1
- package/src/spatial/direction/direction.spec.ts +1 -1
- package/src/spatial/direction/direction.ts +1 -1
- package/src/spatial/direction/index.ts +1 -1
- package/src/spatial/external.ts +1 -1
- package/src/spatial/index.ts +1 -1
- package/src/spatial/location/index.ts +1 -1
- package/src/spatial/location/location.spec.ts +1 -1
- package/src/spatial/location/location.ts +1 -1
- package/src/spatial/scale/index.ts +1 -1
- package/src/spatial/scale/scale.spec.ts +1 -1
- package/src/spatial/scale/scale.ts +1 -1
- package/src/spatial/spatial.ts +1 -1
- package/src/spatial/sticky/index.ts +1 -1
- package/src/spatial/sticky/sticky.spec.ts +1 -1
- package/src/spatial/sticky/sticky.ts +1 -1
- package/src/spatial/xy/index.ts +1 -1
- package/src/spatial/xy/xy.spec.ts +1 -1
- package/src/spatial/xy/xy.ts +1 -1
- package/src/status/index.ts +1 -1
- package/src/status/status.spec.ts +168 -1
- package/src/status/status.ts +47 -1
- package/src/strings/deduplicateFileName.spec.ts +1 -1
- package/src/strings/deduplicateFileName.ts +1 -1
- package/src/strings/external.ts +1 -1
- package/src/strings/index.ts +1 -1
- package/src/strings/strings.spec.ts +1 -1
- package/src/strings/strings.ts +1 -1
- package/src/sync/index.ts +1 -1
- package/src/sync/mutex.ts +4 -4
- package/src/telem/gl.ts +1 -1
- package/src/telem/index.ts +1 -1
- package/src/telem/series.spec.ts +1 -1
- package/src/telem/series.ts +4 -4
- package/src/telem/telem.spec.ts +1 -1
- package/src/telem/telem.ts +1 -1
- package/src/testutil/index.ts +1 -1
- package/src/testutil/testutil.spec.ts +1 -1
- package/src/testutil/testutil.ts +1 -1
- package/src/types/index.ts +1 -1
- package/src/unique/index.ts +1 -1
- package/src/unique/unique.spec.ts +1 -1
- package/src/unique/unique.ts +1 -1
- package/src/url/index.ts +1 -1
- package/src/url/url.spec.ts +1 -1
- package/src/url/url.ts +1 -1
- package/src/uuid/index.ts +1 -1
- package/src/uuid/uuid.spec.ts +1 -1
- package/src/uuid/uuid.ts +1 -1
- package/src/worker/index.ts +1 -1
- package/src/worker/worker.spec.ts +1 -1
- package/src/worker/worker.ts +1 -1
- package/src/zod/external.ts +1 -1
- package/src/zod/index.ts +1 -1
- package/src/zod/nullToUndefined.spec.ts +1 -1
- package/src/zod/nullToUndefined.ts +1 -1
- package/src/zod/schemas.spec.ts +1 -1
- package/src/zod/schemas.ts +1 -1
- package/src/zod/toArray.spec.ts +1 -1
- package/src/zod/toArray.ts +1 -1
- package/src/zod/util.spec.ts +31 -1
- package/src/zod/util.ts +14 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +1 -2
- package/dist/src/jsonrpc/index.d.ts +0 -2
- package/dist/src/jsonrpc/index.d.ts.map +0 -1
- package/dist/src/jsonrpc/jsonrpc.d.ts +0 -70
- package/dist/src/jsonrpc/jsonrpc.d.ts.map +0 -1
- package/dist/src/jsonrpc/jsonrpc.spec.d.ts +0 -2
- package/dist/src/jsonrpc/jsonrpc.spec.d.ts.map +0 -1
- package/src/jsonrpc/index.ts +0 -10
- package/src/jsonrpc/jsonrpc.spec.ts +0 -135
- package/src/jsonrpc/jsonrpc.ts +0 -125
package/src/errors/errors.ts
CHANGED
package/src/errors/index.ts
CHANGED
package/src/id/id.spec.ts
CHANGED
package/src/id/id.ts
CHANGED
package/src/id/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2026 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -23,7 +23,6 @@ export * from "@/destructor";
|
|
|
23
23
|
export * from "@/errors";
|
|
24
24
|
export * from "@/id";
|
|
25
25
|
export * from "@/instance";
|
|
26
|
-
export * from "@/jsonrpc";
|
|
27
26
|
export * from "@/kv";
|
|
28
27
|
export * from "@/label";
|
|
29
28
|
export * from "@/link";
|
package/src/instance/index.ts
CHANGED
package/src/instance/matcher.ts
CHANGED
package/src/kv/external.ts
CHANGED
package/src/kv/index.ts
CHANGED
package/src/kv/mock.spec.ts
CHANGED
package/src/kv/mock.ts
CHANGED
package/src/kv/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2026 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -46,9 +46,7 @@ export interface AsyncDeleter {
|
|
|
46
46
|
|
|
47
47
|
/** A read-writable key-value store. */
|
|
48
48
|
export interface Async<R = unknown, W = R>
|
|
49
|
-
extends AsyncReader<R>,
|
|
50
|
-
AsyncWriter<W>,
|
|
51
|
-
AsyncDeleter {}
|
|
49
|
+
extends AsyncReader<R>, AsyncWriter<W>, AsyncDeleter {}
|
|
52
50
|
|
|
53
51
|
export const stringPairZ = z.object({ key: z.string(), value: z.string() });
|
|
54
52
|
|
package/src/label/index.ts
CHANGED
package/src/label/label.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2026 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -9,12 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
import z from "zod";
|
|
11
11
|
|
|
12
|
+
import { color } from "@/color";
|
|
13
|
+
|
|
12
14
|
export const keyZ = z.uuid();
|
|
13
15
|
export type Key = z.infer<typeof keyZ>;
|
|
14
16
|
|
|
15
17
|
export const labelZ = z.object({
|
|
16
18
|
key: keyZ,
|
|
17
19
|
name: z.string().min(1),
|
|
18
|
-
color:
|
|
20
|
+
color: color.colorZ,
|
|
19
21
|
});
|
|
20
22
|
export interface Label extends z.infer<typeof labelZ> {}
|
package/src/link/index.ts
CHANGED
package/src/link/link.spec.ts
CHANGED
package/src/link/link.ts
CHANGED
package/src/map/index.ts
CHANGED
package/src/map/map.spec.ts
CHANGED
package/src/map/map.ts
CHANGED
package/src/math/constants.ts
CHANGED
package/src/math/external.ts
CHANGED
package/src/math/index.ts
CHANGED
package/src/math/math.spec.ts
CHANGED
package/src/math/math.ts
CHANGED
package/src/math/round.spec.ts
CHANGED
package/src/math/round.ts
CHANGED
package/src/migrate/index.ts
CHANGED
package/src/migrate/migrate.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2026 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -101,11 +101,11 @@ export const compareSemVer = ((
|
|
|
101
101
|
const semB = semVerZ.parse(b);
|
|
102
102
|
|
|
103
103
|
// Split version and pre-release parts
|
|
104
|
-
const [
|
|
105
|
-
const [
|
|
104
|
+
const [aMain, aPreRelease] = semA.split("-");
|
|
105
|
+
const [bMain, bPreRelease] = semB.split("-");
|
|
106
106
|
|
|
107
|
-
const [aMajor, aMinor, aPatch] =
|
|
108
|
-
const [bMajor, bMinor, bPatch] =
|
|
107
|
+
const [aMajor, aMinor, aPatch] = aMain.split(".").map(Number);
|
|
108
|
+
const [bMajor, bMinor, bPatch] = bMain.split(".").map(Number);
|
|
109
109
|
|
|
110
110
|
if (opts.checkMajor) {
|
|
111
111
|
if (aMajor < bMajor) return compare.LESS_THAN;
|
package/src/narrow/index.ts
CHANGED
package/src/narrow/narrow.ts
CHANGED
package/src/notation/index.ts
CHANGED
package/src/notation/notation.ts
CHANGED
package/src/numeric/index.ts
CHANGED
package/src/numeric/numeric.ts
CHANGED
package/src/observe/index.ts
CHANGED
package/src/observe/observe.ts
CHANGED
package/src/optional/index.ts
CHANGED
package/src/optional/optional.ts
CHANGED
package/src/primitive/index.ts
CHANGED
package/src/record/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2026 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { describe, expect, it } from "vitest";
|
|
11
|
+
import z from "zod";
|
|
11
12
|
|
|
12
13
|
import { record } from "@/record";
|
|
13
14
|
|
|
@@ -62,7 +63,28 @@ describe("record", () => {
|
|
|
62
63
|
expect(keyedNamedNumber.name).toBe("Number Item");
|
|
63
64
|
});
|
|
64
65
|
});
|
|
65
|
-
|
|
66
|
+
describe("keyZ", () => {
|
|
67
|
+
it("should accept string keys", () => {
|
|
68
|
+
const stringKey = "test";
|
|
69
|
+
expect(record.keyZ.parse(stringKey)).toBe(stringKey);
|
|
70
|
+
});
|
|
71
|
+
it("should accept number keys", () => {
|
|
72
|
+
const numberKey = 123;
|
|
73
|
+
expect(record.keyZ.parse(numberKey)).toBe(numberKey);
|
|
74
|
+
});
|
|
75
|
+
it("should reject symbol keys", () => {
|
|
76
|
+
const symbolKey = Symbol("test");
|
|
77
|
+
expect(() => record.keyZ.parse(symbolKey)).toThrowError(z.ZodError);
|
|
78
|
+
});
|
|
79
|
+
it("should reject undefined keys", () => {
|
|
80
|
+
const undefinedKey = undefined;
|
|
81
|
+
expect(() => record.keyZ.parse(undefinedKey)).toThrowError(z.ZodError);
|
|
82
|
+
});
|
|
83
|
+
it("should reject null keys", () => {
|
|
84
|
+
const nullKey = null;
|
|
85
|
+
expect(() => record.keyZ.parse(nullKey)).toThrowError(z.ZodError);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
66
88
|
describe("unknownZ", () => {
|
|
67
89
|
it("should validate valid records", () => {
|
|
68
90
|
const validRecord = {
|
|
@@ -70,26 +92,19 @@ describe("record", () => {
|
|
|
70
92
|
number: 42,
|
|
71
93
|
symbol: Symbol("test"),
|
|
72
94
|
nested: { key: "value" },
|
|
73
|
-
|
|
95
|
+
2: [1, 2, 3],
|
|
96
|
+
function: () => {},
|
|
74
97
|
};
|
|
75
|
-
|
|
76
|
-
const result = record.unknownZ.safeParse(validRecord);
|
|
77
|
-
expect(result.success).toBe(true);
|
|
98
|
+
expect(record.unknownZ.parse(validRecord)).toEqual(validRecord);
|
|
78
99
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
[Symbol("test")]: "value", // Symbol keys are not allowed in the schema
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const result = record.unknownZ.safeParse(invalidRecord);
|
|
86
|
-
expect(result.success).toBe(true);
|
|
100
|
+
it("should reject symbol keys", () => {
|
|
101
|
+
const invalidRecord = { [Symbol("test")]: "value" };
|
|
102
|
+
expect(() => record.unknownZ.parse(invalidRecord)).toThrowError(z.ZodError);
|
|
87
103
|
});
|
|
88
104
|
|
|
89
105
|
it("should accept empty objects", () => {
|
|
90
106
|
const emptyRecord = {};
|
|
91
|
-
|
|
92
|
-
expect(result.success).toBe(true);
|
|
107
|
+
expect(record.unknownZ.parse(emptyRecord)).toEqual(emptyRecord);
|
|
93
108
|
});
|
|
94
109
|
|
|
95
110
|
it("should accept null and undefined values", () => {
|
|
@@ -99,8 +114,7 @@ describe("record", () => {
|
|
|
99
114
|
string: "value",
|
|
100
115
|
};
|
|
101
116
|
|
|
102
|
-
|
|
103
|
-
expect(result.success).toBe(true);
|
|
117
|
+
expect(record.unknownZ.parse(recordWithNulls)).toEqual(recordWithNulls);
|
|
104
118
|
});
|
|
105
119
|
});
|
|
106
120
|
|
package/src/record/record.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2026 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -10,16 +10,41 @@
|
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* Can be either a string or number.
|
|
13
|
+
* Zod schema for validating record keys. Can be either a string or number.
|
|
15
14
|
*/
|
|
16
|
-
export
|
|
15
|
+
export const keyZ = z.union([z.string(), z.number()]);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Represents valid key types for record objects. Can be either a string or number.
|
|
19
|
+
*/
|
|
20
|
+
export type Key = z.infer<typeof keyZ>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Zod schema for validating unknown records. Accepts objects with string or number keys
|
|
24
|
+
* and unknown values.
|
|
25
|
+
*/
|
|
26
|
+
export const unknownZ = z.record(keyZ, z.unknown());
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* For required JSON/record fields: coerces null/undefined to empty object {}.
|
|
30
|
+
* Use when the record must always be present and iterable.
|
|
31
|
+
*
|
|
32
|
+
* - null → {}
|
|
33
|
+
* - undefined → {}
|
|
34
|
+
* - {} → {}
|
|
35
|
+
* - {data} → {data}
|
|
36
|
+
*/
|
|
37
|
+
export const nullishToEmpty = (): z.ZodType<Unknown> =>
|
|
38
|
+
z.union([
|
|
39
|
+
z.union([z.null(), z.undefined()]).transform<Unknown>(() => ({})),
|
|
40
|
+
unknownZ,
|
|
41
|
+
]);
|
|
17
42
|
|
|
18
43
|
/**
|
|
19
44
|
* Represents a record with unknown values and string/number keys.
|
|
20
45
|
* This is a generic type for objects where the value types are not known.
|
|
21
46
|
*/
|
|
22
|
-
export
|
|
47
|
+
export interface Unknown extends z.infer<typeof unknownZ> {}
|
|
23
48
|
|
|
24
49
|
/**
|
|
25
50
|
* Interface for objects that have a key property.
|
|
@@ -41,15 +66,6 @@ export interface KeyedNamed<K extends Key = string> {
|
|
|
41
66
|
name: string;
|
|
42
67
|
}
|
|
43
68
|
|
|
44
|
-
/**
|
|
45
|
-
* Zod schema for validating unknown records.
|
|
46
|
-
* Accepts objects with string, number, or symbol keys and unknown values.
|
|
47
|
-
*/
|
|
48
|
-
export const unknownZ = z.record(
|
|
49
|
-
z.union([z.number(), z.string(), z.symbol()]),
|
|
50
|
-
z.unknown(),
|
|
51
|
-
);
|
|
52
|
-
|
|
53
69
|
/**
|
|
54
70
|
* Type representing the entries of a record as an array of key-value tuples.
|
|
55
71
|
* @template T - The record type
|
package/src/runtime/detect.ts
CHANGED
package/src/runtime/external.ts
CHANGED
package/src/runtime/index.ts
CHANGED
package/src/runtime/os.ts
CHANGED
package/src/scheduler/index.ts
CHANGED
package/src/shallow/copy.spec.ts
CHANGED