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,5 +1,3 @@
{
"recommendations": [
"lucono.karma-test-explorer"
]
"recommendations": ["lucono.karma-test-explorer", "esbenp.prettier-vscode", "firsttris.vscode-jest-runner"]
}

11
.vscode/settings.json vendored
View File

@ -32,5 +32,14 @@
"scss"
],
"editor.guides.indentation": true,
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"i18n-ally.localesPaths": [
"scripts/i18n",
"demo-shell/resources/i18n",
"lib/content-services/src/lib/i18n",
"lib/insights/src/lib/i18n",
"lib/process-services/src/lib/i18n",
"lib/core/src/lib/i18n",
"lib/process-services-cloud/src/lib/i18n"
]
}

View File

@ -262,26 +262,7 @@
"command": "echo cli bundle created"
}
]
},
"dependsOn": [
"copyToNodeModules"
]
},
"copyToNodeModules": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "rm -rf ./node_modules/@alfresco/js-api/ && mkdir -p ./node_modules/@alfresco/js-api/ && cp -R ./dist/libs/js-api/* ./node_modules/@alfresco/js-api/"
}
]
},
"dependsOn": [
{
"projects": "self",
"target": "build"
}
]
}
},
"test": {
"builder": "nx:run-commands",
@ -873,7 +854,6 @@
},
"extensions": {
"root": "lib/extensions",
"sourceRoot": "lib/extensions/src",
"projectType": "library",
"prefix": "adf",
"architect": {

View File

@ -13,7 +13,6 @@
"noUnusedLocals": true,
"esModuleInterop": true,
"outDir": "../../dist/libs/cli",
"rootDir": ".",
"skipLibCheck": true,
"strictNullChecks": false,
"target": "es2018",

View File

@ -11,7 +11,6 @@
}
],
"compilerOptions": {
"baseUrl": "src",
"target": "es2020"
},
"angularCompilerOptions": {

View File

@ -4,16 +4,6 @@
"outDir": "../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"paths": {
"@alfresco/adf-extensions": ["../../../dist/libs/extensions"],
"@alfresco/adf-extensions/*": ["../../../dist/libs/extensions/*"],
"@alfresco/adf-core/auth": ["../auth/src/index.ts"],
"@alfresco/adf-core/shell": ["../shell/src/index.ts"],
"@alfresco/adf-core/api": ["../api/src/index.ts"],
"@alfresco/adf-core/feature-flags": ["../feature-flags/src/index.ts"],
"@alfresco/js-api": ["../../../dist/libs/js-api"],
"@alfresco/js-api/*": ["../../../dist/libs/js-api/*"]
},
"target": "ES2022",
"useDefineForClassFields": false
},

View File

@ -1,7 +1,7 @@
{
"name": "extensions",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "lib/extensions/src",
"sourceRoot": "lib/extensions",
"projectType": "library",
"prefix": "adf",
"targets": {

View File

@ -14,7 +14,6 @@
}
],
"compilerOptions": {
"baseUrl": "src",
"target": "es2020"
},
"angularCompilerOptions": {

View File

@ -3,10 +3,6 @@
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"paths": {
"@alfresco/js-api": ["../../../dist/libs/js-api"],
"@alfresco/js-api/*": ["../../../dist/libs/js-api/*"]
}
"declarationMap": true
}
}

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"],

View File

@ -11,7 +11,6 @@
}
],
"compilerOptions": {
"baseUrl": "src",
"target": "es2020"
},
"angularCompilerOptions": {

View File

@ -4,10 +4,6 @@
"outDir": "../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"resolveJsonModule": true,
"paths": {
"@alfresco/js-api": ["../../../dist/libs/js-api"],
"@alfresco/js-api/*": ["../../../dist/libs/js-api/*"]
}
"resolveJsonModule": true
}
}

View File

@ -28,7 +28,7 @@
"inputs": ["default", "^production", "{workspaceRoot}/.storybook/**/*"]
},
"test": {
"inputs": ["default", "^production"]
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
}
},
"tasksRunnerOptions": {
@ -55,7 +55,9 @@
"!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)",
"!{projectRoot}/**/*.spec.[jt]s",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/karma.conf.js"
"!{projectRoot}/karma.conf.js",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/jest.config.[jt]s"
]
}
}

2206
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -57,7 +57,6 @@
"process services-cloud"
],
"dependencies": {
"@alfresco/js-api": ">=7.9.0-0",
"@angular/animations": "15.2.10",
"@angular/cdk": "15.2.9",
"@angular/common": "15.2.10",
@ -117,6 +116,8 @@
"@nrwl/angular": "15.9.3",
"@nrwl/cli": "15.9.3",
"@nrwl/eslint-plugin-nx": "15.9.3",
"@nrwl/jest": "15.9.3",
"@nrwl/js": "^15.9.7",
"@nrwl/node": "15.9.3",
"@nrwl/storybook": "15.9.3",
"@nrwl/workspace": "15.9.3",
@ -131,6 +132,7 @@
"@types/event-emitter": "^0.3.3",
"@types/jasmine": "4.0.3",
"@types/jasminewd2": "~2.0.2",
"@types/jest": "^29.4.0",
"@types/jsdom": "^21.1.5",
"@types/minimatch": "^3.0.3",
"@types/mocha": "^10.0.6",
@ -168,6 +170,8 @@
"jasmine-marbles": "^0.9.2",
"jasmine-reporters": "^2.5.2",
"jasmine-spec-reporter": "7.0.0",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"js-yaml": "^4.0.0",
"jsdom": "^24.0.0",
"karma": "^6.4.1",
@ -202,6 +206,7 @@
"spdx-license-list": "^6.9.0",
"stylelint": "^16.3.1",
"stylelint-config-standard-scss": "^13.1.0",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.1.1",
"typescript": "4.9.5",

View File

@ -3,9 +3,8 @@
"compilerOptions": {
"downlevelIteration": true,
"module": "esnext",
"rootDir": ".",
"outDir": "./dist/out-tsc",
"baseUrl": ".",
"baseUrl": "./",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",