@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 { C as ClickHouseEngines, L as LifeCycle, a as OlapConfig, O as OlapTable, S as S3QueueTableSettings, T as TableConstraint, V as View } from '../view-CJKyTLjp.mjs';
2
- export { A as Aggregated, f as Api, g as ApiConfig, a6 as ConsumerConfig, C as ConsumptionApi, 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, aa as IngestPipelineConfig, M as MaterializedView, ab as MaterializedViewConfig, j as SelectRowPolicy, k as SelectRowPolicyConfig, S as SimpleAggregated, i as SqlResource, a as Stream, b as StreamConfig, T as Task, a9 as TaskConfig, a8 as TaskContext, a7 as TransformConfig, 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';
1
+ export { C as ClickHouseEngines, L as LifeCycle, a as OlapConfig, O as OlapTable, S as S3QueueTableSettings, T as TableConstraint, V as View, a4 as ViewConfig } from '../view-BCWJcLF6.mjs';
2
+ export { A as Aggregated, f as Api, g as ApiConfig, a6 as ConsumerConfig, C as ConsumptionApi, 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, aa as IngestPipelineConfig, M as MaterializedView, ab as MaterializedViewConfig, j as SelectRowPolicy, k as SelectRowPolicyConfig, S as SimpleAggregated, i as SqlResource, a as Stream, b as StreamConfig, T as Task, a9 as TaskConfig, a8 as TaskContext, a7 as TransformConfig, 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';
3
3
  import '@clickhouse/client';
4
4
  import 'typia';
5
5
  import 'typia/lib/tags';
@@ -1,5 +1,5 @@
1
- export { C as ClickHouseEngines, L as LifeCycle, a as OlapConfig, O as OlapTable, S as S3QueueTableSettings, T as TableConstraint, V as View } from '../view-CJKyTLjp.js';
2
- export { A as Aggregated, f as Api, g as ApiConfig, a6 as ConsumerConfig, C as ConsumptionApi, 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, aa as IngestPipelineConfig, M as MaterializedView, ab as MaterializedViewConfig, j as SelectRowPolicy, k as SelectRowPolicyConfig, S as SimpleAggregated, i as SqlResource, a as Stream, b as StreamConfig, T as Task, a9 as TaskConfig, a8 as TaskContext, a7 as TransformConfig, 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';
1
+ export { C as ClickHouseEngines, L as LifeCycle, a as OlapConfig, O as OlapTable, S as S3QueueTableSettings, T as TableConstraint, V as View, a4 as ViewConfig } from '../view-BCWJcLF6.js';
2
+ export { A as Aggregated, f as Api, g as ApiConfig, a6 as ConsumerConfig, C as ConsumptionApi, 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, aa as IngestPipelineConfig, M as MaterializedView, ab as MaterializedViewConfig, j as SelectRowPolicy, k as SelectRowPolicyConfig, S as SimpleAggregated, i as SqlResource, a as Stream, b as StreamConfig, T as Task, a9 as TaskConfig, a8 as TaskContext, a7 as TransformConfig, 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';
3
3
  import '@clickhouse/client';
4
4
  import 'typia';
5
5
  import 'typia/lib/tags';
@@ -754,7 +754,11 @@ var Sql = class _Sql {
754
754
  }
755
755
  this.strings[pos] += rawString;
756
756
  } else if (isView(child)) {
757
- this.strings[pos] += `\`${child.name}\``;
757
+ if (child.database) {
758
+ this.strings[pos] += `\`${child.database}\`.\`${child.name}\``;
759
+ } else {
760
+ this.strings[pos] += `\`${child.name}\``;
761
+ }
758
762
  this.strings[pos] += rawString;
759
763
  } else {
760
764
  this.values[pos++] = child;
@@ -854,6 +858,65 @@ var import_redis = require("redis");
854
858
  // src/consumption-apis/standalone.ts
855
859
  init_commons();
856
860
 
861
+ // src/dmv2/sdk/tableReferenceUtils.ts
862
+ function formatTableReference(table) {
863
+ const database = table instanceof OlapTable ? table.config.database : table.database;
864
+ const deployedName = table instanceof OlapTable ? table.generateTableName() : table.name;
865
+ if (database) {
866
+ return `\`${database}\`.\`${deployedName}\``;
867
+ }
868
+ return `\`${deployedName}\``;
869
+ }
870
+
871
+ // src/dmv2/sdk/view.ts
872
+ function viewRegistryKey(database, name) {
873
+ return database ? `${database}::${name}` : name;
874
+ }
875
+ var View = class {
876
+ /** @internal */
877
+ kind = "View";
878
+ /** The name of the view */
879
+ name;
880
+ /** Optional database where the view is created. When set, the view is created as `database`.`name` in ClickHouse. */
881
+ database;
882
+ /** The SELECT SQL statement that defines the view */
883
+ selectSql;
884
+ /** Names of source tables/views that the SELECT reads from */
885
+ sourceTables;
886
+ /** Optional metadata for the view */
887
+ metadata;
888
+ constructor(name, configOrSelectStatement, baseTables, metadata) {
889
+ const config = typeof configOrSelectStatement === "object" && configOrSelectStatement !== null && "selectStatement" in configOrSelectStatement && "baseTables" in configOrSelectStatement ? configOrSelectStatement : {
890
+ selectStatement: configOrSelectStatement,
891
+ baseTables: baseTables ?? [],
892
+ metadata
893
+ };
894
+ let selectStatement = config.selectStatement;
895
+ if (typeof selectStatement !== "string") {
896
+ selectStatement = toStaticQuery(selectStatement);
897
+ }
898
+ this.name = name;
899
+ this.database = config.database;
900
+ this.selectSql = selectStatement;
901
+ this.sourceTables = config.baseTables.map((t) => formatTableReference(t));
902
+ this.metadata = config.metadata ? { ...config.metadata } : {};
903
+ if (!this.metadata.source) {
904
+ const stack = new Error().stack;
905
+ const sourceInfo = getSourceFileFromStack(stack);
906
+ if (sourceInfo) {
907
+ this.metadata.source = { file: sourceInfo };
908
+ }
909
+ }
910
+ const views = getMooseInternal().views;
911
+ const registryKey = viewRegistryKey(this.database, this.name);
912
+ if (!isClientOnlyMode() && views.has(registryKey)) {
913
+ const qualifiedName = this.database ? `${this.database}.${this.name}` : this.name;
914
+ throw new Error(`View with name ${qualifiedName} already exists`);
915
+ }
916
+ views.set(registryKey, this);
917
+ }
918
+ };
919
+
857
920
  // src/dmv2/registry.ts
858
921
  function getTables() {
859
922
  return getMooseInternal().tables;
@@ -927,8 +990,9 @@ function getMaterializedView(name) {
927
990
  function getViews() {
928
991
  return getMooseInternal().views;
929
992
  }
930
- function getView(name) {
931
- return getMooseInternal().views.get(name);
993
+ function getView(name, database) {
994
+ const key = viewRegistryKey(database, name);
995
+ return getMooseInternal().views.get(key);
932
996
  }
933
997
  function getSelectRowPolicies() {
934
998
  return getMooseInternal().selectRowPolicies;
@@ -2879,56 +2943,6 @@ var ETLPipeline = class {
2879
2943
  }
2880
2944
  };
2881
2945
 
2882
- // src/dmv2/sdk/view.ts
2883
- function formatTableReference(table) {
2884
- const database = table instanceof OlapTable ? table.config.database : void 0;
2885
- const deployedName = table instanceof OlapTable ? table.generateTableName() : table.name;
2886
- if (database) {
2887
- return `\`${database}\`.\`${deployedName}\``;
2888
- }
2889
- return `\`${deployedName}\``;
2890
- }
2891
- var View = class {
2892
- /** @internal */
2893
- kind = "View";
2894
- /** The name of the view */
2895
- name;
2896
- /** The SELECT SQL statement that defines the view */
2897
- selectSql;
2898
- /** Names of source tables/views that the SELECT reads from */
2899
- sourceTables;
2900
- /** Optional metadata for the view */
2901
- metadata;
2902
- /**
2903
- * Creates a new View instance.
2904
- * @param name The name of the view to be created.
2905
- * @param selectStatement The SQL SELECT statement that defines the view's logic.
2906
- * @param baseTables An array of OlapTable or View objects that the `selectStatement` reads from. Used for dependency tracking.
2907
- * @param metadata Optional metadata for the view (e.g., description, source file).
2908
- */
2909
- constructor(name, selectStatement, baseTables, metadata) {
2910
- if (typeof selectStatement !== "string") {
2911
- selectStatement = toStaticQuery(selectStatement);
2912
- }
2913
- this.name = name;
2914
- this.selectSql = selectStatement;
2915
- this.sourceTables = baseTables.map((t) => formatTableReference(t));
2916
- this.metadata = metadata ? { ...metadata } : {};
2917
- if (!this.metadata.source) {
2918
- const stack = new Error().stack;
2919
- const sourceInfo = getSourceFileFromStack(stack);
2920
- if (sourceInfo) {
2921
- this.metadata.source = { file: sourceInfo };
2922
- }
2923
- }
2924
- const views = getMooseInternal().views;
2925
- if (!isClientOnlyMode() && views.has(this.name)) {
2926
- throw new Error(`View with name ${this.name} already exists`);
2927
- }
2928
- views.set(this.name, this);
2929
- }
2930
- };
2931
-
2932
2946
  // src/dmv2/sdk/materializedView.ts
2933
2947
  var requireTargetTableName = (tableName) => {
2934
2948
  if (typeof tableName === "string") {