@application-kit/graphql 0.7.0 → 0.8.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @application-kit/graphql
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3a2f7ed: `graphql`: класс аргументов листинга `Payload` (`@ArgsType`) переименован в `ListingArgs` — имя говорит, чьи это аргументы.
8
+ **Ломающее:** потребителю — заменить импорт и тип `Payload` на `ListingArgs`; схема GraphQL не меняется, имя класса в неё не попадает.
9
+
10
+ `audit-log`: резолвер `auditRecords` принимает `ListingArgs`.
11
+ - 79a405c: `graphql/nest`: `GraphqlRootModule.forRoot({ maxDepth, resolveSupportId, schemaPath })` — корень GraphQL на процесс.
12
+ Регистрирует `GraphqlConfig` с `GraphqlEnvironment` и поднимает `GraphQLModule` на `MercuriusDriver`: приложению не нужно
13
+ собирать `GraphQLModule.forRootAsync` и регистрировать конфиг самому.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [c5a41d7]
18
+ - @application-kit/typeorm@0.5.2
19
+
3
20
  ## 0.7.0
4
21
 
5
22
  ### Minor Changes
package/README.md CHANGED
@@ -32,7 +32,7 @@ Peer-зависимости: `@nestjs/common`, `@nestjs/graphql`, `class-transfo
32
32
  - `matchBusinessError(table, fallback)` — таблица «класс доменной ошибки → опции ответа», первая подходящая строка.
33
33
  - `formatGraphQLError(error, supportId)` — единая точка форматирования: `HttpException` → `extensions`,
34
34
  техническая ошибка получает `supportId`, бизнесовая — нет (`isBusinessGraphQLError`).
35
- - Типы листинга: `Payload` (`@ArgsType`), `PaginatorInputType` (потолок `limit` 200), `FilterInputType`,
35
+ - Типы листинга: `ListingArguments` (`@ArgsType`), `PaginatorInputType` (потолок `limit` 200), `FilterInputType`,
36
36
  `SortingInputType`, `CursorOutputType`, `ListingResponseInterface`.
37
37
 
38
38
  ### Словарь кодов сообщений — у приложения
@@ -76,16 +76,15 @@ export const apolloClient = createApolloClient({
76
76
  Пустой `schemaPath` — схема только в памяти.
77
77
  - `GraphqlEnvironment` — `GRAPHQL_PLAYGROUND` (дефолт `false`) и необязательный `GRAPHQL_SCHEMA_PATH`;
78
78
  `GraphqlConfig.createOptions({ schemaPath, maxDepth, resolveSupportId })` берёт флаг консоли из окружения, путь —
79
- из окружения, если он задан, иначе из вызова. Регистрацию делает приложение:
79
+ из окружения, если он задан, иначе из вызова.
80
+ - `GraphqlRootModule.forRoot({ maxDepth, resolveSupportId, schemaPath })` — корень GraphQL на процесс: регистрирует
81
+ `GraphqlConfig` с `GraphqlEnvironment` и поднимает `GraphQLModule` на `MercuriusDriver` с опциями `createOptions`:
80
82
 
81
83
  ```ts
82
- ConfigsModule.forFeature([GraphqlConfig], [GraphqlEnvironment])
83
-
84
- GraphQLModule.forRootAsync({
85
- driver: MercuriusDriver,
86
- inject: [GraphqlConfig],
87
- useFactory: (config: GraphqlConfig) => config.createOptions({ maxDepth: 5, resolveSupportId, schemaPath: 'src/schema.gql' }),
84
+ @Module({
85
+ imports: [GraphqlRootModule.forRoot({ maxDepth: 5, resolveSupportId, schemaPath: 'src/schema.gql' })],
88
86
  })
87
+ export class WebModule {}
89
88
  ```
90
89
 
91
90
  Источник `supportId` (трасса, id запроса) пакет не выбирает: резолвер передаёт приложение.
@@ -1,7 +1,7 @@
1
1
  export * from './cursor-output.type.js';
2
2
  export * from './cursor-type.interface.js';
3
3
  export * from './filter-input.type.js';
4
- export * from './listing-payload.js';
4
+ export * from './listing-arguments.js';
5
5
  export * from './listing-response.interface.js';
6
6
  export * from './paginator-input.type.js';
7
7
  export * from './sorting-input.type.js';
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./cursor-output.type.js"), exports);
18
18
  __exportStar(require("./cursor-type.interface.js"), exports);
19
19
  __exportStar(require("./filter-input.type.js"), exports);
20
- __exportStar(require("./listing-payload.js"), exports);
20
+ __exportStar(require("./listing-arguments.js"), exports);
21
21
  __exportStar(require("./listing-response.interface.js"), exports);
22
22
  __exportStar(require("./paginator-input.type.js"), exports);
23
23
  __exportStar(require("./sorting-input.type.js"), exports);
@@ -1,7 +1,7 @@
1
1
  import { FilterInputType } from './filter-input.type.js';
2
2
  import { PaginatorInputType } from './paginator-input.type.js';
3
3
  import { SortingInputType } from './sorting-input.type.js';
4
- export declare class Payload {
4
+ export declare class ListingArguments {
5
5
  filters?: FilterInputType[];
6
6
  paginator: PaginatorInputType;
7
7
  sorting?: SortingInputType[];
@@ -9,33 +9,33 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Payload = void 0;
12
+ exports.ListingArguments = void 0;
13
13
  const graphql_1 = require("@nestjs/graphql");
14
14
  const class_transformer_1 = require("class-transformer");
15
15
  const class_validator_1 = require("class-validator");
16
16
  const filter_input_type_js_1 = require("./filter-input.type.js");
17
17
  const paginator_input_type_js_1 = require("./paginator-input.type.js");
18
18
  const sorting_input_type_js_1 = require("./sorting-input.type.js");
19
- let Payload = class Payload {
19
+ let ListingArguments = class ListingArguments {
20
20
  filters = [];
21
21
  paginator = new paginator_input_type_js_1.PaginatorInputType();
22
22
  sorting = [];
23
23
  };
24
- exports.Payload = Payload;
24
+ exports.ListingArguments = ListingArguments;
25
25
  __decorate([
26
26
  (0, graphql_1.Field)(() => [filter_input_type_js_1.FilterInputType], { nullable: true }),
27
27
  __metadata("design:type", Array)
28
- ], Payload.prototype, "filters", void 0);
28
+ ], ListingArguments.prototype, "filters", void 0);
29
29
  __decorate([
30
30
  (0, graphql_1.Field)(() => paginator_input_type_js_1.PaginatorInputType, { nullable: true }),
31
31
  (0, class_transformer_1.Type)(() => paginator_input_type_js_1.PaginatorInputType),
32
32
  (0, class_validator_1.ValidateNested)(),
33
33
  __metadata("design:type", paginator_input_type_js_1.PaginatorInputType)
34
- ], Payload.prototype, "paginator", void 0);
34
+ ], ListingArguments.prototype, "paginator", void 0);
35
35
  __decorate([
36
36
  (0, graphql_1.Field)(() => [sorting_input_type_js_1.SortingInputType], { nullable: true }),
37
37
  __metadata("design:type", Array)
38
- ], Payload.prototype, "sorting", void 0);
39
- exports.Payload = Payload = __decorate([
38
+ ], ListingArguments.prototype, "sorting", void 0);
39
+ exports.ListingArguments = ListingArguments = __decorate([
40
40
  (0, graphql_1.ArgsType)()
41
- ], Payload);
41
+ ], ListingArguments);
@@ -0,0 +1,5 @@
1
+ import type { DynamicModule } from '@nestjs/common';
2
+ import type { GraphqlConfigOptionsInterface } from './mercurius-options.interface.js';
3
+ export declare class GraphqlRootModule {
4
+ static forRoot(options: GraphqlConfigOptionsInterface): DynamicModule;
5
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.GraphqlRootModule = void 0;
10
+ const nestjs_config_module_1 = require("@libs-for-dev/nestjs-config-module");
11
+ const common_1 = require("@nestjs/common");
12
+ const graphql_1 = require("@nestjs/graphql");
13
+ const mercurius_1 = require("@nestjs/mercurius");
14
+ const graphql_config_js_1 = require("./graphql.config.js");
15
+ const graphql_environment_js_1 = require("./graphql.environment.js");
16
+ let GraphqlRootModule = class GraphqlRootModule {
17
+ static forRoot(options) {
18
+ return {
19
+ imports: [
20
+ graphql_1.GraphQLModule.forRootAsync({
21
+ driver: mercurius_1.MercuriusDriver,
22
+ imports: [nestjs_config_module_1.ConfigsModule.forFeature([graphql_config_js_1.GraphqlConfig], [graphql_environment_js_1.GraphqlEnvironment])],
23
+ inject: [graphql_config_js_1.GraphqlConfig],
24
+ useFactory: (config) => config.createOptions(options),
25
+ }),
26
+ ],
27
+ module: this,
28
+ };
29
+ }
30
+ };
31
+ exports.GraphqlRootModule = GraphqlRootModule;
32
+ exports.GraphqlRootModule = GraphqlRootModule = __decorate([
33
+ (0, common_1.Module)({})
34
+ ], GraphqlRootModule);
@@ -1,3 +1,4 @@
1
+ export * from './graphql-root.module.js';
1
2
  export * from './graphql.config.js';
2
3
  export * from './graphql.environment.js';
3
4
  export * from './mercurius-options.js';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./graphql-root.module.js"), exports);
17
18
  __exportStar(require("./graphql.config.js"), exports);
18
19
  __exportStar(require("./graphql.environment.js"), exports);
19
20
  __exportStar(require("./mercurius-options.js"), exports);
@@ -1,7 +1,7 @@
1
1
  export * from './cursor-output.type.js';
2
2
  export * from './cursor-type.interface.js';
3
3
  export * from './filter-input.type.js';
4
- export * from './listing-payload.js';
4
+ export * from './listing-arguments.js';
5
5
  export * from './listing-response.interface.js';
6
6
  export * from './paginator-input.type.js';
7
7
  export * from './sorting-input.type.js';
@@ -1,7 +1,7 @@
1
1
  export * from './cursor-output.type.js';
2
2
  export * from './cursor-type.interface.js';
3
3
  export * from './filter-input.type.js';
4
- export * from './listing-payload.js';
4
+ export * from './listing-arguments.js';
5
5
  export * from './listing-response.interface.js';
6
6
  export * from './paginator-input.type.js';
7
7
  export * from './sorting-input.type.js';
@@ -1,7 +1,7 @@
1
1
  import { FilterInputType } from './filter-input.type.js';
2
2
  import { PaginatorInputType } from './paginator-input.type.js';
3
3
  import { SortingInputType } from './sorting-input.type.js';
4
- export declare class Payload {
4
+ export declare class ListingArguments {
5
5
  filters?: FilterInputType[];
6
6
  paginator: PaginatorInputType;
7
7
  sorting?: SortingInputType[];
@@ -13,7 +13,7 @@ import { ValidateNested } from 'class-validator';
13
13
  import { FilterInputType } from './filter-input.type.js';
14
14
  import { PaginatorInputType } from './paginator-input.type.js';
15
15
  import { SortingInputType } from './sorting-input.type.js';
16
- let Payload = class Payload {
16
+ let ListingArguments = class ListingArguments {
17
17
  filters = [];
18
18
  paginator = new PaginatorInputType();
19
19
  sorting = [];
@@ -21,18 +21,18 @@ let Payload = class Payload {
21
21
  __decorate([
22
22
  Field(() => [FilterInputType], { nullable: true }),
23
23
  __metadata("design:type", Array)
24
- ], Payload.prototype, "filters", void 0);
24
+ ], ListingArguments.prototype, "filters", void 0);
25
25
  __decorate([
26
26
  Field(() => PaginatorInputType, { nullable: true }),
27
27
  Type(() => PaginatorInputType),
28
28
  ValidateNested(),
29
29
  __metadata("design:type", PaginatorInputType)
30
- ], Payload.prototype, "paginator", void 0);
30
+ ], ListingArguments.prototype, "paginator", void 0);
31
31
  __decorate([
32
32
  Field(() => [SortingInputType], { nullable: true }),
33
33
  __metadata("design:type", Array)
34
- ], Payload.prototype, "sorting", void 0);
35
- Payload = __decorate([
34
+ ], ListingArguments.prototype, "sorting", void 0);
35
+ ListingArguments = __decorate([
36
36
  ArgsType()
37
- ], Payload);
38
- export { Payload };
37
+ ], ListingArguments);
38
+ export { ListingArguments };
@@ -0,0 +1,5 @@
1
+ import type { DynamicModule } from '@nestjs/common';
2
+ import type { GraphqlConfigOptionsInterface } from './mercurius-options.interface.js';
3
+ export declare class GraphqlRootModule {
4
+ static forRoot(options: GraphqlConfigOptionsInterface): DynamicModule;
5
+ }
@@ -0,0 +1,31 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { ConfigsModule } from '@libs-for-dev/nestjs-config-module';
8
+ import { Module } from '@nestjs/common';
9
+ import { GraphQLModule } from '@nestjs/graphql';
10
+ import { MercuriusDriver } from '@nestjs/mercurius';
11
+ import { GraphqlConfig } from './graphql.config.js';
12
+ import { GraphqlEnvironment } from './graphql.environment.js';
13
+ let GraphqlRootModule = class GraphqlRootModule {
14
+ static forRoot(options) {
15
+ return {
16
+ imports: [
17
+ GraphQLModule.forRootAsync({
18
+ driver: MercuriusDriver,
19
+ imports: [ConfigsModule.forFeature([GraphqlConfig], [GraphqlEnvironment])],
20
+ inject: [GraphqlConfig],
21
+ useFactory: (config) => config.createOptions(options),
22
+ }),
23
+ ],
24
+ module: this,
25
+ };
26
+ }
27
+ };
28
+ GraphqlRootModule = __decorate([
29
+ Module({})
30
+ ], GraphqlRootModule);
31
+ export { GraphqlRootModule };
@@ -1,3 +1,4 @@
1
+ export * from './graphql-root.module.js';
1
2
  export * from './graphql.config.js';
2
3
  export * from './graphql.environment.js';
3
4
  export * from './mercurius-options.js';
@@ -1,3 +1,4 @@
1
+ export * from './graphql-root.module.js';
1
2
  export * from './graphql.config.js';
2
3
  export * from './graphql.environment.js';
3
4
  export * from './mercurius-options.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@application-kit/graphql",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Контракт ошибок GraphQL (сервер и клиент) и типы курсорного листинга для NestJS",
5
5
  "keywords": [
6
6
  "apollo",
@@ -80,7 +80,7 @@
80
80
  "test:unit": "vitest run"
81
81
  },
82
82
  "dependencies": {
83
- "@application-kit/typeorm": "^0.5.1"
83
+ "@application-kit/typeorm": "^0.5.2"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@apollo/client": "^4.2.12",
@@ -89,6 +89,8 @@
89
89
  "@nestjs/core": "^11.2.7",
90
90
  "@nestjs/graphql": "^13.4.5",
91
91
  "@nestjs/mercurius": "^13.4.5",
92
+ "@nestjs/platform-fastify": "^11.2.7",
93
+ "@nestjs/testing": "^11.2.7",
92
94
  "@stryker-mutator/core": "^10.0.0",
93
95
  "@stryker-mutator/vitest-runner": "^10.0.0",
94
96
  "@types/node": "^26.2.0",