@adobe/data 0.4.4 → 0.4.6

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 (352) hide show
  1. package/dist/ecs/database/database-schema/create-database-from-schema.d.ts +12 -0
  2. package/dist/ecs/database/database-schema/create-database-from-schema.js +8 -0
  3. package/dist/ecs/database/database-schema/create-database-from-schema.js.map +1 -0
  4. package/dist/ecs/database/database-schema/create-database-schema-test.js +2 -2
  5. package/dist/ecs/database/database-schema/create-database-schema-test.js.map +1 -1
  6. package/dist/ecs/database/database-schema/create-database-schema.d.ts +3 -6
  7. package/dist/ecs/database/database-schema/create-database-schema.js +2 -2
  8. package/dist/ecs/database/database-schema/create-database-schema.js.map +1 -1
  9. package/dist/{core/schema/validation/is-valid.test.js → ecs/database/database-schema/create-store-schema-test.js} +14 -18
  10. package/dist/ecs/database/database-schema/create-store-schema-test.js.map +1 -0
  11. package/dist/ecs/database/database-schema/create-store-schema.d.ts +9 -0
  12. package/dist/{core/functions/is-async-generator.js → ecs/database/database-schema/create-store-schema.js} +4 -3
  13. package/dist/ecs/database/database-schema/create-store-schema.js.map +1 -0
  14. package/dist/ecs/database/database-schema/database-schema.d.ts +2 -5
  15. package/dist/ecs/database/database-schema/index.d.ts +2 -2
  16. package/dist/ecs/database/database-schema/index.js +2 -2
  17. package/dist/ecs/database/database-schema/index.js.map +1 -1
  18. package/dist/ecs/database/database-schema/store-schema.d.ts +12 -0
  19. package/dist/ecs/{ecs/ecs-types.js → database/database-schema/store-schema.js} +1 -1
  20. package/dist/ecs/database/database-schema/store-schema.js.map +1 -0
  21. package/dist/ecs/database/database.d.ts +4 -4
  22. package/dist/ecs/database/index.d.ts +0 -1
  23. package/dist/ecs/database/index.js +0 -1
  24. package/dist/ecs/database/index.js.map +1 -1
  25. package/dist/{cache/functions/omit.js → ecs/database/store-schema/create-store-schema-test.js} +15 -8
  26. package/dist/ecs/database/store-schema/create-store-schema-test.js.map +1 -0
  27. package/dist/ecs/database/store-schema/create-store-schema.d.ts +9 -0
  28. package/dist/{core/index.js → ecs/database/store-schema/create-store-schema.js} +5 -4
  29. package/dist/ecs/database/store-schema/create-store-schema.js.map +1 -0
  30. package/dist/ecs/database/store-schema/index.d.ts +2 -0
  31. package/dist/ecs/{action-ecs → database/store-schema}/index.js +2 -1
  32. package/dist/ecs/database/store-schema/index.js.map +1 -0
  33. package/dist/ecs/database/store-schema/store-schema.d.ts +12 -0
  34. package/dist/ecs/database/{transactional-store/undoable.js → store-schema/store-schema.js} +1 -1
  35. package/dist/ecs/database/store-schema/store-schema.js.map +1 -0
  36. package/dist/ecs/database/transactional-store/apply-operations.d.ts +2 -2
  37. package/dist/ecs/database/transactional-store/apply-operations.js.map +1 -1
  38. package/dist/ecs/database/transactional-store/create-test-transaction.d.ts +0 -1
  39. package/dist/ecs/database/transactional-store/create-test-transaction.js.map +1 -1
  40. package/dist/ecs/database/transactional-store/create-transactional-store.js +5 -6
  41. package/dist/ecs/database/transactional-store/create-transactional-store.js.map +1 -1
  42. package/dist/ecs/database/transactional-store/index.d.ts +0 -1
  43. package/dist/ecs/database/transactional-store/index.js +0 -1
  44. package/dist/ecs/database/transactional-store/index.js.map +1 -1
  45. package/dist/ecs/database/transactional-store/transactional-store.d.ts +1 -6
  46. package/dist/ecs/store/create-store.js.map +1 -1
  47. package/dist/ecs/store/index.d.ts +1 -0
  48. package/dist/ecs/store/index.js +1 -0
  49. package/dist/ecs/store/index.js.map +1 -1
  50. package/dist/{cache/functions/bind-functions.js → ecs/store/store-schema/create-store-schema-test.js} +15 -12
  51. package/dist/ecs/store/store-schema/create-store-schema-test.js.map +1 -0
  52. package/dist/ecs/store/store-schema/create-store-schema.d.ts +9 -0
  53. package/dist/{core/functions/index.js → ecs/store/store-schema/create-store-schema.js} +5 -4
  54. package/dist/ecs/store/store-schema/create-store-schema.js.map +1 -0
  55. package/dist/ecs/store/store-schema/index.d.ts +2 -0
  56. package/dist/ecs/{transaction-ecs → store/store-schema}/index.js +2 -2
  57. package/dist/ecs/store/store-schema/index.js.map +1 -0
  58. package/dist/ecs/store/store-schema/store-schema.d.ts +12 -0
  59. package/dist/{cache/functions/types.js → ecs/store/store-schema/store-schema.js} +1 -1
  60. package/dist/ecs/store/store-schema/store-schema.js.map +1 -0
  61. package/dist/ecs/store/store.d.ts +6 -0
  62. package/dist/ecs/undo-redo/create-undo-redo-actions.js +0 -21
  63. package/dist/ecs/undo-redo/create-undo-redo-actions.js.map +1 -1
  64. package/dist/ecs/undo-redo/create-undo-redo-actions.test.js.map +1 -1
  65. package/dist/functions/serialization/deserialize.d.ts +4 -1
  66. package/dist/functions/serialization/deserialize.js +14 -1
  67. package/dist/functions/serialization/deserialize.js.map +1 -1
  68. package/dist/functions/serialization/serialization.d.ts +23 -0
  69. package/dist/functions/serialization/serialization.js +58 -0
  70. package/dist/functions/serialization/serialization.js.map +1 -0
  71. package/dist/functions/serialization.d.ts +23 -0
  72. package/dist/functions/serialization.js +58 -0
  73. package/dist/functions/serialization.js.map +1 -0
  74. package/dist/{core/functions/with-validation.js → functions/serialization.test.js} +22 -16
  75. package/dist/functions/serialization.test.js.map +1 -0
  76. package/dist/functions/serialize.d.ts +17 -0
  77. package/dist/functions/serialize.js +66 -0
  78. package/dist/functions/serialize.js.map +1 -0
  79. package/dist/observe/to-async-generator.js +14 -11
  80. package/dist/observe/to-async-generator.js.map +1 -1
  81. package/dist/tsconfig.tsbuildinfo +1 -1
  82. package/dist/typed-buffer/structs/get-struct-layout.js +7 -10
  83. package/dist/typed-buffer/structs/get-struct-layout.js.map +1 -1
  84. package/dist/typed-buffer/structs/get-struct-layout.test.js +148 -11
  85. package/dist/typed-buffer/structs/get-struct-layout.test.js.map +1 -1
  86. package/package.json +1 -1
  87. package/dist/README.md +0 -310
  88. package/dist/cache/functions/bind-functions.d.ts +0 -6
  89. package/dist/cache/functions/bind-functions.js.map +0 -1
  90. package/dist/cache/functions/hashing/arrayBufferToHex.d.ts +0 -1
  91. package/dist/cache/functions/hashing/arrayBufferToHex.js +0 -27
  92. package/dist/cache/functions/hashing/arrayBufferToHex.js.map +0 -1
  93. package/dist/cache/functions/omit.d.ts +0 -1
  94. package/dist/cache/functions/omit.js.map +0 -1
  95. package/dist/cache/functions/types.d.ts +0 -1
  96. package/dist/cache/functions/types.js.map +0 -1
  97. package/dist/core/data.d.ts +0 -22
  98. package/dist/core/data.js +0 -52
  99. package/dist/core/data.js.map +0 -1
  100. package/dist/core/data.test.js +0 -48
  101. package/dist/core/data.test.js.map +0 -1
  102. package/dist/core/functions/array-equals.d.ts +0 -1
  103. package/dist/core/functions/array-equals.js +0 -34
  104. package/dist/core/functions/array-equals.js.map +0 -1
  105. package/dist/core/functions/deep-merge.d.ts +0 -32
  106. package/dist/core/functions/deep-merge.js +0 -54
  107. package/dist/core/functions/deep-merge.js.map +0 -1
  108. package/dist/core/functions/deep-merge.test.js +0 -94
  109. package/dist/core/functions/deep-merge.test.js.map +0 -1
  110. package/dist/core/functions/index.d.ts +0 -3
  111. package/dist/core/functions/index.js.map +0 -1
  112. package/dist/core/functions/is-async-generator.d.ts +0 -1
  113. package/dist/core/functions/is-async-generator.js.map +0 -1
  114. package/dist/core/functions/is-promise.d.ts +0 -1
  115. package/dist/core/functions/is-promise.js +0 -26
  116. package/dist/core/functions/is-promise.js.map +0 -1
  117. package/dist/core/functions/with-validation.d.ts +0 -5
  118. package/dist/core/functions/with-validation.js.map +0 -1
  119. package/dist/core/functions/with-validation.test.js +0 -96
  120. package/dist/core/functions/with-validation.test.js.map +0 -1
  121. package/dist/core/index.d.ts +0 -3
  122. package/dist/core/index.js.map +0 -1
  123. package/dist/core/schema/dynamic/dynamic-schema.d.ts +0 -27
  124. package/dist/core/schema/dynamic/dynamic-schema.js +0 -2
  125. package/dist/core/schema/dynamic/dynamic-schema.js.map +0 -1
  126. package/dist/core/schema/dynamic/enumerate-patches.d.ts +0 -9
  127. package/dist/core/schema/dynamic/enumerate-patches.js +0 -50
  128. package/dist/core/schema/dynamic/enumerate-patches.js.map +0 -1
  129. package/dist/core/schema/dynamic/enumerate-patches.test.d.ts +0 -134
  130. package/dist/core/schema/dynamic/enumerate-patches.test.js +0 -209
  131. package/dist/core/schema/dynamic/enumerate-patches.test.js.map +0 -1
  132. package/dist/core/schema/dynamic/get-dynamic-schema.d.ts +0 -5
  133. package/dist/core/schema/dynamic/get-dynamic-schema.js +0 -26
  134. package/dist/core/schema/dynamic/get-dynamic-schema.js.map +0 -1
  135. package/dist/core/schema/dynamic/get-dynamic-schema.test.d.ts +0 -1
  136. package/dist/core/schema/dynamic/get-dynamic-schema.test.js +0 -94
  137. package/dist/core/schema/dynamic/get-dynamic-schema.test.js.map +0 -1
  138. package/dist/core/schema/dynamic/index.d.ts +0 -1
  139. package/dist/core/schema/dynamic/index.js +0 -2
  140. package/dist/core/schema/dynamic/index.js.map +0 -1
  141. package/dist/core/schema/dynamic/schema-path-value-path.d.ts +0 -5
  142. package/dist/core/schema/dynamic/schema-path-value-path.js +0 -12
  143. package/dist/core/schema/dynamic/schema-path-value-path.js.map +0 -1
  144. package/dist/core/schema/dynamic-schema.d.ts +0 -27
  145. package/dist/core/schema/dynamic-schema.js +0 -2
  146. package/dist/core/schema/dynamic-schema.js.map +0 -1
  147. package/dist/core/schema/index.d.ts +0 -4
  148. package/dist/core/schema/index.js +0 -26
  149. package/dist/core/schema/index.js.map +0 -1
  150. package/dist/core/schema/schema.d.ts +0 -122
  151. package/dist/core/schema/schema.js +0 -34
  152. package/dist/core/schema/schema.js.map +0 -1
  153. package/dist/core/schema/schemas.d.ts +0 -45
  154. package/dist/core/schema/schemas.js +0 -39
  155. package/dist/core/schema/schemas.js.map +0 -1
  156. package/dist/core/schema/ui-schema.d.ts +0 -25
  157. package/dist/core/schema/ui-schema.js +0 -2
  158. package/dist/core/schema/ui-schema.js.map +0 -1
  159. package/dist/core/schema/validation/is-valid.d.ts +0 -2
  160. package/dist/core/schema/validation/is-valid.js +0 -14
  161. package/dist/core/schema/validation/is-valid.js.map +0 -1
  162. package/dist/core/schema/validation/is-valid.test.d.ts +0 -1
  163. package/dist/core/schema/validation/is-valid.test.js.map +0 -1
  164. package/dist/core/schema/validation/validate.d.ts +0 -2
  165. package/dist/core/schema/validation/validate.js +0 -38
  166. package/dist/core/schema/validation/validate.js.map +0 -1
  167. package/dist/core/schema/validation/validate.test.d.ts +0 -1
  168. package/dist/core/schema/validation/validate.test.js +0 -106
  169. package/dist/core/schema/validation/validate.test.js.map +0 -1
  170. package/dist/core/schema/validation/with-validation.d.ts +0 -5
  171. package/dist/core/schema/validation/with-validation.js +0 -16
  172. package/dist/core/schema/validation/with-validation.js.map +0 -1
  173. package/dist/core/schema/validation/with-validation.test.d.ts +0 -1
  174. package/dist/core/schema/validation/with-validation.test.js +0 -96
  175. package/dist/core/schema/validation/with-validation.test.js.map +0 -1
  176. package/dist/core/schema.d.ts +0 -86
  177. package/dist/core/schema.js +0 -33
  178. package/dist/core/schema.js.map +0 -1
  179. package/dist/core/schema.test.js +0 -16
  180. package/dist/core/schema.test.js.map +0 -1
  181. package/dist/core/schemas.d.ts +0 -45
  182. package/dist/core/schemas.js +0 -39
  183. package/dist/core/schemas.js.map +0 -1
  184. package/dist/ecs/action-ecs/action-ecs.d.ts +0 -19
  185. package/dist/ecs/action-ecs/action-ecs.js +0 -203
  186. package/dist/ecs/action-ecs/action-ecs.js.map +0 -1
  187. package/dist/ecs/action-ecs/action-ecs.test.d.ts +0 -1
  188. package/dist/ecs/action-ecs/action-ecs.test.js +0 -362
  189. package/dist/ecs/action-ecs/action-ecs.test.js.map +0 -1
  190. package/dist/ecs/action-ecs/action-types.d.ts +0 -106
  191. package/dist/ecs/action-ecs/action-types.js +0 -19
  192. package/dist/ecs/action-ecs/action-types.js.map +0 -1
  193. package/dist/ecs/action-ecs/index.d.ts +0 -2
  194. package/dist/ecs/action-ecs/index.js.map +0 -1
  195. package/dist/ecs/core-ecs/core-ecs-serialization.test.d.ts +0 -1
  196. package/dist/ecs/core-ecs/core-ecs-serialization.test.js +0 -230
  197. package/dist/ecs/core-ecs/core-ecs-serialization.test.js.map +0 -1
  198. package/dist/ecs/core-ecs/core-ecs-types.d.ts +0 -141
  199. package/dist/ecs/core-ecs/core-ecs-types.js +0 -23
  200. package/dist/ecs/core-ecs/core-ecs-types.js.map +0 -1
  201. package/dist/ecs/core-ecs/core-ecs.d.ts +0 -7
  202. package/dist/ecs/core-ecs/core-ecs.js +0 -492
  203. package/dist/ecs/core-ecs/core-ecs.js.map +0 -1
  204. package/dist/ecs/core-ecs/core-ecs.test.d.ts +0 -1
  205. package/dist/ecs/core-ecs/core-ecs.test.js +0 -425
  206. package/dist/ecs/core-ecs/core-ecs.test.js.map +0 -1
  207. package/dist/ecs/core-ecs/index.d.ts +0 -1
  208. package/dist/ecs/core-ecs/index.js +0 -2
  209. package/dist/ecs/core-ecs/index.js.map +0 -1
  210. package/dist/ecs/database/register-database-codec.d.ts +0 -1
  211. package/dist/ecs/database/register-database-codec.js +0 -35
  212. package/dist/ecs/database/register-database-codec.js.map +0 -1
  213. package/dist/ecs/database/register-database-codecs.d.ts +0 -1
  214. package/dist/ecs/database/register-database-codecs.js +0 -35
  215. package/dist/ecs/database/register-database-codecs.js.map +0 -1
  216. package/dist/ecs/database/register-store-codec.d.ts +0 -1
  217. package/dist/ecs/database/register-store-codec.js +0 -35
  218. package/dist/ecs/database/register-store-codec.js.map +0 -1
  219. package/dist/ecs/database/register-typed-buffer-codecs.d.ts +0 -1
  220. package/dist/ecs/database/register-typed-buffer-codecs.js +0 -80
  221. package/dist/ecs/database/register-typed-buffer-codecs.js.map +0 -1
  222. package/dist/ecs/database/transactional-store/apply-write-operations.d.ts +0 -7
  223. package/dist/ecs/database/transactional-store/apply-write-operations.js +0 -20
  224. package/dist/ecs/database/transactional-store/apply-write-operations.js.map +0 -1
  225. package/dist/ecs/database/transactional-store/applyWriteOperations.d.ts +0 -7
  226. package/dist/ecs/database/transactional-store/applyWriteOperations.js +0 -20
  227. package/dist/ecs/database/transactional-store/applyWriteOperations.js.map +0 -1
  228. package/dist/ecs/database/transactional-store/patch.d.ts +0 -3
  229. package/dist/ecs/database/transactional-store/patch.js +0 -7
  230. package/dist/ecs/database/transactional-store/patch.js.map +0 -1
  231. package/dist/ecs/database/transactional-store/undoable.d.ts +0 -13
  232. package/dist/ecs/database/transactional-store/undoable.js.map +0 -1
  233. package/dist/ecs/database/transactional-store/with-undoable.d.ts +0 -10
  234. package/dist/ecs/database/transactional-store/with-undoable.js +0 -13
  235. package/dist/ecs/database/transactional-store/with-undoable.js.map +0 -1
  236. package/dist/ecs/database/with-undoable.d.ts +0 -10
  237. package/dist/ecs/database/with-undoable.js +0 -13
  238. package/dist/ecs/database/with-undoable.js.map +0 -1
  239. package/dist/ecs/ecs/ecs-types.d.ts +0 -132
  240. package/dist/ecs/ecs/ecs-types.js.map +0 -1
  241. package/dist/ecs/ecs/ecs-where-functions.d.ts +0 -6
  242. package/dist/ecs/ecs/ecs-where-functions.js +0 -91
  243. package/dist/ecs/ecs/ecs-where-functions.js.map +0 -1
  244. package/dist/ecs/ecs/ecs.d.ts +0 -13
  245. package/dist/ecs/ecs/ecs.js +0 -177
  246. package/dist/ecs/ecs/ecs.js.map +0 -1
  247. package/dist/ecs/ecs/ecs.test.d.ts +0 -1
  248. package/dist/ecs/ecs/ecs.test.js +0 -399
  249. package/dist/ecs/ecs/ecs.test.js.map +0 -1
  250. package/dist/ecs/ecs/index.d.ts +0 -3
  251. package/dist/ecs/ecs/index.js +0 -3
  252. package/dist/ecs/ecs/index.js.map +0 -1
  253. package/dist/ecs/entity-location-table/register-database-codec.d.ts +0 -1
  254. package/dist/ecs/entity-location-table/register-database-codec.js +0 -35
  255. package/dist/ecs/entity-location-table/register-database-codec.js.map +0 -1
  256. package/dist/ecs/entity-location-table/register-entity-location-table-codec.d.ts +0 -1
  257. package/dist/ecs/entity-location-table/register-entity-location-table-codec.js +0 -42
  258. package/dist/ecs/entity-location-table/register-entity-location-table-codec.js.map +0 -1
  259. package/dist/ecs/entity-location-table/register-entity-location-table-codec.test.d.ts +0 -1
  260. package/dist/ecs/entity-location-table/register-entity-location-table-codec.test.js +0 -70
  261. package/dist/ecs/entity-location-table/register-entity-location-table-codec.test.js.map +0 -1
  262. package/dist/ecs/persistence-service/create-persistence-service.d.ts +0 -6
  263. package/dist/ecs/persistence-service/create-persistence-service.js +0 -24
  264. package/dist/ecs/persistence-service/create-persistence-service.js.map +0 -1
  265. package/dist/ecs/persistence-service/create-session-persistence-service.d.ts +0 -8
  266. package/dist/ecs/persistence-service/create-session-persistence-service.js +0 -49
  267. package/dist/ecs/persistence-service/create-session-persistence-service.js.map +0 -1
  268. package/dist/ecs/persistence-service/persistence-service copy.d.ts +0 -5
  269. package/dist/ecs/persistence-service/persistence-service copy.js +0 -2
  270. package/dist/ecs/persistence-service/persistence-service copy.js.map +0 -1
  271. package/dist/ecs/persistence-service/to-blob-refs.d.ts +0 -2
  272. package/dist/ecs/persistence-service/to-blob-refs.js +0 -3
  273. package/dist/ecs/persistence-service/to-blob-refs.js.map +0 -1
  274. package/dist/ecs/persistence-service/undo-redo-service.d.ts +0 -11
  275. package/dist/ecs/persistence-service/undo-redo-service.js +0 -23
  276. package/dist/ecs/persistence-service/undo-redo-service.js.map +0 -1
  277. package/dist/ecs/store/core/register-core-codec.d.ts +0 -1
  278. package/dist/ecs/store/core/register-core-codec.js +0 -45
  279. package/dist/ecs/store/core/register-core-codec.js.map +0 -1
  280. package/dist/ecs/store/core/register-core-codec.test.d.ts +0 -1
  281. package/dist/ecs/store/core/register-core-codec.test.js +0 -136
  282. package/dist/ecs/store/core/register-core-codec.test.js.map +0 -1
  283. package/dist/ecs/store/query.d.ts +0 -47
  284. package/dist/ecs/store/query.js +0 -2
  285. package/dist/ecs/store/query.js.map +0 -1
  286. package/dist/ecs/store/register-core-codec.d.ts +0 -1
  287. package/dist/ecs/store/register-core-codec.js +0 -38
  288. package/dist/ecs/store/register-core-codec.js.map +0 -1
  289. package/dist/ecs/store/register-store-codec.d.ts +0 -1
  290. package/dist/ecs/store/register-store-codec.js +0 -38
  291. package/dist/ecs/store/register-store-codec.js.map +0 -1
  292. package/dist/ecs/store/restore-store.d.ts +0 -12
  293. package/dist/ecs/store/restore-store.js +0 -91
  294. package/dist/ecs/store/restore-store.js.map +0 -1
  295. package/dist/ecs/store/select-options.d.ts +0 -1
  296. package/dist/ecs/store/select-options.js +0 -16
  297. package/dist/ecs/store/select-options.js.map +0 -1
  298. package/dist/ecs/store/select.d.ts +0 -44
  299. package/dist/ecs/store/select.js +0 -2
  300. package/dist/ecs/store/select.js.map +0 -1
  301. package/dist/ecs/transaction-ecs/index.d.ts +0 -2
  302. package/dist/ecs/transaction-ecs/index.js.map +0 -1
  303. package/dist/ecs/transaction-ecs/transaction-ecs.d.ts +0 -11
  304. package/dist/ecs/transaction-ecs/transaction-ecs.js +0 -184
  305. package/dist/ecs/transaction-ecs/transaction-ecs.js.map +0 -1
  306. package/dist/ecs/transaction-ecs/transaction-ecs.test.d.ts +0 -1
  307. package/dist/ecs/transaction-ecs/transaction-ecs.test.js +0 -599
  308. package/dist/ecs/transaction-ecs/transaction-ecs.test.js.map +0 -1
  309. package/dist/ecs/transaction-ecs/transaction-types.d.ts +0 -135
  310. package/dist/ecs/transaction-ecs/transaction-types.js +0 -2
  311. package/dist/ecs/transaction-ecs/transaction-types.js.map +0 -1
  312. package/dist/ecs/transaction-ecs/transactions.d.ts +0 -5
  313. package/dist/ecs/transaction-ecs/transactions.js +0 -158
  314. package/dist/ecs/transaction-ecs/transactions.js.map +0 -1
  315. package/dist/ecs/undo-redo/do.d.ts +0 -3
  316. package/dist/ecs/undo-redo/do.js +0 -3
  317. package/dist/ecs/undo-redo/do.js.map +0 -1
  318. package/dist/ecs/undo-redo/index.d.ts +0 -1
  319. package/dist/ecs/undo-redo/index.js +0 -23
  320. package/dist/ecs/undo-redo/index.js.map +0 -1
  321. package/dist/functions/serialization/register-typed-array-codecs copy.d.ts +0 -1
  322. package/dist/functions/serialization/register-typed-array-codecs copy.js +0 -13
  323. package/dist/functions/serialization/register-typed-array-codecs copy.js.map +0 -1
  324. package/dist/functions/serialization/serialize-to-blobs copy.d.ts +0 -8
  325. package/dist/functions/serialization/serialize-to-blobs copy.js +0 -21
  326. package/dist/functions/serialization/serialize-to-blobs copy.js.map +0 -1
  327. package/dist/observe/with-map copy.d.ts +0 -5
  328. package/dist/observe/with-map copy.js +0 -14
  329. package/dist/observe/with-map copy.js.map +0 -1
  330. package/dist/package.json +0 -129
  331. package/dist/schema/f32 copy.d.ts +0 -6
  332. package/dist/schema/f32 copy.js +0 -6
  333. package/dist/schema/f32 copy.js.map +0 -1
  334. package/dist/schemas/index.d.ts +0 -1
  335. package/dist/schemas/index.js +0 -23
  336. package/dist/schemas/index.js.map +0 -1
  337. package/dist/schemas/schemas.d.ts +0 -45
  338. package/dist/schemas/schemas.js +0 -39
  339. package/dist/schemas/schemas.js.map +0 -1
  340. package/dist/service/sequential-action.d.ts +0 -18
  341. package/dist/service/sequential-action.js +0 -45
  342. package/dist/service/sequential-action.js.map +0 -1
  343. package/dist/table/ensure-capacity copy.d.ts +0 -2
  344. package/dist/table/ensure-capacity copy.js +0 -15
  345. package/dist/table/ensure-capacity copy.js.map +0 -1
  346. package/dist/table/filter-rows.d.ts +0 -2
  347. package/dist/table/filter-rows.js +0 -15
  348. package/dist/table/filter-rows.js.map +0 -1
  349. /package/dist/{core/data.test.d.ts → ecs/database/database-schema/create-store-schema-test.d.ts} +0 -0
  350. /package/dist/{core/functions/deep-merge.test.d.ts → ecs/database/store-schema/create-store-schema-test.d.ts} +0 -0
  351. /package/dist/{core/functions/with-validation.test.d.ts → ecs/store/store-schema/create-store-schema-test.d.ts} +0 -0
  352. /package/dist/{core/schema.test.d.ts → functions/serialization.test.d.ts} +0 -0
@@ -1,122 +0,0 @@
1
- import { DeepReadonly } from "../../types/types.js";
2
- type JSONPath = string;
3
- type JSONMergePatch = unknown;
4
- /**
5
- * Conditional patch applied to the path when the enclosing schema branch is active
6
- * and `match` is not present or validates against the root.
7
- * This is used for dynamic schemas which change in response to the value of the data.
8
- */
9
- export type Conditional = {
10
- match?: Schema;
11
- path: JSONPath;
12
- value: JSONMergePatch;
13
- };
14
- export interface UIProperties {
15
- name?: string;
16
- icon?: string;
17
- summary?: string;
18
- premium?: boolean;
19
- placeholder?: string;
20
- details?: string;
21
- visible?: boolean;
22
- enabled?: boolean;
23
- infoUrl?: string;
24
- group?: string;
25
- order?: number;
26
- groups?: {
27
- readonly [key: string]: UIProperties;
28
- };
29
- }
30
- export interface Schema {
31
- type?: 'number' | 'integer' | 'string' | 'boolean' | 'null' | 'array' | 'object';
32
- conditionals?: readonly Conditional[];
33
- ui?: UIProperties;
34
- default?: any;
35
- precision?: 1 | 2;
36
- multipleOf?: number;
37
- mediaType?: string;
38
- minimum?: number;
39
- maximum?: number;
40
- minLength?: number;
41
- maxLength?: number;
42
- exclusiveMinimum?: number;
43
- exclusiveMaximum?: number;
44
- pattern?: string;
45
- minItems?: number;
46
- maxItems?: number;
47
- items?: Schema;
48
- properties?: {
49
- readonly [key: string]: Schema;
50
- };
51
- required?: readonly string[];
52
- additionalProperties?: boolean | Schema;
53
- oneOf?: readonly Schema[];
54
- const?: any;
55
- enum?: readonly any[];
56
- }
57
- export type FromSchema<T, Depth extends number = 5> = DeepReadonly<Depth extends 0 ? any : T extends {
58
- const: infer Const;
59
- } ? Const : T extends {
60
- enum: infer Enum;
61
- } ? Enum extends ReadonlyArray<any> ? Enum[number] : never : T extends {
62
- oneOf: infer Schemas;
63
- } ? Schemas extends ReadonlyArray<Schema> ? FromOneOfSchema<Schemas, Decrement<Depth>> : never : T extends {
64
- type: 'number' | 'integer';
65
- } ? number : T extends {
66
- type: 'string';
67
- } ? string : T extends {
68
- type: 'boolean';
69
- } ? boolean : T extends {
70
- type: 'null';
71
- } ? null : T extends {
72
- type: 'array';
73
- } | {
74
- items: any;
75
- } ? FromSchemaArray<T, Decrement<Depth>> : T extends {
76
- type: 'object';
77
- } | {
78
- properties: any;
79
- } ? FromSchemaObject<T, Decrement<Depth>> : any>;
80
- type Decrement<N extends number> = ((...x: any[]) => void) extends (arg: any, ...rest: infer R) => void ? R['length'] : never;
81
- type FromSchemaArray<T, Depth extends number> = T extends {
82
- items: infer Items;
83
- } ? T extends {
84
- minItems: infer Min;
85
- maxItems: infer Max;
86
- } ? Equal<Min, Max> extends true ? BuildTuple<FromSchema<Items, Depth>, Min> : FromSchema<Items, Depth>[] : FromSchema<Items, Depth>[] : any[];
87
- type BuildTuple<T, N, R extends unknown[] = []> = R['length'] extends N ? R : BuildTuple<T, N, [...R, T]>;
88
- type FromSchemaObject<T extends Schema, Depth extends number> = T extends {
89
- properties: infer P;
90
- } ? Simplify<{
91
- [K in RequiredKeys<T>]: FromSchema<P[K], Depth>;
92
- } & {
93
- [K in OptionalKeys<T>]?: FromSchema<P[K], Depth>;
94
- } & (T extends {
95
- additionalProperties: infer AP;
96
- } ? AP extends false ? {} : AP extends Schema ? {
97
- [key: string]: FromSchema<AP, Depth>;
98
- } : {
99
- [key: string]: any;
100
- } : {
101
- [key: string]: any;
102
- })> : T extends {
103
- additionalProperties: infer AP;
104
- } ? AP extends Schema ? {
105
- [key: string]: FromSchema<AP, Depth>;
106
- } : {
107
- [key: string]: any;
108
- } : {
109
- [key: string]: any;
110
- };
111
- type RequiredKeys<T> = T extends {
112
- required: infer R;
113
- } ? R extends readonly (infer K)[] ? K extends string ? K : never : never : never;
114
- type OptionalKeys<T> = T extends {
115
- properties: infer P;
116
- } ? Exclude<keyof P, RequiredKeys<T>> : never;
117
- type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false;
118
- type Simplify<T> = T extends infer O ? {
119
- [K in keyof O]: O[K];
120
- } : never;
121
- type FromOneOfSchema<Schemas extends ReadonlyArray<Schema>, Depth extends number> = Schemas[number] extends infer S ? S extends Schema ? FromSchema<S, Depth> : never : never;
122
- export {};
@@ -1,34 +0,0 @@
1
- /*MIT License
2
-
3
- © Copyright 2025 Adobe. All rights reserved.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.*/
22
- ;
23
- const mySchema = {
24
- type: 'object',
25
- properties: {
26
- a: { type: 'number' },
27
- b: { type: 'string' },
28
- c: { enum: [1, 2, 3] }
29
- },
30
- required: ['a', 'c'],
31
- additionalProperties: false,
32
- };
33
- export {};
34
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/core/schema/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AA6DV,CAAC;AAiIF,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrB,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrB,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;KACvB;IACD,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IACpB,oBAAoB,EAAE,KAAK;CACF,CAAC"}
@@ -1,45 +0,0 @@
1
- import { Schema } from "../index.js";
2
- export declare function Nullable<T extends Schema>(schema: T): {
3
- oneOf: [T, {
4
- type: "null";
5
- }];
6
- };
7
- export declare function Tuple<T extends Schema, N extends number>(items: T, length: N): {
8
- readonly type: "array";
9
- readonly items: T;
10
- readonly minItems: N;
11
- readonly maxItems: N;
12
- };
13
- export declare const TrueSchema: {
14
- readonly const: true;
15
- };
16
- export declare const BooleanSchema: {
17
- readonly type: "boolean";
18
- };
19
- export declare const Float32Schema: {
20
- readonly type: "number";
21
- readonly precision: 1;
22
- };
23
- export declare const Float64Schema: {
24
- readonly type: "number";
25
- readonly precision: 2;
26
- };
27
- export declare const TimeSchema: {
28
- readonly type: "number";
29
- readonly precision: 2;
30
- };
31
- export declare const Uint8Schema: {
32
- readonly type: "integer";
33
- readonly minimum: 0;
34
- readonly maximum: 255;
35
- };
36
- export declare const Uint16Schema: {
37
- readonly type: "integer";
38
- readonly minimum: 0;
39
- readonly maximum: 65535;
40
- };
41
- export declare const Uint32Schema: {
42
- readonly type: "integer";
43
- readonly minimum: 0;
44
- readonly maximum: 4294967295;
45
- };
@@ -1,39 +0,0 @@
1
- export function Nullable(schema) {
2
- return {
3
- oneOf: [schema, { type: "null" }],
4
- };
5
- }
6
- export function Tuple(items, length) {
7
- return { type: "array", items, minItems: length, maxItems: length };
8
- }
9
- export const TrueSchema = {
10
- const: true,
11
- };
12
- export const BooleanSchema = {
13
- type: "boolean",
14
- };
15
- export const Float32Schema = {
16
- type: "number",
17
- precision: 1,
18
- };
19
- export const Float64Schema = {
20
- type: "number",
21
- precision: 2,
22
- };
23
- export const TimeSchema = Float64Schema;
24
- export const Uint8Schema = {
25
- type: "integer",
26
- minimum: 0,
27
- maximum: 0xff,
28
- };
29
- export const Uint16Schema = {
30
- type: "integer",
31
- minimum: 0,
32
- maximum: 0xffff,
33
- };
34
- export const Uint32Schema = {
35
- type: "integer",
36
- minimum: 0,
37
- maximum: 0xffffffff,
38
- };
39
- //# sourceMappingURL=schemas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/core/schema/schemas.ts"],"names":[],"mappings":"AAuBA,MAAM,UAAU,QAAQ,CACtB,MAAS;IAET,OAAO;QACL,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CAAqC,KAAQ,EAAE,MAAS;IAC3E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAA4B,CAAC;AAChG,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE,IAAI;CACc,CAAC;AAE5B,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,SAAS;CACU,CAAC;AAE5B,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,CAAC;CACa,CAAC;AAE5B,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,CAAC;CACa,CAAC;AAE5B,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;AAExC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,IAAI;CACY,CAAC;AAE5B,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,MAAM;CACU,CAAC;AAE5B,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,UAAU;CACM,CAAC"}
@@ -1,25 +0,0 @@
1
- import { Schema } from "./schema.js";
2
- export type UIProperties = {
3
- name?: string;
4
- icon?: string;
5
- summary?: string;
6
- placeholder?: string;
7
- details?: string;
8
- visible?: boolean;
9
- enabled?: boolean;
10
- infoUrl?: string;
11
- group?: string;
12
- order?: number;
13
- groups?: {
14
- readonly [key: string]: UIProperties;
15
- };
16
- };
17
- export type UISchema = Schema & {
18
- items?: UISchema;
19
- ui?: UIProperties;
20
- properties?: {
21
- readonly [key: string]: UISchema;
22
- };
23
- additionalProperties?: boolean | UISchema;
24
- oneOf?: readonly UISchema[];
25
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ui-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ui-schema.js","sourceRoot":"","sources":["../../../src/core/schema/ui-schema.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import { Schema } from "../schema.js";
2
- export declare function isValid(schema: Schema, data: any): boolean;
@@ -1,14 +0,0 @@
1
- import { validate } from "./validate.js";
2
- export function isValid(schema, data) {
3
- if (data === undefined) {
4
- debugger;
5
- }
6
- try {
7
- return validate(schema, data ?? null).length === 0;
8
- }
9
- catch (error) {
10
- console.error(`Error during validation:`, error);
11
- return false;
12
- }
13
- }
14
- //# sourceMappingURL=is-valid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-valid.js","sourceRoot":"","sources":["../../../../src/core/schema/validation/is-valid.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,OAAO,CAAC,MAAc,EAAE,IAAS;IAC7C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,QAAQ,CAAC;IACb,CAAC;IACD,IAAI,CAAC;QACD,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;QACjD,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-valid.test.js","sourceRoot":"","sources":["../../../../src/core/schema/validation/is-valid.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACrB,MAAM,MAAM,GAAW;QACnB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC1B;QACD,QAAQ,EAAE,CAAC,KAAK,CAAC;KACpB,CAAC;IAEF,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACnC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { Schema } from "../schema.js";
2
- export declare function validate(schema: Schema, data: any): string[];
@@ -1,38 +0,0 @@
1
- /*MIT License
2
-
3
- © Copyright 2025 Adobe. All rights reserved.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.*/
22
- import { Validator } from '@cfworker/json-schema';
23
- // Cache of validators using WeakMap to avoid memory leaks
24
- const validatorCache = new WeakMap();
25
- export function validate(schema, data) {
26
- // Get or create validator from cache
27
- let validator = validatorCache.get(schema);
28
- if (!validator) {
29
- validator = new Validator(schema);
30
- validatorCache.set(schema, validator);
31
- }
32
- const result = validator.validate(data);
33
- if (result.valid) {
34
- return [];
35
- }
36
- return result.errors.map((error) => error.error);
37
- }
38
- //# sourceMappingURL=validate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../src/core/schema/validation/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,OAAO,EAAE,SAAS,EAAwB,MAAM,uBAAuB,CAAC;AAGxE,0DAA0D;AAC1D,MAAM,cAAc,GAAG,IAAI,OAAO,EAAqB,CAAC;AAExD,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,IAAS;IAC9C,qCAAqC;IACrC,IAAI,SAAS,GAAG,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,SAAS,GAAG,IAAI,SAAS,CAAC,MAAoB,CAAC,CAAC;QAChD,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,106 +0,0 @@
1
- /*MIT License
2
-
3
- © Copyright 2025 Adobe. All rights reserved.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.*/
22
- import { describe, it, expect } from 'vitest';
23
- import { validate } from './validate.js';
24
- describe('validate', () => {
25
- const userSchema = {
26
- type: 'object',
27
- properties: {
28
- name: { type: 'string' },
29
- age: { type: 'number' },
30
- email: { type: 'string', pattern: '^[^@]+@[^@]+\\.[^@]+$' }
31
- },
32
- required: ['name', 'age', 'email']
33
- };
34
- it('should return empty array for valid data', () => {
35
- const validData = {
36
- name: 'John Doe',
37
- age: 30,
38
- email: 'john@example.com'
39
- };
40
- const errors = validate(userSchema, validData);
41
- expect(errors).toEqual([]);
42
- });
43
- it('should return validation errors for invalid data', () => {
44
- const invalidData = {
45
- name: 'John Doe',
46
- age: '30', // Should be a number
47
- email: 'not-an-email'
48
- };
49
- const errors = validate(userSchema, invalidData);
50
- expect(errors.length).toBeGreaterThan(0);
51
- expect(errors).toContain('Property "age" does not match schema.');
52
- expect(errors).toContain('Instance type "string" is invalid. Expected "number".');
53
- });
54
- it('should return errors for missing required fields', () => {
55
- const incompleteData = {
56
- name: 'John Doe'
57
- // Missing age and email
58
- };
59
- const errors = validate(userSchema, incompleteData);
60
- expect(errors.length).toBeGreaterThan(0);
61
- expect(errors).toContain('Instance does not have required property "age".');
62
- expect(errors).toContain('Instance does not have required property "email".');
63
- });
64
- it('should reuse validator instance for the same schema', () => {
65
- const data1 = { name: 'John', age: 30, email: 'john@example.com' };
66
- const data2 = { name: 'Jane', age: 25, email: 'jane@example.com' };
67
- // First validation
68
- const errors1 = validate(userSchema, data1);
69
- expect(errors1).toEqual([]);
70
- // Second validation with same schema
71
- const errors2 = validate(userSchema, data2);
72
- expect(errors2).toEqual([]);
73
- // The validator should be reused from the WeakMap cache
74
- // We can verify this by checking that the schema object is still the same reference
75
- expect(userSchema).toBe(userSchema);
76
- });
77
- it('should handle nested schema validation', () => {
78
- const nestedSchema = {
79
- type: 'object',
80
- properties: {
81
- user: userSchema,
82
- metadata: {
83
- type: 'object',
84
- properties: {
85
- createdAt: { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$' }
86
- },
87
- required: ['createdAt']
88
- }
89
- },
90
- required: ['user', 'metadata']
91
- };
92
- const validNestedData = {
93
- user: {
94
- name: 'John Doe',
95
- age: 30,
96
- email: 'john@example.com'
97
- },
98
- metadata: {
99
- createdAt: '2024-03-20T12:00:00Z'
100
- }
101
- };
102
- const errors = validate(nestedSchema, validNestedData);
103
- expect(errors).toEqual([]);
104
- });
105
- });
106
- //# sourceMappingURL=validate.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.test.js","sourceRoot":"","sources":["../../../../src/core/schema/validation/validate.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACtB,MAAM,UAAU,GAAW;QACvB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACvB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,uBAAuB,EAAE;SAC9D;QACD,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC;KACrC,CAAC;IAEF,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAChD,MAAM,SAAS,GAAG;YACd,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,kBAAkB;SAC5B,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,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,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- import { Schema, FromSchema } from '../index.js';
2
- /**
3
- * Creates a function which can wrap another function and validate the input against a JSON Schema.
4
- */
5
- export declare function withValidation<T extends Schema>(schema: T): <F extends (arg: FromSchema<T>) => any>(fn: F) => F;
@@ -1,16 +0,0 @@
1
- import { validate } from './validate.js';
2
- /**
3
- * Creates a function which can wrap another function and validate the input against a JSON Schema.
4
- */
5
- export function withValidation(schema) {
6
- return function (fn) {
7
- return function (arg) {
8
- const errors = validate(schema, arg);
9
- if (errors.length > 0) {
10
- throw new Error(`Validation failed: ${JSON.stringify(errors)}`);
11
- }
12
- return fn.call(this, arg);
13
- };
14
- };
15
- }
16
- //# sourceMappingURL=with-validation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"with-validation.js","sourceRoot":"","sources":["../../../../src/core/schema/validation/with-validation.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,UAAU,cAAc,CAAmB,MAAS;IACtD,OAAO,UAAiD,EAAK;QACzD,OAAO,UAAqB,GAAkB;YAC1C,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAErC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CACX,sBAAsB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CACjD,CAAC;YACN,CAAC;YAED,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAM,CAAC;IACX,CAAC,CAAC;AACN,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,96 +0,0 @@
1
- /*MIT License
2
-
3
- © Copyright 2025 Adobe. All rights reserved.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.*/
22
- import { describe, it, expect } from 'vitest';
23
- import { withValidation } from './with-validation.js';
24
- // Define a test schema
25
- const userSchema = {
26
- type: 'object',
27
- properties: {
28
- name: { type: 'string' },
29
- age: { type: 'number' },
30
- foo: { type: 'string' },
31
- email: { type: 'string', format: 'email' }
32
- },
33
- required: ['name', 'age', 'email']
34
- };
35
- describe('withValidation', () => {
36
- it('should pass validation for valid input', () => {
37
- const createUser = withValidation(userSchema)((user) => user);
38
- const validUser = {
39
- name: 'John Doe',
40
- age: 30,
41
- email: 'john@example.com'
42
- };
43
- expect(() => createUser(validUser)).not.toThrow();
44
- expect(createUser(validUser)).toEqual(validUser);
45
- });
46
- it('should throw error for invalid input', () => {
47
- const createUser = withValidation(userSchema)((user) => user);
48
- const invalidUser = {
49
- name: 'John Doe',
50
- age: '30', // Should be a number
51
- email: 'not-an-email'
52
- };
53
- expect(() => createUser(invalidUser)).toThrow(/Validation failed/);
54
- });
55
- it('should throw error for missing required fields', () => {
56
- const createUser = withValidation(userSchema)((user) => user);
57
- const incompleteUser = {
58
- name: 'John Doe',
59
- // Missing age and email
60
- };
61
- expect(() => createUser(incompleteUser)).toThrow(/Validation failed/);
62
- });
63
- it('should preserve function return type', () => {
64
- const processUser = withValidation(userSchema)((user) => ({
65
- ...user,
66
- processed: true
67
- }));
68
- const result = processUser({
69
- name: 'John Doe',
70
- age: 30,
71
- email: 'john@example.com'
72
- });
73
- expect(result).toEqual({
74
- name: 'John Doe',
75
- age: 30,
76
- email: 'john@example.com',
77
- processed: true
78
- });
79
- });
80
- it("should pass 'this' context to the wrapped function", () => {
81
- const context = { value: 42 };
82
- const fn = function (user) {
83
- return this.value;
84
- };
85
- const wrapped = withValidation(userSchema)(fn);
86
- const validUser = {
87
- name: 'Jane Doe',
88
- age: 25,
89
- email: 'jane@example.com'
90
- };
91
- // Bind context and call
92
- const result = wrapped.call(context, validUser);
93
- expect(result).toBe(42);
94
- });
95
- });
96
- //# sourceMappingURL=with-validation.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"with-validation.test.js","sourceRoot":"","sources":["../../../../src/core/schema/validation/with-validation.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,uBAAuB;AACvB,MAAM,UAAU,GAAG;IACf,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;KAC7C;IACD,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEX,QAAQ,CAAC,gBAAgB,EAAE,GA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