@longvansoftware/service-js-client 1.6.0 → 1.6.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.
@@ -0,0 +1 @@
|
|
1
|
+
export declare const GET_SHARED_USER_BY_SERVICE: import("graphql").DocumentNode;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GET_SHARED_USER_BY_SERVICE = void 0;
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
5
|
+
exports.GET_SHARED_USER_BY_SERVICE = (0, graphql_tag_1.gql) `
|
6
|
+
query GetSharedUserByService($resourceType: String!, $resourceId: String!) {
|
7
|
+
getSharedUserByService(
|
8
|
+
resourceType: $resourceType
|
9
|
+
resourceId: $resourceId
|
10
|
+
) {
|
11
|
+
role
|
12
|
+
partyId
|
13
|
+
partyName
|
14
|
+
permission
|
15
|
+
}
|
16
|
+
}
|
17
|
+
`;
|
@@ -4,5 +4,6 @@ export declare class ResourcePermissionService extends Service {
|
|
4
4
|
setToken(token: string): void;
|
5
5
|
setStoreId(storeId: string): void;
|
6
6
|
shareResource(createModel: any): Promise<any>;
|
7
|
-
removeShareParty(resourceId: string, sharePartyId: string): Promise<any>;
|
7
|
+
removeShareParty(resourceId: string, sharePartyId: string, resourceType: string): Promise<any>;
|
8
|
+
getSharedUserByService(resourceType: string, resourceId: string): Promise<any>;
|
8
9
|
}
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.ResourcePermissionService = void 0;
|
13
13
|
const mutations_1 = require("../../graphql/resource_permission/mutations");
|
14
|
+
const queries_1 = require("../../graphql/resource_permission/queries");
|
14
15
|
const serviceSDK_1 = require("../serviceSDK");
|
15
16
|
class ResourcePermissionService extends serviceSDK_1.Service {
|
16
17
|
constructor(endpoint, orgId, storeId) {
|
@@ -39,13 +40,13 @@ class ResourcePermissionService extends serviceSDK_1.Service {
|
|
39
40
|
}
|
40
41
|
});
|
41
42
|
}
|
42
|
-
removeShareParty(resourceId, sharePartyId) {
|
43
|
+
removeShareParty(resourceId, sharePartyId, resourceType) {
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
44
45
|
const mutation = mutations_1.REMOVE_SHARE_PARTY;
|
45
46
|
const variables = {
|
46
47
|
partnerId: this.orgId,
|
47
48
|
orgId: this.orgId,
|
48
|
-
resourceType
|
49
|
+
resourceType,
|
49
50
|
resourceId,
|
50
51
|
sharePartyId,
|
51
52
|
};
|
@@ -59,5 +60,22 @@ class ResourcePermissionService extends serviceSDK_1.Service {
|
|
59
60
|
}
|
60
61
|
});
|
61
62
|
}
|
63
|
+
getSharedUserByService(resourceType, resourceId) {
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
65
|
+
const query = queries_1.GET_SHARED_USER_BY_SERVICE;
|
66
|
+
const variables = {
|
67
|
+
resourceType,
|
68
|
+
resourceId,
|
69
|
+
};
|
70
|
+
try {
|
71
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
72
|
+
return response.getSharedUserByService;
|
73
|
+
}
|
74
|
+
catch (error) {
|
75
|
+
console.log(`Error in getSharedUserByService: ${error}`);
|
76
|
+
throw error;
|
77
|
+
}
|
78
|
+
});
|
79
|
+
}
|
62
80
|
}
|
63
81
|
exports.ResourcePermissionService = ResourcePermissionService;
|