arkormx 2.5.3 → 2.5.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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as applyOperationsToPersistedColumnMappingsState, $t as resolvePrismaType, A as getRuntimePrismaClient, An as writeAppliedMigrationsStateToStore, At as buildInverseRelationLine, B as getRegisteredModels, Bt as deriveRelationFieldName, C as getActiveTransactionClient, Cn as markMigrationRun, Ct as applyMigrationRollbackToPrismaSchema, D as getRuntimeDebugHandler, Dn as resolveMigrationStateFilePath, Dt as buildEnumBlock, E as getRuntimeClient, En as removeAppliedMigration, Et as applyOperationsToPrismaSchema, F as loadArkormConfig, Fn as RelationResolutionException, Ft as buildUniqueConstraintLine, G as loadModelsFrom, Gt as formatDefaultValue, H as getRegisteredSeeders, Ht as escapeRegex, I as resetArkormRuntimeForTests, In as ArkormCollection, It as createMigrationTimestamp, J as registerMigrations, Jt as generateMigrationFile, K as loadSeedersFrom, Kt as formatEnumDefaultValue, L as runArkormTransaction, Ln as ArkormException, Lt as deriveCollectionFieldName, M as isDelegateLike, Mn as UnsupportedAdapterFeatureException, Mt as buildModelBlock, N as isQuerySchemaLike, Nn as SetBasedEagerLoader, Nt as buildPrimaryKeyLine, O as getRuntimePaginationCurrentPageResolver, On as supportsDatabaseMigrationState, Ot as buildFieldLine, P as isTransactionCapableClient, Pt as buildRelationLine, Q as resetRuntimeRegistryForTests, Qt as resolveMigrationClassName, R as getRegisteredFactories, Rt as deriveInverseRelationAlias, S as getActiveTransactionAdapter, Sn as markMigrationApplied, St as applyMigrationRollbackToDatabase, T as getRuntimeAdapter, Tn as readAppliedMigrationsStateFromStore, Tt as applyMigrationToPrismaSchema, U as loadFactoriesFrom, Ut as findEnumBlock, V as getRegisteredPaths, Vt as deriveSingularFieldName, W as loadMigrationsFrom, Wt as findModelBlock, X as registerPaths, Xt as pad, Y as registerModels, Yt as getMigrationPlan, Z as registerSeeders, Zt as resolveEnumName, _ as bindAdapterToModels, _n as deleteAppliedMigrationsStateFromStore, _t as PRISMA_ENUM_REGEX, a as HasOneThroughRelation, an as supportsDatabaseReset, at as getPersistedPrimaryKeyGeneration, b as emitRuntimeDebugEvent, bn as getLatestAppliedMigrations, bt as applyCreateTableOperation, c as HasManyRelation, cn as SchemaBuilder, ct as readPersistedColumnMappingsState, d as BelongsToManyRelation, dn as PrimaryKeyGenerationPlanner, dt as resolveColumnMappingsFilePath, en as runMigrationWithPrisma, et as createEmptyPersistedColumnMappingsState, f as Relation, fn as ForeignKeyBuilder, ft as resolvePersistedMetadataFeatures, g as awaitConfiguredModelsRegistration, gn as createEmptyAppliedMigrationsState, gt as PRISMA_ENUM_MEMBER_REGEX, h as URLDriver, hn as computeMigrationChecksum, ht as writePersistedColumnMappingsState, i as MorphManyRelation, in as supportsDatabaseMigrationExecution, it as getPersistedEnumTsType, j as getUserConfig, jn as RuntimeModuleLoader, jt as buildMigrationSource, k as getRuntimePaginationURLDriverFactory, kn as writeAppliedMigrationsState, kt as buildIndexLine, l as BelongsToRelation, ln as EnumBuilder, lt as rebuildPersistedColumnMappingsState, m as Paginator, mn as buildMigrationRunId, mt as validatePersistedMetadataFeaturesForMigrations, n as MorphToManyRelation, nn as stripPrismaSchemaModelsAndEnums, nt as getPersistedColumnMap, o as HasOneRelation, on as toMigrationFileSlug, ot as getPersistedTableMetadata, p as LengthAwarePaginator, pn as buildMigrationIdentity, pt as syncPersistedColumnMappingsFromState, q as registerFactories, qt as formatRelationAction, r as MorphOneRelation, rn as supportsDatabaseCreation, rt as getPersistedEnumMap, s as HasManyThroughRelation, sn as toModelName, st as getPersistedTimestampColumns, t as MorphToRelation, tn as runPrismaCommand, tt as deletePersistedColumnMappingsState, un as TableBuilder, ut as resetPersistedColumnMappingsCache, v as configureArkormRuntime, vn as findAppliedMigration, vt as PRISMA_MODEL_REGEX, w as getDefaultStubsPath, wn as readAppliedMigrationsState, wt as applyMigrationToDatabase, x as ensureArkormConfigLoading, xn as isMigrationApplied, xt as applyDropTableOperation, y as defineConfig, yn as getLastMigrationRun, yt as applyAlterTableOperation, z as getRegisteredMigrations, zt as deriveRelationAlias } from "./relationship-huiFTxxu.mjs";
1
+ import { $ as applyOperationsToPersistedColumnMappingsState, $t as resolvePrismaType, A as getRuntimePrismaClient, An as writeAppliedMigrationsStateToStore, At as buildInverseRelationLine, B as getRegisteredModels, Bt as deriveRelationFieldName, C as getActiveTransactionClient, Cn as markMigrationRun, Ct as applyMigrationRollbackToPrismaSchema, D as getRuntimeDebugHandler, Dn as resolveMigrationStateFilePath, Dt as buildEnumBlock, E as getRuntimeClient, En as removeAppliedMigration, Et as applyOperationsToPrismaSchema, F as loadArkormConfig, Fn as RelationResolutionException, Ft as buildUniqueConstraintLine, G as loadModelsFrom, Gt as formatDefaultValue, H as getRegisteredSeeders, Ht as escapeRegex, I as resetArkormRuntimeForTests, In as ArkormCollection, It as createMigrationTimestamp, J as registerMigrations, Jt as generateMigrationFile, K as loadSeedersFrom, Kt as formatEnumDefaultValue, L as runArkormTransaction, Ln as ArkormException, Lt as deriveCollectionFieldName, M as isDelegateLike, Mn as UnsupportedAdapterFeatureException, Mt as buildModelBlock, N as isQuerySchemaLike, Nn as SetBasedEagerLoader, Nt as buildPrimaryKeyLine, O as getRuntimePaginationCurrentPageResolver, On as supportsDatabaseMigrationState, Ot as buildFieldLine, P as isTransactionCapableClient, Pt as buildRelationLine, Q as resetRuntimeRegistryForTests, Qt as resolveMigrationClassName, R as getRegisteredFactories, Rt as deriveInverseRelationAlias, S as getActiveTransactionAdapter, Sn as markMigrationApplied, St as applyMigrationRollbackToDatabase, T as getRuntimeAdapter, Tn as readAppliedMigrationsStateFromStore, Tt as applyMigrationToPrismaSchema, U as loadFactoriesFrom, Ut as findEnumBlock, V as getRegisteredPaths, Vt as deriveSingularFieldName, W as loadMigrationsFrom, Wt as findModelBlock, X as registerPaths, Xt as pad, Y as registerModels, Yt as getMigrationPlan, Z as registerSeeders, Zt as resolveEnumName, _ as bindAdapterToModels, _n as deleteAppliedMigrationsStateFromStore, _t as PRISMA_ENUM_REGEX, a as HasOneThroughRelation, an as supportsDatabaseReset, at as getPersistedPrimaryKeyGeneration, b as emitRuntimeDebugEvent, bn as getLatestAppliedMigrations, bt as applyCreateTableOperation, c as HasManyRelation, cn as SchemaBuilder, ct as readPersistedColumnMappingsState, d as BelongsToManyRelation, dn as PrimaryKeyGenerationPlanner, dt as resolveColumnMappingsFilePath, en as runMigrationWithPrisma, et as createEmptyPersistedColumnMappingsState, f as Relation, fn as ForeignKeyBuilder, ft as resolvePersistedMetadataFeatures, g as awaitConfiguredModelsRegistration, gn as createEmptyAppliedMigrationsState, gt as PRISMA_ENUM_MEMBER_REGEX, h as URLDriver, hn as computeMigrationChecksum, ht as writePersistedColumnMappingsState, i as MorphManyRelation, in as supportsDatabaseMigrationExecution, it as getPersistedEnumTsType, j as getUserConfig, jn as RuntimeModuleLoader, jt as buildMigrationSource, k as getRuntimePaginationURLDriverFactory, kn as writeAppliedMigrationsState, kt as buildIndexLine, l as BelongsToRelation, ln as EnumBuilder, lt as rebuildPersistedColumnMappingsState, m as Paginator, mn as buildMigrationRunId, mt as validatePersistedMetadataFeaturesForMigrations, n as MorphToManyRelation, nn as stripPrismaSchemaModelsAndEnums, nt as getPersistedColumnMap, o as HasOneRelation, on as toMigrationFileSlug, ot as getPersistedTableMetadata, p as LengthAwarePaginator, pn as buildMigrationIdentity, pt as syncPersistedColumnMappingsFromState, q as registerFactories, qt as formatRelationAction, r as MorphOneRelation, rn as supportsDatabaseCreation, rt as getPersistedEnumMap, s as HasManyThroughRelation, sn as toModelName, st as getPersistedTimestampColumns, t as MorphToRelation, tn as runPrismaCommand, tt as deletePersistedColumnMappingsState, un as TableBuilder, ut as resetPersistedColumnMappingsCache, v as configureArkormRuntime, vn as findAppliedMigration, vt as PRISMA_MODEL_REGEX, w as getDefaultStubsPath, wn as readAppliedMigrationsState, wt as applyMigrationToDatabase, x as ensureArkormConfigLoading, xn as isMigrationApplied, xt as applyDropTableOperation, y as defineConfig, yn as getLastMigrationRun, yt as applyAlterTableOperation, z as getRegisteredMigrations, zt as deriveRelationAlias } from "./relationship-C6oXK5EB.mjs";
2
2
  import { Pool } from "pg";
3
3
  import { join, resolve } from "node:path";
4
4
  import { createRequire } from "module";
@@ -432,9 +432,40 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
432
432
  if (parts.length === 0) return sql`1 = 1`;
433
433
  return sql`${sql.join(parts, sql``)}`;
434
434
  }
435
+ buildColumnComparisonCondition(target, condition) {
436
+ const left = sql.ref(this.mapColumn(target, condition.leftColumn));
437
+ const right = sql.ref(this.mapColumn(target, condition.rightColumn));
438
+ return sql`${left} ${sql.raw(condition.operator)} ${right}`;
439
+ }
440
+ buildTimeCondition(target, condition) {
441
+ return sql`${sql.ref(this.mapColumn(target, condition.column))}::time ${sql.raw(condition.operator)} ${condition.value}::time`;
442
+ }
443
+ buildDayCondition(target, condition) {
444
+ return sql`extract(day from ${sql.ref(this.mapColumn(target, condition.column))}) ${sql.raw(condition.operator)} ${condition.value}`;
445
+ }
446
+ buildExistsCondition(condition) {
447
+ const target = condition.query.target;
448
+ const where = this.buildWhereClause(target, condition.query.where);
449
+ return sql`exists (
450
+ select 1
451
+ from ${sql.table(this.resolveTable(target))}
452
+ ${where}
453
+ )`;
454
+ }
455
+ buildFullTextCondition(target, condition) {
456
+ const language = sql.raw(`'${condition.language ?? "simple"}'`);
457
+ return sql`to_tsvector(${language}, ${sql.join(condition.columns.map((column) => {
458
+ return sql`coalesce(${sql.ref(this.mapColumn(target, column))}::text, '')`;
459
+ }), sql` || ' ' || `)}) @@ plainto_tsquery(${language}, ${condition.value})`;
460
+ }
435
461
  buildWhereCondition(target, condition) {
436
462
  if (!condition) return sql`1 = 1`;
437
463
  if (condition.type === "comparison") return this.buildComparisonCondition(target, condition);
464
+ if (condition.type === "column-comparison") return this.buildColumnComparisonCondition(target, condition);
465
+ if (condition.type === "time") return this.buildTimeCondition(target, condition);
466
+ if (condition.type === "day") return this.buildDayCondition(target, condition);
467
+ if (condition.type === "exists") return this.buildExistsCondition(condition);
468
+ if (condition.type === "full-text") return this.buildFullTextCondition(target, condition);
438
469
  if (condition.type === "group") {
439
470
  const group = condition;
440
471
  const conditions = group.conditions.map((entry) => {
@@ -1381,13 +1412,17 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
1381
1412
  if (!nested) return void 0;
1382
1413
  return { NOT: nested };
1383
1414
  }
1384
- throw new UnsupportedAdapterFeatureException("Raw where clauses are not supported by the Prisma compatibility adapter; use a SQL-backed adapter for raw SQL predicates.", {
1415
+ if (condition.type === "raw") throw new UnsupportedAdapterFeatureException("Raw where clauses are not supported by the Prisma compatibility adapter; use a SQL-backed adapter for raw SQL predicates.", {
1385
1416
  operation: "adapter.where",
1386
1417
  meta: {
1387
1418
  feature: "rawWhere",
1388
1419
  sql: condition.sql
1389
1420
  }
1390
1421
  });
1422
+ throw new UnsupportedAdapterFeatureException(`Where condition [${condition.type}] is not supported by the Prisma compatibility adapter; use a SQL-backed adapter.`, {
1423
+ operation: "adapter.where",
1424
+ meta: { feature: condition.type }
1425
+ });
1391
1426
  }
1392
1427
  buildFindArgs(spec) {
1393
1428
  return {
@@ -3955,6 +3990,179 @@ var QueryBuilder = class QueryBuilder {
3955
3990
  lt: end
3956
3991
  } });
3957
3992
  }
3993
+ whereTime(key, operatorOrValue, maybeValue) {
3994
+ const hasOperator = maybeValue !== void 0;
3995
+ const operator = hasOperator ? operatorOrValue : "=";
3996
+ const value = hasOperator ? maybeValue : operatorOrValue;
3997
+ this.appendQueryCondition("AND", {
3998
+ type: "time",
3999
+ column: key,
4000
+ operator,
4001
+ value: this.normalizeTimeValue(value)
4002
+ });
4003
+ return this;
4004
+ }
4005
+ whereDay(key, operatorOrDay, maybeDay) {
4006
+ const hasOperator = maybeDay !== void 0;
4007
+ const operator = hasOperator ? operatorOrDay : "=";
4008
+ const day = Number(hasOperator ? maybeDay : operatorOrDay);
4009
+ if (!Number.isInteger(day) || day < 1 || day > 31) throw new ArkormException("whereDay() expects an integer between 1 and 31.");
4010
+ this.appendQueryCondition("AND", {
4011
+ type: "day",
4012
+ column: key,
4013
+ operator,
4014
+ value: day
4015
+ });
4016
+ return this;
4017
+ }
4018
+ /**
4019
+ * Adds clause to determine if a column's value is in the past
4020
+ *
4021
+ * @param key
4022
+ * @returns
4023
+ */
4024
+ wherePast(key) {
4025
+ return this.where({ [key]: { lt: /* @__PURE__ */ new Date() } });
4026
+ }
4027
+ /**
4028
+ * Adds clause to determine if a column's value is in the future
4029
+ *
4030
+ * @param key
4031
+ * @returns
4032
+ */
4033
+ whereFuture(key) {
4034
+ return this.where({ [key]: { gt: /* @__PURE__ */ new Date() } });
4035
+ }
4036
+ /**
4037
+ * Adds clause to determine if a column's value is in the past, inclusive of the current date and time
4038
+ *
4039
+ * @param key
4040
+ * @returns
4041
+ */
4042
+ whereNowOrPast(key) {
4043
+ return this.where({ [key]: { lte: /* @__PURE__ */ new Date() } });
4044
+ }
4045
+ /**
4046
+ * Adds clause to determine if a column's value is in the future, inclusive of the current date and time
4047
+ *
4048
+ * @param key
4049
+ * @returns
4050
+ */
4051
+ whereNowOrFuture(key) {
4052
+ return this.where({ [key]: { gte: /* @__PURE__ */ new Date() } });
4053
+ }
4054
+ /**
4055
+ * Adds clause to determine if a column's value is today
4056
+ *
4057
+ * @param key
4058
+ * @returns
4059
+ */
4060
+ whereToday(key) {
4061
+ const [start, end] = this.getUtcDayBounds();
4062
+ return this.where({ [key]: {
4063
+ gte: start,
4064
+ lt: end
4065
+ } });
4066
+ }
4067
+ /**
4068
+ * Adds clause to determine if a column's value is before today
4069
+ *
4070
+ * @param key
4071
+ * @returns
4072
+ */
4073
+ whereBeforeToday(key) {
4074
+ const [start] = this.getUtcDayBounds();
4075
+ return this.where({ [key]: { lt: start } });
4076
+ }
4077
+ /**
4078
+ * Adds clause to determine if a column's value is after today
4079
+ *
4080
+ * @param key
4081
+ * @returns
4082
+ */
4083
+ whereAfterToday(key) {
4084
+ const [, end] = this.getUtcDayBounds();
4085
+ return this.where({ [key]: { gte: end } });
4086
+ }
4087
+ /**
4088
+ * Adds clause to determine if a column's value is today or before today
4089
+ *
4090
+ * @param key
4091
+ * @returns
4092
+ */
4093
+ whereTodayOrBefore(key) {
4094
+ const [, end] = this.getUtcDayBounds();
4095
+ return this.where({ [key]: { lt: end } });
4096
+ }
4097
+ /**
4098
+ * Adds clause to determine if a column's value is today or after today
4099
+ *
4100
+ * @param key
4101
+ * @returns
4102
+ */
4103
+ whereTodayOrAfter(key) {
4104
+ const [start] = this.getUtcDayBounds();
4105
+ return this.where({ [key]: { gte: start } });
4106
+ }
4107
+ whereColumn(left, operatorOrRight, maybeRight) {
4108
+ this.appendQueryCondition("AND", {
4109
+ type: "column-comparison",
4110
+ leftColumn: left,
4111
+ operator: maybeRight === void 0 ? "=" : operatorOrRight,
4112
+ rightColumn: maybeRight ?? operatorOrRight
4113
+ });
4114
+ return this;
4115
+ }
4116
+ /**
4117
+ * Adds "where exists" SQL clauses.
4118
+ *
4119
+ * @param queryOrCallback
4120
+ * @returns
4121
+ */
4122
+ whereExists(queryOrCallback) {
4123
+ const baseQuery = new QueryBuilder(this.model, this.adapter);
4124
+ const existsQuery = typeof queryOrCallback === "function" ? queryOrCallback(baseQuery) ?? baseQuery : queryOrCallback;
4125
+ const spec = existsQuery.tryBuildSelectSpec(existsQuery.buildWhere());
4126
+ if (!spec) throw new UnsupportedAdapterFeatureException("Exists subquery could not be compiled.", {
4127
+ operation: "whereExists",
4128
+ model: this.model.name
4129
+ });
4130
+ this.appendQueryCondition("AND", {
4131
+ type: "exists",
4132
+ query: {
4133
+ ...spec,
4134
+ columns: void 0,
4135
+ orderBy: void 0,
4136
+ limit: void 0,
4137
+ offset: void 0,
4138
+ relationLoads: void 0,
4139
+ relationAggregates: void 0,
4140
+ relationFilters: void 0
4141
+ }
4142
+ });
4143
+ return this;
4144
+ }
4145
+ /**
4146
+ * Adds a fulltext clause for columns that have full text indexes.
4147
+ *
4148
+ * @param columns
4149
+ * @param value
4150
+ * @param options
4151
+ * @returns
4152
+ */
4153
+ whereFullText(columns, value, options = {}) {
4154
+ const normalizedColumns = Array.isArray(columns) ? columns : [columns];
4155
+ if (normalizedColumns.length === 0) throw new ArkormException("whereFullText() expects at least one column.");
4156
+ const language = options.language ?? "simple";
4157
+ if (!/^[a-z][a-z0-9_]*$/i.test(language)) throw new ArkormException("whereFullText() language must be a valid PostgreSQL text search configuration name.");
4158
+ this.appendQueryCondition("AND", {
4159
+ type: "full-text",
4160
+ columns: normalizedColumns,
4161
+ value,
4162
+ language
4163
+ });
4164
+ return this;
4165
+ }
3958
4166
  /**
3959
4167
  * Adds a strongly-typed inequality where clause for a single attribute key.
3960
4168
  *
@@ -4067,6 +4275,25 @@ var QueryBuilder = class QueryBuilder {
4067
4275
  if (Number.isNaN(parsed.getTime())) throw new ArkormException("Invalid date value for date-based query helper.");
4068
4276
  return parsed;
4069
4277
  }
4278
+ normalizeTimeValue(value) {
4279
+ if (value instanceof Date) {
4280
+ if (Number.isNaN(value.getTime())) throw new ArkormException("Invalid date value for whereTime().");
4281
+ return value.toISOString().slice(11, 19);
4282
+ }
4283
+ const matched = value.match(/^(\d{2}):(\d{2})(?::(\d{2}))?$/);
4284
+ if (!matched) throw new ArkormException("whereTime() expects a Date or a time string in HH:mm[:ss] format.");
4285
+ const hour = Number(matched[1]);
4286
+ const minute = Number(matched[2]);
4287
+ const second = Number(matched[3] ?? 0);
4288
+ if (hour > 23 || minute > 59 || second > 59) throw new ArkormException("whereTime() received an invalid time value.");
4289
+ return `${matched[1]}:${matched[2]}:${String(second).padStart(2, "0")}`;
4290
+ }
4291
+ getUtcDayBounds(value = /* @__PURE__ */ new Date()) {
4292
+ const start = new Date(Date.UTC(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate()));
4293
+ const end = new Date(start);
4294
+ end.setUTCDate(end.getUTCDate() + 1);
4295
+ return [start, end];
4296
+ }
4070
4297
  /**
4071
4298
  * Adds a strongly-typed equality where clause for a single attribute key.
4072
4299
  *
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_relationship = require('../relationship-uoGA5q9a.cjs');
2
+ const require_relationship = require('../relationship-CKQaNPdK.cjs');
3
3
 
4
4
  exports.BelongsToManyRelation = require_relationship.BelongsToManyRelation;
5
5
  exports.BelongsToRelation = require_relationship.BelongsToRelation;
@@ -1,2 +1,2 @@
1
- import { ao as MorphToManyRelation, co as HasOneThroughRelation, do as HasManyRelation, fo as BelongsToRelation, go as RelationTableLoader, ho as Relation, io as MorphToRelation, lo as HasOneRelation, mo as BelongsToManyRelation, oo as MorphOneRelation, po as SingleResultRelation, ro as SetBasedEagerLoader, so as MorphManyRelation, uo as HasManyThroughRelation } from "../index-B4brAVHp.cjs";
1
+ import { Co as BelongsToManyRelation, So as SingleResultRelation, To as RelationTableLoader, _o as HasOneThroughRelation, bo as HasManyRelation, fo as SetBasedEagerLoader, go as MorphManyRelation, ho as MorphOneRelation, mo as MorphToManyRelation, po as MorphToRelation, vo as HasOneRelation, wo as Relation, xo as BelongsToRelation, yo as HasManyThroughRelation } from "../index-BUn0wR2X.cjs";
2
2
  export { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasManyThroughRelation, HasOneRelation, HasOneThroughRelation, MorphManyRelation, MorphOneRelation, MorphToManyRelation, MorphToRelation, Relation, RelationTableLoader, SetBasedEagerLoader, SingleResultRelation };
@@ -1,2 +1,2 @@
1
- import { ao as MorphToManyRelation, co as HasOneThroughRelation, do as HasManyRelation, fo as BelongsToRelation, go as RelationTableLoader, ho as Relation, io as MorphToRelation, lo as HasOneRelation, mo as BelongsToManyRelation, oo as MorphOneRelation, po as SingleResultRelation, ro as SetBasedEagerLoader, so as MorphManyRelation, uo as HasManyThroughRelation } from "../index-594mzS6G.mjs";
1
+ import { Co as BelongsToManyRelation, So as SingleResultRelation, To as RelationTableLoader, _o as HasOneThroughRelation, bo as HasManyRelation, fo as SetBasedEagerLoader, go as MorphManyRelation, ho as MorphOneRelation, mo as MorphToManyRelation, po as MorphToRelation, vo as HasOneRelation, wo as Relation, xo as BelongsToRelation, yo as HasManyThroughRelation } from "../index-D8STuZ8X.mjs";
2
2
  export { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasManyThroughRelation, HasOneRelation, HasOneThroughRelation, MorphManyRelation, MorphOneRelation, MorphToManyRelation, MorphToRelation, Relation, RelationTableLoader, SetBasedEagerLoader, SingleResultRelation };
@@ -1,3 +1,3 @@
1
- import { Nn as SetBasedEagerLoader, Pn as RelationTableLoader, a as HasOneThroughRelation, c as HasManyRelation, d as BelongsToManyRelation, f as Relation, i as MorphManyRelation, l as BelongsToRelation, n as MorphToManyRelation, o as HasOneRelation, r as MorphOneRelation, s as HasManyThroughRelation, t as MorphToRelation, u as SingleResultRelation } from "../relationship-huiFTxxu.mjs";
1
+ import { Nn as SetBasedEagerLoader, Pn as RelationTableLoader, a as HasOneThroughRelation, c as HasManyRelation, d as BelongsToManyRelation, f as Relation, i as MorphManyRelation, l as BelongsToRelation, n as MorphToManyRelation, o as HasOneRelation, r as MorphOneRelation, s as HasManyThroughRelation, t as MorphToRelation, u as SingleResultRelation } from "../relationship-C6oXK5EB.mjs";
2
2
 
3
3
  export { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasManyThroughRelation, HasOneRelation, HasOneThroughRelation, MorphManyRelation, MorphOneRelation, MorphToManyRelation, MorphToRelation, Relation, RelationTableLoader, SetBasedEagerLoader, SingleResultRelation };
@@ -3584,6 +3584,187 @@ var Relation = class {
3584
3584
  return this.constrain((query) => query.where(where));
3585
3585
  }
3586
3586
  /**
3587
+ * Adds an OR where clause to the query.
3588
+ *
3589
+ * @param where
3590
+ * @returns
3591
+ */
3592
+ orWhere(where) {
3593
+ return this.constrain((query) => query.orWhere(where));
3594
+ }
3595
+ /**
3596
+ * Adds a NOT where clause to the query.
3597
+ *
3598
+ * @param where
3599
+ * @returns
3600
+ */
3601
+ whereNot(where) {
3602
+ return this.constrain((query) => query.whereNot(where));
3603
+ }
3604
+ /**
3605
+ * Adds an OR NOT where clause to the query.
3606
+ *
3607
+ * @param where
3608
+ * @returns
3609
+ */
3610
+ orWhereNot(where) {
3611
+ return this.constrain((query) => query.orWhereNot(where));
3612
+ }
3613
+ /**
3614
+ * Adds a null check for a key.
3615
+ *
3616
+ * @param key
3617
+ * @returns
3618
+ */
3619
+ whereNull(key) {
3620
+ return this.constrain((query) => query.whereNull(key));
3621
+ }
3622
+ /**
3623
+ * Adds a not-null check for a key.
3624
+ *
3625
+ * @param key
3626
+ * @returns
3627
+ */
3628
+ whereNotNull(key) {
3629
+ return this.constrain((query) => query.whereNotNull(key));
3630
+ }
3631
+ /**
3632
+ * Adds a between range clause for a key.
3633
+ *
3634
+ * @param key
3635
+ * @param range
3636
+ * @returns
3637
+ */
3638
+ whereBetween(key, range) {
3639
+ return this.constrain((query) => query.whereBetween(key, range));
3640
+ }
3641
+ /**
3642
+ * Adds a date-only equality clause for a date-like key.
3643
+ *
3644
+ * @param key
3645
+ * @param value
3646
+ * @returns
3647
+ */
3648
+ whereDate(key, value) {
3649
+ return this.constrain((query) => query.whereDate(key, value));
3650
+ }
3651
+ whereMonth(key, month, year) {
3652
+ return this.constrain((query) => query.whereMonth(key, month, year));
3653
+ }
3654
+ whereYear(key, year) {
3655
+ return this.constrain((query) => query.whereYear(key, year));
3656
+ }
3657
+ whereTime(key, operatorOrValue, maybeValue) {
3658
+ return this.constrain((query) => maybeValue === void 0 ? query.whereTime(key, operatorOrValue) : query.whereTime(key, operatorOrValue, maybeValue));
3659
+ }
3660
+ whereDay(key, operatorOrDay, maybeDay) {
3661
+ return this.constrain((query) => maybeDay === void 0 ? query.whereDay(key, operatorOrDay) : query.whereDay(key, operatorOrDay, maybeDay));
3662
+ }
3663
+ /**
3664
+ * Adds clause to determine if a column's value is in the past
3665
+ *
3666
+ * @param key
3667
+ * @returns
3668
+ */
3669
+ wherePast(key) {
3670
+ return this.constrain((query) => query.wherePast(key));
3671
+ }
3672
+ /**
3673
+ * Adds clause to determine if a column's value is in the future
3674
+ *
3675
+ * @param key
3676
+ * @returns
3677
+ */
3678
+ whereFuture(key) {
3679
+ return this.constrain((query) => query.whereFuture(key));
3680
+ }
3681
+ /**
3682
+ * Adds clause to determine if a column's value is in the past, inclusive of the current date and time
3683
+ *
3684
+ * @param key
3685
+ * @returns
3686
+ */
3687
+ whereNowOrPast(key) {
3688
+ return this.constrain((query) => query.whereNowOrPast(key));
3689
+ }
3690
+ /**
3691
+ * Adds clause to determine if a column's value is in the future, inclusive of the current date and time
3692
+ *
3693
+ * @param key
3694
+ * @returns
3695
+ */
3696
+ whereNowOrFuture(key) {
3697
+ return this.constrain((query) => query.whereNowOrFuture(key));
3698
+ }
3699
+ /**
3700
+ * Adds clause to determine if a column's value is today
3701
+ *
3702
+ * @param key
3703
+ * @returns
3704
+ */
3705
+ whereToday(key) {
3706
+ return this.constrain((query) => query.whereToday(key));
3707
+ }
3708
+ /**
3709
+ * Adds clause to determine if a column's value is before today
3710
+ *
3711
+ * @param key
3712
+ * @returns
3713
+ */
3714
+ whereBeforeToday(key) {
3715
+ return this.constrain((query) => query.whereBeforeToday(key));
3716
+ }
3717
+ /**
3718
+ * Adds clause to determine if a column's value is after today
3719
+ *
3720
+ * @param key
3721
+ * @returns
3722
+ */
3723
+ whereAfterToday(key) {
3724
+ return this.constrain((query) => query.whereAfterToday(key));
3725
+ }
3726
+ /**
3727
+ * Adds clause to determine if a column's value is today or before today
3728
+ *
3729
+ * @param key
3730
+ * @returns
3731
+ */
3732
+ whereTodayOrBefore(key) {
3733
+ return this.constrain((query) => query.whereTodayOrBefore(key));
3734
+ }
3735
+ /**
3736
+ * Adds clause to determine if a column's value is today or after today
3737
+ *
3738
+ * @param key
3739
+ * @returns
3740
+ */
3741
+ whereTodayOrAfter(key) {
3742
+ return this.constrain((query) => query.whereTodayOrAfter(key));
3743
+ }
3744
+ whereColumn(left, operatorOrRight, maybeRight) {
3745
+ return this.constrain((query) => maybeRight === void 0 ? query.whereColumn(left, operatorOrRight) : query.whereColumn(left, operatorOrRight, maybeRight));
3746
+ }
3747
+ /**
3748
+ * Adds "where exists" SQL clauses.
3749
+ *
3750
+ * @param queryOrCallback
3751
+ * @returns
3752
+ */
3753
+ whereExists(queryOrCallback) {
3754
+ return this.constrain((query) => query.whereExists(queryOrCallback));
3755
+ }
3756
+ /**
3757
+ * Adds a fulltext clause for columns that have full text indexes.
3758
+ *
3759
+ * @param columns
3760
+ * @param value
3761
+ * @param options
3762
+ * @returns
3763
+ */
3764
+ whereFullText(columns, value, options = {}) {
3765
+ return this.constrain((query) => query.whereFullText(columns, value, options));
3766
+ }
3767
+ /**
3587
3768
  * Add a strongly-typed where key clause to the relationship query.
3588
3769
  *
3589
3770
  * @param key
@@ -3594,6 +3775,16 @@ var Relation = class {
3594
3775
  return this.constrain((query) => query.whereKey(key, value));
3595
3776
  }
3596
3777
  /**
3778
+ * Adds a strongly-typed inequality where clause for a single attribute key.
3779
+ *
3780
+ * @param key
3781
+ * @param value
3782
+ * @returns
3783
+ */
3784
+ whereKeyNot(key, value) {
3785
+ return this.constrain((query) => query.whereKeyNot(key, value));
3786
+ }
3787
+ /**
3597
3788
  * Add a strongly-typed where in clause to the relationship query.
3598
3789
  *
3599
3790
  * @param key
@@ -3604,6 +3795,36 @@ var Relation = class {
3604
3795
  return this.constrain((query) => query.whereIn(key, values));
3605
3796
  }
3606
3797
  /**
3798
+ * Adds a strongly-typed OR IN where clause for a single attribute key.
3799
+ *
3800
+ * @param key
3801
+ * @param values
3802
+ * @returns
3803
+ */
3804
+ orWhereIn(key, values) {
3805
+ return this.constrain((query) => query.orWhereIn(key, values));
3806
+ }
3807
+ /**
3808
+ * Adds a strongly-typed NOT IN where clause for a single attribute key.
3809
+ *
3810
+ * @param key
3811
+ * @param values
3812
+ * @returns
3813
+ */
3814
+ whereNotIn(key, values) {
3815
+ return this.constrain((query) => query.whereNotIn(key, values));
3816
+ }
3817
+ /**
3818
+ * Adds a strongly-typed OR NOT IN where clause for a single attribute key.
3819
+ *
3820
+ * @param key
3821
+ * @param values
3822
+ * @returns
3823
+ */
3824
+ orWhereNotIn(key, values) {
3825
+ return this.constrain((query) => query.orWhereNotIn(key, values));
3826
+ }
3827
+ /**
3607
3828
  * Add a string contains clause to the relationship query.
3608
3829
  *
3609
3830
  * @param key
@@ -3643,6 +3864,42 @@ var Relation = class {
3643
3864
  return this.constrain((query) => query.orderBy(orderBy));
3644
3865
  }
3645
3866
  /**
3867
+ * Puts the query results in random order.
3868
+ *
3869
+ * @returns
3870
+ */
3871
+ inRandomOrder() {
3872
+ return this.constrain((query) => query.inRandomOrder());
3873
+ }
3874
+ /**
3875
+ * Removes existing order clauses and optionally applies a new one.
3876
+ *
3877
+ * @param column
3878
+ * @param direction
3879
+ * @returns
3880
+ */
3881
+ reorder(column, direction = "asc") {
3882
+ return this.constrain((query) => query.reorder(column, direction));
3883
+ }
3884
+ /**
3885
+ * Adds an orderBy descending clause for a timestamp-like column.
3886
+ *
3887
+ * @param column
3888
+ * @returns
3889
+ */
3890
+ latest(column = "createdAt") {
3891
+ return this.constrain((query) => query.latest(column));
3892
+ }
3893
+ /**
3894
+ * Adds an orderBy ascending clause for a timestamp-like column.
3895
+ *
3896
+ * @param column
3897
+ * @returns
3898
+ */
3899
+ oldest(column = "createdAt") {
3900
+ return this.constrain((query) => query.oldest(column));
3901
+ }
3902
+ /**
3646
3903
  * Add an include clause to the relationship query.
3647
3904
  *
3648
3905
  * @param include
@@ -3669,6 +3926,9 @@ var Relation = class {
3669
3926
  select(select) {
3670
3927
  return this.constrain((query) => query.select(select));
3671
3928
  }
3929
+ addSelect(select) {
3930
+ return this.constrain((query) => query.addSelect(select));
3931
+ }
3672
3932
  /**
3673
3933
  * Add a skip clause to the relationship query.
3674
3934
  *
@@ -3678,6 +3938,9 @@ var Relation = class {
3678
3938
  skip(skip) {
3679
3939
  return this.constrain((query) => query.skip(skip));
3680
3940
  }
3941
+ offset(value) {
3942
+ return this.constrain((query) => query.offset(value));
3943
+ }
3681
3944
  /**
3682
3945
  * Add a take clause to the relationship query.
3683
3946
  *
@@ -3688,6 +3951,45 @@ var Relation = class {
3688
3951
  return this.constrain((query) => query.take(take));
3689
3952
  }
3690
3953
  /**
3954
+ * Alias for take.
3955
+ *
3956
+ * @param value
3957
+ * @returns
3958
+ */
3959
+ limit(value) {
3960
+ return this.constrain((query) => query.limit(value));
3961
+ }
3962
+ /**
3963
+ * Sets offset/limit for a 1-based page.
3964
+ *
3965
+ * @param page
3966
+ * @param perPage
3967
+ * @returns
3968
+ */
3969
+ forPage(page, perPage = 15) {
3970
+ return this.constrain((query) => query.forPage(page, perPage));
3971
+ }
3972
+ /**
3973
+ * Adds a raw where clause when supported by the adapter.
3974
+ *
3975
+ * @param sql
3976
+ * @param bindings
3977
+ * @returns
3978
+ */
3979
+ whereRaw(sql, bindings = []) {
3980
+ return this.constrain((query) => query.whereRaw(sql, bindings));
3981
+ }
3982
+ /**
3983
+ * Adds a raw OR where clause when supported by the adapter.
3984
+ *
3985
+ * @param sql
3986
+ * @param bindings
3987
+ * @returns
3988
+ */
3989
+ orWhereRaw(sql, bindings = []) {
3990
+ return this.constrain((query) => query.orWhereRaw(sql, bindings));
3991
+ }
3992
+ /**
3691
3993
  * Include soft-deleted records in the relationship query.
3692
3994
  *
3693
3995
  * @returns