@514labs/moose-lib 0.6.514 → 0.6.515

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.
@@ -1,5 +1,5 @@
1
- export { A as Aggregated, f as Api, g as ApiConfig, R as ApiUtil, C as ConsumptionApi, U as ConsumptionUtil, c as DeadLetter, D as DeadLetterModel, d as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, e as IngestConfig, h as IngestPipeline, M as MaterializedView, j as SelectRowPolicy, k as SelectRowPolicyConfig, S as SimpleAggregated, i as SqlResource, a as Stream, b as StreamConfig, T as Task, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, N as getMaterializedView, O as getMaterializedViews, P as getSelectRowPolicies, Q as getSelectRowPolicy, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, K as getView, L as getViews, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from './index-BCTJXoD8.mjs';
2
- export { n as ClickHouseAlias, d as ClickHouseByteSize, o as ClickHouseCodec, c as ClickHouseDecimal, k as ClickHouseDefault, C as ClickHouseEngines, e as ClickHouseFixedStringSize, f as ClickHouseFloat, g as ClickHouseInt, h as ClickHouseJson, m as ClickHouseMaterialized, j as ClickHouseNamedTuple, b as ClickHousePrecision, l as ClickHouseTTL, D as DateTime, p as DateTime64, r as DateTime64String, q as DateTimeString, A as Decimal, F as FixedString, s as Float32, t as Float64, G as IdentifierBrandedString, B as Insertable, u as Int16, v as Int32, w as Int64, I as Int8, L as LifeCycle, i as LowCardinality, N as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, R as RawValue, S as S3QueueTableSettings, M as Sql, J as SqlTemplateTag, T as TableConstraint, x as UInt16, y as UInt32, z as UInt64, U as UInt8, H as Value, V as View, W as WithDefault, Z as createClickhouseParameter, Y as getValueFromParameter, _ as mapToClickHouseType, E as quoteIdentifier, K as sql, Q as toQuery, X as toQueryPreview, P as toStaticQuery } from './view-CJKyTLjp.mjs';
1
+ export { A as Aggregated, f as Api, g as ApiConfig, R as ApiUtil, C as ConsumptionApi, U as ConsumptionUtil, c as DeadLetter, D as DeadLetterModel, d as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, e as IngestConfig, h as IngestPipeline, M as MaterializedView, j as SelectRowPolicy, k as SelectRowPolicyConfig, S as SimpleAggregated, i as SqlResource, a as Stream, b as StreamConfig, T as Task, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, N as getMaterializedView, O as getMaterializedViews, P as getSelectRowPolicies, Q as getSelectRowPolicy, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, K as getView, L as getViews, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from './index-k_kpRxE3.mjs';
2
+ export { n as ClickHouseAlias, d as ClickHouseByteSize, o as ClickHouseCodec, c as ClickHouseDecimal, k as ClickHouseDefault, C as ClickHouseEngines, e as ClickHouseFixedStringSize, f as ClickHouseFloat, g as ClickHouseInt, h as ClickHouseJson, m as ClickHouseMaterialized, j as ClickHouseNamedTuple, b as ClickHousePrecision, l as ClickHouseTTL, D as DateTime, p as DateTime64, r as DateTime64String, q as DateTimeString, A as Decimal, F as FixedString, s as Float32, t as Float64, G as IdentifierBrandedString, B as Insertable, u as Int16, v as Int32, w as Int64, I as Int8, L as LifeCycle, i as LowCardinality, N as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, R as RawValue, S as S3QueueTableSettings, M as Sql, J as SqlTemplateTag, T as TableConstraint, x as UInt16, y as UInt32, z as UInt64, U as UInt8, H as Value, V as View, W as WithDefault, Z as createClickhouseParameter, Y as getValueFromParameter, _ as mapToClickHouseType, E as quoteIdentifier, K as sql, Q as toQuery, X as toQueryPreview, P as toStaticQuery } from './view-BCWJcLF6.mjs';
3
3
  import 'typia';
4
4
  import '@temporalio/client';
5
5
  import 'jose';
@@ -1,5 +1,5 @@
1
- export { A as Aggregated, f as Api, g as ApiConfig, R as ApiUtil, C as ConsumptionApi, U as ConsumptionUtil, c as DeadLetter, D as DeadLetterModel, d as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, e as IngestConfig, h as IngestPipeline, M as MaterializedView, j as SelectRowPolicy, k as SelectRowPolicyConfig, S as SimpleAggregated, i as SqlResource, a as Stream, b as StreamConfig, T as Task, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, N as getMaterializedView, O as getMaterializedViews, P as getSelectRowPolicies, Q as getSelectRowPolicy, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, K as getView, L as getViews, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from './index-BOIsE8xN.js';
2
- export { n as ClickHouseAlias, d as ClickHouseByteSize, o as ClickHouseCodec, c as ClickHouseDecimal, k as ClickHouseDefault, C as ClickHouseEngines, e as ClickHouseFixedStringSize, f as ClickHouseFloat, g as ClickHouseInt, h as ClickHouseJson, m as ClickHouseMaterialized, j as ClickHouseNamedTuple, b as ClickHousePrecision, l as ClickHouseTTL, D as DateTime, p as DateTime64, r as DateTime64String, q as DateTimeString, A as Decimal, F as FixedString, s as Float32, t as Float64, G as IdentifierBrandedString, B as Insertable, u as Int16, v as Int32, w as Int64, I as Int8, L as LifeCycle, i as LowCardinality, N as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, R as RawValue, S as S3QueueTableSettings, M as Sql, J as SqlTemplateTag, T as TableConstraint, x as UInt16, y as UInt32, z as UInt64, U as UInt8, H as Value, V as View, W as WithDefault, Z as createClickhouseParameter, Y as getValueFromParameter, _ as mapToClickHouseType, E as quoteIdentifier, K as sql, Q as toQuery, X as toQueryPreview, P as toStaticQuery } from './view-CJKyTLjp.js';
1
+ export { A as Aggregated, f as Api, g as ApiConfig, R as ApiUtil, C as ConsumptionApi, U as ConsumptionUtil, c as DeadLetter, D as DeadLetterModel, d as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, e as IngestConfig, h as IngestPipeline, M as MaterializedView, j as SelectRowPolicy, k as SelectRowPolicyConfig, S as SimpleAggregated, i as SqlResource, a as Stream, b as StreamConfig, T as Task, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, N as getMaterializedView, O as getMaterializedViews, P as getSelectRowPolicies, Q as getSelectRowPolicy, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, K as getView, L as getViews, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from './index-7uxZbwmY.js';
2
+ export { n as ClickHouseAlias, d as ClickHouseByteSize, o as ClickHouseCodec, c as ClickHouseDecimal, k as ClickHouseDefault, C as ClickHouseEngines, e as ClickHouseFixedStringSize, f as ClickHouseFloat, g as ClickHouseInt, h as ClickHouseJson, m as ClickHouseMaterialized, j as ClickHouseNamedTuple, b as ClickHousePrecision, l as ClickHouseTTL, D as DateTime, p as DateTime64, r as DateTime64String, q as DateTimeString, A as Decimal, F as FixedString, s as Float32, t as Float64, G as IdentifierBrandedString, B as Insertable, u as Int16, v as Int32, w as Int64, I as Int8, L as LifeCycle, i as LowCardinality, N as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, R as RawValue, S as S3QueueTableSettings, M as Sql, J as SqlTemplateTag, T as TableConstraint, x as UInt16, y as UInt32, z as UInt64, U as UInt8, H as Value, V as View, W as WithDefault, Z as createClickhouseParameter, Y as getValueFromParameter, _ as mapToClickHouseType, E as quoteIdentifier, K as sql, Q as toQuery, X as toQueryPreview, P as toStaticQuery } from './view-BCWJcLF6.js';
3
3
  import 'typia';
4
4
  import '@temporalio/client';
5
5
  import 'jose';
@@ -492,7 +492,7 @@ __export(browserCompatible_exports, {
492
492
  IngestPipeline: () => IngestPipeline,
493
493
  LifeCycle: () => LifeCycle,
494
494
  MaterializedView: () => MaterializedView,
495
- OlapTable: () => OlapTable2,
495
+ OlapTable: () => OlapTable,
496
496
  SelectRowPolicy: () => SelectRowPolicy,
497
497
  Sql: () => Sql,
498
498
  SqlResource: () => SqlResource,
@@ -770,7 +770,11 @@ var Sql = class _Sql {
770
770
  }
771
771
  this.strings[pos] += rawString;
772
772
  } else if (isView(child)) {
773
- this.strings[pos] += `\`${child.name}\``;
773
+ if (child.database) {
774
+ this.strings[pos] += `\`${child.database}\`.\`${child.name}\``;
775
+ } else {
776
+ this.strings[pos] += `\`${child.name}\``;
777
+ }
774
778
  this.strings[pos] += rawString;
775
779
  } else {
776
780
  this.values[pos++] = child;
@@ -897,6 +901,65 @@ var import_redis = require("redis");
897
901
  // src/consumption-apis/standalone.ts
898
902
  init_commons();
899
903
 
904
+ // src/dmv2/sdk/tableReferenceUtils.ts
905
+ function formatTableReference(table) {
906
+ const database = table instanceof OlapTable ? table.config.database : table.database;
907
+ const deployedName = table instanceof OlapTable ? table.generateTableName() : table.name;
908
+ if (database) {
909
+ return `\`${database}\`.\`${deployedName}\``;
910
+ }
911
+ return `\`${deployedName}\``;
912
+ }
913
+
914
+ // src/dmv2/sdk/view.ts
915
+ function viewRegistryKey(database, name) {
916
+ return database ? `${database}::${name}` : name;
917
+ }
918
+ var View = class {
919
+ /** @internal */
920
+ kind = "View";
921
+ /** The name of the view */
922
+ name;
923
+ /** Optional database where the view is created. When set, the view is created as `database`.`name` in ClickHouse. */
924
+ database;
925
+ /** The SELECT SQL statement that defines the view */
926
+ selectSql;
927
+ /** Names of source tables/views that the SELECT reads from */
928
+ sourceTables;
929
+ /** Optional metadata for the view */
930
+ metadata;
931
+ constructor(name, configOrSelectStatement, baseTables, metadata) {
932
+ const config = typeof configOrSelectStatement === "object" && configOrSelectStatement !== null && "selectStatement" in configOrSelectStatement && "baseTables" in configOrSelectStatement ? configOrSelectStatement : {
933
+ selectStatement: configOrSelectStatement,
934
+ baseTables: baseTables ?? [],
935
+ metadata
936
+ };
937
+ let selectStatement = config.selectStatement;
938
+ if (typeof selectStatement !== "string") {
939
+ selectStatement = toStaticQuery(selectStatement);
940
+ }
941
+ this.name = name;
942
+ this.database = config.database;
943
+ this.selectSql = selectStatement;
944
+ this.sourceTables = config.baseTables.map((t) => formatTableReference(t));
945
+ this.metadata = config.metadata ? { ...config.metadata } : {};
946
+ if (!this.metadata.source) {
947
+ const stack = new Error().stack;
948
+ const sourceInfo = getSourceFileFromStack(stack);
949
+ if (sourceInfo) {
950
+ this.metadata.source = { file: sourceInfo };
951
+ }
952
+ }
953
+ const views = getMooseInternal().views;
954
+ const registryKey = viewRegistryKey(this.database, this.name);
955
+ if (!isClientOnlyMode() && views.has(registryKey)) {
956
+ const qualifiedName = this.database ? `${this.database}.${this.name}` : this.name;
957
+ throw new Error(`View with name ${qualifiedName} already exists`);
958
+ }
959
+ views.set(registryKey, this);
960
+ }
961
+ };
962
+
900
963
  // src/dmv2/registry.ts
901
964
  function getTables() {
902
965
  return getMooseInternal().tables;
@@ -970,8 +1033,9 @@ function getMaterializedView(name) {
970
1033
  function getViews() {
971
1034
  return getMooseInternal().views;
972
1035
  }
973
- function getView(name) {
974
- return getMooseInternal().views.get(name);
1036
+ function getView(name, database) {
1037
+ const key = viewRegistryKey(database, name);
1038
+ return getMooseInternal().views.get(key);
975
1039
  }
976
1040
  function getSelectRowPolicies() {
977
1041
  return getMooseInternal().selectRowPolicies;
@@ -1362,7 +1426,7 @@ var dlqColumns = [
1362
1426
  // src/dmv2/sdk/olapTable.ts
1363
1427
  var import_node_stream = require("stream");
1364
1428
  var import_node_crypto3 = require("crypto");
1365
- var OlapTable2 = class extends TypedBase {
1429
+ var OlapTable = class extends TypedBase {
1366
1430
  name;
1367
1431
  /** @internal */
1368
1432
  kind = "OlapTable";
@@ -2712,7 +2776,7 @@ var IngestPipeline = class extends TypedBase {
2712
2776
  engine: "MergeTree" /* MergeTree */,
2713
2777
  ...config.version && { version: config.version }
2714
2778
  };
2715
- this.table = new OlapTable2(
2779
+ this.table = new OlapTable(
2716
2780
  name,
2717
2781
  tableConfig,
2718
2782
  this.schema,
@@ -2922,56 +2986,6 @@ var ETLPipeline = class {
2922
2986
  }
2923
2987
  };
2924
2988
 
2925
- // src/dmv2/sdk/view.ts
2926
- function formatTableReference(table) {
2927
- const database = table instanceof OlapTable2 ? table.config.database : void 0;
2928
- const deployedName = table instanceof OlapTable2 ? table.generateTableName() : table.name;
2929
- if (database) {
2930
- return `\`${database}\`.\`${deployedName}\``;
2931
- }
2932
- return `\`${deployedName}\``;
2933
- }
2934
- var View = class {
2935
- /** @internal */
2936
- kind = "View";
2937
- /** The name of the view */
2938
- name;
2939
- /** The SELECT SQL statement that defines the view */
2940
- selectSql;
2941
- /** Names of source tables/views that the SELECT reads from */
2942
- sourceTables;
2943
- /** Optional metadata for the view */
2944
- metadata;
2945
- /**
2946
- * Creates a new View instance.
2947
- * @param name The name of the view to be created.
2948
- * @param selectStatement The SQL SELECT statement that defines the view's logic.
2949
- * @param baseTables An array of OlapTable or View objects that the `selectStatement` reads from. Used for dependency tracking.
2950
- * @param metadata Optional metadata for the view (e.g., description, source file).
2951
- */
2952
- constructor(name, selectStatement, baseTables, metadata) {
2953
- if (typeof selectStatement !== "string") {
2954
- selectStatement = toStaticQuery(selectStatement);
2955
- }
2956
- this.name = name;
2957
- this.selectSql = selectStatement;
2958
- this.sourceTables = baseTables.map((t) => formatTableReference(t));
2959
- this.metadata = metadata ? { ...metadata } : {};
2960
- if (!this.metadata.source) {
2961
- const stack = new Error().stack;
2962
- const sourceInfo = getSourceFileFromStack(stack);
2963
- if (sourceInfo) {
2964
- this.metadata.source = { file: sourceInfo };
2965
- }
2966
- }
2967
- const views = getMooseInternal().views;
2968
- if (!isClientOnlyMode() && views.has(this.name)) {
2969
- throw new Error(`View with name ${this.name} already exists`);
2970
- }
2971
- views.set(this.name, this);
2972
- }
2973
- };
2974
-
2975
2989
  // src/dmv2/sdk/materializedView.ts
2976
2990
  var requireTargetTableName = (tableName) => {
2977
2991
  if (typeof tableName === "string") {
@@ -3005,7 +3019,7 @@ var MaterializedView = class {
3005
3019
  "Supply the type param T so that the schema is inserted by the compiler plugin."
3006
3020
  );
3007
3021
  }
3008
- const targetTable = options.targetTable instanceof OlapTable2 ? options.targetTable : new OlapTable2(
3022
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
3009
3023
  requireTargetTableName(
3010
3024
  options.targetTable?.name ?? options.tableName
3011
3025
  ),