@based/db 0.2.19 → 0.2.20

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.
Binary file
Binary file
@@ -9,11 +9,6 @@ export class SubStore {
9
9
  len;
10
10
  subscribe(q) {
11
11
  const onData = (res) => {
12
- // // @ts-ignore
13
- // if (q._payload) {
14
- // // @ts-ignore
15
- // console.log('onData', q._payload)
16
- // }
17
12
  if (!this.response) {
18
13
  this.response = new BasedQueryResponse(q.def, res, 0);
19
14
  }
@@ -1,4 +1,4 @@
1
- import { writeInt64, writeUint16, writeUint32 } from '@based/utils';
1
+ import { readUint32, writeInt64, writeUint16, writeUint32 } from '@based/utils';
2
2
  import native from '../../../native.js';
3
3
  import { ID } from '../toByteCode/offsets.js';
4
4
  import { QueryType } from '../types.js';
@@ -88,7 +88,10 @@ export const registerSubscription = (query) => {
88
88
  const id = query.def.target.id;
89
89
  const fields = collectFields(query.def);
90
90
  const typeId = query.def.schema.id;
91
- const subId = native.crc32(query.buffer.subarray(ID.id + 4, query.buffer.byteLength - 4));
91
+ const queryId = readUint32(query.buffer, ID.id);
92
+ writeUint32(query.buffer, 0, ID.id);
93
+ const subId = native.crc32(query.buffer.subarray(0, query.buffer.byteLength - 4));
94
+ writeUint32(query.buffer, queryId, ID.id);
92
95
  const headerLen = 18;
93
96
  const types = collectTypes(query.def);
94
97
  const nowQueries = collectFilters(query.def.filter, fields);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@based/db",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "type": "module",
5
5
  "main": "./dist/src/index.js",
6
6
  "scripts": {
@@ -42,10 +42,10 @@
42
42
  "basedDbNative.cjs"
43
43
  ],
44
44
  "dependencies": {
45
- "@based/hash": "1.1.3",
46
- "@based/schema": "5.1.7",
47
- "@based/utils": "1.2.3",
48
- "@based/protocol": "0.1.8",
45
+ "@based/hash": "1.1.4",
46
+ "@based/schema": "5.1.8",
47
+ "@based/utils": "1.2.4",
48
+ "@based/protocol": "0.1.9",
49
49
  "exit-hook": "^4.0.0"
50
50
  },
51
51
  "optionalDependencies": {