Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit 12567fe

Browse files
authored
[ACS-5839] improved typing support (#1638)
* cleanup UserprofileApi * cleanup activiti api * cleanup activiti api * cleanup activiti api * cleanup activiti api * cleanup activiti api typings * cleanup activiti api typings * cleanup activiti api typings * cleanup api typings * cleanup api typings * cleanup api typings * cleanup api typings * remove eslint excludes * remove eslint excludes * remove eslint excludes * remove eslint excludes * remove eslint excludes * remove unnecessary config imports * more typings for query params * more typings for query params * more typings for query params * more typings for query params * more typings for query params * reduce code * fix delete queries, reduce code * reduce code * reduce code * reduce code * reduce code
1 parent c212009 commit 12567fe

File tree

129 files changed

+4460
-8929
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+4460
-8929
lines changed

.eslintrc.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,13 @@
1616
],
1717
// TODO: consider removing these rules and improving the source code
1818
"rules": {
19-
"prefer-const": "off",
20-
"no-useless-escape": "off",
2119
"prefer-rest-params": "off",
2220
"prefer-spread": "off",
23-
"no-prototype-builtins": "off",
2421
"@typescript-eslint/explicit-module-boundary-types": "off",
25-
"@typescript-eslint/ban-ts-comment": 1,
26-
"@typescript-eslint/ban-types": 1,
2722
"@typescript-eslint/no-var-requires": "off",
2823
"@typescript-eslint/no-explicit-any": "off",
2924
"@typescript-eslint/no-empty-function": "off",
3025
"@typescript-eslint/no-namespace": "off",
31-
"@typescript-eslint/no-inferrable-types": "off",
32-
"@typescript-eslint/no-unused-vars": 1,
3326
"license-header/header": [
3427
"error",
3528
[

package-lock.json

Lines changed: 10 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
},
3939
"devDependencies": {
4040
"@types/chai": "^4.2.3",
41+
"@types/chai-spies": "^1.0.3",
4142
"@types/event-emitter": "^0.3.3",
4243
"@types/mocha": "^10.0.1",
4344
"@types/node": "^20.4.9",

src/alfrescoApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class AlfrescoApi implements Emitter, AlfrescoApiType {
6262

6363
setConfig(config: AlfrescoApiConfig) {
6464
if (!config) {
65-
config = {} as AlfrescoApiConfig;
65+
config = {};
6666
}
6767

6868
this.storage = Storage.getInstance();

src/alfrescoApiClient.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ export class AlfrescoApiClient implements ee.Emitter, LegacyHttpClient {
134134
}
135135

136136
delete<T = void>(options: RequestOptions): AlfrescoApiClientPromise<T> {
137-
return this.buildRequestCall<T>(this.basePath, options, this.httpClient.delete.bind(this.httpClient));
137+
const url = this.getCallApiUrl(options);
138+
return this.buildRequestCall<T>(url, options, this.httpClient.delete.bind(this.httpClient));
138139
}
139140

140141
callApi(
@@ -264,13 +265,15 @@ export class AlfrescoApiClient implements ee.Emitter, LegacyHttpClient {
264265
}
265266

266267
private static addParamsToUrl(path: string, pathParams: any) {
267-
return path.replace(/\{([\w-]+)\}/g, function (fullMatch, key) {
268+
return path.replace(/\{([\w-]+)}/g, function (fullMatch, key) {
268269
let value;
269-
if (pathParams.hasOwnProperty(key)) {
270+
271+
if (Object.prototype.hasOwnProperty.call(pathParams, key)) {
270272
value = paramToString(pathParams[key]);
271273
} else {
272274
value = fullMatch;
273275
}
276+
274277
return encodeURIComponent(value);
275278
});
276279
}

src/api/activiti-rest-api/api/about.api.ts

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,13 @@ import { BaseApi } from './base.api';
2424
export class AboutApi extends BaseApi {
2525
/**
2626
* Get server type and version
27-
*
2827
* Provides information about the running Alfresco Process Services Suite. The response payload object has the properties type, majorVersion, minorVersion, revisionVersion and edition.
2928
*
3029
* @return Promise<{ [key: string]: string; }>
3130
*/
3231
getAppVersion(): Promise<{ [key: string]: string; }> {
33-
34-
let postBody = null;
35-
36-
let pathParams = {
37-
38-
};
39-
40-
let queryParams = {
41-
};
42-
43-
let headerParams = {
44-
45-
};
46-
let formParams = {
47-
};
48-
49-
let contentTypes = ['application/json'];
50-
let accepts = ['application/json'];
51-
52-
return this.apiClient.callApi(
53-
'/api/enterprise/app-version', 'GET',
54-
pathParams, queryParams, headerParams, formParams, postBody,
55-
contentTypes, accepts);
32+
return this.get({
33+
path: '/api/enterprise/app-version'
34+
});
5635
}
57-
5836
}

src/api/activiti-rest-api/api/accountIntegration.api.ts

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,41 +19,20 @@ import { ResultListDataRepresentationAccountRepresentation } from '../model/resu
1919
import { BaseApi } from './base.api';
2020

2121
/**
22-
* Accountintegration service.
23-
* @module AccountintegrationApi
22+
* AccountIntegrationApi service.
23+
* @module AccountIntegrationApi
2424
*/
2525
export class AccountIntegrationApi extends BaseApi {
2626
/**
2727
* Retrieve external account information
28-
*
2928
* Accounts are used to integrate with third party apps and clients
3029
*
3130
* @return Promise<ResultListDataRepresentationAccountRepresentation>
3231
*/
3332
getAccounts(): Promise<ResultListDataRepresentationAccountRepresentation> {
34-
35-
let postBody = null;
36-
37-
let pathParams = {
38-
39-
};
40-
41-
let queryParams = {
42-
};
43-
44-
let headerParams = {
45-
46-
};
47-
let formParams = {
48-
};
49-
50-
let contentTypes = ['application/json'];
51-
let accepts = ['application/json'];
52-
53-
return this.apiClient.callApi(
54-
'/api/enterprise/account/integration', 'GET',
55-
pathParams, queryParams, headerParams, formParams, postBody,
56-
contentTypes, accepts, ResultListDataRepresentationAccountRepresentation);
33+
return this.get({
34+
path: '/api/enterprise/account/integration',
35+
returnType: ResultListDataRepresentationAccountRepresentation
36+
});
5737
}
58-
5938
}

0 commit comments

Comments
 (0)