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.
@@ -108,6 +108,7 @@ export class PostgresSchemaBuilder {
108
108
  }
109
109
  catch (err) {
110
110
  console.error('failed verify structure of ' + e.$entityName + ' ', err);
111
+ throw err;
111
112
  }
112
113
  }
113
114
  }
@@ -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
@@ -1 +1,2 @@
1
1
  export {};
2
+ //p2 - fix sql log to console to make more sense
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.22.11",
3
+ "version": "0.22.12",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "types": "index.d.ts",
6
6
  "module": "esm/index.js",
@@ -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
- return [3 /*break*/, 8];
182
+ throw err_1;
183
183
  case 8:
184
184
  entities_1_1 = entities_1.next();
185
185
  return [3 /*break*/, 1];
@@ -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
- if (!remult)
613
- remult = remult_proxy_1.remult;
614
- entities = context_1.allEntities.map(function (x) { return remult.repo(x).metadata; });
615
- this.ensureSchema(entities);
616
- return [2 /*return*/];
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
- return [3 /*break*/, 8];
657
+ throw err_2;
653
658
  case 8:
654
659
  entities_1_1 = entities_1.next();
655
660
  return [3 /*break*/, 1];
@@ -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
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //p2 - fix sql log to console to make more sense