@graffy/core 0.15.12-alpha.2 → 0.15.13

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 +7 -7
  2. package/index.mjs +7 -7
  3. package/package.json +3 -3
package/index.cjs CHANGED
@@ -114,28 +114,28 @@ function shiftGen(fn, path) {
114
114
  };
115
115
  }
116
116
  const log = debug__default["default"]("graffy:core");
117
- function resolve(handlers, firstPayload, options) {
117
+ function resolve(handlers, firstPayload, firstOptions) {
118
118
  if (!handlers || !handlers.length)
119
119
  throw Error("resolve.no_provider");
120
- function run(i, payload) {
120
+ function run(i, payload, options) {
121
121
  if (i >= handlers.length) {
122
122
  throw Error("resolve.no_providers_for " + JSON.stringify(payload));
123
123
  }
124
124
  const { path, handle } = handlers[i];
125
125
  if (!common.unwrap(payload, path))
126
- return run(i + 1, payload);
126
+ return run(i + 1, payload, options);
127
127
  let nextCalled = false;
128
- return handle(payload, options, (nextPayload) => {
128
+ return handle(payload, options, (nextPayload, nextOptions) => {
129
129
  if (nextCalled) {
130
130
  throw Error("resolve.duplicate_next_call: " + handlers[i].name);
131
131
  }
132
132
  nextCalled = true;
133
133
  if (typeof nextPayload === "undefined" || !nextPayload.length)
134
134
  return;
135
- return run(i + 1, nextPayload);
135
+ return run(i + 1, nextPayload, nextOptions || options);
136
136
  });
137
137
  }
138
- return run(0, firstPayload);
138
+ return run(0, firstPayload, firstOptions);
139
139
  }
140
140
  class Core {
141
141
  constructor() {
@@ -222,7 +222,7 @@ class Graffy {
222
222
  }
223
223
  async write(...args) {
224
224
  const [path, porcelainChange, options] = validateCall(...args);
225
- const change = common.wrap(common.encodeGraph(porcelainChange), path);
225
+ const change = common.encodeGraph(common.wrapObject(porcelainChange, path));
226
226
  const writtenChange = await this.core.call("write", change, options || {});
227
227
  return common.unwrapObject(common.decodeGraph(writtenChange), common.decodePath(path));
228
228
  }
package/index.mjs CHANGED
@@ -109,28 +109,28 @@ function shiftGen(fn, path) {
109
109
  };
110
110
  }
111
111
  const log = debug("graffy:core");
112
- function resolve(handlers, firstPayload, options) {
112
+ function resolve(handlers, firstPayload, firstOptions) {
113
113
  if (!handlers || !handlers.length)
114
114
  throw Error("resolve.no_provider");
115
- function run(i, payload) {
115
+ function run(i, payload, options) {
116
116
  if (i >= handlers.length) {
117
117
  throw Error("resolve.no_providers_for " + JSON.stringify(payload));
118
118
  }
119
119
  const { path, handle } = handlers[i];
120
120
  if (!unwrap(payload, path))
121
- return run(i + 1, payload);
121
+ return run(i + 1, payload, options);
122
122
  let nextCalled = false;
123
- return handle(payload, options, (nextPayload) => {
123
+ return handle(payload, options, (nextPayload, nextOptions) => {
124
124
  if (nextCalled) {
125
125
  throw Error("resolve.duplicate_next_call: " + handlers[i].name);
126
126
  }
127
127
  nextCalled = true;
128
128
  if (typeof nextPayload === "undefined" || !nextPayload.length)
129
129
  return;
130
- return run(i + 1, nextPayload);
130
+ return run(i + 1, nextPayload, nextOptions || options);
131
131
  });
132
132
  }
133
- return run(0, firstPayload);
133
+ return run(0, firstPayload, firstOptions);
134
134
  }
135
135
  class Core {
136
136
  constructor() {
@@ -217,7 +217,7 @@ class Graffy {
217
217
  }
218
218
  async write(...args) {
219
219
  const [path, porcelainChange, options] = validateCall(...args);
220
- const change = wrap(encodeGraph(porcelainChange), path);
220
+ const change = encodeGraph(wrapObject(porcelainChange, path));
221
221
  const writtenChange = await this.core.call("write", change, options || {});
222
222
  return unwrapObject(decodeGraph(writtenChange), decodePath(path));
223
223
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graffy/core",
3
3
  "description": "The main module for Graffy, a library for intuitive real-time data APIs.",
4
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.15.12-alpha.2",
5
+ "version": "0.15.13",
6
6
  "main": "./index.cjs",
7
7
  "exports": {
8
8
  "import": "./index.mjs",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "license": "Apache-2.0",
18
18
  "dependencies": {
19
- "@graffy/common": "0.15.12-alpha.2",
20
- "@graffy/stream": "0.15.12-alpha.2",
19
+ "@graffy/common": "0.15.13",
20
+ "@graffy/stream": "0.15.13",
21
21
  "debug": "^4.3.2"
22
22
  }
23
23
  }