appknit-platform-sdk
Advanced tools
Comparing version 2.0.0-5 to 2.0.0-6
@@ -9,2 +9,3 @@ "use strict"; | ||
const types_1 = require("./types"); | ||
const errors_1 = require("./types/errors"); | ||
const defaultHttpTimeout = 300000; | ||
@@ -296,4 +297,9 @@ const completionKey = '__completion'; | ||
setStopExecution(status, comment) { | ||
this.executionFramework.setProcessVariable(this.sdkMetadata.processId, completionKey, { status, comment }); | ||
this.executionFramework.markProcessComplete(this.sdkMetadata.processId); | ||
if (this.executionFramework) { | ||
this.executionFramework.setProcessVariable(this.sdkMetadata.processId, completionKey, { status, comment }); | ||
this.executionFramework.markProcessComplete(this.sdkMetadata.processId); | ||
} | ||
else { | ||
throw new errors_1.IncorrectEnvironmentError(); | ||
} | ||
} | ||
@@ -316,3 +322,8 @@ setCredentialBeforeRequestHook(interceptor) { | ||
getStopExecution() { | ||
return this.executionFramework.getProcessVariable(this.sdkMetadata.processId, completionKey); | ||
if (this.executionFramework) { | ||
return this.executionFramework.getProcessVariable(this.sdkMetadata.processId, completionKey); | ||
} | ||
else { | ||
throw new errors_1.IncorrectEnvironmentError(); | ||
} | ||
} | ||
@@ -352,3 +363,8 @@ getCredential() { | ||
setContextVariable(variableId, value) { | ||
this.executionFramework.setProcessVariable(this.sdkMetadata.processId, variableId, value); | ||
if (this.executionFramework) { | ||
this.executionFramework.setProcessVariable(this.sdkMetadata.processId, variableId, value); | ||
} | ||
else { | ||
throw new errors_1.IncorrectEnvironmentError(); | ||
} | ||
} | ||
@@ -361,5 +377,10 @@ setContextVariables(values) { | ||
setContextVariableIfNotSet(variableId, value) { | ||
if (!this.executionFramework.hasProcessVariable(this.sdkMetadata.processId, variableId)) { | ||
this.executionFramework.setProcessVariable(this.sdkMetadata.processId, variableId, value); | ||
if (this.executionFramework) { | ||
if (!this.executionFramework.hasProcessVariable(this.sdkMetadata.processId, variableId)) { | ||
this.executionFramework.setProcessVariable(this.sdkMetadata.processId, variableId, value); | ||
} | ||
} | ||
else { | ||
throw new errors_1.IncorrectEnvironmentError(); | ||
} | ||
} | ||
@@ -372,12 +393,32 @@ setContextVariablesIfNotSet(values) { | ||
getContextVariable(variableId, defaultValue) { | ||
return this.executionFramework.getProcessVariable(this.sdkMetadata.processId, variableId) || defaultValue; | ||
if (this.executionFramework) { | ||
return this.executionFramework.getProcessVariable(this.sdkMetadata.processId, variableId) || defaultValue; | ||
} | ||
else { | ||
throw new errors_1.IncorrectEnvironmentError(); | ||
} | ||
} | ||
unsetContext() { | ||
return this.executionFramework.clearProcessVariables(this.sdkMetadata.processId); | ||
if (this.executionFramework) { | ||
return this.executionFramework.clearProcessVariables(this.sdkMetadata.processId); | ||
} | ||
else { | ||
throw new errors_1.IncorrectEnvironmentError(); | ||
} | ||
} | ||
getContextVariables() { | ||
return Object.keys(this.executionFramework.getProcessVariables(this.sdkMetadata.processId) || {}); | ||
if (this.executionFramework) { | ||
return Object.keys(this.executionFramework.getProcessVariables(this.sdkMetadata.processId) || {}); | ||
} | ||
else { | ||
throw new errors_1.IncorrectEnvironmentError(); | ||
} | ||
} | ||
getContext() { | ||
return this.executionFramework.getProcessVariables(this.sdkMetadata.processId) || {}; | ||
if (this.executionFramework) { | ||
return this.executionFramework.getProcessVariables(this.sdkMetadata.processId) || {}; | ||
} | ||
else { | ||
throw new errors_1.IncorrectEnvironmentError(); | ||
} | ||
} | ||
@@ -400,2 +441,5 @@ getSdkMetadata() { | ||
createSdkContextMap(mapName, records, keyFields) { | ||
if (!this.executionFramework) { | ||
throw new errors_1.IncorrectEnvironmentError(); | ||
} | ||
if (typeof mapName !== 'string' | ||
@@ -402,0 +446,0 @@ || !Array.isArray(records) |
{ | ||
"name": "appknit-platform-sdk", | ||
"version": "2.0.0-5", | ||
"version": "2.0.0-6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "homepage": "https://appknit.io", |
Sorry, the diff of this file is not supported yet
129682
44
2404