@teardown/ingest-api 2.0.33 → 2.0.34

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.
@@ -0,0 +1,457 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "Teardown Ingest API",
5
+ "version": "1.0.0",
6
+ "description": "Ingest API for Teardown SDK"
7
+ },
8
+ "servers": [
9
+ {
10
+ "url": "http://localhost:4501",
11
+ "description": "Local"
12
+ },
13
+ {
14
+ "url": "https://ingest.teardown.dev",
15
+ "description": "Production"
16
+ }
17
+ ],
18
+ "paths": {
19
+ "/": {
20
+ "get": {
21
+ "operationId": "getRoot",
22
+ "summary": "Root endpoint",
23
+ "tags": ["Health"],
24
+ "responses": {
25
+ "200": {
26
+ "description": "API info",
27
+ "content": {
28
+ "application/json": {
29
+ "schema": {
30
+ "type": "object",
31
+ "properties": {
32
+ "message": { "type": "string" },
33
+ "version": { "type": "string" }
34
+ },
35
+ "required": ["message", "version"]
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ },
43
+ "/health": {
44
+ "get": {
45
+ "operationId": "getHealth",
46
+ "summary": "Health check",
47
+ "tags": ["Health"],
48
+ "responses": {
49
+ "200": {
50
+ "description": "Health status",
51
+ "content": {
52
+ "application/json": {
53
+ "schema": {
54
+ "type": "object",
55
+ "properties": {
56
+ "status": { "type": "string" },
57
+ "timestamp": { "type": "string" },
58
+ "build_id": { "type": "string" },
59
+ "service_id": { "type": "string" }
60
+ },
61
+ "required": ["status", "timestamp", "build_id"]
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ },
69
+ "/v1/identify": {
70
+ "post": {
71
+ "operationId": "identify",
72
+ "summary": "Identify device and user",
73
+ "tags": ["Identify"],
74
+ "parameters": [
75
+ { "name": "td-org-id", "in": "header", "required": true, "schema": { "type": "string" } },
76
+ { "name": "td-project-id", "in": "header", "required": true, "schema": { "type": "string" } },
77
+ { "name": "td-environment-slug", "in": "header", "required": true, "schema": { "type": "string" } },
78
+ { "name": "td-api-key", "in": "header", "required": true, "schema": { "type": "string" } },
79
+ { "name": "td-device-id", "in": "header", "required": true, "schema": { "type": "string" } },
80
+ { "name": "td-session-id", "in": "header", "required": false, "schema": { "type": "string" } }
81
+ ],
82
+ "requestBody": {
83
+ "required": true,
84
+ "content": {
85
+ "application/json": {
86
+ "schema": {
87
+ "$ref": "#/components/schemas/IdentifyRequest"
88
+ }
89
+ }
90
+ }
91
+ },
92
+ "responses": {
93
+ "200": {
94
+ "description": "Identify success",
95
+ "content": {
96
+ "application/json": {
97
+ "schema": {
98
+ "$ref": "#/components/schemas/IdentifyResponse"
99
+ }
100
+ }
101
+ }
102
+ },
103
+ "400": {
104
+ "description": "Bad request",
105
+ "content": {
106
+ "application/json": {
107
+ "schema": {
108
+ "$ref": "#/components/schemas/IdentifyError"
109
+ }
110
+ }
111
+ }
112
+ },
113
+ "422": {
114
+ "description": "Validation error",
115
+ "content": {
116
+ "application/json": {
117
+ "schema": {
118
+ "$ref": "#/components/schemas/ValidationError"
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+ },
126
+ "/v1/events": {
127
+ "post": {
128
+ "operationId": "trackEvents",
129
+ "summary": "Track events",
130
+ "tags": ["Events"],
131
+ "parameters": [
132
+ { "name": "td-org-id", "in": "header", "required": true, "schema": { "type": "string" } },
133
+ { "name": "td-project-id", "in": "header", "required": true, "schema": { "type": "string" } },
134
+ { "name": "td-environment-slug", "in": "header", "required": true, "schema": { "type": "string" } },
135
+ { "name": "td-api-key", "in": "header", "required": true, "schema": { "type": "string" } },
136
+ { "name": "td-device-id", "in": "header", "required": false, "schema": { "type": "string" } },
137
+ { "name": "td-session-id", "in": "header", "required": false, "schema": { "type": "string" } }
138
+ ],
139
+ "requestBody": {
140
+ "required": true,
141
+ "content": {
142
+ "application/json": {
143
+ "schema": {
144
+ "$ref": "#/components/schemas/EventsRequest"
145
+ }
146
+ }
147
+ }
148
+ },
149
+ "responses": {
150
+ "200": {
151
+ "description": "Events tracked",
152
+ "content": {
153
+ "application/json": {
154
+ "schema": {
155
+ "$ref": "#/components/schemas/EventsResponse"
156
+ }
157
+ }
158
+ }
159
+ },
160
+ "400": {
161
+ "description": "Bad request",
162
+ "content": {
163
+ "application/json": {
164
+ "schema": {
165
+ "$ref": "#/components/schemas/EventsError"
166
+ }
167
+ }
168
+ }
169
+ },
170
+ "422": {
171
+ "description": "Validation error",
172
+ "content": {
173
+ "application/json": {
174
+ "schema": {
175
+ "$ref": "#/components/schemas/ValidationError"
176
+ }
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
183
+ },
184
+ "components": {
185
+ "schemas": {
186
+ "DevicePlatform": {
187
+ "type": "string",
188
+ "enum": ["ios", "android", "web"]
189
+ },
190
+ "NotificationPlatform": {
191
+ "type": "string",
192
+ "enum": ["fcm", "apns", "expo"]
193
+ },
194
+ "IdentifyVersionStatus": {
195
+ "type": "string",
196
+ "enum": ["up_to_date", "update_available", "update_required", "rollback_required"]
197
+ },
198
+ "DeviceOS": {
199
+ "type": "object",
200
+ "properties": {
201
+ "platform": { "$ref": "#/components/schemas/DevicePlatform" },
202
+ "name": { "type": "string" },
203
+ "version": { "type": "string" }
204
+ },
205
+ "required": ["platform", "name", "version"]
206
+ },
207
+ "DeviceApplication": {
208
+ "type": "object",
209
+ "properties": {
210
+ "version": { "type": "string" },
211
+ "build_number": { "type": "integer" }
212
+ },
213
+ "required": ["version", "build_number"]
214
+ },
215
+ "DeviceHardware": {
216
+ "type": "object",
217
+ "properties": {
218
+ "device_name": { "type": "string" },
219
+ "device_type": { "type": "string" },
220
+ "device_brand": { "type": "string" }
221
+ },
222
+ "required": ["device_name", "device_type", "device_brand"]
223
+ },
224
+ "DeviceUpdate": {
225
+ "type": "object",
226
+ "properties": {
227
+ "is_enabled": { "type": "boolean" },
228
+ "update_id": { "type": "string" },
229
+ "update_channel": { "type": "string" },
230
+ "runtime_version": { "type": "string" },
231
+ "emergency_launch": {
232
+ "type": "object",
233
+ "properties": {
234
+ "is_emergency_launch": { "type": "boolean" },
235
+ "reason": { "type": "string" }
236
+ },
237
+ "required": ["is_emergency_launch"]
238
+ },
239
+ "is_embedded_launch": { "type": "boolean" },
240
+ "created_at": { "type": "string" }
241
+ },
242
+ "required": ["is_enabled", "update_id", "update_channel", "runtime_version", "emergency_launch", "is_embedded_launch", "created_at"]
243
+ },
244
+ "DeviceNotifications": {
245
+ "type": "object",
246
+ "properties": {
247
+ "push": {
248
+ "type": "object",
249
+ "properties": {
250
+ "enabled": { "type": "boolean" },
251
+ "granted": { "type": "boolean" },
252
+ "token": { "type": "string", "nullable": true },
253
+ "platform": { "$ref": "#/components/schemas/NotificationPlatform" }
254
+ },
255
+ "required": ["enabled", "granted", "token", "platform"]
256
+ }
257
+ },
258
+ "required": ["push"]
259
+ },
260
+ "Device": {
261
+ "type": "object",
262
+ "properties": {
263
+ "timestamp": { "type": "string", "format": "date-time" },
264
+ "os": { "$ref": "#/components/schemas/DeviceOS" },
265
+ "application": { "$ref": "#/components/schemas/DeviceApplication" },
266
+ "hardware": { "$ref": "#/components/schemas/DeviceHardware" },
267
+ "update": {
268
+ "oneOf": [
269
+ { "$ref": "#/components/schemas/DeviceUpdate" },
270
+ { "type": "null" }
271
+ ]
272
+ },
273
+ "notifications": { "$ref": "#/components/schemas/DeviceNotifications" }
274
+ },
275
+ "required": ["os", "application", "hardware"]
276
+ },
277
+ "User": {
278
+ "type": "object",
279
+ "properties": {
280
+ "persona_id": { "type": "string" },
281
+ "user_id": { "type": "string" },
282
+ "email": { "type": "string" },
283
+ "name": { "type": "string" }
284
+ }
285
+ },
286
+ "IdentifyRequest": {
287
+ "type": "object",
288
+ "properties": {
289
+ "device": { "$ref": "#/components/schemas/Device" },
290
+ "user": { "$ref": "#/components/schemas/User" }
291
+ },
292
+ "required": ["device"]
293
+ },
294
+ "VersionUpdate": {
295
+ "type": "object",
296
+ "properties": {
297
+ "version": { "type": "string" },
298
+ "build": { "type": "string" },
299
+ "update_id": { "type": "string" },
300
+ "effective_date": { "type": "string", "format": "date-time" },
301
+ "release_notes": { "type": "string", "nullable": true }
302
+ },
303
+ "required": ["version", "build", "update_id", "effective_date"]
304
+ },
305
+ "VersionInfo": {
306
+ "type": "object",
307
+ "properties": {
308
+ "status": { "$ref": "#/components/schemas/IdentifyVersionStatus" },
309
+ "update": {
310
+ "oneOf": [
311
+ { "$ref": "#/components/schemas/VersionUpdate" },
312
+ { "type": "null" }
313
+ ]
314
+ }
315
+ },
316
+ "required": ["status"]
317
+ },
318
+ "IdentifyResponseData": {
319
+ "type": "object",
320
+ "properties": {
321
+ "session_id": { "type": "string" },
322
+ "device_id": { "type": "string" },
323
+ "user_id": { "type": "string" },
324
+ "token": { "type": "string" },
325
+ "version_info": { "$ref": "#/components/schemas/VersionInfo" }
326
+ },
327
+ "required": ["session_id", "device_id", "user_id", "token", "version_info"]
328
+ },
329
+ "IdentifyResponse": {
330
+ "type": "object",
331
+ "properties": {
332
+ "success": { "type": "boolean", "enum": [true] },
333
+ "data": { "$ref": "#/components/schemas/IdentifyResponseData" }
334
+ },
335
+ "required": ["success", "data"]
336
+ },
337
+ "IdentifyErrorCode": {
338
+ "type": "string",
339
+ "enum": [
340
+ "MISSING_ORG_ID",
341
+ "MISSING_PROJECT_ID",
342
+ "MISSING_ENVIRONMENT_SLUG",
343
+ "MISSING_DEVICE_ID",
344
+ "IDENTIFY_FAILED",
345
+ "NO_SESSION_ID_GENERATED",
346
+ "NO_DEVICE_ID_GENERATED",
347
+ "NO_USER_ID_GENERATED"
348
+ ]
349
+ },
350
+ "IdentifyError": {
351
+ "type": "object",
352
+ "properties": {
353
+ "success": { "type": "boolean", "enum": [false] },
354
+ "error": {
355
+ "type": "object",
356
+ "properties": {
357
+ "code": { "$ref": "#/components/schemas/IdentifyErrorCode" },
358
+ "message": { "type": "string" }
359
+ },
360
+ "required": ["code", "message"]
361
+ }
362
+ },
363
+ "required": ["success", "error"]
364
+ },
365
+ "Event": {
366
+ "type": "object",
367
+ "properties": {
368
+ "event_name": { "type": "string" },
369
+ "event_type": { "type": "string", "enum": ["action", "custom", "screen_view"] },
370
+ "properties": { "type": "object", "additionalProperties": true },
371
+ "timestamp": { "type": "string" },
372
+ "session_id": { "type": "string" },
373
+ "device_id": { "type": "string" }
374
+ },
375
+ "required": ["event_name", "event_type"]
376
+ },
377
+ "EventsRequest": {
378
+ "type": "object",
379
+ "properties": {
380
+ "events": {
381
+ "type": "array",
382
+ "items": { "$ref": "#/components/schemas/Event" }
383
+ },
384
+ "session_id": { "type": "string" },
385
+ "device_id": { "type": "string" }
386
+ },
387
+ "required": ["events"]
388
+ },
389
+ "EventsResponseData": {
390
+ "type": "object",
391
+ "properties": {
392
+ "event_ids": { "type": "array", "items": { "type": "string" } },
393
+ "processed_count": { "type": "integer" },
394
+ "failed_count": { "type": "integer" }
395
+ },
396
+ "required": ["event_ids", "processed_count", "failed_count"]
397
+ },
398
+ "EventsResponse": {
399
+ "type": "object",
400
+ "properties": {
401
+ "success": { "type": "boolean", "enum": [true] },
402
+ "data": { "$ref": "#/components/schemas/EventsResponseData" }
403
+ },
404
+ "required": ["success", "data"]
405
+ },
406
+ "EventsErrorCode": {
407
+ "type": "string",
408
+ "enum": [
409
+ "MISSING_ORG_ID",
410
+ "MISSING_PROJECT_ID",
411
+ "MISSING_ENVIRONMENT_SLUG",
412
+ "MISSING_DEVICE_ID",
413
+ "EVENTS_PROCESSING_FAILED",
414
+ "INVALID_SESSION",
415
+ "INVALID_DEVICE",
416
+ "BATCH_SIZE_EXCEEDED",
417
+ "VALIDATION_ERROR"
418
+ ]
419
+ },
420
+ "EventsError": {
421
+ "type": "object",
422
+ "properties": {
423
+ "success": { "type": "boolean", "enum": [false] },
424
+ "error": {
425
+ "type": "object",
426
+ "properties": {
427
+ "code": { "$ref": "#/components/schemas/EventsErrorCode" },
428
+ "message": { "type": "string" }
429
+ },
430
+ "required": ["code", "message"]
431
+ }
432
+ },
433
+ "required": ["success", "error"]
434
+ },
435
+ "ValidationError": {
436
+ "type": "object",
437
+ "properties": {
438
+ "type": { "type": "string", "enum": ["validation"] },
439
+ "on": { "type": "string" },
440
+ "summary": { "type": "string" },
441
+ "message": { "type": "string" },
442
+ "found": {},
443
+ "property": { "type": "string" },
444
+ "expected": { "type": "string" }
445
+ },
446
+ "required": ["type", "on"]
447
+ }
448
+ },
449
+ "securitySchemes": {
450
+ "apiKey": {
451
+ "type": "apiKey",
452
+ "name": "td-api-key",
453
+ "in": "header"
454
+ }
455
+ }
456
+ }
457
+ }
@@ -0,0 +1,373 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export interface paths {
7
+ "/": {
8
+ parameters: {
9
+ query?: never;
10
+ header?: never;
11
+ path?: never;
12
+ cookie?: never;
13
+ };
14
+ /** Root endpoint */
15
+ get: operations["getRoot"];
16
+ put?: never;
17
+ post?: never;
18
+ delete?: never;
19
+ options?: never;
20
+ head?: never;
21
+ patch?: never;
22
+ trace?: never;
23
+ };
24
+ "/health": {
25
+ parameters: {
26
+ query?: never;
27
+ header?: never;
28
+ path?: never;
29
+ cookie?: never;
30
+ };
31
+ /** Health check */
32
+ get: operations["getHealth"];
33
+ put?: never;
34
+ post?: never;
35
+ delete?: never;
36
+ options?: never;
37
+ head?: never;
38
+ patch?: never;
39
+ trace?: never;
40
+ };
41
+ "/v1/identify": {
42
+ parameters: {
43
+ query?: never;
44
+ header?: never;
45
+ path?: never;
46
+ cookie?: never;
47
+ };
48
+ get?: never;
49
+ put?: never;
50
+ /** Identify device and user */
51
+ post: operations["identify"];
52
+ delete?: never;
53
+ options?: never;
54
+ head?: never;
55
+ patch?: never;
56
+ trace?: never;
57
+ };
58
+ "/v1/events": {
59
+ parameters: {
60
+ query?: never;
61
+ header?: never;
62
+ path?: never;
63
+ cookie?: never;
64
+ };
65
+ get?: never;
66
+ put?: never;
67
+ /** Track events */
68
+ post: operations["trackEvents"];
69
+ delete?: never;
70
+ options?: never;
71
+ head?: never;
72
+ patch?: never;
73
+ trace?: never;
74
+ };
75
+ }
76
+ export type webhooks = Record<string, never>;
77
+ export interface components {
78
+ schemas: {
79
+ /** @enum {string} */
80
+ DevicePlatform: "ios" | "android" | "web";
81
+ /** @enum {string} */
82
+ NotificationPlatform: "fcm" | "apns" | "expo";
83
+ /** @enum {string} */
84
+ IdentifyVersionStatus: "up_to_date" | "update_available" | "update_required" | "rollback_required";
85
+ DeviceOS: {
86
+ platform: components["schemas"]["DevicePlatform"];
87
+ name: string;
88
+ version: string;
89
+ };
90
+ DeviceApplication: {
91
+ version: string;
92
+ build_number: number;
93
+ };
94
+ DeviceHardware: {
95
+ device_name: string;
96
+ device_type: string;
97
+ device_brand: string;
98
+ };
99
+ DeviceUpdate: {
100
+ is_enabled: boolean;
101
+ update_id: string;
102
+ update_channel: string;
103
+ runtime_version: string;
104
+ emergency_launch: {
105
+ is_emergency_launch: boolean;
106
+ reason?: string;
107
+ };
108
+ is_embedded_launch: boolean;
109
+ created_at: string;
110
+ };
111
+ DeviceNotifications: {
112
+ push: {
113
+ enabled: boolean;
114
+ granted: boolean;
115
+ token: string | null;
116
+ platform: components["schemas"]["NotificationPlatform"];
117
+ };
118
+ };
119
+ Device: {
120
+ /** Format: date-time */
121
+ timestamp?: string;
122
+ os: components["schemas"]["DeviceOS"];
123
+ application: components["schemas"]["DeviceApplication"];
124
+ hardware: components["schemas"]["DeviceHardware"];
125
+ update?: components["schemas"]["DeviceUpdate"] | null;
126
+ notifications?: components["schemas"]["DeviceNotifications"];
127
+ };
128
+ User: {
129
+ persona_id?: string;
130
+ user_id?: string;
131
+ email?: string;
132
+ name?: string;
133
+ };
134
+ IdentifyRequest: {
135
+ device: components["schemas"]["Device"];
136
+ user?: components["schemas"]["User"];
137
+ };
138
+ VersionUpdate: {
139
+ version: string;
140
+ build: string;
141
+ update_id: string;
142
+ /** Format: date-time */
143
+ effective_date: string;
144
+ release_notes?: string | null;
145
+ };
146
+ VersionInfo: {
147
+ status: components["schemas"]["IdentifyVersionStatus"];
148
+ update?: components["schemas"]["VersionUpdate"] | null;
149
+ };
150
+ IdentifyResponseData: {
151
+ session_id: string;
152
+ device_id: string;
153
+ user_id: string;
154
+ token: string;
155
+ version_info: components["schemas"]["VersionInfo"];
156
+ };
157
+ IdentifyResponse: {
158
+ /** @enum {boolean} */
159
+ success: true;
160
+ data: components["schemas"]["IdentifyResponseData"];
161
+ };
162
+ /** @enum {string} */
163
+ IdentifyErrorCode: "MISSING_ORG_ID" | "MISSING_PROJECT_ID" | "MISSING_ENVIRONMENT_SLUG" | "MISSING_DEVICE_ID" | "IDENTIFY_FAILED" | "NO_SESSION_ID_GENERATED" | "NO_DEVICE_ID_GENERATED" | "NO_USER_ID_GENERATED";
164
+ IdentifyError: {
165
+ /** @enum {boolean} */
166
+ success: false;
167
+ error: {
168
+ code: components["schemas"]["IdentifyErrorCode"];
169
+ message: string;
170
+ };
171
+ };
172
+ Event: {
173
+ event_name: string;
174
+ /** @enum {string} */
175
+ event_type: "action" | "custom" | "screen_view";
176
+ properties?: {
177
+ [key: string]: unknown;
178
+ };
179
+ timestamp?: string;
180
+ session_id?: string;
181
+ device_id?: string;
182
+ };
183
+ EventsRequest: {
184
+ events: components["schemas"]["Event"][];
185
+ session_id?: string;
186
+ device_id?: string;
187
+ };
188
+ EventsResponseData: {
189
+ event_ids: string[];
190
+ processed_count: number;
191
+ failed_count: number;
192
+ };
193
+ EventsResponse: {
194
+ /** @enum {boolean} */
195
+ success: true;
196
+ data: components["schemas"]["EventsResponseData"];
197
+ };
198
+ /** @enum {string} */
199
+ EventsErrorCode: "MISSING_ORG_ID" | "MISSING_PROJECT_ID" | "MISSING_ENVIRONMENT_SLUG" | "MISSING_DEVICE_ID" | "EVENTS_PROCESSING_FAILED" | "INVALID_SESSION" | "INVALID_DEVICE" | "BATCH_SIZE_EXCEEDED" | "VALIDATION_ERROR";
200
+ EventsError: {
201
+ /** @enum {boolean} */
202
+ success: false;
203
+ error: {
204
+ code: components["schemas"]["EventsErrorCode"];
205
+ message: string;
206
+ };
207
+ };
208
+ ValidationError: {
209
+ /** @enum {string} */
210
+ type: "validation";
211
+ on: string;
212
+ summary?: string;
213
+ message?: string;
214
+ found?: unknown;
215
+ property?: string;
216
+ expected?: string;
217
+ };
218
+ };
219
+ responses: never;
220
+ parameters: never;
221
+ requestBodies: never;
222
+ headers: never;
223
+ pathItems: never;
224
+ }
225
+ export type $defs = Record<string, never>;
226
+ export interface operations {
227
+ getRoot: {
228
+ parameters: {
229
+ query?: never;
230
+ header?: never;
231
+ path?: never;
232
+ cookie?: never;
233
+ };
234
+ requestBody?: never;
235
+ responses: {
236
+ /** @description API info */
237
+ 200: {
238
+ headers: {
239
+ [name: string]: unknown;
240
+ };
241
+ content: {
242
+ "application/json": {
243
+ message: string;
244
+ version: string;
245
+ };
246
+ };
247
+ };
248
+ };
249
+ };
250
+ getHealth: {
251
+ parameters: {
252
+ query?: never;
253
+ header?: never;
254
+ path?: never;
255
+ cookie?: never;
256
+ };
257
+ requestBody?: never;
258
+ responses: {
259
+ /** @description Health status */
260
+ 200: {
261
+ headers: {
262
+ [name: string]: unknown;
263
+ };
264
+ content: {
265
+ "application/json": {
266
+ status: string;
267
+ timestamp: string;
268
+ build_id: string;
269
+ service_id?: string;
270
+ };
271
+ };
272
+ };
273
+ };
274
+ };
275
+ identify: {
276
+ parameters: {
277
+ query?: never;
278
+ header: {
279
+ "td-org-id": string;
280
+ "td-project-id": string;
281
+ "td-environment-slug": string;
282
+ "td-api-key": string;
283
+ "td-device-id": string;
284
+ "td-session-id"?: string;
285
+ };
286
+ path?: never;
287
+ cookie?: never;
288
+ };
289
+ requestBody: {
290
+ content: {
291
+ "application/json": components["schemas"]["IdentifyRequest"];
292
+ };
293
+ };
294
+ responses: {
295
+ /** @description Identify success */
296
+ 200: {
297
+ headers: {
298
+ [name: string]: unknown;
299
+ };
300
+ content: {
301
+ "application/json": components["schemas"]["IdentifyResponse"];
302
+ };
303
+ };
304
+ /** @description Bad request */
305
+ 400: {
306
+ headers: {
307
+ [name: string]: unknown;
308
+ };
309
+ content: {
310
+ "application/json": components["schemas"]["IdentifyError"];
311
+ };
312
+ };
313
+ /** @description Validation error */
314
+ 422: {
315
+ headers: {
316
+ [name: string]: unknown;
317
+ };
318
+ content: {
319
+ "application/json": components["schemas"]["ValidationError"];
320
+ };
321
+ };
322
+ };
323
+ };
324
+ trackEvents: {
325
+ parameters: {
326
+ query?: never;
327
+ header: {
328
+ "td-org-id": string;
329
+ "td-project-id": string;
330
+ "td-environment-slug": string;
331
+ "td-api-key": string;
332
+ "td-device-id"?: string;
333
+ "td-session-id"?: string;
334
+ };
335
+ path?: never;
336
+ cookie?: never;
337
+ };
338
+ requestBody: {
339
+ content: {
340
+ "application/json": components["schemas"]["EventsRequest"];
341
+ };
342
+ };
343
+ responses: {
344
+ /** @description Events tracked */
345
+ 200: {
346
+ headers: {
347
+ [name: string]: unknown;
348
+ };
349
+ content: {
350
+ "application/json": components["schemas"]["EventsResponse"];
351
+ };
352
+ };
353
+ /** @description Bad request */
354
+ 400: {
355
+ headers: {
356
+ [name: string]: unknown;
357
+ };
358
+ content: {
359
+ "application/json": components["schemas"]["EventsError"];
360
+ };
361
+ };
362
+ /** @description Validation error */
363
+ 422: {
364
+ headers: {
365
+ [name: string]: unknown;
366
+ };
367
+ content: {
368
+ "application/json": components["schemas"]["ValidationError"];
369
+ };
370
+ };
371
+ };
372
+ };
373
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teardown/ingest-api",
3
- "version": "2.0.33",
3
+ "version": "2.0.34",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -30,27 +30,27 @@
30
30
  "scripts": {
31
31
  "dev": "bun run typecheck --watch",
32
32
  "typecheck": "bun x tsgo --noEmit --project ./tsconfig.lib.json",
33
- "generate:types": "bun run scripts/generate-types.ts",
34
- "build": "bun run generate:types",
35
- "prepublishOnly": "bun run generate:types",
33
+ "generate:types": "bun run scripts/generate-openapi-types.ts",
34
+ "generate:types:offline": "bun run scripts/generate-openapi-types.ts --from-file",
35
+ "build": "bun run generate:types:offline",
36
+ "prepublishOnly": "bun run generate:types:offline",
36
37
  "lint": "bun x biome lint .",
37
38
  "fmt": "bun x biome format --write .",
38
39
  "check": "bun x biome check ."
39
40
  },
40
41
  "dependencies": {
41
- "@elysiajs/eden": "1.4.5",
42
- "@teardown/errors": "2.0.33",
43
- "@teardown/schemas": "2.0.33",
44
- "@teardown/types": "2.0.33",
45
- "zod": "4.2.1"
42
+ "openapi-fetch": "^0.13.5",
43
+ "@teardown/errors": "2.0.34",
44
+ "@teardown/schemas": "2.0.34",
45
+ "@teardown/types": "2.0.34"
46
46
  },
47
47
  "peerDependencies": {
48
- "elysia": "1.4.16",
49
48
  "typescript": "5.9.3"
50
49
  },
51
50
  "devDependencies": {
51
+ "openapi-typescript": "^7.6.1",
52
52
  "@biomejs/biome": "2.3.10",
53
53
  "@types/bun": "1.3.5",
54
- "@teardown/tsconfig": "2.0.33"
54
+ "@teardown/tsconfig": "2.0.34"
55
55
  }
56
56
  }
@@ -1,15 +1,64 @@
1
- import { edenFetch } from "@elysiajs/eden";
2
- import type { IngestApp } from "../../generated/app";
1
+ /**
2
+ * Ingest API client using openapi-fetch.
3
+ * Type-safe client generated from OpenAPI schema.
4
+ */
5
+ import createClient, { type FetchOptions } from "openapi-fetch";
6
+ import type { components, paths } from "../../generated/openapi";
3
7
 
4
- export type { IngestApp };
5
- export { edenFetch };
6
-
7
- export type ClientConfig = NonNullable<Parameters<typeof edenFetch<typeof IngestApp>>[1]>;
8
- export const client = edenFetch<typeof IngestApp>;
9
- export type Client = ReturnType<typeof client>;
10
- export type RequestOptions = Omit<NonNullable<Parameters<Client>[1]>, "headers"> & {
8
+ /** Client configuration options */
9
+ export interface ClientConfig {
10
+ baseUrl?: string;
11
11
  headers?: Record<string, string>;
12
- };
12
+ }
13
+
14
+ /** Create a type-safe client for the Ingest API */
15
+ export function createIngestClient(config?: ClientConfig) {
16
+ return createClient<paths>({
17
+ baseUrl: config?.baseUrl ?? "https://ingest.teardown.dev",
18
+ headers: config?.headers,
19
+ });
20
+ }
21
+
22
+ /** Ingest API client type */
23
+ export type IngestClient = ReturnType<typeof createIngestClient>;
24
+
25
+ /** Re-export schema types for consumers */
26
+ export type { paths, components };
27
+
28
+ /** Convenience type exports from components */
29
+ export type Device = components["schemas"]["Device"];
30
+ export type DeviceOS = components["schemas"]["DeviceOS"];
31
+ export type DeviceApplication = components["schemas"]["DeviceApplication"];
32
+ export type DeviceHardware = components["schemas"]["DeviceHardware"];
33
+ export type DeviceUpdate = components["schemas"]["DeviceUpdate"];
34
+ export type DeviceNotifications = components["schemas"]["DeviceNotifications"];
35
+ export type DevicePlatform = components["schemas"]["DevicePlatform"];
36
+ export type NotificationPlatform = components["schemas"]["NotificationPlatform"];
37
+ export type User = components["schemas"]["User"];
38
+ export type IdentifyRequest = components["schemas"]["IdentifyRequest"];
39
+ export type IdentifyResponse = components["schemas"]["IdentifyResponse"];
40
+ export type IdentifyResponseData = components["schemas"]["IdentifyResponseData"];
41
+ export type IdentifyError = components["schemas"]["IdentifyError"];
42
+ export type IdentifyErrorCode = components["schemas"]["IdentifyErrorCode"];
43
+ export type IdentifyVersionStatus = components["schemas"]["IdentifyVersionStatus"];
44
+ export type VersionInfo = components["schemas"]["VersionInfo"];
45
+ export type VersionUpdate = components["schemas"]["VersionUpdate"];
46
+ export type Event = components["schemas"]["Event"];
47
+ export type EventsRequest = components["schemas"]["EventsRequest"];
48
+ export type EventsResponse = components["schemas"]["EventsResponse"];
49
+ export type EventsResponseData = components["schemas"]["EventsResponseData"];
50
+ export type EventsError = components["schemas"]["EventsError"];
51
+ export type EventsErrorCode = components["schemas"]["EventsErrorCode"];
52
+ export type ValidationError = components["schemas"]["ValidationError"];
53
+
54
+ /** All endpoint paths */
55
+ export type Endpoints = keyof paths;
56
+
57
+ /** Request options type (for backward compatibility) */
58
+ export type RequestOptions = FetchOptions<paths[keyof paths]>;
59
+
60
+ /** Legacy alias - use createIngestClient instead */
61
+ export const client = createIngestClient;
13
62
 
14
- export type Endpoints = Parameters<Client>[0];
15
- export type App = typeof IngestApp;
63
+ /** Legacy type alias */
64
+ export type Client = IngestClient;