@514labs/moose-lib 0.6.266-ci-8-ge6e86870 → 0.6.267
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/dist/{browserCompatible-y8O70Ttx.d.mts → browserCompatible-15NCyT1P.d.mts} +1 -1
- package/dist/{browserCompatible-vY6tmKGn.d.ts → browserCompatible-BUKAJYbj.d.ts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +81 -85
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +81 -85
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/dmv2/index.d.mts +1 -1
- package/dist/dmv2/index.d.ts +1 -1
- package/dist/dmv2/index.js +81 -85
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +81 -85
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-DSzxmiN9.d.mts → index-BtkwFbT9.d.mts} +83 -62
- package/dist/{index-DSzxmiN9.d.ts → index-BtkwFbT9.d.ts} +83 -62
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +73 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -87
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +37 -29
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +37 -29
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -201,7 +201,9 @@ declare enum ClickHouseEngines {
|
|
|
201
201
|
ReplicatedMergeTree = "ReplicatedMergeTree",
|
|
202
202
|
ReplicatedReplacingMergeTree = "ReplicatedReplacingMergeTree",
|
|
203
203
|
ReplicatedAggregatingMergeTree = "ReplicatedAggregatingMergeTree",
|
|
204
|
-
ReplicatedSummingMergeTree = "ReplicatedSummingMergeTree"
|
|
204
|
+
ReplicatedSummingMergeTree = "ReplicatedSummingMergeTree",
|
|
205
|
+
ReplicatedCollapsingMergeTree = "ReplicatedCollapsingMergeTree",
|
|
206
|
+
ReplicatedVersionedCollapsingMergeTree = "ReplicatedVersionedCollapsingMergeTree"
|
|
205
207
|
}
|
|
206
208
|
/**
|
|
207
209
|
* Drops an existing view if it exists.
|
|
@@ -499,6 +501,23 @@ type SummingMergeTreeConfig<T> = BaseOlapConfig<T> & {
|
|
|
499
501
|
engine: ClickHouseEngines.SummingMergeTree;
|
|
500
502
|
columns?: string[];
|
|
501
503
|
};
|
|
504
|
+
/**
|
|
505
|
+
* Configuration for CollapsingMergeTree engine
|
|
506
|
+
* @template T The data type of the records stored in the table.
|
|
507
|
+
*/
|
|
508
|
+
type CollapsingMergeTreeConfig<T> = BaseOlapConfig<T> & {
|
|
509
|
+
engine: ClickHouseEngines.CollapsingMergeTree;
|
|
510
|
+
sign: keyof T & string;
|
|
511
|
+
};
|
|
512
|
+
/**
|
|
513
|
+
* Configuration for VersionedCollapsingMergeTree engine
|
|
514
|
+
* @template T The data type of the records stored in the table.
|
|
515
|
+
*/
|
|
516
|
+
type VersionedCollapsingMergeTreeConfig<T> = BaseOlapConfig<T> & {
|
|
517
|
+
engine: ClickHouseEngines.VersionedCollapsingMergeTree;
|
|
518
|
+
sign: keyof T & string;
|
|
519
|
+
ver: keyof T & string;
|
|
520
|
+
};
|
|
502
521
|
interface ReplicatedEngineProperties {
|
|
503
522
|
keeperPath?: string;
|
|
504
523
|
replicaName?: string;
|
|
@@ -547,6 +566,28 @@ type ReplicatedAggregatingMergeTreeConfig<T> = Omit<AggregatingMergeTreeConfig<T
|
|
|
547
566
|
type ReplicatedSummingMergeTreeConfig<T> = Omit<SummingMergeTreeConfig<T>, "engine"> & ReplicatedEngineProperties & {
|
|
548
567
|
engine: ClickHouseEngines.ReplicatedSummingMergeTree;
|
|
549
568
|
};
|
|
569
|
+
/**
|
|
570
|
+
* Configuration for ReplicatedCollapsingMergeTree engine
|
|
571
|
+
* @template T The data type of the records stored in the table.
|
|
572
|
+
*
|
|
573
|
+
* Note: keeperPath and replicaName are optional. Omit them for ClickHouse Cloud,
|
|
574
|
+
* which manages replication automatically. For self-hosted with ClickHouse Keeper,
|
|
575
|
+
* provide both parameters or neither (to use server defaults).
|
|
576
|
+
*/
|
|
577
|
+
type ReplicatedCollapsingMergeTreeConfig<T> = Omit<CollapsingMergeTreeConfig<T>, "engine"> & ReplicatedEngineProperties & {
|
|
578
|
+
engine: ClickHouseEngines.ReplicatedCollapsingMergeTree;
|
|
579
|
+
};
|
|
580
|
+
/**
|
|
581
|
+
* Configuration for ReplicatedVersionedCollapsingMergeTree engine
|
|
582
|
+
* @template T The data type of the records stored in the table.
|
|
583
|
+
*
|
|
584
|
+
* Note: keeperPath and replicaName are optional. Omit them for ClickHouse Cloud,
|
|
585
|
+
* which manages replication automatically. For self-hosted with ClickHouse Keeper,
|
|
586
|
+
* provide both parameters or neither (to use server defaults).
|
|
587
|
+
*/
|
|
588
|
+
type ReplicatedVersionedCollapsingMergeTreeConfig<T> = Omit<VersionedCollapsingMergeTreeConfig<T>, "engine"> & ReplicatedEngineProperties & {
|
|
589
|
+
engine: ClickHouseEngines.ReplicatedVersionedCollapsingMergeTree;
|
|
590
|
+
};
|
|
550
591
|
/**
|
|
551
592
|
* Configuration for S3Queue engine - only non-alterable constructor parameters.
|
|
552
593
|
* S3Queue-specific settings like 'mode', 'keeper_path', etc. should be specified
|
|
@@ -719,7 +760,7 @@ type IcebergS3Config<T> = Omit<BaseOlapConfig<T>, "orderByFields" | "orderByExpr
|
|
|
719
760
|
* @template T The data type of the records stored in the table.
|
|
720
761
|
*/
|
|
721
762
|
type LegacyOlapConfig<T> = BaseOlapConfig<T>;
|
|
722
|
-
type EngineConfig<T> = MergeTreeConfig<T> | ReplacingMergeTreeConfig<T> | AggregatingMergeTreeConfig<T> | SummingMergeTreeConfig<T> | ReplicatedMergeTreeConfig<T> | ReplicatedReplacingMergeTreeConfig<T> | ReplicatedAggregatingMergeTreeConfig<T> | ReplicatedSummingMergeTreeConfig<T> | S3QueueConfig<T> | S3Config<T> | BufferConfig<T> | DistributedConfig<T> | IcebergS3Config<T> | KafkaConfig<T>;
|
|
763
|
+
type EngineConfig<T> = MergeTreeConfig<T> | ReplacingMergeTreeConfig<T> | AggregatingMergeTreeConfig<T> | SummingMergeTreeConfig<T> | CollapsingMergeTreeConfig<T> | VersionedCollapsingMergeTreeConfig<T> | ReplicatedMergeTreeConfig<T> | ReplicatedReplacingMergeTreeConfig<T> | ReplicatedAggregatingMergeTreeConfig<T> | ReplicatedSummingMergeTreeConfig<T> | ReplicatedCollapsingMergeTreeConfig<T> | ReplicatedVersionedCollapsingMergeTreeConfig<T> | S3QueueConfig<T> | S3Config<T> | BufferConfig<T> | DistributedConfig<T> | IcebergS3Config<T> | KafkaConfig<T>;
|
|
723
764
|
/**
|
|
724
765
|
* Union of all engine-specific configurations (new API)
|
|
725
766
|
* @template T The data type of the records stored in the table.
|
|
@@ -1841,21 +1882,50 @@ declare class ETLPipeline<T, U> {
|
|
|
1841
1882
|
run(): Promise<void>;
|
|
1842
1883
|
}
|
|
1843
1884
|
|
|
1885
|
+
type SqlObject = OlapTable<any> | SqlResource;
|
|
1844
1886
|
/**
|
|
1845
|
-
* Represents a
|
|
1846
|
-
*
|
|
1887
|
+
* Represents a generic SQL resource that requires setup and teardown commands.
|
|
1888
|
+
* Base class for constructs like Views and Materialized Views. Tracks dependencies.
|
|
1847
1889
|
*/
|
|
1848
|
-
declare class
|
|
1890
|
+
declare class SqlResource {
|
|
1849
1891
|
/** @internal */
|
|
1850
|
-
readonly kind = "
|
|
1851
|
-
/**
|
|
1892
|
+
readonly kind = "SqlResource";
|
|
1893
|
+
/** Array of SQL statements to execute for setting up the resource. */
|
|
1894
|
+
setup: readonly string[];
|
|
1895
|
+
/** Array of SQL statements to execute for tearing down the resource. */
|
|
1896
|
+
teardown: readonly string[];
|
|
1897
|
+
/** The name of the SQL resource (e.g., view name, materialized view name). */
|
|
1852
1898
|
name: string;
|
|
1853
|
-
/**
|
|
1854
|
-
|
|
1855
|
-
/**
|
|
1856
|
-
|
|
1857
|
-
/** @internal Source file path where this
|
|
1899
|
+
/** List of OlapTables or Views that this resource reads data from. */
|
|
1900
|
+
pullsDataFrom: SqlObject[];
|
|
1901
|
+
/** List of OlapTables or Views that this resource writes data to. */
|
|
1902
|
+
pushesDataTo: SqlObject[];
|
|
1903
|
+
/** @internal Source file path where this resource was defined */
|
|
1858
1904
|
sourceFile?: string;
|
|
1905
|
+
/** @internal Source line number where this resource was defined */
|
|
1906
|
+
sourceLine?: number;
|
|
1907
|
+
/** @internal Source column number where this resource was defined */
|
|
1908
|
+
sourceColumn?: number;
|
|
1909
|
+
/**
|
|
1910
|
+
* Creates a new SqlResource instance.
|
|
1911
|
+
* @param name The name of the resource.
|
|
1912
|
+
* @param setup An array of SQL DDL statements to create the resource.
|
|
1913
|
+
* @param teardown An array of SQL DDL statements to drop the resource.
|
|
1914
|
+
* @param options Optional configuration for specifying data dependencies.
|
|
1915
|
+
* @param options.pullsDataFrom Tables/Views this resource reads from.
|
|
1916
|
+
* @param options.pushesDataTo Tables/Views this resource writes to.
|
|
1917
|
+
*/
|
|
1918
|
+
constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
|
|
1919
|
+
pullsDataFrom?: SqlObject[];
|
|
1920
|
+
pushesDataTo?: SqlObject[];
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
/**
|
|
1925
|
+
* Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
|
|
1926
|
+
* Inherits from SqlResource, providing setup (CREATE VIEW) and teardown (DROP VIEW) commands.
|
|
1927
|
+
*/
|
|
1928
|
+
declare class View extends SqlResource {
|
|
1859
1929
|
/**
|
|
1860
1930
|
* Creates a new View instance.
|
|
1861
1931
|
* @param name The name of the view to be created.
|
|
@@ -1901,19 +1971,9 @@ interface MaterializedViewConfig<T> {
|
|
|
1901
1971
|
*
|
|
1902
1972
|
* @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
|
|
1903
1973
|
*/
|
|
1904
|
-
declare class MaterializedView<TargetTable> {
|
|
1905
|
-
/** @internal */
|
|
1906
|
-
readonly kind = "MaterializedView";
|
|
1907
|
-
/** The name of the materialized view */
|
|
1908
|
-
name: string;
|
|
1974
|
+
declare class MaterializedView<TargetTable> extends SqlResource {
|
|
1909
1975
|
/** The target OlapTable instance where the materialized data is stored. */
|
|
1910
1976
|
targetTable: OlapTable<TargetTable>;
|
|
1911
|
-
/** The SELECT SQL statement */
|
|
1912
|
-
selectSql: string;
|
|
1913
|
-
/** Names of source tables that the SELECT reads from */
|
|
1914
|
-
sourceTables: string[];
|
|
1915
|
-
/** @internal Source file path where this MV was defined */
|
|
1916
|
-
sourceFile?: string;
|
|
1917
1977
|
/**
|
|
1918
1978
|
* Creates a new MaterializedView instance.
|
|
1919
1979
|
* Requires the `TargetTable` type parameter to be explicitly provided or inferred,
|
|
@@ -1926,45 +1986,6 @@ declare class MaterializedView<TargetTable> {
|
|
|
1926
1986
|
constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
|
|
1927
1987
|
}
|
|
1928
1988
|
|
|
1929
|
-
type SqlObject = OlapTable<any> | SqlResource;
|
|
1930
|
-
/**
|
|
1931
|
-
* Represents a generic SQL resource that requires setup and teardown commands.
|
|
1932
|
-
* Base class for constructs like Views and Materialized Views. Tracks dependencies.
|
|
1933
|
-
*/
|
|
1934
|
-
declare class SqlResource {
|
|
1935
|
-
/** @internal */
|
|
1936
|
-
readonly kind = "SqlResource";
|
|
1937
|
-
/** Array of SQL statements to execute for setting up the resource. */
|
|
1938
|
-
setup: readonly string[];
|
|
1939
|
-
/** Array of SQL statements to execute for tearing down the resource. */
|
|
1940
|
-
teardown: readonly string[];
|
|
1941
|
-
/** The name of the SQL resource (e.g., view name, materialized view name). */
|
|
1942
|
-
name: string;
|
|
1943
|
-
/** List of OlapTables or Views that this resource reads data from. */
|
|
1944
|
-
pullsDataFrom: SqlObject[];
|
|
1945
|
-
/** List of OlapTables or Views that this resource writes data to. */
|
|
1946
|
-
pushesDataTo: SqlObject[];
|
|
1947
|
-
/** @internal Source file path where this resource was defined */
|
|
1948
|
-
sourceFile?: string;
|
|
1949
|
-
/** @internal Source line number where this resource was defined */
|
|
1950
|
-
sourceLine?: number;
|
|
1951
|
-
/** @internal Source column number where this resource was defined */
|
|
1952
|
-
sourceColumn?: number;
|
|
1953
|
-
/**
|
|
1954
|
-
* Creates a new SqlResource instance.
|
|
1955
|
-
* @param name The name of the resource.
|
|
1956
|
-
* @param setup An array of SQL DDL statements to create the resource.
|
|
1957
|
-
* @param teardown An array of SQL DDL statements to drop the resource.
|
|
1958
|
-
* @param options Optional configuration for specifying data dependencies.
|
|
1959
|
-
* @param options.pullsDataFrom Tables/Views this resource reads from.
|
|
1960
|
-
* @param options.pushesDataTo Tables/Views this resource writes to.
|
|
1961
|
-
*/
|
|
1962
|
-
constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
|
|
1963
|
-
pullsDataFrom?: SqlObject[];
|
|
1964
|
-
pushesDataTo?: SqlObject[];
|
|
1965
|
-
});
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
1989
|
type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
|
|
1969
1990
|
interface FrameworkApp {
|
|
1970
1991
|
handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
|
|
@@ -201,7 +201,9 @@ declare enum ClickHouseEngines {
|
|
|
201
201
|
ReplicatedMergeTree = "ReplicatedMergeTree",
|
|
202
202
|
ReplicatedReplacingMergeTree = "ReplicatedReplacingMergeTree",
|
|
203
203
|
ReplicatedAggregatingMergeTree = "ReplicatedAggregatingMergeTree",
|
|
204
|
-
ReplicatedSummingMergeTree = "ReplicatedSummingMergeTree"
|
|
204
|
+
ReplicatedSummingMergeTree = "ReplicatedSummingMergeTree",
|
|
205
|
+
ReplicatedCollapsingMergeTree = "ReplicatedCollapsingMergeTree",
|
|
206
|
+
ReplicatedVersionedCollapsingMergeTree = "ReplicatedVersionedCollapsingMergeTree"
|
|
205
207
|
}
|
|
206
208
|
/**
|
|
207
209
|
* Drops an existing view if it exists.
|
|
@@ -499,6 +501,23 @@ type SummingMergeTreeConfig<T> = BaseOlapConfig<T> & {
|
|
|
499
501
|
engine: ClickHouseEngines.SummingMergeTree;
|
|
500
502
|
columns?: string[];
|
|
501
503
|
};
|
|
504
|
+
/**
|
|
505
|
+
* Configuration for CollapsingMergeTree engine
|
|
506
|
+
* @template T The data type of the records stored in the table.
|
|
507
|
+
*/
|
|
508
|
+
type CollapsingMergeTreeConfig<T> = BaseOlapConfig<T> & {
|
|
509
|
+
engine: ClickHouseEngines.CollapsingMergeTree;
|
|
510
|
+
sign: keyof T & string;
|
|
511
|
+
};
|
|
512
|
+
/**
|
|
513
|
+
* Configuration for VersionedCollapsingMergeTree engine
|
|
514
|
+
* @template T The data type of the records stored in the table.
|
|
515
|
+
*/
|
|
516
|
+
type VersionedCollapsingMergeTreeConfig<T> = BaseOlapConfig<T> & {
|
|
517
|
+
engine: ClickHouseEngines.VersionedCollapsingMergeTree;
|
|
518
|
+
sign: keyof T & string;
|
|
519
|
+
ver: keyof T & string;
|
|
520
|
+
};
|
|
502
521
|
interface ReplicatedEngineProperties {
|
|
503
522
|
keeperPath?: string;
|
|
504
523
|
replicaName?: string;
|
|
@@ -547,6 +566,28 @@ type ReplicatedAggregatingMergeTreeConfig<T> = Omit<AggregatingMergeTreeConfig<T
|
|
|
547
566
|
type ReplicatedSummingMergeTreeConfig<T> = Omit<SummingMergeTreeConfig<T>, "engine"> & ReplicatedEngineProperties & {
|
|
548
567
|
engine: ClickHouseEngines.ReplicatedSummingMergeTree;
|
|
549
568
|
};
|
|
569
|
+
/**
|
|
570
|
+
* Configuration for ReplicatedCollapsingMergeTree engine
|
|
571
|
+
* @template T The data type of the records stored in the table.
|
|
572
|
+
*
|
|
573
|
+
* Note: keeperPath and replicaName are optional. Omit them for ClickHouse Cloud,
|
|
574
|
+
* which manages replication automatically. For self-hosted with ClickHouse Keeper,
|
|
575
|
+
* provide both parameters or neither (to use server defaults).
|
|
576
|
+
*/
|
|
577
|
+
type ReplicatedCollapsingMergeTreeConfig<T> = Omit<CollapsingMergeTreeConfig<T>, "engine"> & ReplicatedEngineProperties & {
|
|
578
|
+
engine: ClickHouseEngines.ReplicatedCollapsingMergeTree;
|
|
579
|
+
};
|
|
580
|
+
/**
|
|
581
|
+
* Configuration for ReplicatedVersionedCollapsingMergeTree engine
|
|
582
|
+
* @template T The data type of the records stored in the table.
|
|
583
|
+
*
|
|
584
|
+
* Note: keeperPath and replicaName are optional. Omit them for ClickHouse Cloud,
|
|
585
|
+
* which manages replication automatically. For self-hosted with ClickHouse Keeper,
|
|
586
|
+
* provide both parameters or neither (to use server defaults).
|
|
587
|
+
*/
|
|
588
|
+
type ReplicatedVersionedCollapsingMergeTreeConfig<T> = Omit<VersionedCollapsingMergeTreeConfig<T>, "engine"> & ReplicatedEngineProperties & {
|
|
589
|
+
engine: ClickHouseEngines.ReplicatedVersionedCollapsingMergeTree;
|
|
590
|
+
};
|
|
550
591
|
/**
|
|
551
592
|
* Configuration for S3Queue engine - only non-alterable constructor parameters.
|
|
552
593
|
* S3Queue-specific settings like 'mode', 'keeper_path', etc. should be specified
|
|
@@ -719,7 +760,7 @@ type IcebergS3Config<T> = Omit<BaseOlapConfig<T>, "orderByFields" | "orderByExpr
|
|
|
719
760
|
* @template T The data type of the records stored in the table.
|
|
720
761
|
*/
|
|
721
762
|
type LegacyOlapConfig<T> = BaseOlapConfig<T>;
|
|
722
|
-
type EngineConfig<T> = MergeTreeConfig<T> | ReplacingMergeTreeConfig<T> | AggregatingMergeTreeConfig<T> | SummingMergeTreeConfig<T> | ReplicatedMergeTreeConfig<T> | ReplicatedReplacingMergeTreeConfig<T> | ReplicatedAggregatingMergeTreeConfig<T> | ReplicatedSummingMergeTreeConfig<T> | S3QueueConfig<T> | S3Config<T> | BufferConfig<T> | DistributedConfig<T> | IcebergS3Config<T> | KafkaConfig<T>;
|
|
763
|
+
type EngineConfig<T> = MergeTreeConfig<T> | ReplacingMergeTreeConfig<T> | AggregatingMergeTreeConfig<T> | SummingMergeTreeConfig<T> | CollapsingMergeTreeConfig<T> | VersionedCollapsingMergeTreeConfig<T> | ReplicatedMergeTreeConfig<T> | ReplicatedReplacingMergeTreeConfig<T> | ReplicatedAggregatingMergeTreeConfig<T> | ReplicatedSummingMergeTreeConfig<T> | ReplicatedCollapsingMergeTreeConfig<T> | ReplicatedVersionedCollapsingMergeTreeConfig<T> | S3QueueConfig<T> | S3Config<T> | BufferConfig<T> | DistributedConfig<T> | IcebergS3Config<T> | KafkaConfig<T>;
|
|
723
764
|
/**
|
|
724
765
|
* Union of all engine-specific configurations (new API)
|
|
725
766
|
* @template T The data type of the records stored in the table.
|
|
@@ -1841,21 +1882,50 @@ declare class ETLPipeline<T, U> {
|
|
|
1841
1882
|
run(): Promise<void>;
|
|
1842
1883
|
}
|
|
1843
1884
|
|
|
1885
|
+
type SqlObject = OlapTable<any> | SqlResource;
|
|
1844
1886
|
/**
|
|
1845
|
-
* Represents a
|
|
1846
|
-
*
|
|
1887
|
+
* Represents a generic SQL resource that requires setup and teardown commands.
|
|
1888
|
+
* Base class for constructs like Views and Materialized Views. Tracks dependencies.
|
|
1847
1889
|
*/
|
|
1848
|
-
declare class
|
|
1890
|
+
declare class SqlResource {
|
|
1849
1891
|
/** @internal */
|
|
1850
|
-
readonly kind = "
|
|
1851
|
-
/**
|
|
1892
|
+
readonly kind = "SqlResource";
|
|
1893
|
+
/** Array of SQL statements to execute for setting up the resource. */
|
|
1894
|
+
setup: readonly string[];
|
|
1895
|
+
/** Array of SQL statements to execute for tearing down the resource. */
|
|
1896
|
+
teardown: readonly string[];
|
|
1897
|
+
/** The name of the SQL resource (e.g., view name, materialized view name). */
|
|
1852
1898
|
name: string;
|
|
1853
|
-
/**
|
|
1854
|
-
|
|
1855
|
-
/**
|
|
1856
|
-
|
|
1857
|
-
/** @internal Source file path where this
|
|
1899
|
+
/** List of OlapTables or Views that this resource reads data from. */
|
|
1900
|
+
pullsDataFrom: SqlObject[];
|
|
1901
|
+
/** List of OlapTables or Views that this resource writes data to. */
|
|
1902
|
+
pushesDataTo: SqlObject[];
|
|
1903
|
+
/** @internal Source file path where this resource was defined */
|
|
1858
1904
|
sourceFile?: string;
|
|
1905
|
+
/** @internal Source line number where this resource was defined */
|
|
1906
|
+
sourceLine?: number;
|
|
1907
|
+
/** @internal Source column number where this resource was defined */
|
|
1908
|
+
sourceColumn?: number;
|
|
1909
|
+
/**
|
|
1910
|
+
* Creates a new SqlResource instance.
|
|
1911
|
+
* @param name The name of the resource.
|
|
1912
|
+
* @param setup An array of SQL DDL statements to create the resource.
|
|
1913
|
+
* @param teardown An array of SQL DDL statements to drop the resource.
|
|
1914
|
+
* @param options Optional configuration for specifying data dependencies.
|
|
1915
|
+
* @param options.pullsDataFrom Tables/Views this resource reads from.
|
|
1916
|
+
* @param options.pushesDataTo Tables/Views this resource writes to.
|
|
1917
|
+
*/
|
|
1918
|
+
constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
|
|
1919
|
+
pullsDataFrom?: SqlObject[];
|
|
1920
|
+
pushesDataTo?: SqlObject[];
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
/**
|
|
1925
|
+
* Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
|
|
1926
|
+
* Inherits from SqlResource, providing setup (CREATE VIEW) and teardown (DROP VIEW) commands.
|
|
1927
|
+
*/
|
|
1928
|
+
declare class View extends SqlResource {
|
|
1859
1929
|
/**
|
|
1860
1930
|
* Creates a new View instance.
|
|
1861
1931
|
* @param name The name of the view to be created.
|
|
@@ -1901,19 +1971,9 @@ interface MaterializedViewConfig<T> {
|
|
|
1901
1971
|
*
|
|
1902
1972
|
* @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
|
|
1903
1973
|
*/
|
|
1904
|
-
declare class MaterializedView<TargetTable> {
|
|
1905
|
-
/** @internal */
|
|
1906
|
-
readonly kind = "MaterializedView";
|
|
1907
|
-
/** The name of the materialized view */
|
|
1908
|
-
name: string;
|
|
1974
|
+
declare class MaterializedView<TargetTable> extends SqlResource {
|
|
1909
1975
|
/** The target OlapTable instance where the materialized data is stored. */
|
|
1910
1976
|
targetTable: OlapTable<TargetTable>;
|
|
1911
|
-
/** The SELECT SQL statement */
|
|
1912
|
-
selectSql: string;
|
|
1913
|
-
/** Names of source tables that the SELECT reads from */
|
|
1914
|
-
sourceTables: string[];
|
|
1915
|
-
/** @internal Source file path where this MV was defined */
|
|
1916
|
-
sourceFile?: string;
|
|
1917
1977
|
/**
|
|
1918
1978
|
* Creates a new MaterializedView instance.
|
|
1919
1979
|
* Requires the `TargetTable` type parameter to be explicitly provided or inferred,
|
|
@@ -1926,45 +1986,6 @@ declare class MaterializedView<TargetTable> {
|
|
|
1926
1986
|
constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
|
|
1927
1987
|
}
|
|
1928
1988
|
|
|
1929
|
-
type SqlObject = OlapTable<any> | SqlResource;
|
|
1930
|
-
/**
|
|
1931
|
-
* Represents a generic SQL resource that requires setup and teardown commands.
|
|
1932
|
-
* Base class for constructs like Views and Materialized Views. Tracks dependencies.
|
|
1933
|
-
*/
|
|
1934
|
-
declare class SqlResource {
|
|
1935
|
-
/** @internal */
|
|
1936
|
-
readonly kind = "SqlResource";
|
|
1937
|
-
/** Array of SQL statements to execute for setting up the resource. */
|
|
1938
|
-
setup: readonly string[];
|
|
1939
|
-
/** Array of SQL statements to execute for tearing down the resource. */
|
|
1940
|
-
teardown: readonly string[];
|
|
1941
|
-
/** The name of the SQL resource (e.g., view name, materialized view name). */
|
|
1942
|
-
name: string;
|
|
1943
|
-
/** List of OlapTables or Views that this resource reads data from. */
|
|
1944
|
-
pullsDataFrom: SqlObject[];
|
|
1945
|
-
/** List of OlapTables or Views that this resource writes data to. */
|
|
1946
|
-
pushesDataTo: SqlObject[];
|
|
1947
|
-
/** @internal Source file path where this resource was defined */
|
|
1948
|
-
sourceFile?: string;
|
|
1949
|
-
/** @internal Source line number where this resource was defined */
|
|
1950
|
-
sourceLine?: number;
|
|
1951
|
-
/** @internal Source column number where this resource was defined */
|
|
1952
|
-
sourceColumn?: number;
|
|
1953
|
-
/**
|
|
1954
|
-
* Creates a new SqlResource instance.
|
|
1955
|
-
* @param name The name of the resource.
|
|
1956
|
-
* @param setup An array of SQL DDL statements to create the resource.
|
|
1957
|
-
* @param teardown An array of SQL DDL statements to drop the resource.
|
|
1958
|
-
* @param options Optional configuration for specifying data dependencies.
|
|
1959
|
-
* @param options.pullsDataFrom Tables/Views this resource reads from.
|
|
1960
|
-
* @param options.pushesDataTo Tables/Views this resource writes to.
|
|
1961
|
-
*/
|
|
1962
|
-
constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
|
|
1963
|
-
pullsDataFrom?: SqlObject[];
|
|
1964
|
-
pushesDataTo?: SqlObject[];
|
|
1965
|
-
});
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
1989
|
type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
|
|
1969
1990
|
interface FrameworkApp {
|
|
1970
1991
|
handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-
|
|
2
|
-
import { K as ApiUtil, a4 as MooseClient } from './index-
|
|
3
|
-
export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae as ConsumptionHelpers, N as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Q as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, R as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, aa as QueryClient, X as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, Z as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, U as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 as dropView, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-
|
|
1
|
+
export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-15NCyT1P.mjs';
|
|
2
|
+
import { K as ApiUtil, a4 as MooseClient } from './index-BtkwFbT9.mjs';
|
|
3
|
+
export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae as ConsumptionHelpers, N as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Q as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, R as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, aa as QueryClient, X as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, Z as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, U as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 as dropView, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-BtkwFbT9.mjs';
|
|
4
4
|
import * as _clickhouse_client from '@clickhouse/client';
|
|
5
5
|
import { KafkaJS } from '@confluentinc/kafka-javascript';
|
|
6
6
|
import http from 'http';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-
|
|
2
|
-
import { K as ApiUtil, a4 as MooseClient } from './index-
|
|
3
|
-
export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae as ConsumptionHelpers, N as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Q as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, R as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, aa as QueryClient, X as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, Z as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, U as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 as dropView, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-
|
|
1
|
+
export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-BUKAJYbj.js';
|
|
2
|
+
import { K as ApiUtil, a4 as MooseClient } from './index-BtkwFbT9.js';
|
|
3
|
+
export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae as ConsumptionHelpers, N as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Q as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, R as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, aa as QueryClient, X as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, Z as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, U as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 as dropView, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-BtkwFbT9.js';
|
|
4
4
|
import * as _clickhouse_client from '@clickhouse/client';
|
|
5
5
|
import { KafkaJS } from '@confluentinc/kafka-javascript';
|
|
6
6
|
import http from 'http';
|
package/dist/index.js
CHANGED
|
@@ -765,6 +765,8 @@ var ClickHouseEngines = /* @__PURE__ */ ((ClickHouseEngines2) => {
|
|
|
765
765
|
ClickHouseEngines2["ReplicatedReplacingMergeTree"] = "ReplicatedReplacingMergeTree";
|
|
766
766
|
ClickHouseEngines2["ReplicatedAggregatingMergeTree"] = "ReplicatedAggregatingMergeTree";
|
|
767
767
|
ClickHouseEngines2["ReplicatedSummingMergeTree"] = "ReplicatedSummingMergeTree";
|
|
768
|
+
ClickHouseEngines2["ReplicatedCollapsingMergeTree"] = "ReplicatedCollapsingMergeTree";
|
|
769
|
+
ClickHouseEngines2["ReplicatedVersionedCollapsingMergeTree"] = "ReplicatedVersionedCollapsingMergeTree";
|
|
768
770
|
return ClickHouseEngines2;
|
|
769
771
|
})(ClickHouseEngines || {});
|
|
770
772
|
function dropView(name) {
|
|
@@ -794,9 +796,7 @@ var moose_internal = {
|
|
|
794
796
|
apis: /* @__PURE__ */ new Map(),
|
|
795
797
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
796
798
|
workflows: /* @__PURE__ */ new Map(),
|
|
797
|
-
webApps: /* @__PURE__ */ new Map()
|
|
798
|
-
materializedViews: /* @__PURE__ */ new Map(),
|
|
799
|
-
customViews: /* @__PURE__ */ new Map()
|
|
799
|
+
webApps: /* @__PURE__ */ new Map()
|
|
800
800
|
};
|
|
801
801
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
802
802
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -812,8 +812,6 @@ var loadIndex = () => {
|
|
|
812
812
|
registry.sqlResources.clear();
|
|
813
813
|
registry.workflows.clear();
|
|
814
814
|
registry.webApps.clear();
|
|
815
|
-
registry.materializedViews.clear();
|
|
816
|
-
registry.customViews.clear();
|
|
817
815
|
const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
|
|
818
816
|
Object.keys(require.cache).forEach((key) => {
|
|
819
817
|
if (key.startsWith(appDir)) {
|
|
@@ -2458,67 +2456,6 @@ var ETLPipeline = class {
|
|
|
2458
2456
|
}
|
|
2459
2457
|
};
|
|
2460
2458
|
|
|
2461
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2462
|
-
var requireTargetTableName = (tableName) => {
|
|
2463
|
-
if (typeof tableName === "string") {
|
|
2464
|
-
return tableName;
|
|
2465
|
-
} else {
|
|
2466
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2467
|
-
}
|
|
2468
|
-
};
|
|
2469
|
-
var MaterializedView = class {
|
|
2470
|
-
/** @internal */
|
|
2471
|
-
kind = "MaterializedView";
|
|
2472
|
-
/** The name of the materialized view */
|
|
2473
|
-
name;
|
|
2474
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2475
|
-
targetTable;
|
|
2476
|
-
/** The SELECT SQL statement */
|
|
2477
|
-
selectSql;
|
|
2478
|
-
/** Names of source tables that the SELECT reads from */
|
|
2479
|
-
sourceTables;
|
|
2480
|
-
/** @internal Source file path where this MV was defined */
|
|
2481
|
-
sourceFile;
|
|
2482
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2483
|
-
let selectStatement = options.selectStatement;
|
|
2484
|
-
if (typeof selectStatement !== "string") {
|
|
2485
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2486
|
-
}
|
|
2487
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2488
|
-
throw new Error(
|
|
2489
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2490
|
-
);
|
|
2491
|
-
}
|
|
2492
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2493
|
-
requireTargetTableName(
|
|
2494
|
-
options.targetTable?.name ?? options.tableName
|
|
2495
|
-
),
|
|
2496
|
-
{
|
|
2497
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2498
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2499
|
-
},
|
|
2500
|
-
targetSchema,
|
|
2501
|
-
targetColumns
|
|
2502
|
-
);
|
|
2503
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2504
|
-
throw new Error(
|
|
2505
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2506
|
-
);
|
|
2507
|
-
}
|
|
2508
|
-
this.name = options.materializedViewName;
|
|
2509
|
-
this.targetTable = targetTable;
|
|
2510
|
-
this.selectSql = selectStatement;
|
|
2511
|
-
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2512
|
-
const stack = new Error().stack;
|
|
2513
|
-
this.sourceFile = getSourceFileFromStack(stack);
|
|
2514
|
-
const materializedViews = getMooseInternal().materializedViews;
|
|
2515
|
-
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2516
|
-
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2517
|
-
}
|
|
2518
|
-
materializedViews.set(this.name, this);
|
|
2519
|
-
}
|
|
2520
|
-
};
|
|
2521
|
-
|
|
2522
2459
|
// src/dmv2/sdk/sqlResource.ts
|
|
2523
2460
|
var SqlResource = class {
|
|
2524
2461
|
/** @internal */
|
|
@@ -2573,18 +2510,66 @@ var SqlResource = class {
|
|
|
2573
2510
|
}
|
|
2574
2511
|
};
|
|
2575
2512
|
|
|
2513
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2514
|
+
var requireTargetTableName = (tableName) => {
|
|
2515
|
+
if (typeof tableName === "string") {
|
|
2516
|
+
return tableName;
|
|
2517
|
+
} else {
|
|
2518
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2519
|
+
}
|
|
2520
|
+
};
|
|
2521
|
+
var MaterializedView = class extends SqlResource {
|
|
2522
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2523
|
+
targetTable;
|
|
2524
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2525
|
+
let selectStatement = options.selectStatement;
|
|
2526
|
+
if (typeof selectStatement !== "string") {
|
|
2527
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2528
|
+
}
|
|
2529
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2530
|
+
throw new Error(
|
|
2531
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2532
|
+
);
|
|
2533
|
+
}
|
|
2534
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2535
|
+
requireTargetTableName(
|
|
2536
|
+
options.targetTable?.name ?? options.tableName
|
|
2537
|
+
),
|
|
2538
|
+
{
|
|
2539
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2540
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2541
|
+
},
|
|
2542
|
+
targetSchema,
|
|
2543
|
+
targetColumns
|
|
2544
|
+
);
|
|
2545
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2546
|
+
throw new Error(
|
|
2547
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2548
|
+
);
|
|
2549
|
+
}
|
|
2550
|
+
super(
|
|
2551
|
+
options.materializedViewName,
|
|
2552
|
+
[
|
|
2553
|
+
createMaterializedView({
|
|
2554
|
+
name: options.materializedViewName,
|
|
2555
|
+
destinationTable: targetTable.name,
|
|
2556
|
+
select: selectStatement
|
|
2557
|
+
})
|
|
2558
|
+
// Population is now handled automatically by Rust infrastructure
|
|
2559
|
+
// based on table engine type and whether this is a new or updated view
|
|
2560
|
+
],
|
|
2561
|
+
[dropView(options.materializedViewName)],
|
|
2562
|
+
{
|
|
2563
|
+
pullsDataFrom: options.selectTables,
|
|
2564
|
+
pushesDataTo: [targetTable]
|
|
2565
|
+
}
|
|
2566
|
+
);
|
|
2567
|
+
this.targetTable = targetTable;
|
|
2568
|
+
}
|
|
2569
|
+
};
|
|
2570
|
+
|
|
2576
2571
|
// src/dmv2/sdk/view.ts
|
|
2577
|
-
var View = class {
|
|
2578
|
-
/** @internal */
|
|
2579
|
-
kind = "CustomView";
|
|
2580
|
-
/** The name of the view */
|
|
2581
|
-
name;
|
|
2582
|
-
/** The SELECT SQL statement that defines the view */
|
|
2583
|
-
selectSql;
|
|
2584
|
-
/** Names of source tables/views that the SELECT reads from */
|
|
2585
|
-
sourceTables;
|
|
2586
|
-
/** @internal Source file path where this view was defined */
|
|
2587
|
-
sourceFile;
|
|
2572
|
+
var View = class extends SqlResource {
|
|
2588
2573
|
/**
|
|
2589
2574
|
* Creates a new View instance.
|
|
2590
2575
|
* @param name The name of the view to be created.
|
|
@@ -2595,16 +2580,17 @@ var View = class {
|
|
|
2595
2580
|
if (typeof selectStatement !== "string") {
|
|
2596
2581
|
selectStatement = toStaticQuery(selectStatement);
|
|
2597
2582
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2583
|
+
super(
|
|
2584
|
+
name,
|
|
2585
|
+
[
|
|
2586
|
+
`CREATE VIEW IF NOT EXISTS ${name}
|
|
2587
|
+
AS ${selectStatement}`.trim()
|
|
2588
|
+
],
|
|
2589
|
+
[dropView(name)],
|
|
2590
|
+
{
|
|
2591
|
+
pullsDataFrom: baseTables
|
|
2592
|
+
}
|
|
2593
|
+
);
|
|
2608
2594
|
}
|
|
2609
2595
|
};
|
|
2610
2596
|
|