appknit-platform-sdk
Advanced tools
Comparing version 1.0.53-12 to 1.0.53-13
@@ -11,2 +11,3 @@ import { SdkHttpHeaders, SdkStopExecutionStatus, SdkLogLevel, SdkLogEntry, SdkHttpRequestOptions, SdkHttpRequestTrace, SdkHttpResponse, SdkAuthenticationCredentialType, SdkFlowProvider, SdkStorageProvider, SdkContext, SdkDataProvider } from './types'; | ||
jwt: string; | ||
flowInvocationTags?: Record<string, string>; | ||
} | ||
@@ -96,4 +97,5 @@ declare type ObjectEntries = [key: string, value: any]; | ||
getSdkMetadata(): ISdkMetadata; | ||
setSdkMetadata(data: Record<string, any>): ISdkMetadata; | ||
getFlowExecutionUrl(pathAndQuery: string): string; | ||
} | ||
export {}; |
@@ -5,2 +5,3 @@ "use strict"; | ||
const nodePath = require("path"); | ||
const _ = require("lodash"); | ||
const http = require("http"); | ||
@@ -12,2 +13,3 @@ const https = require("https"); | ||
const types_1 = require("./types"); | ||
const allowedSDKMetadataFields = ['flowInvocationTags']; | ||
const defaultHttpTimeout = 300000; | ||
@@ -436,2 +438,16 @@ class AppknitSDK { | ||
} | ||
setSdkMetadata(data) { | ||
if (!_.isObject(data)) { | ||
throw new types_1.InvalidInputError(); | ||
} | ||
for (const field in data) { | ||
if (allowedSDKMetadataFields.indexOf(field) === -1) { | ||
const errorMessage = `Valid metadata fields: ${allowedSDKMetadataFields.join(' | ')}`; | ||
throw new types_1.InvalidInputError(errorMessage); | ||
} | ||
} | ||
const sdkMetadata = this.sdkMetadata; | ||
this.sdkMetadata = Object.assign(Object.assign({}, sdkMetadata), data); | ||
return this.sdkMetadata; | ||
} | ||
getFlowExecutionUrl(pathAndQuery) { | ||
@@ -438,0 +454,0 @@ return pathAndQuery ? `${this.getSdkMetadata().apiUrl}${pathAndQuery}` : null; |
@@ -17,4 +17,3 @@ export interface DataTypeVersionExternal { | ||
regexp = "@regexp", | ||
size = "@size", | ||
fullText = "@fulltext" | ||
size = "@size" | ||
} | ||
@@ -24,3 +23,2 @@ export declare type SdkDataQueryCondition<T> = { | ||
[SdkDataQueryConditionOperator.neq]?: T; | ||
[SdkDataQueryConditionOperator.fullText]?: T; | ||
[SdkDataQueryConditionOperator.in]?: Array<T>; | ||
@@ -196,4 +194,4 @@ [SdkDataQueryConditionOperator.nin]?: Array<T>; | ||
abstract getDataType(urn: string): any; | ||
abstract getDataTypeBySystemTitle(systemTitle: string): any; | ||
abstract createDataType(title: string, systemTitle: string): any; | ||
abstract getDataTypeBySystemTitle(systemTitle: string, organizationId?: string): any; | ||
abstract createDataType(title: string, systemTitle: string, organizationId?: string): any; | ||
abstract updateDataType(urn: string, title: string, systemTitle: string): any; | ||
@@ -200,0 +198,0 @@ abstract removeDataType(urn: string): Promise<void>; |
@@ -16,3 +16,2 @@ "use strict"; | ||
SdkDataQueryConditionOperator["size"] = "@size"; | ||
SdkDataQueryConditionOperator["fullText"] = "@fulltext"; | ||
})(SdkDataQueryConditionOperator = exports.SdkDataQueryConditionOperator || (exports.SdkDataQueryConditionOperator = {})); | ||
@@ -19,0 +18,0 @@ var SdkDataSchemaFieldType; |
@@ -23,1 +23,4 @@ export declare class SdkExecutionError extends Error { | ||
} | ||
export declare class InvalidInputError extends Error { | ||
constructor(message?: string); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NotImplementedError = exports.SdkGenericErrorMessages = exports.SdkGenericErrorCodes = exports.SdkExecutionError = void 0; | ||
exports.InvalidInputError = exports.NotImplementedError = exports.SdkGenericErrorMessages = exports.SdkGenericErrorCodes = exports.SdkExecutionError = void 0; | ||
class SdkExecutionError extends Error { | ||
@@ -33,2 +33,9 @@ constructor(code, message, originalError) { | ||
exports.NotImplementedError = NotImplementedError; | ||
class InvalidInputError extends Error { | ||
constructor(message) { | ||
super('INVALID_INPUT'); | ||
this.message = message; | ||
} | ||
} | ||
exports.InvalidInputError = InvalidInputError; | ||
//# sourceMappingURL=error.js.map |
{ | ||
"name": "appknit-platform-sdk", | ||
"version": "1.0.53-12", | ||
"version": "1.0.53-13", | ||
"description": "", | ||
@@ -32,2 +32,3 @@ "homepage": "https://appknit.io", | ||
"form-data": "^3.0.0", | ||
"lodash": "^4.17.20", | ||
"mime-types": "^2.1.27", | ||
@@ -39,2 +40,3 @@ "short-uuid": "^3.1.1", | ||
"@types/jest": "25.1.4", | ||
"@types/lodash": "^4.14.168", | ||
"@types/mime-types": "^2.1.0", | ||
@@ -41,0 +43,0 @@ "@types/node": "^13.9.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
124217
2312
6
21
+ Addedlodash@^4.17.20
+ Addedlodash@4.17.21(transitive)