@nest-boot/graphql-connection 7.6.0 → 7.6.2

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 (53) hide show
  1. package/dist/connection-query-builder.d.ts +21 -0
  2. package/dist/connection-query-builder.js +21 -0
  3. package/dist/connection-query-builder.js.map +1 -1
  4. package/dist/connection.builder.d.ts +83 -0
  5. package/dist/connection.builder.js +75 -0
  6. package/dist/connection.builder.js.map +1 -1
  7. package/dist/connection.manager.d.ts +56 -0
  8. package/dist/connection.manager.js +41 -0
  9. package/dist/connection.manager.js.map +1 -1
  10. package/dist/cursor.d.ts +35 -0
  11. package/dist/cursor.js +29 -0
  12. package/dist/cursor.js.map +1 -1
  13. package/dist/enums/order-direction.enum.d.ts +17 -0
  14. package/dist/enums/order-direction.enum.js +17 -0
  15. package/dist/enums/order-direction.enum.js.map +1 -1
  16. package/dist/enums/paging-type.enum.d.ts +13 -0
  17. package/dist/enums/paging-type.enum.js +13 -0
  18. package/dist/enums/paging-type.enum.js.map +1 -1
  19. package/dist/graphql-connection.constants.d.ts +9 -0
  20. package/dist/graphql-connection.constants.js +9 -0
  21. package/dist/graphql-connection.constants.js.map +1 -1
  22. package/dist/graphql-connection.module.d.ts +20 -0
  23. package/dist/graphql-connection.module.js +20 -0
  24. package/dist/graphql-connection.module.js.map +1 -1
  25. package/dist/interfaces/connection-args.interface.d.ts +47 -0
  26. package/dist/interfaces/connection-builder-options.interface.d.ts +19 -0
  27. package/dist/interfaces/connection-metadata.interface.d.ts +19 -0
  28. package/dist/interfaces/connection.interface.d.ts +19 -0
  29. package/dist/interfaces/edge.interface.d.ts +17 -0
  30. package/dist/interfaces/order-field.type.d.ts +25 -0
  31. package/dist/interfaces/order.interface.d.ts +19 -0
  32. package/dist/objects/page-info.object.d.ts +35 -0
  33. package/dist/objects/page-info.object.js +21 -0
  34. package/dist/objects/page-info.object.js.map +1 -1
  35. package/dist/tsconfig.build.tsbuildinfo +1 -1
  36. package/dist/types/connection-class.type.d.ts +18 -0
  37. package/dist/types/field-options.type.d.ts +70 -0
  38. package/dist/utils/create-connection-args.d.ts +19 -0
  39. package/dist/utils/create-connection-args.js +19 -0
  40. package/dist/utils/create-connection-args.js.map +1 -1
  41. package/dist/utils/create-connection.d.ts +18 -0
  42. package/dist/utils/create-connection.js +18 -0
  43. package/dist/utils/create-connection.js.map +1 -1
  44. package/dist/utils/create-edge.d.ts +14 -0
  45. package/dist/utils/create-edge.js +14 -0
  46. package/dist/utils/create-edge.js.map +1 -1
  47. package/dist/utils/create-filter.d.ts +30 -0
  48. package/dist/utils/create-filter.js +14 -0
  49. package/dist/utils/create-filter.js.map +1 -1
  50. package/dist/utils/create-order.d.ts +27 -0
  51. package/dist/utils/create-order.js +16 -0
  52. package/dist/utils/create-order.js.map +1 -1
  53. package/package.json +5 -5
@@ -2,6 +2,22 @@ import { EntityManager } from "@mikro-orm/core";
2
2
  import { ConnectionFindOptions } from "./connection.manager";
3
3
  import { ConnectionArgsInterface, EdgeInterface } from "./interfaces";
4
4
  import { ConnectionClass } from "./types";
5
+ /**
6
+ * Builds and executes paginated queries for GraphQL connections.
7
+ *
8
+ * This class handles the complexity of cursor-based pagination including:
9
+ * - Forward and backward pagination
10
+ * - Custom ordering with fallback to ID ordering
11
+ * - Filter query construction from multiple sources (args, options, query string)
12
+ * - Cursor encoding/decoding for stable pagination
13
+ *
14
+ * @typeParam Entity - The entity type being queried
15
+ * @typeParam Hint - Type hints for population
16
+ * @typeParam Fields - Fields to select
17
+ * @typeParam Excludes - Fields to exclude
18
+ *
19
+ * @internal This class is used internally by ConnectionManager
20
+ */
5
21
  export declare class ConnectionQueryBuilder<Entity extends object, Hint extends string = never, Fields extends string = "*", Excludes extends string = never> {
6
22
  private readonly entityManager;
7
23
  private readonly connectionClass;
@@ -30,6 +46,11 @@ export declare class ConnectionQueryBuilder<Entity extends object, Hint extends
30
46
  private getCursorFilterQuery;
31
47
  private getQueryStringToFilterQuery;
32
48
  private mergeFilterQuery;
49
+ /**
50
+ * Executes the paginated query and returns the connection result.
51
+ *
52
+ * @returns A promise that resolves to the connection with edges, pageInfo, and totalCount
53
+ */
33
54
  query(): Promise<{
34
55
  totalCount: number;
35
56
  edges: EdgeInterface<Entity>[];
@@ -12,6 +12,22 @@ const search_syntax_1 = require("search-syntax");
12
12
  const cursor_1 = require("./cursor");
13
13
  const enums_1 = require("./enums");
14
14
  const graphql_connection_constants_1 = require("./graphql-connection.constants");
15
+ /**
16
+ * Builds and executes paginated queries for GraphQL connections.
17
+ *
18
+ * This class handles the complexity of cursor-based pagination including:
19
+ * - Forward and backward pagination
20
+ * - Custom ordering with fallback to ID ordering
21
+ * - Filter query construction from multiple sources (args, options, query string)
22
+ * - Cursor encoding/decoding for stable pagination
23
+ *
24
+ * @typeParam Entity - The entity type being queried
25
+ * @typeParam Hint - Type hints for population
26
+ * @typeParam Fields - Fields to select
27
+ * @typeParam Excludes - Fields to exclude
28
+ *
29
+ * @internal This class is used internally by ConnectionManager
30
+ */
15
31
  class ConnectionQueryBuilder {
16
32
  constructor(entityManager, connectionClass, args, options) {
17
33
  this.entityManager = entityManager;
@@ -176,6 +192,11 @@ class ConnectionQueryBuilder {
176
192
  $and: filterQueryGroup,
177
193
  };
178
194
  }
195
+ /**
196
+ * Executes the paginated query and returns the connection result.
197
+ *
198
+ * @returns A promise that resolves to the connection with edges, pageInfo, and totalCount
199
+ */
179
200
  async query() {
180
201
  const [entities, totalCount] = await Promise.all([
181
202
  this.allFilterQuery === null
@@ -1 +1 @@
1
- {"version":3,"file":"connection-query-builder.js","sourceRoot":"","sources":["../src/connection-query-builder.ts"],"names":[],"mappings":";;;;;;AAAA,0CAMyB;AACzB,6DAAqC;AACrC,qDAA6B;AAC7B,qDAA6B;AAC7B,iDAAyD;AAGzD,qCAAkC;AAClC,mCAAqD;AACrD,iFAA6E;AAQ7E,MAAa,sBAAsB;IAgCjC,YACmB,aAA4B,EAC5B,eAAwC,EACxC,IAAqC,EACrC,O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,CAAC,CAAC,EAAE,KAAK,EAAE,IAAA,aAAG,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBAC/C,CAAC,CAAC,EAAE,CAAC;aACR,CAAC,CAAC,QAAQ,EAAE;SACd,CAAC,CAAC,CAAC;QAEJ,OAAO;QACP,OAAO;YACL,UAAU;YACV,KAAK;YACL,QAAQ,EAAE;gBACR,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,kBAAU,CAAC,OAAO;oBACxC,CAAC,CAAC;wBACE,WAAW,EAAE,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK;wBAC/C,eAAe,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI;qBACrC;oBACH,CAAC,CAAC;wBACE,WAAW,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI;wBAChC,eAAe,EAAE,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK;qBACpD,CAAC;gBACN,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM;gBAC7B,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM;aAC3C;SACF,CAAC;IACJ,CAAC;CACF;AAlUD,wDAkUC"}
@@ -3,6 +3,14 @@ import { type Type } from "@nestjs/common";
3
3
  import { GraphQLScalarType } from "graphql";
4
4
  import type { ZodType } from "zod";
5
5
  import { ConnectionArgsInterface, ConnectionBuilderOptions, ConnectionInterface, EdgeInterface, FieldOptions, OrderFieldType, OrderInterface } from "./interfaces";
6
+ /**
7
+ * The result of building a connection with ConnectionBuilder.
8
+ *
9
+ * Contains all the GraphQL types needed for cursor-based pagination,
10
+ * including dynamic named types based on the entity name.
11
+ *
12
+ * @typeParam Entity - The entity type for the connection
13
+ */
6
14
  type ConnectionBuildResult<Entity extends object> = {
7
15
  Connection: Type<ConnectionInterface<Entity>>;
8
16
  ConnectionArgs: Type<ConnectionArgsInterface<Entity>>;
@@ -12,13 +20,88 @@ type ConnectionBuildResult<Entity extends object> = {
12
20
  Order: Type<OrderInterface<Entity>>;
13
21
  OrderField?: OrderFieldType<Entity>;
14
22
  } & Record<`${EntityClass<Entity>["name"]}Connection`, Type<ConnectionInterface<Entity>>> & Record<`${EntityClass<Entity>["name"]}ConnectionArgs`, Type<ConnectionArgsInterface<Entity>>> & Record<`${EntityClass<Entity>["name"]}Edge`, Type<EdgeInterface<Entity>>> & Record<`${EntityClass<Entity>["name"]}Order`, Type<OrderInterface<Entity>>> & Record<`${EntityClass<Entity>["name"]}OrderField`, OrderFieldType<Entity>> & Record<`${EntityClass<Entity>["name"]}Filter`, GraphQLScalarType<FilterQuery<Entity>>>;
23
+ /**
24
+ * Builder class for creating GraphQL connection types following the Relay specification.
25
+ *
26
+ * The ConnectionBuilder generates all necessary GraphQL types for cursor-based pagination:
27
+ * - Connection type with edges, pageInfo, and totalCount
28
+ * - Edge type with node and cursor
29
+ * - ConnectionArgs type with first, last, after, before, orderBy, filter, and query
30
+ * - Order input type for sorting
31
+ * - Filter scalar type for MongoDB-style filtering
32
+ *
33
+ * @typeParam Entity - The MikroORM entity type for the connection
34
+ *
35
+ * @example Basic usage
36
+ * ```typescript
37
+ * import { ConnectionBuilder } from "@nest-boot/graphql-connection";
38
+ * import { User } from "./user.entity";
39
+ *
40
+ * const { Connection, ConnectionArgs, Edge } = new ConnectionBuilder(User)
41
+ * .addField({ field: "name", type: "string", filterable: true, sortable: true })
42
+ * .addField({ field: "createdAt", type: "date", sortable: true })
43
+ * .build();
44
+ *
45
+ * // Use in resolver
46
+ * @Query(() => Connection)
47
+ * async users(@Args() args: typeof ConnectionArgs) {
48
+ * return this.connectionManager.find(Connection, args);
49
+ * }
50
+ * ```
51
+ *
52
+ * @example With custom filter options
53
+ * ```typescript
54
+ * const { Connection, ConnectionArgs } = new ConnectionBuilder(User, {
55
+ * filter: {
56
+ * maxDepth: 3,
57
+ * maxConditions: 10,
58
+ * },
59
+ * })
60
+ * .addField({ field: "email", type: "string", filterable: true })
61
+ * .build();
62
+ * ```
63
+ */
15
64
  export declare class ConnectionBuilder<Entity extends object> {
16
65
  private readonly entityClass;
17
66
  private readonly entityName;
18
67
  private readonly options;
19
68
  private readonly fieldOptionsMap;
69
+ /**
70
+ * Creates a new ConnectionBuilder instance.
71
+ *
72
+ * @param entityClass - The MikroORM entity class to build connection types for
73
+ * @param options - Optional configuration for the connection builder
74
+ */
20
75
  constructor(entityClass: EntityClass<Entity>, options?: Partial<ConnectionBuilderOptions>);
76
+ /**
77
+ * Adds a field configuration to the connection builder.
78
+ *
79
+ * Fields can be configured for filtering, sorting, and searching.
80
+ * The field type determines what filter operators are available.
81
+ *
82
+ * @typeParam Type - The field type ("string", "number", "boolean", or "date")
83
+ * @typeParam Field - The field path in the entity
84
+ * @param options - The field configuration options
85
+ * @returns The builder instance for method chaining
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * builder
90
+ * .addField({ field: "name", type: "string", filterable: true, searchable: true })
91
+ * .addField({ field: "age", type: "number", filterable: true, sortable: true })
92
+ * .addField({ field: "isActive", type: "boolean", filterable: true })
93
+ * .addField({ field: "createdAt", type: "date", sortable: true });
94
+ * ```
95
+ */
21
96
  addField<Type extends "string" | "number" | "boolean" | "date" = never, Field extends string = never>(options: FieldOptions<Entity, Type, Field>): this;
97
+ /**
98
+ * Builds and returns all GraphQL types for the connection.
99
+ *
100
+ * The returned object contains both generic type references and
101
+ * entity-specific named types (e.g., UserConnection, UserEdge).
102
+ *
103
+ * @returns An object containing all generated connection types
104
+ */
22
105
  build(): ConnectionBuildResult<Entity>;
23
106
  }
24
107
  export {};
@@ -2,7 +2,54 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectionBuilder = void 0;
4
4
  const utils_1 = require("./utils");
5
+ /**
6
+ * Builder class for creating GraphQL connection types following the Relay specification.
7
+ *
8
+ * The ConnectionBuilder generates all necessary GraphQL types for cursor-based pagination:
9
+ * - Connection type with edges, pageInfo, and totalCount
10
+ * - Edge type with node and cursor
11
+ * - ConnectionArgs type with first, last, after, before, orderBy, filter, and query
12
+ * - Order input type for sorting
13
+ * - Filter scalar type for MongoDB-style filtering
14
+ *
15
+ * @typeParam Entity - The MikroORM entity type for the connection
16
+ *
17
+ * @example Basic usage
18
+ * ```typescript
19
+ * import { ConnectionBuilder } from "@nest-boot/graphql-connection";
20
+ * import { User } from "./user.entity";
21
+ *
22
+ * const { Connection, ConnectionArgs, Edge } = new ConnectionBuilder(User)
23
+ * .addField({ field: "name", type: "string", filterable: true, sortable: true })
24
+ * .addField({ field: "createdAt", type: "date", sortable: true })
25
+ * .build();
26
+ *
27
+ * // Use in resolver
28
+ * @Query(() => Connection)
29
+ * async users(@Args() args: typeof ConnectionArgs) {
30
+ * return this.connectionManager.find(Connection, args);
31
+ * }
32
+ * ```
33
+ *
34
+ * @example With custom filter options
35
+ * ```typescript
36
+ * const { Connection, ConnectionArgs } = new ConnectionBuilder(User, {
37
+ * filter: {
38
+ * maxDepth: 3,
39
+ * maxConditions: 10,
40
+ * },
41
+ * })
42
+ * .addField({ field: "email", type: "string", filterable: true })
43
+ * .build();
44
+ * ```
45
+ */
5
46
  class ConnectionBuilder {
47
+ /**
48
+ * Creates a new ConnectionBuilder instance.
49
+ *
50
+ * @param entityClass - The MikroORM entity class to build connection types for
51
+ * @param options - Optional configuration for the connection builder
52
+ */
6
53
  constructor(entityClass, options) {
7
54
  this.entityClass = entityClass;
8
55
  this.fieldOptionsMap = new Map();
@@ -18,10 +65,38 @@ class ConnectionBuilder {
18
65
  },
19
66
  };
20
67
  }
68
+ /**
69
+ * Adds a field configuration to the connection builder.
70
+ *
71
+ * Fields can be configured for filtering, sorting, and searching.
72
+ * The field type determines what filter operators are available.
73
+ *
74
+ * @typeParam Type - The field type ("string", "number", "boolean", or "date")
75
+ * @typeParam Field - The field path in the entity
76
+ * @param options - The field configuration options
77
+ * @returns The builder instance for method chaining
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * builder
82
+ * .addField({ field: "name", type: "string", filterable: true, searchable: true })
83
+ * .addField({ field: "age", type: "number", filterable: true, sortable: true })
84
+ * .addField({ field: "isActive", type: "boolean", filterable: true })
85
+ * .addField({ field: "createdAt", type: "date", sortable: true });
86
+ * ```
87
+ */
21
88
  addField(options) {
22
89
  this.fieldOptionsMap.set(options.field, options);
23
90
  return this;
24
91
  }
92
+ /**
93
+ * Builds and returns all GraphQL types for the connection.
94
+ *
95
+ * The returned object contains both generic type references and
96
+ * entity-specific named types (e.g., UserConnection, UserEdge).
97
+ *
98
+ * @returns An object containing all generated connection types
99
+ */
25
100
  build() {
26
101
  const Edge = (0, utils_1.createEdge)(this.entityClass, this.entityName);
27
102
  const { Order, OrderField } = (0, utils_1.createOrder)(this.entityName, this.fieldOptionsMap);
@@ -1 +1 @@
1
- {"version":3,"file":"connection.builder.js","sourceRoot":"","sources":["../src/connection.builder.ts"],"names":[],"mappings":";;;AAeA,mCAMiB;AA0BjB,MAAa,iBAAiB;IAU5B,YACmB,WAAgC,EACjD,OAA2C;QAD1B,gBAAW,GAAX,WAAW,CAAqB;QANlC,oBAAe,GAAG,IAAI,GAAG,EAGvC,CAAC;QAMF,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC;QAEnC,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,OAAO;YACV,MAAM,EAAE;gBACN,QAAQ,EAAE,CAAC;gBACX,aAAa,EAAE,EAAE;gBACjB,aAAa,EAAE,CAAC;gBAChB,cAAc,EAAE,GAAG;gBACnB,GAAG,OAAO,EAAE,MAAM;aACnB;SACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAGN,OAA0C;QAC1C,IAAI,CAAC,eAAe,CAAC,GAAG,CACtB,OAAO,CAAC,KAAK,EACb,OAAkD,CACnD,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,MAAM,IAAI,GAAG,IAAA,kBAAU,EAAC,IAAI,CAAC,WAAW,EA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I,CAAC,eAAe,EACpB,KAAK,EACL,MAAM,CACP,CAAC;QAEF,OAAO;YACL,UAAU;YACV,cAAc;YACd,IAAI;YACJ,MAAM;YACN,iBAAiB;YACjB,KAAK;YACL,UAAU;YACV,CAAC,GAAG,IAAI,CAAC,UAAU,YAAY,CAAC,EAAE,UAAU;YAC5C,CAAC,GAAG,IAAI,CAAC,UAAU,gBAAgB,CAAC,EAAE,cAAc;YACpD,CAAC,GAAG,IAAI,CAAC,UAAU,MAAM,CAAC,EAAE,IAAI;YAChC,CAAC,GAAG,IAAI,CAAC,UAAU,QAAQ,CAAC,EAAE,MAAM;YACpC,CAAC,GAAG,IAAI,CAAC,UAAU,OAAO,CAAC,EAAE,KAAK;YAClC,CAAC,GAAG,IAAI,CAAC,UAAU,YAAY,CAAC,EAAE,UAAU;SACZ,CAAC;IACrC,CAAC;CACF;AAtHD,8CAsHC"}
@@ -2,11 +2,67 @@ import { EntityManager, type FilterQuery } from "@mikro-orm/core";
2
2
  import type { FindOptions } from "@mikro-orm/core/drivers";
3
3
  import { ConnectionArgsInterface, ConnectionInterface } from "./interfaces";
4
4
  import { ConnectionClass } from "./types";
5
+ /**
6
+ * Options for the ConnectionManager.find method.
7
+ *
8
+ * Extends MikroORM FindOptions but excludes pagination-related options
9
+ * (limit, offset, orderBy) which are handled by the connection arguments.
10
+ *
11
+ * @typeParam Entity - The entity type being queried
12
+ * @typeParam Hint - Type hints for population
13
+ * @typeParam Fields - Fields to select
14
+ * @typeParam Excludes - Fields to exclude
15
+ */
5
16
  export interface ConnectionFindOptions<Entity extends object, Hint extends string = never, Fields extends string = "*", Excludes extends string = never> extends Exclude<FindOptions<Entity, Hint, Fields, Excludes>, "limit" | "offset" | "orderBy"> {
17
+ /**
18
+ * Additional filter query to apply to the connection query.
19
+ * This is merged with any filters from the connection arguments.
20
+ */
6
21
  where?: FilterQuery<Entity>;
7
22
  }
23
+ /**
24
+ * Service for executing paginated GraphQL connection queries.
25
+ *
26
+ * The ConnectionManager provides a high-level API for querying entities
27
+ * with cursor-based pagination following the Relay connection specification.
28
+ *
29
+ * @example Basic usage in a resolver
30
+ * ```typescript
31
+ * @Resolver(() => User)
32
+ * export class UserResolver {
33
+ * constructor(private readonly connectionManager: ConnectionManager) {}
34
+ *
35
+ * @Query(() => UserConnection)
36
+ * async users(@Args() args: UserConnectionArgs): Promise<UserConnection> {
37
+ * return this.connectionManager.find(UserConnection, args);
38
+ * }
39
+ * }
40
+ * ```
41
+ *
42
+ * @example With additional filters
43
+ * ```typescript
44
+ * @Query(() => UserConnection)
45
+ * async activeUsers(@Args() args: UserConnectionArgs): Promise<UserConnection> {
46
+ * return this.connectionManager.find(UserConnection, args, {
47
+ * where: { isActive: true },
48
+ * });
49
+ * }
50
+ * ```
51
+ */
8
52
  export declare class ConnectionManager {
9
53
  private readonly em;
10
54
  constructor(em: EntityManager);
55
+ /**
56
+ * Finds entities and returns them as a paginated connection.
57
+ *
58
+ * @typeParam Entity - The entity type being queried
59
+ * @typeParam Hint - Type hints for population
60
+ * @typeParam Fields - Fields to select
61
+ * @typeParam Excludes - Fields to exclude
62
+ * @param connectionClass - The connection class generated by ConnectionBuilder
63
+ * @param args - The connection arguments (first, last, after, before, orderBy, filter, query)
64
+ * @param options - Additional find options (where, populate, etc.)
65
+ * @returns A promise that resolves to the paginated connection result
66
+ */
11
67
  find<Entity extends object, Hint extends string = never, Fields extends string = "*", Excludes extends string = never>(connectionClass: ConnectionClass<Entity>, args: ConnectionArgsInterface<Entity>, options?: ConnectionFindOptions<Entity, Hint, Fields, Excludes>): Promise<ConnectionInterface<Entity>>;
12
68
  }
@@ -13,10 +13,51 @@ exports.ConnectionManager = void 0;
13
13
  const core_1 = require("@mikro-orm/core");
14
14
  const common_1 = require("@nestjs/common");
15
15
  const connection_query_builder_1 = require("./connection-query-builder");
16
+ /**
17
+ * Service for executing paginated GraphQL connection queries.
18
+ *
19
+ * The ConnectionManager provides a high-level API for querying entities
20
+ * with cursor-based pagination following the Relay connection specification.
21
+ *
22
+ * @example Basic usage in a resolver
23
+ * ```typescript
24
+ * @Resolver(() => User)
25
+ * export class UserResolver {
26
+ * constructor(private readonly connectionManager: ConnectionManager) {}
27
+ *
28
+ * @Query(() => UserConnection)
29
+ * async users(@Args() args: UserConnectionArgs): Promise<UserConnection> {
30
+ * return this.connectionManager.find(UserConnection, args);
31
+ * }
32
+ * }
33
+ * ```
34
+ *
35
+ * @example With additional filters
36
+ * ```typescript
37
+ * @Query(() => UserConnection)
38
+ * async activeUsers(@Args() args: UserConnectionArgs): Promise<UserConnection> {
39
+ * return this.connectionManager.find(UserConnection, args, {
40
+ * where: { isActive: true },
41
+ * });
42
+ * }
43
+ * ```
44
+ */
16
45
  let ConnectionManager = class ConnectionManager {
17
46
  constructor(em) {
18
47
  this.em = em;
19
48
  }
49
+ /**
50
+ * Finds entities and returns them as a paginated connection.
51
+ *
52
+ * @typeParam Entity - The entity type being queried
53
+ * @typeParam Hint - Type hints for population
54
+ * @typeParam Fields - Fields to select
55
+ * @typeParam Excludes - Fields to exclude
56
+ * @param connectionClass - The connection class generated by ConnectionBuilder
57
+ * @param args - The connection arguments (first, last, after, before, orderBy, filter, query)
58
+ * @param options - Additional find options (where, populate, etc.)
59
+ * @returns A promise that resolves to the paginated connection result
60
+ */
20
61
  async find(connectionClass, args, options) {
21
62
  return await new connection_query_builder_1.ConnectionQueryBuilder(this.em, connectionClass, args, options).query();
22
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"connection.manager.js","sourceRoot":"","sources":["../src/connection.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAkE;AAElE,2CAA4C;AAE5C,yEAAoE;AAiB7D,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YAA6B,EAAiB;QAAjB,OAAE,GAAF,EAAE,CAAe;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI,CAMR,eAAwC,EACxC,IAAqC,EACrC,OAA+D;QAE/D,OAAO,MAAM,IAAI,iDAAsB,CACrC,IAAI,CAAC,EAAE,EACP,eAAe,EACf,IAAI,EACJ,OAAO,CACR,CAAC,KAAK,EAAE,CAAC;IACZ,CAAC;CACF,CAAA;AApBY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAEsB,oBAAa;GADnC,iBAAiB,CAoB7B"}
1
+ {"version":3,"file":"connection.manager.js","sourceRoot":"","sources":["../src/connection.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAkE;AAElE,2CAA4C;AAE5C,yEAAoE;AA+BpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YAA6B,EAAiB;QAAjB,OAAE,GAAF,EAAE,CAAe;IAAG,CAAC;IAElD;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,IAAI,CAMR,eAAwC,EACxC,IAAqC,EACrC,OAA+D;QAE/D,OAAO,MAAM,IAAI,iDAAsB,CACrC,IAAI,CAAC,EAAE,EACP,eAAe,EACf,IAAI,EACJ,OAAO,CACR,CAAC,KAAK,EAAE,CAAC;IACZ,CAAC;CACF,CAAA;AAhCY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAEsB,oBAAa;GADnC,iBAAiB,CAgC7B"}
package/dist/cursor.d.ts CHANGED
@@ -1,6 +1,41 @@
1
+ /**
2
+ * Represents a cursor for cursor-based pagination in GraphQL connections.
3
+ *
4
+ * Cursors are encoded as base64 JSON strings containing the position information
5
+ * needed for pagination. They typically include the entity ID and optionally
6
+ * the value of the field being sorted by.
7
+ *
8
+ * @example Creating a cursor from an object
9
+ * ```typescript
10
+ * const cursor = new Cursor({ id: '123', value: 'some-value' });
11
+ * console.log(cursor.toString()); // Base64 encoded string
12
+ * ```
13
+ *
14
+ * @example Parsing a cursor string
15
+ * ```typescript
16
+ * const cursor = new Cursor('eyJpZCI6IjEyMyJ9');
17
+ * console.log(cursor.id); // '123'
18
+ * ```
19
+ */
1
20
  export declare class Cursor implements Record<string, any> {
21
+ /**
22
+ * The entity ID stored in the cursor.
23
+ */
2
24
  id?: string;
25
+ /**
26
+ * Allows additional properties to be stored in the cursor.
27
+ */
3
28
  [key: string]: any;
29
+ /**
30
+ * Creates a new Cursor instance.
31
+ *
32
+ * @param cursor - Either a base64-encoded cursor string or an object containing cursor data
33
+ */
4
34
  constructor(cursor: string | Record<string, any>);
35
+ /**
36
+ * Converts the cursor to a base64-encoded string representation.
37
+ *
38
+ * @returns The cursor encoded as a base64 JSON string
39
+ */
5
40
  toString(): string;
6
41
  }
package/dist/cursor.js CHANGED
@@ -1,7 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Cursor = void 0;
4
+ /**
5
+ * Represents a cursor for cursor-based pagination in GraphQL connections.
6
+ *
7
+ * Cursors are encoded as base64 JSON strings containing the position information
8
+ * needed for pagination. They typically include the entity ID and optionally
9
+ * the value of the field being sorted by.
10
+ *
11
+ * @example Creating a cursor from an object
12
+ * ```typescript
13
+ * const cursor = new Cursor({ id: '123', value: 'some-value' });
14
+ * console.log(cursor.toString()); // Base64 encoded string
15
+ * ```
16
+ *
17
+ * @example Parsing a cursor string
18
+ * ```typescript
19
+ * const cursor = new Cursor('eyJpZCI6IjEyMyJ9');
20
+ * console.log(cursor.id); // '123'
21
+ * ```
22
+ */
4
23
  class Cursor {
24
+ /**
25
+ * Creates a new Cursor instance.
26
+ *
27
+ * @param cursor - Either a base64-encoded cursor string or an object containing cursor data
28
+ */
5
29
  constructor(cursor) {
6
30
  if (typeof cursor === "string") {
7
31
  try {
@@ -21,6 +45,11 @@ class Cursor {
21
45
  });
22
46
  }
23
47
  }
48
+ /**
49
+ * Converts the cursor to a base64-encoded string representation.
50
+ *
51
+ * @returns The cursor encoded as a base64 JSON string
52
+ */
24
53
  toString() {
25
54
  return Buffer.from(JSON.stringify(this)).toString("base64");
26
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cursor.js","sourceRoot":"","sources":["../src/cursor.ts"],"names":[],"mappings":";;;AAAA,MAAa,MAAM;IAKjB,YAAY,MAAoC;QAC9C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAErE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;oBAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBACpB,CAAC,CAAC,CAAC;gBACH,6DAA6D;YAC/D,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,EAAE;YACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;gBAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACpB,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,QAAQ;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;CACF;AA3BD,wBA2BC"}
1
+ {"version":3,"file":"cursor.js","sourceRoot":"","sources":["../src/cursor.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,MAAM;IAWjB;;;;OAIG;IACH,YAAY,MAAoC;QAC9C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAErE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;oBAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBACpB,CAAC,CAAC,CAAC;gBACH,6DAA6D;YAC/D,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,EAAE;YACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;gBAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACpB,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;CACF;AA3CD,wBA2CC"}
@@ -1,4 +1,21 @@
1
+ /**
2
+ * Specifies the direction for ordering query results.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * const order = {
7
+ * field: "CREATED_AT",
8
+ * direction: OrderDirection.DESC,
9
+ * };
10
+ * ```
11
+ */
1
12
  export declare enum OrderDirection {
13
+ /**
14
+ * Ascending order (smallest to largest, A to Z, oldest to newest).
15
+ */
2
16
  ASC = "ASC",
17
+ /**
18
+ * Descending order (largest to smallest, Z to A, newest to oldest).
19
+ */
3
20
  DESC = "DESC"
4
21
  }
@@ -2,9 +2,26 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OrderDirection = void 0;
4
4
  const graphql_1 = require("@nest-boot/graphql");
5
+ /**
6
+ * Specifies the direction for ordering query results.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const order = {
11
+ * field: "CREATED_AT",
12
+ * direction: OrderDirection.DESC,
13
+ * };
14
+ * ```
15
+ */
5
16
  var OrderDirection;
6
17
  (function (OrderDirection) {
18
+ /**
19
+ * Ascending order (smallest to largest, A to Z, oldest to newest).
20
+ */
7
21
  OrderDirection["ASC"] = "ASC";
22
+ /**
23
+ * Descending order (largest to smallest, Z to A, newest to oldest).
24
+ */
8
25
  OrderDirection["DESC"] = "DESC";
9
26
  })(OrderDirection || (exports.OrderDirection = OrderDirection = {}));
10
27
  (0, graphql_1.registerEnumType)(OrderDirection, { name: "OrderDirection" });
@@ -1 +1 @@
1
- {"version":3,"file":"order-direction.enum.js","sourceRoot":"","sources":["../../src/enums/order-direction.enum.ts"],"names":[],"mappings":";;;AAAA,gDAAsD;AAEtD,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAA,0BAAgB,EAAC,cAAc,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"order-direction.enum.js","sourceRoot":"","sources":["../../src/enums/order-direction.enum.ts"],"names":[],"mappings":";;;AAAA,gDAAsD;AAEtD;;;;;;;;;;GAUG;AACH,IAAY,cAUX;AAVD,WAAY,cAAc;IACxB;;OAEG;IACH,6BAAW,CAAA;IAEX;;OAEG;IACH,+BAAa,CAAA;AACf,CAAC,EAVW,cAAc,8BAAd,cAAc,QAUzB;AAED,IAAA,0BAAgB,EAAC,cAAc,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC"}
@@ -1,4 +1,17 @@
1
+ /**
2
+ * Represents the pagination direction for cursor-based pagination.
3
+ *
4
+ * @internal Used by ConnectionQueryBuilder to determine query direction
5
+ */
1
6
  export declare enum PagingType {
7
+ /**
8
+ * Forward pagination using `first` and `after` arguments.
9
+ * Fetches items after the cursor, moving towards the end of the list.
10
+ */
2
11
  FORWARD = "FORWARD",
12
+ /**
13
+ * Backward pagination using `last` and `before` arguments.
14
+ * Fetches items before the cursor, moving towards the start of the list.
15
+ */
3
16
  BACKWARD = "BACKWARD"
4
17
  }
@@ -1,9 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PagingType = void 0;
4
+ /**
5
+ * Represents the pagination direction for cursor-based pagination.
6
+ *
7
+ * @internal Used by ConnectionQueryBuilder to determine query direction
8
+ */
4
9
  var PagingType;
5
10
  (function (PagingType) {
11
+ /**
12
+ * Forward pagination using `first` and `after` arguments.
13
+ * Fetches items after the cursor, moving towards the end of the list.
14
+ */
6
15
  PagingType["FORWARD"] = "FORWARD";
16
+ /**
17
+ * Backward pagination using `last` and `before` arguments.
18
+ * Fetches items before the cursor, moving towards the start of the list.
19
+ */
7
20
  PagingType["BACKWARD"] = "BACKWARD";
8
21
  })(PagingType || (exports.PagingType = PagingType = {}));
9
22
  //# sourceMappingURL=paging-type.enum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"paging-type.enum.js","sourceRoot":"","sources":["../../src/enums/paging-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;AACvB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB"}
1
+ {"version":3,"file":"paging-type.enum.js","sourceRoot":"","sources":["../../src/enums/paging-type.enum.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,UAYX;AAZD,WAAY,UAAU;IACpB;;;OAGG;IACH,iCAAmB,CAAA;IAEnB;;;OAGG;IACH,mCAAqB,CAAA;AACvB,CAAC,EAZW,UAAU,0BAAV,UAAU,QAYrB"}
@@ -1 +1,10 @@
1
+ /**
2
+ * Symbol used as a metadata key for storing connection metadata on connection classes.
3
+ *
4
+ * This symbol is used internally by the connection builder to attach metadata
5
+ * (entity class, field options, filter schema) to generated connection classes.
6
+ * The metadata is then used by the ConnectionQueryBuilder to construct queries.
7
+ *
8
+ * @internal
9
+ */
1
10
  export declare const GRAPHQL_CONNECTION_METADATA: unique symbol;