Skip to content

Commit 5246539

Browse files
authored
Merge pull request #68 from Telefonica/feat/63/api-prefix
feat: Add confluence.apiPrefix option
2 parents a0c87be + aaf0cd1 commit 5246539

File tree

15 files changed

+137
-3
lines changed

15 files changed

+137
-3
lines changed

.github/CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,19 @@ pnpm nx test:unit child-process-manager
6464
To run a task in all components, use the following syntax: `pnpm nx run-many <task> --all`. For example, to run the unit tests in all components, use the following command:
6565

6666
```bash
67-
pnpm nx run-many test:unit --all
67+
pnpm nx run-many -t test:unit --all
6868
```
6969

7070
This will run the `test:unit` task in all components and also the corresponding dependencies, in the right order, so everything is built and tested correctly.
7171

72+
## Running all checks in all components
73+
74+
To run all checks in all components, use the following command:
75+
76+
```bash
77+
pnpm check:all
78+
```
79+
7280
# Branching model
7381

7482
Here you have an schema of the branching model used in this repository:

components/confluence-sync/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
#### Deprecated
1212
#### Removed
1313

14+
## [2.2.0] - 2025-11-24
15+
16+
### Added
17+
18+
* feat: Add apiPrefix option to configure the Confluence API prefix (default: /rest/).
19+
1420
## [2.1.0] - 2025-10-17
1521

1622
### Added

components/confluence-sync/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ await confluenceSyncPages.sync([
222222
The main class of the library. It receives a configuration object with the following properties:
223223

224224
* `url`: URL of the Confluence instance.
225+
* `apiPrefix`: Optional prefix for the Confluence API urls. Default is `/rest/`.
225226
* `personalAccessToken`: Personal access token to authenticate in Confluence. To be DEPRECATED in future versions. Use the `authentication` property instead.
226227
* `authentication`: Authentication options to access Confluence. It supports the following methods:
227228
* `oauth2`: OAuth2 authentication. It requires:

components/confluence-sync/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@telefonica/confluence-sync",
33
"description": "Creates/updates/deletes Confluence pages based on a list of objects containing the page contents. Supports nested pages and attachments upload",
4-
"version": "2.1.0",
4+
"version": "2.2.0",
55
"license": "Apache-2.0",
66
"author": "Telefónica Innovación Digital",
77
"repository": {

components/confluence-sync/src/ConfluenceSyncPages.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export const ConfluenceSyncPages: ConfluenceSyncPagesConstructor = class Conflue
5959
dryRun,
6060
syncMode,
6161
rootPageId,
62+
apiPrefix,
6263
}: ConfluenceSyncPagesConfig) {
6364
this._logger = new Logger(LOGGER_NAMESPACE, {
6465
level: logLevel ?? DEFAULT_LOG_LEVEL,
@@ -70,6 +71,7 @@ export const ConfluenceSyncPages: ConfluenceSyncPagesConstructor = class Conflue
7071
authentication,
7172
logger: this._logger.namespace("confluence"),
7273
dryRun,
74+
apiPrefix,
7375
});
7476
this._syncMode = syncMode ?? SyncModes.TREE;
7577

components/confluence-sync/src/ConfluenceSyncPages.types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export interface ConfluenceSyncPagesConfig {
6868
logLevel?: LogLevel;
6969
/** Dry run option */
7070
dryRun?: boolean;
71+
/** API Prefix */
72+
apiPrefix?: string;
7173
/** Sync mode */
7274
syncMode?: SyncModes;
7375
}

components/confluence-sync/src/confluence/CustomConfluenceClient.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ export const CustomConfluenceClient: ConfluenceClientConstructor = class CustomC
114114
},
115115
};
116116

117+
const apiPrefix = config.apiPrefix ?? "/rest/";
118+
117119
this._client = new ConfluenceClient({
118120
host: config.url,
119121
authentication,
120-
apiPrefix: "/rest/",
122+
apiPrefix,
121123
});
122124
this._logger = config.logger;
123125
}

components/confluence-sync/src/confluence/CustomConfluenceClient.types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ export interface ConfluenceClientConfig {
7373
authentication?: ConfluenceClientAuthenticationConfig;
7474
/** Confluence url */
7575
url: string;
76+
/** API Prefix */
77+
apiPrefix?: string;
7678
/** Confluence space id */
7779
spaceId: string;
7880
/** Logger */

components/confluence-sync/test/unit/specs/confluence/CustomConfluenceClient.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,35 @@ describe("customConfluenceClient class", () => {
130130
apiPrefix: "/rest/",
131131
});
132132
});
133+
134+
it("should set apiPrefix when provided", () => {
135+
const configWithBoth = {
136+
spaceId: "foo-space-id",
137+
url: "foo-url",
138+
personalAccessToken: "foo-token",
139+
authentication: {
140+
basic: {
141+
142+
apiToken: "basic-token",
143+
},
144+
},
145+
logger,
146+
apiPrefix: "/foo/",
147+
};
148+
149+
new CustomConfluenceClient(configWithBoth);
150+
151+
expect(ConfluenceClientConstructor).toHaveBeenCalledWith({
152+
host: "foo-url",
153+
authentication: {
154+
basic: {
155+
156+
apiToken: "basic-token",
157+
},
158+
},
159+
apiPrefix: "/foo/",
160+
});
161+
});
133162
});
134163

135164
describe("when using basic authentication", () => {

components/markdown-confluence-sync/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
#### Deprecated
1212
#### Removed
1313

14+
## Unreleased
15+
16+
#### Added
17+
18+
- feat(#63): Add apiPrefix option to configure the Confluence API prefix (default: /rest/).
19+
1420
## [2.2.0] - 2025-10-17
1521

1622
### Added

0 commit comments

Comments
 (0)