@zenstackhq/orm 3.4.5 → 3.4.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/index.cjs +16 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -1217,16 +1217,22 @@ var BaseCrudDialect = class {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
}
|
|
1219
1219
|
buildJsonEqualityFilter(lhs, rhs) {
|
|
1220
|
-
return this.
|
|
1220
|
+
return this.buildValueFilter(lhs, "Json", rhs);
|
|
1221
1221
|
}
|
|
1222
|
-
|
|
1223
|
-
|
|
1222
|
+
buildValueFilter(lhs, type, rhs) {
|
|
1223
|
+
if (rhs === void 0) {
|
|
1224
|
+
return this.true();
|
|
1225
|
+
}
|
|
1226
|
+
if (rhs === null) {
|
|
1227
|
+
return this.eb(lhs, "is", null);
|
|
1228
|
+
}
|
|
1229
|
+
return this.eb(lhs, "=", this.transformInput(rhs, type, false));
|
|
1224
1230
|
}
|
|
1225
1231
|
buildStandardFilter(type, payload, lhs, getRhs, recurse, throwIfInvalid = false, onlyForKeys = void 0, excludeKeys = []) {
|
|
1226
1232
|
if (payload === null || !(0, import_common_helpers2.isPlainObject)(payload)) {
|
|
1227
1233
|
return {
|
|
1228
1234
|
conditions: [
|
|
1229
|
-
this.
|
|
1235
|
+
this.buildValueFilter(lhs, type, payload)
|
|
1230
1236
|
],
|
|
1231
1237
|
consumedKeys: []
|
|
1232
1238
|
};
|
|
@@ -1980,7 +1986,10 @@ var PostgresCrudDialect = class _PostgresCrudDialect extends LateralJoinDialectB
|
|
|
1980
1986
|
overrideTypeParsers() {
|
|
1981
1987
|
if (this.options.fixPostgresTimezone !== false && !_PostgresCrudDialect.typeParserOverrideApplied) {
|
|
1982
1988
|
_PostgresCrudDialect.typeParserOverrideApplied = true;
|
|
1983
|
-
import(
|
|
1989
|
+
import(
|
|
1990
|
+
/* webpackIgnore: true */
|
|
1991
|
+
"pg"
|
|
1992
|
+
).then((pg) => {
|
|
1984
1993
|
pg.types.setTypeParser(pg.types.builtins.TIMESTAMP, (value) => {
|
|
1985
1994
|
if (typeof value !== "string") {
|
|
1986
1995
|
return value;
|
|
@@ -3183,7 +3192,7 @@ var BaseOperationHandler = class {
|
|
|
3183
3192
|
const length = firstArgVal;
|
|
3184
3193
|
const generated = typeof length === "number" ? (0, import_nanoid.nanoid)(length) : (0, import_nanoid.nanoid)();
|
|
3185
3194
|
return this.formatGeneratedValue(generated, defaultValue.args?.[1]);
|
|
3186
|
-
}).with("ulid", () => this.formatGeneratedValue((0, import_ulid.ulid)(), defaultValue.args?.[0])).otherwise(() => void 0);
|
|
3195
|
+
}).with("ulid", () => this.formatGeneratedValue((0, import_ulid.ulid)(), defaultValue.args?.[0])).with("now", () => /* @__PURE__ */ new Date()).otherwise(() => void 0);
|
|
3187
3196
|
} else if (schema_exports.ExpressionUtils.isMember(defaultValue) && schema_exports.ExpressionUtils.isCall(defaultValue.receiver) && defaultValue.receiver.function === "auth") {
|
|
3188
3197
|
let val = this.client.$auth;
|
|
3189
3198
|
for (const member of defaultValue.members) {
|
|
@@ -8110,7 +8119,7 @@ var isEmpty = /* @__PURE__ */ __name((eb, args, { dialect }) => {
|
|
|
8110
8119
|
}
|
|
8111
8120
|
return eb(dialect.buildArrayLength(field), "=", import_kysely10.sql.lit(0));
|
|
8112
8121
|
}, "isEmpty");
|
|
8113
|
-
var now = /* @__PURE__ */ __name(() => import_kysely10.sql.raw("CURRENT_TIMESTAMP"), "now");
|
|
8122
|
+
var now = /* @__PURE__ */ __name((_eb, _args, context) => (0, import_ts_pattern16.match)(context.dialect.provider).with("sqlite", () => import_kysely10.sql.raw("strftime('%Y-%m-%dT%H:%M:%fZ')")).with("mysql", () => import_kysely10.sql.raw("CONCAT(SUBSTRING(DATE_FORMAT(UTC_TIMESTAMP(3), '%Y-%m-%dT%H:%i:%s.%f'), 1, 23), '+00:00')")).with("postgresql", () => import_kysely10.sql.raw("CURRENT_TIMESTAMP")).exhaustive(), "now");
|
|
8114
8123
|
var currentModel = /* @__PURE__ */ __name((_eb, args, { model }) => {
|
|
8115
8124
|
let result = model;
|
|
8116
8125
|
const [casing] = args;
|