feat(planning): grille hebdomadaire complète avec API et filtres
- Connexion API via proxy Angular (résolution CORS, base path /api) - Import CSS ng-zorro global pour les modales et composants - Filtres Camion/Show câblés sur l'affichage de la grille - Camions affichés via TrucksService (linkés au show du même créneau) - Panneau de détails : spectacles + camions du jour sélectionné - Modale de création de spectacle stylisée avec fond et centrage - Positionnement précis des events à la minute dans leur créneau - Auto-scroll vers l'heure courante au chargement - Ligne "maintenant" sur la colonne du jour actuel - Régénération des services OpenAPI (nouveaux noms de types) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+47
-93
@@ -6,16 +6,18 @@ import * as parse from "./parse.js";
|
||||
export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) => {
|
||||
core.$ZodType.init(inst, def);
|
||||
inst.def = def;
|
||||
inst.type = def.type;
|
||||
Object.defineProperty(inst, "_def", { value: def });
|
||||
// base methods
|
||||
inst.check = (...checks) => {
|
||||
return inst.clone(util.mergeDefs(def, {
|
||||
return inst.clone({
|
||||
...def,
|
||||
checks: [
|
||||
...(def.checks ?? []),
|
||||
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
|
||||
],
|
||||
}));
|
||||
}
|
||||
// { parent: true }
|
||||
);
|
||||
};
|
||||
inst.clone = (def, params) => core.clone(inst, def, params);
|
||||
inst.brand = () => inst;
|
||||
@@ -29,15 +31,6 @@ export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) =>
|
||||
inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });
|
||||
inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
|
||||
inst.spa = inst.safeParseAsync;
|
||||
// encoding/decoding
|
||||
inst.encode = (data, params) => parse.encode(inst, data, params);
|
||||
inst.decode = (data, params) => parse.decode(inst, data, params);
|
||||
inst.encodeAsync = async (data, params) => parse.encodeAsync(inst, data, params);
|
||||
inst.decodeAsync = async (data, params) => parse.decodeAsync(inst, data, params);
|
||||
inst.safeEncode = (data, params) => parse.safeEncode(inst, data, params);
|
||||
inst.safeDecode = (data, params) => parse.safeDecode(inst, data, params);
|
||||
inst.safeEncodeAsync = async (data, params) => parse.safeEncodeAsync(inst, data, params);
|
||||
inst.safeDecodeAsync = async (data, params) => parse.safeDecodeAsync(inst, data, params);
|
||||
// refinements
|
||||
inst.refine = (check, params) => inst.check(refine(check, params));
|
||||
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
||||
@@ -106,7 +99,6 @@ export const _ZodString = /*@__PURE__*/ core.$constructor("_ZodString", (inst, d
|
||||
inst.normalize = (...args) => inst.check(checks.normalize(...args));
|
||||
inst.toLowerCase = () => inst.check(checks.toLowerCase());
|
||||
inst.toUpperCase = () => inst.check(checks.toUpperCase());
|
||||
inst.slugify = () => inst.check(checks.slugify());
|
||||
});
|
||||
export const ZodString = /*@__PURE__*/ core.$constructor("ZodString", (inst, def) => {
|
||||
core.$ZodString.init(inst, def);
|
||||
@@ -190,13 +182,6 @@ export const ZodURL = /*@__PURE__*/ core.$constructor("ZodURL", (inst, def) => {
|
||||
export function url(params) {
|
||||
return core._url(ZodURL, params);
|
||||
}
|
||||
export function httpUrl(params) {
|
||||
return core._url(ZodURL, {
|
||||
protocol: /^https?$/,
|
||||
hostname: core.regexes.domain,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodEmoji = /*@__PURE__*/ core.$constructor("ZodEmoji", (inst, def) => {
|
||||
// ZodStringFormat.init(inst, def);
|
||||
core.$ZodEmoji.init(inst, def);
|
||||
@@ -261,14 +246,6 @@ export const ZodIPv4 = /*@__PURE__*/ core.$constructor("ZodIPv4", (inst, def) =>
|
||||
export function ipv4(params) {
|
||||
return core._ipv4(ZodIPv4, params);
|
||||
}
|
||||
export const ZodMAC = /*@__PURE__*/ core.$constructor("ZodMAC", (inst, def) => {
|
||||
// ZodStringFormat.init(inst, def);
|
||||
core.$ZodMAC.init(inst, def);
|
||||
ZodStringFormat.init(inst, def);
|
||||
});
|
||||
export function mac(params) {
|
||||
return core._mac(ZodMAC, params);
|
||||
}
|
||||
export const ZodIPv6 = /*@__PURE__*/ core.$constructor("ZodIPv6", (inst, def) => {
|
||||
// ZodStringFormat.init(inst, def);
|
||||
core.$ZodIPv6.init(inst, def);
|
||||
@@ -331,20 +308,6 @@ export const ZodCustomStringFormat = /*@__PURE__*/ core.$constructor("ZodCustomS
|
||||
export function stringFormat(format, fnOrRegex, _params = {}) {
|
||||
return core._stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
|
||||
}
|
||||
export function hostname(_params) {
|
||||
return core._stringFormat(ZodCustomStringFormat, "hostname", core.regexes.hostname, _params);
|
||||
}
|
||||
export function hex(_params) {
|
||||
return core._stringFormat(ZodCustomStringFormat, "hex", core.regexes.hex, _params);
|
||||
}
|
||||
export function hash(alg, params) {
|
||||
const enc = params?.enc ?? "hex";
|
||||
const format = `${alg}_${enc}`;
|
||||
const regex = core.regexes[format];
|
||||
if (!regex)
|
||||
throw new Error(`Unrecognized hash format: ${format}`);
|
||||
return core._stringFormat(ZodCustomStringFormat, format, regex, params);
|
||||
}
|
||||
export const ZodNumber = /*@__PURE__*/ core.$constructor("ZodNumber", (inst, def) => {
|
||||
core.$ZodNumber.init(inst, def);
|
||||
ZodType.init(inst, def);
|
||||
@@ -518,26 +481,22 @@ export function array(element, params) {
|
||||
// .keyof
|
||||
export function keyof(schema) {
|
||||
const shape = schema._zod.def.shape;
|
||||
return _enum(Object.keys(shape));
|
||||
return literal(Object.keys(shape));
|
||||
}
|
||||
export const ZodObject = /*@__PURE__*/ core.$constructor("ZodObject", (inst, def) => {
|
||||
core.$ZodObjectJIT.init(inst, def);
|
||||
core.$ZodObject.init(inst, def);
|
||||
ZodType.init(inst, def);
|
||||
util.defineLazy(inst, "shape", () => {
|
||||
return def.shape;
|
||||
});
|
||||
util.defineLazy(inst, "shape", () => def.shape);
|
||||
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
||||
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall });
|
||||
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
||||
// inst.nonstrict = () => inst.clone({ ...inst._zod.def, catchall: api.unknown() });
|
||||
inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
||||
inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
|
||||
inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
|
||||
inst.extend = (incoming) => {
|
||||
return util.extend(inst, incoming);
|
||||
};
|
||||
inst.safeExtend = (incoming) => {
|
||||
return util.safeExtend(inst, incoming);
|
||||
};
|
||||
inst.merge = (other) => util.merge(inst, other);
|
||||
inst.pick = (mask) => util.pick(inst, mask);
|
||||
inst.omit = (mask) => util.omit(inst, mask);
|
||||
@@ -547,7 +506,10 @@ export const ZodObject = /*@__PURE__*/ core.$constructor("ZodObject", (inst, def
|
||||
export function object(shape, params) {
|
||||
const def = {
|
||||
type: "object",
|
||||
shape: shape ?? {},
|
||||
get shape() {
|
||||
util.assignProp(this, "shape", { ...shape });
|
||||
return this.shape;
|
||||
},
|
||||
...util.normalizeParams(params),
|
||||
};
|
||||
return new ZodObject(def);
|
||||
@@ -556,7 +518,10 @@ export function object(shape, params) {
|
||||
export function strictObject(shape, params) {
|
||||
return new ZodObject({
|
||||
type: "object",
|
||||
shape,
|
||||
get shape() {
|
||||
util.assignProp(this, "shape", { ...shape });
|
||||
return this.shape;
|
||||
},
|
||||
catchall: never(),
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
@@ -565,7 +530,10 @@ export function strictObject(shape, params) {
|
||||
export function looseObject(shape, params) {
|
||||
return new ZodObject({
|
||||
type: "object",
|
||||
shape,
|
||||
get shape() {
|
||||
util.assignProp(this, "shape", { ...shape });
|
||||
return this.shape;
|
||||
},
|
||||
catchall: unknown(),
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
@@ -641,11 +609,9 @@ export function record(keyType, valueType, params) {
|
||||
}
|
||||
// type alksjf = core.output<core.$ZodRecordKey>;
|
||||
export function partialRecord(keyType, valueType, params) {
|
||||
const k = core.clone(keyType);
|
||||
k._zod.values = undefined;
|
||||
return new ZodRecord({
|
||||
type: "record",
|
||||
keyType: k,
|
||||
keyType: union([keyType, never()]),
|
||||
valueType: valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
@@ -775,9 +741,6 @@ export const ZodTransform = /*@__PURE__*/ core.$constructor("ZodTransform", (ins
|
||||
core.$ZodTransform.init(inst, def);
|
||||
ZodType.init(inst, def);
|
||||
inst._zod.parse = (payload, _ctx) => {
|
||||
if (_ctx.direction === "backward") {
|
||||
throw new core.$ZodEncodeError(inst.constructor.name);
|
||||
}
|
||||
payload.addIssue = (issue) => {
|
||||
if (typeof issue === "string") {
|
||||
payload.issues.push(util.issue(issue, payload.value, def));
|
||||
@@ -790,7 +753,7 @@ export const ZodTransform = /*@__PURE__*/ core.$constructor("ZodTransform", (ins
|
||||
_issue.code ?? (_issue.code = "custom");
|
||||
_issue.input ?? (_issue.input = payload.value);
|
||||
_issue.inst ?? (_issue.inst = inst);
|
||||
// _issue.continue ??= true;
|
||||
_issue.continue ?? (_issue.continue = true);
|
||||
payload.issues.push(util.issue(_issue));
|
||||
}
|
||||
};
|
||||
@@ -848,7 +811,7 @@ export function _default(innerType, defaultValue) {
|
||||
type: "default",
|
||||
innerType: innerType,
|
||||
get defaultValue() {
|
||||
return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
|
||||
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -862,7 +825,7 @@ export function prefault(innerType, defaultValue) {
|
||||
type: "prefault",
|
||||
innerType: innerType,
|
||||
get defaultValue() {
|
||||
return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
|
||||
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -924,23 +887,9 @@ export function pipe(in_, out) {
|
||||
// ...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodCodec = /*@__PURE__*/ core.$constructor("ZodCodec", (inst, def) => {
|
||||
ZodPipe.init(inst, def);
|
||||
core.$ZodCodec.init(inst, def);
|
||||
});
|
||||
export function codec(in_, out, params) {
|
||||
return new ZodCodec({
|
||||
type: "pipe",
|
||||
in: in_,
|
||||
out: out,
|
||||
transform: params.decode,
|
||||
reverseTransform: params.encode,
|
||||
});
|
||||
}
|
||||
export const ZodReadonly = /*@__PURE__*/ core.$constructor("ZodReadonly", (inst, def) => {
|
||||
core.$ZodReadonly.init(inst, def);
|
||||
ZodType.init(inst, def);
|
||||
inst.unwrap = () => inst._zod.def.innerType;
|
||||
});
|
||||
export function readonly(innerType) {
|
||||
return new ZodReadonly({
|
||||
@@ -981,18 +930,6 @@ export function promise(innerType) {
|
||||
innerType: innerType,
|
||||
});
|
||||
}
|
||||
export const ZodFunction = /*@__PURE__*/ core.$constructor("ZodFunction", (inst, def) => {
|
||||
core.$ZodFunction.init(inst, def);
|
||||
ZodType.init(inst, def);
|
||||
});
|
||||
export function _function(params) {
|
||||
return new ZodFunction({
|
||||
type: "function",
|
||||
input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),
|
||||
output: params?.output ?? unknown(),
|
||||
});
|
||||
}
|
||||
export { _function as function };
|
||||
export const ZodCustom = /*@__PURE__*/ core.$constructor("ZodCustom", (inst, def) => {
|
||||
core.$ZodCustom.init(inst, def);
|
||||
ZodType.init(inst, def);
|
||||
@@ -1014,11 +951,27 @@ export function refine(fn, _params = {}) {
|
||||
}
|
||||
// superRefine
|
||||
export function superRefine(fn) {
|
||||
return core._superRefine(fn);
|
||||
const ch = check((payload) => {
|
||||
payload.addIssue = (issue) => {
|
||||
if (typeof issue === "string") {
|
||||
payload.issues.push(util.issue(issue, payload.value, ch._zod.def));
|
||||
}
|
||||
else {
|
||||
// for Zod 3 backwards compatibility
|
||||
const _issue = issue;
|
||||
if (_issue.fatal)
|
||||
_issue.continue = false;
|
||||
_issue.code ?? (_issue.code = "custom");
|
||||
_issue.input ?? (_issue.input = payload.value);
|
||||
_issue.inst ?? (_issue.inst = ch);
|
||||
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
||||
payload.issues.push(util.issue(_issue));
|
||||
}
|
||||
};
|
||||
return fn(payload.value, payload);
|
||||
});
|
||||
return ch;
|
||||
}
|
||||
// Re-export describe and meta from core
|
||||
export const describe = core.describe;
|
||||
export const meta = core.meta;
|
||||
function _instanceof(cls, params = {
|
||||
error: `Input not instance of ${cls.name}`,
|
||||
}) {
|
||||
@@ -1035,9 +988,10 @@ function _instanceof(cls, params = {
|
||||
export { _instanceof as instanceof };
|
||||
// stringbool
|
||||
export const stringbool = (...args) => core._stringbool({
|
||||
Codec: ZodCodec,
|
||||
Pipe: ZodPipe,
|
||||
Boolean: ZodBoolean,
|
||||
String: ZodString,
|
||||
Transform: ZodTransform,
|
||||
}, ...args);
|
||||
export function json(params) {
|
||||
const jsonSchema = lazy(() => {
|
||||
|
||||
Reference in New Issue
Block a user