@plusauth/plusauth-rest-js
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -0,1 +1,3 @@ | ||
# [0.5.0](https://github.com/PlusAuth/plusauth-rest-js/compare/v0.4.0...v0.5.0) (2021-05-05) | ||
# [0.4.0](https://github.com/PlusAuth/plusauth-rest-js/compare/v0.3.3...v0.4.0) (2021-04-12) | ||
@@ -2,0 +4,0 @@ |
@@ -0,1 +1,2 @@ | ||
import { ReadableStreamDefaultReader as ReadableStreamDefaultReader_2 } from 'cross-fetch/lib.fetch'; | ||
@@ -16,3 +17,3 @@ /** | ||
* ```js | ||
* const apis = apis.getAll() | ||
* const apis = await plusAuth.apis.getAll() | ||
* ``` | ||
@@ -48,6 +49,5 @@ * | ||
*/ | ||
create(api: IApi): Promise<IApi>; | ||
create(api: Omit<IApi, 'system'>): Promise<IApi>; | ||
/** | ||
* Update an existing API. | ||
* \> **NOTE:** `audience` is not updatable. | ||
* | ||
@@ -70,3 +70,3 @@ * @param apiId - Id of API to be updated | ||
*/ | ||
update(apiId: string, api: Partial<IApiPatch>): Promise<void>; | ||
update(apiId: string, api: Partial<Omit<IApi, 'system' | 'audience'>>): Promise<void>; | ||
/** | ||
@@ -88,3 +88,3 @@ * Remove an existing API | ||
* | ||
* @param apiId - API id to retrieve permissions of | ||
* @param apiId - ID of Api to retrieve permissions of | ||
* @param pagination - Object containing pagination options | ||
@@ -108,3 +108,3 @@ * | ||
* | ||
* @param apiId - API Id to create permission for | ||
* @param apiId - ID of Api to create permission for | ||
* @param permission - Object containing permission properties | ||
@@ -121,3 +121,3 @@ * | ||
* | ||
* @param apiId - API Id to remove permission from | ||
* @param apiId - ID of Api to remove permission from | ||
* @param permissionId - Permission Id to be removed | ||
@@ -133,8 +133,94 @@ * | ||
removePermission(apiId: string, permissionId: string): Promise<any>; | ||
getAuthorizedClients(apiId: string, pagination: IPagination): Promise<any>; | ||
authorizeClients(apiId: string, clientIds: string[]): Promise<any>; | ||
unAuthorizeClients(apiId: string, clientIds: string[]): Promise<any>; | ||
getAssignedPermissionsToClient(apiId: string, clientId: string): Promise<any>; | ||
assignPermissionsToClient(apiId: string, clientId: string, permissionIds: string[]): Promise<any>; | ||
unassignPermissionsFromClient(apiId: string, clientId: string, permissionIds: string[]): Promise<any>; | ||
/** | ||
* Retrieve authorized clients to the specified API | ||
* | ||
* @param apiId - ID of Api to retrieve authorized clients from | ||
* @param pagination - Object containing pagination options | ||
* | ||
* @example | ||
* Retrieve all authorized clients to the API | ||
* ```js | ||
* const authorizedClients = await plusAuth.apis.getAuthorizedClients('API_ID') | ||
* ``` | ||
* | ||
* @example | ||
* Retrieve first 5 permissions | ||
* ```js | ||
* const authorizedClients = await plusAuth.apis.getAuthorizedClients('API_ID', { itemsPerPage: 5}) | ||
* ``` | ||
*/ | ||
getAuthorizedClients(apiId: string, pagination: IPagination): Promise<PaginatedResult<IAuthorizedClients>>; | ||
/** | ||
* Authorize client/s to the specified API | ||
* | ||
* @param apiId - ID of Api to authorize client/s to | ||
* @param clientIds - IDs of to be authorized clients | ||
* | ||
* @example | ||
* ```js | ||
* if( await plusAuth.apis.authorizeClients('API_ID', ['CLIENT_1_ID', 'CLIENT_2_ID']) ){ | ||
* console.log('clients authorized') | ||
* } | ||
* ``` | ||
*/ | ||
authorizeClients(apiId: string, clientIds: string[]): Promise<void>; | ||
/** | ||
* Unauthorize client/s from the specified API | ||
* | ||
* @param apiId - ID of Api to unauthorize client/s from | ||
* @param clientIds - IDs of to be unauthorized clients | ||
* | ||
* @example | ||
* ```js | ||
* if( await plusAuth.apis.unAuthorizeClients('API_ID', ['CLIENT_1_ID', 'CLIENT_2_ID']) ){ | ||
* console.log('clients unauthorized') | ||
* } | ||
* ``` | ||
*/ | ||
unAuthorizeClients(apiId: string, clientIds: string[]): Promise<void>; | ||
/** | ||
* Retrieve authorized permissions of authorized client of the specified API | ||
* | ||
* @param apiId - ID of Api to retrieve authorized clients from | ||
* @param clientId - Authorized client id | ||
* | ||
* @example | ||
* ```js | ||
* const authorizedPermissions = await plusAuth.apis.getAssignedPermissionsToClient('API_ID', 'CLIENT_ID') | ||
* ``` | ||
* | ||
*/ | ||
getAssignedPermissionsToClient(apiId: string, clientId: string): Promise<string[]>; | ||
/** | ||
* Authorize permission/s to an authorized client of the specified API | ||
* | ||
* @param apiId - ID of Api to retrieve authorized clients from | ||
* @param clientId - Authorized client id | ||
* @param permissionIds - Permissions ID array to be authorized | ||
* | ||
* @example | ||
* ```js | ||
* if( await plusAuth.apis.assignPermissionsToClient('API_ID', 'CLIENT_ID', ['perm_id_1', 'perm_id_2']) ){ | ||
* console.log('permissions authorized for client') | ||
* } | ||
* ``` | ||
* | ||
*/ | ||
assignPermissionsToClient(apiId: string, clientId: string, permissionIds: string[]): Promise<void>; | ||
/** | ||
* Unauthorize permission/s from an authorized client of the specified API | ||
* | ||
* @param apiId - ID of Api to retrieve authorized clients from | ||
* @param clientId - Authorized client id | ||
* @param permissionIds - Permissions ID array to be authorized | ||
* | ||
* @example | ||
* ```js | ||
* if( await plusAuth.apis.assignPermissionsToClient('API_ID', 'CLIENT_ID', ['perm_id_1', 'perm_id_2']) ){ | ||
* console.log('permissions unauthorized from client') | ||
* } | ||
* ``` | ||
* | ||
*/ | ||
unassignPermissionsFromClient(apiId: string, clientId: string, permissionIds: string[]): Promise<void>; | ||
} | ||
@@ -199,3 +285,3 @@ | ||
*/ | ||
create(clientObject: Partial<IClient>): Promise<any>; | ||
create(clientObject: Partial<IClient>): Promise<IClient>; | ||
/** | ||
@@ -236,10 +322,73 @@ * Update an existing client | ||
/** | ||
* Service for interacting custom domains for your tenant. | ||
*/ | ||
declare class CustomDomainService extends HttpService { | ||
protected static prefix: string; | ||
getAll(pagination: IPagination): Promise<any>; | ||
get(customDomainId: string): Promise<any>; | ||
create(props: any): Promise<any>; | ||
update(customDomainId: string, props: any): Promise<any>; | ||
remove(customDomainId: string): Promise<any>; | ||
validate(customDomainId: string): Promise<any>; | ||
/** | ||
* Retrieve or filter created custom domains. | ||
* | ||
* @param pagination - Object containing pagination options | ||
* | ||
* @example | ||
* Retrieve all Custom Domains | ||
* ```js | ||
* const customDomains = plusAuth.customDomains.getAll() | ||
* ``` | ||
* | ||
* @example | ||
* Retrieve first 5 Custom Domains | ||
* ```js | ||
* const customDomains = await plusAuth.customDomains.getAll({ itemsPerPage: 5 }) | ||
* ``` | ||
*/ | ||
getAll(pagination: IPagination): Promise<PaginatedResult<ICustomDomain>>; | ||
/** | ||
* Get Custom Domain with id | ||
* | ||
* @param customDomainId - Custom Domain id | ||
* | ||
* @example | ||
* ```js | ||
* const customDomain = await plusAuth.customDomains.get('CUSTOM_DOMAIN_ID') | ||
* ``` | ||
*/ | ||
get(customDomainId: string): Promise<ICustomDomain>; | ||
/** | ||
* Create a custom domain entry | ||
* | ||
* @param customDomain - Object containing custom domain properties | ||
* | ||
* @example | ||
* ```js | ||
* const customDomain = await plusAuth.customDomains.create({ domain: 'myexamplesite.com' }) | ||
* ``` | ||
*/ | ||
create(customDomain: Omit<ICustomDomain, 'validated'>): Promise<ICustomDomain>; | ||
/** | ||
* Remove a custom domain entry | ||
* | ||
* @param customDomainId - Custom Domain Id to be removed | ||
* | ||
* @example | ||
* ```js | ||
* if( await plusAuth.customDomains.remove('CUSTOM_DOMAIN_ID') ){ | ||
* console.log('custom domain removed') | ||
* } | ||
* ``` | ||
*/ | ||
remove(customDomainId: string): Promise<void>; | ||
/** | ||
* Trigger validation of custom domain ownership | ||
* | ||
* @param customDomainId - Custom Domain Id to be validated | ||
* | ||
* @example | ||
* ```js | ||
* if( await plusAuth.customDomains.validate('CUSTOM_DOMAIN_ID') ){ | ||
* console.log('custom domain ownership validated') | ||
* } | ||
* ``` | ||
*/ | ||
validate(customDomainId: string): Promise<void>; | ||
} | ||
@@ -386,3 +535,3 @@ | ||
* ```js | ||
* const hook = await plusAuth.hooks.get('hook_ID') | ||
* const hook = await plusAuth.hooks.get('HOOK_ID') | ||
* ``` | ||
@@ -408,3 +557,3 @@ */ | ||
* ```js | ||
* const updatedHook = await plusAuth.hooks.update('hook_ID', { name: 'updatedName' }) | ||
* const updatedHook = await plusAuth.hooks.update('HOOK_ID', { name: 'updatedName' }) | ||
* ``` | ||
@@ -420,3 +569,3 @@ */ | ||
* ```js | ||
* if( await plusAuth.hooks.remove('hook_ID') ){ | ||
* if( await plusAuth.hooks.remove('HOOK_ID') ){ | ||
* console.log('hook removed') | ||
@@ -452,3 +601,4 @@ * } | ||
*/ | ||
addPackages(hookId: string, packages: HookPackage[], stream?: boolean): Promise<any>; | ||
addPackages(hookId: string, packages: HookPackage[], stream: true): Promise<ReadableStreamDefaultReader_2>; | ||
addPackages(hookId: string, packages: HookPackage[], stream: false | undefined): Promise<string>; | ||
/** | ||
@@ -479,3 +629,4 @@ * Remove packages from the hook | ||
*/ | ||
deletePackages(hookId: string, packages: HookPackage[], stream?: boolean): Promise<any>; | ||
deletePackages(hookId: string, packages: HookPackage[], stream: true): Promise<ReadableStreamDefaultReader_2>; | ||
deletePackages(hookId: string, packages: HookPackage[], stream: false | undefined): Promise<string>; | ||
} | ||
@@ -523,4 +674,4 @@ | ||
description?: string; | ||
audience?: string; | ||
system?: boolean; | ||
readonly audience?: string; | ||
readonly system?: boolean; | ||
} | ||
@@ -531,5 +682,5 @@ | ||
*/ | ||
export declare interface IApiPatch { | ||
name?: string; | ||
description?: string; | ||
export declare interface IAuthorizedClients { | ||
client_id: string; | ||
permissions: string[]; | ||
} | ||
@@ -554,3 +705,18 @@ | ||
declare interface IEmailProviderSettings { | ||
/** | ||
* @public | ||
*/ | ||
export declare interface ICustomDomain { | ||
domain: string; | ||
readonly validated: boolean; | ||
verification_values?: { | ||
type: 'CNAME' | 'TXT'; | ||
value: string; | ||
}[]; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare interface IEmailProviderSettings { | ||
provider: EmailProvider; | ||
@@ -578,2 +744,27 @@ settings: Record<string, string>; | ||
*/ | ||
export declare interface ILogQuery { | ||
from?: string; | ||
to?: string; | ||
type?: ('error' | 'warning' | 'info')[]; | ||
operation?: string[]; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare interface IMfa extends IMFASettings { | ||
type: MFAType; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare interface IMFASettings { | ||
enabled?: boolean; | ||
settings?: Record<string, any>; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare interface IPagination { | ||
@@ -583,2 +774,3 @@ page?: number; | ||
sortBy?: string; | ||
q?: string; | ||
sortDesc?: boolean; | ||
@@ -599,2 +791,17 @@ } | ||
*/ | ||
export declare interface IRbac { | ||
role_groups: (IRoleGroup & { | ||
roles: (IRole & { | ||
permissions: IPermission[]; | ||
})[]; | ||
})[]; | ||
roles: (IRole & { | ||
permissions: IPermission[]; | ||
})[]; | ||
permissions: IPermission[]; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare interface IRole { | ||
@@ -615,3 +822,6 @@ name: string; | ||
declare interface ISMSProviderSettings { | ||
/** | ||
* @public | ||
*/ | ||
export declare interface ISMSProviderSettings { | ||
provider: SMSProvider; | ||
@@ -624,2 +834,17 @@ settings: Record<string, string>; | ||
*/ | ||
export declare interface IStats { | ||
usage: { | ||
date: string; | ||
data: { | ||
new_user: number; | ||
active_user: number; | ||
}; | ||
}[]; | ||
totalUsers: number; | ||
totalHooks: number; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare interface ITemplate { | ||
@@ -646,2 +871,11 @@ readonly name: EmailTemplate; | ||
*/ | ||
export declare interface ITenantAdministrator { | ||
email: string; | ||
owner: boolean; | ||
inviteAccepted: boolean; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare interface ITenantSettings { | ||
@@ -751,2 +985,25 @@ tokenEndpointAuthMethods?: string[]; | ||
*/ | ||
export declare interface IUserSession { | ||
id: string; | ||
ip: string; | ||
ua: string; | ||
exp: number; | ||
created_at: number; | ||
last_activity: number; | ||
location?: { | ||
city: string; | ||
country: string; | ||
postal_code: string; | ||
pos?: { | ||
latitude: number; | ||
longitude: number; | ||
accuracy_radius: number; | ||
time_zone: string; | ||
}; | ||
}; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare interface IView { | ||
@@ -758,3 +1015,3 @@ type: ViewTemplate; | ||
/** | ||
* Service for interacting with API's defined in PlusAuth | ||
* Service for interacting with signing and encryption keys of your tenant in PlusAuth | ||
* @public | ||
@@ -764,7 +1021,89 @@ */ | ||
protected static prefix: string; | ||
/** | ||
* Retrieve signing keys of your tenant. | ||
* | ||
* @example | ||
* ```js | ||
* const signingKeys = await plusAuth.keys.getSigningKeys() | ||
* ``` | ||
*/ | ||
getSigningKeys(): Promise<JsonWebKey[]>; | ||
/** | ||
* Rotate your signing keys. If keys are not provided, | ||
* a new key will be auto generated for each key type and algorithm in current key set. | ||
* | ||
* @example | ||
* ```js | ||
* Let PlusAuth generate new keys | ||
* if(await plusAuth.keys.rotateSigningKeys()){ | ||
* console.log('signing keys rotated') | ||
* } | ||
* ``` | ||
* | ||
* @example | ||
* With your own key set | ||
* ```js | ||
* const keys = generateJWKS() // implement this according to your needs | ||
* if(await plusAuth.keys.rotateSigningKeys(keys)){ | ||
* console.log('signing keys rotated') | ||
* } | ||
* ``` | ||
*/ | ||
rotateSigningKeys(keys?: JsonWebKey[]): Promise<void>; | ||
/** | ||
* Revoke an existing signing key in your tenant's signing key set. | ||
* | ||
* @param kid - Key's id to be revoked | ||
* | ||
* @example | ||
* ```js | ||
* if(await plusAuth.keys.revokeSigningKey('KEY_ID')){ | ||
* console.log('signing key revoked') | ||
* } | ||
* ``` | ||
*/ | ||
revokeSigningKey(kid: string): Promise<void>; | ||
/** | ||
* Retrieve encryption keys of your tenant. | ||
* | ||
* @example | ||
* ```js | ||
* const encryptionKeys = await plusAuth.keys.getEncryptionKeys() | ||
* ``` | ||
*/ | ||
getEncryptionKeys(): Promise<JsonWebKey[]>; | ||
/** | ||
* Rotate your encryption keys. If keys are not provided, | ||
* a new key will be auto generated for each key type and algorithm in current key set. | ||
* | ||
* @example | ||
* ```js | ||
* Let PlusAuth generate new keys | ||
* if(await plusAuth.keys.rotateEncryptionKeys()){ | ||
* console.log('signing keys rotated') | ||
* } | ||
* ``` | ||
* | ||
* @example | ||
* With your own key set | ||
* ```js | ||
* const keys = generateJWKS() // implement this according to your needs | ||
* if(await plusAuth.keys.rotateEncryptionKeys(keys)){ | ||
* console.log('encryption keys rotated') | ||
* } | ||
* ``` | ||
*/ | ||
rotateEncryptionKeys(keys?: JsonWebKey[]): Promise<void>; | ||
/** | ||
* Revoke an existing encryption key in your tenant's encryption key set. | ||
* | ||
* @param kid - Key's id to be revoked | ||
* | ||
* @example | ||
* ```js | ||
* if(await plusAuth.keys.revokeEncryptionKey('KEY_ID')){ | ||
* console.log('encryption key revoked') | ||
* } | ||
* ``` | ||
*/ | ||
revokeEncryptionKey(kid: string): Promise<void>; | ||
@@ -775,3 +1114,13 @@ } | ||
protected static prefix: string; | ||
getAll(pagination: IPagination, query: string | Record<string, string | number | boolean>): Promise<any>; | ||
/** | ||
* Retrieve or filter your tenant's logs. | ||
* | ||
* @param query - Log query parameters | ||
* | ||
* @example | ||
* ```js | ||
* const logs = await plusAuth.logs.getAll({ from: 'now-1d', type: 'error,warn'}) | ||
* ``` | ||
*/ | ||
getAll(query: ILogQuery): Promise<string | Record<string, any>>; | ||
} | ||
@@ -785,5 +1134,32 @@ | ||
protected static prefix: string; | ||
getAll(): Promise<any>; | ||
get(type: MFAType): Promise<any>; | ||
update(type: MFAType, props: any): Promise<any>; | ||
/** | ||
* Get MFA settings | ||
* | ||
* @example | ||
* ```js | ||
* const settings = await plusAuth.mfa.getAll() | ||
* ``` | ||
*/ | ||
getAll(): Promise<Record<MFAType, IMfa>>; | ||
/** | ||
* Get specific MFA settings | ||
* | ||
* @param type - MFA type | ||
* @example | ||
* ```js | ||
* const smsSettings = await plusAuth.mfa.get(MFAType.SMS) | ||
* ``` | ||
*/ | ||
get(type: MFAType): Promise<IMfa>; | ||
/** | ||
* Update specific MFA settings | ||
* | ||
* @param type - MFA type | ||
* @param mfaProps - Updated properties | ||
* @example | ||
* ```js | ||
* const newSmsSettings = await plusAuth.mfa.update(MFAType.SMS, { enabled: false }) | ||
* ``` | ||
*/ | ||
update(type: MFAType, mfaProps: IMFASettings): Promise<IMfa>; | ||
} | ||
@@ -877,3 +1253,3 @@ | ||
/** | ||
* Retrieve or filter created roleGroups. | ||
* Retrieve or filter created role groups. | ||
* | ||
@@ -883,3 +1259,3 @@ * @param pagination - Object containing pagination options | ||
* @example | ||
* Retrieve all RoleGroups | ||
* Retrieve all role groups | ||
* ```js | ||
@@ -890,3 +1266,3 @@ * const roleGroups = roleGroups.getAll() | ||
* @example | ||
* Retrieve first 5 roleGroups | ||
* Retrieve first 5 role groups | ||
* ```js | ||
@@ -898,5 +1274,5 @@ * const roleGroups = await plusAuth.roleGroups.getAll({ itemsPerPage: 5 }) | ||
/** | ||
* Get roleGroup with id | ||
* Get role group with id | ||
* | ||
* @param roleGroupId - RoleGroup id | ||
* @param roleGroupId - Role group id | ||
* | ||
@@ -910,4 +1286,4 @@ * @example | ||
/** | ||
* Create a roleGroup | ||
* @param roleGroupObject - RoleGroup object | ||
* Create a role group | ||
* @param roleGroupObject - Role group object | ||
* | ||
@@ -921,5 +1297,5 @@ * @example | ||
/** | ||
* Update an existing roleGroup | ||
* Update an existing role group | ||
* | ||
* @param roleGroupId - Id of roleGroup to be updated | ||
* @param roleGroupId - Id of role group to be updated | ||
* @param roleGroup - Object containing to be updated field with values | ||
@@ -933,5 +1309,5 @@ * @example | ||
/** | ||
* Remove an existing roleGroup | ||
* Remove an existing role group | ||
* | ||
* @param roleGroupId - RoleGroup Id to be removed | ||
* @param roleGroupId - Role group Id to be removed | ||
* | ||
@@ -947,5 +1323,5 @@ * @example | ||
/** | ||
* Retrieve roles assigned to the specified Role Group | ||
* Retrieve roles assigned to the specified role group | ||
* | ||
* @param roleGroupId - Role Group id to retrieve assigned roles of | ||
* @param roleGroupId - Role group id to retrieve assigned roles of | ||
* @param pagination - Object containing pagination options | ||
@@ -956,9 +1332,9 @@ * | ||
* ```js | ||
* const permissions = await plusAuth.roleGroups.getRoles('ROLE_GROUP_ID') | ||
* const roles = await plusAuth.roleGroups.getRoles('ROLE_GROUP_ID') | ||
* ``` | ||
* | ||
* @example | ||
* Retrieve first 5 roles | ||
* Retrieve first 5 assigned roles | ||
* ```js | ||
* const permissions = await plusAuth.apis.getRoles('ROLE_GROUP_ID', \{ itemsPerPage: 5 \}) | ||
* const roles = await plusAuth.roleGroups.getRoles('ROLE_GROUP_ID', { itemsPerPage: 5 }) | ||
* ``` | ||
@@ -970,3 +1346,3 @@ */ | ||
* | ||
* @param roleGroupId - Role Group id for assigning roles to | ||
* @param roleGroupId - Role group id for assigning roles to | ||
* @param roleIDs - Array containing role id's to be assigned | ||
@@ -981,7 +1357,7 @@ * | ||
*/ | ||
assignRoles(roleGroupId: string, roleIDs: string[]): Promise<any>; | ||
assignRoles(roleGroupId: string, roleIDs: string[]): Promise<void>; | ||
/** | ||
* Unassign roles from a role group | ||
* | ||
* @param roleGroupId - Role Group id for unassigning roles from | ||
* @param roleGroupId - Role group id for unassigning roles from | ||
* @param roleIDs - Array containing role id's to be unassigned | ||
@@ -996,3 +1372,3 @@ * | ||
*/ | ||
unAssignRoles(roleGroupId: string, roleIDs: string[]): Promise<any>; | ||
unAssignRoles(roleGroupId: string, roleIDs: string[]): Promise<void>; | ||
} | ||
@@ -1007,10 +1383,112 @@ | ||
protected static prefix: string; | ||
/** | ||
* Retrieve or filter created roles. | ||
* | ||
* @param pagination - Object containing pagination options | ||
* | ||
* @example | ||
* Retrieve all roles | ||
* ```js | ||
* const roles = plusAuth.roles.getAll() | ||
* ``` | ||
* | ||
* @example | ||
* Retrieve first 5 roles | ||
* ```js | ||
* const roles = await plusAuth.roles.getAll({ itemsPerPage: 5 }) | ||
* ``` | ||
*/ | ||
getAll(pagination?: IPagination): Promise<PaginatedResult<IRole>>; | ||
/** | ||
* Get role with id | ||
* | ||
* @param roleId - Role id | ||
* | ||
* @example | ||
* ```js | ||
* const role = await plusAuth.roles.get('ROLE_GROUP_ID') | ||
* ``` | ||
*/ | ||
get(roleId: string): Promise<IRole>; | ||
/** | ||
* Create a role | ||
* @param role - Role object | ||
* | ||
* @example | ||
* ```js | ||
* const role = await plusAuth.roles.create({ name: 'My Role' }) | ||
* ``` | ||
*/ | ||
create(role: IRole): Promise<IRole>; | ||
/** | ||
* Update an existing role | ||
* | ||
* @param roleId - Id of role to be updated | ||
* @param role - Object containing to be updated field with values | ||
* @example | ||
* ```js | ||
* const updatedRole = await plusAuth.roles.update('ROLE_ID', { description: 'updatedDescription' }) | ||
* ``` | ||
*/ | ||
update(roleId: string, role: Partial<IRole>): Promise<void>; | ||
/** | ||
* Remove an existing role | ||
* | ||
* @param roleId - Role Id to be removed | ||
* | ||
* @example | ||
* ```js | ||
* if( await plusAuth.roles.remove('ROLE_ID') ){ | ||
* console.log('role removed') | ||
* } | ||
* ``` | ||
*/ | ||
remove(roleId: string): Promise<void>; | ||
/** | ||
* Retrieve permissions assigned to the specified Role | ||
* | ||
* @param roleId - Role id to retrieve assigned roles of | ||
* @param pagination - Object containing pagination options | ||
* | ||
* @example | ||
* Retrieve all permissions assigned to the role | ||
* ```js | ||
* const permissions = await plusAuth.roles.getPermissions('ROLE_ID') | ||
* ``` | ||
* | ||
* @example | ||
* Retrieve first 5 assigned permissions | ||
* ```js | ||
* const permissions = await plusAuth.roles.getPermissions('ROLE_ID', { itemsPerPage: 5 }) | ||
* ``` | ||
*/ | ||
getPermissions(roleId: string, pagination: IPagination): Promise<PaginatedResult<IPermission>>; | ||
assignPermissions(roleId: string, permissionIDs: string[]): Promise<any>; | ||
unAssignPermissions(roleId: string, permissionIDs: string[]): Promise<any>; | ||
/** | ||
* Assign permissions to a role | ||
* | ||
* @param roleId - Role id for assigning permissions to | ||
* @param permissionIDs - Array containing permission id's to be assigned | ||
* | ||
* @example | ||
* ```js | ||
* if ( await plusAuth.roles.assignPermissions('ROLE_GROUP_ID', [ 'PERMISSION_ID_1', 'PERMISSION_ID_2'] ) ){ | ||
* console.log('permissions are assigned') | ||
* } | ||
* ``` | ||
*/ | ||
assignPermissions(roleId: string, permissionIDs: string[]): Promise<void>; | ||
/** | ||
* Unassign permissions from a role | ||
* | ||
* @param roleId - Role Group id for unassigning permissions from | ||
* @param permissionIDs - Array containing permission id's to be unassigned | ||
* | ||
* @example | ||
* ```js | ||
* if ( await plusAuth.roles.unAssignPermissions('ROLE_GROUP_ID', [ 'PERMISSION_ID_2'] ) ){ | ||
* console.log('permissions are unassigned') | ||
* } | ||
* ``` | ||
*/ | ||
unAssignPermissions(roleId: string, permissionIDs: string[]): Promise<void>; | ||
} | ||
@@ -1117,6 +1595,6 @@ | ||
* @example | ||
* Create in 'eu' region. | ||
* Create in 'tr' region. | ||
* | ||
* ```js | ||
* const createdTenant = await plusAuth.tenants.create({ tenant_id: 'myuniquetenantid', region: 'eu' }) | ||
* const createdTenant = await plusAuth.tenants.create({ tenant_id: 'myuniquetenantid', region: 'tr' }) | ||
* ``` | ||
@@ -1161,9 +1639,115 @@ */ | ||
updateSettings(tenantId: string, settings: Partial<ITenantSettings>): Promise<ITenant>; | ||
inviteAdmin(tenantId: string, email: string): Promise<any>; | ||
getAdministrators(tenantId: string): Promise<any>; | ||
removeAdministrator(tenantId: string, email: string): Promise<any>; | ||
getStats(tenantId: string, pagination?: IPagination): Promise<any>; | ||
/** | ||
* Send admin invitation to an email. | ||
* | ||
* @param tenantId - Tenant to invite the admin | ||
* @param email - Email of invitation recipient | ||
* | ||
* @example | ||
* ```js | ||
* if(await plusAuth.tenants.inviteAdmin('TENANT_ID', 'john@doe.com' )){ | ||
* console.log('invitation sent') | ||
* } | ||
* ``` | ||
*/ | ||
inviteAdmin(tenantId: string, email: string): Promise<void>; | ||
/** | ||
* Retrieve administrators of tenant including all invited ones. | ||
* | ||
* @param tenantId - Id of the tenant | ||
* | ||
* @example | ||
* ```js | ||
* const administrators = await plusAuth.tenants.getAdministrators('TENANT_ID') | ||
* ``` | ||
*/ | ||
getAdministrators(tenantId: string): Promise<ITenantAdministrator>; | ||
/** | ||
* Remove and administrator from your tenant | ||
* | ||
* @param tenantId - Tenant to invite the admin | ||
* @param email - Email of administrator | ||
* | ||
* @example | ||
* ```js | ||
* if(await plusAuth.tenants.removeAdministrator('TENANT_ID', 'john@doe.com' )){ | ||
* console.log('administrator removed') | ||
* } | ||
* ``` | ||
*/ | ||
removeAdministrator(tenantId: string, email: string): Promise<void>; | ||
/** | ||
* Retrieve usage stats of tenant | ||
* | ||
* @param tenantId - Id of the tenant | ||
* @param queryOptions - Additional filters | ||
* | ||
* @example | ||
* ```js | ||
* const stats = await plusAuth.tenants.getStats('TENANT_ID') | ||
* ``` | ||
*/ | ||
getStats(tenantId: string, queryOptions?: Pick<IPagination, 'q'>): Promise<IStats>; | ||
/** | ||
* Retrieve SMS provider settings | ||
* | ||
* @param tenantId - Your tenant ID | ||
* @param provider - If necessary, specific provider type | ||
* | ||
* @example | ||
* ```js | ||
* const smsProviderSettings = await plusAuth.tenants.getSMSProviderSettings('MY_TENANT_ID') | ||
* ``` | ||
*/ | ||
getSMSProviderSettings(tenantId: string, provider?: SMSProvider): Promise<ISMSProviderSettings>; | ||
/** | ||
* Update SMS provider settings | ||
* | ||
* @param tenantId - Your tenant ID | ||
* @param settings - SMS Provider settings | ||
* | ||
* @example | ||
* ```js | ||
* if(await plusAuth.tenants.updateSMSProviderSettings('MY_TENANT_ID', { | ||
* provider: SMSProvider.MESSAGEBIRD, | ||
* settings: { | ||
* apiKey: 'MESSAGE_BIRD_API_KEY', | ||
* originator: 'MESSAGE_BIRD_ORIGINATOR' | ||
* } | ||
* })){ | ||
* console.log('sms provider settings updated') | ||
* } | ||
* ``` | ||
*/ | ||
updateSMSProviderSettings(tenantId: string, settings: ISMSProviderSettings): Promise<ISMSProviderSettings>; | ||
/** | ||
* Retrieve Email provider settings | ||
* | ||
* @param tenantId - Your tenant ID | ||
* @param provider - If necessary, specific provider type | ||
* | ||
* @example | ||
* ```js | ||
* const emailProviderSettings = await plusAuth.tenants.getEmailProviderSettings('MY_TENANT_ID') | ||
* ``` | ||
*/ | ||
getEmailProviderSettings(tenantId: string, provider?: EmailProvider): Promise<IEmailProviderSettings>; | ||
/** | ||
* Update Email provider settings | ||
* | ||
* @param tenantId - Your tenant ID | ||
* @param settings - SMS Provider settings | ||
* | ||
* @example | ||
* ```js | ||
* if(await plusAuth.tenants.updateEmailProviderSettings('MY_TENANT_ID', { | ||
* provider: EmailProvider.SENDGRID, | ||
* settings: { | ||
* api_key: 'SENDGRID_API_KEY', | ||
* } | ||
* })){ | ||
* console.log('email provider settings updated') | ||
* } | ||
* ``` | ||
*/ | ||
updateEmailProviderSettings(tenantId: string, settings: IEmailProviderSettings): Promise<IEmailProviderSettings>; | ||
@@ -1181,7 +1765,7 @@ } | ||
get(userId: string): Promise<IUser>; | ||
getSessions(userId: string): Promise<any>; | ||
endSession(userId: string, sessionId: string): Promise<any>; | ||
create(userObject: Partial<IUser>): Promise<IUser>; | ||
remove(userId: string): Promise<void>; | ||
update(userId: string, user: Partial<IUser>): Promise<IUser>; | ||
getSessions(userId: string): Promise<IUserSession[]>; | ||
endSession(userId: string, sessionId: string): Promise<void>; | ||
getTenants(userId: string): Promise<ITenant>; | ||
@@ -1197,3 +1781,3 @@ getRoleGroups(userId: string): Promise<IRoleGroup>; | ||
unAssignPermissions(userId: string, permissionIDs: string[]): Promise<void>; | ||
getRBAC(userId: string): Promise<any>; | ||
getRBAC(userId: string): Promise<IRbac>; | ||
} | ||
@@ -1200,0 +1784,0 @@ |
@@ -1,2 +0,2 @@ | ||
var PlusAuthRestClient=function(){"use strict";function t(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function u(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,u)}h((i=i.apply(t,e||[])).next())}))}var e=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&!function(t){var e=Object.prototype.toString.call(t);return"[object RegExp]"===e||"[object Date]"===e||function(t){return t.$$typeof===r}(t)}(t)};var r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(t,e){return!1!==e.clone&&e.isMergeableObject(t)?h((r=t,Array.isArray(r)?[]:{}),t,e):t;var r}function n(t,e,r){return t.concat(e).map((function(t){return i(t,r)}))}function o(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(e){return t.propertyIsEnumerable(e)})):[]}(t))}function s(t,e){try{return e in t}catch(t){return!1}}function u(t,e,r){var n={};return r.isMergeableObject(t)&&o(t).forEach((function(e){n[e]=i(t[e],r)})),o(e).forEach((function(o){(function(t,e){return s(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,o)||(s(t,o)&&r.isMergeableObject(e[o])?n[o]=function(t,e){if(!e.customMerge)return h;var r=e.customMerge(t);return"function"==typeof r?r:h}(o,r)(t[o],e[o],r):n[o]=i(e[o],r))})),n}function h(t,r,o){(o=o||{}).arrayMerge=o.arrayMerge||n,o.isMergeableObject=o.isMergeableObject||e,o.cloneUnlessOtherwiseSpecified=i;var s=Array.isArray(r);return s===Array.isArray(t)?s?o.arrayMerge(t,r,o):u(t,r,o):i(r,o)}h.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce((function(t,r){return h(t,r,e)}),{})};var d,a=h,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}const f=p((function(t,e){var r="undefined"!=typeof self?self:c,i=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,n="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function d(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function v(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&n&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||h(t))?this._bodyArrayBuffer=y(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var t,e,r,i=f(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=l(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then($)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(t,e){t=d(t),e=a(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},p.prototype.delete=function(t){delete this.map[d(t)]},p.prototype.get=function(t){return t=d(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(d(t))},p.prototype.set=function(t,e){this.map[d(t)]=a(e)},p.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},p.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},p.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},p.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},i&&(p.prototype[Symbol.iterator]=p.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(t,e){var r,i,n=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new p(e.headers)),this.method=(r=e.method||this.method||"GET",i=r.toUpperCase(),b.indexOf(i)>-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function $(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},g.call(m.prototype),g.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];w.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function A(t,r){return new Promise((function(i,o){var s=new m(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function h(){u.abort()}u.onload=function(){var t,e,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();e.append(i,n)}})),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var n="response"in u?u.response:u.responseText;i(new w(n,r))},u.onerror=function(){o(new TypeError("Network request failed"))},u.ontimeout=function(){o(new TypeError("Network request failed"))},u.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},u.open(s.method,s.url,!0),"include"===s.credentials?u.withCredentials=!0:"omit"===s.credentials&&(u.withCredentials=!1),"responseType"in u&&n&&(u.responseType="blob"),s.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",h),u.onreadystatechange=function(){4===u.readyState&&s.signal.removeEventListener("abort",h)}),u.send(void 0===s._bodyInit?null:s._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=p,t.Request=m,t.Response=w),e.Headers=p,e.Request=m,e.Response=w,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var n=i;(e=n.fetch).default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,t.exports=e}(d={exports:{}},d.exports),d.exports));function l(e,r){var i;return t(this,void 0,void 0,(function*(){const t=e.headers.get("content-type");return"stream"===r.responseType?null===(i=e.body)||void 0===i?void 0:i.getReader():"json"===r.responseType||t&&t.indexOf("application/json")>-1?yield e.json():yield e.text()}))}function v(t,e){return new Promise((function(r,i){f(t,e).then((t=>{const n=t.clone();t.ok?l(n,e).then(r).catch(i):400===t.status?l(n,e).then((t=>{if("xhr_request"===t.error&&t.location)return window.location.replace(t.location),!1;i(t)})).catch(i):l(n,e).then(i).catch(i)})).catch(i)}))}class y{constructor(t,e={}){if(!t)throw new Error("'apiURL' must be provided");try{new URL(t)}catch(t){throw new Error("'apiUrl' must be a valid uri")}if("object"!=typeof e)throw new Error("'options' must be an object");if(e.httpClient&&"function"!=typeof e.httpClient)throw new Error('"httpClient" must be function');const r=t+(/\/api\/v\d(\/)?$/.test(t)?"":(t.endsWith("/")?"":"/")+"api/v1")+this.constructor.prefix,i=e.httpClient||v,n={};["get","post","patch","delete"].forEach((t=>{n[t]=function(...n){let o;o=e&&"function"==typeof e.token?e.token.call(void 0):e.token;let s={method:t.toUpperCase(),mode:"cors",headers:Object.assign({Accept:"application/json","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},o?{Authorization:`Bearer ${o}`}:{})};return n.length>1&&"get"!==t&&(s.body="object"==typeof n[1]?JSON.stringify(n[1]):n[1]),n[2]&&"object"==typeof n[2]&&(s=a(s,n[2])),i.call(null,r+n[0],s)}})),this._baseUrl=r,this.http=n}}function g(t,e=!0){if(!t)return"";const r=[];for(const e in t)null!=t[e]&&r.push(`${encodeURIComponent(e)}=${t[e].toString()}`);return e?`?${r.join("&")}`:r.join("&")}y.prefix="";class b extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}getPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/permissions${g(r)}`)}))}createPermission(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/permissions`,r)}))}removePermission(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/permissions/${r}`)}))}getAuthorizedClients(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/authorized_clients${g(r)}`)}))}authorizeClients(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/authorized_clients`,r)}))}unAuthorizeClients(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/authorized_clients`,r)}))}getAssignedPermissionsToClient(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/authorized_clients/${r}/permissions`)}))}assignPermissionsToClient(e,r,i){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/authorized_clients/${r}/permissions`,i)}))}unassignPermissionsFromClient(e,r,i){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/authorized_clients/${r}/permissions`,i)}))}}b.prefix="/apis";class m extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}}m.prefix="/clients";class $ extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}validate(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/validate`)}))}}$.prefix="/custom-domain";class w extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}}w.prefix="/federated";class x extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(`${g(e)}`)}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(""+(e?`/${e}`:""),r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}addPackages(e,r,i=!1){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/packages`,r,{responseType:i?"stream":void 0})}))}deletePackages(e,r,i=!1){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/packages`,r,{responseType:i?"stream":void 0})}))}}x.prefix="/hooks";class A extends y{getSigningKeys(){return t(this,void 0,void 0,(function*(){return this.http.get("/signing")}))}rotateSigningKeys(e){return t(this,void 0,void 0,(function*(){return this.http.post("/signing/rotate",{keys:e})}))}revokeSigningKey(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/signing/revoke/${e}`)}))}getEncryptionKeys(){return t(this,void 0,void 0,(function*(){return this.http.get("/encryption")}))}rotateEncryptionKeys(e){return t(this,void 0,void 0,(function*(){return this.http.post("/encryption/rotate",{keys:e})}))}revokeEncryptionKey(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/encryption/revoke/${e}`)}))}}A.prefix="/keys";class E extends y{getAll(e,r){return t(this,void 0,void 0,(function*(){return r&&"object"==typeof r&&(r=JSON.stringify(r)),this.http.get(g(Object.assign(Object.assign({},e),{query:r})))}))}}E.prefix="/logs";class O extends y{getAll(){return t(this,void 0,void 0,(function*(){return this.http.get("")}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}}O.prefix="/mfa";class P extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}getRoles(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/roles${g(r)}`)}))}assignRoles(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/roles`,r)}))}unAssignRoles(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/roles`,r)}))}}P.prefix="/roleGroups";class _ extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}getPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/permissions${g(r)}`)}))}assignPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/permissions`,r)}))}unAssignPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/permissions`,r)}))}}_.prefix="/roles";class j extends y{get(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/${r}`)}))}update(e,r,i){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}/${r}`,i)}))}}j.prefix="/templates";class T extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(`${g(e)}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e,{headers:{"X-PlusAuth-Tenant":"api"}})}))}delete(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}getSettings(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/settings`)}))}updateSettings(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}/settings`,r)}))}inviteAdmin(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/invite`,{email:r})}))}getAdministrators(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/administrators`)}))}removeAdministrator(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/administrators/${r}`)}))}getStats(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/stats${g(r)}`)}))}getSMSProviderSettings(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/provider/sms${r?`/${r}`:""}`)}))}updateSMSProviderSettings(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}/provider/sms`,r)}))}getEmailProviderSettings(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/provider/email${r?`/${r}`:""}`)}))}updateEmailProviderSettings(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}/provider/email`,r)}))}}T.prefix="/tenants";class S extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}getSessions(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/session`)}))}endSession(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/session/${r}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}getTenants(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/tenants`)}))}getRoleGroups(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/roleGroups`)}))}assignRoleGroups(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/roleGroups`,r)}))}unAssignRoleGroups(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/roleGroups`,r)}))}getRoles(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/roles`)}))}assignRoles(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/roles`,r)}))}unAssignRoles(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/roles`,r)}))}getPermissions(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/permissions`)}))}assignPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/permissions`,r)}))}unAssignPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/permissions`,r)}))}getRBAC(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/rbac`)}))}}S.prefix="/users";class R extends y{get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r,{headers:{"Content-Type":"text/plain"}})}))}}R.prefix="/views";return class{constructor(t,e={}){this.options=e,this.apis=new b(t,this.options),this.clients=new m(t,this.options),this.customDomains=new $(t,this.options),this.federated=new w(t,this.options),this.hooks=new x(t,this.options),this.keys=new A(t,this.options),this.logs=new E(t,this.options),this.mfa=new O(t,this.options),this.roleGroups=new P(t,this.options),this.roles=new _(t,this.options),this.templates=new j(t,this.options),this.tenants=new T(t,this.options),this.users=new S(t,this.options),this.views=new R(t,this.options)}}}(); | ||
var PlusAuthRestClient=function(){"use strict";function t(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function u(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,u)}h((i=i.apply(t,e||[])).next())}))}var e=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&!function(t){var e=Object.prototype.toString.call(t);return"[object RegExp]"===e||"[object Date]"===e||function(t){return t.$$typeof===r}(t)}(t)};var r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(t,e){return!1!==e.clone&&e.isMergeableObject(t)?h((r=t,Array.isArray(r)?[]:{}),t,e):t;var r}function n(t,e,r){return t.concat(e).map((function(t){return i(t,r)}))}function o(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(e){return t.propertyIsEnumerable(e)})):[]}(t))}function s(t,e){try{return e in t}catch(t){return!1}}function u(t,e,r){var n={};return r.isMergeableObject(t)&&o(t).forEach((function(e){n[e]=i(t[e],r)})),o(e).forEach((function(o){(function(t,e){return s(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,o)||(s(t,o)&&r.isMergeableObject(e[o])?n[o]=function(t,e){if(!e.customMerge)return h;var r=e.customMerge(t);return"function"==typeof r?r:h}(o,r)(t[o],e[o],r):n[o]=i(e[o],r))})),n}function h(t,r,o){(o=o||{}).arrayMerge=o.arrayMerge||n,o.isMergeableObject=o.isMergeableObject||e,o.cloneUnlessOtherwiseSpecified=i;var s=Array.isArray(r);return s===Array.isArray(t)?s?o.arrayMerge(t,r,o):u(t,r,o):i(r,o)}h.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce((function(t,r){return h(t,r,e)}),{})};var d,a=h,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}const f=p((function(t,e){var r="undefined"!=typeof self?self:c,i=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,n="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function d(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function v(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&n&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||h(t))?this._bodyArrayBuffer=y(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var t,e,r,i=f(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=l(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(t,e){t=d(t),e=a(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},p.prototype.delete=function(t){delete this.map[d(t)]},p.prototype.get=function(t){return t=d(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(d(t))},p.prototype.set=function(t,e){this.map[d(t)]=a(e)},p.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},p.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},p.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},p.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},i&&(p.prototype[Symbol.iterator]=p.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(t,e){var r,i,n=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new p(e.headers)),this.method=(r=e.method||this.method||"GET",i=r.toUpperCase(),m.indexOf(i)>-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function $(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},g.call(b.prototype),g.call($.prototype),$.prototype.clone=function(){return new $(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},$.error=function(){var t=new $(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];$.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new $(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function A(t,r){return new Promise((function(i,o){var s=new b(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function h(){u.abort()}u.onload=function(){var t,e,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();e.append(i,n)}})),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var n="response"in u?u.response:u.responseText;i(new $(n,r))},u.onerror=function(){o(new TypeError("Network request failed"))},u.ontimeout=function(){o(new TypeError("Network request failed"))},u.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},u.open(s.method,s.url,!0),"include"===s.credentials?u.withCredentials=!0:"omit"===s.credentials&&(u.withCredentials=!1),"responseType"in u&&n&&(u.responseType="blob"),s.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",h),u.onreadystatechange=function(){4===u.readyState&&s.signal.removeEventListener("abort",h)}),u.send(void 0===s._bodyInit?null:s._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=p,t.Request=b,t.Response=$),e.Headers=p,e.Request=b,e.Response=$,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var n=i;(e=n.fetch).default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,t.exports=e}(d={exports:{}},d.exports),d.exports));function l(e,r){var i;return t(this,void 0,void 0,(function*(){const t=e.headers.get("content-type");return"stream"===r.responseType?null===(i=e.body)||void 0===i?void 0:i.getReader():"json"===r.responseType||t&&t.indexOf("application/json")>-1?yield e.json():yield e.text()}))}function v(t,e){return new Promise((function(r,i){f(t,e).then((t=>{const n=t.clone();t.ok?l(n,e).then(r).catch(i):400===t.status?l(n,e).then((t=>{if("xhr_request"===t.error&&t.location)return window.location.replace(t.location),!1;i(t)})).catch(i):l(n,e).then(i).catch(i)})).catch(i)}))}class y{constructor(t,e={}){if(!t)throw new Error("'apiURL' must be provided");try{new URL(t)}catch(t){throw new Error("'apiUrl' must be a valid uri")}if("object"!=typeof e)throw new Error("'options' must be an object");if(e.httpClient&&"function"!=typeof e.httpClient)throw new Error('"httpClient" must be function');const r=t+(/\/api\/v\d(\/)?$/.test(t)?"":(t.endsWith("/")?"":"/")+"api/v1")+this.constructor.prefix,i=e.httpClient||v,n={};["get","post","patch","delete"].forEach((t=>{n[t]=function(...n){let o;o=e&&"function"==typeof e.token?e.token.call(void 0):e.token;let s={method:t.toUpperCase(),mode:"cors",headers:Object.assign({Accept:"application/json","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},o?{Authorization:`Bearer ${o}`}:{})};return n.length>1&&"get"!==t&&(s.body="object"==typeof n[1]?JSON.stringify(n[1]):n[1]),n[2]&&"object"==typeof n[2]&&(s=a(s,n[2])),i.call(null,r+n[0],s)}})),this._baseUrl=r,this.http=n}}function g(t,e=!0){if(!t)return"";const r=[];for(const e in t)null!=t[e]&&r.push(`${encodeURIComponent(e)}=${t[e].toString()}`);return e?`?${r.join("&")}`:r.join("&")}y.prefix="";class m extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}getPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/permissions${g(r)}`)}))}createPermission(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/permissions`,r)}))}removePermission(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/permissions/${r}`)}))}getAuthorizedClients(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/authorized_clients${g(r)}`)}))}authorizeClients(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/authorized_clients`,r)}))}unAuthorizeClients(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/authorized_clients`,r)}))}getAssignedPermissionsToClient(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/authorized_clients/${r}/permissions`)}))}assignPermissionsToClient(e,r,i){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/authorized_clients/${r}/permissions`,i)}))}unassignPermissionsFromClient(e,r,i){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/authorized_clients/${r}/permissions`,i)}))}}m.prefix="/apis";class b extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}}b.prefix="/clients";class w extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}validate(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/validate`)}))}}w.prefix="/custom-domain";class $ extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}}$.prefix="/federated";class x extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(`${g(e)}`)}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){if(!e&&!r.id)throw new Error("hook id is required");return this.http.patch(`/${e||r.id}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}addPackages(e,r,i=!1){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/packages`,r,{responseType:i?"stream":void 0})}))}deletePackages(e,r,i=!1){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/packages`,r,{responseType:i?"stream":void 0})}))}}x.prefix="/hooks";class A extends y{getSigningKeys(){return t(this,void 0,void 0,(function*(){return this.http.get("/signing")}))}rotateSigningKeys(e){return t(this,void 0,void 0,(function*(){return this.http.post("/signing/rotate",{keys:e})}))}revokeSigningKey(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/signing/revoke/${e}`)}))}getEncryptionKeys(){return t(this,void 0,void 0,(function*(){return this.http.get("/encryption")}))}rotateEncryptionKeys(e){return t(this,void 0,void 0,(function*(){return this.http.post("/encryption/rotate",{keys:e})}))}revokeEncryptionKey(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/encryption/revoke/${e}`)}))}}A.prefix="/keys";class E extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}}E.prefix="/logs";class O extends y{getAll(){return t(this,void 0,void 0,(function*(){return this.http.get("")}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}}O.prefix="/mfa";class P extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}getRoles(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/roles${g(r)}`)}))}assignRoles(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/roles`,r)}))}unAssignRoles(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/roles`,r)}))}}P.prefix="/roleGroups";class _ extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}getPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/permissions${g(r)}`)}))}assignPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/permissions`,r)}))}unAssignPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/permissions`,r)}))}}_.prefix="/roles";class j extends y{get(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/${r}`)}))}update(e,r,i){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}/${r}`,i)}))}}j.prefix="/templates";class T extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(`${g(e)}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e,{headers:{"X-PlusAuth-Tenant":"api"}})}))}delete(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}getSettings(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/settings`)}))}updateSettings(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}/settings`,r)}))}inviteAdmin(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/invite`,{email:r})}))}getAdministrators(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/administrators`)}))}removeAdministrator(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/administrators/${r}`)}))}getStats(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/stats${g(r)}`)}))}getSMSProviderSettings(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/provider/sms${r?`/${r}`:""}`)}))}updateSMSProviderSettings(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}/provider/sms`,r)}))}getEmailProviderSettings(e,r){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/provider/email${r?`/${r}`:""}`)}))}updateEmailProviderSettings(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}/provider/email`,r)}))}}T.prefix="/tenants";class S extends y{getAll(e){return t(this,void 0,void 0,(function*(){return this.http.get(g(e))}))}get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}create(e){return t(this,void 0,void 0,(function*(){return this.http.post("",e)}))}remove(e){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}`)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r)}))}getSessions(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/session`)}))}endSession(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/session/${r}`)}))}getTenants(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/tenants`)}))}getRoleGroups(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/roleGroups`)}))}assignRoleGroups(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/roleGroups`,r)}))}unAssignRoleGroups(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/roleGroups`,r)}))}getRoles(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/roles`)}))}assignRoles(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/roles`,r)}))}unAssignRoles(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/roles`,r)}))}getPermissions(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/permissions`)}))}assignPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.post(`/${e}/permissions`,r)}))}unAssignPermissions(e,r){return t(this,void 0,void 0,(function*(){return this.http.delete(`/${e}/permissions`,r)}))}getRBAC(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}/rbac`)}))}}S.prefix="/users";class R extends y{get(e){return t(this,void 0,void 0,(function*(){return this.http.get(`/${e}`)}))}update(e,r){return t(this,void 0,void 0,(function*(){return this.http.patch(`/${e}`,r,{headers:{"Content-Type":"text/plain"}})}))}}R.prefix="/views";return class{constructor(t,e={}){this.options=e,this.apis=new m(t,this.options),this.clients=new b(t,this.options),this.customDomains=new w(t,this.options),this.federated=new $(t,this.options),this.hooks=new x(t,this.options),this.keys=new A(t,this.options),this.logs=new E(t,this.options),this.mfa=new O(t,this.options),this.roleGroups=new P(t,this.options),this.roles=new _(t,this.options),this.templates=new j(t,this.options),this.tenants=new T(t,this.options),this.users=new S(t,this.options),this.views=new R(t,this.options)}}}(); | ||
//# sourceMappingURL=plusauth-rest-js.min.js.map |
{ | ||
"name": "@plusauth/plusauth-rest-js", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "PlusAuth JavaScript Rest Client", | ||
@@ -29,8 +29,8 @@ "main": "dist/plusauth-rest-js.cjs.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.13.13", | ||
"@babel/core": "^7.14.0", | ||
"@babel/plugin-proposal-class-properties": "^7.13.0", | ||
"@babel/preset-env": "^7.13.12", | ||
"@commitlint/cli": "^12.0.1", | ||
"@commitlint/config-conventional": "^12.0.1", | ||
"@microsoft/api-extractor": "^7.13.2", | ||
"@babel/preset-env": "^7.14.0", | ||
"@commitlint/cli": "^12.1.1", | ||
"@commitlint/config-conventional": "^12.1.1", | ||
"@microsoft/api-extractor": "^7.15.0", | ||
"@release-it/conventional-changelog": "^2.0.1", | ||
@@ -40,12 +40,12 @@ "@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-node-resolve": "^11.2.1", | ||
"@types/chai": "^4.2.15", | ||
"@types/chai": "^4.2.17", | ||
"@types/mocha": "^8.2.2", | ||
"@types/node-fetch": "^2.5.8", | ||
"@types/sinon": "^9.0.11", | ||
"@typescript-eslint/eslint-plugin": "^4.19.0", | ||
"@typescript-eslint/parser": "^4.19.0", | ||
"@types/node-fetch": "^2.5.10", | ||
"@types/sinon": "^10.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"chai": "^4.3.4", | ||
"core-js": "^3.9.1", | ||
"core-js": "^3.11.2", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^7.23.0", | ||
"eslint": "^7.25.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
@@ -58,3 +58,3 @@ "fetch-mock": "^9.11.0", | ||
"nock": "^13.0.11", | ||
"release-it": "^14.5.0", | ||
"release-it": "^14.6.1", | ||
"rimraf": "^3.0.2", | ||
@@ -65,7 +65,7 @@ "rollup": "^2.43.1", | ||
"sinon": "^10.0.0", | ||
"standard-version": "^9.1.1", | ||
"standard-version": "^9.2.0", | ||
"ts-node": "^9.1.1", | ||
"typedoc": "^0.20.34", | ||
"typedoc": "^0.20.36", | ||
"typedoc-plugin-merge-modules": "^2.0.0", | ||
"typescript": "^4.2.3" | ||
"typescript": "4.2.4" | ||
}, | ||
@@ -77,2 +77,19 @@ "commitlint": { | ||
"rules": { | ||
"type-enum": [ | ||
2, | ||
"always", | ||
[ | ||
"build", | ||
"chore", | ||
"ci", | ||
"docs", | ||
"feat", | ||
"fix", | ||
"perf", | ||
"refactor", | ||
"dev", | ||
"test", | ||
"type" | ||
] | ||
], | ||
"header-max-length": [ | ||
@@ -79,0 +96,0 @@ 0, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
401563
10846