First: GET /sync Then create the PATCH document
Install Node.JS and install globally via NPM:
npm install -g zeysdk
zeysdk create <IDENTIFIER> --name=<NAME>
Creates a new ZeyOS Application Manufest and creates the application's directory structure:
/<appidentifier>
|- /resources
|- /services
|- /settings
| |- defaultsettings.json
| |- settings.json
|- /weblets
|- zeysdk.package.json
|- zeysdk.assets.json
|- zeysdk.sync.json
zeysdk add <ASSET_CLASS> <FILENAME>
: Add an asset, e.g.zeysdk add service test.ixml
zeysdk update <ASSET_CLASS> <FILENAME>
: Update the asset properiteszeysdk remove <ASSET_CLASS> <FILENAME>
: Remove an assets (will be deleted after sync)zeysdk rename <ASSET_CLASS> <OLD_FILENAME> <NEW_FILENAME>
: Renames a resource
There are three types of asset classes:
- resource
- service
- weblet
zeysdk add weblet picklist.ixml --view=billing.details_transaction --name="Picking List" --type=detached
name
: The service name (mandatory)type
: The service type (mandatory); Options:timing
: Service is called periodically (requires propertiesschedule
andinterval
)remotecall
: Service is called via HTTPafter_creation
: Triggered after an object is created (requires propertyentity
)before_modification
: Triggered before an object is modified (requires propertyentity
)after_modifivation
: Triggered after an object is modified (requires propertyentity
)after_creation_modification
: Triggered after an object is created or modified (requires propertyentity
)before_deletion
: Triggered before an object is deleted (requires propertyentity
)after_deletion
: Triggered after an object is deleted (requires propertyentity
)
schedule
: The daily starting point as minute of the day (e.g. 16:30 = 16.5 * 60 = 990); only applicable and mandatory for typetiming
interval
: The interval my minute in which the service should be called (e.g. 10 means every ten minutes); only applicable and mandatory for typetiming
entity
: The ZeyOS entity class. For options, see List of ZeyOS Entities; only applicable and mandatory for typesafter_creation
,before_modification
,after_modifivation
andafter_creation_modification
.accesskey
: The services security access key; optional; only applicable for typeremotecall
(optional)url
: The service url - can be used when working with external hooks and scripts.
name
: The weblet nametype
: The weblet type (mandatory). Options:integrated
: Weblet will be visible blow the ZeyOS menu barstandalone
: Weblet is standalone and not embedded within the ZeyOS UIdetached
: Weblet is standalone and will be opened in a new tab/windowpopup_framed
: Weblet will be display in a popup including title bar. (required propertieswidth
andheight
)popup_plain
: Weblet will be display in a plain popup without title bar. (required propertieswidth
andheight
)embedded_framed
: Weblet will be displayed within an open panelembedded_collapsed
: Weblet will be displayed within a closed panelembedded_plain
: Weblet will be display within a plain iFrame without encloding panel
view
: The ZeyOS view that should be expanded (mandatory). For options, see List of ZeyOS Viewswidth
: The popup widthheight
: The popup heighturl
: The service url - can be used when working with external hooks and scripts.
name
: The resource name (mandatory)
Add a new service:
zeysdk add service sendreminder.ixml --name="Send reminders" --type=timing --schedule=600 --interval=60
Update the service properties:
zeysdk update service sendreminder.ixml --type=after_creation --entity=contacts
Note: When a service type changes, obsolete properties will be removed from zeysdk.assets.json
, e.g. in this case schedule
and interval
would be removed.
Rename a service:
zeysdk rename service sendreminder.ixml notifycontact.zy
zeysdk link <INSTANCE_ID>
: Create/update a platform linkzeysdk unlink <INSTANCE_ID>
: Remove a platform linkzeysdk use <INSTANCE_ID>
: Switch between linked instanceszeysdk whoami
: Show information about the active platform link
--url
: The ZeyOS URL; if no URL is supplied, the default URL ishttps://cloud.zeyos.com/<INSTANCE_ID>/
--user
: The ZeyOS user name--password
: The user's password
When you work on your application, you will require a ZeyOS platform as testing and development
environment. For this purpose, you will need to link your application with a ZeyOS instance.
Since you might want to deploy your application on multiple instances, you can also
specify an instance ID in order to switch between instances via zeysdk use
.
Every time you create a new instance, a new instance configuration is created in zeysdk.sync.<instanceid>.json
. The currently active instance configuration is stored in zeysdk.sync.json
.
zeysdk run <ASSET_CLASS> <FILENAME>
Runs a given iXML or Zymba script in the platform's console. This means that the code is not executed locally on your machine, but runs on your ZeyOS development machine.
zeysdk compare [<FILENAME1> <FILENAME2> ...]
zeysdk sync [<FILENAME1> <FILENAME2> ...]
zeysdk push [<FILENAME1> <FILENAME2> ...]
zeysdk pull [<FILENAME1> <FILENAME2> ...]
compare
: Only compares the client side with the server side. No changes will be transferredsync
: New files will replace old files on both sides - local and remote.push
: Push local changes to the server - server changes will be overwrittenpull
: Pull changes from the server - local changes will be overwritten
If a conflict arises, the SDK will offer you to create a set of files with the suffix .mine
and .theirs
so that you can use an external merge application to resolve the conflict.
When using the SDK, you will notice that a couple of configuration files are being created:
- The
zeysdk.package.json
, containing all relevant information about your app - The
zeysdk.assets.json
, referencing the individual files in your app - The
zeysdk.sync.json
which stores file sync states with your ZeyOS platforms
We highly recommend using the SDK's interface to edit those file and restrain from editing them directly.
However, in some cases you might want to automate certain tasks through additional scripts and task runners - in such cases it is certainly useful to have a better understanding about the underlying file structure and properties.
BE CAREFUL WHEN MANIPULATING THE SYNC STATES, YOU ARE PUTTING YOUR SYSTEM INTEGRITY AT RISK!
The zeysdk.package.json
describes the application's properties
{
"identifier": "mydemoapp",
"signature": "fhe734e9feznc94zm9",
"name": "Demo Application",
"description": "A sample ZeyOS application",
"author": {
"name": "ZeyOS, Inc.",
"email": "[email protected]",
"id": "zeyos",
"homepage": "https://www.zeyos.com"
},
"repository": "https://github.com/zeyosinc/sdkdemo.git"
}
The manifest file consists of the following sections:
The identifier
property also defines the applications namespace.
The signature
is for all apps that are approved and sigend by ZeyOS.
Simply put a short descriptive name
(< 64 characters) and description
(< 512 characters) in here.
Your company name, e-mail, author ID (if registered with ZeyOS), homepage
Link to the Git repository
The zeysdk.assets.json
represents the properties of all included assets, for example
{
"resources": {
"test": {
"mimetype": "application/ixml+xml"
},
"template": {
"mimetype": "text/html"
}
},
"services": {
"api": {
"mimetype": "text/x-zymba",
"type": "remotecall",
"accesskey": "orhf984ht48"
},
"check_contact": {
"mimetype": "application/ixml+xml",
"type": "after_modification_creation",
"entity": "contacts"
}
},
"weblets": {
"chart": {
"mimetype": "application/ixml+xml",
"type": "popup_framed",
"width": 500,
"height": 400
}
}
}
The zeysdk.sync.json
file is created whenever you are syncing an application with a ZeyOS instance.
The instance configuration stores the authentication information when executing zeysdk link <instanceid>
. By using zeysdk use <instanceid>
a user can switch between different instances.
Example
{
"id": "sdkdemo",
"url": "https://cloud.zeyos.com/sdkdemo/"
"user": 2,
"application": null,
"token": "ee0b44835f52cfe8a53c46f963f9badb2cc8eaa9",
"identifier": "ZeySDK",
"expdate": null,
"syncstates": {
"settings": {
"hash": "9p843rsdufh983f98ef",
"lastmodified": 4389574398534435
},
"defaultsettings": {
"hash": "9p843rsdufh983f98ef",
"lastmodified": 4389574398534435
},
"resources": {
"test": {
"hash": "9p843rsdufh983f98ef",
"lastmodified": 4389574398534435
},
"template": {
"hash": "9p843rsdufh983e78sf",
"lastmodified": 4389574398534435
}
},
"services": {
"api": {
"hash": "9p843rsdufh983e78sf",
"lastmodified": 4389574398534435
}
},
"weblets": {}
}
}
As you can see in the example, the file consists of two core sections:
- The connection settings, including token, URL, etc.
- The sync states for settings, resources, services and weblets
The connection consisting of the platform URL and the authentication token.
Those settings are being updated, whenever you run zeysdk link
in your application
directory.
The sync states for settings, resources, services and weblets consist of the
file name and the sync state on the server.
The lastmodified
property is the timestamp of the last modification date.
The hash
value is the hash of the file contents.
If the lastmodified
and hash
properties are empty, it means that the sync state is unknown,
e.g. when an new file has been created. In our example, the service called api
has
no sync state on the server.
This could lead to the following situations when syncing:
- The file does not exist on the server - in this case it will be created
- The file exists on the server - this would lead to a conflict
- The file can be replaced on the client (Resolution method: theirs)
- The file can be replaced on the server (Resolution method: mine)
If the lastmodified
and hash
properties exist, it will be compared with the server's current state.
This could lead to the following situations when syncing:
- The file does not exist on the server - this would lead to a conflict
- The file can be removed on the client (Resolution method: theirs)
- The file can be created on the server (Resolution method: mine)
- The file exists on the server and
lastmodified
/hash
does not equal the last known sync state - this would lead to a conflict- The file can be replaced on the client (Resolution method: theirs)
- The file can be replaced on the server (Resolution method: mine)
- The file exists on the server and
lastmodified
/hash
equals the last known sync state - in this case, the file will be copied to the server.