@longvansoftware/service-js-client 1.5.9 → 1.6.0
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/auth/mutations.d.ts +3 -0
- package/dist/src/graphql/auth/mutations.js +46 -1
- package/dist/src/graphql/auth/queries.d.ts +3 -0
- package/dist/src/graphql/auth/queries.js +28 -1
- package/dist/src/lib/auth/index.d.ts +6 -0
- package/dist/src/lib/auth/index.js +102 -0
- package/package.json +1 -1
@@ -8,3 +8,6 @@ export declare const UPDATE_PASSWORD_MUTATION: import("graphql").DocumentNode;
|
|
8
8
|
export declare const LOGIN_v2: import("graphql").DocumentNode;
|
9
9
|
export declare const CREATE_RESET_KEY: import("graphql").DocumentNode;
|
10
10
|
export declare const CHECK_RESET_KEY: import("graphql").DocumentNode;
|
11
|
+
export declare const UPDATE_PROFILE: import("graphql").DocumentNode;
|
12
|
+
export declare const CREATE_USER_DETAIL: import("graphql").DocumentNode;
|
13
|
+
export declare const LINKING_USER_LOGIN_AND_USER_DETAIL: import("graphql").DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.CHECK_RESET_KEY = exports.CREATE_RESET_KEY = exports.LOGIN_v2 = exports.UPDATE_PASSWORD_MUTATION = exports.UPDATE_INFO_MUTATION = exports.RESET_PASSWORD_MUTATION = exports.VERIFY_CODE_MUTATION = exports.SEND_SMS_VERIFY_CODE_MUTATION = exports.REGISTER_MUTATION = exports.LOGIN_MUTATION = void 0;
|
3
|
+
exports.LINKING_USER_LOGIN_AND_USER_DETAIL = exports.CREATE_USER_DETAIL = exports.UPDATE_PROFILE = exports.CHECK_RESET_KEY = exports.CREATE_RESET_KEY = exports.LOGIN_v2 = exports.UPDATE_PASSWORD_MUTATION = exports.UPDATE_INFO_MUTATION = exports.RESET_PASSWORD_MUTATION = exports.VERIFY_CODE_MUTATION = exports.SEND_SMS_VERIFY_CODE_MUTATION = exports.REGISTER_MUTATION = exports.LOGIN_MUTATION = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.LOGIN_MUTATION = (0, graphql_tag_1.gql) `
|
6
6
|
mutation Login($loginRequest: LoginRequest!) {
|
@@ -144,3 +144,48 @@ exports.CHECK_RESET_KEY = (0, graphql_tag_1.gql) `
|
|
144
144
|
}
|
145
145
|
}
|
146
146
|
`;
|
147
|
+
exports.UPDATE_PROFILE = (0, graphql_tag_1.gql) `
|
148
|
+
mutation UpdateProfile(
|
149
|
+
$userLoginId: String!
|
150
|
+
$name: String!
|
151
|
+
$phone: String!
|
152
|
+
$email: String
|
153
|
+
) {
|
154
|
+
updateProfile(
|
155
|
+
userLoginId: $userLoginId
|
156
|
+
name: $name
|
157
|
+
phone: $phone
|
158
|
+
email: $email
|
159
|
+
)
|
160
|
+
}
|
161
|
+
`;
|
162
|
+
exports.CREATE_USER_DETAIL = (0, graphql_tag_1.gql) `
|
163
|
+
mutation CreateUserDetail($userLoginId: String!, $partnerId: String!) {
|
164
|
+
createUserDetail(userLoginId: $userLoginId, partnerId: $partnerId) {
|
165
|
+
partyId
|
166
|
+
orgId
|
167
|
+
fullName
|
168
|
+
email
|
169
|
+
phone
|
170
|
+
address
|
171
|
+
identityNumber
|
172
|
+
gender
|
173
|
+
birthDate
|
174
|
+
avatarUrl
|
175
|
+
accessToken
|
176
|
+
username
|
177
|
+
readyV2
|
178
|
+
orgPermissionsMap
|
179
|
+
orgPositionsMap
|
180
|
+
orgRolesMap
|
181
|
+
}
|
182
|
+
}
|
183
|
+
`;
|
184
|
+
exports.LINKING_USER_LOGIN_AND_USER_DETAIL = (0, graphql_tag_1.gql) `
|
185
|
+
mutation LinkingUserLoginAndUserDetail(
|
186
|
+
$userLoginId: String!
|
187
|
+
$partyId: String!
|
188
|
+
) {
|
189
|
+
linkingUserLoginAndUserDetail(userLoginId: $userLoginId, partyId: $partyId)
|
190
|
+
}
|
191
|
+
`;
|
@@ -1 +1,4 @@
|
|
1
1
|
export declare const GET_USER_DETAIL: import("graphql").DocumentNode;
|
2
|
+
export declare const GET_USER_LOGIN_BY_TOKEN: import("graphql").DocumentNode;
|
3
|
+
export declare const GET_USER_LOGIN_BY_USER_LOGIN_ID: import("graphql").DocumentNode;
|
4
|
+
export declare const CHECK_USERNAME_EXISTED: import("graphql").DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GET_USER_DETAIL = void 0;
|
3
|
+
exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.GET_USER_DETAIL = (0, graphql_tag_1.gql) `
|
6
6
|
query GetUserDetail($orgId: String!, $accessToken: String!) {
|
@@ -23,3 +23,30 @@ exports.GET_USER_DETAIL = (0, graphql_tag_1.gql) `
|
|
23
23
|
}
|
24
24
|
}
|
25
25
|
`;
|
26
|
+
exports.GET_USER_LOGIN_BY_TOKEN = (0, graphql_tag_1.gql) `
|
27
|
+
query GetUserLoginByToken($accessToken: String!) {
|
28
|
+
getUserLoginByToken(accessToken: $accessToken) {
|
29
|
+
userLoginId
|
30
|
+
accessToken
|
31
|
+
status
|
32
|
+
partyId
|
33
|
+
id
|
34
|
+
}
|
35
|
+
}
|
36
|
+
`;
|
37
|
+
exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = (0, graphql_tag_1.gql) `
|
38
|
+
query GetUserLoginByUserLoginId($userLoginId: String!) {
|
39
|
+
getUserLoginByUserLoginId(userLoginId: $userLoginId) {
|
40
|
+
id
|
41
|
+
userLoginId
|
42
|
+
accessToken
|
43
|
+
status
|
44
|
+
partyId
|
45
|
+
}
|
46
|
+
}
|
47
|
+
`;
|
48
|
+
exports.CHECK_USERNAME_EXISTED = (0, graphql_tag_1.gql) `
|
49
|
+
query CheckUsernameExisted($username: String!, $orgId: String!) {
|
50
|
+
checkUsernameExisted(username: $username, orgId: $orgId)
|
51
|
+
}
|
52
|
+
`;
|
@@ -29,4 +29,10 @@ export declare class AuthService extends Service {
|
|
29
29
|
loginV2(loginRequest: LoginRequest): Promise<LoginResponse>;
|
30
30
|
createResetKey(userLoginId: string): Promise<any>;
|
31
31
|
checkResetKey(resetKey: string): Promise<any>;
|
32
|
+
getUserLoginByToken(accessToken: string): Promise<any>;
|
33
|
+
updateProfile(userLoginId: string, name: string, phone: string, email: string): Promise<any>;
|
34
|
+
createUserDetail(userLoginId: string): Promise<any>;
|
35
|
+
linkingUserLoginAndUserDetail(userLoginId: string, partyId: string): Promise<any>;
|
36
|
+
getUserLoginByUserLoginId(userLoginId: string): Promise<any>;
|
37
|
+
checkUsernameExisted(username: string): Promise<any>;
|
32
38
|
}
|
@@ -122,5 +122,107 @@ class AuthService extends serviceSDK_1.Service {
|
|
122
122
|
}
|
123
123
|
});
|
124
124
|
}
|
125
|
+
getUserLoginByToken(accessToken) {
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
127
|
+
const query = queries_1.GET_USER_LOGIN_BY_TOKEN;
|
128
|
+
const variables = {
|
129
|
+
accessToken,
|
130
|
+
};
|
131
|
+
try {
|
132
|
+
const response = yield this.graphqlQuery(query, variables);
|
133
|
+
return response.getUserLoginByToken;
|
134
|
+
}
|
135
|
+
catch (error) {
|
136
|
+
console.log(`Error in getUserLoginByToken: ${error}`);
|
137
|
+
throw error;
|
138
|
+
}
|
139
|
+
});
|
140
|
+
}
|
141
|
+
updateProfile(userLoginId, name, phone, email) {
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
143
|
+
const mutation = mutations_1.UPDATE_PROFILE;
|
144
|
+
const variables = {
|
145
|
+
userLoginId,
|
146
|
+
name,
|
147
|
+
phone,
|
148
|
+
email,
|
149
|
+
};
|
150
|
+
try {
|
151
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
152
|
+
return response.updateProfile;
|
153
|
+
}
|
154
|
+
catch (error) {
|
155
|
+
console.log(`Error in updateProfile: ${error}`);
|
156
|
+
throw error;
|
157
|
+
}
|
158
|
+
});
|
159
|
+
}
|
160
|
+
createUserDetail(userLoginId) {
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
162
|
+
const mutation = mutations_1.CREATE_USER_DETAIL;
|
163
|
+
const variables = {
|
164
|
+
userLoginId,
|
165
|
+
partnerId: this.orgId,
|
166
|
+
};
|
167
|
+
try {
|
168
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
169
|
+
return response.createUserDetail;
|
170
|
+
}
|
171
|
+
catch (error) {
|
172
|
+
console.log(`Error in createUserDetail: ${error}`);
|
173
|
+
throw error;
|
174
|
+
}
|
175
|
+
});
|
176
|
+
}
|
177
|
+
linkingUserLoginAndUserDetail(userLoginId, partyId) {
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
179
|
+
const mutation = mutations_1.LINKING_USER_LOGIN_AND_USER_DETAIL;
|
180
|
+
const variables = {
|
181
|
+
userLoginId,
|
182
|
+
partyId,
|
183
|
+
};
|
184
|
+
try {
|
185
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
186
|
+
return response.linkingUserLoginAndUserDetail;
|
187
|
+
}
|
188
|
+
catch (error) {
|
189
|
+
console.log(`Error in linkingUserLoginAndUserDetail: ${error}`);
|
190
|
+
throw error;
|
191
|
+
}
|
192
|
+
});
|
193
|
+
}
|
194
|
+
getUserLoginByUserLoginId(userLoginId) {
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
196
|
+
const query = queries_1.GET_USER_LOGIN_BY_USER_LOGIN_ID;
|
197
|
+
const variables = {
|
198
|
+
userLoginId,
|
199
|
+
};
|
200
|
+
try {
|
201
|
+
const response = yield this.graphqlQuery(query, variables);
|
202
|
+
return response.getUserLoginByUserLoginId;
|
203
|
+
}
|
204
|
+
catch (error) {
|
205
|
+
console.log(`Error in getUserLoginByUserLoginId: ${error}`);
|
206
|
+
throw error;
|
207
|
+
}
|
208
|
+
});
|
209
|
+
}
|
210
|
+
checkUsernameExisted(username) {
|
211
|
+
return __awaiter(this, void 0, void 0, function* () {
|
212
|
+
const query = queries_1.CHECK_USERNAME_EXISTED;
|
213
|
+
const variables = {
|
214
|
+
username,
|
215
|
+
orgId: this.orgId,
|
216
|
+
};
|
217
|
+
try {
|
218
|
+
const response = yield this.graphqlQuery(query, variables);
|
219
|
+
return response.checkUsernameExisted;
|
220
|
+
}
|
221
|
+
catch (error) {
|
222
|
+
console.log(`Error in checkUsernameExisted: ${error}`);
|
223
|
+
throw error;
|
224
|
+
}
|
225
|
+
});
|
226
|
+
}
|
125
227
|
}
|
126
228
|
exports.AuthService = AuthService;
|