@teardown/ingest-api 0.0.21-alpha.10 → 0.0.21-alpha.11

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.
@@ -9,13 +9,28 @@ export declare const client: (server: string, config?: import("@elysiajs/eden/fe
9
9
  query: unknown;
10
10
  headers: unknown;
11
11
  response: {
12
- 200: {
12
+ 200: import("@teardown/errors").ErrorResponse | {
13
13
  status: string;
14
14
  timestamp: string;
15
15
  };
16
16
  };
17
17
  };
18
18
  };
19
+ } & {
20
+ "": {
21
+ get: {
22
+ body: unknown;
23
+ params: {};
24
+ query: unknown;
25
+ headers: unknown;
26
+ response: {
27
+ 200: import("@teardown/errors").ErrorResponse | {
28
+ message: string;
29
+ version: string;
30
+ };
31
+ };
32
+ };
33
+ };
19
34
  } & {
20
35
  "/v1/identify": {
21
36
  post: {
@@ -55,7 +70,7 @@ export declare const client: (server: string, config?: import("@elysiajs/eden/fe
55
70
  enabled: boolean;
56
71
  granted: boolean;
57
72
  token: string | null;
58
- platform: import("@teardown/schemas/identify").NotificationPlatform;
73
+ platform: import("@teardown/schemas").NotificationPlatform;
59
74
  };
60
75
  };
61
76
  timestamp?: Date | undefined;
@@ -72,15 +87,31 @@ export declare const client: (server: string, config?: import("@elysiajs/eden/fe
72
87
  "td-org-id": string;
73
88
  "td-project-id": string;
74
89
  "td-environment-slug": string;
90
+ "td-device-id": string;
75
91
  authorization?: string | undefined;
92
+ "td-session-id"?: string | undefined;
76
93
  };
77
94
  response: {
78
95
  200: {
79
96
  success: true;
80
- session_id: string;
81
- device_id: string;
82
- persona_id: string;
83
- token: string;
97
+ data: {
98
+ session_id: string;
99
+ device_id: string;
100
+ persona_id: string;
101
+ token: string;
102
+ version_info: {
103
+ status: import("@teardown/schemas").IdentifyVersionStatusEnum;
104
+ update?: {
105
+ status: import("@teardown/schemas").IdentifyVersionStatusEnum.UPDATE_AVAILABLE;
106
+ update: {
107
+ version: string;
108
+ build: string;
109
+ update_id: string;
110
+ effective_date: Date;
111
+ };
112
+ } | null | undefined;
113
+ };
114
+ };
84
115
  };
85
116
  400: {
86
117
  success: false;
@@ -93,6 +124,9 @@ export declare const client: (server: string, config?: import("@elysiajs/eden/fe
93
124
  } | {
94
125
  code: "MISSING_ENVIRONMENT_SLUG";
95
126
  message: string;
127
+ } | {
128
+ code: "MISSING_DEVICE_ID";
129
+ message: string;
96
130
  } | {
97
131
  code: "IDENTIFY_FAILED";
98
132
  message: string;
@@ -120,16 +154,78 @@ export declare const client: (server: string, config?: import("@elysiajs/eden/fe
120
154
  };
121
155
  };
122
156
  } & {
123
- "": {
124
- get: {
125
- body: unknown;
157
+ "/v1/events": {
158
+ post: {
159
+ body: {
160
+ events: {
161
+ event_name: string;
162
+ event_type: "action" | "screen_view" | "custom";
163
+ properties?: Record<string, unknown> | undefined;
164
+ timestamp?: Date | undefined;
165
+ session_id?: string | undefined;
166
+ device_id?: string | undefined;
167
+ }[];
168
+ session_id?: string | undefined;
169
+ device_id?: string | undefined;
170
+ };
126
171
  params: {};
127
172
  query: unknown;
128
- headers: unknown;
173
+ headers: {
174
+ "td-org-id": string;
175
+ "td-project-id": string;
176
+ "td-environment-slug": string;
177
+ authorization?: string | undefined;
178
+ "td-device-id"?: string | undefined;
179
+ "td-session-id"?: string | undefined;
180
+ };
129
181
  response: {
130
182
  200: {
131
- message: string;
132
- version: string;
183
+ success: true;
184
+ data: {
185
+ event_ids: string[];
186
+ processed_count: number;
187
+ failed_count: number;
188
+ };
189
+ };
190
+ 400: {
191
+ success: false;
192
+ error: {
193
+ code: "MISSING_ORG_ID";
194
+ message: string;
195
+ } | {
196
+ code: "MISSING_PROJECT_ID";
197
+ message: string;
198
+ } | {
199
+ code: "MISSING_ENVIRONMENT_SLUG";
200
+ message: string;
201
+ } | {
202
+ code: "MISSING_DEVICE_ID";
203
+ message: string;
204
+ } | {
205
+ code: "EVENTS_PROCESSING_FAILED";
206
+ message: string;
207
+ } | {
208
+ code: "INVALID_SESSION";
209
+ message: string;
210
+ } | {
211
+ code: "INVALID_DEVICE";
212
+ message: string;
213
+ } | {
214
+ code: "BATCH_SIZE_EXCEEDED";
215
+ message: string;
216
+ } | {
217
+ code: "VALIDATION_ERROR";
218
+ message: string;
219
+ };
220
+ };
221
+ 422: {
222
+ type: "validation";
223
+ on: string;
224
+ summary?: string;
225
+ message?: string;
226
+ found?: unknown;
227
+ property?: string;
228
+ expected?: string;
133
229
  };
134
230
  };
135
231
  };
@@ -1,3 +1,2 @@
1
- import * as EnvironmentSchemas from "@teardown/schemas/environment";
2
1
  import * as IdentifySchemas from "../vendored/schemas/identify";
3
- export { EnvironmentSchemas, IdentifySchemas };
2
+ export { IdentifySchemas };
@@ -1,3 +1,2 @@
1
- import * as EnvironmentSchemas from "@teardown/schemas/environment";
2
1
  import * as IdentifySchemas from "../vendored/schemas/identify";
3
- export { EnvironmentSchemas, IdentifySchemas };
2
+ export { IdentifySchemas };
@@ -38,7 +38,7 @@ export type EmergencyLaunch = z.infer<typeof EmergencyLaunchSchema>;
38
38
  /**
39
39
  * Update info schema
40
40
  */
41
- export declare const UpdateInfoSchema: z.ZodObject<{
41
+ export declare const DeviceUpdateInfoSchema: z.ZodObject<{
42
42
  is_enabled: z.ZodBoolean;
43
43
  update_id: z.ZodString;
44
44
  update_channel: z.ZodString;
@@ -53,7 +53,7 @@ export declare const UpdateInfoSchema: z.ZodObject<{
53
53
  is_embedded_launch: z.ZodBoolean;
54
54
  created_at: z.ZodCoercedDate<unknown>;
55
55
  }, z.core.$strip>;
56
- export type UpdateInfo = z.infer<typeof UpdateInfoSchema>;
56
+ export type DeviceUpdateInfo = z.infer<typeof DeviceUpdateInfoSchema>;
57
57
  export declare enum NotificationPlatform {
58
58
  APNS = "APNS",// Apple Push Notification Service
59
59
  FCM = "FCM",// Firebase Cloud Messaging
@@ -184,15 +184,87 @@ export declare const IdentifyRequestSchema: z.ZodObject<{
184
184
  }, z.core.$strip>>;
185
185
  }, z.core.$strip>;
186
186
  export type IdentifyRequest = z.infer<typeof IdentifyRequestSchema>;
187
+ export declare enum IdentifyVersionStatusEnum {
188
+ /**
189
+ * A new version is available
190
+ */
191
+ UPDATE_AVAILABLE = "UPDATE_AVAILABLE",
192
+ /**
193
+ * An update is required
194
+ */
195
+ UPDATE_REQUIRED = "UPDATE_REQUIRED",
196
+ /**
197
+ * The current version is valid & up to date
198
+ */
199
+ UP_TO_DATE = "UP_TO_DATE"
200
+ }
201
+ export declare const UpdateInfoSchema: z.ZodObject<{
202
+ version: z.ZodString;
203
+ build: z.ZodString;
204
+ update_id: z.ZodString;
205
+ effective_date: z.ZodCoercedDate<unknown>;
206
+ }, z.core.$strip>;
207
+ export type UpdateAvailableInfo = z.infer<typeof UpdateAvailableInfoSchema>;
208
+ export declare const UpToDateInfoSchema: z.ZodObject<{
209
+ status: z.ZodLiteral<IdentifyVersionStatusEnum.UP_TO_DATE>;
210
+ update: z.ZodNull;
211
+ }, z.core.$strip>;
212
+ export type UpToDateInfo = z.infer<typeof UpToDateInfoSchema>;
213
+ export declare const UpdateRequiredInfoSchema: z.ZodObject<{
214
+ status: z.ZodLiteral<IdentifyVersionStatusEnum.UPDATE_REQUIRED>;
215
+ update: z.ZodObject<{
216
+ version: z.ZodString;
217
+ build: z.ZodString;
218
+ update_id: z.ZodString;
219
+ effective_date: z.ZodCoercedDate<unknown>;
220
+ }, z.core.$strip>;
221
+ }, z.core.$strip>;
222
+ export type UpdateRequiredInfo = z.infer<typeof UpdateRequiredInfoSchema>;
223
+ export declare const UpdateAvailableInfoSchema: z.ZodObject<{
224
+ status: z.ZodLiteral<IdentifyVersionStatusEnum.UPDATE_AVAILABLE>;
225
+ update: z.ZodObject<{
226
+ version: z.ZodString;
227
+ build: z.ZodString;
228
+ update_id: z.ZodString;
229
+ effective_date: z.ZodCoercedDate<unknown>;
230
+ }, z.core.$strip>;
231
+ }, z.core.$strip>;
232
+ export declare const VersionInfoSchema: z.ZodObject<{
233
+ status: z.ZodEnum<typeof IdentifyVersionStatusEnum>;
234
+ update: z.ZodOptional<z.ZodNullable<z.ZodObject<{
235
+ status: z.ZodLiteral<IdentifyVersionStatusEnum.UPDATE_AVAILABLE>;
236
+ update: z.ZodObject<{
237
+ version: z.ZodString;
238
+ build: z.ZodString;
239
+ update_id: z.ZodString;
240
+ effective_date: z.ZodCoercedDate<unknown>;
241
+ }, z.core.$strip>;
242
+ }, z.core.$strip>>>;
243
+ }, z.core.$strip>;
244
+ export type VersionInfo = z.infer<typeof VersionInfoSchema>;
187
245
  /**
188
246
  * Identify response schema
189
247
  */
190
248
  export declare const IdentifyResponseSchema: z.ZodObject<{
191
249
  success: z.ZodLiteral<true>;
192
- session_id: z.ZodString;
193
- device_id: z.ZodString;
194
- persona_id: z.ZodString;
195
- token: z.ZodString;
250
+ data: z.ZodObject<{
251
+ session_id: z.ZodString;
252
+ device_id: z.ZodString;
253
+ persona_id: z.ZodString;
254
+ token: z.ZodString;
255
+ version_info: z.ZodObject<{
256
+ status: z.ZodEnum<typeof IdentifyVersionStatusEnum>;
257
+ update: z.ZodOptional<z.ZodNullable<z.ZodObject<{
258
+ status: z.ZodLiteral<IdentifyVersionStatusEnum.UPDATE_AVAILABLE>;
259
+ update: z.ZodObject<{
260
+ version: z.ZodString;
261
+ build: z.ZodString;
262
+ update_id: z.ZodString;
263
+ effective_date: z.ZodCoercedDate<unknown>;
264
+ }, z.core.$strip>;
265
+ }, z.core.$strip>>>;
266
+ }, z.core.$strip>;
267
+ }, z.core.$strip>;
196
268
  }, z.core.$strip>;
197
269
  export type IdentifyResponse = z.infer<typeof IdentifyResponseSchema>;
198
270
  export declare const IdentifyErrorResponseSchema: z.ZodObject<{
@@ -206,6 +278,9 @@ export declare const IdentifyErrorResponseSchema: z.ZodObject<{
206
278
  }, z.core.$strip>, z.ZodObject<{
207
279
  code: z.ZodLiteral<"MISSING_ENVIRONMENT_SLUG">;
208
280
  message: z.ZodString;
281
+ }, z.core.$strip>, z.ZodObject<{
282
+ code: z.ZodLiteral<"MISSING_DEVICE_ID">;
283
+ message: z.ZodString;
209
284
  }, z.core.$strip>, z.ZodObject<{
210
285
  code: z.ZodLiteral<"IDENTIFY_FAILED">;
211
286
  message: z.ZodString;
@@ -55,7 +55,7 @@ export const EmergencyLaunchSchema = z.union([
55
55
  /**
56
56
  * Update info schema
57
57
  */
58
- export const UpdateInfoSchema = z.object({
58
+ export const DeviceUpdateInfoSchema = z.object({
59
59
  is_enabled: z.boolean(),
60
60
  update_id: z.string("update_id is required"),
61
61
  update_channel: z.string("update_channel is required"),
@@ -103,7 +103,7 @@ export const DeviceInfoSchema = z.object({
103
103
  /**
104
104
  * Update info (optional) - not all builds will have an update
105
105
  */
106
- update: UpdateInfoSchema.nullable(),
106
+ update: DeviceUpdateInfoSchema.nullable(),
107
107
  /**
108
108
  * Hardware info, required
109
109
  */
@@ -145,15 +145,68 @@ export const IdentifyRequestSchema = z.object({
145
145
  }, {
146
146
  error: "Identify request is required",
147
147
  });
148
+ export var IdentifyVersionStatusEnum;
149
+ (function (IdentifyVersionStatusEnum) {
150
+ /**
151
+ * A new version is available
152
+ */
153
+ IdentifyVersionStatusEnum["UPDATE_AVAILABLE"] = "UPDATE_AVAILABLE";
154
+ /**
155
+ * An update is required
156
+ */
157
+ IdentifyVersionStatusEnum["UPDATE_REQUIRED"] = "UPDATE_REQUIRED";
158
+ /**
159
+ * The current version is valid & up to date
160
+ */
161
+ IdentifyVersionStatusEnum["UP_TO_DATE"] = "UP_TO_DATE";
162
+ })(IdentifyVersionStatusEnum || (IdentifyVersionStatusEnum = {}));
163
+ export const UpdateInfoSchema = z.object({
164
+ version: z.string("version is required"),
165
+ build: z.string("build is required"),
166
+ update_id: z.string("update_id is required"),
167
+ effective_date: z.coerce.date("effective_date is required"),
168
+ }, {
169
+ error: "Update available info is required",
170
+ });
171
+ export const UpToDateInfoSchema = z.object({
172
+ status: z.literal(IdentifyVersionStatusEnum.UP_TO_DATE),
173
+ update: z.null(),
174
+ }, {
175
+ error: "Up to date info is required",
176
+ });
177
+ export const UpdateRequiredInfoSchema = z.object({
178
+ status: z.literal(IdentifyVersionStatusEnum.UPDATE_REQUIRED),
179
+ update: UpdateInfoSchema,
180
+ }, {
181
+ error: "Update required info is required",
182
+ });
183
+ export const UpdateAvailableInfoSchema = z.object({
184
+ status: z.literal(IdentifyVersionStatusEnum.UPDATE_AVAILABLE),
185
+ update: UpdateInfoSchema,
186
+ }, {
187
+ error: "Update available info is required",
188
+ });
189
+ export const VersionInfoSchema = z.object({
190
+ /**
191
+ * The status of the version
192
+ */
193
+ status: z.enum(IdentifyVersionStatusEnum, "status is required"),
194
+ update: UpdateAvailableInfoSchema.nullish(),
195
+ }, {
196
+ error: "Version info is required",
197
+ });
148
198
  /**
149
199
  * Identify response schema
150
200
  */
151
201
  export const IdentifyResponseSchema = z.object({
152
202
  success: z.literal(true),
153
- session_id: z.string("session_id is required"),
154
- device_id: z.string("device_id is required"),
155
- persona_id: z.string("persona_id is required"),
156
- token: z.string("token is required"), // JWT token for session authentication
203
+ data: z.object({
204
+ session_id: z.string("session_id is required"),
205
+ device_id: z.string("device_id is required"),
206
+ persona_id: z.string("persona_id is required"),
207
+ token: z.string("token is required"), // JWT token for session authentication
208
+ version_info: VersionInfoSchema,
209
+ }),
157
210
  }, {
158
211
  error: "Identify response is required",
159
212
  });
@@ -172,6 +225,10 @@ export const IdentifyErrorResponseSchema = z.object({
172
225
  code: z.literal("MISSING_ENVIRONMENT_SLUG"),
173
226
  message: z.string(),
174
227
  }),
228
+ z.object({
229
+ code: z.literal("MISSING_DEVICE_ID"),
230
+ message: z.string(),
231
+ }),
175
232
  z.object({
176
233
  code: z.literal("IDENTIFY_FAILED"),
177
234
  message: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teardown/ingest-api",
3
- "version": "0.0.21-alpha.10",
3
+ "version": "0.0.21-alpha.11",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -51,6 +51,6 @@
51
51
  "@types/bun": "1.3.3",
52
52
  "@teardown/ingest": "0.0.1",
53
53
  "@teardown/tsconfig": "1.0.0",
54
- "elysia": "1.4.0"
54
+ "elysia": "1.4.16"
55
55
  }
56
- }
56
+ }