@longvansoftware/service-js-client 2.5.0 → 2.5.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.
- package/dist/src/graphql/computing/mutations.d.ts +1 -0
- package/dist/src/graphql/computing/mutations.js +19 -1
- package/dist/src/graphql/product/mutations.d.ts +4 -0
- package/dist/src/graphql/product/mutations.js +59 -0
- package/dist/src/graphql/product/queries.d.ts +1 -0
- package/dist/src/graphql/product/queries.js +21 -1
- package/dist/src/graphql/quicklab_service/queries.d.ts +1 -0
- package/dist/src/graphql/quicklab_service/queries.js +11 -1
- package/dist/src/lib/computing/index.d.ts +1 -0
- package/dist/src/lib/computing/index.js +18 -0
- package/dist/src/lib/product/index.d.ts +4 -0
- package/dist/src/lib/product/index.js +73 -0
- package/dist/src/lib/quicklab_service/index.d.ts +1 -0
- package/dist/src/lib/quicklab_service/index.js +14 -0
- package/package.json +1 -1
- package/dist/src/lib/service.d.ts +0 -14
- package/dist/src/lib/service.js +0 -101
- package/dist/src/utils/build-field-string.d.ts +0 -1
- package/dist/src/utils/build-field-string.js +0 -16
|
@@ -23,3 +23,4 @@ export declare const DELETE_COMPUTING: (fields?: string[]) => DocumentNode;
|
|
|
23
23
|
export declare const UPDATE_CPU: DocumentNode;
|
|
24
24
|
export declare const UPDATE_RAM: DocumentNode;
|
|
25
25
|
export declare const CREATE_COMPUTING_FOR_EC: DocumentNode;
|
|
26
|
+
export declare const UPDATE_CLIENT_GROUP_ID_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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.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!) {
|
|
@@ -358,3 +358,21 @@ exports.CREATE_COMPUTING_FOR_EC = (0, graphql_tag_1.gql) `
|
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
`;
|
|
361
|
+
const UPDATE_CLIENT_GROUP_ID_DYNAMIC = (fields = []) => {
|
|
362
|
+
const fieldStr = fields.join('\n ');
|
|
363
|
+
const hasFields = fields.length > 0;
|
|
364
|
+
return (0, graphql_tag_1.gql) `
|
|
365
|
+
mutation UpdateClientGroupId(
|
|
366
|
+
$computingIds: [String]
|
|
367
|
+
$groupId: String
|
|
368
|
+
$updateBy: String!
|
|
369
|
+
) {
|
|
370
|
+
updateClientGroupId(
|
|
371
|
+
computingIds: $computingIds
|
|
372
|
+
groupId: $groupId
|
|
373
|
+
updateBy: $updateBy
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
`;
|
|
377
|
+
};
|
|
378
|
+
exports.UPDATE_CLIENT_GROUP_ID_DYNAMIC = UPDATE_CLIENT_GROUP_ID_DYNAMIC;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DocumentNode } from 'graphql';
|
|
2
|
+
export declare const CREATE_CLIENT_GROUP_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
3
|
+
export declare const UPDATE_CLIENT_GROUP_NAME_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
4
|
+
export declare const DELETE_CLIENT_GROUP_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
@@ -1 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DELETE_CLIENT_GROUP_DYNAMIC = exports.UPDATE_CLIENT_GROUP_NAME_DYNAMIC = exports.CREATE_CLIENT_GROUP_DYNAMIC = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
const CREATE_CLIENT_GROUP_DYNAMIC = (fields = []) => {
|
|
6
|
+
const fieldStr = fields.join('\n ');
|
|
7
|
+
const hasFields = fields.length > 0;
|
|
8
|
+
return (0, graphql_tag_1.gql) `
|
|
9
|
+
mutation CreateClientGroup(
|
|
10
|
+
$name: String!
|
|
11
|
+
$createdBy: String!
|
|
12
|
+
$resourceId: String!
|
|
13
|
+
$resourceType: String!
|
|
14
|
+
$scope: String!
|
|
15
|
+
) {
|
|
16
|
+
createClientGroup(
|
|
17
|
+
name: $name
|
|
18
|
+
createdBy: $createdBy
|
|
19
|
+
resourceId: $resourceId
|
|
20
|
+
resourceType: $resourceType
|
|
21
|
+
scope: $scope
|
|
22
|
+
) {
|
|
23
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
};
|
|
28
|
+
exports.CREATE_CLIENT_GROUP_DYNAMIC = CREATE_CLIENT_GROUP_DYNAMIC;
|
|
29
|
+
const UPDATE_CLIENT_GROUP_NAME_DYNAMIC = (fields = []) => {
|
|
30
|
+
const fieldStr = fields.join('\n ');
|
|
31
|
+
const hasFields = fields.length > 0;
|
|
32
|
+
return (0, graphql_tag_1.gql) `
|
|
33
|
+
mutation UpdateClientGroupName(
|
|
34
|
+
$groupId: String!
|
|
35
|
+
$name: String!
|
|
36
|
+
$createdBy: String!
|
|
37
|
+
) {
|
|
38
|
+
updateClientGroupName(
|
|
39
|
+
groupId: $groupId
|
|
40
|
+
name: $name
|
|
41
|
+
createdBy: $createdBy
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
};
|
|
46
|
+
exports.UPDATE_CLIENT_GROUP_NAME_DYNAMIC = UPDATE_CLIENT_GROUP_NAME_DYNAMIC;
|
|
47
|
+
const DELETE_CLIENT_GROUP_DYNAMIC = (fields = []) => {
|
|
48
|
+
const fieldStr = fields.join('\n ');
|
|
49
|
+
const hasFields = fields.length > 0;
|
|
50
|
+
return (0, graphql_tag_1.gql) `
|
|
51
|
+
mutation DeleteClientGroup(
|
|
52
|
+
$groupId: String!
|
|
53
|
+
) {
|
|
54
|
+
deleteClientGroup(
|
|
55
|
+
groupId: $groupId
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
};
|
|
60
|
+
exports.DELETE_CLIENT_GROUP_DYNAMIC = DELETE_CLIENT_GROUP_DYNAMIC;
|
|
@@ -13,6 +13,7 @@ export declare const GET_BRAND_DETAIL_QUERY = "\n query GetBrandDetail($partner
|
|
|
13
13
|
export declare const GET_PRODUCT_OPTION: DocumentNode;
|
|
14
14
|
export declare const GET_POLICY: DocumentNode;
|
|
15
15
|
export declare const GET_PRODUCTS: DocumentNode;
|
|
16
|
+
export declare const GET_CLIENT_GROUPS_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
16
17
|
export declare const GET_PRODUCTS_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
17
18
|
export declare const GET_HANDLE_BY_SERVICETYPE: DocumentNode;
|
|
18
19
|
export declare const GET_RESOURCE_BY_PRODUCT: DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_PRODUCT_OPTION_DYNAMIC = exports.GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC = exports.GET_PRODUCTS_FEATURE_TYPE_DYNAMIC = exports.GET_PRODUCT_RELATED_TO_ARTICLE = exports.GET_SIMPLE_PRODUCTS_DYNAMIC = exports.GET_PRICE_MENUS = exports.GET_CATEGORIES = exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = exports.GET_TAGS_BY_CATEGORY = exports.GET_TAGS = exports.GET_LIST_PRICE = exports.GET_DETAIL_STORES = exports.GET_RELATED_INFOR = exports.GET_PRODUCT_VARIANT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_RESOURCE_BY_PRODUCT = exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS_DYNAMIC = exports.GET_PRODUCTS = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_SIMPLE_PRODUCT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
|
3
|
+
exports.GET_PRODUCT_OPTION_DYNAMIC = exports.GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC = exports.GET_PRODUCTS_FEATURE_TYPE_DYNAMIC = exports.GET_PRODUCT_RELATED_TO_ARTICLE = exports.GET_SIMPLE_PRODUCTS_DYNAMIC = exports.GET_PRICE_MENUS = exports.GET_CATEGORIES = exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = exports.GET_TAGS_BY_CATEGORY = exports.GET_TAGS = exports.GET_LIST_PRICE = exports.GET_DETAIL_STORES = exports.GET_RELATED_INFOR = exports.GET_PRODUCT_VARIANT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_RESOURCE_BY_PRODUCT = exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS_DYNAMIC = exports.GET_CLIENT_GROUPS_DYNAMIC = exports.GET_PRODUCTS = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_SIMPLE_PRODUCT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
// export const GET_PRODUCT_BY_ID_QUERY = gql`
|
|
6
6
|
// query GetProductById(
|
|
@@ -713,6 +713,26 @@ exports.GET_PRODUCTS = (0, graphql_tag_1.gql) `
|
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
`;
|
|
716
|
+
const GET_CLIENT_GROUPS_DYNAMIC = (fields = []) => {
|
|
717
|
+
const fieldStr = fields.join("\n ");
|
|
718
|
+
const hasFields = fields.length > 0;
|
|
719
|
+
return (0, graphql_tag_1.gql) `
|
|
720
|
+
query GetClientGroups(
|
|
721
|
+
$resourceId: String!
|
|
722
|
+
$resourceType: String!
|
|
723
|
+
$scope: String!
|
|
724
|
+
) {
|
|
725
|
+
getClientGroups(
|
|
726
|
+
resourceId: $resourceId
|
|
727
|
+
resourceType: $resourceType
|
|
728
|
+
scope: $scope
|
|
729
|
+
) {
|
|
730
|
+
${hasFields ? `${fieldStr}` : ""}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
`;
|
|
734
|
+
};
|
|
735
|
+
exports.GET_CLIENT_GROUPS_DYNAMIC = GET_CLIENT_GROUPS_DYNAMIC;
|
|
716
736
|
const GET_PRODUCTS_DYNAMIC = (fields = []) => {
|
|
717
737
|
const fieldStr = fields.join("\n ");
|
|
718
738
|
const hasFields = fields.length > 0;
|
|
@@ -4,3 +4,4 @@ export declare const GET_TYPE_LAB_SESSION: DocumentNode;
|
|
|
4
4
|
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
|
+
export declare const GET_LAB_DOING_AND_DONE_BY_USERID: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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.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) `
|
|
@@ -119,3 +119,13 @@ exports.GET_LAB_SESSIONS_CHILL_BY_PARENT = (0, graphql_tag_1.gql) `
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
`;
|
|
122
|
+
const GET_LAB_DOING_AND_DONE_BY_USERID = (fields = []) => {
|
|
123
|
+
const fieldStr = fields.join("\n ");
|
|
124
|
+
const hasFields = fields.length > 0;
|
|
125
|
+
return (0, graphql_tag_1.gql) `
|
|
126
|
+
query getLabDoingAndDoneByUserId($partnerId: String!, $userId: String!) {
|
|
127
|
+
getLabDoingAndDoneByUserId(partnerId: $partnerId userId: $userId) ${hasFields ? `{ ${fieldStr} }` : ""}
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
};
|
|
131
|
+
exports.GET_LAB_DOING_AND_DONE_BY_USERID = GET_LAB_DOING_AND_DONE_BY_USERID;
|
|
@@ -61,6 +61,7 @@ export declare class ComputingService extends Service {
|
|
|
61
61
|
updateCPU(computingId: string, socket: number, corePerSocket: number, updateBy: string, serviceId: string): Promise<any>;
|
|
62
62
|
updateRAM(computingId: string, size: number, unit: string, updateBy: string, serviceId: string): Promise<any>;
|
|
63
63
|
getComputingsDynamic(userId: string, fields: string[]): Promise<any>;
|
|
64
|
+
updateClientGroupIdDynamic(computingIds: [string] | null, groupId: string, updateBy: string, fields: string[]): Promise<any>;
|
|
64
65
|
createComputingForEC(createComputingInputForEC: any, createBy: string): Promise<any>;
|
|
65
66
|
computingDetailDynamic(computingId: string, serviceId: string, fields: string[]): Promise<any>;
|
|
66
67
|
}
|
|
@@ -923,6 +923,24 @@ class ComputingService extends serviceSDK_1.Service {
|
|
|
923
923
|
}
|
|
924
924
|
});
|
|
925
925
|
}
|
|
926
|
+
updateClientGroupIdDynamic(computingIds, groupId, updateBy, fields) {
|
|
927
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
928
|
+
const query = (0, mutations_1.UPDATE_CLIENT_GROUP_ID_DYNAMIC)(fields);
|
|
929
|
+
const variables = {
|
|
930
|
+
computingIds,
|
|
931
|
+
groupId,
|
|
932
|
+
updateBy,
|
|
933
|
+
};
|
|
934
|
+
try {
|
|
935
|
+
const response = yield this.graphqlMutationV2(query, variables);
|
|
936
|
+
return response.updateClientGroupId;
|
|
937
|
+
}
|
|
938
|
+
catch (error) {
|
|
939
|
+
console.log(`Error in updateClientGroupIdDynamic: ${error}`);
|
|
940
|
+
throw error;
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
}
|
|
926
944
|
createComputingForEC(createComputingInputForEC, createBy) {
|
|
927
945
|
return __awaiter(this, void 0, void 0, function* () {
|
|
928
946
|
const mutation = mutations_1.CREATE_COMPUTING_FOR_EC;
|
|
@@ -40,6 +40,10 @@ export declare class ProductService extends Service {
|
|
|
40
40
|
getProductOption(productId: string, store: string): Promise<any>;
|
|
41
41
|
getPolicy(groupId: string): Promise<any>;
|
|
42
42
|
getProducts(param: getProduct, store: string): Promise<any>;
|
|
43
|
+
getClientGroupsDynamic(resourceId: string, resourceType: string, scope: string, fields: string[]): Promise<any>;
|
|
44
|
+
createClientGroupDynamic(name: string, createdBy: string, resourceId: string, resourceType: string, scope: string, fields: string[]): Promise<any>;
|
|
45
|
+
updateClientGroupNameDynamic(groupId: string, name: string, updatedBy: string, fields: string[]): Promise<any>;
|
|
46
|
+
deleteClientGroupDynamic(groupId: string, fields: string[]): Promise<any>;
|
|
43
47
|
getProductsDynamic(param: getProduct, store: string, fields: string[]): Promise<any>;
|
|
44
48
|
getHandleByServiceTypes(serviceTypes: [string]): Promise<any>;
|
|
45
49
|
getResourceByProduct(productId: string): Promise<any>;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ProductService = void 0;
|
|
13
13
|
const serviceSDK_1 = require("../serviceSDK");
|
|
14
14
|
const queries_1 = require("../../graphql/product/queries");
|
|
15
|
+
const mutations_1 = require("../../graphql/product/mutations");
|
|
15
16
|
/**
|
|
16
17
|
* Service class for managing product-related operations.
|
|
17
18
|
*/
|
|
@@ -181,6 +182,78 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
181
182
|
}
|
|
182
183
|
});
|
|
183
184
|
}
|
|
185
|
+
getClientGroupsDynamic(resourceId, resourceType, scope, fields) {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
const query = (0, queries_1.GET_CLIENT_GROUPS_DYNAMIC)(fields);
|
|
188
|
+
const variablesHandle = {
|
|
189
|
+
resourceId,
|
|
190
|
+
resourceType,
|
|
191
|
+
scope,
|
|
192
|
+
};
|
|
193
|
+
try {
|
|
194
|
+
const response = yield this.graphqlQueryV2(query, variablesHandle);
|
|
195
|
+
return response.getClientGroups;
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
console.log(`Error fetching getClientGroups: ${error}`);
|
|
199
|
+
throw error;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
createClientGroupDynamic(name, createdBy, resourceId, resourceType, scope, fields) {
|
|
204
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
const mutation = (0, mutations_1.CREATE_CLIENT_GROUP_DYNAMIC)(fields);
|
|
206
|
+
const variablesHandle = {
|
|
207
|
+
name,
|
|
208
|
+
createdBy,
|
|
209
|
+
resourceId,
|
|
210
|
+
resourceType,
|
|
211
|
+
scope,
|
|
212
|
+
};
|
|
213
|
+
try {
|
|
214
|
+
const response = yield this.graphqlMutationV2(mutation, variablesHandle);
|
|
215
|
+
return response.createClientGroup;
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
console.log(`Error fetching createClientGroup: ${error}`);
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
updateClientGroupNameDynamic(groupId, name, updatedBy, fields) {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
+
const mutation = (0, mutations_1.UPDATE_CLIENT_GROUP_NAME_DYNAMIC)(fields);
|
|
226
|
+
const variablesHandle = {
|
|
227
|
+
groupId,
|
|
228
|
+
name,
|
|
229
|
+
updatedBy
|
|
230
|
+
};
|
|
231
|
+
try {
|
|
232
|
+
const response = yield this.graphqlMutationV2(mutation, variablesHandle);
|
|
233
|
+
return response.updateClientGroupName;
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
console.log(`Error fetching updateClientGroupNameDynamic: ${error}`);
|
|
237
|
+
throw error;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
deleteClientGroupDynamic(groupId, fields) {
|
|
242
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
243
|
+
const mutation = (0, mutations_1.DELETE_CLIENT_GROUP_DYNAMIC)(fields);
|
|
244
|
+
const variablesHandle = {
|
|
245
|
+
groupId
|
|
246
|
+
};
|
|
247
|
+
try {
|
|
248
|
+
const response = yield this.graphqlMutationV2(mutation, variablesHandle);
|
|
249
|
+
return response.deleteClientGroup;
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
console.log(`Error fetching deleteClientGroupDynamic: ${error}`);
|
|
253
|
+
throw error;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
184
257
|
getProductsDynamic(param, store, fields) {
|
|
185
258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
186
259
|
const query = (0, queries_1.GET_PRODUCTS_DYNAMIC)(fields);
|
|
@@ -15,4 +15,5 @@ export declare class QuicklabService extends Service {
|
|
|
15
15
|
updateTypeLabSession(labSessionId: string, typeLabSessionCode: string, userId: string): Promise<any>;
|
|
16
16
|
getLabSessionsChillByParent(labSessionId: string, userId: string): Promise<any>;
|
|
17
17
|
stopLabSessionForCustomer(labSessionId: string, userId: string, note: string): Promise<any>;
|
|
18
|
+
getLabDoingAndDoneByUserId(userId: string, fields: string[]): Promise<any>;
|
|
18
19
|
}
|
|
@@ -193,5 +193,19 @@ class QuicklabService extends serviceSDK_1.Service {
|
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
|
+
getLabDoingAndDoneByUserId(userId, fields) {
|
|
197
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
const query = (0, queries_1.GET_LAB_DOING_AND_DONE_BY_USERID)(fields);
|
|
199
|
+
const variables = { partnerId: this.orgId, userId };
|
|
200
|
+
try {
|
|
201
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
202
|
+
return response.getLabDoingAndDoneByUserId;
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
console.log(`Error in getLabDoingAndDoneByUserId : ${error}`);
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
196
210
|
}
|
|
197
211
|
exports.QuicklabService = QuicklabService;
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
|
|
2
|
-
import { DocumentNode } from "graphql";
|
|
3
|
-
export declare class Service {
|
|
4
|
-
protected token: string | null;
|
|
5
|
-
protected client: ApolloClient<NormalizedCacheObject>;
|
|
6
|
-
protected orgId: string;
|
|
7
|
-
protected storeId: string;
|
|
8
|
-
protected endpoint: string;
|
|
9
|
-
constructor(endpoint: string, orgId: string, storeId: string);
|
|
10
|
-
setToken(token: string): void;
|
|
11
|
-
protected graphqlQuery(query: DocumentNode, variables: any): Promise<any>;
|
|
12
|
-
protected graphqlMutation(mutation: DocumentNode, variables: any): Promise<any>;
|
|
13
|
-
protected restApiCallWithToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
|
|
14
|
-
}
|
package/dist/src/lib/service.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// src/service.ts
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.Service = void 0;
|
|
17
|
-
const client_1 = require("@apollo/client");
|
|
18
|
-
const axios_1 = __importDefault(require("axios"));
|
|
19
|
-
class Service {
|
|
20
|
-
constructor(endpoint, orgId, storeId) {
|
|
21
|
-
this.token = null;
|
|
22
|
-
this.client = new client_1.ApolloClient({
|
|
23
|
-
uri: endpoint,
|
|
24
|
-
cache: new client_1.InMemoryCache(),
|
|
25
|
-
defaultOptions: {
|
|
26
|
-
query: {
|
|
27
|
-
fetchPolicy: "network-only",
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
this.orgId = orgId;
|
|
32
|
-
this.storeId = storeId;
|
|
33
|
-
this.endpoint = endpoint;
|
|
34
|
-
}
|
|
35
|
-
setToken(token) {
|
|
36
|
-
this.token = token;
|
|
37
|
-
}
|
|
38
|
-
// setOrgId(orgId: string) {
|
|
39
|
-
// this.orgId = orgId;
|
|
40
|
-
// }
|
|
41
|
-
graphqlQuery(query, variables) {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
try {
|
|
44
|
-
const { data, errors } = yield this.client.query({
|
|
45
|
-
query: (0, client_1.gql) `
|
|
46
|
-
${query}
|
|
47
|
-
`,
|
|
48
|
-
variables,
|
|
49
|
-
});
|
|
50
|
-
if (errors) {
|
|
51
|
-
throw new Error(`GraphQL error! errors: ${errors}`);
|
|
52
|
-
}
|
|
53
|
-
return data;
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
console.log(`Error in graphqlQuery: ${error}`);
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
graphqlMutation(mutation, variables) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
try {
|
|
64
|
-
const { data, errors } = yield this.client.mutate({
|
|
65
|
-
mutation: (0, client_1.gql) `
|
|
66
|
-
${mutation}
|
|
67
|
-
`,
|
|
68
|
-
variables,
|
|
69
|
-
});
|
|
70
|
-
if (errors) {
|
|
71
|
-
throw new Error(`GraphQL error! errors: ${errors}`);
|
|
72
|
-
}
|
|
73
|
-
return data;
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
console.log(`Error in graphqlMutation: ${error}`);
|
|
77
|
-
throw error;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
restApiCallWithToken(path, method, data, headers) {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
try {
|
|
84
|
-
const modifiedHeaders = Object.assign(Object.assign({}, headers), { "Partner-Id": this.orgId, "X-Ecomos-Access-Token": this.token });
|
|
85
|
-
console.log("🚀 ~ Service ~ modifiedHeaders:", modifiedHeaders);
|
|
86
|
-
const response = yield (0, axios_1.default)({
|
|
87
|
-
url: this.endpoint + path,
|
|
88
|
-
method,
|
|
89
|
-
data,
|
|
90
|
-
headers: modifiedHeaders,
|
|
91
|
-
});
|
|
92
|
-
return response.data;
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
console.log(`Error in restApiCallWithToken: ${error}`);
|
|
96
|
-
throw error;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.Service = Service;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function buildFieldString(fields: (string | Record<string, any>)[], indent?: number): string;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildFieldString = void 0;
|
|
4
|
-
function buildFieldString(fields, indent = 6) {
|
|
5
|
-
const space = " ".repeat(indent);
|
|
6
|
-
return fields
|
|
7
|
-
.map((field) => {
|
|
8
|
-
if (typeof field === "string")
|
|
9
|
-
return `${space}${field}`;
|
|
10
|
-
const [key, value] = Object.entries(field)[0];
|
|
11
|
-
const nested = buildFieldString(value, indent + 2);
|
|
12
|
-
return `${space}${key} {\n${nested}\n${space}}`;
|
|
13
|
-
})
|
|
14
|
-
.join("\n");
|
|
15
|
-
}
|
|
16
|
-
exports.buildFieldString = buildFieldString;
|