@514labs/moose-lib 0.6.266-ci-8-ge6e86870 → 0.6.266-ci-5-g898c2c66

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.
@@ -1841,21 +1841,50 @@ declare class ETLPipeline<T, U> {
1841
1841
  run(): Promise<void>;
1842
1842
  }
1843
1843
 
1844
+ type SqlObject = OlapTable<any> | SqlResource;
1844
1845
  /**
1845
- * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1846
- * Emits structured data for the Moose infrastructure system.
1846
+ * Represents a generic SQL resource that requires setup and teardown commands.
1847
+ * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1847
1848
  */
1848
- declare class View {
1849
+ declare class SqlResource {
1849
1850
  /** @internal */
1850
- readonly kind = "CustomView";
1851
- /** The name of the view */
1851
+ readonly kind = "SqlResource";
1852
+ /** Array of SQL statements to execute for setting up the resource. */
1853
+ setup: readonly string[];
1854
+ /** Array of SQL statements to execute for tearing down the resource. */
1855
+ teardown: readonly string[];
1856
+ /** The name of the SQL resource (e.g., view name, materialized view name). */
1852
1857
  name: string;
1853
- /** The SELECT SQL statement that defines the view */
1854
- selectSql: string;
1855
- /** Names of source tables/views that the SELECT reads from */
1856
- sourceTables: string[];
1857
- /** @internal Source file path where this view was defined */
1858
+ /** List of OlapTables or Views that this resource reads data from. */
1859
+ pullsDataFrom: SqlObject[];
1860
+ /** List of OlapTables or Views that this resource writes data to. */
1861
+ pushesDataTo: SqlObject[];
1862
+ /** @internal Source file path where this resource was defined */
1858
1863
  sourceFile?: string;
1864
+ /** @internal Source line number where this resource was defined */
1865
+ sourceLine?: number;
1866
+ /** @internal Source column number where this resource was defined */
1867
+ sourceColumn?: number;
1868
+ /**
1869
+ * Creates a new SqlResource instance.
1870
+ * @param name The name of the resource.
1871
+ * @param setup An array of SQL DDL statements to create the resource.
1872
+ * @param teardown An array of SQL DDL statements to drop the resource.
1873
+ * @param options Optional configuration for specifying data dependencies.
1874
+ * @param options.pullsDataFrom Tables/Views this resource reads from.
1875
+ * @param options.pushesDataTo Tables/Views this resource writes to.
1876
+ */
1877
+ constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
1878
+ pullsDataFrom?: SqlObject[];
1879
+ pushesDataTo?: SqlObject[];
1880
+ });
1881
+ }
1882
+
1883
+ /**
1884
+ * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1885
+ * Inherits from SqlResource, providing setup (CREATE VIEW) and teardown (DROP VIEW) commands.
1886
+ */
1887
+ declare class View extends SqlResource {
1859
1888
  /**
1860
1889
  * Creates a new View instance.
1861
1890
  * @param name The name of the view to be created.
@@ -1901,19 +1930,9 @@ interface MaterializedViewConfig<T> {
1901
1930
  *
1902
1931
  * @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
1903
1932
  */
1904
- declare class MaterializedView<TargetTable> {
1905
- /** @internal */
1906
- readonly kind = "MaterializedView";
1907
- /** The name of the materialized view */
1908
- name: string;
1933
+ declare class MaterializedView<TargetTable> extends SqlResource {
1909
1934
  /** The target OlapTable instance where the materialized data is stored. */
1910
1935
  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
1936
  /**
1918
1937
  * Creates a new MaterializedView instance.
1919
1938
  * Requires the `TargetTable` type parameter to be explicitly provided or inferred,
@@ -1926,45 +1945,6 @@ declare class MaterializedView<TargetTable> {
1926
1945
  constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
1927
1946
  }
1928
1947
 
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
1948
  type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
1969
1949
  interface FrameworkApp {
1970
1950
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
@@ -1841,21 +1841,50 @@ declare class ETLPipeline<T, U> {
1841
1841
  run(): Promise<void>;
1842
1842
  }
1843
1843
 
1844
+ type SqlObject = OlapTable<any> | SqlResource;
1844
1845
  /**
1845
- * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1846
- * Emits structured data for the Moose infrastructure system.
1846
+ * Represents a generic SQL resource that requires setup and teardown commands.
1847
+ * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1847
1848
  */
1848
- declare class View {
1849
+ declare class SqlResource {
1849
1850
  /** @internal */
1850
- readonly kind = "CustomView";
1851
- /** The name of the view */
1851
+ readonly kind = "SqlResource";
1852
+ /** Array of SQL statements to execute for setting up the resource. */
1853
+ setup: readonly string[];
1854
+ /** Array of SQL statements to execute for tearing down the resource. */
1855
+ teardown: readonly string[];
1856
+ /** The name of the SQL resource (e.g., view name, materialized view name). */
1852
1857
  name: string;
1853
- /** The SELECT SQL statement that defines the view */
1854
- selectSql: string;
1855
- /** Names of source tables/views that the SELECT reads from */
1856
- sourceTables: string[];
1857
- /** @internal Source file path where this view was defined */
1858
+ /** List of OlapTables or Views that this resource reads data from. */
1859
+ pullsDataFrom: SqlObject[];
1860
+ /** List of OlapTables or Views that this resource writes data to. */
1861
+ pushesDataTo: SqlObject[];
1862
+ /** @internal Source file path where this resource was defined */
1858
1863
  sourceFile?: string;
1864
+ /** @internal Source line number where this resource was defined */
1865
+ sourceLine?: number;
1866
+ /** @internal Source column number where this resource was defined */
1867
+ sourceColumn?: number;
1868
+ /**
1869
+ * Creates a new SqlResource instance.
1870
+ * @param name The name of the resource.
1871
+ * @param setup An array of SQL DDL statements to create the resource.
1872
+ * @param teardown An array of SQL DDL statements to drop the resource.
1873
+ * @param options Optional configuration for specifying data dependencies.
1874
+ * @param options.pullsDataFrom Tables/Views this resource reads from.
1875
+ * @param options.pushesDataTo Tables/Views this resource writes to.
1876
+ */
1877
+ constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
1878
+ pullsDataFrom?: SqlObject[];
1879
+ pushesDataTo?: SqlObject[];
1880
+ });
1881
+ }
1882
+
1883
+ /**
1884
+ * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1885
+ * Inherits from SqlResource, providing setup (CREATE VIEW) and teardown (DROP VIEW) commands.
1886
+ */
1887
+ declare class View extends SqlResource {
1859
1888
  /**
1860
1889
  * Creates a new View instance.
1861
1890
  * @param name The name of the view to be created.
@@ -1901,19 +1930,9 @@ interface MaterializedViewConfig<T> {
1901
1930
  *
1902
1931
  * @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
1903
1932
  */
1904
- declare class MaterializedView<TargetTable> {
1905
- /** @internal */
1906
- readonly kind = "MaterializedView";
1907
- /** The name of the materialized view */
1908
- name: string;
1933
+ declare class MaterializedView<TargetTable> extends SqlResource {
1909
1934
  /** The target OlapTable instance where the materialized data is stored. */
1910
1935
  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
1936
  /**
1918
1937
  * Creates a new MaterializedView instance.
1919
1938
  * Requires the `TargetTable` type parameter to be explicitly provided or inferred,
@@ -1926,45 +1945,6 @@ declare class MaterializedView<TargetTable> {
1926
1945
  constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
1927
1946
  }
1928
1947
 
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
1948
  type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
1969
1949
  interface FrameworkApp {
1970
1950
  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-y8O70Ttx.mjs';
2
- import { K as ApiUtil, a4 as MooseClient } from './index-DSzxmiN9.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-DSzxmiN9.mjs';
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-fk6xPzoB.mjs';
2
+ import { K as ApiUtil, a4 as MooseClient } from './index-Dd3ZmpTq.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-Dd3ZmpTq.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-vY6tmKGn.js';
2
- import { K as ApiUtil, a4 as MooseClient } from './index-DSzxmiN9.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-DSzxmiN9.js';
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-CpjUXotI.js';
2
+ import { K as ApiUtil, a4 as MooseClient } from './index-Dd3ZmpTq.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-Dd3ZmpTq.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
@@ -794,9 +794,7 @@ var moose_internal = {
794
794
  apis: /* @__PURE__ */ new Map(),
795
795
  sqlResources: /* @__PURE__ */ new Map(),
796
796
  workflows: /* @__PURE__ */ new Map(),
797
- webApps: /* @__PURE__ */ new Map(),
798
- materializedViews: /* @__PURE__ */ new Map(),
799
- customViews: /* @__PURE__ */ new Map()
797
+ webApps: /* @__PURE__ */ new Map()
800
798
  };
801
799
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
802
800
  var getMooseInternal = () => globalThis.moose_internal;
@@ -812,8 +810,6 @@ var loadIndex = () => {
812
810
  registry.sqlResources.clear();
813
811
  registry.workflows.clear();
814
812
  registry.webApps.clear();
815
- registry.materializedViews.clear();
816
- registry.customViews.clear();
817
813
  const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
818
814
  Object.keys(require.cache).forEach((key) => {
819
815
  if (key.startsWith(appDir)) {
@@ -2458,67 +2454,6 @@ var ETLPipeline = class {
2458
2454
  }
2459
2455
  };
2460
2456
 
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
2457
  // src/dmv2/sdk/sqlResource.ts
2523
2458
  var SqlResource = class {
2524
2459
  /** @internal */
@@ -2573,18 +2508,66 @@ var SqlResource = class {
2573
2508
  }
2574
2509
  };
2575
2510
 
2511
+ // src/dmv2/sdk/materializedView.ts
2512
+ var requireTargetTableName = (tableName) => {
2513
+ if (typeof tableName === "string") {
2514
+ return tableName;
2515
+ } else {
2516
+ throw new Error("Name of targetTable is not specified.");
2517
+ }
2518
+ };
2519
+ var MaterializedView = class extends SqlResource {
2520
+ /** The target OlapTable instance where the materialized data is stored. */
2521
+ targetTable;
2522
+ constructor(options, targetSchema, targetColumns) {
2523
+ let selectStatement = options.selectStatement;
2524
+ if (typeof selectStatement !== "string") {
2525
+ selectStatement = toStaticQuery(selectStatement);
2526
+ }
2527
+ if (targetSchema === void 0 || targetColumns === void 0) {
2528
+ throw new Error(
2529
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2530
+ );
2531
+ }
2532
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2533
+ requireTargetTableName(
2534
+ options.targetTable?.name ?? options.tableName
2535
+ ),
2536
+ {
2537
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2538
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2539
+ },
2540
+ targetSchema,
2541
+ targetColumns
2542
+ );
2543
+ if (targetTable.name === options.materializedViewName) {
2544
+ throw new Error(
2545
+ "Materialized view name cannot be the same as the target table name."
2546
+ );
2547
+ }
2548
+ super(
2549
+ options.materializedViewName,
2550
+ [
2551
+ createMaterializedView({
2552
+ name: options.materializedViewName,
2553
+ destinationTable: targetTable.name,
2554
+ select: selectStatement
2555
+ })
2556
+ // Population is now handled automatically by Rust infrastructure
2557
+ // based on table engine type and whether this is a new or updated view
2558
+ ],
2559
+ [dropView(options.materializedViewName)],
2560
+ {
2561
+ pullsDataFrom: options.selectTables,
2562
+ pushesDataTo: [targetTable]
2563
+ }
2564
+ );
2565
+ this.targetTable = targetTable;
2566
+ }
2567
+ };
2568
+
2576
2569
  // 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;
2570
+ var View = class extends SqlResource {
2588
2571
  /**
2589
2572
  * Creates a new View instance.
2590
2573
  * @param name The name of the view to be created.
@@ -2595,16 +2578,17 @@ var View = class {
2595
2578
  if (typeof selectStatement !== "string") {
2596
2579
  selectStatement = toStaticQuery(selectStatement);
2597
2580
  }
2598
- this.name = name;
2599
- this.selectSql = selectStatement;
2600
- this.sourceTables = baseTables.map((t) => t.name);
2601
- const stack = new Error().stack;
2602
- this.sourceFile = getSourceFileFromStack(stack);
2603
- const customViews = getMooseInternal().customViews;
2604
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2605
- throw new Error(`View with name ${this.name} already exists`);
2606
- }
2607
- customViews.set(this.name, this);
2581
+ super(
2582
+ name,
2583
+ [
2584
+ `CREATE VIEW IF NOT EXISTS ${name}
2585
+ AS ${selectStatement}`.trim()
2586
+ ],
2587
+ [dropView(name)],
2588
+ {
2589
+ pullsDataFrom: baseTables
2590
+ }
2591
+ );
2608
2592
  }
2609
2593
  };
2610
2594