arkormx 0.2.0 → 0.2.1

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/dist/index.cjs CHANGED
@@ -2203,9 +2203,14 @@ const defineFactory = (model, definition) => {
2203
2203
  * @since 0.1.0
2204
2204
  */
2205
2205
  var ModelNotFoundException = class extends ArkormException {
2206
- constructor(message = "No query results for the given model.") {
2206
+ modelName;
2207
+ constructor(modelName, message = "No query results for the given model.") {
2207
2208
  super(message);
2208
2209
  this.name = "ModelNotFoundException";
2210
+ this.modelName = modelName;
2211
+ }
2212
+ getModelName() {
2213
+ return this.modelName;
2209
2214
  }
2210
2215
  };
2211
2216
 
@@ -3605,7 +3610,7 @@ var QueryBuilder = class QueryBuilder {
3605
3610
  */
3606
3611
  async firstOrFail() {
3607
3612
  const model = await this.first();
3608
- if (!model) throw new ModelNotFoundException("Record not found.");
3613
+ if (!model) throw new ModelNotFoundException(this.model.name, "Record not found.");
3609
3614
  return model;
3610
3615
  }
3611
3616
  async find(value, key = "id") {
@@ -3638,7 +3643,7 @@ var QueryBuilder = class QueryBuilder {
3638
3643
  */
3639
3644
  async valueOrFail(column) {
3640
3645
  const result = await this.value(column);
3641
- if (result == null) throw new ModelNotFoundException("Record not found.");
3646
+ if (result == null) throw new ModelNotFoundException(this.model.name, "Record not found.");
3642
3647
  return result;
3643
3648
  }
3644
3649
  /**
package/dist/index.d.cts CHANGED
@@ -2630,7 +2630,9 @@ declare class ArkormException extends Error {
2630
2630
  * @since 0.1.0
2631
2631
  */
2632
2632
  declare class ModelNotFoundException extends ArkormException {
2633
- constructor(message?: string);
2633
+ private modelName;
2634
+ constructor(modelName: string, message?: string);
2635
+ getModelName(): string;
2634
2636
  }
2635
2637
  //#endregion
2636
2638
  //#region src/helpers/migrations.d.ts
package/dist/index.d.mts CHANGED
@@ -2630,7 +2630,9 @@ declare class ArkormException extends Error {
2630
2630
  * @since 0.1.0
2631
2631
  */
2632
2632
  declare class ModelNotFoundException extends ArkormException {
2633
- constructor(message?: string);
2633
+ private modelName;
2634
+ constructor(modelName: string, message?: string);
2635
+ getModelName(): string;
2634
2636
  }
2635
2637
  //#endregion
2636
2638
  //#region src/helpers/migrations.d.ts
package/dist/index.mjs CHANGED
@@ -2174,9 +2174,14 @@ const defineFactory = (model, definition) => {
2174
2174
  * @since 0.1.0
2175
2175
  */
2176
2176
  var ModelNotFoundException = class extends ArkormException {
2177
- constructor(message = "No query results for the given model.") {
2177
+ modelName;
2178
+ constructor(modelName, message = "No query results for the given model.") {
2178
2179
  super(message);
2179
2180
  this.name = "ModelNotFoundException";
2181
+ this.modelName = modelName;
2182
+ }
2183
+ getModelName() {
2184
+ return this.modelName;
2180
2185
  }
2181
2186
  };
2182
2187
 
@@ -3576,7 +3581,7 @@ var QueryBuilder = class QueryBuilder {
3576
3581
  */
3577
3582
  async firstOrFail() {
3578
3583
  const model = await this.first();
3579
- if (!model) throw new ModelNotFoundException("Record not found.");
3584
+ if (!model) throw new ModelNotFoundException(this.model.name, "Record not found.");
3580
3585
  return model;
3581
3586
  }
3582
3587
  async find(value, key = "id") {
@@ -3609,7 +3614,7 @@ var QueryBuilder = class QueryBuilder {
3609
3614
  */
3610
3615
  async valueOrFail(column) {
3611
3616
  const result = await this.value(column);
3612
- if (result == null) throw new ModelNotFoundException("Record not found.");
3617
+ if (result == null) throw new ModelNotFoundException(this.model.name, "Record not found.");
3613
3618
  return result;
3614
3619
  }
3615
3620
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkormx",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Modern TypeScript-first ORM for Node.js.",
5
5
  "keywords": [
6
6
  "orm",