@steffesgroup/steffes-auth
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -13,2 +13,3 @@ import { AxiosInstance, AxiosRequestConfig, AxiosResponse, CancelToken } from 'axios'; | ||
sendResetPassword(tenantId: string | null, email: string): Promise<FileResponse>; | ||
unlock(tenantId: string | null, unlockDTO: UnlockDTO): Promise<FileResponse>; | ||
} | ||
@@ -28,2 +29,4 @@ export declare class AuthClient extends AuthorizedApiBase implements IAuthClient { | ||
protected processSendResetPassword(response: AxiosResponse): Promise<FileResponse>; | ||
unlock(tenantId: string | null, unlockDTO: UnlockDTO, cancelToken?: CancelToken | undefined): Promise<FileResponse>; | ||
protected processUnlock(response: AxiosResponse): Promise<FileResponse>; | ||
} | ||
@@ -46,2 +49,3 @@ export interface IUserClient { | ||
refreshTokenExpires?: Date; | ||
isLocked?: boolean; | ||
constructor(data?: ITokenDTO); | ||
@@ -57,2 +61,3 @@ init(_data?: any): void; | ||
refreshTokenExpires?: Date; | ||
isLocked?: boolean; | ||
} | ||
@@ -107,2 +112,14 @@ export declare class LoginDTO implements ILoginDTO { | ||
} | ||
export declare class UnlockDTO implements IUnlockDTO { | ||
email: string; | ||
token: string; | ||
constructor(data?: IUnlockDTO); | ||
init(_data?: any): void; | ||
static fromJS(data: any): UnlockDTO; | ||
toJSON(data?: any): any; | ||
} | ||
export interface IUnlockDTO { | ||
email: string; | ||
token: string; | ||
} | ||
export declare class UserDTO implements IUserDTO { | ||
@@ -109,0 +126,0 @@ userId?: number; |
@@ -8,3 +8,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IConfig = exports.ApiException = exports.UserDTO = exports.ResetPasswordDTO = exports.RefreshTokenDTO = exports.PlatformType = exports.LoginDTO = exports.TokenDTO = exports.UserClient = exports.AuthClient = exports.AuthorizedApiBase = void 0; | ||
exports.IConfig = exports.ApiException = exports.UserDTO = exports.UnlockDTO = exports.ResetPasswordDTO = exports.RefreshTokenDTO = exports.PlatformType = exports.LoginDTO = exports.TokenDTO = exports.UserClient = exports.AuthClient = exports.AuthorizedApiBase = void 0; | ||
/* tslint:disable */ | ||
@@ -269,2 +269,62 @@ /* eslint-disable */ | ||
} | ||
unlock(tenantId, unlockDTO, cancelToken) { | ||
let url_ = this.baseUrl + "/api/v1/Auth/{tenantId}/Unlock"; | ||
if (tenantId === undefined || tenantId === null) | ||
throw new Error("The parameter 'tenantId' must be defined."); | ||
url_ = url_.replace("{tenantId}", encodeURIComponent("" + tenantId)); | ||
url_ = url_.replace(/[?&]$/, ""); | ||
const content_ = JSON.stringify(unlockDTO); | ||
let options_ = { | ||
data: content_, | ||
responseType: "blob", | ||
method: "POST", | ||
url: url_, | ||
headers: { | ||
"Content-Type": "application/json", | ||
"Accept": "application/octet-stream" | ||
}, | ||
cancelToken | ||
}; | ||
return this.transformOptions(options_).then(transformedOptions_ => { | ||
return this.instance.request(transformedOptions_); | ||
}).catch((_error) => { | ||
if (isAxiosError(_error) && _error.response) { | ||
return _error.response; | ||
} | ||
else { | ||
throw _error; | ||
} | ||
}).then((_response) => { | ||
return this.transformResult(url_, _response, (_response) => this.processUnlock(_response)); | ||
}); | ||
} | ||
processUnlock(response) { | ||
const status = response.status; | ||
let _headers = {}; | ||
if (response.headers && typeof response.headers === "object") { | ||
for (let k in response.headers) { | ||
if (response.headers.hasOwnProperty(k)) { | ||
_headers[k] = response.headers[k]; | ||
} | ||
} | ||
} | ||
if (status === 200 || status === 206) { | ||
const contentDisposition = response.headers ? response.headers["content-disposition"] : undefined; | ||
let fileNameMatch = contentDisposition ? /filename\*=(?:(\\?['"])(.*?)\1|(?:[^\s]+'.*?')?([^;\n]*))/g.exec(contentDisposition) : undefined; | ||
let fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[3] || fileNameMatch[2] : undefined; | ||
if (fileName) { | ||
fileName = decodeURIComponent(fileName); | ||
} | ||
else { | ||
fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined; | ||
fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined; | ||
} | ||
return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data], { type: response.headers["content-type"] }), headers: _headers }); | ||
} | ||
else if (status !== 200 && status !== 204) { | ||
const _responseText = response.data; | ||
return throwException("An unexpected server error occurred.", status, _responseText, _headers); | ||
} | ||
return Promise.resolve(null); | ||
} | ||
} | ||
@@ -346,2 +406,3 @@ exports.AuthClient = AuthClient; | ||
this.refreshTokenExpires = _data["refreshTokenExpires"] ? new Date(_data["refreshTokenExpires"].toString()) : undefined; | ||
this.isLocked = _data["isLocked"]; | ||
} | ||
@@ -361,2 +422,3 @@ } | ||
data["refreshTokenExpires"] = this.refreshTokenExpires ? this.refreshTokenExpires.toISOString() : undefined; | ||
data["isLocked"] = this.isLocked; | ||
return data; | ||
@@ -466,2 +528,31 @@ } | ||
exports.ResetPasswordDTO = ResetPasswordDTO; | ||
class UnlockDTO { | ||
constructor(data) { | ||
if (data) { | ||
for (var property in data) { | ||
if (data.hasOwnProperty(property)) | ||
this[property] = data[property]; | ||
} | ||
} | ||
} | ||
init(_data) { | ||
if (_data) { | ||
this.email = _data["email"]; | ||
this.token = _data["token"]; | ||
} | ||
} | ||
static fromJS(data) { | ||
data = typeof data === 'object' ? data : {}; | ||
let result = new UnlockDTO(); | ||
result.init(data); | ||
return result; | ||
} | ||
toJSON(data) { | ||
data = typeof data === 'object' ? data : {}; | ||
data["email"] = this.email; | ||
data["token"] = this.token; | ||
return data; | ||
} | ||
} | ||
exports.UnlockDTO = UnlockDTO; | ||
class UserDTO { | ||
@@ -468,0 +559,0 @@ constructor(data) { |
{ | ||
"name": "@steffesgroup/steffes-auth", | ||
"version": "0.2.08", | ||
"version": "0.2.09", | ||
"description": "Steffes Auth", | ||
@@ -5,0 +5,0 @@ "main": "dist/api.js", |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
32435
822