@514labs/moose-lib 0.6.441 → 0.6.443
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.js +6 -6
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +6 -6
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +1 -0
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +1 -0
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { JWT, Key } from './browserCompatible.mjs';
|
|
2
2
|
import * as _clickhouse_client from '@clickhouse/client';
|
|
3
3
|
import { KafkaJS } from '@514labs/kafka-javascript';
|
|
4
|
-
import { aF as MooseUtils, aG as MooseClient, ay as Sql, O as OlapTable, aH as Column, aI as QueryClient, aJ as DataType } from './index-D22Yb8pY.mjs';
|
|
5
|
-
export { A as Aggregated, h as Api, i as ApiConfig, aS as ApiHelpers, ap as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, aM as ClickHouseLineString, a5 as ClickHouseMaterialized, aN as ClickHouseMultiLineString, aP as ClickHouseMultiPolygon, a2 as ClickHouseNamedTuple, aK as ClickHousePoint, aO as ClickHousePolygon, U as ClickHousePrecision, aL as ClickHouseRing, a4 as ClickHouseTTL, j as ConsumptionApi, aT as ConsumptionHelpers, aq as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, as as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality,
|
|
4
|
+
import { aF as MooseUtils, aG as MooseClient, ay as Sql, O as OlapTable, M as MaterializedView, aH as Column, aI as QueryClient, aJ as DataType } from './index-D22Yb8pY.mjs';
|
|
5
|
+
export { A as Aggregated, h as Api, i as ApiConfig, aS as ApiHelpers, ap as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, aM as ClickHouseLineString, a5 as ClickHouseMaterialized, aN as ClickHouseMultiLineString, aP as ClickHouseMultiPolygon, a2 as ClickHouseNamedTuple, aK as ClickHousePoint, aO as ClickHousePolygon, U as ClickHousePrecision, aL as ClickHouseRing, a4 as ClickHouseTTL, j as ConsumptionApi, aT as ConsumptionHelpers, aq as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, as as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, at as NonIdentifierBrandedString, a as OlapConfig, av as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, l as SqlResource, aw as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, au as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aQ as WorkflowClient, aD as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aR as getTemporalClient, aC as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aU as joinQueries, aE as mapToClickHouseType, ar as quoteIdentifier, ax as sql, aA as toQuery, aB as toQueryPreview, az as toStaticQuery } from './index-D22Yb8pY.mjs';
|
|
6
6
|
import http from 'http';
|
|
7
7
|
import { IsTuple } from 'typia/lib/typings/IsTuple';
|
|
8
8
|
import { Readable } from 'node:stream';
|
|
@@ -725,7 +725,7 @@ interface ColumnDef<TModel = any, TKey extends keyof TModel = keyof TModel> {
|
|
|
725
725
|
* }
|
|
726
726
|
*/
|
|
727
727
|
interface JoinDef {
|
|
728
|
-
table: OlapTable<any>;
|
|
728
|
+
table: OlapTable<any> | MaterializedView<any>;
|
|
729
729
|
on?: Sql;
|
|
730
730
|
leftKey?: string;
|
|
731
731
|
rightKey?: string;
|
|
@@ -844,8 +844,8 @@ interface QueryModelConfig<TTable, TMetrics extends Record<string, MetricDef>, T
|
|
|
844
844
|
name?: string;
|
|
845
845
|
/** Tool description used by registerModelTools */
|
|
846
846
|
description?: string;
|
|
847
|
-
/** The OlapTable to query */
|
|
848
|
-
table: OlapTable<TTable>;
|
|
847
|
+
/** The OlapTable or MaterializedView to query. If a MaterializedView is passed, its targetTable is used. */
|
|
848
|
+
table: OlapTable<TTable> | MaterializedView<TTable>;
|
|
849
849
|
/**
|
|
850
850
|
* Dimension fields — columns used for grouping, filtering, and display.
|
|
851
851
|
*
|
|
@@ -947,11 +947,11 @@ interface QueryModel<TTable, TMetrics extends Record<string, MetricDef>, TDimens
|
|
|
947
947
|
readonly $inferRequest: QueryRequest<Names<TMetrics>, Names<TDimensions>, TFilters, TSortable, Names<TColumns>, TTable>;
|
|
948
948
|
readonly $inferResult: TResult;
|
|
949
949
|
/** Execute query with Moose QueryClient. */
|
|
950
|
-
query
|
|
950
|
+
query(request: QueryRequest<Names<TMetrics>, Names<TDimensions>, TFilters, TSortable, Names<TColumns>, TTable>, client: QueryClient): Promise<TResult[]>;
|
|
951
951
|
/** Build complete SQL query from request. */
|
|
952
|
-
toSql
|
|
952
|
+
toSql(request: QueryRequest<Names<TMetrics>, Names<TDimensions>, TFilters, TSortable, Names<TColumns>, TTable>): Sql;
|
|
953
953
|
/** Get individual SQL parts for custom assembly. */
|
|
954
|
-
toParts
|
|
954
|
+
toParts(request: QueryRequest<Names<TMetrics>, Names<TDimensions>, TFilters, TSortable, Names<TColumns>, TTable>): QueryParts;
|
|
955
955
|
}
|
|
956
956
|
/**
|
|
957
957
|
* Define a query model with controlled field selection, filtering, and sorting.
|
|
@@ -1390,4 +1390,4 @@ type DataModelConfig<T> = Partial<{
|
|
|
1390
1390
|
parallelism?: number;
|
|
1391
1391
|
}>;
|
|
1392
1392
|
|
|
1393
|
-
export { ACKs, BadRequestError, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, type ColRef, Column, type ColumnDef, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type DimensionDef, type Expr, type ExpressRequestWithMoose, type ExtractionResult, type FilterDefBase, type FilterInputTypeHint, type FilterOperator, type FilterParams, type JSONParsingConfig, type JoinDef, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, type MetricDef, type ModelFilterDef, type ModelToolOptions, type ModelToolResult, MooseCache, MooseClient, MooseUtils, type Names, OlapTable, type OperatorValueType, type Producer, type QueryBuilder, QueryClient, type QueryHandler, type QueryModel, type QueryModelBase, type QueryModelConfig, type QueryModelFilter, type QueryParts, type QueryRequest, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type SortDir, Sql, type SqlValue, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, type ValidationError, and, antiCachePath, as, assertValid, avg, between, buildQuery, cliLog, columnsFromTable, compilerLog, count, countDistinct, createModelTool, createProducerConfig, createQueryHandler, defineQueryModel, deriveInputTypeFromDataType, empty, eq, expressMiddleware, filter, filtersFromTable, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getLegacyMooseUtils, getMooseClients, getMooseUtils, getMooseUtilsFromRequest, groupBy, gt, gte, having, ilike, inList, isEmpty, isNotNull, isNull, isValidCSVDelimiter, join, like, limit, logError, lt, lte, mapTstoJs, max, min, mooseEnvSecrets, mooseRuntimeEnv, ne, not, notIn, offset, or, orderBy, paginate, parseCSV, parseJSON, parseJSONWithDates, raw, registerModelTools, rewriteImportExtensions, select, sum, timeDimensions, where };
|
|
1393
|
+
export { ACKs, BadRequestError, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, type ColRef, Column, type ColumnDef, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type DimensionDef, type Expr, type ExpressRequestWithMoose, type ExtractionResult, type FilterDefBase, type FilterInputTypeHint, type FilterOperator, type FilterParams, type JSONParsingConfig, type JoinDef, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MaterializedView, type MetricDef, type ModelFilterDef, type ModelToolOptions, type ModelToolResult, MooseCache, MooseClient, MooseUtils, type Names, OlapTable, type OperatorValueType, type Producer, type QueryBuilder, QueryClient, type QueryHandler, type QueryModel, type QueryModelBase, type QueryModelConfig, type QueryModelFilter, type QueryParts, type QueryRequest, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type SortDir, Sql, type SqlValue, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, type ValidationError, and, antiCachePath, as, assertValid, avg, between, buildQuery, cliLog, columnsFromTable, compilerLog, count, countDistinct, createModelTool, createProducerConfig, createQueryHandler, defineQueryModel, deriveInputTypeFromDataType, empty, eq, expressMiddleware, filter, filtersFromTable, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getLegacyMooseUtils, getMooseClients, getMooseUtils, getMooseUtilsFromRequest, groupBy, gt, gte, having, ilike, inList, isEmpty, isNotNull, isNull, isValidCSVDelimiter, join, like, limit, logError, lt, lte, mapTstoJs, max, min, mooseEnvSecrets, mooseRuntimeEnv, ne, not, notIn, offset, or, orderBy, paginate, parseCSV, parseJSON, parseJSONWithDates, raw, registerModelTools, rewriteImportExtensions, select, sum, timeDimensions, where };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { JWT, Key } from './browserCompatible.js';
|
|
2
2
|
import * as _clickhouse_client from '@clickhouse/client';
|
|
3
3
|
import { KafkaJS } from '@514labs/kafka-javascript';
|
|
4
|
-
import { aF as MooseUtils, aG as MooseClient, ay as Sql, O as OlapTable, aH as Column, aI as QueryClient, aJ as DataType } from './index-D22Yb8pY.js';
|
|
5
|
-
export { A as Aggregated, h as Api, i as ApiConfig, aS as ApiHelpers, ap as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, aM as ClickHouseLineString, a5 as ClickHouseMaterialized, aN as ClickHouseMultiLineString, aP as ClickHouseMultiPolygon, a2 as ClickHouseNamedTuple, aK as ClickHousePoint, aO as ClickHousePolygon, U as ClickHousePrecision, aL as ClickHouseRing, a4 as ClickHouseTTL, j as ConsumptionApi, aT as ConsumptionHelpers, aq as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, as as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality,
|
|
4
|
+
import { aF as MooseUtils, aG as MooseClient, ay as Sql, O as OlapTable, M as MaterializedView, aH as Column, aI as QueryClient, aJ as DataType } from './index-D22Yb8pY.js';
|
|
5
|
+
export { A as Aggregated, h as Api, i as ApiConfig, aS as ApiHelpers, ap as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, aM as ClickHouseLineString, a5 as ClickHouseMaterialized, aN as ClickHouseMultiLineString, aP as ClickHouseMultiPolygon, a2 as ClickHouseNamedTuple, aK as ClickHousePoint, aO as ClickHousePolygon, U as ClickHousePrecision, aL as ClickHouseRing, a4 as ClickHouseTTL, j as ConsumptionApi, aT as ConsumptionHelpers, aq as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, as as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, at as NonIdentifierBrandedString, a as OlapConfig, av as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, l as SqlResource, aw as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, au as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aQ as WorkflowClient, aD as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aR as getTemporalClient, aC as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aU as joinQueries, aE as mapToClickHouseType, ar as quoteIdentifier, ax as sql, aA as toQuery, aB as toQueryPreview, az as toStaticQuery } from './index-D22Yb8pY.js';
|
|
6
6
|
import http from 'http';
|
|
7
7
|
import { IsTuple } from 'typia/lib/typings/IsTuple';
|
|
8
8
|
import { Readable } from 'node:stream';
|
|
@@ -725,7 +725,7 @@ interface ColumnDef<TModel = any, TKey extends keyof TModel = keyof TModel> {
|
|
|
725
725
|
* }
|
|
726
726
|
*/
|
|
727
727
|
interface JoinDef {
|
|
728
|
-
table: OlapTable<any>;
|
|
728
|
+
table: OlapTable<any> | MaterializedView<any>;
|
|
729
729
|
on?: Sql;
|
|
730
730
|
leftKey?: string;
|
|
731
731
|
rightKey?: string;
|
|
@@ -844,8 +844,8 @@ interface QueryModelConfig<TTable, TMetrics extends Record<string, MetricDef>, T
|
|
|
844
844
|
name?: string;
|
|
845
845
|
/** Tool description used by registerModelTools */
|
|
846
846
|
description?: string;
|
|
847
|
-
/** The OlapTable to query */
|
|
848
|
-
table: OlapTable<TTable>;
|
|
847
|
+
/** The OlapTable or MaterializedView to query. If a MaterializedView is passed, its targetTable is used. */
|
|
848
|
+
table: OlapTable<TTable> | MaterializedView<TTable>;
|
|
849
849
|
/**
|
|
850
850
|
* Dimension fields — columns used for grouping, filtering, and display.
|
|
851
851
|
*
|
|
@@ -947,11 +947,11 @@ interface QueryModel<TTable, TMetrics extends Record<string, MetricDef>, TDimens
|
|
|
947
947
|
readonly $inferRequest: QueryRequest<Names<TMetrics>, Names<TDimensions>, TFilters, TSortable, Names<TColumns>, TTable>;
|
|
948
948
|
readonly $inferResult: TResult;
|
|
949
949
|
/** Execute query with Moose QueryClient. */
|
|
950
|
-
query
|
|
950
|
+
query(request: QueryRequest<Names<TMetrics>, Names<TDimensions>, TFilters, TSortable, Names<TColumns>, TTable>, client: QueryClient): Promise<TResult[]>;
|
|
951
951
|
/** Build complete SQL query from request. */
|
|
952
|
-
toSql
|
|
952
|
+
toSql(request: QueryRequest<Names<TMetrics>, Names<TDimensions>, TFilters, TSortable, Names<TColumns>, TTable>): Sql;
|
|
953
953
|
/** Get individual SQL parts for custom assembly. */
|
|
954
|
-
toParts
|
|
954
|
+
toParts(request: QueryRequest<Names<TMetrics>, Names<TDimensions>, TFilters, TSortable, Names<TColumns>, TTable>): QueryParts;
|
|
955
955
|
}
|
|
956
956
|
/**
|
|
957
957
|
* Define a query model with controlled field selection, filtering, and sorting.
|
|
@@ -1390,4 +1390,4 @@ type DataModelConfig<T> = Partial<{
|
|
|
1390
1390
|
parallelism?: number;
|
|
1391
1391
|
}>;
|
|
1392
1392
|
|
|
1393
|
-
export { ACKs, BadRequestError, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, type ColRef, Column, type ColumnDef, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type DimensionDef, type Expr, type ExpressRequestWithMoose, type ExtractionResult, type FilterDefBase, type FilterInputTypeHint, type FilterOperator, type FilterParams, type JSONParsingConfig, type JoinDef, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, type MetricDef, type ModelFilterDef, type ModelToolOptions, type ModelToolResult, MooseCache, MooseClient, MooseUtils, type Names, OlapTable, type OperatorValueType, type Producer, type QueryBuilder, QueryClient, type QueryHandler, type QueryModel, type QueryModelBase, type QueryModelConfig, type QueryModelFilter, type QueryParts, type QueryRequest, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type SortDir, Sql, type SqlValue, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, type ValidationError, and, antiCachePath, as, assertValid, avg, between, buildQuery, cliLog, columnsFromTable, compilerLog, count, countDistinct, createModelTool, createProducerConfig, createQueryHandler, defineQueryModel, deriveInputTypeFromDataType, empty, eq, expressMiddleware, filter, filtersFromTable, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getLegacyMooseUtils, getMooseClients, getMooseUtils, getMooseUtilsFromRequest, groupBy, gt, gte, having, ilike, inList, isEmpty, isNotNull, isNull, isValidCSVDelimiter, join, like, limit, logError, lt, lte, mapTstoJs, max, min, mooseEnvSecrets, mooseRuntimeEnv, ne, not, notIn, offset, or, orderBy, paginate, parseCSV, parseJSON, parseJSONWithDates, raw, registerModelTools, rewriteImportExtensions, select, sum, timeDimensions, where };
|
|
1393
|
+
export { ACKs, BadRequestError, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, type ColRef, Column, type ColumnDef, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type DimensionDef, type Expr, type ExpressRequestWithMoose, type ExtractionResult, type FilterDefBase, type FilterInputTypeHint, type FilterOperator, type FilterParams, type JSONParsingConfig, type JoinDef, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MaterializedView, type MetricDef, type ModelFilterDef, type ModelToolOptions, type ModelToolResult, MooseCache, MooseClient, MooseUtils, type Names, OlapTable, type OperatorValueType, type Producer, type QueryBuilder, QueryClient, type QueryHandler, type QueryModel, type QueryModelBase, type QueryModelConfig, type QueryModelFilter, type QueryParts, type QueryRequest, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type SortDir, Sql, type SqlValue, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, type ValidationError, and, antiCachePath, as, assertValid, avg, between, buildQuery, cliLog, columnsFromTable, compilerLog, count, countDistinct, createModelTool, createProducerConfig, createQueryHandler, defineQueryModel, deriveInputTypeFromDataType, empty, eq, expressMiddleware, filter, filtersFromTable, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getLegacyMooseUtils, getMooseClients, getMooseUtils, getMooseUtilsFromRequest, groupBy, gt, gte, having, ilike, inList, isEmpty, isNotNull, isNull, isValidCSVDelimiter, join, like, limit, logError, lt, lte, mapTstoJs, max, min, mooseEnvSecrets, mooseRuntimeEnv, ne, not, notIn, offset, or, orderBy, paginate, parseCSV, parseJSON, parseJSONWithDates, raw, registerModelTools, rewriteImportExtensions, select, sum, timeDimensions, where };
|
package/dist/index.js
CHANGED
|
@@ -4227,6 +4227,9 @@ function filtersFromTable(table, options) {
|
|
|
4227
4227
|
// src/query-layer/query-model.ts
|
|
4228
4228
|
var applyFilter = filter;
|
|
4229
4229
|
var identity = (v) => v;
|
|
4230
|
+
function resolveTable(tableOrMv) {
|
|
4231
|
+
return tableOrMv instanceof MaterializedView ? tableOrMv.targetTable : tableOrMv;
|
|
4232
|
+
}
|
|
4230
4233
|
function transformFilterValue(op, value, transform) {
|
|
4231
4234
|
switch (op) {
|
|
4232
4235
|
case "in":
|
|
@@ -4245,7 +4248,7 @@ function transformFilterValue(op, value, transform) {
|
|
|
4245
4248
|
}
|
|
4246
4249
|
function defineQueryModel(config) {
|
|
4247
4250
|
const {
|
|
4248
|
-
table,
|
|
4251
|
+
table: tableOrMv,
|
|
4249
4252
|
dimensions,
|
|
4250
4253
|
metrics,
|
|
4251
4254
|
columns: columnDefs,
|
|
@@ -4254,6 +4257,7 @@ function defineQueryModel(config) {
|
|
|
4254
4257
|
sortable,
|
|
4255
4258
|
defaults = {}
|
|
4256
4259
|
} = config;
|
|
4260
|
+
const table = resolveTable(tableOrMv);
|
|
4257
4261
|
const { maxLimit = 1e3 } = defaults;
|
|
4258
4262
|
const primaryTableName = table.name;
|
|
4259
4263
|
const hasJoins = joinDefs != null && Object.keys(joinDefs).length > 0;
|
|
@@ -4283,7 +4287,7 @@ function defineQueryModel(config) {
|
|
|
4283
4287
|
`Column '${name}' references unknown join '${def.join}'`
|
|
4284
4288
|
);
|
|
4285
4289
|
}
|
|
4286
|
-
const joinTableName = joinDef.table.name;
|
|
4290
|
+
const joinTableName = resolveTable(joinDef.table).name;
|
|
4287
4291
|
normalizedColumns[name] = {
|
|
4288
4292
|
expression: raw(
|
|
4289
4293
|
`${quoteIdentifier(joinTableName)}.${quoteIdentifier(String(def.column))}`
|
|
@@ -4451,9 +4455,10 @@ function defineQueryModel(config) {
|
|
|
4451
4455
|
let fromClause = sql`FROM ${table}`;
|
|
4452
4456
|
for (const [, joinDef] of Object.entries(joinDefs)) {
|
|
4453
4457
|
const joinType = joinDef.type ?? "LEFT";
|
|
4458
|
+
const joinTable = resolveTable(joinDef.table);
|
|
4454
4459
|
let onClause;
|
|
4455
4460
|
if (joinDef.leftKey && joinDef.rightKey) {
|
|
4456
|
-
const joinTableName =
|
|
4461
|
+
const joinTableName = joinTable.name;
|
|
4457
4462
|
onClause = raw(
|
|
4458
4463
|
`${quoteIdentifier(primaryTableName)}.${quoteIdentifier(joinDef.leftKey)} = ${quoteIdentifier(joinTableName)}.${quoteIdentifier(joinDef.rightKey)}`
|
|
4459
4464
|
);
|
|
@@ -4462,7 +4467,7 @@ function defineQueryModel(config) {
|
|
|
4462
4467
|
} else {
|
|
4463
4468
|
throw new Error("JoinDef must specify either leftKey/rightKey or on");
|
|
4464
4469
|
}
|
|
4465
|
-
fromClause = sql`${fromClause} ${raw(joinType)} JOIN ${
|
|
4470
|
+
fromClause = sql`${fromClause} ${raw(joinType)} JOIN ${joinTable} ON ${onClause}`;
|
|
4466
4471
|
}
|
|
4467
4472
|
return fromClause;
|
|
4468
4473
|
}
|