@routier/core 0.0.1-alpha.1 → 0.0.1-alpha.2

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 (331) hide show
  1. package/dist/assertions/index.d.ts +5 -0
  2. package/dist/assertions/index.js +131 -0
  3. package/dist/assertions/index.js.map +1 -0
  4. package/dist/codegen/SlotPath.d.ts +7 -0
  5. package/dist/codegen/blocks.d.ts +130 -0
  6. package/dist/codegen/handlers/CloneHandlerBuilder.d.ts +4 -0
  7. package/dist/codegen/handlers/CompareHandlerBuilder.d.ts +4 -0
  8. package/dist/codegen/handlers/DeserializeHandlerBuilder.d.ts +4 -0
  9. package/dist/codegen/handlers/EnableChangeTrackingHandlerBuilder.d.ts +4 -0
  10. package/dist/codegen/handlers/EnrichmentHandlerBuilder.d.ts +4 -0
  11. package/dist/codegen/handlers/FreezeHandlerBuilder.d.ts +4 -0
  12. package/dist/codegen/handlers/HashHandlerBuilder.d.ts +4 -0
  13. package/dist/codegen/handlers/HashTypeHandlerBuilder.d.ts +4 -0
  14. package/dist/codegen/handlers/IdSelectorHandlerBuilder.d.ts +4 -0
  15. package/dist/codegen/handlers/MergeHandlerBuilder.d.ts +4 -0
  16. package/dist/codegen/handlers/PrepareHandlerBuilder.d.ts +4 -0
  17. package/dist/codegen/handlers/SerializeHandlerBuilder.d.ts +4 -0
  18. package/dist/codegen/handlers/StripHandlerBuilder.d.ts +4 -0
  19. package/dist/codegen/handlers/clone/CloneObjectHandler.d.ts +6 -0
  20. package/dist/codegen/handlers/clone/CloneValueHandler.d.ts +6 -0
  21. package/dist/codegen/handlers/compare/CompareObjectHandler.d.ts +6 -0
  22. package/dist/codegen/handlers/compare/CompareValueHandler.d.ts +6 -0
  23. package/dist/codegen/handlers/deserialize/DeserializeComputedValueHandler.d.ts +6 -0
  24. package/dist/codegen/handlers/deserialize/DeserializeDateHandler.d.ts +9 -0
  25. package/dist/codegen/handlers/deserialize/DeserializeFunctionHandler.d.ts +6 -0
  26. package/dist/codegen/handlers/deserialize/DeserializeObjectHandler.d.ts +6 -0
  27. package/dist/codegen/handlers/deserialize/DeserializeValueHandler.d.ts +6 -0
  28. package/dist/codegen/handlers/enableChangeTracking/EnableChangeTrackingObjectHandler.d.ts +6 -0
  29. package/dist/codegen/handlers/enableChangeTracking/EnableChangeTrackingPrimitiveValueHandler.d.ts +6 -0
  30. package/dist/codegen/handlers/enrichment/EnrichmentComputedValueHandler.d.ts +6 -0
  31. package/dist/codegen/handlers/enrichment/EnrichmentDefaultFunctionHandler.d.ts +6 -0
  32. package/dist/codegen/handlers/enrichment/EnrichmentDefaultValueHandler.d.ts +6 -0
  33. package/dist/codegen/handlers/enrichment/EnrichmentFunctionHandler.d.ts +6 -0
  34. package/dist/codegen/handlers/enrichment/EnrichmentNullableObjectHandler.d.ts +6 -0
  35. package/dist/codegen/handlers/enrichment/EnrichmentObjectHandler.d.ts +6 -0
  36. package/dist/codegen/handlers/enrichment/EnrichmentObjectIdentityHandler.d.ts +6 -0
  37. package/dist/codegen/handlers/enrichment/EnrichmentPrimitiveHandler.d.ts +6 -0
  38. package/dist/codegen/handlers/enrichment/EnrichmentPrimitiveIdentityHandler.d.ts +6 -0
  39. package/dist/codegen/handlers/freeze/FreezeObjectHandler.d.ts +6 -0
  40. package/dist/codegen/handlers/freeze/FreezePrimitiveValueHandler.d.ts +6 -0
  41. package/dist/codegen/handlers/hash/HashComputedValueHandler.d.ts +6 -0
  42. package/dist/codegen/handlers/hash/HashDateHandler.d.ts +6 -0
  43. package/dist/codegen/handlers/hash/HashFunctionHandler.d.ts +6 -0
  44. package/dist/codegen/handlers/hash/HashIdentityHandler.d.ts +6 -0
  45. package/dist/codegen/handlers/hash/HashKeyHandler.d.ts +6 -0
  46. package/dist/codegen/handlers/hash/HashValueHandler.d.ts +6 -0
  47. package/dist/codegen/handlers/hashType/HashTypeValueHandler.d.ts +6 -0
  48. package/dist/codegen/handlers/idSelector/IdSelectorValueHandler.d.ts +6 -0
  49. package/{src/codegen/handlers/index.ts → dist/codegen/handlers/index.d.ts} +1 -1
  50. package/dist/codegen/handlers/merge/MergeComputedValueHandler.d.ts +6 -0
  51. package/dist/codegen/handlers/merge/MergeDefaultFunctionHandler.d.ts +6 -0
  52. package/dist/codegen/handlers/merge/MergeDefaultValueHandler.d.ts +6 -0
  53. package/dist/codegen/handlers/merge/MergeFunctionHandler.d.ts +6 -0
  54. package/dist/codegen/handlers/merge/MergePrimitiveHandler.d.ts +6 -0
  55. package/dist/codegen/handlers/prepare/PrepareComputedValueHandler.d.ts +6 -0
  56. package/dist/codegen/handlers/prepare/PrepareFunctionHandler.d.ts +6 -0
  57. package/dist/codegen/handlers/prepare/PrepareIdentityHandler.d.ts +6 -0
  58. package/dist/codegen/handlers/prepare/PrepareKeyHandler.d.ts +6 -0
  59. package/dist/codegen/handlers/prepare/PrepareObjectHandler.d.ts +6 -0
  60. package/dist/codegen/handlers/prepare/PrepareValueHandler.d.ts +6 -0
  61. package/dist/codegen/handlers/serialize/SerializeDateHandler.d.ts +9 -0
  62. package/dist/codegen/handlers/serialize/SerializeObjectHandler.d.ts +6 -0
  63. package/dist/codegen/handlers/serialize/SerializeValueHandler.d.ts +6 -0
  64. package/dist/codegen/handlers/strip/StripIdentityHandler.d.ts +6 -0
  65. package/dist/codegen/handlers/strip/StripKeyHandler.d.ts +6 -0
  66. package/dist/codegen/handlers/strip/StripObjectHandler.d.ts +6 -0
  67. package/dist/codegen/handlers/strip/StripValueHandler.d.ts +6 -0
  68. package/dist/codegen/handlers/types.d.ts +18 -0
  69. package/{src/codegen/index.ts → dist/codegen/index.d.ts} +1 -1
  70. package/dist/codegen/types.d.ts +9 -0
  71. package/dist/codegen/utils.d.ts +22 -0
  72. package/dist/collections/Changes.d.ts +51 -0
  73. package/dist/collections/Changes.test.d.ts +1 -0
  74. package/dist/collections/IdSet.d.ts +7 -0
  75. package/dist/collections/MemoryDataCollection.d.ts +22 -0
  76. package/dist/collections/MemoryDataCollection.test.d.ts +1 -0
  77. package/dist/collections/SchemaCollection.d.ts +8 -0
  78. package/dist/collections/TagCollection.d.ts +15 -0
  79. package/dist/collections/TagCollection.test.d.ts +1 -0
  80. package/{src/collections/index.ts → dist/collections/index.d.ts} +1 -1
  81. package/dist/collections/index.js +659 -0
  82. package/dist/collections/index.js.map +1 -0
  83. package/dist/errors/SchemaError.d.ts +3 -0
  84. package/dist/errors/index.d.ts +1 -0
  85. package/dist/errors/index.js +90 -0
  86. package/dist/errors/index.js.map +1 -0
  87. package/{src/expressions/index.ts → dist/expressions/index.d.ts} +1 -1
  88. package/{src/expressions/parser.ts → dist/expressions/index.js} +387 -205
  89. package/dist/expressions/index.js.map +1 -0
  90. package/dist/expressions/parser.d.ts +4 -0
  91. package/dist/expressions/parser.test.d.ts +1 -0
  92. package/{src/expressions/types.ts → dist/expressions/types.d.ts} +42 -99
  93. package/dist/expressions/utils.d.ts +10 -0
  94. package/dist/expressions/utils.test.d.ts +1 -0
  95. package/{src/index.ts → dist/index.d.ts} +1 -1
  96. package/dist/index.js +8434 -0
  97. package/dist/index.js.map +1 -0
  98. package/dist/performance/index.d.ts +5 -0
  99. package/dist/performance/index.js +65 -0
  100. package/dist/performance/index.js.map +1 -0
  101. package/dist/pipeline/SyncronousQueue.d.ts +7 -0
  102. package/dist/pipeline/SyncronousQueue.test.d.ts +1 -0
  103. package/dist/pipeline/TrampolinePipeline.d.ts +36 -0
  104. package/dist/pipeline/TrampolinePipeline.test.d.ts +1 -0
  105. package/dist/pipeline/index.d.ts +2 -0
  106. package/{src/pipeline/TrampolinePipeline.ts → dist/pipeline/index.js} +297 -140
  107. package/dist/pipeline/index.js.map +1 -0
  108. package/dist/plugins/EphemeralDataPlugin.d.ts +13 -0
  109. package/dist/plugins/capabilities/DbPluginCapability.d.ts +23 -0
  110. package/{src/plugins/capabilities/index.ts → dist/plugins/capabilities/index.d.ts} +1 -1
  111. package/dist/plugins/capabilities/logging/DbPluginLoggingCapability.d.ts +28 -0
  112. package/dist/plugins/capabilities/logging/index.d.ts +1 -0
  113. package/{src/plugins/index.ts → dist/plugins/index.d.ts} +1 -1
  114. package/dist/plugins/index.js +2328 -0
  115. package/dist/plugins/index.js.map +1 -0
  116. package/dist/plugins/query/Query.d.ts +13 -0
  117. package/dist/plugins/query/QueryOptionsCollection.d.ts +27 -0
  118. package/dist/plugins/query/QueryOptionsCollection.test.d.ts +1 -0
  119. package/{src/plugins/query/index.ts → dist/plugins/query/index.d.ts} +1 -1
  120. package/{src/plugins/query/types.ts → dist/plugins/query/types.d.ts} +29 -20
  121. package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +21 -0
  122. package/dist/plugins/replication/ReplicationDbPlugin.d.ts +21 -0
  123. package/{src/plugins/replication/index.ts → dist/plugins/replication/index.d.ts} +1 -1
  124. package/{src/plugins/replication/types.ts → dist/plugins/replication/types.d.ts} +1 -2
  125. package/dist/plugins/translators/DataTranslator.d.ts +18 -0
  126. package/dist/plugins/translators/JsonTranslator.d.ts +17 -0
  127. package/dist/plugins/translators/JsonTranslator.test.d.ts +1 -0
  128. package/dist/plugins/translators/SqlTranslator.d.ts +14 -0
  129. package/{src/plugins/translators/index.ts → dist/plugins/translators/index.d.ts} +1 -1
  130. package/{src/plugins/types.ts → dist/plugins/types.d.ts} +11 -26
  131. package/dist/results/Result.d.ts +29 -0
  132. package/{src/results/index.ts → dist/results/index.d.ts} +1 -1
  133. package/dist/results/index.js +192 -0
  134. package/dist/results/index.js.map +1 -0
  135. package/{src/results/types.ts → dist/results/types.d.ts} +18 -7
  136. package/dist/results/utils.d.ts +2 -0
  137. package/dist/schema/PropertyInfo.d.ts +132 -0
  138. package/dist/schema/PropertyInfo.test.d.ts +1 -0
  139. package/dist/schema/SchemaDefinition.d.ts +17 -0
  140. package/dist/schema/builder.d.ts +17 -0
  141. package/{src/schema/index.ts → dist/schema/index.d.ts} +1 -1
  142. package/dist/schema/index.js +4822 -0
  143. package/dist/schema/index.js.map +1 -0
  144. package/dist/schema/property/base/SchemaBase.d.ts +23 -0
  145. package/dist/schema/property/base/index.d.ts +1 -0
  146. package/dist/schema/property/modifiers/SchemaDefault.d.ts +13 -0
  147. package/dist/schema/property/modifiers/SchemaDeserialize.d.ts +11 -0
  148. package/dist/schema/property/modifiers/SchemaDistinct.d.ts +7 -0
  149. package/dist/schema/property/modifiers/SchemaFrom.d.ts +23 -0
  150. package/dist/schema/property/modifiers/SchemaIdentity.d.ts +7 -0
  151. package/dist/schema/property/modifiers/SchemaIndex.d.ts +23 -0
  152. package/dist/schema/property/modifiers/SchemaKey.d.ts +13 -0
  153. package/dist/schema/property/modifiers/SchemaNullable.d.ts +9 -0
  154. package/dist/schema/property/modifiers/SchemaOptional.d.ts +9 -0
  155. package/dist/schema/property/modifiers/SchemaReadonly.d.ts +15 -0
  156. package/dist/schema/property/modifiers/SchemaSerialize.d.ts +9 -0
  157. package/dist/schema/property/modifiers/SchemaTracked.d.ts +7 -0
  158. package/{src/schema/property/modifiers/index.ts → dist/schema/property/modifiers/index.d.ts} +1 -1
  159. package/dist/schema/property/types/SchemaArray.d.ts +23 -0
  160. package/dist/schema/property/types/SchemaBoolean.d.ts +27 -0
  161. package/dist/schema/property/types/SchemaDate.d.ts +27 -0
  162. package/dist/schema/property/types/SchemaNumber.d.ts +31 -0
  163. package/dist/schema/property/types/SchemaObject.d.ts +20 -0
  164. package/dist/schema/property/types/SchemaString.d.ts +31 -0
  165. package/{src/schema/property/types/index.ts → dist/schema/property/types/index.d.ts} +1 -1
  166. package/dist/schema/table/SchemaComputed.d.ts +10 -0
  167. package/dist/schema/table/SchemaFunction.d.ts +8 -0
  168. package/{src/schema/table/index.ts → dist/schema/table/index.d.ts} +1 -1
  169. package/{src/schema/types.ts → dist/schema/types.d.ts} +59 -99
  170. package/{src/types/index.ts → dist/types/index.d.ts} +1 -2
  171. package/dist/types/index.js +25 -0
  172. package/dist/types/index.js.map +1 -0
  173. package/dist/utilities/arrays.d.ts +1 -0
  174. package/dist/utilities/arrays.test.d.ts +1 -0
  175. package/dist/utilities/dates.d.ts +1 -0
  176. package/dist/utilities/dates.test.d.ts +1 -0
  177. package/dist/utilities/dbPluginEventUtils.d.ts +14 -0
  178. package/{src/utilities/index.ts → dist/utilities/index.d.ts} +1 -1
  179. package/dist/utilities/index.js +554 -0
  180. package/dist/utilities/index.js.map +1 -0
  181. package/dist/utilities/objects.d.ts +2 -0
  182. package/dist/utilities/queryOptionsCollection.d.ts +2 -0
  183. package/dist/utilities/replication.d.ts +3 -0
  184. package/dist/utilities/runtime.d.ts +1 -0
  185. package/dist/utilities/strings.d.ts +1 -0
  186. package/dist/utilities/types.d.ts +1 -0
  187. package/dist/utilities/uuid.d.ts +2 -0
  188. package/package.json +6 -1
  189. package/readme.md +95 -0
  190. package/CHANGELOG.md +0 -8
  191. package/rspack.config.mjs +0 -65
  192. package/src/assertions/index.ts +0 -37
  193. package/src/codegen/SlotPath.ts +0 -20
  194. package/src/codegen/blocks.ts +0 -578
  195. package/src/codegen/handlers/CloneHandlerBuilder.ts +0 -13
  196. package/src/codegen/handlers/CompareHandlerBuilder.ts +0 -13
  197. package/src/codegen/handlers/DeserializeHandlerBuilder.ts +0 -20
  198. package/src/codegen/handlers/EnableChangeTrackingHandlerBuilder.ts +0 -13
  199. package/src/codegen/handlers/EnrichmentHandlerBuilder.ts +0 -28
  200. package/src/codegen/handlers/FreezeHandlerBuilder.ts +0 -13
  201. package/src/codegen/handlers/HashHandlerBuilder.ts +0 -25
  202. package/src/codegen/handlers/HashTypeHandlerBuilder.ts +0 -11
  203. package/src/codegen/handlers/IdSelectorHandlerBuilder.ts +0 -10
  204. package/src/codegen/handlers/MergeHandlerBuilder.ts +0 -19
  205. package/src/codegen/handlers/PrepareHandlerBuilder.ts +0 -23
  206. package/src/codegen/handlers/SerializeHandlerBuilder.ts +0 -15
  207. package/src/codegen/handlers/StripHandlerBuilder.ts +0 -18
  208. package/src/codegen/handlers/clone/CloneObjectHandler.ts +0 -29
  209. package/src/codegen/handlers/clone/CloneValueHandler.ts +0 -33
  210. package/src/codegen/handlers/compare/CompareObjectHandler.ts +0 -15
  211. package/src/codegen/handlers/compare/CompareValueHandler.ts +0 -27
  212. package/src/codegen/handlers/deserialize/DeserializeComputedValueHandler.ts +0 -16
  213. package/src/codegen/handlers/deserialize/DeserializeDateHandler.ts +0 -45
  214. package/src/codegen/handlers/deserialize/DeserializeFunctionHandler.ts +0 -16
  215. package/src/codegen/handlers/deserialize/DeserializeObjectHandler.ts +0 -29
  216. package/src/codegen/handlers/deserialize/DeserializeValueHandler.ts +0 -33
  217. package/src/codegen/handlers/enableChangeTracking/EnableChangeTrackingObjectHandler.ts +0 -20
  218. package/src/codegen/handlers/enableChangeTracking/EnableChangeTrackingPrimitiveValueHandler.ts +0 -15
  219. package/src/codegen/handlers/enrichment/EnrichmentComputedValueHandler.ts +0 -37
  220. package/src/codegen/handlers/enrichment/EnrichmentDefaultFunctionHandler.ts +0 -50
  221. package/src/codegen/handlers/enrichment/EnrichmentDefaultValueHandler.ts +0 -18
  222. package/src/codegen/handlers/enrichment/EnrichmentFunctionHandler.ts +0 -38
  223. package/src/codegen/handlers/enrichment/EnrichmentNullableObjectHandler.ts +0 -44
  224. package/src/codegen/handlers/enrichment/EnrichmentObjectHandler.ts +0 -29
  225. package/src/codegen/handlers/enrichment/EnrichmentObjectIdentityHandler.ts +0 -16
  226. package/src/codegen/handlers/enrichment/EnrichmentPrimitiveHandler.ts +0 -13
  227. package/src/codegen/handlers/enrichment/EnrichmentPrimitiveIdentityHandler.ts +0 -21
  228. package/src/codegen/handlers/freeze/FreezeObjectHandler.ts +0 -20
  229. package/src/codegen/handlers/freeze/FreezePrimitiveValueHandler.ts +0 -15
  230. package/src/codegen/handlers/hash/HashComputedValueHandler.ts +0 -15
  231. package/src/codegen/handlers/hash/HashDateHandler.ts +0 -26
  232. package/src/codegen/handlers/hash/HashFunctionHandler.ts +0 -16
  233. package/src/codegen/handlers/hash/HashIdentityHandler.ts +0 -15
  234. package/src/codegen/handlers/hash/HashKeyHandler.ts +0 -26
  235. package/src/codegen/handlers/hash/HashValueHandler.ts +0 -26
  236. package/src/codegen/handlers/hashType/HashTypeValueHandler.ts +0 -20
  237. package/src/codegen/handlers/idSelector/IdSelectorValueHandler.ts +0 -28
  238. package/src/codegen/handlers/merge/MergeComputedValueHandler.ts +0 -37
  239. package/src/codegen/handlers/merge/MergeDefaultFunctionHandler.ts +0 -40
  240. package/src/codegen/handlers/merge/MergeDefaultValueHandler.ts +0 -32
  241. package/src/codegen/handlers/merge/MergeFunctionHandler.ts +0 -16
  242. package/src/codegen/handlers/merge/MergePrimitiveHandler.ts +0 -21
  243. package/src/codegen/handlers/prepare/PrepareComputedValueHandler.ts +0 -16
  244. package/src/codegen/handlers/prepare/PrepareFunctionHandler.ts +0 -16
  245. package/src/codegen/handlers/prepare/PrepareIdentityHandler.ts +0 -21
  246. package/src/codegen/handlers/prepare/PrepareKeyHandler.ts +0 -21
  247. package/src/codegen/handlers/prepare/PrepareObjectHandler.ts +0 -38
  248. package/src/codegen/handlers/prepare/PrepareValueHandler.ts +0 -36
  249. package/src/codegen/handlers/serialize/SerializeDateHandler.ts +0 -45
  250. package/src/codegen/handlers/serialize/SerializeObjectHandler.ts +0 -28
  251. package/src/codegen/handlers/serialize/SerializeValueHandler.ts +0 -33
  252. package/src/codegen/handlers/strip/StripIdentityHandler.ts +0 -15
  253. package/src/codegen/handlers/strip/StripKeyHandler.ts +0 -15
  254. package/src/codegen/handlers/strip/StripObjectHandler.ts +0 -35
  255. package/src/codegen/handlers/strip/StripValueHandler.ts +0 -36
  256. package/src/codegen/handlers/types.ts +0 -119
  257. package/src/codegen/types.ts +0 -2
  258. package/src/codegen/utils.ts +0 -74
  259. package/src/collections/Changes.test.ts +0 -337
  260. package/src/collections/Changes.ts +0 -177
  261. package/src/collections/IdSet.ts +0 -28
  262. package/src/collections/MemoryDataCollection.test.ts +0 -424
  263. package/src/collections/MemoryDataCollection.ts +0 -134
  264. package/src/collections/SchemaCollection.ts +0 -22
  265. package/src/collections/TagCollection.test.ts +0 -443
  266. package/src/collections/TagCollection.ts +0 -62
  267. package/src/errors/SchemaError.ts +0 -6
  268. package/src/errors/index.ts +0 -1
  269. package/src/expressions/parser.test.ts +0 -913
  270. package/src/expressions/utils.test.ts +0 -346
  271. package/src/expressions/utils.ts +0 -59
  272. package/src/performance/index.ts +0 -26
  273. package/src/pipeline/SyncronousQueue.test.ts +0 -269
  274. package/src/pipeline/SyncronousQueue.ts +0 -30
  275. package/src/pipeline/TrampolinePipeline.test.ts +0 -374
  276. package/src/pipeline/index.ts +0 -2
  277. package/src/plugins/EphemeralDataPlugin.ts +0 -132
  278. package/src/plugins/capabilities/DbPluginCapability.ts +0 -111
  279. package/src/plugins/capabilities/logging/DbPluginLoggingCapability.ts +0 -261
  280. package/src/plugins/capabilities/logging/index.ts +0 -1
  281. package/src/plugins/query/Query.ts +0 -67
  282. package/src/plugins/query/QueryOptionsCollection.test.ts +0 -86
  283. package/src/plugins/query/QueryOptionsCollection.ts +0 -154
  284. package/src/plugins/replication/OptimisticReplicationDbPlugin.ts +0 -202
  285. package/src/plugins/replication/ReplicationDbPlugin.ts +0 -137
  286. package/src/plugins/translators/DataTranslator.ts +0 -46
  287. package/src/plugins/translators/JsonTranslator.test.ts +0 -618
  288. package/src/plugins/translators/JsonTranslator.ts +0 -211
  289. package/src/plugins/translators/SqlTranslator.ts +0 -45
  290. package/src/results/Result.ts +0 -91
  291. package/src/results/utils.ts +0 -15
  292. package/src/schema/PropertyInfo.test.ts +0 -479
  293. package/src/schema/PropertyInfo.ts +0 -374
  294. package/src/schema/SchemaDefinition.ts +0 -626
  295. package/src/schema/builder.ts +0 -18
  296. package/src/schema/property/base/SchemaBase.ts +0 -49
  297. package/src/schema/property/base/index.ts +0 -1
  298. package/src/schema/property/modifiers/SchemaDefault.ts +0 -29
  299. package/src/schema/property/modifiers/SchemaDeserialize.ts +0 -23
  300. package/src/schema/property/modifiers/SchemaDistinct.ts +0 -14
  301. package/src/schema/property/modifiers/SchemaFrom.ts +0 -54
  302. package/src/schema/property/modifiers/SchemaIdentity.ts +0 -13
  303. package/src/schema/property/modifiers/SchemaIndex.ts +0 -60
  304. package/src/schema/property/modifiers/SchemaKey.ts +0 -28
  305. package/src/schema/property/modifiers/SchemaNullable.ts +0 -18
  306. package/src/schema/property/modifiers/SchemaOptional.ts +0 -19
  307. package/src/schema/property/modifiers/SchemaReadonly.ts +0 -34
  308. package/src/schema/property/modifiers/SchemaSerialize.ts +0 -18
  309. package/src/schema/property/modifiers/SchemaTracked.ts +0 -14
  310. package/src/schema/property/types/SchemaArray.ts +0 -50
  311. package/src/schema/property/types/SchemaBoolean.ts +0 -59
  312. package/src/schema/property/types/SchemaDate.ts +0 -58
  313. package/src/schema/property/types/SchemaNumber.ts +0 -69
  314. package/src/schema/property/types/SchemaObject.ts +0 -44
  315. package/src/schema/property/types/SchemaString.ts +0 -69
  316. package/src/schema/table/SchemaComputed.ts +0 -20
  317. package/src/schema/table/SchemaFunction.ts +0 -15
  318. package/src/utilities/arrays.test.ts +0 -312
  319. package/src/utilities/arrays.ts +0 -12
  320. package/src/utilities/dates.test.ts +0 -388
  321. package/src/utilities/dates.ts +0 -11
  322. package/src/utilities/dbPluginEventUtils.ts +0 -44
  323. package/src/utilities/objects.ts +0 -7
  324. package/src/utilities/queryOptionsCollection.ts +0 -16
  325. package/src/utilities/replication.ts +0 -23
  326. package/src/utilities/runtime.ts +0 -3
  327. package/src/utilities/strings.ts +0 -18
  328. package/src/utilities/types.ts +0 -1
  329. package/src/utilities/uuid.ts +0 -56
  330. package/tsconfig.json +0 -28
  331. package/vitest.config.ts +0 -11
@@ -0,0 +1,2328 @@
1
+ var __webpack_modules__ = ({
2
+ "./src/assertions/index.ts":
3
+ /*!*********************************!*\
4
+ !*** ./src/assertions/index.ts ***!
5
+ \*********************************/
6
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.r(__webpack_exports__);
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ assertDate: () => (assertDate),
10
+ assertInstanceOf: () => (assertInstanceOf),
11
+ assertIsArray: () => (assertIsArray),
12
+ assertIsNotNull: () => (assertIsNotNull),
13
+ assertString: () => (assertString)
14
+ });
15
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utilities */ "./src/utilities/dates.ts");
16
+
17
+ function assertDate(data) {
18
+ if ((0,_utilities__WEBPACK_IMPORTED_MODULE_0__.isDate)(data) === false) {
19
+ throw new TypeError('Value is not a Date');
20
+ }
21
+ }
22
+ function assertIsNotNull(data, message) {
23
+ if (data == null) {
24
+ throw new TypeError(message ?? 'Assertion failed, data is null');
25
+ }
26
+ }
27
+ function assertIsArray(data, message) {
28
+ if (!Array.isArray(data)) {
29
+ throw new TypeError(message ?? 'Assertion failed, data is not of type Array');
30
+ }
31
+ }
32
+ function assertString(data, message) {
33
+ if (typeof data !== "string") {
34
+ throw new TypeError(message ?? 'Assertion failed, data is not of type String');
35
+ }
36
+ }
37
+ function assertInstanceOf(value, Instance) {
38
+ if (value instanceof Instance) {
39
+ return;
40
+ }
41
+ if (value != null && typeof value === "object" && "constructor" in value) {
42
+ throw new TypeError(`Value is not instance of type. Type: ${value.constructor.name}`);
43
+ }
44
+ throw new TypeError(`Value is not instance of type`);
45
+ }
46
+
47
+
48
+ }),
49
+ "./src/collections/Changes.ts":
50
+ /*!************************************!*\
51
+ !*** ./src/collections/Changes.ts ***!
52
+ \************************************/
53
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
54
+ __webpack_require__.r(__webpack_exports__);
55
+ __webpack_require__.d(__webpack_exports__, {
56
+ BulkPersistChanges: () => (BulkPersistChanges),
57
+ BulkPersistResult: () => (BulkPersistResult),
58
+ SchemaPersistChanges: () => (SchemaPersistChanges),
59
+ SchemaPersistResult: () => (SchemaPersistResult)
60
+ });
61
+ /* ESM import */var _TagCollection__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagCollection */ "./src/collections/TagCollection.ts");
62
+
63
+ class BulkPersistResult extends Map {
64
+ resolve(schemaId) {
65
+ if (this.has(schemaId)) {
66
+ return this.get(schemaId);
67
+ }
68
+ this.set(schemaId, new SchemaPersistResult());
69
+ return this.get(schemaId);
70
+ }
71
+ get(schemaId) {
72
+ return super.get(schemaId);
73
+ }
74
+ get aggregate() {
75
+ return {
76
+ size: this.aggregateSize,
77
+ adds: this.aggregateAddsSize,
78
+ updates: this.aggregateUpdatesSize,
79
+ removes: this.aggregateRemovesSize
80
+ };
81
+ }
82
+ get aggregateSize() {
83
+ let count = 0;
84
+ for (const [, result] of this) {
85
+ count += result.total;
86
+ }
87
+ return count;
88
+ }
89
+ get aggregateAddsSize() {
90
+ let count = 0;
91
+ for (const [, result] of this) {
92
+ count += result.adds.length;
93
+ }
94
+ return count;
95
+ }
96
+ get aggregateUpdatesSize() {
97
+ let count = 0;
98
+ for (const [, result] of this) {
99
+ count += result.updates.length;
100
+ }
101
+ return count;
102
+ }
103
+ get aggregateRemovesSize() {
104
+ let count = 0;
105
+ for (const [, result] of this) {
106
+ count += result.removes.length;
107
+ }
108
+ return count;
109
+ }
110
+ }
111
+ class BulkPersistChanges extends Map {
112
+ resolve(schemaId) {
113
+ if (this.has(schemaId)) {
114
+ return this.get(schemaId);
115
+ }
116
+ this.set(schemaId, new SchemaPersistChanges());
117
+ return this.get(schemaId);
118
+ }
119
+ get(schemaId) {
120
+ return super.get(schemaId);
121
+ }
122
+ get aggregate() {
123
+ return {
124
+ size: this.aggregateSize,
125
+ adds: this.aggregateAddsSize,
126
+ updates: this.aggregateUpdatesSize,
127
+ removes: this.aggregateRemovesSize
128
+ };
129
+ }
130
+ get aggregateSize() {
131
+ let count = 0;
132
+ for (const [, result] of this) {
133
+ count += result.total;
134
+ }
135
+ return count;
136
+ }
137
+ get aggregateAddsSize() {
138
+ let count = 0;
139
+ for (const [, result] of this) {
140
+ count += result.adds.length;
141
+ }
142
+ return count;
143
+ }
144
+ get aggregateUpdatesSize() {
145
+ let count = 0;
146
+ for (const [, result] of this) {
147
+ count += result.updates.length;
148
+ }
149
+ return count;
150
+ }
151
+ get aggregateRemovesSize() {
152
+ let count = 0;
153
+ for (const [, result] of this) {
154
+ count += result.removes.length;
155
+ }
156
+ return count;
157
+ }
158
+ /**
159
+ * Ensures the result has the same result sets as the change sets
160
+ * @returns
161
+ */
162
+ toResult() {
163
+ const result = new BulkPersistResult();
164
+ for (const [schemaId] of this) {
165
+ result.set(schemaId, new SchemaPersistResult());
166
+ }
167
+ return result;
168
+ }
169
+ }
170
+ class SchemaPersistChanges {
171
+ adds = [];
172
+ updates = [];
173
+ removes = [];
174
+ tags = new _TagCollection__WEBPACK_IMPORTED_MODULE_0__.TagCollection();
175
+ get hasItems() {
176
+ return this.total > 0;
177
+ }
178
+ get total() {
179
+ return this.adds.length + this.updates.length + this.removes.length;
180
+ }
181
+ }
182
+ class SchemaPersistResult {
183
+ adds = [];
184
+ updates = [];
185
+ removes = [];
186
+ get hasItems() {
187
+ return this.total > 0;
188
+ }
189
+ get total() {
190
+ return this.adds.length + this.updates.length + this.removes.length;
191
+ }
192
+ }
193
+
194
+
195
+ }),
196
+ "./src/collections/TagCollection.ts":
197
+ /*!******************************************!*\
198
+ !*** ./src/collections/TagCollection.ts ***!
199
+ \******************************************/
200
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
201
+ __webpack_require__.r(__webpack_exports__);
202
+ __webpack_require__.d(__webpack_exports__, {
203
+ TagCollection: () => (TagCollection)
204
+ });
205
+ class TagCollection {
206
+ data = new Map();
207
+ _size = 0;
208
+ get size() {
209
+ return this._size;
210
+ }
211
+ get(key) {
212
+ return this.data.get(key);
213
+ }
214
+ has(key) {
215
+ return this.data.has(key);
216
+ }
217
+ set(key, tag) {
218
+ this._size++;
219
+ return this.data.set(key, tag);
220
+ }
221
+ delete(key) {
222
+ const result = this.data.delete(key);
223
+ if (result) {
224
+ this._size--;
225
+ }
226
+ return result;
227
+ }
228
+ setMany(keys, tag) {
229
+ this._size += keys.length;
230
+ for (let i = 0, length = keys.length; i < length; i++) {
231
+ const key = keys[i];
232
+ this.set(key, tag);
233
+ }
234
+ }
235
+ combine(tags) {
236
+ for (const [key, value] of tags) {
237
+ this.data.set(key, value);
238
+ }
239
+ }
240
+ values() {
241
+ return this.data.values();
242
+ }
243
+ keys() {
244
+ return this.data.keys();
245
+ }
246
+ [Symbol.dispose]() {
247
+ this.data = null;
248
+ }
249
+ [Symbol.iterator]() {
250
+ return this.data[Symbol.iterator]();
251
+ }
252
+ }
253
+
254
+
255
+ }),
256
+ "./src/expressions/utils.ts":
257
+ /*!**********************************!*\
258
+ !*** ./src/expressions/utils.ts ***!
259
+ \**********************************/
260
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
261
+ __webpack_require__.r(__webpack_exports__);
262
+ __webpack_require__.d(__webpack_exports__, {
263
+ forEach: () => (forEach),
264
+ getProperties: () => (getProperties),
265
+ isPropertyExpression: () => (isPropertyExpression)
266
+ });
267
+ /**
268
+ * Extracts all properties referenced in an expression
269
+ * @param expression The expression to analyze
270
+ * @returns Array of PropertyInfo objects referenced in the expression
271
+ */
272
+ function getProperties(expression) {
273
+ const properties = [];
274
+ function traverse(expr) {
275
+ // If this is a property expression, add it to our collection
276
+ if (expr.type === "property") {
277
+ properties.push(expr.property);
278
+ }
279
+ // Traverse left and right expressions if they exist
280
+ if (expr.left) {
281
+ traverse(expr.left);
282
+ }
283
+ if (expr.right) {
284
+ traverse(expr.right);
285
+ }
286
+ }
287
+ traverse(expression);
288
+ return properties;
289
+ }
290
+ function isPropertyExpression(expression) {
291
+ return expression.type === "property";
292
+ }
293
+ function forEach(expression, callback) {
294
+ function traverse(expr) {
295
+ // Call the callback for this expression
296
+ // If callback returns false, stop traversing
297
+ if (!callback(expr)) {
298
+ return false;
299
+ }
300
+ // Traverse left and right expressions if they exist
301
+ if (expr.left) {
302
+ if (!traverse(expr.left)) {
303
+ return false;
304
+ }
305
+ }
306
+ if (expr.right) {
307
+ if (!traverse(expr.right)) {
308
+ return false;
309
+ }
310
+ }
311
+ return true;
312
+ }
313
+ traverse(expression);
314
+ }
315
+
316
+
317
+ }),
318
+ "./src/performance/index.ts":
319
+ /*!**********************************!*\
320
+ !*** ./src/performance/index.ts ***!
321
+ \**********************************/
322
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
323
+ __webpack_require__.r(__webpack_exports__);
324
+ __webpack_require__.d(__webpack_exports__, {
325
+ measure: () => (measure),
326
+ now: () => (now)
327
+ });
328
+ const measurements = {};
329
+ const now = () => {
330
+ if (typeof performance !== 'undefined' && performance.now) {
331
+ // Browser or modern Node.js
332
+ return performance.now();
333
+ }
334
+ // Fallback for older environments
335
+ return Date.now();
336
+ };
337
+ const measure = {
338
+ start: (name) => {
339
+ measurements[name] = now();
340
+ },
341
+ end: (name) => {
342
+ const start = measurements[name];
343
+ delete measurements[name];
344
+ const delta = now() - start;
345
+ console.log(`[ROUTIER] - Performance: ${name} took ${delta}`);
346
+ }
347
+ };
348
+
349
+
350
+ }),
351
+ "./src/pipeline/TrampolinePipeline.ts":
352
+ /*!********************************************!*\
353
+ !*** ./src/pipeline/TrampolinePipeline.ts ***!
354
+ \********************************************/
355
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
356
+ __webpack_require__.r(__webpack_exports__);
357
+ __webpack_require__.d(__webpack_exports__, {
358
+ AsyncPipeline: () => (AsyncPipeline),
359
+ TrampolinePipeline: () => (TrampolinePipeline),
360
+ WorkPipeline: () => (WorkPipeline)
361
+ });
362
+ /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../results */ "./src/results/Result.ts");
363
+
364
+ class TrampolinePipeline {
365
+ _list = [];
366
+ _hasErrored = false; // Flag to prevent calling done on error
367
+ filter(initialData, done) {
368
+ this._hasErrored = false; // Reset error flag on new execution
369
+ if (this._list.length === 0) {
370
+ queueMicrotask(() => done(initialData));
371
+ return;
372
+ }
373
+ let index = 0;
374
+ let currentData = initialData;
375
+ let isRunning = false; // Guard against overlapping trampoline calls
376
+ try {
377
+ // --- Revised Completion Logic --- (Moved up for clarity)
378
+ const finalStepSentinel = () => {
379
+ // Only call done if no error has occurred
380
+ if (!this._hasErrored) {
381
+ queueMicrotask(() => done(currentData));
382
+ }
383
+ return null; // Stop the trampoline
384
+ };
385
+ const createStepRevised = (idx) => {
386
+ return () => {
387
+ if (this._hasErrored)
388
+ return null; // Stop if an error occurred elsewhere
389
+ if (idx >= this._list.length) {
390
+ return finalStepSentinel(); // Execute the dedicated final step
391
+ }
392
+ const processor = this._list[idx];
393
+ // Initialize syncCallbackResult to null to satisfy StepResult type
394
+ let syncCallbackResult = null;
395
+ let calledSync = false;
396
+ try {
397
+ processor(currentData, (result, error) => {
398
+ // --- Error Handling ---
399
+ if (error) {
400
+ console.error(`Error reported by processor at index ${idx}:`, error);
401
+ this._hasErrored = true; // Set flag
402
+ // Throw the error to be caught by outer try...catch blocks
403
+ throw error;
404
+ }
405
+ // --- /Error Handling ---
406
+ // If no error, proceed as before
407
+ currentData = result;
408
+ index = idx + 1; // Update index for the next step
409
+ const nextStep = createStepRevised(index); // Use updated index
410
+ if (isRunning) {
411
+ // Callback was synchronous
412
+ syncCallbackResult = nextStep; // Store next step function
413
+ calledSync = true;
414
+ }
415
+ else {
416
+ // Callback was asynchronous, restart trampoline
417
+ trampoline(nextStep);
418
+ }
419
+ });
420
+ }
421
+ catch (error) {
422
+ if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
423
+ console.error(`Error thrown by processor at index ${idx} or its callback:`, error);
424
+ this._hasErrored = true;
425
+ }
426
+ // Rethrow to be caught by the trampoline's catch block
427
+ throw error;
428
+ }
429
+ if (calledSync) {
430
+ // Return the next step function for the sync loop
431
+ return syncCallbackResult;
432
+ }
433
+ else {
434
+ // Pause trampoline for async, loop will stop as step returns null
435
+ return null;
436
+ }
437
+ };
438
+ };
439
+ // The trampoline loop
440
+ const trampoline = (step) => {
441
+ if (isRunning) {
442
+ return;
443
+ }
444
+ isRunning = true;
445
+ let currentStep = step;
446
+ while (typeof currentStep === 'function') {
447
+ try {
448
+ // Stop immediately if an error was flagged elsewhere
449
+ if (this._hasErrored) {
450
+ currentStep = null;
451
+ break;
452
+ }
453
+ currentStep = currentStep(); // Execute step, get next step or null
454
+ }
455
+ catch (trampolineError) {
456
+ // Catch errors propagated from step execution (processor or callback errors)
457
+ if (!this._hasErrored) { // Avoid double logging
458
+ console.error("Error during trampoline step execution:", trampolineError);
459
+ this._hasErrored = true;
460
+ }
461
+ currentStep = null; // Stop the loop
462
+ // We don't call `done` here because an error occurred.
463
+ // The application should handle the uncaught exception if desired.
464
+ break; // Explicitly break loop on error
465
+ }
466
+ }
467
+ // Loop ends when currentStep is null or loop is broken by error
468
+ isRunning = false;
469
+ // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.
470
+ };
471
+ // --- Start the process ---
472
+ index = 0; // Reset index
473
+ currentData = initialData; // Reset data
474
+ trampoline(createStepRevised(0)); // Start with the revised step creator
475
+ }
476
+ catch (error) {
477
+ done(currentData, error);
478
+ }
479
+ }
480
+ pipe(processor) {
481
+ this._list.push(processor);
482
+ return this;
483
+ }
484
+ pipeEach(items, fn, map) {
485
+ for (let i = 0, length = items.length; i < length; i++) {
486
+ this.pipe((previous, done) => {
487
+ fn(map(previous, _results__WEBPACK_IMPORTED_MODULE_0__.Result.success(items[i])), done);
488
+ });
489
+ }
490
+ }
491
+ }
492
+ class AsyncPipeline {
493
+ _list = [];
494
+ _hasErrored = false; // Flag to prevent calling done on error
495
+ filter(done) {
496
+ this._hasErrored = false; // Reset error flag on new execution
497
+ let currentData = [];
498
+ if (this._list.length === 0) {
499
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
500
+ return;
501
+ }
502
+ let index = 0;
503
+ let isRunning = false; // Guard against overlapping trampoline calls
504
+ try {
505
+ // --- Revised Completion Logic --- (Moved up for clarity)
506
+ const finalStepSentinel = () => {
507
+ // Only call done if no error has occurred
508
+ if (!this._hasErrored) {
509
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success(currentData)));
510
+ }
511
+ return null; // Stop the trampoline
512
+ };
513
+ const createStepRevised = (idx) => {
514
+ return () => {
515
+ if (this._hasErrored)
516
+ return null; // Stop if an error occurred elsewhere
517
+ if (idx >= this._list.length) {
518
+ return finalStepSentinel(); // Execute the dedicated final step
519
+ }
520
+ const [payload, processor] = this._list[idx];
521
+ // Initialize syncCallbackResult to null to satisfy StepResult type
522
+ let syncCallbackResult = null;
523
+ let calledSync = false;
524
+ try {
525
+ processor(payload, (result) => {
526
+ // --- Error Handling ---
527
+ if (result.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
528
+ console.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);
529
+ this._hasErrored = true; // Set flag
530
+ // Throw the error to be caught by outer try...catch blocks
531
+ throw result.error;
532
+ }
533
+ // --- /Error Handling ---
534
+ // If no error, proceed as before
535
+ currentData.push(result.data);
536
+ index = idx + 1; // Update index for the next step
537
+ const nextStep = createStepRevised(index); // Use updated index
538
+ if (isRunning) {
539
+ // Callback was synchronous
540
+ syncCallbackResult = nextStep; // Store next step function
541
+ calledSync = true;
542
+ }
543
+ else {
544
+ // Callback was asynchronous, restart trampoline
545
+ trampoline(nextStep);
546
+ }
547
+ });
548
+ }
549
+ catch (error) {
550
+ if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
551
+ console.error(`Error thrown by processor at index ${idx} or its callback:`, error);
552
+ this._hasErrored = true;
553
+ }
554
+ // Rethrow to be caught by the trampoline's catch block
555
+ throw error;
556
+ }
557
+ if (calledSync) {
558
+ // Return the next step function for the sync loop
559
+ return syncCallbackResult;
560
+ }
561
+ else {
562
+ // Pause trampoline for async, loop will stop as step returns null
563
+ return null;
564
+ }
565
+ };
566
+ };
567
+ // The trampoline loop
568
+ const trampoline = (step) => {
569
+ if (isRunning) {
570
+ return;
571
+ }
572
+ isRunning = true;
573
+ let currentStep = step;
574
+ while (typeof currentStep === 'function') {
575
+ try {
576
+ // Stop immediately if an error was flagged elsewhere
577
+ if (this._hasErrored) {
578
+ currentStep = null;
579
+ break;
580
+ }
581
+ currentStep = currentStep(); // Execute step, get next step or null
582
+ }
583
+ catch (trampolineError) {
584
+ // Catch errors propagated from step execution (processor or callback errors)
585
+ if (!this._hasErrored) { // Avoid double logging
586
+ console.error("Error during trampoline step execution:", trampolineError);
587
+ this._hasErrored = true;
588
+ }
589
+ currentStep = null; // Stop the loop
590
+ // We don't call `done` here because an error occurred.
591
+ // The application should handle the uncaught exception if desired.
592
+ break; // Explicitly break loop on error
593
+ }
594
+ }
595
+ // Loop ends when currentStep is null or loop is broken by error
596
+ isRunning = false;
597
+ // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.
598
+ };
599
+ // --- Start the process ---
600
+ index = 0; // Reset index
601
+ trampoline(createStepRevised(0)); // Start with the revised step creator
602
+ }
603
+ catch (error) {
604
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error));
605
+ }
606
+ }
607
+ pipe(data, processor) {
608
+ this._list.push([data, processor]);
609
+ }
610
+ pipeEach(items, processor) {
611
+ for (let i = 0, length = items.length; i < length; i++) {
612
+ this.pipe(items[i], processor);
613
+ }
614
+ }
615
+ }
616
+ /**
617
+ * Processes functions with callbacks asynchronously.
618
+ *
619
+ * This pipeline handles work items that contain callback functions,
620
+ * executing them in an asynchronous manner while maintaining proper
621
+ * flow control and error handling.
622
+ */
623
+ class WorkPipeline {
624
+ unitsOfWork = [];
625
+ _hasErrored = false; // Flag to prevent calling done on error
626
+ filter(done) {
627
+ this._hasErrored = false; // Reset error flag on new execution
628
+ if (this.unitsOfWork.length === 0) {
629
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
630
+ return;
631
+ }
632
+ let index = 0;
633
+ let isRunning = false; // Guard against overlapping trampoline calls
634
+ try {
635
+ // --- Revised Completion Logic --- (Moved up for clarity)
636
+ const finalStepSentinel = () => {
637
+ // Only call done if no error has occurred
638
+ if (!this._hasErrored) {
639
+ queueMicrotask(() => done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success()));
640
+ }
641
+ return null; // Stop the trampoline
642
+ };
643
+ const createStepRevised = (idx) => {
644
+ return () => {
645
+ if (this._hasErrored)
646
+ return null; // Stop if an error occurred elsewhere
647
+ if (idx >= this.unitsOfWork.length) {
648
+ return finalStepSentinel(); // Execute the dedicated final step
649
+ }
650
+ const processor = this.unitsOfWork[idx];
651
+ // Initialize syncCallbackResult to null to satisfy StepResult type
652
+ let syncCallbackResult = null;
653
+ let calledSync = false;
654
+ try {
655
+ processor((result) => {
656
+ // --- Error Handling ---
657
+ if (result.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
658
+ console.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);
659
+ this._hasErrored = true; // Set flag
660
+ // Throw the error to be caught by outer try...catch blocks
661
+ throw result.error;
662
+ }
663
+ // --- /Error Handling ---
664
+ // If no error, proceed as before
665
+ index = idx + 1; // Update index for the next step
666
+ const nextStep = createStepRevised(index); // Use updated index
667
+ if (isRunning) {
668
+ // Callback was synchronous
669
+ syncCallbackResult = nextStep; // Store next step function
670
+ calledSync = true;
671
+ }
672
+ else {
673
+ // Callback was asynchronous, restart trampoline
674
+ trampoline(nextStep);
675
+ }
676
+ });
677
+ }
678
+ catch (error) {
679
+ if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback
680
+ console.error(`Error thrown by processor at index ${idx} or its callback:`, error);
681
+ this._hasErrored = true;
682
+ }
683
+ // Rethrow to be caught by the trampoline's catch block
684
+ throw error;
685
+ }
686
+ if (calledSync) {
687
+ // Return the next step function for the sync loop
688
+ return syncCallbackResult;
689
+ }
690
+ else {
691
+ // Pause trampoline for async, loop will stop as step returns null
692
+ return null;
693
+ }
694
+ };
695
+ };
696
+ // The trampoline loop
697
+ const trampoline = (step) => {
698
+ if (isRunning) {
699
+ return;
700
+ }
701
+ isRunning = true;
702
+ let currentStep = step;
703
+ while (typeof currentStep === 'function') {
704
+ try {
705
+ // Stop immediately if an error was flagged elsewhere
706
+ if (this._hasErrored) {
707
+ currentStep = null;
708
+ break;
709
+ }
710
+ currentStep = currentStep(); // Execute step, get next step or null
711
+ }
712
+ catch (trampolineError) {
713
+ // Catch errors propagated from step execution (processor or callback errors)
714
+ if (!this._hasErrored) { // Avoid double logging
715
+ console.error("Error during trampoline step execution:", trampolineError);
716
+ this._hasErrored = true;
717
+ }
718
+ currentStep = null; // Stop the loop
719
+ // We don't call `done` here because an error occurred.
720
+ // The application should handle the uncaught exception if desired.
721
+ break; // Explicitly break loop on error
722
+ }
723
+ }
724
+ // Loop ends when currentStep is null or loop is broken by error
725
+ isRunning = false;
726
+ // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.
727
+ };
728
+ // --- Start the process ---
729
+ index = 0; // Reset index
730
+ trampoline(createStepRevised(0)); // Start with the revised step creator
731
+ }
732
+ catch (error) {
733
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.Result.error(error));
734
+ }
735
+ }
736
+ pipe(work) {
737
+ this.unitsOfWork.push(work);
738
+ }
739
+ }
740
+
741
+
742
+ }),
743
+ "./src/plugins/EphemeralDataPlugin.ts":
744
+ /*!********************************************!*\
745
+ !*** ./src/plugins/EphemeralDataPlugin.ts ***!
746
+ \********************************************/
747
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
748
+ __webpack_require__.r(__webpack_exports__);
749
+ __webpack_require__.d(__webpack_exports__, {
750
+ EphemeralDataPlugin: () => (EphemeralDataPlugin)
751
+ });
752
+ /* ESM import */var _assertions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../assertions */ "./src/assertions/index.ts");
753
+ /* ESM import */var _pipeline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../pipeline */ "./src/pipeline/TrampolinePipeline.ts");
754
+ /* ESM import */var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! . */ "./src/plugins/translators/JsonTranslator.ts");
755
+ /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../results */ "./src/results/Result.ts");
756
+
757
+
758
+
759
+
760
+ class EphemeralDataPlugin {
761
+ databaseName;
762
+ constructor(databaseName) {
763
+ this.databaseName = databaseName;
764
+ }
765
+ bulkPersist(event, done) {
766
+ try {
767
+ const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_0__.WorkPipeline();
768
+ const bulkPersistResult = event.operation.toResult();
769
+ for (const [schemaId, changes] of event.operation) {
770
+ pipeline.pipe((d) => {
771
+ try {
772
+ const { adds, hasItems, removes, updates } = changes;
773
+ if (hasItems === false) {
774
+ d(_results__WEBPACK_IMPORTED_MODULE_1__.Result.success());
775
+ return;
776
+ }
777
+ const result = bulkPersistResult.get(schemaId);
778
+ const schema = event.schemas.get(schemaId);
779
+ (0,_assertions__WEBPACK_IMPORTED_MODULE_2__.assertIsNotNull)(schema);
780
+ const collection = this.resolveCollection(schema);
781
+ collection.load(readResult => {
782
+ if (readResult.ok === _results__WEBPACK_IMPORTED_MODULE_1__.Result.ERROR) {
783
+ d(readResult);
784
+ return;
785
+ }
786
+ for (let i = 0, length = adds.length; i < length; i++) {
787
+ collection.add(adds[i]);
788
+ result.adds.push(adds[i]);
789
+ }
790
+ for (let i = 0, length = updates.length; i < length; i++) {
791
+ collection.update(updates[i].entity);
792
+ result.updates.push(updates[i].entity);
793
+ }
794
+ for (let i = 0, length = removes.length; i < length; i++) {
795
+ collection.remove(removes[i]);
796
+ result.removes.push(removes[i]);
797
+ }
798
+ collection.save(saveResult => {
799
+ if (saveResult.ok === _results__WEBPACK_IMPORTED_MODULE_1__.Result.ERROR) {
800
+ d(saveResult);
801
+ return;
802
+ }
803
+ d(_results__WEBPACK_IMPORTED_MODULE_1__.Result.success());
804
+ });
805
+ });
806
+ }
807
+ catch (e) {
808
+ d(_results__WEBPACK_IMPORTED_MODULE_1__.Result.error(e));
809
+ }
810
+ });
811
+ }
812
+ let successCount = 0;
813
+ pipeline.filter((asyncResult) => {
814
+ if (asyncResult.ok !== _results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.SUCCESS) {
815
+ if (successCount === 0) {
816
+ done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.error(event.id, asyncResult.error));
817
+ return;
818
+ }
819
+ done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.partial(event.id, bulkPersistResult, asyncResult.error));
820
+ return;
821
+ }
822
+ successCount++;
823
+ done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.success(event.id, bulkPersistResult));
824
+ });
825
+ }
826
+ catch (e) {
827
+ done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.error(event.id, e));
828
+ }
829
+ }
830
+ query(event, done) {
831
+ try {
832
+ const { operation } = event;
833
+ const translator = new ___WEBPACK_IMPORTED_MODULE_3__.JsonTranslator(operation);
834
+ const collection = this.resolveCollection(operation.schema);
835
+ // translate if we are doing any operations like count/sum/min/max/skip/take
836
+ collection.load(r => {
837
+ if (r.ok === _results__WEBPACK_IMPORTED_MODULE_1__.Result.ERROR) {
838
+ done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.error(event.id, r.error));
839
+ return;
840
+ }
841
+ const translated = translator.translate(collection.records);
842
+ done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.success(event.id, translated));
843
+ });
844
+ }
845
+ catch (e) {
846
+ done(_results__WEBPACK_IMPORTED_MODULE_1__.PluginEventResult.error(event.id, e));
847
+ }
848
+ }
849
+ }
850
+
851
+
852
+ }),
853
+ "./src/plugins/capabilities/DbPluginCapability.ts":
854
+ /*!********************************************************!*\
855
+ !*** ./src/plugins/capabilities/DbPluginCapability.ts ***!
856
+ \********************************************************/
857
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
858
+ __webpack_require__.r(__webpack_exports__);
859
+ __webpack_require__.d(__webpack_exports__, {
860
+ DbPluginCapability: () => (DbPluginCapability)
861
+ });
862
+ /**
863
+ * Extends plugin functionality through hooks and event handlers without
864
+ * changing the plugin's type (mixin). Essential for maintaining type safety
865
+ * in routier's core systems.
866
+ */
867
+ class DbPluginCapability {
868
+ events = {};
869
+ add(name, callback) {
870
+ this.resolve(name);
871
+ switch (name) {
872
+ case "queryStart":
873
+ this.events["query"].before = callback;
874
+ break;
875
+ case "queryComplete":
876
+ this.events["query"].after = callback;
877
+ break;
878
+ case "destroyStart":
879
+ this.events["destroy"].before = callback;
880
+ break;
881
+ case "destroyComplete":
882
+ this.events["destroy"].after = callback;
883
+ break;
884
+ case "bulkPersistStart":
885
+ this.events["bulkPersist"].before = callback;
886
+ break;
887
+ case "bulkPersistComplete":
888
+ this.events["bulkPersist"].after = callback;
889
+ break;
890
+ }
891
+ return this;
892
+ }
893
+ resolve(name) {
894
+ switch (name) {
895
+ case "queryStart":
896
+ case "queryComplete":
897
+ if (!this.events["query"]) {
898
+ this.events["query"] = {};
899
+ }
900
+ return;
901
+ case "destroyStart":
902
+ case "destroyComplete":
903
+ if (!this.events["destroy"]) {
904
+ this.events["destroy"] = {};
905
+ }
906
+ return;
907
+ case "bulkPersistStart":
908
+ case "bulkPersistComplete":
909
+ if (!this.events["bulkPersist"]) {
910
+ this.events["bulkPersist"] = {};
911
+ }
912
+ return;
913
+ default:
914
+ throw new Error("Exhaustive check");
915
+ }
916
+ }
917
+ apply(plugin) {
918
+ const methodWrappers = [
919
+ { method: 'query', events: this.events.query },
920
+ { method: 'destroy', events: this.events.destroy },
921
+ { method: 'bulkPersist', events: this.events.bulkPersist }
922
+ ];
923
+ // apply the mixins
924
+ for (let i = 0, length = methodWrappers.length; i < length; i++) {
925
+ const { events, method } = methodWrappers[i];
926
+ if (events?.before || events?.after) {
927
+ const original = plugin[method].bind(plugin);
928
+ plugin[method] = ((event, done) => {
929
+ events.before?.(event, done);
930
+ if (events.after) {
931
+ return original(event, (result) => {
932
+ events.after(result);
933
+ done(result);
934
+ });
935
+ }
936
+ return original(event, done);
937
+ });
938
+ }
939
+ }
940
+ }
941
+ }
942
+
943
+
944
+ }),
945
+ "./src/plugins/capabilities/index.ts":
946
+ /*!*******************************************!*\
947
+ !*** ./src/plugins/capabilities/index.ts ***!
948
+ \*******************************************/
949
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
950
+ __webpack_require__.r(__webpack_exports__);
951
+ __webpack_require__.d(__webpack_exports__, {
952
+ DbPluginCapability: () => (/* reexport safe */ _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__.DbPluginCapability),
953
+ DbPluginLoggingCapability: () => (/* reexport safe */ _logging__WEBPACK_IMPORTED_MODULE_1__.DbPluginLoggingCapability)
954
+ });
955
+ /* ESM import */var _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DbPluginCapability */ "./src/plugins/capabilities/DbPluginCapability.ts");
956
+ /* ESM import */var _logging__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logging */ "./src/plugins/capabilities/logging/index.ts");
957
+
958
+
959
+
960
+
961
+ }),
962
+ "./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts":
963
+ /*!***********************************************************************!*\
964
+ !*** ./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts ***!
965
+ \***********************************************************************/
966
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
967
+ __webpack_require__.r(__webpack_exports__);
968
+ __webpack_require__.d(__webpack_exports__, {
969
+ DbPluginLoggingCapability: () => (DbPluginLoggingCapability)
970
+ });
971
+ /* ESM import */var _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../DbPluginCapability */ "./src/plugins/capabilities/DbPluginCapability.ts");
972
+ /* ESM import */var _performance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../performance */ "./src/performance/index.ts");
973
+
974
+
975
+ class DbPluginLoggingCapability {
976
+ logStyle = 'redux';
977
+ maxLogEntries = 100;
978
+ logHistory = [];
979
+ queryPerformance = new Map();
980
+ constructor(options) {
981
+ this.logStyle = options?.logStyle ?? 'redux';
982
+ this.maxLogEntries = options?.maxLogEntries ?? 100;
983
+ }
984
+ apply(plugin) {
985
+ const baseCapability = new _DbPluginCapability__WEBPACK_IMPORTED_MODULE_0__.DbPluginCapability();
986
+ const pluginName = plugin.constructor.name;
987
+ // Query logging
988
+ baseCapability
989
+ .add("queryStart", (event) => {
990
+ this.logReduxAction('QUERY_REQUEST', event.id, {
991
+ plugin: pluginName,
992
+ collection: event.operation.schema.collectionName,
993
+ schemaId: event.operation.schema.id,
994
+ changeTracking: event.operation.changeTracking
995
+ }, {
996
+ timestamp: new Date().toISOString(),
997
+ options: this.extractQueryOptions(event.operation)
998
+ });
999
+ this.addToHistory('QUERY_REQUEST', event);
1000
+ this.queryPerformance.set(event.id, (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)());
1001
+ })
1002
+ .add("queryComplete", (result) => {
1003
+ const start = this.queryPerformance.get(result.id);
1004
+ this.queryPerformance.delete(result.id);
1005
+ const end = (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)();
1006
+ const duration = start == null ? -1 : end - start;
1007
+ const performance = this.getPerformanceIndicator(duration);
1008
+ if (result.ok === 'success') {
1009
+ this.logReduxAction('QUERY_SUCCESS', result.id, {
1010
+ plugin: pluginName,
1011
+ resultCount: this.getResultCount(result.data),
1012
+ resultType: this.getResultType(result.data)
1013
+ }, {
1014
+ duration: `${duration.toFixed(4)}ms`,
1015
+ performance: performance.label,
1016
+ timestamp: new Date().toISOString()
1017
+ });
1018
+ }
1019
+ else {
1020
+ this.logReduxAction('QUERY_ERROR', result.id, {
1021
+ plugin: pluginName,
1022
+ error: result.error?.message || result.error,
1023
+ isCritical: false
1024
+ }, {
1025
+ duration: `${duration.toFixed(4)}ms`,
1026
+ performance: performance.label,
1027
+ timestamp: new Date().toISOString()
1028
+ });
1029
+ }
1030
+ this.addToHistory('QUERY_RESULT', { result, duration });
1031
+ });
1032
+ // Bulk operations logging
1033
+ baseCapability
1034
+ .add("bulkPersistStart", (event) => {
1035
+ const totalOperations = event.operation.aggregate.size;
1036
+ this.logReduxAction('BULK_OPERATIONS_REQUEST', event.id, {
1037
+ plugin: pluginName,
1038
+ totalOperations,
1039
+ schemaCount: event.schemas.size,
1040
+ operations: this.extractBulkOperations(event.operation)
1041
+ }, {
1042
+ timestamp: new Date().toISOString()
1043
+ });
1044
+ this.addToHistory('BULK_OPERATIONS_REQUEST', event);
1045
+ this.queryPerformance.set(event.id, (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)());
1046
+ })
1047
+ .add("bulkPersistComplete", (result) => {
1048
+ const start = this.queryPerformance.get(result.id);
1049
+ this.queryPerformance.delete(result.id);
1050
+ const end = (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)();
1051
+ const duration = start == null ? -1 : end - start;
1052
+ const performance = this.getPerformanceIndicator(duration);
1053
+ if (result.ok === 'success') {
1054
+ this.logReduxAction('BULK_OPERATIONS_SUCCESS', result.id, {
1055
+ plugin: pluginName,
1056
+ completedOperations: this.countCompletedOperations(result.data),
1057
+ schemaCount: result.data.size
1058
+ }, {
1059
+ duration: `${duration.toFixed(4)}ms`,
1060
+ performance: performance.label,
1061
+ timestamp: new Date().toISOString()
1062
+ });
1063
+ }
1064
+ else {
1065
+ this.logReduxAction('BULK_OPERATIONS_ERROR', result.id, {
1066
+ plugin: pluginName,
1067
+ error: result.error?.message || result.error,
1068
+ isCritical: false
1069
+ }, {
1070
+ duration: `${duration.toFixed(4)}ms`,
1071
+ performance: performance.label,
1072
+ timestamp: new Date().toISOString()
1073
+ });
1074
+ }
1075
+ this.addToHistory('BULK_OPERATIONS_RESULT', { result, duration });
1076
+ });
1077
+ // Destroy logging
1078
+ baseCapability
1079
+ .add("destroyStart", (event) => {
1080
+ this.logReduxAction('DESTROY_REQUEST', event.id, {
1081
+ plugin: pluginName,
1082
+ schemaCount: event.schemas.size
1083
+ }, {
1084
+ timestamp: new Date().toISOString()
1085
+ });
1086
+ this.addToHistory('DESTROY_REQUEST', event);
1087
+ this.queryPerformance.set(event.id, (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)());
1088
+ })
1089
+ .add("destroyComplete", (result) => {
1090
+ const start = this.queryPerformance.get(result.id);
1091
+ this.queryPerformance.delete(result.id);
1092
+ const end = (0,_performance__WEBPACK_IMPORTED_MODULE_1__.now)();
1093
+ const duration = start == null ? -1 : end - start;
1094
+ const performance = this.getPerformanceIndicator(duration);
1095
+ if (result.ok === 'success') {
1096
+ this.logReduxAction('DESTROY_SUCCESS', result.id, {
1097
+ plugin: pluginName
1098
+ }, {
1099
+ duration: `${duration.toFixed(4)}ms`,
1100
+ performance: performance.label,
1101
+ timestamp: new Date().toISOString()
1102
+ });
1103
+ }
1104
+ else {
1105
+ this.logReduxAction('DESTROY_ERROR', result.id, {
1106
+ plugin: pluginName,
1107
+ error: result.error?.message || result.error
1108
+ }, {
1109
+ duration: `${duration.toFixed(4)}ms`,
1110
+ performance: performance.label,
1111
+ timestamp: new Date().toISOString()
1112
+ });
1113
+ }
1114
+ this.addToHistory('DESTROY_RESULT', { result, duration });
1115
+ });
1116
+ baseCapability.apply(plugin);
1117
+ }
1118
+ getPerformanceIndicator(duration) {
1119
+ if (duration > 1000)
1120
+ return { emoji: '🐌', color: '#ef4444', label: 'SLOW', level: 'error' };
1121
+ if (duration > 500)
1122
+ return { emoji: '🐢', color: '#f97316', label: 'MEDIUM', level: 'warning' };
1123
+ if (duration > 100)
1124
+ return { emoji: '⚡', color: '#eab308', label: 'FAST', level: 'info' };
1125
+ return { emoji: '🚀', color: '#22c55e', label: 'INSTANT', level: 'success' };
1126
+ }
1127
+ logReduxAction(action, eventId, payload, meta) {
1128
+ if (this.logStyle !== 'redux')
1129
+ return;
1130
+ const timestamp = new Date().toISOString();
1131
+ console.groupCollapsed(`%c${action} %c@ ${timestamp}`, 'color: #3b82f6; font-weight: bold; font-size: 14px;', 'color: #6b7280; font-size: 12px;');
1132
+ console.group('Action');
1133
+ console.log('Type:', action);
1134
+ console.log('Event ID:', eventId);
1135
+ console.log('Timestamp:', timestamp);
1136
+ console.groupEnd();
1137
+ if (payload) {
1138
+ console.group('Payload');
1139
+ console.log(payload);
1140
+ console.groupEnd();
1141
+ }
1142
+ if (meta) {
1143
+ console.group('Meta');
1144
+ console.log(meta);
1145
+ console.groupEnd();
1146
+ }
1147
+ console.groupEnd();
1148
+ }
1149
+ extractQueryOptions(query) {
1150
+ const options = {};
1151
+ if (query.options) {
1152
+ ['skip', 'take', 'sort', 'filter', 'map', 'distinct'].forEach(type => {
1153
+ try {
1154
+ const values = query.options.getValues(type);
1155
+ if (values.length > 0)
1156
+ options[type] = values;
1157
+ }
1158
+ catch (e) {
1159
+ // Skip if option type not supported
1160
+ }
1161
+ });
1162
+ }
1163
+ return options;
1164
+ }
1165
+ getResultCount(result) {
1166
+ if (Array.isArray(result))
1167
+ return `${result.length} items`;
1168
+ if (result !== null && typeof result === 'object')
1169
+ return '1 object';
1170
+ return '1 primitive';
1171
+ }
1172
+ getResultType(result) {
1173
+ if (Array.isArray(result))
1174
+ return 'array';
1175
+ if (result !== null && typeof result === 'object')
1176
+ return 'object';
1177
+ return typeof result;
1178
+ }
1179
+ extractBulkOperations(operations) {
1180
+ const aggregate = operations.aggregate;
1181
+ return {
1182
+ adds: aggregate.adds,
1183
+ updates: aggregate.updates,
1184
+ removes: aggregate.removes
1185
+ };
1186
+ }
1187
+ countCompletedOperations(result) {
1188
+ return result?.aggregate.size || 0;
1189
+ }
1190
+ addToHistory(type, data) {
1191
+ this.logHistory.push({
1192
+ type,
1193
+ timestamp: Date.now(),
1194
+ data
1195
+ });
1196
+ if (this.logHistory.length > this.maxLogEntries) {
1197
+ this.logHistory = this.logHistory.slice(-this.maxLogEntries);
1198
+ }
1199
+ }
1200
+ generateId() {
1201
+ return Math.random().toString(36).substr(2, 9);
1202
+ }
1203
+ // Public methods for debugging
1204
+ getLogHistory() {
1205
+ return [...this.logHistory];
1206
+ }
1207
+ clearLogHistory() {
1208
+ this.logHistory = [];
1209
+ }
1210
+ }
1211
+
1212
+
1213
+ }),
1214
+ "./src/plugins/capabilities/logging/index.ts":
1215
+ /*!***************************************************!*\
1216
+ !*** ./src/plugins/capabilities/logging/index.ts ***!
1217
+ \***************************************************/
1218
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1219
+ __webpack_require__.r(__webpack_exports__);
1220
+ __webpack_require__.d(__webpack_exports__, {
1221
+ DbPluginLoggingCapability: () => (/* reexport safe */ _DbPluginLoggingCapability__WEBPACK_IMPORTED_MODULE_0__.DbPluginLoggingCapability)
1222
+ });
1223
+ /* ESM import */var _DbPluginLoggingCapability__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DbPluginLoggingCapability */ "./src/plugins/capabilities/logging/DbPluginLoggingCapability.ts");
1224
+
1225
+
1226
+
1227
+ }),
1228
+ "./src/plugins/query/Query.ts":
1229
+ /*!************************************!*\
1230
+ !*** ./src/plugins/query/Query.ts ***!
1231
+ \************************************/
1232
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1233
+ __webpack_require__.r(__webpack_exports__);
1234
+ __webpack_require__.d(__webpack_exports__, {
1235
+ Query: () => (Query)
1236
+ });
1237
+ /* ESM import */var _QueryOptionsCollection__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./QueryOptionsCollection */ "./src/plugins/query/QueryOptionsCollection.ts");
1238
+
1239
+ class Query {
1240
+ options;
1241
+ schema;
1242
+ enableChangeTrackingOverride;
1243
+ constructor(options, schema, enableChangeTrackingOverride) {
1244
+ this.schema = schema;
1245
+ this.options = options;
1246
+ this.enableChangeTrackingOverride = enableChangeTrackingOverride;
1247
+ }
1248
+ // boolean value whether or not change tracking can be enabled on the query result
1249
+ get changeTracking() {
1250
+ if (this.enableChangeTrackingOverride != null) {
1251
+ return this.enableChangeTrackingOverride;
1252
+ }
1253
+ const map = this.options.getValues("map");
1254
+ const count = this.options.has("count");
1255
+ const max = this.options.has("max");
1256
+ const min = this.options.has("min");
1257
+ const sum = this.options.has("sum");
1258
+ if (map.some(x => x.fields.length > 0)) {
1259
+ return false;
1260
+ }
1261
+ if (count === true ||
1262
+ max === true ||
1263
+ min === true ||
1264
+ sum === true) {
1265
+ return false;
1266
+ }
1267
+ return true;
1268
+ }
1269
+ static EMPTY(schema) {
1270
+ return new Query(_QueryOptionsCollection__WEBPACK_IMPORTED_MODULE_0__.QueryOptionsCollection.EMPTY(), schema);
1271
+ }
1272
+ static isEmpty(query) {
1273
+ return _QueryOptionsCollection__WEBPACK_IMPORTED_MODULE_0__.QueryOptionsCollection.isEmpty(query.options);
1274
+ }
1275
+ static toString(query) {
1276
+ return JSON.stringify({
1277
+ options: query.options.items,
1278
+ schema: {
1279
+ id: query.schema.id,
1280
+ collectionName: query.schema.collectionName
1281
+ },
1282
+ changeTracking: query.changeTracking
1283
+ });
1284
+ }
1285
+ }
1286
+
1287
+
1288
+ }),
1289
+ "./src/plugins/query/QueryOptionsCollection.ts":
1290
+ /*!*****************************************************!*\
1291
+ !*** ./src/plugins/query/QueryOptionsCollection.ts ***!
1292
+ \*****************************************************/
1293
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1294
+ __webpack_require__.r(__webpack_exports__);
1295
+ __webpack_require__.d(__webpack_exports__, {
1296
+ QueryOptionsCollection: () => (QueryOptionsCollection)
1297
+ });
1298
+ /* ESM import */var _expressions_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../expressions/utils */ "./src/expressions/utils.ts");
1299
+
1300
+ class QueryOptionsCollection {
1301
+ options = new Map();
1302
+ nextExecutionTarget = "database";
1303
+ nextIndex = 0;
1304
+ enumeratedItems = [];
1305
+ get items() {
1306
+ return this.options;
1307
+ }
1308
+ get isEmpty() {
1309
+ return this.items.size === 0;
1310
+ }
1311
+ static EMPTY() {
1312
+ return new QueryOptionsCollection();
1313
+ }
1314
+ static isEmpty(options) {
1315
+ return options.isEmpty;
1316
+ }
1317
+ add(name, value) {
1318
+ if (name === "map") {
1319
+ const mapValue = value;
1320
+ // Evaluate the map value to see if we are renaming properties,
1321
+ // if we are we need to perform everything after in memory
1322
+ if (mapValue.fields.some(x => x.isRename === true) || mapValue.fields.some(x => x.property?.isUnmapped === true)) {
1323
+ // Cut over to memory execution since we are renaming a property with .map
1324
+ // We do not want to figure out how the new name flows through the entire query
1325
+ this.nextExecutionTarget = "memory";
1326
+ }
1327
+ }
1328
+ if (name === "filter") {
1329
+ // Need to check for unmapped properties
1330
+ const filterValue = value;
1331
+ if (filterValue.expression.type === "not-parsable") {
1332
+ this.nextExecutionTarget = "memory";
1333
+ }
1334
+ else {
1335
+ (0,_expressions_utils__WEBPACK_IMPORTED_MODULE_0__.forEach)(filterValue.expression, (expression) => {
1336
+ if ((0,_expressions_utils__WEBPACK_IMPORTED_MODULE_0__.isPropertyExpression)(expression) && expression.property.isUnmapped) {
1337
+ // Cut over to memory execution, unmapped properties are not in the database and
1338
+ // cannot be queried
1339
+ this.nextExecutionTarget = "memory";
1340
+ return false;
1341
+ }
1342
+ return true;
1343
+ });
1344
+ }
1345
+ }
1346
+ const item = {
1347
+ index: this.nextIndex,
1348
+ option: {
1349
+ name,
1350
+ target: this.nextExecutionTarget,
1351
+ value
1352
+ }
1353
+ };
1354
+ this.nextIndex++;
1355
+ const found = this.options.get(name);
1356
+ this.options.set(name, [...found ?? [], item]);
1357
+ }
1358
+ split() {
1359
+ this.resolveEnumeration();
1360
+ const sortedItems = this.enumeratedItems.toSorted((a, b) => a.index - b.index);
1361
+ const memoryQueryOptionsCollection = new QueryOptionsCollection();
1362
+ const databaseQueryOptionsCollection = new QueryOptionsCollection();
1363
+ for (let i = 0, length = sortedItems.length; i < length; i++) {
1364
+ const sortedItem = sortedItems[i];
1365
+ if (sortedItem.option.target === "database") {
1366
+ databaseQueryOptionsCollection.add(sortedItem.option.name, sortedItem.option.value);
1367
+ continue;
1368
+ }
1369
+ memoryQueryOptionsCollection.add(sortedItem.option.name, sortedItem.option.value);
1370
+ }
1371
+ return {
1372
+ memory: memoryQueryOptionsCollection,
1373
+ database: databaseQueryOptionsCollection
1374
+ };
1375
+ }
1376
+ has(name) {
1377
+ return this.options.has(name);
1378
+ }
1379
+ get(name) {
1380
+ return this.options.get(name) ?? [];
1381
+ }
1382
+ getLast(name) {
1383
+ this.resolveEnumeration();
1384
+ for (let i = this.enumeratedItems.length - 1; i >= 0; i--) {
1385
+ const item = this.enumeratedItems[i];
1386
+ if (item.option.name === name) {
1387
+ return item.option;
1388
+ }
1389
+ }
1390
+ return null;
1391
+ }
1392
+ getValues(name) {
1393
+ const found = this.options.get(name);
1394
+ if (found == null) {
1395
+ return [];
1396
+ }
1397
+ return found.map(w => w.option.value);
1398
+ }
1399
+ getEnumeration() {
1400
+ return [...this.options.values()].flat().toSorted((a, b) => a.index - b.index);
1401
+ }
1402
+ resolveEnumeration() {
1403
+ if (this.enumeratedItems.length != this.nextIndex) {
1404
+ this.enumeratedItems = this.getEnumeration();
1405
+ }
1406
+ }
1407
+ forEach(iterator) {
1408
+ this.resolveEnumeration();
1409
+ for (let i = 0, length = this.enumeratedItems.length; i < length; i++) {
1410
+ iterator(this.enumeratedItems[i].option);
1411
+ }
1412
+ }
1413
+ }
1414
+
1415
+
1416
+ }),
1417
+ "./src/plugins/query/index.ts":
1418
+ /*!************************************!*\
1419
+ !*** ./src/plugins/query/index.ts ***!
1420
+ \************************************/
1421
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1422
+ __webpack_require__.r(__webpack_exports__);
1423
+ __webpack_require__.d(__webpack_exports__, {
1424
+ Query: () => (/* reexport safe */ _Query__WEBPACK_IMPORTED_MODULE_0__.Query),
1425
+ QueryOptionsCollection: () => (/* reexport safe */ _QueryOptionsCollection__WEBPACK_IMPORTED_MODULE_1__.QueryOptionsCollection),
1426
+ QueryOrdering: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.QueryOrdering)
1427
+ });
1428
+ /* ESM import */var _Query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Query */ "./src/plugins/query/Query.ts");
1429
+ /* ESM import */var _QueryOptionsCollection__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./QueryOptionsCollection */ "./src/plugins/query/QueryOptionsCollection.ts");
1430
+ /* ESM import */var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ "./src/plugins/query/types.ts");
1431
+
1432
+
1433
+
1434
+
1435
+
1436
+ }),
1437
+ "./src/plugins/query/types.ts":
1438
+ /*!************************************!*\
1439
+ !*** ./src/plugins/query/types.ts ***!
1440
+ \************************************/
1441
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1442
+ __webpack_require__.r(__webpack_exports__);
1443
+ __webpack_require__.d(__webpack_exports__, {
1444
+ QueryOrdering: () => (QueryOrdering)
1445
+ });
1446
+ var QueryOrdering;
1447
+ (function (QueryOrdering) {
1448
+ QueryOrdering["Descending"] = "desc";
1449
+ QueryOrdering["Ascending"] = "asc";
1450
+ })(QueryOrdering || (QueryOrdering = {}));
1451
+
1452
+
1453
+ }),
1454
+ "./src/plugins/replication/OptimisticReplicationDbPlugin.ts":
1455
+ /*!******************************************************************!*\
1456
+ !*** ./src/plugins/replication/OptimisticReplicationDbPlugin.ts ***!
1457
+ \******************************************************************/
1458
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1459
+ __webpack_require__.r(__webpack_exports__);
1460
+ __webpack_require__.d(__webpack_exports__, {
1461
+ OptimisticReplicationDbPlugin: () => (OptimisticReplicationDbPlugin)
1462
+ });
1463
+ /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../results */ "./src/results/Result.ts");
1464
+ /* ESM import */var _pipeline__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../pipeline */ "./src/pipeline/TrampolinePipeline.ts");
1465
+ /* ESM import */var _query__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../query */ "./src/plugins/query/Query.ts");
1466
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities */ "./src/utilities/uuid.ts");
1467
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utilities */ "./src/utilities/replication.ts");
1468
+ /* ESM import */var _collections__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../collections */ "./src/collections/Changes.ts");
1469
+
1470
+
1471
+ 7;
1472
+
1473
+
1474
+
1475
+ const getMemoryPluginCollectionSize = (plugin, schema) => {
1476
+ if ("getCollectionSize" in plugin && typeof plugin.getCollectionSize === "function") {
1477
+ return plugin.getCollectionSize(schema.collectionName);
1478
+ }
1479
+ throw new Error("Cannot get size of collection for MemoryPlugin, not an instance of MemoryPlugin");
1480
+ };
1481
+ class OptimisticReplicationDbPlugin {
1482
+ plugins;
1483
+ constructor(plugins) {
1484
+ this.plugins = plugins;
1485
+ }
1486
+ /**
1487
+ * Creates a new OptimisticDbPluginReplicator that coordinates operations between a source database and its replicas.
1488
+ *
1489
+ * @param source The primary database plugin that will receive all operations first
1490
+ * @param replicas Additional database plugins that will replicate operations from the source
1491
+ * @returns A new DbPluginReplicator instance that manages the source-replica relationship
1492
+ */
1493
+ static create(plugins) {
1494
+ return new OptimisticReplicationDbPlugin(plugins);
1495
+ }
1496
+ /**
1497
+ * Will query the read plugin if there is one, otherwise the source plugin will be queried
1498
+ */
1499
+ query(event, done) {
1500
+ try {
1501
+ const readPlugin = this.plugins.read;
1502
+ const sourcePlugin = this.plugins.source;
1503
+ const collectionSize = getMemoryPluginCollectionSize(this.plugins.read, event.operation.schema);
1504
+ if (collectionSize === 0) {
1505
+ // nothing is hydrated, let's try and hydrate before querying
1506
+ // Memory plugin might not be hydrated, lets hydrate it for the targeted schema only,
1507
+ // Other queries will do the same and hydrate if needed
1508
+ // We want to select all data here
1509
+ sourcePlugin.query({
1510
+ id: (0,_utilities__WEBPACK_IMPORTED_MODULE_0__.uuid)(8),
1511
+ schemas: event.schemas,
1512
+ // Select All Data
1513
+ operation: _query__WEBPACK_IMPORTED_MODULE_1__.Query.EMPTY(event.operation.schema)
1514
+ }, (sourceResult) => {
1515
+ if (sourceResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
1516
+ done(sourceResult);
1517
+ return;
1518
+ }
1519
+ if (sourceResult == null || (Array.isArray(sourceResult.data) && sourceResult.data.length === 0)) {
1520
+ done(sourceResult);
1521
+ return;
1522
+ }
1523
+ if (Array.isArray(sourceResult.data) === false) {
1524
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, "Query result is not an array"));
1525
+ return;
1526
+ }
1527
+ const changesCollection = new _collections__WEBPACK_IMPORTED_MODULE_3__.BulkPersistChanges();
1528
+ const schemaChanges = changesCollection.resolve(event.operation.schema.id);
1529
+ // Add the existing items into the persist payload as adds
1530
+ schemaChanges.adds = sourceResult.data;
1531
+ readPlugin.bulkPersist({
1532
+ id: (0,_utilities__WEBPACK_IMPORTED_MODULE_0__.uuid)(8),
1533
+ schemas: event.schemas,
1534
+ operation: changesCollection
1535
+ }, (readPersistResult) => {
1536
+ if (readPersistResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
1537
+ done(readPersistResult);
1538
+ return;
1539
+ }
1540
+ // requery the read plugin
1541
+ readPlugin.query(event, done);
1542
+ });
1543
+ });
1544
+ return;
1545
+ }
1546
+ // Collection is hydrated for the targeted collection and should be in sync
1547
+ readPlugin.query(event, (readResult) => {
1548
+ if (readResult.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
1549
+ done(readResult);
1550
+ return;
1551
+ }
1552
+ done(readResult);
1553
+ return;
1554
+ });
1555
+ }
1556
+ catch (e) {
1557
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, e));
1558
+ }
1559
+ }
1560
+ destroy(event, done) {
1561
+ try {
1562
+ const workPipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_4__.WorkPipeline();
1563
+ const plugins = [this.plugins.source, ...this.plugins.replicas];
1564
+ for (let i = 0, length = plugins.length; i < length; i++) {
1565
+ workPipeline.pipe((done) => plugins[i].destroy(event, done));
1566
+ }
1567
+ workPipeline.filter((result) => {
1568
+ if (result.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
1569
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, result.error));
1570
+ return;
1571
+ }
1572
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.success(event.id));
1573
+ });
1574
+ }
1575
+ catch (e) {
1576
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, e));
1577
+ }
1578
+ }
1579
+ bulkPersist(event, done) {
1580
+ try {
1581
+ const workPipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_4__.WorkPipeline();
1582
+ const deferredPlugins = [this.plugins.source, ...this.plugins.replicas];
1583
+ // Since we are doing optimistic, we insert into the read plugin first and assume later plugins will succeed
1584
+ // This means the read plugin will generate ids for the source plugin
1585
+ this.plugins.read.bulkPersist({
1586
+ id: (0,_utilities__WEBPACK_IMPORTED_MODULE_0__.uuid)(8),
1587
+ operation: event.operation,
1588
+ schemas: event.schemas
1589
+ }, (r) => {
1590
+ if (r.ok !== _results__WEBPACK_IMPORTED_MODULE_2__.Result.SUCCESS) {
1591
+ done(r);
1592
+ return;
1593
+ }
1594
+ // optimistically call done and still continue saving the rest of the data. We read from the memory
1595
+ // db anyways
1596
+ done(r);
1597
+ const optimisticBulkPersistChanges = new _collections__WEBPACK_IMPORTED_MODULE_3__.BulkPersistChanges();
1598
+ // make sure we swap the adds here, that way we can make sure other persist events
1599
+ // don't take their additions and try to change subsequent calls
1600
+ (0,_utilities__WEBPACK_IMPORTED_MODULE_5__.resolveBulkPersistChanges)(event, r.data, optimisticBulkPersistChanges);
1601
+ for (let i = 0, length = deferredPlugins.length; i < length; i++) {
1602
+ workPipeline.pipe((d) => {
1603
+ const plugin = deferredPlugins[i];
1604
+ plugin.bulkPersist({
1605
+ id: (0,_utilities__WEBPACK_IMPORTED_MODULE_0__.uuid)(8),
1606
+ operation: optimisticBulkPersistChanges,
1607
+ schemas: event.schemas
1608
+ }, (r) => {
1609
+ if (r.ok === _results__WEBPACK_IMPORTED_MODULE_2__.Result.ERROR) {
1610
+ d(r);
1611
+ return;
1612
+ }
1613
+ d(_results__WEBPACK_IMPORTED_MODULE_2__.Result.success());
1614
+ });
1615
+ });
1616
+ }
1617
+ setTimeout(() => {
1618
+ workPipeline.filter((_) => {
1619
+ // no-op for now, maybe implement retries?
1620
+ });
1621
+ }, 5);
1622
+ });
1623
+ }
1624
+ catch (e) {
1625
+ done(_results__WEBPACK_IMPORTED_MODULE_2__.PluginEventResult.error(event.id, e));
1626
+ }
1627
+ }
1628
+ }
1629
+
1630
+
1631
+ }),
1632
+ "./src/plugins/replication/ReplicationDbPlugin.ts":
1633
+ /*!********************************************************!*\
1634
+ !*** ./src/plugins/replication/ReplicationDbPlugin.ts ***!
1635
+ \********************************************************/
1636
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1637
+ __webpack_require__.r(__webpack_exports__);
1638
+ __webpack_require__.d(__webpack_exports__, {
1639
+ ReplicationDbPlugin: () => (ReplicationDbPlugin)
1640
+ });
1641
+ /* ESM import */var _results__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../results */ "./src/results/Result.ts");
1642
+ /* ESM import */var _pipeline__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../pipeline */ "./src/pipeline/TrampolinePipeline.ts");
1643
+ /* ESM import */var _collections__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../collections */ "./src/collections/Changes.ts");
1644
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utilities */ "./src/utilities/replication.ts");
1645
+
1646
+
1647
+
1648
+
1649
+ class ReplicationDbPlugin {
1650
+ plugins;
1651
+ constructor(plugins) {
1652
+ this.plugins = plugins;
1653
+ }
1654
+ /**
1655
+ * Creates a new DbPluginReplicator that coordinates operations between a source database and its replicas.
1656
+ *
1657
+ * @param source The primary database plugin that will receive all operations first
1658
+ * @param replicas Additional database plugins that will replicate operations from the source
1659
+ * @returns A new DbPluginReplicator instance that manages the source-replica relationship
1660
+ */
1661
+ static create(plugins) {
1662
+ return new ReplicationDbPlugin(plugins);
1663
+ }
1664
+ /**
1665
+ * Will query the read plugin if there is one, otherwise the source plugin will be queried
1666
+ */
1667
+ query(event, done) {
1668
+ try {
1669
+ const plugin = this.plugins.read != null ? this.plugins.read : this.plugins.source;
1670
+ plugin.query(event, done);
1671
+ }
1672
+ catch (e) {
1673
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.PluginEventResult.error(event.id, e));
1674
+ }
1675
+ }
1676
+ destroy(event, done) {
1677
+ try {
1678
+ const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_1__.AsyncPipeline();
1679
+ const plugins = [this.plugins.source, ...this.plugins.replicas];
1680
+ for (let i = 0, length = plugins.length; i < length; i++) {
1681
+ pipeline.pipe(plugins[i], (plugin, done) => plugin.destroy(event, done));
1682
+ }
1683
+ pipeline.filter((result) => {
1684
+ if (result.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
1685
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.PluginEventResult.error(event.id, result.error));
1686
+ return;
1687
+ }
1688
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.PluginEventResult.success(event.id));
1689
+ });
1690
+ }
1691
+ catch (e) {
1692
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.PluginEventResult.error(event.id, e));
1693
+ }
1694
+ }
1695
+ bulkPersist(event, done) {
1696
+ try {
1697
+ // insert into the source first to generate any ids, then take the result and persist that into the replicas
1698
+ const pipeline = new _pipeline__WEBPACK_IMPORTED_MODULE_1__.WorkPipeline();
1699
+ const plugins = [this.plugins.source, ...this.plugins.replicas];
1700
+ if (this.plugins.read != null) {
1701
+ plugins.push(this.plugins.read);
1702
+ }
1703
+ const result = new _collections__WEBPACK_IMPORTED_MODULE_2__.BulkPersistResult();
1704
+ for (let i = 0, length = plugins.length; i < length; i++) {
1705
+ pipeline.pipe((d) => {
1706
+ const plugin = plugins[i];
1707
+ // source is first
1708
+ if (i === 0) {
1709
+ plugin.bulkPersist(event, (r) => {
1710
+ if (r.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
1711
+ d(r);
1712
+ return;
1713
+ }
1714
+ // make sure we swap the adds here, that way we can make sure other persist events
1715
+ // don't take their additions and try to change subsequent calls
1716
+ (0,_utilities__WEBPACK_IMPORTED_MODULE_3__.resolveBulkPersistChanges)(event, r.data, event.operation);
1717
+ d(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success());
1718
+ });
1719
+ return;
1720
+ }
1721
+ plugin.bulkPersist(event, (r) => {
1722
+ if (r.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
1723
+ d(r);
1724
+ return;
1725
+ }
1726
+ d(_results__WEBPACK_IMPORTED_MODULE_0__.Result.success());
1727
+ });
1728
+ });
1729
+ }
1730
+ let successCount = 0;
1731
+ pipeline.filter((r) => {
1732
+ if (r.ok === _results__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
1733
+ if (successCount > 0) {
1734
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.PluginEventResult.partial(event.id, result, r.error));
1735
+ return;
1736
+ }
1737
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.PluginEventResult.error(event.id, r.error));
1738
+ return;
1739
+ }
1740
+ successCount++;
1741
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.PluginEventResult.success(event.id, result));
1742
+ });
1743
+ }
1744
+ catch (e) {
1745
+ done(_results__WEBPACK_IMPORTED_MODULE_0__.PluginEventResult.error(event.id, e));
1746
+ }
1747
+ }
1748
+ }
1749
+
1750
+
1751
+ }),
1752
+ "./src/plugins/replication/index.ts":
1753
+ /*!******************************************!*\
1754
+ !*** ./src/plugins/replication/index.ts ***!
1755
+ \******************************************/
1756
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1757
+ __webpack_require__.r(__webpack_exports__);
1758
+ __webpack_require__.d(__webpack_exports__, {
1759
+ OptimisticReplicationDbPlugin: () => (/* reexport safe */ _OptimisticReplicationDbPlugin__WEBPACK_IMPORTED_MODULE_1__.OptimisticReplicationDbPlugin),
1760
+ ReplicationDbPlugin: () => (/* reexport safe */ _ReplicationDbPlugin__WEBPACK_IMPORTED_MODULE_0__.ReplicationDbPlugin)
1761
+ });
1762
+ /* ESM import */var _ReplicationDbPlugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ReplicationDbPlugin */ "./src/plugins/replication/ReplicationDbPlugin.ts");
1763
+ /* ESM import */var _OptimisticReplicationDbPlugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OptimisticReplicationDbPlugin */ "./src/plugins/replication/OptimisticReplicationDbPlugin.ts");
1764
+
1765
+
1766
+
1767
+
1768
+
1769
+ }),
1770
+ "./src/plugins/translators/DataTranslator.ts":
1771
+ /*!***************************************************!*\
1772
+ !*** ./src/plugins/translators/DataTranslator.ts ***!
1773
+ \***************************************************/
1774
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1775
+ __webpack_require__.r(__webpack_exports__);
1776
+ __webpack_require__.d(__webpack_exports__, {
1777
+ DataTranslator: () => (DataTranslator)
1778
+ });
1779
+ class DataTranslator {
1780
+ query;
1781
+ functionMap = {
1782
+ count: (data, option) => this.count(data, option),
1783
+ distinct: (data, option) => this.distinct(data, option),
1784
+ filter: (data, option) => this.filter(data, option),
1785
+ map: (data, option) => this.map(data, option),
1786
+ max: (data, option) => this.max(data, option),
1787
+ min: (data, option) => this.min(data, option),
1788
+ skip: (data, option) => this.skip(data, option),
1789
+ sort: (data, option) => this.sort(data, option),
1790
+ sum: (data, option) => this.sum(data, option),
1791
+ take: (data, option) => this.take(data, option)
1792
+ };
1793
+ constructor(query) {
1794
+ this.query = query;
1795
+ }
1796
+ translate(data) {
1797
+ this.query.options.forEach(item => {
1798
+ data = this.functionMap[item.name](data, item);
1799
+ });
1800
+ return data;
1801
+ }
1802
+ }
1803
+
1804
+
1805
+ }),
1806
+ "./src/plugins/translators/JsonTranslator.ts":
1807
+ /*!***************************************************!*\
1808
+ !*** ./src/plugins/translators/JsonTranslator.ts ***!
1809
+ \***************************************************/
1810
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1811
+ __webpack_require__.r(__webpack_exports__);
1812
+ __webpack_require__.d(__webpack_exports__, {
1813
+ JsonTranslator: () => (JsonTranslator)
1814
+ });
1815
+ /* ESM import */var _DataTranslator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DataTranslator */ "./src/plugins/translators/DataTranslator.ts");
1816
+ /* ESM import */var _assertions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../assertions */ "./src/assertions/index.ts");
1817
+ /* ESM import */var _utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utilities */ "./src/utilities/dates.ts");
1818
+
1819
+
1820
+
1821
+ class JsonTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTranslator {
1822
+ filter(data, option) {
1823
+ (0,_assertions__WEBPACK_IMPORTED_MODULE_1__.assertIsArray)(data);
1824
+ if (option.value.filter) {
1825
+ if (option.value.params == null) {
1826
+ // standard filtering
1827
+ return data.filter(option.value.filter);
1828
+ }
1829
+ // params filtering
1830
+ const selector = option.value.filter;
1831
+ return data.filter(w => selector([w, option.value.params]));
1832
+ }
1833
+ return data;
1834
+ }
1835
+ map(data, option) {
1836
+ if (Array.isArray(data) == false) {
1837
+ throw new Error("Can only map an array of data");
1838
+ }
1839
+ const response = [];
1840
+ // We want deserialization to flow through mappings
1841
+ // TODO: Speed this up!
1842
+ // Generate a function on the fly?
1843
+ for (let i = 0, length = data.length; i < length; i++) {
1844
+ for (let j = 0, l = option.value.fields.length; j < l; j++) {
1845
+ const field = option.value.fields[j];
1846
+ if (field.property != null) {
1847
+ const value = field.property.getValue(data[i]);
1848
+ if (value != null) {
1849
+ field.property.setValue(data[i], field.property.deserialize(value));
1850
+ }
1851
+ }
1852
+ }
1853
+ response.push(option.value.selector(data[i]));
1854
+ }
1855
+ return response;
1856
+ }
1857
+ count(data, _) {
1858
+ if (Array.isArray(data)) {
1859
+ return data.length;
1860
+ }
1861
+ throw new Error("Cannot count resulting data, it must be an array. Please return array of data for function: count()");
1862
+ }
1863
+ min(data, _) {
1864
+ return this._minMax(data, "min", (a, b) => a - b);
1865
+ }
1866
+ max(data, _) {
1867
+ return this._minMax(data, "max", (a, b) => b - a);
1868
+ }
1869
+ sort(data, option) {
1870
+ if (Array.isArray(data)) {
1871
+ data.sort((a, b) => {
1872
+ if (option.value.direction === "asc") {
1873
+ return option.value.selector(a) - option.value.selector(b);
1874
+ }
1875
+ return option.value.selector(b) - option.value.selector(a);
1876
+ });
1877
+ }
1878
+ return data;
1879
+ }
1880
+ sum(data, _) {
1881
+ (0,_assertions__WEBPACK_IMPORTED_MODULE_1__.assertIsArray)(data, this._formatDataNotArrayError("sum"));
1882
+ const map = this.query.options.getLast("map");
1883
+ let sum = 0;
1884
+ const field = this._getSelectionField("sum", map);
1885
+ for (let i = 0, length = data.length; i < length; i++) {
1886
+ const value = data[i];
1887
+ if (typeof value !== "number") {
1888
+ throw new Error(`Cannot sum, property is not a number. Property: ${field.sourceName}`);
1889
+ }
1890
+ sum += value;
1891
+ }
1892
+ return sum;
1893
+ }
1894
+ distinct(data, _) {
1895
+ (0,_assertions__WEBPACK_IMPORTED_MODULE_1__.assertIsArray)(data, this._formatDataNotArrayError("distinct"));
1896
+ const result = new Set();
1897
+ // would be nice to have property info here for type detection
1898
+ let needsDateConversion = false;
1899
+ for (let i = 0, length = data.length; i < length; i++) {
1900
+ const value = data[i];
1901
+ if (typeof value === "number" || typeof value === "string") {
1902
+ result.add(value);
1903
+ continue;
1904
+ }
1905
+ if ((0,_utilities__WEBPACK_IMPORTED_MODULE_2__.isDate)(value)) {
1906
+ needsDateConversion = true;
1907
+ result.add(value.toISOString());
1908
+ continue;
1909
+ }
1910
+ }
1911
+ if (needsDateConversion) {
1912
+ return [...result].map(w => new Date(w));
1913
+ }
1914
+ return [...result];
1915
+ }
1916
+ skip(data, option) {
1917
+ if (Array.isArray(data)) {
1918
+ if (option.value > 0) {
1919
+ if (data.length < option.value) {
1920
+ // We don't have enough data to skip, return an empty array
1921
+ return [];
1922
+ }
1923
+ return data.slice(option.value);
1924
+ }
1925
+ return data;
1926
+ }
1927
+ return data;
1928
+ }
1929
+ take(data, option) {
1930
+ if (Array.isArray(data)) {
1931
+ if (option.value > 0) {
1932
+ if (data.length < option.value) {
1933
+ return data;
1934
+ }
1935
+ return data.slice(0, option.value);
1936
+ }
1937
+ return data;
1938
+ }
1939
+ return data;
1940
+ }
1941
+ _getSelectionField(name, mapOption) {
1942
+ if (mapOption == null ||
1943
+ mapOption.value.fields.length === 0 ||
1944
+ mapOption.value.fields.length > 1) {
1945
+ throw new Error(`${name}() operation can only be performed when one field is mapped for a result. Ex. myset.map(x => x.someNumberOrDateOrString).${name}()`);
1946
+ }
1947
+ return mapOption.value.fields[0];
1948
+ }
1949
+ _minMax(data, name, sort) {
1950
+ (0,_assertions__WEBPACK_IMPORTED_MODULE_1__.assertIsArray)(data, this._formatDataNotArrayError(name));
1951
+ data.sort(sort);
1952
+ if (data.length === 0) {
1953
+ throw new Error("Cannot perform operation on empty array, result query contains no data");
1954
+ }
1955
+ return data[0];
1956
+ }
1957
+ _formatDataNotArrayError(functionName) {
1958
+ return `Cannot sum resulting data, it must be an array. Please return array of data for function: ${functionName}()`;
1959
+ }
1960
+ }
1961
+
1962
+
1963
+ }),
1964
+ "./src/plugins/translators/SqlTranslator.ts":
1965
+ /*!**************************************************!*\
1966
+ !*** ./src/plugins/translators/SqlTranslator.ts ***!
1967
+ \**************************************************/
1968
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1969
+ __webpack_require__.r(__webpack_exports__);
1970
+ __webpack_require__.d(__webpack_exports__, {
1971
+ SqlTranslator: () => (SqlTranslator)
1972
+ });
1973
+ /* ESM import */var _DataTranslator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DataTranslator */ "./src/plugins/translators/DataTranslator.ts");
1974
+
1975
+ class SqlTranslator extends _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTranslator {
1976
+ count(data, _) {
1977
+ return data;
1978
+ }
1979
+ min(data, _) {
1980
+ return data;
1981
+ }
1982
+ max(data, _) {
1983
+ return data;
1984
+ }
1985
+ sum(data, _) {
1986
+ return data;
1987
+ }
1988
+ distinct(data, _) {
1989
+ return data;
1990
+ }
1991
+ filter(data, _) {
1992
+ return data;
1993
+ }
1994
+ skip(data, _) {
1995
+ return data;
1996
+ }
1997
+ take(data, _) {
1998
+ return data;
1999
+ }
2000
+ sort(data, _) {
2001
+ return data;
2002
+ }
2003
+ map(data, _) {
2004
+ return data;
2005
+ }
2006
+ }
2007
+
2008
+
2009
+ }),
2010
+ "./src/plugins/translators/index.ts":
2011
+ /*!******************************************!*\
2012
+ !*** ./src/plugins/translators/index.ts ***!
2013
+ \******************************************/
2014
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2015
+ __webpack_require__.r(__webpack_exports__);
2016
+ __webpack_require__.d(__webpack_exports__, {
2017
+ DataTranslator: () => (/* reexport safe */ _DataTranslator__WEBPACK_IMPORTED_MODULE_0__.DataTranslator),
2018
+ JsonTranslator: () => (/* reexport safe */ _JsonTranslator__WEBPACK_IMPORTED_MODULE_1__.JsonTranslator),
2019
+ SqlTranslator: () => (/* reexport safe */ _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__.SqlTranslator)
2020
+ });
2021
+ /* ESM import */var _DataTranslator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DataTranslator */ "./src/plugins/translators/DataTranslator.ts");
2022
+ /* ESM import */var _JsonTranslator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./JsonTranslator */ "./src/plugins/translators/JsonTranslator.ts");
2023
+ /* ESM import */var _SqlTranslator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SqlTranslator */ "./src/plugins/translators/SqlTranslator.ts");
2024
+
2025
+
2026
+
2027
+
2028
+
2029
+ }),
2030
+ "./src/results/Result.ts":
2031
+ /*!*******************************!*\
2032
+ !*** ./src/results/Result.ts ***!
2033
+ \*******************************/
2034
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2035
+ __webpack_require__.r(__webpack_exports__);
2036
+ __webpack_require__.d(__webpack_exports__, {
2037
+ PluginEventResult: () => (PluginEventResult),
2038
+ Result: () => (Result)
2039
+ });
2040
+ class BaseResult {
2041
+ static ERROR = "error";
2042
+ static SUCCESS = "success";
2043
+ static PARTIAL = "partial";
2044
+ static resolve(result, resolve, reject) {
2045
+ if (result.ok === BaseResult.SUCCESS) {
2046
+ resolve(result.data);
2047
+ return;
2048
+ }
2049
+ if (result.ok === BaseResult.PARTIAL) {
2050
+ reject({
2051
+ partial: result.data,
2052
+ error: result.error
2053
+ });
2054
+ return;
2055
+ }
2056
+ reject(result.error);
2057
+ }
2058
+ static assertSuccess(result) {
2059
+ if (result.ok !== BaseResult.SUCCESS) {
2060
+ throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);
2061
+ }
2062
+ }
2063
+ }
2064
+ class Result extends BaseResult {
2065
+ static success(data) {
2066
+ return {
2067
+ ok: Result.SUCCESS,
2068
+ data
2069
+ };
2070
+ }
2071
+ static error(error) {
2072
+ return {
2073
+ ok: Result.ERROR,
2074
+ error
2075
+ };
2076
+ }
2077
+ static partial(data, error) {
2078
+ return {
2079
+ ok: Result.PARTIAL,
2080
+ data,
2081
+ error
2082
+ };
2083
+ }
2084
+ }
2085
+ class PluginEventResult extends BaseResult {
2086
+ static success(id, data) {
2087
+ return {
2088
+ id,
2089
+ ok: Result.SUCCESS,
2090
+ data
2091
+ };
2092
+ }
2093
+ static error(id, error) {
2094
+ return {
2095
+ id,
2096
+ ok: Result.ERROR,
2097
+ error
2098
+ };
2099
+ }
2100
+ static partial(id, data, error) {
2101
+ return {
2102
+ id,
2103
+ ok: Result.PARTIAL,
2104
+ data,
2105
+ error
2106
+ };
2107
+ }
2108
+ static assertSuccess(result) {
2109
+ if (result.ok !== Result.SUCCESS) {
2110
+ throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);
2111
+ }
2112
+ }
2113
+ }
2114
+
2115
+
2116
+ }),
2117
+ "./src/utilities/dates.ts":
2118
+ /*!********************************!*\
2119
+ !*** ./src/utilities/dates.ts ***!
2120
+ \********************************/
2121
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2122
+ __webpack_require__.r(__webpack_exports__);
2123
+ __webpack_require__.d(__webpack_exports__, {
2124
+ isDate: () => (isDate)
2125
+ });
2126
+ const isDate = (data) => {
2127
+ if (data == null) {
2128
+ return false;
2129
+ }
2130
+ if (typeof data !== "object") {
2131
+ return false;
2132
+ }
2133
+ return data instanceof Date;
2134
+ };
2135
+
2136
+
2137
+ }),
2138
+ "./src/utilities/replication.ts":
2139
+ /*!**************************************!*\
2140
+ !*** ./src/utilities/replication.ts ***!
2141
+ \**************************************/
2142
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2143
+ __webpack_require__.r(__webpack_exports__);
2144
+ __webpack_require__.d(__webpack_exports__, {
2145
+ resolveBulkPersistChanges: () => (resolveBulkPersistChanges)
2146
+ });
2147
+ const resolveBulkPersistChanges = (event, result, bulkPersistChanges) => {
2148
+ // make sure we swap the adds here, that way we can make sure other persist events
2149
+ // don't take their additions and try to change subsequent calls
2150
+ for (const [schemaId, changes] of event.operation) {
2151
+ const schemmaBulkPersistResult = result.get(schemaId);
2152
+ const schemaBulkPersistChanges = bulkPersistChanges.resolve(schemaId);
2153
+ // Set the original removes
2154
+ schemaBulkPersistChanges.removes = changes.removes;
2155
+ // Set the original updates
2156
+ schemaBulkPersistChanges.updates = changes.updates;
2157
+ // Take the adds from the result and set them to be persisted
2158
+ // in the replicated plugins because the id's are set in the
2159
+ // memory data store
2160
+ schemaBulkPersistChanges.adds = schemmaBulkPersistResult.adds;
2161
+ }
2162
+ };
2163
+
2164
+
2165
+ }),
2166
+ "./src/utilities/uuid.ts":
2167
+ /*!*******************************!*\
2168
+ !*** ./src/utilities/uuid.ts ***!
2169
+ \*******************************/
2170
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2171
+ __webpack_require__.r(__webpack_exports__);
2172
+ __webpack_require__.d(__webpack_exports__, {
2173
+ uuid: () => (uuid),
2174
+ uuidv4: () => (uuidv4)
2175
+ });
2176
+ const uuid = (length = 16) => {
2177
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
2178
+ const charLength = chars.length;
2179
+ let result = '';
2180
+ for (let i = 0; i < length; i++) {
2181
+ result += chars[Math.random() * charLength | 0];
2182
+ }
2183
+ return result;
2184
+ };
2185
+ const HEX_CHARS = '0123456789abcdef';
2186
+ const UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
2187
+ const hasCrypto = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';
2188
+ const uuidv4 = () => {
2189
+ let randomBytes = null;
2190
+ if (hasCrypto) {
2191
+ randomBytes = crypto.getRandomValues(new Uint8Array(16));
2192
+ }
2193
+ let byteIndex = 0;
2194
+ let uuid = '';
2195
+ for (let i = 0; i < UUID_TEMPLATE.length; i++) {
2196
+ const c = UUID_TEMPLATE[i];
2197
+ if (c === '-') {
2198
+ uuid += '-';
2199
+ continue;
2200
+ }
2201
+ let r;
2202
+ if (hasCrypto && randomBytes) {
2203
+ // Each byte gives two hex digits (nibbles)
2204
+ r =
2205
+ (i % 2 === 0
2206
+ ? randomBytes[byteIndex] >> 4
2207
+ : randomBytes[byteIndex++] & 0x0f);
2208
+ }
2209
+ else {
2210
+ r = Math.floor(Math.random() * 16);
2211
+ }
2212
+ if (c === 'x') {
2213
+ uuid += HEX_CHARS[r];
2214
+ }
2215
+ else if (c === 'y') {
2216
+ // Variant bits: 8, 9, A, or B
2217
+ uuid += HEX_CHARS[(r & 0x3) | 0x8];
2218
+ }
2219
+ else if (c === '4') {
2220
+ uuid += '4';
2221
+ }
2222
+ }
2223
+ return uuid;
2224
+ };
2225
+
2226
+
2227
+ }),
2228
+
2229
+ });
2230
+ /************************************************************************/
2231
+ // The module cache
2232
+ var __webpack_module_cache__ = {};
2233
+
2234
+ // The require function
2235
+ function __webpack_require__(moduleId) {
2236
+
2237
+ // Check if module is in cache
2238
+ var cachedModule = __webpack_module_cache__[moduleId];
2239
+ if (cachedModule !== undefined) {
2240
+ return cachedModule.exports;
2241
+ }
2242
+ // Create a new module (and put it into the cache)
2243
+ var module = (__webpack_module_cache__[moduleId] = {
2244
+ exports: {}
2245
+ });
2246
+ // Execute the module function
2247
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
2248
+
2249
+ // Return the exports of the module
2250
+ return module.exports;
2251
+
2252
+ }
2253
+
2254
+ /************************************************************************/
2255
+ // webpack/runtime/define_property_getters
2256
+ (() => {
2257
+ __webpack_require__.d = (exports, definition) => {
2258
+ for(var key in definition) {
2259
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
2260
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
2261
+ }
2262
+ }
2263
+ };
2264
+ })();
2265
+ // webpack/runtime/has_own_property
2266
+ (() => {
2267
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
2268
+ })();
2269
+ // webpack/runtime/make_namespace_object
2270
+ (() => {
2271
+ // define __esModule on exports
2272
+ __webpack_require__.r = (exports) => {
2273
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2274
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2275
+ }
2276
+ Object.defineProperty(exports, '__esModule', { value: true });
2277
+ };
2278
+ })();
2279
+ /************************************************************************/
2280
+ var __webpack_exports__ = {};
2281
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
2282
+ (() => {
2283
+
2284
+ /*!******************************!*\
2285
+ !*** ./src/plugins/index.ts ***!
2286
+ \******************************/
2287
+ __webpack_require__.r(__webpack_exports__);
2288
+ __webpack_require__.d(__webpack_exports__, {
2289
+ DataTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.DataTranslator),
2290
+ DbPluginCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_1__.DbPluginCapability),
2291
+ DbPluginLoggingCapability: () => (/* reexport safe */ _capabilities__WEBPACK_IMPORTED_MODULE_1__.DbPluginLoggingCapability),
2292
+ EphemeralDataPlugin: () => (/* reexport safe */ _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_4__.EphemeralDataPlugin),
2293
+ JsonTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.JsonTranslator),
2294
+ OptimisticReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_2__.OptimisticReplicationDbPlugin),
2295
+ Query: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_3__.Query),
2296
+ QueryOptionsCollection: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_3__.QueryOptionsCollection),
2297
+ QueryOrdering: () => (/* reexport safe */ _query__WEBPACK_IMPORTED_MODULE_3__.QueryOrdering),
2298
+ ReplicationDbPlugin: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_2__.ReplicationDbPlugin),
2299
+ SqlTranslator: () => (/* reexport safe */ _translators__WEBPACK_IMPORTED_MODULE_0__.SqlTranslator)
2300
+ });
2301
+ /* ESM import */var _translators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./translators */ "./src/plugins/translators/index.ts");
2302
+ /* ESM import */var _capabilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./capabilities */ "./src/plugins/capabilities/index.ts");
2303
+ /* ESM import */var _replication__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./replication */ "./src/plugins/replication/index.ts");
2304
+ /* ESM import */var _query__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./query */ "./src/plugins/query/index.ts");
2305
+ /* ESM import */var _EphemeralDataPlugin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./EphemeralDataPlugin */ "./src/plugins/EphemeralDataPlugin.ts");
2306
+
2307
+
2308
+
2309
+
2310
+
2311
+
2312
+
2313
+ })();
2314
+
2315
+ var __webpack_exports__DataTranslator = __webpack_exports__.DataTranslator;
2316
+ var __webpack_exports__DbPluginCapability = __webpack_exports__.DbPluginCapability;
2317
+ var __webpack_exports__DbPluginLoggingCapability = __webpack_exports__.DbPluginLoggingCapability;
2318
+ var __webpack_exports__EphemeralDataPlugin = __webpack_exports__.EphemeralDataPlugin;
2319
+ var __webpack_exports__JsonTranslator = __webpack_exports__.JsonTranslator;
2320
+ var __webpack_exports__OptimisticReplicationDbPlugin = __webpack_exports__.OptimisticReplicationDbPlugin;
2321
+ var __webpack_exports__Query = __webpack_exports__.Query;
2322
+ var __webpack_exports__QueryOptionsCollection = __webpack_exports__.QueryOptionsCollection;
2323
+ var __webpack_exports__QueryOrdering = __webpack_exports__.QueryOrdering;
2324
+ var __webpack_exports__ReplicationDbPlugin = __webpack_exports__.ReplicationDbPlugin;
2325
+ var __webpack_exports__SqlTranslator = __webpack_exports__.SqlTranslator;
2326
+ export { __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__DbPluginCapability as DbPluginCapability, __webpack_exports__DbPluginLoggingCapability as DbPluginLoggingCapability, __webpack_exports__EphemeralDataPlugin as EphemeralDataPlugin, __webpack_exports__JsonTranslator as JsonTranslator, __webpack_exports__OptimisticReplicationDbPlugin as OptimisticReplicationDbPlugin, __webpack_exports__Query as Query, __webpack_exports__QueryOptionsCollection as QueryOptionsCollection, __webpack_exports__QueryOrdering as QueryOrdering, __webpack_exports__ReplicationDbPlugin as ReplicationDbPlugin, __webpack_exports__SqlTranslator as SqlTranslator };
2327
+
2328
+ //# sourceMappingURL=index.js.map