@furystack/core
Advanced tools
Comparing version 11.2.0 to 11.2.1
@@ -7,23 +7,3 @@ "use strict"; | ||
/** | ||
* Creates an InMemoryStore that can be used for testing purposes. | ||
* | ||
* @param options Options for the In Memory Store | ||
* @param options.primaryKey The name of the primary key field | ||
* @param options.model The Entity Model | ||
*/ | ||
constructor(options) { | ||
this.cache = new Map(); | ||
this.get = async (key, select) => { | ||
const item = this.cache.get(key); | ||
return item && select ? (0, physical_store_1.selectFields)(item, ...select) : item; | ||
}; | ||
this.evaluateLike = (value, likeString) => { | ||
const likeRegex = `^${likeString.replace(/%/g, '.*')}$`; | ||
return value.match(new RegExp(likeRegex, 'i')); | ||
}; | ||
this.primaryKey = options.primaryKey; | ||
this.model = options.model; | ||
} | ||
/** | ||
* | ||
* @param keys The keys to remove from the store | ||
@@ -189,4 +169,24 @@ */ | ||
} | ||
/** | ||
* Creates an InMemoryStore that can be used for testing purposes. | ||
* | ||
* @param options Options for the In Memory Store | ||
* @param options.primaryKey The name of the primary key field | ||
* @param options.model The Entity Model | ||
*/ | ||
constructor(options) { | ||
this.cache = new Map(); | ||
this.get = async (key, select) => { | ||
const item = this.cache.get(key); | ||
return item && select ? (0, physical_store_1.selectFields)(item, ...select) : item; | ||
}; | ||
this.evaluateLike = (value, likeString) => { | ||
const likeRegex = `^${likeString.replace(/%/g, '.*')}$`; | ||
return value.match(new RegExp(likeRegex, 'i')); | ||
}; | ||
this.primaryKey = options.primaryKey; | ||
this.model = options.model; | ||
} | ||
} | ||
exports.InMemoryStore = InMemoryStore; | ||
//# sourceMappingURL=in-memory-store.js.map |
{ | ||
"name": "@furystack/core", | ||
"version": "11.2.0", | ||
"version": "11.2.1", | ||
"description": "Core FuryStack package", | ||
@@ -29,8 +29,8 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/jest": "^29.2.2", | ||
"@types/jest": "^29.2.3", | ||
"@types/node": "^18.11.9" | ||
}, | ||
"dependencies": { | ||
"@furystack/inject": "^7.1.2", | ||
"@furystack/utils": "^3.1.2", | ||
"@furystack/inject": "^7.1.3", | ||
"@furystack/utils": "^3.1.3", | ||
"semaphore-async-await": "^1.5.1" | ||
@@ -37,0 +37,0 @@ }, |
@@ -9,3 +9,3 @@ import type { Constructable } from '@furystack/inject'; | ||
export declare const allOperators: readonly ["$eq", "$ne", "$gt", "$gte", "$lt", "$lte", "$in", "$nin", "$and", "$not", "$nor", "$or", "$startsWith", "$endsWith", "$like", "$regex"]; | ||
export declare type FilterType<T> = { | ||
export type FilterType<T> = { | ||
[K in keyof T]?: (T[K] extends string ? { | ||
@@ -33,3 +33,3 @@ [SCO in typeof StringComparisonOperators[number]]?: T[K]; | ||
} | ||
export declare type WithOptionalId<T, TPrimaryKey extends keyof T> = Omit<T, TPrimaryKey> & { | ||
export type WithOptionalId<T, TPrimaryKey extends keyof T> = Omit<T, TPrimaryKey> & { | ||
[K in TPrimaryKey]?: T[K]; | ||
@@ -64,3 +64,3 @@ }; | ||
} | ||
export declare type PartialResult<T, TFields extends Array<keyof T>> = Pick<T, TFields[number]>; | ||
export type PartialResult<T, TFields extends Array<keyof T>> = Pick<T, TFields[number]>; | ||
export declare const selectFields: <T extends object, TField extends (keyof T)[]>(entry: T, ...fields: TField) => PartialResult<T, TField>; | ||
@@ -67,0 +67,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
199160
Updated@furystack/inject@^7.1.3
Updated@furystack/utils@^3.1.3