@camunda8/orchestration-cluster-api 10.0.0-alpha.33 → 10.0.0-alpha.34
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 +7 -0
- package/README.md +50 -1
- package/dist/{CamundaClient-CjiqDv80.d.ts → CamundaClient-BHhMv8K7.d.ts} +164 -24
- package/dist/{CamundaClient-CcbPiyq9.d.cts → CamundaClient-FYepah9u.d.cts} +164 -24
- package/dist/{chunk-AH6BQSBI.js → chunk-DVCU3RZY.js} +150 -3
- package/dist/chunk-DVCU3RZY.js.map +1 -0
- package/dist/effect/index.cjs +147 -2
- package/dist/effect/index.cjs.map +1 -1
- package/dist/effect/index.d.cts +1 -1
- package/dist/effect/index.d.ts +1 -1
- package/dist/effect/index.js +1 -1
- package/dist/index.cjs +151 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -21
- package/dist/index.d.ts +27 -21
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-AH6BQSBI.js.map +0 -1
|
@@ -656,6 +656,85 @@ var JobWorker = class {
|
|
|
656
656
|
}
|
|
657
657
|
};
|
|
658
658
|
|
|
659
|
+
// src/runtime/pagination.ts
|
|
660
|
+
function abortError() {
|
|
661
|
+
const e = new Error("Pagination aborted");
|
|
662
|
+
e.name = "AbortError";
|
|
663
|
+
return e;
|
|
664
|
+
}
|
|
665
|
+
function limitOf(body) {
|
|
666
|
+
const l = body.page?.limit;
|
|
667
|
+
return typeof l === "number" ? l : void 0;
|
|
668
|
+
}
|
|
669
|
+
function advancePage(prev, advance) {
|
|
670
|
+
const rest = { ...prev ?? {} };
|
|
671
|
+
delete rest.after;
|
|
672
|
+
delete rest.from;
|
|
673
|
+
delete rest.before;
|
|
674
|
+
return { ...rest, ...advance };
|
|
675
|
+
}
|
|
676
|
+
function nextPageRequest(body, response, mode = "auto") {
|
|
677
|
+
const limit = limitOf(body);
|
|
678
|
+
const count = response.items.length;
|
|
679
|
+
if (count === 0) return null;
|
|
680
|
+
if (limit !== void 0 && count < limit) return null;
|
|
681
|
+
const endCursor = response.page?.endCursor ?? null;
|
|
682
|
+
const hasCursor = body.page?.after !== void 0 || body.page?.before !== void 0;
|
|
683
|
+
const hasFrom = typeof body.page?.from === "number";
|
|
684
|
+
let useCursor;
|
|
685
|
+
if (mode === "cursor") useCursor = true;
|
|
686
|
+
else if (mode === "offset") useCursor = false;
|
|
687
|
+
else if (hasCursor && !hasFrom) useCursor = true;
|
|
688
|
+
else if (hasFrom && !hasCursor) useCursor = false;
|
|
689
|
+
else useCursor = endCursor !== null;
|
|
690
|
+
if (useCursor) {
|
|
691
|
+
if (endCursor === null) return null;
|
|
692
|
+
if (body.page?.after === endCursor) return null;
|
|
693
|
+
return {
|
|
694
|
+
...body,
|
|
695
|
+
page: advancePage(body.page, { after: endCursor })
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
const prevFrom = typeof body.page?.from === "number" ? body.page.from : 0;
|
|
699
|
+
return {
|
|
700
|
+
...body,
|
|
701
|
+
page: advancePage(body.page, { from: prevFrom + count })
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
function paginate(fetchPage, body, opts = {}) {
|
|
705
|
+
const { signal, maxPages = Number.POSITIVE_INFINITY, mode = "auto" } = opts;
|
|
706
|
+
async function* pages() {
|
|
707
|
+
let current = body;
|
|
708
|
+
let fetched = 0;
|
|
709
|
+
while (true) {
|
|
710
|
+
if (fetched >= maxPages) return;
|
|
711
|
+
if (signal?.aborted) throw abortError();
|
|
712
|
+
const response = await fetchPage(current, signal, fetched === 0);
|
|
713
|
+
const next = nextPageRequest(current, response, mode);
|
|
714
|
+
yield response;
|
|
715
|
+
fetched += 1;
|
|
716
|
+
if (next === null) return;
|
|
717
|
+
current = next;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
async function* items() {
|
|
721
|
+
for await (const page of pages()) {
|
|
722
|
+
yield* page.items;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
async function toArray() {
|
|
726
|
+
const out = [];
|
|
727
|
+
for await (const item of items()) out.push(item);
|
|
728
|
+
return out;
|
|
729
|
+
}
|
|
730
|
+
return {
|
|
731
|
+
pages,
|
|
732
|
+
items,
|
|
733
|
+
toArray,
|
|
734
|
+
[Symbol.asyncIterator]: pages
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
|
|
659
738
|
// src/gen/core/serverSentEvents.gen.ts
|
|
660
739
|
var __STANDARD_REQUEST_INIT_KEYS = [
|
|
661
740
|
"method",
|
|
@@ -5080,7 +5159,7 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
|
|
|
5080
5159
|
}
|
|
5081
5160
|
|
|
5082
5161
|
// src/runtime/version.ts
|
|
5083
|
-
var packageVersion = "10.0.0-alpha.
|
|
5162
|
+
var packageVersion = "10.0.0-alpha.34";
|
|
5084
5163
|
|
|
5085
5164
|
// src/runtime/supportLogger.ts
|
|
5086
5165
|
var NoopSupportLogger = class {
|
|
@@ -6785,6 +6864,70 @@ function evaluateSdkResponse(raw, opts) {
|
|
|
6785
6864
|
return raw.data !== void 0 ? raw.data : raw;
|
|
6786
6865
|
}
|
|
6787
6866
|
|
|
6867
|
+
// src/runtime/searchPagination.ts
|
|
6868
|
+
var NON_PAGINATED_SEARCH_METHODS = /* @__PURE__ */ new Set(["searchVariablesAsDto"]);
|
|
6869
|
+
function mergeAbortSignals(outer, inner) {
|
|
6870
|
+
if (!inner) return outer;
|
|
6871
|
+
const anyFn = AbortSignal.any;
|
|
6872
|
+
if (typeof anyFn === "function") return anyFn([outer, inner]);
|
|
6873
|
+
const ac = new AbortController();
|
|
6874
|
+
if (outer.aborted || inner.aborted) {
|
|
6875
|
+
ac.abort();
|
|
6876
|
+
return ac.signal;
|
|
6877
|
+
}
|
|
6878
|
+
const onAbort = () => ac.abort();
|
|
6879
|
+
outer.addEventListener("abort", onAbort, { once: true });
|
|
6880
|
+
inner.addEventListener("abort", onAbort, { once: true });
|
|
6881
|
+
return ac.signal;
|
|
6882
|
+
}
|
|
6883
|
+
function installSearchPagination(client2) {
|
|
6884
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6885
|
+
let proto = Object.getPrototypeOf(client2);
|
|
6886
|
+
while (proto && proto !== Object.prototype) {
|
|
6887
|
+
for (const name of Object.getOwnPropertyNames(proto)) {
|
|
6888
|
+
if (seen.has(name)) continue;
|
|
6889
|
+
if (!/^search[A-Z]/.test(name)) continue;
|
|
6890
|
+
if (NON_PAGINATED_SEARCH_METHODS.has(name)) continue;
|
|
6891
|
+
const method = proto[name];
|
|
6892
|
+
if (typeof method !== "function") continue;
|
|
6893
|
+
seen.add(name);
|
|
6894
|
+
const call = method.bind(client2);
|
|
6895
|
+
const wrapper = ((...args) => call(...args));
|
|
6896
|
+
wrapper.paginate = (body, opts = {}) => {
|
|
6897
|
+
const { consistency, ...pageOpts } = opts;
|
|
6898
|
+
const fetchPage = (b, signal, isFirstPage = false) => {
|
|
6899
|
+
const baseConsistency = isFirstPage ? consistency ?? { waitUpToMs: 0 } : { waitUpToMs: 0 };
|
|
6900
|
+
const consistencyValue = signal ? {
|
|
6901
|
+
...baseConsistency,
|
|
6902
|
+
abortSignal: mergeAbortSignals(
|
|
6903
|
+
signal,
|
|
6904
|
+
baseConsistency.abortSignal
|
|
6905
|
+
)
|
|
6906
|
+
} : baseConsistency;
|
|
6907
|
+
const consistencyArg = { consistency: consistencyValue };
|
|
6908
|
+
const p = call(b, consistencyArg);
|
|
6909
|
+
if (signal) {
|
|
6910
|
+
const onAbort = () => p.cancel?.();
|
|
6911
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
6912
|
+
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
6913
|
+
p.then(cleanup, cleanup);
|
|
6914
|
+
if (signal.aborted) p.cancel?.();
|
|
6915
|
+
}
|
|
6916
|
+
return p;
|
|
6917
|
+
};
|
|
6918
|
+
return paginate(fetchPage, body, pageOpts);
|
|
6919
|
+
};
|
|
6920
|
+
Object.defineProperty(client2, name, {
|
|
6921
|
+
value: wrapper,
|
|
6922
|
+
writable: true,
|
|
6923
|
+
enumerable: false,
|
|
6924
|
+
configurable: true
|
|
6925
|
+
});
|
|
6926
|
+
}
|
|
6927
|
+
proto = Object.getPrototypeOf(proto);
|
|
6928
|
+
}
|
|
6929
|
+
}
|
|
6930
|
+
|
|
6788
6931
|
// src/gen/CamundaClient.ts
|
|
6789
6932
|
function deepFreeze2(obj) {
|
|
6790
6933
|
if (obj && typeof obj === "object" && !Object.isFrozen(obj)) {
|
|
@@ -6835,7 +6978,7 @@ function toCancelable2(factory) {
|
|
|
6835
6978
|
function createCamundaClient(options) {
|
|
6836
6979
|
return new CamundaClient(options);
|
|
6837
6980
|
}
|
|
6838
|
-
var
|
|
6981
|
+
var CamundaClientBase = class {
|
|
6839
6982
|
_client;
|
|
6840
6983
|
_config;
|
|
6841
6984
|
_auth = createAuthFacade({
|
|
@@ -6962,6 +7105,7 @@ var CamundaClient = class {
|
|
|
6962
7105
|
return ["config.hydrated"];
|
|
6963
7106
|
}
|
|
6964
7107
|
});
|
|
7108
|
+
installSearchPagination(this);
|
|
6965
7109
|
}
|
|
6966
7110
|
get config() {
|
|
6967
7111
|
return this._config;
|
|
@@ -21111,6 +21255,7 @@ var CamundaClient = class {
|
|
|
21111
21255
|
});
|
|
21112
21256
|
}
|
|
21113
21257
|
};
|
|
21258
|
+
var CamundaClient = CamundaClientBase;
|
|
21114
21259
|
|
|
21115
21260
|
export {
|
|
21116
21261
|
isSdkError,
|
|
@@ -21124,8 +21269,10 @@ export {
|
|
|
21124
21269
|
VariableCollector,
|
|
21125
21270
|
collectTypedVariables,
|
|
21126
21271
|
JobActionReceipt,
|
|
21272
|
+
nextPageRequest,
|
|
21273
|
+
paginate,
|
|
21127
21274
|
CancelError,
|
|
21128
21275
|
createCamundaClient,
|
|
21129
21276
|
CamundaClient
|
|
21130
21277
|
};
|
|
21131
|
-
//# sourceMappingURL=chunk-
|
|
21278
|
+
//# sourceMappingURL=chunk-DVCU3RZY.js.map
|