@514labs/moose-lib 0.6.276-ci-1-gfe86cd2c → 0.6.276-ci-3-g7a7bb18a

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/index.d.mts CHANGED
@@ -2,8 +2,7 @@ export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal,
2
2
  import { K as ApiUtil, a4 as MooseClient } from './index-BtkwFbT9.mjs';
3
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-BtkwFbT9.mjs';
4
4
  import * as _clickhouse_client from '@clickhouse/client';
5
- import { KafkaJS, LibrdKafkaError, TopicPartition, KafkaConsumer } from '@confluentinc/kafka-javascript';
6
- export { CODES, ConsumerGlobalConfig, KafkaConsumer, LibrdKafkaError, Message as NativeKafkaMessage, TopicPartition, TopicPartitionOffset } from '@confluentinc/kafka-javascript';
5
+ import { KafkaJS } from '@514labs/kafka-javascript';
7
6
  import http from 'http';
8
7
  import { IsTuple } from 'typia/lib/typings/IsTuple';
9
8
  import { Readable } from 'node:stream';
@@ -16,7 +15,6 @@ import 'jose';
16
15
  declare const Kafka: typeof KafkaJS.Kafka;
17
16
  type Kafka = KafkaJS.Kafka;
18
17
  type Producer = KafkaJS.Producer;
19
-
20
18
  declare const compilerLog: (message: string) => void;
21
19
  declare const antiCachePath: (path: string) => string;
22
20
  declare const getFileName: (filePath: string) => string;
@@ -97,29 +95,6 @@ declare const logError: (logger: Logger, e: Error) => void;
97
95
  * Use this to construct producers/consumers with custom options.
98
96
  */
99
97
  declare const getKafkaClient: (cfg: KafkaClientConfig, logger: Logger) => Promise<Kafka>;
100
- /**
101
- * Configuration for native KafkaConsumer
102
- */
103
- interface NativeConsumerConfig extends KafkaClientConfig {
104
- groupId: string;
105
- sessionTimeoutMs?: number;
106
- heartbeatIntervalMs?: number;
107
- maxPollIntervalMs?: number;
108
- autoCommit?: boolean;
109
- autoCommitIntervalMs?: number;
110
- autoOffsetReset?: "smallest" | "earliest" | "largest" | "latest" | "error";
111
- maxBatchSize?: number;
112
- }
113
- /**
114
- * Creates a native KafkaConsumer instance (using librdkafka directly).
115
- * This provides lower-level control and potentially better performance than the KafkaJS wrapper.
116
- *
117
- * @param cfg - Consumer configuration
118
- * @param logger - Logger instance
119
- * @param rebalanceCb - Optional callback for rebalance events
120
- * @returns Configured but not yet connected KafkaConsumer
121
- */
122
- declare const createNativeKafkaConsumer: (cfg: NativeConsumerConfig, logger: Logger, rebalanceCb?: (err: LibrdKafkaError, assignments: TopicPartition[]) => void) => KafkaConsumer;
123
98
 
124
99
  /**
125
100
  * @module secrets
@@ -579,4 +554,4 @@ type DataModelConfig<T> = Partial<{
579
554
  parallelism?: number;
580
555
  }>;
581
556
 
582
- export { ACKs, ApiUtil, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type ExpressRequestWithMoose, type ExtractionResult, type JSONParsingConfig, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MooseCache, MooseClient, type NativeConsumerConfig, type Producer, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, antiCachePath, cliLog, compilerLog, createApi, createConsumptionApi, createNativeKafkaConsumer, createProducerConfig, expressMiddleware, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getMooseClients, getMooseUtils, isValidCSVDelimiter, logError, mapTstoJs, mooseEnvSecrets, mooseRuntimeEnv, parseCSV, parseJSON, parseJSONWithDates };
557
+ export { ACKs, ApiUtil, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type ExpressRequestWithMoose, type ExtractionResult, type JSONParsingConfig, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MooseCache, MooseClient, type Producer, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, antiCachePath, cliLog, compilerLog, createApi, createConsumptionApi, createProducerConfig, expressMiddleware, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getMooseClients, getMooseUtils, isValidCSVDelimiter, logError, mapTstoJs, mooseEnvSecrets, mooseRuntimeEnv, parseCSV, parseJSON, parseJSONWithDates };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,7 @@ export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal,
2
2
  import { K as ApiUtil, a4 as MooseClient } from './index-BtkwFbT9.js';
3
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-BtkwFbT9.js';
4
4
  import * as _clickhouse_client from '@clickhouse/client';
5
- import { KafkaJS, LibrdKafkaError, TopicPartition, KafkaConsumer } from '@confluentinc/kafka-javascript';
6
- export { CODES, ConsumerGlobalConfig, KafkaConsumer, LibrdKafkaError, Message as NativeKafkaMessage, TopicPartition, TopicPartitionOffset } from '@confluentinc/kafka-javascript';
5
+ import { KafkaJS } from '@514labs/kafka-javascript';
7
6
  import http from 'http';
8
7
  import { IsTuple } from 'typia/lib/typings/IsTuple';
9
8
  import { Readable } from 'node:stream';
@@ -16,7 +15,6 @@ import 'jose';
16
15
  declare const Kafka: typeof KafkaJS.Kafka;
17
16
  type Kafka = KafkaJS.Kafka;
18
17
  type Producer = KafkaJS.Producer;
19
-
20
18
  declare const compilerLog: (message: string) => void;
21
19
  declare const antiCachePath: (path: string) => string;
22
20
  declare const getFileName: (filePath: string) => string;
@@ -97,29 +95,6 @@ declare const logError: (logger: Logger, e: Error) => void;
97
95
  * Use this to construct producers/consumers with custom options.
98
96
  */
99
97
  declare const getKafkaClient: (cfg: KafkaClientConfig, logger: Logger) => Promise<Kafka>;
100
- /**
101
- * Configuration for native KafkaConsumer
102
- */
103
- interface NativeConsumerConfig extends KafkaClientConfig {
104
- groupId: string;
105
- sessionTimeoutMs?: number;
106
- heartbeatIntervalMs?: number;
107
- maxPollIntervalMs?: number;
108
- autoCommit?: boolean;
109
- autoCommitIntervalMs?: number;
110
- autoOffsetReset?: "smallest" | "earliest" | "largest" | "latest" | "error";
111
- maxBatchSize?: number;
112
- }
113
- /**
114
- * Creates a native KafkaConsumer instance (using librdkafka directly).
115
- * This provides lower-level control and potentially better performance than the KafkaJS wrapper.
116
- *
117
- * @param cfg - Consumer configuration
118
- * @param logger - Logger instance
119
- * @param rebalanceCb - Optional callback for rebalance events
120
- * @returns Configured but not yet connected KafkaConsumer
121
- */
122
- declare const createNativeKafkaConsumer: (cfg: NativeConsumerConfig, logger: Logger, rebalanceCb?: (err: LibrdKafkaError, assignments: TopicPartition[]) => void) => KafkaConsumer;
123
98
 
124
99
  /**
125
100
  * @module secrets
@@ -579,4 +554,4 @@ type DataModelConfig<T> = Partial<{
579
554
  parallelism?: number;
580
555
  }>;
581
556
 
582
- export { ACKs, ApiUtil, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type ExpressRequestWithMoose, type ExtractionResult, type JSONParsingConfig, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MooseCache, MooseClient, type NativeConsumerConfig, type Producer, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, antiCachePath, cliLog, compilerLog, createApi, createConsumptionApi, createNativeKafkaConsumer, createProducerConfig, expressMiddleware, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getMooseClients, getMooseUtils, isValidCSVDelimiter, logError, mapTstoJs, mooseEnvSecrets, mooseRuntimeEnv, parseCSV, parseJSON, parseJSONWithDates };
557
+ export { ACKs, ApiUtil, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, type DataModelConfig, DataSource, type DataSourceConfig, type ExpressRequestWithMoose, type ExtractionResult, type JSONParsingConfig, type KafkaClientConfig, type Logger, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MooseCache, MooseClient, type Producer, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type StripDateIntersection, type TaskConfig, type TaskDefinition, type TaskFunction, antiCachePath, cliLog, compilerLog, createApi, createConsumptionApi, createProducerConfig, expressMiddleware, getClickhouseClient, getFileName, getKafkaClient, getKafkaProducer, getMooseClients, getMooseUtils, isValidCSVDelimiter, logError, mapTstoJs, mooseEnvSecrets, mooseRuntimeEnv, parseCSV, parseJSON, parseJSONWithDates };
package/dist/index.js CHANGED
@@ -34,8 +34,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  var commons_exports = {};
35
35
  __export(commons_exports, {
36
36
  ACKs: () => ACKs,
37
- CODES: () => import_kafka_javascript.CODES,
38
- KafkaConsumer: () => import_kafka_javascript.KafkaConsumer,
39
37
  MAX_RETRIES: () => MAX_RETRIES,
40
38
  MAX_RETRIES_PRODUCER: () => MAX_RETRIES_PRODUCER,
41
39
  MAX_RETRY_TIME_MS: () => MAX_RETRY_TIME_MS,
@@ -44,7 +42,6 @@ __export(commons_exports, {
44
42
  antiCachePath: () => antiCachePath,
45
43
  cliLog: () => cliLog,
46
44
  compilerLog: () => compilerLog,
47
- createNativeKafkaConsumer: () => createNativeKafkaConsumer,
48
45
  createProducerConfig: () => createProducerConfig,
49
46
  getClickhouseClient: () => getClickhouseClient,
50
47
  getFileName: () => getFileName,
@@ -90,13 +87,13 @@ async function getKafkaProducer(cfg, logger, maxMessageBytes) {
90
87
  await producer.connect();
91
88
  return producer;
92
89
  }
93
- var import_http, import_client, import_kafka_javascript, Kafka, compilerLog, antiCachePath, getFileName, getClickhouseClient, cliLog, MAX_RETRIES, MAX_RETRY_TIME_MS, RETRY_INITIAL_TIME_MS, MAX_RETRIES_PRODUCER, RETRY_FACTOR_PRODUCER, ACKs, parseBrokerString, logError, buildSaslConfig, getKafkaClient, buildNativeSaslConfig, createNativeKafkaConsumer;
90
+ var import_http, import_client, import_kafka_javascript, Kafka, compilerLog, antiCachePath, getFileName, getClickhouseClient, cliLog, MAX_RETRIES, MAX_RETRY_TIME_MS, RETRY_INITIAL_TIME_MS, MAX_RETRIES_PRODUCER, RETRY_FACTOR_PRODUCER, ACKs, parseBrokerString, logError, buildSaslConfig, getKafkaClient;
94
91
  var init_commons = __esm({
95
92
  "src/commons.ts"() {
96
93
  "use strict";
97
94
  import_http = __toESM(require("http"));
98
95
  import_client = require("@clickhouse/client");
99
- import_kafka_javascript = require("@confluentinc/kafka-javascript");
96
+ import_kafka_javascript = require("@514labs/kafka-javascript");
100
97
  ({ Kafka } = import_kafka_javascript.KafkaJS);
101
98
  compilerLog = (message) => {
102
99
  if (!isTruthy(process.env.MOOSE_DISABLE_COMPILER_LOGS)) {
@@ -197,59 +194,6 @@ var init_commons = __esm({
197
194
  }
198
195
  });
199
196
  };
200
- buildNativeSaslConfig = (logger, cfg) => {
201
- if (!cfg.saslMechanism || !cfg.saslUsername || !cfg.saslPassword) {
202
- return {};
203
- }
204
- const mechanism = cfg.saslMechanism.toUpperCase();
205
- const validMechanisms = ["PLAIN", "SCRAM-SHA-256", "SCRAM-SHA-512"];
206
- if (!validMechanisms.includes(mechanism)) {
207
- logger.warn(`Unsupported SASL mechanism: ${cfg.saslMechanism}`);
208
- return {};
209
- }
210
- return {
211
- "sasl.mechanisms": mechanism,
212
- "sasl.username": cfg.saslUsername,
213
- "sasl.password": cfg.saslPassword
214
- };
215
- };
216
- createNativeKafkaConsumer = (cfg, logger, rebalanceCb) => {
217
- const brokers = parseBrokerString(cfg.broker || "");
218
- if (brokers.length === 0) {
219
- throw new Error(`No valid broker addresses found in: "${cfg.broker}"`);
220
- }
221
- logger.log(
222
- `Creating native KafkaConsumer with brokers: ${brokers.join(", ")}`
223
- );
224
- logger.log(`Security protocol: ${cfg.securityProtocol || "plaintext"}`);
225
- logger.log(`Client ID: ${cfg.clientId}`);
226
- logger.log(`Group ID: ${cfg.groupId}`);
227
- const saslConfig = buildNativeSaslConfig(logger, cfg);
228
- const consumerConfig = {
229
- // Connection
230
- "bootstrap.servers": brokers.join(","),
231
- "client.id": cfg.clientId,
232
- // Group management
233
- "group.id": cfg.groupId,
234
- "session.timeout.ms": cfg.sessionTimeoutMs ?? 3e4,
235
- "heartbeat.interval.ms": cfg.heartbeatIntervalMs ?? 3e3,
236
- "max.poll.interval.ms": cfg.maxPollIntervalMs ?? 3e5,
237
- // Offset management
238
- "enable.auto.commit": cfg.autoCommit ?? true,
239
- "auto.commit.interval.ms": cfg.autoCommitIntervalMs ?? 5e3,
240
- // Security
241
- ...cfg.securityProtocol === "SASL_SSL" && {
242
- "security.protocol": "sasl_ssl"
243
- },
244
- ...saslConfig,
245
- // Rebalance callback
246
- ...rebalanceCb && { rebalance_cb: rebalanceCb }
247
- };
248
- const topicConfig = {
249
- "auto.offset.reset": cfg.autoOffsetReset ?? "earliest"
250
- };
251
- return new import_kafka_javascript.KafkaConsumer(consumerConfig, topicConfig);
252
- };
253
197
  }
254
198
  });
255
199
 
@@ -443,7 +387,6 @@ __export(index_exports, {
443
387
  ACKs: () => ACKs,
444
388
  Api: () => Api,
445
389
  ApiHelpers: () => ApiHelpers,
446
- CODES: () => import_kafka_javascript.CODES,
447
390
  CSV_DELIMITERS: () => CSV_DELIMITERS,
448
391
  ClickHouseEngines: () => ClickHouseEngines,
449
392
  ConsumptionApi: () => ConsumptionApi,
@@ -455,7 +398,6 @@ __export(index_exports, {
455
398
  ETLPipeline: () => ETLPipeline,
456
399
  IngestApi: () => IngestApi,
457
400
  IngestPipeline: () => IngestPipeline,
458
- KafkaConsumer: () => import_kafka_javascript.KafkaConsumer,
459
401
  LifeCycle: () => LifeCycle,
460
402
  MAX_RETRIES: () => MAX_RETRIES,
461
403
  MAX_RETRIES_PRODUCER: () => MAX_RETRIES_PRODUCER,
@@ -483,7 +425,6 @@ __export(index_exports, {
483
425
  createClickhouseParameter: () => createClickhouseParameter,
484
426
  createConsumptionApi: () => createConsumptionApi,
485
427
  createMaterializedView: () => createMaterializedView,
486
- createNativeKafkaConsumer: () => createNativeKafkaConsumer,
487
428
  createProducerConfig: () => createProducerConfig,
488
429
  dropView: () => dropView,
489
430
  expressMiddleware: () => expressMiddleware,
@@ -3495,7 +3436,6 @@ var DataSource = class {
3495
3436
  ACKs,
3496
3437
  Api,
3497
3438
  ApiHelpers,
3498
- CODES,
3499
3439
  CSV_DELIMITERS,
3500
3440
  ClickHouseEngines,
3501
3441
  ConsumptionApi,
@@ -3507,7 +3447,6 @@ var DataSource = class {
3507
3447
  ETLPipeline,
3508
3448
  IngestApi,
3509
3449
  IngestPipeline,
3510
- KafkaConsumer,
3511
3450
  LifeCycle,
3512
3451
  MAX_RETRIES,
3513
3452
  MAX_RETRIES_PRODUCER,
@@ -3535,7 +3474,6 @@ var DataSource = class {
3535
3474
  createClickhouseParameter,
3536
3475
  createConsumptionApi,
3537
3476
  createMaterializedView,
3538
- createNativeKafkaConsumer,
3539
3477
  createProducerConfig,
3540
3478
  dropView,
3541
3479
  expressMiddleware,