@karmaniverous/entity-manager 6.4.7 → 6.4.8

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/dist/cjs/index.js CHANGED
@@ -1,11 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var BaseShardQueryMapBuilder = require('./BaseShardQueryMapBuilder.js');
4
3
  var conditionalize = require('./conditionalize.js');
5
4
  var EntityManager = require('./EntityManager.js');
6
5
 
7
6
 
8
7
 
9
- exports.BaseShardQueryMapBuilder = BaseShardQueryMapBuilder.BaseShardQueryMapBuilder;
10
8
  exports.conditionalize = conditionalize.conditionalize;
11
9
  exports.EntityManager = EntityManager.EntityManager;
package/dist/index.d.ts CHANGED
@@ -2,66 +2,6 @@ import { Entity, Exactify, TranscodeMap, PropertiesOfType, TranscodablePropertie
2
2
  export { DefaultTranscodeMap, Entity, Exactify, PartialTranscodable, PropertiesNotOfType, PropertiesOfType, SortOrder, TranscodableProperties, TranscodeMap, Transcodes, defaultTranscodes } from '@karmaniverous/entity-tools';
3
3
  import { z } from 'zod';
4
4
 
5
- /**
6
- * {@link BaseShardQueryMapBuilder | `BaseShardQueryMapBuilder`} options.
7
- *
8
- * @category Query
9
- */
10
- interface BaseShardQueryMapBuilderOptions {
11
- /** `entityManager.config.entities` key. */
12
- entityToken: string;
13
- /** Either the designated entity hash key or a generated property with `sharded === true`. */
14
- hashKeyToken: string;
15
- /** Dehydrated page key from the previous query data page. */
16
- pageKey?: string;
17
- }
18
-
19
- /**
20
- * A result returned by a {@link ShardQueryFunction | `ShardQueryFunction`} querying an individual shard.
21
- *
22
- * @typeParam Item - The {@link Item | `Item`} type being queried.
23
-
24
- * @category Query
25
- */
26
- interface ShardQueryResult<Item extends Entity> {
27
- /** The number of records returned. */
28
- count: number;
29
- /** The returned records. */
30
- items: Item[];
31
- /** The page key for the next query on this shard. */
32
- pageKey?: Partial<Item>;
33
- }
34
-
35
- /**
36
- * A query function that returns a single page of results from an individual
37
- * shard. This function will typically be composed dynamically to express a
38
- * specific query index & logic. The arguments to this function will be
39
- * provided by the {@link EntityManager.query | `EntityManager.query`} method, which assembles many returned
40
- * pages queried across multiple shards into a single query result.
41
- *
42
- * @typeParam Item - The {@link Item | `Item`} type being queried.
43
-
44
- * @param hashKey - The hash key value of the shard being queried.
45
- * @param pageKey - The page key returned by the previous query on this shard.
46
- * @param pageSize - The maximum number of items to return from this query.
47
- *
48
- * @category Query
49
- */
50
- type ShardQueryFunction<Item extends Entity> = (hashKey: string, pageKey?: Partial<Item>, pageSize?: number) => Promise<ShardQueryResult<Item>>;
51
-
52
- type ShardQueryMap<Item extends Entity> = Record<string, ShardQueryFunction<Item>>;
53
-
54
- /**
55
- * Entity Manager shard query builder base class.
56
- *
57
- * @category Query
58
- */
59
- declare abstract class BaseShardQueryMapBuilder<Item extends Entity, Options extends BaseShardQueryMapBuilderOptions> {
60
- readonly options: Options;
61
- constructor(options: Options);
62
- abstract getShardQueryMap(): ShardQueryMap<Item>;
63
- }
64
-
65
5
  /**
66
6
  * Transforms a function such that it only executes when `condition` is truthy.
67
7
  *
@@ -689,6 +629,41 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
689
629
  */
690
630
  type ParsedConfig = z.infer<typeof configSchema>;
691
631
 
632
+ /**
633
+ * A result returned by a {@link ShardQueryFunction | `ShardQueryFunction`} querying an individual shard.
634
+ *
635
+ * @typeParam Item - The {@link Item | `Item`} type being queried.
636
+
637
+ * @category Query
638
+ */
639
+ interface ShardQueryResult<Item extends Entity> {
640
+ /** The number of records returned. */
641
+ count: number;
642
+ /** The returned records. */
643
+ items: Item[];
644
+ /** The page key for the next query on this shard. */
645
+ pageKey?: Partial<Item>;
646
+ }
647
+
648
+ /**
649
+ * A query function that returns a single page of results from an individual
650
+ * shard. This function will typically be composed dynamically to express a
651
+ * specific query index & logic. The arguments to this function will be
652
+ * provided by the {@link EntityManager.query | `EntityManager.query`} method, which assembles many returned
653
+ * pages queried across multiple shards into a single query result.
654
+ *
655
+ * @typeParam Item - The {@link Item | `Item`} type being queried.
656
+
657
+ * @param hashKey - The hash key value of the shard being queried.
658
+ * @param pageKey - The page key returned by the previous query on this shard.
659
+ * @param pageSize - The maximum number of items to return from this query.
660
+ *
661
+ * @category Query
662
+ */
663
+ type ShardQueryFunction<Item extends Entity> = (hashKey: string, pageKey?: Partial<Item>, pageSize?: number) => Promise<ShardQueryResult<Item>>;
664
+
665
+ type ShardQueryMap<Item extends Entity> = Record<string, ShardQueryFunction<Item>>;
666
+
692
667
  /**
693
668
  * Options passed to the {@link EntityManager.query | `EntityManager.query`} method.
694
669
  *
@@ -893,4 +868,4 @@ type WithRequiredAndNonNullable<T, K extends keyof T> = T & {
893
868
  [P in K]-?: NonNullable<T[P]>;
894
869
  };
895
870
 
896
- 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 };
871
+ 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 };
package/dist/mjs/index.js CHANGED
@@ -1,3 +1,2 @@
1
- export { BaseShardQueryMapBuilder } from './BaseShardQueryMapBuilder.js';
2
1
  export { conditionalize } from './conditionalize.js';
3
2
  export { EntityManager } from './EntityManager.js';
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.7"
135
+ "version": "6.4.8"
136
136
  }
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Entity Manager shard query builder base class.
5
- *
6
- * @category Query
7
- */
8
- class BaseShardQueryMapBuilder {
9
- constructor(options) {
10
- this.options = options;
11
- }
12
- }
13
-
14
- exports.BaseShardQueryMapBuilder = BaseShardQueryMapBuilder;
@@ -1,12 +0,0 @@
1
- /**
2
- * Entity Manager shard query builder base class.
3
- *
4
- * @category Query
5
- */
6
- class BaseShardQueryMapBuilder {
7
- constructor(options) {
8
- this.options = options;
9
- }
10
- }
11
-
12
- export { BaseShardQueryMapBuilder };