README
Dreamtsoft node extender
Running extender
Initial run (if you not paired)
dir> cd /code/ds-extender dir> node ./Extender.js Extender not setup, please run: Extender --pair
Pair to site
dir> cd /code/ds-extender dir> node ./Extender.js --pair https://mysite.dreamtsoft.com
Once the pairing process has started, go into your site to see status
- System bundle
- General
- Data services
- General
Normal starting after paired
dir> cd /code/ds-extender dir> node ./Extender.js
Making extender do stuff
In order to make the extender execute commands, you need to setup 4 things
- Make sure extender is paired and online
- Create a
Script data store
that defines the script to the system - Put the phyiscal script in the
work/
directory - Related the
Script data store
to the extender dataservice record
Script data store
Script data store tells the system what the script name is (and location), what schema (slots) is expected to exist on the rows
You can access script data stores by going to the Data store bucket
- Bundle configuration (gears)
- Bucket management
- Data stores
- Bucket management
Put script in work directory
Create your js script in your extenders work directory, for example:
/code/ds-extender/work/MyScript.js
Relating data store to data service record
Can be done data store screen or the data service screen
Navigate to your data service
- System bundle
- General
- Data services
- General
And click on your extender. On the lower part of the screen you'll see the "Installed scripts" section. You can use the relationship editor to relate the Script data store
to your dataservice
record.
Example extender script
MyScript.js
module.exports = class MyMapper {
start() {
// this function will get called on startup of the extender
// can be used to setup background work
setInterval(this.check.bind(this), 30000);
}
check() {
}
// FRecord.insert
insert() {
return [];
}
// FRecord.update
update() {
return [];
}
// FRecord.del
del() {
return [];
}
// FRecord.search
search(search) {
return [ { "my_field": "aaa" } ];
}
// FRecord.api
api(apiName, data) {
if (api == "my_name") {
return [
{ field: "a", valid: true },
{ field: "b", valid: 0 }
];
}
return [];
}
}