typia 3.5.0-dev.20230211 → 3.5.0-dev.20230212

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 (49) hide show
  1. package/README.md +7 -0
  2. package/lib/module.d.ts +178 -4
  3. package/lib/module.js +53 -2
  4. package/lib/module.js.map +1 -1
  5. package/lib/programmers/AssertPruneProgrammer.d.ts +5 -0
  6. package/lib/programmers/AssertPruneProgrammer.js +37 -0
  7. package/lib/programmers/AssertPruneProgrammer.js.map +1 -0
  8. package/lib/programmers/IsPruneProgrammer.d.ts +5 -0
  9. package/lib/programmers/IsPruneProgrammer.js +37 -0
  10. package/lib/programmers/IsPruneProgrammer.js.map +1 -0
  11. package/lib/programmers/PruneProgrammer.js +2 -2
  12. package/lib/programmers/PruneProgrammer.js.map +1 -1
  13. package/lib/programmers/ValidatePruneProgrammer.d.ts +5 -0
  14. package/lib/programmers/ValidatePruneProgrammer.js +37 -0
  15. package/lib/programmers/ValidatePruneProgrammer.js.map +1 -0
  16. package/lib/programmers/internal/feature_object_entries.d.ts +1 -1
  17. package/lib/transformers/CallExpressionTransformer.js +12 -0
  18. package/lib/transformers/CallExpressionTransformer.js.map +1 -1
  19. package/lib/transformers/features/miscellaneous/AssertPruneTransformer.d.ts +5 -0
  20. package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js +23 -0
  21. package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js.map +1 -0
  22. package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.d.ts +5 -0
  23. package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js +17 -0
  24. package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js.map +1 -0
  25. package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.d.ts +5 -0
  26. package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js +17 -0
  27. package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js.map +1 -0
  28. package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.d.ts +5 -0
  29. package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js +17 -0
  30. package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js.map +1 -0
  31. package/lib/transformers/features/miscellaneous/IsPruneTransformer.d.ts +5 -0
  32. package/lib/transformers/features/miscellaneous/IsPruneTransformer.js +23 -0
  33. package/lib/transformers/features/miscellaneous/IsPruneTransformer.js.map +1 -0
  34. package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.d.ts +5 -0
  35. package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js +23 -0
  36. package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js.map +1 -0
  37. package/package.json +1 -1
  38. package/src/module.ts +278 -5
  39. package/src/programmers/AssertPruneProgrammer.ts +59 -0
  40. package/src/programmers/IsPruneProgrammer.ts +63 -0
  41. package/src/programmers/PruneProgrammer.ts +5 -2
  42. package/src/programmers/ValidatePruneProgrammer.ts +73 -0
  43. package/src/transformers/CallExpressionTransformer.ts +12 -0
  44. package/src/transformers/features/miscellaneous/AssertPruneTransformer.ts +38 -0
  45. package/src/transformers/features/miscellaneous/CreateAssertPruneTransformer.ts +32 -0
  46. package/src/transformers/features/miscellaneous/CreateIsPruneTransformer.ts +32 -0
  47. package/src/transformers/features/miscellaneous/CreateValidatePruneTransformer.ts +32 -0
  48. package/src/transformers/features/miscellaneous/IsPruneTransformer.ts +38 -0
  49. package/src/transformers/features/miscellaneous/ValidatePruneTransformer.ts +38 -0
@@ -1 +1 @@
1
- {"version":3,"file":"CallExpressionTransformer.js","sourceRoot":"","sources":["../../src/transformers/CallExpressionTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAwB;AAIxB,0FAAyF;AACzF,0FAAyF;AACzF,oFAAmF;AACnF,8EAA6E;AAC7E,oFAAmF;AACnF,gGAA+F;AAC/F,wFAAuF;AACvF,oGAAmG;AACnG,4EAA2E;AAC3E,wFAAuF;AACvF,iGAAgG;AA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AC"}
1
+ {"version":3,"file":"CallExpressionTransformer.js","sourceRoot":"","sources":["../../src/transformers/CallExpressionTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAwB;AAIxB,0FAAyF;AACzF,0FAAyF;AACzF,sGAAqG;AACrG,8FAA6F;AAC7F,0FAAyF;AACzF,0GAAyG;AACzG,kFAAiF;AACjF,oFAAmF;AACnF,8EAA6E;AAC7E,8FAA6F;AAC7F,oFAAmF;AACnF,gGAA+F;AAC/F,wFAAuF;AACvF,oGAAmG;AACnG,4EAA2E;AAC3E,wFAAuF;AACvF,iGAAgG;AAChG,6GAA4G;AAC5G,qGAAoG;AACpG,iGAAgG;AAChG,+GAA+G;AAC/G,yFAAwF;AACxF,qFAAoF;AACpF,qGAAoG;AACpG,6EAA4E;AAC5E,yFAAwF;AACxF,iFAAgF;AAChF,6FAA4F;AAC5F,qEAAoE;AACpE,iFAAgF;AAEhF,IAAiB,yBAAyB,CA+BzC;AA/BD,WAAiB,yBAAyB;IACtC,SAAgB,SAAS,CACrB,OAAiB,EACjB,UAA6B;;QAM7B,IAAM,WAAW,GACb,MAAA,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC;QAClE,IAAI,CAAC,WAAW;YAAE,OAAO,UAAU,CAAC;QAGpC,IAAM,IAAI,GAAW,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC;QACxE,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,KAAK,QAAQ;YAClD,OAAO,UAAU,CAAC;QAMd,IAAA,IAAI,GAAK,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,MAAM,KAA1D,CAA2D;QAGvE,IAAM,OAAO,GAA6B,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,UAAU,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CAAC,EAAzC,CAAyC;IAGrE,aAAa,EAAE,cAAM,OAAA,mDAAwB,CAAC,SAAS,EAAlC,CAAkC;IACvD,iBAAiB,EAAE,cAAM,OAAA,2DAA4B,CAAC,SAAS,EAAtC,CAAsC;IAC/D,mBAAmB,EAAE,cAAM,OAAA,+DAA8B,CAAC,SAAS,EAAxC,CAAwC;IAGnE,eAAe,EAAE,cAAM,OAAA,uDAA0B,CAAC,SAAS,EAApC,CAAoC;IAC3D,qBAAqB,EAAE,cAAM,OAAA,mEAAgC,CAAC,SAAS,EAA1C,CAA0C;IACvE,iBAAiB,EAAE,cAAM,OAAA,2DAA4B,CAAC,SAAS,EAAtC,CAAsC;IAC/D,uBAAuB,EAAE,cAAM,OAAA,sEAAkC,CAAC,SAAS,EAA5C,CAA4C;IAG3E,WAAW,EAAE,cAAM,OAAA,+CAAsB,CAAC,SAAS,EAAhC,CAAgC;IACnD,iBAAiB,EAAE,cAAM,OAAA,2DAA4B,CAAC,SAAS,EAAtC,CAAsC;IAC/D,aAAa,EAAE,cAAM,OAAA,mDAAwB,CAAC,SAAS,EAAlC,CAAkC;IACvD,mBAAmB,EAAE,cAAM,OAAA,+DAA8B,CAAC,SAAS,EAAxC,CAAwC;CACtE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import ts from "typescript";
2
+ import { IProject } from "../../IProject";
3
+ export declare namespace AssertPruneTransformer {
4
+ function transform(project: IProject, modulo: ts.LeftHandSideExpression, expression: ts.CallExpression): ts.Expression;
5
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AssertPruneTransformer = void 0;
7
+ var typescript_1 = __importDefault(require("typescript"));
8
+ var AssertPruneProgrammer_1 = require("../../../programmers/AssertPruneProgrammer");
9
+ var AssertPruneTransformer;
10
+ (function (AssertPruneTransformer) {
11
+ function transform(project, modulo, expression) {
12
+ if (expression.arguments.length !== 1)
13
+ throw new Error("Error on typia.assertPrune(): no input value.");
14
+ var type = expression.typeArguments && expression.typeArguments[0]
15
+ ? project.checker.getTypeFromTypeNode(expression.typeArguments[0])
16
+ : project.checker.getTypeAtLocation(expression.arguments[0]);
17
+ if (type.isTypeParameter())
18
+ throw new Error("Error on typia.assertPrune(): non-specified generic argument.");
19
+ return typescript_1.default.factory.createCallExpression(AssertPruneProgrammer_1.AssertPruneProgrammer.generate(project, modulo)(type), undefined, [expression.arguments[0]]);
20
+ }
21
+ AssertPruneTransformer.transform = transform;
22
+ })(AssertPruneTransformer = exports.AssertPruneTransformer || (exports.AssertPruneTransformer = {}));
23
+ //# sourceMappingURL=AssertPruneTransformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssertPruneTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/miscellaneous/AssertPruneTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,oFAAmF;AAInF,IAAiB,sBAAsB,CA0BtC;AA1BD,WAAiB,sBAAsB;IACnC,SAAgB,SAAS,CACrB,OAAiB,EACjB,MAAiC,EACjC,UAA6B;QAE7B,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;YACjC,MAAM,IAAI,KAAK,iDAA8B,CAAC;QAGlD,IAAM,IAAI,GACN,UAAU,CAAC,aAAa,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;YACnD,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAC/B,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAC9B;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAE,CAAC,CAAC;QACtE,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,MAAM,IAAI,KAAK,iEAAgC,CAAC;QAGpD,OAAO,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAClC,6CAAqB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EACrD,SAAS,EACT,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAE,CAAC,CAC7B,CAAC;IACN,CAAC;IAxBe,gCAAS,YAwBxB,CAAA;AACL,CAAC,EA1BgB,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QA0BtC"}
@@ -0,0 +1,5 @@
1
+ import ts from "typescript";
2
+ import { IProject } from "../../IProject";
3
+ export declare namespace CreateAssertPruneTransformer {
4
+ function transform(project: IProject, modulo: ts.LeftHandSideExpression, expression: ts.CallExpression): ts.Expression;
5
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateAssertPruneTransformer = void 0;
4
+ var AssertPruneProgrammer_1 = require("../../../programmers/AssertPruneProgrammer");
5
+ var CreateAssertPruneTransformer;
6
+ (function (CreateAssertPruneTransformer) {
7
+ function transform(project, modulo, expression) {
8
+ if (!expression.typeArguments || !expression.typeArguments[0])
9
+ throw new Error("Error on typia.assertPrune(): generic argument is not specified.");
10
+ var type = project.checker.getTypeFromTypeNode(expression.typeArguments[0]);
11
+ if (type.isTypeParameter())
12
+ throw new Error("Error on typia.assertPrune(): non-specified generic argument.");
13
+ return AssertPruneProgrammer_1.AssertPruneProgrammer.generate(project, modulo)(type);
14
+ }
15
+ CreateAssertPruneTransformer.transform = transform;
16
+ })(CreateAssertPruneTransformer = exports.CreateAssertPruneTransformer || (exports.CreateAssertPruneTransformer = {}));
17
+ //# sourceMappingURL=CreateAssertPruneTransformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateAssertPruneTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/miscellaneous/CreateAssertPruneTransformer.ts"],"names":[],"mappings":";;;AAEA,oFAAmF;AAInF,IAAiB,4BAA4B,CAoB5C;AApBD,WAAiB,4BAA4B;IACzC,SAAgB,SAAS,CACrB,OAAiB,EACjB,MAAiC,EACjC,UAA6B;QAG7B,IAAI,CAAC,UAAU,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;YACzD,MAAM,IAAI,KAAK,oEAA6B,CAAC;QAGjD,IAAM,IAAI,GAAY,OAAO,CAAC,OAAO,CAAC,mBAAmB,CACrD,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAC9B,CAAC;QACF,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,MAAM,IAAI,KAAK,iEAAgC,CAAC;QAGpD,OAAO,6CAAqB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IAlBe,sCAAS,YAkBxB,CAAA;AACL,CAAC,EApBgB,4BAA4B,GAA5B,oCAA4B,KAA5B,oCAA4B,QAoB5C"}
@@ -0,0 +1,5 @@
1
+ import ts from "typescript";
2
+ import { IProject } from "../../IProject";
3
+ export declare namespace CreateIsPruneTransformer {
4
+ function transform(project: IProject, modulo: ts.LeftHandSideExpression, expression: ts.CallExpression): ts.Expression;
5
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateIsPruneTransformer = void 0;
4
+ var IsPruneProgrammer_1 = require("../../../programmers/IsPruneProgrammer");
5
+ var CreateIsPruneTransformer;
6
+ (function (CreateIsPruneTransformer) {
7
+ function transform(project, modulo, expression) {
8
+ if (!expression.typeArguments || !expression.typeArguments[0])
9
+ throw new Error("Error on typia.isPrune(): generic argument is not specified.");
10
+ var type = project.checker.getTypeFromTypeNode(expression.typeArguments[0]);
11
+ if (type.isTypeParameter())
12
+ throw new Error("Error on typia.isPrune(): non-specified generic argument.");
13
+ return IsPruneProgrammer_1.IsPruneProgrammer.generate(project, modulo)(type);
14
+ }
15
+ CreateIsPruneTransformer.transform = transform;
16
+ })(CreateIsPruneTransformer = exports.CreateIsPruneTransformer || (exports.CreateIsPruneTransformer = {}));
17
+ //# sourceMappingURL=CreateIsPruneTransformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateIsPruneTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/miscellaneous/CreateIsPruneTransformer.ts"],"names":[],"mappings":";;;AAEA,4EAA2E;AAI3E,IAAiB,wBAAwB,CAoBxC;AApBD,WAAiB,wBAAwB;IACrC,SAAgB,SAAS,CACrB,OAAiB,EACjB,MAAiC,EACjC,UAA6B;QAG7B,IAAI,CAAC,UAAU,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;YACzD,MAAM,IAAI,KAAK,gEAA6B,CAAC;QAGjD,IAAM,IAAI,GAAY,OAAO,CAAC,OAAO,CAAC,mBAAmB,CACrD,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAC9B,CAAC;QACF,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,MAAM,IAAI,KAAK,6DAAgC,CAAC;QAGpD,OAAO,qCAAiB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAlBe,kCAAS,YAkBxB,CAAA;AACL,CAAC,EApBgB,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAoBxC"}
@@ -0,0 +1,5 @@
1
+ import ts from "typescript";
2
+ import { IProject } from "../../IProject";
3
+ export declare namespace CreateValidatePruneTransformer {
4
+ function transform(project: IProject, modulo: ts.LeftHandSideExpression, expression: ts.CallExpression): ts.Expression;
5
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateValidatePruneTransformer = void 0;
4
+ var ValidatePruneProgrammer_1 = require("../../../programmers/ValidatePruneProgrammer");
5
+ var CreateValidatePruneTransformer;
6
+ (function (CreateValidatePruneTransformer) {
7
+ function transform(project, modulo, expression) {
8
+ if (!expression.typeArguments || !expression.typeArguments[0])
9
+ throw new Error("Error on typia.validatePrune(): generic argument is not specified.");
10
+ var type = project.checker.getTypeFromTypeNode(expression.typeArguments[0]);
11
+ if (type.isTypeParameter())
12
+ throw new Error("Error on typia.validatePrune(): non-specified generic argument.");
13
+ return ValidatePruneProgrammer_1.ValidatePruneProgrammer.generate(project, modulo)(type);
14
+ }
15
+ CreateValidatePruneTransformer.transform = transform;
16
+ })(CreateValidatePruneTransformer = exports.CreateValidatePruneTransformer || (exports.CreateValidatePruneTransformer = {}));
17
+ //# sourceMappingURL=CreateValidatePruneTransformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateValidatePruneTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/miscellaneous/CreateValidatePruneTransformer.ts"],"names":[],"mappings":";;;AAEA,wFAAuF;AAIvF,IAAiB,8BAA8B,CAoB9C;AApBD,WAAiB,8BAA8B;IAC3C,SAAgB,SAAS,CACrB,OAAiB,EACjB,MAAiC,EACjC,UAA6B;QAG7B,IAAI,CAAC,UAAU,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;YACzD,MAAM,IAAI,KAAK,sEAA6B,CAAC;QAGjD,IAAM,IAAI,GAAY,OAAO,CAAC,OAAO,CAAC,mBAAmB,CACrD,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAC9B,CAAC;QACF,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,MAAM,IAAI,KAAK,mEAAgC,CAAC;QAGpD,OAAO,iDAAuB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;IAlBe,wCAAS,YAkBxB,CAAA;AACL,CAAC,EApBgB,8BAA8B,GAA9B,sCAA8B,KAA9B,sCAA8B,QAoB9C"}
@@ -0,0 +1,5 @@
1
+ import ts from "typescript";
2
+ import { IProject } from "../../IProject";
3
+ export declare namespace IsPruneTransformer {
4
+ function transform(project: IProject, modulo: ts.LeftHandSideExpression, expression: ts.CallExpression): ts.Expression;
5
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.IsPruneTransformer = void 0;
7
+ var typescript_1 = __importDefault(require("typescript"));
8
+ var IsPruneProgrammer_1 = require("../../../programmers/IsPruneProgrammer");
9
+ var IsPruneTransformer;
10
+ (function (IsPruneTransformer) {
11
+ function transform(project, modulo, expression) {
12
+ if (expression.arguments.length !== 1)
13
+ throw new Error("Error on typia.isPrune(): no input value.");
14
+ var type = expression.typeArguments && expression.typeArguments[0]
15
+ ? project.checker.getTypeFromTypeNode(expression.typeArguments[0])
16
+ : project.checker.getTypeAtLocation(expression.arguments[0]);
17
+ if (type.isTypeParameter())
18
+ throw new Error("Error on typia.isPrune(): non-specified generic argument.");
19
+ return typescript_1.default.factory.createCallExpression(IsPruneProgrammer_1.IsPruneProgrammer.generate(project, modulo)(type), undefined, [expression.arguments[0]]);
20
+ }
21
+ IsPruneTransformer.transform = transform;
22
+ })(IsPruneTransformer = exports.IsPruneTransformer || (exports.IsPruneTransformer = {}));
23
+ //# sourceMappingURL=IsPruneTransformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IsPruneTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/miscellaneous/IsPruneTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,4EAA2E;AAI3E,IAAiB,kBAAkB,CA0BlC;AA1BD,WAAiB,kBAAkB;IAC/B,SAAgB,SAAS,CACrB,OAAiB,EACjB,MAAiC,EACjC,UAA6B;QAE7B,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;YACjC,MAAM,IAAI,KAAK,6CAA8B,CAAC;QAGlD,IAAM,IAAI,GACN,UAAU,CAAC,aAAa,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;YACnD,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAC/B,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAC9B;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAE,CAAC,CAAC;QACtE,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,MAAM,IAAI,KAAK,6DAAgC,CAAC;QAGpD,OAAO,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAClC,qCAAiB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EACjD,SAAS,EACT,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAE,CAAC,CAC7B,CAAC;IACN,CAAC;IAxBe,4BAAS,YAwBxB,CAAA;AACL,CAAC,EA1BgB,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QA0BlC"}
@@ -0,0 +1,5 @@
1
+ import ts from "typescript";
2
+ import { IProject } from "../../IProject";
3
+ export declare namespace ValidatePruneTransformer {
4
+ function transform(project: IProject, modulo: ts.LeftHandSideExpression, expression: ts.CallExpression): ts.Expression;
5
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ValidatePruneTransformer = void 0;
7
+ var typescript_1 = __importDefault(require("typescript"));
8
+ var ValidatePruneProgrammer_1 = require("../../../programmers/ValidatePruneProgrammer");
9
+ var ValidatePruneTransformer;
10
+ (function (ValidatePruneTransformer) {
11
+ function transform(project, modulo, expression) {
12
+ if (expression.arguments.length !== 1)
13
+ throw new Error("Error on typia.validatePrune(): no input value.");
14
+ var type = expression.typeArguments && expression.typeArguments[0]
15
+ ? project.checker.getTypeFromTypeNode(expression.typeArguments[0])
16
+ : project.checker.getTypeAtLocation(expression.arguments[0]);
17
+ if (type.isTypeParameter())
18
+ throw new Error("Error on typia.validatePrune(): non-specified generic argument.");
19
+ return typescript_1.default.factory.createCallExpression(ValidatePruneProgrammer_1.ValidatePruneProgrammer.generate(project, modulo)(type), undefined, [expression.arguments[0]]);
20
+ }
21
+ ValidatePruneTransformer.transform = transform;
22
+ })(ValidatePruneTransformer = exports.ValidatePruneTransformer || (exports.ValidatePruneTransformer = {}));
23
+ //# sourceMappingURL=ValidatePruneTransformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidatePruneTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/miscellaneous/ValidatePruneTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,wFAAuF;AAIvF,IAAiB,wBAAwB,CA0BxC;AA1BD,WAAiB,wBAAwB;IACrC,SAAgB,SAAS,CACrB,OAAiB,EACjB,MAAiC,EACjC,UAA6B;QAE7B,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;YACjC,MAAM,IAAI,KAAK,mDAA8B,CAAC;QAGlD,IAAM,IAAI,GACN,UAAU,CAAC,aAAa,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;YACnD,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAC/B,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAC9B;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAE,CAAC,CAAC;QACtE,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,MAAM,IAAI,KAAK,mEAAgC,CAAC;QAGpD,OAAO,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAClC,iDAAuB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EACvD,SAAS,EACT,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAE,CAAC,CAC7B,CAAC;IACN,CAAC;IAxBe,kCAAS,YAwBxB,CAAA;AACL,CAAC,EA1BgB,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QA0BxC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typia",
3
- "version": "3.5.0-dev.20230211",
3
+ "version": "3.5.0-dev.20230212",
4
4
  "description": "Superfast runtime validators with only one line",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
package/src/module.ts CHANGED
@@ -829,8 +829,8 @@ Object.assign(validateParse, validate);
829
829
  * than the native `JSON.stringify()` function. The 5x faster principle is because
830
830
  * it writes an optimized JSON conversion plan, only for the type `T`.
831
831
  *
832
- * For reference, this `typia.stringify()` does not validate the input value type. It
833
- * just believes that the input value is following the type `T`. Therefore, if you
832
+ * For reference, this `typia.stringify()` does not validate the input value type.
833
+ * It just believes that the input value is following the type `T`. Therefore, if you
834
834
  * can't ensure the input value type, it would be better to call one of below functions
835
835
  * instead.
836
836
  *
@@ -990,7 +990,7 @@ export function isStringify<T>(input: T): string | null;
990
990
  * `typia.isStringify()` is a combination function of {@link is} and
991
991
  * {@link stringify}. Therefore, it converts an input value to JSON
992
992
  * (JavaScript Object Notation) string, with type checking.
993
- *
993
+ *f
994
994
  * In such reason, when `input` value is not matched with the type `T`, it returns
995
995
  * `null` value. Otherwise, there's no problem on the `input` value, JSON string would
996
996
  * be returned.
@@ -1112,8 +1112,17 @@ export function metadata(): never {
1112
1112
  * objects. Note that, as every superfluous properties would be deleted, you never can
1113
1113
  * read those superfluous properties after calling this `prune()` function.
1114
1114
  *
1115
+ * For reference, this `typia.prune()` function does not validate the input value type.
1116
+ * It just believes that the input value is following the type `T`. Therefore, if you
1117
+ * can't ensure the input value type, it would better to call one of below functions
1118
+ * instead.
1119
+ *
1120
+ * - {@link assertPrune}
1121
+ * - {@link isPrune}
1122
+ * - {@link validatePrune}
1123
+ *
1115
1124
  * @template T Type of the input value
1116
- * @param input target instance to prune
1125
+ * @param input Target instance to prune
1117
1126
  *
1118
1127
  * @author Jeongho Nam - https://github.com/samchon
1119
1128
  */
@@ -1137,7 +1146,6 @@ export namespace prune {
1137
1146
  export const is_ipv6 = $is_ipv6;
1138
1147
  export const is_between = $is_between;
1139
1148
 
1140
- export const rest = $rest;
1141
1149
  export function throws(
1142
1150
  props: Pick<TypeGuardError.IProps, "expected" | "value">,
1143
1151
  ): void {
@@ -1148,6 +1156,180 @@ export namespace prune {
1148
1156
  }
1149
1157
  }
1150
1158
 
1159
+ /**
1160
+ * Prune, erase superfluous properties, with type assertion.
1161
+ *
1162
+ * `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
1163
+ * Therefore, it removes every superfluous properties from the `input` object including
1164
+ * nested objects, with type assertion.
1165
+ *
1166
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
1167
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
1168
+ * every superfluous properties would be removed, including nested objects.
1169
+ *
1170
+ * @template T Type of the input value
1171
+ * @param input Target instance to assert and prune
1172
+ *
1173
+ * @author Jeongho Nam - https://github.com/samchon
1174
+ */
1175
+ export function assertPrune<T>(input: T): T;
1176
+
1177
+ /**
1178
+ * Prune, erase superfluous properties, with type assertion.
1179
+ *
1180
+ * `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
1181
+ * Therefore, it removes every superfluous properties from the `input` object including
1182
+ * nested objects, with type assertion.
1183
+ *
1184
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
1185
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
1186
+ * every superfluous properties would be removed, including nested objects.
1187
+ *
1188
+ * @template T Type of the input value
1189
+ * @param input Target instance to assert and prune
1190
+ *
1191
+ * @author Jeongho Nam - https://github.com/samchon
1192
+ */
1193
+ export function assertPrune<T>(input: unknown): T;
1194
+
1195
+ /**
1196
+ * @internal
1197
+ */
1198
+ export function assertPrune<T>(): unknown {
1199
+ halt("assertPrune");
1200
+ }
1201
+
1202
+ /**
1203
+ * @internal
1204
+ */
1205
+ export namespace assertPrune {
1206
+ export const is_uuid = $is_uuid;
1207
+ export const is_email = $is_email;
1208
+ export const is_url = $is_url;
1209
+ export const is_ipv4 = $is_ipv4;
1210
+ export const is_ipv6 = $is_ipv6;
1211
+ export const is_between = $is_between;
1212
+
1213
+ export const join = $join;
1214
+ export const every = $every;
1215
+ export const guard = $guard("typia.assertPrune");
1216
+ }
1217
+
1218
+ /**
1219
+ * Prune, erase superfluous properties, with type checking.
1220
+ *
1221
+ * `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
1222
+ * Therefore, it removes every superfluous properties from the `input` object including
1223
+ * nested objects, with type checking.
1224
+ *
1225
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1226
+ * `false` value. Otherwise, there's no problem on the `input` value, it returns
1227
+ * `true` after removing every superfluous properties, including nested objects.
1228
+ *
1229
+ * @template T Type of the input value
1230
+ * @param input Target instance to check and prune
1231
+ * @returns Whether the parametric value is following the type `T` or not
1232
+ *
1233
+ * @author Jeongho Nam - https://github.com/samchon
1234
+ */
1235
+ export function isPrune<T>(input: T): input is T;
1236
+
1237
+ /**
1238
+ * Prune, erase superfluous properties, with type checking.
1239
+ *
1240
+ * `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
1241
+ * Therefore, it removes every superfluous properties from the `input` object including
1242
+ * nested objects, with type checking.
1243
+ *
1244
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1245
+ * `false` value. Otherwise, there's no problem on the `input` value, it returns
1246
+ * `true` after removing every superfluous properties, including nested objects.
1247
+ *
1248
+ * @template T Type of the input value
1249
+ * @param input Target instance to check and prune
1250
+ * @returns Whether the parametric value is following the type `T` or not
1251
+ *
1252
+ * @author Jeongho Nam - https://github.com/samchon
1253
+ */
1254
+ export function isPrune<T>(input: unknown): input is T;
1255
+
1256
+ /**
1257
+ * @internal
1258
+ */
1259
+ export function isPrune(): never {
1260
+ halt("isPrune");
1261
+ }
1262
+
1263
+ /**
1264
+ * @internal
1265
+ */
1266
+ export namespace isPrune {
1267
+ export const is_uuid = $is_uuid;
1268
+ export const is_email = $is_email;
1269
+ export const is_url = $is_url;
1270
+ export const is_ipv4 = $is_ipv4;
1271
+ export const is_ipv6 = $is_ipv6;
1272
+ export const is_between = $is_between;
1273
+
1274
+ export function throws(
1275
+ props: Pick<TypeGuardError.IProps, "expected" | "value">,
1276
+ ): void {
1277
+ throw new TypeGuardError({
1278
+ ...props,
1279
+ method: "typia.prune",
1280
+ });
1281
+ }
1282
+ }
1283
+
1284
+ /**
1285
+ * Prune, erase superfluous properties, with type validation.
1286
+ *
1287
+ * `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
1288
+ * Therefore, it removes every superfluous properties from the `input` object including
1289
+ * nested objects, with type validation.
1290
+ *
1291
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1292
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
1293
+ * no problem on the `input` value, it returns {@link IValidation.ISucess} value after
1294
+ * removing every superfluous properties, including nested objects.
1295
+ *
1296
+ * @template T Type of the input value
1297
+ * @param input Target instance to validate and prune
1298
+ * @returns Validation result
1299
+ *
1300
+ * @author Jeongho Nam - https://github.com/samchon
1301
+ */
1302
+ export function validatePrune<T>(input: T): IValidation<T>;
1303
+
1304
+ /**
1305
+ * Prune, erase superfluous properties, with type validation.
1306
+ *
1307
+ * `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
1308
+ * Therefore, it removes every superfluous properties from the `input` object including
1309
+ * nested objects, with type validation.
1310
+ *
1311
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1312
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
1313
+ * no problem on the `input` value, it returns {@link IValidation.ISucess} value after
1314
+ * removing every superfluous properties, including nested objects.
1315
+ *
1316
+ * @template T Type of the input value
1317
+ * @param input Target instance to validate and prune
1318
+ * @returns Validation result
1319
+ *
1320
+ * @author Jeongho Nam - https://github.com/samchon
1321
+ */
1322
+ export function validatePrune<T>(input: unknown): IValidation<T>;
1323
+
1324
+ /**
1325
+ * @internal
1326
+ */
1327
+ export function validatePrune<T>(): IValidation<T> {
1328
+ halt("validatePrune");
1329
+ }
1330
+ Object.assign(validatePrune, prune);
1331
+ Object.assign(validatePrune, validate);
1332
+
1151
1333
  /* ===========================================================
1152
1334
  FACTORY FUNCTIONS
1153
1335
  - BASIC VALIDATORS
@@ -1611,6 +1793,97 @@ export function createPrune<T extends object>(): (input: T) => void {
1611
1793
  }
1612
1794
  Object.assign(createPrune, prune);
1613
1795
 
1796
+ /**
1797
+ * Creates a reusable {@link isPrune} function.
1798
+ *
1799
+ * @danger You have to specify the generic argument `T`
1800
+ * @return Nothing until specifying the generic argument `T`
1801
+ * @throws compile error
1802
+ *
1803
+ * @author Jeongho Nam - https://github.com/samchon
1804
+ */
1805
+ export function createAssertPrune(): never;
1806
+
1807
+ /**
1808
+ * Creates a resuable {@link isPrune} function.
1809
+ *
1810
+ * @template T Type of the input value
1811
+ * @returns A reusable `isPrune` function
1812
+ *
1813
+ * @author Jeongho Nam - https://github.com/samchon
1814
+ */
1815
+ export function createAssertPrune<T extends object>(): (input: T) => T;
1816
+
1817
+ /**
1818
+ * @internal
1819
+ */
1820
+ export function createAssertPrune<T extends object>(): (input: T) => T {
1821
+ halt("createAssertPrune");
1822
+ }
1823
+ Object.assign(createAssertPrune, assertPrune);
1824
+
1825
+ /**
1826
+ * Creates a reusable {@link isPrune} function.
1827
+ *
1828
+ * @danger You have to specify the generic argument `T`
1829
+ * @return Nothing until specifying the generic argument `T`
1830
+ * @throws compile error
1831
+ *
1832
+ * @author Jeongho Nam - https://github.com/samchon
1833
+ */
1834
+ export function createIsPrune(): never;
1835
+
1836
+ /**
1837
+ * Creates a resuable {@link isPrune} function.
1838
+ *
1839
+ * @template T Type of the input value
1840
+ * @returns A reusable `isPrune` function
1841
+ *
1842
+ * @author Jeongho Nam - https://github.com/samchon
1843
+ */
1844
+ export function createIsPrune<T extends object>(): (input: T) => input is T;
1845
+
1846
+ /**
1847
+ * @internal
1848
+ */
1849
+ export function createIsPrune<T extends object>(): (input: T) => input is T {
1850
+ halt("createIsPrune");
1851
+ }
1852
+ Object.assign(createIsPrune, isPrune);
1853
+
1854
+ /**
1855
+ * Creates a reusable {@link validatePrune} function.
1856
+ *
1857
+ * @danger You have to specify the generic argument `T`
1858
+ * @return Nothing until specifying the generic argument `T`
1859
+ * @throws compile error
1860
+ *
1861
+ * @author Jeongho Nam - https://github.com/samchon
1862
+ */
1863
+ export function createValidatePrune(): never;
1864
+
1865
+ /**
1866
+ * Creates a resuable {@link validatePrune} function.
1867
+ *
1868
+ * @template T Type of the input value
1869
+ * @returns A reusable `validatePrune` function
1870
+ *
1871
+ * @author Jeongho Nam - https://github.com/samchon
1872
+ */
1873
+ export function createValidatePrune<T extends object>(): (
1874
+ input: T,
1875
+ ) => IValidation<T>;
1876
+
1877
+ /**
1878
+ * @internal
1879
+ */
1880
+ export function createValidatePrune<T extends object>(): (
1881
+ input: T,
1882
+ ) => IValidation<T> {
1883
+ halt("createValidatePrune");
1884
+ }
1885
+ Object.assign(createValidatePrune, validatePrune);
1886
+
1614
1887
  /**
1615
1888
  * @internal
1616
1889
  */
@@ -0,0 +1,59 @@
1
+ import ts from "typescript";
2
+
3
+ import { IdentifierFactory } from "../factories/IdentifierFactory";
4
+ import { StatementFactory } from "../factories/StatementFactory";
5
+
6
+ import { IProject } from "../transformers/IProject";
7
+
8
+ import { AssertProgrammer } from "./AssertProgrammer";
9
+ import { PruneProgrammer } from "./PruneProgrammer";
10
+
11
+ export namespace AssertPruneProgrammer {
12
+ export const generate =
13
+ (project: IProject, modulo: ts.LeftHandSideExpression) =>
14
+ (type: ts.Type) =>
15
+ ts.factory.createArrowFunction(
16
+ undefined,
17
+ undefined,
18
+ [IdentifierFactory.parameter("input")],
19
+ undefined,
20
+ undefined,
21
+ ts.factory.createBlock([
22
+ StatementFactory.constant(
23
+ "assert",
24
+ AssertProgrammer.generate(project, modulo)(type),
25
+ ),
26
+ StatementFactory.constant(
27
+ "prune",
28
+ PruneProgrammer.generate(
29
+ {
30
+ ...project,
31
+ options: {
32
+ ...project.options,
33
+ functional: false,
34
+ numeric: false,
35
+ },
36
+ },
37
+ modulo,
38
+ )(type),
39
+ ),
40
+ ts.factory.createExpressionStatement(
41
+ ts.factory.createCallExpression(
42
+ ts.factory.createIdentifier("assert"),
43
+ undefined,
44
+ [ts.factory.createIdentifier("input")],
45
+ ),
46
+ ),
47
+ ts.factory.createExpressionStatement(
48
+ ts.factory.createCallExpression(
49
+ ts.factory.createIdentifier("prune"),
50
+ undefined,
51
+ [ts.factory.createIdentifier("input")],
52
+ ),
53
+ ),
54
+ ts.factory.createReturnStatement(
55
+ ts.factory.createIdentifier("input"),
56
+ ),
57
+ ]),
58
+ );
59
+ }