alchemy 2.0.0-beta.28 → 2.0.0-beta.29
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/bin/exec.js +98 -6
- package/bin/exec.js.map +1 -1
- package/lib/AWS/IAM/SAMLProvider.d.ts +2 -1
- package/lib/AWS/IAM/SAMLProvider.d.ts.map +1 -1
- package/lib/AWS/IAM/SAMLProvider.js +30 -9
- package/lib/AWS/IAM/SAMLProvider.js.map +1 -1
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +55 -11
- package/lib/Apply.js.map +1 -1
- package/lib/Cli/commands/bootstrap.d.ts +1 -1
- package/lib/Cli/commands/bootstrap.d.ts.map +1 -1
- package/lib/Cli/commands/bootstrap.js +2 -1
- package/lib/Cli/commands/bootstrap.js.map +1 -1
- package/lib/Cloudflare/Access.d.ts +19 -0
- package/lib/Cloudflare/Access.d.ts.map +1 -0
- package/lib/Cloudflare/Access.js +64 -0
- package/lib/Cloudflare/Access.js.map +1 -0
- package/lib/Cloudflare/AiGateway/AiGateway.d.ts +244 -0
- package/lib/Cloudflare/AiGateway/AiGateway.d.ts.map +1 -0
- package/lib/Cloudflare/AiGateway/AiGateway.js +269 -0
- package/lib/Cloudflare/AiGateway/AiGateway.js.map +1 -0
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.d.ts +103 -0
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.d.ts.map +1 -0
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.js +99 -0
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.js.map +1 -0
- package/lib/Cloudflare/AiGateway/index.d.ts +3 -0
- package/lib/Cloudflare/AiGateway/index.d.ts.map +1 -0
- package/lib/Cloudflare/AiGateway/index.js +3 -0
- package/lib/Cloudflare/AiGateway/index.js.map +1 -0
- package/lib/Cloudflare/EdgeSession.d.ts +2 -1
- package/lib/Cloudflare/EdgeSession.d.ts.map +1 -1
- package/lib/Cloudflare/EdgeSession.js +8 -4
- package/lib/Cloudflare/EdgeSession.js.map +1 -1
- package/lib/Cloudflare/Providers.d.ts +2 -1
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +5 -1
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/StateStore/Api.d.ts +10 -0
- package/lib/Cloudflare/StateStore/Api.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Api.js +12 -1
- package/lib/Cloudflare/StateStore/Api.js.map +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts +4 -3
- package/lib/Cloudflare/StateStore/State.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/State.js +103 -13
- package/lib/Cloudflare/StateStore/State.js.map +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +2 -1
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +40 -31
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/index.d.ts +1 -0
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +1 -0
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/Plan.d.ts +8 -0
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +12 -5
- package/lib/Plan.js.map +1 -1
- package/lib/State/HttpStateApi.d.ts +19 -1
- package/lib/State/HttpStateApi.d.ts.map +1 -1
- package/lib/State/HttpStateApi.js +18 -1
- package/lib/State/HttpStateApi.js.map +1 -1
- package/lib/Util/cached-function.d.ts +38 -0
- package/lib/Util/cached-function.d.ts.map +1 -0
- package/lib/Util/cached-function.js +53 -0
- package/lib/Util/cached-function.js.map +1 -0
- package/lib/Util/scc.d.ts +12 -0
- package/lib/Util/scc.d.ts.map +1 -0
- package/lib/Util/scc.js +81 -0
- package/lib/Util/scc.js.map +1 -0
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/AWS/IAM/SAMLProvider.ts +47 -18
- package/src/Apply.ts +72 -8
- package/src/Cli/commands/bootstrap.ts +2 -0
- package/src/Cloudflare/Access.ts +110 -0
- package/src/Cloudflare/AiGateway/AiGateway.ts +526 -0
- package/src/Cloudflare/AiGateway/AiGatewayBinding.ts +190 -0
- package/src/Cloudflare/AiGateway/index.ts +2 -0
- package/src/Cloudflare/EdgeSession.ts +15 -5
- package/src/Cloudflare/Providers.ts +7 -0
- package/src/Cloudflare/StateStore/Api.ts +18 -0
- package/src/Cloudflare/StateStore/State.ts +130 -12
- package/src/Cloudflare/Workers/InferEnv.ts +7 -5
- package/src/Cloudflare/Workers/Worker.ts +44 -33
- package/src/Cloudflare/index.ts +1 -0
- package/src/Plan.ts +21 -5
- package/src/State/HttpStateApi.ts +22 -1
- package/src/Util/cached-function.ts +75 -0
- package/src/Util/scc.ts +89 -0
package/src/Util/scc.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute the set of graph nodes that participate in a dependency cycle.
|
|
3
|
+
*
|
|
4
|
+
* A node is considered "in a cycle" iff it sits in a strongly-connected
|
|
5
|
+
* component (SCC) of size > 1, or has a self-edge (size-1 SCC that loops
|
|
6
|
+
* back to itself).
|
|
7
|
+
*
|
|
8
|
+
* Implementation is iterative Tarjan's algorithm to avoid blowing the JS
|
|
9
|
+
* call stack on very wide graphs.
|
|
10
|
+
*/
|
|
11
|
+
export const findCycleMembers = (
|
|
12
|
+
edges: Record<string, readonly string[]>,
|
|
13
|
+
): Set<string> => {
|
|
14
|
+
const cycleMembers = new Set<string>();
|
|
15
|
+
|
|
16
|
+
let index = 0;
|
|
17
|
+
const indexOf = new Map<string, number>();
|
|
18
|
+
const lowlink = new Map<string, number>();
|
|
19
|
+
const onStack = new Set<string>();
|
|
20
|
+
const stack: string[] = [];
|
|
21
|
+
|
|
22
|
+
type Frame = { node: string; childIdx: number };
|
|
23
|
+
const callStack: Frame[] = [];
|
|
24
|
+
|
|
25
|
+
const startNode = (node: string) => {
|
|
26
|
+
indexOf.set(node, index);
|
|
27
|
+
lowlink.set(node, index);
|
|
28
|
+
index += 1;
|
|
29
|
+
stack.push(node);
|
|
30
|
+
onStack.add(node);
|
|
31
|
+
callStack.push({ node, childIdx: 0 });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
for (const root of Object.keys(edges)) {
|
|
35
|
+
if (indexOf.has(root)) continue;
|
|
36
|
+
startNode(root);
|
|
37
|
+
|
|
38
|
+
while (callStack.length > 0) {
|
|
39
|
+
const frame = callStack[callStack.length - 1];
|
|
40
|
+
const children = edges[frame.node] ?? [];
|
|
41
|
+
if (frame.childIdx < children.length) {
|
|
42
|
+
const child = children[frame.childIdx];
|
|
43
|
+
frame.childIdx += 1;
|
|
44
|
+
if (!indexOf.has(child)) {
|
|
45
|
+
startNode(child);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (onStack.has(child)) {
|
|
49
|
+
lowlink.set(
|
|
50
|
+
frame.node,
|
|
51
|
+
Math.min(lowlink.get(frame.node)!, indexOf.get(child)!),
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// All children processed: maybe close an SCC.
|
|
58
|
+
if (lowlink.get(frame.node) === indexOf.get(frame.node)) {
|
|
59
|
+
const scc: string[] = [];
|
|
60
|
+
for (;;) {
|
|
61
|
+
const w = stack.pop()!;
|
|
62
|
+
onStack.delete(w);
|
|
63
|
+
scc.push(w);
|
|
64
|
+
if (w === frame.node) break;
|
|
65
|
+
}
|
|
66
|
+
if (scc.length > 1) {
|
|
67
|
+
for (const fqn of scc) cycleMembers.add(fqn);
|
|
68
|
+
} else {
|
|
69
|
+
// Size-1 SCC: only counts as a cycle if it has a self-edge.
|
|
70
|
+
const only = scc[0];
|
|
71
|
+
if ((edges[only] ?? []).includes(only)) {
|
|
72
|
+
cycleMembers.add(only);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Pop frame and propagate lowlink up to the parent.
|
|
78
|
+
callStack.pop();
|
|
79
|
+
const parent = callStack[callStack.length - 1];
|
|
80
|
+
if (parent) {
|
|
81
|
+
const cur = lowlink.get(parent.node)!;
|
|
82
|
+
const childLow = lowlink.get(frame.node)!;
|
|
83
|
+
if (childLow < cur) lowlink.set(parent.node, childLow);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return cycleMembers;
|
|
89
|
+
};
|