@transai/connector-runner-mkg 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/index.cjs +2 -0
- package/index.cjs.map +7 -0
- package/index.js +2 -0
- package/index.js.map +7 -0
- package/libs/connector-runner-mkg/src/lib/actions-handler.d.ts +7 -0
- package/libs/connector-runner-mkg/src/lib/connector-runner-mkg.d.ts +8 -0
- package/libs/connector-runner-mkg/src/lib/extractor.service.d.ts +8 -0
- package/libs/connector-runner-mkg/src/lib/tables/_all.d.ts +4 -0
- package/libs/connector-runner-mkg/src/lib/tables/artg.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/arti.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/base/action.d.ts +21 -0
- package/libs/connector-runner-mkg/src/lib/tables/base/table.d.ts +15 -0
- package/libs/connector-runner-mkg/src/lib/tables/bwrg.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/bwrk.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/clch.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/debi.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/magl.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/magz.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/medw.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/parl.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/plnb.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/prbv.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/prdh.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/prdr.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/prmv.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/rela.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/rgrs.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/rsrc.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/rsrd.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/rsrg.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/stlh.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/stlm.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/stlr.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/tables/vrdg.d.ts +2 -0
- package/libs/connector-runner-mkg/src/lib/types.d.ts +34 -0
- package/libs/connector-runtime-sdk/src/index.d.ts +3 -0
- package/libs/connector-runtime-sdk/src/lib/connector-runtime.d.ts +16 -0
- package/libs/connector-runtime-sdk/src/lib/connector-runtime.interface.d.ts +5 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/files.sdk.interface.d.ts +18 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.d.ts +38 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/index.d.ts +10 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/logger.sdk.interface.d.ts +7 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/offset-store.sdk.interface.d.ts +12 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/processing.sdk.interface.d.ts +13 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.d.ts +14 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.d.ts +31 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/sender.sdk.interface.d.ts +22 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/telemetry.sdk.interface.d.ts +15 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/templating.sdk.interface.d.ts +12 -0
- package/libs/types/src/index.d.ts +7 -0
- package/libs/types/src/lib/cube-query-config.types.d.ts +20 -0
- package/libs/types/src/lib/file-action.types.d.ts +5 -0
- package/libs/types/src/lib/http-status-codes.enum.d.ts +64 -0
- package/libs/types/src/lib/management-api/action-definition.interface.d.ts +12 -0
- package/libs/types/src/lib/management-api/chart.interface.d.ts +9 -0
- package/libs/types/src/lib/management-api/connector/connector.interface.d.ts +140 -0
- package/libs/types/src/lib/management-api/connector/connectors.interface.d.ts +126 -0
- package/libs/types/src/lib/management-api/connector-orchestrator-config.interface.d.ts +14 -0
- package/libs/types/src/lib/management-api/cube-dataset.interface.d.ts +93 -0
- package/libs/types/src/lib/management-api/dashboard.interface.d.ts +35 -0
- package/libs/types/src/lib/management-api/dataset/collection.interface.d.ts +16 -0
- package/libs/types/src/lib/management-api/dataset/dataset-record.interface.d.ts +5 -0
- package/libs/types/src/lib/management-api/dataset/dataset.interface.d.ts +730 -0
- package/libs/types/src/lib/management-api/dataset/datasets.interface.d.ts +710 -0
- package/libs/types/src/lib/management-api/dataset/dimension.interface.d.ts +205 -0
- package/libs/types/src/lib/management-api/dataset/dimensions.interface.d.ts +186 -0
- package/libs/types/src/lib/management-api/dataset/filter-group.interface.d.ts +8 -0
- package/libs/types/src/lib/management-api/dataset/filter.interface.d.ts +34 -0
- package/libs/types/src/lib/management-api/dataset/filters.interface.d.ts +7 -0
- package/libs/types/src/lib/management-api/dataset/measure.interface.d.ts +65 -0
- package/libs/types/src/lib/management-api/dataset/measures.interface.d.ts +56 -0
- package/libs/types/src/lib/management-api/dataset/meta.interface.d.ts +9 -0
- package/libs/types/src/lib/management-api/dataset/pre-aggregate.interface.d.ts +69 -0
- package/libs/types/src/lib/management-api/dataset/pre-aggregations.interface.d.ts +54 -0
- package/libs/types/src/lib/management-api/dataset/relation.interface.d.ts +40 -0
- package/libs/types/src/lib/management-api/dataset/relations.interface.d.ts +36 -0
- package/libs/types/src/lib/management-api/dataset/segment.interface.d.ts +45 -0
- package/libs/types/src/lib/management-api/dataset/segments.interface.d.ts +43 -0
- package/libs/types/src/lib/management-api/dataset/switch.interface.d.ts +70 -0
- package/libs/types/src/lib/management-api/dataset/when-item.interface.d.ts +41 -0
- package/libs/types/src/lib/management-api/dataset/when-items.interface.d.ts +40 -0
- package/libs/types/src/lib/management-api/event-origin.interface.d.ts +24 -0
- package/libs/types/src/lib/management-api/index.d.ts +39 -0
- package/libs/types/src/lib/management-api/semantic-trigger/custom-cron-trigger-record.interface.d.ts +6 -0
- package/libs/types/src/lib/management-api/semantic-trigger/index.d.ts +6 -0
- package/libs/types/src/lib/management-api/semantic-trigger/semantic-trigger-filter.interface.d.ts +20 -0
- package/libs/types/src/lib/management-api/semantic-trigger/semantic-trigger-filters.interface.d.ts +18 -0
- package/libs/types/src/lib/management-api/semantic-trigger/semantic-trigger-record.interface.d.ts +6 -0
- package/libs/types/src/lib/management-api/semantic-trigger/semantic-trigger.interface.d.ts +75 -0
- package/libs/types/src/lib/management-api/semantic-trigger/semantic-triggers.interface.d.ts +62 -0
- package/libs/types/src/lib/management-api/template-implementation-overrides.interface.d.ts +1152 -0
- package/libs/types/src/lib/management-api/template-implementation.interface.d.ts +2860 -0
- package/libs/types/src/lib/management-api/template.interface.d.ts +1191 -0
- package/libs/types/src/lib/management-api/tenant.interface.d.ts +8 -0
- package/libs/types/src/lib/management-api/type-enums.d.ts +85 -0
- package/libs/types/src/lib/management-api/web/generic-filter.dto.d.ts +37 -0
- package/libs/types/src/lib/management-api/web/index.d.ts +2 -0
- package/libs/types/src/lib/management-api/web/paginated-response.interface.d.ts +17 -0
- package/libs/types/src/lib/management-api/workflow/action.interface.d.ts +85 -0
- package/libs/types/src/lib/management-api/workflow/index.d.ts +6 -0
- package/libs/types/src/lib/management-api/workflow/offset.interface.d.ts +14 -0
- package/libs/types/src/lib/management-api/workflow/trigger-types.interface.d.ts +14 -0
- package/libs/types/src/lib/management-api/workflow/workflow-definition.interface.d.ts +57 -0
- package/libs/types/src/lib/management-api/workflow/workflow-run.d.ts +70 -0
- package/libs/types/src/lib/management-api/workflow/workflow.drawing.d.ts +102 -0
- package/libs/types/src/lib/message.types.d.ts +59 -0
- package/libs/types/src/lib/response.types.d.ts +27 -0
- package/libs/types/src/lib/types.d.ts +116 -0
- package/package.json +1 -1
- package/.eslintrc.json +0 -30
- package/jest.config.ts +0 -10
- package/project.json +0 -29
- package/src/lib/actions-handler.spec.ts +0 -177
- package/src/lib/actions-handler.ts +0 -143
- package/src/lib/connector-runner-mkg.spec.ts +0 -219
- package/src/lib/connector-runner-mkg.ts +0 -155
- package/src/lib/extractor.service.spec.ts +0 -123
- package/src/lib/extractor.service.ts +0 -125
- package/src/lib/tables/_all.ts +0 -60
- package/src/lib/tables/artg.ts +0 -12
- package/src/lib/tables/arti.ts +0 -99
- package/src/lib/tables/base/action.ts +0 -70
- package/src/lib/tables/base/table.ts +0 -57
- package/src/lib/tables/bwrg.ts +0 -13
- package/src/lib/tables/bwrk.ts +0 -60
- package/src/lib/tables/clch.ts +0 -42
- package/src/lib/tables/debi.ts +0 -62
- package/src/lib/tables/magl.ts +0 -15
- package/src/lib/tables/magz.ts +0 -14
- package/src/lib/tables/medw.ts +0 -97
- package/src/lib/tables/parl.ts +0 -24
- package/src/lib/tables/plnb.ts +0 -46
- package/src/lib/tables/prbv.ts +0 -31
- package/src/lib/tables/prdh.ts +0 -46
- package/src/lib/tables/prdr.ts +0 -25
- package/src/lib/tables/prmv.ts +0 -31
- package/src/lib/tables/rela.ts +0 -40
- package/src/lib/tables/rgrs.ts +0 -68
- package/src/lib/tables/rsrc.ts +0 -23
- package/src/lib/tables/rsrd.ts +0 -98
- package/src/lib/tables/rsrg.ts +0 -6
- package/src/lib/tables/stlh.ts +0 -24
- package/src/lib/tables/stlm.ts +0 -80
- package/src/lib/tables/stlr.ts +0 -60
- package/src/lib/tables/vrdg.ts +0 -27
- package/src/lib/types.ts +0 -45
- package/tsconfig.json +0 -22
- package/tsconfig.lib.json +0 -10
- package/tsconfig.spec.json +0 -14
- /package/{src/index.ts → libs/connector-runner-mkg/src/index.d.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MkgTableInterface } from '../../types';
|
|
2
|
+
type MkgActionMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
3
|
+
export interface MkgActionInterface {
|
|
4
|
+
identifier: string;
|
|
5
|
+
method: MkgActionMethod;
|
|
6
|
+
fields: Array<string>;
|
|
7
|
+
optionalFields?: Array<string>;
|
|
8
|
+
path?: (inputData: Record<string, unknown>) => string;
|
|
9
|
+
}
|
|
10
|
+
export declare class MkgAction implements MkgActionInterface {
|
|
11
|
+
#private;
|
|
12
|
+
readonly identifier: string;
|
|
13
|
+
readonly method: MkgActionMethod;
|
|
14
|
+
readonly fields: Array<string>;
|
|
15
|
+
readonly optionalFields: Array<string>;
|
|
16
|
+
readonly path: (inputData: Record<string, unknown>) => string;
|
|
17
|
+
constructor(params: MkgActionInterface);
|
|
18
|
+
withParentTable(table: MkgTableInterface): MkgAction;
|
|
19
|
+
fieldSet(inputData: Record<string, unknown>): Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MkgTableInterface, TableConfig } from '../../types';
|
|
2
|
+
import { MkgAction } from './action';
|
|
3
|
+
export declare class MkgTable implements MkgTableInterface {
|
|
4
|
+
readonly identifier: string;
|
|
5
|
+
readonly fields: Array<string>;
|
|
6
|
+
readonly immediate: boolean;
|
|
7
|
+
readonly interval: number;
|
|
8
|
+
readonly identifierField: string;
|
|
9
|
+
readonly dateField: string;
|
|
10
|
+
readonly rows: number;
|
|
11
|
+
readonly actions: Array<MkgAction>;
|
|
12
|
+
constructor(params: MkgTableInterface, actions?: Array<MkgAction>);
|
|
13
|
+
cloneFromTableConfig(tableConfig: TableConfig | true): MkgTable;
|
|
14
|
+
action(identifier: string): MkgAction | undefined;
|
|
15
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseConnectorConfig } from '@xip-online-data/types';
|
|
2
|
+
export declare const DEFAULT_DATASOURCE = "mkg";
|
|
3
|
+
export declare const DEFAULT_INTERVAL = 3600;
|
|
4
|
+
export declare const DEFAULT_ROW_KEY_FIELD = "RowKey";
|
|
5
|
+
export declare const DEFAULT_DATE_FIELD = "sys_dat_wijzig";
|
|
6
|
+
export declare const DEFAULT_NUM_ROWS = 250;
|
|
7
|
+
export declare const SESSION_COOKIE_NAME = "JSESSIONID";
|
|
8
|
+
/**
|
|
9
|
+
* Session expires in 30 minutes
|
|
10
|
+
*/
|
|
11
|
+
export declare const SESSION_EXPIRATION_SECONDS: number;
|
|
12
|
+
export interface TableConfig {
|
|
13
|
+
fields?: Array<string>;
|
|
14
|
+
}
|
|
15
|
+
export interface ConnectorConfig extends BaseConnectorConfig {
|
|
16
|
+
server: 'saas*.mkg.eu' | string;
|
|
17
|
+
port?: 443 | 8443 | number;
|
|
18
|
+
path?: '/mkg' | '/mkgoefenclient' | string;
|
|
19
|
+
username: string;
|
|
20
|
+
password: string;
|
|
21
|
+
apiToken: string;
|
|
22
|
+
tables?: {
|
|
23
|
+
[key: string]: TableConfig | true;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface MkgTableInterface {
|
|
27
|
+
identifier: string;
|
|
28
|
+
fields: Array<string>;
|
|
29
|
+
immediate?: boolean;
|
|
30
|
+
interval?: number;
|
|
31
|
+
identifierField?: string;
|
|
32
|
+
dateField?: string;
|
|
33
|
+
rows?: number;
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { KafkaCallbackResponse, BaseConnectorConfig, ActionInterface, ConnectorInterface, XodJobType } from '@xip-online-data/types';
|
|
2
|
+
import { ConnectorRuntimeInterface } from './connector-runtime.interface';
|
|
3
|
+
import { ConnectorSDKInterface } from './sdk';
|
|
4
|
+
export interface IpcMessage {
|
|
5
|
+
cmd: string;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export declare abstract class ConnectorRuntimeSDK<T extends BaseConnectorConfig = BaseConnectorConfig> implements ConnectorRuntimeInterface {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(connector: ConnectorInterface, connectorSDK: ConnectorSDKInterface);
|
|
11
|
+
init: () => Promise<void>;
|
|
12
|
+
start: () => Promise<void>;
|
|
13
|
+
stop: () => Promise<void>;
|
|
14
|
+
set callbackFunction(callback: (message: XodJobType, action: ActionInterface) => Promise<KafkaCallbackResponse>);
|
|
15
|
+
protected get connectorSDK(): ConnectorSDKInterface<T>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface FileInfo {
|
|
2
|
+
type: 'DIRECTORY' | 'FILE';
|
|
3
|
+
name: string;
|
|
4
|
+
size: number;
|
|
5
|
+
modifyTime: Date;
|
|
6
|
+
}
|
|
7
|
+
export interface FileHandleInterface {
|
|
8
|
+
get(): Buffer;
|
|
9
|
+
close(): boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface FilesSDKInterface {
|
|
12
|
+
list(path: string): Promise<Array<FileInfo>>;
|
|
13
|
+
read(filePath: string): Promise<FileHandleInterface>;
|
|
14
|
+
write(filePath: string, data: FileHandleInterface | Buffer | string): Promise<boolean>;
|
|
15
|
+
delete(path: string): Promise<boolean>;
|
|
16
|
+
exists(path: string): Promise<boolean>;
|
|
17
|
+
pathAsDsn(path: string): string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface HttpConfig {
|
|
2
|
+
baseUrl?: string;
|
|
3
|
+
contentType?: string;
|
|
4
|
+
timeout?: number;
|
|
5
|
+
}
|
|
6
|
+
export type HttpRequestOptions<D = string | object> = {
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
params?: Record<string, string | number | boolean>;
|
|
9
|
+
data?: D;
|
|
10
|
+
withCredentials?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type HttpRequestOptionsFormatter<D = string | object> = (requestOptions: HttpRequestOptions<D>, method: HttpMethod, url: string) => Promise<HttpRequestOptions<D>> | HttpRequestOptions<D>;
|
|
13
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
14
|
+
export type HttpResponseHeader = string | Array<string> | number | boolean | null;
|
|
15
|
+
export type HttpResponse<D = unknown> = {
|
|
16
|
+
status: number;
|
|
17
|
+
data: D;
|
|
18
|
+
headers?: Record<string, HttpResponseHeader>;
|
|
19
|
+
};
|
|
20
|
+
export type HttpError = {
|
|
21
|
+
status: number;
|
|
22
|
+
error?: string;
|
|
23
|
+
};
|
|
24
|
+
interface PromiseWithReason<T = unknown, R = unknown> extends Promise<T> {
|
|
25
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: R) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
|
26
|
+
catch<TResult = never>(onrejected?: ((reason: R) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
|
27
|
+
}
|
|
28
|
+
export type HttpClientPromise<T> = PromiseWithReason<HttpResponse<T>, HttpError>;
|
|
29
|
+
export interface HttpClientSDKInterface {
|
|
30
|
+
get<R = unknown>(destination: string, options?: HttpRequestOptions): HttpClientPromise<R>;
|
|
31
|
+
post<R = unknown, D = string | object>(destination: string, data: D, options?: HttpRequestOptions<D>): HttpClientPromise<R>;
|
|
32
|
+
put<R = unknown, D = string | object>(destination: string, data: D, options?: HttpRequestOptions<D>): HttpClientPromise<R>;
|
|
33
|
+
patch<R = unknown, D = string | object>(destination: string, data: D, options?: HttpRequestOptions<D>): HttpClientPromise<R>;
|
|
34
|
+
delete<R = unknown>(destination: string, options?: HttpRequestOptions): HttpClientPromise<R>;
|
|
35
|
+
request<R = unknown, D = string | object>(method: HttpMethod, url: string, options?: HttpRequestOptions<D>): HttpClientPromise<R>;
|
|
36
|
+
setRequestOptionsFormatter<D = string | object>(formatter: HttpRequestOptionsFormatter<D>): HttpClientSDKInterface;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './sdk.interface';
|
|
2
|
+
export * from './http-client.interface';
|
|
3
|
+
export * from './logger.sdk.interface';
|
|
4
|
+
export * from './offset-store.sdk.interface';
|
|
5
|
+
export * from './processing.sdk.interface';
|
|
6
|
+
export * from './receiver.sdk.interface';
|
|
7
|
+
export * from './sender.sdk.interface';
|
|
8
|
+
export * from './telemetry.sdk.interface';
|
|
9
|
+
export * from './templating.sdk.interface';
|
|
10
|
+
export * from './files.sdk.interface';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface StoredOffset {
|
|
2
|
+
timestamp: number;
|
|
3
|
+
id: number | string;
|
|
4
|
+
isoDate?: string;
|
|
5
|
+
date?: string;
|
|
6
|
+
rawTimestamp?: number | string;
|
|
7
|
+
[key: string]: string | number | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface OffsetStoreSDKInterface {
|
|
10
|
+
getOffset(identifier: string): Promise<StoredOffset>;
|
|
11
|
+
setOffset(offset: StoredOffset, identifier: string): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface IntervalHandler {
|
|
2
|
+
name?: string;
|
|
3
|
+
onInit?: () => Promise<void> | void;
|
|
4
|
+
onRun: () => Promise<void> | void;
|
|
5
|
+
onStop?: () => Promise<void> | void;
|
|
6
|
+
}
|
|
7
|
+
export type RegisterIntervalOptions = {
|
|
8
|
+
immediate?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export interface ProcessingSDKInterface {
|
|
11
|
+
registerInterval(intervalSeconds: number, handler: IntervalHandler, options?: RegisterIntervalOptions): Promise<string>;
|
|
12
|
+
stopInterval(name: string): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActionInterface, KafkaCallbackResponse, KafkaCallbackResponseType, XodJobType } from '@xip-online-data/types';
|
|
2
|
+
export interface ReceiverSDKInterface {
|
|
3
|
+
readonly responses: {
|
|
4
|
+
readonly ok: KafkaCallbackResponseType;
|
|
5
|
+
readonly created: KafkaCallbackResponseType;
|
|
6
|
+
readonly badRequest: KafkaCallbackResponseType;
|
|
7
|
+
readonly unprocessableEntity: KafkaCallbackResponseType;
|
|
8
|
+
readonly notFound: KafkaCallbackResponseType;
|
|
9
|
+
readonly internalServerError: KafkaCallbackResponseType;
|
|
10
|
+
};
|
|
11
|
+
registerCallback<T extends XodJobType = XodJobType>(callbackFunction: (message: T) => Promise<KafkaCallbackResponse>, eventType?: string, identifier?: string): void;
|
|
12
|
+
getActionConfig(message: XodJobType): ActionInterface | null;
|
|
13
|
+
emitEventType<T extends XodJobType = XodJobType>(callbackFunction: (message: T) => Promise<KafkaCallbackResponse>): (message: T) => Promise<KafkaCallbackResponse>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseConnectorConfig } from '@xip-online-data/types';
|
|
2
|
+
import { FilesSDKInterface } from './files.sdk.interface';
|
|
3
|
+
import { HttpClientSDKInterface, HttpConfig } from './http-client.interface';
|
|
4
|
+
import { LoggerSDKInterface } from './logger.sdk.interface';
|
|
5
|
+
import { OffsetStoreSDKInterface } from './offset-store.sdk.interface';
|
|
6
|
+
import { ProcessingSDKInterface } from './processing.sdk.interface';
|
|
7
|
+
import { ReceiverSDKInterface } from './receiver.sdk.interface';
|
|
8
|
+
import { SenderSDKInterface } from './sender.sdk.interface';
|
|
9
|
+
import { TelemetrySDKInterface } from './telemetry.sdk.interface';
|
|
10
|
+
import { TemplatingSDKInterface } from './templating.sdk.interface';
|
|
11
|
+
export interface ConnectorSDKInterface<T = BaseConnectorConfig> {
|
|
12
|
+
get config(): T;
|
|
13
|
+
get logger(): LoggerSDKInterface;
|
|
14
|
+
get sender(): SenderSDKInterface;
|
|
15
|
+
get receiver(): ReceiverSDKInterface;
|
|
16
|
+
get templating(): TemplatingSDKInterface;
|
|
17
|
+
/**
|
|
18
|
+
* Service to schedule and manage processing tasks that need monitoring and retries.
|
|
19
|
+
*/
|
|
20
|
+
get processing(): ProcessingSDKInterface;
|
|
21
|
+
get offsetStore(): OffsetStoreSDKInterface;
|
|
22
|
+
/**
|
|
23
|
+
* Ability to send telemetry data such as gauges and increments on how the connector is performing.
|
|
24
|
+
*/
|
|
25
|
+
get telemetry(): TelemetrySDKInterface;
|
|
26
|
+
/**
|
|
27
|
+
* Get file service instance to access files using a specified DSN. If no DSN is provided, defaults to local file system tmp dir.
|
|
28
|
+
*/
|
|
29
|
+
files(dsn?: string): FilesSDKInterface;
|
|
30
|
+
httpClient(httpConfig?: HttpConfig): HttpClientSDKInterface;
|
|
31
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface Metric {
|
|
2
|
+
key: string;
|
|
3
|
+
value: number;
|
|
4
|
+
}
|
|
5
|
+
export type Metadata = {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
8
|
+
export interface Context {
|
|
9
|
+
timestamp?: Date;
|
|
10
|
+
ttl?: number;
|
|
11
|
+
extraPayload?: {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export type Result = boolean | {
|
|
16
|
+
[index: number]: boolean;
|
|
17
|
+
};
|
|
18
|
+
export interface SenderSDKInterface {
|
|
19
|
+
metrics(metrics: Array<Metric>, metadata?: Metadata, context?: Context): Promise<Result>;
|
|
20
|
+
metricsLegacy(metrics: Array<never>, metadata?: Metadata, context?: Context): Promise<Result>;
|
|
21
|
+
documents(metrics: Array<object>, metadata?: Metadata, context?: Context): Promise<Result>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface TelemetrySDKInterface {
|
|
2
|
+
/**
|
|
3
|
+
* Increment a telemetry counter by 1.
|
|
4
|
+
*/
|
|
5
|
+
increment(key: string): void;
|
|
6
|
+
/**
|
|
7
|
+
* Increment a telemetry counter by a specified value. 0 doesn't send any telemetry.
|
|
8
|
+
* A negative value will decrement the counter.
|
|
9
|
+
*/
|
|
10
|
+
increment(key: string, value: number): void;
|
|
11
|
+
/**
|
|
12
|
+
* Send a gauge telemetry metric.
|
|
13
|
+
*/
|
|
14
|
+
gauge(key: string, value: number): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type RuntimeOptions = {
|
|
2
|
+
partial?: boolean;
|
|
3
|
+
};
|
|
4
|
+
export type CompileDelegate<T = unknown> = {
|
|
5
|
+
(context: T, options?: RuntimeOptions): string;
|
|
6
|
+
};
|
|
7
|
+
export type CompileOptions = {
|
|
8
|
+
strict?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export interface TemplatingSDKInterface {
|
|
11
|
+
compile<T = unknown>(input: string, options?: CompileOptions): CompileDelegate<T>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './lib/types';
|
|
2
|
+
export * from './lib/response.types';
|
|
3
|
+
export * from './lib/message.types';
|
|
4
|
+
export * from './lib/cube-query-config.types';
|
|
5
|
+
export * from './lib/file-action.types';
|
|
6
|
+
export * from './lib/management-api';
|
|
7
|
+
export * from './lib/http-status-codes.enum';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Query } from '@cubejs-client/core';
|
|
2
|
+
export interface CubeQueryConfig {
|
|
3
|
+
tenantId: string;
|
|
4
|
+
query: Query;
|
|
5
|
+
nullable?: boolean;
|
|
6
|
+
subqueries: Array<CubeSubQueryConfig>;
|
|
7
|
+
}
|
|
8
|
+
export interface CubeSubQueryConfig {
|
|
9
|
+
tenantId?: string;
|
|
10
|
+
query: Query;
|
|
11
|
+
nullable?: boolean;
|
|
12
|
+
field: string;
|
|
13
|
+
joinConditions: Array<CubeJoinCondition>;
|
|
14
|
+
}
|
|
15
|
+
export interface CubeJoinCondition {
|
|
16
|
+
selectField: string;
|
|
17
|
+
operator: string;
|
|
18
|
+
valueField: Array<string>;
|
|
19
|
+
valueMap?: Array<any>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare enum HttpStatusCode {
|
|
2
|
+
Continue = 100,
|
|
3
|
+
SwitchingProtocols = 101,
|
|
4
|
+
Processing = 102,
|
|
5
|
+
OK = 200,
|
|
6
|
+
Created = 201,
|
|
7
|
+
Accepted = 202,
|
|
8
|
+
NonAuthoritativeInformation = 203,
|
|
9
|
+
NoContent = 204,
|
|
10
|
+
ResetContent = 205,
|
|
11
|
+
PartialContent = 206,
|
|
12
|
+
MultiStatus = 207,
|
|
13
|
+
AlreadyReported = 208,
|
|
14
|
+
IMUsed = 226,
|
|
15
|
+
MultipleChoices = 300,
|
|
16
|
+
MovedPermanently = 301,
|
|
17
|
+
Found = 302,
|
|
18
|
+
SeeOther = 303,
|
|
19
|
+
NotModified = 304,
|
|
20
|
+
UseProxy = 305,
|
|
21
|
+
TemporaryRedirect = 307,
|
|
22
|
+
PermanentRedirect = 308,
|
|
23
|
+
BadRequest = 400,
|
|
24
|
+
Unauthorized = 401,
|
|
25
|
+
PaymentRequired = 402,
|
|
26
|
+
Forbidden = 403,
|
|
27
|
+
NotFound = 404,
|
|
28
|
+
MethodNotAllowed = 405,
|
|
29
|
+
NotAcceptable = 406,
|
|
30
|
+
ProxyAuthenticationRequired = 407,
|
|
31
|
+
RequestTimeout = 408,
|
|
32
|
+
Conflict = 409,
|
|
33
|
+
Gone = 410,
|
|
34
|
+
LengthRequired = 411,
|
|
35
|
+
PreconditionFailed = 412,
|
|
36
|
+
PayloadTooLarge = 413,
|
|
37
|
+
URITooLong = 414,
|
|
38
|
+
UnsupportedMediaType = 415,
|
|
39
|
+
RangeNotSatisfiable = 416,
|
|
40
|
+
ExpectationFailed = 417,
|
|
41
|
+
ImATeapot = 418,
|
|
42
|
+
MisdirectedRequest = 421,
|
|
43
|
+
UnprocessableEntity = 422,
|
|
44
|
+
Locked = 423,
|
|
45
|
+
FailedDependency = 424,
|
|
46
|
+
TooEarly = 425,
|
|
47
|
+
UpgradeRequired = 426,
|
|
48
|
+
PreconditionRequired = 428,
|
|
49
|
+
TooManyRequests = 429,
|
|
50
|
+
RequestHeaderFieldsTooLarge = 431,
|
|
51
|
+
UnavailableForLegalReasons = 451,
|
|
52
|
+
InternalServerError = 500,
|
|
53
|
+
NotImplemented = 501,
|
|
54
|
+
BadGateway = 502,
|
|
55
|
+
ServiceUnavailable = 503,
|
|
56
|
+
GatewayTimeout = 504,
|
|
57
|
+
HTTPVersionNotSupported = 505,
|
|
58
|
+
VariantAlsoNegotiates = 506,
|
|
59
|
+
InsufficientStorage = 507,
|
|
60
|
+
LoopDetected = 508,
|
|
61
|
+
NotExtended = 510,
|
|
62
|
+
NetworkAuthenticationRequired = 511,
|
|
63
|
+
Aborted = 512
|
|
64
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TenantInterface } from './tenant.interface';
|
|
2
|
+
import { CubeQueryConfig } from '../cube-query-config.types';
|
|
3
|
+
export interface ActionDefinitionInterface {
|
|
4
|
+
tenant: TenantInterface;
|
|
5
|
+
eventType: string;
|
|
6
|
+
eventTopic: string;
|
|
7
|
+
destinationTopic: string;
|
|
8
|
+
actionIdentifier: string;
|
|
9
|
+
template: string;
|
|
10
|
+
fileNameTemplate: string | undefined;
|
|
11
|
+
queryConfig: CubeQueryConfig | undefined;
|
|
12
|
+
}
|