@palmetto/users-sdk 1.8.1 → 1.8.3
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/__generated__/schema.d.ts +113 -0
- package/dist/client.d.ts +14 -0
- package/dist/client.js +39 -0
- package/package.json +1 -1
|
@@ -56,6 +56,43 @@ export interface paths {
|
|
|
56
56
|
patch?: never;
|
|
57
57
|
trace?: never;
|
|
58
58
|
};
|
|
59
|
+
"/api/auth/login": {
|
|
60
|
+
parameters: {
|
|
61
|
+
query?: never;
|
|
62
|
+
header?: never;
|
|
63
|
+
path?: never;
|
|
64
|
+
cookie?: never;
|
|
65
|
+
};
|
|
66
|
+
get?: never;
|
|
67
|
+
put?: never;
|
|
68
|
+
/**
|
|
69
|
+
* Username/password login
|
|
70
|
+
* @deprecated
|
|
71
|
+
*/
|
|
72
|
+
post: operations["AuthController_login"];
|
|
73
|
+
delete?: never;
|
|
74
|
+
options?: never;
|
|
75
|
+
head?: never;
|
|
76
|
+
patch?: never;
|
|
77
|
+
trace?: never;
|
|
78
|
+
};
|
|
79
|
+
"/api/auth/reset-password": {
|
|
80
|
+
parameters: {
|
|
81
|
+
query?: never;
|
|
82
|
+
header?: never;
|
|
83
|
+
path?: never;
|
|
84
|
+
cookie?: never;
|
|
85
|
+
};
|
|
86
|
+
get?: never;
|
|
87
|
+
put?: never;
|
|
88
|
+
/** Request password reset email */
|
|
89
|
+
post: operations["AuthController_resetPassword"];
|
|
90
|
+
delete?: never;
|
|
91
|
+
options?: never;
|
|
92
|
+
head?: never;
|
|
93
|
+
patch?: never;
|
|
94
|
+
trace?: never;
|
|
95
|
+
};
|
|
59
96
|
"/api/organizations/{id}": {
|
|
60
97
|
parameters: {
|
|
61
98
|
query?: never;
|
|
@@ -617,6 +654,17 @@ export interface components {
|
|
|
617
654
|
*/
|
|
618
655
|
expiresIn: number;
|
|
619
656
|
};
|
|
657
|
+
/** LoginInput */
|
|
658
|
+
LoginInputDto: {
|
|
659
|
+
/** Format: email */
|
|
660
|
+
username: string;
|
|
661
|
+
password: string;
|
|
662
|
+
};
|
|
663
|
+
/** ResetPassword */
|
|
664
|
+
ResetPasswordDto: {
|
|
665
|
+
/** Format: email */
|
|
666
|
+
email: string;
|
|
667
|
+
};
|
|
620
668
|
/** Organization */
|
|
621
669
|
OrganizationDto: {
|
|
622
670
|
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
@@ -1596,6 +1644,71 @@ export interface operations {
|
|
|
1596
1644
|
};
|
|
1597
1645
|
};
|
|
1598
1646
|
};
|
|
1647
|
+
AuthController_login: {
|
|
1648
|
+
parameters: {
|
|
1649
|
+
query?: never;
|
|
1650
|
+
header?: never;
|
|
1651
|
+
path?: never;
|
|
1652
|
+
cookie?: never;
|
|
1653
|
+
};
|
|
1654
|
+
requestBody: {
|
|
1655
|
+
content: {
|
|
1656
|
+
"application/json": components["schemas"]["LoginInputDto"];
|
|
1657
|
+
};
|
|
1658
|
+
};
|
|
1659
|
+
responses: {
|
|
1660
|
+
200: {
|
|
1661
|
+
headers: {
|
|
1662
|
+
[name: string]: unknown;
|
|
1663
|
+
};
|
|
1664
|
+
content: {
|
|
1665
|
+
"application/json": components["schemas"]["TokenResponseDto"];
|
|
1666
|
+
};
|
|
1667
|
+
};
|
|
1668
|
+
/** @description When the provided body is invalid */
|
|
1669
|
+
400: {
|
|
1670
|
+
headers: {
|
|
1671
|
+
[name: string]: unknown;
|
|
1672
|
+
};
|
|
1673
|
+
content: {
|
|
1674
|
+
"application/json": components["schemas"]["BadRequestErrorDto"];
|
|
1675
|
+
};
|
|
1676
|
+
};
|
|
1677
|
+
/** @description When authentication fails */
|
|
1678
|
+
401: {
|
|
1679
|
+
headers: {
|
|
1680
|
+
[name: string]: unknown;
|
|
1681
|
+
};
|
|
1682
|
+
content: {
|
|
1683
|
+
"application/json": components["schemas"]["UnauthorizedErrorDto"];
|
|
1684
|
+
};
|
|
1685
|
+
};
|
|
1686
|
+
};
|
|
1687
|
+
};
|
|
1688
|
+
AuthController_resetPassword: {
|
|
1689
|
+
parameters: {
|
|
1690
|
+
query?: never;
|
|
1691
|
+
header?: never;
|
|
1692
|
+
path?: never;
|
|
1693
|
+
cookie?: never;
|
|
1694
|
+
};
|
|
1695
|
+
requestBody: {
|
|
1696
|
+
content: {
|
|
1697
|
+
"application/json": components["schemas"]["ResetPasswordDto"];
|
|
1698
|
+
};
|
|
1699
|
+
};
|
|
1700
|
+
responses: {
|
|
1701
|
+
/** @description When the provided body is invalid */
|
|
1702
|
+
400: {
|
|
1703
|
+
headers: {
|
|
1704
|
+
[name: string]: unknown;
|
|
1705
|
+
};
|
|
1706
|
+
content: {
|
|
1707
|
+
"application/json": components["schemas"]["BadRequestErrorDto"];
|
|
1708
|
+
};
|
|
1709
|
+
};
|
|
1710
|
+
};
|
|
1711
|
+
};
|
|
1599
1712
|
OrganizationsController_getOrganization: {
|
|
1600
1713
|
parameters: {
|
|
1601
1714
|
query?: never;
|
package/dist/client.d.ts
CHANGED
|
@@ -29,10 +29,13 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
29
29
|
addUserGrant({ id, ...input }: AddUserGrantInput, opts?: RequestOptions): Promise<AddUserGrantResult>;
|
|
30
30
|
deleteUserGrant({ id, ...input }: DeleteUserGrantInput, opts?: RequestOptions): Promise<DeleteUserGrantResult>;
|
|
31
31
|
getAuthToken({ code, skipUserVerification }: GetAuthTokenInput, opts?: RequestOptions): Promise<GetTokenResult>;
|
|
32
|
+
loginWithOtp({ identifier, otp, channel }: LoginWithOtpInput, opts?: RequestOptions): Promise<GetTokenResult>;
|
|
32
33
|
refreshToken({ refreshToken }: RefreshTokenInput, opts?: RequestOptions): Promise<GetTokenResult>;
|
|
33
34
|
private getToken;
|
|
34
35
|
getOtpChannels(input: GetOtpChannelsInput, opts?: RequestOptions): Promise<GetOtpChannelsResult>;
|
|
35
36
|
requestOtpChallenge(input: RequestOtpChallengeInput, opts?: RequestOptions): Promise<RequestOtpChallengeResult>;
|
|
37
|
+
login(input: LoginInput, opts?: RequestOptions): Promise<LoginResult>;
|
|
38
|
+
resetPassword(input: ResetPasswordInput, opts?: RequestOptions): Promise<ResetPasswordResult>;
|
|
36
39
|
getServices(_input: GetServicesInput, opts?: RequestOptions): Promise<GetServicesResult>;
|
|
37
40
|
createService(input: CreateServiceInput, opts?: RequestOptions): Promise<CreateServiceResult>;
|
|
38
41
|
getService(input: GetServiceInput, opts?: RequestOptions): Promise<GetServiceResult>;
|
|
@@ -140,6 +143,11 @@ export interface GetAuthTokenInput {
|
|
|
140
143
|
code: string;
|
|
141
144
|
skipUserVerification?: boolean;
|
|
142
145
|
}
|
|
146
|
+
export interface LoginWithOtpInput {
|
|
147
|
+
identifier: string;
|
|
148
|
+
otp: string;
|
|
149
|
+
channel: "EMAIL" | "SMS";
|
|
150
|
+
}
|
|
143
151
|
export interface RefreshTokenInput {
|
|
144
152
|
refreshToken: string;
|
|
145
153
|
}
|
|
@@ -156,3 +164,9 @@ export type GetOtpChannelsResponse = ExtractResultData<GetOtpChannelsResult>;
|
|
|
156
164
|
export type RequestOtpChallengeInput = ApiInput<paths["/api/auth/otp-challenge"]["post"]>;
|
|
157
165
|
export type RequestOtpChallengeResult = SdkResult<paths["/api/auth/otp-challenge"]["post"]>;
|
|
158
166
|
export type RequestOtpChallengeResponse = ExtractResultData<RequestOtpChallengeResult>;
|
|
167
|
+
export type LoginInput = ApiInput<paths["/api/auth/login"]["post"]>;
|
|
168
|
+
export type LoginResult = ResultOk<GetTokenResponse> | SdkError<ApiError<paths["/api/auth/login"]["post"]["responses"]>>;
|
|
169
|
+
export type LoginResponse = ExtractResultData<LoginResult>;
|
|
170
|
+
export type ResetPasswordInput = ApiInput<paths["/api/auth/reset-password"]["post"]>;
|
|
171
|
+
export type ResetPasswordResult = ResultOk<undefined> | SdkError<ApiError<paths["/api/auth/reset-password"]["post"]["responses"]>>;
|
|
172
|
+
export type ResetPasswordResponse = ExtractResultData<ResetPasswordResult>;
|
package/dist/client.js
CHANGED
|
@@ -353,6 +353,16 @@ class UsersApiClient extends base_sdk_client_1.BaseSdkClient {
|
|
|
353
353
|
}, opts);
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
|
+
loginWithOtp(_a, opts_1) {
|
|
357
|
+
return __awaiter(this, arguments, void 0, function* ({ identifier, otp, channel }, opts) {
|
|
358
|
+
return this.getToken({
|
|
359
|
+
grant_type: "https://users.palmetto.com/oauth/grant-types/otp-challenge",
|
|
360
|
+
identifier,
|
|
361
|
+
otp,
|
|
362
|
+
channel,
|
|
363
|
+
}, opts);
|
|
364
|
+
});
|
|
365
|
+
}
|
|
356
366
|
refreshToken(_a, opts_1) {
|
|
357
367
|
return __awaiter(this, arguments, void 0, function* ({ refreshToken }, opts) {
|
|
358
368
|
return this.getToken({
|
|
@@ -402,6 +412,35 @@ class UsersApiClient extends base_sdk_client_1.BaseSdkClient {
|
|
|
402
412
|
return this.handleErrorResponse(error, response);
|
|
403
413
|
});
|
|
404
414
|
}
|
|
415
|
+
login(input, opts) {
|
|
416
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
417
|
+
const { data, error, response } = yield this.client.POST("/api/auth/login", {
|
|
418
|
+
body: input,
|
|
419
|
+
headers: this.generateHeaders(opts),
|
|
420
|
+
});
|
|
421
|
+
if (data) {
|
|
422
|
+
return (0, result_1.Ok)({
|
|
423
|
+
accessToken: data.access_token,
|
|
424
|
+
idToken: data.id_token,
|
|
425
|
+
refreshToken: data.refresh_token,
|
|
426
|
+
expiresIn: data.expires_in,
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
return this.handleErrorResponse(error, response);
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
resetPassword(input, opts) {
|
|
433
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
434
|
+
const { data, error, response } = yield this.client.POST("/api/auth/reset-password", {
|
|
435
|
+
body: input,
|
|
436
|
+
headers: this.generateHeaders(opts),
|
|
437
|
+
});
|
|
438
|
+
if (!error) {
|
|
439
|
+
return (0, result_1.Ok)(data);
|
|
440
|
+
}
|
|
441
|
+
return this.handleErrorResponse(error, response);
|
|
442
|
+
});
|
|
443
|
+
}
|
|
405
444
|
getServices(_input, opts) {
|
|
406
445
|
return __awaiter(this, void 0, void 0, function* () {
|
|
407
446
|
const { data, error, response } = yield this.client.GET("/api/services", {
|