blendsdk 5.33.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 +125 -0
- package/dist/cmdline/cmdline.d.ts +144 -0
- package/dist/cmdline/cmdline.d.ts.map +1 -0
- package/dist/cmdline/cmdline.js +683 -0
- package/dist/cmdline/cmdline.js.map +1 -0
- package/dist/cmdline/errors.d.ts +105 -0
- package/dist/cmdline/errors.d.ts.map +1 -0
- package/dist/cmdline/errors.js +153 -0
- package/dist/cmdline/errors.js.map +1 -0
- package/dist/cmdline/index.d.ts +5 -0
- package/dist/cmdline/index.d.ts.map +1 -0
- package/dist/cmdline/index.js +5 -0
- package/dist/cmdline/index.js.map +1 -0
- package/dist/cmdline/types.d.ts +260 -0
- package/dist/cmdline/types.d.ts.map +1 -0
- package/dist/cmdline/types.js +9 -0
- package/dist/cmdline/types.js.map +1 -0
- package/dist/cmdline/validators.d.ts +28 -0
- package/dist/cmdline/validators.d.ts.map +1 -0
- package/dist/cmdline/validators.js +211 -0
- package/dist/cmdline/validators.js.map +1 -0
- package/dist/codegen/database/index.d.ts +3 -0
- package/dist/codegen/database/index.d.ts.map +1 -0
- package/dist/codegen/database/index.js +3 -0
- package/dist/codegen/database/index.js.map +1 -0
- package/dist/codegen/database/introspect/index.d.ts +3 -0
- package/dist/codegen/database/introspect/index.d.ts.map +1 -0
- package/dist/codegen/database/introspect/index.js +3 -0
- package/dist/codegen/database/introspect/index.js.map +1 -0
- package/dist/codegen/database/introspect/introspect-query.d.ts +2 -0
- package/dist/codegen/database/introspect/introspect-query.d.ts.map +1 -0
- package/dist/codegen/database/introspect/introspect-query.js +416 -0
- package/dist/codegen/database/introspect/introspect-query.js.map +1 -0
- package/dist/codegen/database/introspect/introspect-types.d.ts +45 -0
- package/dist/codegen/database/introspect/introspect-types.d.ts.map +1 -0
- package/dist/codegen/database/introspect/introspect-types.js +2 -0
- package/dist/codegen/database/introspect/introspect-types.js.map +1 -0
- package/dist/codegen/database/introspect/introspect.d.ts +21 -0
- package/dist/codegen/database/introspect/introspect.d.ts.map +1 -0
- package/dist/codegen/database/introspect/introspect.js +223 -0
- package/dist/codegen/database/introspect/introspect.js.map +1 -0
- package/dist/codegen/database/schema/check-constraint.d.ts +8 -0
- package/dist/codegen/database/schema/check-constraint.d.ts.map +1 -0
- package/dist/codegen/database/schema/check-constraint.js +12 -0
- package/dist/codegen/database/schema/check-constraint.js.map +1 -0
- package/dist/codegen/database/schema/column-schema.d.ts +7 -0
- package/dist/codegen/database/schema/column-schema.d.ts.map +1 -0
- package/dist/codegen/database/schema/column-schema.js +9 -0
- package/dist/codegen/database/schema/column-schema.js.map +1 -0
- package/dist/codegen/database/schema/constraint-base.d.ts +13 -0
- package/dist/codegen/database/schema/constraint-base.d.ts.map +1 -0
- package/dist/codegen/database/schema/constraint-base.js +32 -0
- package/dist/codegen/database/schema/constraint-base.js.map +1 -0
- package/dist/codegen/database/schema/database-schema.d.ts +19 -0
- package/dist/codegen/database/schema/database-schema.d.ts.map +1 -0
- package/dist/codegen/database/schema/database-schema.js +48 -0
- package/dist/codegen/database/schema/database-schema.js.map +1 -0
- package/dist/codegen/database/schema/dataobject-schema.d.ts +9 -0
- package/dist/codegen/database/schema/dataobject-schema.d.ts.map +1 -0
- package/dist/codegen/database/schema/dataobject-schema.js +18 -0
- package/dist/codegen/database/schema/dataobject-schema.js.map +1 -0
- package/dist/codegen/database/schema/fkey-constraints.d.ts +21 -0
- package/dist/codegen/database/schema/fkey-constraints.d.ts.map +1 -0
- package/dist/codegen/database/schema/fkey-constraints.js +58 -0
- package/dist/codegen/database/schema/fkey-constraints.js.map +1 -0
- package/dist/codegen/database/schema/index-constraint.d.ts +34 -0
- package/dist/codegen/database/schema/index-constraint.d.ts.map +1 -0
- package/dist/codegen/database/schema/index-constraint.js +79 -0
- package/dist/codegen/database/schema/index-constraint.js.map +1 -0
- package/dist/codegen/database/schema/index.d.ts +5 -0
- package/dist/codegen/database/schema/index.d.ts.map +1 -0
- package/dist/codegen/database/schema/index.js +5 -0
- package/dist/codegen/database/schema/index.js.map +1 -0
- package/dist/codegen/database/schema/primarykey-constraint.d.ts +4 -0
- package/dist/codegen/database/schema/primarykey-constraint.d.ts.map +1 -0
- package/dist/codegen/database/schema/primarykey-constraint.js +4 -0
- package/dist/codegen/database/schema/primarykey-constraint.js.map +1 -0
- package/dist/codegen/database/schema/relation-schema.d.ts +16 -0
- package/dist/codegen/database/schema/relation-schema.d.ts.map +1 -0
- package/dist/codegen/database/schema/relation-schema.js +32 -0
- package/dist/codegen/database/schema/relation-schema.js.map +1 -0
- package/dist/codegen/database/schema/table-column-schema.d.ts +59 -0
- package/dist/codegen/database/schema/table-column-schema.d.ts.map +1 -0
- package/dist/codegen/database/schema/table-column-schema.js +137 -0
- package/dist/codegen/database/schema/table-column-schema.js.map +1 -0
- package/dist/codegen/database/schema/table-schema.d.ts +48 -0
- package/dist/codegen/database/schema/table-schema.d.ts.map +1 -0
- package/dist/codegen/database/schema/table-schema.js +219 -0
- package/dist/codegen/database/schema/table-schema.js.map +1 -0
- package/dist/codegen/database/schema/types.d.ts +13 -0
- package/dist/codegen/database/schema/types.d.ts.map +1 -0
- package/dist/codegen/database/schema/types.js +175 -0
- package/dist/codegen/database/schema/types.js.map +1 -0
- package/dist/codegen/database/schema/unique-constraint.d.ts +4 -0
- package/dist/codegen/database/schema/unique-constraint.d.ts.map +1 -0
- package/dist/codegen/database/schema/unique-constraint.js +4 -0
- package/dist/codegen/database/schema/unique-constraint.js.map +1 -0
- package/dist/codegen/database/schema/view-schema.d.ts +14 -0
- package/dist/codegen/database/schema/view-schema.d.ts.map +1 -0
- package/dist/codegen/database/schema/view-schema.js +32 -0
- package/dist/codegen/database/schema/view-schema.js.map +1 -0
- package/dist/codegen/generator/ctype-generator.d.ts +5 -0
- package/dist/codegen/generator/ctype-generator.d.ts.map +1 -0
- package/dist/codegen/generator/ctype-generator.js +26 -0
- package/dist/codegen/generator/ctype-generator.js.map +1 -0
- package/dist/codegen/generator/generator.d.ts +17 -0
- package/dist/codegen/generator/generator.d.ts.map +1 -0
- package/dist/codegen/generator/generator.js +57 -0
- package/dist/codegen/generator/generator.js.map +1 -0
- package/dist/codegen/generator/index.d.ts +8 -0
- package/dist/codegen/generator/index.d.ts.map +1 -0
- package/dist/codegen/generator/index.js +8 -0
- package/dist/codegen/generator/index.js.map +1 -0
- package/dist/codegen/generator/openapi-generator.d.ts +239 -0
- package/dist/codegen/generator/openapi-generator.d.ts.map +1 -0
- package/dist/codegen/generator/openapi-generator.js +434 -0
- package/dist/codegen/generator/openapi-generator.js.map +1 -0
- package/dist/codegen/generator/openapi-types.d.ts +263 -0
- package/dist/codegen/generator/openapi-types.d.ts.map +1 -0
- package/dist/codegen/generator/openapi-types.js +11 -0
- package/dist/codegen/generator/openapi-types.js.map +1 -0
- package/dist/codegen/generator/postgres-schema-generator.d.ts +48 -0
- package/dist/codegen/generator/postgres-schema-generator.d.ts.map +1 -0
- package/dist/codegen/generator/postgres-schema-generator.js +339 -0
- package/dist/codegen/generator/postgres-schema-generator.js.map +1 -0
- package/dist/codegen/generator/type-generator.d.ts +113 -0
- package/dist/codegen/generator/type-generator.d.ts.map +1 -0
- package/dist/codegen/generator/type-generator.js +249 -0
- package/dist/codegen/generator/type-generator.js.map +1 -0
- package/dist/codegen/generator/zod-generator.d.ts +15 -0
- package/dist/codegen/generator/zod-generator.d.ts.map +1 -0
- package/dist/codegen/generator/zod-generator.js +86 -0
- package/dist/codegen/generator/zod-generator.js.map +1 -0
- package/dist/codegen/generator/zod-to-openapi.d.ts +69 -0
- package/dist/codegen/generator/zod-to-openapi.d.ts.map +1 -0
- package/dist/codegen/generator/zod-to-openapi.js +480 -0
- package/dist/codegen/generator/zod-to-openapi.js.map +1 -0
- package/dist/codegen/index.d.ts +4 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/index.js +4 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/schema/any-schema.d.ts +6 -0
- package/dist/codegen/schema/any-schema.d.ts.map +1 -0
- package/dist/codegen/schema/any-schema.js +12 -0
- package/dist/codegen/schema/any-schema.js.map +1 -0
- package/dist/codegen/schema/boolean-schema.d.ts +6 -0
- package/dist/codegen/schema/boolean-schema.d.ts.map +1 -0
- package/dist/codegen/schema/boolean-schema.js +12 -0
- package/dist/codegen/schema/boolean-schema.js.map +1 -0
- package/dist/codegen/schema/date-schema.d.ts +6 -0
- package/dist/codegen/schema/date-schema.d.ts.map +1 -0
- package/dist/codegen/schema/date-schema.js +12 -0
- package/dist/codegen/schema/date-schema.js.map +1 -0
- package/dist/codegen/schema/index.d.ts +10 -0
- package/dist/codegen/schema/index.d.ts.map +1 -0
- package/dist/codegen/schema/index.js +10 -0
- package/dist/codegen/schema/index.js.map +1 -0
- package/dist/codegen/schema/object-schema.d.ts +10 -0
- package/dist/codegen/schema/object-schema.d.ts.map +1 -0
- package/dist/codegen/schema/object-schema.js +21 -0
- package/dist/codegen/schema/object-schema.js.map +1 -0
- package/dist/codegen/schema/primitive-schema.d.ts +20 -0
- package/dist/codegen/schema/primitive-schema.d.ts.map +1 -0
- package/dist/codegen/schema/primitive-schema.js +48 -0
- package/dist/codegen/schema/primitive-schema.js.map +1 -0
- package/dist/codegen/schema/ref-schema.d.ts +6 -0
- package/dist/codegen/schema/ref-schema.d.ts.map +1 -0
- package/dist/codegen/schema/ref-schema.js +11 -0
- package/dist/codegen/schema/ref-schema.js.map +1 -0
- package/dist/codegen/schema/schema-container.d.ts +14 -0
- package/dist/codegen/schema/schema-container.d.ts.map +1 -0
- package/dist/codegen/schema/schema-container.js +38 -0
- package/dist/codegen/schema/schema-container.js.map +1 -0
- package/dist/codegen/schema/schema-object.d.ts +42 -0
- package/dist/codegen/schema/schema-object.d.ts.map +1 -0
- package/dist/codegen/schema/schema-object.js +90 -0
- package/dist/codegen/schema/schema-object.js.map +1 -0
- package/dist/codegen/schema/schema-scope.d.ts +23 -0
- package/dist/codegen/schema/schema-scope.d.ts.map +1 -0
- package/dist/codegen/schema/schema-scope.js +67 -0
- package/dist/codegen/schema/schema-scope.js.map +1 -0
- package/dist/codegen/schema/utils.d.ts +17 -0
- package/dist/codegen/schema/utils.d.ts.map +1 -0
- package/dist/codegen/schema/utils.js +47 -0
- package/dist/codegen/schema/utils.js.map +1 -0
- package/dist/dbcore/crud-statement.d.ts +67 -0
- package/dist/dbcore/crud-statement.d.ts.map +1 -0
- package/dist/dbcore/crud-statement.js +75 -0
- package/dist/dbcore/crud-statement.js.map +1 -0
- package/dist/dbcore/database.d.ts +272 -0
- package/dist/dbcore/database.d.ts.map +1 -0
- package/dist/dbcore/database.js +53 -0
- package/dist/dbcore/database.js.map +1 -0
- package/dist/dbcore/dataservice-base.d.ts +18 -0
- package/dist/dbcore/dataservice-base.d.ts.map +1 -0
- package/dist/dbcore/dataservice-base.js +19 -0
- package/dist/dbcore/dataservice-base.js.map +1 -0
- package/dist/dbcore/delete-statement.d.ts +29 -0
- package/dist/dbcore/delete-statement.d.ts.map +1 -0
- package/dist/dbcore/delete-statement.js +30 -0
- package/dist/dbcore/delete-statement.js.map +1 -0
- package/dist/dbcore/filterable-statement.d.ts +126 -0
- package/dist/dbcore/filterable-statement.d.ts.map +1 -0
- package/dist/dbcore/filterable-statement.js +178 -0
- package/dist/dbcore/filterable-statement.js.map +1 -0
- package/dist/dbcore/from-statement.d.ts +120 -0
- package/dist/dbcore/from-statement.d.ts.map +1 -0
- package/dist/dbcore/from-statement.js +150 -0
- package/dist/dbcore/from-statement.js.map +1 -0
- package/dist/dbcore/index.d.ts +21 -0
- package/dist/dbcore/index.d.ts.map +1 -0
- package/dist/dbcore/index.js +21 -0
- package/dist/dbcore/index.js.map +1 -0
- package/dist/dbcore/insert-statement.d.ts +48 -0
- package/dist/dbcore/insert-statement.d.ts.map +1 -0
- package/dist/dbcore/insert-statement.js +52 -0
- package/dist/dbcore/insert-statement.js.map +1 -0
- package/dist/dbcore/query-dataservice.d.ts +144 -0
- package/dist/dbcore/query-dataservice.d.ts.map +1 -0
- package/dist/dbcore/query-dataservice.js +144 -0
- package/dist/dbcore/query-dataservice.js.map +1 -0
- package/dist/dbcore/statement.d.ts +133 -0
- package/dist/dbcore/statement.d.ts.map +1 -0
- package/dist/dbcore/statement.js +138 -0
- package/dist/dbcore/statement.js.map +1 -0
- package/dist/dbcore/update-statement.d.ts +48 -0
- package/dist/dbcore/update-statement.d.ts.map +1 -0
- package/dist/dbcore/update-statement.js +52 -0
- package/dist/dbcore/update-statement.js.map +1 -0
- package/dist/expression/builders/comparison-builder.d.ts +47 -0
- package/dist/expression/builders/comparison-builder.d.ts.map +1 -0
- package/dist/expression/builders/comparison-builder.js +197 -0
- package/dist/expression/builders/comparison-builder.js.map +1 -0
- package/dist/expression/builders/query-builder.d.ts +80 -0
- package/dist/expression/builders/query-builder.d.ts.map +1 -0
- package/dist/expression/builders/query-builder.js +229 -0
- package/dist/expression/builders/query-builder.js.map +1 -0
- package/dist/expression/compiler/postgresql-compiler.d.ts +56 -0
- package/dist/expression/compiler/postgresql-compiler.d.ts.map +1 -0
- package/dist/expression/compiler/postgresql-compiler.js +217 -0
- package/dist/expression/compiler/postgresql-compiler.js.map +1 -0
- package/dist/expression/core/ast-node.d.ts +47 -0
- package/dist/expression/core/ast-node.d.ts.map +1 -0
- package/dist/expression/core/ast-node.js +154 -0
- package/dist/expression/core/ast-node.js.map +1 -0
- package/dist/expression/core/parameter-manager.d.ts +84 -0
- package/dist/expression/core/parameter-manager.d.ts.map +1 -0
- package/dist/expression/core/parameter-manager.js +164 -0
- package/dist/expression/core/parameter-manager.js.map +1 -0
- package/dist/expression/core/query-builder-interfaces.d.ts +188 -0
- package/dist/expression/core/query-builder-interfaces.d.ts.map +1 -0
- package/dist/expression/core/query-builder-interfaces.js +6 -0
- package/dist/expression/core/query-builder-interfaces.js.map +1 -0
- package/dist/expression/core/types.d.ts +239 -0
- package/dist/expression/core/types.d.ts.map +1 -0
- package/dist/expression/core/types.js +121 -0
- package/dist/expression/core/types.js.map +1 -0
- package/dist/expression/index.d.ts +11 -0
- package/dist/expression/index.d.ts.map +1 -0
- package/dist/expression/index.js +11 -0
- package/dist/expression/index.js.map +1 -0
- package/dist/i18n/content-file-source.d.ts +109 -0
- package/dist/i18n/content-file-source.d.ts.map +1 -0
- package/dist/i18n/content-file-source.js +218 -0
- package/dist/i18n/content-file-source.js.map +1 -0
- package/dist/i18n/index.d.ts +19 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +21 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/json-file-source.d.ts +96 -0
- package/dist/i18n/json-file-source.d.ts.map +1 -0
- package/dist/i18n/json-file-source.js +258 -0
- package/dist/i18n/json-file-source.js.map +1 -0
- package/dist/i18n/merge-catalogs.d.ts +20 -0
- package/dist/i18n/merge-catalogs.d.ts.map +1 -0
- package/dist/i18n/merge-catalogs.js +34 -0
- package/dist/i18n/merge-catalogs.js.map +1 -0
- package/dist/i18n/node.d.ts +20 -0
- package/dist/i18n/node.d.ts.map +1 -0
- package/dist/i18n/node.js +19 -0
- package/dist/i18n/node.js.map +1 -0
- package/dist/i18n/translation-source.d.ts +35 -0
- package/dist/i18n/translation-source.d.ts.map +1 -0
- package/dist/i18n/translation-source.js +2 -0
- package/dist/i18n/translation-source.js.map +1 -0
- package/dist/i18n/translator.d.ts +162 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/i18n/translator.js +259 -0
- package/dist/i18n/translator.js.map +1 -0
- package/dist/i18n/types.d.ts +80 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +2 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/postgresql/database.d.ts +204 -0
- package/dist/postgresql/database.d.ts.map +1 -0
- package/dist/postgresql/database.js +321 -0
- package/dist/postgresql/database.js.map +1 -0
- package/dist/postgresql/delete-statement.d.ts +36 -0
- package/dist/postgresql/delete-statement.d.ts.map +1 -0
- package/dist/postgresql/delete-statement.js +54 -0
- package/dist/postgresql/delete-statement.js.map +1 -0
- package/dist/postgresql/index.d.ts +12 -0
- package/dist/postgresql/index.d.ts.map +1 -0
- package/dist/postgresql/index.js +12 -0
- package/dist/postgresql/index.js.map +1 -0
- package/dist/postgresql/insert-statement.d.ts +34 -0
- package/dist/postgresql/insert-statement.d.ts.map +1 -0
- package/dist/postgresql/insert-statement.js +48 -0
- package/dist/postgresql/insert-statement.js.map +1 -0
- package/dist/postgresql/update-statement.d.ts +38 -0
- package/dist/postgresql/update-statement.d.ts.map +1 -0
- package/dist/postgresql/update-statement.js +75 -0
- package/dist/postgresql/update-statement.js.map +1 -0
- package/dist/stdlib/formatString.d.ts +52 -0
- package/dist/stdlib/formatString.d.ts.map +1 -0
- package/dist/stdlib/formatString.js +118 -0
- package/dist/stdlib/formatString.js.map +1 -0
- package/dist/stdlib/index.d.ts +8 -0
- package/dist/stdlib/index.d.ts.map +1 -0
- package/dist/stdlib/index.js +8 -0
- package/dist/stdlib/index.js.map +1 -0
- package/dist/stdlib/isBoolean.d.ts +15 -0
- package/dist/stdlib/isBoolean.d.ts.map +1 -0
- package/dist/stdlib/isBoolean.js +17 -0
- package/dist/stdlib/isBoolean.js.map +1 -0
- package/dist/stdlib/isNullOrUndef.d.ts +24 -0
- package/dist/stdlib/isNullOrUndef.d.ts.map +1 -0
- package/dist/stdlib/isNullOrUndef.js +28 -0
- package/dist/stdlib/isNullOrUndef.js.map +1 -0
- package/dist/stdlib/isNumeric.d.ts +20 -0
- package/dist/stdlib/isNumeric.d.ts.map +1 -0
- package/dist/stdlib/isNumeric.js +39 -0
- package/dist/stdlib/isNumeric.js.map +1 -0
- package/dist/stdlib/isString.d.ts +15 -0
- package/dist/stdlib/isString.d.ts.map +1 -0
- package/dist/stdlib/isString.js +17 -0
- package/dist/stdlib/isString.js.map +1 -0
- package/dist/stdlib/isTemplateString.d.ts +18 -0
- package/dist/stdlib/isTemplateString.d.ts.map +1 -0
- package/dist/stdlib/isTemplateString.js +38 -0
- package/dist/stdlib/isTemplateString.js.map +1 -0
- package/dist/stdlib/wrapInArray.d.ts +14 -0
- package/dist/stdlib/wrapInArray.d.ts.map +1 -0
- package/dist/stdlib/wrapInArray.js +17 -0
- package/dist/stdlib/wrapInArray.js.map +1 -0
- package/dist/webafx/application/application-settings.d.ts +129 -0
- package/dist/webafx/application/application-settings.d.ts.map +1 -0
- package/dist/webafx/application/application-settings.js +162 -0
- package/dist/webafx/application/application-settings.js.map +1 -0
- package/dist/webafx/application/base-controller.d.ts +128 -0
- package/dist/webafx/application/base-controller.d.ts.map +1 -0
- package/dist/webafx/application/base-controller.js +122 -0
- package/dist/webafx/application/base-controller.js.map +1 -0
- package/dist/webafx/application/console-logger.d.ts +81 -0
- package/dist/webafx/application/console-logger.d.ts.map +1 -0
- package/dist/webafx/application/console-logger.js +111 -0
- package/dist/webafx/application/console-logger.js.map +1 -0
- package/dist/webafx/application/controller-registry.d.ts +34 -0
- package/dist/webafx/application/controller-registry.d.ts.map +1 -0
- package/dist/webafx/application/controller-registry.js +32 -0
- package/dist/webafx/application/controller-registry.js.map +1 -0
- package/dist/webafx/application/error-handler-middleware.d.ts +22 -0
- package/dist/webafx/application/error-handler-middleware.d.ts.map +1 -0
- package/dist/webafx/application/error-handler-middleware.js +70 -0
- package/dist/webafx/application/error-handler-middleware.js.map +1 -0
- package/dist/webafx/application/index.d.ts +13 -0
- package/dist/webafx/application/index.d.ts.map +1 -0
- package/dist/webafx/application/index.js +13 -0
- package/dist/webafx/application/index.js.map +1 -0
- package/dist/webafx/application/logger.d.ts +2 -0
- package/dist/webafx/application/logger.d.ts.map +1 -0
- package/dist/webafx/application/logger.js +2 -0
- package/dist/webafx/application/logger.js.map +1 -0
- package/dist/webafx/application/plugin.d.ts +73 -0
- package/dist/webafx/application/plugin.d.ts.map +1 -0
- package/dist/webafx/application/plugin.js +90 -0
- package/dist/webafx/application/plugin.js.map +1 -0
- package/dist/webafx/application/rate-limiter.d.ts +35 -0
- package/dist/webafx/application/rate-limiter.d.ts.map +1 -0
- package/dist/webafx/application/rate-limiter.js +74 -0
- package/dist/webafx/application/rate-limiter.js.map +1 -0
- package/dist/webafx/application/request-context.d.ts +62 -0
- package/dist/webafx/application/request-context.d.ts.map +1 -0
- package/dist/webafx/application/request-context.js +54 -0
- package/dist/webafx/application/request-context.js.map +1 -0
- package/dist/webafx/application/request-id-middleware.d.ts +30 -0
- package/dist/webafx/application/request-id-middleware.d.ts.map +1 -0
- package/dist/webafx/application/request-id-middleware.js +57 -0
- package/dist/webafx/application/request-id-middleware.js.map +1 -0
- package/dist/webafx/application/route-builder.d.ts +231 -0
- package/dist/webafx/application/route-builder.d.ts.map +1 -0
- package/dist/webafx/application/route-builder.js +182 -0
- package/dist/webafx/application/route-builder.js.map +1 -0
- package/dist/webafx/application/service-container.d.ts +144 -0
- package/dist/webafx/application/service-container.d.ts.map +1 -0
- package/dist/webafx/application/service-container.js +192 -0
- package/dist/webafx/application/service-container.js.map +1 -0
- package/dist/webafx/application/services.d.ts +27 -0
- package/dist/webafx/application/services.d.ts.map +1 -0
- package/dist/webafx/application/services.js +33 -0
- package/dist/webafx/application/services.js.map +1 -0
- package/dist/webafx/application/structured-logger.d.ts +99 -0
- package/dist/webafx/application/structured-logger.d.ts.map +1 -0
- package/dist/webafx/application/structured-logger.js +132 -0
- package/dist/webafx/application/structured-logger.js.map +1 -0
- package/dist/webafx/application/type.d.ts +29 -0
- package/dist/webafx/application/type.d.ts.map +1 -0
- package/dist/webafx/application/type.js +2 -0
- package/dist/webafx/application/type.js.map +1 -0
- package/dist/webafx/application/web-application.d.ts +257 -0
- package/dist/webafx/application/web-application.d.ts.map +1 -0
- package/dist/webafx/application/web-application.js +611 -0
- package/dist/webafx/application/web-application.js.map +1 -0
- package/dist/webafx/errors/api-error.d.ts +21 -0
- package/dist/webafx/errors/api-error.d.ts.map +1 -0
- package/dist/webafx/errors/api-error.js +38 -0
- package/dist/webafx/errors/api-error.js.map +1 -0
- package/dist/webafx/errors/http-errors.d.ts +56 -0
- package/dist/webafx/errors/http-errors.d.ts.map +1 -0
- package/dist/webafx/errors/http-errors.js +74 -0
- package/dist/webafx/errors/http-errors.js.map +1 -0
- package/dist/webafx/errors/index.d.ts +4 -0
- package/dist/webafx/errors/index.d.ts.map +1 -0
- package/dist/webafx/errors/index.js +4 -0
- package/dist/webafx/errors/index.js.map +1 -0
- package/dist/webafx/errors/types.d.ts +42 -0
- package/dist/webafx/errors/types.d.ts.map +1 -0
- package/dist/webafx/errors/types.js +2 -0
- package/dist/webafx/errors/types.js.map +1 -0
- package/dist/webafx/index.d.ts +3 -0
- package/dist/webafx/index.d.ts.map +1 -0
- package/dist/webafx/index.js +3 -0
- package/dist/webafx/index.js.map +1 -0
- package/dist/webafx-auth/abstract-auth-provider.d.ts +178 -0
- package/dist/webafx-auth/abstract-auth-provider.d.ts.map +1 -0
- package/dist/webafx-auth/abstract-auth-provider.js +240 -0
- package/dist/webafx-auth/abstract-auth-provider.js.map +1 -0
- package/dist/webafx-auth/index.d.ts +27 -0
- package/dist/webafx-auth/index.d.ts.map +1 -0
- package/dist/webafx-auth/index.js +32 -0
- package/dist/webafx-auth/index.js.map +1 -0
- package/dist/webafx-auth/jwt-auth-provider.d.ts +100 -0
- package/dist/webafx-auth/jwt-auth-provider.d.ts.map +1 -0
- package/dist/webafx-auth/jwt-auth-provider.js +154 -0
- package/dist/webafx-auth/jwt-auth-provider.js.map +1 -0
- package/dist/webafx-auth/memory-auth-provider.d.ts +100 -0
- package/dist/webafx-auth/memory-auth-provider.d.ts.map +1 -0
- package/dist/webafx-auth/memory-auth-provider.js +122 -0
- package/dist/webafx-auth/memory-auth-provider.js.map +1 -0
- package/dist/webafx-auth/types.d.ts +333 -0
- package/dist/webafx-auth/types.d.ts.map +1 -0
- package/dist/webafx-auth/types.js +24 -0
- package/dist/webafx-auth/types.js.map +1 -0
- package/dist/webafx-cache/abstract-cache-provider.d.ts +185 -0
- package/dist/webafx-cache/abstract-cache-provider.d.ts.map +1 -0
- package/dist/webafx-cache/abstract-cache-provider.js +133 -0
- package/dist/webafx-cache/abstract-cache-provider.js.map +1 -0
- package/dist/webafx-cache/abstract-pubsub-provider.d.ts +170 -0
- package/dist/webafx-cache/abstract-pubsub-provider.d.ts.map +1 -0
- package/dist/webafx-cache/abstract-pubsub-provider.js +132 -0
- package/dist/webafx-cache/abstract-pubsub-provider.js.map +1 -0
- package/dist/webafx-cache/cache-plugin.d.ts +114 -0
- package/dist/webafx-cache/cache-plugin.d.ts.map +1 -0
- package/dist/webafx-cache/cache-plugin.js +176 -0
- package/dist/webafx-cache/cache-plugin.js.map +1 -0
- package/dist/webafx-cache/index.d.ts +33 -0
- package/dist/webafx-cache/index.d.ts.map +1 -0
- package/dist/webafx-cache/index.js +44 -0
- package/dist/webafx-cache/index.js.map +1 -0
- package/dist/webafx-cache/memory-cache-provider.d.ts +99 -0
- package/dist/webafx-cache/memory-cache-provider.d.ts.map +1 -0
- package/dist/webafx-cache/memory-cache-provider.js +251 -0
- package/dist/webafx-cache/memory-cache-provider.js.map +1 -0
- package/dist/webafx-cache/memory-pubsub-provider.d.ts +124 -0
- package/dist/webafx-cache/memory-pubsub-provider.d.ts.map +1 -0
- package/dist/webafx-cache/memory-pubsub-provider.js +195 -0
- package/dist/webafx-cache/memory-pubsub-provider.js.map +1 -0
- package/dist/webafx-cache/pubsub-plugin.d.ts +128 -0
- package/dist/webafx-cache/pubsub-plugin.d.ts.map +1 -0
- package/dist/webafx-cache/pubsub-plugin.js +182 -0
- package/dist/webafx-cache/pubsub-plugin.js.map +1 -0
- package/dist/webafx-cache/redis-cache-provider.d.ts +81 -0
- package/dist/webafx-cache/redis-cache-provider.d.ts.map +1 -0
- package/dist/webafx-cache/redis-cache-provider.js +209 -0
- package/dist/webafx-cache/redis-cache-provider.js.map +1 -0
- package/dist/webafx-cache/redis-pubsub-provider.d.ts +164 -0
- package/dist/webafx-cache/redis-pubsub-provider.d.ts.map +1 -0
- package/dist/webafx-cache/redis-pubsub-provider.js +329 -0
- package/dist/webafx-cache/redis-pubsub-provider.js.map +1 -0
- package/dist/webafx-cache/types.d.ts +206 -0
- package/dist/webafx-cache/types.d.ts.map +1 -0
- package/dist/webafx-cache/types.js +27 -0
- package/dist/webafx-cache/types.js.map +1 -0
- package/dist/webafx-i18n/i18n-plugin.d.ts +29 -0
- package/dist/webafx-i18n/i18n-plugin.d.ts.map +1 -0
- package/dist/webafx-i18n/i18n-plugin.js +145 -0
- package/dist/webafx-i18n/i18n-plugin.js.map +1 -0
- package/dist/webafx-i18n/index.d.ts +12 -0
- package/dist/webafx-i18n/index.d.ts.map +1 -0
- package/dist/webafx-i18n/index.js +12 -0
- package/dist/webafx-i18n/index.js.map +1 -0
- package/dist/webafx-i18n/locale-resolver.d.ts +33 -0
- package/dist/webafx-i18n/locale-resolver.d.ts.map +1 -0
- package/dist/webafx-i18n/locale-resolver.js +67 -0
- package/dist/webafx-i18n/locale-resolver.js.map +1 -0
- package/dist/webafx-i18n/postgresql-source.d.ts +101 -0
- package/dist/webafx-i18n/postgresql-source.d.ts.map +1 -0
- package/dist/webafx-i18n/postgresql-source.js +101 -0
- package/dist/webafx-i18n/postgresql-source.js.map +1 -0
- package/dist/webafx-i18n/types.d.ts +70 -0
- package/dist/webafx-i18n/types.d.ts.map +1 -0
- package/dist/webafx-i18n/types.js +2 -0
- package/dist/webafx-i18n/types.js.map +1 -0
- package/dist/webafx-mailer/abstract-mail-provider.d.ts +55 -0
- package/dist/webafx-mailer/abstract-mail-provider.d.ts.map +1 -0
- package/dist/webafx-mailer/abstract-mail-provider.js +37 -0
- package/dist/webafx-mailer/abstract-mail-provider.js.map +1 -0
- package/dist/webafx-mailer/index.d.ts +24 -0
- package/dist/webafx-mailer/index.d.ts.map +1 -0
- package/dist/webafx-mailer/index.js +34 -0
- package/dist/webafx-mailer/index.js.map +1 -0
- package/dist/webafx-mailer/mail-plugin.d.ts +98 -0
- package/dist/webafx-mailer/mail-plugin.d.ts.map +1 -0
- package/dist/webafx-mailer/mail-plugin.js +155 -0
- package/dist/webafx-mailer/mail-plugin.js.map +1 -0
- package/dist/webafx-mailer/memory-mail-provider.d.ts +85 -0
- package/dist/webafx-mailer/memory-mail-provider.d.ts.map +1 -0
- package/dist/webafx-mailer/memory-mail-provider.js +111 -0
- package/dist/webafx-mailer/memory-mail-provider.js.map +1 -0
- package/dist/webafx-mailer/smtp-mail-provider.d.ts +65 -0
- package/dist/webafx-mailer/smtp-mail-provider.d.ts.map +1 -0
- package/dist/webafx-mailer/smtp-mail-provider.js +113 -0
- package/dist/webafx-mailer/smtp-mail-provider.js.map +1 -0
- package/dist/webafx-mailer/types.d.ts +136 -0
- package/dist/webafx-mailer/types.d.ts.map +1 -0
- package/dist/webafx-mailer/types.js +13 -0
- package/dist/webafx-mailer/types.js.map +1 -0
- package/package.json +159 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Statement } from './statement.js';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for CRUD (Create, Read, Update, Delete) statement builders.
|
|
4
|
+
* Extends the Statement class to provide common functionality for INSERT, UPDATE,
|
|
5
|
+
* and DELETE operations, including support for RETURNING clauses and value management.
|
|
6
|
+
*
|
|
7
|
+
* This class serves as the foundation for all data modification statements,
|
|
8
|
+
* providing shared functionality for handling values and return fields.
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @abstract
|
|
12
|
+
* @class CrudStatement
|
|
13
|
+
* @extends {Statement<TableType>}
|
|
14
|
+
* @template TableType - The type representing the table structure this statement operates on
|
|
15
|
+
*/
|
|
16
|
+
export class CrudStatement extends Statement {
|
|
17
|
+
tableName;
|
|
18
|
+
/**
|
|
19
|
+
* Array of field names to return after the operation completes.
|
|
20
|
+
* Used to construct the RETURNING clause in SQL statements.
|
|
21
|
+
* Can contain specific field names or '*' to return all fields.
|
|
22
|
+
*
|
|
23
|
+
* @protected
|
|
24
|
+
* @type {string[]}
|
|
25
|
+
* @memberof CrudStatement
|
|
26
|
+
*/
|
|
27
|
+
_returning;
|
|
28
|
+
/**
|
|
29
|
+
* Object containing the values to be inserted or updated.
|
|
30
|
+
* Keys represent column names and values represent the data to be stored.
|
|
31
|
+
*
|
|
32
|
+
* @protected
|
|
33
|
+
* @type {Partial<TableType>}
|
|
34
|
+
* @memberof CrudStatement
|
|
35
|
+
*/
|
|
36
|
+
_values;
|
|
37
|
+
/**
|
|
38
|
+
* Creates an instance of CrudStatement.
|
|
39
|
+
* Initializes the statement with a table name and database connection,
|
|
40
|
+
* and sets up empty arrays/objects for returning fields and values.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} tableName - The name of the table this statement operates on
|
|
43
|
+
* @param {Database} db - The database instance to execute queries against
|
|
44
|
+
* @memberof CrudStatement
|
|
45
|
+
*/
|
|
46
|
+
constructor(tableName, db) {
|
|
47
|
+
super(db);
|
|
48
|
+
this.tableName = tableName;
|
|
49
|
+
this._returning = [];
|
|
50
|
+
this._values = {};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Specifies which fields should be returned after the operation completes.
|
|
54
|
+
* Adds a RETURNING clause to the SQL statement, which is useful for getting
|
|
55
|
+
* auto-generated values (like IDs) or confirming the final state of modified records.
|
|
56
|
+
*
|
|
57
|
+
* @param {(keyof TableType)[] | '*'} fields - Array of field names to return, or '*' for all fields
|
|
58
|
+
* @return {this} The statement instance for method chaining
|
|
59
|
+
* @memberof CrudStatement
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // Return specific fields
|
|
63
|
+
* statement.returning(['id', 'created_at'])
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* // Return all fields
|
|
67
|
+
* statement.returning('*')
|
|
68
|
+
*/
|
|
69
|
+
returning(fields) {
|
|
70
|
+
const fld = fields === '*' ? ['*'] : fields;
|
|
71
|
+
this._returning = fld;
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=crud-statement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud-statement.js","sourceRoot":"","sources":["../src/crud-statement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAgB,aAAyB,SAAQ,SAAoB;IAgC7D;IA/BZ;;;;;;;;OAQG;IACO,UAAU,CAAW;IAE/B;;;;;;;OAOG;IACO,OAAO,CAAqB;IAEtC;;;;;;;;OAQG;IACH,YACY,SAAiB,EAC3B,EAAY;QAEZ,KAAK,CAAC,EAAE,CAAC,CAAC;QAHA,cAAS,GAAT,SAAS,CAAQ;QAI3B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,CAAC,MAAiC;QACzC,MAAM,GAAG,GAAG,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,MAAmB,CAAC;QAC1D,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { DeleteStatement } from './delete-statement.js';
|
|
2
|
+
import { FromStatement } from './from-statement.js';
|
|
3
|
+
import { InsertStatement } from './insert-statement.js';
|
|
4
|
+
import { UpdateStatement } from './update-statement.js';
|
|
5
|
+
/**
|
|
6
|
+
* Handler function type for transforming query parameters before query execution.
|
|
7
|
+
* Allows modification of parameter objects before the query is sent to the database.
|
|
8
|
+
*
|
|
9
|
+
* @export
|
|
10
|
+
* @callback QueryParamHandler
|
|
11
|
+
* @param {Record<string, any>} params - The parameter object to transform
|
|
12
|
+
* @return {Record<string, any>} The transformed parameter object
|
|
13
|
+
*/
|
|
14
|
+
export type QueryParamHandler = (params: Record<string, any>) => Record<string, any>;
|
|
15
|
+
/**
|
|
16
|
+
* Handler function type for transforming query result rows after execution.
|
|
17
|
+
* Allows modification of result data before it is returned to the caller.
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @callback QueryResultHandler
|
|
21
|
+
* @param {any[]} rows - The result rows array to transform
|
|
22
|
+
* @return {any[]} The transformed rows array
|
|
23
|
+
*/
|
|
24
|
+
export type QueryResultHandler = (rows: any[]) => any[];
|
|
25
|
+
/**
|
|
26
|
+
* Configuration options for executing database queries.
|
|
27
|
+
* Provides hooks for parameter transformation at different stages of query execution.
|
|
28
|
+
*
|
|
29
|
+
* @export
|
|
30
|
+
* @interface ExecuteQueryOptions
|
|
31
|
+
*/
|
|
32
|
+
export interface ExecuteQueryOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Handler function called before query execution to transform parameters.
|
|
35
|
+
* Useful for parameter validation, sanitization, or transformation.
|
|
36
|
+
*
|
|
37
|
+
* @type {QueryParamHandler}
|
|
38
|
+
* @memberof ExecuteQueryOptions
|
|
39
|
+
*/
|
|
40
|
+
beforeQuery?: QueryParamHandler;
|
|
41
|
+
/**
|
|
42
|
+
* Handler function called after query execution to transform result rows.
|
|
43
|
+
* Receives the raw result rows array and returns a transformed version.
|
|
44
|
+
* Useful for data transformation, field mapping, or post-processing of returned records.
|
|
45
|
+
*
|
|
46
|
+
* @type {QueryResultHandler}
|
|
47
|
+
* @memberof ExecuteQueryOptions
|
|
48
|
+
*/
|
|
49
|
+
afterQuery?: QueryResultHandler;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Configuration settings for establishing a database connection.
|
|
53
|
+
* Contains all necessary connection parameters for database initialization.
|
|
54
|
+
*
|
|
55
|
+
* @export
|
|
56
|
+
* @interface DatabaseConfig
|
|
57
|
+
*/
|
|
58
|
+
export interface DatabaseConfig {
|
|
59
|
+
/**
|
|
60
|
+
* The hostname or IP address of the database server.
|
|
61
|
+
*
|
|
62
|
+
* @type {string}
|
|
63
|
+
* @memberof DatabaseConfig
|
|
64
|
+
*/
|
|
65
|
+
host?: string;
|
|
66
|
+
/**
|
|
67
|
+
* The name of the database to connect to.
|
|
68
|
+
*
|
|
69
|
+
* @type {string}
|
|
70
|
+
* @memberof DatabaseConfig
|
|
71
|
+
*/
|
|
72
|
+
database?: string;
|
|
73
|
+
/**
|
|
74
|
+
* The port number on which the database server is listening.
|
|
75
|
+
* Can be provided as a string or number.
|
|
76
|
+
*
|
|
77
|
+
* @type {(string | number)}
|
|
78
|
+
* @memberof DatabaseConfig
|
|
79
|
+
*/
|
|
80
|
+
port?: string | number;
|
|
81
|
+
/**
|
|
82
|
+
* The username for database authentication.
|
|
83
|
+
*
|
|
84
|
+
* @type {string}
|
|
85
|
+
* @memberof DatabaseConfig
|
|
86
|
+
*/
|
|
87
|
+
user?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The password for database authentication.
|
|
90
|
+
*
|
|
91
|
+
* @type {string}
|
|
92
|
+
* @memberof DatabaseConfig
|
|
93
|
+
*/
|
|
94
|
+
pass?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Represents the result of a database query execution.
|
|
98
|
+
* Contains both the returned records and metadata about the query execution.
|
|
99
|
+
*
|
|
100
|
+
* @export
|
|
101
|
+
* @interface QueryResult
|
|
102
|
+
* @template T - The type of records returned by the query
|
|
103
|
+
*/
|
|
104
|
+
export interface QueryResult<T> {
|
|
105
|
+
/**
|
|
106
|
+
* Array of records returned by the query.
|
|
107
|
+
* Each record is of type T as specified by the generic parameter.
|
|
108
|
+
*
|
|
109
|
+
* @type {T[]}
|
|
110
|
+
* @memberof QueryResult
|
|
111
|
+
*/
|
|
112
|
+
records: T[];
|
|
113
|
+
/**
|
|
114
|
+
* The number of rows affected or returned by the query.
|
|
115
|
+
* For SELECT queries, this is the number of rows returned.
|
|
116
|
+
* For INSERT/UPDATE/DELETE queries, this is the number of rows affected.
|
|
117
|
+
*
|
|
118
|
+
* @type {number}
|
|
119
|
+
* @memberof QueryResult
|
|
120
|
+
*/
|
|
121
|
+
rowCount: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Abstract base class for database implementations.
|
|
125
|
+
* Provides a unified interface for database operations including connection management,
|
|
126
|
+
* query execution, and CRUD statement builders. Concrete implementations must provide
|
|
127
|
+
* database-specific logic for connection handling and query execution.
|
|
128
|
+
*
|
|
129
|
+
* This class serves as the foundation for all database adapters in the system,
|
|
130
|
+
* ensuring consistent API across different database backends (PostgreSQL, MySQL, etc.).
|
|
131
|
+
*
|
|
132
|
+
* @export
|
|
133
|
+
* @abstract
|
|
134
|
+
* @class Database
|
|
135
|
+
*/
|
|
136
|
+
export declare abstract class Database {
|
|
137
|
+
protected config: DatabaseConfig;
|
|
138
|
+
/**
|
|
139
|
+
* Creates an instance of Database with the provided configuration.
|
|
140
|
+
* Stores the configuration for later use during connection establishment.
|
|
141
|
+
*
|
|
142
|
+
* @param {DatabaseConfig} config - The database connection configuration
|
|
143
|
+
* @memberof Database
|
|
144
|
+
*/
|
|
145
|
+
constructor(config: DatabaseConfig);
|
|
146
|
+
/**
|
|
147
|
+
* Establishes a connection to the database using the provided configuration.
|
|
148
|
+
* Must be implemented by concrete database classes to handle database-specific
|
|
149
|
+
* connection logic.
|
|
150
|
+
*
|
|
151
|
+
* @abstract
|
|
152
|
+
* @return {Promise<any>} Promise resolving to the database connection object
|
|
153
|
+
* @memberof Database
|
|
154
|
+
*/
|
|
155
|
+
abstract connect(): Promise<any>;
|
|
156
|
+
/**
|
|
157
|
+
* Closes the database connection and releases associated resources.
|
|
158
|
+
* Must be implemented by concrete database classes to handle proper cleanup
|
|
159
|
+
* and connection termination.
|
|
160
|
+
*
|
|
161
|
+
* @abstract
|
|
162
|
+
* @param {number} [timeoutMs] - Optional maximum time in milliseconds to wait for graceful shutdown
|
|
163
|
+
* @return {Promise<void>} Promise resolving when disconnection is complete
|
|
164
|
+
* @memberof Database
|
|
165
|
+
*/
|
|
166
|
+
abstract disconnect(timeoutMs?: number): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Executes a SQL query without parameters.
|
|
169
|
+
*
|
|
170
|
+
* @abstract
|
|
171
|
+
* @template R - The type of records expected in the query result
|
|
172
|
+
* @param {string} query - The SQL query string to execute
|
|
173
|
+
* @return {Promise<QueryResult<R> | null>} Promise resolving to query results or null
|
|
174
|
+
* @memberof Database
|
|
175
|
+
*/
|
|
176
|
+
abstract executeQuery<R>(query: string): Promise<QueryResult<R> | null>;
|
|
177
|
+
/**
|
|
178
|
+
* Executes a SQL query with parameterized values.
|
|
179
|
+
*
|
|
180
|
+
* @abstract
|
|
181
|
+
* @template R - The type of records expected in the query result
|
|
182
|
+
* @param {string} query - The SQL query string to execute
|
|
183
|
+
* @param {Record<string, any>} [params] - Optional parameters for the query
|
|
184
|
+
* @return {Promise<QueryResult<R> | null>} Promise resolving to query results or null
|
|
185
|
+
* @memberof Database
|
|
186
|
+
*/
|
|
187
|
+
abstract executeQuery<R>(query: string, params?: Record<string, any>): Promise<QueryResult<R> | null>;
|
|
188
|
+
/**
|
|
189
|
+
* Executes a SQL query with parameterized values and execution options.
|
|
190
|
+
* Provides hooks for parameter transformation before and after query execution.
|
|
191
|
+
*
|
|
192
|
+
* @abstract
|
|
193
|
+
* @template R - The type of records expected in the query result
|
|
194
|
+
* @param {string} query - The SQL query string to execute
|
|
195
|
+
* @param {Record<string, any>} params - Parameters for the query
|
|
196
|
+
* @param {ExecuteQueryOptions} [options] - Optional execution configuration
|
|
197
|
+
* @return {Promise<QueryResult<R> | null>} Promise resolving to query results or null
|
|
198
|
+
* @memberof Database
|
|
199
|
+
*/
|
|
200
|
+
abstract executeQuery<R>(query: string, params: Record<string, any>, options?: ExecuteQueryOptions): Promise<QueryResult<R> | null>;
|
|
201
|
+
/**
|
|
202
|
+
* Executes a function within a database transaction.
|
|
203
|
+
* Ensures that all operations within the function are executed atomically.
|
|
204
|
+
* If the function throws an error, the transaction is rolled back.
|
|
205
|
+
* If the function completes successfully, the transaction is committed.
|
|
206
|
+
*
|
|
207
|
+
* @abstract
|
|
208
|
+
* @template T - The return type of the transaction function
|
|
209
|
+
* @param {(db: this) => Promise<T>} fn - The function to execute within the transaction
|
|
210
|
+
* @return {Promise<T>} Promise resolving to the function's return value
|
|
211
|
+
* @memberof Database
|
|
212
|
+
*/
|
|
213
|
+
abstract withTransaction<T>(fn: (db: this) => Promise<T>): Promise<T>;
|
|
214
|
+
/**
|
|
215
|
+
* Creates an INSERT statement builder for the specified table.
|
|
216
|
+
* Must be implemented by concrete database classes to provide database-specific
|
|
217
|
+
* INSERT statement construction.
|
|
218
|
+
*
|
|
219
|
+
* @abstract
|
|
220
|
+
* @template T - The type representing the table structure
|
|
221
|
+
* @param {string} tableName - The name of the table to insert into
|
|
222
|
+
* @return {InsertStatement<T>} An INSERT statement builder instance
|
|
223
|
+
* @memberof Database
|
|
224
|
+
*/
|
|
225
|
+
abstract insert<T>(tableName: string): InsertStatement<T>;
|
|
226
|
+
/**
|
|
227
|
+
* Creates an UPDATE statement builder for the specified table.
|
|
228
|
+
* Must be implemented by concrete database classes to provide database-specific
|
|
229
|
+
* UPDATE statement construction.
|
|
230
|
+
*
|
|
231
|
+
* @abstract
|
|
232
|
+
* @template T - The type representing the table structure
|
|
233
|
+
* @template F - The type representing the filter criteria structure
|
|
234
|
+
* @param {string} tableName - The name of the table to update
|
|
235
|
+
* @return {UpdateStatement<T, F>} An UPDATE statement builder instance
|
|
236
|
+
* @memberof Database
|
|
237
|
+
*/
|
|
238
|
+
abstract update<T, F>(tableName: string): UpdateStatement<T, F>;
|
|
239
|
+
/**
|
|
240
|
+
* Creates a DELETE statement builder for the specified table.
|
|
241
|
+
* Must be implemented by concrete database classes to provide database-specific
|
|
242
|
+
* DELETE statement construction.
|
|
243
|
+
*
|
|
244
|
+
* @abstract
|
|
245
|
+
* @template F - The type representing the filter criteria structure
|
|
246
|
+
* @param {string} tableName - The name of the table to delete from
|
|
247
|
+
* @return {DeleteStatement<F>} A DELETE statement builder instance
|
|
248
|
+
* @memberof Database
|
|
249
|
+
*/
|
|
250
|
+
abstract delete<F>(tableName: string): DeleteStatement<F>;
|
|
251
|
+
/**
|
|
252
|
+
* Selects all records from the specified table.
|
|
253
|
+
* Returns a FromStatement configured to select all columns.
|
|
254
|
+
*
|
|
255
|
+
* @template T - The type representing the table structure
|
|
256
|
+
* @param {string} tableName - The name of the table to select from
|
|
257
|
+
* @return {FromStatement<T>} A FROM statement builder configured to select all columns
|
|
258
|
+
* @memberof Database
|
|
259
|
+
*/
|
|
260
|
+
selectAll<T>(tableName: string): FromStatement<T>;
|
|
261
|
+
/**
|
|
262
|
+
* Creates a SELECT statement builder for the specified table.
|
|
263
|
+
* Provides a fluent interface for constructing SELECT queries with various clauses.
|
|
264
|
+
*
|
|
265
|
+
* @template T - The type representing the table structure
|
|
266
|
+
* @param {string} tableName - The name of the table to select from
|
|
267
|
+
* @return {FromStatement<T>} A FROM statement builder instance
|
|
268
|
+
* @memberof Database
|
|
269
|
+
*/
|
|
270
|
+
from<T>(tableName: string): FromStatement<T>;
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAErF;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAEhC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B;;;;;;OAMG;IACH,OAAO,EAAE,CAAC,EAAE,CAAC;IAEb;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,8BAAsB,QAAQ;IAQhB,SAAS,CAAC,MAAM,EAAE,cAAc;IAP5C;;;;;;OAMG;gBACmB,MAAM,EAAE,cAAc;IAI5C;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;IAEhC;;;;;;;;;OASG;IACH,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEtD;;;;;;;;OAQG;IACH,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAEvE;;;;;;;;;OASG;IACH,QAAQ,CAAC,YAAY,CAAC,CAAC,EACrB,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC3B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAEjC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,YAAY,CAAC,CAAC,EACrB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAEjC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAErE;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC;IAEzD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAE/D;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC;IAEzD;;;;;;;;OAQG;IACH,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC;IAIjD;;;;;;;;OAQG;IACH,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC;CAG7C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FromStatement } from './from-statement.js';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for database implementations.
|
|
4
|
+
* Provides a unified interface for database operations including connection management,
|
|
5
|
+
* query execution, and CRUD statement builders. Concrete implementations must provide
|
|
6
|
+
* database-specific logic for connection handling and query execution.
|
|
7
|
+
*
|
|
8
|
+
* This class serves as the foundation for all database adapters in the system,
|
|
9
|
+
* ensuring consistent API across different database backends (PostgreSQL, MySQL, etc.).
|
|
10
|
+
*
|
|
11
|
+
* @export
|
|
12
|
+
* @abstract
|
|
13
|
+
* @class Database
|
|
14
|
+
*/
|
|
15
|
+
export class Database {
|
|
16
|
+
config;
|
|
17
|
+
/**
|
|
18
|
+
* Creates an instance of Database with the provided configuration.
|
|
19
|
+
* Stores the configuration for later use during connection establishment.
|
|
20
|
+
*
|
|
21
|
+
* @param {DatabaseConfig} config - The database connection configuration
|
|
22
|
+
* @memberof Database
|
|
23
|
+
*/
|
|
24
|
+
constructor(config) {
|
|
25
|
+
this.config = config;
|
|
26
|
+
// Config is automatically assigned via TypeScript parameter property
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Selects all records from the specified table.
|
|
30
|
+
* Returns a FromStatement configured to select all columns.
|
|
31
|
+
*
|
|
32
|
+
* @template T - The type representing the table structure
|
|
33
|
+
* @param {string} tableName - The name of the table to select from
|
|
34
|
+
* @return {FromStatement<T>} A FROM statement builder configured to select all columns
|
|
35
|
+
* @memberof Database
|
|
36
|
+
*/
|
|
37
|
+
selectAll(tableName) {
|
|
38
|
+
return this.from(tableName).select();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a SELECT statement builder for the specified table.
|
|
42
|
+
* Provides a fluent interface for constructing SELECT queries with various clauses.
|
|
43
|
+
*
|
|
44
|
+
* @template T - The type representing the table structure
|
|
45
|
+
* @param {string} tableName - The name of the table to select from
|
|
46
|
+
* @return {FromStatement<T>} A FROM statement builder instance
|
|
47
|
+
* @memberof Database
|
|
48
|
+
*/
|
|
49
|
+
from(tableName) {
|
|
50
|
+
return new FromStatement(tableName, this);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=database.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAqIpD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAgB,QAAQ;IAQN;IAPtB;;;;;;OAMG;IACH,YAAsB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;QAC1C,qEAAqE;IACvE,CAAC;IA2HD;;;;;;;;OAQG;IACH,SAAS,CAAI,SAAiB;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAI,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1C,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAI,SAAiB;QACvB,OAAO,IAAI,aAAa,CAAI,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Database } from './database.js';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for data services.
|
|
4
|
+
* Provides access to the database instance for subclasses to perform queries.
|
|
5
|
+
*
|
|
6
|
+
* @abstract
|
|
7
|
+
* @class DataServiceBase
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class DataServiceBase {
|
|
10
|
+
/**
|
|
11
|
+
* The database instance used by this data service.
|
|
12
|
+
* Protected to enforce encapsulation — subclasses should access it directly,
|
|
13
|
+
* but external consumers should interact through the data service's public API.
|
|
14
|
+
*/
|
|
15
|
+
protected db: Database;
|
|
16
|
+
constructor(db: Database);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=dataservice-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataservice-base.d.ts","sourceRoot":"","sources":["../src/dataservice-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;GAMG;AACH,8BAAsB,eAAe;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC;gBAEX,EAAE,EAAE,QAAQ;CAGzB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class for data services.
|
|
3
|
+
* Provides access to the database instance for subclasses to perform queries.
|
|
4
|
+
*
|
|
5
|
+
* @abstract
|
|
6
|
+
* @class DataServiceBase
|
|
7
|
+
*/
|
|
8
|
+
export class DataServiceBase {
|
|
9
|
+
/**
|
|
10
|
+
* The database instance used by this data service.
|
|
11
|
+
* Protected to enforce encapsulation — subclasses should access it directly,
|
|
12
|
+
* but external consumers should interact through the data service's public API.
|
|
13
|
+
*/
|
|
14
|
+
db;
|
|
15
|
+
constructor(db) {
|
|
16
|
+
this.db = db;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=dataservice-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataservice-base.js","sourceRoot":"","sources":["../src/dataservice-base.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,OAAgB,eAAe;IACnC;;;;OAIG;IACO,EAAE,CAAW;IAEvB,YAAY,EAAY;QACtB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FilterableStatement } from './filterable-statement.js';
|
|
2
|
+
import { Database } from './database.js';
|
|
3
|
+
/**
|
|
4
|
+
* Abstract statement builder for DELETE operations.
|
|
5
|
+
* Extends FilterableStatement to provide functionality for deleting records from database tables.
|
|
6
|
+
* Concrete database implementations must extend this class to provide database-specific
|
|
7
|
+
* DELETE query construction and parameter handling.
|
|
8
|
+
*
|
|
9
|
+
* This class provides a fluent interface for building DELETE statements with support
|
|
10
|
+
* for filtering which records to delete and RETURNING clauses to retrieve deleted data.
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @abstract
|
|
14
|
+
* @class DeleteStatement
|
|
15
|
+
* @extends {FilterableStatement<FilterType, FilterType>}
|
|
16
|
+
* @template FilterType - The type representing the filter criteria structure
|
|
17
|
+
*/
|
|
18
|
+
export declare abstract class DeleteStatement<FilterType> extends FilterableStatement<FilterType, FilterType> {
|
|
19
|
+
/**
|
|
20
|
+
* Creates an instance of DeleteStatement.
|
|
21
|
+
* Initializes the statement with a table name and database connection.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} tableName - The name of the table to delete from
|
|
24
|
+
* @param {Database} db - The database instance to execute queries against
|
|
25
|
+
* @memberof DeleteStatement
|
|
26
|
+
*/
|
|
27
|
+
constructor(tableName: string, db: Database);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=delete-statement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-statement.d.ts","sourceRoot":"","sources":["../src/delete-statement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;;;;GAcG;AACH,8BAAsB,eAAe,CAAC,UAAU,CAAE,SAAQ,mBAAmB,CAC3E,UAAU,EACV,UAAU,CACX;IACC;;;;;;;OAOG;gBACS,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ;CAG5C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FilterableStatement } from './filterable-statement.js';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract statement builder for DELETE operations.
|
|
4
|
+
* Extends FilterableStatement to provide functionality for deleting records from database tables.
|
|
5
|
+
* Concrete database implementations must extend this class to provide database-specific
|
|
6
|
+
* DELETE query construction and parameter handling.
|
|
7
|
+
*
|
|
8
|
+
* This class provides a fluent interface for building DELETE statements with support
|
|
9
|
+
* for filtering which records to delete and RETURNING clauses to retrieve deleted data.
|
|
10
|
+
*
|
|
11
|
+
* @export
|
|
12
|
+
* @abstract
|
|
13
|
+
* @class DeleteStatement
|
|
14
|
+
* @extends {FilterableStatement<FilterType, FilterType>}
|
|
15
|
+
* @template FilterType - The type representing the filter criteria structure
|
|
16
|
+
*/
|
|
17
|
+
export class DeleteStatement extends FilterableStatement {
|
|
18
|
+
/**
|
|
19
|
+
* Creates an instance of DeleteStatement.
|
|
20
|
+
* Initializes the statement with a table name and database connection.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} tableName - The name of the table to delete from
|
|
23
|
+
* @param {Database} db - The database instance to execute queries against
|
|
24
|
+
* @memberof DeleteStatement
|
|
25
|
+
*/
|
|
26
|
+
constructor(tableName, db) {
|
|
27
|
+
super(tableName, db);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=delete-statement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-statement.js","sourceRoot":"","sources":["../src/delete-statement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAgB,eAA4B,SAAQ,mBAGzD;IACC;;;;;;;OAOG;IACH,YAAY,SAAiB,EAAE,EAAY;QACzC,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { CrudStatement } from './crud-statement.js';
|
|
2
|
+
import { Database } from './database.js';
|
|
3
|
+
import type { CompileResult, QueryBuilder } from '../expression/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Abstract statement builder that adds filtering capabilities to CRUD statements.
|
|
6
|
+
* Provides shared filter logic used by both UPDATE and DELETE operations,
|
|
7
|
+
* including simple key-value filters and complex expression-based filters.
|
|
8
|
+
*
|
|
9
|
+
* This class eliminates code duplication between UpdateStatement and DeleteStatement
|
|
10
|
+
* by centralizing the `_expressionBuilder`, `filter()`, and `filterByExpression()` methods.
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @abstract
|
|
14
|
+
* @class FilterableStatement
|
|
15
|
+
* @extends {CrudStatement<TableType>}
|
|
16
|
+
* @template TableType - The type representing the table structure this statement operates on
|
|
17
|
+
* @template FilterType - The type representing the filter criteria structure
|
|
18
|
+
*/
|
|
19
|
+
export declare abstract class FilterableStatement<TableType, FilterType> extends CrudStatement<TableType> {
|
|
20
|
+
/**
|
|
21
|
+
* Expression builder function for constructing complex WHERE clauses.
|
|
22
|
+
* This is the primary mechanism for filtering records in UPDATE/DELETE operations.
|
|
23
|
+
*
|
|
24
|
+
* @protected
|
|
25
|
+
* @type {((q: QueryBuilder<FilterType>) => QueryBuilder<FilterType>) | undefined}
|
|
26
|
+
* @memberof FilterableStatement
|
|
27
|
+
*/
|
|
28
|
+
protected _expressionBuilder?: (q: QueryBuilder<FilterType>) => QueryBuilder<FilterType>;
|
|
29
|
+
/**
|
|
30
|
+
* Cached compiled expression result to avoid double compilation.
|
|
31
|
+
* The expression builder is invoked once and the result is reused
|
|
32
|
+
* by both buildQuery() and buildParameters() in concrete implementations.
|
|
33
|
+
*
|
|
34
|
+
* @protected
|
|
35
|
+
* @type {CompileResult | undefined}
|
|
36
|
+
* @memberof FilterableStatement
|
|
37
|
+
*/
|
|
38
|
+
protected _compiledExpression?: CompileResult;
|
|
39
|
+
/**
|
|
40
|
+
* Creates an instance of FilterableStatement.
|
|
41
|
+
* Initializes the statement with a table name and database connection.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} tableName - The name of the table this statement operates on
|
|
44
|
+
* @param {Database} db - The database instance to execute queries against
|
|
45
|
+
* @memberof FilterableStatement
|
|
46
|
+
*/
|
|
47
|
+
constructor(tableName: string, db: Database);
|
|
48
|
+
/**
|
|
49
|
+
* Compiles the expression builder and caches the result.
|
|
50
|
+
* If no expression builder is set, returns null.
|
|
51
|
+
* Subsequent calls return the cached result without recompilation.
|
|
52
|
+
*
|
|
53
|
+
* This method is used by concrete statement implementations (e.g., PostgreSQL)
|
|
54
|
+
* to generate WHERE clause SQL and parameters from the expression builder.
|
|
55
|
+
*
|
|
56
|
+
* @protected
|
|
57
|
+
* @returns {CompileResult | null} The compiled expression result, or null if no filter is set
|
|
58
|
+
* @memberof FilterableStatement
|
|
59
|
+
*/
|
|
60
|
+
protected getCompiledExpression(): CompileResult | null;
|
|
61
|
+
/**
|
|
62
|
+
* Sets the filter criteria for selecting which records to modify.
|
|
63
|
+
* Accepts a partial object where keys represent column names and values
|
|
64
|
+
* represent the criteria. Only records matching all specified criteria will be affected.
|
|
65
|
+
*
|
|
66
|
+
* This method internally converts the key-value pairs to an expression builder
|
|
67
|
+
* using equality comparisons. Multiple filters are combined with AND logic.
|
|
68
|
+
* Can be chained with filterByExpression() to add additional conditions.
|
|
69
|
+
*
|
|
70
|
+
* @param {Partial<FilterType>} values - Object containing filter column names and criteria values
|
|
71
|
+
* @return {this} The statement instance for method chaining
|
|
72
|
+
* @memberof FilterableStatement
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* // Filter by a single criterion
|
|
76
|
+
* statement.filter({ id: 123 })
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* // Filter by multiple criteria (combined with AND)
|
|
80
|
+
* statement.filter({ status: 'pending', active: true })
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* // Chain with filterByExpression for complex conditions
|
|
84
|
+
* statement
|
|
85
|
+
* .filter({ active: true })
|
|
86
|
+
* .filterByExpression(q => q.where('age').greaterThan(18))
|
|
87
|
+
*/
|
|
88
|
+
filter(values: Partial<FilterType>): this;
|
|
89
|
+
/**
|
|
90
|
+
* Sets a complex filter expression for selecting which records to modify.
|
|
91
|
+
* Provides full access to the expression builder API for constructing
|
|
92
|
+
* sophisticated WHERE clauses with logical operators, comparisons, and more.
|
|
93
|
+
*
|
|
94
|
+
* Can be chained with filter() to combine simple and complex conditions.
|
|
95
|
+
* Multiple calls to filterByExpression() are merged with AND logic.
|
|
96
|
+
*
|
|
97
|
+
* @param {(q: QueryBuilder<FilterType>) => QueryBuilder<FilterType>} builder - Expression builder function
|
|
98
|
+
* @return {this} The statement instance for method chaining
|
|
99
|
+
* @memberof FilterableStatement
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* // Filter with complex conditions
|
|
103
|
+
* statement.filterByExpression(q =>
|
|
104
|
+
* q.where('age').greaterThan(65)
|
|
105
|
+
* .or('status').equals('inactive')
|
|
106
|
+
* )
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* // Chain with simple filter
|
|
110
|
+
* statement
|
|
111
|
+
* .filter({ active: true })
|
|
112
|
+
* .filterByExpression(q => q.where('last_login').lessThan(cutoffDate))
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* // Complex nested conditions
|
|
116
|
+
* statement.filterByExpression(q =>
|
|
117
|
+
* q.where('category').equals('archived')
|
|
118
|
+
* .and(sub =>
|
|
119
|
+
* sub.where('created_at').lessThan(oldDate)
|
|
120
|
+
* .or('updated_at').isNull()
|
|
121
|
+
* )
|
|
122
|
+
* )
|
|
123
|
+
*/
|
|
124
|
+
filterByExpression(builder: (q: QueryBuilder<FilterType>) => QueryBuilder<FilterType>): this;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=filterable-statement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterable-statement.d.ts","sourceRoot":"","sources":["../src/filterable-statement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGxE;;;;;;;;;;;;;;GAcG;AACH,8BAAsB,mBAAmB,CAAC,SAAS,EAAE,UAAU,CAAE,SAAQ,aAAa,CAAC,SAAS,CAAC;IAC/F;;;;;;;OAOG;IACH,SAAS,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,KAAK,YAAY,CAAC,UAAU,CAAC,CAAC;IAEzF;;;;;;;;OAQG;IACH,SAAS,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC;IAE9C;;;;;;;OAOG;gBACS,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ;IAI3C;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,qBAAqB,IAAI,aAAa,GAAG,IAAI;IAUvD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI;IAmCzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,KAAK,YAAY,CAAC,UAAU,CAAC,GAAG,IAAI;CAc7F"}
|