@skmtc/core 0.0.792 → 0.0.794

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 (113) hide show
  1. package/esm/dsl/GeneratedValueList.d.ts +158 -0
  2. package/esm/dsl/GeneratedValueList.d.ts.map +1 -1
  3. package/esm/dsl/GeneratedValueList.js +158 -0
  4. package/esm/dsl/Stringable.d.ts +76 -0
  5. package/esm/dsl/Stringable.d.ts.map +1 -1
  6. package/esm/dsl/Stringable.js +75 -0
  7. package/esm/helpers/ResultsLog.d.ts +193 -0
  8. package/esm/helpers/ResultsLog.d.ts.map +1 -1
  9. package/esm/helpers/ResultsLog.js +213 -0
  10. package/esm/helpers/collateExamples.d.ts +150 -0
  11. package/esm/helpers/collateExamples.d.ts.map +1 -1
  12. package/esm/helpers/collateExamples.js +145 -0
  13. package/esm/helpers/formatNumber.d.ts +95 -0
  14. package/esm/helpers/formatNumber.d.ts.map +1 -1
  15. package/esm/helpers/formatNumber.js +95 -0
  16. package/esm/helpers/generationStats.d.ts +287 -1
  17. package/esm/helpers/generationStats.d.ts.map +1 -1
  18. package/esm/helpers/generationStats.js +266 -0
  19. package/esm/helpers/isEmpty.d.ts +62 -0
  20. package/esm/helpers/isEmpty.d.ts.map +1 -1
  21. package/esm/helpers/isEmpty.js +62 -0
  22. package/esm/helpers/isImported.d.ts +80 -0
  23. package/esm/helpers/isImported.d.ts.map +1 -1
  24. package/esm/helpers/isImported.js +80 -0
  25. package/esm/helpers/parseModuleName.d.ts +175 -0
  26. package/esm/helpers/parseModuleName.d.ts.map +1 -1
  27. package/esm/helpers/parseModuleName.js +153 -0
  28. package/esm/helpers/toResolvedArtifactPath.d.ts +145 -0
  29. package/esm/helpers/toResolvedArtifactPath.d.ts.map +1 -1
  30. package/esm/helpers/toResolvedArtifactPath.js +140 -0
  31. package/esm/helpers/tracer.d.ts +124 -0
  32. package/esm/helpers/tracer.d.ts.map +1 -1
  33. package/esm/helpers/tracer.js +124 -0
  34. package/esm/oas/schema/Schema.d.ts +117 -0
  35. package/esm/oas/schema/Schema.d.ts.map +1 -1
  36. package/esm/typescript/PathParams.d.ts +198 -0
  37. package/esm/typescript/PathParams.d.ts.map +1 -1
  38. package/esm/typescript/PathParams.js +190 -0
  39. package/esm/typescript/ReactRouterPathParams.d.ts +190 -0
  40. package/esm/typescript/ReactRouterPathParams.d.ts.map +1 -1
  41. package/esm/typescript/ReactRouterPathParams.js +183 -0
  42. package/esm/typescript/identifiers.d.ts +159 -0
  43. package/esm/typescript/identifiers.d.ts.map +1 -1
  44. package/esm/typescript/identifiers.js +159 -0
  45. package/esm/typescript/keyValues.d.ts +125 -0
  46. package/esm/typescript/keyValues.d.ts.map +1 -1
  47. package/esm/typescript/keyValues.js +125 -1
  48. package/esm/typescript/toPathParams.d.ts +179 -0
  49. package/esm/typescript/toPathParams.d.ts.map +1 -1
  50. package/esm/typescript/toPathParams.js +179 -0
  51. package/esm/typescript/toPathTemplate.d.ts +114 -0
  52. package/esm/typescript/toPathTemplate.d.ts.map +1 -1
  53. package/esm/typescript/toPathTemplate.js +114 -0
  54. package/esm/typescript/withDescription.d.ts +119 -0
  55. package/esm/typescript/withDescription.d.ts.map +1 -1
  56. package/esm/typescript/withDescription.js +119 -0
  57. package/package.json +1 -1
  58. package/script/dsl/GeneratedValueList.d.ts +158 -0
  59. package/script/dsl/GeneratedValueList.d.ts.map +1 -1
  60. package/script/dsl/GeneratedValueList.js +158 -0
  61. package/script/dsl/Stringable.d.ts +76 -0
  62. package/script/dsl/Stringable.d.ts.map +1 -1
  63. package/script/dsl/Stringable.js +75 -0
  64. package/script/helpers/ResultsLog.d.ts +193 -0
  65. package/script/helpers/ResultsLog.d.ts.map +1 -1
  66. package/script/helpers/ResultsLog.js +213 -0
  67. package/script/helpers/collateExamples.d.ts +150 -0
  68. package/script/helpers/collateExamples.d.ts.map +1 -1
  69. package/script/helpers/collateExamples.js +145 -0
  70. package/script/helpers/formatNumber.d.ts +95 -0
  71. package/script/helpers/formatNumber.d.ts.map +1 -1
  72. package/script/helpers/formatNumber.js +95 -0
  73. package/script/helpers/generationStats.d.ts +287 -1
  74. package/script/helpers/generationStats.d.ts.map +1 -1
  75. package/script/helpers/generationStats.js +266 -0
  76. package/script/helpers/isEmpty.d.ts +62 -0
  77. package/script/helpers/isEmpty.d.ts.map +1 -1
  78. package/script/helpers/isEmpty.js +62 -0
  79. package/script/helpers/isImported.d.ts +80 -0
  80. package/script/helpers/isImported.d.ts.map +1 -1
  81. package/script/helpers/isImported.js +80 -0
  82. package/script/helpers/parseModuleName.d.ts +175 -0
  83. package/script/helpers/parseModuleName.d.ts.map +1 -1
  84. package/script/helpers/parseModuleName.js +153 -0
  85. package/script/helpers/toResolvedArtifactPath.d.ts +145 -0
  86. package/script/helpers/toResolvedArtifactPath.d.ts.map +1 -1
  87. package/script/helpers/toResolvedArtifactPath.js +140 -0
  88. package/script/helpers/tracer.d.ts +124 -0
  89. package/script/helpers/tracer.d.ts.map +1 -1
  90. package/script/helpers/tracer.js +124 -0
  91. package/script/oas/schema/Schema.d.ts +117 -0
  92. package/script/oas/schema/Schema.d.ts.map +1 -1
  93. package/script/typescript/PathParams.d.ts +198 -0
  94. package/script/typescript/PathParams.d.ts.map +1 -1
  95. package/script/typescript/PathParams.js +190 -0
  96. package/script/typescript/ReactRouterPathParams.d.ts +190 -0
  97. package/script/typescript/ReactRouterPathParams.d.ts.map +1 -1
  98. package/script/typescript/ReactRouterPathParams.js +183 -0
  99. package/script/typescript/identifiers.d.ts +159 -0
  100. package/script/typescript/identifiers.d.ts.map +1 -1
  101. package/script/typescript/identifiers.js +159 -0
  102. package/script/typescript/keyValues.d.ts +125 -0
  103. package/script/typescript/keyValues.d.ts.map +1 -1
  104. package/script/typescript/keyValues.js +125 -1
  105. package/script/typescript/toPathParams.d.ts +179 -0
  106. package/script/typescript/toPathParams.d.ts.map +1 -1
  107. package/script/typescript/toPathParams.js +179 -0
  108. package/script/typescript/toPathTemplate.d.ts +114 -0
  109. package/script/typescript/toPathTemplate.d.ts.map +1 -1
  110. package/script/typescript/toPathTemplate.js +114 -0
  111. package/script/typescript/withDescription.d.ts +119 -0
  112. package/script/typescript/withDescription.d.ts.map +1 -1
  113. package/script/typescript/withDescription.js +119 -0
@@ -1,4 +1,123 @@
1
1
  import type { Stringable } from '../dsl/Stringable.js';
2
2
  import type { Modifiers } from '../types/Modifiers.js';
3
+ /**
4
+ * Wraps a value with a JSDoc comment if a description is provided.
5
+ *
6
+ * This utility function is used throughout the SKMTC code generation system to
7
+ * add JSDoc documentation comments to generated TypeScript code. If a description
8
+ * is provided, it formats it as a single-line JSDoc comment above the value.
9
+ * If no description is provided, the value is returned unchanged.
10
+ *
11
+ * @param value - The code value to potentially wrap with documentation
12
+ * @param modifiers - Modifiers object containing optional description
13
+ * @param modifiers.description - Optional description text for the JSDoc comment
14
+ * @returns The value with JSDoc comment prepended if description exists, otherwise just the value
15
+ *
16
+ * @example With description
17
+ * ```typescript
18
+ * import { withDescription } from '@skmtc/core';
19
+ *
20
+ * const result = withDescription(
21
+ * 'export const API_URL = "https://api.example.com";',
22
+ * { description: 'Base URL for all API requests' }
23
+ * );
24
+ *
25
+ * console.log(result);
26
+ * // /** Base URL for all API requests *\/
27
+ * // export const API_URL = "https://api.example.com";
28
+ * ```
29
+ *
30
+ * @example Without description
31
+ * ```typescript
32
+ * const result = withDescription(
33
+ * 'export const API_URL = "https://api.example.com";',
34
+ * { description: undefined }
35
+ * );
36
+ *
37
+ * console.log(result);
38
+ * // export const API_URL = "https://api.example.com";
39
+ * ```
40
+ *
41
+ * @example Using with Definition class
42
+ * ```typescript
43
+ * class ModelGenerator {
44
+ * generateInterface(name: string, description?: string) {
45
+ * const interfaceCode = `interface ${name} {
46
+ * id: string;
47
+ * name: string;
48
+ * }`;
49
+ *
50
+ * return withDescription(interfaceCode, { description });
51
+ * }
52
+ * }
53
+ *
54
+ * const generator = new ModelGenerator();
55
+ * const documented = generator.generateInterface('User', 'Represents a user in the system');
56
+ *
57
+ * console.log(documented);
58
+ * // /** Represents a user in the system *\/
59
+ * // interface User {
60
+ * // id: string;
61
+ * // name: string;
62
+ * // }
63
+ * ```
64
+ *
65
+ * @example Integration with generated definitions
66
+ * ```typescript
67
+ * import { Definition, Identifier, withDescription } from '@skmtc/core';
68
+ *
69
+ * class DocumentedGenerator {
70
+ * createDefinition(name: string, value: string, docs?: string) {
71
+ * return new Definition({
72
+ * context: this.context,
73
+ * identifier: Identifier.createVariable(name),
74
+ * description: docs, // This gets processed by withDescription internally
75
+ * value: {
76
+ * generatorKey: 'documented',
77
+ * content: value
78
+ * }
79
+ * });
80
+ * }
81
+ * }
82
+ * ```
83
+ *
84
+ * @example Complex documentation
85
+ * ```typescript
86
+ * const complexDoc = withDescription(
87
+ * `export type Status = 'active' | 'inactive' | 'pending';`,
88
+ * {
89
+ * description: 'User account status - active users can access all features'
90
+ * }
91
+ * );
92
+ *
93
+ * console.log(complexDoc);
94
+ * // /** User account status - active users can access all features *\/
95
+ * // export type Status = 'active' | 'inactive' | 'pending';
96
+ * ```
97
+ *
98
+ * @example Conditional documentation
99
+ * ```typescript
100
+ * function generateWithOptionalDocs(
101
+ * code: string,
102
+ * includeDescription: boolean
103
+ * ) {
104
+ * return withDescription(code, {
105
+ * description: includeDescription
106
+ * ? 'This is an auto-generated definition'
107
+ * : undefined
108
+ * });
109
+ * }
110
+ *
111
+ * const withDocs = generateWithOptionalDocs('export const VALUE = 42;', true);
112
+ * const withoutDocs = generateWithOptionalDocs('export const VALUE = 42;', false);
113
+ *
114
+ * console.log(withDocs);
115
+ * // /** This is an auto-generated definition *\/
116
+ * // export const VALUE = 42;
117
+ *
118
+ * console.log(withoutDocs);
119
+ * // export const VALUE = 42;
120
+ * ```
121
+ */
3
122
  export declare const withDescription: (value: Stringable, { description }: Modifiers) => string;
4
123
  //# sourceMappingURL=withDescription.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withDescription.d.ts","sourceRoot":"","sources":["../../src/typescript/withDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,eAAO,MAAM,eAAe,GAC1B,OAAO,UAAU,EACjB,iBAAiB,SAAS,KACzB,MAEF,CAAA"}
1
+ {"version":3,"file":"withDescription.d.ts","sourceRoot":"","sources":["../../src/typescript/withDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsHG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,UAAU,EACjB,iBAAiB,SAAS,KACzB,MAEF,CAAA"}
@@ -1,6 +1,125 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withDescription = void 0;
4
+ /**
5
+ * Wraps a value with a JSDoc comment if a description is provided.
6
+ *
7
+ * This utility function is used throughout the SKMTC code generation system to
8
+ * add JSDoc documentation comments to generated TypeScript code. If a description
9
+ * is provided, it formats it as a single-line JSDoc comment above the value.
10
+ * If no description is provided, the value is returned unchanged.
11
+ *
12
+ * @param value - The code value to potentially wrap with documentation
13
+ * @param modifiers - Modifiers object containing optional description
14
+ * @param modifiers.description - Optional description text for the JSDoc comment
15
+ * @returns The value with JSDoc comment prepended if description exists, otherwise just the value
16
+ *
17
+ * @example With description
18
+ * ```typescript
19
+ * import { withDescription } from '@skmtc/core';
20
+ *
21
+ * const result = withDescription(
22
+ * 'export const API_URL = "https://api.example.com";',
23
+ * { description: 'Base URL for all API requests' }
24
+ * );
25
+ *
26
+ * console.log(result);
27
+ * // /** Base URL for all API requests *\/
28
+ * // export const API_URL = "https://api.example.com";
29
+ * ```
30
+ *
31
+ * @example Without description
32
+ * ```typescript
33
+ * const result = withDescription(
34
+ * 'export const API_URL = "https://api.example.com";',
35
+ * { description: undefined }
36
+ * );
37
+ *
38
+ * console.log(result);
39
+ * // export const API_URL = "https://api.example.com";
40
+ * ```
41
+ *
42
+ * @example Using with Definition class
43
+ * ```typescript
44
+ * class ModelGenerator {
45
+ * generateInterface(name: string, description?: string) {
46
+ * const interfaceCode = `interface ${name} {
47
+ * id: string;
48
+ * name: string;
49
+ * }`;
50
+ *
51
+ * return withDescription(interfaceCode, { description });
52
+ * }
53
+ * }
54
+ *
55
+ * const generator = new ModelGenerator();
56
+ * const documented = generator.generateInterface('User', 'Represents a user in the system');
57
+ *
58
+ * console.log(documented);
59
+ * // /** Represents a user in the system *\/
60
+ * // interface User {
61
+ * // id: string;
62
+ * // name: string;
63
+ * // }
64
+ * ```
65
+ *
66
+ * @example Integration with generated definitions
67
+ * ```typescript
68
+ * import { Definition, Identifier, withDescription } from '@skmtc/core';
69
+ *
70
+ * class DocumentedGenerator {
71
+ * createDefinition(name: string, value: string, docs?: string) {
72
+ * return new Definition({
73
+ * context: this.context,
74
+ * identifier: Identifier.createVariable(name),
75
+ * description: docs, // This gets processed by withDescription internally
76
+ * value: {
77
+ * generatorKey: 'documented',
78
+ * content: value
79
+ * }
80
+ * });
81
+ * }
82
+ * }
83
+ * ```
84
+ *
85
+ * @example Complex documentation
86
+ * ```typescript
87
+ * const complexDoc = withDescription(
88
+ * `export type Status = 'active' | 'inactive' | 'pending';`,
89
+ * {
90
+ * description: 'User account status - active users can access all features'
91
+ * }
92
+ * );
93
+ *
94
+ * console.log(complexDoc);
95
+ * // /** User account status - active users can access all features *\/
96
+ * // export type Status = 'active' | 'inactive' | 'pending';
97
+ * ```
98
+ *
99
+ * @example Conditional documentation
100
+ * ```typescript
101
+ * function generateWithOptionalDocs(
102
+ * code: string,
103
+ * includeDescription: boolean
104
+ * ) {
105
+ * return withDescription(code, {
106
+ * description: includeDescription
107
+ * ? 'This is an auto-generated definition'
108
+ * : undefined
109
+ * });
110
+ * }
111
+ *
112
+ * const withDocs = generateWithOptionalDocs('export const VALUE = 42;', true);
113
+ * const withoutDocs = generateWithOptionalDocs('export const VALUE = 42;', false);
114
+ *
115
+ * console.log(withDocs);
116
+ * // /** This is an auto-generated definition *\/
117
+ * // export const VALUE = 42;
118
+ *
119
+ * console.log(withoutDocs);
120
+ * // export const VALUE = 42;
121
+ * ```
122
+ */
4
123
  const withDescription = (value, { description }) => {
5
124
  return description ? `/** ${description} */\n${value}` : `${value}`;
6
125
  };