mirror of
https://github.com/expo/entity.git
synced 2026-11-21 10:19:25 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
833e2e8c55 | ||
|
|
1a7dfadf64 | ||
|
|
767d9513ff | ||
|
|
c4537262d8 |
No files matched your search
@@ -3,6 +3,16 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package root
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
### Features
|
||||
|
||||
- switch local cache to an interface ([#322](https://github.com/expo/entity/issues/322)) ([c453726](https://github.com/expo/entity/commit/c4537262d810ea01e519f9aec6ae5b17a54ce936))
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"packages": ["packages/*"],
|
||||
"npmClient": "yarn",
|
||||
"version": "0.51.0"
|
||||
"version": "0.53.0"
|
||||
}
|
||||
+6
-3
@@ -22,11 +22,11 @@
|
||||
"@babel/core": "^7.28.5",
|
||||
"@babel/preset-env": "^7.28.5",
|
||||
"@babel/preset-typescript": "^7.28.5",
|
||||
"@tsconfig/node20": "^20.1.6",
|
||||
"@tsconfig/node24": "^24.0.3",
|
||||
"@tsconfig/strictest": "^2.0.7",
|
||||
"@types/babel__core": "^7.20.5",
|
||||
"@types/babel__preset-env": "^7.10.0",
|
||||
"@types/node": "20.19.1",
|
||||
"@types/node": "^24.10.2",
|
||||
"ctix": "^2.7.1",
|
||||
"eslint": "^9.29.0",
|
||||
"eslint-config-universe": "^15.0.3",
|
||||
@@ -38,8 +38,11 @@
|
||||
"typedoc": "^0.28.14",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"resolutions": {
|
||||
"collect-v8-coverage": "^1.0.3"
|
||||
},
|
||||
"volta": {
|
||||
"node": "20.14.0"
|
||||
"node": "24.11.1"
|
||||
},
|
||||
"packageManager": "[email protected]"
|
||||
}
|
||||
@@ -3,6 +3,16 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-cache-adapter-local-memory
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
### Features
|
||||
|
||||
- switch local cache to an interface ([#322](https://github.com/expo/entity/issues/322)) ([c453726](https://github.com/expo/entity/commit/c4537262d810ea01e519f9aec6ae5b17a54ce936))
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-cache-adapter-local-memory
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/entity-cache-adapter-local-memory",
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "Cross-request local memory cache adapter for @expo/entity",
|
||||
"files": [
|
||||
"build",
|
||||
@@ -28,13 +28,12 @@
|
||||
"author": "Expo",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@expo/entity": "workspace:^",
|
||||
"lru-cache": "^6.0.0"
|
||||
"@expo/entity": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@expo/entity-testing-utils": "workspace:^",
|
||||
"@isaacs/ttlcache": "^2.1.3",
|
||||
"@jest/globals": "^30.2.0",
|
||||
"@types/lru-cache": "^5.1.1",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
@@ -6,18 +6,44 @@ import {
|
||||
IEntityLoadKey,
|
||||
IEntityLoadValue,
|
||||
} from '@expo/entity';
|
||||
import LRUCache from 'lru-cache';
|
||||
|
||||
// Sentinel value we store in local memory to negatively cache a database miss.
|
||||
// The sentinel value is distinct from any (positively) cached value.
|
||||
export const DOES_NOT_EXIST_LOCAL_MEMORY_CACHE = Symbol('doesNotExist');
|
||||
|
||||
/**
|
||||
* Type of value stored in the local memory cache. This is either the cached fields, or the
|
||||
* DOES_NOT_EXIST_LOCAL_MEMORY_CACHE sentinel value.
|
||||
*/
|
||||
export type LocalMemoryCacheValue<TFields extends Record<string, any>> =
|
||||
| Readonly<TFields>
|
||||
| typeof DOES_NOT_EXIST_LOCAL_MEMORY_CACHE;
|
||||
export type LocalMemoryCache<TFields extends Record<string, any>> = LRUCache<
|
||||
string,
|
||||
LocalMemoryCacheValue<TFields>
|
||||
>;
|
||||
|
||||
/**
|
||||
* Interface for a local memory cache used by GenericLocalMemoryCacher. Most often, this is something like
|
||||
* a TTLCache from the `@isaacs/ttlcache` package or an lru-cache.
|
||||
*/
|
||||
export interface ILocalMemoryCache<TFields extends Record<string, any>> {
|
||||
/**
|
||||
* Gets a value from the cache for specified key.
|
||||
* @param key - key to get
|
||||
* @returns the cached value, or undefined if not present
|
||||
*/
|
||||
get(key: string): LocalMemoryCacheValue<TFields> | undefined;
|
||||
|
||||
/**
|
||||
* Sets a value in the cache for specified key.
|
||||
* @param key - key to set
|
||||
* @param value - value to set
|
||||
*/
|
||||
set(key: string, value: LocalMemoryCacheValue<TFields>): void;
|
||||
|
||||
/**
|
||||
* Deletes a value from the cache for specified key.
|
||||
* @param key - key to delete
|
||||
*/
|
||||
delete(key: string): void;
|
||||
}
|
||||
|
||||
export class GenericLocalMemoryCacher<
|
||||
TFields extends Record<string, any>,
|
||||
@@ -26,27 +52,17 @@ export class GenericLocalMemoryCacher<
|
||||
{
|
||||
constructor(
|
||||
private readonly entityConfiguration: EntityConfiguration<TFields, TIDField>,
|
||||
private readonly localMemoryCache: LocalMemoryCache<TFields>,
|
||||
private readonly localMemoryCache: ILocalMemoryCache<TFields>,
|
||||
) {}
|
||||
|
||||
static createLRUCache<TFields extends Record<string, any>>(
|
||||
options: { maxSize?: number; ttlSeconds?: number } = {},
|
||||
): LocalMemoryCache<TFields> {
|
||||
const DEFAULT_LRU_CACHE_MAX_AGE_SECONDS = 10;
|
||||
const DEFAULT_LRU_CACHE_SIZE = 10000;
|
||||
const maxAgeSeconds = options.ttlSeconds ?? DEFAULT_LRU_CACHE_MAX_AGE_SECONDS;
|
||||
return new LRUCache<string, LocalMemoryCacheValue<TFields>>({
|
||||
max: options.maxSize ?? DEFAULT_LRU_CACHE_SIZE,
|
||||
length: (value) => (value === DOES_NOT_EXIST_LOCAL_MEMORY_CACHE ? 0 : 1),
|
||||
maxAge: maxAgeSeconds * 1000, // convert to ms
|
||||
});
|
||||
}
|
||||
|
||||
static createNoOpCache<TFields extends Record<string, any>>(): LocalMemoryCache<TFields> {
|
||||
return new LRUCache<string, LocalMemoryCacheValue<TFields>>({
|
||||
max: 0,
|
||||
maxAge: -1,
|
||||
});
|
||||
static createNoOpCache<TFields extends Record<string, any>>(): ILocalMemoryCache<TFields> {
|
||||
return {
|
||||
get(_key: string): LocalMemoryCacheValue<TFields> | undefined {
|
||||
return undefined;
|
||||
},
|
||||
set(_key: string, _value: LocalMemoryCacheValue<TFields>): void {},
|
||||
delete(_key: string): void {},
|
||||
};
|
||||
}
|
||||
|
||||
public async loadManyAsync(
|
||||
@@ -87,7 +103,7 @@ export class GenericLocalMemoryCacher<
|
||||
|
||||
public async invalidateManyAsync(keys: readonly string[]): Promise<void> {
|
||||
for (const key of keys) {
|
||||
this.localMemoryCache.del(key);
|
||||
this.localMemoryCache.delete(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,18 @@ import {
|
||||
IEntityCacheAdapterProvider,
|
||||
} from '@expo/entity';
|
||||
|
||||
import { GenericLocalMemoryCacher, LocalMemoryCache } from './GenericLocalMemoryCacher';
|
||||
import { GenericLocalMemoryCacher, ILocalMemoryCache } from './GenericLocalMemoryCacher';
|
||||
|
||||
export type LocalMemoryCacheCreator = <
|
||||
TFields extends Record<string, any>,
|
||||
>() => ILocalMemoryCache<TFields>;
|
||||
/**
|
||||
* Vends local memory cache adapters. An instance of this class may be shared across requests to
|
||||
* share the local memory cache.
|
||||
*/
|
||||
export class LocalMemoryCacheAdapterProvider implements IEntityCacheAdapterProvider {
|
||||
/**
|
||||
* @returns a no-op local memory cache adapter provider, or one that doesn't cache locally.
|
||||
* @returns a no-op local memory cache adapter provider, or one that doesn't cache at all.
|
||||
*/
|
||||
static createNoOpProvider(): IEntityCacheAdapterProvider {
|
||||
return new LocalMemoryCacheAdapterProvider(<TFields extends Record<string, any>>() =>
|
||||
@@ -23,14 +26,12 @@ export class LocalMemoryCacheAdapterProvider implements IEntityCacheAdapterProvi
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns a local memory cache adapter provider configured with the supplied options.
|
||||
* @returns a local memory cache adapter provider configured with the supplied local memory cache creator function.
|
||||
*/
|
||||
static createProviderWithOptions(
|
||||
options: { maxSize?: number; ttlSeconds?: number } = {},
|
||||
static createProviderWithCacheCreator(
|
||||
cacheCreator: LocalMemoryCacheCreator,
|
||||
): IEntityCacheAdapterProvider {
|
||||
return new LocalMemoryCacheAdapterProvider(<TFields extends Record<string, any>>() =>
|
||||
GenericLocalMemoryCacher.createLRUCache<TFields>(options),
|
||||
);
|
||||
return new LocalMemoryCacheAdapterProvider(cacheCreator);
|
||||
}
|
||||
|
||||
private readonly localMemoryCacheAdapterMap = new Map<
|
||||
@@ -38,11 +39,7 @@ export class LocalMemoryCacheAdapterProvider implements IEntityCacheAdapterProvi
|
||||
GenericEntityCacheAdapter<any, any>
|
||||
>();
|
||||
|
||||
private constructor(
|
||||
private readonly localMemoryCacheCreator: <
|
||||
TFields extends Record<string, any>,
|
||||
>() => LocalMemoryCache<TFields>,
|
||||
) {}
|
||||
private constructor(private readonly localMemoryCacheCreator: LocalMemoryCacheCreator) {}
|
||||
|
||||
public getCacheAdapter<TFields extends Record<string, any>, TIDField extends keyof TFields>(
|
||||
entityConfiguration: EntityConfiguration<TFields, TIDField>,
|
||||
|
||||
+18
-1
@@ -4,11 +4,26 @@ import {
|
||||
NoOpEntityMetricsAdapter,
|
||||
} from '@expo/entity';
|
||||
import { StubDatabaseAdapterProvider, StubQueryContextProvider } from '@expo/entity-testing-utils';
|
||||
import { TTLCache } from '@isaacs/ttlcache';
|
||||
|
||||
import { ILocalMemoryCache, LocalMemoryCacheValue } from '../GenericLocalMemoryCacher';
|
||||
import { LocalMemoryCacheAdapterProvider } from '../LocalMemoryCacheAdapterProvider';
|
||||
|
||||
const queryContextProvider = new StubQueryContextProvider();
|
||||
|
||||
function createTTLCache<TFields extends Record<string, any>>(
|
||||
options: { maxSize?: number; ttlSeconds?: number } = {},
|
||||
): ILocalMemoryCache<TFields> {
|
||||
const DEFAULT_LRU_CACHE_MAX_AGE_SECONDS = 10;
|
||||
const DEFAULT_LRU_CACHE_SIZE = 10000;
|
||||
const maxAgeSeconds = options.ttlSeconds ?? DEFAULT_LRU_CACHE_MAX_AGE_SECONDS;
|
||||
return new TTLCache<string, LocalMemoryCacheValue<TFields>>({
|
||||
max: options.maxSize ?? DEFAULT_LRU_CACHE_SIZE,
|
||||
ttl: maxAgeSeconds * 1000, // convert to ms
|
||||
updateAgeOnGet: true,
|
||||
});
|
||||
}
|
||||
|
||||
export const createLocalMemoryTestEntityCompanionProvider = (
|
||||
localMemoryOptions: { maxSize?: number; ttlSeconds?: number } = {},
|
||||
metricsAdapter: IEntityMetricsAdapter = new NoOpEntityMetricsAdapter(),
|
||||
@@ -16,7 +31,9 @@ export const createLocalMemoryTestEntityCompanionProvider = (
|
||||
const localMemoryCacheAdapterProvider =
|
||||
localMemoryOptions.maxSize === 0 && localMemoryOptions.ttlSeconds === 0
|
||||
? LocalMemoryCacheAdapterProvider.createNoOpProvider()
|
||||
: LocalMemoryCacheAdapterProvider.createProviderWithOptions(localMemoryOptions);
|
||||
: LocalMemoryCacheAdapterProvider.createProviderWithCacheCreator(() =>
|
||||
createTTLCache(localMemoryOptions),
|
||||
);
|
||||
return new EntityCompanionProvider(
|
||||
metricsAdapter,
|
||||
new Map([
|
||||
|
||||
+15
-40
@@ -7,11 +7,14 @@ import {
|
||||
SingleFieldValueHolderMap,
|
||||
UUIDField,
|
||||
} from '@expo/entity';
|
||||
import { TTLCache } from '@isaacs/ttlcache';
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
|
||||
import {
|
||||
DOES_NOT_EXIST_LOCAL_MEMORY_CACHE,
|
||||
GenericLocalMemoryCacher,
|
||||
ILocalMemoryCache,
|
||||
LocalMemoryCacheValue,
|
||||
} from '../GenericLocalMemoryCacher';
|
||||
|
||||
type BlahFields = {
|
||||
@@ -28,41 +31,19 @@ const entityConfiguration = new EntityConfiguration<BlahFields, 'id'>({
|
||||
cacheAdapterFlavor: 'local-memory',
|
||||
});
|
||||
|
||||
describe(GenericLocalMemoryCacher, () => {
|
||||
describe(GenericLocalMemoryCacher.createLRUCache, () => {
|
||||
it('creates a cache with default options', () => {
|
||||
const cache = GenericLocalMemoryCacher.createLRUCache();
|
||||
expect(cache.max).toBe(10000);
|
||||
expect(cache.maxAge).toBe(10000);
|
||||
});
|
||||
|
||||
it('respects specified options', () => {
|
||||
const cache = GenericLocalMemoryCacher.createLRUCache({
|
||||
ttlSeconds: 3,
|
||||
maxSize: 10,
|
||||
});
|
||||
expect(cache.max).toBe(10);
|
||||
expect(cache.maxAge).toBe(3000);
|
||||
});
|
||||
function createTTLCache<TFields extends Record<string, any>>(): ILocalMemoryCache<TFields> {
|
||||
return new TTLCache<string, LocalMemoryCacheValue<TFields>>({
|
||||
max: 10000,
|
||||
ttl: 10 * 1000, // convert to ms
|
||||
updateAgeOnGet: true,
|
||||
});
|
||||
|
||||
describe(GenericLocalMemoryCacher.createNoOpCache, () => {
|
||||
it('creates a no-op cache', () => {
|
||||
const cache = GenericLocalMemoryCacher.createNoOpCache<{ hello: 'world' }>();
|
||||
cache.set('a', { hello: 'world' });
|
||||
expect(cache.get('a')).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
describe('Use within GenericEntityCacheAdapter', () => {
|
||||
describe('loadManyAsync', () => {
|
||||
it('returns appropriate cache results', async () => {
|
||||
const cacheAdapter = new GenericEntityCacheAdapter(
|
||||
new GenericLocalMemoryCacher(
|
||||
entityConfiguration,
|
||||
GenericLocalMemoryCacher.createLRUCache(),
|
||||
),
|
||||
new GenericLocalMemoryCacher(entityConfiguration, createTTLCache()),
|
||||
);
|
||||
|
||||
const cacheHits = new Map<SingleFieldValueHolder<BlahFields, 'id'>, Readonly<BlahFields>>([
|
||||
@@ -97,10 +78,7 @@ describe('Use within GenericEntityCacheAdapter', () => {
|
||||
|
||||
it('returns empty map when passed empty array of values', async () => {
|
||||
const cacheAdapter = new GenericEntityCacheAdapter(
|
||||
new GenericLocalMemoryCacher(
|
||||
entityConfiguration,
|
||||
GenericLocalMemoryCacher.createLRUCache(),
|
||||
),
|
||||
new GenericLocalMemoryCacher(entityConfiguration, createTTLCache()),
|
||||
);
|
||||
const results = await cacheAdapter.loadManyAsync(
|
||||
new SingleFieldHolder<BlahFields, 'id', 'id'>('id'),
|
||||
@@ -112,7 +90,7 @@ describe('Use within GenericEntityCacheAdapter', () => {
|
||||
|
||||
describe('cacheManyAsync', () => {
|
||||
it('correctly caches all objects', async () => {
|
||||
const localMemoryCache = GenericLocalMemoryCacher.createLRUCache<BlahFields>({});
|
||||
const localMemoryCache = createTTLCache<BlahFields>();
|
||||
|
||||
const localMemoryCacher = new GenericLocalMemoryCacher(entityConfiguration, localMemoryCache);
|
||||
const cacheAdapter = new GenericEntityCacheAdapter(localMemoryCacher);
|
||||
@@ -133,7 +111,7 @@ describe('Use within GenericEntityCacheAdapter', () => {
|
||||
|
||||
describe('cacheDBMissesAsync', () => {
|
||||
it('correctly caches misses', async () => {
|
||||
const localMemoryCache = GenericLocalMemoryCacher.createLRUCache<BlahFields>({});
|
||||
const localMemoryCache = createTTLCache<BlahFields>();
|
||||
|
||||
const localMemoryCacher = new GenericLocalMemoryCacher(entityConfiguration, localMemoryCache);
|
||||
const cacheAdapter = new GenericEntityCacheAdapter(localMemoryCacher);
|
||||
@@ -151,7 +129,7 @@ describe('Use within GenericEntityCacheAdapter', () => {
|
||||
|
||||
describe('invalidateManyAsync', () => {
|
||||
it('invalidates correctly', async () => {
|
||||
const localMemoryCache = GenericLocalMemoryCacher.createLRUCache<BlahFields>({});
|
||||
const localMemoryCache = createTTLCache<BlahFields>();
|
||||
|
||||
const cacheAdapter = new GenericEntityCacheAdapter(
|
||||
new GenericLocalMemoryCacher(entityConfiguration, localMemoryCache),
|
||||
@@ -182,10 +160,7 @@ describe('Use within GenericEntityCacheAdapter', () => {
|
||||
|
||||
it('returns when passed empty array of values', async () => {
|
||||
const cacheAdapter = new GenericEntityCacheAdapter(
|
||||
new GenericLocalMemoryCacher(
|
||||
entityConfiguration,
|
||||
GenericLocalMemoryCacher.createLRUCache<BlahFields>({}),
|
||||
),
|
||||
new GenericLocalMemoryCacher(entityConfiguration, createTTLCache<BlahFields>()),
|
||||
);
|
||||
await cacheAdapter.invalidateManyAsync(
|
||||
new SingleFieldHolder<BlahFields, 'id', 'id'>('id'),
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-cache-adapter-redis
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-cache-adapter-redis
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-cache-adapter-redis
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/entity-cache-adapter-redis",
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "Redis cache adapter for @expo/entity",
|
||||
"files": [
|
||||
"build",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-codemod
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-codemod
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-codemod
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/entity-codemod",
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "jscodeshift codemods for @expo/entity upgrades",
|
||||
"files": [
|
||||
"build",
|
||||
@@ -29,7 +29,7 @@
|
||||
"devDependencies": {
|
||||
"@jest/globals": "^30.2.0",
|
||||
"@types/jscodeshift": "^0.12.0",
|
||||
"@types/node": "^20.19.1",
|
||||
"@types/node": "^24.10.2",
|
||||
"jscodeshift": "^17.3.0",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-database-adapter-knex
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-database-adapter-knex
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-database-adapter-knex
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/entity-database-adapter-knex",
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "Knex database adapter for @expo/entity",
|
||||
"files": [
|
||||
"build",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-example
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-example
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-example
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@expo/entity-example",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "An example integration of the @expo/entity framework",
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-full-integration-tests
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-full-integration-tests
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-full-integration-tests
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@expo/entity-full-integration-tests",
|
||||
"private": true,
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "Full redis and knex integration tests for the entity framework",
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-ip-address-field
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-ip-address-field
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-ip-address-field
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/entity-ip-address-field",
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "IP address EntityField definitions for @expo/entity",
|
||||
"files": [
|
||||
"build",
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-secondary-cache-local-memory
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
### Features
|
||||
|
||||
- switch local cache to an interface ([#322](https://github.com/expo/entity/issues/322)) ([c453726](https://github.com/expo/entity/commit/c4537262d810ea01e519f9aec6ae5b17a54ce936))
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-secondary-cache-local-memory
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/entity-secondary-cache-local-memory",
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "Local memory secondary cache for @expo/entity",
|
||||
"files": [
|
||||
"build",
|
||||
@@ -32,6 +32,7 @@
|
||||
"@expo/entity-cache-adapter-local-memory": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@isaacs/ttlcache": "^2.1.3",
|
||||
"@jest/globals": "^30.0.1",
|
||||
"nullthrows": "^1.1.1",
|
||||
"typescript": "^5.9.3"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EntityConfiguration, GenericSecondaryEntityCache } from '@expo/entity';
|
||||
import {
|
||||
GenericLocalMemoryCacher,
|
||||
LocalMemoryCache,
|
||||
ILocalMemoryCache,
|
||||
} from '@expo/entity-cache-adapter-local-memory';
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ export class LocalMemorySecondaryEntityCache<
|
||||
> extends GenericSecondaryEntityCache<TFields, TIDField, TLoadParams> {
|
||||
constructor(
|
||||
entityConfiguration: EntityConfiguration<TFields, TIDField>,
|
||||
localMemoryCache: LocalMemoryCache<TFields>,
|
||||
localMemoryCache: ILocalMemoryCache<TFields>,
|
||||
) {
|
||||
super(new GenericLocalMemoryCacher(entityConfiguration, localMemoryCache), (params) =>
|
||||
JSON.stringify(params),
|
||||
|
||||
+15
-4
@@ -14,10 +14,12 @@ import {
|
||||
ViewerContext,
|
||||
} from '@expo/entity';
|
||||
import {
|
||||
GenericLocalMemoryCacher,
|
||||
ILocalMemoryCache,
|
||||
LocalMemoryCacheAdapterProvider,
|
||||
LocalMemoryCacheValue,
|
||||
} from '@expo/entity-cache-adapter-local-memory';
|
||||
import { StubDatabaseAdapterProvider, StubQueryContextProvider } from '@expo/entity-testing-utils';
|
||||
import { TTLCache } from '@isaacs/ttlcache';
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
@@ -109,6 +111,14 @@ export const localMemoryTestEntityConfiguration = new EntityConfiguration<
|
||||
|
||||
const queryContextProvider = new StubQueryContextProvider();
|
||||
|
||||
function createTTLCache<TFields extends Record<string, any>>(): ILocalMemoryCache<TFields> {
|
||||
return new TTLCache<string, LocalMemoryCacheValue<TFields>>({
|
||||
max: 10000,
|
||||
ttl: 10 * 1000, // convert to ms
|
||||
updateAgeOnGet: true,
|
||||
});
|
||||
}
|
||||
|
||||
export const createTestEntityCompanionProvider = (
|
||||
metricsAdapter: IEntityMetricsAdapter = new NoOpEntityMetricsAdapter(),
|
||||
): EntityCompanionProvider => {
|
||||
@@ -127,7 +137,8 @@ export const createTestEntityCompanionProvider = (
|
||||
[
|
||||
'local-memory',
|
||||
{
|
||||
cacheAdapterProvider: LocalMemoryCacheAdapterProvider.createProviderWithOptions(),
|
||||
cacheAdapterProvider:
|
||||
LocalMemoryCacheAdapterProvider.createProviderWithCacheCreator(createTTLCache),
|
||||
},
|
||||
],
|
||||
]),
|
||||
@@ -184,7 +195,7 @@ describe(LocalMemorySecondaryEntityCache, () => {
|
||||
const secondaryCacheLoader = new TestSecondaryLocalMemoryCacheLoader(
|
||||
new LocalMemorySecondaryEntityCache(
|
||||
localMemoryTestEntityConfiguration,
|
||||
GenericLocalMemoryCacher.createLRUCache<LocalMemoryTestEntityFields>({}),
|
||||
createTTLCache<LocalMemoryTestEntityFields>(),
|
||||
),
|
||||
LocalMemoryTestEntity.loaderWithAuthorizationResults(viewerContext),
|
||||
);
|
||||
@@ -220,7 +231,7 @@ describe(LocalMemorySecondaryEntityCache, () => {
|
||||
const secondaryCacheLoader = new TestSecondaryLocalMemoryCacheLoader(
|
||||
new LocalMemorySecondaryEntityCache(
|
||||
localMemoryTestEntityConfiguration,
|
||||
GenericLocalMemoryCacher.createLRUCache<LocalMemoryTestEntityFields>({}),
|
||||
createTTLCache<LocalMemoryTestEntityFields>(),
|
||||
),
|
||||
LocalMemoryTestEntity.loaderWithAuthorizationResults(viewerContext),
|
||||
);
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-secondary-cache-redis
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-secondary-cache-redis
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-secondary-cache-redis
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/entity-secondary-cache-redis",
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "Redis secondary cache for @expo/entity",
|
||||
"files": [
|
||||
"build",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-testing-utils
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity-testing-utils
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/entity-testing-utils",
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "A package containing utilities for testing applications that use Entity",
|
||||
"files": [
|
||||
"build",
|
||||
@@ -37,7 +37,7 @@
|
||||
"devDependencies": {
|
||||
"@jest/globals": "^30.2.0",
|
||||
"@types/lodash": "^4.17.16",
|
||||
"@types/node": "^20.19.1",
|
||||
"@types/node": "^24.10.2",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [0.53.0](https://github.com/expo/entity/compare/v0.52.0...v0.53.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity
|
||||
|
||||
# [0.52.0](https://github.com/expo/entity/compare/v0.51.0...v0.52.0) (2025-12-19)
|
||||
|
||||
**Note:** Version bump only for package @expo/entity
|
||||
|
||||
# [0.51.0](https://github.com/expo/entity/compare/v0.50.0...v0.51.0) (2025-11-21)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/entity",
|
||||
"version": "0.51.0",
|
||||
"version": "0.53.0",
|
||||
"description": "A privacy-first data model",
|
||||
"files": [
|
||||
"build",
|
||||
@@ -36,7 +36,7 @@
|
||||
"@jest/globals": "^30.2.0",
|
||||
"@types/invariant": "^2.2.37",
|
||||
"@types/lodash": "^4.17.20",
|
||||
"@types/node": "^20.19.1",
|
||||
"@types/node": "^24.10.2",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"lodash": "^4.17.21",
|
||||
"ts-mockito": "^2.6.1",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": ["@tsconfig/strictest/tsconfig", "@tsconfig/node20/tsconfig"],
|
||||
"extends": ["@tsconfig/strictest/tsconfig", "@tsconfig/node24/tsconfig"],
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outDir": "${configDir}/build",
|
||||
|
||||
@@ -2581,9 +2581,8 @@ __metadata:
|
||||
dependencies:
|
||||
"@expo/entity": "workspace:^"
|
||||
"@expo/entity-testing-utils": "workspace:^"
|
||||
"@isaacs/ttlcache": "npm:^2.1.3"
|
||||
"@jest/globals": "npm:^30.2.0"
|
||||
"@types/lru-cache": "npm:^5.1.1"
|
||||
lru-cache: "npm:^6.0.0"
|
||||
typescript: "npm:^5.9.3"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
@@ -2610,7 +2609,7 @@ __metadata:
|
||||
dependencies:
|
||||
"@jest/globals": "npm:^30.2.0"
|
||||
"@types/jscodeshift": "npm:^0.12.0"
|
||||
"@types/node": "npm:^20.19.1"
|
||||
"@types/node": "npm:^24.10.2"
|
||||
jscodeshift: "npm:^17.3.0"
|
||||
typescript: "npm:^5.9.3"
|
||||
languageName: unknown
|
||||
@@ -2683,6 +2682,7 @@ __metadata:
|
||||
dependencies:
|
||||
"@expo/entity": "workspace:^"
|
||||
"@expo/entity-cache-adapter-local-memory": "workspace:^"
|
||||
"@isaacs/ttlcache": "npm:^2.1.3"
|
||||
"@jest/globals": "npm:^30.0.1"
|
||||
nullthrows: "npm:^1.1.1"
|
||||
typescript: "npm:^5.9.3"
|
||||
@@ -2709,7 +2709,7 @@ __metadata:
|
||||
"@expo/entity": "workspace:^"
|
||||
"@jest/globals": "npm:^30.2.0"
|
||||
"@types/lodash": "npm:^4.17.16"
|
||||
"@types/node": "npm:^20.19.1"
|
||||
"@types/node": "npm:^24.10.2"
|
||||
lodash: "npm:^4.17.21"
|
||||
ts-mockito: "npm:^2.6.1"
|
||||
typescript: "npm:^5.9.3"
|
||||
@@ -2726,7 +2726,7 @@ __metadata:
|
||||
"@jest/globals": "npm:^30.2.0"
|
||||
"@types/invariant": "npm:^2.2.37"
|
||||
"@types/lodash": "npm:^4.17.20"
|
||||
"@types/node": "npm:^20.19.1"
|
||||
"@types/node": "npm:^24.10.2"
|
||||
"@types/uuid": "npm:^8.3.0"
|
||||
dataloader: "npm:^2.2.3"
|
||||
es6-error: "npm:^4.1.1"
|
||||
@@ -2888,6 +2888,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@isaacs/ttlcache@npm:^2.1.3":
|
||||
version: 2.1.3
|
||||
resolution: "@isaacs/ttlcache@npm:2.1.3"
|
||||
checksum: 10c0/3a8210d37a23e1a671297c2cd0f703303a39a1822e471a484fde5874828c57ce2cd730435ba12579f21e5b295ebaf66a72312d07511cacb8554006fab5e75b81
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@istanbuljs/load-nyc-config@npm:^1.0.0":
|
||||
version: 1.1.0
|
||||
resolution: "@istanbuljs/load-nyc-config@npm:1.1.0"
|
||||
@@ -4282,10 +4289,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@tsconfig/node20@npm:^20.1.6":
|
||||
version: 20.1.6
|
||||
resolution: "@tsconfig/node20@npm:20.1.6"
|
||||
checksum: 10c0/736bca8c405222e78f77da068bf705b398e3afb3f2ec3c1d2a8792505283863bef8cca5646358fcbabd3b07c6fbbf0b1acdf09aa182254fe60eb519827737f09
|
||||
"@tsconfig/node24@npm:^24.0.3":
|
||||
version: 24.0.3
|
||||
resolution: "@tsconfig/node24@npm:24.0.3"
|
||||
checksum: 10c0/68068b503774450d533dda769785356c5722bdc6a3333646fcbcb265e02aafb6d0784619ed85de6d62414df20483428b25bf3d608955ca40b085fb1f12cc26c4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -4637,13 +4644,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/lru-cache@npm:^5.1.1":
|
||||
version: 5.1.1
|
||||
resolution: "@types/lru-cache@npm:5.1.1"
|
||||
checksum: 10c0/1f17ec9b202c01a89337cc5528198a690be6b61a6688242125fbfb7fa17770e453e00e4685021abf5ae605860ca0722209faac5c254b780d0104730bb0b9e354
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/mime@npm:^1":
|
||||
version: 1.3.2
|
||||
resolution: "@types/mime@npm:1.3.2"
|
||||
@@ -4682,12 +4682,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:20.19.1, @types/node@npm:^20.19.1":
|
||||
version: 20.19.1
|
||||
resolution: "@types/node@npm:20.19.1"
|
||||
"@types/node@npm:^24.10.2":
|
||||
version: 24.10.2
|
||||
resolution: "@types/node@npm:24.10.2"
|
||||
dependencies:
|
||||
undici-types: "npm:~6.21.0"
|
||||
checksum: 10c0/4f1c3c8ec24c79af6802b376fa307904abf19accb9ac291de0bfc02220494c8b027d3ef733dbf64cc09b37594f22f679a15eabb30f3785bcfcc13bd9bbd8c0e2
|
||||
undici-types: "npm:~7.16.0"
|
||||
checksum: 10c0/560c894e1a9bf7468718ceca8cd520361fd0d3fcc0b020c2f028fc722b28b5b56aecd16736a9b753d52a14837c066cf23480a8582ead59adc63a7e4333bc976c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -6341,10 +6341,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"collect-v8-coverage@npm:^1.0.2":
|
||||
version: 1.0.2
|
||||
resolution: "collect-v8-coverage@npm:1.0.2"
|
||||
checksum: 10c0/ed7008e2e8b6852c5483b444a3ae6e976e088d4335a85aa0a9db2861c5f1d31bd2d7ff97a60469b3388deeba661a619753afbe201279fb159b4b9548ab8269a1
|
||||
"collect-v8-coverage@npm:^1.0.3":
|
||||
version: 1.0.3
|
||||
resolution: "collect-v8-coverage@npm:1.0.3"
|
||||
checksum: 10c0/bc62ba251bcce5e3354a8f88fa6442bee56e3e612fec08d4dfcf66179b41ea0bf544b0f78c4ebc0f8050871220af95bb5c5578a6aef346feea155640582f09dc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -13662,11 +13662,11 @@ __metadata:
|
||||
"@babel/core": "npm:^7.28.5"
|
||||
"@babel/preset-env": "npm:^7.28.5"
|
||||
"@babel/preset-typescript": "npm:^7.28.5"
|
||||
"@tsconfig/node20": "npm:^20.1.6"
|
||||
"@tsconfig/node24": "npm:^24.0.3"
|
||||
"@tsconfig/strictest": "npm:^2.0.7"
|
||||
"@types/babel__core": "npm:^7.20.5"
|
||||
"@types/babel__preset-env": "npm:^7.10.0"
|
||||
"@types/node": "npm:20.19.1"
|
||||
"@types/node": "npm:^24.10.2"
|
||||
ctix: "npm:^2.7.1"
|
||||
eslint: "npm:^9.29.0"
|
||||
eslint-config-universe: "npm:^15.0.3"
|
||||
@@ -15082,10 +15082,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"undici-types@npm:~6.21.0":
|
||||
version: 6.21.0
|
||||
resolution: "undici-types@npm:6.21.0"
|
||||
checksum: 10c0/c01ed51829b10aa72fc3ce64b747f8e74ae9b60eafa19a7b46ef624403508a54c526ffab06a14a26b3120d055e1104d7abe7c9017e83ced038ea5cf52f8d5e04
|
||||
"undici-types@npm:~7.16.0":
|
||||
version: 7.16.0
|
||||
resolution: "undici-types@npm:7.16.0"
|
||||
checksum: 10c0/3033e2f2b5c9f1504bdc5934646cb54e37ecaca0f9249c983f7b1fc2e87c6d18399ebb05dc7fd5419e02b2e915f734d872a65da2e3eeed1813951c427d33cc9a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in new issue
Block a user