@karmaniverous/entity-manager
Advanced tools
Comparing version 6.4.7 to 6.4.8
'use strict'; | ||
var BaseShardQueryMapBuilder = require('./BaseShardQueryMapBuilder.js'); | ||
var conditionalize = require('./conditionalize.js'); | ||
@@ -9,4 +8,3 @@ var EntityManager = require('./EntityManager.js'); | ||
exports.BaseShardQueryMapBuilder = BaseShardQueryMapBuilder.BaseShardQueryMapBuilder; | ||
exports.conditionalize = conditionalize.conditionalize; | ||
exports.EntityManager = EntityManager.EntityManager; |
@@ -6,62 +6,2 @@ import { Entity, Exactify, TranscodeMap, PropertiesOfType, TranscodableProperties, Transcodes, DefaultTranscodeMap, SortOrder } from '@karmaniverous/entity-tools'; | ||
/** | ||
* {@link BaseShardQueryMapBuilder | `BaseShardQueryMapBuilder`} options. | ||
* | ||
* @category Query | ||
*/ | ||
interface BaseShardQueryMapBuilderOptions { | ||
/** `entityManager.config.entities` key. */ | ||
entityToken: string; | ||
/** Either the designated entity hash key or a generated property with `sharded === true`. */ | ||
hashKeyToken: string; | ||
/** Dehydrated page key from the previous query data page. */ | ||
pageKey?: string; | ||
} | ||
/** | ||
* A result returned by a {@link ShardQueryFunction | `ShardQueryFunction`} querying an individual shard. | ||
* | ||
* @typeParam Item - The {@link Item | `Item`} type being queried. | ||
* @category Query | ||
*/ | ||
interface ShardQueryResult<Item extends Entity> { | ||
/** The number of records returned. */ | ||
count: number; | ||
/** The returned records. */ | ||
items: Item[]; | ||
/** The page key for the next query on this shard. */ | ||
pageKey?: Partial<Item>; | ||
} | ||
/** | ||
* A query function that returns a single page of results from an individual | ||
* shard. This function will typically be composed dynamically to express a | ||
* specific query index & logic. The arguments to this function will be | ||
* provided by the {@link EntityManager.query | `EntityManager.query`} method, which assembles many returned | ||
* pages queried across multiple shards into a single query result. | ||
* | ||
* @typeParam Item - The {@link Item | `Item`} type being queried. | ||
* @param hashKey - The hash key value of the shard being queried. | ||
* @param pageKey - The page key returned by the previous query on this shard. | ||
* @param pageSize - The maximum number of items to return from this query. | ||
* | ||
* @category Query | ||
*/ | ||
type ShardQueryFunction<Item extends Entity> = (hashKey: string, pageKey?: Partial<Item>, pageSize?: number) => Promise<ShardQueryResult<Item>>; | ||
type ShardQueryMap<Item extends Entity> = Record<string, ShardQueryFunction<Item>>; | ||
/** | ||
* Entity Manager shard query builder base class. | ||
* | ||
* @category Query | ||
*/ | ||
declare abstract class BaseShardQueryMapBuilder<Item extends Entity, Options extends BaseShardQueryMapBuilderOptions> { | ||
readonly options: Options; | ||
constructor(options: Options); | ||
abstract getShardQueryMap(): ShardQueryMap<Item>; | ||
} | ||
/** | ||
* Transforms a function such that it only executes when `condition` is truthy. | ||
@@ -694,2 +634,37 @@ * | ||
/** | ||
* A result returned by a {@link ShardQueryFunction | `ShardQueryFunction`} querying an individual shard. | ||
* | ||
* @typeParam Item - The {@link Item | `Item`} type being queried. | ||
* @category Query | ||
*/ | ||
interface ShardQueryResult<Item extends Entity> { | ||
/** The number of records returned. */ | ||
count: number; | ||
/** The returned records. */ | ||
items: Item[]; | ||
/** The page key for the next query on this shard. */ | ||
pageKey?: Partial<Item>; | ||
} | ||
/** | ||
* A query function that returns a single page of results from an individual | ||
* shard. This function will typically be composed dynamically to express a | ||
* specific query index & logic. The arguments to this function will be | ||
* provided by the {@link EntityManager.query | `EntityManager.query`} method, which assembles many returned | ||
* pages queried across multiple shards into a single query result. | ||
* | ||
* @typeParam Item - The {@link Item | `Item`} type being queried. | ||
* @param hashKey - The hash key value of the shard being queried. | ||
* @param pageKey - The page key returned by the previous query on this shard. | ||
* @param pageSize - The maximum number of items to return from this query. | ||
* | ||
* @category Query | ||
*/ | ||
type ShardQueryFunction<Item extends Entity> = (hashKey: string, pageKey?: Partial<Item>, pageSize?: number) => Promise<ShardQueryResult<Item>>; | ||
type ShardQueryMap<Item extends Entity> = Record<string, ShardQueryFunction<Item>>; | ||
/** | ||
* Options passed to the {@link EntityManager.query | `EntityManager.query`} method. | ||
@@ -898,2 +873,2 @@ * | ||
export { BaseShardQueryMapBuilder, type BaseShardQueryMapBuilderOptions, type Config, type ConfigEntities, type ConfigEntity, type ConfigEntityGenerated, type ConfigKeys, type ConfigTranscodes, EntityManager, type EntityMap, type ExclusiveKey, type ItemMap, type Logger, type LoggerEndpoint, type LoggerOptions, type ParsedConfig, type QueryOptions, type QueryResult, type ShardBump, type ShardQueryFunction, type ShardQueryMap, type ShardQueryResult, type Unwrap, type WithRequiredAndNonNullable, conditionalize }; | ||
export { type Config, type ConfigEntities, type ConfigEntity, type ConfigEntityGenerated, type ConfigKeys, type ConfigTranscodes, EntityManager, type EntityMap, type ExclusiveKey, type ItemMap, type Logger, type LoggerEndpoint, type LoggerOptions, type ParsedConfig, type QueryOptions, type QueryResult, type ShardBump, type ShardQueryFunction, type ShardQueryMap, type ShardQueryResult, type Unwrap, type WithRequiredAndNonNullable, conditionalize }; |
@@ -1,3 +0,2 @@ | ||
export { BaseShardQueryMapBuilder } from './BaseShardQueryMapBuilder.js'; | ||
export { conditionalize } from './conditionalize.js'; | ||
export { EntityManager } from './EntityManager.js'; |
@@ -135,3 +135,3 @@ { | ||
"types": "dist/index.d.ts", | ||
"version": "6.4.7" | ||
"version": "6.4.8" | ||
} |
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
160567
49
3499