@teardown/schemas 0.1.49 → 2.0.28
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teardown/schemas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.28",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -98,11 +98,11 @@
|
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@sinclair/typebox": "^0.34.41",
|
|
101
|
-
"@teardown/types": "0.
|
|
101
|
+
"@teardown/types": "2.0.28"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@biomejs/biome": "2.3.
|
|
105
|
-
"@teardown/tsconfig": "0.
|
|
104
|
+
"@biomejs/biome": "2.3.10",
|
|
105
|
+
"@teardown/tsconfig": "2.0.28",
|
|
106
106
|
"typescript": "5.9.3"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
@@ -114,6 +114,10 @@ export const DeviceInfoSchema = Type.Object({
|
|
|
114
114
|
* Update info (optional) - not all builds will have an update
|
|
115
115
|
*/
|
|
116
116
|
update: Type.Union([DeviceUpdateInfoSchema, Type.Null()]),
|
|
117
|
+
/**
|
|
118
|
+
* Notifications info (optional) - push notification token and permissions
|
|
119
|
+
*/
|
|
120
|
+
notifications: Type.Optional(NotificationsInfoSchema),
|
|
117
121
|
});
|
|
118
122
|
export type DeviceInfo = Static<typeof DeviceInfoSchema>;
|
|
119
123
|
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { type Static, Type } from "@sinclair/typebox";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* FCM Service Account JSON input schema
|
|
5
|
+
* Validates the structure of a Google Cloud service account JSON
|
|
6
|
+
*/
|
|
7
|
+
export const FcmCredentialsInputSchema = Type.Object({
|
|
8
|
+
type: Type.Literal("service_account"),
|
|
9
|
+
project_id: Type.String({ minLength: 1 }),
|
|
10
|
+
private_key_id: Type.String({ minLength: 1 }),
|
|
11
|
+
private_key: Type.String({ minLength: 1 }),
|
|
12
|
+
client_email: Type.String({ format: "email" }),
|
|
13
|
+
client_id: Type.String({ minLength: 1 }),
|
|
14
|
+
auth_uri: Type.String({ format: "uri" }),
|
|
15
|
+
token_uri: Type.String({ format: "uri" }),
|
|
16
|
+
auth_provider_x509_cert_url: Type.Optional(Type.String({ format: "uri" })),
|
|
17
|
+
client_x509_cert_url: Type.Optional(Type.String({ format: "uri" })),
|
|
18
|
+
universe_domain: Type.Optional(Type.String()),
|
|
19
|
+
});
|
|
20
|
+
export type FcmCredentialsInput = Static<typeof FcmCredentialsInputSchema>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* APNS credentials input schema
|
|
24
|
+
* key_id: 10-character Key ID from Apple Developer
|
|
25
|
+
* team_id: 10-character Team ID from Apple Developer
|
|
26
|
+
* bundle_id: iOS app bundle identifier
|
|
27
|
+
* key: .p8 key file content
|
|
28
|
+
*/
|
|
29
|
+
export const ApnsCredentialsInputSchema = Type.Object({
|
|
30
|
+
key_id: Type.String({ minLength: 10, maxLength: 10 }),
|
|
31
|
+
team_id: Type.String({ minLength: 10, maxLength: 10 }),
|
|
32
|
+
bundle_id: Type.String({ minLength: 1 }),
|
|
33
|
+
key: Type.String({ minLength: 1 }), // .p8 file content
|
|
34
|
+
});
|
|
35
|
+
export type ApnsCredentialsInput = Static<typeof ApnsCredentialsInputSchema>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Request schema for saving FCM credentials
|
|
39
|
+
*/
|
|
40
|
+
export const SaveFcmCredentialsBodySchema = Type.Object({
|
|
41
|
+
credentials: FcmCredentialsInputSchema,
|
|
42
|
+
});
|
|
43
|
+
export type SaveFcmCredentialsBody = Static<typeof SaveFcmCredentialsBodySchema>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Request schema for saving APNS credentials
|
|
47
|
+
*/
|
|
48
|
+
export const SaveApnsCredentialsBodySchema = Type.Object({
|
|
49
|
+
credentials: ApnsCredentialsInputSchema,
|
|
50
|
+
});
|
|
51
|
+
export type SaveApnsCredentialsBody = Static<typeof SaveApnsCredentialsBodySchema>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Masked FCM credentials for dashboard display
|
|
55
|
+
* Never exposes the actual private key
|
|
56
|
+
*/
|
|
57
|
+
export const FcmCredentialsMaskedSchema = Type.Object({
|
|
58
|
+
configured: Type.Literal(true),
|
|
59
|
+
project_id: Type.String(),
|
|
60
|
+
client_email_masked: Type.String(), // e.g. "****@project.iam.gserviceaccount.com"
|
|
61
|
+
});
|
|
62
|
+
export type FcmCredentialsMasked = Static<typeof FcmCredentialsMaskedSchema>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Masked APNS credentials for dashboard display
|
|
66
|
+
*/
|
|
67
|
+
export const ApnsCredentialsMaskedSchema = Type.Object({
|
|
68
|
+
configured: Type.Literal(true),
|
|
69
|
+
key_id: Type.String(),
|
|
70
|
+
team_id: Type.String(),
|
|
71
|
+
bundle_id: Type.String(),
|
|
72
|
+
});
|
|
73
|
+
export type ApnsCredentialsMasked = Static<typeof ApnsCredentialsMaskedSchema>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Not configured state for credentials
|
|
77
|
+
*/
|
|
78
|
+
export const CredentialsNotConfiguredSchema = Type.Object({
|
|
79
|
+
configured: Type.Literal(false),
|
|
80
|
+
});
|
|
81
|
+
export type CredentialsNotConfigured = Static<typeof CredentialsNotConfiguredSchema>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Push credentials status response
|
|
85
|
+
* Shows masked status of FCM and APNS configuration
|
|
86
|
+
*/
|
|
87
|
+
export const PushCredentialsStatusSchema = Type.Object({
|
|
88
|
+
fcm: Type.Union([FcmCredentialsMaskedSchema, CredentialsNotConfiguredSchema]),
|
|
89
|
+
apns: Type.Union([ApnsCredentialsMaskedSchema, CredentialsNotConfiguredSchema]),
|
|
90
|
+
});
|
|
91
|
+
export type PushCredentialsStatus = Static<typeof PushCredentialsStatusSchema>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Push credentials status response wrapper
|
|
95
|
+
*/
|
|
96
|
+
export const PushCredentialsStatusResponseSchema = Type.Object({
|
|
97
|
+
success: Type.Literal(true),
|
|
98
|
+
data: PushCredentialsStatusSchema,
|
|
99
|
+
});
|
|
100
|
+
export type PushCredentialsStatusResponse = Static<typeof PushCredentialsStatusResponseSchema>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Push credentials error codes
|
|
104
|
+
*/
|
|
105
|
+
export const PushCredentialsErrorSchema = Type.Union([
|
|
106
|
+
Type.Object({
|
|
107
|
+
code: Type.Literal("PROJECT_NOT_FOUND"),
|
|
108
|
+
message: Type.String(),
|
|
109
|
+
}),
|
|
110
|
+
Type.Object({
|
|
111
|
+
code: Type.Literal("ENCRYPTION_NOT_CONFIGURED"),
|
|
112
|
+
message: Type.String(),
|
|
113
|
+
}),
|
|
114
|
+
Type.Object({
|
|
115
|
+
code: Type.Literal("INVALID_CREDENTIALS"),
|
|
116
|
+
message: Type.String(),
|
|
117
|
+
}),
|
|
118
|
+
Type.Object({
|
|
119
|
+
code: Type.Literal("SAVE_FAILED"),
|
|
120
|
+
message: Type.String(),
|
|
121
|
+
}),
|
|
122
|
+
Type.Object({
|
|
123
|
+
code: Type.Literal("DELETE_FAILED"),
|
|
124
|
+
message: Type.String(),
|
|
125
|
+
}),
|
|
126
|
+
Type.Object({
|
|
127
|
+
code: Type.Literal("FETCH_FAILED"),
|
|
128
|
+
message: Type.String(),
|
|
129
|
+
}),
|
|
130
|
+
]);
|
|
131
|
+
export type PushCredentialsError = Static<typeof PushCredentialsErrorSchema>;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Push credentials error response wrapper
|
|
135
|
+
*/
|
|
136
|
+
export const PushCredentialsErrorResponseSchema = Type.Object({
|
|
137
|
+
success: Type.Literal(false),
|
|
138
|
+
error: PushCredentialsErrorSchema,
|
|
139
|
+
});
|
|
140
|
+
export type PushCredentialsErrorResponse = Static<typeof PushCredentialsErrorResponseSchema>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Success response for credential save/delete operations
|
|
144
|
+
*/
|
|
145
|
+
export const PushCredentialsSuccessResponseSchema = Type.Object({
|
|
146
|
+
success: Type.Literal(true),
|
|
147
|
+
});
|
|
148
|
+
export type PushCredentialsSuccessResponse = Static<typeof PushCredentialsSuccessResponseSchema>;
|
|
@@ -63,6 +63,7 @@ export const ProjectSchema = Type.Object({
|
|
|
63
63
|
slug: SlugSchema,
|
|
64
64
|
type: Type.Enum(ProjectTypeEnum),
|
|
65
65
|
status: Type.Enum(ProjectStatusEnum),
|
|
66
|
+
push_notifications_enabled: Type.Boolean(),
|
|
66
67
|
created_at: Type.String(),
|
|
67
68
|
updated_at: Type.String(),
|
|
68
69
|
});
|
|
@@ -90,6 +91,7 @@ export type CreateProject = Static<typeof CreateProjectSchema>;
|
|
|
90
91
|
export const UpdateProjectSchema = Type.Object({
|
|
91
92
|
name: Type.Optional(Type.String({ minLength: 1, maxLength: 255 })),
|
|
92
93
|
slug: Type.Optional(SlugSchema),
|
|
94
|
+
push_notifications_enabled: Type.Optional(Type.Boolean()),
|
|
93
95
|
});
|
|
94
96
|
export type UpdateProject = Static<typeof UpdateProjectSchema>;
|
|
95
97
|
|