strapi-cache 1.6.2 → 1.7.0
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/README.md +3 -1
- package/dist/_chunks/de-C_gFyhHL.mjs +18 -0
- package/dist/_chunks/de-l6MDDAXu.js +18 -0
- package/dist/_chunks/en-D9w03LyX.js +18 -0
- package/dist/_chunks/en-bK2OKwtN.mjs +18 -0
- package/dist/_chunks/index-BInrGFOe.mjs +52 -0
- package/dist/_chunks/index-BjBoZhpS.js +52 -0
- package/dist/_chunks/index-BwjcxGep.mjs +388 -0
- package/dist/_chunks/index-Dwrl1jfJ.js +387 -0
- package/dist/admin/index.js +3 -0
- package/dist/admin/index.mjs +4 -0
- package/dist/admin/src/components/PurgeModal/index.d.ts +2 -1
- package/dist/admin/src/hooks/useCacheOperations.d.ts +1 -0
- package/dist/server/index.js +848 -0
- package/dist/server/index.mjs +846 -0
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/config/index.d.ts +27 -0
- package/dist/server/src/content-types/index.d.ts +2 -0
- package/dist/server/src/controllers/controller.d.ts +10 -0
- package/dist/server/src/controllers/index.d.ts +11 -0
- package/dist/server/src/index.d.ts +75 -0
- package/dist/server/src/middlewares/cache.d.ts +3 -0
- package/dist/server/src/middlewares/graphql.d.ts +2 -0
- package/dist/server/src/middlewares/index.d.ts +6 -0
- package/dist/server/src/permissions.d.ts +6 -0
- package/dist/server/src/policies/index.d.ts +2 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/routes/index.d.ts +19 -0
- package/dist/server/src/routes/purge.d.ts +14 -0
- package/dist/server/src/services/index.d.ts +8 -0
- package/dist/server/src/services/memory/provider.d.ts +17 -0
- package/dist/server/src/services/memory/service.d.ts +6 -0
- package/dist/server/src/services/redis/provider.d.ts +18 -0
- package/dist/server/src/services/redis/service.d.ts +6 -0
- package/dist/server/src/services/resolver.d.ts +3 -0
- package/dist/server/src/types/cache.types.d.ts +18 -0
- package/dist/server/src/utils/body.d.ts +7 -0
- package/dist/server/src/utils/header.d.ts +10 -0
- package/dist/server/src/utils/invalidateCache.d.ts +4 -0
- package/dist/server/src/utils/key.d.ts +4 -0
- package/dist/server/src/utils/log.d.ts +5 -0
- package/dist/server/src/utils/withTimeout.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
default: ({ env }: {
|
|
3
|
+
env: any;
|
|
4
|
+
}) => {
|
|
5
|
+
debug: boolean;
|
|
6
|
+
max: number;
|
|
7
|
+
ttl: number;
|
|
8
|
+
size: number;
|
|
9
|
+
allowStale: boolean;
|
|
10
|
+
cacheableRoutes: any[];
|
|
11
|
+
provider: string;
|
|
12
|
+
excludeRoutes: any[];
|
|
13
|
+
redisConfig: any;
|
|
14
|
+
redisClusterNodes: any[];
|
|
15
|
+
redisClusterOptions: {};
|
|
16
|
+
cacheHeaders: boolean;
|
|
17
|
+
cacheHeadersDenyList: any[];
|
|
18
|
+
cacheHeadersAllowList: any[];
|
|
19
|
+
cacheAuthorizedRequests: boolean;
|
|
20
|
+
cacheGetTimeoutInMs: number;
|
|
21
|
+
autoPurgeCache: boolean;
|
|
22
|
+
autoPurgeCacheOnStart: boolean;
|
|
23
|
+
disableAdminPopups: boolean;
|
|
24
|
+
};
|
|
25
|
+
validator: (config: any) => void;
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Core } from '@strapi/strapi';
|
|
2
|
+
import { Context } from 'koa';
|
|
3
|
+
declare const controller: ({ strapi }: {
|
|
4
|
+
strapi: Core.Strapi;
|
|
5
|
+
}) => {
|
|
6
|
+
purgeCache(ctx: Context): Promise<void>;
|
|
7
|
+
purgeCacheByKey(ctx: Context): Promise<void>;
|
|
8
|
+
config(ctx: Context): Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export default controller;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="koa" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
controller: ({ strapi }: {
|
|
4
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
5
|
+
}) => {
|
|
6
|
+
purgeCache(ctx: import("koa").Context): Promise<void>;
|
|
7
|
+
purgeCacheByKey(ctx: import("koa").Context): Promise<void>;
|
|
8
|
+
config(ctx: import("koa").Context): Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/// <reference types="koa" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
register: ({ strapi }: {
|
|
4
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
5
|
+
}) => void;
|
|
6
|
+
bootstrap: ({ strapi }: {
|
|
7
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
8
|
+
}) => void;
|
|
9
|
+
destroy(): void;
|
|
10
|
+
config: {
|
|
11
|
+
default: ({ env }: {
|
|
12
|
+
env: any;
|
|
13
|
+
}) => {
|
|
14
|
+
debug: boolean;
|
|
15
|
+
max: number;
|
|
16
|
+
ttl: number;
|
|
17
|
+
size: number;
|
|
18
|
+
allowStale: boolean;
|
|
19
|
+
cacheableRoutes: any[];
|
|
20
|
+
provider: string;
|
|
21
|
+
excludeRoutes: any[];
|
|
22
|
+
redisConfig: any;
|
|
23
|
+
redisClusterNodes: any[];
|
|
24
|
+
redisClusterOptions: {};
|
|
25
|
+
cacheHeaders: boolean;
|
|
26
|
+
cacheHeadersDenyList: any[];
|
|
27
|
+
cacheHeadersAllowList: any[];
|
|
28
|
+
cacheAuthorizedRequests: boolean;
|
|
29
|
+
cacheGetTimeoutInMs: number;
|
|
30
|
+
autoPurgeCache: boolean;
|
|
31
|
+
autoPurgeCacheOnStart: boolean;
|
|
32
|
+
disableAdminPopups: boolean;
|
|
33
|
+
};
|
|
34
|
+
validator: (config: any) => void;
|
|
35
|
+
};
|
|
36
|
+
controllers: {
|
|
37
|
+
controller: ({ strapi }: {
|
|
38
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
39
|
+
}) => {
|
|
40
|
+
purgeCache(ctx: import("koa").Context): Promise<void>;
|
|
41
|
+
purgeCacheByKey(ctx: import("koa").Context): Promise<void>;
|
|
42
|
+
config(ctx: import("koa").Context): Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
routes: {
|
|
46
|
+
'purge-route': {
|
|
47
|
+
type: string;
|
|
48
|
+
routes: {
|
|
49
|
+
method: string;
|
|
50
|
+
path: string;
|
|
51
|
+
handler: string;
|
|
52
|
+
config: {
|
|
53
|
+
policies: (string | {
|
|
54
|
+
name: string;
|
|
55
|
+
config: {
|
|
56
|
+
actions: string[];
|
|
57
|
+
};
|
|
58
|
+
})[];
|
|
59
|
+
};
|
|
60
|
+
}[];
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
services: {
|
|
64
|
+
service: ({ strapi }: {
|
|
65
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
66
|
+
}) => import("./types/cache.types").CacheService;
|
|
67
|
+
};
|
|
68
|
+
contentTypes: {};
|
|
69
|
+
policies: {};
|
|
70
|
+
middlewares: {
|
|
71
|
+
graphql: (ctx: any, next: any) => Promise<void>;
|
|
72
|
+
cache: (ctx: import("koa").Context, next: any) => Promise<void>;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const routes: {
|
|
2
|
+
'purge-route': {
|
|
3
|
+
type: string;
|
|
4
|
+
routes: {
|
|
5
|
+
method: string;
|
|
6
|
+
path: string;
|
|
7
|
+
handler: string;
|
|
8
|
+
config: {
|
|
9
|
+
policies: (string | {
|
|
10
|
+
name: string;
|
|
11
|
+
config: {
|
|
12
|
+
actions: string[];
|
|
13
|
+
};
|
|
14
|
+
})[];
|
|
15
|
+
};
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default routes;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Core } from '@strapi/strapi';
|
|
2
|
+
import { CacheProvider } from '../../types/cache.types';
|
|
3
|
+
export declare class InMemoryCacheProvider implements CacheProvider {
|
|
4
|
+
private strapi;
|
|
5
|
+
private initialized;
|
|
6
|
+
private provider;
|
|
7
|
+
private cacheGetTimeoutInMs;
|
|
8
|
+
constructor(strapi: Core.Strapi);
|
|
9
|
+
init(): void;
|
|
10
|
+
get ready(): boolean;
|
|
11
|
+
get(key: string): Promise<any | null>;
|
|
12
|
+
set(key: string, val: any): Promise<any | null>;
|
|
13
|
+
del(key: string): Promise<any | null>;
|
|
14
|
+
keys(): Promise<string[] | null>;
|
|
15
|
+
reset(): Promise<any | null>;
|
|
16
|
+
clearByRegexp(regExps: RegExp[]): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Core } from '@strapi/strapi';
|
|
2
|
+
import { CacheProvider } from '../../types/cache.types';
|
|
3
|
+
export declare class RedisCacheProvider implements CacheProvider {
|
|
4
|
+
private strapi;
|
|
5
|
+
private initialized;
|
|
6
|
+
private client;
|
|
7
|
+
private cacheGetTimeoutInMs;
|
|
8
|
+
private keyPrefix;
|
|
9
|
+
constructor(strapi: Core.Strapi);
|
|
10
|
+
init(): void;
|
|
11
|
+
get ready(): boolean;
|
|
12
|
+
get(key: string): Promise<any | null>;
|
|
13
|
+
set(key: string, val: any): Promise<any | null>;
|
|
14
|
+
del(key: string): Promise<any | null>;
|
|
15
|
+
keys(): Promise<string[] | null>;
|
|
16
|
+
reset(): Promise<any | null>;
|
|
17
|
+
clearByRegexp(regExps: RegExp[]): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LRUCache } from 'lru-cache';
|
|
2
|
+
export interface CacheProvider {
|
|
3
|
+
init(): void;
|
|
4
|
+
get(key: string): Promise<any | null>;
|
|
5
|
+
set(key: string, val: any): Promise<any | null>;
|
|
6
|
+
del(key: string): Promise<any | null>;
|
|
7
|
+
keys(): Promise<string[] | null>;
|
|
8
|
+
reset(): Promise<any | null>;
|
|
9
|
+
readonly ready: boolean;
|
|
10
|
+
clearByRegexp(regExps: RegExp[]): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface CacheService {
|
|
13
|
+
getCacheInstance(): CacheProvider;
|
|
14
|
+
}
|
|
15
|
+
export interface CacheInstance {
|
|
16
|
+
initialized: boolean;
|
|
17
|
+
provider: LRUCache<string, any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { Stream } from 'stream';
|
|
5
|
+
export declare const streamToBuffer: (stream: Stream) => Promise<Buffer>;
|
|
6
|
+
export declare const decompressBuffer: (buffer: Buffer, encoding?: string) => Promise<Buffer>;
|
|
7
|
+
export declare const decodeBufferToText: (buffer: Buffer) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Context } from 'koa';
|
|
3
|
+
import { OutgoingHttpHeaders } from 'http';
|
|
4
|
+
export declare function getHeadersToStore(ctx: Context, cacheHeaders: boolean, cacheHeadersAllowList?: string[], cacheHeadersDenyList?: string[]): OutgoingHttpHeaders | null;
|
|
5
|
+
export declare function getCacheHeaderConfig(): {
|
|
6
|
+
cacheHeaders: boolean;
|
|
7
|
+
cacheHeadersDenyList: string[];
|
|
8
|
+
cacheHeadersAllowList: string[];
|
|
9
|
+
cacheAuthorizedRequests: boolean;
|
|
10
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Core } from '@strapi/strapi';
|
|
2
|
+
import { CacheProvider } from 'src/types/cache.types';
|
|
3
|
+
export declare function invalidateCache(event: any, cacheStore: CacheProvider, strapi: Core.Strapi): Promise<void>;
|
|
4
|
+
export declare function invalidateGraphqlCache(cacheStore: CacheProvider): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const withTimeout: (callback: () => Promise<any>, ms: number) => Promise<any>;
|
package/package.json
CHANGED