Module: serialization

Functions for serializing a webgme project or models. These will work both on the client and server.
To include in your module (e.g. Plugin) require via 'common/util/serialization'.
Important! In order to export, the state must have been persisted in the database before exporting. If you make changes with the core make sure to persist and make a commit (it could be a headless commit too) before attempting to export.

Source:

Methods

(static) exportModelsToFile(project, blobClient, parameters, callbackopt) → {Promise}

Exports a selection of models and packages them in webgmexm file which is uploaded to the blob storage.

Parameters:
Name Type Attributes Description
project ProjectInterface
blobClient BlobClient
parameters object

One of rootHash, commitHash and branchName and tagName must be given. If more than one is given, the order of precedence is: branchName, commitHash, tagName and rootHash.

Properties
Name Type Attributes Default Description
paths Array.<string>

Paths to node to export.

rootHash string <optional>

The hash of the tree root.

commitHash string <optional>

The tree associated with the commitHash.

branchName string <optional>

The tree at the given branch.

tagName string <optional>

The tree at the given tag.

withAssets boolean <optional>
false
outName string <optional>

Name of the output blob (.webgmex will be appended).

callback function <optional>
Properties
Name Type Description
err Error | null

If there was an error

result object

Data about the exported project

Properties
Name Type Description
hash string

Metadata hash to the exported webgmexm-file

downloadUrl string

Download url of the exported webgmexm-file

fileName string

The name of the exported webgmexm-file

Source:
Returns:
Type
Promise

(static) exportProjectToFile(project, blobClient, parameters, callbackopt) → {Promise}

Exports a snap-shot of the entire project-tree and uploads a webgmex-file on the blob storage.

Parameters:
Name Type Attributes Description
project ProjectInterface
blobClient BlobClient
parameters object

One of rootHash, commitHash and branchName and tagName must be given. If more than one is given, the order of precedence is: branchName, commitHash, tagName and rootHash.

Properties
Name Type Attributes Default Description
rootHash string <optional>

The hash of the tree root.

commitHash string <optional>

The tree associated with the commitHash.

branchName string <optional>

The tree at the given branch.

tagName string <optional>

The tree at the given tag.

withAssets boolean <optional>
false

Bundle the encountered assets linked from attributes.

kind string <optional>

If not given will use the one defined in project (if any).

outName string <optional>

Name of the output blob (.webgmex will be appended).

callback function <optional>
Properties
Name Type Description
err Error | null

If there was an error

result object

Data about the exported project

Properties
Name Type Description
hash string

Metadata hash to the exported webgmex-file

downloadUrl string

Download url of the exported webgmex-file

fileName string

The name of the exported webgmex-file

Source:
Returns:
Type
Promise