@514labs/moose-lib 0.6.256-ci-4-g0ca62054 → 0.6.256-ci-3-gafce5840

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,4 +1,4 @@
1
- import './index-rECDLgTX.js';
1
+ import './index-BpasnHLt.js';
2
2
  import { Pattern, TagBase } from 'typia/lib/tags';
3
3
  import { tags } from 'typia';
4
4
 
@@ -1,4 +1,4 @@
1
- import './index-rECDLgTX.mjs';
1
+ import './index-BpasnHLt.mjs';
2
2
  import { Pattern, TagBase } from 'typia/lib/tags';
3
3
  import { tags } from 'typia';
4
4
 
@@ -1,5 +1,5 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, 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, 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, a2 as createClickhouseParameter, 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, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-rECDLgTX.mjs';
2
- 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, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, 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-DnYA4Zgi.mjs';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, 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, 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, a2 as createClickhouseParameter, 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, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-BpasnHLt.mjs';
2
+ 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, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, 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-CMIa49e4.mjs';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -1,5 +1,5 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, 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, 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, a2 as createClickhouseParameter, 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, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-rECDLgTX.js';
2
- 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, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, 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-B_aEflr_.js';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, 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, 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, a2 as createClickhouseParameter, 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, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-BpasnHLt.js';
2
+ 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, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, 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-B6i2YRSY.js';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -42,7 +42,6 @@ __export(commons_exports, {
42
42
  antiCachePath: () => antiCachePath,
43
43
  cliLog: () => cliLog,
44
44
  compilerLog: () => compilerLog,
45
- createProducerConfig: () => createProducerConfig,
46
45
  getClickhouseClient: () => getClickhouseClient,
47
46
  getFileName: () => getFileName,
48
47
  getKafkaClient: () => getKafkaClient,
@@ -65,25 +64,18 @@ function isTruthy(value) {
65
64
  function mapTstoJs(filePath) {
66
65
  return filePath.replace(/\.ts$/, ".js").replace(/\.cts$/, ".cjs").replace(/\.mts$/, ".mjs");
67
66
  }
68
- function createProducerConfig(maxMessageBytes) {
69
- return {
67
+ async function getKafkaProducer(cfg, logger) {
68
+ const kafka = await getKafkaClient(cfg, logger);
69
+ const producer = kafka.producer({
70
70
  kafkaJS: {
71
- idempotent: false,
72
- // Not needed for at-least-once delivery
71
+ idempotent: true,
73
72
  acks: ACKs,
74
73
  retry: {
75
74
  retries: MAX_RETRIES_PRODUCER,
76
75
  maxRetryTime: MAX_RETRY_TIME_MS
77
76
  }
78
- },
79
- "linger.ms": 0,
80
- // This is to make sure at least once delivery with immediate feedback on the send
81
- ...maxMessageBytes && { "message.max.bytes": maxMessageBytes }
82
- };
83
- }
84
- async function getKafkaProducer(cfg, logger, maxMessageBytes) {
85
- const kafka = await getKafkaClient(cfg, logger);
86
- const producer = kafka.producer(createProducerConfig(maxMessageBytes));
77
+ }
78
+ });
87
79
  await producer.connect();
88
80
  return producer;
89
81
  }
@@ -667,16 +659,6 @@ function emptyIfUndefined(value) {
667
659
  return value === void 0 ? "" : value;
668
660
  }
669
661
 
670
- // src/blocks/helpers.ts
671
- function dropView(name) {
672
- return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
673
- }
674
- function createMaterializedView(options) {
675
- return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
676
- TO ${quoteIdentifier(options.destinationTable)}
677
- AS ${options.select}`.trim();
678
- }
679
-
680
662
  // src/dmv2/internal.ts
681
663
  var import_process = __toESM(require("process"));
682
664
 
@@ -727,7 +709,9 @@ var moose_internal = {
727
709
  apis: /* @__PURE__ */ new Map(),
728
710
  sqlResources: /* @__PURE__ */ new Map(),
729
711
  workflows: /* @__PURE__ */ new Map(),
730
- webApps: /* @__PURE__ */ new Map()
712
+ webApps: /* @__PURE__ */ new Map(),
713
+ materializedViews: /* @__PURE__ */ new Map(),
714
+ customViews: /* @__PURE__ */ new Map()
731
715
  };
732
716
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
733
717
  var getMooseInternal = () => globalThis.moose_internal;
@@ -2343,6 +2327,67 @@ var ETLPipeline = class {
2343
2327
  }
2344
2328
  };
2345
2329
 
2330
+ // src/dmv2/sdk/materializedView.ts
2331
+ var requireTargetTableName = (tableName) => {
2332
+ if (typeof tableName === "string") {
2333
+ return tableName;
2334
+ } else {
2335
+ throw new Error("Name of targetTable is not specified.");
2336
+ }
2337
+ };
2338
+ var MaterializedView = class {
2339
+ /** @internal */
2340
+ kind = "MaterializedView";
2341
+ /** The name of the materialized view */
2342
+ name;
2343
+ /** The target OlapTable instance where the materialized data is stored. */
2344
+ targetTable;
2345
+ /** The SELECT SQL statement */
2346
+ selectSql;
2347
+ /** Names of source tables that the SELECT reads from */
2348
+ sourceTables;
2349
+ /** @internal Source file path where this MV was defined */
2350
+ sourceFile;
2351
+ constructor(options, targetSchema, targetColumns) {
2352
+ let selectStatement = options.selectStatement;
2353
+ if (typeof selectStatement !== "string") {
2354
+ selectStatement = toStaticQuery(selectStatement);
2355
+ }
2356
+ if (targetSchema === void 0 || targetColumns === void 0) {
2357
+ throw new Error(
2358
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2359
+ );
2360
+ }
2361
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2362
+ requireTargetTableName(
2363
+ options.targetTable?.name ?? options.tableName
2364
+ ),
2365
+ {
2366
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2367
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2368
+ },
2369
+ targetSchema,
2370
+ targetColumns
2371
+ );
2372
+ if (targetTable.name === options.materializedViewName) {
2373
+ throw new Error(
2374
+ "Materialized view name cannot be the same as the target table name."
2375
+ );
2376
+ }
2377
+ this.name = options.materializedViewName;
2378
+ this.targetTable = targetTable;
2379
+ this.selectSql = selectStatement;
2380
+ this.sourceTables = options.selectTables.map((t) => t.name);
2381
+ const stack = new Error().stack;
2382
+ this.sourceFile = getSourceFileFromStack(stack);
2383
+ const materializedViews = getMooseInternal().materializedViews;
2384
+ if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2385
+ throw new Error(`MaterializedView with name ${this.name} already exists`);
2386
+ }
2387
+ materializedViews.set(this.name, this);
2388
+ }
2389
+ };
2390
+
2346
2391
  // src/dmv2/sdk/sqlResource.ts
2347
2392
  var SqlResource = class {
2348
2393
  /** @internal */
@@ -2388,66 +2433,18 @@ var SqlResource = class {
2388
2433
  }
2389
2434
  };
2390
2435
 
2391
- // src/dmv2/sdk/materializedView.ts
2392
- var requireTargetTableName = (tableName) => {
2393
- if (typeof tableName === "string") {
2394
- return tableName;
2395
- } else {
2396
- throw new Error("Name of targetTable is not specified.");
2397
- }
2398
- };
2399
- var MaterializedView = class extends SqlResource {
2400
- /** The target OlapTable instance where the materialized data is stored. */
2401
- targetTable;
2402
- constructor(options, targetSchema, targetColumns) {
2403
- let selectStatement = options.selectStatement;
2404
- if (typeof selectStatement !== "string") {
2405
- selectStatement = toStaticQuery(selectStatement);
2406
- }
2407
- if (targetSchema === void 0 || targetColumns === void 0) {
2408
- throw new Error(
2409
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2410
- );
2411
- }
2412
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2413
- requireTargetTableName(
2414
- options.targetTable?.name ?? options.tableName
2415
- ),
2416
- {
2417
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2418
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2419
- },
2420
- targetSchema,
2421
- targetColumns
2422
- );
2423
- if (targetTable.name === options.materializedViewName) {
2424
- throw new Error(
2425
- "Materialized view name cannot be the same as the target table name."
2426
- );
2427
- }
2428
- super(
2429
- options.materializedViewName,
2430
- [
2431
- createMaterializedView({
2432
- name: options.materializedViewName,
2433
- destinationTable: targetTable.name,
2434
- select: selectStatement
2435
- })
2436
- // Population is now handled automatically by Rust infrastructure
2437
- // based on table engine type and whether this is a new or updated view
2438
- ],
2439
- [dropView(options.materializedViewName)],
2440
- {
2441
- pullsDataFrom: options.selectTables,
2442
- pushesDataTo: [targetTable]
2443
- }
2444
- );
2445
- this.targetTable = targetTable;
2446
- }
2447
- };
2448
-
2449
2436
  // src/dmv2/sdk/view.ts
2450
- var View = class extends SqlResource {
2437
+ var View = class {
2438
+ /** @internal */
2439
+ kind = "CustomView";
2440
+ /** The name of the view */
2441
+ name;
2442
+ /** The SELECT SQL statement that defines the view */
2443
+ selectSql;
2444
+ /** Names of source tables/views that the SELECT reads from */
2445
+ sourceTables;
2446
+ /** @internal Source file path where this view was defined */
2447
+ sourceFile;
2451
2448
  /**
2452
2449
  * Creates a new View instance.
2453
2450
  * @param name The name of the view to be created.
@@ -2458,17 +2455,16 @@ var View = class extends SqlResource {
2458
2455
  if (typeof selectStatement !== "string") {
2459
2456
  selectStatement = toStaticQuery(selectStatement);
2460
2457
  }
2461
- super(
2462
- name,
2463
- [
2464
- `CREATE VIEW IF NOT EXISTS ${name}
2465
- AS ${selectStatement}`.trim()
2466
- ],
2467
- [dropView(name)],
2468
- {
2469
- pullsDataFrom: baseTables
2470
- }
2471
- );
2458
+ this.name = name;
2459
+ this.selectSql = selectStatement;
2460
+ this.sourceTables = baseTables.map((t) => t.name);
2461
+ const stack = new Error().stack;
2462
+ this.sourceFile = getSourceFileFromStack(stack);
2463
+ const customViews = getMooseInternal().customViews;
2464
+ if (!isClientOnlyMode() && customViews.has(this.name)) {
2465
+ throw new Error(`View with name ${this.name} already exists`);
2466
+ }
2467
+ customViews.set(this.name, this);
2472
2468
  }
2473
2469
  };
2474
2470