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.
@@ -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) return {
367
- type: "array",
368
- value: []
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",
@@ -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
- return { type: "array", value: [] };
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
  }
package/package.json CHANGED
@@ -34,7 +34,7 @@
34
34
  "require": "./integrations/*.cjs"
35
35
  }
36
36
  },
37
- "version": "0.1.48",
37
+ "version": "0.1.49",
38
38
  "description": "Say goodbye to boilerplate code and hello to efficient and elegant syntax.",
39
39
  "keywords": [],
40
40
  "author": "",