02-04-2019 04:28 AM
Hi everybody,
I want to use nuxeo js client o consume its REST api in my Angular 7 client, but i can't use it because this is a javascript package and it don't have any types definition for typescript. However i tried to include this library in my project using this import statement in my custuom service:
import {Injectable} from '@angular/core';
import {ConfigService} from '@app/technique/@system/config/config.service';
import {Observable} from 'rxjs';
const Nuxeo = require('nuxeo');
@Injectable()
export class NuxeoSocleService {
// XXX Declared here to prevent from mixin style compilation error when using the service.
login: any;
operation: any;
request: any;
repository: any;
batchUpload: any;
users: any;
groups: any;
irectory: any;
workflows: any;
requestAuthenticationToken: any;
// ---
private nuxeoClient: any;
// Path API, URL et chemin du Workspace Nuxeo
private nuxeoApi = '/api/v1';
private nuxeoPath = this.config.variables.nuxeoPATH;
private nuxeoUri = this.config.variables.nuxeoURI;
private pdfDir = this.config.variables.pdfDIR;
private pdfUri = this.config.variables.pdfURI;
// Ici no définit le header d'appel de l'API
private defaultHeader = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'PUT,DELETE,POST,GET,OPTIONS',
'Repository': 'default',
'enrichers.document': 'thumbnail,preview',
'properties': '*',
};
constructor(private config: ConfigService) {
this.nuxeoClient = new Nuxeo({
baseURL: this.nuxeoUri,
apiPath: this.nuxeoApi,
// Activation du CORS
headers: this.defaultHeader,
});
// Mixin Nuxeo JS Client prototype with NuxeoService to use it the same way.
Object.getOwnPropertyNames(Nuxeo.prototype).forEach(name => {
if (/^_|constructor/.test(name)) {
return;
}
NuxeoSocleService.prototype[name] = function (...args: any[]) {
return this.instance[name].apply(this.instance, args);
};
});
}
}
The problem is that, when i run this angular app this error occurred:
index.js:1 Uncaught ReferenceError: process is not defined
at Object../node_modules/promise-queue/index.js (index.js:1)
at __webpack_require__ (bootstrap:76)
at Object../node_modules/nuxeo/lib/upload/batch.js (batch.js:5)
at __webpack_require__ (bootstrap:76)
at Object../node_modules/nuxeo/lib/operation.js (operation.js:7)
at __webpack_require__ (bootstrap:76)
at Object../node_modules/nuxeo/lib/nuxeo.js (nuxeo.js:4)
at __webpack_require__ (bootstrap:76)
at Object../node_modules/nuxeo/lib/index.js (index.js:1)
at __webpack_require__ (bootstrap:76)
./node_modules/promise-queue/index.js @ index.js:1
__webpack_require__ @ bootstrap:76
./node_modules/nuxeo/lib/upload/batch.js @ batch.js:5
__webpack_require__ @ bootstrap:76
./node_modules/nuxeo/lib/operation.js @ operation.js:7
__webpack_require__ @ bootstrap:76
./node_modules/nuxeo/lib/nuxeo.js @ nuxeo.js:4
__webpack_require__ @ bootstrap:76
./node_modules/nuxeo/lib/index.js @ index.js:1
__webpack_require__ @ bootstrap:76
./src/app/nuxeo.service.ts @ DynamicFlatNode.ts:8
__webpack_require__ @ bootstrap:76
./src/app/app.module.ts @ app.component.ts:176
__webpack_require__ @ bootstrap:76
./src/main.ts @ environment.ts:15
__webpack_require__ @ bootstrap:76
0 @ main.ts:12
__webpack_require__ @ bootstrap:76
checkDeferredModules @ bootstrap:43
webpackJsonpCallback @ bootstrap:30
(anonymous) @ main.js:1
I have been doing the import procedure wrong, so any idea to going this problem solve?
update 1 : When we look in detail, it seems that bootstrap looking for Nuxeo module but there is nothing.
Thanks for help
03-26-2019 10:14 AM
This question is solved here https://github.com/nuxeo/nuxeo-js-client/issues/85 with a new release https://github.com/nuxeo/nuxeo-js-client/releases/tag/v3.12.0 Thanks
03-26-2019 10:14 AM
This question is solved here https://github.com/nuxeo/nuxeo-js-client/issues/85 with a new release https://github.com/nuxeo/nuxeo-js-client/releases/tag/v3.12.0 Thanks
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.