@antelopejs/postgres 0.0.1-stage → 0.2.1
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/LICENSE +190 -0
- package/README.md +152 -0
- package/dist/config.d.ts +38 -0
- package/dist/config.js +91 -0
- package/dist/config.js.map +1 -0
- package/dist/connection.d.ts +14 -0
- package/dist/connection.js +128 -0
- package/dist/connection.js.map +1 -0
- package/dist/implementations/catalog/index.d.ts +7 -0
- package/dist/implementations/catalog/index.js +60 -0
- package/dist/implementations/catalog/index.js.map +1 -0
- package/dist/implementations/database/changes.d.ts +19 -0
- package/dist/implementations/database/changes.js +100 -0
- package/dist/implementations/database/changes.js.map +1 -0
- package/dist/implementations/database/coerce.d.ts +15 -0
- package/dist/implementations/database/coerce.js +195 -0
- package/dist/implementations/database/coerce.js.map +1 -0
- package/dist/implementations/database/context.d.ts +32 -0
- package/dist/implementations/database/context.js +50 -0
- package/dist/implementations/database/context.js.map +1 -0
- package/dist/implementations/database/cursors.d.ts +16 -0
- package/dist/implementations/database/cursors.js +269 -0
- package/dist/implementations/database/cursors.js.map +1 -0
- package/dist/implementations/database/ddl.d.ts +62 -0
- package/dist/implementations/database/ddl.js +355 -0
- package/dist/implementations/database/ddl.js.map +1 -0
- package/dist/implementations/database/expression.d.ts +7 -0
- package/dist/implementations/database/expression.js +30 -0
- package/dist/implementations/database/expression.js.map +1 -0
- package/dist/implementations/database/external-catalog.d.ts +37 -0
- package/dist/implementations/database/external-catalog.js +96 -0
- package/dist/implementations/database/external-catalog.js.map +1 -0
- package/dist/implementations/database/external-column-profile.d.ts +18 -0
- package/dist/implementations/database/external-column-profile.js +223 -0
- package/dist/implementations/database/external-column-profile.js.map +1 -0
- package/dist/implementations/database/external-declarations.d.ts +9 -0
- package/dist/implementations/database/external-declarations.js +67 -0
- package/dist/implementations/database/external-declarations.js.map +1 -0
- package/dist/implementations/database/external-discovery.d.ts +39 -0
- package/dist/implementations/database/external-discovery.js +219 -0
- package/dist/implementations/database/external-discovery.js.map +1 -0
- package/dist/implementations/database/external-errors.d.ts +20 -0
- package/dist/implementations/database/external-errors.js +67 -0
- package/dist/implementations/database/external-errors.js.map +1 -0
- package/dist/implementations/database/external-measures.d.ts +11 -0
- package/dist/implementations/database/external-measures.js +82 -0
- package/dist/implementations/database/external-measures.js.map +1 -0
- package/dist/implementations/database/external-payload.d.ts +32 -0
- package/dist/implementations/database/external-payload.js +206 -0
- package/dist/implementations/database/external-payload.js.map +1 -0
- package/dist/implementations/database/external-profile.d.ts +4 -0
- package/dist/implementations/database/external-profile.js +129 -0
- package/dist/implementations/database/external-profile.js.map +1 -0
- package/dist/implementations/database/external-reference.d.ts +2 -0
- package/dist/implementations/database/external-reference.js +49 -0
- package/dist/implementations/database/external-reference.js.map +1 -0
- package/dist/implementations/database/external-refusals.d.ts +5 -0
- package/dist/implementations/database/external-refusals.js +23 -0
- package/dist/implementations/database/external-refusals.js.map +1 -0
- package/dist/implementations/database/external-rows.d.ts +2 -0
- package/dist/implementations/database/external-rows.js +81 -0
- package/dist/implementations/database/external-rows.js.map +1 -0
- package/dist/implementations/database/external-sample.d.ts +9 -0
- package/dist/implementations/database/external-sample.js +29 -0
- package/dist/implementations/database/external-sample.js.map +1 -0
- package/dist/implementations/database/external-schema.d.ts +3 -0
- package/dist/implementations/database/external-schema.js +111 -0
- package/dist/implementations/database/external-schema.js.map +1 -0
- package/dist/implementations/database/external-types.d.ts +37 -0
- package/dist/implementations/database/external-types.js +387 -0
- package/dist/implementations/database/external-types.js.map +1 -0
- package/dist/implementations/database/external-writes.d.ts +3 -0
- package/dist/implementations/database/external-writes.js +298 -0
- package/dist/implementations/database/external-writes.js.map +1 -0
- package/dist/implementations/database/feed-pipeline.d.ts +12 -0
- package/dist/implementations/database/feed-pipeline.js +92 -0
- package/dist/implementations/database/feed-pipeline.js.map +1 -0
- package/dist/implementations/database/feeds.d.ts +34 -0
- package/dist/implementations/database/feeds.js +338 -0
- package/dist/implementations/database/feeds.js.map +1 -0
- package/dist/implementations/database/fields.d.ts +37 -0
- package/dist/implementations/database/fields.js +114 -0
- package/dist/implementations/database/fields.js.map +1 -0
- package/dist/implementations/database/identifier.d.ts +8 -0
- package/dist/implementations/database/identifier.js +62 -0
- package/dist/implementations/database/identifier.js.map +1 -0
- package/dist/implementations/database/instances.d.ts +4 -0
- package/dist/implementations/database/instances.js +57 -0
- package/dist/implementations/database/instances.js.map +1 -0
- package/dist/implementations/database/introspect.d.ts +3 -0
- package/dist/implementations/database/introspect.js +36 -0
- package/dist/implementations/database/introspect.js.map +1 -0
- package/dist/implementations/database/jsonb.d.ts +29 -0
- package/dist/implementations/database/jsonb.js +54 -0
- package/dist/implementations/database/jsonb.js.map +1 -0
- package/dist/implementations/database/listener.d.ts +3 -0
- package/dist/implementations/database/listener.js +93 -0
- package/dist/implementations/database/listener.js.map +1 -0
- package/dist/implementations/database/migrate.d.ts +6 -0
- package/dist/implementations/database/migrate.js +282 -0
- package/dist/implementations/database/migrate.js.map +1 -0
- package/dist/implementations/database/payload.d.ts +24 -0
- package/dist/implementations/database/payload.js +113 -0
- package/dist/implementations/database/payload.js.map +1 -0
- package/dist/implementations/database/pipeline.d.ts +10 -0
- package/dist/implementations/database/pipeline.js +56 -0
- package/dist/implementations/database/pipeline.js.map +1 -0
- package/dist/implementations/database/query.d.ts +11 -0
- package/dist/implementations/database/query.js +189 -0
- package/dist/implementations/database/query.js.map +1 -0
- package/dist/implementations/database/readings.d.ts +17 -0
- package/dist/implementations/database/readings.js +133 -0
- package/dist/implementations/database/readings.js.map +1 -0
- package/dist/implementations/database/reaper.d.ts +6 -0
- package/dist/implementations/database/reaper.js +121 -0
- package/dist/implementations/database/reaper.js.map +1 -0
- package/dist/implementations/database/relation.d.ts +65 -0
- package/dist/implementations/database/relation.js +237 -0
- package/dist/implementations/database/relation.js.map +1 -0
- package/dist/implementations/database/result.d.ts +4 -0
- package/dist/implementations/database/result.js +70 -0
- package/dist/implementations/database/result.js.map +1 -0
- package/dist/implementations/database/row-source.d.ts +64 -0
- package/dist/implementations/database/row-source.js +279 -0
- package/dist/implementations/database/row-source.js.map +1 -0
- package/dist/implementations/database/schema.d.ts +15 -0
- package/dist/implementations/database/schema.js +143 -0
- package/dist/implementations/database/schema.js.map +1 -0
- package/dist/implementations/database/selection.d.ts +18 -0
- package/dist/implementations/database/selection.js +129 -0
- package/dist/implementations/database/selection.js.map +1 -0
- package/dist/implementations/database/sql.d.ts +24 -0
- package/dist/implementations/database/sql.js +48 -0
- package/dist/implementations/database/sql.js.map +1 -0
- package/dist/implementations/database/stage.d.ts +22 -0
- package/dist/implementations/database/stage.js +76 -0
- package/dist/implementations/database/stage.js.map +1 -0
- package/dist/implementations/database/stages-aggregate.d.ts +11 -0
- package/dist/implementations/database/stages-aggregate.js +112 -0
- package/dist/implementations/database/stages-aggregate.js.map +1 -0
- package/dist/implementations/database/stages-array.d.ts +2 -0
- package/dist/implementations/database/stages-array.js +162 -0
- package/dist/implementations/database/stages-array.js.map +1 -0
- package/dist/implementations/database/stages-core.d.ts +2 -0
- package/dist/implementations/database/stages-core.js +107 -0
- package/dist/implementations/database/stages-core.js.map +1 -0
- package/dist/implementations/database/stages-date.d.ts +2 -0
- package/dist/implementations/database/stages-date.js +65 -0
- package/dist/implementations/database/stages-date.js.map +1 -0
- package/dist/implementations/database/stages-group.d.ts +5 -0
- package/dist/implementations/database/stages-group.js +151 -0
- package/dist/implementations/database/stages-group.js.map +1 -0
- package/dist/implementations/database/stages-join.d.ts +2 -0
- package/dist/implementations/database/stages-join.js +162 -0
- package/dist/implementations/database/stages-join.js.map +1 -0
- package/dist/implementations/database/stages-numeric.d.ts +2 -0
- package/dist/implementations/database/stages-numeric.js +152 -0
- package/dist/implementations/database/stages-numeric.js.map +1 -0
- package/dist/implementations/database/stages-object.d.ts +2 -0
- package/dist/implementations/database/stages-object.js +81 -0
- package/dist/implementations/database/stages-object.js.map +1 -0
- package/dist/implementations/database/stages-projection.d.ts +2 -0
- package/dist/implementations/database/stages-projection.js +75 -0
- package/dist/implementations/database/stages-projection.js.map +1 -0
- package/dist/implementations/database/stages-rows.d.ts +2 -0
- package/dist/implementations/database/stages-rows.js +101 -0
- package/dist/implementations/database/stages-rows.js.map +1 -0
- package/dist/implementations/database/stages-selection.d.ts +2 -0
- package/dist/implementations/database/stages-selection.js +146 -0
- package/dist/implementations/database/stages-selection.js.map +1 -0
- package/dist/implementations/database/stages-string.d.ts +2 -0
- package/dist/implementations/database/stages-string.js +101 -0
- package/dist/implementations/database/stages-string.js.map +1 -0
- package/dist/implementations/database/subquery.d.ts +4 -0
- package/dist/implementations/database/subquery.js +49 -0
- package/dist/implementations/database/subquery.js.map +1 -0
- package/dist/implementations/database/types.d.ts +37 -0
- package/dist/implementations/database/types.js +57 -0
- package/dist/implementations/database/types.js.map +1 -0
- package/dist/implementations/database/utils.d.ts +16 -0
- package/dist/implementations/database/utils.js +38 -0
- package/dist/implementations/database/utils.js.map +1 -0
- package/dist/implementations/database/value.d.ts +10 -0
- package/dist/implementations/database/value.js +153 -0
- package/dist/implementations/database/value.js.map +1 -0
- package/dist/implementations/database/writes-atomic.d.ts +6 -0
- package/dist/implementations/database/writes-atomic.js +93 -0
- package/dist/implementations/database/writes-atomic.js.map +1 -0
- package/dist/implementations/database/writes-identity.d.ts +4 -0
- package/dist/implementations/database/writes-identity.js +181 -0
- package/dist/implementations/database/writes-identity.js.map +1 -0
- package/dist/implementations/database/writes-insert.d.ts +2 -0
- package/dist/implementations/database/writes-insert.js +136 -0
- package/dist/implementations/database/writes-insert.js.map +1 -0
- package/dist/implementations/database/writes-shared.d.ts +36 -0
- package/dist/implementations/database/writes-shared.js +64 -0
- package/dist/implementations/database/writes-shared.js.map +1 -0
- package/dist/implementations/database/writes.d.ts +16 -0
- package/dist/implementations/database/writes.js +52 -0
- package/dist/implementations/database/writes.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +6 -0
- package/dist/logger.js.map +1 -0
- package/dist/test/antelope.test.d.ts +2 -0
- package/dist/test/antelope.test.js +89 -0
- package/dist/test/antelope.test.js.map +1 -0
- package/dist/test/atomic.test.d.ts +1 -0
- package/dist/test/atomic.test.js +132 -0
- package/dist/test/atomic.test.js.map +1 -0
- package/dist/test/catalog-owned.test.d.ts +1 -0
- package/dist/test/catalog-owned.test.js +17 -0
- package/dist/test/catalog-owned.test.js.map +1 -0
- package/dist/test/contention.test.d.ts +1 -0
- package/dist/test/contention.test.js +183 -0
- package/dist/test/contention.test.js.map +1 -0
- package/dist/test/indexes.test.d.ts +1 -0
- package/dist/test/indexes.test.js +311 -0
- package/dist/test/indexes.test.js.map +1 -0
- package/dist/test/unit/changes.spec.d.ts +1 -0
- package/dist/test/unit/changes.spec.js +103 -0
- package/dist/test/unit/changes.spec.js.map +1 -0
- package/dist/test/unit/coerce.spec.d.ts +1 -0
- package/dist/test/unit/coerce.spec.js +162 -0
- package/dist/test/unit/coerce.spec.js.map +1 -0
- package/dist/test/unit/config.spec.d.ts +1 -0
- package/dist/test/unit/config.spec.js +123 -0
- package/dist/test/unit/config.spec.js.map +1 -0
- package/dist/test/unit/connection.spec.d.ts +1 -0
- package/dist/test/unit/connection.spec.js +171 -0
- package/dist/test/unit/connection.spec.js.map +1 -0
- package/dist/test/unit/cursors.spec.d.ts +1 -0
- package/dist/test/unit/cursors.spec.js +823 -0
- package/dist/test/unit/cursors.spec.js.map +1 -0
- package/dist/test/unit/ddl.spec.d.ts +1 -0
- package/dist/test/unit/ddl.spec.js +571 -0
- package/dist/test/unit/ddl.spec.js.map +1 -0
- package/dist/test/unit/expression-array.spec.d.ts +1 -0
- package/dist/test/unit/expression-array.spec.js +488 -0
- package/dist/test/unit/expression-array.spec.js.map +1 -0
- package/dist/test/unit/expression-date.spec.d.ts +1 -0
- package/dist/test/unit/expression-date.spec.js +329 -0
- package/dist/test/unit/expression-date.spec.js.map +1 -0
- package/dist/test/unit/expression-numeric.spec.d.ts +1 -0
- package/dist/test/unit/expression-numeric.spec.js +362 -0
- package/dist/test/unit/expression-numeric.spec.js.map +1 -0
- package/dist/test/unit/expression-object.spec.d.ts +1 -0
- package/dist/test/unit/expression-object.spec.js +230 -0
- package/dist/test/unit/expression-object.spec.js.map +1 -0
- package/dist/test/unit/expression-stages.spec.d.ts +1 -0
- package/dist/test/unit/expression-stages.spec.js +82 -0
- package/dist/test/unit/expression-stages.spec.js.map +1 -0
- package/dist/test/unit/expression-string.spec.d.ts +1 -0
- package/dist/test/unit/expression-string.spec.js +249 -0
- package/dist/test/unit/expression-string.spec.js.map +1 -0
- package/dist/test/unit/expression.spec.d.ts +1 -0
- package/dist/test/unit/expression.spec.js +449 -0
- package/dist/test/unit/expression.spec.js.map +1 -0
- package/dist/test/unit/external-comparisons.spec.d.ts +1 -0
- package/dist/test/unit/external-comparisons.spec.js +147 -0
- package/dist/test/unit/external-comparisons.spec.js.map +1 -0
- package/dist/test/unit/external-types.spec.d.ts +1 -0
- package/dist/test/unit/external-types.spec.js +228 -0
- package/dist/test/unit/external-types.spec.js.map +1 -0
- package/dist/test/unit/feeds.spec.d.ts +1 -0
- package/dist/test/unit/feeds.spec.js +374 -0
- package/dist/test/unit/feeds.spec.js.map +1 -0
- package/dist/test/unit/fields.spec.d.ts +1 -0
- package/dist/test/unit/fields.spec.js +79 -0
- package/dist/test/unit/fields.spec.js.map +1 -0
- package/dist/test/unit/identifier.spec.d.ts +1 -0
- package/dist/test/unit/identifier.spec.js +50 -0
- package/dist/test/unit/identifier.spec.js.map +1 -0
- package/dist/test/unit/payload.spec.d.ts +1 -0
- package/dist/test/unit/payload.spec.js +278 -0
- package/dist/test/unit/payload.spec.js.map +1 -0
- package/dist/test/unit/pipeline-aggregate.spec.d.ts +1 -0
- package/dist/test/unit/pipeline-aggregate.spec.js +199 -0
- package/dist/test/unit/pipeline-aggregate.spec.js.map +1 -0
- package/dist/test/unit/pipeline-fixture.d.ts +79 -0
- package/dist/test/unit/pipeline-fixture.js +277 -0
- package/dist/test/unit/pipeline-fixture.js.map +1 -0
- package/dist/test/unit/pipeline-group.spec.d.ts +1 -0
- package/dist/test/unit/pipeline-group.spec.js +390 -0
- package/dist/test/unit/pipeline-group.spec.js.map +1 -0
- package/dist/test/unit/pipeline-join.spec.d.ts +1 -0
- package/dist/test/unit/pipeline-join.spec.js +165 -0
- package/dist/test/unit/pipeline-join.spec.js.map +1 -0
- package/dist/test/unit/pipeline-lookup.spec.d.ts +1 -0
- package/dist/test/unit/pipeline-lookup.spec.js +268 -0
- package/dist/test/unit/pipeline-lookup.spec.js.map +1 -0
- package/dist/test/unit/pipeline-projection.spec.d.ts +1 -0
- package/dist/test/unit/pipeline-projection.spec.js +183 -0
- package/dist/test/unit/pipeline-projection.spec.js.map +1 -0
- package/dist/test/unit/pipeline-rows.spec.d.ts +1 -0
- package/dist/test/unit/pipeline-rows.spec.js +321 -0
- package/dist/test/unit/pipeline-rows.spec.js.map +1 -0
- package/dist/test/unit/pipeline-selection.spec.d.ts +1 -0
- package/dist/test/unit/pipeline-selection.spec.js +257 -0
- package/dist/test/unit/pipeline-selection.spec.js.map +1 -0
- package/dist/test/unit/pipeline-stages.spec.d.ts +1 -0
- package/dist/test/unit/pipeline-stages.spec.js +226 -0
- package/dist/test/unit/pipeline-stages.spec.js.map +1 -0
- package/dist/test/unit/pipeline.spec.d.ts +1 -0
- package/dist/test/unit/pipeline.spec.js +72 -0
- package/dist/test/unit/pipeline.spec.js.map +1 -0
- package/dist/test/unit/query.spec.d.ts +1 -0
- package/dist/test/unit/query.spec.js +212 -0
- package/dist/test/unit/query.spec.js.map +1 -0
- package/dist/test/unit/reaper.spec.d.ts +1 -0
- package/dist/test/unit/reaper.spec.js +122 -0
- package/dist/test/unit/reaper.spec.js.map +1 -0
- package/dist/test/unit/relation.spec.d.ts +1 -0
- package/dist/test/unit/relation.spec.js +348 -0
- package/dist/test/unit/relation.spec.js.map +1 -0
- package/dist/test/unit/result.spec.d.ts +1 -0
- package/dist/test/unit/result.spec.js +128 -0
- package/dist/test/unit/result.spec.js.map +1 -0
- package/dist/test/unit/row-source.spec.d.ts +1 -0
- package/dist/test/unit/row-source.spec.js +141 -0
- package/dist/test/unit/row-source.spec.js.map +1 -0
- package/dist/test/unit/schema.spec.d.ts +1 -0
- package/dist/test/unit/schema.spec.js +44 -0
- package/dist/test/unit/schema.spec.js.map +1 -0
- package/dist/test/unit/selection.spec.d.ts +1 -0
- package/dist/test/unit/selection.spec.js +182 -0
- package/dist/test/unit/selection.spec.js.map +1 -0
- package/dist/test/unit/spec-fixture.d.ts +11 -0
- package/dist/test/unit/spec-fixture.js +71 -0
- package/dist/test/unit/spec-fixture.js.map +1 -0
- package/dist/test/unit/sql.spec.d.ts +1 -0
- package/dist/test/unit/sql.spec.js +38 -0
- package/dist/test/unit/sql.spec.js.map +1 -0
- package/dist/test/unit/subquery.spec.d.ts +1 -0
- package/dist/test/unit/subquery.spec.js +154 -0
- package/dist/test/unit/subquery.spec.js.map +1 -0
- package/dist/test/unit/types.spec.d.ts +1 -0
- package/dist/test/unit/types.spec.js +39 -0
- package/dist/test/unit/types.spec.js.map +1 -0
- package/dist/test/unit/utils.spec.d.ts +1 -0
- package/dist/test/unit/utils.spec.js +22 -0
- package/dist/test/unit/utils.spec.js.map +1 -0
- package/dist/test/unit/value.spec.d.ts +1 -0
- package/dist/test/unit/value.spec.js +195 -0
- package/dist/test/unit/value.spec.js.map +1 -0
- package/dist/test/unit/writes-atomic.spec.d.ts +1 -0
- package/dist/test/unit/writes-atomic.spec.js +66 -0
- package/dist/test/unit/writes-atomic.spec.js.map +1 -0
- package/dist/test/unit/writes-insert.spec.d.ts +1 -0
- package/dist/test/unit/writes-insert.spec.js +270 -0
- package/dist/test/unit/writes-insert.spec.js.map +1 -0
- package/dist/test/unit/writes-replace.spec.d.ts +1 -0
- package/dist/test/unit/writes-replace.spec.js +100 -0
- package/dist/test/unit/writes-replace.spec.js.map +1 -0
- package/dist/test/unit/writes-target.spec.d.ts +1 -0
- package/dist/test/unit/writes-target.spec.js +118 -0
- package/dist/test/unit/writes-target.spec.js.map +1 -0
- package/dist/test/unit/writes-update.spec.d.ts +1 -0
- package/dist/test/unit/writes-update.spec.js +297 -0
- package/dist/test/unit/writes-update.spec.js.map +1 -0
- package/dist/test-external/catalog.test.d.ts +1 -0
- package/dist/test-external/catalog.test.js +348 -0
- package/dist/test-external/catalog.test.js.map +1 -0
- package/dist/test-external/fixture.d.ts +7 -0
- package/dist/test-external/fixture.js +163 -0
- package/dist/test-external/fixture.js.map +1 -0
- package/dist/test-external/native.test.d.ts +1 -0
- package/dist/test-external/native.test.js +132 -0
- package/dist/test-external/native.test.js.map +1 -0
- package/dist/test-external/reads.test.d.ts +1 -0
- package/dist/test-external/reads.test.js +232 -0
- package/dist/test-external/reads.test.js.map +1 -0
- package/dist/test-external/refusals.test.d.ts +1 -0
- package/dist/test-external/refusals.test.js +93 -0
- package/dist/test-external/refusals.test.js.map +1 -0
- package/dist/test-external/registration.test.d.ts +1 -0
- package/dist/test-external/registration.test.js +127 -0
- package/dist/test-external/registration.test.js.map +1 -0
- package/dist/test-external/sales.d.ts +5 -0
- package/dist/test-external/sales.js +126 -0
- package/dist/test-external/sales.js.map +1 -0
- package/dist/test-external/startup.test.d.ts +1 -0
- package/dist/test-external/startup.test.js +15 -0
- package/dist/test-external/startup.test.js.map +1 -0
- package/dist/test-external/writes.test.d.ts +1 -0
- package/dist/test-external/writes.test.js +315 -0
- package/dist/test-external/writes.test.js.map +1 -0
- package/package.json +77 -7
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const chai_1 = require("chai");
|
|
7
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
|
+
const relation_1 = require("../../implementations/database/relation");
|
|
9
|
+
const types_1 = require("../../implementations/database/types");
|
|
10
|
+
const pipeline_fixture_1 = require("./pipeline-fixture");
|
|
11
|
+
const AGE_OVER_25 = '("t0"."age" > ($1::double precision))';
|
|
12
|
+
const AGE_CLAUSE = `(${AGE_OVER_25})`;
|
|
13
|
+
const OFFSET_BOUND = "((CASE WHEN ($1::double precision) IS NOT NULL THEN" +
|
|
14
|
+
" LEAST(GREATEST(trunc(($1::double precision)), 0), 2147483647) END)::bigint)";
|
|
15
|
+
const COUNT_BOUND = "((CASE WHEN ($2::double precision) IS NOT NULL THEN" +
|
|
16
|
+
" LEAST(GREATEST(trunc(($2::double precision)), 0), 2147483647) END)::bigint)";
|
|
17
|
+
const SINGLE_ROW = "((1)::bigint)";
|
|
18
|
+
function Reshaped() {
|
|
19
|
+
return (0, relation_1.SetProjection)((0, pipeline_fixture_1.NewTable)(), {
|
|
20
|
+
sql: '"t0"."_extra"',
|
|
21
|
+
type: (0, types_1.JsonOf)({ name: types_1.TEXT, age: types_1.FLOAT }),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
describe("the filter stage", () => {
|
|
25
|
+
it("absorbs a predicate into WHERE", () => {
|
|
26
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().filter((doc) => doc.key("age").gt(25)));
|
|
27
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([AGE_CLAUSE]);
|
|
28
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([25]);
|
|
29
|
+
});
|
|
30
|
+
it("parenthesises the condition it absorbs, so a conjunct cannot rebind it", () => {
|
|
31
|
+
const sql = (0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)()
|
|
32
|
+
.filter((doc) => doc.key("age").gt(25))
|
|
33
|
+
.filter((doc) => doc.key("isActive").eq(true)));
|
|
34
|
+
(0, chai_1.expect)(sql).to.contain(`WHERE ${AGE_CLAUSE} AND (`);
|
|
35
|
+
});
|
|
36
|
+
it("reads the declared column rather than a materialized document", () => {
|
|
37
|
+
const sql = (0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().filter((doc) => doc.key("age").gt(25)));
|
|
38
|
+
(0, chai_1.expect)(sql).to.contain(`WHERE ${AGE_CLAUSE}`);
|
|
39
|
+
(0, chai_1.expect)(sql).to.not.contain("jsonb_build_object");
|
|
40
|
+
});
|
|
41
|
+
it("keeps the relation row-shaped", () => {
|
|
42
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().filter((doc) => doc.key("age").gt(25)));
|
|
43
|
+
(0, chai_1.expect)(relation.projection).to.equal(undefined);
|
|
44
|
+
(0, chai_1.expect)(relation.origin?.tableId).to.equal(pipeline_fixture_1.TABLE_ID);
|
|
45
|
+
});
|
|
46
|
+
it("absorbs a second predicate beside the first", () => {
|
|
47
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)()
|
|
48
|
+
.filter((doc) => doc.key("age").gt(25))
|
|
49
|
+
.filter((doc) => doc.key("isActive").eq(true)));
|
|
50
|
+
(0, chai_1.expect)(relation.where).to.have.lengthOf(2);
|
|
51
|
+
(0, chai_1.expect)((0, relation_1.Render)(relation)).to.contain(" AND ");
|
|
52
|
+
});
|
|
53
|
+
it("wraps after a slice and still reaches the column", () => {
|
|
54
|
+
const sql = (0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)()
|
|
55
|
+
.slice(0, 2)
|
|
56
|
+
.filter((doc) => doc.key("age").gt(25)));
|
|
57
|
+
(0, chai_1.expect)(sql).to.contain('WHERE (("t1"."age" > ($3::double precision)))');
|
|
58
|
+
(0, chai_1.expect)(sql).to.not.contain("jsonb_build_object");
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
describe("the orderBy stage", () => {
|
|
62
|
+
it("sorts ascending when no direction is named", () => {
|
|
63
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().orderBy("name"))).to.contain('ORDER BY "t0"."name" ASC');
|
|
64
|
+
});
|
|
65
|
+
it("spells a descending sort", () => {
|
|
66
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().orderBy("age", "desc"))).to.contain('ORDER BY "t0"."age" DESC');
|
|
67
|
+
});
|
|
68
|
+
it("names no null ordering, so a btree index still serves the sort", () => {
|
|
69
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().orderBy("name", "asc"))).to.not.contain("NULLS");
|
|
70
|
+
});
|
|
71
|
+
it("lets a later sort dominate an earlier one", () => {
|
|
72
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().orderBy("name", "asc").orderBy("age", "desc"))).to.contain('ORDER BY "t0"."age" DESC, "t0"."name" ASC');
|
|
73
|
+
});
|
|
74
|
+
it("collapses a whole chain into one clause", () => {
|
|
75
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().orderBy("name", "asc").orderBy("age", "desc"));
|
|
76
|
+
(0, chai_1.expect)(relation.orderBy).to.have.lengthOf(2);
|
|
77
|
+
(0, chai_1.expect)(relation.from).to.equal(pipeline_fixture_1.TABLE);
|
|
78
|
+
});
|
|
79
|
+
it("expands a declared multi-field index in its declared order", () => {
|
|
80
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().orderBy("byNameAge", "desc"))).to.contain('ORDER BY "t0"."name" DESC, "t0"."age" DESC');
|
|
81
|
+
});
|
|
82
|
+
it("sorts an undeclared key out of the overflow column", () => {
|
|
83
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().orderBy("nickname"))).to.contain(`ORDER BY ("t0"."_extra" -> 'nickname') ASC`);
|
|
84
|
+
});
|
|
85
|
+
it("treats the name as a single field once the relation is reshaped", () => {
|
|
86
|
+
const sql = (0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().orderBy("byNameAge", "asc"), Reshaped());
|
|
87
|
+
(0, chai_1.expect)(sql).to.contain(`ORDER BY ("t1"."value" -> 'byNameAge') ASC`);
|
|
88
|
+
(0, chai_1.expect)(sql).to.not.contain('"t1"."age"');
|
|
89
|
+
});
|
|
90
|
+
it("wraps after a limit, since the sort would otherwise reorder it", () => {
|
|
91
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().slice(0, 2).orderBy("name", "asc"));
|
|
92
|
+
(0, chai_1.expect)(relation.alias).to.equal("t1");
|
|
93
|
+
(0, chai_1.expect)(relation.orderBy).to.deep.equal([
|
|
94
|
+
{ sql: '"t1"."name"', descending: false },
|
|
95
|
+
]);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
describe("the row bounds slice and nth emit", () => {
|
|
99
|
+
it("hands every bound to the same clamp, since the value itself is a parameter", () => {
|
|
100
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().slice(Number.NaN, Number.POSITIVE_INFINITY));
|
|
101
|
+
(0, chai_1.expect)(relation.offset).to.equal(OFFSET_BOUND);
|
|
102
|
+
(0, chai_1.expect)(relation.limit).to.equal(COUNT_BOUND);
|
|
103
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([
|
|
104
|
+
Number.NaN,
|
|
105
|
+
Number.POSITIVE_INFINITY,
|
|
106
|
+
]);
|
|
107
|
+
});
|
|
108
|
+
it("bounds both ends and truncates, so no bound raises 22003 or 22023", () => {
|
|
109
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().slice(0, 1e20)).relation.limit).to.contain("LEAST(GREATEST(trunc(($2::double precision)), 0), 2147483647)");
|
|
110
|
+
});
|
|
111
|
+
it("leaves an unreadable bound NULL, which reads as no bound rather than none", () => {
|
|
112
|
+
const limit = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().slice(0, 2)).relation.limit;
|
|
113
|
+
(0, chai_1.expect)(limit).to.contain("CASE WHEN ($2::double precision) IS NOT NULL");
|
|
114
|
+
(0, chai_1.expect)(limit).to.not.contain("GREATEST(($2::double precision), 0)");
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
describe("the slice stage", () => {
|
|
118
|
+
it("bounds both ends and hands the driver a bigint", () => {
|
|
119
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().slice(1, 2));
|
|
120
|
+
(0, chai_1.expect)(relation.offset).to.equal(OFFSET_BOUND);
|
|
121
|
+
(0, chai_1.expect)(relation.limit).to.equal(COUNT_BOUND);
|
|
122
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([1, 2]);
|
|
123
|
+
});
|
|
124
|
+
it("sets only the offset when no count is given", () => {
|
|
125
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().slice(3));
|
|
126
|
+
(0, chai_1.expect)(relation.offset).to.equal(OFFSET_BOUND);
|
|
127
|
+
(0, chai_1.expect)(relation.limit).to.equal(undefined);
|
|
128
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([3]);
|
|
129
|
+
});
|
|
130
|
+
it("leaves the relation yielding a stream", () => {
|
|
131
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().slice(0, 2)).relation.single).to.equal(false);
|
|
132
|
+
});
|
|
133
|
+
it("wraps a second slice rather than overwriting the first", () => {
|
|
134
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().slice(0, 4).slice(1, 2));
|
|
135
|
+
(0, chai_1.expect)(relation.alias).to.equal("t1");
|
|
136
|
+
(0, chai_1.expect)(relation.from).to.contain("LIMIT");
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
describe("the nth stage", () => {
|
|
140
|
+
it("takes one row at the given offset", () => {
|
|
141
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().nth(0));
|
|
142
|
+
(0, chai_1.expect)(relation.offset).to.equal(OFFSET_BOUND);
|
|
143
|
+
(0, chai_1.expect)(relation.limit).to.equal(SINGLE_ROW);
|
|
144
|
+
});
|
|
145
|
+
it("marks the relation as yielding exactly one row", () => {
|
|
146
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().nth(0)).relation.single).to.equal(true);
|
|
147
|
+
});
|
|
148
|
+
it("wraps when an offset is already set", () => {
|
|
149
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().slice(2).nth(0));
|
|
150
|
+
(0, chai_1.expect)(relation.alias).to.equal("t1");
|
|
151
|
+
(0, chai_1.expect)(relation.single).to.equal(true);
|
|
152
|
+
(0, chai_1.expect)(relation.from).to.contain("OFFSET");
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
const RIGHT_SOURCE = `FROM ${pipeline_fixture_1.OTHER_TABLE} AS "t1"`;
|
|
156
|
+
const UNION_SELECTS = 2;
|
|
157
|
+
const PRODUCT_DOCUMENT = (0, pipeline_fixture_1.ProductDocument)("t1");
|
|
158
|
+
const PLAIN_UNION = `SELECT "t2"."value" AS "value" FROM ((SELECT ${pipeline_fixture_1.DOCUMENT}` +
|
|
159
|
+
` AS "value" ${pipeline_fixture_1.FROM_TABLE}) UNION ALL (SELECT ${PRODUCT_DOCUMENT}` +
|
|
160
|
+
` AS "value" ${RIGHT_SOURCE} WHERE ("t1"."_instance" = ($1::text)))) AS "t2"`;
|
|
161
|
+
const SELF_UNION = `SELECT "t2"."value" AS "value" FROM ((SELECT ${pipeline_fixture_1.DOCUMENT}` +
|
|
162
|
+
` AS "value" ${pipeline_fixture_1.FROM_TABLE} WHERE (("t0"."age" > ($1::double precision))))` +
|
|
163
|
+
` UNION ALL (SELECT ${(0, pipeline_fixture_1.PeopleDocument)("t1")} AS "value" FROM ${pipeline_fixture_1.TABLE} AS "t1"` +
|
|
164
|
+
` WHERE ("t1"."_instance" = ($2::text))` +
|
|
165
|
+
` AND (("t1"."age" > ($3::double precision))))) AS "t2"`;
|
|
166
|
+
const SCALAR_UNION = `SELECT "t2"."value" AS "value" FROM ((SELECT to_jsonb("t0"."name")` +
|
|
167
|
+
` AS "value" ${pipeline_fixture_1.FROM_TABLE}) UNION ALL (SELECT ${PRODUCT_DOCUMENT}` +
|
|
168
|
+
` AS "value" ${RIGHT_SOURCE} WHERE ("t1"."_instance" = ($1::text)))) AS "t2"`;
|
|
169
|
+
const DISTINCT_SCALAR_SIDE = `SELECT DISTINCT to_jsonb("t0"."name") AS "value"`;
|
|
170
|
+
const MIXED_SCALAR_UNION = `SELECT "t2"."value" AS "value" FROM ((SELECT to_jsonb("t0"."name")` +
|
|
171
|
+
` AS "value" ${pipeline_fixture_1.FROM_TABLE}) UNION ALL (SELECT to_jsonb("t1"."age")` +
|
|
172
|
+
` AS "value" FROM ${pipeline_fixture_1.TABLE} AS "t1"` +
|
|
173
|
+
` WHERE ("t1"."_instance" = ($1::text)))) AS "t2"`;
|
|
174
|
+
const SAME_SCALAR_UNION = `SELECT "t2"."value" AS "value" FROM ((SELECT "t0"."age" AS "value"` +
|
|
175
|
+
` ${pipeline_fixture_1.FROM_TABLE}) UNION ALL (SELECT "t1"."price" AS "value" ${RIGHT_SOURCE}` +
|
|
176
|
+
` WHERE ("t1"."_instance" = ($1::text)))) AS "t2"`;
|
|
177
|
+
const PROJECTED_TIMESTAMP = `(CASE WHEN jsonb_typeof("t1"."meta") = 'string'` +
|
|
178
|
+
` AND pg_input_is_valid(("t1"."meta" #>> '{}'), 'timestamptz')` +
|
|
179
|
+
` THEN (("t1"."meta" #>> '{}')::timestamptz) END)`;
|
|
180
|
+
const TIMESTAMP_UNION = `SELECT "t2"."value" AS "value" FROM ((SELECT "t0"."joined" AS "value"` +
|
|
181
|
+
` ${pipeline_fixture_1.FROM_TABLE}) UNION ALL (SELECT ${PROJECTED_TIMESTAMP} AS "value"` +
|
|
182
|
+
` FROM ${pipeline_fixture_1.TABLE} AS "t1"` +
|
|
183
|
+
` WHERE ("t1"."_instance" = ($1::text)))) AS "t2"`;
|
|
184
|
+
const WIDENED_KEYS = [
|
|
185
|
+
"_id",
|
|
186
|
+
"_instance",
|
|
187
|
+
"age",
|
|
188
|
+
"isActive",
|
|
189
|
+
"joined",
|
|
190
|
+
"meta",
|
|
191
|
+
"name",
|
|
192
|
+
"price",
|
|
193
|
+
];
|
|
194
|
+
function UnionShape(relation) {
|
|
195
|
+
const projection = relation.projection;
|
|
196
|
+
(0, node_assert_1.default)(projection, "a union must leave a projection behind");
|
|
197
|
+
const shape = (0, types_1.ShapeOf)(projection.type);
|
|
198
|
+
(0, node_assert_1.default)(shape, "a union of two documents must stay shaped");
|
|
199
|
+
return shape;
|
|
200
|
+
}
|
|
201
|
+
describe("the union stage", () => {
|
|
202
|
+
it("concatenates two single-column selects under one alias", () => {
|
|
203
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)()))).to.equal(PLAIN_UNION);
|
|
204
|
+
});
|
|
205
|
+
it("concatenates with UNION ALL, so duplicates survive", () => {
|
|
206
|
+
const sql = (0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)()));
|
|
207
|
+
(0, chai_1.expect)(sql).to.contain("UNION ALL");
|
|
208
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Occurrences)(sql, "UNION")).to.equal((0, pipeline_fixture_1.Occurrences)(sql, "UNION ALL"));
|
|
209
|
+
});
|
|
210
|
+
it("keeps the two sides apart when both read the same table", () => {
|
|
211
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)()
|
|
212
|
+
.filter((doc) => doc.key("age").gt(25))
|
|
213
|
+
.union((0, pipeline_fixture_1.Root)().filter((doc) => doc.key("age").gt(30))))).to.equal(SELF_UNION);
|
|
214
|
+
});
|
|
215
|
+
it("parenthesises each side, since either may carry its own bounds", () => {
|
|
216
|
+
const sql = (0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().orderBy("name").union((0, pipeline_fixture_1.Other)().slice(0, 2)));
|
|
217
|
+
(0, chai_1.expect)(sql).to.contain("FROM ((SELECT ");
|
|
218
|
+
(0, chai_1.expect)(sql).to.contain(") UNION ALL (SELECT ");
|
|
219
|
+
(0, chai_1.expect)(sql).to.contain(`)) AS "t2"`);
|
|
220
|
+
(0, chai_1.expect)(sql).to.contain('ORDER BY "t0"."name" ASC)');
|
|
221
|
+
});
|
|
222
|
+
it("renders each side exactly once", () => {
|
|
223
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)()));
|
|
224
|
+
const sql = (0, relation_1.Render)(relation);
|
|
225
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Occurrences)(sql, pipeline_fixture_1.FROM_TABLE)).to.equal(1);
|
|
226
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Occurrences)(sql, RIGHT_SOURCE)).to.equal(1);
|
|
227
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([""]);
|
|
228
|
+
});
|
|
229
|
+
it("materializes a row-mode side through toJson rather than wrapping it", () => {
|
|
230
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)()));
|
|
231
|
+
(0, chai_1.expect)(relation.from).to.contain("jsonb_strip_nulls(jsonb_build_object(");
|
|
232
|
+
(0, chai_1.expect)(relation.from).to.contain(`${pipeline_fixture_1.FROM_TABLE})`);
|
|
233
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Occurrences)(relation.from, "SELECT")).to.equal(UNION_SELECTS);
|
|
234
|
+
});
|
|
235
|
+
it("compiles the right side's own stages against the same context", () => {
|
|
236
|
+
const sql = (0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)().filter((p) => p.key("price").gt(10))));
|
|
237
|
+
(0, chai_1.expect)(sql).to.contain('WHERE ("t1"."_instance" = ($1::text))');
|
|
238
|
+
(0, chai_1.expect)(sql).to.contain('AND (("t1"."price" > ($2::double precision)))');
|
|
239
|
+
});
|
|
240
|
+
it("reads the nested query directly rather than as a correlated subquery", () => {
|
|
241
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)())).subqueries).to.equal(0);
|
|
242
|
+
});
|
|
243
|
+
it("references every parameter it binds, and binds every one it references", () => {
|
|
244
|
+
const ledgers = [
|
|
245
|
+
(0, pipeline_fixture_1.ReadParamLedger)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)()))),
|
|
246
|
+
(0, pipeline_fixture_1.ReadParamLedger)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)().filter((p) => p.key("price").gt(10))))),
|
|
247
|
+
(0, pipeline_fixture_1.ReadParamLedger)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)()).union((0, pipeline_fixture_1.Other)()))),
|
|
248
|
+
(0, pipeline_fixture_1.ReadParamLedger)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().slice(0, 2).union((0, pipeline_fixture_1.Other)()).count())),
|
|
249
|
+
];
|
|
250
|
+
for (const ledger of ledgers) {
|
|
251
|
+
(0, chai_1.expect)(ledger.referenced).to.deep.equal(ledger.bound);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
it("widens the two shapes instead of intersecting them", () => {
|
|
255
|
+
const shape = UnionShape((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)())).relation);
|
|
256
|
+
(0, chai_1.expect)(Object.keys(shape).sort()).to.deep.equal(WIDENED_KEYS);
|
|
257
|
+
});
|
|
258
|
+
it("keeps the type of a key only one side declares", () => {
|
|
259
|
+
const shape = UnionShape((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)())).relation);
|
|
260
|
+
(0, chai_1.expect)(shape.age).to.deep.equal(types_1.FLOAT);
|
|
261
|
+
(0, chai_1.expect)(shape.isActive).to.deep.equal(types_1.BOOL);
|
|
262
|
+
(0, chai_1.expect)(shape.price).to.deep.equal(types_1.FLOAT);
|
|
263
|
+
(0, chai_1.expect)(shape.name).to.deep.equal(types_1.TEXT);
|
|
264
|
+
});
|
|
265
|
+
it("spells a scalar side as jsonb, which is what a row-mode side projects", () => {
|
|
266
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)()
|
|
267
|
+
.map((doc) => doc.key("name"))
|
|
268
|
+
.union((0, pipeline_fixture_1.Other)()))).to.equal(SCALAR_UNION);
|
|
269
|
+
});
|
|
270
|
+
it("spells a scalar side as jsonb whichever stage projected it", () => {
|
|
271
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().key("name").union((0, pipeline_fixture_1.Other)()))).to.equal(SCALAR_UNION);
|
|
272
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().distinct("name").union((0, pipeline_fixture_1.Other)()))).to.contain(DISTINCT_SCALAR_SIDE);
|
|
273
|
+
});
|
|
274
|
+
it("spells two scalar sides of different types as jsonb", () => {
|
|
275
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)()
|
|
276
|
+
.map((doc) => doc.key("name"))
|
|
277
|
+
.union((0, pipeline_fixture_1.Root)().map((doc) => doc.key("age"))))).to.equal(MIXED_SCALAR_UNION);
|
|
278
|
+
});
|
|
279
|
+
it("leaves two sides of one scalar type on their own columns", () => {
|
|
280
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)()
|
|
281
|
+
.map((doc) => doc.key("age"))
|
|
282
|
+
.union((0, pipeline_fixture_1.Other)().map((product) => product.key("price"))));
|
|
283
|
+
(0, chai_1.expect)((0, relation_1.Render)(relation)).to.equal(SAME_SCALAR_UNION);
|
|
284
|
+
(0, chai_1.expect)(relation.projection?.type).to.deep.equal(types_1.FLOAT);
|
|
285
|
+
});
|
|
286
|
+
it("keeps the more specific of two scalar sides, casting the other to it", () => {
|
|
287
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)()
|
|
288
|
+
.map((doc) => doc.key("joined"))
|
|
289
|
+
.union((0, pipeline_fixture_1.Root)().map((doc) => doc.key("meta"))));
|
|
290
|
+
(0, chai_1.expect)(relation.projection?.type).to.deep.equal(types_1.TIMESTAMP);
|
|
291
|
+
(0, chai_1.expect)((0, relation_1.Render)(relation)).to.equal(TIMESTAMP_UNION);
|
|
292
|
+
});
|
|
293
|
+
it("yields a stream rather than a single row", () => {
|
|
294
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)()));
|
|
295
|
+
(0, chai_1.expect)(relation.single).to.equal(false);
|
|
296
|
+
(0, chai_1.expect)(relation.origin).to.equal(undefined);
|
|
297
|
+
(0, chai_1.expect)(relation.projection?.sql).to.equal('"t2"."value"');
|
|
298
|
+
});
|
|
299
|
+
it("wraps a following count, since the union is already a projection", () => {
|
|
300
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)()).count());
|
|
301
|
+
(0, chai_1.expect)(relation.alias).to.equal("t3");
|
|
302
|
+
(0, chai_1.expect)(relation.from).to.contain("UNION ALL");
|
|
303
|
+
(0, chai_1.expect)(relation.projection?.sql).to.contain("count(*)");
|
|
304
|
+
(0, chai_1.expect)(relation.single).to.equal(true);
|
|
305
|
+
});
|
|
306
|
+
it("wraps a following filter, which then reads the union's own column", () => {
|
|
307
|
+
const sql = (0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)()
|
|
308
|
+
.union((0, pipeline_fixture_1.Other)())
|
|
309
|
+
.cast()
|
|
310
|
+
.filter((doc) => doc.key("age").gt(25)));
|
|
311
|
+
(0, chai_1.expect)(sql).to.contain(`"t3"."value" -> 'age'`);
|
|
312
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Occurrences)(sql, "UNION ALL")).to.equal(1);
|
|
313
|
+
});
|
|
314
|
+
it("chains, nesting one union inside the next", () => {
|
|
315
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().union((0, pipeline_fixture_1.Other)()).union((0, pipeline_fixture_1.Other)()));
|
|
316
|
+
(0, chai_1.expect)(relation.alias).to.equal("t4");
|
|
317
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Occurrences)(relation.from, "UNION ALL")).to.equal(2);
|
|
318
|
+
(0, chai_1.expect)(Object.keys(UnionShape(relation)).sort()).to.deep.equal(WIDENED_KEYS);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
//# sourceMappingURL=pipeline-rows.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-rows.spec.js","sourceRoot":"","sources":["../../../src/test/unit/pipeline-rows.spec.ts"],"names":[],"mappings":";;;;;AAAA,+BAA8B;AAC9B,8DAAiC;AAEjC,sEAIiD;AACjD,gEAQ8C;AAC9C,yDAgB4B;AAE5B,MAAM,WAAW,GAAG,uCAAuC,CAAC;AAC5D,MAAM,UAAU,GAAG,IAAI,WAAW,GAAG,CAAC;AACtC,MAAM,YAAY,GAChB,qDAAqD;IACrD,8EAA8E,CAAC;AACjF,MAAM,WAAW,GACf,qDAAqD;IACrD,8EAA8E,CAAC;AACjF,MAAM,UAAU,GAAG,eAAe,CAAC;AAEnC,SAAS,QAAQ;IACf,OAAO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C,IAAI,CAAC,CAAC;QACtC,IAAA,aAAM,EAAC,IAAA,8BAAW,EAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5D,IAAA,aAAM,EAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAC5D,YAAY,CACb,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const chai_1 = require("chai");
|
|
4
|
+
const common_1 = require("@antelopejs/interface-database/common");
|
|
5
|
+
const relation_1 = require("../../implementations/database/relation");
|
|
6
|
+
const pipeline_fixture_1 = require("./pipeline-fixture");
|
|
7
|
+
const ID_KEY = '("t0"."_id" = ($1::text))';
|
|
8
|
+
const AGE_KEYS = '("t0"."age" IN (($1::double precision), ($2::double precision)))';
|
|
9
|
+
const ONE_AGE_KEY = '("t0"."age" IN (($1::double precision)))';
|
|
10
|
+
const ID_KEYS = '("t0"."_id" IN (($1::text), ($2::text)))';
|
|
11
|
+
const ACTIVE_KEY = '("t0"."isActive" IN (($1::boolean)))';
|
|
12
|
+
const COMPOUND_KEY = '(("t0"."name", "t0"."age") IN ((($1::text), ($2::double precision))))';
|
|
13
|
+
const OVERFLOW_KEY = `(("t0"."_extra" -> 'nickname') IN (to_jsonb(($1::text))))`;
|
|
14
|
+
const NO_MATCH = "(FALSE)";
|
|
15
|
+
const LOW_BOUND = '("t0"."age" >= ($1::double precision))';
|
|
16
|
+
const HIGH_BOUND = '("t0"."age" < ($2::double precision))';
|
|
17
|
+
const NUMERIC_TEXT_PATTERN = `'^\\s*[+-]?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)([eE][+-]?[0-9]+)?\\s*$'`;
|
|
18
|
+
function AsNumber(param) {
|
|
19
|
+
return (`(CASE WHEN (${param}::text) ~ ${NUMERIC_TEXT_PATTERN}` +
|
|
20
|
+
` THEN (((${param}::text))::double precision) END)`);
|
|
21
|
+
}
|
|
22
|
+
const NUMERIC_TEXT_KEY = `("t0"."age" IN (${AsNumber("$1")}))`;
|
|
23
|
+
const LOW_TEXT_BOUND = `("t0"."age" >= ${AsNumber("$1")})`;
|
|
24
|
+
const HIGH_TEXT_BOUND = `("t0"."age" < ${AsNumber("$2")})`;
|
|
25
|
+
const COMPOUND_INDEX = "byNameAge";
|
|
26
|
+
const ARRAY_FIELD = "skills";
|
|
27
|
+
const COMPOUND_ARRAY_INDEX = "byNameSkills";
|
|
28
|
+
function Contains(param) {
|
|
29
|
+
return `("t0"."skills" @> to_jsonb((${param}::text)))`;
|
|
30
|
+
}
|
|
31
|
+
const ONE_SKILL = `(${Contains("$1")})`;
|
|
32
|
+
const TWO_SKILLS = `(${Contains("$1")} OR ${Contains("$2")})`;
|
|
33
|
+
function Recorded(stage, index, ...args) {
|
|
34
|
+
return [(0, common_1.QueryStage)(stage, { index }, ...args)];
|
|
35
|
+
}
|
|
36
|
+
describe("the get stage", () => {
|
|
37
|
+
it("absorbs a primary-key comparison into WHERE", () => {
|
|
38
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().get("k"));
|
|
39
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([ID_KEY]);
|
|
40
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal(["k"]);
|
|
41
|
+
});
|
|
42
|
+
it("reads the primary-key column rather than the overflow one", () => {
|
|
43
|
+
const sql = (0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().get("k"));
|
|
44
|
+
(0, chai_1.expect)(sql).to.contain(`WHERE ${ID_KEY}`);
|
|
45
|
+
(0, chai_1.expect)(sql).to.not.contain("-> '_id'");
|
|
46
|
+
(0, chai_1.expect)(sql).to.not.contain("jsonb_build_object");
|
|
47
|
+
});
|
|
48
|
+
it("requires the key, naming the stage", () => {
|
|
49
|
+
(0, chai_1.expect)(() => (0, pipeline_fixture_1.ApplyRaw)(Recorded("get", undefined))).to.throw("Stage 'get' requires an operand at position 0");
|
|
50
|
+
});
|
|
51
|
+
it("marks the relation as yielding exactly one row", () => {
|
|
52
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().get("k"));
|
|
53
|
+
(0, chai_1.expect)(relation.single).to.equal(true);
|
|
54
|
+
(0, chai_1.expect)(relation.origin?.tableId).to.equal(pipeline_fixture_1.TABLE_ID);
|
|
55
|
+
});
|
|
56
|
+
it("answers undefined rather than null for a row that is not there", () => {
|
|
57
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().get("k")).relation.absent).to.equal(undefined);
|
|
58
|
+
});
|
|
59
|
+
it("leaves every other relation answering null", () => {
|
|
60
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.NewTable)().absent).to.equal(null);
|
|
61
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().nth(0)).relation.absent).to.equal(null);
|
|
62
|
+
});
|
|
63
|
+
it("keeps single and the absent value through a projection", () => {
|
|
64
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().get("k").pluck("name", "age"));
|
|
65
|
+
(0, chai_1.expect)(relation.single).to.equal(true);
|
|
66
|
+
(0, chai_1.expect)(relation.absent).to.equal(undefined);
|
|
67
|
+
(0, chai_1.expect)((0, relation_1.Render)(relation)).to.contain(`WHERE ${ID_KEY}`);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
describe("the getAll stage", () => {
|
|
71
|
+
it("matches a key list against one declared column", () => {
|
|
72
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().getAll([25, 30], "age"));
|
|
73
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([AGE_KEYS]);
|
|
74
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([25, 30]);
|
|
75
|
+
});
|
|
76
|
+
it("names the bare column, so the btree index over it stays reachable", () => {
|
|
77
|
+
const sql = (0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().getAll([25, 30], "age"));
|
|
78
|
+
(0, chai_1.expect)(sql).to.contain(`WHERE ${AGE_KEYS}`);
|
|
79
|
+
(0, chai_1.expect)(sql).to.not.contain("jsonb_build_object");
|
|
80
|
+
});
|
|
81
|
+
it("treats a single key as a list of one", () => {
|
|
82
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().getAll(30, "age")).relation.where).to.deep.equal([
|
|
83
|
+
ONE_AGE_KEY,
|
|
84
|
+
]);
|
|
85
|
+
});
|
|
86
|
+
it("compares a boolean key without a guard or a second cast", () => {
|
|
87
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().getAll(false, "isActive")).relation.where).to.deep.equal([ACTIVE_KEY]);
|
|
88
|
+
});
|
|
89
|
+
it("reads a null key against a boolean column as no answer, not as false", () => {
|
|
90
|
+
const { relation, context } = (0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", "isActive", null));
|
|
91
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([
|
|
92
|
+
`("t0"."isActive" IN ((CASE WHEN jsonb_typeof('null'::jsonb) = 'boolean' THEN (('null'::jsonb #>> '{}')::boolean) END)))`,
|
|
93
|
+
]);
|
|
94
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([]);
|
|
95
|
+
});
|
|
96
|
+
it("reads a document key against a boolean column as no answer, not as true", () => {
|
|
97
|
+
const { relation } = (0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", "isActive", { a: 1 }));
|
|
98
|
+
(0, chai_1.expect)(relation.where[0]).to.contain("jsonb_typeof");
|
|
99
|
+
(0, chai_1.expect)(relation.where[0]).to.not.contain("<> ALL");
|
|
100
|
+
});
|
|
101
|
+
it("reads a key as the column's type rather than casting it", () => {
|
|
102
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().getAll("3000", "age")).relation.where).to.deep.equal([
|
|
103
|
+
NUMERIC_TEXT_KEY,
|
|
104
|
+
]);
|
|
105
|
+
});
|
|
106
|
+
it("resolves the primary key when no index is named", () => {
|
|
107
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().getAll(["a", "b"])).relation.where).to.deep.equal([
|
|
108
|
+
ID_KEYS,
|
|
109
|
+
]);
|
|
110
|
+
});
|
|
111
|
+
it("matches nothing rather than emitting an empty IN", () => {
|
|
112
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().getAll([], "age"));
|
|
113
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([NO_MATCH]);
|
|
114
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([]);
|
|
115
|
+
});
|
|
116
|
+
it("matches a compound index row-wise, in its declared field order", () => {
|
|
117
|
+
const { relation, context } = (0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", COMPOUND_INDEX, [["Alice", 30]]));
|
|
118
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([COMPOUND_KEY]);
|
|
119
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal(["Alice", 30]);
|
|
120
|
+
});
|
|
121
|
+
it("rejects a compound key of the wrong arity, naming the index", () => {
|
|
122
|
+
(0, chai_1.expect)(() => (0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", COMPOUND_INDEX, "Alice"))).to.throw("The 'byNameAge' index takes a key of 2 values, received a string");
|
|
123
|
+
(0, chai_1.expect)(() => (0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", COMPOUND_INDEX, [["Alice"]]))).to.throw("The 'byNameAge' index takes a key of 2 values, received 1 values");
|
|
124
|
+
});
|
|
125
|
+
it("names the index and the position of a hole inside a compound key", () => {
|
|
126
|
+
(0, chai_1.expect)(() => (0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", COMPOUND_INDEX, [["Alice", undefined]]))).to.throw("The 'byNameAge' index takes a value for every field, and has none at position 1");
|
|
127
|
+
});
|
|
128
|
+
it("falls back to the overflow column for an undeclared field", () => {
|
|
129
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().getAll("Al", "nickname"));
|
|
130
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([OVERFLOW_KEY]);
|
|
131
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal(["Al"]);
|
|
132
|
+
});
|
|
133
|
+
it("leaves the relation a row-shaped stream", () => {
|
|
134
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().getAll(["a"], "name"));
|
|
135
|
+
(0, chai_1.expect)(relation.single).to.equal(false);
|
|
136
|
+
(0, chai_1.expect)(relation.projection).to.equal(undefined);
|
|
137
|
+
(0, chai_1.expect)(relation.origin?.tableId).to.equal(pipeline_fixture_1.TABLE_ID);
|
|
138
|
+
});
|
|
139
|
+
it("composes with a filter as a second conjunct", () => {
|
|
140
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)()
|
|
141
|
+
.getAll([25, 30], "age")
|
|
142
|
+
.filter((doc) => doc.key("isActive").eq(true)));
|
|
143
|
+
(0, chai_1.expect)(relation.where).to.have.lengthOf(2);
|
|
144
|
+
(0, chai_1.expect)(relation.where[0]).to.equal(AGE_KEYS);
|
|
145
|
+
});
|
|
146
|
+
it("wraps after a slice and still reaches the column", () => {
|
|
147
|
+
const stages = [
|
|
148
|
+
...(0, pipeline_fixture_1.Stages)((0, pipeline_fixture_1.Root)().slice(0, 2)),
|
|
149
|
+
...(0, pipeline_fixture_1.Stages)((0, pipeline_fixture_1.Root)().getAll([30], "age")),
|
|
150
|
+
];
|
|
151
|
+
const sql = (0, relation_1.Render)((0, pipeline_fixture_1.ApplyRaw)(stages).relation);
|
|
152
|
+
(0, chai_1.expect)(sql).to.contain('WHERE ("t1"."age" IN (($3::double precision)))');
|
|
153
|
+
(0, chai_1.expect)(sql).to.not.contain("jsonb_build_object");
|
|
154
|
+
});
|
|
155
|
+
it("references every parameter it binds, and binds every one it references", () => {
|
|
156
|
+
const ledgers = [
|
|
157
|
+
(0, pipeline_fixture_1.ReadParamLedger)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().getAll(["a", "b", "c"]))),
|
|
158
|
+
(0, pipeline_fixture_1.ReadParamLedger)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().getAll([], "age"))),
|
|
159
|
+
(0, pipeline_fixture_1.ReadParamLedger)((0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", COMPOUND_INDEX, [
|
|
160
|
+
["Alice", 30],
|
|
161
|
+
["Bob", 41],
|
|
162
|
+
]))),
|
|
163
|
+
(0, pipeline_fixture_1.ReadParamLedger)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().get("k").pluck("name"))),
|
|
164
|
+
];
|
|
165
|
+
for (const ledger of ledgers) {
|
|
166
|
+
(0, chai_1.expect)(ledger.referenced).to.deep.equal(ledger.bound);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
describe("the getAll stage over a field declared as an array", () => {
|
|
171
|
+
it("matches by containment, which is what a multi index is created for", () => {
|
|
172
|
+
const { relation, context } = (0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", ARRAY_FIELD, "laptop"), (0, pipeline_fixture_1.NewProfiles)());
|
|
173
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([ONE_SKILL]);
|
|
174
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal(["laptop"]);
|
|
175
|
+
});
|
|
176
|
+
it("disjoins a key list, which the planner reads as a bitmap OR", () => {
|
|
177
|
+
const { relation, context } = (0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", ARRAY_FIELD, ["laptop", "phone"]), (0, pipeline_fixture_1.NewProfiles)());
|
|
178
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([TWO_SKILLS]);
|
|
179
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal(["laptop", "phone"]);
|
|
180
|
+
});
|
|
181
|
+
it("wraps the containment in no case, which a gin index cannot see through", () => {
|
|
182
|
+
const sql = (0, relation_1.Render)((0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", ARRAY_FIELD, "laptop"), (0, pipeline_fixture_1.NewProfiles)())
|
|
183
|
+
.relation);
|
|
184
|
+
(0, chai_1.expect)(sql).to.not.contain("CASE");
|
|
185
|
+
(0, chai_1.expect)(sql).to.not.contain("jsonb_build_object");
|
|
186
|
+
});
|
|
187
|
+
it("still matches nothing rather than emitting an empty disjunction", () => {
|
|
188
|
+
const { relation } = (0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", ARRAY_FIELD, []), (0, pipeline_fixture_1.NewProfiles)());
|
|
189
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([NO_MATCH]);
|
|
190
|
+
});
|
|
191
|
+
it("refuses a compound index that keys on an array field beside others", () => {
|
|
192
|
+
(0, chai_1.expect)(() => (0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", COMPOUND_ARRAY_INDEX, [["Alice", "laptop"]]), (0, pipeline_fixture_1.NewProfiles)())).to.throw(`The '${COMPOUND_ARRAY_INDEX}' index keys on an array field beside others`);
|
|
193
|
+
});
|
|
194
|
+
it("references every parameter it binds, and binds every one it references", () => {
|
|
195
|
+
const ledger = (0, pipeline_fixture_1.ReadParamLedger)((0, pipeline_fixture_1.ApplyRaw)(Recorded("getAll", ARRAY_FIELD, ["laptop", "phone"]), (0, pipeline_fixture_1.NewProfiles)()));
|
|
196
|
+
(0, chai_1.expect)(ledger.referenced).to.deep.equal(ledger.bound);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
describe("the between stage", () => {
|
|
200
|
+
it("bounds one field low-inclusive and high-exclusive, in that order", () => {
|
|
201
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().between("age", 0, 10));
|
|
202
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([LOW_BOUND, HIGH_BOUND]);
|
|
203
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([0, 10]);
|
|
204
|
+
});
|
|
205
|
+
it("joins the two bounds as separate conjuncts", () => {
|
|
206
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.Sql)((0, pipeline_fixture_1.Root)().between("age", 0, 10))).to.contain(`WHERE ${LOW_BOUND} AND ${HIGH_BOUND}`);
|
|
207
|
+
});
|
|
208
|
+
it("reads a date bound as an instant", () => {
|
|
209
|
+
const low = new Date("2023-01-01T00:00:00.000Z");
|
|
210
|
+
const high = new Date("2023-02-01T00:00:00.000Z");
|
|
211
|
+
const { relation, context } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().between("joined", low, high));
|
|
212
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([
|
|
213
|
+
'("t0"."joined" >= ($1::timestamptz))',
|
|
214
|
+
'("t0"."joined" < ($2::timestamptz))',
|
|
215
|
+
]);
|
|
216
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([low, high]);
|
|
217
|
+
});
|
|
218
|
+
it("ranges over an undeclared field through the overflow column", () => {
|
|
219
|
+
const { relation } = (0, pipeline_fixture_1.ApplyRaw)(Recorded("between", "nickname", "a", "b"));
|
|
220
|
+
(0, chai_1.expect)(relation.where).to.deep.equal([
|
|
221
|
+
`(("t0"."_extra" -> 'nickname') >= to_jsonb(($1::text)))`,
|
|
222
|
+
`(("t0"."_extra" -> 'nickname') < to_jsonb(($2::text)))`,
|
|
223
|
+
]);
|
|
224
|
+
});
|
|
225
|
+
it("refuses a compound index by name", () => {
|
|
226
|
+
(0, chai_1.expect)(() => (0, pipeline_fixture_1.ApplyRaw)(Recorded("between", COMPOUND_INDEX, 1, 2))).to.throw(`The 'between' stage ranges over one field, but '${COMPOUND_INDEX}' names 2`);
|
|
227
|
+
});
|
|
228
|
+
it("requires both bounds, naming the stage and the missing one", () => {
|
|
229
|
+
(0, chai_1.expect)(() => (0, pipeline_fixture_1.ApplyRaw)(Recorded("between", "age", 0))).to.throw("Stage 'between' requires an operand at position 1");
|
|
230
|
+
(0, chai_1.expect)(() => (0, pipeline_fixture_1.ApplyRaw)(Recorded("between", "age"))).to.throw("Stage 'between' requires an operand at position 0");
|
|
231
|
+
});
|
|
232
|
+
it("requires the field to range over", () => {
|
|
233
|
+
(0, chai_1.expect)(() => (0, pipeline_fixture_1.ApplyRaw)(Recorded("between", undefined, 0, 10))).to.throw("The 'between' stage is missing its field name");
|
|
234
|
+
});
|
|
235
|
+
it("reads a text bound as the column's type rather than casting it", () => {
|
|
236
|
+
(0, chai_1.expect)((0, pipeline_fixture_1.ApplyRaw)(Recorded("between", "age", "0", "10")).relation.where).to.deep.equal([LOW_TEXT_BOUND, HIGH_TEXT_BOUND]);
|
|
237
|
+
});
|
|
238
|
+
it("reads a null bound as a stored value, not as an open bound", () => {
|
|
239
|
+
const { relation, context } = (0, pipeline_fixture_1.ApplyRaw)(Recorded("between", "age", 0, null));
|
|
240
|
+
(0, chai_1.expect)(relation.where).to.have.lengthOf(2);
|
|
241
|
+
(0, chai_1.expect)(relation.where[1]).to.contain("'null'::jsonb");
|
|
242
|
+
(0, chai_1.expect)(context.params.all()).to.deep.equal([0]);
|
|
243
|
+
});
|
|
244
|
+
it("references every parameter it binds, and binds every one it references", () => {
|
|
245
|
+
const ledger = (0, pipeline_fixture_1.ReadParamLedger)((0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().between("age", 0, 10)));
|
|
246
|
+
(0, chai_1.expect)(ledger.referenced).to.deep.equal(ledger.bound);
|
|
247
|
+
});
|
|
248
|
+
it("leaves the relation a row-shaped stream", () => {
|
|
249
|
+
const { relation } = (0, pipeline_fixture_1.Apply)((0, pipeline_fixture_1.Root)().between("age", 0, 10));
|
|
250
|
+
(0, chai_1.expect)(relation.single).to.equal(false);
|
|
251
|
+
(0, chai_1.expect)(relation.origin?.tableId).to.equal(pipeline_fixture_1.TABLE_ID);
|
|
252
|
+
});
|
|
253
|
+
it("refuses a field declared as an array, which no range orders", () => {
|
|
254
|
+
(0, chai_1.expect)(() => (0, pipeline_fixture_1.ApplyRaw)(Recorded("between", ARRAY_FIELD, "a", "b"), (0, pipeline_fixture_1.NewProfiles)())).to.throw(`The 'between' stage ranges over one value, but '${ARRAY_FIELD}' holds a list`);
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
//# sourceMappingURL=pipeline-selection.spec.js.map
|