rads-db 0.1.48 → 0.1.49
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 +14 -4
- package/integrations/lib.mjs +12 -2
- package/package.json +1 -1
package/integrations/lib.cjs
CHANGED
|
@@ -363,10 +363,20 @@ function parseLiteralNode(expr, ctx) {
|
|
|
363
363
|
type: "object",
|
|
364
364
|
value: parseObjectLiteral(expr, ctx)
|
|
365
365
|
};
|
|
366
|
-
if (expr.kind === _typescript.SyntaxKind.ArrayLiteralExpression)
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
if (expr.kind === _typescript.SyntaxKind.ArrayLiteralExpression) {
|
|
367
|
+
const defaultValueStr = expr.getText(ctx.sourceFile);
|
|
368
|
+
let defaultValue;
|
|
369
|
+
try {
|
|
370
|
+
defaultValue = JSON.parse(defaultValueStr.replace(/[\'\`]/gi, '"'));
|
|
371
|
+
} catch (e) {
|
|
372
|
+
throw new Error("Value must be valid array");
|
|
373
|
+
}
|
|
374
|
+
if (!_lodash.default.isArray(defaultValue)) throw new Error("Value must be valid array");
|
|
375
|
+
return {
|
|
376
|
+
type: "array",
|
|
377
|
+
value: defaultValue
|
|
378
|
+
};
|
|
379
|
+
}
|
|
370
380
|
if (expr.kind === _typescript.SyntaxKind.PropertyAccessExpression && expr.expression.kind === _typescript.SyntaxKind.ThisKeyword) {
|
|
371
381
|
return {
|
|
372
382
|
type: "thisReference",
|
package/integrations/lib.mjs
CHANGED
|
@@ -325,8 +325,18 @@ function parseLiteralNode(expr, ctx) {
|
|
|
325
325
|
return { type: "number", value: Number.parseFloat(expr.text) };
|
|
326
326
|
if (expr.kind === SyntaxKind.ObjectLiteralExpression)
|
|
327
327
|
return { type: "object", value: parseObjectLiteral(expr, ctx) };
|
|
328
|
-
if (expr.kind === SyntaxKind.ArrayLiteralExpression)
|
|
329
|
-
|
|
328
|
+
if (expr.kind === SyntaxKind.ArrayLiteralExpression) {
|
|
329
|
+
const defaultValueStr = expr.getText(ctx.sourceFile);
|
|
330
|
+
let defaultValue;
|
|
331
|
+
try {
|
|
332
|
+
defaultValue = JSON.parse(defaultValueStr.replace(/[\'\`]/gi, '"'));
|
|
333
|
+
} catch (e) {
|
|
334
|
+
throw new Error("Value must be valid array");
|
|
335
|
+
}
|
|
336
|
+
if (!_.isArray(defaultValue))
|
|
337
|
+
throw new Error("Value must be valid array");
|
|
338
|
+
return { type: "array", value: defaultValue };
|
|
339
|
+
}
|
|
330
340
|
if (expr.kind === SyntaxKind.PropertyAccessExpression && expr.expression.kind === SyntaxKind.ThisKeyword) {
|
|
331
341
|
return { type: "thisReference", value: expr.name?.text };
|
|
332
342
|
}
|