ucs-plugin-common

UCS common tools

Usage no npm install needed!

<script type="module">
  import ucsPluginCommon from 'https://cdn.skypack.dev/ucs-plugin-common';
</script>

README

PackageHelper

Allows to handle with PULS publication package

There is many useful methods for retrieving common properties, raw as well as prepared earlier.

UcsMailer

UCSMailer allows to send emails from UCS services.

Currently it's possible to send mail about:

  • notification with subject and short content
  • theme deployment
  • configuration deployment

If you want to use your custom template, just add your template and TemplateProcessor.

Example (notification template):

var message = "The latest, 2nd edition of the UCS is probably the most significant update since the first version in 1997. The main goal of the latest release has been to provide a better support for creating larger applications and libraries. This means a more mature syntax, new shortcuts to make coding easier, and also new methods, keywords, data types, and many other enhancements. UCS documentation is extensive, if you like to read a lot, just read your favorite book, because unfortunately there is no time to maintain documentation for UCS. :(";

var mailConfig = {
    receivers: "csp@lst.onet.",
    template: UcsMailer.Templates.INFORMATION,
    data: {
        subject: "UCS 3.0 is coming!",
        content: message
    }
};

var mailer = new UcsMailer(mailConfig);
mailer.send(function (err) {
    if (err) {
        // oh no!
    }
});

FtsHelper

Allows to "low-level" communication with the SOLR core used by UCS services.

UcsTestHelper

Standalone module for mocking the UcsLogger during UCS services development.

If you want to stub UcsLogger, just paste this file in tests/helpers and call $UcsHelper.prepareTests();

NamespaceHelper

Allows to load and process configuration of namespace

Example (get namespace settings from cache/db)


NamespaceHelper.getNamespaceSettings('1442905460988', function(error, data){
    console.log('NamespaceSettings', error, JSON.stringify(data));
})