@514labs/moose-lib 0.6.288 → 0.6.289-ci-7-ge6ab7015
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-BUKAJYbj.d.ts → browserCompatible-B2F3r37v.d.ts} +1 -1
- package/dist/{browserCompatible-15NCyT1P.d.mts → browserCompatible-DVf1GCzu.d.mts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +95 -86
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +95 -86
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/compilerPlugin.js +4 -1
- package/dist/compilerPlugin.js.map +1 -1
- package/dist/compilerPlugin.mjs +5 -1
- package/dist/compilerPlugin.mjs.map +1 -1
- package/dist/dataModels/toDataModels.js +4 -1
- package/dist/dataModels/toDataModels.js.map +1 -1
- package/dist/dataModels/toDataModels.mjs +5 -1
- package/dist/dataModels/toDataModels.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 +115 -86
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +111 -86
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-BtkwFbT9.d.mts → index-C0jZ1bu4.d.mts} +84 -41
- package/dist/{index-BtkwFbT9.d.ts → index-C0jZ1bu4.d.ts} +84 -41
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +97 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -76
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +28 -2
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +28 -2
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -108,6 +108,7 @@ interface Column {
|
|
|
108
108
|
ttl: string | null;
|
|
109
109
|
codec: string | null;
|
|
110
110
|
annotations: [string, any][];
|
|
111
|
+
comment: string | null;
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
/**
|
|
@@ -1882,50 +1883,21 @@ declare class ETLPipeline<T, U> {
|
|
|
1882
1883
|
run(): Promise<void>;
|
|
1883
1884
|
}
|
|
1884
1885
|
|
|
1885
|
-
type SqlObject = OlapTable<any> | SqlResource;
|
|
1886
1886
|
/**
|
|
1887
|
-
* Represents a
|
|
1888
|
-
*
|
|
1887
|
+
* Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
|
|
1888
|
+
* Emits structured data for the Moose infrastructure system.
|
|
1889
1889
|
*/
|
|
1890
|
-
declare class
|
|
1890
|
+
declare class View {
|
|
1891
1891
|
/** @internal */
|
|
1892
|
-
readonly kind = "
|
|
1893
|
-
/**
|
|
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). */
|
|
1892
|
+
readonly kind = "CustomView";
|
|
1893
|
+
/** The name of the view */
|
|
1898
1894
|
name: string;
|
|
1899
|
-
/**
|
|
1900
|
-
|
|
1901
|
-
/**
|
|
1902
|
-
|
|
1903
|
-
/** @internal Source file path where this
|
|
1895
|
+
/** The SELECT SQL statement that defines the view */
|
|
1896
|
+
selectSql: string;
|
|
1897
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
1898
|
+
sourceTables: string[];
|
|
1899
|
+
/** @internal Source file path where this view was defined */
|
|
1904
1900
|
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 {
|
|
1929
1901
|
/**
|
|
1930
1902
|
* Creates a new View instance.
|
|
1931
1903
|
* @param name The name of the view to be created.
|
|
@@ -1971,9 +1943,19 @@ interface MaterializedViewConfig<T> {
|
|
|
1971
1943
|
*
|
|
1972
1944
|
* @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
|
|
1973
1945
|
*/
|
|
1974
|
-
declare class MaterializedView<TargetTable>
|
|
1946
|
+
declare class MaterializedView<TargetTable> {
|
|
1947
|
+
/** @internal */
|
|
1948
|
+
readonly kind = "MaterializedView";
|
|
1949
|
+
/** The name of the materialized view */
|
|
1950
|
+
name: string;
|
|
1975
1951
|
/** The target OlapTable instance where the materialized data is stored. */
|
|
1976
1952
|
targetTable: OlapTable<TargetTable>;
|
|
1953
|
+
/** The SELECT SQL statement */
|
|
1954
|
+
selectSql: string;
|
|
1955
|
+
/** Names of source tables that the SELECT reads from */
|
|
1956
|
+
sourceTables: string[];
|
|
1957
|
+
/** @internal Source file path where this MV was defined */
|
|
1958
|
+
sourceFile?: string;
|
|
1977
1959
|
/**
|
|
1978
1960
|
* Creates a new MaterializedView instance.
|
|
1979
1961
|
* Requires the `TargetTable` type parameter to be explicitly provided or inferred,
|
|
@@ -1986,6 +1968,45 @@ declare class MaterializedView<TargetTable> extends SqlResource {
|
|
|
1986
1968
|
constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
|
|
1987
1969
|
}
|
|
1988
1970
|
|
|
1971
|
+
type SqlObject = OlapTable<any> | SqlResource;
|
|
1972
|
+
/**
|
|
1973
|
+
* Represents a generic SQL resource that requires setup and teardown commands.
|
|
1974
|
+
* Base class for constructs like Views and Materialized Views. Tracks dependencies.
|
|
1975
|
+
*/
|
|
1976
|
+
declare class SqlResource {
|
|
1977
|
+
/** @internal */
|
|
1978
|
+
readonly kind = "SqlResource";
|
|
1979
|
+
/** Array of SQL statements to execute for setting up the resource. */
|
|
1980
|
+
setup: readonly string[];
|
|
1981
|
+
/** Array of SQL statements to execute for tearing down the resource. */
|
|
1982
|
+
teardown: readonly string[];
|
|
1983
|
+
/** The name of the SQL resource (e.g., view name, materialized view name). */
|
|
1984
|
+
name: string;
|
|
1985
|
+
/** List of OlapTables or Views that this resource reads data from. */
|
|
1986
|
+
pullsDataFrom: SqlObject[];
|
|
1987
|
+
/** List of OlapTables or Views that this resource writes data to. */
|
|
1988
|
+
pushesDataTo: SqlObject[];
|
|
1989
|
+
/** @internal Source file path where this resource was defined */
|
|
1990
|
+
sourceFile?: string;
|
|
1991
|
+
/** @internal Source line number where this resource was defined */
|
|
1992
|
+
sourceLine?: number;
|
|
1993
|
+
/** @internal Source column number where this resource was defined */
|
|
1994
|
+
sourceColumn?: number;
|
|
1995
|
+
/**
|
|
1996
|
+
* Creates a new SqlResource instance.
|
|
1997
|
+
* @param name The name of the resource.
|
|
1998
|
+
* @param setup An array of SQL DDL statements to create the resource.
|
|
1999
|
+
* @param teardown An array of SQL DDL statements to drop the resource.
|
|
2000
|
+
* @param options Optional configuration for specifying data dependencies.
|
|
2001
|
+
* @param options.pullsDataFrom Tables/Views this resource reads from.
|
|
2002
|
+
* @param options.pushesDataTo Tables/Views this resource writes to.
|
|
2003
|
+
*/
|
|
2004
|
+
constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
|
|
2005
|
+
pullsDataFrom?: SqlObject[];
|
|
2006
|
+
pushesDataTo?: SqlObject[];
|
|
2007
|
+
});
|
|
2008
|
+
}
|
|
2009
|
+
|
|
1989
2010
|
type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
|
|
1990
2011
|
interface FrameworkApp {
|
|
1991
2012
|
handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
|
|
@@ -2102,6 +2123,28 @@ declare function getWebApps(): Map<string, WebApp>;
|
|
|
2102
2123
|
* @returns The WebApp instance or undefined if not found
|
|
2103
2124
|
*/
|
|
2104
2125
|
declare function getWebApp(name: string): WebApp | undefined;
|
|
2126
|
+
/**
|
|
2127
|
+
* Get all registered materialized views.
|
|
2128
|
+
* @returns A Map of MV name to MaterializedView instance
|
|
2129
|
+
*/
|
|
2130
|
+
declare function getMaterializedViews(): Map<string, MaterializedView<any>>;
|
|
2131
|
+
/**
|
|
2132
|
+
* Get a registered materialized view by name.
|
|
2133
|
+
* @param name - The name of the materialized view
|
|
2134
|
+
* @returns The MaterializedView instance or undefined if not found
|
|
2135
|
+
*/
|
|
2136
|
+
declare function getMaterializedView(name: string): MaterializedView<any> | undefined;
|
|
2137
|
+
/**
|
|
2138
|
+
* Get all registered custom views.
|
|
2139
|
+
* @returns A Map of view name to View instance
|
|
2140
|
+
*/
|
|
2141
|
+
declare function getCustomViews(): Map<string, View>;
|
|
2142
|
+
/**
|
|
2143
|
+
* Get a registered custom view by name.
|
|
2144
|
+
* @param name - The name of the custom view
|
|
2145
|
+
* @returns The View instance or undefined if not found
|
|
2146
|
+
*/
|
|
2147
|
+
declare function getCustomView(name: string): View | undefined;
|
|
2105
2148
|
|
|
2106
2149
|
/**
|
|
2107
2150
|
* @module dmv2
|
|
@@ -2143,4 +2186,4 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
|
|
|
2143
2186
|
_argType?: ArgType;
|
|
2144
2187
|
};
|
|
2145
2188
|
|
|
2146
|
-
export { toQuery as $, type Aggregated as A, getWorkflows as B, ConsumptionApi as C, type DeadLetterModel as D, type EgressConfig as E, type FrameworkApp as F, getWorkflow as G, getWebApps as H, IngestApi as I, getWebApp as J, type ApiUtil as K, LifeCycle as L, MaterializedView as M, type ConsumptionUtil as N, OlapTable as O, quoteIdentifier as P, type IdentifierBrandedString as Q, type NonIdentifierBrandedString as R, type SimpleAggregated as S, Task as T, type Value as U, View as V, Workflow as W, type RawValue as X, sql as Y, Sql as Z, toStaticQuery as _, type OlapConfig as a, toQueryPreview as a0, getValueFromParameter as a1, createClickhouseParameter as a2, mapToClickHouseType as a3, MooseClient as a4, type Blocks as a5, ClickHouseEngines as a6, dropView as a7, createMaterializedView as a8, populateTable as a9, QueryClient as aa, WorkflowClient as ab, getTemporalClient as ac, ApiHelpers as ad, ConsumptionHelpers as ae, joinQueries as af, type ConsumerConfig as ag, type TransformConfig as ah, type TaskContext as ai, type TaskConfig as aj, type IngestPipelineConfig as ak, type MaterializedViewConfig as al, type S3QueueTableSettings as b, Stream as c, type StreamConfig as d, type DeadLetter as e, DeadLetterQueue as f, type IngestConfig as g, Api as h, type ApiConfig as i, IngestPipeline as j, SqlResource as k, ETLPipeline as l, type ETLPipelineConfig as m, WebApp as n, type WebAppConfig as o, type WebAppHandler as p, getTables as q, getTable as r, getStreams as s, getStream as t, getIngestApis as u, getIngestApi as v, getApis as w, getApi as x, getSqlResources as y, getSqlResource as z };
|
|
2189
|
+
export { toQuery as $, type Aggregated as A, getWorkflows as B, ConsumptionApi as C, type DeadLetterModel as D, type EgressConfig as E, type FrameworkApp as F, getWorkflow as G, getWebApps as H, IngestApi as I, getWebApp as J, type ApiUtil as K, LifeCycle as L, MaterializedView as M, type ConsumptionUtil as N, OlapTable as O, quoteIdentifier as P, type IdentifierBrandedString as Q, type NonIdentifierBrandedString as R, type SimpleAggregated as S, Task as T, type Value as U, View as V, Workflow as W, type RawValue as X, sql as Y, Sql as Z, toStaticQuery as _, type OlapConfig as a, toQueryPreview as a0, getValueFromParameter as a1, createClickhouseParameter as a2, mapToClickHouseType as a3, MooseClient as a4, type Blocks as a5, ClickHouseEngines as a6, dropView as a7, createMaterializedView as a8, populateTable as a9, QueryClient as aa, WorkflowClient as ab, getTemporalClient as ac, ApiHelpers as ad, ConsumptionHelpers as ae, joinQueries as af, type ConsumerConfig as ag, type TransformConfig as ah, type TaskContext as ai, type TaskConfig as aj, type IngestPipelineConfig as ak, type MaterializedViewConfig as al, getMaterializedViews as am, getMaterializedView as an, getCustomViews as ao, getCustomView as ap, type S3QueueTableSettings as b, Stream as c, type StreamConfig as d, type DeadLetter as e, DeadLetterQueue as f, type IngestConfig as g, Api as h, type ApiConfig as i, IngestPipeline as j, SqlResource as k, ETLPipeline as l, type ETLPipelineConfig as m, WebApp as n, type WebAppConfig as o, type WebAppHandler as p, getTables as q, getTable as r, getStreams as s, getStream as t, getIngestApis as u, getIngestApi as v, getApis as w, getApi as x, getSqlResources as y, getSqlResource as z };
|
|
@@ -108,6 +108,7 @@ interface Column {
|
|
|
108
108
|
ttl: string | null;
|
|
109
109
|
codec: string | null;
|
|
110
110
|
annotations: [string, any][];
|
|
111
|
+
comment: string | null;
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
/**
|
|
@@ -1882,50 +1883,21 @@ declare class ETLPipeline<T, U> {
|
|
|
1882
1883
|
run(): Promise<void>;
|
|
1883
1884
|
}
|
|
1884
1885
|
|
|
1885
|
-
type SqlObject = OlapTable<any> | SqlResource;
|
|
1886
1886
|
/**
|
|
1887
|
-
* Represents a
|
|
1888
|
-
*
|
|
1887
|
+
* Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
|
|
1888
|
+
* Emits structured data for the Moose infrastructure system.
|
|
1889
1889
|
*/
|
|
1890
|
-
declare class
|
|
1890
|
+
declare class View {
|
|
1891
1891
|
/** @internal */
|
|
1892
|
-
readonly kind = "
|
|
1893
|
-
/**
|
|
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). */
|
|
1892
|
+
readonly kind = "CustomView";
|
|
1893
|
+
/** The name of the view */
|
|
1898
1894
|
name: string;
|
|
1899
|
-
/**
|
|
1900
|
-
|
|
1901
|
-
/**
|
|
1902
|
-
|
|
1903
|
-
/** @internal Source file path where this
|
|
1895
|
+
/** The SELECT SQL statement that defines the view */
|
|
1896
|
+
selectSql: string;
|
|
1897
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
1898
|
+
sourceTables: string[];
|
|
1899
|
+
/** @internal Source file path where this view was defined */
|
|
1904
1900
|
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 {
|
|
1929
1901
|
/**
|
|
1930
1902
|
* Creates a new View instance.
|
|
1931
1903
|
* @param name The name of the view to be created.
|
|
@@ -1971,9 +1943,19 @@ interface MaterializedViewConfig<T> {
|
|
|
1971
1943
|
*
|
|
1972
1944
|
* @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
|
|
1973
1945
|
*/
|
|
1974
|
-
declare class MaterializedView<TargetTable>
|
|
1946
|
+
declare class MaterializedView<TargetTable> {
|
|
1947
|
+
/** @internal */
|
|
1948
|
+
readonly kind = "MaterializedView";
|
|
1949
|
+
/** The name of the materialized view */
|
|
1950
|
+
name: string;
|
|
1975
1951
|
/** The target OlapTable instance where the materialized data is stored. */
|
|
1976
1952
|
targetTable: OlapTable<TargetTable>;
|
|
1953
|
+
/** The SELECT SQL statement */
|
|
1954
|
+
selectSql: string;
|
|
1955
|
+
/** Names of source tables that the SELECT reads from */
|
|
1956
|
+
sourceTables: string[];
|
|
1957
|
+
/** @internal Source file path where this MV was defined */
|
|
1958
|
+
sourceFile?: string;
|
|
1977
1959
|
/**
|
|
1978
1960
|
* Creates a new MaterializedView instance.
|
|
1979
1961
|
* Requires the `TargetTable` type parameter to be explicitly provided or inferred,
|
|
@@ -1986,6 +1968,45 @@ declare class MaterializedView<TargetTable> extends SqlResource {
|
|
|
1986
1968
|
constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
|
|
1987
1969
|
}
|
|
1988
1970
|
|
|
1971
|
+
type SqlObject = OlapTable<any> | SqlResource;
|
|
1972
|
+
/**
|
|
1973
|
+
* Represents a generic SQL resource that requires setup and teardown commands.
|
|
1974
|
+
* Base class for constructs like Views and Materialized Views. Tracks dependencies.
|
|
1975
|
+
*/
|
|
1976
|
+
declare class SqlResource {
|
|
1977
|
+
/** @internal */
|
|
1978
|
+
readonly kind = "SqlResource";
|
|
1979
|
+
/** Array of SQL statements to execute for setting up the resource. */
|
|
1980
|
+
setup: readonly string[];
|
|
1981
|
+
/** Array of SQL statements to execute for tearing down the resource. */
|
|
1982
|
+
teardown: readonly string[];
|
|
1983
|
+
/** The name of the SQL resource (e.g., view name, materialized view name). */
|
|
1984
|
+
name: string;
|
|
1985
|
+
/** List of OlapTables or Views that this resource reads data from. */
|
|
1986
|
+
pullsDataFrom: SqlObject[];
|
|
1987
|
+
/** List of OlapTables or Views that this resource writes data to. */
|
|
1988
|
+
pushesDataTo: SqlObject[];
|
|
1989
|
+
/** @internal Source file path where this resource was defined */
|
|
1990
|
+
sourceFile?: string;
|
|
1991
|
+
/** @internal Source line number where this resource was defined */
|
|
1992
|
+
sourceLine?: number;
|
|
1993
|
+
/** @internal Source column number where this resource was defined */
|
|
1994
|
+
sourceColumn?: number;
|
|
1995
|
+
/**
|
|
1996
|
+
* Creates a new SqlResource instance.
|
|
1997
|
+
* @param name The name of the resource.
|
|
1998
|
+
* @param setup An array of SQL DDL statements to create the resource.
|
|
1999
|
+
* @param teardown An array of SQL DDL statements to drop the resource.
|
|
2000
|
+
* @param options Optional configuration for specifying data dependencies.
|
|
2001
|
+
* @param options.pullsDataFrom Tables/Views this resource reads from.
|
|
2002
|
+
* @param options.pushesDataTo Tables/Views this resource writes to.
|
|
2003
|
+
*/
|
|
2004
|
+
constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
|
|
2005
|
+
pullsDataFrom?: SqlObject[];
|
|
2006
|
+
pushesDataTo?: SqlObject[];
|
|
2007
|
+
});
|
|
2008
|
+
}
|
|
2009
|
+
|
|
1989
2010
|
type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
|
|
1990
2011
|
interface FrameworkApp {
|
|
1991
2012
|
handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
|
|
@@ -2102,6 +2123,28 @@ declare function getWebApps(): Map<string, WebApp>;
|
|
|
2102
2123
|
* @returns The WebApp instance or undefined if not found
|
|
2103
2124
|
*/
|
|
2104
2125
|
declare function getWebApp(name: string): WebApp | undefined;
|
|
2126
|
+
/**
|
|
2127
|
+
* Get all registered materialized views.
|
|
2128
|
+
* @returns A Map of MV name to MaterializedView instance
|
|
2129
|
+
*/
|
|
2130
|
+
declare function getMaterializedViews(): Map<string, MaterializedView<any>>;
|
|
2131
|
+
/**
|
|
2132
|
+
* Get a registered materialized view by name.
|
|
2133
|
+
* @param name - The name of the materialized view
|
|
2134
|
+
* @returns The MaterializedView instance or undefined if not found
|
|
2135
|
+
*/
|
|
2136
|
+
declare function getMaterializedView(name: string): MaterializedView<any> | undefined;
|
|
2137
|
+
/**
|
|
2138
|
+
* Get all registered custom views.
|
|
2139
|
+
* @returns A Map of view name to View instance
|
|
2140
|
+
*/
|
|
2141
|
+
declare function getCustomViews(): Map<string, View>;
|
|
2142
|
+
/**
|
|
2143
|
+
* Get a registered custom view by name.
|
|
2144
|
+
* @param name - The name of the custom view
|
|
2145
|
+
* @returns The View instance or undefined if not found
|
|
2146
|
+
*/
|
|
2147
|
+
declare function getCustomView(name: string): View | undefined;
|
|
2105
2148
|
|
|
2106
2149
|
/**
|
|
2107
2150
|
* @module dmv2
|
|
@@ -2143,4 +2186,4 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
|
|
|
2143
2186
|
_argType?: ArgType;
|
|
2144
2187
|
};
|
|
2145
2188
|
|
|
2146
|
-
export { toQuery as $, type Aggregated as A, getWorkflows as B, ConsumptionApi as C, type DeadLetterModel as D, type EgressConfig as E, type FrameworkApp as F, getWorkflow as G, getWebApps as H, IngestApi as I, getWebApp as J, type ApiUtil as K, LifeCycle as L, MaterializedView as M, type ConsumptionUtil as N, OlapTable as O, quoteIdentifier as P, type IdentifierBrandedString as Q, type NonIdentifierBrandedString as R, type SimpleAggregated as S, Task as T, type Value as U, View as V, Workflow as W, type RawValue as X, sql as Y, Sql as Z, toStaticQuery as _, type OlapConfig as a, toQueryPreview as a0, getValueFromParameter as a1, createClickhouseParameter as a2, mapToClickHouseType as a3, MooseClient as a4, type Blocks as a5, ClickHouseEngines as a6, dropView as a7, createMaterializedView as a8, populateTable as a9, QueryClient as aa, WorkflowClient as ab, getTemporalClient as ac, ApiHelpers as ad, ConsumptionHelpers as ae, joinQueries as af, type ConsumerConfig as ag, type TransformConfig as ah, type TaskContext as ai, type TaskConfig as aj, type IngestPipelineConfig as ak, type MaterializedViewConfig as al, type S3QueueTableSettings as b, Stream as c, type StreamConfig as d, type DeadLetter as e, DeadLetterQueue as f, type IngestConfig as g, Api as h, type ApiConfig as i, IngestPipeline as j, SqlResource as k, ETLPipeline as l, type ETLPipelineConfig as m, WebApp as n, type WebAppConfig as o, type WebAppHandler as p, getTables as q, getTable as r, getStreams as s, getStream as t, getIngestApis as u, getIngestApi as v, getApis as w, getApi as x, getSqlResources as y, getSqlResource as z };
|
|
2189
|
+
export { toQuery as $, type Aggregated as A, getWorkflows as B, ConsumptionApi as C, type DeadLetterModel as D, type EgressConfig as E, type FrameworkApp as F, getWorkflow as G, getWebApps as H, IngestApi as I, getWebApp as J, type ApiUtil as K, LifeCycle as L, MaterializedView as M, type ConsumptionUtil as N, OlapTable as O, quoteIdentifier as P, type IdentifierBrandedString as Q, type NonIdentifierBrandedString as R, type SimpleAggregated as S, Task as T, type Value as U, View as V, Workflow as W, type RawValue as X, sql as Y, Sql as Z, toStaticQuery as _, type OlapConfig as a, toQueryPreview as a0, getValueFromParameter as a1, createClickhouseParameter as a2, mapToClickHouseType as a3, MooseClient as a4, type Blocks as a5, ClickHouseEngines as a6, dropView as a7, createMaterializedView as a8, populateTable as a9, QueryClient as aa, WorkflowClient as ab, getTemporalClient as ac, ApiHelpers as ad, ConsumptionHelpers as ae, joinQueries as af, type ConsumerConfig as ag, type TransformConfig as ah, type TaskContext as ai, type TaskConfig as aj, type IngestPipelineConfig as ak, type MaterializedViewConfig as al, getMaterializedViews as am, getMaterializedView as an, getCustomViews as ao, getCustomView as ap, type S3QueueTableSettings as b, Stream as c, type StreamConfig as d, type DeadLetter as e, DeadLetterQueue as f, type IngestConfig as g, Api as h, type ApiConfig as i, IngestPipeline as j, SqlResource as k, ETLPipeline as l, type ETLPipelineConfig as m, WebApp as n, type WebAppConfig as o, type WebAppHandler as p, getTables as q, getTable as r, getStreams as s, getStream as t, getIngestApis as u, getIngestApi as v, getApis as w, getApi as x, getSqlResources as y, getSqlResource as z };
|
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-DVf1GCzu.mjs';
|
|
2
|
+
import { K as ApiUtil, a4 as MooseClient } from './index-C0jZ1bu4.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-C0jZ1bu4.mjs';
|
|
4
4
|
import * as _clickhouse_client from '@clickhouse/client';
|
|
5
5
|
import { KafkaJS } from '@514labs/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-B2F3r37v.js';
|
|
2
|
+
import { K as ApiUtil, a4 as MooseClient } from './index-C0jZ1bu4.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-C0jZ1bu4.js';
|
|
4
4
|
import * as _clickhouse_client from '@clickhouse/client';
|
|
5
5
|
import { KafkaJS } from '@514labs/kafka-javascript';
|
|
6
6
|
import http from 'http';
|
package/dist/index.js
CHANGED
|
@@ -799,7 +799,9 @@ var moose_internal = {
|
|
|
799
799
|
apis: /* @__PURE__ */ new Map(),
|
|
800
800
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
801
801
|
workflows: /* @__PURE__ */ new Map(),
|
|
802
|
-
webApps: /* @__PURE__ */ new Map()
|
|
802
|
+
webApps: /* @__PURE__ */ new Map(),
|
|
803
|
+
materializedViews: /* @__PURE__ */ new Map(),
|
|
804
|
+
customViews: /* @__PURE__ */ new Map()
|
|
803
805
|
};
|
|
804
806
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
805
807
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -815,6 +817,8 @@ var loadIndex = () => {
|
|
|
815
817
|
registry.sqlResources.clear();
|
|
816
818
|
registry.workflows.clear();
|
|
817
819
|
registry.webApps.clear();
|
|
820
|
+
registry.materializedViews.clear();
|
|
821
|
+
registry.customViews.clear();
|
|
818
822
|
const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
|
|
819
823
|
Object.keys(require.cache).forEach((key) => {
|
|
820
824
|
if (key.startsWith(appDir)) {
|
|
@@ -902,7 +906,8 @@ var dlqColumns = [
|
|
|
902
906
|
annotations: [],
|
|
903
907
|
ttl: null,
|
|
904
908
|
codec: null,
|
|
905
|
-
materialized: null
|
|
909
|
+
materialized: null,
|
|
910
|
+
comment: null
|
|
906
911
|
},
|
|
907
912
|
{
|
|
908
913
|
name: "errorMessage",
|
|
@@ -914,7 +919,8 @@ var dlqColumns = [
|
|
|
914
919
|
annotations: [],
|
|
915
920
|
ttl: null,
|
|
916
921
|
codec: null,
|
|
917
|
-
materialized: null
|
|
922
|
+
materialized: null,
|
|
923
|
+
comment: null
|
|
918
924
|
},
|
|
919
925
|
{
|
|
920
926
|
name: "errorType",
|
|
@@ -926,7 +932,8 @@ var dlqColumns = [
|
|
|
926
932
|
annotations: [],
|
|
927
933
|
ttl: null,
|
|
928
934
|
codec: null,
|
|
929
|
-
materialized: null
|
|
935
|
+
materialized: null,
|
|
936
|
+
comment: null
|
|
930
937
|
},
|
|
931
938
|
{
|
|
932
939
|
name: "failedAt",
|
|
@@ -938,7 +945,8 @@ var dlqColumns = [
|
|
|
938
945
|
annotations: [],
|
|
939
946
|
ttl: null,
|
|
940
947
|
codec: null,
|
|
941
|
-
materialized: null
|
|
948
|
+
materialized: null,
|
|
949
|
+
comment: null
|
|
942
950
|
},
|
|
943
951
|
{
|
|
944
952
|
name: "source",
|
|
@@ -950,7 +958,8 @@ var dlqColumns = [
|
|
|
950
958
|
annotations: [],
|
|
951
959
|
ttl: null,
|
|
952
960
|
codec: null,
|
|
953
|
-
materialized: null
|
|
961
|
+
materialized: null,
|
|
962
|
+
comment: null
|
|
954
963
|
}
|
|
955
964
|
];
|
|
956
965
|
var getWorkflows = async () => {
|
|
@@ -2461,6 +2470,67 @@ var ETLPipeline = class {
|
|
|
2461
2470
|
}
|
|
2462
2471
|
};
|
|
2463
2472
|
|
|
2473
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2474
|
+
var requireTargetTableName = (tableName) => {
|
|
2475
|
+
if (typeof tableName === "string") {
|
|
2476
|
+
return tableName;
|
|
2477
|
+
} else {
|
|
2478
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2479
|
+
}
|
|
2480
|
+
};
|
|
2481
|
+
var MaterializedView = class {
|
|
2482
|
+
/** @internal */
|
|
2483
|
+
kind = "MaterializedView";
|
|
2484
|
+
/** The name of the materialized view */
|
|
2485
|
+
name;
|
|
2486
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2487
|
+
targetTable;
|
|
2488
|
+
/** The SELECT SQL statement */
|
|
2489
|
+
selectSql;
|
|
2490
|
+
/** Names of source tables that the SELECT reads from */
|
|
2491
|
+
sourceTables;
|
|
2492
|
+
/** @internal Source file path where this MV was defined */
|
|
2493
|
+
sourceFile;
|
|
2494
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2495
|
+
let selectStatement = options.selectStatement;
|
|
2496
|
+
if (typeof selectStatement !== "string") {
|
|
2497
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2498
|
+
}
|
|
2499
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2500
|
+
throw new Error(
|
|
2501
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2502
|
+
);
|
|
2503
|
+
}
|
|
2504
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2505
|
+
requireTargetTableName(
|
|
2506
|
+
options.targetTable?.name ?? options.tableName
|
|
2507
|
+
),
|
|
2508
|
+
{
|
|
2509
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2510
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2511
|
+
},
|
|
2512
|
+
targetSchema,
|
|
2513
|
+
targetColumns
|
|
2514
|
+
);
|
|
2515
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2516
|
+
throw new Error(
|
|
2517
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2518
|
+
);
|
|
2519
|
+
}
|
|
2520
|
+
this.name = options.materializedViewName;
|
|
2521
|
+
this.targetTable = targetTable;
|
|
2522
|
+
this.selectSql = selectStatement;
|
|
2523
|
+
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2524
|
+
const stack = new Error().stack;
|
|
2525
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2526
|
+
const materializedViews = getMooseInternal().materializedViews;
|
|
2527
|
+
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2528
|
+
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2529
|
+
}
|
|
2530
|
+
materializedViews.set(this.name, this);
|
|
2531
|
+
}
|
|
2532
|
+
};
|
|
2533
|
+
|
|
2464
2534
|
// src/dmv2/sdk/sqlResource.ts
|
|
2465
2535
|
var SqlResource = class {
|
|
2466
2536
|
/** @internal */
|
|
@@ -2515,66 +2585,18 @@ var SqlResource = class {
|
|
|
2515
2585
|
}
|
|
2516
2586
|
};
|
|
2517
2587
|
|
|
2518
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2519
|
-
var requireTargetTableName = (tableName) => {
|
|
2520
|
-
if (typeof tableName === "string") {
|
|
2521
|
-
return tableName;
|
|
2522
|
-
} else {
|
|
2523
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2524
|
-
}
|
|
2525
|
-
};
|
|
2526
|
-
var MaterializedView = class extends SqlResource {
|
|
2527
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2528
|
-
targetTable;
|
|
2529
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2530
|
-
let selectStatement = options.selectStatement;
|
|
2531
|
-
if (typeof selectStatement !== "string") {
|
|
2532
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2533
|
-
}
|
|
2534
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2535
|
-
throw new Error(
|
|
2536
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2537
|
-
);
|
|
2538
|
-
}
|
|
2539
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2540
|
-
requireTargetTableName(
|
|
2541
|
-
options.targetTable?.name ?? options.tableName
|
|
2542
|
-
),
|
|
2543
|
-
{
|
|
2544
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2545
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2546
|
-
},
|
|
2547
|
-
targetSchema,
|
|
2548
|
-
targetColumns
|
|
2549
|
-
);
|
|
2550
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2551
|
-
throw new Error(
|
|
2552
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2553
|
-
);
|
|
2554
|
-
}
|
|
2555
|
-
super(
|
|
2556
|
-
options.materializedViewName,
|
|
2557
|
-
[
|
|
2558
|
-
createMaterializedView({
|
|
2559
|
-
name: options.materializedViewName,
|
|
2560
|
-
destinationTable: targetTable.name,
|
|
2561
|
-
select: selectStatement
|
|
2562
|
-
})
|
|
2563
|
-
// Population is now handled automatically by Rust infrastructure
|
|
2564
|
-
// based on table engine type and whether this is a new or updated view
|
|
2565
|
-
],
|
|
2566
|
-
[dropView(options.materializedViewName)],
|
|
2567
|
-
{
|
|
2568
|
-
pullsDataFrom: options.selectTables,
|
|
2569
|
-
pushesDataTo: [targetTable]
|
|
2570
|
-
}
|
|
2571
|
-
);
|
|
2572
|
-
this.targetTable = targetTable;
|
|
2573
|
-
}
|
|
2574
|
-
};
|
|
2575
|
-
|
|
2576
2588
|
// src/dmv2/sdk/view.ts
|
|
2577
|
-
var View = class
|
|
2589
|
+
var View = class {
|
|
2590
|
+
/** @internal */
|
|
2591
|
+
kind = "CustomView";
|
|
2592
|
+
/** The name of the view */
|
|
2593
|
+
name;
|
|
2594
|
+
/** The SELECT SQL statement that defines the view */
|
|
2595
|
+
selectSql;
|
|
2596
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
2597
|
+
sourceTables;
|
|
2598
|
+
/** @internal Source file path where this view was defined */
|
|
2599
|
+
sourceFile;
|
|
2578
2600
|
/**
|
|
2579
2601
|
* Creates a new View instance.
|
|
2580
2602
|
* @param name The name of the view to be created.
|
|
@@ -2585,17 +2607,16 @@ var View = class extends SqlResource {
|
|
|
2585
2607
|
if (typeof selectStatement !== "string") {
|
|
2586
2608
|
selectStatement = toStaticQuery(selectStatement);
|
|
2587
2609
|
}
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
{
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
);
|
|
2610
|
+
this.name = name;
|
|
2611
|
+
this.selectSql = selectStatement;
|
|
2612
|
+
this.sourceTables = baseTables.map((t) => t.name);
|
|
2613
|
+
const stack = new Error().stack;
|
|
2614
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2615
|
+
const customViews = getMooseInternal().customViews;
|
|
2616
|
+
if (!isClientOnlyMode() && customViews.has(this.name)) {
|
|
2617
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2618
|
+
}
|
|
2619
|
+
customViews.set(this.name, this);
|
|
2599
2620
|
}
|
|
2600
2621
|
};
|
|
2601
2622
|
|