@karmaniverous/entity-manager 6.4.1 → 6.4.3

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +14 -9
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -645,6 +645,11 @@ interface ShardQueryResult<Item extends ItemMap<M, HashKey, RangeKey>[EntityToke
645
645
  /** The page key for the next query on this shard. */
646
646
  pageKey?: PartialTranscodable<Item, T>;
647
647
  }
648
+ interface ClientShardQueryResult {
649
+ count: number;
650
+ items: Entity[];
651
+ pageKey?: Entity;
652
+ }
648
653
 
649
654
  /**
650
655
  * A query function that returns a single page of results from an individual
@@ -663,8 +668,10 @@ interface ShardQueryResult<Item extends ItemMap<M, HashKey, RangeKey>[EntityToke
663
668
  * @category Query
664
669
  */
665
670
  type ShardQueryFunction<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string, M extends EntityMap, HashKey extends string = 'hashKey', RangeKey extends string = 'rangeKey', T extends TranscodeMap = DefaultTranscodeMap> = (hashKey: string, pageKey?: PartialTranscodable<Item, T>, pageSize?: number) => Promise<ShardQueryResult<Item, EntityToken, M, HashKey, RangeKey, T>>;
671
+ type ClientShardQueryFunction = (hashKey: string, pageKey?: Entity, pageSize?: number) => Promise<ClientShardQueryResult>;
666
672
 
667
673
  type ShardQueryMap<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string, M extends EntityMap, HashKey extends string, RangeKey extends string, T extends TranscodeMap> = Record<string, ShardQueryFunction<Item, EntityToken, M, HashKey, RangeKey, T>>;
674
+ type ClientShardQueryMap = Record<string, ClientShardQueryFunction>;
668
675
 
669
676
  /**
670
677
  * Options passed to the {@link EntityManager.query | `EntityManager.query`} method.
@@ -917,15 +924,13 @@ declare abstract class EntityManagerClient<Options extends EntityManagerClientOp
917
924
  *
918
925
  * @category Query
919
926
  */
920
- interface ShardQueryMapBuilderOptions<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string, M extends EntityMap, HashKey extends string, RangeKey extends string, T extends TranscodeMap> {
921
- /** {@link EntityManager | `EntityManager`} instance. */
922
- entityManager: EntityManager<M, HashKey, RangeKey, T>;
927
+ interface ShardQueryMapBuilderOptions {
923
928
  /** `entityManager.config.entities` key. */
924
- entityToken: EntityToken;
929
+ entityToken: string;
925
930
  /** Either the designated entity hash key or a generated property with `sharded === true`. */
926
- hashKeyToken: HashKey | (PropertiesOfType<M[EntityToken], void> & string);
931
+ hashKeyToken: string;
927
932
  /** A partial `Item` sufficiently populated to generate the query hash key & index values. */
928
- item: Partial<Item>;
933
+ item: Entity;
929
934
  /** Dehydrated page key from the previous query data page. */
930
935
  pageKey?: string;
931
936
  }
@@ -935,10 +940,10 @@ interface ShardQueryMapBuilderOptions<Item extends ItemMap<M, HashKey, RangeKey>
935
940
  *
936
941
  * @category Query
937
942
  */
938
- declare abstract class ShardQueryMapBuilder<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string, M extends EntityMap, HashKey extends string, RangeKey extends string, T extends TranscodeMap, Options extends ShardQueryMapBuilderOptions<Item, EntityToken, M, HashKey, RangeKey, T>> {
943
+ declare abstract class ShardQueryMapBuilder<Options extends ShardQueryMapBuilderOptions> {
939
944
  readonly options: Options;
940
945
  constructor(options: Options);
941
- abstract getShardQueryMap(): ShardQueryMap<Item, EntityToken, M, HashKey, RangeKey, T>;
946
+ abstract getShardQueryMap(): ClientShardQueryMap;
942
947
  }
943
948
 
944
949
  /**
@@ -951,4 +956,4 @@ type WithRequiredAndNonNullable<T, K extends keyof T> = T & {
951
956
  [P in K]-?: NonNullable<T[P]>;
952
957
  };
953
958
 
954
- export { type Config, type ConfigEntities, type ConfigEntity, type ConfigEntityGenerated, type ConfigKeys, type ConfigTranscodes, EntityManager, EntityManagerClient, type EntityManagerClientBatchOptions, type EntityManagerClientOptions, type EntityMap, type ExclusiveKey, type ItemMap, type Logger, type LoggerEndpoint, type LoggerOptions, type ParsedConfig, type QueryOptions, type QueryResult, type ShardBump, type ShardQueryFunction, type ShardQueryMap, ShardQueryMapBuilder, type ShardQueryMapBuilderOptions, type ShardQueryResult, type Unwrap, type WithRequiredAndNonNullable, conditionalize };
959
+ export { type ClientShardQueryFunction, type ClientShardQueryMap, type ClientShardQueryResult, type Config, type ConfigEntities, type ConfigEntity, type ConfigEntityGenerated, type ConfigKeys, type ConfigTranscodes, EntityManager, EntityManagerClient, type EntityManagerClientBatchOptions, type EntityManagerClientOptions, type EntityMap, type ExclusiveKey, type ItemMap, type Logger, type LoggerEndpoint, type LoggerOptions, type ParsedConfig, type QueryOptions, type QueryResult, type ShardBump, type ShardQueryFunction, type ShardQueryMap, ShardQueryMapBuilder, type ShardQueryMapBuilderOptions, type ShardQueryResult, type Unwrap, type WithRequiredAndNonNullable, conditionalize };
package/package.json CHANGED
@@ -132,5 +132,5 @@
132
132
  },
133
133
  "type": "module",
134
134
  "types": "dist/index.d.ts",
135
- "version": "6.4.1"
135
+ "version": "6.4.3"
136
136
  }