@514labs/moose-lib 0.6.252-ci-1-g901efb04 → 0.6.252-ci-3-g37e54b29

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.mjs CHANGED
@@ -26,7 +26,6 @@ __export(commons_exports, {
26
26
  antiCachePath: () => antiCachePath,
27
27
  cliLog: () => cliLog,
28
28
  compilerLog: () => compilerLog,
29
- createProducerConfig: () => createProducerConfig,
30
29
  getClickhouseClient: () => getClickhouseClient,
31
30
  getFileName: () => getFileName,
32
31
  getKafkaClient: () => getKafkaClient,
@@ -52,25 +51,18 @@ function isTruthy(value) {
52
51
  function mapTstoJs(filePath) {
53
52
  return filePath.replace(/\.ts$/, ".js").replace(/\.cts$/, ".cjs").replace(/\.mts$/, ".mjs");
54
53
  }
55
- function createProducerConfig(maxMessageBytes) {
56
- return {
54
+ async function getKafkaProducer(cfg, logger) {
55
+ const kafka = await getKafkaClient(cfg, logger);
56
+ const producer = kafka.producer({
57
57
  kafkaJS: {
58
- idempotent: false,
59
- // Not needed for at-least-once delivery
58
+ idempotent: true,
60
59
  acks: ACKs,
61
60
  retry: {
62
61
  retries: MAX_RETRIES_PRODUCER,
63
62
  maxRetryTime: MAX_RETRY_TIME_MS
64
63
  }
65
- },
66
- "linger.ms": 0,
67
- // Send immediately - batching happens at application level
68
- ...maxMessageBytes && { "message.max.bytes": maxMessageBytes }
69
- };
70
- }
71
- async function getKafkaProducer(cfg, logger, maxMessageBytes) {
72
- const kafka = await getKafkaClient(cfg, logger);
73
- const producer = kafka.producer(createProducerConfig(maxMessageBytes));
64
+ }
65
+ });
74
66
  await producer.connect();
75
67
  return producer;
76
68
  }
@@ -2522,7 +2514,19 @@ var WebApp = class {
2522
2514
  return app.callback();
2523
2515
  }
2524
2516
  if (typeof app.routing === "function") {
2525
- return (req, res) => {
2517
+ let isReady = false;
2518
+ let readyPromise = null;
2519
+ if (typeof app.ready === "function") {
2520
+ readyPromise = app.ready().then(() => {
2521
+ isReady = true;
2522
+ });
2523
+ } else {
2524
+ isReady = true;
2525
+ }
2526
+ return async (req, res) => {
2527
+ if (!isReady && readyPromise) {
2528
+ await readyPromise;
2529
+ }
2526
2530
  app.routing(req, res);
2527
2531
  };
2528
2532
  }
@@ -3305,7 +3309,6 @@ export {
3305
3309
  createClickhouseParameter,
3306
3310
  createConsumptionApi,
3307
3311
  createMaterializedView,
3308
- createProducerConfig,
3309
3312
  dropView,
3310
3313
  expressMiddleware,
3311
3314
  getApi,