@reventlessdev/reventless-aws 3.0.0-alpha.333 → 3.0.0-alpha.335
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 +21 -0
- package/package.json +8 -8
- package/src/Platform.res +71 -6
- package/src/Platform.res.mjs +63 -12
- package/src/adapter/Runtime/AutomationSliceEntryPoint_Ops.res +18 -3
- package/src/adapter/Runtime/AutomationSliceEntryPoint_Ops.res.mjs +13 -1
- package/src/capability/Capability_Messaging.res +141 -0
- package/src/capability/Capability_Messaging.res.mjs +96 -0
- package/src/capability/Capability_Messaging_Ses.res +27 -14
- package/src/capability/Capability_Messaging_Ses.res.mjs +5 -6
- package/src/util/Util_Bundle.res +125 -0
- package/src/util/Util_Bundle.res.mjs +90 -0
- package/tests/Capability_MessagingTest.res +100 -0
- package/tests/Capability_MessagingTest.res.mjs +85 -0
- package/tests/Util_BundleDependencyClosureTest.res +111 -0
- package/tests/Util_BundleDependencyClosureTest.res.mjs +129 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Nodefs from "node:fs";
|
|
4
|
+
import * as Nodeos from "node:os";
|
|
5
|
+
import * as Nodepath from "node:path";
|
|
6
|
+
import * as Util_Bundle$ReventlessAws from "../src/util/Util_Bundle.res.mjs";
|
|
7
|
+
|
|
8
|
+
function mkTmpRoot(prefix) {
|
|
9
|
+
return Nodefs.realpathSync(Nodefs.mkdtempSync(Nodepath.join(Nodeos.tmpdir(), prefix)));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function writePkg(root, name, files) {
|
|
13
|
+
Nodefs.mkdirSync(root, {
|
|
14
|
+
recursive: true
|
|
15
|
+
});
|
|
16
|
+
Nodefs.writeFileSync(Nodepath.join(root, "package.json"), `{"name":"` + name + `","version":"1.0.0"}`, "utf8");
|
|
17
|
+
files.forEach(param => {
|
|
18
|
+
let abs = Nodepath.join(root, param[0]);
|
|
19
|
+
Nodefs.mkdirSync(Nodepath.dirname(abs), {
|
|
20
|
+
recursive: true
|
|
21
|
+
});
|
|
22
|
+
Nodefs.writeFileSync(abs, param[1], "utf8");
|
|
23
|
+
});
|
|
24
|
+
return root;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let hostName = "@fixture/closure-host";
|
|
28
|
+
|
|
29
|
+
let traitName = "@fixture/closure-trait";
|
|
30
|
+
|
|
31
|
+
let rulesName = "@fixture/closure-rules";
|
|
32
|
+
|
|
33
|
+
let hostRoot = mkTmpRoot("bundle-closure-");
|
|
34
|
+
|
|
35
|
+
let traitRoot = Nodepath.join(hostRoot, "node_modules", traitName);
|
|
36
|
+
|
|
37
|
+
let rulesRoot = Nodepath.join(hostRoot, "node_modules", rulesName);
|
|
38
|
+
|
|
39
|
+
writePkg(hostRoot, hostName, [[
|
|
40
|
+
"src/Slice.res.mjs",
|
|
41
|
+
`import * as Trait from "` + traitName + `";
|
|
42
|
+
import * as Sury from "sury";
|
|
43
|
+
import * as Fs from "node:fs";
|
|
44
|
+
import * as Path from "path";
|
|
45
|
+
import * as Ddb from "@aws-sdk/client-dynamodb";
|
|
46
|
+
import * as Missing from "@fixture/never-installed";
|
|
47
|
+
export const handle = () => Trait.rule(Sury, Fs, Path, Ddb, Missing);
|
|
48
|
+
`
|
|
49
|
+
]]);
|
|
50
|
+
|
|
51
|
+
writePkg(traitRoot, traitName, [[
|
|
52
|
+
"src/Trait.res.mjs",
|
|
53
|
+
`import * as Rules from "` + rulesName + `";
|
|
54
|
+
export const rule = () => Rules.check();
|
|
55
|
+
`
|
|
56
|
+
]]);
|
|
57
|
+
|
|
58
|
+
writePkg(rulesRoot, rulesName, [[
|
|
59
|
+
"src/Rules.res.mjs",
|
|
60
|
+
`export const check = () => true;
|
|
61
|
+
`
|
|
62
|
+
]]);
|
|
63
|
+
|
|
64
|
+
function closureOf(packageDirs) {
|
|
65
|
+
Util_Bundle$ReventlessAws.addImportedPackageClosure(packageDirs);
|
|
66
|
+
return packageDirs;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
globalThis.describe("Util_Bundle — bundled user packages carry their imports", () => {
|
|
70
|
+
globalThis.afterAll(() => {
|
|
71
|
+
Nodefs.rmSync(hostRoot, {
|
|
72
|
+
recursive: true,
|
|
73
|
+
force: true
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
globalThis.test("a dependency only the importing package can resolve is added", () => {
|
|
77
|
+
let packageDirs = Object.fromEntries([[
|
|
78
|
+
hostName,
|
|
79
|
+
hostRoot
|
|
80
|
+
]]);
|
|
81
|
+
globalThis.expect((Util_Bundle$ReventlessAws.addImportedPackageClosure(packageDirs), packageDirs)[traitName]).toEqual(traitRoot);
|
|
82
|
+
});
|
|
83
|
+
globalThis.test("the walk is transitive — the dependency's own imports come too", () => {
|
|
84
|
+
let packageDirs = Object.fromEntries([[
|
|
85
|
+
hostName,
|
|
86
|
+
hostRoot
|
|
87
|
+
]]);
|
|
88
|
+
globalThis.expect((Util_Bundle$ReventlessAws.addImportedPackageClosure(packageDirs), packageDirs)[rulesName]).toEqual(rulesRoot);
|
|
89
|
+
});
|
|
90
|
+
globalThis.test("packages the deployed runtime provides are left out", () => {
|
|
91
|
+
let packageDirs = Object.fromEntries([[
|
|
92
|
+
hostName,
|
|
93
|
+
hostRoot
|
|
94
|
+
]]);
|
|
95
|
+
let bundled = Object.keys((Util_Bundle$ReventlessAws.addImportedPackageClosure(packageDirs), packageDirs));
|
|
96
|
+
globalThis.expect(bundled.includes("sury")).toBe(false);
|
|
97
|
+
globalThis.expect(bundled.includes("fs")).toBe(false);
|
|
98
|
+
globalThis.expect(bundled.includes("path")).toBe(false);
|
|
99
|
+
globalThis.expect(bundled.includes("@aws-sdk/client-dynamodb")).toBe(false);
|
|
100
|
+
});
|
|
101
|
+
globalThis.test("an import that resolves nowhere is skipped, not thrown on", () => {
|
|
102
|
+
let packageDirs = Object.fromEntries([[
|
|
103
|
+
hostName,
|
|
104
|
+
hostRoot
|
|
105
|
+
]]);
|
|
106
|
+
let bundled = Object.keys((Util_Bundle$ReventlessAws.addImportedPackageClosure(packageDirs), packageDirs));
|
|
107
|
+
globalThis.expect(bundled.includes("@fixture/never-installed")).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
globalThis.test("framework packages are starting points, not walked", () => {
|
|
110
|
+
let packageDirs = Object.fromEntries([[
|
|
111
|
+
"@reventlessdev/reventless-aws",
|
|
112
|
+
Util_Bundle$ReventlessAws.resolvePackageRoot(undefined, "@reventlessdev/reventless-aws")
|
|
113
|
+
]]);
|
|
114
|
+
globalThis.expect(Object.keys((Util_Bundle$ReventlessAws.addImportedPackageClosure(packageDirs), packageDirs)).length).toBe(1);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export {
|
|
119
|
+
mkTmpRoot,
|
|
120
|
+
writePkg,
|
|
121
|
+
hostName,
|
|
122
|
+
traitName,
|
|
123
|
+
rulesName,
|
|
124
|
+
hostRoot,
|
|
125
|
+
traitRoot,
|
|
126
|
+
rulesRoot,
|
|
127
|
+
closureOf,
|
|
128
|
+
}
|
|
129
|
+
/* hostRoot Not a pure module */
|