Maximilian Koeller dc9f4b994e feat(service-worker): include CacheQueryOptions options in ngsw-config (#34663)
Previously it was not possible to provide `CacheQueryOptions` ([MDN](https://developer.mozilla.org/en-US/docs/Web/API/Cache)) for querying the Cache.
This commit introduces a new parameter called `cacheQueryOptions` for `DataGroup` and `AssetGroup`.
Currently only `ignoreSearch` is supported as `ignoreVary` and `ignoreMethod` would require using
the complete Request object for matching which is not possible with the current implementation.

Closes #28443

PR Close #34663
2020-05-01 09:44:07 -07:00

49 lines
1.2 KiB
TypeScript

export declare interface AssetGroup {
cacheQueryOptions?: Pick<CacheQueryOptions, 'ignoreSearch'>;
installMode?: 'prefetch' | 'lazy';
name: string;
resources: {
files?: Glob[];
urls?: Glob[];
};
updateMode?: 'prefetch' | 'lazy';
}
export declare interface Config {
appData?: {};
assetGroups?: AssetGroup[];
dataGroups?: DataGroup[];
index: string;
navigationUrls?: string[];
}
export declare interface DataGroup {
cacheConfig: {
maxSize: number;
maxAge: Duration;
timeout?: Duration;
strategy?: 'freshness' | 'performance';
};
cacheQueryOptions?: Pick<CacheQueryOptions, 'ignoreSearch'>;
name: string;
urls: Glob[];
version?: number;
}
export declare type Duration = string;
export declare interface Filesystem {
hash(file: string): Promise<string>;
list(dir: string): Promise<string[]>;
read(file: string): Promise<string>;
write(file: string, contents: string): Promise<void>;
}
export declare class Generator {
readonly fs: Filesystem;
constructor(fs: Filesystem, baseHref: string);
process(config: Config): Promise<Object>;
}
export declare type Glob = string;