@comake/skl-js-engine 1.4.3 → 1.5.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/dist/SklEngine.d.ts +9 -0
- package/dist/SklEngine.d.ts.map +1 -1
- package/dist/SklEngine.js +122 -12
- package/dist/SklEngine.js.map +1 -1
- package/dist/SklEngineOptions.d.ts +32 -0
- package/dist/SklEngineOptions.d.ts.map +1 -1
- package/dist/SklEngineOptions.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/storage/FindOptionsTypes.d.ts +4 -1
- package/dist/storage/FindOptionsTypes.d.ts.map +1 -1
- package/dist/storage/FindOptionsTypes.js.map +1 -1
- package/dist/util/ReadCacheHelper.d.ts +14 -0
- package/dist/util/ReadCacheHelper.d.ts.map +1 -0
- package/dist/util/ReadCacheHelper.js +61 -0
- package/dist/util/ReadCacheHelper.js.map +1 -0
- package/package.json +1 -1
- package/src/SklEngine.ts +150 -13
- package/src/SklEngineOptions.ts +40 -0
- package/src/index.ts +1 -0
- package/src/storage/FindOptionsTypes.ts +4 -1
- package/src/util/ReadCacheHelper.ts +64 -0
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import type { SparqlQueryAdapterOptions } from './storage/query-adapter/sparql/SparqlQueryAdapterOptions';
|
|
2
2
|
import type { Callbacks } from './util/Types';
|
|
3
|
+
export declare type ReadCacheOperation = 'find' | 'findBy' | 'findAll' | 'count';
|
|
4
|
+
export interface ReadCacheStore {
|
|
5
|
+
get: (key: string) => Promise<unknown | undefined>;
|
|
6
|
+
set: (key: string, value: unknown, ttlMs: number) => Promise<void>;
|
|
7
|
+
delete?: (key: string) => Promise<void>;
|
|
8
|
+
clear?: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export interface ReadCachePolicyInput {
|
|
11
|
+
operation: ReadCacheOperation;
|
|
12
|
+
args: readonly unknown[];
|
|
13
|
+
endpointUrl?: string;
|
|
14
|
+
namespace?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ReadCachePolicyDecision {
|
|
17
|
+
cache: boolean;
|
|
18
|
+
ttlMs?: number;
|
|
19
|
+
keyHint?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare type ReadCachePolicy = (input: ReadCachePolicyInput) => ReadCachePolicyDecision;
|
|
3
22
|
export declare type SklEngineOptions = SparqlQueryAdapterOptions & {
|
|
4
23
|
/**
|
|
5
24
|
* Callbacks to execute upon events.
|
|
@@ -22,5 +41,18 @@ export declare type SklEngineOptions = SparqlQueryAdapterOptions & {
|
|
|
22
41
|
* The path to the executor script.
|
|
23
42
|
*/
|
|
24
43
|
readonly scriptPath?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Optional read cache store used for select read operations.
|
|
46
|
+
* Cache decisions are made by readCachePolicy.
|
|
47
|
+
*/
|
|
48
|
+
readonly readCache?: ReadCacheStore;
|
|
49
|
+
/**
|
|
50
|
+
* Optional policy that decides whether a given read operation should be cached.
|
|
51
|
+
*/
|
|
52
|
+
readonly readCachePolicy?: ReadCachePolicy;
|
|
53
|
+
/**
|
|
54
|
+
* Optional namespace to scope cache keys (for example tenant/account isolation).
|
|
55
|
+
*/
|
|
56
|
+
readonly readCacheNamespace?: string;
|
|
25
57
|
};
|
|
26
58
|
//# sourceMappingURL=SklEngineOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SklEngineOptions.d.ts","sourceRoot":"","sources":["../src/SklEngineOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAC;AAC1G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,oBAAY,gBAAgB,GAAG,yBAAyB,GAAG;IACzD;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B;;OAEG;IACH,QAAQ,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;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,eAAe,GAAG,CAAC,KAAK,EAAE,oBAAoB,KAAK,uBAAuB,CAAC;AAEvF,oBAAY,gBAAgB,GAAG,yBAAyB,GAAG;IACzD;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC;IAChE;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7C,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC;IAE3C;;OAEG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SklEngineOptions.js","sourceRoot":"","sources":["../src/SklEngineOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { SparqlQueryAdapterOptions } from './storage/query-adapter/sparql/SparqlQueryAdapterOptions';\nimport type { Callbacks } from './util/Types';\n\nexport type SklEngineOptions = SparqlQueryAdapterOptions & {\n /**\n * Callbacks to execute upon events.\n */\n readonly callbacks?: Callbacks;\n /**\n * Manually defined functions which can be used in mappings.\n */\n readonly functions?: Record<string, (args: any | any[]) => any>;\n /**\n * When true, disables validation of verb parameters and return values according to schemas\n */\n readonly disableValidation?: boolean;\n /**\n * An object containing files keyed on their title that can be used in mappings.\n */\n readonly inputFiles?: Record<string, string>;\n\n readonly debugMode?: boolean;\n\n /**\n * The path to the executor script.\n */\n readonly scriptPath?: string;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"SklEngineOptions.js","sourceRoot":"","sources":["../src/SklEngineOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { SparqlQueryAdapterOptions } from './storage/query-adapter/sparql/SparqlQueryAdapterOptions';\nimport type { Callbacks } from './util/Types';\n\nexport type ReadCacheOperation = 'find' | 'findBy' | 'findAll' | 'count';\n\nexport interface ReadCacheStore {\n get: (key: string) => Promise<unknown | undefined>;\n set: (key: string, value: unknown, ttlMs: number) => Promise<void>;\n delete?: (key: string) => Promise<void>;\n clear?: () => Promise<void>;\n}\n\nexport interface ReadCachePolicyInput {\n operation: ReadCacheOperation;\n args: readonly unknown[];\n endpointUrl?: string;\n namespace?: string;\n}\n\nexport interface ReadCachePolicyDecision {\n cache: boolean;\n ttlMs?: number;\n keyHint?: string;\n}\n\nexport type ReadCachePolicy = (input: ReadCachePolicyInput) => ReadCachePolicyDecision;\n\nexport type SklEngineOptions = SparqlQueryAdapterOptions & {\n /**\n * Callbacks to execute upon events.\n */\n readonly callbacks?: Callbacks;\n /**\n * Manually defined functions which can be used in mappings.\n */\n readonly functions?: Record<string, (args: any | any[]) => any>;\n /**\n * When true, disables validation of verb parameters and return values according to schemas\n */\n readonly disableValidation?: boolean;\n /**\n * An object containing files keyed on their title that can be used in mappings.\n */\n readonly inputFiles?: Record<string, string>;\n\n readonly debugMode?: boolean;\n\n /**\n * The path to the executor script.\n */\n readonly scriptPath?: string;\n\n /**\n * Optional read cache store used for select read operations.\n * Cache decisions are made by readCachePolicy.\n */\n readonly readCache?: ReadCacheStore;\n\n /**\n * Optional policy that decides whether a given read operation should be cached.\n */\n readonly readCachePolicy?: ReadCachePolicy;\n\n /**\n * Optional namespace to scope cache keys (for example tenant/account isolation).\n */\n readonly readCacheNamespace?: string;\n};\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './hooks/types';
|
|
|
5
5
|
export * from './JsExecutor';
|
|
6
6
|
export * from './mapping/Mapper';
|
|
7
7
|
export * from './SklEngine';
|
|
8
|
+
export * from './SklEngineOptions';
|
|
8
9
|
export * from './storage/FindOperator';
|
|
9
10
|
export * from './storage/FindOptionsTypes';
|
|
10
11
|
export * from './storage/operator/And';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,WAAW,IAAI,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrF,cAAc,eAAe,CAAC;AAE9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,WAAW,IAAI,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrF,cAAc,eAAe,CAAC;AAE9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,2EAA2E,CAAC;AAC1F,cAAc,2EAA2E,CAAC;AAE1F,cAAc,mDAAmD,CAAC;AAClE,cAAc,mDAAmD,CAAC;AAClE,cAAc,oDAAoD,CAAC;AACnE,cAAc,kDAAkD,CAAC;AAEjE,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __exportStar(require("./hooks/types"), exports);
|
|
|
28
28
|
__exportStar(require("./JsExecutor"), exports);
|
|
29
29
|
__exportStar(require("./mapping/Mapper"), exports);
|
|
30
30
|
__exportStar(require("./SklEngine"), exports);
|
|
31
|
+
__exportStar(require("./SklEngineOptions"), exports);
|
|
31
32
|
// Storage
|
|
32
33
|
__exportStar(require("./storage/FindOperator"), exports);
|
|
33
34
|
__exportStar(require("./storage/FindOptionsTypes"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,UAAU;AACV,8CAA4B;AAC5B,2DAAwF;AAA/E,wHAAA,kBAAkB,OAAA;AAC3B,mDAAqF;AAA5E,uGAAA,WAAW,OAAY;AAAE,yGAAA,UAAU,OAAA;AAAE,wGAAA,SAAS,OAAA;AACvD,gDAA8B;AAC9B,gBAAgB;AAChB,+CAA6B;AAC7B,mDAAiC;AACjC,8CAA4B;AAC5B,UAAU;AACV,yDAAuC;AACvC,6DAA2C;AAC3C,yDAAuC;AACvC,8DAA4C;AAC5C,mBAAmB;AACnB,2DAAyC;AACzC,4DAA0C;AAC1C,iEAA+C;AAC/C,wEAAsD;AACtD,wDAAsC;AACtC,6DAA2C;AAC3C,iEAA+C;AAC/C,qEAAmD;AACnD,0EAAwD;AACxD,8DAA4C;AAC5C,qEAAmD;AACnD,yDAAuC;AACvC,mEAAiD;AACjD,wDAAsC;AACtC,8DAA4C;AAC5C,kEAAgD;AAChD,oEAAkD;AAClD,uEAAqD;AACrD,4GAA0F;AAC1F,4GAA0F;AAC1F,iBAAiB;AACjB,oFAAkE;AAClE,oFAAkE;AAClE,qFAAmE;AACnE,mFAAiE;AACjE,OAAO;AACP,oDAAkC;AAClC,+CAA6B;AAC7B,8CAA4B;AAC5B,6DAA2C","sourcesContent":["// Mapping\nexport * from './constants';\nexport { customCapabilities, type CustomCapabilityHandler } from './customCapabilities';\nexport { globalHooks as SklHooks, HookStages, HookTypes } from './hooks/globalHooks';\nexport * from './hooks/types';\n// Code Executor\nexport * from './JsExecutor';\nexport * from './mapping/Mapper';\nexport * from './SklEngine';\n// Storage\nexport * from './storage/FindOperator';\nexport * from './storage/FindOptionsTypes';\nexport * from './storage/operator/And';\nexport * from './storage/operator/Contains';\n// Storage/Operator\nexport * from './storage/operator/Equal';\nexport * from './storage/operator/Exists';\nexport * from './storage/operator/GreaterThan';\nexport * from './storage/operator/GreaterThanOrEqual';\nexport * from './storage/operator/In';\nexport * from './storage/operator/Inverse';\nexport * from './storage/operator/InversePath';\nexport * from './storage/operator/InverseRelation';\nexport * from './storage/operator/InverseRelationOrder';\nexport * from './storage/operator/LessThan';\nexport * from './storage/operator/LessThanOrEqual';\nexport * from './storage/operator/Not';\nexport * from './storage/operator/OneOrMorePath';\nexport * from './storage/operator/Or';\nexport * from './storage/operator/Sequence';\nexport * from './storage/operator/SequencePath';\nexport * from './storage/operator/ZeroOrMorePath';\nexport * from './storage/query-adapter/QueryAdapter';\nexport * from './storage/query-adapter/sparql/query-executor/InMemorySparqlQueryExecutor';\nexport * from './storage/query-adapter/sparql/query-executor/SparqlEndpointQueryExecutor';\n// Storage/Sparql\nexport * from './storage/query-adapter/sparql/SparqlQueryAdapter';\nexport * from './storage/query-adapter/sparql/SparqlQueryBuilder';\nexport * from './storage/query-adapter/sparql/SparqlUpdateBuilder';\nexport * from './storage/query-adapter/sparql/VariableGenerator';\n// Util\nexport * from './util/TripleUtil';\nexport * from './util/Types';\nexport * from './util/Util';\nexport * from './util/Vocabularies/helper';\n\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,UAAU;AACV,8CAA4B;AAC5B,2DAAwF;AAA/E,wHAAA,kBAAkB,OAAA;AAC3B,mDAAqF;AAA5E,uGAAA,WAAW,OAAY;AAAE,yGAAA,UAAU,OAAA;AAAE,wGAAA,SAAS,OAAA;AACvD,gDAA8B;AAC9B,gBAAgB;AAChB,+CAA6B;AAC7B,mDAAiC;AACjC,8CAA4B;AAC5B,qDAAmC;AACnC,UAAU;AACV,yDAAuC;AACvC,6DAA2C;AAC3C,yDAAuC;AACvC,8DAA4C;AAC5C,mBAAmB;AACnB,2DAAyC;AACzC,4DAA0C;AAC1C,iEAA+C;AAC/C,wEAAsD;AACtD,wDAAsC;AACtC,6DAA2C;AAC3C,iEAA+C;AAC/C,qEAAmD;AACnD,0EAAwD;AACxD,8DAA4C;AAC5C,qEAAmD;AACnD,yDAAuC;AACvC,mEAAiD;AACjD,wDAAsC;AACtC,8DAA4C;AAC5C,kEAAgD;AAChD,oEAAkD;AAClD,uEAAqD;AACrD,4GAA0F;AAC1F,4GAA0F;AAC1F,iBAAiB;AACjB,oFAAkE;AAClE,oFAAkE;AAClE,qFAAmE;AACnE,mFAAiE;AACjE,OAAO;AACP,oDAAkC;AAClC,+CAA6B;AAC7B,8CAA4B;AAC5B,6DAA2C","sourcesContent":["// Mapping\nexport * from './constants';\nexport { customCapabilities, type CustomCapabilityHandler } from './customCapabilities';\nexport { globalHooks as SklHooks, HookStages, HookTypes } from './hooks/globalHooks';\nexport * from './hooks/types';\n// Code Executor\nexport * from './JsExecutor';\nexport * from './mapping/Mapper';\nexport * from './SklEngine';\nexport * from './SklEngineOptions';\n// Storage\nexport * from './storage/FindOperator';\nexport * from './storage/FindOptionsTypes';\nexport * from './storage/operator/And';\nexport * from './storage/operator/Contains';\n// Storage/Operator\nexport * from './storage/operator/Equal';\nexport * from './storage/operator/Exists';\nexport * from './storage/operator/GreaterThan';\nexport * from './storage/operator/GreaterThanOrEqual';\nexport * from './storage/operator/In';\nexport * from './storage/operator/Inverse';\nexport * from './storage/operator/InversePath';\nexport * from './storage/operator/InverseRelation';\nexport * from './storage/operator/InverseRelationOrder';\nexport * from './storage/operator/LessThan';\nexport * from './storage/operator/LessThanOrEqual';\nexport * from './storage/operator/Not';\nexport * from './storage/operator/OneOrMorePath';\nexport * from './storage/operator/Or';\nexport * from './storage/operator/Sequence';\nexport * from './storage/operator/SequencePath';\nexport * from './storage/operator/ZeroOrMorePath';\nexport * from './storage/query-adapter/QueryAdapter';\nexport * from './storage/query-adapter/sparql/query-executor/InMemorySparqlQueryExecutor';\nexport * from './storage/query-adapter/sparql/query-executor/SparqlEndpointQueryExecutor';\n// Storage/Sparql\nexport * from './storage/query-adapter/sparql/SparqlQueryAdapter';\nexport * from './storage/query-adapter/sparql/SparqlQueryBuilder';\nexport * from './storage/query-adapter/sparql/SparqlUpdateBuilder';\nexport * from './storage/query-adapter/sparql/VariableGenerator';\n// Util\nexport * from './util/TripleUtil';\nexport * from './util/Types';\nexport * from './util/Util';\nexport * from './util/Vocabularies/helper';\n\n"]}
|
|
@@ -14,6 +14,7 @@ export interface FindOneOptions {
|
|
|
14
14
|
skipFraming?: boolean;
|
|
15
15
|
group?: Variable;
|
|
16
16
|
entitySelectVariable?: Variable;
|
|
17
|
+
bypassCache?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export declare type FindOptionsRelationsValue = boolean | FindOptionsRelations | FindOperator<InverseRelationOperatorValue, 'inverseRelation'>;
|
|
19
20
|
export declare type FindOptionsRelations = {
|
|
@@ -49,7 +50,8 @@ export interface FindOptionsWhere {
|
|
|
49
50
|
binds?: BindPattern[];
|
|
50
51
|
and?: FindOptionsWhere[];
|
|
51
52
|
or?: FindOptionsWhere[];
|
|
52
|
-
|
|
53
|
+
bypassCache?: boolean;
|
|
54
|
+
[k: string]: FindOptionsWhereField | BindPattern[] | FindOptionsWhere[] | boolean | undefined;
|
|
53
55
|
}
|
|
54
56
|
export interface SubQuery {
|
|
55
57
|
select: Variable[];
|
|
@@ -72,5 +74,6 @@ export interface FindCountOptions {
|
|
|
72
74
|
relations?: FindOptionsRelations;
|
|
73
75
|
order?: FindOptionsOrder;
|
|
74
76
|
offset?: number;
|
|
77
|
+
bypassCache?: boolean;
|
|
75
78
|
}
|
|
76
79
|
//# sourceMappingURL=FindOptionsTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FindOptionsTypes.d.ts","sourceRoot":"","sources":["../../src/storage/FindOptionsTypes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,4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AAC;IACzB,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FindOptionsTypes.js","sourceRoot":"","sources":["../../src/storage/FindOptionsTypes.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { Expression, Variable } from 'sparqljs';\nimport type { OrArray, JSONArray, JSONObject } from '../util/Types';\nimport type { FindOperator } from './FindOperator';\nimport type { InverseRelationOperatorValue } from './operator/InverseRelation';\nimport type { InverseRelationOrderValue } from './operator/InverseRelationOrder';\n\nexport type FindOptionsSelect = string[] | {[key: string]: boolean | FindOptionsSelect };\n\nexport interface FindOneOptions {\n select?: FindOptionsSelect;\n where?: FindOptionsWhere;\n relations?: FindOptionsRelations;\n order?: FindOptionsOrder;\n skipFraming?: boolean;\n group?: Variable;\n entitySelectVariable?: Variable;\n}\n\nexport type FindOptionsRelationsValue =\n | boolean\n | FindOptionsRelations\n | FindOperator<InverseRelationOperatorValue, 'inverseRelation'>;\n\n// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style\nexport type FindOptionsRelations = {\n [k: string]: FindOptionsRelationsValue;\n};\n\nexport type FindOptionsOrderValue = 'ASC' | 'DESC' | 'asc' | 'desc' | 1 | -1;\n\nexport type FindOptionsOrder = Record<\nstring,\nFindOptionsOrderValue | FindOperator<InverseRelationOrderValue, 'inverseRelationOrder'>\n>;\n\nexport type FieldPrimitiveValue = boolean | number | string | Date;\n\nexport type JsonValueObject = {\n '@value': FieldPrimitiveValue | JSONObject | JSONArray;\n '@type': '@json';\n};\n\nexport type LanguageValueObject = {\n '@value': string;\n '@language': string;\n '@direction': string;\n};\n\nexport type NonJsonValueObject = {\n '@value': FieldPrimitiveValue;\n '@type': string;\n};\n\nexport type ValueWhereFieldObject = JsonValueObject | LanguageValueObject | NonJsonValueObject;\n\nexport type FindOptionsWhereField =\n | OrArray<FieldPrimitiveValue>\n | ValueWhereFieldObject\n | FindOptionsWhere\n | OrArray<FindOperator<any, any>>\n | BindPattern[];\n\nexport type IdFindOptionsWhereField = string | FindOperator<any, 'in' | 'not' | 'equal' | 'inversePath' | 'contains'>;\n\nexport type TypeFindOptionsWhereField =\n | string\n | FindOperator<string | string[] | FindOptionsWhere, 'in' | 'not' | 'equal' | 'inverse' | 'contains'>;\n\nexport interface BindPattern {\n expression: Expression;\n variable: Variable;\n}\n\nexport interface FindOptionsWhere {\n type?: TypeFindOptionsWhereField;\n id?: IdFindOptionsWhereField;\n binds?: BindPattern[];\n and?: FindOptionsWhere[];\n or?: FindOptionsWhere[];\n [k: string]: FindOptionsWhereField | BindPattern[] | FindOptionsWhere[] | undefined;\n}\n\n// Add these new types\nexport interface SubQuery {\n select: Variable[];\n where: FindOptionsWhere;\n groupBy?: string[];\n having?: FindOptionsWhere;\n}\n\nexport interface FindAllOptions extends FindOneOptions {\n offset?: number;\n limit?: number;\n skipHook?: boolean;\n subQueries?: SubQuery[];\n}\n\nexport interface FindExistsOptions {\n where?: FindOptionsWhere;\n relations?: FindOptionsRelations;\n}\n\nexport interface FindCountOptions {\n where?: FindOptionsWhere;\n relations?: FindOptionsRelations;\n order?: FindOptionsOrder;\n offset?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FindOptionsTypes.js","sourceRoot":"","sources":["../../src/storage/FindOptionsTypes.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { Expression, Variable } from 'sparqljs';\nimport type { OrArray, JSONArray, JSONObject } from '../util/Types';\nimport type { FindOperator } from './FindOperator';\nimport type { InverseRelationOperatorValue } from './operator/InverseRelation';\nimport type { InverseRelationOrderValue } from './operator/InverseRelationOrder';\n\nexport type FindOptionsSelect = string[] | {[key: string]: boolean | FindOptionsSelect };\n\nexport interface FindOneOptions {\n select?: FindOptionsSelect;\n where?: FindOptionsWhere;\n relations?: FindOptionsRelations;\n order?: FindOptionsOrder;\n skipFraming?: boolean;\n group?: Variable;\n entitySelectVariable?: Variable;\n bypassCache?: boolean;\n}\n\nexport type FindOptionsRelationsValue =\n | boolean\n | FindOptionsRelations\n | FindOperator<InverseRelationOperatorValue, 'inverseRelation'>;\n\n// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style\nexport type FindOptionsRelations = {\n [k: string]: FindOptionsRelationsValue;\n};\n\nexport type FindOptionsOrderValue = 'ASC' | 'DESC' | 'asc' | 'desc' | 1 | -1;\n\nexport type FindOptionsOrder = Record<\nstring,\nFindOptionsOrderValue | FindOperator<InverseRelationOrderValue, 'inverseRelationOrder'>\n>;\n\nexport type FieldPrimitiveValue = boolean | number | string | Date;\n\nexport type JsonValueObject = {\n '@value': FieldPrimitiveValue | JSONObject | JSONArray;\n '@type': '@json';\n};\n\nexport type LanguageValueObject = {\n '@value': string;\n '@language': string;\n '@direction': string;\n};\n\nexport type NonJsonValueObject = {\n '@value': FieldPrimitiveValue;\n '@type': string;\n};\n\nexport type ValueWhereFieldObject = JsonValueObject | LanguageValueObject | NonJsonValueObject;\n\nexport type FindOptionsWhereField =\n | OrArray<FieldPrimitiveValue>\n | ValueWhereFieldObject\n | FindOptionsWhere\n | OrArray<FindOperator<any, any>>\n | BindPattern[];\n\nexport type IdFindOptionsWhereField = string | FindOperator<any, 'in' | 'not' | 'equal' | 'inversePath' | 'contains'>;\n\nexport type TypeFindOptionsWhereField =\n | string\n | FindOperator<string | string[] | FindOptionsWhere, 'in' | 'not' | 'equal' | 'inverse' | 'contains'>;\n\nexport interface BindPattern {\n expression: Expression;\n variable: Variable;\n}\n\nexport interface FindOptionsWhere {\n type?: TypeFindOptionsWhereField;\n id?: IdFindOptionsWhereField;\n binds?: BindPattern[];\n and?: FindOptionsWhere[];\n or?: FindOptionsWhere[];\n bypassCache?: boolean;\n [k: string]: FindOptionsWhereField | BindPattern[] | FindOptionsWhere[] | boolean | undefined;\n}\n\n// Add these new types\nexport interface SubQuery {\n select: Variable[];\n where: FindOptionsWhere;\n groupBy?: string[];\n having?: FindOptionsWhere;\n}\n\nexport interface FindAllOptions extends FindOneOptions {\n offset?: number;\n limit?: number;\n skipHook?: boolean;\n subQueries?: SubQuery[];\n}\n\nexport interface FindExistsOptions {\n where?: FindOptionsWhere;\n relations?: FindOptionsRelations;\n}\n\nexport interface FindCountOptions {\n where?: FindOptionsWhere;\n relations?: FindOptionsRelations;\n order?: FindOptionsOrder;\n offset?: number;\n bypassCache?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReadCacheOperation } from '../SklEngineOptions';
|
|
2
|
+
export interface BuildReadCacheKeyInput {
|
|
3
|
+
operation: ReadCacheOperation;
|
|
4
|
+
args: readonly unknown[];
|
|
5
|
+
endpointUrl?: string;
|
|
6
|
+
namespace?: string;
|
|
7
|
+
keyHint?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function buildReadCacheKey(input: BuildReadCacheKeyInput): string;
|
|
10
|
+
export declare class ReadCacheSingleflight {
|
|
11
|
+
private readonly inflight;
|
|
12
|
+
do<T>(key: string, fn: () => Promise<T>): Promise<T>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ReadCacheHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadCacheHelper.d.ts","sourceRoot":"","sources":["../../src/util/ReadCacheHelper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,IAAI,EAAE,SAAS,OAAO,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAuBD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CASvE;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuC;IAEnD,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAiBlE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.ReadCacheSingleflight = exports.buildReadCacheKey = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
function stableStringify(value) {
|
|
9
|
+
if (value === null)
|
|
10
|
+
return 'null';
|
|
11
|
+
const valueType = typeof value;
|
|
12
|
+
if (valueType === 'number' || valueType === 'boolean')
|
|
13
|
+
return String(value);
|
|
14
|
+
if (valueType === 'string')
|
|
15
|
+
return JSON.stringify(value);
|
|
16
|
+
if (valueType !== 'object') {
|
|
17
|
+
const serializedPrimitive = JSON.stringify(value);
|
|
18
|
+
return serializedPrimitive ?? String(value);
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
return `[${value.map(stableStringify).join(',')}]`;
|
|
22
|
+
}
|
|
23
|
+
const objectValue = value;
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/require-array-sort-compare
|
|
25
|
+
const keys = Object.keys(objectValue).sort();
|
|
26
|
+
return `{${keys.map((key) => `${JSON.stringify(key)}:${stableStringify(objectValue[key])}`).join(',')}}`;
|
|
27
|
+
}
|
|
28
|
+
function buildReadCacheKey(input) {
|
|
29
|
+
const keyParts = {
|
|
30
|
+
namespace: input.namespace ?? '',
|
|
31
|
+
endpointUrl: input.endpointUrl ?? '',
|
|
32
|
+
operation: input.operation,
|
|
33
|
+
keyHint: input.keyHint ?? '',
|
|
34
|
+
args: input.args
|
|
35
|
+
};
|
|
36
|
+
return crypto_1.default.createHash('sha256').update(stableStringify(keyParts)).digest('hex');
|
|
37
|
+
}
|
|
38
|
+
exports.buildReadCacheKey = buildReadCacheKey;
|
|
39
|
+
class ReadCacheSingleflight {
|
|
40
|
+
constructor() {
|
|
41
|
+
this.inflight = new Map();
|
|
42
|
+
}
|
|
43
|
+
async do(key, fn) {
|
|
44
|
+
const existing = this.inflight.get(key);
|
|
45
|
+
if (existing) {
|
|
46
|
+
return existing;
|
|
47
|
+
}
|
|
48
|
+
const promise = (async () => {
|
|
49
|
+
try {
|
|
50
|
+
return await fn();
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
this.inflight.delete(key);
|
|
54
|
+
}
|
|
55
|
+
})();
|
|
56
|
+
this.inflight.set(key, promise);
|
|
57
|
+
return promise;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.ReadCacheSingleflight = ReadCacheSingleflight;
|
|
61
|
+
//# sourceMappingURL=ReadCacheHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadCacheHelper.js","sourceRoot":"","sources":["../../src/util/ReadCacheHelper.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAW5B,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAElC,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;IAC/B,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,IAAI,SAAS,KAAK,Q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aAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;IAmBlE,CAAC;IAjBQ,KAAK,CAAC,EAAE,CAAI,GAAW,EAAE,EAAoB;QAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAA2B,CAAC;QAClE,IAAI,QAAQ,EAAE;YACZ,OAAO,QAAQ,CAAC;SACjB;QAED,MAAM,OAAO,GAAG,CAAC,KAAK,IAAe,EAAE;YACrC,IAAI;gBACF,OAAO,MAAM,EAAE,EAAE,CAAC;aACnB;oBAAS;gBACR,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;aAC3B;QACH,CAAC,CAAC,EAAE,CAAC;QAEL,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAA2B,CAAC,CAAC;QACpD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AApBD,sDAoBC","sourcesContent":["import crypto from 'crypto';\nimport type { ReadCacheOperation } from '../SklEngineOptions';\n\nexport interface BuildReadCacheKeyInput {\n operation: ReadCacheOperation;\n args: readonly unknown[];\n endpointUrl?: string;\n namespace?: string;\n keyHint?: string;\n}\n\nfunction stableStringify(value: unknown): string {\n if (value === null) return 'null';\n\n const valueType = typeof value;\n if (valueType === 'number' || valueType === 'boolean') return String(value);\n if (valueType === 'string') return JSON.stringify(value);\n if (valueType !== 'object') {\n const serializedPrimitive = JSON.stringify(value);\n return serializedPrimitive ?? String(value);\n }\n\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(',')}]`;\n }\n\n const objectValue = value as Record<string, unknown>;\n // eslint-disable-next-line @typescript-eslint/require-array-sort-compare\n const keys = Object.keys(objectValue).sort();\n return `{${keys.map((key) => `${JSON.stringify(key)}:${stableStringify(objectValue[key])}`).join(',')}}`;\n}\n\nexport function buildReadCacheKey(input: BuildReadCacheKeyInput): string {\n const keyParts = {\n namespace: input.namespace ?? '',\n endpointUrl: input.endpointUrl ?? '',\n operation: input.operation,\n keyHint: input.keyHint ?? '',\n args: input.args\n };\n return crypto.createHash('sha256').update(stableStringify(keyParts)).digest('hex');\n}\n\nexport class ReadCacheSingleflight {\n private readonly inflight = new Map<string, Promise<unknown>>();\n\n public async do<T>(key: string, fn: () => Promise<T>): Promise<T> {\n const existing = this.inflight.get(key) as Promise<T> | undefined;\n if (existing) {\n return existing;\n }\n\n const promise = (async(): Promise<T> => {\n try {\n return await fn();\n } finally {\n this.inflight.delete(key);\n }\n })();\n\n this.inflight.set(key, promise as Promise<unknown>);\n return promise;\n }\n}\n"]}
|
package/package.json
CHANGED
package/src/SklEngine.ts
CHANGED
|
@@ -34,7 +34,7 @@ import type { ExecutionOptions } from './JsExecutor';
|
|
|
34
34
|
import type { ICodeExecutor } from './JsExecutor/types';
|
|
35
35
|
import { Logger } from './logger';
|
|
36
36
|
import { Mapper } from './mapping/Mapper';
|
|
37
|
-
import type { SklEngineOptions } from './SklEngineOptions';
|
|
37
|
+
import type { ReadCacheOperation, ReadCachePolicy, ReadCacheStore, SklEngineOptions } from './SklEngineOptions';
|
|
38
38
|
import type { FindOperator } from './storage/FindOperator';
|
|
39
39
|
import type { FindAllOptions, FindOneOptions, FindOptionsWhere } from './storage/FindOptionsTypes';
|
|
40
40
|
import type { GroupByOptions, GroupByResponse } from './storage/GroupOptionTypes';
|
|
@@ -48,6 +48,7 @@ import { ZeroOrMorePath } from './storage/operator/ZeroOrMorePath';
|
|
|
48
48
|
import type { QueryAdapter, RawQueryResult } from './storage/query-adapter/QueryAdapter';
|
|
49
49
|
import { SparqlQueryAdapter } from './storage/query-adapter/sparql/SparqlQueryAdapter';
|
|
50
50
|
import { PerformanceLogger } from './util/PerformanceLogger';
|
|
51
|
+
import { buildReadCacheKey, ReadCacheSingleflight } from './util/ReadCacheHelper';
|
|
51
52
|
// Import './util/safeJsonStringify';
|
|
52
53
|
import type {
|
|
53
54
|
Callbacks,
|
|
@@ -82,6 +83,7 @@ export type CapabilityInterface = Record<string, CapabilityHandler>;
|
|
|
82
83
|
export type MappingResponseOption<T extends boolean> = T extends true ? JSONObject : NodeObject;
|
|
83
84
|
|
|
84
85
|
export type WriteOptions = { bypassHooks?: boolean };
|
|
86
|
+
const DEFAULT_READ_CACHE_TTL_MS = 60_000;
|
|
85
87
|
|
|
86
88
|
export class SKLEngine implements SKLEngineInterface {
|
|
87
89
|
private readonly queryAdapter: QueryAdapter;
|
|
@@ -94,6 +96,10 @@ export class SKLEngine implements SKLEngineInterface {
|
|
|
94
96
|
private readonly skdsEndpointUrl: string;
|
|
95
97
|
private readonly scriptPath: string;
|
|
96
98
|
private readonly logger: Logger;
|
|
99
|
+
private readonly readCache?: ReadCacheStore;
|
|
100
|
+
private readonly readCachePolicy?: ReadCachePolicy;
|
|
101
|
+
private readonly readCacheNamespace?: string;
|
|
102
|
+
private readonly readCacheSingleflight = new ReadCacheSingleflight();
|
|
97
103
|
public constructor(options: SklEngineOptions) {
|
|
98
104
|
this.queryAdapter = new SparqlQueryAdapter(options);
|
|
99
105
|
this.disableValidation = options.disableValidation;
|
|
@@ -101,6 +107,9 @@ export class SKLEngine implements SKLEngineInterface {
|
|
|
101
107
|
this.inputFiles = options.inputFiles;
|
|
102
108
|
this.skdsEndpointUrl = (options as any).endpointUrl;
|
|
103
109
|
this.scriptPath = (options as any).scriptPath;
|
|
110
|
+
this.readCache = options.readCache;
|
|
111
|
+
this.readCachePolicy = options.readCachePolicy;
|
|
112
|
+
this.readCacheNamespace = options.readCacheNamespace;
|
|
104
113
|
if (options.functions) {
|
|
105
114
|
this.functions = Object.fromEntries(
|
|
106
115
|
Object.entries(options.functions).map(([key, func]) => [
|
|
@@ -145,21 +154,120 @@ export class SKLEngine implements SKLEngineInterface {
|
|
|
145
154
|
return await this.queryAdapter.executeRawConstructQuery(query, frame);
|
|
146
155
|
}
|
|
147
156
|
|
|
157
|
+
private cloneForReadCache<T>(value: T): T {
|
|
158
|
+
try {
|
|
159
|
+
return structuredClone(value);
|
|
160
|
+
} catch {
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private stripBypassCacheFromFindOneOptions(options?: FindOneOptions): FindOneOptions | undefined {
|
|
166
|
+
if (!options) {
|
|
167
|
+
return options;
|
|
168
|
+
}
|
|
169
|
+
const { bypassCache, ...rest } = options;
|
|
170
|
+
return rest;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private stripBypassCacheFromFindAllOptions(options?: FindAllOptions): FindAllOptions | undefined {
|
|
174
|
+
if (!options) {
|
|
175
|
+
return options;
|
|
176
|
+
}
|
|
177
|
+
const { bypassCache, ...rest } = options;
|
|
178
|
+
return rest;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private stripBypassCacheFromWhere(where?: FindOptionsWhere): FindOptionsWhere | undefined {
|
|
182
|
+
if (!where) {
|
|
183
|
+
return where;
|
|
184
|
+
}
|
|
185
|
+
const { bypassCache, ...rest } = where;
|
|
186
|
+
return rest;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private async runReadWithCache<T>(params: {
|
|
190
|
+
operation: ReadCacheOperation;
|
|
191
|
+
args: readonly unknown[];
|
|
192
|
+
bypassCache?: boolean;
|
|
193
|
+
execute: () => Promise<T>;
|
|
194
|
+
}): Promise<T> {
|
|
195
|
+
if (params.bypassCache) {
|
|
196
|
+
return await params.execute();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (!this.readCache || !this.readCachePolicy) {
|
|
200
|
+
return await params.execute();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const policyDecision = this.readCachePolicy({
|
|
204
|
+
operation: params.operation,
|
|
205
|
+
args: params.args,
|
|
206
|
+
endpointUrl: this.skdsEndpointUrl,
|
|
207
|
+
namespace: this.readCacheNamespace
|
|
208
|
+
});
|
|
209
|
+
if (!policyDecision.cache) {
|
|
210
|
+
return await params.execute();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const ttlMs = policyDecision.ttlMs ?? DEFAULT_READ_CACHE_TTL_MS;
|
|
214
|
+
if (ttlMs <= 0) {
|
|
215
|
+
return await params.execute();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const cacheKey = buildReadCacheKey({
|
|
219
|
+
operation: params.operation,
|
|
220
|
+
args: params.args,
|
|
221
|
+
endpointUrl: this.skdsEndpointUrl,
|
|
222
|
+
namespace: this.readCacheNamespace,
|
|
223
|
+
keyHint: policyDecision.keyHint
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
return await this.readCacheSingleflight.do(cacheKey, async() => {
|
|
227
|
+
try {
|
|
228
|
+
const cached = await this.readCache?.get(cacheKey);
|
|
229
|
+
if (cached !== undefined) {
|
|
230
|
+
return this.cloneForReadCache(cached as T);
|
|
231
|
+
}
|
|
232
|
+
} catch (error) {
|
|
233
|
+
this.logger.debug('Read cache lookup failed; continuing without cache', error as any);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const result = await params.execute();
|
|
237
|
+
|
|
238
|
+
try {
|
|
239
|
+
await this.readCache?.set(cacheKey, this.cloneForReadCache(result), ttlMs);
|
|
240
|
+
} catch (error) {
|
|
241
|
+
this.logger.debug('Read cache write failed; continuing without cache', error as any);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return result;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
148
248
|
public async find(options?: FindOneOptions): Promise<Entity> {
|
|
249
|
+
const bypassCache = options?.bypassCache;
|
|
250
|
+
const optionsWithoutBypass = this.stripBypassCacheFromFindOneOptions(options);
|
|
251
|
+
|
|
149
252
|
return PerformanceLogger.withSpanRoot('SklEngine.find', async() => {
|
|
150
253
|
const context = {
|
|
151
254
|
entities: [],
|
|
152
255
|
operation: 'find',
|
|
153
|
-
operationParameters: { options },
|
|
256
|
+
operationParameters: { options: optionsWithoutBypass },
|
|
154
257
|
sklEngine: this
|
|
155
258
|
};
|
|
156
259
|
|
|
157
260
|
await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);
|
|
158
261
|
|
|
159
262
|
try {
|
|
160
|
-
const entity = await this.
|
|
263
|
+
const entity = await this.runReadWithCache({
|
|
264
|
+
operation: 'find',
|
|
265
|
+
args: [optionsWithoutBypass],
|
|
266
|
+
bypassCache,
|
|
267
|
+
execute: async() => await this.queryAdapter.find(optionsWithoutBypass)
|
|
268
|
+
});
|
|
161
269
|
if (!entity) {
|
|
162
|
-
throw new Error(`No schema found with fields matching ${JSON.stringify(
|
|
270
|
+
throw new Error(`No schema found with fields matching ${JSON.stringify(optionsWithoutBypass)}`);
|
|
163
271
|
}
|
|
164
272
|
|
|
165
273
|
const updatedContext = { ...context, entities: [entity]};
|
|
@@ -170,31 +278,39 @@ export class SKLEngine implements SKLEngineInterface {
|
|
|
170
278
|
await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);
|
|
171
279
|
throw error;
|
|
172
280
|
}
|
|
173
|
-
}, { options });
|
|
281
|
+
}, { options: optionsWithoutBypass });
|
|
174
282
|
}
|
|
175
283
|
|
|
176
284
|
public async findBy(where: FindOptionsWhere, notFoundErrorMessage?: string): Promise<Entity> {
|
|
285
|
+
const bypassCache = where?.bypassCache;
|
|
286
|
+
const whereWithoutBypass = this.stripBypassCacheFromWhere(where)!;
|
|
287
|
+
|
|
177
288
|
return PerformanceLogger.withSpanRoot('SklEngine.findBy', async() => {
|
|
178
289
|
const context = {
|
|
179
290
|
entities: [],
|
|
180
291
|
operation: 'findBy',
|
|
181
|
-
operationParameters: { where },
|
|
292
|
+
operationParameters: { where: whereWithoutBypass },
|
|
182
293
|
sklEngine: this
|
|
183
294
|
};
|
|
184
295
|
await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);
|
|
185
296
|
try {
|
|
186
|
-
const entity = await this.
|
|
297
|
+
const entity = await this.runReadWithCache({
|
|
298
|
+
operation: 'findBy',
|
|
299
|
+
args: [whereWithoutBypass, notFoundErrorMessage],
|
|
300
|
+
bypassCache,
|
|
301
|
+
execute: async() => await this.queryAdapter.findBy(whereWithoutBypass)
|
|
302
|
+
});
|
|
187
303
|
if (entity) {
|
|
188
304
|
const updatedContext = { ...context, entities: [entity]};
|
|
189
305
|
await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, entity);
|
|
190
306
|
return entity;
|
|
191
307
|
}
|
|
192
|
-
throw new Error(notFoundErrorMessage ?? `No schema found with fields matching ${JSON.stringify(
|
|
308
|
+
throw new Error(notFoundErrorMessage ?? `No schema found with fields matching ${JSON.stringify(whereWithoutBypass)}`);
|
|
193
309
|
} catch (error: unknown) {
|
|
194
310
|
await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);
|
|
195
311
|
throw error;
|
|
196
312
|
}
|
|
197
|
-
}, { where });
|
|
313
|
+
}, { where: whereWithoutBypass });
|
|
198
314
|
}
|
|
199
315
|
|
|
200
316
|
public async findByIfExists(options: FindOptionsWhere): Promise<Entity | undefined> {
|
|
@@ -207,16 +323,24 @@ export class SKLEngine implements SKLEngineInterface {
|
|
|
207
323
|
}
|
|
208
324
|
|
|
209
325
|
public async findAll(options?: FindAllOptions): Promise<Entity[]> {
|
|
326
|
+
const bypassCache = options?.bypassCache;
|
|
327
|
+
const optionsWithoutBypass = this.stripBypassCacheFromFindAllOptions(options);
|
|
328
|
+
|
|
210
329
|
return PerformanceLogger.withSpanRoot('SklEngine.findAll', async() => {
|
|
211
330
|
const context = {
|
|
212
331
|
entities: [],
|
|
213
332
|
operation: 'findAll',
|
|
214
|
-
operationParameters: { options },
|
|
333
|
+
operationParameters: { options: optionsWithoutBypass },
|
|
215
334
|
sklEngine: this
|
|
216
335
|
};
|
|
217
336
|
await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);
|
|
218
337
|
try {
|
|
219
|
-
const entities = await this.
|
|
338
|
+
const entities = await this.runReadWithCache({
|
|
339
|
+
operation: 'findAll',
|
|
340
|
+
args: [optionsWithoutBypass],
|
|
341
|
+
bypassCache,
|
|
342
|
+
execute: async() => await this.queryAdapter.findAll(optionsWithoutBypass)
|
|
343
|
+
});
|
|
220
344
|
const updatedContext = { ...context, entities };
|
|
221
345
|
await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, entities);
|
|
222
346
|
return entities;
|
|
@@ -224,7 +348,7 @@ export class SKLEngine implements SKLEngineInterface {
|
|
|
224
348
|
await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);
|
|
225
349
|
throw error;
|
|
226
350
|
}
|
|
227
|
-
}, { options });
|
|
351
|
+
}, { options: optionsWithoutBypass });
|
|
228
352
|
}
|
|
229
353
|
|
|
230
354
|
public async groupBy(options: GroupByOptions): Promise<GroupByResponse> {
|
|
@@ -274,7 +398,20 @@ export class SKLEngine implements SKLEngineInterface {
|
|
|
274
398
|
}
|
|
275
399
|
|
|
276
400
|
public async count(options?: FindAllOptions): Promise<number> {
|
|
277
|
-
|
|
401
|
+
const bypassCache = options?.bypassCache;
|
|
402
|
+
const optionsWithoutBypass = this.stripBypassCacheFromFindAllOptions(options);
|
|
403
|
+
|
|
404
|
+
return PerformanceLogger.withSpanRoot(
|
|
405
|
+
'SklEngine.count',
|
|
406
|
+
async() =>
|
|
407
|
+
await this.runReadWithCache({
|
|
408
|
+
operation: 'count',
|
|
409
|
+
args: [optionsWithoutBypass],
|
|
410
|
+
bypassCache,
|
|
411
|
+
execute: async() => await this.queryAdapter.count(optionsWithoutBypass)
|
|
412
|
+
}),
|
|
413
|
+
{ options: optionsWithoutBypass }
|
|
414
|
+
);
|
|
278
415
|
}
|
|
279
416
|
|
|
280
417
|
public async save(entity: Entity, options?: WriteOptions): Promise<Entity>;
|
package/src/SklEngineOptions.ts
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import type { SparqlQueryAdapterOptions } from './storage/query-adapter/sparql/SparqlQueryAdapterOptions';
|
|
2
2
|
import type { Callbacks } from './util/Types';
|
|
3
3
|
|
|
4
|
+
export type ReadCacheOperation = 'find' | 'findBy' | 'findAll' | 'count';
|
|
5
|
+
|
|
6
|
+
export interface ReadCacheStore {
|
|
7
|
+
get: (key: string) => Promise<unknown | undefined>;
|
|
8
|
+
set: (key: string, value: unknown, ttlMs: number) => Promise<void>;
|
|
9
|
+
delete?: (key: string) => Promise<void>;
|
|
10
|
+
clear?: () => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ReadCachePolicyInput {
|
|
14
|
+
operation: ReadCacheOperation;
|
|
15
|
+
args: readonly unknown[];
|
|
16
|
+
endpointUrl?: string;
|
|
17
|
+
namespace?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ReadCachePolicyDecision {
|
|
21
|
+
cache: boolean;
|
|
22
|
+
ttlMs?: number;
|
|
23
|
+
keyHint?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type ReadCachePolicy = (input: ReadCachePolicyInput) => ReadCachePolicyDecision;
|
|
27
|
+
|
|
4
28
|
export type SklEngineOptions = SparqlQueryAdapterOptions & {
|
|
5
29
|
/**
|
|
6
30
|
* Callbacks to execute upon events.
|
|
@@ -25,4 +49,20 @@ export type SklEngineOptions = SparqlQueryAdapterOptions & {
|
|
|
25
49
|
* The path to the executor script.
|
|
26
50
|
*/
|
|
27
51
|
readonly scriptPath?: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Optional read cache store used for select read operations.
|
|
55
|
+
* Cache decisions are made by readCachePolicy.
|
|
56
|
+
*/
|
|
57
|
+
readonly readCache?: ReadCacheStore;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Optional policy that decides whether a given read operation should be cached.
|
|
61
|
+
*/
|
|
62
|
+
readonly readCachePolicy?: ReadCachePolicy;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Optional namespace to scope cache keys (for example tenant/account isolation).
|
|
66
|
+
*/
|
|
67
|
+
readonly readCacheNamespace?: string;
|
|
28
68
|
};
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './hooks/types';
|
|
|
7
7
|
export * from './JsExecutor';
|
|
8
8
|
export * from './mapping/Mapper';
|
|
9
9
|
export * from './SklEngine';
|
|
10
|
+
export * from './SklEngineOptions';
|
|
10
11
|
// Storage
|
|
11
12
|
export * from './storage/FindOperator';
|
|
12
13
|
export * from './storage/FindOptionsTypes';
|
|
@@ -15,6 +15,7 @@ export interface FindOneOptions {
|
|
|
15
15
|
skipFraming?: boolean;
|
|
16
16
|
group?: Variable;
|
|
17
17
|
entitySelectVariable?: Variable;
|
|
18
|
+
bypassCache?: boolean;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export type FindOptionsRelationsValue =
|
|
@@ -78,7 +79,8 @@ export interface FindOptionsWhere {
|
|
|
78
79
|
binds?: BindPattern[];
|
|
79
80
|
and?: FindOptionsWhere[];
|
|
80
81
|
or?: FindOptionsWhere[];
|
|
81
|
-
|
|
82
|
+
bypassCache?: boolean;
|
|
83
|
+
[k: string]: FindOptionsWhereField | BindPattern[] | FindOptionsWhere[] | boolean | undefined;
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
// Add these new types
|
|
@@ -106,4 +108,5 @@ export interface FindCountOptions {
|
|
|
106
108
|
relations?: FindOptionsRelations;
|
|
107
109
|
order?: FindOptionsOrder;
|
|
108
110
|
offset?: number;
|
|
111
|
+
bypassCache?: boolean;
|
|
109
112
|
}
|