@merkl/api 0.10.403 → 0.10.404

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.
@@ -2,6 +2,7 @@
2
2
  if (!process.env.ENV || !process.env.FILENAME)
3
3
  throw new Error("[ENV]: missing variable");
4
4
  import { RewardService } from "../../modules/v4/reward";
5
+ import { log } from "../../utils/logger";
5
6
  import { S3Client } from "bun";
6
7
  import moment from "moment";
7
8
  // ─── Constants ───────────────────────────────────────────────
@@ -62,14 +63,14 @@ export const main = async () => {
62
63
  const start = moment().unix();
63
64
  // ─── Start Rewards ETL ───────────────────────────────────────────────
64
65
  const count = await extract();
65
- console.log(`✅ Successfully created ${count} new records in ${moment().unix() - start} sec`);
66
+ log.info(`✅ Successfully created ${count} new records for ${process.env.FILENAME} in ${moment().unix() - start} sec`);
66
67
  if (failedBatches.length !== 0) {
67
- console.log(`${failedBatches.length} batches failed.`);
68
+ log.error("pendings", `${failedBatches.length} batches failed.`);
68
69
  process.exit(1);
69
70
  }
70
71
  if (failedBatches.length === 0) {
71
72
  await file.delete();
72
- console.log("Object deleted");
73
+ log.info("Object deleted");
73
74
  }
74
75
  };
75
76
  main();
@@ -1,6 +1,7 @@
1
1
  // ─── Reward Breakdowns ETL ───────────────────────────────────────────────────
2
2
  if (!process.env.ENV || !process.env.CHAIN_ID || !process.env.ROOT)
3
3
  throw new Error("[ENV]: missing variable");
4
+ import { log } from "../../utils/logger";
4
5
  import { apiDbClient } from "../../utils/prisma";
5
6
  import { S3Client } from "bun";
6
7
  import moment from "moment";
@@ -71,14 +72,14 @@ const load = async (rewardBreakdowns) => {
71
72
  export const main = async () => {
72
73
  const start = moment().unix();
73
74
  const count = await extract();
74
- console.log(`✅ Successfully created ${count} new records in ${moment().unix() - start} sec`);
75
+ log.info(`✅ Successfully created ${count} new records for ${process.env.CHAIN_ID}-${process.env.ROOT} in ${moment().unix() - start} sec`);
75
76
  if (failedBatches.length !== 0) {
76
- console.log(`${failedBatches.length} batches failed.`);
77
+ log.error("breakdowns", `${failedBatches.length} batches failed.`);
77
78
  process.exit(1);
78
79
  }
79
80
  if (failedBatches.length === 0) {
80
- await file.delete();
81
- console.log("Object deleted");
81
+ // await file.delete();
82
+ // log.info("Object deleted");
82
83
  }
83
84
  };
84
85
  main();
@@ -1,6 +1,7 @@
1
1
  // ─── Rewards ETL ─────────────────────────────────────────────────────────────
2
2
  if (!process.env.ENV || !process.env.CHAIN_ID || !process.env.ROOT)
3
3
  throw new Error("[ENV]: missing variable");
4
+ import { log } from "../../utils/logger";
4
5
  import { apiDbClient } from "../../utils/prisma";
5
6
  import { S3Client } from "bun";
6
7
  import moment from "moment";
@@ -92,14 +93,14 @@ export const main = async () => {
92
93
  });
93
94
  // ─── Start Rewards ETL ───────────────────────────────────────────────
94
95
  const count = await extract();
95
- console.log(`✅ Successfully created ${count} new records in ${moment().unix() - start} sec`);
96
+ log.info(`✅ Successfully created ${count} new records for ${process.env.CHAIN_ID}-${process.env.ROOT} in ${moment().unix() - start} sec`);
96
97
  if (failedBatches.length !== 0) {
97
- console.log(`${failedBatches.length} batches failed.`);
98
+ log.error("rewards", `${failedBatches.length} batches failed.`);
98
99
  process.exit(1);
99
100
  }
100
101
  if (failedBatches.length === 0) {
101
- await file.delete();
102
- console.log("Object deleted");
102
+ // await file.delete();
103
+ // log.info("Object deleted");
103
104
  }
104
105
  };
105
106
  main();