arkormx 2.12.8 → 2.12.10

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.
@@ -123,6 +123,9 @@ const readAppliedMigrationsState = (stateFilePath) => {
123
123
  version: 1,
124
124
  migrations: parsed.migrations.filter((migration) => {
125
125
  return typeof migration?.id === "string" && typeof migration?.file === "string" && typeof migration?.className === "string" && typeof migration?.appliedAt === "string" && (migration?.checksum === void 0 || typeof migration?.checksum === "string");
126
+ }).map((migration) => migration.operations === void 0 || Array.isArray(migration.operations) ? migration : {
127
+ ...migration,
128
+ operations: void 0
126
129
  }),
127
130
  runs: Array.isArray(parsed.runs) ? parsed.runs.filter((run) => {
128
131
  return typeof run?.id === "string" && typeof run?.appliedAt === "string" && Array.isArray(run?.migrationIds) && run.migrationIds.every((item) => typeof item === "string");
@@ -157,6 +160,20 @@ const deleteAppliedMigrationsStateFromStore = async (adapter, stateFilePath) =>
157
160
  writeAppliedMigrationsState(stateFilePath, createEmptyAppliedMigrationsState());
158
161
  return "file";
159
162
  };
163
+ /**
164
+ * Whether `identity` counts as applied in `state`.
165
+ *
166
+ * Passing a `checksum` makes an edited migration file count as *not* applied so
167
+ * it is re-run. That only suits the Prisma/file-backed flow, where re-applying a
168
+ * migration just rewrites the generated schema. Adapter-backed runtimes must
169
+ * omit the checksum and let the state store alone decide, since replaying an
170
+ * already-applied `up()` would run its SQL a second time.
171
+ *
172
+ * @param state
173
+ * @param identity
174
+ * @param checksum
175
+ * @returns
176
+ */
160
177
  const isMigrationApplied = (state, identity, checksum) => {
161
178
  const matched = state.migrations.find((migration) => migration.id === identity);
162
179
  if (!matched) return false;
@@ -3537,6 +3554,30 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
3537
3554
  tables: nextTables
3538
3555
  };
3539
3556
  };
3557
+ /**
3558
+ * Replays an applied migration's `up()` from the current file to recover its
3559
+ * schema plan.
3560
+ *
3561
+ * Only used for entries recorded before the plan was stored alongside them; the
3562
+ * result reflects the file as it stands now, which is why a recorded plan always
3563
+ * wins over this.
3564
+ *
3565
+ * @param migration
3566
+ * @param availableByIdentity
3567
+ * @returns
3568
+ */
3569
+ const replayAppliedMigrationPlan = async (migration, availableByIdentity) => {
3570
+ const migrationClass = availableByIdentity.get(migration.id);
3571
+ if (!migrationClass) throw new ArkormException(`Unable to rebuild persisted column mappings because migration [${migration.id}] could not be resolved from the current migration files.`, {
3572
+ operation: "migration.columnMappings",
3573
+ meta: {
3574
+ migrationId: migration.id,
3575
+ file: migration.file,
3576
+ className: migration.className
3577
+ }
3578
+ });
3579
+ return await getMigrationPlan(migrationClass, "up", { inert: true });
3580
+ };
3540
3581
  const rebuildPersistedColumnMappingsState = async (state, availableMigrations, features = resolvePersistedMetadataFeatures()) => {
3541
3582
  const availableByIdentity = new Map(availableMigrations.map(([migrationClass, file]) => [buildMigrationIdentity(file, migrationClass.name), migrationClass]));
3542
3583
  let nextState = createEmptyPersistedColumnMappingsState();
@@ -3549,16 +3590,7 @@ const rebuildPersistedColumnMappingsState = async (state, availableMigrations, f
3549
3590
  return left.index - right.index;
3550
3591
  });
3551
3592
  for (const { migration } of orderedMigrations) {
3552
- const migrationClass = availableByIdentity.get(migration.id);
3553
- if (!migrationClass) throw new ArkormException(`Unable to rebuild persisted column mappings because migration [${migration.id}] could not be resolved from the current migration files.`, {
3554
- operation: "migration.columnMappings",
3555
- meta: {
3556
- migrationId: migration.id,
3557
- file: migration.file,
3558
- className: migration.className
3559
- }
3560
- });
3561
- const operations = await getMigrationPlan(migrationClass, "up", { inert: true });
3593
+ const operations = migration.operations ?? await replayAppliedMigrationPlan(migration, availableByIdentity);
3562
3594
  nextState = applyOperationsToPersistedColumnMappingsState(nextState, operations, features);
3563
3595
  }
3564
3596
  return nextState;
@@ -4830,41 +4862,82 @@ var Relation = class {
4830
4862
  };
4831
4863
  return this;
4832
4864
  }
4865
+ where(whereOrColumn, value) {
4866
+ return this.constrain((query) => {
4867
+ if (typeof whereOrColumn === "function") return query.where(whereOrColumn);
4868
+ if (value !== void 0) return query.where(whereOrColumn, value);
4869
+ return query.where(whereOrColumn);
4870
+ });
4871
+ }
4872
+ orWhere(whereOrColumn, value) {
4873
+ return this.constrain((query) => {
4874
+ if (typeof whereOrColumn === "function") return query.orWhere(whereOrColumn);
4875
+ if (value !== void 0) return query.orWhere(whereOrColumn, value);
4876
+ return query.orWhere(whereOrColumn);
4877
+ });
4878
+ }
4833
4879
  /**
4834
- * Add a where clause to the relationship query.
4880
+ * Adds a NOT where clause to the query.
4835
4881
  *
4836
4882
  * @param where
4837
4883
  * @returns
4838
4884
  */
4839
- where(where) {
4840
- return this.constrain((query) => query.where(where));
4885
+ whereNot(where) {
4886
+ return this.constrain((query) => query.whereNot(where));
4841
4887
  }
4842
4888
  /**
4843
- * Adds an OR where clause to the query.
4889
+ * Adds an OR NOT where clause to the query.
4844
4890
  *
4845
4891
  * @param where
4846
4892
  * @returns
4847
4893
  */
4848
- orWhere(where) {
4849
- return this.constrain((query) => query.orWhere(where));
4894
+ orWhereNot(where) {
4895
+ return this.constrain((query) => query.orWhereNot(where));
4850
4896
  }
4851
4897
  /**
4852
- * Adds a NOT where clause to the query.
4898
+ * Apply a callback when the supplied value is truthy.
4853
4899
  *
4854
- * @param where
4900
+ * Keeping this on the relation avoids forcing callers to await `getQuery()`
4901
+ * merely to compose optional constraints.
4902
+ *
4903
+ * @param value
4904
+ * @param callback
4905
+ * @param defaultCallback
4855
4906
  * @returns
4856
4907
  */
4857
- whereNot(where) {
4858
- return this.constrain((query) => query.whereNot(where));
4908
+ when(value, callback, defaultCallback) {
4909
+ const resolved = typeof value === "function" ? value() : value;
4910
+ if (resolved) callback(this, resolved);
4911
+ else defaultCallback?.(this, resolved);
4912
+ return this;
4859
4913
  }
4860
4914
  /**
4861
- * Adds an OR NOT where clause to the query.
4915
+ * Apply a callback when the supplied value is falsy.
4862
4916
  *
4863
- * @param where
4917
+ * @param value
4918
+ * @param callback
4919
+ * @param defaultCallback
4864
4920
  * @returns
4865
4921
  */
4866
- orWhereNot(where) {
4867
- return this.constrain((query) => query.orWhereNot(where));
4922
+ unless(value, callback, defaultCallback) {
4923
+ const resolved = typeof value === "function" ? value() : value;
4924
+ if (!resolved) callback(this, resolved);
4925
+ else defaultCallback?.(this, resolved);
4926
+ return this;
4927
+ }
4928
+ /**
4929
+ * Pass the relation through a callback and preserve the chain.
4930
+ *
4931
+ * @param callback
4932
+ * @returns
4933
+ */
4934
+ tap(callback) {
4935
+ callback(this);
4936
+ return this;
4937
+ }
4938
+ /** Pass the relation into a callback and return its result. */
4939
+ pipe(callback) {
4940
+ return callback(this);
4868
4941
  }
4869
4942
  /**
4870
4943
  * Adds a null check for a key.
@@ -4885,6 +4958,24 @@ var Relation = class {
4885
4958
  return this.constrain((query) => query.whereNotNull(key));
4886
4959
  }
4887
4960
  /**
4961
+ * Adds an OR null check for a key.
4962
+ *
4963
+ * @param key
4964
+ * @returns
4965
+ */
4966
+ orWhereNull(key) {
4967
+ return this.constrain((query) => query.orWhereNull(key));
4968
+ }
4969
+ /**
4970
+ * Adds an OR not-null check for a key.
4971
+ *
4972
+ * @param key
4973
+ * @returns
4974
+ */
4975
+ orWhereNotNull(key) {
4976
+ return this.constrain((query) => query.orWhereNotNull(key));
4977
+ }
4978
+ /**
4888
4979
  * Adds a between range clause for a key.
4889
4980
  *
4890
4981
  * @param key
@@ -5334,6 +5425,140 @@ var Relation = class {
5334
5425
  return this.constrain((query) => query.with(relations));
5335
5426
  }
5336
5427
  /**
5428
+ * Add a relationship count/existence constraint to the related query.
5429
+ *
5430
+ * @param relation
5431
+ * @param operator
5432
+ * @param count
5433
+ * @param callback
5434
+ * @returns
5435
+ */
5436
+ has(relation, operator = ">=", count = 1, callback) {
5437
+ return this.constrain((query) => query.has(relation, operator, count, callback));
5438
+ }
5439
+ /**
5440
+ * Add an OR relationship count/existence constraint to the related query.
5441
+ *
5442
+ * @param relation
5443
+ * @param operator
5444
+ * @param count
5445
+ * @returns
5446
+ */
5447
+ orHas(relation, operator = ">=", count = 1) {
5448
+ return this.constrain((query) => query.orHas(relation, operator, count));
5449
+ }
5450
+ /**
5451
+ * Require the related query's model to have a nested relationship.
5452
+ *
5453
+ * @param relation
5454
+ * @param callback
5455
+ * @param operator
5456
+ * @param count
5457
+ * @returns
5458
+ */
5459
+ whereHas(relation, callback, operator = ">=", count = 1) {
5460
+ return this.constrain((query) => query.whereHas(relation, callback, operator, count));
5461
+ }
5462
+ /**
5463
+ * Add an OR nested relationship constraint to the related query.
5464
+ *
5465
+ * @param relation
5466
+ * @param callback
5467
+ * @param operator
5468
+ * @param count
5469
+ * @returns
5470
+ */
5471
+ orWhereHas(relation, callback, operator = ">=", count = 1) {
5472
+ return this.constrain((query) => query.orWhereHas(relation, callback, operator, count));
5473
+ }
5474
+ /**
5475
+ * Require the related query's model not to have a nested relationship.
5476
+ *
5477
+ * @param relation
5478
+ * @param callback
5479
+ * @returns
5480
+ */
5481
+ doesntHave(relation, callback) {
5482
+ return this.constrain((query) => query.doesntHave(relation, callback));
5483
+ }
5484
+ /**
5485
+ * Add an OR nested relationship absence constraint.
5486
+ *
5487
+ * @param relation
5488
+ * @returns
5489
+ */
5490
+ orDoesntHave(relation) {
5491
+ return this.constrain((query) => query.orDoesntHave(relation));
5492
+ }
5493
+ /**
5494
+ * Require a constrained nested relationship to be absent.
5495
+ *
5496
+ * @param relation
5497
+ * @param callback
5498
+ * @returns
5499
+ */
5500
+ whereDoesntHave(relation, callback) {
5501
+ return this.constrain((query) => query.whereDoesntHave(relation, callback));
5502
+ }
5503
+ /**
5504
+ * Add an OR constrained nested relationship absence clause.
5505
+ *
5506
+ * @param relation
5507
+ * @param callback
5508
+ * @returns
5509
+ */
5510
+ orWhereDoesntHave(relation, callback) {
5511
+ return this.constrain((query) => query.orWhereDoesntHave(relation, callback));
5512
+ }
5513
+ /**
5514
+ * Add a constrained polymorphic nested relationship clause.
5515
+ *
5516
+ * @param relation
5517
+ * @param types
5518
+ * @param callback
5519
+ * @param operator
5520
+ * @param count
5521
+ * @returns
5522
+ */
5523
+ whereHasMorph(relation, types, callback, operator = ">=", count = 1) {
5524
+ return this.constrain((query) => query.whereHasMorph(relation, types, callback, operator, count));
5525
+ }
5526
+ /**
5527
+ * Add an OR constrained polymorphic nested relationship clause.
5528
+ *
5529
+ * @param relation
5530
+ * @param types
5531
+ * @param callback
5532
+ * @param operator
5533
+ * @param count
5534
+ * @returns
5535
+ */
5536
+ orWhereHasMorph(relation, types, callback, operator = ">=", count = 1) {
5537
+ return this.constrain((query) => query.orWhereHasMorph(relation, types, callback, operator, count));
5538
+ }
5539
+ /**
5540
+ * Require a constrained polymorphic nested relationship to be absent.
5541
+ *
5542
+ * @param relation
5543
+ * @param types
5544
+ * @param callback
5545
+ * @returns
5546
+ */
5547
+ whereDoesntHaveMorph(relation, types, callback) {
5548
+ return this.constrain((query) => query.whereDoesntHaveMorph(relation, types, callback));
5549
+ }
5550
+ /**
5551
+ * Add an OR polymorphic nested relationship absence clause.
5552
+ *
5553
+ * @param relation
5554
+ * @param types
5555
+ * @param callback
5556
+ * @returns
5557
+ */
5558
+ orWhereDoesntHaveMorph(relation, types, callback) {
5559
+ return this.constrain((query) => query.orWhereDoesntHaveMorph(relation, types, callback));
5560
+ }
5561
+ /**
5337
5562
  * Add relationship count aggregates to the related-model query.
5338
5563
  *
5339
5564
  * @param relations
@@ -95,6 +95,9 @@ const readAppliedMigrationsState = (stateFilePath) => {
95
95
  version: 1,
96
96
  migrations: parsed.migrations.filter((migration) => {
97
97
  return typeof migration?.id === "string" && typeof migration?.file === "string" && typeof migration?.className === "string" && typeof migration?.appliedAt === "string" && (migration?.checksum === void 0 || typeof migration?.checksum === "string");
98
+ }).map((migration) => migration.operations === void 0 || Array.isArray(migration.operations) ? migration : {
99
+ ...migration,
100
+ operations: void 0
98
101
  }),
99
102
  runs: Array.isArray(parsed.runs) ? parsed.runs.filter((run) => {
100
103
  return typeof run?.id === "string" && typeof run?.appliedAt === "string" && Array.isArray(run?.migrationIds) && run.migrationIds.every((item) => typeof item === "string");
@@ -129,6 +132,20 @@ const deleteAppliedMigrationsStateFromStore = async (adapter, stateFilePath) =>
129
132
  writeAppliedMigrationsState(stateFilePath, createEmptyAppliedMigrationsState());
130
133
  return "file";
131
134
  };
135
+ /**
136
+ * Whether `identity` counts as applied in `state`.
137
+ *
138
+ * Passing a `checksum` makes an edited migration file count as *not* applied so
139
+ * it is re-run. That only suits the Prisma/file-backed flow, where re-applying a
140
+ * migration just rewrites the generated schema. Adapter-backed runtimes must
141
+ * omit the checksum and let the state store alone decide, since replaying an
142
+ * already-applied `up()` would run its SQL a second time.
143
+ *
144
+ * @param state
145
+ * @param identity
146
+ * @param checksum
147
+ * @returns
148
+ */
132
149
  const isMigrationApplied = (state, identity, checksum) => {
133
150
  const matched = state.migrations.find((migration) => migration.id === identity);
134
151
  if (!matched) return false;
@@ -3509,6 +3526,30 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
3509
3526
  tables: nextTables
3510
3527
  };
3511
3528
  };
3529
+ /**
3530
+ * Replays an applied migration's `up()` from the current file to recover its
3531
+ * schema plan.
3532
+ *
3533
+ * Only used for entries recorded before the plan was stored alongside them; the
3534
+ * result reflects the file as it stands now, which is why a recorded plan always
3535
+ * wins over this.
3536
+ *
3537
+ * @param migration
3538
+ * @param availableByIdentity
3539
+ * @returns
3540
+ */
3541
+ const replayAppliedMigrationPlan = async (migration, availableByIdentity) => {
3542
+ const migrationClass = availableByIdentity.get(migration.id);
3543
+ if (!migrationClass) throw new ArkormException(`Unable to rebuild persisted column mappings because migration [${migration.id}] could not be resolved from the current migration files.`, {
3544
+ operation: "migration.columnMappings",
3545
+ meta: {
3546
+ migrationId: migration.id,
3547
+ file: migration.file,
3548
+ className: migration.className
3549
+ }
3550
+ });
3551
+ return await getMigrationPlan(migrationClass, "up", { inert: true });
3552
+ };
3512
3553
  const rebuildPersistedColumnMappingsState = async (state, availableMigrations, features = resolvePersistedMetadataFeatures()) => {
3513
3554
  const availableByIdentity = new Map(availableMigrations.map(([migrationClass, file]) => [buildMigrationIdentity(file, migrationClass.name), migrationClass]));
3514
3555
  let nextState = createEmptyPersistedColumnMappingsState();
@@ -3521,16 +3562,7 @@ const rebuildPersistedColumnMappingsState = async (state, availableMigrations, f
3521
3562
  return left.index - right.index;
3522
3563
  });
3523
3564
  for (const { migration } of orderedMigrations) {
3524
- const migrationClass = availableByIdentity.get(migration.id);
3525
- if (!migrationClass) throw new ArkormException(`Unable to rebuild persisted column mappings because migration [${migration.id}] could not be resolved from the current migration files.`, {
3526
- operation: "migration.columnMappings",
3527
- meta: {
3528
- migrationId: migration.id,
3529
- file: migration.file,
3530
- className: migration.className
3531
- }
3532
- });
3533
- const operations = await getMigrationPlan(migrationClass, "up", { inert: true });
3565
+ const operations = migration.operations ?? await replayAppliedMigrationPlan(migration, availableByIdentity);
3534
3566
  nextState = applyOperationsToPersistedColumnMappingsState(nextState, operations, features);
3535
3567
  }
3536
3568
  return nextState;
@@ -4802,41 +4834,82 @@ var Relation = class {
4802
4834
  };
4803
4835
  return this;
4804
4836
  }
4837
+ where(whereOrColumn, value) {
4838
+ return this.constrain((query) => {
4839
+ if (typeof whereOrColumn === "function") return query.where(whereOrColumn);
4840
+ if (value !== void 0) return query.where(whereOrColumn, value);
4841
+ return query.where(whereOrColumn);
4842
+ });
4843
+ }
4844
+ orWhere(whereOrColumn, value) {
4845
+ return this.constrain((query) => {
4846
+ if (typeof whereOrColumn === "function") return query.orWhere(whereOrColumn);
4847
+ if (value !== void 0) return query.orWhere(whereOrColumn, value);
4848
+ return query.orWhere(whereOrColumn);
4849
+ });
4850
+ }
4805
4851
  /**
4806
- * Add a where clause to the relationship query.
4852
+ * Adds a NOT where clause to the query.
4807
4853
  *
4808
4854
  * @param where
4809
4855
  * @returns
4810
4856
  */
4811
- where(where) {
4812
- return this.constrain((query) => query.where(where));
4857
+ whereNot(where) {
4858
+ return this.constrain((query) => query.whereNot(where));
4813
4859
  }
4814
4860
  /**
4815
- * Adds an OR where clause to the query.
4861
+ * Adds an OR NOT where clause to the query.
4816
4862
  *
4817
4863
  * @param where
4818
4864
  * @returns
4819
4865
  */
4820
- orWhere(where) {
4821
- return this.constrain((query) => query.orWhere(where));
4866
+ orWhereNot(where) {
4867
+ return this.constrain((query) => query.orWhereNot(where));
4822
4868
  }
4823
4869
  /**
4824
- * Adds a NOT where clause to the query.
4870
+ * Apply a callback when the supplied value is truthy.
4825
4871
  *
4826
- * @param where
4872
+ * Keeping this on the relation avoids forcing callers to await `getQuery()`
4873
+ * merely to compose optional constraints.
4874
+ *
4875
+ * @param value
4876
+ * @param callback
4877
+ * @param defaultCallback
4827
4878
  * @returns
4828
4879
  */
4829
- whereNot(where) {
4830
- return this.constrain((query) => query.whereNot(where));
4880
+ when(value, callback, defaultCallback) {
4881
+ const resolved = typeof value === "function" ? value() : value;
4882
+ if (resolved) callback(this, resolved);
4883
+ else defaultCallback?.(this, resolved);
4884
+ return this;
4831
4885
  }
4832
4886
  /**
4833
- * Adds an OR NOT where clause to the query.
4887
+ * Apply a callback when the supplied value is falsy.
4834
4888
  *
4835
- * @param where
4889
+ * @param value
4890
+ * @param callback
4891
+ * @param defaultCallback
4836
4892
  * @returns
4837
4893
  */
4838
- orWhereNot(where) {
4839
- return this.constrain((query) => query.orWhereNot(where));
4894
+ unless(value, callback, defaultCallback) {
4895
+ const resolved = typeof value === "function" ? value() : value;
4896
+ if (!resolved) callback(this, resolved);
4897
+ else defaultCallback?.(this, resolved);
4898
+ return this;
4899
+ }
4900
+ /**
4901
+ * Pass the relation through a callback and preserve the chain.
4902
+ *
4903
+ * @param callback
4904
+ * @returns
4905
+ */
4906
+ tap(callback) {
4907
+ callback(this);
4908
+ return this;
4909
+ }
4910
+ /** Pass the relation into a callback and return its result. */
4911
+ pipe(callback) {
4912
+ return callback(this);
4840
4913
  }
4841
4914
  /**
4842
4915
  * Adds a null check for a key.
@@ -4857,6 +4930,24 @@ var Relation = class {
4857
4930
  return this.constrain((query) => query.whereNotNull(key));
4858
4931
  }
4859
4932
  /**
4933
+ * Adds an OR null check for a key.
4934
+ *
4935
+ * @param key
4936
+ * @returns
4937
+ */
4938
+ orWhereNull(key) {
4939
+ return this.constrain((query) => query.orWhereNull(key));
4940
+ }
4941
+ /**
4942
+ * Adds an OR not-null check for a key.
4943
+ *
4944
+ * @param key
4945
+ * @returns
4946
+ */
4947
+ orWhereNotNull(key) {
4948
+ return this.constrain((query) => query.orWhereNotNull(key));
4949
+ }
4950
+ /**
4860
4951
  * Adds a between range clause for a key.
4861
4952
  *
4862
4953
  * @param key
@@ -5306,6 +5397,140 @@ var Relation = class {
5306
5397
  return this.constrain((query) => query.with(relations));
5307
5398
  }
5308
5399
  /**
5400
+ * Add a relationship count/existence constraint to the related query.
5401
+ *
5402
+ * @param relation
5403
+ * @param operator
5404
+ * @param count
5405
+ * @param callback
5406
+ * @returns
5407
+ */
5408
+ has(relation, operator = ">=", count = 1, callback) {
5409
+ return this.constrain((query) => query.has(relation, operator, count, callback));
5410
+ }
5411
+ /**
5412
+ * Add an OR relationship count/existence constraint to the related query.
5413
+ *
5414
+ * @param relation
5415
+ * @param operator
5416
+ * @param count
5417
+ * @returns
5418
+ */
5419
+ orHas(relation, operator = ">=", count = 1) {
5420
+ return this.constrain((query) => query.orHas(relation, operator, count));
5421
+ }
5422
+ /**
5423
+ * Require the related query's model to have a nested relationship.
5424
+ *
5425
+ * @param relation
5426
+ * @param callback
5427
+ * @param operator
5428
+ * @param count
5429
+ * @returns
5430
+ */
5431
+ whereHas(relation, callback, operator = ">=", count = 1) {
5432
+ return this.constrain((query) => query.whereHas(relation, callback, operator, count));
5433
+ }
5434
+ /**
5435
+ * Add an OR nested relationship constraint to the related query.
5436
+ *
5437
+ * @param relation
5438
+ * @param callback
5439
+ * @param operator
5440
+ * @param count
5441
+ * @returns
5442
+ */
5443
+ orWhereHas(relation, callback, operator = ">=", count = 1) {
5444
+ return this.constrain((query) => query.orWhereHas(relation, callback, operator, count));
5445
+ }
5446
+ /**
5447
+ * Require the related query's model not to have a nested relationship.
5448
+ *
5449
+ * @param relation
5450
+ * @param callback
5451
+ * @returns
5452
+ */
5453
+ doesntHave(relation, callback) {
5454
+ return this.constrain((query) => query.doesntHave(relation, callback));
5455
+ }
5456
+ /**
5457
+ * Add an OR nested relationship absence constraint.
5458
+ *
5459
+ * @param relation
5460
+ * @returns
5461
+ */
5462
+ orDoesntHave(relation) {
5463
+ return this.constrain((query) => query.orDoesntHave(relation));
5464
+ }
5465
+ /**
5466
+ * Require a constrained nested relationship to be absent.
5467
+ *
5468
+ * @param relation
5469
+ * @param callback
5470
+ * @returns
5471
+ */
5472
+ whereDoesntHave(relation, callback) {
5473
+ return this.constrain((query) => query.whereDoesntHave(relation, callback));
5474
+ }
5475
+ /**
5476
+ * Add an OR constrained nested relationship absence clause.
5477
+ *
5478
+ * @param relation
5479
+ * @param callback
5480
+ * @returns
5481
+ */
5482
+ orWhereDoesntHave(relation, callback) {
5483
+ return this.constrain((query) => query.orWhereDoesntHave(relation, callback));
5484
+ }
5485
+ /**
5486
+ * Add a constrained polymorphic nested relationship clause.
5487
+ *
5488
+ * @param relation
5489
+ * @param types
5490
+ * @param callback
5491
+ * @param operator
5492
+ * @param count
5493
+ * @returns
5494
+ */
5495
+ whereHasMorph(relation, types, callback, operator = ">=", count = 1) {
5496
+ return this.constrain((query) => query.whereHasMorph(relation, types, callback, operator, count));
5497
+ }
5498
+ /**
5499
+ * Add an OR constrained polymorphic nested relationship clause.
5500
+ *
5501
+ * @param relation
5502
+ * @param types
5503
+ * @param callback
5504
+ * @param operator
5505
+ * @param count
5506
+ * @returns
5507
+ */
5508
+ orWhereHasMorph(relation, types, callback, operator = ">=", count = 1) {
5509
+ return this.constrain((query) => query.orWhereHasMorph(relation, types, callback, operator, count));
5510
+ }
5511
+ /**
5512
+ * Require a constrained polymorphic nested relationship to be absent.
5513
+ *
5514
+ * @param relation
5515
+ * @param types
5516
+ * @param callback
5517
+ * @returns
5518
+ */
5519
+ whereDoesntHaveMorph(relation, types, callback) {
5520
+ return this.constrain((query) => query.whereDoesntHaveMorph(relation, types, callback));
5521
+ }
5522
+ /**
5523
+ * Add an OR polymorphic nested relationship absence clause.
5524
+ *
5525
+ * @param relation
5526
+ * @param types
5527
+ * @param callback
5528
+ * @returns
5529
+ */
5530
+ orWhereDoesntHaveMorph(relation, types, callback) {
5531
+ return this.constrain((query) => query.orWhereDoesntHaveMorph(relation, types, callback));
5532
+ }
5533
+ /**
5309
5534
  * Add relationship count aggregates to the related-model query.
5310
5535
  *
5311
5536
  * @param relations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkormx",
3
- "version": "2.12.8",
3
+ "version": "2.12.10",
4
4
  "description": "Modern TypeScript-first ORM for Node.js.",
5
5
  "keywords": [
6
6
  "orm",