fib-orm 2.0.0 → 2.1.0
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/lib/cli/commands/ddlFrom.d.ts +1 -1
- package/lib/cli/commands/ddlFrom.js +1 -0
- package/lib/cli/commands/dumpModel.d.ts +1 -1
- package/lib/cli/commands/dumpModel.js +1 -0
- package/lib/cli/commands/escape.d.ts +1 -1
- package/lib/cli/commands/escape.js +1 -0
- package/lib/cli/commands/spinner.d.ts +1 -1
- package/lib/cli/commands/spinner.js +1 -0
- package/lib/cli/commands/upgrade.d.ts +1 -1
- package/lib/cli/commands/upgrade.js +1 -0
- package/lib/cli/helpers/ddl.d.ts +1 -1
- package/lib/cli/helpers/ddl.js +3 -3
- package/lib/cli/helpers/package.d.ts +0 -1
- package/lib/cli/helpers/package.js +4 -4
- package/lib/cli/index.js +1 -0
- package/lib/db-driver/Typo.d.ts +0 -1
- package/lib/db-driver/Typo.js +1 -0
- package/lib/db-driver/built-ins/base.class.d.ts +0 -5
- package/lib/db-driver/built-ins/base.class.js +1 -0
- package/lib/db-driver/built-ins/driver-dm.d.ts +0 -1
- package/lib/db-driver/built-ins/driver-dm.js +1 -0
- package/lib/db-driver/built-ins/driver-mongodb.d.ts +0 -1
- package/lib/db-driver/built-ins/driver-mongodb.js +1 -0
- package/lib/db-driver/built-ins/driver-mysql.d.ts +0 -1
- package/lib/db-driver/built-ins/driver-mysql.js +1 -0
- package/lib/db-driver/built-ins/driver-postgresql.d.ts +0 -1
- package/lib/db-driver/built-ins/driver-postgresql.js +1 -0
- package/lib/db-driver/built-ins/driver-redis.d.ts +0 -1
- package/lib/db-driver/built-ins/driver-redis.js +1 -0
- package/lib/db-driver/built-ins/driver-sqlite.d.ts +0 -1
- package/lib/db-driver/built-ins/driver-sqlite.js +1 -0
- package/lib/db-driver/index.js +1 -0
- package/lib/db-driver/utils.js +13 -13
- package/lib/knex/knex.js +1 -0
- package/lib/knex/sandbox.js +1 -0
- package/lib/orm/Adapters.js +3 -3
- package/lib/orm/AggregateFunctions.js +1 -0
- package/lib/orm/Associations/Extend.js +4 -4
- package/lib/orm/Associations/Many.d.ts +0 -1
- package/lib/orm/Associations/Many.js +6 -6
- package/lib/orm/Associations/One.js +4 -4
- package/lib/orm/Associations/_utils.d.ts +0 -1
- package/lib/orm/Associations/_utils.js +8 -7
- package/lib/orm/ChainFind.js +1 -0
- package/lib/orm/ChainInstance.js +1 -0
- package/lib/orm/Debug.js +4 -4
- package/lib/orm/Drivers/DB/base.d.ts +0 -1
- package/lib/orm/Drivers/DB/base.js +1 -0
- package/lib/orm/Drivers/DB/dm.d.ts +0 -2
- package/lib/orm/Drivers/DB/dm.js +1 -0
- package/lib/orm/Drivers/DB/mysql.d.ts +0 -2
- package/lib/orm/Drivers/DB/mysql.js +1 -0
- package/lib/orm/Drivers/DB/postgres.d.ts +0 -2
- package/lib/orm/Drivers/DB/postgres.js +1 -0
- package/lib/orm/Drivers/DB/sqlite3.d.ts +0 -2
- package/lib/orm/Drivers/DB/sqlite3.js +1 -0
- package/lib/orm/Drivers/DML/_ddl-sql.js +1 -0
- package/lib/orm/Drivers/DML/_dml-helpers.js +6 -6
- package/lib/orm/Drivers/DML/_shared.js +5 -4
- package/lib/orm/Drivers/DML/_utils.js +7 -7
- package/lib/orm/Drivers/DML/constants.js +1 -0
- package/lib/orm/Drivers/DML/dm.js +1 -0
- package/lib/orm/Drivers/DML/index.js +1 -0
- package/lib/orm/Drivers/DML/mysql.js +1 -0
- package/lib/orm/Drivers/DML/postgres.d.ts +0 -1
- package/lib/orm/Drivers/DML/postgres.js +1 -0
- package/lib/orm/Drivers/DML/sqlite.js +1 -0
- package/lib/orm/Error.js +2 -1
- package/lib/orm/Helpers.js +22 -21
- package/lib/orm/Hook.js +1 -0
- package/lib/orm/Instance.js +1 -0
- package/lib/orm/LazyLoad.js +2 -2
- package/lib/orm/Model.d.ts +1 -2
- package/lib/orm/Model.js +7 -4
- package/lib/orm/ORM.js +1 -0
- package/lib/orm/Patch/fib-cache.d.ts +0 -1
- package/lib/orm/Patch/plugin.js +2 -1
- package/lib/orm/Property.js +2 -2
- package/lib/orm/Settings.js +3 -2
- package/lib/orm/Singleton.js +1 -0
- package/lib/orm/Typo/Adapter.js +1 -0
- package/lib/orm/Typo/DMLDriver.d.ts +0 -1
- package/lib/orm/Typo/DMLDriver.js +1 -0
- package/lib/orm/Typo/Db.d.ts +0 -3
- package/lib/orm/Typo/Db.js +1 -0
- package/lib/orm/Typo/Error.d.ts +0 -2
- package/lib/orm/Typo/Error.js +1 -0
- package/lib/orm/Typo/ORM.d.ts +0 -2
- package/lib/orm/Typo/ORM.js +1 -0
- package/lib/orm/Typo/Validators.d.ts +0 -1
- package/lib/orm/Typo/Validators.js +1 -0
- package/lib/orm/Typo/_common.d.ts +0 -1
- package/lib/orm/Typo/_common.js +1 -0
- package/lib/orm/Typo/assoc.js +1 -0
- package/lib/orm/Typo/hook.js +1 -0
- package/lib/orm/Typo/instance.d.ts +0 -1
- package/lib/orm/Typo/instance.js +1 -0
- package/lib/orm/Typo/model.d.ts +0 -2
- package/lib/orm/Typo/model.js +2 -1
- package/lib/orm/Typo/patch.js +1 -0
- package/lib/orm/Typo/property.js +1 -0
- package/lib/orm/Typo/query.js +1 -0
- package/lib/orm/Typo/settings.js +2 -1
- package/lib/orm/Typo/synchronous.js +1 -0
- package/lib/orm/Utilities.d.ts +1 -2
- package/lib/orm/Utilities.js +60 -60
- package/lib/orm/Validators.d.ts +0 -1
- package/lib/orm/Validators.js +4 -3
- package/lib/orm/Where/common.js +2 -2
- package/lib/orm/Where/filterDate.js +2 -2
- package/lib/orm/index.d.ts +0 -1
- package/lib/orm/index.js +7 -6
- package/lib/orm-core/callback.js +1 -0
- package/lib/orm-core/dialect.js +1 -0
- package/lib/orm-core/error.js +3 -3
- package/lib/orm-core/index.js +1 -0
- package/lib/orm-core/sync.js +1 -0
- package/lib/orm-core/utils.js +1 -0
- package/lib/orm-property/Property.js +1 -0
- package/lib/orm-property/Utils.js +2 -2
- package/lib/orm-property/customTypes.js +2 -2
- package/lib/orm-property/index.js +3 -2
- package/lib/orm-property/transformer.js +2 -2
- package/lib/orm-property/transformers/dm.js +1 -0
- package/lib/orm-property/transformers/index.js +1 -0
- package/lib/orm-property/transformers/mysql.d.ts +0 -1
- package/lib/orm-property/transformers/mysql.js +1 -0
- package/lib/orm-property/transformers/postgresql.js +1 -0
- package/lib/orm-property/transformers/sqlite.js +1 -0
- package/lib/sql-ddl-sync/Dialects/dm.d.ts +0 -1
- package/lib/sql-ddl-sync/Dialects/dm.js +1 -0
- package/lib/sql-ddl-sync/Dialects/index.d.ts +0 -1
- package/lib/sql-ddl-sync/Dialects/index.js +1 -0
- package/lib/sql-ddl-sync/Dialects/mysql.d.ts +0 -1
- package/lib/sql-ddl-sync/Dialects/mysql.js +1 -0
- package/lib/sql-ddl-sync/Dialects/postgresql.d.ts +0 -1
- package/lib/sql-ddl-sync/Dialects/postgresql.js +1 -0
- package/lib/sql-ddl-sync/Dialects/sqlite.d.ts +0 -1
- package/lib/sql-ddl-sync/Dialects/sqlite.js +1 -0
- package/lib/sql-ddl-sync/SQL.js +11 -11
- package/lib/sql-ddl-sync/Typo/Collection.js +1 -0
- package/lib/sql-ddl-sync/Typo/DbIndex.js +1 -0
- package/lib/sql-ddl-sync/Typo/Dialect.js +1 -0
- package/lib/sql-ddl-sync/Typo/Driver.js +1 -0
- package/lib/sql-ddl-sync/Typo/Query.js +1 -0
- package/lib/sql-ddl-sync/Typo/SQL.js +1 -0
- package/lib/sql-ddl-sync/Typo/_common.js +1 -0
- package/lib/sql-ddl-sync/Utils.d.ts +0 -1
- package/lib/sql-ddl-sync/Utils.js +14 -14
- package/lib/sql-ddl-sync/index.js +3 -2
- package/lib/sql-query/Comparators.js +1 -0
- package/lib/sql-query/Create.js +1 -0
- package/lib/sql-query/Dialects/dm.js +1 -0
- package/lib/sql-query/Dialects/index.js +1 -0
- package/lib/sql-query/Dialects/mssql.js +1 -0
- package/lib/sql-query/Dialects/mysql.js +1 -0
- package/lib/sql-query/Dialects/postgresql.js +1 -0
- package/lib/sql-query/Dialects/sqlite.js +1 -0
- package/lib/sql-query/Helpers.d.ts +0 -1
- package/lib/sql-query/Helpers.js +21 -20
- package/lib/sql-query/Insert.js +1 -0
- package/lib/sql-query/Query.d.ts +0 -1
- package/lib/sql-query/Query.js +1 -0
- package/lib/sql-query/Remove.js +1 -0
- package/lib/sql-query/Select.js +1 -0
- package/lib/sql-query/Set.js +2 -2
- package/lib/sql-query/Typo/Aggregation.js +1 -0
- package/lib/sql-query/Typo/Comparators.js +1 -0
- package/lib/sql-query/Typo/Dialect.js +1 -0
- package/lib/sql-query/Typo/Field.js +1 -0
- package/lib/sql-query/Typo/Helper.js +1 -0
- package/lib/sql-query/Typo/Query-ChainBuilder.js +1 -0
- package/lib/sql-query/Typo/Query.js +2 -1
- package/lib/sql-query/Typo/Sql.js +1 -0
- package/lib/sql-query/Typo/SubQuery.js +1 -0
- package/lib/sql-query/Typo/index.js +1 -0
- package/lib/sql-query/Update.js +1 -0
- package/lib/sql-query/Where.js +2 -2
- package/package.json +9 -10
package/lib/orm/Utilities.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@fibjs/types" />
|
|
2
1
|
import FxORMCore = require('../orm-core/index');
|
|
3
2
|
import { FxSqlQuery, FxSqlQuerySubQuery, FxSqlQuerySql, FxSqlQueryDialect } from '../sql-query/Query';
|
|
4
3
|
import type { FxOrmInstance } from './Typo/instance';
|
|
@@ -156,7 +155,7 @@ export declare function makeHandlerDecorator(opts: {
|
|
|
156
155
|
onlyOnce?: boolean;
|
|
157
156
|
}, hdlr: () => any): (err: FxOrmCommon.Arraible<FxOrmError.ExtendedError> | false) => any;
|
|
158
157
|
export declare function reusableChannelGenerator(): () => FxOrmHook.HookChannelResults<Function>;
|
|
159
|
-
export declare const createHookHelper: (hooks: Record<string, any>, hook: keyof FxOrmModel.Hooks | keyof FxOrmAssociation.InstanceAssociationItem[
|
|
158
|
+
export declare const createHookHelper: (hooks: Record<string, any>, hook: keyof FxOrmModel.Hooks | keyof FxOrmAssociation.InstanceAssociationItem["hooks"], { initialHooks }?: Record<string, any>) => (cb: FxOrmHook.HookActionCallback | FxOrmHook.HookResultCallback, opts?: FxOrmModel.ModelHookPatchOptions) => any;
|
|
160
159
|
export declare function attachOnceTypedHookRefToInstance(instance: FxOrmInstance.Instance, type: 'save' | 'create' | 'remove', typedHookRef: Record<string, any>): void;
|
|
161
160
|
export declare function arraify<T = any>(item: T | T[]): T[];
|
|
162
161
|
export declare function firstEl<T = any>(item: T | T[]): T;
|
package/lib/orm/Utilities.js
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.
|
|
3
|
-
exports.
|
|
3
|
+
exports.DEFAULT_GENERATE_SQL_QUERY_SELECT = exports.createHookHelper = exports.takeAwayResult = exports.catchBlocking = void 0;
|
|
4
|
+
exports.standardizeOrder = standardizeOrder;
|
|
5
|
+
exports.addTableToStandardedOrder = addTableToStandardedOrder;
|
|
6
|
+
exports.checkConditions = checkConditions;
|
|
7
|
+
exports.values = values;
|
|
8
|
+
exports.hasValues = hasValues;
|
|
9
|
+
exports.populateModelIdKeysConditions = populateModelIdKeysConditions;
|
|
10
|
+
exports.getConditions = getConditions;
|
|
11
|
+
exports.wrapFieldObject = wrapFieldObject;
|
|
12
|
+
exports.formatAssociatedField = formatAssociatedField;
|
|
13
|
+
exports.extractHasManyExtraConditions = extractHasManyExtraConditions;
|
|
14
|
+
exports.extractSelectTopConditions = extractSelectTopConditions;
|
|
15
|
+
exports.convertPropToJoinKeyProp = convertPropToJoinKeyProp;
|
|
16
|
+
exports.getRealPath = getRealPath;
|
|
17
|
+
exports.transformPropertyNames = transformPropertyNames;
|
|
18
|
+
exports.transformOrderPropertyNames = transformOrderPropertyNames;
|
|
19
|
+
exports.renameDatastoreFieldsToPropertyNames = renameDatastoreFieldsToPropertyNames;
|
|
20
|
+
exports.camelCaseHasMany = camelCaseHasMany;
|
|
21
|
+
exports.ucfirst = ucfirst;
|
|
22
|
+
exports.formatNameFor = formatNameFor;
|
|
23
|
+
exports.combineMergeInfoToArray = combineMergeInfoToArray;
|
|
24
|
+
exports.parseTableInputForSelect = parseTableInputForSelect;
|
|
25
|
+
exports.tableAlias = tableAlias;
|
|
26
|
+
exports.tableAliasCalculatorInOneQuery = tableAliasCalculatorInOneQuery;
|
|
27
|
+
exports.ORM_Error = ORM_Error;
|
|
28
|
+
exports.queryParamCast = queryParamCast;
|
|
29
|
+
exports.isDriverNotSupportedError = isDriverNotSupportedError;
|
|
30
|
+
exports.doWhenErrIs = doWhenErrIs;
|
|
31
|
+
exports.getErrWaitor = getErrWaitor;
|
|
32
|
+
exports.getValueWaitor = getValueWaitor;
|
|
33
|
+
exports.parallelQueryIfPossible = parallelQueryIfPossible;
|
|
34
|
+
exports.filterWhereConditionsInput = filterWhereConditionsInput;
|
|
35
|
+
exports.addUnwritableProperty = addUnwritableProperty;
|
|
36
|
+
exports.addHiddenReadonlyProperty = addHiddenReadonlyProperty;
|
|
37
|
+
exports.addHiddenUnwritableMethodToInstance = addHiddenUnwritableMethodToInstance;
|
|
38
|
+
exports.addHiddenPropertyToInstance = addHiddenPropertyToInstance;
|
|
39
|
+
exports.addHiddenReadonlyPropertyToInstance = addHiddenReadonlyPropertyToInstance;
|
|
40
|
+
exports.fillSyncVersionAccessorForAssociation = fillSyncVersionAccessorForAssociation;
|
|
41
|
+
exports.addHookPatchHelperForAssociation = addHookPatchHelperForAssociation;
|
|
42
|
+
exports.generateUID4SoloGet = generateUID4SoloGet;
|
|
43
|
+
exports.generateUID4ChainFind = generateUID4ChainFind;
|
|
44
|
+
exports.generateUID4Model = generateUID4Model;
|
|
45
|
+
exports.makeIdForDriverTable = makeIdForDriverTable;
|
|
46
|
+
exports.bindInstance = bindInstance;
|
|
47
|
+
exports.buildAssocHooksContext = buildAssocHooksContext;
|
|
48
|
+
exports.makeHandlerDecorator = makeHandlerDecorator;
|
|
49
|
+
exports.reusableChannelGenerator = reusableChannelGenerator;
|
|
50
|
+
exports.attachOnceTypedHookRefToInstance = attachOnceTypedHookRefToInstance;
|
|
51
|
+
exports.arraify = arraify;
|
|
52
|
+
exports.firstEl = firstEl;
|
|
53
|
+
exports.isKeyProperty = isKeyProperty;
|
|
54
|
+
exports.isKeyPrimaryProperty = isKeyPrimaryProperty;
|
|
55
|
+
exports.coercePositiveInt = coercePositiveInt;
|
|
56
|
+
exports.getUUID = getUUID;
|
|
57
|
+
exports.isVirtualViewModel = isVirtualViewModel;
|
|
58
|
+
exports.disAllowOpForVModel = disAllowOpForVModel;
|
|
59
|
+
exports.normalizeVirtualViewOption = normalizeVirtualViewOption;
|
|
60
|
+
exports.__wrapTableSourceAsGneratingSqlSelect = __wrapTableSourceAsGneratingSqlSelect;
|
|
4
61
|
const util = require("util");
|
|
5
62
|
const uuid = require("uuid");
|
|
6
63
|
const coroutine = require("coroutine");
|
|
@@ -59,7 +116,6 @@ function standardizeOrder(order) {
|
|
|
59
116
|
}
|
|
60
117
|
return new_order;
|
|
61
118
|
}
|
|
62
|
-
exports.standardizeOrder = standardizeOrder;
|
|
63
119
|
;
|
|
64
120
|
function addTableToStandardedOrder(order, table_alias) {
|
|
65
121
|
const new_order = [];
|
|
@@ -77,7 +133,6 @@ function addTableToStandardedOrder(order, table_alias) {
|
|
|
77
133
|
}
|
|
78
134
|
return new_order;
|
|
79
135
|
}
|
|
80
|
-
exports.addTableToStandardedOrder = addTableToStandardedOrder;
|
|
81
136
|
/**
|
|
82
137
|
* @description filtered out FxOrmInstance.Instance in mixed FxSqlQuerySubQuery.SubQueryConditions | { [k: string]: FxOrmInstance.Instance }
|
|
83
138
|
*/
|
|
@@ -129,7 +184,6 @@ function checkConditions(conditions, one_associations) {
|
|
|
129
184
|
}
|
|
130
185
|
return conditions;
|
|
131
186
|
}
|
|
132
|
-
exports.checkConditions = checkConditions;
|
|
133
187
|
;
|
|
134
188
|
/**
|
|
135
189
|
* Gets all the values within an object or array, optionally
|
|
@@ -157,7 +211,6 @@ function values(obj, keys) {
|
|
|
157
211
|
}
|
|
158
212
|
return vals;
|
|
159
213
|
}
|
|
160
|
-
exports.values = values;
|
|
161
214
|
;
|
|
162
215
|
// Qn: is Zero a valid value for a FK column?
|
|
163
216
|
// Why? Well I've got a pre-existing database that started all its 'serial' IDs at zero...
|
|
@@ -169,7 +222,6 @@ function hasValues(obj, keys) {
|
|
|
169
222
|
}
|
|
170
223
|
return true;
|
|
171
224
|
}
|
|
172
|
-
exports.hasValues = hasValues;
|
|
173
225
|
;
|
|
174
226
|
/**
|
|
175
227
|
* @description from from <source> object, copy specific ids(determined by <source_model>) to <target> object as
|
|
@@ -207,14 +259,12 @@ function populateModelIdKeysConditions(source_model, associacted_fields, source,
|
|
|
207
259
|
}
|
|
208
260
|
}
|
|
209
261
|
}
|
|
210
|
-
exports.populateModelIdKeysConditions = populateModelIdKeysConditions;
|
|
211
262
|
;
|
|
212
263
|
function getConditions(model, fields, from) {
|
|
213
264
|
var conditions = {};
|
|
214
265
|
populateModelIdKeysConditions(model, fields, from, conditions);
|
|
215
266
|
return conditions;
|
|
216
267
|
}
|
|
217
|
-
exports.getConditions = getConditions;
|
|
218
268
|
;
|
|
219
269
|
/**
|
|
220
270
|
* TODO: add comment for this method
|
|
@@ -258,7 +308,6 @@ function wrapFieldObject(params) {
|
|
|
258
308
|
[field_str]: prop
|
|
259
309
|
};
|
|
260
310
|
}
|
|
261
|
-
exports.wrapFieldObject = wrapFieldObject;
|
|
262
311
|
;
|
|
263
312
|
/**
|
|
264
313
|
* TODO: add comment for this method
|
|
@@ -311,7 +360,6 @@ function formatAssociatedField(model, name, required, reversed) {
|
|
|
311
360
|
}
|
|
312
361
|
return fields;
|
|
313
362
|
}
|
|
314
|
-
exports.formatAssociatedField = formatAssociatedField;
|
|
315
363
|
;
|
|
316
364
|
/** @internal */
|
|
317
365
|
function extractHasManyExtraConditions(association, conditions, extra_where) {
|
|
@@ -326,7 +374,6 @@ function extractHasManyExtraConditions(association, conditions, extra_where) {
|
|
|
326
374
|
}
|
|
327
375
|
return extra_where;
|
|
328
376
|
}
|
|
329
|
-
exports.extractHasManyExtraConditions = extractHasManyExtraConditions;
|
|
330
377
|
/**
|
|
331
378
|
* @description top conditions means that conditions which matches query's top select.
|
|
332
379
|
*/
|
|
@@ -337,7 +384,6 @@ function extractSelectTopConditions(conditions, topFields) {
|
|
|
337
384
|
tableConditions: util.omit(conditions, topFields)
|
|
338
385
|
};
|
|
339
386
|
}
|
|
340
|
-
exports.extractSelectTopConditions = extractSelectTopConditions;
|
|
341
387
|
// If the parent associations key is `serial`, the join tables
|
|
342
388
|
// key should be changed to `integer`.
|
|
343
389
|
function convertPropToJoinKeyProp(props, opts) {
|
|
@@ -357,7 +403,6 @@ function convertPropToJoinKeyProp(props, opts) {
|
|
|
357
403
|
}
|
|
358
404
|
return props;
|
|
359
405
|
}
|
|
360
|
-
exports.convertPropToJoinKeyProp = convertPropToJoinKeyProp;
|
|
361
406
|
function getRealPath(path_str, stack_index) {
|
|
362
407
|
const path = require("path"); // for now, load here (only when needed)
|
|
363
408
|
let cwd = process.cwd();
|
|
@@ -381,7 +426,6 @@ function getRealPath(path_str, stack_index) {
|
|
|
381
426
|
}
|
|
382
427
|
return path_str;
|
|
383
428
|
}
|
|
384
|
-
exports.getRealPath = getRealPath;
|
|
385
429
|
;
|
|
386
430
|
/**
|
|
387
431
|
* @description rename a field name in <dataIn> according to the name map in <properties>
|
|
@@ -410,7 +454,6 @@ function transformPropertyNames(dataIn, properties) {
|
|
|
410
454
|
}
|
|
411
455
|
return dataOut;
|
|
412
456
|
}
|
|
413
|
-
exports.transformPropertyNames = transformPropertyNames;
|
|
414
457
|
;
|
|
415
458
|
function transformOrderPropertyNames(order, properties) {
|
|
416
459
|
if (!order)
|
|
@@ -439,7 +482,6 @@ function transformOrderPropertyNames(order, properties) {
|
|
|
439
482
|
}
|
|
440
483
|
return newOrder;
|
|
441
484
|
}
|
|
442
|
-
exports.transformOrderPropertyNames = transformOrderPropertyNames;
|
|
443
485
|
function renameDatastoreFieldsToPropertyNames(data, fieldToPropertyMap) {
|
|
444
486
|
for (let k in data) {
|
|
445
487
|
const prop = fieldToPropertyMap[k];
|
|
@@ -450,17 +492,14 @@ function renameDatastoreFieldsToPropertyNames(data, fieldToPropertyMap) {
|
|
|
450
492
|
}
|
|
451
493
|
return data;
|
|
452
494
|
}
|
|
453
|
-
exports.renameDatastoreFieldsToPropertyNames = renameDatastoreFieldsToPropertyNames;
|
|
454
495
|
function camelCaseHasMany(text) {
|
|
455
496
|
return ucfirst(text[0]) + text.substr(1).replace(/_([a-z])/, function (m, l) {
|
|
456
497
|
return l.toUpperCase();
|
|
457
498
|
});
|
|
458
499
|
}
|
|
459
|
-
exports.camelCaseHasMany = camelCaseHasMany;
|
|
460
500
|
function ucfirst(text) {
|
|
461
501
|
return text[0].toUpperCase() + text.substr(1);
|
|
462
502
|
}
|
|
463
|
-
exports.ucfirst = ucfirst;
|
|
464
503
|
function formatNameFor(key, name) {
|
|
465
504
|
switch (key) {
|
|
466
505
|
case 'assoc:hasMany':
|
|
@@ -478,13 +517,11 @@ function formatNameFor(key, name) {
|
|
|
478
517
|
return name + 'Sync';
|
|
479
518
|
}
|
|
480
519
|
}
|
|
481
|
-
exports.formatNameFor = formatNameFor;
|
|
482
520
|
function combineMergeInfoToArray(merges) {
|
|
483
521
|
if (!Array.isArray(merges))
|
|
484
522
|
merges = [merges];
|
|
485
523
|
return merges.filter(Boolean);
|
|
486
524
|
}
|
|
487
|
-
exports.combineMergeInfoToArray = combineMergeInfoToArray;
|
|
488
525
|
function parseTableInputForSelect(ta_str) {
|
|
489
526
|
const [pure_table, alias = typeof pure_table === 'string' ? pure_table : ''] = Query_1.Helpers.parseTableInputStr(ta_str);
|
|
490
527
|
return {
|
|
@@ -493,7 +530,6 @@ function parseTableInputForSelect(ta_str) {
|
|
|
493
530
|
from_tuple: [pure_table, alias]
|
|
494
531
|
};
|
|
495
532
|
}
|
|
496
|
-
exports.parseTableInputForSelect = parseTableInputForSelect;
|
|
497
533
|
function tableAlias(table, alias = typeof table === 'string' ? table : '', same_suffix = '') {
|
|
498
534
|
if (Query_1.Helpers.maybeKnexRawOrQueryBuilder(table)) {
|
|
499
535
|
if (!alias) {
|
|
@@ -503,7 +539,6 @@ function tableAlias(table, alias = typeof table === 'string' ? table : '', same_
|
|
|
503
539
|
}
|
|
504
540
|
return `${table} ${alias}${same_suffix ? ` ${same_suffix}` : ''}`;
|
|
505
541
|
}
|
|
506
|
-
exports.tableAlias = tableAlias;
|
|
507
542
|
function tableAliasCalculatorInOneQuery() {
|
|
508
543
|
const countHash = {};
|
|
509
544
|
return function increment(tableName, get_only = false) {
|
|
@@ -514,7 +549,6 @@ function tableAliasCalculatorInOneQuery() {
|
|
|
514
549
|
return countHash[tableName];
|
|
515
550
|
};
|
|
516
551
|
}
|
|
517
|
-
exports.tableAliasCalculatorInOneQuery = tableAliasCalculatorInOneQuery;
|
|
518
552
|
function ORM_Error(err, cb) {
|
|
519
553
|
var Emitter = new events.EventEmitter();
|
|
520
554
|
Emitter.use = Emitter.define = Emitter.sync = Emitter.load = function () { };
|
|
@@ -525,7 +559,6 @@ function ORM_Error(err, cb) {
|
|
|
525
559
|
});
|
|
526
560
|
return Emitter;
|
|
527
561
|
}
|
|
528
|
-
exports.ORM_Error = ORM_Error;
|
|
529
562
|
function queryParamCast(val) {
|
|
530
563
|
if (typeof val == 'string') {
|
|
531
564
|
switch (val) {
|
|
@@ -539,7 +572,6 @@ function queryParamCast(val) {
|
|
|
539
572
|
}
|
|
540
573
|
return val;
|
|
541
574
|
}
|
|
542
|
-
exports.queryParamCast = queryParamCast;
|
|
543
575
|
function isDriverNotSupportedError(err) {
|
|
544
576
|
if (err.code === 'MODULE_NOT_FOUND')
|
|
545
577
|
return true;
|
|
@@ -560,7 +592,6 @@ function isDriverNotSupportedError(err) {
|
|
|
560
592
|
return true;
|
|
561
593
|
return false;
|
|
562
594
|
}
|
|
563
|
-
exports.isDriverNotSupportedError = isDriverNotSupportedError;
|
|
564
595
|
exports.catchBlocking = FxORMCore.catchBlocking;
|
|
565
596
|
exports.takeAwayResult = FxORMCore.takeAwayResult;
|
|
566
597
|
function doWhenErrIs(compare, callback, err) {
|
|
@@ -574,27 +605,23 @@ function doWhenErrIs(compare, callback, err) {
|
|
|
574
605
|
return;
|
|
575
606
|
callback(err);
|
|
576
607
|
}
|
|
577
|
-
exports.doWhenErrIs = doWhenErrIs;
|
|
578
608
|
function getErrWaitor(shouldWait = false) {
|
|
579
609
|
return {
|
|
580
610
|
evt: shouldWait ? new coroutine.Event : null,
|
|
581
611
|
err: null,
|
|
582
612
|
};
|
|
583
613
|
}
|
|
584
|
-
exports.getErrWaitor = getErrWaitor;
|
|
585
614
|
function getValueWaitor(shouldWait = false) {
|
|
586
615
|
return {
|
|
587
616
|
evt: shouldWait ? new coroutine.Event : null,
|
|
588
617
|
value: null,
|
|
589
618
|
};
|
|
590
619
|
}
|
|
591
|
-
exports.getValueWaitor = getValueWaitor;
|
|
592
620
|
function parallelQueryIfPossible(can_parallel, iteratee, iterator) {
|
|
593
621
|
if (can_parallel && iteratee.length > 1)
|
|
594
622
|
return coroutine.parallel(iteratee, (item) => iterator(item));
|
|
595
623
|
return iteratee.map(iterator);
|
|
596
624
|
}
|
|
597
|
-
exports.parallelQueryIfPossible = parallelQueryIfPossible;
|
|
598
625
|
/**
|
|
599
626
|
* @description do some mutation for field-value in conditions
|
|
600
627
|
*
|
|
@@ -610,27 +637,21 @@ function filterWhereConditionsInput(conditions, host) {
|
|
|
610
637
|
}
|
|
611
638
|
return conditions;
|
|
612
639
|
}
|
|
613
|
-
exports.filterWhereConditionsInput = filterWhereConditionsInput;
|
|
614
640
|
function addUnwritableProperty(obj, property, value, propertyConfiguration = {}) {
|
|
615
641
|
Object.defineProperty(obj, property, Object.assign(Object.assign({ value }, propertyConfiguration), { writable: false }));
|
|
616
642
|
}
|
|
617
|
-
exports.addUnwritableProperty = addUnwritableProperty;
|
|
618
643
|
function addHiddenReadonlyProperty(obj, property, getter, propertyConfiguration = {}) {
|
|
619
644
|
Object.defineProperty(obj, property, Object.assign(Object.assign({ get: getter }, propertyConfiguration), { enumerable: false }));
|
|
620
645
|
}
|
|
621
|
-
exports.addHiddenReadonlyProperty = addHiddenReadonlyProperty;
|
|
622
646
|
function addHiddenUnwritableMethodToInstance(instance, method_name, fn, propertyConfiguration = {}) {
|
|
623
647
|
Object.defineProperty(instance, method_name, Object.assign(Object.assign({ value: fn.bind(instance) }, propertyConfiguration), { writable: true, enumerable: false }));
|
|
624
648
|
}
|
|
625
|
-
exports.addHiddenUnwritableMethodToInstance = addHiddenUnwritableMethodToInstance;
|
|
626
649
|
function addHiddenPropertyToInstance(instance, property_name, value, propertyConfiguration = {}) {
|
|
627
650
|
Object.defineProperty(instance, property_name, Object.assign(Object.assign({ value: value }, propertyConfiguration), { enumerable: false }));
|
|
628
651
|
}
|
|
629
|
-
exports.addHiddenPropertyToInstance = addHiddenPropertyToInstance;
|
|
630
652
|
function addHiddenReadonlyPropertyToInstance(instance, property_name, getter, propertyConfiguration = {}) {
|
|
631
653
|
Object.defineProperty(instance, property_name, Object.assign(Object.assign({ get: getter }, propertyConfiguration), { enumerable: false }));
|
|
632
654
|
}
|
|
633
|
-
exports.addHiddenReadonlyPropertyToInstance = addHiddenReadonlyPropertyToInstance;
|
|
634
655
|
function fillSyncVersionAccessorForAssociation(association) {
|
|
635
656
|
if (!association.getSyncAccessor)
|
|
636
657
|
association.getSyncAccessor = formatNameFor('syncify:assoc', association.getAccessor);
|
|
@@ -646,7 +667,6 @@ function fillSyncVersionAccessorForAssociation(association) {
|
|
|
646
667
|
association.modelFindBySyncAccessor = formatNameFor('syncify:assoc', association.modelFindByAccessor);
|
|
647
668
|
return association;
|
|
648
669
|
}
|
|
649
|
-
exports.fillSyncVersionAccessorForAssociation = fillSyncVersionAccessorForAssociation;
|
|
650
670
|
const AvailableHooks = [
|
|
651
671
|
'beforeSet', 'afterSet',
|
|
652
672
|
'beforeRemove', 'afterRemove',
|
|
@@ -658,11 +678,9 @@ function addHookPatchHelperForAssociation(association) {
|
|
|
658
678
|
association[AvailableHooks[k]] = (0, exports.createHookHelper)(association.hooks, AvailableHooks[k], { initialHooks: Object.assign({}, association.hooks) });
|
|
659
679
|
}
|
|
660
680
|
}
|
|
661
|
-
exports.addHookPatchHelperForAssociation = addHookPatchHelperForAssociation;
|
|
662
681
|
function generateUID4SoloGet(m_opts, ids) {
|
|
663
682
|
return m_opts.driver.uid + "/" + m_opts.table + "/" + ids.join("/");
|
|
664
683
|
}
|
|
665
|
-
exports.generateUID4SoloGet = generateUID4SoloGet;
|
|
666
684
|
function generateUID4ChainFind(m_opts, merges = [], data) {
|
|
667
685
|
const merge_id = merges.map(merge => (merge ? merge.from.table : "")).join(',');
|
|
668
686
|
let uid = m_opts.driver.uid + "/" + m_opts.table + (merge_id ? `+${merge_id}` : "");
|
|
@@ -671,19 +689,15 @@ function generateUID4ChainFind(m_opts, merges = [], data) {
|
|
|
671
689
|
}
|
|
672
690
|
return uid;
|
|
673
691
|
}
|
|
674
|
-
exports.generateUID4ChainFind = generateUID4ChainFind;
|
|
675
692
|
function generateUID4Model(m_opts) {
|
|
676
693
|
return m_opts.driver.uid + "/" + m_opts.table + "/" + m_opts.keys.join("/");
|
|
677
694
|
}
|
|
678
|
-
exports.generateUID4Model = generateUID4Model;
|
|
679
695
|
function makeIdForDriverTable(driver_uid, table) {
|
|
680
696
|
return `${driver_uid}/${table}`;
|
|
681
697
|
}
|
|
682
|
-
exports.makeIdForDriverTable = makeIdForDriverTable;
|
|
683
698
|
function bindInstance(instance, fn) {
|
|
684
699
|
return fn.bind(instance);
|
|
685
700
|
}
|
|
686
|
-
exports.bindInstance = bindInstance;
|
|
687
701
|
function buildAssocHooksContext(hookName, payload) {
|
|
688
702
|
const { $ref = {}, useChannel = $ref.useChannel || reusableChannelGenerator() } = payload;
|
|
689
703
|
const { instance = null, association = null, associations = [], association_ids = [], removeConditions = {}, } = $ref;
|
|
@@ -714,7 +728,6 @@ function buildAssocHooksContext(hookName, payload) {
|
|
|
714
728
|
}
|
|
715
729
|
return ctx;
|
|
716
730
|
}
|
|
717
|
-
exports.buildAssocHooksContext = buildAssocHooksContext;
|
|
718
731
|
function makeHandlerDecorator(opts = {}, hdlr) {
|
|
719
732
|
const { thisArg = null, onlyOnce = true } = opts;
|
|
720
733
|
let finishOnce = false;
|
|
@@ -723,7 +736,7 @@ function makeHandlerDecorator(opts = {}, hdlr) {
|
|
|
723
736
|
console.warn(`[makeHandlerDecorator] this function was once only`);
|
|
724
737
|
return;
|
|
725
738
|
}
|
|
726
|
-
finishOnce
|
|
739
|
+
finishOnce = true;
|
|
727
740
|
if (err)
|
|
728
741
|
throw err;
|
|
729
742
|
if (err === false)
|
|
@@ -731,7 +744,6 @@ function makeHandlerDecorator(opts = {}, hdlr) {
|
|
|
731
744
|
return hdlr.call(thisArg);
|
|
732
745
|
};
|
|
733
746
|
}
|
|
734
|
-
exports.makeHandlerDecorator = makeHandlerDecorator;
|
|
735
747
|
function getChannelInfo() {
|
|
736
748
|
return {
|
|
737
749
|
id: uuid.snowflake().hex(),
|
|
@@ -790,7 +802,6 @@ function reusableChannelGenerator() {
|
|
|
790
802
|
return results;
|
|
791
803
|
};
|
|
792
804
|
}
|
|
793
|
-
exports.reusableChannelGenerator = reusableChannelGenerator;
|
|
794
805
|
const createHookHelper = function (hooks, hook, { initialHooks = [] } = {}) {
|
|
795
806
|
return function (cb, opts) {
|
|
796
807
|
if (typeof cb !== "function") {
|
|
@@ -836,34 +847,27 @@ function attachOnceTypedHookRefToInstance(instance, type, typedHookRef) {
|
|
|
836
847
|
typedHookRef.useChannel = reusableChannelGenerator();
|
|
837
848
|
instance.$hookRef[type] = typedHookRef;
|
|
838
849
|
}
|
|
839
|
-
exports.attachOnceTypedHookRefToInstance = attachOnceTypedHookRefToInstance;
|
|
840
850
|
function arraify(item) {
|
|
841
851
|
return Array.isArray(item) ? item : [item];
|
|
842
852
|
}
|
|
843
|
-
exports.arraify = arraify;
|
|
844
853
|
function firstEl(item) {
|
|
845
854
|
return Array.isArray(item) ? item[0] : item;
|
|
846
855
|
}
|
|
847
|
-
exports.firstEl = firstEl;
|
|
848
856
|
function isKeyProperty(prop) {
|
|
849
857
|
return prop.key;
|
|
850
858
|
}
|
|
851
|
-
exports.isKeyProperty = isKeyProperty;
|
|
852
859
|
function isKeyPrimaryProperty(prop) {
|
|
853
860
|
return prop.key && prop.klass === 'primary';
|
|
854
861
|
}
|
|
855
|
-
exports.isKeyPrimaryProperty = isKeyPrimaryProperty;
|
|
856
862
|
function coercePositiveInt(value, fallbackValue = undefined) {
|
|
857
863
|
const num = parseInt(value, 10);
|
|
858
864
|
if (Number.isNaN(num))
|
|
859
865
|
return fallbackValue;
|
|
860
866
|
return Math.abs(num);
|
|
861
867
|
}
|
|
862
|
-
exports.coercePositiveInt = coercePositiveInt;
|
|
863
868
|
function getUUID() {
|
|
864
869
|
return uuid.snowflake().hex();
|
|
865
870
|
}
|
|
866
|
-
exports.getUUID = getUUID;
|
|
867
871
|
const DEFAULT_GENERATE_SQL_QUERY_SELECT = function (ctx) {
|
|
868
872
|
return this.query.select()
|
|
869
873
|
.from(ctx.fromTuple)
|
|
@@ -874,13 +878,11 @@ function isVirtualViewModel(model) {
|
|
|
874
878
|
return (Object.keys(model.allProperties).length === 0
|
|
875
879
|
&& Object.keys(model.virtualProperties).length > 0);
|
|
876
880
|
}
|
|
877
|
-
exports.isVirtualViewModel = isVirtualViewModel;
|
|
878
881
|
function disAllowOpForVModel(model, opName) {
|
|
879
882
|
if (isVirtualViewModel(model)) {
|
|
880
883
|
throw new Error_1.default(`operation '${opName}' not supported for virtual model`, 'NO_SUPPORT', { model: model.name });
|
|
881
884
|
}
|
|
882
885
|
}
|
|
883
|
-
exports.disAllowOpForVModel = disAllowOpForVModel;
|
|
884
886
|
function normalizeVirtualViewOption(virtualView, knex) {
|
|
885
887
|
let result = {
|
|
886
888
|
disabled: true,
|
|
@@ -912,7 +914,6 @@ function normalizeVirtualViewOption(virtualView, knex) {
|
|
|
912
914
|
}
|
|
913
915
|
return result;
|
|
914
916
|
}
|
|
915
|
-
exports.normalizeVirtualViewOption = normalizeVirtualViewOption;
|
|
916
917
|
/** @internal only for plugin developers */
|
|
917
918
|
function __wrapTableSourceAsGneratingSqlSelect({ virtualView, customSelect: _customSelect, generateSqlSelect, }, opts) {
|
|
918
919
|
const { modelTable, dialect } = opts;
|
|
@@ -972,4 +973,3 @@ function __wrapTableSourceAsGneratingSqlSelect({ virtualView, customSelect: _cus
|
|
|
972
973
|
return qSelect;
|
|
973
974
|
};
|
|
974
975
|
}
|
|
975
|
-
exports.__wrapTableSourceAsGneratingSqlSelect = __wrapTableSourceAsGneratingSqlSelect;
|
package/lib/orm/Validators.d.ts
CHANGED
package/lib/orm/Validators.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.
|
|
3
|
+
exports.patterns = exports.password = exports.outsideList = exports.insideList = exports.rangeLength = exports.rangeNumber = exports.notEmptyString = exports.required = void 0;
|
|
4
|
+
exports.equalToProperty = equalToProperty;
|
|
5
|
+
exports.unique = unique;
|
|
3
6
|
const Enforce = require("@fibjs/enforce");
|
|
4
7
|
const util = require("util");
|
|
5
8
|
exports.required = Enforce.required;
|
|
@@ -23,7 +26,6 @@ function equalToProperty(name, msg) {
|
|
|
23
26
|
return next(msg || 'not-equal-to-property');
|
|
24
27
|
};
|
|
25
28
|
}
|
|
26
|
-
exports.equalToProperty = equalToProperty;
|
|
27
29
|
;
|
|
28
30
|
/**
|
|
29
31
|
* Check if a property is unique in the collection.
|
|
@@ -96,5 +98,4 @@ function unique(opts = {}, msg = null) {
|
|
|
96
98
|
chain.all(handler);
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
|
-
exports.unique = unique;
|
|
100
101
|
;
|
package/lib/orm/Where/common.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.isModelConjunctionsKey =
|
|
3
|
+
exports.isModelConjunctionsKey = isModelConjunctionsKey;
|
|
3
4
|
const model_conjunctions_keys = ['or', 'and', 'not_or', 'not_and', 'not'];
|
|
4
5
|
function isModelConjunctionsKey(k) {
|
|
5
6
|
return model_conjunctions_keys.includes(k);
|
|
6
7
|
}
|
|
7
|
-
exports.isModelConjunctionsKey = isModelConjunctionsKey;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.filterDate =
|
|
3
|
+
exports.filterDate = filterDate;
|
|
3
4
|
const util = require("util");
|
|
4
5
|
const common_1 = require("./common");
|
|
5
6
|
function isNumbericDate(v) {
|
|
@@ -55,4 +56,3 @@ function filterDate(conds, m) {
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
exports.filterDate = filterDate;
|
package/lib/orm/index.d.ts
CHANGED
package/lib/orm/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.not_in = exports.lte = exports.lt = exports.gte = exports.gt = exports.ne = exports.eq = exports.not_like = exports.like = exports.not_between = exports.between = exports.Text = exports.
|
|
3
|
+
exports.not_in = exports.lte = exports.lt = exports.gte = exports.gt = exports.ne = exports.eq = exports.not_like = exports.like = exports.not_between = exports.between = exports.Text = exports.ErrorCodes = exports.singleton = exports.Settings = exports.validators = exports.Helpers = exports.addAdapter = exports.settings = exports.enforce = exports.ORM = exports.Property = void 0;
|
|
4
|
+
exports.connectSync = connectSync;
|
|
5
|
+
exports.connect = connect;
|
|
6
|
+
exports.use = use;
|
|
7
|
+
exports.definePlugin = definePlugin;
|
|
8
|
+
exports.defineModel = defineModel;
|
|
3
9
|
const events = require("events");
|
|
4
10
|
const SqlQuery = require("../sql-query/Query");
|
|
5
11
|
const Enforces = require("@fibjs/enforce");
|
|
@@ -63,7 +69,6 @@ function connectSync(opts) {
|
|
|
63
69
|
Utilities.takeAwayResult(syncResult, { no_throw: false });
|
|
64
70
|
return orm;
|
|
65
71
|
}
|
|
66
|
-
exports.connectSync = connectSync;
|
|
67
72
|
function connect(uri, cb) {
|
|
68
73
|
let args = Array.prototype.slice.apply(arguments);
|
|
69
74
|
Helpers.selectArgs(args, function (type, arg) {
|
|
@@ -90,7 +95,6 @@ function connect(uri, cb) {
|
|
|
90
95
|
});
|
|
91
96
|
return orm;
|
|
92
97
|
}
|
|
93
|
-
exports.connect = connect;
|
|
94
98
|
;
|
|
95
99
|
var ORM_2 = require("./ORM");
|
|
96
100
|
Object.defineProperty(exports, "ORM", { enumerable: true, get: function () { return ORM_2.ORM; } });
|
|
@@ -117,18 +121,15 @@ function use(connection, proto, opts, cb) {
|
|
|
117
121
|
return cb(err);
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
|
-
exports.use = use;
|
|
121
124
|
;
|
|
122
125
|
/* @internal */
|
|
123
126
|
exports.ErrorCodes = Error_1.default.codes;
|
|
124
127
|
function definePlugin(definition) {
|
|
125
128
|
return definition;
|
|
126
129
|
}
|
|
127
|
-
exports.definePlugin = definePlugin;
|
|
128
130
|
function defineModel(definition) {
|
|
129
131
|
return definition;
|
|
130
132
|
}
|
|
131
|
-
exports.defineModel = defineModel;
|
|
132
133
|
/** @deprecated use require('../sql-query/Query').Text instead */
|
|
133
134
|
exports.Text = SqlQuery.Text;
|
|
134
135
|
/** @deprecated use require('../sql-query/Query').comparators.between instead */
|
package/lib/orm-core/callback.js
CHANGED
package/lib/orm-core/dialect.js
CHANGED
package/lib/orm-core/error.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.
|
|
3
|
+
exports.catchBlocking = catchBlocking;
|
|
4
|
+
exports.takeAwayResult = takeAwayResult;
|
|
3
5
|
function catchBlocking(executor, args, opts) {
|
|
4
6
|
let error, result;
|
|
5
7
|
const { thisArg = null } = opts || {};
|
|
@@ -11,7 +13,6 @@ function catchBlocking(executor, args, opts) {
|
|
|
11
13
|
}
|
|
12
14
|
return { error, result };
|
|
13
15
|
}
|
|
14
|
-
exports.catchBlocking = catchBlocking;
|
|
15
16
|
function takeAwayResult(input, opts) {
|
|
16
17
|
const { use_tick = false, callback = null, } = opts || {};
|
|
17
18
|
const isFunc = typeof callback === 'function';
|
|
@@ -26,4 +27,3 @@ function takeAwayResult(input, opts) {
|
|
|
26
27
|
else
|
|
27
28
|
callback(input.error, input.result);
|
|
28
29
|
}
|
|
29
|
-
exports.takeAwayResult = takeAwayResult;
|
package/lib/orm-core/index.js
CHANGED
package/lib/orm-core/sync.js
CHANGED
package/lib/orm-core/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.filterPropertyDefaultValue =
|
|
3
|
+
exports.filterPropertyDefaultValue = filterPropertyDefaultValue;
|
|
3
4
|
function filterPropertyDefaultValue(property, ctx) {
|
|
4
5
|
let _dftValue;
|
|
5
6
|
if (property.hasOwnProperty('defaultValue'))
|
|
@@ -10,4 +11,3 @@ function filterPropertyDefaultValue(property, ctx) {
|
|
|
10
11
|
_dftValue = property.defaultValue;
|
|
11
12
|
return _dftValue;
|
|
12
13
|
}
|
|
13
|
-
exports.filterPropertyDefaultValue = filterPropertyDefaultValue;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.defineCustomType =
|
|
3
|
+
exports.defineCustomType = defineCustomType;
|
|
3
4
|
const DEFAULT_DATASTORE_TYPE = function (prop, ctx) {
|
|
4
5
|
return prop.type.toUpperCase();
|
|
5
6
|
};
|
|
@@ -10,4 +11,3 @@ function defineCustomType(opts) {
|
|
|
10
11
|
}
|
|
11
12
|
return opts;
|
|
12
13
|
}
|
|
13
|
-
exports.defineCustomType = defineCustomType;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.defineCustomType = exports.
|
|
3
|
+
exports.defineCustomType = exports.Transformers = void 0;
|
|
4
|
+
exports.transformer = transformer;
|
|
3
5
|
const Transformers = require("./transformers");
|
|
4
6
|
exports.Transformers = Transformers;
|
|
5
7
|
function transformer(type) {
|
|
@@ -17,6 +19,5 @@ function transformer(type) {
|
|
|
17
19
|
throw new Error('Unknown database type');
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
|
-
exports.transformer = transformer;
|
|
21
22
|
var customTypes_1 = require("./customTypes");
|
|
22
23
|
Object.defineProperty(exports, "defineCustomType", { enumerable: true, get: function () { return customTypes_1.defineCustomType; } });
|