@based/db 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/lib/darwin_aarch64/include/selva/hll.h +2 -0
  2. package/dist/lib/darwin_aarch64/include/selva/membar.h +9 -0
  3. package/dist/lib/darwin_aarch64/libdeflate.dylib +0 -0
  4. package/dist/lib/darwin_aarch64/libjemalloc_selva.2.dylib +0 -0
  5. package/dist/lib/darwin_aarch64/libnode-v22.node +0 -0
  6. package/dist/lib/darwin_aarch64/libselva.dylib +0 -0
  7. package/dist/lib/darwin_aarch64/libxxhash.dylib +0 -0
  8. package/dist/src/client/index.d.ts +1 -2
  9. package/dist/src/client/modify/Ctx.js +1 -1
  10. package/dist/src/client/modify/cursor.d.ts +1 -1
  11. package/dist/src/client/modify/cursor.js +2 -2
  12. package/dist/src/client/modify/error.js +0 -2
  13. package/dist/src/client/modify/props/binary.js +2 -1
  14. package/dist/src/client/modify/props/cardinality.js +7 -0
  15. package/dist/src/client/modify/props/object.d.ts +2 -0
  16. package/dist/src/client/modify/props/object.js +50 -17
  17. package/dist/src/client/modify/props/vector.js +25 -7
  18. package/dist/src/client/query/BasedQueryResponse.js +3 -8
  19. package/dist/src/client/query/display.js +9 -16
  20. package/dist/src/client/query/include/toByteCode.js +14 -10
  21. package/dist/src/client/query/queryDefToReadSchema.js +7 -2
  22. package/dist/src/client/query/registerQuery.js +4 -3
  23. package/dist/src/client/query/types.d.ts +1 -0
  24. package/dist/src/client/query/validation.js +4 -1
  25. package/dist/src/client/setLocalClientSchema.d.ts +1 -1
  26. package/dist/src/hooks.d.ts +1 -2
  27. package/dist/src/native.d.ts +2 -0
  28. package/dist/src/native.js +7 -1
  29. package/dist/src/server/index.d.ts +1 -2
  30. package/dist/src/server/index.js +2 -3
  31. package/dist/src/server/migrate/index.d.ts +1 -2
  32. package/dist/src/server/migrate/index.js +3 -2
  33. package/dist/src/server/migrate/worker.js +31 -25
  34. package/dist/src/server/schema.d.ts +7 -3
  35. package/dist/src/server/schema.js +7 -56
  36. package/dist/src/server/workers/DbWorker.js +19 -5
  37. package/dist/src/shared/DbBase.d.ts +1 -1
  38. package/dist/src/shared/Emitter.d.ts +1 -1
  39. package/package.json +6 -6
  40. package/dist/lib/darwin_aarch64/libnode-v23.node +0 -0
  41. package/dist/lib/darwin_aarch64/libnode-v24.node +0 -0
  42. package/dist/lib/linux_aarch64/include/cdefs.h +0 -317
  43. package/dist/lib/linux_aarch64/include/jemalloc.h +0 -468
  44. package/dist/lib/linux_aarch64/include/libdeflate.h +0 -345
  45. package/dist/lib/linux_aarch64/include/libdeflate_strings.h +0 -35
  46. package/dist/lib/linux_aarch64/include/linker_set.h +0 -109
  47. package/dist/lib/linux_aarch64/include/queue.h +0 -627
  48. package/dist/lib/linux_aarch64/include/selva/_export.h +0 -7
  49. package/dist/lib/linux_aarch64/include/selva/align.h +0 -9
  50. package/dist/lib/linux_aarch64/include/selva/backoff_timeout.h +0 -29
  51. package/dist/lib/linux_aarch64/include/selva/bitmap.h +0 -95
  52. package/dist/lib/linux_aarch64/include/selva/colvec.h +0 -71
  53. package/dist/lib/linux_aarch64/include/selva/crc32c.h +0 -17
  54. package/dist/lib/linux_aarch64/include/selva/ctime.h +0 -135
  55. package/dist/lib/linux_aarch64/include/selva/db.h +0 -407
  56. package/dist/lib/linux_aarch64/include/selva/endian.h +0 -301
  57. package/dist/lib/linux_aarch64/include/selva/fast_linear_search.h +0 -27
  58. package/dist/lib/linux_aarch64/include/selva/fast_memcmp.h +0 -18
  59. package/dist/lib/linux_aarch64/include/selva/fast_memmem.h +0 -11
  60. package/dist/lib/linux_aarch64/include/selva/fast_parsei.h +0 -36
  61. package/dist/lib/linux_aarch64/include/selva/fields.h +0 -407
  62. package/dist/lib/linux_aarch64/include/selva/gmtime.h +0 -137
  63. package/dist/lib/linux_aarch64/include/selva/hll.h +0 -83
  64. package/dist/lib/linux_aarch64/include/selva/lpf.h +0 -28
  65. package/dist/lib/linux_aarch64/include/selva/mblen.h +0 -40
  66. package/dist/lib/linux_aarch64/include/selva/membar.h +0 -23
  67. package/dist/lib/linux_aarch64/include/selva/node_id_set.h +0 -43
  68. package/dist/lib/linux_aarch64/include/selva/poptop.h +0 -114
  69. package/dist/lib/linux_aarch64/include/selva/selva_hash128.h +0 -49
  70. package/dist/lib/linux_aarch64/include/selva/selva_lang.h +0 -105
  71. package/dist/lib/linux_aarch64/include/selva/selva_math.h +0 -37
  72. package/dist/lib/linux_aarch64/include/selva/selva_string.h +0 -679
  73. package/dist/lib/linux_aarch64/include/selva/sort.h +0 -140
  74. package/dist/lib/linux_aarch64/include/selva/strsearch.h +0 -43
  75. package/dist/lib/linux_aarch64/include/selva/thread.h +0 -37
  76. package/dist/lib/linux_aarch64/include/selva/timestamp.h +0 -25
  77. package/dist/lib/linux_aarch64/include/selva/types.h +0 -129
  78. package/dist/lib/linux_aarch64/include/selva/vector.h +0 -35
  79. package/dist/lib/linux_aarch64/include/selva_error.h +0 -140
  80. package/dist/lib/linux_aarch64/include/selva_lang_code.h +0 -160
  81. package/dist/lib/linux_aarch64/include/tree.h +0 -852
  82. package/dist/lib/linux_aarch64/libdeflate.so +0 -0
  83. package/dist/lib/linux_aarch64/libjemalloc_selva.so.2 +0 -0
  84. package/dist/lib/linux_aarch64/libnode-v22.node +0 -0
  85. package/dist/lib/linux_aarch64/libnode-v23.node +0 -0
  86. package/dist/lib/linux_aarch64/libnode-v24.node +0 -0
  87. package/dist/lib/linux_aarch64/libselva.so +0 -0
  88. package/dist/lib/linux_aarch64/libxxhash.so.0 +0 -0
  89. package/dist/lib/linux_x86_64/include/cdefs.h +0 -317
  90. package/dist/lib/linux_x86_64/include/jemalloc.h +0 -468
  91. package/dist/lib/linux_x86_64/include/libdeflate.h +0 -345
  92. package/dist/lib/linux_x86_64/include/libdeflate_strings.h +0 -35
  93. package/dist/lib/linux_x86_64/include/linker_set.h +0 -109
  94. package/dist/lib/linux_x86_64/include/queue.h +0 -627
  95. package/dist/lib/linux_x86_64/include/selva/_export.h +0 -7
  96. package/dist/lib/linux_x86_64/include/selva/align.h +0 -9
  97. package/dist/lib/linux_x86_64/include/selva/backoff_timeout.h +0 -29
  98. package/dist/lib/linux_x86_64/include/selva/bitmap.h +0 -95
  99. package/dist/lib/linux_x86_64/include/selva/colvec.h +0 -71
  100. package/dist/lib/linux_x86_64/include/selva/crc32c.h +0 -17
  101. package/dist/lib/linux_x86_64/include/selva/ctime.h +0 -135
  102. package/dist/lib/linux_x86_64/include/selva/db.h +0 -407
  103. package/dist/lib/linux_x86_64/include/selva/endian.h +0 -301
  104. package/dist/lib/linux_x86_64/include/selva/fast_linear_search.h +0 -27
  105. package/dist/lib/linux_x86_64/include/selva/fast_memcmp.h +0 -18
  106. package/dist/lib/linux_x86_64/include/selva/fast_memmem.h +0 -11
  107. package/dist/lib/linux_x86_64/include/selva/fast_parsei.h +0 -36
  108. package/dist/lib/linux_x86_64/include/selva/fields.h +0 -407
  109. package/dist/lib/linux_x86_64/include/selva/gmtime.h +0 -137
  110. package/dist/lib/linux_x86_64/include/selva/hll.h +0 -83
  111. package/dist/lib/linux_x86_64/include/selva/lpf.h +0 -28
  112. package/dist/lib/linux_x86_64/include/selva/mblen.h +0 -40
  113. package/dist/lib/linux_x86_64/include/selva/membar.h +0 -23
  114. package/dist/lib/linux_x86_64/include/selva/node_id_set.h +0 -43
  115. package/dist/lib/linux_x86_64/include/selva/poptop.h +0 -114
  116. package/dist/lib/linux_x86_64/include/selva/selva_hash128.h +0 -49
  117. package/dist/lib/linux_x86_64/include/selva/selva_lang.h +0 -105
  118. package/dist/lib/linux_x86_64/include/selva/selva_math.h +0 -37
  119. package/dist/lib/linux_x86_64/include/selva/selva_string.h +0 -679
  120. package/dist/lib/linux_x86_64/include/selva/sort.h +0 -140
  121. package/dist/lib/linux_x86_64/include/selva/strsearch.h +0 -43
  122. package/dist/lib/linux_x86_64/include/selva/thread.h +0 -37
  123. package/dist/lib/linux_x86_64/include/selva/timestamp.h +0 -25
  124. package/dist/lib/linux_x86_64/include/selva/types.h +0 -129
  125. package/dist/lib/linux_x86_64/include/selva/vector.h +0 -35
  126. package/dist/lib/linux_x86_64/include/selva_error.h +0 -140
  127. package/dist/lib/linux_x86_64/include/selva_lang_code.h +0 -160
  128. package/dist/lib/linux_x86_64/include/tree.h +0 -852
  129. package/dist/lib/linux_x86_64/libdeflate.so +0 -0
  130. package/dist/lib/linux_x86_64/libjemalloc_selva.so.2 +0 -0
  131. package/dist/lib/linux_x86_64/libnode-v22.node +0 -0
  132. package/dist/lib/linux_x86_64/libnode-v23.node +0 -0
  133. package/dist/lib/linux_x86_64/libnode-v24.node +0 -0
  134. package/dist/lib/linux_x86_64/libselva.so +0 -0
  135. package/dist/lib/linux_x86_64/libxxhash.so.0 +0 -0
  136. package/dist/src/schema.d.ts +0 -6
  137. package/dist/src/schema.js +0 -2
Binary file
@@ -1,317 +0,0 @@
1
- /*
2
- * Copyright (c) 2020-2024 SAULX
3
- * SPDX-License-Identifier: BSD-2-Clause
4
- */
5
-
6
- #pragma once
7
- #ifndef _UTIL_CDEFS_H_
8
- #define _UTIL_CDEFS_H_
9
-
10
- #if __STDC_VERSION__ < 202311L
11
- #define static_assert _Static_assert
12
- #if defined(__clang__) && !defined(unreachable)
13
- #define unreachable __builtin_unreachable
14
- #endif
15
- #endif
16
-
17
- #if defined(__linux__)
18
- /**
19
- * Force linking against a specific version of a GLIBC symbol.
20
- * Use this at the top-level of a source file.
21
- */
22
- #define GLIBC_COMPAT_SYMBOL(SYM, VER) \
23
- __asm__(".symver " #SYM "," #SYM "@GLIBC_" #VER);
24
- #else
25
- #define GLIBC_COMPAT_SYMBOL(SYM, VER)
26
- #endif
27
-
28
- #if defined(__GNUC__) && !defined(__clang__)
29
- /**
30
- * The char array isn't a NUL terminated C-string.
31
- * Using this attribute will help to get better warnings at compilation time.
32
- */
33
- #define __nonstring __attribute__((nonstring))
34
- /**
35
- * Annotate a pure function.
36
- * The function has no side effects and the value returned depends on the
37
- * arguments and the state of global variables. Therefore it is safe for
38
- * the optimizer to eliminate repeated calls with unchanged arguments.
39
- */
40
- #define __purefn __attribute__((pure))
41
- /**
42
- * Annotate a const function.
43
- * The return value of the function is solely a function of its arguments,
44
- * and if any of the arguments are pointers, then the pointers are not be
45
- * dereferenced.
46
- */
47
- #define __constfn __attribute__((const))
48
- #else
49
- #define __nonstring
50
- #define __purefn
51
- #define __constfn
52
- #endif
53
-
54
- #define __sentinel __attribute__((sentinel))
55
-
56
- #if __has_c_attribute(noreturn)
57
- #define __noreturn [[noreturn]]
58
- #else
59
- #define __noreturn __attribute__((noreturn))
60
- #endif
61
-
62
- #define __transparent_union __attribute__((__transparent_union__))
63
-
64
- #define CONCATENATE(arg1, arg2) CONCATENATE1(arg1, arg2)
65
- #define CONCATENATE1(arg1, arg2) CONCATENATE2(arg1, arg2)
66
- #define CONCATENATE2(arg1, arg2) arg1##arg2
67
-
68
- #define UTIL_NARG(...) \
69
- UTIL_NARG_(__VA_ARGS__, UTIL_RSEQ_N())
70
- #define UTIL_NARG_(...) UTIL_ARG_N(__VA_ARGS__)
71
- #define UTIL_ARG_N( \
72
- _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, \
73
- _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, \
74
- _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, \
75
- _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, \
76
- _57, _58, _59, _60, _61, _62, _63, N, ...) N
77
- # define UTIL_RSEQ_N() \
78
- 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, \
79
- 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \
80
- 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, \
81
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
82
-
83
- #define _S__LINE__S(x) #x
84
- #define _S__LINE__S2(x) _S__LINE__S(x)
85
- /**
86
- * Current line number as a string.
87
- */
88
- #define S__LINE__ _S__LINE__S2(__LINE__)
89
-
90
- #ifndef __GLOBL1
91
- #define __GLOBL1(sym) __asm__(".globl " #sym)
92
- /**
93
- * Make the symbol `sym` visible to the linker.
94
- */
95
- #define __GLOBL(sym) __GLOBL1(sym)
96
- #endif
97
-
98
- #ifndef __weak_sym
99
- /**
100
- * Emit the declaration as a weak symbol.
101
- * A weak symbol can be overridden at linking. This is particularly useful for
102
- * functions.
103
- *
104
- */
105
- #define __weak_sym __attribute__((weak))
106
- #endif
107
-
108
- #ifndef __used
109
- /**
110
- * The function or variable is used.
111
- * Inform the compiler that the fuction is used and the code must be emitted
112
- * even if the function name is not referenced.
113
- */
114
- #define __used __attribute__((__used__))
115
- #endif
116
-
117
- #ifndef __unused
118
- /**
119
- * The function or variable is unused on purpose.
120
- */
121
- #define __unused __attribute__((__unused__))
122
- #endif
123
-
124
- #ifndef __section
125
- /**
126
- * Store the variable or function in a named section.
127
- */
128
- #define __section(x) __attribute__((__section__(x)))
129
- #endif
130
-
131
- #if defined(__APPLE__)
132
- #define __lazy_alloc_glob
133
- #else
134
- /**
135
- * Lazy alloc global variable.
136
- * On many system (especially Linux) user defined sections are not zeroed on
137
- * startup and thus implicitly neither allocated until accessed. This allows
138
- * us to create global variables that are allocated lazily.
139
- */
140
- #define __lazy_alloc_glob __attribute__((__section__("lazy")))
141
- #endif
142
-
143
- /**
144
- * A function that must be called before `main()`.
145
- * The function is called automatically before executing `main()`.
146
- */
147
- #define __constructor __attribute__((constructor))
148
-
149
- /**
150
- * A function that must be called after `main()` exits.
151
- * The function is called automatically after `main()` exits.
152
- */
153
- #define __destructor __attribute__((destructor))
154
-
155
- #ifndef __hot
156
- /**
157
- * Inform the compiler that the function is a hotspot.
158
- * Hot functions might be placed closely together in memory to improve locality.
159
- */
160
- #define __hot __attribute__((hot))
161
- #endif
162
-
163
- #ifndef __cold
164
- /**
165
- * Inform the compiler that the function is unlikely to be executed.
166
- */
167
- #define __cold __attribute__((cold))
168
- #endif
169
-
170
- #ifndef __packed
171
- /**
172
- * Use the minimum required memory to represent the type.
173
- * The enum, union, structure, or a structure member should have the smallest
174
- * possible alignment.
175
- */
176
- #define __packed __attribute__((packed))
177
- #endif
178
-
179
- #ifndef __counted_by
180
- #if __has_attribute(__counted_by__)
181
- /**
182
- * struct foo {
183
- * unsigned int len;
184
- * char buf[] __counted_by(len);
185
- * };
186
- * __builtin_dynamic_object_size(p->buf) == p->len * sizeof(*p->buf)
187
- */
188
- #define __counted_by(member) __attribute__((__counted_by__(member)))
189
- #else
190
- #define __counted_by(member)
191
- #endif
192
- #endif
193
-
194
- #ifndef __pcounted_by
195
- #if __has_attribute(__counted_by__) && !defined(__clang__)
196
- /**
197
- * struct foo {
198
- * unsigned int len;
199
- * char *buf __pcounted_by(len);
200
- * };
201
- * __builtin_dynamic_object_size(p->buf) == p->len * sizeof(*p->buf)
202
- */
203
- #define __pcounted_by(member) __attribute__((__counted_by__(member)))
204
- #else
205
- #define __pcounted_by(member)
206
- #endif
207
- #endif
208
-
209
- #ifndef __designated_init
210
- #if __has_attribute(__designated_init__)
211
- /**
212
- * Must use a designated initializer with a struct.
213
- */
214
- #define __designated_init __attribute__((__designated_init__))
215
- #else
216
- #define __designated_init
217
- #endif
218
- #endif
219
-
220
- /* This should come with C23 */
221
- #ifndef alignas
222
- #define alignas(x) _Alignas(x)
223
- #endif
224
-
225
- /* This should come with C23 */
226
- #ifndef alignof
227
- #define alignof(x) _Alignof(x)
228
- #endif
229
-
230
- /**
231
- * It's likely that `x` is always truthy in runtime.
232
- */
233
- #define likely(x) __builtin_expect(!!(x), 1)
234
- #define unlikely(x) __builtin_expect(!!(x), 0)
235
-
236
- #if __has_builtin(__builtin_speculation_safe_value)
237
- #define speculation_safe_value(x) __builtin_speculation_safe_value(x)
238
- #else
239
- #define speculation_safe_value(x) x
240
- #endif
241
-
242
- #define same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
243
-
244
- /**
245
- * Statically assert that VAR is compatible with the type TYPE.
246
- */
247
- #define ASSERT_TYPE(TYPE, VAR) \
248
- static_assert(__builtin_types_compatible_p(TYPE, typeof(VAR)))
249
-
250
- /**
251
- * Returns the smaller of the given values.
252
- */
253
- #define min(a, b) \
254
- ({ __typeof__ (a) _a = (a); \
255
- __typeof__ (b) _b = (b); \
256
- _a < _b ? _a : _b; })
257
-
258
- /**
259
- * Returns the greater of the given values.
260
- */
261
- #define max(a, b) \
262
- ({ __typeof__ (a) _a = (a); \
263
- __typeof__ (b) _b = (b); \
264
- _a > _b ? _a : _b; })
265
-
266
- /**
267
- * Get the struct that contains `m`.
268
- * This macro can be only used if we know for certain that `x` is a pointer to
269
- * the member `m` in type `s`.
270
- * @param x is a pointer to the member `m` in a struct of type `s`.
271
- * @param s is a struct type.
272
- * @param m is the name of the member in `s`.
273
- */
274
- #define containerof(x, s, m) ({ \
275
- const __typeof(((s *)0)->m) *__x = (x); \
276
- ((s *)((uint8_t *)(__x) - offsetof(s, m))); \
277
- })
278
-
279
- /**
280
- * Get the number of elements in an array.
281
- */
282
- #define num_elem(x) (sizeof(x) / sizeof(*(x)))
283
-
284
- /**
285
- * Size of struct field.
286
- */
287
- #define typeof_field(t, f) typeof(((t*)0)->f)
288
-
289
- /**
290
- * Size of struct field.
291
- */
292
- #define sizeof_field(t, f) (sizeof(((t*)0)->f))
293
-
294
- /**
295
- * Size of a struct with its flexible array member.
296
- */
297
- #define sizeof_wflex(t, f, count) \
298
- max(sizeof(t), offsetof(t, f[0]) + (count) * sizeof(((t*)0)->f[0]))
299
-
300
- /**
301
- * Check if pointer has a const qualifier.
302
- */
303
- #define IS_POINTER_CONST(P) \
304
- _Generic(1 ? (P) : (void *)(P), \
305
- void const *: 1, \
306
- default : 0)
307
-
308
- /**
309
- * Static ternary if.
310
- * Selects either T or E depending on P.
311
- */
312
- #define STATIC_IF(P, T, E) \
313
- _Generic (&(char [!!(P) + 1]) {0}, \
314
- char (*) [2] : T, \
315
- char (*) [1] : E)
316
-
317
- #endif /* _UTIL_CDEFS_H_ */