@smartive/datocms-utils 3.0.0-next.5 → 3.0.0-next.6

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.
@@ -0,0 +1,9 @@
1
+ import { type CacheTagsStore } from '../types.js';
2
+ /**
3
+ * Creates a `CacheTagsStore` implementation that does not perform any actual storage operations.
4
+ *
5
+ * _Note: This implementation is useful for testing purposes or when you want to disable caching without changing the code that interacts with the cache._
6
+ *
7
+ * @returns An object implementing the `CacheTagsStore` interface.
8
+ */
9
+ export declare const createCacheTagsStore: () => CacheTagsStore;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Creates a `CacheTagsStore` implementation that does not perform any actual storage operations.
3
+ *
4
+ * _Note: This implementation is useful for testing purposes or when you want to disable caching without changing the code that interacts with the cache._
5
+ *
6
+ * @returns An object implementing the `CacheTagsStore` interface.
7
+ */
8
+ export const createCacheTagsStore = () => {
9
+ const storeQueryCacheTags = async (queryId, cacheTags) => {
10
+ console.debug('-- storeQueryCacheTags called', { queryId, cacheTags });
11
+ return Promise.resolve();
12
+ };
13
+ const queriesReferencingCacheTags = async (cacheTags) => {
14
+ console.debug('-- queriesReferencingCacheTags called', { cacheTags });
15
+ return Promise.resolve([]);
16
+ };
17
+ const deleteCacheTags = async (cacheTags) => {
18
+ console.debug('-- deleteCacheTags called', { cacheTags });
19
+ return Promise.resolve(0);
20
+ };
21
+ const truncateCacheTags = async () => {
22
+ console.debug('-- truncateCacheTags called');
23
+ return Promise.resolve(0);
24
+ };
25
+ return {
26
+ storeQueryCacheTags,
27
+ queriesReferencingCacheTags,
28
+ deleteCacheTags,
29
+ truncateCacheTags,
30
+ };
31
+ };
32
+ //# sourceMappingURL=noop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.js","sourceRoot":"","sources":["../../../src/cache/provider/noop.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAmB,EAAE;IACvD,MAAM,mBAAmB,GAAG,KAAK,EAAE,OAAe,EAAE,SAAqB,EAAE,EAAE;QAC3E,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;QAEvE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC,CAAC;IAEF,MAAM,2BAA2B,GAAG,KAAK,EAAE,SAAqB,EAAE,EAAE;QAClE,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAEtE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,KAAK,EAAE,SAAqB,EAAE,EAAE;QACtD,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAE1D,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;QACnC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAE7C,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO;QACL,mBAAmB;QACnB,2BAA2B;QAC3B,eAAe;QACf,iBAAiB;KAClB,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartive/datocms-utils",
3
- "version": "3.0.0-next.5",
3
+ "version": "3.0.0-next.6",
4
4
  "description": "A set of utilities and helpers to work with DatoCMS in a Next.js project.",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -20,6 +20,10 @@
20
20
  "./cache/neon": {
21
21
  "types": "./dist/cache/provider/neon.d.ts",
22
22
  "import": "./dist/cache/provider/neon.js"
23
+ },
24
+ "./cache/noop": {
25
+ "types": "./dist/cache/provider/noop.d.ts",
26
+ "import": "./dist/cache/provider/noop.js"
23
27
  }
24
28
  },
25
29
  "files": [
@@ -0,0 +1,41 @@
1
+ import { type CacheTag, type CacheTagsStore } from '../types.js';
2
+
3
+ /**
4
+ * Creates a `CacheTagsStore` implementation that does not perform any actual storage operations.
5
+ *
6
+ * _Note: This implementation is useful for testing purposes or when you want to disable caching without changing the code that interacts with the cache._
7
+ *
8
+ * @returns An object implementing the `CacheTagsStore` interface.
9
+ */
10
+ export const createCacheTagsStore = (): CacheTagsStore => {
11
+ const storeQueryCacheTags = async (queryId: string, cacheTags: CacheTag[]) => {
12
+ console.debug('-- storeQueryCacheTags called', { queryId, cacheTags });
13
+
14
+ return Promise.resolve();
15
+ };
16
+
17
+ const queriesReferencingCacheTags = async (cacheTags: CacheTag[]) => {
18
+ console.debug('-- queriesReferencingCacheTags called', { cacheTags });
19
+
20
+ return Promise.resolve([]);
21
+ };
22
+
23
+ const deleteCacheTags = async (cacheTags: CacheTag[]) => {
24
+ console.debug('-- deleteCacheTags called', { cacheTags });
25
+
26
+ return Promise.resolve(0);
27
+ };
28
+
29
+ const truncateCacheTags = async () => {
30
+ console.debug('-- truncateCacheTags called');
31
+
32
+ return Promise.resolve(0);
33
+ };
34
+
35
+ return {
36
+ storeQueryCacheTags,
37
+ queriesReferencingCacheTags,
38
+ deleteCacheTags,
39
+ truncateCacheTags,
40
+ };
41
+ };