@terrafirmagreg-team/data 1.2.9 → 1.2.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terrafirmagreg-team/data",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "type": "module",
5
5
  "description": "Storage drivers and shared helpers",
6
6
  "license": "LGPL-3.0-only",
@@ -0,0 +1,17 @@
1
+ export type ServerCacheLoad = (
2
+ key: string,
3
+ loader: () => Promise<unknown>,
4
+ revalidate: number | false,
5
+ ) => Promise<unknown>;
6
+
7
+ const store = globalThis as Record<symbol, unknown>;
8
+
9
+ export function registerServerCache(load: ServerCacheLoad): void {
10
+ store[Symbol.for('terrafirmagreg.serverCache')] = load;
11
+ }
12
+
13
+ export function serverCache(): ServerCacheLoad | undefined {
14
+ return store[Symbol.for('terrafirmagreg.serverCache')] as
15
+ | ServerCacheLoad
16
+ | undefined;
17
+ }