@conduit-client/service-cache-control 3.6.2 → 3.7.0-dev1

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.
@@ -9,17 +9,13 @@ export type OnlyIfCachedRequestConfig = {
9
9
  /**
10
10
  * Only-if-cached strategy:
11
11
  * - Never performs a network request
12
- * - Returns cached data if present
13
- * - Allows serving stale entries per RFC 9111 (only-if-cached may be satisfied by a stored response)
14
- * - Excludes no-store entries
12
+ * - Returns cached data if present and fresh (not expired)
13
+ * - Excludes expired max-age entries, no-store entries, and ALL no-cache entries
14
+ * (no-cache requires revalidation, which is impossible with only-if-cached)
15
15
  */
16
16
  export declare class OnlyIfCachedCacheControlStrategy<NetworkResult, Error> extends CacheControlStrategy<NetworkResult, Error> {
17
17
  execute(options?: ExecuteOptions): SyncOrAsync<Result<void, Error>>;
18
- protected get expiredChecks(): ((cacheControlMetadata: CacheControlMetadata) => cacheControlMetadata is {
19
- type: "no-store";
20
- } & {
21
- generatedTime: number;
22
- })[];
18
+ protected get expiredChecks(): ((cacheControlMetadata: CacheControlMetadata) => boolean)[];
23
19
  private collectCacheHitInstrumentation;
24
20
  private collectCacheMissInstrumentation;
25
21
  }
package/dist/v1/index.js CHANGED
@@ -153,9 +153,13 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
153
153
  }
154
154
  get expiredChecks() {
155
155
  return [
156
- (cacheControlMetadata) => cacheControlMetadata.type === "no-store"
156
+ ...super.expiredChecks,
157
+ (cacheControlMetadata) => cacheControlMetadata.type === "no-cache"
157
158
  ];
158
159
  }
160
+ // Note: If we add support for `stale-while-revalidate` in the future, we may
161
+ // need to further override expiredChecks to allow stale entries that are within the
162
+ // stale-while-revalidate window to be returned for only-if-cached requests.
159
163
  collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
160
164
  if (this.services.instrumentation) {
161
165
  const meter = this.services.instrumentation.metrics.getMeter("onestore");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/v1/cache-control-strategies/cache-control-strategy.ts","../../src/v1/cache-control-strategies/no-cache-control-strategy.ts","../../src/v1/cache-control-strategies/max-age-cache-control-strategy.ts","../../src/v1/cache-control-strategies/only-if-cached-cache-control-strategy.ts","../../src/v1/cache-control.ts","../../src/v1/index.ts"],"sourcesContent":["import { SyncOrAsync, type Result } from '@conduit-client/utils';\nimport type { ExecuteOptions, RequestRunner } from '../cache-control';\nimport type {\n CacheControlMetadata,\n CacheEntry,\n NamedCacheService,\n Cache,\n} from '@conduit-client/service-cache/v1';\nimport type { MaxAgeRequestConfig } from './max-age-cache-control-strategy';\nimport type { NoCacheRequestConfig } from './no-cache-control-strategy';\nimport type { OnlyIfCachedRequestConfig } from './only-if-cached-cache-control-strategy';\nimport { NamedInstrumentationService } from '@conduit-client/service-instrumentation/v1';\nimport { NamedCacheInclusionPolicyService } from '@conduit-client/service-cache-inclusion-policy/v1';\n\nexport type CacheControlStrategyConfig =\n | MaxAgeRequestConfig\n | NoCacheRequestConfig\n | OnlyIfCachedRequestConfig;\n\nexport abstract class CacheControlStrategy<NetworkResult, Error> {\n filteredCache: Cache;\n constructor(\n protected services: NamedCacheService &\n NamedCacheInclusionPolicyService &\n Partial<NamedInstrumentationService>,\n protected config: CacheControlStrategyConfig,\n protected requestRunner: RequestRunner<NetworkResult, Error>\n ) {\n this.filteredCache = this.services.cache.filter((_, entry: CacheEntry<unknown>) => {\n const { cacheControl } = entry.metadata;\n return !this.expiredChecks.some((check) => check(cacheControl));\n });\n }\n\n abstract execute(options?: ExecuteOptions): SyncOrAsync<Result<void, Error>>;\n\n protected get expiredChecks() {\n return [\n (cacheControlMetadata: CacheControlMetadata) =>\n cacheControlMetadata.type === 'max-age' &&\n this.config.now > cacheControlMetadata.generatedTime + cacheControlMetadata.maxAge,\n (cacheControlMetadata: CacheControlMetadata) =>\n cacheControlMetadata.type === 'max-age' && cacheControlMetadata.maxAge <= 0,\n (cacheControlMetadata: CacheControlMetadata) =>\n cacheControlMetadata.type === 'no-store',\n (cacheControlMetadata: CacheControlMetadata) =>\n cacheControlMetadata.type === 'no-cache' &&\n cacheControlMetadata.generatedTime < this.config.now,\n ];\n }\n}\n","import { err, ok, SyncOrAsync, type Result } from '@conduit-client/utils';\nimport { CacheControlStrategy } from './cache-control-strategy';\n\nexport type NoCacheRequestConfig = {\n type: 'no-cache';\n now: number; // seconds\n};\n\nexport class NoCacheCacheControlStrategy<NetworkResult, Error> extends CacheControlStrategy<\n NetworkResult,\n Error\n> {\n execute(): SyncOrAsync<Result<void, Error>> {\n // TODO - should be using wrapper here that suppresses no-store writes\n const tempCache = this.filteredCache;\n return new Promise(async (resolve, reject) => {\n try {\n let readResult: Result<void, Error> = ok(undefined);\n for await (const rfnResult of this.requestRunner.requestFromNetwork()) {\n if (rfnResult) {\n const result = await this.services.cacheInclusionPolicy.write({\n l1: tempCache,\n writeToL1: (l1) => this.requestRunner.writeToCache(l1, rfnResult),\n });\n if (result.isErr()) {\n return resolve(result);\n }\n }\n // give readFromCache another shot at the cache\n readResult = await this.services.cacheInclusionPolicy.read({\n l1: tempCache,\n readFromL1: (l1) => this.requestRunner.readFromCache(l1),\n });\n if (readResult.isOk()) {\n resolve(readResult);\n }\n }\n return resolve(readResult);\n } catch (error) {\n return reject(error);\n }\n });\n }\n}\n","import {\n type Err,\n err,\n ok,\n resolvedPromiseLike,\n type Result,\n type SyncOrAsync,\n} from '@conduit-client/utils';\nimport { CacheControlStrategy } from './cache-control-strategy';\nimport type { CacheControlMetadata, Cache } from '@conduit-client/service-cache/v1';\nimport type { ExecuteOptions } from '../cache-control';\nimport { InstrumentationAttributes } from '@conduit-client/service-instrumentation/v1';\n\nexport type MaxAgeRequestConfig = {\n type: 'max-age';\n requestMaxAge: number; // seconds\n now: number; // seconds\n};\nexport class MaxAgeCacheControlStrategy<NetworkResult, Error> extends CacheControlStrategy<\n NetworkResult,\n Error\n> {\n execute(options?: ExecuteOptions): SyncOrAsync<Result<void, Error>> {\n const startTime: number = this.services.instrumentation\n ? this.services.instrumentation.currentTimeMs()\n : 0;\n\n return this.services.cacheInclusionPolicy\n .read({\n l1: this.filteredCache,\n readFromL1: (l1) => this.requestRunner.readFromCache(l1),\n })\n .then((value) => {\n // ignore error from initial cache read\n if (value.isOk()) {\n this.collectCacheHitInstrumentation(\n startTime,\n options?.instrumentationAttributes\n );\n return ok(undefined);\n }\n\n this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);\n\n // initial cache read failed, awaits are ok beyond this point since the data\n // must come from network requests\n const tempCache = this.filteredCache;\n return new Promise(async (resolve, reject) => {\n try {\n let readResult: Result<void, Error> = ok(undefined);\n for await (const rfnResult of this.requestRunner.requestFromNetwork()) {\n // async generator has a value to ingest\n if (rfnResult) {\n const result = await this.services.cacheInclusionPolicy.write({\n l1: tempCache,\n writeToL1: (l1) =>\n this.requestRunner.writeToCache(l1, rfnResult),\n });\n if (result.isErr()) {\n return resolve(err(result.error));\n }\n }\n\n // give readFromCache another shot at the cache\n readResult = await this.services.cacheInclusionPolicy.read({\n l1: tempCache,\n readFromL1: (l1) => this.requestRunner.readFromCache(l1),\n });\n if (readResult.isOk()) {\n resolve(ok(undefined));\n }\n }\n return resolve(readResult);\n } catch (e) {\n return reject(e);\n }\n });\n });\n }\n\n private collectCacheHitInstrumentation(\n startTime: number,\n instrumentationAttributes: InstrumentationAttributes | undefined\n ) {\n if (this.services.instrumentation) {\n const meter = this.services.instrumentation.metrics.getMeter('onestore');\n meter\n .createCounter<InstrumentationAttributes>(`command.max-age.cache-hit.count`)\n .add(1, instrumentationAttributes);\n meter\n .createHistogram<InstrumentationAttributes>(`command.max-age.cache-hit.duration`)\n .record(\n this.services.instrumentation.currentTimeMs() - startTime,\n instrumentationAttributes\n );\n }\n }\n\n private collectCacheMissInstrumentation(\n startTime: number,\n instrumentationAttributes: InstrumentationAttributes | undefined\n ) {\n if (this.services.instrumentation) {\n const meter = this.services.instrumentation.metrics.getMeter('onestore');\n meter\n .createCounter<InstrumentationAttributes>(`command.max-age.cache-miss.count`)\n .add(1, instrumentationAttributes);\n meter\n .createHistogram<InstrumentationAttributes>(`command.max-age.cache-miss.duration`)\n .record(\n this.services.instrumentation.currentTimeMs() - startTime,\n instrumentationAttributes\n );\n }\n }\n\n protected get expiredChecks() {\n const config = this.config as MaxAgeRequestConfig;\n return [\n ...super.expiredChecks,\n (cacheControlMetadata: CacheControlMetadata) => {\n return cacheControlMetadata.generatedTime + config.requestMaxAge < config.now;\n },\n ];\n }\n}\n","import {\n err,\n type Result,\n type SyncOrAsync,\n FetchResponse,\n HttpStatusCode,\n UserVisibleError,\n ok,\n} from '@conduit-client/utils';\nimport { CacheControlStrategy } from './cache-control-strategy';\nimport type { CacheControlMetadata } from '@conduit-client/service-cache/v1';\nimport type { ExecuteOptions } from '../cache-control';\nimport { InstrumentationAttributes } from '@conduit-client/service-instrumentation/v1';\n\nexport type OnlyIfCachedRequestConfig = {\n type: 'only-if-cached';\n now: number; // seconds\n};\n\n/**\n * Only-if-cached strategy:\n * - Never performs a network request\n * - Returns cached data if present\n * - Allows serving stale entries per RFC 9111 (only-if-cached may be satisfied by a stored response)\n * - Excludes no-store entries\n */\nexport class OnlyIfCachedCacheControlStrategy<NetworkResult, Error> extends CacheControlStrategy<\n NetworkResult,\n Error\n> {\n execute(options?: ExecuteOptions): SyncOrAsync<Result<void, Error>> {\n const startTime: number = this.services.instrumentation\n ? this.services.instrumentation.currentTimeMs()\n : 0;\n\n return this.services.cacheInclusionPolicy\n .read({\n l1: this.filteredCache,\n readFromL1: (l1) => this.requestRunner.readFromCache(l1),\n })\n .then((result) => {\n if (result.isOk()) {\n this.collectCacheHitInstrumentation(\n startTime,\n options?.instrumentationAttributes\n );\n return ok(undefined);\n }\n this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);\n const error = new UserVisibleError(\n new FetchResponse(HttpStatusCode.GatewayTimeout, {\n error: 'Cache miss for only-if-cached request',\n })\n );\n return err(error as unknown as Error);\n });\n }\n\n protected get expiredChecks() {\n // Allow stale cached entries (max-age expired or no-cache) to be used.\n // Still exclude no-store entries.\n return [\n (cacheControlMetadata: CacheControlMetadata) =>\n cacheControlMetadata.type === 'no-store',\n ];\n }\n\n private collectCacheHitInstrumentation(\n startTime: number,\n instrumentationAttributes: InstrumentationAttributes | undefined\n ) {\n if (this.services.instrumentation) {\n const meter = this.services.instrumentation.metrics.getMeter('onestore');\n meter\n .createCounter<InstrumentationAttributes>(`command.only-if-cached.cache-hit.count`)\n .add(1, instrumentationAttributes);\n meter\n .createHistogram<InstrumentationAttributes>(\n `command.only-if-cached.cache-hit.duration`\n )\n .record(\n this.services.instrumentation.currentTimeMs() - startTime,\n instrumentationAttributes\n );\n }\n }\n\n private collectCacheMissInstrumentation(\n startTime: number,\n instrumentationAttributes: InstrumentationAttributes | undefined\n ) {\n if (this.services.instrumentation) {\n const meter = this.services.instrumentation.metrics.getMeter('onestore');\n meter\n .createCounter<InstrumentationAttributes>(`command.only-if-cached.cache-miss.count`)\n .add(1, instrumentationAttributes);\n meter\n .createHistogram<InstrumentationAttributes>(\n `command.only-if-cached.cache-miss.duration`\n )\n .record(\n this.services.instrumentation.currentTimeMs() - startTime,\n instrumentationAttributes\n );\n }\n }\n}\n","import { type SyncOrAsync, type Result, DeepReadonly } from '@conduit-client/utils';\nimport { NoCacheCacheControlStrategy } from './cache-control-strategies/no-cache-control-strategy';\nimport { MaxAgeCacheControlStrategy } from './cache-control-strategies/max-age-cache-control-strategy';\nimport { OnlyIfCachedCacheControlStrategy } from './cache-control-strategies/only-if-cached-cache-control-strategy';\nimport type {\n CacheControlStrategy,\n CacheControlStrategyConfig,\n} from './cache-control-strategies/cache-control-strategy';\nimport type {\n Cache,\n CacheEntry,\n NamedCacheService,\n Key,\n ReadonlyCache,\n} from '@conduit-client/service-cache/v1';\nimport type {\n InstrumentationAttributes,\n NamedInstrumentationService,\n} from '@conduit-client/service-instrumentation/v1';\nimport {\n NamedCacheInclusionPolicyService,\n CacheQuery,\n CacheUpdate,\n} from '@conduit-client/service-cache-inclusion-policy/v1';\n\n/**\n * A class that exposes access for\n * - reading from a cache\n * - writing to a cache\n * - making a network request\n *\n * This allows the cache controller to run these methods in any order\n * based on the canonical & requested cache control metadata, without having\n * to understand the inner workings of these functions\n */\nexport type RequestRunner<NetworkResult, E> = {\n readFromCache: (cache: ReadonlyCache) => SyncOrAsync<Result<void, E>>;\n requestFromNetwork: () => AsyncGenerator<NetworkResult | undefined, void, void>;\n writeToCache: (cache: Cache, networkResult: NetworkResult) => SyncOrAsync<Result<void, E>>;\n};\n\nexport type ExecuteOptions = {\n instrumentationAttributes?: InstrumentationAttributes;\n};\n\n/**\n * A class that allows the execution of requested cache control strategies,\n * while also enforcing the canonical cache control metadata.\n */\nexport class CacheController {\n constructor(\n protected services: NamedCacheService &\n NamedCacheInclusionPolicyService &\n Partial<NamedInstrumentationService>\n ) {}\n\n execute<NetworkResult, E = unknown>(\n config: CacheControlStrategyConfig,\n requestRunner: RequestRunner<NetworkResult, E>,\n options?: ExecuteOptions\n ) {\n const strategy = this.getCacheControlStrategy<NetworkResult, E>(config, requestRunner);\n return strategy.execute(options);\n }\n\n private getCacheControlStrategy<NetworkResult, Error>(\n config: CacheControlStrategyConfig,\n requestRunner: RequestRunner<NetworkResult, Error>\n ): CacheControlStrategy<NetworkResult, Error> {\n if (config.type === 'max-age') {\n return new MaxAgeCacheControlStrategy(this.services, config, requestRunner);\n } else if (config.type === 'no-cache') {\n return new NoCacheCacheControlStrategy(this.services, config, requestRunner);\n } else if (config.type === 'only-if-cached') {\n return new OnlyIfCachedCacheControlStrategy(this.services, config, requestRunner);\n }\n\n throw new Error(`Unknown cache control strategy ${(config as any).type}`);\n }\n\n /**\n * Finds cache entries that match the given query.\n * Returns an async generator that yields `[key, entry]`.\n */\n async *find(\n query: CacheQuery\n ): AsyncGenerator<[key: Key, value: DeepReadonly<CacheEntry<unknown>>], void, unknown> {\n yield* this.services.cacheInclusionPolicy.find(query);\n }\n\n /**\n * Finds and modifies cache entries that match the given query.\n * Extends `find(query)` and returns an async generator of modified keys.\n */\n async *findAndModify(\n query: CacheQuery,\n cacheUpdate: CacheUpdate\n ): AsyncGenerator<Key, void, unknown> {\n yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);\n }\n}\n","import { CacheController } from './cache-control';\nimport type { ServiceDescriptor, NamedService, PublicInterface } from '@conduit-client/utils';\nimport type { Cache } from '@conduit-client/service-cache/v1';\nimport type { CacheInclusionPolicyService } from '@conduit-client/service-cache-inclusion-policy/v1';\nimport { InstrumentationService } from '@conduit-client/service-instrumentation/v1';\nexport type { CacheControlStrategyConfig } from './cache-control-strategies';\n\nexport type { RequestRunner } from './cache-control';\n\nexport type ICacheController = PublicInterface<CacheController>;\n\nexport type NamedCacheControllerService<Name extends string = 'cacheController'> = NamedService<\n Name,\n ICacheController\n>;\n\nexport type CacheControllerServiceDescriptor = ServiceDescriptor<\n ICacheController,\n 'cacheController',\n '1.0'\n>;\n\nexport function buildServiceDescriptor(\n cache: Cache,\n cacheInclusionPolicy: CacheInclusionPolicyService,\n instrumentation?: InstrumentationService\n): CacheControllerServiceDescriptor {\n return {\n type: 'cacheController',\n version: '1.0',\n service: new CacheController({ cache, cacheInclusionPolicy, instrumentation }),\n };\n}\n"],"names":[],"mappings":";;;;;;AAmBO,MAAe,qBAA2C;AAAA,EAE7D,YACc,UAGA,QACA,eACZ;AALY,SAAA,WAAA;AAGA,SAAA,SAAA;AACA,SAAA,gBAAA;AAEV,SAAK,gBAAgB,KAAK,SAAS,MAAM,OAAO,CAAC,GAAG,UAA+B;AAC/E,YAAM,EAAE,iBAAiB,MAAM;AAC/B,aAAO,CAAC,KAAK,cAAc,KAAK,CAAC,UAAU,MAAM,YAAY,CAAC;AAAA,IAClE,CAAC;AAAA,EACL;AAAA,EAIA,IAAc,gBAAgB;AAC1B,WAAO;AAAA,MACH,CAAC,yBACG,qBAAqB,SAAS,aAC9B,KAAK,OAAO,MAAM,qBAAqB,gBAAgB,qBAAqB;A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KACH,OACmF;AACnF,WAAO,KAAK,SAAS,qBAAqB,KAAK,KAAK;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,cACH,OACA,aACkC;AAClC,WAAO,KAAK,SAAS,qBAAqB,cAAc,OAAO,WAAW;AAAA,EAC9E;AACJ;AC9EO,SAAS,uBACZ,OACA,sBACA,iBACgC;AAChC,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,IAAI,gBAAgB,EAAE,OAAO,sBAAsB,iBAAiB;AAAA,EAAA;AAErF;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/v1/cache-control-strategies/cache-control-strategy.ts","../../src/v1/cache-control-strategies/no-cache-control-strategy.ts","../../src/v1/cache-control-strategies/max-age-cache-control-strategy.ts","../../src/v1/cache-control-strategies/only-if-cached-cache-control-strategy.ts","../../src/v1/cache-control.ts","../../src/v1/index.ts"],"sourcesContent":["import { SyncOrAsync, type Result } from '@conduit-client/utils';\nimport type { ExecuteOptions, RequestRunner } from '../cache-control';\nimport type {\n CacheControlMetadata,\n CacheEntry,\n NamedCacheService,\n Cache,\n} from '@conduit-client/service-cache/v1';\nimport type { MaxAgeRequestConfig } from './max-age-cache-control-strategy';\nimport type { NoCacheRequestConfig } from './no-cache-control-strategy';\nimport type { OnlyIfCachedRequestConfig } from './only-if-cached-cache-control-strategy';\nimport { NamedInstrumentationService } from '@conduit-client/service-instrumentation/v1';\nimport { NamedCacheInclusionPolicyService } from '@conduit-client/service-cache-inclusion-policy/v1';\n\nexport type CacheControlStrategyConfig =\n | MaxAgeRequestConfig\n | NoCacheRequestConfig\n | OnlyIfCachedRequestConfig;\n\nexport abstract class CacheControlStrategy<NetworkResult, Error> {\n filteredCache: Cache;\n constructor(\n protected services: NamedCacheService &\n NamedCacheInclusionPolicyService &\n Partial<NamedInstrumentationService>,\n protected config: CacheControlStrategyConfig,\n protected requestRunner: RequestRunner<NetworkResult, Error>\n ) {\n this.filteredCache = this.services.cache.filter((_, entry: CacheEntry<unknown>) => {\n const { cacheControl } = entry.metadata;\n return !this.expiredChecks.some((check) => check(cacheControl));\n });\n }\n\n abstract execute(options?: ExecuteOptions): SyncOrAsync<Result<void, Error>>;\n\n protected get expiredChecks() {\n return [\n (cacheControlMetadata: CacheControlMetadata) =>\n cacheControlMetadata.type === 'max-age' &&\n this.config.now > cacheControlMetadata.generatedTime + cacheControlMetadata.maxAge,\n (cacheControlMetadata: CacheControlMetadata) =>\n cacheControlMetadata.type === 'max-age' && cacheControlMetadata.maxAge <= 0,\n (cacheControlMetadata: CacheControlMetadata) =>\n cacheControlMetadata.type === 'no-store',\n (cacheControlMetadata: CacheControlMetadata) =>\n cacheControlMetadata.type === 'no-cache' &&\n cacheControlMetadata.generatedTime < this.config.now,\n ];\n }\n}\n","import { err, ok, SyncOrAsync, type Result } from '@conduit-client/utils';\nimport { CacheControlStrategy } from './cache-control-strategy';\n\nexport type NoCacheRequestConfig = {\n type: 'no-cache';\n now: number; // seconds\n};\n\nexport class NoCacheCacheControlStrategy<NetworkResult, Error> extends CacheControlStrategy<\n NetworkResult,\n Error\n> {\n execute(): SyncOrAsync<Result<void, Error>> {\n // TODO - should be using wrapper here that suppresses no-store writes\n const tempCache = this.filteredCache;\n return new Promise(async (resolve, reject) => {\n try {\n let readResult: Result<void, Error> = ok(undefined);\n for await (const rfnResult of this.requestRunner.requestFromNetwork()) {\n if (rfnResult) {\n const result = await this.services.cacheInclusionPolicy.write({\n l1: tempCache,\n writeToL1: (l1) => this.requestRunner.writeToCache(l1, rfnResult),\n });\n if (result.isErr()) {\n return resolve(result);\n }\n }\n // give readFromCache another shot at the cache\n readResult = await this.services.cacheInclusionPolicy.read({\n l1: tempCache,\n readFromL1: (l1) => this.requestRunner.readFromCache(l1),\n });\n if (readResult.isOk()) {\n resolve(readResult);\n }\n }\n return resolve(readResult);\n } catch (error) {\n return reject(error);\n }\n });\n }\n}\n","import {\n type Err,\n err,\n ok,\n resolvedPromiseLike,\n type Result,\n type SyncOrAsync,\n} from '@conduit-client/utils';\nimport { CacheControlStrategy } from './cache-control-strategy';\nimport type { CacheControlMetadata, Cache } from '@conduit-client/service-cache/v1';\nimport type { ExecuteOptions } from '../cache-control';\nimport { InstrumentationAttributes } from '@conduit-client/service-instrumentation/v1';\n\nexport type MaxAgeRequestConfig = {\n type: 'max-age';\n requestMaxAge: number; // seconds\n now: number; // seconds\n};\nexport class MaxAgeCacheControlStrategy<NetworkResult, Error> extends CacheControlStrategy<\n NetworkResult,\n Error\n> {\n execute(options?: ExecuteOptions): SyncOrAsync<Result<void, Error>> {\n const startTime: number = this.services.instrumentation\n ? this.services.instrumentation.currentTimeMs()\n : 0;\n\n return this.services.cacheInclusionPolicy\n .read({\n l1: this.filteredCache,\n readFromL1: (l1) => this.requestRunner.readFromCache(l1),\n })\n .then((value) => {\n // ignore error from initial cache read\n if (value.isOk()) {\n this.collectCacheHitInstrumentation(\n startTime,\n options?.instrumentationAttributes\n );\n return ok(undefined);\n }\n\n this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);\n\n // initial cache read failed, awaits are ok beyond this point since the data\n // must come from network requests\n const tempCache = this.filteredCache;\n return new Promise(async (resolve, reject) => {\n try {\n let readResult: Result<void, Error> = ok(undefined);\n for await (const rfnResult of this.requestRunner.requestFromNetwork()) {\n // async generator has a value to ingest\n if (rfnResult) {\n const result = await this.services.cacheInclusionPolicy.write({\n l1: tempCache,\n writeToL1: (l1) =>\n this.requestRunner.writeToCache(l1, rfnResult),\n });\n if (result.isErr()) {\n return resolve(err(result.error));\n }\n }\n\n // give readFromCache another shot at the cache\n readResult = await this.services.cacheInclusionPolicy.read({\n l1: tempCache,\n readFromL1: (l1) => this.requestRunner.readFromCache(l1),\n });\n if (readResult.isOk()) {\n resolve(ok(undefined));\n }\n }\n return resolve(readResult);\n } catch (e) {\n return reject(e);\n }\n });\n });\n }\n\n private collectCacheHitInstrumentation(\n startTime: number,\n instrumentationAttributes: InstrumentationAttributes | undefined\n ) {\n if (this.services.instrumentation) {\n const meter = this.services.instrumentation.metrics.getMeter('onestore');\n meter\n .createCounter<InstrumentationAttributes>(`command.max-age.cache-hit.count`)\n .add(1, instrumentationAttributes);\n meter\n .createHistogram<InstrumentationAttributes>(`command.max-age.cache-hit.duration`)\n .record(\n this.services.instrumentation.currentTimeMs() - startTime,\n instrumentationAttributes\n );\n }\n }\n\n private collectCacheMissInstrumentation(\n startTime: number,\n instrumentationAttributes: InstrumentationAttributes | undefined\n ) {\n if (this.services.instrumentation) {\n const meter = this.services.instrumentation.metrics.getMeter('onestore');\n meter\n .createCounter<InstrumentationAttributes>(`command.max-age.cache-miss.count`)\n .add(1, instrumentationAttributes);\n meter\n .createHistogram<InstrumentationAttributes>(`command.max-age.cache-miss.duration`)\n .record(\n this.services.instrumentation.currentTimeMs() - startTime,\n instrumentationAttributes\n );\n }\n }\n\n protected get expiredChecks() {\n const config = this.config as MaxAgeRequestConfig;\n return [\n ...super.expiredChecks,\n (cacheControlMetadata: CacheControlMetadata) => {\n return cacheControlMetadata.generatedTime + config.requestMaxAge < config.now;\n },\n ];\n }\n}\n","import {\n err,\n type Result,\n type SyncOrAsync,\n FetchResponse,\n HttpStatusCode,\n UserVisibleError,\n ok,\n} from '@conduit-client/utils';\nimport { CacheControlStrategy } from './cache-control-strategy';\nimport type { CacheControlMetadata } from '@conduit-client/service-cache/v1';\nimport type { ExecuteOptions } from '../cache-control';\nimport { InstrumentationAttributes } from '@conduit-client/service-instrumentation/v1';\n\nexport type OnlyIfCachedRequestConfig = {\n type: 'only-if-cached';\n now: number; // seconds\n};\n\n/**\n * Only-if-cached strategy:\n * - Never performs a network request\n * - Returns cached data if present and fresh (not expired)\n * - Excludes expired max-age entries, no-store entries, and ALL no-cache entries\n * (no-cache requires revalidation, which is impossible with only-if-cached)\n */\nexport class OnlyIfCachedCacheControlStrategy<NetworkResult, Error> extends CacheControlStrategy<\n NetworkResult,\n Error\n> {\n execute(options?: ExecuteOptions): SyncOrAsync<Result<void, Error>> {\n const startTime: number = this.services.instrumentation\n ? this.services.instrumentation.currentTimeMs()\n : 0;\n\n return this.services.cacheInclusionPolicy\n .read({\n l1: this.filteredCache,\n readFromL1: (l1) => this.requestRunner.readFromCache(l1),\n })\n .then((result) => {\n if (result.isOk()) {\n this.collectCacheHitInstrumentation(\n startTime,\n options?.instrumentationAttributes\n );\n return ok(undefined);\n }\n this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);\n const error = new UserVisibleError(\n new FetchResponse(HttpStatusCode.GatewayTimeout, {\n error: 'Cache miss for only-if-cached request',\n })\n );\n return err(error as unknown as Error);\n });\n }\n\n protected get expiredChecks() {\n // Override to exclude ALL no-cache entries (not just expired ones).\n // Per RFC 9111, no-cache requires revalidation, but only-if-cached prevents network\n // requests, making revalidation impossible. Therefore, all no-cache entries must be excluded.\n return [\n ...super.expiredChecks,\n (cacheControlMetadata: CacheControlMetadata) =>\n cacheControlMetadata.type === 'no-cache',\n ];\n }\n\n // Note: If we add support for `stale-while-revalidate` in the future, we may\n // need to further override expiredChecks to allow stale entries that are within the\n // stale-while-revalidate window to be returned for only-if-cached requests.\n\n private collectCacheHitInstrumentation(\n startTime: number,\n instrumentationAttributes: InstrumentationAttributes | undefined\n ) {\n if (this.services.instrumentation) {\n const meter = this.services.instrumentation.metrics.getMeter('onestore');\n meter\n .createCounter<InstrumentationAttributes>(`command.only-if-cached.cache-hit.count`)\n .add(1, instrumentationAttributes);\n meter\n .createHistogram<InstrumentationAttributes>(\n `command.only-if-cached.cache-hit.duration`\n )\n .record(\n this.services.instrumentation.currentTimeMs() - startTime,\n instrumentationAttributes\n );\n }\n }\n\n private collectCacheMissInstrumentation(\n startTime: number,\n instrumentationAttributes: InstrumentationAttributes | undefined\n ) {\n if (this.services.instrumentation) {\n const meter = this.services.instrumentation.metrics.getMeter('onestore');\n meter\n .createCounter<InstrumentationAttributes>(`command.only-if-cached.cache-miss.count`)\n .add(1, instrumentationAttributes);\n meter\n .createHistogram<InstrumentationAttributes>(\n `command.only-if-cached.cache-miss.duration`\n )\n .record(\n this.services.instrumentation.currentTimeMs() - startTime,\n instrumentationAttributes\n );\n }\n }\n}\n","import { type SyncOrAsync, type Result, DeepReadonly } from '@conduit-client/utils';\nimport { NoCacheCacheControlStrategy } from './cache-control-strategies/no-cache-control-strategy';\nimport { MaxAgeCacheControlStrategy } from './cache-control-strategies/max-age-cache-control-strategy';\nimport { OnlyIfCachedCacheControlStrategy } from './cache-control-strategies/only-if-cached-cache-control-strategy';\nimport type {\n CacheControlStrategy,\n CacheControlStrategyConfig,\n} from './cache-control-strategies/cache-control-strategy';\nimport type {\n Cache,\n CacheEntry,\n NamedCacheService,\n Key,\n ReadonlyCache,\n} from '@conduit-client/service-cache/v1';\nimport type {\n InstrumentationAttributes,\n NamedInstrumentationService,\n} from '@conduit-client/service-instrumentation/v1';\nimport {\n NamedCacheInclusionPolicyService,\n CacheQuery,\n CacheUpdate,\n} from '@conduit-client/service-cache-inclusion-policy/v1';\n\n/**\n * A class that exposes access for\n * - reading from a cache\n * - writing to a cache\n * - making a network request\n *\n * This allows the cache controller to run these methods in any order\n * based on the canonical & requested cache control metadata, without having\n * to understand the inner workings of these functions\n */\nexport type RequestRunner<NetworkResult, E> = {\n readFromCache: (cache: ReadonlyCache) => SyncOrAsync<Result<void, E>>;\n requestFromNetwork: () => AsyncGenerator<NetworkResult | undefined, void, void>;\n writeToCache: (cache: Cache, networkResult: NetworkResult) => SyncOrAsync<Result<void, E>>;\n};\n\nexport type ExecuteOptions = {\n instrumentationAttributes?: InstrumentationAttributes;\n};\n\n/**\n * A class that allows the execution of requested cache control strategies,\n * while also enforcing the canonical cache control metadata.\n */\nexport class CacheController {\n constructor(\n protected services: NamedCacheService &\n NamedCacheInclusionPolicyService &\n Partial<NamedInstrumentationService>\n ) {}\n\n execute<NetworkResult, E = unknown>(\n config: CacheControlStrategyConfig,\n requestRunner: RequestRunner<NetworkResult, E>,\n options?: ExecuteOptions\n ) {\n const strategy = this.getCacheControlStrategy<NetworkResult, E>(config, requestRunner);\n return strategy.execute(options);\n }\n\n private getCacheControlStrategy<NetworkResult, Error>(\n config: CacheControlStrategyConfig,\n requestRunner: RequestRunner<NetworkResult, Error>\n ): CacheControlStrategy<NetworkResult, Error> {\n if (config.type === 'max-age') {\n return new MaxAgeCacheControlStrategy(this.services, config, requestRunner);\n } else if (config.type === 'no-cache') {\n return new NoCacheCacheControlStrategy(this.services, config, requestRunner);\n } else if (config.type === 'only-if-cached') {\n return new OnlyIfCachedCacheControlStrategy(this.services, config, requestRunner);\n }\n\n throw new Error(`Unknown cache control strategy ${(config as any).type}`);\n }\n\n /**\n * Finds cache entries that match the given query.\n * Returns an async generator that yields `[key, entry]`.\n */\n async *find(\n query: CacheQuery\n ): AsyncGenerator<[key: Key, value: DeepReadonly<CacheEntry<unknown>>], void, unknown> {\n yield* this.services.cacheInclusionPolicy.find(query);\n }\n\n /**\n * Finds and modifies cache entries that match the given query.\n * Extends `find(query)` and returns an async generator of modified keys.\n */\n async *findAndModify(\n query: CacheQuery,\n cacheUpdate: CacheUpdate\n ): AsyncGenerator<Key, void, unknown> {\n yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);\n }\n}\n","import { CacheController } from './cache-control';\nimport type { ServiceDescriptor, NamedService, PublicInterface } from '@conduit-client/utils';\nimport type { Cache } from '@conduit-client/service-cache/v1';\nimport type { CacheInclusionPolicyService } from '@conduit-client/service-cache-inclusion-policy/v1';\nimport { InstrumentationService } from '@conduit-client/service-instrumentation/v1';\nexport type { CacheControlStrategyConfig } from './cache-control-strategies';\n\nexport type { RequestRunner } from './cache-control';\n\nexport type ICacheController = PublicInterface<CacheController>;\n\nexport type NamedCacheControllerService<Name extends string = 'cacheController'> = NamedService<\n Name,\n ICacheController\n>;\n\nexport type CacheControllerServiceDescriptor = ServiceDescriptor<\n ICacheController,\n 'cacheController',\n '1.0'\n>;\n\nexport function buildServiceDescriptor(\n cache: Cache,\n cacheInclusionPolicy: CacheInclusionPolicyService,\n instrumentation?: InstrumentationService\n): CacheControllerServiceDescriptor {\n return {\n type: 'cacheController',\n version: '1.0',\n service: new CacheController({ cache, cacheInclusionPolicy, instrumentation }),\n };\n}\n"],"names":[],"mappings":";;;;;;AAmBO,MAAe,qBAA2C;AAAA,EAE7D,YACc,UAGA,QACA,eACZ;AALY,SAAA,WAAA;AAGA,SAAA,SAAA;AACA,SAAA,gBAAA;AAEV,SAAK,gBAAgB,KAAK,SAAS,MAAM,OAAO,CAAC,GAAG,UAA+B;AAC/E,YAAM,EAAE,iBAAiB,MAAM;AAC/B,aAAO,CAAC,KAAK,cAAc,KAAK,CAAC,UAAU,MAAM,YAAY,CAAC;AAAA,IAClE,CAAC;AAAA,EACL;AAAA,EAIA,IAAc,gBAAgB;AAC1B,WAAO;AAAA,MACH,CAAC,yBACG,qBAAqB,SAAS,aAC9B,KAAK,OAAO,MAAM,qBAAqB,gBAAgB,qBAAqB;AAAA,MAChF,CAAC,yBACG,qBAAqB,SAAS,aAAa,qBAAqB,UAAU;AAAA,MAC9E,CAAC,yBACG,qBAAqB,SAAS;AAAA,MAClC,CAAC,yBACG,qBAAqB,SAAS,cAC9B,qBAAqB,gBAAgB,KAAK,OAAO;AAAA,IAAA;AAAA,EAE7D;AACJ;AC1CO,MAAM,oCAA0D,qBAGrE;AAAA,EACE,UAA4C;AAExC,UAAM,YAAY,KAAK;AACvB,WAAO,IAAI,QAAQ,OAAO,SAAS,WAAW;AAC1C,UAAI;AACA,YAAI,aAAkC,GAAG,MAAS;AAClD,yBAAiB,aAAa,KAAK,cAAc,mBAAA,GAAsB;AACnE,cAAI,WAAW;AACX,kBAAM,SAAS,MAAM,KAAK,SAAS,qBAAqB,MAAM;AAAA,cAC1D,IAAI;AAAA,cACJ,WAAW,CAAC,OAAO,KAAK,cAAc,aAAa,IAAI,SAAS;AAAA,YAAA,CACnE;AACD,gBAAI,OAAO,SAAS;AAChB,qBAAO,QAAQ,MAAM;AAAA,YACzB;AAAA,UACJ;AAEA,u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AACJ;AC/DO,MAAM,gBAAgB;AAAA,EACzB,YACc,UAGZ;AAHY,SAAA,WAAA;AAAA,EAGX;AAAA,EAEH,QACI,QACA,eACA,SACF;AACE,UAAM,WAAW,KAAK,wBAA0C,QAAQ,aAAa;AACrF,WAAO,SAAS,QAAQ,OAAO;AAAA,EACnC;AAAA,EAEQ,wBACJ,QACA,eAC0C;AAC1C,QAAI,OAAO,SAAS,WAAW;AAC3B,aAAO,IAAI,2BAA2B,KAAK,UAAU,QAAQ,aAAa;AAAA,IAC9E,WAAW,OAAO,SAAS,YAAY;AACnC,aAAO,IAAI,4BAA4B,KAAK,UAAU,QAAQ,aAAa;AAAA,IAC/E,WAAW,OAAO,SAAS,kBAAkB;AACzC,aAAO,IAAI,iCAAiC,KAAK,UAAU,QAAQ,aAAa;AAAA,IACpF;AAEA,UAAM,IAAI,MAAM,kCAAmC,OAAe,IAAI,EAAE;AAAA,EAC5E;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,KACH,OACmF;AACnF,WAAO,KAAK,SAAS,qBAAqB,KAAK,KAAK;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,cACH,OACA,aACkC;AAClC,WAAO,KAAK,SAAS,qBAAqB,cAAc,OAAO,WAAW;AAAA,EAC9E;AACJ;AC9EO,SAAS,uBACZ,OACA,sBACA,iBACgC;AAChC,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,IAAI,gBAAgB,EAAE,OAAO,sBAAsB,iBAAiB;AAAA,EAAA;AAErF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduit-client/service-cache-control",
3
- "version": "3.6.2",
3
+ "version": "3.7.0-dev1",
4
4
  "private": false,
5
5
  "description": "OneStore Cache Control Service definition",
6
6
  "type": "module",
@@ -31,9 +31,9 @@
31
31
  "watch": "npm run build --watch"
32
32
  },
33
33
  "dependencies": {
34
- "@conduit-client/service-cache": "3.6.2",
35
- "@conduit-client/service-cache-inclusion-policy": "3.6.2",
36
- "@conduit-client/utils": "3.6.2"
34
+ "@conduit-client/service-cache": "3.7.0-dev1",
35
+ "@conduit-client/service-cache-inclusion-policy": "3.7.0-dev1",
36
+ "@conduit-client/utils": "3.7.0-dev1"
37
37
  },
38
38
  "volta": {
39
39
  "extends": "../../../../package.json"