fib-orm 2.0.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 +36 -34
- package/{lib/cli/commands/ddlFrom.js → src/cli/commands/ddlFrom.ts} +40 -26
- package/{lib/cli/commands/dumpModel.js → src/cli/commands/dumpModel.ts} +78 -31
- package/{lib/cli/commands/escape.js → src/cli/commands/escape.ts} +51 -28
- package/{lib/cli/commands/spinner.js → src/cli/commands/spinner.ts} +20 -10
- package/{lib/cli/commands/upgrade.js → src/cli/commands/upgrade.ts} +53 -33
- 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 -85
- 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 -176
- 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 -68
- 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 -21
- 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 -3
- 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 -26
- package/lib/cli/helpers/package.js +0 -56
- package/lib/cli/index.d.ts +0 -2
- package/lib/cli/index.js +0 -18
- package/lib/db-driver/Typo.d.ts +0 -112
- package/lib/db-driver/Typo.js +0 -1
- package/lib/db-driver/built-ins/base.class.d.ts +0 -96
- package/lib/db-driver/built-ins/base.class.js +0 -186
- package/lib/db-driver/built-ins/driver-dm.d.ts +0 -18
- package/lib/db-driver/built-ins/driver-dm.js +0 -53
- package/lib/db-driver/built-ins/driver-mongodb.d.ts +0 -24
- package/lib/db-driver/built-ins/driver-mongodb.js +0 -46
- package/lib/db-driver/built-ins/driver-mysql.d.ts +0 -18
- package/lib/db-driver/built-ins/driver-mysql.js +0 -37
- package/lib/db-driver/built-ins/driver-postgresql.d.ts +0 -22
- package/lib/db-driver/built-ins/driver-postgresql.js +0 -76
- package/lib/db-driver/built-ins/driver-redis.d.ts +0 -12
- package/lib/db-driver/built-ins/driver-redis.js +0 -35
- package/lib/db-driver/built-ins/driver-sqlite.d.ts +0 -17
- package/lib/db-driver/built-ins/driver-sqlite.js +0 -34
- package/lib/db-driver/index.d.ts +0 -3
- package/lib/db-driver/index.js +0 -4
- 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 -3
- package/lib/knex/sandbox.d.ts +0 -4
- package/lib/knex/sandbox.js +0 -22
- 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 -176
- 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 -17
- 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 -15
- package/lib/orm/Associations/_utils.js +0 -52
- package/lib/orm/ChainFind.d.ts +0 -3
- package/lib/orm/ChainFind.js +0 -327
- package/lib/orm/ChainInstance.d.ts +0 -6
- package/lib/orm/ChainInstance.js +0 -73
- package/lib/orm/Debug.d.ts +0 -2
- package/lib/orm/Debug.js +0 -17
- package/lib/orm/Drivers/DB/base.d.ts +0 -3
- package/lib/orm/Drivers/DB/base.js +0 -3
- package/lib/orm/Drivers/DB/dm.d.ts +0 -11
- package/lib/orm/Drivers/DB/dm.js +0 -23
- package/lib/orm/Drivers/DB/mysql.d.ts +0 -11
- package/lib/orm/Drivers/DB/mysql.js +0 -23
- package/lib/orm/Drivers/DB/postgres.d.ts +0 -11
- package/lib/orm/Drivers/DB/postgres.js +0 -22
- package/lib/orm/Drivers/DB/sqlite3.d.ts +0 -16
- package/lib/orm/Drivers/DB/sqlite3.js +0 -39
- package/lib/orm/Drivers/DML/_ddl-sql.d.ts +0 -3
- package/lib/orm/Drivers/DML/_ddl-sql.js +0 -51
- 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 -38
- 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 -2
- 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 -6
- package/lib/orm/Drivers/DML/mysql.d.ts +0 -2
- package/lib/orm/Drivers/DML/mysql.js +0 -251
- package/lib/orm/Drivers/DML/postgres.d.ts +0 -3
- package/lib/orm/Drivers/DML/postgres.js +0 -276
- package/lib/orm/Drivers/DML/sqlite.d.ts +0 -2
- package/lib/orm/Drivers/DML/sqlite.js +0 -266
- package/lib/orm/Error.d.ts +0 -11
- package/lib/orm/Error.js +0 -40
- package/lib/orm/Helpers.d.ts +0 -35
- package/lib/orm/Helpers.js +0 -233
- package/lib/orm/Hook.d.ts +0 -13
- package/lib/orm/Hook.js +0 -99
- package/lib/orm/Instance.d.ts +0 -2
- package/lib/orm/Instance.js +0 -697
- package/lib/orm/LazyLoad.d.ts +0 -4
- package/lib/orm/LazyLoad.js +0 -76
- package/lib/orm/Model.d.ts +0 -7
- package/lib/orm/Model.js +0 -971
- package/lib/orm/ORM.d.ts +0 -37
- package/lib/orm/ORM.js +0 -241
- 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 -13
- 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 -119
- package/lib/orm/Singleton.d.ts +0 -5
- package/lib/orm/Singleton.js +0 -72
- package/lib/orm/Typo/Adapter.d.ts +0 -5
- package/lib/orm/Typo/Adapter.js +0 -1
- package/lib/orm/Typo/DMLDriver.d.ts +0 -210
- package/lib/orm/Typo/DMLDriver.js +0 -1
- package/lib/orm/Typo/Db.d.ts +0 -38
- package/lib/orm/Typo/Db.js +0 -1
- package/lib/orm/Typo/Error.d.ts +0 -31
- package/lib/orm/Typo/Error.js +0 -1
- package/lib/orm/Typo/ORM.d.ts +0 -233
- package/lib/orm/Typo/ORM.js +0 -3
- package/lib/orm/Typo/Validators.d.ts +0 -32
- package/lib/orm/Typo/Validators.js +0 -2
- package/lib/orm/Typo/_common.d.ts +0 -38
- package/lib/orm/Typo/_common.js +0 -1
- package/lib/orm/Typo/assoc.d.ts +0 -221
- package/lib/orm/Typo/assoc.js +0 -1
- package/lib/orm/Typo/hook.d.ts +0 -42
- package/lib/orm/Typo/hook.js +0 -1
- package/lib/orm/Typo/instance.d.ts +0 -157
- package/lib/orm/Typo/instance.js +0 -1
- package/lib/orm/Typo/model.js +0 -6
- package/lib/orm/Typo/patch.d.ts +0 -31
- package/lib/orm/Typo/patch.js +0 -1
- package/lib/orm/Typo/property.d.ts +0 -57
- package/lib/orm/Typo/property.js +0 -1
- package/lib/orm/Typo/query.d.ts +0 -216
- package/lib/orm/Typo/query.js +0 -1
- package/lib/orm/Typo/settings.js +0 -5
- package/lib/orm/Typo/synchronous.js +0 -1
- package/lib/orm/Utilities.d.ts +0 -179
- package/lib/orm/Utilities.js +0 -975
- package/lib/orm/Validators.d.ts +0 -34
- package/lib/orm/Validators.js +0 -100
- 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 -68
- package/lib/orm/index.js +0 -157
- package/lib/orm-core/callback.d.ts +0 -12
- package/lib/orm-core/callback.js +0 -1
- package/lib/orm-core/dialect.js +0 -1
- package/lib/orm-core/error.d.ts +0 -16
- package/lib/orm-core/error.js +0 -29
- package/lib/orm-core/index.js +0 -6
- package/lib/orm-core/sync.d.ts +0 -12
- package/lib/orm-core/sync.js +0 -1
- package/lib/orm-core/utils.d.ts +0 -1
- package/lib/orm-core/utils.js +0 -5
- package/lib/orm-property/Property.d.ts +0 -78
- package/lib/orm-property/Property.js +0 -1
- 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 -22
- 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 -5
- package/lib/orm-property/transformers/mysql.d.ts +0 -102
- package/lib/orm-property/transformers/mysql.js +0 -261
- package/lib/orm-property/transformers/postgresql.d.ts +0 -54
- package/lib/orm-property/transformers/postgresql.js +0 -189
- package/lib/orm-property/transformers/sqlite.d.ts +0 -19
- package/lib/orm-property/transformers/sqlite.js +0 -171
- package/lib/sql-ddl-sync/Dialects/dm.d.ts +0 -40
- package/lib/sql-ddl-sync/Dialects/dm.js +0 -296
- package/lib/sql-ddl-sync/Dialects/index.d.ts +0 -7
- package/lib/sql-ddl-sync/Dialects/index.js +0 -7
- package/lib/sql-ddl-sync/Dialects/mysql.d.ts +0 -39
- package/lib/sql-ddl-sync/Dialects/mysql.js +0 -240
- package/lib/sql-ddl-sync/Dialects/postgresql.d.ts +0 -40
- package/lib/sql-ddl-sync/Dialects/postgresql.js +0 -286
- package/lib/sql-ddl-sync/Dialects/sqlite.d.ts +0 -44
- package/lib/sql-ddl-sync/Dialects/sqlite.js +0 -256
- 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 -1
- package/lib/sql-ddl-sync/Typo/DbIndex.d.ts +0 -13
- package/lib/sql-ddl-sync/Typo/DbIndex.js +0 -1
- package/lib/sql-ddl-sync/Typo/Dialect.js +0 -1
- package/lib/sql-ddl-sync/Typo/Driver.d.ts +0 -53
- package/lib/sql-ddl-sync/Typo/Driver.js +0 -1
- package/lib/sql-ddl-sync/Typo/Query.d.ts +0 -7
- package/lib/sql-ddl-sync/Typo/Query.js +0 -1
- package/lib/sql-ddl-sync/Typo/SQL.d.ts +0 -31
- package/lib/sql-ddl-sync/Typo/SQL.js +0 -1
- package/lib/sql-ddl-sync/Typo/_common.d.ts +0 -29
- package/lib/sql-ddl-sync/Typo/_common.js +0 -1
- package/lib/sql-ddl-sync/Utils.d.ts +0 -40
- 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 -371
- package/lib/sql-query/Comparators.d.ts +0 -3
- package/lib/sql-query/Comparators.js +0 -94
- package/lib/sql-query/Create.d.ts +0 -35
- package/lib/sql-query/Create.js +0 -77
- package/lib/sql-query/Dialects/dm.d.ts +0 -3
- package/lib/sql-query/Dialects/index.js +0 -12
- package/lib/sql-query/Dialects/mssql.d.ts +0 -3
- package/lib/sql-query/Dialects/mssql.js +0 -73
- package/lib/sql-query/Dialects/mysql.d.ts +0 -3
- package/lib/sql-query/Dialects/mysql.js +0 -100
- package/lib/sql-query/Dialects/postgresql.d.ts +0 -3
- package/lib/sql-query/Dialects/postgresql.js +0 -76
- package/lib/sql-query/Dialects/sqlite.d.ts +0 -3
- package/lib/sql-query/Dialects/sqlite.js +0 -61
- package/lib/sql-query/Helpers.d.ts +0 -38
- package/lib/sql-query/Helpers.js +0 -259
- package/lib/sql-query/Insert.d.ts +0 -12
- package/lib/sql-query/Insert.js +0 -33
- package/lib/sql-query/Query.d.ts +0 -29
- package/lib/sql-query/Query.js +0 -119
- package/lib/sql-query/Remove.d.ts +0 -16
- package/lib/sql-query/Remove.js +0 -93
- package/lib/sql-query/Select.d.ts +0 -62
- package/lib/sql-query/Select.js +0 -533
- 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 -1
- package/lib/sql-query/Typo/Comparators.d.ts +0 -140
- package/lib/sql-query/Typo/Comparators.js +0 -1
- package/lib/sql-query/Typo/Dialect.d.ts +0 -39
- package/lib/sql-query/Typo/Dialect.js +0 -1
- package/lib/sql-query/Typo/Field.d.ts +0 -8
- package/lib/sql-query/Typo/Field.js +0 -1
- package/lib/sql-query/Typo/Helper.d.ts +0 -4
- package/lib/sql-query/Typo/Helper.js +0 -1
- package/lib/sql-query/Typo/Query-ChainBuilder.d.ts +0 -80
- package/lib/sql-query/Typo/Query-ChainBuilder.js +0 -1
- package/lib/sql-query/Typo/Query.d.ts +0 -34
- package/lib/sql-query/Typo/Query.js +0 -16
- package/lib/sql-query/Typo/Sql.d.ts +0 -143
- package/lib/sql-query/Typo/Sql.js +0 -1
- package/lib/sql-query/Typo/SubQuery.d.ts +0 -39
- package/lib/sql-query/Typo/SubQuery.js +0 -1
- package/lib/sql-query/Typo/index.js +0 -1
- package/lib/sql-query/Update.d.ts +0 -15
- package/lib/sql-query/Update.js +0 -38
- 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
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
/// <reference types="@fibjs/types" />
|
|
2
|
-
import { FxDbDriverNS, IDbDriver } from "../../db-driver/index";
|
|
3
|
-
import type { FxOrmSqlDDLSync__Dialect } from "../../sql-ddl-sync/index";
|
|
4
|
-
import type { FxOrmAssociation } from "./assoc";
|
|
5
|
-
import type { FxOrmDb } from "./Db";
|
|
6
|
-
import type { FxOrmModel } from "./model";
|
|
7
|
-
import type { FxOrmProperty } from "./property";
|
|
8
|
-
import type { FxOrmQuery } from "./query";
|
|
9
|
-
import type { FxOrmSettings } from "./settings";
|
|
10
|
-
import type { FxOrmCommon } from "./_common";
|
|
11
|
-
import type { FxSqlQuery, FxSqlQuerySubQuery, FxSqlQuerySql, FxSqlQueryColumns, FxSqlQueryChainBuilder } from '../../sql-query/Query';
|
|
12
|
-
export declare namespace FxOrmDMLDriver {
|
|
13
|
-
export type DriverUidType = string;
|
|
14
|
-
export interface QueryDataPayload {
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}
|
|
17
|
-
export interface QueriedCountDataPayload {
|
|
18
|
-
c: number;
|
|
19
|
-
}
|
|
20
|
-
export interface DMLDriverOptions {
|
|
21
|
-
debug?: boolean;
|
|
22
|
-
settings: FxOrmSettings.SettingInstance;
|
|
23
|
-
}
|
|
24
|
-
export interface DMLDriverConstructor {
|
|
25
|
-
new (config: FxDbDriverNS.DBConnectionConfig, connection: FxOrmDb.Database, opts: FxOrmDMLDriver.DMLDriverOptions): DMLDriver;
|
|
26
|
-
prototype: DMLDriver;
|
|
27
|
-
}
|
|
28
|
-
export interface DMLDriver<TConn extends IDbDriver.ISQLConn = IDbDriver.ISQLConn> {
|
|
29
|
-
readonly db: FxOrmDb.Database<TConn>;
|
|
30
|
-
readonly config: FxOrmDb.Database<TConn>['config'];
|
|
31
|
-
/**
|
|
32
|
-
* @description driver object for SQL-type backend
|
|
33
|
-
*/
|
|
34
|
-
readonly sqlDriver: TConn extends IDbDriver.ISQLConn ? IDbDriver.ITypedDriver<TConn> : undefined;
|
|
35
|
-
readonly isSql: TConn extends IDbDriver.ISQLConn ? true : false;
|
|
36
|
-
customTypes: {
|
|
37
|
-
[key: string]: FxOrmProperty.CustomPropertyType;
|
|
38
|
-
};
|
|
39
|
-
knex: import('../../knex/types').Knex;
|
|
40
|
-
readonly query: FxSqlQuery.Class_Query;
|
|
41
|
-
/** @internal */
|
|
42
|
-
getQuery: {
|
|
43
|
-
(): FxSqlQuery.Class_Query;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* @internal
|
|
47
|
-
*/
|
|
48
|
-
readonly ddlSync: FxOrmSqlDDLSync__Dialect.Dialect<IDbDriver.ISQLConn>;
|
|
49
|
-
doSync<T = any>(opts?: FxOrmDMLShared.SyncOptions): this;
|
|
50
|
-
doDrop<T = any>(opts?: FxOrmDMLShared.DropOptions): this;
|
|
51
|
-
connect: {
|
|
52
|
-
(cb: FxOrmCommon.GenericCallback<IDbDriver>): void;
|
|
53
|
-
(): IDbDriver;
|
|
54
|
-
};
|
|
55
|
-
reconnect: {
|
|
56
|
-
(cb: FxOrmCommon.GenericCallback<IDbDriver>): void;
|
|
57
|
-
(): IDbDriver;
|
|
58
|
-
};
|
|
59
|
-
ping: {
|
|
60
|
-
(cb?: FxOrmCommon.VoidCallback): void;
|
|
61
|
-
};
|
|
62
|
-
on: {
|
|
63
|
-
<T>(ev: string, cb?: FxOrmCommon.GenericCallback<T>): void;
|
|
64
|
-
};
|
|
65
|
-
close: {
|
|
66
|
-
(cb?: FxOrmCommon.VoidCallback): void;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* @description
|
|
70
|
-
* aggregate_functions could be string tuple such as
|
|
71
|
-
*
|
|
72
|
-
* [`RANDOM`, `RAND`] ---> FxOrmDb.AGGREGATION_METHOD_TUPLE__COMMON
|
|
73
|
-
*/
|
|
74
|
-
aggregate_functions: ((FxOrmDb.AGGREGATION_METHOD_COMPLEX) | FxOrmDb.AGGREGATION_METHOD_TUPLE__COMMON)[];
|
|
75
|
-
execSimpleQuery: {
|
|
76
|
-
<T = any>(query: string, cb?: FxOrmCommon.GenericCallback<T>): T;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* @description do eager-query
|
|
80
|
-
*/
|
|
81
|
-
eagerQuery: {
|
|
82
|
-
<T = any>(association: FxOrmAssociation.InstanceAssociationItem, opts: FxOrmQuery.ChainFindOptions, keys: string[], cb?: FxOrmCommon.GenericCallback<T>): T;
|
|
83
|
-
};
|
|
84
|
-
find: {
|
|
85
|
-
<T = FxOrmDMLDriver.QueryDataPayload[]>(selectFields: FxSqlQueryColumns.SelectInputArgType[], table: string, conditions: FxSqlQuerySubQuery.SubQueryConditions, opts: DMLDriver_FindOptions): T;
|
|
86
|
-
};
|
|
87
|
-
count: {
|
|
88
|
-
/**
|
|
89
|
-
* mysql: {c: number}
|
|
90
|
-
* sqlite: {c: number}
|
|
91
|
-
*/
|
|
92
|
-
(table: string, conditions: FxSqlQuerySubQuery.SubQueryConditions, opts: DMLDriver_CountOptions, cb?: FxOrmCommon.GenericCallback<FxOrmQuery.CountResult[]>): FxOrmQuery.CountResult[];
|
|
93
|
-
};
|
|
94
|
-
insert: {
|
|
95
|
-
(table: string, data: FxSqlQuerySql.DataToSet, keyProperties: FxOrmProperty.NormalizedProperty[], cb?: FxOrmCommon.GenericCallback<FxOrmQuery.InsertResult>): FxOrmQuery.InsertResult;
|
|
96
|
-
};
|
|
97
|
-
update: {
|
|
98
|
-
<T = any>(table: string, changes: FxSqlQuerySql.DataToSet, conditions: FxSqlQuerySubQuery.SubQueryConditions, cb?: FxOrmCommon.GenericCallback<T>): T;
|
|
99
|
-
};
|
|
100
|
-
remove: {
|
|
101
|
-
<T = any>(table: string, conditions: FxSqlQuerySubQuery.SubQueryConditions, cb?: FxOrmCommon.GenericCallback<T>): T;
|
|
102
|
-
};
|
|
103
|
-
clear: {
|
|
104
|
-
<T = any>(table: string, cb?: FxOrmCommon.GenericCallback<T>): T;
|
|
105
|
-
};
|
|
106
|
-
valueToProperty: {
|
|
107
|
-
(value: any, property: FxOrmProperty.NormalizedProperty): any;
|
|
108
|
-
};
|
|
109
|
-
propertyToValue: {
|
|
110
|
-
(value: any, property: FxOrmProperty.NormalizedProperty): any;
|
|
111
|
-
};
|
|
112
|
-
uid: string;
|
|
113
|
-
hasMany?: {
|
|
114
|
-
(Model: FxOrmModel.Model, association: FxOrmAssociation.InstanceAssociationItem): any;
|
|
115
|
-
};
|
|
116
|
-
execQuerySync: (query: string, opt: Record<string, any>) => any;
|
|
117
|
-
[ext_key: string]: any;
|
|
118
|
-
}
|
|
119
|
-
export type ChainWhereExistsInfoPayload = FxOrmQuery.ChainWhereExistsInfo[];
|
|
120
|
-
/** @internal */
|
|
121
|
-
type __DMLDriver_FindSqlQueryModifierCtx = {
|
|
122
|
-
table: string;
|
|
123
|
-
fromTuple: FxSqlQuerySql.SqlTableTuple;
|
|
124
|
-
selectFields: FxSqlQueryColumns.SelectInputArgType[];
|
|
125
|
-
selectVirtualFields: Exclude<DMLDriver_FindOptions['selectVirtualFields'], void>;
|
|
126
|
-
};
|
|
127
|
-
export interface DMLDriver_FindOptions {
|
|
128
|
-
offset?: number;
|
|
129
|
-
limit?: number;
|
|
130
|
-
order?: FxOrmQuery.OrderNormalizedResult[];
|
|
131
|
-
merge?: FxOrmQuery.ChainFindMergeInfo[];
|
|
132
|
-
exists?: ChainWhereExistsInfoPayload;
|
|
133
|
-
topConditions?: FxSqlQuerySubQuery.SubQueryConditions;
|
|
134
|
-
/** @experimental */
|
|
135
|
-
selectVirtualFields?: string[];
|
|
136
|
-
/** @experimental */
|
|
137
|
-
generateSqlSelect?: (this: DMLDriver, ctx: __DMLDriver_FindSqlQueryModifierCtx, chainSelect: FxSqlQueryChainBuilder.ChainBuilder__Select) => typeof chainSelect | void;
|
|
138
|
-
/** @experimental */
|
|
139
|
-
__pointTypeMapsTo: string[];
|
|
140
|
-
}
|
|
141
|
-
export interface DMLDriver_CountOptions {
|
|
142
|
-
merge?: DMLDriver_FindOptions['merge'];
|
|
143
|
-
exists?: DMLDriver_FindOptions['exists'];
|
|
144
|
-
}
|
|
145
|
-
export interface DMLDriverConstructor_MySQL extends DMLDriverConstructor {
|
|
146
|
-
(this: DMLDriver_MySQL, config: FxDbDriverNS.DBConnectionConfig, connection: FxOrmDb.Database<Class_MySQL>, opts: FxOrmDMLDriver.DMLDriverOptions): void;
|
|
147
|
-
prototype: DMLDriver_MySQL;
|
|
148
|
-
}
|
|
149
|
-
export interface DMLDriver_MySQL extends DMLDriver {
|
|
150
|
-
db: FxOrmDb.Database<Class_MySQL>;
|
|
151
|
-
config: DMLDriver['config'] & {
|
|
152
|
-
timezone: string;
|
|
153
|
-
};
|
|
154
|
-
aggregate_functions: (FxOrmDb.AGGREGATION_METHOD_MYSQL | FxOrmDb.AGGREGATION_METHOD_TUPLE__MYSQL)[];
|
|
155
|
-
}
|
|
156
|
-
export interface DMLDriverConstructor_PostgreSQL extends DMLDriverConstructor {
|
|
157
|
-
(this: DMLDriver_PostgreSQL, config: FxDbDriverNS.DBConnectionConfig, connection: FxOrmDb.DatabaseBase_PostgreSQL, opts: FxOrmDMLDriver.DMLDriverOptions): void;
|
|
158
|
-
prototype: DMLDriver_PostgreSQL;
|
|
159
|
-
}
|
|
160
|
-
export interface DMLDriver_PostgreSQL extends DMLDriver {
|
|
161
|
-
db: FxOrmDb.DatabaseBase_PostgreSQL;
|
|
162
|
-
config: DMLDriver['config'] & {
|
|
163
|
-
timezone: string;
|
|
164
|
-
};
|
|
165
|
-
aggregate_functions: (FxOrmDb.AGGREGATION_METHOD_POSTGRESQL)[];
|
|
166
|
-
}
|
|
167
|
-
export interface DMLDriverConstructor_SQLite extends DMLDriverConstructor {
|
|
168
|
-
(this: DMLDriver_SQLite, config: FxDbDriverNS.DBConnectionConfig, connection: FxOrmDb.DatabaseBase_SQLite, opts: FxOrmDMLDriver.DMLDriverOptions): void;
|
|
169
|
-
prototype: DMLDriver_SQLite;
|
|
170
|
-
}
|
|
171
|
-
export interface DMLDriver_SQLite extends DMLDriver {
|
|
172
|
-
db: FxOrmDb.DatabaseBase_SQLite;
|
|
173
|
-
config: DMLDriver['config'] & {
|
|
174
|
-
timezone: string;
|
|
175
|
-
};
|
|
176
|
-
aggregate_functions: (FxOrmDb.AGGREGATION_METHOD_SQLITE)[];
|
|
177
|
-
}
|
|
178
|
-
export type DefaultSqlDialect = FxOrmSqlDDLSync__Dialect.Dialect<IDbDriver.ISQLConn>;
|
|
179
|
-
export {};
|
|
180
|
-
}
|
|
181
|
-
export declare namespace FxOrmDMLShared {
|
|
182
|
-
interface SyncOptions {
|
|
183
|
-
id: string[];
|
|
184
|
-
extension: boolean;
|
|
185
|
-
table: string;
|
|
186
|
-
allProperties: Record<string, FxOrmProperty.NormalizedProperty>;
|
|
187
|
-
indexes: string[];
|
|
188
|
-
customTypes: {
|
|
189
|
-
[key: string]: FxOrmProperty.CustomPropertyType;
|
|
190
|
-
};
|
|
191
|
-
one_associations: FxOrmAssociation.InstanceAssociationItem_HasOne[];
|
|
192
|
-
many_associations: FxOrmAssociation.InstanceAssociationItem_HasMany[];
|
|
193
|
-
extend_associations: FxOrmAssociation.InstanceAssociationItem_ExtendTos[];
|
|
194
|
-
tableComment?: string;
|
|
195
|
-
/**
|
|
196
|
-
* @default true
|
|
197
|
-
*/
|
|
198
|
-
repair_column?: boolean;
|
|
199
|
-
/**
|
|
200
|
-
* @default false
|
|
201
|
-
*/
|
|
202
|
-
allow_drop_column?: boolean;
|
|
203
|
-
}
|
|
204
|
-
interface DropOptions {
|
|
205
|
-
table: string;
|
|
206
|
-
properties: Record<string, FxOrmProperty.NormalizedProperty>;
|
|
207
|
-
one_associations: FxOrmAssociation.InstanceAssociationItem_HasOne[];
|
|
208
|
-
many_associations: FxOrmAssociation.InstanceAssociationItem_HasMany[];
|
|
209
|
-
}
|
|
210
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/orm/Typo/Db.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/// <reference types="@fibjs/types" />
|
|
2
|
-
/// <reference types="@fibjs/types" />
|
|
3
|
-
/// <reference types="@fibjs/types" />
|
|
4
|
-
import { IDbDriver } from "../../db-driver/index";
|
|
5
|
-
import type { FxOrmCommon } from "./_common";
|
|
6
|
-
export declare namespace FxOrmDb {
|
|
7
|
-
interface DatabaseBaseConfig extends /* FxDbDriverNS.DBConnectionConfig, */ Class_UrlObject {
|
|
8
|
-
}
|
|
9
|
-
interface Database<T extends IDbDriver.IConnTypeEnum = IDbDriver.IConnTypeEnum> extends IDbDriver<T> {
|
|
10
|
-
eventor: Class_EventEmitter;
|
|
11
|
-
query: {
|
|
12
|
-
<T = any>(query: string, cb?: FxOrmCommon.GenericCallback<T>): T;
|
|
13
|
-
};
|
|
14
|
-
connect: {
|
|
15
|
-
(cb?: FxOrmCommon.GenericCallback<T>): void;
|
|
16
|
-
(): T;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
interface SQLDatabase<T extends IDbDriver.ISQLConn = IDbDriver.ISQLConn> extends Database<T> {
|
|
20
|
-
}
|
|
21
|
-
interface DatabaseBase_SQLite extends SQLDatabase<Class_SQLite> {
|
|
22
|
-
readonly use_memory: boolean;
|
|
23
|
-
all: DatabaseBase_SQLite['query'];
|
|
24
|
-
get: DatabaseBase_SQLite['query'];
|
|
25
|
-
}
|
|
26
|
-
interface DatabaseBase_PostgreSQL extends SQLDatabase<IDbDriver.ISQLConn> {
|
|
27
|
-
}
|
|
28
|
-
type AGGREGATION_METHOD_COMMON = "ABS" | "ROUND" | "AVG" | "MIN" | "MAX" | "SUM" | "COUNT" | "DISTINCT";
|
|
29
|
-
type AGGREGATION_METHOD_TUPLE__COMMON = [
|
|
30
|
-
string,
|
|
31
|
-
AGGREGATION_METHOD_COMPLEX
|
|
32
|
-
];
|
|
33
|
-
type AGGREGATION_METHOD_SQLITE = AGGREGATION_METHOD_COMMON | "RANDOM";
|
|
34
|
-
type AGGREGATION_METHOD_MYSQL = AGGREGATION_METHOD_COMMON | "CEIL" | "FLOOR" | "LOG" | "LOG2" | "LOG10" | "EXP" | "POWER" | "ACOS" | "ASIN" | "ATAN" | "COS" | "SIN" | "TAN" | "CONV" | "RAND" | "RADIANS" | "DEGREES" | "SUM" | "COUNT" | "DISTINCT";
|
|
35
|
-
type AGGREGATION_METHOD_TUPLE__MYSQL = ["RANDOM", "RAND"];
|
|
36
|
-
type AGGREGATION_METHOD_POSTGRESQL = AGGREGATION_METHOD_COMMON | "CEIL" | "FLOOR" | 'RANDOM' | "LOG" | "EXP" | "POWER" | "ACOS" | "ASIN" | "ATAN" | "COS" | "SIN" | "TAN" | "RADIANS" | "DEGREES";
|
|
37
|
-
type AGGREGATION_METHOD_COMPLEX = AGGREGATION_METHOD_POSTGRESQL | AGGREGATION_METHOD_SQLITE | AGGREGATION_METHOD_MYSQL;
|
|
38
|
-
}
|
package/lib/orm/Typo/Db.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/orm/Typo/Error.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/// <reference types="@fibjs/enforce" />
|
|
2
|
-
/// <reference types="@fibjs/types" />
|
|
3
|
-
import { FxOrmInstance } from "./instance";
|
|
4
|
-
export declare namespace FxOrmError {
|
|
5
|
-
interface PredefineErrorCodes {
|
|
6
|
-
QUERY_ERROR: number;
|
|
7
|
-
NOT_FOUND: number;
|
|
8
|
-
NOT_DEFINED: number;
|
|
9
|
-
NO_SUPPORT: number;
|
|
10
|
-
MISSING_CALLBACK: number;
|
|
11
|
-
PARAM_MISMATCH: number;
|
|
12
|
-
CONNECTION_LOST: number;
|
|
13
|
-
BAD_MODEL: number;
|
|
14
|
-
}
|
|
15
|
-
interface ExtendedError extends Error {
|
|
16
|
-
code?: number | string;
|
|
17
|
-
[ext: string]: any;
|
|
18
|
-
}
|
|
19
|
-
interface ValidateError extends FibjsEnforce.ValidationError {
|
|
20
|
-
code?: number | string;
|
|
21
|
-
}
|
|
22
|
-
type ValidateErrorResult = ValidateError | ValidateError[];
|
|
23
|
-
interface ErrorWaitor {
|
|
24
|
-
evt?: Class_Event;
|
|
25
|
-
err: FxOrmError.ExtendedError;
|
|
26
|
-
}
|
|
27
|
-
interface BatchOperationInstanceErrorItem extends ExtendedError {
|
|
28
|
-
index: number;
|
|
29
|
-
instance: FxOrmInstance.Instance;
|
|
30
|
-
}
|
|
31
|
-
}
|
package/lib/orm/Typo/Error.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/orm/Typo/ORM.d.ts
DELETED
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
/// <reference types="@fibjs/types" />
|
|
2
|
-
/// <reference types="@fibjs/enforce" />
|
|
3
|
-
import type { FxOrmModel } from "./model";
|
|
4
|
-
import type { FxOrmInstance } from "./instance";
|
|
5
|
-
import type { FxOrmQuery } from "./query";
|
|
6
|
-
import type { FxOrmDMLDriver } from "./DMLDriver";
|
|
7
|
-
import type { FxOrmValidators } from "./Validators";
|
|
8
|
-
import type { FxOrmSettings } from "./settings";
|
|
9
|
-
import type { FxOrmPatch } from "./patch";
|
|
10
|
-
import type { FxOrmAssociation } from "./assoc";
|
|
11
|
-
import type { FxOrmSynchronous } from "./synchronous";
|
|
12
|
-
import type { FxOrmProperty } from "./property";
|
|
13
|
-
import type { FxOrmCommon } from "./_common";
|
|
14
|
-
import { FxDbDriverNS } from "../../db-driver/index";
|
|
15
|
-
import type { FxSqlQueryComparator, FxSqlQueryChainBuilder } from '../../sql-query/Query';
|
|
16
|
-
export type { FxSqlAggregation, FxSqlQueryComparator, FxSqlQueryComparatorFunction, FxSqlQueryDialect, FxSqlQueryColumns, FxSqlQueryHelpler, FxSqlQueryChainBuilder, FxSqlQuery, FxSqlQuerySql, FxSqlQuerySubQuery, } from '../../sql-query/Query';
|
|
17
|
-
export declare namespace FxOrmNS {
|
|
18
|
-
type Model = FxOrmModel.Model;
|
|
19
|
-
type IChainFind = FxOrmQuery.IChainFind;
|
|
20
|
-
type Instance = FxOrmInstance.Instance;
|
|
21
|
-
type Hooks = FxOrmModel.Hooks;
|
|
22
|
-
type ModelOptions = FxOrmModel.ModelDefineOptions;
|
|
23
|
-
type ComplexModelPropertyDefinition = FxOrmModel.ComplexModelPropertyDefinition;
|
|
24
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
25
|
-
type PatchedSyncfiedModelOrInstance = FxOrmPatch.PatchedSyncfiedModelOrInstance;
|
|
26
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
27
|
-
type PatchedSyncfiedInstanceWithDbWriteOperation = FxOrmPatch.PatchedSyncfiedInstanceWithDbWriteOperation;
|
|
28
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
29
|
-
type PatchedSyncfiedInstanceWithAssociations = FxOrmPatch.PatchedSyncfiedInstanceWithAssociations;
|
|
30
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
31
|
-
type SettingInstance = FxOrmSettings.SettingInstance;
|
|
32
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
33
|
-
type ModelOptions__Find = FxOrmModel.ModelOptions__Find;
|
|
34
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
35
|
-
type ModelQueryConditions__Find = FxOrmModel.ModelQueryConditions__Find;
|
|
36
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
37
|
-
type ModelMethodCallback__Find = FxOrmModel.ModelMethodCallback__Find;
|
|
38
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
39
|
-
type ModelMethodCallback__Count = FxOrmModel.ModelMethodCallback__Count;
|
|
40
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
41
|
-
type InstanceDataPayload = FxOrmInstance.InstanceDataPayload;
|
|
42
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
43
|
-
type InstanceAssociationItem_HasMany = FxOrmAssociation.InstanceAssociationItem_HasMany;
|
|
44
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
45
|
-
type InstanceAssociationItem_HasOne = FxOrmAssociation.InstanceAssociationItem_HasOne;
|
|
46
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
47
|
-
type InstanceAssociationItem_ExtendTos = FxOrmAssociation.InstanceAssociationItem_ExtendTos;
|
|
48
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
49
|
-
type QueryConditionInTypeType = FxOrmQuery.QueryConditionInTypeType;
|
|
50
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
51
|
-
type QueryCondition_SimpleEq = FxOrmQuery.QueryCondition_SimpleEq;
|
|
52
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
53
|
-
type QueryCondition_eq = FxOrmQuery.QueryCondition_eq;
|
|
54
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
55
|
-
type QueryCondition_ne = FxOrmQuery.QueryCondition_ne;
|
|
56
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
57
|
-
type QueryCondition_gt = FxOrmQuery.QueryCondition_gt;
|
|
58
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
59
|
-
type QueryCondition_gte = FxOrmQuery.QueryCondition_gte;
|
|
60
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
61
|
-
type QueryCondition_lt = FxOrmQuery.QueryCondition_lt;
|
|
62
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
63
|
-
type QueryCondition_lte = FxOrmQuery.QueryCondition_lte;
|
|
64
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
65
|
-
type QueryCondition_like = FxOrmQuery.QueryCondition_like;
|
|
66
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
67
|
-
type QueryCondition_not_like = FxOrmQuery.QueryCondition_not_like;
|
|
68
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
69
|
-
type QueryCondition_between = FxOrmQuery.QueryCondition_between;
|
|
70
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
71
|
-
type QueryCondition_not_between = FxOrmQuery.QueryCondition_not_between;
|
|
72
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
73
|
-
type QueryCondition_in = FxOrmQuery.QueryCondition_in;
|
|
74
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
75
|
-
type QueryCondition_not_in = FxOrmQuery.QueryCondition_not_in;
|
|
76
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
77
|
-
type QueryConditionAtomicType = FxOrmQuery.QueryConditionAtomicType;
|
|
78
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
79
|
-
type QueryConditions = FxOrmQuery.QueryConditions;
|
|
80
|
-
interface ExtensibleError extends Error {
|
|
81
|
-
[extensibleProperty: string]: any;
|
|
82
|
-
}
|
|
83
|
-
interface FibORMIConnectionOptions extends FxDbDriverNS.ConnectionInputArgs {
|
|
84
|
-
timezone: string;
|
|
85
|
-
}
|
|
86
|
-
/** @deprecated would be deprecated >= 1.16.x */
|
|
87
|
-
type OrigAggreteGenerator = (...args: any[]) => FxOrmQuery.IAggregated;
|
|
88
|
-
interface FibOrmFindLikeQueryObject {
|
|
89
|
-
[key: string]: any;
|
|
90
|
-
}
|
|
91
|
-
interface FibOrmFixedModelInstanceFn {
|
|
92
|
-
(model: FxOrmModel.Model, opts: object): FxOrmInstance.Instance;
|
|
93
|
-
new (model: FxOrmModel.Model, opts: object): FxOrmInstance.Instance;
|
|
94
|
-
}
|
|
95
|
-
interface FibOrmPatchedSyncfiedInstantce extends FxOrmPatch.PatchedSyncfiedInstanceWithDbWriteOperation, FxOrmPatch.PatchedSyncfiedInstanceWithAssociations {
|
|
96
|
-
}
|
|
97
|
-
interface IChainFibORMFind extends FxOrmPatch.PatchedSyncfiedModelOrInstance, FxSqlQueryChainBuilder.ChainBuilder__Select {
|
|
98
|
-
only(args: string | string[]): IChainFibORMFind;
|
|
99
|
-
only(...args: string[]): IChainFibORMFind;
|
|
100
|
-
}
|
|
101
|
-
interface ModelAutoFetchOptions {
|
|
102
|
-
autoFetchLimit?: number;
|
|
103
|
-
autoFetch?: boolean;
|
|
104
|
-
}
|
|
105
|
-
interface InstanceAutoFetchOptions extends ModelAutoFetchOptions {
|
|
106
|
-
}
|
|
107
|
-
interface ModelExtendOptions {
|
|
108
|
-
}
|
|
109
|
-
interface InstanceExtendOptions extends ModelExtendOptions {
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Parameter Type Interfaces
|
|
113
|
-
**/
|
|
114
|
-
type FibOrmFixedModel = FxOrmModel.Model;
|
|
115
|
-
type FibOrmFixedModelInstance = FxOrmInstance.Instance;
|
|
116
|
-
interface PluginOptions {
|
|
117
|
-
[key: string]: any;
|
|
118
|
-
}
|
|
119
|
-
type PluginConstructFn<T2 = PluginOptions, T1 extends ORM = ORM> = (orm: T1, opts: T2) => Plugin;
|
|
120
|
-
interface Plugin {
|
|
121
|
-
beforeDefine?: {
|
|
122
|
-
(name?: string, properties?: Record<string, ComplexModelPropertyDefinition>, opts?: FxOrmModel.ModelDefineOptions): void;
|
|
123
|
-
};
|
|
124
|
-
define?: {
|
|
125
|
-
(model?: FxOrmModel.Model, orm?: ORM): void;
|
|
126
|
-
};
|
|
127
|
-
beforeHasOne?: {
|
|
128
|
-
(model?: FxOrmModel.Model, opts?: {
|
|
129
|
-
association_name?: string;
|
|
130
|
-
ext_model?: Model;
|
|
131
|
-
assoc_options?: FxOrmAssociation.AssociationDefinitionOptions_HasOne;
|
|
132
|
-
}): void;
|
|
133
|
-
};
|
|
134
|
-
beforeHasMany?: {
|
|
135
|
-
(model?: FxOrmModel.Model, opts?: {
|
|
136
|
-
association_name?: string;
|
|
137
|
-
ext_model?: Model;
|
|
138
|
-
assoc_props?: Record<string, FxOrmModel.ModelPropertyDefinition>;
|
|
139
|
-
assoc_options?: FxOrmAssociation.AssociationDefinitionOptions_HasMany;
|
|
140
|
-
}): void;
|
|
141
|
-
};
|
|
142
|
-
beforeExtendsTo?: {
|
|
143
|
-
(model?: FxOrmModel.Model, opts?: {
|
|
144
|
-
association_name?: string;
|
|
145
|
-
properties?: Record<string, FxOrmModel.ModelPropertyDefinition>;
|
|
146
|
-
assoc_options?: FxOrmAssociation.AssociationDefinitionOptions_ExtendsTo;
|
|
147
|
-
}): void;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* @description leave here for augmention on consumer of this package,
|
|
152
|
-
*
|
|
153
|
-
* all models declared here would be considered as memebers of `orm.models`, e.g.
|
|
154
|
-
*
|
|
155
|
-
* ```ts
|
|
156
|
-
* const User = orm.define('user', { ... });
|
|
157
|
-
*
|
|
158
|
-
* declare module '../index' {
|
|
159
|
-
* export namespace FxOrmNS {
|
|
160
|
-
* export GlobalModels {
|
|
161
|
-
* users: typeof User
|
|
162
|
-
* }
|
|
163
|
-
* }
|
|
164
|
-
* }
|
|
165
|
-
* ```
|
|
166
|
-
*/
|
|
167
|
-
interface GlobalModels {
|
|
168
|
-
[key: string]: FxOrmModel.Model;
|
|
169
|
-
}
|
|
170
|
-
interface ORMLike extends Class_EventEmitter {
|
|
171
|
-
use: {
|
|
172
|
-
(plugin: PluginConstructFn, options?: PluginOptions): ThisType<ORMLike>;
|
|
173
|
-
};
|
|
174
|
-
define: <T extends Record<string, FxOrmModel.ComplexModelPropertyDefinition>, U extends FxOrmModel.ModelDefineOptions<FxOrmModel.GetPropertiesType<T>>>(name: string, properties: T, opts?: U) => FxOrmModel.Model<FxOrmModel.GetPropertiesType<T>, Exclude<U['methods'], void>>;
|
|
175
|
-
sync(callback: FxOrmCommon.VoidCallback): this;
|
|
176
|
-
syncSync(): void;
|
|
177
|
-
load(file: string, callback: FxOrmCommon.VoidCallback): any;
|
|
178
|
-
driver?: FxOrmDMLDriver.DMLDriver;
|
|
179
|
-
models: GlobalModels;
|
|
180
|
-
[k: string]: any;
|
|
181
|
-
}
|
|
182
|
-
interface ORM extends ORMLike, FxOrmSynchronous.SynchronizedORMInstance {
|
|
183
|
-
validators: FxOrmValidators.ValidatorModules;
|
|
184
|
-
enforce: FibjsEnforce.ExportModule;
|
|
185
|
-
settings: FxOrmSettings.SettingInstance;
|
|
186
|
-
driver_name: string;
|
|
187
|
-
driver: FxOrmDMLDriver.DMLDriver;
|
|
188
|
-
comparators: FxSqlQueryComparator.ComparatorHash;
|
|
189
|
-
plugins: Plugin[];
|
|
190
|
-
customTypes: {
|
|
191
|
-
[key: string]: FxOrmProperty.CustomPropertyType;
|
|
192
|
-
};
|
|
193
|
-
defineType(name: string, type: FxOrmProperty.CustomPropertyType): this;
|
|
194
|
-
load(file: string, callback: FxOrmCommon.VoidCallback): any;
|
|
195
|
-
ping(callback: FxOrmCommon.VoidCallback): this;
|
|
196
|
-
close(callback: FxOrmCommon.VoidCallback): this;
|
|
197
|
-
sync(callback: FxOrmCommon.VoidCallback): this;
|
|
198
|
-
drop(callback: FxOrmCommon.VoidCallback): this;
|
|
199
|
-
begin: FxDbDriverNS.SQLDriver['begin'];
|
|
200
|
-
commit: FxDbDriverNS.SQLDriver['commit'];
|
|
201
|
-
rollback: FxDbDriverNS.SQLDriver['rollback'];
|
|
202
|
-
trans: FxDbDriverNS.SQLDriver['trans'];
|
|
203
|
-
[extraMember: string]: any;
|
|
204
|
-
}
|
|
205
|
-
interface SingletonOptions {
|
|
206
|
-
identityCache?: boolean;
|
|
207
|
-
saveCheck?: boolean;
|
|
208
|
-
}
|
|
209
|
-
interface IUseOptions {
|
|
210
|
-
query?: {
|
|
211
|
-
/**
|
|
212
|
-
* debug key from connection options or connction url's querystring
|
|
213
|
-
* @example query.debug: 'false'
|
|
214
|
-
* @example mysql://127.0.0.1:3306/schema?debug=true
|
|
215
|
-
*/
|
|
216
|
-
debug?: string;
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
interface SingletonModule {
|
|
220
|
-
modelClear: {
|
|
221
|
-
(model: FxOrmModel.Model, key?: string): SingletonModule;
|
|
222
|
-
};
|
|
223
|
-
clear: {
|
|
224
|
-
(key?: string): SingletonModule;
|
|
225
|
-
};
|
|
226
|
-
modelGet: {
|
|
227
|
-
<T = any>(model: FxOrmModel.Model, key: string, opts: SingletonOptions, reFetchSync: () => FxOrmInstance.Instance): FxOrmInstance.Instance;
|
|
228
|
-
};
|
|
229
|
-
get: {
|
|
230
|
-
<T = any>(key: string, opts: SingletonOptions, reFetchSync: () => FxOrmInstance.Instance): FxOrmInstance.Instance;
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
}
|
package/lib/orm/Typo/ORM.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/// <reference types="@fibjs/enforce" />
|
|
2
|
-
import type { FxOrmCommon } from "./_common";
|
|
3
|
-
import type { FxOrmNS } from "./ORM";
|
|
4
|
-
import type { FxOrmInstance } from "./instance";
|
|
5
|
-
import type { FxOrmModel } from "./model";
|
|
6
|
-
export declare namespace FxOrmValidators {
|
|
7
|
-
interface ValidatorModules {
|
|
8
|
-
required: FibjsEnforce.enforcementValidation;
|
|
9
|
-
notEmptyString: FibjsEnforce.enforcementValidation;
|
|
10
|
-
rangeNumber: FibjsEnforce.enforcementValidation;
|
|
11
|
-
rangeLength: FibjsEnforce.enforcementValidation;
|
|
12
|
-
insideList: FibjsEnforce.enforcementValidation;
|
|
13
|
-
outsideList: FibjsEnforce.enforcementValidation;
|
|
14
|
-
password: FibjsEnforce.enforcementValidation;
|
|
15
|
-
patterns: FibjsEnforce.enforcementsContainer;
|
|
16
|
-
equalToProperty(name: string, message?: string): FibjsEnforce.ValidationCallback;
|
|
17
|
-
unique(opts?: {
|
|
18
|
-
ignoreCase: boolean;
|
|
19
|
-
}, message?: string): FibjsEnforce.ValidationCallback;
|
|
20
|
-
}
|
|
21
|
-
interface IValidatorHash {
|
|
22
|
-
[validation: string]: FibjsEnforce.IValidator | FibjsEnforce.IValidator[];
|
|
23
|
-
}
|
|
24
|
-
interface ValidationCallback<T_THIS = any> extends FibjsEnforce.ValidationCallback {
|
|
25
|
-
(value: any, next: FxOrmCommon.NextCallback, thisArg?: T_THIS, contexts?: ValidatorContext): void;
|
|
26
|
-
}
|
|
27
|
-
interface ValidatorContext extends FibjsEnforce.ContextMap {
|
|
28
|
-
driver: FxOrmNS.ORM['driver'];
|
|
29
|
-
instance: FxOrmInstance.Instance;
|
|
30
|
-
model: FxOrmModel.Model;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/// <reference types="@fibjs/types" />
|
|
2
|
-
import { FxOrmCoreError } from "../../orm-core/index";
|
|
3
|
-
import { FxOrmError } from "./Error";
|
|
4
|
-
export declare namespace FxOrmCommon {
|
|
5
|
-
type IdType = string | number;
|
|
6
|
-
type Arraible<T> = T | T[];
|
|
7
|
-
interface VoidCallback<T_RESULT = any, T_THIS = any> {
|
|
8
|
-
(this: T_THIS, err?: FxOrmCoreError.ExtendedError | null): T_RESULT;
|
|
9
|
-
}
|
|
10
|
-
interface ExecutionCallback<T, T_RESULT = any, T_THIS = any> {
|
|
11
|
-
(this: T_THIS, err?: string | FxOrmError.ExtendedError | FxOrmError.ExtendedError[] | null, result?: T): T_RESULT;
|
|
12
|
-
}
|
|
13
|
-
interface GenericCallback<T, T_RESULT = any, T_THIS = any> {
|
|
14
|
-
(this: T_THIS, err: FxOrmError.ExtendedError | null, result?: T): T_RESULT;
|
|
15
|
-
}
|
|
16
|
-
interface NextCallback<ERR_T = string, T_RESULT = any, T_THIS = any> {
|
|
17
|
-
(this: T_THIS, err?: ERR_T): T_RESULT;
|
|
18
|
-
}
|
|
19
|
-
interface SuccessCallback<T> {
|
|
20
|
-
(result?: T): any;
|
|
21
|
-
}
|
|
22
|
-
interface ValidatorCallback {
|
|
23
|
-
(errors: Error[]): void;
|
|
24
|
-
}
|
|
25
|
-
type Nilable<T> = null | T;
|
|
26
|
-
interface ExposedResult<T = any> {
|
|
27
|
-
error: FxOrmError.ExtendedError;
|
|
28
|
-
result?: T;
|
|
29
|
-
}
|
|
30
|
-
interface SyncCallbackInputArags<T = any> {
|
|
31
|
-
callback?: ExecutionCallback<T>;
|
|
32
|
-
is_sync?: boolean;
|
|
33
|
-
}
|
|
34
|
-
interface ValueWaitor<T = any> {
|
|
35
|
-
evt?: Class_Event;
|
|
36
|
-
value: T;
|
|
37
|
-
}
|
|
38
|
-
}
|
package/lib/orm/Typo/_common.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|