@bikefinder/sdk 0.23.0 → 0.28.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.
@@ -1,786 +0,0 @@
1
- // ../customer-contracts/src/schemas.ts
2
- import { z as z2 } from "zod";
3
-
4
- // ../customer-contracts/src/shared.ts
5
- import { z } from "zod";
6
- var documentId = z.string().min(1).max(128).refine(
7
- (value) => value.trim().length > 0 && ![".", ".."].includes(value) && !/[\\/\p{Cc}]/u.test(value) && !value.startsWith("__"),
8
- "Invalid document ID."
9
- );
10
- var trackerInput = z.strictObject({ id: documentId });
11
- var requestId = z.guid().refine(
12
- (value) => value !== "00000000-0000-0000-0000-000000000000",
13
- "Supply a nonempty request ID."
14
- ).toLowerCase();
15
- var documentFields = {
16
- id: z.string(),
17
- revision: z.string(),
18
- createdAt: z.iso.datetime(),
19
- updatedAt: z.iso.datetime()
20
- };
21
- var pageFields = {
22
- limit: z.int().positive().default(50),
23
- after: documentId.optional()
24
- };
25
- var pageInput = z.strictObject(pageFields).prefault({});
26
- var timeCursorFields = { id: documentId, at: z.iso.datetime() };
27
- var timePageInput = z.strictObject({
28
- limit: pageFields.limit,
29
- after: z.strictObject(timeCursorFields).optional()
30
- }).prefault({});
31
- var errorData = z.strictObject({ traceId: z.string() });
32
- var apiErrors = {
33
- invalid: { status: 400, data: errorData },
34
- unauthenticated: { status: 401, data: errorData },
35
- forbidden: { status: 403, data: errorData },
36
- subscription_not_owned: { status: 403, data: errorData },
37
- not_found: { status: 404, data: errorData },
38
- conflict: { status: 409, data: errorData },
39
- inventory_changed: { status: 412, data: errorData },
40
- firmware_catalog_invalid: { status: 503, data: errorData },
41
- firmware_catalog_full: { status: 503, data: errorData },
42
- firmware_execution_invalid: { status: 503, data: errorData },
43
- firmware_review_changed: { status: 412, data: errorData },
44
- firmware_review_required: { status: 428, data: errorData },
45
- firmware_policy_unavailable: { status: 503, data: errorData },
46
- firmware_release_unavailable: { status: 503, data: errorData },
47
- rate_limited: { status: 429, data: errorData },
48
- stored_data_invalid: { status: 503, data: errorData },
49
- service_unavailable: { status: 503, data: errorData },
50
- directory_unavailable: { status: 503, data: errorData },
51
- directory_response_invalid: { status: 503, data: errorData },
52
- support_provider_unavailable: { status: 503, data: errorData },
53
- support_journal_invalid: { status: 503, data: errorData },
54
- support_actions_disabled: { status: 503, data: errorData },
55
- support_billing_disabled: { status: 503, data: errorData },
56
- support_agent_mismatch: { status: 503, data: errorData },
57
- operation_unconfirmed: { status: 503, data: errorData },
58
- support_response_invalid: { status: 503, data: errorData },
59
- support_response_too_large: { status: 503, data: errorData },
60
- ticket_history_incomplete: { status: 503, data: errorData },
61
- ticket_context_too_large: { status: 503, data: errorData },
62
- read_unavailable: { status: 503, data: errorData },
63
- inbox_unavailable: { status: 503, data: errorData },
64
- stream_unavailable: { status: 503, data: errorData },
65
- payload_too_large: { status: 413, data: errorData }
66
- };
67
-
68
- // ../customer-contracts/src/schemas.ts
69
- var trackerBike = z2.strictObject({
70
- revision: z2.string(),
71
- name: z2.string().nullable(),
72
- brand: z2.string().nullable(),
73
- type: z2.string().nullable(),
74
- model: z2.string().nullable(),
75
- frameNumber: z2.string().nullable(),
76
- url: z2.string().nullable(),
77
- marketPrice: z2.string().nullable(),
78
- marketPriceCurrency: z2.string().nullable()
79
- });
80
- var trackerBattery = z2.strictObject({
81
- level: z2.number().nullable(),
82
- isCharging: z2.boolean().nullable(),
83
- levelUpdatedAt: z2.iso.datetime().nullable(),
84
- chargingObservedAt: z2.iso.datetime().nullable(),
85
- observation: z2.strictObject({
86
- observedAt: z2.iso.datetime().nullable(),
87
- receivedAt: z2.iso.datetime().nullable()
88
- }).nullable(),
89
- source: z2.string().nullable()
90
- });
91
- var trackerLocation = z2.strictObject({
92
- latitude: z2.number().nullable(),
93
- longitude: z2.number().nullable(),
94
- accuracy: z2.number().nullable(),
95
- source: z2.string().nullable(),
96
- observedAt: z2.iso.datetime().nullable()
97
- });
98
- var trackerSubscription = z2.strictObject({
99
- id: z2.string().nullable(),
100
- isActive: z2.boolean().nullable(),
101
- isDemo: z2.boolean().nullable(),
102
- status: z2.string().nullable(),
103
- country: z2.string().nullable(),
104
- endsAt: z2.iso.datetime().nullable()
105
- });
106
- var trackerFirmware = z2.strictObject({
107
- lte: z2.string().nullable(),
108
- bluetooth: z2.string().nullable(),
109
- battery: z2.string().nullable(),
110
- modem: z2.string().nullable(),
111
- mtk: z2.string().nullable(),
112
- ti: z2.string().nullable(),
113
- buildNumber: z2.int().nullable()
114
- });
115
- var trackerMember = z2.strictObject({
116
- active: z2.boolean().nullable(),
117
- displayName: z2.string().nullable(),
118
- listOrder: z2.int().nullable(),
119
- joinedAt: z2.iso.datetime().nullable()
120
- });
121
- var trackerSummaryFields = {
122
- ...documentFields,
123
- generation: z2.int().positive().nullable(),
124
- bike: trackerBike,
125
- battery: trackerBattery.nullable(),
126
- location: trackerLocation.nullable(),
127
- subscription: trackerSubscription.nullable()
128
- };
129
- var trackerFields = {
130
- ...trackerSummaryFields,
131
- firmware: trackerFirmware.nullable(),
132
- members: z2.record(z2.string(), trackerMember).nullable()
133
- };
134
- var trackerSummary = z2.strictObject({
135
- ...trackerSummaryFields,
136
- identity: z2.strictObject({ serialNumber: z2.string().nullable() }).nullable()
137
- });
138
- var trackerPage = z2.strictObject({
139
- items: z2.array(trackerSummary),
140
- nextAfter: z2.string().nullable()
141
- });
142
- var tracker = z2.strictObject({
143
- ...trackerFields,
144
- identity: trackerSummary.shape.identity,
145
- preferences: z2.strictObject({ movementAlerts: z2.boolean().nullable() }).nullable(),
146
- capabilities: z2.strictObject({
147
- firmwareUpdates: z2.boolean(),
148
- factoryResetReports: z2.boolean()
149
- })
150
- });
151
-
152
- // ../customer-contracts/src/push.ts
153
- import { oc } from "@orpc/contract";
154
- import { z as z3 } from "zod";
155
- var pushToken = z3.string().min(1).max(4096).refine(
156
- (value) => value.trim().length > 0 && !/\p{Cc}/u.test(value) && !/^__.*__$/u.test(value) && // Tokens are literal Firestore field segments. Leave room for the parent and leaf paths.
157
- new TextEncoder().encode(value.replace(/[\\`]/g, "\\$&")).length <= 1400,
158
- "Use a valid push token that fits a literal field path."
159
- );
160
- var pushRegistrationInput = z3.strictObject({
161
- token: pushToken,
162
- platform: z3.enum(["android", "ios"]),
163
- replaceTokens: z3.array(pushToken).default([])
164
- });
165
- var pushRemovalInput = z3.strictObject({ token: pushToken });
166
- var pushContract = {
167
- register: oc.errors(apiErrors).input(pushRegistrationInput).output(z3.void()),
168
- unregister: oc.errors(apiErrors).input(pushRemovalInput).output(z3.void())
169
- };
170
-
171
- // ../customer-contracts/src/inbox.ts
172
- import { oc as oc2, eventIterator } from "@orpc/contract";
173
- import { z as z4 } from "zod";
174
- var notificationSource = z4.strictObject({
175
- kind: z4.enum(["account", "subscription"]),
176
- id: documentId
177
- });
178
- var inboxPageInput = z4.strictObject({
179
- limit: pageFields.limit,
180
- after: z4.strictObject({ ...timeCursorFields, source: notificationSource }).optional()
181
- }).prefault({});
182
- var notification = z4.strictObject({
183
- id: documentId,
184
- source: notificationSource,
185
- type: z4.string().nullable(),
186
- title: z4.string().nullable(),
187
- body: z4.string().nullable(),
188
- trackerId: z4.string().nullable(),
189
- subscriptionId: z4.string().nullable(),
190
- createdAt: z4.iso.datetime()
191
- });
192
- var inboxPage = z4.strictObject({
193
- items: z4.array(notification),
194
- nextAfter: z4.strictObject({ ...timeCursorFields, source: notificationSource }).nullable()
195
- });
196
- var inboxContract = {
197
- list: oc2.meta({ operation: "read" }).errors(apiErrors).input(inboxPageInput).output(inboxPage),
198
- watch: oc2.meta({ operation: "read" }).errors(apiErrors).input(inboxPageInput).output(eventIterator(inboxPage))
199
- };
200
-
201
- // ../customer-contracts/src/accounts.ts
202
- import { oc as oc3, eventIterator as eventIterator2 } from "@orpc/contract";
203
- import { z as z5 } from "zod";
204
- var directoryProfile = z5.strictObject({
205
- id: z5.string().min(1),
206
- email: z5.string().nullable(),
207
- emailVerified: z5.boolean().nullable(),
208
- name: z5.string().nullable(),
209
- picture: z5.string().nullable(),
210
- blocked: z5.boolean().nullable()
211
- });
212
- var unit = z5.enum(["metric", "imperial"]);
213
- var mapStyle = z5.enum(["minimal", "satellite"]);
214
- var accountPreferences = z5.strictObject({
215
- alarm: z5.boolean().nullable(),
216
- timeSensitive: z5.boolean().nullable(),
217
- notifications: z5.boolean().nullable(),
218
- liquidGlass: z5.boolean().nullable(),
219
- language: z5.string().nullable(),
220
- unit: unit.nullable(),
221
- mapStyle: mapStyle.nullable()
222
- });
223
- var account = z5.strictObject({
224
- ...documentFields,
225
- name: z5.string().nullable(),
226
- email: z5.string().nullable(),
227
- picture: z5.string().nullable(),
228
- registeredAt: z5.iso.datetime().nullable(),
229
- preferences: accountPreferences.nullable(),
230
- notificationPermission: z5.string().nullable()
231
- });
232
- var language = z5.string().min(2).max(64).refine((value) => {
233
- try {
234
- return Intl.getCanonicalLocales(value).length === 1;
235
- } catch {
236
- return false;
237
- }
238
- }, "Use a valid language tag.");
239
- var accountPreferencePatch = z5.strictObject({
240
- alarm: z5.boolean().optional(),
241
- timeSensitive: z5.boolean().optional(),
242
- notifications: z5.boolean().optional(),
243
- liquidGlass: z5.boolean().optional(),
244
- language: language.nullable().optional(),
245
- unit: unit.optional(),
246
- mapStyle: mapStyle.optional()
247
- }).refine(
248
- (value) => Object.values(value).some((field) => field !== void 0),
249
- "Supply at least one preference."
250
- );
251
- var accountContract = {
252
- inbox: inboxContract,
253
- push: pushContract,
254
- profile: oc3.meta({ operation: "read" }).errors(apiErrors).input(z5.void()).output(directoryProfile),
255
- get: oc3.meta({ operation: "read" }).errors(apiErrors).input(z5.void()).output(account),
256
- watch: oc3.meta({ operation: "read" }).errors(apiErrors).input(z5.void()).output(eventIterator2(account)),
257
- initialize: oc3.errors(apiErrors).input(z5.void()).output(z5.void()),
258
- preferences: {
259
- update: oc3.errors(apiErrors).input(accountPreferencePatch).output(z5.void())
260
- }
261
- };
262
-
263
- // ../customer-contracts/src/tracker-changes.ts
264
- import { z as z6 } from "zod";
265
- import Decimal from "decimal.js";
266
- import { oc as oc4 } from "@orpc/contract";
267
- var text = z6.string().max(200).regex(/^[^\p{Cc}]*$/u);
268
- var price = z6.string().max(200).regex(/^(?:\d+(?:\.\d{0,2})?|\.\d{1,2})$/).pipe(
269
- z6.string().refine(
270
- (value) => new Decimal(value).lte("90071992547409"),
271
- "The price is too large."
272
- )
273
- ).transform((value) => new Decimal(value).toFixed(2));
274
- var url = z6.string().max(2048).regex(/^[^\p{Cc}]*$/u).pipe(z6.url({ protocol: /^https?$/ }).or(z6.literal("")));
275
- var bikeChanges = z6.strictObject({
276
- name: text.nullable().optional(),
277
- brand: text.nullable().optional(),
278
- type: text.nullable().optional(),
279
- model: text.nullable().optional(),
280
- frameNumber: text.nullable().optional(),
281
- url: url.nullable().optional(),
282
- marketPrice: price.nullable().optional(),
283
- marketPriceCurrency: z6.enum(["NOK", "SEK", "DKK", "EUR", "GBP", "USD"]).nullable().optional()
284
- }).refine(
285
- (changes) => Object.values(changes).some((value) => value !== void 0),
286
- "Supply at least one changed bike field."
287
- );
288
- var bikeEditInput = z6.strictObject({
289
- id: documentId,
290
- expectedRevision: z6.string().regex(/^[a-f0-9]{64}$/),
291
- changes: bikeChanges
292
- });
293
- var membershipName = z6.string().min(1).max(100).regex(/^[^\p{Cc}]+$/u).refine((value) => value.trim().length > 0, "Supply a display name.");
294
- var trackerClaimInput = z6.strictObject({
295
- id: documentId,
296
- displayName: membershipName
297
- });
298
- var trackerMemberInput = z6.strictObject({
299
- id: documentId,
300
- memberId: documentId
301
- });
302
- var trackerMemberAddInput = trackerMemberInput.extend({
303
- displayName: membershipName
304
- });
305
- var trackerMovementAlertsInput = z6.strictObject({
306
- id: documentId,
307
- enabled: z6.boolean()
308
- });
309
- var trackerChangeContract = {
310
- bike: { edit: oc4.errors(apiErrors).input(bikeEditInput).output(z6.void()) },
311
- movementAlerts: {
312
- set: oc4.errors(apiErrors).input(trackerMovementAlertsInput).output(z6.void())
313
- },
314
- members: {
315
- remove: oc4.errors(apiErrors).input(trackerMemberInput).output(z6.void())
316
- }
317
- };
318
-
319
- // ../customer-contracts/src/invitations.ts
320
- import { oc as oc5 } from "@orpc/contract";
321
- import { z as z7 } from "zod";
322
- var accessCode = z7.string().regex(/^[a-f0-9]{32}$/);
323
- var invitationInput = z7.strictObject({
324
- id: documentId,
325
- requestId
326
- });
327
- var invitationRedeemInput = z7.strictObject({
328
- id: documentId,
329
- accessCode,
330
- displayName: membershipName
331
- });
332
- var fields = { requestId: z7.guid(), createdAt: z7.iso.datetime() };
333
- var trackerInvitation = z7.discriminatedUnion("state", [
334
- z7.strictObject({ ...fields, state: z7.literal("active"), accessCode }),
335
- z7.strictObject({
336
- ...fields,
337
- state: z7.literal("unavailable"),
338
- accessCode: z7.null()
339
- })
340
- ]);
341
- var trackerInvitationContract = {
342
- create: oc5.errors(apiErrors).input(invitationInput).output(trackerInvitation),
343
- get: oc5.meta({ operation: "read" }).errors(apiErrors).input(invitationInput).output(trackerInvitation),
344
- revoke: oc5.errors(apiErrors).input(trackerInput).output(z7.void()),
345
- redeem: oc5.errors(apiErrors).input(invitationRedeemInput).output(z7.void())
346
- };
347
-
348
- // ../customer-contracts/src/photos.ts
349
- import { oc as oc6 } from "@orpc/contract";
350
- import { z as z8 } from "zod";
351
- var photoInput = z8.strictObject({
352
- id: documentId,
353
- photoId: documentId
354
- });
355
- var photoPageInput = z8.strictObject({ id: documentId, ...pageFields });
356
- var photoDownloadInput = photoInput.extend({
357
- variant: z8.enum(["original", "thumbnail"]).default("original")
358
- });
359
- var photo = z8.strictObject({
360
- ...documentFields,
361
- kind: z8.string().nullable(),
362
- width: z8.int().nullable(),
363
- height: z8.int().nullable(),
364
- sizeBytes: z8.int().nullable(),
365
- isVertical: z8.boolean().nullable(),
366
- contentType: z8.string().nullable(),
367
- capturedAt: z8.iso.datetime().nullable()
368
- });
369
- var photoPage = z8.strictObject({
370
- items: z8.array(photo),
371
- nextAfter: documentId.nullable()
372
- });
373
- var downloadReference = z8.strictObject({
374
- url: z8.url({ protocol: /^https$/ }),
375
- expiresAt: z8.iso.datetime(),
376
- contentType: z8.string(),
377
- name: z8.string()
378
- });
379
- var trackerPhotoContract = {
380
- list: oc6.meta({ operation: "read" }).errors(apiErrors).input(photoPageInput).output(photoPage),
381
- download: oc6.meta({ operation: "read" }).errors(apiErrors).input(photoDownloadInput).output(downloadReference),
382
- delete: oc6.errors(apiErrors).input(photoInput).output(z8.void())
383
- };
384
-
385
- // ../customer-contracts/src/photo-uploads.ts
386
- import { oc as oc7 } from "@orpc/contract";
387
- import { z as z9 } from "zod";
388
- var photoUploadInput = z9.strictObject({ id: documentId, requestId });
389
- var photoUploadStartInput = photoUploadInput.extend({
390
- kind: z9.enum(["bike", "installation", "receipt"]),
391
- length: z9.int().min(4).max(10 * 1024 * 1024),
392
- sha256: z9.string().regex(/^[a-fA-F0-9]{64}$/).toUpperCase()
393
- });
394
- var photoUploadSession = z9.discriminatedUnion("status", [
395
- z9.strictObject({ status: z9.literal("published"), photoId: documentId }),
396
- z9.strictObject({
397
- status: z9.literal("upload"),
398
- url: z9.url({ protocol: /^https$/ }),
399
- expiresAt: z9.iso.datetime(),
400
- headers: z9.strictObject({
401
- "content-type": z9.literal("image/jpeg"),
402
- "if-none-match": z9.literal("*")
403
- })
404
- })
405
- ]);
406
- var photoUploadContract = {
407
- start: oc7.errors(apiErrors).input(photoUploadStartInput).output(photoUploadSession),
408
- complete: oc7.errors(apiErrors).input(photoUploadInput).output(z9.strictObject({ photoId: documentId }))
409
- };
410
-
411
- // ../customer-contracts/src/theft.ts
412
- import { oc as oc8 } from "@orpc/contract";
413
- import { z as z10 } from "zod";
414
- var theftSubmission = z10.strictObject({
415
- id: documentId,
416
- requestId,
417
- phoneNumber: z10.string().min(1).max(80).refine((value) => {
418
- if (/\p{Cc}/u.test(value)) return false;
419
- const number = value.replaceAll("+", "").replace(/\p{Z}+$/u, "").replace(/(?:ext\.?|x)\p{Z}*\p{Nd}+$/iu, "");
420
- return /\p{Nd}/u.test(number) && /^[\p{Nd}\p{Z}().-]+$/u.test(number);
421
- }, "Supply a contact phone number.")
422
- });
423
- var theftContract = {
424
- submit: oc8.errors(apiErrors).input(theftSubmission).output(z10.strictObject({ reportId: documentId }))
425
- };
426
-
427
- // ../customer-contracts/src/realtime.ts
428
- import { oc as oc9 } from "@orpc/contract";
429
- import { z as z11 } from "zod";
430
- var realtimeTicket = z11.strictObject({
431
- ticket: z11.string().regex(/^[A-Za-z0-9_-]{43}$/),
432
- expiresAt: z11.iso.datetime(),
433
- webSocketUrl: z11.url({ protocol: /^wss?$/ })
434
- });
435
- var realtimeContract = {
436
- ticket: oc9.errors(apiErrors).input(z11.void()).output(realtimeTicket)
437
- };
438
-
439
- // ../customer-contracts/src/history.ts
440
- import { oc as oc10 } from "@orpc/contract";
441
- import { z as z12 } from "zod";
442
- var historyCursor = z12.strictObject({
443
- ...timeCursorFields,
444
- scope: z12.string().regex(/^[a-f0-9]{64}$/)
445
- });
446
- var historyInput = z12.strictObject({
447
- id: documentId,
448
- from: z12.iso.datetime(),
449
- until: z12.iso.datetime(),
450
- limit: pageFields.limit,
451
- after: historyCursor.optional()
452
- });
453
- var historyEntry = z12.strictObject({
454
- ...documentFields,
455
- type: z12.string().nullable(),
456
- observedAt: z12.iso.datetime().nullable(),
457
- latitude: z12.number().nullable(),
458
- longitude: z12.number().nullable(),
459
- accuracy: z12.number().nullable(),
460
- speed: z12.number().nullable(),
461
- altitude: z12.number().nullable(),
462
- heading: z12.number().nullable(),
463
- source: z12.string().nullable(),
464
- battery: z12.strictObject({
465
- level: z12.int().nullable(),
466
- isCharging: z12.boolean().nullable(),
467
- source: z12.string().nullable(),
468
- observedAt: z12.iso.datetime().nullable()
469
- }).nullable()
470
- });
471
- var historyPage = z12.strictObject({
472
- items: z12.array(historyEntry),
473
- nextAfter: historyCursor.nullable()
474
- });
475
- var historyContract = oc10.meta({ operation: "read" }).errors(apiErrors).input(historyInput).output(historyPage);
476
-
477
- // ../customer-contracts/src/firmware.ts
478
- import { oc as oc11 } from "@orpc/contract";
479
- import { z as z13 } from "zod";
480
- var firmwareAvailability = z13.strictObject({
481
- state: z13.enum(["available", "current", "unsupported", "blocked"]),
482
- reason: z13.enum([
483
- "subscriptionRequired",
484
- "accountRestricted",
485
- "temporarilyPaused",
486
- "repeatedFailures",
487
- "locationRequired",
488
- "outsideSupportedArea",
489
- "installedVersionUnknown",
490
- "appUpdateRequired"
491
- ]).nullable(),
492
- retryAfter: z13.iso.datetime().nullable()
493
- });
494
- var trackerFirmwareRelease = z13.strictObject({
495
- id: z13.string().regex(/^[a-f0-9]{64}$/),
496
- fromVersion: z13.string(),
497
- version: z13.string(),
498
- deliveryMethod: z13.literal("bluetoothOad"),
499
- requiredBatteryPercent: z13.int().min(0).max(100)
500
- });
501
- var firmwareAppInput = trackerInput.extend({
502
- platform: z13.enum(["ios", "android"]),
503
- build: z13.int().min(0).max(2147483647)
504
- });
505
- var trackerFirmwareReleases = z13.strictObject({
506
- trackerId: z13.string(),
507
- availability: firmwareAvailability,
508
- items: z13.array(trackerFirmwareRelease).max(1),
509
- revision: z13.string().regex(/^[a-f0-9]{64}$/)
510
- });
511
- var firmwareTransfer = z13.strictObject({
512
- imageUrl: z13.url({ protocol: /^https$/ }),
513
- blockSize: z13.int().min(5).max(512),
514
- requiredBatteryPercent: z13.int().min(0).max(100),
515
- blockTimeoutMs: z13.int().min(1e3).max(6e4),
516
- rebootTimeoutMs: z13.int().min(1e3).max(6e4)
517
- });
518
- var firmwareUpdateInput = trackerInput.extend({ updateId: requestId });
519
- var startFirmwareUpdate = firmwareAppInput.extend({
520
- updateId: requestId,
521
- releaseId: z13.string().regex(/^[a-f0-9]{64}$/),
522
- expectedRevision: z13.string().regex(/^[a-f0-9]{64}$/).optional()
523
- });
524
- var firmwareReportOutcome = z13.enum([
525
- "transferFailed",
526
- "targetVersionObserved"
527
- ]);
528
- var firmwareReportInput = firmwareUpdateInput.extend({
529
- attemptId: requestId,
530
- outcome: firmwareReportOutcome
531
- });
532
- var firmwareClientReport = z13.strictObject({
533
- attemptId: requestId,
534
- outcome: firmwareReportOutcome,
535
- reportedAt: z13.iso.datetime(),
536
- pinnedTargetCleared: z13.boolean()
537
- });
538
- var trackerFirmwareUpdate = z13.strictObject({
539
- updateId: requestId,
540
- trackerId: z13.string(),
541
- requestedAt: z13.iso.datetime(),
542
- release: trackerFirmwareRelease,
543
- transfer: firmwareTransfer,
544
- latestClientReport: firmwareClientReport.nullable()
545
- });
546
- var gen1FirmwareContract = {
547
- start: oc11.errors(apiErrors).input(startFirmwareUpdate).output(trackerFirmwareUpdate),
548
- get: oc11.meta({ operation: "read" }).errors(apiErrors).input(firmwareUpdateInput).output(trackerFirmwareUpdate),
549
- report: oc11.errors(apiErrors).input(firmwareReportInput).output(firmwareClientReport),
550
- catalog: oc11.meta({ operation: "read" }).errors(apiErrors).input(firmwareAppInput).output(trackerFirmwareReleases)
551
- };
552
-
553
- // ../customer-contracts/src/session-migration.ts
554
- import { z as z14 } from "zod";
555
- var token = z14.string().min(1).max(16384).regex(/^[\x21-\x7e]+$/);
556
- var migratedSession = z14.strictObject({
557
- accessToken: token,
558
- refreshToken: token,
559
- expiresIn: z14.int32().positive()
560
- });
561
-
562
- // ../customer-contracts/src/subscriptions.ts
563
- import { oc as oc12, eventIterator as eventIterator3 } from "@orpc/contract";
564
- import { z as z15 } from "zod";
565
- var subscription = z15.strictObject({
566
- ...documentFields,
567
- accountId: z15.string().nullable(),
568
- name: z15.string().nullable(),
569
- quantity: z15.int().nullable(),
570
- available: z15.int().nullable(),
571
- trackers: z15.array(
572
- z15.strictObject({
573
- trackerId: z15.string(),
574
- addedAt: z15.iso.datetime().nullable()
575
- })
576
- ),
577
- active: z15.boolean().nullable(),
578
- status: z15.string().nullable(),
579
- endsAt: z15.iso.datetime().nullable(),
580
- nextPaymentAt: z15.iso.datetime().nullable(),
581
- managementUrl: z15.string().nullable(),
582
- country: z15.string().nullable(),
583
- demo: z15.boolean().nullable(),
584
- type: z15.string().nullable(),
585
- deleted: z15.boolean()
586
- });
587
- var subscriptionPage = z15.strictObject({
588
- items: z15.array(subscription),
589
- nextAfter: z15.string().nullable()
590
- });
591
- var subscriptionContract = {
592
- get: oc12.meta({ operation: "read" }).errors(apiErrors).input(trackerInput).output(subscription),
593
- list: oc12.meta({ operation: "read" }).errors(apiErrors).input(pageInput).output(subscriptionPage),
594
- watch: oc12.meta({ operation: "read" }).errors(apiErrors).input(pageInput).output(eventIterator3(subscriptionPage))
595
- };
596
- var subscriptionAllocationInput = z15.strictObject({
597
- id: documentId,
598
- subscriptionId: documentId.nullable(),
599
- expectedSubscriptionId: documentId.nullable()
600
- });
601
- var subscriptionAllocationContract = {
602
- change: oc12.errors(apiErrors).input(subscriptionAllocationInput).output(z15.void())
603
- };
604
-
605
- // ../customer-contracts/src/bluetooth.ts
606
- import { oc as oc13 } from "@orpc/contract";
607
- import { z as z16 } from "zod";
608
- var bluetoothPin = z16.array(z16.int().min(0).max(255)).length(19);
609
- var bluetoothCredentials = z16.strictObject({
610
- ...documentFields,
611
- pin: bluetoothPin,
612
- crowdKey: z16.int().min(0).max(16777215).nullable(),
613
- rotationRequested: z16.boolean()
614
- });
615
- var bluetoothPinChange = z16.strictObject({
616
- id: documentId,
617
- trackerCreatedAt: z16.iso.datetime(),
618
- before: bluetoothPin,
619
- after: bluetoothPin,
620
- clearRotation: z16.boolean()
621
- });
622
- var factoryResetReport = z16.strictObject({
623
- id: documentId,
624
- requestId,
625
- trackerCreatedAt: z16.iso.datetime()
626
- });
627
- var batteryObservation = z16.strictObject({
628
- id: documentId,
629
- observedAt: z16.iso.datetime(),
630
- level: z16.int().min(0).max(100).nullable(),
631
- isCharging: z16.boolean()
632
- });
633
- var locationObservation = z16.strictObject({
634
- id: documentId,
635
- requestId,
636
- observedAt: z16.iso.datetime({ offset: true }),
637
- source: z16.enum(["BLE", "CBT"]),
638
- latitude: z16.number().min(-90).max(90),
639
- longitude: z16.number().min(-180).max(180),
640
- accuracy: z16.number().min(0).max(1e5),
641
- batteryLevel: z16.int().min(0).max(100).nullable(),
642
- isCharging: z16.boolean(),
643
- crowdKey: z16.int().min(0).max(16777215).nullable(),
644
- rssi: z16.int().min(-127).max(20).nullable()
645
- }).refine(
646
- (value) => value.source !== "CBT" || value.crowdKey !== null,
647
- "Crowd observations require a crowd key."
648
- );
649
- var bluetoothContract = {
650
- reportLocation: oc13.errors(apiErrors).input(locationObservation).output(z16.strictObject({ observationId: documentId })),
651
- credentials: oc13.meta({ operation: "read" }).errors(apiErrors).input(trackerInput).output(bluetoothCredentials),
652
- changePin: oc13.errors(apiErrors).input(bluetoothPinChange).output(z16.void()),
653
- reportFactoryReset: oc13.errors(apiErrors).input(factoryResetReport).output(z16.void()),
654
- reportBattery: oc13.errors(apiErrors).input(batteryObservation).output(z16.void())
655
- };
656
-
657
- // ../customer-contracts/src/discovery.ts
658
- import { z as z17 } from "zod";
659
- import { oc as oc14 } from "@orpc/contract";
660
- var trackerLookupInput = z17.discriminatedUnion("by", [
661
- z17.strictObject({ by: z17.literal("id"), value: documentId }),
662
- z17.strictObject({
663
- by: z17.literal("serialNumber"),
664
- value: z17.string().min(1).max(128).regex(/^[^\p{Cc}]+$/u).refine((value) => value.trim().length > 0)
665
- })
666
- ]);
667
- var trackerAdmission = z17.strictObject({
668
- id: documentId,
669
- isMember: z17.boolean(),
670
- canClaim: z17.boolean()
671
- });
672
- var trackerLookupContract = oc14.meta({ operation: "read" }).errors(apiErrors).input(trackerLookupInput).output(trackerAdmission);
673
-
674
- // ../customer-contracts/src/index.ts
675
- import { oc as oc15, eventIterator as eventIterator4 } from "@orpc/contract";
676
- import { z as z18 } from "zod";
677
- var procedure = oc15.errors(apiErrors).input(trackerInput);
678
- var customerContract = {
679
- realtime: realtimeContract,
680
- subscriptions: subscriptionContract,
681
- account: accountContract,
682
- trackers: {
683
- firmware: gen1FirmwareContract,
684
- subscription: subscriptionAllocationContract,
685
- history: historyContract,
686
- theft: theftContract,
687
- lookup: trackerLookupContract,
688
- bluetooth: bluetoothContract,
689
- photos: { ...trackerPhotoContract, uploads: photoUploadContract },
690
- invitations: trackerInvitationContract,
691
- ...trackerChangeContract,
692
- claim: oc15.errors(apiErrors).input(trackerClaimInput).output(z18.void()),
693
- list: oc15.meta({ operation: "read" }).errors(apiErrors).input(pageInput).output(trackerPage),
694
- watchPage: oc15.meta({ operation: "read" }).errors(apiErrors).input(pageInput).output(eventIterator4(trackerPage)),
695
- get: procedure.meta({ operation: "read" }).output(tracker),
696
- watch: procedure.meta({ operation: "read" }).output(eventIterator4(tracker))
697
- }
698
- };
699
-
700
- export {
701
- trackerBike,
702
- trackerBattery,
703
- trackerLocation,
704
- trackerSubscription,
705
- trackerFirmware,
706
- trackerMember,
707
- trackerSummaryFields,
708
- trackerFields,
709
- trackerSummary,
710
- trackerPage,
711
- tracker,
712
- pushToken,
713
- pushRegistrationInput,
714
- pushRemovalInput,
715
- pushContract,
716
- notificationSource,
717
- inboxPageInput,
718
- notification,
719
- inboxPage,
720
- inboxContract,
721
- directoryProfile,
722
- accountPreferences,
723
- account,
724
- accountPreferencePatch,
725
- bikeChanges,
726
- bikeEditInput,
727
- membershipName,
728
- trackerClaimInput,
729
- trackerMemberInput,
730
- trackerMemberAddInput,
731
- trackerMovementAlertsInput,
732
- trackerChangeContract,
733
- invitationInput,
734
- invitationRedeemInput,
735
- trackerInvitation,
736
- trackerInvitationContract,
737
- photoInput,
738
- photoPageInput,
739
- photoDownloadInput,
740
- photo,
741
- photoPage,
742
- downloadReference,
743
- trackerPhotoContract,
744
- photoUploadInput,
745
- photoUploadStartInput,
746
- photoUploadSession,
747
- photoUploadContract,
748
- theftSubmission,
749
- theftContract,
750
- realtimeTicket,
751
- realtimeContract,
752
- historyCursor,
753
- historyInput,
754
- historyEntry,
755
- historyPage,
756
- historyContract,
757
- firmwareAvailability,
758
- trackerFirmwareRelease,
759
- firmwareAppInput,
760
- trackerFirmwareReleases,
761
- firmwareTransfer,
762
- firmwareUpdateInput,
763
- startFirmwareUpdate,
764
- firmwareReportOutcome,
765
- firmwareReportInput,
766
- firmwareClientReport,
767
- trackerFirmwareUpdate,
768
- gen1FirmwareContract,
769
- migratedSession,
770
- subscription,
771
- subscriptionPage,
772
- subscriptionContract,
773
- subscriptionAllocationInput,
774
- subscriptionAllocationContract,
775
- bluetoothPin,
776
- bluetoothCredentials,
777
- bluetoothPinChange,
778
- factoryResetReport,
779
- batteryObservation,
780
- locationObservation,
781
- bluetoothContract,
782
- trackerLookupInput,
783
- trackerAdmission,
784
- trackerLookupContract,
785
- customerContract
786
- };