@teardown/ingest-api 0.0.17 → 0.0.18

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,72 +18,88 @@ 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>;
51
70
  /**
52
71
  * Device info schema
53
72
  */
54
73
  export declare const DeviceInfoSchema: z.ZodObject<{
55
- applicationInfo: z.ZodObject<{
56
- version: z.ZodNullable<z.ZodString>;
57
- buildNumber: z.ZodNullable<z.ZodString>;
74
+ application: z.ZodObject<{
75
+ version: z.ZodString;
76
+ build_number: z.ZodString;
58
77
  }, 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>>;
68
- }, 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>;
78
+ update: z.ZodNullable<z.ZodObject<{
79
+ is_enabled: z.ZodBoolean;
80
+ update_id: z.ZodString;
81
+ update_channel: z.ZodString;
82
+ runtime_version: z.ZodString;
83
+ emergency_launch: z.ZodUnion<readonly [z.ZodObject<{
84
+ is_emergency_launch: z.ZodLiteral<true>;
85
+ reason: z.ZodString;
86
+ }, z.core.$strip>, z.ZodObject<{
87
+ is_emergency_launch: z.ZodLiteral<false>;
88
+ reason: z.ZodOptional<z.ZodNever>;
89
+ }, z.core.$strip>]>;
90
+ is_embedded_launch: z.ZodBoolean;
91
+ created_at: z.ZodCoercedDate<unknown>;
79
92
  }, z.core.$strip>>;
93
+ hardware: z.ZodObject<{
94
+ device_name: z.ZodString;
95
+ device_type: z.ZodString;
96
+ device_brand: z.ZodString;
97
+ }, z.core.$strip>;
98
+ os: z.ZodObject<{
99
+ type: z.ZodEnum<typeof OSType>;
100
+ name: z.ZodString;
101
+ version: z.ZodString;
102
+ }, z.core.$strip>;
80
103
  }, z.core.$strip>;
81
104
  export type DeviceInfo = z.infer<typeof DeviceInfoSchema>;
82
105
  /**
@@ -95,31 +118,35 @@ export type PersonaInfo = z.infer<typeof PersonaInfoSchema>;
95
118
  */
96
119
  export declare const IdentifyRequestSchema: z.ZodObject<{
97
120
  device: z.ZodObject<{
98
- applicationInfo: z.ZodObject<{
99
- version: z.ZodNullable<z.ZodString>;
100
- buildNumber: z.ZodNullable<z.ZodString>;
121
+ application: z.ZodObject<{
122
+ version: z.ZodString;
123
+ build_number: z.ZodString;
101
124
  }, 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>;
117
- }, 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>;
125
+ update: z.ZodNullable<z.ZodObject<{
126
+ is_enabled: z.ZodBoolean;
127
+ update_id: z.ZodString;
128
+ update_channel: z.ZodString;
129
+ runtime_version: z.ZodString;
130
+ emergency_launch: z.ZodUnion<readonly [z.ZodObject<{
131
+ is_emergency_launch: z.ZodLiteral<true>;
132
+ reason: z.ZodString;
133
+ }, z.core.$strip>, z.ZodObject<{
134
+ is_emergency_launch: z.ZodLiteral<false>;
135
+ reason: z.ZodOptional<z.ZodNever>;
136
+ }, z.core.$strip>]>;
137
+ is_embedded_launch: z.ZodBoolean;
138
+ created_at: z.ZodCoercedDate<unknown>;
122
139
  }, z.core.$strip>>;
140
+ hardware: z.ZodObject<{
141
+ device_name: z.ZodString;
142
+ device_type: z.ZodString;
143
+ device_brand: z.ZodString;
144
+ }, z.core.$strip>;
145
+ os: z.ZodObject<{
146
+ type: z.ZodEnum<typeof OSType>;
147
+ name: z.ZodString;
148
+ version: z.ZodString;
149
+ }, z.core.$strip>;
123
150
  }, z.core.$strip>;
124
151
  persona: z.ZodOptional<z.ZodObject<{
125
152
  user_id: z.ZodOptional<z.ZodString>;
@@ -134,6 +161,8 @@ export type IdentifyRequest = z.infer<typeof IdentifyRequestSchema>;
134
161
  export declare const IdentifyResponseSchema: z.ZodObject<{
135
162
  success: z.ZodLiteral<true>;
136
163
  session_id: z.ZodString;
164
+ device_id: z.ZodString;
165
+ persona_id: z.ZodString;
137
166
  }, z.core.$strip>;
138
167
  export type IdentifyResponse = z.infer<typeof IdentifyResponseSchema>;
139
168
  export declare const IdentifyErrorResponseSchema: z.ZodObject<{
@@ -1,49 +1,84 @@
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(),
38
61
  });
39
62
  /**
40
63
  * Device info schema
41
64
  */
42
65
  export const DeviceInfoSchema = z.object({
43
- applicationInfo: ApplicationInfoSchema,
44
- updateInfo: UpdateInfoSchema.nullable(),
45
- hardwareInfo: HardwareInfoSchema.nullable(),
46
- osInfo: OSInfoSchema.nullable(),
66
+ /**
67
+ * Application info, required
68
+ */
69
+ application: ApplicationInfoSchema,
70
+ /**
71
+ * Update info (optional) - not all builds will have an update
72
+ */
73
+ update: UpdateInfoSchema.nullable(),
74
+ /**
75
+ * Hardware info, required
76
+ */
77
+ hardware: HardwareInfoSchema,
78
+ /**
79
+ * OS info, required
80
+ */
81
+ os: OSInfoSchema,
47
82
  });
48
83
  /**
49
84
  * Persona info schema (optional fields)
@@ -73,6 +108,8 @@ export const IdentifyRequestSchema = z.object({
73
108
  export const IdentifyResponseSchema = z.object({
74
109
  success: z.literal(true),
75
110
  session_id: z.string(),
111
+ device_id: z.string(),
112
+ persona_id: z.string(),
76
113
  });
77
114
  export const IdentifyErrorResponseSchema = z.object({
78
115
  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.18",
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",