@alfresco/js-api 9.4.0-17806466306 → 9.4.0-17827115123

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 (74) hide show
  1. package/esm2015/index.js +1 -0
  2. package/esm2015/index.js.map +1 -1
  3. package/esm2015/package.json +3 -3
  4. package/esm2015/src/alfrescoApi.js +14 -14
  5. package/esm2015/src/alfrescoApi.js.map +1 -1
  6. package/esm2015/src/alfrescoApiClient.js +28 -14
  7. package/esm2015/src/alfrescoApiClient.js.map +1 -1
  8. package/esm2015/src/api/content-custom-api/api/upload.api.js +52 -1
  9. package/esm2015/src/api/content-custom-api/api/upload.api.js.map +1 -1
  10. package/esm2015/src/api-clients/http-client.interface.js.map +1 -1
  11. package/esm2015/src/authentication/contentAuth.js +4 -7
  12. package/esm2015/src/authentication/contentAuth.js.map +1 -1
  13. package/esm2015/src/authentication/oauth2Auth.js +3 -4
  14. package/esm2015/src/authentication/oauth2Auth.js.map +1 -1
  15. package/esm2015/src/authentication/processAuth.js +3 -5
  16. package/esm2015/src/authentication/processAuth.js.map +1 -1
  17. package/esm2015/src/axiosHttpClient.js +283 -0
  18. package/esm2015/src/axiosHttpClient.js.map +1 -0
  19. package/esm2015/src/types.js +18 -0
  20. package/esm2015/src/types.js.map +1 -0
  21. package/esm5/index.js +1 -0
  22. package/esm5/index.js.map +1 -1
  23. package/esm5/package.json +3 -3
  24. package/esm5/src/alfrescoApi.js +14 -14
  25. package/esm5/src/alfrescoApi.js.map +1 -1
  26. package/esm5/src/alfrescoApiClient.js +28 -14
  27. package/esm5/src/alfrescoApiClient.js.map +1 -1
  28. package/esm5/src/api/content-custom-api/api/upload.api.js +52 -1
  29. package/esm5/src/api/content-custom-api/api/upload.api.js.map +1 -1
  30. package/esm5/src/api-clients/http-client.interface.js.map +1 -1
  31. package/esm5/src/authentication/contentAuth.js +4 -7
  32. package/esm5/src/authentication/contentAuth.js.map +1 -1
  33. package/esm5/src/authentication/oauth2Auth.js +3 -4
  34. package/esm5/src/authentication/oauth2Auth.js.map +1 -1
  35. package/esm5/src/authentication/processAuth.js +3 -5
  36. package/esm5/src/authentication/processAuth.js.map +1 -1
  37. package/esm5/src/axiosHttpClient.js +283 -0
  38. package/esm5/src/axiosHttpClient.js.map +1 -0
  39. package/esm5/src/types.js +18 -0
  40. package/esm5/src/types.js.map +1 -0
  41. package/index.js +1 -0
  42. package/index.js.map +1 -1
  43. package/package.json +3 -3
  44. package/src/alfrescoApi.js +14 -15
  45. package/src/alfrescoApi.js.map +1 -1
  46. package/src/alfrescoApiClient.js +28 -15
  47. package/src/alfrescoApiClient.js.map +1 -1
  48. package/src/api/content-custom-api/api/upload.api.js +52 -1
  49. package/src/api/content-custom-api/api/upload.api.js.map +1 -1
  50. package/src/api-clients/http-client.interface.js.map +1 -1
  51. package/src/authentication/contentAuth.js +4 -8
  52. package/src/authentication/contentAuth.js.map +1 -1
  53. package/src/authentication/oauth2Auth.js +3 -4
  54. package/src/authentication/oauth2Auth.js.map +1 -1
  55. package/src/authentication/processAuth.js +3 -6
  56. package/src/authentication/processAuth.js.map +1 -1
  57. package/src/axiosHttpClient.js +287 -0
  58. package/src/axiosHttpClient.js.map +1 -0
  59. package/src/types.js +19 -0
  60. package/src/types.js.map +1 -0
  61. package/typings/index.d.ts +1 -0
  62. package/typings/package.json +3 -3
  63. package/typings/src/alfrescoApi.d.ts +2 -10
  64. package/typings/src/alfrescoApiClient.d.ts +12 -11
  65. package/typings/src/api-clients/http-client.interface.d.ts +8 -3
  66. package/typings/src/authentication/oauth2Auth.d.ts +1 -1
  67. package/typings/src/{superagentHttpClient.d.ts → axiosHttpClient.d.ts} +5 -5
  68. package/typings/src/types.d.ts +19 -0
  69. package/esm2015/src/superagentHttpClient.js +0 -264
  70. package/esm2015/src/superagentHttpClient.js.map +0 -1
  71. package/esm5/src/superagentHttpClient.js +0 -264
  72. package/esm5/src/superagentHttpClient.js.map +0 -1
  73. package/src/superagentHttpClient.js +0 -269
  74. package/src/superagentHttpClient.js.map +0 -1
@@ -0,0 +1,283 @@
1
+ /*!
2
+ * @license
3
+ * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { __awaiter } from "tslib";
18
+ import axios from 'axios';
19
+ import { isBrowser, paramToString } from './utils';
20
+ const isProgressEvent = (event) => event === null || event === void 0 ? void 0 : event.lengthComputable;
21
+ export class AxiosHttpClient {
22
+ constructor() {
23
+ this.timeout = undefined;
24
+ }
25
+ post(url, options, securityOptions, emitters) {
26
+ return this.request(url, Object.assign(Object.assign({}, options), { httpMethod: 'POST' }), securityOptions, emitters);
27
+ }
28
+ put(url, options, securityOptions, emitters) {
29
+ return this.request(url, Object.assign(Object.assign({}, options), { httpMethod: 'PUT' }), securityOptions, emitters);
30
+ }
31
+ get(url, options, securityOptions, emitters) {
32
+ return this.request(url, Object.assign(Object.assign({}, options), { httpMethod: 'GET' }), securityOptions, emitters);
33
+ }
34
+ delete(url, options, securityOptions, emitters) {
35
+ return this.request(url, Object.assign(Object.assign({}, options), { httpMethod: 'DELETE' }), securityOptions, emitters);
36
+ }
37
+ request(url, options, securityOptions, emitters) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const { httpMethod, queryParams, headerParams, formParams, bodyParam, contentType, accept, responseType, returnType } = options;
40
+ const { eventEmitter, apiClientEmitter } = emitters;
41
+ const config = this.buildRequest(httpMethod, url, queryParams, headerParams, formParams, bodyParam, contentType, accept, responseType, eventEmitter, returnType, securityOptions);
42
+ const source = axios.CancelToken.source();
43
+ config.cancelToken = source.token;
44
+ if (returnType === 'Binary') {
45
+ config.responseType = 'arraybuffer';
46
+ }
47
+ const promise = axios(config)
48
+ .then((response) => {
49
+ var _a;
50
+ if (securityOptions.isBpmRequest) {
51
+ const hasSetCookie = response.headers['set-cookie'];
52
+ if (response.headers && hasSetCookie) {
53
+ securityOptions.authentications.cookie = hasSetCookie[0];
54
+ }
55
+ }
56
+ let data = {};
57
+ if ((_a = response.headers['content-type']) === null || _a === void 0 ? void 0 : _a.includes('text/html')) {
58
+ data = AxiosHttpClient.deserialize(response);
59
+ }
60
+ else {
61
+ data = AxiosHttpClient.deserialize(response, returnType);
62
+ }
63
+ eventEmitter.emit('success', data);
64
+ return data;
65
+ })
66
+ .catch((error) => {
67
+ var _a, _b;
68
+ apiClientEmitter.emit('error', error);
69
+ eventEmitter.emit('error', error);
70
+ if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
71
+ apiClientEmitter.emit('unauthorized');
72
+ eventEmitter.emit('unauthorized');
73
+ }
74
+ if ((_b = error.response) === null || _b === void 0 ? void 0 : _b.data) {
75
+ const responseError = error.response.data;
76
+ const enrichedError = Object.assign(error, {
77
+ message: typeof responseError === 'string' ? responseError : JSON.stringify(responseError)
78
+ });
79
+ throw enrichedError;
80
+ }
81
+ else {
82
+ throw { error };
83
+ }
84
+ });
85
+ promise.abort = function () {
86
+ eventEmitter.emit('abort');
87
+ source.cancel('Request aborted');
88
+ return this;
89
+ };
90
+ return promise;
91
+ });
92
+ }
93
+ buildRequest(httpMethod, url, queryParams, headerParams, formParams, bodyParam, contentType, accept, responseType, eventEmitter, returnType, securityOptions) {
94
+ var _a, _b;
95
+ const { isBpmRequest, authentications, defaultHeaders = {}, enableCsrf, withCredentials = false } = securityOptions;
96
+ const config = {
97
+ method: httpMethod,
98
+ url,
99
+ params: AxiosHttpClient.normalizeParams(queryParams),
100
+ headers: Object.assign(Object.assign({}, defaultHeaders), AxiosHttpClient.normalizeParams(headerParams)),
101
+ timeout: typeof this.timeout === 'number' ? this.timeout : (_a = this.timeout) === null || _a === void 0 ? void 0 : _a.response,
102
+ withCredentials
103
+ };
104
+ this.applyAuthToRequest(config, authentications);
105
+ if (isBpmRequest && enableCsrf) {
106
+ this.setCsrfToken(config);
107
+ }
108
+ if (isBpmRequest) {
109
+ config.withCredentials = true;
110
+ if (securityOptions.authentications.cookie) {
111
+ if (!isBrowser()) {
112
+ config.headers = Object.assign(Object.assign({}, config.headers), { Cookie: securityOptions.authentications.cookie });
113
+ }
114
+ }
115
+ }
116
+ if (contentType && contentType !== 'multipart/form-data') {
117
+ config.headers = Object.assign(Object.assign({}, config.headers), { 'Content-Type': contentType });
118
+ }
119
+ else if (!((_b = config.headers) === null || _b === void 0 ? void 0 : _b['Content-Type']) && contentType !== 'multipart/form-data') {
120
+ config.headers = Object.assign(Object.assign({}, config.headers), { 'Content-Type': 'application/json' });
121
+ }
122
+ if (contentType === 'application/x-www-form-urlencoded') {
123
+ const params = new URLSearchParams();
124
+ const normalizedParams = AxiosHttpClient.normalizeParams(formParams);
125
+ Object.keys(normalizedParams).forEach((key) => {
126
+ params.append(key, normalizedParams[key]);
127
+ });
128
+ config.data = params;
129
+ config.onUploadProgress = (progressEvent) => {
130
+ this.progress(progressEvent, eventEmitter);
131
+ };
132
+ }
133
+ else if (contentType === 'multipart/form-data') {
134
+ const formData = new FormData();
135
+ const _formParams = AxiosHttpClient.normalizeParams(formParams);
136
+ for (const key in _formParams) {
137
+ if (Object.prototype.hasOwnProperty.call(_formParams, key)) {
138
+ if (AxiosHttpClient.isFileParam(_formParams[key])) {
139
+ formData.append(key, _formParams[key]);
140
+ }
141
+ else {
142
+ formData.append(key, _formParams[key]);
143
+ }
144
+ }
145
+ }
146
+ config.data = formData;
147
+ delete config.headers['Content-Type'];
148
+ config.onUploadProgress = (progressEvent) => {
149
+ this.progress(progressEvent, eventEmitter);
150
+ };
151
+ }
152
+ else if (bodyParam) {
153
+ config.data = bodyParam;
154
+ config.onUploadProgress = (progressEvent) => {
155
+ this.progress(progressEvent, eventEmitter);
156
+ };
157
+ }
158
+ if (accept) {
159
+ config.headers = Object.assign(Object.assign({}, config.headers), { Accept: accept });
160
+ }
161
+ if (returnType === 'blob' || returnType === 'Blob' || responseType === 'blob' || responseType === 'Blob') {
162
+ config.responseType = 'blob';
163
+ }
164
+ else if (returnType === 'String') {
165
+ config.responseType = 'text';
166
+ }
167
+ return config;
168
+ }
169
+ setCsrfToken(config) {
170
+ const token = AxiosHttpClient.createCSRFToken();
171
+ config.headers = Object.assign(Object.assign({}, config.headers), { 'X-CSRF-TOKEN': token });
172
+ if (!isBrowser()) {
173
+ config.headers = Object.assign(Object.assign({}, config.headers), { Cookie: `CSRF-TOKEN=${token};path=/` });
174
+ }
175
+ try {
176
+ document.cookie = `CSRF-TOKEN=${token};path=/`;
177
+ }
178
+ catch (_a) {
179
+ }
180
+ }
181
+ applyAuthToRequest(config, authentications) {
182
+ if (authentications) {
183
+ switch (authentications.type) {
184
+ case 'basic': {
185
+ const basicAuth = authentications.basicAuth;
186
+ if (basicAuth.username || basicAuth.password) {
187
+ config.auth = {
188
+ username: basicAuth.username || '',
189
+ password: basicAuth.password || ''
190
+ };
191
+ }
192
+ break;
193
+ }
194
+ case 'activiti': {
195
+ if (authentications.basicAuth.ticket) {
196
+ config.headers = Object.assign(Object.assign({}, config.headers), { Authorization: authentications.basicAuth.ticket });
197
+ }
198
+ break;
199
+ }
200
+ case 'oauth2': {
201
+ const oauth2 = authentications.oauth2;
202
+ if (oauth2.accessToken) {
203
+ config.headers = Object.assign(Object.assign({}, config.headers), { Authorization: `Bearer ${oauth2.accessToken}` });
204
+ }
205
+ break;
206
+ }
207
+ default:
208
+ throw new Error('Unknown authentication type: ' + authentications.type);
209
+ }
210
+ }
211
+ }
212
+ progress(event, eventEmitter) {
213
+ if (isProgressEvent(event)) {
214
+ const percent = Math.round((event.loaded / event.total) * 100);
215
+ const progress = {
216
+ total: event.total,
217
+ loaded: event.loaded,
218
+ percent
219
+ };
220
+ eventEmitter.emit('progress', progress);
221
+ }
222
+ }
223
+ static createCSRFToken(a) {
224
+ return a
225
+ ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
226
+ : ([1e16] + (1e16).toString()).replace(/[01]/g, AxiosHttpClient.createCSRFToken);
227
+ }
228
+ static deserialize(response, returnType) {
229
+ if (response === null) {
230
+ return null;
231
+ }
232
+ let data = response.data;
233
+ if (data === null) {
234
+ data = response.statusText;
235
+ }
236
+ if (returnType) {
237
+ if (returnType === 'blob' && isBrowser()) {
238
+ data = new Blob([data], { type: response.headers['content-type'] });
239
+ }
240
+ else if (returnType === 'blob' && !isBrowser()) {
241
+ data = Buffer.from(data, 'binary');
242
+ }
243
+ else if (Array.isArray(data)) {
244
+ data = data.map((element) => new returnType(element));
245
+ }
246
+ else {
247
+ data = new returnType(data);
248
+ }
249
+ }
250
+ return data;
251
+ }
252
+ static normalizeParams(params) {
253
+ const newParams = {};
254
+ for (const key in params) {
255
+ if (Object.prototype.hasOwnProperty.call(params, key) && params[key] !== undefined && params[key] !== null) {
256
+ const value = params[key];
257
+ if (AxiosHttpClient.isFileParam(value) || Array.isArray(value)) {
258
+ newParams[key] = value;
259
+ }
260
+ else {
261
+ newParams[key] = paramToString(value);
262
+ }
263
+ }
264
+ }
265
+ return newParams;
266
+ }
267
+ static isFileParam(param) {
268
+ if (typeof Buffer === 'function' && (param instanceof Buffer || param.path)) {
269
+ return true;
270
+ }
271
+ if (typeof Blob === 'function' && param instanceof Blob) {
272
+ return true;
273
+ }
274
+ if (typeof File === 'function' && param instanceof File) {
275
+ return true;
276
+ }
277
+ if (typeof File === 'object' && param instanceof File) {
278
+ return true;
279
+ }
280
+ return false;
281
+ }
282
+ }
283
+ //# sourceMappingURL=../../../../../lib/js-api/src/axiosHttpClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axiosHttpClient.js","sourceRoot":"","sources":["axiosHttpClient.ts"],"names":[],"mappings":"AA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;QACL,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAOO,MAAM,CAAC,WAAW,CAAC,KAAU;QAEjC,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,CAAC,KAAK,YAAY,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1E,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,OAAO,IAAI,KAAK,UAAU,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;YACtD,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,OAAO,IAAI,KAAK,UAAU,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;YACtD,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;YACpD,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["/*!\n * @license\n * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport axios, { AxiosResponse, AxiosRequestConfig, AxiosError } from 'axios';\nimport { Authentication } from './authentication/authentication';\nimport { RequestOptions, HttpClient, SecurityOptions, Emitters } from './api-clients/http-client.interface';\nimport { Oauth2 } from './authentication/oauth2';\nimport { BasicAuth } from './authentication/basicAuth';\nimport { isBrowser, paramToString } from './utils';\nimport { EventEmitterInstance } from './types';\n\ndeclare const Blob: any;\ndeclare const Buffer: any;\n\nconst isProgressEvent = (event: ProgressEvent | unknown): event is ProgressEvent => (event as ProgressEvent)?.lengthComputable;\n\nexport class AxiosHttpClient implements HttpClient {\n /**\n * The default HTTP timeout for all API calls.\n */\n timeout: number | { deadline?: number; response?: number } = undefined;\n\n post<T = any>(url: string, options: RequestOptions, securityOptions: SecurityOptions, emitters: Emitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'POST' }, securityOptions, emitters);\n }\n\n put<T = any>(url: string, options: RequestOptions, securityOptions: SecurityOptions, emitters: Emitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'PUT' }, securityOptions, emitters);\n }\n\n get<T = any>(url: string, options: RequestOptions, securityOptions: SecurityOptions, emitters: Emitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'GET' }, securityOptions, emitters);\n }\n\n delete<T = void>(url: string, options: RequestOptions, securityOptions: SecurityOptions, emitters: Emitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'DELETE' }, securityOptions, emitters);\n }\n\n async request<T = any>(url: string, options: RequestOptions, securityOptions: SecurityOptions, emitters: Emitters): Promise<T> {\n const { httpMethod, queryParams, headerParams, formParams, bodyParam, contentType, accept, responseType, returnType } = options;\n const { eventEmitter, apiClientEmitter } = emitters;\n\n const config = this.buildRequest(\n httpMethod,\n url,\n queryParams,\n headerParams,\n formParams,\n bodyParam,\n contentType,\n accept,\n responseType,\n eventEmitter,\n returnType,\n securityOptions\n );\n\n const source = axios.CancelToken.source();\n config.cancelToken = source.token;\n\n if (returnType === 'Binary') {\n config.responseType = 'arraybuffer';\n }\n\n const promise: any = axios(config)\n .then((response: AxiosResponse<T>) => {\n if (securityOptions.isBpmRequest) {\n const hasSetCookie = response.headers['set-cookie'];\n if (response.headers && hasSetCookie) {\n // mutate the passed value from AlfrescoApiClient class for backward compatibility\n securityOptions.authentications.cookie = hasSetCookie[0];\n }\n }\n let data = {};\n if (response.headers['content-type']?.includes('text/html')) {\n data = AxiosHttpClient.deserialize(response);\n } else {\n data = AxiosHttpClient.deserialize(response, returnType);\n }\n\n eventEmitter.emit('success', data);\n return data;\n })\n .catch((error: AxiosError) => {\n apiClientEmitter.emit('error', error);\n eventEmitter.emit('error', error);\n\n if (error.response?.status === 401) {\n apiClientEmitter.emit('unauthorized');\n eventEmitter.emit('unauthorized');\n }\n\n if (error.response?.data) {\n const responseError = error.response.data;\n const enrichedError = Object.assign(error, {\n message: typeof responseError === 'string' ? responseError : JSON.stringify(responseError)\n });\n throw enrichedError;\n } else {\n throw { error };\n }\n });\n\n promise.abort = function () {\n eventEmitter.emit('abort');\n source.cancel('Request aborted');\n return this;\n };\n\n return promise;\n }\n\n private buildRequest(\n httpMethod: string,\n url: string,\n queryParams: { [key: string]: any },\n headerParams: { [key: string]: any },\n formParams: { [key: string]: any },\n // eslint-disable-next-line @typescript-eslint/ban-types\n bodyParam: string | Object,\n contentType: string,\n accept: string,\n responseType: string,\n eventEmitter: EventEmitterInstance,\n returnType: string,\n securityOptions: SecurityOptions\n ): AxiosRequestConfig {\n const { isBpmRequest, authentications, defaultHeaders = {}, enableCsrf, withCredentials = false } = securityOptions;\n\n const config: AxiosRequestConfig = {\n method: httpMethod as any,\n url,\n params: AxiosHttpClient.normalizeParams(queryParams),\n headers: {\n ...defaultHeaders,\n ...AxiosHttpClient.normalizeParams(headerParams)\n },\n timeout: typeof this.timeout === 'number' ? this.timeout : this.timeout?.response,\n withCredentials\n };\n\n // apply authentications\n this.applyAuthToRequest(config, authentications);\n\n if (isBpmRequest && enableCsrf) {\n this.setCsrfToken(config);\n }\n\n // add cookie for activiti\n if (isBpmRequest) {\n config.withCredentials = true;\n if (securityOptions.authentications.cookie) {\n if (!isBrowser()) {\n config.headers = {\n ...config.headers,\n Cookie: securityOptions.authentications.cookie\n };\n }\n }\n }\n\n if (contentType && contentType !== 'multipart/form-data') {\n config.headers = {\n ...config.headers,\n 'Content-Type': contentType\n };\n } else if (!config.headers?.['Content-Type'] && contentType !== 'multipart/form-data') {\n config.headers = {\n ...config.headers,\n 'Content-Type': 'application/json'\n };\n }\n\n if (contentType === 'application/x-www-form-urlencoded') {\n const params = new URLSearchParams();\n const normalizedParams = AxiosHttpClient.normalizeParams(formParams);\n Object.keys(normalizedParams).forEach((key) => {\n params.append(key, normalizedParams[key]);\n });\n config.data = params;\n\n config.onUploadProgress = (progressEvent) => {\n this.progress(progressEvent, eventEmitter);\n };\n } else if (contentType === 'multipart/form-data') {\n const formData = new FormData();\n const _formParams = AxiosHttpClient.normalizeParams(formParams);\n for (const key in _formParams) {\n if (Object.prototype.hasOwnProperty.call(_formParams, key)) {\n if (AxiosHttpClient.isFileParam(_formParams[key])) {\n // file field\n formData.append(key, _formParams[key]);\n } else {\n formData.append(key, _formParams[key]);\n }\n }\n }\n config.data = formData;\n // Remove Content-Type header for multipart/form-data to let axios set the boundary\n delete config.headers['Content-Type'];\n\n config.onUploadProgress = (progressEvent) => {\n this.progress(progressEvent, eventEmitter);\n };\n } else if (bodyParam) {\n config.data = bodyParam;\n\n config.onUploadProgress = (progressEvent) => {\n this.progress(progressEvent, eventEmitter);\n };\n }\n\n if (accept) {\n config.headers = {\n ...config.headers,\n Accept: accept\n };\n }\n\n if (returnType === 'blob' || returnType === 'Blob' || responseType === 'blob' || responseType === 'Blob') {\n config.responseType = 'blob';\n } else if (returnType === 'String') {\n config.responseType = 'text';\n }\n\n return config;\n }\n\n setCsrfToken(config: AxiosRequestConfig): void {\n const token = AxiosHttpClient.createCSRFToken();\n config.headers = {\n ...config.headers,\n 'X-CSRF-TOKEN': token\n };\n\n if (!isBrowser()) {\n config.headers = {\n ...config.headers,\n Cookie: `CSRF-TOKEN=${token};path=/`\n };\n }\n\n try {\n document.cookie = `CSRF-TOKEN=${token};path=/`;\n } catch {\n /* continue regardless of error */\n }\n }\n\n /**\n * Applies authentication headers to the request.\n * @param config The axios request config object.\n * @param authentications authentications\n */\n private applyAuthToRequest(config: AxiosRequestConfig, authentications: Authentication) {\n if (authentications) {\n switch (authentications.type) {\n case 'basic': {\n const basicAuth: BasicAuth = authentications.basicAuth;\n if (basicAuth.username || basicAuth.password) {\n config.auth = {\n username: basicAuth.username || '',\n password: basicAuth.password || ''\n };\n }\n break;\n }\n case 'activiti': {\n if (authentications.basicAuth.ticket) {\n config.headers = {\n ...config.headers,\n Authorization: authentications.basicAuth.ticket\n };\n }\n break;\n }\n case 'oauth2': {\n const oauth2: Oauth2 = authentications.oauth2;\n if (oauth2.accessToken) {\n config.headers = {\n ...config.headers,\n Authorization: `Bearer ${oauth2.accessToken}`\n };\n }\n break;\n }\n default:\n throw new Error('Unknown authentication type: ' + authentications.type);\n }\n }\n }\n\n private progress(event: ProgressEvent | unknown, eventEmitter: EventEmitterInstance): void {\n if (isProgressEvent(event)) {\n const percent = Math.round((event.loaded / event.total) * 100);\n\n const progress = {\n total: event.total,\n loaded: event.loaded,\n percent\n };\n\n eventEmitter.emit('progress', progress);\n }\n }\n\n private static createCSRFToken(a?: any): string {\n return a\n ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)\n : ([1e16] + (1e16).toString()).replace(/[01]/g, AxiosHttpClient.createCSRFToken);\n }\n\n /**\n * Deserializes an HTTP response body into a value of the specified type.\n * @param response An Axios response object.\n * @param returnType The type to return. Pass a string for simple types\n * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To\n * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:\n * all properties on <code>data<code> will be converted to this type.\n * @returns A value of the specified type.\n */\n private static deserialize(response: AxiosResponse, returnType?: any): any {\n if (response === null) {\n return null;\n }\n\n let data = response.data;\n\n if (data === null) {\n data = response.statusText;\n }\n\n if (returnType) {\n if (returnType === 'blob' && isBrowser()) {\n data = new Blob([data], { type: response.headers['content-type'] });\n } else if (returnType === 'blob' && !isBrowser()) {\n data = Buffer.from(data, 'binary');\n } else if (Array.isArray(data)) {\n data = data.map((element) => new returnType(element));\n } else {\n data = new returnType(data);\n }\n }\n\n return data;\n }\n\n /**\n * Normalizes parameter values:\n * <ul>\n * <li>remove nils</li>\n * <li>keep files and arrays</li>\n * <li>format to string with `paramToString` for other cases</li>\n * </ul>\n * @param params The parameters as object properties.\n * @returns normalized parameters.\n */\n private static normalizeParams(params: { [key: string]: any }): { [key: string]: any } {\n const newParams: { [key: string]: any } = {};\n\n for (const key in params) {\n if (Object.prototype.hasOwnProperty.call(params, key) && params[key] !== undefined && params[key] !== null) {\n const value = params[key];\n if (AxiosHttpClient.isFileParam(value) || Array.isArray(value)) {\n newParams[key] = value;\n } else {\n newParams[key] = paramToString(value);\n }\n }\n }\n return newParams;\n }\n\n /**\n * Checks whether the given parameter value represents file-like content.\n * @param param The parameter to check.\n * @returns <code>true</code> if <code>param</code> represents a file.\n */\n private static isFileParam(param: any): boolean {\n // Buffer in Node.js\n if (typeof Buffer === 'function' && (param instanceof Buffer || param.path)) {\n return true;\n }\n // Blob in browser\n if (typeof Blob === 'function' && param instanceof Blob) {\n return true;\n }\n // File in browser (it seems File object is also instance of Blob, but keep this for safe)\n if (typeof File === 'function' && param instanceof File) {\n return true;\n }\n // Safari fix\n if (typeof File === 'object' && param instanceof File) {\n return true;\n }\n\n return false;\n }\n}\n"]}
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * @license
3
+ * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
18
+ //# sourceMappingURL=../../../../../lib/js-api/src/types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG","sourcesContent":["/*!\n * @license\n * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { EventEmitter } from 'eventemitter3';\n\nexport type EventEmitterInstance = InstanceType<typeof EventEmitter>;\nexport type EventEmitterEvents = 'progress' | 'success' | 'error' | 'forbidden' | 'abort' | 'unauthorized' | string;\n"]}
package/esm5/index.js CHANGED
@@ -39,4 +39,5 @@ export * from './src/api-clients/api-client';
39
39
  export * from './src/api-clients/http-client.interface';
40
40
  export * from './src/utils';
41
41
  export * from './src/constants';
42
+ export * from './src/types';
42
43
  //# sourceMappingURL=../../../../lib/js-api/index.js.map
package/esm5/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAElD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AAExC,cAAc,sCAAsC,CAAC;AAErD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yCAAyC,CAAC;AACxD,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC","sourcesContent":["/*!\n * @license\n * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './src/api/content-rest-api/index';\nexport * from './src/api/content-custom-api/index';\nexport * from './src/api/discovery-rest-api/index';\nexport * from './src/api/gs-classification-rest-api/index';\nexport * from './src/api/gs-core-rest-api/index';\nexport * from './src/api/auth-rest-api/index';\nexport * from './src/api/activiti-rest-api/index';\nexport * from './src/api/search-rest-api/index';\nexport * from './src/api/model-rest-api/index';\nexport * from './src/api/hxi-connector-api/index';\n\nexport * from './src/api/content-custom-api/api/content.api';\nexport * from './src/authentication/contentAuth';\nexport * from './src/authentication/processAuth';\nexport * from './src/authentication/oauth2Auth';\nexport * from './src/contentClient';\nexport * from './src/processClient';\nexport * from './src/storage';\nexport * from './src/alfrescoApi';\nexport * from './src/alfrescoApiClient';\nexport * from './src/alfrescoApiConfig';\n\nexport * from './src/to-deprecate/alfresco-api-type';\n\nexport * from './src/api-clients/api-client';\nexport * from './src/api-clients/http-client.interface';\nexport * from './src/utils';\nexport * from './src/constants';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAElD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AAExC,cAAc,sCAAsC,CAAC;AAErD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yCAAyC,CAAC;AACxD,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC","sourcesContent":["/*!\n * @license\n * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './src/api/content-rest-api/index';\nexport * from './src/api/content-custom-api/index';\nexport * from './src/api/discovery-rest-api/index';\nexport * from './src/api/gs-classification-rest-api/index';\nexport * from './src/api/gs-core-rest-api/index';\nexport * from './src/api/auth-rest-api/index';\nexport * from './src/api/activiti-rest-api/index';\nexport * from './src/api/search-rest-api/index';\nexport * from './src/api/model-rest-api/index';\nexport * from './src/api/hxi-connector-api/index';\n\nexport * from './src/api/content-custom-api/api/content.api';\nexport * from './src/authentication/contentAuth';\nexport * from './src/authentication/processAuth';\nexport * from './src/authentication/oauth2Auth';\nexport * from './src/contentClient';\nexport * from './src/processClient';\nexport * from './src/storage';\nexport * from './src/alfrescoApi';\nexport * from './src/alfrescoApiClient';\nexport * from './src/alfrescoApiConfig';\n\nexport * from './src/to-deprecate/alfresco-api-type';\n\nexport * from './src/api-clients/api-client';\nexport * from './src/api-clients/http-client.interface';\nexport * from './src/utils';\nexport * from './src/constants';\nexport * from './src/types';\n"]}
package/esm5/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfresco/js-api",
3
- "version": "9.4.0-17806466306",
3
+ "version": "9.4.0-17827115123",
4
4
  "license": "Apache-2.0",
5
5
  "description": "JavaScript client library for the Alfresco REST API",
6
6
  "author": "Hyland Software, Inc. and its affiliates",
@@ -15,8 +15,8 @@
15
15
  "url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
16
16
  },
17
17
  "dependencies": {
18
- "event-emitter": "^0.3.5",
19
- "superagent": "^9.0.1",
18
+ "axios": "^1.12.2",
19
+ "eventemitter3": "^5.0.1",
20
20
  "tslib": "^2.6.1"
21
21
  },
22
22
  "typings": "./typings/index.d.ts",
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import ee from 'event-emitter';
17
+ import { EventEmitter } from 'eventemitter3';
18
18
  import { ContentAuth } from './authentication/contentAuth';
19
19
  import { ProcessAuth } from './authentication/processAuth';
20
20
  import { Oauth2Auth } from './authentication/oauth2Auth';
@@ -22,12 +22,12 @@ import { ContentClient } from './contentClient';
22
22
  import { ProcessClient } from './processClient';
23
23
  import { Storage } from './storage';
24
24
  import { AlfrescoApiConfig } from './alfrescoApiConfig';
25
- export class AlfrescoApi {
25
+ import { AlfrescoApiClient } from './alfrescoApiClient';
26
+ export class AlfrescoApi extends AlfrescoApiClient {
26
27
  constructor(config, httpClient) {
27
- this.httpClient = httpClient;
28
+ super(undefined, httpClient);
28
29
  this.__type = 'legacy-client';
29
30
  this.bufferEvents = [];
30
- ee(this);
31
31
  if (config) {
32
32
  this.setConfig(config);
33
33
  }
@@ -314,22 +314,22 @@ export class AlfrescoApi {
314
314
  loginBPMECM(username, password) {
315
315
  const contentPromise = this.contentAuth.login(username, password);
316
316
  const processPromise = this.processAuth.login(username, password);
317
+ const eventEmitter = new EventEmitter();
317
318
  const promise = new Promise((resolve, reject) => {
318
319
  Promise.all([contentPromise, processPromise]).then((data) => {
319
- promise.emit('success');
320
+ eventEmitter.emit('success');
320
321
  resolve(data);
321
322
  }, (error) => {
322
323
  this.contentAuth.invalidateSession();
323
324
  this.processAuth.invalidateSession();
324
325
  if (error.status === 401) {
325
- promise.emit('unauthorized');
326
+ eventEmitter.emit('unauthorized');
326
327
  }
327
- promise.emit('error');
328
+ eventEmitter.emit('error');
328
329
  reject(error);
329
330
  });
330
331
  });
331
- ee(promise);
332
- return promise;
332
+ return this.addPromiseListeners(promise, eventEmitter);
333
333
  }
334
334
  logout() {
335
335
  this.username = null;
@@ -352,21 +352,21 @@ export class AlfrescoApi {
352
352
  _logoutBPMECM() {
353
353
  const contentPromise = this.contentAuth.logout();
354
354
  const processPromise = this.processAuth.logout();
355
+ const eventEmitter = new EventEmitter();
355
356
  const promise = new Promise((resolve, reject) => {
356
357
  Promise.all([contentPromise, processPromise]).then(() => {
357
358
  this.config.ticket = undefined;
358
- promise.emit('logout');
359
+ eventEmitter.emit('logout');
359
360
  resolve();
360
361
  }, (error) => {
361
362
  if (error.status === 401) {
362
- promise.emit('unauthorized');
363
+ eventEmitter.emit('unauthorized');
363
364
  }
364
- promise.emit('error');
365
+ eventEmitter.emit('error');
365
366
  reject(error);
366
367
  });
367
368
  });
368
- ee(promise);
369
- return promise;
369
+ return this.addPromiseListeners(promise, eventEmitter);
370
370
  }
371
371
  isLoggedIn() {
372
372
  if (this.isOauthConfiguration()) {