vona-module-a-orm 5.0.81 → 5.0.83
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.js +8 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { isNil, catchError, safeBoolean, isClass, ensureArray, hashkey } from '@
|
|
|
7
7
|
import knex from 'knex';
|
|
8
8
|
import { BeanMutateBase } from 'vona-module-a-beanmutate';
|
|
9
9
|
import { swapDeps } from '@cabloy/deps';
|
|
10
|
-
import { prepareClassType, getTargetDecoratorRules, getTargetDecoratorRuleColumnsMap, Api, v, OrderMaxBase, OrderCoreBase, getSchemaDynamic, SymbolSchemaDynamicRefId, addSchemaDynamic, mergeFieldsOpenapiMetadata } from 'vona-module-a-
|
|
10
|
+
import { prepareClassType, getTargetDecoratorRules, getTargetDecoratorRuleColumnsMap, Api, v, OrderMaxBase, OrderCoreBase, getSchemaDynamic, SymbolSchemaDynamicRefId, addSchemaDynamic, mergeFieldsOpenapiMetadata } from 'vona-module-a-openapiutils';
|
|
11
11
|
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
12
12
|
import z from 'zod';
|
|
13
13
|
import { parseFirstWord, toLowerCaseFirstChar } from '@cabloy/word-utils';
|
|
@@ -260,7 +260,6 @@ let ServiceDatabase = (_dec$r = Service(), _dec2$r = BeanInfo({
|
|
|
260
260
|
const instanceName = this.ctx.instanceName;
|
|
261
261
|
if (!isNil(instanceName)) {
|
|
262
262
|
const configInstanceBase = this.$scope.instance.service.instance.getConfigInstanceBase(instanceName);
|
|
263
|
-
if (configInstanceBase === false) throw new Error(`instance disabled: ${instanceName}`);
|
|
264
263
|
if (configInstanceBase?.isolate) {
|
|
265
264
|
return configInstanceBase.isolateClient;
|
|
266
265
|
}
|
|
@@ -1228,13 +1227,13 @@ function _initializerDefineProperty(e, i, r, l) {
|
|
|
1228
1227
|
});
|
|
1229
1228
|
}
|
|
1230
1229
|
|
|
1231
|
-
var _dec$h, _dec2$h, _dec3$6, _dec4$4, _dec5$1, _dec6$1,
|
|
1230
|
+
var _dec$h, _dec2$h, _dec3$6, _dec4$4, _dec5$1, _dec6$1, _class$h, _descriptor$4, _descriptor2$2, _descriptor3$1;
|
|
1232
1231
|
const app$1 = useApp();
|
|
1233
1232
|
const ormConfig$1 = app$1.util.getModuleConfigRaw('a-orm');
|
|
1234
1233
|
const ordersDefault = ormConfig$1?.rest?.query?.orders?.default ?? 'createdAt,desc';
|
|
1235
1234
|
let DtoQueryBase = (_dec$h = Api.field(v.optional(), v.array(String, {
|
|
1236
1235
|
separator: ','
|
|
1237
|
-
})), _dec2$h = Reflect.metadata("design:type", Array), _dec3$6 = Api.field(v.optional(), z.looseObject({})), _dec4$4 = Reflect.metadata("design:type", Object), _dec5$1 = Api.field(v.default(ordersDefault), v.optional(), z.union([z.string(), z.array(z.array(z.string()))])), _dec6$1 =
|
|
1236
|
+
})), _dec2$h = Reflect.metadata("design:type", Array), _dec3$6 = Api.field(v.optional(), z.looseObject({})), _dec4$4 = Reflect.metadata("design:type", Object), _dec5$1 = Api.field(v.default(ordersDefault), v.optional(), z.union([z.string(), z.array(z.array(z.string()))])), _dec6$1 = Reflect.metadata("design:type", Object), _class$h = class DtoQueryBase {
|
|
1238
1237
|
constructor() {
|
|
1239
1238
|
_initializerDefineProperty(this, "columns", _descriptor$4, this);
|
|
1240
1239
|
_initializerDefineProperty(this, "where", _descriptor2$2, this);
|
|
@@ -1250,7 +1249,7 @@ let DtoQueryBase = (_dec$h = Api.field(v.optional(), v.array(String, {
|
|
|
1250
1249
|
enumerable: true,
|
|
1251
1250
|
writable: true,
|
|
1252
1251
|
initializer: null
|
|
1253
|
-
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$h.prototype, "orders", [_dec5$1, _dec6$1
|
|
1252
|
+
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$h.prototype, "orders", [_dec5$1, _dec6$1], {
|
|
1254
1253
|
configurable: true,
|
|
1255
1254
|
enumerable: true,
|
|
1256
1255
|
writable: true,
|
|
@@ -1779,6 +1778,7 @@ class BeanModelKnex extends BeanModelUtils {
|
|
|
1779
1778
|
}
|
|
1780
1779
|
async queryOne(sql, bindings) {
|
|
1781
1780
|
const res = await this.query(sql, bindings);
|
|
1781
|
+
if (!res[0]) return undefined;
|
|
1782
1782
|
return res[0];
|
|
1783
1783
|
}
|
|
1784
1784
|
}
|
|
@@ -3050,9 +3050,8 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3050
3050
|
}
|
|
3051
3051
|
async selectAndCount(params, options, modelJoins) {
|
|
3052
3052
|
// pageNo/pageSize
|
|
3053
|
-
const pageSize = params?.limit;
|
|
3054
|
-
|
|
3055
|
-
const pageNo = Math.floor(params.offset / pageSize) + 1;
|
|
3053
|
+
const pageSize = params?.limit ?? this.scopeOrm.config.rest.query.pageSize.default;
|
|
3054
|
+
const pageNo = Math.floor((params?.offset ?? 0) / pageSize) + 1;
|
|
3056
3055
|
// count
|
|
3057
3056
|
const paramsCount = Object.assign({}, params, {
|
|
3058
3057
|
columns: undefined,
|
|
@@ -3339,8 +3338,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3339
3338
|
},
|
|
3340
3339
|
db: this.db
|
|
3341
3340
|
});
|
|
3342
|
-
if (!item) return
|
|
3343
|
-
if (!this._checkIfEntityValidByDeleted(item, options)) return undefined;
|
|
3341
|
+
if (!item || !this._checkIfEntityValidByDeleted(item, options)) return null;
|
|
3344
3342
|
return item;
|
|
3345
3343
|
}
|
|
3346
3344
|
__filterMGetColumns(items, columns) {
|