@based/db 0.0.15 → 0.0.17

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 (94) hide show
  1. package/dist/lib/darwin_aarch64/include/selva/db.h +3 -0
  2. package/dist/lib/darwin_aarch64/include/selva/fields.h +1 -2
  3. package/dist/lib/darwin_aarch64/include/selva/history.h +16 -1
  4. package/dist/lib/darwin_aarch64/include/selva/hll.h +2 -1
  5. package/dist/lib/darwin_aarch64/include/selva/types.h +4 -0
  6. package/dist/lib/darwin_aarch64/libnode-v20.11.1.node +0 -0
  7. package/dist/lib/darwin_aarch64/libnode-v20.18.1.node +0 -0
  8. package/dist/lib/darwin_aarch64/libnode-v22.13.0.node +0 -0
  9. package/dist/lib/darwin_aarch64/libselva.dylib +0 -0
  10. package/dist/lib/linux_aarch64/include/selva/db.h +3 -0
  11. package/dist/lib/linux_aarch64/include/selva/fields.h +1 -2
  12. package/dist/lib/linux_aarch64/include/selva/history.h +16 -1
  13. package/dist/lib/linux_aarch64/include/selva/hll.h +2 -1
  14. package/dist/lib/linux_aarch64/include/selva/types.h +4 -0
  15. package/dist/lib/linux_aarch64/libnode-v20.11.1.node +0 -0
  16. package/dist/lib/linux_aarch64/libnode-v20.18.1.node +0 -0
  17. package/dist/lib/linux_aarch64/libnode-v22.13.0.node +0 -0
  18. package/dist/lib/linux_aarch64/libselva.so +0 -0
  19. package/dist/lib/linux_x86_64/include/selva/db.h +3 -0
  20. package/dist/lib/linux_x86_64/include/selva/fields.h +1 -2
  21. package/dist/lib/linux_x86_64/include/selva/history.h +16 -1
  22. package/dist/lib/linux_x86_64/include/selva/hll.h +2 -1
  23. package/dist/lib/linux_x86_64/include/selva/types.h +4 -0
  24. package/dist/lib/linux_x86_64/libnode-v20.11.1.node +0 -0
  25. package/dist/lib/linux_x86_64/libnode-v20.18.1.node +0 -0
  26. package/dist/lib/linux_x86_64/libnode-v22.13.0.node +0 -0
  27. package/dist/lib/linux_x86_64/libselva.so +0 -0
  28. package/dist/src/client/bitWise.js +1 -0
  29. package/dist/src/client/crc32.js +0 -276
  30. package/dist/src/client/modify/ModifyRes.d.ts +4 -2
  31. package/dist/src/client/modify/ModifyRes.js +11 -6
  32. package/dist/src/client/modify/alias.js +2 -2
  33. package/dist/src/client/modify/cardinality.js +14 -10
  34. package/dist/src/client/modify/create.js +8 -9
  35. package/dist/src/client/modify/references/reference.js +14 -7
  36. package/dist/src/client/modify/references/references.js +10 -4
  37. package/dist/src/client/modify/string.js +2 -2
  38. package/dist/src/client/modify/text.js +1 -1
  39. package/dist/src/client/modify/types.d.ts +3 -1
  40. package/dist/src/client/modify/types.js +2 -0
  41. package/dist/src/client/modify/update.js +1 -1
  42. package/dist/src/client/operations.d.ts +2 -2
  43. package/dist/src/client/operations.js +19 -3
  44. package/dist/src/client/query/BasedDbQuery.d.ts +5 -4
  45. package/dist/src/client/query/BasedDbQuery.js +28 -13
  46. package/dist/src/client/query/BasedIterable.js +3 -10
  47. package/dist/src/client/query/display.d.ts +6 -0
  48. package/dist/src/client/query/display.js +63 -4
  49. package/dist/src/client/query/filter/FilterBranch.js +8 -3
  50. package/dist/src/client/query/filter/convertFilter.d.ts +4 -0
  51. package/dist/src/client/query/filter/convertFilter.js +56 -0
  52. package/dist/src/client/query/filter/createFixedFilterBuffer.js +9 -8
  53. package/dist/src/client/query/filter/createReferenceFilter.js +5 -4
  54. package/dist/src/client/query/filter/createVariableFilterBuffer.js +6 -10
  55. package/dist/src/client/query/filter/filter.d.ts +1 -2
  56. package/dist/src/client/query/filter/filter.js +5 -56
  57. package/dist/src/client/query/filter/primitiveFilter.d.ts +2 -2
  58. package/dist/src/client/query/filter/primitiveFilter.js +5 -1
  59. package/dist/src/client/query/filter/toBuffer.js +1 -6
  60. package/dist/src/client/query/filter/types.d.ts +2 -1
  61. package/dist/src/client/query/filter/types.js +23 -12
  62. package/dist/src/client/query/include/props.js +14 -6
  63. package/dist/src/client/query/include/utils.js +2 -2
  64. package/dist/src/client/query/include/walk.js +1 -7
  65. package/dist/src/client/query/queryDef.d.ts +1 -1
  66. package/dist/src/client/query/queryDef.js +4 -3
  67. package/dist/src/client/query/read/read.js +21 -32
  68. package/dist/src/client/query/read/types.d.ts +4 -0
  69. package/dist/src/client/query/read/types.js +5 -0
  70. package/dist/src/client/query/registerQuery.js +1 -0
  71. package/dist/src/client/query/search/index.js +12 -6
  72. package/dist/src/client/query/sort.js +7 -6
  73. package/dist/src/client/query/thresholds.d.ts +0 -1
  74. package/dist/src/client/query/thresholds.js +0 -8
  75. package/dist/src/client/query/toBuffer.js +0 -3
  76. package/dist/src/client/query/types.d.ts +2 -0
  77. package/dist/src/client/query/validation.d.ts +39 -1
  78. package/dist/src/client/query/validation.js +299 -93
  79. package/dist/src/client/xxHash64.d.ts +1 -1
  80. package/dist/src/client/xxHash64.js +7 -2
  81. package/dist/src/index.d.ts +6 -1
  82. package/dist/src/index.js +31 -1
  83. package/dist/src/native.d.ts +3 -1
  84. package/dist/src/native.js +8 -2
  85. package/dist/src/server/index.d.ts +8 -6
  86. package/dist/src/server/index.js +56 -30
  87. package/dist/src/server/migrate/index.js +10 -2
  88. package/dist/src/server/migrate/worker.js +1 -1
  89. package/dist/src/server/schema/typeDef.js +35 -25
  90. package/dist/src/server/schema/types.d.ts +10 -5
  91. package/dist/src/server/schema/types.js +1 -1
  92. package/dist/src/server/schema/utils.d.ts +1 -0
  93. package/dist/src/server/schema/utils.js +18 -5
  94. package/package.json +5 -3
@@ -113,6 +113,9 @@ const struct SelvaFieldsSchema *selva_get_edge_field_fields_schema(struct SelvaD
113
113
  SELVA_EXPORT
114
114
  void selva_expire_node(struct SelvaDb *db, node_type_t type, node_id_t node_id, int64_t ts);
115
115
 
116
+ SELVA_EXPORT
117
+ void selva_expire_node_cancel(struct SelvaDb *db, node_type_t type, node_id_t node_id);
118
+
116
119
  SELVA_EXPORT
117
120
  void selva_db_expire_tick(struct SelvaDb *db, int64_t now);
118
121
 
@@ -132,8 +132,7 @@ int selva_fields_get_mutable_string(
132
132
  * TODO Document diff to get_mutable_string
133
133
  */
134
134
  SELVA_EXPORT
135
- struct selva_string *fields_ensure_string(
136
- struct SelvaDb *db,
135
+ struct selva_string *selva_fields_ensure_string(
137
136
  struct SelvaNode *node,
138
137
  const struct SelvaFieldSchema *fs,
139
138
  size_t initial_len);
@@ -19,15 +19,27 @@ struct selva_history_event {
19
19
 
20
20
  static_assert(alignof(struct selva_history_event) == alignof(uint32_t));
21
21
 
22
+ /**
23
+ * Create a new history object.
24
+ */
22
25
  SELVA_EXPORT
23
- int selva_history_init(const char *pathname, size_t bsize, struct selva_history **hist_out);
26
+ int selva_history_create(const char *pathname, size_t bsize, struct selva_history **hist_out);
24
27
 
28
+ /**
29
+ * Destroy a history object.
30
+ */
25
31
  SELVA_EXPORT
26
32
  void selva_history_destroy(struct selva_history *hist);
27
33
 
34
+ /**
35
+ * Append a block of size `bsize` to a history object.
36
+ */
28
37
  SELVA_EXPORT
29
38
  void selva_history_append(struct selva_history *hist, int64_t ts, node_id_t node_id, void *buf);
30
39
 
40
+ /**
41
+ * Ensure that the history file is fully written to the disk.
42
+ */
31
43
  SELVA_EXPORT
32
44
  void selva_history_fsync(struct selva_history *hist);
33
45
 
@@ -45,5 +57,8 @@ uint32_t *selva_history_find_range(struct selva_history *hist, int64_t from, int
45
57
  SELVA_EXPORT
46
58
  uint32_t *selva_history_find_range_node(struct selva_history *hist, int64_t from, int64_t to, node_id_t node_id, size_t *size_out);
47
59
 
60
+ /**
61
+ * Free a range returned by selva_history_find_range() or selva_history_find_range_node().
62
+ */
48
63
  SELVA_EXPORT
49
64
  void selva_history_free_range(uint32_t *range);
@@ -8,13 +8,14 @@
8
8
  #include <stdbool.h>
9
9
  #include "cdefs.h"
10
10
 
11
+ #define HLL_INIT_SIZE 8
11
12
 
12
13
  SELVA_EXPORT
13
14
  void hll_init(struct selva_string *hllss, uint8_t precision, bool is_sparse);
14
15
  SELVA_EXPORT
15
16
  void hll_add(struct selva_string *hllss, uint64_t element);
16
17
  SELVA_EXPORT
17
- double hll_count(struct selva_string *hllss);
18
+ uint8_t *hll_count(struct selva_string *hllss);
18
19
  SELVA_EXPORT
19
20
  struct selva_string hll_array_union(struct selva_string *hll_array, size_t count);
20
21
 
@@ -56,6 +56,10 @@ enum SelvaFieldType {
56
56
  struct EdgeFieldConstraint {
57
57
  enum EdgeFieldConstraintFlag {
58
58
  EDGE_FIELD_CONSTRAINT_FLAG_DEPENDENT = 0x01,
59
+ /**
60
+ * _fields_schema is referenced from the opposite efc and shouldn't be freed.
61
+ */
62
+ EDGE_FIELD_CONSTRAINT_FLAG_SCHEMA_REF_CACHED = 0x40,
59
63
  /**
60
64
  * Skip saving this field while dumping.
61
65
  */
@@ -113,6 +113,9 @@ const struct SelvaFieldsSchema *selva_get_edge_field_fields_schema(struct SelvaD
113
113
  SELVA_EXPORT
114
114
  void selva_expire_node(struct SelvaDb *db, node_type_t type, node_id_t node_id, int64_t ts);
115
115
 
116
+ SELVA_EXPORT
117
+ void selva_expire_node_cancel(struct SelvaDb *db, node_type_t type, node_id_t node_id);
118
+
116
119
  SELVA_EXPORT
117
120
  void selva_db_expire_tick(struct SelvaDb *db, int64_t now);
118
121
 
@@ -132,8 +132,7 @@ int selva_fields_get_mutable_string(
132
132
  * TODO Document diff to get_mutable_string
133
133
  */
134
134
  SELVA_EXPORT
135
- struct selva_string *fields_ensure_string(
136
- struct SelvaDb *db,
135
+ struct selva_string *selva_fields_ensure_string(
137
136
  struct SelvaNode *node,
138
137
  const struct SelvaFieldSchema *fs,
139
138
  size_t initial_len);
@@ -19,15 +19,27 @@ struct selva_history_event {
19
19
 
20
20
  static_assert(alignof(struct selva_history_event) == alignof(uint32_t));
21
21
 
22
+ /**
23
+ * Create a new history object.
24
+ */
22
25
  SELVA_EXPORT
23
- int selva_history_init(const char *pathname, size_t bsize, struct selva_history **hist_out);
26
+ int selva_history_create(const char *pathname, size_t bsize, struct selva_history **hist_out);
24
27
 
28
+ /**
29
+ * Destroy a history object.
30
+ */
25
31
  SELVA_EXPORT
26
32
  void selva_history_destroy(struct selva_history *hist);
27
33
 
34
+ /**
35
+ * Append a block of size `bsize` to a history object.
36
+ */
28
37
  SELVA_EXPORT
29
38
  void selva_history_append(struct selva_history *hist, int64_t ts, node_id_t node_id, void *buf);
30
39
 
40
+ /**
41
+ * Ensure that the history file is fully written to the disk.
42
+ */
31
43
  SELVA_EXPORT
32
44
  void selva_history_fsync(struct selva_history *hist);
33
45
 
@@ -45,5 +57,8 @@ uint32_t *selva_history_find_range(struct selva_history *hist, int64_t from, int
45
57
  SELVA_EXPORT
46
58
  uint32_t *selva_history_find_range_node(struct selva_history *hist, int64_t from, int64_t to, node_id_t node_id, size_t *size_out);
47
59
 
60
+ /**
61
+ * Free a range returned by selva_history_find_range() or selva_history_find_range_node().
62
+ */
48
63
  SELVA_EXPORT
49
64
  void selva_history_free_range(uint32_t *range);
@@ -8,13 +8,14 @@
8
8
  #include <stdbool.h>
9
9
  #include "cdefs.h"
10
10
 
11
+ #define HLL_INIT_SIZE 8
11
12
 
12
13
  SELVA_EXPORT
13
14
  void hll_init(struct selva_string *hllss, uint8_t precision, bool is_sparse);
14
15
  SELVA_EXPORT
15
16
  void hll_add(struct selva_string *hllss, uint64_t element);
16
17
  SELVA_EXPORT
17
- double hll_count(struct selva_string *hllss);
18
+ uint8_t *hll_count(struct selva_string *hllss);
18
19
  SELVA_EXPORT
19
20
  struct selva_string hll_array_union(struct selva_string *hll_array, size_t count);
20
21
 
@@ -56,6 +56,10 @@ enum SelvaFieldType {
56
56
  struct EdgeFieldConstraint {
57
57
  enum EdgeFieldConstraintFlag {
58
58
  EDGE_FIELD_CONSTRAINT_FLAG_DEPENDENT = 0x01,
59
+ /**
60
+ * _fields_schema is referenced from the opposite efc and shouldn't be freed.
61
+ */
62
+ EDGE_FIELD_CONSTRAINT_FLAG_SCHEMA_REF_CACHED = 0x40,
59
63
  /**
60
64
  * Skip saving this field while dumping.
61
65
  */
Binary file
@@ -113,6 +113,9 @@ const struct SelvaFieldsSchema *selva_get_edge_field_fields_schema(struct SelvaD
113
113
  SELVA_EXPORT
114
114
  void selva_expire_node(struct SelvaDb *db, node_type_t type, node_id_t node_id, int64_t ts);
115
115
 
116
+ SELVA_EXPORT
117
+ void selva_expire_node_cancel(struct SelvaDb *db, node_type_t type, node_id_t node_id);
118
+
116
119
  SELVA_EXPORT
117
120
  void selva_db_expire_tick(struct SelvaDb *db, int64_t now);
118
121
 
@@ -132,8 +132,7 @@ int selva_fields_get_mutable_string(
132
132
  * TODO Document diff to get_mutable_string
133
133
  */
134
134
  SELVA_EXPORT
135
- struct selva_string *fields_ensure_string(
136
- struct SelvaDb *db,
135
+ struct selva_string *selva_fields_ensure_string(
137
136
  struct SelvaNode *node,
138
137
  const struct SelvaFieldSchema *fs,
139
138
  size_t initial_len);
@@ -19,15 +19,27 @@ struct selva_history_event {
19
19
 
20
20
  static_assert(alignof(struct selva_history_event) == alignof(uint32_t));
21
21
 
22
+ /**
23
+ * Create a new history object.
24
+ */
22
25
  SELVA_EXPORT
23
- int selva_history_init(const char *pathname, size_t bsize, struct selva_history **hist_out);
26
+ int selva_history_create(const char *pathname, size_t bsize, struct selva_history **hist_out);
24
27
 
28
+ /**
29
+ * Destroy a history object.
30
+ */
25
31
  SELVA_EXPORT
26
32
  void selva_history_destroy(struct selva_history *hist);
27
33
 
34
+ /**
35
+ * Append a block of size `bsize` to a history object.
36
+ */
28
37
  SELVA_EXPORT
29
38
  void selva_history_append(struct selva_history *hist, int64_t ts, node_id_t node_id, void *buf);
30
39
 
40
+ /**
41
+ * Ensure that the history file is fully written to the disk.
42
+ */
31
43
  SELVA_EXPORT
32
44
  void selva_history_fsync(struct selva_history *hist);
33
45
 
@@ -45,5 +57,8 @@ uint32_t *selva_history_find_range(struct selva_history *hist, int64_t from, int
45
57
  SELVA_EXPORT
46
58
  uint32_t *selva_history_find_range_node(struct selva_history *hist, int64_t from, int64_t to, node_id_t node_id, size_t *size_out);
47
59
 
60
+ /**
61
+ * Free a range returned by selva_history_find_range() or selva_history_find_range_node().
62
+ */
48
63
  SELVA_EXPORT
49
64
  void selva_history_free_range(uint32_t *range);
@@ -8,13 +8,14 @@
8
8
  #include <stdbool.h>
9
9
  #include "cdefs.h"
10
10
 
11
+ #define HLL_INIT_SIZE 8
11
12
 
12
13
  SELVA_EXPORT
13
14
  void hll_init(struct selva_string *hllss, uint8_t precision, bool is_sparse);
14
15
  SELVA_EXPORT
15
16
  void hll_add(struct selva_string *hllss, uint64_t element);
16
17
  SELVA_EXPORT
17
- double hll_count(struct selva_string *hllss);
18
+ uint8_t *hll_count(struct selva_string *hllss);
18
19
  SELVA_EXPORT
19
20
  struct selva_string hll_array_union(struct selva_string *hll_array, size_t count);
20
21
 
@@ -56,6 +56,10 @@ enum SelvaFieldType {
56
56
  struct EdgeFieldConstraint {
57
57
  enum EdgeFieldConstraintFlag {
58
58
  EDGE_FIELD_CONSTRAINT_FLAG_DEPENDENT = 0x01,
59
+ /**
60
+ * _fields_schema is referenced from the opposite efc and shouldn't be freed.
61
+ */
62
+ EDGE_FIELD_CONSTRAINT_FLAG_SCHEMA_REF_CACHED = 0x40,
59
63
  /**
60
64
  * Skip saving this field while dumping.
61
65
  */
Binary file
@@ -79,4 +79,5 @@ export const concatUint8Arr = (arrs) => {
79
79
  });
80
80
  return result;
81
81
  };
82
+ const textDecoder = new TextDecoder('utf-8');
82
83
  //# sourceMappingURL=bitWise.js.map
@@ -2,280 +2,4 @@ import native from '../native.js';
2
2
  export const crc32 = (buf) => {
3
3
  return native.crc32(buf);
4
4
  };
5
- // Pure js version:
6
- // /**
7
- // * This code is a manual javascript translation of c code generated by
8
- // * pycrc 0.7.1 (http://www.tty1.net/pycrc/). Command line used:
9
- // * './pycrc.py --model=crc-32c --generate c --algorithm=table-driven'
10
- // */
11
- //
12
- // const kCRCTable = Int32Array.of(
13
- // 0x00000000,
14
- // 0xf26b8303,
15
- // 0xe13b70f7,
16
- // 0x1350f3f4,
17
- // 0xc79a971f,
18
- // 0x35f1141c,
19
- // 0x26a1e7e8,
20
- // 0xd4ca64eb,
21
- // 0x8ad958cf,
22
- // 0x78b2dbcc,
23
- // 0x6be22838,
24
- // 0x9989ab3b,
25
- // 0x4d43cfd0,
26
- // 0xbf284cd3,
27
- // 0xac78bf27,
28
- // 0x5e133c24,
29
- // 0x105ec76f,
30
- // 0xe235446c,
31
- // 0xf165b798,
32
- // 0x030e349b,
33
- // 0xd7c45070,
34
- // 0x25afd373,
35
- // 0x36ff2087,
36
- // 0xc494a384,
37
- // 0x9a879fa0,
38
- // 0x68ec1ca3,
39
- // 0x7bbcef57,
40
- // 0x89d76c54,
41
- // 0x5d1d08bf,
42
- // 0xaf768bbc,
43
- // 0xbc267848,
44
- // 0x4e4dfb4b,
45
- // 0x20bd8ede,
46
- // 0xd2d60ddd,
47
- // 0xc186fe29,
48
- // 0x33ed7d2a,
49
- // 0xe72719c1,
50
- // 0x154c9ac2,
51
- // 0x061c6936,
52
- // 0xf477ea35,
53
- // 0xaa64d611,
54
- // 0x580f5512,
55
- // 0x4b5fa6e6,
56
- // 0xb93425e5,
57
- // 0x6dfe410e,
58
- // 0x9f95c20d,
59
- // 0x8cc531f9,
60
- // 0x7eaeb2fa,
61
- // 0x30e349b1,
62
- // 0xc288cab2,
63
- // 0xd1d83946,
64
- // 0x23b3ba45,
65
- // 0xf779deae,
66
- // 0x05125dad,
67
- // 0x1642ae59,
68
- // 0xe4292d5a,
69
- // 0xba3a117e,
70
- // 0x4851927d,
71
- // 0x5b016189,
72
- // 0xa96ae28a,
73
- // 0x7da08661,
74
- // 0x8fcb0562,
75
- // 0x9c9bf696,
76
- // 0x6ef07595,
77
- // 0x417b1dbc,
78
- // 0xb3109ebf,
79
- // 0xa0406d4b,
80
- // 0x522bee48,
81
- // 0x86e18aa3,
82
- // 0x748a09a0,
83
- // 0x67dafa54,
84
- // 0x95b17957,
85
- // 0xcba24573,
86
- // 0x39c9c670,
87
- // 0x2a993584,
88
- // 0xd8f2b687,
89
- // 0x0c38d26c,
90
- // 0xfe53516f,
91
- // 0xed03a29b,
92
- // 0x1f682198,
93
- // 0x5125dad3,
94
- // 0xa34e59d0,
95
- // 0xb01eaa24,
96
- // 0x42752927,
97
- // 0x96bf4dcc,
98
- // 0x64d4cecf,
99
- // 0x77843d3b,
100
- // 0x85efbe38,
101
- // 0xdbfc821c,
102
- // 0x2997011f,
103
- // 0x3ac7f2eb,
104
- // 0xc8ac71e8,
105
- // 0x1c661503,
106
- // 0xee0d9600,
107
- // 0xfd5d65f4,
108
- // 0x0f36e6f7,
109
- // 0x61c69362,
110
- // 0x93ad1061,
111
- // 0x80fde395,
112
- // 0x72966096,
113
- // 0xa65c047d,
114
- // 0x5437877e,
115
- // 0x4767748a,
116
- // 0xb50cf789,
117
- // 0xeb1fcbad,
118
- // 0x197448ae,
119
- // 0x0a24bb5a,
120
- // 0xf84f3859,
121
- // 0x2c855cb2,
122
- // 0xdeeedfb1,
123
- // 0xcdbe2c45,
124
- // 0x3fd5af46,
125
- // 0x7198540d,
126
- // 0x83f3d70e,
127
- // 0x90a324fa,
128
- // 0x62c8a7f9,
129
- // 0xb602c312,
130
- // 0x44694011,
131
- // 0x5739b3e5,
132
- // 0xa55230e6,
133
- // 0xfb410cc2,
134
- // 0x092a8fc1,
135
- // 0x1a7a7c35,
136
- // 0xe811ff36,
137
- // 0x3cdb9bdd,
138
- // 0xceb018de,
139
- // 0xdde0eb2a,
140
- // 0x2f8b6829,
141
- // 0x82f63b78,
142
- // 0x709db87b,
143
- // 0x63cd4b8f,
144
- // 0x91a6c88c,
145
- // 0x456cac67,
146
- // 0xb7072f64,
147
- // 0xa457dc90,
148
- // 0x563c5f93,
149
- // 0x082f63b7,
150
- // 0xfa44e0b4,
151
- // 0xe9141340,
152
- // 0x1b7f9043,
153
- // 0xcfb5f4a8,
154
- // 0x3dde77ab,
155
- // 0x2e8e845f,
156
- // 0xdce5075c,
157
- // 0x92a8fc17,
158
- // 0x60c37f14,
159
- // 0x73938ce0,
160
- // 0x81f80fe3,
161
- // 0x55326b08,
162
- // 0xa759e80b,
163
- // 0xb4091bff,
164
- // 0x466298fc,
165
- // 0x1871a4d8,
166
- // 0xea1a27db,
167
- // 0xf94ad42f,
168
- // 0x0b21572c,
169
- // 0xdfeb33c7,
170
- // 0x2d80b0c4,
171
- // 0x3ed04330,
172
- // 0xccbbc033,
173
- // 0xa24bb5a6,
174
- // 0x502036a5,
175
- // 0x4370c551,
176
- // 0xb11b4652,
177
- // 0x65d122b9,
178
- // 0x97baa1ba,
179
- // 0x84ea524e,
180
- // 0x7681d14d,
181
- // 0x2892ed69,
182
- // 0xdaf96e6a,
183
- // 0xc9a99d9e,
184
- // 0x3bc21e9d,
185
- // 0xef087a76,
186
- // 0x1d63f975,
187
- // 0x0e330a81,
188
- // 0xfc588982,
189
- // 0xb21572c9,
190
- // 0x407ef1ca,
191
- // 0x532e023e,
192
- // 0xa145813d,
193
- // 0x758fe5d6,
194
- // 0x87e466d5,
195
- // 0x94b49521,
196
- // 0x66df1622,
197
- // 0x38cc2a06,
198
- // 0xcaa7a905,
199
- // 0xd9f75af1,
200
- // 0x2b9cd9f2,
201
- // 0xff56bd19,
202
- // 0x0d3d3e1a,
203
- // 0x1e6dcdee,
204
- // 0xec064eed,
205
- // 0xc38d26c4,
206
- // 0x31e6a5c7,
207
- // 0x22b65633,
208
- // 0xd0ddd530,
209
- // 0x0417b1db,
210
- // 0xf67c32d8,
211
- // 0xe52cc12c,
212
- // 0x1747422f,
213
- // 0x49547e0b,
214
- // 0xbb3ffd08,
215
- // 0xa86f0efc,
216
- // 0x5a048dff,
217
- // 0x8ecee914,
218
- // 0x7ca56a17,
219
- // 0x6ff599e3,
220
- // 0x9d9e1ae0,
221
- // 0xd3d3e1ab,
222
- // 0x21b862a8,
223
- // 0x32e8915c,
224
- // 0xc083125f,
225
- // 0x144976b4,
226
- // 0xe622f5b7,
227
- // 0xf5720643,
228
- // 0x07198540,
229
- // 0x590ab964,
230
- // 0xab613a67,
231
- // 0xb831c993,
232
- // 0x4a5a4a90,
233
- // 0x9e902e7b,
234
- // 0x6cfbad78,
235
- // 0x7fab5e8c,
236
- // 0x8dc0dd8f,
237
- // 0xe330a81a,
238
- // 0x115b2b19,
239
- // 0x020bd8ed,
240
- // 0xf0605bee,
241
- // 0x24aa3f05,
242
- // 0xd6c1bc06,
243
- // 0xc5914ff2,
244
- // 0x37faccf1,
245
- // 0x69e9f0d5,
246
- // 0x9b8273d6,
247
- // 0x88d28022,
248
- // 0x7ab90321,
249
- // 0xae7367ca,
250
- // 0x5c18e4c9,
251
- // 0x4f48173d,
252
- // 0xbd23943e,
253
- // 0xf36e6f75,
254
- // 0x0105ec76,
255
- // 0x12551f82,
256
- // 0xe03e9c81,
257
- // 0x34f4f86a,
258
- // 0xc69f7b69,
259
- // 0xd5cf889d,
260
- // 0x27a40b9e,
261
- // 0x79b737ba,
262
- // 0x8bdcb4b9,
263
- // 0x988c474d,
264
- // 0x6ae7c44e,
265
- // 0xbe2da0a5,
266
- // 0x4c4623a6,
267
- // 0x5f16d052,
268
- // 0xad7d5351
269
- // )
270
- //
271
- // export function crc32(buf: Buffer, initial: number): number {
272
- // if (!Buffer.isBuffer(buf)) {
273
- // buf = Buffer.from(buf)
274
- // }
275
- // let crc = (initial | 0) ^ -1
276
- // for (let i = 0; i < buf.length; i++) {
277
- // crc = kCRCTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8)
278
- // }
279
- // return (crc ^ -1) >>> 0
280
- // }
281
5
  //# sourceMappingURL=crc32.js.map
@@ -16,12 +16,14 @@ export declare class ModifyError {
16
16
  }
17
17
  export declare class ModifyState {
18
18
  #private;
19
- constructor(typeId: number, tmpId: number, db: DbClient, subMarkers: SubscriptionMarkersCheck | false, opts?: ModifyOpts);
19
+ constructor(typeId: number, tmpId: number, db: DbClient, subMarkers: SubscriptionMarkersCheck | false, opts: ModifyOpts, update?: boolean);
20
20
  subMarkers: SubscriptionMarkersCheck | false;
21
- i18n: LangCode;
21
+ update: boolean;
22
+ locale: LangCode;
22
23
  tmpId: number;
23
24
  error?: ModifyError;
24
25
  promises?: Promise<any>[];
26
+ resolved?: boolean;
25
27
  [Symbol.toPrimitive](): number;
26
28
  getId(offsets: Record<number, number>): number;
27
29
  then(resolve: any, reject: any): Promise<unknown>;
@@ -45,30 +45,35 @@ export class ModifyError {
45
45
  }
46
46
  }
47
47
  export class ModifyState {
48
- constructor(typeId, tmpId, db, subMarkers, opts) {
48
+ constructor(typeId, tmpId, db, subMarkers, opts, update = false) {
49
49
  this.tmpId = tmpId;
50
50
  this.#typeId = typeId;
51
51
  this.#buf = db.modifyCtx;
52
52
  this.#ctx = db.modifyCtx.ctx;
53
53
  this.subMarkers = subMarkers;
54
- if (opts) {
55
- if (opts.i18n) {
56
- this.i18n = langCodesMap.get(opts.i18n);
57
- }
54
+ this.update = update;
55
+ if (opts?.locale) {
56
+ this.locale = langCodesMap.get(opts.locale);
58
57
  }
59
58
  }
60
59
  subMarkers;
61
- i18n;
60
+ update;
61
+ locale;
62
62
  #buf;
63
63
  #ctx;
64
64
  #typeId;
65
65
  tmpId;
66
66
  error;
67
67
  promises;
68
+ resolved;
68
69
  [Symbol.toPrimitive]() {
69
70
  return this.tmpId;
70
71
  }
71
72
  getId(offsets) {
73
+ this.resolved = true;
74
+ if (this.update) {
75
+ return this.tmpId;
76
+ }
72
77
  const offset = offsets[this.#typeId] || 0;
73
78
  return this.tmpId + offset;
74
79
  }
@@ -19,8 +19,8 @@ export function writeAlias(value, ctx, def, t, parentId, modifyOp) {
19
19
  return RANGE_ERR;
20
20
  }
21
21
  if (modifyOp === CREATE) {
22
- def.stringPropsCurrent[t.prop] = 2;
23
- ctx.hasStringField++;
22
+ def.seperateSort.bufferTmp[t.prop] = 2;
23
+ ctx.hasSortField++;
24
24
  }
25
25
  setCursor(ctx, def, t.prop, t.typeIndex, parentId, modifyOp);
26
26
  ctx.buf[ctx.len++] = modifyOp;