rads-db 3.0.73 → 3.0.74
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.
- package/integrations/lib.cjs +9 -3
- package/integrations/lib.mjs +9 -3
- package/package.json +1 -1
package/integrations/lib.cjs
CHANGED
|
@@ -165,7 +165,7 @@ function parseClassDeclaration(typeDeclaration, typeName, ctx) {
|
|
|
165
165
|
const nameNode = typeDeclaration.name;
|
|
166
166
|
if (!nameNode || nameNode.kind !== _typescript.SyntaxKind.Identifier) throw new Error("Cannot detect class name");
|
|
167
167
|
const name = nameNode.text;
|
|
168
|
-
const comment = typeDeclaration.jsDoc
|
|
168
|
+
const comment = getCommentFromJsdocNode(typeDeclaration.jsDoc);
|
|
169
169
|
const decorators = parseDecorators(modifiers, ctx);
|
|
170
170
|
const classDeclaration = typeDeclaration;
|
|
171
171
|
const {
|
|
@@ -202,7 +202,7 @@ function parseTypeAliasDeclaration(typeDeclaration, typeName, ctx) {
|
|
|
202
202
|
const nameNode = typeDeclaration.name;
|
|
203
203
|
if (!nameNode || nameNode.kind !== _typescript.SyntaxKind.Identifier) throw new Error("Cannot detect class name");
|
|
204
204
|
const name = nameNode.text;
|
|
205
|
-
const comment = typeDeclaration.jsDoc
|
|
205
|
+
const comment = getCommentFromJsdocNode(typeDeclaration.jsDoc);
|
|
206
206
|
const typeAliasDeclaration = typeDeclaration;
|
|
207
207
|
const typeAliasType = typeAliasDeclaration.type;
|
|
208
208
|
if (typeAliasType.kind === _typescript.SyntaxKind.UnionType) {
|
|
@@ -259,7 +259,7 @@ function parseClassMember(node, parentFields, parentName, ctx) {
|
|
|
259
259
|
defaultValueClass
|
|
260
260
|
} = parseDefaultValueExpression(node.initializer, ctx);
|
|
261
261
|
const isRequired = !node.questionToken;
|
|
262
|
-
const comment = node.jsDoc
|
|
262
|
+
const comment = getCommentFromJsdocNode(node.jsDoc);
|
|
263
263
|
const decorators = parseDecorators(node.modifiers, ctx);
|
|
264
264
|
let defaultValueType = defaultValueClass || getPrimitiveTypeFromDefaultValue(defaultValue);
|
|
265
265
|
if (defaultValueCopyFrom) {
|
|
@@ -280,6 +280,12 @@ function parseClassMember(node, parentFields, parentName, ctx) {
|
|
|
280
280
|
if (defaultValueClass) result.defaultValueClass = defaultValueClass;
|
|
281
281
|
return result;
|
|
282
282
|
}
|
|
283
|
+
function getCommentFromJsdocNode(jsDoc) {
|
|
284
|
+
const comment = jsDoc?.[0]?.comment;
|
|
285
|
+
const tags = jsDoc?.[0]?.tags;
|
|
286
|
+
const tagsStr = tags?.map(tag => [`@${tag.tagName.text}`, tag.comment || ""].filter(x => x).join(" "))?.join("\n") || "";
|
|
287
|
+
return [comment, tagsStr].filter(x => x).join("\n") || void 0;
|
|
288
|
+
}
|
|
283
289
|
function getPrimitiveTypeFromDefaultValue(value) {
|
|
284
290
|
if (_lodash.default.isString(value)) return "string";
|
|
285
291
|
if (_lodash.default.isNumber(value)) return "number";
|
package/integrations/lib.mjs
CHANGED
|
@@ -145,7 +145,7 @@ function parseClassDeclaration(typeDeclaration, typeName, ctx) {
|
|
|
145
145
|
if (!nameNode || nameNode.kind !== SyntaxKind.Identifier)
|
|
146
146
|
throw new Error("Cannot detect class name");
|
|
147
147
|
const name = nameNode.text;
|
|
148
|
-
const comment = typeDeclaration.jsDoc
|
|
148
|
+
const comment = getCommentFromJsdocNode(typeDeclaration.jsDoc);
|
|
149
149
|
const decorators = parseDecorators(modifiers, ctx);
|
|
150
150
|
const classDeclaration = typeDeclaration;
|
|
151
151
|
const { members, heritageClauses } = classDeclaration;
|
|
@@ -181,7 +181,7 @@ function parseTypeAliasDeclaration(typeDeclaration, typeName, ctx) {
|
|
|
181
181
|
if (!nameNode || nameNode.kind !== SyntaxKind.Identifier)
|
|
182
182
|
throw new Error("Cannot detect class name");
|
|
183
183
|
const name = nameNode.text;
|
|
184
|
-
const comment = typeDeclaration.jsDoc
|
|
184
|
+
const comment = getCommentFromJsdocNode(typeDeclaration.jsDoc);
|
|
185
185
|
const typeAliasDeclaration = typeDeclaration;
|
|
186
186
|
const typeAliasType = typeAliasDeclaration.type;
|
|
187
187
|
if (typeAliasType.kind === SyntaxKind.UnionType) {
|
|
@@ -222,7 +222,7 @@ function parseClassMember(node, parentFields, parentName, ctx) {
|
|
|
222
222
|
const name = node.name.getText(ctx.sourceFile);
|
|
223
223
|
const { defaultValue, defaultValueCopyFrom, defaultValueClass } = parseDefaultValueExpression(node.initializer, ctx);
|
|
224
224
|
const isRequired = !node.questionToken;
|
|
225
|
-
const comment = node.jsDoc
|
|
225
|
+
const comment = getCommentFromJsdocNode(node.jsDoc);
|
|
226
226
|
const decorators = parseDecorators(node.modifiers, ctx);
|
|
227
227
|
let defaultValueType = defaultValueClass || getPrimitiveTypeFromDefaultValue(defaultValue);
|
|
228
228
|
if (defaultValueCopyFrom) {
|
|
@@ -246,6 +246,12 @@ function parseClassMember(node, parentFields, parentName, ctx) {
|
|
|
246
246
|
result.defaultValueClass = defaultValueClass;
|
|
247
247
|
return result;
|
|
248
248
|
}
|
|
249
|
+
function getCommentFromJsdocNode(jsDoc) {
|
|
250
|
+
const comment = jsDoc?.[0]?.comment;
|
|
251
|
+
const tags = jsDoc?.[0]?.tags;
|
|
252
|
+
const tagsStr = tags?.map((tag) => [`@${tag.tagName.text}`, tag.comment || ""].filter((x) => x).join(" "))?.join("\n") || "";
|
|
253
|
+
return [comment, tagsStr].filter((x) => x).join("\n") || void 0;
|
|
254
|
+
}
|
|
249
255
|
function getPrimitiveTypeFromDefaultValue(value) {
|
|
250
256
|
if (_.isString(value))
|
|
251
257
|
return "string";
|