@reventlessdev/reventless-aws 3.0.0-alpha.300 → 3.0.0-alpha.302

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.
@@ -1,9 +1,12 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
3
  import * as JestGlobals from "@reventlessdev/rescript-jest/src/JestGlobals.res.mjs";
4
+ import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
5
+ import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
4
6
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
5
7
  import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
6
8
  import * as Util_ShellConfig$ReventlessAws from "../src/util/Util_ShellConfig.res.mjs";
9
+ import * as Platform_BakedManifest$ReventlessCore from "@reventlessdev/reventless-core/src/admin/Platform_BakedManifest.res.mjs";
7
10
 
8
11
  let computed = [
9
12
  [
@@ -107,6 +110,103 @@ globalThis.describe("Util_ShellConfig.fields — bakedManifest", () => {
107
110
  });
108
111
  });
109
112
 
113
+ globalThis.describe("Util_ShellConfig.fields — journeys", () => {
114
+ let withJourneys = journeys => ({
115
+ components: [{
116
+ plugin: "Catalog",
117
+ views: ["Products"],
118
+ commands: []
119
+ }],
120
+ journeys: journeys
121
+ });
122
+ let shopper_components = [{
123
+ plugin: "Catalog",
124
+ views: ["Products"],
125
+ commands: []
126
+ }];
127
+ let shopper = {
128
+ group: "Shopper",
129
+ components: shopper_components
130
+ };
131
+ let fulfilment_components = [{
132
+ plugin: "Ordering",
133
+ views: ["Orders"],
134
+ commands: ["ShipOrder"]
135
+ }];
136
+ let fulfilment_key = "fulfilment.json";
137
+ let fulfilment = {
138
+ group: "Fulfilment",
139
+ components: fulfilment_components,
140
+ key: fulfilment_key
141
+ };
142
+ globalThis.test("a bake declaring no journeys writes no map", () => {
143
+ let out = Util_ShellConfig$ReventlessAws.fields(computed, undefined, {
144
+ components: [{
145
+ plugin: "Catalog",
146
+ views: ["Products"],
147
+ commands: []
148
+ }]
149
+ }, undefined);
150
+ globalThis.expect(Stdlib_Option.isNone(out["journeyManifestUrls"])).toBe(true);
151
+ });
152
+ globalThis.test("an empty journeys array is the same as none", () => {
153
+ let out = Util_ShellConfig$ReventlessAws.fields(computed, undefined, withJourneys([]), undefined);
154
+ globalThis.expect(Stdlib_Option.isNone(out["journeyManifestUrls"])).toBe(true);
155
+ });
156
+ globalThis.test("keeps manifestUrl as the default journey", () => {
157
+ let out = Util_ShellConfig$ReventlessAws.fields(computed, undefined, withJourneys([shopper]), undefined);
158
+ globalThis.expect(get(out, "manifestUrl")).toEqual("/component-manifest.json");
159
+ });
160
+ globalThis.test("maps each declared group to its own file", () => {
161
+ let out = Util_ShellConfig$ReventlessAws.fields(computed, undefined, withJourneys([
162
+ shopper,
163
+ fulfilment
164
+ ]), undefined);
165
+ globalThis.expect(get(out, "journeyManifestUrls")).toEqual(Object.fromEntries([
166
+ [
167
+ "Shopper",
168
+ "/component-manifest-shopper.json"
169
+ ],
170
+ [
171
+ "Fulfilment",
172
+ "/fulfilment.json"
173
+ ]
174
+ ]));
175
+ });
176
+ globalThis.test("publishes the URL of every key the bake writes, exactly once", () => {
177
+ let bake = withJourneys([
178
+ shopper,
179
+ fulfilment
180
+ ]);
181
+ let out = Util_ShellConfig$ReventlessAws.fields(computed, undefined, bake, undefined);
182
+ let published = Stdlib_Option.mapOr(Stdlib_JSON.Decode.string(get(out, "manifestUrl")), [], url => [url]).concat(Stdlib_Array.filterMap(Object.values(Stdlib_Option.getOr(Stdlib_JSON.Decode.object(get(out, "journeyManifestUrls")), {})), Stdlib_JSON.Decode.string));
183
+ globalThis.expect(published).toEqual(Platform_BakedManifest$ReventlessCore.files(bake).map(param => "/" + param[0]));
184
+ });
185
+ globalThis.test("a shellConfig journey map fails the deploy rather than redirecting it", () => {
186
+ let failure;
187
+ try {
188
+ Util_ShellConfig$ReventlessAws.fields(computed, undefined, withJourneys([shopper]), Object.fromEntries([[
189
+ "journeyManifestUrls",
190
+ {}
191
+ ]]));
192
+ failure = undefined;
193
+ } catch (raw_message) {
194
+ let message = Primitive_exceptions.internalToException(raw_message);
195
+ if (message.RE_EXN_ID === "Failure") {
196
+ failure = message._1;
197
+ } else {
198
+ throw message;
199
+ }
200
+ }
201
+ if (failure !== undefined) {
202
+ globalThis.expect(failure.includes("journeyManifestUrls")).toBe(true);
203
+ return;
204
+ } else {
205
+ return JestGlobals.fail("a shellConfig key redirecting the computed journey map must fail the deploy");
206
+ }
207
+ });
208
+ });
209
+
110
210
  globalThis.describe("Util_ShellConfig.fields — shellConfig passthrough", () => {
111
211
  globalThis.test("shell-owned keys land verbatim, under the computed ones", () => {
112
212
  let out = Util_ShellConfig$ReventlessAws.fields(computed, undefined, undefined, Object.fromEntries([