refactor(schemas): group network schemas by direction
Move request and response schemas into matching subdirectories, extract the shared chat lock type, and update barrels and imports without changing wire formats.
This commit is contained in:
@@ -2,19 +2,19 @@
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./facebook_identity_request";
|
||||
export * from "./facebook_identity_response";
|
||||
export * from "./facebook_login_request";
|
||||
export * from "./facebook_psid_login_request";
|
||||
export * from "./facebook_psid_login_response";
|
||||
export * from "./facebook_user_data";
|
||||
export * from "./fb_id_login_request";
|
||||
export * from "./google_login_request";
|
||||
export * from "./guest_login_request";
|
||||
export * from "./guest_login_response";
|
||||
export * from "./login_request";
|
||||
export * from "./login_response";
|
||||
export * from "./logout_response";
|
||||
export * from "./refresh_token_request";
|
||||
export * from "./refresh_token_response";
|
||||
export * from "./register_request";
|
||||
export * from "./request/facebook_identity_request";
|
||||
export * from "./request/facebook_login_request";
|
||||
export * from "./request/facebook_psid_login_request";
|
||||
export * from "./request/fb_id_login_request";
|
||||
export * from "./request/google_login_request";
|
||||
export * from "./request/guest_login_request";
|
||||
export * from "./request/login_request";
|
||||
export * from "./request/refresh_token_request";
|
||||
export * from "./request/register_request";
|
||||
export * from "./response/facebook_identity_response";
|
||||
export * from "./response/facebook_psid_login_response";
|
||||
export * from "./response/guest_login_response";
|
||||
export * from "./response/login_response";
|
||||
export * from "./response/logout_response";
|
||||
export * from "./response/refresh_token_response";
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { stringOrEmpty } from "../nullable-defaults";
|
||||
import { stringOrEmpty } from "../../nullable-defaults";
|
||||
|
||||
export const FacebookIdentityRequestSchema = z.object({
|
||||
asid: stringOrEmpty,
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { booleanOrFalse, stringOrEmpty } from "../nullable-defaults";
|
||||
import { booleanOrFalse, stringOrEmpty } from "../../nullable-defaults";
|
||||
|
||||
export const FacebookLoginRequestSchema = z.object({
|
||||
accessToken: z.string(),
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { booleanOrTrue, stringOrEmpty } from "../nullable-defaults";
|
||||
import { booleanOrTrue, stringOrEmpty } from "../../nullable-defaults";
|
||||
|
||||
export const FacebookPsidLoginRequestSchema = z.object({
|
||||
psid: z.string(),
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { booleanOrFalse, stringOrEmpty } from "../nullable-defaults";
|
||||
import { booleanOrFalse, stringOrEmpty } from "../../nullable-defaults";
|
||||
|
||||
export const FbIdLoginRequestSchema = z.object({
|
||||
fbId: z.string(),
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { booleanOrFalse, stringOrEmpty } from "../nullable-defaults";
|
||||
import { booleanOrFalse, stringOrEmpty } from "../../nullable-defaults";
|
||||
|
||||
export const GoogleLoginRequestSchema = z.object({
|
||||
idToken: z.string(),
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { booleanOrFalse } from "../nullable-defaults";
|
||||
import { booleanOrFalse } from "../../nullable-defaults";
|
||||
|
||||
export const GuestLoginRequestSchema = z.object({
|
||||
deviceId: z.string(),
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./facebook_identity_request";
|
||||
export * from "./facebook_login_request";
|
||||
export * from "./facebook_psid_login_request";
|
||||
export * from "./fb_id_login_request";
|
||||
export * from "./google_login_request";
|
||||
export * from "./guest_login_request";
|
||||
export * from "./login_request";
|
||||
export * from "./refresh_token_request";
|
||||
export * from "./register_request";
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { booleanOrFalse, stringOrEmpty } from "../nullable-defaults";
|
||||
import { booleanOrFalse, stringOrEmpty } from "../../nullable-defaults";
|
||||
|
||||
export const LoginRequestSchema = z.object({
|
||||
email: stringOrEmpty,
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { booleanOrFalse, stringOrEmpty } from "../nullable-defaults";
|
||||
import { booleanOrFalse, stringOrEmpty } from "../../nullable-defaults";
|
||||
|
||||
export const RegisterRequestSchema = z.object({
|
||||
username: z.string(),
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { arrayOrEmpty, stringOrEmpty } from "../nullable-defaults";
|
||||
import { arrayOrEmpty, stringOrEmpty } from "../../nullable-defaults";
|
||||
|
||||
export const FacebookIdentityBindingSchema = z.object({
|
||||
conflicts: arrayOrEmpty(z.unknown()),
|
||||
+2
-2
@@ -7,8 +7,8 @@ import {
|
||||
booleanOrFalse,
|
||||
schemaOrNull,
|
||||
stringOrEmpty,
|
||||
} from "../nullable-defaults";
|
||||
import { UserSchema } from "../user/user";
|
||||
} from "../../nullable-defaults";
|
||||
import { UserSchema } from "../../user/user";
|
||||
|
||||
export const FacebookPsidLoginResponseSchema = z.object({
|
||||
token: z.string(),
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { booleanOrTrue, numberOr, schemaOrNull } from "../nullable-defaults";
|
||||
import { UserSchema } from "../user/user";
|
||||
import { booleanOrTrue, numberOr, schemaOrNull } from "../../nullable-defaults";
|
||||
import { UserSchema } from "../../user/user";
|
||||
|
||||
export const GuestLoginResponseSchema = z.object({
|
||||
token: z.string(),
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./facebook_identity_response";
|
||||
export * from "./facebook_psid_login_response";
|
||||
export * from "./guest_login_response";
|
||||
export * from "./login_response";
|
||||
export * from "./logout_response";
|
||||
export * from "./refresh_token_response";
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { stringOrEmpty } from "../nullable-defaults";
|
||||
import { UserSchema } from "../user/user";
|
||||
import { stringOrEmpty } from "../../nullable-defaults";
|
||||
import { UserSchema } from "../../user/user";
|
||||
|
||||
export const LoginResponseSchema = z.object({
|
||||
user: UserSchema,
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { booleanOrTrue } from "../nullable-defaults";
|
||||
import { booleanOrTrue } from "../../nullable-defaults";
|
||||
|
||||
export const LogoutResponseSchema = z.object({
|
||||
success: booleanOrTrue,
|
||||
@@ -0,0 +1,9 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const ChatLockTypeSchema = z.enum([
|
||||
"voice_message",
|
||||
"image_paywall",
|
||||
"private_message",
|
||||
]);
|
||||
|
||||
export type ChatLockType = z.output<typeof ChatLockTypeSchema>;
|
||||
@@ -2,11 +2,12 @@
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./chat_history_response";
|
||||
export * from "./chat_lock_type";
|
||||
export * from "./chat_message";
|
||||
export * from "./chat_payloads";
|
||||
export * from "./chat_send_response";
|
||||
export * from "./send_message_request";
|
||||
export * from "./unlock_history_response";
|
||||
export * from "./unlock_private_request";
|
||||
export * from "./unlock_private_response";
|
||||
export * from "./request/send_message_request";
|
||||
export * from "./request/unlock_private_request";
|
||||
export * from "./response/chat_history_response";
|
||||
export * from "./response/chat_send_response";
|
||||
export * from "./response/unlock_history_response";
|
||||
export * from "./response/unlock_private_response";
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./send_message_request";
|
||||
export * from "./unlock_private_request";
|
||||
+5
-1
@@ -4,7 +4,11 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { booleanOrFalse, numberOrZero, stringOrEmpty } from "../nullable-defaults";
|
||||
import {
|
||||
booleanOrFalse,
|
||||
numberOrZero,
|
||||
stringOrEmpty,
|
||||
} from "../../nullable-defaults";
|
||||
|
||||
export const SendMessageRequestSchema = z.object({
|
||||
message: stringOrEmpty,
|
||||
+1
-7
@@ -3,11 +3,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const ChatLockTypeSchema = z.enum([
|
||||
"voice_message",
|
||||
"image_paywall",
|
||||
"private_message",
|
||||
]);
|
||||
import { ChatLockTypeSchema } from "../chat_lock_type";
|
||||
|
||||
export const UnlockPrivateRequestSchema = z
|
||||
.object({
|
||||
@@ -19,8 +15,6 @@ export const UnlockPrivateRequestSchema = z
|
||||
message: "messageId or lockType is required",
|
||||
});
|
||||
|
||||
export type ChatLockType = z.output<typeof ChatLockTypeSchema>;
|
||||
|
||||
export type UnlockPrivateRequestInput = z.input<
|
||||
typeof UnlockPrivateRequestSchema
|
||||
>;
|
||||
+6
-2
@@ -4,8 +4,12 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { arrayOrEmpty, booleanOrFalse, numberOrZero } from "../nullable-defaults";
|
||||
import { ChatMessageSchema } from "./chat_message";
|
||||
import {
|
||||
arrayOrEmpty,
|
||||
booleanOrFalse,
|
||||
numberOrZero,
|
||||
} from "../../nullable-defaults";
|
||||
import { ChatMessageSchema } from "../chat_message";
|
||||
|
||||
export const ChatHistoryResponseSchema = z.object({
|
||||
messages: arrayOrEmpty(ChatMessageSchema),
|
||||
+2
-2
@@ -9,8 +9,8 @@ import {
|
||||
numberOrLazy,
|
||||
numberOrZero,
|
||||
stringOrEmpty,
|
||||
} from "../nullable-defaults";
|
||||
import { ChatImageSchema, ChatLockDetailSchema } from "./chat_payloads";
|
||||
} from "../../nullable-defaults";
|
||||
import { ChatImageSchema, ChatLockDetailSchema } from "../chat_payloads";
|
||||
|
||||
export const ChatSendResponseSchema = z.object({
|
||||
reply: stringOrEmpty,
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./chat_history_response";
|
||||
export * from "./chat_send_response";
|
||||
export * from "./unlock_history_response";
|
||||
export * from "./unlock_private_response";
|
||||
+6
-1
@@ -3,7 +3,12 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { arrayOrEmpty, booleanOrFalse, numberOrZero, recordOrEmpty } from "../nullable-defaults";
|
||||
import {
|
||||
arrayOrEmpty,
|
||||
booleanOrFalse,
|
||||
numberOrZero,
|
||||
recordOrEmpty,
|
||||
} from "../../nullable-defaults";
|
||||
|
||||
export const UnlockHistoryCostsByMessageSchema = recordOrEmpty(z.number());
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ import {
|
||||
numberOrZero,
|
||||
stringOrEmpty,
|
||||
stringOrNull,
|
||||
} from "../nullable-defaults";
|
||||
import { ChatImageSchema, ChatLockDetailSchema } from "./chat_payloads";
|
||||
import { ChatLockTypeSchema } from "./unlock_private_request";
|
||||
} from "../../nullable-defaults";
|
||||
import { ChatImageSchema, ChatLockDetailSchema } from "../chat_payloads";
|
||||
import { ChatLockTypeSchema } from "../chat_lock_type";
|
||||
|
||||
/**
|
||||
* 单条历史付费 / 私密消息解锁响应。
|
||||
@@ -2,5 +2,5 @@
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./app_event";
|
||||
export * from "./pwa_event";
|
||||
export * from "./request/app_event";
|
||||
export * from "./request/pwa_event";
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { stringOrEmpty } from "../nullable-defaults";
|
||||
import { stringOrEmpty } from "../../nullable-defaults";
|
||||
|
||||
export const AppEventSchema = z.object({
|
||||
userId: stringOrEmpty,
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./app_event";
|
||||
export * from "./pwa_event";
|
||||
+1
-1
@@ -8,7 +8,7 @@ import {
|
||||
booleanOrFalse,
|
||||
numberOrZero,
|
||||
stringOrEmpty,
|
||||
} from "../nullable-defaults";
|
||||
} from "../../nullable-defaults";
|
||||
|
||||
export const PwaEventSchema = z.object({
|
||||
deviceId: stringOrEmpty,
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* @file Payment schema barrel.
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./create_payment_order_request";
|
||||
export * from "./create_payment_order_response";
|
||||
export * from "./payment_order_status_response";
|
||||
export * from "./payment_plan";
|
||||
export * from "./payment_plans_response";
|
||||
export * from "./tip_payment_plan";
|
||||
export * from "./tip_payment_plans_response";
|
||||
export * from "./request/create_payment_order_request";
|
||||
export * from "./response/create_payment_order_response";
|
||||
export * from "./response/payment_order_status_response";
|
||||
export * from "./response/payment_plans_response";
|
||||
export * from "./response/tip_payment_plans_response";
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./create_payment_order_request";
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
import { stringOrNull } from "../nullable-defaults";
|
||||
import { stringOrNull } from "../../nullable-defaults";
|
||||
|
||||
const paymentUrlKeys = [
|
||||
"cashierUrl",
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./create_payment_order_response";
|
||||
export * from "./payment_order_status_response";
|
||||
export * from "./payment_plans_response";
|
||||
export * from "./tip_payment_plans_response";
|
||||
+2
-2
@@ -9,8 +9,8 @@ import {
|
||||
numberOrZero,
|
||||
schemaOrNull,
|
||||
stringOrEmpty,
|
||||
} from "../nullable-defaults";
|
||||
import { PaymentPlanSchema } from "./payment_plan";
|
||||
} from "../../nullable-defaults";
|
||||
import { PaymentPlanSchema } from "../payment_plan";
|
||||
|
||||
export const FirstRechargeOfferSchema = z.object({
|
||||
enabled: booleanOrFalse,
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { arrayOrEmpty } from "../nullable-defaults";
|
||||
import { TipPaymentPlanSchema } from "./tip_payment_plan";
|
||||
import { arrayOrEmpty } from "../../nullable-defaults";
|
||||
import { TipPaymentPlanSchema } from "../tip_payment_plan";
|
||||
|
||||
export const TipPaymentPlansResponseSchema = z.object({
|
||||
plans: arrayOrEmpty(TipPaymentPlanSchema),
|
||||
@@ -1,4 +1,8 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./private_album";
|
||||
export * from "./private_albums_response";
|
||||
export * from "./private_album_unlock_response";
|
||||
export * from "./unlock_private_album_request";
|
||||
export * from "./request/unlock_private_album_request";
|
||||
export * from "./response/private_album_unlock_response";
|
||||
export * from "./response/private_albums_response";
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./unlock_private_album_request";
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { numberOrZero } from "../nullable-defaults";
|
||||
import { numberOrZero } from "../../nullable-defaults";
|
||||
|
||||
export const UnlockPrivateAlbumRequestSchema = z.object({
|
||||
expectedCost: numberOrZero,
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./private_album_unlock_response";
|
||||
export * from "./private_albums_response";
|
||||
+2
-2
@@ -5,8 +5,8 @@ import {
|
||||
booleanOrFalse,
|
||||
numberOrZero,
|
||||
stringOrEmpty,
|
||||
} from "../nullable-defaults";
|
||||
import { PrivateAlbumImageSchema } from "./private_album";
|
||||
} from "../../nullable-defaults";
|
||||
import { PrivateAlbumImageSchema } from "../private_album";
|
||||
|
||||
export const PrivateAlbumUnlockReasonSchema = z.enum([
|
||||
"ok",
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { arrayOrEmpty, numberOrZero } from "../nullable-defaults";
|
||||
import { PrivateAlbumSchema } from "./private_album";
|
||||
import { arrayOrEmpty, numberOrZero } from "../../nullable-defaults";
|
||||
import { PrivateAlbumSchema } from "../private_album";
|
||||
|
||||
export const PrivateAlbumsResponseSchema = z.object({
|
||||
items: arrayOrEmpty(PrivateAlbumSchema),
|
||||
Reference in New Issue
Block a user