wirejs-deploy-amplify-basic 0.0.30 → 0.0.32

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.
@@ -129,7 +129,7 @@ export class AuthenticationService extends AuthenticationServiceBase {
129
129
  const state = await this.#cookie.read(cookies);
130
130
  if (state?.state === 'authenticated') {
131
131
  if (this.#keepalive)
132
- this.#cookie.write(cookies, state);
132
+ await this.#cookie.write(cookies, state);
133
133
  return {
134
134
  ...state,
135
135
  actions: machineActions('changepassword', 'signout')
@@ -161,7 +161,7 @@ export class AuthenticationService extends AuthenticationServiceBase {
161
161
  return {
162
162
  state: 'unauthenticated',
163
163
  user: undefined,
164
- actions: machineActions('signin', 'startsignup')
164
+ actions: machineActions('signin', 'startsignup', 'startforgotpassword', 'resendsignupcode')
165
165
  };
166
166
  }
167
167
  }
@@ -186,8 +186,11 @@ export class AuthenticationService extends AuthenticationServiceBase {
186
186
  const state = await this.#cookie.read(cookies);
187
187
  if (!state)
188
188
  return this.getMachineState(cookies);
189
- state.metadata = undefined;
190
- state.substate = undefined;
189
+ await this.#cookie.write(cookies, {
190
+ ...state,
191
+ substate: undefined,
192
+ metadata: undefined
193
+ });
191
194
  return this.getMachineState(cookies);
192
195
  }
193
196
  else if (isAction(form, 'startsignup')) {
@@ -205,7 +208,7 @@ export class AuthenticationService extends AuthenticationServiceBase {
205
208
  ]
206
209
  });
207
210
  const result = await client.send(command);
208
- this.#cookie.write(cookies, {
211
+ await this.#cookie.write(cookies, {
209
212
  state: 'unauthenticated',
210
213
  user: undefined,
211
214
  substate: 'pending-completesignup',
@@ -234,7 +237,7 @@ export class AuthenticationService extends AuthenticationServiceBase {
234
237
  if (state?.state === 'authenticated'
235
238
  || state?.substate !== 'pending-completesignup'
236
239
  || !state?.metadata) {
237
- this.#cookie.write(cookies, {
240
+ await this.#cookie.write(cookies, {
238
241
  ...state,
239
242
  substate: undefined,
240
243
  metadata: undefined,
@@ -282,7 +285,7 @@ export class AuthenticationService extends AuthenticationServiceBase {
282
285
  ConfirmationCode: form.inputs.code
283
286
  });
284
287
  await client.send(command);
285
- this.#cookie.write(cookies, {
288
+ await this.#cookie.write(cookies, {
286
289
  state: 'authenticated',
287
290
  user: {
288
291
  id: sub,
@@ -318,7 +321,7 @@ export class AuthenticationService extends AuthenticationServiceBase {
318
321
  const jwtPayload = jose.decodeJwt(
319
322
  // assuming for now, until we support challenges like OTP, Email code, etc.
320
323
  result.AuthenticationResult?.IdToken);
321
- this.#cookie.write(cookies, {
324
+ await this.#cookie.write(cookies, {
322
325
  state: 'authenticated',
323
326
  user: {
324
327
  id: jwtPayload.sub,
@@ -406,7 +409,7 @@ export class AuthenticationService extends AuthenticationServiceBase {
406
409
  Username: form.inputs.email
407
410
  });
408
411
  await client.send(command);
409
- this.#cookie.write(cookies, {
412
+ await this.#cookie.write(cookies, {
410
413
  state: 'unauthenticated',
411
414
  user: undefined,
412
415
  substate: 'pending-completeforgotpassword',
@@ -440,7 +443,7 @@ export class AuthenticationService extends AuthenticationServiceBase {
440
443
  Username: state?.metadata
441
444
  });
442
445
  await client.send(command);
443
- this.#cookie.write(cookies, {
446
+ await this.#cookie.write(cookies, {
444
447
  state: 'unauthenticated',
445
448
  user: undefined,
446
449
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-deploy-amplify-basic",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",