confluence.js 1.2.0 → 1.3.1

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +0 -57
  3. package/out/api/audit.js +6 -6
  4. package/out/api/content.js +11 -10
  5. package/out/api/contentAttachments.d.ts +2 -2
  6. package/out/api/contentAttachments.js +7 -6
  7. package/out/api/contentBody.js +1 -1
  8. package/out/api/contentChildrenAndDescendants.js +7 -7
  9. package/out/api/contentComments.js +1 -1
  10. package/out/api/contentLabels.js +4 -4
  11. package/out/api/contentMacroBody.js +1 -1
  12. package/out/api/contentPermissions.js +1 -1
  13. package/out/api/contentProperties.js +7 -6
  14. package/out/api/contentRestrictions.js +15 -15
  15. package/out/api/contentVersions.js +4 -4
  16. package/out/api/contentWatches.js +12 -12
  17. package/out/api/dynamicModules.js +3 -3
  18. package/out/api/experimental.d.ts +36 -0
  19. package/out/api/experimental.js +38 -2
  20. package/out/api/group.js +15 -15
  21. package/out/api/inlineTasks.js +3 -3
  22. package/out/api/labelInfo.js +1 -1
  23. package/out/api/longRunningTask.js +2 -2
  24. package/out/api/parameters/addLabelsToSpace.d.ts +4 -0
  25. package/out/api/parameters/addLabelsToSpace.js +2 -0
  26. package/out/api/parameters/deleteLabelFromSpace.d.ts +8 -0
  27. package/out/api/parameters/deleteLabelFromSpace.js +2 -0
  28. package/out/api/parameters/getBulkUserLookup.d.ts +0 -6
  29. package/out/api/parameters/getContentById.d.ts +85 -1
  30. package/out/api/parameters/getContentById.js +87 -0
  31. package/out/api/parameters/getContentChildren.d.ts +1 -0
  32. package/out/api/parameters/getContentProperties.d.ts +1 -1
  33. package/out/api/parameters/getContentProperty.d.ts +12 -0
  34. package/out/api/parameters/getContentVersions.d.ts +1 -1
  35. package/out/api/parameters/getCurrentUser.d.ts +1 -6
  36. package/out/api/parameters/getHistoryForContent.d.ts +1 -1
  37. package/out/api/parameters/getLabelsForSpace.d.ts +18 -0
  38. package/out/api/parameters/getLabelsForSpace.js +2 -0
  39. package/out/api/parameters/index.d.ts +3 -0
  40. package/out/api/parameters/index.js +3 -0
  41. package/out/api/parameters/restoreContentVersion.d.ts +1 -1
  42. package/out/api/parameters/searchUser.d.ts +7 -0
  43. package/out/api/relation.js +5 -5
  44. package/out/api/search.d.ts +2 -2
  45. package/out/api/search.js +3 -2
  46. package/out/api/settings.js +6 -6
  47. package/out/api/space.js +9 -9
  48. package/out/api/spacePermissions.js +3 -3
  49. package/out/api/spaceProperties.js +6 -6
  50. package/out/api/spaceSettings.js +2 -2
  51. package/out/api/template.d.ts +24 -16
  52. package/out/api/template.js +6 -6
  53. package/out/api/themes.js +6 -6
  54. package/out/api/users.js +8 -8
  55. package/out/clients/baseClient.d.ts +2 -5
  56. package/out/clients/baseClient.js +10 -32
  57. package/out/clients/client.d.ts +2 -3
  58. package/out/config.d.ts +3 -2
  59. package/out/index.d.ts +1 -0
  60. package/out/index.js +2 -1
  61. package/package.json +24 -24
  62. package/src/api/audit.ts +6 -6
  63. package/src/api/content.ts +11 -10
  64. package/src/api/contentAttachments.ts +10 -9
  65. package/src/api/contentBody.ts +1 -1
  66. package/src/api/contentChildrenAndDescendants.ts +7 -7
  67. package/src/api/contentComments.ts +1 -1
  68. package/src/api/contentLabels.ts +4 -4
  69. package/src/api/contentMacroBody.ts +1 -1
  70. package/src/api/contentPermissions.ts +1 -1
  71. package/src/api/contentProperties.ts +7 -6
  72. package/src/api/contentRestrictions.ts +15 -15
  73. package/src/api/contentVersions.ts +4 -4
  74. package/src/api/contentWatches.ts +12 -12
  75. package/src/api/dynamicModules.ts +3 -3
  76. package/src/api/experimental.ts +95 -2
  77. package/src/api/group.ts +16 -15
  78. package/src/api/inlineTasks.ts +3 -3
  79. package/src/api/labelInfo.ts +1 -1
  80. package/src/api/longRunningTask.ts +2 -2
  81. package/src/api/parameters/addLabelsToSpace.ts +4 -0
  82. package/src/api/parameters/deleteLabelFromSpace.ts +8 -0
  83. package/src/api/parameters/getBulkUserLookup.ts +0 -6
  84. package/src/api/parameters/getContentById.ts +86 -1
  85. package/src/api/parameters/getContentChildren.ts +1 -0
  86. package/src/api/parameters/getContentProperties.ts +1 -1
  87. package/src/api/parameters/getContentProperty.ts +12 -0
  88. package/src/api/parameters/getContentVersions.ts +1 -1
  89. package/src/api/parameters/getCurrentUser.ts +1 -6
  90. package/src/api/parameters/getHistoryForContent.ts +1 -1
  91. package/src/api/parameters/getLabelsForSpace.ts +18 -0
  92. package/src/api/parameters/index.ts +3 -0
  93. package/src/api/parameters/restoreContentVersion.ts +1 -1
  94. package/src/api/parameters/searchUser.ts +7 -0
  95. package/src/api/relation.ts +5 -5
  96. package/src/api/search.ts +6 -4
  97. package/src/api/settings.ts +6 -6
  98. package/src/api/space.ts +9 -9
  99. package/src/api/spacePermissions.ts +3 -3
  100. package/src/api/spaceProperties.ts +6 -6
  101. package/src/api/spaceSettings.ts +2 -2
  102. package/src/api/template.ts +30 -22
  103. package/src/api/themes.ts +6 -6
  104. package/src/api/users.ts +8 -8
  105. package/src/clients/baseClient.ts +10 -62
  106. package/src/clients/client.ts +2 -3
  107. package/src/config.ts +3 -2
  108. package/src/index.ts +1 -0
  109. package/tsconfig.json +2 -1
package/out/api/themes.js CHANGED
@@ -16,7 +16,7 @@ class Themes {
16
16
  limit: parameters === null || parameters === void 0 ? void 0 : parameters.limit,
17
17
  },
18
18
  };
19
- return this.client.sendRequest(config, callback, { methodName: 'getThemes' });
19
+ return this.client.sendRequest(config, callback);
20
20
  });
21
21
  }
22
22
  getGlobalTheme(callback) {
@@ -25,7 +25,7 @@ class Themes {
25
25
  url: '/api/settings/theme/selected',
26
26
  method: 'GET',
27
27
  };
28
- return this.client.sendRequest(config, callback, { methodName: 'getGlobalTheme' });
28
+ return this.client.sendRequest(config, callback);
29
29
  });
30
30
  }
31
31
  getTheme(parameters, callback) {
@@ -34,7 +34,7 @@ class Themes {
34
34
  url: `/api/settings/theme/${parameters.themeKey}`,
35
35
  method: 'GET',
36
36
  };
37
- return this.client.sendRequest(config, callback, { methodName: 'getTheme' });
37
+ return this.client.sendRequest(config, callback);
38
38
  });
39
39
  }
40
40
  getSpaceTheme(parameters, callback) {
@@ -43,7 +43,7 @@ class Themes {
43
43
  url: `/api/space/${parameters.spaceKey}/theme`,
44
44
  method: 'GET',
45
45
  };
46
- return this.client.sendRequest(config, callback, { methodName: 'getSpaceTheme' });
46
+ return this.client.sendRequest(config, callback);
47
47
  });
48
48
  }
49
49
  setSpaceTheme(parameters, callback) {
@@ -55,7 +55,7 @@ class Themes {
55
55
  themeKey: parameters.themeKey,
56
56
  },
57
57
  };
58
- return this.client.sendRequest(config, callback, { methodName: 'setSpaceTheme' });
58
+ return this.client.sendRequest(config, callback);
59
59
  });
60
60
  }
61
61
  resetSpaceTheme(parameters, callback) {
@@ -64,7 +64,7 @@ class Themes {
64
64
  url: `/api/space/${parameters.spaceKey}/theme`,
65
65
  method: 'DELETE',
66
66
  };
67
- return this.client.sendRequest(config, callback, { methodName: 'resetSpaceTheme' });
67
+ return this.client.sendRequest(config, callback);
68
68
  });
69
69
  }
70
70
  }
package/out/api/users.js CHANGED
@@ -18,7 +18,7 @@ class Users {
18
18
  expand: parameters.expand,
19
19
  },
20
20
  };
21
- return this.client.sendRequest(config, callback, { methodName: 'getUser' });
21
+ return this.client.sendRequest(config, callback);
22
22
  });
23
23
  }
24
24
  getAnonymousUser(parameters, callback) {
@@ -30,7 +30,7 @@ class Users {
30
30
  expand: parameters === null || parameters === void 0 ? void 0 : parameters.expand,
31
31
  },
32
32
  };
33
- return this.client.sendRequest(config, callback, { methodName: 'getAnonymousUser' });
33
+ return this.client.sendRequest(config, callback);
34
34
  });
35
35
  }
36
36
  getCurrentUser(parameters, callback) {
@@ -42,7 +42,7 @@ class Users {
42
42
  expand: parameters === null || parameters === void 0 ? void 0 : parameters.expand,
43
43
  },
44
44
  };
45
- return this.client.sendRequest(config, callback, { methodName: 'getCurrentUser' });
45
+ return this.client.sendRequest(config, callback);
46
46
  });
47
47
  }
48
48
  getGroupMembershipsForUser(parameters, callback) {
@@ -58,7 +58,7 @@ class Users {
58
58
  limit: parameters.limit,
59
59
  },
60
60
  };
61
- return this.client.sendRequest(config, callback, { methodName: 'getGroupMembershipsForUser' });
61
+ return this.client.sendRequest(config, callback);
62
62
  });
63
63
  }
64
64
  getBulkUserLookup(parameters, callback) {
@@ -72,7 +72,7 @@ class Users {
72
72
  limit: parameters.limit,
73
73
  },
74
74
  };
75
- return this.client.sendRequest(config, callback, { methodName: 'getBulkUserLookup' });
75
+ return this.client.sendRequest(config, callback);
76
76
  });
77
77
  }
78
78
  getPrivacyUnsafeUserEmail(parameters, callback) {
@@ -84,7 +84,7 @@ class Users {
84
84
  accountId: parameters.accountId,
85
85
  },
86
86
  };
87
- return this.client.sendRequest(config, callback, { methodName: 'getPrivacyUnsafeUserEmail' });
87
+ return this.client.sendRequest(config, callback);
88
88
  });
89
89
  }
90
90
  getPrivacyUnsafeUserEmailBulk(parameters, callback) {
@@ -96,7 +96,7 @@ class Users {
96
96
  accountId: parameters.accountId,
97
97
  },
98
98
  };
99
- return this.client.sendRequest(config, callback, { methodName: 'getPrivacyUnsafeUserEmailBulk' });
99
+ return this.client.sendRequest(config, callback);
100
100
  });
101
101
  }
102
102
  getBulkUserMigration(parameters, callback) {
@@ -111,7 +111,7 @@ class Users {
111
111
  limit: parameters.limit,
112
112
  },
113
113
  };
114
- return this.client.sendRequest(config, callback, { methodName: 'getBulkUserMigration' });
114
+ return this.client.sendRequest(config, callback);
115
115
  });
116
116
  }
117
117
  }
@@ -1,4 +1,3 @@
1
- import { Telemetry } from 'telemetry.confluence.js';
2
1
  import type { Client } from './client';
3
2
  import type { Callback } from '../callback';
4
3
  import type { Config } from '../config';
@@ -6,14 +5,12 @@ import type { RequestConfig } from '../requestConfig';
6
5
  export declare class BaseClient implements Client {
7
6
  #private;
8
7
  protected readonly config: Config;
9
- private telemetryClient;
10
8
  protected urlSuffix: string;
11
9
  constructor(config: Config);
12
10
  protected paramSerializer(parameters: Record<string, any>): string;
13
11
  protected encode(value: string): string;
14
12
  protected removeUndefinedProperties(obj: Record<string, any>): Record<string, any>;
15
13
  private get instance();
16
- sendRequest<T>(requestConfig: RequestConfig, callback: never, telemetryData?: Partial<Telemetry>): Promise<T>;
17
- sendRequest<T>(requestConfig: RequestConfig, callback: Callback<T>, telemetryData?: Partial<Telemetry>): Promise<void>;
18
- private get authenticationType();
14
+ sendRequest<T>(requestConfig: RequestConfig, callback: never, telemetryData?: any): Promise<T>;
15
+ sendRequest<T>(requestConfig: RequestConfig, callback: Callback<T>, telemetryData?: any): Promise<void>;
19
16
  }
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.BaseClient = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const axios_1 = require("axios");
7
- const telemetry_confluence_js_1 = require("telemetry.confluence.js");
8
7
  const authenticationService_1 = require("../services/authenticationService");
9
8
  const ATLASSIAN_TOKEN_CHECK_FLAG = 'X-Atlassian-Token';
10
9
  const ATLASSIAN_TOKEN_CHECK_NOCHECK_VALUE = 'no-check';
@@ -13,13 +12,12 @@ class BaseClient {
13
12
  this.config = config;
14
13
  _BaseClient_instance.set(this, void 0);
15
14
  this.urlSuffix = '/wiki/rest/';
16
- this.telemetryClient = new telemetry_confluence_js_1.TelemetryClient(config.telemetry);
17
15
  }
18
16
  paramSerializer(parameters) {
19
17
  const parts = [];
20
18
  Object.entries(parameters).forEach(([key, value]) => {
21
19
  if (value === null || typeof value === 'undefined') {
22
- return undefined;
20
+ return;
23
21
  }
24
22
  if (Array.isArray(value)) {
25
23
  // eslint-disable-next-line no-param-reassign
@@ -33,8 +31,12 @@ class BaseClient {
33
31
  // eslint-disable-next-line no-param-reassign
34
32
  value = JSON.stringify(value);
35
33
  }
34
+ else if (value instanceof Function) {
35
+ const part = value();
36
+ return part && parts.push(part);
37
+ }
36
38
  parts.push(`${this.encode(key)}=${this.encode(value)}`);
37
- return undefined;
39
+ return;
38
40
  });
39
41
  return parts.join('&');
40
42
  }
@@ -60,11 +62,9 @@ class BaseClient {
60
62
  (0, tslib_1.__classPrivateFieldSet)(this, _BaseClient_instance, axios_1.default.create(Object.assign(Object.assign({ paramsSerializer: this.paramSerializer.bind(this) }, this.config.baseRequestConfig), { baseURL: `${this.config.host}${this.urlSuffix}`, headers: this.removeUndefinedProperties(Object.assign({ [ATLASSIAN_TOKEN_CHECK_FLAG]: this.config.noCheckAtlassianToken ? ATLASSIAN_TOKEN_CHECK_NOCHECK_VALUE : undefined }, (_a = this.config.baseRequestConfig) === null || _a === void 0 ? void 0 : _a.headers)) })), "f");
61
63
  return (0, tslib_1.__classPrivateFieldGet)(this, _BaseClient_instance, "f");
62
64
  }
63
- sendRequest(requestConfig, callback, telemetryData) {
64
- var _a, _b, _c, _d, _e, _f, _g, _h;
65
+ sendRequest(requestConfig, callback) {
66
+ var _a, _b, _c, _d;
65
67
  return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
66
- const startDateTime = new Date();
67
- const telemetry = Object.assign({ authentication: this.authenticationType, baseRequestConfigUsed: !!this.config.baseRequestConfig, bodyExists: !!requestConfig.data, callbackUsed: !!callback, headersExists: !!requestConfig.headers, libVersion: '1.2.0', libVersionHash: '0ba4439ee9a46d9d9f14c60f88f45f87', methodName: (telemetryData === null || telemetryData === void 0 ? void 0 : telemetryData.methodName) || 'sendRequest', onErrorMiddlewareUsed: !!((_a = this.config.middlewares) === null || _a === void 0 ? void 0 : _a.onError), onResponseMiddlewareUsed: !!((_b = this.config.middlewares) === null || _b === void 0 ? void 0 : _b.onResponse), queryExists: !!requestConfig.params, requestEndTime: new Date(), requestStartTime: startDateTime, requestStatusCode: 0, noCheckAtlassianToken: !!this.config.noCheckAtlassianToken }, telemetryData);
68
68
  try {
69
69
  const modifiedRequestConfig = Object.assign(Object.assign({}, requestConfig), { headers: this.removeUndefinedProperties(Object.assign({ Authorization: yield authenticationService_1.AuthenticationService.getAuthenticationToken(this.config.authentication, {
70
70
  baseURL: this.config.host,
@@ -75,8 +75,7 @@ class BaseClient {
75
75
  const callbackResponseHandler = callback && ((data) => callback(null, data));
76
76
  const defaultResponseHandler = (data) => data;
77
77
  const responseHandler = callbackResponseHandler !== null && callbackResponseHandler !== void 0 ? callbackResponseHandler : defaultResponseHandler;
78
- (_d = (_c = this.config.middlewares) === null || _c === void 0 ? void 0 : _c.onResponse) === null || _d === void 0 ? void 0 : _d.call(_c, response.data);
79
- telemetry.requestStatusCode = response.status;
78
+ (_b = (_a = this.config.middlewares) === null || _a === void 0 ? void 0 : _a.onResponse) === null || _b === void 0 ? void 0 : _b.call(_a, response.data);
80
79
  return responseHandler(response.data);
81
80
  }
82
81
  catch (e) {
@@ -85,32 +84,11 @@ class BaseClient {
85
84
  throw error;
86
85
  };
87
86
  const errorHandler = callbackErrorHandler !== null && callbackErrorHandler !== void 0 ? callbackErrorHandler : defaultErrorHandler;
88
- (_f = (_e = this.config.middlewares) === null || _e === void 0 ? void 0 : _e.onError) === null || _f === void 0 ? void 0 : _f.call(_e, e);
89
- telemetry.requestStatusCode = e.isAxiosError ? (_h = (_g = e.response) === null || _g === void 0 ? void 0 : _g.status) !== null && _h !== void 0 ? _h : 0 : 418;
87
+ (_d = (_c = this.config.middlewares) === null || _c === void 0 ? void 0 : _c.onError) === null || _d === void 0 ? void 0 : _d.call(_c, e);
90
88
  return errorHandler(e);
91
89
  }
92
- finally {
93
- telemetry.requestEndTime = new Date();
94
- this.telemetryClient.sendTelemetry(telemetry);
95
- }
96
90
  });
97
91
  }
98
- get authenticationType() {
99
- const { authentication } = this.config;
100
- if (!authentication) {
101
- return telemetry_confluence_js_1.Authentication.None;
102
- }
103
- if (authentication.basic) {
104
- return telemetry_confluence_js_1.Authentication.Basic;
105
- }
106
- if (authentication.oauth2) {
107
- return telemetry_confluence_js_1.Authentication.OAuth2;
108
- }
109
- if (authentication.jwt) {
110
- return telemetry_confluence_js_1.Authentication.JWT;
111
- }
112
- return telemetry_confluence_js_1.Authentication.NA;
113
- }
114
92
  }
115
93
  exports.BaseClient = BaseClient;
116
94
  _BaseClient_instance = new WeakMap();
@@ -1,7 +1,6 @@
1
- import type { Telemetry } from 'telemetry.confluence.js';
2
1
  import type { Callback } from '../callback';
3
2
  import type { RequestConfig } from '../requestConfig';
4
3
  export interface Client {
5
- sendRequest<T>(requestConfig: RequestConfig, callback?: never, telemetryData?: Partial<Telemetry>): Promise<T>;
6
- sendRequest<T>(requestConfig: RequestConfig, callback?: Callback<T>, telemetryData?: Partial<Telemetry>): Promise<void>;
4
+ sendRequest<T>(requestConfig: RequestConfig, callback?: never, telemetryData?: any): Promise<T>;
5
+ sendRequest<T>(requestConfig: RequestConfig, callback?: Callback<T>, telemetryData?: any): Promise<void>;
7
6
  }
package/out/config.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { AxiosError } from 'axios';
2
- import type { TelemetryConfig } from 'telemetry.confluence.js';
3
2
  import type { RequestConfig } from './requestConfig';
4
3
  import type { UtilityTypes } from './utilityTypes';
5
4
  export interface Config {
@@ -7,6 +6,7 @@ export interface Config {
7
6
  baseRequestConfig?: Config.BaseRequestConfig;
8
7
  authentication?: Config.Authentication;
9
8
  middlewares?: Config.Middlewares;
9
+ /** @deprecated Disabled. Will be removed in the next major version. */
10
10
  telemetry?: Config.Telemetry;
11
11
  /**
12
12
  * Adds `'X-Atlassian-Token': 'no-check'` to each request header
@@ -16,7 +16,8 @@ export interface Config {
16
16
  export declare namespace Config {
17
17
  type BaseRequestConfig = RequestConfig;
18
18
  type Error = AxiosError;
19
- type Telemetry = boolean | TelemetryConfig;
19
+ /** @deprecated Disabled. Will be removed in the next major version. */
20
+ type Telemetry = boolean | any;
20
21
  type Authentication = UtilityTypes.XOR<{
21
22
  jwt: Authentication.JWT;
22
23
  }, UtilityTypes.XOR<{
package/out/index.d.ts CHANGED
@@ -3,5 +3,6 @@ export * from './config';
3
3
  export * from './requestConfig';
4
4
  export * from './callback';
5
5
  export * as Api from './api';
6
+ export * as Server from './server';
6
7
  export * as Models from './api/models';
7
8
  export * as Parameters from './api/parameters';
package/out/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Parameters = exports.Models = exports.Api = void 0;
3
+ exports.Parameters = exports.Models = exports.Server = exports.Api = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  (0, tslib_1.__exportStar)(require("./clients"), exports);
6
6
  (0, tslib_1.__exportStar)(require("./config"), exports);
7
7
  (0, tslib_1.__exportStar)(require("./requestConfig"), exports);
8
8
  (0, tslib_1.__exportStar)(require("./callback"), exports);
9
9
  exports.Api = require("./api");
10
+ exports.Server = require("./server");
10
11
  exports.Models = require("./api/models");
11
12
  exports.Parameters = require("./api/parameters");
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "confluence.js",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "confluence.js is a powerful Node.JS/Browser module that allows you to interact with the Confluence API very easily",
5
+ "author": "Vladislav Tupikin <mrrefactoring@yandex.ru>",
6
+ "license": "MIT",
7
+ "homepage": "https://mrrefactoring.github.io/confluence.js",
8
+ "repository": "https://github.com/MrRefactoring/confluence.js.git",
5
9
  "main": "out/index.js",
6
10
  "types": "out/index.d.ts",
7
11
  "scripts": {
8
12
  "build": "tsc",
9
13
  "prepublishOnly": "npm run build && npm run test && npm run lint",
10
14
  "test": "npm run test:unit && npm run test:e2e",
11
- "test:unit": "jest tests/unit",
15
+ "test:unit": "jest tests/unit --verbose",
12
16
  "test:e2e": "jest tests/e2e --setupFiles=./tests/setup.ts --runInBand",
13
17
  "prettier": "prettier --write src/**/*.ts",
14
- "doc": "typedoc --name Confluence.js --out docs ./src",
18
+ "doc": "typedoc --name \"Confluence.js - Cloud and Server API library\" --out docs ./src/index.ts --plugin typedoc-plugin-extras --footerDate --footerTime --footerTypedocVersion --favicon https://svgshare.com/i/bVi.svg",
15
19
  "lint": "eslint src --ext .ts",
16
20
  "lint:fix": "npm run lint -- --fix"
17
21
  },
@@ -19,7 +23,6 @@
19
23
  "preset": "ts-jest",
20
24
  "testEnvironment": "node"
21
25
  },
22
- "repository": "https://github.com/MrRefactoring/confluence.js.git",
23
26
  "keywords": [
24
27
  "confluence",
25
28
  "api",
@@ -29,35 +32,32 @@
29
32
  "wiki",
30
33
  "atlassian"
31
34
  ],
32
- "author": "Vladislav Tupikin <mrrefactoring@yandex.ru>",
33
- "license": "MIT",
34
- "homepage": "https://github.com/MrRefactoring/confluence.js#readme",
35
35
  "devDependencies": {
36
36
  "@types/express": "^4.17.13",
37
- "@types/jest": "^26.0.24",
37
+ "@types/jest": "^27.0.3",
38
38
  "@types/oauth": "^0.9.1",
39
- "@types/sinon": "^10.0.4",
40
- "@typescript-eslint/eslint-plugin": "^4.32.0",
41
- "@typescript-eslint/parser": "^4.32.0",
39
+ "@types/sinon": "^10.0.6",
40
+ "@typescript-eslint/eslint-plugin": "^5.6.0",
41
+ "@typescript-eslint/parser": "^5.6.0",
42
42
  "dotenv": "^10.0.0",
43
- "eslint": "^7.32.0",
44
- "eslint-config-airbnb": "^18.2.1",
45
- "eslint-config-airbnb-typescript": "^14.0.0",
43
+ "eslint": "^8.4.1",
44
+ "eslint-config-airbnb": "^19.0.2",
45
+ "eslint-config-airbnb-typescript": "^16.1.0",
46
46
  "eslint-import-resolver-typescript": "^2.5.0",
47
- "eslint-plugin-import": "^2.24.2",
48
- "jest": "^26.6.3",
49
- "prettier": "^2.4.1",
50
- "prettier-plugin-jsdoc": "^0.3.24",
51
- "sinon": "^11.1.2",
52
- "ts-jest": "^26.5.6",
53
- "typedoc": "^0.22.4",
54
- "typescript": "^4.4.3"
47
+ "eslint-plugin-import": "^2.25.3",
48
+ "jest": "^27.4.4",
49
+ "prettier": "^2.5.1",
50
+ "prettier-plugin-jsdoc": "^0.3.30",
51
+ "sinon": "^12.0.1",
52
+ "ts-jest": "^27.1.1",
53
+ "typedoc": "^0.22.10",
54
+ "typedoc-plugin-extras": "^2.2.1",
55
+ "typescript": "^4.5.3"
55
56
  },
56
57
  "dependencies": {
57
58
  "atlassian-jwt": "^2.0.2",
58
- "axios": "^0.21.4",
59
+ "axios": "^0.24.0",
59
60
  "oauth": "^0.9.15",
60
- "telemetry.confluence.js": "<2",
61
61
  "tslib": "^2.3.1"
62
62
  }
63
63
  }
package/src/api/audit.ts CHANGED
@@ -45,7 +45,7 @@ export class Audit {
45
45
  },
46
46
  };
47
47
 
48
- return this.client.sendRequest(config, callback, { methodName: 'getAuditRecords' });
48
+ return this.client.sendRequest(config, callback);
49
49
  }
50
50
 
51
51
  /**
@@ -87,7 +87,7 @@ export class Audit {
87
87
  },
88
88
  };
89
89
 
90
- return this.client.sendRequest(config, callback, { methodName: 'createAuditRecord' });
90
+ return this.client.sendRequest(config, callback);
91
91
  }
92
92
 
93
93
  /**
@@ -120,7 +120,7 @@ export class Audit {
120
120
  },
121
121
  };
122
122
 
123
- return this.client.sendRequest(config, callback, { methodName: 'exportAuditRecords' });
123
+ return this.client.sendRequest(config, callback);
124
124
  }
125
125
 
126
126
  /**
@@ -143,7 +143,7 @@ export class Audit {
143
143
  method: 'GET',
144
144
  };
145
145
 
146
- return this.client.sendRequest(config, callback, { methodName: 'getRetentionPeriod' });
146
+ return this.client.sendRequest(config, callback);
147
147
  }
148
148
 
149
149
  /**
@@ -177,7 +177,7 @@ export class Audit {
177
177
  },
178
178
  };
179
179
 
180
- return this.client.sendRequest(config, callback, { methodName: 'setRetentionPeriod' });
180
+ return this.client.sendRequest(config, callback);
181
181
  }
182
182
 
183
183
  /**
@@ -224,6 +224,6 @@ export class Audit {
224
224
  },
225
225
  };
226
226
 
227
- return this.client.sendRequest(config, callback, { methodName: 'getAuditRecordsForTimePeriod' });
227
+ return this.client.sendRequest(config, callback);
228
228
  }
229
229
  }
@@ -49,7 +49,7 @@ export class Content {
49
49
  },
50
50
  };
51
51
 
52
- return this.client.sendRequest(config, callback, { methodName: 'getContent' });
52
+ return this.client.sendRequest(config, callback);
53
53
  }
54
54
 
55
55
  /**
@@ -99,7 +99,7 @@ export class Content {
99
99
  },
100
100
  };
101
101
 
102
- return this.client.sendRequest(config, callback, { methodName: 'createContent' });
102
+ return this.client.sendRequest(config, callback);
103
103
  }
104
104
 
105
105
  /**
@@ -138,7 +138,7 @@ export class Content {
138
138
  },
139
139
  };
140
140
 
141
- return this.client.sendRequest(config, callback, { methodName: 'archivePages' });
141
+ return this.client.sendRequest(config, callback);
142
142
  }
143
143
 
144
144
  /**
@@ -185,7 +185,7 @@ export class Content {
185
185
  },
186
186
  };
187
187
 
188
- return this.client.sendRequest(config, callback, { methodName: 'publishLegacyDraft' });
188
+ return this.client.sendRequest(config, callback);
189
189
  }
190
190
 
191
191
  /**
@@ -230,7 +230,7 @@ export class Content {
230
230
  },
231
231
  };
232
232
 
233
- return this.client.sendRequest(config, callback, { methodName: 'publishSharedDraft' });
233
+ return this.client.sendRequest(config, callback);
234
234
  }
235
235
 
236
236
  /**
@@ -286,7 +286,7 @@ export class Content {
286
286
  },
287
287
  };
288
288
 
289
- return this.client.sendRequest(config, callback, { methodName: 'searchContentByCQL' });
289
+ return this.client.sendRequest(config, callback);
290
290
  }
291
291
 
292
292
  /**
@@ -319,10 +319,11 @@ export class Content {
319
319
  version: parameters.version,
320
320
  embeddedContentRender: parameters.embeddedContentRender,
321
321
  trigger: parameters.trigger,
322
+ expand: parameters.expand,
322
323
  },
323
324
  };
324
325
 
325
- return this.client.sendRequest(config, callback, { methodName: 'getContentById' });
326
+ return this.client.sendRequest(config, callback);
326
327
  }
327
328
 
328
329
  /**
@@ -364,7 +365,7 @@ export class Content {
364
365
  },
365
366
  };
366
367
 
367
- return this.client.sendRequest(config, callback, { methodName: 'updateContent' });
368
+ return this.client.sendRequest(config, callback);
368
369
  }
369
370
 
370
371
  /**
@@ -400,7 +401,7 @@ export class Content {
400
401
  },
401
402
  };
402
403
 
403
- return this.client.sendRequest(config, callback, { methodName: 'deleteContent' });
404
+ return this.client.sendRequest(config, callback);
404
405
  }
405
406
 
406
407
  /**
@@ -433,6 +434,6 @@ export class Content {
433
434
  },
434
435
  };
435
436
 
436
- return this.client.sendRequest(config, callback, { methodName: 'getHistoryForContent' });
437
+ return this.client.sendRequest(config, callback);
437
438
  }
438
439
  }
@@ -44,7 +44,7 @@ export class ContentAttachments {
44
44
  },
45
45
  };
46
46
 
47
- return this.client.sendRequest(config, callback, { methodName: 'getAttachments' });
47
+ return this.client.sendRequest(config, callback);
48
48
  }
49
49
 
50
50
  /**
@@ -136,7 +136,7 @@ export class ContentAttachments {
136
136
  },
137
137
  };
138
138
 
139
- return this.client.sendRequest(config, callback, { methodName: 'createAttachments' });
139
+ return this.client.sendRequest(config, callback);
140
140
  }
141
141
 
142
142
  /**
@@ -230,7 +230,7 @@ export class ContentAttachments {
230
230
  },
231
231
  };
232
232
 
233
- return this.client.sendRequest(config, callback, { methodName: 'createOrUpdateAttachments' });
233
+ return this.client.sendRequest(config, callback);
234
234
  }
235
235
 
236
236
  /**
@@ -263,7 +263,7 @@ export class ContentAttachments {
263
263
  data: parameters.body,
264
264
  };
265
265
 
266
- return this.client.sendRequest(config, callback, { methodName: 'updateAttachmentProperties' });
266
+ return this.client.sendRequest(config, callback);
267
267
  }
268
268
 
269
269
  /**
@@ -358,28 +358,29 @@ export class ContentAttachments {
358
358
  },
359
359
  };
360
360
 
361
- return this.client.sendRequest(config, callback, { methodName: 'updateAttachmentData' });
361
+ return this.client.sendRequest(config, callback);
362
362
  }
363
363
 
364
364
  /** Redirects the client to a URL that serves an attachment's binary data. */
365
- async downloadAttachment<T = unknown>(
365
+ async downloadAttachment<T = ArrayBuffer>(
366
366
  parameters: Parameters.DownloadAttachment,
367
367
  callback: Callback<T>
368
368
  ): Promise<void>;
369
369
  /** Redirects the client to a URL that serves an attachment's binary data. */
370
- async downloadAttachment<T = unknown>(parameters: Parameters.DownloadAttachment, callback?: never): Promise<T>;
371
- async downloadAttachment<T = unknown>(
370
+ async downloadAttachment<T = ArrayBuffer>(parameters: Parameters.DownloadAttachment, callback?: never): Promise<T>;
371
+ async downloadAttachment<T = ArrayBuffer>(
372
372
  parameters: Parameters.DownloadAttachment,
373
373
  callback?: Callback<T>,
374
374
  ): Promise<void | T> {
375
375
  const config: RequestConfig = {
376
376
  url: `/api/content/${parameters.id}/child/attachment/${parameters.attachmentId}/download`,
377
377
  method: 'GET',
378
+ responseType: 'arraybuffer',
378
379
  params: {
379
380
  version: parameters.version,
380
381
  },
381
382
  };
382
383
 
383
- return this.client.sendRequest(config, callback, { methodName: 'downloadAttachment' });
384
+ return this.client.sendRequest(config, callback);
384
385
  }
385
386
  }
@@ -61,6 +61,6 @@ export class ContentBody {
61
61
  },
62
62
  };
63
63
 
64
- return this.client.sendRequest(config, callback, { methodName: 'convertContentBody' });
64
+ return this.client.sendRequest(config, callback);
65
65
  }
66
66
  }
@@ -64,7 +64,7 @@ export class ContentChildrenAndDescendants {
64
64
  },
65
65
  };
66
66
 
67
- return this.client.sendRequest(config, callback, { methodName: 'getContentChildren' });
67
+ return this.client.sendRequest(config, callback);
68
68
  }
69
69
 
70
70
  /**
@@ -97,7 +97,7 @@ export class ContentChildrenAndDescendants {
97
97
  method: 'PUT',
98
98
  };
99
99
 
100
- return this.client.sendRequest(config, callback, { methodName: 'movePage' });
100
+ return this.client.sendRequest(config, callback);
101
101
  }
102
102
 
103
103
  /**
@@ -156,7 +156,7 @@ export class ContentChildrenAndDescendants {
156
156
  },
157
157
  };
158
158
 
159
- return this.client.sendRequest(config, callback, { methodName: 'getContentChildrenByType' });
159
+ return this.client.sendRequest(config, callback);
160
160
  }
161
161
 
162
162
  /**
@@ -215,7 +215,7 @@ export class ContentChildrenAndDescendants {
215
215
  },
216
216
  };
217
217
 
218
- return this.client.sendRequest(config, callback, { methodName: 'getContentDescendants' });
218
+ return this.client.sendRequest(config, callback);
219
219
  }
220
220
 
221
221
  /** @deprecated This API will be removed in the next major version. Use `getDescendantsOfType` method instead. */
@@ -292,7 +292,7 @@ export class ContentChildrenAndDescendants {
292
292
  },
293
293
  };
294
294
 
295
- return this.client.sendRequest(config, callback, { methodName: 'descendantsOfType' });
295
+ return this.client.sendRequest(config, callback);
296
296
  }
297
297
 
298
298
  /**
@@ -329,7 +329,7 @@ export class ContentChildrenAndDescendants {
329
329
  },
330
330
  };
331
331
 
332
- return this.client.sendRequest(config, callback, { methodName: 'copyPageHierarchy' });
332
+ return this.client.sendRequest(config, callback);
333
333
  }
334
334
 
335
335
  /**
@@ -372,6 +372,6 @@ export class ContentChildrenAndDescendants {
372
372
  data: parameters.bodyParameters,
373
373
  };
374
374
 
375
- return this.client.sendRequest(config, callback, { methodName: 'copyPage' });
375
+ return this.client.sendRequest(config, callback);
376
376
  }
377
377
  }