3.14.4 • Published 3 years ago

smartmate-workspace-tools v3.14.4

Weekly downloads
314
License
UNLICENSED
Repository
bitbucket
Last release
3 years ago

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
3.14.3

3 years ago

3.14.4

3 years ago

3.14.2

3 years ago

3.14.1

3 years ago

3.13.3

3 years ago

3.13.2

3 years ago

3.13.1

3 years ago

3.12.2

4 years ago

3.12.1

4 years ago

3.11.12

4 years ago

3.11.11

4 years ago

3.11.10

4 years ago

3.11.9

4 years ago

3.11.8

4 years ago

3.11.7

4 years ago

3.11.6

4 years ago

3.11.4

4 years ago

3.11.5

4 years ago

3.11.3

4 years ago

3.11.2

4 years ago

3.11.1

4 years ago

3.10.3

4 years ago

3.10.2

4 years ago

3.10.1

4 years ago

3.9.1

4 years ago

3.8.5

4 years ago

3.8.4

4 years ago

3.8.3

4 years ago

3.8.2

4 years ago

3.8.1

4 years ago

3.7.1

4 years ago

3.6.2

4 years ago

3.6.1

4 years ago

3.5.1

4 years ago

3.4.1

4 years ago

3.3.3

4 years ago

3.3.2

4 years ago

3.3.1

4 years ago

3.2.6

4 years ago

3.2.5

4 years ago

3.2.4

4 years ago

3.2.3

4 years ago

3.2.2

4 years ago

3.2.1

4 years ago

3.1.1

4 years ago

3.0.34

4 years ago

3.0.33

4 years ago

3.0.32

4 years ago

3.0.31

4 years ago

3.0.30

4 years ago

3.0.29

4 years ago

3.0.28

4 years ago

3.0.27

4 years ago

3.0.25

4 years ago

3.0.26

4 years ago

3.0.23

4 years ago

3.0.24

4 years ago

3.0.22

4 years ago

3.0.21

4 years ago

3.0.20

4 years ago

3.0.18

4 years ago

3.0.19

4 years ago

3.0.17

4 years ago

3.0.16

4 years ago

3.0.15

4 years ago

3.0.14

4 years ago

3.0.13

4 years ago

3.0.12

4 years ago

3.0.11

4 years ago

3.0.10

4 years ago

3.0.8

4 years ago

3.0.7

4 years ago

3.0.9

4 years ago

3.0.6

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.5

4 years ago

3.0.1

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

1.0.63

4 years ago

1.0.62

4 years ago

1.0.61

4 years ago

1.0.60

4 years ago

1.0.59

4 years ago

1.0.58

4 years ago

1.0.57

4 years ago

1.0.56

4 years ago

1.0.55

4 years ago

1.0.54

4 years ago

1.0.53

4 years ago

1.0.52

4 years ago

1.0.51

4 years ago

1.0.50

4 years ago

1.0.49

4 years ago

1.0.48

4 years ago

1.0.47

4 years ago

1.0.46

4 years ago

1.0.45

4 years ago

1.0.44

4 years ago

1.0.43

4 years ago

1.0.42

4 years ago

1.0.41

4 years ago

1.0.40

4 years ago

1.0.39

4 years ago

1.0.38

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago