confluence.js 1.5.1 → 1.6.0

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 (163) hide show
  1. package/CHANGELOG.md +22 -3
  2. package/README.md +1 -0
  3. package/out/api/audit.d.ts +24 -12
  4. package/out/api/audit.js.map +1 -1
  5. package/out/api/content.d.ts +18 -12
  6. package/out/api/content.js.map +1 -1
  7. package/out/api/contentAttachments.d.ts +14 -8
  8. package/out/api/contentAttachments.js.map +1 -1
  9. package/out/api/contentBody.d.ts +52 -0
  10. package/out/api/contentBody.js +27 -3
  11. package/out/api/contentBody.js.map +1 -1
  12. package/out/api/contentChildrenAndDescendants.js +2 -1
  13. package/out/api/contentChildrenAndDescendants.js.map +1 -1
  14. package/out/api/contentContentState.d.ts +30 -28
  15. package/out/api/contentContentState.js +2 -0
  16. package/out/api/contentContentState.js.map +1 -1
  17. package/out/api/contentMacroBody.d.ts +72 -2
  18. package/out/api/contentMacroBody.js +29 -0
  19. package/out/api/contentMacroBody.js.map +1 -1
  20. package/out/api/contentRestrictions.d.ts +16 -8
  21. package/out/api/contentRestrictions.js.map +1 -1
  22. package/out/api/contentStates.d.ts +120 -0
  23. package/out/api/contentStates.js +88 -0
  24. package/out/api/contentStates.js.map +1 -0
  25. package/out/api/contentWatches.d.ts +16 -8
  26. package/out/api/contentWatches.js.map +1 -1
  27. package/out/api/dynamicModules.js +1 -0
  28. package/out/api/dynamicModules.js.map +1 -1
  29. package/out/api/experimental.d.ts +2 -2
  30. package/out/api/index.d.ts +1 -0
  31. package/out/api/index.js +1 -0
  32. package/out/api/index.js.map +1 -1
  33. package/out/api/models/asyncContentBody.d.ts +30 -0
  34. package/out/api/models/asyncContentBody.js +3 -0
  35. package/out/api/models/asyncContentBody.js.map +1 -0
  36. package/out/api/models/asyncId.d.ts +3 -0
  37. package/out/api/models/asyncId.js +3 -0
  38. package/out/api/models/asyncId.js.map +1 -0
  39. package/out/api/models/contentBodyCreate.d.ts +1 -0
  40. package/out/api/models/contentStateResponse.d.ts +7 -0
  41. package/out/api/models/contentStateResponse.js +3 -0
  42. package/out/api/models/contentStateResponse.js.map +1 -0
  43. package/out/api/models/contentStateRestInput.d.ts +11 -0
  44. package/out/api/models/contentStateRestInput.js +3 -0
  45. package/out/api/models/contentStateRestInput.js.map +1 -0
  46. package/out/api/models/index.d.ts +16 -12
  47. package/out/api/models/index.js +16 -12
  48. package/out/api/models/index.js.map +1 -1
  49. package/out/api/parameters/asyncConvertContentBodyRequest.d.ts +38 -0
  50. package/out/api/parameters/asyncConvertContentBodyRequest.js +3 -0
  51. package/out/api/parameters/asyncConvertContentBodyRequest.js.map +1 -0
  52. package/out/api/parameters/asyncConvertContentBodyResponse.d.ts +4 -0
  53. package/out/api/parameters/asyncConvertContentBodyResponse.js +3 -0
  54. package/out/api/parameters/asyncConvertContentBodyResponse.js.map +1 -0
  55. package/out/api/parameters/convertContentBody.d.ts +16 -2
  56. package/out/api/parameters/getAndAsyncConvertMacroBodyByMacroId.d.ts +46 -0
  57. package/out/api/parameters/getAndAsyncConvertMacroBodyByMacroId.js +3 -0
  58. package/out/api/parameters/getAndAsyncConvertMacroBodyByMacroId.js.map +1 -0
  59. package/out/api/parameters/getAndConvertMacroBodyByMacroId.d.ts +34 -0
  60. package/out/api/parameters/getAndConvertMacroBodyByMacroId.js +3 -0
  61. package/out/api/parameters/getAndConvertMacroBodyByMacroId.js.map +1 -0
  62. package/out/api/parameters/getAvailableContentStates.d.ts +4 -2
  63. package/out/api/parameters/getContentState.d.ts +8 -4
  64. package/out/api/parameters/getSpaceContentStates.d.ts +4 -0
  65. package/out/api/parameters/getSpaceContentStates.js +3 -0
  66. package/out/api/parameters/getSpaceContentStates.js.map +1 -0
  67. package/out/api/parameters/getUser.d.ts +6 -4
  68. package/out/api/parameters/index.d.ts +5 -0
  69. package/out/api/parameters/index.js +5 -0
  70. package/out/api/parameters/index.js.map +1 -1
  71. package/out/api/parameters/movePage.d.ts +9 -5
  72. package/out/api/parameters/removeContentState.d.ts +5 -1
  73. package/out/api/parameters/setContentState.d.ts +11 -5
  74. package/out/api/relation.d.ts +8 -4
  75. package/out/api/relation.js.map +1 -1
  76. package/out/api/settings.d.ts +6 -4
  77. package/out/api/settings.js.map +1 -1
  78. package/out/api/space.d.ts +6 -4
  79. package/out/api/space.js.map +1 -1
  80. package/out/api/spaceProperties.d.ts +4 -4
  81. package/out/api/template.d.ts +16 -8
  82. package/out/api/template.js.map +1 -1
  83. package/out/clients/baseClient.js +3 -1
  84. package/out/clients/baseClient.js.map +1 -1
  85. package/out/clients/confluenceClient.d.ts +2 -1
  86. package/out/clients/confluenceClient.js +1 -0
  87. package/out/clients/confluenceClient.js.map +1 -1
  88. package/out/clients/serverClient.js.map +1 -1
  89. package/out/server/audit.js +6 -6
  90. package/out/server/audit.js.map +1 -1
  91. package/out/server/content.d.ts +34 -262
  92. package/out/server/content.js +40 -32
  93. package/out/server/content.js.map +1 -1
  94. package/out/server/contentBody.d.ts +2 -12
  95. package/out/server/contentBody.js +2 -1
  96. package/out/server/contentBody.js.map +1 -1
  97. package/out/server/group.js +3 -3
  98. package/out/server/group.js.map +1 -1
  99. package/out/server/longTask.js +2 -2
  100. package/out/server/longTask.js.map +1 -1
  101. package/out/server/parameters/convertContentBody.d.ts +16 -0
  102. package/out/server/parameters/updateAttachmentData.d.ts +8 -2
  103. package/out/server/search.d.ts +2 -22
  104. package/out/server/search.js +1 -1
  105. package/out/server/search.js.map +1 -1
  106. package/out/server/space.d.ts +12 -94
  107. package/out/server/space.js +14 -14
  108. package/out/server/space.js.map +1 -1
  109. package/out/server/user.d.ts +8 -152
  110. package/out/server/user.js +10 -10
  111. package/out/server/user.js.map +1 -1
  112. package/package.json +10 -10
  113. package/src/api/audit.ts +24 -12
  114. package/src/api/content.ts +23 -17
  115. package/src/api/contentAttachments.ts +19 -13
  116. package/src/api/contentBody.ts +102 -0
  117. package/src/api/contentChildrenAndDescendants.ts +3 -1
  118. package/src/api/contentContentState.ts +30 -28
  119. package/src/api/contentMacroBody.ts +119 -2
  120. package/src/api/contentRestrictions.ts +16 -8
  121. package/src/api/contentStates.ts +252 -0
  122. package/src/api/contentWatches.ts +16 -8
  123. package/src/api/dynamicModules.ts +1 -0
  124. package/src/api/experimental.ts +2 -2
  125. package/src/api/index.ts +1 -0
  126. package/src/api/models/asyncContentBody.ts +31 -0
  127. package/src/api/models/asyncId.ts +3 -0
  128. package/src/api/models/contentBodyCreate.ts +1 -0
  129. package/src/api/models/contentStateResponse.ts +8 -0
  130. package/src/api/models/contentStateRestInput.ts +11 -0
  131. package/src/api/models/index.ts +16 -12
  132. package/src/api/parameters/asyncConvertContentBodyRequest.ts +81 -0
  133. package/src/api/parameters/asyncConvertContentBodyResponse.ts +4 -0
  134. package/src/api/parameters/convertContentBody.ts +39 -2
  135. package/src/api/parameters/getAndAsyncConvertMacroBodyByMacroId.ts +88 -0
  136. package/src/api/parameters/getAndConvertMacroBodyByMacroId.ts +104 -0
  137. package/src/api/parameters/getAvailableContentStates.ts +5 -2
  138. package/src/api/parameters/getContentState.ts +9 -4
  139. package/src/api/parameters/getSpaceContentStates.ts +4 -0
  140. package/src/api/parameters/getUser.ts +14 -4
  141. package/src/api/parameters/index.ts +5 -0
  142. package/src/api/parameters/movePage.ts +9 -5
  143. package/src/api/parameters/removeContentState.ts +6 -1
  144. package/src/api/parameters/setContentState.ts +13 -5
  145. package/src/api/relation.ts +8 -4
  146. package/src/api/settings.ts +6 -4
  147. package/src/api/space.ts +7 -5
  148. package/src/api/spaceProperties.ts +4 -4
  149. package/src/api/template.ts +16 -8
  150. package/src/clients/baseClient.ts +5 -10
  151. package/src/clients/client.ts +1 -5
  152. package/src/clients/confluenceClient.ts +2 -0
  153. package/src/clients/serverClient.ts +1 -10
  154. package/src/server/audit.ts +6 -6
  155. package/src/server/content.ts +78 -295
  156. package/src/server/contentBody.ts +4 -13
  157. package/src/server/group.ts +3 -3
  158. package/src/server/longTask.ts +2 -2
  159. package/src/server/parameters/convertContentBody.ts +37 -0
  160. package/src/server/parameters/updateAttachmentData.ts +7 -3
  161. package/src/server/search.ts +3 -23
  162. package/src/server/space.ts +26 -108
  163. package/src/server/user.ts +18 -162
@@ -111,8 +111,8 @@ export class SpaceProperties {
111
111
  }
112
112
 
113
113
  /**
114
- * Creates a new space property. This is the same as `POST /wiki/rest/api/space/{spaceKey}/property` but the key for
115
- * the property is passed as a path parameter, rather than in the request body.
114
+ * Creates a new space property. This is the same as `POST /api/space/{spaceKey}/property` but the key for the
115
+ * property is passed as a path parameter, rather than in the request body.
116
116
  *
117
117
  * **[Permissions required](https://confluence.atlassian.com/x/_AozKw)**: ‘Admin’ permission for the space.
118
118
  */
@@ -121,8 +121,8 @@ export class SpaceProperties {
121
121
  callback: Callback<T>
122
122
  ): Promise<void>;
123
123
  /**
124
- * Creates a new space property. This is the same as `POST /wiki/rest/api/space/{spaceKey}/property` but the key for
125
- * the property is passed as a path parameter, rather than in the request body.
124
+ * Creates a new space property. This is the same as `POST /api/space/{spaceKey}/property` but the key for the
125
+ * property is passed as a path parameter, rather than in the request body.
126
126
  *
127
127
  * **[Permissions required](https://confluence.atlassian.com/x/_AozKw)**: ‘Admin’ permission for the space.
128
128
  */
@@ -137,20 +137,24 @@ export class Template {
137
137
  }
138
138
 
139
139
  /**
140
- * Returns all content templates. Use this method to retrieve all global content templates or all content templates in a space.
140
+ * Returns all content templates. Use this method to retrieve all global content templates or all content templates in
141
+ * a space.
141
142
  *
142
143
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
143
- * space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
144
+ * space templates and permission to access the Confluence site ('Can use' global permission) to view global
145
+ * templates.
144
146
  */
145
147
  async getContentTemplates<T = Models.ContentTemplateArray>(
146
148
  parameters: Parameters.GetContentTemplates | undefined,
147
149
  callback: Callback<T>
148
150
  ): Promise<void>;
149
151
  /**
150
- * Returns all content templates. Use this method to retrieve all global content templates or all content templates in a space.
152
+ * Returns all content templates. Use this method to retrieve all global content templates or all content templates in
153
+ * a space.
151
154
  *
152
155
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
153
- * space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
156
+ * space templates and permission to access the Confluence site ('Can use' global permission) to view global
157
+ * templates.
154
158
  */
155
159
  async getContentTemplates<T = Models.ContentTemplateArray>(
156
160
  parameters?: Parameters.GetContentTemplates,
@@ -179,7 +183,8 @@ export class Template {
179
183
  * the template is in, the body of the template, and more.
180
184
  *
181
185
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
182
- * space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
186
+ * space templates and permission to access the Confluence site ('Can use' global permission) to view global
187
+ * templates.
183
188
  */
184
189
  async getContentTemplate<T = Models.ContentTemplate>(
185
190
  parameters: Parameters.GetContentTemplate,
@@ -190,7 +195,8 @@ export class Template {
190
195
  * the template is in, the body of the template, and more.
191
196
  *
192
197
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
193
- * space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
198
+ * space templates and permission to access the Confluence site ('Can use' global permission) to view global
199
+ * templates.
194
200
  */
195
201
  async getContentTemplate<T = Models.ContentTemplate>(
196
202
  parameters: Parameters.GetContentTemplate,
@@ -214,7 +220,8 @@ export class Template {
214
220
  * - If the template is a content template, it is deleted.
215
221
  * - If the template is a modified space-level blueprint template, it reverts to the template inherited from the
216
222
  * global-level blueprint template.
217
- * - If the template is a modified global-level blueprint template, it reverts to the default global-level blueprint template.
223
+ * - If the template is a modified global-level blueprint template, it reverts to the default global-level blueprint
224
+ * template.
218
225
  *
219
226
  * Note, unmodified blueprint templates cannot be deleted.
220
227
  *
@@ -228,7 +235,8 @@ export class Template {
228
235
  * - If the template is a content template, it is deleted.
229
236
  * - If the template is a modified space-level blueprint template, it reverts to the template inherited from the
230
237
  * global-level blueprint template.
231
- * - If the template is a modified global-level blueprint template, it reverts to the default global-level blueprint template.
238
+ * - If the template is a modified global-level blueprint template, it reverts to the default global-level blueprint
239
+ * template.
232
240
  *
233
241
  * Note, unmodified blueprint templates cannot be deleted.
234
242
  *
@@ -74,7 +74,9 @@ export class BaseClient implements Client {
74
74
  ...this.config.baseRequestConfig,
75
75
  baseURL: `${this.config.host}${this.urlSuffix}`,
76
76
  headers: this.removeUndefinedProperties({
77
- [ATLASSIAN_TOKEN_CHECK_FLAG]: this.config.noCheckAtlassianToken ? ATLASSIAN_TOKEN_CHECK_NOCHECK_VALUE : undefined,
77
+ [ATLASSIAN_TOKEN_CHECK_FLAG]: this.config.noCheckAtlassianToken
78
+ ? ATLASSIAN_TOKEN_CHECK_NOCHECK_VALUE
79
+ : undefined,
78
80
  ...this.config.baseRequestConfig?.headers,
79
81
  }),
80
82
  });
@@ -83,15 +85,8 @@ export class BaseClient implements Client {
83
85
  }
84
86
 
85
87
  async sendRequest<T>(requestConfig: RequestConfig, callback: never, telemetryData?: any): Promise<T>;
86
- async sendRequest<T>(
87
- requestConfig: RequestConfig,
88
- callback: Callback<T>,
89
- telemetryData?: any,
90
- ): Promise<void>;
91
- async sendRequest<T>(
92
- requestConfig: RequestConfig,
93
- callback: Callback<T> | never,
94
- ): Promise<void | T> {
88
+ async sendRequest<T>(requestConfig: RequestConfig, callback: Callback<T>, telemetryData?: any): Promise<void>;
89
+ async sendRequest<T>(requestConfig: RequestConfig, callback: Callback<T> | never): Promise<void | T> {
95
90
  try {
96
91
  const modifiedRequestConfig = {
97
92
  ...requestConfig,
@@ -3,9 +3,5 @@ import type { RequestConfig } from '../requestConfig';
3
3
 
4
4
  export interface Client {
5
5
  sendRequest<T>(requestConfig: RequestConfig, callback?: never, telemetryData?: any): Promise<T>;
6
- sendRequest<T>(
7
- requestConfig: RequestConfig,
8
- callback?: Callback<T>,
9
- telemetryData?: any,
10
- ): Promise<void>;
6
+ sendRequest<T>(requestConfig: RequestConfig, callback?: Callback<T>, telemetryData?: any): Promise<void>;
11
7
  }
@@ -13,6 +13,7 @@ import {
13
13
  ContentPermissions,
14
14
  ContentProperties,
15
15
  ContentRestrictions,
16
+ ContentStates,
16
17
  ContentVersions,
17
18
  ContentWatches,
18
19
  DynamicModules,
@@ -47,6 +48,7 @@ export class ConfluenceClient extends BaseClient {
47
48
  contentPermissions = new ContentPermissions(this);
48
49
  contentProperties = new ContentProperties(this);
49
50
  contentRestrictions = new ContentRestrictions(this);
51
+ contentStates = new ContentStates(this);
50
52
  contentVersions = new ContentVersions(this);
51
53
  contentWatches = new ContentWatches(this);
52
54
  dynamicModules = new DynamicModules(this);
@@ -1,14 +1,5 @@
1
1
  import { BaseClient } from './baseClient';
2
- import {
3
- Audit,
4
- Content,
5
- ContentBody,
6
- Group,
7
- LongTask,
8
- Search,
9
- Space,
10
- User,
11
- } from '../server';
2
+ import { Audit, Content, ContentBody, Group, LongTask, Search, Space, User } from '../server';
12
3
 
13
4
  export class ServerClient extends BaseClient {
14
5
  urlSuffix = '/';
@@ -34,7 +34,7 @@ export class Audit {
34
34
  },
35
35
  };
36
36
 
37
- return this.client.sendRequest(config, callback, { methodName: 'server.getAuditRecords' });
37
+ return this.client.sendRequest(config, callback);
38
38
  }
39
39
 
40
40
  /** Creates a record in the audit log. */
@@ -68,7 +68,7 @@ export class Audit {
68
68
  },
69
69
  };
70
70
 
71
- return this.client.sendRequest(config, callback, { methodName: 'server.createAuditRecord' });
71
+ return this.client.sendRequest(config, callback);
72
72
  }
73
73
 
74
74
  /** Exports audit records as a CSV file or ZIP file. */
@@ -93,7 +93,7 @@ export class Audit {
93
93
  },
94
94
  };
95
95
 
96
- return this.client.sendRequest(config, callback, { methodName: 'server.exportAuditRecords' });
96
+ return this.client.sendRequest(config, callback);
97
97
  }
98
98
 
99
99
  /** Fetches the current retention periodResponses */
@@ -106,7 +106,7 @@ export class Audit {
106
106
  method: 'GET',
107
107
  };
108
108
 
109
- return this.client.sendRequest(config, callback, { methodName: 'server.getRetentionPeriod' });
109
+ return this.client.sendRequest(config, callback);
110
110
  }
111
111
 
112
112
  /** Set the retention period to a new value. Can throw ServiceException if the retention period is too long */
@@ -132,7 +132,7 @@ export class Audit {
132
132
  },
133
133
  };
134
134
 
135
- return this.client.sendRequest(config, callback, { methodName: 'server.setRetentionPeriod' });
135
+ return this.client.sendRequest(config, callback);
136
136
  }
137
137
 
138
138
  /** Fetch a paginated list of AuditRecord instances dating back to a certain time */
@@ -161,6 +161,6 @@ export class Audit {
161
161
  },
162
162
  };
163
163
 
164
- return this.client.sendRequest(config, callback, { methodName: 'server.getAuditRecordsForTimePeriod' });
164
+ return this.client.sendRequest(config, callback);
165
165
  }
166
166
  }