@graphql-mesh/transform-cache 1.0.0-alpha-20230523154127-518d8667d → 1.0.0-alpha-20230523154231-8c60b52d9

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/cjs/index.js CHANGED
@@ -11,11 +11,12 @@ class CacheTransform {
11
11
  this.shouldWaitLocal = {};
12
12
  }
13
13
  transformSchema(schema) {
14
+ var _a;
14
15
  const { config, cache } = this.options;
15
16
  const sourceResolvers = (0, utils_1.extractResolvers)(schema);
16
17
  const compositions = {};
17
18
  for (const cacheItem of config) {
18
- const effectingOperations = cacheItem.invalidate?.effectingOperations || [];
19
+ const effectingOperations = ((_a = cacheItem.invalidate) === null || _a === void 0 ? void 0 : _a.effectingOperations) || [];
19
20
  for (const { operation, matchKey } of effectingOperations) {
20
21
  compositions[operation] = originalResolver => async (root, args, context, info) => {
21
22
  const result = await originalResolver(root, args, context, info);
@@ -29,6 +30,7 @@ class CacheTransform {
29
30
  };
30
31
  }
31
32
  compositions[cacheItem.field] = originalResolver => async (root, args, context, info) => {
33
+ var _a, _b;
32
34
  const cacheKey = (0, compute_cache_key_js_1.computeCacheKey)({
33
35
  keyStr: cacheItem.cacheKey,
34
36
  args,
@@ -48,12 +50,12 @@ class CacheTransform {
48
50
  try {
49
51
  const result = await originalResolver(root, args, context, info);
50
52
  await cache.set(cacheKey, result, {
51
- ttl: cacheItem.invalidate?.ttl,
53
+ ttl: (_a = cacheItem.invalidate) === null || _a === void 0 ? void 0 : _a.ttl,
52
54
  });
53
55
  // do not await setting the cache here, otherwise we would delay returnig the result unnecessarily
54
56
  // instead await as part of shouldWait cleanup
55
57
  const setCachePromise = this.options.cache.set(cacheKey, result, {
56
- ttl: cacheItem.invalidate?.ttl,
58
+ ttl: (_b = cacheItem.invalidate) === null || _b === void 0 ? void 0 : _b.ttl,
57
59
  });
58
60
  // do not wait for cleanup to complete
59
61
  this.cleanupShouldWait({
package/esm/index.js CHANGED
@@ -9,11 +9,12 @@ export default class CacheTransform {
9
9
  this.shouldWaitLocal = {};
10
10
  }
11
11
  transformSchema(schema) {
12
+ var _a;
12
13
  const { config, cache } = this.options;
13
14
  const sourceResolvers = extractResolvers(schema);
14
15
  const compositions = {};
15
16
  for (const cacheItem of config) {
16
- const effectingOperations = cacheItem.invalidate?.effectingOperations || [];
17
+ const effectingOperations = ((_a = cacheItem.invalidate) === null || _a === void 0 ? void 0 : _a.effectingOperations) || [];
17
18
  for (const { operation, matchKey } of effectingOperations) {
18
19
  compositions[operation] = originalResolver => async (root, args, context, info) => {
19
20
  const result = await originalResolver(root, args, context, info);
@@ -27,6 +28,7 @@ export default class CacheTransform {
27
28
  };
28
29
  }
29
30
  compositions[cacheItem.field] = originalResolver => async (root, args, context, info) => {
31
+ var _a, _b;
30
32
  const cacheKey = computeCacheKey({
31
33
  keyStr: cacheItem.cacheKey,
32
34
  args,
@@ -46,12 +48,12 @@ export default class CacheTransform {
46
48
  try {
47
49
  const result = await originalResolver(root, args, context, info);
48
50
  await cache.set(cacheKey, result, {
49
- ttl: cacheItem.invalidate?.ttl,
51
+ ttl: (_a = cacheItem.invalidate) === null || _a === void 0 ? void 0 : _a.ttl,
50
52
  });
51
53
  // do not await setting the cache here, otherwise we would delay returnig the result unnecessarily
52
54
  // instead await as part of shouldWait cleanup
53
55
  const setCachePromise = this.options.cache.set(cacheKey, result, {
54
- ttl: cacheItem.invalidate?.ttl,
56
+ ttl: (_b = cacheItem.invalidate) === null || _b === void 0 ? void 0 : _b.ttl,
55
57
  });
56
58
  // do not wait for cleanup to complete
57
59
  this.cleanupShouldWait({
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@graphql-mesh/transform-cache",
3
- "version": "1.0.0-alpha-20230523154127-518d8667d",
3
+ "version": "1.0.0-alpha-20230523154231-8c60b52d9",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@graphql-mesh/cross-helpers": "0.4.0-alpha-20230523154127-518d8667d",
7
- "@graphql-mesh/types": "1.0.0-alpha-20230523154127-518d8667d",
8
- "@graphql-mesh/utils": "1.0.0-alpha-20230523154127-518d8667d",
9
- "@graphql-tools/utils": "^9.2.1",
6
+ "@graphql-mesh/cross-helpers": "0.4.0-alpha-20230523154231-8c60b52d9",
7
+ "@graphql-mesh/types": "1.0.0-alpha-20230523154231-8c60b52d9",
8
+ "@graphql-mesh/utils": "1.0.0-alpha-20230523154231-8c60b52d9",
9
+ "@graphql-tools/utils": "^9.2.1 || ^10.0.0",
10
10
  "graphql": "*",
11
11
  "tslib": "^2.4.0"
12
12
  },
13
13
  "dependencies": {
14
- "@graphql-mesh/string-interpolation": "0.5.0-alpha-20230523154127-518d8667d",
15
- "@graphql-tools/resolvers-composition": "^6.5.18",
16
- "@graphql-tools/schema": "^9.0.18",
14
+ "@graphql-mesh/string-interpolation": "0.5.0-alpha-20230523154231-8c60b52d9",
15
+ "@graphql-tools/resolvers-composition": "^7.0.0",
16
+ "@graphql-tools/schema": "^10.0.0",
17
17
  "dayjs": "^1.11.7"
18
18
  },
19
19
  "repository": {
@@ -22,9 +22,6 @@
22
22
  "directory": "packages/transforms/cache"
23
23
  },
24
24
  "license": "MIT",
25
- "engines": {
26
- "node": ">=16.0.0"
27
- },
28
25
  "main": "cjs/index.js",
29
26
  "module": "esm/index.js",
30
27
  "typings": "typings/index.d.ts",