{"version":3,"file":"index.mjs","names":["isError","BaseClient","isClientError","isClientError"],"sources":["../src/cookies.ts","../src/client/helper.ts","../src/utils/duplicate-slashes.ts","../src/utils/object-property.ts","../src/domains/base.ts","../src/domains/entities/client/module.ts","../src/domains/entities/client-permission/module.ts","../src/domains/entities/client-role/module.ts","../src/domains/entities/client-scope/module.ts","../src/domains/entities/identity-provider/module.ts","../src/domains/entities/identity-provider-role-mapping/module.ts","../src/domains/entities/policy/module.ts","../src/domains/entities/permission/module.ts","../src/domains/entities/permission-policy/module.ts","../src/domains/entities/realm/module.ts","../src/domains/entities/robot/module.ts","../src/domains/entities/robot-permission/module.ts","../src/domains/entities/robot-role/module.ts","../src/domains/entities/role/module.ts","../src/domains/entities/role-attribute/module.ts","../src/domains/entities/role-permission/module.ts","../src/domains/entities/scope/module.ts","../src/domains/entities/user/module.ts","../src/domains/entities/user-attribute/module.ts","../src/domains/entities/user-permission/module.ts","../src/domains/entities/user-role/module.ts","../src/domains/workflows/oauth2/authorize/module.ts","../src/domains/workflows/oauth2/token/module.ts","../src/domains/workflows/oauth2/user-info/module.ts","../src/client/module.ts","../src/helpers/error-code.ts","../src/hook/constants.ts","../src/hook/utils.ts","../src/hook/module.ts","../src/token-creator/presets/client.ts","../src/token-creator/presets/robot.ts","../src/token-creator/presets/user.ts"],"sourcesContent":["/*\n * Copyright (c) 2022-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum CookieName {\n    ACCESS_TOKEN = 'access_token',\n    ACCESS_TOKEN_EXPIRE_DATE = 'access_token_expire_date',\n    REFRESH_TOKEN = 'refresh_token',\n\n    USER = 'user',\n    REALM = 'realm',\n    REALM_MANAGEMENT = 'realm_management',\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { ClientError } from 'hapic';\nimport { isClientError as isError } from 'hapic';\n\nexport function isClientError(input: unknown) : input is ClientError {\n    return isError(input);\n}\n","/*\n * Copyright (c) 2022-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function cleanDoubleSlashes(input: string) : string {\n    if (input.includes('://')) {\n        return input.split('://')\n            .map((str) => cleanDoubleSlashes(str))\n            .join('://');\n    }\n\n    return input.replace(/\\/+/g, '/');\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function nullifyEmptyObjectProperties<T extends Record<string, any>>(data: T) : T {\n    const keys : (keyof T)[] = Object.keys(data);\n\n    for (const key of keys) {\n        if (data[key] === '') {\n            data[key] = null as T[keyof T];\n        }\n    }\n\n    return data;\n}\n","/*\n * Copyright (c) 2023-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { createClient, isClient } from 'hapic';\nimport type { Client, RequestBaseOptions } from 'hapic';\nimport type { BaseAPIContext } from './types-base';\n\nexport class BaseAPI {\n    protected client! : Client;\n\n    // -----------------------------------------------------------------------------------\n\n    constructor(context?: BaseAPIContext) {\n        context = context || {};\n\n        this.setClient(context.client);\n    }\n\n    // -----------------------------------------------------------------------------------\n\n    setClient(input?: Client | RequestBaseOptions) {\n        this.client = isClient(input) ?\n            input :\n            createClient(input);\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { Client } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class ClientAPI extends BaseAPI implements EntityAPI<Client> {\n    async getMany(\n        options?: BuildInput<Client>,\n    ): Promise<EntityCollectionResponse<Client>> {\n        const response = await this.client\n            .get(`clients${buildQuery(options)}`);\n\n        return response.data;\n    }\n\n    async getOne(\n        id: Client['id'],\n        options?: BuildInput<Client>,\n    ): Promise<EntityRecordResponse<Client>> {\n        const response = await this.client\n            .get(`clients/${id}${buildQuery(options)}`);\n\n        return response.data;\n    }\n\n    async delete(\n        id: Client['id'],\n    ): Promise<EntityRecordResponse<Client>> {\n        const response = await this.client\n            .delete(`clients/${id}`);\n\n        return response.data;\n    }\n\n    async create(\n        data: Partial<Client>,\n    ): Promise<EntityRecordResponse<Client>> {\n        const response = await this.client\n            .post('clients', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(\n        id: Client['id'],\n        data: Partial<Client>,\n    ): Promise<EntityRecordResponse<Client>> {\n        const response = await this.client.post(`clients/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async createOrUpdate(\n        idOrName: string,\n        data: Partial<Client>,\n    ): Promise<EntityRecordResponse<Client>> {\n        const response = await this.client.put(`clients/${idOrName}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { ClientPermission } from '@authup/core-kit';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class ClientPermissionAPI extends BaseAPI implements EntityAPI<ClientPermission> {\n    async getMany(data?: BuildInput<ClientPermission>) : Promise<EntityCollectionResponse<ClientPermission>> {\n        const response = await this.client.get(`client-permissions${buildQuery(data)}`);\n        return response.data;\n    }\n\n    async getOne(id: ClientPermission['id'], data?: BuildInput<ClientPermission>) : Promise<EntityRecordResponse<ClientPermission>> {\n        const response = await this.client.get(`client-permissions/${id}${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async delete(id: ClientPermission['id']) : Promise<EntityRecordResponse<ClientPermission>> {\n        const response = await this.client.delete(`client-permissions/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<ClientPermission>) : Promise<EntityRecordResponse<ClientPermission>> {\n        const response = await this.client.post('client-permissions', data);\n\n        return response.data;\n    }\n\n    async update(id: ClientPermission['id'], data: Partial<ClientPermission>) : Promise<EntityRecordResponse<ClientPermission>> {\n        const response = await this.client.post(`client-permissions/${id}`, data);\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { ClientRole } from '@authup/core-kit';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPISlim, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class ClientRoleAPI extends BaseAPI implements EntityAPISlim<ClientRole> {\n    async getMany(data: BuildInput<ClientRole> = {}): Promise<EntityCollectionResponse<ClientRole>> {\n        const response = await this.client.get(`client-roles${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async getOne(id: ClientRole['id']): Promise<EntityRecordResponse<ClientRole>> {\n        const response = await this.client.get(`client-roles/${id}`);\n\n        return response.data;\n    }\n\n    async delete(id: ClientRole['id']): Promise<EntityRecordResponse<ClientRole>> {\n        const response = await this.client.delete(`client-roles/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<ClientRole>): Promise<EntityRecordResponse<ClientRole>> {\n        const response = await this.client.post('client-roles', data);\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { ClientScope } from '@authup/core-kit';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPISlim, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class ClientScopeAPI extends BaseAPI implements EntityAPISlim<ClientScope> {\n    async getMany(data?: BuildInput<ClientScope>) : Promise<EntityCollectionResponse<ClientScope>> {\n        const response = await this.client.get(`client-scopes${buildQuery(data)}`);\n        return response.data;\n    }\n\n    async getOne(id: ClientScope['id']) : Promise<EntityRecordResponse<ClientScope>> {\n        const response = await this.client.get(`client-scopes/${id}`);\n\n        return response.data;\n    }\n\n    async delete(id: ClientScope['id']) : Promise<EntityRecordResponse<ClientScope>> {\n        const response = await this.client.delete(`client-scopes/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<ClientScope>) : Promise<EntityRecordResponse<ClientScope>> {\n        const response = await this.client.post('client-scopes', data);\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { IdentityProvider } from '@authup/core-kit';\nimport { buildIdentityProviderAuthorizePath } from '@authup/core-kit';\nimport { cleanDoubleSlashes, nullifyEmptyObjectProperties } from '../../../utils';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\nimport { BaseAPI } from '../../base';\n\nexport class IdentityProviderAPI extends BaseAPI implements EntityAPI<IdentityProvider> {\n    getAuthorizeUri(id: IdentityProvider['id']): string {\n        return cleanDoubleSlashes(`${this.client.defaults.baseURL}/${buildIdentityProviderAuthorizePath(id)}`);\n    }\n\n    async getMany(record?: BuildInput<IdentityProvider>): Promise<EntityCollectionResponse<IdentityProvider>> {\n        const response = await this.client.get(`identity-providers${buildQuery(record)}`);\n\n        return response.data;\n    }\n\n    async getOne(\n        id: IdentityProvider['id'],\n        record?: BuildInput<IdentityProvider>,\n    ): Promise<EntityRecordResponse<IdentityProvider>> {\n        const response = await this.client.get(`identity-providers/${id}${buildQuery(record)}`);\n\n        return response.data;\n    }\n\n    async delete(id: IdentityProvider['id']): Promise<EntityRecordResponse<IdentityProvider>> {\n        const response = await this.client.delete(`identity-providers/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<IdentityProvider>): Promise<EntityRecordResponse<IdentityProvider>> {\n        const response = await this.client.post('identity-providers', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(id: IdentityProvider['id'], data: Partial<IdentityProvider>): Promise<EntityRecordResponse<IdentityProvider>> {\n        const response = await this.client.post(`identity-providers/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async createOrUpdate(\n        idOrName: string,\n        data: Partial<IdentityProvider>,\n    ): Promise<EntityRecordResponse<IdentityProvider>> {\n        const response = await this.client.put(`identity-providers/${idOrName}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { IdentityProviderRoleMapping } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class IdentityProviderRoleMappingAPI extends BaseAPI implements EntityAPI<IdentityProviderRoleMapping> {\n    async getMany(data: BuildInput<IdentityProviderRoleMapping>): Promise<EntityCollectionResponse<IdentityProviderRoleMapping>> {\n        const response = await this.client.get(`identity-provider-role-mappings${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async getOne(id: IdentityProviderRoleMapping['id']): Promise<EntityRecordResponse<IdentityProviderRoleMapping>> {\n        const response = await this.client.get(`identity-provider-role-mappings/${id}`);\n\n        return response.data;\n    }\n\n    async delete(id: IdentityProviderRoleMapping['id']): Promise<EntityRecordResponse<IdentityProviderRoleMapping>> {\n        const response = await this.client.delete(`identity-provider-role-mappings/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<IdentityProviderRoleMapping>): Promise<EntityRecordResponse<IdentityProviderRoleMapping>> {\n        const response = await this.client.post('identity-provider-role-mappings', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(\n        id: IdentityProviderRoleMapping['id'],\n        data: Partial<IdentityProviderRoleMapping>,\n    ): Promise<EntityRecordResponse<IdentityProviderRoleMapping>> {\n        const response = await this.client.post(`identity-provider-role-mappings/${id}`, data);\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { Policy } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\nimport type {\n    BuiltInPolicyCreateRequest,\n    BuiltInPolicyResponse, \n    BuiltInPolicyUpdateRequest, \n    PolicyAPICheckResponse, \n    PolicyCreateRequest, \n    PolicyResponse, \n    PolicyUpdateRequest,\n} from './types';\n\nexport class PolicyAPI extends BaseAPI implements EntityAPI<Policy> {\n    async getMany<\n        OUTPUT extends PolicyResponse = PolicyResponse,\n    >(data?: BuildInput<Policy & { parent_id?: string | null }>): Promise<EntityCollectionResponse<OUTPUT>> {\n        const response = await this.client.get(`policies${buildQuery(data)}`);\n        return response.data;\n    }\n\n    async delete<\n        OUTPUT extends PolicyResponse = PolicyResponse,\n    >(id: Policy['id']): Promise<EntityRecordResponse<OUTPUT>> {\n        const response = await this.client.delete(`policies/${id}`);\n\n        return response.data;\n    }\n\n    async getOne<\n        OUTPUT extends PolicyResponse = PolicyResponse,\n    >(id: Policy['id'], record?: BuildInput<Policy>) : Promise<EntityRecordResponse<OUTPUT>> {\n        const response = await this.client.get(`policies/${id}${buildQuery(record)}`);\n\n        return response.data;\n    }\n\n    async getOneExpanded<\n        OUTPUT extends PolicyResponse = PolicyResponse,\n    >(id: Policy['id'], record?: BuildInput<Policy>) : Promise<EntityRecordResponse<OUTPUT>> {\n        const response = await this.client.get(`policies/${id}/expanded${buildQuery(record)}`);\n\n        return response.data;\n    }\n\n    async create<\n        INPUT extends PolicyCreateRequest = PolicyCreateRequest,\n        OUTPUT extends PolicyResponse = PolicyResponse,\n    >(data: INPUT): Promise<EntityRecordResponse<OUTPUT>> {\n        const response = await this.client.post('policies', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async createBuiltIn(\n        data: BuiltInPolicyCreateRequest,\n    ): Promise<EntityRecordResponse<BuiltInPolicyResponse>> {\n        return this.create(data);\n    }\n\n    async update<\n        INPUT extends PolicyUpdateRequest = PolicyUpdateRequest,\n        OUTPUT extends PolicyResponse = PolicyResponse,\n    >(id: Policy['id'], data: INPUT): Promise<EntityRecordResponse<OUTPUT>> {\n        const response = await this.client.post(`policies/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async updateBuiltIn(\n        id: Policy['id'],\n        data: BuiltInPolicyUpdateRequest,\n    ): Promise<EntityRecordResponse<BuiltInPolicyResponse>> {\n        return this.update(id, data);\n    }\n\n    async createOrUpdate<\n        INPUT extends PolicyCreateRequest = PolicyCreateRequest,\n        OUTPUT extends PolicyResponse = PolicyResponse,\n    >(\n        idOrName: string,\n        data: INPUT,\n    ): Promise<EntityRecordResponse<OUTPUT>> {\n        const response = await this.client.put(`policies/${idOrName}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async createOrUpdateBuiltin(\n        idOrName: string,\n        data: BuiltInPolicyCreateRequest,\n    ): Promise<EntityRecordResponse<BuiltInPolicyResponse>> {\n        return this.createOrUpdate(idOrName, data);\n    }\n\n    async check(\n        idOrName: string,\n        data: Record<string, any> = {},\n    ) : Promise<PolicyAPICheckResponse> {\n        const response = await this.client.post(\n            `policies/${idOrName}/check`,\n            nullifyEmptyObjectProperties(data),\n        );\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { Permission } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\nimport type { PermissionAPICheckResponse } from './types';\n\nexport class PermissionAPI extends BaseAPI implements EntityAPI<Permission> {\n    async getMany(data?: BuildInput<Permission>): Promise<EntityCollectionResponse<Permission>> {\n        const response = await this.client.get(`permissions${buildQuery(data)}`);\n        return response.data;\n    }\n\n    async delete(id: Permission['id']): Promise<EntityRecordResponse<Permission>> {\n        const response = await this.client.delete(`permissions/${id}`);\n\n        return response.data;\n    }\n\n    async getOne(id: Permission['id'], record?: BuildInput<Permission>) {\n        const response = await this.client.get(`permissions/${id}${buildQuery(record)}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<Permission>): Promise<EntityRecordResponse<Permission>> {\n        const response = await this.client.post('permissions', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(id: Permission['id'], data: Partial<Permission>): Promise<EntityRecordResponse<Permission>> {\n        const response = await this.client.post(`permissions/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async createOrUpdate(\n        idOrName: string,\n        data: Partial<Permission>,\n    ): Promise<EntityRecordResponse<Permission>> {\n        const response = await this.client.put(`permissions/${idOrName}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async check(\n        idOrName: string,\n        data: Record<string, any> = {},\n    ) : Promise<PermissionAPICheckResponse> {\n        const response = await this.client.post(\n            `permissions/${idOrName}/check`,\n            nullifyEmptyObjectProperties(data),\n        );\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { PermissionPolicy } from '@authup/core-kit';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPISlim, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class PermissionPolicyAPI extends BaseAPI implements EntityAPISlim<PermissionPolicy> {\n    async getMany(data?: BuildInput<PermissionPolicy>) : Promise<EntityCollectionResponse<PermissionPolicy>> {\n        const response = await this.client.get(`permission-policies${buildQuery(data)}`);\n        return response.data;\n    }\n\n    async getOne(id: PermissionPolicy['id']) : Promise<EntityRecordResponse<PermissionPolicy>> {\n        const response = await this.client.get(`permission-policies/${id}`);\n\n        return response.data;\n    }\n\n    async delete(id: PermissionPolicy['id']) : Promise<EntityRecordResponse<PermissionPolicy>> {\n        const response = await this.client.delete(`permission-policies/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<PermissionPolicy>) : Promise<EntityRecordResponse<PermissionPolicy>> {\n        const response = await this.client.post('permission-policies', data);\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { Realm } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class RealmAPI extends BaseAPI implements EntityAPI<Realm> {\n    async getMany(data?: BuildInput<Realm>): Promise<EntityCollectionResponse<Realm>> {\n        const response = await this.client.get(`realms${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async getOne(id: Realm['id']): Promise<EntityRecordResponse<Realm>> {\n        const response = await this.client.get(`realms/${id}`);\n\n        return response.data;\n    }\n\n    async delete(id: Realm['id']): Promise<EntityRecordResponse<Realm>> {\n        const response = await this.client.delete(`realms/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<Realm>): Promise<EntityRecordResponse<Realm>> {\n        const response = await this.client.post('realms', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(realmId: Realm['id'], data: Partial<Realm>): Promise<EntityRecordResponse<Realm>> {\n        const response = await this.client.post(`realms/${realmId}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async createOrUpdate(\n        idOrName: string,\n        data: Partial<Realm>,\n    ): Promise<EntityRecordResponse<Realm>> {\n        const response = await this.client.put(`realms/${idOrName}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { Robot } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class RobotAPI extends BaseAPI implements EntityAPI<Robot> {\n    async getMany(\n        options?: BuildInput<Robot>,\n    ): Promise<EntityCollectionResponse<Robot>> {\n        const response = await this.client\n            .get(`robots${buildQuery(options)}`);\n\n        return response.data;\n    }\n\n    async getOne(\n        id: Robot['id'],\n        options?: BuildInput<Robot>,\n    ): Promise<EntityRecordResponse<Robot>> {\n        const response = await this.client\n            .get(`robots/${id}${buildQuery(options)}`);\n\n        return response.data;\n    }\n\n    async delete(\n        id: Robot['id'],\n    ): Promise<EntityRecordResponse<Robot>> {\n        const response = await this.client\n            .delete(`robots/${id}`);\n\n        return response.data;\n    }\n\n    async create(\n        data: Partial<Robot>,\n    ): Promise<EntityRecordResponse<Robot>> {\n        const response = await this.client\n            .post('robots', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(\n        id: Robot['id'],\n        data: Partial<Robot>,\n    ): Promise<EntityRecordResponse<Robot>> {\n        const response = await this.client.post(`robots/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async createOrUpdate(\n        idOrName: string,\n        data: Partial<Robot>,\n    ): Promise<EntityRecordResponse<Robot>> {\n        const response = await this.client.put(`robots/${idOrName}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async integrity(\n        id: Robot['id'] | Robot['name'],\n    ): Promise<EntityRecordResponse<Robot>> {\n        const { data: response } = await this.client\n            .get(`robots/${id}/integrity`);\n\n        return response;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { RobotPermission } from '@authup/core-kit';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class RobotPermissionAPI extends BaseAPI implements EntityAPI<RobotPermission> {\n    async getMany(data?: BuildInput<RobotPermission>) : Promise<EntityCollectionResponse<RobotPermission>> {\n        const response = await this.client.get(`robot-permissions${buildQuery(data)}`);\n        return response.data;\n    }\n\n    async getOne(id: RobotPermission['id'], data?: BuildInput<RobotPermission>) : Promise<EntityRecordResponse<RobotPermission>> {\n        const response = await this.client.get(`robot-permissions/${id}${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async delete(id: RobotPermission['id']) : Promise<EntityRecordResponse<RobotPermission>> {\n        const response = await this.client.delete(`robot-permissions/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<RobotPermission>) : Promise<EntityRecordResponse<RobotPermission>> {\n        const response = await this.client.post('robot-permissions', data);\n\n        return response.data;\n    }\n\n    async update(id: RobotPermission['id'], data: Partial<RobotPermission>) : Promise<EntityRecordResponse<RobotPermission>> {\n        const response = await this.client.post(`robot-permissions/${id}`, data);\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { RobotRole } from '@authup/core-kit';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPISlim, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class RobotRoleAPI extends BaseAPI implements EntityAPISlim<RobotRole> {\n    async getMany(data: BuildInput<RobotRole> = {}): Promise<EntityCollectionResponse<RobotRole>> {\n        const response = await this.client.get(`robot-roles${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async getOne(id: RobotRole['id']): Promise<EntityRecordResponse<RobotRole>> {\n        const response = await this.client.get(`robot-roles/${id}`);\n\n        return response.data;\n    }\n\n    async delete(id: RobotRole['id']): Promise<EntityRecordResponse<RobotRole>> {\n        const response = await this.client.delete(`robot-roles/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<RobotRole>): Promise<EntityRecordResponse<RobotRole>> {\n        const response = await this.client.post('robot-roles', data);\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { Role } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class RoleAPI extends BaseAPI implements EntityAPI<Role> {\n    async getMany(data?: BuildInput<Role>): Promise<EntityCollectionResponse<Role>> {\n        const response = await this.client.get(`roles${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async getOne(roleId: Role['id']): Promise<EntityRecordResponse<Role>> {\n        const response = await this.client.get(`roles/${roleId}`);\n\n        return response.data;\n    }\n\n    async delete(roleId: Role['id']): Promise<EntityRecordResponse<Role>> {\n        const response = await this.client.delete(`roles/${roleId}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<Role>): Promise<EntityRecordResponse<Role>> {\n        const response = await this.client.post('roles', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(id: Role['id'], data: Partial<Role>): Promise<EntityRecordResponse<Role>> {\n        const response = await this.client.post(`roles/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async createOrUpdate(\n        idOrName: string,\n        data: Partial<Role>,\n    ): Promise<EntityRecordResponse<Role>> {\n        const response = await this.client.put(`roles/${idOrName}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { RoleAttribute } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class RoleAttributeAPI extends BaseAPI implements EntityAPI<RoleAttribute> {\n    async getMany(data?: BuildInput<RoleAttribute>): Promise<EntityCollectionResponse<RoleAttribute>> {\n        const response = await this.client.get(`role-attributes${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async getOne(roleId: RoleAttribute['id']): Promise<EntityRecordResponse<RoleAttribute>> {\n        const response = await this.client.get(`role-attributes/${roleId}`);\n\n        return response.data;\n    }\n\n    async delete(roleId: RoleAttribute['id']): Promise<EntityRecordResponse<RoleAttribute>> {\n        const response = await this.client.delete(`role-attributes/${roleId}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<RoleAttribute>): Promise<EntityRecordResponse<RoleAttribute>> {\n        const response = await this.client.post('role-attributes', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(id: RoleAttribute['id'], data: Partial<RoleAttribute>): Promise<EntityRecordResponse<RoleAttribute>> {\n        const response = await this.client.post(`role-attributes/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { RolePermission } from '@authup/core-kit';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class RolePermissionAPI extends BaseAPI implements EntityAPI<RolePermission> {\n    async getMany(data?: BuildInput<RolePermission>) : Promise<EntityCollectionResponse<RolePermission>> {\n        const response = await this.client.get(`role-permissions${buildQuery(data)}`);\n        return response.data;\n    }\n\n    async getOne(id: RolePermission['id']) : Promise<EntityRecordResponse<RolePermission>> {\n        const response = await this.client.get(`role-permissions/${id}`);\n\n        return response.data;\n    }\n\n    async delete(id: RolePermission['id']) : Promise<EntityRecordResponse<RolePermission>> {\n        const response = await this.client.delete(`role-permissions/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<RolePermission>) : Promise<EntityRecordResponse<RolePermission>> {\n        const response = await this.client.post('role-permissions', data);\n\n        return response.data;\n    }\n\n    async update(id: RolePermission['id'], data: Partial<RolePermission>) : Promise<EntityRecordResponse<RolePermission>> {\n        const response = await this.client.post(`role-permissions/${id}`, data);\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { Scope } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class ScopeAPI extends BaseAPI implements EntityAPI<Scope> {\n    async getMany(data?: BuildInput<Scope>): Promise<EntityCollectionResponse<Scope>> {\n        const response = await this.client.get(`scopes${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async getOne(id: Scope['id']): Promise<EntityRecordResponse<Scope>> {\n        const response = await this.client.get(`scopes/${id}`);\n\n        return response.data;\n    }\n\n    async delete(id: Scope['id']): Promise<EntityRecordResponse<Scope>> {\n        const response = await this.client.delete(`scopes/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<Scope>): Promise<EntityRecordResponse<Scope>> {\n        const response = await this.client.post('scopes', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(id: Scope['id'], data: Partial<Scope>): Promise<EntityRecordResponse<Scope>> {\n        const response = await this.client.post(`scopes/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async createOrUpdate(\n        idOrName: string,\n        data: Partial<Scope>,\n    ): Promise<EntityRecordResponse<Scope>> {\n        const response = await this.client.put(`scopes/${idOrName}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { User } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport type PasswordForgotResponse = {\n    reset_expires: string;\n};\n\nexport type PasswordResetResponse = {\n    reset_at: string;\n};\n\nexport type RegisterResponse = {\n    active: true\n};\n\nexport class UserAPI extends BaseAPI implements EntityAPI<User> {\n    async getMany(\n        options?: BuildInput<User>,\n    ): Promise<EntityCollectionResponse<User>> {\n        const response = await this.client\n            .get(`users${buildQuery(options)}`);\n\n        return response.data;\n    }\n\n    async getOne(\n        id: User['id'],\n        options?: BuildInput<User>,\n    ): Promise<EntityRecordResponse<User>> {\n        const response = await this.client\n            .get(`users/${id}${buildQuery(options)}`);\n\n        return response.data;\n    }\n\n    async delete(\n        id: User['id'],\n    ): Promise<EntityRecordResponse<User>> {\n        const response = await this.client\n            .delete(`users/${id}`);\n\n        return response.data;\n    }\n\n    async create(\n        data: Partial<User>,\n    ): Promise<EntityRecordResponse<User>> {\n        const response = await this.client\n            .post('users', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(\n        id: User['id'],\n        data: Partial<User> & { password_repeat?: User['password'] },\n    ): Promise<EntityRecordResponse<User>> {\n        const response = await this.client.post(`users/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async createOrUpdate(\n        idOrName: string,\n        data: Partial<User> & { password_repeat?: User['password'] },\n    ): Promise<EntityRecordResponse<User>> {\n        const response = await this.client.put(`users/${idOrName}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    // ---------------------------------------------------------------------------\n\n    async activate(\n        token: string,\n    ): Promise<User> {\n        const response = await this.client.post('activate', { token });\n\n        return response.data;\n    }\n\n    async register(\n        data: Partial<Pick<User, 'email' | 'name' | 'password' | 'realm_id'>>,\n    ): Promise<RegisterResponse> {\n        const response = await this.client.post('register', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async passwordForgot(\n        data: Partial<Pick<User, 'email' | 'name' | 'realm_id'>>,\n    ) : Promise<PasswordForgotResponse> {\n        const response = await this.client.post('password-forgot', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async passwordReset(\n        data: Partial<Pick<User, 'email' | 'name' | 'realm_id'>> &\n        {\n            token: string,\n            password: string \n        },\n    ) : Promise<PasswordResetResponse> {\n        const response = await this.client.post('password-reset', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { UserAttribute } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class UserAttributeAPI extends BaseAPI implements EntityAPI<UserAttribute> {\n    async getMany(data?: BuildInput<UserAttribute>): Promise<EntityCollectionResponse<UserAttribute>> {\n        const response = await this.client.get(`user-attributes${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async getOne(roleId: UserAttribute['id']): Promise<EntityRecordResponse<UserAttribute>> {\n        const response = await this.client.get(`user-attributes/${roleId}`);\n\n        return response.data;\n    }\n\n    async delete(roleId: UserAttribute['id']): Promise<EntityRecordResponse<UserAttribute>> {\n        const response = await this.client.delete(`user-attributes/${roleId}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<UserAttribute>): Promise<EntityRecordResponse<UserAttribute>> {\n        const response = await this.client.post('user-attributes', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(id: UserAttribute['id'], data: Partial<UserAttribute>): Promise<EntityRecordResponse<UserAttribute>> {\n        const response = await this.client.post(`user-attributes/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { UserPermission } from '@authup/core-kit';\nimport { nullifyEmptyObjectProperties } from '../../../utils';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPI, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class UserPermissionAPI extends BaseAPI implements EntityAPI<UserPermission> {\n    async getMany(data?: BuildInput<UserPermission>) : Promise<EntityCollectionResponse<UserPermission>> {\n        const response = await this.client.get(`user-permissions${buildQuery(data)}`);\n        return response.data;\n    }\n\n    async getOne(id: UserPermission['id']) : Promise<EntityRecordResponse<UserPermission>> {\n        const response = await this.client.get(`user-permissions/${id}`);\n\n        return response.data;\n    }\n\n    async delete(id: UserPermission['id']) : Promise<EntityRecordResponse<UserPermission>> {\n        const response = await this.client.delete(`user-permissions/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<UserPermission>) : Promise<EntityRecordResponse<UserPermission>> {\n        const response = await this.client.post('user-permissions', nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n\n    async update(id: UserPermission['id'], data: Partial<UserPermission>) : Promise<EntityRecordResponse<UserPermission>> {\n        const response = await this.client.post(`user-permissions/${id}`, nullifyEmptyObjectProperties(data));\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { BuildInput } from 'rapiq';\nimport { buildQuery } from 'rapiq';\nimport type { UserRole } from '@authup/core-kit';\nimport { BaseAPI } from '../../base';\nimport type { EntityAPISlim, EntityCollectionResponse, EntityRecordResponse } from '../../types-base';\n\nexport class UserRoleAPI extends BaseAPI implements EntityAPISlim<UserRole> {\n    async getMany(data: BuildInput<UserRole> = {}): Promise<EntityCollectionResponse<UserRole>> {\n        const response = await this.client.get(`user-roles${buildQuery(data)}`);\n\n        return response.data;\n    }\n\n    async getOne(id: UserRole['id']): Promise<EntityRecordResponse<UserRole>> {\n        const response = await this.client.get(`user-roles/${id}`);\n\n        return response.data;\n    }\n\n    async delete(id: UserRole['id']): Promise<EntityRecordResponse<UserRole>> {\n        const response = await this.client.delete(`user-roles/${id}`);\n\n        return response.data;\n    }\n\n    async create(data: Partial<UserRole>): Promise<EntityRecordResponse<UserRole>> {\n        const response = await this.client.post('user-roles', data);\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2AuthorizationCodeRequest } from '@authup/core-kit';\nimport { AuthorizeAPI } from '@hapic/oauth2';\nimport { nullifyEmptyObjectProperties } from '../../../../utils';\n\nexport class OAuth2AuthorizeAPI extends AuthorizeAPI {\n    async confirm(\n        data: OAuth2AuthorizationCodeRequest,\n    ) : Promise<{ url: string }> {\n        const response = await this.client.post(\n            'authorize',\n            nullifyEmptyObjectProperties(data),\n        );\n\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2024-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { TokenAPI } from '@hapic/oauth2';\n\nexport class OAuth2TokenAPI extends TokenAPI {\n\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { UserInfoAPI } from '@hapic/oauth2';\n\nexport class OAuth2UserInfoAPI extends UserInfoAPI {\n\n}\n","/*\n * Copyright (c) 2022-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { Client as BaseClient, HookName, isClientError } from 'hapic';\nimport type { Options } from '@hapic/oauth2';\nimport type { OAuth2JsonWebKey, OpenIDProviderMetadata } from '@authup/specs';\nimport {\n    ClientAPI,\n    ClientPermissionAPI,\n    ClientRoleAPI,\n    ClientScopeAPI,\n    IdentityProviderAPI,\n    IdentityProviderRoleMappingAPI,\n    OAuth2AuthorizeAPI,\n    OAuth2TokenAPI,\n    OAuth2UserInfoAPI,\n    PermissionAPI,\n    PermissionPolicyAPI,\n    PolicyAPI,\n    RealmAPI,\n    RobotAPI,\n    RobotPermissionAPI,\n    RobotRoleAPI,\n    RoleAPI,\n    RoleAttributeAPI,\n    RolePermissionAPI,\n    ScopeAPI,\n    UserAPI,\n    UserAttributeAPI,\n    UserPermissionAPI,\n    UserRoleAPI,\n} from '../domains';\nimport type { ClientOptions } from './type';\n\nexport class Client extends BaseClient {\n    public readonly token : OAuth2TokenAPI;\n\n    public readonly authorize : OAuth2AuthorizeAPI;\n\n    public readonly client : ClientAPI;\n\n    public readonly clientPermission : ClientPermissionAPI;\n\n    public readonly clientRole : ClientRoleAPI;\n\n    public readonly clientScope : ClientScopeAPI;\n\n    public readonly identityProvider : IdentityProviderAPI;\n\n    public readonly identityProviderRoleMapping : IdentityProviderRoleMappingAPI;\n\n    public readonly policy: PolicyAPI;\n\n    public readonly permission : PermissionAPI;\n\n    public readonly permissionPolicy : PermissionPolicyAPI;\n\n    public readonly realm : RealmAPI;\n\n    public readonly robot : RobotAPI;\n\n    public readonly robotPermission : RobotPermissionAPI;\n\n    public readonly robotRole : RobotRoleAPI;\n\n    public readonly role : RoleAPI;\n\n    public readonly roleAttribute : RoleAttributeAPI;\n\n    public readonly rolePermission : RolePermissionAPI;\n\n    public readonly scope: ScopeAPI;\n\n    public readonly user : UserAPI;\n\n    public readonly userInfo : OAuth2UserInfoAPI;\n\n    public readonly userAttribute: UserAttributeAPI;\n\n    public readonly userPermission : UserPermissionAPI;\n\n    public readonly userRole : UserRoleAPI;\n\n    constructor(config: ClientOptions = {}) {\n        super(config);\n\n        const options : Options = {\n            authorizationEndpoint: 'authorize',\n            introspectionEndpoint: 'token/introspect',\n            tokenEndpoint: 'token',\n            userinfoEndpoint: 'users/@me',\n        };\n\n        const baseURL = this.getBaseURL();\n\n        if (typeof baseURL === 'string') {\n            const keys = Object.keys(options);\n            for (const key_ of keys) {\n                const key = key_ as keyof Options;\n                if (typeof options[key] === 'string') {\n                    options[key] = new URL(options[key], baseURL).href;\n                }\n            }\n        }\n\n        this.authorize = new OAuth2AuthorizeAPI({\n            client: this,\n            options, \n        });\n        this.token = new OAuth2TokenAPI({\n            client: this,\n            options, \n        });\n\n        this.client = new ClientAPI({ client: this });\n        this.clientPermission = new ClientPermissionAPI({ client: this });\n        this.clientRole = new ClientRoleAPI({ client: this });\n        this.clientScope = new ClientScopeAPI({ client: this });\n\n        this.identityProvider = new IdentityProviderAPI({ client: this });\n        this.identityProviderRoleMapping = new IdentityProviderRoleMappingAPI({ client: this });\n\n        this.policy = new PolicyAPI({ client: this });\n        this.permission = new PermissionAPI({ client: this });\n        this.permissionPolicy = new PermissionPolicyAPI({ client: this });\n\n        this.realm = new RealmAPI({ client: this });\n\n        this.robot = new RobotAPI({ client: this });\n        this.robotPermission = new RobotPermissionAPI({ client: this });\n        this.robotRole = new RobotRoleAPI({ client: this });\n\n        this.role = new RoleAPI({ client: this });\n        this.roleAttribute = new RoleAttributeAPI({ client: this });\n        this.rolePermission = new RolePermissionAPI({ client: this });\n\n        this.scope = new ScopeAPI({ client: this });\n\n        this.user = new UserAPI({ client: this });\n\n        this.userInfo = new OAuth2UserInfoAPI({\n            client: this,\n            options, \n        });\n        this.userAttribute = new UserAttributeAPI({ client: this });\n        this.userPermission = new UserPermissionAPI({ client: this });\n        this.userRole = new UserRoleAPI({ client: this });\n\n        this.on(HookName.RESPONSE_ERROR, ((error) => {\n            if (\n                isClientError(error) &&\n                error.response &&\n                error.response.data &&\n                    typeof error.response.data.message === 'string'\n            ) {\n                error.message = error.response.data.message;\n            }\n\n            throw error;\n        }));\n    }\n\n    async getJwks() : Promise<OAuth2JsonWebKey[]> {\n        const response = await this.get('jwks');\n\n        return response.data;\n    }\n\n    async getJwk(id: string) : Promise<OAuth2JsonWebKey> {\n        const response = await this.get(`jwks/${id}`);\n\n        return response.data;\n    }\n\n    async getWellKnownOpenIDConfiguration() : Promise<OpenIDProviderMetadata> {\n        const response = await this.get('/.well-known/openid-configuration');\n        return response.data;\n    }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\nimport { isObject } from '@authup/kit';\n\nexport function getClientErrorCode(err: unknown): string | null {\n    if (!isObject(err) || !isObject(err.response)) {\n        return null;\n    }\n\n    /* istanbul ignore next */\n    if (!isObject(err.response.data) || typeof err.response.data.code !== 'string') {\n        return null;\n    }\n\n    return err.response.data.code;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum ClientAuthenticationHookEventName {\n    REFRESH_FINISHED = 'refreshFinished',\n    REFRESH_FAILED = 'refreshFailed',\n\n    HEADER_SET = 'headerSet',\n    HEADER_UNSET = 'headerRemoved',\n}\n","/*\n * Copyright (c) 2023-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { RequestOptions } from 'hapic';\n\ntype RetryState = {\n    retryCount: number\n};\nexport function getClientRequestRetryState(\n    config: Partial<RequestOptions> & { retry?: Partial<RetryState> },\n) : RetryState {\n    const currentState = config.retry || {};\n    currentState.retryCount = currentState.retryCount || 0;\n\n    config.retry = currentState;\n    return currentState as RetryState;\n}\n","/*\n * Copyright (c) 2023-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isObject } from '@authup/kit';\nimport { isJWKErrorCode, isJWTErrorCode } from '@authup/specs';\nimport type { TokenGrantResponse } from '@hapic/oauth2';\nimport { EventEmitter } from '@posva/event-emitter';\nimport type { AuthorizationHeader, Client as BaseClient } from 'hapic';\nimport {\n    HeaderName,\n    HookName, \n    getHeader, \n    isClientError, \n    setHeader, \n    stringifyAuthorizationHeader, \n    unsetHeader,\n} from 'hapic';\nimport { getClientErrorCode } from '../helpers';\nimport type { TokenCreator } from '../token-creator';\nimport { ClientAuthenticationHookEventName } from './constants';\nimport type { ClientAuthenticationHookEvents, ClientAuthenticationHookOptions } from './types';\nimport { getClientRequestRetryState } from './utils';\n\nconst HOOK_SYMBOL = Symbol.for('ClientResponseHook');\n\nexport class ClientAuthenticationHook extends EventEmitter<{\n    [K in keyof ClientAuthenticationHookEvents as `${K}`]: ClientAuthenticationHookEvents[K]\n}> {\n    protected isActive : boolean;\n\n    protected authorizationHeader : AuthorizationHeader | undefined;\n\n    protected clients : BaseClient[];\n\n    protected creator: TokenCreator;\n\n    protected options : ClientAuthenticationHookOptions;\n\n    protected timer : ReturnType<typeof setTimeout> | undefined;\n\n    protected refreshPromise?: Promise<TokenGrantResponse>;\n\n    // ------------------------------------------------\n\n    constructor(options: ClientAuthenticationHookOptions) {\n        super();\n\n        this.isActive = true;\n        this.authorizationHeader = undefined;\n\n        this.clients = [];\n\n        options.timer ??= true;\n        this.options = options;\n\n        this.creator = options.tokenCreator;\n    }\n\n    // ------------------------------------------------\n\n    enable() {\n        this.isActive = true;\n    }\n\n    disable() {\n        this.isActive = false;\n    }\n\n    // ------------------------------------------------\n\n    setAuthorizationHeader(value: AuthorizationHeader) {\n        this.authorizationHeader = value;\n\n        for (let i = 0; i < this.clients.length; i++) {\n            this.clients[i]!.setAuthorizationHeader(value);\n        }\n\n        this.emit(ClientAuthenticationHookEventName.HEADER_SET);\n    }\n\n    unsetAuthorizationHeader() {\n        this.authorizationHeader = undefined;\n\n        for (let i = 0; i < this.clients.length; i++) {\n            this.clients[i]!.unsetAuthorizationHeader();\n        }\n\n        this.emit(ClientAuthenticationHookEventName.HEADER_UNSET);\n    }\n\n    // ------------------------------------------------\n\n    isAttached(client: BaseClient) {\n        return HOOK_SYMBOL in client;\n    }\n\n    attach(client: BaseClient) {\n        if (this.authorizationHeader) {\n            client.setAuthorizationHeader(this.authorizationHeader);\n        } else {\n            client.unsetAuthorizationHeader();\n        }\n\n        const index = this.clients.indexOf(client);\n        if (index === -1) {\n            this.clients.push(client);\n        }\n\n        if (!this.isAttached(client)) {\n            Object.assign(client, {\n                [HOOK_SYMBOL]: client.on(\n                    HookName.RESPONSE_ERROR,\n                    (err) => {\n                        if (!this.isActive) {\n                            return Promise.reject(err);\n                        }\n\n                        const { request } = err;\n\n                        const currentState = getClientRequestRetryState(request);\n                        if (currentState.retryCount > 0) {\n                            return Promise.reject(err);\n                        }\n\n                        currentState.retryCount += 1;\n\n                        const code = getClientErrorCode(err);\n\n                        if (isJWKErrorCode(code)) {\n                            this.unsetAuthorizationHeader();\n\n                            if (request.headers) {\n                                unsetHeader(\n                                    request.headers,\n                                    HeaderName.AUTHORIZATION,\n                                );\n                            }\n\n                            return Promise.reject(err);\n                        }\n\n                        const refresh = () => this.refresh()\n                            .then((response) => {\n                                if (request.headers) {\n                                    setHeader(\n                                        request.headers,\n                                        HeaderName.AUTHORIZATION,\n                                        stringifyAuthorizationHeader({\n                                            type: 'Bearer',\n                                            token: response.access_token,\n                                        }),\n                                    );\n                                }\n\n                                return client.request(request);\n                            })\n                            .catch((err) => {\n                                if (request.headers) {\n                                    unsetHeader(\n                                        request.headers,\n                                        HeaderName.AUTHORIZATION,\n                                    );\n                                }\n\n                                return Promise.reject(err);\n                            });\n\n                        if (isJWTErrorCode(code)) {\n                            return refresh();\n                        }\n\n                        if (isObject(err.response)) {\n                            if (err.response.status === 401) {\n                                return refresh();\n                            }\n\n                            if (\n                                err.response.status === 403 &&\n                                request.headers &&\n                                !getHeader(request.headers, HeaderName.AUTHORIZATION)\n                            ) {\n                                return refresh();\n                            }\n                        }\n\n                        return Promise.reject(err);\n                    },\n                ),\n            });\n        }\n    }\n\n    detach(client: BaseClient) {\n        client.unsetAuthorizationHeader();\n\n        const index = this.clients.indexOf(client);\n        if (index !== -1) {\n            this.clients.splice(index, 1);\n        }\n\n        if (this.isAttached(client)) {\n            client.off(HookName.RESPONSE_ERROR, client[HOOK_SYMBOL] as number);\n\n            delete client[HOOK_SYMBOL];\n        }\n    }\n\n    // ------------------------------------------------\n\n    setTimer(\n        expiresIn: number,\n    ) {\n        if (!this.options.timer) {\n            return;\n        }\n\n        this.clearTimer();\n\n        const refreshInMs = (expiresIn - 60) * 1000;\n        if (refreshInMs > 0) {\n            this.timer = setTimeout(\n                async () => this.refresh(),\n                refreshInMs,\n            );\n        }\n    }\n\n    clearTimer() {\n        if (this.timer) {\n            clearTimeout(this.timer);\n        }\n    }\n\n    // ------------------------------------------------\n\n    /**\n     * Refresh token\n     *\n     * @throws ClientError\n     */\n    async refresh() : Promise<TokenGrantResponse> {\n        if (this.refreshPromise) {\n            return this.refreshPromise;\n        }\n\n        this.refreshPromise = this.creator();\n\n        return this.refreshPromise\n            .then((response) => {\n                this.setTimer(response.expires_in);\n\n                this.emit(ClientAuthenticationHookEventName.REFRESH_FINISHED, response);\n\n                this.refreshPromise = undefined;\n\n                this.setAuthorizationHeader({\n                    type: 'Bearer',\n                    token: response.access_token,\n                });\n\n                return response;\n            })\n            .catch((e) => {\n                if (isClientError(e)) {\n                    this.emit(ClientAuthenticationHookEventName.REFRESH_FAILED, e);\n                } else {\n                    this.emit(ClientAuthenticationHookEventName.REFRESH_FAILED, null);\n                }\n\n                this.refreshPromise = undefined;\n\n                this.unsetAuthorizationHeader();\n\n                return Promise.reject(e);\n            });\n    }\n}\n","/*\n * Copyright (c) 2023-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { ClientOptions } from '../../client';\nimport { Client } from '../../client';\nimport type { TokenCreator } from '../type';\n\nexport type ClientTokenCreatorOptions = {\n    client?: ClientOptions\n};\n\nexport type ClientTokenCreatorCredentials = {\n    id: string,\n    secret: string,\n};\n\n/**\n * Create token creator based on client credentials flow.\n *\n * @param credentials\n * @param options\n */\nexport function createClientTokenCreator(\n    credentials: ClientTokenCreatorCredentials,\n    options: ClientTokenCreatorOptions = {},\n): TokenCreator {\n    const client = new Client(options.client);\n\n    return async () => client.token.createWithClientCredentials({\n        client_id: credentials.id,\n        client_secret: credentials.secret,\n    });\n}\n","/*\n * Copyright (c) 2023-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { ClientOptions } from '../../client';\nimport { Client } from '../../client';\nimport type { TokenCreator } from '../type';\n\nexport type RobotTokenCreatorOptions = {\n    client?: ClientOptions,\n};\n\nexport type RobotTokenCreatorCredentials = {\n    id: string,\n    secret: string,\n};\n\n/**\n * Create token creator based on robot credentials flow.\n *\n * @param credentials\n * @param options\n */\nexport function createRobotTokenCreator(\n    credentials: RobotTokenCreatorCredentials,\n    options: RobotTokenCreatorOptions = {},\n): TokenCreator {\n    const client = new Client(options.client);\n\n    return async () => client.token.createWithRobotCredentials({\n        id: credentials.id,\n        secret: credentials.secret,\n    });\n}\n","/*\n * Copyright (c) 2023-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { ClientOptions } from '../../client';\nimport { Client } from '../../client';\nimport type { TokenCreator } from '../type';\n\nexport type UserTokenCreatorOptions = {\n    client?: ClientOptions,\n};\n\nexport type UserTokenCreatorCredentials = {\n    name: string,\n    password: string,\n    realmId?: string,\n    realmName?: string,\n};\n\n/**\n * Create token creator based on password flow.\n *\n * @param credentials\n * @param options\n */\nexport function createUserTokenCreator(\n    credentials: UserTokenCreatorCredentials,\n    options: UserTokenCreatorOptions = {},\n) : TokenCreator {\n    const client = new Client(options.client);\n\n    return async () => client.token.createWithPassword({\n        username: credentials.name,\n        password: credentials.password,\n        ...(credentials.realmId ? { realm_id: credentials.realmId } : {}),\n        ...(credentials.realmName ? { realm_name: credentials.realmName } : {}),\n    });\n}\n"],"mappings":";;;;;;;;AAOA,IAAY,aAAL,yBAAA,YAAA;AACH,YAAA,kBAAA;AACA,YAAA,8BAAA;AACA,YAAA,mBAAA;AAEA,YAAA,UAAA;AACA,YAAA,WAAA;AACA,YAAA,sBAAA;;KACH;;;ACLD,SAAgB,cAAc,OAAuC;AACjE,QAAOA,gBAAQ,MAAM;;;;ACJzB,SAAgB,mBAAmB,OAAwB;AACvD,KAAI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