next-workflow-builder 0.5.0 → 0.7.0
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 +156 -0
- package/README.md +1 -1
- package/dist/chunk-5J6TNMJG.js +1 -0
- package/dist/chunk-6UXAINJQ.js +1 -0
- package/dist/chunk-7WFHHPX4.js +1 -0
- package/dist/chunk-BNX2SV7E.js +1 -0
- package/dist/chunk-CYVALTSI.js +218 -0
- package/dist/chunk-DMHGXYVW.js +14 -0
- package/dist/chunk-HB2H2PVI.js +42 -0
- package/dist/chunk-IEOZJAW2.js +1 -0
- package/dist/chunk-KFTXS23Q.js +1 -0
- package/dist/chunk-NI6U7PHC.js +76 -0
- package/dist/chunk-PRVESNIO.js +1 -0
- package/dist/chunk-QRG4O4PE.js +2 -0
- package/dist/chunk-R5GS6TJS.js +1 -0
- package/dist/client/index.js +160 -13725
- package/dist/condition-CFAA7UDI.js +1 -0
- package/dist/database-query-OHFQUPLV.js +1 -0
- package/dist/handler-NWAMWKXW.js +1 -0
- package/dist/http-request-EHJHOTNA.js +1 -0
- package/dist/loop-5LPVY452.js +1 -0
- package/dist/merge-HYBHX22D.js +1 -0
- package/dist/next/index.d.ts +9 -0
- package/dist/next/index.js +1 -84
- package/dist/plugins/index.js +1 -54
- package/dist/server/api/index.d.ts +30 -1
- package/dist/server/api/index.js +18 -2360
- package/dist/server/index.js +1 -60
- package/dist/switch-ZPVREROE.js +1 -0
- package/drizzle.config.ts +9 -0
- package/package.json +27 -2
- package/src/plugins/types.ts +31 -0
- package/src/server/db/schema.ts +228 -0
- package/src/server/lib/utils/id.ts +26 -0
- package/dist/chunk-3XFDIK7H.js +0 -251
- package/dist/chunk-5H76TY4T.js +0 -51
- package/dist/chunk-5YYA34YV.js +0 -96
- package/dist/chunk-C7GDB4KC.js +0 -550
- package/dist/chunk-CKE7ETZL.js +0 -169
- package/dist/chunk-EMCA7GLF.js +0 -1305
- package/dist/chunk-J72T2LRL.js +0 -66
- package/dist/chunk-JUV5RBYM.js +0 -105
- package/dist/chunk-O3I2INCD.js +0 -71
- package/dist/chunk-OQHML4II.js +0 -36
- package/dist/chunk-PEVVELQ6.js +0 -438
- package/dist/condition-VHC4KYLI.js +0 -29
- package/dist/database-query-BYPF5CDB.js +0 -99
- package/dist/http-request-4OT32ZXA.js +0 -76
- package/dist/loop-S5H7DSCB.js +0 -47
- package/dist/merge-X5JAIZSZ.js +0 -107
- package/dist/style-prefixed.css +0 -5167
- package/dist/switch-WZBVDWWR.js +0 -68
package/dist/merge-X5JAIZSZ.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import "./chunk-J72T2LRL.js";
|
|
2
|
-
import "./chunk-C7GDB4KC.js";
|
|
3
|
-
import "./chunk-JUV5RBYM.js";
|
|
4
|
-
import "./chunk-5YYA34YV.js";
|
|
5
|
-
import "./chunk-OQHML4II.js";
|
|
6
|
-
import "./chunk-5H76TY4T.js";
|
|
7
|
-
import "./chunk-CKE7ETZL.js";
|
|
8
|
-
import "./chunk-3XFDIK7H.js";
|
|
9
|
-
import "./chunk-O3I2INCD.js";
|
|
10
|
-
import {
|
|
11
|
-
withStepLogging
|
|
12
|
-
} from "./chunk-PEVVELQ6.js";
|
|
13
|
-
|
|
14
|
-
// src/plugins/merge/merge.ts
|
|
15
|
-
import "server-only";
|
|
16
|
-
function getField(item, field) {
|
|
17
|
-
if (item && typeof item === "object") {
|
|
18
|
-
return item[field];
|
|
19
|
-
}
|
|
20
|
-
return void 0;
|
|
21
|
-
}
|
|
22
|
-
function mergeAppend(items1, items2) {
|
|
23
|
-
const merged = [...items1, ...items2];
|
|
24
|
-
return { merged, totalItems: merged.length };
|
|
25
|
-
}
|
|
26
|
-
function mergeByPosition(items1, items2, unmatchedHandling) {
|
|
27
|
-
const maxLength = Math.max(items1.length, items2.length);
|
|
28
|
-
const useNull = unmatchedHandling !== "discard";
|
|
29
|
-
const merged = [];
|
|
30
|
-
for (let i = 0; i < maxLength; i++) {
|
|
31
|
-
const item1 = items1[i];
|
|
32
|
-
const item2 = items2[i];
|
|
33
|
-
if (!useNull && (item1 === void 0 || item2 === void 0)) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
merged.push({
|
|
37
|
-
...item1 && typeof item1 === "object" ? item1 : { input1: item1 ?? null },
|
|
38
|
-
...item2 && typeof item2 === "object" ? item2 : { input2: item2 ?? null }
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return { merged, totalItems: merged.length };
|
|
42
|
-
}
|
|
43
|
-
function mergeByFields(items1, items2, field1, field2, joinType) {
|
|
44
|
-
const map2 = /* @__PURE__ */ new Map();
|
|
45
|
-
for (const item of items2) {
|
|
46
|
-
const key = getField(item, field2);
|
|
47
|
-
if (!map2.has(key)) {
|
|
48
|
-
map2.set(key, []);
|
|
49
|
-
}
|
|
50
|
-
map2.get(key).push(item);
|
|
51
|
-
}
|
|
52
|
-
const merged = [];
|
|
53
|
-
const matchedKeys2 = /* @__PURE__ */ new Set();
|
|
54
|
-
for (const item1 of items1) {
|
|
55
|
-
const key = getField(item1, field1);
|
|
56
|
-
const matches = map2.get(key);
|
|
57
|
-
if (matches && matches.length > 0) {
|
|
58
|
-
matchedKeys2.add(key);
|
|
59
|
-
for (const item2 of matches) {
|
|
60
|
-
merged.push({
|
|
61
|
-
...typeof item1 === "object" ? item1 : {},
|
|
62
|
-
...typeof item2 === "object" ? item2 : {}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
} else if (joinType === "leftOuter" || joinType === "fullOuter") {
|
|
66
|
-
merged.push({ ...typeof item1 === "object" ? item1 : {} });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (joinType === "rightOuter" || joinType === "fullOuter") {
|
|
70
|
-
for (const item2 of items2) {
|
|
71
|
-
const key = getField(item2, field2);
|
|
72
|
-
if (!matchedKeys2.has(key)) {
|
|
73
|
-
merged.push({ ...typeof item2 === "object" ? item2 : {} });
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return { merged, totalItems: merged.length };
|
|
78
|
-
}
|
|
79
|
-
function evaluateMerge(input) {
|
|
80
|
-
const items1 = Array.isArray(input.input1) ? input.input1 : [];
|
|
81
|
-
const items2 = Array.isArray(input.input2) ? input.input2 : [];
|
|
82
|
-
const mode = input.mode || "append";
|
|
83
|
-
switch (mode) {
|
|
84
|
-
case "append":
|
|
85
|
-
return mergeAppend(items1, items2);
|
|
86
|
-
case "combineByPosition":
|
|
87
|
-
return mergeByPosition(items1, items2, input.unmatchedHandling || "useNull");
|
|
88
|
-
case "combineByFields":
|
|
89
|
-
return mergeByFields(
|
|
90
|
-
items1,
|
|
91
|
-
items2,
|
|
92
|
-
input.matchField1 || "id",
|
|
93
|
-
input.matchField2 || "id",
|
|
94
|
-
input.joinType || "inner"
|
|
95
|
-
);
|
|
96
|
-
default:
|
|
97
|
-
return mergeAppend(items1, items2);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
async function mergeStep(input) {
|
|
101
|
-
"use step";
|
|
102
|
-
return withStepLogging(input, () => Promise.resolve(evaluateMerge(input)));
|
|
103
|
-
}
|
|
104
|
-
mergeStep.maxRetries = 0;
|
|
105
|
-
export {
|
|
106
|
-
mergeStep
|
|
107
|
-
};
|