Skip to content

Commit d0f1292

Browse files
authored
Merge pull request #382 from camunda/fix-375
fix(camunda8): add optional tenantId to deployResourcesFromFiles fixes #375
2 parents 3a720a5 + faa9fac commit d0f1292

34 files changed

+35
-6
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
66

7+
Full API Docs are [here](https://camunda.github.io/camunda-8-js-sdk/).
8+
79
This is the official Camunda 8 JavaScript SDK. It is written in TypeScript and runs on Node.js. See why [this does not run in a web browser](https://github.com/camunda/camunda-8-js-sdk/issues/79).
810

9-
Full API Docs are [here](https://camunda.github.io/camunda-8-js-sdk/). See the QUICKSTART.md file in [the repository](https://github.com/camunda/camunda-8-js-sdk) for a quick start.
11+
See the QUICKSTART.md file in [the repository](https://github.com/camunda/camunda-8-js-sdk) for a quick start.
1012

1113
## What does "supported" mean?
1214

@@ -36,8 +38,9 @@ In this release, the functionality of Camunda 8 is exposed via dedicated clients
3638
import { Camunda8 } from '@camunda8/sdk'
3739

3840
const c8 = new Camunda8()
41+
const restClient = c8.getCamundaRestClient() // New REST API
3942
const zeebe = c8.getZeebeGrpcApiClient()
40-
const zeebeRest = c8.getZeebeRestClient()
43+
const zeebeRest = c8.getZeebeRestClient() // Deprecated
4144
const operate = c8.getOperateApiClient()
4245
const optimize = c8.getOptimizeApiClient()
4346
const tasklist = c8.getTasklistApiClient()

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"sm:start": "docker compose -f docker/docker-compose-multitenancy.yaml -f docker/docker-compose-modeler.yaml up -d",
1313
"sm:stop": "docker compose -f docker/docker-compose-multitenancy.yaml -f docker/docker-compose-modeler.yaml down && docker/cleanup-volumes.sh",
1414
"test": "cross-env CAMUNDA_UNIT_TEST=true jest '\\.unit\\.' -u --detectOpenHandles --runInBand --testPathIgnorePatterns integration --testPathIgnorePatterns local-integration --testPathIgnorePatterns disconnection --testPathIgnorePatterns multitenancy --testPathIgnorePatterns __tests__/config",
15-
"test:integration": "jest --runInBand --testPathIgnorePatterns disconnection --testPathIgnorePatterns '\\.unit\\.' --testPathIgnorePatterns __tests__/config --testPathIgnorePatterns multitenancy --detectOpenHandles --verbose true -u",
15+
"test:integration": "jest --runInBand --testPathIgnorePatterns disconnection --testPathIgnorePatterns '\\.unit\\.' --testPathIgnorePatterns __tests__/config --testPathIgnorePatterns __tests__/multitenancy --detectOpenHandles --verbose true -u",
1616
"test:multitenancy": "jest --runInBand --testPathIgnorePatterns disconnection --testPathIgnorePatterns admin --testPathIgnorePatterns '\\.unit\\.' --testPathIgnorePatterns __tests__/config - --detectOpenHandles --verbose true -u",
1717
"test:local": "jest --runInBand --verbose true --detectOpenHandles local-integration -u",
18-
"test:local-integration": "jest --runInBand --detectOpenHandles --verbose --testPathIgnorePatterns disconnection --testPathIgnorePatterns '\\.unit\\.' --testPathIgnorePatterns admin --testPathIgnorePatterns multitenancy --testPathIgnorePatterns __tests__/config -u",
18+
"test:local-integration": "jest --runInBand --detectOpenHandles --verbose --testPathIgnorePatterns disconnection --testPathIgnorePatterns '\\.unit\\.' --testPathIgnorePatterns admin --testPathIgnorePatterns --testPathIgnorePatterns __tests__/multitenancy --testPathIgnorePatterns __tests__/config -u",
1919
"test:docker": "jest --runInBand --testPathIgnorePatterns disconnection --testPathIgnorePatterns __tests__/config local-integration --detectOpenHandles --verbose true",
2020
"test:disconnect": "jest --runInBand --verbose true --detectOpenHandles --testPathIgnorePatterns __tests__/config disconnection",
2121
"test:smoketest": "npm run build && node smoke-test/smoke-test.js && npx tsd --typings dist/",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import path from 'node:path'
2+
3+
import { CamundaRestClient } from '../../../c8/lib/CamundaRestClient'
4+
5+
let processDefinitionId: string
6+
const restClient = new CamundaRestClient()
7+
8+
test('It can deploy with a specific tenantId', async () => {
9+
const res = await restClient.deployResourcesFromFiles(
10+
[
11+
path.join(
12+
'.',
13+
'src',
14+
'__tests__',
15+
'testdata',
16+
'hello-world-complete-rest.bpmn'
17+
),
18+
],
19+
{ tenantId: 'green' }
20+
)
21+
processDefinitionId = res.processes[0].processDefinitionId
22+
expect(processDefinitionId).toBeTruthy()
23+
})

src/c8/lib/CamundaRestClient.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,10 @@ export class CamundaRestClient {
851851
*
852852
* @since 8.6.0
853853
*/
854-
public async deployResourcesFromFiles(files: string[]) {
854+
public async deployResourcesFromFiles(
855+
files: string[],
856+
{ tenantId }: { tenantId?: string } = {}
857+
) {
855858
const resources: { content: string; name: string }[] = []
856859

857860
for (const file of files) {
@@ -861,7 +864,7 @@ export class CamundaRestClient {
861864
})
862865
}
863866

864-
return this.deployResources(resources)
867+
return this.deployResources(resources, tenantId ?? this.tenantId)
865868
}
866869

867870
/**

0 commit comments

Comments
 (0)