@yimingliao/cms 0.0.167 → 0.0.169

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.
Files changed (17) hide show
  1. package/dist/src/server/infrastructure/zod/schemas/schemas.js +0 -8
  2. package/dist/src/server/interfaces/actions/resources/admin/commands/create/admin-create-validator.js +1 -1
  3. package/dist/src/server/interfaces/actions/resources/admin/commands/update/admin-update-validator.js +1 -1
  4. package/dist/src/server/interfaces/actions/resources/file/commands/create/file-create-validator.js +1 -1
  5. package/dist/src/server/interfaces/actions/resources/file/commands/create-many/file-create-many-validator.js +1 -1
  6. package/dist/src/server/interfaces/actions/resources/file/commands/update/file-update-validator.js +1 -1
  7. package/dist/src/server/interfaces/actions/resources/post/commands/create/post-create-validator.js +1 -1
  8. package/dist/src/server/interfaces/actions/resources/post/commands/update/post-update-validator.js +1 -1
  9. package/dist/src/server/interfaces/actions/resources/seo-metadata/commands/upsert/seo-metadata-upsert-validator.js +1 -1
  10. package/dist/src/server/interfaces/apis/file-upload/validator.js +1 -1
  11. package/dist/types/src/server/infrastructure/storage/sftp/sftp-pool.d.ts +2 -1
  12. package/dist/types/src/server/infrastructure/storage/sftp/sftp-pool.d.ts.map +1 -1
  13. package/dist/types/src/server/infrastructure/storage/sftp/types.d.ts +32 -0
  14. package/dist/types/src/server/infrastructure/storage/sftp/types.d.ts.map +1 -0
  15. package/dist/types/src/server/infrastructure/zod/schemas/schemas.d.ts +1 -3
  16. package/dist/types/src/server/infrastructure/zod/schemas/schemas.d.ts.map +1 -1
  17. package/package.json +1 -1
@@ -1,12 +1,10 @@
1
1
  function createSchemas({
2
2
  z,
3
- localeArray,
4
3
  exist
5
4
  }) {
6
5
  const trimmedString = () => z.string().trim();
7
6
  const MAX_NUMBER = 2147483647;
8
7
  const MAX_STRING = 1e5;
9
- const localeSet = new Set(localeArray);
10
8
  function text() {
11
9
  return trimmedString().max(MAX_STRING);
12
10
  }
@@ -55,11 +53,6 @@ function createSchemas({
55
53
  function pathSegment() {
56
54
  return trimmedString().min(1).regex(/^(?!\.\.?$)[^\u0000-\u001F/\\]+$/u).max(255);
57
55
  }
58
- function locale() {
59
- return trimmedString().refine((val) => localeSet.has(val), {
60
- error: "Invalid locale"
61
- });
62
- }
63
56
  function singleItem(options) {
64
57
  return z.object({
65
58
  id: id().refine((v) => exist(v, options), {
@@ -92,7 +85,6 @@ function createSchemas({
92
85
  sha256Hash,
93
86
  slug,
94
87
  pathSegment,
95
- locale,
96
88
  // item
97
89
  singleItem,
98
90
  multiItems
@@ -19,7 +19,7 @@ const adminCreateValidator = (schemas) => schemas.z.object({
19
19
  translations: schemas.array(
20
20
  schemas.z.object({
21
21
  // core
22
- locale: schemas.locale(),
22
+ locale: schemas.text(),
23
23
  // text
24
24
  name: schemas.text().nullable(),
25
25
  // better seo
@@ -22,7 +22,7 @@ const adminUpdateValidator = (schemas, id) => schemas.z.object({
22
22
  translations: schemas.array(
23
23
  schemas.z.object({
24
24
  // core
25
- locale: schemas.locale(),
25
+ locale: schemas.text(),
26
26
  // text
27
27
  name: schemas.text().nullable(),
28
28
  // better seo
@@ -26,7 +26,7 @@ const fileCreateValidator = (schemas) => schemas.z.object({
26
26
  translations: schemas.array(
27
27
  schemas.z.object({
28
28
  // core
29
- locale: schemas.locale(),
29
+ locale: schemas.text(),
30
30
  // text
31
31
  name: schemas.text().nullable(),
32
32
  alt: schemas.text().nullable()
@@ -20,7 +20,7 @@ const fileCreateManyValidator = (schemas) => schemas.z.object({
20
20
  translations: schemas.array(
21
21
  schemas.z.object({
22
22
  // core
23
- locale: schemas.locale(),
23
+ locale: schemas.text(),
24
24
  // text
25
25
  name: schemas.text().nullable(),
26
26
  alt: schemas.text().nullable()
@@ -24,7 +24,7 @@ const fileUpdateValidator = (schemas) => schemas.z.object({
24
24
  translations: schemas.array(
25
25
  schemas.z.object({
26
26
  // core
27
- locale: schemas.locale(),
27
+ locale: schemas.text(),
28
28
  // text
29
29
  name: schemas.text().nullable(),
30
30
  alt: schemas.text().nullable()
@@ -87,7 +87,7 @@ const postCreateValidator = ({
87
87
  // ----------------------------------------------------------------------------
88
88
  translations: schemas.array(
89
89
  schemas.z.object({
90
- locale: schemas.locale(),
90
+ locale: schemas.text(),
91
91
  // text
92
92
  title: schemas.text().nullable(),
93
93
  subtitle: schemas.text().nullable(),
@@ -89,7 +89,7 @@ const postUpdateValidator = ({
89
89
  // ----------------------------------------------------------------------------
90
90
  translations: schemas.array(
91
91
  schemas.z.object({
92
- locale: schemas.locale(),
92
+ locale: schemas.text(),
93
93
  // text
94
94
  title: schemas.text().nullable(),
95
95
  subtitle: schemas.text().nullable(),
@@ -13,7 +13,7 @@ const seoMetadataUpsertValidator = (schemas) => schemas.z.object({
13
13
  translations: schemas.array(
14
14
  schemas.z.object({
15
15
  // core
16
- locale: schemas.locale(),
16
+ locale: schemas.text(),
17
17
  // ---------------------------------------------------
18
18
  // Basic
19
19
  // ---------------------------------------------------
@@ -4,7 +4,7 @@ const fileUploadValidator = (schemas) => schemas.z.object({
4
4
  //====== Translations ======
5
5
  translations: schemas.array(
6
6
  schemas.z.object({
7
- locale: schemas.locale(),
7
+ locale: schemas.text(),
8
8
  name: schemas.text().nullable(),
9
9
  alt: schemas.text().nullable()
10
10
  })
@@ -1,3 +1,4 @@
1
+ import type { SftpClientLike } from "./types";
1
2
  import type { Pool } from "generic-pool";
2
3
  import type { Logger } from "logry";
3
4
  import SFTPClient from "ssh2-sftp-client";
@@ -5,6 +6,6 @@ interface CreateSftpPoolParams {
5
6
  sftpClientOptions: SFTPClient.ConnectOptions;
6
7
  logger: Logger;
7
8
  }
8
- export declare const createSftpPool: ({ sftpClientOptions, logger, }: CreateSftpPoolParams) => Pool<SFTPClient>;
9
+ export declare const createSftpPool: ({ sftpClientOptions, logger, }: CreateSftpPoolParams) => Pool<SftpClientLike>;
9
10
  export {};
10
11
  //# sourceMappingURL=sftp-pool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sftp-pool.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/storage/sftp/sftp-pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,UAAU,oBAAoB;IAC5B,iBAAiB,EAAE,UAAU,CAAC,cAAc,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,cAAc,GAAI,gCAG5B,oBAAoB,KAAG,IAAI,CAAC,UAAU,CAgDxC,CAAC"}
1
+ {"version":3,"file":"sftp-pool.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/storage/sftp/sftp-pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,UAAU,oBAAoB;IAC5B,iBAAiB,EAAE,UAAU,CAAC,cAAc,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,cAAc,GAAI,gCAG5B,oBAAoB,KAAG,IAAI,CAAC,cAAc,CAgD5C,CAAC"}
@@ -0,0 +1,32 @@
1
+ export interface SftpClientLike {
2
+ connect(options: ConnectConfig): Promise<unknown>;
3
+ realPath(remotePath: string): Promise<string>;
4
+ end(): Promise<boolean>;
5
+ put(input: Buffer<ArrayBufferLike>, remoteFilePath: string): Promise<string>;
6
+ delete(remoteFilePath: string): Promise<string>;
7
+ rename(remoteSourcePath: string, remoteDestPath: string): Promise<string>;
8
+ }
9
+ export interface ConnectConfig {
10
+ host?: string;
11
+ port?: number;
12
+ forceIPv4?: boolean;
13
+ forceIPv6?: boolean;
14
+ hostHash?: string;
15
+ username?: string;
16
+ password?: string;
17
+ privateKey?: Buffer | string;
18
+ passphrase?: Buffer | string;
19
+ localHostname?: string;
20
+ localUsername?: string;
21
+ tryKeyboard?: boolean;
22
+ keepaliveInterval?: number;
23
+ keepaliveCountMax?: number;
24
+ readyTimeout?: number;
25
+ strictVendor?: boolean;
26
+ agentForward?: boolean;
27
+ localAddress?: string;
28
+ localPort?: number;
29
+ timeout?: number;
30
+ ident?: Buffer | string;
31
+ }
32
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/storage/sftp/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACxB,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7E,MAAM,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3E;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB"}
@@ -2,9 +2,8 @@ import type { createZod } from "../create-zod";
2
2
  import type { createExist, ExistOptions } from "../rules/exist";
3
3
  import type zod from "zod";
4
4
  import type { ZodType } from "zod";
5
- export declare function createSchemas({ z, localeArray, exist, }: {
5
+ export declare function createSchemas({ z, exist, }: {
6
6
  z: ReturnType<typeof createZod>;
7
- localeArray: string[];
8
7
  exist: ReturnType<typeof createExist>;
9
8
  }): {
10
9
  z: typeof zod;
@@ -20,7 +19,6 @@ export declare function createSchemas({ z, localeArray, exist, }: {
20
19
  sha256Hash: () => zod.ZodString;
21
20
  slug: () => zod.ZodString;
22
21
  pathSegment: () => zod.ZodString;
23
- locale: () => zod.ZodString;
24
22
  singleItem: (options: ExistOptions) => zod.ZodNullable<zod.ZodObject<{
25
23
  id: zod.ZodString;
26
24
  }, zod.core.$strip>>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/zod/schemas/schemas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,wBAAgB,aAAa,CAAC,EAC5B,CAAC,EACD,WAAW,EACX,KAAK,GACN,EAAE;IACD,CAAC,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;IAChC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;CACvC;;;;;;;;YA2CgB,CAAC,SAAS,OAAO,UAAU,CAAC;;;;;;;0BAyDd,YAAY;;;0BAUZ,YAAY;;;;;;;EA+B1C"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/zod/schemas/schemas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,wBAAgB,aAAa,CAAC,EAC5B,CAAC,EACD,KAAK,GACN,EAAE;IACD,CAAC,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;IAChC,KAAK,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;CACvC;;;;;;;;YA0CgB,CAAC,SAAS,OAAO,UAAU,CAAC;;;;;;0BAkDd,YAAY;;;0BAUZ,YAAY;;;;;;;EA8B1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.167",
3
+ "version": "0.0.169",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",