@layer-drone/protocol 2.2.0 → 2.3.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@layer-drone/protocol",
3
3
  "description": "Layer Drone protocol SDK with typed API client and event parsing",
4
- "version": "2.2.0",
4
+ "version": "2.3.0",
5
5
  "license": "MIT",
6
6
  "files": [
7
7
  "dist",
@@ -23,6 +23,7 @@
23
23
  "@types/node": "^20.3.1",
24
24
  "csv-parse": "^6.1.0",
25
25
  "express": "^4.17.7",
26
+ "h3-js": "^4.2.1",
26
27
  "jest": "^29.7.0",
27
28
  "json-refs": "^3.0.15",
28
29
  "json-schema-to-zod": "^2.6.1",
@@ -34,8 +35,8 @@
34
35
  "zod": "^3.24.2",
35
36
  "zod-to-json-schema": "^3.24.5",
36
37
  "@layer-drone/eslint-config": "0.0.0",
37
- "@layer-drone/event-schema": "0.0.0",
38
- "@layer-drone/typescript-config": "0.0.0"
38
+ "@layer-drone/typescript-config": "0.0.0",
39
+ "@layer-drone/event-schema": "0.0.0"
39
40
  },
40
41
  "peerDependencies": {
41
42
  "zod": "^3.x.x"
@@ -62,6 +62,10 @@ import {
62
62
  missionsControllerGetMissionsV2V2ResponseTransformer,
63
63
  missionsControllerRetryMissionV2V2ResponseTransformer,
64
64
  missionsControllerUpdateMissionV2V2ResponseTransformer,
65
+ reservationsControllerCancelReservationV2V2ResponseTransformer,
66
+ reservationsControllerCreateReservationV2V2ResponseTransformer,
67
+ reservationsControllerGetReservationV2V2ResponseTransformer,
68
+ reservationsControllerGetReservationsV2V2ResponseTransformer,
65
69
  rewardsControllerListRewardsV2V2ResponseTransformer,
66
70
  webhooksControllerGet0V1ResponseTransformer,
67
71
  webhooksControllerGet1ResponseTransformer,
@@ -150,6 +154,9 @@ import type {
150
154
  CampaignsControllerGetCampaignV2V2Data,
151
155
  CampaignsControllerGetCampaignV2V2Errors,
152
156
  CampaignsControllerGetCampaignV2V2Responses,
157
+ CampaignsControllerGetCampaignZonesV2V2Data,
158
+ CampaignsControllerGetCampaignZonesV2V2Errors,
159
+ CampaignsControllerGetCampaignZonesV2V2Responses,
153
160
  CampaignsControllerGetCampaignsV2V2Data,
154
161
  CampaignsControllerGetCampaignsV2V2Errors,
155
162
  CampaignsControllerGetCampaignsV2V2Responses,
@@ -407,6 +414,9 @@ import type {
407
414
  MissionsControllerUpdateMissions1Data,
408
415
  MissionsControllerUpdateMissions1Errors,
409
416
  MissionsControllerUpdateMissions1Responses,
417
+ PilotsControllerGetPilotReputationV2V2Data,
418
+ PilotsControllerGetPilotReputationV2V2Errors,
419
+ PilotsControllerGetPilotReputationV2V2Responses,
410
420
  ProtocolTriggersApiControllerTriggerMissionClose0V1Data,
411
421
  ProtocolTriggersApiControllerTriggerMissionClose0V1Errors,
412
422
  ProtocolTriggersApiControllerTriggerMissionClose0V1Responses,
@@ -431,6 +441,18 @@ import type {
431
441
  QuotesControllerGetQuote1Data,
432
442
  QuotesControllerGetQuote1Errors,
433
443
  QuotesControllerGetQuote1Responses,
444
+ ReservationsControllerCancelReservationV2V2Data,
445
+ ReservationsControllerCancelReservationV2V2Errors,
446
+ ReservationsControllerCancelReservationV2V2Responses,
447
+ ReservationsControllerCreateReservationV2V2Data,
448
+ ReservationsControllerCreateReservationV2V2Errors,
449
+ ReservationsControllerCreateReservationV2V2Responses,
450
+ ReservationsControllerGetReservationV2V2Data,
451
+ ReservationsControllerGetReservationV2V2Errors,
452
+ ReservationsControllerGetReservationV2V2Responses,
453
+ ReservationsControllerGetReservationsV2V2Data,
454
+ ReservationsControllerGetReservationsV2V2Errors,
455
+ ReservationsControllerGetReservationsV2V2Responses,
434
456
  ReviewProposalData,
435
457
  ReviewProposalErrors,
436
458
  ReviewProposalResponses,
@@ -3757,6 +3779,10 @@ export const campaignsControllerGetCampaignsV2V2 = <
3757
3779
  name: "x-api-token",
3758
3780
  type: "apiKey",
3759
3781
  },
3782
+ {
3783
+ name: "x-api-token",
3784
+ type: "apiKey",
3785
+ },
3760
3786
  ],
3761
3787
  responseTransformer: campaignsControllerGetCampaignsV2V2ResponseTransformer,
3762
3788
  url: "/v2/campaigns",
@@ -3814,6 +3840,10 @@ export const campaignsControllerGetCampaignV2V2 = <
3814
3840
  name: "x-api-token",
3815
3841
  type: "apiKey",
3816
3842
  },
3843
+ {
3844
+ name: "x-api-token",
3845
+ type: "apiKey",
3846
+ },
3817
3847
  ],
3818
3848
  responseTransformer: campaignsControllerGetCampaignV2V2ResponseTransformer,
3819
3849
  url: "/v2/campaigns/{id}",
@@ -3877,6 +3907,35 @@ export const campaignsControllerCancelCampaignV2V2 = <
3877
3907
  });
3878
3908
  };
3879
3909
 
3910
+ /**
3911
+ * List campaign zones (mission-fulfillment)
3912
+ * Returns Zones linked to a campaign from mission-fulfillment.
3913
+ */
3914
+ export const campaignsControllerGetCampaignZonesV2V2 = <
3915
+ ThrowOnError extends boolean = true,
3916
+ >(
3917
+ options: Options<CampaignsControllerGetCampaignZonesV2V2Data, ThrowOnError>,
3918
+ ) => {
3919
+ return (options.client ?? _heyApiClient).get<
3920
+ CampaignsControllerGetCampaignZonesV2V2Responses,
3921
+ CampaignsControllerGetCampaignZonesV2V2Errors,
3922
+ ThrowOnError
3923
+ >({
3924
+ security: [
3925
+ {
3926
+ name: "x-api-token",
3927
+ type: "apiKey",
3928
+ },
3929
+ {
3930
+ name: "x-api-token",
3931
+ type: "apiKey",
3932
+ },
3933
+ ],
3934
+ url: "/v2/campaigns/{id}/zones",
3935
+ ...options,
3936
+ });
3937
+ };
3938
+
3880
3939
  /**
3881
3940
  * Get all flight plans (mission-fulfillment)
3882
3941
  * Returns flight plans from mission-fulfillment.
@@ -4305,6 +4364,10 @@ export const missionsControllerGetMissionsV2V2 = <
4305
4364
  name: "x-api-token",
4306
4365
  type: "apiKey",
4307
4366
  },
4367
+ {
4368
+ name: "x-api-token",
4369
+ type: "apiKey",
4370
+ },
4308
4371
  ],
4309
4372
  responseTransformer: missionsControllerGetMissionsV2V2ResponseTransformer,
4310
4373
  url: "/v2/missions",
@@ -4362,6 +4425,10 @@ export const missionsControllerGetMissionV2V2 = <
4362
4425
  name: "x-api-token",
4363
4426
  type: "apiKey",
4364
4427
  },
4428
+ {
4429
+ name: "x-api-token",
4430
+ type: "apiKey",
4431
+ },
4365
4432
  ],
4366
4433
  responseTransformer: missionsControllerGetMissionV2V2ResponseTransformer,
4367
4434
  url: "/v2/missions/{id}",
@@ -4451,6 +4518,164 @@ export const missionsControllerRetryMissionV2V2 = <
4451
4518
  });
4452
4519
  };
4453
4520
 
4521
+ /**
4522
+ * Get a pilot's reputation (mission-fulfillment)
4523
+ * Returns the pilot's Reputation Points and rating from mission-fulfillment.
4524
+ */
4525
+ export const pilotsControllerGetPilotReputationV2V2 = <
4526
+ ThrowOnError extends boolean = true,
4527
+ >(
4528
+ options: Options<PilotsControllerGetPilotReputationV2V2Data, ThrowOnError>,
4529
+ ) => {
4530
+ return (options.client ?? _heyApiClient).get<
4531
+ PilotsControllerGetPilotReputationV2V2Responses,
4532
+ PilotsControllerGetPilotReputationV2V2Errors,
4533
+ ThrowOnError
4534
+ >({
4535
+ security: [
4536
+ {
4537
+ name: "x-api-token",
4538
+ type: "apiKey",
4539
+ },
4540
+ ],
4541
+ url: "/v2/pilots/{address}/reputation",
4542
+ ...options,
4543
+ });
4544
+ };
4545
+
4546
+ /**
4547
+ * List reservations (mission-fulfillment)
4548
+ * Returns reservations from mission-fulfillment.
4549
+ */
4550
+ export const reservationsControllerGetReservationsV2V2 = <
4551
+ ThrowOnError extends boolean = true,
4552
+ >(
4553
+ options?: Options<
4554
+ ReservationsControllerGetReservationsV2V2Data,
4555
+ ThrowOnError
4556
+ >,
4557
+ ) => {
4558
+ return (options?.client ?? _heyApiClient).get<
4559
+ ReservationsControllerGetReservationsV2V2Responses,
4560
+ ReservationsControllerGetReservationsV2V2Errors,
4561
+ ThrowOnError
4562
+ >({
4563
+ security: [
4564
+ {
4565
+ name: "x-api-token",
4566
+ type: "apiKey",
4567
+ },
4568
+ {
4569
+ name: "x-api-token",
4570
+ type: "apiKey",
4571
+ },
4572
+ ],
4573
+ responseTransformer:
4574
+ reservationsControllerGetReservationsV2V2ResponseTransformer,
4575
+ url: "/v2/reservations",
4576
+ ...options,
4577
+ });
4578
+ };
4579
+
4580
+ /**
4581
+ * Reserve a mission (mission-fulfillment)
4582
+ * Creates a reservation in mission-fulfillment.
4583
+ */
4584
+ export const reservationsControllerCreateReservationV2V2 = <
4585
+ ThrowOnError extends boolean = true,
4586
+ >(
4587
+ options: Options<
4588
+ ReservationsControllerCreateReservationV2V2Data,
4589
+ ThrowOnError
4590
+ >,
4591
+ ) => {
4592
+ return (options.client ?? _heyApiClient).post<
4593
+ ReservationsControllerCreateReservationV2V2Responses,
4594
+ ReservationsControllerCreateReservationV2V2Errors,
4595
+ ThrowOnError
4596
+ >({
4597
+ security: [
4598
+ {
4599
+ name: "x-api-token",
4600
+ type: "apiKey",
4601
+ },
4602
+ ],
4603
+ responseTransformer:
4604
+ reservationsControllerCreateReservationV2V2ResponseTransformer,
4605
+ url: "/v2/reservations",
4606
+ ...options,
4607
+ headers: {
4608
+ "Content-Type": "application/json",
4609
+ ...options.headers,
4610
+ },
4611
+ });
4612
+ };
4613
+
4614
+ /**
4615
+ * Get a reservation by id (mission-fulfillment)
4616
+ * Returns a reservation from mission-fulfillment.
4617
+ */
4618
+ export const reservationsControllerGetReservationV2V2 = <
4619
+ ThrowOnError extends boolean = true,
4620
+ >(
4621
+ options: Options<ReservationsControllerGetReservationV2V2Data, ThrowOnError>,
4622
+ ) => {
4623
+ return (options.client ?? _heyApiClient).get<
4624
+ ReservationsControllerGetReservationV2V2Responses,
4625
+ ReservationsControllerGetReservationV2V2Errors,
4626
+ ThrowOnError
4627
+ >({
4628
+ security: [
4629
+ {
4630
+ name: "x-api-token",
4631
+ type: "apiKey",
4632
+ },
4633
+ {
4634
+ name: "x-api-token",
4635
+ type: "apiKey",
4636
+ },
4637
+ ],
4638
+ responseTransformer:
4639
+ reservationsControllerGetReservationV2V2ResponseTransformer,
4640
+ url: "/v2/reservations/{id}",
4641
+ ...options,
4642
+ });
4643
+ };
4644
+
4645
+ /**
4646
+ * Cancel a reservation (mission-fulfillment)
4647
+ * Cancels a reservation in mission-fulfillment.
4648
+ */
4649
+ export const reservationsControllerCancelReservationV2V2 = <
4650
+ ThrowOnError extends boolean = true,
4651
+ >(
4652
+ options: Options<
4653
+ ReservationsControllerCancelReservationV2V2Data,
4654
+ ThrowOnError
4655
+ >,
4656
+ ) => {
4657
+ return (options.client ?? _heyApiClient).post<
4658
+ ReservationsControllerCancelReservationV2V2Responses,
4659
+ ReservationsControllerCancelReservationV2V2Errors,
4660
+ ThrowOnError
4661
+ >({
4662
+ security: [
4663
+ {
4664
+ name: "x-api-token",
4665
+ type: "apiKey",
4666
+ },
4667
+ ],
4668
+ responseTransformer:
4669
+ reservationsControllerCancelReservationV2V2ResponseTransformer,
4670
+ url: "/v2/reservations/{id}/cancel",
4671
+ ...options,
4672
+ headers: {
4673
+ "Content-Type": "application/json",
4674
+ ...options.headers,
4675
+ },
4676
+ });
4677
+ };
4678
+
4454
4679
  /**
4455
4680
  * List rewards (mission-fulfillment)
4456
4681
  * Returns rewards from mission-fulfillment.
@@ -4523,6 +4748,10 @@ export const zonesControllerGetZoneV2V2 = <ThrowOnError extends boolean = true>(
4523
4748
  name: "x-api-token",
4524
4749
  type: "apiKey",
4525
4750
  },
4751
+ {
4752
+ name: "x-api-token",
4753
+ type: "apiKey",
4754
+ },
4526
4755
  ],
4527
4756
  responseTransformer: zonesControllerGetZoneV2V2ResponseTransformer,
4528
4757
  url: "/v2/zones/{id}",
@@ -56,6 +56,10 @@ import type {
56
56
  MissionsControllerGetMissionsV2V2Response,
57
57
  MissionsControllerRetryMissionV2V2Response,
58
58
  MissionsControllerUpdateMissionV2V2Response,
59
+ ReservationsControllerCancelReservationV2V2Response,
60
+ ReservationsControllerCreateReservationV2V2Response,
61
+ ReservationsControllerGetReservationV2V2Response,
62
+ ReservationsControllerGetReservationsV2V2Response,
59
63
  RewardsControllerListRewardsV2V2Response,
60
64
  WebhooksControllerGet0V1Response,
61
65
  WebhooksControllerGet1Response,
@@ -836,6 +840,13 @@ const listMissionsResponseSchemaResponseTransformer = (data: any) => {
836
840
  item.hold.created_at = new Date(item.hold.created_at);
837
841
  item.hold.updated_at = new Date(item.hold.updated_at);
838
842
  }
843
+ if (item.reservation) {
844
+ if (item.reservation.ended_at) {
845
+ item.reservation.ended_at = new Date(item.reservation.ended_at);
846
+ }
847
+ item.reservation.created_at = new Date(item.reservation.created_at);
848
+ item.reservation.updated_at = new Date(item.reservation.updated_at);
849
+ }
839
850
  if (item.closed_at) {
840
851
  item.closed_at = new Date(item.closed_at);
841
852
  }
@@ -877,6 +888,19 @@ const createMissionsResponseSchemaResponseTransformer = (data: any) => {
877
888
  item.mission.hold.created_at = new Date(item.mission.hold.created_at);
878
889
  item.mission.hold.updated_at = new Date(item.mission.hold.updated_at);
879
890
  }
891
+ if (item.mission.reservation) {
892
+ if (item.mission.reservation.ended_at) {
893
+ item.mission.reservation.ended_at = new Date(
894
+ item.mission.reservation.ended_at,
895
+ );
896
+ }
897
+ item.mission.reservation.created_at = new Date(
898
+ item.mission.reservation.created_at,
899
+ );
900
+ item.mission.reservation.updated_at = new Date(
901
+ item.mission.reservation.updated_at,
902
+ );
903
+ }
880
904
  if (item.mission.closed_at) {
881
905
  item.mission.closed_at = new Date(item.mission.closed_at);
882
906
  }
@@ -915,6 +939,13 @@ const missionResponseSchemaResponseTransformer = (data: any) => {
915
939
  data.hold.created_at = new Date(data.hold.created_at);
916
940
  data.hold.updated_at = new Date(data.hold.updated_at);
917
941
  }
942
+ if (data.reservation) {
943
+ if (data.reservation.ended_at) {
944
+ data.reservation.ended_at = new Date(data.reservation.ended_at);
945
+ }
946
+ data.reservation.created_at = new Date(data.reservation.created_at);
947
+ data.reservation.updated_at = new Date(data.reservation.updated_at);
948
+ }
918
949
  if (data.closed_at) {
919
950
  data.closed_at = new Date(data.closed_at);
920
951
  }
@@ -951,6 +982,59 @@ export const missionsControllerRetryMissionV2V2ResponseTransformer = async (
951
982
  return data;
952
983
  };
953
984
 
985
+ const listReservationsResponseSchemaResponseTransformer = (data: any) => {
986
+ data.data = data.data.map((item: any) => {
987
+ if (item.ended_at) {
988
+ item.ended_at = new Date(item.ended_at);
989
+ }
990
+ item.created_at = new Date(item.created_at);
991
+ item.updated_at = new Date(item.updated_at);
992
+ return item;
993
+ });
994
+ return data;
995
+ };
996
+
997
+ export const reservationsControllerGetReservationsV2V2ResponseTransformer =
998
+ async (
999
+ data: any,
1000
+ ): Promise<ReservationsControllerGetReservationsV2V2Response> => {
1001
+ data = listReservationsResponseSchemaResponseTransformer(data);
1002
+ return data;
1003
+ };
1004
+
1005
+ const reservationResponseSchemaResponseTransformer = (data: any) => {
1006
+ if (data.ended_at) {
1007
+ data.ended_at = new Date(data.ended_at);
1008
+ }
1009
+ data.created_at = new Date(data.created_at);
1010
+ data.updated_at = new Date(data.updated_at);
1011
+ return data;
1012
+ };
1013
+
1014
+ export const reservationsControllerCreateReservationV2V2ResponseTransformer =
1015
+ async (
1016
+ data: any,
1017
+ ): Promise<ReservationsControllerCreateReservationV2V2Response> => {
1018
+ data = reservationResponseSchemaResponseTransformer(data);
1019
+ return data;
1020
+ };
1021
+
1022
+ export const reservationsControllerGetReservationV2V2ResponseTransformer =
1023
+ async (
1024
+ data: any,
1025
+ ): Promise<ReservationsControllerGetReservationV2V2Response> => {
1026
+ data = reservationResponseSchemaResponseTransformer(data);
1027
+ return data;
1028
+ };
1029
+
1030
+ export const reservationsControllerCancelReservationV2V2ResponseTransformer =
1031
+ async (
1032
+ data: any,
1033
+ ): Promise<ReservationsControllerCancelReservationV2V2Response> => {
1034
+ data = reservationResponseSchemaResponseTransformer(data);
1035
+ return data;
1036
+ };
1037
+
954
1038
  const listRewardsResponseSchemaResponseTransformer = (data: any) => {
955
1039
  data.data = data.data.map((item: any) => {
956
1040
  item.created_at = new Date(item.created_at);