@graffy/common 0.19.1-alpha.2 → 0.19.1-alpha.3

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.
@@ -1,11 +1,3 @@
1
- export declare const END = 0;
2
- export declare const NULL = 1;
3
- export declare const FALSE = 2;
4
- export declare const TRUE = 3;
5
- export declare const NUM = 4;
6
1
  export declare const STR = 5;
7
- export declare const ARR = 6;
8
- export declare const OBJ = 7;
9
- export declare const EOK = 127;
10
2
  export declare function encode(value: any): Uint8Array<any>;
11
3
  export declare function decode(buffer: any): any;
package/coding/struct.js CHANGED
@@ -7,15 +7,15 @@ import { decode as decodeString, encode as encodeString } from "./string.js";
7
7
  The constraints are:
8
8
  - Sorting a byte stream should
9
9
  */
10
- export const END = 0;
11
- export const NULL = 1;
12
- export const FALSE = 2;
13
- export const TRUE = 3;
14
- export const NUM = 4;
10
+ const END = 0;
11
+ const NULL = 1;
12
+ const FALSE = 2;
13
+ const TRUE = 3;
14
+ const NUM = 4;
15
15
  export const STR = 5;
16
- export const ARR = 6;
17
- export const OBJ = 7;
18
- export const EOK = 127; // end-of-key
16
+ const ARR = 6;
17
+ const OBJ = 7;
18
+ const EOK = 127; // end-of-key
19
19
  function encodeArray(array) {
20
20
  return [ARR, ...array.flatMap((value) => encodeParts(value)), END];
21
21
  }
package/ops/merge.d.ts CHANGED
@@ -1,3 +1 @@
1
1
  export default function merge(current: any, changes: any): any;
2
- export declare function insertRange(current: any, change: any, start?: number): number;
3
- export declare function insertNode(current: any, change: any, start?: number): any;
package/ops/merge.js CHANGED
@@ -12,7 +12,7 @@ export default function merge(current, changes) {
12
12
  }
13
13
  return current;
14
14
  }
15
- export function insertRange(current, change, start = 0) {
15
+ function insertRange(current, change, start = 0) {
16
16
  const { key, end } = change;
17
17
  const keyIx = findFirst(current, key, start);
18
18
  const endIx = findLast(current, end, keyIx);
@@ -41,7 +41,7 @@ function mergeRanges(base, node) {
41
41
  cmp(base.end, node.end) > 0 && { ...base, key: keyAfter(node.end) },
42
42
  ].filter(Boolean);
43
43
  }
44
- export function insertNode(current, change, start = 0) {
44
+ function insertNode(current, change, start = 0) {
45
45
  if (!current)
46
46
  throw new Error(`merge.insertNode: ${current}`);
47
47
  const key = change.key;
package/ops/sieve.d.ts CHANGED
@@ -1,3 +1 @@
1
1
  export default function sieve(current: any, changes: any, result?: any[]): any[];
2
- export declare function insertRange(current: any, change: any, result: any, start?: number): number;
3
- export declare function insertNode(current: any, change: any, result: any, start?: number): any;
package/ops/sieve.js CHANGED
@@ -10,7 +10,7 @@ export default function sieve(current, changes, result = []) {
10
10
  }
11
11
  return result;
12
12
  }
13
- export function insertRange(current, change, result, start = 0) {
13
+ function insertRange(current, change, result, start = 0) {
14
14
  const { key, end } = change;
15
15
  const keyIx = findFirst(current, key, start);
16
16
  const endIx = findLast(current, end, keyIx);
@@ -89,7 +89,7 @@ function mergeRanges(base, node) {
89
89
  cmp(base.end, node.end) > 0 && { ...base, key: keyAfter(node.end) },
90
90
  ].filter(Boolean);
91
91
  }
92
- export function insertNode(current, change, result, start = 0) {
92
+ function insertNode(current, change, result, start = 0) {
93
93
  const key = change.key;
94
94
  const index = findFirst(current, key, start);
95
95
  const node = current[index];
package/ops/slice.d.ts CHANGED
@@ -9,5 +9,4 @@ declare class Result {
9
9
  addLinked(children: any): any;
10
10
  }
11
11
  export default function slice(graph: any, query: any, root?: any): Result;
12
- export declare function sliceRange(graph: any, query: any, result: any): void;
13
12
  export {};
package/ops/slice.js CHANGED
@@ -93,7 +93,7 @@ function sliceNode(graph, query, result) {
93
93
  result.addKnown(graph);
94
94
  }
95
95
  }
96
- export function sliceRange(graph, query, result) {
96
+ function sliceRange(graph, query, result) {
97
97
  let { key, end, limit = Number.POSITIVE_INFINITY, version } = query;
98
98
  const step = cmp(key, end) < 0 ? 1 : -1;
99
99
  // Prefixes are used to combine filtering and pagination. In schemas where
package/package.json CHANGED
@@ -2,18 +2,9 @@
2
2
  "name": "@graffy/common",
3
3
  "description": "Common libraries that used by various Graffy modules.",
4
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.19.1-alpha.2",
6
- "main": "./cjs/index.js",
7
- "exports": {
8
- ".": {
9
- "import": "./index.js",
10
- "types": "./index.d.ts"
11
- },
12
- "./*": {
13
- "import": "./*.js",
14
- "types": "./*.d.ts"
15
- }
16
- },
5
+ "version": "0.19.1-alpha.3",
6
+ "type": "module",
7
+ "main": "./index.js",
17
8
  "types": "./index.d.ts",
18
9
  "repository": {
19
10
  "type": "git",
@@ -24,7 +15,7 @@
24
15
  "debug": "^4.4.3",
25
16
  "lodash": "^4.18.1",
26
17
  "nanoid": "^5.1.11",
27
- "@graffy/stream": "0.19.1-alpha.2",
18
+ "@graffy/stream": "0.19.1-alpha.3",
28
19
  "merge-async-iterators": "^0.2.1"
29
20
  }
30
21
  }