aws-service-stack 0.18.366 → 0.18.371

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 (64) hide show
  1. package/README.md +149 -0
  2. package/dist/_examples/controller/property/property-crud.d.ts +4 -0
  3. package/dist/_examples/controller/property/property-crud.js +58 -0
  4. package/dist/_examples/controller/property/property-crud.js.map +1 -0
  5. package/dist/_examples/controller/property/property.config.d.ts +10 -0
  6. package/dist/_examples/controller/property/property.config.js +55 -0
  7. package/dist/_examples/controller/property/property.config.js.map +1 -0
  8. package/dist/_examples/controller/property/property.controller.d.ts +14 -0
  9. package/dist/_examples/controller/property/property.controller.js +72 -0
  10. package/dist/_examples/controller/property/property.controller.js.map +1 -0
  11. package/dist/_examples/controller/property/property.permissions.d.ts +2 -0
  12. package/dist/_examples/controller/property/property.permissions.js +19 -0
  13. package/dist/_examples/controller/property/property.permissions.js.map +1 -0
  14. package/dist/controller/controller-api.d.ts +8 -0
  15. package/dist/controller/controller-api.js +39 -1
  16. package/dist/controller/controller-api.js.map +1 -1
  17. package/dist/controller/controller-role.d.ts +56 -0
  18. package/dist/controller/controller-role.js +140 -0
  19. package/dist/controller/controller-role.js.map +1 -0
  20. package/dist/controller/index.d.ts +1 -0
  21. package/dist/controller/index.js +1 -0
  22. package/dist/controller/index.js.map +1 -1
  23. package/dist/function/cognito/cognito.function.d.ts +5 -0
  24. package/dist/function/cognito/cognito.function.js +22 -0
  25. package/dist/function/cognito/cognito.function.js.map +1 -1
  26. package/dist/function/cognito/index.d.ts +3 -1
  27. package/dist/function/cognito/index.js +2 -0
  28. package/dist/function/cognito/index.js.map +1 -1
  29. package/dist/function/index.d.ts +2 -0
  30. package/dist/model/base.config.d.ts +12 -1
  31. package/dist/model/base.config.js +20 -0
  32. package/dist/model/base.config.js.map +1 -1
  33. package/dist/model/base.model.d.ts +19 -0
  34. package/dist/model/base.model.js +14 -1
  35. package/dist/model/base.model.js.map +1 -1
  36. package/dist/model/index.d.ts +1 -0
  37. package/dist/model/index.js.map +1 -1
  38. package/dist/model/role.model.d.ts +20 -0
  39. package/dist/model/role.model.js +12 -0
  40. package/dist/model/role.model.js.map +1 -0
  41. package/dist/model/validation.model.d.ts +1 -1
  42. package/dist/model/validation.model.js.map +1 -1
  43. package/dist/service/index.d.ts +3 -0
  44. package/dist/service/index.js +3 -0
  45. package/dist/service/index.js.map +1 -1
  46. package/dist/service/permission.cache.d.ts +24 -0
  47. package/dist/service/permission.cache.js +61 -0
  48. package/dist/service/permission.cache.js.map +1 -0
  49. package/dist/service/permission.repo.d.ts +16 -0
  50. package/dist/service/permission.repo.js +63 -0
  51. package/dist/service/permission.repo.js.map +1 -0
  52. package/dist/service/permission.service.d.ts +39 -0
  53. package/dist/service/permission.service.js +151 -0
  54. package/dist/service/permission.service.js.map +1 -0
  55. package/dist/utils/date.util.d.ts +0 -13
  56. package/dist/utils/date.util.js +0 -35
  57. package/dist/utils/date.util.js.map +1 -1
  58. package/dist/utils/index.d.ts +0 -1
  59. package/dist/utils/index.js +0 -1
  60. package/dist/utils/index.js.map +1 -1
  61. package/package.json +32 -32
  62. package/dist/utils/data.util.d.ts +0 -20
  63. package/dist/utils/data.util.js +0 -73
  64. package/dist/utils/data.util.js.map +0 -1
@@ -3,16 +3,3 @@ export declare function isValidDate(dateStr: string): boolean;
3
3
  export declare function isSameYearMonth(date1: string | Date | Dayjs, date2: string | Date | Dayjs): boolean;
4
4
  export declare function isCurrentMonth(date: string | Date | Dayjs): boolean;
5
5
  export declare function isFutureMonth(date: string): boolean;
6
- export declare function addSecondToDate(date: string | Date | Dayjs): Dayjs;
7
- /**
8
- * Returns the oldest date string from a list of date strings.
9
- * @param dateStrList List of date strings (ISO or other formats supported by dayjs).
10
- * @returns The oldest date string, or an empty string if the list is empty.
11
- */
12
- export declare function minDateStr(dateStrList: any[]): string;
13
- /**
14
- * Returns the newest date string from a list of date strings.
15
- * @param dateStrList List of date strings (ISO or other formats supported by dayjs).
16
- * @returns The newest date string, or an empty string if the list is empty.
17
- */
18
- export declare function maxDateStr(dateStrList: any[]): string;
@@ -7,9 +7,6 @@ exports.isValidDate = isValidDate;
7
7
  exports.isSameYearMonth = isSameYearMonth;
8
8
  exports.isCurrentMonth = isCurrentMonth;
9
9
  exports.isFutureMonth = isFutureMonth;
10
- exports.addSecondToDate = addSecondToDate;
11
- exports.minDateStr = minDateStr;
12
- exports.maxDateStr = maxDateStr;
13
10
  const dayjs_1 = __importDefault(require("dayjs"));
14
11
  function isValidDate(dateStr) {
15
12
  const d = new Date(dateStr);
@@ -34,36 +31,4 @@ function isFutureMonth(date) {
34
31
  // Compare year-month
35
32
  return inputYear > currentYear || (inputYear === currentYear && inputMonth > currentMonth);
36
33
  }
37
- function addSecondToDate(date) {
38
- return (0, dayjs_1.default)(date).add(1, "second");
39
- }
40
- /**
41
- * Returns the oldest date string from a list of date strings.
42
- * @param dateStrList List of date strings (ISO or other formats supported by dayjs).
43
- * @returns The oldest date string, or an empty string if the list is empty.
44
- */
45
- function minDateStr(dateStrList) {
46
- return minMaxDateStr(dateStrList, false);
47
- }
48
- /**
49
- * Returns the newest date string from a list of date strings.
50
- * @param dateStrList List of date strings (ISO or other formats supported by dayjs).
51
- * @returns The newest date string, or an empty string if the list is empty.
52
- */
53
- function maxDateStr(dateStrList) {
54
- return minMaxDateStr(dateStrList, true);
55
- }
56
- function minMaxDateStr(dateStrList, isMax) {
57
- if (!dateStrList || dateStrList.length === 0)
58
- return "";
59
- const filtered = dateStrList.filter((d) => !!d);
60
- if (filtered.length === 0)
61
- return "";
62
- return filtered.reduce((newestDate, current) => {
63
- if (isMax)
64
- return (0, dayjs_1.default)(current).isAfter((0, dayjs_1.default)(newestDate)) ? current : newestDate;
65
- else
66
- return (0, dayjs_1.default)(current).isBefore((0, dayjs_1.default)(newestDate)) ? newestDate : current;
67
- });
68
- }
69
34
  //# sourceMappingURL=date.util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.util.js","sourceRoot":"","sources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C;AAC7F,CAAC;AAED,SAAgB,eAAe,CAAC,IAA2B;IACzD,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC;AACD;;;;GAIG;AACH,SAAgB,UAAU,CAAC,WAAkB;IAC3C,OAAO,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,WAAkB;IAC3C,OAAO,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,WAAkB,EAAE,KAAc;IACvD,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAExD,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE;QAC7C,IAAI,KAAK;YAAE,OAAO,IAAA,eAAK,EAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAA,eAAK,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;;YAC9E,OAAO,IAAA,eAAK,EAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAA,eAAK,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import dayjs, { Dayjs } from \"dayjs\";\n\nexport function isValidDate(dateStr: string): boolean {\n const d = new Date(dateStr);\n return !Number.isNaN(d.getTime());\n}\n\nexport function isSameYearMonth(date1: string | Date | Dayjs, date2: string | Date | Dayjs): boolean {\n const d1 = dayjs(date1);\n const d2 = dayjs(date2);\n return d1.isSame(d2, \"month\") && d1.isSame(d2, \"year\");\n}\n\nexport function isCurrentMonth(date: string | Date | Dayjs): boolean {\n return isSameYearMonth(date, new Date());\n}\n\nexport function isFutureMonth(date: string): boolean {\n const inputDate = new Date(date);\n const today = new Date();\n\n // Extract year and month\n const inputYear = inputDate.getFullYear();\n const inputMonth = inputDate.getMonth(); // 0-based (0 = Jan)\n const currentYear = today.getFullYear();\n const currentMonth = today.getMonth();\n\n // Compare year-month\n return inputYear > currentYear || (inputYear === currentYear && inputMonth > currentMonth);\n}\n\nexport function addSecondToDate(date: string | Date | Dayjs): Dayjs {\n return dayjs(date).add(1, \"second\");\n}\n/**\n * Returns the oldest date string from a list of date strings.\n * @param dateStrList List of date strings (ISO or other formats supported by dayjs).\n * @returns The oldest date string, or an empty string if the list is empty.\n */\nexport function minDateStr(dateStrList: any[]): string {\n return minMaxDateStr(dateStrList, false);\n}\n\n/**\n * Returns the newest date string from a list of date strings.\n * @param dateStrList List of date strings (ISO or other formats supported by dayjs).\n * @returns The newest date string, or an empty string if the list is empty.\n */\nexport function maxDateStr(dateStrList: any[]): string {\n return minMaxDateStr(dateStrList, true);\n}\n\nfunction minMaxDateStr(dateStrList: any[], isMax: boolean): string {\n if (!dateStrList || dateStrList.length === 0) return \"\";\n\n const filtered = dateStrList.filter((d) => !!d);\n if (filtered.length === 0) return \"\";\n\n return filtered.reduce((newestDate, current) => {\n if (isMax) return dayjs(current).isAfter(dayjs(newestDate)) ? current : newestDate;\n else return dayjs(current).isBefore(dayjs(newestDate)) ? newestDate : current;\n });\n}\n"]}
1
+ {"version":3,"file":"date.util.js","sourceRoot":"","sources":["../../src/utils/date.util.ts"],"names":[],"mappings":";;;;;AACA,kCAGC;AAED,0CAIC;AAED,wCAEC;AAED,sCAYC;AA5BD,kDAAqC;AACrC,SAAgB,WAAW,CAAC,OAAe;IACzC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,SAAgB,eAAe,CAAC,KAA4B,EAAE,KAA4B;IACxF,MAAM,EAAE,GAAG,IAAA,eAAK,EAAC,KAAK,CAAC,CAAC;IACxB,MAAM,EAAE,GAAG,IAAA,eAAK,EAAC,KAAK,CAAC,CAAC;IACxB,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC;AAED,SAAgB,cAAc,CAAC,IAA2B;IACxD,OAAO,eAAe,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,SAAgB,aAAa,CAAC,IAAY;IACxC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IAEzB,yBAAyB;IACzB,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IAC1C,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,oBAAoB;IAC7D,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IACxC,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAEtC,qBAAqB;IACrB,OAAO,SAAS,GAAG,WAAW,IAAI,CAAC,SAAS,KAAK,WAAW,IAAI,UAAU,GAAG,YAAY,CAAC,CAAC;AAC7F,CAAC","sourcesContent":["import dayjs, { Dayjs } from \"dayjs\";\nexport function isValidDate(dateStr: string): boolean {\n const d = new Date(dateStr);\n return !Number.isNaN(d.getTime());\n}\n\nexport function isSameYearMonth(date1: string | Date | Dayjs, date2: string | Date | Dayjs): boolean {\n const d1 = dayjs(date1);\n const d2 = dayjs(date2);\n return d1.isSame(d2, \"month\") && d1.isSame(d2, \"year\");\n}\n\nexport function isCurrentMonth(date: string | Date | Dayjs): boolean {\n return isSameYearMonth(date, new Date());\n}\n\nexport function isFutureMonth(date: string): boolean {\n const inputDate = new Date(date);\n const today = new Date();\n\n // Extract year and month\n const inputYear = inputDate.getFullYear();\n const inputMonth = inputDate.getMonth(); // 0-based (0 = Jan)\n const currentYear = today.getFullYear();\n const currentMonth = today.getMonth();\n\n // Compare year-month\n return inputYear > currentYear || (inputYear === currentYear && inputMonth > currentMonth);\n}\n"]}
@@ -12,5 +12,4 @@ export * from "./reflection.util";
12
12
  export * from "./validation.util";
13
13
  export * from "./opensearch/opensearch.parser";
14
14
  export * from "./opensearch/opensearch.transform";
15
- export * from "./data.util";
16
15
  export * from "../function/logger";
@@ -28,6 +28,5 @@ __exportStar(require("./reflection.util"), exports);
28
28
  __exportStar(require("./validation.util"), exports);
29
29
  __exportStar(require("./opensearch/opensearch.parser"), exports);
30
30
  __exportStar(require("./opensearch/opensearch.transform"), exports);
31
- __exportStar(require("./data.util"), exports);
32
31
  __exportStar(require("../function/logger"), exports);
33
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,sDAAoC;AACpC,+CAA6B;AAC7B,8CAA4B;AAC5B,8CAA4B;AAC5B,mDAAiC;AACjC,6CAA2B;AAC3B,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC;AACnC,oDAAkC;AAClC,oDAAkC;AAClC,iEAA+C;AAC/C,oEAAkD;AAClD,8CAA4B;AAE5B,qDAAmC","sourcesContent":["export * from \"./http/http.util\";\nexport * from \"./http/http-request\";\nexport * from \"./array.util\";\nexport * from \"./auth.util\";\nexport * from \"./date.util\";\nexport * from \"./dynamodb.utils\";\nexport * from \"./env.util\";\nexport * from \"./error.util\";\nexport * from \"./json.util\";\nexport * from \"./opensearch.utils\";\nexport * from \"./reflection.util\";\nexport * from \"./validation.util\";\nexport * from \"./opensearch/opensearch.parser\";\nexport * from \"./opensearch/opensearch.transform\";\nexport * from \"./data.util\";\n\nexport * from \"../function/logger\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,sDAAoC;AACpC,+CAA6B;AAC7B,8CAA4B;AAC5B,8CAA4B;AAC5B,mDAAiC;AACjC,6CAA2B;AAC3B,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC;AACnC,oDAAkC;AAClC,oDAAkC;AAClC,iEAA+C;AAC/C,oEAAkD;AAElD,qDAAmC","sourcesContent":["export * from \"./http/http.util\";\nexport * from \"./http/http-request\";\nexport * from \"./array.util\";\nexport * from \"./auth.util\";\nexport * from \"./date.util\";\nexport * from \"./dynamodb.utils\";\nexport * from \"./env.util\";\nexport * from \"./error.util\";\nexport * from \"./json.util\";\nexport * from \"./opensearch.utils\";\nexport * from \"./reflection.util\";\nexport * from \"./validation.util\";\nexport * from \"./opensearch/opensearch.parser\";\nexport * from \"./opensearch/opensearch.transform\";\n\nexport * from \"../function/logger\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-service-stack",
3
- "version": "0.18.366",
3
+ "version": "0.18.371",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "chinggis.systems",
@@ -23,45 +23,45 @@
23
23
  "tslib": "^2.8.1"
24
24
  },
25
25
  "peerDependencies": {
26
- "@aws-sdk/client-api-gateway": "^3.999.0",
27
- "@aws-sdk/client-apigatewaymanagementapi": "^3.999.0",
28
- "@aws-sdk/client-cognito-identity-provider": "^3.999.0",
29
- "@aws-sdk/client-dynamodb": "^3.999.0",
30
- "@aws-sdk/client-lambda": "^3.999.0",
31
- "@aws-sdk/client-pinpoint": "^3.999.0",
32
- "@aws-sdk/client-secrets-manager": "^3.999.0",
33
- "@aws-sdk/client-sqs": "^3.999.0",
34
- "@aws-sdk/credential-provider-node": "^3.972.14",
35
- "@aws-sdk/lib-dynamodb": "^3.999.0",
36
- "@aws-sdk/s3-request-presigner": "^3.999.0",
37
- "@aws-sdk/util-dynamodb": "^3.996.1",
26
+ "@aws-sdk/client-api-gateway": "^3.907.0",
27
+ "@aws-sdk/client-apigatewaymanagementapi": "^3.907.0",
28
+ "@aws-sdk/client-cognito-identity-provider": "^3.907.0",
29
+ "@aws-sdk/client-dynamodb": "^3.907.0",
30
+ "@aws-sdk/client-lambda": "^3.907.0",
31
+ "@aws-sdk/client-pinpoint": "^3.907.0",
32
+ "@aws-sdk/client-secrets-manager": "^3.907.0",
33
+ "@aws-sdk/client-sqs": "^3.907.0",
34
+ "@aws-sdk/credential-provider-node": "^3.907.0",
35
+ "@aws-sdk/lib-dynamodb": "^3.907.0",
36
+ "@aws-sdk/s3-request-presigner": "^3.907.0",
37
+ "@aws-sdk/util-dynamodb": "^3.907.0",
38
38
  "@opensearch-project/opensearch": "^3.5.1",
39
- "axios": "^1.13.5",
40
- "dayjs": "^1.11.19",
41
- "elastic-builder": "^4.1.0",
39
+ "axios": "^1.12.2",
40
+ "dayjs": "^1.11.10",
41
+ "elastic-builder": "^3.4.0",
42
42
  "lodash.truncate": "^4.4.2",
43
- "nodemailer": "^8.0.1",
43
+ "nodemailer": "^6.9.11",
44
44
  "numeral": "^2.0.6",
45
- "typedi": "^0.10.0",
45
+ "typedi": "0.10.0",
46
46
  "yup": "^1.7.1",
47
- "zod": "^4.3.6"
47
+ "zod": "^4.1.12"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/aws-lambda": "^8.10.161",
51
- "@types/jest": "^30.0.0",
52
- "eslint": "^10.0.2",
53
- "@typescript-eslint/eslint-plugin": "^8.56.1",
54
- "@typescript-eslint/parser": "^8.56.1",
55
- "jest": "^30.2.0",
50
+ "@types/aws-lambda": "^8.10.149",
51
+ "@types/jest": "^29.5.14",
52
+ "eslint": "^8.56.0",
53
+ "@typescript-eslint/eslint-plugin": "^6.19.1",
54
+ "@typescript-eslint/parser": "^6.19.1",
55
+ "jest": "^29.7.0",
56
56
  "jest-transform-stub": "^2.0.0",
57
- "jsonc-eslint-parser": "^3.1.0",
58
- "serverless-offline": "^14.5.0",
57
+ "jsonc-eslint-parser": "^2.4.0",
58
+ "serverless-offline": "^14.4.0",
59
59
  "serverless-stage-manager": "^1.0.5",
60
- "ts-jest": "^29.4.6",
60
+ "ts-jest": "^29.3.1",
61
61
  "ts-node": "^10.9.2",
62
- "tsc-alias": "^1.8.16",
63
- "typescript": "^5.9.3",
64
- "prettier": "^3.8.1",
65
- "typescript-transform-paths": "^3.5.6"
62
+ "tsc-alias": "^1.8.11",
63
+ "typescript": "^5.8.3",
64
+ "prettier": "^3.6.2",
65
+ "typescript-transform-paths": "^3.5.3"
66
66
  }
67
67
  }
@@ -1,20 +0,0 @@
1
- import { z, ZodType } from "zod";
2
- type InvalidConfig = boolean | string[];
3
- /**
4
- * EntityBuilder generates mock objects from a Zod schema.
5
- * - Can produce fully valid objects
6
- * - Can produce random invalid objects (at least one field invalid)
7
- * - Can produce targeted invalid objects (specific fields)
8
- * - Arrays are autofilled with multiple elements if `arrayLength` > 1
9
- */
10
- export declare class EntityBuilder<T extends ZodType<any, any, any>> {
11
- private readonly schema;
12
- private readonly invalid;
13
- private readonly arrayLength;
14
- private seed;
15
- constructor(schema: T, invalid?: InvalidConfig, arrayLength?: number);
16
- build(): z.infer<T>;
17
- private buildFromZod;
18
- private shouldInvalidate;
19
- }
20
- export {};
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityBuilder = void 0;
4
- const zod_1 = require("zod");
5
- /**
6
- * EntityBuilder generates mock objects from a Zod schema.
7
- * - Can produce fully valid objects
8
- * - Can produce random invalid objects (at least one field invalid)
9
- * - Can produce targeted invalid objects (specific fields)
10
- * - Arrays are autofilled with multiple elements if `arrayLength` > 1
11
- */
12
- class EntityBuilder {
13
- schema;
14
- invalid;
15
- arrayLength;
16
- seed = 1;
17
- constructor(schema, invalid = true, arrayLength = 1) {
18
- this.schema = schema;
19
- this.invalid = invalid;
20
- this.arrayLength = arrayLength;
21
- }
22
- build() {
23
- return this.buildFromZod(this.schema, this.invalid);
24
- }
25
- buildFromZod(schema, invalidConfig, path = []) {
26
- // Optional / Nullable unwrap
27
- if (schema instanceof zod_1.ZodOptional || schema instanceof zod_1.ZodNullable) {
28
- const inner = schema._def.innerType;
29
- return this.buildFromZod(inner, invalidConfig, path);
30
- }
31
- if (schema instanceof zod_1.ZodString) {
32
- return this.shouldInvalidate(path, invalidConfig) ? "INVALID" : `valid_${path.join("_")}`;
33
- }
34
- if (schema instanceof zod_1.ZodNumber) {
35
- return this.shouldInvalidate(path, invalidConfig) ? -1 : 1;
36
- }
37
- if (schema instanceof zod_1.ZodBoolean) {
38
- return !this.shouldInvalidate(path, invalidConfig);
39
- }
40
- if (schema instanceof zod_1.ZodArray) {
41
- const elementSchema = schema.element;
42
- const arr = [];
43
- for (let i = 0; i < this.arrayLength; i++) {
44
- arr.push(this.buildFromZod(elementSchema, invalidConfig, path.concat([String(i)])));
45
- }
46
- return arr;
47
- }
48
- if (schema instanceof zod_1.ZodObject) {
49
- const obj = {};
50
- const shape = schema.shape;
51
- for (const key in shape) {
52
- obj[key] = this.buildFromZod(shape[key], invalidConfig, path.concat([key]));
53
- }
54
- return obj;
55
- }
56
- // fallback for unsupported types
57
- return null;
58
- }
59
- shouldInvalidate(path, invalidConfig) {
60
- if (invalidConfig === false) {
61
- // random invalid
62
- const x = Math.sin(this.seed++) * 10000;
63
- return x - Math.floor(x) > 0.5;
64
- }
65
- if (Array.isArray(invalidConfig)) {
66
- // targeted invalid
67
- return invalidConfig.includes(path.join("."));
68
- }
69
- return false; // valid by default
70
- }
71
- }
72
- exports.EntityBuilder = EntityBuilder;
73
- //# sourceMappingURL=data.util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data.util.js","sourceRoot":"","sources":["../../src/utils/data.util.ts"],"names":[],"mappings":";;;AAAA,6BAAkH;AAIlH;;;;;;GAMG;AACH,MAAa,aAAa;IAIL;IACA;IACA;IALX,IAAI,GAAG,CAAC,CAAC;IAEjB,YACmB,MAAS,EACT,UAAyB,IAAI,EAC7B,cAAsB,CAAC;QAFvB,WAAM,GAAN,MAAM,CAAG;QACT,YAAO,GAAP,OAAO,CAAsB;QAC7B,gBAAW,GAAX,WAAW,CAAY;IACvC,CAAC;IAEJ,KAAK;QACH,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAe,CAAC;IACpE,CAAC;IAEO,YAAY,CAAC,MAA8B,EAAE,aAA4B,EAAE,OAAiB,EAAE;QACpG,6BAA6B;QAC7B,IAAI,MAAM,YAAY,iBAAW,IAAI,MAAM,YAAY,iBAAW,EAAE,CAAC;YACnE,MAAM,KAAK,GAAI,MAAc,CAAC,IAAI,CAAC,SAAmC,CAAC;YACvE,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;QACvD,CAAC;QAED,IAAI,MAAM,YAAY,eAAS,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5F,CAAC;QAED,IAAI,MAAM,YAAY,eAAS,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC;QAED,IAAI,MAAM,YAAY,gBAAU,EAAE,CAAC;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AC;QACjC,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;YACjC,mBAAmB;YACnB,OAAO,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,KAAK,CAAC,CAAC,mBAAmB;IACnC,CAAC;CACF;AAlED,sCAkEC","sourcesContent":["import { z, ZodArray, ZodBoolean, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodString, ZodType } from \"zod\";\n\ntype InvalidConfig = boolean | string[];\n\n/**\n * EntityBuilder generates mock objects from a Zod schema.\n * - Can produce fully valid objects\n * - Can produce random invalid objects (at least one field invalid)\n * - Can produce targeted invalid objects (specific fields)\n * - Arrays are autofilled with multiple elements if `arrayLength` > 1\n */\nexport class EntityBuilder<T extends ZodType<any, any, any>> {\n private seed = 1;\n\n constructor(\n private readonly schema: T,\n private readonly invalid: InvalidConfig = true,\n private readonly arrayLength: number = 1, // default number of elements in arrays\n ) {}\n\n build(): z.infer<T> {\n return this.buildFromZod(this.schema, this.invalid) as z.infer<T>;\n }\n\n private buildFromZod(schema: ZodType<any, any, any>, invalidConfig: InvalidConfig, path: string[] = []): any {\n // Optional / Nullable unwrap\n if (schema instanceof ZodOptional || schema instanceof ZodNullable) {\n const inner = (schema as any)._def.innerType as ZodType<any, any, any>;\n return this.buildFromZod(inner, invalidConfig, path);\n }\n\n if (schema instanceof ZodString) {\n return this.shouldInvalidate(path, invalidConfig) ? \"INVALID\" : `valid_${path.join(\"_\")}`;\n }\n\n if (schema instanceof ZodNumber) {\n return this.shouldInvalidate(path, invalidConfig) ? -1 : 1;\n }\n\n if (schema instanceof ZodBoolean) {\n return !this.shouldInvalidate(path, invalidConfig);\n }\n\n if (schema instanceof ZodArray) {\n const elementSchema = (schema as ZodArray<any>).element as ZodType<any, any, any>;\n const arr = [];\n for (let i = 0; i < this.arrayLength; i++) {\n arr.push(this.buildFromZod(elementSchema, invalidConfig, path.concat([String(i)])));\n }\n return arr;\n }\n\n if (schema instanceof ZodObject) {\n const obj: any = {};\n const shape = (schema as ZodObject<any>).shape;\n for (const key in shape) {\n obj[key] = this.buildFromZod(shape[key], invalidConfig, path.concat([key]));\n }\n return obj;\n }\n\n // fallback for unsupported types\n return null;\n }\n\n private shouldInvalidate(path: string[], invalidConfig: InvalidConfig): boolean {\n if (invalidConfig === false) {\n // random invalid\n const x = Math.sin(this.seed++) * 10000;\n return x - Math.floor(x) > 0.5;\n }\n if (Array.isArray(invalidConfig)) {\n // targeted invalid\n return invalidConfig.includes(path.join(\".\"));\n }\n return false; // valid by default\n }\n}\n"]}