@mindconnect/mindconnect-nodejs
Version:
NodeJS Library for Siemens Insights Hub Connectivity - TypeScript SDK for Insights Hub and Industrial IoT - Command Line Interface - Insights Hub Development Proxy (Siemens Insights Hub was formerly known as MindSphere)
86 lines (85 loc) • 3.89 kB
TypeScript
import { TreeItem } from "performant-array-to-tree";
import { TimeStampedDataPoint } from "..";
import { IMindConnectConfiguration } from "./mindconnect-models";
export declare const convertToTdpArray: (data: any[]) => TimeStampedDataPoint[];
export type authJson = {
auth: string;
iv: string;
gateway: string;
tenant: string;
usertenant: string;
appName: string;
appVersion: string;
selected: boolean;
type: "SERVICE" | "APP";
createdAt: string;
};
export declare function upgradeOldConfiguration(obj: any): any;
export declare const isUrl: (url: string) => boolean;
export declare const getPiamUrl: (gateway: string, tenant: string) => string;
export declare const encrypt: ({ user, password, passkey, gateway, tenant, type, usertenant, appName, appVersion, createdAt, selected, }: credentialEntry) => authJson;
export type credentialEntry = {
user: string;
password: string;
passkey: string;
gateway: string;
tenant: string;
type: "SERVICE" | "APP";
usertenant: string;
appName: string;
appVersion: string;
createdAt: string;
selected: boolean;
};
export declare const decrypt: (encryptedAuth: authJson, passkey: string) => string;
export declare const getAgentDir: (path?: string) => string;
export declare const getHomeDotMcDir: () => string;
export declare const storeAuth: (auth: {
credentials: authJson[];
}) => void;
export declare const loadAuth: () => authJson;
export declare function getFullConfig(): {
credentials: authJson[];
};
export declare const getConfigProfile: (config: IMindConnectConfiguration) => string;
export declare const checkCertificate: (config: IMindConnectConfiguration, options: any) => boolean;
/**
* retry the function n times (while progressively waiting for the success) until success
* the waiting schema is iteration * timeoutInMiliseconds (default is 300ms)
*
* @param {number} n
* @param {Function} func
* @param {number} [timoutinMilliseconds=300]
* @param {Function} [logFunction]
* @returns
*/
export declare const retry: (n: number, func: Function, timoutinMilliseconds?: number, logFunction?: Function) => Promise<any>;
export declare const checkAssetId: (agentId: string) => void;
export declare const throwError: (error: string) => never;
export declare const toQueryString: (qs: any) => string;
export declare const removeUndefined: (obj: any) => any;
export declare function checksumFile(hashName: string, path: string): Promise<string>;
export declare function pruneCert(s: string): string;
export declare function addAndStoreConfiguration(configuration: any): void;
export declare function checkList(list: any[]): void;
/**
* Iterates over all properties of an object and returns it serialized as data points
*
* @export
* @param {{ [x: string]: any }} obj Object to iterate over
* @param {string} aspect aspect name in mindsphere
* @param {((propertyName: string, aspect: string) => string | undefined)} dataPointFunction find id in the object
* @param {((propertyName: string, aspect: string) => string | undefined)} qualityCodeFunction find quality code in the object
* @param {(propertyName: string, aspect: string) => void} invalidDataFunction what to do if the data is not available
* @returns
*/
export declare function convertToDataPoints(obj: {
[x: string]: any;
}, aspect: string, dataPointFunction: (propertyName: string, aspect: string) => string | undefined, qualityCodeFunction: (propertyName: string, aspect: string) => string | undefined, invalidDataFunction: (propertyName: string, aspect: string) => void): {
dataPointId: string;
qualityCode: string;
value: string;
}[];
export declare function isGuid(x: string): boolean;
export declare function printTree(treeItem: TreeItem, level: number, color: (x: string) => string): void;
export declare function removeTrailingSlash(url: string): string;