@teardown/schemas 0.1.21 → 0.1.23
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 +49 -52
- package/src/common/primitives.ts +21 -0
- package/src/common/responses.ts +25 -0
- package/{dist/common/type-checks.d.ts → src/common/type-checks.ts} +23 -4
- package/{dist/index.js → src/index.ts} +1 -0
- package/src/modules/analytics/schemas.ts +178 -0
- package/src/modules/builds/schemas.ts +171 -0
- package/src/modules/devices/schemas.ts +196 -0
- package/src/modules/environment/schemas.ts +81 -0
- package/src/modules/events/index.ts +2 -0
- package/src/modules/events/schemas.ts +129 -0
- package/src/modules/identify/schemas.ts +257 -0
- package/src/modules/me/schemas.ts +87 -0
- package/src/modules/orgs/schemas.ts +260 -0
- package/src/modules/personas/schemas.ts +123 -0
- package/src/modules/projects/schemas.ts +179 -0
- package/src/modules/sessions/schemas.ts +158 -0
- package/src/modules/versions/schemas.ts +192 -0
- package/dist/common/index.js +0 -3
- package/dist/common/primitives.d.ts +0 -11
- package/dist/common/primitives.js +0 -8
- package/dist/common/responses.d.ts +0 -27
- package/dist/common/responses.js +0 -13
- package/dist/common/type-checks.js +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/modules/analytics/schemas.d.ts +0 -239
- package/dist/modules/analytics/schemas.js +0 -136
- package/dist/modules/builds/schemas.d.ts +0 -248
- package/dist/modules/builds/schemas.js +0 -137
- package/dist/modules/devices/schemas.d.ts +0 -207
- package/dist/modules/devices/schemas.js +0 -165
- package/dist/modules/environment/schemas.d.ts +0 -56
- package/dist/modules/environment/schemas.js +0 -57
- package/dist/modules/events/schemas.d.ts +0 -138
- package/dist/modules/events/schemas.js +0 -116
- package/dist/modules/identify/index.js +0 -1
- package/dist/modules/identify/schemas.d.ts +0 -377
- package/dist/modules/identify/schemas.js +0 -221
- package/dist/modules/index.js +0 -12
- package/dist/modules/me/index.d.ts +0 -1
- package/dist/modules/me/index.js +0 -1
- package/dist/modules/me/schemas.d.ts +0 -75
- package/dist/modules/me/schemas.js +0 -76
- package/dist/modules/orgs/index.d.ts +0 -1
- package/dist/modules/orgs/index.js +0 -1
- package/dist/modules/orgs/schemas.d.ts +0 -308
- package/dist/modules/orgs/schemas.js +0 -214
- package/dist/modules/personas/index.d.ts +0 -1
- package/dist/modules/personas/index.js +0 -1
- package/dist/modules/personas/schemas.d.ts +0 -170
- package/dist/modules/personas/schemas.js +0 -100
- package/dist/modules/projects/index.d.ts +0 -1
- package/dist/modules/projects/index.js +0 -1
- package/dist/modules/projects/schemas.d.ts +0 -222
- package/dist/modules/projects/schemas.js +0 -145
- package/dist/modules/sessions/index.d.ts +0 -1
- package/dist/modules/sessions/index.js +0 -1
- package/dist/modules/sessions/schemas.d.ts +0 -258
- package/dist/modules/sessions/schemas.js +0 -128
- package/dist/modules/versions/index.d.ts +0 -1
- package/dist/modules/versions/index.js +0 -1
- package/dist/modules/versions/schemas.d.ts +0 -248
- package/dist/modules/versions/schemas.js +0 -155
- /package/{dist/common/index.d.ts → src/common/index.ts} +0 -0
- /package/{dist/modules/analytics/index.d.ts → src/modules/analytics/index.ts} +0 -0
- /package/{dist/modules/analytics/index.js → src/modules/builds/index.ts} +0 -0
- /package/{dist/modules/builds/index.d.ts → src/modules/devices/index.ts} +0 -0
- /package/{dist/modules/builds/index.js → src/modules/environment/index.ts} +0 -0
- /package/{dist/modules/devices/index.d.ts → src/modules/identify/index.ts} +0 -0
- /package/{dist/modules/index.d.ts → src/modules/index.ts} +0 -0
- /package/{dist/modules/devices/index.js → src/modules/me/index.ts} +0 -0
- /package/{dist/modules/environment/index.d.ts → src/modules/orgs/index.ts} +0 -0
- /package/{dist/modules/environment/index.js → src/modules/personas/index.ts} +0 -0
- /package/{dist/modules/events/index.d.ts → src/modules/projects/index.ts} +0 -0
- /package/{dist/modules/events/index.js → src/modules/sessions/index.ts} +0 -0
- /package/{dist/modules/identify/index.d.ts → src/modules/versions/index.ts} +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { type Static, Type } from "@sinclair/typebox";
|
|
2
|
+
import type { AssertSchemaCompatibleWithRow, AssertTrue } from "../../common";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Base session schema
|
|
6
|
+
* Represents device_sessions table structure
|
|
7
|
+
*/
|
|
8
|
+
export const SessionSchema = Type.Object({
|
|
9
|
+
id: Type.String({ format: "uuid" }),
|
|
10
|
+
device_id: Type.String({ format: "uuid" }),
|
|
11
|
+
token: Type.Union([Type.String(), Type.Null()]),
|
|
12
|
+
version: Type.Union([Type.String(), Type.Null()]),
|
|
13
|
+
version_id: Type.Union([Type.String({ format: "uuid" }), Type.Null()]),
|
|
14
|
+
version_build_id: Type.Union([Type.String({ format: "uuid" }), Type.Null()]),
|
|
15
|
+
os_version: Type.Union([Type.String(), Type.Null()]),
|
|
16
|
+
ota_updates_enabled: Type.Union([Type.Boolean(), Type.Null()]),
|
|
17
|
+
is_emergency_launch: Type.Union([Type.Boolean(), Type.Null()]),
|
|
18
|
+
emergency_launch_reason: Type.Union([Type.String(), Type.Null()]),
|
|
19
|
+
is_embedded_launch: Type.Union([Type.Boolean(), Type.Null()]),
|
|
20
|
+
ota_update_id: Type.Union([Type.String({ format: "uuid" }), Type.Null()]),
|
|
21
|
+
ota_update_runtime_version: Type.Union([Type.String(), Type.Null()]),
|
|
22
|
+
ota_update_created_at: Type.Union([Type.String(), Type.Null()]),
|
|
23
|
+
metadata: Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()]),
|
|
24
|
+
started_at: Type.String(),
|
|
25
|
+
created_at: Type.String(),
|
|
26
|
+
updated_at: Type.String(),
|
|
27
|
+
});
|
|
28
|
+
export type Session = Static<typeof SessionSchema>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Session with device info for joined queries
|
|
32
|
+
*/
|
|
33
|
+
export const SessionWithDeviceSchema = Type.Composite([
|
|
34
|
+
SessionSchema,
|
|
35
|
+
Type.Object({
|
|
36
|
+
device: Type.Optional(
|
|
37
|
+
Type.Object({
|
|
38
|
+
device_id: Type.String(),
|
|
39
|
+
device_name: Type.Union([Type.String(), Type.Null()]),
|
|
40
|
+
platform: Type.Union([Type.String(), Type.Null()]),
|
|
41
|
+
})
|
|
42
|
+
),
|
|
43
|
+
}),
|
|
44
|
+
]);
|
|
45
|
+
export type SessionWithDevice = Static<typeof SessionWithDeviceSchema>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Session params schema
|
|
49
|
+
*/
|
|
50
|
+
export const SessionParamsSchema = Type.Object({
|
|
51
|
+
session_id: Type.String({ format: "uuid" }),
|
|
52
|
+
});
|
|
53
|
+
export type SessionParams = Static<typeof SessionParamsSchema>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Search sessions query schema
|
|
57
|
+
* Supports pagination, search, and sorting
|
|
58
|
+
*/
|
|
59
|
+
export const SearchSessionsQuerySchema = Type.Object({
|
|
60
|
+
project_id: Type.String({ format: "uuid" }),
|
|
61
|
+
page: Type.Number({ minimum: 1, default: 1 }),
|
|
62
|
+
limit: Type.Number({ minimum: 1, maximum: 100, default: 20 }),
|
|
63
|
+
search: Type.Optional(Type.String()),
|
|
64
|
+
sort_by: Type.Union(
|
|
65
|
+
[
|
|
66
|
+
Type.Literal("started_at"),
|
|
67
|
+
Type.Literal("created_at"),
|
|
68
|
+
Type.Literal("updated_at"),
|
|
69
|
+
Type.Literal("version"),
|
|
70
|
+
Type.Literal("os_version"),
|
|
71
|
+
],
|
|
72
|
+
{ default: "started_at" }
|
|
73
|
+
),
|
|
74
|
+
sort_order: Type.Union([Type.Literal("asc"), Type.Literal("desc")], { default: "desc" }),
|
|
75
|
+
});
|
|
76
|
+
export type SearchSessionsQuery = Static<typeof SearchSessionsQuerySchema>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Search sessions query schema without project_id (injected from headers)
|
|
80
|
+
*/
|
|
81
|
+
export const SearchSessionsQueryParamsSchema = Type.Omit(SearchSessionsQuerySchema, ["project_id"]);
|
|
82
|
+
export type SearchSessionsQueryParams = Static<typeof SearchSessionsQueryParamsSchema>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Sessions by IDs request schema
|
|
86
|
+
*/
|
|
87
|
+
export const SessionsByIdsSchema = Type.Object({
|
|
88
|
+
session_ids: Type.Array(Type.String({ format: "uuid" }), { minItems: 1, maxItems: 100 }),
|
|
89
|
+
});
|
|
90
|
+
export type SessionsByIds = Static<typeof SessionsByIdsSchema>;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Paginated sessions response schema
|
|
94
|
+
*/
|
|
95
|
+
export const SessionsResponseSchema = Type.Object({
|
|
96
|
+
sessions: Type.Array(SessionWithDeviceSchema),
|
|
97
|
+
pagination: Type.Object({
|
|
98
|
+
page: Type.Integer({ minimum: 1 }),
|
|
99
|
+
limit: Type.Integer({ minimum: 1 }),
|
|
100
|
+
total: Type.Integer({ minimum: 0 }),
|
|
101
|
+
total_pages: Type.Integer({ minimum: 0 }),
|
|
102
|
+
}),
|
|
103
|
+
});
|
|
104
|
+
export type SessionsResponse = Static<typeof SessionsResponseSchema>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Single session response schema
|
|
108
|
+
*/
|
|
109
|
+
export const SessionResponseSchema = Type.Object({
|
|
110
|
+
success: Type.Literal(true),
|
|
111
|
+
data: SessionWithDeviceSchema,
|
|
112
|
+
});
|
|
113
|
+
export type SessionResponse = Static<typeof SessionResponseSchema>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Session error response schema
|
|
117
|
+
* Discriminated union by error code
|
|
118
|
+
*/
|
|
119
|
+
export const SessionErrorSchema = Type.Union([
|
|
120
|
+
Type.Object({
|
|
121
|
+
code: Type.Literal("SESSION_NOT_FOUND"),
|
|
122
|
+
message: Type.String(),
|
|
123
|
+
}),
|
|
124
|
+
Type.Object({
|
|
125
|
+
code: Type.Literal("PROJECT_NOT_FOUND"),
|
|
126
|
+
message: Type.String(),
|
|
127
|
+
}),
|
|
128
|
+
Type.Object({
|
|
129
|
+
code: Type.Literal("FORBIDDEN"),
|
|
130
|
+
message: Type.String(),
|
|
131
|
+
}),
|
|
132
|
+
Type.Object({
|
|
133
|
+
code: Type.Literal("FETCH_FAILED"),
|
|
134
|
+
message: Type.String(),
|
|
135
|
+
}),
|
|
136
|
+
Type.Object({
|
|
137
|
+
code: Type.Literal("INVALID_PARAMS"),
|
|
138
|
+
message: Type.String(),
|
|
139
|
+
}),
|
|
140
|
+
]);
|
|
141
|
+
export type SessionError = Static<typeof SessionErrorSchema>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Session error response wrapper
|
|
145
|
+
*/
|
|
146
|
+
export const SessionErrorResponseSchema = Type.Object({
|
|
147
|
+
success: Type.Literal(false),
|
|
148
|
+
error: SessionErrorSchema,
|
|
149
|
+
});
|
|
150
|
+
export type SessionErrorResponse = Static<typeof SessionErrorResponseSchema>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Session request response schema
|
|
154
|
+
*/
|
|
155
|
+
export const SessionRequestResponseSchema = Type.Union([SessionResponseSchema, SessionErrorResponseSchema]);
|
|
156
|
+
export type SessionRequestResponse = Static<typeof SessionRequestResponseSchema>;
|
|
157
|
+
|
|
158
|
+
export type _CheckSessionRow = AssertTrue<AssertSchemaCompatibleWithRow<Session, "device_sessions">>;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { type Static, Type } from "@sinclair/typebox";
|
|
2
|
+
import { VersionBuildStatusEnum } from "@teardown/types";
|
|
3
|
+
import type { AssertSchemaCompatibleWithRow, AssertTrue } from "../../common";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Version status enum matching database
|
|
7
|
+
*/
|
|
8
|
+
export const VersionBuildStatusSchema = Type.Enum(VersionBuildStatusEnum);
|
|
9
|
+
export type VersionBuildStatus = Static<typeof VersionBuildStatusSchema>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Parse and validate a VersionBuildStatusEnum value
|
|
13
|
+
* Uses a switch statement to ensure type safety and runtime validation
|
|
14
|
+
* @param value - The value to parse
|
|
15
|
+
* @returns The validated VersionBuildStatusEnum value
|
|
16
|
+
* @throws Error if the value is not a valid VersionBuildStatusEnum
|
|
17
|
+
*/
|
|
18
|
+
export function parseVersionStatusEnum(value: unknown): VersionBuildStatusEnum {
|
|
19
|
+
switch (value) {
|
|
20
|
+
case VersionBuildStatusEnum.SUPPORTED:
|
|
21
|
+
return VersionBuildStatusEnum.SUPPORTED;
|
|
22
|
+
case VersionBuildStatusEnum.UPDATE_AVAILABLE:
|
|
23
|
+
return VersionBuildStatusEnum.UPDATE_AVAILABLE;
|
|
24
|
+
case VersionBuildStatusEnum.UPDATE_RECOMMENDED:
|
|
25
|
+
case VersionBuildStatusEnum.UPDATE_REQUIRED:
|
|
26
|
+
return VersionBuildStatusEnum.UPDATE_REQUIRED;
|
|
27
|
+
default:
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Invalid VersionBuildStatusEnum value: ${value}. Expected one of: ${Object.values(VersionBuildStatusEnum).join(", ")}`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Base version schema
|
|
36
|
+
* Represents project_versions table structure
|
|
37
|
+
*/
|
|
38
|
+
export const VersionSchema = Type.Object({
|
|
39
|
+
id: Type.String({ format: "uuid" }),
|
|
40
|
+
project_id: Type.String({ format: "uuid" }),
|
|
41
|
+
name: Type.String(),
|
|
42
|
+
major: Type.Number(), // Matches type number, not integer constraint (db type numeric)
|
|
43
|
+
minor: Type.Number(),
|
|
44
|
+
patch: Type.Number(),
|
|
45
|
+
status: VersionBuildStatusSchema, // SUPPORTED, UPDATE_AVAILABLE, UPDATE_RECOMMENDED, UPDATE_REQUIRED - controls if version is active
|
|
46
|
+
created_at: Type.String(),
|
|
47
|
+
updated_at: Type.String(),
|
|
48
|
+
});
|
|
49
|
+
export type Version = Static<typeof VersionSchema>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Version params schema
|
|
53
|
+
*/
|
|
54
|
+
export const VersionParamsSchema = Type.Object({
|
|
55
|
+
version_id: Type.String({ format: "uuid" }),
|
|
56
|
+
});
|
|
57
|
+
export type VersionParams = Static<typeof VersionParamsSchema>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Search versions query schema
|
|
61
|
+
* Supports pagination, search, and sorting
|
|
62
|
+
*/
|
|
63
|
+
export const SearchVersionsQuerySchema = Type.Object({
|
|
64
|
+
project_id: Type.String({ format: "uuid" }),
|
|
65
|
+
page: Type.Number({ minimum: 1, default: 1 }),
|
|
66
|
+
limit: Type.Number({ minimum: 1, maximum: 100, default: 20 }),
|
|
67
|
+
search: Type.Optional(Type.String()),
|
|
68
|
+
sort_by: Type.Union(
|
|
69
|
+
[
|
|
70
|
+
Type.Literal("created_at"),
|
|
71
|
+
Type.Literal("updated_at"),
|
|
72
|
+
Type.Literal("name"),
|
|
73
|
+
Type.Literal("major"),
|
|
74
|
+
Type.Literal("minor"),
|
|
75
|
+
Type.Literal("patch"),
|
|
76
|
+
],
|
|
77
|
+
{ default: "created_at" }
|
|
78
|
+
),
|
|
79
|
+
sort_order: Type.Union([Type.Literal("asc"), Type.Literal("desc")], { default: "desc" }),
|
|
80
|
+
});
|
|
81
|
+
export type SearchVersionsQuery = Static<typeof SearchVersionsQuerySchema>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Search versions query schema without project_id (injected from headers)
|
|
85
|
+
*/
|
|
86
|
+
export const SearchVersionsQueryParamsSchema = Type.Omit(SearchVersionsQuerySchema, ["project_id"]);
|
|
87
|
+
export type SearchVersionsQueryParams = Static<typeof SearchVersionsQueryParamsSchema>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Versions by IDs request schema
|
|
91
|
+
*/
|
|
92
|
+
export const VersionsByIdsSchema = Type.Object({
|
|
93
|
+
version_ids: Type.Array(Type.String({ format: "uuid" }), { minItems: 1, maxItems: 100 }),
|
|
94
|
+
});
|
|
95
|
+
export type VersionsByIds = Static<typeof VersionsByIdsSchema>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Paginated versions response schema
|
|
99
|
+
*/
|
|
100
|
+
export const VersionsResponseSchema = Type.Object({
|
|
101
|
+
versions: Type.Array(VersionSchema),
|
|
102
|
+
pagination: Type.Object({
|
|
103
|
+
page: Type.Integer({ minimum: 1 }),
|
|
104
|
+
limit: Type.Integer({ minimum: 1 }),
|
|
105
|
+
total: Type.Integer({ minimum: 0 }),
|
|
106
|
+
total_pages: Type.Integer({ minimum: 0 }),
|
|
107
|
+
}),
|
|
108
|
+
});
|
|
109
|
+
export type VersionsResponse = Static<typeof VersionsResponseSchema>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Single version response schema
|
|
113
|
+
*/
|
|
114
|
+
export const VersionResponseSchema = Type.Object({
|
|
115
|
+
success: Type.Literal(true),
|
|
116
|
+
data: VersionSchema,
|
|
117
|
+
});
|
|
118
|
+
export type VersionResponse = Static<typeof VersionResponseSchema>;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Version error response schema
|
|
122
|
+
* Discriminated union by error code
|
|
123
|
+
*/
|
|
124
|
+
export const VersionErrorSchema = Type.Union([
|
|
125
|
+
Type.Object({
|
|
126
|
+
code: Type.Literal("VERSION_NOT_FOUND"),
|
|
127
|
+
message: Type.String(),
|
|
128
|
+
}),
|
|
129
|
+
Type.Object({
|
|
130
|
+
code: Type.Literal("PROJECT_NOT_FOUND"),
|
|
131
|
+
message: Type.String(),
|
|
132
|
+
}),
|
|
133
|
+
Type.Object({
|
|
134
|
+
code: Type.Literal("FORBIDDEN"),
|
|
135
|
+
message: Type.String(),
|
|
136
|
+
}),
|
|
137
|
+
Type.Object({
|
|
138
|
+
code: Type.Literal("FETCH_FAILED"),
|
|
139
|
+
message: Type.String(),
|
|
140
|
+
}),
|
|
141
|
+
Type.Object({
|
|
142
|
+
code: Type.Literal("INVALID_PARAMS"),
|
|
143
|
+
message: Type.String(),
|
|
144
|
+
}),
|
|
145
|
+
]);
|
|
146
|
+
export type VersionError = Static<typeof VersionErrorSchema>;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Version error response wrapper
|
|
150
|
+
*/
|
|
151
|
+
export const VersionErrorResponseSchema = Type.Object({
|
|
152
|
+
success: Type.Literal(false),
|
|
153
|
+
error: VersionErrorSchema,
|
|
154
|
+
});
|
|
155
|
+
export type VersionErrorResponse = Static<typeof VersionErrorResponseSchema>;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Version request response schema
|
|
159
|
+
*/
|
|
160
|
+
export const VersionRequestResponseSchema = Type.Union([VersionResponseSchema, VersionErrorResponseSchema]);
|
|
161
|
+
export type VersionRequestResponse = Static<typeof VersionRequestResponseSchema>;
|
|
162
|
+
|
|
163
|
+
export type _CheckVersionRow = AssertTrue<AssertSchemaCompatibleWithRow<Version, "project_versions">>;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Update version status request body schema
|
|
167
|
+
*/
|
|
168
|
+
export const UpdateVersionStatusBodySchema = Type.Object({
|
|
169
|
+
status: VersionBuildStatusSchema,
|
|
170
|
+
});
|
|
171
|
+
export type UpdateVersionStatusBody = Static<typeof UpdateVersionStatusBodySchema>;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Add UPDATE_FAILED error code for update operations
|
|
175
|
+
*/
|
|
176
|
+
export const VersionErrorSchemaWithUpdate = Type.Union([
|
|
177
|
+
VersionErrorSchema,
|
|
178
|
+
Type.Object({
|
|
179
|
+
code: Type.Literal("UPDATE_FAILED"),
|
|
180
|
+
message: Type.String(),
|
|
181
|
+
}),
|
|
182
|
+
]);
|
|
183
|
+
export type VersionErrorWithUpdate = Static<typeof VersionErrorSchemaWithUpdate>;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Version error response wrapper with update error
|
|
187
|
+
*/
|
|
188
|
+
export const VersionErrorResponseWithUpdateSchema = Type.Object({
|
|
189
|
+
success: Type.Literal(false),
|
|
190
|
+
error: VersionErrorSchemaWithUpdate,
|
|
191
|
+
});
|
|
192
|
+
export type VersionErrorResponseWithUpdate = Static<typeof VersionErrorResponseWithUpdateSchema>;
|
package/dist/common/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type Static } from "@sinclair/typebox";
|
|
2
|
-
export declare const UUIDSchema: import("@sinclair/typebox").TString;
|
|
3
|
-
export declare const SlugSchema: import("@sinclair/typebox").TString;
|
|
4
|
-
export declare const URLSchema: import("@sinclair/typebox").TString;
|
|
5
|
-
export declare const TimestampSchema: import("@sinclair/typebox").TString;
|
|
6
|
-
export type UUID = Static<typeof UUIDSchema>;
|
|
7
|
-
export type Slug = Static<typeof SlugSchema>;
|
|
8
|
-
export type URL = Static<typeof URLSchema>;
|
|
9
|
-
export type Timestamp = Static<typeof TimestampSchema>;
|
|
10
|
-
export declare const EmailSchema: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<"">, import("@sinclair/typebox").TUndefined]>>, string | undefined>;
|
|
11
|
-
export type Email = Static<typeof EmailSchema>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
export const UUIDSchema = Type.String({ format: "uuid", error: "Invalid UUID" });
|
|
3
|
-
export const SlugSchema = Type.String({ pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$", error: "Invalid slug" });
|
|
4
|
-
export const URLSchema = Type.String({ format: "uri", error: "Invalid URL" });
|
|
5
|
-
export const TimestampSchema = Type.String({ format: "date-time", error: "Invalid timestamp" });
|
|
6
|
-
export const EmailSchema = Type.Transform(Type.Optional(Type.Union([Type.String({ format: "email", error: "Invalid email address" }), Type.Literal(""), Type.Undefined()])))
|
|
7
|
-
.Decode((value) => (value === "" ? undefined : value))
|
|
8
|
-
.Encode((value) => value ?? "");
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type Static, type TSchema } from "@sinclair/typebox";
|
|
2
|
-
export declare const SuccessResponseSchema: <T extends TSchema>(dataSchema: T) => import("@sinclair/typebox").TObject<{
|
|
3
|
-
success: import("@sinclair/typebox").TLiteral<true>;
|
|
4
|
-
data: T;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const ErrorResponseSchema: import("@sinclair/typebox").TObject<{
|
|
7
|
-
success: import("@sinclair/typebox").TLiteral<false>;
|
|
8
|
-
error: import("@sinclair/typebox").TObject<{
|
|
9
|
-
message: import("@sinclair/typebox").TString;
|
|
10
|
-
code: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
11
|
-
}>;
|
|
12
|
-
}>;
|
|
13
|
-
export type SuccessResponse<T> = {
|
|
14
|
-
success: true;
|
|
15
|
-
data: T;
|
|
16
|
-
};
|
|
17
|
-
export type ErrorResponse = Static<typeof ErrorResponseSchema>;
|
|
18
|
-
export declare const RequestResponseSchema: <Success extends TSchema>(successSchema: Success) => import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
19
|
-
success: import("@sinclair/typebox").TLiteral<true>;
|
|
20
|
-
data: Success;
|
|
21
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
22
|
-
success: import("@sinclair/typebox").TLiteral<false>;
|
|
23
|
-
error: import("@sinclair/typebox").TObject<{
|
|
24
|
-
message: import("@sinclair/typebox").TString;
|
|
25
|
-
code: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
26
|
-
}>;
|
|
27
|
-
}>]>;
|
package/dist/common/responses.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
export const SuccessResponseSchema = (dataSchema) => Type.Object({
|
|
3
|
-
success: Type.Literal(true),
|
|
4
|
-
data: dataSchema,
|
|
5
|
-
});
|
|
6
|
-
export const ErrorResponseSchema = Type.Object({
|
|
7
|
-
success: Type.Literal(false),
|
|
8
|
-
error: Type.Object({
|
|
9
|
-
message: Type.String(),
|
|
10
|
-
code: Type.Optional(Type.String()),
|
|
11
|
-
}),
|
|
12
|
-
});
|
|
13
|
-
export const RequestResponseSchema = (successSchema) => Type.Union([SuccessResponseSchema(successSchema), ErrorResponseSchema]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from "./common";
|
|
2
|
-
export * from "./modules/analytics";
|
|
3
|
-
export * from "./modules/builds";
|
|
4
|
-
export * from "./modules/devices";
|
|
5
|
-
export * from "./modules/environment";
|
|
6
|
-
export * from "./modules/events";
|
|
7
|
-
export * from "./modules/identify";
|
|
8
|
-
export * from "./modules/me";
|
|
9
|
-
export * from "./modules/orgs";
|
|
10
|
-
export * from "./modules/personas";
|
|
11
|
-
export * from "./modules/projects";
|
|
12
|
-
export * from "./modules/sessions";
|
|
13
|
-
export * from "./modules/versions";
|