Skip to content

Commit a5d2810

Browse files
committed
docs: Update docs. Change E2E auth method to test warning
1 parent f7c98f6 commit a5d2810

File tree

8 files changed

+83
-31
lines changed

8 files changed

+83
-31
lines changed

components/confluence-sync/CHANGELOG.md

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

14-
## Unreleased
14+
## [2.1.0] - 2025-10-17
1515

1616
### Added
1717

1818
* feat: Add authentication options (OAuth2, Basic, JWT). Deprecate personalAccessToken.
1919

20+
### Changed
21+
22+
* chore: Update confluence.js to 2.1.0
23+
2024
## [2.0.2] - 2025-07-11
2125

2226
### Fixed

components/confluence-sync/README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This library requires:
4444

4545
* A Confluence instance.
4646
* The id of the Confluence space where the pages will be created.
47-
* A personal access token to authenticate. You can create a personal access token following the instructions in the [Atlassian documentation](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/).
47+
* Valid authentication credentials to access the Confluence instance. It uses the `confluence.js` library internally, so it supports the [same authentication methods](https://github.com/MrRefactoring/confluence.js?tab=readme-ov-file#authentication) as it.
4848

4949
### Compatibility
5050

@@ -68,7 +68,11 @@ import { ConfluenceSyncPages } from '@telefonica/confluence-sync';
6868

6969
const confluenceSyncPages = new ConfluenceSyncPages({
7070
url: "https://your.confluence.com",
71-
personalAccessToken: "*******",
71+
authentication: {
72+
oauth2: {
73+
accessToken: "your-oauth2-access-token"
74+
}
75+
},
7276
spaceId: "your-space-id",
7377
rootPageId: "12345678"
7478
logLevel: "debug",
@@ -191,7 +195,11 @@ import { ConfluenceSyncPages, SyncModes } from '@telefonica/confluence-sync';
191195

192196
const confluenceSyncPages = new ConfluenceSyncPages({
193197
url: "https://my.confluence.es",
194-
personalAccessToken: "*******",
198+
authentication: {
199+
oauth2: {
200+
accessToken: "my-oauth2-access-token"
201+
}
202+
},
195203
spaceId: "MY-SPACE",
196204
logLevel: "debug",
197205
dryRun: false,
@@ -214,7 +222,17 @@ await confluenceSyncPages.sync([
214222
The main class of the library. It receives a configuration object with the following properties:
215223

216224
* `url`: URL of the Confluence instance.
217-
* `personalAccessToken`: Personal access token to authenticate in Confluence.
225+
* `personalAccessToken`: Personal access token to authenticate in Confluence. To be DEPRECATED in future versions. Use the `authentication` property instead.
226+
* `authentication`: Authentication options to access Confluence. It supports the following methods:
227+
* `oauth2`: OAuth2 authentication. It requires:
228+
* `accessToken`: Access token to authenticate.
229+
* `basic`: Basic authentication.
230+
* `email`: Email of the user.
231+
* `apiToken`: API token to authenticate.
232+
* `jwt`: JWT authentication.
233+
* `issuer`: Issuer of the JWT.
234+
* `secret`: Secret to sign the JWT.
235+
* `expiryTimeSeconds`: Optional expiry time of the JWT in seconds.
218236
* `spaceId`: Key of the space where the pages will be created.
219237
* `rootPageId`: ID of the root page under the pages will be created. It only can be missing if the sync mode is `flat` and all the pages provided have an id.
220238
* `logLevel`: One of `silly`, `debug`, `info`, `warn`, `error` or `silent`. Default is `silent`.

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.0.2",
4+
"version": "2.1.0",
55
"license": "Apache-2.0",
66
"author": "Telefónica Innovación Digital",
77
"repository": {

components/markdown-confluence-sync/CHANGELOG.md

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

14+
## [2.2.0] - 2025-10-17
15+
16+
### Added
17+
18+
* feat: Update confluence-sync to 2.1.0. Add authentication options (OAuth2, Basic, JWT). Deprecate personalAccessToken.
19+
* feat: Add warning when using the deprecated personalAccessToken option.
20+
1421
## [2.1.1] - 2025-07-11
1522

1623
### Fixed

components/markdown-confluence-sync/README.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ In order to be able to sync the markdown files with Confluence, you need to have
5858

5959
* A [Confluence](https://www.atlassian.com/es/software/confluence) instance.
6060
* The id of the Confluence space where the pages will be created.
61-
* A personal access token to authenticate. You can create a personal access token following the instructions in the [Atlassian documentation](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/).
6261
* Markdown file or files to be synced with Confluence. It can be as complex as a Docusaurus project docs folder, or as simple as a single README.md file.
62+
* Valid authentication credentials to access the Confluence instance. It uses the `confluence.js` library internally, so it supports the [same authentication methods](https://github.com/MrRefactoring/confluence.js?tab=readme-ov-file#authentication) as it.
6363

6464
### Compatibility
6565

@@ -144,7 +144,11 @@ module.exports = {
144144
docsDir: "docs",
145145
confluence: {
146146
url: "https://my-confluence.es",
147-
personalAccessToken: "*******",
147+
authentication: {
148+
oauth2: {
149+
accessToken: "*******"
150+
}
151+
},
148152
spaceKey: "MY-SPACE",
149153
rootPageId: "my-root-page-id"
150154
}
@@ -254,7 +258,11 @@ module.exports = {
254258
filesPattern: "check*.{md,mdx}",
255259
confluence: {
256260
url: "https://my-confluence.es",
257-
personalAccessToken: "*******",
261+
authentication: {
262+
oauth2: {
263+
accessToken: "*******"
264+
}
265+
},
258266
spaceKey: "MY-SPACE",
259267
rootPageId: "my-root-page-id"
260268
}
@@ -276,7 +284,17 @@ The namespace for the configuration of this library is `markdown-confluence-sync
276284
| `filesMetadata` | `array` | Array of objects with the metadata of the files to sync. Each object must have the `path` property with the path of the file. For the rest of properties read the [Configuration per page](#configuration-per-page) section | |
277285
| `docsDir` | `string` | Path to the docs directory. | `./docs` |
278286
| `confluence.url` | `string` | URL of the Confluence instance. | |
279-
| `confluence.personalAccessToken` | `string` | Personal access token to authenticate against the Confluence instance. | |
287+
| `confluence.personalAccessToken` | `string` | Deprecated. Personal access token to authenticate against the Confluence instance. | |
288+
| `confluence.authentication` | `object` | Object containing authentication options to access the Confluence instance. It supports the same methods [as the `confluence.js` library](https://github.com/MrRefactoring/confluence.js?tab=readme-ov-file#authentication). | |
289+
| `confluence.authentication.oauth2` | `object` | Object containing OAuth2 authentication options. | |
290+
| `confluence.authentication.oauth2.accessToken` | `string` | Access token for OAuth2 authentication. | |
291+
| `confluence.authentication.basic` | `object` | Object containing Basic authentication options. | |
292+
| `confluence.authentication.basic.email` | `string` | Email for Basic authentication. | |
293+
| `confluence.authentication.basic.apiToken` | `string` | ApiToken for Basic authentication. | |
294+
| `confluence.authentication.jwt` | `object` | Object containing JWT authentication options. | |
295+
| `confluence.authentication.jwt.issuer` | `string` | Issuer for JWT authentication. | |
296+
| `confluence.authentication.jwt.secret` | `string` | Secret for JWT authentication. | |
297+
| `confluence.authentication.jwt.expiryTimeSeconds` | `number` | Optional expiry time in seconds for JWT authentication. | |
280298
| `confluence.spaceKey` | `string` | Key of the Confluence space where the pages will be synced. | |
281299
| `confluence.rootPageId` | `string` | Id of the Confluence parent page where the pages will be synced. | |
282300
| `confluence.rootPageName` | `string` | Customize Confluence page titles by adding a prefix to all of them for improved organization and clarity | |
@@ -312,7 +330,12 @@ module.exports = {
312330
ignore: ["docs/no-sync/**"],
313331
confluence: {
314332
url: "https://my-confluence.es",
315-
personalAccessToken: "*******",
333+
authentication: {
334+
basic: {
335+
email: "<your-email>",
336+
apiToken: "<your-api-token>"
337+
}
338+
},
316339
spaceKey: "MY-SPACE",
317340
rootPageId: "my-root-page-id"
318341
}
@@ -389,7 +412,13 @@ module.exports = {
389412
],
390413
confluence: {
391414
url: "https://my.confluence.es",
392-
personalAccessToken: "*******",
415+
authentication: {
416+
jwt: {
417+
issuer: "my-issuer",
418+
secret: "my-secret",
419+
expiryTimeSeconds: 300,
420+
},
421+
},
393422
spaceKey: "MY-SPACE",
394423
},
395424
};
@@ -512,7 +541,12 @@ const markdownConfluenceSync = new MarkdownConfluenceSync({
512541
docsDir: path.resolve(__dirname, "..", "docs");
513542
confluence: {
514543
url: "https://my.confluence.es",
515-
personalAccessToken: "*******",
544+
authentication: {
545+
basic: {
546+
email: "<your-email>",
547+
apiToken: "<your-api-token>"
548+
}
549+
},
516550
spaceKey: "MY-SPACE",
517551
rootPageId: "my-root-page-id"
518552
},

components/markdown-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/markdown-confluence-sync",
33
"description": "Creates/updates/deletes Confluence pages based on markdown files in a directory. Supports Mermaid diagrams and per-page configuration using frontmatter metadata. Works great with Docusaurus",
4-
"version": "2.1.1",
4+
"version": "2.2.0",
55
"license": "Apache-2.0",
66
"author": "Telefónica Innovación Digital",
77
"repository": {

components/markdown-confluence-sync/src/lib/confluence/ConfluenceSync.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ export const ConfluenceSync: ConfluenceSyncConstructor = class ConfluenceSync
177177
);
178178
}
179179

180+
if (this._personalAccessTokenOption.value) {
181+
this._logger.warn(
182+
"The 'personalAccessToken' option is deprecated and will be removed in future versions. Please use the 'authentication' option instead.",
183+
);
184+
}
185+
180186
this._confluencePageTransformer = new ConfluencePageTransformer({
181187
noticeMessage: this._noticeMessageOption.value,
182188
noticeTemplate: this._noticeTemplateOption.value,

components/markdown-confluence-sync/test/unit/specs/confluence/ConfluenceSync.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,23 +109,6 @@ describe("confluenceSync", () => {
109109
);
110110
});
111111

112-
it("should fail if the personalAccessToken option is not defined", async () => {
113-
// Arrange
114-
const confluenceSync = new ConfluenceSync(confluenceSyncOptions);
115-
await config.load({
116-
...CONFIG,
117-
confluence: {
118-
url: "foo",
119-
},
120-
});
121-
122-
// Act
123-
// Assert
124-
await expect(async () => await confluenceSync.sync([])).rejects.toThrow(
125-
"Confluence personal access token is required. Please set confluence.personalAccessToken option.",
126-
);
127-
});
128-
129112
it("should fail if the spaceKey option is not defined", async () => {
130113
// Arrange
131114
const confluenceSync = new ConfluenceSync(confluenceSyncOptions);

0 commit comments

Comments
 (0)