@teardown/schemas 0.1.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.
Files changed (61) hide show
  1. package/dist/common/index.d.ts +3 -0
  2. package/dist/common/index.js +3 -0
  3. package/dist/common/primitives.d.ts +11 -0
  4. package/dist/common/primitives.js +9 -0
  5. package/dist/common/responses.d.ts +27 -0
  6. package/dist/common/responses.js +13 -0
  7. package/dist/common/type-checks.d.ts +58 -0
  8. package/dist/common/type-checks.js +1 -0
  9. package/dist/index.d.ts +13 -0
  10. package/dist/index.js +14 -0
  11. package/dist/modules/analytics/index.d.ts +1 -0
  12. package/dist/modules/analytics/index.js +1 -0
  13. package/dist/modules/analytics/schemas.d.ts +239 -0
  14. package/dist/modules/analytics/schemas.js +136 -0
  15. package/dist/modules/builds/index.d.ts +1 -0
  16. package/dist/modules/builds/index.js +1 -0
  17. package/dist/modules/builds/schemas.d.ts +248 -0
  18. package/dist/modules/builds/schemas.js +137 -0
  19. package/dist/modules/devices/index.d.ts +1 -0
  20. package/dist/modules/devices/index.js +1 -0
  21. package/dist/modules/devices/schemas.d.ts +207 -0
  22. package/dist/modules/devices/schemas.js +165 -0
  23. package/dist/modules/environment/index.d.ts +1 -0
  24. package/dist/modules/environment/index.js +1 -0
  25. package/dist/modules/environment/schemas.d.ts +56 -0
  26. package/dist/modules/environment/schemas.js +57 -0
  27. package/dist/modules/events/index.d.ts +1 -0
  28. package/dist/modules/events/index.js +1 -0
  29. package/dist/modules/events/schemas.d.ts +138 -0
  30. package/dist/modules/events/schemas.js +116 -0
  31. package/dist/modules/identify/index.d.ts +1 -0
  32. package/dist/modules/identify/index.js +1 -0
  33. package/dist/modules/identify/schemas.d.ts +377 -0
  34. package/dist/modules/identify/schemas.js +221 -0
  35. package/dist/modules/index.d.ts +12 -0
  36. package/dist/modules/index.js +12 -0
  37. package/dist/modules/me/index.d.ts +1 -0
  38. package/dist/modules/me/index.js +1 -0
  39. package/dist/modules/me/schemas.d.ts +75 -0
  40. package/dist/modules/me/schemas.js +76 -0
  41. package/dist/modules/orgs/index.d.ts +1 -0
  42. package/dist/modules/orgs/index.js +1 -0
  43. package/dist/modules/orgs/schemas.d.ts +308 -0
  44. package/dist/modules/orgs/schemas.js +214 -0
  45. package/dist/modules/personas/index.d.ts +1 -0
  46. package/dist/modules/personas/index.js +1 -0
  47. package/dist/modules/personas/schemas.d.ts +170 -0
  48. package/dist/modules/personas/schemas.js +100 -0
  49. package/dist/modules/projects/index.d.ts +1 -0
  50. package/dist/modules/projects/index.js +1 -0
  51. package/dist/modules/projects/schemas.d.ts +222 -0
  52. package/dist/modules/projects/schemas.js +145 -0
  53. package/dist/modules/sessions/index.d.ts +1 -0
  54. package/dist/modules/sessions/index.js +1 -0
  55. package/dist/modules/sessions/schemas.d.ts +258 -0
  56. package/dist/modules/sessions/schemas.js +128 -0
  57. package/dist/modules/versions/index.d.ts +1 -0
  58. package/dist/modules/versions/index.js +1 -0
  59. package/dist/modules/versions/schemas.d.ts +248 -0
  60. package/dist/modules/versions/schemas.js +155 -0
  61. package/package.json +106 -0
@@ -0,0 +1,377 @@
1
+ import { DevicePlatformEnum } from "@teardown/types";
2
+ import { type Static } from "elysia";
3
+ export { DevicePlatformEnum };
4
+ /**
5
+ * Application info schema
6
+ */
7
+ export declare const ApplicationInfoSchema: import("@sinclair/typebox").TObject<{
8
+ version: import("@sinclair/typebox").TString;
9
+ build_number: import("@sinclair/typebox").TString;
10
+ }>;
11
+ export type ApplicationInfo = Static<typeof ApplicationInfoSchema>;
12
+ /**
13
+ * OS info schema
14
+ */
15
+ export declare const OSInfoSchema: import("@sinclair/typebox").TObject<{
16
+ /**
17
+ * Device platform
18
+ */
19
+ platform: import("@sinclair/typebox").TEnum<typeof DevicePlatformEnum>;
20
+ /**
21
+ * OS name
22
+ */
23
+ name: import("@sinclair/typebox").TString;
24
+ /**
25
+ * OS version
26
+ */
27
+ version: import("@sinclair/typebox").TString;
28
+ }>;
29
+ export type OSInfo = Static<typeof OSInfoSchema>;
30
+ /**
31
+ * Hardware info schema
32
+ */
33
+ export declare const HardwareInfoSchema: import("@sinclair/typebox").TObject<{
34
+ device_name: import("@sinclair/typebox").TString;
35
+ device_type: import("@sinclair/typebox").TString;
36
+ device_brand: import("@sinclair/typebox").TString;
37
+ }>;
38
+ export type HardwareInfo = Static<typeof HardwareInfoSchema>;
39
+ export declare const EmergencyLaunchSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
40
+ is_emergency_launch: import("@sinclair/typebox").TLiteral<true>;
41
+ reason: import("@sinclair/typebox").TString;
42
+ }>, import("@sinclair/typebox").TObject<{
43
+ is_emergency_launch: import("@sinclair/typebox").TLiteral<false>;
44
+ reason: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNever>;
45
+ }>]>;
46
+ export type EmergencyLaunch = Static<typeof EmergencyLaunchSchema>;
47
+ /**
48
+ * Update info schema
49
+ */
50
+ export declare const DeviceUpdateInfoSchema: import("@sinclair/typebox").TObject<{
51
+ is_enabled: import("@sinclair/typebox").TBoolean;
52
+ update_id: import("@sinclair/typebox").TString;
53
+ update_channel: import("@sinclair/typebox").TString;
54
+ runtime_version: import("@sinclair/typebox").TString;
55
+ emergency_launch: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
56
+ is_emergency_launch: import("@sinclair/typebox").TLiteral<true>;
57
+ reason: import("@sinclair/typebox").TString;
58
+ }>, import("@sinclair/typebox").TObject<{
59
+ is_emergency_launch: import("@sinclair/typebox").TLiteral<false>;
60
+ reason: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNever>;
61
+ }>]>;
62
+ is_embedded_launch: import("@sinclair/typebox").TBoolean;
63
+ created_at: import("@sinclair/typebox").TString;
64
+ }>;
65
+ export type DeviceUpdateInfo = Static<typeof DeviceUpdateInfoSchema>;
66
+ export declare enum NotificationPlatform {
67
+ APNS = "APNS",// Apple Push Notification Service
68
+ FCM = "FCM",// Firebase Cloud Messaging
69
+ EXPO = "EXPO"
70
+ }
71
+ /**
72
+ * Push notification info schema
73
+ */
74
+ export declare const PushNotificationInfoSchema: import("@sinclair/typebox").TObject<{
75
+ enabled: import("@sinclair/typebox").TBoolean;
76
+ granted: import("@sinclair/typebox").TBoolean;
77
+ token: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
78
+ platform: import("@sinclair/typebox").TEnum<typeof NotificationPlatform>;
79
+ }>;
80
+ export type PushNotificationInfo = Static<typeof PushNotificationInfoSchema>;
81
+ export declare const NotificationsInfoSchema: import("@sinclair/typebox").TObject<{
82
+ push: import("@sinclair/typebox").TObject<{
83
+ enabled: import("@sinclair/typebox").TBoolean;
84
+ granted: import("@sinclair/typebox").TBoolean;
85
+ token: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
86
+ platform: import("@sinclair/typebox").TEnum<typeof NotificationPlatform>;
87
+ }>;
88
+ }>;
89
+ export type NotificationsInfo = Static<typeof NotificationsInfoSchema>;
90
+ /**
91
+ * Device info schema
92
+ */
93
+ export declare const DeviceInfoSchema: import("@sinclair/typebox").TObject<{
94
+ /**
95
+ * Timestamp of collection on device (optional, generated server-side if not provided)
96
+ */
97
+ timestamp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TDate>;
98
+ /**
99
+ * Application info, required
100
+ */
101
+ application: import("@sinclair/typebox").TObject<{
102
+ version: import("@sinclair/typebox").TString;
103
+ build_number: import("@sinclair/typebox").TString;
104
+ }>;
105
+ /**
106
+ * Update info (optional) - not all builds will have an update
107
+ */
108
+ update: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
109
+ is_enabled: import("@sinclair/typebox").TBoolean;
110
+ update_id: import("@sinclair/typebox").TString;
111
+ update_channel: import("@sinclair/typebox").TString;
112
+ runtime_version: import("@sinclair/typebox").TString;
113
+ emergency_launch: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
114
+ is_emergency_launch: import("@sinclair/typebox").TLiteral<true>;
115
+ reason: import("@sinclair/typebox").TString;
116
+ }>, import("@sinclair/typebox").TObject<{
117
+ is_emergency_launch: import("@sinclair/typebox").TLiteral<false>;
118
+ reason: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNever>;
119
+ }>]>;
120
+ is_embedded_launch: import("@sinclair/typebox").TBoolean;
121
+ created_at: import("@sinclair/typebox").TString;
122
+ }>, import("@sinclair/typebox").TNull]>;
123
+ /**
124
+ * Hardware info, required
125
+ */
126
+ hardware: import("@sinclair/typebox").TObject<{
127
+ device_name: import("@sinclair/typebox").TString;
128
+ device_type: import("@sinclair/typebox").TString;
129
+ device_brand: import("@sinclair/typebox").TString;
130
+ }>;
131
+ /**
132
+ * OS info, required
133
+ */
134
+ os: import("@sinclair/typebox").TObject<{
135
+ /**
136
+ * Device platform
137
+ */
138
+ platform: import("@sinclair/typebox").TEnum<typeof DevicePlatformEnum>;
139
+ /**
140
+ * OS name
141
+ */
142
+ name: import("@sinclair/typebox").TString;
143
+ /**
144
+ * OS version
145
+ */
146
+ version: import("@sinclair/typebox").TString;
147
+ }>;
148
+ /**
149
+ * Notifications info, required
150
+ */
151
+ notifications: import("@sinclair/typebox").TObject<{
152
+ push: import("@sinclair/typebox").TObject<{
153
+ enabled: import("@sinclair/typebox").TBoolean;
154
+ granted: import("@sinclair/typebox").TBoolean;
155
+ token: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
156
+ platform: import("@sinclair/typebox").TEnum<typeof NotificationPlatform>;
157
+ }>;
158
+ }>;
159
+ }>;
160
+ export type DeviceInfo = Static<typeof DeviceInfoSchema>;
161
+ /**
162
+ * Persona info schema (optional fields)
163
+ * Matches personas table structure
164
+ */
165
+ export declare const PersonaInfoSchema: import("@sinclair/typebox").TObject<{
166
+ user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
167
+ email: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<"">, import("@sinclair/typebox").TUndefined]>>, string | undefined>>;
168
+ name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
169
+ }>;
170
+ export type PersonaInfo = Static<typeof PersonaInfoSchema>;
171
+ /**
172
+ * Identify request schema
173
+ * Ties a device to a persona with optional persona data
174
+ */
175
+ export declare const IdentifyRequestSchema: import("@sinclair/typebox").TObject<{
176
+ device: import("@sinclair/typebox").TObject<{
177
+ /**
178
+ * Timestamp of collection on device (optional, generated server-side if not provided)
179
+ */
180
+ timestamp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TDate>;
181
+ /**
182
+ * Application info, required
183
+ */
184
+ application: import("@sinclair/typebox").TObject<{
185
+ version: import("@sinclair/typebox").TString;
186
+ build_number: import("@sinclair/typebox").TString;
187
+ }>;
188
+ /**
189
+ * Update info (optional) - not all builds will have an update
190
+ */
191
+ update: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
192
+ is_enabled: import("@sinclair/typebox").TBoolean;
193
+ update_id: import("@sinclair/typebox").TString;
194
+ update_channel: import("@sinclair/typebox").TString;
195
+ runtime_version: import("@sinclair/typebox").TString;
196
+ emergency_launch: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
197
+ is_emergency_launch: import("@sinclair/typebox").TLiteral<true>;
198
+ reason: import("@sinclair/typebox").TString;
199
+ }>, import("@sinclair/typebox").TObject<{
200
+ is_emergency_launch: import("@sinclair/typebox").TLiteral<false>;
201
+ reason: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNever>;
202
+ }>]>;
203
+ is_embedded_launch: import("@sinclair/typebox").TBoolean;
204
+ created_at: import("@sinclair/typebox").TString;
205
+ }>, import("@sinclair/typebox").TNull]>;
206
+ /**
207
+ * Hardware info, required
208
+ */
209
+ hardware: import("@sinclair/typebox").TObject<{
210
+ device_name: import("@sinclair/typebox").TString;
211
+ device_type: import("@sinclair/typebox").TString;
212
+ device_brand: import("@sinclair/typebox").TString;
213
+ }>;
214
+ /**
215
+ * OS info, required
216
+ */
217
+ os: import("@sinclair/typebox").TObject<{
218
+ /**
219
+ * Device platform
220
+ */
221
+ platform: import("@sinclair/typebox").TEnum<typeof DevicePlatformEnum>;
222
+ /**
223
+ * OS name
224
+ */
225
+ name: import("@sinclair/typebox").TString;
226
+ /**
227
+ * OS version
228
+ */
229
+ version: import("@sinclair/typebox").TString;
230
+ }>;
231
+ /**
232
+ * Notifications info, required
233
+ */
234
+ notifications: import("@sinclair/typebox").TObject<{
235
+ push: import("@sinclair/typebox").TObject<{
236
+ enabled: import("@sinclair/typebox").TBoolean;
237
+ granted: import("@sinclair/typebox").TBoolean;
238
+ token: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
239
+ platform: import("@sinclair/typebox").TEnum<typeof NotificationPlatform>;
240
+ }>;
241
+ }>;
242
+ }>;
243
+ persona: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
244
+ user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
245
+ email: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<"">, import("@sinclair/typebox").TUndefined]>>, string | undefined>>;
246
+ name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
247
+ }>>;
248
+ }>;
249
+ export type IdentifyRequest = Static<typeof IdentifyRequestSchema>;
250
+ export declare enum IdentifyVersionStatusEnum {
251
+ /**
252
+ * A new version is available
253
+ */
254
+ UPDATE_AVAILABLE = "UPDATE_AVAILABLE",
255
+ /**
256
+ * An update is required
257
+ */
258
+ UPDATE_REQUIRED = "UPDATE_REQUIRED",
259
+ /**
260
+ * The current version is valid & up to date
261
+ */
262
+ UP_TO_DATE = "UP_TO_DATE",
263
+ /**
264
+ * The version or build has been disabled
265
+ */
266
+ DISABLED = "DISABLED"
267
+ }
268
+ export declare const UpdateInfoSchema: import("@sinclair/typebox").TObject<{
269
+ version: import("@sinclair/typebox").TString;
270
+ build: import("@sinclair/typebox").TString;
271
+ update_id: import("@sinclair/typebox").TString;
272
+ effective_date: import("@sinclair/typebox").TDate;
273
+ }>;
274
+ export type UpdateInfo = Static<typeof UpdateInfoSchema>;
275
+ export declare const UpToDateInfoSchema: import("@sinclair/typebox").TObject<{
276
+ status: import("@sinclair/typebox").TLiteral<IdentifyVersionStatusEnum.UP_TO_DATE>;
277
+ update: import("@sinclair/typebox").TNull;
278
+ }>;
279
+ export type UpToDateInfo = Static<typeof UpToDateInfoSchema>;
280
+ export declare const UpdateRequiredInfoSchema: import("@sinclair/typebox").TObject<{
281
+ status: import("@sinclair/typebox").TLiteral<IdentifyVersionStatusEnum.UPDATE_REQUIRED>;
282
+ update: import("@sinclair/typebox").TObject<{
283
+ version: import("@sinclair/typebox").TString;
284
+ build: import("@sinclair/typebox").TString;
285
+ update_id: import("@sinclair/typebox").TString;
286
+ effective_date: import("@sinclair/typebox").TDate;
287
+ }>;
288
+ }>;
289
+ export type UpdateRequiredInfo = Static<typeof UpdateRequiredInfoSchema>;
290
+ export declare const UpdateAvailableInfoSchema: import("@sinclair/typebox").TObject<{
291
+ status: import("@sinclair/typebox").TLiteral<IdentifyVersionStatusEnum.UPDATE_AVAILABLE>;
292
+ update: import("@sinclair/typebox").TObject<{
293
+ version: import("@sinclair/typebox").TString;
294
+ build: import("@sinclair/typebox").TString;
295
+ update_id: import("@sinclair/typebox").TString;
296
+ effective_date: import("@sinclair/typebox").TDate;
297
+ }>;
298
+ }>;
299
+ export type UpdateAvailableInfo = Static<typeof UpdateAvailableInfoSchema>;
300
+ export declare const VersionInfoSchema: import("@sinclair/typebox").TObject<{
301
+ /**
302
+ * The status of the version
303
+ */
304
+ status: import("@sinclair/typebox").TEnum<typeof IdentifyVersionStatusEnum>;
305
+ update: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
306
+ status: import("@sinclair/typebox").TLiteral<IdentifyVersionStatusEnum.UPDATE_AVAILABLE>;
307
+ update: import("@sinclair/typebox").TObject<{
308
+ version: import("@sinclair/typebox").TString;
309
+ build: import("@sinclair/typebox").TString;
310
+ update_id: import("@sinclair/typebox").TString;
311
+ effective_date: import("@sinclair/typebox").TDate;
312
+ }>;
313
+ }>, import("@sinclair/typebox").TNull]>>;
314
+ }>;
315
+ export type VersionInfo = Static<typeof VersionInfoSchema>;
316
+ /**
317
+ * Identify response schema
318
+ */
319
+ export declare const IdentifyResponseSchema: import("@sinclair/typebox").TObject<{
320
+ success: import("@sinclair/typebox").TLiteral<true>;
321
+ data: import("@sinclair/typebox").TObject<{
322
+ session_id: import("@sinclair/typebox").TString;
323
+ device_id: import("@sinclair/typebox").TString;
324
+ persona_id: import("@sinclair/typebox").TString;
325
+ token: import("@sinclair/typebox").TString;
326
+ version_info: import("@sinclair/typebox").TObject<{
327
+ /**
328
+ * The status of the version
329
+ */
330
+ status: import("@sinclair/typebox").TEnum<typeof IdentifyVersionStatusEnum>;
331
+ update: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
332
+ status: import("@sinclair/typebox").TLiteral<IdentifyVersionStatusEnum.UPDATE_AVAILABLE>;
333
+ update: import("@sinclair/typebox").TObject<{
334
+ version: import("@sinclair/typebox").TString;
335
+ build: import("@sinclair/typebox").TString;
336
+ update_id: import("@sinclair/typebox").TString;
337
+ effective_date: import("@sinclair/typebox").TDate;
338
+ }>;
339
+ }>, import("@sinclair/typebox").TNull]>>;
340
+ }>;
341
+ }>;
342
+ }>;
343
+ export type IdentifyResponse = Static<typeof IdentifyResponseSchema>;
344
+ export declare const IdentifyErrorResponseSchema: import("@sinclair/typebox").TObject<{
345
+ success: import("@sinclair/typebox").TLiteral<false>;
346
+ error: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
347
+ code: import("@sinclair/typebox").TLiteral<"MISSING_ORG_ID">;
348
+ message: import("@sinclair/typebox").TString;
349
+ }>, import("@sinclair/typebox").TObject<{
350
+ code: import("@sinclair/typebox").TLiteral<"MISSING_PROJECT_ID">;
351
+ message: import("@sinclair/typebox").TString;
352
+ }>, import("@sinclair/typebox").TObject<{
353
+ code: import("@sinclair/typebox").TLiteral<"MISSING_ENVIRONMENT_SLUG">;
354
+ message: import("@sinclair/typebox").TString;
355
+ }>, import("@sinclair/typebox").TObject<{
356
+ code: import("@sinclair/typebox").TLiteral<"MISSING_DEVICE_ID">;
357
+ message: import("@sinclair/typebox").TString;
358
+ }>, import("@sinclair/typebox").TObject<{
359
+ code: import("@sinclair/typebox").TLiteral<"IDENTIFY_FAILED">;
360
+ message: import("@sinclair/typebox").TString;
361
+ }>, import("@sinclair/typebox").TObject<{
362
+ code: import("@sinclair/typebox").TLiteral<"NO_SESSION_ID_GENERATED">;
363
+ message: import("@sinclair/typebox").TString;
364
+ }>, import("@sinclair/typebox").TObject<{
365
+ code: import("@sinclair/typebox").TLiteral<"NO_DEVICE_ID_GENERATED">;
366
+ message: import("@sinclair/typebox").TString;
367
+ }>, import("@sinclair/typebox").TObject<{
368
+ code: import("@sinclair/typebox").TLiteral<"NO_PERSONA_ID_GENERATED">;
369
+ message: import("@sinclair/typebox").TString;
370
+ }>]>;
371
+ }>;
372
+ export type IdentifyErrorResponse = Static<typeof IdentifyErrorResponseSchema>;
373
+ export declare const ValidationErrorSchema: import("@sinclair/typebox").TObject<{
374
+ success: import("@sinclair/typebox").TLiteral<false>;
375
+ error: import("@sinclair/typebox").TLiteral<"VALIDATION">;
376
+ message: import("@sinclair/typebox").TString;
377
+ }>;
@@ -0,0 +1,221 @@
1
+ import { DevicePlatformEnum } from "@teardown/types";
2
+ import { t } from "elysia";
3
+ import { EmailSchema } from "../../common";
4
+ export { DevicePlatformEnum };
5
+ /**
6
+ * Application info schema
7
+ */
8
+ export const ApplicationInfoSchema = t.Object({
9
+ version: t.String({ error: "version is required" }),
10
+ build_number: t.String({ error: "build_number is required" }),
11
+ });
12
+ /**
13
+ * OS info schema
14
+ */
15
+ export const OSInfoSchema = t.Object({
16
+ /**
17
+ * Device platform
18
+ */
19
+ platform: t.Enum(DevicePlatformEnum, { error: "platform is required" }),
20
+ /**
21
+ * OS name
22
+ */
23
+ name: t.String({ error: "name is required" }),
24
+ /**
25
+ * OS version
26
+ */
27
+ version: t.String({ error: "version is required" }),
28
+ });
29
+ /**
30
+ * Hardware info schema
31
+ */
32
+ export const HardwareInfoSchema = t.Object({
33
+ device_name: t.String({ error: "device_name is required" }),
34
+ device_type: t.String({ error: "device_type is required" }),
35
+ device_brand: t.String({ error: "device_brand is required" }),
36
+ });
37
+ export const EmergencyLaunchSchema = t.Union([
38
+ t.Object({
39
+ is_emergency_launch: t.Literal(true),
40
+ reason: t.String({ error: "reason is required when is_emergency_launch is true" }),
41
+ }),
42
+ t.Object({
43
+ is_emergency_launch: t.Literal(false),
44
+ reason: t.Optional(t.Never()),
45
+ }),
46
+ ]);
47
+ /**
48
+ * Update info schema
49
+ */
50
+ export const DeviceUpdateInfoSchema = t.Object({
51
+ is_enabled: t.Boolean(),
52
+ update_id: t.String({ error: "update_id is required" }),
53
+ update_channel: t.String({ error: "update_channel is required" }),
54
+ runtime_version: t.String({ error: "runtime_version is required" }),
55
+ emergency_launch: EmergencyLaunchSchema,
56
+ is_embedded_launch: t.Boolean({ error: "is_embedded_launch is required" }),
57
+ created_at: t.String(),
58
+ });
59
+ export var NotificationPlatform;
60
+ (function (NotificationPlatform) {
61
+ NotificationPlatform["APNS"] = "APNS";
62
+ NotificationPlatform["FCM"] = "FCM";
63
+ NotificationPlatform["EXPO"] = "EXPO";
64
+ })(NotificationPlatform || (NotificationPlatform = {}));
65
+ /**
66
+ * Push notification info schema
67
+ */
68
+ export const PushNotificationInfoSchema = t.Object({
69
+ enabled: t.Boolean({ error: "enabled is required" }),
70
+ granted: t.Boolean({ error: "granted is required" }),
71
+ token: t.Union([t.String({ error: "token is required" }), t.Null()]),
72
+ platform: t.Enum(NotificationPlatform, { error: "platform is required" }),
73
+ });
74
+ export const NotificationsInfoSchema = t.Object({
75
+ push: PushNotificationInfoSchema,
76
+ });
77
+ /**
78
+ * Device info schema
79
+ */
80
+ export const DeviceInfoSchema = t.Object({
81
+ /**
82
+ * Timestamp of collection on device (optional, generated server-side if not provided)
83
+ */
84
+ timestamp: t.Optional(t.Date({ error: "timestamp is required" })),
85
+ /**
86
+ * Application info, required
87
+ */
88
+ application: ApplicationInfoSchema,
89
+ /**
90
+ * Update info (optional) - not all builds will have an update
91
+ */
92
+ update: t.Union([DeviceUpdateInfoSchema, t.Null()]),
93
+ /**
94
+ * Hardware info, required
95
+ */
96
+ hardware: HardwareInfoSchema,
97
+ /**
98
+ * OS info, required
99
+ */
100
+ os: OSInfoSchema,
101
+ /**
102
+ * Notifications info, required
103
+ */
104
+ notifications: NotificationsInfoSchema,
105
+ });
106
+ /**
107
+ * Persona info schema (optional fields)
108
+ * Matches personas table structure
109
+ */
110
+ export const PersonaInfoSchema = t.Object({
111
+ user_id: t.Optional(t.String({ error: "user_id is required" })),
112
+ email: t.Optional(EmailSchema),
113
+ name: t.Optional(t.String({ error: "name is required" })),
114
+ });
115
+ /**
116
+ * Identify request schema
117
+ * Ties a device to a persona with optional persona data
118
+ */
119
+ export const IdentifyRequestSchema = t.Object({
120
+ device: DeviceInfoSchema,
121
+ persona: t.Optional(PersonaInfoSchema),
122
+ });
123
+ export var IdentifyVersionStatusEnum;
124
+ (function (IdentifyVersionStatusEnum) {
125
+ /**
126
+ * A new version is available
127
+ */
128
+ IdentifyVersionStatusEnum["UPDATE_AVAILABLE"] = "UPDATE_AVAILABLE";
129
+ /**
130
+ * An update is required
131
+ */
132
+ IdentifyVersionStatusEnum["UPDATE_REQUIRED"] = "UPDATE_REQUIRED";
133
+ /**
134
+ * The current version is valid & up to date
135
+ */
136
+ IdentifyVersionStatusEnum["UP_TO_DATE"] = "UP_TO_DATE";
137
+ /**
138
+ * The version or build has been disabled
139
+ */
140
+ IdentifyVersionStatusEnum["DISABLED"] = "DISABLED";
141
+ })(IdentifyVersionStatusEnum || (IdentifyVersionStatusEnum = {}));
142
+ export const UpdateInfoSchema = t.Object({
143
+ version: t.String({ error: "version is required" }),
144
+ build: t.String({ error: "build is required" }),
145
+ update_id: t.String({ error: "update_id is required" }),
146
+ effective_date: t.Date({ error: "effective_date is required" }),
147
+ });
148
+ export const UpToDateInfoSchema = t.Object({
149
+ status: t.Literal(IdentifyVersionStatusEnum.UP_TO_DATE),
150
+ update: t.Null(),
151
+ });
152
+ export const UpdateRequiredInfoSchema = t.Object({
153
+ status: t.Literal(IdentifyVersionStatusEnum.UPDATE_REQUIRED),
154
+ update: UpdateInfoSchema,
155
+ });
156
+ export const UpdateAvailableInfoSchema = t.Object({
157
+ status: t.Literal(IdentifyVersionStatusEnum.UPDATE_AVAILABLE),
158
+ update: UpdateInfoSchema,
159
+ });
160
+ export const VersionInfoSchema = t.Object({
161
+ /**
162
+ * The status of the version
163
+ */
164
+ status: t.Enum(IdentifyVersionStatusEnum, { error: "status is required" }),
165
+ update: t.Optional(t.Union([UpdateAvailableInfoSchema, t.Null()])),
166
+ });
167
+ /**
168
+ * Identify response schema
169
+ */
170
+ export const IdentifyResponseSchema = t.Object({
171
+ success: t.Literal(true),
172
+ data: t.Object({
173
+ session_id: t.String({ error: "session_id is required" }),
174
+ device_id: t.String({ error: "device_id is required" }),
175
+ persona_id: t.String({ error: "persona_id is required" }),
176
+ token: t.String({ error: "token is required" }), // JWT token for session authentication
177
+ version_info: VersionInfoSchema,
178
+ }),
179
+ });
180
+ export const IdentifyErrorResponseSchema = t.Object({
181
+ success: t.Literal(false),
182
+ error: t.Union([
183
+ t.Object({
184
+ code: t.Literal("MISSING_ORG_ID"),
185
+ message: t.String(),
186
+ }),
187
+ t.Object({
188
+ code: t.Literal("MISSING_PROJECT_ID"),
189
+ message: t.String(),
190
+ }),
191
+ t.Object({
192
+ code: t.Literal("MISSING_ENVIRONMENT_SLUG"),
193
+ message: t.String(),
194
+ }),
195
+ t.Object({
196
+ code: t.Literal("MISSING_DEVICE_ID"),
197
+ message: t.String(),
198
+ }),
199
+ t.Object({
200
+ code: t.Literal("IDENTIFY_FAILED"),
201
+ message: t.String(),
202
+ }),
203
+ t.Object({
204
+ code: t.Literal("NO_SESSION_ID_GENERATED"),
205
+ message: t.String(),
206
+ }),
207
+ t.Object({
208
+ code: t.Literal("NO_DEVICE_ID_GENERATED"),
209
+ message: t.String(),
210
+ }),
211
+ t.Object({
212
+ code: t.Literal("NO_PERSONA_ID_GENERATED"),
213
+ message: t.String(),
214
+ }),
215
+ ]),
216
+ });
217
+ export const ValidationErrorSchema = t.Object({
218
+ success: t.Literal(false),
219
+ error: t.Literal("VALIDATION"),
220
+ message: t.String(),
221
+ });
@@ -0,0 +1,12 @@
1
+ export * from "./analytics/schemas";
2
+ export * from "./builds/schemas";
3
+ export * from "./devices/schemas";
4
+ export * from "./environment/schemas";
5
+ export * from "./events/schemas";
6
+ export * from "./identify/schemas";
7
+ export * from "./me/schemas";
8
+ export * from "./orgs/schemas";
9
+ export * from "./personas/schemas";
10
+ export * from "./projects/schemas";
11
+ export * from "./sessions/schemas";
12
+ export * from "./versions/schemas";
@@ -0,0 +1,12 @@
1
+ export * from "./analytics/schemas";
2
+ export * from "./builds/schemas";
3
+ export * from "./devices/schemas";
4
+ export * from "./environment/schemas";
5
+ export * from "./events/schemas";
6
+ export * from "./identify/schemas";
7
+ export * from "./me/schemas";
8
+ export * from "./orgs/schemas";
9
+ export * from "./personas/schemas";
10
+ export * from "./projects/schemas";
11
+ export * from "./sessions/schemas";
12
+ export * from "./versions/schemas";
@@ -0,0 +1 @@
1
+ export * from "./schemas";
@@ -0,0 +1 @@
1
+ export * from "./schemas";