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:
+101
-231
@@ -14,18 +14,13 @@ exports.nullish = nullish;
|
||||
exports.cleanRegex = cleanRegex;
|
||||
exports.floatSafeRemainder = floatSafeRemainder;
|
||||
exports.defineLazy = defineLazy;
|
||||
exports.objectClone = objectClone;
|
||||
exports.assignProp = assignProp;
|
||||
exports.mergeDefs = mergeDefs;
|
||||
exports.cloneDef = cloneDef;
|
||||
exports.getElementAtPath = getElementAtPath;
|
||||
exports.promiseAllObject = promiseAllObject;
|
||||
exports.randomString = randomString;
|
||||
exports.esc = esc;
|
||||
exports.slugify = slugify;
|
||||
exports.isObject = isObject;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.shallowClone = shallowClone;
|
||||
exports.numKeys = numKeys;
|
||||
exports.escapeRegex = escapeRegex;
|
||||
exports.clone = clone;
|
||||
@@ -36,7 +31,6 @@ exports.optionalKeys = optionalKeys;
|
||||
exports.pick = pick;
|
||||
exports.omit = omit;
|
||||
exports.extend = extend;
|
||||
exports.safeExtend = safeExtend;
|
||||
exports.merge = merge;
|
||||
exports.partial = partial;
|
||||
exports.required = required;
|
||||
@@ -48,12 +42,6 @@ exports.getSizableOrigin = getSizableOrigin;
|
||||
exports.getLengthableOrigin = getLengthableOrigin;
|
||||
exports.issue = issue;
|
||||
exports.cleanEnum = cleanEnum;
|
||||
exports.base64ToUint8Array = base64ToUint8Array;
|
||||
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
||||
exports.base64urlToUint8Array = base64urlToUint8Array;
|
||||
exports.uint8ArrayToBase64url = uint8ArrayToBase64url;
|
||||
exports.hexToUint8Array = hexToUint8Array;
|
||||
exports.uint8ArrayToHex = uint8ArrayToHex;
|
||||
// functions
|
||||
function assertEqual(val) {
|
||||
return val;
|
||||
@@ -104,33 +92,22 @@ function cleanRegex(source) {
|
||||
}
|
||||
function floatSafeRemainder(val, step) {
|
||||
const valDecCount = (val.toString().split(".")[1] || "").length;
|
||||
const stepString = step.toString();
|
||||
let stepDecCount = (stepString.split(".")[1] || "").length;
|
||||
if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
|
||||
const match = stepString.match(/\d?e-(\d?)/);
|
||||
if (match?.[1]) {
|
||||
stepDecCount = Number.parseInt(match[1]);
|
||||
}
|
||||
}
|
||||
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
||||
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
||||
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
||||
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
||||
return (valInt % stepInt) / 10 ** decCount;
|
||||
}
|
||||
const EVALUATING = Symbol("evaluating");
|
||||
function defineLazy(object, key, getter) {
|
||||
let value = undefined;
|
||||
const set = false;
|
||||
Object.defineProperty(object, key, {
|
||||
get() {
|
||||
if (value === EVALUATING) {
|
||||
// Circular reference detected, return undefined to break the cycle
|
||||
return undefined;
|
||||
if (!set) {
|
||||
const value = getter();
|
||||
object[key] = value;
|
||||
return value;
|
||||
}
|
||||
if (value === undefined) {
|
||||
value = EVALUATING;
|
||||
value = getter();
|
||||
}
|
||||
return value;
|
||||
throw new Error("cached value already set");
|
||||
},
|
||||
set(v) {
|
||||
Object.defineProperty(object, key, {
|
||||
@@ -142,9 +119,6 @@ function defineLazy(object, key, getter) {
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
function objectClone(obj) {
|
||||
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
||||
}
|
||||
function assignProp(target, prop, value) {
|
||||
Object.defineProperty(target, prop, {
|
||||
value,
|
||||
@@ -153,17 +127,6 @@ function assignProp(target, prop, value) {
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
function mergeDefs(...defs) {
|
||||
const mergedDescriptors = {};
|
||||
for (const def of defs) {
|
||||
const descriptors = Object.getOwnPropertyDescriptors(def);
|
||||
Object.assign(mergedDescriptors, descriptors);
|
||||
}
|
||||
return Object.defineProperties({}, mergedDescriptors);
|
||||
}
|
||||
function cloneDef(schema) {
|
||||
return mergeDefs(schema._zod.def);
|
||||
}
|
||||
function getElementAtPath(obj, path) {
|
||||
if (!path)
|
||||
return obj;
|
||||
@@ -191,20 +154,13 @@ function randomString(length = 10) {
|
||||
function esc(str) {
|
||||
return JSON.stringify(str);
|
||||
}
|
||||
function slugify(input) {
|
||||
return input
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/[^\w\s-]/g, "")
|
||||
.replace(/[\s_-]+/g, "-")
|
||||
.replace(/^-+|-+$/g, "");
|
||||
}
|
||||
exports.captureStackTrace = ("captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => { });
|
||||
exports.captureStackTrace = Error.captureStackTrace
|
||||
? Error.captureStackTrace
|
||||
: (..._args) => { };
|
||||
function isObject(data) {
|
||||
return typeof data === "object" && data !== null && !Array.isArray(data);
|
||||
}
|
||||
exports.allowsEval = cached(() => {
|
||||
// @ts-ignore
|
||||
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
||||
return false;
|
||||
}
|
||||
@@ -224,8 +180,6 @@ function isPlainObject(o) {
|
||||
const ctor = o.constructor;
|
||||
if (ctor === undefined)
|
||||
return true;
|
||||
if (typeof ctor !== "function")
|
||||
return true;
|
||||
// modified prototype
|
||||
const prot = ctor.prototype;
|
||||
if (isObject(prot) === false)
|
||||
@@ -236,13 +190,6 @@ function isPlainObject(o) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function shallowClone(o) {
|
||||
if (isPlainObject(o))
|
||||
return { ...o };
|
||||
if (Array.isArray(o))
|
||||
return [...o];
|
||||
return o;
|
||||
}
|
||||
function numKeys(data) {
|
||||
let keyCount = 0;
|
||||
for (const key in data) {
|
||||
@@ -288,7 +235,6 @@ const getParsedType = (data) => {
|
||||
if (typeof Date !== "undefined" && data instanceof Date) {
|
||||
return "date";
|
||||
}
|
||||
// @ts-ignore
|
||||
if (typeof File !== "undefined" && data instanceof File) {
|
||||
return "file";
|
||||
}
|
||||
@@ -383,68 +329,44 @@ exports.BIGINT_FORMAT_RANGES = {
|
||||
uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")],
|
||||
};
|
||||
function pick(schema, mask) {
|
||||
const currDef = schema._zod.def;
|
||||
const def = mergeDefs(schema._zod.def, {
|
||||
get shape() {
|
||||
const newShape = {};
|
||||
for (const key in mask) {
|
||||
if (!(key in currDef.shape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
if (!mask[key])
|
||||
continue;
|
||||
newShape[key] = currDef.shape[key];
|
||||
}
|
||||
assignProp(this, "shape", newShape); // self-caching
|
||||
return newShape;
|
||||
},
|
||||
const newShape = {};
|
||||
const currDef = schema._zod.def; //.shape;
|
||||
for (const key in mask) {
|
||||
if (!(key in currDef.shape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
if (!mask[key])
|
||||
continue;
|
||||
// pick key
|
||||
newShape[key] = currDef.shape[key];
|
||||
}
|
||||
return clone(schema, {
|
||||
...schema._zod.def,
|
||||
shape: newShape,
|
||||
checks: [],
|
||||
});
|
||||
return clone(schema, def);
|
||||
}
|
||||
function omit(schema, mask) {
|
||||
const currDef = schema._zod.def;
|
||||
const def = mergeDefs(schema._zod.def, {
|
||||
get shape() {
|
||||
const newShape = { ...schema._zod.def.shape };
|
||||
for (const key in mask) {
|
||||
if (!(key in currDef.shape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
if (!mask[key])
|
||||
continue;
|
||||
delete newShape[key];
|
||||
}
|
||||
assignProp(this, "shape", newShape); // self-caching
|
||||
return newShape;
|
||||
},
|
||||
const newShape = { ...schema._zod.def.shape };
|
||||
const currDef = schema._zod.def; //.shape;
|
||||
for (const key in mask) {
|
||||
if (!(key in currDef.shape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
if (!mask[key])
|
||||
continue;
|
||||
delete newShape[key];
|
||||
}
|
||||
return clone(schema, {
|
||||
...schema._zod.def,
|
||||
shape: newShape,
|
||||
checks: [],
|
||||
});
|
||||
return clone(schema, def);
|
||||
}
|
||||
function extend(schema, shape) {
|
||||
if (!isPlainObject(shape)) {
|
||||
throw new Error("Invalid input to extend: expected a plain object");
|
||||
}
|
||||
const checks = schema._zod.def.checks;
|
||||
const hasChecks = checks && checks.length > 0;
|
||||
if (hasChecks) {
|
||||
throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
|
||||
}
|
||||
const def = mergeDefs(schema._zod.def, {
|
||||
get shape() {
|
||||
const _shape = { ...schema._zod.def.shape, ...shape };
|
||||
assignProp(this, "shape", _shape); // self-caching
|
||||
return _shape;
|
||||
},
|
||||
checks: [],
|
||||
});
|
||||
return clone(schema, def);
|
||||
}
|
||||
function safeExtend(schema, shape) {
|
||||
if (!isPlainObject(shape)) {
|
||||
throw new Error("Invalid input to safeExtend: expected a plain object");
|
||||
}
|
||||
const def = {
|
||||
...schema._zod.def,
|
||||
get shape() {
|
||||
@@ -452,106 +374,95 @@ function safeExtend(schema, shape) {
|
||||
assignProp(this, "shape", _shape); // self-caching
|
||||
return _shape;
|
||||
},
|
||||
checks: schema._zod.def.checks,
|
||||
checks: [], // delete existing checks
|
||||
};
|
||||
return clone(schema, def);
|
||||
}
|
||||
function merge(a, b) {
|
||||
const def = mergeDefs(a._zod.def, {
|
||||
return clone(a, {
|
||||
...a._zod.def,
|
||||
get shape() {
|
||||
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
||||
assignProp(this, "shape", _shape); // self-caching
|
||||
return _shape;
|
||||
},
|
||||
get catchall() {
|
||||
return b._zod.def.catchall;
|
||||
},
|
||||
catchall: b._zod.def.catchall,
|
||||
checks: [], // delete existing checks
|
||||
});
|
||||
return clone(a, def);
|
||||
}
|
||||
function partial(Class, schema, mask) {
|
||||
const def = mergeDefs(schema._zod.def, {
|
||||
get shape() {
|
||||
const oldShape = schema._zod.def.shape;
|
||||
const shape = { ...oldShape };
|
||||
if (mask) {
|
||||
for (const key in mask) {
|
||||
if (!(key in oldShape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
if (!mask[key])
|
||||
continue;
|
||||
// if (oldShape[key]!._zod.optin === "optional") continue;
|
||||
shape[key] = Class
|
||||
? new Class({
|
||||
type: "optional",
|
||||
innerType: oldShape[key],
|
||||
})
|
||||
: oldShape[key];
|
||||
}
|
||||
const oldShape = schema._zod.def.shape;
|
||||
const shape = { ...oldShape };
|
||||
if (mask) {
|
||||
for (const key in mask) {
|
||||
if (!(key in oldShape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
else {
|
||||
for (const key in oldShape) {
|
||||
// if (oldShape[key]!._zod.optin === "optional") continue;
|
||||
shape[key] = Class
|
||||
? new Class({
|
||||
type: "optional",
|
||||
innerType: oldShape[key],
|
||||
})
|
||||
: oldShape[key];
|
||||
}
|
||||
}
|
||||
assignProp(this, "shape", shape); // self-caching
|
||||
return shape;
|
||||
},
|
||||
if (!mask[key])
|
||||
continue;
|
||||
// if (oldShape[key]!._zod.optin === "optional") continue;
|
||||
shape[key] = Class
|
||||
? new Class({
|
||||
type: "optional",
|
||||
innerType: oldShape[key],
|
||||
})
|
||||
: oldShape[key];
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const key in oldShape) {
|
||||
// if (oldShape[key]!._zod.optin === "optional") continue;
|
||||
shape[key] = Class
|
||||
? new Class({
|
||||
type: "optional",
|
||||
innerType: oldShape[key],
|
||||
})
|
||||
: oldShape[key];
|
||||
}
|
||||
}
|
||||
return clone(schema, {
|
||||
...schema._zod.def,
|
||||
shape,
|
||||
checks: [],
|
||||
});
|
||||
return clone(schema, def);
|
||||
}
|
||||
function required(Class, schema, mask) {
|
||||
const def = mergeDefs(schema._zod.def, {
|
||||
get shape() {
|
||||
const oldShape = schema._zod.def.shape;
|
||||
const shape = { ...oldShape };
|
||||
if (mask) {
|
||||
for (const key in mask) {
|
||||
if (!(key in shape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
if (!mask[key])
|
||||
continue;
|
||||
// overwrite with non-optional
|
||||
shape[key] = new Class({
|
||||
type: "nonoptional",
|
||||
innerType: oldShape[key],
|
||||
});
|
||||
}
|
||||
const oldShape = schema._zod.def.shape;
|
||||
const shape = { ...oldShape };
|
||||
if (mask) {
|
||||
for (const key in mask) {
|
||||
if (!(key in shape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
else {
|
||||
for (const key in oldShape) {
|
||||
// overwrite with non-optional
|
||||
shape[key] = new Class({
|
||||
type: "nonoptional",
|
||||
innerType: oldShape[key],
|
||||
});
|
||||
}
|
||||
}
|
||||
assignProp(this, "shape", shape); // self-caching
|
||||
return shape;
|
||||
},
|
||||
if (!mask[key])
|
||||
continue;
|
||||
// overwrite with non-optional
|
||||
shape[key] = new Class({
|
||||
type: "nonoptional",
|
||||
innerType: oldShape[key],
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const key in oldShape) {
|
||||
// overwrite with non-optional
|
||||
shape[key] = new Class({
|
||||
type: "nonoptional",
|
||||
innerType: oldShape[key],
|
||||
});
|
||||
}
|
||||
}
|
||||
return clone(schema, {
|
||||
...schema._zod.def,
|
||||
shape,
|
||||
// optional: [],
|
||||
checks: [],
|
||||
});
|
||||
return clone(schema, def);
|
||||
}
|
||||
// invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom
|
||||
function aborted(x, startIndex = 0) {
|
||||
if (x.aborted === true)
|
||||
return true;
|
||||
for (let i = startIndex; i < x.issues.length; i++) {
|
||||
if (x.issues[i]?.continue !== true) {
|
||||
if (x.issues[i]?.continue !== true)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -590,7 +501,6 @@ function getSizableOrigin(input) {
|
||||
return "set";
|
||||
if (input instanceof Map)
|
||||
return "map";
|
||||
// @ts-ignore
|
||||
if (input instanceof File)
|
||||
return "file";
|
||||
return "unknown";
|
||||
@@ -622,46 +532,6 @@ function cleanEnum(obj) {
|
||||
})
|
||||
.map((el) => el[1]);
|
||||
}
|
||||
// Codec utility functions
|
||||
function base64ToUint8Array(base64) {
|
||||
const binaryString = atob(base64);
|
||||
const bytes = new Uint8Array(binaryString.length);
|
||||
for (let i = 0; i < binaryString.length; i++) {
|
||||
bytes[i] = binaryString.charCodeAt(i);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
function uint8ArrayToBase64(bytes) {
|
||||
let binaryString = "";
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
binaryString += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
return btoa(binaryString);
|
||||
}
|
||||
function base64urlToUint8Array(base64url) {
|
||||
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
|
||||
const padding = "=".repeat((4 - (base64.length % 4)) % 4);
|
||||
return base64ToUint8Array(base64 + padding);
|
||||
}
|
||||
function uint8ArrayToBase64url(bytes) {
|
||||
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
||||
}
|
||||
function hexToUint8Array(hex) {
|
||||
const cleanHex = hex.replace(/^0x/, "");
|
||||
if (cleanHex.length % 2 !== 0) {
|
||||
throw new Error("Invalid hex string length");
|
||||
}
|
||||
const bytes = new Uint8Array(cleanHex.length / 2);
|
||||
for (let i = 0; i < cleanHex.length; i += 2) {
|
||||
bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
function uint8ArrayToHex(bytes) {
|
||||
return Array.from(bytes)
|
||||
.map((b) => b.toString(16).padStart(2, "0"))
|
||||
.join("");
|
||||
}
|
||||
// instanceof
|
||||
class Class {
|
||||
constructor(..._args) { }
|
||||
|
||||
Reference in New Issue
Block a user