arkormx 2.5.4 → 2.5.6
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/cli.mjs +5 -1
- package/dist/{index-CnwdCOkd.d.mts → index-BJoi7tFI.d.mts} +308 -7
- package/dist/{index-DDpAZm-_.d.cts → index-ByZ5eKVA.d.cts} +308 -7
- package/dist/index.cjs +229 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +229 -2
- package/dist/relationship/index.cjs +1 -1
- package/dist/relationship/index.d.cts +1 -1
- package/dist/relationship/index.d.mts +1 -1
- package/dist/relationship/index.mjs +1 -1
- package/dist/{relationship-7rzMKbqq.mjs → relationship-C6oXK5EB.mjs} +110 -0
- package/dist/{relationship-BS1AHptf.cjs → relationship-CKQaNPdK.cjs} +110 -0
- package/package.json +1 -1
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-
|
|
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-
|
|
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 {
|
|
1
|
+
import { Co as SingleResultRelation, Eo as RelationTableLoader, So as BelongsToRelation, To as Relation, _o as MorphManyRelation, bo as HasManyThroughRelation, go as MorphOneRelation, ho as MorphToManyRelation, mo as MorphToRelation, po as SetBasedEagerLoader, vo as HasOneThroughRelation, wo as BelongsToManyRelation, xo as HasManyRelation, yo as HasOneRelation } from "../index-ByZ5eKVA.cjs";
|
|
2
2
|
export { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasManyThroughRelation, HasOneRelation, HasOneThroughRelation, MorphManyRelation, MorphOneRelation, MorphToManyRelation, MorphToRelation, Relation, RelationTableLoader, SetBasedEagerLoader, SingleResultRelation };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Co as SingleResultRelation, Eo as RelationTableLoader, So as BelongsToRelation, To as Relation, _o as MorphManyRelation, bo as HasManyThroughRelation, go as MorphOneRelation, ho as MorphToManyRelation, mo as MorphToRelation, po as SetBasedEagerLoader, vo as HasOneThroughRelation, wo as BelongsToManyRelation, xo as HasManyRelation, yo as HasOneRelation } from "../index-BJoi7tFI.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-
|
|
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 };
|
|
@@ -3654,6 +3654,116 @@ var Relation = class {
|
|
|
3654
3654
|
whereYear(key, year) {
|
|
3655
3655
|
return this.constrain((query) => query.whereYear(key, year));
|
|
3656
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
|
+
}
|
|
3657
3767
|
/**
|
|
3658
3768
|
* Add a strongly-typed where key clause to the relationship query.
|
|
3659
3769
|
*
|
|
@@ -3682,6 +3682,116 @@ var Relation = class {
|
|
|
3682
3682
|
whereYear(key, year) {
|
|
3683
3683
|
return this.constrain((query) => query.whereYear(key, year));
|
|
3684
3684
|
}
|
|
3685
|
+
whereTime(key, operatorOrValue, maybeValue) {
|
|
3686
|
+
return this.constrain((query) => maybeValue === void 0 ? query.whereTime(key, operatorOrValue) : query.whereTime(key, operatorOrValue, maybeValue));
|
|
3687
|
+
}
|
|
3688
|
+
whereDay(key, operatorOrDay, maybeDay) {
|
|
3689
|
+
return this.constrain((query) => maybeDay === void 0 ? query.whereDay(key, operatorOrDay) : query.whereDay(key, operatorOrDay, maybeDay));
|
|
3690
|
+
}
|
|
3691
|
+
/**
|
|
3692
|
+
* Adds clause to determine if a column's value is in the past
|
|
3693
|
+
*
|
|
3694
|
+
* @param key
|
|
3695
|
+
* @returns
|
|
3696
|
+
*/
|
|
3697
|
+
wherePast(key) {
|
|
3698
|
+
return this.constrain((query) => query.wherePast(key));
|
|
3699
|
+
}
|
|
3700
|
+
/**
|
|
3701
|
+
* Adds clause to determine if a column's value is in the future
|
|
3702
|
+
*
|
|
3703
|
+
* @param key
|
|
3704
|
+
* @returns
|
|
3705
|
+
*/
|
|
3706
|
+
whereFuture(key) {
|
|
3707
|
+
return this.constrain((query) => query.whereFuture(key));
|
|
3708
|
+
}
|
|
3709
|
+
/**
|
|
3710
|
+
* Adds clause to determine if a column's value is in the past, inclusive of the current date and time
|
|
3711
|
+
*
|
|
3712
|
+
* @param key
|
|
3713
|
+
* @returns
|
|
3714
|
+
*/
|
|
3715
|
+
whereNowOrPast(key) {
|
|
3716
|
+
return this.constrain((query) => query.whereNowOrPast(key));
|
|
3717
|
+
}
|
|
3718
|
+
/**
|
|
3719
|
+
* Adds clause to determine if a column's value is in the future, inclusive of the current date and time
|
|
3720
|
+
*
|
|
3721
|
+
* @param key
|
|
3722
|
+
* @returns
|
|
3723
|
+
*/
|
|
3724
|
+
whereNowOrFuture(key) {
|
|
3725
|
+
return this.constrain((query) => query.whereNowOrFuture(key));
|
|
3726
|
+
}
|
|
3727
|
+
/**
|
|
3728
|
+
* Adds clause to determine if a column's value is today
|
|
3729
|
+
*
|
|
3730
|
+
* @param key
|
|
3731
|
+
* @returns
|
|
3732
|
+
*/
|
|
3733
|
+
whereToday(key) {
|
|
3734
|
+
return this.constrain((query) => query.whereToday(key));
|
|
3735
|
+
}
|
|
3736
|
+
/**
|
|
3737
|
+
* Adds clause to determine if a column's value is before today
|
|
3738
|
+
*
|
|
3739
|
+
* @param key
|
|
3740
|
+
* @returns
|
|
3741
|
+
*/
|
|
3742
|
+
whereBeforeToday(key) {
|
|
3743
|
+
return this.constrain((query) => query.whereBeforeToday(key));
|
|
3744
|
+
}
|
|
3745
|
+
/**
|
|
3746
|
+
* Adds clause to determine if a column's value is after today
|
|
3747
|
+
*
|
|
3748
|
+
* @param key
|
|
3749
|
+
* @returns
|
|
3750
|
+
*/
|
|
3751
|
+
whereAfterToday(key) {
|
|
3752
|
+
return this.constrain((query) => query.whereAfterToday(key));
|
|
3753
|
+
}
|
|
3754
|
+
/**
|
|
3755
|
+
* Adds clause to determine if a column's value is today or before today
|
|
3756
|
+
*
|
|
3757
|
+
* @param key
|
|
3758
|
+
* @returns
|
|
3759
|
+
*/
|
|
3760
|
+
whereTodayOrBefore(key) {
|
|
3761
|
+
return this.constrain((query) => query.whereTodayOrBefore(key));
|
|
3762
|
+
}
|
|
3763
|
+
/**
|
|
3764
|
+
* Adds clause to determine if a column's value is today or after today
|
|
3765
|
+
*
|
|
3766
|
+
* @param key
|
|
3767
|
+
* @returns
|
|
3768
|
+
*/
|
|
3769
|
+
whereTodayOrAfter(key) {
|
|
3770
|
+
return this.constrain((query) => query.whereTodayOrAfter(key));
|
|
3771
|
+
}
|
|
3772
|
+
whereColumn(left, operatorOrRight, maybeRight) {
|
|
3773
|
+
return this.constrain((query) => maybeRight === void 0 ? query.whereColumn(left, operatorOrRight) : query.whereColumn(left, operatorOrRight, maybeRight));
|
|
3774
|
+
}
|
|
3775
|
+
/**
|
|
3776
|
+
* Adds "where exists" SQL clauses.
|
|
3777
|
+
*
|
|
3778
|
+
* @param queryOrCallback
|
|
3779
|
+
* @returns
|
|
3780
|
+
*/
|
|
3781
|
+
whereExists(queryOrCallback) {
|
|
3782
|
+
return this.constrain((query) => query.whereExists(queryOrCallback));
|
|
3783
|
+
}
|
|
3784
|
+
/**
|
|
3785
|
+
* Adds a fulltext clause for columns that have full text indexes.
|
|
3786
|
+
*
|
|
3787
|
+
* @param columns
|
|
3788
|
+
* @param value
|
|
3789
|
+
* @param options
|
|
3790
|
+
* @returns
|
|
3791
|
+
*/
|
|
3792
|
+
whereFullText(columns, value, options = {}) {
|
|
3793
|
+
return this.constrain((query) => query.whereFullText(columns, value, options));
|
|
3794
|
+
}
|
|
3685
3795
|
/**
|
|
3686
3796
|
* Add a strongly-typed where key clause to the relationship query.
|
|
3687
3797
|
*
|