@based/db 0.0.28 → 0.0.30

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 (115) hide show
  1. package/README.md +1 -399
  2. package/dist/lib/darwin_aarch64/include/selva/db.h +8 -4
  3. package/dist/lib/darwin_aarch64/include/selva/fields.h +10 -2
  4. package/dist/lib/darwin_aarch64/include/selva/selva_hash128.h +17 -7
  5. package/dist/lib/darwin_aarch64/include/selva/sort.h +21 -14
  6. package/dist/lib/darwin_aarch64/libdeflate.dylib +0 -0
  7. package/dist/lib/darwin_aarch64/libjemalloc_selva.2.dylib +0 -0
  8. package/dist/lib/darwin_aarch64/libnode-v20.node +0 -0
  9. package/dist/lib/darwin_aarch64/libnode-v21.node +0 -0
  10. package/dist/lib/darwin_aarch64/libnode-v22.node +0 -0
  11. package/dist/lib/darwin_aarch64/libnode-v23.node +0 -0
  12. package/dist/lib/darwin_aarch64/libselva.dylib +0 -0
  13. package/dist/lib/darwin_aarch64/libxxhash.dylib +0 -0
  14. package/dist/lib/linux_aarch64/include/selva/db.h +8 -4
  15. package/dist/lib/linux_aarch64/include/selva/fields.h +10 -2
  16. package/dist/lib/linux_aarch64/include/selva/selva_hash128.h +17 -7
  17. package/dist/lib/linux_aarch64/include/selva/sort.h +21 -14
  18. package/dist/lib/linux_aarch64/libdeflate.so +0 -0
  19. package/dist/lib/linux_aarch64/libjemalloc_selva.so.2 +0 -0
  20. package/dist/lib/linux_aarch64/libnode-v20.node +0 -0
  21. package/dist/lib/linux_aarch64/libnode-v21.node +0 -0
  22. package/dist/lib/linux_aarch64/libnode-v22.node +0 -0
  23. package/dist/lib/linux_aarch64/libnode-v23.node +0 -0
  24. package/dist/lib/linux_aarch64/libselva.so +0 -0
  25. package/dist/lib/linux_x86_64/include/selva/db.h +8 -4
  26. package/dist/lib/linux_x86_64/include/selva/fields.h +10 -2
  27. package/dist/lib/linux_x86_64/include/selva/selva_hash128.h +17 -7
  28. package/dist/lib/linux_x86_64/include/selva/sort.h +21 -14
  29. package/dist/lib/linux_x86_64/libjemalloc_selva.so.2 +0 -0
  30. package/dist/lib/linux_x86_64/libnode-v20.node +0 -0
  31. package/dist/lib/linux_x86_64/libnode-v21.node +0 -0
  32. package/dist/lib/linux_x86_64/libnode-v22.node +0 -0
  33. package/dist/lib/linux_x86_64/libnode-v23.node +0 -0
  34. package/dist/lib/linux_x86_64/libselva.so +0 -0
  35. package/dist/src/client/flushModify.d.ts +1 -1
  36. package/dist/src/client/flushModify.js +15 -19
  37. package/dist/src/client/index.d.ts +8 -10
  38. package/dist/src/client/index.js +19 -8
  39. package/dist/src/client/modify/ModifyRes.d.ts +2 -4
  40. package/dist/src/client/modify/ModifyRes.js +15 -21
  41. package/dist/src/client/modify/create.js +1 -2
  42. package/dist/src/client/modify/delete.js +1 -2
  43. package/dist/src/client/modify/fixed.js +43 -8
  44. package/dist/src/client/modify/modify.js +0 -5
  45. package/dist/src/client/modify/references/{appendRefs.d.ts → appendEdgeRefs.d.ts} +1 -1
  46. package/dist/src/client/modify/references/{appendRefs.js → appendEdgeRefs.js} +5 -2
  47. package/dist/src/client/modify/references/edge.js +182 -175
  48. package/dist/src/client/modify/references/reference.js +4 -8
  49. package/dist/src/client/modify/references/references.js +18 -14
  50. package/dist/src/client/modify/setCursor.js +1 -1
  51. package/dist/src/client/modify/string.js +0 -3
  52. package/dist/src/client/modify/text.js +11 -3
  53. package/dist/src/client/modify/types.d.ts +11 -0
  54. package/dist/src/client/modify/types.js +10 -0
  55. package/dist/src/client/modify/update.js +5 -3
  56. package/dist/src/client/modify/vector.js +13 -4
  57. package/dist/src/client/query/BasedDbQuery.d.ts +1 -1
  58. package/dist/src/client/query/BasedDbQuery.js +2 -2
  59. package/dist/src/client/query/BasedIterable.d.ts +1 -1
  60. package/dist/src/client/query/BasedIterable.js +7 -2
  61. package/dist/src/client/query/filter/createFixedFilterBuffer.d.ts +2 -1
  62. package/dist/src/client/query/filter/createFixedFilterBuffer.js +11 -28
  63. package/dist/src/client/query/filter/createReferenceFilter.d.ts +2 -1
  64. package/dist/src/client/query/filter/createReferenceFilter.js +10 -9
  65. package/dist/src/client/query/filter/createVariableFilterBuffer.d.ts +2 -1
  66. package/dist/src/client/query/filter/createVariableFilterBuffer.js +8 -10
  67. package/dist/src/client/query/filter/parseFilterValue.js +1 -1
  68. package/dist/src/client/query/filter/primitiveFilter.js +9 -9
  69. package/dist/src/client/query/filter/toBuffer.js +0 -15
  70. package/dist/src/client/query/filter/types.d.ts +1 -0
  71. package/dist/src/client/query/filter/types.js +1 -0
  72. package/dist/src/client/query/include/walk.js +0 -1
  73. package/dist/src/client/query/read/read.js +16 -7
  74. package/dist/src/client/query/search/index.js +11 -15
  75. package/dist/src/client/query/subscription/index.d.ts +1 -2
  76. package/dist/src/client/query/subscription/index.js +3 -50
  77. package/dist/src/client/query/subscription/markers.js +1 -2
  78. package/dist/src/client/query/subscription/run.js +0 -2
  79. package/dist/src/client/query/subscription/types.d.ts +1 -29
  80. package/dist/src/client/query/subscription/types.js +8 -1
  81. package/dist/src/client/query/thresholds.d.ts +0 -2
  82. package/dist/src/client/query/thresholds.js +0 -2
  83. package/dist/src/client/query/toBuffer.js +16 -42
  84. package/dist/src/client/query/types.d.ts +3 -2
  85. package/dist/src/client/query/validation.d.ts +1 -3
  86. package/dist/src/client/query/validation.js +6 -18
  87. package/dist/src/client/string.d.ts +2 -0
  88. package/dist/src/client/string.js +10 -14
  89. package/dist/src/index.d.ts +1 -1
  90. package/dist/src/index.js +11 -15
  91. package/dist/src/native.d.ts +3 -3
  92. package/dist/src/native.js +6 -4
  93. package/dist/src/server/csmt/draw-dot.js +2 -2
  94. package/dist/src/server/csmt/tree.js +57 -6
  95. package/dist/src/server/csmt/types.d.ts +5 -0
  96. package/dist/src/server/index.d.ts +4 -3
  97. package/dist/src/server/index.js +44 -44
  98. package/dist/src/server/migrate/index.js +47 -29
  99. package/dist/src/server/migrate/worker.js +2 -2
  100. package/dist/src/server/save.js +40 -28
  101. package/dist/src/server/start.js +7 -19
  102. package/dist/src/server/tree.d.ts +2 -0
  103. package/dist/src/server/tree.js +34 -2
  104. package/dist/src/server/worker.js +3 -3
  105. package/dist/src/utils.d.ts +3 -1
  106. package/dist/src/utils.js +43 -19
  107. package/package.json +9 -3
  108. package/dist/lib/darwin_aarch64/include/selva/base64.h +0 -59
  109. package/dist/lib/darwin_aarch64/include/selva/base64url.h +0 -59
  110. package/dist/lib/linux_aarch64/include/selva/base64.h +0 -59
  111. package/dist/lib/linux_aarch64/include/selva/base64url.h +0 -59
  112. package/dist/lib/linux_x86_64/include/selva/base64.h +0 -59
  113. package/dist/lib/linux_x86_64/include/selva/base64url.h +0 -59
  114. package/dist/src/client/timestamp.d.ts +0 -1
  115. package/dist/src/client/timestamp.js +0 -68
@@ -1,59 +0,0 @@
1
- /*
2
- * Base64 encoding/decoding (RFC1341)
3
- * Copyright (c) 2021-2025 SAULX
4
- * Copyright (c) 2005-2011, Jouni Malinen <j@w1.fi>
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- #pragma once
8
-
9
- #include "selva/_export.h"
10
-
11
- SELVA_EXPORT
12
- size_t base64_encode_s(char *out, const char *str_in, size_t len, size_t line_max)
13
- __attribute__((access(write_only, 1), access(read_only, 2, 3)));
14
-
15
- /**
16
- * base64_encode - Base64 encode
17
- * Caller is responsible for freeing the returned buffer. Returned buffer is
18
- * nul terminated to make it easier to use as a C string. The nul terminator is
19
- * not included in out_len.
20
- * @parma str_in Data to be encoded
21
- * @param len Length of the data to be encoded
22
- * @param out_len Pointer to output length variable, or NULL if not used
23
- * @returns Allocated buffer of out_len bytes of encoded data,
24
- * or %NULL on failure
25
- */
26
- [[nodiscard]]
27
- SELVA_EXPORT
28
- char * base64_encode(const char *str_in, size_t len, size_t *out_len)
29
- __attribute__((access(read_only, 1, 2), access(read_only, 3)));
30
-
31
- /**
32
- * Base64 decode.
33
- * Caller is responsible for freeing the returned buffer.
34
- * @param str_in Data to be decoded
35
- * @param len Length of the data to be decoded
36
- * @param out_len Pointer to output length variable
37
- * @returns Allocated buffer of out_len bytes of decoded data, or NULL on failure
38
- */
39
- [[nodiscard]]
40
- SELVA_EXPORT
41
- char * base64_decode(const char *str_in, size_t len, size_t *out_len)
42
- __attribute__((access(read_only, 1, 2), access(write_only, 3)));
43
-
44
- /**
45
- * Calculate the required buffer size of a string of n bytes.
46
- * @param line_max is the max line length. 0 = no limit; 72 = typical.
47
- */
48
- static inline size_t base64_out_len(size_t n, size_t line_max) {
49
- size_t olen;
50
-
51
- /* This version would be with padding but we don't pad */
52
- #if 0
53
- olen = n * 4 / 3 + 4; /* 3-byte blocks to 4-byte */
54
- #endif
55
- olen = ((4 * n / 3) + 3) & ~3;
56
- olen += line_max > 0 ? olen / line_max : 0; /* line feeds */
57
-
58
- return olen;
59
- }
@@ -1,59 +0,0 @@
1
- /*
2
- * Base64url encoding/decoding (RFC4648)
3
- * Copyright (c) 2021-2025 SAULX
4
- * Copyright (c) 2005-2011, Jouni Malinen <j@w1.fi>
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- #pragma once
8
-
9
- #include "selva/_export.h"
10
-
11
- SELVA_EXPORT
12
- size_t base64url_encode_s(char *out, const char *str_in, size_t len, size_t line_max)
13
- __attribute__((access(write_only, 1), access(read_only, 2, 3)));
14
-
15
- /**
16
- * base64url_encode - Base64url encode
17
- * Caller is responsible for freeing the returned buffer. Returned buffer is
18
- * nul terminated to make it easier to use as a C string. The nul terminator is
19
- * not included in out_len.
20
- * @parma str_in Data to be encoded
21
- * @param len Length of the data to be encoded
22
- * @param out_len Pointer to output length variable, or NULL if not used
23
- * @returns Allocated buffer of out_len bytes of encoded data,
24
- * or %NULL on failure
25
- */
26
- [[nodiscard]]
27
- SELVA_EXPORT
28
- char * base64url_encode(const char *str_in, size_t len, size_t *out_len)
29
- __attribute__((access(read_only, 1, 2), access(read_only, 3)));
30
-
31
- /**
32
- * Base64url decode.
33
- * Caller is responsible for freeing the returned buffer.
34
- * @param str_in Data to be decoded
35
- * @param len Length of the data to be decoded
36
- * @param out_len Pointer to output length variable
37
- * @returns Allocated buffer of out_len bytes of decoded data, or NULL on failure
38
- */
39
- [[nodiscard]]
40
- SELVA_EXPORT
41
- char * base64url_decode(const char *str_in, size_t len, size_t *out_len)
42
- __attribute__((access(read_only, 1, 2), access(write_only, 3)));
43
-
44
- /**
45
- * Calculate the required buffer size of a string of n bytes.
46
- * @param line_max is the max line length. 0 = no limit; 72 = typical.
47
- */
48
- static inline size_t base64url_out_len(size_t n, size_t line_max) {
49
- size_t olen;
50
-
51
- /* This version would be with padding but we don't pad */
52
- #if 0
53
- olen = n * 4 / 3 + 4; /* 3-byte blocks to 4-byte */
54
- #endif
55
- olen = ((4 * n / 3) + 3) & ~3;
56
- olen += line_max > 0 ? olen / line_max : 0; /* line feeds */
57
-
58
- return olen;
59
- }
@@ -1 +0,0 @@
1
- export declare const convertToTimestamp: (value: string | Date | number) => number;
@@ -1,68 +0,0 @@
1
- const timeToNumber = (ex) => {
2
- if (ex === 's') {
3
- return 1000;
4
- }
5
- if (ex === 'm') {
6
- return 1000 * 60;
7
- }
8
- if (ex === 'h') {
9
- return 1000 * 60 * 60;
10
- }
11
- if (ex === 'd') {
12
- return 1000 * 60 * 60 * 24;
13
- }
14
- if (ex === 'y') {
15
- return 31556952000;
16
- }
17
- return 1;
18
- };
19
- export const convertToTimestamp = (value) => {
20
- if (value instanceof Date) {
21
- return value.valueOf();
22
- }
23
- if (typeof value === 'string') {
24
- if (value === 'now') {
25
- return Date.now();
26
- }
27
- // MAKE THIS INTO A UTIL
28
- const y = value.replace(/([+-])/g, ' $1 ');
29
- const arr = y.split(/ +/);
30
- let newValue = 0;
31
- let now;
32
- let op = 1;
33
- for (const seg of arr) {
34
- if (seg === '-') {
35
- op = -1;
36
- }
37
- else if (seg === '+') {
38
- op = 1;
39
- }
40
- else {
41
- var v = 0;
42
- if (seg === 'now') {
43
- if (!now) {
44
- now = Date.now();
45
- }
46
- v = now;
47
- }
48
- else if (/[smhdy]$/.test(seg)) {
49
- const ex = seg[seg.length - 1];
50
- const number = parseInt(seg, 10);
51
- v = number * timeToNumber(ex);
52
- }
53
- else if (seg) {
54
- v = new Date(seg).valueOf();
55
- }
56
- if (op === -1) {
57
- newValue -= v;
58
- }
59
- else {
60
- newValue += v;
61
- }
62
- }
63
- }
64
- return newValue;
65
- }
66
- return value;
67
- };
68
- //# sourceMappingURL=timestamp.js.map