@acmekit/caching 2.13.1
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/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/loaders/hash.d.ts +5 -0
- package/dist/loaders/hash.d.ts.map +1 -0
- package/dist/loaders/hash.js +9 -0
- package/dist/loaders/hash.js.map +1 -0
- package/dist/loaders/providers.d.ts +5 -0
- package/dist/loaders/providers.d.ts.map +1 -0
- package/dist/loaders/providers.js +64 -0
- package/dist/loaders/providers.js.map +1 -0
- package/dist/providers/memory-cache.d.ts +45 -0
- package/dist/providers/memory-cache.d.ts.map +1 -0
- package/dist/providers/memory-cache.js +205 -0
- package/dist/providers/memory-cache.js.map +1 -0
- package/dist/services/cache-module.d.ts +90 -0
- package/dist/services/cache-module.d.ts.map +1 -0
- package/dist/services/cache-module.js +204 -0
- package/dist/services/cache-module.js.map +1 -0
- package/dist/services/cache-provider.d.ts +13 -0
- package/dist/services/cache-provider.d.ts.map +1 -0
- package/dist/services/cache-provider.js +53 -0
- package/dist/services/cache-provider.js.map +1 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +11 -0
- package/dist/services/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +82 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/parser.d.ts +44 -0
- package/dist/utils/parser.d.ts.map +1 -0
- package/dist/utils/parser.js +161 -0
- package/dist/utils/parser.js.map +1 -0
- package/dist/utils/strategy.d.ts +17 -0
- package/dist/utils/strategy.d.ts.map +1 -0
- package/dist/utils/strategy.js +98 -0
- package/dist/utils/strategy.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const modules_sdk_1 = require("@acmekit/framework/modules-sdk");
|
|
4
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
5
|
+
const _types_1 = require("../types");
|
|
6
|
+
const ONE_HOUR_IN_SECOND = 60 * 60;
|
|
7
|
+
class CachingModuleService {
|
|
8
|
+
constructor(container, moduleDeclaration) {
|
|
9
|
+
this.moduleDeclaration = moduleDeclaration;
|
|
10
|
+
this.ongoingRequests = new Map();
|
|
11
|
+
this.__hooks = {
|
|
12
|
+
onApplicationStart: async () => {
|
|
13
|
+
this.onApplicationStart();
|
|
14
|
+
},
|
|
15
|
+
onApplicationShutdown: async () => {
|
|
16
|
+
this.onApplicationShutdown();
|
|
17
|
+
},
|
|
18
|
+
onApplicationPrepareShutdown: async () => {
|
|
19
|
+
this.onApplicationPrepareShutdown();
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
this.container = container;
|
|
23
|
+
this.providerService = container.cacheProviderService;
|
|
24
|
+
this.defaultProviderId = container[_types_1.CachingDefaultProvider];
|
|
25
|
+
this.strategyCtr = container.strategy;
|
|
26
|
+
this.strategy = new this.strategyCtr(this.container, this);
|
|
27
|
+
const moduleOptions = "options" in moduleDeclaration
|
|
28
|
+
? moduleDeclaration.options
|
|
29
|
+
: moduleDeclaration;
|
|
30
|
+
this.ttl = moduleOptions.ttl ?? ONE_HOUR_IN_SECOND;
|
|
31
|
+
this.logger = container.logger ?? console;
|
|
32
|
+
}
|
|
33
|
+
onApplicationStart() {
|
|
34
|
+
const loadedSchema = modules_sdk_1.AcmeKitModule.getAllJoinerConfigs()
|
|
35
|
+
.map((joinerConfig) => joinerConfig?.schema ?? "")
|
|
36
|
+
.join("\n");
|
|
37
|
+
const defaultAcmeKitSchema = `
|
|
38
|
+
scalar DateTime
|
|
39
|
+
scalar JSON
|
|
40
|
+
directive @enumValue(value: String) on ENUM_VALUE
|
|
41
|
+
`;
|
|
42
|
+
const { schema: cleanedSchema } = utils_1.GraphQLUtils.cleanGraphQLSchema(defaultAcmeKitSchema + loadedSchema);
|
|
43
|
+
const mergedSchema = utils_1.GraphQLUtils.mergeTypeDefs(cleanedSchema);
|
|
44
|
+
const schema = utils_1.GraphQLUtils.makeExecutableSchema({
|
|
45
|
+
typeDefs: mergedSchema,
|
|
46
|
+
});
|
|
47
|
+
this.strategy.onApplicationStart?.(schema, modules_sdk_1.AcmeKitModule.getAllJoinerConfigs());
|
|
48
|
+
}
|
|
49
|
+
onApplicationShutdown() {
|
|
50
|
+
this.strategy.onApplicationShutdown?.();
|
|
51
|
+
}
|
|
52
|
+
onApplicationPrepareShutdown() {
|
|
53
|
+
this.strategy.onApplicationPrepareShutdown?.();
|
|
54
|
+
}
|
|
55
|
+
static normalizeProviders(providers) {
|
|
56
|
+
const providers_ = Array.isArray(providers) ? providers : [providers];
|
|
57
|
+
return providers_.map((provider) => {
|
|
58
|
+
return typeof provider === "string" ? { id: provider } : provider;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
getRequestKey(key, tags, providers) {
|
|
62
|
+
const keyPart = key || "";
|
|
63
|
+
const tagsPart = tags?.sort().join(",") || "";
|
|
64
|
+
const providersPart = providers?.join(",") || this.defaultProviderId;
|
|
65
|
+
return `${keyPart}|${tagsPart}|${providersPart}`;
|
|
66
|
+
}
|
|
67
|
+
getClearRequestKey(key, tags, providers) {
|
|
68
|
+
const keyPart = key || "";
|
|
69
|
+
const tagsPart = tags?.sort().join(",") || "";
|
|
70
|
+
const providersPart = providers?.join(",") || this.defaultProviderId;
|
|
71
|
+
return `clear:${keyPart}|${tagsPart}|${providersPart}`;
|
|
72
|
+
}
|
|
73
|
+
async get(options) {
|
|
74
|
+
if (CachingModuleService.traceGet) {
|
|
75
|
+
return await CachingModuleService.traceGet(() => this.get_(options), options.key ?? "", options.tags ?? []);
|
|
76
|
+
}
|
|
77
|
+
return await this.get_(options);
|
|
78
|
+
}
|
|
79
|
+
async get_({ key, tags, providers, }) {
|
|
80
|
+
if (!key && !tags) {
|
|
81
|
+
throw new utils_1.AcmeKitError(utils_1.AcmeKitError.Types.INVALID_ARGUMENT, "Either key or tags must be provided");
|
|
82
|
+
}
|
|
83
|
+
const requestKey = this.getRequestKey(key, tags, providers);
|
|
84
|
+
const existingRequest = this.ongoingRequests.get(requestKey);
|
|
85
|
+
if (existingRequest) {
|
|
86
|
+
return await existingRequest;
|
|
87
|
+
}
|
|
88
|
+
const requestPromise = this.performCacheGet(key, tags, providers);
|
|
89
|
+
this.ongoingRequests.set(requestKey, requestPromise);
|
|
90
|
+
try {
|
|
91
|
+
const result = await requestPromise;
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
// Clean up the completed request
|
|
96
|
+
this.ongoingRequests.delete(requestKey);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async performCacheGet(key, tags, providers) {
|
|
100
|
+
const providersToCheck = providers ?? [this.defaultProviderId];
|
|
101
|
+
for (const providerId of providersToCheck) {
|
|
102
|
+
try {
|
|
103
|
+
const provider_ = this.providerService.retrieveProvider(providerId);
|
|
104
|
+
const result = await provider_.get({ key, tags });
|
|
105
|
+
if (result != null) {
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
this.logger.warn(`Cache provider ${providerId} failed: ${error.message}\n${error.stack}`);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
async set(options) {
|
|
117
|
+
if (CachingModuleService.traceSet) {
|
|
118
|
+
return await CachingModuleService.traceSet(() => this.set_(options), options.key, options.tags ?? [], options.options ?? {});
|
|
119
|
+
}
|
|
120
|
+
return await this.set_(options);
|
|
121
|
+
}
|
|
122
|
+
async set_({ key, data, ttl, tags, providers, options, }) {
|
|
123
|
+
if (!key) {
|
|
124
|
+
throw new utils_1.AcmeKitError(utils_1.AcmeKitError.Types.INVALID_ARGUMENT, "[CachingModuleService] Key must be provided");
|
|
125
|
+
}
|
|
126
|
+
const key_ = key;
|
|
127
|
+
const tags_ = tags ?? (await this.strategy.computeTags(data));
|
|
128
|
+
let providers_ = [
|
|
129
|
+
this.defaultProviderId,
|
|
130
|
+
];
|
|
131
|
+
providers_ = CachingModuleService.normalizeProviders(providers ?? providers_);
|
|
132
|
+
const providerIds = providers_.map((p) => p.id);
|
|
133
|
+
const requestKey = this.getRequestKey(key_, tags_, providerIds);
|
|
134
|
+
const existingRequest = this.ongoingRequests.get(requestKey);
|
|
135
|
+
if (existingRequest) {
|
|
136
|
+
return await existingRequest;
|
|
137
|
+
}
|
|
138
|
+
const requestPromise = this.performCacheSet(key_, tags_, data, ttl, providers_, options);
|
|
139
|
+
this.ongoingRequests.set(requestKey, requestPromise);
|
|
140
|
+
try {
|
|
141
|
+
await requestPromise;
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
// Clean up the completed request
|
|
145
|
+
this.ongoingRequests.delete(requestKey);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async performCacheSet(key, tags, data, ttl, providers, options) {
|
|
149
|
+
for (const providerOptions of providers || []) {
|
|
150
|
+
const ttl_ = providerOptions.ttl ?? ttl ?? this.ttl;
|
|
151
|
+
const provider = this.providerService.retrieveProvider(providerOptions.id);
|
|
152
|
+
void provider.set({
|
|
153
|
+
key,
|
|
154
|
+
tags,
|
|
155
|
+
data,
|
|
156
|
+
ttl: ttl_,
|
|
157
|
+
options,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async clear(options) {
|
|
162
|
+
if (CachingModuleService.traceClear) {
|
|
163
|
+
return await CachingModuleService.traceClear(() => this.clear_(options), options.key ?? "", options.tags ?? [], options.options ?? {});
|
|
164
|
+
}
|
|
165
|
+
return await this.clear_(options);
|
|
166
|
+
}
|
|
167
|
+
async clear_({ key, tags, options, providers, }) {
|
|
168
|
+
if (!key && !tags) {
|
|
169
|
+
throw new utils_1.AcmeKitError(utils_1.AcmeKitError.Types.INVALID_ARGUMENT, "Either key or tags must be provided");
|
|
170
|
+
}
|
|
171
|
+
const requestKey = this.getClearRequestKey(key, tags, providers);
|
|
172
|
+
const existingRequest = this.ongoingRequests.get(requestKey);
|
|
173
|
+
if (existingRequest) {
|
|
174
|
+
return await existingRequest;
|
|
175
|
+
}
|
|
176
|
+
const requestPromise = this.performCacheClear(key, tags, options, providers);
|
|
177
|
+
this.ongoingRequests.set(requestKey, requestPromise);
|
|
178
|
+
try {
|
|
179
|
+
await requestPromise;
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
// Clean up the completed request
|
|
183
|
+
this.ongoingRequests.delete(requestKey);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async performCacheClear(key, tags, options, providers) {
|
|
187
|
+
let providerIds_ = [this.defaultProviderId];
|
|
188
|
+
if (providers) {
|
|
189
|
+
providerIds_ = Array.isArray(providers) ? providers : [providers];
|
|
190
|
+
}
|
|
191
|
+
for (const providerId of providerIds_) {
|
|
192
|
+
const provider = this.providerService.retrieveProvider(providerId);
|
|
193
|
+
void provider.clear({ key, tags, options });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async computeKey(input) {
|
|
197
|
+
return await this.strategy.computeKey(input);
|
|
198
|
+
}
|
|
199
|
+
async computeTags(input, options) {
|
|
200
|
+
return await this.strategy.computeTags(input, options);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
exports.default = CachingModuleService;
|
|
204
|
+
//# sourceMappingURL=cache-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-module.js","sourceRoot":"","sources":["../../src/services/cache-module.ts"],"names":[],"mappings":";;AAAA,gEAA8D;AAM9D,oDAAqE;AACrE,mCAAqE;AAGrE,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,CAAA;AAElC,MAAqB,oBAAoB;IAgCvC,YAC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K,CAAC,UAAU,CAAC,KAAa;QAC5B,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAC9C,CAAC;IAED,KAAK,CAAC,WAAW,CACf,KAAa,EACb,OAA6B;QAE7B,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACxD,CAAC;CACF;AAzYD,uCAyYC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Constructor, ICachingProviderService, Logger } from "@acmekit/framework/types";
|
|
2
|
+
type InjectedDependencies = {
|
|
3
|
+
[key: `cp_${string}`]: ICachingProviderService;
|
|
4
|
+
logger?: Logger;
|
|
5
|
+
};
|
|
6
|
+
export default class CacheProviderService {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(container: InjectedDependencies);
|
|
9
|
+
static getRegistrationIdentifier(providerClass: Constructor<ICachingProviderService>): string;
|
|
10
|
+
retrieveProvider(providerId: string): ICachingProviderService;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=cache-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-provider.d.ts","sourceRoot":"","sources":["../../src/services/cache-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,MAAM,EACP,MAAM,0BAA0B,CAAA;AAIjC,KAAK,oBAAoB,GAAG;IAC1B,CAAC,GAAG,EAAE,MAAM,MAAM,EAAE,GAAG,uBAAuB,CAAA;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,oBAAoB;;gBAI3B,SAAS,EAAE,oBAAoB;IAO3C,MAAM,CAAC,yBAAyB,CAC9B,aAAa,EAAE,WAAW,CAAC,uBAAuB,CAAC;IAW9C,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,uBAAuB;CAuBrE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _CacheProviderService_container, _CacheProviderService_logger;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
16
|
+
const types_1 = require("../types");
|
|
17
|
+
class CacheProviderService {
|
|
18
|
+
constructor(container) {
|
|
19
|
+
_CacheProviderService_container.set(this, void 0);
|
|
20
|
+
_CacheProviderService_logger.set(this, void 0);
|
|
21
|
+
__classPrivateFieldSet(this, _CacheProviderService_container, container, "f");
|
|
22
|
+
__classPrivateFieldSet(this, _CacheProviderService_logger, container["logger"]
|
|
23
|
+
? container.logger
|
|
24
|
+
: console, "f");
|
|
25
|
+
}
|
|
26
|
+
static getRegistrationIdentifier(providerClass) {
|
|
27
|
+
if (!providerClass.identifier) {
|
|
28
|
+
throw new utils_1.AcmeKitError(utils_1.AcmeKitError.Types.INVALID_ARGUMENT, `Trying to register a caching provider without an identifier.`);
|
|
29
|
+
}
|
|
30
|
+
return `${providerClass.identifier}`;
|
|
31
|
+
}
|
|
32
|
+
retrieveProvider(providerId) {
|
|
33
|
+
try {
|
|
34
|
+
return __classPrivateFieldGet(this, _CacheProviderService_container, "f")[`${types_1.CachingProviderRegistrationPrefix}${providerId}`];
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
if (err.name === "AwilixResolutionError") {
|
|
38
|
+
const errMessage = `
|
|
39
|
+
Unable to retrieve the caching provider with id: ${providerId}
|
|
40
|
+
Please make sure that the provider is registered in the container and it is configured correctly in your project configuration file.`;
|
|
41
|
+
// Log full error for debugging
|
|
42
|
+
__classPrivateFieldGet(this, _CacheProviderService_logger, "f").error(`AwilixResolutionError: ${err.message}`, err);
|
|
43
|
+
throw new Error(errMessage);
|
|
44
|
+
}
|
|
45
|
+
const errMessage = `Unable to retrieve the caching provider with id: ${providerId}, the following error occurred: ${err.message}`;
|
|
46
|
+
__classPrivateFieldGet(this, _CacheProviderService_logger, "f").error(errMessage);
|
|
47
|
+
throw new Error(errMessage);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
_CacheProviderService_container = new WeakMap(), _CacheProviderService_logger = new WeakMap();
|
|
52
|
+
exports.default = CacheProviderService;
|
|
53
|
+
//# sourceMappingURL=cache-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-provider.js","sourceRoot":"","sources":["../../src/services/cache-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAKA,oDAAuD;AACvD,oCAA4D;AAO5D,MAAqB,oBAAoB;IAIvC,YAAY,SAA+B;QAH3C,kDAAgC;QAChC,+CAAe;QAGb,uBAAA,IAAI,mCAAc,SAAS,MAAA,CAAA;QAC3B,uBAAA,IAAI,gCAAW,SAAS,CAAC,QAAQ,CAAC;YAChC,CAAC,CAAC,SAAS,CAAC,MAAM;YAClB,CAAC,CAAE,OAA6B,MAAA,CAAA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1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CachingProviderService = exports.CachingModuleService = void 0;
|
|
7
|
+
var cache_module_1 = require("./cache-module");
|
|
8
|
+
Object.defineProperty(exports, "CachingModuleService", { enumerable: true, get: function () { return __importDefault(cache_module_1).default; } });
|
|
9
|
+
var cache_provider_1 = require("./cache-provider");
|
|
10
|
+
Object.defineProperty(exports, "CachingProviderService", { enumerable: true, get: function () { return __importDefault(cache_provider_1).default; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAgE;AAAvD,qIAAA,OAAO,OAAwB;AACxC,mDAAoE;AAA3D,yIAAA,OAAO,OAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/index.ts","../src/loaders/hash.ts","../src/loaders/providers.ts","../src/providers/memory-cache.ts","../src/services/cache-module.ts","../src/services/cache-provider.ts","../src/services/index.ts","../src/types/index.ts","../src/utils/parser.ts","../src/utils/strategy.ts","../src/utils/__tests__/parser.test.ts"],"version":"5.9.3"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Constructor, ICachingStrategy, IEventBusModuleService, Logger, ModuleProviderExports, ModuleServiceInitializeOptions } from "@acmekit/framework/types";
|
|
2
|
+
import { Modules } from "@acmekit/framework/utils";
|
|
3
|
+
import { default as CacheProviderService } from "../services/cache-provider";
|
|
4
|
+
export declare const CachingDefaultProvider = "default_provider";
|
|
5
|
+
export declare const CachingIdentifiersRegistrationName = "caching_providers_identifier";
|
|
6
|
+
export declare const CachingProviderRegistrationPrefix = "lp_";
|
|
7
|
+
export type InjectedDependencies = {
|
|
8
|
+
cacheProviderService: CacheProviderService;
|
|
9
|
+
hasher: (data: string) => string;
|
|
10
|
+
logger?: Logger;
|
|
11
|
+
strategy: Constructor<ICachingStrategy>;
|
|
12
|
+
[CachingDefaultProvider]: string;
|
|
13
|
+
[Modules.EVENT_BUS]: IEventBusModuleService;
|
|
14
|
+
};
|
|
15
|
+
export interface MemoryCacheModuleOptions {
|
|
16
|
+
/**
|
|
17
|
+
* TTL in seconds
|
|
18
|
+
*/
|
|
19
|
+
ttl?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Maximum number of keys to store (see node-cache documentation)
|
|
22
|
+
*/
|
|
23
|
+
maxKeys?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Check period for expired keys in seconds (see node-cache documentation)
|
|
26
|
+
*/
|
|
27
|
+
checkPeriod?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Use clones for cached data (see node-cache documentation)
|
|
30
|
+
*/
|
|
31
|
+
useClones?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum size of the cache in bytes (default 300MB).
|
|
34
|
+
* It is an approximation, if a new entry will make the limit exceeded, the entry will be cached
|
|
35
|
+
* but not the following ones
|
|
36
|
+
*/
|
|
37
|
+
maxSize?: number;
|
|
38
|
+
}
|
|
39
|
+
export type CachingModuleOptions = Partial<ModuleServiceInitializeOptions> & {
|
|
40
|
+
/**
|
|
41
|
+
* The strategy to be used. Default to the inbuilt default strategy.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Time to keep data in cache (in seconds)
|
|
45
|
+
*/
|
|
46
|
+
ttl?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Enable and configure the built in memory cache
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
in_memory?: MemoryCacheModuleOptions & {
|
|
52
|
+
enable?: boolean;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Providers to be registered
|
|
56
|
+
*/
|
|
57
|
+
providers?: {
|
|
58
|
+
/**
|
|
59
|
+
* The module provider to be registered
|
|
60
|
+
*/
|
|
61
|
+
resolve: string | ModuleProviderExports;
|
|
62
|
+
/**
|
|
63
|
+
* If the provider is the default
|
|
64
|
+
*/
|
|
65
|
+
is_default?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* The id of the provider
|
|
68
|
+
*/
|
|
69
|
+
id: string;
|
|
70
|
+
/**
|
|
71
|
+
* key value pair of the configuration to be passed to the provider constructor
|
|
72
|
+
*/
|
|
73
|
+
options?: Record<string, unknown>;
|
|
74
|
+
}[];
|
|
75
|
+
};
|
|
76
|
+
declare module "@acmekit/types" {
|
|
77
|
+
interface ModuleOptions {
|
|
78
|
+
"@acmekit/caching": CachingModuleOptions;
|
|
79
|
+
"@acmekit/acmekit/caching": CachingModuleOptions;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,MAAM,EACN,qBAAqB,EACrB,8BAA8B,EAC/B,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAE5E,eAAO,MAAM,sBAAsB,qBAAqB,CAAA;AACxD,eAAO,MAAM,kCAAkC,iCAAiC,CAAA;AAEhF,eAAO,MAAM,iCAAiC,QAAQ,CAAA;AAEtD,MAAM,MAAM,oBAAoB,GAAG;IACjC,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAA;IACvC,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAChC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,sBAAsB,CAAA;CAC5C,CAAA;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,8BAA8B,CAAC,GAAG;IAC3E;;OAEG;IAEH;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,SAAS,CAAC,EAAE,wBAAwB,GAAG;QACrC,MAAM,CAAC,EAAE,OAAO,CAAA;KACjB,CAAA;IAED;;OAEG;IACH,SAAS,CAAC,EAAE;QACV;;WAEG;QACH,OAAO,EAAE,MAAM,GAAG,qBAAqB,CAAA;QACvC;;WAEG;QACH,UAAU,CAAC,EAAE,OAAO,CAAA;QACpB;;WAEG;QACH,EAAE,EAAE,MAAM,CAAA;QACV;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAClC,EAAE,CAAA;CACJ,CAAA;AAED,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,aAAa;QACrB,kBAAkB,EAAE,oBAAoB,CAAA;QACxC,0BAA0B,EAAE,oBAAoB,CAAA;KACjD;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CachingProviderRegistrationPrefix = exports.CachingIdentifiersRegistrationName = exports.CachingDefaultProvider = void 0;
|
|
4
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
5
|
+
exports.CachingDefaultProvider = "default_provider";
|
|
6
|
+
exports.CachingIdentifiersRegistrationName = "caching_providers_identifier";
|
|
7
|
+
exports.CachingProviderRegistrationPrefix = "lp_";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAQA,oDAAkD;AAGrC,QAAA,sBAAsB,GAAG,kBAAkB,CAAA;AAC3C,QAAA,kCAAkC,GAAG,8BAA8B,CAAA;AAEnE,QAAA,iCAAiC,GAAG,KAAK,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ModuleJoinerConfig } from "@acmekit/framework/types";
|
|
2
|
+
import { GraphQLSchema } from "graphql";
|
|
3
|
+
export interface EntityReference {
|
|
4
|
+
type: string;
|
|
5
|
+
id: string | number;
|
|
6
|
+
field?: string;
|
|
7
|
+
isInArray?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface InvalidationEvent {
|
|
10
|
+
entityType: string;
|
|
11
|
+
entityId: string | number;
|
|
12
|
+
relatedEntities: EntityReference[];
|
|
13
|
+
cacheKeys: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare class CacheInvalidationParser {
|
|
16
|
+
private typeMap;
|
|
17
|
+
private idPrefixToEntityName;
|
|
18
|
+
constructor(schema: GraphQLSchema, joinerConfigs: ModuleJoinerConfig[]);
|
|
19
|
+
/**
|
|
20
|
+
* Parse an object to identify entities and their relationships
|
|
21
|
+
*/
|
|
22
|
+
parseObjectForEntities(obj: any, parentType?: string, isInArray?: boolean): EntityReference[];
|
|
23
|
+
/**
|
|
24
|
+
* Detect entity type based on object structure and GraphQL type map
|
|
25
|
+
*/
|
|
26
|
+
private detectEntityType;
|
|
27
|
+
/**
|
|
28
|
+
* Check if object structure matches GraphQL type fields
|
|
29
|
+
*/
|
|
30
|
+
private objectMatchesType;
|
|
31
|
+
/**
|
|
32
|
+
* Get the expected type for a relationship field
|
|
33
|
+
*/
|
|
34
|
+
private getRelationshipType;
|
|
35
|
+
/**
|
|
36
|
+
* Build invalidation events based on parsed entities
|
|
37
|
+
*/
|
|
38
|
+
buildInvalidationEvents(entities: EntityReference[], operation?: "created" | "updated" | "deleted"): InvalidationEvent[];
|
|
39
|
+
/**
|
|
40
|
+
* Build list of cache keys that should be invalidated
|
|
41
|
+
*/
|
|
42
|
+
private buildAffectedCacheKeys;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/utils/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,EAEL,aAAa,EAId,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,eAAe,EAAE,eAAe,EAAE,CAAA;IAClC,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,qBAAa,uBAAuB;IAClC,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,oBAAoB,CAAwB;gBAExC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE;IAwBtE;;OAEG;IACH,sBAAsB,CACpB,GAAG,EAAE,GAAG,EACR,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,GAAE,OAAe,GACzB,eAAe,EAAE;IA6CpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAyBxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAmC3B;;OAEG;IACH,uBAAuB,CACrB,QAAQ,EAAE,eAAe,EAAE,EAC3B,SAAS,GAAE,SAAS,GAAG,SAAS,GAAG,SAAqB,GACvD,iBAAiB,EAAE;IA6BtB;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAgB/B"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CacheInvalidationParser = void 0;
|
|
4
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
|
+
class CacheInvalidationParser {
|
|
7
|
+
constructor(schema, joinerConfigs) {
|
|
8
|
+
this.typeMap = new Map();
|
|
9
|
+
// Build type map for quick lookups
|
|
10
|
+
const schemaTypeMap = schema.getTypeMap();
|
|
11
|
+
Object.keys(schemaTypeMap).forEach((typeName) => {
|
|
12
|
+
const type = schemaTypeMap[typeName];
|
|
13
|
+
if ((0, graphql_1.isObjectType)(type) && !typeName.startsWith("__")) {
|
|
14
|
+
this.typeMap.set(typeName, type);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
this.idPrefixToEntityName = joinerConfigs.reduce((acc, joinerConfig) => {
|
|
18
|
+
if (joinerConfig.idPrefixToEntityName) {
|
|
19
|
+
Object.entries(joinerConfig.idPrefixToEntityName).forEach(([idPrefix, entityName]) => {
|
|
20
|
+
acc[idPrefix] = entityName;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return acc;
|
|
24
|
+
}, {});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parse an object to identify entities and their relationships
|
|
28
|
+
*/
|
|
29
|
+
parseObjectForEntities(obj, parentType, isInArray = false) {
|
|
30
|
+
const entities = [];
|
|
31
|
+
if (!obj || typeof obj !== "object") {
|
|
32
|
+
return entities;
|
|
33
|
+
}
|
|
34
|
+
// Check if this object matches any known GraphQL types
|
|
35
|
+
const detectedType = this.detectEntityType(obj, parentType);
|
|
36
|
+
if (detectedType && obj.id) {
|
|
37
|
+
entities.push({
|
|
38
|
+
type: detectedType,
|
|
39
|
+
id: obj.id,
|
|
40
|
+
isInArray,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// Recursively parse nested objects and arrays
|
|
44
|
+
Object.keys(obj).forEach((key) => {
|
|
45
|
+
const value = obj[key];
|
|
46
|
+
if (Array.isArray(value)) {
|
|
47
|
+
value.forEach((item) => {
|
|
48
|
+
entities.push(...this.parseObjectForEntities(item, this.getRelationshipType(detectedType, key), true));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else if ((0, utils_1.isObject)(value)) {
|
|
52
|
+
entities.push(...this.parseObjectForEntities(value, this.getRelationshipType(detectedType, key), false));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return entities;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Detect entity type based on object structure and GraphQL type map
|
|
59
|
+
*/
|
|
60
|
+
detectEntityType(obj, suggestedType) {
|
|
61
|
+
if (obj.id) {
|
|
62
|
+
const idParts = obj.id.split("_");
|
|
63
|
+
if (idParts.length > 1 && this.idPrefixToEntityName[idParts[0]]) {
|
|
64
|
+
return this.idPrefixToEntityName[idParts[0]];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (suggestedType && this.typeMap.has(suggestedType)) {
|
|
68
|
+
const type = this.typeMap.get(suggestedType);
|
|
69
|
+
if (this.objectMatchesType(obj, type)) {
|
|
70
|
+
return suggestedType;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Try to match against all known types
|
|
74
|
+
for (const [typeName, type] of this.typeMap) {
|
|
75
|
+
if (this.objectMatchesType(obj, type)) {
|
|
76
|
+
return typeName;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if object structure matches GraphQL type fields
|
|
83
|
+
*/
|
|
84
|
+
objectMatchesType(obj, type) {
|
|
85
|
+
const fields = type.getFields();
|
|
86
|
+
const objKeys = Object.keys(obj);
|
|
87
|
+
// Must have id field for entities
|
|
88
|
+
if (!obj.id || !fields.id) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
// Check if at least 50% of non-null object fields match type fields
|
|
92
|
+
const matchingFields = objKeys.filter((key) => fields[key]).length;
|
|
93
|
+
return matchingFields >= Math.max(1, objKeys.length * 0.5);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get the expected type for a relationship field
|
|
97
|
+
*/
|
|
98
|
+
getRelationshipType(parentType, fieldName) {
|
|
99
|
+
if (!parentType || !this.typeMap.has(parentType)) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
const type = this.typeMap.get(parentType);
|
|
103
|
+
const field = type.getFields()[fieldName];
|
|
104
|
+
if (!field) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
let fieldType = field.type;
|
|
108
|
+
// Unwrap NonNull and List wrappers
|
|
109
|
+
if ((0, graphql_1.isNonNullType)(fieldType)) {
|
|
110
|
+
fieldType = fieldType.ofType;
|
|
111
|
+
}
|
|
112
|
+
if ((0, graphql_1.isListType)(fieldType)) {
|
|
113
|
+
fieldType = fieldType.ofType;
|
|
114
|
+
}
|
|
115
|
+
if ((0, graphql_1.isNonNullType)(fieldType)) {
|
|
116
|
+
fieldType = fieldType.ofType;
|
|
117
|
+
}
|
|
118
|
+
if ((0, graphql_1.isObjectType)(fieldType)) {
|
|
119
|
+
return fieldType.name;
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Build invalidation events based on parsed entities
|
|
125
|
+
*/
|
|
126
|
+
buildInvalidationEvents(entities, operation = "updated") {
|
|
127
|
+
const events = [];
|
|
128
|
+
const processedEntities = new Set();
|
|
129
|
+
entities.forEach((entity) => {
|
|
130
|
+
const entityKey = `${entity.type}:${entity.id}`;
|
|
131
|
+
if (processedEntities.has(entityKey)) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
processedEntities.add(entityKey);
|
|
135
|
+
const relatedEntities = entities.filter((e) => e.type !== entity.type || e.id !== entity.id);
|
|
136
|
+
const affectedKeys = this.buildAffectedCacheKeys(entity, operation);
|
|
137
|
+
events.push({
|
|
138
|
+
entityType: entity.type,
|
|
139
|
+
entityId: entity.id,
|
|
140
|
+
relatedEntities,
|
|
141
|
+
cacheKeys: affectedKeys,
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
return events;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Build list of cache keys that should be invalidated
|
|
148
|
+
*/
|
|
149
|
+
buildAffectedCacheKeys(entity, operation = "updated") {
|
|
150
|
+
const keys = new Set();
|
|
151
|
+
keys.add(`${entity.type}:${entity.id}`);
|
|
152
|
+
// Add list key only if entity was found in an array context or if an event of type created or
|
|
153
|
+
// deleted is triggered
|
|
154
|
+
if (entity.isInArray || ["created", "deleted"].includes(operation)) {
|
|
155
|
+
keys.add(`${entity.type}:list:*`);
|
|
156
|
+
}
|
|
157
|
+
return Array.from(keys);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.CacheInvalidationParser = CacheInvalidationParser;
|
|
161
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/utils/parser.ts"],"names":[],"mappings":";;;AACA,oDAAmD;AACnD,qCAMgB;AAgBhB,MAAa,uBAAuB;IAIlC,YAAY,MAAqB,EAAE,aAAmC;QACpE,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAA;QAExB,mCAAmC;QACnC,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAA;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