@akohn/dashql 0.0.19-dev.299.g3adbd8a4b → 0.0.19-dev.368.g7091b292b
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 +1 -2
- package/dist/core/api.d.ts +25 -18
- package/dist/core/api.js +45 -46
- package/dist/core/connection.d.ts +1 -1
- package/dist/core/index.d.ts +0 -4
- package/dist/core/index.js +1 -4
- package/dist/core/runtime.d.ts +1 -1
- package/dist/core/workbook.d.ts +1 -1
- package/dist/platform/compute/arrow_formatter.d.ts +3 -1
- package/dist/platform/compute/arrow_formatter.js +23 -20
- package/dist/platform/compute/computation_types.d.ts +7 -12
- package/dist/platform/compute/computation_types.js +6 -3
- package/dist/platform/compute/query_result_search_sql.d.ts +0 -7
- package/dist/platform/compute/query_result_search_sql.js +1 -19
- package/dist/platform/connections/connection_params.d.ts +5 -6
- package/dist/platform/connections/connection_params.js +14 -25
- package/dist/platform/connections/connection_state.d.ts +1 -1
- package/dist/platform/connections/connector_configs.d.ts +2 -3
- package/dist/platform/connections/connector_info.d.ts +4 -14
- package/dist/platform/connections/connector_info.js +1 -25
- package/dist/platform/connections/embedded_database_channel.d.ts +3 -3
- package/dist/platform/connections/embedded_database_channel.js +12 -6
- package/dist/platform/connections/hyper/hyper_error_info.d.ts +0 -15
- package/dist/platform/connections/hyper/hyper_error_info.js +1 -18
- package/dist/platform/connections/query_execution.js +9 -7
- package/dist/platform/connections/query_execution_args.d.ts +2 -2
- package/dist/platform/http_client.d.ts +1 -1
- package/dist/platform/logger/logger.d.ts +3 -3
- package/dist/platform/query/query_execution_state.d.ts +11 -38
- package/dist/platform/query/query_execution_state.js +6 -1
- package/dist/platform/query/query_progress.d.ts +0 -14
- package/dist/platform/query/query_result_cache.d.ts +2 -2
- package/dist/platform/storage/composite_storage_backend.d.ts +64 -0
- package/dist/platform/storage/composite_storage_backend.js +321 -0
- package/dist/platform/storage/native_storage_backend.d.ts +1 -1
- package/dist/platform/storage/native_storage_backend.js +1 -1
- package/dist/platform/storage/opfs_query_result_cache.d.ts +0 -2
- package/dist/platform/storage/opfs_query_result_cache.js +3 -5
- package/dist/platform/storage/opfs_storage_backend.d.ts +67 -0
- package/dist/platform/storage/opfs_storage_backend.js +494 -0
- package/dist/platform/storage/workbook_locator.d.ts +7 -0
- package/dist/platform/storage/workbook_locator.js +14 -0
- package/dist/platform/storage/workbook_tables.d.ts +1 -4
- package/dist/platform/storage/workbook_tables.js +3 -17
- package/dist/platform/storage/workbook_transfer.d.ts +9 -0
- package/dist/platform/storage/workbook_transfer.js +84 -0
- package/dist/platform/storage/workbook_tree.d.ts +30 -9
- package/dist/platform/storage/workbook_tree.js +17 -96
- package/dist/platform/utils/base64.js +4 -4
- package/dist/platform/web_http_client.d.ts +1 -4
- package/dist/platform/web_http_client.js +0 -5
- package/dist/platform/workbook/attachment_mounts.d.ts +12 -4
- package/dist/platform/workbook/attachment_mounts.js +69 -60
- package/dist/platform/workbook/run_events.js +1 -1
- package/dist/platform/workbook/script_compilation.d.ts +0 -1
- package/dist/platform/workbook/script_compilation.js +1 -14
- package/dist/platform/workbook/script_reference_check.js +7 -6
- package/dist/platform/workbook/script_types.d.ts +1 -1
- package/dist/platform/workbook/script_types.js +1 -10
- package/dist/platform/workbook/workbook_execution.d.ts +0 -2
- package/dist/platform/workbook/workbook_execution.js +1 -4
- package/dist/platform/workbook/workbook_inputs.d.ts +7 -7
- package/dist/platform/workbook/workbook_inputs.js +4 -4
- package/dist/platform/workbook/workbook_scripts.d.ts +2 -2
- package/dist/runtime/compute_platform.js +2 -2
- package/dist/runtime/node/node_platform.js +1 -1
- package/dist/runtime/platform_requests.js +1 -1
- package/dist/runtime/query/query_channels.d.ts +0 -2
- package/dist/runtime/query/query_channels.js +36 -55
- package/dist/runtime/run_mounts.d.ts +2 -1
- package/dist/runtime/run_mounts.js +4 -5
- package/dist/runtime/runtime.d.ts +3 -0
- package/dist/runtime/runtime.js +10 -6
- package/dist/runtime/runtime_storage.d.ts +2 -5
- package/dist/runtime/runtime_storage.js +4 -13
- package/dist/runtime/workbook_projection.js +2 -2
- package/dist/runtime/workbook_run_report.d.ts +3 -6
- package/dist/runtime/workbook_run_report.js +33 -47
- package/dist/wasm/dashql_core.d.ts +2206 -1922
- package/dist/wasm/dashql_core.js +428 -223
- package/dist/wasm/dashql_core.wasm +0 -0
- package/dist/wasm/dashql_dataflow.wasm +0 -0
- package/package.json +1 -1
- package/dist/core/format.d.ts +0 -4
- package/dist/core/format.js +0 -23
- package/dist/core/lookup.d.ts +0 -10
- package/dist/core/lookup.js +0 -129
- package/dist/core/tokens.d.ts +0 -9
- package/dist/core/tokens.js +0 -78
- package/dist/core/variant.d.ts +0 -4
- package/dist/core/variant.js +0 -0
- package/dist/platform/connections/hyper/local_cloud.d.ts +0 -15
- package/dist/platform/connections/hyper/local_cloud.js +0 -14
- package/dist/platform/connections/query_channel.d.ts +0 -3
- package/dist/platform/connections/query_channel.js +0 -11
- package/dist/platform/hyper_link_target.d.ts +0 -8
- package/dist/platform/hyper_link_target.js +0 -35
- package/dist/platform/sql/sql_format.d.ts +0 -9
- package/dist/platform/sql/sql_format.js +0 -40
- package/dist/platform/sql/sql_lint.d.ts +0 -27
- package/dist/platform/sql/sql_lint.js +0 -69
- package/dist/platform/sql/sql_report.d.ts +0 -18
- package/dist/platform/sql/sql_report.js +0 -80
- package/dist/platform/storage/storage_versions.d.ts +0 -3
- package/dist/platform/storage/storage_versions.js +0 -13
- package/dist/platform/utils/async_consumer.d.ts +0 -14
- package/dist/platform/utils/async_consumer.js +0 -24
- package/dist/platform/workbook/attachment_mirror.d.ts +0 -2
- package/dist/platform/workbook/attachment_mirror.js +0 -25
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { ConnectorType } from "../../wasm/dashql_core.js";
|
|
2
|
-
import
|
|
3
|
-
import "../../core/index.js";
|
|
4
|
-
import { CONNECTOR_INFOS } from "./connector_info.js";
|
|
2
|
+
import "./connector_info.js";
|
|
5
3
|
import { connectionParamsOf, connectorOf, connectorOfParams, connectorParams } from "./connector_descriptor.js";
|
|
6
4
|
// dist/.stage/src/platform/connections/connection_params.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
paramsCore ??= DashQL.instantiated();
|
|
10
|
-
if (paramsCore == null) throw new Error("The connection params need the core, which is not instantiated yet");
|
|
11
|
-
return paramsCore;
|
|
12
|
-
}
|
|
13
|
-
function connectionParamsWithoutDraftRows(params) {
|
|
14
|
-
return instantiatedCore().connectionParamsWithoutDraftRows(params);
|
|
5
|
+
function connectionParamsWithoutDraftRows(core, params) {
|
|
6
|
+
return core.connectionParamsWithoutDraftRows(params);
|
|
15
7
|
}
|
|
16
8
|
function sortObjectKeys(value) {
|
|
17
9
|
return value != null && typeof value === "object" && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).sort(([a], [b]) => a.localeCompare(b))) : value;
|
|
@@ -23,8 +15,8 @@ function getConnectionSetupParams(connection) {
|
|
|
23
15
|
const setupParams = connection.details.setupParams;
|
|
24
16
|
return setupParams ? connectionParamsOf(connectorOf(connection), setupParams) : null;
|
|
25
17
|
}
|
|
26
|
-
function connectionParamsHaveLoginHint(params) {
|
|
27
|
-
return params != null &&
|
|
18
|
+
function connectionParamsHaveLoginHint(core, params) {
|
|
19
|
+
return params != null && core.connectionParamsLoginHint(params) != null;
|
|
28
20
|
}
|
|
29
21
|
function newConnectionFromParams(params, options = {}) {
|
|
30
22
|
const connector = connectorOfParams(params);
|
|
@@ -36,20 +28,17 @@ function newConnectionFromParams(params, options = {}) {
|
|
|
36
28
|
};
|
|
37
29
|
}
|
|
38
30
|
function newDefaultHyperWasmConnection(options = {}) {
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
function salesforceCatalogDatabase() {
|
|
45
|
-
return instantiatedCore().salesforceCatalogDatabase();
|
|
31
|
+
return {
|
|
32
|
+
connectorType: ConnectorType.HYPER,
|
|
33
|
+
...options
|
|
34
|
+
};
|
|
46
35
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
36
|
+
function createDefaultConnectionParamsForConnector(core, info) {
|
|
37
|
+
return core.defaultConnectionParams(info.connectorType);
|
|
49
38
|
}
|
|
50
39
|
var DEFAULT_HYPER_ENDPOINT = "http://localhost:7484";
|
|
51
|
-
function createAttachedConnectionParamsForConnector(info) {
|
|
52
|
-
const params = createDefaultConnectionParamsForConnector(info);
|
|
40
|
+
function createAttachedConnectionParamsForConnector(core, info) {
|
|
41
|
+
const params = createDefaultConnectionParamsForConnector(core, info);
|
|
53
42
|
if (info.connectorType !== ConnectorType.HYPER || !("hyper" in params)) return params;
|
|
54
43
|
return {
|
|
55
44
|
...params,
|
|
@@ -60,4 +49,4 @@ function createAttachedConnectionParamsForConnector(info) {
|
|
|
60
49
|
}
|
|
61
50
|
};
|
|
62
51
|
}
|
|
63
|
-
export { DEFAULT_HYPER_ENDPOINT, connectionParamsHaveLoginHint, connectionParamsKey, connectionParamsWithoutDraftRows, createAttachedConnectionParamsForConnector, createDefaultConnectionParamsForConnector, getConnectionSetupParams,
|
|
52
|
+
export { DEFAULT_HYPER_ENDPOINT, connectionParamsHaveLoginHint, connectionParamsKey, connectionParamsWithoutDraftRows, createAttachedConnectionParamsForConnector, createDefaultConnectionParamsForConnector, getConnectionSetupParams, newConnectionFromParams, newDefaultHyperWasmConnection };
|
|
@@ -12,7 +12,7 @@ export { ConnectionHealth, ConnectionStatus };
|
|
|
12
12
|
export declare function connectorInfoOf(connection: Pick<ConnectionState, 'connectorType'>): ConnectorInfo;
|
|
13
13
|
export interface NewConnection {
|
|
14
14
|
connectorType: ConnectorType;
|
|
15
|
-
setupParams
|
|
15
|
+
setupParams?: unknown;
|
|
16
16
|
active?: boolean;
|
|
17
17
|
params?: ConnectionParams;
|
|
18
18
|
paramsDraft?: ConnectionParams;
|
|
@@ -8,11 +8,10 @@ export interface SalesforceConnectorConfig {
|
|
|
8
8
|
defaultParams?: connection.SalesforceConnectionParams;
|
|
9
9
|
mock?: SalesforceConnectorMockConfig;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
12
|
-
}
|
|
11
|
+
export type TrinoConnectorConfig = object;
|
|
13
12
|
export interface ConnectorConfigs {
|
|
14
13
|
salesforce?: SalesforceConnectorConfig;
|
|
15
14
|
hyper?: HyperConnectorConfig;
|
|
16
15
|
trino?: TrinoConnectorConfig;
|
|
17
16
|
}
|
|
18
|
-
export declare function readConnectorConfigs(configs:
|
|
17
|
+
export declare function readConnectorConfigs(configs: ConnectorConfigs): ConnectorConfigs;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { ConnectorType } from '../../core/index.js';
|
|
2
|
-
export declare const SALESFORCE_DATA_CLOUD_CONNECTOR: unique symbol;
|
|
3
|
-
export declare const HYPER_CONNECTOR: unique symbol;
|
|
4
|
-
export declare const TRINO_CONNECTOR: unique symbol;
|
|
5
|
-
export declare const DBCOM_CONNECTOR: unique symbol;
|
|
6
2
|
export { ConnectorType };
|
|
7
3
|
export declare const CONNECTOR_TYPES: ConnectorType[];
|
|
8
4
|
export interface ConnectorInfo {
|
|
9
5
|
connectorType: ConnectorType;
|
|
10
|
-
helloWorldScript: string;
|
|
11
6
|
names: {
|
|
12
7
|
displayLong: string;
|
|
13
8
|
displayShort: string;
|
|
@@ -18,16 +13,11 @@ export interface ConnectorInfo {
|
|
|
18
13
|
uncolored: string;
|
|
19
14
|
outlines: string;
|
|
20
15
|
};
|
|
21
|
-
platforms: ConnectorPlatforms;
|
|
22
|
-
}
|
|
23
|
-
export interface ConnectorPlatforms {
|
|
24
|
-
browser: boolean;
|
|
25
|
-
native: boolean;
|
|
26
16
|
}
|
|
27
17
|
export declare const CONNECTOR_INFOS: ConnectorInfo[];
|
|
28
18
|
export declare function getConnectorInfoForParams(params: {
|
|
29
|
-
hyper?:
|
|
30
|
-
salesforce?:
|
|
31
|
-
dbcom?:
|
|
32
|
-
trino?:
|
|
19
|
+
hyper?: unknown;
|
|
20
|
+
salesforce?: unknown;
|
|
21
|
+
dbcom?: unknown;
|
|
22
|
+
trino?: unknown;
|
|
33
23
|
}): ConnectorInfo | null;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { ConnectorType } from "../../wasm/dashql_core.js";
|
|
2
2
|
import "../../core/index.js";
|
|
3
3
|
// dist/.stage/src/platform/connections/connector_info.ts
|
|
4
|
-
var SALESFORCE_DATA_CLOUD_CONNECTOR = Symbol("SALESFORCE_DATA_CLOUD_CONNECTOR");
|
|
5
|
-
var HYPER_CONNECTOR = Symbol("HYPER_CONNECTOR");
|
|
6
|
-
var TRINO_CONNECTOR = Symbol("TRINO_CONNECTOR");
|
|
7
|
-
var DBCOM_CONNECTOR = Symbol("DBCOM_CONNECTOR");
|
|
8
4
|
var CONNECTOR_TYPES = [
|
|
9
5
|
ConnectorType.HYPER,
|
|
10
6
|
ConnectorType.SALESFORCE_DATA_CLOUD,
|
|
@@ -14,7 +10,6 @@ var CONNECTOR_TYPES = [
|
|
|
14
10
|
var CONNECTOR_INFOS = [
|
|
15
11
|
{
|
|
16
12
|
connectorType: ConnectorType.HYPER,
|
|
17
|
-
helloWorldScript: "select version();",
|
|
18
13
|
names: {
|
|
19
14
|
displayShort: "Hyper",
|
|
20
15
|
displayLong: "Hyper",
|
|
@@ -24,15 +19,10 @@ var CONNECTOR_INFOS = [
|
|
|
24
19
|
colored: "hyper",
|
|
25
20
|
uncolored: "hyper_nocolor",
|
|
26
21
|
outlines: "hyper_outlines"
|
|
27
|
-
},
|
|
28
|
-
platforms: {
|
|
29
|
-
browser: true,
|
|
30
|
-
native: true
|
|
31
22
|
}
|
|
32
23
|
},
|
|
33
24
|
{
|
|
34
25
|
connectorType: ConnectorType.SALESFORCE_DATA_CLOUD,
|
|
35
|
-
helloWorldScript: "select version();",
|
|
36
26
|
names: {
|
|
37
27
|
displayShort: "Salesforce",
|
|
38
28
|
displayLong: "Salesforce Data Cloud",
|
|
@@ -42,15 +32,10 @@ var CONNECTOR_INFOS = [
|
|
|
42
32
|
colored: "salesforce_notext",
|
|
43
33
|
uncolored: "salesforce_notext_nocolor",
|
|
44
34
|
outlines: "salesforce_outlines"
|
|
45
|
-
},
|
|
46
|
-
platforms: {
|
|
47
|
-
browser: true,
|
|
48
|
-
native: true
|
|
49
35
|
}
|
|
50
36
|
},
|
|
51
37
|
{
|
|
52
38
|
connectorType: ConnectorType.TRINO,
|
|
53
|
-
helloWorldScript: "select version();",
|
|
54
39
|
names: {
|
|
55
40
|
displayShort: "Trino",
|
|
56
41
|
displayLong: "Trino",
|
|
@@ -60,15 +45,10 @@ var CONNECTOR_INFOS = [
|
|
|
60
45
|
colored: "trino",
|
|
61
46
|
uncolored: "trino_nocolor",
|
|
62
47
|
outlines: "trino_outlines"
|
|
63
|
-
},
|
|
64
|
-
platforms: {
|
|
65
|
-
browser: true,
|
|
66
|
-
native: true
|
|
67
48
|
}
|
|
68
49
|
},
|
|
69
50
|
{
|
|
70
51
|
connectorType: ConnectorType.DBCOM,
|
|
71
|
-
helloWorldScript: "select version();",
|
|
72
52
|
names: {
|
|
73
53
|
displayShort: "Database.com",
|
|
74
54
|
displayLong: "Database.com",
|
|
@@ -78,10 +58,6 @@ var CONNECTOR_INFOS = [
|
|
|
78
58
|
colored: "hyper_nocolor",
|
|
79
59
|
uncolored: "hyper_nocolor",
|
|
80
60
|
outlines: "hyper_outlines"
|
|
81
|
-
},
|
|
82
|
-
platforms: {
|
|
83
|
-
browser: true,
|
|
84
|
-
native: true
|
|
85
61
|
}
|
|
86
62
|
}
|
|
87
63
|
];
|
|
@@ -92,4 +68,4 @@ function getConnectorInfoForParams(params) {
|
|
|
92
68
|
if ("trino" in params) return CONNECTOR_INFOS[ConnectorType.TRINO];
|
|
93
69
|
return null;
|
|
94
70
|
}
|
|
95
|
-
export { CONNECTOR_INFOS, CONNECTOR_TYPES, ConnectorType,
|
|
71
|
+
export { CONNECTOR_INFOS, CONNECTOR_TYPES, ConnectorType, getConnectorInfoForParams };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type * as core from '../../core/index.js';
|
|
1
2
|
import type * as pb from '../proto.js';
|
|
2
3
|
import type { EmbeddedClientContext, EmbeddedConnection, EmbeddedDatabase } from '../embedded_database.js';
|
|
3
|
-
import { type
|
|
4
|
-
import { QueryExecutionResponseStream } from '../query/query_execution_state.js';
|
|
4
|
+
import { type QueryExecutionResponseStream } from '../query/query_execution_state.js';
|
|
5
5
|
import type { HyperDatabaseChannel } from './hyper/hyperdb_grpc_client.js';
|
|
6
6
|
export declare class EmbeddedDatabaseChannel {
|
|
7
7
|
private readonly connection;
|
|
@@ -17,4 +17,4 @@ export declare class EmbeddedHyperDatabaseChannel implements HyperDatabaseChanne
|
|
|
17
17
|
executeQuery(params: pb.salesforce_hyperdb_grpc_v1.pb.QueryParam, abort?: AbortSignal): Promise<QueryExecutionResponseStream>;
|
|
18
18
|
close(): Promise<void>;
|
|
19
19
|
}
|
|
20
|
-
export declare function connectEmbeddedHyper(database: EmbeddedDatabase,
|
|
20
|
+
export declare function connectEmbeddedHyper(database: EmbeddedDatabase, session: core.EmbeddedHyperSession | null, clientContext?: EmbeddedClientContext): Promise<EmbeddedHyperDatabaseChannel>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { embeddedAttachedDatabasePath } from "../hyperdb/hyperdb_opfs_instance.js";
|
|
2
|
-
import { embeddedCloudDatabases } from "./hyper/local_cloud.js";
|
|
3
2
|
import { createQueryResponseStreamMetrics } from "../query/query_execution_state.js";
|
|
4
3
|
import { yieldToBrowser } from "../utils/yield_to_browser.js";
|
|
5
4
|
// dist/.stage/src/platform/connections/embedded_database_channel.ts
|
|
@@ -32,7 +31,7 @@ var EmbeddedQueryResultStream = class {
|
|
|
32
31
|
async getSchema() {
|
|
33
32
|
return this.reader.schema;
|
|
34
33
|
}
|
|
35
|
-
async
|
|
34
|
+
async *read(abort) {
|
|
36
35
|
try {
|
|
37
36
|
for (;;) {
|
|
38
37
|
abort?.throwIfAborted();
|
|
@@ -43,7 +42,10 @@ var EmbeddedQueryResultStream = class {
|
|
|
43
42
|
this.metrics.totalDataBytesReceived += batch.data.byteLength;
|
|
44
43
|
this.metrics.totalBatchesReceived += 1;
|
|
45
44
|
this.metrics.totalRowsReceived += batch.numRows;
|
|
46
|
-
|
|
45
|
+
yield {
|
|
46
|
+
type: "batch",
|
|
47
|
+
batch
|
|
48
|
+
};
|
|
47
49
|
if (this.metrics.totalBatchesReceived % STREAM_YIELD_INTERVAL === 0) await yieldToBrowser();
|
|
48
50
|
}
|
|
49
51
|
this.metrics.totalQueryRequestsSucceeded = 1;
|
|
@@ -52,6 +54,10 @@ var EmbeddedQueryResultStream = class {
|
|
|
52
54
|
await this.reader.cancel().catch(() => {});
|
|
53
55
|
throw error;
|
|
54
56
|
} finally {
|
|
57
|
+
if (this.metrics.totalQueryRequestsSucceeded === 0 && this.metrics.totalQueryRequestsFailed === 0) {
|
|
58
|
+
this.metrics.totalQueryRequestsFailed = 1;
|
|
59
|
+
await this.reader.cancel().catch(() => {});
|
|
60
|
+
}
|
|
55
61
|
this.metrics.totalQueryRequestDurationMs = performance.now() - this.startedAt;
|
|
56
62
|
this.resolveFinished();
|
|
57
63
|
}
|
|
@@ -119,13 +125,13 @@ var EmbeddedHyperDatabaseChannel = class {
|
|
|
119
125
|
await this.channel.close();
|
|
120
126
|
}
|
|
121
127
|
};
|
|
122
|
-
async function connectEmbeddedHyper(database,
|
|
123
|
-
const attachedDatabases = await Promise.all(
|
|
128
|
+
async function connectEmbeddedHyper(database, session, clientContext) {
|
|
129
|
+
const attachedDatabases = await Promise.all((session?.attachedDatabases ?? []).map(async (attached) => ({
|
|
124
130
|
path: await embeddedAttachedDatabasePath(attached.path),
|
|
125
131
|
alias: attached.alias
|
|
126
132
|
})));
|
|
127
133
|
return new EmbeddedHyperDatabaseChannel(new EmbeddedDatabaseChannel(await database.connect({
|
|
128
|
-
defaultDatabase:
|
|
134
|
+
defaultDatabase: session == null ? "hyper" : session.defaultDatabase,
|
|
129
135
|
attachedDatabases,
|
|
130
136
|
clientContext
|
|
131
137
|
})));
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import { LoggableException } from "../../logger/logger.js";
|
|
2
|
-
export interface QueryErrorResponse {
|
|
3
|
-
error: string;
|
|
4
|
-
message: string;
|
|
5
|
-
details?: {
|
|
6
|
-
customerHint?: string;
|
|
7
|
-
customerDetail?: string;
|
|
8
|
-
systemDetail?: string;
|
|
9
|
-
errorSource?: string;
|
|
10
|
-
position?: {
|
|
11
|
-
errorBeginCharacterOffset: string;
|
|
12
|
-
errorEndCharacterOffset: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
2
|
export declare const HEADER_GRPC_STATUS_DETAILS = "dashql-grpc-status-details-bin";
|
|
17
3
|
export declare const HEADER_GRPC_MESSAGE = "dashql-grpc-message";
|
|
18
4
|
export declare const HEADER_GRPC_STATUS = "dashql-grpc-status";
|
|
@@ -38,4 +24,3 @@ export declare class HyperQueryError extends LoggableException {
|
|
|
38
24
|
readonly info: HyperErrorInfo;
|
|
39
25
|
constructor(info: HyperErrorInfo, target?: string);
|
|
40
26
|
}
|
|
41
|
-
export declare function fromHttpErrorResponse(response: QueryErrorResponse): HyperErrorInfo;
|
|
@@ -97,21 +97,4 @@ var HyperQueryError = class extends LoggableException {
|
|
|
97
97
|
this.info = info;
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
|
|
101
|
-
function fromHttpErrorResponse(response) {
|
|
102
|
-
const details = response.details;
|
|
103
|
-
const position = details?.position ? {
|
|
104
|
-
beginCharacterOffset: Number.parseInt(details.position.errorBeginCharacterOffset),
|
|
105
|
-
endCharacterOffset: Number.parseInt(details.position.errorEndCharacterOffset)
|
|
106
|
-
} : void 0;
|
|
107
|
-
return {
|
|
108
|
-
primaryMessage: response.message || response.error,
|
|
109
|
-
sqlstate: SQLSTATE_PATTERN.test(response.error) ? response.error : void 0,
|
|
110
|
-
customerHint: details?.customerHint || void 0,
|
|
111
|
-
customerDetail: details?.customerDetail || void 0,
|
|
112
|
-
systemDetail: details?.systemDetail || void 0,
|
|
113
|
-
position,
|
|
114
|
-
errorSource: normalizeErrorSource(details?.errorSource)
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
export { HEADER_GRPC_MESSAGE, HEADER_GRPC_STATUS, HEADER_GRPC_STATUS_DETAILS, HyperQueryError, decodeGrpcErrorHeaders, decodeGrpcStatusDetails, fromHttpErrorResponse, hyperErrorInfoToKeyValues };
|
|
100
|
+
export { HEADER_GRPC_MESSAGE, HEADER_GRPC_STATUS, HEADER_GRPC_STATUS_DETAILS, HyperQueryError, decodeGrpcErrorHeaders, decodeGrpcStatusDetails, hyperErrorInfoToKeyValues };
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { AsyncConsumerLambdas } from "../utils/async_consumer.js";
|
|
2
1
|
import * as arrow from "apache-arrow";
|
|
3
2
|
// dist/.stage/src/platform/connections/query_execution.ts
|
|
4
3
|
async function consumeQueryResponseStream(args) {
|
|
5
4
|
const batches = [];
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
for await (const item of args.stream.read(args.abort)) {
|
|
6
|
+
if (item.type === "progress") {
|
|
7
|
+
args.onProgress(item.progress);
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
if (!args.publishResults) continue;
|
|
11
|
+
const batch = item.batch;
|
|
9
12
|
batches.push(batch);
|
|
10
13
|
if (args.logger && args.logContext) args.logger.debug("Received result batch", {
|
|
11
14
|
workbookId: args.logContext.workbookId,
|
|
@@ -13,9 +16,8 @@ async function consumeQueryResponseStream(args) {
|
|
|
13
16
|
batchColumns: batch.numCols.toString(),
|
|
14
17
|
batchRows: batch.numRows.toString()
|
|
15
18
|
}, args.logContext.target);
|
|
16
|
-
args.onBatch?.(batch, stream);
|
|
17
|
-
}
|
|
18
|
-
await args.stream.produce(consumeBatches, consumeProgress, args.abort);
|
|
19
|
+
args.onBatch?.(batch, args.stream);
|
|
20
|
+
}
|
|
19
21
|
args.onResultsReceived?.();
|
|
20
22
|
if (!args.publishResults) return null;
|
|
21
23
|
const schema = batches.length > 0 ? batches[0].schema : await args.stream.getSchema() ?? new arrow.Schema();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type * as core from '../../core/index.js';
|
|
2
2
|
import type * as arrow from 'apache-arrow';
|
|
3
3
|
import type { ClientFunctionCallDescription } from "./clfn_spec.js";
|
|
4
4
|
export interface QueryExecutionArgs {
|
|
@@ -11,7 +11,7 @@ export interface QueryExecutionArgs {
|
|
|
11
11
|
onLog?: (message: string) => void;
|
|
12
12
|
onTiming?: (label: string, elapsedMs: number) => void;
|
|
13
13
|
onResultsReady?: () => void;
|
|
14
|
-
metadata:
|
|
14
|
+
metadata: core.QueryMetadataView;
|
|
15
15
|
failure?: Error;
|
|
16
16
|
cacheable?: boolean;
|
|
17
17
|
refreshCache?: boolean;
|
|
@@ -13,7 +13,7 @@ export interface LoggerLike {
|
|
|
13
13
|
info(message: string, keyValues: LogKeyValues, target?: string): void;
|
|
14
14
|
warn(message: string, keyValues: LogKeyValues, target?: string): void;
|
|
15
15
|
error(message: string, keyValues: LogKeyValues, target?: string): void;
|
|
16
|
-
exception(error:
|
|
16
|
+
exception(error: unknown): void;
|
|
17
17
|
}
|
|
18
18
|
export declare class LoggableException extends Error {
|
|
19
19
|
keyValues: LogKeyValues;
|
|
@@ -36,7 +36,7 @@ export declare abstract class Logger {
|
|
|
36
36
|
info(message: string, keyValues: LogKeyValues, target?: string): void;
|
|
37
37
|
warn(message: string, keyValues: LogKeyValues, target?: string): void;
|
|
38
38
|
error(message: string, keyValues: LogKeyValues, target?: string): void;
|
|
39
|
-
exception(error:
|
|
39
|
+
exception(error: unknown): void;
|
|
40
40
|
}
|
|
41
41
|
export declare class TracedLogger {
|
|
42
42
|
private readonly base;
|
|
@@ -53,5 +53,5 @@ export declare class TracedLogger {
|
|
|
53
53
|
info(message: string, keyValues: LogKeyValues, target?: string): void;
|
|
54
54
|
warn(message: string, keyValues: LogKeyValues, target?: string): void;
|
|
55
55
|
error(message: string, keyValues: LogKeyValues, target?: string): void;
|
|
56
|
-
exception(error:
|
|
56
|
+
exception(error: unknown): void;
|
|
57
57
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as arrow from 'apache-arrow';
|
|
2
2
|
import type * as core from '../../core/index.js';
|
|
3
3
|
import { QueryExecutionStatus, QueryType } from '../../core/index.js';
|
|
4
|
-
import {
|
|
5
|
-
import type { EngineProgressPayload, QueryProfileProgress } from './query_progress.js';
|
|
4
|
+
import type { QueryProfileProgress } from './query_progress.js';
|
|
6
5
|
export { QueryExecutionStatus };
|
|
7
6
|
export declare function queryIsDone(status: QueryExecutionStatus): boolean;
|
|
8
7
|
export type QueryExecutionMetrics = core.QueryStreamMetrics;
|
|
@@ -14,51 +13,25 @@ export interface QueryExecutionProgress {
|
|
|
14
13
|
executionTimeMs: number | null;
|
|
15
14
|
metrics: QueryExecutionMetrics;
|
|
16
15
|
phase?: string | null;
|
|
17
|
-
engineProgress?: EngineProgressPayload | null;
|
|
18
16
|
profileProgress?: QueryProfileProgress | null;
|
|
19
17
|
}
|
|
18
|
+
export type QueryStreamItem = {
|
|
19
|
+
type: 'batch';
|
|
20
|
+
batch: arrow.RecordBatch;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'progress';
|
|
23
|
+
progress: QueryExecutionProgress;
|
|
24
|
+
};
|
|
20
25
|
export interface QueryExecutionResponseStream {
|
|
21
26
|
cancel?(): Promise<void>;
|
|
22
27
|
setProfileDetail?(wanted: boolean): void;
|
|
23
28
|
getMetrics(): QueryExecutionMetrics;
|
|
24
29
|
getSchema(): Promise<arrow.Schema | null>;
|
|
25
|
-
|
|
30
|
+
read(abort?: AbortSignal): AsyncIterable<QueryStreamItem>;
|
|
26
31
|
}
|
|
32
|
+
export declare function readStreamBatches(stream: QueryExecutionResponseStream, abort?: AbortSignal): Promise<arrow.RecordBatch[]>;
|
|
27
33
|
export { QueryType };
|
|
28
|
-
export
|
|
29
|
-
queryType: QueryType;
|
|
30
|
-
title: string | null;
|
|
31
|
-
description: string | null;
|
|
32
|
-
issuer: string | null;
|
|
33
|
-
userProvided: boolean;
|
|
34
|
-
workbookId?: string;
|
|
35
|
-
resultOwner?: string;
|
|
36
|
-
planned?: PlannedStatement;
|
|
37
|
-
}
|
|
38
|
-
export interface PlannedStatement {
|
|
39
|
-
run: 'workbook' | 'script';
|
|
40
|
-
target: string | null;
|
|
41
|
-
node: number;
|
|
42
|
-
script: string;
|
|
43
|
-
statement: number;
|
|
44
|
-
statements: number;
|
|
45
|
-
statementType: string;
|
|
46
|
-
result: boolean;
|
|
47
|
-
cached: boolean;
|
|
48
|
-
inlined: string[];
|
|
49
|
-
scans: Array<{
|
|
50
|
-
script: string;
|
|
51
|
-
path: string;
|
|
52
|
-
cached: boolean;
|
|
53
|
-
}>;
|
|
54
|
-
materializes: string | null;
|
|
55
|
-
after: Array<{
|
|
56
|
-
node: number;
|
|
57
|
-
reason: string;
|
|
58
|
-
}>;
|
|
59
|
-
}
|
|
60
|
-
export type QueryExecutionState = Omit<core.QueryView, 'queryMetadata'> & {
|
|
61
|
-
queryMetadata: QueryMetadata;
|
|
34
|
+
export type QueryExecutionState = core.QueryView & {
|
|
62
35
|
progress?: QueryExecutionProgress | null;
|
|
63
36
|
};
|
|
64
37
|
export declare function queryErrorDetails(error: core.QueryErrorView | null | undefined): Record<string, string> | null;
|
|
@@ -9,6 +9,11 @@ function queryIsDone(status) {
|
|
|
9
9
|
default: return false;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
async function readStreamBatches(stream, abort) {
|
|
13
|
+
const batches = [];
|
|
14
|
+
for await (const item of stream.read(abort)) if (item.type === "batch") batches.push(item.batch);
|
|
15
|
+
return batches;
|
|
16
|
+
}
|
|
12
17
|
function queryErrorDetails(error) {
|
|
13
18
|
if (error?.details == null) return null;
|
|
14
19
|
try {
|
|
@@ -30,4 +35,4 @@ function createQueryResponseStreamMetrics() {
|
|
|
30
35
|
durationUntilFirstBatchMs: null
|
|
31
36
|
};
|
|
32
37
|
}
|
|
33
|
-
export { QueryExecutionStatus, QueryType, createQueryResponseStreamMetrics, queryErrorDetails, queryIsDone };
|
|
38
|
+
export { QueryExecutionStatus, QueryType, createQueryResponseStreamMetrics, queryErrorDetails, queryIsDone, readStreamBatches };
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import * as dashql from '../../core/index.js';
|
|
2
2
|
import { ProfileExecutionState } from './profile_execution_state.js';
|
|
3
3
|
import type { QueryExecutionProgress } from './query_execution_state.js';
|
|
4
|
-
export type EngineProgressPayload = {
|
|
5
|
-
kind: 'hyper_query_status';
|
|
6
|
-
status: HyperQueryStatus;
|
|
7
|
-
receivedAt: number;
|
|
8
|
-
};
|
|
9
|
-
export interface HyperQueryStatus {
|
|
10
|
-
completionStatus: string;
|
|
11
|
-
rowCount: number | null;
|
|
12
|
-
progress: number | null;
|
|
13
|
-
executionStats: {
|
|
14
|
-
wallClockTime: number;
|
|
15
|
-
rowsProcessed: number;
|
|
16
|
-
} | null;
|
|
17
|
-
}
|
|
18
4
|
export interface QueryProgressSource {
|
|
19
5
|
readonly runtime: dashql.Runtime;
|
|
20
6
|
readonly queryId: number;
|
|
@@ -39,8 +39,8 @@ export interface QueryResultCache {
|
|
|
39
39
|
crc32?: number;
|
|
40
40
|
}): Promise<boolean>;
|
|
41
41
|
readonly capacity: {
|
|
42
|
-
maxBytes: number;
|
|
43
|
-
maxFiles: number;
|
|
42
|
+
maxBytes: number | null;
|
|
43
|
+
maxFiles: number | null;
|
|
44
44
|
};
|
|
45
45
|
fileStats(): Promise<CacheFileStat[]>;
|
|
46
46
|
remove(name: string): Promise<boolean>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type * as core from '../../core/index.js';
|
|
2
|
+
import { type WorkbookRegistryBackend, type WorkbookData, type ScriptData, type DataFile, type DataFileContent, type WorkbookEntry, type AppSettings, type ConnectionEntry, type StorageManifest, type ExpectedStamp, StorageBackendType } from './storage_backend.js';
|
|
3
|
+
import { type WorkbookTreeFolder } from './workbook_tree.js';
|
|
4
|
+
import { type FileStamp } from '../electron_fs.js';
|
|
5
|
+
import { NativeStorageBackend } from './native_storage_backend.js';
|
|
6
|
+
import { type WorkbookLocation } from './workbook_locator.js';
|
|
7
|
+
import type { Logger } from '../logger/logger.js';
|
|
8
|
+
export declare class CompositeStorageBackend implements WorkbookRegistryBackend {
|
|
9
|
+
private readonly opfs;
|
|
10
|
+
private readonly locations;
|
|
11
|
+
private tree;
|
|
12
|
+
private readonly nativeCache;
|
|
13
|
+
private readonly mirroredAttachments;
|
|
14
|
+
private readonly logger;
|
|
15
|
+
private readonly core;
|
|
16
|
+
constructor(core: core.DashQL, opfs: WorkbookRegistryBackend, logger: Logger);
|
|
17
|
+
getBackendType(): StorageBackendType;
|
|
18
|
+
initialize(): Promise<void>;
|
|
19
|
+
refreshLocations(): Promise<void>;
|
|
20
|
+
private refreshTree;
|
|
21
|
+
private locationOf;
|
|
22
|
+
private backendFor;
|
|
23
|
+
nativeWorkbookFolder(workbookId: string): NativeStorageBackend | null;
|
|
24
|
+
listWorkbooks(): Promise<WorkbookEntry[]>;
|
|
25
|
+
loadWorkbookTree(): Promise<WorkbookTreeFolder>;
|
|
26
|
+
loadAppSettings(): Promise<AppSettings | null>;
|
|
27
|
+
saveAppSettings(settings: AppSettings): Promise<void>;
|
|
28
|
+
loadManifest(): Promise<StorageManifest>;
|
|
29
|
+
updateConnections(update: (connections: ConnectionEntry[] | undefined) => ConnectionEntry[] | null): Promise<void>;
|
|
30
|
+
loadConnectionFile(connectionId: string, fileName: string): Promise<string | null>;
|
|
31
|
+
saveConnectionFile(connectionId: string, fileName: string, text: string): Promise<void>;
|
|
32
|
+
createConnectionFolder(connectionId: string): Promise<void>;
|
|
33
|
+
deleteConnectionFiles(connectionId: string): Promise<void>;
|
|
34
|
+
upsertWorkbookEntry(entry: WorkbookEntry, folderPath?: readonly string[]): Promise<void>;
|
|
35
|
+
removeWorkbookEntry(workbookId: string): Promise<void>;
|
|
36
|
+
moveWorkbook(workbookId: string, folderPath: string[], index: number): Promise<void>;
|
|
37
|
+
createFolder(path: string[]): Promise<void>;
|
|
38
|
+
moveFolder(path: string[], parentPath: string[], name?: string): Promise<void>;
|
|
39
|
+
deleteFolder(path: string[]): Promise<void>;
|
|
40
|
+
private forgetWorkbook;
|
|
41
|
+
getWorkbookTree(): WorkbookTreeFolder;
|
|
42
|
+
getWorkbookOrder(): string[];
|
|
43
|
+
deleteWorkbookFiles(workbookId: string): Promise<void>;
|
|
44
|
+
loadWorkbook(workbookId: string): Promise<WorkbookData>;
|
|
45
|
+
private syncNativeAttachments;
|
|
46
|
+
saveWorkbookManifest(workbookId: string, data: WorkbookData, expected?: ExpectedStamp): Promise<FileStamp | null>;
|
|
47
|
+
private registerSavedWorkbook;
|
|
48
|
+
deleteWorkbook(workbookId: string): Promise<void>;
|
|
49
|
+
loadScripts(workbookId: string): Promise<ScriptData[]>;
|
|
50
|
+
loadScript(workbookId: string, scriptName: string): Promise<ScriptData>;
|
|
51
|
+
saveScript(workbookId: string, scriptName: string, sql: string, expected?: ExpectedStamp): Promise<FileStamp | null>;
|
|
52
|
+
deleteScript(workbookId: string, scriptName: string, expected?: ExpectedStamp): Promise<void>;
|
|
53
|
+
renameScript(workbookId: string, oldScriptName: string, newScriptName: string, expectedFrom?: ExpectedStamp, expectedTo?: ExpectedStamp): Promise<void>;
|
|
54
|
+
listDataFiles(workbookId: string): Promise<DataFile[]>;
|
|
55
|
+
loadDataFile(workbookId: string, name: string): Promise<Uint8Array>;
|
|
56
|
+
saveDataFile(workbookId: string, name: string, content: DataFileContent): Promise<void>;
|
|
57
|
+
deleteDataFile(workbookId: string, name: string): Promise<void>;
|
|
58
|
+
renameDataFile(workbookId: string, oldName: string, newName: string): Promise<void>;
|
|
59
|
+
clearAllStorage(): Promise<void>;
|
|
60
|
+
getWorkbookLocation(workbookId: string): WorkbookLocation;
|
|
61
|
+
registerNativeWorkbook(dir: string, workbookId: string): Promise<void>;
|
|
62
|
+
importFolder(dir: string): core.RuntimeImportFolder;
|
|
63
|
+
relocateWorkbookToNative(uuid: string, dir: string): Promise<void>;
|
|
64
|
+
}
|