@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
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { DevicePlatformEnum } from "@teardown/types";
|
|
3
|
-
import { EmailSchema } from "../../common";
|
|
4
|
-
export { DevicePlatformEnum };
|
|
5
|
-
/**
|
|
6
|
-
* Application info schema
|
|
7
|
-
*/
|
|
8
|
-
export const ApplicationInfoSchema = Type.Object({
|
|
9
|
-
version: Type.String({ error: "version is required" }),
|
|
10
|
-
build_number: Type.String({ error: "build_number is required" }),
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* OS info schema
|
|
14
|
-
*/
|
|
15
|
-
export const OSInfoSchema = Type.Object({
|
|
16
|
-
/**
|
|
17
|
-
* Device platform
|
|
18
|
-
*/
|
|
19
|
-
platform: Type.Enum(DevicePlatformEnum, { error: "platform is required" }),
|
|
20
|
-
/**
|
|
21
|
-
* OS name
|
|
22
|
-
*/
|
|
23
|
-
name: Type.String({ error: "name is required" }),
|
|
24
|
-
/**
|
|
25
|
-
* OS version
|
|
26
|
-
*/
|
|
27
|
-
version: Type.String({ error: "version is required" }),
|
|
28
|
-
});
|
|
29
|
-
/**
|
|
30
|
-
* Hardware info schema
|
|
31
|
-
*/
|
|
32
|
-
export const HardwareInfoSchema = Type.Object({
|
|
33
|
-
device_name: Type.String({ error: "device_name is required" }),
|
|
34
|
-
device_type: Type.String({ error: "device_type is required" }),
|
|
35
|
-
device_brand: Type.String({ error: "device_brand is required" }),
|
|
36
|
-
});
|
|
37
|
-
export const EmergencyLaunchSchema = Type.Union([
|
|
38
|
-
Type.Object({
|
|
39
|
-
is_emergency_launch: Type.Literal(true),
|
|
40
|
-
reason: Type.String({ error: "reason is required when is_emergency_launch is true" }),
|
|
41
|
-
}),
|
|
42
|
-
Type.Object({
|
|
43
|
-
is_emergency_launch: Type.Literal(false),
|
|
44
|
-
reason: Type.Optional(Type.Never()),
|
|
45
|
-
}),
|
|
46
|
-
]);
|
|
47
|
-
/**
|
|
48
|
-
* Update info schema
|
|
49
|
-
*/
|
|
50
|
-
export const DeviceUpdateInfoSchema = Type.Object({
|
|
51
|
-
is_enabled: Type.Boolean(),
|
|
52
|
-
update_id: Type.String({ error: "update_id is required" }),
|
|
53
|
-
update_channel: Type.String({ error: "update_channel is required" }),
|
|
54
|
-
runtime_version: Type.String({ error: "runtime_version is required" }),
|
|
55
|
-
emergency_launch: EmergencyLaunchSchema,
|
|
56
|
-
is_embedded_launch: Type.Boolean({ error: "is_embedded_launch is required" }),
|
|
57
|
-
created_at: Type.String(),
|
|
58
|
-
});
|
|
59
|
-
export var NotificationPlatformEnum;
|
|
60
|
-
(function (NotificationPlatformEnum) {
|
|
61
|
-
NotificationPlatformEnum["APNS"] = "APNS";
|
|
62
|
-
NotificationPlatformEnum["FCM"] = "FCM";
|
|
63
|
-
NotificationPlatformEnum["EXPO"] = "EXPO";
|
|
64
|
-
})(NotificationPlatformEnum || (NotificationPlatformEnum = {}));
|
|
65
|
-
/**
|
|
66
|
-
* Push notification info schema
|
|
67
|
-
*/
|
|
68
|
-
export const PushNotificationInfoSchema = Type.Object({
|
|
69
|
-
enabled: Type.Boolean({ error: "enabled is required" }),
|
|
70
|
-
granted: Type.Boolean({ error: "granted is required" }),
|
|
71
|
-
token: Type.Union([Type.String({ error: "token is required" }), Type.Null()]),
|
|
72
|
-
platform: Type.Enum(NotificationPlatformEnum, { error: "platform is required" }),
|
|
73
|
-
});
|
|
74
|
-
export const NotificationsInfoSchema = Type.Object({
|
|
75
|
-
push: PushNotificationInfoSchema,
|
|
76
|
-
});
|
|
77
|
-
/**
|
|
78
|
-
* Device info schema
|
|
79
|
-
*/
|
|
80
|
-
export const DeviceInfoSchema = Type.Object({
|
|
81
|
-
/**
|
|
82
|
-
* Timestamp of collection on device (optional, generated server-side if not provided)
|
|
83
|
-
*/
|
|
84
|
-
timestamp: Type.Optional(Type.Date({ error: "timestamp is required" })),
|
|
85
|
-
/**
|
|
86
|
-
* Application info, required
|
|
87
|
-
*/
|
|
88
|
-
application: ApplicationInfoSchema,
|
|
89
|
-
/**
|
|
90
|
-
* Update info (optional) - not all builds will have an update
|
|
91
|
-
*/
|
|
92
|
-
update: Type.Union([DeviceUpdateInfoSchema, Type.Null()]),
|
|
93
|
-
/**
|
|
94
|
-
* Hardware info, required
|
|
95
|
-
*/
|
|
96
|
-
hardware: HardwareInfoSchema,
|
|
97
|
-
/**
|
|
98
|
-
* OS info, required
|
|
99
|
-
*/
|
|
100
|
-
os: OSInfoSchema,
|
|
101
|
-
/**
|
|
102
|
-
* Notifications info, required
|
|
103
|
-
*/
|
|
104
|
-
notifications: NotificationsInfoSchema,
|
|
105
|
-
});
|
|
106
|
-
/**
|
|
107
|
-
* Persona info schema (optional fields)
|
|
108
|
-
* Matches personas table structure
|
|
109
|
-
*/
|
|
110
|
-
export const PersonaInfoSchema = Type.Object({
|
|
111
|
-
user_id: Type.Optional(Type.String({ error: "user_id is required" })),
|
|
112
|
-
email: Type.Optional(EmailSchema),
|
|
113
|
-
name: Type.Optional(Type.String({ error: "name is required" })),
|
|
114
|
-
});
|
|
115
|
-
/**
|
|
116
|
-
* Identify request schema
|
|
117
|
-
* Ties a device to a persona with optional persona data
|
|
118
|
-
*/
|
|
119
|
-
export const IdentifyRequestSchema = Type.Object({
|
|
120
|
-
device: DeviceInfoSchema,
|
|
121
|
-
persona: Type.Optional(PersonaInfoSchema),
|
|
122
|
-
});
|
|
123
|
-
export var IdentifyVersionStatusEnum;
|
|
124
|
-
(function (IdentifyVersionStatusEnum) {
|
|
125
|
-
/**
|
|
126
|
-
* A new version is available
|
|
127
|
-
*/
|
|
128
|
-
IdentifyVersionStatusEnum["UPDATE_AVAILABLE"] = "UPDATE_AVAILABLE";
|
|
129
|
-
/**
|
|
130
|
-
* An update is required
|
|
131
|
-
*/
|
|
132
|
-
IdentifyVersionStatusEnum["UPDATE_REQUIRED"] = "UPDATE_REQUIRED";
|
|
133
|
-
/**
|
|
134
|
-
* The current version is valid & up to date
|
|
135
|
-
*/
|
|
136
|
-
IdentifyVersionStatusEnum["UP_TO_DATE"] = "UP_TO_DATE";
|
|
137
|
-
/**
|
|
138
|
-
* The version or build has been disabled
|
|
139
|
-
*/
|
|
140
|
-
IdentifyVersionStatusEnum["DISABLED"] = "DISABLED";
|
|
141
|
-
})(IdentifyVersionStatusEnum || (IdentifyVersionStatusEnum = {}));
|
|
142
|
-
export const UpdateInfoSchema = Type.Object({
|
|
143
|
-
version: Type.String({ error: "version is required" }),
|
|
144
|
-
build: Type.String({ error: "build is required" }),
|
|
145
|
-
update_id: Type.String({ error: "update_id is required" }),
|
|
146
|
-
effective_date: Type.Date({ error: "effective_date is required" }),
|
|
147
|
-
});
|
|
148
|
-
export const UpToDateInfoSchema = Type.Object({
|
|
149
|
-
status: Type.Literal(IdentifyVersionStatusEnum.UP_TO_DATE),
|
|
150
|
-
update: Type.Null(),
|
|
151
|
-
});
|
|
152
|
-
export const UpdateRequiredInfoSchema = Type.Object({
|
|
153
|
-
status: Type.Literal(IdentifyVersionStatusEnum.UPDATE_REQUIRED),
|
|
154
|
-
update: UpdateInfoSchema,
|
|
155
|
-
});
|
|
156
|
-
export const UpdateAvailableInfoSchema = Type.Object({
|
|
157
|
-
status: Type.Literal(IdentifyVersionStatusEnum.UPDATE_AVAILABLE),
|
|
158
|
-
update: UpdateInfoSchema,
|
|
159
|
-
});
|
|
160
|
-
export const VersionInfoSchema = Type.Object({
|
|
161
|
-
/**
|
|
162
|
-
* The status of the version
|
|
163
|
-
*/
|
|
164
|
-
status: Type.Enum(IdentifyVersionStatusEnum, { error: "status is required" }),
|
|
165
|
-
update: Type.Optional(Type.Union([UpdateAvailableInfoSchema, Type.Null()])),
|
|
166
|
-
});
|
|
167
|
-
/**
|
|
168
|
-
* Identify response schema
|
|
169
|
-
*/
|
|
170
|
-
export const IdentifyResponseSchema = Type.Object({
|
|
171
|
-
success: Type.Literal(true),
|
|
172
|
-
data: Type.Object({
|
|
173
|
-
session_id: Type.String({ error: "session_id is required" }),
|
|
174
|
-
device_id: Type.String({ error: "device_id is required" }),
|
|
175
|
-
persona_id: Type.String({ error: "persona_id is required" }),
|
|
176
|
-
token: Type.String({ error: "token is required" }), // JWT token for session authentication
|
|
177
|
-
version_info: VersionInfoSchema,
|
|
178
|
-
}),
|
|
179
|
-
});
|
|
180
|
-
export const IdentifyErrorResponseSchema = Type.Object({
|
|
181
|
-
success: Type.Literal(false),
|
|
182
|
-
error: Type.Union([
|
|
183
|
-
Type.Object({
|
|
184
|
-
code: Type.Literal("MISSING_ORG_ID"),
|
|
185
|
-
message: Type.String(),
|
|
186
|
-
}),
|
|
187
|
-
Type.Object({
|
|
188
|
-
code: Type.Literal("MISSING_PROJECT_ID"),
|
|
189
|
-
message: Type.String(),
|
|
190
|
-
}),
|
|
191
|
-
Type.Object({
|
|
192
|
-
code: Type.Literal("MISSING_ENVIRONMENT_SLUG"),
|
|
193
|
-
message: Type.String(),
|
|
194
|
-
}),
|
|
195
|
-
Type.Object({
|
|
196
|
-
code: Type.Literal("MISSING_DEVICE_ID"),
|
|
197
|
-
message: Type.String(),
|
|
198
|
-
}),
|
|
199
|
-
Type.Object({
|
|
200
|
-
code: Type.Literal("IDENTIFY_FAILED"),
|
|
201
|
-
message: Type.String(),
|
|
202
|
-
}),
|
|
203
|
-
Type.Object({
|
|
204
|
-
code: Type.Literal("NO_SESSION_ID_GENERATED"),
|
|
205
|
-
message: Type.String(),
|
|
206
|
-
}),
|
|
207
|
-
Type.Object({
|
|
208
|
-
code: Type.Literal("NO_DEVICE_ID_GENERATED"),
|
|
209
|
-
message: Type.String(),
|
|
210
|
-
}),
|
|
211
|
-
Type.Object({
|
|
212
|
-
code: Type.Literal("NO_PERSONA_ID_GENERATED"),
|
|
213
|
-
message: Type.String(),
|
|
214
|
-
}),
|
|
215
|
-
]),
|
|
216
|
-
});
|
|
217
|
-
export const ValidationErrorSchema = Type.Object({
|
|
218
|
-
success: Type.Literal(false),
|
|
219
|
-
error: Type.Literal("VALIDATION"),
|
|
220
|
-
message: Type.String(),
|
|
221
|
-
});
|
package/dist/modules/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from "./analytics/schemas";
|
|
2
|
-
export * from "./builds/schemas";
|
|
3
|
-
export * from "./devices/schemas";
|
|
4
|
-
export * from "./environment/schemas";
|
|
5
|
-
export * from "./events/schemas";
|
|
6
|
-
export * from "./identify/schemas";
|
|
7
|
-
export * from "./me/schemas";
|
|
8
|
-
export * from "./orgs/schemas";
|
|
9
|
-
export * from "./personas/schemas";
|
|
10
|
-
export * from "./projects/schemas";
|
|
11
|
-
export * from "./sessions/schemas";
|
|
12
|
-
export * from "./versions/schemas";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./schemas";
|
package/dist/modules/me/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./schemas";
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { type Static } from "@sinclair/typebox";
|
|
2
|
-
/**
|
|
3
|
-
* User schema
|
|
4
|
-
* Represents Supabase Auth user structure
|
|
5
|
-
*/
|
|
6
|
-
export declare const UserSchema: import("@sinclair/typebox").TObject<{
|
|
7
|
-
id: import("@sinclair/typebox").TString;
|
|
8
|
-
email: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
9
|
-
app_metadata: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
10
|
-
user_metadata: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
11
|
-
created_at: import("@sinclair/typebox").TString;
|
|
12
|
-
}>;
|
|
13
|
-
export type User = Static<typeof UserSchema>;
|
|
14
|
-
/**
|
|
15
|
-
* Me response schema
|
|
16
|
-
*/
|
|
17
|
-
export declare const MeResponseSchema: import("@sinclair/typebox").TObject<{
|
|
18
|
-
user: import("@sinclair/typebox").TObject<{
|
|
19
|
-
id: import("@sinclair/typebox").TString;
|
|
20
|
-
email: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
21
|
-
app_metadata: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
22
|
-
user_metadata: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
23
|
-
created_at: import("@sinclair/typebox").TString;
|
|
24
|
-
}>;
|
|
25
|
-
}>;
|
|
26
|
-
export type MeResponse = Static<typeof MeResponseSchema>;
|
|
27
|
-
/**
|
|
28
|
-
* Me orgs response schema
|
|
29
|
-
* Reuses OrgRoleWithOrgSchema from orgs module
|
|
30
|
-
*/
|
|
31
|
-
export declare const MeOrgsResponseSchema: import("@sinclair/typebox").TObject<{
|
|
32
|
-
orgs: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
33
|
-
id: import("@sinclair/typebox").TString;
|
|
34
|
-
user_id: import("@sinclair/typebox").TString;
|
|
35
|
-
created_at: import("@sinclair/typebox").TString;
|
|
36
|
-
updated_at: import("@sinclair/typebox").TString;
|
|
37
|
-
org_id: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>;
|
|
38
|
-
role: import("@sinclair/typebox").TEnum<typeof import("@teardown/types").OrgRoleTypeEnum>;
|
|
39
|
-
org_name: import("@sinclair/typebox").TString;
|
|
40
|
-
org_slug: import("@sinclair/typebox").TString;
|
|
41
|
-
}>>;
|
|
42
|
-
}>;
|
|
43
|
-
export type MeOrgsResponse = Static<typeof MeOrgsResponseSchema>;
|
|
44
|
-
/**
|
|
45
|
-
* Me error response schema
|
|
46
|
-
* Discriminated union by error code
|
|
47
|
-
*/
|
|
48
|
-
export declare const MeErrorSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
49
|
-
code: import("@sinclair/typebox").TLiteral<"UNAUTHORIZED">;
|
|
50
|
-
message: import("@sinclair/typebox").TString;
|
|
51
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
52
|
-
code: import("@sinclair/typebox").TLiteral<"USER_NOT_FOUND">;
|
|
53
|
-
message: import("@sinclair/typebox").TString;
|
|
54
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
55
|
-
code: import("@sinclair/typebox").TLiteral<"FETCH_FAILED">;
|
|
56
|
-
message: import("@sinclair/typebox").TString;
|
|
57
|
-
}>]>;
|
|
58
|
-
export type MeError = Static<typeof MeErrorSchema>;
|
|
59
|
-
/**
|
|
60
|
-
* Me error response wrapper
|
|
61
|
-
*/
|
|
62
|
-
export declare const MeErrorResponseSchema: import("@sinclair/typebox").TObject<{
|
|
63
|
-
success: import("@sinclair/typebox").TLiteral<false>;
|
|
64
|
-
error: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
65
|
-
code: import("@sinclair/typebox").TLiteral<"UNAUTHORIZED">;
|
|
66
|
-
message: import("@sinclair/typebox").TString;
|
|
67
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
68
|
-
code: import("@sinclair/typebox").TLiteral<"USER_NOT_FOUND">;
|
|
69
|
-
message: import("@sinclair/typebox").TString;
|
|
70
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
71
|
-
code: import("@sinclair/typebox").TLiteral<"FETCH_FAILED">;
|
|
72
|
-
message: import("@sinclair/typebox").TString;
|
|
73
|
-
}>]>;
|
|
74
|
-
}>;
|
|
75
|
-
export type MeErrorResponse = Static<typeof MeErrorResponseSchema>;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { OrgRoleWithOrgSchema } from "../orgs/schemas";
|
|
3
|
-
/**
|
|
4
|
-
* User schema
|
|
5
|
-
* Represents Supabase Auth user structure
|
|
6
|
-
*/
|
|
7
|
-
export const UserSchema = Type.Object({
|
|
8
|
-
id: Type.String({ format: "uuid" }),
|
|
9
|
-
email: Type.Optional(Type.String({ format: "email" })),
|
|
10
|
-
app_metadata: Type.Record(Type.String(), Type.Unknown()),
|
|
11
|
-
user_metadata: Type.Record(Type.String(), Type.Unknown()),
|
|
12
|
-
created_at: Type.String(),
|
|
13
|
-
// id: string
|
|
14
|
-
// app_metadata: UserAppMetadata
|
|
15
|
-
// user_metadata: UserMetadata
|
|
16
|
-
// aud: string
|
|
17
|
-
// confirmation_sent_at?: string
|
|
18
|
-
// recovery_sent_at?: string
|
|
19
|
-
// email_change_sent_at?: string
|
|
20
|
-
// new_email?: string
|
|
21
|
-
// new_phone?: string
|
|
22
|
-
// invited_at?: string
|
|
23
|
-
// action_link?: string
|
|
24
|
-
// email?: string
|
|
25
|
-
// phone?: string
|
|
26
|
-
// created_at: string
|
|
27
|
-
// confirmed_at?: string
|
|
28
|
-
// email_confirmed_at?: string
|
|
29
|
-
// phone_confirmed_at?: string
|
|
30
|
-
// last_sign_in_at?: string
|
|
31
|
-
// role?: string
|
|
32
|
-
// updated_at?: string
|
|
33
|
-
// identities?: UserIdentity[]
|
|
34
|
-
// is_anonymous?: boolean
|
|
35
|
-
// is_sso_user?: boolean
|
|
36
|
-
// factors?: (Factor<FactorType, 'verified'> | Factor<FactorType, 'unverified'>)[]
|
|
37
|
-
// deleted_at?: string
|
|
38
|
-
});
|
|
39
|
-
/**
|
|
40
|
-
* Me response schema
|
|
41
|
-
*/
|
|
42
|
-
export const MeResponseSchema = Type.Object({
|
|
43
|
-
user: UserSchema,
|
|
44
|
-
});
|
|
45
|
-
/**
|
|
46
|
-
* Me orgs response schema
|
|
47
|
-
* Reuses OrgRoleWithOrgSchema from orgs module
|
|
48
|
-
*/
|
|
49
|
-
export const MeOrgsResponseSchema = Type.Object({
|
|
50
|
-
orgs: Type.Array(OrgRoleWithOrgSchema),
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* Me error response schema
|
|
54
|
-
* Discriminated union by error code
|
|
55
|
-
*/
|
|
56
|
-
export const MeErrorSchema = Type.Union([
|
|
57
|
-
Type.Object({
|
|
58
|
-
code: Type.Literal("UNAUTHORIZED"),
|
|
59
|
-
message: Type.String(),
|
|
60
|
-
}),
|
|
61
|
-
Type.Object({
|
|
62
|
-
code: Type.Literal("USER_NOT_FOUND"),
|
|
63
|
-
message: Type.String(),
|
|
64
|
-
}),
|
|
65
|
-
Type.Object({
|
|
66
|
-
code: Type.Literal("FETCH_FAILED"),
|
|
67
|
-
message: Type.String(),
|
|
68
|
-
}),
|
|
69
|
-
]);
|
|
70
|
-
/**
|
|
71
|
-
* Me error response wrapper
|
|
72
|
-
*/
|
|
73
|
-
export const MeErrorResponseSchema = Type.Object({
|
|
74
|
-
success: Type.Literal(false),
|
|
75
|
-
error: MeErrorSchema,
|
|
76
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./schemas";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./schemas";
|