@apso/cli 0.4.2 → 0.6.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 (71) hide show
  1. package/README.md +796 -6
  2. package/dist/commands/server/new.js +1 -1
  3. package/dist/commands/server/scaffold.js +20 -9
  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 +47 -0
  10. package/dist/lib/guards.js +176 -0
  11. package/dist/lib/index.d.ts +1 -0
  12. package/dist/lib/index.js +5 -1
  13. package/dist/lib/module.js +3 -1
  14. package/dist/lib/templates/guards/auth.guard.eta +228 -0
  15. package/dist/lib/templates/guards/guards.module.eta +114 -0
  16. package/dist/lib/templates/guards/index.eta +22 -0
  17. package/dist/lib/templates/guards/scope.guard.eta +327 -0
  18. package/dist/lib/types/auth.d.ts +203 -0
  19. package/dist/lib/types/auth.js +60 -0
  20. package/dist/lib/types/entity.d.ts +36 -1
  21. package/dist/lib/types/index.d.ts +2 -1
  22. package/dist/lib/types/index.js +8 -0
  23. package/dist/lib/types/relationship.d.ts +1 -1
  24. package/dist/lib/utils/casing.js +5 -5
  25. package/dist/lib/utils/field.js +2 -1
  26. package/dist/lib/utils/file-system.js +1 -1
  27. package/dist/lib/utils/relationships/parse-v1.js +2 -1
  28. package/dist/lib/utils/relationships/parse.js +117 -32
  29. package/dist/lib/utils/relationships/parse.spec.js +168 -141
  30. package/dist/test-nested-relationships.js +10 -10
  31. package/dist/tests/templates/entities/types/array-template.spec.js +45 -45
  32. package/dist/tests/templates/entities/types/bigint-template.spec.js +43 -43
  33. package/dist/tests/templates/entities/types/boolean-template.spec.js +44 -44
  34. package/dist/tests/templates/entities/types/bytea-template.spec.js +35 -35
  35. package/dist/tests/templates/entities/types/char-template.spec.js +35 -35
  36. package/dist/tests/templates/entities/types/date-template.spec.js +29 -29
  37. package/dist/tests/templates/entities/types/decimal-field-validation.spec.js +46 -46
  38. package/dist/tests/templates/entities/types/decimal-template.spec.js +46 -46
  39. package/dist/tests/templates/entities/types/double-template.spec.js +37 -34
  40. package/dist/tests/templates/entities/types/enum-template.spec.js +42 -42
  41. package/dist/tests/templates/entities/types/float-template.spec.js +37 -34
  42. package/dist/tests/templates/entities/types/geometry-template.spec.js +31 -31
  43. package/dist/tests/templates/entities/types/inet-template.spec.js +36 -36
  44. package/dist/tests/templates/entities/types/int4range-template.spec.js +45 -33
  45. package/dist/tests/templates/entities/types/integer-template.spec.js +40 -40
  46. package/dist/tests/templates/entities/types/interval-template.spec.js +35 -35
  47. package/dist/tests/templates/entities/types/json-plain-template.spec.js +27 -27
  48. package/dist/tests/templates/entities/types/json-template.spec.js +19 -19
  49. package/dist/tests/templates/entities/types/jsonb-template.spec.js +19 -19
  50. package/dist/tests/templates/entities/types/money-template.spec.js +35 -35
  51. package/dist/tests/templates/entities/types/numeric-template.spec.js +44 -44
  52. package/dist/tests/templates/entities/types/point-template.spec.js +37 -31
  53. package/dist/tests/templates/entities/types/polygon-template.spec.js +43 -31
  54. package/dist/tests/templates/entities/types/real-template.spec.js +34 -34
  55. package/dist/tests/templates/entities/types/serial-template.spec.js +62 -62
  56. package/dist/tests/templates/entities/types/smallint-template.spec.js +43 -43
  57. package/dist/tests/templates/entities/types/string-template.spec.js +59 -59
  58. package/dist/tests/templates/entities/types/text-template.spec.js +37 -37
  59. package/dist/tests/templates/entities/types/time-template.spec.js +35 -35
  60. package/dist/tests/templates/entities/types/timestamp-template.spec.js +39 -39
  61. package/dist/tests/templates/entities/types/timetz-template.spec.js +35 -35
  62. package/dist/tests/templates/entities/types/tsvector-template.spec.js +28 -28
  63. package/dist/tests/templates/entities/types/uuid-template.spec.js +43 -43
  64. package/dist/tests/templates/entities/types/varchar-template.spec.js +59 -56
  65. package/dist/tests/templates/entities/types/xml-template.spec.js +28 -28
  66. package/dist/tests/templates/entities/utils/template-test-utils.d.ts +1 -1
  67. package/dist/tests/templates/entities/utils/template-test-utils.js +3 -3
  68. package/dist/tests/templates/entities/uuid-entity-template.spec.js +138 -138
  69. package/dist/tests/utils/relationship-deduplication.spec.js +11 -11
  70. package/oclif.manifest.json +1 -1
  71. package/package.json +1 -1
@@ -2,57 +2,63 @@
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)('Point Entity Template Tests', () => {
5
+ (0, globals_1.describe)("Point 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-point';
10
+ const templatePath = "./entities/entity-col-point";
11
11
  const testCases = [
12
12
  {
13
- name: 'should render basic point field correctly',
13
+ name: "should render basic point field correctly",
14
14
  field: {
15
- name: 'location',
16
- dataType: '{ x: number, y: number }',
17
- nullable: false
15
+ name: "location",
16
+ dataType: "{ x: number, y: number }",
17
+ nullable: false,
18
18
  },
19
19
  assertions: [
20
- { type: 'contains', text: '@Column({' },
21
- { type: 'contains', text: '"type": "point"' },
22
- { type: 'contains', text: 'transformer: {' },
23
- { type: 'contains', text: 'to: (point: {x: number, y: number} | null) => {' },
24
- { type: 'contains', text: 'from: (pgPoint: string | null) => {' },
25
- { type: 'contains', text: 'location: { x: number, y: number };' },
26
- { type: 'notContains', text: 'nullable: true' }
27
- ]
20
+ { type: "contains", text: "@Column({" },
21
+ { type: "contains", text: '"type": "point"' },
22
+ { type: "contains", text: "transformer: {" },
23
+ {
24
+ type: "contains",
25
+ text: "to: (point: {x: number, y: number} | null) => {",
26
+ },
27
+ { type: "contains", text: "from: (pgPoint: string | null) => {" },
28
+ { type: "contains", text: "location: { x: number, y: number };" },
29
+ { type: "notContains", text: "nullable: true" },
30
+ ],
28
31
  },
29
32
  {
30
- name: 'should render nullable point field correctly',
33
+ name: "should render nullable point field correctly",
31
34
  field: {
32
- name: 'optionalLocation',
33
- dataType: '{ x: number, y: number }',
34
- nullable: true
35
+ name: "optionalLocation",
36
+ dataType: "{ x: number, y: number }",
37
+ nullable: true,
35
38
  },
36
39
  assertions: [
37
- { type: 'contains', text: '@Column({' },
38
- { type: 'contains', text: '"type": "point"' },
39
- { type: 'contains', text: 'nullable: true' },
40
- { type: 'contains', text: 'optionalLocation: { x: number, y: number };' }
41
- ]
40
+ { type: "contains", text: "@Column({" },
41
+ { type: "contains", text: '"type": "point"' },
42
+ { type: "contains", text: "nullable: true" },
43
+ {
44
+ type: "contains",
45
+ text: "optionalLocation: { x: number, y: number };",
46
+ },
47
+ ],
42
48
  },
43
49
  {
44
- name: 'should render indexed point field correctly',
50
+ name: "should render indexed point field correctly",
45
51
  field: {
46
- name: 'coordinates',
47
- dataType: '{ x: number, y: number }',
52
+ name: "coordinates",
53
+ dataType: "{ x: number, y: number }",
48
54
  nullable: false,
49
- index: true
55
+ index: true,
50
56
  },
51
57
  assertions: [
52
- { type: 'contains', text: '@Index()' },
53
- { type: 'contains', text: 'coordinates: { x: number, y: number };' }
54
- ]
55
- }
58
+ { type: "contains", text: "@Index()" },
59
+ { type: "contains", text: "coordinates: { x: number, y: number };" },
60
+ ],
61
+ },
56
62
  ];
57
63
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
58
64
  });
@@ -2,57 +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)('Polygon Entity Template Tests', () => {
5
+ (0, globals_1.describe)("Polygon 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-polygon';
10
+ const templatePath = "./entities/entity-col-polygon";
11
11
  const testCases = [
12
12
  {
13
- name: 'should render basic polygon field correctly',
13
+ name: "should render basic polygon field correctly",
14
14
  field: {
15
- name: 'boundary',
16
- dataType: '{ coordinates: Array<Array<{ x: number, y: number }>> }',
17
- nullable: false
15
+ name: "boundary",
16
+ dataType: "{ coordinates: Array<Array<{ x: number, y: number }>> }",
17
+ nullable: false,
18
18
  },
19
19
  assertions: [
20
- { type: 'contains', text: '@Column({' },
21
- { type: 'contains', text: '"type": "polygon"' },
22
- { type: 'contains', text: 'transformer: {' },
23
- { type: 'contains', text: 'to: (polygon: { coordinates: Array<Array<{x: number, y: number}>> } | null) => {' },
24
- { type: 'contains', text: 'from: (pgPolygon: string | null) => {' },
25
- { type: 'contains', text: 'boundary: { coordinates: Array<Array<{ x: number, y: number }>> };' },
26
- { type: 'notContains', text: 'nullable: true' }
27
- ]
20
+ { type: "contains", text: "@Column({" },
21
+ { type: "contains", text: '"type": "polygon"' },
22
+ { type: "contains", text: "transformer: {" },
23
+ {
24
+ type: "contains",
25
+ text: "to: (polygon: { coordinates: Array<Array<{x: number, y: number}>> } | null) => {",
26
+ },
27
+ { type: "contains", text: "from: (pgPolygon: string | null) => {" },
28
+ {
29
+ type: "contains",
30
+ text: "boundary: { coordinates: Array<Array<{ x: number, y: number }>> };",
31
+ },
32
+ { type: "notContains", text: "nullable: true" },
33
+ ],
28
34
  },
29
35
  {
30
- name: 'should render nullable polygon field correctly',
36
+ name: "should render nullable polygon field correctly",
31
37
  field: {
32
- name: 'optionalBoundary',
33
- dataType: '{ coordinates: Array<Array<{ x: number, y: number }>> }',
34
- nullable: true
38
+ name: "optionalBoundary",
39
+ dataType: "{ coordinates: Array<Array<{ x: number, y: number }>> }",
40
+ nullable: true,
35
41
  },
36
42
  assertions: [
37
- { type: 'contains', text: '@Column({' },
38
- { type: 'contains', text: '"type": "polygon"' },
39
- { type: 'contains', text: 'nullable: true' },
40
- { type: 'contains', text: 'optionalBoundary: { coordinates: Array<Array<{ x: number, y: number }>> };' }
41
- ]
43
+ { type: "contains", text: "@Column({" },
44
+ { type: "contains", text: '"type": "polygon"' },
45
+ { type: "contains", text: "nullable: true" },
46
+ {
47
+ type: "contains",
48
+ text: "optionalBoundary: { coordinates: Array<Array<{ x: number, y: number }>> };",
49
+ },
50
+ ],
42
51
  },
43
52
  {
44
- name: 'should render indexed polygon field correctly',
53
+ name: "should render indexed polygon field correctly",
45
54
  field: {
46
- name: 'area',
47
- dataType: '{ coordinates: Array<Array<{ x: number, y: number }>> }',
55
+ name: "area",
56
+ dataType: "{ coordinates: Array<Array<{ x: number, y: number }>> }",
48
57
  nullable: false,
49
- index: true
58
+ index: true,
50
59
  },
51
60
  assertions: [
52
- { type: 'contains', text: '@Index()' },
53
- { type: 'contains', text: 'area: { coordinates: Array<Array<{ x: number, y: number }>> };' }
54
- ]
55
- }
61
+ { type: "contains", text: "@Index()" },
62
+ {
63
+ type: "contains",
64
+ text: "area: { coordinates: Array<Array<{ x: number, y: number }>> };",
65
+ },
66
+ ],
67
+ },
56
68
  ];
57
69
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
58
70
  });
@@ -2,66 +2,66 @@
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)('Real Entity Template Tests', () => {
5
+ (0, globals_1.describe)("Real 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-real';
10
+ const templatePath = "./entities/entity-col-real";
11
11
  const testCases = [
12
12
  {
13
- name: 'should render basic real field correctly',
13
+ name: "should render basic real field correctly",
14
14
  field: {
15
- name: 'measurement',
16
- dataType: 'number',
17
- nullable: false
15
+ name: "measurement",
16
+ dataType: "number",
17
+ nullable: false,
18
18
  },
19
19
  assertions: [
20
- { type: 'contains', text: '@Column({ "type": "real"' },
21
- { type: 'contains', text: 'measurement: number;' },
22
- { type: 'notContains', text: '@Index()' },
23
- { type: 'notContains', text: '@PrimaryColumn()' }
24
- ]
20
+ { type: "contains", text: '@Column({ "type": "real"' },
21
+ { type: "contains", text: "measurement: number;" },
22
+ { type: "notContains", text: "@Index()" },
23
+ { type: "notContains", text: "@PrimaryColumn()" },
24
+ ],
25
25
  },
26
26
  {
27
- name: 'should render nullable real field correctly',
27
+ name: "should render nullable real field correctly",
28
28
  field: {
29
- name: 'optionalMeasure',
30
- dataType: 'number',
31
- nullable: true
29
+ name: "optionalMeasure",
30
+ dataType: "number",
31
+ nullable: true,
32
32
  },
33
33
  assertions: [
34
- { type: 'contains', text: '@Column({ "type": "real"' },
35
- { type: 'contains', text: 'optionalMeasure: number;' }
36
- ]
34
+ { type: "contains", text: '@Column({ "type": "real"' },
35
+ { type: "contains", text: "optionalMeasure: number;" },
36
+ ],
37
37
  },
38
38
  {
39
- name: 'should render real field with default value correctly',
39
+ name: "should render real field with default value correctly",
40
40
  field: {
41
- name: 'defaultMeasure',
42
- dataType: 'number',
41
+ name: "defaultMeasure",
42
+ dataType: "number",
43
43
  nullable: false,
44
- default: 0
44
+ default: 0,
45
45
  },
46
46
  assertions: [
47
- { type: 'contains', text: '@Column({ "type": "real", default: 0 })' },
48
- { type: 'contains', text: 'defaultMeasure: number;' }
49
- ]
47
+ { type: "contains", text: '@Column({ "type": "real", default: 0 })' },
48
+ { type: "contains", text: "defaultMeasure: number;" },
49
+ ],
50
50
  },
51
51
  {
52
- name: 'should render indexed real field correctly',
52
+ name: "should render indexed real field correctly",
53
53
  field: {
54
- name: 'indexedMeasure',
55
- dataType: 'number',
54
+ name: "indexedMeasure",
55
+ dataType: "number",
56
56
  nullable: false,
57
- index: true
57
+ index: true,
58
58
  },
59
59
  assertions: [
60
- { type: 'contains', text: '@Column({ "type": "real"' },
61
- { type: 'contains', text: '@Index()' },
62
- { type: 'contains', text: 'indexedMeasure: number;' }
63
- ]
64
- }
60
+ { type: "contains", text: '@Column({ "type": "real"' },
61
+ { type: "contains", text: "@Index()" },
62
+ { type: "contains", text: "indexedMeasure: number;" },
63
+ ],
64
+ },
65
65
  ];
66
66
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
67
67
  });
@@ -2,111 +2,111 @@
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)('Serial Entity Template Tests', () => {
5
+ (0, globals_1.describe)("Serial 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
- (0, globals_1.describe)('serial', () => {
11
- const templatePath = './entities/entity-col-serial';
10
+ (0, globals_1.describe)("serial", () => {
11
+ const templatePath = "./entities/entity-col-serial";
12
12
  const testCases = [
13
13
  {
14
- name: 'should render basic serial field correctly',
14
+ name: "should render basic serial field correctly",
15
15
  field: {
16
- name: 'id',
17
- dataType: 'number',
18
- nullable: false
16
+ name: "id",
17
+ dataType: "number",
18
+ nullable: false,
19
19
  },
20
20
  assertions: [
21
- { type: 'contains', text: '@Column({ "type": "int" })' },
22
- { type: 'contains', text: '@Generated("increment")' },
23
- { type: 'contains', text: 'id: number;' },
24
- { type: 'notContains', text: 'default:' }
25
- ]
21
+ { type: "contains", text: '@Column({ "type": "int" })' },
22
+ { type: "contains", text: '@Generated("increment")' },
23
+ { type: "contains", text: "id: number;" },
24
+ { type: "notContains", text: "default:" },
25
+ ],
26
26
  },
27
27
  {
28
- name: 'should render indexed serial field correctly',
28
+ name: "should render indexed serial field correctly",
29
29
  field: {
30
- name: 'recordId',
31
- dataType: 'number',
30
+ name: "recordId",
31
+ dataType: "number",
32
32
  nullable: false,
33
- index: true
33
+ index: true,
34
34
  },
35
35
  assertions: [
36
- { type: 'contains', text: '@Column({ "type": "int" })' },
37
- { type: 'contains', text: '@Generated("increment")' },
38
- { type: 'contains', text: '@Index()' },
39
- { type: 'contains', text: 'recordId: number;' }
40
- ]
36
+ { type: "contains", text: '@Column({ "type": "int" })' },
37
+ { type: "contains", text: '@Generated("increment")' },
38
+ { type: "contains", text: "@Index()" },
39
+ { type: "contains", text: "recordId: number;" },
40
+ ],
41
41
  },
42
42
  {
43
- name: 'should render primary key serial field correctly',
43
+ name: "should render primary key serial field correctly",
44
44
  field: {
45
- name: 'id',
46
- dataType: 'number',
45
+ name: "id",
46
+ dataType: "number",
47
47
  nullable: false,
48
- primary: true
48
+ primary: true,
49
49
  },
50
50
  assertions: [
51
- { type: 'contains', text: '@Column({ "type": "int" })' },
52
- { type: 'contains', text: '@Generated("increment")' },
53
- { type: 'contains', text: '@PrimaryColumn()' },
54
- { type: 'contains', text: 'id: number;' }
55
- ]
56
- }
51
+ { type: "contains", text: '@Column({ "type": "int" })' },
52
+ { type: "contains", text: '@Generated("increment")' },
53
+ { type: "contains", text: "@PrimaryColumn()" },
54
+ { type: "contains", text: "id: number;" },
55
+ ],
56
+ },
57
57
  ];
58
58
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
59
59
  });
60
- (0, globals_1.describe)('bigserial', () => {
61
- const templatePath = './entities/entity-col-bigserial';
60
+ (0, globals_1.describe)("bigserial", () => {
61
+ const templatePath = "./entities/entity-col-bigserial";
62
62
  const testCases = [
63
63
  {
64
- name: 'should render basic bigserial field correctly',
64
+ name: "should render basic bigserial field correctly",
65
65
  field: {
66
- name: 'id',
67
- dataType: 'string',
68
- nullable: false
66
+ name: "id",
67
+ dataType: "string",
68
+ nullable: false,
69
69
  },
70
70
  assertions: [
71
- { type: 'contains', text: '@Column({ "type": "bigint" })' },
72
- { type: 'contains', text: '@Generated("increment")' },
73
- { type: 'contains', text: 'id: string;' }
74
- ]
71
+ { type: "contains", text: '@Column({ "type": "bigint" })' },
72
+ { type: "contains", text: '@Generated("increment")' },
73
+ { type: "contains", text: "id: string;" },
74
+ ],
75
75
  },
76
76
  {
77
- name: 'should render primary key bigserial field correctly',
77
+ name: "should render primary key bigserial field correctly",
78
78
  field: {
79
- name: 'id',
80
- dataType: 'string',
79
+ name: "id",
80
+ dataType: "string",
81
81
  nullable: false,
82
- primary: true
82
+ primary: true,
83
83
  },
84
84
  assertions: [
85
- { type: 'contains', text: '@Column({ "type": "bigint" })' },
86
- { type: 'contains', text: '@Generated("increment")' },
87
- { type: 'contains', text: '@PrimaryColumn()' },
88
- { type: 'contains', text: 'id: string;' }
89
- ]
90
- }
85
+ { type: "contains", text: '@Column({ "type": "bigint" })' },
86
+ { type: "contains", text: '@Generated("increment")' },
87
+ { type: "contains", text: "@PrimaryColumn()" },
88
+ { type: "contains", text: "id: string;" },
89
+ ],
90
+ },
91
91
  ];
92
92
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
93
93
  });
94
- (0, globals_1.describe)('smallserial', () => {
95
- const templatePath = './entities/entity-col-smallserial';
94
+ (0, globals_1.describe)("smallserial", () => {
95
+ const templatePath = "./entities/entity-col-smallserial";
96
96
  const testCases = [
97
97
  {
98
- name: 'should render basic smallserial field correctly',
98
+ name: "should render basic smallserial field correctly",
99
99
  field: {
100
- name: 'id',
101
- dataType: 'number',
102
- nullable: false
100
+ name: "id",
101
+ dataType: "number",
102
+ nullable: false,
103
103
  },
104
104
  assertions: [
105
- { type: 'contains', text: '@Column({ "type": "smallint" })' },
106
- { type: 'contains', text: '@Generated("increment")' },
107
- { type: 'contains', text: 'id: number;' }
108
- ]
109
- }
105
+ { type: "contains", text: '@Column({ "type": "smallint" })' },
106
+ { type: "contains", text: '@Generated("increment")' },
107
+ { type: "contains", text: "id: number;" },
108
+ ],
109
+ },
110
110
  ];
111
111
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
112
112
  });
@@ -2,81 +2,81 @@
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)('SmallInt Entity Template Tests', () => {
5
+ (0, globals_1.describe)("SmallInt 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-smallint';
10
+ const templatePath = "./entities/entity-col-smallint";
11
11
  const testCases = [
12
12
  {
13
- name: 'should render basic smallint field correctly',
13
+ name: "should render basic smallint field correctly",
14
14
  field: {
15
- name: 'smallCounter',
16
- dataType: 'number',
17
- nullable: false
15
+ name: "smallCounter",
16
+ dataType: "number",
17
+ nullable: false,
18
18
  },
19
19
  assertions: [
20
- { type: 'contains', text: '@Column({ "type": "smallint"' },
21
- { type: 'contains', text: 'smallCounter: number;' },
22
- { type: 'notContains', text: '@Index()' },
23
- { type: 'notContains', text: '@PrimaryColumn()' }
24
- ]
20
+ { type: "contains", text: '@Column({ "type": "smallint"' },
21
+ { type: "contains", text: "smallCounter: number;" },
22
+ { type: "notContains", text: "@Index()" },
23
+ { type: "notContains", text: "@PrimaryColumn()" },
24
+ ],
25
25
  },
26
26
  {
27
- name: 'should render nullable smallint field correctly',
27
+ name: "should render nullable smallint field correctly",
28
28
  field: {
29
- name: 'optionalCounter',
30
- dataType: 'number',
31
- nullable: true
29
+ name: "optionalCounter",
30
+ dataType: "number",
31
+ nullable: true,
32
32
  },
33
33
  assertions: [
34
- { type: 'contains', text: '@Column({ "type": "smallint"' },
35
- { type: 'contains', text: 'optionalCounter: number;' }
36
- ]
34
+ { type: "contains", text: '@Column({ "type": "smallint"' },
35
+ { type: "contains", text: "optionalCounter: number;" },
36
+ ],
37
37
  },
38
38
  {
39
- name: 'should render smallint field with default value correctly',
39
+ name: "should render smallint field with default value correctly",
40
40
  field: {
41
- name: 'defaultCounter',
42
- dataType: 'number',
41
+ name: "defaultCounter",
42
+ dataType: "number",
43
43
  nullable: false,
44
- default: 0
44
+ default: 0,
45
45
  },
46
46
  assertions: [
47
- { type: 'contains', text: '@Column({ "type": "smallint"' },
48
- { type: 'contains', text: 'default: 0' },
49
- { type: 'contains', text: 'defaultCounter: number;' }
50
- ]
47
+ { type: "contains", text: '@Column({ "type": "smallint"' },
48
+ { type: "contains", text: "default: 0" },
49
+ { type: "contains", text: "defaultCounter: number;" },
50
+ ],
51
51
  },
52
52
  {
53
- name: 'should render indexed smallint field correctly',
53
+ name: "should render indexed smallint field correctly",
54
54
  field: {
55
- name: 'indexedCounter',
56
- dataType: 'number',
55
+ name: "indexedCounter",
56
+ dataType: "number",
57
57
  nullable: false,
58
- index: true
58
+ index: true,
59
59
  },
60
60
  assertions: [
61
- { type: 'contains', text: '@Column({ "type": "smallint"' },
62
- { type: 'contains', text: '@Index()' },
63
- { type: 'contains', text: 'indexedCounter: number;' }
64
- ]
61
+ { type: "contains", text: '@Column({ "type": "smallint"' },
62
+ { type: "contains", text: "@Index()" },
63
+ { type: "contains", text: "indexedCounter: number;" },
64
+ ],
65
65
  },
66
66
  {
67
- name: 'should render primary key smallint field correctly',
67
+ name: "should render primary key smallint field correctly",
68
68
  field: {
69
- name: 'id',
70
- dataType: 'number',
69
+ name: "id",
70
+ dataType: "number",
71
71
  nullable: false,
72
- primary: true
72
+ primary: true,
73
73
  },
74
74
  assertions: [
75
- { type: 'contains', text: '@Column({ "type": "smallint"' },
76
- { type: 'contains', text: '@PrimaryColumn()' },
77
- { type: 'contains', text: 'id: number;' }
78
- ]
79
- }
75
+ { type: "contains", text: '@Column({ "type": "smallint"' },
76
+ { type: "contains", text: "@PrimaryColumn()" },
77
+ { type: "contains", text: "id: number;" },
78
+ ],
79
+ },
80
80
  ];
81
81
  (0, template_test_utils_1.runTemplateTests)(templatePath, testCases);
82
82
  });