@fastybird/smart-panel-backend 1.1.0-alpha.64 → 1.1.0-alpha.66
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/dist/app.module.d.ts +3 -1
- package/dist/app.module.js +5 -1
- package/dist/app.module.js.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/common/database/sqlite-data-source.d.ts +37 -0
- package/dist/common/database/sqlite-data-source.js +2131 -0
- package/dist/common/database/sqlite-data-source.js.map +1 -0
- package/dist/dataSource.d.ts +3 -1
- package/dist/dataSource.js +3 -3
- package/dist/dataSource.js.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/migrations/1000000000002-AddTokenLastUsedAt.js +1 -0
- package/dist/migrations/1000000000002-AddTokenLastUsedAt.js.map +1 -1
- package/dist/migrations/1000000000027-AddVirtualProducerBindings.d.ts +7 -0
- package/dist/migrations/1000000000027-AddVirtualProducerBindings.js +87 -0
- package/dist/migrations/1000000000027-AddVirtualProducerBindings.js.map +1 -0
- package/dist/migrations/1000000000028-AddShellySampleSources.d.ts +6 -0
- package/dist/migrations/1000000000028-AddShellySampleSources.js +29 -0
- package/dist/migrations/1000000000028-AddShellySampleSources.js.map +1 -0
- package/dist/migrations/1000000000029-AddVirtualNumericTransforms.d.ts +6 -0
- package/dist/migrations/1000000000029-AddVirtualNumericTransforms.js +31 -0
- package/dist/migrations/1000000000029-AddVirtualNumericTransforms.js.map +1 -0
- package/dist/migrations/1000000000030-AddZigbeeSampleSources.d.ts +6 -0
- package/dist/migrations/1000000000030-AddZigbeeSampleSources.js +33 -0
- package/dist/migrations/1000000000030-AddZigbeeSampleSources.js.map +1 -0
- package/dist/migrations/1000000000031-AddVirtualThermostatClaims.d.ts +6 -0
- package/dist/migrations/1000000000031-AddVirtualThermostatClaims.js +62 -0
- package/dist/migrations/1000000000031-AddVirtualThermostatClaims.js.map +1 -0
- package/dist/migrations/1000000000032-AddVirtualThermostatRuntime.d.ts +6 -0
- package/dist/migrations/1000000000032-AddVirtualThermostatRuntime.js +39 -0
- package/dist/migrations/1000000000032-AddVirtualThermostatRuntime.js.map +1 -0
- package/dist/migrations/1000000000033-AddThermostatInstallationProfiles.d.ts +6 -0
- package/dist/migrations/1000000000033-AddThermostatInstallationProfiles.js +28 -0
- package/dist/migrations/1000000000033-AddThermostatInstallationProfiles.js.map +1 -0
- package/dist/migrations/1000000000034-AddVirtualThermostatRecoveries.d.ts +6 -0
- package/dist/migrations/1000000000034-AddVirtualThermostatRecoveries.js +26 -0
- package/dist/migrations/1000000000034-AddVirtualThermostatRecoveries.js.map +1 -0
- package/dist/migrations/1000000000035-IndexVirtualThermostatCommands.d.ts +6 -0
- package/dist/migrations/1000000000035-IndexVirtualThermostatCommands.js +35 -0
- package/dist/migrations/1000000000035-IndexVirtualThermostatCommands.js.map +1 -0
- package/dist/migrations/1000000000036-AddVirtualAggregatePolicies.d.ts +6 -0
- package/dist/migrations/1000000000036-AddVirtualAggregatePolicies.js +18 -0
- package/dist/migrations/1000000000036-AddVirtualAggregatePolicies.js.map +1 -0
- package/dist/migrations/1000000000037-AddVirtualAggregateProfiles.d.ts +6 -0
- package/dist/migrations/1000000000037-AddVirtualAggregateProfiles.js +16 -0
- package/dist/migrations/1000000000037-AddVirtualAggregateProfiles.js.map +1 -0
- package/dist/migrations/1000000000038-AddShellyCoverOrdering.d.ts +6 -0
- package/dist/migrations/1000000000038-AddShellyCoverOrdering.js +19 -0
- package/dist/migrations/1000000000038-AddShellyCoverOrdering.js.map +1 -0
- package/dist/migrations/1000000000039-AddVirtualThermostatComfort.d.ts +6 -0
- package/dist/migrations/1000000000039-AddVirtualThermostatComfort.js +16 -0
- package/dist/migrations/1000000000039-AddVirtualThermostatComfort.js.map +1 -0
- package/dist/migrations/1000000000040-AddThermostatBranchGroups.d.ts +6 -0
- package/dist/migrations/1000000000040-AddThermostatBranchGroups.js +32 -0
- package/dist/migrations/1000000000040-AddThermostatBranchGroups.js.map +1 -0
- package/dist/migrations/1000000000041-AddThermostatMemberProtection.d.ts +6 -0
- package/dist/migrations/1000000000041-AddThermostatMemberProtection.js +39 -0
- package/dist/migrations/1000000000041-AddThermostatMemberProtection.js.map +1 -0
- package/dist/migrations/1000000000042-AddShellyCoverRecoveries.d.ts +6 -0
- package/dist/migrations/1000000000042-AddShellyCoverRecoveries.js +19 -0
- package/dist/migrations/1000000000042-AddShellyCoverRecoveries.js.map +1 -0
- package/dist/migrations/1000000000044-AddVirtualDewPoint.d.ts +6 -0
- package/dist/migrations/1000000000044-AddVirtualDewPoint.js +36 -0
- package/dist/migrations/1000000000044-AddVirtualDewPoint.js.map +1 -0
- package/dist/migrations/1000000000045-AddThermostatCoolingDependencies.d.ts +6 -0
- package/dist/migrations/1000000000045-AddThermostatCoolingDependencies.js +32 -0
- package/dist/migrations/1000000000045-AddThermostatCoolingDependencies.js.map +1 -0
- package/dist/migrations/1000000000046-AddSpaceActivityModes.d.ts +7 -0
- package/dist/migrations/1000000000046-AddSpaceActivityModes.js +54 -0
- package/dist/migrations/1000000000046-AddSpaceActivityModes.js.map +1 -0
- package/dist/migrations/1000000000047-AddClimateAutomationOwnership.d.ts +6 -0
- package/dist/migrations/1000000000047-AddClimateAutomationOwnership.js +60 -0
- package/dist/migrations/1000000000047-AddClimateAutomationOwnership.js.map +1 -0
- package/dist/migrations/1000000000048-AddThermostatCreationCatalogBirths.d.ts +6 -0
- package/dist/migrations/1000000000048-AddThermostatCreationCatalogBirths.js +208 -0
- package/dist/migrations/1000000000048-AddThermostatCreationCatalogBirths.js.map +1 -0
- package/dist/migrations/1000000000049-FenceClimateAutomationLifecycle.d.ts +6 -0
- package/dist/migrations/1000000000049-FenceClimateAutomationLifecycle.js +40 -0
- package/dist/migrations/1000000000049-FenceClimateAutomationLifecycle.js.map +1 -0
- package/dist/migrations/1000000000050-AddSpaceModeSchedules.d.ts +6 -0
- package/dist/migrations/1000000000050-AddSpaceModeSchedules.js +36 -0
- package/dist/migrations/1000000000050-AddSpaceModeSchedules.js.map +1 -0
- package/dist/migrations/1000000000051-AddSpaceOccupancy.d.ts +6 -0
- package/dist/migrations/1000000000051-AddSpaceOccupancy.js +34 -0
- package/dist/migrations/1000000000051-AddSpaceOccupancy.js.map +1 -0
- package/dist/migrations/1000000000052-AddNativeThermostats.d.ts +6 -0
- package/dist/migrations/1000000000052-AddNativeThermostats.js +39 -0
- package/dist/migrations/1000000000052-AddNativeThermostats.js.map +1 -0
- package/dist/migrations/1000000000053-AddThermostatOverrideClocks.d.ts +6 -0
- package/dist/migrations/1000000000053-AddThermostatOverrideClocks.js +35 -0
- package/dist/migrations/1000000000053-AddThermostatOverrideClocks.js.map +1 -0
- package/dist/modules/buddy/buddy.utils.d.ts +1 -1
- package/dist/modules/buddy/buddy.utils.js +10 -11
- package/dist/modules/buddy/buddy.utils.js.map +1 -1
- package/dist/modules/buddy/services/buddy-context.service.js +2 -1
- package/dist/modules/buddy/services/buddy-context.service.js.map +1 -1
- package/dist/modules/buddy/services/home-context-tool-provider.service.d.ts +1 -1
- package/dist/modules/devices/contracts/climate-automation.contract.d.ts +111 -0
- package/dist/modules/devices/contracts/climate-automation.contract.js +3 -0
- package/dist/modules/devices/contracts/climate-automation.contract.js.map +1 -0
- package/dist/modules/devices/controllers/channels.properties.controller.d.ts +1 -1
- package/dist/modules/devices/controllers/channels.properties.controller.js +11 -4
- package/dist/modules/devices/controllers/channels.properties.controller.js.map +1 -1
- package/dist/modules/devices/controllers/devices.channels.properties.controller.d.ts +1 -1
- package/dist/modules/devices/controllers/devices.channels.properties.controller.js +11 -4
- package/dist/modules/devices/controllers/devices.channels.properties.controller.js.map +1 -1
- package/dist/modules/devices/controllers/property-command.controller.d.ts +9 -0
- package/dist/modules/devices/controllers/property-command.controller.js +88 -0
- package/dist/modules/devices/controllers/property-command.controller.js.map +1 -0
- package/dist/modules/devices/devices.constants.d.ts +4 -0
- package/dist/modules/devices/devices.constants.js +4 -0
- package/dist/modules/devices/devices.constants.js.map +1 -1
- package/dist/modules/devices/devices.module.js +22 -0
- package/dist/modules/devices/devices.module.js.map +1 -1
- package/dist/modules/devices/devices.openapi.d.ts +3 -1
- package/dist/modules/devices/devices.openapi.js +39 -0
- package/dist/modules/devices/devices.openapi.js.map +1 -1
- package/dist/modules/devices/dto/property-command.dto.js +20 -6
- package/dist/modules/devices/dto/property-command.dto.js.map +1 -1
- package/dist/modules/devices/dto/update-device.dto.d.ts +1 -1
- package/dist/modules/devices/dto/update-device.dto.js +4 -3
- package/dist/modules/devices/dto/update-device.dto.js.map +1 -1
- package/dist/modules/devices/entities/climate-automation.entity.d.ts +56 -0
- package/dist/modules/devices/entities/climate-automation.entity.js +231 -0
- package/dist/modules/devices/entities/climate-automation.entity.js.map +1 -0
- package/dist/modules/devices/entities/devices.entity.d.ts +4 -0
- package/dist/modules/devices/entities/devices.entity.js +27 -3
- package/dist/modules/devices/entities/devices.entity.js.map +1 -1
- package/dist/modules/devices/interceptors/property-command-entry.interceptor.d.ts +10 -0
- package/dist/modules/devices/interceptors/property-command-entry.interceptor.js +50 -0
- package/dist/modules/devices/interceptors/property-command-entry.interceptor.js.map +1 -0
- package/dist/modules/devices/models/composite-command.model.d.ts +16 -0
- package/dist/modules/devices/models/composite-command.model.js +99 -0
- package/dist/modules/devices/models/composite-command.model.js.map +1 -0
- package/dist/modules/devices/models/property-command-response.model.d.ts +18 -0
- package/dist/modules/devices/models/property-command-response.model.js +90 -0
- package/dist/modules/devices/models/property-command-response.model.js.map +1 -0
- package/dist/modules/devices/models/property-read-policy.model.d.ts +4 -0
- package/dist/modules/devices/models/property-read-policy.model.js +57 -0
- package/dist/modules/devices/models/property-read-policy.model.js.map +1 -0
- package/dist/modules/devices/models/property-sample.model.d.ts +50 -0
- package/dist/modules/devices/models/property-sample.model.js +3 -0
- package/dist/modules/devices/models/property-sample.model.js.map +1 -0
- package/dist/modules/devices/models/property-value-state.model.d.ts +11 -0
- package/dist/modules/devices/models/property-value-state.model.js +55 -1
- package/dist/modules/devices/models/property-value-state.model.js.map +1 -1
- package/dist/modules/devices/platforms/device.platform.d.ts +43 -0
- package/dist/modules/devices/platforms/native-climate.contract.d.ts +50 -0
- package/dist/modules/devices/platforms/native-climate.contract.js +3 -0
- package/dist/modules/devices/platforms/native-climate.contract.js.map +1 -0
- package/dist/modules/devices/services/channels-type-mapper.service.d.ts +3 -0
- package/dist/modules/devices/services/channels-type-mapper.service.js +21 -1
- package/dist/modules/devices/services/channels-type-mapper.service.js.map +1 -1
- package/dist/modules/devices/services/channels.properties-type-mapper.service.d.ts +7 -2
- package/dist/modules/devices/services/channels.properties-type-mapper.service.js +21 -1
- package/dist/modules/devices/services/channels.properties-type-mapper.service.js.map +1 -1
- package/dist/modules/devices/services/channels.properties.service.d.ts +11 -2
- package/dist/modules/devices/services/channels.properties.service.js +219 -64
- package/dist/modules/devices/services/channels.properties.service.js.map +1 -1
- package/dist/modules/devices/services/channels.service.d.ts +12 -5
- package/dist/modules/devices/services/channels.service.js +148 -55
- package/dist/modules/devices/services/channels.service.js.map +1 -1
- package/dist/modules/devices/services/climate-automation-ledger-lifecycle.d.ts +47 -0
- package/dist/modules/devices/services/climate-automation-ledger-lifecycle.js +242 -0
- package/dist/modules/devices/services/climate-automation-ledger-lifecycle.js.map +1 -0
- package/dist/modules/devices/services/climate-automation-ledger.service.d.ts +68 -0
- package/dist/modules/devices/services/climate-automation-ledger.service.js +1061 -0
- package/dist/modules/devices/services/climate-automation-ledger.service.js.map +1 -0
- package/dist/modules/devices/services/climate-automation-ledger.utils.d.ts +8 -0
- package/dist/modules/devices/services/climate-automation-ledger.utils.js +54 -0
- package/dist/modules/devices/services/climate-automation-ledger.utils.js.map +1 -0
- package/dist/modules/devices/services/climate-automation.registry.service.d.ts +15 -0
- package/dist/modules/devices/services/climate-automation.registry.service.js +71 -0
- package/dist/modules/devices/services/climate-automation.registry.service.js.map +1 -0
- package/dist/modules/devices/services/composite-property-command.registry.service.d.ts +48 -0
- package/dist/modules/devices/services/composite-property-command.registry.service.js +65 -0
- package/dist/modules/devices/services/composite-property-command.registry.service.js.map +1 -0
- package/dist/modules/devices/services/controller-publication-context.d.ts +27 -0
- package/dist/modules/devices/services/controller-publication-context.js +148 -0
- package/dist/modules/devices/services/controller-publication-context.js.map +1 -0
- package/dist/modules/devices/services/cover-action-proof.d.ts +7 -0
- package/dist/modules/devices/services/cover-action-proof.js +142 -0
- package/dist/modules/devices/services/cover-action-proof.js.map +1 -0
- package/dist/modules/devices/services/creation-capture.d.ts +19 -0
- package/dist/modules/devices/services/creation-capture.js +85 -0
- package/dist/modules/devices/services/creation-capture.js.map +1 -0
- package/dist/modules/devices/services/device-command-graph.service.js +1 -1
- package/dist/modules/devices/services/device-command-graph.service.js.map +1 -1
- package/dist/modules/devices/services/device-connection-state.service.d.ts +1 -0
- package/dist/modules/devices/services/device-connection-state.service.js +64 -18
- package/dist/modules/devices/services/device-connection-state.service.js.map +1 -1
- package/dist/modules/devices/services/device-connectivity.service.js +96 -51
- package/dist/modules/devices/services/device-connectivity.service.js.map +1 -1
- package/dist/modules/devices/services/device-contribution.registry.service.d.ts +50 -0
- package/dist/modules/devices/services/device-contribution.registry.service.js +45 -0
- package/dist/modules/devices/services/device-contribution.registry.service.js.map +1 -0
- package/dist/modules/devices/services/device-creation-context.d.ts +57 -0
- package/dist/modules/devices/services/device-creation-context.js +315 -0
- package/dist/modules/devices/services/device-creation-context.js.map +1 -0
- package/dist/modules/devices/services/device-structure-lock.service.d.ts +5 -0
- package/dist/modules/devices/services/device-structure-lock.service.js +64 -12
- package/dist/modules/devices/services/device-structure-lock.service.js.map +1 -1
- package/dist/modules/devices/services/device-validation.service.d.ts +0 -1
- package/dist/modules/devices/services/device-validation.service.js +3 -14
- package/dist/modules/devices/services/device-validation.service.js.map +1 -1
- package/dist/modules/devices/services/device-zones.service.d.ts +3 -1
- package/dist/modules/devices/services/device-zones.service.js +30 -6
- package/dist/modules/devices/services/device-zones.service.js.map +1 -1
- package/dist/modules/devices/services/devices-type-mapper.service.d.ts +3 -0
- package/dist/modules/devices/services/devices-type-mapper.service.js +21 -1
- package/dist/modules/devices/services/devices-type-mapper.service.js.map +1 -1
- package/dist/modules/devices/services/devices.service.d.ts +8 -2
- package/dist/modules/devices/services/devices.service.js +194 -49
- package/dist/modules/devices/services/devices.service.js.map +1 -1
- package/dist/modules/devices/services/platform.registry.service.d.ts +11 -1
- package/dist/modules/devices/services/platform.registry.service.js +42 -5
- package/dist/modules/devices/services/platform.registry.service.js.map +1 -1
- package/dist/modules/devices/services/property-command-admission.registry.service.d.ts +28 -0
- package/dist/modules/devices/services/property-command-admission.registry.service.js +70 -0
- package/dist/modules/devices/services/property-command-admission.registry.service.js.map +1 -0
- package/dist/modules/devices/services/property-command-dispatch.service.d.ts +28 -2
- package/dist/modules/devices/services/property-command-dispatch.service.js +704 -10
- package/dist/modules/devices/services/property-command-dispatch.service.js.map +1 -1
- package/dist/modules/devices/services/property-command-entry-snapshot.d.ts +25 -0
- package/dist/modules/devices/services/property-command-entry-snapshot.js +87 -0
- package/dist/modules/devices/services/property-command-entry-snapshot.js.map +1 -0
- package/dist/modules/devices/services/property-command-window.service.d.ts +22 -0
- package/dist/modules/devices/services/property-command-window.service.js +81 -0
- package/dist/modules/devices/services/property-command-window.service.js.map +1 -1
- package/dist/modules/devices/services/property-command.service.d.ts +24 -3
- package/dist/modules/devices/services/property-command.service.js +180 -18
- package/dist/modules/devices/services/property-command.service.js.map +1 -1
- package/dist/modules/devices/services/property-metadata.service.js +1 -1
- package/dist/modules/devices/services/property-metadata.service.js.map +1 -1
- package/dist/modules/devices/services/property-producer.registry.service.d.ts +98 -0
- package/dist/modules/devices/services/property-producer.registry.service.js +636 -0
- package/dist/modules/devices/services/property-producer.registry.service.js.map +1 -0
- package/dist/modules/devices/services/property-value-source.registry.service.d.ts +18 -0
- package/dist/modules/devices/services/property-value-source.registry.service.js +291 -2
- package/dist/modules/devices/services/property-value-source.registry.service.js.map +1 -1
- package/dist/modules/devices/services/property-value.service.d.ts +40 -3
- package/dist/modules/devices/services/property-value.service.js +744 -193
- package/dist/modules/devices/services/property-value.service.js.map +1 -1
- package/dist/modules/devices/subscribers/channel-property-entity.subscriber.d.ts +5 -0
- package/dist/modules/devices/subscribers/channel-property-entity.subscriber.js +25 -0
- package/dist/modules/devices/subscribers/channel-property-entity.subscriber.js.map +1 -1
- package/dist/modules/devices/utils/property-metadata.utils.d.ts +1 -0
- package/dist/modules/devices/utils/property-metadata.utils.js +10 -0
- package/dist/modules/devices/utils/property-metadata.utils.js.map +1 -1
- package/dist/modules/devices/utils/property-permissions.utils.d.ts +2 -0
- package/dist/modules/devices/utils/property-permissions.utils.js +10 -0
- package/dist/modules/devices/utils/property-permissions.utils.js.map +1 -0
- package/dist/modules/extensions/services/discovered-backend.module.d.ts +6 -0
- package/dist/modules/extensions/services/discovered-backend.module.js +32 -0
- package/dist/modules/extensions/services/discovered-backend.module.js.map +1 -0
- package/dist/modules/extensions/services/extensions-discovery.js +15 -0
- package/dist/modules/extensions/services/extensions-discovery.js.map +1 -1
- package/dist/modules/extensions/services/extensions.service.d.ts +4 -0
- package/dist/modules/extensions/services/extensions.service.js +13 -0
- package/dist/modules/extensions/services/extensions.service.js.map +1 -1
- package/dist/modules/extensions/services/managed-extension-service.interface.d.ts +1 -0
- package/dist/modules/extensions/services/managed-service-manager.service.d.ts +15 -0
- package/dist/modules/extensions/services/managed-service-manager.service.js +242 -72
- package/dist/modules/extensions/services/managed-service-manager.service.js.map +1 -1
- package/dist/modules/home-context/schemas/home-search-input.schemas.d.ts +1 -1
- package/dist/modules/intents/models/intent.model.d.ts +2 -0
- package/dist/modules/intents/models/intent.model.js +14 -0
- package/dist/modules/intents/models/intent.model.js.map +1 -1
- package/dist/modules/intents/services/intents.service.d.ts +2 -1
- package/dist/modules/intents/services/intents.service.js +18 -2
- package/dist/modules/intents/services/intents.service.js.map +1 -1
- package/dist/modules/scenes/listeners/websocket-exchange.listener.js +4 -0
- package/dist/modules/scenes/listeners/websocket-exchange.listener.js.map +1 -1
- package/dist/modules/scenes/models/scenes.model.d.ts +2 -0
- package/dist/modules/scenes/models/scenes.model.js +10 -0
- package/dist/modules/scenes/models/scenes.model.js.map +1 -1
- package/dist/modules/scenes/services/scene-executor.service.d.ts +6 -1
- package/dist/modules/scenes/services/scene-executor.service.js +33 -22
- package/dist/modules/scenes/services/scene-executor.service.js.map +1 -1
- package/dist/modules/security/providers/alarm-security.provider.d.ts +3 -1
- package/dist/modules/security/providers/alarm-security.provider.js +83 -8
- package/dist/modules/security/providers/alarm-security.provider.js.map +1 -1
- package/dist/modules/spaces/services/space-lifecycle-registry.service.d.ts +19 -0
- package/dist/modules/spaces/services/space-lifecycle-registry.service.js +121 -0
- package/dist/modules/spaces/services/space-lifecycle-registry.service.js.map +1 -0
- package/dist/modules/spaces/services/spaces.service.d.ts +5 -1
- package/dist/modules/spaces/services/spaces.service.js +34 -6
- package/dist/modules/spaces/services/spaces.service.js.map +1 -1
- package/dist/modules/spaces/spaces.constants.d.ts +3 -1
- package/dist/modules/spaces/spaces.constants.js +2 -0
- package/dist/modules/spaces/spaces.constants.js.map +1 -1
- package/dist/modules/spaces/spaces.module.js +13 -1
- package/dist/modules/spaces/spaces.module.js.map +1 -1
- package/dist/modules/storage/services/storage.service.d.ts +8 -0
- package/dist/modules/storage/services/storage.service.js +225 -0
- package/dist/modules/storage/services/storage.service.js.map +1 -1
- package/dist/modules/swagger/decorators/api-documentation.decorator.d.ts +1 -0
- package/dist/modules/swagger/decorators/api-documentation.decorator.js +9 -1
- package/dist/modules/swagger/decorators/api-documentation.decorator.js.map +1 -1
- package/dist/modules/swagger/services/swagger-document.service.d.ts +1 -0
- package/dist/modules/swagger/services/swagger-document.service.js +71 -1
- package/dist/modules/swagger/services/swagger-document.service.js.map +1 -1
- package/dist/modules/system/services/backup.service.js +3 -5
- package/dist/modules/system/services/backup.service.js.map +1 -1
- package/dist/modules/system/utils/timezone.utils.d.ts +2 -0
- package/dist/modules/system/utils/timezone.utils.js +9 -0
- package/dist/modules/system/utils/timezone.utils.js.map +1 -0
- package/dist/modules/websocket/gateway/websocket.gateway.js +1 -0
- package/dist/modules/websocket/gateway/websocket.gateway.js.map +1 -1
- package/dist/plugins/devices-home-assistant/devices-home-assistant.plugin.js +2 -0
- package/dist/plugins/devices-home-assistant/devices-home-assistant.plugin.js.map +1 -1
- package/dist/plugins/devices-home-assistant/dto/update-channel-property.dto.d.ts +3 -3
- package/dist/plugins/devices-home-assistant/dto/update-channel-property.dto.js +3 -3
- package/dist/plugins/devices-home-assistant/dto/update-channel-property.dto.js.map +1 -1
- package/dist/plugins/devices-home-assistant/platforms/home-assistant.device.platform.d.ts +11 -1
- package/dist/plugins/devices-home-assistant/platforms/home-assistant.device.platform.js +82 -2
- package/dist/plugins/devices-home-assistant/platforms/home-assistant.device.platform.js.map +1 -1
- package/dist/plugins/devices-home-assistant/services/home-assistant-native-climate.service.d.ts +22 -0
- package/dist/plugins/devices-home-assistant/services/home-assistant-native-climate.service.js +409 -0
- package/dist/plugins/devices-home-assistant/services/home-assistant-native-climate.service.js.map +1 -0
- package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.d.ts +14 -0
- package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js +93 -3
- package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js.map +1 -1
- package/dist/plugins/devices-homekit/devices-homekit.plugin.js +28 -2
- package/dist/plugins/devices-homekit/devices-homekit.plugin.js.map +1 -1
- package/dist/plugins/devices-homekit/listeners/homekit-event.listener.d.ts +26 -3
- package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js +183 -5
- package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/base.mapper.d.ts +2 -1
- package/dist/plugins/devices-homekit/mappers/base.mapper.js +38 -10
- package/dist/plugins/devices-homekit/mappers/base.mapper.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/battery.mapper.js +4 -3
- package/dist/plugins/devices-homekit/mappers/battery.mapper.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/button.mapper.js +21 -2
- package/dist/plugins/devices-homekit/mappers/button.mapper.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/characteristic-get.d.ts +3 -0
- package/dist/plugins/devices-homekit/mappers/characteristic-get.js +10 -0
- package/dist/plugins/devices-homekit/mappers/characteristic-get.js.map +1 -0
- package/dist/plugins/devices-homekit/mappers/characteristic-write.d.ts +1 -1
- package/dist/plugins/devices-homekit/mappers/characteristic-write.js +2 -1
- package/dist/plugins/devices-homekit/mappers/characteristic-write.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/fan.mapper.d.ts +12 -0
- package/dist/plugins/devices-homekit/mappers/fan.mapper.js +126 -0
- package/dist/plugins/devices-homekit/mappers/fan.mapper.js.map +1 -0
- package/dist/plugins/devices-homekit/mappers/homekit-mapper.interface.d.ts +8 -0
- package/dist/plugins/devices-homekit/mappers/outlet.mapper.js +4 -0
- package/dist/plugins/devices-homekit/mappers/outlet.mapper.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/property-read.d.ts +7 -0
- package/dist/plugins/devices-homekit/mappers/property-read.js +64 -0
- package/dist/plugins/devices-homekit/mappers/property-read.js.map +1 -0
- package/dist/plugins/devices-homekit/mappers/semantic-conversion.d.ts +2 -0
- package/dist/plugins/devices-homekit/mappers/semantic-conversion.js +15 -0
- package/dist/plugins/devices-homekit/mappers/semantic-conversion.js.map +1 -0
- package/dist/plugins/devices-homekit/mappers/sensor.mapper.d.ts +3 -0
- package/dist/plugins/devices-homekit/mappers/sensor.mapper.js +63 -11
- package/dist/plugins/devices-homekit/mappers/sensor.mapper.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/service-fault.d.ts +4 -0
- package/dist/plugins/devices-homekit/mappers/service-fault.js +33 -0
- package/dist/plugins/devices-homekit/mappers/service-fault.js.map +1 -0
- package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.d.ts +4 -0
- package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js +128 -19
- package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/thermostat.mapper.js +5 -3
- package/dist/plugins/devices-homekit/mappers/thermostat.mapper.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/unavailable-characteristic.d.ts +3 -0
- package/dist/plugins/devices-homekit/mappers/unavailable-characteristic.js +18 -0
- package/dist/plugins/devices-homekit/mappers/unavailable-characteristic.js.map +1 -0
- package/dist/plugins/devices-homekit/mappers/window-covering.mapper.js +19 -3
- package/dist/plugins/devices-homekit/mappers/window-covering.mapper.js.map +1 -1
- package/dist/plugins/devices-homekit/services/homekit-bridge.service.d.ts +4 -0
- package/dist/plugins/devices-homekit/services/homekit-bridge.service.js +58 -29
- package/dist/plugins/devices-homekit/services/homekit-bridge.service.js.map +1 -1
- package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.d.ts +2 -0
- package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.js +3 -0
- package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.js.map +1 -1
- package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.d.ts +30 -2
- package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.js +126 -2
- package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.js.map +1 -1
- package/dist/plugins/devices-homekit/services/homekit-mapping-maintenance.d.ts +8 -0
- package/dist/plugins/devices-homekit/services/homekit-mapping-maintenance.js +17 -0
- package/dist/plugins/devices-homekit/services/homekit-mapping-maintenance.js.map +1 -0
- package/dist/plugins/devices-homekit/services/homekit-property-state.service.d.ts +19 -0
- package/dist/plugins/devices-homekit/services/homekit-property-state.service.js +69 -0
- package/dist/plugins/devices-homekit/services/homekit-property-state.service.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/contracts/cover-action.contract.d.ts +13 -0
- package/dist/plugins/devices-shelly-ng/contracts/cover-action.contract.js +60 -0
- package/dist/plugins/devices-shelly-ng/contracts/cover-action.contract.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/contracts/cover-recovery.contract.d.ts +13 -0
- package/dist/plugins/devices-shelly-ng/contracts/cover-recovery.contract.js +3 -0
- package/dist/plugins/devices-shelly-ng/contracts/cover-recovery.contract.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/contracts/guard-script-source.d.ts +1 -0
- package/dist/plugins/devices-shelly-ng/contracts/guard-script-source.js +5 -0
- package/dist/plugins/devices-shelly-ng/contracts/guard-script-source.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/contracts/guard-script.contract.d.ts +21 -0
- package/dist/plugins/devices-shelly-ng/contracts/guard-script.contract.js +47 -0
- package/dist/plugins/devices-shelly-ng/contracts/guard-script.contract.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/contracts/member-guard-script-source.d.ts +2 -0
- package/dist/plugins/devices-shelly-ng/contracts/member-guard-script-source.js +27 -0
- package/dist/plugins/devices-shelly-ng/contracts/member-guard-script-source.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/contracts/native-temperature.contract.d.ts +36 -0
- package/dist/plugins/devices-shelly-ng/contracts/native-temperature.contract.js +200 -0
- package/dist/plugins/devices-shelly-ng/contracts/native-temperature.contract.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/contracts/protective-switch.contract.d.ts +44 -0
- package/dist/plugins/devices-shelly-ng/contracts/protective-switch.contract.js +29 -0
- package/dist/plugins/devices-shelly-ng/contracts/protective-switch.contract.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/controllers/shelly-cover-recovery.controller.d.ts +11 -0
- package/dist/plugins/devices-shelly-ng/controllers/shelly-cover-recovery.controller.js +98 -0
- package/dist/plugins/devices-shelly-ng/controllers/shelly-cover-recovery.controller.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.d.ts +51 -1
- package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js +688 -2
- package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.d.ts +46 -1
- package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js +315 -4
- package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/devices-shelly-ng.openapi.d.ts +3 -1
- package/dist/plugins/devices-shelly-ng/devices-shelly-ng.openapi.js +8 -0
- package/dist/plugins/devices-shelly-ng/devices-shelly-ng.openapi.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/devices-shelly-ng.plugin.js +16 -1
- package/dist/plugins/devices-shelly-ng/devices-shelly-ng.plugin.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/dto/cover-recovery.dto.d.ts +11 -0
- package/dist/plugins/devices-shelly-ng/dto/cover-recovery.dto.js +77 -0
- package/dist/plugins/devices-shelly-ng/dto/cover-recovery.dto.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/entities/shelly-cover-ordering.entity.d.ts +5 -0
- package/dist/plugins/devices-shelly-ng/entities/shelly-cover-ordering.entity.js +32 -0
- package/dist/plugins/devices-shelly-ng/entities/shelly-cover-ordering.entity.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/entities/shelly-cover-recovery.entity.d.ts +17 -0
- package/dist/plugins/devices-shelly-ng/entities/shelly-cover-recovery.entity.js +80 -0
- package/dist/plugins/devices-shelly-ng/entities/shelly-cover-recovery.entity.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/entities/shelly-sample-source.entity.d.ts +16 -0
- package/dist/plugins/devices-shelly-ng/entities/shelly-sample-source.entity.js +70 -0
- package/dist/plugins/devices-shelly-ng/entities/shelly-sample-source.entity.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/mappings/definitions/covers.yaml +30 -24
- package/dist/plugins/devices-shelly-ng/models/cover-recovery.model.d.ts +21 -0
- package/dist/plugins/devices-shelly-ng/models/cover-recovery.model.js +114 -0
- package/dist/plugins/devices-shelly-ng/models/cover-recovery.model.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/platforms/shelly-ng.device.platform.d.ts +27 -1
- package/dist/plugins/devices-shelly-ng/platforms/shelly-ng.device.platform.js +146 -0
- package/dist/plugins/devices-shelly-ng/platforms/shelly-ng.device.platform.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/services/authenticated-shelly-script-http.d.ts +16 -0
- package/dist/plugins/devices-shelly-ng/services/authenticated-shelly-script-http.js +154 -0
- package/dist/plugins/devices-shelly-ng/services/authenticated-shelly-script-http.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/device-manager.service.d.ts +4 -1
- package/dist/plugins/devices-shelly-ng/services/device-manager.service.js +113 -4
- package/dist/plugins/devices-shelly-ng/services/device-manager.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/services/guarded-shelly-http.d.ts +2 -0
- package/dist/plugins/devices-shelly-ng/services/guarded-shelly-http.js +78 -0
- package/dist/plugins/devices-shelly-ng/services/guarded-shelly-http.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/guarded-shelly-rpc.d.ts +9 -0
- package/dist/plugins/devices-shelly-ng/services/guarded-shelly-rpc.js +56 -0
- package/dist/plugins/devices-shelly-ng/services/guarded-shelly-rpc.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-artifact.d.ts +45 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-artifact.js +278 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-artifact.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-lease.contract.d.ts +49 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-lease.contract.js +32 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-lease.contract.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-qualification.d.ts +53 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-qualification.js +91 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-qualification.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-session.d.ts +35 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-session.js +244 -0
- package/dist/plugins/devices-shelly-ng/services/remote-dew-point-session.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-ordering.service.d.ts +9 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-ordering.service.js +50 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-ordering.service.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery-lane.service.d.ts +29 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery-lane.service.js +166 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery-lane.service.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery.service.d.ts +21 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery.service.js +207 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery.service.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-session.d.ts +25 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-session.js +132 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-session.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-telemetry.d.ts +9 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-telemetry.js +63 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-cover-telemetry.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-guard-rpc-session.d.ts +33 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-guard-rpc-session.js +191 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-guard-rpc-session.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.d.ts +3 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js +32 -4
- package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/services/shelly-sample-sources.service.d.ts +34 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-sample-sources.service.js +194 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-sample-sources.service.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js +5 -2
- package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js.map +1 -1
- package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.d.ts +4 -0
- package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.js +3 -0
- package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.js.map +1 -1
- package/dist/plugins/devices-virtual/contracts/thermostat-actuation.contract.d.ts +114 -0
- package/dist/plugins/devices-virtual/contracts/thermostat-actuation.contract.js +12 -0
- package/dist/plugins/devices-virtual/contracts/thermostat-actuation.contract.js.map +1 -0
- package/dist/plugins/devices-virtual/contracts/thermostat-command.contract.d.ts +4 -0
- package/dist/plugins/devices-virtual/contracts/thermostat-command.contract.js +3 -0
- package/dist/plugins/devices-virtual/contracts/thermostat-command.contract.js.map +1 -0
- package/dist/plugins/devices-virtual/controllers/native-thermostat.controller.d.ts +15 -0
- package/dist/plugins/devices-virtual/controllers/native-thermostat.controller.js +178 -0
- package/dist/plugins/devices-virtual/controllers/native-thermostat.controller.js.map +1 -0
- package/dist/plugins/devices-virtual/controllers/thermostat-authoring-context.controller.d.ts +11 -0
- package/dist/plugins/devices-virtual/controllers/thermostat-authoring-context.controller.js +92 -0
- package/dist/plugins/devices-virtual/controllers/thermostat-authoring-context.controller.js.map +1 -0
- package/dist/plugins/devices-virtual/controllers/thermostat-installation.controller.d.ts +16 -0
- package/dist/plugins/devices-virtual/controllers/thermostat-installation.controller.js +179 -0
- package/dist/plugins/devices-virtual/controllers/thermostat-installation.controller.js.map +1 -0
- package/dist/plugins/devices-virtual/controllers/virtual-dew-point-config.controller.d.ts +11 -0
- package/dist/plugins/devices-virtual/controllers/virtual-dew-point-config.controller.js +100 -0
- package/dist/plugins/devices-virtual/controllers/virtual-dew-point-config.controller.js.map +1 -0
- package/dist/plugins/devices-virtual/controllers/virtual-measurement-authoring.controller.d.ts +19 -0
- package/dist/plugins/devices-virtual/controllers/virtual-measurement-authoring.controller.js +168 -0
- package/dist/plugins/devices-virtual/controllers/virtual-measurement-authoring.controller.js.map +1 -0
- package/dist/plugins/devices-virtual/controllers/virtual-producer-config.controller.d.ts +28 -0
- package/dist/plugins/devices-virtual/controllers/virtual-producer-config.controller.js +278 -0
- package/dist/plugins/devices-virtual/controllers/virtual-producer-config.controller.js.map +1 -0
- package/dist/plugins/devices-virtual/controllers/virtual-thermostat-authoring.controller.d.ts +12 -0
- package/dist/plugins/devices-virtual/controllers/virtual-thermostat-authoring.controller.js +111 -0
- package/dist/plugins/devices-virtual/controllers/virtual-thermostat-authoring.controller.js.map +1 -0
- package/dist/plugins/devices-virtual/controllers/virtual-thermostat-comfort.controller.d.ts +14 -0
- package/dist/plugins/devices-virtual/controllers/virtual-thermostat-comfort.controller.js +160 -0
- package/dist/plugins/devices-virtual/controllers/virtual-thermostat-comfort.controller.js.map +1 -0
- package/dist/plugins/devices-virtual/controllers/virtual-thermostat-config.controller.d.ts +18 -0
- package/dist/plugins/devices-virtual/controllers/virtual-thermostat-config.controller.js +196 -0
- package/dist/plugins/devices-virtual/controllers/virtual-thermostat-config.controller.js.map +1 -0
- package/dist/plugins/devices-virtual/controllers/virtual-transform-config.controller.d.ts +14 -0
- package/dist/plugins/devices-virtual/controllers/virtual-transform-config.controller.js +128 -0
- package/dist/plugins/devices-virtual/controllers/virtual-transform-config.controller.js.map +1 -0
- package/dist/plugins/devices-virtual/devices-virtual.constants.d.ts +1 -0
- package/dist/plugins/devices-virtual/devices-virtual.constants.js +2 -1
- package/dist/plugins/devices-virtual/devices-virtual.constants.js.map +1 -1
- package/dist/plugins/devices-virtual/devices-virtual.openapi.d.ts +24 -2
- package/dist/plugins/devices-virtual/devices-virtual.openapi.js +95 -0
- package/dist/plugins/devices-virtual/devices-virtual.openapi.js.map +1 -1
- package/dist/plugins/devices-virtual/devices-virtual.plugin.d.ts +7 -1
- package/dist/plugins/devices-virtual/devices-virtual.plugin.js +167 -10
- package/dist/plugins/devices-virtual/devices-virtual.plugin.js.map +1 -1
- package/dist/plugins/devices-virtual/dto/create-device.dto.d.ts +2 -0
- package/dist/plugins/devices-virtual/dto/create-device.dto.js +20 -0
- package/dist/plugins/devices-virtual/dto/create-device.dto.js.map +1 -1
- package/dist/plugins/devices-virtual/dto/dew-point-config.dto.d.ts +14 -0
- package/dist/plugins/devices-virtual/dto/dew-point-config.dto.js +119 -0
- package/dist/plugins/devices-virtual/dto/dew-point-config.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/group-catalog.dto.d.ts +8 -0
- package/dist/plugins/devices-virtual/dto/group-catalog.dto.js +62 -0
- package/dist/plugins/devices-virtual/dto/group-catalog.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/light-group-draft.dto.d.ts +19 -0
- package/dist/plugins/devices-virtual/dto/light-group-draft.dto.js +108 -0
- package/dist/plugins/devices-virtual/dto/light-group-draft.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/measurement-authoring.dto.d.ts +25 -0
- package/dist/plugins/devices-virtual/dto/measurement-authoring.dto.js +157 -0
- package/dist/plugins/devices-virtual/dto/measurement-authoring.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/native-thermostat.dto.d.ts +21 -0
- package/dist/plugins/devices-virtual/dto/native-thermostat.dto.js +122 -0
- package/dist/plugins/devices-virtual/dto/native-thermostat.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/producer-config.dto.d.ts +35 -0
- package/dist/plugins/devices-virtual/dto/producer-config.dto.js +290 -0
- package/dist/plugins/devices-virtual/dto/producer-config.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/thermostat-authoring.dto.d.ts +6 -0
- package/dist/plugins/devices-virtual/dto/thermostat-authoring.dto.js +46 -0
- package/dist/plugins/devices-virtual/dto/thermostat-authoring.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/thermostat-comfort.dto.d.ts +39 -0
- package/dist/plugins/devices-virtual/dto/thermostat-comfort.dto.js +244 -0
- package/dist/plugins/devices-virtual/dto/thermostat-comfort.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/thermostat-config.dto.d.ts +94 -0
- package/dist/plugins/devices-virtual/dto/thermostat-config.dto.js +718 -0
- package/dist/plugins/devices-virtual/dto/thermostat-config.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/thermostat-installation.dto.d.ts +71 -0
- package/dist/plugins/devices-virtual/dto/thermostat-installation.dto.js +410 -0
- package/dist/plugins/devices-virtual/dto/thermostat-installation.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/transform-config.dto.d.ts +71 -0
- package/dist/plugins/devices-virtual/dto/transform-config.dto.js +430 -0
- package/dist/plugins/devices-virtual/dto/transform-config.dto.js.map +1 -0
- package/dist/plugins/devices-virtual/dto/update-device.dto.d.ts +2 -0
- package/dist/plugins/devices-virtual/dto/update-device.dto.js +20 -0
- package/dist/plugins/devices-virtual/dto/update-device.dto.js.map +1 -1
- package/dist/plugins/devices-virtual/entities/devices-virtual.entity.d.ts +13 -1
- package/dist/plugins/devices-virtual/entities/devices-virtual.entity.js +56 -6
- package/dist/plugins/devices-virtual/entities/devices-virtual.entity.js.map +1 -1
- package/dist/plugins/devices-virtual/entities/native-thermostat.entity.d.ts +23 -0
- package/dist/plugins/devices-virtual/entities/native-thermostat.entity.js +103 -0
- package/dist/plugins/devices-virtual/entities/native-thermostat.entity.js.map +1 -0
- package/dist/plugins/devices-virtual/entities/thermostat-cooling-dependency.entity.d.ts +19 -0
- package/dist/plugins/devices-virtual/entities/thermostat-cooling-dependency.entity.js +87 -0
- package/dist/plugins/devices-virtual/entities/thermostat-cooling-dependency.entity.js.map +1 -0
- package/dist/plugins/devices-virtual/entities/thermostat-installation.entity.d.ts +36 -0
- package/dist/plugins/devices-virtual/entities/thermostat-installation.entity.js +125 -0
- package/dist/plugins/devices-virtual/entities/thermostat-installation.entity.js.map +1 -0
- package/dist/plugins/devices-virtual/entities/thermostat-member-protection.entity.d.ts +15 -0
- package/dist/plugins/devices-virtual/entities/thermostat-member-protection.entity.js +70 -0
- package/dist/plugins/devices-virtual/entities/thermostat-member-protection.entity.js.map +1 -0
- package/dist/plugins/devices-virtual/entities/thermostat-override-clock.entity.d.ts +7 -0
- package/dist/plugins/devices-virtual/entities/thermostat-override-clock.entity.js +39 -0
- package/dist/plugins/devices-virtual/entities/thermostat-override-clock.entity.js.map +1 -0
- package/dist/plugins/devices-virtual/entities/virtual-dew-point.entity.d.ts +28 -0
- package/dist/plugins/devices-virtual/entities/virtual-dew-point.entity.js +104 -0
- package/dist/plugins/devices-virtual/entities/virtual-dew-point.entity.js.map +1 -0
- package/dist/plugins/devices-virtual/entities/virtual-producer.entity.d.ts +89 -0
- package/dist/plugins/devices-virtual/entities/virtual-producer.entity.js +281 -0
- package/dist/plugins/devices-virtual/entities/virtual-producer.entity.js.map +1 -0
- package/dist/plugins/devices-virtual/entities/virtual-thermostat-runtime.entity.d.ts +45 -0
- package/dist/plugins/devices-virtual/entities/virtual-thermostat-runtime.entity.js +184 -0
- package/dist/plugins/devices-virtual/entities/virtual-thermostat-runtime.entity.js.map +1 -0
- package/dist/plugins/devices-virtual/entities/virtual-thermostat.entity.d.ts +86 -0
- package/dist/plugins/devices-virtual/entities/virtual-thermostat.entity.js +337 -0
- package/dist/plugins/devices-virtual/entities/virtual-thermostat.entity.js.map +1 -0
- package/dist/plugins/devices-virtual/entities/virtual-transform.entity.d.ts +23 -0
- package/dist/plugins/devices-virtual/entities/virtual-transform.entity.js +101 -0
- package/dist/plugins/devices-virtual/entities/virtual-transform.entity.js.map +1 -0
- package/dist/plugins/devices-virtual/listeners/virtual-device-information.listener.d.ts +5 -0
- package/dist/plugins/devices-virtual/listeners/virtual-device-information.listener.js +65 -22
- package/dist/plugins/devices-virtual/listeners/virtual-device-information.listener.js.map +1 -1
- package/dist/plugins/devices-virtual/listeners/virtual-index-maintenance.listener.d.ts +8 -1
- package/dist/plugins/devices-virtual/listeners/virtual-index-maintenance.listener.js +123 -32
- package/dist/plugins/devices-virtual/listeners/virtual-index-maintenance.listener.js.map +1 -1
- package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.d.ts +3 -0
- package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.js +41 -3
- package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.js.map +1 -1
- package/dist/plugins/devices-virtual/listeners/virtual-status.listener.js +28 -15
- package/dist/plugins/devices-virtual/listeners/virtual-status.listener.js.map +1 -1
- package/dist/plugins/devices-virtual/models/dew-point-response.model.d.ts +38 -0
- package/dist/plugins/devices-virtual/models/dew-point-response.model.js +193 -0
- package/dist/plugins/devices-virtual/models/dew-point-response.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/group-catalog.model.d.ts +26 -0
- package/dist/plugins/devices-virtual/models/group-catalog.model.js +117 -0
- package/dist/plugins/devices-virtual/models/group-catalog.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/light-group-draft.model.d.ts +28 -0
- package/dist/plugins/devices-virtual/models/light-group-draft.model.js +122 -0
- package/dist/plugins/devices-virtual/models/light-group-draft.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/measurement-authoring-response.model.d.ts +26 -0
- package/dist/plugins/devices-virtual/models/measurement-authoring-response.model.js +125 -0
- package/dist/plugins/devices-virtual/models/measurement-authoring-response.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/native-thermostat-response.model.d.ts +84 -0
- package/dist/plugins/devices-virtual/models/native-thermostat-response.model.js +406 -0
- package/dist/plugins/devices-virtual/models/native-thermostat-response.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/numeric-operator.model.d.ts +23 -0
- package/dist/plugins/devices-virtual/models/numeric-operator.model.js +120 -0
- package/dist/plugins/devices-virtual/models/numeric-operator.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/producer-response.model.d.ts +138 -0
- package/dist/plugins/devices-virtual/models/producer-response.model.js +764 -0
- package/dist/plugins/devices-virtual/models/producer-response.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/thermostat-authoring-context.model.d.ts +22 -0
- package/dist/plugins/devices-virtual/models/thermostat-authoring-context.model.js +134 -0
- package/dist/plugins/devices-virtual/models/thermostat-authoring-context.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/thermostat-authoring-response.model.d.ts +18 -0
- package/dist/plugins/devices-virtual/models/thermostat-authoring-response.model.js +87 -0
- package/dist/plugins/devices-virtual/models/thermostat-authoring-response.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/thermostat-comfort-response.model.d.ts +60 -0
- package/dist/plugins/devices-virtual/models/thermostat-comfort-response.model.js +341 -0
- package/dist/plugins/devices-virtual/models/thermostat-comfort-response.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/thermostat-installation-response.model.d.ts +84 -0
- package/dist/plugins/devices-virtual/models/thermostat-installation-response.model.js +440 -0
- package/dist/plugins/devices-virtual/models/thermostat-installation-response.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/thermostat-response.model.d.ts +218 -0
- package/dist/plugins/devices-virtual/models/thermostat-response.model.js +1157 -0
- package/dist/plugins/devices-virtual/models/thermostat-response.model.js.map +1 -0
- package/dist/plugins/devices-virtual/models/transform-response.model.d.ts +73 -0
- package/dist/plugins/devices-virtual/models/transform-response.model.js +386 -0
- package/dist/plugins/devices-virtual/models/transform-response.model.js.map +1 -0
- package/dist/plugins/devices-virtual/platforms/virtual-device.platform.d.ts +5 -1
- package/dist/plugins/devices-virtual/platforms/virtual-device.platform.js +22 -3
- package/dist/plugins/devices-virtual/platforms/virtual-device.platform.js.map +1 -1
- package/dist/plugins/devices-virtual/services/native-thermostat.service.d.ts +72 -0
- package/dist/plugins/devices-virtual/services/native-thermostat.service.js +932 -0
- package/dist/plugins/devices-virtual/services/native-thermostat.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-authoring-context.service.d.ts +14 -0
- package/dist/plugins/devices-virtual/services/thermostat-authoring-context.service.js +147 -0
- package/dist/plugins/devices-virtual/services/thermostat-authoring-context.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-comfort-selection.d.ts +199 -0
- package/dist/plugins/devices-virtual/services/thermostat-comfort-selection.js +1064 -0
- package/dist/plugins/devices-virtual/services/thermostat-comfort-selection.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-controller-mutation.d.ts +75 -0
- package/dist/plugins/devices-virtual/services/thermostat-controller-mutation.js +445 -0
- package/dist/plugins/devices-virtual/services/thermostat-controller-mutation.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-cooling-dependency.service.d.ts +53 -0
- package/dist/plugins/devices-virtual/services/thermostat-cooling-dependency.service.js +267 -0
- package/dist/plugins/devices-virtual/services/thermostat-cooling-dependency.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-creation-catalog.d.ts +56 -0
- package/dist/plugins/devices-virtual/services/thermostat-creation-catalog.js +438 -0
- package/dist/plugins/devices-virtual/services/thermostat-creation-catalog.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-creation-response.d.ts +37 -0
- package/dist/plugins/devices-virtual/services/thermostat-creation-response.js +430 -0
- package/dist/plugins/devices-virtual/services/thermostat-creation-response.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation-artifact.d.ts +13 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation-artifact.js +263 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation-artifact.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation-bindings.service.d.ts +10 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation-bindings.service.js +238 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation-bindings.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation-loader.service.d.ts +41 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation-loader.service.js +350 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation-loader.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation.service.d.ts +40 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation.service.js +263 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation.types.d.ts +72 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation.types.js +13 -0
- package/dist/plugins/devices-virtual/services/thermostat-installation.types.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-member-protection.service.d.ts +45 -0
- package/dist/plugins/devices-virtual/services/thermostat-member-protection.service.js +235 -0
- package/dist/plugins/devices-virtual/services/thermostat-member-protection.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-override-clock.sql.d.ts +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-override-clock.sql.js +16 -0
- package/dist/plugins/devices-virtual/services/thermostat-override-clock.sql.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-protection-source.utils.d.ts +27 -0
- package/dist/plugins/devices-virtual/services/thermostat-protection-source.utils.js +132 -0
- package/dist/plugins/devices-virtual/services/thermostat-protection-source.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/thermostat-remote-cooling-adapter.d.ts +88 -0
- package/dist/plugins/devices-virtual/services/thermostat-remote-cooling-adapter.js +200 -0
- package/dist/plugins/devices-virtual/services/thermostat-remote-cooling-adapter.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-aggregate-evaluator.d.ts +35 -0
- package/dist/plugins/devices-virtual/services/virtual-aggregate-evaluator.js +200 -0
- package/dist/plugins/devices-virtual/services/virtual-aggregate-evaluator.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-aggregate-policy.utils.d.ts +5 -0
- package/dist/plugins/devices-virtual/services/virtual-aggregate-policy.utils.js +18 -0
- package/dist/plugins/devices-virtual/services/virtual-aggregate-policy.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-aggregate-runtime.service.d.ts +48 -0
- package/dist/plugins/devices-virtual/services/virtual-aggregate-runtime.service.js +425 -0
- package/dist/plugins/devices-virtual/services/virtual-aggregate-runtime.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-cooling-policy.utils.d.ts +13 -0
- package/dist/plugins/devices-virtual/services/virtual-cooling-policy.utils.js +38 -0
- package/dist/plugins/devices-virtual/services/virtual-cooling-policy.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-cover-contract.utils.d.ts +7 -0
- package/dist/plugins/devices-virtual/services/virtual-cover-contract.utils.js +41 -0
- package/dist/plugins/devices-virtual/services/virtual-cover-contract.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-cover-readiness.utils.d.ts +16 -0
- package/dist/plugins/devices-virtual/services/virtual-cover-readiness.utils.js +42 -0
- package/dist/plugins/devices-virtual/services/virtual-cover-readiness.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-dependency-graph.service.d.ts +118 -0
- package/dist/plugins/devices-virtual/services/virtual-dependency-graph.service.js +667 -0
- package/dist/plugins/devices-virtual/services/virtual-dependency-graph.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-devices.service.d.ts +8 -4
- package/dist/plugins/devices-virtual/services/virtual-devices.service.js +105 -22
- package/dist/plugins/devices-virtual/services/virtual-devices.service.js.map +1 -1
- package/dist/plugins/devices-virtual/services/virtual-dew-point-config.service.d.ts +28 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point-config.service.js +193 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point-config.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point-contract.utils.d.ts +5 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point-contract.utils.js +69 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point-contract.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point-runtime.service.d.ts +65 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point-runtime.service.js +524 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point-runtime.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point.utils.d.ts +9 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point.utils.js +25 -0
- package/dist/plugins/devices-virtual/services/virtual-dew-point.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-group-catalog.service.d.ts +10 -0
- package/dist/plugins/devices-virtual/services/virtual-group-catalog.service.js +117 -0
- package/dist/plugins/devices-virtual/services/virtual-group-catalog.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-group-contract.utils.d.ts +4 -0
- package/dist/plugins/devices-virtual/services/virtual-group-contract.utils.js +35 -0
- package/dist/plugins/devices-virtual/services/virtual-group-contract.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-group-field.utils.d.ts +10 -0
- package/dist/plugins/devices-virtual/services/virtual-group-field.utils.js +35 -0
- package/dist/plugins/devices-virtual/services/virtual-group-field.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-group-profile.d.ts +19 -0
- package/dist/plugins/devices-virtual/services/virtual-group-profile.js +137 -0
- package/dist/plugins/devices-virtual/services/virtual-group-profile.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-authoring.service.d.ts +43 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-authoring.service.js +217 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-authoring.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-command.service.d.ts +28 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-command.service.js +262 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-command.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-contribution.service.d.ts +19 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-contribution.service.js +91 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-contribution.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-state.service.d.ts +37 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-state.service.js +346 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group-state.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group.utils.d.ts +46 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group.utils.js +204 -0
- package/dist/plugins/devices-virtual/services/virtual-light-group.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-measurement-authoring.service.d.ts +37 -0
- package/dist/plugins/devices-virtual/services/virtual-measurement-authoring.service.js +270 -0
- package/dist/plugins/devices-virtual/services/virtual-measurement-authoring.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-measurement-contribution.service.d.ts +21 -0
- package/dist/plugins/devices-virtual/services/virtual-measurement-contribution.service.js +166 -0
- package/dist/plugins/devices-virtual/services/virtual-measurement-contribution.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-measurement-metadata.utils.d.ts +3 -0
- package/dist/plugins/devices-virtual/services/virtual-measurement-metadata.utils.js +25 -0
- package/dist/plugins/devices-virtual/services/virtual-measurement-metadata.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-operator-host.service.d.ts +24 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-operator-host.service.js +145 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-operator-host.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-operator.registry.d.ts +18 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-operator.registry.js +86 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-operator.registry.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-profile.utils.d.ts +29 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-profile.utils.js +136 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-profile.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-transform.utils.d.ts +59 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-transform.utils.js +165 -0
- package/dist/plugins/devices-virtual/services/virtual-numeric-transform.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-producer-config.service.d.ts +64 -0
- package/dist/plugins/devices-virtual/services/virtual-producer-config.service.js +694 -0
- package/dist/plugins/devices-virtual/services/virtual-producer-config.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-producer-state.service.d.ts +60 -0
- package/dist/plugins/devices-virtual/services/virtual-producer-state.service.js +484 -0
- package/dist/plugins/devices-virtual/services/virtual-producer-state.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-property-index.service.d.ts +11 -2
- package/dist/plugins/devices-virtual/services/virtual-property-index.service.js +166 -13
- package/dist/plugins/devices-virtual/services/virtual-property-index.service.js.map +1 -1
- package/dist/plugins/devices-virtual/services/virtual-source-eligibility.utils.d.ts +3 -0
- package/dist/plugins/devices-virtual/services/virtual-source-eligibility.utils.js +10 -0
- package/dist/plugins/devices-virtual/services/virtual-source-eligibility.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-authoring.service.d.ts +27 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-authoring.service.js +385 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-authoring.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-automation.service.d.ts +90 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-automation.service.js +1189 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-automation.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-branch.utils.d.ts +5 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-branch.utils.js +29 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-branch.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-claims.service.d.ts +80 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-claims.service.js +489 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-claims.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.service.d.ts +80 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.service.js +580 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.utils.d.ts +58 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.utils.js +106 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-config.service.d.ts +909 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-config.service.js +1171 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-config.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-contract.utils.d.ts +5 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-contract.utils.js +51 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-contract.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-inputs.service.d.ts +46 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-inputs.service.js +166 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-inputs.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-ownership.sql.d.ts +4 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-ownership.sql.js +59 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-ownership.sql.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-policy.utils.d.ts +45 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-policy.utils.js +149 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-policy.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime-ownership.d.ts +56 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime-ownership.js +680 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime-ownership.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime.service.d.ts +133 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime.service.js +1617 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-transport.service.d.ts +39 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-transport.service.js +561 -0
- package/dist/plugins/devices-virtual/services/virtual-thermostat-transport.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-config.service.d.ts +41 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-config.service.js +209 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-config.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-contract.utils.d.ts +8 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-contract.utils.js +103 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-contract.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-preview.utils.d.ts +3 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-preview.utils.js +18 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-preview.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-resolver.d.ts +15 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-resolver.js +102 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-resolver.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-runtime.service.d.ts +54 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-runtime.service.js +470 -0
- package/dist/plugins/devices-virtual/services/virtual-transform-runtime.service.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-typed-group.utils.d.ts +6 -0
- package/dist/plugins/devices-virtual/services/virtual-typed-group.utils.js +100 -0
- package/dist/plugins/devices-virtual/services/virtual-typed-group.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-value-source.service.d.ts +7 -0
- package/dist/plugins/devices-virtual/services/virtual-value-source.service.js +36 -2
- package/dist/plugins/devices-virtual/services/virtual-value-source.service.js.map +1 -1
- package/dist/plugins/devices-virtual/services/virtual-window-contact.utils.d.ts +17 -0
- package/dist/plugins/devices-virtual/services/virtual-window-contact.utils.js +52 -0
- package/dist/plugins/devices-virtual/services/virtual-window-contact.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/services/virtual-window-trend.utils.d.ts +44 -0
- package/dist/plugins/devices-virtual/services/virtual-window-trend.utils.js +171 -0
- package/dist/plugins/devices-virtual/services/virtual-window-trend.utils.js.map +1 -0
- package/dist/plugins/devices-virtual/subscribers/virtual-thermostat-ownership.subscriber.d.ts +30 -0
- package/dist/plugins/devices-virtual/subscribers/virtual-thermostat-ownership.subscriber.js +195 -0
- package/dist/plugins/devices-virtual/subscribers/virtual-thermostat-ownership.subscriber.js.map +1 -0
- package/dist/plugins/devices-virtual/subscribers/virtual-transform-metadata.subscriber.d.ts +9 -0
- package/dist/plugins/devices-virtual/subscribers/virtual-transform-metadata.subscriber.js +58 -0
- package/dist/plugins/devices-virtual/subscribers/virtual-transform-metadata.subscriber.js.map +1 -0
- package/dist/plugins/devices-virtual/validators/category-allowed-constraint.validator.d.ts +1 -1
- package/dist/plugins/devices-virtual/validators/category-allowed-constraint.validator.js +6 -1
- package/dist/plugins/devices-virtual/validators/category-allowed-constraint.validator.js.map +1 -1
- package/dist/plugins/devices-wled/interfaces/wled.interface.d.ts +7 -0
- package/dist/plugins/devices-wled/interfaces/wled.interface.js.map +1 -1
- package/dist/plugins/devices-wled/platforms/wled.device.platform.d.ts +4 -2
- package/dist/plugins/devices-wled/platforms/wled.device.platform.js +56 -9
- package/dist/plugins/devices-wled/platforms/wled.device.platform.js.map +1 -1
- package/dist/plugins/devices-wled/services/device-mapper.service.d.ts +3 -2
- package/dist/plugins/devices-wled/services/device-mapper.service.js +48 -1
- package/dist/plugins/devices-wled/services/device-mapper.service.js.map +1 -1
- package/dist/plugins/devices-wled/services/wled-client-adapter.service.d.ts +6 -1
- package/dist/plugins/devices-wled/services/wled-client-adapter.service.js +101 -13
- package/dist/plugins/devices-wled/services/wled-client-adapter.service.js.map +1 -1
- package/dist/plugins/devices-wled/services/wled.service.js +5 -2
- package/dist/plugins/devices-wled/services/wled.service.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/contracts/sample-source.contract.d.ts +38 -0
- package/dist/plugins/devices-zigbee2mqtt/contracts/sample-source.contract.js +95 -0
- package/dist/plugins/devices-zigbee2mqtt/contracts/sample-source.contract.js.map +1 -0
- package/dist/plugins/devices-zigbee2mqtt/devices-zigbee2mqtt.plugin.js +11 -1
- package/dist/plugins/devices-zigbee2mqtt/devices-zigbee2mqtt.plugin.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/entities/zigbee-sample-source.entity.d.ts +18 -0
- package/dist/plugins/devices-zigbee2mqtt/entities/zigbee-sample-source.entity.js +79 -0
- package/dist/plugins/devices-zigbee2mqtt/entities/zigbee-sample-source.entity.js.map +1 -0
- package/dist/plugins/devices-zigbee2mqtt/interfaces/zigbee2mqtt.interface.d.ts +11 -0
- package/dist/plugins/devices-zigbee2mqtt/platforms/zigbee2mqtt.device.platform.d.ts +11 -2
- package/dist/plugins/devices-zigbee2mqtt/platforms/zigbee2mqtt.device.platform.js +100 -11
- package/dist/plugins/devices-zigbee2mqtt/platforms/zigbee2mqtt.device.platform.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.d.ts +31 -13
- package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.js +166 -5
- package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.d.ts +1 -0
- package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.js +44 -3
- package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.d.ts +20 -3
- package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.js +156 -34
- package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.d.ts +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.js +14 -1
- package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/native-climate-adapter.service.d.ts +15 -0
- package/dist/plugins/devices-zigbee2mqtt/services/native-climate-adapter.service.js +249 -0
- package/dist/plugins/devices-zigbee2mqtt/services/native-climate-adapter.service.js.map +1 -0
- package/dist/plugins/devices-zigbee2mqtt/services/websocket-sample-evidence.d.ts +2 -0
- package/dist/plugins/devices-zigbee2mqtt/services/websocket-sample-evidence.js +15 -0
- package/dist/plugins/devices-zigbee2mqtt/services/websocket-sample-evidence.js.map +1 -0
- package/dist/plugins/devices-zigbee2mqtt/services/ws-client-adapter.service.d.ts +7 -1
- package/dist/plugins/devices-zigbee2mqtt/services/ws-client-adapter.service.js +45 -2
- package/dist/plugins/devices-zigbee2mqtt/services/ws-client-adapter.service.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/zigbee-sample-sources.service.d.ts +49 -0
- package/dist/plugins/devices-zigbee2mqtt/services/zigbee-sample-sources.service.js +264 -0
- package/dist/plugins/devices-zigbee2mqtt/services/zigbee-sample-sources.service.js.map +1 -0
- package/dist/plugins/devices-zigbee2mqtt/services/zigbee2mqtt.service.js +2 -0
- package/dist/plugins/devices-zigbee2mqtt/services/zigbee2mqtt.service.js.map +1 -1
- package/dist/plugins/scenes-local/platforms/local-scene.platform.d.ts +6 -3
- package/dist/plugins/scenes-local/platforms/local-scene.platform.js +101 -15
- package/dist/plugins/scenes-local/platforms/local-scene.platform.js.map +1 -1
- package/dist/plugins/spaces-home-control/activity/activity-actor.d.ts +2 -0
- package/dist/plugins/spaces-home-control/activity/activity-actor.js +14 -0
- package/dist/plugins/spaces-home-control/activity/activity-actor.js.map +1 -0
- package/dist/plugins/spaces-home-control/activity/activity-result.utils.d.ts +6 -0
- package/dist/plugins/spaces-home-control/activity/activity-result.utils.js +26 -0
- package/dist/plugins/spaces-home-control/activity/activity-result.utils.js.map +1 -0
- package/dist/plugins/spaces-home-control/activity/space-activity.constants.d.ts +32 -0
- package/dist/plugins/spaces-home-control/activity/space-activity.constants.js +40 -0
- package/dist/plugins/spaces-home-control/activity/space-activity.constants.js.map +1 -0
- package/dist/plugins/spaces-home-control/activity/space-activity.defaults.d.ts +3 -0
- package/dist/plugins/spaces-home-control/activity/space-activity.defaults.js +25 -0
- package/dist/plugins/spaces-home-control/activity/space-activity.defaults.js.map +1 -0
- package/dist/plugins/spaces-home-control/activity/validate-activity-configuration.d.ts +2 -0
- package/dist/plugins/spaces-home-control/activity/validate-activity-configuration.js +37 -0
- package/dist/plugins/spaces-home-control/activity/validate-activity-configuration.js.map +1 -0
- package/dist/plugins/spaces-home-control/controllers/space-mode-schedules.controller.d.ts +12 -0
- package/dist/plugins/spaces-home-control/controllers/space-mode-schedules.controller.js +97 -0
- package/dist/plugins/spaces-home-control/controllers/space-mode-schedules.controller.js.map +1 -0
- package/dist/plugins/spaces-home-control/controllers/space-modes.controller.d.ts +19 -0
- package/dist/plugins/spaces-home-control/controllers/space-modes.controller.js +220 -0
- package/dist/plugins/spaces-home-control/controllers/space-modes.controller.js.map +1 -0
- package/dist/plugins/spaces-home-control/controllers/space-occupancy.controller.d.ts +18 -0
- package/dist/plugins/spaces-home-control/controllers/space-occupancy.controller.js +147 -0
- package/dist/plugins/spaces-home-control/controllers/space-occupancy.controller.js.map +1 -0
- package/dist/plugins/spaces-home-control/controllers/spaces-domain.controller.js +4 -0
- package/dist/plugins/spaces-home-control/controllers/spaces-domain.controller.js.map +1 -1
- package/dist/plugins/spaces-home-control/dto/activity-mode.dto.d.ts +22 -0
- package/dist/plugins/spaces-home-control/dto/activity-mode.dto.js +119 -0
- package/dist/plugins/spaces-home-control/dto/activity-mode.dto.js.map +1 -0
- package/dist/plugins/spaces-home-control/dto/space-mode-schedule.dto.d.ts +18 -0
- package/dist/plugins/spaces-home-control/dto/space-mode-schedule.dto.js +127 -0
- package/dist/plugins/spaces-home-control/dto/space-mode-schedule.dto.js.map +1 -0
- package/dist/plugins/spaces-home-control/dto/space-occupancy.dto.d.ts +13 -0
- package/dist/plugins/spaces-home-control/dto/space-occupancy.dto.js +99 -0
- package/dist/plugins/spaces-home-control/dto/space-occupancy.dto.js.map +1 -0
- package/dist/plugins/spaces-home-control/entities/space-activity-config.entity.d.ts +12 -0
- package/dist/plugins/spaces-home-control/entities/space-activity-config.entity.js +72 -0
- package/dist/plugins/spaces-home-control/entities/space-activity-config.entity.js.map +1 -0
- package/dist/plugins/spaces-home-control/entities/space-activity-state.entity.d.ts +14 -0
- package/dist/plugins/spaces-home-control/entities/space-activity-state.entity.js +105 -0
- package/dist/plugins/spaces-home-control/entities/space-activity-state.entity.js.map +1 -0
- package/dist/plugins/spaces-home-control/entities/space-mode-schedule.entity.d.ts +19 -0
- package/dist/plugins/spaces-home-control/entities/space-mode-schedule.entity.js +110 -0
- package/dist/plugins/spaces-home-control/entities/space-mode-schedule.entity.js.map +1 -0
- package/dist/plugins/spaces-home-control/entities/space-occupancy.entity.d.ts +23 -0
- package/dist/plugins/spaces-home-control/entities/space-occupancy.entity.js +135 -0
- package/dist/plugins/spaces-home-control/entities/space-occupancy.entity.js.map +1 -0
- package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.d.ts +2 -0
- package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.js +23 -0
- package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.js.map +1 -1
- package/dist/plugins/spaces-home-control/listeners/websocket-exchange.listener.js +3 -0
- package/dist/plugins/spaces-home-control/listeners/websocket-exchange.listener.js.map +1 -1
- package/dist/plugins/spaces-home-control/models/activity-configuration.model.d.ts +27 -0
- package/dist/plugins/spaces-home-control/models/activity-configuration.model.js +182 -0
- package/dist/plugins/spaces-home-control/models/activity-configuration.model.js.map +1 -0
- package/dist/plugins/spaces-home-control/models/activity-response.model.d.ts +16 -0
- package/dist/plugins/spaces-home-control/models/activity-response.model.js +79 -0
- package/dist/plugins/spaces-home-control/models/activity-response.model.js.map +1 -0
- package/dist/plugins/spaces-home-control/models/activity-result.model.d.ts +6 -0
- package/dist/plugins/spaces-home-control/models/activity-result.model.js +37 -0
- package/dist/plugins/spaces-home-control/models/activity-result.model.js.map +1 -0
- package/dist/plugins/spaces-home-control/models/climate-contribution.model.d.ts +11 -0
- package/dist/plugins/spaces-home-control/models/climate-contribution.model.js +66 -0
- package/dist/plugins/spaces-home-control/models/climate-contribution.model.js.map +1 -0
- package/dist/plugins/spaces-home-control/models/space-mode-schedule-response.model.d.ts +9 -0
- package/dist/plugins/spaces-home-control/models/space-mode-schedule-response.model.js +45 -0
- package/dist/plugins/spaces-home-control/models/space-mode-schedule-response.model.js.map +1 -0
- package/dist/plugins/spaces-home-control/models/space-mode-schedule.model.d.ts +34 -0
- package/dist/plugins/spaces-home-control/models/space-mode-schedule.model.js +170 -0
- package/dist/plugins/spaces-home-control/models/space-mode-schedule.model.js.map +1 -0
- package/dist/plugins/spaces-home-control/models/space-occupancy.model.d.ts +26 -0
- package/dist/plugins/spaces-home-control/models/space-occupancy.model.js +121 -0
- package/dist/plugins/spaces-home-control/models/space-occupancy.model.js.map +1 -0
- package/dist/plugins/spaces-home-control/models/spaces-response.model.d.ts +13 -0
- package/dist/plugins/spaces-home-control/models/spaces-response.model.js +81 -2
- package/dist/plugins/spaces-home-control/models/spaces-response.model.js.map +1 -1
- package/dist/plugins/spaces-home-control/occupancy/occupancy-admission.d.ts +7 -0
- package/dist/plugins/spaces-home-control/occupancy/occupancy-admission.js +57 -0
- package/dist/plugins/spaces-home-control/occupancy/occupancy-admission.js.map +1 -0
- package/dist/plugins/spaces-home-control/occupancy/space-occupancy.types.d.ts +31 -0
- package/dist/plugins/spaces-home-control/occupancy/space-occupancy.types.js +30 -0
- package/dist/plugins/spaces-home-control/occupancy/space-occupancy.types.js.map +1 -0
- package/dist/plugins/spaces-home-control/schedule/schedule-time.d.ts +9 -0
- package/dist/plugins/spaces-home-control/schedule/schedule-time.js +79 -0
- package/dist/plugins/spaces-home-control/schedule/schedule-time.js.map +1 -0
- package/dist/plugins/spaces-home-control/schedule/space-mode-schedule.types.d.ts +28 -0
- package/dist/plugins/spaces-home-control/schedule/space-mode-schedule.types.js +7 -0
- package/dist/plugins/spaces-home-control/schedule/space-mode-schedule.types.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/activity-test-support.d.ts +16 -0
- package/dist/plugins/spaces-home-control/services/activity-test-support.js +34 -0
- package/dist/plugins/spaces-home-control/services/activity-test-support.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/climate-contribution-planner.service.d.ts +15 -0
- package/dist/plugins/spaces-home-control/services/climate-contribution-planner.service.js +97 -0
- package/dist/plugins/spaces-home-control/services/climate-contribution-planner.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/climate-intent.service.d.ts +15 -2
- package/dist/plugins/spaces-home-control/services/climate-intent.service.js +155 -15
- package/dist/plugins/spaces-home-control/services/climate-intent.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/cover-group-intent.port.d.ts +31 -0
- package/dist/plugins/spaces-home-control/services/cover-group-intent.port.js +189 -0
- package/dist/plugins/spaces-home-control/services/cover-group-intent.port.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/covers-intent.service.d.ts +8 -3
- package/dist/plugins/spaces-home-control/services/covers-intent.service.js +139 -65
- package/dist/plugins/spaces-home-control/services/covers-intent.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/lighting-contribution-planner.service.d.ts +16 -0
- package/dist/plugins/spaces-home-control/services/lighting-contribution-planner.service.js +66 -0
- package/dist/plugins/spaces-home-control/services/lighting-contribution-planner.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/lighting-intent.service.d.ts +13 -3
- package/dist/plugins/spaces-home-control/services/lighting-intent.service.js +93 -13
- package/dist/plugins/spaces-home-control/services/lighting-intent.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-activity-config.service.d.ts +25 -0
- package/dist/plugins/spaces-home-control/services/space-activity-config.service.js +144 -0
- package/dist/plugins/spaces-home-control/services/space-activity-config.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/space-activity-domains.service.d.ts +21 -0
- package/dist/plugins/spaces-home-control/services/space-activity-domains.service.js +139 -0
- package/dist/plugins/spaces-home-control/services/space-activity-domains.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/space-climate-automation.port.d.ts +17 -0
- package/dist/plugins/spaces-home-control/services/space-climate-automation.port.js +5 -0
- package/dist/plugins/spaces-home-control/services/space-climate-automation.port.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/space-climate-automation.service.d.ts +63 -0
- package/dist/plugins/spaces-home-control/services/space-climate-automation.service.js +722 -0
- package/dist/plugins/spaces-home-control/services/space-climate-automation.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/space-climate-state.service.d.ts +8 -3
- package/dist/plugins/spaces-home-control/services/space-climate-state.service.js +25 -19
- package/dist/plugins/spaces-home-control/services/space-climate-state.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-covers-state.service.d.ts +16 -2
- package/dist/plugins/spaces-home-control/services/space-covers-state.service.js +102 -18
- package/dist/plugins/spaces-home-control/services/space-covers-state.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-intent-base.service.d.ts +2 -0
- package/dist/plugins/spaces-home-control/services/space-intent-base.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-lighting-state.service.d.ts +4 -1
- package/dist/plugins/spaces-home-control/services/space-lighting-state.service.js +94 -24
- package/dist/plugins/spaces-home-control/services/space-lighting-state.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-media-activity.service.d.ts +8 -2
- package/dist/plugins/spaces-home-control/services/space-media-activity.service.js +79 -13
- package/dist/plugins/spaces-home-control/services/space-media-activity.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-mode-schedule-config.service.d.ts +24 -0
- package/dist/plugins/spaces-home-control/services/space-mode-schedule-config.service.js +132 -0
- package/dist/plugins/spaces-home-control/services/space-mode-schedule-config.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/space-mode-scheduler.service.d.ts +39 -0
- package/dist/plugins/spaces-home-control/services/space-mode-scheduler.service.js +289 -0
- package/dist/plugins/spaces-home-control/services/space-mode-scheduler.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/space-mode.service.d.ts +34 -0
- package/dist/plugins/spaces-home-control/services/space-mode.service.js +296 -0
- package/dist/plugins/spaces-home-control/services/space-mode.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/space-occupancy-config.service.d.ts +26 -0
- package/dist/plugins/spaces-home-control/services/space-occupancy-config.service.js +134 -0
- package/dist/plugins/spaces-home-control/services/space-occupancy-config.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/space-occupancy-inputs.service.d.ts +21 -0
- package/dist/plugins/spaces-home-control/services/space-occupancy-inputs.service.js +84 -0
- package/dist/plugins/spaces-home-control/services/space-occupancy-inputs.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/space-occupancy.service.d.ts +48 -0
- package/dist/plugins/spaces-home-control/services/space-occupancy.service.js +285 -0
- package/dist/plugins/spaces-home-control/services/space-occupancy.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/services/space-state-read.service.d.ts +5 -1
- package/dist/plugins/spaces-home-control/services/space-state-read.service.js +33 -7
- package/dist/plugins/spaces-home-control/services/space-state-read.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/spaces-home-control.openapi.js +52 -0
- package/dist/plugins/spaces-home-control/spaces-home-control.openapi.js.map +1 -1
- package/dist/plugins/spaces-home-control/spaces-home-control.plugin.d.ts +5 -1
- package/dist/plugins/spaces-home-control/spaces-home-control.plugin.js +57 -2
- package/dist/plugins/spaces-home-control/spaces-home-control.plugin.js.map +1 -1
- package/dist/spec/channels.d.ts +27 -4
- package/dist/spec/channels.js +37 -6
- package/dist/spec/channels.js.map +1 -1
- package/dist/spec/devices.d.ts +20 -0
- package/dist/spec/devices.js +20 -0
- package/dist/spec/devices.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,2131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _CoordinatedSqliteQueryRunner_instances, _CoordinatedSqliteQueryRunner_coordinator, _CoordinatedSqliteQueryRunner_managedLifecycle, _CoordinatedSqliteQueryRunner_checkNoMutationPins, _CoordinatedSqliteQueryRunner_recordNoMutationAttempt, _CoordinatedSqliteQueryRunner_retainQueryRefusal, _CoordinatedSqliteQueryRunner_nativeDispatchRefusal, _CoordinatedSqliteQueryRunner_finalValidationActive, _CoordinatedSqliteQueryRunner_finalValidationRefusal, _CoordinatedSqliteQueryRunner_assertFinalControlOrigin, _CoordinatedSqliteQueryRunner_validateNoMutationDispatch, _CoordinatedSqliteQueryRunner_blockedQuery, _CoordinatedSqliteQueryRunner_beginFullAbort, _CoordinatedSqliteQueryRunner_captureQueryFailure, _CoordinatedSqliteQueryRunner_latchNativeFailure, _CoordinatedSqliteQueryRunner_pumpNative, _CoordinatedSqliteQueryRunner_dispatchQueued, _CoordinatedSqliteQueryRunner_submitNative, _CoordinatedSqliteQueryRunner_noMutationTransactionControl, _CoordinatedSqliteQueryRunner_startManagedTransaction, _CoordinatedSqliteQueryRunner_startOriginalTransaction, _CoordinatedSqliteQueryRunner_startWithWriteIntent, _CoordinatedSqliteQueryRunner_commitManagedTransaction, _CoordinatedSqliteQueryRunner_rollbackManagedTransaction, _CoordinatedSqliteQueryRunner_dispatchGuardedCommit, _CoordinatedSqliteQueryRunner_refuseCommit, _CoordinatedSqliteQueryRunner_settleCommitScope, _CoordinatedSqliteQueryRunner_withTransactionControl, _CoordinatedSqliteQueryRunner_recoverTransaction, _CoordinatedSqliteQueryRunner_recoverOwnedTransaction;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SqliteDataSource = exports.SqliteCommitGuardRefusedError = void 0;
|
|
16
|
+
exports.createSqliteDataSource = createSqliteDataSource;
|
|
17
|
+
exports.registerSqliteCommitGuard = registerSqliteCommitGuard;
|
|
18
|
+
exports.captureSqliteNoMutationWindow = captureSqliteNoMutationWindow;
|
|
19
|
+
exports.observeSqliteOuterOutcome = observeSqliteOuterOutcome;
|
|
20
|
+
exports.hasCurrentSqliteConnectionLease = hasCurrentSqliteConnectionLease;
|
|
21
|
+
exports.isSqliteTransactionActive = isSqliteTransactionActive;
|
|
22
|
+
exports.outsideSqliteTransaction = outsideSqliteTransaction;
|
|
23
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
24
|
+
const node_util_1 = require("node:util");
|
|
25
|
+
const typeorm_1 = require("typeorm");
|
|
26
|
+
const SqliteQueryRunner_1 = require("typeorm/driver/sqlite/SqliteQueryRunner");
|
|
27
|
+
class SqliteCommitGuardRefusedError extends Error {
|
|
28
|
+
constructor(cause) {
|
|
29
|
+
super('SQLite outer COMMIT admission was refused before native submission', { cause });
|
|
30
|
+
this.name = 'SqliteCommitGuardRefusedError';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.SqliteCommitGuardRefusedError = SqliteCommitGuardRefusedError;
|
|
34
|
+
const leaseReleases = new WeakMap();
|
|
35
|
+
const nestedWakes = new WeakMap();
|
|
36
|
+
const nestedWaiters = new WeakMap();
|
|
37
|
+
const abortResolvers = new WeakMap();
|
|
38
|
+
const blockedRefusals = new WeakMap();
|
|
39
|
+
const queryDispatchFailures = new WeakMap();
|
|
40
|
+
const nativeActions = new WeakMap();
|
|
41
|
+
function tailWaiters(tail) {
|
|
42
|
+
let waiters = nestedWaiters.get(tail);
|
|
43
|
+
if (!waiters)
|
|
44
|
+
nestedWaiters.set(tail, (waiters = new Set()));
|
|
45
|
+
return waiters;
|
|
46
|
+
}
|
|
47
|
+
const noMutationCounterLimit = (1n << 64n) - 1n;
|
|
48
|
+
function isSqliteTransactionControl(sql) {
|
|
49
|
+
const command = sql.replace(/^(?:\s|;|--[^\n]*(?:\n|$)|\/\*[\s\S]*?\*\/)*/, '');
|
|
50
|
+
return /^(BEGIN|COMMIT|END|ROLLBACK|SAVEPOINT|RELEASE)\b/i.test(command);
|
|
51
|
+
}
|
|
52
|
+
function isNoMutationRead(sql, tables) {
|
|
53
|
+
if (typeof sql !== 'string')
|
|
54
|
+
return false;
|
|
55
|
+
const tokens = [];
|
|
56
|
+
const pattern = /\s+|"(?:[^"]|"")*"|`(?:[^`]|``)*`|\[(?:[^\]])*\]|'(?:[^']|'')*'|\?(?:\d+)?|[:@$][A-Za-z_][A-Za-z_0-9]*|(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?|[A-Za-z_][A-Za-z_0-9]*|<>|!=|<=|>=|\|\||[(),.*+/%=<>-]/gy;
|
|
57
|
+
let offset = 0;
|
|
58
|
+
while (offset < sql.length) {
|
|
59
|
+
pattern.lastIndex = offset;
|
|
60
|
+
const match = pattern.exec(sql);
|
|
61
|
+
if (!match || sql.includes('\0'))
|
|
62
|
+
return false;
|
|
63
|
+
offset = pattern.lastIndex;
|
|
64
|
+
const text = match[0];
|
|
65
|
+
if ((text === '-' && sql[offset] === '-') || (text === '/' && sql[offset] === '*'))
|
|
66
|
+
return false;
|
|
67
|
+
if (/^\s+$/.test(text))
|
|
68
|
+
continue;
|
|
69
|
+
const kind = /^["`[]/.test(text)
|
|
70
|
+
? 'identifier'
|
|
71
|
+
: /^[A-Za-z_]/.test(text)
|
|
72
|
+
? 'word'
|
|
73
|
+
: /^[?'\d.:@$]/.test(text)
|
|
74
|
+
? 'literal'
|
|
75
|
+
: 'symbol';
|
|
76
|
+
tokens.push({ text, kind });
|
|
77
|
+
}
|
|
78
|
+
let index = 0;
|
|
79
|
+
const peek = () => tokens[index]?.text.toUpperCase();
|
|
80
|
+
const take = (text) => {
|
|
81
|
+
if (peek() !== text)
|
|
82
|
+
return false;
|
|
83
|
+
index++;
|
|
84
|
+
return true;
|
|
85
|
+
};
|
|
86
|
+
const need = (text) => {
|
|
87
|
+
if (!take(text))
|
|
88
|
+
throw new Error('syntax');
|
|
89
|
+
};
|
|
90
|
+
const reserved = new Set('SELECT FROM WHERE JOIN LEFT RIGHT INNER OUTER CROSS ON AS DISTINCT AND OR NOT IS NULL TRUE FALSE BETWEEN IN ORDER BY GROUP HAVING LIMIT OFFSET ASC DESC UNION EXCEPT INTERSECT CASE WHEN THEN ELSE END COLLATE'.split(' '));
|
|
91
|
+
const identifier = () => {
|
|
92
|
+
const token = tokens[index++];
|
|
93
|
+
if (!token || (token.kind !== 'identifier' && (token.kind !== 'word' || reserved.has(token.text.toUpperCase()))))
|
|
94
|
+
throw new Error('identifier');
|
|
95
|
+
return token.kind === 'identifier' ? token.text.slice(1, -1).replace(/""/g, '"').replace(/``/g, '`') : token.text;
|
|
96
|
+
};
|
|
97
|
+
const alias = () => {
|
|
98
|
+
if (take('AS'))
|
|
99
|
+
identifier();
|
|
100
|
+
else if (tokens[index]?.kind === 'identifier' || (tokens[index]?.kind === 'word' && !reserved.has(peek())))
|
|
101
|
+
identifier();
|
|
102
|
+
};
|
|
103
|
+
const list = (operation) => {
|
|
104
|
+
operation();
|
|
105
|
+
while (take(','))
|
|
106
|
+
operation();
|
|
107
|
+
};
|
|
108
|
+
const expression = (minimum = 0) => {
|
|
109
|
+
if (take('NOT') || take('+') || take('-'))
|
|
110
|
+
expression(7);
|
|
111
|
+
else if (take('(')) {
|
|
112
|
+
if (peek() === 'SELECT')
|
|
113
|
+
select();
|
|
114
|
+
else
|
|
115
|
+
expression();
|
|
116
|
+
need(')');
|
|
117
|
+
}
|
|
118
|
+
else if (tokens[index]?.kind === 'literal' || ['NULL', 'TRUE', 'FALSE'].includes(peek()))
|
|
119
|
+
index++;
|
|
120
|
+
else if (take('*')) {
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
const token = tokens[index];
|
|
124
|
+
const name = identifier();
|
|
125
|
+
if (take('(')) {
|
|
126
|
+
if (token.kind !== 'word' || name.toUpperCase() !== 'COUNT')
|
|
127
|
+
throw new Error('function');
|
|
128
|
+
take('DISTINCT');
|
|
129
|
+
expression();
|
|
130
|
+
need(')');
|
|
131
|
+
}
|
|
132
|
+
else if (take('.')) {
|
|
133
|
+
if (!take('*'))
|
|
134
|
+
identifier();
|
|
135
|
+
if (peek() === '(')
|
|
136
|
+
throw new Error('qualified function');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
while (true) {
|
|
140
|
+
const op = peek();
|
|
141
|
+
const precedence = op === 'OR'
|
|
142
|
+
? 1
|
|
143
|
+
: op === 'AND'
|
|
144
|
+
? 2
|
|
145
|
+
: ['=', '!=', '<>', '<', '>', '<=', '>=', 'IS', 'IN', 'BETWEEN', 'NOT'].includes(op)
|
|
146
|
+
? 3
|
|
147
|
+
: ['+', '-', '||'].includes(op)
|
|
148
|
+
? 4
|
|
149
|
+
: ['*', '/', '%'].includes(op)
|
|
150
|
+
? 5
|
|
151
|
+
: 0;
|
|
152
|
+
if (!precedence || precedence <= minimum)
|
|
153
|
+
return;
|
|
154
|
+
index++;
|
|
155
|
+
let comparison = op;
|
|
156
|
+
if (op === 'NOT') {
|
|
157
|
+
comparison = peek();
|
|
158
|
+
if (!['IN', 'BETWEEN'].includes(comparison))
|
|
159
|
+
throw new Error('not');
|
|
160
|
+
index++;
|
|
161
|
+
}
|
|
162
|
+
if (comparison === 'IS')
|
|
163
|
+
take('NOT');
|
|
164
|
+
if (comparison === 'IN') {
|
|
165
|
+
need('(');
|
|
166
|
+
if (peek() === 'SELECT')
|
|
167
|
+
select();
|
|
168
|
+
else if (peek() !== ')')
|
|
169
|
+
list(() => expression());
|
|
170
|
+
need(')');
|
|
171
|
+
}
|
|
172
|
+
else if (comparison === 'BETWEEN') {
|
|
173
|
+
expression(3);
|
|
174
|
+
need('AND');
|
|
175
|
+
expression(3);
|
|
176
|
+
}
|
|
177
|
+
else
|
|
178
|
+
expression(precedence);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const source = () => {
|
|
182
|
+
if (take('(')) {
|
|
183
|
+
select();
|
|
184
|
+
need(')');
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
const table = identifier();
|
|
188
|
+
if (!tables.has(table) || table.toLowerCase().startsWith('pragma_') || peek() === '(' || peek() === '.')
|
|
189
|
+
throw new Error('table');
|
|
190
|
+
}
|
|
191
|
+
alias();
|
|
192
|
+
};
|
|
193
|
+
const select = () => {
|
|
194
|
+
need('SELECT');
|
|
195
|
+
take('DISTINCT');
|
|
196
|
+
list(() => {
|
|
197
|
+
expression();
|
|
198
|
+
alias();
|
|
199
|
+
});
|
|
200
|
+
if (take('FROM')) {
|
|
201
|
+
source();
|
|
202
|
+
while (true) {
|
|
203
|
+
if (take(',')) {
|
|
204
|
+
source();
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
const join = take('LEFT') || take('INNER') || take('CROSS');
|
|
208
|
+
if (join)
|
|
209
|
+
take('OUTER');
|
|
210
|
+
if (!take('JOIN')) {
|
|
211
|
+
if (join)
|
|
212
|
+
throw new Error('join');
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
source();
|
|
216
|
+
if (take('ON'))
|
|
217
|
+
expression();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (take('WHERE'))
|
|
221
|
+
expression();
|
|
222
|
+
if (take('GROUP')) {
|
|
223
|
+
need('BY');
|
|
224
|
+
list(() => expression());
|
|
225
|
+
}
|
|
226
|
+
if (take('HAVING'))
|
|
227
|
+
expression();
|
|
228
|
+
if (take('ORDER')) {
|
|
229
|
+
need('BY');
|
|
230
|
+
list(() => {
|
|
231
|
+
expression();
|
|
232
|
+
if (!take('ASC'))
|
|
233
|
+
take('DESC');
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
if (take('LIMIT')) {
|
|
237
|
+
expression();
|
|
238
|
+
if (take(',') || take('OFFSET'))
|
|
239
|
+
expression();
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
try {
|
|
243
|
+
select();
|
|
244
|
+
return index === tokens.length;
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
class SqliteConnectionCoordinator {
|
|
251
|
+
constructor() {
|
|
252
|
+
this.context = new node_async_hooks_1.AsyncLocalStorage();
|
|
253
|
+
this.queue = [];
|
|
254
|
+
this.contexts = new Set();
|
|
255
|
+
this.closed = false;
|
|
256
|
+
this.acquisitionTimeoutMs = 5_000;
|
|
257
|
+
}
|
|
258
|
+
get isClosed() {
|
|
259
|
+
return this.closed;
|
|
260
|
+
}
|
|
261
|
+
configure(options) {
|
|
262
|
+
if (options.acquisitionTimeoutMs !== undefined) {
|
|
263
|
+
if (!Number.isFinite(options.acquisitionTimeoutMs) || options.acquisitionTimeoutMs <= 0) {
|
|
264
|
+
throw new Error('SQLite acquisition timeout must be a positive finite number');
|
|
265
|
+
}
|
|
266
|
+
this.acquisitionTimeoutMs = options.acquisitionTimeoutMs;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
assertAvailable() {
|
|
270
|
+
if (this.closed)
|
|
271
|
+
throw new Error('SQLite DataSource has been destroyed; create a new DataSource instance');
|
|
272
|
+
if (this.failure)
|
|
273
|
+
throw this.failure;
|
|
274
|
+
}
|
|
275
|
+
close() {
|
|
276
|
+
this.closed = true;
|
|
277
|
+
if (this.owner)
|
|
278
|
+
this.owner.active = false;
|
|
279
|
+
this.owner = undefined;
|
|
280
|
+
this.rejectWaiters(new Error('SQLite DataSource was destroyed while waiting for connection ownership'));
|
|
281
|
+
}
|
|
282
|
+
get currentRunner() {
|
|
283
|
+
const context = this.context.getStore();
|
|
284
|
+
return context?.lease?.active ? context.lease.runner : undefined;
|
|
285
|
+
}
|
|
286
|
+
get isTransactionActive() {
|
|
287
|
+
return this.owner?.runner.isTransactionActive ?? false;
|
|
288
|
+
}
|
|
289
|
+
detach(operation) {
|
|
290
|
+
return this.context.exit(operation);
|
|
291
|
+
}
|
|
292
|
+
acquire(runner) {
|
|
293
|
+
this.assertAvailable();
|
|
294
|
+
return new Promise((resolve, reject) => {
|
|
295
|
+
const waiter = { runner, resolve, reject };
|
|
296
|
+
waiter.timer = setTimeout(() => {
|
|
297
|
+
const index = this.queue.indexOf(waiter);
|
|
298
|
+
if (index === -1)
|
|
299
|
+
return;
|
|
300
|
+
this.queue.splice(index, 1);
|
|
301
|
+
reject(new Error(`Timed out after ${this.acquisitionTimeoutMs}ms waiting for SQLite connection ownership. ` +
|
|
302
|
+
'Use runner.manager inside manual transactions; do not await independent database work or acquire other locks while holding a transaction.'));
|
|
303
|
+
}, this.acquisitionTimeoutMs);
|
|
304
|
+
this.queue.push(waiter);
|
|
305
|
+
this.admitNext();
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
admitNext() {
|
|
309
|
+
if (this.owner || this.closed || this.failure)
|
|
310
|
+
return;
|
|
311
|
+
const waiter = this.queue.shift();
|
|
312
|
+
if (!waiter)
|
|
313
|
+
return;
|
|
314
|
+
clearTimeout(waiter.timer);
|
|
315
|
+
const lease = { runner: waiter.runner, active: true };
|
|
316
|
+
leaseReleases.set(lease, () => {
|
|
317
|
+
if (!lease.active)
|
|
318
|
+
return;
|
|
319
|
+
lease.active = false;
|
|
320
|
+
if (this.owner === lease)
|
|
321
|
+
this.owner = undefined;
|
|
322
|
+
this.admitNext();
|
|
323
|
+
});
|
|
324
|
+
this.owner = lease;
|
|
325
|
+
waiter.resolve(lease);
|
|
326
|
+
}
|
|
327
|
+
rejectWaiters(error) {
|
|
328
|
+
for (const waiter of this.queue.splice(0)) {
|
|
329
|
+
clearTimeout(waiter.timer);
|
|
330
|
+
waiter.reject(error);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
run(lease, operation) {
|
|
334
|
+
this.assertAvailable();
|
|
335
|
+
if (lease?.aborted)
|
|
336
|
+
throw lease.aborted;
|
|
337
|
+
if (!lease?.active)
|
|
338
|
+
return operation();
|
|
339
|
+
return this.runContext(this.createContext(lease), operation);
|
|
340
|
+
}
|
|
341
|
+
createContext(lease) {
|
|
342
|
+
const parent = this.context.getStore();
|
|
343
|
+
return {
|
|
344
|
+
lease,
|
|
345
|
+
parent: parent?.lease === lease ? parent : undefined,
|
|
346
|
+
active: true,
|
|
347
|
+
accepting: true,
|
|
348
|
+
children: { finished: true },
|
|
349
|
+
completion: undefined,
|
|
350
|
+
operations: new Map(),
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
runContext(context, operation) {
|
|
354
|
+
let complete, fail;
|
|
355
|
+
context.completion = new Promise((resolve, reject) => {
|
|
356
|
+
complete = resolve;
|
|
357
|
+
fail = reject;
|
|
358
|
+
});
|
|
359
|
+
void context.completion.catch(() => undefined);
|
|
360
|
+
const recordFailure = context.lease.runner.captureOwnFailureRecorder(context.lease);
|
|
361
|
+
this.contexts.add(context);
|
|
362
|
+
const result = this.context.run(context, async () => {
|
|
363
|
+
try {
|
|
364
|
+
const value = await operation();
|
|
365
|
+
await this.drainOperations(context, true, true);
|
|
366
|
+
return value;
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
if (!context.nested?.refusal) {
|
|
370
|
+
recordFailure?.(error);
|
|
371
|
+
context.lease.runner.recordEarlyChildFailure(context.lease, error);
|
|
372
|
+
}
|
|
373
|
+
await this.drainOperations(context, false, true);
|
|
374
|
+
throw error;
|
|
375
|
+
}
|
|
376
|
+
finally {
|
|
377
|
+
context.active = false;
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
const retire = () => {
|
|
381
|
+
this.contexts.delete(context);
|
|
382
|
+
if (context.lease.closing)
|
|
383
|
+
context.lease.runner.releaseIfSettled();
|
|
384
|
+
};
|
|
385
|
+
void result.then(() => {
|
|
386
|
+
complete();
|
|
387
|
+
retire();
|
|
388
|
+
}, (cause) => {
|
|
389
|
+
fail(cause);
|
|
390
|
+
retire();
|
|
391
|
+
});
|
|
392
|
+
return result;
|
|
393
|
+
}
|
|
394
|
+
track(operation, nested = false) {
|
|
395
|
+
let parent = this.context.getStore();
|
|
396
|
+
if (!parent?.lease.active)
|
|
397
|
+
return operation();
|
|
398
|
+
const lease = parent.lease;
|
|
399
|
+
while (!parent.active || !parent.accepting) {
|
|
400
|
+
parent = parent.parent;
|
|
401
|
+
if (!parent || parent.lease !== lease) {
|
|
402
|
+
return Promise.reject(new Error('SQLite operation requires an active owning context on its original lease'));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const owner = parent;
|
|
406
|
+
const child = this.createContext(lease);
|
|
407
|
+
if (nested)
|
|
408
|
+
child.nested = this.prepareNested(owner, child);
|
|
409
|
+
const recordFailure = owner.lease.runner.captureChildFailureRecorder(owner.lease);
|
|
410
|
+
const promise = this.runContext(child, nested ? () => this.runNested(operation, owner) : operation);
|
|
411
|
+
owner.operations.set(promise, child);
|
|
412
|
+
void promise.then(() => owner.operations.delete(promise), (cause) => {
|
|
413
|
+
if (!child.nested?.refusal)
|
|
414
|
+
recordFailure?.(cause);
|
|
415
|
+
owner.operations.delete(promise);
|
|
416
|
+
});
|
|
417
|
+
return promise;
|
|
418
|
+
}
|
|
419
|
+
captureCommitContext(lease) {
|
|
420
|
+
const context = this.context.getStore();
|
|
421
|
+
if (!context?.active || context.lease !== lease || !lease.active || this.owner !== lease) {
|
|
422
|
+
throw new Error('SQLite COMMIT guard requires its current owning connection lease');
|
|
423
|
+
}
|
|
424
|
+
return context;
|
|
425
|
+
}
|
|
426
|
+
hasOutstanding(context) {
|
|
427
|
+
const ancestors = new Set();
|
|
428
|
+
for (let current = context; current; current = current.parent)
|
|
429
|
+
ancestors.add(current);
|
|
430
|
+
for (const candidate of this.contexts) {
|
|
431
|
+
if (candidate.lease !== context.lease)
|
|
432
|
+
continue;
|
|
433
|
+
if (!ancestors.has(candidate))
|
|
434
|
+
return true;
|
|
435
|
+
for (const child of candidate.operations.values())
|
|
436
|
+
if (!ancestors.has(child))
|
|
437
|
+
return true;
|
|
438
|
+
}
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
isCurrent(context) {
|
|
442
|
+
return context?.active && this.context.getStore() === context;
|
|
443
|
+
}
|
|
444
|
+
async drainCommitChildren(context, dispatch, propagateFailure = true) {
|
|
445
|
+
let failure;
|
|
446
|
+
while (true) {
|
|
447
|
+
this.assertAvailable();
|
|
448
|
+
if (!context.active || !context.lease.active || this.owner !== context.lease) {
|
|
449
|
+
throw new Error('SQLite guarded COMMIT lease expired');
|
|
450
|
+
}
|
|
451
|
+
const ancestors = new Set();
|
|
452
|
+
for (let ancestor = context; ancestor; ancestor = ancestor.parent) {
|
|
453
|
+
ancestors.add(ancestor);
|
|
454
|
+
}
|
|
455
|
+
const children = new Set();
|
|
456
|
+
for (const candidate of this.contexts) {
|
|
457
|
+
if (candidate.lease !== context.lease)
|
|
458
|
+
continue;
|
|
459
|
+
if (!ancestors.has(candidate))
|
|
460
|
+
children.add(candidate.completion);
|
|
461
|
+
for (const [promise, child] of candidate.operations) {
|
|
462
|
+
if (!ancestors.has(child))
|
|
463
|
+
children.add(promise);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
if (children.size === 0) {
|
|
467
|
+
if (propagateFailure && failure)
|
|
468
|
+
throw failure.cause;
|
|
469
|
+
dispatch();
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
const results = await Promise.allSettled(children);
|
|
473
|
+
const failed = results.find((result) => result.status === 'rejected');
|
|
474
|
+
if (failed?.status === 'rejected')
|
|
475
|
+
failure ??= { cause: failed.reason };
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
async drainCurrent(propagateFailure = true) {
|
|
479
|
+
const context = this.context.getStore();
|
|
480
|
+
if (context?.lease.active)
|
|
481
|
+
await this.drainOperations(context, propagateFailure);
|
|
482
|
+
}
|
|
483
|
+
markFailedStart() {
|
|
484
|
+
const context = this.context.getStore();
|
|
485
|
+
if (context?.lease.active && context.managedStart)
|
|
486
|
+
context.failedStart = true;
|
|
487
|
+
}
|
|
488
|
+
async managedTransaction(args, invoke) {
|
|
489
|
+
const context = this.context.getStore();
|
|
490
|
+
const callbackIndex = typeof args[0] === 'function' ? 0 : 1;
|
|
491
|
+
const callback = args[callbackIndex];
|
|
492
|
+
const wrappedArgs = [...args];
|
|
493
|
+
context.managedStart = true;
|
|
494
|
+
context.managed = true;
|
|
495
|
+
if (typeof callback === 'function') {
|
|
496
|
+
wrappedArgs[callbackIndex] = function (...callbackArgs) {
|
|
497
|
+
context.managedStart = false;
|
|
498
|
+
context.failedStart = false;
|
|
499
|
+
try {
|
|
500
|
+
const result = Reflect.apply(callback, this, callbackArgs);
|
|
501
|
+
const ordinary = node_util_1.types.isPromise(result) &&
|
|
502
|
+
Object.getPrototypeOf(result) === Promise.prototype &&
|
|
503
|
+
!Object.hasOwn(result, 'constructor') &&
|
|
504
|
+
!Object.hasOwn(result, 'then');
|
|
505
|
+
const observed = ordinary
|
|
506
|
+
? result
|
|
507
|
+
: result !== null && (typeof result === 'object' || typeof result === 'function')
|
|
508
|
+
? new Promise((resolve) => resolve(result))
|
|
509
|
+
: undefined;
|
|
510
|
+
if (observed !== undefined)
|
|
511
|
+
void Promise.prototype.then.call(observed, undefined, (cause) => {
|
|
512
|
+
context.primary ??= { cause };
|
|
513
|
+
});
|
|
514
|
+
return observed ?? result;
|
|
515
|
+
}
|
|
516
|
+
catch (cause) {
|
|
517
|
+
context.primary ??= { cause };
|
|
518
|
+
throw cause;
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
try {
|
|
523
|
+
return await invoke(wrappedArgs);
|
|
524
|
+
}
|
|
525
|
+
finally {
|
|
526
|
+
context.managedStart = false;
|
|
527
|
+
context.failedStart = false;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
consumeFailedStart() {
|
|
531
|
+
const context = this.context.getStore();
|
|
532
|
+
if (!context?.failedStart)
|
|
533
|
+
return false;
|
|
534
|
+
context.failedStart = false;
|
|
535
|
+
return true;
|
|
536
|
+
}
|
|
537
|
+
async drainOperations(context, propagateFailure = true, retire = false) {
|
|
538
|
+
while (context.operations.size > 0) {
|
|
539
|
+
const results = await Promise.allSettled([...context.operations.keys()]);
|
|
540
|
+
const failed = results.find((result) => result.status === 'rejected');
|
|
541
|
+
if (propagateFailure && failed?.status === 'rejected')
|
|
542
|
+
throw failed.reason;
|
|
543
|
+
}
|
|
544
|
+
if (retire)
|
|
545
|
+
context.accepting = false;
|
|
546
|
+
}
|
|
547
|
+
managedPrimary() {
|
|
548
|
+
for (let context = this.context.getStore(); context; context = context.parent) {
|
|
549
|
+
if (context.managed)
|
|
550
|
+
return context.primary;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
recordManagedFailure(cause) {
|
|
554
|
+
for (let context = this.context.getStore(); context; context = context.parent) {
|
|
555
|
+
if (context.managed) {
|
|
556
|
+
context.primary ??= { cause };
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
hasContexts(lease) {
|
|
562
|
+
return [...this.contexts].some((context) => context.lease === lease);
|
|
563
|
+
}
|
|
564
|
+
refuseQueued(lease) {
|
|
565
|
+
for (const context of this.contexts) {
|
|
566
|
+
const admission = context.nested;
|
|
567
|
+
if (context.lease !== lease || admission?.state !== 'queued')
|
|
568
|
+
continue;
|
|
569
|
+
admission.state = 'refused';
|
|
570
|
+
admission.refusal = lease.closing;
|
|
571
|
+
if (admission.previous)
|
|
572
|
+
tailWaiters(admission.previous).delete(nestedWakes.get(admission));
|
|
573
|
+
admission.previous = undefined;
|
|
574
|
+
nestedWakes.get(admission)();
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
async drainOwned(lease) {
|
|
578
|
+
await this.drainCommitChildren(this.captureCommitContext(lease), () => undefined, false);
|
|
579
|
+
}
|
|
580
|
+
prepareNested(owner, invocation) {
|
|
581
|
+
const previous = owner.children;
|
|
582
|
+
let wake;
|
|
583
|
+
const gate = new Promise((resolve) => {
|
|
584
|
+
wake = resolve;
|
|
585
|
+
});
|
|
586
|
+
const tail = { owner: invocation, finished: false };
|
|
587
|
+
const admission = { owner, invocation, previous, tail, state: 'queued', gate };
|
|
588
|
+
nestedWakes.set(admission, wake);
|
|
589
|
+
owner.children = tail;
|
|
590
|
+
if (previous.finished)
|
|
591
|
+
wake();
|
|
592
|
+
else
|
|
593
|
+
tailWaiters(previous).add(wake);
|
|
594
|
+
if (owner.lease.closing) {
|
|
595
|
+
admission.state = 'refused';
|
|
596
|
+
admission.refusal = owner.lease.closing;
|
|
597
|
+
tailWaiters(previous).delete(wake);
|
|
598
|
+
admission.previous = undefined;
|
|
599
|
+
wake();
|
|
600
|
+
}
|
|
601
|
+
return admission;
|
|
602
|
+
}
|
|
603
|
+
async runNested(operation, owner = this.context.getStore()) {
|
|
604
|
+
if (!owner?.lease.active)
|
|
605
|
+
return operation();
|
|
606
|
+
const admission = this.context.getStore().nested;
|
|
607
|
+
const { gate, tail } = admission;
|
|
608
|
+
const wake = nestedWakes.get(admission);
|
|
609
|
+
try {
|
|
610
|
+
await gate;
|
|
611
|
+
if (owner.lease.closing) {
|
|
612
|
+
admission.state = 'refused';
|
|
613
|
+
admission.refusal = owner.lease.closing;
|
|
614
|
+
await admission.refusal.ready;
|
|
615
|
+
throw admission.refusal.reason.cause;
|
|
616
|
+
}
|
|
617
|
+
if (!owner.lease.active)
|
|
618
|
+
throw new Error('Nested SQLite original lease expired');
|
|
619
|
+
admission.state = 'started';
|
|
620
|
+
return await this.run(owner.lease, operation);
|
|
621
|
+
}
|
|
622
|
+
finally {
|
|
623
|
+
if (admission.previous)
|
|
624
|
+
tailWaiters(admission.previous).delete(wake);
|
|
625
|
+
admission.previous = undefined;
|
|
626
|
+
admission.state = 'finished';
|
|
627
|
+
tail.finished = true;
|
|
628
|
+
for (const signal of tailWaiters(tail))
|
|
629
|
+
signal();
|
|
630
|
+
tailWaiters(tail).clear();
|
|
631
|
+
tail.owner = undefined;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
poison(error) {
|
|
635
|
+
this.failure = new Error('SQLite transaction recovery failed; create a new DataSource to replace this connection', {
|
|
636
|
+
cause: error,
|
|
637
|
+
});
|
|
638
|
+
this.rejectWaiters(this.failure);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const managedLifecycles = new WeakMap();
|
|
642
|
+
const coordinators = new WeakMap();
|
|
643
|
+
function coordinatorFor(dataSource) {
|
|
644
|
+
let coordinator = coordinators.get(dataSource);
|
|
645
|
+
if (!coordinator) {
|
|
646
|
+
coordinator = new SqliteConnectionCoordinator();
|
|
647
|
+
coordinators.set(dataSource, coordinator);
|
|
648
|
+
}
|
|
649
|
+
return coordinator;
|
|
650
|
+
}
|
|
651
|
+
function configureSqliteSchemaComparison(driver) {
|
|
652
|
+
const normalizeType = driver.normalizeType.bind(driver);
|
|
653
|
+
const findChangedColumns = driver.findChangedColumns.bind(driver);
|
|
654
|
+
driver.normalizeType = (column) => ('enum' in column && column.enum ? 'varchar' : normalizeType(column));
|
|
655
|
+
driver.findChangedColumns = (tableColumns, columnMetadatas) => {
|
|
656
|
+
const changed = new Set(findChangedColumns(tableColumns, columnMetadatas));
|
|
657
|
+
return [...new Set(columnMetadatas)].filter((column) => changed.has(column) ||
|
|
658
|
+
tableColumns.some((loaded) => loaded.name === column.databaseName && Boolean(loaded.enum) !== Boolean(column.enum)));
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
class SqliteDataSource extends typeorm_1.DataSource {
|
|
662
|
+
constructor(options, coordinationOptions = {}) {
|
|
663
|
+
super(options);
|
|
664
|
+
if (options.type !== 'sqlite')
|
|
665
|
+
throw new Error('SqliteDataSource requires the sqlite driver');
|
|
666
|
+
configureSqliteSchemaComparison(this.driver);
|
|
667
|
+
const coordinator = coordinatorFor(this);
|
|
668
|
+
coordinator.configure(coordinationOptions);
|
|
669
|
+
this.driver.createQueryRunner = () => new CoordinatedSqliteQueryRunner(this.driver, coordinator);
|
|
670
|
+
}
|
|
671
|
+
async initialize() {
|
|
672
|
+
coordinatorFor(this).assertAvailable();
|
|
673
|
+
return super.initialize();
|
|
674
|
+
}
|
|
675
|
+
async destroy() {
|
|
676
|
+
coordinatorFor(this).close();
|
|
677
|
+
await super.destroy();
|
|
678
|
+
}
|
|
679
|
+
createQueryRunner(mode = 'master') {
|
|
680
|
+
return coordinatorFor(this).currentRunner ?? super.createQueryRunner(mode);
|
|
681
|
+
}
|
|
682
|
+
async transactionWithWriteIntent(callback) {
|
|
683
|
+
const coordinator = coordinatorFor(this);
|
|
684
|
+
coordinator.assertAvailable();
|
|
685
|
+
if (!this.isInitialized)
|
|
686
|
+
throw new Error('SQLite write admission requires an initialized DataSource');
|
|
687
|
+
if (coordinator.currentRunner)
|
|
688
|
+
throw new Error('SQLite write admission requires a fresh connection lease');
|
|
689
|
+
const runner = this.createQueryRunner();
|
|
690
|
+
return runner.transactionWithWriteIntent(callback);
|
|
691
|
+
}
|
|
692
|
+
createEntityManager(queryRunner) {
|
|
693
|
+
const manager = super.createEntityManager(queryRunner);
|
|
694
|
+
const coordinator = coordinatorFor(this);
|
|
695
|
+
for (const method of ['transaction', 'save', 'remove', 'softRemove', 'recover']) {
|
|
696
|
+
const original = manager[method];
|
|
697
|
+
Object.defineProperty(manager, method, {
|
|
698
|
+
value: (...args) => {
|
|
699
|
+
const execute = async () => {
|
|
700
|
+
const runner = (manager.queryRunner ?? this.createQueryRunner());
|
|
701
|
+
return runner.withConnection(() => {
|
|
702
|
+
const invoke = (parameters) => Reflect.apply(original, runner.manager, parameters);
|
|
703
|
+
return method === 'transaction'
|
|
704
|
+
? coordinator.managedTransaction(args, (parameters) => managedLifecycles.get(runner)(parameters, original))
|
|
705
|
+
: invoke(args);
|
|
706
|
+
});
|
|
707
|
+
};
|
|
708
|
+
return coordinator.track(execute, method === 'transaction');
|
|
709
|
+
},
|
|
710
|
+
configurable: true,
|
|
711
|
+
writable: true,
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
return manager;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
exports.SqliteDataSource = SqliteDataSource;
|
|
718
|
+
function createSqliteDataSource(options) {
|
|
719
|
+
return new SqliteDataSource(options).initialize();
|
|
720
|
+
}
|
|
721
|
+
class CoordinatedSqliteQueryRunner extends SqliteQueryRunner_1.SqliteQueryRunner {
|
|
722
|
+
constructor(driver, coordinator) {
|
|
723
|
+
super(driver);
|
|
724
|
+
_CoordinatedSqliteQueryRunner_instances.add(this);
|
|
725
|
+
_CoordinatedSqliteQueryRunner_coordinator.set(this, void 0);
|
|
726
|
+
this.operationDepth = 0;
|
|
727
|
+
this.transactionControlDepth = 0;
|
|
728
|
+
this.terminalQuery = new node_async_hooks_1.AsyncLocalStorage();
|
|
729
|
+
this.startupQuery = new node_async_hooks_1.AsyncLocalStorage();
|
|
730
|
+
this.writeIntentRequested = false;
|
|
731
|
+
this.nativeCommitContext = new node_async_hooks_1.AsyncLocalStorage();
|
|
732
|
+
this.noMutationQuery = new node_async_hooks_1.AsyncLocalStorage();
|
|
733
|
+
this.noMutationOwnerCheck = new node_async_hooks_1.AsyncLocalStorage();
|
|
734
|
+
__classPrivateFieldSet(this, _CoordinatedSqliteQueryRunner_coordinator, coordinator, "f");
|
|
735
|
+
managedLifecycles.set(this, (args, original) => __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_managedLifecycle).call(this, args, original));
|
|
736
|
+
}
|
|
737
|
+
async withConnection(operation) {
|
|
738
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").assertAvailable();
|
|
739
|
+
const ownsLease = !this.lease?.active;
|
|
740
|
+
if (ownsLease)
|
|
741
|
+
this.lease = await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").acquire(this);
|
|
742
|
+
const lease = this.lease;
|
|
743
|
+
this.operationDepth++;
|
|
744
|
+
try {
|
|
745
|
+
return await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").run(lease, operation);
|
|
746
|
+
}
|
|
747
|
+
finally {
|
|
748
|
+
this.operationDepth--;
|
|
749
|
+
this.releaseIfSettled();
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
async query(query, parameters, useStructuredResult = false) {
|
|
753
|
+
const closing = this.lease?.active ? this.lease.closing : undefined;
|
|
754
|
+
const permit = this.terminalControlPermit;
|
|
755
|
+
this.terminalControlPermit = undefined;
|
|
756
|
+
if (closing &&
|
|
757
|
+
!((query === 'ROLLBACK' || query === 'COMMIT') &&
|
|
758
|
+
permit?.sql === query &&
|
|
759
|
+
permit?.scope === closing.scope &&
|
|
760
|
+
permit.context === __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").captureCommitContext(closing.scope.lease))) {
|
|
761
|
+
await closing.ready;
|
|
762
|
+
throw closing.reason.cause;
|
|
763
|
+
}
|
|
764
|
+
const terminal = closing
|
|
765
|
+
? { closing, sql: query, connected: false, dispatched: false }
|
|
766
|
+
: undefined;
|
|
767
|
+
const startup = this.startupPermit === query;
|
|
768
|
+
this.startupPermit = undefined;
|
|
769
|
+
if (this.guardedCommit && !this.guardedCommit.noMutation && !startup)
|
|
770
|
+
this.guardedCommit.issuedBeforeCapture = true;
|
|
771
|
+
const entryScope = this.guardedCommit;
|
|
772
|
+
let ticket;
|
|
773
|
+
try {
|
|
774
|
+
ticket = __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_recordNoMutationAttempt).call(this, query);
|
|
775
|
+
if (this.writeAdmission) {
|
|
776
|
+
const permitted = this.writeAdmission === 'armed' && query === 'BEGIN IMMEDIATE TRANSACTION';
|
|
777
|
+
this.writeAdmission = 'pending';
|
|
778
|
+
if (!permitted) {
|
|
779
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").track(() => Promise.reject(new Error('SQLite write admission forbids queries before BEGIN acknowledgement')));
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
const command = query.replace(/^(?:\s|;|--[^\n]*(?:\n|$)|\/\*[\s\S]*?\*\/)*/, '');
|
|
783
|
+
if (this.transactionControlDepth === 0 && /^(BEGIN|COMMIT|END|ROLLBACK|SAVEPOINT|RELEASE)\b/i.test(command)) {
|
|
784
|
+
throw new Error('Use QueryRunner transaction methods for SQLite transaction control');
|
|
785
|
+
}
|
|
786
|
+
const scope = this.guardedCommit;
|
|
787
|
+
if ((scope?.guards.length || scope?.noMutation) && (scope.phase === 'sealed' || scope.phase === 'submitted')) {
|
|
788
|
+
const cause = new Error('SQLite guarded COMMIT is sealed against new candidate queries');
|
|
789
|
+
if (scope.noMutation)
|
|
790
|
+
scope.noMutation.anomaly ??= { cause };
|
|
791
|
+
throw cause;
|
|
792
|
+
}
|
|
793
|
+
const outerCommit = command === 'COMMIT' && this.transactionDepth === 1 ? scope : undefined;
|
|
794
|
+
const invoke = () => {
|
|
795
|
+
if (terminal)
|
|
796
|
+
terminal.context = __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").captureCommitContext(terminal.closing.scope.lease);
|
|
797
|
+
return this.terminalQuery.run(terminal, () => this.nativeCommitContext.run(outerCommit, () => super.query(query, parameters, useStructuredResult)));
|
|
798
|
+
};
|
|
799
|
+
if (!ticket)
|
|
800
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").track(() => this.withConnection(() => this.startupQuery.run({ connected: !startup }, invoke)));
|
|
801
|
+
return await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").track(() => this.withConnection(async () => {
|
|
802
|
+
try {
|
|
803
|
+
if (ticket.scope.noMutation.terminal && !ticket.cleanup && query !== 'COMMIT')
|
|
804
|
+
return await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_blockedQuery).call(this, ticket);
|
|
805
|
+
const failed = new Promise((_resolve, reject) => {
|
|
806
|
+
queryDispatchFailures.set(ticket, reject);
|
|
807
|
+
});
|
|
808
|
+
const original = this.noMutationQuery.run(ticket, () => invoke());
|
|
809
|
+
return (await Promise.race([original, failed]));
|
|
810
|
+
}
|
|
811
|
+
catch (cause) {
|
|
812
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_captureQueryFailure).call(this, ticket, cause);
|
|
813
|
+
throw cause;
|
|
814
|
+
}
|
|
815
|
+
finally {
|
|
816
|
+
if (ticket) {
|
|
817
|
+
ticket.active = false;
|
|
818
|
+
ticket.sql = undefined;
|
|
819
|
+
queryDispatchFailures.delete(ticket);
|
|
820
|
+
ticket.scope.noMutation?.pending.delete(ticket);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}));
|
|
824
|
+
}
|
|
825
|
+
catch (cause) {
|
|
826
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_retainQueryRefusal).call(this, entryScope, cause);
|
|
827
|
+
throw cause;
|
|
828
|
+
}
|
|
829
|
+
finally {
|
|
830
|
+
if (ticket) {
|
|
831
|
+
ticket.active = false;
|
|
832
|
+
ticket.sql = undefined;
|
|
833
|
+
queryDispatchFailures.delete(ticket);
|
|
834
|
+
ticket.scope.noMutation?.pending.delete(ticket);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
captureNoMutationWindow(manager, ownerCurrent) {
|
|
839
|
+
const receipt = this.observeOuterOutcome(manager);
|
|
840
|
+
const scope = this.guardedCommit;
|
|
841
|
+
if (scope.noMutation)
|
|
842
|
+
throw new Error('Original SQLite no-mutation window already exists');
|
|
843
|
+
const evidence = {
|
|
844
|
+
queue: [],
|
|
845
|
+
physical: () => false,
|
|
846
|
+
decision: 'undecided',
|
|
847
|
+
attempts: 0n,
|
|
848
|
+
mutations: 0n,
|
|
849
|
+
pending: new Set(),
|
|
850
|
+
current: () => false,
|
|
851
|
+
pinned: () => false,
|
|
852
|
+
read: () => false,
|
|
853
|
+
};
|
|
854
|
+
scope.noMutation = evidence;
|
|
855
|
+
blockedRefusals.set(evidence, []);
|
|
856
|
+
try {
|
|
857
|
+
const source = this.connection, driver = this.driver;
|
|
858
|
+
const native = driver.databaseConnection;
|
|
859
|
+
const all = native.all, run = native.run;
|
|
860
|
+
Object.assign(evidence, {
|
|
861
|
+
native,
|
|
862
|
+
all,
|
|
863
|
+
run,
|
|
864
|
+
physical: () => scope === this.guardedCommit &&
|
|
865
|
+
scope.lease === this.lease &&
|
|
866
|
+
scope.lease.active &&
|
|
867
|
+
!__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").isClosed &&
|
|
868
|
+
source.isInitialized &&
|
|
869
|
+
this.connection === source &&
|
|
870
|
+
this.driver === driver &&
|
|
871
|
+
driver.databaseConnection === native &&
|
|
872
|
+
native.all === all &&
|
|
873
|
+
native.run === run &&
|
|
874
|
+
manager === this.manager &&
|
|
875
|
+
manager.queryRunner === this &&
|
|
876
|
+
manager.connection === source,
|
|
877
|
+
});
|
|
878
|
+
if (scope.issuedBeforeCapture)
|
|
879
|
+
throw new Error('SQLite no-mutation capture must precede candidate query/connect issuance');
|
|
880
|
+
this.registerCommitGuard(manager, () => {
|
|
881
|
+
if (evidence.decision !== 'applied' && evidence.decision !== 'unchanged')
|
|
882
|
+
throw new SqliteCommitGuardRefusedError(evidence.anomaly?.cause);
|
|
883
|
+
return true;
|
|
884
|
+
});
|
|
885
|
+
const context = __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").captureCommitContext(scope.lease);
|
|
886
|
+
evidence.owner = context;
|
|
887
|
+
const pin = (target, keys) => {
|
|
888
|
+
const prototype = Object.getPrototypeOf(target);
|
|
889
|
+
const descriptor = (key) => {
|
|
890
|
+
for (let owner = target; owner; owner = Object.getPrototypeOf(owner)) {
|
|
891
|
+
const value = Object.getOwnPropertyDescriptor(owner, key);
|
|
892
|
+
if (value)
|
|
893
|
+
return { owner, value };
|
|
894
|
+
}
|
|
895
|
+
return undefined;
|
|
896
|
+
};
|
|
897
|
+
const fields = keys.map((key) => descriptor(key));
|
|
898
|
+
if (fields.some((field) => field && !('value' in field.value)))
|
|
899
|
+
throw new Error('SQLite original dispatch accessor is unsupported');
|
|
900
|
+
return () => Object.getPrototypeOf(target) === prototype &&
|
|
901
|
+
keys.every((key, index) => {
|
|
902
|
+
const before = fields[index], after = descriptor(key);
|
|
903
|
+
return before === undefined
|
|
904
|
+
? after === undefined
|
|
905
|
+
: after !== undefined &&
|
|
906
|
+
before.owner === after.owner &&
|
|
907
|
+
'value' in after.value &&
|
|
908
|
+
['value', 'writable', 'enumerable', 'configurable'].every((field) => before.value[field] === after.value[field]);
|
|
909
|
+
});
|
|
910
|
+
};
|
|
911
|
+
const sourcePin = pin(source, ['isInitialized', 'driver', 'manager', 'query', 'createQueryRunner']);
|
|
912
|
+
const driverPin = pin(driver, ['databaseConnection', 'connection']);
|
|
913
|
+
const runnerPin = pin(this, [
|
|
914
|
+
'query',
|
|
915
|
+
'connect',
|
|
916
|
+
'startTransaction',
|
|
917
|
+
'commitTransaction',
|
|
918
|
+
'rollbackTransaction',
|
|
919
|
+
'release',
|
|
920
|
+
'manager',
|
|
921
|
+
'connection',
|
|
922
|
+
'driver',
|
|
923
|
+
'broadcaster',
|
|
924
|
+
]);
|
|
925
|
+
const managerPin = pin(manager, ['queryRunner', 'connection', 'query']);
|
|
926
|
+
const broadcasterPin = pin(this.broadcaster, [
|
|
927
|
+
'broadcast',
|
|
928
|
+
'broadcastBeforeQueryEvent',
|
|
929
|
+
'broadcastBeforeTransactionCommitEvent',
|
|
930
|
+
]);
|
|
931
|
+
const nativePin = pin(native, ['all', 'run']);
|
|
932
|
+
const tables = new Set(source.entityMetadatas.filter((meta) => meta.tableType !== 'view').map((meta) => meta.tableName));
|
|
933
|
+
Object.assign(evidence, {
|
|
934
|
+
native,
|
|
935
|
+
all,
|
|
936
|
+
run,
|
|
937
|
+
read: (sql) => isNoMutationRead(sql, tables),
|
|
938
|
+
physical: () => scope === this.guardedCommit &&
|
|
939
|
+
scope.lease === this.lease &&
|
|
940
|
+
scope.lease.active &&
|
|
941
|
+
!__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").isClosed &&
|
|
942
|
+
source.isInitialized &&
|
|
943
|
+
this.connection === source &&
|
|
944
|
+
this.driver === driver &&
|
|
945
|
+
driver.databaseConnection === native &&
|
|
946
|
+
nativePin() &&
|
|
947
|
+
manager === this.manager &&
|
|
948
|
+
manager.queryRunner === this &&
|
|
949
|
+
manager.connection === source,
|
|
950
|
+
current: () => evidence.pinned() &&
|
|
951
|
+
this.noMutationOwnerCheck.run(scope, ownerCurrent) &&
|
|
952
|
+
(!evidence.finalValidation || evidence.pinned()),
|
|
953
|
+
pinned: () => runnerPin() &&
|
|
954
|
+
managerPin() &&
|
|
955
|
+
sourcePin() &&
|
|
956
|
+
driverPin() &&
|
|
957
|
+
nativePin() &&
|
|
958
|
+
broadcasterPin() &&
|
|
959
|
+
scope === this.guardedCommit &&
|
|
960
|
+
scope.lease === this.lease &&
|
|
961
|
+
scope.lease.active &&
|
|
962
|
+
context.active &&
|
|
963
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").currentRunner === this &&
|
|
964
|
+
!__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").isClosed &&
|
|
965
|
+
source.isInitialized &&
|
|
966
|
+
this.connection === source &&
|
|
967
|
+
this.driver === driver &&
|
|
968
|
+
driver.databaseConnection === native &&
|
|
969
|
+
native.all === all &&
|
|
970
|
+
native.run === run &&
|
|
971
|
+
nativePin() &&
|
|
972
|
+
this.transactionDepth >= 1 &&
|
|
973
|
+
(!evidence.finalValidation || this.transactionDepth === 1) &&
|
|
974
|
+
this.isTransactionActive &&
|
|
975
|
+
manager === this.manager &&
|
|
976
|
+
manager.queryRunner === this &&
|
|
977
|
+
manager.connection === source &&
|
|
978
|
+
runnerPin() &&
|
|
979
|
+
managerPin() &&
|
|
980
|
+
broadcasterPin(),
|
|
981
|
+
});
|
|
982
|
+
const refuse = () => {
|
|
983
|
+
evidence.decision = 'refused';
|
|
984
|
+
throw new SqliteCommitGuardRefusedError(evidence.anomaly?.cause);
|
|
985
|
+
};
|
|
986
|
+
const clean = () => __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_checkNoMutationPins).call(this, evidence) && !evidence.anomaly && evidence.mutations === 0n;
|
|
987
|
+
if (!clean())
|
|
988
|
+
refuse();
|
|
989
|
+
const thisRunnerCurrent = () => __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_checkNoMutationPins).call(this, evidence);
|
|
990
|
+
const finalReady = () => {
|
|
991
|
+
try {
|
|
992
|
+
return (scope.phase === 'open' &&
|
|
993
|
+
scope.managedOwner === context &&
|
|
994
|
+
!evidence.ownerControlAttempted &&
|
|
995
|
+
this.transactionDepth === 1 &&
|
|
996
|
+
this.isTransactionActive &&
|
|
997
|
+
evidence.pinned() &&
|
|
998
|
+
!scope.lease.closing &&
|
|
999
|
+
!scope.lease.aborted &&
|
|
1000
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").captureCommitContext(scope.lease) === context &&
|
|
1001
|
+
!__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").hasOutstanding(context) &&
|
|
1002
|
+
!__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").managedPrimary() &&
|
|
1003
|
+
!scope.childFailure &&
|
|
1004
|
+
!evidence.anomaly &&
|
|
1005
|
+
!evidence.terminal &&
|
|
1006
|
+
!evidence.pending.size &&
|
|
1007
|
+
!evidence.inFlight &&
|
|
1008
|
+
!evidence.queue.length &&
|
|
1009
|
+
!evidence.reservation &&
|
|
1010
|
+
evidence.attempts < noMutationCounterLimit &&
|
|
1011
|
+
evidence.mutations < noMutationCounterLimit);
|
|
1012
|
+
}
|
|
1013
|
+
catch {
|
|
1014
|
+
return false;
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
const activate = () => {
|
|
1018
|
+
if (scope !== this.guardedCommit ||
|
|
1019
|
+
!scope.lease.active ||
|
|
1020
|
+
scope.phase === 'committed' ||
|
|
1021
|
+
scope.phase === 'settled')
|
|
1022
|
+
throw new SqliteCommitGuardRefusedError();
|
|
1023
|
+
const repeated = evidence.finalValidation;
|
|
1024
|
+
evidence.finalValidation = true;
|
|
1025
|
+
if (repeated ||
|
|
1026
|
+
evidence.decision !== 'undecided' ||
|
|
1027
|
+
!finalReady() ||
|
|
1028
|
+
!thisRunnerCurrent() ||
|
|
1029
|
+
!finalReady() ||
|
|
1030
|
+
evidence.decision !== 'undecided') {
|
|
1031
|
+
const cause = __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, scope, scope.childFailure
|
|
1032
|
+
? scope.childFailure.cause
|
|
1033
|
+
: evidence.anomaly
|
|
1034
|
+
? evidence.anomaly.cause
|
|
1035
|
+
: new Error('SQLite final validation requires its settled original outer scope'));
|
|
1036
|
+
evidence.decision = 'refused';
|
|
1037
|
+
throw cause;
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
let checkpoint, reserved = false;
|
|
1041
|
+
return Object.freeze({
|
|
1042
|
+
beginFinalValidation: activate,
|
|
1043
|
+
async reserveZeroRows(table, column) {
|
|
1044
|
+
if (evidence.finalValidation ||
|
|
1045
|
+
reserved ||
|
|
1046
|
+
checkpoint ||
|
|
1047
|
+
evidence.decision !== 'undecided' ||
|
|
1048
|
+
!/^[A-Za-z_][A-Za-z_0-9]*$/.test(table) ||
|
|
1049
|
+
!/^[A-Za-z_][A-Za-z_0-9]*$/.test(column) ||
|
|
1050
|
+
!clean())
|
|
1051
|
+
refuse();
|
|
1052
|
+
reserved = true;
|
|
1053
|
+
const sql = `UPDATE "${table}" SET "${column}"="${column}" WHERE 0`;
|
|
1054
|
+
evidence.reservation = sql;
|
|
1055
|
+
try {
|
|
1056
|
+
await manager.query(sql);
|
|
1057
|
+
}
|
|
1058
|
+
finally {
|
|
1059
|
+
evidence.reservation = undefined;
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
beginReads() {
|
|
1063
|
+
if (evidence.finalValidation ||
|
|
1064
|
+
checkpoint ||
|
|
1065
|
+
evidence.decision !== 'undecided' ||
|
|
1066
|
+
evidence.pending.size ||
|
|
1067
|
+
!clean())
|
|
1068
|
+
refuse();
|
|
1069
|
+
checkpoint = Object.freeze({ kind: 'sqlite-read-checkpoint' });
|
|
1070
|
+
return checkpoint;
|
|
1071
|
+
},
|
|
1072
|
+
armUnchanged(candidate) {
|
|
1073
|
+
if (evidence.finalValidation ||
|
|
1074
|
+
!checkpoint ||
|
|
1075
|
+
candidate !== checkpoint ||
|
|
1076
|
+
evidence.decision !== 'undecided' ||
|
|
1077
|
+
evidence.pending.size ||
|
|
1078
|
+
!clean())
|
|
1079
|
+
refuse();
|
|
1080
|
+
evidence.decision = 'unchanged';
|
|
1081
|
+
},
|
|
1082
|
+
applied() {
|
|
1083
|
+
if (evidence.decision !== 'undecided' ||
|
|
1084
|
+
scope.phase !== 'open' ||
|
|
1085
|
+
!scope.lease.active ||
|
|
1086
|
+
evidence.terminal !== undefined ||
|
|
1087
|
+
!thisRunnerCurrent() ||
|
|
1088
|
+
(evidence.finalValidation && (!finalReady() || evidence.decision !== 'undecided')))
|
|
1089
|
+
refuse();
|
|
1090
|
+
evidence.decision = 'applied';
|
|
1091
|
+
},
|
|
1092
|
+
get outcome() {
|
|
1093
|
+
return receipt.outcome;
|
|
1094
|
+
},
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
catch (cause) {
|
|
1098
|
+
evidence.decision = 'refused';
|
|
1099
|
+
evidence.anomaly ??= {
|
|
1100
|
+
cause: cause instanceof SqliteCommitGuardRefusedError ? cause.cause : cause,
|
|
1101
|
+
};
|
|
1102
|
+
throw cause;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
captureOwnFailureRecorder(lease) {
|
|
1106
|
+
const scope = this.guardedCommit;
|
|
1107
|
+
if (!scope || scope.lease !== lease)
|
|
1108
|
+
return;
|
|
1109
|
+
return (cause) => {
|
|
1110
|
+
if (scope === this.guardedCommit &&
|
|
1111
|
+
lease.active &&
|
|
1112
|
+
(scope.guards.length || scope.noMutation) &&
|
|
1113
|
+
scope.phase !== 'committed' &&
|
|
1114
|
+
scope.phase !== 'settled' &&
|
|
1115
|
+
!scope.noMutation?.terminal)
|
|
1116
|
+
scope.childFailure ??= { cause };
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
recordEarlyChildFailure(lease, cause) {
|
|
1120
|
+
const scope = this.guardedCommit;
|
|
1121
|
+
if (scope?.lease === lease && scope.noMutation && !scope.noMutation.terminal)
|
|
1122
|
+
this.captureChildFailureRecorder(lease)?.(cause);
|
|
1123
|
+
}
|
|
1124
|
+
async startTransaction(isolationLevel) {
|
|
1125
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_assertFinalControlOrigin).call(this, 'start');
|
|
1126
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_startManagedTransaction).call(this, isolationLevel);
|
|
1127
|
+
}
|
|
1128
|
+
async transactionWithWriteIntent(callback) {
|
|
1129
|
+
this.writeIntentRequested = true;
|
|
1130
|
+
try {
|
|
1131
|
+
return await this.withConnection(() => this.manager.transaction(callback));
|
|
1132
|
+
}
|
|
1133
|
+
finally {
|
|
1134
|
+
this.writeIntentRequested = false;
|
|
1135
|
+
this.writeAdmission = undefined;
|
|
1136
|
+
await this.release();
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
async commitTransaction() {
|
|
1140
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_assertFinalControlOrigin).call(this, 'commit');
|
|
1141
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_commitManagedTransaction).call(this);
|
|
1142
|
+
}
|
|
1143
|
+
async rollbackTransaction() {
|
|
1144
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_assertFinalControlOrigin).call(this, 'rollback');
|
|
1145
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_rollbackManagedTransaction).call(this);
|
|
1146
|
+
}
|
|
1147
|
+
captureChildFailureRecorder(lease) {
|
|
1148
|
+
const scope = this.guardedCommit;
|
|
1149
|
+
if (!scope || scope.lease !== lease || (scope.phase !== 'starting' && scope.phase !== 'open'))
|
|
1150
|
+
return undefined;
|
|
1151
|
+
return (cause) => {
|
|
1152
|
+
if (scope === this.guardedCommit &&
|
|
1153
|
+
lease.active &&
|
|
1154
|
+
(scope.phase === 'starting' || scope.phase === 'open') &&
|
|
1155
|
+
!scope.childFailure &&
|
|
1156
|
+
!scope.noMutation?.terminal) {
|
|
1157
|
+
scope.childFailure = { cause };
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
observeOuterOutcome(manager) {
|
|
1162
|
+
const scope = this.guardedCommit;
|
|
1163
|
+
if (manager !== this.manager ||
|
|
1164
|
+
manager.queryRunner !== this ||
|
|
1165
|
+
!scope ||
|
|
1166
|
+
!this.isTransactionActive ||
|
|
1167
|
+
this.transactionDepth !== 1 ||
|
|
1168
|
+
scope.phase !== 'open') {
|
|
1169
|
+
throw new Error('Native outcome observation requires its exact open outer manager');
|
|
1170
|
+
}
|
|
1171
|
+
scope.observed = true;
|
|
1172
|
+
return Object.freeze({
|
|
1173
|
+
get outcome() {
|
|
1174
|
+
return scope.outcome;
|
|
1175
|
+
},
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
registerCommitGuard(manager, guard) {
|
|
1179
|
+
const scope = this.guardedCommit;
|
|
1180
|
+
if (manager.queryRunner !== this || !scope || !this.isTransactionActive || scope.phase !== 'open') {
|
|
1181
|
+
throw new Error('SQLite COMMIT guards require an open transaction on its exact scoped manager');
|
|
1182
|
+
}
|
|
1183
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").captureCommitContext(scope.lease);
|
|
1184
|
+
scope.guards.push(guard);
|
|
1185
|
+
return {
|
|
1186
|
+
get outcome() {
|
|
1187
|
+
return scope.outcome;
|
|
1188
|
+
},
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
async connect() {
|
|
1192
|
+
const entryScope = this.guardedCommit;
|
|
1193
|
+
const terminal = this.terminalQuery.getStore();
|
|
1194
|
+
const entryClosing = this.lease?.active ? this.lease.closing : undefined;
|
|
1195
|
+
const terminalConnect = entryClosing &&
|
|
1196
|
+
terminal?.closing === entryClosing &&
|
|
1197
|
+
!terminal.connected &&
|
|
1198
|
+
terminal.context === __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").captureCommitContext(entryClosing.scope.lease);
|
|
1199
|
+
if (entryClosing && !terminalConnect) {
|
|
1200
|
+
await entryClosing.ready;
|
|
1201
|
+
throw entryClosing.reason.cause;
|
|
1202
|
+
}
|
|
1203
|
+
if (terminalConnect)
|
|
1204
|
+
terminal.connected = true;
|
|
1205
|
+
const entryWindow = entryScope?.noMutation && entryScope.phase !== 'committed' && entryScope.phase !== 'settled'
|
|
1206
|
+
? entryScope
|
|
1207
|
+
: undefined;
|
|
1208
|
+
const startup = this.startupQuery.getStore();
|
|
1209
|
+
if (entryScope && !entryScope.noMutation) {
|
|
1210
|
+
if (!startup || startup.connected)
|
|
1211
|
+
entryScope.issuedBeforeCapture = true;
|
|
1212
|
+
else
|
|
1213
|
+
startup.connected = true;
|
|
1214
|
+
}
|
|
1215
|
+
const entryTicket = this.noMutationQuery.getStore();
|
|
1216
|
+
const originalConnect = entryTicket !== undefined && !entryTicket.connected;
|
|
1217
|
+
let entryRefusal;
|
|
1218
|
+
if (entryWindow) {
|
|
1219
|
+
entryRefusal = __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_validateNoMutationDispatch).call(this, entryWindow, entryTicket, entryTicket?.sql ?? '');
|
|
1220
|
+
if (entryTicket)
|
|
1221
|
+
entryTicket.connected = true;
|
|
1222
|
+
if (!originalConnect)
|
|
1223
|
+
entryRefusal ??= __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, entryWindow, new Error('SQLite query ticket cannot lend its native connection'));
|
|
1224
|
+
}
|
|
1225
|
+
const connection = (await super.connect());
|
|
1226
|
+
const commitScope = this.nativeCommitContext.getStore();
|
|
1227
|
+
const activeScope = this.guardedCommit;
|
|
1228
|
+
const window = entryWindow ??
|
|
1229
|
+
(activeScope?.noMutation && activeScope.phase !== 'committed' && activeScope.phase !== 'settled'
|
|
1230
|
+
? activeScope
|
|
1231
|
+
: undefined);
|
|
1232
|
+
const connectionScope = entryScope ?? activeScope;
|
|
1233
|
+
const scope = commitScope ?? window ?? connectionScope;
|
|
1234
|
+
const closing = scope?.lease.closing ?? (this.lease?.active ? this.lease.closing : undefined);
|
|
1235
|
+
if (closing && (!terminalConnect || terminal.closing !== closing)) {
|
|
1236
|
+
await closing.ready;
|
|
1237
|
+
throw closing.reason.cause;
|
|
1238
|
+
}
|
|
1239
|
+
if (!scope)
|
|
1240
|
+
return connection;
|
|
1241
|
+
const ticket = this.noMutationQuery.getStore();
|
|
1242
|
+
if (window)
|
|
1243
|
+
entryRefusal ??= __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_validateNoMutationDispatch).call(this, window, ticket, ticket?.sql ?? '');
|
|
1244
|
+
const context = commitScope || window || terminalConnect ? __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").captureCommitContext(scope.lease) : undefined;
|
|
1245
|
+
const callbackContext = window ? node_async_hooks_1.AsyncLocalStorage.snapshot() : undefined;
|
|
1246
|
+
return new Proxy(connection, {
|
|
1247
|
+
get: (target, property) => {
|
|
1248
|
+
if (property === 'all' || ((window || connectionScope) && property === 'run')) {
|
|
1249
|
+
return (...args) => {
|
|
1250
|
+
const [query, parameters] = args;
|
|
1251
|
+
const last = args[args.length - 1];
|
|
1252
|
+
const callback = typeof last === 'function' ? last : undefined;
|
|
1253
|
+
if (!window && __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, scope)) {
|
|
1254
|
+
const refusal = __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, scope, new Error('SQLite saved facade lacks its original final-validation ticket'));
|
|
1255
|
+
if (!callback)
|
|
1256
|
+
throw refusal;
|
|
1257
|
+
callback.call(target, refusal);
|
|
1258
|
+
return target;
|
|
1259
|
+
}
|
|
1260
|
+
const closing = scope.lease.closing;
|
|
1261
|
+
if (!window && closing) {
|
|
1262
|
+
if (!terminalConnect ||
|
|
1263
|
+
terminal.closing !== closing ||
|
|
1264
|
+
!scope.lease.active ||
|
|
1265
|
+
scope !== this.guardedCommit ||
|
|
1266
|
+
!terminal.context.active ||
|
|
1267
|
+
property !== 'all' ||
|
|
1268
|
+
terminal.sql !== query ||
|
|
1269
|
+
(!terminal.retry &&
|
|
1270
|
+
(terminal !== this.terminalQuery.getStore() ||
|
|
1271
|
+
terminal.dispatched ||
|
|
1272
|
+
terminal.context !== __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").captureCommitContext(scope.lease)))) {
|
|
1273
|
+
const refusal = new SqliteCommitGuardRefusedError(closing.reason?.cause);
|
|
1274
|
+
if (!callback)
|
|
1275
|
+
throw refusal;
|
|
1276
|
+
callback.call(target, refusal);
|
|
1277
|
+
return target;
|
|
1278
|
+
}
|
|
1279
|
+
terminal.dispatched = true;
|
|
1280
|
+
terminal.retry = false;
|
|
1281
|
+
}
|
|
1282
|
+
if (window) {
|
|
1283
|
+
const refusal = entryRefusal ?? __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_validateNoMutationDispatch).call(this, window, ticket, query);
|
|
1284
|
+
if (refusal ||
|
|
1285
|
+
!originalConnect ||
|
|
1286
|
+
(__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, window) && !__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").isCurrent(context)) ||
|
|
1287
|
+
entryScope !== window ||
|
|
1288
|
+
entryTicket !== ticket ||
|
|
1289
|
+
!ticket?.active ||
|
|
1290
|
+
ticket.scope !== window ||
|
|
1291
|
+
ticket.sql !== query ||
|
|
1292
|
+
!window.noMutation.pending.has(ticket) ||
|
|
1293
|
+
(ticket.dispatched && !ticket.retry) ||
|
|
1294
|
+
(ticket.nativeMethod !== undefined && ticket.nativeMethod !== property) ||
|
|
1295
|
+
(isSqliteTransactionControl(query) && !ticket.control)) {
|
|
1296
|
+
callback.call(target, refusal ??
|
|
1297
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, window, new Error('SQLite native dispatch lacks its original single-use ticket')));
|
|
1298
|
+
return target;
|
|
1299
|
+
}
|
|
1300
|
+
ticket.nativeMethod ??= property;
|
|
1301
|
+
ticket.dispatched = true;
|
|
1302
|
+
ticket.retry = false;
|
|
1303
|
+
if (query !== 'COMMIT' || !commitScope)
|
|
1304
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_submitNative).call(this, window, ticket, property, query, parameters, callback, callbackContext, context);
|
|
1305
|
+
}
|
|
1306
|
+
if (property !== 'all' ||
|
|
1307
|
+
query !== 'COMMIT' ||
|
|
1308
|
+
!commitScope ||
|
|
1309
|
+
(scope.guards.length === 0 && !scope.observed && !scope.noMutation)) {
|
|
1310
|
+
const original = window ? (window.noMutation[property] ?? target[property]) : target[property];
|
|
1311
|
+
if (!window && closing && query === 'ROLLBACK')
|
|
1312
|
+
return target.all(query, parameters, function (error, rows) {
|
|
1313
|
+
if (error?.toString().includes('SQLITE_BUSY:'))
|
|
1314
|
+
terminal.retry = true;
|
|
1315
|
+
callback.call(this, error, rows);
|
|
1316
|
+
});
|
|
1317
|
+
return original.apply(window?.noMutation.native ?? target, args);
|
|
1318
|
+
}
|
|
1319
|
+
if (scope.guards.length === 0 && !scope.noMutation) {
|
|
1320
|
+
scope.outcome = 'unknown';
|
|
1321
|
+
return target.all(query, parameters, function (error, rows) {
|
|
1322
|
+
if (!error)
|
|
1323
|
+
scope.outcome = 'committed';
|
|
1324
|
+
callback.call(this, error, rows);
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_dispatchGuardedCommit).call(this, scope, context, target, query, parameters, callback);
|
|
1328
|
+
return target;
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
const value = Reflect.get(target, property);
|
|
1332
|
+
return typeof value === 'function'
|
|
1333
|
+
? (...args) => {
|
|
1334
|
+
if (__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, scope))
|
|
1335
|
+
throw __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, scope, new Error('Unsupported SQLite final-validation facade call'));
|
|
1336
|
+
return Reflect.apply(value, target, args);
|
|
1337
|
+
}
|
|
1338
|
+
: value;
|
|
1339
|
+
},
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
async release() {
|
|
1343
|
+
if (__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").isClosed) {
|
|
1344
|
+
this.isTransactionActive = false;
|
|
1345
|
+
this.transactionDepth = 0;
|
|
1346
|
+
await super.release();
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
while (this.operationDepth === 0 && this.isTransactionActive)
|
|
1350
|
+
await this.rollbackTransaction();
|
|
1351
|
+
await super.release();
|
|
1352
|
+
this.releaseIfSettled();
|
|
1353
|
+
}
|
|
1354
|
+
releaseIfSettled() {
|
|
1355
|
+
if (this.lease?.closing)
|
|
1356
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_settleCommitScope).call(this);
|
|
1357
|
+
if (this.lease &&
|
|
1358
|
+
this.operationDepth === 0 &&
|
|
1359
|
+
(!this.lease?.closing || !__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").hasContexts(this.lease)) &&
|
|
1360
|
+
!this.isTransactionActive &&
|
|
1361
|
+
!this.guardedCommit?.noMutation?.inFlight &&
|
|
1362
|
+
!this.guardedCommit?.noMutation?.queue.length &&
|
|
1363
|
+
!this.guardedCommit?.noMutation?.pending.size)
|
|
1364
|
+
leaseReleases.get(this.lease)();
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
_CoordinatedSqliteQueryRunner_coordinator = new WeakMap(), _CoordinatedSqliteQueryRunner_instances = new WeakSet(), _CoordinatedSqliteQueryRunner_managedLifecycle = function _CoordinatedSqliteQueryRunner_managedLifecycle(args, original) {
|
|
1368
|
+
const lifecycle = {
|
|
1369
|
+
context: __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").captureCommitContext(this.lease),
|
|
1370
|
+
state: 'new',
|
|
1371
|
+
};
|
|
1372
|
+
const claim = async (operation, isolation) => {
|
|
1373
|
+
const before = lifecycle.state;
|
|
1374
|
+
if (operation === 'start'
|
|
1375
|
+
? before !== 'new'
|
|
1376
|
+
: operation === 'commit'
|
|
1377
|
+
? before !== 'body'
|
|
1378
|
+
: !['start-failed', 'body', 'commit-failed'].includes(before))
|
|
1379
|
+
throw new Error('SQLite managed lifecycle was already claimed');
|
|
1380
|
+
lifecycle.state = operation === 'start' ? 'body' : operation === 'commit' ? 'committing' : 'rolling-back';
|
|
1381
|
+
try {
|
|
1382
|
+
if (operation === 'start')
|
|
1383
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_startManagedTransaction).call(this, isolation, lifecycle);
|
|
1384
|
+
else if (operation === 'commit')
|
|
1385
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_commitManagedTransaction).call(this, lifecycle);
|
|
1386
|
+
else
|
|
1387
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_rollbackManagedTransaction).call(this, lifecycle);
|
|
1388
|
+
if (operation !== 'start')
|
|
1389
|
+
lifecycle.state = operation === 'commit' ? 'commit-returned' : 'terminal';
|
|
1390
|
+
}
|
|
1391
|
+
catch (cause) {
|
|
1392
|
+
lifecycle.state =
|
|
1393
|
+
operation === 'rollback' ? 'terminal' : operation === 'commit' ? 'commit-failed' : 'start-failed';
|
|
1394
|
+
throw cause;
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
const released = () => this.isReleased, manager = () => this.manager;
|
|
1398
|
+
const view = Object.freeze({
|
|
1399
|
+
get isReleased() {
|
|
1400
|
+
return released();
|
|
1401
|
+
},
|
|
1402
|
+
get manager() {
|
|
1403
|
+
return manager();
|
|
1404
|
+
},
|
|
1405
|
+
startTransaction: (isolation) => claim('start', isolation),
|
|
1406
|
+
commitTransaction: () => claim('commit'),
|
|
1407
|
+
rollbackTransaction: () => claim('rollback'),
|
|
1408
|
+
});
|
|
1409
|
+
return Reflect.apply(original, Object.freeze({ queryRunner: view, connection: this.connection }), args);
|
|
1410
|
+
}, _CoordinatedSqliteQueryRunner_checkNoMutationPins = function _CoordinatedSqliteQueryRunner_checkNoMutationPins(evidence) {
|
|
1411
|
+
try {
|
|
1412
|
+
if (evidence.current() === true)
|
|
1413
|
+
return true;
|
|
1414
|
+
}
|
|
1415
|
+
catch (cause) {
|
|
1416
|
+
evidence.anomaly ??= { cause };
|
|
1417
|
+
}
|
|
1418
|
+
evidence.anomaly ??= { cause: new Error('Original SQLite no-mutation identity expired') };
|
|
1419
|
+
return false;
|
|
1420
|
+
}, _CoordinatedSqliteQueryRunner_recordNoMutationAttempt = function _CoordinatedSqliteQueryRunner_recordNoMutationAttempt(sql) {
|
|
1421
|
+
const scope = this.guardedCommit, evidence = scope?.noMutation;
|
|
1422
|
+
if (!evidence || scope.phase === 'committed' || scope.phase === 'settled')
|
|
1423
|
+
return undefined;
|
|
1424
|
+
const permit = this.noMutationControl;
|
|
1425
|
+
this.noMutationControl = undefined;
|
|
1426
|
+
const control = permit?.scope === scope && permit.sql === sql;
|
|
1427
|
+
const reservation = evidence.reservation === sql;
|
|
1428
|
+
evidence.reservation = undefined;
|
|
1429
|
+
if (evidence.attempts === noMutationCounterLimit || evidence.mutations === noMutationCounterLimit)
|
|
1430
|
+
evidence.anomaly ??= { cause: new Error('SQLite query witness exhausted') };
|
|
1431
|
+
else {
|
|
1432
|
+
evidence.attempts++;
|
|
1433
|
+
if ((!control || !permit.outer) && !reservation && !evidence.read(sql))
|
|
1434
|
+
evidence.mutations++;
|
|
1435
|
+
}
|
|
1436
|
+
const refusal = __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationRefusal).call(this, scope, sql, control && permit.outer);
|
|
1437
|
+
if (refusal)
|
|
1438
|
+
throw refusal;
|
|
1439
|
+
if (!__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, scope))
|
|
1440
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_checkNoMutationPins).call(this, evidence);
|
|
1441
|
+
if (isSqliteTransactionControl(sql) && !control) {
|
|
1442
|
+
const cause = new Error('SQLite transaction control requires its original internal invocation');
|
|
1443
|
+
evidence.anomaly ??= { cause };
|
|
1444
|
+
throw new SqliteCommitGuardRefusedError(cause);
|
|
1445
|
+
}
|
|
1446
|
+
const ticket = {
|
|
1447
|
+
scope,
|
|
1448
|
+
sql,
|
|
1449
|
+
control,
|
|
1450
|
+
outer: control && permit.outer,
|
|
1451
|
+
cleanup: control && permit.outer && sql === 'ROLLBACK',
|
|
1452
|
+
active: true,
|
|
1453
|
+
connected: false,
|
|
1454
|
+
dispatched: false,
|
|
1455
|
+
retry: false,
|
|
1456
|
+
};
|
|
1457
|
+
evidence.pending.add(ticket);
|
|
1458
|
+
return ticket;
|
|
1459
|
+
}, _CoordinatedSqliteQueryRunner_retainQueryRefusal = function _CoordinatedSqliteQueryRunner_retainQueryRefusal(scope, cause) {
|
|
1460
|
+
if (scope?.noMutation &&
|
|
1461
|
+
scope === this.guardedCommit &&
|
|
1462
|
+
scope.phase !== 'committed' &&
|
|
1463
|
+
scope.phase !== 'settled' &&
|
|
1464
|
+
!scope.noMutation.terminal) {
|
|
1465
|
+
scope.childFailure ??= { cause };
|
|
1466
|
+
}
|
|
1467
|
+
}, _CoordinatedSqliteQueryRunner_nativeDispatchRefusal = function _CoordinatedSqliteQueryRunner_nativeDispatchRefusal(scope, cause) {
|
|
1468
|
+
scope.noMutation.anomaly ??= { cause };
|
|
1469
|
+
const refusal = new SqliteCommitGuardRefusedError(cause);
|
|
1470
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_retainQueryRefusal).call(this, scope, refusal);
|
|
1471
|
+
return refusal;
|
|
1472
|
+
}, _CoordinatedSqliteQueryRunner_finalValidationActive = function _CoordinatedSqliteQueryRunner_finalValidationActive(scope) {
|
|
1473
|
+
return scope?.noMutation?.finalValidation && scope.phase !== 'committed' && scope.phase !== 'settled';
|
|
1474
|
+
}, _CoordinatedSqliteQueryRunner_finalValidationRefusal = function _CoordinatedSqliteQueryRunner_finalValidationRefusal(scope, sql, outer = false) {
|
|
1475
|
+
if (!__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, scope))
|
|
1476
|
+
return;
|
|
1477
|
+
if (outer && (sql === 'ROLLBACK' || sql === 'COMMIT'))
|
|
1478
|
+
return;
|
|
1479
|
+
const evidence = scope.noMutation;
|
|
1480
|
+
if (!evidence.read(sql) ||
|
|
1481
|
+
!__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_checkNoMutationPins).call(this, evidence) ||
|
|
1482
|
+
evidence.anomaly ||
|
|
1483
|
+
scope.childFailure ||
|
|
1484
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").managedPrimary() ||
|
|
1485
|
+
evidence.decision === 'refused' ||
|
|
1486
|
+
evidence.terminal ||
|
|
1487
|
+
scope.lease.closing ||
|
|
1488
|
+
scope.phase !== 'open')
|
|
1489
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, scope, scope.childFailure
|
|
1490
|
+
? scope.childFailure.cause
|
|
1491
|
+
: evidence.anomaly
|
|
1492
|
+
? evidence.anomaly.cause
|
|
1493
|
+
: new Error('SQLite final validation admits only original closed-grammar reads'));
|
|
1494
|
+
}, _CoordinatedSqliteQueryRunner_assertFinalControlOrigin = function _CoordinatedSqliteQueryRunner_assertFinalControlOrigin(operation, lifecycle) {
|
|
1495
|
+
const scope = this.guardedCommit;
|
|
1496
|
+
const ownerCheck = scope !== undefined && this.noMutationOwnerCheck.getStore() === scope;
|
|
1497
|
+
if (scope?.noMutation && !lifecycle && scope.phase !== 'committed' && scope.phase !== 'settled')
|
|
1498
|
+
scope.noMutation.ownerControlAttempted = true;
|
|
1499
|
+
if (!__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, scope))
|
|
1500
|
+
return;
|
|
1501
|
+
let original = false;
|
|
1502
|
+
try {
|
|
1503
|
+
original =
|
|
1504
|
+
!ownerCheck &&
|
|
1505
|
+
operation !== 'start' &&
|
|
1506
|
+
((lifecycle?.scope === scope &&
|
|
1507
|
+
lifecycle.context === scope.managedOwner &&
|
|
1508
|
+
lifecycle.state === (operation === 'commit' ? 'committing' : 'rolling-back')) ||
|
|
1509
|
+
(operation === 'rollback' && !scope.managedOwner)) &&
|
|
1510
|
+
(this.transactionDepth === 1 || operation === 'rollback') &&
|
|
1511
|
+
scope.lease === this.lease &&
|
|
1512
|
+
scope.lease.active &&
|
|
1513
|
+
(!scope.managedOwner || (lifecycle?.context === scope.noMutation.owner && lifecycle.context.active));
|
|
1514
|
+
}
|
|
1515
|
+
catch {
|
|
1516
|
+
}
|
|
1517
|
+
if (!original) {
|
|
1518
|
+
if (operation === 'start')
|
|
1519
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").markFailedStart();
|
|
1520
|
+
throw __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, scope, new Error('SQLite final validation control requires its original outer origin'));
|
|
1521
|
+
}
|
|
1522
|
+
}, _CoordinatedSqliteQueryRunner_validateNoMutationDispatch = function _CoordinatedSqliteQueryRunner_validateNoMutationDispatch(scope, ticket, sql) {
|
|
1523
|
+
const evidence = scope.noMutation;
|
|
1524
|
+
if (!evidence || scope.phase === 'committed' || scope.phase === 'settled')
|
|
1525
|
+
return;
|
|
1526
|
+
if (!__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, scope))
|
|
1527
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_checkNoMutationPins).call(this, evidence);
|
|
1528
|
+
if (!ticket || !ticket.active || ticket.scope !== scope || ticket.sql !== sql || !evidence.pending.has(ticket))
|
|
1529
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, scope, new Error('SQLite native dispatch lacks its original query ticket'));
|
|
1530
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationRefusal).call(this, scope, sql, ticket.outer);
|
|
1531
|
+
}, _CoordinatedSqliteQueryRunner_blockedQuery = function _CoordinatedSqliteQueryRunner_blockedQuery(ticket) {
|
|
1532
|
+
const evidence = ticket.scope.noMutation;
|
|
1533
|
+
return new Promise((_resolve, reject) => {
|
|
1534
|
+
const finish = () => reject(new SqliteCommitGuardRefusedError(ticket.scope.childFailure ? ticket.scope.childFailure.cause : evidence.terminal?.logical?.cause));
|
|
1535
|
+
if (evidence.terminal && !evidence.terminal.logical)
|
|
1536
|
+
blockedRefusals.get(evidence).push(finish);
|
|
1537
|
+
else
|
|
1538
|
+
finish();
|
|
1539
|
+
});
|
|
1540
|
+
}, _CoordinatedSqliteQueryRunner_beginFullAbort = function _CoordinatedSqliteQueryRunner_beginFullAbort(scope, trigger) {
|
|
1541
|
+
if (!scope ||
|
|
1542
|
+
scope !== this.guardedCommit ||
|
|
1543
|
+
!scope.lease.active ||
|
|
1544
|
+
(!scope.guards.length && !scope.noMutation) ||
|
|
1545
|
+
scope.phase === 'committed')
|
|
1546
|
+
return;
|
|
1547
|
+
const lease = scope.lease;
|
|
1548
|
+
if (lease.closing)
|
|
1549
|
+
return lease.closing;
|
|
1550
|
+
let resolveReason;
|
|
1551
|
+
const ready = new Promise((resolve) => {
|
|
1552
|
+
resolveReason = resolve;
|
|
1553
|
+
});
|
|
1554
|
+
const terminal = scope.noMutation?.terminal;
|
|
1555
|
+
let reason = __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").managedPrimary() ?? scope.childFailure ?? terminal?.logical;
|
|
1556
|
+
if (!reason && !terminal)
|
|
1557
|
+
reason = trigger;
|
|
1558
|
+
if (!reason && !terminal) {
|
|
1559
|
+
const cause = new Error('Queued nested SQLite transaction was refused because its owning transaction is closing');
|
|
1560
|
+
cause.name = 'SqliteNestedTransactionAbortedError';
|
|
1561
|
+
reason = { cause };
|
|
1562
|
+
}
|
|
1563
|
+
const closing = { scope, reason, ready };
|
|
1564
|
+
abortResolvers.set(closing, resolveReason);
|
|
1565
|
+
lease.closing = closing;
|
|
1566
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").refuseQueued(lease);
|
|
1567
|
+
if (reason)
|
|
1568
|
+
resolveReason();
|
|
1569
|
+
return closing;
|
|
1570
|
+
}, _CoordinatedSqliteQueryRunner_captureQueryFailure = function _CoordinatedSqliteQueryRunner_captureQueryFailure(ticket, cause) {
|
|
1571
|
+
const scope = ticket.scope, evidence = scope.noMutation;
|
|
1572
|
+
if (evidence.terminal?.origin === ticket && !evidence.terminal.logical) {
|
|
1573
|
+
evidence.terminal.logical = { cause };
|
|
1574
|
+
const closing = scope.lease.closing;
|
|
1575
|
+
if (closing?.scope === scope && !closing.reason) {
|
|
1576
|
+
closing.reason = { cause };
|
|
1577
|
+
abortResolvers.get(closing)();
|
|
1578
|
+
}
|
|
1579
|
+
scope.childFailure ??= { cause };
|
|
1580
|
+
for (const finish of blockedRefusals.get(evidence).splice(0))
|
|
1581
|
+
finish();
|
|
1582
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_pumpNative).call(this, scope);
|
|
1583
|
+
}
|
|
1584
|
+
else if (!evidence.terminal)
|
|
1585
|
+
this.captureChildFailureRecorder(scope.lease)?.(cause);
|
|
1586
|
+
}, _CoordinatedSqliteQueryRunner_latchNativeFailure = function _CoordinatedSqliteQueryRunner_latchNativeFailure(ticket, cause) {
|
|
1587
|
+
ticket.scope.noMutation.terminal ??= { nativeCause: cause, origin: ticket };
|
|
1588
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_beginFullAbort).call(this, ticket.scope);
|
|
1589
|
+
}, _CoordinatedSqliteQueryRunner_pumpNative = function _CoordinatedSqliteQueryRunner_pumpNative(scope) {
|
|
1590
|
+
const evidence = scope.noMutation;
|
|
1591
|
+
if (evidence.inFlight || (evidence.terminal && !evidence.terminal.logical))
|
|
1592
|
+
return;
|
|
1593
|
+
const envelope = evidence.queue.shift();
|
|
1594
|
+
if (!envelope)
|
|
1595
|
+
return;
|
|
1596
|
+
nativeActions.get(envelope).context(() => __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_dispatchQueued).call(this, scope, envelope));
|
|
1597
|
+
}, _CoordinatedSqliteQueryRunner_dispatchQueued = function _CoordinatedSqliteQueryRunner_dispatchQueued(scope, envelope) {
|
|
1598
|
+
const evidence = scope.noMutation;
|
|
1599
|
+
const ticket = envelope.ticket;
|
|
1600
|
+
const actions = nativeActions.get(envelope);
|
|
1601
|
+
let physical = false;
|
|
1602
|
+
try {
|
|
1603
|
+
physical = evidence.physical();
|
|
1604
|
+
}
|
|
1605
|
+
catch (cause) {
|
|
1606
|
+
evidence.anomaly ??= { cause };
|
|
1607
|
+
}
|
|
1608
|
+
if ((!ticket.cleanup && evidence.terminal) ||
|
|
1609
|
+
!ticket.active ||
|
|
1610
|
+
!evidence.pending.has(ticket) ||
|
|
1611
|
+
ticket.scope !== this.guardedCommit ||
|
|
1612
|
+
!scope.lease.active ||
|
|
1613
|
+
!envelope.context.active ||
|
|
1614
|
+
envelope.context.lease !== scope.lease ||
|
|
1615
|
+
!physical) {
|
|
1616
|
+
actions.refuse(new SqliteCommitGuardRefusedError(scope.childFailure?.cause));
|
|
1617
|
+
queueMicrotask(() => __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_pumpNative).call(this, scope));
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
const mismatch = ticket.sql !== envelope.query ||
|
|
1621
|
+
ticket.nativeMethod !== envelope.property ||
|
|
1622
|
+
!ticket.connected ||
|
|
1623
|
+
!ticket.dispatched ||
|
|
1624
|
+
envelope.query === 'COMMIT' ||
|
|
1625
|
+
(isSqliteTransactionControl(envelope.query) && !ticket.control);
|
|
1626
|
+
const refusal = mismatch
|
|
1627
|
+
? __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, scope, scope.childFailure
|
|
1628
|
+
? scope.childFailure.cause
|
|
1629
|
+
: evidence.anomaly
|
|
1630
|
+
? evidence.anomaly.cause
|
|
1631
|
+
: new Error('SQLite queued native SQL lacks its exact original ticket'))
|
|
1632
|
+
: __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, scope)
|
|
1633
|
+
? __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_validateNoMutationDispatch).call(this, scope, ticket, envelope.query)
|
|
1634
|
+
: undefined;
|
|
1635
|
+
if (refusal || (__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, scope) && !evidence.physical())) {
|
|
1636
|
+
actions.refuse(refusal ?? __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, scope, new Error('SQLite final physical identity expired')));
|
|
1637
|
+
queueMicrotask(() => __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_pumpNative).call(this, scope));
|
|
1638
|
+
return;
|
|
1639
|
+
}
|
|
1640
|
+
evidence.inFlight = envelope;
|
|
1641
|
+
actions.submit();
|
|
1642
|
+
}, _CoordinatedSqliteQueryRunner_submitNative = function _CoordinatedSqliteQueryRunner_submitNative(scope, ticket, property, query, parameters, callback, callbackContext, context) {
|
|
1643
|
+
const evidence = scope.noMutation, native = evidence.native;
|
|
1644
|
+
const original = evidence[property];
|
|
1645
|
+
let finished = false;
|
|
1646
|
+
const deliver = (receiver, args, nativeCompletion = true) => {
|
|
1647
|
+
if (finished)
|
|
1648
|
+
return;
|
|
1649
|
+
finished = true;
|
|
1650
|
+
const error = args[0];
|
|
1651
|
+
if (error?.toString().includes('SQLITE_BUSY:'))
|
|
1652
|
+
ticket.retry = true;
|
|
1653
|
+
else if (error && nativeCompletion && !ticket.cleanup)
|
|
1654
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_latchNativeFailure).call(this, ticket, error);
|
|
1655
|
+
try {
|
|
1656
|
+
callbackContext(() => Reflect.apply(callback, receiver, args));
|
|
1657
|
+
}
|
|
1658
|
+
finally {
|
|
1659
|
+
if (evidence.inFlight === envelope)
|
|
1660
|
+
evidence.inFlight = undefined;
|
|
1661
|
+
queueMicrotask(() => __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_pumpNative).call(this, scope));
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
const envelope = Object.freeze({ ticket, context, query, property });
|
|
1665
|
+
nativeActions.set(envelope, {
|
|
1666
|
+
context: callbackContext,
|
|
1667
|
+
refuse: (cause) => deliver(native, [cause], false),
|
|
1668
|
+
submit: () => {
|
|
1669
|
+
try {
|
|
1670
|
+
original.call(native, query, parameters, function (...args) {
|
|
1671
|
+
deliver(this, args);
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
catch (cause) {
|
|
1675
|
+
if (finished)
|
|
1676
|
+
throw cause;
|
|
1677
|
+
finished = true;
|
|
1678
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_latchNativeFailure).call(this, ticket, cause);
|
|
1679
|
+
if (evidence.inFlight === envelope)
|
|
1680
|
+
evidence.inFlight = undefined;
|
|
1681
|
+
queryDispatchFailures.get(ticket)(cause);
|
|
1682
|
+
}
|
|
1683
|
+
},
|
|
1684
|
+
});
|
|
1685
|
+
evidence.queue.push(envelope);
|
|
1686
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_pumpNative).call(this, scope);
|
|
1687
|
+
return native;
|
|
1688
|
+
}, _CoordinatedSqliteQueryRunner_noMutationTransactionControl = async function _CoordinatedSqliteQueryRunner_noMutationTransactionControl(operation, isolation, lifecycle) {
|
|
1689
|
+
const originalOuter = operation !== 'start' && this.transactionDepth === 1;
|
|
1690
|
+
if (operation === 'start') {
|
|
1691
|
+
if (this.driver.transactionSupport === 'none')
|
|
1692
|
+
throw new typeorm_1.TypeORMError(`Transactions aren't supported by ${this.connection.driver.options.type}.`);
|
|
1693
|
+
if (this.isTransactionActive && this.driver.transactionSupport === 'simple')
|
|
1694
|
+
throw new typeorm_1.TransactionAlreadyStartedError();
|
|
1695
|
+
if (isolation && isolation !== 'READ UNCOMMITTED' && isolation !== 'SERIALIZABLE')
|
|
1696
|
+
throw new typeorm_1.TypeORMError('SQLite only supports SERIALIZABLE and READ UNCOMMITTED isolation');
|
|
1697
|
+
this.isTransactionActive = true;
|
|
1698
|
+
try {
|
|
1699
|
+
await this.broadcaster.broadcast('BeforeTransactionStart');
|
|
1700
|
+
}
|
|
1701
|
+
catch (error) {
|
|
1702
|
+
this.isTransactionActive = false;
|
|
1703
|
+
throw error;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
else {
|
|
1707
|
+
if (!this.isTransactionActive)
|
|
1708
|
+
throw new typeorm_1.TransactionNotStartedError();
|
|
1709
|
+
await this.broadcaster.broadcast(operation === 'commit' ? 'BeforeTransactionCommit' : 'BeforeTransactionRollback');
|
|
1710
|
+
}
|
|
1711
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_assertFinalControlOrigin).call(this, operation, lifecycle);
|
|
1712
|
+
const terminalRollback = operation === 'rollback' &&
|
|
1713
|
+
(this.guardedCommit.noMutation?.terminal !== undefined || __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, this.guardedCommit));
|
|
1714
|
+
const abortNested = terminalRollback && this.transactionDepth > 1;
|
|
1715
|
+
const outer = operation !== 'start' && (originalOuter || terminalRollback);
|
|
1716
|
+
const sql = operation === 'start'
|
|
1717
|
+
? `SAVEPOINT typeorm_${this.transactionDepth}`
|
|
1718
|
+
: outer
|
|
1719
|
+
? operation === 'commit'
|
|
1720
|
+
? 'COMMIT'
|
|
1721
|
+
: 'ROLLBACK'
|
|
1722
|
+
: `${operation === 'commit' ? 'RELEASE' : 'ROLLBACK TO'} SAVEPOINT typeorm_${this.transactionDepth - 1}`;
|
|
1723
|
+
if (outer && this.lease.closing) {
|
|
1724
|
+
if (operation === 'rollback')
|
|
1725
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").drainOwned(this.lease);
|
|
1726
|
+
this.terminalControlPermit = {
|
|
1727
|
+
scope: this.lease.closing.scope,
|
|
1728
|
+
context: __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").captureCommitContext(this.lease),
|
|
1729
|
+
sql,
|
|
1730
|
+
};
|
|
1731
|
+
}
|
|
1732
|
+
this.noMutationControl = { scope: this.guardedCommit, sql, outer };
|
|
1733
|
+
try {
|
|
1734
|
+
await this.query(sql);
|
|
1735
|
+
}
|
|
1736
|
+
finally {
|
|
1737
|
+
this.noMutationControl = undefined;
|
|
1738
|
+
this.terminalControlPermit = undefined;
|
|
1739
|
+
}
|
|
1740
|
+
if (outer)
|
|
1741
|
+
this.isTransactionActive = false;
|
|
1742
|
+
this.transactionDepth = terminalRollback ? 0 : this.transactionDepth + (operation === 'start' ? 1 : -1);
|
|
1743
|
+
try {
|
|
1744
|
+
await this.broadcaster.broadcast(operation === 'start'
|
|
1745
|
+
? 'AfterTransactionStart'
|
|
1746
|
+
: operation === 'commit'
|
|
1747
|
+
? 'AfterTransactionCommit'
|
|
1748
|
+
: 'AfterTransactionRollback');
|
|
1749
|
+
}
|
|
1750
|
+
finally {
|
|
1751
|
+
if (abortNested && this.lease?.active)
|
|
1752
|
+
this.lease.aborted = new Error('Nested SQLite terminal failure aborted the owning transaction scope');
|
|
1753
|
+
}
|
|
1754
|
+
}, _CoordinatedSqliteQueryRunner_startManagedTransaction = async function _CoordinatedSqliteQueryRunner_startManagedTransaction(isolationLevel, lifecycle) {
|
|
1755
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_assertFinalControlOrigin).call(this, 'start', lifecycle);
|
|
1756
|
+
if (this.lease?.active && this.lease.closing) {
|
|
1757
|
+
await this.lease.closing.ready;
|
|
1758
|
+
throw this.lease.closing.reason.cause;
|
|
1759
|
+
}
|
|
1760
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").assertAvailable();
|
|
1761
|
+
if (this.writeAdmission) {
|
|
1762
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").markFailedStart();
|
|
1763
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").track(() => Promise.reject(new Error('SQLite write admission forbids reentrant transaction start before BEGIN acknowledgement')));
|
|
1764
|
+
}
|
|
1765
|
+
if (!this.lease?.active)
|
|
1766
|
+
this.lease = await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").acquire(this);
|
|
1767
|
+
const previousDepth = this.transactionDepth;
|
|
1768
|
+
const writeIntent = this.writeIntentRequested && previousDepth === 0;
|
|
1769
|
+
this.writeIntentRequested = false;
|
|
1770
|
+
const outerScope = previousDepth === 0 ? { lease: this.lease, guards: [], phase: 'starting', outcome: 'pending' } : undefined;
|
|
1771
|
+
if (outerScope) {
|
|
1772
|
+
this.guardedCommit = outerScope;
|
|
1773
|
+
if (lifecycle) {
|
|
1774
|
+
lifecycle.scope = outerScope;
|
|
1775
|
+
outerScope.managedOwner = lifecycle.context;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
try {
|
|
1779
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_withTransactionControl).call(this, () => writeIntent
|
|
1780
|
+
? __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_startWithWriteIntent).call(this)
|
|
1781
|
+
: this.guardedCommit?.noMutation && previousDepth > 0
|
|
1782
|
+
? __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_noMutationTransactionControl).call(this, 'start', isolationLevel, lifecycle)
|
|
1783
|
+
: __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_startOriginalTransaction).call(this, isolationLevel));
|
|
1784
|
+
if (outerScope)
|
|
1785
|
+
outerScope.phase = 'open';
|
|
1786
|
+
}
|
|
1787
|
+
catch (error) {
|
|
1788
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").recordManagedFailure(error);
|
|
1789
|
+
if (previousDepth === 0) {
|
|
1790
|
+
if (outerScope)
|
|
1791
|
+
outerScope.phase = 'rolling_back';
|
|
1792
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_recoverTransaction).call(this);
|
|
1793
|
+
}
|
|
1794
|
+
else {
|
|
1795
|
+
this.isTransactionActive = true;
|
|
1796
|
+
if (this.transactionDepth > previousDepth)
|
|
1797
|
+
await this.rollbackTransaction();
|
|
1798
|
+
this.transactionDepth = previousDepth;
|
|
1799
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").markFailedStart();
|
|
1800
|
+
}
|
|
1801
|
+
throw error;
|
|
1802
|
+
}
|
|
1803
|
+
finally {
|
|
1804
|
+
if (writeIntent)
|
|
1805
|
+
this.writeAdmission = undefined;
|
|
1806
|
+
if (outerScope)
|
|
1807
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_settleCommitScope).call(this);
|
|
1808
|
+
this.releaseIfSettled();
|
|
1809
|
+
}
|
|
1810
|
+
}, _CoordinatedSqliteQueryRunner_startOriginalTransaction = async function _CoordinatedSqliteQueryRunner_startOriginalTransaction(isolation) {
|
|
1811
|
+
if (this.transactionDepth !== 0)
|
|
1812
|
+
return Reflect.apply(Reflect.get(SqliteQueryRunner_1.SqliteQueryRunner.prototype, 'startTransaction'), this, [isolation]);
|
|
1813
|
+
if (this.driver.transactionSupport === 'none')
|
|
1814
|
+
throw new typeorm_1.TypeORMError(`Transactions aren't supported by ${this.connection.driver.options.type}.`);
|
|
1815
|
+
if (this.isTransactionActive && this.driver.transactionSupport === 'simple')
|
|
1816
|
+
throw new typeorm_1.TransactionAlreadyStartedError();
|
|
1817
|
+
if (isolation && isolation !== 'READ UNCOMMITTED' && isolation !== 'SERIALIZABLE')
|
|
1818
|
+
throw new typeorm_1.TypeORMError('SQLite only supports SERIALIZABLE and READ UNCOMMITTED isolation');
|
|
1819
|
+
this.isTransactionActive = true;
|
|
1820
|
+
try {
|
|
1821
|
+
await this.broadcaster.broadcast('BeforeTransactionStart');
|
|
1822
|
+
}
|
|
1823
|
+
catch (cause) {
|
|
1824
|
+
this.isTransactionActive = false;
|
|
1825
|
+
throw cause;
|
|
1826
|
+
}
|
|
1827
|
+
if (isolation) {
|
|
1828
|
+
this.startupPermit = `PRAGMA read_uncommitted = ${isolation === 'READ UNCOMMITTED' ? 'true' : 'false'}`;
|
|
1829
|
+
await this.query(this.startupPermit);
|
|
1830
|
+
}
|
|
1831
|
+
this.startupPermit = 'BEGIN TRANSACTION';
|
|
1832
|
+
await this.query(this.startupPermit);
|
|
1833
|
+
this.transactionDepth += 1;
|
|
1834
|
+
await this.broadcaster.broadcast('AfterTransactionStart');
|
|
1835
|
+
}, _CoordinatedSqliteQueryRunner_startWithWriteIntent = async function _CoordinatedSqliteQueryRunner_startWithWriteIntent() {
|
|
1836
|
+
this.writeAdmission = 'pending';
|
|
1837
|
+
this.isTransactionActive = true;
|
|
1838
|
+
try {
|
|
1839
|
+
await this.broadcaster.broadcast('BeforeTransactionStart');
|
|
1840
|
+
this.writeAdmission = 'armed';
|
|
1841
|
+
this.startupPermit = 'BEGIN IMMEDIATE TRANSACTION';
|
|
1842
|
+
await this.query('BEGIN IMMEDIATE TRANSACTION');
|
|
1843
|
+
}
|
|
1844
|
+
finally {
|
|
1845
|
+
this.writeAdmission = undefined;
|
|
1846
|
+
}
|
|
1847
|
+
this.transactionDepth += 1;
|
|
1848
|
+
await this.broadcaster.broadcast('AfterTransactionStart');
|
|
1849
|
+
}, _CoordinatedSqliteQueryRunner_commitManagedTransaction = async function _CoordinatedSqliteQueryRunner_commitManagedTransaction(lifecycle) {
|
|
1850
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_assertFinalControlOrigin).call(this, 'commit', lifecycle);
|
|
1851
|
+
try {
|
|
1852
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").drainCurrent();
|
|
1853
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_assertFinalControlOrigin).call(this, 'commit', lifecycle);
|
|
1854
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_withTransactionControl).call(this, () => this.guardedCommit?.noMutation || (this.lease?.active && this.lease.closing)
|
|
1855
|
+
? __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_noMutationTransactionControl).call(this, 'commit', undefined, lifecycle)
|
|
1856
|
+
: Reflect.apply(Reflect.get(SqliteQueryRunner_1.SqliteQueryRunner.prototype, 'commitTransaction'), this, []));
|
|
1857
|
+
}
|
|
1858
|
+
catch (cause) {
|
|
1859
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").recordManagedFailure(cause);
|
|
1860
|
+
throw cause;
|
|
1861
|
+
}
|
|
1862
|
+
finally {
|
|
1863
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_settleCommitScope).call(this);
|
|
1864
|
+
this.releaseIfSettled();
|
|
1865
|
+
}
|
|
1866
|
+
}, _CoordinatedSqliteQueryRunner_rollbackManagedTransaction = async function _CoordinatedSqliteQueryRunner_rollbackManagedTransaction(lifecycle) {
|
|
1867
|
+
if (lifecycle && __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").consumeFailedStart())
|
|
1868
|
+
return;
|
|
1869
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_assertFinalControlOrigin).call(this, 'rollback', lifecycle);
|
|
1870
|
+
const scope = this.guardedCommit;
|
|
1871
|
+
if (lifecycle?.scope === scope &&
|
|
1872
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, scope) &&
|
|
1873
|
+
!this.isTransactionActive &&
|
|
1874
|
+
this.transactionDepth > 0) {
|
|
1875
|
+
let physical = false;
|
|
1876
|
+
try {
|
|
1877
|
+
physical = scope.noMutation.physical();
|
|
1878
|
+
}
|
|
1879
|
+
catch {
|
|
1880
|
+
}
|
|
1881
|
+
if (!physical) {
|
|
1882
|
+
scope.outcome = 'unknown';
|
|
1883
|
+
const cause = new Error('SQLite original managed rollback physical identity expired');
|
|
1884
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").poison(cause);
|
|
1885
|
+
throw cause;
|
|
1886
|
+
}
|
|
1887
|
+
this.isTransactionActive = true;
|
|
1888
|
+
}
|
|
1889
|
+
const full = this.transactionDepth === 1 || scope?.noMutation?.terminal !== undefined || __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_finalValidationActive).call(this, scope);
|
|
1890
|
+
if (full)
|
|
1891
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_beginFullAbort).call(this, scope);
|
|
1892
|
+
if (scope && full)
|
|
1893
|
+
scope.phase = 'rolling_back';
|
|
1894
|
+
try {
|
|
1895
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").drainCurrent(false);
|
|
1896
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_withTransactionControl).call(this, async () => {
|
|
1897
|
+
if (this.lease?.active && this.lease.closing)
|
|
1898
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").drainOwned(this.lease);
|
|
1899
|
+
await (scope?.noMutation || (this.lease?.active && this.lease.closing)
|
|
1900
|
+
? __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_noMutationTransactionControl).call(this, 'rollback', undefined, lifecycle)
|
|
1901
|
+
: Reflect.apply(Reflect.get(SqliteQueryRunner_1.SqliteQueryRunner.prototype, 'rollbackTransaction'), this, []));
|
|
1902
|
+
if (this.lease?.active && this.lease.closing)
|
|
1903
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").drainOwned(this.lease);
|
|
1904
|
+
});
|
|
1905
|
+
}
|
|
1906
|
+
catch (error) {
|
|
1907
|
+
if (this.lease?.active && this.isTransactionActive)
|
|
1908
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_recoverTransaction).call(this, { cause: error });
|
|
1909
|
+
throw error;
|
|
1910
|
+
}
|
|
1911
|
+
finally {
|
|
1912
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_settleCommitScope).call(this);
|
|
1913
|
+
this.releaseIfSettled();
|
|
1914
|
+
}
|
|
1915
|
+
}, _CoordinatedSqliteQueryRunner_dispatchGuardedCommit = function _CoordinatedSqliteQueryRunner_dispatchGuardedCommit(scope, context, connection, query, parameters, callback) {
|
|
1916
|
+
const ticket = this.noMutationQuery.getStore();
|
|
1917
|
+
const latchFailure = (cause) => __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_latchNativeFailure).call(this, ticket, cause);
|
|
1918
|
+
const callbackContext = node_async_hooks_1.AsyncLocalStorage.snapshot();
|
|
1919
|
+
let delivered = false;
|
|
1920
|
+
const deliver = function (error, rows) {
|
|
1921
|
+
if (delivered)
|
|
1922
|
+
return;
|
|
1923
|
+
delivered = true;
|
|
1924
|
+
if (ticket) {
|
|
1925
|
+
if (error?.toString().includes('SQLITE_BUSY:'))
|
|
1926
|
+
ticket.retry = true;
|
|
1927
|
+
else if (error && scope.outcome === 'unknown')
|
|
1928
|
+
latchFailure(error);
|
|
1929
|
+
}
|
|
1930
|
+
callbackContext(() => {
|
|
1931
|
+
callback.call(this, error, rows);
|
|
1932
|
+
});
|
|
1933
|
+
};
|
|
1934
|
+
void __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f")
|
|
1935
|
+
.drainCommitChildren(context, () => {
|
|
1936
|
+
let submitted = false;
|
|
1937
|
+
try {
|
|
1938
|
+
if (scope !== this.guardedCommit ||
|
|
1939
|
+
!scope.lease.active ||
|
|
1940
|
+
this.transactionDepth !== 1 ||
|
|
1941
|
+
(scope.phase !== 'open' && scope.phase !== 'sealed')) {
|
|
1942
|
+
throw new Error('SQLite outer COMMIT scope expired');
|
|
1943
|
+
}
|
|
1944
|
+
if (scope.lease.closing)
|
|
1945
|
+
throw new SqliteCommitGuardRefusedError(scope.childFailure ? scope.childFailure.cause : scope.lease.closing.reason?.cause);
|
|
1946
|
+
if (scope.noMutation?.inFlight || scope.noMutation?.queue.length || scope.noMutation?.terminal)
|
|
1947
|
+
throw new SqliteCommitGuardRefusedError(scope.childFailure?.cause);
|
|
1948
|
+
scope.phase = 'sealed';
|
|
1949
|
+
if (scope.childFailure)
|
|
1950
|
+
throw new SqliteCommitGuardRefusedError(scope.childFailure.cause);
|
|
1951
|
+
for (const guard of scope.guards) {
|
|
1952
|
+
if (guard() !== true)
|
|
1953
|
+
throw new SqliteCommitGuardRefusedError();
|
|
1954
|
+
}
|
|
1955
|
+
if (scope.childFailure)
|
|
1956
|
+
throw new SqliteCommitGuardRefusedError(scope.childFailure.cause);
|
|
1957
|
+
const witness = scope.noMutation;
|
|
1958
|
+
if (witness &&
|
|
1959
|
+
(query !== 'COMMIT' ||
|
|
1960
|
+
ticket?.scope !== scope ||
|
|
1961
|
+
ticket.sql !== query ||
|
|
1962
|
+
!ticket.control ||
|
|
1963
|
+
!ticket.outer ||
|
|
1964
|
+
!ticket.connected ||
|
|
1965
|
+
!ticket.dispatched ||
|
|
1966
|
+
ticket.nativeMethod !== 'all' ||
|
|
1967
|
+
!witness.pending.has(ticket) ||
|
|
1968
|
+
witness.native !== connection ||
|
|
1969
|
+
context.lease !== scope.lease ||
|
|
1970
|
+
!context.active))
|
|
1971
|
+
throw __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_nativeDispatchRefusal).call(this, scope, scope.childFailure
|
|
1972
|
+
? scope.childFailure.cause
|
|
1973
|
+
: witness.anomaly
|
|
1974
|
+
? witness.anomaly.cause
|
|
1975
|
+
: new Error('SQLite COMMIT lacks its original terminal ticket'));
|
|
1976
|
+
if (witness?.finalValidation) {
|
|
1977
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_checkNoMutationPins).call(this, witness);
|
|
1978
|
+
if (witness.decision !== 'applied' ||
|
|
1979
|
+
witness.anomaly ||
|
|
1980
|
+
scope.childFailure ||
|
|
1981
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").managedPrimary() ||
|
|
1982
|
+
witness.inFlight ||
|
|
1983
|
+
witness.queue.length ||
|
|
1984
|
+
witness.terminal ||
|
|
1985
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").hasOutstanding(context) ||
|
|
1986
|
+
[...witness.pending].some((pending) => pending !== ticket))
|
|
1987
|
+
throw new SqliteCommitGuardRefusedError(scope.childFailure ? scope.childFailure.cause : witness.anomaly?.cause);
|
|
1988
|
+
}
|
|
1989
|
+
if (witness && witness.decision !== 'applied') {
|
|
1990
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_checkNoMutationPins).call(this, witness);
|
|
1991
|
+
if (witness.decision !== 'unchanged' ||
|
|
1992
|
+
witness.anomaly ||
|
|
1993
|
+
witness.mutations !== 0n ||
|
|
1994
|
+
[...witness.pending].some((ticket) => !ticket.control))
|
|
1995
|
+
throw new SqliteCommitGuardRefusedError(witness.anomaly?.cause);
|
|
1996
|
+
}
|
|
1997
|
+
scope.phase = 'submitted';
|
|
1998
|
+
scope.outcome = 'unknown';
|
|
1999
|
+
submitted = true;
|
|
2000
|
+
(scope.noMutation?.all ?? connection.all).call(connection, query, parameters, function (error, rows) {
|
|
2001
|
+
if (!error) {
|
|
2002
|
+
scope.phase = 'committed';
|
|
2003
|
+
scope.outcome = 'committed';
|
|
2004
|
+
}
|
|
2005
|
+
else if (error.toString().includes('SQLITE_BUSY:')) {
|
|
2006
|
+
scope.phase = 'sealed';
|
|
2007
|
+
}
|
|
2008
|
+
else {
|
|
2009
|
+
scope.outcome = 'unknown';
|
|
2010
|
+
}
|
|
2011
|
+
deliver.call(this, error, rows);
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
catch (error) {
|
|
2015
|
+
if (delivered)
|
|
2016
|
+
return;
|
|
2017
|
+
if (submitted) {
|
|
2018
|
+
scope.outcome = 'unknown';
|
|
2019
|
+
if (ticket) {
|
|
2020
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_latchNativeFailure).call(this, ticket, error);
|
|
2021
|
+
queryDispatchFailures.get(ticket)(error);
|
|
2022
|
+
return;
|
|
2023
|
+
}
|
|
2024
|
+
deliver.call(connection, error instanceof Error ? error : new Error('Native COMMIT dispatch threw', { cause: error }));
|
|
2025
|
+
}
|
|
2026
|
+
else {
|
|
2027
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_refuseCommit).call(this, scope, connection, deliver, error);
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
})
|
|
2031
|
+
.catch((error) => __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_refuseCommit).call(this, scope, connection, deliver, scope.childFailure ? scope.childFailure.cause : error));
|
|
2032
|
+
}, _CoordinatedSqliteQueryRunner_refuseCommit = function _CoordinatedSqliteQueryRunner_refuseCommit(scope, connection, callback, cause) {
|
|
2033
|
+
scope.phase = 'sealed';
|
|
2034
|
+
scope.outcome = 'refused';
|
|
2035
|
+
callback.call(connection, cause instanceof SqliteCommitGuardRefusedError ? cause : new SqliteCommitGuardRefusedError(cause));
|
|
2036
|
+
}, _CoordinatedSqliteQueryRunner_settleCommitScope = function _CoordinatedSqliteQueryRunner_settleCommitScope() {
|
|
2037
|
+
const scope = this.guardedCommit;
|
|
2038
|
+
if (!scope ||
|
|
2039
|
+
(scope.lease.closing && __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").hasContexts(scope.lease)) ||
|
|
2040
|
+
this.isTransactionActive ||
|
|
2041
|
+
this.transactionDepth !== 0 ||
|
|
2042
|
+
scope.noMutation?.inFlight ||
|
|
2043
|
+
scope.noMutation?.queue.length ||
|
|
2044
|
+
scope.noMutation?.pending.size)
|
|
2045
|
+
return;
|
|
2046
|
+
if (scope.outcome === 'pending')
|
|
2047
|
+
scope.outcome = 'rolled_back';
|
|
2048
|
+
scope.phase = 'settled';
|
|
2049
|
+
scope.childFailure = undefined;
|
|
2050
|
+
this.guardedCommit = undefined;
|
|
2051
|
+
}, _CoordinatedSqliteQueryRunner_withTransactionControl = function _CoordinatedSqliteQueryRunner_withTransactionControl(operation) {
|
|
2052
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").run(this.lease, async () => {
|
|
2053
|
+
this.transactionControlDepth++;
|
|
2054
|
+
try {
|
|
2055
|
+
await operation();
|
|
2056
|
+
}
|
|
2057
|
+
finally {
|
|
2058
|
+
this.transactionControlDepth--;
|
|
2059
|
+
}
|
|
2060
|
+
});
|
|
2061
|
+
}, _CoordinatedSqliteQueryRunner_recoverTransaction = async function _CoordinatedSqliteQueryRunner_recoverTransaction(trigger) {
|
|
2062
|
+
const closing = __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_beginFullAbort).call(this, this.guardedCommit, trigger);
|
|
2063
|
+
if (closing)
|
|
2064
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_withTransactionControl).call(this, () => __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_recoverOwnedTransaction).call(this, closing));
|
|
2065
|
+
return __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_instances, "m", _CoordinatedSqliteQueryRunner_recoverOwnedTransaction).call(this);
|
|
2066
|
+
}, _CoordinatedSqliteQueryRunner_recoverOwnedTransaction = async function _CoordinatedSqliteQueryRunner_recoverOwnedTransaction(closing) {
|
|
2067
|
+
const hadTransaction = this.transactionDepth > 0;
|
|
2068
|
+
const abortedNestedTransaction = this.transactionDepth > 1;
|
|
2069
|
+
try {
|
|
2070
|
+
if (closing)
|
|
2071
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").drainOwned(closing.scope.lease);
|
|
2072
|
+
await new Promise((resolve, reject) => {
|
|
2073
|
+
const connection = this.driver.databaseConnection;
|
|
2074
|
+
connection.run('ROLLBACK', (error) => {
|
|
2075
|
+
if (!error || /no transaction is active/i.test(error.message))
|
|
2076
|
+
resolve();
|
|
2077
|
+
else
|
|
2078
|
+
reject(error);
|
|
2079
|
+
});
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2082
|
+
catch (error) {
|
|
2083
|
+
if (this.guardedCommit?.outcome === 'pending')
|
|
2084
|
+
this.guardedCommit.outcome = 'unknown';
|
|
2085
|
+
__classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").poison(error);
|
|
2086
|
+
}
|
|
2087
|
+
finally {
|
|
2088
|
+
this.isTransactionActive = false;
|
|
2089
|
+
this.transactionDepth = 0;
|
|
2090
|
+
}
|
|
2091
|
+
if (hadTransaction) {
|
|
2092
|
+
try {
|
|
2093
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").run(this.lease, () => this.broadcaster.broadcast('AfterTransactionRollback'));
|
|
2094
|
+
}
|
|
2095
|
+
catch {
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
if (closing)
|
|
2099
|
+
await __classPrivateFieldGet(this, _CoordinatedSqliteQueryRunner_coordinator, "f").drainOwned(closing.scope.lease);
|
|
2100
|
+
if (abortedNestedTransaction && this.lease?.active) {
|
|
2101
|
+
this.lease.aborted = new Error('Nested SQLite transaction recovery aborted the owning transaction scope');
|
|
2102
|
+
}
|
|
2103
|
+
};
|
|
2104
|
+
function registerSqliteCommitGuard(manager, guard) {
|
|
2105
|
+
if (!(manager.queryRunner instanceof CoordinatedSqliteQueryRunner)) {
|
|
2106
|
+
throw new Error('SQLite COMMIT guards require a coordinated scoped manager');
|
|
2107
|
+
}
|
|
2108
|
+
return manager.queryRunner.registerCommitGuard(manager, guard);
|
|
2109
|
+
}
|
|
2110
|
+
function captureSqliteNoMutationWindow(manager, ownerCurrent) {
|
|
2111
|
+
if (!(manager.queryRunner instanceof CoordinatedSqliteQueryRunner))
|
|
2112
|
+
throw new Error('SQLite no-mutation window requires its coordinated scoped manager');
|
|
2113
|
+
return manager.queryRunner.captureNoMutationWindow(manager, ownerCurrent);
|
|
2114
|
+
}
|
|
2115
|
+
function observeSqliteOuterOutcome(manager) {
|
|
2116
|
+
if (!(manager.queryRunner instanceof CoordinatedSqliteQueryRunner)) {
|
|
2117
|
+
throw new Error('Native outcome observation requires a coordinated scoped manager');
|
|
2118
|
+
}
|
|
2119
|
+
return manager.queryRunner.observeOuterOutcome(manager);
|
|
2120
|
+
}
|
|
2121
|
+
function hasCurrentSqliteConnectionLease(dataSource) {
|
|
2122
|
+
return coordinators.get(dataSource)?.currentRunner !== undefined;
|
|
2123
|
+
}
|
|
2124
|
+
function isSqliteTransactionActive(dataSource) {
|
|
2125
|
+
return coordinators.get(dataSource)?.isTransactionActive ?? dataSource.createQueryRunner().isTransactionActive;
|
|
2126
|
+
}
|
|
2127
|
+
function outsideSqliteTransaction(dataSource, operation) {
|
|
2128
|
+
const coordinator = coordinators.get(dataSource);
|
|
2129
|
+
return coordinator ? coordinator.detach(operation) : operation();
|
|
2130
|
+
}
|
|
2131
|
+
//# sourceMappingURL=sqlite-data-source.js.map
|