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

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 (334) 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/ReadonlySchemaCollection.d.ts +17 -0
  78. package/dist/collections/SchemaCollection.d.ts +10 -0
  79. package/dist/collections/TagCollection.d.ts +15 -0
  80. package/dist/collections/TagCollection.test.d.ts +1 -0
  81. package/{src/collections/index.ts → dist/collections/index.d.ts} +2 -1
  82. package/dist/collections/index.js +717 -0
  83. package/dist/collections/index.js.map +1 -0
  84. package/dist/errors/SchemaError.d.ts +3 -0
  85. package/dist/errors/index.d.ts +1 -0
  86. package/dist/errors/index.js +90 -0
  87. package/dist/errors/index.js.map +1 -0
  88. package/{src/expressions/index.ts → dist/expressions/index.d.ts} +1 -1
  89. package/{src/expressions/parser.ts → dist/expressions/index.js} +387 -205
  90. package/dist/expressions/index.js.map +1 -0
  91. package/dist/expressions/parser.d.ts +4 -0
  92. package/dist/expressions/parser.test.d.ts +1 -0
  93. package/{src/expressions/types.ts → dist/expressions/types.d.ts} +42 -99
  94. package/dist/expressions/utils.d.ts +10 -0
  95. package/dist/expressions/utils.test.d.ts +1 -0
  96. package/{src/index.ts → dist/index.d.ts} +1 -1
  97. package/dist/index.js +8589 -0
  98. package/dist/index.js.map +1 -0
  99. package/dist/performance/index.d.ts +5 -0
  100. package/dist/performance/index.js +65 -0
  101. package/dist/performance/index.js.map +1 -0
  102. package/dist/pipeline/SyncronousQueue.d.ts +7 -0
  103. package/dist/pipeline/SyncronousQueue.test.d.ts +1 -0
  104. package/dist/pipeline/TrampolinePipeline.d.ts +36 -0
  105. package/dist/pipeline/TrampolinePipeline.test.d.ts +1 -0
  106. package/dist/pipeline/index.d.ts +2 -0
  107. package/{src/pipeline/TrampolinePipeline.ts → dist/pipeline/index.js} +297 -140
  108. package/dist/pipeline/index.js.map +1 -0
  109. package/dist/plugins/EphemeralDataPlugin.d.ts +13 -0
  110. package/dist/plugins/capabilities/DbPluginCapability.d.ts +23 -0
  111. package/{src/plugins/capabilities/index.ts → dist/plugins/capabilities/index.d.ts} +1 -1
  112. package/dist/plugins/capabilities/logging/DbPluginLoggingCapability.d.ts +28 -0
  113. package/dist/plugins/capabilities/logging/index.d.ts +1 -0
  114. package/{src/plugins/index.ts → dist/plugins/index.d.ts} +1 -1
  115. package/dist/plugins/index.js +2332 -0
  116. package/dist/plugins/index.js.map +1 -0
  117. package/dist/plugins/query/Query.d.ts +13 -0
  118. package/dist/plugins/query/QueryOptionsCollection.d.ts +27 -0
  119. package/dist/plugins/query/QueryOptionsCollection.test.d.ts +1 -0
  120. package/{src/plugins/query/index.ts → dist/plugins/query/index.d.ts} +1 -1
  121. package/{src/plugins/query/types.ts → dist/plugins/query/types.d.ts} +29 -20
  122. package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +21 -0
  123. package/dist/plugins/replication/ReplicationDbPlugin.d.ts +21 -0
  124. package/{src/plugins/replication/index.ts → dist/plugins/replication/index.d.ts} +1 -1
  125. package/{src/plugins/replication/types.ts → dist/plugins/replication/types.d.ts} +1 -2
  126. package/dist/plugins/translators/DataTranslator.d.ts +18 -0
  127. package/dist/plugins/translators/JsonTranslator.d.ts +17 -0
  128. package/dist/plugins/translators/JsonTranslator.test.d.ts +1 -0
  129. package/dist/plugins/translators/SqlTranslator.d.ts +14 -0
  130. package/{src/plugins/translators/index.ts → dist/plugins/translators/index.d.ts} +1 -1
  131. package/{src/plugins/types.ts → dist/plugins/types.d.ts} +13 -26
  132. package/dist/results/Result.d.ts +29 -0
  133. package/{src/results/index.ts → dist/results/index.d.ts} +1 -1
  134. package/dist/results/index.js +192 -0
  135. package/dist/results/index.js.map +1 -0
  136. package/{src/results/types.ts → dist/results/types.d.ts} +18 -7
  137. package/dist/results/utils.d.ts +2 -0
  138. package/dist/schema/PropertyInfo.d.ts +132 -0
  139. package/dist/schema/PropertyInfo.test.d.ts +1 -0
  140. package/dist/schema/SchemaDefinition.d.ts +17 -0
  141. package/dist/schema/builder.d.ts +17 -0
  142. package/dist/schema/communication/broadcast.d.ts +11 -0
  143. package/{src/schema/index.ts → dist/schema/index.d.ts} +1 -1
  144. package/dist/schema/index.js +4929 -0
  145. package/dist/schema/index.js.map +1 -0
  146. package/dist/schema/property/base/SchemaBase.d.ts +23 -0
  147. package/dist/schema/property/base/index.d.ts +1 -0
  148. package/dist/schema/property/modifiers/SchemaDefault.d.ts +13 -0
  149. package/dist/schema/property/modifiers/SchemaDeserialize.d.ts +11 -0
  150. package/dist/schema/property/modifiers/SchemaDistinct.d.ts +7 -0
  151. package/dist/schema/property/modifiers/SchemaFrom.d.ts +23 -0
  152. package/dist/schema/property/modifiers/SchemaIdentity.d.ts +7 -0
  153. package/dist/schema/property/modifiers/SchemaIndex.d.ts +23 -0
  154. package/dist/schema/property/modifiers/SchemaKey.d.ts +13 -0
  155. package/dist/schema/property/modifiers/SchemaNullable.d.ts +9 -0
  156. package/dist/schema/property/modifiers/SchemaOptional.d.ts +9 -0
  157. package/dist/schema/property/modifiers/SchemaReadonly.d.ts +15 -0
  158. package/dist/schema/property/modifiers/SchemaSerialize.d.ts +9 -0
  159. package/dist/schema/property/modifiers/SchemaTracked.d.ts +7 -0
  160. package/{src/schema/property/modifiers/index.ts → dist/schema/property/modifiers/index.d.ts} +1 -1
  161. package/dist/schema/property/types/SchemaArray.d.ts +23 -0
  162. package/dist/schema/property/types/SchemaBoolean.d.ts +27 -0
  163. package/dist/schema/property/types/SchemaDate.d.ts +27 -0
  164. package/dist/schema/property/types/SchemaNumber.d.ts +31 -0
  165. package/dist/schema/property/types/SchemaObject.d.ts +20 -0
  166. package/dist/schema/property/types/SchemaString.d.ts +31 -0
  167. package/{src/schema/property/types/index.ts → dist/schema/property/types/index.d.ts} +1 -1
  168. package/dist/schema/table/SchemaComputed.d.ts +10 -0
  169. package/dist/schema/table/SchemaFunction.d.ts +8 -0
  170. package/{src/schema/table/index.ts → dist/schema/table/index.d.ts} +1 -1
  171. package/{src/schema/types.ts → dist/schema/types.d.ts} +61 -101
  172. package/{src/types/index.ts → dist/types/index.d.ts} +1 -2
  173. package/dist/types/index.js +25 -0
  174. package/dist/types/index.js.map +1 -0
  175. package/dist/utilities/arrays.d.ts +1 -0
  176. package/dist/utilities/arrays.test.d.ts +1 -0
  177. package/dist/utilities/dates.d.ts +1 -0
  178. package/dist/utilities/dates.test.d.ts +1 -0
  179. package/dist/utilities/dbPluginEventUtils.d.ts +14 -0
  180. package/dist/utilities/functions.d.ts +1 -0
  181. package/{src/utilities/index.ts → dist/utilities/index.d.ts} +2 -1
  182. package/dist/utilities/index.js +571 -0
  183. package/dist/utilities/index.js.map +1 -0
  184. package/dist/utilities/objects.d.ts +2 -0
  185. package/dist/utilities/queryOptionsCollection.d.ts +2 -0
  186. package/dist/utilities/replication.d.ts +3 -0
  187. package/dist/utilities/runtime.d.ts +1 -0
  188. package/dist/utilities/strings.d.ts +1 -0
  189. package/dist/utilities/types.d.ts +4 -0
  190. package/dist/utilities/uuid.d.ts +2 -0
  191. package/package.json +6 -1
  192. package/readme.md +95 -0
  193. package/CHANGELOG.md +0 -8
  194. package/rspack.config.mjs +0 -65
  195. package/src/assertions/index.ts +0 -37
  196. package/src/codegen/SlotPath.ts +0 -20
  197. package/src/codegen/blocks.ts +0 -578
  198. package/src/codegen/handlers/CloneHandlerBuilder.ts +0 -13
  199. package/src/codegen/handlers/CompareHandlerBuilder.ts +0 -13
  200. package/src/codegen/handlers/DeserializeHandlerBuilder.ts +0 -20
  201. package/src/codegen/handlers/EnableChangeTrackingHandlerBuilder.ts +0 -13
  202. package/src/codegen/handlers/EnrichmentHandlerBuilder.ts +0 -28
  203. package/src/codegen/handlers/FreezeHandlerBuilder.ts +0 -13
  204. package/src/codegen/handlers/HashHandlerBuilder.ts +0 -25
  205. package/src/codegen/handlers/HashTypeHandlerBuilder.ts +0 -11
  206. package/src/codegen/handlers/IdSelectorHandlerBuilder.ts +0 -10
  207. package/src/codegen/handlers/MergeHandlerBuilder.ts +0 -19
  208. package/src/codegen/handlers/PrepareHandlerBuilder.ts +0 -23
  209. package/src/codegen/handlers/SerializeHandlerBuilder.ts +0 -15
  210. package/src/codegen/handlers/StripHandlerBuilder.ts +0 -18
  211. package/src/codegen/handlers/clone/CloneObjectHandler.ts +0 -29
  212. package/src/codegen/handlers/clone/CloneValueHandler.ts +0 -33
  213. package/src/codegen/handlers/compare/CompareObjectHandler.ts +0 -15
  214. package/src/codegen/handlers/compare/CompareValueHandler.ts +0 -27
  215. package/src/codegen/handlers/deserialize/DeserializeComputedValueHandler.ts +0 -16
  216. package/src/codegen/handlers/deserialize/DeserializeDateHandler.ts +0 -45
  217. package/src/codegen/handlers/deserialize/DeserializeFunctionHandler.ts +0 -16
  218. package/src/codegen/handlers/deserialize/DeserializeObjectHandler.ts +0 -29
  219. package/src/codegen/handlers/deserialize/DeserializeValueHandler.ts +0 -33
  220. package/src/codegen/handlers/enableChangeTracking/EnableChangeTrackingObjectHandler.ts +0 -20
  221. package/src/codegen/handlers/enableChangeTracking/EnableChangeTrackingPrimitiveValueHandler.ts +0 -15
  222. package/src/codegen/handlers/enrichment/EnrichmentComputedValueHandler.ts +0 -37
  223. package/src/codegen/handlers/enrichment/EnrichmentDefaultFunctionHandler.ts +0 -50
  224. package/src/codegen/handlers/enrichment/EnrichmentDefaultValueHandler.ts +0 -18
  225. package/src/codegen/handlers/enrichment/EnrichmentFunctionHandler.ts +0 -38
  226. package/src/codegen/handlers/enrichment/EnrichmentNullableObjectHandler.ts +0 -44
  227. package/src/codegen/handlers/enrichment/EnrichmentObjectHandler.ts +0 -29
  228. package/src/codegen/handlers/enrichment/EnrichmentObjectIdentityHandler.ts +0 -16
  229. package/src/codegen/handlers/enrichment/EnrichmentPrimitiveHandler.ts +0 -13
  230. package/src/codegen/handlers/enrichment/EnrichmentPrimitiveIdentityHandler.ts +0 -21
  231. package/src/codegen/handlers/freeze/FreezeObjectHandler.ts +0 -20
  232. package/src/codegen/handlers/freeze/FreezePrimitiveValueHandler.ts +0 -15
  233. package/src/codegen/handlers/hash/HashComputedValueHandler.ts +0 -15
  234. package/src/codegen/handlers/hash/HashDateHandler.ts +0 -26
  235. package/src/codegen/handlers/hash/HashFunctionHandler.ts +0 -16
  236. package/src/codegen/handlers/hash/HashIdentityHandler.ts +0 -15
  237. package/src/codegen/handlers/hash/HashKeyHandler.ts +0 -26
  238. package/src/codegen/handlers/hash/HashValueHandler.ts +0 -26
  239. package/src/codegen/handlers/hashType/HashTypeValueHandler.ts +0 -20
  240. package/src/codegen/handlers/idSelector/IdSelectorValueHandler.ts +0 -28
  241. package/src/codegen/handlers/merge/MergeComputedValueHandler.ts +0 -37
  242. package/src/codegen/handlers/merge/MergeDefaultFunctionHandler.ts +0 -40
  243. package/src/codegen/handlers/merge/MergeDefaultValueHandler.ts +0 -32
  244. package/src/codegen/handlers/merge/MergeFunctionHandler.ts +0 -16
  245. package/src/codegen/handlers/merge/MergePrimitiveHandler.ts +0 -21
  246. package/src/codegen/handlers/prepare/PrepareComputedValueHandler.ts +0 -16
  247. package/src/codegen/handlers/prepare/PrepareFunctionHandler.ts +0 -16
  248. package/src/codegen/handlers/prepare/PrepareIdentityHandler.ts +0 -21
  249. package/src/codegen/handlers/prepare/PrepareKeyHandler.ts +0 -21
  250. package/src/codegen/handlers/prepare/PrepareObjectHandler.ts +0 -38
  251. package/src/codegen/handlers/prepare/PrepareValueHandler.ts +0 -36
  252. package/src/codegen/handlers/serialize/SerializeDateHandler.ts +0 -45
  253. package/src/codegen/handlers/serialize/SerializeObjectHandler.ts +0 -28
  254. package/src/codegen/handlers/serialize/SerializeValueHandler.ts +0 -33
  255. package/src/codegen/handlers/strip/StripIdentityHandler.ts +0 -15
  256. package/src/codegen/handlers/strip/StripKeyHandler.ts +0 -15
  257. package/src/codegen/handlers/strip/StripObjectHandler.ts +0 -35
  258. package/src/codegen/handlers/strip/StripValueHandler.ts +0 -36
  259. package/src/codegen/handlers/types.ts +0 -119
  260. package/src/codegen/types.ts +0 -2
  261. package/src/codegen/utils.ts +0 -74
  262. package/src/collections/Changes.test.ts +0 -337
  263. package/src/collections/Changes.ts +0 -177
  264. package/src/collections/IdSet.ts +0 -28
  265. package/src/collections/MemoryDataCollection.test.ts +0 -424
  266. package/src/collections/MemoryDataCollection.ts +0 -134
  267. package/src/collections/SchemaCollection.ts +0 -22
  268. package/src/collections/TagCollection.test.ts +0 -443
  269. package/src/collections/TagCollection.ts +0 -62
  270. package/src/errors/SchemaError.ts +0 -6
  271. package/src/errors/index.ts +0 -1
  272. package/src/expressions/parser.test.ts +0 -913
  273. package/src/expressions/utils.test.ts +0 -346
  274. package/src/expressions/utils.ts +0 -59
  275. package/src/performance/index.ts +0 -26
  276. package/src/pipeline/SyncronousQueue.test.ts +0 -269
  277. package/src/pipeline/SyncronousQueue.ts +0 -30
  278. package/src/pipeline/TrampolinePipeline.test.ts +0 -374
  279. package/src/pipeline/index.ts +0 -2
  280. package/src/plugins/EphemeralDataPlugin.ts +0 -132
  281. package/src/plugins/capabilities/DbPluginCapability.ts +0 -111
  282. package/src/plugins/capabilities/logging/DbPluginLoggingCapability.ts +0 -261
  283. package/src/plugins/capabilities/logging/index.ts +0 -1
  284. package/src/plugins/query/Query.ts +0 -67
  285. package/src/plugins/query/QueryOptionsCollection.test.ts +0 -86
  286. package/src/plugins/query/QueryOptionsCollection.ts +0 -154
  287. package/src/plugins/replication/OptimisticReplicationDbPlugin.ts +0 -202
  288. package/src/plugins/replication/ReplicationDbPlugin.ts +0 -137
  289. package/src/plugins/translators/DataTranslator.ts +0 -46
  290. package/src/plugins/translators/JsonTranslator.test.ts +0 -618
  291. package/src/plugins/translators/JsonTranslator.ts +0 -211
  292. package/src/plugins/translators/SqlTranslator.ts +0 -45
  293. package/src/results/Result.ts +0 -91
  294. package/src/results/utils.ts +0 -15
  295. package/src/schema/PropertyInfo.test.ts +0 -479
  296. package/src/schema/PropertyInfo.ts +0 -374
  297. package/src/schema/SchemaDefinition.ts +0 -626
  298. package/src/schema/builder.ts +0 -18
  299. package/src/schema/property/base/SchemaBase.ts +0 -49
  300. package/src/schema/property/base/index.ts +0 -1
  301. package/src/schema/property/modifiers/SchemaDefault.ts +0 -29
  302. package/src/schema/property/modifiers/SchemaDeserialize.ts +0 -23
  303. package/src/schema/property/modifiers/SchemaDistinct.ts +0 -14
  304. package/src/schema/property/modifiers/SchemaFrom.ts +0 -54
  305. package/src/schema/property/modifiers/SchemaIdentity.ts +0 -13
  306. package/src/schema/property/modifiers/SchemaIndex.ts +0 -60
  307. package/src/schema/property/modifiers/SchemaKey.ts +0 -28
  308. package/src/schema/property/modifiers/SchemaNullable.ts +0 -18
  309. package/src/schema/property/modifiers/SchemaOptional.ts +0 -19
  310. package/src/schema/property/modifiers/SchemaReadonly.ts +0 -34
  311. package/src/schema/property/modifiers/SchemaSerialize.ts +0 -18
  312. package/src/schema/property/modifiers/SchemaTracked.ts +0 -14
  313. package/src/schema/property/types/SchemaArray.ts +0 -50
  314. package/src/schema/property/types/SchemaBoolean.ts +0 -59
  315. package/src/schema/property/types/SchemaDate.ts +0 -58
  316. package/src/schema/property/types/SchemaNumber.ts +0 -69
  317. package/src/schema/property/types/SchemaObject.ts +0 -44
  318. package/src/schema/property/types/SchemaString.ts +0 -69
  319. package/src/schema/table/SchemaComputed.ts +0 -20
  320. package/src/schema/table/SchemaFunction.ts +0 -15
  321. package/src/utilities/arrays.test.ts +0 -312
  322. package/src/utilities/arrays.ts +0 -12
  323. package/src/utilities/dates.test.ts +0 -388
  324. package/src/utilities/dates.ts +0 -11
  325. package/src/utilities/dbPluginEventUtils.ts +0 -44
  326. package/src/utilities/objects.ts +0 -7
  327. package/src/utilities/queryOptionsCollection.ts +0 -16
  328. package/src/utilities/replication.ts +0 -23
  329. package/src/utilities/runtime.ts +0 -3
  330. package/src/utilities/strings.ts +0 -18
  331. package/src/utilities/types.ts +0 -1
  332. package/src/utilities/uuid.ts +0 -56
  333. package/tsconfig.json +0 -28
  334. package/vitest.config.ts +0 -11
@@ -0,0 +1,14 @@
1
+ import { QueryOption } from "../query/types";
2
+ import { DataTranslator } from "./DataTranslator";
3
+ export declare class SqlTranslator<TRoot extends {}, TShape> extends DataTranslator<TRoot, TShape> {
4
+ count<TResult extends number>(data: unknown, _: QueryOption<TShape, "count">): TResult;
5
+ min<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, "min">): TResult;
6
+ max<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, "max">): TResult;
7
+ sum<TResult extends number>(data: unknown, _: QueryOption<TShape, "sum">): TResult;
8
+ distinct<TResult>(data: unknown, _: QueryOption<TShape, "distinct">): TResult;
9
+ filter<TResult>(data: unknown, _: QueryOption<TShape, "filter">): TResult;
10
+ skip(data: unknown, _: QueryOption<TShape, "skip">): TShape;
11
+ take(data: unknown, _: QueryOption<TShape, "take">): TShape;
12
+ sort(data: unknown, _: QueryOption<TShape, "sort">): TShape;
13
+ map(data: unknown, _: QueryOption<TShape, "map">): TShape;
14
+ }
@@ -1,3 +1,3 @@
1
1
  export * from './DataTranslator';
2
2
  export * from './JsonTranslator';
3
- export * from './SqlTranslator';
3
+ export * from './SqlTranslator';
@@ -2,7 +2,6 @@ import { PluginEventCallbackPartialResult, PluginEventCallbackResult } from "../
2
2
  import { QueryOptionsCollection } from "./query/QueryOptionsCollection";
3
3
  import { CompiledSchema, InferType } from '../schema';
4
4
  import { BulkPersistChanges, BulkPersistResult, SchemaCollection } from "../collections";
5
-
6
5
  /**
7
6
  * Interface for a database plugin, which provides query, destroy, and bulk operations.
8
7
  */
@@ -25,36 +24,32 @@ export interface IDbPlugin {
25
24
  */
26
25
  bulkPersist(event: DbPluginBulkPersistEvent, done: PluginEventCallbackPartialResult<BulkPersistResult>): void;
27
26
  }
28
-
29
27
  /**
30
28
  * Event for a query operation, including schema, parent, and the query operation.
31
29
  */
32
30
  export type DbPluginQueryEvent<TRoot extends {}, TShape> = DbPluginOperationEvent<IQuery<TRoot, TShape>>;
33
-
34
31
  /**
35
32
  * Event for bulk operations, including schema, parent, and the entity changes.
36
33
  */
37
34
  export type DbPluginBulkPersistEvent = DbPluginOperationEvent<BulkPersistChanges>;
38
-
39
35
  /**
40
36
  * Base event for all plugin operations, containing the schema and parent.
41
37
  */
42
38
  export type DbPluginEvent = {
43
39
  /** The compiled schema for the entity. */
44
40
  schemas: SchemaCollection;
45
-
46
41
  /** Unique id of the event. */
47
42
  id: string;
48
- }
49
-
43
+ /** Source of the request */
44
+ source: "data-store" | "collection" | "view";
45
+ };
50
46
  /**
51
47
  * Event for a specific plugin operation, extending the base event with an operation payload.
52
48
  */
53
49
  export type DbPluginOperationEvent<TOperation> = DbPluginEvent & {
54
50
  /** The operation payload (query, changes, etc.). */
55
51
  operation: TOperation;
56
- }
57
-
52
+ };
58
53
  /**
59
54
  * Represents a collection of database plugins with a primary source and optional replicas.
60
55
  * Used for implementing read/write separation and high availability.
@@ -70,39 +65,32 @@ export type ReplicationPluginOptions = {
70
65
  * read data. Typically this is a MemoryPlugin. Should not be included in the list of replicas.
71
66
  */
72
67
  read?: IDbPlugin;
73
- }
74
-
68
+ };
75
69
  export type OptimisticReplicationPluginOptions = {
76
70
  /** The primary database plugin that handles all write operations, do not include in the list of replicas. */
77
71
  source: IDbPlugin;
78
-
79
72
  /** Array of replica database plugins that can be used for read operations. */
80
73
  replicas: IDbPlugin[];
81
-
82
74
  /** Must be a MemoryPlugin */
83
75
  read: IDbPlugin;
84
- }
85
-
86
-
76
+ };
87
77
  export type EntityUpdateInfo<T extends {}> = {
88
- entity: InferType<T>,
78
+ entity: InferType<T>;
89
79
  changeType: EntityChangeType;
90
- delta: { [key: string]: string | number | Date }
91
- }
92
-
80
+ delta: {
81
+ [key: string]: string | number | Date;
82
+ };
83
+ };
93
84
  export type TaggedEntity<T> = {
94
85
  entity: T;
95
- tag?: unknown
96
- }
97
-
86
+ tag?: unknown;
87
+ };
98
88
  /**
99
89
  * Interface for a query operation, including expression, options, filters, and change tracking.
100
90
  */
101
91
  export type IQuery<TRoot extends {}, TShape> = {
102
-
103
92
  /** Query options (sort, skip, take, etc.). */
104
93
  options: QueryOptionsCollection<TShape>;
105
-
106
94
  schema: CompiledSchema<TRoot>;
107
95
  /**
108
96
  * Whether change tracking is enabled for the query result.
@@ -110,5 +98,4 @@ export type IQuery<TRoot extends {}, TShape> = {
110
98
  */
111
99
  get changeTracking(): boolean;
112
100
  };
113
-
114
101
  export type EntityChangeType = "propertiesChanged" | "markedDirty" | "notModified";
@@ -0,0 +1,29 @@
1
+ import { PartialResultType, PluginEventPartialResultType, PluginEventResultType, ResultType } from "./types";
2
+ declare abstract class BaseResult {
3
+ static ERROR: "error";
4
+ static SUCCESS: "success";
5
+ static PARTIAL: "partial";
6
+ static resolve<T>(result: ResultType<T> | PartialResultType<T>, resolve: (data: T) => void, reject: (error?: any) => void): void;
7
+ static assertSuccess<T>(result: any): asserts result is {
8
+ ok: "success";
9
+ data: T;
10
+ };
11
+ }
12
+ export declare class Result extends BaseResult {
13
+ static success<T>(data: T): ResultType<T>;
14
+ static success<T>(): ResultType<never>;
15
+ static error<T>(error: any): ResultType<T>;
16
+ static partial<T>(data: T, error: any): PartialResultType<T>;
17
+ }
18
+ export declare class PluginEventResult extends BaseResult {
19
+ static success<T>(id: string, data: T): PluginEventResultType<T>;
20
+ static success<T>(id: string): PluginEventResultType<never>;
21
+ static error<T>(id: string, error: any): PluginEventResultType<T>;
22
+ static partial<T>(id: string, data: T, error: any): PluginEventPartialResultType<T>;
23
+ static assertSuccess<T>(result: PluginEventResultType<T>): asserts result is {
24
+ ok: "success";
25
+ data: T;
26
+ id: string;
27
+ };
28
+ }
29
+ export {};
@@ -1,3 +1,3 @@
1
1
  export * from './Result';
2
2
  export * from './types';
3
- export * from './utils';
3
+ export * from './utils';
@@ -0,0 +1,192 @@
1
+ var __webpack_modules__ = ({
2
+ "./src/results/Result.ts":
3
+ /*!*******************************!*\
4
+ !*** ./src/results/Result.ts ***!
5
+ \*******************************/
6
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.r(__webpack_exports__);
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ PluginEventResult: () => (PluginEventResult),
10
+ Result: () => (Result)
11
+ });
12
+ class BaseResult {
13
+ static ERROR = "error";
14
+ static SUCCESS = "success";
15
+ static PARTIAL = "partial";
16
+ static resolve(result, resolve, reject) {
17
+ if (result.ok === BaseResult.SUCCESS) {
18
+ resolve(result.data);
19
+ return;
20
+ }
21
+ if (result.ok === BaseResult.PARTIAL) {
22
+ reject({
23
+ partial: result.data,
24
+ error: result.error
25
+ });
26
+ return;
27
+ }
28
+ reject(result.error);
29
+ }
30
+ static assertSuccess(result) {
31
+ if (result.ok !== BaseResult.SUCCESS) {
32
+ throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);
33
+ }
34
+ }
35
+ }
36
+ class Result extends BaseResult {
37
+ static success(data) {
38
+ return {
39
+ ok: Result.SUCCESS,
40
+ data
41
+ };
42
+ }
43
+ static error(error) {
44
+ return {
45
+ ok: Result.ERROR,
46
+ error
47
+ };
48
+ }
49
+ static partial(data, error) {
50
+ return {
51
+ ok: Result.PARTIAL,
52
+ data,
53
+ error
54
+ };
55
+ }
56
+ }
57
+ class PluginEventResult extends BaseResult {
58
+ static success(id, data) {
59
+ return {
60
+ id,
61
+ ok: Result.SUCCESS,
62
+ data
63
+ };
64
+ }
65
+ static error(id, error) {
66
+ return {
67
+ id,
68
+ ok: Result.ERROR,
69
+ error
70
+ };
71
+ }
72
+ static partial(id, data, error) {
73
+ return {
74
+ id,
75
+ ok: Result.PARTIAL,
76
+ data,
77
+ error
78
+ };
79
+ }
80
+ static assertSuccess(result) {
81
+ if (result.ok !== Result.SUCCESS) {
82
+ throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);
83
+ }
84
+ }
85
+ }
86
+
87
+
88
+ }),
89
+ "./src/results/utils.ts":
90
+ /*!******************************!*\
91
+ !*** ./src/results/utils.ts ***!
92
+ \******************************/
93
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
94
+ __webpack_require__.r(__webpack_exports__);
95
+ __webpack_require__.d(__webpack_exports__, {
96
+ toPromise: () => (toPromise)
97
+ });
98
+ /* ESM import */var _Result__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Result */ "./src/results/Result.ts");
99
+
100
+ function toPromise(fn) {
101
+ return new Promise((resolve, reject) => {
102
+ fn((r) => {
103
+ if (r.ok === _Result__WEBPACK_IMPORTED_MODULE_0__.Result.ERROR) {
104
+ reject(r.error);
105
+ return;
106
+ }
107
+ resolve(r.data);
108
+ });
109
+ });
110
+ }
111
+
112
+
113
+ }),
114
+
115
+ });
116
+ /************************************************************************/
117
+ // The module cache
118
+ var __webpack_module_cache__ = {};
119
+
120
+ // The require function
121
+ function __webpack_require__(moduleId) {
122
+
123
+ // Check if module is in cache
124
+ var cachedModule = __webpack_module_cache__[moduleId];
125
+ if (cachedModule !== undefined) {
126
+ return cachedModule.exports;
127
+ }
128
+ // Create a new module (and put it into the cache)
129
+ var module = (__webpack_module_cache__[moduleId] = {
130
+ exports: {}
131
+ });
132
+ // Execute the module function
133
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
134
+
135
+ // Return the exports of the module
136
+ return module.exports;
137
+
138
+ }
139
+
140
+ /************************************************************************/
141
+ // webpack/runtime/define_property_getters
142
+ (() => {
143
+ __webpack_require__.d = (exports, definition) => {
144
+ for(var key in definition) {
145
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
146
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
147
+ }
148
+ }
149
+ };
150
+ })();
151
+ // webpack/runtime/has_own_property
152
+ (() => {
153
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
154
+ })();
155
+ // webpack/runtime/make_namespace_object
156
+ (() => {
157
+ // define __esModule on exports
158
+ __webpack_require__.r = (exports) => {
159
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
160
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
161
+ }
162
+ Object.defineProperty(exports, '__esModule', { value: true });
163
+ };
164
+ })();
165
+ /************************************************************************/
166
+ var __webpack_exports__ = {};
167
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
168
+ (() => {
169
+
170
+ /*!******************************!*\
171
+ !*** ./src/results/index.ts ***!
172
+ \******************************/
173
+ __webpack_require__.r(__webpack_exports__);
174
+ __webpack_require__.d(__webpack_exports__, {
175
+ PluginEventResult: () => (/* reexport safe */ _Result__WEBPACK_IMPORTED_MODULE_0__.PluginEventResult),
176
+ Result: () => (/* reexport safe */ _Result__WEBPACK_IMPORTED_MODULE_0__.Result),
177
+ toPromise: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_1__.toPromise)
178
+ });
179
+ /* ESM import */var _Result__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Result */ "./src/results/Result.ts");
180
+ /* ESM import */var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./src/results/utils.ts");
181
+
182
+
183
+
184
+
185
+ })();
186
+
187
+ var __webpack_exports__PluginEventResult = __webpack_exports__.PluginEventResult;
188
+ var __webpack_exports__Result = __webpack_exports__.Result;
189
+ var __webpack_exports__toPromise = __webpack_exports__.toPromise;
190
+ export { __webpack_exports__PluginEventResult as PluginEventResult, __webpack_exports__Result as Result, __webpack_exports__toPromise as toPromise };
191
+
192
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results/index.js","sources":["webpack://@routier/core/./src/results/Result.ts","webpack://@routier/core/./src/results/utils.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/webpack/runtime/make_namespace_object","webpack://@routier/core/./src/results/index.ts"],"sourcesContent":["import { PartialResultType, PluginEventPartialResultType, PluginEventResultType, ResultType } from \"./types\";\n\nabstract class BaseResult {\n static ERROR = \"error\" as const;\n static SUCCESS = \"success\" as const;\n static PARTIAL = \"partial\" as const;\n\n static resolve<T>(result: ResultType<T> | PartialResultType<T>, resolve: (data: T) => void, reject: (error?: any) => void) {\n if (result.ok === BaseResult.SUCCESS) {\n resolve(result.data);\n return;\n }\n\n if (result.ok === BaseResult.PARTIAL) {\n reject({\n partial: result.data,\n error: result.error\n });\n return;\n }\n\n reject(result.error);\n }\n\n static assertSuccess<T>(result: any): asserts result is { ok: \"success\"; data: T } {\n if (result.ok !== BaseResult.SUCCESS) {\n throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);\n }\n }\n}\n\nexport class Result extends BaseResult {\n static success<T>(data: T): ResultType<T>;\n static success<T>(): ResultType<never>;\n static success<T>(data?: T): ResultType<T> {\n return {\n ok: Result.SUCCESS,\n data\n }\n }\n\n static error<T>(error: any): ResultType<T> {\n return {\n ok: Result.ERROR,\n error\n }\n }\n\n static partial<T>(data: T, error: any): PartialResultType<T> {\n return {\n ok: Result.PARTIAL,\n data,\n error\n }\n }\n}\n\nexport class PluginEventResult extends BaseResult {\n static success<T>(id: string, data: T): PluginEventResultType<T>;\n static success<T>(id: string): PluginEventResultType<never>;\n static success<T>(id: string, data?: T): PluginEventResultType<T> {\n return {\n id,\n ok: Result.SUCCESS,\n data\n }\n }\n\n static error<T>(id: string, error: any): PluginEventResultType<T> {\n return {\n id,\n ok: Result.ERROR,\n error\n }\n }\n\n static partial<T>(id: string, data: T, error: any): PluginEventPartialResultType<T> {\n return {\n id,\n ok: Result.PARTIAL,\n data,\n error\n }\n }\n\n static assertSuccess<T>(result: PluginEventResultType<T>): asserts result is { ok: \"success\"; data: T; id: string } {\n if (result.ok !== Result.SUCCESS) {\n throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);\n }\n }\n}\n","import { Result } from \"./Result\";\nimport { CallbackResult } from \"./types\";\n\nexport function toPromise<T>(fn: (callback: CallbackResult<T>) => void) {\n return new Promise<T>((resolve, reject) => {\n fn((r) => {\n if (r.ok === Result.ERROR) {\n reject(r.error);\n return;\n }\n\n resolve(r.data);\n });\n });\n}\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './Result';\nexport * from './types';\nexport * from './utils';"],"names":[],"mappings":"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"}
@@ -1,17 +1,28 @@
1
- export type ErrorType<Extra extends {} = {}> = { error: any, ok: "error" } & Extra;
2
- export type SuccessType<T, Extra extends {} = {}> = { data: T, ok: "success" } & Extra;
3
- export type PartialType<T, Extra extends {} = {}> = { data: T, ok: "partial", error: any } & Extra;
1
+ export type ErrorType<Extra extends {} = {}> = {
2
+ error: any;
3
+ ok: "error";
4
+ } & Extra;
5
+ export type SuccessType<T, Extra extends {} = {}> = {
6
+ data: T;
7
+ ok: "success";
8
+ } & Extra;
9
+ export type PartialType<T, Extra extends {} = {}> = {
10
+ data: T;
11
+ ok: "partial";
12
+ error: any;
13
+ } & Extra;
4
14
  export type ResultType<T, Extra extends {} = {}> = ErrorType<Extra> | SuccessType<T, Extra>;
5
15
  export type PartialResultType<T, Extra extends {} = {}> = ErrorType<Extra> | SuccessType<T, Extra> | PartialType<T, Extra>;
6
16
  export type CallbackResult<TData, TCallbackResult = void> = (result: ResultType<TData>) => TCallbackResult;
7
17
  export type CallbackPartialResult<TData, TCallbackResult = void> = (result: PartialResultType<TData>) => TCallbackResult;
8
-
9
-
10
- type IdentifiedType = { id: string }
18
+ type IdentifiedType = {
19
+ id: string;
20
+ };
11
21
  export type PluginEventErrorType = ErrorType<IdentifiedType>;
12
22
  export type PluginEventSuccessType<T> = SuccessType<T, IdentifiedType>;
13
23
  export type PluginEventPartialType<T> = PartialType<T, IdentifiedType>;
14
24
  export type PluginEventResultType<T> = PluginEventErrorType | PluginEventSuccessType<T>;
15
25
  export type PluginEventPartialResultType<T> = PluginEventErrorType | PluginEventSuccessType<T> | PluginEventPartialType<T>;
16
26
  export type PluginEventCallbackResult<TData, TCallbackResult = void> = (result: PluginEventResultType<TData>) => TCallbackResult;
17
- export type PluginEventCallbackPartialResult<TData, TCallbackResult = void> = (result: PluginEventPartialResultType<TData>) => TCallbackResult;
27
+ export type PluginEventCallbackPartialResult<TData, TCallbackResult = void> = (result: PluginEventPartialResultType<TData>) => TCallbackResult;
28
+ export {};
@@ -0,0 +1,2 @@
1
+ import { CallbackResult } from "./types";
2
+ export declare function toPromise<T>(fn: (callback: CallbackResult<T>) => void): Promise<T>;
@@ -0,0 +1,132 @@
1
+ import { SchemaBase } from './property/base/SchemaBase';
2
+ import { DefaultValue, FunctionBody, PropertyDeserializer, PropertySerializer, SchemaTypes } from './types';
3
+ /**
4
+ * Represents metadata and utilities for a property in a schema, including its type, name, parent, children, and serialization details.
5
+ */
6
+ export declare class PropertyInfo<T extends {}> {
7
+ get id(): string;
8
+ /** The name of the property. */
9
+ readonly name: string;
10
+ /** The name of the property we need to map from. */
11
+ readonly from: string | null;
12
+ /** The schema type of the property. */
13
+ readonly type: SchemaTypes;
14
+ /** Whether the property can be null. */
15
+ readonly isNullable: boolean;
16
+ /** Whether the property is optional. */
17
+ readonly isOptional: boolean;
18
+ /** Whether the property is a key. */
19
+ readonly isKey: boolean;
20
+ /** Whether the property is an identity property. */
21
+ readonly isIdentity: boolean;
22
+ /** Whether the property is readonly. */
23
+ readonly isReadonly: boolean;
24
+ /** Whether the property is unmapped. */
25
+ readonly isUnmapped: boolean;
26
+ /** Whether the property is distinct. */
27
+ readonly isDistinct: boolean;
28
+ /** Indexes associated with the property. */
29
+ readonly indexes: string[];
30
+ /** Any injected value for the property. */
31
+ readonly injected: any | null;
32
+ /** The default value for the property, if any. */
33
+ readonly defaultValue: DefaultValue<any> | null;
34
+ /** Serializer for the property value, if any. */
35
+ readonly valueSerializer: PropertySerializer<T> | null;
36
+ /** Deserializer for the property value, if any. */
37
+ readonly valueDeserializer: PropertyDeserializer<T> | null;
38
+ /** Function body for computed properties, if any. */
39
+ readonly functionBody: FunctionBody<any, T> | null;
40
+ /** Child properties of this property. */
41
+ readonly children: PropertyInfo<T>[];
42
+ /** The schema this property belongs to. */
43
+ readonly schema: SchemaBase<T, any>;
44
+ /** The inner schema if this property is an array. */
45
+ readonly innerSchema?: SchemaBase<unknown, any>;
46
+ /** Literal values allowed for this property. */
47
+ readonly literals: T[];
48
+ /** The parent property, if any. */
49
+ readonly parent?: PropertyInfo<T>;
50
+ private _propertyChainCache?;
51
+ private _pathArrayCache?;
52
+ private _parentPathArrayCache?;
53
+ private _idCache?;
54
+ private _levelCache?;
55
+ private _hasNullableParentsCache?;
56
+ constructor(schema: SchemaBase<T, any>, name: string, parent?: PropertyInfo<T> | null);
57
+ /**
58
+ * Returns the depth (level) of this property in the property tree.
59
+ *
60
+ * The root property has a level of 0. Each child property increases the level by 1.
61
+ * Traverses up the parent chain, incrementing the level for each parent until the root is reached.
62
+ *
63
+ * @returns {number} The number of parent properties above this property (0 for root).
64
+ */
65
+ get level(): number;
66
+ private _getPropertyChain;
67
+ private _needsOptionalChaining;
68
+ private _resolvePathArray;
69
+ /**
70
+ * Returns an array of property names representing the path from the root to this property.
71
+ *
72
+ * @returns {string[]} The property path as an array of names.
73
+ */
74
+ getPathArray(): string[];
75
+ /**
76
+ * Returns an array of property names representing the path from the root to the parent of this property.
77
+ *
78
+ * @returns {string[]} The property path as an array of names, excluding this property.
79
+ */
80
+ getParentPathArray(): string[];
81
+ /**
82
+ * Returns true if any parent property is nullable or optional.
83
+ *
84
+ * @returns {boolean} True if any parent is nullable or optional, false otherwise.
85
+ */
86
+ get hasNullableParents(): boolean;
87
+ /**
88
+ * Returns true if any child property (recursively) is an identity property.
89
+ *
90
+ * @returns {boolean} True if any child is an identity property, false otherwise.
91
+ */
92
+ get hasIdentityChildren(): boolean;
93
+ /**
94
+ * Gets the value of this property from the given instance, following the property path.
95
+ *
96
+ * @param instance The object instance to retrieve the value from.
97
+ * @returns The value of the property, or null if not found.
98
+ */
99
+ getValue(instance: unknown): any;
100
+ /**
101
+ * Sets the value of this property on the given instance, creating intermediate objects as needed.
102
+ *
103
+ * @param instance The object instance to set the value on.
104
+ * @param value The value to set.
105
+ */
106
+ setValue(instance: unknown, value: unknown): void;
107
+ /**
108
+ * Returns a selector path string for this property, starting from the given parent variable name.
109
+ *
110
+ * @param options.parent The root variable name.
111
+ * @param options.assignmentType Optional assignment type for path resolution.
112
+ * @returns {string} The selector path string (e.g., 'parent.prop1.prop2').
113
+ */
114
+ getSelectrorPath(options: {
115
+ parent: string;
116
+ assignmentType?: AssignmentType;
117
+ useFromPropertyName?: boolean;
118
+ }): string;
119
+ /**
120
+ * Returns an assignment path string for this property, optionally starting from a parent variable name.
121
+ *
122
+ * @param options.parent Optional root variable name.
123
+ * @returns {string} The assignment path string (e.g., 'prop1.prop2').
124
+ */
125
+ getAssignmentPath(options?: {
126
+ parent?: string;
127
+ useFromPropertyName?: boolean;
128
+ }): string;
129
+ deserialize(value: string | number): string | number | boolean | Date | T;
130
+ }
131
+ type AssignmentType = "FORCE_NULLABLE_OR_OPTIONAL" | "ASSIGNMENT";
132
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { SchemaFunction } from './table/SchemaFunction';
2
+ import { SchemaComputed } from './table/SchemaComputed';
3
+ import { SchemaBase } from "./property/base/SchemaBase";
4
+ import { CompiledSchema, InferType, SchemaTypes } from './types';
5
+ export declare class SchemaDefinition<T extends {}> extends SchemaBase<T, any> {
6
+ instance: T;
7
+ type: SchemaTypes;
8
+ collectionName: string;
9
+ constructor(collectionName: string, schema: T);
10
+ modify<R>(builder: (d: {
11
+ function: <UU, I = never>(fn: (entity: InferType<CompiledSchema<T>>, collectionName: string, injected: I) => UU, injected?: I) => SchemaFunction<UU, I, "unmapped">;
12
+ computed: <UU, I = never>(fn: (entity: InferType<CompiledSchema<T>>, collectionName: string, injected: I) => UU, injected?: I) => SchemaComputed<UU, I, "unmapped">;
13
+ }) => R): SchemaDefinition<R & T>;
14
+ private _iterate;
15
+ private createChangeTracker;
16
+ compile(): CompiledSchema<T>;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { SchemaArray } from "./property/types/SchemaArray";
2
+ import { SchemaBase } from "./property/base/SchemaBase";
3
+ import { SchemaBoolean } from "./property/types/SchemaBoolean";
4
+ import { SchemaDate } from "./property/types/SchemaDate";
5
+ import { SchemaDefinition } from "./SchemaDefinition";
6
+ import { SchemaNumber } from "./property/types/SchemaNumber";
7
+ import { SchemaObject } from "./property/types/SchemaObject";
8
+ import { SchemaString } from "./property/types/SchemaString";
9
+ export declare const s: {
10
+ number: <T extends number[] = number[]>(...literals: T) => SchemaNumber<T[number] extends never ? number : T[number], never>;
11
+ string: <T extends string[] = string[]>(...literals: T) => SchemaString<T[number] extends never ? string : T[number], never>;
12
+ boolean: <T extends boolean = boolean>() => SchemaBoolean<T, never>;
13
+ date: <T extends Date = Date>() => SchemaDate<T, never>;
14
+ array: <T extends unknown>(schema: SchemaBase<T, never>) => SchemaArray<SchemaBase<T, never>, never>;
15
+ object: <T extends {} = {}>(schema: T) => SchemaObject<T, never>;
16
+ define: <T extends {}>(collectionName: string, schema: T) => SchemaDefinition<T>;
17
+ };
@@ -0,0 +1,11 @@
1
+ import { ISchemaSubscription, SchemaId, SubscriptionChanges } from "../types";
2
+ export declare class SchemaSubscription<T extends {}> implements ISchemaSubscription<T> {
3
+ private readonly id;
4
+ private readonly schemaId;
5
+ private readonly createdAt;
6
+ constructor(schemaId: SchemaId, signal?: AbortSignal);
7
+ send(changes: SubscriptionChanges<T>): void;
8
+ onMessage(callback: (changes: SubscriptionChanges<T>) => void): void;
9
+ dispose(): void;
10
+ [Symbol.dispose](): void;
11
+ }
@@ -4,4 +4,4 @@ export * from './property/base';
4
4
  export * from './property/modifiers';
5
5
  export * from './property/types';
6
6
  export * from './PropertyInfo';
7
- export * from './types';
7
+ export * from './types';