bigal 13.0.4 → 13.0.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 13.0.5 - 2024-12-17
4
+
5
+ - Update npms
6
+ - Use node protocol for built-in modules
7
+
3
8
  ## 13.0.4 - 2024-11-29
4
9
 
5
10
  - Update npms
package/dist/index.cjs CHANGED
@@ -6,30 +6,60 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
6
6
 
7
7
  const ___default = /*#__PURE__*/_interopDefaultCompat(_);
8
8
 
9
- var __defProp$7 = Object.defineProperty;
10
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __publicField$7 = (obj, key, value) => {
12
- __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
13
- return value;
14
- };
15
9
  class MetadataStorage {
16
- constructor() {
17
- __publicField$7(this, "models", []);
18
- // All columns for all models. This data only represents @column specifics, not additional column modifiers
19
- __publicField$7(this, "columns", []);
20
- // This represents additional column behavior separate from the main @column decorator. For example, @primaryColumn, @versionColumn, etc
21
- // This behavior will be merged over defaults from @column()
22
- __publicField$7(this, "columnModifiers", []);
23
- }
10
+ models = [];
11
+ // All columns for all models. This data only represents @column specifics, not additional column modifiers
12
+ columns = [];
13
+ // This represents additional column behavior separate from the main @column decorator. For example, @primaryColumn, @versionColumn, etc
14
+ // This behavior will be merged over defaults from @column()
15
+ columnModifiers = [];
24
16
  }
25
17
 
26
- var __defProp$6 = Object.defineProperty;
27
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
28
- var __publicField$6 = (obj, key, value) => {
29
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
30
- return value;
31
- };
32
18
  class ColumnBaseMetadata {
19
+ /**
20
+ * Name of class with @table decorator
21
+ */
22
+ target;
23
+ /**
24
+ * Column name in the database
25
+ */
26
+ name;
27
+ /**
28
+ * Class property to which the column is applied
29
+ */
30
+ propertyName;
31
+ /**
32
+ * Indicates if a value is required for creates.
33
+ */
34
+ required;
35
+ /**
36
+ * Indicates if column is inserted by default. Default is true
37
+ */
38
+ insert;
39
+ /**
40
+ * Indicates if column value is updated by "save" operation. Default is true
41
+ */
42
+ update;
43
+ /**
44
+ * Indicates if this column is a primary key.
45
+ * Same can be achieved when @primaryColumn decorator is used
46
+ */
47
+ primary;
48
+ /**
49
+ * Value will be equal to `new Date()` when the row is inserted into the table
50
+ * Same can be achieved when @createDateColumn decorator is used
51
+ */
52
+ createDate;
53
+ /**
54
+ * Value will be equal to `new Date()` when the row is updated
55
+ * Same can be achieved when @updateDateColumn decorator is used
56
+ */
57
+ updateDate;
58
+ /**
59
+ * Value will be set to 1 when the row is inserted. Value will be incremented by one when the row is updated
60
+ * Same can be achieved when @versionColumn decorator is used
61
+ */
62
+ version;
33
63
  constructor({
34
64
  target,
35
65
  name,
@@ -42,50 +72,6 @@ class ColumnBaseMetadata {
42
72
  updateDate = false,
43
73
  version = false
44
74
  }) {
45
- /**
46
- * Name of class with @table decorator
47
- */
48
- __publicField$6(this, "target");
49
- /**
50
- * Column name in the database
51
- */
52
- __publicField$6(this, "name");
53
- /**
54
- * Class property to which the column is applied
55
- */
56
- __publicField$6(this, "propertyName");
57
- /**
58
- * Indicates if a value is required for creates.
59
- */
60
- __publicField$6(this, "required");
61
- /**
62
- * Indicates if column is inserted by default. Default is true
63
- */
64
- __publicField$6(this, "insert");
65
- /**
66
- * Indicates if column value is updated by "save" operation. Default is true
67
- */
68
- __publicField$6(this, "update");
69
- /**
70
- * Indicates if this column is a primary key.
71
- * Same can be achieved when @primaryColumn decorator is used
72
- */
73
- __publicField$6(this, "primary");
74
- /**
75
- * Value will be equal to `new Date()` when the row is inserted into the table
76
- * Same can be achieved when @createDateColumn decorator is used
77
- */
78
- __publicField$6(this, "createDate");
79
- /**
80
- * Value will be equal to `new Date()` when the row is updated
81
- * Same can be achieved when @updateDateColumn decorator is used
82
- */
83
- __publicField$6(this, "updateDate");
84
- /**
85
- * Value will be set to 1 when the row is inserted. Value will be incremented by one when the row is updated
86
- * Same can be achieved when @versionColumn decorator is used
87
- */
88
- __publicField$6(this, "version");
89
75
  this.target = target;
90
76
  this.name = name;
91
77
  this.propertyName = propertyName;
@@ -99,13 +85,41 @@ class ColumnBaseMetadata {
99
85
  }
100
86
  }
101
87
 
102
- var __defProp$5 = Object.defineProperty;
103
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
104
- var __publicField$5 = (obj, key, value) => {
105
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
106
- return value;
107
- };
108
88
  class ColumnCollectionMetadata extends ColumnBaseMetadata {
89
+ _collectionString;
90
+ _collectionFn;
91
+ _throughString;
92
+ _throughFn;
93
+ /**
94
+ * Type of the items in the collection
95
+ */
96
+ get collection() {
97
+ if (this._collectionString) {
98
+ return this._collectionString;
99
+ }
100
+ if (!this._collectionFn) {
101
+ throw new Error(`Unable to determine collection type for ${this.target}#${this.propertyName}`);
102
+ }
103
+ this._collectionString = this._collectionFn();
104
+ return this._collectionString;
105
+ }
106
+ /**
107
+ * Property name of the on the collection item type
108
+ */
109
+ via;
110
+ /**
111
+ * Name of the junction table for multi-multi associations
112
+ */
113
+ get through() {
114
+ if (this._throughString) {
115
+ return this._throughString;
116
+ }
117
+ if (this._throughFn) {
118
+ this._throughString = this._throughFn();
119
+ return this._throughString;
120
+ }
121
+ return void 0;
122
+ }
109
123
  constructor({
110
124
  target,
111
125
  //
@@ -134,14 +148,6 @@ class ColumnCollectionMetadata extends ColumnBaseMetadata {
134
148
  updateDate,
135
149
  version
136
150
  });
137
- __publicField$5(this, "_collectionString");
138
- __publicField$5(this, "_collectionFn");
139
- __publicField$5(this, "_throughString");
140
- __publicField$5(this, "_throughFn");
141
- /**
142
- * Property name of the on the collection item type
143
- */
144
- __publicField$5(this, "via");
145
151
  this.via = via;
146
152
  if (typeof collection === "string") {
147
153
  this._collectionString = collection;
@@ -154,41 +160,24 @@ class ColumnCollectionMetadata extends ColumnBaseMetadata {
154
160
  this._throughFn = through;
155
161
  }
156
162
  }
163
+ }
164
+
165
+ class ColumnModelMetadata extends ColumnBaseMetadata {
166
+ _modelString;
167
+ _modelFn;
157
168
  /**
158
- * Type of the items in the collection
159
- */
160
- get collection() {
161
- if (this._collectionString) {
162
- return this._collectionString;
163
- }
164
- if (!this._collectionFn) {
165
- throw new Error(`Unable to determine collection type for ${this.target}#${this.propertyName}`);
166
- }
167
- this._collectionString = this._collectionFn();
168
- return this._collectionString;
169
- }
170
- /**
171
- * Name of the junction table for multi-multi associations
169
+ * Name of the model represented by this column id
172
170
  */
173
- get through() {
174
- if (this._throughString) {
175
- return this._throughString;
171
+ get model() {
172
+ if (this._modelString) {
173
+ return this._modelString;
176
174
  }
177
- if (this._throughFn) {
178
- this._throughString = this._throughFn();
179
- return this._throughString;
175
+ if (!this._modelFn) {
176
+ throw new Error(`Unable to determine model type for ${this.target}#${this.propertyName}`);
180
177
  }
181
- return void 0;
178
+ this._modelString = this._modelFn();
179
+ return this._modelString;
182
180
  }
183
- }
184
-
185
- var __defProp$4 = Object.defineProperty;
186
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
187
- var __publicField$4 = (obj, key, value) => {
188
- __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
189
- return value;
190
- };
191
- class ColumnModelMetadata extends ColumnBaseMetadata {
192
181
  constructor({
193
182
  target,
194
183
  //
@@ -215,36 +204,33 @@ class ColumnModelMetadata extends ColumnBaseMetadata {
215
204
  updateDate,
216
205
  version
217
206
  });
218
- __publicField$4(this, "_modelString");
219
- __publicField$4(this, "_modelFn");
220
207
  if (typeof model === "string") {
221
208
  this._modelString = model;
222
209
  } else {
223
210
  this._modelFn = model;
224
211
  }
225
212
  }
226
- /**
227
- * Name of the model represented by this column id
228
- */
229
- get model() {
230
- if (this._modelString) {
231
- return this._modelString;
232
- }
233
- if (!this._modelFn) {
234
- throw new Error(`Unable to determine model type for ${this.target}#${this.propertyName}`);
235
- }
236
- this._modelString = this._modelFn();
237
- return this._modelString;
238
- }
239
213
  }
240
214
 
241
- var __defProp$3 = Object.defineProperty;
242
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
243
- var __publicField$3 = (obj, key, value) => {
244
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
245
- return value;
246
- };
247
215
  class ColumnTypeMetadata extends ColumnBaseMetadata {
216
+ /**
217
+ * Type of the column
218
+ */
219
+ type;
220
+ /**
221
+ * Default database value
222
+ */
223
+ defaultsTo;
224
+ /**
225
+ * Array of possible enumerated values
226
+ */
227
+ enum;
228
+ /**
229
+ * If set, enforces a maximum length check on the column
230
+ *
231
+ * Applies to types: string | string[]
232
+ */
233
+ maxLength;
248
234
  constructor(options) {
249
235
  super({
250
236
  target: options.target,
@@ -258,24 +244,6 @@ class ColumnTypeMetadata extends ColumnBaseMetadata {
258
244
  updateDate: options.updateDate,
259
245
  version: options.version
260
246
  });
261
- /**
262
- * Type of the column
263
- */
264
- __publicField$3(this, "type");
265
- /**
266
- * Default database value
267
- */
268
- __publicField$3(this, "defaultsTo");
269
- /**
270
- * Array of possible enumerated values
271
- */
272
- __publicField$3(this, "enum");
273
- /**
274
- * If set, enforces a maximum length check on the column
275
- *
276
- * Applies to types: string | string[]
277
- */
278
- __publicField$3(this, "maxLength");
279
247
  this.type = options.type;
280
248
  this.defaultsTo = options.defaultsTo;
281
249
  this.enum = options.enum;
@@ -283,39 +251,12 @@ class ColumnTypeMetadata extends ColumnBaseMetadata {
283
251
  }
284
252
  }
285
253
 
286
- var __defProp$2 = Object.defineProperty;
287
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
288
- var __publicField$2 = (obj, key, value) => {
289
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
290
- return value;
291
- };
292
254
  class ModelMetadata {
293
- constructor({
294
- name,
295
- //
296
- type,
297
- connection,
298
- tableName,
299
- readonly = false
300
- }) {
301
- __publicField$2(this, "_columns", []);
302
- __publicField$2(this, "_primaryKeyColumn");
303
- __publicField$2(this, "_createDateColumns", []);
304
- __publicField$2(this, "_updateDateColumns", []);
305
- __publicField$2(this, "_versionDateColumns", []);
306
- __publicField$2(this, "name");
307
- __publicField$2(this, "type");
308
- __publicField$2(this, "connection");
309
- __publicField$2(this, "tableName");
310
- __publicField$2(this, "readonly");
311
- __publicField$2(this, "columnsByColumnName", {});
312
- __publicField$2(this, "columnsByPropertyName", {});
313
- this.name = name;
314
- this.type = type;
315
- this.connection = connection;
316
- this.tableName = tableName ?? ___default.snakeCase(name);
317
- this.readonly = readonly;
318
- }
255
+ _columns = [];
256
+ _primaryKeyColumn;
257
+ _createDateColumns = [];
258
+ _updateDateColumns = [];
259
+ _versionDateColumns = [];
319
260
  set columns(columns) {
320
261
  this._columns = columns;
321
262
  this.columnsByColumnName = {};
@@ -352,6 +293,27 @@ class ModelMetadata {
352
293
  get versionColumns() {
353
294
  return this._versionDateColumns;
354
295
  }
296
+ name;
297
+ type;
298
+ connection;
299
+ tableName;
300
+ readonly;
301
+ columnsByColumnName = {};
302
+ columnsByPropertyName = {};
303
+ constructor({
304
+ name,
305
+ //
306
+ type,
307
+ connection,
308
+ tableName,
309
+ readonly = false
310
+ }) {
311
+ this.name = name;
312
+ this.type = type;
313
+ this.connection = connection;
314
+ this.tableName = tableName ?? ___default.snakeCase(name);
315
+ this.readonly = readonly;
316
+ }
355
317
  }
356
318
 
357
319
  function getMetadataStorage() {
@@ -361,17 +323,11 @@ function getMetadataStorage() {
361
323
  return global.bigAlMetadataArgsStorage;
362
324
  }
363
325
 
364
- var __defProp$1 = Object.defineProperty;
365
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
366
- var __publicField$1 = (obj, key, value) => {
367
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
368
- return value;
369
- };
370
326
  class QueryError extends Error {
327
+ model;
328
+ where;
371
329
  constructor(message, model, where) {
372
330
  super(message);
373
- __publicField$1(this, "model");
374
- __publicField$1(this, "where");
375
331
  this.name = "QueryError";
376
332
  this.model = model;
377
333
  this.where = where;
@@ -1344,21 +1300,15 @@ function isComparer(value) {
1344
1300
  }
1345
1301
  }
1346
1302
 
1347
- var __defProp = Object.defineProperty;
1348
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1349
- var __publicField = (obj, key, value) => {
1350
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1351
- return value;
1352
- };
1353
1303
  class ReadonlyRepository {
1304
+ _modelMetadata;
1305
+ _type;
1306
+ _pool;
1307
+ _readonlyPool;
1308
+ _repositoriesByModelNameLowered;
1309
+ _floatProperties = [];
1310
+ _intProperties = [];
1354
1311
  constructor({ modelMetadata, type, pool, readonlyPool, repositoriesByModelNameLowered }) {
1355
- __publicField(this, "_modelMetadata");
1356
- __publicField(this, "_type");
1357
- __publicField(this, "_pool");
1358
- __publicField(this, "_readonlyPool");
1359
- __publicField(this, "_repositoriesByModelNameLowered");
1360
- __publicField(this, "_floatProperties", []);
1361
- __publicField(this, "_intProperties", []);
1362
1312
  this._modelMetadata = modelMetadata;
1363
1313
  this._type = type;
1364
1314
  this._pool = pool;
package/dist/index.mjs CHANGED
@@ -1,29 +1,59 @@
1
1
  import _ from 'lodash';
2
2
 
3
- var __defProp$7 = Object.defineProperty;
4
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
- var __publicField$7 = (obj, key, value) => {
6
- __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
7
- return value;
8
- };
9
3
  class MetadataStorage {
10
- constructor() {
11
- __publicField$7(this, "models", []);
12
- // All columns for all models. This data only represents @column specifics, not additional column modifiers
13
- __publicField$7(this, "columns", []);
14
- // This represents additional column behavior separate from the main @column decorator. For example, @primaryColumn, @versionColumn, etc
15
- // This behavior will be merged over defaults from @column()
16
- __publicField$7(this, "columnModifiers", []);
17
- }
4
+ models = [];
5
+ // All columns for all models. This data only represents @column specifics, not additional column modifiers
6
+ columns = [];
7
+ // This represents additional column behavior separate from the main @column decorator. For example, @primaryColumn, @versionColumn, etc
8
+ // This behavior will be merged over defaults from @column()
9
+ columnModifiers = [];
18
10
  }
19
11
 
20
- var __defProp$6 = Object.defineProperty;
21
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22
- var __publicField$6 = (obj, key, value) => {
23
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
24
- return value;
25
- };
26
12
  class ColumnBaseMetadata {
13
+ /**
14
+ * Name of class with @table decorator
15
+ */
16
+ target;
17
+ /**
18
+ * Column name in the database
19
+ */
20
+ name;
21
+ /**
22
+ * Class property to which the column is applied
23
+ */
24
+ propertyName;
25
+ /**
26
+ * Indicates if a value is required for creates.
27
+ */
28
+ required;
29
+ /**
30
+ * Indicates if column is inserted by default. Default is true
31
+ */
32
+ insert;
33
+ /**
34
+ * Indicates if column value is updated by "save" operation. Default is true
35
+ */
36
+ update;
37
+ /**
38
+ * Indicates if this column is a primary key.
39
+ * Same can be achieved when @primaryColumn decorator is used
40
+ */
41
+ primary;
42
+ /**
43
+ * Value will be equal to `new Date()` when the row is inserted into the table
44
+ * Same can be achieved when @createDateColumn decorator is used
45
+ */
46
+ createDate;
47
+ /**
48
+ * Value will be equal to `new Date()` when the row is updated
49
+ * Same can be achieved when @updateDateColumn decorator is used
50
+ */
51
+ updateDate;
52
+ /**
53
+ * Value will be set to 1 when the row is inserted. Value will be incremented by one when the row is updated
54
+ * Same can be achieved when @versionColumn decorator is used
55
+ */
56
+ version;
27
57
  constructor({
28
58
  target,
29
59
  name,
@@ -36,50 +66,6 @@ class ColumnBaseMetadata {
36
66
  updateDate = false,
37
67
  version = false
38
68
  }) {
39
- /**
40
- * Name of class with @table decorator
41
- */
42
- __publicField$6(this, "target");
43
- /**
44
- * Column name in the database
45
- */
46
- __publicField$6(this, "name");
47
- /**
48
- * Class property to which the column is applied
49
- */
50
- __publicField$6(this, "propertyName");
51
- /**
52
- * Indicates if a value is required for creates.
53
- */
54
- __publicField$6(this, "required");
55
- /**
56
- * Indicates if column is inserted by default. Default is true
57
- */
58
- __publicField$6(this, "insert");
59
- /**
60
- * Indicates if column value is updated by "save" operation. Default is true
61
- */
62
- __publicField$6(this, "update");
63
- /**
64
- * Indicates if this column is a primary key.
65
- * Same can be achieved when @primaryColumn decorator is used
66
- */
67
- __publicField$6(this, "primary");
68
- /**
69
- * Value will be equal to `new Date()` when the row is inserted into the table
70
- * Same can be achieved when @createDateColumn decorator is used
71
- */
72
- __publicField$6(this, "createDate");
73
- /**
74
- * Value will be equal to `new Date()` when the row is updated
75
- * Same can be achieved when @updateDateColumn decorator is used
76
- */
77
- __publicField$6(this, "updateDate");
78
- /**
79
- * Value will be set to 1 when the row is inserted. Value will be incremented by one when the row is updated
80
- * Same can be achieved when @versionColumn decorator is used
81
- */
82
- __publicField$6(this, "version");
83
69
  this.target = target;
84
70
  this.name = name;
85
71
  this.propertyName = propertyName;
@@ -93,13 +79,41 @@ class ColumnBaseMetadata {
93
79
  }
94
80
  }
95
81
 
96
- var __defProp$5 = Object.defineProperty;
97
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
98
- var __publicField$5 = (obj, key, value) => {
99
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
100
- return value;
101
- };
102
82
  class ColumnCollectionMetadata extends ColumnBaseMetadata {
83
+ _collectionString;
84
+ _collectionFn;
85
+ _throughString;
86
+ _throughFn;
87
+ /**
88
+ * Type of the items in the collection
89
+ */
90
+ get collection() {
91
+ if (this._collectionString) {
92
+ return this._collectionString;
93
+ }
94
+ if (!this._collectionFn) {
95
+ throw new Error(`Unable to determine collection type for ${this.target}#${this.propertyName}`);
96
+ }
97
+ this._collectionString = this._collectionFn();
98
+ return this._collectionString;
99
+ }
100
+ /**
101
+ * Property name of the on the collection item type
102
+ */
103
+ via;
104
+ /**
105
+ * Name of the junction table for multi-multi associations
106
+ */
107
+ get through() {
108
+ if (this._throughString) {
109
+ return this._throughString;
110
+ }
111
+ if (this._throughFn) {
112
+ this._throughString = this._throughFn();
113
+ return this._throughString;
114
+ }
115
+ return void 0;
116
+ }
103
117
  constructor({
104
118
  target,
105
119
  //
@@ -128,14 +142,6 @@ class ColumnCollectionMetadata extends ColumnBaseMetadata {
128
142
  updateDate,
129
143
  version
130
144
  });
131
- __publicField$5(this, "_collectionString");
132
- __publicField$5(this, "_collectionFn");
133
- __publicField$5(this, "_throughString");
134
- __publicField$5(this, "_throughFn");
135
- /**
136
- * Property name of the on the collection item type
137
- */
138
- __publicField$5(this, "via");
139
145
  this.via = via;
140
146
  if (typeof collection === "string") {
141
147
  this._collectionString = collection;
@@ -148,41 +154,24 @@ class ColumnCollectionMetadata extends ColumnBaseMetadata {
148
154
  this._throughFn = through;
149
155
  }
150
156
  }
157
+ }
158
+
159
+ class ColumnModelMetadata extends ColumnBaseMetadata {
160
+ _modelString;
161
+ _modelFn;
151
162
  /**
152
- * Type of the items in the collection
153
- */
154
- get collection() {
155
- if (this._collectionString) {
156
- return this._collectionString;
157
- }
158
- if (!this._collectionFn) {
159
- throw new Error(`Unable to determine collection type for ${this.target}#${this.propertyName}`);
160
- }
161
- this._collectionString = this._collectionFn();
162
- return this._collectionString;
163
- }
164
- /**
165
- * Name of the junction table for multi-multi associations
163
+ * Name of the model represented by this column id
166
164
  */
167
- get through() {
168
- if (this._throughString) {
169
- return this._throughString;
165
+ get model() {
166
+ if (this._modelString) {
167
+ return this._modelString;
170
168
  }
171
- if (this._throughFn) {
172
- this._throughString = this._throughFn();
173
- return this._throughString;
169
+ if (!this._modelFn) {
170
+ throw new Error(`Unable to determine model type for ${this.target}#${this.propertyName}`);
174
171
  }
175
- return void 0;
172
+ this._modelString = this._modelFn();
173
+ return this._modelString;
176
174
  }
177
- }
178
-
179
- var __defProp$4 = Object.defineProperty;
180
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
181
- var __publicField$4 = (obj, key, value) => {
182
- __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
183
- return value;
184
- };
185
- class ColumnModelMetadata extends ColumnBaseMetadata {
186
175
  constructor({
187
176
  target,
188
177
  //
@@ -209,36 +198,33 @@ class ColumnModelMetadata extends ColumnBaseMetadata {
209
198
  updateDate,
210
199
  version
211
200
  });
212
- __publicField$4(this, "_modelString");
213
- __publicField$4(this, "_modelFn");
214
201
  if (typeof model === "string") {
215
202
  this._modelString = model;
216
203
  } else {
217
204
  this._modelFn = model;
218
205
  }
219
206
  }
220
- /**
221
- * Name of the model represented by this column id
222
- */
223
- get model() {
224
- if (this._modelString) {
225
- return this._modelString;
226
- }
227
- if (!this._modelFn) {
228
- throw new Error(`Unable to determine model type for ${this.target}#${this.propertyName}`);
229
- }
230
- this._modelString = this._modelFn();
231
- return this._modelString;
232
- }
233
207
  }
234
208
 
235
- var __defProp$3 = Object.defineProperty;
236
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
237
- var __publicField$3 = (obj, key, value) => {
238
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
239
- return value;
240
- };
241
209
  class ColumnTypeMetadata extends ColumnBaseMetadata {
210
+ /**
211
+ * Type of the column
212
+ */
213
+ type;
214
+ /**
215
+ * Default database value
216
+ */
217
+ defaultsTo;
218
+ /**
219
+ * Array of possible enumerated values
220
+ */
221
+ enum;
222
+ /**
223
+ * If set, enforces a maximum length check on the column
224
+ *
225
+ * Applies to types: string | string[]
226
+ */
227
+ maxLength;
242
228
  constructor(options) {
243
229
  super({
244
230
  target: options.target,
@@ -252,24 +238,6 @@ class ColumnTypeMetadata extends ColumnBaseMetadata {
252
238
  updateDate: options.updateDate,
253
239
  version: options.version
254
240
  });
255
- /**
256
- * Type of the column
257
- */
258
- __publicField$3(this, "type");
259
- /**
260
- * Default database value
261
- */
262
- __publicField$3(this, "defaultsTo");
263
- /**
264
- * Array of possible enumerated values
265
- */
266
- __publicField$3(this, "enum");
267
- /**
268
- * If set, enforces a maximum length check on the column
269
- *
270
- * Applies to types: string | string[]
271
- */
272
- __publicField$3(this, "maxLength");
273
241
  this.type = options.type;
274
242
  this.defaultsTo = options.defaultsTo;
275
243
  this.enum = options.enum;
@@ -277,39 +245,12 @@ class ColumnTypeMetadata extends ColumnBaseMetadata {
277
245
  }
278
246
  }
279
247
 
280
- var __defProp$2 = Object.defineProperty;
281
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
282
- var __publicField$2 = (obj, key, value) => {
283
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
284
- return value;
285
- };
286
248
  class ModelMetadata {
287
- constructor({
288
- name,
289
- //
290
- type,
291
- connection,
292
- tableName,
293
- readonly = false
294
- }) {
295
- __publicField$2(this, "_columns", []);
296
- __publicField$2(this, "_primaryKeyColumn");
297
- __publicField$2(this, "_createDateColumns", []);
298
- __publicField$2(this, "_updateDateColumns", []);
299
- __publicField$2(this, "_versionDateColumns", []);
300
- __publicField$2(this, "name");
301
- __publicField$2(this, "type");
302
- __publicField$2(this, "connection");
303
- __publicField$2(this, "tableName");
304
- __publicField$2(this, "readonly");
305
- __publicField$2(this, "columnsByColumnName", {});
306
- __publicField$2(this, "columnsByPropertyName", {});
307
- this.name = name;
308
- this.type = type;
309
- this.connection = connection;
310
- this.tableName = tableName ?? _.snakeCase(name);
311
- this.readonly = readonly;
312
- }
249
+ _columns = [];
250
+ _primaryKeyColumn;
251
+ _createDateColumns = [];
252
+ _updateDateColumns = [];
253
+ _versionDateColumns = [];
313
254
  set columns(columns) {
314
255
  this._columns = columns;
315
256
  this.columnsByColumnName = {};
@@ -346,6 +287,27 @@ class ModelMetadata {
346
287
  get versionColumns() {
347
288
  return this._versionDateColumns;
348
289
  }
290
+ name;
291
+ type;
292
+ connection;
293
+ tableName;
294
+ readonly;
295
+ columnsByColumnName = {};
296
+ columnsByPropertyName = {};
297
+ constructor({
298
+ name,
299
+ //
300
+ type,
301
+ connection,
302
+ tableName,
303
+ readonly = false
304
+ }) {
305
+ this.name = name;
306
+ this.type = type;
307
+ this.connection = connection;
308
+ this.tableName = tableName ?? _.snakeCase(name);
309
+ this.readonly = readonly;
310
+ }
349
311
  }
350
312
 
351
313
  function getMetadataStorage() {
@@ -355,17 +317,11 @@ function getMetadataStorage() {
355
317
  return global.bigAlMetadataArgsStorage;
356
318
  }
357
319
 
358
- var __defProp$1 = Object.defineProperty;
359
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
360
- var __publicField$1 = (obj, key, value) => {
361
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
362
- return value;
363
- };
364
320
  class QueryError extends Error {
321
+ model;
322
+ where;
365
323
  constructor(message, model, where) {
366
324
  super(message);
367
- __publicField$1(this, "model");
368
- __publicField$1(this, "where");
369
325
  this.name = "QueryError";
370
326
  this.model = model;
371
327
  this.where = where;
@@ -1338,21 +1294,15 @@ function isComparer(value) {
1338
1294
  }
1339
1295
  }
1340
1296
 
1341
- var __defProp = Object.defineProperty;
1342
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1343
- var __publicField = (obj, key, value) => {
1344
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1345
- return value;
1346
- };
1347
1297
  class ReadonlyRepository {
1298
+ _modelMetadata;
1299
+ _type;
1300
+ _pool;
1301
+ _readonlyPool;
1302
+ _repositoriesByModelNameLowered;
1303
+ _floatProperties = [];
1304
+ _intProperties = [];
1348
1305
  constructor({ modelMetadata, type, pool, readonlyPool, repositoriesByModelNameLowered }) {
1349
- __publicField(this, "_modelMetadata");
1350
- __publicField(this, "_type");
1351
- __publicField(this, "_pool");
1352
- __publicField(this, "_readonlyPool");
1353
- __publicField(this, "_repositoriesByModelNameLowered");
1354
- __publicField(this, "_floatProperties", []);
1355
- __publicField(this, "_intProperties", []);
1356
1306
  this._modelMetadata = modelMetadata;
1357
1307
  this._type = type;
1358
1308
  this._pool = pool;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bigal",
3
- "version": "13.0.4",
3
+ "version": "13.0.5",
4
4
  "description": "A fast and lightweight orm for postgres and node.js, written in typescript.",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -36,29 +36,29 @@
36
36
  "@types/pg": "^8.11.10",
37
37
  "lodash": "^4.17.21",
38
38
  "pg": "^8.13.1",
39
- "postgres-pool": "^9.0.4"
39
+ "postgres-pool": "^9.0.5"
40
40
  },
41
41
  "devDependencies": {
42
- "@faker-js/faker": "^9.2.0",
42
+ "@faker-js/faker": "^9.3.0",
43
43
  "@types/chai": "^5.0.1",
44
44
  "@types/lodash": "^4.17.13",
45
45
  "@types/mocha": "10.0.10",
46
46
  "@types/node": ">=22",
47
47
  "chai": "^5.1.2",
48
- "eslint": "^9.16.0",
49
- "eslint-config-decent": "^2.2.3",
48
+ "eslint": "^9.17.0",
49
+ "eslint-config-decent": "^2.3.0",
50
50
  "husky": "^9.1.7",
51
- "lint-staged": "^15.2.10",
51
+ "lint-staged": "^15.2.11",
52
52
  "markdownlint-cli": "^0.43.0",
53
- "mocha": "^10.8.2",
53
+ "mocha": "^11.0.1",
54
54
  "npm-run-all": "^4.1.5",
55
55
  "pinst": "^3.0.0",
56
- "prettier": "^3.4.1",
56
+ "prettier": "^3.4.2",
57
57
  "strict-event-emitter-types": "^2.0.0",
58
58
  "ts-mockito": "^2.6.1",
59
59
  "ts-node": "^10.9.2",
60
60
  "typescript": "^5.7.2",
61
- "unbuild": "^2.0.0"
61
+ "unbuild": "^3.0.1"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "unbuild",