@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
@@ -4,20 +4,20 @@ const tslib_1 = require("tslib");
4
4
  const Eta = tslib_1.__importStar(require("eta"));
5
5
  const path = tslib_1.__importStar(require("path"));
6
6
  const globals_1 = require("@jest/globals");
7
- (0, globals_1.describe)('UUID Entity Template Tests', () => {
7
+ (0, globals_1.describe)("UUID Entity Template Tests", () => {
8
8
  (0, globals_1.beforeAll)(() => {
9
9
  Eta.configure({
10
- views: path.join(__dirname, '../../../lib/templates'),
11
- cache: false
10
+ views: path.join(__dirname, "../../../lib/templates"),
11
+ cache: false,
12
12
  });
13
13
  });
14
- (0, globals_1.describe)('UUID Primary Key', () => {
15
- (0, globals_1.it)('should render entity with UUID primary key', async () => {
14
+ (0, globals_1.describe)("UUID Primary Key", () => {
15
+ (0, globals_1.it)("should render entity with UUID primary key", async () => {
16
16
  const data = {
17
- name: 'User',
18
- snakeCasedName: 'user',
17
+ name: "User",
18
+ snakeCasedName: "user",
19
19
  createPrimaryKey: true,
20
- primaryKeyType: 'uuid',
20
+ primaryKeyType: "uuid",
21
21
  createdAt: true,
22
22
  updatedAt: true,
23
23
  columns: [],
@@ -25,25 +25,25 @@ const globals_1 = require("@jest/globals");
25
25
  indexes: [],
26
26
  uniques: [],
27
27
  entitiesToImport: [],
28
- apiType: 'rest',
29
- importEnums: false
28
+ apiType: "rest",
29
+ importEnums: false,
30
30
  };
31
- const rendered = await Eta.renderFileAsync('./entities/entity', data);
31
+ const rendered = await Eta.renderFileAsync("./entities/entity", data);
32
32
  // Should use @Column with uuid type
33
33
  (0, globals_1.expect)(rendered).toContain("@Column({ type: 'uuid' })");
34
34
  // Should use @PrimaryColumn instead of @PrimaryGeneratedColumn
35
- (0, globals_1.expect)(rendered).toContain('@PrimaryColumn()');
36
- (0, globals_1.expect)(rendered).not.toContain('@PrimaryGeneratedColumn()');
35
+ (0, globals_1.expect)(rendered).toContain("@PrimaryColumn()");
36
+ (0, globals_1.expect)(rendered).not.toContain("@PrimaryGeneratedColumn()");
37
37
  // Should declare id as string
38
- (0, globals_1.expect)(rendered).toContain('id: string;');
39
- (0, globals_1.expect)(rendered).not.toContain('id!: number;');
38
+ (0, globals_1.expect)(rendered).toContain("id: string;");
39
+ (0, globals_1.expect)(rendered).not.toContain("id!: number;");
40
40
  });
41
- (0, globals_1.it)('should render entity with serial (auto-increment) primary key', async () => {
41
+ (0, globals_1.it)("should render entity with serial (auto-increment) primary key", async () => {
42
42
  const data = {
43
- name: 'Post',
44
- snakeCasedName: 'post',
43
+ name: "Post",
44
+ snakeCasedName: "post",
45
45
  createPrimaryKey: true,
46
- primaryKeyType: 'serial',
46
+ primaryKeyType: "serial",
47
47
  createdAt: true,
48
48
  updatedAt: true,
49
49
  columns: [],
@@ -51,22 +51,22 @@ const globals_1 = require("@jest/globals");
51
51
  indexes: [],
52
52
  uniques: [],
53
53
  entitiesToImport: [],
54
- apiType: 'rest',
55
- importEnums: false
54
+ apiType: "rest",
55
+ importEnums: false,
56
56
  };
57
- const rendered = await Eta.renderFileAsync('./entities/entity', data);
57
+ const rendered = await Eta.renderFileAsync("./entities/entity", data);
58
58
  // Should use @PrimaryGeneratedColumn
59
- (0, globals_1.expect)(rendered).toContain('@PrimaryGeneratedColumn()');
59
+ (0, globals_1.expect)(rendered).toContain("@PrimaryGeneratedColumn()");
60
60
  (0, globals_1.expect)(rendered).not.toContain("@Column({ type: 'uuid' })");
61
- (0, globals_1.expect)(rendered).not.toContain('@PrimaryColumn()');
61
+ (0, globals_1.expect)(rendered).not.toContain("@PrimaryColumn()");
62
62
  // Should declare id as number
63
- (0, globals_1.expect)(rendered).toContain('id!: number;');
64
- (0, globals_1.expect)(rendered).not.toContain('id: string;');
63
+ (0, globals_1.expect)(rendered).toContain("id!: number;");
64
+ (0, globals_1.expect)(rendered).not.toContain("id: string;");
65
65
  });
66
- (0, globals_1.it)('should default to serial primary key when primaryKeyType is not specified', async () => {
66
+ (0, globals_1.it)("should default to serial primary key when primaryKeyType is not specified", async () => {
67
67
  const data = {
68
- name: 'Comment',
69
- snakeCasedName: 'comment',
68
+ name: "Comment",
69
+ snakeCasedName: "comment",
70
70
  createPrimaryKey: true,
71
71
  // primaryKeyType not specified
72
72
  createdAt: true,
@@ -76,202 +76,202 @@ const globals_1 = require("@jest/globals");
76
76
  indexes: [],
77
77
  uniques: [],
78
78
  entitiesToImport: [],
79
- apiType: 'rest',
80
- importEnums: false
79
+ apiType: "rest",
80
+ importEnums: false,
81
81
  };
82
- const rendered = await Eta.renderFileAsync('./entities/entity', data);
82
+ const rendered = await Eta.renderFileAsync("./entities/entity", data);
83
83
  // Should default to serial (auto-increment)
84
- (0, globals_1.expect)(rendered).toContain('@PrimaryGeneratedColumn()');
85
- (0, globals_1.expect)(rendered).toContain('id!: number;');
84
+ (0, globals_1.expect)(rendered).toContain("@PrimaryGeneratedColumn()");
85
+ (0, globals_1.expect)(rendered).toContain("id!: number;");
86
86
  });
87
87
  });
88
- (0, globals_1.describe)('UUID Foreign Keys', () => {
89
- (0, globals_1.it)('should render ManyToOne relationship with UUID foreign key when referenced entity has UUID primary key', async () => {
88
+ (0, globals_1.describe)("UUID Foreign Keys", () => {
89
+ (0, globals_1.it)("should render ManyToOne relationship with UUID foreign key when referenced entity has UUID primary key", async () => {
90
90
  const data = {
91
- name: 'Account',
92
- snakeCasedName: 'account',
91
+ name: "Account",
92
+ snakeCasedName: "account",
93
93
  createPrimaryKey: true,
94
- primaryKeyType: 'serial',
94
+ primaryKeyType: "serial",
95
95
  createdAt: true,
96
96
  updatedAt: true,
97
97
  columns: [],
98
98
  associations: [
99
99
  {
100
- name: 'User',
101
- type: 'ManyToOne',
102
- relationshipName: 'user',
103
- pluralizedRelationshipName: 'users',
104
- pluralizedName: 'users',
105
- camelCasedName: 'user',
106
- camelCasedId: 'userId',
107
- entityName: 'account',
100
+ name: "User",
101
+ type: "ManyToOne",
102
+ relationshipName: "user",
103
+ pluralizedRelationshipName: "users",
104
+ pluralizedName: "users",
105
+ camelCasedName: "user",
106
+ camelCasedId: "userId",
107
+ entityName: "account",
108
108
  joinTable: false,
109
109
  biDirectional: true,
110
- inverseSidePropertyName: 'accounts',
111
- referencedEntityPrimaryKeyType: 'uuid',
110
+ inverseSidePropertyName: "accounts",
111
+ referencedEntityPrimaryKeyType: "uuid",
112
112
  nullable: false,
113
- index: false
114
- }
113
+ index: false,
114
+ },
115
115
  ],
116
116
  indexes: [],
117
117
  uniques: [],
118
- entitiesToImport: ['User'],
119
- apiType: 'rest',
120
- importEnums: false
118
+ entitiesToImport: ["User"],
119
+ apiType: "rest",
120
+ importEnums: false,
121
121
  };
122
- const rendered = await Eta.renderFileAsync('./entities/entity', data);
122
+ const rendered = await Eta.renderFileAsync("./entities/entity", data);
123
123
  // Should have ManyToOne decorator
124
- (0, globals_1.expect)(rendered).toContain('@ManyToOne(() => User');
124
+ (0, globals_1.expect)(rendered).toContain("@ManyToOne(() => User");
125
125
  // Should have JoinColumn
126
126
  (0, globals_1.expect)(rendered).toContain("@JoinColumn({ name: 'userId' })");
127
127
  // Should declare relationship property
128
- (0, globals_1.expect)(rendered).toContain('user: User;');
128
+ (0, globals_1.expect)(rendered).toContain("user: User;");
129
129
  // Should have UUID foreign key column
130
130
  (0, globals_1.expect)(rendered).toContain('@Column({ type: "uuid"');
131
- (0, globals_1.expect)(rendered).toContain('userId: string;');
131
+ (0, globals_1.expect)(rendered).toContain("userId: string;");
132
132
  // Should NOT have integer foreign key
133
- (0, globals_1.expect)(rendered).not.toContain('userId: number;');
133
+ (0, globals_1.expect)(rendered).not.toContain("userId: number;");
134
134
  });
135
- (0, globals_1.it)('should render ManyToOne relationship with integer foreign key when referenced entity has serial primary key', async () => {
135
+ (0, globals_1.it)("should render ManyToOne relationship with integer foreign key when referenced entity has serial primary key", async () => {
136
136
  const data = {
137
- name: 'Post',
138
- snakeCasedName: 'post',
137
+ name: "Post",
138
+ snakeCasedName: "post",
139
139
  createPrimaryKey: true,
140
- primaryKeyType: 'serial',
140
+ primaryKeyType: "serial",
141
141
  createdAt: true,
142
142
  updatedAt: true,
143
143
  columns: [],
144
144
  associations: [
145
145
  {
146
- name: 'User',
147
- type: 'ManyToOne',
148
- relationshipName: 'user',
149
- pluralizedRelationshipName: 'users',
150
- pluralizedName: 'users',
151
- camelCasedName: 'user',
152
- camelCasedId: 'userId',
153
- entityName: 'post',
146
+ name: "User",
147
+ type: "ManyToOne",
148
+ relationshipName: "user",
149
+ pluralizedRelationshipName: "users",
150
+ pluralizedName: "users",
151
+ camelCasedName: "user",
152
+ camelCasedId: "userId",
153
+ entityName: "post",
154
154
  joinTable: false,
155
155
  biDirectional: true,
156
- inverseSidePropertyName: 'posts',
157
- referencedEntityPrimaryKeyType: 'serial',
156
+ inverseSidePropertyName: "posts",
157
+ referencedEntityPrimaryKeyType: "serial",
158
158
  nullable: false,
159
- index: true
160
- }
159
+ index: true,
160
+ },
161
161
  ],
162
162
  indexes: [],
163
163
  uniques: [],
164
- entitiesToImport: ['User'],
165
- apiType: 'rest',
166
- importEnums: false
164
+ entitiesToImport: ["User"],
165
+ apiType: "rest",
166
+ importEnums: false,
167
167
  };
168
- const rendered = await Eta.renderFileAsync('./entities/entity', data);
168
+ const rendered = await Eta.renderFileAsync("./entities/entity", data);
169
169
  // Should have ManyToOne decorator
170
- (0, globals_1.expect)(rendered).toContain('@ManyToOne(() => User');
170
+ (0, globals_1.expect)(rendered).toContain("@ManyToOne(() => User");
171
171
  // Should have index since index: true
172
- (0, globals_1.expect)(rendered).toContain('@Index()');
172
+ (0, globals_1.expect)(rendered).toContain("@Index()");
173
173
  // Should have integer foreign key column
174
174
  (0, globals_1.expect)(rendered).toContain('@Column({ type: "integer"');
175
- (0, globals_1.expect)(rendered).toContain('userId: number;');
175
+ (0, globals_1.expect)(rendered).toContain("userId: number;");
176
176
  // Should NOT have UUID foreign key
177
- (0, globals_1.expect)(rendered).not.toContain('userId: string;');
177
+ (0, globals_1.expect)(rendered).not.toContain("userId: string;");
178
178
  });
179
- (0, globals_1.it)('should handle nullable UUID foreign keys', async () => {
179
+ (0, globals_1.it)("should handle nullable UUID foreign keys", async () => {
180
180
  const data = {
181
- name: 'Profile',
182
- snakeCasedName: 'profile',
181
+ name: "Profile",
182
+ snakeCasedName: "profile",
183
183
  createPrimaryKey: true,
184
- primaryKeyType: 'uuid',
184
+ primaryKeyType: "uuid",
185
185
  createdAt: true,
186
186
  updatedAt: true,
187
187
  columns: [],
188
188
  associations: [
189
189
  {
190
- name: 'Organization',
191
- type: 'ManyToOne',
192
- relationshipName: 'organization',
193
- pluralizedRelationshipName: 'organizations',
194
- pluralizedName: 'organizations',
195
- camelCasedName: 'organization',
196
- camelCasedId: 'organizationId',
197
- entityName: 'profile',
190
+ name: "Organization",
191
+ type: "ManyToOne",
192
+ relationshipName: "organization",
193
+ pluralizedRelationshipName: "organizations",
194
+ pluralizedName: "organizations",
195
+ camelCasedName: "organization",
196
+ camelCasedId: "organizationId",
197
+ entityName: "profile",
198
198
  joinTable: false,
199
199
  biDirectional: false,
200
- referencedEntityPrimaryKeyType: 'uuid',
200
+ referencedEntityPrimaryKeyType: "uuid",
201
201
  nullable: true,
202
- index: false
203
- }
202
+ index: false,
203
+ },
204
204
  ],
205
205
  indexes: [],
206
206
  uniques: [],
207
- entitiesToImport: ['Organization'],
208
- apiType: 'rest',
209
- importEnums: false
207
+ entitiesToImport: ["Organization"],
208
+ apiType: "rest",
209
+ importEnums: false,
210
210
  };
211
- const rendered = await Eta.renderFileAsync('./entities/entity', data);
211
+ const rendered = await Eta.renderFileAsync("./entities/entity", data);
212
212
  // Should have nullable UUID foreign key
213
213
  (0, globals_1.expect)(rendered).toContain('@Column({ type: "uuid", nullable: true');
214
- (0, globals_1.expect)(rendered).toContain('organizationId: string;');
214
+ (0, globals_1.expect)(rendered).toContain("organizationId: string;");
215
215
  });
216
- (0, globals_1.it)('should handle multiple relationships with mixed UUID and serial foreign keys', async () => {
216
+ (0, globals_1.it)("should handle multiple relationships with mixed UUID and serial foreign keys", async () => {
217
217
  const data = {
218
- name: 'Comment',
219
- snakeCasedName: 'comment',
218
+ name: "Comment",
219
+ snakeCasedName: "comment",
220
220
  createPrimaryKey: true,
221
- primaryKeyType: 'serial',
221
+ primaryKeyType: "serial",
222
222
  createdAt: true,
223
223
  updatedAt: true,
224
224
  columns: [],
225
225
  associations: [
226
226
  {
227
- name: 'User',
228
- type: 'ManyToOne',
229
- relationshipName: 'user',
230
- pluralizedRelationshipName: 'users',
231
- pluralizedName: 'users',
232
- camelCasedName: 'user',
233
- camelCasedId: 'userId',
234
- entityName: 'comment',
227
+ name: "User",
228
+ type: "ManyToOne",
229
+ relationshipName: "user",
230
+ pluralizedRelationshipName: "users",
231
+ pluralizedName: "users",
232
+ camelCasedName: "user",
233
+ camelCasedId: "userId",
234
+ entityName: "comment",
235
235
  joinTable: false,
236
236
  biDirectional: true,
237
- inverseSidePropertyName: 'comments',
238
- referencedEntityPrimaryKeyType: 'uuid',
237
+ inverseSidePropertyName: "comments",
238
+ referencedEntityPrimaryKeyType: "uuid",
239
239
  nullable: false,
240
- index: true
240
+ index: true,
241
241
  },
242
242
  {
243
- name: 'Post',
244
- type: 'ManyToOne',
245
- relationshipName: 'post',
246
- pluralizedRelationshipName: 'posts',
247
- pluralizedName: 'posts',
248
- camelCasedName: 'post',
249
- camelCasedId: 'postId',
250
- entityName: 'comment',
243
+ name: "Post",
244
+ type: "ManyToOne",
245
+ relationshipName: "post",
246
+ pluralizedRelationshipName: "posts",
247
+ pluralizedName: "posts",
248
+ camelCasedName: "post",
249
+ camelCasedId: "postId",
250
+ entityName: "comment",
251
251
  joinTable: false,
252
252
  biDirectional: true,
253
- inverseSidePropertyName: 'comments',
254
- referencedEntityPrimaryKeyType: 'serial',
253
+ inverseSidePropertyName: "comments",
254
+ referencedEntityPrimaryKeyType: "serial",
255
255
  nullable: false,
256
- index: true
257
- }
256
+ index: true,
257
+ },
258
258
  ],
259
259
  indexes: [],
260
260
  uniques: [],
261
- entitiesToImport: ['User', 'Post'],
262
- apiType: 'rest',
263
- importEnums: false
261
+ entitiesToImport: ["User", "Post"],
262
+ apiType: "rest",
263
+ importEnums: false,
264
264
  };
265
- const rendered = await Eta.renderFileAsync('./entities/entity', data);
265
+ const rendered = await Eta.renderFileAsync("./entities/entity", data);
266
266
  // Should have UUID foreign key for User
267
267
  (0, globals_1.expect)(rendered).toContain('@Column({ type: "uuid"');
268
- (0, globals_1.expect)(rendered).toContain('userId: string;');
268
+ (0, globals_1.expect)(rendered).toContain("userId: string;");
269
269
  // Should have integer foreign key for Post
270
270
  (0, globals_1.expect)(rendered).toContain('@Column({ type: "integer"');
271
- (0, globals_1.expect)(rendered).toContain('postId: number;');
271
+ (0, globals_1.expect)(rendered).toContain("postId: number;");
272
272
  // Should have both relationships
273
- (0, globals_1.expect)(rendered).toContain('user: User;');
274
- (0, globals_1.expect)(rendered).toContain('post: Post;');
273
+ (0, globals_1.expect)(rendered).toContain("user: User;");
274
+ (0, globals_1.expect)(rendered).toContain("post: Post;");
275
275
  });
276
276
  });
277
277
  });
@@ -6,7 +6,7 @@ const parse_1 = require("../../lib/utils/relationships/parse");
6
6
  (0, globals_1.test)("should deduplicate ManyToMany relationships", () => {
7
7
  // Mock entity name
8
8
  const entityName = "CustomerCard";
9
- // Mock relationships - simulating bidirectional ManyToMany where
9
+ // Mock relationships - simulating bidirectional ManyToMany where
10
10
  // both sides are added to the relationships array for the same entity
11
11
  const mockRelationships = [
12
12
  // First ManyToMany relationship (non-join side)
@@ -16,7 +16,7 @@ const parse_1 = require("../../lib/utils/relationships/parse");
16
16
  referenceName: "subscriptions",
17
17
  biDirectional: true,
18
18
  join: false,
19
- inverseReferenceName: "customercards"
19
+ inverseReferenceName: "customercards",
20
20
  },
21
21
  // Duplicate relationship (join side) - similar to what happens in bidirectional ManyToMany
22
22
  {
@@ -25,8 +25,8 @@ const parse_1 = require("../../lib/utils/relationships/parse");
25
25
  referenceName: "subscriptions",
26
26
  biDirectional: true,
27
27
  join: true,
28
- inverseReferenceName: "customercards"
29
- }
28
+ inverseReferenceName: "customercards",
29
+ },
30
30
  ];
31
31
  // Run the function
32
32
  const result = (0, parse_1.getRelationshipForTemplate)(entityName, mockRelationships);
@@ -47,22 +47,22 @@ const parse_1 = require("../../lib/utils/relationships/parse");
47
47
  type: "ManyToMany",
48
48
  referenceName: "workspaces",
49
49
  biDirectional: true,
50
- join: true
50
+ join: true,
51
51
  },
52
52
  {
53
53
  name: "Workspace",
54
54
  type: "ManyToMany",
55
55
  referenceName: "ownedWorkspaces",
56
56
  biDirectional: true,
57
- join: true
58
- }
57
+ join: true,
58
+ },
59
59
  ];
60
60
  // Run the function
61
61
  const result = (0, parse_1.getRelationshipForTemplate)(entityName, mockRelationships);
62
62
  // Assertions
63
63
  // New behavior: Both relationships with different referenceName should be kept
64
64
  (0, globals_1.expect)(result.length).toBe(2);
65
- const referenceNames = result.map(r => r.relationshipName || r.referenceName);
65
+ const referenceNames = result.map((r) => r.relationshipName || r.referenceName);
66
66
  (0, globals_1.expect)(referenceNames).toContain("workspaces");
67
67
  (0, globals_1.expect)(referenceNames).toContain("ownedWorkspaces");
68
68
  });
@@ -76,15 +76,15 @@ const parse_1 = require("../../lib/utils/relationships/parse");
76
76
  type: "ManyToMany",
77
77
  biDirectional: true,
78
78
  join: false,
79
- referenceName: "workspaceservices"
79
+ referenceName: "workspaceservices",
80
80
  },
81
81
  {
82
82
  name: "WorkspaceService",
83
83
  type: "ManyToMany",
84
84
  biDirectional: true,
85
85
  join: true,
86
- referenceName: "workspaceservices"
87
- }
86
+ referenceName: "workspaceservices",
87
+ },
88
88
  ];
89
89
  // Run the function
90
90
  const result = (0, parse_1.getRelationshipForTemplate)(entityName, mockRelationships);
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.0",
2
+ "version": "0.7.0",
3
3
  "commands": {
4
4
  "server:new": {
5
5
  "id": "server:new",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apso/cli",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Apso CLI",
5
5
  "author": "Apso by Mavric - @mavric",
6
6
  "bin": {