remult 0.22.11 → 0.22.12
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/esm/postgres/schema-builder.js +1 -0
- package/esm/remult-knex/index.js +2 -1
- package/esm/src/remult3/Fields.d.ts +0 -20
- package/esm/src/remult3/remult3.js +1 -0
- package/package.json +1 -1
- package/postgres/schema-builder.js +1 -1
- package/remult-knex/index.js +11 -6
- package/src/remult3/Fields.d.ts +0 -20
- package/src/remult3/remult3.js +1 -0
package/esm/remult-knex/index.js
CHANGED
|
@@ -313,7 +313,7 @@ export class KnexSchemaBuilder {
|
|
|
313
313
|
if (!remult)
|
|
314
314
|
remult = remultContext;
|
|
315
315
|
const entities = allEntities.map((x) => remult.repo(x).metadata);
|
|
316
|
-
this.ensureSchema(entities);
|
|
316
|
+
await this.ensureSchema(entities);
|
|
317
317
|
}
|
|
318
318
|
async ensureSchema(entities) {
|
|
319
319
|
for (const entity of entities) {
|
|
@@ -328,6 +328,7 @@ export class KnexSchemaBuilder {
|
|
|
328
328
|
}
|
|
329
329
|
catch (err) {
|
|
330
330
|
console.error('failed ensure schema of ' + e.$entityName + ' ', err);
|
|
331
|
+
throw err;
|
|
331
332
|
}
|
|
332
333
|
}
|
|
333
334
|
}
|
|
@@ -54,26 +54,6 @@ export declare class Relations {
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
static toOne<entityType, toEntityType>(toEntityType: () => ClassType<toEntityType>, fieldInMyEntity?: keyof entityType): ClassFieldDecorator<entityType, toEntityType | undefined>;
|
|
57
|
-
/**
|
|
58
|
-
* Define a to-one relation between entities, indicating a one-to-one relationship.
|
|
59
|
-
* This overload allows you to define the relation using options.
|
|
60
|
-
* If no field or fields are provided, it will automatically create a field in the database
|
|
61
|
-
* to represent the relation.
|
|
62
|
-
*
|
|
63
|
-
* @param toEntityType A function that returns the target entity type.
|
|
64
|
-
* @param options An object containing options for configuring the to-one relation.
|
|
65
|
-
* - field (Optional): The name of the field in the related entity that corresponds to this relation.
|
|
66
|
-
* @returns A decorator function to apply the virtual to-one relation to an entity field.
|
|
67
|
-
*
|
|
68
|
-
* Example usage:
|
|
69
|
-
* ```
|
|
70
|
-
* @Relations.toOne(() => Customer, {
|
|
71
|
-
* field: "customerId",
|
|
72
|
-
* })
|
|
73
|
-
* customer?: Customer;
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
static toOne<entityType, toEntityType>(toEntityType: () => ClassType<toEntityType>, fieldInMyEntity?: keyof entityType): ClassFieldDecorator<entityType, toEntityType | undefined>;
|
|
77
57
|
/**
|
|
78
58
|
* Define a to-one relation between entities, indicating a one-to-one relationship.
|
|
79
59
|
* If no field or fields are provided, it will automatically create a field in the database
|
package/package.json
CHANGED
|
@@ -179,7 +179,7 @@ var PostgresSchemaBuilder = /** @class */ (function () {
|
|
|
179
179
|
case 7:
|
|
180
180
|
err_1 = _b.sent();
|
|
181
181
|
console.error('failed verify structure of ' + e.$entityName + ' ', err_1);
|
|
182
|
-
|
|
182
|
+
throw err_1;
|
|
183
183
|
case 8:
|
|
184
184
|
entities_1_1 = entities_1.next();
|
|
185
185
|
return [3 /*break*/, 1];
|
package/remult-knex/index.js
CHANGED
|
@@ -609,11 +609,16 @@ var KnexSchemaBuilder = /** @class */ (function () {
|
|
|
609
609
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
610
610
|
var entities;
|
|
611
611
|
return tslib_1.__generator(this, function (_a) {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
612
|
+
switch (_a.label) {
|
|
613
|
+
case 0:
|
|
614
|
+
if (!remult)
|
|
615
|
+
remult = remult_proxy_1.remult;
|
|
616
|
+
entities = context_1.allEntities.map(function (x) { return remult.repo(x).metadata; });
|
|
617
|
+
return [4 /*yield*/, this.ensureSchema(entities)];
|
|
618
|
+
case 1:
|
|
619
|
+
_a.sent();
|
|
620
|
+
return [2 /*return*/];
|
|
621
|
+
}
|
|
617
622
|
});
|
|
618
623
|
});
|
|
619
624
|
};
|
|
@@ -649,7 +654,7 @@ var KnexSchemaBuilder = /** @class */ (function () {
|
|
|
649
654
|
case 7:
|
|
650
655
|
err_2 = _b.sent();
|
|
651
656
|
console.error('failed ensure schema of ' + e.$entityName + ' ', err_2);
|
|
652
|
-
|
|
657
|
+
throw err_2;
|
|
653
658
|
case 8:
|
|
654
659
|
entities_1_1 = entities_1.next();
|
|
655
660
|
return [3 /*break*/, 1];
|
package/src/remult3/Fields.d.ts
CHANGED
|
@@ -54,26 +54,6 @@ export declare class Relations {
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
static toOne<entityType, toEntityType>(toEntityType: () => ClassType<toEntityType>, fieldInMyEntity?: keyof entityType): ClassFieldDecorator<entityType, toEntityType | undefined>;
|
|
57
|
-
/**
|
|
58
|
-
* Define a to-one relation between entities, indicating a one-to-one relationship.
|
|
59
|
-
* This overload allows you to define the relation using options.
|
|
60
|
-
* If no field or fields are provided, it will automatically create a field in the database
|
|
61
|
-
* to represent the relation.
|
|
62
|
-
*
|
|
63
|
-
* @param toEntityType A function that returns the target entity type.
|
|
64
|
-
* @param options An object containing options for configuring the to-one relation.
|
|
65
|
-
* - field (Optional): The name of the field in the related entity that corresponds to this relation.
|
|
66
|
-
* @returns A decorator function to apply the virtual to-one relation to an entity field.
|
|
67
|
-
*
|
|
68
|
-
* Example usage:
|
|
69
|
-
* ```
|
|
70
|
-
* @Relations.toOne(() => Customer, {
|
|
71
|
-
* field: "customerId",
|
|
72
|
-
* })
|
|
73
|
-
* customer?: Customer;
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
static toOne<entityType, toEntityType>(toEntityType: () => ClassType<toEntityType>, fieldInMyEntity?: keyof entityType): ClassFieldDecorator<entityType, toEntityType | undefined>;
|
|
77
57
|
/**
|
|
78
58
|
* Define a to-one relation between entities, indicating a one-to-one relationship.
|
|
79
59
|
* If no field or fields are provided, it will automatically create a field in the database
|
package/src/remult3/remult3.js
CHANGED