@suspensive/cache
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -1,2 +0,2 @@ | ||
import { CacheKey, CacheOptions } from './types.js'; | ||
import { CacheKey, CacheOptions, DataTag } from './types.js'; | ||
@@ -6,4 +6,6 @@ /** | ||
*/ | ||
declare function cacheOptions<TData, TCacheKey extends CacheKey>(options: CacheOptions<TData, TCacheKey>): CacheOptions<TData, TCacheKey>; | ||
declare function cacheOptions<TData, TCacheKey extends CacheKey>(options: CacheOptions<TData, TCacheKey>): CacheOptions<TData, TCacheKey> & { | ||
cacheKey: DataTag<TCacheKey, TData>; | ||
}; | ||
export { cacheOptions }; |
"use client" | ||
import { | ||
cacheOptions | ||
} from "./chunk-RYZ2WLOI.js"; | ||
} from "./chunk-RN456Z2W.js"; | ||
import "./chunk-QETBZSG5.js"; | ||
@@ -6,0 +6,0 @@ export { |
@@ -13,3 +13,3 @@ "use client" | ||
cacheOptions | ||
} from "./chunk-RYZ2WLOI.js"; | ||
} from "./chunk-RN456Z2W.js"; | ||
import { | ||
@@ -16,0 +16,0 @@ useCache |
@@ -7,3 +7,3 @@ type Tuple<TItem = unknown> = TItem[] | readonly TItem[]; | ||
*/ | ||
type CacheOptions<TData, TCacheKey extends CacheKey> = { | ||
interface CacheOptions<TData, TCacheKey extends CacheKey> { | ||
cacheKey: TCacheKey; | ||
@@ -13,4 +13,8 @@ cacheFn: (options: { | ||
}) => Promise<TData>; | ||
} | ||
declare const dataTagSymbol: unique symbol; | ||
type DataTag<TType, TValue> = TType & { | ||
[dataTagSymbol]: TValue; | ||
}; | ||
export type { CacheKey, CacheOptions }; | ||
export { type CacheKey, type CacheOptions, type DataTag, dataTagSymbol }; |
{ | ||
"name": "@suspensive/cache", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Useful interfaces for React Suspense", | ||
@@ -46,4 +46,4 @@ "keywords": [ | ||
"@suspensive/eslint-config": "0.0.0", | ||
"@suspensive/react": "2.6.2", | ||
"@suspensive/test-utils": "0.0.0", | ||
"@suspensive/react": "2.6.2", | ||
"@suspensive/tsconfig": "0.0.0-development", | ||
@@ -50,0 +50,0 @@ "@suspensive/tsup": "0.0.0" |
@@ -1,2 +0,2 @@ | ||
import type { CacheKey, CacheOptions } from './types' | ||
import type { CacheKey, CacheOptions, DataTag } from './types' | ||
@@ -8,4 +8,11 @@ /** | ||
options: CacheOptions<TData, TCacheKey> | ||
): CacheOptions<TData, TCacheKey> { | ||
): CacheOptions<TData, TCacheKey> & { | ||
cacheKey: DataTag<TCacheKey, TData> | ||
} | ||
/** | ||
* @experimental This is experimental feature. | ||
*/ | ||
export function cacheOptions(options: unknown) { | ||
return options | ||
} |
@@ -8,5 +8,10 @@ import type { Tuple } from './utility-types' | ||
*/ | ||
export type CacheOptions<TData, TCacheKey extends CacheKey> = { | ||
export interface CacheOptions<TData, TCacheKey extends CacheKey> { | ||
cacheKey: TCacheKey | ||
cacheFn: (options: { cacheKey: TCacheKey }) => Promise<TData> | ||
} | ||
export declare const dataTagSymbol: unique symbol | ||
export type DataTag<TType, TValue> = TType & { | ||
[dataTagSymbol]: TValue | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
127645
91
1916
0