@longvansoftware/service-js-client 1.6.4 → 1.6.6
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.
@@ -11,3 +11,7 @@ export declare const CHECK_RESET_KEY: import("graphql").DocumentNode;
|
|
11
11
|
export declare const UPDATE_PROFILE: import("graphql").DocumentNode;
|
12
12
|
export declare const CREATE_USER_DETAIL: import("graphql").DocumentNode;
|
13
13
|
export declare const LINKING_USER_LOGIN_AND_USER_DETAIL: import("graphql").DocumentNode;
|
14
|
+
export declare const SEND_OTP: import("graphql").DocumentNode;
|
15
|
+
export declare const VALIDATE_OTP: import("graphql").DocumentNode;
|
16
|
+
export declare const CREATE_USER_LOGIN: import("graphql").DocumentNode;
|
17
|
+
export declare const CREATE_USER_DETAIL_WITHOUT_USER_LOGIN: import("graphql").DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
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;
|
3
|
+
exports.CREATE_USER_DETAIL_WITHOUT_USER_LOGIN = exports.CREATE_USER_LOGIN = exports.VALIDATE_OTP = exports.SEND_OTP = 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!) {
|
@@ -189,3 +189,52 @@ exports.LINKING_USER_LOGIN_AND_USER_DETAIL = (0, graphql_tag_1.gql) `
|
|
189
189
|
linkingUserLoginAndUserDetail(userLoginId: $userLoginId, partyId: $partyId)
|
190
190
|
}
|
191
191
|
`;
|
192
|
+
exports.SEND_OTP = (0, graphql_tag_1.gql) `
|
193
|
+
mutation SendOTP($orgId: String!, $phone: String!) {
|
194
|
+
sendOTP(orgId: $orgId, phone: $phone) {
|
195
|
+
id
|
196
|
+
code
|
197
|
+
username
|
198
|
+
timeExpired
|
199
|
+
}
|
200
|
+
}
|
201
|
+
`;
|
202
|
+
exports.VALIDATE_OTP = (0, graphql_tag_1.gql) `
|
203
|
+
mutation ValidateOTP($otpCode: String!, $phone: String!) {
|
204
|
+
validateOTP(otpCode: $otpCode, phone: $phone)
|
205
|
+
}
|
206
|
+
`;
|
207
|
+
exports.CREATE_USER_LOGIN = (0, graphql_tag_1.gql) `
|
208
|
+
mutation CreateUserLogin($userLoginId: String!) {
|
209
|
+
createUserLogin(userLoginId: $userLoginId) {
|
210
|
+
id
|
211
|
+
partyId
|
212
|
+
type
|
213
|
+
username
|
214
|
+
status
|
215
|
+
accessToken
|
216
|
+
}
|
217
|
+
}
|
218
|
+
`;
|
219
|
+
exports.CREATE_USER_DETAIL_WITHOUT_USER_LOGIN = (0, graphql_tag_1.gql) `
|
220
|
+
mutation CreateUserDetailWithoutUserLogin(
|
221
|
+
$name: String!
|
222
|
+
$phone: String!
|
223
|
+
$email: String
|
224
|
+
$partnerId: String!
|
225
|
+
) {
|
226
|
+
createUserDetailWithoutUserLogin(
|
227
|
+
name: $name
|
228
|
+
phone: $phone
|
229
|
+
email: $email
|
230
|
+
partnerId: $partnerId
|
231
|
+
) {
|
232
|
+
id
|
233
|
+
partyId
|
234
|
+
type
|
235
|
+
username
|
236
|
+
status
|
237
|
+
accessToken
|
238
|
+
}
|
239
|
+
}
|
240
|
+
`;
|
@@ -18,7 +18,7 @@ export declare class AuthService extends Service {
|
|
18
18
|
* @param loginRequest - The login request object.
|
19
19
|
* @returns A promise that resolves to the login response.
|
20
20
|
*/
|
21
|
-
login(loginRequest:
|
21
|
+
login(loginRequest: any): Promise<LoginResponse>;
|
22
22
|
/**
|
23
23
|
* Registers a new user with the provided register request.
|
24
24
|
* @param registerRequest - The register request object.
|
@@ -36,4 +36,8 @@ export declare class AuthService extends Service {
|
|
36
36
|
getUserLoginByUserLoginId(userLoginId: string): Promise<any>;
|
37
37
|
checkUsernameExisted(username: string): Promise<any>;
|
38
38
|
getUserLoginsByPartyId(partyId: string): Promise<any>;
|
39
|
+
sendOTP(phone: string): Promise<any>;
|
40
|
+
validateOTP(otpCode: string, phone: string): Promise<any>;
|
41
|
+
createUserLogin(userLoginId: string): Promise<any>;
|
42
|
+
createUserDetailWithoutUserLogin(name: string, phone: string, email: string): Promise<any>;
|
39
43
|
}
|
@@ -240,5 +240,74 @@ class AuthService extends serviceSDK_1.Service {
|
|
240
240
|
}
|
241
241
|
});
|
242
242
|
}
|
243
|
+
sendOTP(phone) {
|
244
|
+
return __awaiter(this, void 0, void 0, function* () {
|
245
|
+
const mutation = mutations_1.SEND_OTP;
|
246
|
+
const variables = {
|
247
|
+
orgId: this.orgId,
|
248
|
+
phone,
|
249
|
+
};
|
250
|
+
try {
|
251
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
252
|
+
return response.sendOTP;
|
253
|
+
}
|
254
|
+
catch (error) {
|
255
|
+
console.log(`Error in sendOTP: ${error}`);
|
256
|
+
throw error;
|
257
|
+
}
|
258
|
+
});
|
259
|
+
}
|
260
|
+
validateOTP(otpCode, phone) {
|
261
|
+
return __awaiter(this, void 0, void 0, function* () {
|
262
|
+
const mutation = mutations_1.VALIDATE_OTP;
|
263
|
+
const variables = {
|
264
|
+
otpCode,
|
265
|
+
phone,
|
266
|
+
};
|
267
|
+
try {
|
268
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
269
|
+
return response.validateOTP;
|
270
|
+
}
|
271
|
+
catch (error) {
|
272
|
+
console.log(`Error in validateOTP: ${error}`);
|
273
|
+
throw error;
|
274
|
+
}
|
275
|
+
});
|
276
|
+
}
|
277
|
+
createUserLogin(userLoginId) {
|
278
|
+
return __awaiter(this, void 0, void 0, function* () {
|
279
|
+
const mutation = mutations_1.CREATE_USER_LOGIN;
|
280
|
+
const variables = {
|
281
|
+
userLoginId,
|
282
|
+
};
|
283
|
+
try {
|
284
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
285
|
+
return response.createUserLogin;
|
286
|
+
}
|
287
|
+
catch (error) {
|
288
|
+
console.log(`Error in createUserLogin: ${error}`);
|
289
|
+
throw error;
|
290
|
+
}
|
291
|
+
});
|
292
|
+
}
|
293
|
+
createUserDetailWithoutUserLogin(name, phone, email) {
|
294
|
+
return __awaiter(this, void 0, void 0, function* () {
|
295
|
+
const mutation = mutations_1.CREATE_USER_DETAIL_WITHOUT_USER_LOGIN;
|
296
|
+
const variables = {
|
297
|
+
name,
|
298
|
+
phone,
|
299
|
+
email,
|
300
|
+
partnerId: this.orgId,
|
301
|
+
};
|
302
|
+
try {
|
303
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
304
|
+
return response.createUserDetailWithoutUserLogin;
|
305
|
+
}
|
306
|
+
catch (error) {
|
307
|
+
console.log(`Error in createUserDetailWithoutUserLogin: ${error}`);
|
308
|
+
throw error;
|
309
|
+
}
|
310
|
+
});
|
311
|
+
}
|
243
312
|
}
|
244
313
|
exports.AuthService = AuthService;
|