@longvansoftware/service-js-client 1.0.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 (84) hide show
  1. package/README.md +93 -0
  2. package/dist/config/config.d.ts +26 -0
  3. package/dist/config/config.js +29 -0
  4. package/dist/src/graphql/auth/mutations.d.ts +7 -0
  5. package/dist/src/graphql/auth/mutations.js +99 -0
  6. package/dist/src/graphql/auth/queries.d.ts +1 -0
  7. package/dist/src/graphql/auth/queries.js +25 -0
  8. package/dist/src/graphql/cloud/mutations.d.ts +8 -0
  9. package/dist/src/graphql/cloud/mutations.js +115 -0
  10. package/dist/src/graphql/cloud/queries.d.ts +5 -0
  11. package/dist/src/graphql/cloud/queries.js +121 -0
  12. package/dist/src/graphql/computing/mutations.d.ts +10 -0
  13. package/dist/src/graphql/computing/mutations.js +110 -0
  14. package/dist/src/graphql/computing/queries.d.ts +3 -0
  15. package/dist/src/graphql/computing/queries.js +48 -0
  16. package/dist/src/graphql/crm/mutations.d.ts +8 -0
  17. package/dist/src/graphql/crm/mutations.js +316 -0
  18. package/dist/src/graphql/crm/queries.d.ts +7 -0
  19. package/dist/src/graphql/crm/queries.js +281 -0
  20. package/dist/src/graphql/payment/mutations.d.ts +1 -0
  21. package/dist/src/graphql/payment/mutations.js +35 -0
  22. package/dist/src/graphql/payment/queries.d.ts +2 -0
  23. package/dist/src/graphql/payment/queries.js +23 -0
  24. package/dist/src/graphql/product/mutations.d.ts +0 -0
  25. package/dist/src/graphql/product/mutations.js +1 -0
  26. package/dist/src/graphql/product/queries.d.ts +11 -0
  27. package/dist/src/graphql/product/queries.js +431 -0
  28. package/dist/src/graphql/service/mutations.d.ts +10 -0
  29. package/dist/src/graphql/service/mutations.js +284 -0
  30. package/dist/src/graphql/service/queries.d.ts +6 -0
  31. package/dist/src/graphql/service/queries.js +174 -0
  32. package/dist/src/graphql/user/mutations.d.ts +4 -0
  33. package/dist/src/graphql/user/mutations.js +118 -0
  34. package/dist/src/graphql/user/queries.d.ts +13 -0
  35. package/dist/src/graphql/user/queries.js +252 -0
  36. package/dist/src/index.d.ts +1 -0
  37. package/dist/src/index.js +5 -0
  38. package/dist/src/lib/SDK.d.ts +42 -0
  39. package/dist/src/lib/SDK.js +71 -0
  40. package/dist/src/lib/auth/index.d.ts +27 -0
  41. package/dist/src/lib/auth/index.js +72 -0
  42. package/dist/src/lib/cloud/index.d.ts +25 -0
  43. package/dist/src/lib/cloud/index.js +248 -0
  44. package/dist/src/lib/computing/index.d.ts +25 -0
  45. package/dist/src/lib/computing/index.js +254 -0
  46. package/dist/src/lib/crm/index.d.ts +21 -0
  47. package/dist/src/lib/crm/index.js +296 -0
  48. package/dist/src/lib/order/index.d.ts +452 -0
  49. package/dist/src/lib/order/index.js +1204 -0
  50. package/dist/src/lib/payment/index.d.ts +7 -0
  51. package/dist/src/lib/payment/index.js +69 -0
  52. package/dist/src/lib/product/index.d.ts +37 -0
  53. package/dist/src/lib/product/index.js +132 -0
  54. package/dist/src/lib/service/index.d.ts +94 -0
  55. package/dist/src/lib/service/index.js +348 -0
  56. package/dist/src/lib/service.d.ts +14 -0
  57. package/dist/src/lib/service.js +101 -0
  58. package/dist/src/lib/serviceSDK.d.ts +18 -0
  59. package/dist/src/lib/serviceSDK.js +187 -0
  60. package/dist/src/lib/user/index.d.ts +23 -0
  61. package/dist/src/lib/user/index.js +345 -0
  62. package/dist/src/lib/warehouse/index.d.ts +20 -0
  63. package/dist/src/lib/warehouse/index.js +48 -0
  64. package/dist/src/types/auth.d.ts +82 -0
  65. package/dist/src/types/auth.js +2 -0
  66. package/dist/src/types/cloud.d.ts +40 -0
  67. package/dist/src/types/cloud.js +2 -0
  68. package/dist/src/types/computing.d.ts +16 -0
  69. package/dist/src/types/computing.js +2 -0
  70. package/dist/src/types/crm.d.ts +291 -0
  71. package/dist/src/types/crm.js +2 -0
  72. package/dist/src/types/order.d.ts +54 -0
  73. package/dist/src/types/order.js +2 -0
  74. package/dist/src/types/product.d.ts +63 -0
  75. package/dist/src/types/product.js +2 -0
  76. package/dist/src/types/service.d.ts +29 -0
  77. package/dist/src/types/service.js +2 -0
  78. package/dist/src/types/user.d.ts +95 -0
  79. package/dist/src/types/user.js +2 -0
  80. package/dist/src/types/warehouse.d.ts +5 -0
  81. package/dist/src/types/warehouse.js +2 -0
  82. package/dist/src/utils/helpers.d.ts +4 -0
  83. package/dist/src/utils/helpers.js +41 -0
  84. package/package.json +43 -0
@@ -0,0 +1,296 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CrmService = void 0;
13
+ const mutations_1 = require("../../graphql/crm/mutations");
14
+ const queries_1 = require("../../graphql/crm/queries");
15
+ const serviceSDK_1 = require("../serviceSDK");
16
+ class CrmService extends serviceSDK_1.Service {
17
+ constructor(endpoint, orgId, storeId) {
18
+ super(endpoint, orgId, storeId);
19
+ }
20
+ setToken(token) {
21
+ this.token = token;
22
+ }
23
+ addOpportunity(addOpportunityRequest, performerId) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const mutation = mutations_1.ADD_OPPORTUNITY_MUTATION;
26
+ const variables = {
27
+ partyId: this.orgId,
28
+ addOpportunityRequest,
29
+ performerId,
30
+ };
31
+ try {
32
+ const response = yield this.graphqlMutationV2(mutation, variables);
33
+ return response.addOpportunity;
34
+ }
35
+ catch (error) {
36
+ console.log(`Error in addOpportunity: ${error}`);
37
+ throw error;
38
+ }
39
+ });
40
+ }
41
+ getListOpportunity(performerId, getOpportunityRequest) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const query = queries_1.GET_LIST_OPPORTUNITY_QUERY;
44
+ const variables = {
45
+ partyId: this.orgId,
46
+ performerId,
47
+ getOpportunityRequest,
48
+ };
49
+ try {
50
+ const response = yield this.graphqlQueryV2(query, variables);
51
+ return response.getListOpportunity;
52
+ }
53
+ catch (error) {
54
+ console.log(`Error in getListOpportunity: ${error}`);
55
+ throw error;
56
+ }
57
+ });
58
+ }
59
+ getListTodo(workEffortId) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const query = queries_1.GET_LIST_TODO;
62
+ const variables = {
63
+ partyId: this.orgId,
64
+ workEffortId,
65
+ };
66
+ try {
67
+ const response = yield this.graphqlQueryV2(query, variables);
68
+ return response.getListTodo;
69
+ }
70
+ catch (error) {
71
+ console.log(`Error in getListTodo: ${error}`);
72
+ throw error;
73
+ }
74
+ });
75
+ }
76
+ getListWorkEffortType(id) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ const query = queries_1.GET_LIST_WORK_EFFORT_TYPE;
79
+ const variables = {
80
+ partyId: this.orgId,
81
+ id,
82
+ };
83
+ try {
84
+ const response = yield this.graphqlQueryV2(query, variables);
85
+ return response.getListWorkEffortType;
86
+ }
87
+ catch (error) {
88
+ console.log(`Error in getListWorkEffortType: ${error}`);
89
+ throw error;
90
+ }
91
+ });
92
+ }
93
+ updateStatusAttachmentById(performerId, attachmentId, status) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ const mutation = mutations_1.UPDATE_STATUS_ATTACHMENT_BY_ID;
96
+ const variables = {
97
+ performerId,
98
+ attachmentId,
99
+ status,
100
+ };
101
+ try {
102
+ const response = yield this.graphqlMutationV2(mutation, variables);
103
+ return response.updateStatusAttachmentById;
104
+ }
105
+ catch (error) {
106
+ console.log(`Error in updateStatusAttachmentById: ${error}`);
107
+ throw error;
108
+ }
109
+ });
110
+ }
111
+ updateWorkEffortDescription(performerId, workEffortId, description) {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ const mutation = mutations_1.UPDATE_WORK_EFFORT_DESCRIPTION;
114
+ const variables = {
115
+ performerId,
116
+ workEffortId,
117
+ description,
118
+ };
119
+ try {
120
+ const response = yield this.graphqlMutationV2(mutation, variables);
121
+ return response.updateWorkEffortDescription;
122
+ }
123
+ catch (error) {
124
+ console.log(`Error in updateWorkEffortDescription: ${error}`);
125
+ throw error;
126
+ }
127
+ });
128
+ }
129
+ updateWorkEffortName(performerId, workEffortId, name) {
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ const mutation = mutations_1.UPDATE_WORK_EFFORT_NAME;
132
+ const variables = {
133
+ partyId: this.orgId,
134
+ performerId,
135
+ workEffortId,
136
+ newName: name,
137
+ };
138
+ try {
139
+ const response = yield this.graphqlMutationV2(mutation, variables);
140
+ return response.updateWorkEffortName;
141
+ }
142
+ catch (error) {
143
+ console.log(`Error in updateWorkEffortName: ${error}`);
144
+ throw error;
145
+ }
146
+ });
147
+ }
148
+ updateWorkEffortStatus(performerId, workEffortId, source, status) {
149
+ return __awaiter(this, void 0, void 0, function* () {
150
+ const mutation = mutations_1.UPDATE_WORK_EFFORT_STATUS;
151
+ const variables = {
152
+ partyId: this.orgId,
153
+ performerId,
154
+ workEffortId,
155
+ source,
156
+ status,
157
+ };
158
+ try {
159
+ const response = yield this.graphqlMutationV2(mutation, variables);
160
+ return response.updateWorkEffortStatus;
161
+ }
162
+ catch (error) {
163
+ console.log(`Error in updateWorkEffortStatus: ${error}`);
164
+ throw error;
165
+ }
166
+ });
167
+ }
168
+ addAttachmentForWorkEffort(performerId, workEffortId, attachments) {
169
+ return __awaiter(this, void 0, void 0, function* () {
170
+ const mutation = mutations_1.ADD_ATTACHMENT_FOR_WORK_EFFORT;
171
+ const variables = {
172
+ partyId: this.orgId,
173
+ performerId,
174
+ workEffortId,
175
+ attachments,
176
+ };
177
+ try {
178
+ const response = yield this.graphqlMutationV2(mutation, variables);
179
+ return response.addAttachmentForWorkEffort;
180
+ }
181
+ catch (error) {
182
+ console.log(`Error in addAttachmentForWorkEffort: ${error}`);
183
+ throw error;
184
+ }
185
+ });
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
+ }
295
+ }
296
+ exports.CrmService = CrmService;