@merkl/api 0.20.20 → 0.20.21

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.
@@ -1195,6 +1195,17 @@ declare const eden: {
1195
1195
  }>>;
1196
1196
  };
1197
1197
  }) & {
1198
+ "dynamic-data": {
1199
+ post: (body: string[], options: {
1200
+ headers: {
1201
+ authorization: string;
1202
+ };
1203
+ query?: Record<string, unknown> | undefined;
1204
+ fetch?: RequestInit | undefined;
1205
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
1206
+ 200: unknown[];
1207
+ }>>;
1208
+ };
1198
1209
  metadata: {
1199
1210
  get: (options: {
1200
1211
  headers: {
@@ -4946,6 +4957,17 @@ declare const eden: {
4946
4957
  }>>;
4947
4958
  };
4948
4959
  }) & {
4960
+ "dynamic-data": {
4961
+ post: (body: string[], options: {
4962
+ headers: {
4963
+ authorization: string;
4964
+ };
4965
+ query?: Record<string, unknown> | undefined;
4966
+ fetch?: RequestInit | undefined;
4967
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
4968
+ 200: unknown[];
4969
+ }>>;
4970
+ };
4949
4971
  metadata: {
4950
4972
  get: (options: {
4951
4973
  headers: {
@@ -9469,6 +9491,22 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
9469
9491
  };
9470
9492
  };
9471
9493
  };
9494
+ } & {
9495
+ "dry-run": {
9496
+ "dynamic-data": {
9497
+ post: {
9498
+ body: string[];
9499
+ params: {};
9500
+ query: unknown;
9501
+ headers: {
9502
+ authorization: string;
9503
+ };
9504
+ response: {
9505
+ 200: unknown[];
9506
+ };
9507
+ };
9508
+ };
9509
+ };
9472
9510
  } & {
9473
9511
  "dry-run": {
9474
9512
  metadata: {
@@ -14965,6 +15003,17 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
14965
15003
  }>>;
14966
15004
  };
14967
15005
  }) & {
15006
+ "dynamic-data": {
15007
+ post: (body: string[], options: {
15008
+ headers: {
15009
+ authorization: string;
15010
+ };
15011
+ query?: Record<string, unknown> | undefined;
15012
+ fetch?: RequestInit | undefined;
15013
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
15014
+ 200: unknown[];
15015
+ }>>;
15016
+ };
14968
15017
  metadata: {
14969
15018
  get: (options: {
14970
15019
  headers: {
@@ -18716,6 +18765,17 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
18716
18765
  }>>;
18717
18766
  };
18718
18767
  }) & {
18768
+ "dynamic-data": {
18769
+ post: (body: string[], options: {
18770
+ headers: {
18771
+ authorization: string;
18772
+ };
18773
+ query?: Record<string, unknown> | undefined;
18774
+ fetch?: RequestInit | undefined;
18775
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
18776
+ 200: unknown[];
18777
+ }>>;
18778
+ };
18719
18779
  metadata: {
18720
18780
  get: (options: {
18721
18781
  headers: {
@@ -1280,6 +1280,22 @@ declare const app: Elysia<"", false, {
1280
1280
  };
1281
1281
  };
1282
1282
  };
1283
+ } & {
1284
+ "dry-run": {
1285
+ "dynamic-data": {
1286
+ post: {
1287
+ body: string[];
1288
+ params: {};
1289
+ query: unknown;
1290
+ headers: {
1291
+ authorization: string;
1292
+ };
1293
+ response: {
1294
+ 200: unknown[];
1295
+ };
1296
+ };
1297
+ };
1298
+ };
1283
1299
  } & {
1284
1300
  "dry-run": {
1285
1301
  metadata: {
@@ -183,6 +183,22 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
183
183
  };
184
184
  };
185
185
  };
186
+ } & {
187
+ "dry-run": {
188
+ "dynamic-data": {
189
+ post: {
190
+ body: string[];
191
+ params: {};
192
+ query: unknown;
193
+ headers: {
194
+ authorization: string;
195
+ };
196
+ response: {
197
+ 200: unknown[];
198
+ };
199
+ };
200
+ };
201
+ };
186
202
  } & {
187
203
  "dry-run": {
188
204
  metadata: {
@@ -8,7 +8,7 @@ import { throwOnUnsupportedChainId } from "src/utils/throw";
8
8
  import { DynamicDataService } from "../dynamicData/dynamicData.service";
9
9
  import { OpportunityService } from "../opportunity";
10
10
  import { OpportunityConvertorService } from "../opportunity/opportunity.converter";
11
- import { CampaignResourceDto, CampaignUniqueDto, CreateCampaignDto, GetCampaignQueryDto, RemoveManualOverrideDto, UpdateCampaignCreatorDto, UpdateCampaignDto, UpdateMetaDataCampaignDto, } from "./campaign.model";
11
+ import { CampaignResourceDto, CampaignUniqueDto, CampaignsDto, CreateCampaignDto, GetCampaignQueryDto, RemoveManualOverrideDto, UpdateCampaignCreatorDto, UpdateCampaignDto, UpdateMetaDataCampaignDto, } from "./campaign.model";
12
12
  import { CampaignService } from "./campaign.service";
13
13
  // ─── Campaigns Controller ────────────────────────────────────────────────────
14
14
  export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { tags: ["Campaigns"] } })
@@ -65,6 +65,19 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
65
65
  const campaignV3 = OpportunityConvertorService.convertV4CampaignToV3(Campaign[campaign.type], CampaignService.format(campaign), campaign.Opportunity.identifier);
66
66
  return await DynamicDataService.updateForCampaigns([campaignV3], true);
67
67
  }, { beforeHandle: BackOfficeGuard, headers: AuthorizationHeadersDto, detail: { hide: true } })
68
+ // ─── Test Dynamic data computation with a list of campaignId ───────────────────────
69
+ .post("/dynamic-data", async ({ body }) => {
70
+ const listCampaigns = [];
71
+ for (const campaignId of body) {
72
+ const id = (await CampaignService.findMany({ campaignId: campaignId, test: true }))?.[0]?.id;
73
+ if (!id)
74
+ throw new NotFoundError();
75
+ const campaign = await CampaignService.findUniqueOrThrow(id, true);
76
+ const campaignV3 = OpportunityConvertorService.convertV4CampaignToV3(Campaign[campaign.type], CampaignService.format(campaign), campaign.Opportunity.identifier);
77
+ listCampaigns.push(campaignV3);
78
+ }
79
+ return await DynamicDataService.updateForCampaigns(listCampaigns, true);
80
+ }, { beforeHandle: BackOfficeGuard, body: CampaignsDto, headers: AuthorizationHeadersDto, detail: { hide: true } })
68
81
  // ─── Test Opportunity creation through a campaign Id and a chain ───────────────────────
69
82
  // @dev Starts from the engine db to debug opportunity creation failing and preventing the api db to be filled
70
83
  .get("/metadata", async ({ query }) => {
@@ -29,6 +29,7 @@ export declare const CampaignUniqueDto: import("@sinclair/typebox").TObject<{
29
29
  distributionChain: import("@sinclair/typebox").TNumber;
30
30
  campaignId: import("@sinclair/typebox").TString;
31
31
  }>;
32
+ export declare const CampaignsDto: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
32
33
  export declare const CampaignResourceDto: import("@sinclair/typebox").TObject<{
33
34
  id: import("@sinclair/typebox").TString;
34
35
  computeChainId: import("@sinclair/typebox").TNumber;
@@ -8,6 +8,7 @@ export const CampaignUniqueDto = t.Object({
8
8
  distributionChain: t.Numeric(),
9
9
  campaignId: t.String(),
10
10
  });
11
+ export const CampaignsDto = t.Array(t.String());
11
12
  export const CampaignResourceDto = t.Object({
12
13
  id: t.String(),
13
14
  computeChainId: t.Number(),
@@ -1150,6 +1150,22 @@ export declare const v4: Elysia<"/v4", false, {
1150
1150
  };
1151
1151
  };
1152
1152
  };
1153
+ } & {
1154
+ "dry-run": {
1155
+ "dynamic-data": {
1156
+ post: {
1157
+ body: string[];
1158
+ params: {};
1159
+ query: unknown;
1160
+ headers: {
1161
+ authorization: string;
1162
+ };
1163
+ response: {
1164
+ 200: unknown[];
1165
+ };
1166
+ };
1167
+ };
1168
+ };
1153
1169
  } & {
1154
1170
  "dry-run": {
1155
1171
  metadata: {