@layer-drone/protocol 0.5.0 → 0.6.0
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 +192 -42
- package/dist/index.d.ts +192 -42
- package/dist/index.js +202 -27
- package/dist/index.mjs +193 -26
- package/package.json +1 -1
- package/src/client/sdk.gen.ts +171 -0
- package/src/client/transformers.gen.ts +106 -16
- package/src/client/types.gen.ts +262 -38
- package/src/event/parser.ts +62 -10
package/src/client/sdk.gen.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
flightPlansControllerGetResponseTransformer,
|
|
15
15
|
flightReviewsControllerGetFlightReviewResponseTransformer,
|
|
16
16
|
flightReviewsControllerGetFlightReviewsResponseTransformer,
|
|
17
|
+
flightsControllerGetFlightResponseTransformer,
|
|
17
18
|
flightsControllerValidateFlightResponseTransformer,
|
|
18
19
|
inboundWebhookConfigsControllerCreateResponseTransformer,
|
|
19
20
|
inboundWebhookConfigsControllerGetManyResponseTransformer,
|
|
@@ -22,6 +23,12 @@ import {
|
|
|
22
23
|
missionsControllerCreateMissionsResponseTransformer,
|
|
23
24
|
missionsControllerGetMissionResponseTransformer,
|
|
24
25
|
missionsControllerGetMissionsResponseTransformer,
|
|
26
|
+
webhooksControllerGetManyResponseTransformer,
|
|
27
|
+
webhooksControllerGetResponseTransformer,
|
|
28
|
+
webhooksControllerRegenerateSecretResponseTransformer,
|
|
29
|
+
webhooksControllerUpdateResponseTransformer,
|
|
30
|
+
zonesControllerCreateZoneResponseTransformer,
|
|
31
|
+
zonesControllerUpdateZoneResponseTransformer,
|
|
25
32
|
} from "./transformers.gen.js";
|
|
26
33
|
import type {
|
|
27
34
|
AlchemyControllerHandleWebhookData,
|
|
@@ -62,6 +69,12 @@ import type {
|
|
|
62
69
|
DlqRedriverControllerRedriveDlqData,
|
|
63
70
|
DlqRedriverControllerRedriveDlqErrors,
|
|
64
71
|
DlqRedriverControllerRedriveDlqResponses,
|
|
72
|
+
EventProcessorFlightReviewsSyncControllerResyncFlightReviewsData,
|
|
73
|
+
EventProcessorFlightReviewsSyncControllerResyncFlightReviewsErrors,
|
|
74
|
+
EventProcessorFlightReviewsSyncControllerResyncFlightReviewsResponses,
|
|
75
|
+
EventProcessorMissionsSyncControllerResyncMissionsData,
|
|
76
|
+
EventProcessorMissionsSyncControllerResyncMissionsErrors,
|
|
77
|
+
EventProcessorMissionsSyncControllerResyncMissionsResponses,
|
|
65
78
|
FlightPlansControllerCreateData,
|
|
66
79
|
FlightPlansControllerCreateErrors,
|
|
67
80
|
FlightPlansControllerCreateResponses,
|
|
@@ -159,6 +172,15 @@ import type {
|
|
|
159
172
|
WebhooksControllerUpdateData,
|
|
160
173
|
WebhooksControllerUpdateErrors,
|
|
161
174
|
WebhooksControllerUpdateResponses,
|
|
175
|
+
ZonesControllerCreateZoneData,
|
|
176
|
+
ZonesControllerCreateZoneErrors,
|
|
177
|
+
ZonesControllerCreateZoneResponses,
|
|
178
|
+
ZonesControllerDeleteZoneData,
|
|
179
|
+
ZonesControllerDeleteZoneErrors,
|
|
180
|
+
ZonesControllerDeleteZoneResponses,
|
|
181
|
+
ZonesControllerUpdateZoneData,
|
|
182
|
+
ZonesControllerUpdateZoneErrors,
|
|
183
|
+
ZonesControllerUpdateZoneResponses,
|
|
162
184
|
} from "./types.gen.js";
|
|
163
185
|
|
|
164
186
|
export type Options<
|
|
@@ -517,6 +539,7 @@ export const flightsControllerGetFlight = <
|
|
|
517
539
|
type: "apiKey",
|
|
518
540
|
},
|
|
519
541
|
],
|
|
542
|
+
responseTransformer: flightsControllerGetFlightResponseTransformer,
|
|
520
543
|
url: "/flights/{flightId}",
|
|
521
544
|
...options,
|
|
522
545
|
});
|
|
@@ -996,6 +1019,7 @@ export const webhooksControllerGetMany = <ThrowOnError extends boolean = false>(
|
|
|
996
1019
|
type: "apiKey",
|
|
997
1020
|
},
|
|
998
1021
|
],
|
|
1022
|
+
responseTransformer: webhooksControllerGetManyResponseTransformer,
|
|
999
1023
|
url: "/org/{org_id}/webhooks",
|
|
1000
1024
|
...options,
|
|
1001
1025
|
});
|
|
@@ -1057,6 +1081,7 @@ export const webhooksControllerGet = <ThrowOnError extends boolean = false>(
|
|
|
1057
1081
|
type: "apiKey",
|
|
1058
1082
|
},
|
|
1059
1083
|
],
|
|
1084
|
+
responseTransformer: webhooksControllerGetResponseTransformer,
|
|
1060
1085
|
url: "/org/{org_id}/webhooks/{id}",
|
|
1061
1086
|
...options,
|
|
1062
1087
|
});
|
|
@@ -1076,6 +1101,7 @@ export const webhooksControllerUpdate = <ThrowOnError extends boolean = false>(
|
|
|
1076
1101
|
type: "apiKey",
|
|
1077
1102
|
},
|
|
1078
1103
|
],
|
|
1104
|
+
responseTransformer: webhooksControllerUpdateResponseTransformer,
|
|
1079
1105
|
url: "/org/{org_id}/webhooks/{id}",
|
|
1080
1106
|
...options,
|
|
1081
1107
|
headers: {
|
|
@@ -1101,8 +1127,13 @@ export const webhooksControllerRegenerateSecret = <
|
|
|
1101
1127
|
type: "apiKey",
|
|
1102
1128
|
},
|
|
1103
1129
|
],
|
|
1130
|
+
responseTransformer: webhooksControllerRegenerateSecretResponseTransformer,
|
|
1104
1131
|
url: "/org/{org_id}/webhooks/{id}/regenerate-secret",
|
|
1105
1132
|
...options,
|
|
1133
|
+
headers: {
|
|
1134
|
+
"Content-Type": "application/json",
|
|
1135
|
+
...options.headers,
|
|
1136
|
+
},
|
|
1106
1137
|
});
|
|
1107
1138
|
};
|
|
1108
1139
|
|
|
@@ -1146,6 +1177,146 @@ export const webhooksControllerGetStatus = <
|
|
|
1146
1177
|
});
|
|
1147
1178
|
};
|
|
1148
1179
|
|
|
1180
|
+
/**
|
|
1181
|
+
* Create a zone
|
|
1182
|
+
*/
|
|
1183
|
+
export const zonesControllerCreateZone = <ThrowOnError extends boolean = false>(
|
|
1184
|
+
options: Options<ZonesControllerCreateZoneData, ThrowOnError>,
|
|
1185
|
+
) => {
|
|
1186
|
+
return (options.client ?? _heyApiClient).post<
|
|
1187
|
+
ZonesControllerCreateZoneResponses,
|
|
1188
|
+
ZonesControllerCreateZoneErrors,
|
|
1189
|
+
ThrowOnError
|
|
1190
|
+
>({
|
|
1191
|
+
security: [
|
|
1192
|
+
{
|
|
1193
|
+
name: "x-api-token",
|
|
1194
|
+
type: "apiKey",
|
|
1195
|
+
},
|
|
1196
|
+
],
|
|
1197
|
+
responseTransformer: zonesControllerCreateZoneResponseTransformer,
|
|
1198
|
+
url: "/zones",
|
|
1199
|
+
...options,
|
|
1200
|
+
headers: {
|
|
1201
|
+
"Content-Type": "application/json",
|
|
1202
|
+
...options.headers,
|
|
1203
|
+
},
|
|
1204
|
+
});
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Delete a zone
|
|
1209
|
+
*/
|
|
1210
|
+
export const zonesControllerDeleteZone = <ThrowOnError extends boolean = false>(
|
|
1211
|
+
options: Options<ZonesControllerDeleteZoneData, ThrowOnError>,
|
|
1212
|
+
) => {
|
|
1213
|
+
return (options.client ?? _heyApiClient).delete<
|
|
1214
|
+
ZonesControllerDeleteZoneResponses,
|
|
1215
|
+
ZonesControllerDeleteZoneErrors,
|
|
1216
|
+
ThrowOnError
|
|
1217
|
+
>({
|
|
1218
|
+
security: [
|
|
1219
|
+
{
|
|
1220
|
+
name: "x-api-token",
|
|
1221
|
+
type: "apiKey",
|
|
1222
|
+
},
|
|
1223
|
+
],
|
|
1224
|
+
url: "/zones/{id}",
|
|
1225
|
+
...options,
|
|
1226
|
+
});
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1229
|
+
/**
|
|
1230
|
+
* Update a zone
|
|
1231
|
+
*/
|
|
1232
|
+
export const zonesControllerUpdateZone = <ThrowOnError extends boolean = false>(
|
|
1233
|
+
options: Options<ZonesControllerUpdateZoneData, ThrowOnError>,
|
|
1234
|
+
) => {
|
|
1235
|
+
return (options.client ?? _heyApiClient).put<
|
|
1236
|
+
ZonesControllerUpdateZoneResponses,
|
|
1237
|
+
ZonesControllerUpdateZoneErrors,
|
|
1238
|
+
ThrowOnError
|
|
1239
|
+
>({
|
|
1240
|
+
security: [
|
|
1241
|
+
{
|
|
1242
|
+
name: "x-api-token",
|
|
1243
|
+
type: "apiKey",
|
|
1244
|
+
},
|
|
1245
|
+
],
|
|
1246
|
+
responseTransformer: zonesControllerUpdateZoneResponseTransformer,
|
|
1247
|
+
url: "/zones/{id}",
|
|
1248
|
+
...options,
|
|
1249
|
+
headers: {
|
|
1250
|
+
"Content-Type": "application/json",
|
|
1251
|
+
...options.headers,
|
|
1252
|
+
},
|
|
1253
|
+
});
|
|
1254
|
+
};
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* Force mission state resync from RPC
|
|
1258
|
+
* For each mission ID, reads MissionData + MissionEscrow on-chain, loads off-chain JSON from the missions bucket, and upserts event-proc.vaults / missions / campaigns.
|
|
1259
|
+
*/
|
|
1260
|
+
export const eventProcessorMissionsSyncControllerResyncMissions = <
|
|
1261
|
+
ThrowOnError extends boolean = false,
|
|
1262
|
+
>(
|
|
1263
|
+
options: Options<
|
|
1264
|
+
EventProcessorMissionsSyncControllerResyncMissionsData,
|
|
1265
|
+
ThrowOnError
|
|
1266
|
+
>,
|
|
1267
|
+
) => {
|
|
1268
|
+
return (options.client ?? _heyApiClient).put<
|
|
1269
|
+
EventProcessorMissionsSyncControllerResyncMissionsResponses,
|
|
1270
|
+
EventProcessorMissionsSyncControllerResyncMissionsErrors,
|
|
1271
|
+
ThrowOnError
|
|
1272
|
+
>({
|
|
1273
|
+
security: [
|
|
1274
|
+
{
|
|
1275
|
+
name: "x-api-token",
|
|
1276
|
+
type: "apiKey",
|
|
1277
|
+
},
|
|
1278
|
+
],
|
|
1279
|
+
url: "/event-processor/missions/sync",
|
|
1280
|
+
...options,
|
|
1281
|
+
headers: {
|
|
1282
|
+
"Content-Type": "application/json",
|
|
1283
|
+
...options.headers,
|
|
1284
|
+
},
|
|
1285
|
+
});
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Force flight review state resync from RPC
|
|
1290
|
+
* For each flight ID, reads FlightReviews on-chain, resolves validation log URI like the indexer, fetches optional S3 validation log, and upserts event-proc.flight_reviews.
|
|
1291
|
+
*/
|
|
1292
|
+
export const eventProcessorFlightReviewsSyncControllerResyncFlightReviews = <
|
|
1293
|
+
ThrowOnError extends boolean = false,
|
|
1294
|
+
>(
|
|
1295
|
+
options: Options<
|
|
1296
|
+
EventProcessorFlightReviewsSyncControllerResyncFlightReviewsData,
|
|
1297
|
+
ThrowOnError
|
|
1298
|
+
>,
|
|
1299
|
+
) => {
|
|
1300
|
+
return (options.client ?? _heyApiClient).put<
|
|
1301
|
+
EventProcessorFlightReviewsSyncControllerResyncFlightReviewsResponses,
|
|
1302
|
+
EventProcessorFlightReviewsSyncControllerResyncFlightReviewsErrors,
|
|
1303
|
+
ThrowOnError
|
|
1304
|
+
>({
|
|
1305
|
+
security: [
|
|
1306
|
+
{
|
|
1307
|
+
name: "x-api-token",
|
|
1308
|
+
type: "apiKey",
|
|
1309
|
+
},
|
|
1310
|
+
],
|
|
1311
|
+
url: "/event-processor/flightreviews",
|
|
1312
|
+
...options,
|
|
1313
|
+
headers: {
|
|
1314
|
+
"Content-Type": "application/json",
|
|
1315
|
+
...options.headers,
|
|
1316
|
+
},
|
|
1317
|
+
});
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1149
1320
|
export const alchemyControllerHandleWebhook = <
|
|
1150
1321
|
ThrowOnError extends boolean = false,
|
|
1151
1322
|
>(
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
FlightPlansControllerGetResponse,
|
|
9
9
|
FlightReviewsControllerGetFlightReviewResponse,
|
|
10
10
|
FlightReviewsControllerGetFlightReviewsResponse,
|
|
11
|
+
FlightsControllerGetFlightResponse,
|
|
11
12
|
FlightsControllerValidateFlightResponse,
|
|
12
13
|
InboundWebhookConfigsControllerCreateResponse,
|
|
13
14
|
InboundWebhookConfigsControllerGetManyResponse,
|
|
@@ -16,6 +17,12 @@ import type {
|
|
|
16
17
|
MissionsControllerCreateMissionsResponse,
|
|
17
18
|
MissionsControllerGetMissionResponse,
|
|
18
19
|
MissionsControllerGetMissionsResponse,
|
|
20
|
+
WebhooksControllerGetManyResponse,
|
|
21
|
+
WebhooksControllerGetResponse,
|
|
22
|
+
WebhooksControllerRegenerateSecretResponse,
|
|
23
|
+
WebhooksControllerUpdateResponse,
|
|
24
|
+
ZonesControllerCreateZoneResponse,
|
|
25
|
+
ZonesControllerUpdateZoneResponse,
|
|
19
26
|
} from "./types.gen.js";
|
|
20
27
|
|
|
21
28
|
const updateApiTokenResponseDtoSchemaResponseTransformer = (data: any) => {
|
|
@@ -70,6 +77,18 @@ export const contractsControllerGetAllContractsResponseTransformer = async (
|
|
|
70
77
|
return data;
|
|
71
78
|
};
|
|
72
79
|
|
|
80
|
+
const flightDtoSchemaResponseTransformer = (data: any) => {
|
|
81
|
+
data.payout.createdAt = new Date(data.payout.createdAt);
|
|
82
|
+
return data;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const flightsControllerGetFlightResponseTransformer = async (
|
|
86
|
+
data: any,
|
|
87
|
+
): Promise<FlightsControllerGetFlightResponse> => {
|
|
88
|
+
data = flightDtoSchemaResponseTransformer(data);
|
|
89
|
+
return data;
|
|
90
|
+
};
|
|
91
|
+
|
|
73
92
|
const validateFlightResponseDtoSchemaResponseTransformer = (data: any) => {
|
|
74
93
|
data.flightId = BigInt(data.flightId.toString());
|
|
75
94
|
return data;
|
|
@@ -155,14 +174,13 @@ export const flightReviewsControllerGetFlightReviewsResponseTransformer =
|
|
|
155
174
|
};
|
|
156
175
|
|
|
157
176
|
const getMissionResponseDtoSchemaResponseTransformer = (data: any) => {
|
|
158
|
-
data.
|
|
159
|
-
data.
|
|
160
|
-
data.
|
|
161
|
-
data.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
177
|
+
data.captureStartTime = new Date(data.captureStartTime);
|
|
178
|
+
data.captureEndTime = new Date(data.captureEndTime);
|
|
179
|
+
data.createdAt = new Date(data.createdAt);
|
|
180
|
+
data.updatedAt = new Date(data.updatedAt);
|
|
181
|
+
data.payout.createdAt = new Date(data.payout.createdAt);
|
|
182
|
+
data.vault.createdAt = new Date(data.vault.createdAt);
|
|
183
|
+
data.vault.updatedAt = new Date(data.vault.updatedAt);
|
|
166
184
|
return data;
|
|
167
185
|
};
|
|
168
186
|
|
|
@@ -175,14 +193,13 @@ export const missionsControllerGetMissionResponseTransformer = async (
|
|
|
175
193
|
|
|
176
194
|
const getMissionsResponseDtoSchemaResponseTransformer = (data: any) => {
|
|
177
195
|
data.missions = data.missions.map((item: any) => {
|
|
178
|
-
item.
|
|
179
|
-
item.
|
|
180
|
-
item.
|
|
181
|
-
item.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
196
|
+
item.captureStartTime = new Date(item.captureStartTime);
|
|
197
|
+
item.captureEndTime = new Date(item.captureEndTime);
|
|
198
|
+
item.createdAt = new Date(item.createdAt);
|
|
199
|
+
item.updatedAt = new Date(item.updatedAt);
|
|
200
|
+
item.payout.createdAt = new Date(item.payout.createdAt);
|
|
201
|
+
item.vault.createdAt = new Date(item.vault.createdAt);
|
|
202
|
+
item.vault.updatedAt = new Date(item.vault.updatedAt);
|
|
186
203
|
return item;
|
|
187
204
|
});
|
|
188
205
|
return data;
|
|
@@ -211,6 +228,79 @@ export const missionsControllerCreateMissionsResponseTransformer = async (
|
|
|
211
228
|
return data;
|
|
212
229
|
};
|
|
213
230
|
|
|
231
|
+
const getWebhooksResponseSchemaResponseTransformer = (data: any) => {
|
|
232
|
+
data = data.map((item: any) => {
|
|
233
|
+
item.previous_secret_expires_at = new Date(item.previous_secret_expires_at);
|
|
234
|
+
return item;
|
|
235
|
+
});
|
|
236
|
+
return data;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export const webhooksControllerGetManyResponseTransformer = async (
|
|
240
|
+
data: any,
|
|
241
|
+
): Promise<WebhooksControllerGetManyResponse> => {
|
|
242
|
+
data = getWebhooksResponseSchemaResponseTransformer(data);
|
|
243
|
+
return data;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const getWebhookResponseSchemaResponseTransformer = (data: any) => {
|
|
247
|
+
data.previous_secret_expires_at = new Date(data.previous_secret_expires_at);
|
|
248
|
+
return data;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export const webhooksControllerGetResponseTransformer = async (
|
|
252
|
+
data: any,
|
|
253
|
+
): Promise<WebhooksControllerGetResponse> => {
|
|
254
|
+
data = getWebhookResponseSchemaResponseTransformer(data);
|
|
255
|
+
return data;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
const updateWebhookResponseSchemaResponseTransformer = (data: any) => {
|
|
259
|
+
data.previous_secret_expires_at = new Date(data.previous_secret_expires_at);
|
|
260
|
+
return data;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export const webhooksControllerUpdateResponseTransformer = async (
|
|
264
|
+
data: any,
|
|
265
|
+
): Promise<WebhooksControllerUpdateResponse> => {
|
|
266
|
+
data = updateWebhookResponseSchemaResponseTransformer(data);
|
|
267
|
+
return data;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
const regenerateWebhookSecretResponseDtoSchemaResponseTransformer = (
|
|
271
|
+
data: any,
|
|
272
|
+
) => {
|
|
273
|
+
data.previous_secret_expires_at = new Date(data.previous_secret_expires_at);
|
|
274
|
+
return data;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export const webhooksControllerRegenerateSecretResponseTransformer = async (
|
|
278
|
+
data: any,
|
|
279
|
+
): Promise<WebhooksControllerRegenerateSecretResponse> => {
|
|
280
|
+
data = regenerateWebhookSecretResponseDtoSchemaResponseTransformer(data);
|
|
281
|
+
return data;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const zoneResponseDtoSchemaResponseTransformer = (data: any) => {
|
|
285
|
+
data.created_at = new Date(data.created_at);
|
|
286
|
+
data.updated_at = new Date(data.updated_at);
|
|
287
|
+
return data;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
export const zonesControllerCreateZoneResponseTransformer = async (
|
|
291
|
+
data: any,
|
|
292
|
+
): Promise<ZonesControllerCreateZoneResponse> => {
|
|
293
|
+
data = zoneResponseDtoSchemaResponseTransformer(data);
|
|
294
|
+
return data;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
export const zonesControllerUpdateZoneResponseTransformer = async (
|
|
298
|
+
data: any,
|
|
299
|
+
): Promise<ZonesControllerUpdateZoneResponse> => {
|
|
300
|
+
data = zoneResponseDtoSchemaResponseTransformer(data);
|
|
301
|
+
return data;
|
|
302
|
+
};
|
|
303
|
+
|
|
214
304
|
const getInboundWebhookConfigsResponseSchemaResponseTransformer = (
|
|
215
305
|
data: any,
|
|
216
306
|
) => {
|