How to use @alfresco/js-api - 10 common examples

To help you get started, we’ve selected a few @alfresco/js-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Alfresco / alfresco-js-api / test / integration / test-node / login-ecm.ts View on Github external
async function main() {

    program
        .version('0.1.0')
        .option('--host  [type]', '')
        .option('-p, --password [type]', 'password ')
        .option('-u, --username [type]', 'username ')
        .parse(process.argv);

    let alfrescoApi: AlfrescoApi = new AlfrescoApi();

    alfrescoApi.setConfig({
        provider: 'ECM',
        hostEcm: program.host,
        authType: 'BASIC',
        contextRoot: ''
    });

    alfrescoApi.login(program.username, program.password).then(() => {
        let discovery = new DiscoveryApi(alfrescoApi);
        discovery.getRepositoryInformation().then(
            (ecmVers) => {
                console.log('ecmVers' + JSON.stringify(ecmVers));
            },
            () => {
                process.exit(1);
github Alfresco / alfresco-js-api / test / integration / test-node / login-ecm.ts View on Github external
alfrescoApi.login(program.username, program.password).then(() => {
        let discovery = new DiscoveryApi(alfrescoApi);
        discovery.getRepositoryInformation().then(
            (ecmVers) => {
                console.log('ecmVers' + JSON.stringify(ecmVers));
            },
            () => {
                process.exit(1);
            });
    }, () => {
        process.exit(1);
github Alfresco / alfresco-js-api / test / performance / test-webpack / index.ts View on Github external
constructor() {
        let alfrescoApi = new AlfrescoApi();
        alfrescoApi.setConfig({
            provider: 'ECM',
            hostEcm: 'http://localhost:3000',
            authType: 'BASIC',
            contextRoot: ''
        });

        let discovery = new DiscoveryApi(alfrescoApi);
        discovery.getRepositoryInformation().then(
            (ecmVers) => {
                console.log('ecmVers' + ecmVers);
            },
            (ecmVers) => {
                console.log('error ecmvers' + ecmVers);
            });
    }
github Alfresco / alfresco-js-api / test / performance / test-webpack / index.ts View on Github external
constructor() {
        let alfrescoApi = new AlfrescoApi();
        alfrescoApi.setConfig({
            provider: 'ECM',
            hostEcm: 'http://localhost:3000',
            authType: 'BASIC',
            contextRoot: ''
        });

        let discovery = new DiscoveryApi(alfrescoApi);
        discovery.getRepositoryInformation().then(
            (ecmVers) => {
                console.log('ecmVers' + ecmVers);
            },
            (ecmVers) => {
                console.log('error ecmvers' + ecmVers);
            });
    }
}
github Activiti / activiti-modeling-app / projects / ama-testing / src / e2e / api / acm / acm-backend.ts View on Github external
constructor(public config: TestConfig) {
        this.api = new AlfrescoApi({
            provider: 'BPMN',
            authType: config.ama.backendConfig.authType,
            oauth2: config.ama.backendConfig.oauth2
        });
    }
github Alfresco / alfresco-ng2-components / lib / testing / src / lib / process-services-cloud / actions / testing-alfresco-api.service.ts View on Github external
constructor(public appConfig: AppConfigService, public storageService: StorageService) {
        super(null, null);
        const oauth = Object.assign({}, this.appConfig.get(AppConfigValues.OAUTHCONFIG, null));
        this.storageService.prefix = this.appConfig.get(AppConfigValues.STORAGE_PREFIX, '');
        this.config = new AlfrescoApiConfig({
            provider: this.appConfig.get(AppConfigValues.PROVIDERS),
            hostEcm: this.appConfig.get(AppConfigValues.ECMHOST),
            hostBpm: this.appConfig.get(AppConfigValues.BPMHOST),
            authType: this.appConfig.get(AppConfigValues.AUTHTYPE, 'BASIC'),
            contextRootBpm: this.appConfig.get(AppConfigValues.CONTEXTROOTBPM),
            contextRoot: this.appConfig.get(AppConfigValues.CONTEXTROOTECM),
            disableCsrf: this.appConfig.get(AppConfigValues.DISABLECSRF),
            withCredentials: this.appConfig.get(AppConfigValues.AUTH_WITH_CREDENTIALS, false),
            domainPrefix: this.storageService.prefix,
            oauth2: oauth
        });
    }
github Alfresco / alfresco-ng2-components / scripts / clean-env.js View on Github external
async function main() {

    program
        .version('0.1.0')
        .option('--host [type]', 'Remote environment host adf.lab.com ')
        .option('-p, --password [type]', 'password RANCHER')
        .option('-u, --username [type]', 'username RANCHER')
        .parse(process.argv);

    this.alfrescoJsApi = new alfrescoApi.AlfrescoApiCompatibility({
        provider: 'ECM',
        hostEcm: program.host
    });

    try {
        await this.alfrescoJsApi.login(program.username, program.password);
    } catch (error) {
        console.log(JSON.stringify(error));
    }

    console.log('====== Clean Root ======');
    await cleanRoot(this.alfrescoJsApi);

    console.log('====== Clean Sites ======');
    await deleteSite(this.alfrescoJsApi);
github Alfresco / alfresco-ng2-components / lib / core / services / content.service.spec.ts View on Github external
it('should hasAllowableOperations return false if no permission parameter are passed', () => {
            const permissionNode = new Node({ allowableOperations: ['delete', 'update', 'updatePermissions'] });
            expect(contentService.hasAllowableOperations(permissionNode, null)).toBeFalsy();
        });
github Alfresco / alfresco-ng2-components / lib / process-services / src / lib / content-widget / attach-file-widget-dialog.component.spec.ts View on Github external
it('should be able to select a file', (done) => {
            data.selected.subscribe((nodeList: Node[]) => {
                expect(nodeList[0].id).toBe('fake');
                expect(nodeList[0].isFile).toBeTruthy();
                done();
            });
            const fakeNode: Node = new Node({ id: 'fake', isFile: true});
            contentNodePanel.componentInstance.select.emit([fakeNode]);
            fixture.detectChanges();
            fixture.whenStable().then(() => {
                const chooseButton: HTMLButtonElement = element.querySelector('button[data-automation-id="attach-file-dialog-actions-choose"]');
                chooseButton.click();
            });
        });
github Alfresco / alfresco-ng2-components / lib / core / services / content.service.spec.ts View on Github external
it('should havePermission works in the opposite way with negate value', () => {
            const permissionNode = new Node({ permissions: { locallySet: [{ name: 'collaborator' }, { name: 'consumer' }] } });
            expect(contentService.hasPermissions(permissionNode, '!manager')).toBeTruthy();
        });