@fastybird/smart-panel-backend 1.1.0-alpha.64 → 1.1.0-alpha.65

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.
Files changed (1108) hide show
  1. package/dist/app.module.d.ts +3 -1
  2. package/dist/app.module.js +5 -1
  3. package/dist/app.module.js.map +1 -1
  4. package/dist/cli.js +1 -0
  5. package/dist/cli.js.map +1 -1
  6. package/dist/common/database/sqlite-data-source.d.ts +37 -0
  7. package/dist/common/database/sqlite-data-source.js +2131 -0
  8. package/dist/common/database/sqlite-data-source.js.map +1 -0
  9. package/dist/dataSource.d.ts +3 -1
  10. package/dist/dataSource.js +3 -3
  11. package/dist/dataSource.js.map +1 -1
  12. package/dist/main.js +1 -0
  13. package/dist/main.js.map +1 -1
  14. package/dist/migrations/1000000000002-AddTokenLastUsedAt.js +1 -0
  15. package/dist/migrations/1000000000002-AddTokenLastUsedAt.js.map +1 -1
  16. package/dist/migrations/1000000000027-AddVirtualProducerBindings.d.ts +7 -0
  17. package/dist/migrations/1000000000027-AddVirtualProducerBindings.js +87 -0
  18. package/dist/migrations/1000000000027-AddVirtualProducerBindings.js.map +1 -0
  19. package/dist/migrations/1000000000028-AddShellySampleSources.d.ts +6 -0
  20. package/dist/migrations/1000000000028-AddShellySampleSources.js +29 -0
  21. package/dist/migrations/1000000000028-AddShellySampleSources.js.map +1 -0
  22. package/dist/migrations/1000000000029-AddVirtualNumericTransforms.d.ts +6 -0
  23. package/dist/migrations/1000000000029-AddVirtualNumericTransforms.js +31 -0
  24. package/dist/migrations/1000000000029-AddVirtualNumericTransforms.js.map +1 -0
  25. package/dist/migrations/1000000000030-AddZigbeeSampleSources.d.ts +6 -0
  26. package/dist/migrations/1000000000030-AddZigbeeSampleSources.js +33 -0
  27. package/dist/migrations/1000000000030-AddZigbeeSampleSources.js.map +1 -0
  28. package/dist/migrations/1000000000031-AddVirtualThermostatClaims.d.ts +6 -0
  29. package/dist/migrations/1000000000031-AddVirtualThermostatClaims.js +62 -0
  30. package/dist/migrations/1000000000031-AddVirtualThermostatClaims.js.map +1 -0
  31. package/dist/migrations/1000000000032-AddVirtualThermostatRuntime.d.ts +6 -0
  32. package/dist/migrations/1000000000032-AddVirtualThermostatRuntime.js +39 -0
  33. package/dist/migrations/1000000000032-AddVirtualThermostatRuntime.js.map +1 -0
  34. package/dist/migrations/1000000000033-AddThermostatInstallationProfiles.d.ts +6 -0
  35. package/dist/migrations/1000000000033-AddThermostatInstallationProfiles.js +28 -0
  36. package/dist/migrations/1000000000033-AddThermostatInstallationProfiles.js.map +1 -0
  37. package/dist/migrations/1000000000034-AddVirtualThermostatRecoveries.d.ts +6 -0
  38. package/dist/migrations/1000000000034-AddVirtualThermostatRecoveries.js +26 -0
  39. package/dist/migrations/1000000000034-AddVirtualThermostatRecoveries.js.map +1 -0
  40. package/dist/migrations/1000000000035-IndexVirtualThermostatCommands.d.ts +6 -0
  41. package/dist/migrations/1000000000035-IndexVirtualThermostatCommands.js +35 -0
  42. package/dist/migrations/1000000000035-IndexVirtualThermostatCommands.js.map +1 -0
  43. package/dist/migrations/1000000000036-AddVirtualAggregatePolicies.d.ts +6 -0
  44. package/dist/migrations/1000000000036-AddVirtualAggregatePolicies.js +18 -0
  45. package/dist/migrations/1000000000036-AddVirtualAggregatePolicies.js.map +1 -0
  46. package/dist/migrations/1000000000037-AddVirtualAggregateProfiles.d.ts +6 -0
  47. package/dist/migrations/1000000000037-AddVirtualAggregateProfiles.js +16 -0
  48. package/dist/migrations/1000000000037-AddVirtualAggregateProfiles.js.map +1 -0
  49. package/dist/migrations/1000000000038-AddShellyCoverOrdering.d.ts +6 -0
  50. package/dist/migrations/1000000000038-AddShellyCoverOrdering.js +19 -0
  51. package/dist/migrations/1000000000038-AddShellyCoverOrdering.js.map +1 -0
  52. package/dist/migrations/1000000000039-AddVirtualThermostatComfort.d.ts +6 -0
  53. package/dist/migrations/1000000000039-AddVirtualThermostatComfort.js +16 -0
  54. package/dist/migrations/1000000000039-AddVirtualThermostatComfort.js.map +1 -0
  55. package/dist/migrations/1000000000040-AddThermostatBranchGroups.d.ts +6 -0
  56. package/dist/migrations/1000000000040-AddThermostatBranchGroups.js +32 -0
  57. package/dist/migrations/1000000000040-AddThermostatBranchGroups.js.map +1 -0
  58. package/dist/migrations/1000000000041-AddThermostatMemberProtection.d.ts +6 -0
  59. package/dist/migrations/1000000000041-AddThermostatMemberProtection.js +39 -0
  60. package/dist/migrations/1000000000041-AddThermostatMemberProtection.js.map +1 -0
  61. package/dist/migrations/1000000000042-AddShellyCoverRecoveries.d.ts +6 -0
  62. package/dist/migrations/1000000000042-AddShellyCoverRecoveries.js +19 -0
  63. package/dist/migrations/1000000000042-AddShellyCoverRecoveries.js.map +1 -0
  64. package/dist/migrations/1000000000044-AddVirtualDewPoint.d.ts +6 -0
  65. package/dist/migrations/1000000000044-AddVirtualDewPoint.js +36 -0
  66. package/dist/migrations/1000000000044-AddVirtualDewPoint.js.map +1 -0
  67. package/dist/migrations/1000000000045-AddThermostatCoolingDependencies.d.ts +6 -0
  68. package/dist/migrations/1000000000045-AddThermostatCoolingDependencies.js +32 -0
  69. package/dist/migrations/1000000000045-AddThermostatCoolingDependencies.js.map +1 -0
  70. package/dist/migrations/1000000000046-AddSpaceActivityModes.d.ts +7 -0
  71. package/dist/migrations/1000000000046-AddSpaceActivityModes.js +54 -0
  72. package/dist/migrations/1000000000046-AddSpaceActivityModes.js.map +1 -0
  73. package/dist/migrations/1000000000047-AddClimateAutomationOwnership.d.ts +6 -0
  74. package/dist/migrations/1000000000047-AddClimateAutomationOwnership.js +60 -0
  75. package/dist/migrations/1000000000047-AddClimateAutomationOwnership.js.map +1 -0
  76. package/dist/migrations/1000000000048-AddThermostatCreationCatalogBirths.d.ts +6 -0
  77. package/dist/migrations/1000000000048-AddThermostatCreationCatalogBirths.js +208 -0
  78. package/dist/migrations/1000000000048-AddThermostatCreationCatalogBirths.js.map +1 -0
  79. package/dist/migrations/1000000000049-FenceClimateAutomationLifecycle.d.ts +6 -0
  80. package/dist/migrations/1000000000049-FenceClimateAutomationLifecycle.js +40 -0
  81. package/dist/migrations/1000000000049-FenceClimateAutomationLifecycle.js.map +1 -0
  82. package/dist/migrations/1000000000050-AddSpaceModeSchedules.d.ts +6 -0
  83. package/dist/migrations/1000000000050-AddSpaceModeSchedules.js +36 -0
  84. package/dist/migrations/1000000000050-AddSpaceModeSchedules.js.map +1 -0
  85. package/dist/migrations/1000000000051-AddSpaceOccupancy.d.ts +6 -0
  86. package/dist/migrations/1000000000051-AddSpaceOccupancy.js +34 -0
  87. package/dist/migrations/1000000000051-AddSpaceOccupancy.js.map +1 -0
  88. package/dist/migrations/1000000000052-AddNativeThermostats.d.ts +6 -0
  89. package/dist/migrations/1000000000052-AddNativeThermostats.js +39 -0
  90. package/dist/migrations/1000000000052-AddNativeThermostats.js.map +1 -0
  91. package/dist/migrations/1000000000053-AddThermostatOverrideClocks.d.ts +6 -0
  92. package/dist/migrations/1000000000053-AddThermostatOverrideClocks.js +35 -0
  93. package/dist/migrations/1000000000053-AddThermostatOverrideClocks.js.map +1 -0
  94. package/dist/modules/buddy/buddy.utils.d.ts +1 -1
  95. package/dist/modules/buddy/buddy.utils.js +10 -11
  96. package/dist/modules/buddy/buddy.utils.js.map +1 -1
  97. package/dist/modules/buddy/services/buddy-context.service.js +2 -1
  98. package/dist/modules/buddy/services/buddy-context.service.js.map +1 -1
  99. package/dist/modules/buddy/services/home-context-tool-provider.service.d.ts +1 -1
  100. package/dist/modules/devices/contracts/climate-automation.contract.d.ts +111 -0
  101. package/dist/modules/devices/contracts/climate-automation.contract.js +3 -0
  102. package/dist/modules/devices/contracts/climate-automation.contract.js.map +1 -0
  103. package/dist/modules/devices/controllers/channels.properties.controller.d.ts +1 -1
  104. package/dist/modules/devices/controllers/channels.properties.controller.js +11 -4
  105. package/dist/modules/devices/controllers/channels.properties.controller.js.map +1 -1
  106. package/dist/modules/devices/controllers/devices.channels.properties.controller.d.ts +1 -1
  107. package/dist/modules/devices/controllers/devices.channels.properties.controller.js +11 -4
  108. package/dist/modules/devices/controllers/devices.channels.properties.controller.js.map +1 -1
  109. package/dist/modules/devices/controllers/property-command.controller.d.ts +9 -0
  110. package/dist/modules/devices/controllers/property-command.controller.js +88 -0
  111. package/dist/modules/devices/controllers/property-command.controller.js.map +1 -0
  112. package/dist/modules/devices/devices.constants.d.ts +4 -0
  113. package/dist/modules/devices/devices.constants.js +4 -0
  114. package/dist/modules/devices/devices.constants.js.map +1 -1
  115. package/dist/modules/devices/devices.module.js +22 -0
  116. package/dist/modules/devices/devices.module.js.map +1 -1
  117. package/dist/modules/devices/devices.openapi.d.ts +3 -1
  118. package/dist/modules/devices/devices.openapi.js +39 -0
  119. package/dist/modules/devices/devices.openapi.js.map +1 -1
  120. package/dist/modules/devices/dto/property-command.dto.js +20 -6
  121. package/dist/modules/devices/dto/property-command.dto.js.map +1 -1
  122. package/dist/modules/devices/dto/update-device.dto.d.ts +1 -1
  123. package/dist/modules/devices/dto/update-device.dto.js +4 -3
  124. package/dist/modules/devices/dto/update-device.dto.js.map +1 -1
  125. package/dist/modules/devices/entities/climate-automation.entity.d.ts +56 -0
  126. package/dist/modules/devices/entities/climate-automation.entity.js +231 -0
  127. package/dist/modules/devices/entities/climate-automation.entity.js.map +1 -0
  128. package/dist/modules/devices/entities/devices.entity.d.ts +4 -0
  129. package/dist/modules/devices/entities/devices.entity.js +27 -3
  130. package/dist/modules/devices/entities/devices.entity.js.map +1 -1
  131. package/dist/modules/devices/interceptors/property-command-entry.interceptor.d.ts +10 -0
  132. package/dist/modules/devices/interceptors/property-command-entry.interceptor.js +50 -0
  133. package/dist/modules/devices/interceptors/property-command-entry.interceptor.js.map +1 -0
  134. package/dist/modules/devices/models/composite-command.model.d.ts +16 -0
  135. package/dist/modules/devices/models/composite-command.model.js +99 -0
  136. package/dist/modules/devices/models/composite-command.model.js.map +1 -0
  137. package/dist/modules/devices/models/property-command-response.model.d.ts +18 -0
  138. package/dist/modules/devices/models/property-command-response.model.js +90 -0
  139. package/dist/modules/devices/models/property-command-response.model.js.map +1 -0
  140. package/dist/modules/devices/models/property-read-policy.model.d.ts +4 -0
  141. package/dist/modules/devices/models/property-read-policy.model.js +57 -0
  142. package/dist/modules/devices/models/property-read-policy.model.js.map +1 -0
  143. package/dist/modules/devices/models/property-sample.model.d.ts +50 -0
  144. package/dist/modules/devices/models/property-sample.model.js +3 -0
  145. package/dist/modules/devices/models/property-sample.model.js.map +1 -0
  146. package/dist/modules/devices/models/property-value-state.model.d.ts +11 -0
  147. package/dist/modules/devices/models/property-value-state.model.js +55 -1
  148. package/dist/modules/devices/models/property-value-state.model.js.map +1 -1
  149. package/dist/modules/devices/platforms/device.platform.d.ts +43 -0
  150. package/dist/modules/devices/platforms/native-climate.contract.d.ts +50 -0
  151. package/dist/modules/devices/platforms/native-climate.contract.js +3 -0
  152. package/dist/modules/devices/platforms/native-climate.contract.js.map +1 -0
  153. package/dist/modules/devices/services/channels-type-mapper.service.d.ts +3 -0
  154. package/dist/modules/devices/services/channels-type-mapper.service.js +21 -1
  155. package/dist/modules/devices/services/channels-type-mapper.service.js.map +1 -1
  156. package/dist/modules/devices/services/channels.properties-type-mapper.service.d.ts +7 -2
  157. package/dist/modules/devices/services/channels.properties-type-mapper.service.js +21 -1
  158. package/dist/modules/devices/services/channels.properties-type-mapper.service.js.map +1 -1
  159. package/dist/modules/devices/services/channels.properties.service.d.ts +11 -2
  160. package/dist/modules/devices/services/channels.properties.service.js +219 -64
  161. package/dist/modules/devices/services/channels.properties.service.js.map +1 -1
  162. package/dist/modules/devices/services/channels.service.d.ts +12 -5
  163. package/dist/modules/devices/services/channels.service.js +148 -55
  164. package/dist/modules/devices/services/channels.service.js.map +1 -1
  165. package/dist/modules/devices/services/climate-automation-ledger-lifecycle.d.ts +47 -0
  166. package/dist/modules/devices/services/climate-automation-ledger-lifecycle.js +242 -0
  167. package/dist/modules/devices/services/climate-automation-ledger-lifecycle.js.map +1 -0
  168. package/dist/modules/devices/services/climate-automation-ledger.service.d.ts +68 -0
  169. package/dist/modules/devices/services/climate-automation-ledger.service.js +1061 -0
  170. package/dist/modules/devices/services/climate-automation-ledger.service.js.map +1 -0
  171. package/dist/modules/devices/services/climate-automation-ledger.utils.d.ts +8 -0
  172. package/dist/modules/devices/services/climate-automation-ledger.utils.js +54 -0
  173. package/dist/modules/devices/services/climate-automation-ledger.utils.js.map +1 -0
  174. package/dist/modules/devices/services/climate-automation.registry.service.d.ts +15 -0
  175. package/dist/modules/devices/services/climate-automation.registry.service.js +71 -0
  176. package/dist/modules/devices/services/climate-automation.registry.service.js.map +1 -0
  177. package/dist/modules/devices/services/composite-property-command.registry.service.d.ts +48 -0
  178. package/dist/modules/devices/services/composite-property-command.registry.service.js +65 -0
  179. package/dist/modules/devices/services/composite-property-command.registry.service.js.map +1 -0
  180. package/dist/modules/devices/services/controller-publication-context.d.ts +27 -0
  181. package/dist/modules/devices/services/controller-publication-context.js +148 -0
  182. package/dist/modules/devices/services/controller-publication-context.js.map +1 -0
  183. package/dist/modules/devices/services/cover-action-proof.d.ts +7 -0
  184. package/dist/modules/devices/services/cover-action-proof.js +142 -0
  185. package/dist/modules/devices/services/cover-action-proof.js.map +1 -0
  186. package/dist/modules/devices/services/creation-capture.d.ts +19 -0
  187. package/dist/modules/devices/services/creation-capture.js +85 -0
  188. package/dist/modules/devices/services/creation-capture.js.map +1 -0
  189. package/dist/modules/devices/services/device-command-graph.service.js +1 -1
  190. package/dist/modules/devices/services/device-command-graph.service.js.map +1 -1
  191. package/dist/modules/devices/services/device-connection-state.service.d.ts +1 -0
  192. package/dist/modules/devices/services/device-connection-state.service.js +64 -18
  193. package/dist/modules/devices/services/device-connection-state.service.js.map +1 -1
  194. package/dist/modules/devices/services/device-connectivity.service.js +96 -51
  195. package/dist/modules/devices/services/device-connectivity.service.js.map +1 -1
  196. package/dist/modules/devices/services/device-contribution.registry.service.d.ts +50 -0
  197. package/dist/modules/devices/services/device-contribution.registry.service.js +45 -0
  198. package/dist/modules/devices/services/device-contribution.registry.service.js.map +1 -0
  199. package/dist/modules/devices/services/device-creation-context.d.ts +57 -0
  200. package/dist/modules/devices/services/device-creation-context.js +315 -0
  201. package/dist/modules/devices/services/device-creation-context.js.map +1 -0
  202. package/dist/modules/devices/services/device-structure-lock.service.d.ts +5 -0
  203. package/dist/modules/devices/services/device-structure-lock.service.js +64 -12
  204. package/dist/modules/devices/services/device-structure-lock.service.js.map +1 -1
  205. package/dist/modules/devices/services/device-validation.service.d.ts +0 -1
  206. package/dist/modules/devices/services/device-validation.service.js +3 -14
  207. package/dist/modules/devices/services/device-validation.service.js.map +1 -1
  208. package/dist/modules/devices/services/device-zones.service.d.ts +3 -1
  209. package/dist/modules/devices/services/device-zones.service.js +30 -6
  210. package/dist/modules/devices/services/device-zones.service.js.map +1 -1
  211. package/dist/modules/devices/services/devices-type-mapper.service.d.ts +3 -0
  212. package/dist/modules/devices/services/devices-type-mapper.service.js +21 -1
  213. package/dist/modules/devices/services/devices-type-mapper.service.js.map +1 -1
  214. package/dist/modules/devices/services/devices.service.d.ts +8 -2
  215. package/dist/modules/devices/services/devices.service.js +194 -49
  216. package/dist/modules/devices/services/devices.service.js.map +1 -1
  217. package/dist/modules/devices/services/platform.registry.service.d.ts +11 -1
  218. package/dist/modules/devices/services/platform.registry.service.js +42 -5
  219. package/dist/modules/devices/services/platform.registry.service.js.map +1 -1
  220. package/dist/modules/devices/services/property-command-admission.registry.service.d.ts +28 -0
  221. package/dist/modules/devices/services/property-command-admission.registry.service.js +70 -0
  222. package/dist/modules/devices/services/property-command-admission.registry.service.js.map +1 -0
  223. package/dist/modules/devices/services/property-command-dispatch.service.d.ts +28 -2
  224. package/dist/modules/devices/services/property-command-dispatch.service.js +704 -10
  225. package/dist/modules/devices/services/property-command-dispatch.service.js.map +1 -1
  226. package/dist/modules/devices/services/property-command-entry-snapshot.d.ts +25 -0
  227. package/dist/modules/devices/services/property-command-entry-snapshot.js +87 -0
  228. package/dist/modules/devices/services/property-command-entry-snapshot.js.map +1 -0
  229. package/dist/modules/devices/services/property-command-window.service.d.ts +22 -0
  230. package/dist/modules/devices/services/property-command-window.service.js +81 -0
  231. package/dist/modules/devices/services/property-command-window.service.js.map +1 -1
  232. package/dist/modules/devices/services/property-command.service.d.ts +24 -3
  233. package/dist/modules/devices/services/property-command.service.js +180 -18
  234. package/dist/modules/devices/services/property-command.service.js.map +1 -1
  235. package/dist/modules/devices/services/property-metadata.service.js +1 -1
  236. package/dist/modules/devices/services/property-metadata.service.js.map +1 -1
  237. package/dist/modules/devices/services/property-producer.registry.service.d.ts +98 -0
  238. package/dist/modules/devices/services/property-producer.registry.service.js +636 -0
  239. package/dist/modules/devices/services/property-producer.registry.service.js.map +1 -0
  240. package/dist/modules/devices/services/property-value-source.registry.service.d.ts +18 -0
  241. package/dist/modules/devices/services/property-value-source.registry.service.js +291 -2
  242. package/dist/modules/devices/services/property-value-source.registry.service.js.map +1 -1
  243. package/dist/modules/devices/services/property-value.service.d.ts +40 -3
  244. package/dist/modules/devices/services/property-value.service.js +744 -193
  245. package/dist/modules/devices/services/property-value.service.js.map +1 -1
  246. package/dist/modules/devices/subscribers/channel-property-entity.subscriber.d.ts +5 -0
  247. package/dist/modules/devices/subscribers/channel-property-entity.subscriber.js +25 -0
  248. package/dist/modules/devices/subscribers/channel-property-entity.subscriber.js.map +1 -1
  249. package/dist/modules/devices/utils/property-metadata.utils.d.ts +1 -0
  250. package/dist/modules/devices/utils/property-metadata.utils.js +10 -0
  251. package/dist/modules/devices/utils/property-metadata.utils.js.map +1 -1
  252. package/dist/modules/devices/utils/property-permissions.utils.d.ts +2 -0
  253. package/dist/modules/devices/utils/property-permissions.utils.js +10 -0
  254. package/dist/modules/devices/utils/property-permissions.utils.js.map +1 -0
  255. package/dist/modules/extensions/services/discovered-backend.module.d.ts +6 -0
  256. package/dist/modules/extensions/services/discovered-backend.module.js +32 -0
  257. package/dist/modules/extensions/services/discovered-backend.module.js.map +1 -0
  258. package/dist/modules/extensions/services/extensions-discovery.js +15 -0
  259. package/dist/modules/extensions/services/extensions-discovery.js.map +1 -1
  260. package/dist/modules/extensions/services/extensions.service.d.ts +4 -0
  261. package/dist/modules/extensions/services/extensions.service.js +13 -0
  262. package/dist/modules/extensions/services/extensions.service.js.map +1 -1
  263. package/dist/modules/extensions/services/managed-extension-service.interface.d.ts +1 -0
  264. package/dist/modules/extensions/services/managed-service-manager.service.d.ts +15 -0
  265. package/dist/modules/extensions/services/managed-service-manager.service.js +242 -72
  266. package/dist/modules/extensions/services/managed-service-manager.service.js.map +1 -1
  267. package/dist/modules/home-context/schemas/home-search-input.schemas.d.ts +1 -1
  268. package/dist/modules/intents/models/intent.model.d.ts +2 -0
  269. package/dist/modules/intents/models/intent.model.js +14 -0
  270. package/dist/modules/intents/models/intent.model.js.map +1 -1
  271. package/dist/modules/intents/services/intents.service.d.ts +2 -1
  272. package/dist/modules/intents/services/intents.service.js +18 -2
  273. package/dist/modules/intents/services/intents.service.js.map +1 -1
  274. package/dist/modules/scenes/listeners/websocket-exchange.listener.js +4 -0
  275. package/dist/modules/scenes/listeners/websocket-exchange.listener.js.map +1 -1
  276. package/dist/modules/scenes/models/scenes.model.d.ts +2 -0
  277. package/dist/modules/scenes/models/scenes.model.js +10 -0
  278. package/dist/modules/scenes/models/scenes.model.js.map +1 -1
  279. package/dist/modules/scenes/services/scene-executor.service.d.ts +6 -1
  280. package/dist/modules/scenes/services/scene-executor.service.js +33 -22
  281. package/dist/modules/scenes/services/scene-executor.service.js.map +1 -1
  282. package/dist/modules/security/providers/alarm-security.provider.d.ts +3 -1
  283. package/dist/modules/security/providers/alarm-security.provider.js +83 -8
  284. package/dist/modules/security/providers/alarm-security.provider.js.map +1 -1
  285. package/dist/modules/spaces/services/space-lifecycle-registry.service.d.ts +19 -0
  286. package/dist/modules/spaces/services/space-lifecycle-registry.service.js +121 -0
  287. package/dist/modules/spaces/services/space-lifecycle-registry.service.js.map +1 -0
  288. package/dist/modules/spaces/services/spaces.service.d.ts +5 -1
  289. package/dist/modules/spaces/services/spaces.service.js +34 -6
  290. package/dist/modules/spaces/services/spaces.service.js.map +1 -1
  291. package/dist/modules/spaces/spaces.constants.d.ts +3 -1
  292. package/dist/modules/spaces/spaces.constants.js +2 -0
  293. package/dist/modules/spaces/spaces.constants.js.map +1 -1
  294. package/dist/modules/spaces/spaces.module.js +13 -1
  295. package/dist/modules/spaces/spaces.module.js.map +1 -1
  296. package/dist/modules/storage/services/storage.service.d.ts +8 -0
  297. package/dist/modules/storage/services/storage.service.js +225 -0
  298. package/dist/modules/storage/services/storage.service.js.map +1 -1
  299. package/dist/modules/swagger/decorators/api-documentation.decorator.d.ts +1 -0
  300. package/dist/modules/swagger/decorators/api-documentation.decorator.js +9 -1
  301. package/dist/modules/swagger/decorators/api-documentation.decorator.js.map +1 -1
  302. package/dist/modules/swagger/services/swagger-document.service.d.ts +1 -0
  303. package/dist/modules/swagger/services/swagger-document.service.js +71 -1
  304. package/dist/modules/swagger/services/swagger-document.service.js.map +1 -1
  305. package/dist/modules/system/services/backup.service.js +3 -5
  306. package/dist/modules/system/services/backup.service.js.map +1 -1
  307. package/dist/modules/system/utils/timezone.utils.d.ts +2 -0
  308. package/dist/modules/system/utils/timezone.utils.js +9 -0
  309. package/dist/modules/system/utils/timezone.utils.js.map +1 -0
  310. package/dist/modules/websocket/gateway/websocket.gateway.js +1 -0
  311. package/dist/modules/websocket/gateway/websocket.gateway.js.map +1 -1
  312. package/dist/plugins/devices-home-assistant/devices-home-assistant.plugin.js +2 -0
  313. package/dist/plugins/devices-home-assistant/devices-home-assistant.plugin.js.map +1 -1
  314. package/dist/plugins/devices-home-assistant/dto/update-channel-property.dto.d.ts +3 -3
  315. package/dist/plugins/devices-home-assistant/dto/update-channel-property.dto.js +3 -3
  316. package/dist/plugins/devices-home-assistant/dto/update-channel-property.dto.js.map +1 -1
  317. package/dist/plugins/devices-home-assistant/platforms/home-assistant.device.platform.d.ts +11 -1
  318. package/dist/plugins/devices-home-assistant/platforms/home-assistant.device.platform.js +82 -2
  319. package/dist/plugins/devices-home-assistant/platforms/home-assistant.device.platform.js.map +1 -1
  320. package/dist/plugins/devices-home-assistant/services/home-assistant-native-climate.service.d.ts +22 -0
  321. package/dist/plugins/devices-home-assistant/services/home-assistant-native-climate.service.js +409 -0
  322. package/dist/plugins/devices-home-assistant/services/home-assistant-native-climate.service.js.map +1 -0
  323. package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.d.ts +14 -0
  324. package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js +93 -3
  325. package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js.map +1 -1
  326. package/dist/plugins/devices-homekit/devices-homekit.plugin.js +28 -2
  327. package/dist/plugins/devices-homekit/devices-homekit.plugin.js.map +1 -1
  328. package/dist/plugins/devices-homekit/listeners/homekit-event.listener.d.ts +26 -3
  329. package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js +183 -5
  330. package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js.map +1 -1
  331. package/dist/plugins/devices-homekit/mappers/base.mapper.d.ts +2 -1
  332. package/dist/plugins/devices-homekit/mappers/base.mapper.js +38 -10
  333. package/dist/plugins/devices-homekit/mappers/base.mapper.js.map +1 -1
  334. package/dist/plugins/devices-homekit/mappers/battery.mapper.js +4 -3
  335. package/dist/plugins/devices-homekit/mappers/battery.mapper.js.map +1 -1
  336. package/dist/plugins/devices-homekit/mappers/button.mapper.js +21 -2
  337. package/dist/plugins/devices-homekit/mappers/button.mapper.js.map +1 -1
  338. package/dist/plugins/devices-homekit/mappers/characteristic-get.d.ts +3 -0
  339. package/dist/plugins/devices-homekit/mappers/characteristic-get.js +10 -0
  340. package/dist/plugins/devices-homekit/mappers/characteristic-get.js.map +1 -0
  341. package/dist/plugins/devices-homekit/mappers/characteristic-write.d.ts +1 -1
  342. package/dist/plugins/devices-homekit/mappers/characteristic-write.js +2 -1
  343. package/dist/plugins/devices-homekit/mappers/characteristic-write.js.map +1 -1
  344. package/dist/plugins/devices-homekit/mappers/fan.mapper.d.ts +12 -0
  345. package/dist/plugins/devices-homekit/mappers/fan.mapper.js +126 -0
  346. package/dist/plugins/devices-homekit/mappers/fan.mapper.js.map +1 -0
  347. package/dist/plugins/devices-homekit/mappers/homekit-mapper.interface.d.ts +8 -0
  348. package/dist/plugins/devices-homekit/mappers/outlet.mapper.js +4 -0
  349. package/dist/plugins/devices-homekit/mappers/outlet.mapper.js.map +1 -1
  350. package/dist/plugins/devices-homekit/mappers/property-read.d.ts +7 -0
  351. package/dist/plugins/devices-homekit/mappers/property-read.js +64 -0
  352. package/dist/plugins/devices-homekit/mappers/property-read.js.map +1 -0
  353. package/dist/plugins/devices-homekit/mappers/semantic-conversion.d.ts +2 -0
  354. package/dist/plugins/devices-homekit/mappers/semantic-conversion.js +15 -0
  355. package/dist/plugins/devices-homekit/mappers/semantic-conversion.js.map +1 -0
  356. package/dist/plugins/devices-homekit/mappers/sensor.mapper.d.ts +3 -0
  357. package/dist/plugins/devices-homekit/mappers/sensor.mapper.js +63 -11
  358. package/dist/plugins/devices-homekit/mappers/sensor.mapper.js.map +1 -1
  359. package/dist/plugins/devices-homekit/mappers/service-fault.d.ts +4 -0
  360. package/dist/plugins/devices-homekit/mappers/service-fault.js +33 -0
  361. package/dist/plugins/devices-homekit/mappers/service-fault.js.map +1 -0
  362. package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.d.ts +4 -0
  363. package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js +128 -19
  364. package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js.map +1 -1
  365. package/dist/plugins/devices-homekit/mappers/thermostat.mapper.js +5 -3
  366. package/dist/plugins/devices-homekit/mappers/thermostat.mapper.js.map +1 -1
  367. package/dist/plugins/devices-homekit/mappers/unavailable-characteristic.d.ts +3 -0
  368. package/dist/plugins/devices-homekit/mappers/unavailable-characteristic.js +18 -0
  369. package/dist/plugins/devices-homekit/mappers/unavailable-characteristic.js.map +1 -0
  370. package/dist/plugins/devices-homekit/mappers/window-covering.mapper.js +19 -3
  371. package/dist/plugins/devices-homekit/mappers/window-covering.mapper.js.map +1 -1
  372. package/dist/plugins/devices-homekit/services/homekit-bridge.service.d.ts +4 -0
  373. package/dist/plugins/devices-homekit/services/homekit-bridge.service.js +58 -29
  374. package/dist/plugins/devices-homekit/services/homekit-bridge.service.js.map +1 -1
  375. package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.d.ts +2 -0
  376. package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.js +3 -0
  377. package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.js.map +1 -1
  378. package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.d.ts +30 -2
  379. package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.js +126 -2
  380. package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.js.map +1 -1
  381. package/dist/plugins/devices-homekit/services/homekit-mapping-maintenance.d.ts +8 -0
  382. package/dist/plugins/devices-homekit/services/homekit-mapping-maintenance.js +17 -0
  383. package/dist/plugins/devices-homekit/services/homekit-mapping-maintenance.js.map +1 -0
  384. package/dist/plugins/devices-homekit/services/homekit-property-state.service.d.ts +19 -0
  385. package/dist/plugins/devices-homekit/services/homekit-property-state.service.js +69 -0
  386. package/dist/plugins/devices-homekit/services/homekit-property-state.service.js.map +1 -0
  387. package/dist/plugins/devices-shelly-ng/contracts/cover-action.contract.d.ts +13 -0
  388. package/dist/plugins/devices-shelly-ng/contracts/cover-action.contract.js +60 -0
  389. package/dist/plugins/devices-shelly-ng/contracts/cover-action.contract.js.map +1 -0
  390. package/dist/plugins/devices-shelly-ng/contracts/cover-recovery.contract.d.ts +13 -0
  391. package/dist/plugins/devices-shelly-ng/contracts/cover-recovery.contract.js +3 -0
  392. package/dist/plugins/devices-shelly-ng/contracts/cover-recovery.contract.js.map +1 -0
  393. package/dist/plugins/devices-shelly-ng/contracts/guard-script-source.d.ts +1 -0
  394. package/dist/plugins/devices-shelly-ng/contracts/guard-script-source.js +5 -0
  395. package/dist/plugins/devices-shelly-ng/contracts/guard-script-source.js.map +1 -0
  396. package/dist/plugins/devices-shelly-ng/contracts/guard-script.contract.d.ts +21 -0
  397. package/dist/plugins/devices-shelly-ng/contracts/guard-script.contract.js +47 -0
  398. package/dist/plugins/devices-shelly-ng/contracts/guard-script.contract.js.map +1 -0
  399. package/dist/plugins/devices-shelly-ng/contracts/member-guard-script-source.d.ts +2 -0
  400. package/dist/plugins/devices-shelly-ng/contracts/member-guard-script-source.js +27 -0
  401. package/dist/plugins/devices-shelly-ng/contracts/member-guard-script-source.js.map +1 -0
  402. package/dist/plugins/devices-shelly-ng/contracts/native-temperature.contract.d.ts +36 -0
  403. package/dist/plugins/devices-shelly-ng/contracts/native-temperature.contract.js +200 -0
  404. package/dist/plugins/devices-shelly-ng/contracts/native-temperature.contract.js.map +1 -0
  405. package/dist/plugins/devices-shelly-ng/contracts/protective-switch.contract.d.ts +44 -0
  406. package/dist/plugins/devices-shelly-ng/contracts/protective-switch.contract.js +29 -0
  407. package/dist/plugins/devices-shelly-ng/contracts/protective-switch.contract.js.map +1 -0
  408. package/dist/plugins/devices-shelly-ng/controllers/shelly-cover-recovery.controller.d.ts +11 -0
  409. package/dist/plugins/devices-shelly-ng/controllers/shelly-cover-recovery.controller.js +98 -0
  410. package/dist/plugins/devices-shelly-ng/controllers/shelly-cover-recovery.controller.js.map +1 -0
  411. package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.d.ts +51 -1
  412. package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js +688 -2
  413. package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js.map +1 -1
  414. package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.d.ts +46 -1
  415. package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js +315 -4
  416. package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js.map +1 -1
  417. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.openapi.d.ts +3 -1
  418. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.openapi.js +8 -0
  419. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.openapi.js.map +1 -1
  420. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.plugin.js +16 -1
  421. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.plugin.js.map +1 -1
  422. package/dist/plugins/devices-shelly-ng/dto/cover-recovery.dto.d.ts +11 -0
  423. package/dist/plugins/devices-shelly-ng/dto/cover-recovery.dto.js +77 -0
  424. package/dist/plugins/devices-shelly-ng/dto/cover-recovery.dto.js.map +1 -0
  425. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-ordering.entity.d.ts +5 -0
  426. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-ordering.entity.js +32 -0
  427. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-ordering.entity.js.map +1 -0
  428. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-recovery.entity.d.ts +17 -0
  429. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-recovery.entity.js +80 -0
  430. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-recovery.entity.js.map +1 -0
  431. package/dist/plugins/devices-shelly-ng/entities/shelly-sample-source.entity.d.ts +16 -0
  432. package/dist/plugins/devices-shelly-ng/entities/shelly-sample-source.entity.js +70 -0
  433. package/dist/plugins/devices-shelly-ng/entities/shelly-sample-source.entity.js.map +1 -0
  434. package/dist/plugins/devices-shelly-ng/mappings/definitions/covers.yaml +30 -24
  435. package/dist/plugins/devices-shelly-ng/models/cover-recovery.model.d.ts +21 -0
  436. package/dist/plugins/devices-shelly-ng/models/cover-recovery.model.js +114 -0
  437. package/dist/plugins/devices-shelly-ng/models/cover-recovery.model.js.map +1 -0
  438. package/dist/plugins/devices-shelly-ng/platforms/shelly-ng.device.platform.d.ts +27 -1
  439. package/dist/plugins/devices-shelly-ng/platforms/shelly-ng.device.platform.js +146 -0
  440. package/dist/plugins/devices-shelly-ng/platforms/shelly-ng.device.platform.js.map +1 -1
  441. package/dist/plugins/devices-shelly-ng/services/authenticated-shelly-script-http.d.ts +16 -0
  442. package/dist/plugins/devices-shelly-ng/services/authenticated-shelly-script-http.js +154 -0
  443. package/dist/plugins/devices-shelly-ng/services/authenticated-shelly-script-http.js.map +1 -0
  444. package/dist/plugins/devices-shelly-ng/services/device-manager.service.d.ts +4 -1
  445. package/dist/plugins/devices-shelly-ng/services/device-manager.service.js +113 -4
  446. package/dist/plugins/devices-shelly-ng/services/device-manager.service.js.map +1 -1
  447. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-http.d.ts +2 -0
  448. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-http.js +78 -0
  449. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-http.js.map +1 -0
  450. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-rpc.d.ts +9 -0
  451. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-rpc.js +56 -0
  452. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-rpc.js.map +1 -0
  453. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-artifact.d.ts +45 -0
  454. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-artifact.js +278 -0
  455. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-artifact.js.map +1 -0
  456. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-lease.contract.d.ts +49 -0
  457. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-lease.contract.js +32 -0
  458. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-lease.contract.js.map +1 -0
  459. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-qualification.d.ts +53 -0
  460. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-qualification.js +91 -0
  461. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-qualification.js.map +1 -0
  462. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-session.d.ts +35 -0
  463. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-session.js +244 -0
  464. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-session.js.map +1 -0
  465. package/dist/plugins/devices-shelly-ng/services/shelly-cover-ordering.service.d.ts +9 -0
  466. package/dist/plugins/devices-shelly-ng/services/shelly-cover-ordering.service.js +50 -0
  467. package/dist/plugins/devices-shelly-ng/services/shelly-cover-ordering.service.js.map +1 -0
  468. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery-lane.service.d.ts +29 -0
  469. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery-lane.service.js +166 -0
  470. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery-lane.service.js.map +1 -0
  471. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery.service.d.ts +21 -0
  472. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery.service.js +207 -0
  473. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery.service.js.map +1 -0
  474. package/dist/plugins/devices-shelly-ng/services/shelly-cover-session.d.ts +25 -0
  475. package/dist/plugins/devices-shelly-ng/services/shelly-cover-session.js +132 -0
  476. package/dist/plugins/devices-shelly-ng/services/shelly-cover-session.js.map +1 -0
  477. package/dist/plugins/devices-shelly-ng/services/shelly-cover-telemetry.d.ts +9 -0
  478. package/dist/plugins/devices-shelly-ng/services/shelly-cover-telemetry.js +63 -0
  479. package/dist/plugins/devices-shelly-ng/services/shelly-cover-telemetry.js.map +1 -0
  480. package/dist/plugins/devices-shelly-ng/services/shelly-guard-rpc-session.d.ts +33 -0
  481. package/dist/plugins/devices-shelly-ng/services/shelly-guard-rpc-session.js +191 -0
  482. package/dist/plugins/devices-shelly-ng/services/shelly-guard-rpc-session.js.map +1 -0
  483. package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.d.ts +3 -0
  484. package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js +32 -4
  485. package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js.map +1 -1
  486. package/dist/plugins/devices-shelly-ng/services/shelly-sample-sources.service.d.ts +34 -0
  487. package/dist/plugins/devices-shelly-ng/services/shelly-sample-sources.service.js +194 -0
  488. package/dist/plugins/devices-shelly-ng/services/shelly-sample-sources.service.js.map +1 -0
  489. package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js +5 -2
  490. package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js.map +1 -1
  491. package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.d.ts +4 -0
  492. package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.js +3 -0
  493. package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.js.map +1 -1
  494. package/dist/plugins/devices-virtual/contracts/thermostat-actuation.contract.d.ts +114 -0
  495. package/dist/plugins/devices-virtual/contracts/thermostat-actuation.contract.js +12 -0
  496. package/dist/plugins/devices-virtual/contracts/thermostat-actuation.contract.js.map +1 -0
  497. package/dist/plugins/devices-virtual/contracts/thermostat-command.contract.d.ts +4 -0
  498. package/dist/plugins/devices-virtual/contracts/thermostat-command.contract.js +3 -0
  499. package/dist/plugins/devices-virtual/contracts/thermostat-command.contract.js.map +1 -0
  500. package/dist/plugins/devices-virtual/controllers/native-thermostat.controller.d.ts +15 -0
  501. package/dist/plugins/devices-virtual/controllers/native-thermostat.controller.js +178 -0
  502. package/dist/plugins/devices-virtual/controllers/native-thermostat.controller.js.map +1 -0
  503. package/dist/plugins/devices-virtual/controllers/thermostat-authoring-context.controller.d.ts +11 -0
  504. package/dist/plugins/devices-virtual/controllers/thermostat-authoring-context.controller.js +92 -0
  505. package/dist/plugins/devices-virtual/controllers/thermostat-authoring-context.controller.js.map +1 -0
  506. package/dist/plugins/devices-virtual/controllers/thermostat-installation.controller.d.ts +16 -0
  507. package/dist/plugins/devices-virtual/controllers/thermostat-installation.controller.js +179 -0
  508. package/dist/plugins/devices-virtual/controllers/thermostat-installation.controller.js.map +1 -0
  509. package/dist/plugins/devices-virtual/controllers/virtual-dew-point-config.controller.d.ts +11 -0
  510. package/dist/plugins/devices-virtual/controllers/virtual-dew-point-config.controller.js +100 -0
  511. package/dist/plugins/devices-virtual/controllers/virtual-dew-point-config.controller.js.map +1 -0
  512. package/dist/plugins/devices-virtual/controllers/virtual-measurement-authoring.controller.d.ts +19 -0
  513. package/dist/plugins/devices-virtual/controllers/virtual-measurement-authoring.controller.js +168 -0
  514. package/dist/plugins/devices-virtual/controllers/virtual-measurement-authoring.controller.js.map +1 -0
  515. package/dist/plugins/devices-virtual/controllers/virtual-producer-config.controller.d.ts +28 -0
  516. package/dist/plugins/devices-virtual/controllers/virtual-producer-config.controller.js +278 -0
  517. package/dist/plugins/devices-virtual/controllers/virtual-producer-config.controller.js.map +1 -0
  518. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-authoring.controller.d.ts +12 -0
  519. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-authoring.controller.js +111 -0
  520. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-authoring.controller.js.map +1 -0
  521. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-comfort.controller.d.ts +14 -0
  522. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-comfort.controller.js +160 -0
  523. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-comfort.controller.js.map +1 -0
  524. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-config.controller.d.ts +18 -0
  525. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-config.controller.js +196 -0
  526. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-config.controller.js.map +1 -0
  527. package/dist/plugins/devices-virtual/controllers/virtual-transform-config.controller.d.ts +14 -0
  528. package/dist/plugins/devices-virtual/controllers/virtual-transform-config.controller.js +128 -0
  529. package/dist/plugins/devices-virtual/controllers/virtual-transform-config.controller.js.map +1 -0
  530. package/dist/plugins/devices-virtual/devices-virtual.constants.d.ts +1 -0
  531. package/dist/plugins/devices-virtual/devices-virtual.constants.js +2 -1
  532. package/dist/plugins/devices-virtual/devices-virtual.constants.js.map +1 -1
  533. package/dist/plugins/devices-virtual/devices-virtual.openapi.d.ts +24 -2
  534. package/dist/plugins/devices-virtual/devices-virtual.openapi.js +95 -0
  535. package/dist/plugins/devices-virtual/devices-virtual.openapi.js.map +1 -1
  536. package/dist/plugins/devices-virtual/devices-virtual.plugin.d.ts +7 -1
  537. package/dist/plugins/devices-virtual/devices-virtual.plugin.js +167 -10
  538. package/dist/plugins/devices-virtual/devices-virtual.plugin.js.map +1 -1
  539. package/dist/plugins/devices-virtual/dto/create-device.dto.d.ts +2 -0
  540. package/dist/plugins/devices-virtual/dto/create-device.dto.js +20 -0
  541. package/dist/plugins/devices-virtual/dto/create-device.dto.js.map +1 -1
  542. package/dist/plugins/devices-virtual/dto/dew-point-config.dto.d.ts +14 -0
  543. package/dist/plugins/devices-virtual/dto/dew-point-config.dto.js +119 -0
  544. package/dist/plugins/devices-virtual/dto/dew-point-config.dto.js.map +1 -0
  545. package/dist/plugins/devices-virtual/dto/group-catalog.dto.d.ts +8 -0
  546. package/dist/plugins/devices-virtual/dto/group-catalog.dto.js +62 -0
  547. package/dist/plugins/devices-virtual/dto/group-catalog.dto.js.map +1 -0
  548. package/dist/plugins/devices-virtual/dto/light-group-draft.dto.d.ts +19 -0
  549. package/dist/plugins/devices-virtual/dto/light-group-draft.dto.js +108 -0
  550. package/dist/plugins/devices-virtual/dto/light-group-draft.dto.js.map +1 -0
  551. package/dist/plugins/devices-virtual/dto/measurement-authoring.dto.d.ts +25 -0
  552. package/dist/plugins/devices-virtual/dto/measurement-authoring.dto.js +157 -0
  553. package/dist/plugins/devices-virtual/dto/measurement-authoring.dto.js.map +1 -0
  554. package/dist/plugins/devices-virtual/dto/native-thermostat.dto.d.ts +21 -0
  555. package/dist/plugins/devices-virtual/dto/native-thermostat.dto.js +122 -0
  556. package/dist/plugins/devices-virtual/dto/native-thermostat.dto.js.map +1 -0
  557. package/dist/plugins/devices-virtual/dto/producer-config.dto.d.ts +35 -0
  558. package/dist/plugins/devices-virtual/dto/producer-config.dto.js +290 -0
  559. package/dist/plugins/devices-virtual/dto/producer-config.dto.js.map +1 -0
  560. package/dist/plugins/devices-virtual/dto/thermostat-authoring.dto.d.ts +6 -0
  561. package/dist/plugins/devices-virtual/dto/thermostat-authoring.dto.js +46 -0
  562. package/dist/plugins/devices-virtual/dto/thermostat-authoring.dto.js.map +1 -0
  563. package/dist/plugins/devices-virtual/dto/thermostat-comfort.dto.d.ts +39 -0
  564. package/dist/plugins/devices-virtual/dto/thermostat-comfort.dto.js +244 -0
  565. package/dist/plugins/devices-virtual/dto/thermostat-comfort.dto.js.map +1 -0
  566. package/dist/plugins/devices-virtual/dto/thermostat-config.dto.d.ts +94 -0
  567. package/dist/plugins/devices-virtual/dto/thermostat-config.dto.js +718 -0
  568. package/dist/plugins/devices-virtual/dto/thermostat-config.dto.js.map +1 -0
  569. package/dist/plugins/devices-virtual/dto/thermostat-installation.dto.d.ts +71 -0
  570. package/dist/plugins/devices-virtual/dto/thermostat-installation.dto.js +410 -0
  571. package/dist/plugins/devices-virtual/dto/thermostat-installation.dto.js.map +1 -0
  572. package/dist/plugins/devices-virtual/dto/transform-config.dto.d.ts +71 -0
  573. package/dist/plugins/devices-virtual/dto/transform-config.dto.js +430 -0
  574. package/dist/plugins/devices-virtual/dto/transform-config.dto.js.map +1 -0
  575. package/dist/plugins/devices-virtual/dto/update-device.dto.d.ts +2 -0
  576. package/dist/plugins/devices-virtual/dto/update-device.dto.js +20 -0
  577. package/dist/plugins/devices-virtual/dto/update-device.dto.js.map +1 -1
  578. package/dist/plugins/devices-virtual/entities/devices-virtual.entity.d.ts +13 -1
  579. package/dist/plugins/devices-virtual/entities/devices-virtual.entity.js +56 -6
  580. package/dist/plugins/devices-virtual/entities/devices-virtual.entity.js.map +1 -1
  581. package/dist/plugins/devices-virtual/entities/native-thermostat.entity.d.ts +23 -0
  582. package/dist/plugins/devices-virtual/entities/native-thermostat.entity.js +103 -0
  583. package/dist/plugins/devices-virtual/entities/native-thermostat.entity.js.map +1 -0
  584. package/dist/plugins/devices-virtual/entities/thermostat-cooling-dependency.entity.d.ts +19 -0
  585. package/dist/plugins/devices-virtual/entities/thermostat-cooling-dependency.entity.js +87 -0
  586. package/dist/plugins/devices-virtual/entities/thermostat-cooling-dependency.entity.js.map +1 -0
  587. package/dist/plugins/devices-virtual/entities/thermostat-installation.entity.d.ts +36 -0
  588. package/dist/plugins/devices-virtual/entities/thermostat-installation.entity.js +125 -0
  589. package/dist/plugins/devices-virtual/entities/thermostat-installation.entity.js.map +1 -0
  590. package/dist/plugins/devices-virtual/entities/thermostat-member-protection.entity.d.ts +15 -0
  591. package/dist/plugins/devices-virtual/entities/thermostat-member-protection.entity.js +70 -0
  592. package/dist/plugins/devices-virtual/entities/thermostat-member-protection.entity.js.map +1 -0
  593. package/dist/plugins/devices-virtual/entities/thermostat-override-clock.entity.d.ts +7 -0
  594. package/dist/plugins/devices-virtual/entities/thermostat-override-clock.entity.js +39 -0
  595. package/dist/plugins/devices-virtual/entities/thermostat-override-clock.entity.js.map +1 -0
  596. package/dist/plugins/devices-virtual/entities/virtual-dew-point.entity.d.ts +28 -0
  597. package/dist/plugins/devices-virtual/entities/virtual-dew-point.entity.js +104 -0
  598. package/dist/plugins/devices-virtual/entities/virtual-dew-point.entity.js.map +1 -0
  599. package/dist/plugins/devices-virtual/entities/virtual-producer.entity.d.ts +89 -0
  600. package/dist/plugins/devices-virtual/entities/virtual-producer.entity.js +281 -0
  601. package/dist/plugins/devices-virtual/entities/virtual-producer.entity.js.map +1 -0
  602. package/dist/plugins/devices-virtual/entities/virtual-thermostat-runtime.entity.d.ts +45 -0
  603. package/dist/plugins/devices-virtual/entities/virtual-thermostat-runtime.entity.js +184 -0
  604. package/dist/plugins/devices-virtual/entities/virtual-thermostat-runtime.entity.js.map +1 -0
  605. package/dist/plugins/devices-virtual/entities/virtual-thermostat.entity.d.ts +86 -0
  606. package/dist/plugins/devices-virtual/entities/virtual-thermostat.entity.js +337 -0
  607. package/dist/plugins/devices-virtual/entities/virtual-thermostat.entity.js.map +1 -0
  608. package/dist/plugins/devices-virtual/entities/virtual-transform.entity.d.ts +23 -0
  609. package/dist/plugins/devices-virtual/entities/virtual-transform.entity.js +101 -0
  610. package/dist/plugins/devices-virtual/entities/virtual-transform.entity.js.map +1 -0
  611. package/dist/plugins/devices-virtual/listeners/virtual-device-information.listener.d.ts +5 -0
  612. package/dist/plugins/devices-virtual/listeners/virtual-device-information.listener.js +65 -22
  613. package/dist/plugins/devices-virtual/listeners/virtual-device-information.listener.js.map +1 -1
  614. package/dist/plugins/devices-virtual/listeners/virtual-index-maintenance.listener.d.ts +8 -1
  615. package/dist/plugins/devices-virtual/listeners/virtual-index-maintenance.listener.js +123 -32
  616. package/dist/plugins/devices-virtual/listeners/virtual-index-maintenance.listener.js.map +1 -1
  617. package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.d.ts +3 -0
  618. package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.js +41 -3
  619. package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.js.map +1 -1
  620. package/dist/plugins/devices-virtual/listeners/virtual-status.listener.js +28 -15
  621. package/dist/plugins/devices-virtual/listeners/virtual-status.listener.js.map +1 -1
  622. package/dist/plugins/devices-virtual/models/dew-point-response.model.d.ts +38 -0
  623. package/dist/plugins/devices-virtual/models/dew-point-response.model.js +193 -0
  624. package/dist/plugins/devices-virtual/models/dew-point-response.model.js.map +1 -0
  625. package/dist/plugins/devices-virtual/models/group-catalog.model.d.ts +26 -0
  626. package/dist/plugins/devices-virtual/models/group-catalog.model.js +117 -0
  627. package/dist/plugins/devices-virtual/models/group-catalog.model.js.map +1 -0
  628. package/dist/plugins/devices-virtual/models/light-group-draft.model.d.ts +28 -0
  629. package/dist/plugins/devices-virtual/models/light-group-draft.model.js +122 -0
  630. package/dist/plugins/devices-virtual/models/light-group-draft.model.js.map +1 -0
  631. package/dist/plugins/devices-virtual/models/measurement-authoring-response.model.d.ts +26 -0
  632. package/dist/plugins/devices-virtual/models/measurement-authoring-response.model.js +125 -0
  633. package/dist/plugins/devices-virtual/models/measurement-authoring-response.model.js.map +1 -0
  634. package/dist/plugins/devices-virtual/models/native-thermostat-response.model.d.ts +84 -0
  635. package/dist/plugins/devices-virtual/models/native-thermostat-response.model.js +406 -0
  636. package/dist/plugins/devices-virtual/models/native-thermostat-response.model.js.map +1 -0
  637. package/dist/plugins/devices-virtual/models/numeric-operator.model.d.ts +23 -0
  638. package/dist/plugins/devices-virtual/models/numeric-operator.model.js +120 -0
  639. package/dist/plugins/devices-virtual/models/numeric-operator.model.js.map +1 -0
  640. package/dist/plugins/devices-virtual/models/producer-response.model.d.ts +138 -0
  641. package/dist/plugins/devices-virtual/models/producer-response.model.js +764 -0
  642. package/dist/plugins/devices-virtual/models/producer-response.model.js.map +1 -0
  643. package/dist/plugins/devices-virtual/models/thermostat-authoring-context.model.d.ts +22 -0
  644. package/dist/plugins/devices-virtual/models/thermostat-authoring-context.model.js +134 -0
  645. package/dist/plugins/devices-virtual/models/thermostat-authoring-context.model.js.map +1 -0
  646. package/dist/plugins/devices-virtual/models/thermostat-authoring-response.model.d.ts +18 -0
  647. package/dist/plugins/devices-virtual/models/thermostat-authoring-response.model.js +87 -0
  648. package/dist/plugins/devices-virtual/models/thermostat-authoring-response.model.js.map +1 -0
  649. package/dist/plugins/devices-virtual/models/thermostat-comfort-response.model.d.ts +60 -0
  650. package/dist/plugins/devices-virtual/models/thermostat-comfort-response.model.js +341 -0
  651. package/dist/plugins/devices-virtual/models/thermostat-comfort-response.model.js.map +1 -0
  652. package/dist/plugins/devices-virtual/models/thermostat-installation-response.model.d.ts +84 -0
  653. package/dist/plugins/devices-virtual/models/thermostat-installation-response.model.js +440 -0
  654. package/dist/plugins/devices-virtual/models/thermostat-installation-response.model.js.map +1 -0
  655. package/dist/plugins/devices-virtual/models/thermostat-response.model.d.ts +218 -0
  656. package/dist/plugins/devices-virtual/models/thermostat-response.model.js +1157 -0
  657. package/dist/plugins/devices-virtual/models/thermostat-response.model.js.map +1 -0
  658. package/dist/plugins/devices-virtual/models/transform-response.model.d.ts +73 -0
  659. package/dist/plugins/devices-virtual/models/transform-response.model.js +386 -0
  660. package/dist/plugins/devices-virtual/models/transform-response.model.js.map +1 -0
  661. package/dist/plugins/devices-virtual/platforms/virtual-device.platform.d.ts +5 -1
  662. package/dist/plugins/devices-virtual/platforms/virtual-device.platform.js +22 -3
  663. package/dist/plugins/devices-virtual/platforms/virtual-device.platform.js.map +1 -1
  664. package/dist/plugins/devices-virtual/services/native-thermostat.service.d.ts +72 -0
  665. package/dist/plugins/devices-virtual/services/native-thermostat.service.js +932 -0
  666. package/dist/plugins/devices-virtual/services/native-thermostat.service.js.map +1 -0
  667. package/dist/plugins/devices-virtual/services/thermostat-authoring-context.service.d.ts +14 -0
  668. package/dist/plugins/devices-virtual/services/thermostat-authoring-context.service.js +147 -0
  669. package/dist/plugins/devices-virtual/services/thermostat-authoring-context.service.js.map +1 -0
  670. package/dist/plugins/devices-virtual/services/thermostat-comfort-selection.d.ts +199 -0
  671. package/dist/plugins/devices-virtual/services/thermostat-comfort-selection.js +1064 -0
  672. package/dist/plugins/devices-virtual/services/thermostat-comfort-selection.js.map +1 -0
  673. package/dist/plugins/devices-virtual/services/thermostat-controller-mutation.d.ts +75 -0
  674. package/dist/plugins/devices-virtual/services/thermostat-controller-mutation.js +445 -0
  675. package/dist/plugins/devices-virtual/services/thermostat-controller-mutation.js.map +1 -0
  676. package/dist/plugins/devices-virtual/services/thermostat-cooling-dependency.service.d.ts +53 -0
  677. package/dist/plugins/devices-virtual/services/thermostat-cooling-dependency.service.js +267 -0
  678. package/dist/plugins/devices-virtual/services/thermostat-cooling-dependency.service.js.map +1 -0
  679. package/dist/plugins/devices-virtual/services/thermostat-creation-catalog.d.ts +56 -0
  680. package/dist/plugins/devices-virtual/services/thermostat-creation-catalog.js +438 -0
  681. package/dist/plugins/devices-virtual/services/thermostat-creation-catalog.js.map +1 -0
  682. package/dist/plugins/devices-virtual/services/thermostat-creation-response.d.ts +37 -0
  683. package/dist/plugins/devices-virtual/services/thermostat-creation-response.js +430 -0
  684. package/dist/plugins/devices-virtual/services/thermostat-creation-response.js.map +1 -0
  685. package/dist/plugins/devices-virtual/services/thermostat-installation-artifact.d.ts +13 -0
  686. package/dist/plugins/devices-virtual/services/thermostat-installation-artifact.js +263 -0
  687. package/dist/plugins/devices-virtual/services/thermostat-installation-artifact.js.map +1 -0
  688. package/dist/plugins/devices-virtual/services/thermostat-installation-bindings.service.d.ts +10 -0
  689. package/dist/plugins/devices-virtual/services/thermostat-installation-bindings.service.js +238 -0
  690. package/dist/plugins/devices-virtual/services/thermostat-installation-bindings.service.js.map +1 -0
  691. package/dist/plugins/devices-virtual/services/thermostat-installation-loader.service.d.ts +41 -0
  692. package/dist/plugins/devices-virtual/services/thermostat-installation-loader.service.js +350 -0
  693. package/dist/plugins/devices-virtual/services/thermostat-installation-loader.service.js.map +1 -0
  694. package/dist/plugins/devices-virtual/services/thermostat-installation.service.d.ts +40 -0
  695. package/dist/plugins/devices-virtual/services/thermostat-installation.service.js +263 -0
  696. package/dist/plugins/devices-virtual/services/thermostat-installation.service.js.map +1 -0
  697. package/dist/plugins/devices-virtual/services/thermostat-installation.types.d.ts +72 -0
  698. package/dist/plugins/devices-virtual/services/thermostat-installation.types.js +13 -0
  699. package/dist/plugins/devices-virtual/services/thermostat-installation.types.js.map +1 -0
  700. package/dist/plugins/devices-virtual/services/thermostat-member-protection.service.d.ts +45 -0
  701. package/dist/plugins/devices-virtual/services/thermostat-member-protection.service.js +235 -0
  702. package/dist/plugins/devices-virtual/services/thermostat-member-protection.service.js.map +1 -0
  703. package/dist/plugins/devices-virtual/services/thermostat-override-clock.sql.d.ts +1 -0
  704. package/dist/plugins/devices-virtual/services/thermostat-override-clock.sql.js +16 -0
  705. package/dist/plugins/devices-virtual/services/thermostat-override-clock.sql.js.map +1 -0
  706. package/dist/plugins/devices-virtual/services/thermostat-protection-source.utils.d.ts +27 -0
  707. package/dist/plugins/devices-virtual/services/thermostat-protection-source.utils.js +132 -0
  708. package/dist/plugins/devices-virtual/services/thermostat-protection-source.utils.js.map +1 -0
  709. package/dist/plugins/devices-virtual/services/thermostat-remote-cooling-adapter.d.ts +88 -0
  710. package/dist/plugins/devices-virtual/services/thermostat-remote-cooling-adapter.js +200 -0
  711. package/dist/plugins/devices-virtual/services/thermostat-remote-cooling-adapter.js.map +1 -0
  712. package/dist/plugins/devices-virtual/services/virtual-aggregate-evaluator.d.ts +35 -0
  713. package/dist/plugins/devices-virtual/services/virtual-aggregate-evaluator.js +200 -0
  714. package/dist/plugins/devices-virtual/services/virtual-aggregate-evaluator.js.map +1 -0
  715. package/dist/plugins/devices-virtual/services/virtual-aggregate-policy.utils.d.ts +5 -0
  716. package/dist/plugins/devices-virtual/services/virtual-aggregate-policy.utils.js +18 -0
  717. package/dist/plugins/devices-virtual/services/virtual-aggregate-policy.utils.js.map +1 -0
  718. package/dist/plugins/devices-virtual/services/virtual-aggregate-runtime.service.d.ts +48 -0
  719. package/dist/plugins/devices-virtual/services/virtual-aggregate-runtime.service.js +425 -0
  720. package/dist/plugins/devices-virtual/services/virtual-aggregate-runtime.service.js.map +1 -0
  721. package/dist/plugins/devices-virtual/services/virtual-cooling-policy.utils.d.ts +13 -0
  722. package/dist/plugins/devices-virtual/services/virtual-cooling-policy.utils.js +38 -0
  723. package/dist/plugins/devices-virtual/services/virtual-cooling-policy.utils.js.map +1 -0
  724. package/dist/plugins/devices-virtual/services/virtual-cover-contract.utils.d.ts +7 -0
  725. package/dist/plugins/devices-virtual/services/virtual-cover-contract.utils.js +41 -0
  726. package/dist/plugins/devices-virtual/services/virtual-cover-contract.utils.js.map +1 -0
  727. package/dist/plugins/devices-virtual/services/virtual-cover-readiness.utils.d.ts +16 -0
  728. package/dist/plugins/devices-virtual/services/virtual-cover-readiness.utils.js +42 -0
  729. package/dist/plugins/devices-virtual/services/virtual-cover-readiness.utils.js.map +1 -0
  730. package/dist/plugins/devices-virtual/services/virtual-dependency-graph.service.d.ts +118 -0
  731. package/dist/plugins/devices-virtual/services/virtual-dependency-graph.service.js +667 -0
  732. package/dist/plugins/devices-virtual/services/virtual-dependency-graph.service.js.map +1 -0
  733. package/dist/plugins/devices-virtual/services/virtual-devices.service.d.ts +8 -4
  734. package/dist/plugins/devices-virtual/services/virtual-devices.service.js +105 -22
  735. package/dist/plugins/devices-virtual/services/virtual-devices.service.js.map +1 -1
  736. package/dist/plugins/devices-virtual/services/virtual-dew-point-config.service.d.ts +28 -0
  737. package/dist/plugins/devices-virtual/services/virtual-dew-point-config.service.js +193 -0
  738. package/dist/plugins/devices-virtual/services/virtual-dew-point-config.service.js.map +1 -0
  739. package/dist/plugins/devices-virtual/services/virtual-dew-point-contract.utils.d.ts +5 -0
  740. package/dist/plugins/devices-virtual/services/virtual-dew-point-contract.utils.js +69 -0
  741. package/dist/plugins/devices-virtual/services/virtual-dew-point-contract.utils.js.map +1 -0
  742. package/dist/plugins/devices-virtual/services/virtual-dew-point-runtime.service.d.ts +65 -0
  743. package/dist/plugins/devices-virtual/services/virtual-dew-point-runtime.service.js +524 -0
  744. package/dist/plugins/devices-virtual/services/virtual-dew-point-runtime.service.js.map +1 -0
  745. package/dist/plugins/devices-virtual/services/virtual-dew-point.utils.d.ts +9 -0
  746. package/dist/plugins/devices-virtual/services/virtual-dew-point.utils.js +25 -0
  747. package/dist/plugins/devices-virtual/services/virtual-dew-point.utils.js.map +1 -0
  748. package/dist/plugins/devices-virtual/services/virtual-group-catalog.service.d.ts +10 -0
  749. package/dist/plugins/devices-virtual/services/virtual-group-catalog.service.js +117 -0
  750. package/dist/plugins/devices-virtual/services/virtual-group-catalog.service.js.map +1 -0
  751. package/dist/plugins/devices-virtual/services/virtual-group-contract.utils.d.ts +4 -0
  752. package/dist/plugins/devices-virtual/services/virtual-group-contract.utils.js +35 -0
  753. package/dist/plugins/devices-virtual/services/virtual-group-contract.utils.js.map +1 -0
  754. package/dist/plugins/devices-virtual/services/virtual-group-field.utils.d.ts +10 -0
  755. package/dist/plugins/devices-virtual/services/virtual-group-field.utils.js +35 -0
  756. package/dist/plugins/devices-virtual/services/virtual-group-field.utils.js.map +1 -0
  757. package/dist/plugins/devices-virtual/services/virtual-group-profile.d.ts +19 -0
  758. package/dist/plugins/devices-virtual/services/virtual-group-profile.js +137 -0
  759. package/dist/plugins/devices-virtual/services/virtual-group-profile.js.map +1 -0
  760. package/dist/plugins/devices-virtual/services/virtual-light-group-authoring.service.d.ts +43 -0
  761. package/dist/plugins/devices-virtual/services/virtual-light-group-authoring.service.js +217 -0
  762. package/dist/plugins/devices-virtual/services/virtual-light-group-authoring.service.js.map +1 -0
  763. package/dist/plugins/devices-virtual/services/virtual-light-group-command.service.d.ts +28 -0
  764. package/dist/plugins/devices-virtual/services/virtual-light-group-command.service.js +262 -0
  765. package/dist/plugins/devices-virtual/services/virtual-light-group-command.service.js.map +1 -0
  766. package/dist/plugins/devices-virtual/services/virtual-light-group-contribution.service.d.ts +19 -0
  767. package/dist/plugins/devices-virtual/services/virtual-light-group-contribution.service.js +91 -0
  768. package/dist/plugins/devices-virtual/services/virtual-light-group-contribution.service.js.map +1 -0
  769. package/dist/plugins/devices-virtual/services/virtual-light-group-state.service.d.ts +37 -0
  770. package/dist/plugins/devices-virtual/services/virtual-light-group-state.service.js +346 -0
  771. package/dist/plugins/devices-virtual/services/virtual-light-group-state.service.js.map +1 -0
  772. package/dist/plugins/devices-virtual/services/virtual-light-group.utils.d.ts +46 -0
  773. package/dist/plugins/devices-virtual/services/virtual-light-group.utils.js +204 -0
  774. package/dist/plugins/devices-virtual/services/virtual-light-group.utils.js.map +1 -0
  775. package/dist/plugins/devices-virtual/services/virtual-measurement-authoring.service.d.ts +37 -0
  776. package/dist/plugins/devices-virtual/services/virtual-measurement-authoring.service.js +270 -0
  777. package/dist/plugins/devices-virtual/services/virtual-measurement-authoring.service.js.map +1 -0
  778. package/dist/plugins/devices-virtual/services/virtual-measurement-contribution.service.d.ts +21 -0
  779. package/dist/plugins/devices-virtual/services/virtual-measurement-contribution.service.js +166 -0
  780. package/dist/plugins/devices-virtual/services/virtual-measurement-contribution.service.js.map +1 -0
  781. package/dist/plugins/devices-virtual/services/virtual-measurement-metadata.utils.d.ts +3 -0
  782. package/dist/plugins/devices-virtual/services/virtual-measurement-metadata.utils.js +25 -0
  783. package/dist/plugins/devices-virtual/services/virtual-measurement-metadata.utils.js.map +1 -0
  784. package/dist/plugins/devices-virtual/services/virtual-numeric-operator-host.service.d.ts +24 -0
  785. package/dist/plugins/devices-virtual/services/virtual-numeric-operator-host.service.js +145 -0
  786. package/dist/plugins/devices-virtual/services/virtual-numeric-operator-host.service.js.map +1 -0
  787. package/dist/plugins/devices-virtual/services/virtual-numeric-operator.registry.d.ts +18 -0
  788. package/dist/plugins/devices-virtual/services/virtual-numeric-operator.registry.js +86 -0
  789. package/dist/plugins/devices-virtual/services/virtual-numeric-operator.registry.js.map +1 -0
  790. package/dist/plugins/devices-virtual/services/virtual-numeric-profile.utils.d.ts +29 -0
  791. package/dist/plugins/devices-virtual/services/virtual-numeric-profile.utils.js +136 -0
  792. package/dist/plugins/devices-virtual/services/virtual-numeric-profile.utils.js.map +1 -0
  793. package/dist/plugins/devices-virtual/services/virtual-numeric-transform.utils.d.ts +59 -0
  794. package/dist/plugins/devices-virtual/services/virtual-numeric-transform.utils.js +165 -0
  795. package/dist/plugins/devices-virtual/services/virtual-numeric-transform.utils.js.map +1 -0
  796. package/dist/plugins/devices-virtual/services/virtual-producer-config.service.d.ts +64 -0
  797. package/dist/plugins/devices-virtual/services/virtual-producer-config.service.js +694 -0
  798. package/dist/plugins/devices-virtual/services/virtual-producer-config.service.js.map +1 -0
  799. package/dist/plugins/devices-virtual/services/virtual-producer-state.service.d.ts +60 -0
  800. package/dist/plugins/devices-virtual/services/virtual-producer-state.service.js +484 -0
  801. package/dist/plugins/devices-virtual/services/virtual-producer-state.service.js.map +1 -0
  802. package/dist/plugins/devices-virtual/services/virtual-property-index.service.d.ts +11 -2
  803. package/dist/plugins/devices-virtual/services/virtual-property-index.service.js +166 -13
  804. package/dist/plugins/devices-virtual/services/virtual-property-index.service.js.map +1 -1
  805. package/dist/plugins/devices-virtual/services/virtual-source-eligibility.utils.d.ts +3 -0
  806. package/dist/plugins/devices-virtual/services/virtual-source-eligibility.utils.js +10 -0
  807. package/dist/plugins/devices-virtual/services/virtual-source-eligibility.utils.js.map +1 -0
  808. package/dist/plugins/devices-virtual/services/virtual-thermostat-authoring.service.d.ts +27 -0
  809. package/dist/plugins/devices-virtual/services/virtual-thermostat-authoring.service.js +385 -0
  810. package/dist/plugins/devices-virtual/services/virtual-thermostat-authoring.service.js.map +1 -0
  811. package/dist/plugins/devices-virtual/services/virtual-thermostat-automation.service.d.ts +90 -0
  812. package/dist/plugins/devices-virtual/services/virtual-thermostat-automation.service.js +1189 -0
  813. package/dist/plugins/devices-virtual/services/virtual-thermostat-automation.service.js.map +1 -0
  814. package/dist/plugins/devices-virtual/services/virtual-thermostat-branch.utils.d.ts +5 -0
  815. package/dist/plugins/devices-virtual/services/virtual-thermostat-branch.utils.js +29 -0
  816. package/dist/plugins/devices-virtual/services/virtual-thermostat-branch.utils.js.map +1 -0
  817. package/dist/plugins/devices-virtual/services/virtual-thermostat-claims.service.d.ts +80 -0
  818. package/dist/plugins/devices-virtual/services/virtual-thermostat-claims.service.js +489 -0
  819. package/dist/plugins/devices-virtual/services/virtual-thermostat-claims.service.js.map +1 -0
  820. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.service.d.ts +80 -0
  821. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.service.js +580 -0
  822. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.service.js.map +1 -0
  823. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.utils.d.ts +58 -0
  824. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.utils.js +106 -0
  825. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.utils.js.map +1 -0
  826. package/dist/plugins/devices-virtual/services/virtual-thermostat-config.service.d.ts +909 -0
  827. package/dist/plugins/devices-virtual/services/virtual-thermostat-config.service.js +1171 -0
  828. package/dist/plugins/devices-virtual/services/virtual-thermostat-config.service.js.map +1 -0
  829. package/dist/plugins/devices-virtual/services/virtual-thermostat-contract.utils.d.ts +5 -0
  830. package/dist/plugins/devices-virtual/services/virtual-thermostat-contract.utils.js +51 -0
  831. package/dist/plugins/devices-virtual/services/virtual-thermostat-contract.utils.js.map +1 -0
  832. package/dist/plugins/devices-virtual/services/virtual-thermostat-inputs.service.d.ts +46 -0
  833. package/dist/plugins/devices-virtual/services/virtual-thermostat-inputs.service.js +166 -0
  834. package/dist/plugins/devices-virtual/services/virtual-thermostat-inputs.service.js.map +1 -0
  835. package/dist/plugins/devices-virtual/services/virtual-thermostat-ownership.sql.d.ts +4 -0
  836. package/dist/plugins/devices-virtual/services/virtual-thermostat-ownership.sql.js +59 -0
  837. package/dist/plugins/devices-virtual/services/virtual-thermostat-ownership.sql.js.map +1 -0
  838. package/dist/plugins/devices-virtual/services/virtual-thermostat-policy.utils.d.ts +45 -0
  839. package/dist/plugins/devices-virtual/services/virtual-thermostat-policy.utils.js +149 -0
  840. package/dist/plugins/devices-virtual/services/virtual-thermostat-policy.utils.js.map +1 -0
  841. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime-ownership.d.ts +56 -0
  842. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime-ownership.js +680 -0
  843. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime-ownership.js.map +1 -0
  844. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime.service.d.ts +133 -0
  845. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime.service.js +1617 -0
  846. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime.service.js.map +1 -0
  847. package/dist/plugins/devices-virtual/services/virtual-thermostat-transport.service.d.ts +39 -0
  848. package/dist/plugins/devices-virtual/services/virtual-thermostat-transport.service.js +561 -0
  849. package/dist/plugins/devices-virtual/services/virtual-thermostat-transport.service.js.map +1 -0
  850. package/dist/plugins/devices-virtual/services/virtual-transform-config.service.d.ts +41 -0
  851. package/dist/plugins/devices-virtual/services/virtual-transform-config.service.js +209 -0
  852. package/dist/plugins/devices-virtual/services/virtual-transform-config.service.js.map +1 -0
  853. package/dist/plugins/devices-virtual/services/virtual-transform-contract.utils.d.ts +8 -0
  854. package/dist/plugins/devices-virtual/services/virtual-transform-contract.utils.js +103 -0
  855. package/dist/plugins/devices-virtual/services/virtual-transform-contract.utils.js.map +1 -0
  856. package/dist/plugins/devices-virtual/services/virtual-transform-preview.utils.d.ts +3 -0
  857. package/dist/plugins/devices-virtual/services/virtual-transform-preview.utils.js +18 -0
  858. package/dist/plugins/devices-virtual/services/virtual-transform-preview.utils.js.map +1 -0
  859. package/dist/plugins/devices-virtual/services/virtual-transform-resolver.d.ts +15 -0
  860. package/dist/plugins/devices-virtual/services/virtual-transform-resolver.js +102 -0
  861. package/dist/plugins/devices-virtual/services/virtual-transform-resolver.js.map +1 -0
  862. package/dist/plugins/devices-virtual/services/virtual-transform-runtime.service.d.ts +54 -0
  863. package/dist/plugins/devices-virtual/services/virtual-transform-runtime.service.js +470 -0
  864. package/dist/plugins/devices-virtual/services/virtual-transform-runtime.service.js.map +1 -0
  865. package/dist/plugins/devices-virtual/services/virtual-typed-group.utils.d.ts +6 -0
  866. package/dist/plugins/devices-virtual/services/virtual-typed-group.utils.js +100 -0
  867. package/dist/plugins/devices-virtual/services/virtual-typed-group.utils.js.map +1 -0
  868. package/dist/plugins/devices-virtual/services/virtual-value-source.service.d.ts +7 -0
  869. package/dist/plugins/devices-virtual/services/virtual-value-source.service.js +36 -2
  870. package/dist/plugins/devices-virtual/services/virtual-value-source.service.js.map +1 -1
  871. package/dist/plugins/devices-virtual/services/virtual-window-contact.utils.d.ts +17 -0
  872. package/dist/plugins/devices-virtual/services/virtual-window-contact.utils.js +52 -0
  873. package/dist/plugins/devices-virtual/services/virtual-window-contact.utils.js.map +1 -0
  874. package/dist/plugins/devices-virtual/services/virtual-window-trend.utils.d.ts +44 -0
  875. package/dist/plugins/devices-virtual/services/virtual-window-trend.utils.js +171 -0
  876. package/dist/plugins/devices-virtual/services/virtual-window-trend.utils.js.map +1 -0
  877. package/dist/plugins/devices-virtual/subscribers/virtual-thermostat-ownership.subscriber.d.ts +30 -0
  878. package/dist/plugins/devices-virtual/subscribers/virtual-thermostat-ownership.subscriber.js +195 -0
  879. package/dist/plugins/devices-virtual/subscribers/virtual-thermostat-ownership.subscriber.js.map +1 -0
  880. package/dist/plugins/devices-virtual/subscribers/virtual-transform-metadata.subscriber.d.ts +9 -0
  881. package/dist/plugins/devices-virtual/subscribers/virtual-transform-metadata.subscriber.js +58 -0
  882. package/dist/plugins/devices-virtual/subscribers/virtual-transform-metadata.subscriber.js.map +1 -0
  883. package/dist/plugins/devices-virtual/validators/category-allowed-constraint.validator.d.ts +1 -1
  884. package/dist/plugins/devices-virtual/validators/category-allowed-constraint.validator.js +6 -1
  885. package/dist/plugins/devices-virtual/validators/category-allowed-constraint.validator.js.map +1 -1
  886. package/dist/plugins/devices-wled/interfaces/wled.interface.d.ts +7 -0
  887. package/dist/plugins/devices-wled/interfaces/wled.interface.js.map +1 -1
  888. package/dist/plugins/devices-wled/platforms/wled.device.platform.d.ts +4 -2
  889. package/dist/plugins/devices-wled/platforms/wled.device.platform.js +56 -9
  890. package/dist/plugins/devices-wled/platforms/wled.device.platform.js.map +1 -1
  891. package/dist/plugins/devices-wled/services/device-mapper.service.d.ts +3 -2
  892. package/dist/plugins/devices-wled/services/device-mapper.service.js +48 -1
  893. package/dist/plugins/devices-wled/services/device-mapper.service.js.map +1 -1
  894. package/dist/plugins/devices-wled/services/wled-client-adapter.service.d.ts +6 -1
  895. package/dist/plugins/devices-wled/services/wled-client-adapter.service.js +101 -13
  896. package/dist/plugins/devices-wled/services/wled-client-adapter.service.js.map +1 -1
  897. package/dist/plugins/devices-wled/services/wled.service.js +5 -2
  898. package/dist/plugins/devices-wled/services/wled.service.js.map +1 -1
  899. package/dist/plugins/devices-zigbee2mqtt/contracts/sample-source.contract.d.ts +38 -0
  900. package/dist/plugins/devices-zigbee2mqtt/contracts/sample-source.contract.js +95 -0
  901. package/dist/plugins/devices-zigbee2mqtt/contracts/sample-source.contract.js.map +1 -0
  902. package/dist/plugins/devices-zigbee2mqtt/devices-zigbee2mqtt.plugin.js +11 -1
  903. package/dist/plugins/devices-zigbee2mqtt/devices-zigbee2mqtt.plugin.js.map +1 -1
  904. package/dist/plugins/devices-zigbee2mqtt/entities/zigbee-sample-source.entity.d.ts +18 -0
  905. package/dist/plugins/devices-zigbee2mqtt/entities/zigbee-sample-source.entity.js +79 -0
  906. package/dist/plugins/devices-zigbee2mqtt/entities/zigbee-sample-source.entity.js.map +1 -0
  907. package/dist/plugins/devices-zigbee2mqtt/interfaces/zigbee2mqtt.interface.d.ts +11 -0
  908. package/dist/plugins/devices-zigbee2mqtt/platforms/zigbee2mqtt.device.platform.d.ts +11 -2
  909. package/dist/plugins/devices-zigbee2mqtt/platforms/zigbee2mqtt.device.platform.js +100 -11
  910. package/dist/plugins/devices-zigbee2mqtt/platforms/zigbee2mqtt.device.platform.js.map +1 -1
  911. package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.d.ts +31 -13
  912. package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.js +166 -5
  913. package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.js.map +1 -1
  914. package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.d.ts +1 -0
  915. package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.js +44 -3
  916. package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.js.map +1 -1
  917. package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.d.ts +20 -3
  918. package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.js +156 -34
  919. package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.js.map +1 -1
  920. package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.d.ts +1 -1
  921. package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.js +14 -1
  922. package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.js.map +1 -1
  923. package/dist/plugins/devices-zigbee2mqtt/services/native-climate-adapter.service.d.ts +15 -0
  924. package/dist/plugins/devices-zigbee2mqtt/services/native-climate-adapter.service.js +249 -0
  925. package/dist/plugins/devices-zigbee2mqtt/services/native-climate-adapter.service.js.map +1 -0
  926. package/dist/plugins/devices-zigbee2mqtt/services/websocket-sample-evidence.d.ts +2 -0
  927. package/dist/plugins/devices-zigbee2mqtt/services/websocket-sample-evidence.js +15 -0
  928. package/dist/plugins/devices-zigbee2mqtt/services/websocket-sample-evidence.js.map +1 -0
  929. package/dist/plugins/devices-zigbee2mqtt/services/ws-client-adapter.service.d.ts +7 -1
  930. package/dist/plugins/devices-zigbee2mqtt/services/ws-client-adapter.service.js +45 -2
  931. package/dist/plugins/devices-zigbee2mqtt/services/ws-client-adapter.service.js.map +1 -1
  932. package/dist/plugins/devices-zigbee2mqtt/services/zigbee-sample-sources.service.d.ts +49 -0
  933. package/dist/plugins/devices-zigbee2mqtt/services/zigbee-sample-sources.service.js +264 -0
  934. package/dist/plugins/devices-zigbee2mqtt/services/zigbee-sample-sources.service.js.map +1 -0
  935. package/dist/plugins/devices-zigbee2mqtt/services/zigbee2mqtt.service.js +2 -0
  936. package/dist/plugins/devices-zigbee2mqtt/services/zigbee2mqtt.service.js.map +1 -1
  937. package/dist/plugins/scenes-local/platforms/local-scene.platform.d.ts +6 -3
  938. package/dist/plugins/scenes-local/platforms/local-scene.platform.js +101 -15
  939. package/dist/plugins/scenes-local/platforms/local-scene.platform.js.map +1 -1
  940. package/dist/plugins/spaces-home-control/activity/activity-actor.d.ts +2 -0
  941. package/dist/plugins/spaces-home-control/activity/activity-actor.js +14 -0
  942. package/dist/plugins/spaces-home-control/activity/activity-actor.js.map +1 -0
  943. package/dist/plugins/spaces-home-control/activity/activity-result.utils.d.ts +6 -0
  944. package/dist/plugins/spaces-home-control/activity/activity-result.utils.js +26 -0
  945. package/dist/plugins/spaces-home-control/activity/activity-result.utils.js.map +1 -0
  946. package/dist/plugins/spaces-home-control/activity/space-activity.constants.d.ts +32 -0
  947. package/dist/plugins/spaces-home-control/activity/space-activity.constants.js +40 -0
  948. package/dist/plugins/spaces-home-control/activity/space-activity.constants.js.map +1 -0
  949. package/dist/plugins/spaces-home-control/activity/space-activity.defaults.d.ts +3 -0
  950. package/dist/plugins/spaces-home-control/activity/space-activity.defaults.js +25 -0
  951. package/dist/plugins/spaces-home-control/activity/space-activity.defaults.js.map +1 -0
  952. package/dist/plugins/spaces-home-control/activity/validate-activity-configuration.d.ts +2 -0
  953. package/dist/plugins/spaces-home-control/activity/validate-activity-configuration.js +37 -0
  954. package/dist/plugins/spaces-home-control/activity/validate-activity-configuration.js.map +1 -0
  955. package/dist/plugins/spaces-home-control/controllers/space-mode-schedules.controller.d.ts +12 -0
  956. package/dist/plugins/spaces-home-control/controllers/space-mode-schedules.controller.js +97 -0
  957. package/dist/plugins/spaces-home-control/controllers/space-mode-schedules.controller.js.map +1 -0
  958. package/dist/plugins/spaces-home-control/controllers/space-modes.controller.d.ts +19 -0
  959. package/dist/plugins/spaces-home-control/controllers/space-modes.controller.js +220 -0
  960. package/dist/plugins/spaces-home-control/controllers/space-modes.controller.js.map +1 -0
  961. package/dist/plugins/spaces-home-control/controllers/space-occupancy.controller.d.ts +18 -0
  962. package/dist/plugins/spaces-home-control/controllers/space-occupancy.controller.js +147 -0
  963. package/dist/plugins/spaces-home-control/controllers/space-occupancy.controller.js.map +1 -0
  964. package/dist/plugins/spaces-home-control/controllers/spaces-domain.controller.js +4 -0
  965. package/dist/plugins/spaces-home-control/controllers/spaces-domain.controller.js.map +1 -1
  966. package/dist/plugins/spaces-home-control/dto/activity-mode.dto.d.ts +22 -0
  967. package/dist/plugins/spaces-home-control/dto/activity-mode.dto.js +119 -0
  968. package/dist/plugins/spaces-home-control/dto/activity-mode.dto.js.map +1 -0
  969. package/dist/plugins/spaces-home-control/dto/space-mode-schedule.dto.d.ts +18 -0
  970. package/dist/plugins/spaces-home-control/dto/space-mode-schedule.dto.js +127 -0
  971. package/dist/plugins/spaces-home-control/dto/space-mode-schedule.dto.js.map +1 -0
  972. package/dist/plugins/spaces-home-control/dto/space-occupancy.dto.d.ts +13 -0
  973. package/dist/plugins/spaces-home-control/dto/space-occupancy.dto.js +99 -0
  974. package/dist/plugins/spaces-home-control/dto/space-occupancy.dto.js.map +1 -0
  975. package/dist/plugins/spaces-home-control/entities/space-activity-config.entity.d.ts +12 -0
  976. package/dist/plugins/spaces-home-control/entities/space-activity-config.entity.js +72 -0
  977. package/dist/plugins/spaces-home-control/entities/space-activity-config.entity.js.map +1 -0
  978. package/dist/plugins/spaces-home-control/entities/space-activity-state.entity.d.ts +14 -0
  979. package/dist/plugins/spaces-home-control/entities/space-activity-state.entity.js +105 -0
  980. package/dist/plugins/spaces-home-control/entities/space-activity-state.entity.js.map +1 -0
  981. package/dist/plugins/spaces-home-control/entities/space-mode-schedule.entity.d.ts +19 -0
  982. package/dist/plugins/spaces-home-control/entities/space-mode-schedule.entity.js +110 -0
  983. package/dist/plugins/spaces-home-control/entities/space-mode-schedule.entity.js.map +1 -0
  984. package/dist/plugins/spaces-home-control/entities/space-occupancy.entity.d.ts +23 -0
  985. package/dist/plugins/spaces-home-control/entities/space-occupancy.entity.js +135 -0
  986. package/dist/plugins/spaces-home-control/entities/space-occupancy.entity.js.map +1 -0
  987. package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.d.ts +2 -0
  988. package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.js +23 -0
  989. package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.js.map +1 -1
  990. package/dist/plugins/spaces-home-control/listeners/websocket-exchange.listener.js +3 -0
  991. package/dist/plugins/spaces-home-control/listeners/websocket-exchange.listener.js.map +1 -1
  992. package/dist/plugins/spaces-home-control/models/activity-configuration.model.d.ts +27 -0
  993. package/dist/plugins/spaces-home-control/models/activity-configuration.model.js +182 -0
  994. package/dist/plugins/spaces-home-control/models/activity-configuration.model.js.map +1 -0
  995. package/dist/plugins/spaces-home-control/models/activity-response.model.d.ts +16 -0
  996. package/dist/plugins/spaces-home-control/models/activity-response.model.js +79 -0
  997. package/dist/plugins/spaces-home-control/models/activity-response.model.js.map +1 -0
  998. package/dist/plugins/spaces-home-control/models/activity-result.model.d.ts +6 -0
  999. package/dist/plugins/spaces-home-control/models/activity-result.model.js +37 -0
  1000. package/dist/plugins/spaces-home-control/models/activity-result.model.js.map +1 -0
  1001. package/dist/plugins/spaces-home-control/models/climate-contribution.model.d.ts +11 -0
  1002. package/dist/plugins/spaces-home-control/models/climate-contribution.model.js +66 -0
  1003. package/dist/plugins/spaces-home-control/models/climate-contribution.model.js.map +1 -0
  1004. package/dist/plugins/spaces-home-control/models/space-mode-schedule-response.model.d.ts +9 -0
  1005. package/dist/plugins/spaces-home-control/models/space-mode-schedule-response.model.js +45 -0
  1006. package/dist/plugins/spaces-home-control/models/space-mode-schedule-response.model.js.map +1 -0
  1007. package/dist/plugins/spaces-home-control/models/space-mode-schedule.model.d.ts +34 -0
  1008. package/dist/plugins/spaces-home-control/models/space-mode-schedule.model.js +170 -0
  1009. package/dist/plugins/spaces-home-control/models/space-mode-schedule.model.js.map +1 -0
  1010. package/dist/plugins/spaces-home-control/models/space-occupancy.model.d.ts +26 -0
  1011. package/dist/plugins/spaces-home-control/models/space-occupancy.model.js +121 -0
  1012. package/dist/plugins/spaces-home-control/models/space-occupancy.model.js.map +1 -0
  1013. package/dist/plugins/spaces-home-control/models/spaces-response.model.d.ts +13 -0
  1014. package/dist/plugins/spaces-home-control/models/spaces-response.model.js +81 -2
  1015. package/dist/plugins/spaces-home-control/models/spaces-response.model.js.map +1 -1
  1016. package/dist/plugins/spaces-home-control/occupancy/occupancy-admission.d.ts +7 -0
  1017. package/dist/plugins/spaces-home-control/occupancy/occupancy-admission.js +57 -0
  1018. package/dist/plugins/spaces-home-control/occupancy/occupancy-admission.js.map +1 -0
  1019. package/dist/plugins/spaces-home-control/occupancy/space-occupancy.types.d.ts +31 -0
  1020. package/dist/plugins/spaces-home-control/occupancy/space-occupancy.types.js +30 -0
  1021. package/dist/plugins/spaces-home-control/occupancy/space-occupancy.types.js.map +1 -0
  1022. package/dist/plugins/spaces-home-control/schedule/schedule-time.d.ts +9 -0
  1023. package/dist/plugins/spaces-home-control/schedule/schedule-time.js +79 -0
  1024. package/dist/plugins/spaces-home-control/schedule/schedule-time.js.map +1 -0
  1025. package/dist/plugins/spaces-home-control/schedule/space-mode-schedule.types.d.ts +28 -0
  1026. package/dist/plugins/spaces-home-control/schedule/space-mode-schedule.types.js +7 -0
  1027. package/dist/plugins/spaces-home-control/schedule/space-mode-schedule.types.js.map +1 -0
  1028. package/dist/plugins/spaces-home-control/services/activity-test-support.d.ts +16 -0
  1029. package/dist/plugins/spaces-home-control/services/activity-test-support.js +34 -0
  1030. package/dist/plugins/spaces-home-control/services/activity-test-support.js.map +1 -0
  1031. package/dist/plugins/spaces-home-control/services/climate-contribution-planner.service.d.ts +15 -0
  1032. package/dist/plugins/spaces-home-control/services/climate-contribution-planner.service.js +97 -0
  1033. package/dist/plugins/spaces-home-control/services/climate-contribution-planner.service.js.map +1 -0
  1034. package/dist/plugins/spaces-home-control/services/climate-intent.service.d.ts +15 -2
  1035. package/dist/plugins/spaces-home-control/services/climate-intent.service.js +155 -15
  1036. package/dist/plugins/spaces-home-control/services/climate-intent.service.js.map +1 -1
  1037. package/dist/plugins/spaces-home-control/services/cover-group-intent.port.d.ts +31 -0
  1038. package/dist/plugins/spaces-home-control/services/cover-group-intent.port.js +189 -0
  1039. package/dist/plugins/spaces-home-control/services/cover-group-intent.port.js.map +1 -0
  1040. package/dist/plugins/spaces-home-control/services/covers-intent.service.d.ts +8 -3
  1041. package/dist/plugins/spaces-home-control/services/covers-intent.service.js +139 -65
  1042. package/dist/plugins/spaces-home-control/services/covers-intent.service.js.map +1 -1
  1043. package/dist/plugins/spaces-home-control/services/lighting-contribution-planner.service.d.ts +16 -0
  1044. package/dist/plugins/spaces-home-control/services/lighting-contribution-planner.service.js +66 -0
  1045. package/dist/plugins/spaces-home-control/services/lighting-contribution-planner.service.js.map +1 -0
  1046. package/dist/plugins/spaces-home-control/services/lighting-intent.service.d.ts +13 -3
  1047. package/dist/plugins/spaces-home-control/services/lighting-intent.service.js +93 -13
  1048. package/dist/plugins/spaces-home-control/services/lighting-intent.service.js.map +1 -1
  1049. package/dist/plugins/spaces-home-control/services/space-activity-config.service.d.ts +25 -0
  1050. package/dist/plugins/spaces-home-control/services/space-activity-config.service.js +144 -0
  1051. package/dist/plugins/spaces-home-control/services/space-activity-config.service.js.map +1 -0
  1052. package/dist/plugins/spaces-home-control/services/space-activity-domains.service.d.ts +21 -0
  1053. package/dist/plugins/spaces-home-control/services/space-activity-domains.service.js +139 -0
  1054. package/dist/plugins/spaces-home-control/services/space-activity-domains.service.js.map +1 -0
  1055. package/dist/plugins/spaces-home-control/services/space-climate-automation.port.d.ts +17 -0
  1056. package/dist/plugins/spaces-home-control/services/space-climate-automation.port.js +5 -0
  1057. package/dist/plugins/spaces-home-control/services/space-climate-automation.port.js.map +1 -0
  1058. package/dist/plugins/spaces-home-control/services/space-climate-automation.service.d.ts +63 -0
  1059. package/dist/plugins/spaces-home-control/services/space-climate-automation.service.js +722 -0
  1060. package/dist/plugins/spaces-home-control/services/space-climate-automation.service.js.map +1 -0
  1061. package/dist/plugins/spaces-home-control/services/space-climate-state.service.d.ts +8 -3
  1062. package/dist/plugins/spaces-home-control/services/space-climate-state.service.js +25 -19
  1063. package/dist/plugins/spaces-home-control/services/space-climate-state.service.js.map +1 -1
  1064. package/dist/plugins/spaces-home-control/services/space-covers-state.service.d.ts +16 -2
  1065. package/dist/plugins/spaces-home-control/services/space-covers-state.service.js +102 -18
  1066. package/dist/plugins/spaces-home-control/services/space-covers-state.service.js.map +1 -1
  1067. package/dist/plugins/spaces-home-control/services/space-intent-base.service.d.ts +2 -0
  1068. package/dist/plugins/spaces-home-control/services/space-intent-base.service.js.map +1 -1
  1069. package/dist/plugins/spaces-home-control/services/space-lighting-state.service.d.ts +4 -1
  1070. package/dist/plugins/spaces-home-control/services/space-lighting-state.service.js +94 -24
  1071. package/dist/plugins/spaces-home-control/services/space-lighting-state.service.js.map +1 -1
  1072. package/dist/plugins/spaces-home-control/services/space-media-activity.service.d.ts +8 -2
  1073. package/dist/plugins/spaces-home-control/services/space-media-activity.service.js +79 -13
  1074. package/dist/plugins/spaces-home-control/services/space-media-activity.service.js.map +1 -1
  1075. package/dist/plugins/spaces-home-control/services/space-mode-schedule-config.service.d.ts +24 -0
  1076. package/dist/plugins/spaces-home-control/services/space-mode-schedule-config.service.js +132 -0
  1077. package/dist/plugins/spaces-home-control/services/space-mode-schedule-config.service.js.map +1 -0
  1078. package/dist/plugins/spaces-home-control/services/space-mode-scheduler.service.d.ts +39 -0
  1079. package/dist/plugins/spaces-home-control/services/space-mode-scheduler.service.js +289 -0
  1080. package/dist/plugins/spaces-home-control/services/space-mode-scheduler.service.js.map +1 -0
  1081. package/dist/plugins/spaces-home-control/services/space-mode.service.d.ts +34 -0
  1082. package/dist/plugins/spaces-home-control/services/space-mode.service.js +296 -0
  1083. package/dist/plugins/spaces-home-control/services/space-mode.service.js.map +1 -0
  1084. package/dist/plugins/spaces-home-control/services/space-occupancy-config.service.d.ts +26 -0
  1085. package/dist/plugins/spaces-home-control/services/space-occupancy-config.service.js +134 -0
  1086. package/dist/plugins/spaces-home-control/services/space-occupancy-config.service.js.map +1 -0
  1087. package/dist/plugins/spaces-home-control/services/space-occupancy-inputs.service.d.ts +21 -0
  1088. package/dist/plugins/spaces-home-control/services/space-occupancy-inputs.service.js +84 -0
  1089. package/dist/plugins/spaces-home-control/services/space-occupancy-inputs.service.js.map +1 -0
  1090. package/dist/plugins/spaces-home-control/services/space-occupancy.service.d.ts +48 -0
  1091. package/dist/plugins/spaces-home-control/services/space-occupancy.service.js +285 -0
  1092. package/dist/plugins/spaces-home-control/services/space-occupancy.service.js.map +1 -0
  1093. package/dist/plugins/spaces-home-control/services/space-state-read.service.d.ts +5 -1
  1094. package/dist/plugins/spaces-home-control/services/space-state-read.service.js +33 -7
  1095. package/dist/plugins/spaces-home-control/services/space-state-read.service.js.map +1 -1
  1096. package/dist/plugins/spaces-home-control/spaces-home-control.openapi.js +52 -0
  1097. package/dist/plugins/spaces-home-control/spaces-home-control.openapi.js.map +1 -1
  1098. package/dist/plugins/spaces-home-control/spaces-home-control.plugin.d.ts +5 -1
  1099. package/dist/plugins/spaces-home-control/spaces-home-control.plugin.js +57 -2
  1100. package/dist/plugins/spaces-home-control/spaces-home-control.plugin.js.map +1 -1
  1101. package/dist/spec/channels.d.ts +27 -4
  1102. package/dist/spec/channels.js +37 -6
  1103. package/dist/spec/channels.js.map +1 -1
  1104. package/dist/spec/devices.d.ts +20 -0
  1105. package/dist/spec/devices.js +20 -0
  1106. package/dist/spec/devices.js.map +1 -1
  1107. package/dist/tsconfig.build.tsbuildinfo +1 -1
  1108. 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