k2-javascript-broker-intellisense README
Visual Studio Code plugin for intellisense and code completion for K2 Javascript Service Provider (JSSP).
Features
Generates code for metadata
metadata = {
"systemName": "Sample Broker",
"displayName": "sample",
"description": "",
"configuration": {
"configKey": {
displayName: "configKey",
type: "string",
value: "https://www.myurl.com",
}
}
};
ondescribe Code Generation
Generates code for ondescribe
ondescribe = async function(): Promise<void> {
postSchema({
objects: {
"object1": {
displayName: "object1",
description: "",
properties: {
"prop1": { displayName: "prop1", description: "", type: "attachment", extendedType: "k2.com/2019/image" },
},
methods: {
"method1": {
displayName: "method1",
description: "",
type: "list",
parameters: {
"param1": { displayName: "param1", description: "", type: "string" },
},
requiredParameters: [""],
inputs: [""],
requiredInputs: [""],
outputs: [""],
},
},
},
},
});
}
onexecute Code Generation
Generates basic code for onexecute and child functions
onexecute = async function ({objectName, methodName, parameters, properties, configuration}): Promise<void> {
switch (objectName) {
case "object1": await onexecuteObject(methodName, parameters, properties, configuration); break;
default: throw new Error("The object " + objectName + " is not supported.");
}
}
async function onexecuteObject(methodName: string, parameters: SingleRecord, properties: SingleRecord, configuration: SingleRecord): Promise<void> {
switch (methodName) {
case "method1": await onexecuteMethod(parameters, properties, configuration); break;
default: throw new Error("The method " + methodName + " is not supported.");
}
}
function onexecuteMethod(parameters: SingleRecord, properties: SingleRecord, configuration: SingleRecord): Promise<void> {
}
Requirements
@k2oss/k2-broker-core npm package - Download and install from (https://www.npmjs.com/package/@k2oss/k2-broker-core)
Release Notes
1.0.0
Initial release of k2-javascript-broker-intellisense