@514labs/moose-lib 0.6.279-ci-5-g982a1dc0 → 0.6.279-ci-2-g69faf7b6
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-15NCyT1P.d.mts → browserCompatible-Bs-byVfO.d.mts} +1 -1
- package/dist/{browserCompatible-BUKAJYbj.d.ts → browserCompatible-D8Hbpq6L.d.ts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +94 -93
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +94 -93
- 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 +114 -93
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +110 -93
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-BtkwFbT9.d.mts → index-KhGbXtkS.d.mts} +83 -41
- package/dist/{index-BtkwFbT9.d.ts → index-KhGbXtkS.d.ts} +83 -41
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +96 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -83
- 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
|
@@ -1882,50 +1882,21 @@ declare class ETLPipeline<T, U> {
|
|
|
1882
1882
|
run(): Promise<void>;
|
|
1883
1883
|
}
|
|
1884
1884
|
|
|
1885
|
-
type SqlObject = OlapTable<any> | SqlResource;
|
|
1886
1885
|
/**
|
|
1887
|
-
* Represents a
|
|
1888
|
-
*
|
|
1886
|
+
* Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
|
|
1887
|
+
* Emits structured data for the Moose infrastructure system.
|
|
1889
1888
|
*/
|
|
1890
|
-
declare class
|
|
1889
|
+
declare class View {
|
|
1891
1890
|
/** @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). */
|
|
1891
|
+
readonly kind = "CustomView";
|
|
1892
|
+
/** The name of the view */
|
|
1898
1893
|
name: string;
|
|
1899
|
-
/**
|
|
1900
|
-
|
|
1901
|
-
/**
|
|
1902
|
-
|
|
1903
|
-
/** @internal Source file path where this
|
|
1894
|
+
/** The SELECT SQL statement that defines the view */
|
|
1895
|
+
selectSql: string;
|
|
1896
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
1897
|
+
sourceTables: string[];
|
|
1898
|
+
/** @internal Source file path where this view was defined */
|
|
1904
1899
|
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
1900
|
/**
|
|
1930
1901
|
* Creates a new View instance.
|
|
1931
1902
|
* @param name The name of the view to be created.
|
|
@@ -1971,9 +1942,19 @@ interface MaterializedViewConfig<T> {
|
|
|
1971
1942
|
*
|
|
1972
1943
|
* @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
|
|
1973
1944
|
*/
|
|
1974
|
-
declare class MaterializedView<TargetTable>
|
|
1945
|
+
declare class MaterializedView<TargetTable> {
|
|
1946
|
+
/** @internal */
|
|
1947
|
+
readonly kind = "MaterializedView";
|
|
1948
|
+
/** The name of the materialized view */
|
|
1949
|
+
name: string;
|
|
1975
1950
|
/** The target OlapTable instance where the materialized data is stored. */
|
|
1976
1951
|
targetTable: OlapTable<TargetTable>;
|
|
1952
|
+
/** The SELECT SQL statement */
|
|
1953
|
+
selectSql: string;
|
|
1954
|
+
/** Names of source tables that the SELECT reads from */
|
|
1955
|
+
sourceTables: string[];
|
|
1956
|
+
/** @internal Source file path where this MV was defined */
|
|
1957
|
+
sourceFile?: string;
|
|
1977
1958
|
/**
|
|
1978
1959
|
* Creates a new MaterializedView instance.
|
|
1979
1960
|
* Requires the `TargetTable` type parameter to be explicitly provided or inferred,
|
|
@@ -1986,6 +1967,45 @@ declare class MaterializedView<TargetTable> extends SqlResource {
|
|
|
1986
1967
|
constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
|
|
1987
1968
|
}
|
|
1988
1969
|
|
|
1970
|
+
type SqlObject = OlapTable<any> | SqlResource;
|
|
1971
|
+
/**
|
|
1972
|
+
* Represents a generic SQL resource that requires setup and teardown commands.
|
|
1973
|
+
* Base class for constructs like Views and Materialized Views. Tracks dependencies.
|
|
1974
|
+
*/
|
|
1975
|
+
declare class SqlResource {
|
|
1976
|
+
/** @internal */
|
|
1977
|
+
readonly kind = "SqlResource";
|
|
1978
|
+
/** Array of SQL statements to execute for setting up the resource. */
|
|
1979
|
+
setup: readonly string[];
|
|
1980
|
+
/** Array of SQL statements to execute for tearing down the resource. */
|
|
1981
|
+
teardown: readonly string[];
|
|
1982
|
+
/** The name of the SQL resource (e.g., view name, materialized view name). */
|
|
1983
|
+
name: string;
|
|
1984
|
+
/** List of OlapTables or Views that this resource reads data from. */
|
|
1985
|
+
pullsDataFrom: SqlObject[];
|
|
1986
|
+
/** List of OlapTables or Views that this resource writes data to. */
|
|
1987
|
+
pushesDataTo: SqlObject[];
|
|
1988
|
+
/** @internal Source file path where this resource was defined */
|
|
1989
|
+
sourceFile?: string;
|
|
1990
|
+
/** @internal Source line number where this resource was defined */
|
|
1991
|
+
sourceLine?: number;
|
|
1992
|
+
/** @internal Source column number where this resource was defined */
|
|
1993
|
+
sourceColumn?: number;
|
|
1994
|
+
/**
|
|
1995
|
+
* Creates a new SqlResource instance.
|
|
1996
|
+
* @param name The name of the resource.
|
|
1997
|
+
* @param setup An array of SQL DDL statements to create the resource.
|
|
1998
|
+
* @param teardown An array of SQL DDL statements to drop the resource.
|
|
1999
|
+
* @param options Optional configuration for specifying data dependencies.
|
|
2000
|
+
* @param options.pullsDataFrom Tables/Views this resource reads from.
|
|
2001
|
+
* @param options.pushesDataTo Tables/Views this resource writes to.
|
|
2002
|
+
*/
|
|
2003
|
+
constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
|
|
2004
|
+
pullsDataFrom?: SqlObject[];
|
|
2005
|
+
pushesDataTo?: SqlObject[];
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
|
|
1989
2009
|
type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
|
|
1990
2010
|
interface FrameworkApp {
|
|
1991
2011
|
handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
|
|
@@ -2102,6 +2122,28 @@ declare function getWebApps(): Map<string, WebApp>;
|
|
|
2102
2122
|
* @returns The WebApp instance or undefined if not found
|
|
2103
2123
|
*/
|
|
2104
2124
|
declare function getWebApp(name: string): WebApp | undefined;
|
|
2125
|
+
/**
|
|
2126
|
+
* Get all registered materialized views.
|
|
2127
|
+
* @returns A Map of MV name to MaterializedView instance
|
|
2128
|
+
*/
|
|
2129
|
+
declare function getMaterializedViews(): Map<string, MaterializedView<any>>;
|
|
2130
|
+
/**
|
|
2131
|
+
* Get a registered materialized view by name.
|
|
2132
|
+
* @param name - The name of the materialized view
|
|
2133
|
+
* @returns The MaterializedView instance or undefined if not found
|
|
2134
|
+
*/
|
|
2135
|
+
declare function getMaterializedView(name: string): MaterializedView<any> | undefined;
|
|
2136
|
+
/**
|
|
2137
|
+
* Get all registered custom views.
|
|
2138
|
+
* @returns A Map of view name to View instance
|
|
2139
|
+
*/
|
|
2140
|
+
declare function getCustomViews(): Map<string, View>;
|
|
2141
|
+
/**
|
|
2142
|
+
* Get a registered custom view by name.
|
|
2143
|
+
* @param name - The name of the custom view
|
|
2144
|
+
* @returns The View instance or undefined if not found
|
|
2145
|
+
*/
|
|
2146
|
+
declare function getCustomView(name: string): View | undefined;
|
|
2105
2147
|
|
|
2106
2148
|
/**
|
|
2107
2149
|
* @module dmv2
|
|
@@ -2143,4 +2185,4 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
|
|
|
2143
2185
|
_argType?: ArgType;
|
|
2144
2186
|
};
|
|
2145
2187
|
|
|
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 };
|
|
2188
|
+
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 };
|
|
@@ -1882,50 +1882,21 @@ declare class ETLPipeline<T, U> {
|
|
|
1882
1882
|
run(): Promise<void>;
|
|
1883
1883
|
}
|
|
1884
1884
|
|
|
1885
|
-
type SqlObject = OlapTable<any> | SqlResource;
|
|
1886
1885
|
/**
|
|
1887
|
-
* Represents a
|
|
1888
|
-
*
|
|
1886
|
+
* Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
|
|
1887
|
+
* Emits structured data for the Moose infrastructure system.
|
|
1889
1888
|
*/
|
|
1890
|
-
declare class
|
|
1889
|
+
declare class View {
|
|
1891
1890
|
/** @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). */
|
|
1891
|
+
readonly kind = "CustomView";
|
|
1892
|
+
/** The name of the view */
|
|
1898
1893
|
name: string;
|
|
1899
|
-
/**
|
|
1900
|
-
|
|
1901
|
-
/**
|
|
1902
|
-
|
|
1903
|
-
/** @internal Source file path where this
|
|
1894
|
+
/** The SELECT SQL statement that defines the view */
|
|
1895
|
+
selectSql: string;
|
|
1896
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
1897
|
+
sourceTables: string[];
|
|
1898
|
+
/** @internal Source file path where this view was defined */
|
|
1904
1899
|
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
1900
|
/**
|
|
1930
1901
|
* Creates a new View instance.
|
|
1931
1902
|
* @param name The name of the view to be created.
|
|
@@ -1971,9 +1942,19 @@ interface MaterializedViewConfig<T> {
|
|
|
1971
1942
|
*
|
|
1972
1943
|
* @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
|
|
1973
1944
|
*/
|
|
1974
|
-
declare class MaterializedView<TargetTable>
|
|
1945
|
+
declare class MaterializedView<TargetTable> {
|
|
1946
|
+
/** @internal */
|
|
1947
|
+
readonly kind = "MaterializedView";
|
|
1948
|
+
/** The name of the materialized view */
|
|
1949
|
+
name: string;
|
|
1975
1950
|
/** The target OlapTable instance where the materialized data is stored. */
|
|
1976
1951
|
targetTable: OlapTable<TargetTable>;
|
|
1952
|
+
/** The SELECT SQL statement */
|
|
1953
|
+
selectSql: string;
|
|
1954
|
+
/** Names of source tables that the SELECT reads from */
|
|
1955
|
+
sourceTables: string[];
|
|
1956
|
+
/** @internal Source file path where this MV was defined */
|
|
1957
|
+
sourceFile?: string;
|
|
1977
1958
|
/**
|
|
1978
1959
|
* Creates a new MaterializedView instance.
|
|
1979
1960
|
* Requires the `TargetTable` type parameter to be explicitly provided or inferred,
|
|
@@ -1986,6 +1967,45 @@ declare class MaterializedView<TargetTable> extends SqlResource {
|
|
|
1986
1967
|
constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
|
|
1987
1968
|
}
|
|
1988
1969
|
|
|
1970
|
+
type SqlObject = OlapTable<any> | SqlResource;
|
|
1971
|
+
/**
|
|
1972
|
+
* Represents a generic SQL resource that requires setup and teardown commands.
|
|
1973
|
+
* Base class for constructs like Views and Materialized Views. Tracks dependencies.
|
|
1974
|
+
*/
|
|
1975
|
+
declare class SqlResource {
|
|
1976
|
+
/** @internal */
|
|
1977
|
+
readonly kind = "SqlResource";
|
|
1978
|
+
/** Array of SQL statements to execute for setting up the resource. */
|
|
1979
|
+
setup: readonly string[];
|
|
1980
|
+
/** Array of SQL statements to execute for tearing down the resource. */
|
|
1981
|
+
teardown: readonly string[];
|
|
1982
|
+
/** The name of the SQL resource (e.g., view name, materialized view name). */
|
|
1983
|
+
name: string;
|
|
1984
|
+
/** List of OlapTables or Views that this resource reads data from. */
|
|
1985
|
+
pullsDataFrom: SqlObject[];
|
|
1986
|
+
/** List of OlapTables or Views that this resource writes data to. */
|
|
1987
|
+
pushesDataTo: SqlObject[];
|
|
1988
|
+
/** @internal Source file path where this resource was defined */
|
|
1989
|
+
sourceFile?: string;
|
|
1990
|
+
/** @internal Source line number where this resource was defined */
|
|
1991
|
+
sourceLine?: number;
|
|
1992
|
+
/** @internal Source column number where this resource was defined */
|
|
1993
|
+
sourceColumn?: number;
|
|
1994
|
+
/**
|
|
1995
|
+
* Creates a new SqlResource instance.
|
|
1996
|
+
* @param name The name of the resource.
|
|
1997
|
+
* @param setup An array of SQL DDL statements to create the resource.
|
|
1998
|
+
* @param teardown An array of SQL DDL statements to drop the resource.
|
|
1999
|
+
* @param options Optional configuration for specifying data dependencies.
|
|
2000
|
+
* @param options.pullsDataFrom Tables/Views this resource reads from.
|
|
2001
|
+
* @param options.pushesDataTo Tables/Views this resource writes to.
|
|
2002
|
+
*/
|
|
2003
|
+
constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
|
|
2004
|
+
pullsDataFrom?: SqlObject[];
|
|
2005
|
+
pushesDataTo?: SqlObject[];
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
|
|
1989
2009
|
type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
|
|
1990
2010
|
interface FrameworkApp {
|
|
1991
2011
|
handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
|
|
@@ -2102,6 +2122,28 @@ declare function getWebApps(): Map<string, WebApp>;
|
|
|
2102
2122
|
* @returns The WebApp instance or undefined if not found
|
|
2103
2123
|
*/
|
|
2104
2124
|
declare function getWebApp(name: string): WebApp | undefined;
|
|
2125
|
+
/**
|
|
2126
|
+
* Get all registered materialized views.
|
|
2127
|
+
* @returns A Map of MV name to MaterializedView instance
|
|
2128
|
+
*/
|
|
2129
|
+
declare function getMaterializedViews(): Map<string, MaterializedView<any>>;
|
|
2130
|
+
/**
|
|
2131
|
+
* Get a registered materialized view by name.
|
|
2132
|
+
* @param name - The name of the materialized view
|
|
2133
|
+
* @returns The MaterializedView instance or undefined if not found
|
|
2134
|
+
*/
|
|
2135
|
+
declare function getMaterializedView(name: string): MaterializedView<any> | undefined;
|
|
2136
|
+
/**
|
|
2137
|
+
* Get all registered custom views.
|
|
2138
|
+
* @returns A Map of view name to View instance
|
|
2139
|
+
*/
|
|
2140
|
+
declare function getCustomViews(): Map<string, View>;
|
|
2141
|
+
/**
|
|
2142
|
+
* Get a registered custom view by name.
|
|
2143
|
+
* @param name - The name of the custom view
|
|
2144
|
+
* @returns The View instance or undefined if not found
|
|
2145
|
+
*/
|
|
2146
|
+
declare function getCustomView(name: string): View | undefined;
|
|
2105
2147
|
|
|
2106
2148
|
/**
|
|
2107
2149
|
* @module dmv2
|
|
@@ -2143,4 +2185,4 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
|
|
|
2143
2185
|
_argType?: ArgType;
|
|
2144
2186
|
};
|
|
2145
2187
|
|
|
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 };
|
|
2188
|
+
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-Bs-byVfO.mjs';
|
|
2
|
+
import { K as ApiUtil, a4 as MooseClient } from './index-KhGbXtkS.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-KhGbXtkS.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-D8Hbpq6L.js';
|
|
2
|
+
import { K as ApiUtil, a4 as MooseClient } from './index-KhGbXtkS.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-KhGbXtkS.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
|
@@ -472,13 +472,10 @@ module.exports = __toCommonJS(index_exports);
|
|
|
472
472
|
// src/dmv2/utils/stackTrace.ts
|
|
473
473
|
function shouldSkipStackLine(line) {
|
|
474
474
|
return line.includes("node_modules") || // Skip npm installed packages (prod)
|
|
475
|
-
line.includes("
|
|
476
|
-
line.includes("internal/modules") || // Skip Node.js internals (older format)
|
|
475
|
+
line.includes("internal/modules") || // Skip Node.js internals
|
|
477
476
|
line.includes("ts-node") || // Skip TypeScript execution
|
|
478
|
-
line.includes("/ts-moose-lib/
|
|
479
|
-
line.includes("\\ts-moose-lib\\
|
|
480
|
-
line.includes("/ts-moose-lib/dist/") || // Skip dev/linked moose-lib dist (Unix)
|
|
481
|
-
line.includes("\\ts-moose-lib\\dist\\");
|
|
477
|
+
line.includes("/ts-moose-lib/") || // Skip dev/linked moose-lib (Unix)
|
|
478
|
+
line.includes("\\ts-moose-lib\\");
|
|
482
479
|
}
|
|
483
480
|
function parseStackLine(line) {
|
|
484
481
|
const match = line.match(/\((.*):(\d+):(\d+)\)/) || line.match(/at (.*):(\d+):(\d+)/);
|
|
@@ -581,12 +578,12 @@ var TypedBase = class {
|
|
|
581
578
|
this.validators = validators;
|
|
582
579
|
this.allowExtraFields = allowExtraFields ?? false;
|
|
583
580
|
this.metadata = config?.metadata ? { ...config.metadata } : {};
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
581
|
+
const stack = new Error().stack;
|
|
582
|
+
if (stack) {
|
|
583
|
+
const info = getSourceFileInfo(stack);
|
|
584
|
+
this.metadata.source = { file: info.file, line: info.line };
|
|
585
|
+
} else {
|
|
586
|
+
this.metadata.source = void 0;
|
|
590
587
|
}
|
|
591
588
|
}
|
|
592
589
|
};
|
|
@@ -799,7 +796,9 @@ var moose_internal = {
|
|
|
799
796
|
apis: /* @__PURE__ */ new Map(),
|
|
800
797
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
801
798
|
workflows: /* @__PURE__ */ new Map(),
|
|
802
|
-
webApps: /* @__PURE__ */ new Map()
|
|
799
|
+
webApps: /* @__PURE__ */ new Map(),
|
|
800
|
+
materializedViews: /* @__PURE__ */ new Map(),
|
|
801
|
+
customViews: /* @__PURE__ */ new Map()
|
|
803
802
|
};
|
|
804
803
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
805
804
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -815,6 +814,8 @@ var loadIndex = () => {
|
|
|
815
814
|
registry.sqlResources.clear();
|
|
816
815
|
registry.workflows.clear();
|
|
817
816
|
registry.webApps.clear();
|
|
817
|
+
registry.materializedViews.clear();
|
|
818
|
+
registry.customViews.clear();
|
|
818
819
|
const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
|
|
819
820
|
Object.keys(require.cache).forEach((key) => {
|
|
820
821
|
if (key.startsWith(appDir)) {
|
|
@@ -2461,6 +2462,67 @@ var ETLPipeline = class {
|
|
|
2461
2462
|
}
|
|
2462
2463
|
};
|
|
2463
2464
|
|
|
2465
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2466
|
+
var requireTargetTableName = (tableName) => {
|
|
2467
|
+
if (typeof tableName === "string") {
|
|
2468
|
+
return tableName;
|
|
2469
|
+
} else {
|
|
2470
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2471
|
+
}
|
|
2472
|
+
};
|
|
2473
|
+
var MaterializedView = class {
|
|
2474
|
+
/** @internal */
|
|
2475
|
+
kind = "MaterializedView";
|
|
2476
|
+
/** The name of the materialized view */
|
|
2477
|
+
name;
|
|
2478
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2479
|
+
targetTable;
|
|
2480
|
+
/** The SELECT SQL statement */
|
|
2481
|
+
selectSql;
|
|
2482
|
+
/** Names of source tables that the SELECT reads from */
|
|
2483
|
+
sourceTables;
|
|
2484
|
+
/** @internal Source file path where this MV was defined */
|
|
2485
|
+
sourceFile;
|
|
2486
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2487
|
+
let selectStatement = options.selectStatement;
|
|
2488
|
+
if (typeof selectStatement !== "string") {
|
|
2489
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2490
|
+
}
|
|
2491
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2492
|
+
throw new Error(
|
|
2493
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2494
|
+
);
|
|
2495
|
+
}
|
|
2496
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2497
|
+
requireTargetTableName(
|
|
2498
|
+
options.targetTable?.name ?? options.tableName
|
|
2499
|
+
),
|
|
2500
|
+
{
|
|
2501
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2502
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2503
|
+
},
|
|
2504
|
+
targetSchema,
|
|
2505
|
+
targetColumns
|
|
2506
|
+
);
|
|
2507
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2508
|
+
throw new Error(
|
|
2509
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2510
|
+
);
|
|
2511
|
+
}
|
|
2512
|
+
this.name = options.materializedViewName;
|
|
2513
|
+
this.targetTable = targetTable;
|
|
2514
|
+
this.selectSql = selectStatement;
|
|
2515
|
+
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2516
|
+
const stack = new Error().stack;
|
|
2517
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2518
|
+
const materializedViews = getMooseInternal().materializedViews;
|
|
2519
|
+
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2520
|
+
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2521
|
+
}
|
|
2522
|
+
materializedViews.set(this.name, this);
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
|
|
2464
2526
|
// src/dmv2/sdk/sqlResource.ts
|
|
2465
2527
|
var SqlResource = class {
|
|
2466
2528
|
/** @internal */
|
|
@@ -2515,66 +2577,18 @@ var SqlResource = class {
|
|
|
2515
2577
|
}
|
|
2516
2578
|
};
|
|
2517
2579
|
|
|
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
2580
|
// src/dmv2/sdk/view.ts
|
|
2577
|
-
var View = class
|
|
2581
|
+
var View = class {
|
|
2582
|
+
/** @internal */
|
|
2583
|
+
kind = "CustomView";
|
|
2584
|
+
/** The name of the view */
|
|
2585
|
+
name;
|
|
2586
|
+
/** The SELECT SQL statement that defines the view */
|
|
2587
|
+
selectSql;
|
|
2588
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
2589
|
+
sourceTables;
|
|
2590
|
+
/** @internal Source file path where this view was defined */
|
|
2591
|
+
sourceFile;
|
|
2578
2592
|
/**
|
|
2579
2593
|
* Creates a new View instance.
|
|
2580
2594
|
* @param name The name of the view to be created.
|
|
@@ -2585,17 +2599,16 @@ var View = class extends SqlResource {
|
|
|
2585
2599
|
if (typeof selectStatement !== "string") {
|
|
2586
2600
|
selectStatement = toStaticQuery(selectStatement);
|
|
2587
2601
|
}
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
{
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
);
|
|
2602
|
+
this.name = name;
|
|
2603
|
+
this.selectSql = selectStatement;
|
|
2604
|
+
this.sourceTables = baseTables.map((t) => t.name);
|
|
2605
|
+
const stack = new Error().stack;
|
|
2606
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2607
|
+
const customViews = getMooseInternal().customViews;
|
|
2608
|
+
if (!isClientOnlyMode() && customViews.has(this.name)) {
|
|
2609
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2610
|
+
}
|
|
2611
|
+
customViews.set(this.name, this);
|
|
2599
2612
|
}
|
|
2600
2613
|
};
|
|
2601
2614
|
|