@yimingliao/cms 0.0.33 → 0.0.35

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.
@@ -185,6 +185,28 @@ var result = {
185
185
  error
186
186
  };
187
187
 
188
+ // src/shared/seo-metadata/standards.ts
189
+ var OG_TYPE_ARRAY = [
190
+ "article",
191
+ "book",
192
+ "music.song",
193
+ "music.album",
194
+ "music.playlist",
195
+ "music.radio_station",
196
+ "profile",
197
+ "website",
198
+ "video.tv_show",
199
+ "video.other",
200
+ "video.movie",
201
+ "video.episode"
202
+ ];
203
+ var TWITTER_CARD_ARRAY = [
204
+ "summary",
205
+ "summary_large_image",
206
+ "player",
207
+ "app"
208
+ ];
209
+
188
210
  // src/shared/units.ts
189
211
  var SIZE = {
190
212
  BYTE: 1,
@@ -194,15 +216,5 @@ var SIZE = {
194
216
  TB: 1024 ** 4,
195
217
  PB: 1024 ** 5
196
218
  };
197
- var TIME = {
198
- MILLISECOND: 1,
199
- SECOND: 1e3,
200
- MINUTE: 60 * 1e3,
201
- HOUR: 60 * 60 * 1e3,
202
- DAY: 24 * 60 * 60 * 1e3,
203
- WEEK: 7 * 24 * 60 * 60 * 1e3,
204
- MONTH: 30 * 24 * 60 * 60 * 1e3,
205
- YEAR: 365 * 24 * 60 * 60 * 1e3
206
- };
207
219
 
208
- export { FILE_TYPES, SIZE, TIME, classifyFileType, formatFileSize, getMediaInfo, mimeToExtension, result };
220
+ export { FILE_TYPES, OG_TYPE_ARRAY, SIZE, TWITTER_CARD_ARRAY, classifyFileType, formatFileSize, getMediaInfo, mimeToExtension, result };
@@ -1,4 +1,4 @@
1
- import { mimeToExtension } from './chunk-I2DBI3WJ.js';
1
+ import { mimeToExtension } from './chunk-JADZTYRH.js';
2
2
  import path from 'path/posix';
3
3
  import { ulid } from 'ulid';
4
4
 
package/dist/index.d.ts CHANGED
@@ -44,6 +44,11 @@ declare const result: {
44
44
  error: typeof error;
45
45
  };
46
46
 
47
+ declare const OG_TYPE_ARRAY: ("article" | "book" | "music.song" | "music.album" | "music.playlist" | "music.radio_station" | "profile" | "website" | "video.tv_show" | "video.other" | "video.movie" | "video.episode")[];
48
+ type OgType = (typeof OG_TYPE_ARRAY)[number];
49
+ declare const TWITTER_CARD_ARRAY: readonly ["summary", "summary_large_image", "player", "app"];
50
+ type TwitterCard = (typeof TWITTER_CARD_ARRAY)[number];
51
+
47
52
  declare const SIZE: {
48
53
  readonly BYTE: 1;
49
54
  readonly KB: 1024;
@@ -53,16 +58,5 @@ declare const SIZE: {
53
58
  readonly PB: number;
54
59
  };
55
60
  type SizeUnit = keyof typeof SIZE;
56
- declare const TIME: {
57
- readonly MILLISECOND: 1;
58
- readonly SECOND: 1000;
59
- readonly MINUTE: number;
60
- readonly HOUR: number;
61
- readonly DAY: number;
62
- readonly WEEK: number;
63
- readonly MONTH: number;
64
- readonly YEAR: number;
65
- };
66
- type TimeUnit = keyof typeof TIME;
67
61
 
68
- export { ErrorDetail, ErrorResult, type ErrorResultParams, FolderFull, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, SIZE, type SizeUnit, SuccessResult, type SuccessResultParams, TIME, type TimeUnit, classifyFileType, formatFileSize, getMediaInfo, mimeToExtension, result };
62
+ export { ErrorDetail, ErrorResult, type ErrorResultParams, FolderFull, OG_TYPE_ARRAY, type OgType, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, SIZE, type SizeUnit, SuccessResult, type SuccessResultParams, TWITTER_CARD_ARRAY, type TwitterCard, classifyFileType, formatFileSize, getMediaInfo, mimeToExtension, result };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export { ADMIN_ROLES, POST_TYPES, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME } from './chunk-ZCOYQ5BG.js';
2
- export { FILE_TYPES, SIZE, TIME, classifyFileType, formatFileSize, getMediaInfo, mimeToExtension, result } from './chunk-I2DBI3WJ.js';
2
+ export { FILE_TYPES, OG_TYPE_ARRAY, SIZE, TWITTER_CARD_ARRAY, classifyFileType, formatFileSize, getMediaInfo, mimeToExtension, result } from './chunk-JADZTYRH.js';
@@ -1,5 +1,5 @@
1
1
  import { ADMIN_ROLES, ROOT_FOLDER_ID } from '../chunk-ZCOYQ5BG.js';
2
- import { SIZE, result, mimeToExtension, classifyFileType } from '../chunk-I2DBI3WJ.js';
2
+ import { SIZE, result, mimeToExtension, classifyFileType } from '../chunk-JADZTYRH.js';
3
3
  import jwt from 'jsonwebtoken';
4
4
  import argon2 from 'argon2';
5
5
  import crypto, { timingSafeEqual } from 'crypto';
@@ -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
- Object.defineProperty(stringProto, "unique", {
402
- configurable: true,
403
- writable: false,
404
- value: function(options) {
405
- return this.refine(async (v) => unique(v, options), {
406
- params: { i18nKey: "validator.unique" }
407
- });
408
- }
409
- });
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
- Object.defineProperty(stringProto, "bcp47", {
420
- configurable: true,
421
- writable: false,
422
- value: function() {
423
- return this.refine((v) => bcp47(v), {
424
- params: { i18nKey: "validator.bcp47" }
425
- });
426
- }
427
- });
428
- Object.defineProperty(stringProto, "ogLocale", {
429
- configurable: true,
430
- writable: false,
431
- value: function() {
432
- return this.refine((v) => ogLocale(v), {
433
- params: { i18nKey: "validator.og-locale" }
434
- });
435
- }
436
- });
437
- Object.defineProperty(emailProto, "unique", {
438
- configurable: true,
439
- writable: false,
440
- value: function(options) {
441
- return this.refine(async (v) => unique(v, options), {
442
- params: { i18nKey: "validator.unique" }
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
 
@@ -1,5 +1,5 @@
1
- import { createObjectKey } from '../../chunk-DWFOB4P3.js';
2
- import '../../chunk-I2DBI3WJ.js';
1
+ import { createObjectKey } from '../../chunk-SUETTGXY.js';
2
+ import '../../chunk-JADZTYRH.js';
3
3
  import { PutObjectCommand, DeleteObjectCommand, CopyObjectCommand } from '@aws-sdk/client-s3';
4
4
 
5
5
  function createR2Service({
@@ -1,5 +1,5 @@
1
- import { createObjectKey } from '../../chunk-DWFOB4P3.js';
2
- import '../../chunk-I2DBI3WJ.js';
1
+ import { createObjectKey } from '../../chunk-SUETTGXY.js';
2
+ import '../../chunk-JADZTYRH.js';
3
3
  import path from 'path/posix';
4
4
  import { createPool } from 'generic-pool';
5
5
  import SFTPClient from 'ssh2-sftp-client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",