@layer-drone/protocol 0.0.16 → 0.0.17

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.mjs CHANGED
@@ -699,6 +699,23 @@ var apiTokenControllerUpdateTokenResponseTransformer = /* @__PURE__ */ __name(as
699
699
  data = updateApiTokenResponseDtoSchemaResponseTransformer(data);
700
700
  return data;
701
701
  }, "apiTokenControllerUpdateTokenResponseTransformer");
702
+ var flightDtoSchemaResponseTransformer = /* @__PURE__ */ __name((data) => {
703
+ data.token_id = BigInt(data.token_id.toString());
704
+ data.mission_id = BigInt(data.mission_id.toString());
705
+ return data;
706
+ }, "flightDtoSchemaResponseTransformer");
707
+ var flightsControllerGetFlightResponseTransformer = /* @__PURE__ */ __name(async (data) => {
708
+ data = flightDtoSchemaResponseTransformer(data);
709
+ return data;
710
+ }, "flightsControllerGetFlightResponseTransformer");
711
+ var validateFlightResponseDtoSchemaResponseTransformer = /* @__PURE__ */ __name((data) => {
712
+ data.flightId = BigInt(data.flightId.toString());
713
+ return data;
714
+ }, "validateFlightResponseDtoSchemaResponseTransformer");
715
+ var flightsControllerValidateFlightResponseTransformer = /* @__PURE__ */ __name(async (data) => {
716
+ data = validateFlightResponseDtoSchemaResponseTransformer(data);
717
+ return data;
718
+ }, "flightsControllerValidateFlightResponseTransformer");
702
719
  var getTimeLimitsForSunAltitudeResponseSchemaResponseTransformer = /* @__PURE__ */ __name((data) => {
703
720
  data.OptimalSunAltitudePeriod.StartTime = new Date(data.OptimalSunAltitudePeriod.StartTime);
704
721
  data.OptimalSunAltitudePeriod.EndTime = new Date(data.OptimalSunAltitudePeriod.EndTime);
@@ -839,7 +856,7 @@ var missionsControllerClaimRewards = /* @__PURE__ */ __name((options) => {
839
856
  }
840
857
  });
841
858
  }, "missionsControllerClaimRewards");
842
- var flightsControllerGenerateFlightId = /* @__PURE__ */ __name((options) => {
859
+ var flightsControllerGenerateStorageKey = /* @__PURE__ */ __name((options) => {
843
860
  return (options.client ?? client).get({
844
861
  security: [
845
862
  {
@@ -847,10 +864,10 @@ var flightsControllerGenerateFlightId = /* @__PURE__ */ __name((options) => {
847
864
  type: "apiKey"
848
865
  }
849
866
  ],
850
- url: "/flights/id",
867
+ url: "/flights/storage-key",
851
868
  ...options
852
869
  });
853
- }, "flightsControllerGenerateFlightId");
870
+ }, "flightsControllerGenerateStorageKey");
854
871
  var flightsControllerGetFlight = /* @__PURE__ */ __name((options) => {
855
872
  return (options.client ?? client).get({
856
873
  security: [
@@ -859,6 +876,7 @@ var flightsControllerGetFlight = /* @__PURE__ */ __name((options) => {
859
876
  type: "apiKey"
860
877
  }
861
878
  ],
879
+ responseTransformer: flightsControllerGetFlightResponseTransformer,
862
880
  url: "/flights/{flightId}",
863
881
  ...options
864
882
  });
@@ -871,7 +889,7 @@ var flightsControllerCreatePresignedUrls = /* @__PURE__ */ __name((options) => {
871
889
  type: "apiKey"
872
890
  }
873
891
  ],
874
- url: "/flights/{flightId}/files",
892
+ url: "/flights/files",
875
893
  ...options,
876
894
  headers: {
877
895
  "Content-Type": "application/json",
@@ -887,6 +905,7 @@ var flightsControllerValidateFlight = /* @__PURE__ */ __name((options) => {
887
905
  type: "apiKey"
888
906
  }
889
907
  ],
908
+ responseTransformer: flightsControllerValidateFlightResponseTransformer,
890
909
  url: "/flights",
891
910
  ...options,
892
911
  headers: {
@@ -1029,10 +1048,13 @@ var Event = z.union([
1029
1048
  event_type: z.literal("protocol.flight.submitted"),
1030
1049
  timestamp: z.any(),
1031
1050
  data: z.object({
1032
- flightId: z.number(),
1051
+ storageKey: z.string(),
1033
1052
  pilotAddress: z.string(),
1034
1053
  flightManifestUri: z.string(),
1035
- missionId: z.number()
1054
+ missionId: z.object({
1055
+ __type: z.literal("bigint"),
1056
+ value: z.string()
1057
+ }).transform((wire) => BigInt(wire.value))
1036
1058
  }).strict()
1037
1059
  }).strict(),
1038
1060
  z.object({
@@ -1085,11 +1107,42 @@ var Event = z.union([
1085
1107
  event_type: z.literal("protocol.flight.reviewed"),
1086
1108
  timestamp: z.any(),
1087
1109
  data: z.object({
1088
- flightId: z.number(),
1110
+ flightId: z.object({
1111
+ __type: z.literal("bigint"),
1112
+ value: z.string()
1113
+ }).transform((wire) => BigInt(wire.value)),
1089
1114
  isApproved: z.boolean(),
1090
1115
  validationLogUri: z.string(),
1091
1116
  validator: z.string(),
1092
- filesHash: z.string()
1117
+ filesHash: z.string(),
1118
+ storageKey: z.string(),
1119
+ missionId: z.object({
1120
+ __type: z.literal("bigint"),
1121
+ value: z.string()
1122
+ }).transform((wire) => BigInt(wire.value))
1123
+ }).strict()
1124
+ }).strict(),
1125
+ z.object({
1126
+ id: z.any(),
1127
+ event_type: z.literal("internal.flight.reviewed"),
1128
+ timestamp: z.any(),
1129
+ data: z.object({
1130
+ isApproved: z.boolean(),
1131
+ storageKey: z.string(),
1132
+ provenanceDataVersion: z.string(),
1133
+ validationLogUri: z.string(),
1134
+ provenanceDataUri: z.string(),
1135
+ tokenId: z.object({
1136
+ __type: z.literal("bigint"),
1137
+ value: z.string()
1138
+ }).transform((wire) => BigInt(wire.value)),
1139
+ missionId: z.object({
1140
+ __type: z.literal("bigint"),
1141
+ value: z.string()
1142
+ }).transform((wire) => BigInt(wire.value)),
1143
+ validator: z.any(),
1144
+ filesHash: z.string(),
1145
+ to: z.any()
1093
1146
  }).strict()
1094
1147
  }).strict()
1095
1148
  ]);
@@ -1130,7 +1183,7 @@ export {
1130
1183
  createClient,
1131
1184
  createConfig,
1132
1185
  flightsControllerCreatePresignedUrls,
1133
- flightsControllerGenerateFlightId,
1186
+ flightsControllerGenerateStorageKey,
1134
1187
  flightsControllerGetFlight,
1135
1188
  flightsControllerValidateFlight,
1136
1189
  formDataBodySerializer,
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": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "license": "MIT",
6
6
  "files": [
7
7
  "dist",
@@ -8,6 +8,8 @@ import type {
8
8
  import {
9
9
  apiTokenControllerUpdateTokenResponseTransformer,
10
10
  conditionsControllerGetSunAltitudeTimeLimitsResponseTransformer,
11
+ flightsControllerGetFlightResponseTransformer,
12
+ flightsControllerValidateFlightResponseTransformer,
11
13
  } from "./transformers.gen.js";
12
14
  import type {
13
15
  ApiTokenControllerCreateTokenData,
@@ -29,9 +31,9 @@ import type {
29
31
  FlightsControllerCreatePresignedUrlsData,
30
32
  FlightsControllerCreatePresignedUrlsErrors,
31
33
  FlightsControllerCreatePresignedUrlsResponses,
32
- FlightsControllerGenerateFlightIdData,
33
- FlightsControllerGenerateFlightIdErrors,
34
- FlightsControllerGenerateFlightIdResponses,
34
+ FlightsControllerGenerateStorageKeyData,
35
+ FlightsControllerGenerateStorageKeyErrors,
36
+ FlightsControllerGenerateStorageKeyResponses,
35
37
  FlightsControllerGetFlightData,
36
38
  FlightsControllerGetFlightErrors,
37
39
  FlightsControllerGetFlightResponses,
@@ -333,14 +335,14 @@ export const missionsControllerClaimRewards = <
333
335
  });
334
336
  };
335
337
 
336
- export const flightsControllerGenerateFlightId = <
338
+ export const flightsControllerGenerateStorageKey = <
337
339
  ThrowOnError extends boolean = false,
338
340
  >(
339
- options: Options<FlightsControllerGenerateFlightIdData, ThrowOnError>,
341
+ options: Options<FlightsControllerGenerateStorageKeyData, ThrowOnError>,
340
342
  ) => {
341
343
  return (options.client ?? _heyApiClient).get<
342
- FlightsControllerGenerateFlightIdResponses,
343
- FlightsControllerGenerateFlightIdErrors,
344
+ FlightsControllerGenerateStorageKeyResponses,
345
+ FlightsControllerGenerateStorageKeyErrors,
344
346
  ThrowOnError
345
347
  >({
346
348
  security: [
@@ -349,7 +351,7 @@ export const flightsControllerGenerateFlightId = <
349
351
  type: "apiKey",
350
352
  },
351
353
  ],
352
- url: "/flights/id",
354
+ url: "/flights/storage-key",
353
355
  ...options,
354
356
  });
355
357
  };
@@ -370,6 +372,7 @@ export const flightsControllerGetFlight = <
370
372
  type: "apiKey",
371
373
  },
372
374
  ],
375
+ responseTransformer: flightsControllerGetFlightResponseTransformer,
373
376
  url: "/flights/{flightId}",
374
377
  ...options,
375
378
  });
@@ -391,7 +394,7 @@ export const flightsControllerCreatePresignedUrls = <
391
394
  type: "apiKey",
392
395
  },
393
396
  ],
394
- url: "/flights/{flightId}/files",
397
+ url: "/flights/files",
395
398
  ...options,
396
399
  headers: {
397
400
  "Content-Type": "application/json",
@@ -416,6 +419,7 @@ export const flightsControllerValidateFlight = <
416
419
  type: "apiKey",
417
420
  },
418
421
  ],
422
+ responseTransformer: flightsControllerValidateFlightResponseTransformer,
419
423
  url: "/flights",
420
424
  ...options,
421
425
  headers: {
@@ -2,6 +2,8 @@
2
2
  import type {
3
3
  ApiTokenControllerUpdateTokenResponse,
4
4
  ConditionsControllerGetSunAltitudeTimeLimitsResponse,
5
+ FlightsControllerGetFlightResponse,
6
+ FlightsControllerValidateFlightResponse,
5
7
  } from "./types.gen.js";
6
8
 
7
9
  const updateApiTokenResponseDtoSchemaResponseTransformer = (data: any) => {
@@ -17,6 +19,31 @@ export const apiTokenControllerUpdateTokenResponseTransformer = async (
17
19
  return data;
18
20
  };
19
21
 
22
+ const flightDtoSchemaResponseTransformer = (data: any) => {
23
+ data.token_id = BigInt(data.token_id.toString());
24
+ data.mission_id = BigInt(data.mission_id.toString());
25
+ return data;
26
+ };
27
+
28
+ export const flightsControllerGetFlightResponseTransformer = async (
29
+ data: any,
30
+ ): Promise<FlightsControllerGetFlightResponse> => {
31
+ data = flightDtoSchemaResponseTransformer(data);
32
+ return data;
33
+ };
34
+
35
+ const validateFlightResponseDtoSchemaResponseTransformer = (data: any) => {
36
+ data.flightId = BigInt(data.flightId.toString());
37
+ return data;
38
+ };
39
+
40
+ export const flightsControllerValidateFlightResponseTransformer = async (
41
+ data: any,
42
+ ): Promise<FlightsControllerValidateFlightResponse> => {
43
+ data = validateFlightResponseDtoSchemaResponseTransformer(data);
44
+ return data;
45
+ };
46
+
20
47
  const getTimeLimitsForSunAltitudeResponseSchemaResponseTransformer = (
21
48
  data: any,
22
49
  ) => {
@@ -129,7 +129,8 @@ export type ClaimRewardsResponseDto = {
129
129
  };
130
130
 
131
131
  export type FlightDto = {
132
- token_id: number;
132
+ token_id: bigint;
133
+ mission_id: bigint;
133
134
  owner: string;
134
135
  validator: string;
135
136
  is_approved: boolean;
@@ -142,6 +143,7 @@ export type FlightDto = {
142
143
 
143
144
  export type CreateFileRequestDto = {
144
145
  filenames: Array<string>;
146
+ storageKey: string;
145
147
  };
146
148
 
147
149
  export type CreateFileResponseDto = {
@@ -150,10 +152,10 @@ export type CreateFileResponseDto = {
150
152
  };
151
153
  };
152
154
 
153
- export type ValidateFlightDto = {
154
- flightId?: number;
155
+ export type ValidateFlightRequestDto = {
156
+ storageKey: string;
155
157
  pilotAddress: string;
156
- missionId: number;
158
+ missionId: bigint;
157
159
  flightTimestamp: string;
158
160
  flightRequestInfo: {
159
161
  filePaths: Array<string>;
@@ -164,7 +166,7 @@ export type ValidateFlightDto = {
164
166
  };
165
167
 
166
168
  export type ValidateFlightResponseDto = {
167
- flightId: number;
169
+ flightId: bigint;
168
170
  flightManifestUri: string;
169
171
  };
170
172
 
@@ -191,6 +193,7 @@ export type CreateWebhookBody = {
191
193
  | "protocol.mission.created"
192
194
  | "protocol.mission.updated"
193
195
  | "protocol.flight.reviewed"
196
+ | "internal.flight.reviewed"
194
197
  | "*"
195
198
  >;
196
199
  active: boolean;
@@ -211,6 +214,7 @@ export type GetWebhooksResponse = Array<{
211
214
  | "protocol.mission.created"
212
215
  | "protocol.mission.updated"
213
216
  | "protocol.flight.reviewed"
217
+ | "internal.flight.reviewed"
214
218
  | "*"
215
219
  >;
216
220
  active: boolean;
@@ -230,6 +234,7 @@ export type GetWebhookResponse = {
230
234
  | "protocol.mission.created"
231
235
  | "protocol.mission.updated"
232
236
  | "protocol.flight.reviewed"
237
+ | "internal.flight.reviewed"
233
238
  | "*"
234
239
  >;
235
240
  active: boolean;
@@ -248,6 +253,7 @@ export type UpdateWebhookBody = {
248
253
  | "protocol.mission.created"
249
254
  | "protocol.mission.updated"
250
255
  | "protocol.flight.reviewed"
256
+ | "internal.flight.reviewed"
251
257
  | "*"
252
258
  >;
253
259
  active?: boolean;
@@ -263,6 +269,7 @@ export type UpdateWebhookResponse = {
263
269
  | "protocol.mission.created"
264
270
  | "protocol.mission.updated"
265
271
  | "protocol.flight.reviewed"
272
+ | "internal.flight.reviewed"
266
273
  | "*"
267
274
  >;
268
275
  active: boolean;
@@ -508,36 +515,36 @@ export type MissionsControllerClaimRewardsResponses = {
508
515
  export type MissionsControllerClaimRewardsResponse =
509
516
  MissionsControllerClaimRewardsResponses[keyof MissionsControllerClaimRewardsResponses];
510
517
 
511
- export type FlightsControllerGenerateFlightIdData = {
518
+ export type FlightsControllerGenerateStorageKeyData = {
512
519
  body?: never;
513
520
  path?: never;
514
521
  query: {
515
- missionId: number;
522
+ missionId: bigint;
516
523
  pilotAddress: string;
517
524
  flightTimestamp?: string;
518
525
  };
519
- url: "/flights/id";
526
+ url: "/flights/storage-key";
520
527
  };
521
528
 
522
- export type FlightsControllerGenerateFlightIdErrors = {
529
+ export type FlightsControllerGenerateStorageKeyErrors = {
523
530
  401: unknown;
524
531
  403: unknown;
525
532
  };
526
533
 
527
- export type FlightsControllerGenerateFlightIdResponses = {
534
+ export type FlightsControllerGenerateStorageKeyResponses = {
528
535
  /**
529
- * Returns the generated flight ID
536
+ * Returns the generated storage key
530
537
  */
531
- 200: number;
538
+ 200: string;
532
539
  };
533
540
 
534
- export type FlightsControllerGenerateFlightIdResponse =
535
- FlightsControllerGenerateFlightIdResponses[keyof FlightsControllerGenerateFlightIdResponses];
541
+ export type FlightsControllerGenerateStorageKeyResponse =
542
+ FlightsControllerGenerateStorageKeyResponses[keyof FlightsControllerGenerateStorageKeyResponses];
536
543
 
537
544
  export type FlightsControllerGetFlightData = {
538
545
  body?: never;
539
546
  path: {
540
- flightId: number;
547
+ flightId: bigint;
541
548
  };
542
549
  query?: never;
543
550
  url: "/flights/{flightId}";
@@ -560,11 +567,9 @@ export type FlightsControllerGetFlightResponse =
560
567
 
561
568
  export type FlightsControllerCreatePresignedUrlsData = {
562
569
  body: CreateFileRequestDto;
563
- path: {
564
- flightId: number;
565
- };
570
+ path?: never;
566
571
  query?: never;
567
- url: "/flights/{flightId}/files";
572
+ url: "/flights/files";
568
573
  };
569
574
 
570
575
  export type FlightsControllerCreatePresignedUrlsErrors = {
@@ -583,7 +588,7 @@ export type FlightsControllerCreatePresignedUrlsResponse =
583
588
  FlightsControllerCreatePresignedUrlsResponses[keyof FlightsControllerCreatePresignedUrlsResponses];
584
589
 
585
590
  export type FlightsControllerValidateFlightData = {
586
- body: ValidateFlightDto;
591
+ body: ValidateFlightRequestDto;
587
592
  path?: never;
588
593
  query?: never;
589
594
  url: "/flights";
@@ -17,10 +17,12 @@ export const Event = z.union([
17
17
  timestamp: z.any(),
18
18
  data: z
19
19
  .object({
20
- flightId: z.number(),
20
+ storageKey: z.string(),
21
21
  pilotAddress: z.string(),
22
22
  flightManifestUri: z.string(),
23
- missionId: z.number(),
23
+ missionId: z
24
+ .object({ __type: z.literal("bigint"), value: z.string() })
25
+ .transform((wire) => BigInt(wire.value)),
24
26
  })
25
27
  .strict(),
26
28
  })
@@ -77,11 +79,42 @@ export const Event = z.union([
77
79
  timestamp: z.any(),
78
80
  data: z
79
81
  .object({
80
- flightId: z.number(),
82
+ flightId: z
83
+ .object({ __type: z.literal("bigint"), value: z.string() })
84
+ .transform((wire) => BigInt(wire.value)),
81
85
  isApproved: z.boolean(),
82
86
  validationLogUri: z.string(),
83
87
  validator: z.string(),
84
88
  filesHash: z.string(),
89
+ storageKey: z.string(),
90
+ missionId: z
91
+ .object({ __type: z.literal("bigint"), value: z.string() })
92
+ .transform((wire) => BigInt(wire.value)),
93
+ })
94
+ .strict(),
95
+ })
96
+ .strict(),
97
+ z
98
+ .object({
99
+ id: z.any(),
100
+ event_type: z.literal("internal.flight.reviewed"),
101
+ timestamp: z.any(),
102
+ data: z
103
+ .object({
104
+ isApproved: z.boolean(),
105
+ storageKey: z.string(),
106
+ provenanceDataVersion: z.string(),
107
+ validationLogUri: z.string(),
108
+ provenanceDataUri: z.string(),
109
+ tokenId: z
110
+ .object({ __type: z.literal("bigint"), value: z.string() })
111
+ .transform((wire) => BigInt(wire.value)),
112
+ missionId: z
113
+ .object({ __type: z.literal("bigint"), value: z.string() })
114
+ .transform((wire) => BigInt(wire.value)),
115
+ validator: z.any(),
116
+ filesHash: z.string(),
117
+ to: z.any(),
85
118
  })
86
119
  .strict(),
87
120
  })
@@ -106,3 +139,7 @@ export type FlightReviewedEvent = Extract<
106
139
  Event,
107
140
  { event_type: "protocol.flight.reviewed" }
108
141
  >;
142
+ export type InternalFlightReviewedEvent = Extract<
143
+ Event,
144
+ { event_type: "internal.flight.reviewed" }
145
+ >;