@alfresco/adf-core 8.4.0-17805328622 → 8.4.0-17806466306

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.
@@ -5,7 +5,7 @@ import * as i0 from '@angular/core';
5
5
  import { Injectable } from '@angular/core';
6
6
  import { Subject, lastValueFrom, of, throwError } from 'rxjs';
7
7
  import { map, catchError, takeUntil } from 'rxjs/operators';
8
- import { EventEmitter } from 'eventemitter3';
8
+ import ee from 'event-emitter';
9
9
 
10
10
  /*!
11
11
  * @license
@@ -189,30 +189,13 @@ class AdfHttpClient {
189
189
  }
190
190
  constructor(httpClient) {
191
191
  this.httpClient = httpClient;
192
- this.eventEmitter = new EventEmitter();
193
192
  this.defaultSecurityOptions = {
194
193
  withCredentials: true,
195
194
  isBpmRequest: false,
196
195
  authentications: {},
197
196
  defaultHeaders: {}
198
197
  };
199
- // No need for ee(this) anymore - we use composition instead of inheritance
200
- }
201
- // EventEmitter delegation methods
202
- on(event, fn, context) {
203
- this.eventEmitter.on(event, fn, context);
204
- return this;
205
- }
206
- off(event, fn, context) {
207
- this.eventEmitter.off(event, fn, context);
208
- return this;
209
- }
210
- once(event, fn, context) {
211
- this.eventEmitter.once(event, fn, context);
212
- return this;
213
- }
214
- emit(event, ...args) {
215
- return this.eventEmitter.emit(event, ...args);
198
+ ee(this);
216
199
  }
217
200
  setDefaultSecurityOption(options) {
218
201
  this.defaultSecurityOptions = this.merge(this.defaultSecurityOptions, options);
@@ -270,34 +253,39 @@ class AdfHttpClient {
270
253
  }
271
254
  addPromiseListeners(promise, eventEmitter) {
272
255
  const eventPromise = Object.assign(promise, {
273
- on(event, fn, context) {
274
- eventEmitter.on(event, fn, context);
256
+ on() {
257
+ // eslint-disable-next-line prefer-spread, prefer-rest-params
258
+ eventEmitter.on.apply(eventEmitter, arguments);
275
259
  return this;
276
260
  },
277
- once(event, fn, context) {
278
- eventEmitter.once(event, fn, context);
261
+ once() {
262
+ // eslint-disable-next-line prefer-spread, prefer-rest-params
263
+ eventEmitter.once.apply(eventEmitter, arguments);
279
264
  return this;
280
265
  },
281
- emit(event, ...args) {
282
- return eventEmitter.emit(event, ...args);
266
+ emit() {
267
+ // eslint-disable-next-line prefer-spread, prefer-rest-params
268
+ eventEmitter.emit.apply(eventEmitter, arguments);
269
+ return this;
283
270
  },
284
- off(event, fn, context) {
285
- eventEmitter.off(event, fn, context);
271
+ off() {
272
+ // eslint-disable-next-line prefer-spread, prefer-rest-params
273
+ eventEmitter.off.apply(eventEmitter, arguments);
286
274
  return this;
287
275
  }
288
276
  });
289
277
  return eventPromise;
290
278
  }
291
279
  getEventEmitters() {
292
- const apiClientEmitter = new EventEmitter();
293
- // Bind this instance's methods to the apiClientEmitter for backward compatibility
294
- apiClientEmitter.on = this.on.bind(this);
295
- apiClientEmitter.off = this.off.bind(this);
296
- apiClientEmitter.once = this.once.bind(this);
297
- apiClientEmitter.emit = this.emit.bind(this);
280
+ const apiClientEmitter = {
281
+ on: this.on.bind(this),
282
+ off: this.off.bind(this),
283
+ once: this.once.bind(this),
284
+ emit: this.emit.bind(this)
285
+ };
298
286
  return {
299
287
  apiClientEmitter,
300
- eventEmitter: new EventEmitter()
288
+ eventEmitter: ee({})
301
289
  };
302
290
  }
303
291
  requestWithLegacyEventEmitters(request$, emitters, returnType) {
@@ -1 +1 @@
1
- {"version":3,"file":"alfresco-adf-core-api.mjs","sources":["../../../../lib/core/api/src/lib/types.ts","../../../../lib/core/api/src/lib/alfresco-api/alfresco-api.utils.ts","../../../../lib/core/api/src/lib/alfresco-api/alfresco-api.param-encoder.ts","../../../../lib/core/api/src/lib/alfresco-api/alfresco-api.response-error.ts","../../../../lib/core/api/src/lib/adf-http-client.service.ts","../../../../lib/core/api/src/lib/interfaces.ts","../../../../lib/core/api/src/index.ts","../../../../lib/core/api/src/alfresco-adf-core-api.ts"],"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 interface Dictionary<T> {\n [key: string]: T;\n}\n\nexport type Constructor<T> = new (...args: any[]) => T;\n","/*!\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 {\n HttpEvent,\n HttpUploadProgressEvent,\n HttpEventType,\n HttpResponse,\n HttpParams,\n HttpParameterCodec,\n HttpUrlEncodingCodec\n} from '@angular/common/http';\nimport { Constructor } from '../types';\n\nexport const isHttpUploadProgressEvent = <T>(val: HttpEvent<T>): val is HttpUploadProgressEvent => val.type === HttpEventType.UploadProgress;\nexport const isHttpResponseEvent = <T>(val: HttpEvent<T>): val is HttpResponse<T> => val.type === HttpEventType.Response;\nexport const isDate = (value: unknown): value is Date => value instanceof Date;\nexport const isXML = (value: unknown): boolean => typeof value === 'string' && value.startsWith('<?xml');\nexport const isBlobResponse = (response: HttpResponse<any>, returnType: Constructor<unknown> | 'blob'): response is HttpResponse<Blob> =>\n returnType === 'blob' || response.body instanceof Blob;\nexport const isConstructor = <T = unknown>(value: any): value is Constructor<T> =>\n typeof value === 'function' && !!value?.prototype?.constructor.name;\n\nconst convertParamsToString = (value: any): any => (isDate(value) ? value.toISOString() : value);\nexport const getQueryParamsWithCustomEncoder = (\n obj: Record<string | number, unknown>,\n encoder: HttpParameterCodec = new HttpUrlEncodingCodec()\n): HttpParams | undefined => {\n if (!obj) {\n return undefined;\n }\n\n let httpParams = new HttpParams({\n encoder\n });\n\n const params = removeNilValues(obj);\n\n for (const key in params) {\n if (Object.prototype.hasOwnProperty.call(params, key)) {\n const value = params[key];\n if (value instanceof Array) {\n const array = value.map(convertParamsToString).filter(Boolean);\n httpParams = httpParams.appendAll({\n [key]: array\n });\n } else {\n httpParams = httpParams.append(key, convertParamsToString(value));\n }\n }\n }\n\n return httpParams;\n};\n\n/**\n * Removes null and undefined values from an object.\n *\n * @param obj object to process\n * @returns object with updated values\n */\nexport const removeNilValues = (obj: Record<string | number, unknown>) => {\n if (!obj) {\n return {};\n }\n\n return Object.keys(obj).reduce((acc, key) => {\n const value = obj[key];\n const isNil = value === undefined || value === null;\n return isNil ? acc : { ...acc, [key]: value };\n }, {});\n};\n\nexport const convertObjectToFormData = (formParams: Record<string | number, string | Blob | Array<string | Blob>>): FormData => {\n const formData = new FormData();\n\n for (const key in formParams) {\n if (Object.prototype.hasOwnProperty.call(formParams, key)) {\n const value = formParams[key];\n if (value instanceof File) {\n formData.append(key, value, value.name);\n } else if (Array.isArray(value)) {\n value.forEach((item) => formData.append(key, item));\n } else {\n formData.append(key, value);\n }\n }\n }\n\n return formData;\n};\n","/*!\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 { HttpParameterCodec } from '@angular/common/http';\n\n// The default implementation of HttpParameterCodec from angular\n// does not encode some special characters like + with is causing issues with the alfresco js API and returns 500 error\n\nexport class AlfrescoApiParamEncoder implements HttpParameterCodec {\n encodeKey(key: string): string {\n return encodeURIComponent(key);\n }\n\n encodeValue(value: string): string {\n return encodeURIComponent(value);\n }\n\n decodeKey(key: string): string {\n return decodeURIComponent(key);\n }\n\n decodeValue(value: string): string {\n return decodeURIComponent(value);\n }\n}\n","/*!\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 class AlfrescoApiResponseError extends Error {\n public name = 'AlfrescoApiResponseError';\n\n constructor(msg: string, public status: number, public response: Record<string, any>) {\n super(msg);\n }\n}\n","/*!\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 { SHOULD_ADD_AUTH_TOKEN } from '@alfresco/adf-core/auth';\nimport { Emitters as JsApiEmitters, HttpClient as JsApiHttpClient, EventEmitterInstance, EventEmitterEvents } from '@alfresco/js-api';\nimport { HttpClient, HttpContext, HttpErrorResponse, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { lastValueFrom, Observable, of, Subject, throwError } from 'rxjs';\nimport { catchError, map, takeUntil } from 'rxjs/operators';\nimport {\n convertObjectToFormData,\n getQueryParamsWithCustomEncoder,\n isBlobResponse,\n isConstructor,\n isHttpResponseEvent,\n isHttpUploadProgressEvent,\n removeNilValues\n} from './alfresco-api/alfresco-api.utils';\nimport { AlfrescoApiParamEncoder } from './alfresco-api/alfresco-api.param-encoder';\nimport { AlfrescoApiResponseError } from './alfresco-api/alfresco-api.response-error';\nimport { Constructor } from './types';\nimport { RequestOptions, SecurityOptions } from './interfaces';\nimport { EventEmitter } from 'eventemitter3';\n\nexport interface Emitters {\n readonly eventEmitter: EventEmitterInstance;\n readonly apiClientEmitter: EventEmitterInstance;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AdfHttpClient implements JsApiHttpClient {\n private eventEmitter = new EventEmitter();\n\n _disableCsrf: boolean;\n\n get disableCsrf(): boolean {\n return this._disableCsrf;\n }\n\n set disableCsrf(disableCsrf: boolean) {\n this._disableCsrf = disableCsrf;\n }\n\n private defaultSecurityOptions = {\n withCredentials: true,\n isBpmRequest: false,\n authentications: {},\n defaultHeaders: {}\n };\n\n constructor(private httpClient: HttpClient) {\n // No need for ee(this) anymore - we use composition instead of inheritance\n }\n\n // EventEmitter delegation methods\n on(event: EventEmitterEvents, fn: (...args: any[]) => void, context?: any): this {\n this.eventEmitter.on(event, fn, context);\n return this;\n }\n\n off(event: EventEmitterEvents, fn?: (...args: any[]) => void, context?: any): this {\n this.eventEmitter.off(event, fn, context);\n return this;\n }\n\n once(event: EventEmitterEvents, fn: (...args: any[]) => void, context?: any): this {\n this.eventEmitter.once(event, fn, context);\n return this;\n }\n\n emit(event: EventEmitterEvents, ...args: any[]): boolean {\n return this.eventEmitter.emit(event, ...args);\n }\n\n setDefaultSecurityOption(options: any) {\n this.defaultSecurityOptions = this.merge(this.defaultSecurityOptions, options);\n }\n\n merge(...objects): any {\n const result = {};\n\n objects.forEach((source) => {\n Object.keys(source).forEach((prop) => {\n if (prop in result && Array.isArray(result[prop])) {\n result[prop] = result[prop].concat(source[prop]);\n } else if (prop in result && typeof result[prop] === 'object') {\n result[prop] = this.merge(result[prop], source[prop]);\n } else {\n result[prop] = source[prop];\n }\n });\n });\n\n return result;\n }\n\n request<T = any>(url: string, options?: RequestOptions, sc: SecurityOptions = this.defaultSecurityOptions, emitters?: JsApiEmitters): Promise<T> {\n const body = AdfHttpClient.getBody(options);\n const params = getQueryParamsWithCustomEncoder(options.queryParams, new AlfrescoApiParamEncoder());\n const responseType = AdfHttpClient.getResponseType(options);\n const context = new HttpContext().set(SHOULD_ADD_AUTH_TOKEN, true);\n const security: SecurityOptions = { ...this.defaultSecurityOptions, ...sc };\n const headers = this.getHeaders(options);\n if (!emitters) {\n emitters = this.getEventEmitters();\n }\n\n const request = this.httpClient.request(options.httpMethod, url, {\n context,\n ...(body && { body }),\n ...(responseType && { responseType }),\n ...security,\n ...(params && { params }),\n headers,\n observe: 'events',\n reportProgress: true\n });\n\n return this.requestWithLegacyEventEmitters<T>(request, emitters, options.returnType);\n }\n\n post<T = any>(url: string, options?: RequestOptions, sc?: SecurityOptions, emitters?: JsApiEmitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'POST' }, sc, emitters);\n }\n\n put<T = any>(url: string, options?: RequestOptions, sc?: SecurityOptions, emitters?: JsApiEmitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'PUT' }, sc, emitters);\n }\n\n get<T = any>(url: string, options?: RequestOptions, sc?: SecurityOptions, emitters?: JsApiEmitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'GET' }, sc, emitters);\n }\n\n delete<T = void>(url: string, options?: RequestOptions, sc?: SecurityOptions, emitters?: JsApiEmitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'DELETE' }, sc, emitters);\n }\n\n private addPromiseListeners<T = any>(promise: Promise<T>, eventEmitter: any) {\n const eventPromise = Object.assign(promise, {\n on<K extends string | symbol>(event: K, fn: (...args: any[]) => void, context?: any) {\n eventEmitter.on(event, fn, context);\n return this;\n },\n once<K extends string | symbol>(event: K, fn: (...args: any[]) => void, context?: any) {\n eventEmitter.once(event, fn, context);\n return this;\n },\n emit<K extends string | symbol>(event: K, ...args: any[]): boolean {\n return eventEmitter.emit(event, ...args);\n },\n off<K extends string | symbol>(event: K, fn?: (...args: any[]) => void, context?: any) {\n eventEmitter.off(event, fn, context);\n return this;\n }\n });\n\n return eventPromise;\n }\n\n private getEventEmitters(): Emitters {\n const apiClientEmitter: EventEmitterInstance = new EventEmitter();\n\n // Bind this instance's methods to the apiClientEmitter for backward compatibility\n apiClientEmitter.on = this.on.bind(this);\n apiClientEmitter.off = this.off.bind(this);\n apiClientEmitter.once = this.once.bind(this);\n apiClientEmitter.emit = this.emit.bind(this);\n\n return {\n apiClientEmitter,\n eventEmitter: new EventEmitter()\n };\n }\n\n private requestWithLegacyEventEmitters<T = any>(request$: Observable<HttpEvent<T>>, emitters: JsApiEmitters, returnType: any): Promise<T> {\n const abort$ = new Subject<void>();\n const { eventEmitter, apiClientEmitter } = emitters;\n\n const promise = lastValueFrom(\n request$.pipe(\n map((res) => {\n if (isHttpUploadProgressEvent(res)) {\n const percent = Math.round((res.loaded / res.total) * 100);\n eventEmitter.emit('progress', { loaded: res.loaded, total: res.total, percent });\n }\n\n if (isHttpResponseEvent(res)) {\n eventEmitter.emit('success', res.body);\n return AdfHttpClient.deserialize(res, returnType);\n }\n }),\n catchError((err: HttpErrorResponse): Observable<AlfrescoApiResponseError> => {\n // since we can't always determinate ahead of time if the response is going to be xml or plain text response\n // we need to handle false positive cases here.\n\n if (err.status === 200) {\n eventEmitter.emit('success', err.error.text);\n return of(err.error.text);\n }\n\n eventEmitter.emit('error', err);\n apiClientEmitter.emit('error', { ...err, response: { req: err } });\n\n if (err.status === 401) {\n eventEmitter.emit('unauthorized');\n apiClientEmitter.emit('unauthorized');\n }\n\n // for backwards compatibility we need to convert it to error class as the HttpErrorResponse only implements Error interface, not extending it,\n // and we need to be able to correctly pass instanceof Error conditions used inside repository\n // we also need to pass error as Stringify string as we are detecting statusCodes using JSON.parse(error.message) in some places\n const msg = typeof err.error === 'string' ? err.error : JSON.stringify(err.error);\n\n // for backwards compatibility to handle cases in code where we try read response.error.response.body;\n\n const error = {\n ...err,\n body: err.error\n };\n\n const alfrescoApiError = new AlfrescoApiResponseError(msg, err.status, error);\n return throwError(alfrescoApiError);\n }),\n takeUntil(abort$)\n )\n );\n\n (promise as any).abort = function () {\n eventEmitter.emit('abort');\n abort$.next();\n abort$.complete();\n return this;\n };\n\n return this.addPromiseListeners(promise, eventEmitter);\n }\n\n private static getBody(options: RequestOptions): any {\n const contentType = options.contentType ? options.contentType : AdfHttpClient.jsonPreferredMime(options.contentTypes);\n const isFormData = contentType === 'multipart/form-data';\n const isFormUrlEncoded = contentType === 'application/x-www-form-urlencoded';\n const body = options.bodyParam;\n\n if (isFormData) {\n return convertObjectToFormData(options.formParams);\n }\n\n if (isFormUrlEncoded) {\n return new HttpParams({ fromObject: removeNilValues(options.formParams) });\n }\n\n return body;\n }\n\n private getHeaders(options: RequestOptions): HttpHeaders {\n const contentType = options.contentType || AdfHttpClient.jsonPreferredMime(options.contentTypes);\n const accept = options.accept || AdfHttpClient.jsonPreferredMime(options.accepts);\n\n const optionsHeaders = {\n ...options.headerParams,\n ...(accept && { Accept: accept }),\n ...(contentType && { 'Content-Type': contentType })\n };\n\n if (!this.disableCsrf) {\n this.setCsrfToken(optionsHeaders);\n }\n\n return new HttpHeaders(optionsHeaders);\n }\n\n /**\n * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.\n *\n * @param contentTypes a contentType array\n * @returns The chosen content type, preferring JSON.\n */\n private static jsonPreferredMime(contentTypes: readonly string[]): string {\n if (!contentTypes?.length) {\n return 'application/json';\n }\n\n for (let i = 0; i < contentTypes.length; i++) {\n if (AdfHttpClient.isJsonMime(contentTypes[i])) {\n return contentTypes[i];\n }\n }\n return contentTypes[0];\n }\n\n /**\n * Checks whether the given content type represents JSON.<br>\n * JSON content type examples:<br>\n * <ul>\n * <li>application/json</li>\n * <li>application/json; charset=UTF8</li>\n * <li>APPLICATION/JSON</li>\n * </ul>\n *\n * @param contentType The MIME content type to check.\n * @returns <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.\n */\n private static isJsonMime(contentType: string): boolean {\n return Boolean(contentType?.match(/^application\\/json(;.*)?$/i));\n }\n\n private setCsrfToken(optionsHeaders: any) {\n const token = this.createCSRFToken();\n optionsHeaders['X-CSRF-TOKEN'] = token;\n\n try {\n document.cookie = 'CSRF-TOKEN=' + token + ';path=/';\n } catch {\n /* continue regardless of error */\n }\n }\n\n private createCSRFToken(a?: any): string {\n const randomValue = AdfHttpClient.getSecureRandomValue();\n return a ? (a ^ ((randomValue * 16) >> (a / 4))).toString(16) : ([1e16] + (1e16).toString()).replace(/[01]/g, this.createCSRFToken);\n }\n\n private static getSecureRandomValue(): number {\n const max = Math.pow(2, 32);\n return window.crypto.getRandomValues(new Uint32Array(1))[0] / max;\n }\n\n private static getResponseType(options: RequestOptions): 'blob' | 'json' | 'text' {\n const isBlobType = options.returnType?.toString().toLowerCase() === 'blob' || options.responseType?.toString().toLowerCase() === 'blob';\n\n if (isBlobType) {\n return 'blob';\n }\n\n if (options.returnType === 'String') {\n return 'text';\n }\n\n return 'json';\n }\n\n /**\n * Deserialize an HTTP response body into a value of the specified type.\n *\n * @param response response object\n * @param returnType return type\n * @returns deserialized object\n */\n private static deserialize<T>(response: HttpResponse<T>, returnType?: Constructor<unknown> | 'blob'): any {\n if (response === null) {\n return null;\n }\n\n const body = response.body;\n\n if (!returnType) {\n // for backwards compatibility we need to return empty string instead of null,\n // to avoid issues when accessing null response would break application [C309878]\n // cannot read property 'entry' of null in cases like\n // return this.post(apiUrl, saveFormRepresentation).pipe(map((res: any) => res.entry))\n\n return body !== null ? body : '';\n }\n\n if (isBlobResponse(response, returnType)) {\n return AdfHttpClient.deserializeBlobResponse(response);\n }\n\n if (!isConstructor(returnType)) {\n return body;\n }\n\n if (Array.isArray(body)) {\n return body.map((element) => new returnType(element));\n }\n\n return new returnType(body);\n }\n\n private static deserializeBlobResponse(response: HttpResponse<Blob>) {\n return new Blob([response.body], { type: response.headers.get('Content-Type') });\n }\n}\n","/*!\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 interface SecurityOptions {\n readonly withCredentials?: boolean;\n readonly authentications?: Authentication;\n readonly defaultHeaders?: Record<string, string>;\n}\n\nexport interface Oauth2 {\n refreshToken?: string;\n accessToken?: string;\n}\n\nexport interface BasicAuth {\n username?: string;\n password?: string;\n ticket?: string;\n}\n\nexport interface Authentication {\n basicAuth?: BasicAuth;\n oauth2?: Oauth2;\n cookie?: string;\n type?: string;\n}\n\nexport interface RequestOptions {\n httpMethod?: string;\n pathParams?: any;\n queryParams?: any;\n headerParams?: any;\n formParams?: any;\n bodyParam?: any;\n returnType?: any;\n responseType?: string;\n accepts?: string[];\n contentTypes?: string[];\n readonly accept?: string;\n readonly contentType?: string;\n}\n","/*!\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 './lib/types';\nexport * from './lib/adf-http-client.service';\nexport * from './lib/interfaces';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;;ACfH;;;;;;;;;;;;;;;AAeG;AAaI,MAAM,yBAAyB,GAAG,CAAI,GAAiB,KAAqC,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,cAAc;AACrI,MAAM,mBAAmB,GAAG,CAAI,GAAiB,KAA6B,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,QAAQ;AACjH,MAAM,MAAM,GAAG,CAAC,KAAc,KAAoB,KAAK,YAAY,IAAI;AACvE,MAAM,KAAK,GAAG,CAAC,KAAc,KAAc,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;AACjG,MAAM,cAAc,GAAG,CAAC,QAA2B,EAAE,UAAyC,KACjG,UAAU,KAAK,MAAM,IAAI,QAAQ,CAAC,IAAI,YAAY,IAAI;AACnD,MAAM,aAAa,GAAG,CAAc,KAAU,KACjD,OAAO,KAAK,KAAK,UAAU,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,IAAI;AAEvE,MAAM,qBAAqB,GAAG,CAAC,KAAU,MAAW,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC;AACzF,MAAM,+BAA+B,GAAG,CAC3C,GAAqC,EACrC,OAAA,GAA8B,IAAI,oBAAoB,EAAE,KAChC;IACxB,IAAI,CAAC,GAAG,EAAE;AACN,QAAA,OAAO,SAAS;IACpB;AAEA,IAAA,IAAI,UAAU,GAAG,IAAI,UAAU,CAAC;QAC5B;AACH,KAAA,CAAC;AAEF,IAAA,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC;AAEnC,IAAA,KAAK,MAAM,GAAG,IAAI,MAAM,EAA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C;IAC/B;IAEQ,OAAO,uBAAuB,CAAC,QAA4B,EAAA;QAC/D,OAAO,IAAI,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;IACpF;8GA/VS,aAAa,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAb,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cAFV,MAAM,EAAA,CAAA,CAAA;;2FAET,aAAa,EAAA,UAAA,EAAA,CAAA;kBAHzB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE;AACf,iBAAA;;;AC7CD;;;;;;;;;;;;;;;AAeG;;ACfH;;;;;;;;;;;;;;;AAeG;;ACfH;;AAEG;;;;"}
1
+ {"version":3,"file":"alfresco-adf-core-api.mjs","sources":["../../../../lib/core/api/src/lib/types.ts","../../../../lib/core/api/src/lib/alfresco-api/alfresco-api.utils.ts","../../../../lib/core/api/src/lib/alfresco-api/alfresco-api.param-encoder.ts","../../../../lib/core/api/src/lib/alfresco-api/alfresco-api.response-error.ts","../../../../lib/core/api/src/lib/adf-http-client.service.ts","../../../../lib/core/api/src/lib/interfaces.ts","../../../../lib/core/api/src/index.ts","../../../../lib/core/api/src/alfresco-adf-core-api.ts"],"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 interface Dictionary<T> {\n [key: string]: T;\n}\n\nexport type Constructor<T> = new (...args: any[]) => T;\n","/*!\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 {\n HttpEvent,\n HttpUploadProgressEvent,\n HttpEventType,\n HttpResponse,\n HttpParams,\n HttpParameterCodec,\n HttpUrlEncodingCodec\n} from '@angular/common/http';\nimport { Constructor } from '../types';\n\nexport const isHttpUploadProgressEvent = <T>(val: HttpEvent<T>): val is HttpUploadProgressEvent => val.type === HttpEventType.UploadProgress;\nexport const isHttpResponseEvent = <T>(val: HttpEvent<T>): val is HttpResponse<T> => val.type === HttpEventType.Response;\nexport const isDate = (value: unknown): value is Date => value instanceof Date;\nexport const isXML = (value: unknown): boolean => typeof value === 'string' && value.startsWith('<?xml');\nexport const isBlobResponse = (response: HttpResponse<any>, returnType: Constructor<unknown> | 'blob'): response is HttpResponse<Blob> =>\n returnType === 'blob' || response.body instanceof Blob;\nexport const isConstructor = <T = unknown>(value: any): value is Constructor<T> =>\n typeof value === 'function' && !!value?.prototype?.constructor.name;\n\nconst convertParamsToString = (value: any): any => (isDate(value) ? value.toISOString() : value);\nexport const getQueryParamsWithCustomEncoder = (\n obj: Record<string | number, unknown>,\n encoder: HttpParameterCodec = new HttpUrlEncodingCodec()\n): HttpParams | undefined => {\n if (!obj) {\n return undefined;\n }\n\n let httpParams = new HttpParams({\n encoder\n });\n\n const params = removeNilValues(obj);\n\n for (const key in params) {\n if (Object.prototype.hasOwnProperty.call(params, key)) {\n const value = params[key];\n if (value instanceof Array) {\n const array = value.map(convertParamsToString).filter(Boolean);\n httpParams = httpParams.appendAll({\n [key]: array\n });\n } else {\n httpParams = httpParams.append(key, convertParamsToString(value));\n }\n }\n }\n\n return httpParams;\n};\n\n/**\n * Removes null and undefined values from an object.\n *\n * @param obj object to process\n * @returns object with updated values\n */\nexport const removeNilValues = (obj: Record<string | number, unknown>) => {\n if (!obj) {\n return {};\n }\n\n return Object.keys(obj).reduce((acc, key) => {\n const value = obj[key];\n const isNil = value === undefined || value === null;\n return isNil ? acc : { ...acc, [key]: value };\n }, {});\n};\n\nexport const convertObjectToFormData = (formParams: Record<string | number, string | Blob | Array<string | Blob>>): FormData => {\n const formData = new FormData();\n\n for (const key in formParams) {\n if (Object.prototype.hasOwnProperty.call(formParams, key)) {\n const value = formParams[key];\n if (value instanceof File) {\n formData.append(key, value, value.name);\n } else if (Array.isArray(value)) {\n value.forEach((item) => formData.append(key, item));\n } else {\n formData.append(key, value);\n }\n }\n }\n\n return formData;\n};\n","/*!\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 { HttpParameterCodec } from '@angular/common/http';\n\n// The default implementation of HttpParameterCodec from angular\n// does not encode some special characters like + with is causing issues with the alfresco js API and returns 500 error\n\nexport class AlfrescoApiParamEncoder implements HttpParameterCodec {\n encodeKey(key: string): string {\n return encodeURIComponent(key);\n }\n\n encodeValue(value: string): string {\n return encodeURIComponent(value);\n }\n\n decodeKey(key: string): string {\n return decodeURIComponent(key);\n }\n\n decodeValue(value: string): string {\n return decodeURIComponent(value);\n }\n}\n","/*!\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 class AlfrescoApiResponseError extends Error {\n public name = 'AlfrescoApiResponseError';\n\n constructor(msg: string, public status: number, public response: Record<string, any>) {\n super(msg);\n }\n}\n","/*!\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 { SHOULD_ADD_AUTH_TOKEN } from '@alfresco/adf-core/auth';\nimport { Emitters as JsApiEmitters, HttpClient as JsApiHttpClient } from '@alfresco/js-api';\nimport { HttpClient, HttpContext, HttpErrorResponse, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { lastValueFrom, Observable, of, Subject, throwError } from 'rxjs';\nimport { catchError, map, takeUntil } from 'rxjs/operators';\nimport {\n convertObjectToFormData,\n getQueryParamsWithCustomEncoder,\n isBlobResponse,\n isConstructor,\n isHttpResponseEvent,\n isHttpUploadProgressEvent,\n removeNilValues\n} from './alfresco-api/alfresco-api.utils';\nimport { AlfrescoApiParamEncoder } from './alfresco-api/alfresco-api.param-encoder';\nimport { AlfrescoApiResponseError } from './alfresco-api/alfresco-api.response-error';\nimport { Constructor } from './types';\nimport { RequestOptions, SecurityOptions } from './interfaces';\nimport ee, { Emitter } from 'event-emitter';\n\nexport interface Emitters {\n readonly eventEmitter: Emitter;\n readonly apiClientEmitter: Emitter;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AdfHttpClient implements ee.Emitter, JsApiHttpClient {\n on: ee.EmitterMethod;\n off: ee.EmitterMethod;\n once: ee.EmitterMethod;\n _disableCsrf: boolean;\n\n emit: (type: string, ...args: any[]) => void;\n\n get disableCsrf(): boolean {\n return this._disableCsrf;\n }\n\n set disableCsrf(disableCsrf: boolean) {\n this._disableCsrf = disableCsrf;\n }\n\n private defaultSecurityOptions = {\n withCredentials: true,\n isBpmRequest: false,\n authentications: {},\n defaultHeaders: {}\n };\n\n constructor(private httpClient: HttpClient) {\n ee(this);\n }\n\n setDefaultSecurityOption(options: any) {\n this.defaultSecurityOptions = this.merge(this.defaultSecurityOptions, options);\n }\n\n merge(...objects): any {\n const result = {};\n\n objects.forEach((source) => {\n Object.keys(source).forEach((prop) => {\n if (prop in result && Array.isArray(result[prop])) {\n result[prop] = result[prop].concat(source[prop]);\n } else if (prop in result && typeof result[prop] === 'object') {\n result[prop] = this.merge(result[prop], source[prop]);\n } else {\n result[prop] = source[prop];\n }\n });\n });\n\n return result;\n }\n\n request<T = any>(url: string, options?: RequestOptions, sc: SecurityOptions = this.defaultSecurityOptions, emitters?: JsApiEmitters): Promise<T> {\n const body = AdfHttpClient.getBody(options);\n const params = getQueryParamsWithCustomEncoder(options.queryParams, new AlfrescoApiParamEncoder());\n const responseType = AdfHttpClient.getResponseType(options);\n const context = new HttpContext().set(SHOULD_ADD_AUTH_TOKEN, true);\n const security: SecurityOptions = { ...this.defaultSecurityOptions, ...sc };\n const headers = this.getHeaders(options);\n if (!emitters) {\n emitters = this.getEventEmitters();\n }\n\n const request = this.httpClient.request(options.httpMethod, url, {\n context,\n ...(body && { body }),\n ...(responseType && { responseType }),\n ...security,\n ...(params && { params }),\n headers,\n observe: 'events',\n reportProgress: true\n });\n\n return this.requestWithLegacyEventEmitters<T>(request, emitters, options.returnType);\n }\n\n post<T = any>(url: string, options?: RequestOptions, sc?: SecurityOptions, emitters?: JsApiEmitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'POST' }, sc, emitters);\n }\n\n put<T = any>(url: string, options?: RequestOptions, sc?: SecurityOptions, emitters?: JsApiEmitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'PUT' }, sc, emitters);\n }\n\n get<T = any>(url: string, options?: RequestOptions, sc?: SecurityOptions, emitters?: JsApiEmitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'GET' }, sc, emitters);\n }\n\n delete<T = void>(url: string, options?: RequestOptions, sc?: SecurityOptions, emitters?: JsApiEmitters): Promise<T> {\n return this.request<T>(url, { ...options, httpMethod: 'DELETE' }, sc, emitters);\n }\n\n private addPromiseListeners<T = any>(promise: Promise<T>, eventEmitter: any) {\n const eventPromise = Object.assign(promise, {\n on() {\n // eslint-disable-next-line prefer-spread, prefer-rest-params\n eventEmitter.on.apply(eventEmitter, arguments);\n return this;\n },\n once() {\n // eslint-disable-next-line prefer-spread, prefer-rest-params\n eventEmitter.once.apply(eventEmitter, arguments);\n return this;\n },\n emit() {\n // eslint-disable-next-line prefer-spread, prefer-rest-params\n eventEmitter.emit.apply(eventEmitter, arguments);\n return this;\n },\n off() {\n // eslint-disable-next-line prefer-spread, prefer-rest-params\n eventEmitter.off.apply(eventEmitter, arguments);\n return this;\n }\n });\n\n return eventPromise;\n }\n\n private getEventEmitters(): Emitters {\n const apiClientEmitter = {\n on: this.on.bind(this),\n off: this.off.bind(this),\n once: this.once.bind(this),\n emit: this.emit.bind(this)\n };\n\n return {\n apiClientEmitter,\n eventEmitter: ee({})\n };\n }\n\n private requestWithLegacyEventEmitters<T = any>(request$: Observable<HttpEvent<T>>, emitters: JsApiEmitters, returnType: any): Promise<T> {\n const abort$ = new Subject<void>();\n const { eventEmitter, apiClientEmitter } = emitters;\n\n const promise = lastValueFrom(\n request$.pipe(\n map((res) => {\n if (isHttpUploadProgressEvent(res)) {\n const percent = Math.round((res.loaded / res.total) * 100);\n eventEmitter.emit('progress', { loaded: res.loaded, total: res.total, percent });\n }\n\n if (isHttpResponseEvent(res)) {\n eventEmitter.emit('success', res.body);\n return AdfHttpClient.deserialize(res, returnType);\n }\n }),\n catchError((err: HttpErrorResponse): Observable<AlfrescoApiResponseError> => {\n // since we can't always determinate ahead of time if the response is going to be xml or plain text response\n // we need to handle false positive cases here.\n\n if (err.status === 200) {\n eventEmitter.emit('success', err.error.text);\n return of(err.error.text);\n }\n\n eventEmitter.emit('error', err);\n apiClientEmitter.emit('error', { ...err, response: { req: err } });\n\n if (err.status === 401) {\n eventEmitter.emit('unauthorized');\n apiClientEmitter.emit('unauthorized');\n }\n\n // for backwards compatibility we need to convert it to error class as the HttpErrorResponse only implements Error interface, not extending it,\n // and we need to be able to correctly pass instanceof Error conditions used inside repository\n // we also need to pass error as Stringify string as we are detecting statusCodes using JSON.parse(error.message) in some places\n const msg = typeof err.error === 'string' ? err.error : JSON.stringify(err.error);\n\n // for backwards compatibility to handle cases in code where we try read response.error.response.body;\n\n const error = {\n ...err,\n body: err.error\n };\n\n const alfrescoApiError = new AlfrescoApiResponseError(msg, err.status, error);\n return throwError(alfrescoApiError);\n }),\n takeUntil(abort$)\n )\n );\n\n (promise as any).abort = function () {\n eventEmitter.emit('abort');\n abort$.next();\n abort$.complete();\n return this;\n };\n\n return this.addPromiseListeners(promise, eventEmitter);\n }\n\n private static getBody(options: RequestOptions): any {\n const contentType = options.contentType ? options.contentType : AdfHttpClient.jsonPreferredMime(options.contentTypes);\n const isFormData = contentType === 'multipart/form-data';\n const isFormUrlEncoded = contentType === 'application/x-www-form-urlencoded';\n const body = options.bodyParam;\n\n if (isFormData) {\n return convertObjectToFormData(options.formParams);\n }\n\n if (isFormUrlEncoded) {\n return new HttpParams({ fromObject: removeNilValues(options.formParams) });\n }\n\n return body;\n }\n\n private getHeaders(options: RequestOptions): HttpHeaders {\n const contentType = options.contentType || AdfHttpClient.jsonPreferredMime(options.contentTypes);\n const accept = options.accept || AdfHttpClient.jsonPreferredMime(options.accepts);\n\n const optionsHeaders = {\n ...options.headerParams,\n ...(accept && { Accept: accept }),\n ...(contentType && { 'Content-Type': contentType })\n };\n\n if (!this.disableCsrf) {\n this.setCsrfToken(optionsHeaders);\n }\n\n return new HttpHeaders(optionsHeaders);\n }\n\n /**\n * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.\n *\n * @param contentTypes a contentType array\n * @returns The chosen content type, preferring JSON.\n */\n private static jsonPreferredMime(contentTypes: readonly string[]): string {\n if (!contentTypes?.length) {\n return 'application/json';\n }\n\n for (let i = 0; i < contentTypes.length; i++) {\n if (AdfHttpClient.isJsonMime(contentTypes[i])) {\n return contentTypes[i];\n }\n }\n return contentTypes[0];\n }\n\n /**\n * Checks whether the given content type represents JSON.<br>\n * JSON content type examples:<br>\n * <ul>\n * <li>application/json</li>\n * <li>application/json; charset=UTF8</li>\n * <li>APPLICATION/JSON</li>\n * </ul>\n *\n * @param contentType The MIME content type to check.\n * @returns <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.\n */\n private static isJsonMime(contentType: string): boolean {\n return Boolean(contentType?.match(/^application\\/json(;.*)?$/i));\n }\n\n private setCsrfToken(optionsHeaders: any) {\n const token = this.createCSRFToken();\n optionsHeaders['X-CSRF-TOKEN'] = token;\n\n try {\n document.cookie = 'CSRF-TOKEN=' + token + ';path=/';\n } catch {\n /* continue regardless of error */\n }\n }\n\n private createCSRFToken(a?: any): string {\n const randomValue = AdfHttpClient.getSecureRandomValue();\n return a ? (a ^ ((randomValue * 16) >> (a / 4))).toString(16) : ([1e16] + (1e16).toString()).replace(/[01]/g, this.createCSRFToken);\n }\n\n private static getSecureRandomValue(): number {\n const max = Math.pow(2, 32);\n return window.crypto.getRandomValues(new Uint32Array(1))[0] / max;\n }\n\n private static getResponseType(options: RequestOptions): 'blob' | 'json' | 'text' {\n const isBlobType = options.returnType?.toString().toLowerCase() === 'blob' || options.responseType?.toString().toLowerCase() === 'blob';\n\n if (isBlobType) {\n return 'blob';\n }\n\n if (options.returnType === 'String') {\n return 'text';\n }\n\n return 'json';\n }\n\n /**\n * Deserialize an HTTP response body into a value of the specified type.\n *\n * @param response response object\n * @param returnType return type\n * @returns deserialized object\n */\n private static deserialize<T>(response: HttpResponse<T>, returnType?: Constructor<unknown> | 'blob'): any {\n if (response === null) {\n return null;\n }\n\n const body = response.body;\n\n if (!returnType) {\n // for backwards compatibility we need to return empty string instead of null,\n // to avoid issues when accessing null response would break application [C309878]\n // cannot read property 'entry' of null in cases like\n // return this.post(apiUrl, saveFormRepresentation).pipe(map((res: any) => res.entry))\n\n return body !== null ? body : '';\n }\n\n if (isBlobResponse(response, returnType)) {\n return AdfHttpClient.deserializeBlobResponse(response);\n }\n\n if (!isConstructor(returnType)) {\n return body;\n }\n\n if (Array.isArray(body)) {\n return body.map((element) => new returnType(element));\n }\n\n return new returnType(body);\n }\n\n private static deserializeBlobResponse(response: HttpResponse<Blob>) {\n return new Blob([response.body], { type: response.headers.get('Content-Type') });\n }\n}\n","/*!\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 interface SecurityOptions {\n readonly withCredentials?: boolean;\n readonly authentications?: Authentication;\n readonly defaultHeaders?: Record<string, string>;\n}\n\nexport interface Oauth2 {\n refreshToken?: string;\n accessToken?: string;\n}\n\nexport interface BasicAuth {\n username?: string;\n password?: string;\n ticket?: string;\n}\n\nexport interface Authentication {\n basicAuth?: BasicAuth;\n oauth2?: Oauth2;\n cookie?: string;\n type?: string;\n}\n\nexport interface RequestOptions {\n httpMethod?: string;\n pathParams?: any;\n queryParams?: any;\n headerParams?: any;\n formParams?: any;\n bodyParam?: any;\n returnType?: any;\n responseType?: string;\n accepts?: string[];\n contentTypes?: string[];\n readonly accept?: string;\n readonly contentType?: string;\n}\n","/*!\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 './lib/types';\nexport * from './lib/adf-http-client.service';\nexport * from './lib/interfaces';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;;ACfH;;;;;;;;;;;;;;;AAeG;AAaI,MAAM,yBAAyB,GAAG,CAAI,GAAiB,KAAqC,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,cAAc;AACrI,MAAM,mBAAmB,GAAG,CAAI,GAAiB,KAA6B,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,QAAQ;AACjH,MAAM,MAAM,GAAG,CAAC,KAAc,KAAoB,KAAK,YAAY,IAAI;AACvE,MAAM,KAAK,GAAG,CAA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AAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;IACpF;8GAlVS,aAAa,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAb,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cAFV,MAAM,EAAA,CAAA,CAAA;;2FAET,aAAa,EAAA,UAAA,EAAA,CAAA;kBAHzB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE;AACf,iBAAA;;;AC7CD;;;;;;;;;;;;;;;AAeG;;ACfH;;;;;;;;;;;;;;;AAeG;;ACfH;;AAEG;;;;"}
@@ -15,17 +15,16 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { HttpHeaders } from '@angular/common/http';
18
- import { EventEmitter } from 'eventemitter3';
18
+ import ee from 'event-emitter';
19
19
  import { Observable } from 'rxjs';
20
- type EventEmitterInstance = InstanceType<typeof EventEmitter>;
21
20
  export interface AuthenticationServiceInterface {
22
21
  onError: any;
23
22
  onLogin: any;
24
23
  onLogout: any;
25
- on: EventEmitterInstance['on'];
26
- off: EventEmitterInstance['off'];
27
- once: EventEmitterInstance['once'];
28
- emit: EventEmitterInstance['emit'];
24
+ on: ee.EmitterMethod;
25
+ off: ee.EmitterMethod;
26
+ once: ee.EmitterMethod;
27
+ emit: (type: string, ...args: any[]) => void;
29
28
  getToken(): string;
30
29
  isLoggedIn(): boolean;
31
30
  isOauth(): boolean;
@@ -38,4 +37,3 @@ export interface AuthenticationServiceInterface {
38
37
  addTokenToHeader(requestUrl: string, headersArg?: HttpHeaders): Observable<HttpHeaders>;
39
38
  reset(): void;
40
39
  }
41
- export {};
@@ -18,21 +18,20 @@ import { Injector } from '@angular/core';
18
18
  import { Observable, Subject } from 'rxjs';
19
19
  import { HttpHeaders } from '@angular/common/http';
20
20
  import { AuthenticationServiceInterface } from '../interfaces/authentication-service.interface';
21
+ import ee from 'event-emitter';
21
22
  import { RedirectAuthService } from '../oidc/redirect-auth.service';
22
- import { EventEmitter } from 'eventemitter3';
23
23
  import * as i0 from "@angular/core";
24
- type EventEmitterInstance = InstanceType<typeof EventEmitter>;
25
- export declare class AuthenticationService implements AuthenticationServiceInterface {
24
+ export declare class AuthenticationService implements AuthenticationServiceInterface, ee.Emitter {
26
25
  private readonly injector;
27
26
  private readonly redirectAuthService;
28
27
  onLogin: Subject<any>;
29
28
  onLogout: Subject<any>;
30
29
  onTokenReceived: Subject<any>;
31
30
  constructor(injector: Injector, redirectAuthService: RedirectAuthService);
32
- get on(): EventEmitterInstance['on'];
33
- get off(): EventEmitterInstance['off'];
34
- get once(): EventEmitterInstance['once'];
35
- get emit(): EventEmitterInstance['emit'];
31
+ get on(): ee.EmitterMethod;
32
+ get off(): ee.EmitterMethod;
33
+ get once(): ee.EmitterMethod;
34
+ get emit(): (type: string, ...args: any[]) => void;
36
35
  get onError(): Observable<any>;
37
36
  addTokenToHeader(requestUrl: string, headersArg?: HttpHeaders): Observable<HttpHeaders>;
38
37
  isECMProvider(): boolean;
@@ -60,4 +59,3 @@ export declare class AuthenticationService implements AuthenticationServiceInter
60
59
  static ɵfac: i0.ɵɵFactoryDeclaration<AuthenticationService, never>;
61
60
  static ɵprov: i0.ɵɵInjectableDeclaration<AuthenticationService>;
62
61
  }
63
- export {};
@@ -20,14 +20,14 @@ import { Observable, ReplaySubject } from 'rxjs';
20
20
  import { AppConfigService } from '../../app-config/app-config.service';
21
21
  import { CookieService } from '../../common/services/cookie.service';
22
22
  import { AuthenticationServiceInterface } from '../interfaces/authentication-service.interface';
23
- import { EventEmitterInstance } from '@alfresco/js-api';
24
- export declare abstract class BaseAuthenticationService implements AuthenticationServiceInterface {
23
+ import ee from 'event-emitter';
24
+ export declare abstract class BaseAuthenticationService implements AuthenticationServiceInterface, ee.Emitter {
25
25
  protected appConfig: AppConfigService;
26
26
  protected cookie: CookieService;
27
- on: EventEmitterInstance['on'];
28
- off: EventEmitterInstance['off'];
29
- once: EventEmitterInstance['once'];
30
- emit: EventEmitterInstance['emit'];
27
+ on: ee.EmitterMethod;
28
+ off: ee.EmitterMethod;
29
+ once: ee.EmitterMethod;
30
+ emit: (type: string, ...args: any[]) => void;
31
31
  protected redirectUrl: RedirectionModel;
32
32
  onError: ReplaySubject<any>;
33
33
  onLogin: ReplaySubject<any>;
@@ -96,7 +96,7 @@ export declare abstract class FormBaseComponent {
96
96
  handleError(err: any): any;
97
97
  abstract onRefreshClicked(): void;
98
98
  abstract saveTaskForm(): void;
99
- abstract completeTaskForm(outcome?: string, outcomeId?: string): void;
99
+ abstract completeTaskForm(outcome?: string): void;
100
100
  protected abstract onTaskSaved(form: FormModel): void;
101
101
  protected abstract storeFormAsMetadata(): void;
102
102
  protected abstract onExecuteOutcome(outcome: FormOutcomeModel): boolean;
@@ -1,19 +1,3 @@
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
1
  import { OnInit } from '@angular/core';
18
2
  import { FormService } from '../../../services/form.service';
19
3
  import { WidgetComponent } from '../widget.component';
@@ -64,6 +64,7 @@ export declare class FormModel implements ProcessFormModel {
64
64
  readonly confirmMessage: ConfirmMessage;
65
65
  readonly taskName: string;
66
66
  readonly processDefinitionId: string;
67
+ readonly selectedOutcome: string;
67
68
  readonly enableFixedSpace: boolean;
68
69
  readonly displayMode: any;
69
70
  fieldsCache: FormFieldModel[];
@@ -76,8 +77,6 @@ export declare class FormModel implements ProcessFormModel {
76
77
  fieldValidators: FormFieldValidator[];
77
78
  customFieldTemplates: FormFieldTemplates;
78
79
  theme?: ThemeModel;
79
- selectedOutcomeId?: string;
80
- selectedOutcome: string;
81
80
  className: string;
82
81
  readOnly: boolean;
83
82
  isValid: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alfresco/adf-core",
3
3
  "description": "Alfresco ADF core",
4
- "version": "8.4.0-17805328622",
4
+ "version": "8.4.0-17806466306",
5
5
  "author": "Hyland Software, Inc. and its affiliates",
6
6
  "repository": {
7
7
  "type": "git",
@@ -26,14 +26,14 @@
26
26
  "types": "./index.d.ts",
27
27
  "default": "./fesm2022/adf-core.mjs"
28
28
  },
29
- "./auth": {
30
- "types": "./auth/index.d.ts",
31
- "default": "./fesm2022/alfresco-adf-core-auth.mjs"
32
- },
33
29
  "./api": {
34
30
  "types": "./api/index.d.ts",
35
31
  "default": "./fesm2022/alfresco-adf-core-api.mjs"
36
32
  },
33
+ "./auth": {
34
+ "types": "./auth/index.d.ts",
35
+ "default": "./fesm2022/alfresco-adf-core-auth.mjs"
36
+ },
37
37
  "./feature-flags": {
38
38
  "types": "./feature-flags/index.d.ts",
39
39
  "default": "./fesm2022/alfresco-adf-core-feature-flags.mjs"
@@ -63,10 +63,11 @@
63
63
  "@angular/router": ">=16.0.0",
64
64
  "@mat-datetimepicker/core": ">=12.0.1",
65
65
  "@ngx-translate/core": ">=16.0.0",
66
- "@alfresco/js-api": ">=9.4.0-17805328622",
67
- "@alfresco/adf-extensions": ">=8.4.0-17805328622",
66
+ "@alfresco/js-api": ">=9.4.0-17806466306",
67
+ "@alfresco/adf-extensions": ">=8.4.0-17806466306",
68
68
  "minimatch": ">=10.0.0",
69
- "pdfjs-dist": ">=3.3.122"
69
+ "pdfjs-dist": ">=3.3.122",
70
+ "ts-morph": ">=20.0.0"
70
71
  },
71
72
  "keywords": [
72
73
  "core",
@@ -15,9 +15,10 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { Rule, Tree } from '@angular-devkit/schematics';
18
+ import { Project } from 'ts-morph';
18
19
  /**
19
20
  * @returns Schematic rule for updating imports
20
21
  */
21
22
  export declare function updateAlfrescoApiImports(): Rule;
22
- export declare const visitor: (filePath: string, tree: Pick<Tree, "read" | "overwrite">) => void;
23
+ export declare const visitor: (filePath: string, tree: Pick<Tree, "read" | "overwrite">, project: Project) => void;
23
24
  export default updateAlfrescoApiImports;
@@ -18,8 +18,8 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.visitor = void 0;
20
20
  exports.updateAlfrescoApiImports = updateAlfrescoApiImports;
21
- const ts = require("typescript");
22
21
  const schematics_1 = require("@angular-devkit/schematics");
22
+ const ts_morph_1 = require("ts-morph");
23
23
  const alfrescoApiServiceMigration = {
24
24
  change: {
25
25
  importedValue: 'AlfrescoApiService',
@@ -55,12 +55,14 @@ const migrations = [alfrescoApiServiceMigration, alfrescoApiMockMigration, alfre
55
55
  * @returns Schematic rule for updating imports
56
56
  */
57
57
  function updateAlfrescoApiImports() {
58
- return (tree) => {
59
- tree.visit((filePath) => (0, exports.visitor)(filePath, tree));
58
+ const project = new ts_morph_1.Project();
59
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
60
+ return (tree, _context) => {
61
+ tree.visit((filePath) => (0, exports.visitor)(filePath, tree, project));
60
62
  return tree;
61
63
  };
62
64
  }
63
- const visitor = (filePath, tree) => {
65
+ const visitor = (filePath, tree, project) => {
64
66
  if (!filePath.includes('/.git/') &&
65
67
  !filePath.includes('/node_modules/') &&
66
68
  !filePath.includes('/.angular/') &&
@@ -70,10 +72,8 @@ const visitor = (filePath, tree) => {
70
72
  if (!bufferFileContent) {
71
73
  throw new schematics_1.SchematicsException(`Could not read file: ${filePath}`);
72
74
  }
73
- const fileContent = bufferFileContent.toString();
74
- const sourceFile = ts.createSourceFile(filePath, fileContent, ts.ScriptTarget.Latest, true);
75
75
  migrations.forEach((migrationData) => {
76
- const fileWithUpdatedImport = moveImport(bufferFileContent, sourceFile, migrationData);
76
+ const fileWithUpdatedImport = moveImport(filePath, bufferFileContent, project, migrationData);
77
77
  if (fileWithUpdatedImport) {
78
78
  tree.overwrite(filePath, fileWithUpdatedImport);
79
79
  }
@@ -81,51 +81,64 @@ const visitor = (filePath, tree) => {
81
81
  }
82
82
  };
83
83
  exports.visitor = visitor;
84
- const moveImport = (bufferFileContent, sourceFile, migrationData) => {
85
- var _a;
84
+ const moveImport = (filePath, bufferFileContent, project, migrationData) => {
85
+ var _a, _b, _c;
86
86
  const fileContent = bufferFileContent.toString();
87
87
  const predictImport = fileContent.includes(migrationData.change.importedValue);
88
- if (!predictImport) {
89
- return undefined;
90
- }
91
- const moduleImports = sourceFile.statements.filter(ts.isImportDeclaration);
92
- const importDeclaration = moduleImports.find((moduleImport) => {
93
- const currentImportSource = moduleImport.moduleSpecifier.getText().replace(/['"]/g, '');
94
- return currentImportSource === migrationData.change.importSource;
95
- });
96
- if (!((_a = importDeclaration === null || importDeclaration === void 0 ? void 0 : importDeclaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings)) {
97
- return undefined;
98
- }
99
- if (!ts.isNamedImports(importDeclaration.importClause.namedBindings)) {
100
- return undefined;
101
- }
102
- const namedImportsElements = importDeclaration.importClause.namedBindings.elements;
103
- const importedValue = namedImportsElements.find((binding) => binding.name.text === migrationData.change.importedValue);
104
- if (importedValue) {
105
- let updatedContent = namedImportsElements.length === 1
106
- ? removeTextRange(fileContent, importDeclaration.getFullStart(), importDeclaration.getEnd())
107
- : removeTextRange(fileContent, importedValue.getFullStart(), importedValue.getEnd());
108
- const alreadyImported = moduleImports.some((moduleImport) => {
109
- var _a;
110
- const currentImportSource = moduleImport.moduleSpecifier.getText().replace(/['"]/g, '');
111
- return (currentImportSource === migrationData.to.importSource &&
112
- ((_a = moduleImport.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings) &&
113
- ts.isNamedImports(moduleImport.importClause.namedBindings) &&
114
- moduleImport.importClause.namedBindings.elements.some((element) => element.name.text === migrationData.to.importedValue));
88
+ if (predictImport) {
89
+ const sourceFile = (_a = project.getSourceFile(`migration-${filePath}`)) !== null && _a !== void 0 ? _a : project.createSourceFile(`migration-${filePath}`, fileContent);
90
+ const alfrescoApiImportResult = getImportedValueFromSource(sourceFile, {
91
+ importedIdentifier: migrationData.change.importedValue,
92
+ from: migrationData.change.importSource
115
93
  });
116
- if (!alreadyImported) {
117
- const firstNonImport = sourceFile.statements.find((statement) => !ts.isImportDeclaration(statement));
118
- const insertPosition = firstNonImport ? firstNonImport.getFullStart() : fileContent.length;
119
- updatedContent =
120
- updatedContent.slice(0, insertPosition).trimEnd() +
121
- `\nimport { ${migrationData.to.importedValue} } from '${migrationData.to.importSource}';\n` +
122
- updatedContent.slice(insertPosition);
94
+ if (alfrescoApiImportResult === null || alfrescoApiImportResult === void 0 ? void 0 : alfrescoApiImportResult.importedValue) {
95
+ if (alfrescoApiImportResult.allImportedValuesCount === 1) {
96
+ // There is only one import e.g. import { A } from 'A';
97
+ // Therefore, we need to remove whole import statement
98
+ (_b = alfrescoApiImportResult.importSource) === null || _b === void 0 ? void 0 : _b.remove();
99
+ }
100
+ else {
101
+ (_c = alfrescoApiImportResult.importedValue) === null || _c === void 0 ? void 0 : _c.remove();
102
+ }
103
+ const alfrescoContentServiceImport = getSourceImport(sourceFile, migrationData.to.importSource);
104
+ if (alfrescoContentServiceImport) {
105
+ alfrescoContentServiceImport.addNamedImport(migrationData.to.importedValue);
106
+ }
107
+ else {
108
+ sourceFile.insertStatements(sourceFile.getImportDeclarations().length + 1, `import { ${migrationData.to.importedValue} } from '${migrationData.to.importSource}';`);
109
+ }
110
+ return sourceFile.getFullText();
123
111
  }
124
- updatedContent = updatedContent.replace(/^\s*\n+/g, '').replace(/\n{3,}/g, '\n\n');
125
- return updatedContent;
126
112
  }
127
113
  return undefined;
128
114
  };
129
- const removeTextRange = (text, start, end) => text.slice(0, start) + text.slice(end);
115
+ const getSourceImport = (sourceFile, from) => {
116
+ const moduleImports = sourceFile.getImportDeclarations();
117
+ const importDeclaration = moduleImports.find((moduleImport) => {
118
+ const currentImportSource = moduleImport.getModuleSpecifierValue();
119
+ return currentImportSource === from;
120
+ });
121
+ return importDeclaration;
122
+ };
123
+ const getImportedValueFromSource = (sourceFile, searchedImport) => {
124
+ var _a;
125
+ const importSource = getSourceImport(sourceFile, searchedImport.from);
126
+ if (!importSource) {
127
+ return {
128
+ importedValue: undefined,
129
+ importSource: undefined,
130
+ allImportedValuesCount: undefined
131
+ };
132
+ }
133
+ const importedValues = importSource === null || importSource === void 0 ? void 0 : importSource.getImportClause();
134
+ const namedImports = importedValues === null || importedValues === void 0 ? void 0 : importedValues.getNamedBindings();
135
+ const namedImportsElements = (_a = namedImports === null || namedImports === void 0 ? void 0 : namedImports.getElements()) !== null && _a !== void 0 ? _a : [];
136
+ const importedValue = namedImportsElements.find((binding) => binding.getName() === searchedImport.importedIdentifier);
137
+ return {
138
+ importedValue,
139
+ importSource,
140
+ allImportedValuesCount: namedImportsElements.length
141
+ };
142
+ };
130
143
  exports.default = updateAlfrescoApiImports;
131
144
  //# sourceMappingURL=index.js.map