@longvansoftware/service-js-client 1.3.7 → 1.3.8
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.d.ts +2 -0
- package/dist/config/config.js +2 -0
- package/dist/src/graphql/computing/queries.js +2 -2
- package/dist/src/graphql/resource_permission/mutations.d.ts +1 -0
- package/dist/src/graphql/resource_permission/mutations.js +29 -0
- package/dist/src/lib/SDK.d.ts +3 -0
- package/dist/src/lib/SDK.js +4 -1
- package/dist/src/lib/computing/index.d.ts +1 -1
- package/dist/src/lib/computing/index.js +2 -1
- package/dist/src/lib/resource_permission/index.d.ts +6 -0
- package/dist/src/lib/resource_permission/index.js +40 -0
- package/package.json +1 -1
package/dist/config/config.d.ts
CHANGED
@@ -14,6 +14,7 @@ export declare const environmentEndpoints: {
|
|
14
14
|
crm_camping: string;
|
15
15
|
order_graphQL: string;
|
16
16
|
paymentLV: string;
|
17
|
+
resource_permission: string;
|
17
18
|
};
|
18
19
|
live: {
|
19
20
|
product: string;
|
@@ -30,5 +31,6 @@ export declare const environmentEndpoints: {
|
|
30
31
|
crm_camping: string;
|
31
32
|
order_graphQL: string;
|
32
33
|
paymentLV: string;
|
34
|
+
resource_permission: string;
|
33
35
|
};
|
34
36
|
};
|
package/dist/config/config.js
CHANGED
@@ -17,6 +17,7 @@ exports.environmentEndpoints = {
|
|
17
17
|
crm_camping: "https://crm.dev.longvan.vn/campaign-gateway/graphql",
|
18
18
|
order_graphQL: "https://api-gateway.dev.longvan.vn/order-cloud-service/graphql",
|
19
19
|
paymentLV: "https://payment.dev.longvan.vn/graphql",
|
20
|
+
resource_permission: "https://api-gateway.dev.longvan.vn/resource-permission-api/graphql"
|
20
21
|
},
|
21
22
|
live: {
|
22
23
|
product: "https://product-service.longvan.vn/product-service/graphql",
|
@@ -33,5 +34,6 @@ exports.environmentEndpoints = {
|
|
33
34
|
crm_camping: "https://crm.longvan.vn/campaign-gateway/graphql",
|
34
35
|
order_graphQL: "https://api-gateway.longvan.vn/order-cloud-service/graphql",
|
35
36
|
paymentLV: "https://payment-staging.longvan.vn/graphql",
|
37
|
+
resource_permission: "https://api-gateway.longvan.vn/resource-permission-api/graphql"
|
36
38
|
},
|
37
39
|
};
|
@@ -211,8 +211,8 @@ exports.GET_COMPUTINGS = (0, graphql_tag_1.gql) `
|
|
211
211
|
}
|
212
212
|
`;
|
213
213
|
exports.GET_LAB_INSTANCE = (0, graphql_tag_1.gql) `
|
214
|
-
query GetLabInstance($articleId: String!, $userId: String!) {
|
215
|
-
getLabInstance(articleId: $articleId, userId: $userId) {
|
214
|
+
query GetLabInstance($articleId: String!, $labId: String!, $userId: String!) {
|
215
|
+
getLabInstance(articleId: $articleId, labId: $labId, userId: $userId) {
|
216
216
|
id
|
217
217
|
name
|
218
218
|
username
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const SHARE_RESOURCE: import("graphql").DocumentNode;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SHARE_RESOURCE = void 0;
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
5
|
+
exports.SHARE_RESOURCE = (0, graphql_tag_1.gql) `
|
6
|
+
mutation ShareResource(
|
7
|
+
$partnerId: String!
|
8
|
+
$createModel: ShareResourceRequest!
|
9
|
+
) {
|
10
|
+
shareResource(partnerId: $partnerId, createModel: $createModel) {
|
11
|
+
id
|
12
|
+
name
|
13
|
+
resourceId
|
14
|
+
org
|
15
|
+
resourceType
|
16
|
+
oauthSharePermissions {
|
17
|
+
role
|
18
|
+
partyId
|
19
|
+
partyName
|
20
|
+
permission
|
21
|
+
}
|
22
|
+
description
|
23
|
+
createdStamp
|
24
|
+
updatedStamp
|
25
|
+
updatedBy
|
26
|
+
createdBy
|
27
|
+
}
|
28
|
+
}
|
29
|
+
`;
|
package/dist/src/lib/SDK.d.ts
CHANGED
@@ -12,6 +12,7 @@ import { DnsService } from "../lib/dns/index";
|
|
12
12
|
import { CrmCampingService } from "./crm_camping";
|
13
13
|
import { OrderGraphQLService } from "./orderGraphQL";
|
14
14
|
import { PaymentLVService } from "./paymentLV";
|
15
|
+
import { ResourcePermissionService } from "./resource_permission";
|
15
16
|
export interface Endpoints {
|
16
17
|
product: string;
|
17
18
|
crm: string;
|
@@ -27,6 +28,7 @@ export interface Endpoints {
|
|
27
28
|
crm_camping: string;
|
28
29
|
order_graphQL: string;
|
29
30
|
paymentLV: string;
|
31
|
+
resource_permission: string;
|
30
32
|
}
|
31
33
|
export declare class SDK {
|
32
34
|
orgId: string;
|
@@ -47,6 +49,7 @@ export declare class SDK {
|
|
47
49
|
crm_camping: CrmCampingService;
|
48
50
|
order_graphQL: OrderGraphQLService;
|
49
51
|
paymentLV: PaymentLVService;
|
52
|
+
resource_permission: ResourcePermissionService;
|
50
53
|
token: string | null;
|
51
54
|
constructor(orgId: string, storeId: string, storefrontAccessToken: string, environment: string);
|
52
55
|
setToken(token: string): void;
|
package/dist/src/lib/SDK.js
CHANGED
@@ -18,6 +18,7 @@ const index_10 = require("../lib/dns/index");
|
|
18
18
|
const crm_camping_1 = require("./crm_camping");
|
19
19
|
const orderGraphQL_1 = require("./orderGraphQL");
|
20
20
|
const paymentLV_1 = require("./paymentLV");
|
21
|
+
const resource_permission_1 = require("./resource_permission");
|
21
22
|
class SDK {
|
22
23
|
constructor(orgId, storeId, storefrontAccessToken, environment) {
|
23
24
|
this.orgId = orgId;
|
@@ -25,7 +26,7 @@ class SDK {
|
|
25
26
|
this.storefrontAccessToken = storefrontAccessToken;
|
26
27
|
this.environment = environment;
|
27
28
|
this.token = null;
|
28
|
-
console.log("🚀 ~ SDK ~ environment:", environment);
|
29
|
+
//console.log("🚀 ~ SDK ~ environment:", environment);
|
29
30
|
(0, helpers_1.validateStorefrontAccessToken)(storefrontAccessToken);
|
30
31
|
const endpoints = environment == "live"
|
31
32
|
? config_1.environmentEndpoints.live
|
@@ -45,6 +46,7 @@ class SDK {
|
|
45
46
|
this.crm_camping = new crm_camping_1.CrmCampingService(endpoints.crm_camping, orgId, storeId);
|
46
47
|
this.order_graphQL = new orderGraphQL_1.OrderGraphQLService(endpoints.order_graphQL, orgId, storeId);
|
47
48
|
this.paymentLV = new paymentLV_1.PaymentLVService(endpoints.paymentLV, orgId, storeId);
|
49
|
+
this.resource_permission = new resource_permission_1.ResourcePermissionService(endpoints.resource_permission, orgId, storeId);
|
48
50
|
// Initialize other services here
|
49
51
|
}
|
50
52
|
setToken(token) {
|
@@ -64,6 +66,7 @@ class SDK {
|
|
64
66
|
this.crm_camping.setToken(token);
|
65
67
|
this.order_graphQL.setToken(token);
|
66
68
|
this.paymentLV.setToken(token);
|
69
|
+
this.resource_permission.setToken(token);
|
67
70
|
// Set token for other services here
|
68
71
|
}
|
69
72
|
// các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
|
@@ -32,7 +32,7 @@ export declare class ComputingService extends Service {
|
|
32
32
|
networkUsageStartTime(computingId: string, type: string, startTime: string): Promise<any>;
|
33
33
|
diskUsageStartTime(computingId: string, type: string, startTime: string): Promise<any>;
|
34
34
|
getComputings(userId: string): Promise<any>;
|
35
|
-
getLabInstance(articleId: string, userId: string): Promise<any>;
|
35
|
+
getLabInstance(articleId: string, labId: string, userId: string): Promise<any>;
|
36
36
|
createCluster(ownerId: string, name: string): Promise<any>;
|
37
37
|
addComputingInCluster(clusterId: string, computingId: string, userId: string): Promise<any>;
|
38
38
|
removeComputingInCluster(clusterId: string, computingId: string, userId: string): Promise<any>;
|
@@ -426,11 +426,12 @@ class ComputingService extends serviceSDK_1.Service {
|
|
426
426
|
}
|
427
427
|
});
|
428
428
|
}
|
429
|
-
getLabInstance(articleId, userId) {
|
429
|
+
getLabInstance(articleId, labId, userId) {
|
430
430
|
return __awaiter(this, void 0, void 0, function* () {
|
431
431
|
const query = queries_1.GET_LAB_INSTANCE;
|
432
432
|
const variables = {
|
433
433
|
articleId,
|
434
|
+
labId,
|
434
435
|
userId,
|
435
436
|
};
|
436
437
|
try {
|
@@ -0,0 +1,40 @@
|
|
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.ResourcePermissionService = void 0;
|
13
|
+
const mutations_1 = require("../../graphql/resource_permission/mutations");
|
14
|
+
const serviceSDK_1 = require("../serviceSDK");
|
15
|
+
class ResourcePermissionService extends serviceSDK_1.Service {
|
16
|
+
constructor(endpoint, orgId, storeId) {
|
17
|
+
super(endpoint, orgId, storeId);
|
18
|
+
}
|
19
|
+
setToken(token) {
|
20
|
+
this.token = token;
|
21
|
+
}
|
22
|
+
shareResource(createModel) {
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
24
|
+
const mutation = mutations_1.SHARE_RESOURCE;
|
25
|
+
const variables = {
|
26
|
+
partnerId: this.orgId,
|
27
|
+
createModel,
|
28
|
+
};
|
29
|
+
try {
|
30
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
31
|
+
return response.shareResource;
|
32
|
+
}
|
33
|
+
catch (error) {
|
34
|
+
console.log(`Error in shareResource: ${error}`);
|
35
|
+
throw error;
|
36
|
+
}
|
37
|
+
});
|
38
|
+
}
|
39
|
+
}
|
40
|
+
exports.ResourcePermissionService = ResourcePermissionService;
|