-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
types.ts
138 lines (117 loc) Β· 4.06 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import { CheckAuthFn, CheckAuthMiddlewareFn, ExtendContextFn, QueryTransformerFn, JWTOptions } from '@cubejs-backend/api-gateway';
import { BaseDriver, RedisPoolOptions } from '@cubejs-backend/query-orchestrator';
import { BaseQuery } from '@cubejs-backend/schema-compiler';
export interface QueueOptions {
concurrency?: number;
continueWaitTimeout?: number;
executionTimeout?: number;
orphanedTimeout?: number;
heartBeatInterval?: number;
}
export interface QueryCacheOptions {
refreshKeyRenewalThreshold?: number;
backgroundRenew?: boolean;
queueOptions?: QueueOptions | ((dataSource: string) => QueueOptions);
externalQueueOptions?: QueueOptions;
}
export interface PreAggregationsOptions {
queueOptions?: QueueOptions;
externalRefresh?: boolean;
}
export interface OrchestratorOptions {
redisPrefix?: string;
redisPoolOptions?: RedisPoolOptions;
queryCacheOptions?: QueryCacheOptions;
preAggregationsOptions?: PreAggregationsOptions;
rollupOnlyMode?: boolean;
}
export interface RequestContext {
// @deprecated Renamed to securityContext, please use securityContext.
authInfo: any;
securityContext: any;
requestId: string;
}
export type UserBackgroundContext = {
// @deprecated Renamed to securityContext, please use securityContext.
authInfo?: any;
securityContext: any;
};
export interface DriverContext extends RequestContext {
dataSource: string;
}
export interface DialectContext extends DriverContext {
dbType: string;
}
export interface FileContent {
fileName: string;
content: string;
}
export interface SchemaFileRepository {
dataSchemaFiles: () => Promise<FileContent[]>;
}
export interface DriverFactory {}
export type DatabaseType =
| 'athena'
| 'bigquery'
| 'clickhouse'
| 'druid'
| 'jdbc'
| 'hive'
| 'mongobi'
| 'mssql'
| 'mysql'
| 'elasticsearch'
| 'awselasticsearch'
| 'oracle'
| 'postgres'
| 'prestodb'
| 'redshift'
| 'snowflake'
| 'sqlite';
export type ContextToAppIdFn = (context: RequestContext) => string;
export type OrchestratorOptionsFn = (context: RequestContext) => OrchestratorOptions;
export type PreAggregationsSchemaFn = (context: RequestContext) => string;
export type ExternalDbTypeFn = (context: RequestContext) => DatabaseType;
export type ExternalDriverFactoryFn = (context: RequestContext) => Promise<BaseDriver>|BaseDriver;
export type ExternalDialectFactoryFn = (context: RequestContext) => BaseQuery;
export type DbTypeFn = (context: RequestContext) => DatabaseType;
export type LoggerFn = (msg: string, params: any) => void;
export interface CreateOptions {
dbType?: DatabaseType | DbTypeFn;
externalDbType?: DatabaseType | ExternalDbTypeFn;
schemaPath?: string;
basePath?: string;
devServer?: boolean;
apiSecret?: string;
logger?: LoggerFn;
driverFactory?: (context: DriverContext) => Promise<BaseDriver>|BaseDriver;
dialectFactory?: (context: DialectContext) => BaseQuery;
externalDriverFactory?: ExternalDriverFactoryFn;
externalDialectFactory?: ExternalDialectFactoryFn;
contextToAppId?: ContextToAppIdFn;
contextToOrchestratorId?: (context: RequestContext) => string;
repositoryFactory?: (context: RequestContext) => SchemaFileRepository;
checkAuthMiddleware?: CheckAuthMiddlewareFn;
checkAuth?: CheckAuthFn;
jwt?: JWTOptions;
queryTransformer?: QueryTransformerFn;
preAggregationsSchema?: string | PreAggregationsSchemaFn;
schemaVersion?: (context: RequestContext) => string;
extendContext?: ExtendContextFn;
scheduledRefreshTimer?: boolean | number;
scheduledRefreshTimeZones?: string[];
scheduledRefreshContexts?: () => Promise<UserBackgroundContext[]>;
scheduledRefreshConcurrency?: number;
compilerCacheSize?: number;
maxCompilerCacheKeepAlive?: number;
updateCompilerCacheKeepAlive?: boolean;
telemetry?: boolean;
allowUngroupedWithoutPrimaryKey?: boolean;
orchestratorOptions?: OrchestratorOptions | OrchestratorOptionsFn;
allowJsDuplicatePropsInSchema?: boolean;
// @deprecated Use contextToOrchestratorId instead.
contextToDataSourceId?: any;
dashboardAppPath?: string;
dashboardAppPort?: number;
sqlCache?: boolean;
}