@graffy/core 0.16.0-alpha.9 → 0.16.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 +13 -2
  2. package/index.mjs +13 -2
  3. package/package.json +3 -3
package/index.cjs CHANGED
@@ -167,14 +167,25 @@ class Graffy {
167
167
  path,
168
168
  shiftFn(async function porcelainRead(query, options, next) {
169
169
  const porcelainQuery = common.decodeQuery(query);
170
+ let nextCalled = false;
170
171
  const encoded = common.encodeGraph(
171
172
  await handle(porcelainQuery, options, async (nextQuery, nextOpts) => {
173
+ nextCalled = true;
172
174
  const nextResult = await next(common.encodeQuery(nextQuery), nextOpts);
173
175
  return common.decodeGraph(nextResult);
174
176
  })
175
177
  );
176
- const finalized = common.finalize(encoded, query);
177
- return finalized;
178
+ let final;
179
+ if (!nextCalled) {
180
+ const encodedPath = common.encodePath(path);
181
+ final = common.unwrap(
182
+ common.finalize(common.wrap(encoded, encodedPath), common.wrap(query, encodedPath)),
183
+ encodedPath
184
+ );
185
+ } else {
186
+ final = encoded;
187
+ }
188
+ return final;
178
189
  }, path)
179
190
  );
180
191
  }
package/index.mjs CHANGED
@@ -164,14 +164,25 @@ class Graffy {
164
164
  path,
165
165
  shiftFn(async function porcelainRead(query, options, next) {
166
166
  const porcelainQuery = decodeQuery(query);
167
+ let nextCalled = false;
167
168
  const encoded = encodeGraph(
168
169
  await handle(porcelainQuery, options, async (nextQuery, nextOpts) => {
170
+ nextCalled = true;
169
171
  const nextResult = await next(encodeQuery(nextQuery), nextOpts);
170
172
  return decodeGraph(nextResult);
171
173
  })
172
174
  );
173
- const finalized = finalize(encoded, query);
174
- return finalized;
175
+ let final;
176
+ if (!nextCalled) {
177
+ const encodedPath = encodePath(path);
178
+ final = unwrap(
179
+ finalize(wrap(encoded, encodedPath), wrap(query, encodedPath)),
180
+ encodedPath
181
+ );
182
+ } else {
183
+ final = encoded;
184
+ }
185
+ return final;
175
186
  }, path)
176
187
  );
177
188
  }
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.16.0-alpha.9",
5
+ "version": "0.16.1",
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.16.0-alpha.9",
20
- "@graffy/stream": "0.16.0-alpha.9",
19
+ "@graffy/common": "0.16.1",
20
+ "@graffy/stream": "0.16.1",
21
21
  "debug": "^4.3.3"
22
22
  }
23
23
  }