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,144 @@
|
|
|
1
|
+
import { QueryBuilder } from '../expression/index.js';
|
|
2
|
+
import { Database } from './database.js';
|
|
3
|
+
import { DataServiceBase } from './dataservice-base.js';
|
|
4
|
+
/**
|
|
5
|
+
* Function type for building query expressions with type-safe column references.
|
|
6
|
+
* Accepts a QueryBuilder instance and configures the query conditions.
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type representing the table/relation structure for type-safe column access
|
|
9
|
+
* @export
|
|
10
|
+
*/
|
|
11
|
+
export type ExpressionBuilder<T = any> = (q: QueryBuilder<T>) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Promise type alias for a set of partial records from a relation.
|
|
14
|
+
* Used as the return type for query methods that return multiple records.
|
|
15
|
+
*
|
|
16
|
+
* @template RecordType - The type of records in the result set
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
19
|
+
export type PromiseOfRecordSet<RecordType> = Promise<Partial<RecordType>[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Promise type alias for a single partial record from a relation.
|
|
22
|
+
* Used as the return type for query methods that return a single record.
|
|
23
|
+
*
|
|
24
|
+
* @template RecordType - The type of the record to return
|
|
25
|
+
* @export
|
|
26
|
+
*/
|
|
27
|
+
export type PromiseOfRecord<RecordType> = Promise<Partial<RecordType>>;
|
|
28
|
+
/**
|
|
29
|
+
* Abstract base class for read-only data services that query a single database relation.
|
|
30
|
+
* Provides common query patterns like findById, findByExpression, and findAll.
|
|
31
|
+
*
|
|
32
|
+
* Uses the expression builder from @blendsdk/expression for type-safe query construction
|
|
33
|
+
* and delegates execution to the FromStatement builder.
|
|
34
|
+
*
|
|
35
|
+
* To create a concrete data service, either extend this class or use the
|
|
36
|
+
* `createQueryService()` factory function.
|
|
37
|
+
*
|
|
38
|
+
* @export
|
|
39
|
+
* @abstract
|
|
40
|
+
* @class QueryDataService
|
|
41
|
+
* @extends {DataServiceBase}
|
|
42
|
+
* @template RelationType - The type representing the database relation/table structure
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Using the factory function
|
|
46
|
+
* const UserService = createQueryService<User>('users', 'id');
|
|
47
|
+
* const service = new UserService(db);
|
|
48
|
+
* const user = await service.findById(123);
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Extending the class
|
|
52
|
+
* class UserService extends QueryDataService<User> {
|
|
53
|
+
* constructor(db: Database) {
|
|
54
|
+
* super('users', 'id', db);
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
*/
|
|
58
|
+
export declare abstract class QueryDataService<RelationType> extends DataServiceBase {
|
|
59
|
+
/**
|
|
60
|
+
* The name of the database relation (table or view) this service queries.
|
|
61
|
+
*
|
|
62
|
+
* @type {string}
|
|
63
|
+
* @memberof QueryDataService
|
|
64
|
+
*/
|
|
65
|
+
relation: string;
|
|
66
|
+
/**
|
|
67
|
+
* The name of the primary key column used for findById queries.
|
|
68
|
+
*
|
|
69
|
+
* @type {string}
|
|
70
|
+
* @memberof QueryDataService
|
|
71
|
+
*/
|
|
72
|
+
idColumn: string;
|
|
73
|
+
/**
|
|
74
|
+
* Creates an instance of QueryDataService.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} relation - The name of the database relation (table/view) to query
|
|
77
|
+
* @param {string} idColumn - The name of the primary key column
|
|
78
|
+
* @param {Database} db - The database instance to execute queries against
|
|
79
|
+
* @memberof QueryDataService
|
|
80
|
+
*/
|
|
81
|
+
constructor(relation: string, idColumn: string, db: Database);
|
|
82
|
+
/**
|
|
83
|
+
* Finds a single record by its primary key value.
|
|
84
|
+
* Constructs a WHERE clause matching the idColumn to the provided value.
|
|
85
|
+
*
|
|
86
|
+
* @template IdType - The type of the primary key value
|
|
87
|
+
* @param {IdType} id - The primary key value to search for
|
|
88
|
+
* @returns {PromiseOfRecord<RelationType | null>} The matching record, or null if not found
|
|
89
|
+
* @memberof QueryDataService
|
|
90
|
+
*/
|
|
91
|
+
findById<IdType>(id: IdType): PromiseOfRecord<RelationType | null>;
|
|
92
|
+
/**
|
|
93
|
+
* Finds a single record matching a custom expression.
|
|
94
|
+
* Returns the first matching record, or null if no records match.
|
|
95
|
+
*
|
|
96
|
+
* @param {ExpressionBuilder<RelationType>} builder - Expression builder function to construct the WHERE clause
|
|
97
|
+
* @returns {PromiseOfRecord<RelationType | null>} The first matching record, or null if not found
|
|
98
|
+
* @memberof QueryDataService
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* const user = await service.findByExpression(q =>
|
|
102
|
+
* q.where('email').equals('alice@example.com')
|
|
103
|
+
* );
|
|
104
|
+
*/
|
|
105
|
+
findByExpression(builder: ExpressionBuilder<RelationType>): PromiseOfRecord<RelationType | null>;
|
|
106
|
+
/**
|
|
107
|
+
* Finds all records matching a custom expression.
|
|
108
|
+
* Returns an empty array if no records match.
|
|
109
|
+
*
|
|
110
|
+
* @param {ExpressionBuilder<RelationType>} builder - Expression builder function to construct the WHERE clause
|
|
111
|
+
* @returns {PromiseOfRecordSet<RelationType>} Array of matching records
|
|
112
|
+
* @memberof QueryDataService
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* const activeUsers = await service.findAllByExpression(q =>
|
|
116
|
+
* q.where('active').equals(true)
|
|
117
|
+
* );
|
|
118
|
+
*/
|
|
119
|
+
findAllByExpression(builder: ExpressionBuilder<RelationType>): PromiseOfRecordSet<RelationType>;
|
|
120
|
+
/**
|
|
121
|
+
* Finds all records in the relation without any filtering.
|
|
122
|
+
* Returns an empty array if the relation is empty.
|
|
123
|
+
*
|
|
124
|
+
* @returns {PromiseOfRecordSet<RelationType>} Array of all records in the relation
|
|
125
|
+
* @memberof QueryDataService
|
|
126
|
+
*/
|
|
127
|
+
findAll(): PromiseOfRecordSet<RelationType>;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Factory function that creates a concrete QueryDataService class for a specific relation.
|
|
131
|
+
* The returned class can be instantiated with just a Database instance.
|
|
132
|
+
*
|
|
133
|
+
* @template RelationType - The type representing the relation/table structure
|
|
134
|
+
* @param {string} relationName - The name of the relation/table
|
|
135
|
+
* @param {string} idColumn - The name of the primary key column
|
|
136
|
+
* @returns A concrete QueryDataService class bound to the specified relation
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* const UserService = createQueryService<User>('users', 'id');
|
|
140
|
+
* const service = new UserService(db);
|
|
141
|
+
* const user = await service.findById(123);
|
|
142
|
+
*/
|
|
143
|
+
export declare function createQueryService<RelationType>(relationName: string, idColumn: string): new (db: Database) => QueryDataService<RelationType>;
|
|
144
|
+
//# sourceMappingURL=query-dataservice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-dataservice.d.ts","sourceRoot":"","sources":["../src/query-dataservice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAE5E;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,8BAAsB,gBAAgB,CAAC,YAAY,CAAE,SAAQ,eAAe;IAC1E;;;;;OAKG;IACI,QAAQ,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACI,QAAQ,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;gBACS,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ;IAM5D;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,eAAe,CAAC,YAAY,GAAG,IAAI,CAAC;IAMlE;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,eAAe,CAAC,YAAY,GAAG,IAAI,CAAC;IAMhG;;;;;;;;;;;;OAYG;IACH,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,kBAAkB,CAAC,YAAY,CAAC;IAM/F;;;;;;OAMG;IACH,OAAO,IAAI,kBAAkB,CAAC,YAAY,CAAC;CAG5C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAC7C,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,KAAK,EAAE,EAAE,QAAQ,KAAK,gBAAgB,CAAC,YAAY,CAAC,CAOtD"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { query } from '../expression/index.js';
|
|
2
|
+
import { DataServiceBase } from './dataservice-base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Abstract base class for read-only data services that query a single database relation.
|
|
5
|
+
* Provides common query patterns like findById, findByExpression, and findAll.
|
|
6
|
+
*
|
|
7
|
+
* Uses the expression builder from @blendsdk/expression for type-safe query construction
|
|
8
|
+
* and delegates execution to the FromStatement builder.
|
|
9
|
+
*
|
|
10
|
+
* To create a concrete data service, either extend this class or use the
|
|
11
|
+
* `createQueryService()` factory function.
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @abstract
|
|
15
|
+
* @class QueryDataService
|
|
16
|
+
* @extends {DataServiceBase}
|
|
17
|
+
* @template RelationType - The type representing the database relation/table structure
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Using the factory function
|
|
21
|
+
* const UserService = createQueryService<User>('users', 'id');
|
|
22
|
+
* const service = new UserService(db);
|
|
23
|
+
* const user = await service.findById(123);
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Extending the class
|
|
27
|
+
* class UserService extends QueryDataService<User> {
|
|
28
|
+
* constructor(db: Database) {
|
|
29
|
+
* super('users', 'id', db);
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
*/
|
|
33
|
+
export class QueryDataService extends DataServiceBase {
|
|
34
|
+
/**
|
|
35
|
+
* The name of the database relation (table or view) this service queries.
|
|
36
|
+
*
|
|
37
|
+
* @type {string}
|
|
38
|
+
* @memberof QueryDataService
|
|
39
|
+
*/
|
|
40
|
+
relation;
|
|
41
|
+
/**
|
|
42
|
+
* The name of the primary key column used for findById queries.
|
|
43
|
+
*
|
|
44
|
+
* @type {string}
|
|
45
|
+
* @memberof QueryDataService
|
|
46
|
+
*/
|
|
47
|
+
idColumn;
|
|
48
|
+
/**
|
|
49
|
+
* Creates an instance of QueryDataService.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} relation - The name of the database relation (table/view) to query
|
|
52
|
+
* @param {string} idColumn - The name of the primary key column
|
|
53
|
+
* @param {Database} db - The database instance to execute queries against
|
|
54
|
+
* @memberof QueryDataService
|
|
55
|
+
*/
|
|
56
|
+
constructor(relation, idColumn, db) {
|
|
57
|
+
super(db);
|
|
58
|
+
this.relation = relation;
|
|
59
|
+
this.idColumn = idColumn;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Finds a single record by its primary key value.
|
|
63
|
+
* Constructs a WHERE clause matching the idColumn to the provided value.
|
|
64
|
+
*
|
|
65
|
+
* @template IdType - The type of the primary key value
|
|
66
|
+
* @param {IdType} id - The primary key value to search for
|
|
67
|
+
* @returns {PromiseOfRecord<RelationType | null>} The matching record, or null if not found
|
|
68
|
+
* @memberof QueryDataService
|
|
69
|
+
*/
|
|
70
|
+
findById(id) {
|
|
71
|
+
const qb = query();
|
|
72
|
+
qb.where(this.idColumn).equals(id);
|
|
73
|
+
return this.db.from(this.relation).select().byExpression(qb.compile()).executeReturnSingle();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Finds a single record matching a custom expression.
|
|
77
|
+
* Returns the first matching record, or null if no records match.
|
|
78
|
+
*
|
|
79
|
+
* @param {ExpressionBuilder<RelationType>} builder - Expression builder function to construct the WHERE clause
|
|
80
|
+
* @returns {PromiseOfRecord<RelationType | null>} The first matching record, or null if not found
|
|
81
|
+
* @memberof QueryDataService
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* const user = await service.findByExpression(q =>
|
|
85
|
+
* q.where('email').equals('alice@example.com')
|
|
86
|
+
* );
|
|
87
|
+
*/
|
|
88
|
+
findByExpression(builder) {
|
|
89
|
+
const qb = query();
|
|
90
|
+
builder(qb);
|
|
91
|
+
return this.db.from(this.relation).select().byExpression(qb.compile()).executeReturnSingle();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Finds all records matching a custom expression.
|
|
95
|
+
* Returns an empty array if no records match.
|
|
96
|
+
*
|
|
97
|
+
* @param {ExpressionBuilder<RelationType>} builder - Expression builder function to construct the WHERE clause
|
|
98
|
+
* @returns {PromiseOfRecordSet<RelationType>} Array of matching records
|
|
99
|
+
* @memberof QueryDataService
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* const activeUsers = await service.findAllByExpression(q =>
|
|
103
|
+
* q.where('active').equals(true)
|
|
104
|
+
* );
|
|
105
|
+
*/
|
|
106
|
+
findAllByExpression(builder) {
|
|
107
|
+
const qb = query();
|
|
108
|
+
builder(qb);
|
|
109
|
+
return this.db.from(this.relation).select().byExpression(qb.compile()).executeReturnAll();
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Finds all records in the relation without any filtering.
|
|
113
|
+
* Returns an empty array if the relation is empty.
|
|
114
|
+
*
|
|
115
|
+
* @returns {PromiseOfRecordSet<RelationType>} Array of all records in the relation
|
|
116
|
+
* @memberof QueryDataService
|
|
117
|
+
*/
|
|
118
|
+
findAll() {
|
|
119
|
+
return this.db.from(this.relation).select().executeReturnAll();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Factory function that creates a concrete QueryDataService class for a specific relation.
|
|
124
|
+
* The returned class can be instantiated with just a Database instance.
|
|
125
|
+
*
|
|
126
|
+
* @template RelationType - The type representing the relation/table structure
|
|
127
|
+
* @param {string} relationName - The name of the relation/table
|
|
128
|
+
* @param {string} idColumn - The name of the primary key column
|
|
129
|
+
* @returns A concrete QueryDataService class bound to the specified relation
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* const UserService = createQueryService<User>('users', 'id');
|
|
133
|
+
* const service = new UserService(db);
|
|
134
|
+
* const user = await service.findById(123);
|
|
135
|
+
*/
|
|
136
|
+
export function createQueryService(relationName, idColumn) {
|
|
137
|
+
class ConcreteQueryDataService extends QueryDataService {
|
|
138
|
+
constructor(db) {
|
|
139
|
+
super(relationName, idColumn, db);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return ConcreteQueryDataService;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=query-dataservice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-dataservice.js","sourceRoot":"","sources":["../src/query-dataservice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgB,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA6BxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAgB,gBAA+B,SAAQ,eAAe;IAC1E;;;;;OAKG;IACI,QAAQ,CAAS;IAExB;;;;;OAKG;IACI,QAAQ,CAAS;IAExB;;;;;;;OAOG;IACH,YAAY,QAAgB,EAAE,QAAgB,EAAE,EAAY;QAC1D,KAAK,CAAC,EAAE,CAAC,CAAC;QACV,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;;;;;;OAQG;IACH,QAAQ,CAAS,EAAU;QACzB,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;QACnB,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,mBAAmB,EAAE,CAAC;IAC/F,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,OAAwC;QACvD,MAAM,EAAE,GAAG,KAAK,EAAgB,CAAC;QACjC,OAAO,CAAC,EAAE,CAAC,CAAC;QACZ,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,mBAAmB,EAAE,CAAC;IAC/F,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,mBAAmB,CAAC,OAAwC;QAC1D,MAAM,EAAE,GAAG,KAAK,EAAgB,CAAC;QACjC,OAAO,CAAC,EAAE,CAAC,CAAC;QACZ,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC5F,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAe,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC/E,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAChC,YAAoB,EACpB,QAAgB;IAEhB,MAAM,wBAAyB,SAAQ,gBAA8B;QACnE,YAAY,EAAY;YACtB,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;QACpC,CAAC;KACF;IACD,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Database, QueryResult } from './database.js';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for all SQL statement builders.
|
|
4
|
+
* Provides common functionality for building and executing database queries,
|
|
5
|
+
* including parameter handling, query execution, and result processing.
|
|
6
|
+
*
|
|
7
|
+
* This class implements the builder pattern, allowing for fluent method chaining
|
|
8
|
+
* when constructing database queries. Concrete implementations must provide
|
|
9
|
+
* the specific query building logic for their statement type.
|
|
10
|
+
*
|
|
11
|
+
* @export
|
|
12
|
+
* @abstract
|
|
13
|
+
* @class Statement
|
|
14
|
+
* @template TableType - The type representing the table structure this statement operates on
|
|
15
|
+
*/
|
|
16
|
+
export declare abstract class Statement<TableType = any> {
|
|
17
|
+
protected db: Database;
|
|
18
|
+
/**
|
|
19
|
+
* Handler function to transform parameters before query execution.
|
|
20
|
+
* Set via the beforeQuery() method to enable parameter preprocessing.
|
|
21
|
+
*
|
|
22
|
+
* @protected
|
|
23
|
+
* @type {((params: any) => any) | null}
|
|
24
|
+
* @memberof Statement
|
|
25
|
+
*/
|
|
26
|
+
protected _beforeQuery: ((params: any) => any) | null;
|
|
27
|
+
/**
|
|
28
|
+
* Handler function to transform result rows after query execution.
|
|
29
|
+
* Set via the afterQuery() method to enable result postprocessing
|
|
30
|
+
* (e.g., data transformation, filtering, or augmenting returned records).
|
|
31
|
+
*
|
|
32
|
+
* @protected
|
|
33
|
+
* @type {((rows: any) => any) | null}
|
|
34
|
+
* @memberof Statement
|
|
35
|
+
*/
|
|
36
|
+
protected _afterQuery: ((rows: any) => any) | null;
|
|
37
|
+
/**
|
|
38
|
+
* Creates an instance of Statement.
|
|
39
|
+
* Initializes the statement with a database connection and sets up
|
|
40
|
+
* parameter transformation handlers to null.
|
|
41
|
+
*
|
|
42
|
+
* @param {Database} db - The database instance to execute queries against
|
|
43
|
+
* @memberof Statement
|
|
44
|
+
*/
|
|
45
|
+
constructor(db: Database);
|
|
46
|
+
/**
|
|
47
|
+
* Builds the SQL query string for this statement.
|
|
48
|
+
* Must be implemented by concrete statement classes to generate
|
|
49
|
+
* the appropriate SQL syntax for their operation type.
|
|
50
|
+
*
|
|
51
|
+
* @protected
|
|
52
|
+
* @abstract
|
|
53
|
+
* @return {string} The SQL query string
|
|
54
|
+
* @memberof Statement
|
|
55
|
+
*/
|
|
56
|
+
protected abstract buildQuery(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Builds the parameter object for this statement's query.
|
|
59
|
+
* Must be implemented by concrete statement classes to provide
|
|
60
|
+
* the parameters needed for their specific query.
|
|
61
|
+
*
|
|
62
|
+
* @protected
|
|
63
|
+
* @abstract
|
|
64
|
+
* @return {any} The parameters object for the query
|
|
65
|
+
* @memberof Statement
|
|
66
|
+
*/
|
|
67
|
+
protected abstract buildParameters(): any;
|
|
68
|
+
/**
|
|
69
|
+
* Executes the statement and returns the query result.
|
|
70
|
+
* Builds the query and parameters, applies any registered parameter handlers,
|
|
71
|
+
* and executes the query through the database connection.
|
|
72
|
+
*
|
|
73
|
+
* @template R - The type of QueryResult expected, defaults to QueryResult<any>
|
|
74
|
+
* @return {Promise<R | null>} Promise resolving to the query result or null
|
|
75
|
+
* @memberof Statement
|
|
76
|
+
*/
|
|
77
|
+
execute<R extends QueryResult<any> = QueryResult<any>>(): Promise<R | null>;
|
|
78
|
+
/**
|
|
79
|
+
* Executes the statement and returns the first record from the result.
|
|
80
|
+
* Useful for queries expected to return a single row, such as SELECT with LIMIT 1
|
|
81
|
+
* or queries filtering by unique identifiers.
|
|
82
|
+
*
|
|
83
|
+
* @return {Promise<Partial<TableType> | null>} Promise resolving to the first record or null if no records found
|
|
84
|
+
* @memberof Statement
|
|
85
|
+
*/
|
|
86
|
+
executeReturnSingle(): Promise<Partial<TableType> | null>;
|
|
87
|
+
/**
|
|
88
|
+
* Executes the statement and returns all records from the result.
|
|
89
|
+
* Returns an empty array if no records are found.
|
|
90
|
+
*
|
|
91
|
+
* @return {Promise<Partial<TableType>[]>} Promise resolving to an array of all records
|
|
92
|
+
* @memberof Statement
|
|
93
|
+
*/
|
|
94
|
+
executeReturnAll(): Promise<Partial<TableType>[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Executes the statement and returns the number of affected rows.
|
|
97
|
+
* Useful for INSERT, UPDATE, and DELETE operations where you need to know
|
|
98
|
+
* how many rows were modified.
|
|
99
|
+
*
|
|
100
|
+
* @return {Promise<number>} Promise resolving to the count of affected rows
|
|
101
|
+
* @memberof Statement
|
|
102
|
+
*/
|
|
103
|
+
executeReturnCount(): Promise<number>;
|
|
104
|
+
/**
|
|
105
|
+
* Registers a handler to transform parameters before query execution.
|
|
106
|
+
* The handler receives the parameters object and must return a transformed version.
|
|
107
|
+
* Useful for parameter validation, sanitization, or transformation before the query runs.
|
|
108
|
+
*
|
|
109
|
+
* @template T - The type of the parameters object
|
|
110
|
+
* @param {(params: T) => T} handler - The transformation function to apply before query execution
|
|
111
|
+
* @return {this} The statement instance for method chaining
|
|
112
|
+
* @memberof Statement
|
|
113
|
+
*/
|
|
114
|
+
beforeQuery<T>(handler: (params: T) => T): this;
|
|
115
|
+
/**
|
|
116
|
+
* Registers a handler to transform result rows after query execution.
|
|
117
|
+
* The handler receives the query result rows array and must return a transformed version.
|
|
118
|
+
* Useful for data transformation, field mapping, or post-processing of returned records.
|
|
119
|
+
*
|
|
120
|
+
* @template T - The type of the result rows array
|
|
121
|
+
* @param {(rows: T) => T} handler - The transformation function to apply to result rows
|
|
122
|
+
* @return {this} The statement instance for method chaining
|
|
123
|
+
* @memberof Statement
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* // Convert all date strings to Date objects
|
|
127
|
+
* statement.afterQuery((rows) =>
|
|
128
|
+
* rows.map(row => ({ ...row, created_at: new Date(row.created_at) }))
|
|
129
|
+
* )
|
|
130
|
+
*/
|
|
131
|
+
afterQuery<T>(handler: (rows: T) => T): this;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=statement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statement.d.ts","sourceRoot":"","sources":["../src/statement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAuB,WAAW,EAAE,MAAM,eAAe,CAAC;AAE3E;;;;;;;;;;;;;GAaG;AACH,8BAAsB,SAAS,CAAC,SAAS,GAAG,GAAG;IA8BjC,SAAS,CAAC,EAAE,EAAE,QAAQ;IA7BlC;;;;;;;OAOG;IACH,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC;IAEtD;;;;;;;;OAQG;IACH,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC;IAEnD;;;;;;;OAOG;gBACmB,EAAE,EAAE,QAAQ;IAKlC;;;;;;;;;OASG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,IAAI,MAAM;IAEvC;;;;;;;;;OASG;IACH,SAAS,CAAC,QAAQ,CAAC,eAAe,IAAI,GAAG;IAEzC;;;;;;;;OAQG;IACH,OAAO,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAgB3E;;;;;;;OAOG;IACG,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAK/D;;;;;;OAMG;IACG,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;IAKvD;;;;;;;OAOG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAK3C;;;;;;;;;OASG;IACH,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI;IAK/C;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI;CAI7C"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class for all SQL statement builders.
|
|
3
|
+
* Provides common functionality for building and executing database queries,
|
|
4
|
+
* including parameter handling, query execution, and result processing.
|
|
5
|
+
*
|
|
6
|
+
* This class implements the builder pattern, allowing for fluent method chaining
|
|
7
|
+
* when constructing database queries. Concrete implementations must provide
|
|
8
|
+
* the specific query building logic for their statement type.
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @abstract
|
|
12
|
+
* @class Statement
|
|
13
|
+
* @template TableType - The type representing the table structure this statement operates on
|
|
14
|
+
*/
|
|
15
|
+
export class Statement {
|
|
16
|
+
db;
|
|
17
|
+
/**
|
|
18
|
+
* Handler function to transform parameters before query execution.
|
|
19
|
+
* Set via the beforeQuery() method to enable parameter preprocessing.
|
|
20
|
+
*
|
|
21
|
+
* @protected
|
|
22
|
+
* @type {((params: any) => any) | null}
|
|
23
|
+
* @memberof Statement
|
|
24
|
+
*/
|
|
25
|
+
_beforeQuery;
|
|
26
|
+
/**
|
|
27
|
+
* Handler function to transform result rows after query execution.
|
|
28
|
+
* Set via the afterQuery() method to enable result postprocessing
|
|
29
|
+
* (e.g., data transformation, filtering, or augmenting returned records).
|
|
30
|
+
*
|
|
31
|
+
* @protected
|
|
32
|
+
* @type {((rows: any) => any) | null}
|
|
33
|
+
* @memberof Statement
|
|
34
|
+
*/
|
|
35
|
+
_afterQuery;
|
|
36
|
+
/**
|
|
37
|
+
* Creates an instance of Statement.
|
|
38
|
+
* Initializes the statement with a database connection and sets up
|
|
39
|
+
* parameter transformation handlers to null.
|
|
40
|
+
*
|
|
41
|
+
* @param {Database} db - The database instance to execute queries against
|
|
42
|
+
* @memberof Statement
|
|
43
|
+
*/
|
|
44
|
+
constructor(db) {
|
|
45
|
+
this.db = db;
|
|
46
|
+
this._beforeQuery = null;
|
|
47
|
+
this._afterQuery = null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Executes the statement and returns the query result.
|
|
51
|
+
* Builds the query and parameters, applies any registered parameter handlers,
|
|
52
|
+
* and executes the query through the database connection.
|
|
53
|
+
*
|
|
54
|
+
* @template R - The type of QueryResult expected, defaults to QueryResult<any>
|
|
55
|
+
* @return {Promise<R | null>} Promise resolving to the query result or null
|
|
56
|
+
* @memberof Statement
|
|
57
|
+
*/
|
|
58
|
+
execute() {
|
|
59
|
+
const options = {};
|
|
60
|
+
if (this._beforeQuery) {
|
|
61
|
+
options.beforeQuery = this._beforeQuery;
|
|
62
|
+
}
|
|
63
|
+
if (this._afterQuery) {
|
|
64
|
+
options.afterQuery = this._afterQuery;
|
|
65
|
+
}
|
|
66
|
+
return this.db.executeQuery(this.buildQuery(), this.buildParameters(), options);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Executes the statement and returns the first record from the result.
|
|
70
|
+
* Useful for queries expected to return a single row, such as SELECT with LIMIT 1
|
|
71
|
+
* or queries filtering by unique identifiers.
|
|
72
|
+
*
|
|
73
|
+
* @return {Promise<Partial<TableType> | null>} Promise resolving to the first record or null if no records found
|
|
74
|
+
* @memberof Statement
|
|
75
|
+
*/
|
|
76
|
+
async executeReturnSingle() {
|
|
77
|
+
const result = await this.execute();
|
|
78
|
+
return result?.records[0] || null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Executes the statement and returns all records from the result.
|
|
82
|
+
* Returns an empty array if no records are found.
|
|
83
|
+
*
|
|
84
|
+
* @return {Promise<Partial<TableType>[]>} Promise resolving to an array of all records
|
|
85
|
+
* @memberof Statement
|
|
86
|
+
*/
|
|
87
|
+
async executeReturnAll() {
|
|
88
|
+
const result = await this.execute();
|
|
89
|
+
return (result?.records || []);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Executes the statement and returns the number of affected rows.
|
|
93
|
+
* Useful for INSERT, UPDATE, and DELETE operations where you need to know
|
|
94
|
+
* how many rows were modified.
|
|
95
|
+
*
|
|
96
|
+
* @return {Promise<number>} Promise resolving to the count of affected rows
|
|
97
|
+
* @memberof Statement
|
|
98
|
+
*/
|
|
99
|
+
async executeReturnCount() {
|
|
100
|
+
const result = await this.execute();
|
|
101
|
+
return result?.rowCount || 0;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Registers a handler to transform parameters before query execution.
|
|
105
|
+
* The handler receives the parameters object and must return a transformed version.
|
|
106
|
+
* Useful for parameter validation, sanitization, or transformation before the query runs.
|
|
107
|
+
*
|
|
108
|
+
* @template T - The type of the parameters object
|
|
109
|
+
* @param {(params: T) => T} handler - The transformation function to apply before query execution
|
|
110
|
+
* @return {this} The statement instance for method chaining
|
|
111
|
+
* @memberof Statement
|
|
112
|
+
*/
|
|
113
|
+
beforeQuery(handler) {
|
|
114
|
+
this._beforeQuery = handler;
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Registers a handler to transform result rows after query execution.
|
|
119
|
+
* The handler receives the query result rows array and must return a transformed version.
|
|
120
|
+
* Useful for data transformation, field mapping, or post-processing of returned records.
|
|
121
|
+
*
|
|
122
|
+
* @template T - The type of the result rows array
|
|
123
|
+
* @param {(rows: T) => T} handler - The transformation function to apply to result rows
|
|
124
|
+
* @return {this} The statement instance for method chaining
|
|
125
|
+
* @memberof Statement
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* // Convert all date strings to Date objects
|
|
129
|
+
* statement.afterQuery((rows) =>
|
|
130
|
+
* rows.map(row => ({ ...row, created_at: new Date(row.created_at) }))
|
|
131
|
+
* )
|
|
132
|
+
*/
|
|
133
|
+
afterQuery(handler) {
|
|
134
|
+
this._afterQuery = handler;
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=statement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statement.js","sourceRoot":"","sources":["../src/statement.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAgB,SAAS;IA8BP;IA7BtB;;;;;;;OAOG;IACO,YAAY,CAAgC;IAEtD;;;;;;;;OAQG;IACO,WAAW,CAA8B;IAEnD;;;;;;;OAOG;IACH,YAAsB,EAAY;QAAZ,OAAE,GAAF,EAAE,CAAU;QAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IA0BD;;;;;;;;OAQG;IACH,OAAO;QACL,MAAM,OAAO,GAAwB,EAAE,CAAC;QACxC,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;QAC1C,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;QACxC,CAAC;QAED,OAAO,IAAI,CAAC,EAAE,CAAC,YAAY,CACzB,IAAI,CAAC,UAAU,EAAE,EACjB,IAAI,CAAC,eAAe,EAAE,EACtB,OAAO,CACa,CAAC;IACzB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,mBAAmB;QACvB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACpC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB;QACpB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAyB,CAAC;IACzD,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,kBAAkB;QACtB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;;;OASG;IACH,WAAW,CAAI,OAAyB;QACtC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAI,OAAuB;QACnC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FilterableStatement } from './filterable-statement.js';
|
|
2
|
+
import { Database } from './database.js';
|
|
3
|
+
/**
|
|
4
|
+
* Abstract statement builder for UPDATE operations.
|
|
5
|
+
* Extends FilterableStatement to provide functionality for updating existing records in database tables.
|
|
6
|
+
* Concrete database implementations must extend this class to provide database-specific
|
|
7
|
+
* UPDATE query construction and parameter handling.
|
|
8
|
+
*
|
|
9
|
+
* This class provides a fluent interface for building UPDATE statements with support
|
|
10
|
+
* for filtering which records to update and RETURNING clauses to retrieve updated data.
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @abstract
|
|
14
|
+
* @class UpdateStatement
|
|
15
|
+
* @extends {FilterableStatement<TableType, FilterType>}
|
|
16
|
+
* @template TableType - The type representing the table structure for updates
|
|
17
|
+
* @template FilterType - The type representing the filter criteria structure
|
|
18
|
+
*/
|
|
19
|
+
export declare abstract class UpdateStatement<TableType, FilterType> extends FilterableStatement<TableType, FilterType> {
|
|
20
|
+
/**
|
|
21
|
+
* Creates an instance of UpdateStatement.
|
|
22
|
+
* Initializes the statement with a table name and database connection.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} tableName - The name of the table to update
|
|
25
|
+
* @param {Database} db - The database instance to execute queries against
|
|
26
|
+
* @memberof UpdateStatement
|
|
27
|
+
*/
|
|
28
|
+
constructor(tableName: string, db: Database);
|
|
29
|
+
/**
|
|
30
|
+
* Sets the values to be updated in the table.
|
|
31
|
+
* Accepts a partial object where keys represent column names and values
|
|
32
|
+
* represent the new data. Only the specified columns will be updated.
|
|
33
|
+
*
|
|
34
|
+
* @param {Partial<TableType>} values - Object containing column names and new values
|
|
35
|
+
* @return {this} The statement instance for method chaining
|
|
36
|
+
* @memberof UpdateStatement
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Update user fields
|
|
40
|
+
* statement.values({
|
|
41
|
+
* name: 'Jane Doe',
|
|
42
|
+
* email: 'jane@example.com',
|
|
43
|
+
* updated_at: new Date()
|
|
44
|
+
* })
|
|
45
|
+
*/
|
|
46
|
+
values(values: Partial<TableType>): this;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=update-statement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-statement.d.ts","sourceRoot":"","sources":["../src/update-statement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,8BAAsB,eAAe,CAAC,SAAS,EAAE,UAAU,CAAE,SAAQ,mBAAmB,CACtF,SAAS,EACT,UAAU,CACX;IACC;;;;;;;OAOG;gBACS,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ;IAI3C;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI;CAIzC"}
|