@teardown/ingest-api 0.0.17 → 0.0.20

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.
@@ -2,7 +2,14 @@ import { z } from "zod";
2
2
  /**
3
3
  * OS types
4
4
  */
5
- export type OSType = "IOS" | "ANDROID" | "WEB" | "WINDOWS" | "MACOS" | "LINUX" | string;
5
+ export declare enum OSType {
6
+ IOS = "IOS",
7
+ ANDROID = "ANDROID",
8
+ WEB = "WEB",
9
+ WINDOWS = "WINDOWS",
10
+ MACOS = "MACOS",
11
+ LINUX = "LINUX"
12
+ }
6
13
  /**
7
14
  * Device types
8
15
  */
@@ -11,71 +18,107 @@ export type DeviceType = "UNKNOWN" | "PHONE" | "TABLET" | "DESKTOP" | "CONSOLE"
11
18
  * Application info schema
12
19
  */
13
20
  export declare const ApplicationInfoSchema: z.ZodObject<{
14
- version: z.ZodNullable<z.ZodString>;
15
- buildNumber: z.ZodNullable<z.ZodString>;
21
+ version: z.ZodString;
22
+ build_number: z.ZodString;
16
23
  }, z.core.$strip>;
17
24
  export type ApplicationInfo = z.infer<typeof ApplicationInfoSchema>;
18
25
  /**
19
26
  * OS info schema
20
27
  */
21
28
  export declare const OSInfoSchema: z.ZodObject<{
22
- type: z.ZodString;
23
- name: z.ZodNullable<z.ZodString>;
24
- version: z.ZodNullable<z.ZodString>;
29
+ type: z.ZodEnum<typeof OSType>;
30
+ name: z.ZodString;
31
+ version: z.ZodString;
25
32
  }, z.core.$strip>;
26
33
  export type OSInfo = z.infer<typeof OSInfoSchema>;
27
34
  /**
28
35
  * Hardware info schema
29
36
  */
30
37
  export declare const HardwareInfoSchema: z.ZodObject<{
31
- deviceName: z.ZodNullable<z.ZodString>;
32
- deviceType: z.ZodNullable<z.ZodString>;
33
- deviceBrand: z.ZodNullable<z.ZodString>;
34
- osVersion: z.ZodNullable<z.ZodString>;
38
+ device_name: z.ZodString;
39
+ device_type: z.ZodString;
40
+ device_brand: z.ZodString;
35
41
  }, z.core.$strip>;
36
42
  export type HardwareInfo = z.infer<typeof HardwareInfoSchema>;
43
+ export declare const EmergencyLaunchSchema: z.ZodUnion<readonly [z.ZodObject<{
44
+ is_emergency_launch: z.ZodLiteral<true>;
45
+ reason: z.ZodString;
46
+ }, z.core.$strip>, z.ZodObject<{
47
+ is_emergency_launch: z.ZodLiteral<false>;
48
+ reason: z.ZodOptional<z.ZodNever>;
49
+ }, z.core.$strip>]>;
50
+ export type EmergencyLaunch = z.infer<typeof EmergencyLaunchSchema>;
37
51
  /**
38
52
  * Update info schema
39
53
  */
40
54
  export declare const UpdateInfoSchema: z.ZodObject<{
41
- isEnabled: z.ZodBoolean;
42
- updateId: z.ZodNullable<z.ZodString>;
43
- channel: z.ZodNullable<z.ZodString>;
44
- runtimeVersion: z.ZodNullable<z.ZodString>;
45
- isEmergencyLaunch: z.ZodBoolean;
46
- emergencyLaunchReason: z.ZodNullable<z.ZodString>;
47
- isEmbeddedLaunch: z.ZodBoolean;
48
- createdAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
55
+ is_enabled: z.ZodBoolean;
56
+ update_id: z.ZodString;
57
+ update_channel: z.ZodString;
58
+ runtime_version: z.ZodString;
59
+ emergency_launch: z.ZodUnion<readonly [z.ZodObject<{
60
+ is_emergency_launch: z.ZodLiteral<true>;
61
+ reason: z.ZodString;
62
+ }, z.core.$strip>, z.ZodObject<{
63
+ is_emergency_launch: z.ZodLiteral<false>;
64
+ reason: z.ZodOptional<z.ZodNever>;
65
+ }, z.core.$strip>]>;
66
+ is_embedded_launch: z.ZodBoolean;
67
+ created_at: z.ZodCoercedDate<unknown>;
49
68
  }, z.core.$strip>;
50
69
  export type UpdateInfo = z.infer<typeof UpdateInfoSchema>;
70
+ /**
71
+ * Push notification info schema
72
+ */
73
+ export declare const PushNotificationInfoSchema: z.ZodObject<{
74
+ token: z.ZodString;
75
+ platform: z.ZodEnum<{
76
+ APNS: "APNS";
77
+ FCM: "FCM";
78
+ EXPO: "EXPO";
79
+ }>;
80
+ }, z.core.$strip>;
81
+ export type PushNotificationInfo = z.infer<typeof PushNotificationInfoSchema>;
51
82
  /**
52
83
  * Device info schema
53
84
  */
54
85
  export declare const DeviceInfoSchema: z.ZodObject<{
55
- applicationInfo: z.ZodObject<{
56
- version: z.ZodNullable<z.ZodString>;
57
- buildNumber: z.ZodNullable<z.ZodString>;
86
+ application: z.ZodObject<{
87
+ version: z.ZodString;
88
+ build_number: z.ZodString;
58
89
  }, z.core.$strip>;
59
- updateInfo: z.ZodNullable<z.ZodObject<{
60
- isEnabled: z.ZodBoolean;
61
- updateId: z.ZodNullable<z.ZodString>;
62
- channel: z.ZodNullable<z.ZodString>;
63
- runtimeVersion: z.ZodNullable<z.ZodString>;
64
- isEmergencyLaunch: z.ZodBoolean;
65
- emergencyLaunchReason: z.ZodNullable<z.ZodString>;
66
- isEmbeddedLaunch: z.ZodBoolean;
67
- createdAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
90
+ update: z.ZodNullable<z.ZodObject<{
91
+ is_enabled: z.ZodBoolean;
92
+ update_id: z.ZodString;
93
+ update_channel: z.ZodString;
94
+ runtime_version: z.ZodString;
95
+ emergency_launch: z.ZodUnion<readonly [z.ZodObject<{
96
+ is_emergency_launch: z.ZodLiteral<true>;
97
+ reason: z.ZodString;
98
+ }, z.core.$strip>, z.ZodObject<{
99
+ is_emergency_launch: z.ZodLiteral<false>;
100
+ reason: z.ZodOptional<z.ZodNever>;
101
+ }, z.core.$strip>]>;
102
+ is_embedded_launch: z.ZodBoolean;
103
+ created_at: z.ZodCoercedDate<unknown>;
68
104
  }, z.core.$strip>>;
69
- hardwareInfo: z.ZodNullable<z.ZodObject<{
70
- deviceName: z.ZodNullable<z.ZodString>;
71
- deviceType: z.ZodNullable<z.ZodString>;
72
- deviceBrand: z.ZodNullable<z.ZodString>;
73
- osVersion: z.ZodNullable<z.ZodString>;
74
- }, z.core.$strip>>;
75
- osInfo: z.ZodNullable<z.ZodObject<{
76
- type: z.ZodString;
77
- name: z.ZodNullable<z.ZodString>;
78
- version: z.ZodNullable<z.ZodString>;
105
+ hardware: z.ZodObject<{
106
+ device_name: z.ZodString;
107
+ device_type: z.ZodString;
108
+ device_brand: z.ZodString;
109
+ }, z.core.$strip>;
110
+ os: z.ZodObject<{
111
+ type: z.ZodEnum<typeof OSType>;
112
+ name: z.ZodString;
113
+ version: z.ZodString;
114
+ }, z.core.$strip>;
115
+ push_notification: z.ZodOptional<z.ZodObject<{
116
+ token: z.ZodString;
117
+ platform: z.ZodEnum<{
118
+ APNS: "APNS";
119
+ FCM: "FCM";
120
+ EXPO: "EXPO";
121
+ }>;
79
122
  }, z.core.$strip>>;
80
123
  }, z.core.$strip>;
81
124
  export type DeviceInfo = z.infer<typeof DeviceInfoSchema>;
@@ -95,30 +138,42 @@ export type PersonaInfo = z.infer<typeof PersonaInfoSchema>;
95
138
  */
96
139
  export declare const IdentifyRequestSchema: z.ZodObject<{
97
140
  device: z.ZodObject<{
98
- applicationInfo: z.ZodObject<{
99
- version: z.ZodNullable<z.ZodString>;
100
- buildNumber: z.ZodNullable<z.ZodString>;
141
+ application: z.ZodObject<{
142
+ version: z.ZodString;
143
+ build_number: z.ZodString;
101
144
  }, z.core.$strip>;
102
- updateInfo: z.ZodNullable<z.ZodObject<{
103
- isEnabled: z.ZodBoolean;
104
- updateId: z.ZodNullable<z.ZodString>;
105
- channel: z.ZodNullable<z.ZodString>;
106
- runtimeVersion: z.ZodNullable<z.ZodString>;
107
- isEmergencyLaunch: z.ZodBoolean;
108
- emergencyLaunchReason: z.ZodNullable<z.ZodString>;
109
- isEmbeddedLaunch: z.ZodBoolean;
110
- createdAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
111
- }, z.core.$strip>>;
112
- hardwareInfo: z.ZodNullable<z.ZodObject<{
113
- deviceName: z.ZodNullable<z.ZodString>;
114
- deviceType: z.ZodNullable<z.ZodString>;
115
- deviceBrand: z.ZodNullable<z.ZodString>;
116
- osVersion: z.ZodNullable<z.ZodString>;
145
+ update: z.ZodNullable<z.ZodObject<{
146
+ is_enabled: z.ZodBoolean;
147
+ update_id: z.ZodString;
148
+ update_channel: z.ZodString;
149
+ runtime_version: z.ZodString;
150
+ emergency_launch: z.ZodUnion<readonly [z.ZodObject<{
151
+ is_emergency_launch: z.ZodLiteral<true>;
152
+ reason: z.ZodString;
153
+ }, z.core.$strip>, z.ZodObject<{
154
+ is_emergency_launch: z.ZodLiteral<false>;
155
+ reason: z.ZodOptional<z.ZodNever>;
156
+ }, z.core.$strip>]>;
157
+ is_embedded_launch: z.ZodBoolean;
158
+ created_at: z.ZodCoercedDate<unknown>;
117
159
  }, z.core.$strip>>;
118
- osInfo: z.ZodNullable<z.ZodObject<{
119
- type: z.ZodString;
120
- name: z.ZodNullable<z.ZodString>;
121
- version: z.ZodNullable<z.ZodString>;
160
+ hardware: z.ZodObject<{
161
+ device_name: z.ZodString;
162
+ device_type: z.ZodString;
163
+ device_brand: z.ZodString;
164
+ }, z.core.$strip>;
165
+ os: z.ZodObject<{
166
+ type: z.ZodEnum<typeof OSType>;
167
+ name: z.ZodString;
168
+ version: z.ZodString;
169
+ }, z.core.$strip>;
170
+ push_notification: z.ZodOptional<z.ZodObject<{
171
+ token: z.ZodString;
172
+ platform: z.ZodEnum<{
173
+ APNS: "APNS";
174
+ FCM: "FCM";
175
+ EXPO: "EXPO";
176
+ }>;
122
177
  }, z.core.$strip>>;
123
178
  }, z.core.$strip>;
124
179
  persona: z.ZodOptional<z.ZodObject<{
@@ -134,6 +189,8 @@ export type IdentifyRequest = z.infer<typeof IdentifyRequestSchema>;
134
189
  export declare const IdentifyResponseSchema: z.ZodObject<{
135
190
  success: z.ZodLiteral<true>;
136
191
  session_id: z.ZodString;
192
+ device_id: z.ZodString;
193
+ persona_id: z.ZodString;
137
194
  }, z.core.$strip>;
138
195
  export type IdentifyResponse = z.infer<typeof IdentifyResponseSchema>;
139
196
  export declare const IdentifyErrorResponseSchema: z.ZodObject<{
@@ -1,49 +1,95 @@
1
1
  import { z } from "zod";
2
+ /**
3
+ * OS types
4
+ */
5
+ export var OSType;
6
+ (function (OSType) {
7
+ OSType["IOS"] = "IOS";
8
+ OSType["ANDROID"] = "ANDROID";
9
+ OSType["WEB"] = "WEB";
10
+ OSType["WINDOWS"] = "WINDOWS";
11
+ OSType["MACOS"] = "MACOS";
12
+ OSType["LINUX"] = "LINUX";
13
+ })(OSType || (OSType = {}));
2
14
  /**
3
15
  * Application info schema
4
16
  */
5
17
  export const ApplicationInfoSchema = z.object({
6
- version: z.string().nullable(),
7
- buildNumber: z.string().nullable(),
18
+ version: z.string(),
19
+ build_number: z.string(),
8
20
  });
9
21
  /**
10
22
  * OS info schema
11
23
  */
12
24
  export const OSInfoSchema = z.object({
13
- type: z.string(),
14
- name: z.string().nullable(),
15
- version: z.string().nullable(),
25
+ /**
26
+ * OS type
27
+ */
28
+ type: z.enum(OSType),
29
+ name: z.string(),
30
+ version: z.string(),
16
31
  });
17
32
  /**
18
33
  * Hardware info schema
19
34
  */
20
35
  export const HardwareInfoSchema = z.object({
21
- deviceName: z.string().nullable(),
22
- deviceType: z.string().nullable(),
23
- deviceBrand: z.string().nullable(),
24
- osVersion: z.string().nullable(),
36
+ device_name: z.string(),
37
+ device_type: z.string(),
38
+ device_brand: z.string(),
25
39
  });
40
+ export const EmergencyLaunchSchema = z.union([
41
+ z.object({
42
+ is_emergency_launch: z.literal(true),
43
+ reason: z.string(),
44
+ }),
45
+ z.object({
46
+ is_emergency_launch: z.literal(false),
47
+ reason: z.never().optional(),
48
+ }),
49
+ ]);
26
50
  /**
27
51
  * Update info schema
28
52
  */
29
53
  export const UpdateInfoSchema = z.object({
30
- isEnabled: z.boolean(),
31
- updateId: z.string().nullable(),
32
- channel: z.string().nullable(),
33
- runtimeVersion: z.string().nullable(),
34
- isEmergencyLaunch: z.boolean(),
35
- emergencyLaunchReason: z.string().nullable(),
36
- isEmbeddedLaunch: z.boolean(),
37
- createdAt: z.coerce.date().nullable(),
54
+ is_enabled: z.boolean(),
55
+ update_id: z.string(),
56
+ update_channel: z.string(),
57
+ runtime_version: z.string(),
58
+ emergency_launch: EmergencyLaunchSchema,
59
+ is_embedded_launch: z.boolean(),
60
+ created_at: z.coerce.date(),
61
+ });
62
+ /**
63
+ * Push notification info schema
64
+ */
65
+ export const PushNotificationInfoSchema = z.object({
66
+ token: z.string(),
67
+ platform: z.enum(["APNS", "FCM", "EXPO"]),
38
68
  });
39
69
  /**
40
70
  * Device info schema
41
71
  */
42
72
  export const DeviceInfoSchema = z.object({
43
- applicationInfo: ApplicationInfoSchema,
44
- updateInfo: UpdateInfoSchema.nullable(),
45
- hardwareInfo: HardwareInfoSchema.nullable(),
46
- osInfo: OSInfoSchema.nullable(),
73
+ /**
74
+ * Application info, required
75
+ */
76
+ application: ApplicationInfoSchema,
77
+ /**
78
+ * Update info (optional) - not all builds will have an update
79
+ */
80
+ update: UpdateInfoSchema.nullable(),
81
+ /**
82
+ * Hardware info, required
83
+ */
84
+ hardware: HardwareInfoSchema,
85
+ /**
86
+ * OS info, required
87
+ */
88
+ os: OSInfoSchema,
89
+ /**
90
+ * Push notification info, optional
91
+ */
92
+ push_notification: PushNotificationInfoSchema.optional(),
47
93
  });
48
94
  /**
49
95
  * Persona info schema (optional fields)
@@ -73,6 +119,8 @@ export const IdentifyRequestSchema = z.object({
73
119
  export const IdentifyResponseSchema = z.object({
74
120
  success: z.literal(true),
75
121
  session_id: z.string(),
122
+ device_id: z.string(),
123
+ persona_id: z.string(),
76
124
  });
77
125
  export const IdentifyErrorResponseSchema = z.object({
78
126
  success: z.literal(false),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teardown/ingest-api",
3
- "version": "0.0.17",
3
+ "version": "0.0.20",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -33,7 +33,7 @@
33
33
  "predev": "bun run sync:schemas",
34
34
  "dev": "rm -rf dist; bun x tsc --watch --project ./tsconfig.lib.json",
35
35
  "check:types": "tsc --noEmit --project ./tsconfig.lib.json",
36
- "prepublishOnly": "bun run build"
36
+ "prepublishOnly": "bun run sync:schemas && bun run build"
37
37
  },
38
38
  "dependencies": {
39
39
  "@elysiajs/eden": "^1.4.4",