AAE-23572 all builds but the extensions one

This commit is contained in:
Wojciech Duda
2024-07-03 15:54:13 +02:00
parent 54b34f513e
commit 2a62c1e2a9
23 changed files with 1860 additions and 518 deletions

View File

@@ -1,7 +0,0 @@
{
"extensions": ["ts"],
"spec": ["lib/js-api/test/**/*.spec.ts"],
"node-option": [
"loader=ts-node/register"
]
}

View File

@@ -1,52 +1,11 @@
# Alfresco JavaScript API
# lib-js-api
JavaScript client API for the Alfresco REST API and Activiti REST API.
This library was generated with [Nx](https://nx.dev).
## API clients documentation
## Building
- [Authentication Api](src/api/auth-rest-api/README.md)
- [Content Api](src/api/content-rest-api/README.md)
- [Model Api](src/api/model-rest-api/README.md)
- [Process Api (AAE)](src/api/activiti-rest-api/README.md)
- [Search Api](src/api/search-rest-api/README.md)
- [Governance Classification Api](src/api/gs-classification-rest-api/README.md)
- [Governance Core Api](src/api/gs-core-rest-api/README.md)
- [Discovery Content API](src/api/discovery-rest-api/README.md)
Run `nx build lib-js-api` to build the library.
## Guides
## Running unit tests
- [Authentication](docs/authentication.md)
- [Calling Custom Endpoints](docs/calling-custom-endpoints.md)
- [Error Events](docs/error-events.md)
- [ECM Examples](docs/ecm-example.md), full docs: [Content API](src/api/content-rest-api/README.md)
- [BPM Examples](docs/bpm-example.md), full docs: [APS 2.X API](src/api/activiti-rest-api/README.md)
## Prerequisites
The minimal supported versions are:
- Alfresco Platform Repository: version [5.2.a-EA](https://wiki.alfresco.com/wiki/Community_file_list_201606-EA) or newer
- Activiti: 1.5
- Node.js ([Long Term Support](https://nodejs.org/en/) version)
## Installing
Using NPM:
```sh
npm install @alfresco/js-api
```
## Development
To run the build
```sh
npm run build
```
To run the test
```sh
npm run test
```
Run `nx test lib-js-api` to execute the unit tests via [Jest](https://jestjs.io).

View File

@@ -353,7 +353,7 @@ export class Oauth2Auth extends AlfrescoApiClient {
redirectLogin(): void {
if (this.config.oauth2.implicitFlow && typeof window !== 'undefined') {
const href = this.composeImplicitLoginUrl();
window.location.href = href;
window.location.assign(href);
this.emit('implicit_redirect', href);
}
}

View File

@@ -17,7 +17,7 @@
import assert from 'assert';
import { AlfrescoApi, ContentAuth } from '../src';
import { EcmAuthMock as AuthEcmMock } from '../test/mockObjects';
import { EcmAuthMock as AuthEcmMock } from './mockObjects';
describe('Ecm Auth test', () => {
const hostEcm = 'https://127.0.0.1:8080';

View File

@@ -18,6 +18,8 @@
import assert from 'assert';
import { AlfrescoApi, ContentApi, Oauth2Auth } from '../src';
import { EcmAuthMock, OAuthMock } from './mockObjects';
import { TextEncoder, TextDecoder } from 'util';
Object.assign(global, { TextDecoder, TextEncoder });
import jsdom from 'jsdom';
const { JSDOM } = jsdom;
@@ -169,7 +171,6 @@ describe('Oauth2 test', () => {
});
it('should refresh token when the login not use the implicitFlow ', function (done) {
this.timeout(3000);
oauth2Mock.get200Response();
const oauth2Auth = new Oauth2Auth(
@@ -202,10 +203,9 @@ describe('Oauth2 test', () => {
}, 600);
oauth2Auth.login('admin', 'admin');
});
}, 3000);
it('should not hang the app also if teh logout is missing', function (done) {
this.timeout(3000);
oauth2Mock.get200Response();
const oauth2Auth = new Oauth2Auth(
@@ -237,7 +237,7 @@ describe('Oauth2 test', () => {
}, 600);
oauth2Auth.login('admin', 'admin');
});
}, 3000);
it('should emit a token_issued event if login is ok ', (done) => {
oauth2Mock.get200Response();
@@ -426,7 +426,6 @@ describe('Oauth2 test', () => {
// TODO: very flaky test, fails on different machines if running slow, might relate to `this.timeout`
// eslint-disable-next-line ban/ban
xit('should extend content session after oauth token refresh', function (done) {
this.timeout(3000);
oauth2Mock.get200Response();
authResponseMock.get200ValidTicket();
@@ -464,9 +463,8 @@ describe('Oauth2 test', () => {
});
alfrescoApi.login('admin', 'admin');
this.timeout(3000);
alfrescoApi.refreshToken();
});
}, 3000);
it('isLoggedIn should return true if the api is logged in', (done) => {
oauth2Mock.get200Response();

View File

@@ -9,6 +9,6 @@
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"types": ["mocha"]
"types": ["jest"]
}
}

View File

@@ -1,4 +1,13 @@
{
"extends": "../../tsconfig.json",
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"importHelpers": true,
"removeComments": true,
@@ -14,7 +23,7 @@
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"stripInternal": false,
"target": "es2015",
"target": "es2020",
"outDir": "./.out",
"lib": ["es2018", "dom"],
"typeRoots": ["node_modules/@types"],