@sdflc/backend-helpers 1.0.71 → 1.0.72

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/build/BaseCore.js CHANGED
@@ -719,7 +719,7 @@ class BaseCore {
719
719
  return __awaiter(this, void 0, void 0, function* () {
720
720
  const { req, space, authorization } = args;
721
721
  const token = ((_a = req.cookies) === null || _a === void 0 ? void 0 : _a[space.cookieName]) || authorization;
722
- const fingerprint = ((_b = req.cookies) === null || _b === void 0 ? void 0 : _b[space.fingerprintCookieName]) || '';
722
+ const fingerprint = ((_b = req.cookies) === null || _b === void 0 ? void 0 : _b[space.fingerprintCookieName]) || args.fingerprint || '';
723
723
  return {
724
724
  token,
725
725
  fingerprint,
@@ -737,7 +737,13 @@ class BaseCore {
737
737
  if (spaceResult !== true) {
738
738
  return [spaceResult, space];
739
739
  }
740
- const { token, fingerprint } = yield this.extractCredentials({ req, authorization, space, params });
740
+ const { token, fingerprint } = yield this.extractCredentials({
741
+ req,
742
+ authorization,
743
+ fingerprint: context.fingerprint,
744
+ space,
745
+ params,
746
+ });
741
747
  const { jwtSecret, verifyTokenArgs } = yield this.getJwtTokenSecretAndSettings(params);
742
748
  if (token && jwtSecret) {
743
749
  const verifyResult = (0, userToken_1.verifyUserToken)(token, jwtSecret, Object.assign(Object.assign({}, verifyTokenArgs), { algorithms: (verifyTokenArgs === null || verifyTokenArgs === void 0 ? void 0 : verifyTokenArgs.algorithms) || [(0, userToken_1.getDefaultJwtAlgorithm)()], audience: (verifyTokenArgs === null || verifyTokenArgs === void 0 ? void 0 : verifyTokenArgs.audience) || space.id, issuer: (verifyTokenArgs === null || verifyTokenArgs === void 0 ? void 0 : verifyTokenArgs.issuer) || (0, userToken_1.getDefaultJwtIssuer)(), fingerprint }));
@@ -297,7 +297,7 @@ class BaseGateway {
297
297
  }
298
298
  const shouldUseCache = useCache != null ? useCache : !this.config.noCache;
299
299
  const fieldsToUse = !shouldUseCache && Array.isArray(this.config.selectFields) ? this.config.selectFields : this.getIdField();
300
- const query = this.buildListQuery({ filter, params, fieldsToUse });
300
+ const query = this.buildListQuery({ filter, params, fieldsToUse, useCache: shouldUseCache });
301
301
  yield this.onListFilter(query, filter);
302
302
  if (limit && !isNaN(limit) && limit > 0) {
303
303
  query.offset(offset).limit(limit);
@@ -2,4 +2,5 @@ export interface BuildListQueryArgsInterface {
2
2
  filter: any;
3
3
  params: any;
4
4
  fieldsToUse: any;
5
+ useCache: boolean;
5
6
  }
@@ -11,6 +11,7 @@ export interface ExtractCredentialsArgs {
11
11
  * Authorization is a token from the Authorization header
12
12
  */
13
13
  authorization?: string;
14
+ fingerprint?: string;
14
15
  /**
15
16
  * An object with parameters passed to the authenticate methods
16
17
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdflc/backend-helpers",
3
- "version": "1.0.71",
3
+ "version": "1.0.72",
4
4
  "description": "Set of helper functions and classes to simplify building backend apps within @sdflc ecosystem",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",