@camunda/ccma-api 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -0
- package/dist/index.js.map +2 -2
- package/dist/services/accounts/orgs.service.d.ts +8 -1
- package/dist/services/accounts/orgs.service.js.map +2 -2
- package/dist/services/accounts/users.service.d.ts +15 -0
- package/dist/services/accounts/users.service.js +39 -0
- package/dist/services/accounts/users.service.js.map +2 -2
- package/dist/services/external/external.accounts.service.d.ts +21 -1
- package/dist/services/external/external.accounts.service.js +41 -0
- package/dist/services/external/external.accounts.service.js.map +2 -2
- package/dist/services/openrouter/openrouter.service.d.ts +200 -0
- package/dist/services/openrouter/openrouter.service.js +227 -0
- package/dist/services/openrouter/openrouter.service.js.map +7 -0
- package/dist/services/openrouter/openrouter.service.spec.d.ts +1 -0
- package/package.json +2 -2
|
@@ -79,6 +79,12 @@ export interface UserIdRequest extends RequestBaseParams {
|
|
|
79
79
|
userId: string;
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
+
export interface DeleteMeRequest extends RequestBaseParams {
|
|
83
|
+
params: {
|
|
84
|
+
reason: string;
|
|
85
|
+
explanation: string;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
82
88
|
export interface SetDefaultOrgRequest extends RequestBaseParams {
|
|
83
89
|
params: {
|
|
84
90
|
userId: string;
|
|
@@ -103,6 +109,15 @@ export declare class UsersService {
|
|
|
103
109
|
/** Refresh the verification token and resend the welcome mail. */
|
|
104
110
|
static resendWelcomeMail(params: UserIdRequest): Promise<void>;
|
|
105
111
|
static deleteUser(params: UserIdRequest): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Delete the account of the caller (self-service `DELETE api/users/me`).
|
|
114
|
+
* The route reads the caller from the token, so it needs no `userId`.
|
|
115
|
+
*
|
|
116
|
+
* The backend reads the body field `explaination`, not `explanation`. This
|
|
117
|
+
* method keeps the misspelling only in the request body, not in its own
|
|
118
|
+
* parameter name.
|
|
119
|
+
*/
|
|
120
|
+
static deleteMe(params: DeleteMeRequest): Promise<void>;
|
|
106
121
|
/**
|
|
107
122
|
* Auth0 brute-force blocks for a user (`GET api/users/:userId/blocks`). The
|
|
108
123
|
* entries are Auth0's block records (identifier/IP), returned opaque for the
|
|
@@ -337,6 +337,45 @@ class UsersService {
|
|
|
337
337
|
);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* Delete the account of the caller (self-service `DELETE api/users/me`).
|
|
342
|
+
* The route reads the caller from the token, so it needs no `userId`.
|
|
343
|
+
*
|
|
344
|
+
* The backend reads the body field `explaination`, not `explanation`. This
|
|
345
|
+
* method keeps the misspelling only in the request body, not in its own
|
|
346
|
+
* parameter name.
|
|
347
|
+
*/
|
|
348
|
+
static async deleteMe(params) {
|
|
349
|
+
const serviceContext = {
|
|
350
|
+
method: {
|
|
351
|
+
name: "UsersService.deleteMe",
|
|
352
|
+
url: "api/users/me",
|
|
353
|
+
normalizedUrl: "api/users/me",
|
|
354
|
+
type: "delete"
|
|
355
|
+
},
|
|
356
|
+
source: params.config.metrics?.source || "unset",
|
|
357
|
+
target: { name: "accounts", type: "internal" }
|
|
358
|
+
};
|
|
359
|
+
const response = await request({
|
|
360
|
+
config: params.config,
|
|
361
|
+
base: { id: "accounts" },
|
|
362
|
+
url: serviceContext.method.url,
|
|
363
|
+
method: serviceContext.method.type,
|
|
364
|
+
metricsDetails: serviceContext,
|
|
365
|
+
body: {
|
|
366
|
+
reason: params.params.reason,
|
|
367
|
+
explaination: params.params.explanation
|
|
368
|
+
},
|
|
369
|
+
responseType: "none"
|
|
370
|
+
});
|
|
371
|
+
if (!response.ok) {
|
|
372
|
+
throw new HttpError(
|
|
373
|
+
`${serviceContext.method.name}: ${response.status} ${response.statusText}`,
|
|
374
|
+
response.status,
|
|
375
|
+
response.statusText
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
340
379
|
/**
|
|
341
380
|
* Auth0 brute-force blocks for a user (`GET api/users/:userId/blocks`). The
|
|
342
381
|
* entries are Auth0's block records (identifier/IP), returned opaque for the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/services/accounts/users.service.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nimport {\n MINUTE,\n type OrganizationRole,\n type User,\n} from '@camunda/ccma-shared-types'\nimport type {\n RequestBaseParams,\n RequestBaseServiceContext,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { Cache } from '../../utils/cache.js'\nimport { HttpError } from '../../utils/errors.js'\nimport type { HibobSearchResponse } from '../hibob/hibob.service.js'\n\nconst userCache = new Cache<string, User>(5 * MINUTE)\nconst REGEX_EMAIL =\n // eslint-disable-next-line prefer-named-capture-group, no-useless-escape\n /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/u\n\nexport interface SearchParams extends RequestBaseParams {\n params: {\n q: {\n organization?: {\n uuid: string\n member: boolean\n }\n name?: string\n userId?: string\n roleId?: string\n email?: string\n signUpStatus?: {\n verified: boolean\n tokenExpired?: boolean\n }\n created?: {\n after?: Date\n before?: Date\n }\n }\n onBehalfOf?: string\n }\n}\n\nexport interface SimpleSearchParams extends RequestBaseParams {\n params: {\n query: string\n type: 'by-email' | 'by-id' | 'fuzzy' | 'lucene'\n }\n}\n\nexport interface AddUserToOrganizationRequest extends RequestBaseParams {\n params: {\n userId: string\n orgId: string\n orgRoles: OrganizationRole[]\n byEmail?: boolean\n }\n}\n\nexport interface RemoveUserFromOrganizationRequest extends RequestBaseParams {\n params: {\n userId: string\n orgId: string\n byEmail?: boolean\n }\n}\n\nexport interface RemoveStaleOrganizationRequest extends RequestBaseParams {\n params: {\n userId: string\n orgId: string\n }\n}\n\nexport interface UpdateUserRoleRequest extends RequestBaseParams {\n params: {\n userId: string\n roleToAdd?: string\n roleToRemove?: string\n }\n headers?: {\n 'x-camunda-email'?: string\n }\n}\n\nexport interface ChangeUserEmailRequest extends RequestBaseParams {\n params: { userId: string; email: string }\n}\n\nexport interface ChangeUserNameRequest extends RequestBaseParams {\n params: { userId: string; firstname: string; lastname: string }\n}\n\nexport interface UserIdRequest extends RequestBaseParams {\n params: { userId: string }\n}\n\nexport interface SetDefaultOrgRequest extends RequestBaseParams {\n params: { userId: string; orgId: string }\n}\n\nexport class UsersService {\n public static async search(params: SearchParams): Promise<User[]> {\n const queryParams = new URLSearchParams()\n const urlParts: string[] = []\n if (params.params.q.roleId) {\n // API route different if roleId is present\n // eslint-disable-next-line id-length\n const q = {\n roleId: params.params.q.roleId,\n name: params.params.q.name || '',\n email: params.params.q.email || '',\n }\n queryParams.append('q', JSON.stringify(q))\n urlParts.push(...['api', 'users', `?${queryParams.toString()}`])\n } else {\n if (params.params.onBehalfOf) {\n queryParams.append(\n 'onBehalfOf',\n encodeURI(JSON.stringify(params.params.onBehalfOf)),\n )\n }\n queryParams.append('q', encodeURI(JSON.stringify(params.params.q)))\n urlParts.push(...['api', 'users', 'search', `?${queryParams.toString()}`])\n }\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.search`,\n url: urlParts.join(`/`),\n normalizedUrl: `api/users/search`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n // Validation\n if (params.params.q.userId) {\n UsersService.validateUserId(serviceContext, params.params.q.userId)\n }\n\n const response = await request<User[]>({\n config: params.config,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async simpleSearch(\n params: SimpleSearchParams,\n ): Promise<{ users: User[] }> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.simpleSearch`,\n url: `api/users/search`,\n normalizedUrl: `api/users/search`,\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n switch (params.params.type) {\n case 'by-email':\n UsersService.validateEmail(serviceContext, params.params.query)\n break\n case 'by-id':\n UsersService.validateUserId(serviceContext, params.params.query)\n break\n case 'lucene':\n UsersService.validateLuceneQuery(serviceContext, params.params.query)\n break\n }\n\n const response = await request<{ users: User[] }>({\n config: params.config,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n body: {\n query: params.params.query,\n type: params.params.type,\n },\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async getUserInfo(\n params: {\n userId: string\n basic?: boolean\n roles?: boolean\n } & RequestBaseParams,\n ): Promise<User | undefined> {\n // `roles=true` asks the backend to enrich the user with its Auth0\n // platform (account-level) roles, which are omitted by default.\n const cacheKey = `${params.basic === true ? 'basic-' : ''}${\n params.roles === true ? 'roles-' : ''\n }${params.userId}`\n if (!params.cacheControl?.ignoreCache) {\n const inCache = userCache.get(cacheKey)\n if (inCache) {\n return inCache\n }\n }\n\n const searchParams = new URLSearchParams()\n if (params.basic === true) {\n searchParams.append('basic', 'true')\n }\n if (params.roles === true) {\n searchParams.append('roles', 'true')\n }\n const queryParams = searchParams.toString()\n ? `?${searchParams.toString()}`\n : ''\n\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.getUserInfo`,\n url: `api/users/${params.userId}${queryParams}`,\n normalizedUrl: `api/users/:userId`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n // Validation\n UsersService.validateUserId(serviceContext, params.userId)\n\n const response = await request<User>({\n ...params,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n userCache.set(cacheKey, response.body!)\n return response.body\n }\n\n public static async addUserToOrganization(\n params: AddUserToOrganizationRequest,\n ) {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.addUserToOrganization`,\n url: `api/users/${params.params.userId}/organization/${params.params.orgId}`,\n normalizedUrl: `api/users/:userId/organization/:orgId`,\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: {\n orgRoles: params.params.orgRoles,\n byEmail: params.params.byEmail,\n },\n responseType: 'none',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static async changeEmail(\n params: ChangeUserEmailRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.changeEmail',\n url: `api/users/${encodeURIComponent(params.params.userId)}/email`,\n normalizedUrl: 'api/users/:userId/email',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: { email: params.params.email },\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static async changeName(params: ChangeUserNameRequest): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.changeName',\n url: `api/users/${encodeURIComponent(params.params.userId)}/name`,\n normalizedUrl: 'api/users/:userId/name',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: {\n firstname: params.params.firstname,\n lastname: params.params.lastname,\n },\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /** Admin-activate a user without an email token (POST api/admin/activate). */\n public static async activateWithoutToken(\n params: UserIdRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.activateWithoutToken',\n url: 'api/admin/activate',\n normalizedUrl: 'api/admin/activate',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: { userId: params.params.userId },\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /** Refresh the verification token and resend the welcome mail. */\n public static async resendWelcomeMail(params: UserIdRequest): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.resendWelcomeMail',\n url: 'api/admin/resend-welcome-mail',\n normalizedUrl: 'api/admin/resend-welcome-mail',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: { userId: params.params.userId },\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static async deleteUser(params: UserIdRequest): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.deleteUser',\n url: `api/users/${encodeURIComponent(params.params.userId)}`,\n normalizedUrl: 'api/users/:userId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /**\n * Auth0 brute-force blocks for a user (`GET api/users/:userId/blocks`). The\n * entries are Auth0's block records (identifier/IP), returned opaque for the\n * caller to render.\n */\n public static async getBlocks(params: UserIdRequest): Promise<unknown[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.getBlocks',\n url: `api/users/${encodeURIComponent(params.params.userId)}/blocks`,\n normalizedUrl: 'api/users/:userId/blocks',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request<unknown[]>({\n ...params,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body ?? []\n }\n\n /** Clear a user's Auth0 blocks (`DELETE api/users/:userId/blocks`). */\n public static async clearBlocks(params: UserIdRequest): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.clearBlocks',\n url: `api/users/${encodeURIComponent(params.params.userId)}/blocks`,\n normalizedUrl: 'api/users/:userId/blocks',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /** Replace a user's Auth0 `app_metadata` (god-gated raw JSON edit). */\n public static async updateAppMetadata(\n params: {\n params: { userId: string }\n body: { appMetadata: object }\n } & RequestBaseParams,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.updateAppMetadata',\n url: `api/users/${encodeURIComponent(params.params.userId)}/appmetadata`,\n normalizedUrl: 'api/users/:userId/appmetadata',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /** Replace a user's Auth0 `user_metadata` (god-gated raw JSON edit). */\n public static async updateUserMetadata(\n params: {\n params: { userId: string }\n body: { userMetadata: object }\n } & RequestBaseParams,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.updateUserMetadata',\n url: `api/users/${encodeURIComponent(params.params.userId)}/usermetadata`,\n normalizedUrl: 'api/users/:userId/usermetadata',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static async setDefaultOrg(\n params: SetDefaultOrgRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.setDefaultOrg',\n url: `api/users/${encodeURIComponent(params.params.userId)}/organizations/${encodeURIComponent(params.params.orgId)}/default`,\n normalizedUrl: 'api/users/:userId/organizations/:orgId/default',\n type: 'patch',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static async removeUserFromOrganization(\n params: RemoveUserFromOrganizationRequest,\n ) {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.removeUserFromOrganization`,\n url: `api/users/${params.params.userId}/organization/${params.params.orgId}`,\n normalizedUrl: `api/users/:userId/organization/:orgId`,\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: {\n byEmail: params.params.byEmail,\n },\n responseType: 'none',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /**\n * Remove a stale organization assignment from a user at Auth0. Use it when\n * the organization has no row in the accounts database any more and only\n * the Auth0 membership is left. The endpoint refuses an organization that\n * still exists, thus `removeUserFromOrganization` stays the normal way.\n */\n public static async removeStaleOrganization(\n params: RemoveStaleOrganizationRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.removeStaleOrganization`,\n url: `api/users/${encodeURIComponent(params.params.userId)}/organization/${encodeURIComponent(params.params.orgId)}/stale`,\n normalizedUrl: `api/users/:userId/organization/:orgId/stale`,\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'none',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /**\n * Update a user's role by adding or removing a single role.\n * This uses the PATCH /api/users/:userId/roles endpoint.\n * Supports email-based auth middleware via the x-camunda-email header.\n */\n public static async updateUserRole(\n params: UpdateUserRoleRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.updateUserRole`,\n url: `api/users/${encodeURIComponent(params.params.userId)}/roles`,\n normalizedUrl: `api/users/:userId/roles`,\n type: 'patch',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n // Validation\n UsersService.validateUserId(serviceContext, params.params.userId)\n\n if (!params.params.roleToAdd && !params.params.roleToRemove) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - either roleToAdd or roleToRemove must be specified`,\n 400,\n `Validation Error in API Package - either roleToAdd or roleToRemove must be specified`,\n )\n }\n\n const body: { roleToAdd?: string; roleToRemove?: string } = {}\n if (params.params.roleToAdd) {\n body.roleToAdd = params.params.roleToAdd\n }\n if (params.params.roleToRemove) {\n body.roleToRemove = params.params.roleToRemove\n }\n\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body,\n headers: params.headers,\n responseType: 'none',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /**\n * Get all Hibob users (for bulk ghost account checks).\n * This fetches all active Hibob employees in a single request.\n */\n public static async getAllHibobUsers(\n params: RequestBaseParams,\n ): Promise<HibobSearchResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.getAllHibobUsers',\n url: 'api/users/hibob/all',\n normalizedUrl: 'api/users/hibob/all',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request<HibobSearchResponse>({\n ...params,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body!\n }\n\n /**\n * Get Hibob details for a specific user by their Auth0 user ID.\n */\n public static async getUserHibobDetails(\n params: { userId: string } & RequestBaseParams,\n ): Promise<HibobSearchResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.getUserHibobDetails',\n url: `api/users/${encodeURIComponent(params.userId)}/hibob`,\n normalizedUrl: 'api/users/:userId/hibob',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request<HibobSearchResponse>({\n ...params,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body!\n }\n\n private static validateUserId(\n serviceContext: RequestBaseServiceContext,\n userId: string,\n ) {\n if (!userId || !userId.includes('|')) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - missing pipe '|'`,\n 400,\n `Validation Error in API Package - missing pipe '|'`,\n )\n }\n }\n\n private static validateEmail(\n serviceContext: RequestBaseServiceContext,\n email: string,\n ) {\n if (!email || !REGEX_EMAIL.test(email)) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - invalid email format`,\n 400,\n `Validation Error in API Package - invalid email format`,\n )\n }\n }\n\n /**\n * Validates a Lucene query string for Auth0 user search.\n * Auth0 supports Lucene query syntax including:\n * - Field queries: field:value (e.g., email:john@example.com)\n * - Wildcards: field:*value*, field:value*\n * - Boolean operators: AND, OR, NOT\n * - Grouping: (field:value OR field:value)\n * - Range queries: field:[min TO max]\n * - Exact phrase: field:\"exact phrase\"\n *\n * @see https://auth0.com/docs/manage-users/user-search/user-search-query-syntax\n */\n private static validateLuceneQuery(\n serviceContext: RequestBaseServiceContext,\n query: string,\n ) {\n if (!query || query.trim().length === 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - empty Lucene query`,\n 400,\n `Validation Error in API Package - empty Lucene query`,\n )\n }\n\n // Basic validation: query should contain at least a field:value pattern or be a valid search term\n // Auth0 Lucene syntax requires queries to have field:value format for structured searches\n const trimmedQuery = query.trim()\n\n // Check for unbalanced parentheses\n let parenCount = 0\n for (const char of trimmedQuery) {\n if (char === '(') parenCount++\n if (char === ')') parenCount--\n if (parenCount < 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - unbalanced parentheses in Lucene query`,\n 400,\n `Validation Error in API Package - unbalanced parentheses in Lucene query`,\n )\n }\n }\n if (parenCount !== 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - unbalanced parentheses in Lucene query`,\n 400,\n `Validation Error in API Package - unbalanced parentheses in Lucene query`,\n )\n }\n\n // Check for unbalanced square brackets (range queries)\n let bracketCount = 0\n for (const char of trimmedQuery) {\n if (char === '[') bracketCount++\n if (char === ']') bracketCount--\n if (bracketCount < 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - unbalanced brackets in Lucene query`,\n 400,\n `Validation Error in API Package - unbalanced brackets in Lucene query`,\n )\n }\n }\n if (bracketCount !== 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - unbalanced brackets in Lucene query`,\n 400,\n `Validation Error in API Package - unbalanced brackets in Lucene query`,\n )\n }\n\n // Check for unbalanced quotes\n const quoteCount = (trimmedQuery.match(/\"/gu) || []).length\n if (quoteCount % 2 !== 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - unbalanced quotes in Lucene query`,\n 400,\n `Validation Error in API Package - unbalanced quotes in Lucene query`,\n )\n }\n\n // Validate that query contains at least one valid field:value pattern or search term\n // A valid Lucene query for Auth0 should have field:value syntax\n // Use word boundary to match field:value patterns anywhere in the query\n const hasFieldValue = /\\b\\w+:/u.test(trimmedQuery)\n if (!hasFieldValue) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - Lucene query must contain field:value syntax (e.g., email:john@example.com)`,\n 400,\n `Validation Error in API Package - Lucene query must contain field:value syntax (e.g., email:john@example.com)`,\n )\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "AAMA;AAAA,EACE;AAAA,OAGK;AAKP,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAG1B,MAAM,YAAY,IAAI,MAAoB,IAAI,MAAM;AACpD,MAAM;AAAA;AAAA,EAEJ;AAAA;AAoFK,MAAM,aAAa;AAAA,EACxB,aAAoB,OAAO,QAAuC;AAChE,UAAM,cAAc,IAAI,gBAAgB;AACxC,UAAM,WAAqB,CAAC;AAC5B,QAAI,OAAO,OAAO,E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ACxB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI;AAAA,QAC7B;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAKA,UAAM,gBAAgB,UAAU,KAAK,YAAY;AACjD,QAAI,CAAC,eAAe;AAClB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI;AAAA,QAC7B;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
4
|
+
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nimport {\n MINUTE,\n type OrganizationRole,\n type User,\n} from '@camunda/ccma-shared-types'\nimport type {\n RequestBaseParams,\n RequestBaseServiceContext,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { Cache } from '../../utils/cache.js'\nimport { HttpError } from '../../utils/errors.js'\nimport type { HibobSearchResponse } from '../hibob/hibob.service.js'\n\nconst userCache = new Cache<string, User>(5 * MINUTE)\nconst REGEX_EMAIL =\n // eslint-disable-next-line prefer-named-capture-group, no-useless-escape\n /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/u\n\nexport interface SearchParams extends RequestBaseParams {\n params: {\n q: {\n organization?: {\n uuid: string\n member: boolean\n }\n name?: string\n userId?: string\n roleId?: string\n email?: string\n signUpStatus?: {\n verified: boolean\n tokenExpired?: boolean\n }\n created?: {\n after?: Date\n before?: Date\n }\n }\n onBehalfOf?: string\n }\n}\n\nexport interface SimpleSearchParams extends RequestBaseParams {\n params: {\n query: string\n type: 'by-email' | 'by-id' | 'fuzzy' | 'lucene'\n }\n}\n\nexport interface AddUserToOrganizationRequest extends RequestBaseParams {\n params: {\n userId: string\n orgId: string\n orgRoles: OrganizationRole[]\n byEmail?: boolean\n }\n}\n\nexport interface RemoveUserFromOrganizationRequest extends RequestBaseParams {\n params: {\n userId: string\n orgId: string\n byEmail?: boolean\n }\n}\n\nexport interface RemoveStaleOrganizationRequest extends RequestBaseParams {\n params: {\n userId: string\n orgId: string\n }\n}\n\nexport interface UpdateUserRoleRequest extends RequestBaseParams {\n params: {\n userId: string\n roleToAdd?: string\n roleToRemove?: string\n }\n headers?: {\n 'x-camunda-email'?: string\n }\n}\n\nexport interface ChangeUserEmailRequest extends RequestBaseParams {\n params: { userId: string; email: string }\n}\n\nexport interface ChangeUserNameRequest extends RequestBaseParams {\n params: { userId: string; firstname: string; lastname: string }\n}\n\nexport interface UserIdRequest extends RequestBaseParams {\n params: { userId: string }\n}\n\nexport interface DeleteMeRequest extends RequestBaseParams {\n params: { reason: string; explanation: string }\n}\n\nexport interface SetDefaultOrgRequest extends RequestBaseParams {\n params: { userId: string; orgId: string }\n}\n\nexport class UsersService {\n public static async search(params: SearchParams): Promise<User[]> {\n const queryParams = new URLSearchParams()\n const urlParts: string[] = []\n if (params.params.q.roleId) {\n // API route different if roleId is present\n // eslint-disable-next-line id-length\n const q = {\n roleId: params.params.q.roleId,\n name: params.params.q.name || '',\n email: params.params.q.email || '',\n }\n queryParams.append('q', JSON.stringify(q))\n urlParts.push(...['api', 'users', `?${queryParams.toString()}`])\n } else {\n if (params.params.onBehalfOf) {\n queryParams.append(\n 'onBehalfOf',\n encodeURI(JSON.stringify(params.params.onBehalfOf)),\n )\n }\n queryParams.append('q', encodeURI(JSON.stringify(params.params.q)))\n urlParts.push(...['api', 'users', 'search', `?${queryParams.toString()}`])\n }\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.search`,\n url: urlParts.join(`/`),\n normalizedUrl: `api/users/search`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n // Validation\n if (params.params.q.userId) {\n UsersService.validateUserId(serviceContext, params.params.q.userId)\n }\n\n const response = await request<User[]>({\n config: params.config,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async simpleSearch(\n params: SimpleSearchParams,\n ): Promise<{ users: User[] }> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.simpleSearch`,\n url: `api/users/search`,\n normalizedUrl: `api/users/search`,\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n switch (params.params.type) {\n case 'by-email':\n UsersService.validateEmail(serviceContext, params.params.query)\n break\n case 'by-id':\n UsersService.validateUserId(serviceContext, params.params.query)\n break\n case 'lucene':\n UsersService.validateLuceneQuery(serviceContext, params.params.query)\n break\n }\n\n const response = await request<{ users: User[] }>({\n config: params.config,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n body: {\n query: params.params.query,\n type: params.params.type,\n },\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async getUserInfo(\n params: {\n userId: string\n basic?: boolean\n roles?: boolean\n } & RequestBaseParams,\n ): Promise<User | undefined> {\n // `roles=true` asks the backend to enrich the user with its Auth0\n // platform (account-level) roles, which are omitted by default.\n const cacheKey = `${params.basic === true ? 'basic-' : ''}${\n params.roles === true ? 'roles-' : ''\n }${params.userId}`\n if (!params.cacheControl?.ignoreCache) {\n const inCache = userCache.get(cacheKey)\n if (inCache) {\n return inCache\n }\n }\n\n const searchParams = new URLSearchParams()\n if (params.basic === true) {\n searchParams.append('basic', 'true')\n }\n if (params.roles === true) {\n searchParams.append('roles', 'true')\n }\n const queryParams = searchParams.toString()\n ? `?${searchParams.toString()}`\n : ''\n\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.getUserInfo`,\n url: `api/users/${params.userId}${queryParams}`,\n normalizedUrl: `api/users/:userId`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n // Validation\n UsersService.validateUserId(serviceContext, params.userId)\n\n const response = await request<User>({\n ...params,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n userCache.set(cacheKey, response.body!)\n return response.body\n }\n\n public static async addUserToOrganization(\n params: AddUserToOrganizationRequest,\n ) {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.addUserToOrganization`,\n url: `api/users/${params.params.userId}/organization/${params.params.orgId}`,\n normalizedUrl: `api/users/:userId/organization/:orgId`,\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: {\n orgRoles: params.params.orgRoles,\n byEmail: params.params.byEmail,\n },\n responseType: 'none',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static async changeEmail(\n params: ChangeUserEmailRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.changeEmail',\n url: `api/users/${encodeURIComponent(params.params.userId)}/email`,\n normalizedUrl: 'api/users/:userId/email',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: { email: params.params.email },\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static async changeName(params: ChangeUserNameRequest): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.changeName',\n url: `api/users/${encodeURIComponent(params.params.userId)}/name`,\n normalizedUrl: 'api/users/:userId/name',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: {\n firstname: params.params.firstname,\n lastname: params.params.lastname,\n },\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /** Admin-activate a user without an email token (POST api/admin/activate). */\n public static async activateWithoutToken(\n params: UserIdRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.activateWithoutToken',\n url: 'api/admin/activate',\n normalizedUrl: 'api/admin/activate',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: { userId: params.params.userId },\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /** Refresh the verification token and resend the welcome mail. */\n public static async resendWelcomeMail(params: UserIdRequest): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.resendWelcomeMail',\n url: 'api/admin/resend-welcome-mail',\n normalizedUrl: 'api/admin/resend-welcome-mail',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: { userId: params.params.userId },\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static async deleteUser(params: UserIdRequest): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.deleteUser',\n url: `api/users/${encodeURIComponent(params.params.userId)}`,\n normalizedUrl: 'api/users/:userId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /**\n * Delete the account of the caller (self-service `DELETE api/users/me`).\n * The route reads the caller from the token, so it needs no `userId`.\n *\n * The backend reads the body field `explaination`, not `explanation`. This\n * method keeps the misspelling only in the request body, not in its own\n * parameter name.\n */\n public static async deleteMe(params: DeleteMeRequest): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.deleteMe',\n url: 'api/users/me',\n normalizedUrl: 'api/users/me',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: {\n reason: params.params.reason,\n explaination: params.params.explanation,\n },\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /**\n * Auth0 brute-force blocks for a user (`GET api/users/:userId/blocks`). The\n * entries are Auth0's block records (identifier/IP), returned opaque for the\n * caller to render.\n */\n public static async getBlocks(params: UserIdRequest): Promise<unknown[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.getBlocks',\n url: `api/users/${encodeURIComponent(params.params.userId)}/blocks`,\n normalizedUrl: 'api/users/:userId/blocks',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request<unknown[]>({\n ...params,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body ?? []\n }\n\n /** Clear a user's Auth0 blocks (`DELETE api/users/:userId/blocks`). */\n public static async clearBlocks(params: UserIdRequest): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.clearBlocks',\n url: `api/users/${encodeURIComponent(params.params.userId)}/blocks`,\n normalizedUrl: 'api/users/:userId/blocks',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /** Replace a user's Auth0 `app_metadata` (god-gated raw JSON edit). */\n public static async updateAppMetadata(\n params: {\n params: { userId: string }\n body: { appMetadata: object }\n } & RequestBaseParams,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.updateAppMetadata',\n url: `api/users/${encodeURIComponent(params.params.userId)}/appmetadata`,\n normalizedUrl: 'api/users/:userId/appmetadata',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /** Replace a user's Auth0 `user_metadata` (god-gated raw JSON edit). */\n public static async updateUserMetadata(\n params: {\n params: { userId: string }\n body: { userMetadata: object }\n } & RequestBaseParams,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.updateUserMetadata',\n url: `api/users/${encodeURIComponent(params.params.userId)}/usermetadata`,\n normalizedUrl: 'api/users/:userId/usermetadata',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static async setDefaultOrg(\n params: SetDefaultOrgRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.setDefaultOrg',\n url: `api/users/${encodeURIComponent(params.params.userId)}/organizations/${encodeURIComponent(params.params.orgId)}/default`,\n normalizedUrl: 'api/users/:userId/organizations/:orgId/default',\n type: 'patch',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'none',\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static async removeUserFromOrganization(\n params: RemoveUserFromOrganizationRequest,\n ) {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.removeUserFromOrganization`,\n url: `api/users/${params.params.userId}/organization/${params.params.orgId}`,\n normalizedUrl: `api/users/:userId/organization/:orgId`,\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: {\n byEmail: params.params.byEmail,\n },\n responseType: 'none',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /**\n * Remove a stale organization assignment from a user at Auth0. Use it when\n * the organization has no row in the accounts database any more and only\n * the Auth0 membership is left. The endpoint refuses an organization that\n * still exists, thus `removeUserFromOrganization` stays the normal way.\n */\n public static async removeStaleOrganization(\n params: RemoveStaleOrganizationRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.removeStaleOrganization`,\n url: `api/users/${encodeURIComponent(params.params.userId)}/organization/${encodeURIComponent(params.params.orgId)}/stale`,\n normalizedUrl: `api/users/:userId/organization/:orgId/stale`,\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'none',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /**\n * Update a user's role by adding or removing a single role.\n * This uses the PATCH /api/users/:userId/roles endpoint.\n * Supports email-based auth middleware via the x-camunda-email header.\n */\n public static async updateUserRole(\n params: UpdateUserRoleRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `UsersService.updateUserRole`,\n url: `api/users/${encodeURIComponent(params.params.userId)}/roles`,\n normalizedUrl: `api/users/:userId/roles`,\n type: 'patch',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n // Validation\n UsersService.validateUserId(serviceContext, params.params.userId)\n\n if (!params.params.roleToAdd && !params.params.roleToRemove) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - either roleToAdd or roleToRemove must be specified`,\n 400,\n `Validation Error in API Package - either roleToAdd or roleToRemove must be specified`,\n )\n }\n\n const body: { roleToAdd?: string; roleToRemove?: string } = {}\n if (params.params.roleToAdd) {\n body.roleToAdd = params.params.roleToAdd\n }\n if (params.params.roleToRemove) {\n body.roleToRemove = params.params.roleToRemove\n }\n\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body,\n headers: params.headers,\n responseType: 'none',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /**\n * Get all Hibob users (for bulk ghost account checks).\n * This fetches all active Hibob employees in a single request.\n */\n public static async getAllHibobUsers(\n params: RequestBaseParams,\n ): Promise<HibobSearchResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.getAllHibobUsers',\n url: 'api/users/hibob/all',\n normalizedUrl: 'api/users/hibob/all',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request<HibobSearchResponse>({\n ...params,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body!\n }\n\n /**\n * Get Hibob details for a specific user by their Auth0 user ID.\n */\n public static async getUserHibobDetails(\n params: { userId: string } & RequestBaseParams,\n ): Promise<HibobSearchResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'UsersService.getUserHibobDetails',\n url: `api/users/${encodeURIComponent(params.userId)}/hibob`,\n normalizedUrl: 'api/users/:userId/hibob',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request<HibobSearchResponse>({\n ...params,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body!\n }\n\n private static validateUserId(\n serviceContext: RequestBaseServiceContext,\n userId: string,\n ) {\n if (!userId || !userId.includes('|')) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - missing pipe '|'`,\n 400,\n `Validation Error in API Package - missing pipe '|'`,\n )\n }\n }\n\n private static validateEmail(\n serviceContext: RequestBaseServiceContext,\n email: string,\n ) {\n if (!email || !REGEX_EMAIL.test(email)) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - invalid email format`,\n 400,\n `Validation Error in API Package - invalid email format`,\n )\n }\n }\n\n /**\n * Validates a Lucene query string for Auth0 user search.\n * Auth0 supports Lucene query syntax including:\n * - Field queries: field:value (e.g., email:john@example.com)\n * - Wildcards: field:*value*, field:value*\n * - Boolean operators: AND, OR, NOT\n * - Grouping: (field:value OR field:value)\n * - Range queries: field:[min TO max]\n * - Exact phrase: field:\"exact phrase\"\n *\n * @see https://auth0.com/docs/manage-users/user-search/user-search-query-syntax\n */\n private static validateLuceneQuery(\n serviceContext: RequestBaseServiceContext,\n query: string,\n ) {\n if (!query || query.trim().length === 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - empty Lucene query`,\n 400,\n `Validation Error in API Package - empty Lucene query`,\n )\n }\n\n // Basic validation: query should contain at least a field:value pattern or be a valid search term\n // Auth0 Lucene syntax requires queries to have field:value format for structured searches\n const trimmedQuery = query.trim()\n\n // Check for unbalanced parentheses\n let parenCount = 0\n for (const char of trimmedQuery) {\n if (char === '(') parenCount++\n if (char === ')') parenCount--\n if (parenCount < 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - unbalanced parentheses in Lucene query`,\n 400,\n `Validation Error in API Package - unbalanced parentheses in Lucene query`,\n )\n }\n }\n if (parenCount !== 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - unbalanced parentheses in Lucene query`,\n 400,\n `Validation Error in API Package - unbalanced parentheses in Lucene query`,\n )\n }\n\n // Check for unbalanced square brackets (range queries)\n let bracketCount = 0\n for (const char of trimmedQuery) {\n if (char === '[') bracketCount++\n if (char === ']') bracketCount--\n if (bracketCount < 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - unbalanced brackets in Lucene query`,\n 400,\n `Validation Error in API Package - unbalanced brackets in Lucene query`,\n )\n }\n }\n if (bracketCount !== 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - unbalanced brackets in Lucene query`,\n 400,\n `Validation Error in API Package - unbalanced brackets in Lucene query`,\n )\n }\n\n // Check for unbalanced quotes\n const quoteCount = (trimmedQuery.match(/\"/gu) || []).length\n if (quoteCount % 2 !== 0) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - unbalanced quotes in Lucene query`,\n 400,\n `Validation Error in API Package - unbalanced quotes in Lucene query`,\n )\n }\n\n // Validate that query contains at least one valid field:value pattern or search term\n // A valid Lucene query for Auth0 should have field:value syntax\n // Use word boundary to match field:value patterns anywhere in the query\n const hasFieldValue = /\\b\\w+:/u.test(trimmedQuery)\n if (!hasFieldValue) {\n throw new HttpError(\n `${serviceContext.method.name}: 400 - Validation Error in API Package - Lucene query must contain field:value syntax (e.g., email:john@example.com)`,\n 400,\n `Validation Error in API Package - Lucene query must contain field:value syntax (e.g., email:john@example.com)`,\n )\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAMA;AAAA,EACE;AAAA,OAGK;AAKP,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAG1B,MAAM,YAAY,IAAI,MAAoB,IAAI,MAAM;AACpD,MAAM;AAAA;AAAA,EAEJ;AAAA;AAwFK,MAAM,aAAa;AAAA,EACxB,aAAoB,OAAO,QAAuC;AAChE,UAAM,cAAc,IAAI,gBAAgB;AACxC,UAAM,WAAqB,CAAC;AAC5B,QAAI,OAAO,OAAO,EAAE,QAAQ;AAG1B,YAAM,IAAI;AAAA,QACR,QAAQ,OAAO,OAAO,EAAE;AAAA,QACxB,MAAM,OAAO,OAAO,EAAE,QAAQ;AAAA,QAC9B,OAAO,OAAO,OAAO,EAAE,SAAS;AAAA,MAClC;AACA,kBAAY,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC;AACzC,eAAS,KAAK,GAAG,CAAC,OAAO,SAAS,IAAI,YAAY,SAAS,CAAC,EAAE,CAAC;AAAA,IACjE,OAAO;AACL,UAAI,OAAO,OAAO,YAAY;AAC5B,oBAAY;AAAA,UACV;AAAA,UACA,UAAU,KAAK,UAAU,OAAO,OAAO,UAAU,CAAC;AAAA,QACpD;AAAA,MACF;AACA,kBAAY,OAAO,KAAK,UAAU,KAAK,UAAU,OAAO,OAAO,CAAC,CAAC,CAAC;AAClE,eAAS,KAAK,GAAG,CAAC,OAA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ACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AACA,QAAI,iBAAiB,GAAG;AACtB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI;AAAA,QAC7B;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAGA,UAAM,cAAc,aAAa,MAAM,KAAK,KAAK,CAAC,GAAG;AACrD,QAAI,aAAa,MAAM,GAAG;AACxB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI;AAAA,QAC7B;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAKA,UAAM,gBAAgB,UAAU,KAAK,YAAY;AACjD,QAAI,CAAC,eAAe;AAClB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI;AAAA,QAC7B;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import type { ExternalOrganizationDto } from '@camunda/ccma-shared-types';
|
|
1
|
+
import type { ExternalOrganizationDto, Features } from '@camunda/ccma-shared-types';
|
|
2
2
|
import type { RequestBaseParams } from '../../types/general.types.js';
|
|
3
3
|
export type UserThemePreference = 'light' | 'dark' | 'system';
|
|
4
4
|
export interface UpdateUserThemeParams extends RequestBaseParams {
|
|
5
5
|
theme: UserThemePreference;
|
|
6
6
|
}
|
|
7
|
+
export interface GetFeatureFlagsParams extends RequestBaseParams {
|
|
8
|
+
params?: {
|
|
9
|
+
/**
|
|
10
|
+
* The organization to evaluate the org-scoped flags for. Omit it before
|
|
11
|
+
* the user selects an organization. The caller must be a member, because
|
|
12
|
+
* the backend answers 403 for every other organization.
|
|
13
|
+
*/
|
|
14
|
+
orgId?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
7
17
|
/**
|
|
8
18
|
* Accounts backend **external** (CORS-enabled) endpoints used to build webapp
|
|
9
19
|
* navigation. Distinct from `OrgsService`/`UsersService`, which target the
|
|
@@ -18,6 +28,16 @@ export declare class ExternalAccountsService {
|
|
|
18
28
|
* organization switcher.
|
|
19
29
|
*/
|
|
20
30
|
static getMyOrganizations(params: RequestBaseParams): Promise<ExternalOrganizationDto[]>;
|
|
31
|
+
/**
|
|
32
|
+
* The evaluated feature flags for the current user
|
|
33
|
+
* (`GET external/feature-flags`). The deployed accounts-backend decides the
|
|
34
|
+
* values, thus a host does not hold a copy of the rules.
|
|
35
|
+
*
|
|
36
|
+
* The stage of the flags is the stage of the backend that answers, not the
|
|
37
|
+
* stage that the client thinks it runs on. The email comes from the access
|
|
38
|
+
* token alone.
|
|
39
|
+
*/
|
|
40
|
+
static getFeatureFlags(params: GetFeatureFlagsParams): Promise<Features>;
|
|
21
41
|
/**
|
|
22
42
|
* Persist the user's theme preference (`PATCH external/user/theme`). The
|
|
23
43
|
* backend stores it on the user profile and reflects it in the next access
|
|
@@ -37,6 +37,47 @@ class ExternalAccountsService {
|
|
|
37
37
|
}
|
|
38
38
|
return response.body ?? [];
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* The evaluated feature flags for the current user
|
|
42
|
+
* (`GET external/feature-flags`). The deployed accounts-backend decides the
|
|
43
|
+
* values, thus a host does not hold a copy of the rules.
|
|
44
|
+
*
|
|
45
|
+
* The stage of the flags is the stage of the backend that answers, not the
|
|
46
|
+
* stage that the client thinks it runs on. The email comes from the access
|
|
47
|
+
* token alone.
|
|
48
|
+
*/
|
|
49
|
+
static async getFeatureFlags(params) {
|
|
50
|
+
const orgId = params.params?.orgId;
|
|
51
|
+
const serviceContext = {
|
|
52
|
+
method: {
|
|
53
|
+
name: "ExternalAccountsService.getFeatureFlags",
|
|
54
|
+
url: orgId ? `external/feature-flags?orgId=${encodeURIComponent(orgId)}` : "external/feature-flags",
|
|
55
|
+
normalizedUrl: "external/feature-flags",
|
|
56
|
+
type: "get"
|
|
57
|
+
},
|
|
58
|
+
source: params.config.metrics?.source || "unset",
|
|
59
|
+
target: {
|
|
60
|
+
name: "accounts",
|
|
61
|
+
type: "internal"
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const response = await request({
|
|
65
|
+
config: params.config,
|
|
66
|
+
base: { id: "accounts" },
|
|
67
|
+
url: serviceContext.method.url,
|
|
68
|
+
method: serviceContext.method.type,
|
|
69
|
+
metricsDetails: serviceContext,
|
|
70
|
+
responseType: "json"
|
|
71
|
+
});
|
|
72
|
+
if (!response.ok || !response.body) {
|
|
73
|
+
throw new HttpError(
|
|
74
|
+
`${serviceContext.method.name}: ${response.status} ${response.statusText}`,
|
|
75
|
+
response.status,
|
|
76
|
+
response.statusText
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return response.body;
|
|
80
|
+
}
|
|
40
81
|
/**
|
|
41
82
|
* Persist the user's theme preference (`PATCH external/user/theme`). The
|
|
42
83
|
* backend stores it on the user profile and reflects it in the next access
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/services/external/external.accounts.service.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nimport type {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nimport type {\n ExternalOrganizationDto,\n Features,\n} from '@camunda/ccma-shared-types'\nimport type {\n RequestBaseParams,\n RequestBaseServiceContext,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { HttpError } from '../../utils/errors.js'\n\nexport type UserThemePreference = 'light' | 'dark' | 'system'\n\nexport interface UpdateUserThemeParams extends RequestBaseParams {\n theme: UserThemePreference\n}\n\nexport interface GetFeatureFlagsParams extends RequestBaseParams {\n params?: {\n /**\n * The organization to evaluate the org-scoped flags for. Omit it before\n * the user selects an organization. The caller must be a member, because\n * the backend answers 403 for every other organization.\n */\n orgId?: string\n }\n}\n\n/**\n * Accounts backend **external** (CORS-enabled) endpoints used to build webapp\n * navigation. Distinct from `OrgsService`/`UsersService`, which target the\n * internal accounts API with admin-scoped DTOs. Use this from any Camunda\n * webapp (console, modeler, operate, \u2026); use the internal services from\n * console/accounts' own admin surfaces.\n */\nexport class ExternalAccountsService {\n /**\n * Organizations the current user belongs to\n * (`GET external/organizations/my`). Source for the org breadcrumb and the\n * organization switcher.\n */\n public static async getMyOrganizations(\n params: RequestBaseParams,\n ): Promise<ExternalOrganizationDto[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ExternalAccountsService.getMyOrganizations',\n url: 'external/organizations/my',\n normalizedUrl: 'external/organizations/my',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request<ExternalOrganizationDto[]>({\n ...params,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body ?? []\n }\n\n /**\n * The evaluated feature flags for the current user\n * (`GET external/feature-flags`). The deployed accounts-backend decides the\n * values, thus a host does not hold a copy of the rules.\n *\n * The stage of the flags is the stage of the backend that answers, not the\n * stage that the client thinks it runs on. The email comes from the access\n * token alone.\n */\n public static async getFeatureFlags(\n params: GetFeatureFlagsParams,\n ): Promise<Features> {\n const orgId = params.params?.orgId\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ExternalAccountsService.getFeatureFlags',\n url: orgId\n ? `external/feature-flags?orgId=${encodeURIComponent(orgId)}`\n : 'external/feature-flags',\n normalizedUrl: 'external/feature-flags',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request<Features>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n /**\n * Persist the user's theme preference (`PATCH external/user/theme`). The\n * backend stores it on the user profile and reflects it in the next access\n * token's `https://camunda.com/settings.theme` claim. Response is empty.\n */\n public static async updateUserTheme(\n params: UpdateUserThemeParams,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ExternalAccountsService.updateUserTheme',\n url: 'external/user/theme',\n normalizedUrl: 'external/user/theme',\n type: 'patch',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n\n const response = await request({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: { theme: params.theme },\n responseType: 'none',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAcA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AA0BnB,MAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnC,aAAoB,mBAClB,QACoC;AACpC,UAAM,iBAA4C;AAAA,MAChD,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,KAAK;AAAA,QACL,eAAe;AAAA,QACf,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,OAAO,OAAO,SAAS,UAAU;AAAA,MACzC,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAEA,UAAM,WAAW,MAAM,QAAmC;AAAA,MACxD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AA;AAAA;AAAA,EAOA,aAAoB,gBAClB,QACe;AACf,UAAM,iBAA4C;AAAA,MAChD,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,KAAK;AAAA,QACL,eAAe;AAAA,QACf,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,OAAO,OAAO,SAAS,UAAU;AAAA,MACzC,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAEA,UAAM,WAAW,MAAM,QAAQ;AAAA,MAC7B,QAAQ,OAAO;AAAA,MACf,MAAM,EAAE,IAAI,WAAW;AAAA,MACvB,KAAK,eAAe,OAAO;AAAA,MAC3B,QAAQ,eAAe,OAAO;AAAA,MAC9B,gBAAgB;AAAA,MAChB,MAAM,EAAE,OAAO,OAAO,MAAM;AAAA,MAC5B,cAAc;AAAA,IAChB,CAAC;AAED,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI,KAAK,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,QACxE,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { RequestBaseParams } from '../../types/general.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Fields that every key management route of OpenRouter returns for a key.
|
|
4
|
+
*
|
|
5
|
+
* OpenRouter addresses a key by its `hash`, never by the key itself. The key
|
|
6
|
+
* comes back exactly once, from the create route. Thus the caller must persist
|
|
7
|
+
* the hash together with the key. Without the hash, the key cannot be read,
|
|
8
|
+
* disabled or deleted.
|
|
9
|
+
*
|
|
10
|
+
* `usage` and `limit` hold USD credits. They are the OpenRouter names for the
|
|
11
|
+
* `spend` and `max_budget` of LiteLLM.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Number of keys that `GET /keys` gives back in one page.
|
|
15
|
+
*
|
|
16
|
+
* A caller that scans for a key must step `offset` by this number. The
|
|
17
|
+
* integration writes one key per org, so a real account holds more keys than
|
|
18
|
+
* one page.
|
|
19
|
+
*/
|
|
20
|
+
export declare const OPENROUTER_KEY_PAGE_SIZE = 100;
|
|
21
|
+
export interface OpenRouterKeyData {
|
|
22
|
+
/** Identifier of the key for every management route. */
|
|
23
|
+
hash: string;
|
|
24
|
+
/** Name of the key. This service writes `org-<orgId>` into it. */
|
|
25
|
+
name?: string;
|
|
26
|
+
/** Label of the key, which OpenRouter derives from the name. */
|
|
27
|
+
label?: string;
|
|
28
|
+
/** Credit limit in USD. `null` means no limit. */
|
|
29
|
+
limit?: number | null;
|
|
30
|
+
/** Credits spent in USD. */
|
|
31
|
+
usage?: number;
|
|
32
|
+
/** True when the key is disabled and rejects inference requests. */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
created_at?: string;
|
|
35
|
+
updated_at?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Fields that OpenRouter sends and this service does not model, such as
|
|
38
|
+
* `limit_remaining` and the `usage_daily` family. `unknown` keeps them
|
|
39
|
+
* readable and makes a caller narrow the type first.
|
|
40
|
+
*/
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Common options of every key management request.
|
|
45
|
+
*
|
|
46
|
+
* The token is a Provisioning API key. An inference key cannot read or write
|
|
47
|
+
* other keys.
|
|
48
|
+
*/
|
|
49
|
+
interface OpenRouterRequestOptions {
|
|
50
|
+
/** Base URL of the OpenRouter API, including the `/api/v1` prefix. */
|
|
51
|
+
openRouterApiBaseUrl: string;
|
|
52
|
+
/** Provisioning API key for authentication. */
|
|
53
|
+
apiToken: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Request to create a key
|
|
57
|
+
* POST /keys
|
|
58
|
+
*/
|
|
59
|
+
export interface CreateOpenRouterKeyRequest extends RequestBaseParams {
|
|
60
|
+
options: OpenRouterRequestOptions & {
|
|
61
|
+
/** Name of the key. Used to find the key again if the hash is lost. */
|
|
62
|
+
name: string;
|
|
63
|
+
/** Credit limit in USD. */
|
|
64
|
+
limit?: number;
|
|
65
|
+
/** When false, credits of a customer-owned provider key do not count. */
|
|
66
|
+
include_byok_in_limit?: boolean;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Response from creating a key.
|
|
71
|
+
*
|
|
72
|
+
* `key` holds the inference credential and OpenRouter returns it only here.
|
|
73
|
+
* `data.hash` is the handle for every later request about this key.
|
|
74
|
+
*/
|
|
75
|
+
export interface CreateOpenRouterKeyResponse {
|
|
76
|
+
key: string;
|
|
77
|
+
data: OpenRouterKeyData;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Request to read one key
|
|
81
|
+
* GET /keys/{hash}
|
|
82
|
+
*/
|
|
83
|
+
export interface GetOpenRouterKeyRequest extends RequestBaseParams {
|
|
84
|
+
options: OpenRouterRequestOptions & {
|
|
85
|
+
/** Hash of the key to read. */
|
|
86
|
+
hash: string;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Response from reading one key
|
|
91
|
+
*/
|
|
92
|
+
export interface GetOpenRouterKeyResponse {
|
|
93
|
+
data: OpenRouterKeyData;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Request to update a key
|
|
97
|
+
* PATCH /keys/{hash}
|
|
98
|
+
*/
|
|
99
|
+
export interface UpdateOpenRouterKeyRequest extends RequestBaseParams {
|
|
100
|
+
options: OpenRouterRequestOptions & {
|
|
101
|
+
/** Hash of the key to update. */
|
|
102
|
+
hash: string;
|
|
103
|
+
/** New name of the key. */
|
|
104
|
+
name?: string;
|
|
105
|
+
/** True disables the key. False enables it again. */
|
|
106
|
+
disabled?: boolean;
|
|
107
|
+
/** New credit limit in USD. */
|
|
108
|
+
limit?: number;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Response from updating a key
|
|
113
|
+
*/
|
|
114
|
+
export interface UpdateOpenRouterKeyResponse {
|
|
115
|
+
data: OpenRouterKeyData;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Request to delete a key
|
|
119
|
+
* DELETE /keys/{hash}
|
|
120
|
+
*/
|
|
121
|
+
export interface DeleteOpenRouterKeyRequest extends RequestBaseParams {
|
|
122
|
+
options: OpenRouterRequestOptions & {
|
|
123
|
+
/** Hash of the key to delete. */
|
|
124
|
+
hash: string;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Response from deleting a key
|
|
129
|
+
*/
|
|
130
|
+
export interface DeleteOpenRouterKeyResponse {
|
|
131
|
+
/** True when OpenRouter removed the key. */
|
|
132
|
+
deleted?: boolean;
|
|
133
|
+
/** Fields that OpenRouter sends and this service does not model. */
|
|
134
|
+
[key: string]: unknown;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Request to list keys
|
|
138
|
+
* GET /keys
|
|
139
|
+
*/
|
|
140
|
+
export interface ListOpenRouterKeysRequest extends RequestBaseParams {
|
|
141
|
+
options: OpenRouterRequestOptions & {
|
|
142
|
+
/** Number of keys to skip. OpenRouter returns 100 keys per page. */
|
|
143
|
+
offset?: number;
|
|
144
|
+
/** When true, disabled keys are part of the result. */
|
|
145
|
+
includeDisabled?: boolean;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Response from listing keys
|
|
150
|
+
*/
|
|
151
|
+
export interface ListOpenRouterKeysResponse {
|
|
152
|
+
data: OpenRouterKeyData[];
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Service for the key management API of OpenRouter.
|
|
156
|
+
*
|
|
157
|
+
* API documentation: https://openrouter.ai/docs/features/provisioning-api-keys
|
|
158
|
+
*
|
|
159
|
+
* This is the OpenRouter counterpart of `LiteLLMService`. Two differences
|
|
160
|
+
* shape every method:
|
|
161
|
+
*
|
|
162
|
+
* - OpenRouter has no teams. One key per org carries the whole budget, and
|
|
163
|
+
* the name of the key holds the org id.
|
|
164
|
+
* - OpenRouter addresses a key by hash. LiteLLM addressed a key by its value.
|
|
165
|
+
*/
|
|
166
|
+
export declare class OpenRouterService {
|
|
167
|
+
/**
|
|
168
|
+
* Create a key
|
|
169
|
+
* POST /keys
|
|
170
|
+
*/
|
|
171
|
+
static createKey(params: CreateOpenRouterKeyRequest): Promise<CreateOpenRouterKeyResponse>;
|
|
172
|
+
/**
|
|
173
|
+
* Read one key, with its credit usage and limit
|
|
174
|
+
* GET /keys/{hash}
|
|
175
|
+
*/
|
|
176
|
+
static getKey(params: GetOpenRouterKeyRequest): Promise<GetOpenRouterKeyResponse>;
|
|
177
|
+
/**
|
|
178
|
+
* Update the name, the disabled state or the credit limit of a key.
|
|
179
|
+
*
|
|
180
|
+
* OpenRouter has no separate block, unblock or budget route. All three are
|
|
181
|
+
* this one PATCH with a different field.
|
|
182
|
+
* PATCH /keys/{hash}
|
|
183
|
+
*/
|
|
184
|
+
static updateKey(params: UpdateOpenRouterKeyRequest): Promise<UpdateOpenRouterKeyResponse>;
|
|
185
|
+
/**
|
|
186
|
+
* Delete a key
|
|
187
|
+
* DELETE /keys/{hash}
|
|
188
|
+
*/
|
|
189
|
+
static deleteKey(params: DeleteOpenRouterKeyRequest): Promise<DeleteOpenRouterKeyResponse>;
|
|
190
|
+
/**
|
|
191
|
+
* List keys, newest first.
|
|
192
|
+
*
|
|
193
|
+
* This is the recovery path for a key whose hash is not in the metadata of
|
|
194
|
+
* the org. The name of the key holds the org id, so a caller can match on
|
|
195
|
+
* it. OpenRouter returns 100 keys per page. Use `offset` for the next page.
|
|
196
|
+
* GET /keys
|
|
197
|
+
*/
|
|
198
|
+
static listKeys(params: ListOpenRouterKeysRequest): Promise<ListOpenRouterKeysResponse>;
|
|
199
|
+
}
|
|
200
|
+
export {};
|