@reventlessdev/reventless-aws 3.0.0-alpha.319 → 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.
Files changed (37) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +9 -5
  3. package/rescript.json +4 -0
  4. package/run-provision-identity.mjs +3 -0
  5. package/scripts/ProvisionIdentity.res +303 -0
  6. package/scripts/ProvisionIdentity.res.mjs +376 -0
  7. package/src/Platform.res +54 -30
  8. package/src/Platform.res.mjs +34 -32
  9. package/src/Platform_Stack.res +102 -19
  10. package/src/Platform_Stack.res.mjs +43 -7
  11. package/src/adapter/Auth/Auth_ActiveRolePoolAttachment.res +267 -32
  12. package/src/adapter/Auth/Auth_ActiveRolePoolAttachment.res.mjs +124 -14
  13. package/src/adapter/Auth/Auth_ActiveRoleStore.res +93 -5
  14. package/src/adapter/Auth/Auth_ActiveRoleStore.res.mjs +53 -4
  15. package/src/adapter/Auth/Auth_ActiveRoleStore_Ops.res +50 -4
  16. package/src/adapter/Auth/Auth_ActiveRoleStore_Ops.res.mjs +24 -3
  17. package/src/adapter/Auth/Auth_ActiveRoleStore_Schema.res +92 -0
  18. package/src/adapter/Auth/Auth_ActiveRoleStore_Schema.res.mjs +49 -0
  19. package/src/adapter/Auth/Auth_ActiveRoleTrigger_Ops.res +21 -7
  20. package/src/adapter/Auth/Auth_ActiveRoleTrigger_Ops.res.mjs +15 -7
  21. package/src/util/Util_AwsError.res +56 -0
  22. package/src/util/Util_AwsError.res.mjs +59 -0
  23. package/src/util/Util_ShellConfig.res +28 -0
  24. package/src/util/Util_ShellConfig.res.mjs +22 -0
  25. package/tests/Auth_ActiveRolePoolAttachmentTest.res +175 -0
  26. package/tests/Auth_ActiveRolePoolAttachmentTest.res.mjs +136 -0
  27. package/tests/Auth_ActiveRoleStoreTest.res +65 -0
  28. package/tests/Auth_ActiveRoleStoreTest.res.mjs +48 -0
  29. package/tests/Auth_ActiveRoleStore_SchemaTest.res +98 -0
  30. package/tests/Auth_ActiveRoleStore_SchemaTest.res.mjs +97 -0
  31. package/tests/AwsErrorFixtures.mjs +16 -0
  32. package/tests/ProvisionIdentityTest.res +109 -0
  33. package/tests/ProvisionIdentityTest.res.mjs +132 -0
  34. package/tests/Util_AwsErrorTest.res +127 -0
  35. package/tests/Util_AwsErrorTest.res.mjs +76 -0
  36. package/tests/Util_ShellConfigTest.res +51 -0
  37. package/tests/Util_ShellConfigTest.res.mjs +42 -0
@@ -0,0 +1,376 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
4
+ import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
5
+ import * as ClientDynamodb from "@aws-sdk/client-dynamodb";
6
+ import * as DynamoDb_DynamoDb$AwsSdk from "@reventlessdev/rescript-aws-sdk/src/DynamoDb_DynamoDb.res.mjs";
7
+ import * as Util_AwsError$ReventlessAws from "../src/util/Util_AwsError.res.mjs";
8
+ import * as CognitoIdentityServiceProvider$AwsSdk from "@reventlessdev/rescript-aws-sdk/src/CognitoIdentityServiceProvider.res.mjs";
9
+ import * as ClientCognitoIdentityProvider from "@aws-sdk/client-cognito-identity-provider";
10
+ import * as Auth_ActiveRoleStore_Schema$ReventlessAws from "../src/adapter/Auth/Auth_ActiveRoleStore_Schema.res.mjs";
11
+
12
+ let defaultPoolName = "ReventlessIdentity";
13
+
14
+ function parseArgs(argv) {
15
+ let acc = {
16
+ TAG: "Ok",
17
+ _0: {
18
+ poolName: defaultPoolName,
19
+ providerId: undefined,
20
+ help: false
21
+ }
22
+ };
23
+ let i = 0;
24
+ let count = argv.length;
25
+ while (i < count) {
26
+ let flag = argv[i];
27
+ let value = argv[i + 1 | 0];
28
+ let match = acc;
29
+ let exit = 0;
30
+ if (match.TAG === "Ok") {
31
+ let a = match._0;
32
+ let exit$1 = 0;
33
+ switch (flag) {
34
+ case "--name" :
35
+ if (value !== undefined) {
36
+ acc = {
37
+ TAG: "Ok",
38
+ _0: {
39
+ poolName: value,
40
+ providerId: a.providerId,
41
+ help: a.help
42
+ }
43
+ };
44
+ i = i + 2 | 0;
45
+ } else {
46
+ exit = 1;
47
+ }
48
+ break;
49
+ case "--provider-id" :
50
+ if (value !== undefined) {
51
+ acc = {
52
+ TAG: "Ok",
53
+ _0: {
54
+ poolName: a.poolName,
55
+ providerId: value,
56
+ help: a.help
57
+ }
58
+ };
59
+ i = i + 2 | 0;
60
+ } else {
61
+ exit = 1;
62
+ }
63
+ break;
64
+ case "--help" :
65
+ case "-h" :
66
+ exit$1 = 2;
67
+ break;
68
+ default:
69
+ acc = {
70
+ TAG: "Error",
71
+ _0: `unknown argument "` + flag + `"`
72
+ };
73
+ }
74
+ if (exit$1 === 2) {
75
+ acc = {
76
+ TAG: "Ok",
77
+ _0: {
78
+ poolName: a.poolName,
79
+ providerId: a.providerId,
80
+ help: true
81
+ }
82
+ };
83
+ i = i + 1 | 0;
84
+ }
85
+ } else {
86
+ i = count;
87
+ }
88
+ if (exit === 1) {
89
+ acc = {
90
+ TAG: "Error",
91
+ _0: flag + ` needs a value`
92
+ };
93
+ }
94
+ };
95
+ return acc;
96
+ }
97
+
98
+ let usage = `
99
+ Provision a Reventless identity provider and its active-role store.
100
+
101
+ --name <name> Pool name to create or adopt (default: ` + defaultPoolName + `)
102
+ --provider-id <id> Use this existing pool instead of creating one; only the
103
+ store is provisioned
104
+
105
+ Creates nothing that a platform stack owns, and never attaches a trigger.
106
+ Region and credentials come from the environment, as for any AWS SDK call.
107
+ `;
108
+
109
+ function poolSettings(poolName) {
110
+ return {
111
+ PoolName: poolName,
112
+ UsernameAttributes: ["email"],
113
+ MfaConfiguration: "OFF",
114
+ Policies: {
115
+ PasswordPolicy: {
116
+ MinimumLength: 12,
117
+ RequireLowercase: true,
118
+ RequireUppercase: true,
119
+ RequireNumbers: true
120
+ }
121
+ },
122
+ AdminCreateUserConfig: {
123
+ AllowAdminCreateUserOnly: true
124
+ }
125
+ };
126
+ }
127
+
128
+ async function findPoolByName(poolName) {
129
+ let nextToken;
130
+ let more = true;
131
+ let found = [];
132
+ while (more) {
133
+ let page = await CognitoIdentityServiceProvider$AwsSdk.ListUserPoolsCommand.send(new ClientCognitoIdentityProvider.ListUserPoolsCommand({
134
+ MaxResults: 60,
135
+ NextToken: nextToken
136
+ }));
137
+ Stdlib_Option.getOr(page.UserPools, []).forEach(p => {
138
+ let match = p.Name;
139
+ let match$1 = p.Id;
140
+ if (match !== undefined && match$1 !== undefined && match === poolName) {
141
+ found.push(match$1);
142
+ return;
143
+ }
144
+ });
145
+ let t = page.NextToken;
146
+ if (t !== undefined) {
147
+ nextToken = t;
148
+ } else {
149
+ more = false;
150
+ }
151
+ };
152
+ let len = found.length;
153
+ if (len !== 1) {
154
+ if (len !== 0) {
155
+ return {
156
+ TAG: "Error",
157
+ _0: found.length.toString() + ` user pools are named "` + poolName + `" (` + found.join(", ") + `). Pass --provider-id to say which one to use; this script will not guess.`
158
+ };
159
+ } else {
160
+ return {
161
+ TAG: "Ok",
162
+ _0: undefined
163
+ };
164
+ }
165
+ }
166
+ let only = found[0];
167
+ return {
168
+ TAG: "Ok",
169
+ _0: only
170
+ };
171
+ }
172
+
173
+ async function resolvePool(args) {
174
+ let id = args.providerId;
175
+ if (id !== undefined) {
176
+ await CognitoIdentityServiceProvider$AwsSdk.DescribeUserPoolCommand.send(new ClientCognitoIdentityProvider.DescribeUserPoolCommand({
177
+ UserPoolId: id
178
+ }));
179
+ console.log(`pool ` + id + ` (given, unchanged)`);
180
+ return {
181
+ TAG: "Ok",
182
+ _0: id
183
+ };
184
+ }
185
+ let e = await findPoolByName(args.poolName);
186
+ if (e.TAG !== "Ok") {
187
+ return e;
188
+ }
189
+ let existing = e._0;
190
+ if (existing !== undefined) {
191
+ console.log(`pool ` + existing + ` (adopted, named "` + args.poolName + `")`);
192
+ return {
193
+ TAG: "Ok",
194
+ _0: existing
195
+ };
196
+ }
197
+ let created = await CognitoIdentityServiceProvider$AwsSdk.CreateUserPoolCommand.send(new ClientCognitoIdentityProvider.CreateUserPoolCommand(poolSettings(args.poolName)));
198
+ let id$1 = Stdlib_Option.flatMap(created.UserPool, p => p.Id);
199
+ if (id$1 !== undefined) {
200
+ console.log(`pool ` + id$1 + ` (created, named "` + args.poolName + `")`);
201
+ return {
202
+ TAG: "Ok",
203
+ _0: id$1
204
+ };
205
+ } else {
206
+ return {
207
+ TAG: "Error",
208
+ _0: "CreateUserPool returned no pool id"
209
+ };
210
+ }
211
+ }
212
+
213
+ let keySchema = [
214
+ {
215
+ AttributeName: Auth_ActiveRoleStore_Schema$ReventlessAws.partitionKey,
216
+ KeyType: "HASH"
217
+ },
218
+ {
219
+ AttributeName: Auth_ActiveRoleStore_Schema$ReventlessAws.sortKey,
220
+ KeyType: "RANGE"
221
+ }
222
+ ];
223
+
224
+ function asPairs(elements) {
225
+ return elements.map(k => [
226
+ k.AttributeName,
227
+ k.KeyType
228
+ ]);
229
+ }
230
+
231
+ async function describeTable(tableName) {
232
+ try {
233
+ return (await DynamoDb_DynamoDb$AwsSdk.DescribeTableCommand.send(new ClientDynamodb.DescribeTableCommand({
234
+ TableName: tableName
235
+ }))).Table;
236
+ } catch (raw_exn) {
237
+ let exn = Primitive_exceptions.internalToException(raw_exn);
238
+ if (Util_AwsError$ReventlessAws.isNotFound(exn)) {
239
+ return;
240
+ }
241
+ throw exn;
242
+ }
243
+ }
244
+
245
+ async function provisionStore(tableName) {
246
+ let described = await describeTable(tableName);
247
+ if (described !== undefined) {
248
+ let message = Auth_ActiveRoleStore_Schema$ReventlessAws.keySchemaRefusal(tableName, asPairs(Stdlib_Option.getOr(described.KeySchema, [])));
249
+ if (message !== undefined) {
250
+ return {
251
+ TAG: "Error",
252
+ _0: message
253
+ };
254
+ } else {
255
+ console.log(`store ` + tableName + ` (adopted)`);
256
+ return {
257
+ TAG: "Ok",
258
+ _0: undefined
259
+ };
260
+ }
261
+ }
262
+ await DynamoDb_DynamoDb$AwsSdk.CreateTableCommand.send(new ClientDynamodb.CreateTableCommand({
263
+ TableName: tableName,
264
+ KeySchema: keySchema,
265
+ AttributeDefinitions: [
266
+ {
267
+ AttributeName: Auth_ActiveRoleStore_Schema$ReventlessAws.partitionKey,
268
+ AttributeType: "S"
269
+ },
270
+ {
271
+ AttributeName: Auth_ActiveRoleStore_Schema$ReventlessAws.sortKey,
272
+ AttributeType: "S"
273
+ }
274
+ ],
275
+ BillingMode: "PAY_PER_REQUEST"
276
+ }));
277
+ let waited = await DynamoDb_DynamoDb$AwsSdk.TableExistsWaiter.wait(tableName, undefined);
278
+ if (DynamoDb_DynamoDb$AwsSdk.TableExistsWaiter.succeeded(waited)) {
279
+ await DynamoDb_DynamoDb$AwsSdk.UpdateContinuousBackupsCommand.send(new ClientDynamodb.UpdateContinuousBackupsCommand({
280
+ TableName: tableName,
281
+ PointInTimeRecoverySpecification: {
282
+ PointInTimeRecoveryEnabled: true
283
+ }
284
+ }));
285
+ console.log(`store ` + tableName + ` (created)`);
286
+ return {
287
+ TAG: "Ok",
288
+ _0: undefined
289
+ };
290
+ } else {
291
+ return {
292
+ TAG: "Error",
293
+ _0: `table "` + tableName + `" was created but did not become ACTIVE (` + waited.state + `). Re-run this script — it adopts what is already there.`
294
+ };
295
+ }
296
+ }
297
+
298
+ function nextSteps(providerId) {
299
+ return `
300
+ Configure each platform stack that should use this provider:
301
+
302
+ pulumi config set platform:identityProviderId ` + providerId + `
303
+
304
+ or set REVENTLESS_IDENTITY_PROVIDER_ID in CI. Every stack on this provider
305
+ derives the same store, so there is nothing else to configure.
306
+
307
+ The pre-token-generation trigger is attached by the deploy, not by this script.
308
+ Users and groups are yours to create.`;
309
+ }
310
+
311
+ async function run() {
312
+ let e = parseArgs(process.argv.slice(2, process.argv.length));
313
+ if (e.TAG !== "Ok") {
314
+ return e;
315
+ }
316
+ let args = e._0;
317
+ if (args.help) {
318
+ console.log(usage);
319
+ return {
320
+ TAG: "Ok",
321
+ _0: undefined
322
+ };
323
+ }
324
+ let e$1 = await resolvePool(args);
325
+ if (e$1.TAG !== "Ok") {
326
+ return e$1;
327
+ }
328
+ let providerId = e$1._0;
329
+ let tableName = Auth_ActiveRoleStore_Schema$ReventlessAws.derivedStoreName(providerId);
330
+ let e$2 = await provisionStore(tableName);
331
+ if (e$2.TAG !== "Ok") {
332
+ return e$2;
333
+ }
334
+ console.log(nextSteps(providerId));
335
+ return {
336
+ TAG: "Ok",
337
+ _0: undefined
338
+ };
339
+ }
340
+
341
+ async function main() {
342
+ let message;
343
+ try {
344
+ message = await run();
345
+ } catch (raw_exn) {
346
+ let exn = Primitive_exceptions.internalToException(raw_exn);
347
+ console.error(`provision-identity: ` + Util_AwsError$ReventlessAws.describe(exn));
348
+ process.exit(1);
349
+ return;
350
+ }
351
+ if (message.TAG === "Ok") {
352
+ return;
353
+ }
354
+ console.error(`provision-identity: ` + message._0);
355
+ process.exit(1);
356
+ }
357
+
358
+ let Schema;
359
+
360
+ export {
361
+ Schema,
362
+ defaultPoolName,
363
+ parseArgs,
364
+ usage,
365
+ poolSettings,
366
+ findPoolByName,
367
+ resolvePool,
368
+ keySchema,
369
+ asPairs,
370
+ describeTable,
371
+ provisionStore,
372
+ nextSteps,
373
+ run,
374
+ main,
375
+ }
376
+ /* @aws-sdk/client-dynamodb Not a pure module */
package/src/Platform.res CHANGED
@@ -309,36 +309,57 @@ module MakeWithConfig = (
309
309
  //
310
310
  // In ESM mode, Pulumi exports are inside the "default" output.
311
311
  // Try top-level field first (CJS), fall back to "default".<field> (ESM).
312
+ // Read under both spellings: this plugin stack may be deploying against a
313
+ // platform older than the rename, or newer than a pinned plugin. Neither
314
+ // direction is the ordinary case, and neither should fail.
312
315
  let defaultOutput: Pulumi.Output.t<option<JSON.t>> =
313
316
  stackRef->Pulumi.StackReference.getOutput("default")
317
+ let providerIdOutput: Pulumi.Output.t<option<string>> =
318
+ stackRef->Pulumi.StackReference.getOutput("identityProviderId")
319
+ let providerRegionOutput: Pulumi.Output.t<option<string>> =
320
+ stackRef->Pulumi.StackReference.getOutput("identityProviderRegion")
314
321
  let cognitoPoolIdOutput: Pulumi.Output.t<option<string>> =
315
322
  stackRef->Pulumi.StackReference.getOutput("cognitoUserPoolId")
316
323
  let cognitoRegionOutput: Pulumi.Output.t<option<string>> =
317
324
  stackRef->Pulumi.StackReference.getOutput("cognitoRegion")
318
325
  let userPoolConfig =
319
- (cognitoPoolIdOutput, cognitoRegionOutput, defaultOutput)
326
+ (
327
+ (providerIdOutput, providerRegionOutput)->Pulumi.Output.all2,
328
+ (cognitoPoolIdOutput, cognitoRegionOutput)->Pulumi.Output.all2,
329
+ defaultOutput,
330
+ )
320
331
  ->Pulumi.Output.all3
321
- ->Pulumi.Output.apply(((directPoolId, directRegion, default)) => {
322
- let getFromDefault = key =>
323
- default
324
- ->Option.flatMap(d => d->JSON.Decode.object)
325
- ->Option.flatMap(d => d->Dict.get(key))
326
- ->Option.flatMap(v => v->JSON.Decode.string)
327
- let userPoolId =
328
- directPoolId
329
- ->Option.orElse(getFromDefault("cognitoUserPoolId"))
330
- ->Option.getOrThrow(
331
- ~message="Platform stack does not export 'cognitoUserPoolId' — redeploy the platform stack first",
332
+ ->Pulumi.Output.apply(
333
+ (((directProviderId, directProviderRegion), (directPoolId, directRegion), default)) => {
334
+ let getFromDefault = key =>
335
+ default
336
+ ->Option.flatMap(d => d->JSON.Decode.object)
337
+ ->Option.flatMap(d => d->Dict.get(key))
338
+ ->Option.flatMap(v => v->JSON.Decode.string)
339
+ // New spelling first at both levels, then the deprecated one. In ESM
340
+ // mode exports arrive nested under "default", hence each pair.
341
+ let userPoolId =
342
+ directProviderId
343
+ ->Option.orElse(getFromDefault("identityProviderId"))
344
+ ->Option.orElse(directPoolId)
345
+ ->Option.orElse(getFromDefault("cognitoUserPoolId"))
346
+ ->Option.getOrThrow(
347
+ ~message="Platform stack exports neither 'identityProviderId' nor 'cognitoUserPoolId' — redeploy the platform stack first",
348
+ )
349
+ let awsRegion =
350
+ directProviderRegion
351
+ ->Option.orElse(getFromDefault("identityProviderRegion"))
352
+ ->Option.orElse(directRegion)
353
+ ->Option.orElse(getFromDefault("cognitoRegion"))
354
+ (
355
+ {
356
+ userPoolId,
357
+ ?awsRegion,
358
+ defaultAction: PulumiAws.AppSync.GraphQLApi.ALLOW,
359
+ }: PulumiAws.AppSync.GraphQLApi.userPoolConfig
332
360
  )
333
- let awsRegion = directRegion->Option.orElse(getFromDefault("cognitoRegion"))
334
- (
335
- {
336
- userPoolId,
337
- ?awsRegion,
338
- defaultAction: PulumiAws.AppSync.GraphQLApi.ALLOW,
339
- }: PulumiAws.AppSync.GraphQLApi.userPoolConfig
340
- )
341
- })
361
+ },
362
+ )
342
363
  let (api, role) = AppSync_Adapter.makePluginSourceApiResource(
343
364
  ~name="PluginSourceApi",
344
365
  ~userPoolConfig,
@@ -2137,15 +2158,18 @@ module MakeWithConfig = (
2137
2158
  )
2138
2159
  ->Pulumi.Output.all2
2139
2160
  ->Pulumi.Output.apply((((domainEp, platformEp, poolId, clientId), eventsEpOpt)) => {
2140
- let computed = [
2141
- ("apiEndpoint", JSON.Encode.string(domainEp)),
2142
- ("platformApiEndpoint", JSON.Encode.string(platformEp)),
2143
- ("region", JSON.Encode.string(regionStr)),
2144
- ("authMode", JSON.Encode.string("cognito")),
2145
- ("cognitoUserPoolId", JSON.Encode.string(poolId)),
2146
- ("cognitoClientId", JSON.Encode.string(clientId)),
2147
- ("liveUpdates", JSON.Encode.bool(true)),
2148
- ]
2161
+ // `authMode` stays `"cognito"`: it is a value naming which provider
2162
+ // authenticates this deployment, and that is true. The identity *keys*
2163
+ // travel under both spellings — see [Util_ShellConfig.identityFields].
2164
+ let computed =
2165
+ [
2166
+ ("apiEndpoint", JSON.Encode.string(domainEp)),
2167
+ ("platformApiEndpoint", JSON.Encode.string(platformEp)),
2168
+ ("region", JSON.Encode.string(regionStr)),
2169
+ ("authMode", JSON.Encode.string("cognito")),
2170
+ ]
2171
+ ->Array.concat(Util_ShellConfig.identityFields(~providerId=poolId, ~clientId))
2172
+ ->Array.concat([("liveUpdates", JSON.Encode.bool(true))])
2149
2173
  let withEvents = switch eventsEpOpt {
2150
2174
  | Some(ep) =>
2151
2175
  Array.concat(
@@ -207,17 +207,27 @@ function MakeWithConfig(Config) {
207
207
  if (platformStackRef !== undefined) {
208
208
  let stackRef = Primitive_option.valFromOption(platformStackRef);
209
209
  let defaultOutput = stackRef.getOutput("default");
210
+ let providerIdOutput = stackRef.getOutput("identityProviderId");
211
+ let providerRegionOutput = stackRef.getOutput("identityProviderRegion");
210
212
  let cognitoPoolIdOutput = stackRef.getOutput("cognitoUserPoolId");
211
213
  let cognitoRegionOutput = stackRef.getOutput("cognitoRegion");
212
214
  let userPoolConfig = Pulumi.all([
213
- cognitoPoolIdOutput,
214
- cognitoRegionOutput,
215
+ Pulumi.all([
216
+ providerIdOutput,
217
+ providerRegionOutput
218
+ ]),
219
+ Pulumi.all([
220
+ cognitoPoolIdOutput,
221
+ cognitoRegionOutput
222
+ ]),
215
223
  defaultOutput
216
224
  ]).apply(param => {
217
225
  let $$default = param[2];
226
+ let match = param[1];
227
+ let match$1 = param[0];
218
228
  let getFromDefault = key => Stdlib_Option.flatMap(Stdlib_Option.flatMap(Stdlib_Option.flatMap($$default, d => Stdlib_JSON.Decode.object(d)), d => d[key]), v => Stdlib_JSON.Decode.string(v));
219
- let userPoolId = Stdlib_Option.getOrThrow(Stdlib_Option.orElse(param[0], getFromDefault("cognitoUserPoolId")), "Platform stack does not export 'cognitoUserPoolId' — redeploy the platform stack first");
220
- let awsRegion = Stdlib_Option.orElse(param[1], getFromDefault("cognitoRegion"));
229
+ let userPoolId = Stdlib_Option.getOrThrow(Stdlib_Option.orElse(Stdlib_Option.orElse(Stdlib_Option.orElse(match$1[0], getFromDefault("identityProviderId")), match[0]), getFromDefault("cognitoUserPoolId")), "Platform stack exports neither 'identityProviderId' nor 'cognitoUserPoolId' — redeploy the platform stack first");
230
+ let awsRegion = Stdlib_Option.orElse(Stdlib_Option.orElse(Stdlib_Option.orElse(match$1[1], getFromDefault("identityProviderRegion")), match[1]), getFromDefault("cognitoRegion"));
221
231
  return {
222
232
  userPoolId: userPoolId,
223
233
  defaultAction: "ALLOW",
@@ -1162,20 +1172,11 @@ function MakeWithConfig(Config) {
1162
1172
  [
1163
1173
  "authMode",
1164
1174
  "cognito"
1165
- ],
1166
- [
1167
- "cognitoUserPoolId",
1168
- match[2]
1169
- ],
1170
- [
1171
- "cognitoClientId",
1172
- match[3]
1173
- ],
1174
- [
1175
+ ]
1176
+ ].concat(Util_ShellConfig$ReventlessAws.identityFields(match[2], match[3])).concat([[
1175
1177
  "liveUpdates",
1176
1178
  true
1177
- ]
1178
- ];
1179
+ ]]);
1179
1180
  let withEvents = eventsEpOpt !== undefined ? computed.concat([
1180
1181
  [
1181
1182
  "domainApiEventsEndpoint",
@@ -1520,17 +1521,27 @@ function Make($star) {
1520
1521
  if (platformStackRef !== undefined) {
1521
1522
  let stackRef = Primitive_option.valFromOption(platformStackRef);
1522
1523
  let defaultOutput = stackRef.getOutput("default");
1524
+ let providerIdOutput = stackRef.getOutput("identityProviderId");
1525
+ let providerRegionOutput = stackRef.getOutput("identityProviderRegion");
1523
1526
  let cognitoPoolIdOutput = stackRef.getOutput("cognitoUserPoolId");
1524
1527
  let cognitoRegionOutput = stackRef.getOutput("cognitoRegion");
1525
1528
  let userPoolConfig = Pulumi.all([
1526
- cognitoPoolIdOutput,
1527
- cognitoRegionOutput,
1529
+ Pulumi.all([
1530
+ providerIdOutput,
1531
+ providerRegionOutput
1532
+ ]),
1533
+ Pulumi.all([
1534
+ cognitoPoolIdOutput,
1535
+ cognitoRegionOutput
1536
+ ]),
1528
1537
  defaultOutput
1529
1538
  ]).apply(param => {
1530
1539
  let $$default = param[2];
1540
+ let match = param[1];
1541
+ let match$1 = param[0];
1531
1542
  let getFromDefault = key => Stdlib_Option.flatMap(Stdlib_Option.flatMap(Stdlib_Option.flatMap($$default, d => Stdlib_JSON.Decode.object(d)), d => d[key]), v => Stdlib_JSON.Decode.string(v));
1532
- let userPoolId = Stdlib_Option.getOrThrow(Stdlib_Option.orElse(param[0], getFromDefault("cognitoUserPoolId")), "Platform stack does not export 'cognitoUserPoolId' — redeploy the platform stack first");
1533
- let awsRegion = Stdlib_Option.orElse(param[1], getFromDefault("cognitoRegion"));
1543
+ let userPoolId = Stdlib_Option.getOrThrow(Stdlib_Option.orElse(Stdlib_Option.orElse(Stdlib_Option.orElse(match$1[0], getFromDefault("identityProviderId")), match[0]), getFromDefault("cognitoUserPoolId")), "Platform stack exports neither 'identityProviderId' nor 'cognitoUserPoolId' — redeploy the platform stack first");
1544
+ let awsRegion = Stdlib_Option.orElse(Stdlib_Option.orElse(Stdlib_Option.orElse(match$1[1], getFromDefault("identityProviderRegion")), match[1]), getFromDefault("cognitoRegion"));
1534
1545
  return {
1535
1546
  userPoolId: userPoolId,
1536
1547
  defaultAction: "ALLOW",
@@ -2452,20 +2463,11 @@ function Make($star) {
2452
2463
  [
2453
2464
  "authMode",
2454
2465
  "cognito"
2455
- ],
2456
- [
2457
- "cognitoUserPoolId",
2458
- match[2]
2459
- ],
2460
- [
2461
- "cognitoClientId",
2462
- match[3]
2463
- ],
2464
- [
2466
+ ]
2467
+ ].concat(Util_ShellConfig$ReventlessAws.identityFields(match[2], match[3])).concat([[
2465
2468
  "liveUpdates",
2466
2469
  true
2467
- ]
2468
- ];
2470
+ ]]);
2469
2471
  let withEvents = eventsEpOpt !== undefined ? computed.concat([
2470
2472
  [
2471
2473
  "domainApiEventsEndpoint",