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

11
.vscode/settings.json vendored
View File

@ -32,5 +32,14 @@
"scss" "scss"
], ],
"editor.guides.indentation": true, "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" "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": { "test": {
"builder": "nx:run-commands", "builder": "nx:run-commands",
@ -873,7 +854,6 @@
}, },
"extensions": { "extensions": {
"root": "lib/extensions", "root": "lib/extensions",
"sourceRoot": "lib/extensions/src",
"projectType": "library", "projectType": "library",
"prefix": "adf", "prefix": "adf",
"architect": { "architect": {

View File

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

View File

@ -66,7 +66,7 @@
"demo-shell/src/custom-style-dev.scss", "demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css", "node_modules/cropperjs/dist/cropper.min.css",
"node_modules/pdfjs-dist/web/pdf_viewer.css", "node_modules/pdfjs-dist/web/pdf_viewer.css",
], ],
"stylePreprocessorOptions": { "stylePreprocessorOptions": {
"includePaths": ["lib", "lib/core/src/lib"] "includePaths": ["lib", "lib/core/src/lib"]

View File

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

View File

@ -4,16 +4,6 @@
"outDir": "../../dist/out-tsc", "outDir": "../../dist/out-tsc",
"declaration": true, "declaration": true,
"declarationMap": 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", "target": "ES2022",
"useDefineForClassFields": false "useDefineForClassFields": false
}, },

View File

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

View File

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

View File

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

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) Run `nx build lib-js-api` to build the library.
- [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)
## Guides ## Running unit tests
- [Authentication](docs/authentication.md) Run `nx test lib-js-api` to execute the unit tests via [Jest](https://jestjs.io).
- [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
```

View File

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

View File

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

View File

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

View File

@ -9,6 +9,6 @@
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"skipLibCheck": true, "skipLibCheck": true,
"skipDefaultLibCheck": 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": { "compilerOptions": {
"importHelpers": true, "importHelpers": true,
"removeComments": true, "removeComments": true,
@ -14,7 +23,7 @@
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"moduleResolution": "node", "moduleResolution": "node",
"stripInternal": false, "stripInternal": false,
"target": "es2015", "target": "es2020",
"outDir": "./.out", "outDir": "./.out",
"lib": ["es2018", "dom"], "lib": ["es2018", "dom"],
"typeRoots": ["node_modules/@types"], "typeRoots": ["node_modules/@types"],

View File

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

View File

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

View File

@ -28,7 +28,7 @@
"inputs": ["default", "^production", "{workspaceRoot}/.storybook/**/*"] "inputs": ["default", "^production", "{workspaceRoot}/.storybook/**/*"]
}, },
"test": { "test": {
"inputs": ["default", "^production"] "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
} }
}, },
"tasksRunnerOptions": { "tasksRunnerOptions": {
@ -55,7 +55,9 @@
"!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)", "!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)",
"!{projectRoot}/**/*.spec.[jt]s", "!{projectRoot}/**/*.spec.[jt]s",
"!{projectRoot}/tsconfig.spec.json", "!{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" "process services-cloud"
], ],
"dependencies": { "dependencies": {
"@alfresco/js-api": ">=7.9.0-0",
"@angular/animations": "15.2.10", "@angular/animations": "15.2.10",
"@angular/cdk": "15.2.9", "@angular/cdk": "15.2.9",
"@angular/common": "15.2.10", "@angular/common": "15.2.10",
@ -117,6 +116,8 @@
"@nrwl/angular": "15.9.3", "@nrwl/angular": "15.9.3",
"@nrwl/cli": "15.9.3", "@nrwl/cli": "15.9.3",
"@nrwl/eslint-plugin-nx": "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/node": "15.9.3",
"@nrwl/storybook": "15.9.3", "@nrwl/storybook": "15.9.3",
"@nrwl/workspace": "15.9.3", "@nrwl/workspace": "15.9.3",
@ -131,6 +132,7 @@
"@types/event-emitter": "^0.3.3", "@types/event-emitter": "^0.3.3",
"@types/jasmine": "4.0.3", "@types/jasmine": "4.0.3",
"@types/jasminewd2": "~2.0.2", "@types/jasminewd2": "~2.0.2",
"@types/jest": "^29.4.0",
"@types/jsdom": "^21.1.5", "@types/jsdom": "^21.1.5",
"@types/minimatch": "^3.0.3", "@types/minimatch": "^3.0.3",
"@types/mocha": "^10.0.6", "@types/mocha": "^10.0.6",
@ -168,6 +170,8 @@
"jasmine-marbles": "^0.9.2", "jasmine-marbles": "^0.9.2",
"jasmine-reporters": "^2.5.2", "jasmine-reporters": "^2.5.2",
"jasmine-spec-reporter": "7.0.0", "jasmine-spec-reporter": "7.0.0",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"js-yaml": "^4.0.0", "js-yaml": "^4.0.0",
"jsdom": "^24.0.0", "jsdom": "^24.0.0",
"karma": "^6.4.1", "karma": "^6.4.1",
@ -202,6 +206,7 @@
"spdx-license-list": "^6.9.0", "spdx-license-list": "^6.9.0",
"stylelint": "^16.3.1", "stylelint": "^16.3.1",
"stylelint-config-standard-scss": "^13.1.0", "stylelint-config-standard-scss": "^13.1.0",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"tsconfig-paths": "^4.1.1", "tsconfig-paths": "^4.1.1",
"typescript": "4.9.5", "typescript": "4.9.5",

View File

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