@alfresco/js-api 9.1.0-14701637708 → 9.1.0-14711395239

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfresco/js-api",
3
- "version": "9.1.0-14701637708",
3
+ "version": "9.1.0-14711395239",
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",
@@ -24,4 +24,4 @@
24
24
  "es2015": "./esm2015/index.js",
25
25
  "type": "module",
26
26
  "main": "./src/index.js"
27
- }
27
+ }
package/esm5/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfresco/js-api",
3
- "version": "9.1.0-14701637708",
3
+ "version": "9.1.0-14711395239",
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",
@@ -24,4 +24,4 @@
24
24
  "es2015": "./esm2015/index.js",
25
25
  "type": "module",
26
26
  "main": "./src/index.js"
27
- }
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfresco/js-api",
3
- "version": "9.1.0-14701637708",
3
+ "version": "9.1.0-14711395239",
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",
@@ -24,4 +24,4 @@
24
24
  "es2015": "./esm2015/index.js",
25
25
  "main": "./src/index.js",
26
26
  "type": "commonjs"
27
- }
27
+ }
@@ -16,8 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.AlfrescoApiClient = void 0;
20
- exports.buildCollectionParam = buildCollectionParam;
19
+ exports.AlfrescoApiClient = exports.buildCollectionParam = void 0;
21
20
  const tslib_1 = require("tslib");
22
21
  const event_emitter_1 = tslib_1.__importDefault(require("event-emitter"));
23
22
  const superagentHttpClient_1 = require("./superagentHttpClient");
@@ -42,6 +41,7 @@ function buildCollectionParam(param, collectionFormat) {
42
41
  throw new Error('Unknown collection format: ' + collectionFormat);
43
42
  }
44
43
  }
44
+ exports.buildCollectionParam = buildCollectionParam;
45
45
  class AlfrescoApiClient {
46
46
  constructor(host, httpClient) {
47
47
  this.basePath = '';
@@ -1 +1 @@
1
- {"version":3,"file":"alfrescoApiClient.js","sourceRoot":"","sources":["alfrescoApiClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AA2BH,oDAoBC;;AA7CD,0EAA+B;AAG/B,iEAA8D;AAE9D,mCAAwC;AACxC,uCAAoC;AAmBpC,SAAgB,oBAAoB,CAAC,KAAe,EAAE,gBAAwB;IAC1E,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,gBAAgB,EAAE,CAAC;QACvB,KAAK,KAAK;YACN,OAAO,KAAK,CAAC,GAAG,CAAC,qBAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9C,KAAK,KAAK;YACN,OAAO,KAAK,CAAC,GAAG,CAAC,qBAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9C,KAAK,KAAK;YACN,OAAO,KAAK,CAAC,GAAG,CAAC,qBAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,KAAK,OAAO;YACR,OAAO,KAAK,CAAC,GAAG,CAAC,qBAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9C,KAAK,OAAO;YAER,OAAO,KAAK,CAAC,GAAG,CAAC,qBAAa,CAAC,CAAC;QACpC;YACI,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,gBAAgB,CAAC,CAAC;IAC1E,CAAC;AACL,CAAC;AAED,MAAa,iBAAiB;IAyC1B,YAAY,IAAa,EAAE,UAAuB;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U,CAAC,WAAmB;QACzC,OAAO,OAAO,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAAC;IACrE,CAAC;IAEO,mBAAmB,CAAU,OAAmB,EAAE,YAAwB;QAC9E,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;YAC1B,EAAE;gBAEE,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBAC/C,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,IAAI;gBAEA,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBACjD,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,IAAI;gBAEA,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBACjD,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,GAAG;gBAEC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBAChD,OAAO,IAAI,CAAC;YAChB,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;CACJ;AAhVD,8CAgVC","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 ee from 'event-emitter';\nimport { AlfrescoApiConfig } from './alfrescoApiConfig';\nimport { Authentication } from './authentication/authentication';\nimport { SuperagentHttpClient } from './superagentHttpClient';\nimport { Emitters, HttpClient, LegacyHttpClient, RequestOptions, SecurityOptions } from './api-clients/http-client.interface';\nimport { paramToString } from './utils';\nimport { Storage } from './storage';\n\ndeclare const Buffer: any;\n\nexport type AlfrescoApiClientPromise<T = any> = Promise<T> & {\n on: ee.EmitterMethod;\n off: ee.EmitterMethod;\n once: ee.EmitterMethod;\n emit: (type: string, ...args: any[]) => void;\n abort?: () => void;\n};\n\n/**\n * Builds a string representation of an array-type actual parameter, according to the given collection format.\n * @param param An array parameter.\n * @param collectionFormat The array element separator strategy.\n * @returns A string representation of the supplied collection, using the specified delimiter. Returns\n * <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.\n */\nexport function buildCollectionParam(param: string[], collectionFormat: string): string | any[] {\n if (!param) {\n return null;\n }\n\n switch (collectionFormat) {\n case 'csv':\n return param.map(paramToString).join(',');\n case 'ssv':\n return param.map(paramToString).join(' ');\n case 'tsv':\n return param.map(paramToString).join('\\t');\n case 'pipes':\n return param.map(paramToString).join('|');\n case 'multi':\n // return the array directly as SuperAgent will handle it as expected\n return param.map(paramToString);\n default:\n throw new Error('Unknown collection format: ' + collectionFormat);\n }\n}\n\nexport class AlfrescoApiClient implements ee.Emitter, LegacyHttpClient {\n on: ee.EmitterMethod;\n off: ee.EmitterMethod;\n once: ee.EmitterMethod;\n emit: (type: string, ...args: any[]) => void;\n\n storage: Storage;\n host: string;\n className: string;\n config: AlfrescoApiConfig;\n url: string;\n /**\n * The base URL against which to resolve every API call's (relative) path.\n */\n basePath = '';\n\n /**\n * The authentication methods to be included for all API calls.\n */\n authentications: Authentication = {\n basicAuth: {\n ticket: ''\n },\n type: 'basic'\n };\n /**\n * The default HTTP headers to be included for all API calls.\n */\n defaultHeaders = {};\n\n /**\n * The default HTTP timeout for all API calls.\n */\n timeout: number | { deadline?: number; response?: number } = undefined;\n\n contentTypes = {\n JSON: ['application/json']\n };\n\n httpClient: HttpClient;\n\n constructor(host?: string, httpClient?: HttpClient) {\n this.host = host;\n\n this.storage = Storage.getInstance();\n\n // fallback for backward compatibility\n this.httpClient = httpClient || new SuperagentHttpClient();\n\n ee(this);\n }\n\n request<T = any>(options: RequestOptions): Promise<T> {\n return this.buildRequestCall(this.basePath, options, this.httpClient.request.bind(this.httpClient));\n }\n\n post<T = any>(options: RequestOptions): AlfrescoApiClientPromise<T> {\n const url = this.getCallApiUrl(options);\n return this.buildRequestCall(url, options, this.httpClient.post.bind(this.httpClient));\n }\n\n put<T = any>(options: RequestOptions): AlfrescoApiClientPromise<T> {\n const url = this.getCallApiUrl(options);\n return this.buildRequestCall(url, options, this.httpClient.put.bind(this.httpClient));\n }\n\n get<T = any>(options: RequestOptions): AlfrescoApiClientPromise<T> {\n const url = this.getCallApiUrl(options);\n return this.buildRequestCall(url, options, this.httpClient.get.bind(this.httpClient));\n }\n\n delete<T = void>(options: RequestOptions): AlfrescoApiClientPromise<T> {\n const url = this.getCallApiUrl(options);\n return this.buildRequestCall<T>(url, options, this.httpClient.delete.bind(this.httpClient));\n }\n\n callApi(\n path: string,\n httpMethod: string,\n pathParams?: any,\n queryParams?: any,\n headerParams?: any,\n formParams?: any,\n bodyParam?: any,\n contentTypes?: string[],\n accepts?: string[],\n returnType?: any,\n contextRoot?: string,\n responseType?: string,\n url?: string\n ): AlfrescoApiClientPromise<any> {\n const callApiUrl = url ?? this.getCallApiUrl({ contextRoot, path, pathParams });\n\n const options: RequestOptions = {\n path,\n httpMethod,\n pathParams,\n queryParams,\n headerParams,\n formParams,\n bodyParam,\n contentTypes,\n accepts,\n returnType,\n contextRoot,\n responseType,\n url\n };\n\n return this.buildRequestCall(callApiUrl, options, this.httpClient.request.bind(this.httpClient));\n }\n\n callCustomApi(\n path: string,\n httpMethod: string,\n pathParams?: any,\n queryParams?: any,\n headerParams?: any,\n formParams?: any,\n bodyParam?: any,\n contentTypes?: string[],\n accepts?: string[],\n returnType?: any,\n contextRoot?: string,\n responseType?: string\n ): AlfrescoApiClientPromise<any> {\n const customApiUrl = AlfrescoApiClient.buildUrl(path, '', pathParams);\n const options: RequestOptions = {\n path,\n httpMethod,\n pathParams,\n queryParams,\n headerParams,\n formParams,\n bodyParam,\n contentTypes,\n accepts,\n returnType,\n contextRoot,\n responseType\n };\n\n return this.buildRequestCall(customApiUrl, options, this.httpClient.request.bind(this.httpClient));\n }\n\n isCsrfEnabled(): boolean {\n if (this.config) {\n return !this.config.disableCsrf;\n } else {\n return true;\n }\n }\n\n isBpmRequest(): boolean {\n return this.className === 'ProcessAuth' || this.className === 'ProcessClient';\n }\n\n basicAuth(username: string, password: string): string {\n const str = username + ':' + password;\n\n let base64;\n\n if (typeof Buffer === 'function') {\n base64 = Buffer.from(str, 'binary').toString('base64');\n } else {\n base64 = btoa(str);\n }\n\n return 'Basic ' + base64;\n }\n\n isWithCredentials(): boolean {\n return !!this.config?.withCredentials;\n }\n\n getAlfTicket(ticket: string): string {\n const ticketParam = this.isWithCredentials() ? '&ticket=' : '&alf_ticket=';\n\n if (ticket) {\n return ticketParam + ticket;\n } else {\n const ticketConfig = this.config.ticketEcm;\n const ticketStorage = this.storage.getItem('ticket-ECM');\n\n if (ticketConfig && ticketStorage && ticketConfig !== ticketStorage) {\n this.emit('ticket_mismatch', { newTicket: ticketStorage });\n return ticketParam + ticketStorage;\n } else if (ticketConfig) {\n return ticketParam + ticketConfig;\n } else if (ticketStorage) {\n return ticketParam + ticketStorage;\n }\n }\n\n return '';\n }\n\n /**\n * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders\n * with parameter values\n */\n private static buildUrl(basePath: string, path: string, pathParams: any): string {\n if (path && path !== '' && !path.match(/^\\//)) {\n path = '/' + path;\n }\n const url = basePath + path;\n\n return AlfrescoApiClient.addParamsToUrl(url, pathParams);\n }\n\n private static addParamsToUrl(path: string, pathParams: any) {\n return path.replace(/\\{([\\w-]+)}/g, (fullMatch, key) => {\n let value;\n\n if (Object.prototype.hasOwnProperty.call(pathParams, key)) {\n value = paramToString(pathParams[key]);\n } else {\n value = fullMatch;\n }\n\n return encodeURIComponent(value);\n });\n }\n\n private getCallApiUrl({ contextRoot, path, pathParams }: { contextRoot?: string; path: string; pathParams?: any }): string {\n const basePath = contextRoot ? `${this.host}/${contextRoot}` : this.basePath;\n\n return AlfrescoApiClient.buildUrl(basePath, path, pathParams);\n }\n\n private buildRequestCall<T = any>(\n url: string,\n options: RequestOptions,\n httpCall: (url: string, options: RequestOptions, security: SecurityOptions, emitters: Emitters) => Promise<T>\n ): AlfrescoApiClientPromise<T> {\n const security = this.getSecurityOptions();\n const emitters = this.getEventEmitters();\n const httpRequestOptions = this.getRequestOptionsWithAcceptAndContentType(options);\n const promise = httpCall(url, httpRequestOptions, security, emitters);\n\n return this.addPromiseListeners(promise, emitters.eventEmitter);\n }\n\n private getSecurityOptions(): SecurityOptions {\n return {\n isBpmRequest: this.isBpmRequest(),\n enableCsrf: this.isCsrfEnabled(),\n withCredentials: this.isWithCredentials(),\n authentications: this.authentications,\n defaultHeaders: this.defaultHeaders\n };\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 getRequestOptionsWithAcceptAndContentType(options: RequestOptions): RequestOptions {\n const contentType = AlfrescoApiClient.jsonPreferredMime(options.contentTypes);\n const accept = AlfrescoApiClient.jsonPreferredMime(options.accepts);\n\n return {\n ...options,\n contentType,\n accept\n };\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 * @param contentTypes content types\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 (const item of contentTypes) {\n if (AlfrescoApiClient.isJsonMime(item)) {\n return item;\n }\n }\n return contentTypes[0];\n }\n\n /**\n * Checks whether the given content type represents JSON.<br>\n *\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 * @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 addPromiseListeners<T = any>(promise: Promise<T>, eventEmitter: ee.Emitter): AlfrescoApiClientPromise<T> {\n return 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}\n"]}
1
+ {"version":3,"file":"alfrescoApiClient.js","sourceRoot":"","sources":["alfrescoApiClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;AAEH,0EAA+B;AAG/B,iEAA8D;AAE9D,mCAAwC;AACxC,uCAAoC;AAmBpC,SAAgB,oBAAoB,CAAC,KAAe,EAAE,gBAAwB;IAC1E,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,gBAAgB,EAAE,CAAC;QACvB,KAAK,KAAK;YACN,OAAO,KAAK,CAAC,GAAG,CAAC,qBAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9C,KAAK,KAAK;YACN,OAAO,KAAK,CAAC,GAAG,CAAC,qBAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9C,KAAK,KAAK;YACN,OAAO,KAAK,CAAC,GAAG,CAAC,qBAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;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YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,CAAA,EAAE,CAAC;YACxB,OAAO,kBAAkB,CAAC;QAC9B,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;YAC9B,IAAI,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAcO,MAAM,CAAC,UAAU,CAAC,WAAmB;QACzC,OAAO,OAAO,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAAC;IACrE,CAAC;IAEO,mBAAmB,CAAU,OAAmB,EAAE,YAAwB;QAC9E,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;YAC1B,EAAE;gBAEE,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBAC/C,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,IAAI;gBAEA,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBACjD,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,IAAI;gBAEA,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBACjD,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,GAAG;gBAEC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBAChD,OAAO,IAAI,CAAC;YAChB,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;CACJ;AAhVD,8CAgVC","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 ee from 'event-emitter';\nimport { AlfrescoApiConfig } from './alfrescoApiConfig';\nimport { Authentication } from './authentication/authentication';\nimport { SuperagentHttpClient } from './superagentHttpClient';\nimport { Emitters, HttpClient, LegacyHttpClient, RequestOptions, SecurityOptions } from './api-clients/http-client.interface';\nimport { paramToString } from './utils';\nimport { Storage } from './storage';\n\ndeclare const Buffer: any;\n\nexport type AlfrescoApiClientPromise<T = any> = Promise<T> & {\n on: ee.EmitterMethod;\n off: ee.EmitterMethod;\n once: ee.EmitterMethod;\n emit: (type: string, ...args: any[]) => void;\n abort?: () => void;\n};\n\n/**\n * Builds a string representation of an array-type actual parameter, according to the given collection format.\n * @param param An array parameter.\n * @param collectionFormat The array element separator strategy.\n * @returns A string representation of the supplied collection, using the specified delimiter. Returns\n * <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.\n */\nexport function buildCollectionParam(param: string[], collectionFormat: string): string | any[] {\n if (!param) {\n return null;\n }\n\n switch (collectionFormat) {\n case 'csv':\n return param.map(paramToString).join(',');\n case 'ssv':\n return param.map(paramToString).join(' ');\n case 'tsv':\n return param.map(paramToString).join('\\t');\n case 'pipes':\n return param.map(paramToString).join('|');\n case 'multi':\n // return the array directly as SuperAgent will handle it as expected\n return param.map(paramToString);\n default:\n throw new Error('Unknown collection format: ' + collectionFormat);\n }\n}\n\nexport class AlfrescoApiClient implements ee.Emitter, LegacyHttpClient {\n on: ee.EmitterMethod;\n off: ee.EmitterMethod;\n once: ee.EmitterMethod;\n emit: (type: string, ...args: any[]) => void;\n\n storage: Storage;\n host: string;\n className: string;\n config: AlfrescoApiConfig;\n url: string;\n /**\n * The base URL against which to resolve every API call's (relative) path.\n */\n basePath = '';\n\n /**\n * The authentication methods to be included for all API calls.\n */\n authentications: Authentication = {\n basicAuth: {\n ticket: ''\n },\n type: 'basic'\n };\n /**\n * The default HTTP headers to be included for all API calls.\n */\n defaultHeaders = {};\n\n /**\n * The default HTTP timeout for all API calls.\n */\n timeout: number | { deadline?: number; response?: number } = undefined;\n\n contentTypes = {\n JSON: ['application/json']\n };\n\n httpClient: HttpClient;\n\n constructor(host?: string, httpClient?: HttpClient) {\n this.host = host;\n\n this.storage = Storage.getInstance();\n\n // fallback for backward compatibility\n this.httpClient = httpClient || new SuperagentHttpClient();\n\n ee(this);\n }\n\n request<T = any>(options: RequestOptions): Promise<T> {\n return this.buildRequestCall(this.basePath, options, this.httpClient.request.bind(this.httpClient));\n }\n\n post<T = any>(options: RequestOptions): AlfrescoApiClientPromise<T> {\n const url = this.getCallApiUrl(options);\n return this.buildRequestCall(url, options, this.httpClient.post.bind(this.httpClient));\n }\n\n put<T = any>(options: RequestOptions): AlfrescoApiClientPromise<T> {\n const url = this.getCallApiUrl(options);\n return this.buildRequestCall(url, options, this.httpClient.put.bind(this.httpClient));\n }\n\n get<T = any>(options: RequestOptions): AlfrescoApiClientPromise<T> {\n const url = this.getCallApiUrl(options);\n return this.buildRequestCall(url, options, this.httpClient.get.bind(this.httpClient));\n }\n\n delete<T = void>(options: RequestOptions): AlfrescoApiClientPromise<T> {\n const url = this.getCallApiUrl(options);\n return this.buildRequestCall<T>(url, options, this.httpClient.delete.bind(this.httpClient));\n }\n\n callApi(\n path: string,\n httpMethod: string,\n pathParams?: any,\n queryParams?: any,\n headerParams?: any,\n formParams?: any,\n bodyParam?: any,\n contentTypes?: string[],\n accepts?: string[],\n returnType?: any,\n contextRoot?: string,\n responseType?: string,\n url?: string\n ): AlfrescoApiClientPromise<any> {\n const callApiUrl = url ?? this.getCallApiUrl({ contextRoot, path, pathParams });\n\n const options: RequestOptions = {\n path,\n httpMethod,\n pathParams,\n queryParams,\n headerParams,\n formParams,\n bodyParam,\n contentTypes,\n accepts,\n returnType,\n contextRoot,\n responseType,\n url\n };\n\n return this.buildRequestCall(callApiUrl, options, this.httpClient.request.bind(this.httpClient));\n }\n\n callCustomApi(\n path: string,\n httpMethod: string,\n pathParams?: any,\n queryParams?: any,\n headerParams?: any,\n formParams?: any,\n bodyParam?: any,\n contentTypes?: string[],\n accepts?: string[],\n returnType?: any,\n contextRoot?: string,\n responseType?: string\n ): AlfrescoApiClientPromise<any> {\n const customApiUrl = AlfrescoApiClient.buildUrl(path, '', pathParams);\n const options: RequestOptions = {\n path,\n httpMethod,\n pathParams,\n queryParams,\n headerParams,\n formParams,\n bodyParam,\n contentTypes,\n accepts,\n returnType,\n contextRoot,\n responseType\n };\n\n return this.buildRequestCall(customApiUrl, options, this.httpClient.request.bind(this.httpClient));\n }\n\n isCsrfEnabled(): boolean {\n if (this.config) {\n return !this.config.disableCsrf;\n } else {\n return true;\n }\n }\n\n isBpmRequest(): boolean {\n return this.className === 'ProcessAuth' || this.className === 'ProcessClient';\n }\n\n basicAuth(username: string, password: string): string {\n const str = username + ':' + password;\n\n let base64;\n\n if (typeof Buffer === 'function') {\n base64 = Buffer.from(str, 'binary').toString('base64');\n } else {\n base64 = btoa(str);\n }\n\n return 'Basic ' + base64;\n }\n\n isWithCredentials(): boolean {\n return !!this.config?.withCredentials;\n }\n\n getAlfTicket(ticket: string): string {\n const ticketParam = this.isWithCredentials() ? '&ticket=' : '&alf_ticket=';\n\n if (ticket) {\n return ticketParam + ticket;\n } else {\n const ticketConfig = this.config.ticketEcm;\n const ticketStorage = this.storage.getItem('ticket-ECM');\n\n if (ticketConfig && ticketStorage && ticketConfig !== ticketStorage) {\n this.emit('ticket_mismatch', { newTicket: ticketStorage });\n return ticketParam + ticketStorage;\n } else if (ticketConfig) {\n return ticketParam + ticketConfig;\n } else if (ticketStorage) {\n return ticketParam + ticketStorage;\n }\n }\n\n return '';\n }\n\n /**\n * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders\n * with parameter values\n */\n private static buildUrl(basePath: string, path: string, pathParams: any): string {\n if (path && path !== '' && !path.match(/^\\//)) {\n path = '/' + path;\n }\n const url = basePath + path;\n\n return AlfrescoApiClient.addParamsToUrl(url, pathParams);\n }\n\n private static addParamsToUrl(path: string, pathParams: any) {\n return path.replace(/\\{([\\w-]+)}/g, (fullMatch, key) => {\n let value;\n\n if (Object.prototype.hasOwnProperty.call(pathParams, key)) {\n value = paramToString(pathParams[key]);\n } else {\n value = fullMatch;\n }\n\n return encodeURIComponent(value);\n });\n }\n\n private getCallApiUrl({ contextRoot, path, pathParams }: { contextRoot?: string; path: string; pathParams?: any }): string {\n const basePath = contextRoot ? `${this.host}/${contextRoot}` : this.basePath;\n\n return AlfrescoApiClient.buildUrl(basePath, path, pathParams);\n }\n\n private buildRequestCall<T = any>(\n url: string,\n options: RequestOptions,\n httpCall: (url: string, options: RequestOptions, security: SecurityOptions, emitters: Emitters) => Promise<T>\n ): AlfrescoApiClientPromise<T> {\n const security = this.getSecurityOptions();\n const emitters = this.getEventEmitters();\n const httpRequestOptions = this.getRequestOptionsWithAcceptAndContentType(options);\n const promise = httpCall(url, httpRequestOptions, security, emitters);\n\n return this.addPromiseListeners(promise, emitters.eventEmitter);\n }\n\n private getSecurityOptions(): SecurityOptions {\n return {\n isBpmRequest: this.isBpmRequest(),\n enableCsrf: this.isCsrfEnabled(),\n withCredentials: this.isWithCredentials(),\n authentications: this.authentications,\n defaultHeaders: this.defaultHeaders\n };\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 getRequestOptionsWithAcceptAndContentType(options: RequestOptions): RequestOptions {\n const contentType = AlfrescoApiClient.jsonPreferredMime(options.contentTypes);\n const accept = AlfrescoApiClient.jsonPreferredMime(options.accepts);\n\n return {\n ...options,\n contentType,\n accept\n };\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 * @param contentTypes content types\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 (const item of contentTypes) {\n if (AlfrescoApiClient.isJsonMime(item)) {\n return item;\n }\n }\n return contentTypes[0];\n }\n\n /**\n * Checks whether the given content type represents JSON.<br>\n *\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 * @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 addPromiseListeners<T = any>(promise: Promise<T>, eventEmitter: ee.Emitter): AlfrescoApiClientPromise<T> {\n return 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}\n"]}
package/src/assert.js CHANGED
@@ -16,10 +16,11 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.throwIfNotDefined = throwIfNotDefined;
19
+ exports.throwIfNotDefined = void 0;
20
20
  function throwIfNotDefined(param, name) {
21
21
  if (param === null || param === undefined) {
22
22
  throw new Error(`Missing param '${name}'`);
23
23
  }
24
24
  }
25
+ exports.throwIfNotDefined = throwIfNotDefined;
25
26
  //# sourceMappingURL=../../../../lib/js-api/src/assert.js.map
package/src/assert.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"assert.js","sourceRoot":"","sources":["assert.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAOH,8CAIC;AAJD,SAAgB,iBAAiB,CAAC,KAAU,EAAE,IAAY;IACtD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,GAAG,CAAC,CAAC;IAC/C,CAAC;AACL,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\n/**\n * Throw exception if param is not defined\n * @param param param\n * @param name param name\n */\nexport function throwIfNotDefined(param: any, name: string) {\n if (param === null || param === undefined) {\n throw new Error(`Missing param '${name}'`);\n }\n}\n"]}
1
+ {"version":3,"file":"assert.js","sourceRoot":"","sources":["assert.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAOH,SAAgB,iBAAiB,CAAC,KAAU,EAAE,IAAY;IACtD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,GAAG,CAAC,CAAC;IAC/C,CAAC;AACL,CAAC;AAJD,8CAIC","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\n/**\n * Throw exception if param is not defined\n * @param param param\n * @param name param name\n */\nexport function throwIfNotDefined(param: any, name: string) {\n if (param === null || param === undefined) {\n throw new Error(`Missing param '${name}'`);\n }\n}\n"]}
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.paramToString = paramToString;
19
+ exports.paramToString = void 0;
20
20
  function paramToString(param) {
21
21
  if (param === undefined || param === null) {
22
22
  return '';
@@ -26,4 +26,5 @@ function paramToString(param) {
26
26
  }
27
27
  return param.toString();
28
28
  }
29
+ exports.paramToString = paramToString;
29
30
  //# sourceMappingURL=../../../../../lib/js-api/src/utils/param-to-string.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"param-to-string.js","sourceRoot":"","sources":["param-to-string.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAOH,sCAQC;AARD,SAAgB,aAAa,CAAC,KAAU;IACpC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,EAAE,CAAC;IACd,CAAC;IACD,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC5B,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\n/**\n * Returns a string representation for an actual parameter.\n * @param param The actual parameter.\n * @returns The string representation of <code>param</code>.\n */\nexport function paramToString(param: any): string {\n if (param === undefined || param === null) {\n return '';\n }\n if (param instanceof Date) {\n return param.toJSON();\n }\n return param.toString();\n}\n"]}
1
+ {"version":3,"file":"param-to-string.js","sourceRoot":"","sources":["param-to-string.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAOH,SAAgB,aAAa,CAAC,KAAU;IACpC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,EAAE,CAAC;IACd,CAAC;IACD,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC5B,CAAC;AARD,sCAQC","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\n/**\n * Returns a string representation for an actual parameter.\n * @param param The actual parameter.\n * @returns The string representation of <code>param</code>.\n */\nexport function paramToString(param: any): string {\n if (param === undefined || param === null) {\n return '';\n }\n if (param instanceof Date) {\n return param.toJSON();\n }\n return param.toString();\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfresco/js-api",
3
- "version": "9.1.0-14701637708",
3
+ "version": "9.1.0-14711395239",
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",
@@ -24,4 +24,4 @@
24
24
  "es2015": "./esm2015/index.js",
25
25
  "type": "module",
26
26
  "main": "./src/index.js"
27
- }
27
+ }