@layer-drone/protocol 0.3.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 +336 -18
- package/dist/index.d.ts +336 -18
- package/dist/index.js +300 -19
- package/dist/index.mjs +287 -17
- package/package.json +1 -1
- package/src/client/client/types.ts +4 -5
- package/src/client/core/pathSerializer.ts +1 -2
- package/src/client/sdk.gen.ts +290 -17
- package/src/client/transformers.gen.ts +165 -0
- package/src/client/types.gen.ts +438 -16
- package/src/event/parser.ts +62 -10
package/src/client/types.gen.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type CreateApiTokenResponseDto = {
|
|
|
9
9
|
scopes: Array<
|
|
10
10
|
| "manageTokens"
|
|
11
11
|
| "manageFlights"
|
|
12
|
+
| "manageFlightReviews"
|
|
12
13
|
| "manageFlightPlans"
|
|
13
14
|
| "manageMissions"
|
|
14
15
|
| "manageVaults"
|
|
@@ -16,6 +17,10 @@ export type CreateApiTokenResponseDto = {
|
|
|
16
17
|
| "manageContracts"
|
|
17
18
|
| "redrive"
|
|
18
19
|
| "updateOnChainData"
|
|
20
|
+
| "syncEventProcessorState"
|
|
21
|
+
| "manageZones"
|
|
22
|
+
| "manageProposals"
|
|
23
|
+
| "approveProposals"
|
|
19
24
|
| "all"
|
|
20
25
|
>;
|
|
21
26
|
};
|
|
@@ -25,6 +30,7 @@ export type CreateApiTokenRequestDto = {
|
|
|
25
30
|
scopes: Array<
|
|
26
31
|
| "manageTokens"
|
|
27
32
|
| "manageFlights"
|
|
33
|
+
| "manageFlightReviews"
|
|
28
34
|
| "manageFlightPlans"
|
|
29
35
|
| "manageMissions"
|
|
30
36
|
| "manageVaults"
|
|
@@ -32,6 +38,10 @@ export type CreateApiTokenRequestDto = {
|
|
|
32
38
|
| "manageContracts"
|
|
33
39
|
| "redrive"
|
|
34
40
|
| "updateOnChainData"
|
|
41
|
+
| "syncEventProcessorState"
|
|
42
|
+
| "manageZones"
|
|
43
|
+
| "manageProposals"
|
|
44
|
+
| "approveProposals"
|
|
35
45
|
| "all"
|
|
36
46
|
>;
|
|
37
47
|
orgId: number;
|
|
@@ -42,6 +52,7 @@ export type UpdateApiTokenRequestDto = {
|
|
|
42
52
|
scopes?: Array<
|
|
43
53
|
| "manageTokens"
|
|
44
54
|
| "manageFlights"
|
|
55
|
+
| "manageFlightReviews"
|
|
45
56
|
| "manageFlightPlans"
|
|
46
57
|
| "manageMissions"
|
|
47
58
|
| "manageVaults"
|
|
@@ -49,6 +60,10 @@ export type UpdateApiTokenRequestDto = {
|
|
|
49
60
|
| "manageContracts"
|
|
50
61
|
| "redrive"
|
|
51
62
|
| "updateOnChainData"
|
|
63
|
+
| "syncEventProcessorState"
|
|
64
|
+
| "manageZones"
|
|
65
|
+
| "manageProposals"
|
|
66
|
+
| "approveProposals"
|
|
52
67
|
| "all"
|
|
53
68
|
>;
|
|
54
69
|
};
|
|
@@ -62,6 +77,7 @@ export type UpdateApiTokenResponseDto = {
|
|
|
62
77
|
scopes: Array<
|
|
63
78
|
| "manageTokens"
|
|
64
79
|
| "manageFlights"
|
|
80
|
+
| "manageFlightReviews"
|
|
65
81
|
| "manageFlightPlans"
|
|
66
82
|
| "manageMissions"
|
|
67
83
|
| "manageVaults"
|
|
@@ -69,6 +85,10 @@ export type UpdateApiTokenResponseDto = {
|
|
|
69
85
|
| "manageContracts"
|
|
70
86
|
| "redrive"
|
|
71
87
|
| "updateOnChainData"
|
|
88
|
+
| "syncEventProcessorState"
|
|
89
|
+
| "manageZones"
|
|
90
|
+
| "manageProposals"
|
|
91
|
+
| "approveProposals"
|
|
72
92
|
| "all"
|
|
73
93
|
>;
|
|
74
94
|
};
|
|
@@ -296,6 +316,16 @@ export type FlightDto = {
|
|
|
296
316
|
block_number: number;
|
|
297
317
|
block_timestamp: number;
|
|
298
318
|
transaction_hash: string;
|
|
319
|
+
payout: {
|
|
320
|
+
id: string;
|
|
321
|
+
missionId: string;
|
|
322
|
+
flightReviewId: string;
|
|
323
|
+
recipient: string;
|
|
324
|
+
amount: string;
|
|
325
|
+
tokenContractAddress: string;
|
|
326
|
+
chainId: number;
|
|
327
|
+
createdAt: Date;
|
|
328
|
+
};
|
|
299
329
|
};
|
|
300
330
|
|
|
301
331
|
export type CreateFileRequestDto = {
|
|
@@ -502,10 +532,43 @@ export type CreateFlightPlanResponse = {
|
|
|
502
532
|
updated_at: Date;
|
|
503
533
|
};
|
|
504
534
|
|
|
535
|
+
export type GetFlightReviewResponseDto = {
|
|
536
|
+
flightId: string;
|
|
537
|
+
owner: string;
|
|
538
|
+
validator: string;
|
|
539
|
+
isApproved: boolean;
|
|
540
|
+
storageKey: string;
|
|
541
|
+
filesHash: string;
|
|
542
|
+
missionId: string;
|
|
543
|
+
validationLogUri: string;
|
|
544
|
+
contractAddress: string;
|
|
545
|
+
chainId: number;
|
|
546
|
+
createdAt: Date;
|
|
547
|
+
updatedAt: Date;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
export type GetFlightReviewsResponseDto = {
|
|
551
|
+
flightReviews: Array<{
|
|
552
|
+
flightId: string;
|
|
553
|
+
owner: string;
|
|
554
|
+
validator: string;
|
|
555
|
+
isApproved: boolean;
|
|
556
|
+
storageKey: string;
|
|
557
|
+
filesHash: string;
|
|
558
|
+
missionId: string;
|
|
559
|
+
validationLogUri: string;
|
|
560
|
+
contractAddress: string;
|
|
561
|
+
chainId: number;
|
|
562
|
+
createdAt: Date;
|
|
563
|
+
updatedAt: Date;
|
|
564
|
+
}>;
|
|
565
|
+
};
|
|
566
|
+
|
|
505
567
|
export type GetProvenanceCryptoKeyResponse = {
|
|
506
568
|
KeyId: string;
|
|
507
569
|
PublicKey: string;
|
|
508
570
|
KeySpec?:
|
|
571
|
+
| "ECC_NIST_EDWARDS25519"
|
|
509
572
|
| "ECC_NIST_P256"
|
|
510
573
|
| "ECC_NIST_P384"
|
|
511
574
|
| "ECC_NIST_P521"
|
|
@@ -514,6 +577,9 @@ export type GetProvenanceCryptoKeyResponse = {
|
|
|
514
577
|
| "HMAC_256"
|
|
515
578
|
| "HMAC_384"
|
|
516
579
|
| "HMAC_512"
|
|
580
|
+
| "ML_DSA_44"
|
|
581
|
+
| "ML_DSA_65"
|
|
582
|
+
| "ML_DSA_87"
|
|
517
583
|
| "RSA_2048"
|
|
518
584
|
| "RSA_3072"
|
|
519
585
|
| "RSA_4096"
|
|
@@ -529,6 +595,83 @@ export type GetProvenanceCryptoKeyResponse = {
|
|
|
529
595
|
>;
|
|
530
596
|
};
|
|
531
597
|
|
|
598
|
+
export type GetMissionResponseDto = {
|
|
599
|
+
id: string;
|
|
600
|
+
vaultId: string;
|
|
601
|
+
requestor: string;
|
|
602
|
+
zoneId: string;
|
|
603
|
+
isOpen: boolean;
|
|
604
|
+
flightPlanId: number;
|
|
605
|
+
isReservable: boolean;
|
|
606
|
+
tags: {
|
|
607
|
+
[key: string]: string;
|
|
608
|
+
};
|
|
609
|
+
captureStartTime: Date;
|
|
610
|
+
captureEndTime: Date;
|
|
611
|
+
campaigns: Array<string>;
|
|
612
|
+
contractAddress: string;
|
|
613
|
+
chainId: number;
|
|
614
|
+
createdAt: Date;
|
|
615
|
+
updatedAt: Date;
|
|
616
|
+
payout: {
|
|
617
|
+
id: string;
|
|
618
|
+
recipient: string;
|
|
619
|
+
amount: string;
|
|
620
|
+
flightReviewId: string;
|
|
621
|
+
createdAt: Date;
|
|
622
|
+
};
|
|
623
|
+
vault: {
|
|
624
|
+
id: string;
|
|
625
|
+
amount: string;
|
|
626
|
+
collateralTokenAddress: string;
|
|
627
|
+
funder: string;
|
|
628
|
+
contractAddress: string;
|
|
629
|
+
chainId: number;
|
|
630
|
+
createdAt: Date;
|
|
631
|
+
updatedAt: Date;
|
|
632
|
+
};
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
export type GetMissionsResponseDto = {
|
|
636
|
+
missions: Array<{
|
|
637
|
+
id: string;
|
|
638
|
+
vaultId: string;
|
|
639
|
+
requestor: string;
|
|
640
|
+
zoneId: string;
|
|
641
|
+
isOpen: boolean;
|
|
642
|
+
flightPlanId: number;
|
|
643
|
+
isReservable: boolean;
|
|
644
|
+
tags: {
|
|
645
|
+
[key: string]: string;
|
|
646
|
+
};
|
|
647
|
+
captureStartTime: Date;
|
|
648
|
+
captureEndTime: Date;
|
|
649
|
+
campaigns: Array<string>;
|
|
650
|
+
contractAddress: string;
|
|
651
|
+
chainId: number;
|
|
652
|
+
createdAt: Date;
|
|
653
|
+
updatedAt: Date;
|
|
654
|
+
payout: {
|
|
655
|
+
id: string;
|
|
656
|
+
recipient: string;
|
|
657
|
+
amount: string;
|
|
658
|
+
flightReviewId: string;
|
|
659
|
+
createdAt: Date;
|
|
660
|
+
};
|
|
661
|
+
vault: {
|
|
662
|
+
id: string;
|
|
663
|
+
amount: string;
|
|
664
|
+
collateralTokenAddress: string;
|
|
665
|
+
funder: string;
|
|
666
|
+
contractAddress: string;
|
|
667
|
+
chainId: number;
|
|
668
|
+
createdAt: Date;
|
|
669
|
+
updatedAt: Date;
|
|
670
|
+
};
|
|
671
|
+
}>;
|
|
672
|
+
hasNextPage: boolean;
|
|
673
|
+
};
|
|
674
|
+
|
|
532
675
|
export type CreateMissionRequestDto = {
|
|
533
676
|
missions: Array<{
|
|
534
677
|
zoneId: string;
|
|
@@ -539,7 +682,7 @@ export type CreateMissionRequestDto = {
|
|
|
539
682
|
endTime: Date;
|
|
540
683
|
collateralToken: string;
|
|
541
684
|
decimals: number;
|
|
542
|
-
isReservable
|
|
685
|
+
isReservable?: boolean;
|
|
543
686
|
tags?: {
|
|
544
687
|
[key: string]: string;
|
|
545
688
|
};
|
|
@@ -555,6 +698,7 @@ export type CreateMissionResponseDto = {
|
|
|
555
698
|
id: string;
|
|
556
699
|
vaultId: string;
|
|
557
700
|
amount: string;
|
|
701
|
+
collateralToken: string;
|
|
558
702
|
zoneId: string;
|
|
559
703
|
flightPlanId: number;
|
|
560
704
|
campaigns: Array<string>;
|
|
@@ -679,6 +823,7 @@ export type GetWebhooksResponse = Array<{
|
|
|
679
823
|
active: boolean;
|
|
680
824
|
failure_count: number;
|
|
681
825
|
last_failure_reason: string;
|
|
826
|
+
previous_secret_expires_at: Date;
|
|
682
827
|
created_at: string;
|
|
683
828
|
updated_at: string;
|
|
684
829
|
}>;
|
|
@@ -699,6 +844,7 @@ export type GetWebhookResponse = {
|
|
|
699
844
|
active: boolean;
|
|
700
845
|
failure_count: number;
|
|
701
846
|
last_failure_reason: string;
|
|
847
|
+
previous_secret_expires_at: Date;
|
|
702
848
|
created_at: string;
|
|
703
849
|
updated_at: string;
|
|
704
850
|
};
|
|
@@ -734,6 +880,7 @@ export type UpdateWebhookResponse = {
|
|
|
734
880
|
active: boolean;
|
|
735
881
|
failure_count: number;
|
|
736
882
|
last_failure_reason: string;
|
|
883
|
+
previous_secret_expires_at: Date;
|
|
737
884
|
created_at: string;
|
|
738
885
|
updated_at: string;
|
|
739
886
|
};
|
|
@@ -742,8 +889,15 @@ export type DeleteWebhookResponse = {
|
|
|
742
889
|
message: string;
|
|
743
890
|
};
|
|
744
891
|
|
|
892
|
+
export type RegenerateWebhookSecretBody =
|
|
893
|
+
| {
|
|
894
|
+
previous_secret_expires_at?: Date;
|
|
895
|
+
}
|
|
896
|
+
| unknown;
|
|
897
|
+
|
|
745
898
|
export type RegenerateWebhookSecretResponseDto = {
|
|
746
899
|
secret: string;
|
|
900
|
+
previous_secret_expires_at: Date;
|
|
747
901
|
};
|
|
748
902
|
|
|
749
903
|
export type TestWebhookResponse = {
|
|
@@ -755,6 +909,51 @@ export type GetWebhookStatusResponse = {
|
|
|
755
909
|
error?: string;
|
|
756
910
|
};
|
|
757
911
|
|
|
912
|
+
export type CreateZoneDto = {
|
|
913
|
+
id: string;
|
|
914
|
+
region_id: number;
|
|
915
|
+
is_flyable?: boolean;
|
|
916
|
+
};
|
|
917
|
+
|
|
918
|
+
export type ZoneResponseDto = {
|
|
919
|
+
id: string;
|
|
920
|
+
region_id: number;
|
|
921
|
+
is_flyable: boolean;
|
|
922
|
+
created_at: Date;
|
|
923
|
+
updated_at: Date;
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
export type UpdateZoneDto = {
|
|
927
|
+
is_flyable: boolean;
|
|
928
|
+
};
|
|
929
|
+
|
|
930
|
+
export type SyncEventProcessorMissionsRequestDto = {
|
|
931
|
+
missionIds: Array<string>;
|
|
932
|
+
missionDataContractAddress: string;
|
|
933
|
+
missionEscrowContractAddress: string;
|
|
934
|
+
};
|
|
935
|
+
|
|
936
|
+
export type SyncEventProcessorMissionsResponseDto = {
|
|
937
|
+
succeeded: Array<string>;
|
|
938
|
+
failed: Array<{
|
|
939
|
+
missionId: string;
|
|
940
|
+
error: string;
|
|
941
|
+
}>;
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
export type SyncEventProcessorFlightReviewsRequestDto = {
|
|
945
|
+
flightIds: Array<string>;
|
|
946
|
+
flightReviewContractAddress: string;
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
export type SyncEventProcessorFlightReviewsResponseDto = {
|
|
950
|
+
succeeded: Array<string>;
|
|
951
|
+
failed: Array<{
|
|
952
|
+
flightId: string;
|
|
953
|
+
error: string;
|
|
954
|
+
}>;
|
|
955
|
+
};
|
|
956
|
+
|
|
758
957
|
export type AlchemyWebhookBodyDto = {
|
|
759
958
|
[key: string]: unknown;
|
|
760
959
|
};
|
|
@@ -1323,6 +1522,53 @@ export type FlightPlansControllerGetResponses = {
|
|
|
1323
1522
|
export type FlightPlansControllerGetResponse =
|
|
1324
1523
|
FlightPlansControllerGetResponses[keyof FlightPlansControllerGetResponses];
|
|
1325
1524
|
|
|
1525
|
+
export type FlightReviewsControllerGetFlightReviewData = {
|
|
1526
|
+
body?: never;
|
|
1527
|
+
path: {
|
|
1528
|
+
id: bigint;
|
|
1529
|
+
};
|
|
1530
|
+
query?: never;
|
|
1531
|
+
url: "/flight-reviews/{id}";
|
|
1532
|
+
};
|
|
1533
|
+
|
|
1534
|
+
export type FlightReviewsControllerGetFlightReviewErrors = {
|
|
1535
|
+
401: unknown;
|
|
1536
|
+
403: unknown;
|
|
1537
|
+
/**
|
|
1538
|
+
* Flight review not found
|
|
1539
|
+
*/
|
|
1540
|
+
404: unknown;
|
|
1541
|
+
};
|
|
1542
|
+
|
|
1543
|
+
export type FlightReviewsControllerGetFlightReviewResponses = {
|
|
1544
|
+
200: GetFlightReviewResponseDto;
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
export type FlightReviewsControllerGetFlightReviewResponse =
|
|
1548
|
+
FlightReviewsControllerGetFlightReviewResponses[keyof FlightReviewsControllerGetFlightReviewResponses];
|
|
1549
|
+
|
|
1550
|
+
export type FlightReviewsControllerGetFlightReviewsData = {
|
|
1551
|
+
body?: never;
|
|
1552
|
+
path?: never;
|
|
1553
|
+
query: {
|
|
1554
|
+
updated_at_gt: Date;
|
|
1555
|
+
updated_at_lt: Date;
|
|
1556
|
+
};
|
|
1557
|
+
url: "/flight-reviews";
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
export type FlightReviewsControllerGetFlightReviewsErrors = {
|
|
1561
|
+
401: unknown;
|
|
1562
|
+
403: unknown;
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
export type FlightReviewsControllerGetFlightReviewsResponses = {
|
|
1566
|
+
200: GetFlightReviewsResponseDto;
|
|
1567
|
+
};
|
|
1568
|
+
|
|
1569
|
+
export type FlightReviewsControllerGetFlightReviewsResponse =
|
|
1570
|
+
FlightReviewsControllerGetFlightReviewsResponses[keyof FlightReviewsControllerGetFlightReviewsResponses];
|
|
1571
|
+
|
|
1326
1572
|
export type KeysControllerGetProvenanceCryptoKeyData = {
|
|
1327
1573
|
body?: never;
|
|
1328
1574
|
path?: never;
|
|
@@ -1337,6 +1583,70 @@ export type KeysControllerGetProvenanceCryptoKeyResponses = {
|
|
|
1337
1583
|
export type KeysControllerGetProvenanceCryptoKeyResponse =
|
|
1338
1584
|
KeysControllerGetProvenanceCryptoKeyResponses[keyof KeysControllerGetProvenanceCryptoKeyResponses];
|
|
1339
1585
|
|
|
1586
|
+
export type MissionsControllerGetMissionData = {
|
|
1587
|
+
body?: never;
|
|
1588
|
+
path: {
|
|
1589
|
+
id: string;
|
|
1590
|
+
};
|
|
1591
|
+
query?: {
|
|
1592
|
+
relations?:
|
|
1593
|
+
| "vault"
|
|
1594
|
+
| "payout"
|
|
1595
|
+
| "campaigns"
|
|
1596
|
+
| Array<"vault" | "payout" | "campaigns">;
|
|
1597
|
+
};
|
|
1598
|
+
url: "/missions/{id}";
|
|
1599
|
+
};
|
|
1600
|
+
|
|
1601
|
+
export type MissionsControllerGetMissionErrors = {
|
|
1602
|
+
401: unknown;
|
|
1603
|
+
403: unknown;
|
|
1604
|
+
/**
|
|
1605
|
+
* Mission not found
|
|
1606
|
+
*/
|
|
1607
|
+
404: unknown;
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
export type MissionsControllerGetMissionResponses = {
|
|
1611
|
+
200: GetMissionResponseDto;
|
|
1612
|
+
};
|
|
1613
|
+
|
|
1614
|
+
export type MissionsControllerGetMissionResponse =
|
|
1615
|
+
MissionsControllerGetMissionResponses[keyof MissionsControllerGetMissionResponses];
|
|
1616
|
+
|
|
1617
|
+
export type MissionsControllerGetMissionsData = {
|
|
1618
|
+
body?: never;
|
|
1619
|
+
path?: never;
|
|
1620
|
+
query?: {
|
|
1621
|
+
updatedAt_gt?: Date;
|
|
1622
|
+
updatedAt_lt?: Date;
|
|
1623
|
+
createdAt_gt?: Date;
|
|
1624
|
+
createdAt_lt?: Date;
|
|
1625
|
+
isOpen?: string;
|
|
1626
|
+
zoneIds?: string | Array<string>;
|
|
1627
|
+
flightPlanId?: number;
|
|
1628
|
+
page?: number;
|
|
1629
|
+
relations?:
|
|
1630
|
+
| "vault"
|
|
1631
|
+
| "payout"
|
|
1632
|
+
| "campaigns"
|
|
1633
|
+
| Array<"vault" | "payout" | "campaigns">;
|
|
1634
|
+
};
|
|
1635
|
+
url: "/missions";
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
export type MissionsControllerGetMissionsErrors = {
|
|
1639
|
+
401: unknown;
|
|
1640
|
+
403: unknown;
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1643
|
+
export type MissionsControllerGetMissionsResponses = {
|
|
1644
|
+
200: GetMissionsResponseDto;
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1647
|
+
export type MissionsControllerGetMissionsResponse =
|
|
1648
|
+
MissionsControllerGetMissionsResponses[keyof MissionsControllerGetMissionsResponses];
|
|
1649
|
+
|
|
1340
1650
|
export type MissionsControllerCreateMissionsData = {
|
|
1341
1651
|
body: CreateMissionRequestDto;
|
|
1342
1652
|
path?: never;
|
|
@@ -1494,20 +1804,6 @@ export type SchemaControllerGetEventSchemaResponses = {
|
|
|
1494
1804
|
200: unknown;
|
|
1495
1805
|
};
|
|
1496
1806
|
|
|
1497
|
-
export type SchemaControllerGetFlightPlanSchemaData = {
|
|
1498
|
-
body?: never;
|
|
1499
|
-
path?: never;
|
|
1500
|
-
query?: never;
|
|
1501
|
-
url: "/schema/flight-plan";
|
|
1502
|
-
};
|
|
1503
|
-
|
|
1504
|
-
export type SchemaControllerGetFlightPlanSchemaResponses = {
|
|
1505
|
-
/**
|
|
1506
|
-
* Get flight plan schema
|
|
1507
|
-
*/
|
|
1508
|
-
200: unknown;
|
|
1509
|
-
};
|
|
1510
|
-
|
|
1511
1807
|
export type VaultsControllerCreateVaultsData = {
|
|
1512
1808
|
body: CreateVaultsRequestDto;
|
|
1513
1809
|
path?: never;
|
|
@@ -1647,7 +1943,7 @@ export type WebhooksControllerUpdateResponse =
|
|
|
1647
1943
|
WebhooksControllerUpdateResponses[keyof WebhooksControllerUpdateResponses];
|
|
1648
1944
|
|
|
1649
1945
|
export type WebhooksControllerRegenerateSecretData = {
|
|
1650
|
-
body
|
|
1946
|
+
body: RegenerateWebhookSecretBody;
|
|
1651
1947
|
path: {
|
|
1652
1948
|
org_id: number;
|
|
1653
1949
|
id: number;
|
|
@@ -1712,6 +2008,132 @@ export type WebhooksControllerGetStatusResponses = {
|
|
|
1712
2008
|
export type WebhooksControllerGetStatusResponse =
|
|
1713
2009
|
WebhooksControllerGetStatusResponses[keyof WebhooksControllerGetStatusResponses];
|
|
1714
2010
|
|
|
2011
|
+
export type ZonesControllerCreateZoneData = {
|
|
2012
|
+
body: CreateZoneDto;
|
|
2013
|
+
path?: never;
|
|
2014
|
+
query?: never;
|
|
2015
|
+
url: "/zones";
|
|
2016
|
+
};
|
|
2017
|
+
|
|
2018
|
+
export type ZonesControllerCreateZoneErrors = {
|
|
2019
|
+
/**
|
|
2020
|
+
* Invalid zone id (must be a valid level-9 H3 cell)
|
|
2021
|
+
*/
|
|
2022
|
+
400: unknown;
|
|
2023
|
+
401: unknown;
|
|
2024
|
+
403: unknown;
|
|
2025
|
+
/**
|
|
2026
|
+
* Zone already exists
|
|
2027
|
+
*/
|
|
2028
|
+
409: unknown;
|
|
2029
|
+
};
|
|
2030
|
+
|
|
2031
|
+
export type ZonesControllerCreateZoneResponses = {
|
|
2032
|
+
201: ZoneResponseDto;
|
|
2033
|
+
};
|
|
2034
|
+
|
|
2035
|
+
export type ZonesControllerCreateZoneResponse =
|
|
2036
|
+
ZonesControllerCreateZoneResponses[keyof ZonesControllerCreateZoneResponses];
|
|
2037
|
+
|
|
2038
|
+
export type ZonesControllerDeleteZoneData = {
|
|
2039
|
+
body?: never;
|
|
2040
|
+
path: {
|
|
2041
|
+
id: string;
|
|
2042
|
+
};
|
|
2043
|
+
query?: never;
|
|
2044
|
+
url: "/zones/{id}";
|
|
2045
|
+
};
|
|
2046
|
+
|
|
2047
|
+
export type ZonesControllerDeleteZoneErrors = {
|
|
2048
|
+
401: unknown;
|
|
2049
|
+
403: unknown;
|
|
2050
|
+
/**
|
|
2051
|
+
* Zone not found
|
|
2052
|
+
*/
|
|
2053
|
+
404: unknown;
|
|
2054
|
+
};
|
|
2055
|
+
|
|
2056
|
+
export type ZonesControllerDeleteZoneResponses = {
|
|
2057
|
+
/**
|
|
2058
|
+
* Zone deleted
|
|
2059
|
+
*/
|
|
2060
|
+
204: void;
|
|
2061
|
+
};
|
|
2062
|
+
|
|
2063
|
+
export type ZonesControllerDeleteZoneResponse =
|
|
2064
|
+
ZonesControllerDeleteZoneResponses[keyof ZonesControllerDeleteZoneResponses];
|
|
2065
|
+
|
|
2066
|
+
export type ZonesControllerUpdateZoneData = {
|
|
2067
|
+
body: UpdateZoneDto;
|
|
2068
|
+
path: {
|
|
2069
|
+
id: string;
|
|
2070
|
+
};
|
|
2071
|
+
query?: never;
|
|
2072
|
+
url: "/zones/{id}";
|
|
2073
|
+
};
|
|
2074
|
+
|
|
2075
|
+
export type ZonesControllerUpdateZoneErrors = {
|
|
2076
|
+
401: unknown;
|
|
2077
|
+
403: unknown;
|
|
2078
|
+
/**
|
|
2079
|
+
* Zone not found
|
|
2080
|
+
*/
|
|
2081
|
+
404: unknown;
|
|
2082
|
+
};
|
|
2083
|
+
|
|
2084
|
+
export type ZonesControllerUpdateZoneResponses = {
|
|
2085
|
+
200: ZoneResponseDto;
|
|
2086
|
+
};
|
|
2087
|
+
|
|
2088
|
+
export type ZonesControllerUpdateZoneResponse =
|
|
2089
|
+
ZonesControllerUpdateZoneResponses[keyof ZonesControllerUpdateZoneResponses];
|
|
2090
|
+
|
|
2091
|
+
export type EventProcessorMissionsSyncControllerResyncMissionsData = {
|
|
2092
|
+
body: SyncEventProcessorMissionsRequestDto;
|
|
2093
|
+
path?: never;
|
|
2094
|
+
query?: never;
|
|
2095
|
+
url: "/event-processor/missions/sync";
|
|
2096
|
+
};
|
|
2097
|
+
|
|
2098
|
+
export type EventProcessorMissionsSyncControllerResyncMissionsErrors = {
|
|
2099
|
+
401: unknown;
|
|
2100
|
+
403: unknown;
|
|
2101
|
+
};
|
|
2102
|
+
|
|
2103
|
+
export type EventProcessorMissionsSyncControllerResyncMissionsResponses = {
|
|
2104
|
+
/**
|
|
2105
|
+
* Per-mission success or failure.
|
|
2106
|
+
*/
|
|
2107
|
+
200: SyncEventProcessorMissionsResponseDto;
|
|
2108
|
+
};
|
|
2109
|
+
|
|
2110
|
+
export type EventProcessorMissionsSyncControllerResyncMissionsResponse =
|
|
2111
|
+
EventProcessorMissionsSyncControllerResyncMissionsResponses[keyof EventProcessorMissionsSyncControllerResyncMissionsResponses];
|
|
2112
|
+
|
|
2113
|
+
export type EventProcessorFlightReviewsSyncControllerResyncFlightReviewsData = {
|
|
2114
|
+
body: SyncEventProcessorFlightReviewsRequestDto;
|
|
2115
|
+
path?: never;
|
|
2116
|
+
query?: never;
|
|
2117
|
+
url: "/event-processor/flightreviews";
|
|
2118
|
+
};
|
|
2119
|
+
|
|
2120
|
+
export type EventProcessorFlightReviewsSyncControllerResyncFlightReviewsErrors =
|
|
2121
|
+
{
|
|
2122
|
+
401: unknown;
|
|
2123
|
+
403: unknown;
|
|
2124
|
+
};
|
|
2125
|
+
|
|
2126
|
+
export type EventProcessorFlightReviewsSyncControllerResyncFlightReviewsResponses =
|
|
2127
|
+
{
|
|
2128
|
+
/**
|
|
2129
|
+
* Per-flight success or failure.
|
|
2130
|
+
*/
|
|
2131
|
+
200: SyncEventProcessorFlightReviewsResponseDto;
|
|
2132
|
+
};
|
|
2133
|
+
|
|
2134
|
+
export type EventProcessorFlightReviewsSyncControllerResyncFlightReviewsResponse =
|
|
2135
|
+
EventProcessorFlightReviewsSyncControllerResyncFlightReviewsResponses[keyof EventProcessorFlightReviewsSyncControllerResyncFlightReviewsResponses];
|
|
2136
|
+
|
|
1715
2137
|
export type AlchemyControllerHandleWebhookData = {
|
|
1716
2138
|
body: AlchemyWebhookBodyDto;
|
|
1717
2139
|
path?: never;
|
package/src/event/parser.ts
CHANGED
|
@@ -2,28 +2,80 @@ import type { Request } from "express";
|
|
|
2
2
|
|
|
3
3
|
import { Event } from "./types.gen";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/** Primary signing secret for this delivery (current secret). */
|
|
6
|
+
export const WEBHOOK_SECRET_HEADER = "X-Webhook-Secret";
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* During rotation, the prior secret value still valid for receivers who have not
|
|
10
|
+
* updated their stored secret yet (must be sent together with the expiry header).
|
|
11
|
+
*/
|
|
12
|
+
export const WEBHOOK_PREVIOUS_SECRET_HEADER = "X-Webhook-Previous-Secret";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* ISO-8601 instant; after this time the previous secret must no longer be accepted.
|
|
16
|
+
*/
|
|
17
|
+
export const WEBHOOK_PREVIOUS_SECRET_EXPIRES_AT_HEADER =
|
|
18
|
+
"X-Webhook-Previous-Secret-Expires-At";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Verify an inbound webhook using the signing secret your app has configured.
|
|
22
|
+
*
|
|
23
|
+
* Compares `X-Webhook-Secret` to `webhookSecret`. If that fails, checks optional
|
|
24
|
+
* rotation headers from LayerDrone: when both `X-Webhook-Previous-Secret` and
|
|
25
|
+
* `X-Webhook-Previous-Secret-Expires-At` are present, the request is accepted if
|
|
26
|
+
* your configured secret still matches the announced previous secret (same value
|
|
27
|
+
* as in `X-Webhook-Previous-Secret`) and the expiry has not passed.
|
|
28
|
+
*/
|
|
7
29
|
export function parseWebhookEvent(req: Request, webhookSecret: string) {
|
|
8
|
-
const
|
|
9
|
-
if (typeof
|
|
30
|
+
const incoming = getFirstHeader(req.headers, WEBHOOK_SECRET_HEADER);
|
|
31
|
+
if (typeof incoming !== "string") {
|
|
10
32
|
throw new Error("Webhook request signature is not a string");
|
|
11
33
|
}
|
|
12
34
|
if (!Buffer.isBuffer(req.body)) {
|
|
13
35
|
throw new Error("Webhook request body is not a Buffer");
|
|
14
36
|
}
|
|
15
|
-
|
|
37
|
+
|
|
38
|
+
if (incoming === webhookSecret) {
|
|
39
|
+
return Event.parse(JSON.parse(req.body.toString("utf-8")));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const announcedPrevious = getFirstHeader(
|
|
43
|
+
req.headers,
|
|
44
|
+
WEBHOOK_PREVIOUS_SECRET_HEADER,
|
|
45
|
+
);
|
|
46
|
+
const expiresRaw = getFirstHeader(
|
|
47
|
+
req.headers,
|
|
48
|
+
WEBHOOK_PREVIOUS_SECRET_EXPIRES_AT_HEADER,
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
if (announcedPrevious === undefined || expiresRaw === undefined) {
|
|
16
52
|
throw new Error("Invalid webhook secret");
|
|
17
53
|
}
|
|
18
|
-
|
|
54
|
+
|
|
55
|
+
const expiresAt = new Date(expiresRaw);
|
|
56
|
+
if (Number.isNaN(expiresAt.getTime())) {
|
|
57
|
+
throw new Error("Invalid webhook secret");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (Date.now() >= expiresAt.getTime()) {
|
|
61
|
+
throw new Error("Invalid webhook secret");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (webhookSecret === announcedPrevious) {
|
|
65
|
+
return Event.parse(JSON.parse(req.body.toString("utf-8")));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
throw new Error("Invalid webhook secret");
|
|
19
69
|
}
|
|
20
70
|
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
71
|
+
function getFirstHeader(
|
|
72
|
+
headers: Request["headers"],
|
|
73
|
+
canonicalName: string,
|
|
74
|
+
): string | undefined {
|
|
75
|
+
const lower = canonicalName.toLowerCase();
|
|
76
|
+
let value = headers[canonicalName] ?? headers[lower];
|
|
25
77
|
if (Array.isArray(value)) {
|
|
26
78
|
value = value[0];
|
|
27
79
|
}
|
|
28
|
-
return value;
|
|
80
|
+
return typeof value === "string" ? value : undefined;
|
|
29
81
|
}
|