@longvansoftware/storefront-js-client 1.4.7 → 1.4.9

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.
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ComputingService = void 0;
13
+ const mutations_1 = require("../../graphql/computing/mutations");
13
14
  const queries_1 = require("../../graphql/computing/queries");
14
15
  const serviceSDK_1 = require("../serviceSDK");
15
16
  class ComputingService extends serviceSDK_1.Service {
@@ -32,7 +33,7 @@ class ComputingService extends serviceSDK_1.Service {
32
33
  computingId,
33
34
  };
34
35
  try {
35
- const response = yield this.graphqlQuery(query, variables);
36
+ const response = yield this.graphqlQueryV2(query, variables);
36
37
  return response.computingDetail;
37
38
  }
38
39
  catch (error) {
@@ -48,7 +49,7 @@ class ComputingService extends serviceSDK_1.Service {
48
49
  computingId,
49
50
  };
50
51
  try {
51
- const response = yield this.graphqlQuery(query, variables);
52
+ const response = yield this.graphqlQueryV2(query, variables);
52
53
  return response.portNats;
53
54
  }
54
55
  catch (error) {
@@ -57,5 +58,197 @@ class ComputingService extends serviceSDK_1.Service {
57
58
  }
58
59
  });
59
60
  }
61
+ restartVM(computingId, actor) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const mutation = mutations_1.RESTARTVM;
64
+ const variables = {
65
+ computingId,
66
+ actor,
67
+ };
68
+ try {
69
+ const response = yield this.graphqlMutationV2(mutation, variables);
70
+ return response.restart;
71
+ }
72
+ catch (error) {
73
+ console.log(`Error in restartVM: ${error}`);
74
+ throw error;
75
+ }
76
+ });
77
+ }
78
+ updateDescriptionPortNat(payload, updateBy) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const mutation = mutations_1.UPDATE_DESCRIPTION_PORTNAT;
81
+ const variables = {
82
+ portNatId: payload.portNatId,
83
+ description: payload.description,
84
+ updateBy,
85
+ };
86
+ try {
87
+ const response = yield this.graphqlMutationV2(mutation, variables);
88
+ return response.updateDescriptionPortNat;
89
+ }
90
+ catch (error) {
91
+ console.log(`Error in updateDescriptionPortNat: ${error}`);
92
+ throw error;
93
+ }
94
+ });
95
+ }
96
+ createPortNat(payload, createBy) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ const mutation = mutations_1.CREATE_PORT_NAT;
99
+ const variables = {
100
+ portNatId: payload.portNatId,
101
+ translatedPort: payload.translatedPort,
102
+ createBy,
103
+ };
104
+ try {
105
+ const response = yield this.graphqlMutationV2(mutation, variables);
106
+ return response.createPortNat;
107
+ }
108
+ catch (error) {
109
+ console.log(`Error in createPortNat: ${error}`);
110
+ throw error;
111
+ }
112
+ });
113
+ }
114
+ updatePortNat(payload, updateBy) {
115
+ return __awaiter(this, void 0, void 0, function* () {
116
+ const mutation = mutations_1.UPDATE_PORT_NAT;
117
+ const variables = {
118
+ portNatId: payload.portNatId,
119
+ translatedPort: payload.translatedPort,
120
+ updateBy,
121
+ };
122
+ try {
123
+ const response = yield this.graphqlMutationV2(mutation, variables);
124
+ return response.updatePortNat;
125
+ }
126
+ catch (error) {
127
+ console.log(`Error in updatePortNat: ${error}`);
128
+ throw error;
129
+ }
130
+ });
131
+ }
132
+ removePortNat(portNatId, updateBy) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ const mutation = mutations_1.REMOVE_PORT_NAT;
135
+ const variables = {
136
+ portNatId,
137
+ updateBy,
138
+ };
139
+ try {
140
+ const response = yield this.graphqlMutationV2(mutation, variables);
141
+ return response.removePortNat;
142
+ }
143
+ catch (error) {
144
+ console.log(`Error in removePortNat: ${error}`);
145
+ throw error;
146
+ }
147
+ });
148
+ }
149
+ startVM(computingId, actor) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ const mutation = mutations_1.POWER_ON;
152
+ const variables = {
153
+ computingId,
154
+ actor,
155
+ };
156
+ try {
157
+ const response = yield this.graphqlMutationV2(mutation, variables);
158
+ return response.powerOn;
159
+ }
160
+ catch (error) {
161
+ console.log(`Error in startVM: ${error}`);
162
+ throw error;
163
+ }
164
+ });
165
+ }
166
+ stopVM(computingId, actor) {
167
+ return __awaiter(this, void 0, void 0, function* () {
168
+ const mutation = mutations_1.POWER_OFF;
169
+ const variables = {
170
+ computingId,
171
+ actor,
172
+ };
173
+ try {
174
+ const response = yield this.graphqlMutationV2(mutation, variables);
175
+ return response.powerOff;
176
+ }
177
+ catch (error) {
178
+ console.log(`Error in stopVM: ${error}`);
179
+ throw error;
180
+ }
181
+ });
182
+ }
183
+ snapshots(computingId) {
184
+ return __awaiter(this, void 0, void 0, function* () {
185
+ const query = queries_1.SNAP_SHOTS;
186
+ const variables = {
187
+ computingId,
188
+ };
189
+ try {
190
+ const response = yield this.graphqlQueryV2(query, variables);
191
+ return response.snapshots;
192
+ }
193
+ catch (error) {
194
+ console.log(`Error in snapshots: ${error}`);
195
+ throw error;
196
+ }
197
+ });
198
+ }
199
+ createSnapshot(payload, createBy) {
200
+ return __awaiter(this, void 0, void 0, function* () {
201
+ const mutation = mutations_1.CREATE_SNAP_SHOT;
202
+ const variables = {
203
+ computingId: payload.computingId,
204
+ snapshotName: payload.snapshotName,
205
+ createBy,
206
+ };
207
+ try {
208
+ const response = yield this.graphqlMutationV2(mutation, variables);
209
+ return response.createSnapshot;
210
+ }
211
+ catch (error) {
212
+ console.log(`Error in createSnapshot: ${error}`);
213
+ throw error;
214
+ }
215
+ });
216
+ }
217
+ rollbackSnapshot(payload, createBy) {
218
+ return __awaiter(this, void 0, void 0, function* () {
219
+ const mutation = mutations_1.ROLLBACK_SNAPSHOT;
220
+ const variables = {
221
+ computingId: payload.computingId,
222
+ snapshotId: payload.snapshotId,
223
+ createBy,
224
+ };
225
+ try {
226
+ const response = yield this.graphqlMutationV2(mutation, variables);
227
+ return response.rollbackSnapshot;
228
+ }
229
+ catch (error) {
230
+ console.log(`Error in rollbackSnapshot: ${error}`);
231
+ throw error;
232
+ }
233
+ });
234
+ }
235
+ deleteSnapshot(payload, updateBy) {
236
+ return __awaiter(this, void 0, void 0, function* () {
237
+ const mutation = mutations_1.DELETE_SNAPSHOT;
238
+ const variables = {
239
+ computingId: payload.computingId,
240
+ snapshotId: payload.snapshotId,
241
+ updateBy,
242
+ };
243
+ try {
244
+ const response = yield this.graphqlMutationV2(mutation, variables);
245
+ return response.deleteSnapshot;
246
+ }
247
+ catch (error) {
248
+ console.log(`Error in deleteSnapshot: ${error}`);
249
+ throw error;
250
+ }
251
+ });
252
+ }
60
253
  }
61
254
  exports.ComputingService = ComputingService;
@@ -1,5 +1,5 @@
1
- import { AddOpportunityRequest, GetOpportunityRequest } from '../../types/crm';
2
- import { Service } from '../serviceSDK';
1
+ import { AddAttachmentRequest, AddOpportunityRequest, AddTicketRequest, GetCommentRequest, GetOpportunityRequest, getTicketRequest } from "../../types/crm";
2
+ import { Service } from "../serviceSDK";
3
3
  export declare class CrmService extends Service {
4
4
  constructor(endpoint: string, orgId: string, storeId: string);
5
5
  setToken(token: string): void;
@@ -12,4 +12,10 @@ export declare class CrmService extends Service {
12
12
  updateWorkEffortName(performerId: string, workEffortId: string, name: string): Promise<any>;
13
13
  updateWorkEffortStatus(performerId: string, workEffortId: string, source: string, status: string): Promise<any>;
14
14
  addAttachmentForWorkEffort(performerId: string, workEffortId: string, attachments: [{}]): Promise<any>;
15
+ getListTicket(performerId: string, getTicketRequest: getTicketRequest): Promise<any>;
16
+ addTicket(performerId: string, addTicketRequest: AddTicketRequest, addAttachmentRequest: [AddAttachmentRequest]): Promise<any>;
17
+ getTicketById(ticketId: string): Promise<any>;
18
+ getAttachmentByWorkEffortId(workEffortIds: [string]): Promise<any>;
19
+ getListComment(getCommentRequest: GetCommentRequest): Promise<any>;
20
+ addComment(params: any): Promise<any>;
15
21
  }
@@ -29,7 +29,7 @@ class CrmService extends serviceSDK_1.Service {
29
29
  performerId,
30
30
  };
31
31
  try {
32
- const response = yield this.graphqlMutation(mutation, variables);
32
+ const response = yield this.graphqlMutationV2(mutation, variables);
33
33
  return response.addOpportunity;
34
34
  }
35
35
  catch (error) {
@@ -47,7 +47,7 @@ class CrmService extends serviceSDK_1.Service {
47
47
  getOpportunityRequest,
48
48
  };
49
49
  try {
50
- const response = yield this.graphqlQuery(query, variables);
50
+ const response = yield this.graphqlQueryV2(query, variables);
51
51
  return response.getListOpportunity;
52
52
  }
53
53
  catch (error) {
@@ -61,10 +61,10 @@ class CrmService extends serviceSDK_1.Service {
61
61
  const query = queries_1.GET_LIST_TODO;
62
62
  const variables = {
63
63
  partyId: this.orgId,
64
- workEffortId
64
+ workEffortId,
65
65
  };
66
66
  try {
67
- const response = yield this.graphqlQuery(query, variables);
67
+ const response = yield this.graphqlQueryV2(query, variables);
68
68
  return response.getListTodo;
69
69
  }
70
70
  catch (error) {
@@ -78,10 +78,10 @@ class CrmService extends serviceSDK_1.Service {
78
78
  const query = queries_1.GET_LIST_WORK_EFFORT_TYPE;
79
79
  const variables = {
80
80
  partyId: this.orgId,
81
- id
81
+ id,
82
82
  };
83
83
  try {
84
- const response = yield this.graphqlQuery(query, variables);
84
+ const response = yield this.graphqlQueryV2(query, variables);
85
85
  return response.getListWorkEffortType;
86
86
  }
87
87
  catch (error) {
@@ -96,10 +96,10 @@ class CrmService extends serviceSDK_1.Service {
96
96
  const variables = {
97
97
  performerId,
98
98
  attachmentId,
99
- status
99
+ status,
100
100
  };
101
101
  try {
102
- const response = yield this.graphqlMutation(mutation, variables);
102
+ const response = yield this.graphqlMutationV2(mutation, variables);
103
103
  return response.updateStatusAttachmentById;
104
104
  }
105
105
  catch (error) {
@@ -114,10 +114,10 @@ class CrmService extends serviceSDK_1.Service {
114
114
  const variables = {
115
115
  performerId,
116
116
  workEffortId,
117
- description
117
+ description,
118
118
  };
119
119
  try {
120
- const response = yield this.graphqlMutation(mutation, variables);
120
+ const response = yield this.graphqlMutationV2(mutation, variables);
121
121
  return response.updateWorkEffortDescription;
122
122
  }
123
123
  catch (error) {
@@ -133,10 +133,10 @@ class CrmService extends serviceSDK_1.Service {
133
133
  partyId: this.orgId,
134
134
  performerId,
135
135
  workEffortId,
136
- newName: name
136
+ newName: name,
137
137
  };
138
138
  try {
139
- const response = yield this.graphqlMutation(mutation, variables);
139
+ const response = yield this.graphqlMutationV2(mutation, variables);
140
140
  return response.updateWorkEffortName;
141
141
  }
142
142
  catch (error) {
@@ -153,10 +153,10 @@ class CrmService extends serviceSDK_1.Service {
153
153
  performerId,
154
154
  workEffortId,
155
155
  source,
156
- status
156
+ status,
157
157
  };
158
158
  try {
159
- const response = yield this.graphqlMutation(mutation, variables);
159
+ const response = yield this.graphqlMutationV2(mutation, variables);
160
160
  return response.updateWorkEffortStatus;
161
161
  }
162
162
  catch (error) {
@@ -175,7 +175,7 @@ class CrmService extends serviceSDK_1.Service {
175
175
  attachments,
176
176
  };
177
177
  try {
178
- const response = yield this.graphqlMutation(mutation, variables);
178
+ const response = yield this.graphqlMutationV2(mutation, variables);
179
179
  return response.addAttachmentForWorkEffort;
180
180
  }
181
181
  catch (error) {
@@ -184,5 +184,113 @@ class CrmService extends serviceSDK_1.Service {
184
184
  }
185
185
  });
186
186
  }
187
+ getListTicket(performerId, getTicketRequest) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ const query = queries_1.GET_LIST_TICKET;
190
+ const variables = {
191
+ partyId: this.orgId,
192
+ performerId,
193
+ getTicketRequest,
194
+ };
195
+ try {
196
+ const response = yield this.graphqlQueryV2(query, variables);
197
+ return response.getListTicket;
198
+ }
199
+ catch (error) {
200
+ console.log(`Error in getListTicket: ${error}`);
201
+ throw error;
202
+ }
203
+ });
204
+ }
205
+ addTicket(performerId, addTicketRequest, addAttachmentRequest) {
206
+ return __awaiter(this, void 0, void 0, function* () {
207
+ const mutation = mutations_1.ADD_TICKED;
208
+ const variables = {
209
+ partyId: this.orgId,
210
+ performerId,
211
+ addTicketRequest,
212
+ addAttachmentRequest,
213
+ };
214
+ try {
215
+ const response = yield this.graphqlMutationV2(mutation, variables);
216
+ return response.addTicket;
217
+ }
218
+ catch (error) {
219
+ console.log(`Error in addTicket: ${error}`);
220
+ throw error;
221
+ }
222
+ });
223
+ }
224
+ getTicketById(ticketId) {
225
+ return __awaiter(this, void 0, void 0, function* () {
226
+ const query = queries_1.GET_TICKET_BY_ID;
227
+ const variables = {
228
+ ticketId,
229
+ };
230
+ try {
231
+ const response = yield this.graphqlQueryV2(query, variables);
232
+ return response.getTicketById;
233
+ }
234
+ catch (error) {
235
+ console.log(`Error in getTicketById: ${error}`);
236
+ throw error;
237
+ }
238
+ });
239
+ }
240
+ getAttachmentByWorkEffortId(workEffortIds) {
241
+ return __awaiter(this, void 0, void 0, function* () {
242
+ const query = queries_1.GET_ATTACHMENT_BY_WORK_EFFORT_ID;
243
+ const variables = {
244
+ partyId: this.orgId,
245
+ workEffortIds,
246
+ };
247
+ try {
248
+ const response = yield this.graphqlQueryV2(query, variables);
249
+ return response.getAttachmentByWorkEffortId;
250
+ }
251
+ catch (error) {
252
+ console.log(`Error in getAttachmentByWorkEffortId: ${error}`);
253
+ throw error;
254
+ }
255
+ });
256
+ }
257
+ getListComment(getCommentRequest) {
258
+ return __awaiter(this, void 0, void 0, function* () {
259
+ const query = queries_1.GET_LIST_COMMENT;
260
+ const variables = {
261
+ partyId: this.orgId,
262
+ getCommentRequest,
263
+ };
264
+ try {
265
+ const response = yield this.graphqlQueryV2(query, variables);
266
+ return response.getListComment;
267
+ }
268
+ catch (error) {
269
+ console.log(`Error in getListComment: ${error}`);
270
+ throw error;
271
+ }
272
+ });
273
+ }
274
+ addComment(params) {
275
+ return __awaiter(this, void 0, void 0, function* () {
276
+ const mutation = mutations_1.ADD_COMMENT;
277
+ const variables = {
278
+ partyId: this.orgId,
279
+ performerId: params.performerId,
280
+ format: params.addAttachmentRequest ? "ATTACHMENT" : "TEXT",
281
+ content: params.content,
282
+ referId: params.referId,
283
+ addAttachmentRequest: params.addAttachmentRequest,
284
+ };
285
+ try {
286
+ const response = yield this.graphqlMutationV2(mutation, variables);
287
+ return response.addComment;
288
+ }
289
+ catch (error) {
290
+ console.log(`Error in addComment: ${error}`);
291
+ throw error;
292
+ }
293
+ });
294
+ }
187
295
  }
188
296
  exports.CrmService = CrmService;
@@ -35,7 +35,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
35
35
  serviceId,
36
36
  };
37
37
  try {
38
- const response = yield this.graphqlQuery(query, variables);
38
+ const response = yield this.graphqlQueryV2(query, variables);
39
39
  return response.getServiceById;
40
40
  }
41
41
  catch (error) {
@@ -60,7 +60,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
60
60
  ownerId,
61
61
  };
62
62
  try {
63
- const response = yield this.graphqlQuery(query, variables);
63
+ const response = yield this.graphqlQueryV2(query, variables);
64
64
  return response.getServiceByOwnerId;
65
65
  }
66
66
  catch (error) {
@@ -81,7 +81,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
81
81
  serviceId: serviceId,
82
82
  };
83
83
  try {
84
- const response = yield this.graphqlQuery(query, variables);
84
+ const response = yield this.graphqlQueryV2(query, variables);
85
85
  return response.getServiceActions;
86
86
  }
87
87
  catch (error) {
@@ -101,7 +101,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
101
101
  createModel: data,
102
102
  };
103
103
  try {
104
- const response = yield this.graphqlMutation(mutation, variables);
104
+ const response = yield this.graphqlMutationV2(mutation, variables);
105
105
  return response.createService;
106
106
  }
107
107
  catch (error) {
@@ -125,7 +125,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
125
125
  updatedBy: updatedBy,
126
126
  };
127
127
  try {
128
- const response = yield this.graphqlMutation(mutation, variables);
128
+ const response = yield this.graphqlMutationV2(mutation, variables);
129
129
  return response.updateService;
130
130
  }
131
131
  catch (error) {
@@ -147,7 +147,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
147
147
  deletedBy: deletedBy,
148
148
  };
149
149
  try {
150
- const response = yield this.graphqlMutation(mutation, variables);
150
+ const response = yield this.graphqlMutationV2(mutation, variables);
151
151
  return response.deleteService;
152
152
  }
153
153
  catch (error) {
@@ -173,7 +173,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
173
173
  updatedBy: updatedBy,
174
174
  };
175
175
  try {
176
- const response = yield this.graphqlMutation(mutation, variables);
176
+ const response = yield this.graphqlMutationV2(mutation, variables);
177
177
  return response.updateAttrValue;
178
178
  }
179
179
  catch (error) {
@@ -197,7 +197,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
197
197
  updatedBy: updatedBy,
198
198
  };
199
199
  try {
200
- const response = yield this.graphqlMutation(mutation, variables);
200
+ const response = yield this.graphqlMutationV2(mutation, variables);
201
201
  return response.deleteAttrValue;
202
202
  }
203
203
  catch (error) {
@@ -219,7 +219,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
219
219
  updatedBy: updatedBy,
220
220
  };
221
221
  try {
222
- const response = yield this.graphqlMutation(mutation, variables);
222
+ const response = yield this.graphqlMutationV2(mutation, variables);
223
223
  return response;
224
224
  }
225
225
  catch (error) {
@@ -242,7 +242,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
242
242
  updatedBy: updatedBy,
243
243
  };
244
244
  try {
245
- const response = yield this.graphqlMutation(mutation, variables);
245
+ const response = yield this.graphqlMutationV2(mutation, variables);
246
246
  return response;
247
247
  }
248
248
  catch (error) {
@@ -270,7 +270,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
270
270
  description,
271
271
  };
272
272
  try {
273
- const response = yield this.graphqlMutation(mutation, variables);
273
+ const response = yield this.graphqlMutationV2(mutation, variables);
274
274
  return response.createServiceTicket;
275
275
  }
276
276
  catch (error) {
@@ -285,7 +285,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
285
285
  serviceId,
286
286
  };
287
287
  try {
288
- const response = yield this.graphqlQuery(query, variables);
288
+ const response = yield this.graphqlQueryV2(query, variables);
289
289
  return response.getServiceTickets;
290
290
  }
291
291
  catch (error) {
@@ -302,7 +302,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
302
302
  createdBy,
303
303
  };
304
304
  try {
305
- const response = yield this.graphqlMutation(mutation, variables);
305
+ const response = yield this.graphqlMutationV2(mutation, variables);
306
306
  return response.createServiceAction;
307
307
  }
308
308
  catch (error) {
@@ -320,7 +320,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
320
320
  createdBy,
321
321
  };
322
322
  try {
323
- const response = yield this.graphqlMutation(mutation, variables);
323
+ const response = yield this.graphqlMutationV2(mutation, variables);
324
324
  return response.addActionAttribute;
325
325
  }
326
326
  catch (error) {
@@ -336,7 +336,7 @@ class ServiceManagementService extends serviceSDK_1.Service {
336
336
  attributeName,
337
337
  };
338
338
  try {
339
- const response = yield this.graphqlQuery(query, variables);
339
+ const response = yield this.graphqlQueryV2(query, variables);
340
340
  return response.getActionAttribute;
341
341
  }
342
342
  catch (error) {
@@ -13,4 +13,6 @@ export declare class Service {
13
13
  protected graphqlMutation(mutation: DocumentNode, variables: any): Promise<any>;
14
14
  protected restApiCallWithToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
15
15
  protected restApiCallWithNoToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
16
+ protected graphqlQueryV2(query: DocumentNode, variables: any): Promise<any>;
17
+ protected graphqlMutationV2(mutation: DocumentNode, variables: any): Promise<any>;
16
18
  }
@@ -75,6 +75,13 @@ class Service {
75
75
  ${mutation}
76
76
  `,
77
77
  variables,
78
+ context: {
79
+ method: "POST",
80
+ headers: {
81
+ "Content-Type": "application/json",
82
+ partnerId: this.orgId,
83
+ },
84
+ },
78
85
  });
79
86
  if (errors) {
80
87
  throw new Error(`GraphQL error! errors: ${errors}`);
@@ -121,5 +128,60 @@ class Service {
121
128
  }
122
129
  });
123
130
  }
131
+ graphqlQueryV2(query, variables) {
132
+ return __awaiter(this, void 0, void 0, function* () {
133
+ try {
134
+ const { data, errors } = yield this.client.query({
135
+ query: (0, client_1.gql) `
136
+ ${query}
137
+ `,
138
+ variables,
139
+ context: {
140
+ method: "POST",
141
+ headers: {
142
+ "Content-Type": "application/json",
143
+ "PartnerId": this.orgId,
144
+ "Authorization": 'Bearer ' + this.token,
145
+ },
146
+ },
147
+ });
148
+ if (errors) {
149
+ throw new Error(`GraphQL error! errors: ${errors}`);
150
+ }
151
+ return data;
152
+ }
153
+ catch (error) {
154
+ console.log(`Error in graphqlQuery: ${error}`);
155
+ throw error;
156
+ }
157
+ });
158
+ }
159
+ graphqlMutationV2(mutation, variables) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ try {
162
+ const { data, errors } = yield this.client.mutate({
163
+ mutation: (0, client_1.gql) `
164
+ ${mutation}
165
+ `,
166
+ variables,
167
+ context: {
168
+ method: "POST",
169
+ headers: {
170
+ "Content-Type": "application/json",
171
+ "PartnerId": this.orgId,
172
+ "Authorization": 'Bearer ' + this.token,
173
+ },
174
+ },
175
+ });
176
+ if (errors) {
177
+ throw new Error(`GraphQL error! errors: ${errors}`);
178
+ }
179
+ return data;
180
+ }
181
+ catch (error) {
182
+ throw error;
183
+ }
184
+ });
185
+ }
124
186
  }
125
187
  exports.Service = Service;