@merkl/api 0.19.1 → 0.19.3

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.
Files changed (29) hide show
  1. package/dist/database/api/.generated/drizzle/schema.d.ts +20 -3
  2. package/dist/database/api/.generated/drizzle/schema.js +3 -2
  3. package/dist/database/api/.generated/drizzle/schema.ts +3 -2
  4. package/dist/database/api/.generated/edge.js +6 -4
  5. package/dist/database/api/.generated/index-browser.js +3 -1
  6. package/dist/database/api/.generated/index.d.ts +151 -70
  7. package/dist/database/api/.generated/index.js +6 -4
  8. package/dist/database/api/.generated/package.json +1 -1
  9. package/dist/database/api/.generated/schema.prisma +3 -0
  10. package/dist/database/api/.generated/wasm.js +3 -1
  11. package/dist/src/eden/index.d.ts +562 -5
  12. package/dist/src/index.d.ts +122 -1
  13. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +119 -0
  14. package/dist/src/modules/v4/campaign/campaign.controller.js +13 -2
  15. package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -0
  16. package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
  17. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +20 -0
  18. package/dist/src/modules/v4/campaign/campaign.repository.js +4 -3
  19. package/dist/src/modules/v4/campaign/campaign.service.d.ts +223 -0
  20. package/dist/src/modules/v4/campaign/campaign.service.js +26 -2
  21. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +3 -1
  22. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +1 -0
  23. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +5 -0
  24. package/dist/src/modules/v4/opportunity/opportunity.repository.js +1 -1
  25. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +3 -0
  26. package/dist/src/modules/v4/protocol/protocol.repository.d.ts +1 -0
  27. package/dist/src/modules/v4/router.d.ts +122 -1
  28. package/dist/tsconfig.package.tsbuildinfo +1 -1
  29. package/package.json +6 -4
@@ -173,7 +173,7 @@ declare const app: Elysia<"", false, {
173
173
  chainId: number;
174
174
  }[];
175
175
  identifier: string;
176
- action: "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT" | "INVALID";
176
+ action: "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT" | "SWAP" | "INVALID";
177
177
  chainId: number;
178
178
  };
179
179
  params: {};
@@ -394,6 +394,7 @@ declare const app: Elysia<"", false, {
394
394
  amount: string;
395
395
  opportunityId: string;
396
396
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
397
+ createdAt: Date;
397
398
  }[] | undefined;
398
399
  id: string;
399
400
  depositUrl: string | undefined;
@@ -606,6 +607,7 @@ declare const app: Elysia<"", false, {
606
607
  mainParameter?: string | undefined;
607
608
  tokenAddress?: string | undefined;
608
609
  test?: boolean | undefined;
610
+ createdAfter?: Date | undefined;
609
611
  creatorTag?: string | undefined;
610
612
  distributionChainIds?: number[] | undefined;
611
613
  tokenSymbol?: string | undefined;
@@ -1124,6 +1126,7 @@ declare const app: Elysia<"", false, {
1124
1126
  endTimestamp: bigint;
1125
1127
  creatorAddress: string;
1126
1128
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
1129
+ createdAt: Date;
1127
1130
  } | undefined;
1128
1131
  };
1129
1132
  };
@@ -1211,6 +1214,7 @@ declare const app: Elysia<"", false, {
1211
1214
  endTimestamp: bigint;
1212
1215
  creatorAddress: string;
1213
1216
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
1217
+ createdAt: Date;
1214
1218
  };
1215
1219
  };
1216
1220
  };
@@ -1255,6 +1259,7 @@ declare const app: Elysia<"", false, {
1255
1259
  mainParameter?: string | undefined;
1256
1260
  tokenAddress?: string | undefined;
1257
1261
  test?: boolean | undefined;
1262
+ createdAfter?: Date | undefined;
1258
1263
  creatorTag?: string | undefined;
1259
1264
  distributionChainIds?: number[] | undefined;
1260
1265
  tokenSymbol?: string | undefined;
@@ -1330,6 +1335,7 @@ declare const app: Elysia<"", false, {
1330
1335
  amount: string;
1331
1336
  opportunityId: string;
1332
1337
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
1338
+ createdAt: Date;
1333
1339
  }[];
1334
1340
  };
1335
1341
  };
@@ -1412,6 +1418,7 @@ declare const app: Elysia<"", false, {
1412
1418
  amount: string;
1413
1419
  opportunityId: string;
1414
1420
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
1421
+ createdAt: Date;
1415
1422
  };
1416
1423
  };
1417
1424
  };
@@ -1438,6 +1445,7 @@ declare const app: Elysia<"", false, {
1438
1445
  mainParameter?: string | undefined;
1439
1446
  tokenAddress?: string | undefined;
1440
1447
  test?: boolean | undefined;
1448
+ createdAfter?: Date | undefined;
1441
1449
  creatorTag?: string | undefined;
1442
1450
  distributionChainIds?: number[] | undefined;
1443
1451
  tokenSymbol?: string | undefined;
@@ -1449,6 +1457,82 @@ declare const app: Elysia<"", false, {
1449
1457
  };
1450
1458
  };
1451
1459
  };
1460
+ } & {
1461
+ count: {
1462
+ "by-type": {
1463
+ get: {
1464
+ body: unknown;
1465
+ params: {};
1466
+ query: {
1467
+ type?: string | undefined;
1468
+ status?: "NONE" | "PAST" | "LIVE" | "SOON" | undefined;
1469
+ items?: number | undefined;
1470
+ subType?: number | undefined;
1471
+ page?: number | undefined;
1472
+ types?: string[] | undefined;
1473
+ campaignId?: string | undefined;
1474
+ opportunityId?: string | undefined;
1475
+ startTimestamp?: string | undefined;
1476
+ endTimestamp?: string | undefined;
1477
+ creatorAddress?: string | undefined;
1478
+ chainId?: number | undefined;
1479
+ creatorId?: string | undefined;
1480
+ mainParameter?: string | undefined;
1481
+ tokenAddress?: string | undefined;
1482
+ test?: boolean | undefined;
1483
+ createdAfter?: Date | undefined;
1484
+ creatorTag?: string | undefined;
1485
+ distributionChainIds?: number[] | undefined;
1486
+ tokenSymbol?: string | undefined;
1487
+ withOpportunity?: boolean | undefined;
1488
+ };
1489
+ headers: unknown;
1490
+ response: {
1491
+ 200: {
1492
+ [x: string]: number;
1493
+ };
1494
+ };
1495
+ };
1496
+ };
1497
+ };
1498
+ } & {
1499
+ count: {
1500
+ "by-protocol": {
1501
+ get: {
1502
+ body: unknown;
1503
+ params: {};
1504
+ query: {
1505
+ type?: string | undefined;
1506
+ status?: "NONE" | "PAST" | "LIVE" | "SOON" | undefined;
1507
+ items?: number | undefined;
1508
+ subType?: number | undefined;
1509
+ page?: number | undefined;
1510
+ types?: string[] | undefined;
1511
+ campaignId?: string | undefined;
1512
+ opportunityId?: string | undefined;
1513
+ startTimestamp?: string | undefined;
1514
+ endTimestamp?: string | undefined;
1515
+ creatorAddress?: string | undefined;
1516
+ chainId?: number | undefined;
1517
+ creatorId?: string | undefined;
1518
+ mainParameter?: string | undefined;
1519
+ tokenAddress?: string | undefined;
1520
+ test?: boolean | undefined;
1521
+ createdAfter?: Date | undefined;
1522
+ creatorTag?: string | undefined;
1523
+ distributionChainIds?: number[] | undefined;
1524
+ tokenSymbol?: string | undefined;
1525
+ withOpportunity?: boolean | undefined;
1526
+ };
1527
+ headers: unknown;
1528
+ response: {
1529
+ 200: {
1530
+ [x: string]: number;
1531
+ };
1532
+ };
1533
+ };
1534
+ };
1535
+ };
1452
1536
  } & {
1453
1537
  "campaigns-to-process": {
1454
1538
  index: {
@@ -1528,6 +1612,43 @@ declare const app: Elysia<"", false, {
1528
1612
  };
1529
1613
  };
1530
1614
  };
1615
+ campaignscount: {
1616
+ "by-chains": {
1617
+ get: {
1618
+ body: unknown;
1619
+ params: {};
1620
+ query: {
1621
+ type?: string | undefined;
1622
+ status?: "NONE" | "PAST" | "LIVE" | "SOON" | undefined;
1623
+ items?: number | undefined;
1624
+ subType?: number | undefined;
1625
+ page?: number | undefined;
1626
+ types?: string[] | undefined;
1627
+ campaignId?: string | undefined;
1628
+ opportunityId?: string | undefined;
1629
+ startTimestamp?: string | undefined;
1630
+ endTimestamp?: string | undefined;
1631
+ creatorAddress?: string | undefined;
1632
+ chainId?: number | undefined;
1633
+ creatorId?: string | undefined;
1634
+ mainParameter?: string | undefined;
1635
+ tokenAddress?: string | undefined;
1636
+ test?: boolean | undefined;
1637
+ createdAfter?: Date | undefined;
1638
+ creatorTag?: string | undefined;
1639
+ distributionChainIds?: number[] | undefined;
1640
+ tokenSymbol?: string | undefined;
1641
+ withOpportunity?: boolean | undefined;
1642
+ };
1643
+ headers: unknown;
1644
+ response: {
1645
+ 200: {
1646
+ [x: string]: number;
1647
+ };
1648
+ };
1649
+ };
1650
+ };
1651
+ };
1531
1652
  };
1532
1653
  } & {
1533
1654
  v4: {
@@ -52,6 +52,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
52
52
  endTimestamp: bigint;
53
53
  creatorAddress: string;
54
54
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
55
+ createdAt: Date;
55
56
  } | undefined;
56
57
  };
57
58
  };
@@ -139,6 +140,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
139
140
  endTimestamp: bigint;
140
141
  creatorAddress: string;
141
142
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
143
+ createdAt: Date;
142
144
  };
143
145
  };
144
146
  };
@@ -183,6 +185,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
183
185
  mainParameter?: string | undefined;
184
186
  tokenAddress?: string | undefined;
185
187
  test?: boolean | undefined;
188
+ createdAfter?: Date | undefined;
186
189
  creatorTag?: string | undefined;
187
190
  distributionChainIds?: number[] | undefined;
188
191
  tokenSymbol?: string | undefined;
@@ -258,6 +261,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
258
261
  amount: string;
259
262
  opportunityId: string;
260
263
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
264
+ createdAt: Date;
261
265
  }[];
262
266
  };
263
267
  };
@@ -340,6 +344,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
340
344
  amount: string;
341
345
  opportunityId: string;
342
346
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
347
+ createdAt: Date;
343
348
  };
344
349
  };
345
350
  };
@@ -366,6 +371,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
366
371
  mainParameter?: string | undefined;
367
372
  tokenAddress?: string | undefined;
368
373
  test?: boolean | undefined;
374
+ createdAfter?: Date | undefined;
369
375
  creatorTag?: string | undefined;
370
376
  distributionChainIds?: number[] | undefined;
371
377
  tokenSymbol?: string | undefined;
@@ -377,6 +383,82 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
377
383
  };
378
384
  };
379
385
  };
386
+ } & {
387
+ count: {
388
+ "by-type": {
389
+ get: {
390
+ body: unknown;
391
+ params: {};
392
+ query: {
393
+ type?: string | undefined;
394
+ status?: "NONE" | "PAST" | "LIVE" | "SOON" | undefined;
395
+ items?: number | undefined;
396
+ subType?: number | undefined;
397
+ page?: number | undefined;
398
+ types?: string[] | undefined;
399
+ campaignId?: string | undefined;
400
+ opportunityId?: string | undefined;
401
+ startTimestamp?: string | undefined;
402
+ endTimestamp?: string | undefined;
403
+ creatorAddress?: string | undefined;
404
+ chainId?: number | undefined;
405
+ creatorId?: string | undefined;
406
+ mainParameter?: string | undefined;
407
+ tokenAddress?: string | undefined;
408
+ test?: boolean | undefined;
409
+ createdAfter?: Date | undefined;
410
+ creatorTag?: string | undefined;
411
+ distributionChainIds?: number[] | undefined;
412
+ tokenSymbol?: string | undefined;
413
+ withOpportunity?: boolean | undefined;
414
+ };
415
+ headers: unknown;
416
+ response: {
417
+ 200: {
418
+ [x: string]: number;
419
+ };
420
+ };
421
+ };
422
+ };
423
+ };
424
+ } & {
425
+ count: {
426
+ "by-protocol": {
427
+ get: {
428
+ body: unknown;
429
+ params: {};
430
+ query: {
431
+ type?: string | undefined;
432
+ status?: "NONE" | "PAST" | "LIVE" | "SOON" | undefined;
433
+ items?: number | undefined;
434
+ subType?: number | undefined;
435
+ page?: number | undefined;
436
+ types?: string[] | undefined;
437
+ campaignId?: string | undefined;
438
+ opportunityId?: string | undefined;
439
+ startTimestamp?: string | undefined;
440
+ endTimestamp?: string | undefined;
441
+ creatorAddress?: string | undefined;
442
+ chainId?: number | undefined;
443
+ creatorId?: string | undefined;
444
+ mainParameter?: string | undefined;
445
+ tokenAddress?: string | undefined;
446
+ test?: boolean | undefined;
447
+ createdAfter?: Date | undefined;
448
+ creatorTag?: string | undefined;
449
+ distributionChainIds?: number[] | undefined;
450
+ tokenSymbol?: string | undefined;
451
+ withOpportunity?: boolean | undefined;
452
+ };
453
+ headers: unknown;
454
+ response: {
455
+ 200: {
456
+ [x: string]: number;
457
+ };
458
+ };
459
+ };
460
+ };
461
+ };
380
462
  } & {
381
463
  "campaigns-to-process": {
382
464
  index: {
@@ -456,6 +538,43 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
456
538
  };
457
539
  };
458
540
  };
541
+ campaignscount: {
542
+ "by-chains": {
543
+ get: {
544
+ body: unknown;
545
+ params: {};
546
+ query: {
547
+ type?: string | undefined;
548
+ status?: "NONE" | "PAST" | "LIVE" | "SOON" | undefined;
549
+ items?: number | undefined;
550
+ subType?: number | undefined;
551
+ page?: number | undefined;
552
+ types?: string[] | undefined;
553
+ campaignId?: string | undefined;
554
+ opportunityId?: string | undefined;
555
+ startTimestamp?: string | undefined;
556
+ endTimestamp?: string | undefined;
557
+ creatorAddress?: string | undefined;
558
+ chainId?: number | undefined;
559
+ creatorId?: string | undefined;
560
+ mainParameter?: string | undefined;
561
+ tokenAddress?: string | undefined;
562
+ test?: boolean | undefined;
563
+ createdAfter?: Date | undefined;
564
+ creatorTag?: string | undefined;
565
+ distributionChainIds?: number[] | undefined;
566
+ tokenSymbol?: string | undefined;
567
+ withOpportunity?: boolean | undefined;
568
+ };
569
+ headers: unknown;
570
+ response: {
571
+ 200: {
572
+ [x: string]: number;
573
+ };
574
+ };
575
+ };
576
+ };
577
+ };
459
578
  }, {
460
579
  derive: {};
461
580
  resolve: {};
@@ -1,4 +1,4 @@
1
- import { NotFoundError } from "@/errors";
1
+ import { HttpError, NotFoundError } from "@/errors";
2
2
  import { BackOfficeGuard } from "@/guards/BackOffice.guard";
3
3
  import { AuthorizationHeadersDto, EngineGuard } from "@/guards/Engine.guard";
4
4
  import { ChainUniqueDto } from "@/modules/v4/chain/chain.model";
@@ -67,7 +67,11 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
67
67
  return await DynamicDataService.updateForCampaigns([campaignV3]);
68
68
  }, { beforeHandle: BackOfficeGuard, headers: AuthorizationHeadersDto, detail: { hide: true } })
69
69
  // ─── Get Many Campaigns ──────────────────────────────────────────────
70
- .get("/", async ({ query }) => await CampaignService.findMany(query), {
70
+ .get("/", async ({ query }) => {
71
+ if (query.items === 0)
72
+ throw new HttpError("Bad Request: Cannot retrieve 0 items", 400);
73
+ return await CampaignService.findMany(query);
74
+ }, {
71
75
  query: GetCampaignQueryDto,
72
76
  response: t.Array(CampaignResourceDto),
73
77
  detail: {
@@ -103,6 +107,13 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
103
107
  description: `**Count Campaigns**
104
108
  <p>This endpoint enables you to count campaigns corresponding to filters specified in the query params.</p>`,
105
109
  },
110
+ })
111
+ .get("count/by-chains", async ({ query }) => await CampaignService.countByChains(query), {
112
+ query: GetCampaignQueryDto,
113
+ })
114
+ .get("/count/by-type", async ({ query }) => await CampaignService.countByType(query), { query: GetCampaignQueryDto })
115
+ .get("/count/by-protocol", async ({ query }) => await CampaignService.countByProtocol(query), {
116
+ query: GetCampaignQueryDto,
106
117
  })
107
118
  .group("/campaigns-to-process", app => {
108
119
  return (app
@@ -118,6 +118,7 @@ export declare const UpdateMetaDataCampaignDto: import("@sinclair/typebox").TObj
118
118
  url: import("@sinclair/typebox").TString;
119
119
  }>;
120
120
  export declare const GetCampaignQueryDto: import("@sinclair/typebox").TObject<{
121
+ createdAfter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TDate>;
121
122
  creatorTag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
122
123
  creatorAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
123
124
  creatorId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -69,6 +69,7 @@ export const UpdateMetaDataCampaignDto = t.Object({
69
69
  url: t.String(),
70
70
  });
71
71
  export const GetCampaignQueryDto = t.Object({
72
+ createdAfter: t.Optional(t.Date({ description: "Return campaigns created after the given date" })),
72
73
  creatorTag: t.Optional(t.String({ description: "Filter campaigns created by a user who has a specific tag" })),
73
74
  creatorAddress: t.Optional(t.String()),
74
75
  creatorId: t.Optional(t.String({ description: "Filter campaigns created by a user who is registered as a merkl creator" })),
@@ -4,6 +4,9 @@ import { type ChainId } from "@sdk";
4
4
  export declare abstract class CampaignRepository {
5
5
  static transformQueryToPrismaFilters(query: GetCampaignQueryModel): {
6
6
  where: {
7
+ createdAt: {
8
+ gte: Date;
9
+ } | undefined;
7
10
  endTimestamp: {
8
11
  gte: number;
9
12
  lt?: undefined;
@@ -73,6 +76,9 @@ export declare abstract class CampaignRepository {
73
76
  Creator?: undefined;
74
77
  } | undefined;
75
78
  } | {
79
+ createdAt: {
80
+ gte: Date;
81
+ } | undefined;
76
82
  endTimestamp: {
77
83
  lt: number;
78
84
  gte?: undefined;
@@ -138,6 +144,9 @@ export declare abstract class CampaignRepository {
138
144
  Creator?: undefined;
139
145
  } | undefined;
140
146
  } | {
147
+ createdAt: {
148
+ gte: Date;
149
+ } | undefined;
141
150
  startTimestamp: {
142
151
  gt: number;
143
152
  lte?: undefined;
@@ -204,6 +213,9 @@ export declare abstract class CampaignRepository {
204
213
  Creator?: undefined;
205
214
  } | undefined;
206
215
  } | {
216
+ createdAt: {
217
+ gte: Date;
218
+ } | undefined;
207
219
  endTimestamp: {
208
220
  gte: number;
209
221
  lt?: undefined;
@@ -316,6 +328,7 @@ export declare abstract class CampaignRepository {
316
328
  endTimestamp: bigint;
317
329
  creatorAddress: string;
318
330
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
331
+ createdAt: Date;
319
332
  })[]>;
320
333
  /**
321
334
  * Retrieves all past campaigns from the database.
@@ -359,6 +372,7 @@ export declare abstract class CampaignRepository {
359
372
  endTimestamp: bigint;
360
373
  creatorAddress: string;
361
374
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
375
+ createdAt: Date;
362
376
  })[]>;
363
377
  /**
364
378
  * Retrieves all live campaigns from the database.
@@ -418,6 +432,7 @@ export declare abstract class CampaignRepository {
418
432
  endTimestamp: bigint;
419
433
  creatorAddress: string;
420
434
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
435
+ createdAt: Date;
421
436
  })[]>;
422
437
  static countLives(query?: {
423
438
  distributionChainId?: number;
@@ -460,6 +475,7 @@ export declare abstract class CampaignRepository {
460
475
  endTimestamp: bigint;
461
476
  creatorAddress: string;
462
477
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
478
+ createdAt: Date;
463
479
  } | undefined>;
464
480
  /**
465
481
  * Retrieves a campaign from the engine database by its chain and campaign id.
@@ -536,6 +552,7 @@ export declare abstract class CampaignRepository {
536
552
  endTimestamp: bigint;
537
553
  creatorAddress: string;
538
554
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
555
+ createdAt: Date;
539
556
  }) | null>;
540
557
  static findUniqueOrThrow(id: string, withOpportunity: boolean): Promise<{
541
558
  ComputeChain: {
@@ -606,6 +623,7 @@ export declare abstract class CampaignRepository {
606
623
  endTimestamp: bigint;
607
624
  creatorAddress: string;
608
625
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
626
+ createdAt: Date;
609
627
  }>;
610
628
  static findCampaignsToProcess(distributionChainId: ChainId): Promise<{
611
629
  campaignId: string;
@@ -685,6 +703,7 @@ export declare abstract class CampaignRepository {
685
703
  endTimestamp: bigint;
686
704
  creatorAddress: string;
687
705
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
706
+ createdAt: Date;
688
707
  })[]>;
689
708
  static countMany(query: GetCampaignQueryModel): Promise<number>;
690
709
  static findChains(): Promise<Record<string, ChainId>>;
@@ -707,5 +726,6 @@ export declare abstract class CampaignRepository {
707
726
  endTimestamp: bigint;
708
727
  creatorAddress: string;
709
728
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
729
+ createdAt: Date;
710
730
  }>;
711
731
  }
@@ -8,7 +8,7 @@ import moment from "moment";
8
8
  import { OpportunityService } from "../opportunity";
9
9
  export class CampaignRepository {
10
10
  static transformQueryToPrismaFilters(query) {
11
- const { creatorTag, creatorId, creatorAddress, chainId, distributionChainIds, endTimestamp, opportunityId, mainParameter, campaignId, startTimestamp, status, subType, type, types, tokenAddress, tokenSymbol, test, } = query;
11
+ const { creatorTag, creatorId, creatorAddress, chainId, distributionChainIds, endTimestamp, opportunityId, mainParameter, campaignId, startTimestamp, status, subType, type, types, tokenAddress, tokenSymbol, test, createdAfter, } = query;
12
12
  const getTagFilter = () => {
13
13
  if (creatorTag && creatorId)
14
14
  return {
@@ -66,6 +66,7 @@ export class CampaignRepository {
66
66
  },
67
67
  Creator: getTagFilter(),
68
68
  ...timeFilter,
69
+ createdAt: createdAfter ? { gte: createdAfter } : undefined,
69
70
  },
70
71
  };
71
72
  }
@@ -355,11 +356,11 @@ export class CampaignRepository {
355
356
  static async findMany(query) {
356
357
  const { page: _page, items: _items, ..._filters } = query;
357
358
  const page = _page ? _page : 0;
358
- const items = _items ? _items : 20;
359
+ const items = _items === undefined ? 20 : _items === 0 ? undefined : _items;
359
360
  const args = CampaignRepository.transformQueryToPrismaFilters(query);
360
361
  return await apiDbClient.campaign.findMany({
361
362
  take: items,
362
- skip: page * items,
363
+ skip: items ? page * items : 0,
363
364
  include: {
364
365
  DistributionChain: true,
365
366
  ComputeChain: true,