@graffy/fill 0.15.9 → 0.15.11-alpha.1

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 (3) hide show
  1. package/index.cjs +9 -10
  2. package/index.mjs +9 -10
  3. package/package.json +3 -4
package/index.cjs CHANGED
@@ -2,7 +2,6 @@
2
2
  var common = require("@graffy/common");
3
3
  var stream = require("@graffy/stream");
4
4
  var debug = require("debug");
5
- var testing = require("@graffy/testing");
6
5
  function _interopDefaultLegacy(e) {
7
6
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
8
7
  }
@@ -17,7 +16,7 @@ function subscribe(store, originalQuery, { raw }) {
17
16
  let payload = [];
18
17
  const stream$1 = stream.makeStream((streamPush, streamEnd) => {
19
18
  push = (v) => {
20
- log$1("Push", testing.format(v));
19
+ log$1("Push", v);
21
20
  streamPush(v);
22
21
  };
23
22
  end = streamEnd;
@@ -28,17 +27,17 @@ function subscribe(store, originalQuery, { raw }) {
28
27
  async function resubscribe(unknown) {
29
28
  try {
30
29
  const changed = common.add(query, unknown);
31
- log$1(changed ? "Resubscribing" : "Not resubscribing", testing.format(unknown));
30
+ log$1(changed ? "Resubscribing" : "Not resubscribing", unknown);
32
31
  if (!changed)
33
32
  return;
34
33
  if (upstream)
35
34
  upstream.return();
36
35
  upstream = store.call("watch", query, { skipFill: true });
37
36
  let { value } = await upstream.next();
38
- log$1("First payload", typeof value, testing.format(value));
37
+ log$1("First payload", typeof value, value);
39
38
  if (typeof value === "undefined") {
40
39
  value = await store.call("read", unknown, { skipCache: true });
41
- log$1("Read initial value", testing.format(value));
40
+ log$1("Read initial value", value);
42
41
  }
43
42
  putValue(value, false);
44
43
  } catch (e) {
@@ -73,14 +72,14 @@ function subscribe(store, originalQuery, { raw }) {
73
72
  if (sieved)
74
73
  common.merge(data, sieved);
75
74
  }
76
- log$1("Sieved: ", sieved && testing.format(sieved));
75
+ log$1("Sieved: ", sieved && sieved);
77
76
  if (raw && sieved) {
78
77
  common.merge(payload, sieved);
79
78
  }
80
79
  let { known, unknown } = common.slice(data, originalQuery);
81
80
  data = known || empty();
82
- log$1("Data and unknown", testing.format(data), unknown && testing.format(unknown));
83
- log$1("Payload and value", testing.format(payload), value && testing.format(value));
81
+ log$1("Data and unknown", data, unknown && unknown);
82
+ log$1("Payload and value", payload, value && value);
84
83
  if (isChange && value && unknown) {
85
84
  const valueParts = common.slice(value, unknown);
86
85
  if (valueParts.known) {
@@ -119,7 +118,7 @@ function fill(_) {
119
118
  if (options.skipFill)
120
119
  return value;
121
120
  if (!value || !value.length) {
122
- log("No progress", testing.format(query));
121
+ log("No progress", query);
123
122
  throw Error("fill.no_progress");
124
123
  }
125
124
  let budget = MAX_RECURSIONS;
@@ -132,7 +131,7 @@ function fill(_) {
132
131
  common.merge(value, res);
133
132
  }
134
133
  if (!budget) {
135
- log("fill.max_recursion", testing.format(value), testing.format(query));
134
+ log("fill.max_recursion", value, query);
136
135
  throw new Error("fill.max_recursion");
137
136
  }
138
137
  return value;
package/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { finalize, add, sieve, slice, merge } from "@graffy/common";
2
2
  import { makeStream } from "@graffy/stream";
3
3
  import debug from "debug";
4
- import { format } from "@graffy/testing";
5
4
  const log$1 = debug("graffy:fill:subscribe");
6
5
  function subscribe(store, originalQuery, { raw }) {
7
6
  const empty = () => finalize([], originalQuery, 0);
@@ -12,7 +11,7 @@ function subscribe(store, originalQuery, { raw }) {
12
11
  let payload = [];
13
12
  const stream = makeStream((streamPush, streamEnd) => {
14
13
  push = (v) => {
15
- log$1("Push", format(v));
14
+ log$1("Push", v);
16
15
  streamPush(v);
17
16
  };
18
17
  end = streamEnd;
@@ -23,17 +22,17 @@ function subscribe(store, originalQuery, { raw }) {
23
22
  async function resubscribe(unknown) {
24
23
  try {
25
24
  const changed = add(query, unknown);
26
- log$1(changed ? "Resubscribing" : "Not resubscribing", format(unknown));
25
+ log$1(changed ? "Resubscribing" : "Not resubscribing", unknown);
27
26
  if (!changed)
28
27
  return;
29
28
  if (upstream)
30
29
  upstream.return();
31
30
  upstream = store.call("watch", query, { skipFill: true });
32
31
  let { value } = await upstream.next();
33
- log$1("First payload", typeof value, format(value));
32
+ log$1("First payload", typeof value, value);
34
33
  if (typeof value === "undefined") {
35
34
  value = await store.call("read", unknown, { skipCache: true });
36
- log$1("Read initial value", format(value));
35
+ log$1("Read initial value", value);
37
36
  }
38
37
  putValue(value, false);
39
38
  } catch (e) {
@@ -68,14 +67,14 @@ function subscribe(store, originalQuery, { raw }) {
68
67
  if (sieved)
69
68
  merge(data, sieved);
70
69
  }
71
- log$1("Sieved: ", sieved && format(sieved));
70
+ log$1("Sieved: ", sieved && sieved);
72
71
  if (raw && sieved) {
73
72
  merge(payload, sieved);
74
73
  }
75
74
  let { known, unknown } = slice(data, originalQuery);
76
75
  data = known || empty();
77
- log$1("Data and unknown", format(data), unknown && format(unknown));
78
- log$1("Payload and value", format(payload), value && format(value));
76
+ log$1("Data and unknown", data, unknown && unknown);
77
+ log$1("Payload and value", payload, value && value);
79
78
  if (isChange && value && unknown) {
80
79
  const valueParts = slice(value, unknown);
81
80
  if (valueParts.known) {
@@ -114,7 +113,7 @@ function fill(_) {
114
113
  if (options.skipFill)
115
114
  return value;
116
115
  if (!value || !value.length) {
117
- log("No progress", format(query));
116
+ log("No progress", query);
118
117
  throw Error("fill.no_progress");
119
118
  }
120
119
  let budget = MAX_RECURSIONS;
@@ -127,7 +126,7 @@ function fill(_) {
127
126
  merge(value, res);
128
127
  }
129
128
  if (!budget) {
130
- log("fill.max_recursion", format(value), format(query));
129
+ log("fill.max_recursion", value, query);
131
130
  throw new Error("fill.max_recursion");
132
131
  }
133
132
  return value;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graffy/fill",
3
3
  "description": "Graffy module for fulfilling queries using multiple backends, traversing links and turning subscriptions into live queries.",
4
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.15.9",
5
+ "version": "0.15.11-alpha.1",
6
6
  "main": "./index.cjs",
7
7
  "exports": {
8
8
  "import": "./index.mjs",
@@ -16,9 +16,8 @@
16
16
  },
17
17
  "license": "Apache-2.0",
18
18
  "dependencies": {
19
- "@graffy/common": "0.15.9",
20
- "@graffy/testing": "0.15.9",
19
+ "@graffy/common": "0.15.11-alpha.1",
21
20
  "debug": "^4.3.2",
22
- "@graffy/stream": "0.15.9"
21
+ "@graffy/stream": "0.15.11-alpha.1"
23
22
  }
24
23
  }