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
package/lib/orm/Typo/assoc.d.ts
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import type { FxOrmHook } from "./hook";
|
|
2
|
-
import type { FxOrmModel } from "./model";
|
|
3
|
-
import type { FxOrmProperty } from "./property";
|
|
4
|
-
import type { FxOrmCommon } from "./_common";
|
|
5
|
-
import type { FxOrmInstance } from "./instance";
|
|
6
|
-
export declare namespace FxOrmAssociation {
|
|
7
|
-
type AssociationType = 'extendsTo' | 'hasOne' | 'hasMany';
|
|
8
|
-
/**
|
|
9
|
-
* @type.function: (model_name: string, idkey: string) => string
|
|
10
|
-
*
|
|
11
|
-
* @string.default: `{model_name}_${idkey}`
|
|
12
|
-
*/
|
|
13
|
-
type AssociationKeyComputation = ((model_name: string, idkey: string) => string) | string;
|
|
14
|
-
interface AssociationDefinitionOptions {
|
|
15
|
-
/**
|
|
16
|
-
* it's also accessor base for `extendsTo`, `hasOne`, `hasMany`,
|
|
17
|
-
*
|
|
18
|
-
* @notice fallback from `acessor` for `hasOne`, `hasMany`
|
|
19
|
-
*/
|
|
20
|
-
name?: string;
|
|
21
|
-
model?: FxOrmModel.Model;
|
|
22
|
-
field?: string | Record<string, FxOrmProperty.NormalizedProperty>;
|
|
23
|
-
__for_extension?: boolean;
|
|
24
|
-
required?: boolean;
|
|
25
|
-
reversed?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* accessor base for `hasOne`, `hasMany`
|
|
28
|
-
*/
|
|
29
|
-
accessor?: string;
|
|
30
|
-
/**
|
|
31
|
-
* accessor base for `hasOne`
|
|
32
|
-
*/
|
|
33
|
-
reverseAccessor?: string;
|
|
34
|
-
autoFetch?: boolean;
|
|
35
|
-
autoFetchLimit?: number;
|
|
36
|
-
getAccessor?: string;
|
|
37
|
-
setAccessor?: string;
|
|
38
|
-
hasAccessor?: string;
|
|
39
|
-
delAccessor?: string;
|
|
40
|
-
addAccessor?: string;
|
|
41
|
-
modelFindByAccessor?: string;
|
|
42
|
-
hooks?: InstanceAssociationItem['hooks'];
|
|
43
|
-
}
|
|
44
|
-
interface AssociationDefinitionOptions_ExtendsTo extends AssociationDefinitionOptions {
|
|
45
|
-
table?: string;
|
|
46
|
-
reverse?: string;
|
|
47
|
-
reverseHooks?: InstanceAssociationItem_HasOne['hooks'];
|
|
48
|
-
}
|
|
49
|
-
interface AssociationDefinitionOptions_HasOne extends AssociationDefinitionOptions {
|
|
50
|
-
reverse?: string;
|
|
51
|
-
reverseHooks?: InstanceAssociationItem_HasOne['hooks'];
|
|
52
|
-
}
|
|
53
|
-
interface AssociationDefinitionOptions_HasMany extends AssociationDefinitionOptions {
|
|
54
|
-
reverse?: string;
|
|
55
|
-
reverseHooks?: AssociationDefinitionOptions_HasMany['hooks'];
|
|
56
|
-
key?: boolean;
|
|
57
|
-
mergeId?: string | Record<string, FxOrmModel.ModelPropertyDefinition>;
|
|
58
|
-
mergeAssocId?: string | Record<string, FxOrmModel.ModelPropertyDefinition>;
|
|
59
|
-
reverseAssociation?: string;
|
|
60
|
-
hooks?: InstanceAssociationItem['hooks'] & {
|
|
61
|
-
beforeAdd?: FxOrmHook.HookActionWithCtxCallback<FxOrmInstance.Instance, __AssocHooksCtx>;
|
|
62
|
-
afterAdd?: FxOrmHook.HookRetOnlyPayloadCallback<FxOrmInstance.Instance, __AssocHooksCtx>;
|
|
63
|
-
/** @deprecated */
|
|
64
|
-
beforeSave?: {
|
|
65
|
-
(next?: FxOrmHook.HookActionNextor): void;
|
|
66
|
-
(extra: any, next?: FxOrmHook.HookActionNextor): void;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
mergeTable?: string;
|
|
70
|
-
association?: string;
|
|
71
|
-
getAccessor?: string;
|
|
72
|
-
setAccessor?: string;
|
|
73
|
-
hasAccessor?: string;
|
|
74
|
-
delAccessor?: string;
|
|
75
|
-
addAccessor?: string;
|
|
76
|
-
}
|
|
77
|
-
interface InstanceAssociationItemHooks {
|
|
78
|
-
beforeSet?: {
|
|
79
|
-
(func: FxOrmHook.HookActionCallback, opts?: FxOrmHook.HookPatchOptions & Record<string, any>): any;
|
|
80
|
-
};
|
|
81
|
-
afterSet?: {
|
|
82
|
-
(func: FxOrmHook.HookResultCallback, opts?: FxOrmHook.HookPatchOptions & Record<string, any>): any;
|
|
83
|
-
};
|
|
84
|
-
beforeRemove?: {
|
|
85
|
-
(func: FxOrmHook.HookActionCallback, opts?: FxOrmHook.HookPatchOptions & Record<string, any>): any;
|
|
86
|
-
};
|
|
87
|
-
afterRemove?: {
|
|
88
|
-
(func: FxOrmHook.HookResultCallback, opts?: FxOrmHook.HookPatchOptions & Record<string, any>): any;
|
|
89
|
-
};
|
|
90
|
-
beforeAdd?: {
|
|
91
|
-
(func: FxOrmHook.HookActionCallback, opts?: FxOrmHook.HookPatchOptions & Record<string, any>): any;
|
|
92
|
-
};
|
|
93
|
-
afterAdd?: {
|
|
94
|
-
(func: FxOrmHook.HookResultCallback, opts?: FxOrmHook.HookPatchOptions & Record<string, any>): any;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
/** @internal */
|
|
98
|
-
type __AssocHooksCtx = {
|
|
99
|
-
instance?: FxOrmInstance.Instance;
|
|
100
|
-
association?: FxOrmInstance.Instance;
|
|
101
|
-
associations?: (FxOrmInstance.Instance)[];
|
|
102
|
-
association_ids?: any[];
|
|
103
|
-
removeConditions?: Record<string, any>;
|
|
104
|
-
useChannel?: () => FxOrmHook.HookChannelResults<Function>;
|
|
105
|
-
$ref?: {
|
|
106
|
-
instance?: __AssocHooksCtx['instance'];
|
|
107
|
-
association?: __AssocHooksCtx['association'];
|
|
108
|
-
associations?: __AssocHooksCtx['associations'];
|
|
109
|
-
association_ids?: __AssocHooksCtx['association_ids'];
|
|
110
|
-
removeConditions?: __AssocHooksCtx['removeConditions'];
|
|
111
|
-
useChannel?: __AssocHooksCtx['useChannel'];
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
interface InstanceAssociationItem extends InstanceAssociationItemHooks {
|
|
115
|
-
name: string;
|
|
116
|
-
model: FxOrmModel.Model;
|
|
117
|
-
field: string | Record<string, FxOrmProperty.NormalizedProperty>;
|
|
118
|
-
hooks: {
|
|
119
|
-
beforeSet?: FxOrmCommon.Arraible<FxOrmHook.HookActionWithCtxCallback<FxOrmInstance.Instance, __AssocHooksCtx>>;
|
|
120
|
-
afterSet?: FxOrmCommon.Arraible<FxOrmHook.HookRetOnlyPayloadCallback<FxOrmInstance.Instance, __AssocHooksCtx>>;
|
|
121
|
-
beforeRemove?: FxOrmCommon.Arraible<FxOrmHook.HookActionWithCtxCallback<FxOrmInstance.Instance, __AssocHooksCtx>>;
|
|
122
|
-
afterRemove?: FxOrmCommon.Arraible<FxOrmHook.HookRetOnlyPayloadCallback<FxOrmInstance.Instance, __AssocHooksCtx>>;
|
|
123
|
-
[k: string]: FxOrmCommon.Arraible<FxOrmHook.HookActionWithCtxCallback<FxOrmInstance.Instance, __AssocHooksCtx> | FxOrmHook.HookRetOnlyPayloadCallback<FxOrmInstance.Instance, __AssocHooksCtx>>;
|
|
124
|
-
};
|
|
125
|
-
__for_extension?: boolean;
|
|
126
|
-
getAccessor: string;
|
|
127
|
-
getSyncAccessor: string;
|
|
128
|
-
setAccessor: string;
|
|
129
|
-
setSyncAccessor: string;
|
|
130
|
-
hasAccessor: string;
|
|
131
|
-
hasSyncAccessor: string;
|
|
132
|
-
delAccessor: string;
|
|
133
|
-
delSyncAccessor: string;
|
|
134
|
-
addAccessor?: string;
|
|
135
|
-
addSyncAccessor?: string;
|
|
136
|
-
modelFindByAccessor?: string;
|
|
137
|
-
modelFindBySyncAccessor?: string;
|
|
138
|
-
reversed?: boolean;
|
|
139
|
-
autoFetch: boolean;
|
|
140
|
-
autoFetchLimit: number;
|
|
141
|
-
mapsTo?: FxOrmModel.ModelPropertyDefinition['mapsTo'];
|
|
142
|
-
[k: string]: any;
|
|
143
|
-
}
|
|
144
|
-
type InstanceAssociatedInstance = FxOrmInstance.Instance;
|
|
145
|
-
interface InstanceAssociationItem_ExtendTos extends InstanceAssociationItem {
|
|
146
|
-
table: string;
|
|
147
|
-
reverse?: string;
|
|
148
|
-
modelFindByAccessor: string;
|
|
149
|
-
}
|
|
150
|
-
interface InstanceAssociationItem_HasOne extends InstanceAssociationItem {
|
|
151
|
-
field: Record<string, FxOrmProperty.NormalizedProperty>;
|
|
152
|
-
reverse?: string;
|
|
153
|
-
reverseHooks?: InstanceAssociationItem_HasOne['hooks'];
|
|
154
|
-
accessor?: string;
|
|
155
|
-
reverseAccessor?: string;
|
|
156
|
-
modelFindByAccessor: string;
|
|
157
|
-
required?: boolean;
|
|
158
|
-
__for_extension?: boolean;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @description information collected from code like:
|
|
162
|
-
*
|
|
163
|
-
* ```js
|
|
164
|
-
* Host.hasMany(Other, {
|
|
165
|
-
* mergeTable: 'merge_table',
|
|
166
|
-
* mergeId: ['host_id'], // optional,
|
|
167
|
-
* mergeAssocId: ['other_id']
|
|
168
|
-
* })
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
interface InstanceAssociationItem_HasMany extends InstanceAssociationItem {
|
|
172
|
-
props: Record<string, FxOrmProperty.NormalizedProperty>;
|
|
173
|
-
mergeTable: string;
|
|
174
|
-
/**
|
|
175
|
-
* @description associated properties linked to Host on merge table
|
|
176
|
-
*/
|
|
177
|
-
mergeId: Record<string, FxOrmProperty.NormalizedProperty>;
|
|
178
|
-
/**
|
|
179
|
-
* @description associated properties linked to Other on merge table
|
|
180
|
-
*/
|
|
181
|
-
mergeAssocId: Record<string, FxOrmProperty.NormalizedProperty>;
|
|
182
|
-
getAccessor: string;
|
|
183
|
-
setAccessor: string;
|
|
184
|
-
hasAccessor: string;
|
|
185
|
-
delAccessor: string;
|
|
186
|
-
addAccessor: string;
|
|
187
|
-
modelFindByAccessor?: string;
|
|
188
|
-
hooks: AssociationDefinitionOptions_HasMany['hooks'];
|
|
189
|
-
}
|
|
190
|
-
interface InstanceAssociationItemInformation {
|
|
191
|
-
changed: boolean;
|
|
192
|
-
value?: InstanceAssociatedInstance;
|
|
193
|
-
data?: InstanceAssociationItem;
|
|
194
|
-
}
|
|
195
|
-
interface ModelAssociationMethod__Options {
|
|
196
|
-
/** @deprecated use `extra_where` directly */
|
|
197
|
-
join_where?: FxOrmModel.ModelQueryConditions__Find;
|
|
198
|
-
/** @internal */
|
|
199
|
-
extra?: FxOrmModel.ModelOptions__Find['extra'];
|
|
200
|
-
/** @internal */
|
|
201
|
-
extra_info?: {
|
|
202
|
-
table: string;
|
|
203
|
-
id: FxOrmModel.Model['id'];
|
|
204
|
-
id_prop: string[];
|
|
205
|
-
assoc_prop: string[];
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
interface ModelAssociationMethod__FindOptions extends FxOrmModel.ModelOptions__Find, ModelAssociationMethod__Options {
|
|
209
|
-
}
|
|
210
|
-
interface ModelAssociationMethod__GetOptions extends FxOrmModel.ModelOptions__Find, ModelAssociationMethod__Options {
|
|
211
|
-
}
|
|
212
|
-
interface ModelAssociationMethod__FindByOptions extends FxOrmModel.ModelOptions__Findby, ModelAssociationMethod__Options {
|
|
213
|
-
}
|
|
214
|
-
interface AccessorOptions_has {
|
|
215
|
-
}
|
|
216
|
-
type AccessorOptions_get = FxOrmCommon.IdType | FxOrmModel.ModelQueryConditions__Find;
|
|
217
|
-
interface AutoFetchInstanceOptions {
|
|
218
|
-
autoFetch?: boolean;
|
|
219
|
-
autoFetchLimit?: number;
|
|
220
|
-
}
|
|
221
|
-
}
|
package/lib/orm/Typo/assoc.js
DELETED
package/lib/orm/Typo/hook.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { FxOrmCommon } from './_common';
|
|
2
|
-
import type { FxOrmInstance } from './instance';
|
|
3
|
-
export declare namespace FxOrmHook {
|
|
4
|
-
export interface HookActionNextor<TTHIS = FxOrmInstance.Instance> {
|
|
5
|
-
(this: TTHIS, err?: Error | null): any;
|
|
6
|
-
}
|
|
7
|
-
export interface HookActionCallback<TTHIS = FxOrmInstance.Instance> {
|
|
8
|
-
(this: TTHIS, next?: HookActionNextor<TTHIS>): any;
|
|
9
|
-
}
|
|
10
|
-
export interface HookActionWithCtxCallback<TTHIS = FxOrmInstance.Instance, TPayload extends Record<string, any> = Record<string, any>> {
|
|
11
|
-
(this: TTHIS, ctx?: TPayload, next?: HookActionNextor<TTHIS>): any;
|
|
12
|
-
}
|
|
13
|
-
export interface HookWait<CTX_SELF = FxOrmInstance.Instance, TNEXT_THIS = any> {
|
|
14
|
-
(self: CTX_SELF, hook: FxOrmCommon.Arraible<HookActionCallback | HookActionWithCtxCallback | FxOrmCommon.Arraible<HookActionCallback | HookActionWithCtxCallback>>, nextor: FxOrmCommon.GenericCallback<TNEXT_THIS>, ctx?: Record<string, any>): void;
|
|
15
|
-
}
|
|
16
|
-
export type HookResultCallback<TTHIS = FxOrmInstance.Instance> = ((this: TTHIS, success?: boolean) => any);
|
|
17
|
-
export type HookRetPayloadCallback<TTHIS = FxOrmInstance.Instance, TPAYLOAD = any, TResult = boolean> = (this: TTHIS, arg1?: TPAYLOAD, success?: TResult) => any;
|
|
18
|
-
export type HookRetOnlyPayloadCallback<TTHIS = FxOrmInstance.Instance, TPAYLOAD = any> = (this: TTHIS, arg1?: TPAYLOAD) => any;
|
|
19
|
-
export interface HookTrigger<CTX_SELF = FxOrmInstance.Instance, RESULT_TYPE = boolean> {
|
|
20
|
-
(self: CTX_SELF, cur: FxOrmCommon.Arraible<HookResultCallback | HookRetPayloadCallback>, _?: RESULT_TYPE, ...args: any): void;
|
|
21
|
-
}
|
|
22
|
-
export interface HookPatchOptions {
|
|
23
|
-
/**
|
|
24
|
-
* @default false
|
|
25
|
-
* 'prepend': prepend old oldhook to new hook
|
|
26
|
-
* 'append': append old oldhook to new hook
|
|
27
|
-
* undefined: overwrite oldhook
|
|
28
|
-
*/
|
|
29
|
-
oldhook?: 'prepend' | 'append' | 'initial' | 'overwrite' | undefined;
|
|
30
|
-
}
|
|
31
|
-
export interface HookChannel<FTYPE = Function> {
|
|
32
|
-
(name: string, handler: FTYPE): HookChannelResults;
|
|
33
|
-
(handler: FTYPE): HookChannelResults;
|
|
34
|
-
(name?: string): HookChannelResults;
|
|
35
|
-
}
|
|
36
|
-
type HookTuple<FTYPE = Function> = [FTYPE, (fn: FTYPE, ...args: any) => any];
|
|
37
|
-
export interface HookChannelResults<FTYPE = Function> extends HookTuple<FTYPE> {
|
|
38
|
-
run: (...args: any) => any;
|
|
39
|
-
set: (fn: Function, ...args: any) => any;
|
|
40
|
-
}
|
|
41
|
-
export {};
|
|
42
|
-
}
|
package/lib/orm/Typo/hook.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import type { FxOrmAssociation } from "./assoc";
|
|
2
|
-
import type { FxOrmDMLDriver } from "./DMLDriver";
|
|
3
|
-
import type { FxOrmHook } from "./hook";
|
|
4
|
-
import type { FxOrmModel } from "./model";
|
|
5
|
-
import type { FxOrmProperty } from "./property";
|
|
6
|
-
import type { FxOrmValidators } from "./Validators";
|
|
7
|
-
import type { FxOrmCommon } from "./_common";
|
|
8
|
-
import type { FxOrmError } from "./Error";
|
|
9
|
-
export declare namespace FxOrmInstance {
|
|
10
|
-
export interface InstanceDataPayload {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}
|
|
13
|
-
export interface CreateOptions {
|
|
14
|
-
autoFetch?: boolean;
|
|
15
|
-
autoFetchLimit?: number;
|
|
16
|
-
cascadeRemove?: boolean;
|
|
17
|
-
uid?: string;
|
|
18
|
-
isNew?: boolean;
|
|
19
|
-
isShell?: boolean;
|
|
20
|
-
autoSave?: boolean;
|
|
21
|
-
extra?: InstanceConstructorOptions['extra'];
|
|
22
|
-
extra_info?: InstanceConstructorOptions['extra_info'];
|
|
23
|
-
}
|
|
24
|
-
export interface SaveOptions {
|
|
25
|
-
saveAssociations?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface InstanceConstructorOptions {
|
|
28
|
-
table: string;
|
|
29
|
-
keys?: FxOrmModel.ModelConstructorOptions['keys'];
|
|
30
|
-
originalKeyValues?: InstanceDataPayload;
|
|
31
|
-
data?: InstanceDataPayload;
|
|
32
|
-
/**
|
|
33
|
-
* @description changes records
|
|
34
|
-
*/
|
|
35
|
-
changes?: string[];
|
|
36
|
-
extra?: string[] | Record<string, FxOrmProperty.NormalizedProperty>;
|
|
37
|
-
extra_info?: {
|
|
38
|
-
table: string;
|
|
39
|
-
id: string[];
|
|
40
|
-
id_prop: string[];
|
|
41
|
-
assoc_prop: string[];
|
|
42
|
-
};
|
|
43
|
-
isNew?: boolean;
|
|
44
|
-
isShell?: boolean;
|
|
45
|
-
autoSave?: FxOrmModel.ModelConstructorOptions['autoSave'];
|
|
46
|
-
methods?: FxOrmModel.ModelConstructorOptions['methods'];
|
|
47
|
-
/**
|
|
48
|
-
* @description all key properties of the instance, determined by the model
|
|
49
|
-
*/
|
|
50
|
-
keyProperties: FxOrmProperty.NormalizedProperty[];
|
|
51
|
-
validations: FxOrmValidators.IValidatorHash;
|
|
52
|
-
hooks: FxOrmModel.ModelConstructorOptions['hooks'];
|
|
53
|
-
one_associations: FxOrmAssociation.InstanceAssociationItem_HasOne[];
|
|
54
|
-
many_associations: FxOrmAssociation.InstanceAssociationItem_HasMany[];
|
|
55
|
-
extend_associations: FxOrmAssociation.InstanceAssociationItem_ExtendTos[];
|
|
56
|
-
association_properties: string[];
|
|
57
|
-
uid: FxOrmDMLDriver.DriverUidType;
|
|
58
|
-
driver: FxOrmDMLDriver.DMLDriver;
|
|
59
|
-
/**
|
|
60
|
-
* @internal
|
|
61
|
-
*/
|
|
62
|
-
__setupAssociations: (instance: Instance) => void;
|
|
63
|
-
fieldToPropertyMap: FxOrmProperty.FieldToPropertyMapType;
|
|
64
|
-
/**
|
|
65
|
-
* @internal
|
|
66
|
-
*/
|
|
67
|
-
events?: {
|
|
68
|
-
[k: string]: FxOrmCommon.GenericCallback<any>;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export interface InnerInstanceRuntimeData extends InstanceConstructorOptions {
|
|
72
|
-
associations?: {
|
|
73
|
-
[key: string]: FxOrmAssociation.InstanceAssociationItemInformation;
|
|
74
|
-
};
|
|
75
|
-
extrachanges: string[];
|
|
76
|
-
/** @internal */
|
|
77
|
-
__validationData: Record<string, FxOrmError.ExtendedError[]>;
|
|
78
|
-
}
|
|
79
|
-
type __AddThisToMethods<TMethods extends Record<string, (...args: any) => any>> = TMethods extends void ? {} : {
|
|
80
|
-
[P in keyof TMethods]: (...args: Parameters<TMethods[P]>) => ReturnType<TMethods[P]>;
|
|
81
|
-
};
|
|
82
|
-
export type InstanceConstructor = new (model: FxOrmModel.Model, opts: InstanceConstructorOptions) => FxOrmInstance.Instance;
|
|
83
|
-
export type InstanceEventType = 'ready' | 'save' | 'beforeRemove' | 'remove';
|
|
84
|
-
export type Instance<TProperties extends Record<string, FieldRuntimeType> = Record<string, FieldRuntimeType>, Methods extends Record<string, (...args: any) => any> = Record<string, (...args: any) => any>> = {
|
|
85
|
-
on(event: InstanceEventType | string, callback: FxOrmCommon.GenericCallback<any>): Instance;
|
|
86
|
-
$on: Class_EventEmitter['on'];
|
|
87
|
-
$off: Class_EventEmitter['off'];
|
|
88
|
-
$emit: Class_EventEmitter['emit'];
|
|
89
|
-
validate(callback: FxOrmCommon.ValidatorCallback): void;
|
|
90
|
-
validateSync(): false | FxOrmError.ExtendedError[];
|
|
91
|
-
save(callback?: FxOrmCommon.VoidCallback): Instance;
|
|
92
|
-
save(data: InstanceDataPayload, callback?: FxOrmCommon.VoidCallback): Instance;
|
|
93
|
-
save(data: InstanceDataPayload, options: SaveOptions, callback?: FxOrmCommon.VoidCallback): Instance;
|
|
94
|
-
saveSync(data?: FxOrmInstance.InstanceDataPayload, options?: FxOrmInstance.SaveOptions): FxOrmInstance.Instance;
|
|
95
|
-
saved(): boolean;
|
|
96
|
-
remove(callback?: FxOrmCommon.VoidCallback): Instance;
|
|
97
|
-
removeSync(): void;
|
|
98
|
-
/**
|
|
99
|
-
* @noenum
|
|
100
|
-
*/
|
|
101
|
-
isInstance: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* @noenum
|
|
104
|
-
*/
|
|
105
|
-
isPersisted(): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* @noenum
|
|
108
|
-
*/
|
|
109
|
-
isShell(): boolean;
|
|
110
|
-
/**
|
|
111
|
-
* @noenum
|
|
112
|
-
*/
|
|
113
|
-
set: (path: string | string[], value: any) => void;
|
|
114
|
-
markAsDirty: (propName: string) => void;
|
|
115
|
-
dirtyProperties: {
|
|
116
|
-
[key: string]: any;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* @internal
|
|
120
|
-
* @noenum
|
|
121
|
-
*/
|
|
122
|
-
__singleton_uid(): string | number;
|
|
123
|
-
/**
|
|
124
|
-
* @internal
|
|
125
|
-
* @noenum
|
|
126
|
-
*/
|
|
127
|
-
__instRtd?: InnerInstanceRuntimeData;
|
|
128
|
-
/**
|
|
129
|
-
* @noenum
|
|
130
|
-
*/
|
|
131
|
-
model(): FxOrmModel.Model<TProperties, Methods>;
|
|
132
|
-
/**
|
|
133
|
-
* @internal
|
|
134
|
-
*
|
|
135
|
-
* @warn only valid in corresponding hook
|
|
136
|
-
*/
|
|
137
|
-
readonly $hookRef: {
|
|
138
|
-
create: {
|
|
139
|
-
instance: Instance;
|
|
140
|
-
useChannel: FxOrmHook.HookChannel;
|
|
141
|
-
};
|
|
142
|
-
save: {
|
|
143
|
-
instance: Instance;
|
|
144
|
-
useChannel: FxOrmHook.HookChannel;
|
|
145
|
-
};
|
|
146
|
-
remove: {
|
|
147
|
-
instance: Instance;
|
|
148
|
-
useChannel: FxOrmHook.HookChannel;
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
} & TProperties & __AddThisToMethods<Methods> & {
|
|
152
|
-
[key: string]: any;
|
|
153
|
-
};
|
|
154
|
-
export type FieldRuntimeType = number | string | boolean | Date | object;
|
|
155
|
-
export {};
|
|
156
|
-
}
|
package/lib/orm/Typo/instance.js
DELETED
package/lib/orm/Typo/model.js
DELETED
package/lib/orm/Typo/patch.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare namespace FxOrmPatch {
|
|
2
|
-
interface PatchedSyncfiedModelOrInstance {
|
|
3
|
-
/**
|
|
4
|
-
* @important
|
|
5
|
-
*
|
|
6
|
-
* methods patchSyncfied by 'fib-orm'
|
|
7
|
-
*/
|
|
8
|
-
countSync: Function;
|
|
9
|
-
firstSync: Function;
|
|
10
|
-
lastSync: Function;
|
|
11
|
-
allSync: Function;
|
|
12
|
-
whereSync: Function;
|
|
13
|
-
findSync: Function;
|
|
14
|
-
removeSync: Function;
|
|
15
|
-
runSync: Function;
|
|
16
|
-
}
|
|
17
|
-
interface PatchedSyncfiedInstanceWithDbWriteOperation extends PatchedSyncfiedModelOrInstance {
|
|
18
|
-
saveSync: Function;
|
|
19
|
-
removeSync: Function;
|
|
20
|
-
validateSync: Function;
|
|
21
|
-
modelSync: Function;
|
|
22
|
-
}
|
|
23
|
-
interface PatchedSyncfiedInstanceWithAssociations {
|
|
24
|
-
/**
|
|
25
|
-
* generated by association, but you don't know what it is
|
|
26
|
-
*/
|
|
27
|
-
[associationFunc: string]: Function;
|
|
28
|
-
}
|
|
29
|
-
interface PatchedSyncfiedInstantce extends FxOrmPatch.PatchedSyncfiedInstanceWithDbWriteOperation, FxOrmPatch.PatchedSyncfiedInstanceWithAssociations {
|
|
30
|
-
}
|
|
31
|
-
}
|
package/lib/orm/Typo/patch.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { FxOrmSqlDDLSync__Driver } from "../../sql-ddl-sync/index";
|
|
2
|
-
import type { FxSqlQuery } from '../../sql-query/Query';
|
|
3
|
-
import type { IProperty } from "../../orm-property/index";
|
|
4
|
-
export declare namespace FxOrmProperty {
|
|
5
|
-
/**
|
|
6
|
-
* @description key linked association type
|
|
7
|
-
* - 'primary': means this property is for column defined as 'primary'
|
|
8
|
-
* - 'hasOne': means this property is for column used as asscociated key in 'hasOne' assciation
|
|
9
|
-
* - 'extendsTo': means this property is for column used as asscociated key in 'extendsTo' assciation
|
|
10
|
-
*/
|
|
11
|
-
type KlassType = 'primary' | 'hasOne' | 'extendsTo';
|
|
12
|
-
interface CustomPropertyType extends FxOrmSqlDDLSync__Driver.CustomPropertyType {
|
|
13
|
-
datastoreType: {
|
|
14
|
-
(prop?: FxOrmProperty.NormalizedProperty): string;
|
|
15
|
-
};
|
|
16
|
-
valueToProperty?: {
|
|
17
|
-
(value?: any, prop?: FxOrmProperty.NormalizedProperty): any;
|
|
18
|
-
};
|
|
19
|
-
propertyToValue?: {
|
|
20
|
-
(value?: any, prop?: FxOrmProperty.NormalizedProperty): any;
|
|
21
|
-
};
|
|
22
|
-
datastoreGet?: {
|
|
23
|
-
(prop?: FxOrmProperty.NormalizedProperty, helper?: FxSqlQuery.Class_Query): any;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
type DataStoreProperty = IProperty & {
|
|
27
|
-
type: PropertyType | keyof GlobalCustomModelType;
|
|
28
|
-
/**
|
|
29
|
-
* @description virtual property is not stored in database,
|
|
30
|
-
* but maybe presented in query result
|
|
31
|
-
*/
|
|
32
|
-
virtual?: boolean;
|
|
33
|
-
};
|
|
34
|
-
type PropertyType = 'text' | 'integer' | 'number' | 'serial' | 'boolean' | 'date' | 'binary' | 'object' | 'enum' | 'point';
|
|
35
|
-
/**
|
|
36
|
-
* @description used for augumenting model's properties type
|
|
37
|
-
*/
|
|
38
|
-
interface GlobalCustomModelType {
|
|
39
|
-
}
|
|
40
|
-
type GetPrimitiveFromOrmPropertyType<T extends PropertyType = PropertyType> = T extends 'text' ? string : T extends 'enum' ? any[] : T extends 'integer' | 'number' | 'serial' ? number : T extends 'boolean' ? boolean : T extends 'date' ? number | Date : T extends 'binary' | 'object' | 'point' ? any : never;
|
|
41
|
-
/**
|
|
42
|
-
* @description useful when pass property's option(such as type, big, ...etc) internally, useless for exposed api.
|
|
43
|
-
*
|
|
44
|
-
* @notice though there's definition, but those fields SHOULD NEVER be set in NormalizedProperty:
|
|
45
|
-
* - `serial`
|
|
46
|
-
*/
|
|
47
|
-
interface NormalizedProperty extends DataStoreProperty {
|
|
48
|
-
key?: boolean;
|
|
49
|
-
klass?: KlassType;
|
|
50
|
-
lazyload?: boolean;
|
|
51
|
-
alwaysValidate?: boolean;
|
|
52
|
-
lazyname?: string;
|
|
53
|
-
}
|
|
54
|
-
interface FieldToPropertyMapType {
|
|
55
|
-
[f_name: string]: NormalizedProperty;
|
|
56
|
-
}
|
|
57
|
-
}
|
package/lib/orm/Typo/property.js
DELETED