@reventlessdev/reventless-seed-aws 1.0.0-alpha.5 → 1.0.0-alpha.6
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 +8 -0
- package/lib/bs/.compiler.log +2 -2
- package/lib/bs/.sourcedirs.json +1 -1
- package/lib/bs/compiler-info.json +2 -2
- package/lib/bs/src/ReventlessSeedAws.ast +0 -0
- package/lib/bs/src/ReventlessSeedAws.cmi +0 -0
- package/lib/bs/src/ReventlessSeedAws.cmt +0 -0
- package/lib/bs/src/ReventlessSeedAws.res +6 -7
- package/lib/bs/src/ReventlessSeedAws_Reset.ast +0 -0
- package/lib/bs/src/ReventlessSeedAws_Reset.cmi +0 -0
- package/lib/bs/src/ReventlessSeedAws_Reset.cmt +0 -0
- package/lib/bs/src/ReventlessSeedAws_Reset.res +8 -15
- package/lib/bs/tests/EndpointResolutionTest.ast +0 -0
- package/lib/bs/tests/EndpointResolutionTest.cmi +0 -0
- package/lib/bs/tests/EndpointResolutionTest.cmt +0 -0
- package/lib/bs/tests/EndpointResolutionTest.res +2 -3
- package/lib/ocaml/.compiler.log +2 -2
- package/lib/ocaml/EndpointResolutionTest.ast +0 -0
- package/lib/ocaml/EndpointResolutionTest.cmi +0 -0
- package/lib/ocaml/EndpointResolutionTest.cmt +0 -0
- package/lib/ocaml/EndpointResolutionTest.res +2 -3
- package/lib/ocaml/ReventlessSeedAws.ast +0 -0
- package/lib/ocaml/ReventlessSeedAws.cmi +0 -0
- package/lib/ocaml/ReventlessSeedAws.cmt +0 -0
- package/lib/ocaml/ReventlessSeedAws.res +6 -7
- package/lib/ocaml/ReventlessSeedAws_Reset.ast +0 -0
- package/lib/ocaml/ReventlessSeedAws_Reset.cmi +0 -0
- package/lib/ocaml/ReventlessSeedAws_Reset.cmt +0 -0
- package/lib/ocaml/ReventlessSeedAws_Reset.res +8 -15
- package/package.json +5 -4
- package/rescript.json +1 -0
- package/src/ReventlessSeedAws.res +6 -7
- package/src/ReventlessSeedAws_Reset.res +8 -15
- package/tests/EndpointResolutionTest.res +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 1.0.0-alpha.6 (2026-07-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @reventlessdev/reventless-seed-aws
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# 1.0.0-alpha.5 (2026-07-31)
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
package/lib/bs/.compiler.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#Start(
|
|
2
|
-
#Done(
|
|
1
|
+
#Start(1785535392961)
|
|
2
|
+
#Done(1785535392990)
|
package/lib/bs/.sourcedirs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"cmt_scan":[{"also_scan_build_root":true,"build_root":"lib/bs","scan_dirs":["src","tests"]}],"dirs":["src","tests"],"generated":[],"pkgs":[["@reventlessdev/rescript-aws-sdk","/home/runner/work/reventless-core/reventless-core/rescript/aws-sdk"],["@reventlessdev/rescript-jest","/home/runner/work/reventless-core/reventless-core/rescript/jest"],["@reventlessdev/reventless-seed","/home/runner/work/reventless-core/reventless-core/reventless/seed"]],"version":2}
|
|
1
|
+
{"cmt_scan":[{"also_scan_build_root":true,"build_root":"lib/bs","scan_dirs":["src","tests"]}],"dirs":["src","tests"],"generated":[],"pkgs":[["@reventlessdev/rescript-aws-sdk","/home/runner/work/reventless-core/reventless-core/rescript/aws-sdk"],["@reventlessdev/rescript-jest","/home/runner/work/reventless-core/reventless-core/rescript/jest"],["@reventlessdev/rescript-node","/home/runner/work/reventless-core/reventless-core/rescript/node"],["@reventlessdev/reventless-seed","/home/runner/work/reventless-core/reventless-core/reventless/seed"]],"version":2}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "12.3.0",
|
|
3
3
|
"bsc_path": "/home/runner/work/reventless-core/reventless-core/node_modules/@rescript/linux-x64/bin/bsc.exe",
|
|
4
4
|
"bsc_hash": "75e3a59c95cc953608fd3dd6ea6ed68141bba4414a20a52f114261b8a48385fa",
|
|
5
|
-
"rescript_config_hash": "
|
|
5
|
+
"rescript_config_hash": "c18a0067c363fd1290f6e7f6fe6212d2e16e201c1702fac667962047f88ed468",
|
|
6
6
|
"runtime_path": "/home/runner/work/reventless-core/reventless-core/node_modules/@rescript/runtime",
|
|
7
|
-
"generated_at": "
|
|
7
|
+
"generated_at": "1785535392996"
|
|
8
8
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14,11 +14,6 @@ open ReventlessSeed
|
|
|
14
14
|
|
|
15
15
|
// ── Node bindings ─────────────────────────────────────────────────────────────
|
|
16
16
|
|
|
17
|
-
@val @scope("process") external processEnv: dict<string> = "env"
|
|
18
|
-
|
|
19
|
-
type execOptions = {cwd: string, encoding: string, env?: dict<string>}
|
|
20
|
-
@module("node:child_process")
|
|
21
|
-
external execFileSync: (string, array<string>, execOptions) => string = "execFileSync"
|
|
22
17
|
|
|
23
18
|
type fetchInit = {method: string, headers: dict<string>, body?: string}
|
|
24
19
|
type response
|
|
@@ -65,13 +60,17 @@ let envForBackend = (backend: option<string>): option<dict<string>> =>
|
|
|
65
60
|
switch backend {
|
|
66
61
|
| None => None
|
|
67
62
|
| Some(url) =>
|
|
68
|
-
let copy =
|
|
63
|
+
let copy = NodeProcess.env->Dict.toArray->Dict.fromArray
|
|
69
64
|
copy->Dict.set("PULUMI_BACKEND_URL", url)
|
|
70
65
|
Some(copy)
|
|
71
66
|
}
|
|
72
67
|
|
|
73
68
|
let pulumi = (~projectDir: string, ~backend: option<string>, args: array<string>): string =>
|
|
74
|
-
execFileSync(
|
|
69
|
+
NodeChildProcess.execFileSync(
|
|
70
|
+
"pulumi",
|
|
71
|
+
args,
|
|
72
|
+
{cwd: projectDir, encoding: "utf8", env: ?envForBackend(backend)},
|
|
73
|
+
)
|
|
75
74
|
|
|
76
75
|
// Stacks that actually exist in the Pulumi backend for this project — the names
|
|
77
76
|
// `pulumi stack output --stack <name>` accepts. A `Pulumi.<stack>.yaml` config
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -48,14 +48,7 @@ module Ddb = AwsSdk.DynamoDb
|
|
|
48
48
|
module Rgt = AwsSdk.ResourceGroupsTaggingApi
|
|
49
49
|
module S3 = AwsSdk.S3
|
|
50
50
|
|
|
51
|
-
@scope("process") @val external exit: int => unit = "exit"
|
|
52
|
-
@scope("process") @val external processEnv: dict<string> = "env"
|
|
53
|
-
@module("node:fs") external readFileSync: (string, string) => string = "readFileSync"
|
|
54
51
|
|
|
55
|
-
type stream
|
|
56
|
-
@scope("process") @val external stdin: stream = "stdin"
|
|
57
|
-
// `process.stdin.isTTY` is `true` interactively and `undefined` under a pipe/CI.
|
|
58
|
-
@get external isTTY: stream => option<bool> = "isTTY"
|
|
59
52
|
|
|
60
53
|
// The Pulumi project name, which the framework stamps as `reventless:platform` on
|
|
61
54
|
// every resource (`Plugin.res`: `platformName = getProjectName()`). Discovery
|
|
@@ -66,7 +59,7 @@ type stream
|
|
|
66
59
|
// the target project's Pulumi.yaml — the same dir the pulumi subprocess uses.
|
|
67
60
|
let projectName = (~projectDir: string): string => {
|
|
68
61
|
let path = `${projectDir}/Pulumi.yaml`
|
|
69
|
-
let raw = try readFileSync(path
|
|
62
|
+
let raw = try NodeFs.readFileSync(path) catch {
|
|
70
63
|
| _ => throw(Seed.Failed(`could not read ${path} to scope the wipe to this Pulumi project.`))
|
|
71
64
|
}
|
|
72
65
|
switch raw
|
|
@@ -561,7 +554,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
561
554
|
),
|
|
562
555
|
)
|
|
563
556
|
}
|
|
564
|
-
|
|
557
|
+
NodeProcess.env->Dict.set("AWS_REGION", region)
|
|
565
558
|
|
|
566
559
|
// Discover + count each target, scoped to its own project via the platform
|
|
567
560
|
// tag so a same-named stack from another project is never touched.
|
|
@@ -597,7 +590,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
597
590
|
Seed.Prompt.close()
|
|
598
591
|
Console.log("")
|
|
599
592
|
Console.log(`Nothing to reset — the selected scope already reads empty in ${region}.`)
|
|
600
|
-
exit(0)
|
|
593
|
+
NodeProcess.exit(0)
|
|
601
594
|
}
|
|
602
595
|
|
|
603
596
|
// Confirmation. Interactively, re-typing the exact stack name IS the
|
|
@@ -606,7 +599,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
606
599
|
// TTY (CI/scripts) there is nothing to type into, so
|
|
607
600
|
// REVENTLESS_WIPE_CONFIRM=<stack> is the equivalent opt-in. Dry-run is the
|
|
608
601
|
// default either way.
|
|
609
|
-
let interactive = stdin->isTTY->Option.getOr(false)
|
|
602
|
+
let interactive = NodeProcess.stdin->NodeProcess.isTTY->Option.getOr(false)
|
|
610
603
|
let confirmed = if interactive {
|
|
611
604
|
let typed = await Seed.Prompt.ask(
|
|
612
605
|
`About to permanently empty ${total->Int.toString} item(s)/object(s) across the selected scope of "${stack}". ` ++
|
|
@@ -624,7 +617,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
624
617
|
? "Dry run — nothing was deleted."
|
|
625
618
|
: `Dry run — nothing was deleted. Set REVENTLESS_WIPE_CONFIRM=${stack} to empty this scope non-interactively.`,
|
|
626
619
|
)
|
|
627
|
-
exit(0)
|
|
620
|
+
NodeProcess.exit(0)
|
|
628
621
|
}
|
|
629
622
|
|
|
630
623
|
for i in 0 to resolvedList->Array.length - 1 {
|
|
@@ -681,19 +674,19 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
681
674
|
|
|
682
675
|
Console.log("")
|
|
683
676
|
Console.log(`Reset complete — the selected scope of "${stack}" reads empty and is re-seedable.`)
|
|
684
|
-
exit(0)
|
|
677
|
+
NodeProcess.exit(0)
|
|
685
678
|
} catch {
|
|
686
679
|
| Seed.Failed(message) =>
|
|
687
680
|
Seed.Prompt.close()
|
|
688
681
|
Console.error("")
|
|
689
682
|
Console.error(`Reset aborted — ${message}`)
|
|
690
|
-
exit(1)
|
|
683
|
+
NodeProcess.exit(1)
|
|
691
684
|
| exn =>
|
|
692
685
|
Seed.Prompt.close()
|
|
693
686
|
Console.error("")
|
|
694
687
|
Console.error("Reset aborted with an unexpected error:")
|
|
695
688
|
Console.error(exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown"))
|
|
696
|
-
exit(1)
|
|
689
|
+
NodeProcess.exit(1)
|
|
697
690
|
}
|
|
698
691
|
}
|
|
699
692
|
go()->ignore
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
open JestGlobals
|
|
13
13
|
open ReventlessSeed
|
|
14
14
|
|
|
15
|
-
@val @scope("process") external processEnv: dict<string> = "env"
|
|
16
15
|
|
|
17
16
|
// Every value read here has an env override, and an ambient one in the runner's
|
|
18
17
|
// environment (AWS_REGION is routinely set) would silently stand in for the
|
|
@@ -24,7 +23,7 @@ let clearOverrides = () =>
|
|
|
24
23
|
"AWS_REGION",
|
|
25
24
|
"COGNITO_CLIENT_ID",
|
|
26
25
|
"SEED_SKIP_UPLOADS",
|
|
27
|
-
]->Array.forEach(k =>
|
|
26
|
+
]->Array.forEach(k => NodeProcess.env->Dict.set(k, ""))
|
|
28
27
|
|
|
29
28
|
let obj = entries => JSON.Encode.object(entries->Dict.fromArray)
|
|
30
29
|
let str = JSON.Encode.string
|
|
@@ -92,7 +91,7 @@ describe("endpointsFrom — host shell arm", () => {
|
|
|
92
91
|
})
|
|
93
92
|
|
|
94
93
|
testSync("REVENTLESS_UPLOAD_ENDPOINT overrides the legacy service and leaves the map alone", () => {
|
|
95
|
-
|
|
94
|
+
NodeProcess.env->Dict.set("REVENTLESS_UPLOAD_ENDPOINT", "https://override.example/")
|
|
96
95
|
let eps = ReventlessSeedAws.endpointsFrom(
|
|
97
96
|
~stack="alpha",
|
|
98
97
|
HostShellConfig(
|
package/lib/ocaml/.compiler.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#Start(
|
|
2
|
-
#Done(
|
|
1
|
+
#Start(1785535392961)
|
|
2
|
+
#Done(1785535392990)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
open JestGlobals
|
|
13
13
|
open ReventlessSeed
|
|
14
14
|
|
|
15
|
-
@val @scope("process") external processEnv: dict<string> = "env"
|
|
16
15
|
|
|
17
16
|
// Every value read here has an env override, and an ambient one in the runner's
|
|
18
17
|
// environment (AWS_REGION is routinely set) would silently stand in for the
|
|
@@ -24,7 +23,7 @@ let clearOverrides = () =>
|
|
|
24
23
|
"AWS_REGION",
|
|
25
24
|
"COGNITO_CLIENT_ID",
|
|
26
25
|
"SEED_SKIP_UPLOADS",
|
|
27
|
-
]->Array.forEach(k =>
|
|
26
|
+
]->Array.forEach(k => NodeProcess.env->Dict.set(k, ""))
|
|
28
27
|
|
|
29
28
|
let obj = entries => JSON.Encode.object(entries->Dict.fromArray)
|
|
30
29
|
let str = JSON.Encode.string
|
|
@@ -92,7 +91,7 @@ describe("endpointsFrom — host shell arm", () => {
|
|
|
92
91
|
})
|
|
93
92
|
|
|
94
93
|
testSync("REVENTLESS_UPLOAD_ENDPOINT overrides the legacy service and leaves the map alone", () => {
|
|
95
|
-
|
|
94
|
+
NodeProcess.env->Dict.set("REVENTLESS_UPLOAD_ENDPOINT", "https://override.example/")
|
|
96
95
|
let eps = ReventlessSeedAws.endpointsFrom(
|
|
97
96
|
~stack="alpha",
|
|
98
97
|
HostShellConfig(
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14,11 +14,6 @@ open ReventlessSeed
|
|
|
14
14
|
|
|
15
15
|
// ── Node bindings ─────────────────────────────────────────────────────────────
|
|
16
16
|
|
|
17
|
-
@val @scope("process") external processEnv: dict<string> = "env"
|
|
18
|
-
|
|
19
|
-
type execOptions = {cwd: string, encoding: string, env?: dict<string>}
|
|
20
|
-
@module("node:child_process")
|
|
21
|
-
external execFileSync: (string, array<string>, execOptions) => string = "execFileSync"
|
|
22
17
|
|
|
23
18
|
type fetchInit = {method: string, headers: dict<string>, body?: string}
|
|
24
19
|
type response
|
|
@@ -65,13 +60,17 @@ let envForBackend = (backend: option<string>): option<dict<string>> =>
|
|
|
65
60
|
switch backend {
|
|
66
61
|
| None => None
|
|
67
62
|
| Some(url) =>
|
|
68
|
-
let copy =
|
|
63
|
+
let copy = NodeProcess.env->Dict.toArray->Dict.fromArray
|
|
69
64
|
copy->Dict.set("PULUMI_BACKEND_URL", url)
|
|
70
65
|
Some(copy)
|
|
71
66
|
}
|
|
72
67
|
|
|
73
68
|
let pulumi = (~projectDir: string, ~backend: option<string>, args: array<string>): string =>
|
|
74
|
-
execFileSync(
|
|
69
|
+
NodeChildProcess.execFileSync(
|
|
70
|
+
"pulumi",
|
|
71
|
+
args,
|
|
72
|
+
{cwd: projectDir, encoding: "utf8", env: ?envForBackend(backend)},
|
|
73
|
+
)
|
|
75
74
|
|
|
76
75
|
// Stacks that actually exist in the Pulumi backend for this project — the names
|
|
77
76
|
// `pulumi stack output --stack <name>` accepts. A `Pulumi.<stack>.yaml` config
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -48,14 +48,7 @@ module Ddb = AwsSdk.DynamoDb
|
|
|
48
48
|
module Rgt = AwsSdk.ResourceGroupsTaggingApi
|
|
49
49
|
module S3 = AwsSdk.S3
|
|
50
50
|
|
|
51
|
-
@scope("process") @val external exit: int => unit = "exit"
|
|
52
|
-
@scope("process") @val external processEnv: dict<string> = "env"
|
|
53
|
-
@module("node:fs") external readFileSync: (string, string) => string = "readFileSync"
|
|
54
51
|
|
|
55
|
-
type stream
|
|
56
|
-
@scope("process") @val external stdin: stream = "stdin"
|
|
57
|
-
// `process.stdin.isTTY` is `true` interactively and `undefined` under a pipe/CI.
|
|
58
|
-
@get external isTTY: stream => option<bool> = "isTTY"
|
|
59
52
|
|
|
60
53
|
// The Pulumi project name, which the framework stamps as `reventless:platform` on
|
|
61
54
|
// every resource (`Plugin.res`: `platformName = getProjectName()`). Discovery
|
|
@@ -66,7 +59,7 @@ type stream
|
|
|
66
59
|
// the target project's Pulumi.yaml — the same dir the pulumi subprocess uses.
|
|
67
60
|
let projectName = (~projectDir: string): string => {
|
|
68
61
|
let path = `${projectDir}/Pulumi.yaml`
|
|
69
|
-
let raw = try readFileSync(path
|
|
62
|
+
let raw = try NodeFs.readFileSync(path) catch {
|
|
70
63
|
| _ => throw(Seed.Failed(`could not read ${path} to scope the wipe to this Pulumi project.`))
|
|
71
64
|
}
|
|
72
65
|
switch raw
|
|
@@ -561,7 +554,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
561
554
|
),
|
|
562
555
|
)
|
|
563
556
|
}
|
|
564
|
-
|
|
557
|
+
NodeProcess.env->Dict.set("AWS_REGION", region)
|
|
565
558
|
|
|
566
559
|
// Discover + count each target, scoped to its own project via the platform
|
|
567
560
|
// tag so a same-named stack from another project is never touched.
|
|
@@ -597,7 +590,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
597
590
|
Seed.Prompt.close()
|
|
598
591
|
Console.log("")
|
|
599
592
|
Console.log(`Nothing to reset — the selected scope already reads empty in ${region}.`)
|
|
600
|
-
exit(0)
|
|
593
|
+
NodeProcess.exit(0)
|
|
601
594
|
}
|
|
602
595
|
|
|
603
596
|
// Confirmation. Interactively, re-typing the exact stack name IS the
|
|
@@ -606,7 +599,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
606
599
|
// TTY (CI/scripts) there is nothing to type into, so
|
|
607
600
|
// REVENTLESS_WIPE_CONFIRM=<stack> is the equivalent opt-in. Dry-run is the
|
|
608
601
|
// default either way.
|
|
609
|
-
let interactive = stdin->isTTY->Option.getOr(false)
|
|
602
|
+
let interactive = NodeProcess.stdin->NodeProcess.isTTY->Option.getOr(false)
|
|
610
603
|
let confirmed = if interactive {
|
|
611
604
|
let typed = await Seed.Prompt.ask(
|
|
612
605
|
`About to permanently empty ${total->Int.toString} item(s)/object(s) across the selected scope of "${stack}". ` ++
|
|
@@ -624,7 +617,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
624
617
|
? "Dry run — nothing was deleted."
|
|
625
618
|
: `Dry run — nothing was deleted. Set REVENTLESS_WIPE_CONFIRM=${stack} to empty this scope non-interactively.`,
|
|
626
619
|
)
|
|
627
|
-
exit(0)
|
|
620
|
+
NodeProcess.exit(0)
|
|
628
621
|
}
|
|
629
622
|
|
|
630
623
|
for i in 0 to resolvedList->Array.length - 1 {
|
|
@@ -681,19 +674,19 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
681
674
|
|
|
682
675
|
Console.log("")
|
|
683
676
|
Console.log(`Reset complete — the selected scope of "${stack}" reads empty and is re-seedable.`)
|
|
684
|
-
exit(0)
|
|
677
|
+
NodeProcess.exit(0)
|
|
685
678
|
} catch {
|
|
686
679
|
| Seed.Failed(message) =>
|
|
687
680
|
Seed.Prompt.close()
|
|
688
681
|
Console.error("")
|
|
689
682
|
Console.error(`Reset aborted — ${message}`)
|
|
690
|
-
exit(1)
|
|
683
|
+
NodeProcess.exit(1)
|
|
691
684
|
| exn =>
|
|
692
685
|
Seed.Prompt.close()
|
|
693
686
|
Console.error("")
|
|
694
687
|
Console.error("Reset aborted with an unexpected error:")
|
|
695
688
|
Console.error(exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown"))
|
|
696
|
-
exit(1)
|
|
689
|
+
NodeProcess.exit(1)
|
|
697
690
|
}
|
|
698
691
|
}
|
|
699
692
|
go()->ignore
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-seed-aws",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
4
|
"description": "AWS connect + guarded reset for the Reventless seed harness — stack discovery, Cognito login, and a tag-scoped, allowlisted store wipe",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@reventlessdev/rescript-aws-sdk": "
|
|
8
|
-
"@reventlessdev/
|
|
7
|
+
"@reventlessdev/rescript-aws-sdk": "3.0.0-alpha.0",
|
|
8
|
+
"@reventlessdev/rescript-node": "2.0.0-alpha.0",
|
|
9
|
+
"@reventlessdev/reventless-seed": "1.0.0-alpha.6"
|
|
9
10
|
},
|
|
10
11
|
"devDependencies": {
|
|
11
12
|
"rescript": "12.3.0",
|
|
12
|
-
"@reventlessdev/rescript-jest": "1.0.0-alpha.
|
|
13
|
+
"@reventlessdev/rescript-jest": "1.0.0-alpha.10"
|
|
13
14
|
},
|
|
14
15
|
"peerDependencies": {
|
|
15
16
|
"rescript": "12.3.0"
|
package/rescript.json
CHANGED
|
@@ -14,11 +14,6 @@ open ReventlessSeed
|
|
|
14
14
|
|
|
15
15
|
// ── Node bindings ─────────────────────────────────────────────────────────────
|
|
16
16
|
|
|
17
|
-
@val @scope("process") external processEnv: dict<string> = "env"
|
|
18
|
-
|
|
19
|
-
type execOptions = {cwd: string, encoding: string, env?: dict<string>}
|
|
20
|
-
@module("node:child_process")
|
|
21
|
-
external execFileSync: (string, array<string>, execOptions) => string = "execFileSync"
|
|
22
17
|
|
|
23
18
|
type fetchInit = {method: string, headers: dict<string>, body?: string}
|
|
24
19
|
type response
|
|
@@ -65,13 +60,17 @@ let envForBackend = (backend: option<string>): option<dict<string>> =>
|
|
|
65
60
|
switch backend {
|
|
66
61
|
| None => None
|
|
67
62
|
| Some(url) =>
|
|
68
|
-
let copy =
|
|
63
|
+
let copy = NodeProcess.env->Dict.toArray->Dict.fromArray
|
|
69
64
|
copy->Dict.set("PULUMI_BACKEND_URL", url)
|
|
70
65
|
Some(copy)
|
|
71
66
|
}
|
|
72
67
|
|
|
73
68
|
let pulumi = (~projectDir: string, ~backend: option<string>, args: array<string>): string =>
|
|
74
|
-
execFileSync(
|
|
69
|
+
NodeChildProcess.execFileSync(
|
|
70
|
+
"pulumi",
|
|
71
|
+
args,
|
|
72
|
+
{cwd: projectDir, encoding: "utf8", env: ?envForBackend(backend)},
|
|
73
|
+
)
|
|
75
74
|
|
|
76
75
|
// Stacks that actually exist in the Pulumi backend for this project — the names
|
|
77
76
|
// `pulumi stack output --stack <name>` accepts. A `Pulumi.<stack>.yaml` config
|
|
@@ -48,14 +48,7 @@ module Ddb = AwsSdk.DynamoDb
|
|
|
48
48
|
module Rgt = AwsSdk.ResourceGroupsTaggingApi
|
|
49
49
|
module S3 = AwsSdk.S3
|
|
50
50
|
|
|
51
|
-
@scope("process") @val external exit: int => unit = "exit"
|
|
52
|
-
@scope("process") @val external processEnv: dict<string> = "env"
|
|
53
|
-
@module("node:fs") external readFileSync: (string, string) => string = "readFileSync"
|
|
54
51
|
|
|
55
|
-
type stream
|
|
56
|
-
@scope("process") @val external stdin: stream = "stdin"
|
|
57
|
-
// `process.stdin.isTTY` is `true` interactively and `undefined` under a pipe/CI.
|
|
58
|
-
@get external isTTY: stream => option<bool> = "isTTY"
|
|
59
52
|
|
|
60
53
|
// The Pulumi project name, which the framework stamps as `reventless:platform` on
|
|
61
54
|
// every resource (`Plugin.res`: `platformName = getProjectName()`). Discovery
|
|
@@ -66,7 +59,7 @@ type stream
|
|
|
66
59
|
// the target project's Pulumi.yaml — the same dir the pulumi subprocess uses.
|
|
67
60
|
let projectName = (~projectDir: string): string => {
|
|
68
61
|
let path = `${projectDir}/Pulumi.yaml`
|
|
69
|
-
let raw = try readFileSync(path
|
|
62
|
+
let raw = try NodeFs.readFileSync(path) catch {
|
|
70
63
|
| _ => throw(Seed.Failed(`could not read ${path} to scope the wipe to this Pulumi project.`))
|
|
71
64
|
}
|
|
72
65
|
switch raw
|
|
@@ -561,7 +554,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
561
554
|
),
|
|
562
555
|
)
|
|
563
556
|
}
|
|
564
|
-
|
|
557
|
+
NodeProcess.env->Dict.set("AWS_REGION", region)
|
|
565
558
|
|
|
566
559
|
// Discover + count each target, scoped to its own project via the platform
|
|
567
560
|
// tag so a same-named stack from another project is never touched.
|
|
@@ -597,7 +590,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
597
590
|
Seed.Prompt.close()
|
|
598
591
|
Console.log("")
|
|
599
592
|
Console.log(`Nothing to reset — the selected scope already reads empty in ${region}.`)
|
|
600
|
-
exit(0)
|
|
593
|
+
NodeProcess.exit(0)
|
|
601
594
|
}
|
|
602
595
|
|
|
603
596
|
// Confirmation. Interactively, re-typing the exact stack name IS the
|
|
@@ -606,7 +599,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
606
599
|
// TTY (CI/scripts) there is nothing to type into, so
|
|
607
600
|
// REVENTLESS_WIPE_CONFIRM=<stack> is the equivalent opt-in. Dry-run is the
|
|
608
601
|
// default either way.
|
|
609
|
-
let interactive = stdin->isTTY->Option.getOr(false)
|
|
602
|
+
let interactive = NodeProcess.stdin->NodeProcess.isTTY->Option.getOr(false)
|
|
610
603
|
let confirmed = if interactive {
|
|
611
604
|
let typed = await Seed.Prompt.ask(
|
|
612
605
|
`About to permanently empty ${total->Int.toString} item(s)/object(s) across the selected scope of "${stack}". ` ++
|
|
@@ -624,7 +617,7 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
624
617
|
? "Dry run — nothing was deleted."
|
|
625
618
|
: `Dry run — nothing was deleted. Set REVENTLESS_WIPE_CONFIRM=${stack} to empty this scope non-interactively.`,
|
|
626
619
|
)
|
|
627
|
-
exit(0)
|
|
620
|
+
NodeProcess.exit(0)
|
|
628
621
|
}
|
|
629
622
|
|
|
630
623
|
for i in 0 to resolvedList->Array.length - 1 {
|
|
@@ -681,19 +674,19 @@ let run = (~stack=?, ~backend=?, ~targets: array<target>, ()): unit => {
|
|
|
681
674
|
|
|
682
675
|
Console.log("")
|
|
683
676
|
Console.log(`Reset complete — the selected scope of "${stack}" reads empty and is re-seedable.`)
|
|
684
|
-
exit(0)
|
|
677
|
+
NodeProcess.exit(0)
|
|
685
678
|
} catch {
|
|
686
679
|
| Seed.Failed(message) =>
|
|
687
680
|
Seed.Prompt.close()
|
|
688
681
|
Console.error("")
|
|
689
682
|
Console.error(`Reset aborted — ${message}`)
|
|
690
|
-
exit(1)
|
|
683
|
+
NodeProcess.exit(1)
|
|
691
684
|
| exn =>
|
|
692
685
|
Seed.Prompt.close()
|
|
693
686
|
Console.error("")
|
|
694
687
|
Console.error("Reset aborted with an unexpected error:")
|
|
695
688
|
Console.error(exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown"))
|
|
696
|
-
exit(1)
|
|
689
|
+
NodeProcess.exit(1)
|
|
697
690
|
}
|
|
698
691
|
}
|
|
699
692
|
go()->ignore
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
open JestGlobals
|
|
13
13
|
open ReventlessSeed
|
|
14
14
|
|
|
15
|
-
@val @scope("process") external processEnv: dict<string> = "env"
|
|
16
15
|
|
|
17
16
|
// Every value read here has an env override, and an ambient one in the runner's
|
|
18
17
|
// environment (AWS_REGION is routinely set) would silently stand in for the
|
|
@@ -24,7 +23,7 @@ let clearOverrides = () =>
|
|
|
24
23
|
"AWS_REGION",
|
|
25
24
|
"COGNITO_CLIENT_ID",
|
|
26
25
|
"SEED_SKIP_UPLOADS",
|
|
27
|
-
]->Array.forEach(k =>
|
|
26
|
+
]->Array.forEach(k => NodeProcess.env->Dict.set(k, ""))
|
|
28
27
|
|
|
29
28
|
let obj = entries => JSON.Encode.object(entries->Dict.fromArray)
|
|
30
29
|
let str = JSON.Encode.string
|
|
@@ -92,7 +91,7 @@ describe("endpointsFrom — host shell arm", () => {
|
|
|
92
91
|
})
|
|
93
92
|
|
|
94
93
|
testSync("REVENTLESS_UPLOAD_ENDPOINT overrides the legacy service and leaves the map alone", () => {
|
|
95
|
-
|
|
94
|
+
NodeProcess.env->Dict.set("REVENTLESS_UPLOAD_ENDPOINT", "https://override.example/")
|
|
96
95
|
let eps = ReventlessSeedAws.endpointsFrom(
|
|
97
96
|
~stack="alpha",
|
|
98
97
|
HostShellConfig(
|