appknit-platform-sdk
Advanced tools
Comparing version 1.0.53-4 to 1.0.53-6
@@ -12,2 +12,3 @@ import { SdkHttpHeaders, SdkStopExecutionStatus, SdkLogLevel, SdkLogEntry, SdkHttpRequestOptions, SdkHttpRequestTrace, SdkHttpResponse, SdkAuthenticationCredentialType, SdkFlowProvider, SdkStorageProvider, SdkContext, SdkDataProvider } from './types'; | ||
} | ||
declare type ObjectEntries = [key: string, value: any]; | ||
export declare class AppknitSDK { | ||
@@ -87,3 +88,5 @@ protected sdkMetadata: ISdkMetadata; | ||
setContextVariable(variableId: string, value: any): void; | ||
setContextVariables(values: ObjectEntries[]): void; | ||
setContextVariableIfNotSet(variableId: string, value: any): void; | ||
setContextVariablesIfNotSet(values: ObjectEntries[]): void; | ||
getContextVariable(variableId: string, defaultValue: any): any; | ||
@@ -96,1 +99,2 @@ unsetContext(): void; | ||
} | ||
export {}; |
@@ -17,2 +17,3 @@ "use strict"; | ||
this.traces = []; | ||
this.context = {}; | ||
this.serialization = { | ||
@@ -88,3 +89,3 @@ json: { | ||
}; | ||
this.context = context; | ||
this.context = context || {}; | ||
this.sdkMetadata = sdkMetadata || null; | ||
@@ -383,13 +384,36 @@ } | ||
setContextVariable(variableId, value) { | ||
if (!this.context) | ||
this.context = {}; | ||
this.context[variableId] = value; | ||
} | ||
setContextVariables(values) { | ||
if (!this.context) | ||
this.context = {}; | ||
values.forEach(entry => { | ||
const [key, value] = entry; | ||
this.context[key] = value; | ||
}); | ||
} | ||
setContextVariableIfNotSet(variableId, value) { | ||
if (!this.context.hasOwnProperty(variableId)) { | ||
this.context[variableId] = value; | ||
} | ||
else { | ||
if (!this.context) | ||
this.context = {}; | ||
if (this.context.hasOwnProperty(variableId)) { | ||
throw new Error(`Variable with name ${variableId} already exists`); | ||
} | ||
this.context[variableId] = value; | ||
} | ||
setContextVariablesIfNotSet(values) { | ||
if (!this.context) | ||
this.context = {}; | ||
values.forEach(entry => { | ||
const [key, value] = entry; | ||
if (this.context.hasOwnProperty(key)) { | ||
throw new Error(`Variable with name ${key} already exists`); | ||
} | ||
this.context[key] = value; | ||
}); | ||
} | ||
getContextVariable(variableId, defaultValue) { | ||
if (!this.context) | ||
this.context = {}; | ||
return this.context[variableId] || defaultValue; | ||
@@ -401,5 +425,9 @@ } | ||
getContextVariables() { | ||
if (!this.context) | ||
this.context = {}; | ||
return Object.keys(this.context); | ||
} | ||
getContext() { | ||
if (!this.context) | ||
this.context = {}; | ||
return this.context; | ||
@@ -406,0 +434,0 @@ } |
@@ -52,7 +52,7 @@ import { AppknitSDK } from '../sdk'; | ||
minProperties?: number; | ||
allOf?: Array<object>; | ||
anyOf?: Array<object>; | ||
oneOf?: Array<object>; | ||
allOf?: Array<Record<string, any>>; | ||
anyOf?: Array<Record<string, any>>; | ||
oneOf?: Array<Record<string, any>>; | ||
not?: SdkOpenApiSchemaProperty; | ||
additionalProperties?: boolean | object; | ||
additionalProperties?: boolean | Record<string, any>; | ||
discriminator?: string; | ||
@@ -100,4 +100,4 @@ xml?: SdkOpenApiSchemaXMLProperty; | ||
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'TRACE' | 'OPTIONS' | 'CONNECT'; | ||
headers: {}; | ||
query: {}; | ||
headers: Record<string, any>; | ||
query: Record<string, any>; | ||
body: string; | ||
@@ -104,0 +104,0 @@ pathAndQuery?: string; |
{ | ||
"name": "appknit-platform-sdk", | ||
"version": "1.0.53-4", | ||
"version": "1.0.53-6", | ||
"description": "", | ||
@@ -40,4 +40,4 @@ "homepage": "https://appknit.io", | ||
"@types/node": "^13.9.1", | ||
"@typescript-eslint/eslint-plugin": "^2.23.0", | ||
"@typescript-eslint/parser": "^2.23.0", | ||
"@typescript-eslint/eslint-plugin": "^4.14.1", | ||
"@typescript-eslint/parser": "^4.14.1", | ||
"dotenv": "^8.2.0", | ||
@@ -57,3 +57,3 @@ "eslint": "^7.4.0", | ||
"tsconfig-paths": "^3.9.0", | ||
"typescript": "^4.0.5" | ||
"typescript": "^4.1.3" | ||
}, | ||
@@ -60,0 +60,0 @@ "jest": { |
Sorry, the diff of this file is not supported yet
122331
2284