@apso/cli 0.5.0 → 0.7.0

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 (69) hide show
  1. package/README.md +510 -1
  2. package/dist/commands/server/new.js +1 -1
  3. package/dist/commands/server/scaffold.js +19 -10
  4. package/dist/lib/apsorc-parser.d.ts +3 -0
  5. package/dist/lib/apsorc-parser.js +11 -6
  6. package/dist/lib/controller.js +3 -1
  7. package/dist/lib/dto.js +9 -9
  8. package/dist/lib/entity.js +6 -5
  9. package/dist/lib/guards.d.ts +4 -3
  10. package/dist/lib/guards.js +64 -25
  11. package/dist/lib/module.js +3 -1
  12. package/dist/lib/templates/guards/auth.guard.eta +228 -0
  13. package/dist/lib/templates/guards/guards.module.eta +73 -13
  14. package/dist/lib/templates/guards/index.eta +18 -0
  15. package/dist/lib/templates/guards/scope.guard.eta +12 -4
  16. package/dist/lib/types/auth.d.ts +203 -0
  17. package/dist/lib/types/auth.js +60 -0
  18. package/dist/lib/types/entity.d.ts +2 -2
  19. package/dist/lib/types/index.d.ts +1 -0
  20. package/dist/lib/types/index.js +8 -0
  21. package/dist/lib/types/relationship.d.ts +1 -1
  22. package/dist/lib/utils/casing.js +5 -5
  23. package/dist/lib/utils/field.js +2 -1
  24. package/dist/lib/utils/file-system.js +1 -1
  25. package/dist/lib/utils/relationships/parse-v1.js +2 -1
  26. package/dist/lib/utils/relationships/parse.js +117 -32
  27. package/dist/lib/utils/relationships/parse.spec.js +168 -141
  28. package/dist/test-nested-relationships.js +10 -10
  29. package/dist/tests/templates/entities/types/array-template.spec.js +45 -45
  30. package/dist/tests/templates/entities/types/bigint-template.spec.js +43 -43
  31. package/dist/tests/templates/entities/types/boolean-template.spec.js +44 -44
  32. package/dist/tests/templates/entities/types/bytea-template.spec.js +35 -35
  33. package/dist/tests/templates/entities/types/char-template.spec.js +35 -35
  34. package/dist/tests/templates/entities/types/date-template.spec.js +29 -29
  35. package/dist/tests/templates/entities/types/decimal-field-validation.spec.js +46 -46
  36. package/dist/tests/templates/entities/types/decimal-template.spec.js +46 -46
  37. package/dist/tests/templates/entities/types/double-template.spec.js +37 -34
  38. package/dist/tests/templates/entities/types/enum-template.spec.js +42 -42
  39. package/dist/tests/templates/entities/types/float-template.spec.js +37 -34
  40. package/dist/tests/templates/entities/types/geometry-template.spec.js +31 -31
  41. package/dist/tests/templates/entities/types/inet-template.spec.js +36 -36
  42. package/dist/tests/templates/entities/types/int4range-template.spec.js +45 -33
  43. package/dist/tests/templates/entities/types/integer-template.spec.js +40 -40
  44. package/dist/tests/templates/entities/types/interval-template.spec.js +35 -35
  45. package/dist/tests/templates/entities/types/json-plain-template.spec.js +27 -27
  46. package/dist/tests/templates/entities/types/json-template.spec.js +19 -19
  47. package/dist/tests/templates/entities/types/jsonb-template.spec.js +19 -19
  48. package/dist/tests/templates/entities/types/money-template.spec.js +35 -35
  49. package/dist/tests/templates/entities/types/numeric-template.spec.js +44 -44
  50. package/dist/tests/templates/entities/types/point-template.spec.js +37 -31
  51. package/dist/tests/templates/entities/types/polygon-template.spec.js +43 -31
  52. package/dist/tests/templates/entities/types/real-template.spec.js +34 -34
  53. package/dist/tests/templates/entities/types/serial-template.spec.js +62 -62
  54. package/dist/tests/templates/entities/types/smallint-template.spec.js +43 -43
  55. package/dist/tests/templates/entities/types/string-template.spec.js +59 -59
  56. package/dist/tests/templates/entities/types/text-template.spec.js +37 -37
  57. package/dist/tests/templates/entities/types/time-template.spec.js +35 -35
  58. package/dist/tests/templates/entities/types/timestamp-template.spec.js +39 -39
  59. package/dist/tests/templates/entities/types/timetz-template.spec.js +35 -35
  60. package/dist/tests/templates/entities/types/tsvector-template.spec.js +28 -28
  61. package/dist/tests/templates/entities/types/uuid-template.spec.js +43 -43
  62. package/dist/tests/templates/entities/types/varchar-template.spec.js +59 -56
  63. package/dist/tests/templates/entities/types/xml-template.spec.js +28 -28
  64. package/dist/tests/templates/entities/utils/template-test-utils.d.ts +1 -1
  65. package/dist/tests/templates/entities/utils/template-test-utils.js +3 -3
  66. package/dist/tests/templates/entities/uuid-entity-template.spec.js +138 -138
  67. package/dist/tests/utils/relationship-deduplication.spec.js +11 -11
  68. package/oclif.manifest.json +1 -1
  69. package/package.json +1 -1
@@ -2,66 +2,69 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const template_test_utils_1 = require("../utils/template-test-utils");
4
4
  const globals_1 = require("@jest/globals");
5
- (0, globals_1.describe)('Float Entity Template Tests', () => {
5
+ (0, globals_1.describe)("Float Entity Template Tests", () => {
6
6
  // Setup Eta configuration once before all tests
7
7
  (0, globals_1.beforeAll)(() => {
8
8
  (0, template_test_utils_1.configureEta)();
9
9
  });
10
- const templatePath = './entities/entity-col-float';
10
+ const templatePath = "./entities/entity-col-float";
11
11
  const testCases = [
12
12
  {
13
- name: 'should render basic float field correctly',
13
+ name: "should render basic float field correctly",
14
14
  field: {
15
- name: 'floatValue',
16
- dataType: 'number',
17
- nullable: false
15
+ name: "floatValue",
16
+ dataType: "number",
17
+ nullable: false,
18
18
  },
19
19
  assertions: [
20
- { type: 'contains', text: '@Column({ "type": "decimal"' },
21
- { type: 'contains', text: 'floatValue: number;' },
22
- { type: 'notContains', text: '@Index()' },
23
- { type: 'notContains', text: '@PrimaryColumn()' }
24
- ]
20
+ { type: "contains", text: '@Column({ "type": "decimal"' },
21
+ { type: "contains", text: "floatValue: number;" },
22
+ { type: "notContains", text: "@Index()" },
23
+ { type: "notContains", text: "@PrimaryColumn()" },
24
+ ],
25
25
  },
26
26
  {
27
- name: 'should render nullable float field correctly',
27
+ name: "should render nullable float field correctly",
28
28
  field: {
29
- name: 'optionalFloat',
30
- dataType: 'number',
31
- nullable: true
29
+ name: "optionalFloat",
30
+ dataType: "number",
31
+ nullable: true,
32
32
  },
33
33
  assertions: [
34
- { type: 'contains', text: '@Column({ "type": "decimal"' },
35
- { type: 'contains', text: 'optionalFloat: number;' }
36
- ]
34
+ { type: "contains", text: '@Column({ "type": "decimal"' },
35
+ { type: "contains", text: "optionalFloat: number;" },
36
+ ],
37
37
  },
38
38
  {
39
- name: 'should render float field with default value correctly',
39
+ name: "should render float field with default value correctly",
40
40
  field: {
41
- name: 'defaultFloat',
42
- dataType: 'number',
41
+ name: "defaultFloat",
42
+ dataType: "number",
43
43
  nullable: false,
44
- default: 0
44
+ default: 0,
45
45
  },
46
46
  assertions: [
47
- { type: 'contains', text: '@Column({ "type": "decimal", default: 0 })' },
48
- { type: 'contains', text: 'defaultFloat: number;' }
49
- ]
47
+ {
48
+ type: "contains",
49
+ text: '@Column({ "type": "decimal", default: 0 })',
50
+ },
51
+ { type: "contains", text: "defaultFloat: number;" },
52
+ ],
50
53
  },
51
54
  {
52
- name: 'should render indexed float field correctly',
55
+ name: "should render indexed float field correctly",
53
56
  field: {
54
- name: 'indexedFloat',
55
- dataType: 'number',
57
+ name: "indexedFloat",
58
+ dataType: "number",
56
59
  nullable: false,
57
- index: true
60
+ index: true,
58
61
  },
59
62
  assertions: [
60
- { type: 'contains', text: '@Column({ "type": "decimal"' },
61
- { type: 'contains', text: '@Index()' },
62
- { type: 'contains', text: 'indexedFloat: number;' }
63
- ]
64
- }
63
+ { type: "contains", text: '@Column({ "type": "decimal"' },
64
+ { type: "contains", text: "@Index()" },
65
+ { type: "contains", text: "indexedFloat: number;" },
66
+ ],
67
+ },
65
68
  ];
66
69
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
67
70
  });
@@ -2,57 +2,57 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const template_test_utils_1 = require("../utils/template-test-utils");
4
4
  const globals_1 = require("@jest/globals");
5
- (0, globals_1.describe)('Geometry Entity Template Tests', () => {
5
+ (0, globals_1.describe)("Geometry Entity Template Tests", () => {
6
6
  // Setup Eta configuration once before all tests
7
7
  (0, globals_1.beforeAll)(() => {
8
8
  (0, template_test_utils_1.configureEta)();
9
9
  });
10
- const templatePath = './entities/entity-col-geometry';
10
+ const templatePath = "./entities/entity-col-geometry";
11
11
  const testCases = [
12
12
  {
13
- name: 'should render basic geometry field correctly',
13
+ name: "should render basic geometry field correctly",
14
14
  field: {
15
- name: 'shape',
16
- dataType: 'any',
17
- nullable: false
15
+ name: "shape",
16
+ dataType: "any",
17
+ nullable: false,
18
18
  },
19
19
  assertions: [
20
- { type: 'contains', text: '@Column({' },
21
- { type: 'contains', text: '"type": "geometry"' },
22
- { type: 'contains', text: 'transformer: {' },
23
- { type: 'contains', text: 'to: (geometry: any) => {' },
24
- { type: 'contains', text: 'from: (pgGeometry: any) => {' },
25
- { type: 'contains', text: 'shape: any;' },
26
- { type: 'notContains', text: 'nullable: true' }
27
- ]
20
+ { type: "contains", text: "@Column({" },
21
+ { type: "contains", text: '"type": "geometry"' },
22
+ { type: "contains", text: "transformer: {" },
23
+ { type: "contains", text: "to: (geometry: any) => {" },
24
+ { type: "contains", text: "from: (pgGeometry: any) => {" },
25
+ { type: "contains", text: "shape: any;" },
26
+ { type: "notContains", text: "nullable: true" },
27
+ ],
28
28
  },
29
29
  {
30
- name: 'should render nullable geometry field correctly',
30
+ name: "should render nullable geometry field correctly",
31
31
  field: {
32
- name: 'optionalShape',
33
- dataType: 'any',
34
- nullable: true
32
+ name: "optionalShape",
33
+ dataType: "any",
34
+ nullable: true,
35
35
  },
36
36
  assertions: [
37
- { type: 'contains', text: '@Column({' },
38
- { type: 'contains', text: '"type": "geometry"' },
39
- { type: 'contains', text: 'nullable: true' },
40
- { type: 'contains', text: 'optionalShape: any;' }
41
- ]
37
+ { type: "contains", text: "@Column({" },
38
+ { type: "contains", text: '"type": "geometry"' },
39
+ { type: "contains", text: "nullable: true" },
40
+ { type: "contains", text: "optionalShape: any;" },
41
+ ],
42
42
  },
43
43
  {
44
- name: 'should render indexed geometry field correctly',
44
+ name: "should render indexed geometry field correctly",
45
45
  field: {
46
- name: 'spatialData',
47
- dataType: 'any',
46
+ name: "spatialData",
47
+ dataType: "any",
48
48
  nullable: false,
49
- index: true
49
+ index: true,
50
50
  },
51
51
  assertions: [
52
- { type: 'contains', text: '@Index()' },
53
- { type: 'contains', text: 'spatialData: any;' }
54
- ]
55
- }
52
+ { type: "contains", text: "@Index()" },
53
+ { type: "contains", text: "spatialData: any;" },
54
+ ],
55
+ },
56
56
  ];
57
57
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
58
58
  });
@@ -2,68 +2,68 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const template_test_utils_1 = require("../utils/template-test-utils");
4
4
  const globals_1 = require("@jest/globals");
5
- (0, globals_1.describe)('Inet Entity Template Tests', () => {
5
+ (0, globals_1.describe)("Inet Entity Template Tests", () => {
6
6
  // Setup Eta configuration once before all tests
7
7
  (0, globals_1.beforeAll)(() => {
8
8
  (0, template_test_utils_1.configureEta)();
9
9
  });
10
- const templatePath = './entities/entity-col-inet';
10
+ const templatePath = "./entities/entity-col-inet";
11
11
  const testCases = [
12
12
  {
13
- name: 'should render basic inet field correctly',
13
+ name: "should render basic inet field correctly",
14
14
  field: {
15
- name: 'ipAddress',
16
- dataType: 'string',
17
- nullable: false
15
+ name: "ipAddress",
16
+ dataType: "string",
17
+ nullable: false,
18
18
  },
19
19
  assertions: [
20
- { type: 'contains', text: '@Column({ "type": "inet"' },
21
- { type: 'contains', text: 'ipAddress: string;' },
22
- { type: 'notContains', text: '@Index()' },
23
- { type: 'notContains', text: '@PrimaryColumn()' }
24
- ]
20
+ { type: "contains", text: '@Column({ "type": "inet"' },
21
+ { type: "contains", text: "ipAddress: string;" },
22
+ { type: "notContains", text: "@Index()" },
23
+ { type: "notContains", text: "@PrimaryColumn()" },
24
+ ],
25
25
  },
26
26
  {
27
- name: 'should render nullable inet field correctly',
27
+ name: "should render nullable inet field correctly",
28
28
  field: {
29
- name: 'optionalIp',
30
- dataType: 'string',
31
- nullable: true
29
+ name: "optionalIp",
30
+ dataType: "string",
31
+ nullable: true,
32
32
  },
33
33
  assertions: [
34
- { type: 'contains', text: '@Column({ "type": "inet"' },
35
- { type: 'contains', text: 'nullable: true' },
36
- { type: 'contains', text: 'optionalIp: string;' }
37
- ]
34
+ { type: "contains", text: '@Column({ "type": "inet"' },
35
+ { type: "contains", text: "nullable: true" },
36
+ { type: "contains", text: "optionalIp: string;" },
37
+ ],
38
38
  },
39
39
  {
40
- name: 'should render inet field with default value correctly',
40
+ name: "should render inet field with default value correctly",
41
41
  field: {
42
- name: 'defaultIp',
43
- dataType: 'string',
42
+ name: "defaultIp",
43
+ dataType: "string",
44
44
  nullable: false,
45
- default: '127.0.0.1'
45
+ default: "127.0.0.1",
46
46
  },
47
47
  assertions: [
48
- { type: 'contains', text: '@Column({ "type": "inet"' },
49
- { type: 'contains', text: 'default: 127.0.0.1' },
50
- { type: 'contains', text: 'defaultIp: string;' }
51
- ]
48
+ { type: "contains", text: '@Column({ "type": "inet"' },
49
+ { type: "contains", text: "default: 127.0.0.1" },
50
+ { type: "contains", text: "defaultIp: string;" },
51
+ ],
52
52
  },
53
53
  {
54
- name: 'should render indexed inet field correctly',
54
+ name: "should render indexed inet field correctly",
55
55
  field: {
56
- name: 'indexedIp',
57
- dataType: 'string',
56
+ name: "indexedIp",
57
+ dataType: "string",
58
58
  nullable: false,
59
- index: true
59
+ index: true,
60
60
  },
61
61
  assertions: [
62
- { type: 'contains', text: '@Column({ "type": "inet"' },
63
- { type: 'contains', text: '@Index()' },
64
- { type: 'contains', text: 'indexedIp: string;' }
65
- ]
66
- }
62
+ { type: "contains", text: '@Column({ "type": "inet"' },
63
+ { type: "contains", text: "@Index()" },
64
+ { type: "contains", text: "indexedIp: string;" },
65
+ ],
66
+ },
67
67
  ];
68
68
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
69
69
  });
@@ -2,59 +2,71 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const template_test_utils_1 = require("../utils/template-test-utils");
4
4
  const globals_1 = require("@jest/globals");
5
- (0, globals_1.describe)('Int4Range Entity Template Tests', () => {
5
+ (0, globals_1.describe)("Int4Range Entity Template Tests", () => {
6
6
  // Setup Eta configuration once before all tests
7
7
  (0, globals_1.beforeAll)(() => {
8
8
  (0, template_test_utils_1.configureEta)();
9
9
  });
10
- const templatePath = './entities/entity-col-int4range';
10
+ const templatePath = "./entities/entity-col-int4range";
11
11
  const testCases = [
12
12
  {
13
- name: 'should render basic int4range field correctly',
13
+ name: "should render basic int4range field correctly",
14
14
  field: {
15
- name: 'ageRange',
16
- dataType: '{lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean}',
17
- nullable: false
15
+ name: "ageRange",
16
+ dataType: "{lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean}",
17
+ nullable: false,
18
18
  },
19
19
  assertions: [
20
- { type: 'contains', text: '@Column({' },
21
- { type: 'contains', text: '"type": "int4range"' },
22
- { type: 'contains', text: 'transformer: {' },
23
- { type: 'contains', text: 'to: (range: {lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean}' },
24
- { type: 'contains', text: 'from: (pgRange: string | null)' },
25
- { type: 'contains', text: 'const lowerInclusive = pgRange.startsWith' },
26
- { type: 'contains', text: 'const upperInclusive = pgRange.endsWith' },
27
- { type: 'contains', text: 'ageRange: {lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean};' },
28
- { type: 'notContains', text: 'nullable: true' }
29
- ]
20
+ { type: "contains", text: "@Column({" },
21
+ { type: "contains", text: '"type": "int4range"' },
22
+ { type: "contains", text: "transformer: {" },
23
+ {
24
+ type: "contains",
25
+ text: "to: (range: {lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean}",
26
+ },
27
+ { type: "contains", text: "from: (pgRange: string | null)" },
28
+ { type: "contains", text: "const lowerInclusive = pgRange.startsWith" },
29
+ { type: "contains", text: "const upperInclusive = pgRange.endsWith" },
30
+ {
31
+ type: "contains",
32
+ text: "ageRange: {lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean};",
33
+ },
34
+ { type: "notContains", text: "nullable: true" },
35
+ ],
30
36
  },
31
37
  {
32
- name: 'should render nullable int4range field correctly',
38
+ name: "should render nullable int4range field correctly",
33
39
  field: {
34
- name: 'optionalRange',
35
- dataType: '{lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean}',
36
- nullable: true
40
+ name: "optionalRange",
41
+ dataType: "{lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean}",
42
+ nullable: true,
37
43
  },
38
44
  assertions: [
39
- { type: 'contains', text: '@Column({' },
40
- { type: 'contains', text: '"type": "int4range"' },
41
- { type: 'contains', text: 'nullable: true' },
42
- { type: 'contains', text: 'optionalRange: {lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean};' }
43
- ]
45
+ { type: "contains", text: "@Column({" },
46
+ { type: "contains", text: '"type": "int4range"' },
47
+ { type: "contains", text: "nullable: true" },
48
+ {
49
+ type: "contains",
50
+ text: "optionalRange: {lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean};",
51
+ },
52
+ ],
44
53
  },
45
54
  {
46
- name: 'should render indexed int4range field correctly',
55
+ name: "should render indexed int4range field correctly",
47
56
  field: {
48
- name: 'valueRange',
49
- dataType: '{lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean}',
57
+ name: "valueRange",
58
+ dataType: "{lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean}",
50
59
  nullable: false,
51
- index: true
60
+ index: true,
52
61
  },
53
62
  assertions: [
54
- { type: 'contains', text: '@Index()' },
55
- { type: 'contains', text: 'valueRange: {lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean};' }
56
- ]
57
- }
63
+ { type: "contains", text: "@Index()" },
64
+ {
65
+ type: "contains",
66
+ text: "valueRange: {lower: number, upper: number, lowerInclusive: boolean, upperInclusive: boolean};",
67
+ },
68
+ ],
69
+ },
58
70
  ];
59
71
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
60
72
  });
@@ -2,78 +2,78 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const template_test_utils_1 = require("../utils/template-test-utils");
4
4
  const globals_1 = require("@jest/globals");
5
- (0, globals_1.describe)('Integer Entity Template Tests', () => {
5
+ (0, globals_1.describe)("Integer Entity Template Tests", () => {
6
6
  // Setup Eta configuration once before all tests
7
7
  (0, globals_1.beforeAll)(() => {
8
8
  (0, template_test_utils_1.configureEta)();
9
9
  });
10
- const templatePath = './entities/entity-col-integer';
10
+ const templatePath = "./entities/entity-col-integer";
11
11
  const testCases = [
12
12
  {
13
- name: 'should render basic integer field correctly',
13
+ name: "should render basic integer field correctly",
14
14
  field: {
15
- name: 'count',
16
- dataType: 'number',
17
- nullable: false
15
+ name: "count",
16
+ dataType: "number",
17
+ nullable: false,
18
18
  },
19
19
  assertions: [
20
- { type: 'contains', text: '@Column({ "type": "int"' },
21
- { type: 'contains', text: 'count: number;' },
22
- { type: 'notContains', text: '@Index()' },
23
- { type: 'notContains', text: '@PrimaryColumn()' },
24
- ]
20
+ { type: "contains", text: '@Column({ "type": "int"' },
21
+ { type: "contains", text: "count: number;" },
22
+ { type: "notContains", text: "@Index()" },
23
+ { type: "notContains", text: "@PrimaryColumn()" },
24
+ ],
25
25
  },
26
26
  {
27
- name: 'should render nullable integer field correctly',
27
+ name: "should render nullable integer field correctly",
28
28
  field: {
29
- name: 'optionalCount',
30
- dataType: 'number',
31
- nullable: true
29
+ name: "optionalCount",
30
+ dataType: "number",
31
+ nullable: true,
32
32
  },
33
33
  assertions: [
34
- { type: 'contains', text: '@Column({ "type": "int"' },
35
- { type: 'contains', text: 'optionalCount: number;' }
36
- ]
34
+ { type: "contains", text: '@Column({ "type": "int"' },
35
+ { type: "contains", text: "optionalCount: number;" },
36
+ ],
37
37
  },
38
38
  {
39
- name: 'should render integer field with default value correctly',
39
+ name: "should render integer field with default value correctly",
40
40
  field: {
41
- name: 'quantity',
42
- dataType: 'number',
41
+ name: "quantity",
42
+ dataType: "number",
43
43
  nullable: false,
44
- default: 0
44
+ default: 0,
45
45
  },
46
46
  assertions: [
47
- { type: 'contains', text: 'default: 0' },
48
- { type: 'contains', text: 'quantity: number;' }
49
- ]
47
+ { type: "contains", text: "default: 0" },
48
+ { type: "contains", text: "quantity: number;" },
49
+ ],
50
50
  },
51
51
  {
52
- name: 'should render indexed integer field correctly',
52
+ name: "should render indexed integer field correctly",
53
53
  field: {
54
- name: 'userId',
55
- dataType: 'number',
54
+ name: "userId",
55
+ dataType: "number",
56
56
  nullable: false,
57
- index: true
57
+ index: true,
58
58
  },
59
59
  assertions: [
60
- { type: 'contains', text: '@Index()' },
61
- { type: 'contains', text: 'userId: number;' }
62
- ]
60
+ { type: "contains", text: "@Index()" },
61
+ { type: "contains", text: "userId: number;" },
62
+ ],
63
63
  },
64
64
  {
65
- name: 'should render primary key integer field correctly',
65
+ name: "should render primary key integer field correctly",
66
66
  field: {
67
- name: 'id',
68
- dataType: 'number',
67
+ name: "id",
68
+ dataType: "number",
69
69
  nullable: false,
70
- primary: true
70
+ primary: true,
71
71
  },
72
72
  assertions: [
73
- { type: 'contains', text: '@PrimaryColumn()' },
74
- { type: 'contains', text: 'id: number;' }
75
- ]
76
- }
73
+ { type: "contains", text: "@PrimaryColumn()" },
74
+ { type: "contains", text: "id: number;" },
75
+ ],
76
+ },
77
77
  ];
78
78
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
79
79
  });