@longvansoftware/service-js-client 2.7.9 → 2.8.1
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/config/config.js +22 -22
- package/dist/src/graphql/campaign/queries.d.ts +13 -11
- package/dist/src/graphql/campaign/queries.js +39 -111
- package/dist/src/graphql/computing/queries.js +2 -2
- package/dist/src/graphql/marketplace/mutations.d.ts +3 -0
- package/dist/src/graphql/marketplace/mutations.js +54 -0
- package/dist/src/graphql/marketplace/queries.d.ts +2 -0
- package/dist/src/graphql/marketplace/queries.js +42 -0
- package/dist/src/graphql/paymentV2/mutations.d.ts +1 -0
- package/dist/src/graphql/paymentV2/mutations.js +15 -1
- package/dist/src/graphql/paymentV2/queries.d.ts +2 -0
- package/dist/src/graphql/paymentV2/queries.js +58 -1
- package/dist/src/graphql/quicklab_service/mutations.d.ts +1 -0
- package/dist/src/graphql/quicklab_service/mutations.js +11 -1
- package/dist/src/graphql/quicklab_service/queries.d.ts +3 -0
- package/dist/src/graphql/quicklab_service/queries.js +25 -1
- package/dist/src/graphql/storefont/mutation.d.ts +0 -0
- package/dist/src/graphql/storefont/mutation.js +1 -0
- package/dist/src/graphql/storefont/queries.d.ts +2 -0
- package/dist/src/graphql/storefont/queries.js +46 -0
- package/dist/src/graphql/tag/mutations.d.ts +2 -0
- package/dist/src/graphql/tag/mutations.js +44 -0
- package/dist/src/graphql/tag/queries.d.ts +1 -0
- package/dist/src/graphql/tag/queries.js +20 -0
- package/dist/src/lib/auth/index.js +8 -1
- package/dist/src/lib/campaign/index.d.ts +1 -0
- package/dist/src/lib/campaign/index.js +69 -12
- package/dist/src/lib/computing/index.d.ts +1 -1
- package/dist/src/lib/computing/index.js +2 -2
- package/dist/src/lib/marketplace/index.d.ts +9 -0
- package/dist/src/lib/marketplace/index.js +106 -0
- package/dist/src/lib/paymentV2/index.d.ts +10 -0
- package/dist/src/lib/paymentV2/index.js +39 -0
- package/dist/src/lib/portal/index.d.ts +3 -0
- package/dist/src/lib/portal/index.js +50 -0
- package/dist/src/lib/quicklab_service/index.d.ts +5 -1
- package/dist/src/lib/quicklab_service/index.js +66 -3
- package/dist/src/lib/storefont/index.d.ts +6 -0
- package/dist/src/lib/storefont/index.js +51 -0
- package/dist/src/lib/tag/index.d.ts +7 -0
- package/dist/src/lib/tag/index.js +61 -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
|
@@ -221,8 +221,8 @@ class QuicklabService extends serviceSDK_1.Service {
|
|
|
221
221
|
}
|
|
222
222
|
});
|
|
223
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 = []) {
|
|
224
|
+
createComputingLabByTemplateId(templateId_1, userId_1, productId_1, province_1, timeUse_1, createBy_1, price_1, typeLabSessionCode_1) {
|
|
225
|
+
return __awaiter(this, arguments, void 0, function* (templateId, userId, productId, province, timeUse, createBy, price, typeLabSessionCode, fields = []) {
|
|
226
226
|
const mutation = (0, mutations_1.CREATE_COMPUTING_LAB_BY_TEMPLATE_ID)(fields);
|
|
227
227
|
const variables = {
|
|
228
228
|
templateId,
|
|
@@ -231,7 +231,8 @@ class QuicklabService extends serviceSDK_1.Service {
|
|
|
231
231
|
province,
|
|
232
232
|
timeUse: Number(timeUse),
|
|
233
233
|
createBy,
|
|
234
|
-
price: price != null ? Number(price) : null
|
|
234
|
+
price: price != null ? Number(price) : null,
|
|
235
|
+
typeLabSessionCode: typeLabSessionCode || null
|
|
235
236
|
};
|
|
236
237
|
try {
|
|
237
238
|
const response = yield this.graphqlMutation(mutation, variables);
|
|
@@ -346,5 +347,67 @@ class QuicklabService extends serviceSDK_1.Service {
|
|
|
346
347
|
}
|
|
347
348
|
});
|
|
348
349
|
}
|
|
350
|
+
getLabSessions() {
|
|
351
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
352
|
+
try {
|
|
353
|
+
const response = yield this.graphqlMutationV2(queries_1.GET_TYPE_LAB_SESSIONS, {});
|
|
354
|
+
return response.getTypeLabSessions;
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
console.log(`Error in getTypeLabSessions: ${error}`);
|
|
358
|
+
throw error;
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
updateComputingLabTypeLabSessionCode(userId, computingId, typeLabSessionCode, updateBy) {
|
|
363
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
364
|
+
const variables = { partnerId: this.orgId, userId, computingId, typeLabSessionCode, updateBy };
|
|
365
|
+
try {
|
|
366
|
+
const response = yield this.graphqlMutation(queries_1.UPDATE_COMPUTING_LAB_TYPE_LAB_SESSION_CODE, variables);
|
|
367
|
+
return response.updateComputingLabTypeLabSessionCode;
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
console.log(`Error in updateComputingLabTypeLabSessionCode: ${error}`);
|
|
371
|
+
throw error;
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
stopComputingLabByTypeLabSessionCode(userId, computingId, updateBy) {
|
|
376
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
377
|
+
const variables = {
|
|
378
|
+
partnerId: this.orgId,
|
|
379
|
+
userId,
|
|
380
|
+
computingId,
|
|
381
|
+
updateBy
|
|
382
|
+
};
|
|
383
|
+
try {
|
|
384
|
+
const response = yield this.graphqlMutation(queries_1.STOP_COMPUTING_LAB_BY_TYPE_LAB_SESSION_CODE, variables);
|
|
385
|
+
return response.stopComputingLabByTypeLabSessionCode;
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
console.log(`Error in stopComputingLabByTypeLabSessionCode: ${error}`);
|
|
389
|
+
throw error;
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
renewalComputingLab(userId, computingId, timeUse, updateBy) {
|
|
394
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
395
|
+
const variables = {
|
|
396
|
+
partnerId: this.orgId,
|
|
397
|
+
userId,
|
|
398
|
+
computingId,
|
|
399
|
+
timeUse: Number(timeUse),
|
|
400
|
+
updateBy
|
|
401
|
+
};
|
|
402
|
+
try {
|
|
403
|
+
const response = yield this.graphqlMutation(mutations_1.RENEWAL_COMPUTING_LAB, variables);
|
|
404
|
+
return response.renewalComputingLab;
|
|
405
|
+
}
|
|
406
|
+
catch (error) {
|
|
407
|
+
console.log(`Error in renewalComputingLab: ${error}`);
|
|
408
|
+
throw error;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
}
|
|
349
412
|
}
|
|
350
413
|
exports.QuicklabService = QuicklabService;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class StorefontService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
getRevenueStatisticByGroupOrCategory(dataQuery: any, groupBy: any): Promise<any>;
|
|
5
|
+
getRevenueStatisticByProduct(dataQuery: any): Promise<any>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.StorefontService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
const queries_1 = require("../../graphql/storefont/queries");
|
|
15
|
+
class StorefontService extends serviceSDK_1.Service {
|
|
16
|
+
constructor(endpoint, orgId, storeId) {
|
|
17
|
+
super(endpoint, orgId, storeId);
|
|
18
|
+
}
|
|
19
|
+
getRevenueStatisticByGroupOrCategory(dataQuery, groupBy) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const query = queries_1.GET_REVENUE_STATISTIC_BY_GROUP_OR_CATEGORY;
|
|
22
|
+
const variables = {
|
|
23
|
+
input: dataQuery,
|
|
24
|
+
groupBy,
|
|
25
|
+
};
|
|
26
|
+
try {
|
|
27
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
28
|
+
return response.getRevenueStatisticByGroupOrCategory;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getRevenueStatisticByProduct(dataQuery) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const query = queries_1.GET_REVENUE_STATISTIC_BY_PRODUCT;
|
|
38
|
+
const variables = {
|
|
39
|
+
input: dataQuery,
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
43
|
+
return response.getRevenueStatisticByProduct;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.StorefontService = StorefontService;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class TagService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
addTagToTagGroup(data: any): Promise<any>;
|
|
5
|
+
removeTagToTagGroup(data: any): Promise<any>;
|
|
6
|
+
getResultTag(resourceId: string, resourceType: string): Promise<any>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.TagService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
const mutations_1 = require("../../graphql/tag/mutations");
|
|
15
|
+
const queries_1 = require("../../graphql/tag/queries");
|
|
16
|
+
class TagService extends serviceSDK_1.Service {
|
|
17
|
+
constructor(endpoint, orgId, storeId) {
|
|
18
|
+
super(endpoint, orgId, storeId);
|
|
19
|
+
}
|
|
20
|
+
addTagToTagGroup(data) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const mutation = mutations_1.ADD_TAG_TO_TAG_GROUP;
|
|
23
|
+
try {
|
|
24
|
+
const response = yield this.graphqlMutation(mutation, data);
|
|
25
|
+
return response.addTagToTagGroup;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
removeTagToTagGroup(data) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const mutation = mutations_1.REMOVE_TAG_TO_TAG_GROUP;
|
|
35
|
+
try {
|
|
36
|
+
const response = yield this.graphqlMutation(mutation, data);
|
|
37
|
+
return response.removeTagToTagGroup;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
getResultTag(resourceId, resourceType) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const queries = queries_1.GET_RESULT_TAG;
|
|
47
|
+
const variables = {
|
|
48
|
+
resourceId,
|
|
49
|
+
resourceType,
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
const response = yield this.graphqlMutationV3(queries, variables);
|
|
53
|
+
return response.getResultTag;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.TagService = TagService;
|
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;
|