@reventlessdev/reventless-aws 3.0.0-alpha.318 → 3.0.0-alpha.320
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 +35 -0
- package/package.json +11 -7
- package/rescript.json +4 -0
- package/run-provision-identity.mjs +3 -0
- package/scripts/ProvisionIdentity.res +303 -0
- package/scripts/ProvisionIdentity.res.mjs +376 -0
- package/src/Platform.res +54 -30
- package/src/Platform.res.mjs +34 -32
- package/src/Platform_Stack.res +102 -19
- package/src/Platform_Stack.res.mjs +43 -7
- package/src/adapter/Auth/Auth_ActiveRolePoolAttachment.res +267 -32
- package/src/adapter/Auth/Auth_ActiveRolePoolAttachment.res.mjs +124 -14
- package/src/adapter/Auth/Auth_ActiveRoleStore.res +93 -5
- package/src/adapter/Auth/Auth_ActiveRoleStore.res.mjs +53 -4
- package/src/adapter/Auth/Auth_ActiveRoleStore_Ops.res +50 -4
- package/src/adapter/Auth/Auth_ActiveRoleStore_Ops.res.mjs +24 -3
- package/src/adapter/Auth/Auth_ActiveRoleStore_Schema.res +92 -0
- package/src/adapter/Auth/Auth_ActiveRoleStore_Schema.res.mjs +49 -0
- package/src/adapter/Auth/Auth_ActiveRoleTrigger_Ops.res +21 -7
- package/src/adapter/Auth/Auth_ActiveRoleTrigger_Ops.res.mjs +15 -7
- package/src/adapter/Runtime/AutomationSliceEntryPoint_Ops.res +6 -3
- package/src/util/Util_AwsError.res +56 -0
- package/src/util/Util_AwsError.res.mjs +59 -0
- package/src/util/Util_ShellConfig.res +28 -0
- package/src/util/Util_ShellConfig.res.mjs +22 -0
- package/tests/Auth_ActiveRolePoolAttachmentTest.res +175 -0
- package/tests/Auth_ActiveRolePoolAttachmentTest.res.mjs +136 -0
- package/tests/Auth_ActiveRoleStoreTest.res +65 -0
- package/tests/Auth_ActiveRoleStoreTest.res.mjs +48 -0
- package/tests/Auth_ActiveRoleStore_SchemaTest.res +98 -0
- package/tests/Auth_ActiveRoleStore_SchemaTest.res.mjs +97 -0
- package/tests/AwsErrorFixtures.mjs +16 -0
- package/tests/PgQueryResolver_LambdaTest.res +166 -0
- package/tests/PgQueryResolver_LambdaTest.res.mjs +196 -0
- package/tests/ProvisionIdentityTest.res +109 -0
- package/tests/ProvisionIdentityTest.res.mjs +132 -0
- package/tests/Util_AwsErrorTest.res +127 -0
- package/tests/Util_AwsErrorTest.res.mjs +76 -0
- package/tests/Util_ShellConfigTest.res +51 -0
- package/tests/Util_ShellConfigTest.res.mjs +42 -0
|
@@ -224,3 +224,54 @@ describe("Util_ShellConfig.fields — shellConfig passthrough", () => {
|
|
|
224
224
|
}
|
|
225
225
|
})
|
|
226
226
|
})
|
|
227
|
+
|
|
228
|
+
// 🚨 The identity keys travel under both spellings through the rename. A shell
|
|
229
|
+
// reads config.json at runtime and CloudFront serves the previous bundle until
|
|
230
|
+
// someone invalidates it, so switching them in one deploy leaves a window where
|
|
231
|
+
// the served bundle and the served config disagree — and `cognitoClientId` is
|
|
232
|
+
// read into an option, so a bundle that cannot find its key does not error, it
|
|
233
|
+
// gets `None` and login silently stops working.
|
|
234
|
+
//
|
|
235
|
+
// These assert the property that removes that window, not the spelling.
|
|
236
|
+
describe("Util_ShellConfig.identityFields", () => {
|
|
237
|
+
let fields = Util_ShellConfig.identityFields(~providerId="eu-west-1_x", ~clientId="7cl13nt")
|
|
238
|
+
let get = key =>
|
|
239
|
+
fields->Array.find(((k, _)) => k == key)->Option.map(((_, v)) => v)
|
|
240
|
+
|
|
241
|
+
testSync("the new spelling is present", () =>
|
|
242
|
+
expect((get("identityProviderId"), get("identityProviderClientId")))->toEqual((
|
|
243
|
+
Some(JSON.Encode.string("eu-west-1_x")),
|
|
244
|
+
Some(JSON.Encode.string("7cl13nt")),
|
|
245
|
+
))
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
// Not "still" — deliberately. Every shipped shell reads these, and dropping
|
|
249
|
+
// them is a later release gated on the pinned bundle, not on this one.
|
|
250
|
+
testSync("the deprecated spelling is present too", () =>
|
|
251
|
+
expect((get("cognitoUserPoolId"), get("cognitoClientId")))->toEqual((
|
|
252
|
+
Some(JSON.Encode.string("eu-west-1_x")),
|
|
253
|
+
Some(JSON.Encode.string("7cl13nt")),
|
|
254
|
+
))
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
// The whole point: a bundle reading either name gets the same answer. Two keys
|
|
258
|
+
// carrying different values would be worse than one key, not better.
|
|
259
|
+
testSync("both spellings carry identical values", () =>
|
|
260
|
+
expect((
|
|
261
|
+
get("identityProviderId") == get("cognitoUserPoolId"),
|
|
262
|
+
get("identityProviderClientId") == get("cognitoClientId"),
|
|
263
|
+
))->toEqual((true, true))
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
// The client id is the load-bearing one — it is what the shell's auth provider
|
|
267
|
+
// branches on. The pool id is currently discarded by the shell, which is
|
|
268
|
+
// exactly why a `cognito*` sweep is dangerous: the safe one gives no warning.
|
|
269
|
+
testSync("nothing else sneaks into the identity field set", () =>
|
|
270
|
+
expect(fields->Array.map(((k, _)) => k)->Array.toSorted(String.compare))->toEqual([
|
|
271
|
+
"cognitoClientId",
|
|
272
|
+
"cognitoUserPoolId",
|
|
273
|
+
"identityProviderClientId",
|
|
274
|
+
"identityProviderId",
|
|
275
|
+
])
|
|
276
|
+
)
|
|
277
|
+
})
|
|
@@ -4,6 +4,8 @@ import * as JestGlobals from "@reventlessdev/rescript-jest/src/JestGlobals.res.m
|
|
|
4
4
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
5
5
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
6
6
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
|
+
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
8
|
+
import * as Primitive_string from "@rescript/runtime/lib/es6/Primitive_string.js";
|
|
7
9
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
8
10
|
import * as Util_ShellConfig$ReventlessAws from "../src/util/Util_ShellConfig.res.mjs";
|
|
9
11
|
import * as Platform_BakedManifest$ReventlessCore from "@reventlessdev/reventless-core/src/admin/Platform_BakedManifest.res.mjs";
|
|
@@ -252,6 +254,46 @@ globalThis.describe("Util_ShellConfig.fields — shellConfig passthrough", () =>
|
|
|
252
254
|
});
|
|
253
255
|
});
|
|
254
256
|
|
|
257
|
+
globalThis.describe("Util_ShellConfig.identityFields", () => {
|
|
258
|
+
let fields = Util_ShellConfig$ReventlessAws.identityFields("eu-west-1_x", "7cl13nt");
|
|
259
|
+
let get = key => Stdlib_Option.map(fields.find(param => param[0] === key), param => param[1]);
|
|
260
|
+
globalThis.test("the new spelling is present", () => {
|
|
261
|
+
globalThis.expect([
|
|
262
|
+
get("identityProviderId"),
|
|
263
|
+
get("identityProviderClientId")
|
|
264
|
+
]).toEqual([
|
|
265
|
+
"eu-west-1_x",
|
|
266
|
+
"7cl13nt"
|
|
267
|
+
]);
|
|
268
|
+
});
|
|
269
|
+
globalThis.test("the deprecated spelling is present too", () => {
|
|
270
|
+
globalThis.expect([
|
|
271
|
+
get("cognitoUserPoolId"),
|
|
272
|
+
get("cognitoClientId")
|
|
273
|
+
]).toEqual([
|
|
274
|
+
"eu-west-1_x",
|
|
275
|
+
"7cl13nt"
|
|
276
|
+
]);
|
|
277
|
+
});
|
|
278
|
+
globalThis.test("both spellings carry identical values", () => {
|
|
279
|
+
globalThis.expect([
|
|
280
|
+
Primitive_object.equal(get("identityProviderId"), get("cognitoUserPoolId")),
|
|
281
|
+
Primitive_object.equal(get("identityProviderClientId"), get("cognitoClientId"))
|
|
282
|
+
]).toEqual([
|
|
283
|
+
true,
|
|
284
|
+
true
|
|
285
|
+
]);
|
|
286
|
+
});
|
|
287
|
+
globalThis.test("nothing else sneaks into the identity field set", () => {
|
|
288
|
+
globalThis.expect(fields.map(param => param[0]).toSorted(Primitive_string.compare)).toEqual([
|
|
289
|
+
"cognitoClientId",
|
|
290
|
+
"cognitoUserPoolId",
|
|
291
|
+
"identityProviderClientId",
|
|
292
|
+
"identityProviderId"
|
|
293
|
+
]);
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
|
|
255
297
|
export {
|
|
256
298
|
computed,
|
|
257
299
|
get,
|