db._svc.PackagingService

Functionality around building, installing, versioning Noonian packages.

installBootstrapPackages()

Install packages identified in configuration “bootstrap”

Returns

Promise – resolving when package is complete

Tracking Updates for Package Content

updateLogger(isCreate, isUpdate, isDelete)

Create an UpdateLog entry for an update. If filesystem sync is enabled, write files for the object

Arguments
  • isCreate (boolean) –

  • isUpdate (boolean) –

  • isDelete (boolean) –

Returns

Promise – resolving when operations are complete

importObject(className, obj, pacakgeRef)

Import a plain json object (originating from a package or file) into db, with special handling of BusinessObjectDef’s and versioning. (used by both fs_sync and pkg_stream)

Arguments
  • className (string) –

  • obj (object) –

  • pacakgeRef – reference to BusinessObjectPackage on who’s behalf this object is being imported; if not present, no version checking will occur

Returns

Promise.<BusinessObject> – the created/updated object

packageToFs(bopId)

Exports a package’s objects to filesystem, to begin filesystem sync and allow for collaboration/source control in git

Arguments
  • bopId (string) – id of BusinessObjectPackage

Returns

Promise – resolving when export is complete

Processing Package Streams

checkPackage(metaObj, inProgress)

Check the package metaObj against the current sytem.

How the noonian dependency summary is built: configured RemotePackageRepositories are queried to obtain metadata objects for all of the package’s noonian dependencies. Then those objects are recursively checked, and the tree of results are flattened into a list, sorted in the order that they should be installed.

Arguments
  • metaObj (object) – metadata object from the BusinessObjectPackage

  • inProgress – used for tracking recursive calls

Returns

object – summary describing the package - basic package info (key, name, desc, version) - installed version of that pkg (if applicable) - parameters requested by package to be collected from user on install - list of dependencies for npm, bower, and noonian - list of check results of noonian depenencies

getPackageMetadataFromStream(pkgReadStream)

Pull metadata element from Noonian package JSON stream; ignoring all other stream content

Arguments
  • pkgReadStream (stream.Readable) – Noonian package JSON stream

Returns

Promise.<object> – the metadata object

checkPackageStream(pkgReadStream)
Read package metadata from pkg stream and:
  1. check its dependencies against what is installed

  2. resolve to the user_parameters

Arguments
  • pkgReadStream (stream.Readable) – Noonian package JSON stream

Returns

Promise.<object> – the metadata object

installPackage(pkgReadStream, userParams, skipDep)

Install the package (and its dependencies) to this instance from json stream

Arguments
  • pkgReadStream – node readable stream of package json

  • userParams – object containing parameters to be passed to pacakges’ install functions keyed by package key

  • skipDep – skip dependency check/installation (mainly for use in recursive calls)

Returns

Promise.<{{result, metaObj, dependencyResults, recursiveResults, functionResults}}>

buildPackage(bopId, majorMinorPatch)
Run against a BusinessObjectPackage (BOP) record;
  • builds the package file, incorporating all UpdateLog’s associated w/ the BOP

  • stores it in gridfs, sets as package_file attachment to BOP

  • updates manifest and increments minor version on BOP record

Arguments
  • bopId (string) – id of BusinessObjectPackage

  • majorMinorPatch – which version component to increment

Returns

Promise<string> gridfs file id of generated package