@longvansoftware/service-js-client 2.7.3 → 2.7.5

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.
@@ -25,3 +25,6 @@ export declare const UPDATE_RAM: DocumentNode;
25
25
  export declare const CREATE_COMPUTING_FOR_EC: DocumentNode;
26
26
  export declare const UPDATE_CLIENT_GROUP_ID_DYNAMIC: (fields?: string[]) => DocumentNode;
27
27
  export declare const SHUTDOWN: DocumentNode;
28
+ export declare const ADD_DISK: DocumentNode;
29
+ export declare const EXTEND_DISK: DocumentNode;
30
+ export declare const RESIZE_DISK: DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SHUTDOWN = exports.UPDATE_CLIENT_GROUP_ID_DYNAMIC = exports.CREATE_COMPUTING_FOR_EC = exports.UPDATE_RAM = exports.UPDATE_CPU = exports.DELETE_COMPUTING = exports.RESTORE_COMPUTING_WAITING_REVOKE = exports.COMPUTING_WAITING_REVOKE = exports.UPDATE_NAME_COMPUTING = exports.CREATE_COMPUTING_FOR_DC = exports.UPDATE_DESCRIPTION_COMPUTING = exports.ADD_PORT_NAT = exports.STOP_USE_COMPUTING = exports.REMOVE_COMPUTING_IN_CLUSTER = exports.ADD_COMPUTING_IN_CLUSTER = exports.CREATE_CLUSTER = exports.DELETE_SNAPSHOT = exports.ROLLBACK_SNAPSHOT = exports.CREATE_SNAP_SHOT = exports.POWER_OFF = exports.POWER_ON = exports.REMOVE_PORT_NAT = exports.UPDATE_PORT_NAT = exports.CREATE_PORT_NAT = exports.UPDATE_DESCRIPTION_PORTNAT = exports.RESTARTVM = void 0;
3
+ exports.RESIZE_DISK = exports.EXTEND_DISK = exports.ADD_DISK = exports.SHUTDOWN = exports.UPDATE_CLIENT_GROUP_ID_DYNAMIC = exports.CREATE_COMPUTING_FOR_EC = exports.UPDATE_RAM = exports.UPDATE_CPU = exports.DELETE_COMPUTING = exports.RESTORE_COMPUTING_WAITING_REVOKE = exports.COMPUTING_WAITING_REVOKE = exports.UPDATE_NAME_COMPUTING = exports.CREATE_COMPUTING_FOR_DC = exports.UPDATE_DESCRIPTION_COMPUTING = exports.ADD_PORT_NAT = exports.STOP_USE_COMPUTING = exports.REMOVE_COMPUTING_IN_CLUSTER = exports.ADD_COMPUTING_IN_CLUSTER = exports.CREATE_CLUSTER = exports.DELETE_SNAPSHOT = exports.ROLLBACK_SNAPSHOT = exports.CREATE_SNAP_SHOT = exports.POWER_OFF = exports.POWER_ON = exports.REMOVE_PORT_NAT = exports.UPDATE_PORT_NAT = exports.CREATE_PORT_NAT = exports.UPDATE_DESCRIPTION_PORTNAT = exports.RESTARTVM = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.RESTARTVM = (0, graphql_tag_1.gql) `
6
6
  mutation Restart($computingId: String!, $actor: String!, $serviceId: String!) {
@@ -391,3 +391,42 @@ exports.SHUTDOWN = (0, graphql_tag_1.gql) `
391
391
  )
392
392
  }
393
393
  `;
394
+ exports.ADD_DISK = (0, graphql_tag_1.gql) `
395
+ mutation addDisk(
396
+ $computingId: String!
397
+ $size: Int!
398
+ $unit: StorageUnitEnum!
399
+ $datastoreId: String!
400
+ ) {
401
+ addDisk(
402
+ computingId: $computingId
403
+ datastoreId: $datastoreId
404
+ size: $size
405
+ unit: $unit
406
+ )
407
+ }
408
+ `;
409
+ exports.EXTEND_DISK = (0, graphql_tag_1.gql) `
410
+ mutation extendDisk(
411
+ $computingId: String!
412
+ ) {
413
+ extendDisk(
414
+ computingId: $computingId
415
+ )
416
+ }
417
+ `;
418
+ exports.RESIZE_DISK = (0, graphql_tag_1.gql) `
419
+ mutation resizeDisk(
420
+ $computingId: String!
421
+ $diskIndex: Int!
422
+ $size: Int!
423
+ $unit: StorageUnitEnum!
424
+ ) {
425
+ resizeDisk(
426
+ computingId: $computingId
427
+ diskIndex: $diskIndex
428
+ size: $size
429
+ unit: $unit
430
+ )
431
+ }
432
+ `;
@@ -6,3 +6,7 @@ export declare const UPDATE_END_TIME_LAB_SESSION: DocumentNode;
6
6
  export declare const STOP_LAB_SESSION: DocumentNode;
7
7
  export declare const UPDATE_TYPE_LAB_SESSION: DocumentNode;
8
8
  export declare const STOP_LAB_SESSION_FOR_CUSTOMER: DocumentNode;
9
+ export declare const CREATE_COMPUTING_LAB_BY_TEMPLATE_ID: (fields?: string[]) => DocumentNode;
10
+ export declare const REMOVE_COMPUTING_LAB: DocumentNode;
11
+ export declare const OFF_COMPUTING_LAB: DocumentNode;
12
+ export declare const ON_COMPUTING_LAB: DocumentNode;
@@ -1,21 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STOP_LAB_SESSION_FOR_CUSTOMER = exports.UPDATE_TYPE_LAB_SESSION = exports.STOP_LAB_SESSION = exports.UPDATE_END_TIME_LAB_SESSION = exports.CREATE_LAB_SESSION_BY_COMPUTING_ID = exports.CREATE_LAB_SESSION_BY_LAB_SESSION_ID = exports.CREATE_LAB_SESSION_BY_TEMPLATE_ID = void 0;
3
+ exports.ON_COMPUTING_LAB = exports.OFF_COMPUTING_LAB = exports.REMOVE_COMPUTING_LAB = exports.CREATE_COMPUTING_LAB_BY_TEMPLATE_ID = exports.STOP_LAB_SESSION_FOR_CUSTOMER = exports.UPDATE_TYPE_LAB_SESSION = exports.STOP_LAB_SESSION = exports.UPDATE_END_TIME_LAB_SESSION = exports.CREATE_LAB_SESSION_BY_COMPUTING_ID = exports.CREATE_LAB_SESSION_BY_LAB_SESSION_ID = exports.CREATE_LAB_SESSION_BY_TEMPLATE_ID = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  // Tạo phiên thực hành từ template
6
6
  exports.CREATE_LAB_SESSION_BY_TEMPLATE_ID = (0, graphql_tag_1.gql) `
7
- mutation CreateLabSessionByTemplateId(
8
- $templateId: String!
9
- $userId: String!
10
- $articleId: String!
11
- $typeLabSessionCode: String!
12
- ) {
13
- createLabSessionByTemplateId(
14
- templateId: $templateId
15
- userId: $userId
16
- articleId: $articleId
17
- typeLabSessionCode: $typeLabSessionCode
18
- ) {
7
+ mutation CreateLabSessionByTemplateId($templateId: String!, $userId: String!, $articleId: String!, $typeLabSessionCode: String!) {
8
+ createLabSessionByTemplateId(templateId: $templateId, userId: $userId, articleId: $articleId, typeLabSessionCode: $typeLabSessionCode) {
19
9
  labSessionId
20
10
  userId
21
11
  typeLabSession
@@ -44,16 +34,8 @@ exports.CREATE_LAB_SESSION_BY_TEMPLATE_ID = (0, graphql_tag_1.gql) `
44
34
  `;
45
35
  // Tạo phiên thực hành con từ phiên thực hành chính
46
36
  exports.CREATE_LAB_SESSION_BY_LAB_SESSION_ID = (0, graphql_tag_1.gql) `
47
- mutation CreateLabSessionByLabSessionId(
48
- $labSessionId: String!
49
- $userId: String!
50
- $articleId: String!
51
- ) {
52
- createLabSessionByLabSessionId(
53
- labSessionId: $labSessionId
54
- userId: $userId
55
- articleId: $articleId
56
- ) {
37
+ mutation CreateLabSessionByLabSessionId($labSessionId: String!, $userId: String!, $articleId: String!) {
38
+ createLabSessionByLabSessionId(labSessionId: $labSessionId, userId: $userId, articleId: $articleId) {
57
39
  labSessionId
58
40
  userId
59
41
  typeLabSession
@@ -82,16 +64,8 @@ exports.CREATE_LAB_SESSION_BY_LAB_SESSION_ID = (0, graphql_tag_1.gql) `
82
64
  `;
83
65
  // Tạo phiên thực hành từ computing của khách hàng
84
66
  exports.CREATE_LAB_SESSION_BY_COMPUTING_ID = (0, graphql_tag_1.gql) `
85
- mutation CreateLabSessionByComputingId(
86
- $computingId: String!
87
- $userId: String!
88
- $articleId: String!
89
- ) {
90
- createLabSessionByComputingId(
91
- computingId: $computingId
92
- userId: $userId
93
- articleId: $articleId
94
- ) {
67
+ mutation CreateLabSessionByComputingId($computingId: String!, $userId: String!, $articleId: String!) {
68
+ createLabSessionByComputingId(computingId: $computingId, userId: $userId, articleId: $articleId) {
95
69
  labSessionId
96
70
  userId
97
71
  typeLabSession
@@ -129,11 +103,7 @@ exports.UPDATE_END_TIME_LAB_SESSION = (0, graphql_tag_1.gql) `
129
103
  `;
130
104
  // Dừng thực hành
131
105
  exports.STOP_LAB_SESSION = (0, graphql_tag_1.gql) `
132
- mutation StopLabSession(
133
- $labSessionId: String!
134
- $userId: String!
135
- $note: String
136
- ) {
106
+ mutation StopLabSession($labSessionId: String!, $userId: String!, $note: String) {
137
107
  stopLabSession(labSessionId: $labSessionId, userId: $userId, note: $note) {
138
108
  status
139
109
  message
@@ -141,16 +111,8 @@ exports.STOP_LAB_SESSION = (0, graphql_tag_1.gql) `
141
111
  }
142
112
  `;
143
113
  exports.UPDATE_TYPE_LAB_SESSION = (0, graphql_tag_1.gql) `
144
- mutation StopLabSession(
145
- $labSessionId: String!
146
- $typeLabSessionCode: String!
147
- $userId: String!
148
- ) {
149
- updateTypeLabSession(
150
- labSessionId: $labSessionId
151
- typeLabSessionCode: $typeLabSessionCode
152
- userId: $userId
153
- ) {
114
+ mutation StopLabSession($labSessionId: String!, $typeLabSessionCode: String!, $userId: String!) {
115
+ updateTypeLabSession(labSessionId: $labSessionId, typeLabSessionCode: $typeLabSessionCode, userId: $userId) {
154
116
  status
155
117
  message
156
118
  }
@@ -158,14 +120,60 @@ exports.UPDATE_TYPE_LAB_SESSION = (0, graphql_tag_1.gql) `
158
120
  `;
159
121
  // Dừng thực hành
160
122
  exports.STOP_LAB_SESSION_FOR_CUSTOMER = (0, graphql_tag_1.gql) `
161
- mutation StopLabSessionForCustomer(
162
- $labSessionId: String!
163
- $userId: String!
164
- $note: String
165
- ) {
123
+ mutation StopLabSessionForCustomer($labSessionId: String!, $userId: String!, $note: String) {
166
124
  stopLabSessionForCustomer(labSessionId: $labSessionId, userId: $userId, note: $note) {
167
125
  status
168
126
  message
169
127
  }
170
128
  }
171
129
  `;
130
+ const CREATE_COMPUTING_LAB_BY_TEMPLATE_ID = (fields = []) => {
131
+ const fieldStr = fields.join("\n ");
132
+ const hasFields = fields.length > 0;
133
+ return (0, graphql_tag_1.gql) `
134
+ mutation createComputingLabByTemplateId(
135
+ $templateId: String!
136
+ $userId: String!
137
+ $productId: String!
138
+ $province: String!
139
+ $timeUse: BigDecimal!
140
+ $createBy: String!
141
+ $price: BigDecimal
142
+ ){
143
+ createComputingLabByTemplateId (
144
+ templateId: $templateId
145
+ userId: $userId
146
+ productId: $productId
147
+ province: $province
148
+ timeUse: $timeUse
149
+ createBy: $createBy
150
+ price: $price
151
+ )
152
+ ${hasFields ? `{ ${fieldStr} }` : ""}
153
+ } `;
154
+ };
155
+ exports.CREATE_COMPUTING_LAB_BY_TEMPLATE_ID = CREATE_COMPUTING_LAB_BY_TEMPLATE_ID;
156
+ exports.REMOVE_COMPUTING_LAB = (0, graphql_tag_1.gql) `
157
+ mutation RemoveComputingLab($partnerId: String!, $userId: String!, $computingId: String!, $updateBy: String!) {
158
+ removeComputingLab(partnerId: $partnerId, userId: $userId, computingId: $computingId, updateBy: $updateBy) {
159
+ status
160
+ message
161
+ }
162
+ }
163
+ `;
164
+ exports.OFF_COMPUTING_LAB = (0, graphql_tag_1.gql) `
165
+ mutation OffComputingLab($partnerId: String!, $userId: String!, $computingId: String!, $timeUse: BigDecimal!, $updateBy: String!) {
166
+ offComputingLab(partnerId: $partnerId, userId: $userId, computingId: $computingId, timeUse: $timeUse, updateBy: $updateBy) {
167
+ status
168
+ message
169
+ }
170
+ }
171
+ `;
172
+ exports.ON_COMPUTING_LAB = (0, graphql_tag_1.gql) `
173
+ mutation OnComputingLab($partnerId: String!, $userId: String!, $computingId: String!, $timeUse: BigDecimal!, $updateBy: String!, $price: BigDecimal) {
174
+ onComputingLab(partnerId: $partnerId, userId: $userId, computingId: $computingId, timeUse: $timeUse, updateBy: $updateBy, price: $price) {
175
+ status
176
+ message
177
+ }
178
+ }
179
+ `;
@@ -5,3 +5,6 @@ export declare const GET_LAB_SESSIONS_BY_USER_ID: DocumentNode;
5
5
  export declare const GET_LAB_SESSIONS_BY_USER_ID_AND_ARTICLE_ID: DocumentNode;
6
6
  export declare const GET_LAB_SESSIONS_CHILL_BY_PARENT: DocumentNode;
7
7
  export declare const GET_LAB_DOING_AND_DONE_BY_USERID: (fields?: string[]) => DocumentNode;
8
+ export declare const CALCULATE_COMPUTING_LAB_ACTION_PRICING: (fields?: string[]) => DocumentNode;
9
+ export declare const GET_SESSION_LAB: (fields?: string[]) => DocumentNode;
10
+ export declare const FILTER_COMPUTING_LAB: (fields?: string[]) => DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_LAB_DOING_AND_DONE_BY_USERID = exports.GET_LAB_SESSIONS_CHILL_BY_PARENT = exports.GET_LAB_SESSIONS_BY_USER_ID_AND_ARTICLE_ID = exports.GET_LAB_SESSIONS_BY_USER_ID = exports.GET_TYPE_LAB_SESSION = exports.GET_TEMPLATE_BY_ARTICLE_ID = void 0;
3
+ exports.FILTER_COMPUTING_LAB = exports.GET_SESSION_LAB = exports.CALCULATE_COMPUTING_LAB_ACTION_PRICING = exports.GET_LAB_DOING_AND_DONE_BY_USERID = exports.GET_LAB_SESSIONS_CHILL_BY_PARENT = exports.GET_LAB_SESSIONS_BY_USER_ID_AND_ARTICLE_ID = exports.GET_LAB_SESSIONS_BY_USER_ID = exports.GET_TYPE_LAB_SESSION = exports.GET_TEMPLATE_BY_ARTICLE_ID = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  // Danh sách template của bài lab
6
6
  exports.GET_TEMPLATE_BY_ARTICLE_ID = (0, graphql_tag_1.gql) `
@@ -56,10 +56,7 @@ exports.GET_LAB_SESSIONS_BY_USER_ID = (0, graphql_tag_1.gql) `
56
56
  `;
57
57
  // Danh sách phiên thực hành theo bài lab của người dùng
58
58
  exports.GET_LAB_SESSIONS_BY_USER_ID_AND_ARTICLE_ID = (0, graphql_tag_1.gql) `
59
- query GetLabSessionsByUserIdAndArticleId(
60
- $userId: String!
61
- $articleId: String!
62
- ) {
59
+ query GetLabSessionsByUserIdAndArticleId($userId: String!, $articleId: String!) {
63
60
  getLabSessionsByUserIdAndArticleId(userId: $userId, articleId: $articleId) {
64
61
  labSessionId
65
62
  userId
@@ -88,10 +85,7 @@ exports.GET_LAB_SESSIONS_BY_USER_ID_AND_ARTICLE_ID = (0, graphql_tag_1.gql) `
88
85
  }
89
86
  `;
90
87
  exports.GET_LAB_SESSIONS_CHILL_BY_PARENT = (0, graphql_tag_1.gql) `
91
- query GetLabSessionsByUserIdAndArticleId(
92
- $labSessionId: String!
93
- $userId: String!
94
- ) {
88
+ query GetLabSessionsByUserIdAndArticleId($labSessionId: String!, $userId: String!) {
95
89
  getLabSessionsChillByParent(labSessionId: $labSessionId, userId: $userId) {
96
90
  labSessionId
97
91
  userId
@@ -129,3 +123,58 @@ const GET_LAB_DOING_AND_DONE_BY_USERID = (fields = []) => {
129
123
  `;
130
124
  };
131
125
  exports.GET_LAB_DOING_AND_DONE_BY_USERID = GET_LAB_DOING_AND_DONE_BY_USERID;
126
+ const CALCULATE_COMPUTING_LAB_ACTION_PRICING = (fields = []) => {
127
+ const fieldStr = fields.join("\n ");
128
+ const hasFields = fields.length > 0;
129
+ return (0, graphql_tag_1.gql) `
130
+ query CalculateComputingLabActionPricing(
131
+ $partnerId: String!
132
+ $userId: String!
133
+ $action: String!
134
+ $timeUse: BigDecimal!
135
+ $productId: String
136
+ $computingId: String
137
+ $price: BigDecimal
138
+ ) {
139
+ calculateComputingLabActionPricing(
140
+ partnerId: $partnerId
141
+ userId: $userId
142
+ action: $action
143
+ timeUse: $timeUse
144
+ productId: $productId
145
+ computingId: $computingId
146
+ price: $price
147
+ ) ${hasFields ? `{ ${fieldStr} }` : ""}
148
+ }
149
+ `;
150
+ };
151
+ exports.CALCULATE_COMPUTING_LAB_ACTION_PRICING = CALCULATE_COMPUTING_LAB_ACTION_PRICING;
152
+ const GET_SESSION_LAB = (fields = []) => {
153
+ const fieldStr = fields.join("\n ");
154
+ const hasFields = fields.length > 0;
155
+ return (0, graphql_tag_1.gql) `
156
+ query GetSessionLab(
157
+ $parnerId: String!
158
+ $userId: String!
159
+ $computingId: String!
160
+ ) {
161
+ getSessionLab(
162
+ partnerId: $parnerId
163
+ userId: $userId
164
+ computingId: $computingId
165
+ )
166
+ ${hasFields ? `{ ${fieldStr} }` : ""}
167
+ } `;
168
+ };
169
+ exports.GET_SESSION_LAB = GET_SESSION_LAB;
170
+ const FILTER_COMPUTING_LAB = (fields = []) => {
171
+ const fieldStr = fields.join("\n ");
172
+ const hasFields = fields.length > 0;
173
+ return (0, graphql_tag_1.gql) `
174
+ query FilterComputingLab($filter: ComputingLabFilterInput!) {
175
+ filterComputingLab(filter: $filter)
176
+ ${hasFields ? `{ ${fieldStr} }` : ""}
177
+ }
178
+ `;
179
+ };
180
+ exports.FILTER_COMPUTING_LAB = FILTER_COMPUTING_LAB;
@@ -65,4 +65,7 @@ export declare class ComputingService extends Service {
65
65
  createComputingForEC(createComputingInputForEC: any, createBy: string): Promise<any>;
66
66
  computingDetailDynamic(computingId: string, serviceId: string, fields: string[]): Promise<any>;
67
67
  shutdown(computingId: string, isForceShutdown: boolean, actor: string, serviceId: string): Promise<any>;
68
+ addDisk(computingId: string, size: number, unit: string, datastoreId: string): Promise<any>;
69
+ extendDisk(computingId: string): Promise<any>;
70
+ resizeDisk(computingId: string, diskIndex: number, size: number, unit: string): Promise<any>;
68
71
  }
@@ -994,5 +994,59 @@ class ComputingService extends serviceSDK_1.Service {
994
994
  }
995
995
  });
996
996
  }
997
+ addDisk(computingId, size, unit, datastoreId) {
998
+ return __awaiter(this, void 0, void 0, function* () {
999
+ const mutation = mutations_1.ADD_DISK;
1000
+ const variables = {
1001
+ computingId,
1002
+ size,
1003
+ unit,
1004
+ datastoreId
1005
+ };
1006
+ try {
1007
+ const response = yield this.graphqlMutationV2(mutation, variables);
1008
+ return response.addDisk;
1009
+ }
1010
+ catch (error) {
1011
+ console.log(`Error fetching add disk method: ${error}`);
1012
+ throw error;
1013
+ }
1014
+ });
1015
+ }
1016
+ extendDisk(computingId) {
1017
+ return __awaiter(this, void 0, void 0, function* () {
1018
+ const mutation = mutations_1.EXTEND_DISK;
1019
+ const variables = {
1020
+ computingId,
1021
+ };
1022
+ try {
1023
+ const response = yield this.graphqlMutationV2(mutation, variables);
1024
+ return response.extendDisk;
1025
+ }
1026
+ catch (error) {
1027
+ console.log(`Error fetching extend disk method: ${error}`);
1028
+ throw error;
1029
+ }
1030
+ });
1031
+ }
1032
+ resizeDisk(computingId, diskIndex, size, unit) {
1033
+ return __awaiter(this, void 0, void 0, function* () {
1034
+ const mutation = mutations_1.RESIZE_DISK;
1035
+ const variables = {
1036
+ computingId,
1037
+ diskIndex,
1038
+ size,
1039
+ unit
1040
+ };
1041
+ try {
1042
+ const response = yield this.graphqlMutationV2(mutation, variables);
1043
+ return response.resizeDisk;
1044
+ }
1045
+ catch (error) {
1046
+ console.log(`Error fetching resize disk method: ${error}`);
1047
+ throw error;
1048
+ }
1049
+ });
1050
+ }
997
1051
  }
998
1052
  exports.ComputingService = ComputingService;
@@ -16,4 +16,11 @@ export declare class QuicklabService extends Service {
16
16
  getLabSessionsChillByParent(labSessionId: string, userId: string): Promise<any>;
17
17
  stopLabSessionForCustomer(labSessionId: string, userId: string, note: string): Promise<any>;
18
18
  getLabDoingAndDoneByUserId(userId: string, fields: string[]): Promise<any>;
19
+ calculateComputingLabActionPricing(userId: string, timeUse: number | string, action: string, productId: string, computingId: string, price: number | string, fields: string[]): Promise<any>;
20
+ createComputingLabByTemplateId(templateId: string, userId: string, productId: string, province: string, timeUse: number | string, createBy: string, price: number | string, fields?: string[]): Promise<any>;
21
+ getSessionLab(userId: string, computingId: string, fields: string[]): Promise<any>;
22
+ removeComputingLab(userId: string, computingId: string, updateBy: string): Promise<any>;
23
+ offComputingLab(userId: string, computingId: string, timeUse: string | number, updateBy: string): Promise<any>;
24
+ filterComputingLab(id: string, search: string, createdStampFrom: string, createdStampTo: string, offset: number, maxResult: number, userId: string, fields?: string[]): Promise<any>;
25
+ onComputingLab(userId: string, computingId: string, timeUse: string | number, updateBy: string, price: number | string): Promise<any>;
19
26
  }
@@ -27,7 +27,7 @@ class QuicklabService extends serviceSDK_1.Service {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
28
  const query = queries_1.GET_TEMPLATE_BY_ARTICLE_ID;
29
29
  const variables = {
30
- articleId,
30
+ articleId
31
31
  };
32
32
  try {
33
33
  const response = yield this.graphqlQuery(query, variables);
@@ -207,5 +207,144 @@ class QuicklabService extends serviceSDK_1.Service {
207
207
  }
208
208
  });
209
209
  }
210
+ calculateComputingLabActionPricing(userId, timeUse, action, productId, computingId, price, fields) {
211
+ return __awaiter(this, void 0, void 0, function* () {
212
+ const query = (0, queries_1.CALCULATE_COMPUTING_LAB_ACTION_PRICING)(fields);
213
+ const variables = { partnerId: this.orgId, userId, timeUse: Number(timeUse), action, productId, computingId, price: price != null ? Number(price) : null };
214
+ try {
215
+ const response = yield this.graphqlQuery(query, variables);
216
+ return response.calculateComputingLabActionPricing;
217
+ }
218
+ catch (error) {
219
+ console.log(`Error in calculateComputingLabActionPricing : ${error}`);
220
+ throw error;
221
+ }
222
+ });
223
+ }
224
+ createComputingLabByTemplateId(templateId_1, userId_1, productId_1, province_1, timeUse_1, createBy_1, price_1) {
225
+ return __awaiter(this, arguments, void 0, function* (templateId, userId, productId, province, timeUse, createBy, price, fields = []) {
226
+ const mutation = (0, mutations_1.CREATE_COMPUTING_LAB_BY_TEMPLATE_ID)(fields);
227
+ const variables = {
228
+ templateId,
229
+ userId,
230
+ productId,
231
+ province,
232
+ timeUse: Number(timeUse),
233
+ createBy,
234
+ price: price != null ? Number(price) : null
235
+ };
236
+ try {
237
+ const response = yield this.graphqlMutation(mutation, variables);
238
+ return response.createComputingLabByTemplateId;
239
+ }
240
+ catch (error) {
241
+ console.log(`Error in createComputingLabByTemplateId : ${error}`);
242
+ throw error;
243
+ }
244
+ });
245
+ }
246
+ getSessionLab(userId, computingId, fields) {
247
+ return __awaiter(this, void 0, void 0, function* () {
248
+ const query = (0, queries_1.GET_SESSION_LAB)(fields);
249
+ const variables = {
250
+ parnerId: this.orgId,
251
+ userId,
252
+ computingId
253
+ };
254
+ try {
255
+ const response = yield this.graphqlQuery(query, variables);
256
+ return response.getSessionLab;
257
+ }
258
+ catch (error) {
259
+ console.log(`Error in getSessionLab : ${error}`);
260
+ throw error;
261
+ }
262
+ });
263
+ }
264
+ removeComputingLab(userId, computingId, updateBy) {
265
+ return __awaiter(this, void 0, void 0, function* () {
266
+ const variables = {
267
+ partnerId: this.orgId,
268
+ userId,
269
+ computingId,
270
+ updateBy
271
+ };
272
+ try {
273
+ const response = yield this.graphqlMutation(mutations_1.REMOVE_COMPUTING_LAB, variables);
274
+ return response.removeComputingLab;
275
+ }
276
+ catch (error) {
277
+ console.log(`Error in removeComputingLab: ${error}`);
278
+ throw error;
279
+ }
280
+ });
281
+ }
282
+ offComputingLab(userId, computingId, timeUse, updateBy) {
283
+ return __awaiter(this, void 0, void 0, function* () {
284
+ const variables = {
285
+ partnerId: this.orgId,
286
+ userId,
287
+ computingId,
288
+ timeUse: Number(timeUse),
289
+ updateBy
290
+ };
291
+ try {
292
+ const response = yield this.graphqlMutation(mutations_1.OFF_COMPUTING_LAB, variables);
293
+ return response.offComputingLab;
294
+ }
295
+ catch (error) {
296
+ console.log(`Error in offComputingLab: ${error}`);
297
+ throw error;
298
+ }
299
+ });
300
+ }
301
+ filterComputingLab(id_1, search_1, createdStampFrom_1, createdStampTo_1, offset_1, maxResult_1, userId_1) {
302
+ return __awaiter(this, arguments, void 0, function* (id, search, createdStampFrom, createdStampTo, offset, maxResult, userId, fields = []) {
303
+ const query = (0, queries_1.FILTER_COMPUTING_LAB)(fields);
304
+ const filter = {
305
+ partnerId: this.orgId,
306
+ userId,
307
+ offset: Number(offset) || 0,
308
+ maxResult: Number(maxResult) || 10
309
+ };
310
+ if (id)
311
+ filter.id = id;
312
+ if (search)
313
+ filter.search = search;
314
+ if (createdStampFrom)
315
+ filter.createdStampFrom = createdStampFrom;
316
+ if (createdStampTo)
317
+ filter.createdStampTo = createdStampTo;
318
+ const variables = { filter };
319
+ try {
320
+ const response = yield this.graphqlQuery(query, variables);
321
+ return response.filterComputingLab;
322
+ }
323
+ catch (error) {
324
+ console.log(`Error in filterComputingLab: ${error}`);
325
+ throw error;
326
+ }
327
+ });
328
+ }
329
+ onComputingLab(userId, computingId, timeUse, updateBy, price) {
330
+ return __awaiter(this, void 0, void 0, function* () {
331
+ const variables = {
332
+ partnerId: this.orgId,
333
+ userId,
334
+ computingId,
335
+ timeUse: Number(timeUse),
336
+ updateBy,
337
+ price: price != null ? Number(price) : null
338
+ };
339
+ try {
340
+ const response = yield this.graphqlMutation(mutations_1.ON_COMPUTING_LAB, variables);
341
+ return response.onComputingLab;
342
+ }
343
+ catch (error) {
344
+ console.log(`Error in onComputingLab: ${error}`);
345
+ throw error;
346
+ }
347
+ });
348
+ }
210
349
  }
211
350
  exports.QuicklabService = QuicklabService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "2.7.3",
3
+ "version": "2.7.5",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [