npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

smartmate-workspace-tools

v3.14.4

Published

A tools library to perform common operations with a Smartmate workspace

Downloads

26

Readme

smartmate-workspace-tools

A tools library to perform common operations with a Smartmate workspace. It's designed for programmatic usage. If you want a CLI interface, take a look at smartmate-cli instead.

Installation

Include it in your project as a dependency.

yarn add smartmate-workspace-tools or npm install --save smartmate-workspace-tools

Usage

This module provide various classes that you can use:

  • Workspace
  • App
  • Process
  • Table
  • Script

Sample usage

// - Model Workspace:

  // To initialize it:
    const Workspace = require('smartmate-app-tools').Workspace;
    const myWorkspace = new Workspace('/path/to/myWorkspacePth/');

  // To load its apps without running any kind of validation:
    await myWorkspace.load();

  // To get data validated and updated with all correct fields just run:
    await myWorkspace.validate(); // this runs method (load()) internally, so it is not necessary to run both

  // To get JSON data:
    await myWorkspace.toJSON(); // this runs method (validate()) internally, so it is not necessary to run both

  // Other available methods:

  myWorkspace.isLoaded();
  myWorkspace.getPath();
  myWorkspace.getApps();
  myWorkspace.getApp(appId);
  myWorkspace.saveAsZip();

// - Model App:

  // To initialize it:
    const App = require('smartmate-app-tools').App;
    const myApp = new App('/path/to/myAppPth/');

  // To load its models and processes without running any kind of validation:
    await myApp.load();

  // To get data validated and updated with all correct fields just run:
    await myApp.validate(); // this runs method (load()) internally, so it is not necessary to run both

  // To get JSON data:
    await myApp.toJSON(); // this runs method (validate()) internally, so it is not necessary to run both

  // Other available methods:

  myApp.isLoaded();
  myApp.getId();
  myApp.getFilePath();
  myApp.getRootDirectory(appId);
  myApp.getRawData();
  myApp.getTables();
  myApp.getProcesses();
  myApp.getTemplates();
  myApp.getTableByKey();
  myApp.getProcessByKey();
  myApp.getTemplateByKey();
  myApp.hasTables();
  myApp.hasProcesses();
  await myApp.getAllTableFields();
  await myApp.getVarsByProcess();

// - Model Table:

  // To initialize it:
    const Table = require('smartmate-app-tools').Table;
    const myTable = new Table(appId, '/path/to/myTablePth/');
  // or:
    myApp.getTableByKey(tableKey);

  // To load its yml data without running any kind of validation:
    await myTable.load();

  // To get data validated and updated with all correct fields just run:
    await myTable.validate(); // this runs method (load()) internally, so it is not necessary to run both

  // To get JSON data:
    await myTable.toJSON(); // this runs method (validate()) internally, so it is not necessary to run both

  // Other available methods:

  myTable.isLoaded();
  myTable.getKey();
  myTable.getFilePath();
  myTable.getAppId();
  myTable.getRawData();
  myTable.getFullName();
  await myTable.getFieldsWithAdditionalProperties();

// - Model Process:

  // To initialize it:
    const Process = require('smartmate-app-tools').Process;
    const myProcess = new Process(appId, '/path/to/myProcessPth/', tableFields);
  // or:
    myApp.getProcessByKey(processKey);

  // To load its yml data without running any kind of validation:
    await myProcess.load();

  // To get data validated and updated with all correct fields just run:
    await myProcess.validate(); // this runs method (load()) internally, so it is not necessary to run both

  // To get JSON data:
    await myProcess.toJSON(); // this runs method (validate()) internally, so it is not necessary to run both

// - Model BpmFile:

//  To initialize it:
    const myBpmFile = myProcess.getBPMNFile(processKey);

//  Other available methods:

  await myBpmFile.validate();
  myBpmFile.getAppId();
  myBpmFile.getFilePath();
  myBpmFile.isLoaded();
  myBpmFile.getRawXML();
  myBpmFile.getRawJSON();
  myBpmFile.toXML();
  myBpmFile.toJSON();
  myBpmFile.toBase64();

 //  if you get the bpmFile instance through your process, make sure to have called process.validate() before.
 //  Otherwise run myBpmFile.validate();

## Testing

yarn test [--watch]

In Windows, you need to set `LF` as the line ending sequence for some tests to pass. In particular those tests the verify XML in `process.spec.js`.

## Local development

To be able to install smartmate-schemas you need to configure an SSH key in Bitbucket.

See https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html