@expo/entity-cache-adapter-local-memory 0.45.0 → 0.47.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/build/{GenericLocalMemoryCacher.d.ts → src/GenericLocalMemoryCacher.d.ts} +1 -1
- package/build/{GenericLocalMemoryCacher.js → src/GenericLocalMemoryCacher.js} +2 -2
- package/build/src/GenericLocalMemoryCacher.js.map +1 -0
- package/build/{LocalMemoryCacheAdapterProvider.d.ts → src/LocalMemoryCacheAdapterProvider.d.ts} +2 -2
- package/build/{LocalMemoryCacheAdapterProvider.js → src/LocalMemoryCacheAdapterProvider.js} +6 -8
- package/build/{LocalMemoryCacheAdapterProvider.js.map → src/LocalMemoryCacheAdapterProvider.js.map} +1 -1
- package/build/src/index.d.ts +6 -0
- package/build/{index.js → src/index.js} +1 -8
- package/build/src/index.js.map +1 -0
- package/package.json +16 -27
- package/src/GenericLocalMemoryCacher.ts +1 -1
- package/src/LocalMemoryCacheAdapterProvider.ts +3 -3
- package/src/__testfixtures__/LocalMemoryTestEntity.ts +6 -6
- package/src/__testfixtures__/createLocalMemoryTestEntityCompanionProvider.ts +3 -3
- package/src/__tests__/GenericLocalMemoryCacher-full-test.ts +11 -17
- package/src/__tests__/GenericLocalMemoryCacher-test.ts +3 -1
- package/src/index.ts +1 -2
- package/LICENSE +0 -21
- package/build/GenericLocalMemoryCacher.js.map +0 -1
- package/build/index.d.ts +0 -7
- package/build/index.js.map +0 -1
- package/build/tsconfig.build.tsbuildinfo +0 -1
|
@@ -3,7 +3,7 @@ import LRUCache from 'lru-cache';
|
|
|
3
3
|
export declare const DOES_NOT_EXIST_LOCAL_MEMORY_CACHE: unique symbol;
|
|
4
4
|
export type LocalMemoryCacheValue<TFields extends Record<string, any>> = Readonly<TFields> | typeof DOES_NOT_EXIST_LOCAL_MEMORY_CACHE;
|
|
5
5
|
export type LocalMemoryCache<TFields extends Record<string, any>> = LRUCache<string, LocalMemoryCacheValue<TFields>>;
|
|
6
|
-
export
|
|
6
|
+
export declare class GenericLocalMemoryCacher<TFields extends Record<string, any>, TIDField extends keyof TFields> implements IEntityGenericCacher<TFields, TIDField> {
|
|
7
7
|
private readonly entityConfiguration;
|
|
8
8
|
private readonly localMemoryCache;
|
|
9
9
|
constructor(entityConfiguration: EntityConfiguration<TFields, TIDField>, localMemoryCache: LocalMemoryCache<TFields>);
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DOES_NOT_EXIST_LOCAL_MEMORY_CACHE = void 0;
|
|
6
|
+
exports.GenericLocalMemoryCacher = exports.DOES_NOT_EXIST_LOCAL_MEMORY_CACHE = void 0;
|
|
7
7
|
const entity_1 = require("@expo/entity");
|
|
8
8
|
const lru_cache_1 = __importDefault(require("lru-cache"));
|
|
9
9
|
// Sentinel value we store in local memory to negatively cache a database miss.
|
|
@@ -89,5 +89,5 @@ class GenericLocalMemoryCacher {
|
|
|
89
89
|
return [this.makeCacheKeyForStorage(key, value)];
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
exports.
|
|
92
|
+
exports.GenericLocalMemoryCacher = GenericLocalMemoryCacher;
|
|
93
93
|
//# sourceMappingURL=GenericLocalMemoryCacher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericLocalMemoryCacher.js","sourceRoot":"","sources":["../../src/GenericLocalMemoryCacher.ts"],"names":[],"mappings":";;;;;;AAAA,yCAOsB;AACtB,0DAAiC;AAEjC,+EAA+E;AAC/E,qEAAqE;AACxD,QAAA,iCAAiC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AASxE,MAAa,wBAAwB;IAMhB;IACA;IAFnB,YACmB,mBAA2D,EAC3D,gBAA2C;QAD3C,wBAAmB,GAAnB,mBAAmB,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,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,SAAS,EAAE,CAAC,CAChE,CAAC;QACF,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAEM,4BAA4B,CAIjC,GAAa,EAAE,KAAiB;QAChC,sFAAsF;QACtF,8CAA8C;QAC9C,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IACnD,CAAC;CACF;AAtGD,4DAsGC"}
|
package/build/{LocalMemoryCacheAdapterProvider.d.ts → src/LocalMemoryCacheAdapterProvider.d.ts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntityConfiguration, IEntityCacheAdapter, IEntityCacheAdapterProvider } from '@expo/entity';
|
|
2
2
|
/**
|
|
3
3
|
* Vends local memory cache adapters. An instance of this class may be shared across requests to
|
|
4
4
|
* share the local memory cache.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare class LocalMemoryCacheAdapterProvider implements IEntityCacheAdapterProvider {
|
|
7
7
|
private readonly localMemoryCacheCreator;
|
|
8
8
|
/**
|
|
9
9
|
* @returns a no-op local memory cache adapter provider, or one that doesn't cache locally.
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocalMemoryCacheAdapterProvider = void 0;
|
|
6
4
|
const entity_1 = require("@expo/entity");
|
|
7
|
-
const GenericLocalMemoryCacher_1 =
|
|
5
|
+
const GenericLocalMemoryCacher_1 = require("./GenericLocalMemoryCacher");
|
|
8
6
|
/**
|
|
9
7
|
* Vends local memory cache adapters. An instance of this class may be shared across requests to
|
|
10
8
|
* share the local memory cache.
|
|
@@ -15,13 +13,13 @@ class LocalMemoryCacheAdapterProvider {
|
|
|
15
13
|
* @returns a no-op local memory cache adapter provider, or one that doesn't cache locally.
|
|
16
14
|
*/
|
|
17
15
|
static createNoOpProvider() {
|
|
18
|
-
return new LocalMemoryCacheAdapterProvider(() => GenericLocalMemoryCacher_1.
|
|
16
|
+
return new LocalMemoryCacheAdapterProvider(() => GenericLocalMemoryCacher_1.GenericLocalMemoryCacher.createNoOpCache());
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
19
|
* @returns a local memory cache adapter provider configured with the supplied options.
|
|
22
20
|
*/
|
|
23
21
|
static createProviderWithOptions(options = {}) {
|
|
24
|
-
return new LocalMemoryCacheAdapterProvider(() => GenericLocalMemoryCacher_1.
|
|
22
|
+
return new LocalMemoryCacheAdapterProvider(() => GenericLocalMemoryCacher_1.GenericLocalMemoryCacher.createLRUCache(options));
|
|
25
23
|
}
|
|
26
24
|
localMemoryCacheAdapterMap = new Map();
|
|
27
25
|
constructor(localMemoryCacheCreator) {
|
|
@@ -30,9 +28,9 @@ class LocalMemoryCacheAdapterProvider {
|
|
|
30
28
|
getCacheAdapter(entityConfiguration) {
|
|
31
29
|
return (0, entity_1.computeIfAbsent)(this.localMemoryCacheAdapterMap, entityConfiguration.tableName, () => {
|
|
32
30
|
const localMemoryCache = this.localMemoryCacheCreator();
|
|
33
|
-
return new entity_1.GenericEntityCacheAdapter(new GenericLocalMemoryCacher_1.
|
|
31
|
+
return new entity_1.GenericEntityCacheAdapter(new GenericLocalMemoryCacher_1.GenericLocalMemoryCacher(entityConfiguration, localMemoryCache));
|
|
34
32
|
});
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
|
-
exports.
|
|
35
|
+
exports.LocalMemoryCacheAdapterProvider = LocalMemoryCacheAdapterProvider;
|
|
38
36
|
//# sourceMappingURL=LocalMemoryCacheAdapterProvider.js.map
|
package/build/{LocalMemoryCacheAdapterProvider.js.map → src/LocalMemoryCacheAdapterProvider.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalMemoryCacheAdapterProvider.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"LocalMemoryCacheAdapterProvider.js","sourceRoot":"","sources":["../../src/LocalMemoryCacheAdapterProvider.ts"],"names":[],"mappings":";;;AAAA,yCAMsB;AAEtB,yEAAwF;AAExF;;;GAGG;AACH,MAAa,+BAA+B;IA2BvB;IA1BnB;;OAEG;IACH,MAAM,CAAC,kBAAkB;QACvB,OAAO,IAAI,+BAA+B,CAAC,GAAwC,EAAE,CACnF,mDAAwB,CAAC,eAAe,EAAW,CACpD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,yBAAyB,CAC9B,UAAqD,EAAE;QAEvD,OAAO,IAAI,+BAA+B,CAAC,GAAwC,EAAE,CACnF,mDAAwB,CAAC,cAAc,CAAU,OAAO,CAAC,CAC1D,CAAC;IACJ,CAAC;IAEgB,0BAA0B,GAAG,IAAI,GAAG,EAGlD,CAAC;IAEJ,YACmB,uBAEe;QAFf,4BAAuB,GAAvB,uBAAuB,CAER;IAC/B,CAAC;IAEG,eAAe,CACpB,mBAA2D;QAE3D,OAAO,IAAA,wBAAe,EAAC,IAAI,CAAC,0BAA0B,EAAE,mBAAmB,CAAC,SAAS,EAAE,GAAG,EAAE;YAC1F,MAAM,gBAAgB,GAAG,IAAI,CAAC,uBAAuB,EAAW,CAAC;YACjE,OAAO,IAAI,kCAAyB,CAClC,IAAI,mDAAwB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CACpE,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1CD,0EA0CC"}
|
|
@@ -18,14 +18,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
18
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.LocalMemoryCacheAdapterProvider = exports.GenericLocalMemoryCacher = void 0;
|
|
26
|
-
var GenericLocalMemoryCacher_1 = require("./GenericLocalMemoryCacher");
|
|
27
|
-
Object.defineProperty(exports, "GenericLocalMemoryCacher", { enumerable: true, get: function () { return __importDefault(GenericLocalMemoryCacher_1).default; } });
|
|
28
22
|
__exportStar(require("./GenericLocalMemoryCacher"), exports);
|
|
29
|
-
|
|
30
|
-
Object.defineProperty(exports, "LocalMemoryCacheAdapterProvider", { enumerable: true, get: function () { return __importDefault(LocalMemoryCacheAdapterProvider_1).default; } });
|
|
23
|
+
__exportStar(require("./LocalMemoryCacheAdapterProvider"), exports);
|
|
31
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC;;;GAGG;;;;;;;;;;;;;;;;AAEH,6DAA2C;AAC3C,oEAAkD"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/entity-cache-adapter-local-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"description": "Cross-request local memory cache adapter for @expo/entity",
|
|
5
5
|
"files": [
|
|
6
6
|
"build",
|
|
7
|
+
"!*.tsbuildinfo",
|
|
8
|
+
"!__*",
|
|
7
9
|
"src"
|
|
8
10
|
],
|
|
9
|
-
"main": "build/index.js",
|
|
10
|
-
"types": "build/index.d.ts",
|
|
11
|
+
"main": "build/src/index.js",
|
|
12
|
+
"types": "build/src/index.d.ts",
|
|
11
13
|
"scripts": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"clean": "
|
|
15
|
-
"lint": "eslint src",
|
|
16
|
-
"lint-fix": "
|
|
17
|
-
"test": "
|
|
18
|
-
"integration": "
|
|
19
|
-
"integration-no-setup": "jest --config ../../resources/jest-integration.config.js --rootDir . --runInBand --passWithNoTests",
|
|
20
|
-
"ctix": "ctix build --config ../../.ctirc && ../../resources/prepend-barrel.sh '@expo/entity-cache-adapter-local-memory'"
|
|
14
|
+
"build": "tsc --build",
|
|
15
|
+
"prepack": "rm -rf build && yarn build",
|
|
16
|
+
"clean": "yarn build --clean",
|
|
17
|
+
"lint": "yarn run --top-level eslint src",
|
|
18
|
+
"lint-fix": "yarn lint --fix",
|
|
19
|
+
"test": "yarn test:all --rootDir $(pwd)",
|
|
20
|
+
"integration": "yarn integration:all --rootDir $(pwd)"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=16"
|
|
@@ -28,24 +28,13 @@
|
|
|
28
28
|
"author": "Expo",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@expo/entity": "
|
|
31
|
+
"@expo/entity": "workspace:^",
|
|
32
32
|
"lru-cache": "^6.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@expo/entity-testing-utils": "
|
|
36
|
-
"@
|
|
35
|
+
"@expo/entity-testing-utils": "workspace:^",
|
|
36
|
+
"@jest/globals": "^30.0.0",
|
|
37
37
|
"@types/lru-cache": "^5.1.1",
|
|
38
|
-
"@types/node": "^20.14.1",
|
|
39
|
-
"ctix": "^2.7.0",
|
|
40
|
-
"eslint": "^9.26.0",
|
|
41
|
-
"eslint-config-universe": "^15.0.3",
|
|
42
|
-
"eslint-plugin-tsdoc": "^0.4.0",
|
|
43
|
-
"jest": "^29.7.0",
|
|
44
|
-
"prettier": "^3.5.3",
|
|
45
|
-
"prettier-plugin-organize-imports": "^4.1.0",
|
|
46
|
-
"ts-jest": "^29.3.2",
|
|
47
|
-
"ts-mockito": "^2.6.1",
|
|
48
38
|
"typescript": "^5.8.3"
|
|
49
|
-
}
|
|
50
|
-
"gitHead": "fe2d246f87adc98a13cc7c1ae57f3628769560c9"
|
|
39
|
+
}
|
|
51
40
|
}
|
|
@@ -19,7 +19,7 @@ export type LocalMemoryCache<TFields extends Record<string, any>> = LRUCache<
|
|
|
19
19
|
LocalMemoryCacheValue<TFields>
|
|
20
20
|
>;
|
|
21
21
|
|
|
22
|
-
export
|
|
22
|
+
export class GenericLocalMemoryCacher<
|
|
23
23
|
TFields extends Record<string, any>,
|
|
24
24
|
TIDField extends keyof TFields,
|
|
25
25
|
> implements IEntityGenericCacher<TFields, TIDField>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
computeIfAbsent,
|
|
3
|
-
IEntityCacheAdapter,
|
|
4
3
|
EntityConfiguration,
|
|
5
4
|
GenericEntityCacheAdapter,
|
|
5
|
+
IEntityCacheAdapter,
|
|
6
6
|
IEntityCacheAdapterProvider,
|
|
7
7
|
} from '@expo/entity';
|
|
8
8
|
|
|
9
|
-
import GenericLocalMemoryCacher,
|
|
9
|
+
import { GenericLocalMemoryCacher, LocalMemoryCache } from './GenericLocalMemoryCacher';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Vends local memory cache adapters. An instance of this class may be shared across requests to
|
|
13
13
|
* share the local memory cache.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export class LocalMemoryCacheAdapterProvider implements IEntityCacheAdapterProvider {
|
|
16
16
|
/**
|
|
17
17
|
* @returns a no-op local memory cache adapter provider, or one that doesn't cache locally.
|
|
18
18
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AlwaysAllowPrivacyPolicyRule,
|
|
3
|
-
EntityPrivacyPolicy,
|
|
4
|
-
ViewerContext,
|
|
5
3
|
DateField,
|
|
6
|
-
StringField,
|
|
7
|
-
EntityConfiguration,
|
|
8
|
-
EntityCompanionDefinition,
|
|
9
4
|
Entity,
|
|
5
|
+
EntityCompanionDefinition,
|
|
6
|
+
EntityConfiguration,
|
|
7
|
+
EntityPrivacyPolicy,
|
|
8
|
+
StringField,
|
|
10
9
|
UUIDField,
|
|
10
|
+
ViewerContext,
|
|
11
11
|
} from '@expo/entity';
|
|
12
12
|
|
|
13
13
|
export type LocalMemoryTestEntityFields = {
|
|
@@ -16,7 +16,7 @@ export type LocalMemoryTestEntityFields = {
|
|
|
16
16
|
dateField: Date | null;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export
|
|
19
|
+
export class LocalMemoryTestEntity extends Entity<
|
|
20
20
|
LocalMemoryTestEntityFields,
|
|
21
21
|
'id',
|
|
22
22
|
ViewerContext
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
NoOpEntityMetricsAdapter,
|
|
3
|
-
IEntityMetricsAdapter,
|
|
4
2
|
EntityCompanionProvider,
|
|
3
|
+
IEntityMetricsAdapter,
|
|
4
|
+
NoOpEntityMetricsAdapter,
|
|
5
5
|
} from '@expo/entity';
|
|
6
6
|
import { StubDatabaseAdapterProvider, StubQueryContextProvider } from '@expo/entity-testing-utils';
|
|
7
7
|
|
|
8
|
-
import LocalMemoryCacheAdapterProvider from '../LocalMemoryCacheAdapterProvider';
|
|
8
|
+
import { LocalMemoryCacheAdapterProvider } from '../LocalMemoryCacheAdapterProvider';
|
|
9
9
|
|
|
10
10
|
const queryContextProvider = new StubQueryContextProvider();
|
|
11
11
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CacheAdapterFlavor,
|
|
3
|
-
CacheAdapterFlavorDefinition,
|
|
4
2
|
CacheStatus,
|
|
5
3
|
IEntityGenericCacher,
|
|
6
4
|
SingleFieldHolder,
|
|
7
5
|
SingleFieldValueHolder,
|
|
8
6
|
ViewerContext,
|
|
9
7
|
} from '@expo/entity';
|
|
8
|
+
import { describe, expect, it } from '@jest/globals';
|
|
10
9
|
import { v4 as uuidv4 } from 'uuid';
|
|
11
10
|
|
|
12
|
-
import GenericLocalMemoryCacher from '../GenericLocalMemoryCacher';
|
|
13
|
-
import LocalMemoryCacheAdapterProvider from '../LocalMemoryCacheAdapterProvider';
|
|
14
|
-
import
|
|
11
|
+
import { GenericLocalMemoryCacher } from '../GenericLocalMemoryCacher';
|
|
12
|
+
import { LocalMemoryCacheAdapterProvider } from '../LocalMemoryCacheAdapterProvider';
|
|
13
|
+
import {
|
|
14
|
+
LocalMemoryTestEntity,
|
|
15
15
|
LocalMemoryTestEntityFields,
|
|
16
16
|
} from '../__testfixtures__/LocalMemoryTestEntity';
|
|
17
17
|
import {
|
|
@@ -41,12 +41,9 @@ describe(GenericLocalMemoryCacher, () => {
|
|
|
41
41
|
entity1Created.getID(),
|
|
42
42
|
);
|
|
43
43
|
|
|
44
|
-
const localMemoryCacheAdapterProvider = (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
CacheAdapterFlavorDefinition
|
|
48
|
-
>
|
|
49
|
-
).get('local-memory')!.cacheAdapterProvider as LocalMemoryCacheAdapterProvider;
|
|
44
|
+
const localMemoryCacheAdapterProvider = entityCompanionProvider['cacheAdapterFlavors'].get(
|
|
45
|
+
'local-memory',
|
|
46
|
+
)!.cacheAdapterProvider as LocalMemoryCacheAdapterProvider;
|
|
50
47
|
const entitySpecificGenericCacher = localMemoryCacheAdapterProvider[
|
|
51
48
|
'localMemoryCacheAdapterMap'
|
|
52
49
|
].get(
|
|
@@ -143,12 +140,9 @@ describe(GenericLocalMemoryCacher, () => {
|
|
|
143
140
|
entity1Created.getID(),
|
|
144
141
|
);
|
|
145
142
|
|
|
146
|
-
const localMemoryCacheAdapterProvider = (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
CacheAdapterFlavorDefinition
|
|
150
|
-
>
|
|
151
|
-
).get('local-memory')!.cacheAdapterProvider as LocalMemoryCacheAdapterProvider;
|
|
143
|
+
const localMemoryCacheAdapterProvider = entityCompanionProvider['cacheAdapterFlavors'].get(
|
|
144
|
+
'local-memory',
|
|
145
|
+
)!.cacheAdapterProvider as LocalMemoryCacheAdapterProvider;
|
|
152
146
|
const entitySpecificGenericCacher = localMemoryCacheAdapterProvider[
|
|
153
147
|
'localMemoryCacheAdapterMap'
|
|
154
148
|
].get(
|
|
@@ -7,9 +7,11 @@ import {
|
|
|
7
7
|
SingleFieldValueHolderMap,
|
|
8
8
|
UUIDField,
|
|
9
9
|
} from '@expo/entity';
|
|
10
|
+
import { describe, expect, it } from '@jest/globals';
|
|
10
11
|
|
|
11
|
-
import
|
|
12
|
+
import {
|
|
12
13
|
DOES_NOT_EXIST_LOCAL_MEMORY_CACHE,
|
|
14
|
+
GenericLocalMemoryCacher,
|
|
13
15
|
} from '../GenericLocalMemoryCacher';
|
|
14
16
|
|
|
15
17
|
type BlahFields = {
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,5 @@
|
|
|
4
4
|
* @module @expo/entity-cache-adapter-local-memory
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export { default as GenericLocalMemoryCacher } from './GenericLocalMemoryCacher';
|
|
8
7
|
export * from './GenericLocalMemoryCacher';
|
|
9
|
-
export
|
|
8
|
+
export * from './LocalMemoryCacheAdapterProvider';
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020-present 650 Industries, Inc. (aka Expo)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GenericLocalMemoryCacher.js","sourceRoot":"","sources":["../src/GenericLocalMemoryCacher.ts"],"names":[],"mappings":";;;;;;AAAA,yCAOsB;AACtB,0DAAiC;AAEjC,+EAA+E;AAC/E,qEAAqE;AACxD,QAAA,iCAAiC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AASxE,MAAqB,wBAAwB;IAMxB;IACA;IAFnB,YACmB,mBAA2D,EAC3D,gBAA2C;QAD3C,wBAAmB,GAAnB,mBAAmB,CAAwC;QAC3D,qBAAgB,GAAhB,gBAAgB,CAA2B;IAC3D,CAAC;IAEJ,MAAM,CAAC,cAAc,CACnB,UAAqD,EAAE;QAEvD,MAAM,iCAAiC,GAAG,EAAE,CAAC;QAC7C,MAAM,sBAAsB,GAAG,KAAK,CAAC;QACrC,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,IAAI,iCAAiC,CAAC;QAC9E,OAAO,IAAI,mBAAQ,CAAyC;YAC1D,GAAG,EAAE,OAAO,CAAC,OAAO,IAAI,sBAAsB;YAC9C,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,K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/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* @module @expo/entity-cache-adapter-local-memory
|
|
4
|
-
*/
|
|
5
|
-
export { default as GenericLocalMemoryCacher } from './GenericLocalMemoryCacher';
|
|
6
|
-
export * from './GenericLocalMemoryCacher';
|
|
7
|
-
export { default as LocalMemoryCacheAdapterProvider } from './LocalMemoryCacheAdapterProvider';
|
package/build/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC;;;GAGG;;;;;;;;;;;;;;;;;;;;AAEH,uEAAiF;AAAxE,qJAAA,OAAO,OAA4B;AAC5C,6DAA2C;AAC3C,qFAA+F;AAAtF,mKAAA,OAAO,OAAmC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["../src/genericlocalmemorycacher.ts","../src/localmemorycacheadapterprovider.ts","../src/index.ts"],"version":"5.8.3"}
|