@yimingliao/cms 0.0.32 → 0.0.34
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/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +56 -49
- package/package.json +1 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -181,7 +181,7 @@ declare function createMultiFileSchema({ z, fileSchema, maxSizeInMb, }: {
|
|
|
181
181
|
}): ({ size, extensions, }?: {
|
|
182
182
|
size?: number;
|
|
183
183
|
extensions?: string[];
|
|
184
|
-
}) =>
|
|
184
|
+
}) => zod.ZodArray<zod.ZodPipe<zod.ZodCustom<File, File>, zod.ZodTransform<BlobFile, File>>>;
|
|
185
185
|
|
|
186
186
|
declare function createTocItemSchema({ z, schemas, }: {
|
|
187
187
|
z: ReturnType<typeof createZod>;
|
package/dist/server/index.js
CHANGED
|
@@ -389,60 +389,67 @@ function ogLocale(locale) {
|
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
// src/server/infrastructure/zod/create-zod.ts
|
|
392
|
-
var patched = false;
|
|
393
392
|
function createZod({
|
|
394
393
|
unique,
|
|
395
394
|
exist
|
|
396
395
|
}) {
|
|
397
|
-
if (patched) return z;
|
|
398
|
-
patched = true;
|
|
399
396
|
const stringProto = z.ZodString.prototype;
|
|
400
397
|
const emailProto = z.ZodEmail.prototype;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
398
|
+
if (!stringProto.unique) {
|
|
399
|
+
Object.defineProperty(stringProto, "unique", {
|
|
400
|
+
configurable: true,
|
|
401
|
+
writable: false,
|
|
402
|
+
value: function(options) {
|
|
403
|
+
return this.refine(async (v) => unique(v, options), {
|
|
404
|
+
params: { i18nKey: "validator.unique" }
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
if (!stringProto.exist) {
|
|
410
|
+
Object.defineProperty(stringProto, "exist", {
|
|
411
|
+
configurable: true,
|
|
412
|
+
writable: false,
|
|
413
|
+
value: function(options) {
|
|
414
|
+
return this.refine(async (v) => exist(v, options), {
|
|
415
|
+
params: { i18nKey: "validator.exist" }
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
if (!stringProto.bcp47) {
|
|
421
|
+
Object.defineProperty(stringProto, "bcp47", {
|
|
422
|
+
configurable: true,
|
|
423
|
+
writable: false,
|
|
424
|
+
value: function() {
|
|
425
|
+
return this.refine((v) => bcp47(v), {
|
|
426
|
+
params: { i18nKey: "validator.bcp47" }
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
if (!stringProto.ogLocale) {
|
|
432
|
+
Object.defineProperty(stringProto, "ogLocale", {
|
|
433
|
+
configurable: true,
|
|
434
|
+
writable: false,
|
|
435
|
+
value: function() {
|
|
436
|
+
return this.refine((v) => ogLocale(v), {
|
|
437
|
+
params: { i18nKey: "validator.og-locale" }
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
if (!emailProto.unique) {
|
|
443
|
+
Object.defineProperty(emailProto, "unique", {
|
|
444
|
+
configurable: true,
|
|
445
|
+
writable: false,
|
|
446
|
+
value: function(options) {
|
|
447
|
+
return this.refine(async (v) => unique(v, options), {
|
|
448
|
+
params: { i18nKey: "validator.unique" }
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
446
453
|
return z;
|
|
447
454
|
}
|
|
448
455
|
|
|
@@ -578,7 +585,7 @@ function createMultiFileSchema({
|
|
|
578
585
|
size = maxSizeInMb * SIZE.MB,
|
|
579
586
|
extensions = []
|
|
580
587
|
} = {}) {
|
|
581
|
-
z2.array(fileSchema({ size, extensions }));
|
|
588
|
+
return z2.array(fileSchema({ size, extensions }));
|
|
582
589
|
};
|
|
583
590
|
}
|
|
584
591
|
|