@transai/connector-runner-file 0.1.0 → 0.2.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.
Files changed (101) hide show
  1. package/index.cjs +58 -0
  2. package/index.cjs.map +7 -0
  3. package/index.js +58 -0
  4. package/index.js.map +7 -0
  5. package/libs/connector-runner-file/src/lib/actions-handler.d.ts +7 -0
  6. package/libs/connector-runner-file/src/lib/connector-runner-file.d.ts +8 -0
  7. package/libs/connector-runner-file/src/lib/processor.d.ts +9 -0
  8. package/libs/connector-runner-file/src/lib/types.d.ts +40 -0
  9. package/libs/connector-runtime-sdk/src/index.d.ts +3 -0
  10. package/libs/connector-runtime-sdk/src/lib/connector-runtime.d.ts +16 -0
  11. package/libs/connector-runtime-sdk/src/lib/connector-runtime.interface.d.ts +5 -0
  12. package/libs/connector-runtime-sdk/src/lib/sdk/files.sdk.interface.d.ts +18 -0
  13. package/libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.d.ts +38 -0
  14. package/libs/connector-runtime-sdk/src/lib/sdk/index.d.ts +10 -0
  15. package/libs/connector-runtime-sdk/src/lib/sdk/logger.sdk.interface.d.ts +7 -0
  16. package/libs/connector-runtime-sdk/src/lib/sdk/offset-store.sdk.interface.d.ts +12 -0
  17. package/libs/connector-runtime-sdk/src/lib/sdk/processing.sdk.interface.d.ts +13 -0
  18. package/libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.d.ts +14 -0
  19. package/libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.d.ts +31 -0
  20. package/libs/connector-runtime-sdk/src/lib/sdk/sender.sdk.interface.d.ts +22 -0
  21. package/libs/connector-runtime-sdk/src/lib/sdk/telemetry.sdk.interface.d.ts +15 -0
  22. package/libs/connector-runtime-sdk/src/lib/sdk/templating.sdk.interface.d.ts +12 -0
  23. package/libs/file-handler/src/index.d.ts +2 -0
  24. package/libs/file-handler/src/lib/file-handler.d.ts +23 -0
  25. package/libs/file-handler/src/lib/types.d.ts +6 -0
  26. package/libs/logger/src/index.d.ts +1 -0
  27. package/libs/logger/src/lib/logger.d.ts +28 -0
  28. package/libs/types/src/index.d.ts +7 -0
  29. package/libs/types/src/lib/cube-query-config.types.d.ts +20 -0
  30. package/libs/types/src/lib/file-action.types.d.ts +5 -0
  31. package/libs/types/src/lib/http-status-codes.enum.d.ts +64 -0
  32. package/libs/types/src/lib/management-api/action-definition.interface.d.ts +12 -0
  33. package/libs/types/src/lib/management-api/chart.interface.d.ts +9 -0
  34. package/libs/types/src/lib/management-api/connector/connector.interface.d.ts +140 -0
  35. package/libs/types/src/lib/management-api/connector/connectors.interface.d.ts +126 -0
  36. package/libs/types/src/lib/management-api/connector-orchestrator-config.interface.d.ts +14 -0
  37. package/libs/types/src/lib/management-api/cube-dataset.interface.d.ts +93 -0
  38. package/libs/types/src/lib/management-api/dashboard.interface.d.ts +35 -0
  39. package/libs/types/src/lib/management-api/dataset/collection.interface.d.ts +16 -0
  40. package/libs/types/src/lib/management-api/dataset/dataset-record.interface.d.ts +5 -0
  41. package/libs/types/src/lib/management-api/dataset/dataset.interface.d.ts +730 -0
  42. package/libs/types/src/lib/management-api/dataset/datasets.interface.d.ts +710 -0
  43. package/libs/types/src/lib/management-api/dataset/dimension.interface.d.ts +205 -0
  44. package/libs/types/src/lib/management-api/dataset/dimensions.interface.d.ts +186 -0
  45. package/libs/types/src/lib/management-api/dataset/filter-group.interface.d.ts +8 -0
  46. package/libs/types/src/lib/management-api/dataset/filter.interface.d.ts +34 -0
  47. package/libs/types/src/lib/management-api/dataset/filters.interface.d.ts +7 -0
  48. package/libs/types/src/lib/management-api/dataset/measure.interface.d.ts +65 -0
  49. package/libs/types/src/lib/management-api/dataset/measures.interface.d.ts +56 -0
  50. package/libs/types/src/lib/management-api/dataset/meta.interface.d.ts +9 -0
  51. package/libs/types/src/lib/management-api/dataset/pre-aggregate.interface.d.ts +69 -0
  52. package/libs/types/src/lib/management-api/dataset/pre-aggregations.interface.d.ts +54 -0
  53. package/libs/types/src/lib/management-api/dataset/relation.interface.d.ts +40 -0
  54. package/libs/types/src/lib/management-api/dataset/relations.interface.d.ts +36 -0
  55. package/libs/types/src/lib/management-api/dataset/segment.interface.d.ts +45 -0
  56. package/libs/types/src/lib/management-api/dataset/segments.interface.d.ts +43 -0
  57. package/libs/types/src/lib/management-api/dataset/switch.interface.d.ts +70 -0
  58. package/libs/types/src/lib/management-api/dataset/when-item.interface.d.ts +41 -0
  59. package/libs/types/src/lib/management-api/dataset/when-items.interface.d.ts +40 -0
  60. package/libs/types/src/lib/management-api/event-origin.interface.d.ts +24 -0
  61. package/libs/types/src/lib/management-api/index.d.ts +39 -0
  62. package/libs/types/src/lib/management-api/semantic-trigger/custom-cron-trigger-record.interface.d.ts +6 -0
  63. package/libs/types/src/lib/management-api/semantic-trigger/index.d.ts +6 -0
  64. package/libs/types/src/lib/management-api/semantic-trigger/semantic-trigger-filter.interface.d.ts +20 -0
  65. package/libs/types/src/lib/management-api/semantic-trigger/semantic-trigger-filters.interface.d.ts +18 -0
  66. package/libs/types/src/lib/management-api/semantic-trigger/semantic-trigger-record.interface.d.ts +6 -0
  67. package/libs/types/src/lib/management-api/semantic-trigger/semantic-trigger.interface.d.ts +75 -0
  68. package/libs/types/src/lib/management-api/semantic-trigger/semantic-triggers.interface.d.ts +62 -0
  69. package/libs/types/src/lib/management-api/template-implementation-overrides.interface.d.ts +1152 -0
  70. package/libs/types/src/lib/management-api/template-implementation.interface.d.ts +2860 -0
  71. package/libs/types/src/lib/management-api/template.interface.d.ts +1191 -0
  72. package/libs/types/src/lib/management-api/tenant.interface.d.ts +8 -0
  73. package/libs/types/src/lib/management-api/type-enums.d.ts +85 -0
  74. package/libs/types/src/lib/management-api/web/generic-filter.dto.d.ts +37 -0
  75. package/libs/types/src/lib/management-api/web/index.d.ts +2 -0
  76. package/libs/types/src/lib/management-api/web/paginated-response.interface.d.ts +17 -0
  77. package/libs/types/src/lib/management-api/workflow/action.interface.d.ts +85 -0
  78. package/libs/types/src/lib/management-api/workflow/index.d.ts +6 -0
  79. package/libs/types/src/lib/management-api/workflow/offset.interface.d.ts +14 -0
  80. package/libs/types/src/lib/management-api/workflow/trigger-types.interface.d.ts +14 -0
  81. package/libs/types/src/lib/management-api/workflow/workflow-definition.interface.d.ts +57 -0
  82. package/libs/types/src/lib/management-api/workflow/workflow-run.d.ts +70 -0
  83. package/libs/types/src/lib/management-api/workflow/workflow.drawing.d.ts +102 -0
  84. package/libs/types/src/lib/message.types.d.ts +59 -0
  85. package/libs/types/src/lib/response.types.d.ts +27 -0
  86. package/libs/types/src/lib/types.d.ts +116 -0
  87. package/package.json +1 -1
  88. package/.eslintrc.json +0 -18
  89. package/jest.config.ts +0 -10
  90. package/project.json +0 -33
  91. package/src/lib/actions-handler.spec.ts +0 -121
  92. package/src/lib/actions-handler.ts +0 -82
  93. package/src/lib/connector-runner-file.spec.ts +0 -73
  94. package/src/lib/connector-runner-file.ts +0 -50
  95. package/src/lib/processor.spec.ts +0 -119
  96. package/src/lib/processor.ts +0 -186
  97. package/src/lib/types.ts +0 -51
  98. package/tsconfig.json +0 -22
  99. package/tsconfig.lib.json +0 -10
  100. package/tsconfig.spec.json +0 -14
  101. /package/{src/index.ts → libs/connector-runner-file/src/index.d.ts} +0 -0
@@ -0,0 +1,7 @@
1
+ import { ConnectorSDKInterface, FilesSDKInterface } from '@transai/connector-runtime-sdk';
2
+ import { ActionInterface, KafkaCallbackResponse, XodJobType } from '@xip-online-data/types';
3
+ export declare class ActionsHandler {
4
+ #private;
5
+ constructor(connectorSDK: ConnectorSDKInterface, fileHandler: FilesSDKInterface);
6
+ get callbackFunctionChain(): (message: XodJobType, action: ActionInterface) => Promise<KafkaCallbackResponse>;
7
+ }
@@ -0,0 +1,8 @@
1
+ import { ConnectorRuntimeSDK, ConnectorSDKInterface } from '@transai/connector-runtime-sdk';
2
+ import { ConnectorInterface } from '@xip-online-data/types';
3
+ import { FileConfig } from './types';
4
+ export declare class ConnectorRunnerFile extends ConnectorRuntimeSDK<FileConfig> {
5
+ #private;
6
+ constructor(connector: ConnectorInterface, connectorSDK: ConnectorSDKInterface);
7
+ init: () => Promise<void>;
8
+ }
@@ -0,0 +1,9 @@
1
+ import { ConnectorSDKInterface, FilesSDKInterface, IntervalHandler } from '@transai/connector-runtime-sdk';
2
+ import { FileConfig, FileSelectorConfig } from './types';
3
+ export declare class Processor implements IntervalHandler {
4
+ #private;
5
+ static readonly DEFAULT_INTERVAL_SECONDS = 60;
6
+ constructor(connectorSDK: ConnectorSDKInterface<FileConfig>, fileSelector: FileSelectorConfig, fileHandler: FilesSDKInterface);
7
+ get name(): string;
8
+ onRun(): Promise<void>;
9
+ }
@@ -0,0 +1,40 @@
1
+ import { BaseConnectorConfig } from '@xip-online-data/types';
2
+ export interface FileSelectorConfig {
3
+ /**
4
+ * A regex pattern or string to select matching files. If the identifier is not
5
+ * provided, the selector string itself will be used as the identifier.
6
+ */
7
+ selector: {
8
+ pattern: string;
9
+ flags?: string;
10
+ } | string;
11
+ /**
12
+ * The action to take on the file after processing. 'move' to move the file to
13
+ * a different DSN (requires destinationDsn), 'delete' to delete the file, or
14
+ * 'nothing' to leave the file as is (default).
15
+ */
16
+ action?: 'move' | 'delete' | 'nothing';
17
+ /**
18
+ * If the action is 'move', the destination DSN where the file should be moved.
19
+ */
20
+ destinationDsn?: string;
21
+ /**
22
+ * An optional identifier for the file selector, used for the collection.
23
+ */
24
+ identifier?: string;
25
+ intervalSeconds?: number;
26
+ /**
27
+ * Look for files recursively in subdirectories.
28
+ */
29
+ recursive?: boolean;
30
+ delimiter?: string;
31
+ optionalHeaders?: Array<string>;
32
+ optionalSettings?: {
33
+ [key: string]: unknown;
34
+ };
35
+ type?: 'metric' | 'document';
36
+ }
37
+ export interface FileConfig extends BaseConnectorConfig {
38
+ dsn: string;
39
+ fileSelectors?: Array<FileSelectorConfig>;
40
+ }
@@ -0,0 +1,3 @@
1
+ export * from './lib/connector-runtime';
2
+ export * from './lib/connector-runtime.interface';
3
+ export * from './lib/sdk';
@@ -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,5 @@
1
+ export interface ConnectorRuntimeInterface {
2
+ init(): Promise<void>;
3
+ start(): Promise<void>;
4
+ stop(): Promise<void>;
5
+ }
@@ -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,7 @@
1
+ export interface LoggerSDKInterface {
2
+ info(...args: Array<unknown>): void;
3
+ debug(...args: Array<unknown>): void;
4
+ error(...args: Array<unknown>): void;
5
+ warn(...args: Array<unknown>): void;
6
+ verbose(...args: Array<unknown>): void;
7
+ }
@@ -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,2 @@
1
+ export * from './lib/file-handler';
2
+ export * from './lib/types';
@@ -0,0 +1,23 @@
1
+ export interface ParsedFile {
2
+ [key: string]: unknown;
3
+ }
4
+ export declare class FileHandler {
5
+ #private;
6
+ constructor(delimiter?: string | undefined);
7
+ handleBuffer(file: string, content: Buffer, optionalHeaders: Array<string>, optionalSettings?: {
8
+ [key: string]: unknown;
9
+ }): Promise<ParsedFile | undefined>;
10
+ handle(file: string, content: string, optionalHeaders: Array<string>, optionalSettings?: {
11
+ [key: string]: unknown;
12
+ }): Promise<ParsedFile | undefined>;
13
+ parseXML(content: string, optionalHeaders: Array<string>): Promise<ParsedFile>;
14
+ parseCSV(content: Buffer, optionalHeaders: Array<string>, optionalSettings?: {
15
+ [key: string]: unknown;
16
+ }): Promise<ParsedFile>;
17
+ private xmlOptions;
18
+ private csvOptions;
19
+ stringify(destination: string): string;
20
+ static getPath(file: string): string;
21
+ static getFileName(file: string): string;
22
+ static getExtension(file: string): string;
23
+ }
@@ -0,0 +1,6 @@
1
+ export interface SftpConfig {
2
+ host: string;
3
+ port: number;
4
+ username: string;
5
+ password: string;
6
+ }
@@ -0,0 +1 @@
1
+ export * from './lib/logger';
@@ -0,0 +1,28 @@
1
+ export declare enum LogLevels {
2
+ error = "error",
3
+ warn = "warn",
4
+ info = "info",
5
+ http = "http",
6
+ debug = "debug"
7
+ }
8
+ export declare class Logger {
9
+ #private;
10
+ private static instance;
11
+ private readonly logger;
12
+ constructor(identifier?: string, loglevel?: LogLevels);
13
+ static getInstance(identifier?: string, loglevel?: LogLevels): Logger;
14
+ setDatadogTransport(context?: {
15
+ service?: string;
16
+ env?: string;
17
+ source?: string;
18
+ tags?: {
19
+ [tag: string]: string;
20
+ };
21
+ apiKey?: string;
22
+ }): Logger;
23
+ info(...args: Array<unknown>): void;
24
+ debug(...args: Array<unknown>): void;
25
+ error(...args: Array<unknown>): void;
26
+ warn(...args: Array<unknown>): void;
27
+ verbose(...args: Array<unknown>): void;
28
+ }
@@ -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,5 @@
1
+ export declare enum FileActionType {
2
+ ACTION_MOVE = "move",
3
+ ACTION_DELETE = "delete",
4
+ ACTION_NOTHING = "nothing"
5
+ }
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ export interface ChartInterface {
2
+ dashboards: Array<number>;
3
+ owners: Array<number>;
4
+ params: string;
5
+ slice_name: string;
6
+ viz_type: string;
7
+ id: string;
8
+ supersetId: number;
9
+ }
@@ -0,0 +1,140 @@
1
+ import { z } from 'zod';
2
+ import { BaseConnectorConfig, ConfiguredConnectorTypes } from '../../types';
3
+ import { ConnectorOrigin } from '../type-enums';
4
+ import { ActionInterface } from '../workflow';
5
+ export declare const ConnectorSchema: z.ZodObject<{
6
+ identifier: z.ZodString;
7
+ connectorType: z.ZodNativeEnum<typeof ConfiguredConnectorTypes>;
8
+ name: z.ZodString;
9
+ location: z.ZodString;
10
+ config: z.ZodRecord<z.ZodString, z.ZodAny>;
11
+ enabled: z.ZodBoolean;
12
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
13
+ identifier: z.ZodString;
14
+ version: z.ZodString;
15
+ name: z.ZodString;
16
+ description: z.ZodOptional<z.ZodString>;
17
+ config: z.ZodRecord<z.ZodString, z.ZodAny>;
18
+ inputParameters: z.ZodArray<z.ZodObject<{
19
+ name: z.ZodString;
20
+ type: z.ZodEnum<["string", "number", "boolean", "array"]>;
21
+ required: z.ZodOptional<z.ZodBoolean>;
22
+ items: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ type: "string" | "number" | "boolean" | "array";
25
+ name: string;
26
+ required?: boolean | undefined;
27
+ items?: any[] | undefined;
28
+ }, {
29
+ type: "string" | "number" | "boolean" | "array";
30
+ name: string;
31
+ required?: boolean | undefined;
32
+ items?: any[] | undefined;
33
+ }>, "many">;
34
+ outputParameters: z.ZodAny;
35
+ mode: z.ZodOptional<z.ZodNativeEnum<typeof ConnectorOrigin>>;
36
+ createdAt: z.ZodOptional<z.ZodDate>;
37
+ updatedAt: z.ZodOptional<z.ZodDate>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ identifier: string;
40
+ version: string;
41
+ name: string;
42
+ config: Record<string, any>;
43
+ inputParameters: {
44
+ type: "string" | "number" | "boolean" | "array";
45
+ name: string;
46
+ required?: boolean | undefined;
47
+ items?: any[] | undefined;
48
+ }[];
49
+ mode?: ConnectorOrigin | undefined;
50
+ createdAt?: Date | undefined;
51
+ description?: string | undefined;
52
+ outputParameters?: any;
53
+ updatedAt?: Date | undefined;
54
+ }, {
55
+ identifier: string;
56
+ version: string;
57
+ name: string;
58
+ config: Record<string, any>;
59
+ inputParameters: {
60
+ type: "string" | "number" | "boolean" | "array";
61
+ name: string;
62
+ required?: boolean | undefined;
63
+ items?: any[] | undefined;
64
+ }[];
65
+ mode?: ConnectorOrigin | undefined;
66
+ createdAt?: Date | undefined;
67
+ description?: string | undefined;
68
+ outputParameters?: any;
69
+ updatedAt?: Date | undefined;
70
+ }>, "many">>;
71
+ createdAt: z.ZodOptional<z.ZodDate>;
72
+ updatedAt: z.ZodOptional<z.ZodDate>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ identifier: string;
75
+ name: string;
76
+ config: Record<string, any>;
77
+ connectorType: ConfiguredConnectorTypes;
78
+ location: string;
79
+ enabled: boolean;
80
+ createdAt?: Date | undefined;
81
+ updatedAt?: Date | undefined;
82
+ actions?: {
83
+ identifier: string;
84
+ version: string;
85
+ name: string;
86
+ config: Record<string, any>;
87
+ inputParameters: {
88
+ type: "string" | "number" | "boolean" | "array";
89
+ name: string;
90
+ required?: boolean | undefined;
91
+ items?: any[] | undefined;
92
+ }[];
93
+ mode?: ConnectorOrigin | undefined;
94
+ createdAt?: Date | undefined;
95
+ description?: string | undefined;
96
+ outputParameters?: any;
97
+ updatedAt?: Date | undefined;
98
+ }[] | undefined;
99
+ }, {
100
+ identifier: string;
101
+ name: string;
102
+ config: Record<string, any>;
103
+ connectorType: ConfiguredConnectorTypes;
104
+ location: string;
105
+ enabled: boolean;
106
+ createdAt?: Date | undefined;
107
+ updatedAt?: Date | undefined;
108
+ actions?: {
109
+ identifier: string;
110
+ version: string;
111
+ name: string;
112
+ config: Record<string, any>;
113
+ inputParameters: {
114
+ type: "string" | "number" | "boolean" | "array";
115
+ name: string;
116
+ required?: boolean | undefined;
117
+ items?: any[] | undefined;
118
+ }[];
119
+ mode?: ConnectorOrigin | undefined;
120
+ createdAt?: Date | undefined;
121
+ description?: string | undefined;
122
+ outputParameters?: any;
123
+ updatedAt?: Date | undefined;
124
+ }[] | undefined;
125
+ }>;
126
+ export interface ConnectorInterface<T = Partial<BaseConnectorConfig>> {
127
+ identifier: string;
128
+ connectorType: ConfiguredConnectorTypes;
129
+ tenantIdentifier: string;
130
+ name: string;
131
+ location: string;
132
+ config?: T;
133
+ enabled: boolean;
134
+ actions?: Array<ActionInterface>;
135
+ mode?: ConnectorOrigin;
136
+ createdAt?: Date;
137
+ updatedAt?: Date;
138
+ }
139
+ export type CreateConnectorInterface<T = Partial<BaseConnectorConfig>> = Omit<ConnectorInterface<T>, 'id' | 'createdAt' | 'updatedAt' | 'mode'>;
140
+ export type UpdateConnectorInterface<T = Partial<BaseConnectorConfig>> = Partial<Omit<ConnectorInterface<T>, 'id' | 'tenantIdentifier' | 'identifier' | 'createdAt' | 'mode'>>;