@teardown/ingest-api 0.0.12 → 0.0.15
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.
- package/package.json +32 -10
- package/dist/src/client/client.d.ts +0 -123
- package/dist/src/client/client.js +0 -3
- package/dist/src/client/index.d.ts +0 -2
- package/dist/src/client/index.js +0 -2
- package/dist/src/client/types.d.ts +0 -74
- package/dist/src/client/types.js +0 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +0 -1
package/package.json
CHANGED
|
@@ -1,30 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teardown/ingest-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
|
-
"dist
|
|
9
|
+
"dist/**/*"
|
|
10
10
|
],
|
|
11
|
-
"main": "./dist/
|
|
12
|
-
"module": "./dist/
|
|
13
|
-
"types": "./dist/
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./schemas": {
|
|
21
|
+
"types": "./dist/schemas/index.d.ts",
|
|
22
|
+
"import": "./dist/schemas/index.js",
|
|
23
|
+
"default": "./dist/schemas/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./types": {
|
|
26
|
+
"types": "./dist/types/index.d.ts"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
14
29
|
"scripts": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
30
|
+
"sync:schemas": "bun run scripts/sync-schemas.ts",
|
|
31
|
+
"prebuild": "bun run sync:schemas",
|
|
32
|
+
"build": "rm -rf dist && tsc --project ./tsconfig.lib.json",
|
|
33
|
+
"compile": "rm -rf dist && tsc --project ./tsconfig.lib.json",
|
|
34
|
+
"predev": "bun run sync:schemas",
|
|
35
|
+
"dev": "rm -rf dist && tsc --watch --project ./tsconfig.lib.json",
|
|
36
|
+
"check:types": "tsc --noEmit --project ./tsconfig.lib.json",
|
|
18
37
|
"prepublishOnly": "bun run build"
|
|
19
38
|
},
|
|
20
39
|
"dependencies": {
|
|
21
40
|
"@elysiajs/eden": "^1.4.4",
|
|
22
41
|
"elysia": "^1.4.13"
|
|
23
42
|
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"typescript": "^5",
|
|
45
|
+
"zod": "^4"
|
|
46
|
+
},
|
|
24
47
|
"devDependencies": {
|
|
25
48
|
"@types/bun": "latest",
|
|
26
49
|
"@teardown/tsconfig": "1.0.0",
|
|
27
|
-
"@teardown/types": "0.0.1"
|
|
28
|
-
"@teardown/ingest": "0.0.1"
|
|
50
|
+
"@teardown/types": "0.0.1"
|
|
29
51
|
}
|
|
30
52
|
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { edenFetch } from "@elysiajs/eden";
|
|
2
|
-
import type { IngestApp } from "@teardown/ingest/types";
|
|
3
|
-
export * from "@teardown/ingest/types";
|
|
4
|
-
export type ClientConfig = NonNullable<Parameters<typeof edenFetch<IngestApp>>[1]>;
|
|
5
|
-
export declare const client: (server: string, config?: import("@elysiajs/eden/fetch").EdenFetch.Config) => import("@elysiajs/eden/fetch").EdenFetch.Fn<{
|
|
6
|
-
"/v1/identify": {
|
|
7
|
-
post: {
|
|
8
|
-
body: {
|
|
9
|
-
device: {
|
|
10
|
-
applicationInfo: {
|
|
11
|
-
version: string | null;
|
|
12
|
-
buildNumber: string | null;
|
|
13
|
-
} | null;
|
|
14
|
-
updateInfo: {
|
|
15
|
-
isEnabled: boolean;
|
|
16
|
-
updateId: string | null;
|
|
17
|
-
channel: string | null;
|
|
18
|
-
runtimeVersion: string | null;
|
|
19
|
-
isEmergencyLaunch: boolean;
|
|
20
|
-
emergencyLaunchReason: string | null;
|
|
21
|
-
isEmbeddedLaunch: boolean;
|
|
22
|
-
createdAt: Date | null;
|
|
23
|
-
} | null;
|
|
24
|
-
hardwareInfo: {
|
|
25
|
-
deviceName: string | null;
|
|
26
|
-
deviceType: string | null;
|
|
27
|
-
deviceBrand: string | null;
|
|
28
|
-
osVersion: string | null;
|
|
29
|
-
} | null;
|
|
30
|
-
osInfo: {
|
|
31
|
-
type: string;
|
|
32
|
-
name: string | null;
|
|
33
|
-
version: string | null;
|
|
34
|
-
} | null;
|
|
35
|
-
};
|
|
36
|
-
persona?: {
|
|
37
|
-
user_id?: string | undefined;
|
|
38
|
-
email?: string | undefined;
|
|
39
|
-
name?: string | undefined;
|
|
40
|
-
} | undefined;
|
|
41
|
-
};
|
|
42
|
-
params: {};
|
|
43
|
-
query: unknown;
|
|
44
|
-
headers: {
|
|
45
|
-
"td-environment-slug": string;
|
|
46
|
-
"td-device-id"?: string | undefined;
|
|
47
|
-
};
|
|
48
|
-
response: {
|
|
49
|
-
200: {
|
|
50
|
-
success: true;
|
|
51
|
-
session_id: string;
|
|
52
|
-
};
|
|
53
|
-
400: {
|
|
54
|
-
success: false;
|
|
55
|
-
error: {
|
|
56
|
-
code: string;
|
|
57
|
-
message: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
422: {
|
|
61
|
-
type: "validation";
|
|
62
|
-
on: string;
|
|
63
|
-
summary?: string;
|
|
64
|
-
message?: string;
|
|
65
|
-
found?: unknown;
|
|
66
|
-
property?: string;
|
|
67
|
-
expected?: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
} & {
|
|
73
|
-
"/health": {
|
|
74
|
-
get: {
|
|
75
|
-
body: unknown;
|
|
76
|
-
params: {};
|
|
77
|
-
query: unknown;
|
|
78
|
-
headers: unknown;
|
|
79
|
-
response: {
|
|
80
|
-
200: {
|
|
81
|
-
error: string;
|
|
82
|
-
message: string;
|
|
83
|
-
status: number;
|
|
84
|
-
} | {
|
|
85
|
-
error: string;
|
|
86
|
-
status: number;
|
|
87
|
-
message?: undefined;
|
|
88
|
-
} | {
|
|
89
|
-
status: string;
|
|
90
|
-
timestamp: string;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
} & {
|
|
96
|
-
"": {
|
|
97
|
-
get: {
|
|
98
|
-
body: unknown;
|
|
99
|
-
params: {};
|
|
100
|
-
query: unknown;
|
|
101
|
-
headers: unknown;
|
|
102
|
-
response: {
|
|
103
|
-
200: {
|
|
104
|
-
error: string;
|
|
105
|
-
message: string;
|
|
106
|
-
status: number;
|
|
107
|
-
} | {
|
|
108
|
-
error: string;
|
|
109
|
-
status: number;
|
|
110
|
-
message?: undefined;
|
|
111
|
-
} | {
|
|
112
|
-
message: string;
|
|
113
|
-
version: string;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
}>;
|
|
119
|
-
export type Client = ReturnType<typeof client>;
|
|
120
|
-
export type RequestOptions = Omit<NonNullable<Parameters<Client>[1]>, "headers"> & {
|
|
121
|
-
headers?: Record<string, string>;
|
|
122
|
-
};
|
|
123
|
-
export type Endpoints = Parameters<Client>[0];
|
package/dist/src/client/index.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
export declare class EdenFetchError<Status extends number = number, Value = unknown> extends Error {
|
|
2
|
-
status: Status;
|
|
3
|
-
value: Value;
|
|
4
|
-
constructor(status: Status, value: Value);
|
|
5
|
-
}
|
|
6
|
-
export type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
|
|
7
|
-
export type Enumerate<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc["length"]]>;
|
|
8
|
-
export type ErrorRange = Range<300, 599>;
|
|
9
|
-
export type MapError<T extends Record<number, unknown>> = [
|
|
10
|
-
{
|
|
11
|
-
[K in keyof T]-?: K extends ErrorRange ? K : never;
|
|
12
|
-
}[keyof T]
|
|
13
|
-
] extends [infer A extends number] ? {
|
|
14
|
-
[K in A]: EdenFetchError<K, T[K]>;
|
|
15
|
-
}[A] : false;
|
|
16
|
-
export type UnionToIntersect<U> = (U extends any ? (arg: U) => any : never) extends (arg: infer I) => void ? I : never;
|
|
17
|
-
export type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
18
|
-
export type IsNever<T> = [T] extends [never] ? true : false;
|
|
19
|
-
export type IsUnknown<T> = IsAny<T> extends true ? false : unknown extends T ? true : false;
|
|
20
|
-
export type AnyTypedRoute = {
|
|
21
|
-
body?: unknown;
|
|
22
|
-
headers?: unknown;
|
|
23
|
-
query?: unknown;
|
|
24
|
-
params?: unknown;
|
|
25
|
-
response: Record<number, unknown>;
|
|
26
|
-
};
|
|
27
|
-
export type Prettify<T> = {
|
|
28
|
-
[K in keyof T]: T[K];
|
|
29
|
-
} & {};
|
|
30
|
-
export type TreatyToPath<T, Path extends string = ""> = UnionToIntersect<T extends Record<string, unknown> ? {
|
|
31
|
-
[K in keyof T]: T[K] extends AnyTypedRoute ? {
|
|
32
|
-
[path in Path]: {
|
|
33
|
-
[method in K]: T[K];
|
|
34
|
-
};
|
|
35
|
-
} : unknown extends T[K] ? {
|
|
36
|
-
[path in Path]: {
|
|
37
|
-
[method in K]: T[K];
|
|
38
|
-
};
|
|
39
|
-
} : TreatyToPath<T[K], `${Path}/${K & string}`>;
|
|
40
|
-
}[keyof T] : {}>;
|
|
41
|
-
export type Not<T> = T extends true ? false : true;
|
|
42
|
-
export type Fn<Schema extends Record<string, any>> = <Endpoint extends keyof Schema, Method extends Uppercase<Extract<keyof Schema[Endpoint], string>>, Route extends Schema[Endpoint][Lowercase<Method>]>(endpoint: Endpoint, options: Omit<RequestInit, "body" | "method" | "headers"> & ("GET" extends Method ? {
|
|
43
|
-
method?: Method;
|
|
44
|
-
} : {
|
|
45
|
-
method: Method;
|
|
46
|
-
}) & (IsNever<keyof Route["params"]> extends true ? {
|
|
47
|
-
params?: Record<never, string>;
|
|
48
|
-
} : {
|
|
49
|
-
params: Route["params"];
|
|
50
|
-
}) & (IsNever<keyof Route["query"]> extends true ? {
|
|
51
|
-
query?: Record<never, string>;
|
|
52
|
-
} : {
|
|
53
|
-
query: Route["query"];
|
|
54
|
-
}) & (undefined extends Route["headers"] ? {
|
|
55
|
-
headers?: Record<string, string>;
|
|
56
|
-
} : {
|
|
57
|
-
headers: Route["headers"];
|
|
58
|
-
}) & (IsUnknown<Route["body"]> extends false ? {
|
|
59
|
-
body: Route["body"];
|
|
60
|
-
} : {
|
|
61
|
-
body?: unknown;
|
|
62
|
-
})) => Promise<Prettify<{
|
|
63
|
-
data: Awaited<Route["response"][200]>;
|
|
64
|
-
error: null;
|
|
65
|
-
status: number;
|
|
66
|
-
headers: Record<string, unknown>;
|
|
67
|
-
retry(): Promise<void>;
|
|
68
|
-
} | {
|
|
69
|
-
data: null;
|
|
70
|
-
error: MapError<Route["response"]> extends infer Errors ? IsNever<Errors> extends true ? EdenFetchError<number, string> : Errors : EdenFetchError<number, string>;
|
|
71
|
-
status: number;
|
|
72
|
-
headers: Record<string, unknown>;
|
|
73
|
-
retry(): Promise<void>;
|
|
74
|
-
}>>;
|
package/dist/src/client/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./client";
|
package/dist/src/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./client";
|