Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: oliver-oloughlin/kvdex
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.18.1
Choose a base ref
...
head repository: oliver-oloughlin/kvdex
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 24,033 additions and 5,731 deletions.
  1. +16 −0 .github/workflows/publish.yml
  2. +13 −16 .github/workflows/test.yml
  3. +25 −0 .github/workflows/test_map_kv.yml
  4. +39 −0 .github/workflows/test_minimum_deno_version.yml
  5. +1 −1 LICENSE
  6. +1,040 −284 README.md
  7. +10 −0 benchmarks/collection/add.bench.ts
  8. +12 −0 benchmarks/collection/count.bench.ts
  9. +13 −0 benchmarks/collection/delete.bench.ts
  10. +12 −0 benchmarks/collection/deleteMany.bench.ts
  11. +13 −0 benchmarks/collection/find.bench.ts
  12. +18 −0 benchmarks/collection/findMany.bench.ts
  13. +12 −0 benchmarks/collection/getMany.bench.ts
  14. +56 −0 benchmarks/collection/update.bench.ts
  15. +17 −0 benchmarks/db/countAll.bench.ts
  16. +17 −0 benchmarks/db/deleteAll.bench.ts
  17. +140 −0 benchmarks/db/kvdex.bench.ts
  18. +10 −0 benchmarks/indexable_collection/add.bench.ts
  19. +12 −0 benchmarks/indexable_collection/count.bench.ts
  20. +13 −0 benchmarks/indexable_collection/delete.bench.ts
  21. +12 −0 benchmarks/indexable_collection/deleteByPrimaryIndex.bench.ts
  22. +12 −0 benchmarks/indexable_collection/deleteMany.bench.ts
  23. +13 −0 benchmarks/indexable_collection/find.bench.ts
  24. +12 −0 benchmarks/indexable_collection/findByPrimaryIndex.bench.ts
  25. +12 −0 benchmarks/indexable_collection/findBySecondaryIndex.bench.ts
  26. +18 −0 benchmarks/indexable_collection/findMany.bench.ts
  27. +12 −0 benchmarks/indexable_collection/getMany.bench.ts
  28. +43 −0 benchmarks/indexable_collection/update.bench.ts
  29. +58 −0 benchmarks/indexable_collection/updateByPrimaryIndex.bench.ts
  30. +10 −0 benchmarks/serialized_collection/add.bench.ts
  31. +12 −0 benchmarks/serialized_collection/count.bench.ts
  32. +13 −0 benchmarks/serialized_collection/delete.bench.ts
  33. +12 −0 benchmarks/serialized_collection/deleteMany.bench.ts
  34. +13 −0 benchmarks/serialized_collection/find.bench.ts
  35. +18 −0 benchmarks/serialized_collection/findMany.bench.ts
  36. +12 −0 benchmarks/serialized_collection/getMany.bench.ts
  37. +56 −0 benchmarks/serialized_collection/update.bench.ts
  38. +10 −0 benchmarks/serialized_indexable_collection/add.bench.ts
  39. +12 −0 benchmarks/serialized_indexable_collection/count.bench.ts
  40. +13 −0 benchmarks/serialized_indexable_collection/delete.bench.ts
  41. +15 −0 benchmarks/serialized_indexable_collection/deleteByPrimaryIndex.bench.ts
  42. +15 −0 benchmarks/serialized_indexable_collection/deleteMany.bench.ts
  43. +13 −0 benchmarks/serialized_indexable_collection/find.bench.ts
  44. +15 −0 benchmarks/serialized_indexable_collection/findByPrimaryIndex.bench.ts
  45. +15 −0 benchmarks/serialized_indexable_collection/findBySecondaryIndex.bench.ts
  46. +18 −0 benchmarks/serialized_indexable_collection/findMany.bench.ts
  47. +12 −0 benchmarks/serialized_indexable_collection/getMany.bench.ts
  48. +46 −0 benchmarks/serialized_indexable_collection/update.bench.ts
  49. +61 −0 benchmarks/serialized_indexable_collection/updateByPrimaryIndex.bench.ts
  50. +26 −0 benchmarks/utils/_object.ts
  51. +24 −0 benchmarks/utils/deserialize.bench.ts
  52. +10 −0 benchmarks/utils/encoder.bench.ts
  53. +10 −0 benchmarks/utils/serialize.bench.ts
  54. +42 −0 deno.json
  55. +0 −12 deno.jsonc
  56. +147 −0 deno.lock
  57. +8 −16 mod.ts
  58. +254 −236 src/atomic_builder.ts
  59. +66 −0 src/atomic_pool.ts
  60. +156 −0 src/atomic_wrapper.ts
  61. +2,294 −393 src/collection.ts
  62. +30 −11 src/constants.ts
  63. +15 −15 src/document.ts
  64. +3 −8 src/errors.ts
  65. +57 −0 src/ext/encoding/brotli/brotli_compressor.ts
  66. +21 −0 src/ext/encoding/brotli/mod.ts
  67. +9 −0 src/ext/encoding/brotli/types.ts
  68. +21 −0 src/ext/encoding/json/json_encoder.ts
  69. +59 −0 src/ext/encoding/json/mod.ts
  70. +7 −0 src/ext/encoding/json/types.ts
  71. +569 −0 src/ext/encoding/json/utils.ts
  72. +107 −0 src/ext/encoding/mod.ts
  73. +37 −0 src/ext/encoding/v8/mod.ts
  74. +7 −0 src/ext/encoding/v8/types.ts
  75. +112 −0 src/ext/encoding/v8/utils.ts
  76. +23 −0 src/ext/encoding/v8/v8_encoder.ts
  77. +64 −0 src/ext/kv/async_lock.ts
  78. +153 −0 src/ext/kv/atomic.ts
  79. +269 −0 src/ext/kv/map_kv.ts
  80. +55 −0 src/ext/kv/mod.ts
  81. +60 −0 src/ext/kv/storage_adapter.ts
  82. +79 −0 src/ext/kv/types.ts
  83. +145 −0 src/ext/kv/utils.ts
  84. +72 −0 src/ext/kv/watcher.ts
  85. +10 −0 src/ext/migrate/errors.ts
  86. +32 −0 src/ext/migrate/migrate.ts
  87. +72 −0 src/ext/migrate/mod.ts
  88. +17 −0 src/ext/migrate/types.ts
  89. +28 −0 src/ext/zod/mod.ts
  90. +54 −0 src/ext/zod/schemas.ts
  91. +0 −527 src/indexable_collection.ts
  92. +371 −204 src/kvdex.ts
  93. +0 −406 src/large_collection.ts
  94. +22 −4 src/model.ts
  95. +927 −251 src/types.ts
  96. +281 −230 src/utils.ts
  97. +24 −23 tests/collection/add.test.ts
  98. +30 −33 tests/collection/addMany.test.ts
  99. +13 −13 tests/collection/count.test.ts
  100. +27 −25 tests/collection/delete.test.ts
  101. +13 −13 tests/collection/deleteMany.test.ts
  102. +75 −38 tests/collection/enqueue.test.ts
  103. +16 −16 tests/collection/find.test.ts
  104. +19 −18 tests/collection/findMany.test.ts
  105. +15 −15 tests/collection/forEach.test.ts
  106. +11 −12 tests/collection/getMany.test.ts
  107. +20 −0 tests/collection/getOne.test.ts
  108. +223 −0 tests/collection/history.test.ts
  109. +54 −39 tests/collection/listenQueue.test.ts
  110. +11 −12 tests/collection/map.test.ts
  111. +232 −103 tests/collection/properties.test.ts
  112. +49 −30 tests/collection/set.test.ts
  113. +31 −0 tests/collection/types.test.ts
  114. +206 −74 tests/collection/update.test.ts
  115. +249 −86 tests/collection/updateMany.test.ts
  116. +308 −0 tests/collection/updateOne.test.ts
  117. +133 −0 tests/collection/upsert.test.ts
  118. +70 −0 tests/collection/watch.test.ts
  119. +117 −0 tests/collection/watchMany.test.ts
  120. +0 −59 tests/collection/write.test.ts
  121. +256 −163 tests/db/atomic.test.ts
  122. +18 −16 tests/db/countAll.test.ts
  123. +0 −37 tests/db/cron.test.ts
  124. +58 −22 tests/db/deleteAll.test.ts
  125. +95 −44 tests/db/enqueue.test.ts
  126. +44 −44 tests/db/indexable_atomic.test.ts
  127. +19 −16 tests/db/kvdex.test.ts
  128. +44 −34 tests/db/listenQueue.test.ts
  129. +65 −0 tests/db/loop.test.ts
  130. +16 −0 tests/db/properties.test.ts
  131. +48 −0 tests/db/setInterval.test.ts
  132. +0 −183 tests/db/types.test.ts
  133. +68 −0 tests/db/wipe.test.ts
  134. +0 −4 tests/deps.ts
  135. +32 −32 tests/document/flat.test.ts
  136. +19 −18 tests/document/properties.test.ts
  137. +64 −0 tests/ext/encoder.test.ts
  138. +191 −0 tests/ext/kv.test.ts
  139. +787 −0 tests/ext/migrate.test.ts
  140. +178 −0 tests/ext/zod.test.ts
  141. +31 −31 tests/indexable_collection/add.test.ts
  142. +36 −40 tests/indexable_collection/addMany.test.ts
  143. +12 −13 tests/indexable_collection/count.test.ts
  144. +28 −0 tests/indexable_collection/countBySecondaryIndex.test.ts
  145. +43 −0 tests/indexable_collection/countBySecondaryOrder.test.ts
  146. +35 −33 tests/indexable_collection/delete.test.ts
  147. +23 −23 tests/indexable_collection/deleteByPrimaryIndex.test.ts
  148. +22 −22 tests/indexable_collection/deleteBySecondaryIndex.test.ts
  149. +22 −22 tests/indexable_collection/deleteMany.test.ts
  150. +28 −0 tests/indexable_collection/deleteManyBySecondaryOrder.test.ts
  151. +77 −41 tests/indexable_collection/enqueue.test.ts
  152. +16 −16 tests/indexable_collection/find.test.ts
  153. +35 −16 tests/indexable_collection/findByPrimaryIndex.test.ts
  154. +41 −20 tests/indexable_collection/findBySecondaryIndex.test.ts
  155. +19 −20 tests/indexable_collection/findMany.test.ts
  156. +14 −15 tests/indexable_collection/forEach.test.ts
  157. +29 −0 tests/indexable_collection/forEachBySecondaryIndex.test.ts
  158. +32 −0 tests/indexable_collection/forEachBySecondaryOrder.test.ts
  159. +12 −12 tests/indexable_collection/getMany.test.ts
  160. +23 −0 tests/indexable_collection/getManyBySecondaryOrder.test.ts
  161. +20 −0 tests/indexable_collection/getOne.test.ts
  162. +26 −0 tests/indexable_collection/getOneBySecondaryIndex.test.ts
  163. +17 −0 tests/indexable_collection/getOneBySecondaryOrder.test.ts
  164. +278 −0 tests/indexable_collection/history.test.ts
  165. +54 −42 tests/indexable_collection/listenQueue.test.ts
  166. +11 −12 tests/indexable_collection/map.test.ts
  167. +26 −0 tests/indexable_collection/mapBySecondaryIndex.test.ts
  168. +29 −0 tests/indexable_collection/mapBySecondaryOrder.test.ts
  169. +842 −110 tests/indexable_collection/properties.test.ts
  170. +85 −40 tests/indexable_collection/set.test.ts
  171. +31 −0 tests/indexable_collection/types.test.ts
  172. +197 −52 tests/indexable_collection/update.test.ts
  173. +175 −52 tests/indexable_collection/updateByPrimaryIndex.test.ts
  174. +155 −39 tests/indexable_collection/updateBySecondaryIndex.test.ts
  175. +135 −39 tests/indexable_collection/updateMany.test.ts
  176. +219 −0 tests/indexable_collection/updateManyBySecondaryOrder.test.ts
  177. +171 −0 tests/indexable_collection/updateOne.test.ts
  178. +192 −0 tests/indexable_collection/updateOneBySecondaryIndex.test.ts
  179. +205 −0 tests/indexable_collection/updateOneBySecondaryOrder.test.ts
  180. +133 −0 tests/indexable_collection/upsert.test.ts
  181. +134 −0 tests/indexable_collection/upsertByPrimaryIndex.test.ts
  182. +74 −0 tests/indexable_collection/watch.test.ts
  183. +120 −0 tests/indexable_collection/watchMany.test.ts
  184. +0 −85 tests/indexable_collection/write.test.ts
  185. +0 −41 tests/large_collection/add.test.ts
  186. +0 −60 tests/large_collection/addMany.test.ts
  187. +0 −22 tests/large_collection/count.test.ts
  188. +0 −45 tests/large_collection/delete.test.ts
  189. +0 −20 tests/large_collection/deleteMany.test.ts
  190. +0 −68 tests/large_collection/enqueue.test.ts
  191. +0 −25 tests/large_collection/find.test.ts
  192. +0 −33 tests/large_collection/findMany.test.ts
  193. +0 −28 tests/large_collection/forEach.test.ts
  194. +0 −21 tests/large_collection/getMany.test.ts
  195. +0 −72 tests/large_collection/listenQueue.test.ts
  196. +0 −25 tests/large_collection/map.test.ts
  197. +0 −193 tests/large_collection/properties.test.ts
  198. +0 −49 tests/large_collection/set.test.ts
  199. +0 −110 tests/large_collection/update.test.ts
  200. +0 −145 tests/large_collection/updateMany.test.ts
  201. +0 −59 tests/large_collection/write.test.ts
  202. +29 −4 tests/mocks.ts
  203. +18 −5 tests/models.ts
  204. +45 −0 tests/serialized_collection/add.test.ts
  205. +58 −0 tests/serialized_collection/addMany.test.ts
  206. +21 −0 tests/serialized_collection/count.test.ts
  207. +47 −0 tests/serialized_collection/delete.test.ts
  208. +20 −0 tests/serialized_collection/deleteMany.test.ts
  209. +106 −0 tests/serialized_collection/enqueue.test.ts
  210. +25 −0 tests/serialized_collection/find.test.ts
  211. +32 −0 tests/serialized_collection/findMany.test.ts
  212. +27 −0 tests/serialized_collection/forEach.test.ts
  213. +20 −0 tests/serialized_collection/getMany.test.ts
  214. +20 −0 tests/serialized_collection/getOne.test.ts
  215. +254 −0 tests/serialized_collection/history.test.ts
  216. +85 −0 tests/serialized_collection/listenQueue.test.ts
  217. +24 −0 tests/serialized_collection/map.test.ts
  218. +317 −0 tests/serialized_collection/properties.test.ts
  219. +68 −0 tests/serialized_collection/set.test.ts
  220. +35 −0 tests/serialized_collection/types.test.ts
  221. +242 −0 tests/serialized_collection/update.test.ts
  222. +306 −0 tests/serialized_collection/updateMany.test.ts
  223. +310 −0 tests/serialized_collection/updateOne.test.ts
  224. +133 −0 tests/serialized_collection/upsert.test.ts
  225. +70 −0 tests/serialized_collection/watch.test.ts
  226. +122 −0 tests/serialized_collection/watchMany.test.ts
  227. +57 −0 tests/serialized_indexable_collection/add.test.ts
  228. +73 −0 tests/serialized_indexable_collection/addMany.test.ts
  229. +21 −0 tests/serialized_indexable_collection/count.test.ts
  230. +28 −0 tests/serialized_indexable_collection/countBySecondaryIndex.test.ts
  231. +43 −0 tests/serialized_indexable_collection/countBySecondaryOrder.test.ts
  232. +68 −0 tests/serialized_indexable_collection/delete.test.ts
  233. +47 −0 tests/serialized_indexable_collection/deleteByPrimaryIndex.test.ts
  234. +49 −0 tests/serialized_indexable_collection/deleteBySecondaryIndex.test.ts
  235. +46 −0 tests/serialized_indexable_collection/deleteMany.test.ts
  236. +28 −0 tests/serialized_indexable_collection/deleteManyBySecondaryOrder.test.ts
  237. +110 −0 tests/serialized_indexable_collection/enqueue.test.ts
  238. +26 −0 tests/serialized_indexable_collection/find.test.ts
  239. +52 −0 tests/serialized_indexable_collection/findByPrimaryIndex.test.ts
  240. +61 −0 tests/serialized_indexable_collection/findBySecondaryIndex.test.ts
  241. +32 −0 tests/serialized_indexable_collection/findMany.test.ts
  242. +27 −0 tests/serialized_indexable_collection/forEach.test.ts
  243. +29 −0 tests/serialized_indexable_collection/forEachBySecondaryIndex.test.ts
  244. +32 −0 tests/serialized_indexable_collection/forEachBySecondaryOrder.test.ts
  245. +20 −0 tests/serialized_indexable_collection/getMany.test.ts
  246. +23 −0 tests/serialized_indexable_collection/getManyBySecondaryOrder.test.ts
  247. +20 −0 tests/serialized_indexable_collection/getOne.test.ts
  248. +26 −0 tests/serialized_indexable_collection/getOneBySecondaryIndex.test.ts
  249. +17 −0 tests/serialized_indexable_collection/getOneBySecondaryOrder.test.ts
  250. +286 −0 tests/serialized_indexable_collection/history.test.ts
  251. +96 −0 tests/serialized_indexable_collection/listenQueue.test.ts
  252. +24 −0 tests/serialized_indexable_collection/map.test.ts
  253. +26 −0 tests/serialized_indexable_collection/mapBySecondaryIndex.test.ts
  254. +29 −0 tests/serialized_indexable_collection/mapBySecondaryOrder.test.ts
  255. +961 −0 tests/serialized_indexable_collection/properties.test.ts
  256. +122 −0 tests/serialized_indexable_collection/set.test.ts
  257. +33 −0 tests/serialized_indexable_collection/types.test.ts
  258. +235 −0 tests/serialized_indexable_collection/update.test.ts
  259. +222 −0 tests/serialized_indexable_collection/updateByPrimaryIndex.test.ts
  260. +202 −0 tests/serialized_indexable_collection/updateBySecondaryIndex.test.ts
  261. +172 −0 tests/serialized_indexable_collection/updateMany.test.ts
  262. +219 −0 tests/serialized_indexable_collection/updateManyBySecondaryOrder.test.ts
  263. +171 −0 tests/serialized_indexable_collection/updateOne.test.ts
  264. +192 −0 tests/serialized_indexable_collection/updateOneBySecondaryIndex.test.ts
  265. +205 −0 tests/serialized_indexable_collection/updateOneBySecondaryOrder.test.ts
  266. +133 −0 tests/serialized_indexable_collection/upsert.test.ts
  267. +134 −0 tests/serialized_indexable_collection/upsertByPrimaryIndex.test.ts
  268. +70 −0 tests/serialized_indexable_collection/watch.test.ts
  269. +112 −0 tests/serialized_indexable_collection/watchMany.test.ts
  270. +125 −75 tests/utils.ts
  271. +22 −0 tests/utils/isKvObject.test.ts
  272. +121 −0 tests/values.ts
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # The OIDC ID token is used for authentication with JSR.
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
- run: deno publish
29 changes: 13 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow will install Deno then run `deno lint` and `deno test`.
# For more information see: https://github.com/denoland/setup-deno

name: Deno
name: Test

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
branches: ["main", "release/**/*"]

permissions:
contents: read

id-token: write # The OIDC ID token is used for authentication with JSR.

jobs:
test:
runs-on: ubuntu-latest
@@ -26,15 +19,19 @@ jobs:
uses: actions/checkout@v3

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
uses: denoland/setup-deno@v2

- name: Check Types
run: deno task check

- name: Verify formatting
- name: Check formatting
run: deno fmt --check

- name: Run linter
run: deno lint

- name: "Test publish"
run: deno publish --dry-run

- name: Run tests
run: deno test -A --unstable
run: deno task test
25 changes: 25 additions & 0 deletions .github/workflows/test_map_kv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test KV map

on:
push:
branches: ["main"]
pull_request:
branches: ["main", "release/**/*"]

permissions:
contents: read
id-token: write # The OIDC ID token is used for authentication with JSR.

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Setup repo
uses: actions/checkout@v3

- name: Setup Deno
uses: denoland/setup-deno@v2

- name: Run tests
run: deno task test -- map
39 changes: 39 additions & 0 deletions .github/workflows/test_minimum_deno_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test minimum deno version

on:
push:
branches: ["main"]
pull_request:
branches: ["main", "release/**/*"]

permissions:
contents: read
id-token: write # The OIDC ID token is used for authentication with JSR.

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Setup repo
uses: actions/checkout@v3

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.2.0

- name: Check Types
run: deno task check

- name: Check formatting
run: deno fmt --check

- name: Run linter
run: deno lint

- name: "Test publish"
run: deno publish --dry-run

- name: Run tests
run: deno task test
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2023 Oliver Abraham O'Loughlin
Copyright 2025 Oliver Abraham O'Loughlin

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
Loading