@uql/core 3.1.1 → 3.1.3
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/CHANGELOG.md +136 -185
- package/{dist/README.md → README.md} +22 -27
- package/dist/browser/cc-BEf4wTUm.js +535 -0
- package/dist/browser/cc-BEf4wTUm.js.map +1 -0
- package/dist/browser/http/bus.d.ts +1 -0
- package/dist/browser/http/bus.d.ts.map +1 -0
- package/dist/browser/http/bus.js +1 -1
- package/dist/browser/http/bus.js.map +1 -0
- package/dist/browser/http/http.d.ts +1 -0
- package/dist/browser/http/http.d.ts.map +1 -0
- package/dist/browser/http/http.js +1 -1
- package/dist/browser/http/http.js.map +1 -0
- package/dist/browser/http/index.d.ts +1 -0
- package/dist/browser/http/index.d.ts.map +1 -0
- package/dist/browser/http/index.js +1 -1
- package/dist/browser/http/index.js.map +1 -0
- package/dist/browser/index.d.ts +1 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/options.d.ts +1 -0
- package/dist/browser/options.d.ts.map +1 -0
- package/dist/browser/options.js +1 -1
- package/dist/browser/options.js.map +1 -0
- package/dist/browser/querier/genericClientRepository.d.ts +1 -0
- package/dist/browser/querier/genericClientRepository.d.ts.map +1 -0
- package/dist/browser/querier/genericClientRepository.js +1 -1
- package/dist/browser/querier/genericClientRepository.js.map +1 -0
- package/dist/browser/querier/httpQuerier.d.ts +1 -0
- package/dist/browser/querier/httpQuerier.d.ts.map +1 -0
- package/dist/browser/querier/httpQuerier.js +1 -1
- package/dist/browser/querier/httpQuerier.js.map +1 -0
- package/dist/browser/querier/index.d.ts +1 -0
- package/dist/browser/querier/index.d.ts.map +1 -0
- package/dist/browser/querier/index.js +1 -1
- package/dist/browser/querier/index.js.map +1 -0
- package/dist/browser/querier/querier.util.d.ts +1 -0
- package/dist/browser/querier/querier.util.d.ts.map +1 -0
- package/dist/browser/querier/querier.util.js +1 -1
- package/dist/browser/querier/querier.util.js.map +1 -0
- package/dist/browser/type/clientQuerier.d.ts +1 -0
- package/dist/browser/type/clientQuerier.d.ts.map +1 -0
- package/dist/browser/type/clientQuerier.js +1 -1
- package/dist/browser/type/clientQuerier.js.map +1 -0
- package/dist/browser/type/clientQuerierPool.d.ts +1 -0
- package/dist/browser/type/clientQuerierPool.d.ts.map +1 -0
- package/dist/browser/type/clientQuerierPool.js +1 -1
- package/dist/browser/type/clientQuerierPool.js.map +1 -0
- package/dist/browser/type/clientRepository.d.ts +1 -0
- package/dist/browser/type/clientRepository.d.ts.map +1 -0
- package/dist/browser/type/clientRepository.js +1 -1
- package/dist/browser/type/clientRepository.js.map +1 -0
- package/dist/browser/type/index.d.ts +1 -0
- package/dist/browser/type/index.d.ts.map +1 -0
- package/dist/browser/type/index.js +1 -1
- package/dist/browser/type/index.js.map +1 -0
- package/dist/browser/type/request.d.ts +1 -0
- package/dist/browser/type/request.d.ts.map +1 -0
- package/dist/browser/type/request.js +1 -1
- package/dist/browser/type/request.js.map +1 -0
- package/dist/dialect/abstractDialect.d.ts +1 -0
- package/dist/dialect/abstractDialect.d.ts.map +1 -0
- package/dist/dialect/abstractDialect.js +1 -1
- package/dist/dialect/abstractDialect.js.map +1 -0
- package/dist/dialect/abstractSqlDialect.d.ts +1 -0
- package/dist/dialect/abstractSqlDialect.d.ts.map +1 -0
- package/dist/dialect/abstractSqlDialect.js +1 -1
- package/dist/dialect/abstractSqlDialect.js.map +1 -0
- package/dist/dialect/index.d.ts +1 -0
- package/dist/dialect/index.d.ts.map +1 -0
- package/dist/dialect/index.js +1 -1
- package/dist/dialect/index.js.map +1 -0
- package/dist/dialect/queryContext.d.ts +1 -0
- package/dist/dialect/queryContext.d.ts.map +1 -0
- package/dist/dialect/queryContext.js +1 -1
- package/dist/dialect/queryContext.js.map +1 -0
- package/dist/entity/decorator/definition.d.ts +1 -0
- package/dist/entity/decorator/definition.d.ts.map +1 -0
- package/dist/entity/decorator/definition.js +1 -2
- package/dist/entity/decorator/definition.js.map +1 -0
- package/dist/entity/decorator/entity.d.ts +1 -0
- package/dist/entity/decorator/entity.d.ts.map +1 -0
- package/dist/entity/decorator/entity.js +1 -1
- package/dist/entity/decorator/entity.js.map +1 -0
- package/dist/entity/decorator/field.d.ts +1 -0
- package/dist/entity/decorator/field.d.ts.map +1 -0
- package/dist/entity/decorator/field.js +1 -1
- package/dist/entity/decorator/field.js.map +1 -0
- package/dist/entity/decorator/id.d.ts +1 -0
- package/dist/entity/decorator/id.d.ts.map +1 -0
- package/dist/entity/decorator/id.js +1 -1
- package/dist/entity/decorator/id.js.map +1 -0
- package/dist/entity/decorator/index.d.ts +1 -0
- package/dist/entity/decorator/index.d.ts.map +1 -0
- package/dist/entity/decorator/index.js +1 -1
- package/dist/entity/decorator/index.js.map +1 -0
- package/dist/entity/decorator/relation.d.ts +1 -0
- package/dist/entity/decorator/relation.d.ts.map +1 -0
- package/dist/entity/decorator/relation.js +1 -1
- package/dist/entity/decorator/relation.js.map +1 -0
- package/dist/entity/index.d.ts +1 -0
- package/dist/entity/index.d.ts.map +1 -0
- package/dist/entity/index.js +1 -1
- package/dist/entity/index.js.map +1 -0
- package/dist/express/index.d.ts +1 -0
- package/dist/express/index.d.ts.map +1 -0
- package/dist/express/index.js +1 -1
- package/dist/express/index.js.map +1 -0
- package/dist/express/querierMiddleware.d.ts +1 -0
- package/dist/express/querierMiddleware.d.ts.map +1 -0
- package/dist/express/querierMiddleware.js +1 -1
- package/dist/express/querierMiddleware.js.map +1 -0
- package/dist/express/query.util.d.ts +1 -0
- package/dist/express/query.util.d.ts.map +1 -0
- package/dist/express/query.util.js +1 -1
- package/dist/express/query.util.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -0
- package/dist/maria/index.d.ts +1 -0
- package/dist/maria/index.d.ts.map +1 -0
- package/dist/maria/index.js +1 -1
- package/dist/maria/index.js.map +1 -0
- package/dist/maria/mariaDialect.d.ts +1 -0
- package/dist/maria/mariaDialect.d.ts.map +1 -0
- package/dist/maria/mariaDialect.js +1 -1
- package/dist/maria/mariaDialect.js.map +1 -0
- package/dist/maria/mariadbQuerier.d.ts +1 -0
- package/dist/maria/mariadbQuerier.d.ts.map +1 -0
- package/dist/maria/mariadbQuerier.js +1 -1
- package/dist/maria/mariadbQuerier.js.map +1 -0
- package/dist/maria/mariadbQuerierPool.d.ts +1 -0
- package/dist/maria/mariadbQuerierPool.d.ts.map +1 -0
- package/dist/maria/mariadbQuerierPool.js +1 -1
- package/dist/maria/mariadbQuerierPool.js.map +1 -0
- package/dist/migrate/cli.d.ts +1 -0
- package/dist/migrate/cli.d.ts.map +1 -0
- package/dist/migrate/cli.js +3 -3
- package/dist/migrate/cli.js.map +1 -0
- package/dist/migrate/generator/index.d.ts +1 -0
- package/dist/migrate/generator/index.d.ts.map +1 -0
- package/dist/migrate/generator/index.js +1 -1
- package/dist/migrate/generator/index.js.map +1 -0
- package/dist/migrate/generator/mongoSchemaGenerator.d.ts +1 -0
- package/dist/migrate/generator/mongoSchemaGenerator.d.ts.map +1 -0
- package/dist/migrate/generator/mongoSchemaGenerator.js +1 -1
- package/dist/migrate/generator/mongoSchemaGenerator.js.map +1 -0
- package/dist/migrate/generator/mysqlSchemaGenerator.d.ts +1 -0
- package/dist/migrate/generator/mysqlSchemaGenerator.d.ts.map +1 -0
- package/dist/migrate/generator/mysqlSchemaGenerator.js +1 -1
- package/dist/migrate/generator/mysqlSchemaGenerator.js.map +1 -0
- package/dist/migrate/generator/postgresSchemaGenerator.d.ts +1 -0
- package/dist/migrate/generator/postgresSchemaGenerator.d.ts.map +1 -0
- package/dist/migrate/generator/postgresSchemaGenerator.js +1 -1
- package/dist/migrate/generator/postgresSchemaGenerator.js.map +1 -0
- package/dist/migrate/generator/sqliteSchemaGenerator.d.ts +1 -0
- package/dist/migrate/generator/sqliteSchemaGenerator.d.ts.map +1 -0
- package/dist/migrate/generator/sqliteSchemaGenerator.js +1 -1
- package/dist/migrate/generator/sqliteSchemaGenerator.js.map +1 -0
- package/dist/migrate/index.d.ts +1 -0
- package/dist/migrate/index.d.ts.map +1 -0
- package/dist/migrate/index.js +1 -1
- package/dist/migrate/index.js.map +1 -0
- package/dist/migrate/introspection/index.d.ts +1 -0
- package/dist/migrate/introspection/index.d.ts.map +1 -0
- package/dist/migrate/introspection/index.js +1 -1
- package/dist/migrate/introspection/index.js.map +1 -0
- package/dist/migrate/introspection/mongoIntrospector.d.ts +1 -0
- package/dist/migrate/introspection/mongoIntrospector.d.ts.map +1 -0
- package/dist/migrate/introspection/mongoIntrospector.js +1 -1
- package/dist/migrate/introspection/mongoIntrospector.js.map +1 -0
- package/dist/migrate/introspection/mysqlIntrospector.d.ts +1 -0
- package/dist/migrate/introspection/mysqlIntrospector.d.ts.map +1 -0
- package/dist/migrate/introspection/mysqlIntrospector.js +1 -1
- package/dist/migrate/introspection/mysqlIntrospector.js.map +1 -0
- package/dist/migrate/introspection/postgresIntrospector.d.ts +1 -0
- package/dist/migrate/introspection/postgresIntrospector.d.ts.map +1 -0
- package/dist/migrate/introspection/postgresIntrospector.js +1 -1
- package/dist/migrate/introspection/postgresIntrospector.js.map +1 -0
- package/dist/migrate/introspection/sqliteIntrospector.d.ts +1 -0
- package/dist/migrate/introspection/sqliteIntrospector.d.ts.map +1 -0
- package/dist/migrate/introspection/sqliteIntrospector.js +1 -1
- package/dist/migrate/introspection/sqliteIntrospector.js.map +1 -0
- package/dist/migrate/migrator.d.ts +1 -0
- package/dist/migrate/migrator.d.ts.map +1 -0
- package/dist/migrate/migrator.js +1 -1
- package/dist/migrate/migrator.js.map +1 -0
- package/dist/migrate/schemaGenerator.d.ts +1 -0
- package/dist/migrate/schemaGenerator.d.ts.map +1 -0
- package/dist/migrate/schemaGenerator.js +1 -1
- package/dist/migrate/schemaGenerator.js.map +1 -0
- package/dist/migrate/storage/databaseStorage.d.ts +1 -0
- package/dist/migrate/storage/databaseStorage.d.ts.map +1 -0
- package/dist/migrate/storage/databaseStorage.js +1 -1
- package/dist/migrate/storage/databaseStorage.js.map +1 -0
- package/dist/migrate/storage/index.d.ts +1 -0
- package/dist/migrate/storage/index.d.ts.map +1 -0
- package/dist/migrate/storage/index.js +1 -1
- package/dist/migrate/storage/index.js.map +1 -0
- package/dist/migrate/storage/jsonStorage.d.ts +1 -0
- package/dist/migrate/storage/jsonStorage.d.ts.map +1 -0
- package/dist/migrate/storage/jsonStorage.js +1 -1
- package/dist/migrate/storage/jsonStorage.js.map +1 -0
- package/dist/migrate/type.d.ts +1 -0
- package/dist/migrate/type.d.ts.map +1 -0
- package/dist/migrate/type.js +1 -1
- package/dist/migrate/type.js.map +1 -0
- package/dist/mongo/index.d.ts +1 -0
- package/dist/mongo/index.d.ts.map +1 -0
- package/dist/mongo/index.js +1 -1
- package/dist/mongo/index.js.map +1 -0
- package/dist/mongo/mongoDialect.d.ts +1 -0
- package/dist/mongo/mongoDialect.d.ts.map +1 -0
- package/dist/mongo/mongoDialect.js +1 -1
- package/dist/mongo/mongoDialect.js.map +1 -0
- package/dist/mongo/mongodbQuerier.d.ts +1 -0
- package/dist/mongo/mongodbQuerier.d.ts.map +1 -0
- package/dist/mongo/mongodbQuerier.js +1 -1
- package/dist/mongo/mongodbQuerier.js.map +1 -0
- package/dist/mongo/mongodbQuerierPool.d.ts +1 -0
- package/dist/mongo/mongodbQuerierPool.d.ts.map +1 -0
- package/dist/mongo/mongodbQuerierPool.js +1 -1
- package/dist/mongo/mongodbQuerierPool.js.map +1 -0
- package/dist/mysql/index.d.ts +1 -0
- package/dist/mysql/index.d.ts.map +1 -0
- package/dist/mysql/index.js +1 -1
- package/dist/mysql/index.js.map +1 -0
- package/dist/mysql/mysql2Querier.d.ts +1 -0
- package/dist/mysql/mysql2Querier.d.ts.map +1 -0
- package/dist/mysql/mysql2Querier.js +1 -1
- package/dist/mysql/mysql2Querier.js.map +1 -0
- package/dist/mysql/mysql2QuerierPool.d.ts +1 -0
- package/dist/mysql/mysql2QuerierPool.d.ts.map +1 -0
- package/dist/mysql/mysql2QuerierPool.js +1 -1
- package/dist/mysql/mysql2QuerierPool.js.map +1 -0
- package/dist/mysql/mysqlDialect.d.ts +1 -0
- package/dist/mysql/mysqlDialect.d.ts.map +1 -0
- package/dist/mysql/mysqlDialect.js +1 -1
- package/dist/mysql/mysqlDialect.js.map +1 -0
- package/dist/namingStrategy/defaultNamingStrategy.d.ts +1 -0
- package/dist/namingStrategy/defaultNamingStrategy.d.ts.map +1 -0
- package/dist/namingStrategy/defaultNamingStrategy.js +1 -1
- package/dist/namingStrategy/defaultNamingStrategy.js.map +1 -0
- package/dist/namingStrategy/index.d.ts +1 -0
- package/dist/namingStrategy/index.d.ts.map +1 -0
- package/dist/namingStrategy/index.js +1 -1
- package/dist/namingStrategy/index.js.map +1 -0
- package/dist/namingStrategy/snakeCaseNamingStrategy.d.ts +1 -0
- package/dist/namingStrategy/snakeCaseNamingStrategy.d.ts.map +1 -0
- package/dist/namingStrategy/snakeCaseNamingStrategy.js +1 -1
- package/dist/namingStrategy/snakeCaseNamingStrategy.js.map +1 -0
- package/dist/options.d.ts +1 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +1 -1
- package/dist/options.js.map +1 -0
- package/dist/postgres/index.d.ts +1 -0
- package/dist/postgres/index.d.ts.map +1 -0
- package/dist/postgres/index.js +1 -1
- package/dist/postgres/index.js.map +1 -0
- package/dist/postgres/pgQuerier.d.ts +1 -0
- package/dist/postgres/pgQuerier.d.ts.map +1 -0
- package/dist/postgres/pgQuerier.js +1 -1
- package/dist/postgres/pgQuerier.js.map +1 -0
- package/dist/postgres/pgQuerierPool.d.ts +1 -0
- package/dist/postgres/pgQuerierPool.d.ts.map +1 -0
- package/dist/postgres/pgQuerierPool.js +1 -1
- package/dist/postgres/pgQuerierPool.js.map +1 -0
- package/dist/postgres/postgresDialect.d.ts +1 -0
- package/dist/postgres/postgresDialect.d.ts.map +1 -0
- package/dist/postgres/postgresDialect.js +1 -1
- package/dist/postgres/postgresDialect.js.map +1 -0
- package/dist/querier/abstractQuerier.d.ts +1 -0
- package/dist/querier/abstractQuerier.d.ts.map +1 -0
- package/dist/querier/abstractQuerier.js +1 -1
- package/dist/querier/abstractQuerier.js.map +1 -0
- package/dist/querier/abstractQuerierPool.d.ts +1 -0
- package/dist/querier/abstractQuerierPool.d.ts.map +1 -0
- package/dist/querier/abstractQuerierPool.js +1 -1
- package/dist/querier/abstractQuerierPool.js.map +1 -0
- package/dist/querier/abstractSqlQuerier.d.ts +1 -0
- package/dist/querier/abstractSqlQuerier.d.ts.map +1 -0
- package/dist/querier/abstractSqlQuerier.js +1 -1
- package/dist/querier/abstractSqlQuerier.js.map +1 -0
- package/dist/querier/decorator/index.d.ts +1 -0
- package/dist/querier/decorator/index.d.ts.map +1 -0
- package/dist/querier/decorator/index.js +1 -1
- package/dist/querier/decorator/index.js.map +1 -0
- package/dist/querier/decorator/injectQuerier.d.ts +1 -0
- package/dist/querier/decorator/injectQuerier.d.ts.map +1 -0
- package/dist/querier/decorator/injectQuerier.js +1 -1
- package/dist/querier/decorator/injectQuerier.js.map +1 -0
- package/dist/querier/decorator/serialized.d.ts +1 -0
- package/dist/querier/decorator/serialized.d.ts.map +1 -0
- package/dist/querier/decorator/serialized.js +1 -1
- package/dist/querier/decorator/serialized.js.map +1 -0
- package/dist/querier/decorator/transactional.d.ts +1 -0
- package/dist/querier/decorator/transactional.d.ts.map +1 -0
- package/dist/querier/decorator/transactional.js +1 -1
- package/dist/querier/decorator/transactional.js.map +1 -0
- package/dist/querier/index.d.ts +1 -0
- package/dist/querier/index.d.ts.map +1 -0
- package/dist/querier/index.js +1 -1
- package/dist/querier/index.js.map +1 -0
- package/dist/repository/genericRepository.d.ts +1 -0
- package/dist/repository/genericRepository.d.ts.map +1 -0
- package/dist/repository/genericRepository.js +1 -1
- package/dist/repository/genericRepository.js.map +1 -0
- package/dist/repository/index.d.ts +1 -0
- package/dist/repository/index.d.ts.map +1 -0
- package/dist/repository/index.js +1 -1
- package/dist/repository/index.js.map +1 -0
- package/dist/sqlite/index.d.ts +1 -0
- package/dist/sqlite/index.d.ts.map +1 -0
- package/dist/sqlite/index.js +1 -1
- package/dist/sqlite/index.js.map +1 -0
- package/dist/sqlite/sqliteDialect.d.ts +1 -0
- package/dist/sqlite/sqliteDialect.d.ts.map +1 -0
- package/dist/sqlite/sqliteDialect.js +1 -1
- package/dist/sqlite/sqliteDialect.js.map +1 -0
- package/dist/sqlite/sqliteQuerier.d.ts +1 -0
- package/dist/sqlite/sqliteQuerier.d.ts.map +1 -0
- package/dist/sqlite/sqliteQuerier.js +1 -1
- package/dist/sqlite/sqliteQuerier.js.map +1 -0
- package/dist/sqlite/sqliteQuerierPool.d.ts +1 -0
- package/dist/sqlite/sqliteQuerierPool.d.ts.map +1 -0
- package/dist/sqlite/sqliteQuerierPool.js +1 -1
- package/dist/sqlite/sqliteQuerierPool.js.map +1 -0
- package/dist/type/entity.d.ts +1 -0
- package/dist/type/entity.d.ts.map +1 -0
- package/dist/type/entity.js +1 -1
- package/dist/type/entity.js.map +1 -0
- package/dist/type/index.d.ts +1 -0
- package/dist/type/index.d.ts.map +1 -0
- package/dist/type/index.js +1 -1
- package/dist/type/index.js.map +1 -0
- package/dist/type/migration.d.ts +1 -0
- package/dist/type/migration.d.ts.map +1 -0
- package/dist/type/migration.js +1 -1
- package/dist/type/migration.js.map +1 -0
- package/dist/type/namingStrategy.d.ts +1 -0
- package/dist/type/namingStrategy.d.ts.map +1 -0
- package/dist/type/namingStrategy.js +1 -1
- package/dist/type/namingStrategy.js.map +1 -0
- package/dist/type/querier.d.ts +1 -0
- package/dist/type/querier.d.ts.map +1 -0
- package/dist/type/querier.js +1 -1
- package/dist/type/querier.js.map +1 -0
- package/dist/type/querierPool.d.ts +1 -0
- package/dist/type/querierPool.d.ts.map +1 -0
- package/dist/type/querierPool.js +1 -1
- package/dist/type/querierPool.js.map +1 -0
- package/dist/type/query.d.ts +1 -0
- package/dist/type/query.d.ts.map +1 -0
- package/dist/type/query.js +1 -1
- package/dist/type/query.js.map +1 -0
- package/dist/type/repository.d.ts +1 -0
- package/dist/type/repository.d.ts.map +1 -0
- package/dist/type/repository.js +1 -1
- package/dist/type/repository.js.map +1 -0
- package/dist/type/universalQuerier.d.ts +1 -0
- package/dist/type/universalQuerier.d.ts.map +1 -0
- package/dist/type/universalQuerier.js +1 -1
- package/dist/type/universalQuerier.js.map +1 -0
- package/dist/type/utility.d.ts +1 -0
- package/dist/type/utility.d.ts.map +1 -0
- package/dist/type/utility.js +1 -1
- package/dist/type/utility.js.map +1 -0
- package/dist/util/dialect.util.d.ts +1 -0
- package/dist/util/dialect.util.d.ts.map +1 -0
- package/dist/util/dialect.util.js +1 -1
- package/dist/util/dialect.util.js.map +1 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +1 -1
- package/dist/util/index.js.map +1 -0
- package/dist/util/object.util.d.ts +1 -0
- package/dist/util/object.util.d.ts.map +1 -0
- package/dist/util/object.util.js +1 -1
- package/dist/util/object.util.js.map +1 -0
- package/dist/util/raw.d.ts +1 -0
- package/dist/util/raw.d.ts.map +1 -0
- package/dist/util/raw.js +1 -1
- package/dist/util/raw.js.map +1 -0
- package/dist/util/sql.util.d.ts +1 -0
- package/dist/util/sql.util.d.ts.map +1 -0
- package/dist/util/sql.util.js +1 -1
- package/dist/util/sql.util.js.map +1 -0
- package/dist/util/string.util.d.ts +1 -0
- package/dist/util/string.util.d.ts.map +1 -0
- package/dist/util/string.util.js +1 -1
- package/dist/util/string.util.js.map +1 -0
- package/package.json +32 -26
- package/dist/CHANGELOG.md +0 -186
- package/dist/maria/mariaQuerierPool.test.d.ts +0 -5
- package/dist/maria/mariaQuerierPool.test.js +0 -19
- package/dist/maria/mariadbQuerier.test.d.ts +0 -4
- package/dist/maria/mariadbQuerier.test.js +0 -19
- package/dist/migrate/migrator-mongo.test.d.ts +0 -1
- package/dist/migrate/migrator-mongo.test.js +0 -54
- package/dist/migrate/migrator.test.d.ts +0 -1
- package/dist/migrate/migrator.test.js +0 -106
- package/dist/mongo/mongodbQuerier.test.d.ts +0 -1
- package/dist/mongo/mongodbQuerier.test.js +0 -36
- package/dist/mongo/mongodbQuerierPool.test.d.ts +0 -1
- package/dist/mongo/mongodbQuerierPool.test.js +0 -21
- package/dist/mysql/mysql2Querier.test.d.ts +0 -4
- package/dist/mysql/mysql2Querier.test.js +0 -16
- package/dist/mysql/mysql2QuerierPool.test.d.ts +0 -5
- package/dist/mysql/mysql2QuerierPool.test.js +0 -16
- package/dist/package.json +0 -131
- package/dist/postgres/pgQuerier.test.d.ts +0 -4
- package/dist/postgres/pgQuerier.test.js +0 -20
- package/dist/postgres/pgQuerierPool.test.d.ts +0 -5
- package/dist/postgres/pgQuerierPool.test.js +0 -23
- package/dist/querier/abstractQuerier-test.d.ts +0 -45
- package/dist/querier/abstractQuerier-test.js +0 -461
- package/dist/querier/abstractQuerierPool-test.d.ts +0 -9
- package/dist/querier/abstractQuerierPool-test.js +0 -18
- package/dist/querier/abstractSqlQuerier-test.d.ts +0 -9
- package/dist/querier/abstractSqlQuerier-test.js +0 -16
- package/dist/sqlite/sqliteQuerier.test.d.ts +0 -5
- package/dist/sqlite/sqliteQuerier.test.js +0 -19
- package/dist/sqlite/sqliteQuerierPool.test.d.ts +0 -5
- package/dist/sqlite/sqliteQuerierPool.test.js +0 -10
- package/dist/test/entityMock.d.ts +0 -164
- package/dist/test/entityMock.js +0 -554
- package/dist/test/index.d.ts +0 -3
- package/dist/test/index.js +0 -4
- package/dist/test/it.util.d.ts +0 -4
- package/dist/test/it.util.js +0 -55
- package/dist/test/spec.util.d.ts +0 -14
- package/dist/test/spec.util.js +0 -50
- package/src/@types/index.d.ts +0 -1
- package/src/@types/jest.d.ts +0 -6
- package/src/browser/http/bus.spec.ts +0 -22
- package/src/browser/http/bus.ts +0 -17
- package/src/browser/http/http.spec.ts +0 -70
- package/src/browser/http/http.ts +0 -55
- package/src/browser/http/index.ts +0 -2
- package/src/browser/index.ts +0 -4
- package/src/browser/options.spec.ts +0 -37
- package/src/browser/options.ts +0 -18
- package/src/browser/querier/genericClientRepository.spec.ts +0 -105
- package/src/browser/querier/genericClientRepository.ts +0 -49
- package/src/browser/querier/httpQuerier.ts +0 -82
- package/src/browser/querier/index.ts +0 -3
- package/src/browser/querier/querier.util.spec.ts +0 -35
- package/src/browser/querier/querier.util.ts +0 -18
- package/src/browser/type/clientQuerier.ts +0 -45
- package/src/browser/type/clientQuerierPool.ts +0 -5
- package/src/browser/type/clientRepository.ts +0 -22
- package/src/browser/type/index.ts +0 -4
- package/src/browser/type/request.ts +0 -25
- package/src/dialect/abstractDialect.ts +0 -28
- package/src/dialect/abstractSqlDialect-spec.ts +0 -1309
- package/src/dialect/abstractSqlDialect.ts +0 -805
- package/src/dialect/index.ts +0 -3
- package/src/dialect/namingStrategy.spec.ts +0 -52
- package/src/dialect/queryContext.ts +0 -69
- package/src/entity/decorator/definition.spec.ts +0 -736
- package/src/entity/decorator/definition.ts +0 -265
- package/src/entity/decorator/entity.ts +0 -8
- package/src/entity/decorator/field.ts +0 -9
- package/src/entity/decorator/id.ts +0 -9
- package/src/entity/decorator/index.ts +0 -5
- package/src/entity/decorator/relation.spec.ts +0 -41
- package/src/entity/decorator/relation.ts +0 -34
- package/src/entity/index.ts +0 -1
- package/src/express/@types/express.d.ts +0 -8
- package/src/express/@types/index.d.ts +0 -1
- package/src/express/index.ts +0 -2
- package/src/express/querierMiddleware.ts +0 -217
- package/src/express/query.util.spec.ts +0 -40
- package/src/express/query.util.ts +0 -21
- package/src/index.ts +0 -9
- package/src/maria/index.ts +0 -3
- package/src/maria/mariaDialect.spec.ts +0 -207
- package/src/maria/mariaDialect.ts +0 -42
- package/src/maria/mariaQuerierPool.test.ts +0 -23
- package/src/maria/mariadbQuerier.test.ts +0 -23
- package/src/maria/mariadbQuerier.ts +0 -45
- package/src/maria/mariadbQuerierPool.ts +0 -21
- package/src/migrate/cli.ts +0 -301
- package/src/migrate/generator/index.ts +0 -4
- package/src/migrate/generator/mongoSchemaGenerator.spec.ts +0 -112
- package/src/migrate/generator/mongoSchemaGenerator.ts +0 -115
- package/src/migrate/generator/mysqlSchemaGenerator.spec.ts +0 -34
- package/src/migrate/generator/mysqlSchemaGenerator.ts +0 -92
- package/src/migrate/generator/postgresSchemaGenerator.spec.ts +0 -44
- package/src/migrate/generator/postgresSchemaGenerator.ts +0 -127
- package/src/migrate/generator/sqliteSchemaGenerator.spec.ts +0 -33
- package/src/migrate/generator/sqliteSchemaGenerator.ts +0 -81
- package/src/migrate/index.ts +0 -41
- package/src/migrate/introspection/index.ts +0 -4
- package/src/migrate/introspection/mongoIntrospector.spec.ts +0 -75
- package/src/migrate/introspection/mongoIntrospector.ts +0 -47
- package/src/migrate/introspection/mysqlIntrospector.spec.ts +0 -113
- package/src/migrate/introspection/mysqlIntrospector.ts +0 -278
- package/src/migrate/introspection/postgresIntrospector.spec.ts +0 -112
- package/src/migrate/introspection/postgresIntrospector.ts +0 -329
- package/src/migrate/introspection/sqliteIntrospector.spec.ts +0 -112
- package/src/migrate/introspection/sqliteIntrospector.ts +0 -296
- package/src/migrate/migrator-mongo.test.ts +0 -54
- package/src/migrate/migrator.spec.ts +0 -255
- package/src/migrate/migrator.test.ts +0 -94
- package/src/migrate/migrator.ts +0 -719
- package/src/migrate/namingStrategy.spec.ts +0 -22
- package/src/migrate/schemaGenerator-advanced.spec.ts +0 -138
- package/src/migrate/schemaGenerator.spec.ts +0 -190
- package/src/migrate/schemaGenerator.ts +0 -478
- package/src/migrate/storage/databaseStorage.spec.ts +0 -69
- package/src/migrate/storage/databaseStorage.ts +0 -100
- package/src/migrate/storage/index.ts +0 -2
- package/src/migrate/storage/jsonStorage.ts +0 -58
- package/src/migrate/type.ts +0 -1
- package/src/mongo/index.ts +0 -3
- package/src/mongo/mongoDialect.spec.ts +0 -251
- package/src/mongo/mongoDialect.ts +0 -238
- package/src/mongo/mongodbQuerier.test.ts +0 -45
- package/src/mongo/mongodbQuerier.ts +0 -256
- package/src/mongo/mongodbQuerierPool.test.ts +0 -25
- package/src/mongo/mongodbQuerierPool.ts +0 -24
- package/src/mysql/index.ts +0 -3
- package/src/mysql/mysql2Querier.test.ts +0 -20
- package/src/mysql/mysql2Querier.ts +0 -49
- package/src/mysql/mysql2QuerierPool.test.ts +0 -20
- package/src/mysql/mysql2QuerierPool.ts +0 -21
- package/src/mysql/mysqlDialect.spec.ts +0 -20
- package/src/mysql/mysqlDialect.ts +0 -16
- package/src/namingStrategy/defaultNamingStrategy.ts +0 -18
- package/src/namingStrategy/index.spec.ts +0 -36
- package/src/namingStrategy/index.ts +0 -2
- package/src/namingStrategy/snakeCaseNamingStrategy.ts +0 -15
- package/src/options.spec.ts +0 -41
- package/src/options.ts +0 -18
- package/src/postgres/index.ts +0 -3
- package/src/postgres/manual-types.d.ts +0 -4
- package/src/postgres/pgQuerier.test.ts +0 -25
- package/src/postgres/pgQuerier.ts +0 -45
- package/src/postgres/pgQuerierPool.test.ts +0 -28
- package/src/postgres/pgQuerierPool.ts +0 -21
- package/src/postgres/postgresDialect.spec.ts +0 -428
- package/src/postgres/postgresDialect.ts +0 -144
- package/src/querier/abstractQuerier-test.ts +0 -584
- package/src/querier/abstractQuerier.ts +0 -353
- package/src/querier/abstractQuerierPool-test.ts +0 -20
- package/src/querier/abstractQuerierPool.ts +0 -18
- package/src/querier/abstractSqlQuerier-spec.ts +0 -979
- package/src/querier/abstractSqlQuerier-test.ts +0 -21
- package/src/querier/abstractSqlQuerier.ts +0 -138
- package/src/querier/decorator/index.ts +0 -3
- package/src/querier/decorator/injectQuerier.spec.ts +0 -74
- package/src/querier/decorator/injectQuerier.ts +0 -45
- package/src/querier/decorator/serialized.spec.ts +0 -98
- package/src/querier/decorator/serialized.ts +0 -13
- package/src/querier/decorator/transactional.spec.ts +0 -240
- package/src/querier/decorator/transactional.ts +0 -56
- package/src/querier/index.ts +0 -4
- package/src/repository/genericRepository.spec.ts +0 -111
- package/src/repository/genericRepository.ts +0 -74
- package/src/repository/index.ts +0 -1
- package/src/sqlite/index.ts +0 -3
- package/src/sqlite/manual-types.d.ts +0 -4
- package/src/sqlite/sqliteDialect.spec.ts +0 -155
- package/src/sqlite/sqliteDialect.ts +0 -76
- package/src/sqlite/sqliteQuerier.spec.ts +0 -36
- package/src/sqlite/sqliteQuerier.test.ts +0 -21
- package/src/sqlite/sqliteQuerier.ts +0 -37
- package/src/sqlite/sqliteQuerierPool.test.ts +0 -12
- package/src/sqlite/sqliteQuerierPool.ts +0 -38
- package/src/test/entityMock.ts +0 -375
- package/src/test/index.ts +0 -3
- package/src/test/it.util.ts +0 -69
- package/src/test/spec.util.ts +0 -57
- package/src/type/entity.ts +0 -218
- package/src/type/index.ts +0 -9
- package/src/type/migration.ts +0 -241
- package/src/type/namingStrategy.ts +0 -17
- package/src/type/querier.ts +0 -143
- package/src/type/querierPool.ts +0 -26
- package/src/type/query.ts +0 -506
- package/src/type/repository.ts +0 -142
- package/src/type/universalQuerier.ts +0 -133
- package/src/type/utility.ts +0 -21
- package/src/util/dialect.util-extra.spec.ts +0 -96
- package/src/util/dialect.util.spec.ts +0 -23
- package/src/util/dialect.util.ts +0 -134
- package/src/util/index.ts +0 -5
- package/src/util/object.util.spec.ts +0 -29
- package/src/util/object.util.ts +0 -27
- package/src/util/raw.ts +0 -11
- package/src/util/sql.util-extra.spec.ts +0 -17
- package/src/util/sql.util.spec.ts +0 -208
- package/src/util/sql.util.ts +0 -104
- package/src/util/string.util.spec.ts +0 -46
- package/src/util/string.util.ts +0 -35
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -8
package/dist/test/spec.util.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="bun-types" resolution-mode="require"/>
|
|
2
|
-
import { afterAll, afterEach, beforeAll, beforeEach } from 'bun:test';
|
|
3
|
-
export declare function createSpec<T extends Spec>(spec: T): void;
|
|
4
|
-
declare const hooks: {
|
|
5
|
-
readonly beforeAll: typeof beforeAll;
|
|
6
|
-
readonly beforeEach: typeof beforeEach;
|
|
7
|
-
readonly afterEach: typeof afterEach;
|
|
8
|
-
readonly afterAll: typeof afterAll;
|
|
9
|
-
};
|
|
10
|
-
type SpecHooks = Partial<typeof hooks>;
|
|
11
|
-
export type Spec = SpecHooks & {
|
|
12
|
-
readonly [k: string]: (() => void | Promise<void>) | any;
|
|
13
|
-
};
|
|
14
|
-
export {};
|
package/dist/test/spec.util.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { afterAll, afterEach, beforeAll, beforeEach, describe, it } from 'bun:test';
|
|
2
|
-
export function createSpec(spec) {
|
|
3
|
-
const proto = Object.getPrototypeOf(spec);
|
|
4
|
-
let describeFn;
|
|
5
|
-
const specName = proto.constructor.name;
|
|
6
|
-
if (specName.startsWith('fff')) {
|
|
7
|
-
describeFn = describe.only;
|
|
8
|
-
}
|
|
9
|
-
else if (specName.startsWith('xxx')) {
|
|
10
|
-
describeFn = describe.skip;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
describeFn = describe;
|
|
14
|
-
}
|
|
15
|
-
describeFn(specName, () => createTestCases(spec));
|
|
16
|
-
}
|
|
17
|
-
function createTestCases(spec) {
|
|
18
|
-
let proto = Object.getPrototypeOf(spec);
|
|
19
|
-
const processedMethodsMap = {};
|
|
20
|
-
while (proto.constructor !== Object) {
|
|
21
|
-
for (const key of Object.getOwnPropertyNames(proto)) {
|
|
22
|
-
const isProcessed = processedMethodsMap[key];
|
|
23
|
-
processedMethodsMap[key] = true;
|
|
24
|
-
if (isProcessed || key === 'constructor' || typeof spec[key] !== 'function') {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
const callback = spec[key].bind(spec);
|
|
28
|
-
if (hooks[key]) {
|
|
29
|
-
hooks[key](callback);
|
|
30
|
-
}
|
|
31
|
-
else if (key.startsWith('should')) {
|
|
32
|
-
it(key, callback);
|
|
33
|
-
}
|
|
34
|
-
else if (key.startsWith('fffShould')) {
|
|
35
|
-
it.only(key, callback);
|
|
36
|
-
}
|
|
37
|
-
else if (key.startsWith('xxxShould')) {
|
|
38
|
-
it.skip(key, callback);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
proto = Object.getPrototypeOf(proto);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const hooks = {
|
|
45
|
-
beforeAll,
|
|
46
|
-
beforeEach,
|
|
47
|
-
afterEach,
|
|
48
|
-
afterAll,
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3BlYy51dGlsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3Qvc3BlYy51dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxRQUFRLEVBQUUsU0FBUyxFQUFFLFNBQVMsRUFBRSxVQUFVLEVBQUUsUUFBUSxFQUFFLEVBQUUsRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUVwRixNQUFNLFVBQVUsVUFBVSxDQUFpQixJQUFPO0lBQ2hELE1BQU0sS0FBSyxHQUF3QixNQUFNLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQy9ELElBQUksVUFBMkIsQ0FBQztJQUNoQyxNQUFNLFFBQVEsR0FBRyxLQUFLLENBQUMsV0FBVyxDQUFDLElBQUksQ0FBQztJQUV4QyxJQUFJLFFBQVEsQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQztRQUMvQixVQUFVLEdBQUcsUUFBUSxDQUFDLElBQUksQ0FBQztJQUM3QixDQUFDO1NBQU0sSUFBSSxRQUFRLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxFQUFFLENBQUM7UUFDdEMsVUFBVSxHQUFHLFFBQVEsQ0FBQyxJQUFJLENBQUM7SUFDN0IsQ0FBQztTQUFNLENBQUM7UUFDTixVQUFVLEdBQUcsUUFBUSxDQUFDO0lBQ3hCLENBQUM7SUFFRCxVQUFVLENBQUMsUUFBUSxFQUFFLEdBQUcsRUFBRSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO0FBQ3BELENBQUM7QUFFRCxTQUFTLGVBQWUsQ0FBQyxJQUFZO0lBQ25DLElBQUksS0FBSyxHQUF3QixNQUFNLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBRTdELE1BQU0sbUJBQW1CLEdBQTBCLEVBQUUsQ0FBQztJQUV0RCxPQUFPLEtBQUssQ0FBQyxXQUFXLEtBQUssTUFBTSxFQUFFLENBQUM7UUFDcEMsS0FBSyxNQUFNLEdBQUcsSUFBSSxNQUFNLENBQUMsbUJBQW1CLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQztZQUNwRCxNQUFNLFdBQVcsR0FBRyxtQkFBbUIsQ0FBQyxHQUFHLENBQUMsQ0FBQztZQUM3QyxtQkFBbUIsQ0FBQyxHQUFHLENBQUMsR0FBRyxJQUFJLENBQUM7WUFDaEMsSUFBSSxXQUFXLElBQUksR0FBRyxLQUFLLGFBQWEsSUFBSSxPQUFPLElBQUksQ0FBQyxHQUFHLENBQUMsS0FBSyxVQUFVLEVBQUUsQ0FBQztnQkFDNUUsU0FBUztZQUNYLENBQUM7WUFDRCxNQUFNLFFBQVEsR0FBK0IsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUNsRSxJQUFJLEtBQUssQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDO2dCQUNmLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQyxRQUFRLENBQUMsQ0FBQztZQUN2QixDQUFDO2lCQUFNLElBQUksR0FBRyxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsRUFBRSxDQUFDO2dCQUNwQyxFQUFFLENBQUMsR0FBRyxFQUFFLFFBQVEsQ0FBQyxDQUFDO1lBQ3BCLENBQUM7aUJBQU0sSUFBSSxHQUFHLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyxFQUFFLENBQUM7Z0JBQ3ZDLEVBQUUsQ0FBQyxJQUFJLENBQUMsR0FBRyxFQUFFLFFBQVEsQ0FBQyxDQUFDO1lBQ3pCLENBQUM7aUJBQU0sSUFBSSxHQUFHLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyxFQUFFLENBQUM7Z0JBQ3ZDLEVBQUUsQ0FBQyxJQUFJLENBQUMsR0FBRyxFQUFFLFFBQVEsQ0FBQyxDQUFDO1lBQ3pCLENBQUM7UUFDSCxDQUFDO1FBQ0QsS0FBSyxHQUFHLE1BQU0sQ0FBQyxjQUFjLENBQUMsS0FBSyxDQUFDLENBQUM7SUFDdkMsQ0FBQztBQUNILENBQUM7QUFFRCxNQUFNLEtBQUssR0FBRztJQUNaLFNBQVM7SUFDVCxVQUFVO0lBQ1YsU0FBUztJQUNULFFBQVE7Q0FDQSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgYWZ0ZXJBbGwsIGFmdGVyRWFjaCwgYmVmb3JlQWxsLCBiZWZvcmVFYWNoLCBkZXNjcmliZSwgaXQgfSBmcm9tICdidW46dGVzdCc7XG5cbmV4cG9ydCBmdW5jdGlvbiBjcmVhdGVTcGVjPFQgZXh0ZW5kcyBTcGVjPihzcGVjOiBUKSB7XG4gIGNvbnN0IHByb3RvOiBGdW5jdGlvbkNvbnN0cnVjdG9yID0gT2JqZWN0LmdldFByb3RvdHlwZU9mKHNwZWMpO1xuICBsZXQgZGVzY3JpYmVGbjogdHlwZW9mIGRlc2NyaWJlO1xuICBjb25zdCBzcGVjTmFtZSA9IHByb3RvLmNvbnN0cnVjdG9yLm5hbWU7XG5cbiAgaWYgKHNwZWNOYW1lLnN0YXJ0c1dpdGgoJ2ZmZicpKSB7XG4gICAgZGVzY3JpYmVGbiA9IGRlc2NyaWJlLm9ubHk7XG4gIH0gZWxzZSBpZiAoc3BlY05hbWUuc3RhcnRzV2l0aCgneHh4JykpIHtcbiAgICBkZXNjcmliZUZuID0gZGVzY3JpYmUuc2tpcDtcbiAgfSBlbHNlIHtcbiAgICBkZXNjcmliZUZuID0gZGVzY3JpYmU7XG4gIH1cblxuICBkZXNjcmliZUZuKHNwZWNOYW1lLCAoKSA9PiBjcmVhdGVUZXN0Q2FzZXMoc3BlYykpO1xufVxuXG5mdW5jdGlvbiBjcmVhdGVUZXN0Q2FzZXMoc3BlYzogb2JqZWN0KSB7XG4gIGxldCBwcm90bzogRnVuY3Rpb25Db25zdHJ1Y3RvciA9IE9iamVjdC5nZXRQcm90b3R5cGVPZihzcGVjKTtcblxuICBjb25zdCBwcm9jZXNzZWRNZXRob2RzTWFwOiB7IFtrOiBzdHJpbmddOiB0cnVlIH0gPSB7fTtcblxuICB3aGlsZSAocHJvdG8uY29uc3RydWN0b3IgIT09IE9iamVjdCkge1xuICAgIGZvciAoY29uc3Qga2V5IG9mIE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHByb3RvKSkge1xuICAgICAgY29uc3QgaXNQcm9jZXNzZWQgPSBwcm9jZXNzZWRNZXRob2RzTWFwW2tleV07XG4gICAgICBwcm9jZXNzZWRNZXRob2RzTWFwW2tleV0gPSB0cnVlO1xuICAgICAgaWYgKGlzUHJvY2Vzc2VkIHx8IGtleSA9PT0gJ2NvbnN0cnVjdG9yJyB8fCB0eXBlb2Ygc3BlY1trZXldICE9PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgIGNvbnRpbnVlO1xuICAgICAgfVxuICAgICAgY29uc3QgY2FsbGJhY2s6ICgpID0+IHZvaWQgfCBQcm9taXNlPHZvaWQ+ID0gc3BlY1trZXldLmJpbmQoc3BlYyk7XG4gICAgICBpZiAoaG9va3Nba2V5XSkge1xuICAgICAgICBob29rc1trZXldKGNhbGxiYWNrKTtcbiAgICAgIH0gZWxzZSBpZiAoa2V5LnN0YXJ0c1dpdGgoJ3Nob3VsZCcpKSB7XG4gICAgICAgIGl0KGtleSwgY2FsbGJhY2spO1xuICAgICAgfSBlbHNlIGlmIChrZXkuc3RhcnRzV2l0aCgnZmZmU2hvdWxkJykpIHtcbiAgICAgICAgaXQub25seShrZXksIGNhbGxiYWNrKTtcbiAgICAgIH0gZWxzZSBpZiAoa2V5LnN0YXJ0c1dpdGgoJ3h4eFNob3VsZCcpKSB7XG4gICAgICAgIGl0LnNraXAoa2V5LCBjYWxsYmFjayk7XG4gICAgICB9XG4gICAgfVxuICAgIHByb3RvID0gT2JqZWN0LmdldFByb3RvdHlwZU9mKHByb3RvKTtcbiAgfVxufVxuXG5jb25zdCBob29rcyA9IHtcbiAgYmVmb3JlQWxsLFxuICBiZWZvcmVFYWNoLFxuICBhZnRlckVhY2gsXG4gIGFmdGVyQWxsLFxufSBhcyBjb25zdDtcblxudHlwZSBTcGVjSG9va3MgPSBQYXJ0aWFsPHR5cGVvZiBob29rcz47XG5cbmV4cG9ydCB0eXBlIFNwZWMgPSBTcGVjSG9va3MgJiB7XG4gIHJlYWRvbmx5IFtrOiBzdHJpbmddOiAoKCkgPT4gdm9pZCB8IFByb21pc2U8dm9pZD4pIHwgYW55O1xufTtcbiJdfQ==
|
package/src/@types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './jest';
|
package/src/@types/jest.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { expect, it } from 'bun:test';
|
|
2
|
-
import type { RequestNotification } from '../type/index.js';
|
|
3
|
-
import { notify, on } from './bus.js';
|
|
4
|
-
|
|
5
|
-
it('bus', () => {
|
|
6
|
-
const off = on((msg) => {
|
|
7
|
-
const expected: RequestNotification = {
|
|
8
|
-
phase: 'start',
|
|
9
|
-
opts: {
|
|
10
|
-
silent: true,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
expect(msg).toEqual(expected);
|
|
14
|
-
off();
|
|
15
|
-
});
|
|
16
|
-
notify({
|
|
17
|
-
phase: 'start',
|
|
18
|
-
opts: {
|
|
19
|
-
silent: true,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
});
|
package/src/browser/http/bus.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { RequestCallback, RequestNotification } from '../type/index.js';
|
|
2
|
-
|
|
3
|
-
const subscriptors: RequestCallback[] = [];
|
|
4
|
-
|
|
5
|
-
export function notify(notification: RequestNotification): void {
|
|
6
|
-
for (const subscriptor of subscriptors) {
|
|
7
|
-
subscriptor(notification);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function on(cb: RequestCallback): () => void {
|
|
12
|
-
subscriptors.push(cb);
|
|
13
|
-
const index = subscriptors.length - 1;
|
|
14
|
-
return (): void => {
|
|
15
|
-
subscriptors.splice(index, 1);
|
|
16
|
-
};
|
|
17
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, jest } from 'bun:test';
|
|
2
|
-
import { get, patch, post, put, remove } from './http.js';
|
|
3
|
-
|
|
4
|
-
describe('http', () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
globalThis.fetch = jest.fn() as any;
|
|
7
|
-
(globalThis.fetch as unknown as jest.Mock).mockImplementation(setupFetchStub({}));
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
afterEach(() => {
|
|
11
|
-
delete globalThis.fetch;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('post', async () => {
|
|
15
|
-
const body = {};
|
|
16
|
-
await post('/', body);
|
|
17
|
-
expect(globalThis.fetch).toHaveBeenCalledWith(
|
|
18
|
-
'/',
|
|
19
|
-
expect.objectContaining({ body: JSON.stringify(body), method: 'post' }),
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('patch', async () => {
|
|
24
|
-
const body = {};
|
|
25
|
-
await patch('/', body);
|
|
26
|
-
expect(globalThis.fetch).toHaveBeenCalledWith(
|
|
27
|
-
'/',
|
|
28
|
-
expect.objectContaining({ body: JSON.stringify(body), method: 'patch' }),
|
|
29
|
-
);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('put', async () => {
|
|
33
|
-
const body = {};
|
|
34
|
-
await put('/', body);
|
|
35
|
-
expect(globalThis.fetch).toHaveBeenCalledWith(
|
|
36
|
-
'/',
|
|
37
|
-
expect.objectContaining({ body: JSON.stringify(body), method: 'put' }),
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('get', async () => {
|
|
42
|
-
await get('/?a=1');
|
|
43
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/?a=1', expect.objectContaining({ method: 'get' }));
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('remove', async () => {
|
|
47
|
-
await remove('/?a=1');
|
|
48
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/?a=1', expect.objectContaining({ method: 'delete' }));
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('error', async () => {
|
|
52
|
-
globalThis.fetch = jest.fn() as any;
|
|
53
|
-
(globalThis.fetch as unknown as jest.Mock).mockImplementation(setupFetchStubError(new Error('some error')));
|
|
54
|
-
await expect(remove('/?a=1')).rejects.toThrow('some error');
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
function setupFetchStub(data: object) {
|
|
59
|
-
return async (_url: any) => ({
|
|
60
|
-
status: 200,
|
|
61
|
-
json: async () => ({ data }),
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function setupFetchStubError(error: Error) {
|
|
66
|
-
return async (_url: any) => ({
|
|
67
|
-
status: 500,
|
|
68
|
-
json: async () => ({ error }),
|
|
69
|
-
});
|
|
70
|
-
}
|
package/src/browser/http/http.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { RequestErrorResponse, RequestOptions, RequestSuccessResponse } from '../type/index.js';
|
|
2
|
-
import { notify } from './bus.js';
|
|
3
|
-
|
|
4
|
-
export function get<T>(url: string, opts?: RequestOptions) {
|
|
5
|
-
return request<T>(url, { method: 'get' }, opts);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function post<T>(url: string, payload: unknown, opts?: RequestOptions) {
|
|
9
|
-
const body = JSON.stringify(payload);
|
|
10
|
-
return request<T>(url, { method: 'post', body }, opts);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function patch<T>(url: string, payload: unknown, opts?: RequestOptions) {
|
|
14
|
-
const body = JSON.stringify(payload);
|
|
15
|
-
return request<T>(url, { method: 'patch', body }, opts);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function put<T>(url: string, payload: unknown, opts?: RequestOptions) {
|
|
19
|
-
const body = JSON.stringify(payload);
|
|
20
|
-
return request<T>(url, { method: 'put', body }, opts);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function remove<T>(url: string, opts?: RequestOptions) {
|
|
24
|
-
return request<T>(url, { method: 'delete' }, opts);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function request<T>(url: string, init: RequestInit, opts?: RequestOptions) {
|
|
28
|
-
notify({ phase: 'start', opts });
|
|
29
|
-
|
|
30
|
-
init.headers = {
|
|
31
|
-
accept: 'application/json',
|
|
32
|
-
'content-type': 'application/json',
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return fetch(url, init)
|
|
36
|
-
.then((rawResp) =>
|
|
37
|
-
rawResp.json().then((resp: unknown) => {
|
|
38
|
-
const isSuccess = rawResp.status >= 200 && rawResp.status < 300;
|
|
39
|
-
if (isSuccess) {
|
|
40
|
-
notify({ phase: 'success', opts });
|
|
41
|
-
return resp as RequestSuccessResponse<T>;
|
|
42
|
-
}
|
|
43
|
-
const errorResp = resp as RequestErrorResponse;
|
|
44
|
-
notify({
|
|
45
|
-
phase: 'error',
|
|
46
|
-
error: errorResp.error,
|
|
47
|
-
opts,
|
|
48
|
-
});
|
|
49
|
-
throw Error(errorResp.error.message);
|
|
50
|
-
}),
|
|
51
|
-
)
|
|
52
|
-
.finally(() => {
|
|
53
|
-
notify({ phase: 'complete', opts });
|
|
54
|
-
});
|
|
55
|
-
}
|
package/src/browser/index.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { User } from '../test/index.js';
|
|
3
|
-
import { getQuerier, getQuerierPool, setQuerierPool } from './options.js';
|
|
4
|
-
import { GenericClientRepository, HttpQuerier } from './querier/index.js';
|
|
5
|
-
import type { ClientQuerierPool } from './type/clientQuerierPool.js';
|
|
6
|
-
|
|
7
|
-
describe('options', () => {
|
|
8
|
-
it('default getQuerier', () => {
|
|
9
|
-
const querier = getQuerier();
|
|
10
|
-
expect(querier).toBeInstanceOf(HttpQuerier);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('default querierPool', () => {
|
|
14
|
-
expect(getQuerierPool()).toBeDefined();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('custom querierPool', () => {
|
|
18
|
-
const querierMock = new HttpQuerier('/');
|
|
19
|
-
|
|
20
|
-
const querierPool: ClientQuerierPool = {
|
|
21
|
-
getQuerier: () => querierMock,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
setQuerierPool(querierPool);
|
|
25
|
-
|
|
26
|
-
const querier1 = getQuerierPool().getQuerier();
|
|
27
|
-
expect(querier1).toBe(querierMock);
|
|
28
|
-
|
|
29
|
-
const querier2 = getQuerier();
|
|
30
|
-
expect(querier2).toBe(querierMock);
|
|
31
|
-
|
|
32
|
-
const repository1 = querier2.getRepository(User);
|
|
33
|
-
expect(repository1).toBeInstanceOf(GenericClientRepository);
|
|
34
|
-
|
|
35
|
-
expect(getQuerierPool()).toBe(getQuerierPool());
|
|
36
|
-
});
|
|
37
|
-
});
|
package/src/browser/options.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { HttpQuerier } from './querier/httpQuerier.js';
|
|
2
|
-
import type { ClientQuerier, ClientQuerierPool } from './type/index.js';
|
|
3
|
-
|
|
4
|
-
let defaultPool: ClientQuerierPool = {
|
|
5
|
-
getQuerier: () => new HttpQuerier('/api'),
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function setQuerierPool<T extends ClientQuerierPool>(pool: T) {
|
|
9
|
-
defaultPool = pool;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function getQuerierPool(): ClientQuerierPool {
|
|
13
|
-
return defaultPool;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function getQuerier(): ClientQuerier {
|
|
17
|
-
return getQuerierPool().getQuerier();
|
|
18
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, jest } from 'bun:test';
|
|
2
|
-
import { User } from '../../test/index.js';
|
|
3
|
-
import { GenericClientRepository } from './genericClientRepository.js';
|
|
4
|
-
import { HttpQuerier } from './httpQuerier.js';
|
|
5
|
-
|
|
6
|
-
describe('repository', () => {
|
|
7
|
-
let repository: GenericClientRepository<User>;
|
|
8
|
-
const querier = new HttpQuerier('');
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
globalThis.fetch = jest.fn() as any;
|
|
12
|
-
(globalThis.fetch as unknown as jest.Mock).mockImplementation(setupFetchStub({}));
|
|
13
|
-
repository = new GenericClientRepository(User, querier);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
afterEach(() => {
|
|
17
|
-
delete globalThis.fetch;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('count', async () => {
|
|
21
|
-
await repository.count({});
|
|
22
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user/count', expect.objectContaining({ method: 'get' }));
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('findOneById', async () => {
|
|
26
|
-
await repository.findOneById(1);
|
|
27
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user/1', expect.objectContaining({ method: 'get' }));
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('findOne', async () => {
|
|
31
|
-
await repository.findOne({});
|
|
32
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user/one', expect.objectContaining({ method: 'get' }));
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('findMany', async () => {
|
|
36
|
-
await repository.findMany({});
|
|
37
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user', expect.objectContaining({ method: 'get' }));
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('findManyAndCount', async () => {
|
|
41
|
-
await repository.findManyAndCount({});
|
|
42
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user?count=true', expect.objectContaining({ method: 'get' }));
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('insertOne', async () => {
|
|
46
|
-
await repository.insertOne({});
|
|
47
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user', expect.objectContaining({ method: 'post' }));
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('updateOneById', async () => {
|
|
51
|
-
await repository.updateOneById(1, {});
|
|
52
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user/1', expect.objectContaining({ method: 'patch' }));
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('saveOne', async () => {
|
|
56
|
-
await repository.saveOne({});
|
|
57
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user', expect.objectContaining({ method: 'post' }));
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('saveOne id', async () => {
|
|
61
|
-
await repository.saveOne({ id: 2 });
|
|
62
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user/2', expect.objectContaining({ method: 'patch' }));
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('deleteOneById', async () => {
|
|
66
|
-
await repository.deleteOneById(1);
|
|
67
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user/1', expect.objectContaining({ method: 'delete' }));
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('deleteOneById soft', async () => {
|
|
71
|
-
await repository.deleteOneById(1, { softDelete: true });
|
|
72
|
-
expect(globalThis.fetch).toHaveBeenCalledWith(
|
|
73
|
-
'/user/1?softDelete=true',
|
|
74
|
-
expect.objectContaining({ method: 'delete' }),
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('deleteMany', async () => {
|
|
79
|
-
await repository.deleteMany({});
|
|
80
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('/user', expect.objectContaining({ method: 'delete' }));
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('deleteMany soft', async () => {
|
|
84
|
-
await repository.deleteMany({}, { softDelete: true });
|
|
85
|
-
expect(globalThis.fetch).toHaveBeenCalledWith(
|
|
86
|
-
'/user?softDelete=true',
|
|
87
|
-
expect.objectContaining({ method: 'delete' }),
|
|
88
|
-
);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('entity property', () => {
|
|
92
|
-
expect(repository.entity).toBe(User);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('repository property', () => {
|
|
96
|
-
expect(repository.querier).toBe(querier);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
function setupFetchStub(data: object) {
|
|
101
|
-
return async (_url: any) => ({
|
|
102
|
-
status: 200,
|
|
103
|
-
json: async () => ({ data }),
|
|
104
|
-
});
|
|
105
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { IdValue, Query, QueryOne, QueryOptions, QuerySearch, Type } from '../../type/index.js';
|
|
2
|
-
import type { ClientQuerier, ClientRepository, RequestOptions } from '../type/index.js';
|
|
3
|
-
|
|
4
|
-
export class GenericClientRepository<E> implements ClientRepository<E> {
|
|
5
|
-
constructor(
|
|
6
|
-
readonly entity: Type<E>,
|
|
7
|
-
readonly querier: ClientQuerier,
|
|
8
|
-
) {}
|
|
9
|
-
|
|
10
|
-
findOneById(id: IdValue<E>, q?: QueryOne<E>, opts?: RequestOptions) {
|
|
11
|
-
return this.querier.findOneById(this.entity, id, q, opts);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
findOne(q: QueryOne<E>, opts?: RequestOptions) {
|
|
15
|
-
return this.querier.findOne(this.entity, q, opts);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
findMany(q: Query<E>, opts?: RequestOptions) {
|
|
19
|
-
return this.querier.findMany(this.entity, q, opts);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
findManyAndCount(q: Query<E>, opts?: RequestOptions) {
|
|
23
|
-
return this.querier.findManyAndCount(this.entity, q, opts);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
count(qm?: QuerySearch<E>, opts?: RequestOptions) {
|
|
27
|
-
return this.querier.count(this.entity, qm, opts);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
insertOne(payload: E, opts?: RequestOptions) {
|
|
31
|
-
return this.querier.insertOne(this.entity, payload, opts);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
updateOneById(id: IdValue<E>, payload: E, opts?: RequestOptions) {
|
|
35
|
-
return this.querier.updateOneById(this.entity, id, payload, opts);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
saveOne(payload: E, opts?: RequestOptions) {
|
|
39
|
-
return this.querier.saveOne(this.entity, payload, opts);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
deleteOneById(id: IdValue<E>, opts?: QueryOptions) {
|
|
43
|
-
return this.querier.deleteOneById(this.entity, id, opts);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
deleteMany(qm: QuerySearch<E>, opts?: QueryOptions) {
|
|
47
|
-
return this.querier.deleteMany(this.entity, qm, opts);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { getMeta } from '../../entity/index.js';
|
|
2
|
-
import type { IdValue, Query, QueryOne, QueryOptions, QuerySearch, Type } from '../../type/index.js';
|
|
3
|
-
import { kebabCase } from '../../util/index.js';
|
|
4
|
-
import { get, patch, post, remove } from '../http/index.js';
|
|
5
|
-
import type { ClientQuerier, ClientRepository, RequestFindOptions, RequestOptions } from '../type/index.js';
|
|
6
|
-
import { GenericClientRepository } from './genericClientRepository.js';
|
|
7
|
-
import { stringifyQuery } from './querier.util.js';
|
|
8
|
-
|
|
9
|
-
export class HttpQuerier implements ClientQuerier {
|
|
10
|
-
constructor(readonly basePath: string) {}
|
|
11
|
-
|
|
12
|
-
findOneById<E>(entity: Type<E>, id: IdValue<E>, q?: QueryOne<E>, opts?: RequestOptions) {
|
|
13
|
-
const basePath = this.getBasePath(entity);
|
|
14
|
-
const qs = stringifyQuery(q);
|
|
15
|
-
return get<E>(`${basePath}/${id}${qs}`, opts);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
findOne<E>(entity: Type<E>, q: QueryOne<E>, opts?: RequestOptions) {
|
|
19
|
-
const basePath = this.getBasePath(entity);
|
|
20
|
-
const qs = stringifyQuery(q);
|
|
21
|
-
return get<E>(`${basePath}/one${qs}`, opts);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
findMany<E>(entity: Type<E>, q: Query<E>, opts?: RequestFindOptions) {
|
|
25
|
-
const data: Query<E> & Pick<typeof opts, 'count'> = { ...q };
|
|
26
|
-
if (opts?.count) {
|
|
27
|
-
data.count = true;
|
|
28
|
-
}
|
|
29
|
-
const basePath = this.getBasePath(entity);
|
|
30
|
-
const qs = stringifyQuery(data);
|
|
31
|
-
return get<E[]>(`${basePath}${qs}`, opts);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
findManyAndCount<E>(entity: Type<E>, q: Query<E>, opts?: RequestFindOptions) {
|
|
35
|
-
return this.findMany(entity, q, { ...opts, count: true });
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
count<E>(entity: Type<E>, q: QuerySearch<E>, opts?: RequestOptions) {
|
|
39
|
-
const basePath = this.getBasePath(entity);
|
|
40
|
-
const qs = stringifyQuery(q);
|
|
41
|
-
return get<number>(`${basePath}/count${qs}`, opts);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
insertOne<E>(entity: Type<E>, payload: E, opts?: RequestOptions) {
|
|
45
|
-
const basePath = this.getBasePath(entity);
|
|
46
|
-
return post<any>(basePath, payload, opts);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
updateOneById<E>(entity: Type<E>, id: IdValue<E>, payload: E, opts?: RequestOptions) {
|
|
50
|
-
const basePath = this.getBasePath(entity);
|
|
51
|
-
return patch<typeof id>(`${basePath}/${id}`, payload, opts);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
saveOne<E>(entity: Type<E>, payload: E, opts?: RequestOptions) {
|
|
55
|
-
const meta = getMeta(entity);
|
|
56
|
-
const id = payload[meta.id];
|
|
57
|
-
if (id) {
|
|
58
|
-
return this.updateOneById(entity, id, payload, opts).then(() => ({ data: id }));
|
|
59
|
-
}
|
|
60
|
-
return this.insertOne(entity, payload, opts);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
deleteOneById<E>(entity: Type<E>, id: IdValue<E>, opts: QueryOptions & RequestOptions = {}) {
|
|
64
|
-
const basePath = this.getBasePath(entity);
|
|
65
|
-
const qs = opts.softDelete ? stringifyQuery({ softDelete: opts.softDelete }) : '';
|
|
66
|
-
return remove<typeof id>(`${basePath}/${id}${qs}`, opts);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
deleteMany<E>(entity: Type<E>, q: QuerySearch<E>, opts: QueryOptions & RequestOptions = {}) {
|
|
70
|
-
const basePath = this.getBasePath(entity);
|
|
71
|
-
const qs = stringifyQuery(opts.softDelete ? { ...q, softDelete: opts.softDelete } : q);
|
|
72
|
-
return remove<IdValue<E>[]>(`${basePath}${qs}`, opts);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
getRepository<E>(entity: Type<E>): ClientRepository<E> {
|
|
76
|
-
return new GenericClientRepository(entity, this);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
getBasePath<E>(entity: Type<E>) {
|
|
80
|
-
return this.basePath + '/' + kebabCase(entity.name);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { expect, it } from 'bun:test';
|
|
2
|
-
import type { Item, User } from '../../test/index.js';
|
|
3
|
-
import type { Query } from '../../type/index.js';
|
|
4
|
-
import { stringifyQuery, stringifyQueryParameter } from './querier.util.js';
|
|
5
|
-
|
|
6
|
-
it('stringifyQuery -- empty', () => {
|
|
7
|
-
const source: Query<User> = {};
|
|
8
|
-
const result = stringifyQuery(source);
|
|
9
|
-
const expected = '';
|
|
10
|
-
expect(result).toBe(expected);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('stringifyQueryParameter', () => {
|
|
14
|
-
expect(stringifyQueryParameter('select', undefined)).toBe('select=undefined');
|
|
15
|
-
expect(stringifyQueryParameter('limit', 10, true)).toBe('?limit=10');
|
|
16
|
-
expect(stringifyQueryParameter('limit', 10)).toBe('limit=10');
|
|
17
|
-
expect(stringifyQueryParameter('limit', null, true)).toBe('?limit=null');
|
|
18
|
-
expect(stringifyQueryParameter('sort', { createdAt: -1 })).toBe('sort={"createdAt":-1}');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('stringifyQuery', () => {
|
|
22
|
-
expect(stringifyQuery(undefined)).toBe('');
|
|
23
|
-
expect(stringifyQuery({})).toBe('');
|
|
24
|
-
expect(stringifyQuery({ $sort: undefined })).toBe('');
|
|
25
|
-
const source: Query<Item> = {
|
|
26
|
-
$select: { id: 1, name: 1, tax: true, measureUnit: { $select: { id: 1, name: 1, categoryId: 1 } } },
|
|
27
|
-
$where: { name: 'Batman', companyId: 38 },
|
|
28
|
-
$sort: { companyId: 1, name: -1 },
|
|
29
|
-
$limit: 5,
|
|
30
|
-
};
|
|
31
|
-
const result = stringifyQuery(source);
|
|
32
|
-
const expected =
|
|
33
|
-
'?$select={"id":1,"name":1,"tax":true,"measureUnit":{"$select":{"id":1,"name":1,"categoryId":1}}}&$where={"name":"Batman","companyId":38}&$sort={"companyId":1,"name":-1}&$limit=5';
|
|
34
|
-
expect(result).toBe(expected);
|
|
35
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { getKeys } from '../../util/index.js';
|
|
2
|
-
|
|
3
|
-
export function stringifyQueryParameter(key: string, value?: unknown, useQuestionMark?: boolean): string {
|
|
4
|
-
const valStr = typeof value === 'object' && value !== null ? JSON.stringify(value) : value;
|
|
5
|
-
return (useQuestionMark ? '?' : '') + `${key}=${valStr}`;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function stringifyQuery(query: object): string {
|
|
9
|
-
if (!query) {
|
|
10
|
-
return '';
|
|
11
|
-
}
|
|
12
|
-
const keys = getKeys(query);
|
|
13
|
-
if (keys.length === 0) {
|
|
14
|
-
return '';
|
|
15
|
-
}
|
|
16
|
-
const qsArr = keys.filter((key) => query[key] !== undefined).map((key) => stringifyQueryParameter(key, query[key]));
|
|
17
|
-
return qsArr.length ? '?' + qsArr.join('&') : '';
|
|
18
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { IdValue, Query, QueryOne, QueryOptions, QuerySearch, Type, UniversalQuerier } from '../../type/index.js';
|
|
2
|
-
import type { ClientRepository } from './clientRepository.js';
|
|
3
|
-
import type { RequestOptions, RequestSuccessResponse } from './request.js';
|
|
4
|
-
|
|
5
|
-
export interface ClientQuerier extends UniversalQuerier {
|
|
6
|
-
findOneById<E>(
|
|
7
|
-
entity: Type<E>,
|
|
8
|
-
id: IdValue<E>,
|
|
9
|
-
q?: QueryOne<E>,
|
|
10
|
-
opts?: RequestOptions,
|
|
11
|
-
): Promise<RequestSuccessResponse<E>>;
|
|
12
|
-
|
|
13
|
-
findOne<E>(entity: Type<E>, q: QueryOne<E>, opts?: RequestOptions): Promise<RequestSuccessResponse<E>>;
|
|
14
|
-
|
|
15
|
-
findMany<E>(entity: Type<E>, q: Query<E>, opts?: RequestOptions): Promise<RequestSuccessResponse<E[]>>;
|
|
16
|
-
|
|
17
|
-
findManyAndCount<E>(entity: Type<E>, q: Query<E>, opts?: RequestOptions): Promise<RequestSuccessResponse<E[]>>;
|
|
18
|
-
|
|
19
|
-
count<E>(entity: Type<E>, q?: QuerySearch<E>, opts?: RequestOptions): Promise<RequestSuccessResponse<number>>;
|
|
20
|
-
|
|
21
|
-
insertOne<E>(entity: Type<E>, payload: E, opts?: RequestOptions): Promise<RequestSuccessResponse<IdValue<E>>>;
|
|
22
|
-
|
|
23
|
-
updateOneById<E>(
|
|
24
|
-
entity: Type<E>,
|
|
25
|
-
id: IdValue<E>,
|
|
26
|
-
payload: E,
|
|
27
|
-
opts?: RequestOptions,
|
|
28
|
-
): Promise<RequestSuccessResponse<IdValue<E>>>;
|
|
29
|
-
|
|
30
|
-
saveOne<E>(entity: Type<E>, payload: E, opts?: RequestOptions): Promise<RequestSuccessResponse<IdValue<E>>>;
|
|
31
|
-
|
|
32
|
-
deleteOneById<E>(
|
|
33
|
-
entity: Type<E>,
|
|
34
|
-
id: IdValue<E>,
|
|
35
|
-
opts?: QueryOptions & RequestOptions,
|
|
36
|
-
): Promise<RequestSuccessResponse<IdValue<E>>>;
|
|
37
|
-
|
|
38
|
-
deleteMany<E>(
|
|
39
|
-
entity: Type<E>,
|
|
40
|
-
qm: QuerySearch<E>,
|
|
41
|
-
opts?: QueryOptions & RequestOptions,
|
|
42
|
-
): Promise<RequestSuccessResponse<IdValue<E>[]>>;
|
|
43
|
-
|
|
44
|
-
getRepository<E>(entity: Type<E>): ClientRepository<E>;
|
|
45
|
-
}
|