@sphereon/ssi-sdk.resource-resolver 0.30.2-unstable.20 → 0.30.2-unstable.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceResolver.d.ts","sourceRoot":"","sources":["../../src/agent/ResourceResolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAQ3C,OAAO,EAIL,iBAAiB,EAKjB,uBAAuB,EAIxB,MAAM,4BAA4B,CAAA;AAEnC;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD,QAAQ,CAAC,MAAM,MAA2B;IAC1C,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAMlC;IAED,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAQ;IACvC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuC;gBAE3D,OAAO,CAAC,EAAE,uBAAuB;IA4B7C,sDAAsD;YACxC,eAAe;IAoD7B,gEAAgE;YAClD,yBAAyB;IAOvC,6DAA6D;YAC/C,sBAAsB;IAIpC,+DAA+D;YACjD,wBAAwB;IAItC,yDAAyD;YAC3C,kBAAkB;YAIlB,WAAW;YAUX,eAAe;IAe7B,OAAO,CAAC,KAAK;IASb,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,MAAM;CAKf"}
1
+ {"version":3,"file":"ResourceResolver.d.ts","sourceRoot":"","sources":["../../src/agent/ResourceResolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAS3C,OAAO,EAIL,iBAAiB,EAKjB,uBAAuB,EAIxB,MAAM,4BAA4B,CAAA;AAEnC;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD,QAAQ,CAAC,MAAM,MAA2B;IAC1C,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAMlC;IAED,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAQ;IACvC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuC;gBAE3D,OAAO,CAAC,EAAE,uBAAuB;IA4B7C,sDAAsD;YACxC,eAAe;IAoD7B,gEAAgE;YAClD,yBAAyB;IAOvC,6DAA6D;YAC/C,sBAAsB;IAIpC,+DAA+D;YACjD,wBAAwB;IAItC,yDAAyD;YAC3C,kBAAkB;YAIlB,WAAW;YAUX,eAAe;IAe7B,OAAO,CAAC,KAAK;IASb,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,MAAM;CAKf"}
@@ -74,7 +74,7 @@ class ResourceResolver {
74
74
  const { input, init, resourceType, resolveOpts, partyCorrelationId, storeId, namespace } = args;
75
75
  const resourceIdentifier = (0, ResourceResolverUtils_1.getResourceIdentifier)(input);
76
76
  const cachedResource = yield this.getResource({ resourceIdentifier, storeId, namespace });
77
- if (cachedResource.value && ((resolveOpts === null || resolveOpts === void 0 ? void 0 : resolveOpts.maxAgeMs) === undefined || (Date.now() - cachedResource.value.insertedAt < resolveOpts.maxAgeMs))) {
77
+ if (cachedResource.value && (0, ResourceResolverUtils_1.isCacheWithinMaxAge)(cachedResource.value, resolveOpts)) {
78
78
  return (0, ResourceResolverUtils_1.deserializeResponse)(cachedResource.value.response);
79
79
  }
80
80
  if (resolveOpts === null || resolveOpts === void 0 ? void 0 : resolveOpts.onlyCache) {
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceResolver.js","sourceRoot":"","sources":["../../src/agent/ResourceResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2EAKwC;AAExC,2DAAsD;AACtD,oCAAiC;AACjC,0EAIuC;AAgBvC;;GAEG;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EAAE,CAAC,IAAI,kBAAkB,EAAE,CAAA;IACpE,CAAC;CAEF;AAxKD,4CAwKC"}
@@ -1,6 +1,7 @@
1
1
  import { Response, Request } from 'cross-fetch';
2
- import { SerializedResponse } from '../types/IResourceResolver';
2
+ import { ResolveOptions, Resource, SerializedResponse } from '../types/IResourceResolver';
3
3
  export declare const getResourceIdentifier: (input: Request | string | URL) => string;
4
4
  export declare const serializeResponse: (response: Response) => Promise<SerializedResponse>;
5
5
  export declare const deserializeResponse: (data: SerializedResponse) => Promise<Response>;
6
+ export declare const isCacheWithinMaxAge: (cachedResource: Resource, resolveOpts?: ResolveOptions) => boolean;
6
7
  //# sourceMappingURL=ResourceResolverUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceResolverUtils.d.ts","sourceRoot":"","sources":["../../src/utils/ResourceResolverUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D,eAAO,MAAM,qBAAqB,UAAW,OAAO,GAAG,MAAM,GAAG,GAAG,KAAG,MAUrE,CAAA;AAED,eAAO,MAAM,iBAAiB,aAAoB,QAAQ,KAAG,QAAQ,kBAAkB,CAUtF,CAAA;AAED,eAAO,MAAM,mBAAmB,SAAgB,kBAAkB,KAAG,QAAQ,QAAQ,CAgBpF,CAAA"}
1
+ {"version":3,"file":"ResourceResolverUtils.d.ts","sourceRoot":"","sources":["../../src/utils/ResourceResolverUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEzF,eAAO,MAAM,qBAAqB,UAAW,OAAO,GAAG,MAAM,GAAG,GAAG,KAAG,MAUrE,CAAA;AAED,eAAO,MAAM,iBAAiB,aAAoB,QAAQ,KAAG,QAAQ,kBAAkB,CAUtF,CAAA;AAED,eAAO,MAAM,mBAAmB,SAAgB,kBAAkB,KAAG,QAAQ,QAAQ,CAgBpF,CAAA;AAGD,eAAO,MAAM,mBAAmB,mBAAoB,QAAQ,gBAAgB,cAAc,KAAG,OAE5F,CAAA"}
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.deserializeResponse = exports.serializeResponse = exports.getResourceIdentifier = void 0;
35
+ exports.isCacheWithinMaxAge = exports.deserializeResponse = exports.serializeResponse = exports.getResourceIdentifier = void 0;
36
36
  const cross_fetch_1 = require("cross-fetch");
37
37
  const u8a = __importStar(require("uint8arrays"));
38
38
  const getResourceIdentifier = (input) => {
@@ -70,4 +70,9 @@ const deserializeResponse = (data) => __awaiter(void 0, void 0, void 0, function
70
70
  });
71
71
  });
72
72
  exports.deserializeResponse = deserializeResponse;
73
+ // Check if the cache is still within the acceptable age
74
+ const isCacheWithinMaxAge = (cachedResource, resolveOpts) => {
75
+ return cachedResource && ((resolveOpts === null || resolveOpts === void 0 ? void 0 : resolveOpts.maxAgeMs) === undefined || (Date.now() - cachedResource.insertedAt < resolveOpts.maxAgeMs));
76
+ };
77
+ exports.isCacheWithinMaxAge = isCacheWithinMaxAge;
73
78
  //# sourceMappingURL=ResourceResolverUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceResolverUtils.js","sourceRoot":"","sources":["../../src/utils/ResourceResolverUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwD;AACxD,iDAAkC;AAG3B,MAAM,qBAAqB,GAAG,CAAC,KAA6B,EAAU,EAAE;IAC7E,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,IAAI,KAAK,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ACL,GAAG,IAAI,CAAA;IAER,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;IACpD,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAElH,OAAO,IAAI,sBAAQ,CAAC,WAAW,EAAE;QAC/B,MAAM;QACN,UAAU;QACV,OAAO,EAAE,IAAI,qBAAO,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAA;AACJ,CAAC,CAAA,CAAA;AAhBY,QAAA,mBAAmB,uBAgB/B;AAED,wDAAwD;AACjD,MAAM,mBAAmB,GAAG,CAAC,cAAwB,EAAE,WAA4B,EAAW,EAAE;IACrG,OAAO,cAAc,IAAI,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,MAAK,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,cAAc,CAAC,UAAU,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAA;AACnI,CAAC,CAAA;AAFY,QAAA,mBAAmB,uBAE/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.resource-resolver",
3
- "version": "0.30.2-unstable.20+61a818af",
3
+ "version": "0.30.2-unstable.23+3d2a8a87",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,14 +14,14 @@
14
14
  "build:clean": "tsc --build --clean && tsc --build"
15
15
  },
16
16
  "dependencies": {
17
- "@sphereon/ssi-sdk.kv-store-temp": "0.30.2-unstable.20+61a818af",
17
+ "@sphereon/ssi-sdk.kv-store-temp": "0.30.2-unstable.23+3d2a8a87",
18
18
  "cross-fetch": "^3.1.8",
19
19
  "debug": "^4.3.5",
20
20
  "typeorm": "^0.3.20",
21
21
  "uint8arrays": "^3.1.1"
22
22
  },
23
23
  "devDependencies": {
24
- "@sphereon/ssi-sdk.agent-config": "0.30.2-unstable.20+61a818af",
24
+ "@sphereon/ssi-sdk.agent-config": "0.30.2-unstable.23+3d2a8a87",
25
25
  "@veramo/remote-client": "4.2.0",
26
26
  "@veramo/remote-server": "4.2.0",
27
27
  "nock": "^13.5.4",
@@ -48,5 +48,5 @@
48
48
  "Resource Management",
49
49
  "Caching"
50
50
  ],
51
- "gitHead": "61a818aff2848c41bdb7a9a8c9160b5d66c74e75"
51
+ "gitHead": "3d2a8a87d0a1786b2a4558627ef46b889341c410"
52
52
  }
@@ -10,6 +10,7 @@ import { schema } from '../index'
10
10
  import {
11
11
  deserializeResponse,
12
12
  getResourceIdentifier,
13
+ isCacheWithinMaxAge,
13
14
  serializeResponse
14
15
  } from '../utils/ResourceResolverUtils'
15
16
  import {
@@ -88,7 +89,7 @@ export class ResourceResolver implements IAgentPlugin {
88
89
  const resourceIdentifier = getResourceIdentifier(input)
89
90
 
90
91
  const cachedResource = await this.getResource({ resourceIdentifier, storeId, namespace })
91
- if (cachedResource.value && (resolveOpts?.maxAgeMs === undefined || (Date.now() - cachedResource.value.insertedAt < resolveOpts.maxAgeMs))) {
92
+ if (cachedResource.value && isCacheWithinMaxAge(cachedResource.value, resolveOpts)) {
92
93
  return deserializeResponse(cachedResource.value.response);
93
94
  }
94
95
 
@@ -1,6 +1,6 @@
1
1
  import { Headers, Response, Request } from 'cross-fetch'
2
2
  import * as u8a from 'uint8arrays'
3
- import { SerializedResponse } from '../types/IResourceResolver'
3
+ import { ResolveOptions, Resource, SerializedResponse } from '../types/IResourceResolver'
4
4
 
5
5
  export const getResourceIdentifier = (input: Request | string | URL): string => {
6
6
  if (typeof input === 'string') {
@@ -43,3 +43,8 @@ export const deserializeResponse = async (data: SerializedResponse): Promise<Res
43
43
  headers: new Headers(headers)
44
44
  })
45
45
  }
46
+
47
+ // Check if the cache is still within the acceptable age
48
+ export const isCacheWithinMaxAge = (cachedResource: Resource, resolveOpts?: ResolveOptions): boolean => {
49
+ return cachedResource && (resolveOpts?.maxAgeMs === undefined || (Date.now() - cachedResource.insertedAt < resolveOpts.maxAgeMs))
50
+ }