Methods
(inner) deregisterAPI(apiRef, data)
Deregister an API defined by an extension definition objects.
Name | Type | Description |
---|---|---|
apiRef | object | reference to the rosetta api object |
data | Array | a JSON objects representing a custom API that have been registered. See registerAPI data parameter for schema. |
An error if the deregister failed.
(inner) deregisterAPIs(apiRef, dataArray) → {Array}
Deregister APIs from an array of JSON API extension definition objects.
Name | Type | Description |
---|---|---|
apiRef | object | reference to the rosetta api object |
dataArray | Array | an array of JSON objects, each representing a custom APIs that have been registered. See registerAPI data parameter for schema. |
An array of errors indicating any APIs that failed to deregister. An empty array if all were successful.
- Type:
- Array
(inner) generateTernDefsForCustomAPIs(apiRef, dataArray, config) → {Object}
Generate Tern definitions for a set of custom APIs. The Tern definitions can be used for intellisense support.
Name | Type | Description |
---|---|---|
apiRef | Object | reference to the rosetta API object tree where to register the method. |
dataArray | Array | an array of JSON objects, each representing a custom API to register. See registerAPI data parameter for schema. |
config | Object | contains the name for the api definitions and the name for the formula definitions. |
An object containing a property 'API' for the Rosetta API Tern defintions. If the lang parameter is 'notes' or 'open formula' in any of the custom definition objects, then the property 'Formula' will contain the formula Tern definitions.
- Type:
- Object
(inner) getActionEventObject() → {*}
Volt MX framework based API: getActionEventObject; Gets the Action Event Object
Error object with string representing the failure message
- Type
- Object
The current Action Event Object
- Type:
- *
(inner) getCurrentServerDatabase() → {String}
Volt MX framework based API: getCurrentServerDatabase; Get the server location and file name being used under the VoltMX API layer
Error object with string representing the failure message
- Type
- Object
The server location and file name of the database under the VoltMX API layer
- Type:
- String
(inner) getCurrentServiceName() → {String}
Volt MX framework based API: getCurrentServiceName; Gets the current service name being used under the VoltMX API layer
Error object with string representing the failure message
- Type
- Object
The current service name under the VoltMX API layer
- Type:
- String
(inner) getDefaultAPI() → {string}
Set getDefaultAPI
the default API currently set
- Type:
- string
(inner) getDefaultContext() → {string}
Get default context
the currently set default context (all|local|db)
- Type:
- string
(inner) getDefaultFramework() → {string}
Get default framework
default framework (JS or VMX)
- Type:
- string
(inner) getDefaultServiceType() → {String}
Volt MX framework based API: getDefaultServiceType; returns the default service type under the VoltMX API layer expressed as a string
Error object with string representing the failure message
- Type
- String
The default service type under the VoltMX API layer
- Type:
- String
(inner) getServiceType(serviceName) → {string}
getServiceType
Name | Type | Description |
---|---|---|
serviceName | string | for the Volt MX Object Service |
the service type for the specified service
- Type:
- string
(inner) getTernFileNames() → {Object}
Get the names for the Tern files generated for the Rosetta API.
The names of the tern file definitions generated for the Rossetta API. Keys are "API" for the Rosetta javascript API, "Notes" for the Notes formula, and "OpenFormula" for OpenFormula.
- Type:
- Object
(inner) isCurrentAPINotes() → {boolean}
Is current API Notes.
True if the current API is set to Notes; false otherwise
- Type:
- boolean
(inner) isCurrentAPIOpenFormula() → {boolean}
Is current API Open Formula.
True if the current API is set to Open Formula false otherwise
- Type:
- boolean
(inner) isCurrentContextAll() → {boolean}
Is current context all?
true if the current context is set to all; false otherwise
- Type:
- boolean
(inner) isCurrentContextDb() → {boolean}
Is current context database?
true if the current context is set to db; false otherwise
- Type:
- boolean
(inner) isCurrentContextLocal() → {boolean}
Is current context local?
true if the current context is set to local; false otherwise
- Type:
- boolean
(inner) isCurrentFrameworkDRAPI() → {boolean}
Is current framework Javascript.
True if the current framework is set to js; false otherwise
- Type:
- boolean
(inner) isCurrentFrameworkJS() → {boolean}
Is current framework Javascript.
True if the current framework is set to js; false otherwise
- Type:
- boolean
(inner) isCurrentFrameworkVoltMX() → {boolean}
Is current framework Volt MX.
True if the current framework is set to vmx; false otherwise
- Type:
- boolean
(inner) isCurrentServiceTypeIntegration() → {Boolean}
Volt MX framework based API: isCurrentServiceTypeIntegration; Is current service type "integration"?
Error object with string representing the failure message
- Type
- Object
true if the current service type is set to integration
- Type:
- Boolean
(inner) isCurrentServiceTypeOfflineObjects() → {Boolean}
Volt MX framework based API: isCurrentServiceTypeOfflineObjects; Is current service type "object.offline"?
Error object with string representing the failure message
- Type
- Object
true if the current service type is set to object.offline
- Type:
- Boolean
(inner) isCurrentServiceTypeOnlineObjects() → {Boolean}
Volt MX framework based API: isCurrentServiceTypeOnlineObjects; Is current service type "object.online"?
Error object with string representing the failure message
- Type
- Object
true if the current service type is set to object.online
- Type:
- Boolean
(inner) parseCustomData(data) → {object}
Parse information from an object defining an extened API.
Name | Type | Description |
---|---|---|
data | object | object defining the extended API. |
Information about the extended API defined by data. The following keys will be returned: name, namef, funcArgs, cat, lang, and code. The any optional settings in data will be resolved to values in the returned object. funcArgs will contain any arguments defined for name.
- Type:
- object
(inner) registerAPI(apiRef, data) → {Object}
Register an API by adding it as an object to the referential array of APIs Defines/redefines the Rosetta API library by creating/updating a node in the API object The API object may be redefined if when using the existing category, name, language combination If language param is supplied, the API node will also define the method at the formula language level and the main method will point to call the method inside the language object
Name | Type | Description |
---|---|---|
apiRef | Object | required. reference to the rosetta API object tree where to register the method. |
data | Object | required. object defining the extended API. object props as follows:
|
Error object string representing registration failure
- Type
- String
the return value from registerCustomAPI
- Type:
- Object
// code as actual js arrow function object, default params for the rest
// defines <rosettaObj>.Custom.hello = s => alert(`hello $(s)}`)
registerAPI(
apiRef:rosettajs,
{
"name":"hello(s)",
"code": s => alert(`hello $(s)}`)
}
);
// code as actual js function object,
// defines <rosettaObj>.Text.hello(args...) -> .Text._notes.Hello_Test(args...) = function(name) { return "hello " + name; }
registerAPI(
apiRef:rosettajs,
{
"name": "hello(name)",
"cat": "Text",
"lang": "notes",
"namef": "Hello_Test",
"code": function(name) { return "hello " + name; }
}
);
// code as stringified js function body,
// defines <rosettaObj>.Text.hellop(args...) -> .Text._notes.HelloPhone_Test(args...) = function(name,phone) { return `hello ${name}. phone is ${phone}` }
registerAPI(
apiRef:rosettajs,
{
"name": "hellop(name,phone)",
"cat": "Text",
"lang": "notes",
"namef": "HelloPhone_Test",
"code": "{ return `hello ${name}. phone is ${phone}` }"
}
// code as stringified notes formula code (gets auto-converted to rosettajs),
// defines <rosettaObj>.Custom.myAbs -> .Custom._notes.myAbs(args...) = n => { return rosettajs.Math.abs(n)+10 }`)
registerAPI(
apiRef:rosettajs,
{
"name":"myAbs(n)",
"code": "@Abs(n)+10;"
}
);
// code as stringified open formula code (gets auto-converted to rosettajs),
// defines <rosettaObj>.Custom.myAbs -> .Custom._openFormula.MYABS(args...) = n => { return rosettajs.Math.abs(n)+10 }`)
registerAPI(
apiRef:rosettajs,
{
"name":"myAbs(n)",
"namef": "MYABS"
"code": "=ABS(n)+10;"
}
);
(inner) registerAPIs(apiRef, dataArray) → {Array}
Register APIs from an array of JSON API extension definition objects. Each object in the array must adhere to schema required in registerAPI method
Name | Type | Description |
---|---|---|
apiRef | String | required. reference to the rosetta api object tree |
dataArray | Array | an array of JSON objects, each representing a custom API to register. See registerAPI data parameter for schema. |
Error object string representing registration failure
- Type
- String
Array of callbacks for the API methods registered
- Type:
- Array
registerAPI(
apiRef:rosettajs,
[
{ // defines: <rosettajs>.Custom.simplest = () => { }
"name": "simplest"
},
{ // defines: <rosettajs>.Text.simpler = () => { }
"name": "simpler",
"cat": "Text",
},
{ // defines: <rosettajs>.Text.simple = function(x) { return x+1; }
"name": "simple(x)",
"cat": "Text",
"code": function(x) { return x+1; }
},
{ // defines: <rosettajs>.Text.simple = function(x) { this._notes.simple(): function(x) { return x+1; } }
"name": "simpleNotes(x)",
"cat": "Text",
"lang": "notes",
"code": function(x) { return x+1; }
},
{ // defines: <rosettajs>.Text.simple = function(x) { this._notes.ADVanceNOTES123(): function(x) { return x+1; } }
"name": "advancedNotes(x)",
"cat": "Text",
"lang": "notes",
"namef": "ADVanceNOTES123",
"code": function(x) { return x+1; }
},
{
"cat": "Text",
"name": "hello(name)",
"lang": "notes",
"namef": "Hello",
"code": function(name) { return "hello " + name; }
},
{
"name": "goodbye(name)",
"lang": "notes",
"cat": "Text",
"code": function(name) { return "bye bye " + name; }
},
{ // defines: <rosettajs>.Custom.weather = function(x) { this._openFormula.WEATHER(): function(zip) { return "Sunny in " + zip; } }
"name": "WEATHER(zip)",
"lang": "open formula",
"cat": "Custom",
"code": function (zip) { return "Sunny in " + zip; }
},
{ // defines: <rosettajs>.Custom.absPlusX = function(n,x) { this._notes.absPlusX(): javascript conversion result from "@Abs(n)+x" }
"name": "AbsPlusX(n; x)",
"lang": "notes",
"cat": "Custom",
"code": "@Abs(n)+x;"
}
]
);
(inner) rosettajsLogger() → {*}
Volt MX framework based API: rosettajsLogger; returns the logger object under the VoltMX API layer
Error object with string representing the failure message
- Type
- String
The rosettajs logger object under the VoltMX API layer
- Type:
- *
(inner) setActionEventObject(eventobject)
Volt MX framework based API: setActionEventObject; Sets the Action Event Object
Name | Type | Description |
---|---|---|
eventobject | * | The Action Event Object used by Action Widgets. |
Error object with string representing the failure message
- Type
- Object
(inner) setCurrentServerDatabase(serverDatabase)
Volt MX framework based API: setCurrentServerDatabase; Sets the server location and file name to be used under the VoltMX API layer
Name | Type | Description |
---|---|---|
serverDatabase | * | The server location and file name of the database. |
Error object with string representing the failure message
- Type
- Object
(inner) setDefaultAPIAsNotes() → {string}
Set default API to Notes when an underlaying Open Formula API function with the same name exists.
The default API
- Type:
- string
(inner) setDefaultAPIAsOpenFormula() → {string}
Set default API to Open Formula when an underlaying Notes API function with the same name exists.
The default API
- Type:
- string
(inner) setDefaultContextAsAll() → {string}
Set default context to all
The default context
- Type:
- string
(inner) setDefaultContextAsDb() → {string}
Set default context to db
The default context
- Type:
- string
(inner) setDefaultContextAsLocal() → {string}
Set default context to local
The default context
- Type:
- string
(inner) setDefaultFrameworkAsDRAPI() → {string}
Set default framework to drapi
The default framework
- Type:
- string
(inner) setDefaultFrameworkAsJS() → {string}
Set default framework to javascript
The default framework
- Type:
- string
(inner) setDefaultFrameworkAsVoltMX() → {string}
Set default framework to voltmx
The default framework
- Type:
- string
(inner) setDefaultServiceTypeAsIntegration() → {String}
Volt MX framework based API: setDefaultServiceTypeAsIntegration; Sets the default service type to "integration", under the VoltMX API layer
Error object with string representing the failure message
- Type
- Object
The default service type
- Type:
- String
(inner) setDefaultServiceTypeAsOfflineObjects() → {String}
Volt MX framework based API: setDefaultServiceTypeAsOfflineObjects; Sets the default service type to "object.offline", under the VoltMX API layer
Error object with string representing the failure message
- Type
- Object
The default service type
- Type:
- String
(inner) setDefaultServiceTypeAsOnlineObjects() → {String}
Volt MX framework based API: setDefaultServiceTypeAsOnlineObjects; Sets the default service type to "object.online", under the VoltMX API layer
Error object with string representing the failure message
- Type
- Object
The default service type
- Type:
- String
(inner) setServiceTypeAsOfflineObjects(serviceName) → {string}
setServiceTypeAsOfflineObjects(serviceName)
Name | Type | Description |
---|---|---|
serviceName | string | for the Volt MX Object Service |
the service type for the specified service
- Type:
- string
(inner) setServiceTypeAsOnlineObjects(serviceName) → {string}
setServiceTypeAsOnlineObjects(serviceName)
Name | Type | Description |
---|---|---|
serviceName | string | for the Volt MX Object Service |
the service type for the specified service
- Type:
- string