semanticdb-v2 2.0.0-alpha.1 → 2.0.0-alpha.10
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/README.md +346 -46
- package/dist/cache/index.d.ts +2 -1
- package/dist/cache/manager.d.ts +5 -0
- package/dist/cache/registry.d.ts +14 -0
- package/dist/cache/types.d.ts +17 -0
- package/dist/close.d.ts +1 -0
- package/dist/compatibility/index.d.ts +2 -2
- package/dist/compatibility/logicform.d.ts +1 -7
- package/dist/compiler/compile-cte.d.ts +17 -2
- package/dist/compiler/index.d.ts +2 -1
- package/dist/compiler/shorten-sql.d.ts +1 -1
- package/dist/errors.d.ts +3 -0
- package/dist/executor/compatibility.d.ts +13 -0
- package/dist/executor/components.d.ts +8 -3
- package/dist/executor/connection-registry.d.ts +1 -12
- package/dist/executor/execute-query.d.ts +8 -2
- package/dist/executor/federated-execution.d.ts +38 -0
- package/dist/executor/fetch-entities.d.ts +7 -1
- package/dist/executor/index.d.ts +1 -1
- package/dist/executor/result-hydrator/types.d.ts +2 -0
- package/dist/executor/row-identity.d.ts +2 -1
- package/dist/executor/total.d.ts +11 -0
- package/dist/executor/types.d.ts +64 -19
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/locales/en-US.d.ts +2 -0
- package/dist/i18n/locales/zh-CN.d.ts +2 -0
- package/dist/i18n/registry.d.ts +13 -0
- package/dist/i18n/types.d.ts +9 -0
- package/dist/index.d.ts +16 -16
- package/dist/logicform-types.d.ts +56 -36
- package/dist/normalizer/core.d.ts +16 -2
- package/dist/normalizer/default-pred-name.d.ts +2 -0
- package/dist/normalizer/index.d.ts +1 -0
- package/dist/normalizer/pred-expression.d.ts +6 -0
- package/dist/normalizer/property-resolve.d.ts +6 -0
- package/dist/operators/builtins/constant.d.ts +2 -0
- package/dist/operators/builtins/period-name.d.ts +2 -1
- package/dist/operators/builtins/period-value.d.ts +2 -0
- package/dist/operators/builtins/query-expression.d.ts +3 -0
- package/dist/operators/builtins/scalar-extremum.d.ts +3 -0
- package/dist/operators/index.d.ts +2 -1
- package/dist/operators/registry.d.ts +5 -3
- package/dist/operators/resolve.d.ts +3 -0
- package/dist/operators/types.d.ts +102 -49
- package/dist/physical/clickhouse-provider.d.ts +29 -2
- package/dist/physical/connection-registry.d.ts +13 -0
- package/dist/physical/connection.d.ts +57 -15
- package/dist/physical/dameng-provider.d.ts +66 -0
- package/dist/physical/databricks-provider.d.ts +88 -0
- package/dist/physical/db-connector.d.ts +23 -0
- package/dist/physical/display-query.d.ts +3 -0
- package/dist/physical/doris-provider.d.ts +7 -1
- package/dist/physical/duckdb-coordinator-provider.d.ts +37 -0
- package/dist/physical/gbase-provider.d.ts +11 -0
- package/dist/physical/index.d.ts +24 -9
- package/dist/physical/load-driver.d.ts +1 -0
- package/dist/physical/maxcompute-provider.d.ts +44 -0
- package/dist/physical/mysql-protocol-provider.d.ts +27 -7
- package/dist/physical/mysql-provider.d.ts +2 -1
- package/dist/physical/oracle-provider.d.ts +21 -4
- package/dist/physical/postgresql-provider.d.ts +25 -4
- package/dist/physical/provider.d.ts +66 -2
- package/dist/physical/snowflake-provider.d.ts +20 -3
- package/dist/physical/sqlserver-provider.d.ts +69 -0
- package/dist/physical/starrocks-provider.d.ts +7 -1
- package/dist/physical/table-description.d.ts +5 -0
- package/dist/physical/table-discovery.d.ts +10 -0
- package/dist/planner/build-lineage.d.ts +1 -1
- package/dist/planner/create-logical-plan.d.ts +7 -0
- package/dist/planner/index.d.ts +4 -2
- package/dist/planner/mapping-granularity.d.ts +7 -0
- package/dist/planner/rewrite-nested-components.d.ts +8 -0
- package/dist/planner/select-schema-mapping.d.ts +16 -2
- package/dist/planner/semantics/index.d.ts +0 -3
- package/dist/planner/semantics/periods.d.ts +13 -0
- package/dist/planner/semantics/registry-defaults.d.ts +2 -1
- package/dist/planner/semantics/registry.d.ts +2 -1
- package/dist/planner/types.d.ts +94 -14
- package/dist/plugins/hierarchy/index.d.ts +1 -1
- package/dist/plugins/hierarchy/mapping-granularity.d.ts +4 -0
- package/dist/plugins/hierarchy/types.d.ts +20 -2
- package/dist/plugins/index.d.ts +10 -1
- package/dist/{planner/semantics → plugins}/observation/classification.d.ts +1 -1
- package/dist/plugins/observation/index.d.ts +17 -0
- package/dist/{planner/semantics → plugins}/observation/operator-policy.d.ts +4 -5
- package/dist/plugins/observation/periods.d.ts +18 -0
- package/dist/{planner/semantics → plugins}/observation/rule.d.ts +1 -1
- package/dist/plugins/observation/types.d.ts +3 -0
- package/dist/plugins/property-hierarchy/index.d.ts +11 -0
- package/dist/plugins/recursive/index.d.ts +26 -0
- package/dist/plugins/temporal/index.d.ts +13 -0
- package/dist/plugins/types.d.ts +165 -1
- package/dist/plugins/validity/classification.d.ts +5 -0
- package/dist/plugins/validity/index.d.ts +15 -0
- package/dist/plugins/validity/periods.d.ts +15 -0
- package/dist/plugins/validity/query-policy.d.ts +3 -0
- package/dist/plugins/validity/rule.d.ts +2 -0
- package/dist/plugins/validity/semantic-types.d.ts +3 -0
- package/dist/schema/dependent-projection.d.ts +8 -0
- package/dist/schema/entity-identity.d.ts +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema-mappings/freshness.d.ts +1 -1
- package/dist/schema-mappings/granularity.d.ts +5 -0
- package/dist/schema-mappings/index.d.ts +4 -1
- package/dist/schema-mappings/registry.d.ts +6 -3
- package/dist/schema-mappings/types.d.ts +52 -8
- package/dist/schema-mappings/yiask.d.ts +26 -0
- package/dist/semantic-types/builtins/tag.d.ts +2 -0
- package/dist/semantic-types/index.d.ts +5 -3
- package/dist/semantic-types/registry.d.ts +2 -0
- package/dist/semantic-types/resolve-schema.d.ts +1 -1
- package/dist/semantic-types/types.d.ts +22 -10
- package/dist/semantic-types/validate-resolved-schema.d.ts +2 -5
- package/dist/semanticdb.esm.js +5 -0
- package/dist/semanticdb.js +5 -0
- package/package.json +49 -17
- package/dist/cache/expiry.js +0 -1
- package/dist/cache/identity.js +0 -1
- package/dist/cache/redis-query-cache.js +0 -1
- package/dist/cache/serialization.js +0 -1
- package/dist/calendar/constants.d.ts +0 -7
- package/dist/calendar/constants.js +0 -1
- package/dist/calendar/index.d.ts +0 -6
- package/dist/calendar/provider-relation-store.d.ts +0 -9
- package/dist/calendar/provider-relation-store.js +0 -1
- package/dist/calendar/resolver.d.ts +0 -10
- package/dist/calendar/resolver.js +0 -1
- package/dist/calendar/system-schemas.d.ts +0 -3
- package/dist/calendar/system-schemas.js +0 -1
- package/dist/calendar/types.d.ts +0 -31
- package/dist/compatibility/logicform.js +0 -1
- package/dist/compiler/compile-cte.js +0 -1
- package/dist/compiler/compile-plan.js +0 -1
- package/dist/compiler/shorten-sql.js +0 -2
- package/dist/custom-functions/custom-functions.d.ts +0 -6
- package/dist/custom-functions/custom-functions.js +0 -1
- package/dist/custom-functions/index.d.ts +0 -3
- package/dist/custom-functions/operator-adapter.d.ts +0 -12
- package/dist/custom-functions/operator-adapter.js +0 -1
- package/dist/custom-functions/types.d.ts +0 -62
- package/dist/errors.js +0 -1
- package/dist/executor/compatibility.js +0 -1
- package/dist/executor/components.js +0 -1
- package/dist/executor/connection-registry.js +0 -1
- package/dist/executor/evaluate.js +0 -1
- package/dist/executor/execute-query.js +0 -1
- package/dist/executor/execute.js +0 -1
- package/dist/executor/fetch-entities.js +0 -1
- package/dist/executor/result-hydrator/entity-loader.js +0 -1
- package/dist/executor/result-hydrator/format-values.js +0 -1
- package/dist/executor/result-hydrator/hydrate-result.js +0 -1
- package/dist/executor/result-hydrator/missing-entity.js +0 -1
- package/dist/executor/result-hydrator/populate-entities.js +0 -1
- package/dist/executor/row-identity.js +0 -1
- package/dist/index.js +0 -1
- package/dist/logicform-types.js +0 -1
- package/dist/normalizer/core.js +0 -1
- package/dist/normalizer/default-pred-name.js +0 -1
- package/dist/normalizer/entity-id.js +0 -1
- package/dist/normalizer/groupby.js +0 -1
- package/dist/normalizer/normalize-logicform.js +0 -1
- package/dist/normalizer/pagination.js +0 -1
- package/dist/normalizer/pred-query-name.js +0 -1
- package/dist/normalizer/preds.js +0 -1
- package/dist/normalizer/query.js +0 -1
- package/dist/normalizer/version.js +0 -1
- package/dist/operators/builtins/abs.js +0 -1
- package/dist/operators/builtins/accumulate.js +0 -1
- package/dist/operators/builtins/add.js +0 -1
- package/dist/operators/builtins/arithmetic.js +0 -1
- package/dist/operators/builtins/average-per-period.js +0 -1
- package/dist/operators/builtins/avg.js +0 -1
- package/dist/operators/builtins/case.js +0 -1
- package/dist/operators/builtins/concat.js +0 -1
- package/dist/operators/builtins/count-distinct.js +0 -1
- package/dist/operators/builtins/count.js +0 -1
- package/dist/operators/builtins/date-bucket.js +0 -1
- package/dist/operators/builtins/divide.js +0 -1
- package/dist/operators/builtins/index.js +0 -1
- package/dist/operators/builtins/max.js +0 -1
- package/dist/operators/builtins/min.js +0 -1
- package/dist/operators/builtins/multiply.js +0 -1
- package/dist/operators/builtins/newly.js +0 -1
- package/dist/operators/builtins/period-boundary.js +0 -1
- package/dist/operators/builtins/period-difference.js +0 -1
- package/dist/operators/builtins/period-growth.js +0 -1
- package/dist/operators/builtins/period-name.js +0 -1
- package/dist/operators/builtins/period-shift.js +0 -1
- package/dist/operators/builtins/rank.js +0 -1
- package/dist/operators/builtins/row-number.js +0 -1
- package/dist/operators/builtins/share-of-total.js +0 -1
- package/dist/operators/builtins/sql.js +0 -1
- package/dist/operators/builtins/substring.js +0 -1
- package/dist/operators/builtins/subtract.js +0 -1
- package/dist/operators/builtins/sum.js +0 -1
- package/dist/operators/builtins/time-range.js +0 -1
- package/dist/operators/groupby.js +0 -1
- package/dist/operators/index.js +0 -1
- package/dist/operators/registry.js +0 -1
- package/dist/operators/sql-expression.js +0 -1
- package/dist/permissions/permissions.js +0 -1
- package/dist/physical/clickhouse-provider.js +0 -1
- package/dist/physical/connection.js +0 -1
- package/dist/physical/display-query.js +0 -1
- package/dist/physical/doris-provider.js +0 -1
- package/dist/physical/mysql-compatible-sql.js +0 -1
- package/dist/physical/mysql-protocol-provider.js +0 -1
- package/dist/physical/mysql-provider.js +0 -1
- package/dist/physical/oracle-provider.js +0 -1
- package/dist/physical/postgresql-provider.js +0 -1
- package/dist/physical/snowflake-provider.js +0 -1
- package/dist/physical/starrocks-provider.js +0 -1
- package/dist/planner/build-lineage.js +0 -1
- package/dist/planner/create-logical-plan.js +0 -1
- package/dist/planner/select-schema-mapping.js +0 -1
- package/dist/planner/semantics/lifecycle/classification.d.ts +0 -7
- package/dist/planner/semantics/lifecycle/classification.js +0 -1
- package/dist/planner/semantics/lifecycle/index.d.ts +0 -3
- package/dist/planner/semantics/lifecycle/query-policy.d.ts +0 -3
- package/dist/planner/semantics/lifecycle/query-policy.js +0 -1
- package/dist/planner/semantics/lifecycle/rule.d.ts +0 -2
- package/dist/planner/semantics/lifecycle/rule.js +0 -1
- package/dist/planner/semantics/observation/classification.js +0 -1
- package/dist/planner/semantics/observation/index.d.ts +0 -4
- package/dist/planner/semantics/observation/operator-policy.js +0 -1
- package/dist/planner/semantics/observation/rule.js +0 -1
- package/dist/planner/semantics/observation/types.d.ts +0 -3
- package/dist/planner/semantics/registry-defaults.js +0 -1
- package/dist/planner/semantics/registry.js +0 -1
- package/dist/planner/types.js +0 -1
- package/dist/plugins/hierarchy/compatibility.js +0 -1
- package/dist/plugins/hierarchy/entity-identity.js +0 -1
- package/dist/plugins/hierarchy/index.js +0 -1
- package/dist/plugins/hierarchy/operator.js +0 -1
- package/dist/plugins/hierarchy/resolve-schema.js +0 -1
- package/dist/plugins/index.js +0 -1
- package/dist/schema/entity-identity.js +0 -1
- package/dist/schema/resolve-property-path.js +0 -1
- package/dist/schema/schema-registry.js +0 -1
- package/dist/schema-mappings/freshness.js +0 -1
- package/dist/schema-mappings/registry.js +0 -1
- package/dist/semantic-types/builtins/boolean.js +0 -1
- package/dist/semantic-types/builtins/category.js +0 -1
- package/dist/semantic-types/builtins/currency.js +0 -1
- package/dist/semantic-types/builtins/date.js +0 -1
- package/dist/semantic-types/builtins/duration.js +0 -1
- package/dist/semantic-types/builtins/end-date.d.ts +0 -2
- package/dist/semantic-types/builtins/end-date.js +0 -1
- package/dist/semantic-types/builtins/entity.js +0 -1
- package/dist/semantic-types/builtins/file.js +0 -1
- package/dist/semantic-types/builtins/human-name.js +0 -1
- package/dist/semantic-types/builtins/id.js +0 -1
- package/dist/semantic-types/builtins/image.js +0 -1
- package/dist/semantic-types/builtins/index.js +0 -1
- package/dist/semantic-types/builtins/int.js +0 -1
- package/dist/semantic-types/builtins/name.js +0 -1
- package/dist/semantic-types/builtins/number.js +0 -1
- package/dist/semantic-types/builtins/object.js +0 -1
- package/dist/semantic-types/builtins/order.js +0 -1
- package/dist/semantic-types/builtins/percentage.js +0 -1
- package/dist/semantic-types/builtins/start-date.d.ts +0 -2
- package/dist/semantic-types/builtins/start-date.js +0 -1
- package/dist/semantic-types/builtins/string.js +0 -1
- package/dist/semantic-types/builtins/timestamp.js +0 -1
- package/dist/semantic-types/index.js +0 -1
- package/dist/semantic-types/primal-types/date.js +0 -1
- package/dist/semantic-types/primal-types/index.js +0 -1
- package/dist/semantic-types/registry.js +0 -1
- package/dist/semantic-types/resolve-schema.js +0 -1
- package/dist/semantic-types/validate-resolved-schema.js +0 -1
- package/dist/utils/clone.js +0 -1
- /package/dist/operators/builtins/{period-boundary.d.ts → period-boundary-expression.d.ts} +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
2
|
+
type DamengBind = string | number | Date | Buffer | null;
|
|
3
|
+
export interface DamengConnectionOptions {
|
|
4
|
+
readonly connectString?: string;
|
|
5
|
+
readonly host?: string;
|
|
6
|
+
readonly port?: number;
|
|
7
|
+
readonly user?: string;
|
|
8
|
+
readonly password?: string;
|
|
9
|
+
readonly schema?: string;
|
|
10
|
+
readonly poolMin?: number;
|
|
11
|
+
readonly poolMax?: number;
|
|
12
|
+
readonly poolTimeout?: number;
|
|
13
|
+
readonly [option: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface DamengConnectionLike {
|
|
16
|
+
execute(sql: string, binds: DamengBind[], options: {
|
|
17
|
+
readonly outFormat: number;
|
|
18
|
+
readonly autoCommit?: boolean;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
readonly rows?: unknown[];
|
|
21
|
+
readonly rowsAffected?: number;
|
|
22
|
+
}>;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export interface DamengPoolLike {
|
|
26
|
+
getConnection(): Promise<DamengConnectionLike>;
|
|
27
|
+
close(drainTime?: number): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export interface DamengDriverLike {
|
|
30
|
+
createPool(options: DamengPoolOptions): Promise<DamengPoolLike>;
|
|
31
|
+
}
|
|
32
|
+
export interface DamengPoolOptions extends Omit<DamengConnectionOptions, 'host' | 'port'> {
|
|
33
|
+
readonly connectString: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DamengProviderOptions {
|
|
36
|
+
readonly connection?: DamengConnectionOptions;
|
|
37
|
+
readonly pool?: DamengPoolLike;
|
|
38
|
+
readonly driver?: DamengDriverLike;
|
|
39
|
+
}
|
|
40
|
+
export declare const damengPoolOptions: (options: DamengConnectionOptions) => DamengPoolOptions;
|
|
41
|
+
export declare class DamengProvider implements CoreComputeProvider {
|
|
42
|
+
#private;
|
|
43
|
+
readonly kind: "dameng";
|
|
44
|
+
readonly supportsHavingAlias = false;
|
|
45
|
+
constructor(options?: DamengProviderOptions);
|
|
46
|
+
quoteIdentifier(identifier: string): string;
|
|
47
|
+
tableAlias(expression: string, alias: string): string;
|
|
48
|
+
paginate(sql: string, pageSize: number, offset: number): string;
|
|
49
|
+
parameter(index: number, value: unknown): string;
|
|
50
|
+
displayQuery(sql: string, parameters: readonly unknown[]): string;
|
|
51
|
+
dateBucket(expression: string, level: string): string;
|
|
52
|
+
datePart(expression: string, part: DatePart): string;
|
|
53
|
+
dateShift(expression: string, granularity: string, offset: number): string;
|
|
54
|
+
aggregateFunction(name: string, expression?: string): string;
|
|
55
|
+
stringify(expression: string): string;
|
|
56
|
+
concat(expressions: readonly string[]): string;
|
|
57
|
+
substring(expression: string, start: number, length: number): string;
|
|
58
|
+
stringLength(expression: string): string;
|
|
59
|
+
regex(expression: string, pattern: string, options?: string): string;
|
|
60
|
+
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
61
|
+
runSQL(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
62
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
63
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
64
|
+
close(): Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
2
|
+
type DatabricksBind = string | number | boolean | bigint | Date | null;
|
|
3
|
+
export interface DatabricksConnectionBase {
|
|
4
|
+
readonly host: string;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly catalog?: string;
|
|
7
|
+
readonly schema?: string;
|
|
8
|
+
/** Legacy datasource field for the default schema. */
|
|
9
|
+
readonly database?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DatabricksAccessTokenAuth {
|
|
12
|
+
readonly authType: 'access-token';
|
|
13
|
+
readonly token: string;
|
|
14
|
+
readonly oauthClientId?: never;
|
|
15
|
+
readonly oauthClientSecret?: never;
|
|
16
|
+
readonly azureTenantId?: never;
|
|
17
|
+
readonly useDatabricksOAuthInAzure?: never;
|
|
18
|
+
readonly oauthScopes?: never;
|
|
19
|
+
}
|
|
20
|
+
export interface DatabricksOAuthAuth {
|
|
21
|
+
readonly authType: 'databricks-oauth';
|
|
22
|
+
readonly oauthClientId: string;
|
|
23
|
+
readonly oauthClientSecret: string;
|
|
24
|
+
readonly token?: never;
|
|
25
|
+
readonly azureTenantId?: string;
|
|
26
|
+
readonly useDatabricksOAuthInAzure?: boolean;
|
|
27
|
+
readonly oauthScopes?: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
export type DatabricksConnectionOptions = DatabricksConnectionBase & (DatabricksAccessTokenAuth | DatabricksOAuthAuth);
|
|
30
|
+
export interface DatabricksOperationLike {
|
|
31
|
+
fetchAll(): Promise<unknown>;
|
|
32
|
+
/** The native SDK can finish commands that have no result set to fetch. */
|
|
33
|
+
finished?(): Promise<void>;
|
|
34
|
+
cancel(): Promise<unknown>;
|
|
35
|
+
close(): Promise<unknown>;
|
|
36
|
+
}
|
|
37
|
+
export interface DatabricksSessionLike {
|
|
38
|
+
executeStatement(sql: string, options: {
|
|
39
|
+
readonly ordinalParameters: DatabricksBind[];
|
|
40
|
+
}): Promise<DatabricksOperationLike>;
|
|
41
|
+
close(): Promise<unknown>;
|
|
42
|
+
}
|
|
43
|
+
export interface DatabricksClientLike {
|
|
44
|
+
connect(options: object): Promise<unknown>;
|
|
45
|
+
openSession(options: {
|
|
46
|
+
readonly initialCatalog?: string;
|
|
47
|
+
readonly initialSchema?: string;
|
|
48
|
+
}): Promise<DatabricksSessionLike>;
|
|
49
|
+
close(): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
export interface DatabricksProviderOptions {
|
|
52
|
+
readonly connection?: DatabricksConnectionOptions;
|
|
53
|
+
readonly client?: DatabricksClientLike;
|
|
54
|
+
}
|
|
55
|
+
export declare const databricksConnectOptions: (input: unknown) => object;
|
|
56
|
+
export declare class DatabricksProvider implements CoreComputeProvider {
|
|
57
|
+
#private;
|
|
58
|
+
readonly kind: "databricks";
|
|
59
|
+
readonly supportsHavingAlias = false;
|
|
60
|
+
readonly supportsRecursiveCte = true;
|
|
61
|
+
constructor(options?: DatabricksProviderOptions);
|
|
62
|
+
quoteIdentifier(identifier: string): string;
|
|
63
|
+
tableAlias(expression: string, alias: string): string;
|
|
64
|
+
paginate(sql: string, pageSize: number, offset: number): string;
|
|
65
|
+
parameter(index: number, value: unknown): string;
|
|
66
|
+
displayQuery(sql: string, parameters: readonly unknown[]): string;
|
|
67
|
+
dateBucket(expression: string, level: string): string;
|
|
68
|
+
datePart(expression: string, part: DatePart): string;
|
|
69
|
+
dateShift(expression: string, granularity: string, offset: number): string;
|
|
70
|
+
castValue(expression: string, type: string): string;
|
|
71
|
+
aggregateFunction(name: string, expression?: string): string;
|
|
72
|
+
stringify(expression: string): string;
|
|
73
|
+
concat(expressions: readonly string[]): string;
|
|
74
|
+
substring(expression: string, start: number, length: number): string;
|
|
75
|
+
stringLength(expression: string): string;
|
|
76
|
+
regex(expression: string, pattern: string, options?: string): string;
|
|
77
|
+
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
78
|
+
expandArray(arrayExpression: string, alias: string, column: string): {
|
|
79
|
+
joinSql: string;
|
|
80
|
+
valueExpression: string;
|
|
81
|
+
};
|
|
82
|
+
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
83
|
+
runSQL(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
84
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
85
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
86
|
+
close(): Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DatabaseConnection, ProviderRegistry } from './connection';
|
|
2
|
+
import type { DatabaseTable, SQLResult, SqlParameters, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
3
|
+
export interface DBConnectorOptions {
|
|
4
|
+
/** Exactly the same connection object accepted by Logicform.execute.connections. */
|
|
5
|
+
readonly connection: DatabaseConnection;
|
|
6
|
+
readonly providerRegistry?: ProviderRegistry;
|
|
7
|
+
readonly signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
export interface RunSQLOptions extends DBConnectorOptions {
|
|
10
|
+
readonly sql: string;
|
|
11
|
+
readonly parameters?: SqlParameters;
|
|
12
|
+
}
|
|
13
|
+
export interface GetTableListOptions extends DBConnectorOptions, TableListRequest {
|
|
14
|
+
}
|
|
15
|
+
export interface DescribeTableOptions extends DBConnectorOptions, DescribeTableRequest {
|
|
16
|
+
}
|
|
17
|
+
/** Trusted physical operations; no LogicForm permissions, rewriting, or caching. */
|
|
18
|
+
export declare const DBConnector: Readonly<{
|
|
19
|
+
runSQL: (options: RunSQLOptions) => Promise<SQLResult>;
|
|
20
|
+
getTableList: (options: GetTableListOptions) => Promise<DatabaseTable[]>;
|
|
21
|
+
describeTable: (options: DescribeTableOptions) => Promise<TableDescription>;
|
|
22
|
+
close: () => Promise<void>;
|
|
23
|
+
}>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare const displayClickHouseQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
2
2
|
export declare const displayOracleQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
3
3
|
export declare const displayPostgreSQLQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
4
|
+
export declare const displayMySQLQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
4
5
|
export declare const displayQuestionMarkQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
6
|
+
export declare const displayDamengQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
7
|
+
export declare const displaySQLServerQuery: (sql: string, parameters: readonly unknown[]) => string;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { MySQLProtocolProvider } from './mysql-protocol-provider';
|
|
2
|
-
import type { MySQLProtocolPoolLike, MySQLProtocolProviderOptions } from './mysql-protocol-provider';
|
|
2
|
+
import type { MySQLProtocolPoolLike, MySQLProtocolConnectionOptions, MySQLProtocolProviderOptions } from './mysql-protocol-provider';
|
|
3
3
|
export type DorisPoolLike = MySQLProtocolPoolLike;
|
|
4
|
+
export type DorisConnectionOptions = MySQLProtocolConnectionOptions;
|
|
4
5
|
export type DorisProviderOptions = MySQLProtocolProviderOptions;
|
|
5
6
|
/** Doris adapter using its MySQL-compatible protocol and SQL surface. */
|
|
6
7
|
export declare class DorisProvider extends MySQLProtocolProvider {
|
|
7
8
|
readonly kind: "doris";
|
|
8
9
|
constructor(options?: DorisProviderOptions);
|
|
10
|
+
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
11
|
+
expandArray(arrayExpression: string, alias: string, column: string): {
|
|
12
|
+
readonly joinSql: string;
|
|
13
|
+
readonly valueExpression: string;
|
|
14
|
+
};
|
|
9
15
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CoreComputeProvider, DataRow, DatePart, ProviderExecutionRequest } from './provider';
|
|
2
|
+
export type DuckDBCoordinatorColumnKind = 'boolean' | 'date' | 'number' | 'string';
|
|
3
|
+
export interface DuckDBCoordinatorColumn {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly kind: DuckDBCoordinatorColumnKind;
|
|
6
|
+
}
|
|
7
|
+
/** In-process SQL engine used only to combine results from separate physical connections. */
|
|
8
|
+
export declare class DuckDBCoordinatorProvider implements CoreComputeProvider {
|
|
9
|
+
private readonly instance;
|
|
10
|
+
private readonly connection;
|
|
11
|
+
readonly kind: "duckdb";
|
|
12
|
+
readonly supportsHavingAlias = true;
|
|
13
|
+
readonly supportsRecursiveCte = true;
|
|
14
|
+
static create(): Promise<DuckDBCoordinatorProvider>;
|
|
15
|
+
private constructor();
|
|
16
|
+
quoteIdentifier(identifier: string): string;
|
|
17
|
+
tableAlias(expression: string, alias: string): string;
|
|
18
|
+
paginate(sql: string, pageSize: number, offset: number): string;
|
|
19
|
+
parameter(index: number, value: unknown): string;
|
|
20
|
+
displayQuery(sql: string, parameters: readonly unknown[]): string;
|
|
21
|
+
dateBucket(expression: string, level: string): string;
|
|
22
|
+
datePart(expression: string, part: DatePart): string;
|
|
23
|
+
dateShift(expression: string, granularity: string, offset: number): string;
|
|
24
|
+
datePeriodBoundary(expression: string, granularity: string, boundary: 'start' | 'end'): string;
|
|
25
|
+
castValue(expression: string, type: string): string;
|
|
26
|
+
scalarExtremum(operator: 'least' | 'greatest', expressions: readonly string[]): string;
|
|
27
|
+
aggregateFunction(name: string, expression?: string): string;
|
|
28
|
+
stringify(expression: string): string;
|
|
29
|
+
concat(expressions: readonly string[]): string;
|
|
30
|
+
substring(expression: string, start: number, length: number): string;
|
|
31
|
+
stringLength(expression: string): string;
|
|
32
|
+
regex(expression: string, pattern: string, options?: string): string;
|
|
33
|
+
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
34
|
+
materialize(tableName: string, inputColumns: readonly DuckDBCoordinatorColumn[], rows: readonly DataRow[]): Promise<void>;
|
|
35
|
+
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
36
|
+
close(): Promise<void>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MySQLProtocolProvider } from './mysql-protocol-provider';
|
|
2
|
+
import type { MySQLProtocolConnectionOptions, MySQLProtocolPoolLike, MySQLProtocolProviderOptions } from './mysql-protocol-provider';
|
|
3
|
+
export type GBasePoolLike = MySQLProtocolPoolLike;
|
|
4
|
+
export type GBaseConnectionOptions = MySQLProtocolConnectionOptions;
|
|
5
|
+
export type GBaseProviderOptions = MySQLProtocolProviderOptions;
|
|
6
|
+
/** GBase 8a adapter using its MySQL-compatible protocol and SQL surface. */
|
|
7
|
+
export declare class GBaseProvider extends MySQLProtocolProvider {
|
|
8
|
+
readonly kind: "gbase";
|
|
9
|
+
readonly supportsRecursiveCte = false;
|
|
10
|
+
constructor(options?: GBaseProviderOptions);
|
|
11
|
+
}
|
package/dist/physical/index.d.ts
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
/** Internal physical adapters selected from the public database connection configuration. */
|
|
2
|
-
export type { CoreComputeProvider, DataRow, ProviderExecutionRequest, SqlRenderCapabilities, SqlParameters, } from './provider';
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
2
|
+
export type { CoreComputeProvider, DatePart, DataRow, DatabaseTable, SQLResult, TableListRequest, DescribeTableRequest, DatabaseColumn, TableDescription, ProviderExecutionRequest, ProviderKind, ProviderKindExtensions, SqlRenderCapabilities, SqlParameters, } from './provider';
|
|
3
|
+
export { ConnectionRegistry, getConnectionProvider, closeConnections } from './connection-registry';
|
|
4
|
+
export { DBConnector } from './db-connector';
|
|
5
|
+
export type { DBConnectorOptions, RunSQLOptions, GetTableListOptions, DescribeTableOptions } from './db-connector';
|
|
6
|
+
export { builtinProviderDefinitions, createProvider, defaultProviderRegistry, ProviderRegistry, } from './connection';
|
|
7
|
+
export type { BuiltinDatabaseConnection, DatabaseConnection, DatabaseConnectionBase, DatabaseConnectionExtensions, ProviderDefinition, } from './connection';
|
|
8
|
+
export { DuckDBCoordinatorProvider } from './duckdb-coordinator-provider';
|
|
9
|
+
export type { DuckDBCoordinatorColumn, DuckDBCoordinatorColumnKind, } from './duckdb-coordinator-provider';
|
|
5
10
|
export { ClickHouseProvider, } from './clickhouse-provider';
|
|
6
11
|
export type { ClickHouseClientLike, ClickHouseProviderOptions, } from './clickhouse-provider';
|
|
12
|
+
export { DatabricksProvider } from './databricks-provider';
|
|
13
|
+
export type { DatabricksClientLike, DatabricksConnectionBase, DatabricksConnectionOptions, DatabricksAccessTokenAuth, DatabricksOAuthAuth, DatabricksProviderOptions, DatabricksSessionLike, DatabricksOperationLike, } from './databricks-provider';
|
|
14
|
+
export { DamengProvider } from './dameng-provider';
|
|
15
|
+
export type { DamengConnectionLike, DamengConnectionOptions, DamengDriverLike, DamengPoolLike, DamengPoolOptions, DamengProviderOptions, } from './dameng-provider';
|
|
7
16
|
export { DorisProvider } from './doris-provider';
|
|
8
|
-
export type { DorisPoolLike, DorisProviderOptions } from './doris-provider';
|
|
17
|
+
export type { DorisConnectionOptions, DorisPoolLike, DorisProviderOptions } from './doris-provider';
|
|
18
|
+
export { GBaseProvider } from './gbase-provider';
|
|
19
|
+
export type { GBaseConnectionOptions, GBasePoolLike, GBaseProviderOptions } from './gbase-provider';
|
|
20
|
+
export { MaxComputeProvider } from './maxcompute-provider';
|
|
21
|
+
export type { MaxComputeClientLike, MaxComputeConnectionOptions, MaxComputeProviderOptions, } from './maxcompute-provider';
|
|
9
22
|
export { MySQLProvider } from './mysql-provider';
|
|
10
|
-
export type { MySQLPoolLike, MySQLProviderOptions } from './mysql-provider';
|
|
23
|
+
export type { MySQLConnectionOptions, MySQLPoolLike, MySQLProviderOptions } from './mysql-provider';
|
|
11
24
|
export { OracleProvider } from './oracle-provider';
|
|
12
|
-
export type { OracleConnectionLike, OracleDriverLike, OraclePoolLike, OracleProviderOptions, } from './oracle-provider';
|
|
25
|
+
export type { OracleConnectionLike, OracleConnectionOptions, OracleDriverLike, OraclePoolLike, OracleProviderOptions, } from './oracle-provider';
|
|
13
26
|
export { PostgreSQLProvider } from './postgresql-provider';
|
|
14
|
-
export type { PostgreSQLPoolLike, PostgreSQLProviderOptions, } from './postgresql-provider';
|
|
27
|
+
export type { PostgreSQLPoolLike, PostgreSQLConnectionOptions, PostgreSQLProviderOptions, } from './postgresql-provider';
|
|
15
28
|
export { SnowflakeProvider } from './snowflake-provider';
|
|
16
|
-
export type { SnowflakeConnectionLike, SnowflakeProviderOptions, SnowflakeStatementLike, } from './snowflake-provider';
|
|
29
|
+
export type { SnowflakeConnectionLike, SnowflakeConnectionOptions, SnowflakeProviderOptions, SnowflakeStatementLike, } from './snowflake-provider';
|
|
30
|
+
export { SQLServerProvider, sqlServerPoolOptions } from './sqlserver-provider';
|
|
31
|
+
export type { SQLServerConnectionOptions, SQLServerDriverLike, SQLServerPoolLike, SQLServerProviderOptions, SQLServerRequestLike, } from './sqlserver-provider';
|
|
17
32
|
export { StarRocksProvider } from './starrocks-provider';
|
|
18
|
-
export type { StarRocksPoolLike, StarRocksProviderOptions, } from './starrocks-provider';
|
|
33
|
+
export type { StarRocksPoolLike, StarRocksConnectionOptions, StarRocksProviderOptions, } from './starrocks-provider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const driverLoadError: (packageName: string, cause: unknown) => Error;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CoreComputeProvider, DataRow, DatePart, ProviderExecutionRequest, SqlParameters, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
2
|
+
/**
|
|
3
|
+
* Parameterized MaxCompute execution boundary supplied by the application.
|
|
4
|
+
* Implementations must bind `parameters`; they must not interpolate them into `sql`.
|
|
5
|
+
*/
|
|
6
|
+
export interface MaxComputeClientLike {
|
|
7
|
+
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
8
|
+
/** Optional command metadata and project/schema-aware discovery extensions. */
|
|
9
|
+
runSQL?(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
10
|
+
getTableList?(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
11
|
+
describeTable?(request: DescribeTableRequest): Promise<TableDescription>;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export interface MaxComputeConnectionOptions {
|
|
15
|
+
readonly client: MaxComputeClientLike;
|
|
16
|
+
}
|
|
17
|
+
export type MaxComputeProviderOptions = MaxComputeConnectionOptions;
|
|
18
|
+
/** MaxCompute SQL dialect backed by a caller-owned parameterized execution client. */
|
|
19
|
+
export declare class MaxComputeProvider implements CoreComputeProvider {
|
|
20
|
+
#private;
|
|
21
|
+
readonly kind: "maxcompute";
|
|
22
|
+
readonly supportsRecursiveCte = false;
|
|
23
|
+
constructor(options: MaxComputeProviderOptions);
|
|
24
|
+
quoteIdentifier(identifier: string): string;
|
|
25
|
+
tableAlias(expression: string, alias: string): string;
|
|
26
|
+
paginate(sql: string, pageSize: number, offset: number): string;
|
|
27
|
+
parameter(index: number, value: unknown): string;
|
|
28
|
+
displayQuery(sql: string, parameters: SqlParameters): string;
|
|
29
|
+
dateBucket(expression: string, level: string): string;
|
|
30
|
+
datePart(expression: string, part: DatePart): string;
|
|
31
|
+
dateShift(expression: string, granularity: string, offset: number): string;
|
|
32
|
+
datePeriodBoundary(expression: string, granularity: string, boundary: 'start' | 'end'): string;
|
|
33
|
+
aggregateFunction(name: string, expression?: string): string;
|
|
34
|
+
stringify(expression: string): string;
|
|
35
|
+
concat(expressions: readonly string[]): string;
|
|
36
|
+
substring(expression: string, start: number, length: number): string;
|
|
37
|
+
stringLength(expression: string): string;
|
|
38
|
+
regex(expression: string, pattern: string, options?: string): string;
|
|
39
|
+
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
40
|
+
runSQL(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
41
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
42
|
+
close(): Promise<void>;
|
|
43
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
44
|
+
}
|
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CoreComputeProvider, DataRow, ProviderExecutionRequest, SqlParameters } from './provider';
|
|
1
|
+
import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, SqlParameters, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
3
2
|
export interface MySQLProtocolPoolLike {
|
|
4
3
|
execute(sql: string, values: readonly unknown[]): Promise<readonly [unknown, unknown]>;
|
|
5
4
|
end(): Promise<void>;
|
|
6
5
|
}
|
|
6
|
+
export interface MySQLProtocolConnectionOptions {
|
|
7
|
+
readonly host?: string;
|
|
8
|
+
readonly port?: number;
|
|
9
|
+
readonly user?: string;
|
|
10
|
+
readonly password?: string;
|
|
11
|
+
readonly database?: string;
|
|
12
|
+
readonly connectionLimit?: number;
|
|
13
|
+
readonly maxIdle?: number;
|
|
14
|
+
readonly idleTimeout?: number;
|
|
15
|
+
readonly enableKeepAlive?: boolean;
|
|
16
|
+
readonly keepAliveInitialDelay?: number;
|
|
17
|
+
readonly decimalNumbers?: boolean;
|
|
18
|
+
readonly [option: string]: unknown;
|
|
19
|
+
}
|
|
7
20
|
export interface MySQLProtocolProviderOptions {
|
|
8
|
-
readonly connection?:
|
|
21
|
+
readonly connection?: object;
|
|
9
22
|
readonly pool?: MySQLProtocolPoolLike;
|
|
10
23
|
}
|
|
11
24
|
export declare abstract class MySQLProtocolProvider implements CoreComputeProvider {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
#private;
|
|
26
|
+
readonly supportsRecursiveCte: boolean;
|
|
27
|
+
abstract readonly kind: 'doris' | 'gbase' | 'maxcompute' | 'mysql' | 'starrocks';
|
|
15
28
|
protected constructor(options?: MySQLProtocolProviderOptions);
|
|
16
29
|
quoteIdentifier(identifier: string): string;
|
|
17
30
|
tableAlias(expression: string, alias: string): string;
|
|
@@ -19,16 +32,23 @@ export declare abstract class MySQLProtocolProvider implements CoreComputeProvid
|
|
|
19
32
|
parameter(index: number, value: unknown): string;
|
|
20
33
|
displayQuery(sql: string, parameters: SqlParameters): string;
|
|
21
34
|
dateBucket(expression: string, level: string): string;
|
|
35
|
+
datePart(expression: string, part: DatePart): string;
|
|
22
36
|
dateShift(expression: string, granularity: string, offset: number): string;
|
|
37
|
+
datePeriodBoundary(expression: string, granularity: string, boundary: 'start' | 'end'): string;
|
|
23
38
|
aggregateFunction(name: string, expression?: string): string;
|
|
39
|
+
stringify(expression: string): string;
|
|
24
40
|
concat(expressions: readonly string[]): string;
|
|
25
41
|
substring(expression: string, start: number, length: number): string;
|
|
42
|
+
stringLength(expression: string): string;
|
|
26
43
|
regex(expression: string, pattern: string, options?: string): string;
|
|
27
44
|
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
28
|
-
expandArray(arrayExpression: string, alias: string, column: string): {
|
|
45
|
+
expandArray(arrayExpression: string, alias: string, column: string, elementType?: 'string'): {
|
|
29
46
|
readonly joinSql: string;
|
|
30
47
|
readonly valueExpression: string;
|
|
31
48
|
};
|
|
32
49
|
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
50
|
+
runSQL(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
51
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
52
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
33
53
|
close(): Promise<void>;
|
|
34
54
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MySQLProtocolProvider } from './mysql-protocol-provider';
|
|
2
|
-
import type { MySQLProtocolPoolLike, MySQLProtocolProviderOptions } from './mysql-protocol-provider';
|
|
2
|
+
import type { MySQLProtocolPoolLike, MySQLProtocolConnectionOptions, MySQLProtocolProviderOptions } from './mysql-protocol-provider';
|
|
3
3
|
export type MySQLPoolLike = MySQLProtocolPoolLike;
|
|
4
|
+
export type MySQLConnectionOptions = MySQLProtocolConnectionOptions;
|
|
4
5
|
export type MySQLProviderOptions = MySQLProtocolProviderOptions;
|
|
5
6
|
export declare class MySQLProvider extends MySQLProtocolProvider {
|
|
6
7
|
readonly kind: "mysql";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CoreComputeProvider, DataRow, ProviderExecutionRequest } from './provider';
|
|
1
|
+
import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
3
2
|
type OracleBind = string | number | boolean | Date | Buffer | null;
|
|
4
3
|
export interface OracleConnectionLike {
|
|
5
4
|
execute(sql: string, binds: OracleBind[], options: {
|
|
6
5
|
readonly outFormat: number;
|
|
6
|
+
readonly autoCommit?: boolean;
|
|
7
7
|
}): Promise<{
|
|
8
8
|
readonly rows?: unknown[] | undefined;
|
|
9
|
+
readonly rowsAffected?: number | undefined;
|
|
9
10
|
}>;
|
|
10
11
|
break(): Promise<void>;
|
|
11
12
|
close(): Promise<void>;
|
|
@@ -14,12 +15,22 @@ export interface OraclePoolLike {
|
|
|
14
15
|
getConnection(): Promise<OracleConnectionLike>;
|
|
15
16
|
close(drainTime?: number): Promise<void>;
|
|
16
17
|
}
|
|
18
|
+
export interface OracleConnectionOptions {
|
|
19
|
+
readonly user?: string;
|
|
20
|
+
readonly password?: string;
|
|
21
|
+
readonly connectString?: string;
|
|
22
|
+
readonly poolMin?: number;
|
|
23
|
+
readonly poolMax?: number;
|
|
24
|
+
readonly poolIncrement?: number;
|
|
25
|
+
readonly poolTimeout?: number;
|
|
26
|
+
readonly [option: string]: unknown;
|
|
27
|
+
}
|
|
17
28
|
export interface OracleDriverLike {
|
|
18
|
-
createPool(options:
|
|
29
|
+
createPool(options: OracleConnectionOptions): Promise<OraclePoolLike>;
|
|
19
30
|
}
|
|
20
31
|
export interface OracleProviderOptions {
|
|
21
32
|
/** Passed to oracledb.createPool(). Thin mode is used unless the caller initialized Thick mode. */
|
|
22
|
-
readonly connection?:
|
|
33
|
+
readonly connection?: object;
|
|
23
34
|
/** Injectable pool for applications that own pool creation or for tests. */
|
|
24
35
|
readonly pool?: OraclePoolLike;
|
|
25
36
|
/** Injectable driver factory used to test lazy pool creation. */
|
|
@@ -37,10 +48,13 @@ export declare class OracleProvider implements CoreComputeProvider {
|
|
|
37
48
|
parameter(index: number, value: unknown): string;
|
|
38
49
|
displayQuery(sql: string, parameters: readonly unknown[]): string;
|
|
39
50
|
dateBucket(expression: string, level: string): string;
|
|
51
|
+
datePart(expression: string, part: DatePart): string;
|
|
40
52
|
dateShift(expression: string, granularity: string, offset: number): string;
|
|
41
53
|
aggregateFunction(name: string, expression?: string): string;
|
|
54
|
+
stringify(expression: string): string;
|
|
42
55
|
concat(expressions: readonly string[]): string;
|
|
43
56
|
substring(expression: string, start: number, length: number): string;
|
|
57
|
+
stringLength(expression: string): string;
|
|
44
58
|
regex(expression: string, pattern: string, options?: string): string;
|
|
45
59
|
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
46
60
|
expandArray(arrayExpression: string, alias: string, column: string): {
|
|
@@ -48,6 +62,9 @@ export declare class OracleProvider implements CoreComputeProvider {
|
|
|
48
62
|
valueExpression: string;
|
|
49
63
|
};
|
|
50
64
|
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
65
|
+
runSQL(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
66
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
67
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
51
68
|
close(): Promise<void>;
|
|
52
69
|
}
|
|
53
70
|
export {};
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CoreComputeProvider, DataRow, ProviderExecutionRequest } from './provider';
|
|
1
|
+
import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest, SQLResult, DatabaseTable, TableListRequest, DescribeTableRequest, TableDescription } from './provider';
|
|
3
2
|
export interface PostgreSQLPoolLike {
|
|
4
3
|
query(sql: string, values: unknown[]): Promise<{
|
|
5
4
|
readonly rows: unknown;
|
|
5
|
+
readonly rowCount?: number | null;
|
|
6
|
+
readonly command?: string;
|
|
6
7
|
}>;
|
|
7
8
|
end(): Promise<void>;
|
|
8
9
|
}
|
|
10
|
+
export interface PostgreSQLConnectionOptions {
|
|
11
|
+
readonly connectionString?: string;
|
|
12
|
+
readonly host?: string;
|
|
13
|
+
readonly port?: number;
|
|
14
|
+
readonly user?: string;
|
|
15
|
+
readonly password?: string;
|
|
16
|
+
readonly database?: string;
|
|
17
|
+
readonly ssl?: unknown;
|
|
18
|
+
readonly max?: number;
|
|
19
|
+
readonly idleTimeoutMillis?: number;
|
|
20
|
+
readonly connectionTimeoutMillis?: number;
|
|
21
|
+
readonly [option: string]: unknown;
|
|
22
|
+
}
|
|
9
23
|
export interface PostgreSQLProviderOptions {
|
|
10
|
-
readonly connection?:
|
|
24
|
+
readonly connection?: object;
|
|
11
25
|
readonly pool?: PostgreSQLPoolLike;
|
|
12
26
|
}
|
|
13
27
|
export declare class PostgreSQLProvider implements CoreComputeProvider {
|
|
28
|
+
#private;
|
|
14
29
|
readonly kind: "postgresql";
|
|
15
30
|
readonly supportsHavingAlias = false;
|
|
16
31
|
readonly supportsRecursiveCte = true;
|
|
17
|
-
private readonly pool;
|
|
18
32
|
constructor(options?: PostgreSQLProviderOptions);
|
|
19
33
|
quoteIdentifier(identifier: string): string;
|
|
20
34
|
tableAlias(expression: string, alias: string): string;
|
|
@@ -22,16 +36,23 @@ export declare class PostgreSQLProvider implements CoreComputeProvider {
|
|
|
22
36
|
parameter(index: number, value: unknown): string;
|
|
23
37
|
displayQuery(sql: string, parameters: readonly unknown[]): string;
|
|
24
38
|
dateBucket(expression: string, level: string): string;
|
|
39
|
+
datePart(expression: string, part: DatePart): string;
|
|
25
40
|
dateShift(expression: string, granularity: string, offset: number): string;
|
|
26
41
|
aggregateFunction(name: string, expression?: string): string;
|
|
42
|
+
stringify(expression: string): string;
|
|
27
43
|
concat(expressions: readonly string[]): string;
|
|
28
44
|
substring(expression: string, start: number, length: number): string;
|
|
45
|
+
stringLength(expression: string): string;
|
|
29
46
|
regex(expression: string, pattern: string, options?: string): string;
|
|
30
47
|
arrayContains(arrayExpression: string, valueExpression: string): string;
|
|
48
|
+
normalizeStringArray(expression: string): string;
|
|
31
49
|
expandArray(arrayExpression: string, alias: string, column: string): {
|
|
32
50
|
joinSql: string;
|
|
33
51
|
valueExpression: string;
|
|
34
52
|
};
|
|
35
53
|
execute(request: ProviderExecutionRequest): Promise<DataRow[]>;
|
|
54
|
+
getTableList(request: TableListRequest): Promise<DatabaseTable[]>;
|
|
55
|
+
describeTable(request: DescribeTableRequest): Promise<TableDescription>;
|
|
56
|
+
runSQL(request: ProviderExecutionRequest): Promise<SQLResult>;
|
|
36
57
|
close(): Promise<void>;
|
|
37
58
|
}
|