@camunda/ccma-api 13.2.2 → 13.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/services/control/control.leaflets.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 {\n CreateLeafletRequest,\n LeafletDto,\n LeafletSummaryDto,\n UpdateLeafletRequest,\n} from '@camunda/ccma-shared-types'\nimport type {\n RequestBaseMethodType,\n RequestBaseParams,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { HttpError } from '../../utils/errors.js'\n\n/**\n * The leaflets of control-backend: pages of HTML and CSS that a Camundi or a\n * bot stores, and that a Camundi with `admin.readAll` can open.
|
|
5
|
-
"mappings": "AAgBA,SAAS,eAAe;AACxB,SAAS,iBAAiB;
|
|
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 CreateLeafletRequest,\n LeafletDto,\n LeafletSummaryDto,\n UpdateLeafletRequest,\n} from '@camunda/ccma-shared-types'\nimport type {\n RequestBaseMethodType,\n RequestBaseParams,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { HttpError } from '../../utils/errors.js'\n\n/**\n * The leaflets of control-backend: pages of HTML and CSS that a Camundi or a\n * bot stores, and that a Camundi with `admin.readAll` can open. A page can\n * hold inline scripts: show it only in a sandboxed frame with an opaque\n * origin (`allow-scripts`, never `allow-same-origin`). Every route answers 404\n * while the feature flag `control.leaflets` is off on the stage.\n */\n\nconst BASE = { id: 'control' } as const\n\nexport interface ListLeafletsRequest extends RequestBaseParams {\n params?: { limit?: number; offset?: number }\n}\n\nexport interface LeafletIdRequest extends RequestBaseParams {\n params: { id: string }\n}\n\nexport interface CreateLeafletParams extends RequestBaseParams {\n params: CreateLeafletRequest\n}\n\nexport interface UpdateLeafletParams extends RequestBaseParams {\n params: { id: string } & UpdateLeafletRequest\n}\n\nexport interface LeafletPageInfoDto {\n limit: number\n offset: number\n /** True when the next page holds more. Never read the length instead. */\n hasMore: boolean\n}\n\nexport interface LeafletPageDto {\n leaflets: LeafletSummaryDto[]\n page: LeafletPageInfoDto\n}\n\nexport class ControlLeafletsService {\n /** One page of the live leaflets, the newest change first. No HTML. */\n public static async list(\n params: ListLeafletsRequest,\n ): Promise<LeafletPageDto> {\n const query = new URLSearchParams()\n for (const [key, value] of Object.entries(params.params ?? {})) {\n if (value !== undefined) {\n query.set(key, String(value))\n }\n }\n const suffix = query.size > 0 ? `?${query.toString()}` : ''\n return ControlLeafletsService.send<LeafletPageDto>(\n params,\n 'list',\n `api/leaflets${suffix}`,\n 'api/leaflets',\n 'get',\n )\n }\n\n /** One live leaflet with its HTML. An expired leaflet answers 404. */\n public static async get(params: LeafletIdRequest): Promise<LeafletDto> {\n const { leaflet } = await ControlLeafletsService.send<{\n leaflet: LeafletDto\n }>(\n params,\n 'get',\n `api/leaflets/${encodeURIComponent(params.params.id)}`,\n 'api/leaflets/:id',\n 'get',\n )\n return leaflet\n }\n\n /** Stores a leaflet. Without `expiresAt` it expires in 30 days. */\n public static async create(params: CreateLeafletParams): Promise<LeafletDto> {\n const { leaflet } = await ControlLeafletsService.send<{\n leaflet: LeafletDto\n }>(params, 'create', 'api/leaflets', 'api/leaflets', 'post', params.params)\n return leaflet\n }\n\n /** Changes a leaflet. `expiresAt: null` means that it never expires. */\n public static async update(params: UpdateLeafletParams): Promise<LeafletDto> {\n const { id, ...patch } = params.params\n const { leaflet } = await ControlLeafletsService.send<{\n leaflet: LeafletDto\n }>(\n params,\n 'update',\n `api/leaflets/${encodeURIComponent(id)}`,\n 'api/leaflets/:id',\n 'patch',\n patch,\n )\n return leaflet\n }\n\n /** Deletes a leaflet. Humans only: a machine token answers 403. */\n public static async remove(params: LeafletIdRequest): Promise<void> {\n await ControlLeafletsService.send<undefined>(\n params,\n 'remove',\n `api/leaflets/${encodeURIComponent(params.params.id)}`,\n 'api/leaflets/:id',\n 'delete',\n )\n }\n\n private static async send<TResponse>(\n params: RequestBaseParams,\n name: string,\n url: string,\n normalizedUrl: string,\n method: RequestBaseMethodType,\n body?: object,\n ): Promise<TResponse> {\n const serviceContext = {\n method: {\n name: `ControlLeafletsService.${name}`,\n url: normalizedUrl,\n normalizedUrl,\n type: method,\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'control', type: 'internal' as const },\n }\n const response = await request<TResponse>({\n ...params,\n config: params.config,\n base: BASE,\n url,\n logUrl: normalizedUrl,\n method,\n metricsDetails: serviceContext,\n body,\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 // `remove` answers 204 with no body. Its caller reads nothing.\n return response.body as TResponse\n }\n}\n"],
|
|
5
|
+
"mappings": "AAgBA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAU1B,MAAM,OAAO,EAAE,IAAI,UAAU;AA8BtB,MAAM,uBAAuB;AAAA;AAAA,EAElC,aAAoB,KAClB,QACyB;AACzB,UAAM,QAAQ,IAAI,gBAAgB;AAClC,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,UAAU,CAAC,CAAC,GAAG;AAC9D,UAAI,UAAU,QAAW;AACvB,cAAM,IAAI,KAAK,OAAO,KAAK,CAAC;AAAA,MAC9B;AAAA,IACF;AACA,UAAM,SAAS,MAAM,OAAO,IAAI,IAAI,MAAM,SAAS,CAAC,KAAK;AACzD,WAAO,uBAAuB;AAAA,MAC5B;AAAA,MACA;AAAA,MACA,eAAe,MAAM;AAAA,MACrB;AAAA,MACA;AAAA,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,MACA,QAAQ;AAAA,MACR;AAAA,MACA,gBAAgB;AAAA,MAChB;AAAA,IACF,CAAC;AACD,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;AAEA,WAAO,SAAS;AAAA,EAClB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/ccma-api",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.3",
|
|
4
4
|
"description": "Centralized API service layer for Camunda Cloud Management Apps",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@camunda/ccma-shared-types": "18.6.
|
|
44
|
+
"@camunda/ccma-shared-types": "18.6.1"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "node esbuild.mjs && tsc --emitDeclarationOnly --outDir dist",
|