fib-orm 1.4.2 → 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/License +1 -1
- package/README.md +53 -0
- package/lib/cli/commands/ddlFrom.d.ts +2 -0
- package/lib/cli/commands/ddlFrom.js +75 -0
- package/lib/cli/commands/dumpModel.d.ts +2 -0
- package/lib/cli/commands/dumpModel.js +107 -0
- package/lib/cli/commands/escape.d.ts +2 -0
- package/lib/cli/commands/escape.js +69 -0
- package/lib/cli/commands/spinner.d.ts +2 -0
- package/lib/cli/commands/spinner.js +37 -0
- package/lib/cli/commands/upgrade.d.ts +2 -0
- package/lib/cli/commands/upgrade.js +66 -0
- package/lib/cli/helpers/ddl.d.ts +17 -0
- package/lib/cli/helpers/ddl.js +55 -0
- package/lib/cli/helpers/package.d.ts +25 -0
- package/lib/cli/helpers/package.js +56 -0
- package/lib/cli/index.d.ts +2 -0
- package/lib/cli/index.js +19 -0
- package/lib/codepoints-map.json +762 -0
- package/lib/db-driver/Typo.d.ts +111 -0
- package/lib/db-driver/Typo.js +2 -0
- package/lib/db-driver/built-ins/base.class.d.ts +91 -0
- package/lib/db-driver/built-ins/base.class.js +187 -0
- package/lib/db-driver/built-ins/driver-dm.d.ts +17 -0
- package/lib/db-driver/built-ins/driver-dm.js +54 -0
- package/lib/db-driver/built-ins/driver-mongodb.d.ts +23 -0
- package/lib/db-driver/built-ins/driver-mongodb.js +47 -0
- package/lib/db-driver/built-ins/driver-mysql.d.ts +17 -0
- package/lib/db-driver/built-ins/driver-mysql.js +38 -0
- package/lib/db-driver/built-ins/driver-postgresql.d.ts +21 -0
- package/lib/db-driver/built-ins/driver-postgresql.js +77 -0
- package/lib/db-driver/built-ins/driver-redis.d.ts +11 -0
- package/lib/db-driver/built-ins/driver-redis.js +36 -0
- package/lib/db-driver/built-ins/driver-sqlite.d.ts +16 -0
- package/lib/db-driver/built-ins/driver-sqlite.js +35 -0
- package/lib/db-driver/index.d.ts +3 -0
- package/lib/db-driver/index.js +5 -0
- package/lib/db-driver/utils.d.ts +14 -0
- package/lib/db-driver/utils.js +187 -0
- package/lib/knex/deps/tarn/dist/PendingOperation.d.ts +12 -0
- package/lib/knex/deps/tarn/dist/PendingOperation.js +48 -0
- package/lib/knex/deps/tarn/dist/Pool.d.ts +97 -0
- package/lib/knex/deps/tarn/dist/Pool.js +516 -0
- package/lib/knex/deps/tarn/dist/PromiseInspection.d.ts +16 -0
- package/lib/knex/deps/tarn/dist/PromiseInspection.js +21 -0
- package/lib/knex/deps/tarn/dist/Resource.d.ts +9 -0
- package/lib/knex/deps/tarn/dist/Resource.js +19 -0
- package/lib/knex/deps/tarn/dist/TimeoutError.d.ts +2 -0
- package/lib/knex/deps/tarn/dist/TimeoutError.js +5 -0
- package/lib/knex/deps/tarn/dist/tarn.d.ts +3 -0
- package/lib/knex/deps/tarn/dist/tarn.js +10 -0
- package/lib/knex/deps/tarn/dist/utils.d.ts +14 -0
- package/lib/knex/deps/tarn/dist/utils.js +60 -0
- package/lib/knex/knex.d.ts +2 -0
- package/lib/knex/knex.js +4 -0
- package/lib/knex/sandbox.d.ts +4 -0
- package/lib/knex/sandbox.js +23 -0
- package/lib/orm/Adapters.d.ts +3 -0
- package/lib/orm/Adapters.js +44 -0
- package/lib/orm/AggregateFunctions.d.ts +3 -0
- package/lib/orm/AggregateFunctions.js +177 -0
- package/lib/orm/Associations/Extend.d.ts +22 -0
- package/lib/orm/Associations/Extend.js +274 -0
- package/lib/orm/Associations/Many.d.ts +16 -0
- package/lib/orm/Associations/Many.js +569 -0
- package/lib/orm/Associations/One.d.ts +16 -0
- package/lib/orm/Associations/One.js +310 -0
- package/lib/orm/Associations/_utils.d.ts +14 -0
- package/lib/orm/Associations/_utils.js +53 -0
- package/lib/orm/ChainFind.d.ts +3 -0
- package/lib/orm/ChainFind.js +328 -0
- package/lib/orm/ChainInstance.d.ts +6 -0
- package/lib/orm/ChainInstance.js +74 -0
- package/lib/orm/Debug.d.ts +2 -0
- package/lib/orm/Debug.js +17 -0
- package/lib/orm/Drivers/DB/base.d.ts +2 -0
- package/lib/orm/Drivers/DB/base.js +4 -0
- package/lib/orm/Drivers/DB/dm.d.ts +9 -0
- package/lib/orm/Drivers/DB/dm.js +24 -0
- package/lib/orm/Drivers/DB/mysql.d.ts +9 -0
- package/lib/orm/Drivers/DB/mysql.js +24 -0
- package/lib/orm/Drivers/DB/postgres.d.ts +9 -0
- package/lib/orm/Drivers/DB/postgres.js +23 -0
- package/lib/orm/Drivers/DB/sqlite3.d.ts +14 -0
- package/lib/orm/Drivers/DB/sqlite3.js +40 -0
- package/lib/orm/Drivers/DML/_ddl-sql.d.ts +3 -0
- package/lib/orm/Drivers/DML/_ddl-sql.js +52 -0
- package/lib/orm/Drivers/DML/_dml-helpers.d.ts +19 -0
- package/lib/orm/Drivers/DML/_dml-helpers.js +51 -0
- package/lib/orm/Drivers/DML/_shared.d.ts +9 -0
- package/lib/orm/Drivers/DML/_shared.js +39 -0
- package/lib/orm/Drivers/DML/_utils.d.ts +8 -0
- package/lib/orm/Drivers/DML/_utils.js +67 -0
- package/lib/orm/Drivers/DML/constants.d.ts +3 -0
- package/lib/orm/Drivers/DML/constants.js +3 -0
- package/lib/orm/Drivers/DML/dm.d.ts +2 -0
- package/lib/orm/Drivers/DML/dm.js +294 -0
- package/lib/orm/Drivers/DML/index.d.ts +4 -0
- package/lib/orm/Drivers/DML/index.js +7 -0
- package/lib/orm/Drivers/DML/mysql.d.ts +2 -0
- package/lib/orm/Drivers/DML/mysql.js +252 -0
- package/lib/orm/Drivers/DML/postgres.d.ts +2 -0
- package/lib/orm/Drivers/DML/postgres.js +277 -0
- package/lib/orm/Drivers/DML/sqlite.d.ts +2 -0
- package/lib/orm/Drivers/DML/sqlite.js +267 -0
- package/lib/orm/Error.d.ts +11 -0
- package/lib/orm/Error.js +41 -0
- package/lib/orm/Helpers.d.ts +35 -0
- package/lib/orm/Helpers.js +234 -0
- package/lib/orm/Hook.d.ts +13 -0
- package/lib/orm/Hook.js +100 -0
- package/lib/orm/Instance.d.ts +2 -0
- package/lib/orm/Instance.js +698 -0
- package/lib/orm/LazyLoad.d.ts +4 -0
- package/lib/orm/LazyLoad.js +76 -0
- package/lib/orm/Model.d.ts +6 -0
- package/lib/orm/Model.js +974 -0
- package/lib/orm/ORM.d.ts +37 -0
- package/lib/orm/ORM.js +242 -0
- package/lib/orm/Patch/fib-cache.d.ts +39 -0
- package/lib/orm/Patch/fib-cache.js +2 -0
- package/lib/orm/Patch/plugin.d.ts +4 -0
- package/lib/orm/Patch/plugin.js +14 -0
- package/lib/orm/Property.d.ts +9 -0
- package/lib/orm/Property.js +71 -0
- package/lib/orm/Settings.d.ts +42 -0
- package/lib/orm/Settings.js +120 -0
- package/lib/orm/Singleton.d.ts +5 -0
- package/lib/orm/Singleton.js +73 -0
- package/lib/orm/Typo/Adapter.d.ts +5 -0
- package/lib/orm/Typo/Adapter.js +2 -0
- package/lib/orm/Typo/DMLDriver.d.ts +209 -0
- package/lib/orm/Typo/DMLDriver.js +2 -0
- package/lib/orm/Typo/Db.d.ts +35 -0
- package/lib/orm/Typo/Db.js +2 -0
- package/lib/orm/Typo/Error.d.ts +29 -0
- package/lib/orm/Typo/Error.js +2 -0
- package/lib/orm/Typo/ORM.d.ts +231 -0
- package/lib/orm/Typo/ORM.js +4 -0
- package/lib/orm/Typo/Validators.d.ts +31 -0
- package/lib/orm/Typo/Validators.js +3 -0
- package/lib/orm/Typo/_common.d.ts +37 -0
- package/lib/orm/Typo/_common.js +2 -0
- package/lib/orm/Typo/assoc.d.ts +221 -0
- package/lib/orm/Typo/assoc.js +2 -0
- package/lib/orm/Typo/hook.d.ts +42 -0
- package/lib/orm/Typo/hook.js +2 -0
- package/lib/orm/Typo/instance.d.ts +156 -0
- package/lib/orm/Typo/instance.js +2 -0
- package/lib/orm/Typo/model.d.ts +311 -0
- package/lib/orm/Typo/model.js +7 -0
- package/lib/orm/Typo/patch.d.ts +31 -0
- package/lib/orm/Typo/patch.js +2 -0
- package/lib/orm/Typo/property.d.ts +57 -0
- package/lib/orm/Typo/property.js +2 -0
- package/lib/orm/Typo/query.d.ts +216 -0
- package/lib/orm/Typo/query.js +2 -0
- package/lib/orm/Typo/settings.d.ts +35 -0
- package/lib/orm/Typo/settings.js +6 -0
- package/lib/orm/Typo/synchronous.d.ts +47 -0
- package/lib/orm/Typo/synchronous.js +2 -0
- package/lib/orm/Utilities.d.ts +178 -0
- package/lib/orm/Utilities.js +975 -0
- package/lib/orm/Validators.d.ts +33 -0
- package/lib/orm/Validators.js +101 -0
- package/lib/orm/Where/common.d.ts +1 -0
- package/lib/orm/Where/common.js +7 -0
- package/lib/orm/Where/filterDate.d.ts +11 -0
- package/lib/orm/Where/filterDate.js +58 -0
- package/lib/orm/index.d.ts +67 -0
- package/lib/orm/index.js +158 -0
- package/lib/orm-core/callback.d.ts +12 -0
- package/lib/orm-core/callback.js +2 -0
- package/lib/orm-core/dialect.d.ts +80 -0
- package/lib/orm-core/dialect.js +2 -0
- package/lib/orm-core/error.d.ts +16 -0
- package/lib/orm-core/error.js +29 -0
- package/lib/orm-core/index.d.ts +6 -0
- package/lib/orm-core/index.js +7 -0
- package/lib/orm-core/sync.d.ts +12 -0
- package/lib/orm-core/sync.js +2 -0
- package/lib/orm-core/utils.d.ts +1 -0
- package/lib/orm-core/utils.js +6 -0
- package/lib/orm-property/Property.d.ts +78 -0
- package/lib/orm-property/Property.js +2 -0
- package/lib/orm-property/Utils.d.ts +9 -0
- package/lib/orm-property/Utils.js +13 -0
- package/lib/orm-property/customTypes.d.ts +2 -0
- package/lib/orm-property/customTypes.js +13 -0
- package/lib/orm-property/index.d.ts +10 -0
- package/lib/orm-property/index.js +23 -0
- package/lib/orm-property/transformer.d.ts +5 -0
- package/lib/orm-property/transformer.js +10 -0
- package/lib/orm-property/transformers/dm.d.ts +29 -0
- package/lib/orm-property/transformers/dm.js +238 -0
- package/lib/orm-property/transformers/index.d.ts +4 -0
- package/lib/orm-property/transformers/index.js +6 -0
- package/lib/orm-property/transformers/mysql.d.ts +101 -0
- package/lib/orm-property/transformers/mysql.js +262 -0
- package/lib/orm-property/transformers/postgresql.d.ts +54 -0
- package/lib/orm-property/transformers/postgresql.js +190 -0
- package/lib/orm-property/transformers/sqlite.d.ts +19 -0
- package/lib/orm-property/transformers/sqlite.js +172 -0
- package/lib/sql-ddl-sync/Dialects/dm.d.ts +39 -0
- package/lib/sql-ddl-sync/Dialects/dm.js +297 -0
- package/lib/sql-ddl-sync/Dialects/index.d.ts +6 -0
- package/lib/sql-ddl-sync/Dialects/index.js +8 -0
- package/lib/sql-ddl-sync/Dialects/mysql.d.ts +38 -0
- package/lib/sql-ddl-sync/Dialects/mysql.js +241 -0
- package/lib/sql-ddl-sync/Dialects/postgresql.d.ts +39 -0
- package/lib/sql-ddl-sync/Dialects/postgresql.js +287 -0
- package/lib/sql-ddl-sync/Dialects/sqlite.d.ts +43 -0
- package/lib/sql-ddl-sync/Dialects/sqlite.js +257 -0
- package/lib/sql-ddl-sync/SQL.d.ts +12 -0
- package/lib/sql-ddl-sync/SQL.js +108 -0
- package/lib/sql-ddl-sync/Typo/Collection.d.ts +13 -0
- package/lib/sql-ddl-sync/Typo/Collection.js +2 -0
- package/lib/sql-ddl-sync/Typo/DbIndex.d.ts +13 -0
- package/lib/sql-ddl-sync/Typo/DbIndex.js +2 -0
- package/lib/sql-ddl-sync/Typo/Dialect.d.ts +81 -0
- package/lib/sql-ddl-sync/Typo/Dialect.js +2 -0
- package/lib/sql-ddl-sync/Typo/Driver.d.ts +53 -0
- package/lib/sql-ddl-sync/Typo/Driver.js +2 -0
- package/lib/sql-ddl-sync/Typo/Query.d.ts +7 -0
- package/lib/sql-ddl-sync/Typo/Query.js +2 -0
- package/lib/sql-ddl-sync/Typo/SQL.d.ts +31 -0
- package/lib/sql-ddl-sync/Typo/SQL.js +2 -0
- package/lib/sql-ddl-sync/Typo/_common.d.ts +29 -0
- package/lib/sql-ddl-sync/Typo/_common.js +2 -0
- package/lib/sql-ddl-sync/Utils.d.ts +39 -0
- package/lib/sql-ddl-sync/Utils.js +217 -0
- package/lib/sql-ddl-sync/index.d.ts +87 -0
- package/lib/sql-ddl-sync/index.js +372 -0
- package/lib/sql-query/Comparators.d.ts +3 -0
- package/lib/sql-query/Comparators.js +95 -0
- package/lib/sql-query/Create.d.ts +35 -0
- package/lib/sql-query/Create.js +78 -0
- package/lib/sql-query/Dialects/dm.d.ts +3 -0
- package/lib/sql-query/Dialects/dm.js +75 -0
- package/lib/sql-query/Dialects/index.d.ts +10 -0
- package/lib/sql-query/Dialects/index.js +13 -0
- package/lib/sql-query/Dialects/mssql.d.ts +3 -0
- package/lib/sql-query/Dialects/mssql.js +74 -0
- package/lib/sql-query/Dialects/mysql.d.ts +3 -0
- package/lib/sql-query/Dialects/mysql.js +101 -0
- package/lib/sql-query/Dialects/postgresql.d.ts +3 -0
- package/lib/sql-query/Dialects/postgresql.js +77 -0
- package/lib/sql-query/Dialects/sqlite.d.ts +3 -0
- package/lib/sql-query/Dialects/sqlite.js +62 -0
- package/lib/sql-query/Helpers.d.ts +37 -0
- package/lib/sql-query/Helpers.js +260 -0
- package/lib/sql-query/Insert.d.ts +12 -0
- package/lib/sql-query/Insert.js +34 -0
- package/lib/sql-query/Query.d.ts +28 -0
- package/lib/sql-query/Query.js +120 -0
- package/lib/sql-query/Remove.d.ts +16 -0
- package/lib/sql-query/Remove.js +94 -0
- package/lib/sql-query/Select.d.ts +62 -0
- package/lib/sql-query/Select.js +534 -0
- package/lib/sql-query/Set.d.ts +4 -0
- package/lib/sql-query/Set.js +16 -0
- package/lib/sql-query/Typo/Aggregation.d.ts +32 -0
- package/lib/sql-query/Typo/Aggregation.js +2 -0
- package/lib/sql-query/Typo/Comparators.d.ts +140 -0
- package/lib/sql-query/Typo/Comparators.js +2 -0
- package/lib/sql-query/Typo/Dialect.d.ts +39 -0
- package/lib/sql-query/Typo/Dialect.js +2 -0
- package/lib/sql-query/Typo/Field.d.ts +8 -0
- package/lib/sql-query/Typo/Field.js +2 -0
- package/lib/sql-query/Typo/Helper.d.ts +4 -0
- package/lib/sql-query/Typo/Helper.js +2 -0
- package/lib/sql-query/Typo/Query-ChainBuilder.d.ts +80 -0
- package/lib/sql-query/Typo/Query-ChainBuilder.js +2 -0
- package/lib/sql-query/Typo/Query.d.ts +34 -0
- package/lib/sql-query/Typo/Query.js +17 -0
- package/lib/sql-query/Typo/Sql.d.ts +143 -0
- package/lib/sql-query/Typo/Sql.js +2 -0
- package/lib/sql-query/Typo/SubQuery.d.ts +39 -0
- package/lib/sql-query/Typo/SubQuery.js +2 -0
- package/lib/sql-query/Typo/index.d.ts +9 -0
- package/lib/sql-query/Typo/index.js +2 -0
- package/lib/sql-query/Update.d.ts +15 -0
- package/lib/sql-query/Update.js +39 -0
- package/lib/sql-query/Where.d.ts +4 -0
- package/lib/sql-query/Where.js +280 -0
- package/package.json +71 -36
- package/.travis.yml +0 -14
- package/@types/index.d.ts +0 -254
- package/@types/orm_mirror/orm.d.ts +0 -275
- package/@types/orm_mirror/sql-query.d.ts +0 -79
- package/Readme.md +0 -843
- package/lib/index.js +0 -13
- package/lib/modules/mysql.js +0 -35
- package/lib/modules/sqlite3.js +0 -27
- package/lib/patch.js +0 -271
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare namespace FxOrmSettings {
|
|
2
|
+
export interface SettingInstance {
|
|
3
|
+
set(key: string, value: any): SettingInstance;
|
|
4
|
+
get(key: string, def?: Function): any;
|
|
5
|
+
unset(): SettingInstance;
|
|
6
|
+
}
|
|
7
|
+
class Settings {
|
|
8
|
+
constructor(settings: any);
|
|
9
|
+
static Container: any;
|
|
10
|
+
static defaults(): {
|
|
11
|
+
properties: {
|
|
12
|
+
primary_key: string;
|
|
13
|
+
association_key: string;
|
|
14
|
+
required: boolean;
|
|
15
|
+
};
|
|
16
|
+
instance: {
|
|
17
|
+
identityCache: boolean;
|
|
18
|
+
identityCacheSaveCheck: boolean;
|
|
19
|
+
autoSave: boolean;
|
|
20
|
+
autoFetch: boolean;
|
|
21
|
+
autoFetchLimit: number;
|
|
22
|
+
cascadeRemove: boolean;
|
|
23
|
+
returnAllErrors: boolean;
|
|
24
|
+
};
|
|
25
|
+
connection: {
|
|
26
|
+
reconnect: boolean;
|
|
27
|
+
poll: boolean;
|
|
28
|
+
debug: boolean;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export type ISettings = Settings;
|
|
33
|
+
export var settings: SettingInstance;
|
|
34
|
+
export {};
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { FxOrmCommon } from './_common';
|
|
2
|
+
import type { FxOrmAssociation } from "./assoc";
|
|
3
|
+
import type { FxOrmInstance } from "./instance";
|
|
4
|
+
import type { FxOrmModel } from "./model";
|
|
5
|
+
import type { FxOrmQuery } from './query';
|
|
6
|
+
import type { FxSqlQuerySubQuery } from "../../sql-query/Query";
|
|
7
|
+
export declare namespace FxOrmSynchronous {
|
|
8
|
+
interface VoidReturn {
|
|
9
|
+
(): void;
|
|
10
|
+
}
|
|
11
|
+
interface UnknownReturn {
|
|
12
|
+
(): any;
|
|
13
|
+
}
|
|
14
|
+
interface SynchronizedModel<HP extends Record<string, FxOrmInstance.FieldRuntimeType> = Record<string, FxOrmInstance.FieldRuntimeType>, HM extends Record<string, (...args: any) => any> = Record<string, (...args: any) => any>> {
|
|
15
|
+
findSync<T = FxOrmInstance.Instance<HP, HM>[]>(conditions?: FxOrmQuery.QueryConditions__Find, options?: FxOrmModel.ModelOptions__Find): T;
|
|
16
|
+
findSync<T = FxOrmInstance.Instance<HP, HM>[]>(conditions: FxOrmQuery.QueryConditions__Find, limit: number, order: string[]): T;
|
|
17
|
+
allSync: SynchronizedModel['findSync'];
|
|
18
|
+
whereSync: SynchronizedModel['findSync'];
|
|
19
|
+
countSync(conditions?: FxOrmQuery.QueryConditions__Find): number;
|
|
20
|
+
existsSync(...conditions: (FxOrmCommon.IdType | FxSqlQuerySubQuery.SubQueryConditions)[]): boolean;
|
|
21
|
+
oneSync(conditions?: FxOrmQuery.QueryConditions__Find, options?: FxOrmModel.ModelOptions__Find): FxOrmInstance.Instance<HP, HM> | null;
|
|
22
|
+
oneSync(conditions?: FxOrmQuery.QueryConditions__Find, order?: string[]): FxOrmInstance.Instance<HP, HM> | null;
|
|
23
|
+
createSync<T = FxOrmInstance.Instance<HP, HM>>(data: FxOrmInstance.InstanceDataPayload): T;
|
|
24
|
+
createSync<T = FxOrmInstance.Instance<HP, HM>[]>(data: FxOrmInstance.InstanceDataPayload[]): T;
|
|
25
|
+
getSync(...ids: any[]): FxOrmInstance.Instance<HP, HM> | null;
|
|
26
|
+
findBySync: {
|
|
27
|
+
<T = FxOrmInstance.Instance<HP, HM>[]>(ext_name: string, conditions?: FxOrmQuery.QueryConditions__Find, options?: FxOrmAssociation.ModelAssociationMethod__FindByOptions): T;
|
|
28
|
+
};
|
|
29
|
+
syncSync: VoidReturn;
|
|
30
|
+
clearSync: VoidReturn;
|
|
31
|
+
dropSync: UnknownReturn;
|
|
32
|
+
/**
|
|
33
|
+
* other patched synchronous version method
|
|
34
|
+
* - lazyLoad: getXXXSync, setXXXSync, removeXXXSync
|
|
35
|
+
* - association: [addAccessor]Sync, [getAccessor]Sync, [hasAccessor]Sync, [setAccessor]Sync, [removeAccessor]Sync
|
|
36
|
+
*/
|
|
37
|
+
[ek: string]: any;
|
|
38
|
+
}
|
|
39
|
+
interface SynchronizedIChainFind {
|
|
40
|
+
}
|
|
41
|
+
interface SynchronizedORMInstance {
|
|
42
|
+
syncSync: VoidReturn;
|
|
43
|
+
closeSync: VoidReturn;
|
|
44
|
+
dropSync: VoidReturn;
|
|
45
|
+
pingSync: VoidReturn;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import FxORMCore = require('../orm-core/index');
|
|
2
|
+
import { FxSqlQuery, FxSqlQuerySubQuery, FxSqlQuerySql, FxSqlQueryDialect } from '../sql-query/Query';
|
|
3
|
+
import type { FxOrmInstance } from './Typo/instance';
|
|
4
|
+
import type { FxOrmModel } from './Typo/model';
|
|
5
|
+
import type { FxOrmQuery } from './Typo/query';
|
|
6
|
+
import type { FxOrmAssociation } from './Typo/assoc';
|
|
7
|
+
import { FxOrmProperty } from './Typo/property';
|
|
8
|
+
import { FxOrmCommon } from './Typo/_common';
|
|
9
|
+
import { FxOrmNS } from './Typo/ORM';
|
|
10
|
+
import { FxOrmError } from './Typo/Error';
|
|
11
|
+
import { FxOrmHook } from './Typo/hook';
|
|
12
|
+
import { FxOrmDMLDriver } from './Typo/DMLDriver';
|
|
13
|
+
export declare function standardizeOrder(order: FxOrmModel.ModelOptions__Find['order']): FxOrmQuery.OrderNormalizedTupleMixin;
|
|
14
|
+
export declare function addTableToStandardedOrder(order: FxOrmQuery.OrderNormalizedTupleMixin, table_alias: string | FxSqlQuerySql.SqlFromTableInput): FxOrmQuery.ChainFindOptions['order'];
|
|
15
|
+
/**
|
|
16
|
+
* @description filtered out FxOrmInstance.Instance in mixed FxSqlQuerySubQuery.SubQueryConditions | { [k: string]: FxOrmInstance.Instance }
|
|
17
|
+
*/
|
|
18
|
+
export declare function checkConditions(conditions: (FxSqlQuerySubQuery.SubQueryConditions | {
|
|
19
|
+
[k: string]: FxOrmInstance.Instance;
|
|
20
|
+
}), one_associations: (FxOrmAssociation.InstanceAssociatedInstance | FxOrmAssociation.InstanceAssociationItem_HasOne)[]): FxSqlQuerySubQuery.SubQueryConditions;
|
|
21
|
+
/**
|
|
22
|
+
* Gets all the values within an object or array, optionally
|
|
23
|
+
* using a keys array to get only specific values
|
|
24
|
+
*/
|
|
25
|
+
export declare function values(obj: any[] | {
|
|
26
|
+
[k: string]: any;
|
|
27
|
+
}, keys?: string[]): any[];
|
|
28
|
+
export declare function hasValues(obj: {
|
|
29
|
+
[k: string]: any;
|
|
30
|
+
}, keys: string[]): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @description from from <source> object, copy specific ids(determined by <source_model>) to <target> object as
|
|
33
|
+
* correspoding <associacted_fields>, for example:
|
|
34
|
+
*
|
|
35
|
+
* if <source_model> id: id1, id2
|
|
36
|
+
* if <associacted_fields>: user_id, production_id
|
|
37
|
+
* source.id1 = 1, source.id2 = 2
|
|
38
|
+
* target.user_id = undefined, target.production_id = undefined
|
|
39
|
+
*
|
|
40
|
+
* Then, we will get:
|
|
41
|
+
*
|
|
42
|
+
* target.user_id = 1, target.production_id = 2
|
|
43
|
+
*
|
|
44
|
+
* if target.user_id is not undefined, it wouldn't be overwritten unless <overwrite> is true
|
|
45
|
+
*
|
|
46
|
+
* @param source_model
|
|
47
|
+
* @param associacted_fields
|
|
48
|
+
* @param source
|
|
49
|
+
* @param target
|
|
50
|
+
* @param overwrite
|
|
51
|
+
*/
|
|
52
|
+
export declare function populateModelIdKeysConditions(source_model: FxOrmModel.Model, associacted_fields: string[], source: FxOrmInstance.InstanceDataPayload, target: FxSqlQuerySubQuery.SubQueryConditions, overwrite?: boolean): void;
|
|
53
|
+
export declare function getConditions(model: FxOrmModel.Model, fields: string[], from: FxSqlQuerySubQuery.SubQueryConditions): FxSqlQuerySubQuery.SubQueryConditions;
|
|
54
|
+
/**
|
|
55
|
+
* TODO: add comment for this method
|
|
56
|
+
*
|
|
57
|
+
* @description WIP
|
|
58
|
+
* @param params
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
export declare function wrapFieldObject(params: {
|
|
62
|
+
field: FxOrmAssociation.InstanceAssociationItem['field'];
|
|
63
|
+
model: FxOrmModel.Model;
|
|
64
|
+
altName: string;
|
|
65
|
+
mapsTo?: FxOrmModel.ModelPropertyDefinition['mapsTo'];
|
|
66
|
+
}): Record<string, FxOrmProperty.NormalizedProperty>;
|
|
67
|
+
/**
|
|
68
|
+
* TODO: add comment for this method
|
|
69
|
+
* @param model related Model
|
|
70
|
+
* @param name field name
|
|
71
|
+
* @param required is field required for relationship
|
|
72
|
+
* @param reversed is model is reversed in relationship
|
|
73
|
+
*/
|
|
74
|
+
export declare function formatAssociatedField(model: FxOrmModel.Model, name: string, required: boolean, reversed: boolean): Record<string, FxOrmProperty.NormalizedProperty>;
|
|
75
|
+
/** @internal */
|
|
76
|
+
export declare function extractHasManyExtraConditions(association: FxOrmAssociation.InstanceAssociationItem_HasMany, conditions: FxOrmModel.ModelFindByDescriptorItem['conditions'], extra_where?: FxOrmModel.ModelFindByDescriptorItem['conditions']): FxOrmQuery.QueryConditions__Find;
|
|
77
|
+
/**
|
|
78
|
+
* @description top conditions means that conditions which matches query's top select.
|
|
79
|
+
*/
|
|
80
|
+
export declare function extractSelectTopConditions(conditions: FxOrmModel.ModelOptions__Find['conditions'], topFields: string[]): {
|
|
81
|
+
topConditions: FIBJS.GeneralObject;
|
|
82
|
+
tableConditions: FIBJS.GeneralObject;
|
|
83
|
+
};
|
|
84
|
+
export declare function convertPropToJoinKeyProp(props: Record<string, FxOrmProperty.NormalizedProperty>, opts: {
|
|
85
|
+
required: boolean;
|
|
86
|
+
makeKey: boolean;
|
|
87
|
+
}): Record<string, FxOrmProperty.NormalizedProperty>;
|
|
88
|
+
export declare function getRealPath(path_str: string, stack_index?: number): string;
|
|
89
|
+
/**
|
|
90
|
+
* @description rename a field name in <dataIn> according to the name map in <properties>
|
|
91
|
+
* @example
|
|
92
|
+
* ```
|
|
93
|
+
* dataIn: { a: 1, b: 2 };
|
|
94
|
+
* properties: { a: { mapsTo: 'a1' }, b: { mapsTo: 'b' } };
|
|
95
|
+
* -->
|
|
96
|
+
* result: { a1: 1, b: 2 };
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @param dataIn
|
|
100
|
+
* @param properties
|
|
101
|
+
*/
|
|
102
|
+
export declare function transformPropertyNames(dataIn: FxOrmInstance.InstanceDataPayload, properties: Record<string, FxOrmProperty.NormalizedProperty> | FxOrmModel.ModelPropertyDefinition): FxOrmInstance.InstanceDataPayload;
|
|
103
|
+
export declare function transformOrderPropertyNames(order: FxOrmQuery.ChainFindOptions['order'], properties: Record<string, FxOrmProperty.NormalizedProperty>): (FxSqlQuery.OrderSqlStyleTuple | FxSqlQuery.OrderNormalizedTuple)[];
|
|
104
|
+
export declare function renameDatastoreFieldsToPropertyNames(data: FxOrmInstance.InstanceDataPayload, fieldToPropertyMap: FxOrmProperty.FieldToPropertyMapType): FxOrmInstance.InstanceDataPayload;
|
|
105
|
+
export declare function camelCaseHasMany(text: string): string;
|
|
106
|
+
export declare function ucfirst(text: string): string;
|
|
107
|
+
export declare function formatNameFor(key: 'assoc:hasMany' | 'assoc:hasOne' | 'findBy:common' | 'findBy:hasOne' | 'assoc:extendsTo' | 'findBy:extendsTo' | 'field:lazyload' | 'syncify:assoc', name: string): string;
|
|
108
|
+
export declare function combineMergeInfoToArray(merges: FxOrmQuery.ChainFindOptions['merge']): FxOrmQuery.ChainFindMergeInfo[];
|
|
109
|
+
export declare function parseTableInputForSelect(ta_str: string): {
|
|
110
|
+
pure_table: string | FxSqlQuerySql.SqlFromTableInput;
|
|
111
|
+
alias: string;
|
|
112
|
+
from_tuple: FxSqlQuerySql.SqlTableTuple;
|
|
113
|
+
};
|
|
114
|
+
export declare function tableAlias(table: string | FxSqlQuerySql.SqlFromTableInput, alias?: string, same_suffix?: string): string;
|
|
115
|
+
export declare function tableAliasCalculatorInOneQuery(): (tableName: string, get_only?: boolean) => number;
|
|
116
|
+
export declare function ORM_Error(err: Error, cb?: FxOrmCommon.VoidCallback): FxOrmNS.ORMLike;
|
|
117
|
+
export declare function queryParamCast(val: any): any;
|
|
118
|
+
export declare function isDriverNotSupportedError(err: FxOrmError.ExtendedError): boolean;
|
|
119
|
+
export declare const catchBlocking: typeof FxORMCore.Utils.exposeErrAndResultFromSyncMethod;
|
|
120
|
+
export declare const takeAwayResult: typeof FxORMCore.Utils.throwErrOrCallabckErrResult;
|
|
121
|
+
export declare function doWhenErrIs(compare: {
|
|
122
|
+
message?: string;
|
|
123
|
+
literalCode?: string;
|
|
124
|
+
}, callback: Function, err?: FxOrmError.ExtendedError): void;
|
|
125
|
+
export declare function getErrWaitor(shouldWait?: boolean): FxOrmError.ErrorWaitor;
|
|
126
|
+
export declare function getValueWaitor<T = any>(shouldWait?: boolean): FxOrmCommon.ValueWaitor<T>;
|
|
127
|
+
export declare function parallelQueryIfPossible<T = any, RESP = any>(can_parallel: boolean, iteratee: T[], iterator: (value: T, index?: number, array?: T[]) => RESP): RESP[];
|
|
128
|
+
/**
|
|
129
|
+
* @description do some mutation for field-value in conditions
|
|
130
|
+
*
|
|
131
|
+
* @param conditions
|
|
132
|
+
* @param host
|
|
133
|
+
*/
|
|
134
|
+
export declare function filterWhereConditionsInput(conditions: FxSqlQuerySubQuery.SubQueryConditions, host: {
|
|
135
|
+
properties: Record<string, FxOrmProperty.NormalizedProperty>;
|
|
136
|
+
} | FxOrmModel.Model): FxSqlQuerySubQuery.SubQueryConditions;
|
|
137
|
+
export declare function addUnwritableProperty(obj: any, property: string, value: any, propertyConfiguration?: PropertyDescriptor): void;
|
|
138
|
+
export declare function addHiddenReadonlyProperty(obj: any, property: string, getter: () => any, propertyConfiguration?: PropertyDescriptor): void;
|
|
139
|
+
export declare function addHiddenUnwritableMethodToInstance(instance: FxOrmInstance.Instance, method_name: 'save' | 'saveSync' | string, fn: Function, propertyConfiguration?: PropertyDescriptor): void;
|
|
140
|
+
export declare function addHiddenPropertyToInstance(instance: FxOrmInstance.Instance, property_name: string, value: any, propertyConfiguration?: PropertyDescriptor): void;
|
|
141
|
+
export declare function addHiddenReadonlyPropertyToInstance(instance: FxOrmInstance.Instance, property_name: string, getter: () => any, propertyConfiguration?: PropertyDescriptor): void;
|
|
142
|
+
export declare function fillSyncVersionAccessorForAssociation(association: FxOrmAssociation.InstanceAssociationItem): FxOrmAssociation.InstanceAssociationItem;
|
|
143
|
+
export declare function addHookPatchHelperForAssociation(association: FxOrmAssociation.InstanceAssociationItem): void;
|
|
144
|
+
export declare function generateUID4SoloGet(m_opts: FxOrmModel.ModelConstructorOptions, ids: (string | number)[]): string;
|
|
145
|
+
export declare function generateUID4ChainFind(m_opts: FxOrmModel.ModelConstructorOptions, merges: FxOrmQuery.ChainFindMergeInfo[], data: FxOrmInstance.InstanceDataPayload): string;
|
|
146
|
+
export declare function generateUID4Model(m_opts: FxOrmModel.ModelConstructorOptions): string;
|
|
147
|
+
export declare function makeIdForDriverTable(driver_uid: string, table: string): string;
|
|
148
|
+
export declare function bindInstance(instance: FxOrmInstance.Instance, fn: Function): any;
|
|
149
|
+
export declare function buildAssocHooksContext(hookName: keyof FxOrmAssociation.InstanceAssociationItem['hooks'], payload: {
|
|
150
|
+
$ref: FxOrmAssociation.__AssocHooksCtx;
|
|
151
|
+
useChannel?: FxOrmAssociation.__AssocHooksCtx['useChannel'];
|
|
152
|
+
}): Record<string, any>;
|
|
153
|
+
export declare function makeHandlerDecorator(opts: {
|
|
154
|
+
thisArg?: any;
|
|
155
|
+
onlyOnce?: boolean;
|
|
156
|
+
}, hdlr: () => any): (err: FxOrmCommon.Arraible<FxOrmError.ExtendedError> | false) => any;
|
|
157
|
+
export declare function reusableChannelGenerator(): () => FxOrmHook.HookChannelResults<Function>;
|
|
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;
|
|
159
|
+
export declare function attachOnceTypedHookRefToInstance(instance: FxOrmInstance.Instance, type: 'save' | 'create' | 'remove', typedHookRef: Record<string, any>): void;
|
|
160
|
+
export declare function arraify<T = any>(item: T | T[]): T[];
|
|
161
|
+
export declare function firstEl<T = any>(item: T | T[]): T;
|
|
162
|
+
export declare function isKeyProperty(prop: FxOrmProperty.NormalizedProperty): boolean;
|
|
163
|
+
export declare function isKeyPrimaryProperty(prop: FxOrmProperty.NormalizedProperty): boolean;
|
|
164
|
+
export declare function coercePositiveInt<T extends number | undefined | null = undefined>(value: any, fallbackValue?: T): number | T;
|
|
165
|
+
export declare function getUUID(): string;
|
|
166
|
+
export declare const DEFAULT_GENERATE_SQL_QUERY_SELECT: FxOrmDMLDriver.DMLDriver_FindOptions['generateSqlSelect'];
|
|
167
|
+
export declare function isVirtualViewModel(model: FxOrmModel.Model): boolean;
|
|
168
|
+
export declare function disAllowOpForVModel(model: FxOrmModel.Model, opName: string): void;
|
|
169
|
+
export declare function normalizeVirtualViewOption(virtualView: FxOrmModel.ModelDefineOptions['virtualView'], knex: import('../knex/types').Knex): FxOrmModel.ModelConstructorOptions['virtualView'];
|
|
170
|
+
/** @internal only for plugin developers */
|
|
171
|
+
export declare function __wrapTableSourceAsGneratingSqlSelect({ virtualView, customSelect: _customSelect, generateSqlSelect, }: {
|
|
172
|
+
virtualView: FxOrmModel.ModelConstructorOptions['virtualView'];
|
|
173
|
+
customSelect?: FxOrmModel.ModelDefineOptions['customSelect'];
|
|
174
|
+
generateSqlSelect?: FxOrmModel.ModelDefineOptions['generateSqlSelect'];
|
|
175
|
+
}, opts: {
|
|
176
|
+
dialect: FxSqlQueryDialect.Dialect;
|
|
177
|
+
modelTable: string;
|
|
178
|
+
}): FxOrmModel.ModelDefineOptions['generateSqlSelect'];
|