@webresto/graphql 1.3.6 → 1.3.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.
Files changed (142) hide show
  1. package/.gitattributes +2 -0
  2. package/.gitlab-ci.yml +18 -0
  3. package/.vscode/extensions.json +5 -0
  4. package/docs/actions.md +25 -0
  5. package/docs/authorization.md +215 -0
  6. package/docs/captcha.md +71 -0
  7. package/docs/device-id.md +30 -0
  8. package/docs/messages.md +10 -0
  9. package/docs/user.md +54 -0
  10. package/index.d.ts +0 -1
  11. package/index.js +6 -2
  12. package/index.ts +2 -2
  13. package/lib/afterHook.js +8 -0
  14. package/lib/afterHook.ts +9 -0
  15. package/lib/bindTranslations.d.ts +1 -0
  16. package/lib/bindTranslations.js +40 -0
  17. package/lib/bindTranslations.ts +39 -0
  18. package/lib/defaults.d.ts +1 -0
  19. package/lib/defaults.js +49 -10
  20. package/lib/defaults.ts +55 -0
  21. package/lib/eventHelper.d.ts +14 -5
  22. package/lib/eventHelper.js +28 -9
  23. package/lib/eventHelper.ts +41 -8
  24. package/lib/getRecomended.d.ts +1 -0
  25. package/lib/getRecomended.js +29 -0
  26. package/lib/getRecomended.ts +31 -0
  27. package/lib/graphqlHelper.d.ts +3 -4
  28. package/lib/graphqlHelper.js +184 -73
  29. package/lib/graphqlHelper.ts +329 -186
  30. package/lib/jwt.d.ts +10 -0
  31. package/lib/jwt.js +43 -0
  32. package/lib/jwt.ts +61 -0
  33. package/package.json +13 -6
  34. package/src/additionalResolvers.d.ts +72 -9
  35. package/src/additionalResolvers.js +93 -24
  36. package/src/additionalResolvers.ts +105 -34
  37. package/src/graphql.d.ts +5 -3
  38. package/src/graphql.js +170 -37
  39. package/src/graphql.ts +210 -60
  40. package/src/resolvers/bonusProgram.d.ts +32 -0
  41. package/src/resolvers/bonusProgram.js +65 -0
  42. package/src/resolvers/bonusProgram.ts +79 -0
  43. package/src/resolvers/captcha.d.ts +11 -0
  44. package/src/resolvers/captcha.js +19 -0
  45. package/src/resolvers/captcha.ts +16 -0
  46. package/src/resolvers/checkout.d.ts +43 -14
  47. package/src/resolvers/checkout.js +172 -122
  48. package/src/resolvers/checkout.ts +218 -142
  49. package/src/resolvers/dishAndModifier.js +8 -4
  50. package/src/resolvers/dishAndModifier.ts +4 -0
  51. package/src/resolvers/error.d.ts +9 -0
  52. package/src/resolvers/error.js +21 -0
  53. package/src/resolvers/error.ts +21 -0
  54. package/src/resolvers/menu.d.ts +9 -0
  55. package/src/resolvers/menu.js +12 -0
  56. package/src/resolvers/menu.ts +10 -0
  57. package/src/resolvers/order.d.ts +527 -0
  58. package/src/resolvers/order.js +349 -0
  59. package/src/resolvers/order.ts +435 -0
  60. package/src/resolvers/paymentMethod.js +7 -3
  61. package/src/resolvers/paymentMethod.ts +9 -5
  62. package/src/resolvers/pickupPoint.d.ts +1 -0
  63. package/src/resolvers/pickupPoint.js +24 -0
  64. package/src/resolvers/pickupPoint.ts +23 -0
  65. package/src/resolvers/recomended.d.ts +13 -0
  66. package/src/resolvers/recomended.js +80 -0
  67. package/src/resolvers/recomended.ts +86 -0
  68. package/src/resolvers/restrictions.d.ts +37 -1
  69. package/src/resolvers/restrictions.js +100 -15
  70. package/src/resolvers/restrictions.ts +106 -14
  71. package/src/resolvers/streets.d.ts +1 -1
  72. package/src/resolvers/streets.js +1 -4
  73. package/src/resolvers/streets.ts +1 -3
  74. package/src/resolvers/subscriptions.d.ts +4 -4
  75. package/src/resolvers/subscriptions.js +49 -12
  76. package/src/resolvers/subscriptions.ts +59 -14
  77. package/src/resolvers/telemetry.d.ts +14 -0
  78. package/src/resolvers/telemetry.js +25 -0
  79. package/src/resolvers/telemetry.ts +24 -0
  80. package/src/resolvers/user.d.ts +82 -0
  81. package/src/resolvers/user.js +416 -0
  82. package/src/resolvers/user.ts +621 -0
  83. package/src/resolvers/userLocation.d.ts +53 -0
  84. package/src/resolvers/userLocation.js +74 -0
  85. package/src/resolvers/userLocation.ts +125 -0
  86. package/src/resolvers/userOTPrequest.d.ts +21 -0
  87. package/src/resolvers/userOTPrequest.js +57 -0
  88. package/src/resolvers/userOTPrequest.ts +75 -0
  89. package/test/e2e_helper.js +157 -0
  90. package/test/e2e_helper.ts +212 -0
  91. package/test/fixture/config/i18n.js +7 -20
  92. package/test/fixture/config/locales/de.json +1 -0
  93. package/test/fixture/config/locales/en.json +10 -0
  94. package/test/fixture/config/locales/es.json +3 -0
  95. package/test/fixture/config/locales/fr.json +1 -0
  96. package/test/fixture/config/log.js +1 -1
  97. package/test/fixture/package.json +5 -6
  98. package/test/fixture/patches/rttc+10.0.1.patch +17 -0
  99. package/test/integration/captcha.test.js +20 -0
  100. package/test/integration/captcha.test.ts +25 -0
  101. package/test/integration/dish.test.js +35 -0
  102. package/test/integration/dish.test.ts +43 -0
  103. package/test/integration/graphql.test.js +5 -2
  104. package/test/integration/graphql.test.ts +2 -4
  105. package/test/integration/images.test.js +35 -0
  106. package/test/integration/images.test.ts +40 -0
  107. package/test/integration/locale.test.js +26 -0
  108. package/test/integration/locale.test.ts +32 -0
  109. package/test/integration/order.test.js +56 -43
  110. package/test/integration/order.test.ts +59 -59
  111. package/test/integration/subscriptions.test.js +136 -0
  112. package/test/integration/subscriptions.test.ts +162 -0
  113. package/test/integration/user.test.js +249 -0
  114. package/test/integration/user.test.ts +299 -0
  115. package/test/unit/first.test.js +4 -2
  116. package/test/unit/first.test.ts +1 -1
  117. package/test/unit/get-recomended.test.js +56 -0
  118. package/test/unit/get-recomended.test.ts +63 -0
  119. package/translations/de.json +2 -0
  120. package/translations/en.json +3 -0
  121. package/translations/es.json +3 -0
  122. package/translations/fr.json +2 -0
  123. package/translations/ru.json +36 -0
  124. package/tsconfig.json +20 -5
  125. package/types/global.d.ts +30 -0
  126. package/types/global.js +2 -0
  127. package/types/global.ts +31 -0
  128. package/types/primitives.d.ts +19 -0
  129. package/types/references.d.ts +1 -0
  130. package/types/restoGraphQLConfig.d.ts +13 -0
  131. package/lib/afterHook.ts___graphql-transport-ws +0 -138
  132. package/lib/afterHook.ts___graphql-ws +0 -133
  133. package/lib/errorWrapper.d.ts +0 -4
  134. package/lib/errorWrapper.js +0 -13
  135. package/lib/errorWrapper.ts +0 -12
  136. package/notes.md +0 -1976
  137. package/src/resolvers/cart.d.ts +0 -343
  138. package/src/resolvers/cart.js +0 -196
  139. package/src/resolvers/cart.ts +0 -277
  140. package/test/fixture/config/connections.js +0 -9
  141. package/test/integration/sails_not_crash.test.js +0 -3
  142. package/test/integration/sails_not_crash.test.ts +0 -3
@@ -0,0 +1,2 @@
1
+ {
2
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "Status here": "Status here"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "Status here": "Estado aquí"
3
+ }
@@ -0,0 +1,2 @@
1
+ {
2
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "Status here": "Статус здесь",
3
+ "Order not found": "Заказ не найден",
4
+ "Order with id %s not found": "Заказ с ID %s не найден",
5
+ "Error": "Ошибка",
6
+ "Cart was ordered": "Корзина была заказана",
7
+ "Checking the payment system ended in failure": "Проверка платежной системы завершилась неудачно",
8
+ "Attention": "Внимание",
9
+ "Ready for order": "Готов к заказу",
10
+ "It was not possible to check the order": "Не удалось проверить заказ",
11
+ "Enter the name of the customer": "Введите имя клиента",
12
+ "Enter the customer's phone": "Введите телефон клиента",
13
+ "The wrong format of the name of the customer": "Неправильный формат имени клиента",
14
+ "The wrong format of the customer number": "Неправильный формат номера клиента",
15
+ "No point of Street": "Не указана улица",
16
+ "Not indicated the house number": "Не указан номер дома",
17
+ "The city is not indicated": "Город не указан",
18
+ "The payment system is not available": "Платежная система недоступна",
19
+ "The date of execution of the order is not true": "Дата исполнения заказа не соответствует действительности",
20
+ "Problem when checking the order: %s": "Проблема при проверке заказа: %s",
21
+ "Successfully": "Успешно",
22
+ "Your order is accepted for processing": "Ваш заказ принят в обработку",
23
+ "Success": "Успех",
24
+ "OTP sended": "КОД отправлен",
25
+ "Authorization": "Авторизация",
26
+ "User not found": "Пользователь не найден",
27
+ "Check login please": "Пожалуйста, проверьте логин",
28
+ "Password was cahanged": "Пароль был изменен",
29
+ "New user created": "Создан новый пользователь",
30
+ "Logout": "Выйти",
31
+ "Logout from all devices": "Выйти со всех устройств",
32
+ "User was updated": "Пользователь обновлен",
33
+ "The user will be deleted": "Пользователь будет удален",
34
+ "Error: %s": "Ошибка: %s",
35
+ "Ordering for a date in the past is not possible": "Заказ на дату в прошлом невозможен"
36
+ }
package/tsconfig.json CHANGED
@@ -1,10 +1,25 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "module": "commonjs",
4
- "target": "es2019"
4
+ "target": "es2022",
5
+ "lib": [
6
+ "dom"
7
+ ],
8
+ "types": [
9
+ "bluebird-global",
10
+ "mocha",
11
+ "node",
12
+ "chai",
13
+ "@webresto/core"
14
+ ],
15
+ "sourceMap": false,
16
+ "declaration": true,
17
+ "removeComments": false,
18
+ "skipLibCheck": true,
19
+ // TODO: ts with "strict": true,
20
+ // "alwaysStrict": true
5
21
  },
6
- "exclude": ["node_modules"],
7
- "types": [
8
- "@webresto/core",
9
- ]
22
+ "exclude": [
23
+ "node_modules"
24
+ ]
10
25
  }
@@ -0,0 +1,30 @@
1
+ import sails from "@42pub/typed-sails";
2
+ import { Config } from "@webresto/core/interfaces/Config";
3
+ import AwaitEmitter from "@webresto/core/libs/AwaitEmitter";
4
+ import { NotificationManager } from "@webresto/core/libs/NotificationManager";
5
+ type sailsConfig = typeof sails.config;
6
+ declare global {
7
+ const emitter: AwaitEmitter;
8
+ const NotificationManager: NotificationManager;
9
+ const Adapter: typeof import("@webresto/core/adapters").Adapter;
10
+ export interface Sails extends sails.Sails {
11
+ on: any;
12
+ emit: any;
13
+ router: any;
14
+ hooks: any;
15
+ models: any;
16
+ config: _sailsConfig;
17
+ log: any;
18
+ after: any;
19
+ graphql: any;
20
+ }
21
+ interface _sailsConfig extends sailsConfig {
22
+ restocore: Config;
23
+ [key: string]: any | object;
24
+ }
25
+ export const sails: Sails;
26
+ type ReqType = sails.Request;
27
+ type ResType = sails.Response;
28
+ type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];
29
+ }
30
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,31 @@
1
+ import sails from "@42pub/typed-sails";
2
+ import { Config } from "@webresto/core/interfaces/Config";
3
+ import AwaitEmitter from "@webresto/core/libs/AwaitEmitter";
4
+ import { NotificationManager } from "@webresto/core/libs/NotificationManager"
5
+ type sailsConfig = typeof sails.config;
6
+
7
+ declare global {
8
+ const emitter: AwaitEmitter;
9
+ const NotificationManager: NotificationManager
10
+ const Adapter: typeof import("@webresto/core/adapters").Adapter
11
+
12
+ export interface Sails extends sails.Sails {
13
+ on: any
14
+ emit: any
15
+ router: any
16
+ hooks: any
17
+ models: any;
18
+ config: _sailsConfig;
19
+ log: any;
20
+ after: any;
21
+ graphql: any;
22
+ }
23
+ interface _sailsConfig extends sailsConfig {
24
+ restocore: Config;
25
+ [key:string]: any | object;
26
+ }
27
+ export const sails: Sails;
28
+ type ReqType = sails.Request;
29
+ type ResType = sails.Response;
30
+ type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];
31
+ }
@@ -0,0 +1,19 @@
1
+ export interface Message {
2
+ title: string
3
+ type: "error" | "info"
4
+ id?: string
5
+ message?: string
6
+ deviceId: string
7
+ }
8
+
9
+ export interface Action {
10
+ type: string
11
+ data: object | string
12
+ id?: string
13
+ deviceId: string
14
+ }
15
+
16
+ export interface Response {
17
+ message?: Message | undefined | null
18
+ action?: Action | undefined | null
19
+ }
@@ -0,0 +1 @@
1
+ // <reference path="./node_modules/@webresto/core/interfaces/globalTypes.ts"/>
@@ -0,0 +1,13 @@
1
+ import User from "@webresto/core/models/User"
2
+ export interface RestoGraphQLConfig {
3
+ // /**
4
+ // * This method retruns user by context.connectionParams.authorization
5
+ // *`function(context.connectionParams.authorization){
6
+ // * user = ...
7
+ // * retrun user
8
+ // * }`
9
+ // */
10
+ // authService(token: string): Promise<User>
11
+ whiteListAutoGen?: {[key: string]: string[]}
12
+ blackList?: string[]
13
+ }
@@ -1,138 +0,0 @@
1
- import graphql from "../src/graphql";
2
- import * as helper from "./graphqlHelper";
3
- import { useServer } from 'graphql-ws/lib/use/ws';
4
- import { execute, subscribe } from "graphql";
5
- import * as WebSocket from 'ws';
6
-
7
-
8
- import { createServer } from 'graphql-transport-ws';
9
-
10
- import * as url from "url";
11
- import { formatApolloErrors } from "apollo-server-errors";
12
-
13
- export default async function () {
14
- try {
15
- sails.log.verbose(">>> graphql hook starting");
16
- sails.on("lifted", async function () {
17
- const graphServer = await graphql.init();
18
-
19
- // inject middleware into express app
20
- sails.hooks.http.app.use(graphServer.getMiddleware());
21
- let layer = sails.hooks.http.app._router.stack.slice(-1)[0];
22
- sails.hooks.http.app._router.stack.splice(1, 0, layer);
23
- // graphServer.installSubscriptionHandlers(sails.hooks.http.server);
24
-
25
- // WebSocket
26
-
27
- const schema = graphServer.schema;
28
-
29
- const graphqlWS = new WebSocket.Server({ noServer: true });
30
- console.log(graphqlWS)
31
- // serve graphql
32
- // useServer({ schema }, graphqlWS);
33
-
34
- // const subscriptionServer = createServer(
35
- // {
36
- // schema,
37
- // execute,
38
- // subscribe,
39
- // onConnect() {
40
- // console.log("SubscriptionServer ready!");
41
- // }
42
- // },
43
- // {
44
- // noServer: true,
45
- // }
46
- // );
47
-
48
-
49
- // const subscriptionServer = SubscriptionServer.create(
50
- // {
51
- // schema,
52
- // execute,
53
- // subscribe,
54
- // onConnect:(connectionParams: Object) => ({ ...connectionParams }),
55
- // // onDisconnect: onDisconnect,
56
- // onOperation: async (
57
- // message: { payload: any },
58
- // connection: ExecutionParams,
59
- // ) => {
60
- // connection.formatResponse = (value: any) => ({
61
- // ...value,
62
- // // errors:
63
- // // value.errors &&
64
- // // formatApolloErrors([...value.errors], {
65
- // // formatter: this.requestOptions.formatError,
66
- // // debug: this.requestOptions.debug,
67
- // // }),
68
- // });
69
-
70
- // // connection.formatError = this.requestOptions.formatError;
71
- // console.log("<><><><",this.context, connection)
72
- // let context: any = this.context ? this.context : { connection };
73
-
74
- // try {
75
- // context =
76
- // typeof this.context === 'function'
77
- // ? await this.context({ connection, payload: message.payload })
78
- // : context;
79
- // } catch (e) {
80
- // // throw formatApolloErrors([e], {
81
- // // formatter: this.requestOptions.formatError,
82
- // // debug: this.requestOptions.debug,
83
- // // })[0];
84
- // }
85
-
86
- // return { ...connection, context };
87
- // },
88
- // // keepAlive,
89
- // // validationRules: this.requestOptions.validationRules,
90
- // },
91
- // {
92
- // noServer: true,
93
- // }
94
- // );
95
-
96
- //@ts-ignore we need to access the private field which typescript does not like
97
- // const wsServer: WebSocket.Server = subscriptionServer.wsServer;
98
- const upgradeHandler = (req, socket, head) => {
99
- if (!req.url) return;
100
- const pathname = url.parse(req.url).pathname;
101
-
102
- if (!pathname) return;
103
-
104
-
105
- // if (pathname === '/graphql') {
106
- // return graphqlWS.handleUpgrade(request, socket, head, (client) => {
107
- // graphqlWS.emit('connection', client, request);
108
- // });
109
- // }
110
-
111
- console.log(pathname)
112
- if (pathname.startsWith("/graphql")) {
113
- console.log(">>>>>>>>>>>>>>>>>>>..")
114
-
115
- graphqlWS.handleUpgrade(req, socket, head, (ws) => {
116
- console.log(">>>>>>>>>>>>>>>>>>>..111")
117
- graphqlWS.emit('connection', ws, req);
118
- });
119
- }
120
- };
121
-
122
- sails.hooks.http.server.on("upgrade", upgradeHandler);
123
-
124
- createServer(
125
- {
126
- schema,
127
- execute,
128
- subscribe,
129
- },
130
- graphqlWS,
131
- );
132
-
133
-
134
- });
135
- } catch (e) {
136
- sails.log.error("graphql > afterHook > error1", e);
137
- }
138
- }
@@ -1,133 +0,0 @@
1
- import graphql from "../src/graphql";
2
- import * as helper from "./graphqlHelper";
3
- import { useServer } from 'graphql-ws/lib/use/ws';
4
- import { execute, subscribe } from "graphql";
5
- import * as ws from "ws";
6
- const WebSocketServer = ws.Server
7
-
8
- import * as url from "url";
9
- import { formatApolloErrors } from "apollo-server-errors";
10
-
11
- export default async function () {
12
- try {
13
- sails.log.verbose(">>> graphql hook starting");
14
- sails.on("lifted", async function () {
15
- const graphServer = await graphql.init();
16
-
17
- // inject middleware into express app
18
- sails.hooks.http.app.use(graphServer.getMiddleware());
19
- let layer = sails.hooks.http.app._router.stack.slice(-1)[0];
20
- sails.hooks.http.app._router.stack.splice(1, 0, layer);
21
- // graphServer.installSubscriptionHandlers(sails.hooks.http.server);
22
-
23
- // WebSocket
24
-
25
- const schema = graphServer.schema;
26
-
27
- const graphqlWS = new WebSocketServer({ noServer: true });
28
-
29
- // serve graphql
30
- useServer({ schema }, graphqlWS);
31
-
32
- // const subscriptionServer = SubscriptionServer.create(
33
- // {
34
- // schema,
35
- // execute,
36
- // subscribe,
37
- // onConnect() {
38
- // console.log("SubscriptionServer ready!");
39
- // },
40
- // onOperation: async (
41
- // message: { payload: any },
42
- // connection: ExecutionParams
43
- // ) => {
44
- // connection.formatResponse = (value: any) => ({
45
- // ...value
46
- // });
47
- // console.log("<><><><",this.context)
48
- // let context: any = this.context ? this.context : { connection };
49
-
50
- // try {
51
- // context =
52
- // typeof this.context === "function"
53
- // ? await this.context({ connection, payload: message.payload })
54
- // : context;
55
- // } catch (e) {
56
- // console.log(e)
57
- // }
58
-
59
- // return { ...connection, context };
60
- // },
61
- // },
62
- // {
63
- // noServer: true,
64
- // }
65
- // );
66
-
67
- // const subscriptionServer = SubscriptionServer.create(
68
- // {
69
- // schema,
70
- // execute,
71
- // subscribe,
72
- // onConnect:(connectionParams: Object) => ({ ...connectionParams }),
73
- // // onDisconnect: onDisconnect,
74
- // onOperation: async (
75
- // message: { payload: any },
76
- // connection: ExecutionParams,
77
- // ) => {
78
- // connection.formatResponse = (value: any) => ({
79
- // ...value,
80
- // // errors:
81
- // // value.errors &&
82
- // // formatApolloErrors([...value.errors], {
83
- // // formatter: this.requestOptions.formatError,
84
- // // debug: this.requestOptions.debug,
85
- // // }),
86
- // });
87
-
88
- // // connection.formatError = this.requestOptions.formatError;
89
- // console.log("<><><><",this.context, connection)
90
- // let context: any = this.context ? this.context : { connection };
91
-
92
- // try {
93
- // context =
94
- // typeof this.context === 'function'
95
- // ? await this.context({ connection, payload: message.payload })
96
- // : context;
97
- // } catch (e) {
98
- // // throw formatApolloErrors([e], {
99
- // // formatter: this.requestOptions.formatError,
100
- // // debug: this.requestOptions.debug,
101
- // // })[0];
102
- // }
103
-
104
- // return { ...connection, context };
105
- // },
106
- // // keepAlive,
107
- // // validationRules: this.requestOptions.validationRules,
108
- // },
109
- // {
110
- // noServer: true,
111
- // }
112
- // );
113
-
114
- //@ts-ignore we need to access the private field which typescript does not like
115
- // const wsServer: WebSocket.Server = subscriptionServer.wsServer;
116
- const upgradeHandler = (req, socket, head) => {
117
- if (!req.url) return;
118
- const pathname = url.parse(req.url).pathname;
119
-
120
- if (!pathname) return;
121
-
122
- if (pathname.startsWith("/graphql")) {
123
- graphqlWS.handleUpgrade(req, socket, head, (ws) => {
124
- graphqlWS.emit("connection", ws, req);
125
- });
126
- }
127
- };
128
- sails.hooks.http.server.on("upgrade", upgradeHandler);
129
- });
130
- } catch (e) {
131
- sails.log.error("graphql > afterHook > error1", e);
132
- }
133
- }
@@ -1,4 +0,0 @@
1
- import { ApolloError } from 'apollo-server-errors';
2
- export declare class Error extends ApolloError {
3
- constructor(code?: string, message?: string);
4
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Error = void 0;
4
- const apollo_server_errors_1 = require("apollo-server-errors");
5
- class Error extends apollo_server_errors_1.ApolloError {
6
- constructor(code, message) {
7
- if (process.env.NODE_ENV == "production" && code === "INTERNAL_ERROR")
8
- message = 'Что-то пошло не так';
9
- super(message, code);
10
- Object.defineProperty(this, 'name', { value: '' });
11
- }
12
- }
13
- exports.Error = Error;
@@ -1,12 +0,0 @@
1
- import { ApolloError } from 'apollo-server-errors';
2
-
3
- export class Error extends ApolloError {
4
- constructor(code?: string, message?: string) {
5
- if (process.env.NODE_ENV == "production" && code === "INTERNAL_ERROR")
6
- message = 'Что-то пошло не так';
7
- super(message, code);
8
-
9
-
10
- Object.defineProperty(this, 'name', { value: '' });
11
- }
12
- }