@nestia/migrate 14.0.1 → 14.0.2

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 (167) hide show
  1. package/lib/NestiaMigrateApplication.d.ts +111 -0
  2. package/lib/NestiaMigrateApplication.js +148 -9
  3. package/lib/NestiaMigrateApplication.js.map +1 -1
  4. package/lib/NestiaMigrateApplication.mjs +147 -5
  5. package/lib/analyzers/NestiaMigrateControllerAnalyzer.d.ts +45 -0
  6. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js +59 -3
  7. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -1
  8. package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs +9 -3
  9. package/lib/archivers/NestiaMigrateFileArchiver.d.ts +34 -0
  10. package/lib/archivers/NestiaMigrateFileArchiver.js +34 -0
  11. package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
  12. package/lib/bundles/NEST_TEMPLATE.js +1 -1
  13. package/lib/bundles/NEST_TEMPLATE.mjs +1 -1
  14. package/lib/bundles/SDK_TEMPLATE.js +1 -1
  15. package/lib/bundles/SDK_TEMPLATE.mjs +1 -1
  16. package/lib/executable/NestiaMigrateCommander.d.ts +36 -0
  17. package/lib/executable/NestiaMigrateCommander.js +38 -0
  18. package/lib/executable/NestiaMigrateCommander.js.map +1 -1
  19. package/lib/executable/NestiaMigrateCommander.mjs +3 -1
  20. package/lib/executable/NestiaMigrateInquirer.d.ts +29 -0
  21. package/lib/executable/NestiaMigrateInquirer.js +20 -0
  22. package/lib/executable/NestiaMigrateInquirer.js.map +1 -1
  23. package/lib/factories/ExpressionFactory.d.ts +14 -0
  24. package/lib/factories/ExpressionFactory.js +14 -0
  25. package/lib/factories/ExpressionFactory.js.map +1 -1
  26. package/lib/factories/IdentifierFactory.d.ts +20 -0
  27. package/lib/factories/IdentifierFactory.js +20 -0
  28. package/lib/factories/IdentifierFactory.js.map +1 -1
  29. package/lib/factories/LiteralFactory.d.ts +18 -2
  30. package/lib/factories/LiteralFactory.js +18 -2
  31. package/lib/factories/LiteralFactory.js.map +1 -1
  32. package/lib/factories/StatementFactory.d.ts +26 -1
  33. package/lib/factories/StatementFactory.js +26 -1
  34. package/lib/factories/StatementFactory.js.map +1 -1
  35. package/lib/factories/SupportedStringFormats.d.ts +6 -0
  36. package/lib/factories/SupportedStringFormats.js +33 -0
  37. package/lib/factories/SupportedStringFormats.js.map +1 -0
  38. package/lib/factories/SupportedStringFormats.mjs +34 -0
  39. package/lib/factories/SupportedStringFormats.mjs.map +1 -0
  40. package/lib/factories/TypeFactory.d.ts +21 -0
  41. package/lib/factories/TypeFactory.js +13 -0
  42. package/lib/factories/TypeFactory.js.map +1 -1
  43. package/lib/factories/TypeLiteralFactory.d.ts +18 -0
  44. package/lib/factories/TypeLiteralFactory.js +18 -0
  45. package/lib/factories/TypeLiteralFactory.js.map +1 -1
  46. package/lib/internal/ts.d.ts +153 -0
  47. package/lib/internal/ts.js.map +1 -1
  48. package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +31 -0
  49. package/lib/programmers/NestiaMigrateApiFileProgrammer.js +17 -0
  50. package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -1
  51. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +40 -0
  52. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +27 -0
  53. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
  54. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +39 -0
  55. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +26 -0
  56. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -1
  57. package/lib/programmers/NestiaMigrateApiProgrammer.d.ts +18 -0
  58. package/lib/programmers/NestiaMigrateApiProgrammer.js +18 -0
  59. package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
  60. package/lib/programmers/NestiaMigrateApiProgrammer.mjs +1 -1
  61. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +40 -0
  62. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +27 -0
  63. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -1
  64. package/lib/programmers/NestiaMigrateApiStartProgrammer.d.ts +17 -0
  65. package/lib/programmers/NestiaMigrateApiStartProgrammer.js +19 -8
  66. package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -1
  67. package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs +1 -6
  68. package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +30 -0
  69. package/lib/programmers/NestiaMigrateDtoProgrammer.js +17 -0
  70. package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -1
  71. package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +39 -0
  72. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +26 -0
  73. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -1
  74. package/lib/programmers/NestiaMigrateE2eProgrammer.d.ts +16 -0
  75. package/lib/programmers/NestiaMigrateE2eProgrammer.js +16 -0
  76. package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
  77. package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +75 -0
  78. package/lib/programmers/NestiaMigrateImportProgrammer.js +58 -3
  79. package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
  80. package/lib/programmers/NestiaMigrateImportProgrammer.mjs +58 -3
  81. package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +28 -0
  82. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +16 -0
  83. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
  84. package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +30 -0
  85. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +16 -0
  86. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -1
  87. package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +16 -0
  88. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +16 -0
  89. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -1
  90. package/lib/programmers/NestiaMigrateNestProgrammer.d.ts +17 -0
  91. package/lib/programmers/NestiaMigrateNestProgrammer.js +17 -0
  92. package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
  93. package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +16 -0
  94. package/lib/programmers/NestiaMigrateSchemaProgrammer.js +20 -5
  95. package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
  96. package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs +4 -4
  97. package/lib/structures/INestiaMigrateConfig.d.ts +21 -0
  98. package/lib/structures/INestiaMigrateContext.d.ts +15 -0
  99. package/lib/structures/INestiaMigrateController.d.ts +13 -0
  100. package/lib/structures/INestiaMigrateFile.d.ts +11 -0
  101. package/lib/utils/FilePrinter.d.ts +33 -0
  102. package/lib/utils/FilePrinter.js +33 -0
  103. package/lib/utils/FilePrinter.js.map +1 -1
  104. package/lib/utils/MapUtil.d.ts +17 -0
  105. package/lib/utils/MapUtil.js +19 -3
  106. package/lib/utils/MapUtil.js.map +1 -1
  107. package/lib/utils/MapUtil.mjs +1 -2
  108. package/lib/utils/PathTemplate.d.ts +23 -1
  109. package/lib/utils/PathTemplate.js +15 -1
  110. package/lib/utils/PathTemplate.js.map +1 -1
  111. package/lib/utils/RequestBody.d.ts +13 -0
  112. package/lib/utils/RequestBody.js +13 -0
  113. package/lib/utils/RequestBody.js.map +1 -1
  114. package/lib/utils/StringUtil.d.ts +55 -0
  115. package/lib/utils/StringUtil.js +93 -8
  116. package/lib/utils/StringUtil.js.map +1 -1
  117. package/lib/utils/StringUtil.mjs +30 -8
  118. package/lib/utils/SuccessStatus.d.ts +21 -1
  119. package/lib/utils/SuccessStatus.js +21 -1
  120. package/lib/utils/SuccessStatus.js.map +1 -1
  121. package/package.json +4 -3
  122. package/src/NestiaMigrateApplication.ts +151 -13
  123. package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +59 -4
  124. package/src/archivers/NestiaMigrateFileArchiver.ts +34 -0
  125. package/src/bundles/NEST_TEMPLATE.ts +1 -1
  126. package/src/bundles/SDK_TEMPLATE.ts +1 -1
  127. package/src/executable/NestiaMigrateCommander.ts +40 -0
  128. package/src/executable/NestiaMigrateInquirer.ts +29 -0
  129. package/src/factories/ExpressionFactory.ts +14 -0
  130. package/src/factories/IdentifierFactory.ts +20 -0
  131. package/src/factories/LiteralFactory.ts +18 -2
  132. package/src/factories/StatementFactory.ts +26 -1
  133. package/src/factories/SupportedStringFormats.ts +29 -0
  134. package/src/factories/TypeFactory.ts +21 -0
  135. package/src/factories/TypeLiteralFactory.ts +18 -0
  136. package/src/internal/ts.ts +153 -0
  137. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +35 -0
  138. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +43 -0
  139. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +42 -0
  140. package/src/programmers/NestiaMigrateApiProgrammer.ts +18 -0
  141. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +43 -0
  142. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +19 -10
  143. package/src/programmers/NestiaMigrateDtoProgrammer.ts +33 -0
  144. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +42 -0
  145. package/src/programmers/NestiaMigrateE2eProgrammer.ts +16 -0
  146. package/src/programmers/NestiaMigrateImportProgrammer.ts +86 -5
  147. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +30 -0
  148. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +34 -0
  149. package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +16 -0
  150. package/src/programmers/NestiaMigrateNestProgrammer.ts +17 -0
  151. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +25 -8
  152. package/src/structures/INestiaMigrateConfig.ts +26 -0
  153. package/src/structures/INestiaMigrateContext.ts +17 -0
  154. package/src/structures/INestiaMigrateController.ts +16 -0
  155. package/src/structures/INestiaMigrateFile.ts +13 -0
  156. package/src/utils/FilePrinter.ts +33 -0
  157. package/src/utils/MapUtil.ts +18 -2
  158. package/src/utils/PathTemplate.ts +23 -1
  159. package/src/utils/RequestBody.ts +13 -0
  160. package/src/utils/StringUtil.ts +101 -9
  161. package/src/utils/SuccessStatus.ts +21 -1
  162. package/lib/factories/FormatCheatSheet.d.ts +0 -25
  163. package/lib/factories/FormatCheatSheet.js +0 -34
  164. package/lib/factories/FormatCheatSheet.js.map +0 -1
  165. package/lib/factories/FormatCheatSheet.mjs +0 -31
  166. package/lib/factories/FormatCheatSheet.mjs.map +0 -1
  167. package/src/factories/FormatCheatSheet.ts +0 -71
@@ -1 +1 @@
1
- {"version":3,"file":"ExpressionFactory.js","sourceRoot":"","sources":["../../src/factories/ExpressionFactory.ts"],"names":[],"mappings":";;;AAAA,2CAKuB;AAEvB;;;;GAIG;AACH,IAAiB,iBAAiB,CAUjC;AAVD,WAAiB,iBAAiB;IACnB,wBAAM,GAAG,CACpB,KAAa,EAC2B,EAAE,CAC1C,KAAK,GAAG,CAAC;QACP,CAAC,CAAC,iBAAO,CAAC,2BAA2B,CACjC,oBAAU,CAAC,UAAU,EACrB,iBAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAC9C;QACH,CAAC,CAAC,iBAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,EAVgB,iBAAiB,aAAjB,iBAAiB,GAAjB,iBAAiB,QAUjC"}
1
+ {"version":3,"file":"ExpressionFactory.js","sourceRoot":"","sources":["../../src/factories/ExpressionFactory.ts"],"names":[],"mappings":";;;AAAA,2CAKuB;AAEvB;;;;;;;;;GASG;AACH,IAAiB,iBAAiB,CAmBjC;AAnBD,WAAiB,iBAAiB;IAChC;;;;;;;;OAQG;IACU,wBAAM,GAAG,CACpB,KAAa,EAC2B,EAAE,CAC1C,KAAK,GAAG,CAAC;QACP,CAAC,CAAC,iBAAO,CAAC,2BAA2B,CACjC,oBAAU,CAAC,UAAU,EACrB,iBAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAC9C;QACH,CAAC,CAAC,iBAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,EAnBgB,iBAAiB,aAAjB,iBAAiB,GAAjB,iBAAiB,QAmBjC"}
@@ -2,21 +2,41 @@ import { type Expression, type Identifier, type ParameterDeclaration, type Strin
2
2
  /**
3
3
  * Identifier and member-access helpers. The surface kept here is the subset
4
4
  * nestia generators actually call (`identifier`, `access`, `parameter`).
5
+ *
6
+ * @evidence contracts/common.md#principled-implementation The functions decide between an identifier and a string literal by the syntax of the name, so any string can be used as a key.
7
+ * @evidence contracts/common.md#clear-and-simple-design Three small functions and one private predicate.
8
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The variable-name test is a regular expression of the language's identifier syntax, which is inlined so that the package need not load a larger namespace.
9
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
5
10
  */
6
11
  export declare namespace IdentifierFactory {
7
12
  /**
8
13
  * Build an identifier or string literal depending on whether `name` is a
9
14
  * valid JavaScript identifier.
15
+ *
16
+ * @evidence contracts/common.md#principled-implementation The name is tested against the identifier grammar `[A-Za-z_$][A-Za-z0-9_$]*`, which is conservative: a valid name outside it, such as one with non-ASCII letters, becomes a quoted key, which is equivalent.
17
+ * @evidence contracts/common.md#clear-and-simple-design One conditional.
18
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The test applies to every name.
19
+ * @evidence contracts/common.md#meaningful-documentation The comment states the two results.
10
20
  */
11
21
  const identifier: (name: string) => Identifier | StringLiteral;
12
22
  /**
13
23
  * Member access on `input` by `key`. Falls back to element access when the
14
24
  * key is not a valid identifier.
25
+ *
26
+ * @evidence contracts/common.md#principled-implementation The postfix is built by `identifier`, and its kind selects the property form or the element form, with the chain token added when requested.
27
+ * @evidence contracts/common.md#clear-and-simple-design One function delegating the naming rule.
28
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It never concatenates source text.
29
+ * @evidence contracts/common.md#meaningful-documentation The comment states the forms.
15
30
  */
16
31
  const access: (input: Expression, key: string, chain?: boolean) => Expression;
17
32
  /**
18
33
  * Parameter declaration with default `any` type when the caller omits one.
19
34
  * Passing a `QuestionToken` as `init` marks the parameter optional.
35
+ *
36
+ * @evidence contracts/common.md#principled-implementation An initializer that is the question token becomes the optional marker and is not an initializer, and any other initializer is passed through.
37
+ * @evidence contracts/common.md#clear-and-simple-design One function with one branch.
38
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It follows the declaration grammar.
39
+ * @evidence contracts/common.md#meaningful-documentation The comment states the optional marker and the default type.
20
40
  */
21
41
  const parameter: (name: string | Identifier, type?: TypeNode, init?: Expression | Token) => ParameterDeclaration;
22
42
  }
@@ -10,12 +10,22 @@ const isVariableName = (str) => VARIABLE_REGEX.test(str);
10
10
  /**
11
11
  * Identifier and member-access helpers. The surface kept here is the subset
12
12
  * nestia generators actually call (`identifier`, `access`, `parameter`).
13
+ *
14
+ * @evidence contracts/common.md#principled-implementation The functions decide between an identifier and a string literal by the syntax of the name, so any string can be used as a key.
15
+ * @evidence contracts/common.md#clear-and-simple-design Three small functions and one private predicate.
16
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The variable-name test is a regular expression of the language's identifier syntax, which is inlined so that the package need not load a larger namespace.
17
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
13
18
  */
14
19
  var IdentifierFactory;
15
20
  (function (IdentifierFactory) {
16
21
  /**
17
22
  * Build an identifier or string literal depending on whether `name` is a
18
23
  * valid JavaScript identifier.
24
+ *
25
+ * @evidence contracts/common.md#principled-implementation The name is tested against the identifier grammar `[A-Za-z_$][A-Za-z0-9_$]*`, which is conservative: a valid name outside it, such as one with non-ASCII letters, becomes a quoted key, which is equivalent.
26
+ * @evidence contracts/common.md#clear-and-simple-design One conditional.
27
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The test applies to every name.
28
+ * @evidence contracts/common.md#meaningful-documentation The comment states the two results.
19
29
  */
20
30
  IdentifierFactory.identifier = (name) => isVariableName(name)
21
31
  ? factory_1.factory.createIdentifier(name)
@@ -23,6 +33,11 @@ var IdentifierFactory;
23
33
  /**
24
34
  * Member access on `input` by `key`. Falls back to element access when the
25
35
  * key is not a valid identifier.
36
+ *
37
+ * @evidence contracts/common.md#principled-implementation The postfix is built by `identifier`, and its kind selects the property form or the element form, with the chain token added when requested.
38
+ * @evidence contracts/common.md#clear-and-simple-design One function delegating the naming rule.
39
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It never concatenates source text.
40
+ * @evidence contracts/common.md#meaningful-documentation The comment states the forms.
26
41
  */
27
42
  IdentifierFactory.access = (input, key, chain) => {
28
43
  const postfix = IdentifierFactory.identifier(key);
@@ -37,6 +52,11 @@ var IdentifierFactory;
37
52
  /**
38
53
  * Parameter declaration with default `any` type when the caller omits one.
39
54
  * Passing a `QuestionToken` as `init` marks the parameter optional.
55
+ *
56
+ * @evidence contracts/common.md#principled-implementation An initializer that is the question token becomes the optional marker and is not an initializer, and any other initializer is passed through.
57
+ * @evidence contracts/common.md#clear-and-simple-design One function with one branch.
58
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It follows the declaration grammar.
59
+ * @evidence contracts/common.md#meaningful-documentation The comment states the optional marker and the default type.
40
60
  */
41
61
  IdentifierFactory.parameter = (name, type, init) => {
42
62
  const isQuestionToken = !!init &&
@@ -1 +1 @@
1
- {"version":3,"file":"IdentifierFactory.js","sourceRoot":"","sources":["../../src/factories/IdentifierFactory.ts"],"names":[],"mappings":";;;AAAA,2CASuB;AAEvB,+CAA4C;AAE5C,yEAAyE;AACzE,yEAAyE;AACzE,MAAM,cAAc,GAAG,4BAA4B,CAAC;AACpD,MAAM,cAAc,G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B,CAC9B,KAAK,EACL,iBAAO,CAAC,WAAW,CAAC,oBAAU,CAAC,gBAAgB,CAAC,EAChD,OAAO,CACR;gBACH,CAAC,CAAC,iBAAO,CAAC,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC5D,OAAO,KAAK,KAAK,IAAI;YACnB,CAAC,CAAC,iBAAO,CAAC,yBAAyB,CAC/B,KAAK,EACL,iBAAO,CAAC,WAAW,CAAC,oBAAU,CAAC,gBAAgB,CAAC,EAChD,OAAO,CACR;YACH,CAAC,CAAC,iBAAO,CAAC,8BAA8B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC,CAAC;IAEF;;;;;;;;OAQG;IACU,2BAAS,GAAG,CACvB,IAAyB,EACzB,IAAe,EACf,IAAyB,EACH,EAAE;QACxB,MAAM,eAAe,GACnB,CAAC,CAAC,IAAI;YACN,IAAI,CAAC,IAAI,KAAK,OAAO;YACpB,IAAc,CAAC,KAAK,KAAK,oBAAU,CAAC,aAAa,CAAC;QACrD,OAAO,iBAAO,CAAC,0BAA0B,CACvC,SAAS,EACT,SAAS,EACT,IAAI,EACJ,eAAe;YACb,CAAC,CAAC,iBAAO,CAAC,WAAW,CAAC,oBAAU,CAAC,aAAa,CAAC;YAC/C,CAAC,CAAC,SAAS,EACb,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,yBAAW,CAAC,OAAO,CAAC,KAAK,CAAC,EAClC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAE,IAA+B,CAC/D,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,EA5EgB,iBAAiB,aAAjB,iBAAiB,GAAjB,iBAAiB,QA4EjC"}
@@ -1,9 +1,25 @@
1
1
  import { type Expression } from "@ttsc/factory";
2
2
  /**
3
3
  * Recursive value-to-AST-literal builder. Hands back already-AST inputs
4
- * unchanged (so callers can mix factory output with raw JS values inside the
5
- * same object/array), and emits the appropriate literal node otherwise.
4
+ * unchanged for arrow functions, calls and identifiers (so callers can mix
5
+ * those factory expressions with raw values inside objects/arrays), and emits
6
+ * the appropriate literal node otherwise.
7
+ *
8
+ * @evidence contracts/common.md#principled-implementation The namespace maps null, booleans, numbers, strings, bigint text, arrays and object entries to literal expressions, passes through the three accepted AST kinds, maps functions to undefined and refuses unsupported primitive types.
9
+ * @evidence contracts/common.md#clear-and-simple-design One entry function and two private helpers for containers.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The mapping is by type, with no value special-cased.
11
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
6
12
  */
7
13
  export declare namespace LiteralFactory {
14
+ /**
15
+ * Builds the expression of a value: `null`, a boolean, a number, a string, a
16
+ * bigint as its text, an array, an object without its `undefined` members, or
17
+ * an expression node as it is.
18
+ *
19
+ * @evidence contracts/common.md#principled-implementation The value is dispatched by type in a fixed order; nodes of the kinds arrow function, call, and identifier pass through, functions become `undefined`, and an unsupported type is a `TypeError`, so the result is total over the listed types.
20
+ * @evidence contracts/common.md#clear-and-simple-design One function with one branch per type.
21
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The dispatch is general, and a bigint becomes text because a literal bigint is not supported by the target syntax here.
22
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the mapping.
23
+ */
8
24
  const write: (input: any) => Expression;
9
25
  }
@@ -14,11 +14,27 @@ const isNode = (value) => typeof value === "object" &&
14
14
  typeof value.kind === "string";
15
15
  /**
16
16
  * Recursive value-to-AST-literal builder. Hands back already-AST inputs
17
- * unchanged (so callers can mix factory output with raw JS values inside the
18
- * same object/array), and emits the appropriate literal node otherwise.
17
+ * unchanged for arrow functions, calls and identifiers (so callers can mix
18
+ * those factory expressions with raw values inside objects/arrays), and emits
19
+ * the appropriate literal node otherwise.
20
+ *
21
+ * @evidence contracts/common.md#principled-implementation The namespace maps null, booleans, numbers, strings, bigint text, arrays and object entries to literal expressions, passes through the three accepted AST kinds, maps functions to undefined and refuses unsupported primitive types.
22
+ * @evidence contracts/common.md#clear-and-simple-design One entry function and two private helpers for containers.
23
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The mapping is by type, with no value special-cased.
24
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
19
25
  */
20
26
  var LiteralFactory;
21
27
  (function (LiteralFactory) {
28
+ /**
29
+ * Builds the expression of a value: `null`, a boolean, a number, a string, a
30
+ * bigint as its text, an array, an object without its `undefined` members, or
31
+ * an expression node as it is.
32
+ *
33
+ * @evidence contracts/common.md#principled-implementation The value is dispatched by type in a fixed order; nodes of the kinds arrow function, call, and identifier pass through, functions become `undefined`, and an unsupported type is a `TypeError`, so the result is total over the listed types.
34
+ * @evidence contracts/common.md#clear-and-simple-design One function with one branch per type.
35
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The dispatch is general, and a bigint becomes text because a literal bigint is not supported by the target syntax here.
36
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the mapping.
37
+ */
22
38
  LiteralFactory.write = (input) => {
23
39
  if (input === null)
24
40
  return factory_1.factory.createNull();
@@ -1 +1 @@
1
- {"version":3,"file":"LiteralFactory.js","sourceRoot":"","sources":["../../src/factories/LiteralFactory.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AAEzD,2DAAwD;AACxD,2DAAwD;AAExD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS;IACxC,eAAe;IACf,gBAAgB;IAChB,YAAY;CACb,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,CAAC,KAAc,EAAuB,EAAE,CACrD,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ,CAAC;AAEzD;;;;GAIG;AACH,IAAiB,cAAc,CAgC9B;AAhCD,WAAiB,cAAc;IAChB,oBAAK,GAAG,CAAC,KAAU,EAAc,EAAE;QAC9C,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,iBAAO,CAAC,UAAU,EAAE,CAAC;QAChD,IAAI,MAA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Variable-statement helpers. `constant` emits `const`, `mut` emits `let`. */
2
+ /**
3
+ * Variable-statement helpers. `constant` emits `const`, `mut` emits `let`.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation The namespace builds `let` and `const` statements from a name, an optional type, and an optional value.
6
+ * @evidence contracts/common.md#clear-and-simple-design Two functions.
7
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It only builds nodes.
8
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
9
+ */
3
10
  export declare namespace StatementFactory {
11
+ /**
12
+ * Builds a `let` statement; a declaration without a type and without an
13
+ * initializer is typed `any`.
14
+ *
15
+ * @evidence contracts/common.md#principled-implementation A `let` without both a type and an initializer would be implicitly any, so the type is stated explicitly in that case.
16
+ * @evidence contracts/common.md#clear-and-simple-design One expression.
17
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It follows the declaration grammar.
18
+ * @evidence contracts/common.md#meaningful-documentation The comment states the default type.
19
+ */
4
20
  const mut: (props: {
5
21
  name: string;
6
22
  type?: TypeNode | undefined;
7
23
  initializer?: Expression | undefined;
8
24
  }) => VariableStatement;
25
+ /**
26
+ * Builds a `const` statement from a name, an optional type, and an optional
27
+ * value.
28
+ *
29
+ * @evidence contracts/common.md#principled-implementation The declaration list carries the const flag and the given parts.
30
+ * @evidence contracts/common.md#clear-and-simple-design One expression.
31
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It follows the declaration grammar.
32
+ * @evidence contracts/common.md#meaningful-documentation The comment states its inputs.
33
+ */
9
34
  const constant: (props: {
10
35
  name: string;
11
36
  type?: TypeNode | undefined;
@@ -3,9 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StatementFactory = void 0;
4
4
  const factory_1 = require("@ttsc/factory");
5
5
  const TypeFactory_1 = require("./TypeFactory");
6
- /** Variable-statement helpers. `constant` emits `const`, `mut` emits `let`. */
6
+ /**
7
+ * Variable-statement helpers. `constant` emits `const`, `mut` emits `let`.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation The namespace builds `let` and `const` statements from a name, an optional type, and an optional value.
10
+ * @evidence contracts/common.md#clear-and-simple-design Two functions.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It only builds nodes.
12
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
13
+ */
7
14
  var StatementFactory;
8
15
  (function (StatementFactory) {
16
+ /**
17
+ * Builds a `let` statement; a declaration without a type and without an
18
+ * initializer is typed `any`.
19
+ *
20
+ * @evidence contracts/common.md#principled-implementation A `let` without both a type and an initializer would be implicitly any, so the type is stated explicitly in that case.
21
+ * @evidence contracts/common.md#clear-and-simple-design One expression.
22
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It follows the declaration grammar.
23
+ * @evidence contracts/common.md#meaningful-documentation The comment states the default type.
24
+ */
9
25
  StatementFactory.mut = (props) => factory_1.factory.createVariableStatement(undefined, factory_1.factory.createVariableDeclarationList([
10
26
  factory_1.factory.createVariableDeclaration(props.name, undefined, props.type !== undefined
11
27
  ? props.type
@@ -13,6 +29,15 @@ var StatementFactory;
13
29
  ? TypeFactory_1.TypeFactory.keyword("any")
14
30
  : undefined, props.initializer),
15
31
  ], factory_1.NodeFlags.Let));
32
+ /**
33
+ * Builds a `const` statement from a name, an optional type, and an optional
34
+ * value.
35
+ *
36
+ * @evidence contracts/common.md#principled-implementation The declaration list carries the const flag and the given parts.
37
+ * @evidence contracts/common.md#clear-and-simple-design One expression.
38
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It follows the declaration grammar.
39
+ * @evidence contracts/common.md#meaningful-documentation The comment states its inputs.
40
+ */
16
41
  StatementFactory.constant = (props) => factory_1.factory.createVariableStatement(undefined, factory_1.factory.createVariableDeclarationList([
17
42
  factory_1.factory.createVariableDeclaration(props.name, undefined, props.type, props.value),
18
43
  ], factory_1.NodeFlags.Const));
@@ -1 +1 @@
1
- {"version":3,"file":"StatementFactory.js","sourceRoot":"","sources":["../../src/factories/StatementFactory.ts"],"names":[],"mappings":";;;AAAA,2CAMuB;AAEvB,+CAA4C;AAE5C,+EAA+E;AAC/E,IAAiB,gBAAgB,CA4ChC;AA5CD,WAAiB,gBAAgB;IAClB,oBAAG,GAAG,CAAC,KAInB,EAAqB,EAAE,CACtB,iBAAO,CAAC,uBAAuB,CAC7B,SAAS,EACT,iBAAO,CAAC,6BAA6B,CACnC;QACE,iBAAO,CAAC,yBAAyB,CAC/B,KAAK,CAAC,IAAI,EACV,SAAS,EACT,KAAK,CAAC,IAAI,KAAK,SAAS;YACtB,CAAC,CAAC,KAAK,CAAC,IAAI;YACZ,CAAC,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS;gBAC/B,CAAC,CAAC,yBAAW,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC5B,CAAC,CAAC,SAAS,EACf,KAAK,CAAC,WAAW,CAClB;KACF,EACD,mBAAS,CAAC,GAAG,CACd,CACF,CAAC;IAES,yBAAQ,GAAG,CAAC,KAIxB,EAAqB,EAAE,CACtB,iBAAO,CAAC,uBAAuB,CAC7B,SAAS,EACT,iBAAO,CAAC,6BAA6B,CACnC;QACE,iBAAO,CAAC,yBAAyB,CAC/B,KAAK,CAAC,IAAI,EACV,SAAS,EACT,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,KAAK,CACZ;KACF,EACD,mBAAS,CAAC,KAAK,CAChB,CACF,CAAC;AACN,CAAC,EA5CgB,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QA4ChC"}
1
+ {"version":3,"file":"StatementFactory.js","sourceRoot":"","sources":["../../src/factories/StatementFactory.ts"],"names":[],"mappings":";;;AAAA,2CAMuB;AAEvB,+CAA4C;AAE5C;;;;;;;GAOG;AACH,IAAiB,gBAAgB,CA8DhC;AA9DD,WAAiB,gBAAgB;IAC/B;;;;;;;;OAQG;IACU,oBAAG,GAAG,CAAC,KAInB,EAAqB,EAAE,CACtB,iBAAO,CAAC,uBAAuB,CAC7B,SAAS,EACT,iBAAO,CAAC,6BAA6B,CACnC;QACE,iBAAO,CAAC,yBAAyB,CAC/B,KAAK,CAAC,IAAI,EACV,SAAS,EACT,KAAK,CAAC,IAAI,KAAK,SAAS;YACtB,CAAC,CAAC,KAAK,CAAC,IAAI;YACZ,CAAC,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS;gBAC/B,CAAC,CAAC,yBAAW,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC5B,CAAC,CAAC,SAAS,EACf,KAAK,CAAC,WAAW,CAClB;KACF,EACD,mBAAS,CAAC,GAAG,CACd,CACF,CAAC;IAEJ;;;;;;;;OAQG;IACU,yBAAQ,GAAG,CAAC,KAIxB,EAAqB,EAAE,CACtB,iBAAO,CAAC,uBAAuB,CAC7B,SAAS,EACT,iBAAO,CAAC,6BAA6B,CACnC;QACE,iBAAO,CAAC,yBAAyB,CAC/B,KAAK,CAAC,IAAI,EACV,SAAS,EACT,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,KAAK,CACZ;KACF,EACD,mBAAS,CAAC,KAAK,CAChB,CACF,CAAC;AACN,CAAC,EA9DgB,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QA8DhC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The string formats of the OpenAPI document that the typia `Format` tag
3
+ * validates, so a schema carrying one of them is generated as a `Format` tag
4
+ * and a schema carrying any other format stays a plain `string`.
5
+ */
6
+ export declare const SUPPORTED_STRING_FORMATS: ReadonlySet<string>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUPPORTED_STRING_FORMATS = void 0;
4
+ /**
5
+ * The string formats of the OpenAPI document that the typia `Format` tag
6
+ * validates, so a schema carrying one of them is generated as a `Format` tag
7
+ * and a schema carrying any other format stays a plain `string`.
8
+ */
9
+ exports.SUPPORTED_STRING_FORMATS = new Set([
10
+ "byte",
11
+ "password",
12
+ "regex",
13
+ "uuid",
14
+ "email",
15
+ "hostname",
16
+ "idn-email",
17
+ "idn-hostname",
18
+ "iri",
19
+ "iri-reference",
20
+ "ipv4",
21
+ "ipv6",
22
+ "uri",
23
+ "uri-reference",
24
+ "uri-template",
25
+ "url",
26
+ "date-time",
27
+ "date",
28
+ "time",
29
+ "duration",
30
+ "json-pointer",
31
+ "relative-json-pointer",
32
+ ]);
33
+ //# sourceMappingURL=SupportedStringFormats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SupportedStringFormats.js","sourceRoot":"","sources":["../../src/factories/SupportedStringFormats.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,wBAAwB,GAAwB,IAAI,GAAG,CAAC;IACnE,MAAM;IACN,UAAU;IACV,OAAO;IACP,MAAM;IACN,OAAO;IACP,UAAU;IACV,WAAW;IACX,cAAc;IACd,KAAK;IACL,eAAe;IACf,MAAM;IACN,MAAM;IACN,KAAK;IACL,eAAe;IACf,cAAc;IACd,KAAK;IACL,WAAW;IACX,MAAM;IACN,MAAM;IACN,UAAU;IACV,cAAc;IACd,uBAAuB;CACxB,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ //#region src/factories/SupportedStringFormats.ts
2
+ /**
3
+ * The string formats of the OpenAPI document that the typia `Format` tag
4
+ * validates, so a schema carrying one of them is generated as a `Format` tag
5
+ * and a schema carrying any other format stays a plain `string`.
6
+ */
7
+ const SUPPORTED_STRING_FORMATS = /* @__PURE__ */ new Set([
8
+ "byte",
9
+ "password",
10
+ "regex",
11
+ "uuid",
12
+ "email",
13
+ "hostname",
14
+ "idn-email",
15
+ "idn-hostname",
16
+ "iri",
17
+ "iri-reference",
18
+ "ipv4",
19
+ "ipv6",
20
+ "uri",
21
+ "uri-reference",
22
+ "uri-template",
23
+ "url",
24
+ "date-time",
25
+ "date",
26
+ "time",
27
+ "duration",
28
+ "json-pointer",
29
+ "relative-json-pointer"
30
+ ]);
31
+ //#endregion
32
+ export { SUPPORTED_STRING_FORMATS };
33
+
34
+ //# sourceMappingURL=SupportedStringFormats.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SupportedStringFormats.mjs","names":[],"sources":[],"mappings":""}
@@ -5,6 +5,11 @@ import { type KeywordTypeNode, SyntaxKind } from "@ttsc/factory";
5
5
  * Wraps {@link factory.createKeywordTypeNode} with a name-based interface so
6
6
  * generator code reads as `TypeFactory.keyword("any")` instead of selecting the
7
7
  * `SyntaxKind.AnyKeyword` token by hand.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation The namespace maps the names of the nine keyword types to their syntax kinds.
10
+ * @evidence contracts/common.md#clear-and-simple-design One table, one type, and one function.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It only builds nodes.
12
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
8
13
  */
9
14
  export declare namespace TypeFactory {
10
15
  const KEYWORDS: {
@@ -18,7 +23,23 @@ export declare namespace TypeFactory {
18
23
  readonly never: SyntaxKind.NeverKeyword;
19
24
  readonly undefined: SyntaxKind.UndefinedKeyword;
20
25
  };
26
+ /**
27
+ * The names of the supported keyword types.
28
+ *
29
+ * @evidence contracts/common.md#principled-implementation The type is the key set of the table that maps names to syntax kinds, so a new keyword is one table entry.
30
+ * @evidence contracts/common.md#clear-and-simple-design One derived type.
31
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
32
+ * @evidence contracts/common.md#meaningful-documentation The comment names the set.
33
+ */
21
34
  export type Keyword = keyof typeof KEYWORDS;
35
+ /**
36
+ * Builds the keyword type node of a keyword name.
37
+ *
38
+ * @evidence contracts/common.md#principled-implementation The name is looked up in the table, so an unsupported name is a compile error.
39
+ * @evidence contracts/common.md#clear-and-simple-design One lookup.
40
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It follows the type grammar.
41
+ * @evidence contracts/common.md#meaningful-documentation The comment states its input.
42
+ */
22
43
  export const keyword: (type: Keyword) => KeywordTypeNode;
23
44
  export {};
24
45
  }
@@ -8,6 +8,11 @@ const factory_1 = require("@ttsc/factory");
8
8
  * Wraps {@link factory.createKeywordTypeNode} with a name-based interface so
9
9
  * generator code reads as `TypeFactory.keyword("any")` instead of selecting the
10
10
  * `SyntaxKind.AnyKeyword` token by hand.
11
+ *
12
+ * @evidence contracts/common.md#principled-implementation The namespace maps the names of the nine keyword types to their syntax kinds.
13
+ * @evidence contracts/common.md#clear-and-simple-design One table, one type, and one function.
14
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It only builds nodes.
15
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
11
16
  */
12
17
  var TypeFactory;
13
18
  (function (TypeFactory) {
@@ -22,6 +27,14 @@ var TypeFactory;
22
27
  never: factory_1.SyntaxKind.NeverKeyword,
23
28
  undefined: factory_1.SyntaxKind.UndefinedKeyword,
24
29
  };
30
+ /**
31
+ * Builds the keyword type node of a keyword name.
32
+ *
33
+ * @evidence contracts/common.md#principled-implementation The name is looked up in the table, so an unsupported name is a compile error.
34
+ * @evidence contracts/common.md#clear-and-simple-design One lookup.
35
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It follows the type grammar.
36
+ * @evidence contracts/common.md#meaningful-documentation The comment states its input.
37
+ */
25
38
  TypeFactory.keyword = (type) => factory_1.factory.createKeywordTypeNode(KEYWORDS[type]);
26
39
  })(TypeFactory || (exports.TypeFactory = TypeFactory = {}));
27
40
  //# sourceMappingURL=TypeFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TypeFactory.js","sourceRoot":"","sources":["../../src/factories/TypeFactory.ts"],"names":[],"mappings":";;;AAAA,2CAA0E;AAE1E;;;;;;GAMG;AACH,IAAiB,WAAW,CAiB3B;AAjBD,WAAiB,WAAW;IAC1B,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,oBAAU,CAAC,WAAW;QAC5B,GAAG,EAAE,oBAAU,CAAC,UAAU;QAC1B,OAAO,EAAE,oBAAU,CAAC,cAAc;QAClC,OAAO,EAAE,oBAAU,CAAC,cAAc;QAClC,MAAM,EAAE,oBAAU,CAAC,aAAa;QAChC,MAAM,EAAE,oBAAU,CAAC,aAAa;QAChC,MAAM,EAAE,oBAAU,CAAC,aAAa;QAChC,KAAK,EAAE,oBAAU,CAAC,YAAY;QAC9B,SAAS,EAAE,oBAAU,CAAC,gBAAgB;KAC9B,CAAC;IAIE,mBAAO,GAAG,CAAC,IAAa,EAAmB,EAAE,CACxD,iBAAO,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC,EAjBgB,WAAW,aAAX,WAAW,GAAX,WAAW,QAiB3B"}
1
+ {"version":3,"file":"TypeFactory.js","sourceRoot":"","sources":["../../src/factories/TypeFactory.ts"],"names":[],"mappings":";;;AAAA,2CAA0E;AAE1E;;;;;;;;;;;GAWG;AACH,IAAiB,WAAW,CAiC3B;AAjCD,WAAiB,WAAW;IAC1B,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,oBAAU,CAAC,WAAW;QAC5B,GAAG,EAAE,oBAAU,CAAC,UAAU;QAC1B,OAAO,EAAE,oBAAU,CAAC,cAAc;QAClC,OAAO,EAAE,oBAAU,CAAC,cAAc;QAClC,MAAM,EAAE,oBAAU,CAAC,aAAa;QAChC,MAAM,EAAE,oBAAU,CAAC,aAAa;QAChC,MAAM,EAAE,oBAAU,CAAC,aAAa;QAChC,KAAK,EAAE,oBAAU,CAAC,YAAY;QAC9B,SAAS,EAAE,oBAAU,CAAC,gBAAgB;KAC9B,CAAC;IAYX;;;;;;;OAOG;IACU,mBAAO,GAAG,CAAC,IAAa,EAAmB,EAAE,CACxD,iBAAO,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC,EAjCgB,WAAW,aAAX,WAAW,GAAX,WAAW,QAiC3B"}
@@ -1,4 +1,22 @@
1
1
  import ts from "../internal/ts";
2
+ /**
3
+ * Builds type nodes from JavaScript values, so a value can be written as a
4
+ * literal type.
5
+ *
6
+ * @evidence contracts/common.md#principled-implementation The namespace maps booleans, numbers, strings, null, arrays as tuples, and objects as type literals, and anything else to `any`.
7
+ * @evidence contracts/common.md#clear-and-simple-design One entry function and small private builders per kind.
8
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The mapping is by type, with no value special-cased.
9
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
10
+ */
2
11
  export declare namespace TypeLiteralFactory {
12
+ /**
13
+ * Builds the literal type of a value: a literal for a primitive, a tuple for
14
+ * an array, a type literal for an object, and `any` for other values.
15
+ *
16
+ * @evidence contracts/common.md#principled-implementation The value is dispatched by type, negative numbers use a prefix minus as expressions do, and object keys that are not identifiers are quoted.
17
+ * @evidence contracts/common.md#clear-and-simple-design One function with one branch per kind.
18
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The dispatch is general.
19
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the mapping.
20
+ */
3
21
  const generate: (value: any) => ts.TypeNode;
4
22
  }
@@ -3,8 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TypeLiteralFactory = void 0;
4
4
  const factory_1 = require("@ttsc/factory");
5
5
  const utils_1 = require("@typia/utils");
6
+ /**
7
+ * Builds type nodes from JavaScript values, so a value can be written as a
8
+ * literal type.
9
+ *
10
+ * @evidence contracts/common.md#principled-implementation The namespace maps booleans, numbers, strings, null, arrays as tuples, and objects as type literals, and anything else to `any`.
11
+ * @evidence contracts/common.md#clear-and-simple-design One entry function and small private builders per kind.
12
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The mapping is by type, with no value special-cased.
13
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
14
+ */
6
15
  var TypeLiteralFactory;
7
16
  (function (TypeLiteralFactory) {
17
+ /**
18
+ * Builds the literal type of a value: a literal for a primitive, a tuple for
19
+ * an array, a type literal for an object, and `any` for other values.
20
+ *
21
+ * @evidence contracts/common.md#principled-implementation The value is dispatched by type, negative numbers use a prefix minus as expressions do, and object keys that are not identifiers are quoted.
22
+ * @evidence contracts/common.md#clear-and-simple-design One function with one branch per kind.
23
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The dispatch is general.
24
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the mapping.
25
+ */
8
26
  TypeLiteralFactory.generate = (value) => typeof value === "boolean"
9
27
  ? generateBoolean(value)
10
28
  : typeof value === "number"
@@ -1 +1 @@
1
- {"version":3,"file":"TypeLiteralFactory.js","sourceRoot":"","sources":["../../src/factories/TypeLiteralFactory.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AACpD,wCAAgD;AAIhD,IAAiB,kBAAkB,CAqDlC;AArDD,WAAiB,kBAAkB;IACpB,2BAAQ,GAAG,CAAC,KAAU,EAAe,EAAE,CAClD,OAAO,KAAK,KAAK,SAAS;QACxB,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC;QACxB,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;YACvB,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;gBACzB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;gBACvB,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;oBACzB,CAAC,CAAC,KAAK,KAAK,IAAI;wBACd,CAAC,CAAC,YAAY,EAAE;wBAChB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;4BACpB,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;4BACtB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;oBAC3B,CAAC,CAAC,iBAAO,CAAC,qBAAqB,CAAC,oBAAU,CAAC,UAAU,CAAC,CAAC;IAEjE,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE,CACrC,iBAAO,CAAC,qBAAqB,CAAC,iBAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;IAElE,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE,CACrC,iBAAO,CAAC,qBAAqB,CAC3B,GA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