@graffy/core 0.16.1 → 0.16.2-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.
- package/index.cjs +6 -8
- package/index.mjs +5 -5
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
const common = require("@graffy/common");
|
|
3
3
|
const stream = require("@graffy/stream");
|
|
4
4
|
const debug = require("debug");
|
|
5
|
-
const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
6
|
-
const debug__default = /* @__PURE__ */ _interopDefaultLegacy(debug);
|
|
7
5
|
const splitPath = (path) => Array.isArray(path) ? path : path === "" ? [] : String(path).split(".");
|
|
8
6
|
function validateCall(...args) {
|
|
9
7
|
if (args.length === 1) {
|
|
@@ -65,7 +63,7 @@ function shiftFn(fn, path) {
|
|
|
65
63
|
if (!nextCalled && remainingPayload.length) {
|
|
66
64
|
remainingNextResult = await next(remainingPayload);
|
|
67
65
|
}
|
|
68
|
-
if (remainingNextResult
|
|
66
|
+
if (remainingNextResult == null ? void 0 : remainingNextResult.length) {
|
|
69
67
|
common.merge(result, remainingNextResult);
|
|
70
68
|
}
|
|
71
69
|
return result;
|
|
@@ -111,13 +109,13 @@ function shiftGen(fn, path) {
|
|
|
111
109
|
yield* remainingNextStream ? common.mergeStreams(resultStream, remainingNextStream) : resultStream;
|
|
112
110
|
};
|
|
113
111
|
}
|
|
114
|
-
const log =
|
|
112
|
+
const log = debug("graffy:core");
|
|
115
113
|
function resolve(handlers, firstPayload, firstOptions) {
|
|
116
|
-
if (!handlers
|
|
114
|
+
if (!(handlers == null ? void 0 : handlers.length))
|
|
117
115
|
throw Error("resolve.no_provider");
|
|
118
116
|
function run(i, payload, options) {
|
|
119
117
|
if (i >= handlers.length) {
|
|
120
|
-
throw Error(
|
|
118
|
+
throw Error(`resolve.no_providers_for ${JSON.stringify(payload)}`);
|
|
121
119
|
}
|
|
122
120
|
const { path, handle } = handlers[i];
|
|
123
121
|
if (!common.unwrap(payload, path)) {
|
|
@@ -126,7 +124,7 @@ function resolve(handlers, firstPayload, firstOptions) {
|
|
|
126
124
|
let nextCalled = false;
|
|
127
125
|
return handle(payload, options, (nextPayload, nextOptions) => {
|
|
128
126
|
if (nextCalled) {
|
|
129
|
-
throw Error(
|
|
127
|
+
throw Error(`resolve.duplicate_next_call: ${handlers[i].name}`);
|
|
130
128
|
}
|
|
131
129
|
nextCalled = true;
|
|
132
130
|
if (typeof nextPayload === "undefined" || !nextPayload.length)
|
|
@@ -198,7 +196,7 @@ class Graffy {
|
|
|
198
196
|
shiftGen(function porcelainWatch(query, options) {
|
|
199
197
|
return stream.makeStream((push, end) => {
|
|
200
198
|
const subscription = handle(common.decodeQuery(query), options, () => {
|
|
201
|
-
throw Error(
|
|
199
|
+
throw Error(`porcelain.watch_next_unsupported: ${path}`);
|
|
202
200
|
});
|
|
203
201
|
(async function() {
|
|
204
202
|
try {
|
package/index.mjs
CHANGED
|
@@ -62,7 +62,7 @@ function shiftFn(fn, path) {
|
|
|
62
62
|
if (!nextCalled && remainingPayload.length) {
|
|
63
63
|
remainingNextResult = await next(remainingPayload);
|
|
64
64
|
}
|
|
65
|
-
if (remainingNextResult
|
|
65
|
+
if (remainingNextResult == null ? void 0 : remainingNextResult.length) {
|
|
66
66
|
merge(result, remainingNextResult);
|
|
67
67
|
}
|
|
68
68
|
return result;
|
|
@@ -110,11 +110,11 @@ function shiftGen(fn, path) {
|
|
|
110
110
|
}
|
|
111
111
|
const log = debug("graffy:core");
|
|
112
112
|
function resolve(handlers, firstPayload, firstOptions) {
|
|
113
|
-
if (!handlers
|
|
113
|
+
if (!(handlers == null ? void 0 : handlers.length))
|
|
114
114
|
throw Error("resolve.no_provider");
|
|
115
115
|
function run(i, payload, options) {
|
|
116
116
|
if (i >= handlers.length) {
|
|
117
|
-
throw Error(
|
|
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)) {
|
|
@@ -123,7 +123,7 @@ function resolve(handlers, firstPayload, firstOptions) {
|
|
|
123
123
|
let nextCalled = false;
|
|
124
124
|
return handle(payload, options, (nextPayload, nextOptions) => {
|
|
125
125
|
if (nextCalled) {
|
|
126
|
-
throw Error(
|
|
126
|
+
throw Error(`resolve.duplicate_next_call: ${handlers[i].name}`);
|
|
127
127
|
}
|
|
128
128
|
nextCalled = true;
|
|
129
129
|
if (typeof nextPayload === "undefined" || !nextPayload.length)
|
|
@@ -195,7 +195,7 @@ class Graffy {
|
|
|
195
195
|
shiftGen(function porcelainWatch(query, options) {
|
|
196
196
|
return makeStream((push, end) => {
|
|
197
197
|
const subscription = handle(decodeQuery(query), options, () => {
|
|
198
|
-
throw Error(
|
|
198
|
+
throw Error(`porcelain.watch_next_unsupported: ${path}`);
|
|
199
199
|
});
|
|
200
200
|
(async function() {
|
|
201
201
|
try {
|
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.1",
|
|
5
|
+
"version": "0.16.2-alpha.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.1",
|
|
20
|
-
"@graffy/stream": "0.16.1",
|
|
19
|
+
"@graffy/common": "0.16.2-alpha.1",
|
|
20
|
+
"@graffy/stream": "0.16.2-alpha.1",
|
|
21
21
|
"debug": "^4.3.3"
|
|
22
22
|
}
|
|
23
23
|
}
|