New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aem-api

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aem-api

API class to manipulate nodes within AEM from node.

0.2.4
latest
Source
npm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

node-aem-api

Warning this is under development. Tests are sparse or incomplete. Use at your own peril.

Installation

npm install --save-dev aem-api

Usage

Initialize and instance of aem-api with you credentials, then call any of the listed methods. They will all return a promise.

const AEM = require('aem-api');

const aem = new AEM('http://localhost', 4502, 'admin', 'admin');

aem.createNode('/tmp/myNode')
  .then(_ => {
    console.log('Node successfully created')
  })
  .catch(e => {
    console.error('Problem creating node', e);
  })

Best Practises

This api returns promises by design even a synchronous response would suffice for ease of use, mainly with generators in mind. With this, it is recommended to use generators where possible for cleaner more readable code.

const AEM = require('aem-api');

const aem = new AEM('http://localhost', 4502, 'admin', 'admin');

const runner = function *() {
  const myNode = yield aem.createNode('/tmp/myNode');
  
  yield myNode.activate();
  
  console.warn(`Created my node and activated it, yay, pub o'clock?`);
}

Todo

  • Change almost all response that return a promise to the http response. They're pretty much useless and should remain "behind closed doors". You only want a node object to mess with or an error. Then promise chaining becomes a lot more viable.
  • Tests
  • Economise on http requests where possible (Node#getProperties i'm looking at you...)
  • Ability to lock and unlock nodes

API

HTML documentation can be viewed here

FAQs

Package last updated on 11 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts