@bedrock/vc-delivery 7.7.0 → 7.7.2

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/lib/helpers.js CHANGED
@@ -64,7 +64,7 @@ export function emitExchangeUpdated({workflow, exchange, step}) {
64
64
 
65
65
  const {url} = step.callback;
66
66
  const exchangeId = `${workflow.id}/exchanges/${exchange.id}`;
67
- httpClient.post(url, {
67
+ return httpClient.post(url, {
68
68
  agent: httpsAgent,
69
69
  json: {
70
70
  event: {
@@ -55,7 +55,7 @@ export async function processInviteResponse({req}) {
55
55
  exchange.state = 'complete';
56
56
  exchange.sequence++;
57
57
  await exchanges.complete({workflowId: workflow.id, exchange});
58
- emitExchangeUpdated({workflow, exchange, step});
58
+ await emitExchangeUpdated({workflow, exchange, step});
59
59
  lastUpdated = Date.now();
60
60
  } catch(e) {
61
61
  // revert exchange changes as it couldn't be written
@@ -79,10 +79,10 @@ export async function processInviteResponse({req}) {
79
79
  const copy = {...exchange};
80
80
  copy.sequence++;
81
81
  copy.lastError = e;
82
- exchanges.setLastError({workflowId, exchange: copy, lastUpdated})
82
+ await exchanges.setLastError({workflowId, exchange: copy, lastUpdated})
83
83
  .catch(error => logger.error(
84
84
  'Could not set last exchange error: ' + error.message, {error}));
85
- emitExchangeUpdated({workflow, exchange, step});
85
+ await emitExchangeUpdated({workflow, exchange, step});
86
86
  throw e;
87
87
  }
88
88
  }
@@ -523,7 +523,7 @@ async function _processExchange({
523
523
  try {
524
524
  exchange.sequence++;
525
525
  await exchanges.complete({workflowId, exchange});
526
- emitExchangeUpdated({workflow, exchange, step});
526
+ await emitExchangeUpdated({workflow, exchange, step});
527
527
  lastUpdated = Date.now();
528
528
  } catch(e) {
529
529
  exchange.sequence--;
@@ -546,7 +546,7 @@ async function _processExchange({
546
546
  exchanges.setLastError({workflowId, exchange: copy, lastUpdated})
547
547
  .catch(error => logger.error(
548
548
  'Could not set last exchange error: ' + error.message, {error}));
549
- emitExchangeUpdated({workflow, exchange, step});
549
+ await emitExchangeUpdated({workflow, exchange, step});
550
550
  throw e;
551
551
  }
552
552
  }
@@ -71,7 +71,7 @@ export async function getAuthorizationRequest({req, clientProfileId}) {
71
71
  try {
72
72
  exchange.sequence++;
73
73
  await exchanges.update({workflowId: workflow.id, exchange});
74
- emitExchangeUpdated({workflow, exchange, step});
74
+ await emitExchangeUpdated({workflow, exchange, step});
75
75
  } catch(e) {
76
76
  exchange.state = prevState;
77
77
  exchange.sequence--;
@@ -293,7 +293,7 @@ export async function processAuthorizationResponse({req, clientProfileId}) {
293
293
  exchange.state = 'complete';
294
294
  await exchanges.complete({workflowId: workflow.id, exchange});
295
295
  }
296
- emitExchangeUpdated({workflow, exchange, step});
296
+ await emitExchangeUpdated({workflow, exchange, step});
297
297
  lastUpdated = Date.now();
298
298
  } catch(e) {
299
299
  // revert exchange changes as it couldn't be written
@@ -321,10 +321,10 @@ export async function processAuthorizationResponse({req, clientProfileId}) {
321
321
  const copy = {...exchange};
322
322
  copy.sequence++;
323
323
  copy.lastError = e;
324
- exchanges.setLastError({workflowId, exchange: copy, lastUpdated})
324
+ await exchanges.setLastError({workflowId, exchange: copy, lastUpdated})
325
325
  .catch(error => logger.error(
326
326
  'Could not set last exchange error: ' + error.message, {error}));
327
- emitExchangeUpdated({workflow, exchange, step});
327
+ await emitExchangeUpdated({workflow, exchange, step});
328
328
  throw e;
329
329
  }
330
330
  }
package/lib/vcapi.js CHANGED
@@ -278,7 +278,7 @@ export async function processExchange({req, res, workflow, exchangeRecord}) {
278
278
  try {
279
279
  exchange.sequence++;
280
280
  await exchanges.update({workflowId: workflow.id, exchange});
281
- emitExchangeUpdated({workflow, exchange, step});
281
+ await emitExchangeUpdated({workflow, exchange, step});
282
282
  lastUpdated = Date.now();
283
283
  } catch(e) {
284
284
  exchange.sequence--;
@@ -303,7 +303,7 @@ export async function processExchange({req, res, workflow, exchangeRecord}) {
303
303
  try {
304
304
  exchange.sequence++;
305
305
  await exchanges.complete({workflowId: workflow.id, exchange});
306
- emitExchangeUpdated({workflow, exchange, step});
306
+ await emitExchangeUpdated({workflow, exchange, step});
307
307
  } catch(e) {
308
308
  exchange.sequence--;
309
309
  throw e;
@@ -333,10 +333,10 @@ export async function processExchange({req, res, workflow, exchangeRecord}) {
333
333
  const copy = {...exchange};
334
334
  copy.sequence++;
335
335
  copy.lastError = e;
336
- exchanges.setLastError({workflowId, exchange: copy, lastUpdated})
336
+ await exchanges.setLastError({workflowId, exchange: copy, lastUpdated})
337
337
  .catch(error => logger.error(
338
338
  'Could not set last exchange error: ' + error.message, {error}));
339
- emitExchangeUpdated({workflow, exchange, step});
339
+ await emitExchangeUpdated({workflow, exchange, step});
340
340
  throw e;
341
341
  }
342
342
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/vc-delivery",
3
- "version": "7.7.0",
3
+ "version": "7.7.2",
4
4
  "type": "module",
5
5
  "description": "Bedrock Verifiable Credential Delivery",
6
6
  "main": "./lib/index.js",
@@ -52,7 +52,7 @@
52
52
  "serialize-error": "^12.0.0"
53
53
  },
54
54
  "peerDependencies": {
55
- "@bedrock/app-identity": "4.0.0",
55
+ "@bedrock/app-identity": "^4.0.0",
56
56
  "@bedrock/core": "^6.3.0",
57
57
  "@bedrock/did-io": "^10.4.0",
58
58
  "@bedrock/express": "^8.3.1",