fib-orm 2.1.0 → 3.0.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/README.md +42 -6
- package/index.d.ts +11 -0
- package/index.js +15 -0
- package/package.json +37 -34
- package/{lib/cli/commands/ddlFrom.js → src/cli/commands/ddlFrom.ts} +40 -27
- package/{lib/cli/commands/dumpModel.js → src/cli/commands/dumpModel.ts} +78 -32
- package/{lib/cli/commands/escape.js → src/cli/commands/escape.ts} +51 -29
- package/{lib/cli/commands/spinner.js → src/cli/commands/spinner.ts} +20 -11
- package/{lib/cli/commands/upgrade.js → src/cli/commands/upgrade.ts} +53 -34
- package/src/cli/helpers/ddl.ts +84 -0
- package/src/cli/helpers/package.ts +81 -0
- package/src/cli/index.ts +24 -0
- package/src/cli/wrapSubcommand.ts +66 -0
- package/src/db-driver/Typo.d.ts +141 -0
- package/src/db-driver/built-ins/base.class.ts +260 -0
- package/src/db-driver/built-ins/driver-dm.ts +62 -0
- package/src/db-driver/built-ins/driver-mssql.ts +67 -0
- package/src/db-driver/built-ins/driver-mysql.ts +44 -0
- package/src/db-driver/built-ins/driver-postgresql.ts +94 -0
- package/src/db-driver/built-ins/driver-redis.ts +45 -0
- package/src/db-driver/built-ins/driver-sqlite.ts +41 -0
- package/src/db-driver/index.ts +6 -0
- package/src/db-driver/parseQueryString.ts +76 -0
- package/src/db-driver/utils.ts +204 -0
- package/src/knex/deps/tarn/PendingOperation.ts +56 -0
- package/src/knex/deps/tarn/Pool.ts +610 -0
- package/src/knex/deps/tarn/PromiseInspection.ts +29 -0
- package/src/knex/deps/tarn/Resource.ts +22 -0
- package/src/knex/deps/tarn/TimeoutError.ts +1 -0
- package/src/knex/deps/tarn/tarn.ts +7 -0
- package/src/knex/deps/tarn/utils.ts +62 -0
- package/src/knex/knex.ts +11 -0
- package/src/knex/result.d.ts +27 -0
- package/src/knex/sandbox.ts +45 -0
- package/src/knex/tables.d.ts +4 -0
- package/src/knex/types.d.ts +3228 -0
- package/src/orm/Adapters.ts +53 -0
- package/src/orm/AggregateFunctions.ts +254 -0
- package/src/orm/Associations/Extend.ts +405 -0
- package/src/orm/Associations/Many.ts +784 -0
- package/src/orm/Associations/One.ts +494 -0
- package/src/orm/Associations/_utils.ts +72 -0
- package/src/orm/ChainFind.ts +427 -0
- package/src/orm/ChainInstance.ts +97 -0
- package/src/orm/Debug.ts +21 -0
- package/src/orm/Drivers/DB/base.ts +7 -0
- package/src/orm/Drivers/DB/dm.ts +35 -0
- package/src/orm/Drivers/DB/mssql.ts +35 -0
- package/src/orm/Drivers/DB/mysql.ts +35 -0
- package/src/orm/Drivers/DB/postgres.ts +35 -0
- package/src/orm/Drivers/DB/sqlite3.ts +60 -0
- package/src/orm/Drivers/DML/_ddl-sql.ts +85 -0
- package/src/orm/Drivers/DML/_dml-helpers.ts +66 -0
- package/src/orm/Drivers/DML/_shared.ts +61 -0
- package/src/orm/Drivers/DML/_utils.ts +112 -0
- package/{lib/orm/Drivers/DML/dm.js → src/orm/Drivers/DML/dm.ts} +178 -86
- package/src/orm/Drivers/DML/index.ts +10 -0
- package/src/orm/Drivers/DML/mssql.ts +366 -0
- package/src/orm/Drivers/DML/mysql.ts +347 -0
- package/src/orm/Drivers/DML/postgres.ts +382 -0
- package/src/orm/Drivers/DML/sqlite.ts +361 -0
- package/src/orm/Error.ts +49 -0
- package/src/orm/Helpers.ts +297 -0
- package/src/orm/Hook.ts +125 -0
- package/src/orm/Instance.ts +944 -0
- package/src/orm/LazyLoad.ts +117 -0
- package/src/orm/Model.ts +1235 -0
- package/src/orm/ORM.ts +301 -0
- package/src/orm/Patch/fib-cache.ts +7 -0
- package/src/orm/Patch/plugin.ts +25 -0
- package/src/orm/Property.ts +86 -0
- package/src/orm/Settings.ts +134 -0
- package/src/orm/Singleton.ts +97 -0
- package/src/orm/Typo/Adapter.d.ts +5 -0
- package/src/orm/Typo/DMLDriver.d.ts +260 -0
- package/src/orm/Typo/Db.d.ts +100 -0
- package/src/orm/Typo/Error.d.ts +36 -0
- package/src/orm/Typo/ORM.d.ts +315 -0
- package/src/orm/Typo/Validators.d.ts +39 -0
- package/src/orm/Typo/_common.d.ts +44 -0
- package/src/orm/Typo/assoc.d.ts +280 -0
- package/src/orm/Typo/hook.d.ts +68 -0
- package/src/orm/Typo/instance.d.ts +214 -0
- package/{lib → src}/orm/Typo/model.d.ts +297 -174
- package/src/orm/Typo/patch.d.ts +39 -0
- package/src/orm/Typo/property.d.ts +79 -0
- package/src/orm/Typo/query.d.ts +266 -0
- package/{lib → src}/orm/Typo/settings.d.ts +14 -7
- package/{lib → src}/orm/Typo/synchronous.d.ts +51 -26
- package/src/orm/Utilities.ts +1313 -0
- package/src/orm/Validators.ts +127 -0
- package/src/orm/Where/common.ts +8 -0
- package/src/orm/Where/filterDate.ts +74 -0
- package/src/orm/cloneDeep.ts +45 -0
- package/src/orm/index.ts +231 -0
- package/src/orm-core/callback.d.ts +15 -0
- package/{lib → src}/orm-core/dialect.d.ts +75 -52
- package/src/orm-core/error.ts +71 -0
- package/{lib/orm-core/index.d.ts → src/orm-core/index.ts} +8 -2
- package/src/orm-core/sync.d.ts +14 -0
- package/src/orm-core/utils.ts +4 -0
- package/src/orm-property/Property.ts +110 -0
- package/src/orm-property/Utils.ts +26 -0
- package/src/orm-property/customTypes.ts +13 -0
- package/src/orm-property/index.ts +34 -0
- package/src/orm-property/transformer.ts +16 -0
- package/{lib/orm-property/transformers/dm.js → src/orm-property/transformers/dm.ts} +128 -69
- package/src/orm-property/transformers/index.ts +10 -0
- package/src/orm-property/transformers/mssql.ts +285 -0
- package/src/orm-property/transformers/mysql.ts +395 -0
- package/src/orm-property/transformers/postgresql.ts +267 -0
- package/src/orm-property/transformers/sqlite.ts +217 -0
- package/src/plugins/orm-plugin-uacl/Typo.d.ts +173 -0
- package/src/plugins/orm-plugin-uacl/_utils.ts +237 -0
- package/src/plugins/orm-plugin-uacl/acl-tree.ts +440 -0
- package/src/plugins/orm-plugin-uacl/config-acl-tree.ts +592 -0
- package/src/plugins/orm-plugin-uacl/index.ts +180 -0
- package/src/plugins/orm-plugin-uacl/tree.ts +331 -0
- package/src/sql-ddl-sync/Dialects/dm.ts +493 -0
- package/{lib/sql-query/Dialects/index.d.ts → src/sql-ddl-sync/Dialects/index.ts} +3 -3
- package/src/sql-ddl-sync/Dialects/mssql.ts +441 -0
- package/src/sql-ddl-sync/Dialects/mysql.ts +414 -0
- package/src/sql-ddl-sync/Dialects/postgresql.ts +474 -0
- package/src/sql-ddl-sync/Dialects/sqlite.ts +439 -0
- package/src/sql-ddl-sync/SQL.ts +157 -0
- package/src/sql-ddl-sync/Typo/Collection.d.ts +19 -0
- package/src/sql-ddl-sync/Typo/DbIndex.d.ts +11 -0
- package/{lib → src}/sql-ddl-sync/Typo/Dialect.d.ts +67 -52
- package/src/sql-ddl-sync/Typo/Driver.d.ts +67 -0
- package/src/sql-ddl-sync/Typo/Query.d.ts +8 -0
- package/src/sql-ddl-sync/Typo/SQL.d.ts +45 -0
- package/src/sql-ddl-sync/Typo/_common.d.ts +59 -0
- package/src/sql-ddl-sync/Utils.ts +291 -0
- package/src/sql-ddl-sync/index.ts +599 -0
- package/src/sql-query/Comparators.ts +115 -0
- package/src/sql-query/Create.ts +87 -0
- package/{lib/sql-query/Dialects/dm.js → src/sql-query/Dialects/dm.ts} +42 -22
- package/src/sql-query/Dialects/index.ts +14 -0
- package/src/sql-query/Dialects/mssql.ts +91 -0
- package/src/sql-query/Dialects/mysql.ts +120 -0
- package/src/sql-query/Dialects/postgresql.ts +99 -0
- package/src/sql-query/Dialects/sqlite.ts +80 -0
- package/src/sql-query/Helpers.ts +303 -0
- package/src/sql-query/Insert.ts +41 -0
- package/src/sql-query/Query.ts +140 -0
- package/src/sql-query/Remove.ts +111 -0
- package/src/sql-query/Select.ts +719 -0
- package/src/sql-query/Set.ts +25 -0
- package/src/sql-query/Typo/Aggregation.d.ts +34 -0
- package/src/sql-query/Typo/Comparators.d.ts +156 -0
- package/src/sql-query/Typo/Dialect.d.ts +51 -0
- package/src/sql-query/Typo/Field.d.ts +10 -0
- package/src/sql-query/Typo/Helper.d.ts +4 -0
- package/src/sql-query/Typo/Query-ChainBuilder.d.ts +110 -0
- package/src/sql-query/Typo/Query.d.ts +65 -0
- package/src/sql-query/Typo/Sql.d.ts +192 -0
- package/src/sql-query/Typo/SubQuery.d.ts +52 -0
- package/{lib/sql-query/Typo/index.d.ts → src/sql-query/Typo/index.ts} +5 -2
- package/src/sql-query/Update.ts +50 -0
- package/src/sql-query/Where.ts +435 -0
- package/{lib/orm/Patch → src/typings}/fib-cache.d.ts +4 -2
- package/lib/cli/commands/ddlFrom.d.ts +0 -2
- package/lib/cli/commands/dumpModel.d.ts +0 -2
- package/lib/cli/commands/escape.d.ts +0 -2
- package/lib/cli/commands/spinner.d.ts +0 -2
- package/lib/cli/commands/upgrade.d.ts +0 -2
- package/lib/cli/helpers/ddl.d.ts +0 -17
- package/lib/cli/helpers/ddl.js +0 -55
- package/lib/cli/helpers/package.d.ts +0 -25
- package/lib/cli/helpers/package.js +0 -56
- package/lib/cli/index.d.ts +0 -2
- package/lib/cli/index.js +0 -19
- package/lib/db-driver/Typo.d.ts +0 -111
- package/lib/db-driver/Typo.js +0 -2
- package/lib/db-driver/built-ins/base.class.d.ts +0 -91
- package/lib/db-driver/built-ins/base.class.js +0 -187
- package/lib/db-driver/built-ins/driver-dm.d.ts +0 -17
- package/lib/db-driver/built-ins/driver-dm.js +0 -54
- package/lib/db-driver/built-ins/driver-mongodb.d.ts +0 -23
- package/lib/db-driver/built-ins/driver-mongodb.js +0 -47
- package/lib/db-driver/built-ins/driver-mysql.d.ts +0 -17
- package/lib/db-driver/built-ins/driver-mysql.js +0 -38
- package/lib/db-driver/built-ins/driver-postgresql.d.ts +0 -21
- package/lib/db-driver/built-ins/driver-postgresql.js +0 -77
- package/lib/db-driver/built-ins/driver-redis.d.ts +0 -11
- package/lib/db-driver/built-ins/driver-redis.js +0 -36
- package/lib/db-driver/built-ins/driver-sqlite.d.ts +0 -16
- package/lib/db-driver/built-ins/driver-sqlite.js +0 -35
- package/lib/db-driver/index.d.ts +0 -3
- package/lib/db-driver/index.js +0 -5
- package/lib/db-driver/utils.d.ts +0 -14
- package/lib/db-driver/utils.js +0 -187
- package/lib/knex/deps/tarn/dist/PendingOperation.d.ts +0 -12
- package/lib/knex/deps/tarn/dist/PendingOperation.js +0 -48
- package/lib/knex/deps/tarn/dist/Pool.d.ts +0 -97
- package/lib/knex/deps/tarn/dist/Pool.js +0 -516
- package/lib/knex/deps/tarn/dist/PromiseInspection.d.ts +0 -16
- package/lib/knex/deps/tarn/dist/PromiseInspection.js +0 -21
- package/lib/knex/deps/tarn/dist/Resource.d.ts +0 -9
- package/lib/knex/deps/tarn/dist/Resource.js +0 -19
- package/lib/knex/deps/tarn/dist/TimeoutError.d.ts +0 -2
- package/lib/knex/deps/tarn/dist/TimeoutError.js +0 -5
- package/lib/knex/deps/tarn/dist/tarn.d.ts +0 -3
- package/lib/knex/deps/tarn/dist/tarn.js +0 -10
- package/lib/knex/deps/tarn/dist/utils.d.ts +0 -14
- package/lib/knex/deps/tarn/dist/utils.js +0 -60
- package/lib/knex/knex.d.ts +0 -2
- package/lib/knex/knex.js +0 -4
- package/lib/knex/sandbox.d.ts +0 -4
- package/lib/knex/sandbox.js +0 -23
- package/lib/orm/Adapters.d.ts +0 -3
- package/lib/orm/Adapters.js +0 -44
- package/lib/orm/AggregateFunctions.d.ts +0 -3
- package/lib/orm/AggregateFunctions.js +0 -177
- package/lib/orm/Associations/Extend.d.ts +0 -22
- package/lib/orm/Associations/Extend.js +0 -274
- package/lib/orm/Associations/Many.d.ts +0 -16
- package/lib/orm/Associations/Many.js +0 -569
- package/lib/orm/Associations/One.d.ts +0 -16
- package/lib/orm/Associations/One.js +0 -310
- package/lib/orm/Associations/_utils.d.ts +0 -14
- package/lib/orm/Associations/_utils.js +0 -53
- package/lib/orm/ChainFind.d.ts +0 -3
- package/lib/orm/ChainFind.js +0 -328
- package/lib/orm/ChainInstance.d.ts +0 -6
- package/lib/orm/ChainInstance.js +0 -74
- package/lib/orm/Debug.d.ts +0 -2
- package/lib/orm/Debug.js +0 -17
- package/lib/orm/Drivers/DB/base.d.ts +0 -2
- package/lib/orm/Drivers/DB/base.js +0 -4
- package/lib/orm/Drivers/DB/dm.d.ts +0 -9
- package/lib/orm/Drivers/DB/dm.js +0 -24
- package/lib/orm/Drivers/DB/mysql.d.ts +0 -9
- package/lib/orm/Drivers/DB/mysql.js +0 -24
- package/lib/orm/Drivers/DB/postgres.d.ts +0 -9
- package/lib/orm/Drivers/DB/postgres.js +0 -23
- package/lib/orm/Drivers/DB/sqlite3.d.ts +0 -14
- package/lib/orm/Drivers/DB/sqlite3.js +0 -40
- package/lib/orm/Drivers/DML/_ddl-sql.d.ts +0 -3
- package/lib/orm/Drivers/DML/_ddl-sql.js +0 -52
- package/lib/orm/Drivers/DML/_dml-helpers.d.ts +0 -19
- package/lib/orm/Drivers/DML/_dml-helpers.js +0 -51
- package/lib/orm/Drivers/DML/_shared.d.ts +0 -9
- package/lib/orm/Drivers/DML/_shared.js +0 -39
- package/lib/orm/Drivers/DML/_utils.d.ts +0 -8
- package/lib/orm/Drivers/DML/_utils.js +0 -67
- package/lib/orm/Drivers/DML/constants.d.ts +0 -3
- package/lib/orm/Drivers/DML/constants.js +0 -3
- package/lib/orm/Drivers/DML/dm.d.ts +0 -2
- package/lib/orm/Drivers/DML/index.d.ts +0 -4
- package/lib/orm/Drivers/DML/index.js +0 -7
- package/lib/orm/Drivers/DML/mysql.d.ts +0 -2
- package/lib/orm/Drivers/DML/mysql.js +0 -252
- package/lib/orm/Drivers/DML/postgres.d.ts +0 -2
- package/lib/orm/Drivers/DML/postgres.js +0 -277
- package/lib/orm/Drivers/DML/sqlite.d.ts +0 -2
- package/lib/orm/Drivers/DML/sqlite.js +0 -267
- package/lib/orm/Error.d.ts +0 -11
- package/lib/orm/Error.js +0 -41
- package/lib/orm/Helpers.d.ts +0 -35
- package/lib/orm/Helpers.js +0 -234
- package/lib/orm/Hook.d.ts +0 -13
- package/lib/orm/Hook.js +0 -100
- package/lib/orm/Instance.d.ts +0 -2
- package/lib/orm/Instance.js +0 -698
- package/lib/orm/LazyLoad.d.ts +0 -4
- package/lib/orm/LazyLoad.js +0 -76
- package/lib/orm/Model.d.ts +0 -6
- package/lib/orm/Model.js +0 -974
- package/lib/orm/ORM.d.ts +0 -37
- package/lib/orm/ORM.js +0 -242
- package/lib/orm/Patch/fib-cache.js +0 -2
- package/lib/orm/Patch/plugin.d.ts +0 -4
- package/lib/orm/Patch/plugin.js +0 -14
- package/lib/orm/Property.d.ts +0 -9
- package/lib/orm/Property.js +0 -71
- package/lib/orm/Settings.d.ts +0 -42
- package/lib/orm/Settings.js +0 -120
- package/lib/orm/Singleton.d.ts +0 -5
- package/lib/orm/Singleton.js +0 -73
- package/lib/orm/Typo/Adapter.d.ts +0 -5
- package/lib/orm/Typo/Adapter.js +0 -2
- package/lib/orm/Typo/DMLDriver.d.ts +0 -209
- package/lib/orm/Typo/DMLDriver.js +0 -2
- package/lib/orm/Typo/Db.d.ts +0 -35
- package/lib/orm/Typo/Db.js +0 -2
- package/lib/orm/Typo/Error.d.ts +0 -29
- package/lib/orm/Typo/Error.js +0 -2
- package/lib/orm/Typo/ORM.d.ts +0 -231
- package/lib/orm/Typo/ORM.js +0 -4
- package/lib/orm/Typo/Validators.d.ts +0 -31
- package/lib/orm/Typo/Validators.js +0 -3
- package/lib/orm/Typo/_common.d.ts +0 -37
- package/lib/orm/Typo/_common.js +0 -2
- package/lib/orm/Typo/assoc.d.ts +0 -221
- package/lib/orm/Typo/assoc.js +0 -2
- package/lib/orm/Typo/hook.d.ts +0 -42
- package/lib/orm/Typo/hook.js +0 -2
- package/lib/orm/Typo/instance.d.ts +0 -156
- package/lib/orm/Typo/instance.js +0 -2
- package/lib/orm/Typo/model.js +0 -7
- package/lib/orm/Typo/patch.d.ts +0 -31
- package/lib/orm/Typo/patch.js +0 -2
- package/lib/orm/Typo/property.d.ts +0 -57
- package/lib/orm/Typo/property.js +0 -2
- package/lib/orm/Typo/query.d.ts +0 -216
- package/lib/orm/Typo/query.js +0 -2
- package/lib/orm/Typo/settings.js +0 -6
- package/lib/orm/Typo/synchronous.js +0 -2
- package/lib/orm/Utilities.d.ts +0 -178
- package/lib/orm/Utilities.js +0 -975
- package/lib/orm/Validators.d.ts +0 -33
- package/lib/orm/Validators.js +0 -101
- package/lib/orm/Where/common.d.ts +0 -1
- package/lib/orm/Where/common.js +0 -7
- package/lib/orm/Where/filterDate.d.ts +0 -11
- package/lib/orm/Where/filterDate.js +0 -58
- package/lib/orm/index.d.ts +0 -67
- package/lib/orm/index.js +0 -158
- package/lib/orm-core/callback.d.ts +0 -12
- package/lib/orm-core/callback.js +0 -2
- package/lib/orm-core/dialect.js +0 -2
- package/lib/orm-core/error.d.ts +0 -16
- package/lib/orm-core/error.js +0 -29
- package/lib/orm-core/index.js +0 -7
- package/lib/orm-core/sync.d.ts +0 -12
- package/lib/orm-core/sync.js +0 -2
- package/lib/orm-core/utils.d.ts +0 -1
- package/lib/orm-core/utils.js +0 -6
- package/lib/orm-property/Property.d.ts +0 -78
- package/lib/orm-property/Property.js +0 -2
- package/lib/orm-property/Utils.d.ts +0 -9
- package/lib/orm-property/Utils.js +0 -13
- package/lib/orm-property/customTypes.d.ts +0 -2
- package/lib/orm-property/customTypes.js +0 -13
- package/lib/orm-property/index.d.ts +0 -10
- package/lib/orm-property/index.js +0 -23
- package/lib/orm-property/transformer.d.ts +0 -5
- package/lib/orm-property/transformer.js +0 -10
- package/lib/orm-property/transformers/dm.d.ts +0 -29
- package/lib/orm-property/transformers/index.d.ts +0 -4
- package/lib/orm-property/transformers/index.js +0 -6
- package/lib/orm-property/transformers/mysql.d.ts +0 -101
- package/lib/orm-property/transformers/mysql.js +0 -262
- package/lib/orm-property/transformers/postgresql.d.ts +0 -54
- package/lib/orm-property/transformers/postgresql.js +0 -190
- package/lib/orm-property/transformers/sqlite.d.ts +0 -19
- package/lib/orm-property/transformers/sqlite.js +0 -172
- package/lib/sql-ddl-sync/Dialects/dm.d.ts +0 -39
- package/lib/sql-ddl-sync/Dialects/dm.js +0 -297
- package/lib/sql-ddl-sync/Dialects/index.d.ts +0 -6
- package/lib/sql-ddl-sync/Dialects/index.js +0 -8
- package/lib/sql-ddl-sync/Dialects/mysql.d.ts +0 -38
- package/lib/sql-ddl-sync/Dialects/mysql.js +0 -241
- package/lib/sql-ddl-sync/Dialects/postgresql.d.ts +0 -39
- package/lib/sql-ddl-sync/Dialects/postgresql.js +0 -287
- package/lib/sql-ddl-sync/Dialects/sqlite.d.ts +0 -43
- package/lib/sql-ddl-sync/Dialects/sqlite.js +0 -257
- package/lib/sql-ddl-sync/SQL.d.ts +0 -12
- package/lib/sql-ddl-sync/SQL.js +0 -108
- package/lib/sql-ddl-sync/Typo/Collection.d.ts +0 -13
- package/lib/sql-ddl-sync/Typo/Collection.js +0 -2
- package/lib/sql-ddl-sync/Typo/DbIndex.d.ts +0 -13
- package/lib/sql-ddl-sync/Typo/DbIndex.js +0 -2
- package/lib/sql-ddl-sync/Typo/Dialect.js +0 -2
- package/lib/sql-ddl-sync/Typo/Driver.d.ts +0 -53
- package/lib/sql-ddl-sync/Typo/Driver.js +0 -2
- package/lib/sql-ddl-sync/Typo/Query.d.ts +0 -7
- package/lib/sql-ddl-sync/Typo/Query.js +0 -2
- package/lib/sql-ddl-sync/Typo/SQL.d.ts +0 -31
- package/lib/sql-ddl-sync/Typo/SQL.js +0 -2
- package/lib/sql-ddl-sync/Typo/_common.d.ts +0 -29
- package/lib/sql-ddl-sync/Typo/_common.js +0 -2
- package/lib/sql-ddl-sync/Utils.d.ts +0 -39
- package/lib/sql-ddl-sync/Utils.js +0 -217
- package/lib/sql-ddl-sync/index.d.ts +0 -87
- package/lib/sql-ddl-sync/index.js +0 -372
- package/lib/sql-query/Comparators.d.ts +0 -3
- package/lib/sql-query/Comparators.js +0 -95
- package/lib/sql-query/Create.d.ts +0 -35
- package/lib/sql-query/Create.js +0 -78
- package/lib/sql-query/Dialects/dm.d.ts +0 -3
- package/lib/sql-query/Dialects/index.js +0 -13
- package/lib/sql-query/Dialects/mssql.d.ts +0 -3
- package/lib/sql-query/Dialects/mssql.js +0 -74
- package/lib/sql-query/Dialects/mysql.d.ts +0 -3
- package/lib/sql-query/Dialects/mysql.js +0 -101
- package/lib/sql-query/Dialects/postgresql.d.ts +0 -3
- package/lib/sql-query/Dialects/postgresql.js +0 -77
- package/lib/sql-query/Dialects/sqlite.d.ts +0 -3
- package/lib/sql-query/Dialects/sqlite.js +0 -62
- package/lib/sql-query/Helpers.d.ts +0 -37
- package/lib/sql-query/Helpers.js +0 -260
- package/lib/sql-query/Insert.d.ts +0 -12
- package/lib/sql-query/Insert.js +0 -34
- package/lib/sql-query/Query.d.ts +0 -28
- package/lib/sql-query/Query.js +0 -120
- package/lib/sql-query/Remove.d.ts +0 -16
- package/lib/sql-query/Remove.js +0 -94
- package/lib/sql-query/Select.d.ts +0 -62
- package/lib/sql-query/Select.js +0 -534
- package/lib/sql-query/Set.d.ts +0 -4
- package/lib/sql-query/Set.js +0 -16
- package/lib/sql-query/Typo/Aggregation.d.ts +0 -32
- package/lib/sql-query/Typo/Aggregation.js +0 -2
- package/lib/sql-query/Typo/Comparators.d.ts +0 -140
- package/lib/sql-query/Typo/Comparators.js +0 -2
- package/lib/sql-query/Typo/Dialect.d.ts +0 -39
- package/lib/sql-query/Typo/Dialect.js +0 -2
- package/lib/sql-query/Typo/Field.d.ts +0 -8
- package/lib/sql-query/Typo/Field.js +0 -2
- package/lib/sql-query/Typo/Helper.d.ts +0 -4
- package/lib/sql-query/Typo/Helper.js +0 -2
- package/lib/sql-query/Typo/Query-ChainBuilder.d.ts +0 -80
- package/lib/sql-query/Typo/Query-ChainBuilder.js +0 -2
- package/lib/sql-query/Typo/Query.d.ts +0 -34
- package/lib/sql-query/Typo/Query.js +0 -17
- package/lib/sql-query/Typo/Sql.d.ts +0 -143
- package/lib/sql-query/Typo/Sql.js +0 -2
- package/lib/sql-query/Typo/SubQuery.d.ts +0 -39
- package/lib/sql-query/Typo/SubQuery.js +0 -2
- package/lib/sql-query/Typo/index.js +0 -2
- package/lib/sql-query/Update.d.ts +0 -15
- package/lib/sql-query/Update.js +0 -39
- package/lib/sql-query/Where.d.ts +0 -4
- package/lib/sql-query/Where.js +0 -280
- /package/{lib → src}/codepoints-map.json +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FxOrmSqlDDLSync__Driver
|
|
3
|
+
} from "../../sql-ddl-sync/index";
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
FxSqlQuery,
|
|
7
|
+
} from '../../sql-query/Query';
|
|
8
|
+
|
|
9
|
+
import type { IProperty } from "../../orm-property/index";
|
|
10
|
+
|
|
11
|
+
export namespace FxOrmProperty {
|
|
12
|
+
/**
|
|
13
|
+
* @description key linked association type
|
|
14
|
+
* - 'primary': means this property is for column defined as 'primary'
|
|
15
|
+
* - 'hasOne': means this property is for column used as asscociated key in 'hasOne' assciation
|
|
16
|
+
* - 'extendsTo': means this property is for column used as asscociated key in 'extendsTo' assciation
|
|
17
|
+
*/
|
|
18
|
+
export type KlassType = 'primary' | 'hasOne' | 'extendsTo'
|
|
19
|
+
|
|
20
|
+
export interface CustomPropertyType extends FxOrmSqlDDLSync__Driver.CustomPropertyType {
|
|
21
|
+
datastoreType: {
|
|
22
|
+
(prop?: FxOrmProperty.NormalizedProperty): string
|
|
23
|
+
}
|
|
24
|
+
valueToProperty?: {
|
|
25
|
+
(value?: any, prop?: FxOrmProperty.NormalizedProperty): any
|
|
26
|
+
}
|
|
27
|
+
propertyToValue?: {
|
|
28
|
+
(value?: any, prop?: FxOrmProperty.NormalizedProperty): any
|
|
29
|
+
}
|
|
30
|
+
datastoreGet?: {
|
|
31
|
+
(prop?: FxOrmProperty.NormalizedProperty, helper?: FxSqlQuery.Class_Query): any
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export type DataStoreProperty = IProperty & {
|
|
35
|
+
// restrain it, not expanded to `string`
|
|
36
|
+
type: PropertyType | keyof GlobalCustomModelType
|
|
37
|
+
/**
|
|
38
|
+
* @description virtual property is not stored in database,
|
|
39
|
+
* but maybe presented in query result
|
|
40
|
+
*/
|
|
41
|
+
virtual?: boolean
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// type PropertyType = import('../../orm-property/Property').PropertyType;
|
|
45
|
+
export type PropertyType = 'text' | 'integer' | 'number' | 'serial' | 'boolean' | 'date' | 'binary' | 'object' | 'enum' | 'point';
|
|
46
|
+
/**
|
|
47
|
+
* @description used for augumenting model's properties type
|
|
48
|
+
*/
|
|
49
|
+
export interface GlobalCustomModelType {
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type GetPrimitiveFromOrmPropertyType<T extends PropertyType = PropertyType> =
|
|
53
|
+
T extends 'text' ? string :
|
|
54
|
+
T extends 'enum' ? any[] :
|
|
55
|
+
T extends 'integer' | 'number' | 'serial' ? number :
|
|
56
|
+
T extends 'boolean' ? boolean :
|
|
57
|
+
T extends 'date' ? number | Date :
|
|
58
|
+
T extends 'binary' | 'object' | 'point' ? any : never
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @description useful when pass property's option(such as type, big, ...etc) internally, useless for exposed api.
|
|
62
|
+
*
|
|
63
|
+
* @notice though there's definition, but those fields SHOULD NEVER be set in NormalizedProperty:
|
|
64
|
+
* - `serial`
|
|
65
|
+
*/
|
|
66
|
+
export interface NormalizedProperty extends DataStoreProperty {
|
|
67
|
+
// all fields inherited from `FxOrmModel.ModelPropertyDefinition` are still optional
|
|
68
|
+
|
|
69
|
+
key?: boolean
|
|
70
|
+
klass?: KlassType
|
|
71
|
+
lazyload?: boolean
|
|
72
|
+
alwaysValidate?: boolean
|
|
73
|
+
lazyname?: string
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface FieldToPropertyMapType {
|
|
77
|
+
[f_name: string]: NormalizedProperty
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import type { FxOrmAssociation } from './assoc';
|
|
2
|
+
import type { FxOrmDb } from './Db';
|
|
3
|
+
import type { FxOrmDMLDriver } from './DMLDriver';
|
|
4
|
+
import type { FxOrmInstance } from './instance';
|
|
5
|
+
import type { FxOrmModel } from './model';
|
|
6
|
+
import type { FxOrmProperty } from './property';
|
|
7
|
+
import type { FxOrmCommon } from './_common';
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
FxSqlQueryColumns,
|
|
11
|
+
FxSqlQueryComparator,
|
|
12
|
+
FxSqlQuerySubQuery,
|
|
13
|
+
FxSqlQuery,
|
|
14
|
+
FxSqlQuerySql,
|
|
15
|
+
} from '../../sql-query/Query';
|
|
16
|
+
|
|
17
|
+
export namespace FxOrmQuery {
|
|
18
|
+
/* query conditions :start */
|
|
19
|
+
export type QueryConditionInTypeType = string | number
|
|
20
|
+
|
|
21
|
+
export type QueryCondition_SimpleEq = { [key: string]: FxSqlQueryComparator.SimpleEqValueType }
|
|
22
|
+
|
|
23
|
+
export type QueryCondition_eq = { [key: string]: FxSqlQueryComparator.SimpleEqValueType | FxSqlQueryComparator.InputValue_eq }
|
|
24
|
+
export type QueryCondition_ne = { [key: string]: FxSqlQueryComparator.InputValue_ne }
|
|
25
|
+
export type QueryCondition_gt = { [key: string]: FxSqlQueryComparator.InputValue_gt }
|
|
26
|
+
export type QueryCondition_gte = { [key: string]: FxSqlQueryComparator.InputValue_gte }
|
|
27
|
+
export type QueryCondition_lt = { [key: string]: FxSqlQueryComparator.InputValue_lt }
|
|
28
|
+
export type QueryCondition_lte = { [key: string]: FxSqlQueryComparator.InputValue_lte }
|
|
29
|
+
export type QueryCondition_like = { [key: string]: FxSqlQueryComparator.InputValue_like }
|
|
30
|
+
export type QueryCondition_not_like = { [key: string]: FxSqlQueryComparator.InputValue_not_like }
|
|
31
|
+
export type QueryCondition_between = { [key: string]: FxSqlQueryComparator.InputValue_between }
|
|
32
|
+
export type QueryCondition_not_between = { [key: string]: FxSqlQueryComparator.InputValue_not_between }
|
|
33
|
+
|
|
34
|
+
export type QueryCondition_in = { [key: string]: FxSqlQueryComparator.InputValue_in }
|
|
35
|
+
export type QueryCondition_not_in = { [key: string]: FxSqlQueryComparator.InputValue_not_in }
|
|
36
|
+
|
|
37
|
+
export type QueryConditionAtomicType =
|
|
38
|
+
QueryCondition_eq |
|
|
39
|
+
QueryCondition_ne |
|
|
40
|
+
QueryCondition_gt |
|
|
41
|
+
QueryCondition_gte |
|
|
42
|
+
QueryCondition_lt |
|
|
43
|
+
QueryCondition_lte |
|
|
44
|
+
QueryCondition_like |
|
|
45
|
+
QueryCondition_not_like |
|
|
46
|
+
QueryCondition_between |
|
|
47
|
+
QueryCondition_not_between |
|
|
48
|
+
QueryCondition_in |
|
|
49
|
+
QueryCondition_not_in
|
|
50
|
+
|
|
51
|
+
export type QueryConditions = FxSqlQuerySubQuery.SubQueryConditions
|
|
52
|
+
export type QueryConditionsItem = FxSqlQuerySql.SqlFragmentStr | FxOrmQuery.QueryConditions__Find
|
|
53
|
+
/* query conditions :end */
|
|
54
|
+
|
|
55
|
+
export type OrderNormalizedTuple = FxSqlQuery.OrderNormalizedTuple
|
|
56
|
+
export type OrderSqlStyleTuple = FxSqlQuery.OrderSqlStyleTuple
|
|
57
|
+
export type OrderNormalizedResult = FxSqlQuery.OrderNormalizedResult
|
|
58
|
+
|
|
59
|
+
export type OrderSeqRawTuple = (OrderNormalizedTupleWithoutTable[0] | OrderNormalizedTupleWithoutTable[1])[]
|
|
60
|
+
export type OrderRawInput = string | OrderSeqRawTuple
|
|
61
|
+
export type OrderNormalizedTupleWithoutTable = [string, "Z" | "A"]
|
|
62
|
+
export type OrderNormalizedTupleMixin = (OrderNormalizedTupleWithoutTable|FxSqlQuery.OrderNormalizedResult)[]
|
|
63
|
+
|
|
64
|
+
export interface QueryConditions__Find extends FxSqlQuerySubQuery.SubQueryConditions {
|
|
65
|
+
[property: string]: any
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface ChainFindMergeInfo {
|
|
69
|
+
from: {
|
|
70
|
+
table: string
|
|
71
|
+
field: string[]
|
|
72
|
+
}
|
|
73
|
+
to: {
|
|
74
|
+
table?: string
|
|
75
|
+
field: string[]
|
|
76
|
+
}
|
|
77
|
+
select: FxSqlQueryColumns.SelectInputArgType[]
|
|
78
|
+
where: [string, QueryConditions__Find]
|
|
79
|
+
table: string
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface ChainWhereExistsInfo {
|
|
83
|
+
table: string
|
|
84
|
+
link: FxSqlQuerySql.WhereExistsLinkTuple
|
|
85
|
+
conditions: FxSqlQuerySubQuery.SubQueryConditions
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface InsertResult {
|
|
89
|
+
insertId?: string | number
|
|
90
|
+
|
|
91
|
+
[extra_key: string]: any
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface CountResult {
|
|
95
|
+
c: number
|
|
96
|
+
|
|
97
|
+
[extra_key: string]: any
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface RemoveResult {
|
|
101
|
+
[extra_key: string]: any
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface AggregationMethod {
|
|
105
|
+
(...args: string[]): IAggregated
|
|
106
|
+
(arg: string[]): IAggregated
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface IAggregated {
|
|
110
|
+
groupBy: {
|
|
111
|
+
(...columns: string[]): IAggregated;
|
|
112
|
+
}
|
|
113
|
+
limit: {
|
|
114
|
+
(limit: number): IAggregated;
|
|
115
|
+
(offset: number, limit: number): IAggregated;
|
|
116
|
+
}
|
|
117
|
+
order: {
|
|
118
|
+
(...order: string[]): IAggregated;
|
|
119
|
+
}
|
|
120
|
+
select: {
|
|
121
|
+
(columns: string[]): IAggregated;
|
|
122
|
+
(...columns: string[]): IAggregated;
|
|
123
|
+
}
|
|
124
|
+
as: {
|
|
125
|
+
(alias: string): IAggregated;
|
|
126
|
+
}
|
|
127
|
+
call: {
|
|
128
|
+
(fun: FxOrmDb.AGGREGATION_METHOD_COMPLEX, args: string[]): IAggregated;
|
|
129
|
+
}
|
|
130
|
+
getSync: {
|
|
131
|
+
<T = any>(): FxOrmCommon.ExecutionCallback<T[]>
|
|
132
|
+
}
|
|
133
|
+
get: {
|
|
134
|
+
<T = any>(cb?: FxOrmCommon.ExecutionCallback<T[]>): void
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// [ext_method: string]: AggregationMethod
|
|
138
|
+
|
|
139
|
+
[ext_k: string]: any
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export type KeyOfIAggregated = keyof IAggregated
|
|
143
|
+
export type AggregationFuncTuple = FxOrmDb.AGGREGATION_METHOD_TUPLE__COMMON
|
|
144
|
+
|
|
145
|
+
export interface SqlSelectFieldsDescriptor extends FxSqlQuerySql.SqlSelectFieldItemDescriptor {
|
|
146
|
+
args?: string | string[]
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface AggregateConstructorOptions {
|
|
150
|
+
driver: FxOrmDMLDriver.DMLDriver
|
|
151
|
+
driver_name?: string
|
|
152
|
+
limit?: [number, number]
|
|
153
|
+
order?: FxOrmQuery.ChainFindOptions['order']
|
|
154
|
+
// property name's list
|
|
155
|
+
propertyList?: string[]
|
|
156
|
+
table?: string
|
|
157
|
+
conditions?: FxOrmQuery.QueryConditions
|
|
158
|
+
properties: Record<string, FxOrmProperty.NormalizedProperty>
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export type AggregateConstructor = new (opts: AggregateConstructorOptions) => IAggregated
|
|
162
|
+
|
|
163
|
+
export type ChainFindGenerator = new (Model: FxOrmModel.Model, opts: FxOrmQuery.ChainFindOptions) => IChainFind
|
|
164
|
+
|
|
165
|
+
export interface IChainFind<
|
|
166
|
+
HP extends Record<string, FxOrmInstance.FieldRuntimeType> = Record<string, FxOrmInstance.FieldRuntimeType>,
|
|
167
|
+
HM extends Record<string, (...args: any) => any> = Record<string, (...args: any) => any>
|
|
168
|
+
> {
|
|
169
|
+
model: FxOrmModel.Model<HP, HM>;
|
|
170
|
+
options: ChainFindInstanceOptions
|
|
171
|
+
|
|
172
|
+
only(...args: (string|string[])[]): this;
|
|
173
|
+
omit(...args: (string|string[])[]): this;
|
|
174
|
+
skip(offset: number): this;
|
|
175
|
+
offset(offset: number): this;
|
|
176
|
+
|
|
177
|
+
order(propertyOrderDesc: string, order?: FxOrmQuery.OrderNormalizedTuple[1]): this;
|
|
178
|
+
order(...orders: FxOrmQuery.OrderSeqRawTuple): this;
|
|
179
|
+
orderRaw(str: FxOrmQuery.OrderSqlStyleTuple[0], args?: FxOrmQuery.OrderSqlStyleTuple[1]): this;
|
|
180
|
+
limit(limit: number): this;
|
|
181
|
+
|
|
182
|
+
count(callback?: FxOrmCommon.ExecutionCallback<number>): this;
|
|
183
|
+
countSync(): number;
|
|
184
|
+
|
|
185
|
+
remove(callback?: FxOrmCommon.ExecutionCallback<FxOrmQuery.RemoveResult>): this;
|
|
186
|
+
removeSync(): FxOrmQuery.RemoveResult | null;
|
|
187
|
+
|
|
188
|
+
find<T = FxOrmInstance.Instance<HP, HM>[]>(...conditions: (FxOrmQuery.QueryConditionsItem | FxOrmCommon.ExecutionCallback<T>)[]): this;
|
|
189
|
+
findSync: {
|
|
190
|
+
<T = FxOrmInstance.Instance<HP, HM>[]>(...conditions: (FxOrmQuery.QueryConditionsItem | FxOrmCommon.ExecutionCallback<T>)[]): T
|
|
191
|
+
}
|
|
192
|
+
all: this['find']
|
|
193
|
+
allSync: this['findSync']
|
|
194
|
+
|
|
195
|
+
where: this['find']
|
|
196
|
+
whereSync: this['findSync']
|
|
197
|
+
|
|
198
|
+
whereExists(...exists: FxOrmQuery.ChainWhereExistsInfo[]): this;
|
|
199
|
+
whereExists(exists: FxOrmQuery.ChainWhereExistsInfo[]): this;
|
|
200
|
+
|
|
201
|
+
run(callback?: FxOrmQuery.IChainInstanceCallbackFn): this;
|
|
202
|
+
runSync<T = FxOrmInstance.Instance<HP, HM>[]>(): T
|
|
203
|
+
|
|
204
|
+
// removed in commit 717ee65a7a23ed6762856cf3c187700e36c9ba70
|
|
205
|
+
// success(callback?: FxOrmModel.ModelMethodCallback__Find): void;
|
|
206
|
+
// fail(callback?: FxOrmModel.ModelMethodCallback__Find): void;
|
|
207
|
+
|
|
208
|
+
first(callback?: FxOrmCommon.GenericCallback<FxOrmInstance.Instance<HP, HM> | null>): this;
|
|
209
|
+
firstSync(): FxOrmInstance.Instance<HP, HM> | null;
|
|
210
|
+
last(callback?: FxOrmCommon.GenericCallback<FxOrmInstance.Instance<HP, HM> | null>): this;
|
|
211
|
+
lastSync(): FxOrmInstance.Instance<HP, HM> | null;
|
|
212
|
+
|
|
213
|
+
each: {
|
|
214
|
+
<T = FxOrmInstance.Instance<HP, HM>>(cb?: FxOrmCommon.ExecutionCallback<T>): IChainInstance;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
eager(...assocs: string[]): this;
|
|
218
|
+
eager(assocs: string[]): this;
|
|
219
|
+
|
|
220
|
+
[extraProperty: string]: any;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface IChainInstanceCallbackFn {
|
|
224
|
+
(...args: any[]): any | FxOrmQuery.IChainInstance
|
|
225
|
+
}
|
|
226
|
+
export interface IChainInstance {
|
|
227
|
+
_each (cb: IChainInstanceCallbackFn): IChainInstance
|
|
228
|
+
filter (cb: IChainInstanceCallbackFn): IChainInstance
|
|
229
|
+
sort (cb: IChainInstanceCallbackFn): IChainInstance
|
|
230
|
+
count (cb: IChainInstanceCallbackFn): IChainInstance
|
|
231
|
+
get (cb: IChainInstanceCallbackFn): IChainInstance
|
|
232
|
+
save (cb: IChainInstanceCallbackFn): IChainInstance
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
export interface ChainFindOptions {
|
|
237
|
+
keys: string[]
|
|
238
|
+
table: string
|
|
239
|
+
generateSqlSelect?: FxOrmDMLDriver.DMLDriver_FindOptions['generateSqlSelect']
|
|
240
|
+
driver: FxOrmDMLDriver.DMLDriver
|
|
241
|
+
|
|
242
|
+
conditions: QueryConditions
|
|
243
|
+
/**
|
|
244
|
+
* @notice virtual properties included here
|
|
245
|
+
*/
|
|
246
|
+
properties: Record<string, FxOrmProperty.NormalizedProperty>
|
|
247
|
+
keyProperties: FxOrmProperty.NormalizedProperty[]
|
|
248
|
+
order: (FxOrmQuery.OrderNormalizedTuple | FxOrmQuery.OrderSqlStyleTuple)[]
|
|
249
|
+
// only: string|FxSqlQueryColumns.SelectInputArgType[]
|
|
250
|
+
only: (string|FxSqlQueryColumns.SelectInputArgType)[]
|
|
251
|
+
limit?: number
|
|
252
|
+
offset?: number
|
|
253
|
+
merge: FxOrmQuery.ChainFindMergeInfo | FxOrmQuery.ChainFindMergeInfo[]
|
|
254
|
+
newInstanceSync: {
|
|
255
|
+
(data: FxOrmInstance.InstanceDataPayload): FxOrmInstance.Instance
|
|
256
|
+
}
|
|
257
|
+
associations: FxOrmAssociation.InstanceAssociationItem_HasMany[]
|
|
258
|
+
|
|
259
|
+
/* in instance */
|
|
260
|
+
exists?: FxOrmQuery.ChainWhereExistsInfo[]
|
|
261
|
+
__eager?: FxOrmAssociation.InstanceAssociationItem_HasMany[]
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export interface ChainFindInstanceOptions extends ChainFindOptions {
|
|
265
|
+
}
|
|
266
|
+
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
export
|
|
1
|
+
export namespace FxOrmSettings {
|
|
2
2
|
export interface SettingInstance {
|
|
3
|
-
set(key: string, value: any): SettingInstance
|
|
4
|
-
get(key: string, def?:
|
|
5
|
-
unset(): SettingInstance
|
|
3
|
+
set(key: string, value: any): SettingInstance
|
|
4
|
+
get(key: string, def?: (...args: any[]) => any): any
|
|
5
|
+
unset(): SettingInstance
|
|
6
6
|
}
|
|
7
|
+
|
|
7
8
|
class Settings {
|
|
8
9
|
constructor(settings: any);
|
|
10
|
+
|
|
9
11
|
static Container: any;
|
|
12
|
+
|
|
10
13
|
static defaults(): {
|
|
11
14
|
properties: {
|
|
12
15
|
primary_key: string;
|
|
13
16
|
association_key: string;
|
|
14
17
|
required: boolean;
|
|
15
18
|
};
|
|
19
|
+
|
|
16
20
|
instance: {
|
|
17
|
-
identityCache: boolean;
|
|
21
|
+
identityCache: boolean | number;
|
|
18
22
|
identityCacheSaveCheck: boolean;
|
|
19
23
|
autoSave: boolean;
|
|
20
24
|
autoFetch: boolean;
|
|
@@ -22,6 +26,7 @@ export declare namespace FxOrmSettings {
|
|
|
22
26
|
cascadeRemove: boolean;
|
|
23
27
|
returnAllErrors: boolean;
|
|
24
28
|
};
|
|
29
|
+
|
|
25
30
|
connection: {
|
|
26
31
|
reconnect: boolean;
|
|
27
32
|
poll: boolean;
|
|
@@ -29,7 +34,9 @@ export declare namespace FxOrmSettings {
|
|
|
29
34
|
};
|
|
30
35
|
};
|
|
31
36
|
}
|
|
37
|
+
|
|
32
38
|
export type ISettings = Settings;
|
|
39
|
+
|
|
33
40
|
export var settings: SettingInstance;
|
|
34
|
-
|
|
35
|
-
}
|
|
41
|
+
|
|
42
|
+
}
|
|
@@ -3,45 +3,70 @@ import type { FxOrmAssociation } from "./assoc";
|
|
|
3
3
|
import type { FxOrmInstance } from "./instance";
|
|
4
4
|
import type { FxOrmModel } from "./model";
|
|
5
5
|
import type { FxOrmQuery } from './query';
|
|
6
|
+
|
|
6
7
|
import type { FxSqlQuerySubQuery } from "../../sql-query/Query";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
export namespace FxOrmSynchronous {
|
|
10
|
+
export interface VoidReturn {
|
|
11
|
+
(): void
|
|
10
12
|
}
|
|
11
|
-
interface UnknownReturn {
|
|
12
|
-
(): any
|
|
13
|
+
export interface UnknownReturn {
|
|
14
|
+
(): any
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
|
|
17
|
+
export interface SynchronizedModel<
|
|
18
|
+
HP extends Record<string, FxOrmInstance.FieldRuntimeType> = Record<string, FxOrmInstance.FieldRuntimeType>,
|
|
19
|
+
HM extends Record<string, (...args: any) => any> = Record<string, (...args: any) => any>
|
|
20
|
+
> {
|
|
21
|
+
findSync<T = FxOrmInstance.Instance<HP, HM>[]>(conditions?: FxOrmQuery.QueryConditions__Find, options?: FxOrmModel.ModelOptions__Find): T
|
|
22
|
+
findSync<T = FxOrmInstance.Instance<HP, HM>[]>(conditions: FxOrmQuery.QueryConditions__Find, limit: number, order: string[]): T
|
|
23
|
+
|
|
24
|
+
allSync: SynchronizedModel['findSync']
|
|
25
|
+
whereSync: SynchronizedModel['findSync']
|
|
26
|
+
|
|
19
27
|
countSync(conditions?: FxOrmQuery.QueryConditions__Find): number;
|
|
20
|
-
existsSync(...conditions: (FxOrmCommon.IdType | FxSqlQuerySubQuery.SubQueryConditions)[]): boolean
|
|
21
|
-
|
|
22
|
-
oneSync(conditions?: FxOrmQuery.QueryConditions__Find,
|
|
28
|
+
existsSync(...conditions: (FxOrmCommon.IdType | FxSqlQuerySubQuery.SubQueryConditions)[]): boolean
|
|
29
|
+
|
|
30
|
+
oneSync(conditions?: FxOrmQuery.QueryConditions__Find, options?: FxOrmModel.ModelOptions__Find): FxOrmInstance.Instance<HP, HM> | null
|
|
31
|
+
oneSync(conditions?: FxOrmQuery.QueryConditions__Find, order?: string[]): FxOrmInstance.Instance<HP, HM> | null
|
|
32
|
+
|
|
23
33
|
createSync<T = FxOrmInstance.Instance<HP, HM>>(data: FxOrmInstance.InstanceDataPayload): T;
|
|
24
34
|
createSync<T = FxOrmInstance.Instance<HP, HM>[]>(data: FxOrmInstance.InstanceDataPayload[]): T;
|
|
35
|
+
|
|
36
|
+
// // this Instance is from its callback
|
|
25
37
|
getSync(...ids: any[]): FxOrmInstance.Instance<HP, HM> | null;
|
|
38
|
+
|
|
26
39
|
findBySync: {
|
|
27
|
-
<T = FxOrmInstance.Instance<HP, HM>[]>(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
<T = FxOrmInstance.Instance<HP, HM>[]>(
|
|
41
|
+
ext_name: string,
|
|
42
|
+
conditions?: FxOrmQuery.QueryConditions__Find,
|
|
43
|
+
options?: FxOrmAssociation.ModelAssociationMethod__FindByOptions,
|
|
44
|
+
): T
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// it's callback version could return `this: ORM`
|
|
48
|
+
syncSync: VoidReturn
|
|
49
|
+
clearSync: VoidReturn
|
|
50
|
+
dropSync: UnknownReturn
|
|
51
|
+
|
|
32
52
|
/**
|
|
33
53
|
* other patched synchronous version method
|
|
34
54
|
* - lazyLoad: getXXXSync, setXXXSync, removeXXXSync
|
|
35
55
|
* - association: [addAccessor]Sync, [getAccessor]Sync, [hasAccessor]Sync, [setAccessor]Sync, [removeAccessor]Sync
|
|
36
56
|
*/
|
|
37
|
-
[ek: string]: any
|
|
57
|
+
[ek: string]: any
|
|
38
58
|
}
|
|
39
|
-
|
|
59
|
+
|
|
60
|
+
// TODO: to implement it.
|
|
61
|
+
export interface SynchronizedIChainFind {
|
|
62
|
+
|
|
40
63
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
|
|
65
|
+
export interface SynchronizedORMInstance {
|
|
66
|
+
// it's callback version could return `this: ORM`
|
|
67
|
+
syncSync: VoidReturn
|
|
68
|
+
closeSync: VoidReturn
|
|
69
|
+
dropSync: VoidReturn
|
|
70
|
+
pingSync: VoidReturn
|
|
46
71
|
}
|
|
47
|
-
}
|
|
72
|
+
}
|