@layer-drone/protocol 0.1.1 → 0.1.2

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.js CHANGED
@@ -22,6 +22,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
24
  Event: () => Event,
25
+ apiControllerGetError: () => apiControllerGetError,
25
26
  apiControllerGetHello: () => apiControllerGetHello,
26
27
  apiTokenControllerCreateToken: () => apiTokenControllerCreateToken,
27
28
  apiTokenControllerDeleteToken: () => apiTokenControllerDeleteToken,
@@ -627,11 +628,7 @@ var createClient = /* @__PURE__ */ __name((config = {}) => {
627
628
  if (opts.body === void 0 || opts.body === "") {
628
629
  opts.headers.delete("Content-Type");
629
630
  }
630
- const url = buildUrl({
631
- ...opts,
632
- baseUrl: opts.baseUrl ?? _config?.baseUrl ?? "https://api.layerdrone.org",
633
- url: opts.url ?? ""
634
- });
631
+ const url = buildUrl(opts);
635
632
  const requestInit = {
636
633
  redirect: "follow",
637
634
  ...opts
@@ -786,6 +783,12 @@ var apiControllerGetHello = /* @__PURE__ */ __name((options) => {
786
783
  ...options
787
784
  });
788
785
  }, "apiControllerGetHello");
786
+ var apiControllerGetError = /* @__PURE__ */ __name((options) => {
787
+ return (options?.client ?? client).get({
788
+ url: "/debug-sentry",
789
+ ...options
790
+ });
791
+ }, "apiControllerGetError");
789
792
  var apiTokenControllerCreateToken = /* @__PURE__ */ __name((options) => {
790
793
  return (options.client ?? client).post({
791
794
  security: [
@@ -915,6 +918,12 @@ var keysControllerGetProvenanceCryptoKey = /* @__PURE__ */ __name((options) => {
915
918
  }, "keysControllerGetProvenanceCryptoKey");
916
919
  var missionsControllerCreateMissions = /* @__PURE__ */ __name((options) => {
917
920
  return (options.client ?? client).post({
921
+ security: [
922
+ {
923
+ name: "x-api-token",
924
+ type: "apiKey"
925
+ }
926
+ ],
918
927
  url: "/missions",
919
928
  ...options,
920
929
  headers: {
@@ -925,6 +934,12 @@ var missionsControllerCreateMissions = /* @__PURE__ */ __name((options) => {
925
934
  }, "missionsControllerCreateMissions");
926
935
  var missionsControllerUpdateMissions = /* @__PURE__ */ __name((options) => {
927
936
  return (options.client ?? client).put({
937
+ security: [
938
+ {
939
+ name: "x-api-token",
940
+ type: "apiKey"
941
+ }
942
+ ],
928
943
  url: "/missions",
929
944
  ...options,
930
945
  headers: {
@@ -1081,8 +1096,8 @@ var Event = import_zod.z.union([
1081
1096
  timestamp: import_zod.z.string(),
1082
1097
  data: import_zod.z.object({
1083
1098
  message: import_zod.z.string()
1084
- }).strict()
1085
- }).strict(),
1099
+ }).catchall(import_zod.z.any())
1100
+ }).catchall(import_zod.z.any()),
1086
1101
  import_zod.z.object({
1087
1102
  id: import_zod.z.string(),
1088
1103
  event_type: import_zod.z.literal("protocol.mission.created"),
@@ -1102,6 +1117,7 @@ var Event = import_zod.z.union([
1102
1117
  }).transform((wire) => BigInt(wire.value)),
1103
1118
  zoneId: import_zod.z.string(),
1104
1119
  flightPlanId: import_zod.z.number(),
1120
+ campaigns: import_zod.z.array(import_zod.z.string()),
1105
1121
  captureStartTime: import_zod.z.string().datetime({
1106
1122
  offset: true
1107
1123
  }),
@@ -1109,8 +1125,8 @@ var Event = import_zod.z.union([
1109
1125
  offset: true
1110
1126
  }),
1111
1127
  requestor: import_zod.z.string().regex(new RegExp("^0x[a-fA-F0-9]{40}$"))
1112
- }).strict()
1113
- }).strict(),
1128
+ }).catchall(import_zod.z.any())
1129
+ }).catchall(import_zod.z.any()),
1114
1130
  import_zod.z.object({
1115
1131
  id: import_zod.z.string(),
1116
1132
  event_type: import_zod.z.literal("protocol.mission.updated"),
@@ -1124,9 +1140,10 @@ var Event = import_zod.z.union([
1124
1140
  __type: import_zod.z.literal("bigint"),
1125
1141
  value: import_zod.z.string()
1126
1142
  }).transform((wire) => BigInt(wire.value)).optional(),
1127
- isOpen: import_zod.z.boolean().optional()
1128
- }).strict()
1129
- }).strict(),
1143
+ isOpen: import_zod.z.boolean().optional(),
1144
+ campaigns: import_zod.z.array(import_zod.z.string()).optional()
1145
+ }).catchall(import_zod.z.any())
1146
+ }).catchall(import_zod.z.any()),
1130
1147
  import_zod.z.object({
1131
1148
  id: import_zod.z.string(),
1132
1149
  event_type: import_zod.z.literal("protocol.mission.paid"),
@@ -1150,8 +1167,8 @@ var Event = import_zod.z.union([
1150
1167
  value: import_zod.z.string()
1151
1168
  }).transform((wire) => BigInt(wire.value)),
1152
1169
  storageKey: import_zod.z.string()
1153
- }).strict()
1154
- }).strict(),
1170
+ }).catchall(import_zod.z.any())
1171
+ }).catchall(import_zod.z.any()),
1155
1172
  import_zod.z.object({
1156
1173
  id: import_zod.z.string(),
1157
1174
  event_type: import_zod.z.literal("protocol.flight.submitted"),
@@ -1164,8 +1181,8 @@ var Event = import_zod.z.union([
1164
1181
  __type: import_zod.z.literal("bigint"),
1165
1182
  value: import_zod.z.string()
1166
1183
  }).transform((wire) => BigInt(wire.value))
1167
- }).strict()
1168
- }).strict(),
1184
+ }).catchall(import_zod.z.any())
1185
+ }).catchall(import_zod.z.any()),
1169
1186
  import_zod.z.object({
1170
1187
  id: import_zod.z.string(),
1171
1188
  event_type: import_zod.z.literal("protocol.flight.reviewed"),
@@ -1185,8 +1202,8 @@ var Event = import_zod.z.union([
1185
1202
  __type: import_zod.z.literal("bigint"),
1186
1203
  value: import_zod.z.string()
1187
1204
  }).transform((wire) => BigInt(wire.value))
1188
- }).strict()
1189
- }).strict()
1205
+ }).catchall(import_zod.z.any())
1206
+ }).catchall(import_zod.z.any())
1190
1207
  ]);
1191
1208
 
1192
1209
  // src/event/parser.ts
@@ -1216,6 +1233,7 @@ __name(getSecretHeader, "getSecretHeader");
1216
1233
  // Annotate the CommonJS export names for ESM import in node:
1217
1234
  0 && (module.exports = {
1218
1235
  Event,
1236
+ apiControllerGetError,
1219
1237
  apiControllerGetHello,
1220
1238
  apiTokenControllerCreateToken,
1221
1239
  apiTokenControllerDeleteToken,
package/dist/index.mjs CHANGED
@@ -571,11 +571,7 @@ var createClient = /* @__PURE__ */ __name((config = {}) => {
571
571
  if (opts.body === void 0 || opts.body === "") {
572
572
  opts.headers.delete("Content-Type");
573
573
  }
574
- const url = buildUrl({
575
- ...opts,
576
- baseUrl: opts.baseUrl ?? _config?.baseUrl ?? "https://api.layerdrone.org",
577
- url: opts.url ?? ""
578
- });
574
+ const url = buildUrl(opts);
579
575
  const requestInit = {
580
576
  redirect: "follow",
581
577
  ...opts
@@ -730,6 +726,12 @@ var apiControllerGetHello = /* @__PURE__ */ __name((options) => {
730
726
  ...options
731
727
  });
732
728
  }, "apiControllerGetHello");
729
+ var apiControllerGetError = /* @__PURE__ */ __name((options) => {
730
+ return (options?.client ?? client).get({
731
+ url: "/debug-sentry",
732
+ ...options
733
+ });
734
+ }, "apiControllerGetError");
733
735
  var apiTokenControllerCreateToken = /* @__PURE__ */ __name((options) => {
734
736
  return (options.client ?? client).post({
735
737
  security: [
@@ -859,6 +861,12 @@ var keysControllerGetProvenanceCryptoKey = /* @__PURE__ */ __name((options) => {
859
861
  }, "keysControllerGetProvenanceCryptoKey");
860
862
  var missionsControllerCreateMissions = /* @__PURE__ */ __name((options) => {
861
863
  return (options.client ?? client).post({
864
+ security: [
865
+ {
866
+ name: "x-api-token",
867
+ type: "apiKey"
868
+ }
869
+ ],
862
870
  url: "/missions",
863
871
  ...options,
864
872
  headers: {
@@ -869,6 +877,12 @@ var missionsControllerCreateMissions = /* @__PURE__ */ __name((options) => {
869
877
  }, "missionsControllerCreateMissions");
870
878
  var missionsControllerUpdateMissions = /* @__PURE__ */ __name((options) => {
871
879
  return (options.client ?? client).put({
880
+ security: [
881
+ {
882
+ name: "x-api-token",
883
+ type: "apiKey"
884
+ }
885
+ ],
872
886
  url: "/missions",
873
887
  ...options,
874
888
  headers: {
@@ -1025,8 +1039,8 @@ var Event = z.union([
1025
1039
  timestamp: z.string(),
1026
1040
  data: z.object({
1027
1041
  message: z.string()
1028
- }).strict()
1029
- }).strict(),
1042
+ }).catchall(z.any())
1043
+ }).catchall(z.any()),
1030
1044
  z.object({
1031
1045
  id: z.string(),
1032
1046
  event_type: z.literal("protocol.mission.created"),
@@ -1046,6 +1060,7 @@ var Event = z.union([
1046
1060
  }).transform((wire) => BigInt(wire.value)),
1047
1061
  zoneId: z.string(),
1048
1062
  flightPlanId: z.number(),
1063
+ campaigns: z.array(z.string()),
1049
1064
  captureStartTime: z.string().datetime({
1050
1065
  offset: true
1051
1066
  }),
@@ -1053,8 +1068,8 @@ var Event = z.union([
1053
1068
  offset: true
1054
1069
  }),
1055
1070
  requestor: z.string().regex(new RegExp("^0x[a-fA-F0-9]{40}$"))
1056
- }).strict()
1057
- }).strict(),
1071
+ }).catchall(z.any())
1072
+ }).catchall(z.any()),
1058
1073
  z.object({
1059
1074
  id: z.string(),
1060
1075
  event_type: z.literal("protocol.mission.updated"),
@@ -1068,9 +1083,10 @@ var Event = z.union([
1068
1083
  __type: z.literal("bigint"),
1069
1084
  value: z.string()
1070
1085
  }).transform((wire) => BigInt(wire.value)).optional(),
1071
- isOpen: z.boolean().optional()
1072
- }).strict()
1073
- }).strict(),
1086
+ isOpen: z.boolean().optional(),
1087
+ campaigns: z.array(z.string()).optional()
1088
+ }).catchall(z.any())
1089
+ }).catchall(z.any()),
1074
1090
  z.object({
1075
1091
  id: z.string(),
1076
1092
  event_type: z.literal("protocol.mission.paid"),
@@ -1094,8 +1110,8 @@ var Event = z.union([
1094
1110
  value: z.string()
1095
1111
  }).transform((wire) => BigInt(wire.value)),
1096
1112
  storageKey: z.string()
1097
- }).strict()
1098
- }).strict(),
1113
+ }).catchall(z.any())
1114
+ }).catchall(z.any()),
1099
1115
  z.object({
1100
1116
  id: z.string(),
1101
1117
  event_type: z.literal("protocol.flight.submitted"),
@@ -1108,8 +1124,8 @@ var Event = z.union([
1108
1124
  __type: z.literal("bigint"),
1109
1125
  value: z.string()
1110
1126
  }).transform((wire) => BigInt(wire.value))
1111
- }).strict()
1112
- }).strict(),
1127
+ }).catchall(z.any())
1128
+ }).catchall(z.any()),
1113
1129
  z.object({
1114
1130
  id: z.string(),
1115
1131
  event_type: z.literal("protocol.flight.reviewed"),
@@ -1129,8 +1145,8 @@ var Event = z.union([
1129
1145
  __type: z.literal("bigint"),
1130
1146
  value: z.string()
1131
1147
  }).transform((wire) => BigInt(wire.value))
1132
- }).strict()
1133
- }).strict()
1148
+ }).catchall(z.any())
1149
+ }).catchall(z.any())
1134
1150
  ]);
1135
1151
 
1136
1152
  // src/event/parser.ts
@@ -1159,6 +1175,7 @@ function getSecretHeader(headers) {
1159
1175
  __name(getSecretHeader, "getSecretHeader");
1160
1176
  export {
1161
1177
  Event,
1178
+ apiControllerGetError,
1162
1179
  apiControllerGetHello,
1163
1180
  apiTokenControllerCreateToken,
1164
1181
  apiTokenControllerDeleteToken,
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.1.1",
4
+ "version": "0.1.2",
5
5
  "license": "MIT",
6
6
  "files": [
7
7
  "dist",
@@ -55,11 +55,7 @@ export const createClient = (config: Config = {}): Client => {
55
55
  opts.headers.delete("Content-Type");
56
56
  }
57
57
 
58
- const url = buildUrl({
59
- ...opts,
60
- baseUrl: opts.baseUrl ?? _config?.baseUrl ?? "https://api.layerdrone.org",
61
- url: opts.url ?? "",
62
- });
58
+ const url = buildUrl(opts);
63
59
  const requestInit: ReqInit = {
64
60
  redirect: "follow",
65
61
  ...opts,
@@ -11,6 +11,8 @@ import {
11
11
  flightsControllerValidateFlightResponseTransformer,
12
12
  } from "./transformers.gen.js";
13
13
  import type {
14
+ ApiControllerGetErrorData,
15
+ ApiControllerGetErrorResponses,
14
16
  ApiControllerGetHelloData,
15
17
  ApiControllerGetHelloResponses,
16
18
  ApiTokenControllerCreateTokenData,
@@ -45,6 +47,7 @@ import type {
45
47
  MissionsControllerCreateMissionsErrors,
46
48
  MissionsControllerCreateMissionsResponses,
47
49
  MissionsControllerUpdateMissionsData,
50
+ MissionsControllerUpdateMissionsErrors,
48
51
  MissionsControllerUpdateMissionsResponses,
49
52
  QuotesControllerCreateQuoteData,
50
53
  QuotesControllerCreateQuoteErrors,
@@ -110,6 +113,19 @@ export const apiControllerGetHello = <ThrowOnError extends boolean = false>(
110
113
  });
111
114
  };
112
115
 
116
+ export const apiControllerGetError = <ThrowOnError extends boolean = false>(
117
+ options?: Options<ApiControllerGetErrorData, ThrowOnError>,
118
+ ) => {
119
+ return (options?.client ?? _heyApiClient).get<
120
+ ApiControllerGetErrorResponses,
121
+ unknown,
122
+ ThrowOnError
123
+ >({
124
+ url: "/debug-sentry",
125
+ ...options,
126
+ });
127
+ };
128
+
113
129
  export const apiTokenControllerCreateToken = <
114
130
  ThrowOnError extends boolean = false,
115
131
  >(
@@ -345,6 +361,12 @@ export const missionsControllerCreateMissions = <
345
361
  MissionsControllerCreateMissionsErrors,
346
362
  ThrowOnError
347
363
  >({
364
+ security: [
365
+ {
366
+ name: "x-api-token",
367
+ type: "apiKey",
368
+ },
369
+ ],
348
370
  url: "/missions",
349
371
  ...options,
350
372
  headers: {
@@ -365,9 +387,15 @@ export const missionsControllerUpdateMissions = <
365
387
  ) => {
366
388
  return (options.client ?? _heyApiClient).put<
367
389
  MissionsControllerUpdateMissionsResponses,
368
- unknown,
390
+ MissionsControllerUpdateMissionsErrors,
369
391
  ThrowOnError
370
392
  >({
393
+ security: [
394
+ {
395
+ name: "x-api-token",
396
+ type: "apiKey",
397
+ },
398
+ ],
371
399
  url: "/missions",
372
400
  ...options,
373
401
  headers: {
@@ -6,18 +6,36 @@ export type CreateApiTokenResponseDto = {
6
6
  deleted_at: Date;
7
7
  last_used: Date;
8
8
  org: number;
9
- scopes: Array<"manageTokens" | "manageFlights" | "manageWebhooks" | "all">;
9
+ scopes: Array<
10
+ | "manageTokens"
11
+ | "manageFlights"
12
+ | "manageMissions"
13
+ | "manageWebhooks"
14
+ | "all"
15
+ >;
10
16
  };
11
17
 
12
18
  export type CreateApiTokenRequestDto = {
13
19
  name: string;
14
- scopes: Array<"manageTokens" | "manageFlights" | "manageWebhooks" | "all">;
20
+ scopes: Array<
21
+ | "manageTokens"
22
+ | "manageFlights"
23
+ | "manageMissions"
24
+ | "manageWebhooks"
25
+ | "all"
26
+ >;
15
27
  orgId: number;
16
28
  };
17
29
 
18
30
  export type UpdateApiTokenRequestDto = {
19
31
  name?: string;
20
- scopes?: Array<"manageTokens" | "manageFlights" | "manageWebhooks" | "all">;
32
+ scopes?: Array<
33
+ | "manageTokens"
34
+ | "manageFlights"
35
+ | "manageMissions"
36
+ | "manageWebhooks"
37
+ | "all"
38
+ >;
21
39
  };
22
40
 
23
41
  export type UpdateApiTokenResponseDto = {
@@ -26,7 +44,13 @@ export type UpdateApiTokenResponseDto = {
26
44
  deleted_at: Date;
27
45
  last_used: Date;
28
46
  org: number;
29
- scopes: Array<"manageTokens" | "manageFlights" | "manageWebhooks" | "all">;
47
+ scopes: Array<
48
+ | "manageTokens"
49
+ | "manageFlights"
50
+ | "manageMissions"
51
+ | "manageWebhooks"
52
+ | "all"
53
+ >;
30
54
  };
31
55
 
32
56
  export type GetTimeLimitsForSunAltitudeResponse = {
@@ -298,6 +322,17 @@ export type ApiControllerGetHelloResponses = {
298
322
  200: unknown;
299
323
  };
300
324
 
325
+ export type ApiControllerGetErrorData = {
326
+ body?: never;
327
+ path?: never;
328
+ query?: never;
329
+ url: "/debug-sentry";
330
+ };
331
+
332
+ export type ApiControllerGetErrorResponses = {
333
+ 200: unknown;
334
+ };
335
+
301
336
  export type ApiTokenControllerCreateTokenData = {
302
337
  body: CreateApiTokenRequestDto;
303
338
  path?: never;
@@ -525,6 +560,7 @@ export type MissionsControllerCreateMissionsErrors = {
525
560
  * Validation failed - invalid Zones, mission types, or times
526
561
  */
527
562
  400: unknown;
563
+ 401: unknown;
528
564
  /**
529
565
  * Insufficient treasury spending limit
530
566
  */
@@ -552,6 +588,11 @@ export type MissionsControllerUpdateMissionsData = {
552
588
  url: "/missions";
553
589
  };
554
590
 
591
+ export type MissionsControllerUpdateMissionsErrors = {
592
+ 401: unknown;
593
+ 403: unknown;
594
+ };
595
+
555
596
  export type MissionsControllerUpdateMissionsResponses = {
556
597
  /**
557
598
  * Missions update transaction queued successfully
@@ -7,9 +7,9 @@ export const Event = z.union([
7
7
  id: z.string(),
8
8
  event_type: z.literal("test"),
9
9
  timestamp: z.string(),
10
- data: z.object({ message: z.string() }).strict(),
10
+ data: z.object({ message: z.string() }).catchall(z.any()),
11
11
  })
12
- .strict(),
12
+ .catchall(z.any()),
13
13
  z
14
14
  .object({
15
15
  id: z.string(),
@@ -28,13 +28,14 @@ export const Event = z.union([
28
28
  .transform((wire) => BigInt(wire.value)),
29
29
  zoneId: z.string(),
30
30
  flightPlanId: z.number(),
31
+ campaigns: z.array(z.string()),
31
32
  captureStartTime: z.string().datetime({ offset: true }),
32
33
  captureEndTime: z.string().datetime({ offset: true }),
33
34
  requestor: z.string().regex(new RegExp("^0x[a-fA-F0-9]{40}$")),
34
35
  })
35
- .strict(),
36
+ .catchall(z.any()),
36
37
  })
37
- .strict(),
38
+ .catchall(z.any()),
38
39
  z
39
40
  .object({
40
41
  id: z.string(),
@@ -50,10 +51,11 @@ export const Event = z.union([
50
51
  .transform((wire) => BigInt(wire.value))
51
52
  .optional(),
52
53
  isOpen: z.boolean().optional(),
54
+ campaigns: z.array(z.string()).optional(),
53
55
  })
54
- .strict(),
56
+ .catchall(z.any()),
55
57
  })
56
- .strict(),
58
+ .catchall(z.any()),
57
59
  z
58
60
  .object({
59
61
  id: z.string(),
@@ -76,9 +78,9 @@ export const Event = z.union([
76
78
  .transform((wire) => BigInt(wire.value)),
77
79
  storageKey: z.string(),
78
80
  })
79
- .strict(),
81
+ .catchall(z.any()),
80
82
  })
81
- .strict(),
83
+ .catchall(z.any()),
82
84
  z
83
85
  .object({
84
86
  id: z.string(),
@@ -93,9 +95,9 @@ export const Event = z.union([
93
95
  .object({ __type: z.literal("bigint"), value: z.string() })
94
96
  .transform((wire) => BigInt(wire.value)),
95
97
  })
96
- .strict(),
98
+ .catchall(z.any()),
97
99
  })
98
- .strict(),
100
+ .catchall(z.any()),
99
101
  z
100
102
  .object({
101
103
  id: z.string(),
@@ -116,9 +118,9 @@ export const Event = z.union([
116
118
  .object({ __type: z.literal("bigint"), value: z.string() })
117
119
  .transform((wire) => BigInt(wire.value)),
118
120
  })
119
- .strict(),
121
+ .catchall(z.any()),
120
122
  })
121
- .strict(),
123
+ .catchall(z.any()),
122
124
  ]);
123
125
  export type Event = z.infer<typeof Event>;
124
126