@zapier/kitcore 0.10.0 → 0.10.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/CHANGELOG.md +6 -0
- package/dist/index.cjs +47 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +48 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -168,13 +168,34 @@ function buildRegistry({
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
// src/utils/build-hooks.ts
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (!
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
var isolated = /* @__PURE__ */ new WeakSet();
|
|
172
|
+
function isolate(observer) {
|
|
173
|
+
if (!observer) return void 0;
|
|
174
|
+
if (isolated.has(observer)) return observer;
|
|
175
|
+
const wrapped = (ctx) => {
|
|
176
|
+
try {
|
|
177
|
+
observer(ctx);
|
|
178
|
+
} catch (error) {
|
|
179
|
+
console.error(
|
|
180
|
+
"[core] A method-lifecycle observer threw and was ignored. Observers are fire-and-forget and must not throw.",
|
|
181
|
+
error
|
|
182
|
+
);
|
|
183
|
+
}
|
|
177
184
|
};
|
|
185
|
+
isolated.add(wrapped);
|
|
186
|
+
return wrapped;
|
|
187
|
+
}
|
|
188
|
+
function composeVoid(existing, added) {
|
|
189
|
+
const wrappedExisting = isolate(existing);
|
|
190
|
+
const wrappedAdded = isolate(added);
|
|
191
|
+
if (!wrappedExisting) return wrappedAdded;
|
|
192
|
+
if (!wrappedAdded) return wrappedExisting;
|
|
193
|
+
const composed = (ctx) => {
|
|
194
|
+
wrappedExisting(ctx);
|
|
195
|
+
wrappedAdded(ctx);
|
|
196
|
+
};
|
|
197
|
+
isolated.add(composed);
|
|
198
|
+
return composed;
|
|
178
199
|
}
|
|
179
200
|
function buildHooks(existing, added) {
|
|
180
201
|
const result = {};
|
|
@@ -925,24 +946,27 @@ function createPaginatedFunction(coreFn, options) {
|
|
|
925
946
|
return result.value;
|
|
926
947
|
});
|
|
927
948
|
if (hooks?.onMethodEnd) {
|
|
928
|
-
firstPagePromise.then(
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
949
|
+
firstPagePromise.then(
|
|
950
|
+
() => {
|
|
951
|
+
hooks.onMethodEnd({
|
|
952
|
+
methodName: functionName,
|
|
953
|
+
args,
|
|
954
|
+
isPaginated: true,
|
|
955
|
+
depth,
|
|
956
|
+
durationMs: Date.now() - startTime
|
|
957
|
+
});
|
|
958
|
+
},
|
|
959
|
+
(error) => {
|
|
960
|
+
hooks.onMethodEnd({
|
|
961
|
+
methodName: functionName,
|
|
962
|
+
args,
|
|
963
|
+
isPaginated: true,
|
|
964
|
+
depth,
|
|
965
|
+
durationMs: Date.now() - startTime,
|
|
966
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
);
|
|
946
970
|
}
|
|
947
971
|
const pageStream = async function* () {
|
|
948
972
|
yield await firstPagePromise;
|