avancement planning
This commit is contained in:
+7
-4
@@ -1,4 +1,5 @@
|
||||
"use strict";
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.globalRegistry = exports.$ZodRegistry = exports.$input = exports.$output = void 0;
|
||||
exports.registry = registry;
|
||||
@@ -6,7 +7,7 @@ exports.$output = Symbol("ZodOutput");
|
||||
exports.$input = Symbol("ZodInput");
|
||||
class $ZodRegistry {
|
||||
constructor() {
|
||||
this._map = new Map();
|
||||
this._map = new WeakMap();
|
||||
this._idmap = new Map();
|
||||
}
|
||||
add(schema, ..._meta) {
|
||||
@@ -21,7 +22,7 @@ class $ZodRegistry {
|
||||
return this;
|
||||
}
|
||||
clear() {
|
||||
this._map = new Map();
|
||||
this._map = new WeakMap();
|
||||
this._idmap = new Map();
|
||||
return this;
|
||||
}
|
||||
@@ -40,7 +41,8 @@ class $ZodRegistry {
|
||||
if (p) {
|
||||
const pm = { ...(this.get(p) ?? {}) };
|
||||
delete pm.id; // do not inherit id
|
||||
return { ...pm, ...this._map.get(schema) };
|
||||
const f = { ...pm, ...this._map.get(schema) };
|
||||
return Object.keys(f).length ? f : undefined;
|
||||
}
|
||||
return this._map.get(schema);
|
||||
}
|
||||
@@ -53,4 +55,5 @@ exports.$ZodRegistry = $ZodRegistry;
|
||||
function registry() {
|
||||
return new $ZodRegistry();
|
||||
}
|
||||
exports.globalRegistry = registry();
|
||||
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
||||
exports.globalRegistry = globalThis.__zod_globalRegistry;
|
||||
|
||||
Reference in New Issue
Block a user