@beorchid-llc/thrivo-contracts 0.3.0 → 0.5.0
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/dist/admin.d.ts +410 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +129 -0
- package/dist/admin.js.map +1 -0
- package/dist/auth.d.ts +71 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +47 -0
- package/dist/auth.js.map +1 -0
- package/dist/common.d.ts +43 -27
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +17 -2
- package/dist/common.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/users.d.ts +40 -48
- package/dist/users.d.ts.map +1 -1
- package/package.json +9 -1
package/dist/admin.d.ts
ADDED
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const adminRoleSchema: z.ZodEnum<["admin", "support", "read-only"]>;
|
|
3
|
+
export type AdminRole = z.infer<typeof adminRoleSchema>;
|
|
4
|
+
export declare const adminSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
email: z.ZodString;
|
|
7
|
+
name: z.ZodNullable<z.ZodString>;
|
|
8
|
+
role: z.ZodEnum<["admin", "support", "read-only"]>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
id: string;
|
|
11
|
+
email: string;
|
|
12
|
+
name: string | null;
|
|
13
|
+
role: "admin" | "support" | "read-only";
|
|
14
|
+
}, {
|
|
15
|
+
id: string;
|
|
16
|
+
email: string;
|
|
17
|
+
name: string | null;
|
|
18
|
+
role: "admin" | "support" | "read-only";
|
|
19
|
+
}>;
|
|
20
|
+
export type Admin = z.infer<typeof adminSchema>;
|
|
21
|
+
export declare const adminSessionResponseSchema: z.ZodObject<{
|
|
22
|
+
admin: z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
email: z.ZodString;
|
|
25
|
+
name: z.ZodNullable<z.ZodString>;
|
|
26
|
+
role: z.ZodEnum<["admin", "support", "read-only"]>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
id: string;
|
|
29
|
+
email: string;
|
|
30
|
+
name: string | null;
|
|
31
|
+
role: "admin" | "support" | "read-only";
|
|
32
|
+
}, {
|
|
33
|
+
id: string;
|
|
34
|
+
email: string;
|
|
35
|
+
name: string | null;
|
|
36
|
+
role: "admin" | "support" | "read-only";
|
|
37
|
+
}>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
admin: {
|
|
40
|
+
id: string;
|
|
41
|
+
email: string;
|
|
42
|
+
name: string | null;
|
|
43
|
+
role: "admin" | "support" | "read-only";
|
|
44
|
+
};
|
|
45
|
+
}, {
|
|
46
|
+
admin: {
|
|
47
|
+
id: string;
|
|
48
|
+
email: string;
|
|
49
|
+
name: string | null;
|
|
50
|
+
role: "admin" | "support" | "read-only";
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
export type AdminSessionResponse = z.infer<typeof adminSessionResponseSchema>;
|
|
54
|
+
export declare const adminAckSchema: z.ZodNull;
|
|
55
|
+
export type AdminAck = null;
|
|
56
|
+
export declare const adminOtpRequestPayloadSchema: z.ZodObject<{
|
|
57
|
+
email: z.ZodString;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
email: string;
|
|
60
|
+
}, {
|
|
61
|
+
email: string;
|
|
62
|
+
}>;
|
|
63
|
+
export type AdminOtpRequestPayload = z.infer<typeof adminOtpRequestPayloadSchema>;
|
|
64
|
+
export declare const adminOtpVerifyPayloadSchema: z.ZodObject<{
|
|
65
|
+
email: z.ZodString;
|
|
66
|
+
code: z.ZodString;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
code: string;
|
|
69
|
+
email: string;
|
|
70
|
+
}, {
|
|
71
|
+
code: string;
|
|
72
|
+
email: string;
|
|
73
|
+
}>;
|
|
74
|
+
export type AdminOtpVerifyPayload = z.infer<typeof adminOtpVerifyPayloadSchema>;
|
|
75
|
+
export declare const adminPaginationSchema: z.ZodObject<{
|
|
76
|
+
page: z.ZodNumber;
|
|
77
|
+
pageSize: z.ZodNumber;
|
|
78
|
+
total: z.ZodNumber;
|
|
79
|
+
totalPages: z.ZodNumber;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
page: number;
|
|
82
|
+
pageSize: number;
|
|
83
|
+
total: number;
|
|
84
|
+
totalPages: number;
|
|
85
|
+
}, {
|
|
86
|
+
page: number;
|
|
87
|
+
pageSize: number;
|
|
88
|
+
total: number;
|
|
89
|
+
totalPages: number;
|
|
90
|
+
}>;
|
|
91
|
+
export type AdminPagination = z.infer<typeof adminPaginationSchema>;
|
|
92
|
+
export declare const adminPaginated: <T extends z.ZodTypeAny>(item: T) => z.ZodObject<{
|
|
93
|
+
items: z.ZodArray<T, "many">;
|
|
94
|
+
pagination: z.ZodObject<{
|
|
95
|
+
page: z.ZodNumber;
|
|
96
|
+
pageSize: z.ZodNumber;
|
|
97
|
+
total: z.ZodNumber;
|
|
98
|
+
totalPages: z.ZodNumber;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
page: number;
|
|
101
|
+
pageSize: number;
|
|
102
|
+
total: number;
|
|
103
|
+
totalPages: number;
|
|
104
|
+
}, {
|
|
105
|
+
page: number;
|
|
106
|
+
pageSize: number;
|
|
107
|
+
total: number;
|
|
108
|
+
totalPages: number;
|
|
109
|
+
}>;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
items: T["_output"][];
|
|
112
|
+
pagination: {
|
|
113
|
+
page: number;
|
|
114
|
+
pageSize: number;
|
|
115
|
+
total: number;
|
|
116
|
+
totalPages: number;
|
|
117
|
+
};
|
|
118
|
+
}, {
|
|
119
|
+
items: T["_input"][];
|
|
120
|
+
pagination: {
|
|
121
|
+
page: number;
|
|
122
|
+
pageSize: number;
|
|
123
|
+
total: number;
|
|
124
|
+
totalPages: number;
|
|
125
|
+
};
|
|
126
|
+
}>;
|
|
127
|
+
export declare const adminEntitlementSchema: z.ZodEnum<["free", "premium"]>;
|
|
128
|
+
export type AdminEntitlement = z.infer<typeof adminEntitlementSchema>;
|
|
129
|
+
export declare const adminUserStatusSchema: z.ZodEnum<["active", "suspended", "deleted"]>;
|
|
130
|
+
export type AdminUserStatus = z.infer<typeof adminUserStatusSchema>;
|
|
131
|
+
export declare const adminSubscriptionStatusSchema: z.ZodEnum<["active", "trialing", "canceled", "expired", "none"]>;
|
|
132
|
+
export type AdminSubscriptionStatus = z.infer<typeof adminSubscriptionStatusSchema>;
|
|
133
|
+
export declare const adminUserSchema: z.ZodObject<{
|
|
134
|
+
id: z.ZodString;
|
|
135
|
+
email: z.ZodString;
|
|
136
|
+
name: z.ZodNullable<z.ZodString>;
|
|
137
|
+
entitlement: z.ZodEnum<["free", "premium"]>;
|
|
138
|
+
status: z.ZodEnum<["active", "suspended", "deleted"]>;
|
|
139
|
+
createdAt: z.ZodString;
|
|
140
|
+
lastActiveAt: z.ZodNullable<z.ZodString>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
status: "active" | "suspended" | "deleted";
|
|
143
|
+
id: string;
|
|
144
|
+
email: string;
|
|
145
|
+
name: string | null;
|
|
146
|
+
entitlement: "free" | "premium";
|
|
147
|
+
createdAt: string;
|
|
148
|
+
lastActiveAt: string | null;
|
|
149
|
+
}, {
|
|
150
|
+
status: "active" | "suspended" | "deleted";
|
|
151
|
+
id: string;
|
|
152
|
+
email: string;
|
|
153
|
+
name: string | null;
|
|
154
|
+
entitlement: "free" | "premium";
|
|
155
|
+
createdAt: string;
|
|
156
|
+
lastActiveAt: string | null;
|
|
157
|
+
}>;
|
|
158
|
+
export type AdminUser = z.infer<typeof adminUserSchema>;
|
|
159
|
+
export declare const adminUserDetailSchema: z.ZodObject<{
|
|
160
|
+
id: z.ZodString;
|
|
161
|
+
email: z.ZodString;
|
|
162
|
+
name: z.ZodNullable<z.ZodString>;
|
|
163
|
+
entitlement: z.ZodEnum<["free", "premium"]>;
|
|
164
|
+
status: z.ZodEnum<["active", "suspended", "deleted"]>;
|
|
165
|
+
createdAt: z.ZodString;
|
|
166
|
+
lastActiveAt: z.ZodNullable<z.ZodString>;
|
|
167
|
+
} & {
|
|
168
|
+
goal: z.ZodNullable<z.ZodString>;
|
|
169
|
+
targetCalories: z.ZodNullable<z.ZodNumber>;
|
|
170
|
+
totalFoodLogs: z.ZodNumber;
|
|
171
|
+
currentStreakDays: z.ZodNumber;
|
|
172
|
+
subscription: z.ZodNullable<z.ZodObject<{
|
|
173
|
+
status: z.ZodEnum<["active", "trialing", "canceled", "expired", "none"]>;
|
|
174
|
+
priceLabel: z.ZodNullable<z.ZodString>;
|
|
175
|
+
renewsAt: z.ZodNullable<z.ZodString>;
|
|
176
|
+
cancelAtPeriodEnd: z.ZodBoolean;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
status: "active" | "trialing" | "canceled" | "expired" | "none";
|
|
179
|
+
priceLabel: string | null;
|
|
180
|
+
renewsAt: string | null;
|
|
181
|
+
cancelAtPeriodEnd: boolean;
|
|
182
|
+
}, {
|
|
183
|
+
status: "active" | "trialing" | "canceled" | "expired" | "none";
|
|
184
|
+
priceLabel: string | null;
|
|
185
|
+
renewsAt: string | null;
|
|
186
|
+
cancelAtPeriodEnd: boolean;
|
|
187
|
+
}>>;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
status: "active" | "suspended" | "deleted";
|
|
190
|
+
id: string;
|
|
191
|
+
email: string;
|
|
192
|
+
name: string | null;
|
|
193
|
+
entitlement: "free" | "premium";
|
|
194
|
+
createdAt: string;
|
|
195
|
+
lastActiveAt: string | null;
|
|
196
|
+
goal: string | null;
|
|
197
|
+
targetCalories: number | null;
|
|
198
|
+
totalFoodLogs: number;
|
|
199
|
+
currentStreakDays: number;
|
|
200
|
+
subscription: {
|
|
201
|
+
status: "active" | "trialing" | "canceled" | "expired" | "none";
|
|
202
|
+
priceLabel: string | null;
|
|
203
|
+
renewsAt: string | null;
|
|
204
|
+
cancelAtPeriodEnd: boolean;
|
|
205
|
+
} | null;
|
|
206
|
+
}, {
|
|
207
|
+
status: "active" | "suspended" | "deleted";
|
|
208
|
+
id: string;
|
|
209
|
+
email: string;
|
|
210
|
+
name: string | null;
|
|
211
|
+
entitlement: "free" | "premium";
|
|
212
|
+
createdAt: string;
|
|
213
|
+
lastActiveAt: string | null;
|
|
214
|
+
goal: string | null;
|
|
215
|
+
targetCalories: number | null;
|
|
216
|
+
totalFoodLogs: number;
|
|
217
|
+
currentStreakDays: number;
|
|
218
|
+
subscription: {
|
|
219
|
+
status: "active" | "trialing" | "canceled" | "expired" | "none";
|
|
220
|
+
priceLabel: string | null;
|
|
221
|
+
renewsAt: string | null;
|
|
222
|
+
cancelAtPeriodEnd: boolean;
|
|
223
|
+
} | null;
|
|
224
|
+
}>;
|
|
225
|
+
export type AdminUserDetail = z.infer<typeof adminUserDetailSchema>;
|
|
226
|
+
export declare const adminUserDetailResponseSchema: z.ZodObject<{
|
|
227
|
+
user: z.ZodObject<{
|
|
228
|
+
id: z.ZodString;
|
|
229
|
+
email: z.ZodString;
|
|
230
|
+
name: z.ZodNullable<z.ZodString>;
|
|
231
|
+
entitlement: z.ZodEnum<["free", "premium"]>;
|
|
232
|
+
status: z.ZodEnum<["active", "suspended", "deleted"]>;
|
|
233
|
+
createdAt: z.ZodString;
|
|
234
|
+
lastActiveAt: z.ZodNullable<z.ZodString>;
|
|
235
|
+
} & {
|
|
236
|
+
goal: z.ZodNullable<z.ZodString>;
|
|
237
|
+
targetCalories: z.ZodNullable<z.ZodNumber>;
|
|
238
|
+
totalFoodLogs: z.ZodNumber;
|
|
239
|
+
currentStreakDays: z.ZodNumber;
|
|
240
|
+
subscription: z.ZodNullable<z.ZodObject<{
|
|
241
|
+
status: z.ZodEnum<["active", "trialing", "canceled", "expired", "none"]>;
|
|
242
|
+
priceLabel: z.ZodNullable<z.ZodString>;
|
|
243
|
+
renewsAt: z.ZodNullable<z.ZodString>;
|
|
244
|
+
cancelAtPeriodEnd: z.ZodBoolean;
|
|
245
|
+
}, "strip", z.ZodTypeAny, {
|
|
246
|
+
status: "active" | "trialing" | "canceled" | "expired" | "none";
|
|
247
|
+
priceLabel: string | null;
|
|
248
|
+
renewsAt: string | null;
|
|
249
|
+
cancelAtPeriodEnd: boolean;
|
|
250
|
+
}, {
|
|
251
|
+
status: "active" | "trialing" | "canceled" | "expired" | "none";
|
|
252
|
+
priceLabel: string | null;
|
|
253
|
+
renewsAt: string | null;
|
|
254
|
+
cancelAtPeriodEnd: boolean;
|
|
255
|
+
}>>;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
status: "active" | "suspended" | "deleted";
|
|
258
|
+
id: string;
|
|
259
|
+
email: string;
|
|
260
|
+
name: string | null;
|
|
261
|
+
entitlement: "free" | "premium";
|
|
262
|
+
createdAt: string;
|
|
263
|
+
lastActiveAt: string | null;
|
|
264
|
+
goal: string | null;
|
|
265
|
+
targetCalories: number | null;
|
|
266
|
+
totalFoodLogs: number;
|
|
267
|
+
currentStreakDays: number;
|
|
268
|
+
subscription: {
|
|
269
|
+
status: "active" | "trialing" | "canceled" | "expired" | "none";
|
|
270
|
+
priceLabel: string | null;
|
|
271
|
+
renewsAt: string | null;
|
|
272
|
+
cancelAtPeriodEnd: boolean;
|
|
273
|
+
} | null;
|
|
274
|
+
}, {
|
|
275
|
+
status: "active" | "suspended" | "deleted";
|
|
276
|
+
id: string;
|
|
277
|
+
email: string;
|
|
278
|
+
name: string | null;
|
|
279
|
+
entitlement: "free" | "premium";
|
|
280
|
+
createdAt: string;
|
|
281
|
+
lastActiveAt: string | null;
|
|
282
|
+
goal: string | null;
|
|
283
|
+
targetCalories: number | null;
|
|
284
|
+
totalFoodLogs: number;
|
|
285
|
+
currentStreakDays: number;
|
|
286
|
+
subscription: {
|
|
287
|
+
status: "active" | "trialing" | "canceled" | "expired" | "none";
|
|
288
|
+
priceLabel: string | null;
|
|
289
|
+
renewsAt: string | null;
|
|
290
|
+
cancelAtPeriodEnd: boolean;
|
|
291
|
+
} | null;
|
|
292
|
+
}>;
|
|
293
|
+
}, "strip", z.ZodTypeAny, {
|
|
294
|
+
user: {
|
|
295
|
+
status: "active" | "suspended" | "deleted";
|
|
296
|
+
id: string;
|
|
297
|
+
email: string;
|
|
298
|
+
name: string | null;
|
|
299
|
+
entitlement: "free" | "premium";
|
|
300
|
+
createdAt: string;
|
|
301
|
+
lastActiveAt: string | null;
|
|
302
|
+
goal: string | null;
|
|
303
|
+
targetCalories: number | null;
|
|
304
|
+
totalFoodLogs: number;
|
|
305
|
+
currentStreakDays: number;
|
|
306
|
+
subscription: {
|
|
307
|
+
status: "active" | "trialing" | "canceled" | "expired" | "none";
|
|
308
|
+
priceLabel: string | null;
|
|
309
|
+
renewsAt: string | null;
|
|
310
|
+
cancelAtPeriodEnd: boolean;
|
|
311
|
+
} | null;
|
|
312
|
+
};
|
|
313
|
+
}, {
|
|
314
|
+
user: {
|
|
315
|
+
status: "active" | "suspended" | "deleted";
|
|
316
|
+
id: string;
|
|
317
|
+
email: string;
|
|
318
|
+
name: string | null;
|
|
319
|
+
entitlement: "free" | "premium";
|
|
320
|
+
createdAt: string;
|
|
321
|
+
lastActiveAt: string | null;
|
|
322
|
+
goal: string | null;
|
|
323
|
+
targetCalories: number | null;
|
|
324
|
+
totalFoodLogs: number;
|
|
325
|
+
currentStreakDays: number;
|
|
326
|
+
subscription: {
|
|
327
|
+
status: "active" | "trialing" | "canceled" | "expired" | "none";
|
|
328
|
+
priceLabel: string | null;
|
|
329
|
+
renewsAt: string | null;
|
|
330
|
+
cancelAtPeriodEnd: boolean;
|
|
331
|
+
} | null;
|
|
332
|
+
};
|
|
333
|
+
}>;
|
|
334
|
+
export type AdminUserDetailResponse = z.infer<typeof adminUserDetailResponseSchema>;
|
|
335
|
+
export declare const adminCancelPayloadSchema: z.ZodObject<{
|
|
336
|
+
reason: z.ZodString;
|
|
337
|
+
}, "strip", z.ZodTypeAny, {
|
|
338
|
+
reason: string;
|
|
339
|
+
}, {
|
|
340
|
+
reason: string;
|
|
341
|
+
}>;
|
|
342
|
+
export type AdminCancelPayload = z.infer<typeof adminCancelPayloadSchema>;
|
|
343
|
+
export declare const adminRefundPayloadSchema: z.ZodObject<{
|
|
344
|
+
amountCents: z.ZodOptional<z.ZodNumber>;
|
|
345
|
+
reason: z.ZodString;
|
|
346
|
+
}, "strip", z.ZodTypeAny, {
|
|
347
|
+
reason: string;
|
|
348
|
+
amountCents?: number | undefined;
|
|
349
|
+
}, {
|
|
350
|
+
reason: string;
|
|
351
|
+
amountCents?: number | undefined;
|
|
352
|
+
}>;
|
|
353
|
+
export type AdminRefundPayload = z.infer<typeof adminRefundPayloadSchema>;
|
|
354
|
+
/** Response for CSV/export endpoints — a signed download URL. */
|
|
355
|
+
export declare const adminExportResponseSchema: z.ZodObject<{
|
|
356
|
+
url: z.ZodString;
|
|
357
|
+
}, "strip", z.ZodTypeAny, {
|
|
358
|
+
url: string;
|
|
359
|
+
}, {
|
|
360
|
+
url: string;
|
|
361
|
+
}>;
|
|
362
|
+
export type AdminExportResponse = z.infer<typeof adminExportResponseSchema>;
|
|
363
|
+
export declare const adminRoutes: {
|
|
364
|
+
getSession: {
|
|
365
|
+
method: "GET";
|
|
366
|
+
path: "/api/v1/admin/auth/session";
|
|
367
|
+
auth: "admin";
|
|
368
|
+
};
|
|
369
|
+
requestOtp: {
|
|
370
|
+
method: "POST";
|
|
371
|
+
path: "/api/v1/admin/auth/request-otp";
|
|
372
|
+
auth: "public";
|
|
373
|
+
};
|
|
374
|
+
verifyOtp: {
|
|
375
|
+
method: "POST";
|
|
376
|
+
path: "/api/v1/admin/auth/verify-otp";
|
|
377
|
+
auth: "public";
|
|
378
|
+
};
|
|
379
|
+
adminLogout: {
|
|
380
|
+
method: "POST";
|
|
381
|
+
path: "/api/v1/admin/auth/logout";
|
|
382
|
+
auth: "admin";
|
|
383
|
+
};
|
|
384
|
+
listUsers: {
|
|
385
|
+
method: "GET";
|
|
386
|
+
path: "/api/v1/admin/users";
|
|
387
|
+
auth: "admin";
|
|
388
|
+
};
|
|
389
|
+
getUser: {
|
|
390
|
+
method: "GET";
|
|
391
|
+
path: "/api/v1/admin/users/:id";
|
|
392
|
+
auth: "admin";
|
|
393
|
+
};
|
|
394
|
+
hardDeleteUser: {
|
|
395
|
+
method: "DELETE";
|
|
396
|
+
path: "/api/v1/admin/users/:id";
|
|
397
|
+
auth: "admin";
|
|
398
|
+
};
|
|
399
|
+
cancelSubscription: {
|
|
400
|
+
method: "POST";
|
|
401
|
+
path: "/api/v1/admin/users/:id/subscription/cancel";
|
|
402
|
+
auth: "admin";
|
|
403
|
+
};
|
|
404
|
+
refundSubscription: {
|
|
405
|
+
method: "POST";
|
|
406
|
+
path: "/api/v1/admin/users/:id/subscription/refund";
|
|
407
|
+
auth: "admin";
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,eAAe,8CAA4C,CAAC;AACzE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAKtB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAMhD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAmC,CAAC;AAC3E,MAAM,MAAM,oBAAoB,GAAG,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAahC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4C,CAAC;AACvF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,wBAAwB;;;;;;EAA0C,CAAC;AAChF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,wBAAwB;;;;;;;;;EAGnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,iEAAiE;AACjE,eAAO,MAAM,yBAAyB;;;;;;EAAsC,CAAC;AAC7E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAM5E,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDiB,CAAC"}
|
package/dist/admin.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Admin identity
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
export const adminRoleSchema = z.enum(["admin", "support", "read-only"]);
|
|
6
|
+
export const adminSchema = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
email: z.string().email(),
|
|
9
|
+
name: z.string().nullable(),
|
|
10
|
+
role: adminRoleSchema,
|
|
11
|
+
});
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Admin auth payloads + responses
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
export const adminSessionResponseSchema = z.object({ admin: adminSchema });
|
|
16
|
+
export const adminAckSchema = z.null();
|
|
17
|
+
export const adminOtpRequestPayloadSchema = z.object({
|
|
18
|
+
email: z.string().email(),
|
|
19
|
+
});
|
|
20
|
+
export const adminOtpVerifyPayloadSchema = z.object({
|
|
21
|
+
email: z.string().email(),
|
|
22
|
+
code: z.string().min(4),
|
|
23
|
+
});
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Admin pagination helper
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
export const adminPaginationSchema = z.object({
|
|
28
|
+
page: z.number(),
|
|
29
|
+
pageSize: z.number(),
|
|
30
|
+
total: z.number(),
|
|
31
|
+
totalPages: z.number(),
|
|
32
|
+
});
|
|
33
|
+
export const adminPaginated = (item) => z.object({ items: z.array(item), pagination: adminPaginationSchema });
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
// Admin user schemas
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
export const adminEntitlementSchema = z.enum(["free", "premium"]);
|
|
38
|
+
export const adminUserStatusSchema = z.enum(["active", "suspended", "deleted"]);
|
|
39
|
+
export const adminSubscriptionStatusSchema = z.enum([
|
|
40
|
+
"active",
|
|
41
|
+
"trialing",
|
|
42
|
+
"canceled",
|
|
43
|
+
"expired",
|
|
44
|
+
"none",
|
|
45
|
+
]);
|
|
46
|
+
export const adminUserSchema = z.object({
|
|
47
|
+
id: z.string(),
|
|
48
|
+
email: z.string().email(),
|
|
49
|
+
name: z.string().nullable(),
|
|
50
|
+
entitlement: adminEntitlementSchema,
|
|
51
|
+
status: adminUserStatusSchema,
|
|
52
|
+
createdAt: z.string(), // ISO-8601
|
|
53
|
+
lastActiveAt: z.string().nullable(),
|
|
54
|
+
});
|
|
55
|
+
export const adminUserDetailSchema = adminUserSchema.extend({
|
|
56
|
+
goal: z.string().nullable(),
|
|
57
|
+
targetCalories: z.number().nullable(),
|
|
58
|
+
totalFoodLogs: z.number(),
|
|
59
|
+
currentStreakDays: z.number(),
|
|
60
|
+
subscription: z
|
|
61
|
+
.object({
|
|
62
|
+
status: adminSubscriptionStatusSchema,
|
|
63
|
+
priceLabel: z.string().nullable(),
|
|
64
|
+
renewsAt: z.string().nullable(),
|
|
65
|
+
cancelAtPeriodEnd: z.boolean(),
|
|
66
|
+
})
|
|
67
|
+
.nullable(),
|
|
68
|
+
});
|
|
69
|
+
export const adminUserDetailResponseSchema = z.object({ user: adminUserDetailSchema });
|
|
70
|
+
export const adminCancelPayloadSchema = z.object({ reason: z.string().min(1) });
|
|
71
|
+
export const adminRefundPayloadSchema = z.object({
|
|
72
|
+
amountCents: z.number().int().positive().optional(),
|
|
73
|
+
reason: z.string().min(1),
|
|
74
|
+
});
|
|
75
|
+
/** Response for CSV/export endpoints — a signed download URL. */
|
|
76
|
+
export const adminExportResponseSchema = z.object({ url: z.string().url() });
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
// Admin route contracts
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
export const adminRoutes = {
|
|
81
|
+
// Auth (staff OTP login — session stored in httpOnly cookie)
|
|
82
|
+
getSession: {
|
|
83
|
+
method: "GET",
|
|
84
|
+
path: "/api/v1/admin/auth/session",
|
|
85
|
+
auth: "admin",
|
|
86
|
+
},
|
|
87
|
+
requestOtp: {
|
|
88
|
+
method: "POST",
|
|
89
|
+
path: "/api/v1/admin/auth/request-otp",
|
|
90
|
+
auth: "public",
|
|
91
|
+
},
|
|
92
|
+
verifyOtp: {
|
|
93
|
+
method: "POST",
|
|
94
|
+
path: "/api/v1/admin/auth/verify-otp",
|
|
95
|
+
auth: "public",
|
|
96
|
+
},
|
|
97
|
+
adminLogout: {
|
|
98
|
+
method: "POST",
|
|
99
|
+
path: "/api/v1/admin/auth/logout",
|
|
100
|
+
auth: "admin",
|
|
101
|
+
},
|
|
102
|
+
// User management
|
|
103
|
+
listUsers: {
|
|
104
|
+
method: "GET",
|
|
105
|
+
path: "/api/v1/admin/users",
|
|
106
|
+
auth: "admin",
|
|
107
|
+
},
|
|
108
|
+
getUser: {
|
|
109
|
+
method: "GET",
|
|
110
|
+
path: "/api/v1/admin/users/:id",
|
|
111
|
+
auth: "admin",
|
|
112
|
+
},
|
|
113
|
+
hardDeleteUser: {
|
|
114
|
+
method: "DELETE",
|
|
115
|
+
path: "/api/v1/admin/users/:id",
|
|
116
|
+
auth: "admin",
|
|
117
|
+
},
|
|
118
|
+
cancelSubscription: {
|
|
119
|
+
method: "POST",
|
|
120
|
+
path: "/api/v1/admin/users/:id/subscription/cancel",
|
|
121
|
+
auth: "admin",
|
|
122
|
+
},
|
|
123
|
+
refundSubscription: {
|
|
124
|
+
method: "POST",
|
|
125
|
+
path: "/api/v1/admin/users/:id/subscription/refund",
|
|
126
|
+
auth: "admin",
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;AAGzE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE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AC3B,IAAI,EAAE,OAAO;KACd;IACD,OAAO,EAAE;QACP,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,yBAAyB;QAC/B,IAAI,EAAE,OAAO;KACd;IACD,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,yBAAyB;QAC/B,IAAI,EAAE,OAAO;KACd;IACD,kBAAkB,EAAE;QAClB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,6CAA6C;QACnD,IAAI,EAAE,OAAO;KACd;IACD,kBAAkB,EAAE;QAClB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,6CAA6C;QACnD,IAAI,EAAE,OAAO;KACd;CACsC,CAAC"}
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Token pair returned to a client after a successful auth flow (magic-link or Google OAuth). */
|
|
3
|
+
export declare const authSessionSchema: z.ZodObject<{
|
|
4
|
+
accessToken: z.ZodString;
|
|
5
|
+
refreshToken: z.ZodString;
|
|
6
|
+
refreshExpiresAt: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
accessToken: string;
|
|
9
|
+
refreshToken: string;
|
|
10
|
+
refreshExpiresAt: string;
|
|
11
|
+
}, {
|
|
12
|
+
accessToken: string;
|
|
13
|
+
refreshToken: string;
|
|
14
|
+
refreshExpiresAt: string;
|
|
15
|
+
}>;
|
|
16
|
+
export type AuthSession = z.infer<typeof authSessionSchema>;
|
|
17
|
+
/** POST /auth/magic-link/request payload */
|
|
18
|
+
export declare const magicLinkRequestPayloadSchema: z.ZodObject<{
|
|
19
|
+
email: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
email: string;
|
|
22
|
+
}, {
|
|
23
|
+
email: string;
|
|
24
|
+
}>;
|
|
25
|
+
export type MagicLinkRequestPayload = z.infer<typeof magicLinkRequestPayloadSchema>;
|
|
26
|
+
/** POST /auth/magic-link/verify payload */
|
|
27
|
+
export declare const magicLinkVerifyPayloadSchema: z.ZodObject<{
|
|
28
|
+
token: z.ZodString;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
token: string;
|
|
31
|
+
}, {
|
|
32
|
+
token: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type MagicLinkVerifyPayload = z.infer<typeof magicLinkVerifyPayloadSchema>;
|
|
35
|
+
/** POST /auth/refresh + POST /auth/logout payload */
|
|
36
|
+
export declare const refreshPayloadSchema: z.ZodObject<{
|
|
37
|
+
refreshToken: z.ZodString;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
refreshToken: string;
|
|
40
|
+
}, {
|
|
41
|
+
refreshToken: string;
|
|
42
|
+
}>;
|
|
43
|
+
export type RefreshPayload = z.infer<typeof refreshPayloadSchema>;
|
|
44
|
+
export declare const authRoutes: {
|
|
45
|
+
requestMagicLink: {
|
|
46
|
+
method: "POST";
|
|
47
|
+
path: "/api/v1/auth/magic-link/request";
|
|
48
|
+
auth: "public";
|
|
49
|
+
};
|
|
50
|
+
verifyMagicLink: {
|
|
51
|
+
method: "POST";
|
|
52
|
+
path: "/api/v1/auth/magic-link/verify";
|
|
53
|
+
auth: "public";
|
|
54
|
+
};
|
|
55
|
+
refresh: {
|
|
56
|
+
method: "POST";
|
|
57
|
+
path: "/api/v1/auth/refresh";
|
|
58
|
+
auth: "public";
|
|
59
|
+
};
|
|
60
|
+
logout: {
|
|
61
|
+
method: "POST";
|
|
62
|
+
path: "/api/v1/auth/logout";
|
|
63
|
+
auth: "public";
|
|
64
|
+
};
|
|
65
|
+
googleStart: {
|
|
66
|
+
method: "GET";
|
|
67
|
+
path: "/api/v1/auth/google/start";
|
|
68
|
+
auth: "public";
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,iGAAiG;AACjG,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,4CAA4C;AAC5C,eAAO,MAAM,6BAA6B;;;;;;EAExC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,2CAA2C;AAC3C,eAAO,MAAM,4BAA4B;;;;;;EAEvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,qDAAqD;AACrD,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BkB,CAAC"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Token pair returned to a client after a successful auth flow (magic-link or Google OAuth). */
|
|
3
|
+
export const authSessionSchema = z.object({
|
|
4
|
+
accessToken: z.string(),
|
|
5
|
+
refreshToken: z.string(),
|
|
6
|
+
refreshExpiresAt: z.string(), // ISO-8601
|
|
7
|
+
});
|
|
8
|
+
/** POST /auth/magic-link/request payload */
|
|
9
|
+
export const magicLinkRequestPayloadSchema = z.object({
|
|
10
|
+
email: z.string().email(),
|
|
11
|
+
});
|
|
12
|
+
/** POST /auth/magic-link/verify payload */
|
|
13
|
+
export const magicLinkVerifyPayloadSchema = z.object({
|
|
14
|
+
token: z.string().min(1),
|
|
15
|
+
});
|
|
16
|
+
/** POST /auth/refresh + POST /auth/logout payload */
|
|
17
|
+
export const refreshPayloadSchema = z.object({
|
|
18
|
+
refreshToken: z.string().min(1),
|
|
19
|
+
});
|
|
20
|
+
export const authRoutes = {
|
|
21
|
+
requestMagicLink: {
|
|
22
|
+
method: "POST",
|
|
23
|
+
path: "/api/v1/auth/magic-link/request",
|
|
24
|
+
auth: "public",
|
|
25
|
+
},
|
|
26
|
+
verifyMagicLink: {
|
|
27
|
+
method: "POST",
|
|
28
|
+
path: "/api/v1/auth/magic-link/verify",
|
|
29
|
+
auth: "public",
|
|
30
|
+
},
|
|
31
|
+
refresh: {
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/api/v1/auth/refresh",
|
|
34
|
+
auth: "public",
|
|
35
|
+
},
|
|
36
|
+
logout: {
|
|
37
|
+
method: "POST",
|
|
38
|
+
path: "/api/v1/auth/logout",
|
|
39
|
+
auth: "public",
|
|
40
|
+
},
|
|
41
|
+
googleStart: {
|
|
42
|
+
method: "GET",
|
|
43
|
+
path: "/api/v1/auth/google/start",
|
|
44
|
+
auth: "public",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,iGAAiG;AACjG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,WAAW;CAC1C,CAAC,CAAC;AAGH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;CAC1B,CAAC,CAAC;AAGH,2CAA2C;AAC3C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACzB,CAAC,CAAC;AAGH,qDAAqD;AACrD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,gBAAgB,EAAE;QAChB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,iCAAiC;QACvC,IAAI,EAAE,QAAQ;KACf;IACD,eAAe,EAAE;QACf,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,gCAAgC;QACtC,IAAI,EAAE,QAAQ;KACf;IACD,OAAO,EAAE;QACP,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,QAAQ;KACf;IACD,MAAM,EAAE;QACN,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,qBAAqB;QAC3B,IAAI,EAAE,QAAQ;KACf;IACD,WAAW,EAAE;QACX,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE,QAAQ;KACf;CACsC,CAAC"}
|
package/dist/common.d.ts
CHANGED
|
@@ -10,64 +10,63 @@ export declare const metaSchema: z.ZodObject<{
|
|
|
10
10
|
}, z.ZodUnknown, "strip">>;
|
|
11
11
|
export type Meta = z.infer<typeof metaSchema>;
|
|
12
12
|
export declare const apiErrorSchema: z.ZodObject<{
|
|
13
|
+
success: z.ZodLiteral<false>;
|
|
13
14
|
error: z.ZodObject<{
|
|
14
|
-
code: z.
|
|
15
|
+
code: z.ZodString;
|
|
15
16
|
message: z.ZodString;
|
|
16
17
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
17
18
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
code:
|
|
19
|
+
code: string;
|
|
19
20
|
message: string;
|
|
20
21
|
details?: unknown;
|
|
21
22
|
}, {
|
|
22
|
-
code:
|
|
23
|
+
code: string;
|
|
23
24
|
message: string;
|
|
24
25
|
details?: unknown;
|
|
25
26
|
}>;
|
|
27
|
+
responseCode: z.ZodNumber;
|
|
28
|
+
message: z.ZodString;
|
|
26
29
|
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
message: string;
|
|
31
|
+
success: false;
|
|
27
32
|
error: {
|
|
28
|
-
code:
|
|
33
|
+
code: string;
|
|
29
34
|
message: string;
|
|
30
35
|
details?: unknown;
|
|
31
36
|
};
|
|
37
|
+
responseCode: number;
|
|
32
38
|
}, {
|
|
39
|
+
message: string;
|
|
40
|
+
success: false;
|
|
33
41
|
error: {
|
|
34
|
-
code:
|
|
42
|
+
code: string;
|
|
35
43
|
message: string;
|
|
36
44
|
details?: unknown;
|
|
37
45
|
};
|
|
46
|
+
responseCode: number;
|
|
38
47
|
}>;
|
|
39
48
|
export type ApiError = z.infer<typeof apiErrorSchema>;
|
|
40
49
|
export declare function apiSuccessSchema<T extends z.ZodTypeAny>(data: T): z.ZodObject<{
|
|
50
|
+
success: z.ZodLiteral<true>;
|
|
41
51
|
data: T;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
45
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
-
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
47
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
-
}, z.ZodUnknown, "strip">>>;
|
|
52
|
+
responseCode: z.ZodNumber;
|
|
53
|
+
message: z.ZodString;
|
|
49
54
|
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
55
|
+
success: z.ZodLiteral<true>;
|
|
50
56
|
data: T;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
54
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
-
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
56
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
|
-
}, z.ZodUnknown, "strip">>>;
|
|
57
|
+
responseCode: z.ZodNumber;
|
|
58
|
+
message: z.ZodString;
|
|
58
59
|
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
|
|
60
|
+
success: z.ZodLiteral<true>;
|
|
59
61
|
data: T;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
63
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
64
|
-
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
65
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
|
-
}, z.ZodUnknown, "strip">>>;
|
|
62
|
+
responseCode: z.ZodNumber;
|
|
63
|
+
message: z.ZodString;
|
|
67
64
|
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
68
65
|
export type ApiSuccess<T> = {
|
|
66
|
+
success: true;
|
|
69
67
|
data: T;
|
|
70
|
-
|
|
68
|
+
responseCode: number;
|
|
69
|
+
message: string;
|
|
71
70
|
};
|
|
72
71
|
export type HttpMethod = "GET" | "POST" | "PATCH" | "DELETE";
|
|
73
72
|
export type RouteContract = {
|
|
@@ -75,4 +74,21 @@ export type RouteContract = {
|
|
|
75
74
|
path: `/api/v1/${string}`;
|
|
76
75
|
auth: "public" | "user" | "admin" | "signature";
|
|
77
76
|
};
|
|
77
|
+
/** Generic success envelope `{ data: T, meta? }` — admin-panel alias of apiSuccessSchema. */
|
|
78
|
+
export declare const successEnvelope: typeof apiSuccessSchema;
|
|
79
|
+
/** Untyped primitive schemas for ID fields and ISO date strings. */
|
|
80
|
+
export declare const idSchema: z.ZodString;
|
|
81
|
+
export declare const isoDateSchema: z.ZodString;
|
|
82
|
+
/** Named time-series point used in admin analytics charts. */
|
|
83
|
+
export declare const timePointSchema: z.ZodObject<{
|
|
84
|
+
date: z.ZodString;
|
|
85
|
+
value: z.ZodNumber;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
value: number;
|
|
88
|
+
date: string;
|
|
89
|
+
}, {
|
|
90
|
+
value: number;
|
|
91
|
+
date: string;
|
|
92
|
+
}>;
|
|
93
|
+
export type TimePoint = z.infer<typeof timePointSchema>;
|
|
78
94
|
//# sourceMappingURL=common.d.ts.map
|
package/dist/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe,+JAU1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,UAAU;;;;;;0BAIC,CAAC;AAEzB,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe,+JAU1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,UAAU;;;;;;0BAIC,CAAC;AAEzB,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;;;;;;;;;;;;;;;kEAO/D;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;IACR,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE7D,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,WAAW,MAAM,EAAE,CAAC;IAC1B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;CACjD,CAAC;AAMF,6FAA6F;AAC7F,eAAO,MAAM,eAAe,yBAAmB,CAAC;AAEhD,oEAAoE;AACpE,eAAO,MAAM,QAAQ,aAAoB,CAAC;AAC1C,eAAO,MAAM,aAAa,aAAa,CAAC;AAExC,8DAA8D;AAC9D,eAAO,MAAM,eAAe;;;;;;;;;EAAoD,CAAC;AACjF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/common.js
CHANGED
|
@@ -16,16 +16,31 @@ export const metaSchema = z
|
|
|
16
16
|
})
|
|
17
17
|
.catchall(z.unknown());
|
|
18
18
|
export const apiErrorSchema = z.object({
|
|
19
|
+
success: z.literal(false),
|
|
19
20
|
error: z.object({
|
|
20
|
-
code:
|
|
21
|
+
code: z.string(),
|
|
21
22
|
message: z.string(),
|
|
22
23
|
details: z.unknown().optional(),
|
|
23
24
|
}),
|
|
25
|
+
responseCode: z.number(),
|
|
26
|
+
message: z.string(),
|
|
24
27
|
});
|
|
25
28
|
export function apiSuccessSchema(data) {
|
|
26
29
|
return z.object({
|
|
30
|
+
success: z.literal(true),
|
|
27
31
|
data,
|
|
28
|
-
|
|
32
|
+
responseCode: z.number(),
|
|
33
|
+
message: z.string(),
|
|
29
34
|
});
|
|
30
35
|
}
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Utility aliases used by admin-panel consumers
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
/** Generic success envelope `{ data: T, meta? }` — admin-panel alias of apiSuccessSchema. */
|
|
40
|
+
export const successEnvelope = apiSuccessSchema;
|
|
41
|
+
/** Untyped primitive schemas for ID fields and ISO date strings. */
|
|
42
|
+
export const idSchema = z.string().min(1);
|
|
43
|
+
export const isoDateSchema = z.string();
|
|
44
|
+
/** Named time-series point used in admin analytics charts. */
|
|
45
|
+
export const timePointSchema = z.object({ date: z.string(), value: z.number() });
|
|
31
46
|
//# sourceMappingURL=common.js.map
|
package/dist/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,kBAAkB;IAClB,cAAc;IACd,WAAW;IACX,kBAAkB;IAClB,WAAW;IACX,UAAU;IACV,cAAc;IACd,gBAAgB;IAChB,gBAAgB;CACjB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,CAAC;IACN,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE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CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;QACxB,IAAI;QACJ,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;QACxB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC,CAAC;AACL,CAAC;AAiBD,8EAA8E;AAC9E,gDAAgD;AAChD,8EAA8E;AAE9E,6FAA6F;AAC7F,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAEhD,oEAAoE;AACpE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AAExC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/dist/users.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
34
34
|
id: string;
|
|
35
35
|
email: string;
|
|
36
36
|
name: string;
|
|
37
|
+
createdAt: Date;
|
|
37
38
|
goal: "lose" | "maintain" | "gain" | null;
|
|
38
39
|
sex: "male" | "female" | "prefer_not_to_say" | null;
|
|
39
40
|
age: number | null;
|
|
@@ -45,7 +46,7 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
45
46
|
targetProteinG: number | null;
|
|
46
47
|
targetCarbsG: number | null;
|
|
47
48
|
targetFatG: number | null;
|
|
48
|
-
activityLevel: "
|
|
49
|
+
activityLevel: "active" | "sedentary" | "light" | "moderate" | "very_active" | null;
|
|
49
50
|
manualDailyTargetKcal: number | null;
|
|
50
51
|
notifyTimes: string[] | null;
|
|
51
52
|
timezone: string | null;
|
|
@@ -54,11 +55,11 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
54
55
|
trialEndsAt: Date | null;
|
|
55
56
|
onboardingStep: number;
|
|
56
57
|
isOnboarded: boolean;
|
|
57
|
-
createdAt: Date;
|
|
58
58
|
}, {
|
|
59
59
|
id: string;
|
|
60
60
|
email: string;
|
|
61
61
|
name: string;
|
|
62
|
+
createdAt: Date;
|
|
62
63
|
goal: "lose" | "maintain" | "gain" | null;
|
|
63
64
|
sex: "male" | "female" | "prefer_not_to_say" | null;
|
|
64
65
|
age: number | null;
|
|
@@ -70,7 +71,7 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
70
71
|
targetProteinG: number | null;
|
|
71
72
|
targetCarbsG: number | null;
|
|
72
73
|
targetFatG: number | null;
|
|
73
|
-
activityLevel: "
|
|
74
|
+
activityLevel: "active" | "sedentary" | "light" | "moderate" | "very_active" | null;
|
|
74
75
|
manualDailyTargetKcal: number | null;
|
|
75
76
|
notifyTimes: string[] | null;
|
|
76
77
|
timezone: string | null;
|
|
@@ -79,10 +80,10 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
79
80
|
trialEndsAt: Date | null;
|
|
80
81
|
onboardingStep: number;
|
|
81
82
|
isOnboarded: boolean;
|
|
82
|
-
createdAt: Date;
|
|
83
83
|
}>;
|
|
84
84
|
export type UserProfile = z.infer<typeof userProfileSchema>;
|
|
85
85
|
export declare const getMeResponseSchema: z.ZodObject<{
|
|
86
|
+
success: z.ZodLiteral<true>;
|
|
86
87
|
data: z.ZodObject<{
|
|
87
88
|
id: z.ZodString;
|
|
88
89
|
email: z.ZodString;
|
|
@@ -112,6 +113,7 @@ export declare const getMeResponseSchema: z.ZodObject<{
|
|
|
112
113
|
id: string;
|
|
113
114
|
email: string;
|
|
114
115
|
name: string;
|
|
116
|
+
createdAt: Date;
|
|
115
117
|
goal: "lose" | "maintain" | "gain" | null;
|
|
116
118
|
sex: "male" | "female" | "prefer_not_to_say" | null;
|
|
117
119
|
age: number | null;
|
|
@@ -123,7 +125,7 @@ export declare const getMeResponseSchema: z.ZodObject<{
|
|
|
123
125
|
targetProteinG: number | null;
|
|
124
126
|
targetCarbsG: number | null;
|
|
125
127
|
targetFatG: number | null;
|
|
126
|
-
activityLevel: "
|
|
128
|
+
activityLevel: "active" | "sedentary" | "light" | "moderate" | "very_active" | null;
|
|
127
129
|
manualDailyTargetKcal: number | null;
|
|
128
130
|
notifyTimes: string[] | null;
|
|
129
131
|
timezone: string | null;
|
|
@@ -132,11 +134,11 @@ export declare const getMeResponseSchema: z.ZodObject<{
|
|
|
132
134
|
trialEndsAt: Date | null;
|
|
133
135
|
onboardingStep: number;
|
|
134
136
|
isOnboarded: boolean;
|
|
135
|
-
createdAt: Date;
|
|
136
137
|
}, {
|
|
137
138
|
id: string;
|
|
138
139
|
email: string;
|
|
139
140
|
name: string;
|
|
141
|
+
createdAt: Date;
|
|
140
142
|
goal: "lose" | "maintain" | "gain" | null;
|
|
141
143
|
sex: "male" | "female" | "prefer_not_to_say" | null;
|
|
142
144
|
age: number | null;
|
|
@@ -148,7 +150,7 @@ export declare const getMeResponseSchema: z.ZodObject<{
|
|
|
148
150
|
targetProteinG: number | null;
|
|
149
151
|
targetCarbsG: number | null;
|
|
150
152
|
targetFatG: number | null;
|
|
151
|
-
activityLevel: "
|
|
153
|
+
activityLevel: "active" | "sedentary" | "light" | "moderate" | "very_active" | null;
|
|
152
154
|
manualDailyTargetKcal: number | null;
|
|
153
155
|
notifyTimes: string[] | null;
|
|
154
156
|
timezone: string | null;
|
|
@@ -157,20 +159,18 @@ export declare const getMeResponseSchema: z.ZodObject<{
|
|
|
157
159
|
trialEndsAt: Date | null;
|
|
158
160
|
onboardingStep: number;
|
|
159
161
|
isOnboarded: boolean;
|
|
160
|
-
createdAt: Date;
|
|
161
162
|
}>;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
165
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
166
|
-
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
167
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
168
|
-
}, z.ZodUnknown, "strip">>>;
|
|
163
|
+
responseCode: z.ZodNumber;
|
|
164
|
+
message: z.ZodString;
|
|
169
165
|
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
message: string;
|
|
167
|
+
success: true;
|
|
168
|
+
responseCode: number;
|
|
170
169
|
data: {
|
|
171
170
|
id: string;
|
|
172
171
|
email: string;
|
|
173
172
|
name: string;
|
|
173
|
+
createdAt: Date;
|
|
174
174
|
goal: "lose" | "maintain" | "gain" | null;
|
|
175
175
|
sex: "male" | "female" | "prefer_not_to_say" | null;
|
|
176
176
|
age: number | null;
|
|
@@ -182,7 +182,7 @@ export declare const getMeResponseSchema: z.ZodObject<{
|
|
|
182
182
|
targetProteinG: number | null;
|
|
183
183
|
targetCarbsG: number | null;
|
|
184
184
|
targetFatG: number | null;
|
|
185
|
-
activityLevel: "
|
|
185
|
+
activityLevel: "active" | "sedentary" | "light" | "moderate" | "very_active" | null;
|
|
186
186
|
manualDailyTargetKcal: number | null;
|
|
187
187
|
notifyTimes: string[] | null;
|
|
188
188
|
timezone: string | null;
|
|
@@ -191,16 +191,16 @@ export declare const getMeResponseSchema: z.ZodObject<{
|
|
|
191
191
|
trialEndsAt: Date | null;
|
|
192
192
|
onboardingStep: number;
|
|
193
193
|
isOnboarded: boolean;
|
|
194
|
-
createdAt: Date;
|
|
195
194
|
};
|
|
196
|
-
meta?: z.objectOutputType<{
|
|
197
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
198
|
-
}, z.ZodUnknown, "strip"> | undefined;
|
|
199
195
|
}, {
|
|
196
|
+
message: string;
|
|
197
|
+
success: true;
|
|
198
|
+
responseCode: number;
|
|
200
199
|
data: {
|
|
201
200
|
id: string;
|
|
202
201
|
email: string;
|
|
203
202
|
name: string;
|
|
203
|
+
createdAt: Date;
|
|
204
204
|
goal: "lose" | "maintain" | "gain" | null;
|
|
205
205
|
sex: "male" | "female" | "prefer_not_to_say" | null;
|
|
206
206
|
age: number | null;
|
|
@@ -212,7 +212,7 @@ export declare const getMeResponseSchema: z.ZodObject<{
|
|
|
212
212
|
targetProteinG: number | null;
|
|
213
213
|
targetCarbsG: number | null;
|
|
214
214
|
targetFatG: number | null;
|
|
215
|
-
activityLevel: "
|
|
215
|
+
activityLevel: "active" | "sedentary" | "light" | "moderate" | "very_active" | null;
|
|
216
216
|
manualDailyTargetKcal: number | null;
|
|
217
217
|
notifyTimes: string[] | null;
|
|
218
218
|
timezone: string | null;
|
|
@@ -221,11 +221,7 @@ export declare const getMeResponseSchema: z.ZodObject<{
|
|
|
221
221
|
trialEndsAt: Date | null;
|
|
222
222
|
onboardingStep: number;
|
|
223
223
|
isOnboarded: boolean;
|
|
224
|
-
createdAt: Date;
|
|
225
224
|
};
|
|
226
|
-
meta?: z.objectInputType<{
|
|
227
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
228
|
-
}, z.ZodUnknown, "strip"> | undefined;
|
|
229
225
|
}>;
|
|
230
226
|
export type GetMeResponse = z.infer<typeof getMeResponseSchema>;
|
|
231
227
|
export declare const updateProfilePayloadSchema: z.ZodObject<{
|
|
@@ -248,7 +244,7 @@ export declare const updateProfilePayloadSchema: z.ZodObject<{
|
|
|
248
244
|
sex?: "male" | "female" | "prefer_not_to_say" | undefined;
|
|
249
245
|
heightCm?: number | undefined;
|
|
250
246
|
targetWeightKg?: number | undefined;
|
|
251
|
-
activityLevel?: "
|
|
247
|
+
activityLevel?: "active" | "sedentary" | "light" | "moderate" | "very_active" | undefined;
|
|
252
248
|
manualDailyTargetKcal?: number | undefined;
|
|
253
249
|
notifyTimes?: string[] | undefined;
|
|
254
250
|
timezone?: string | undefined;
|
|
@@ -263,7 +259,7 @@ export declare const updateProfilePayloadSchema: z.ZodObject<{
|
|
|
263
259
|
sex?: "male" | "female" | "prefer_not_to_say" | undefined;
|
|
264
260
|
heightCm?: number | undefined;
|
|
265
261
|
targetWeightKg?: number | undefined;
|
|
266
|
-
activityLevel?: "
|
|
262
|
+
activityLevel?: "active" | "sedentary" | "light" | "moderate" | "very_active" | undefined;
|
|
267
263
|
manualDailyTargetKcal?: number | undefined;
|
|
268
264
|
notifyTimes?: string[] | undefined;
|
|
269
265
|
timezone?: string | undefined;
|
|
@@ -276,6 +272,7 @@ export declare const updateProfilePayloadSchema: z.ZodObject<{
|
|
|
276
272
|
}>;
|
|
277
273
|
export type UpdateProfilePayload = z.infer<typeof updateProfilePayloadSchema>;
|
|
278
274
|
export declare const updateProfileResponseSchema: z.ZodObject<{
|
|
275
|
+
success: z.ZodLiteral<true>;
|
|
279
276
|
data: z.ZodObject<{
|
|
280
277
|
id: z.ZodString;
|
|
281
278
|
email: z.ZodString;
|
|
@@ -305,6 +302,7 @@ export declare const updateProfileResponseSchema: z.ZodObject<{
|
|
|
305
302
|
id: string;
|
|
306
303
|
email: string;
|
|
307
304
|
name: string;
|
|
305
|
+
createdAt: Date;
|
|
308
306
|
goal: "lose" | "maintain" | "gain" | null;
|
|
309
307
|
sex: "male" | "female" | "prefer_not_to_say" | null;
|
|
310
308
|
age: number | null;
|
|
@@ -316,7 +314,7 @@ export declare const updateProfileResponseSchema: z.ZodObject<{
|
|
|
316
314
|
targetProteinG: number | null;
|
|
317
315
|
targetCarbsG: number | null;
|
|
318
316
|
targetFatG: number | null;
|
|
319
|
-
activityLevel: "
|
|
317
|
+
activityLevel: "active" | "sedentary" | "light" | "moderate" | "very_active" | null;
|
|
320
318
|
manualDailyTargetKcal: number | null;
|
|
321
319
|
notifyTimes: string[] | null;
|
|
322
320
|
timezone: string | null;
|
|
@@ -325,11 +323,11 @@ export declare const updateProfileResponseSchema: z.ZodObject<{
|
|
|
325
323
|
trialEndsAt: Date | null;
|
|
326
324
|
onboardingStep: number;
|
|
327
325
|
isOnboarded: boolean;
|
|
328
|
-
createdAt: Date;
|
|
329
326
|
}, {
|
|
330
327
|
id: string;
|
|
331
328
|
email: string;
|
|
332
329
|
name: string;
|
|
330
|
+
createdAt: Date;
|
|
333
331
|
goal: "lose" | "maintain" | "gain" | null;
|
|
334
332
|
sex: "male" | "female" | "prefer_not_to_say" | null;
|
|
335
333
|
age: number | null;
|
|
@@ -341,7 +339,7 @@ export declare const updateProfileResponseSchema: z.ZodObject<{
|
|
|
341
339
|
targetProteinG: number | null;
|
|
342
340
|
targetCarbsG: number | null;
|
|
343
341
|
targetFatG: number | null;
|
|
344
|
-
activityLevel: "
|
|
342
|
+
activityLevel: "active" | "sedentary" | "light" | "moderate" | "very_active" | null;
|
|
345
343
|
manualDailyTargetKcal: number | null;
|
|
346
344
|
notifyTimes: string[] | null;
|
|
347
345
|
timezone: string | null;
|
|
@@ -350,20 +348,18 @@ export declare const updateProfileResponseSchema: z.ZodObject<{
|
|
|
350
348
|
trialEndsAt: Date | null;
|
|
351
349
|
onboardingStep: number;
|
|
352
350
|
isOnboarded: boolean;
|
|
353
|
-
createdAt: Date;
|
|
354
351
|
}>;
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
358
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
359
|
-
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
360
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
361
|
-
}, z.ZodUnknown, "strip">>>;
|
|
352
|
+
responseCode: z.ZodNumber;
|
|
353
|
+
message: z.ZodString;
|
|
362
354
|
}, "strip", z.ZodTypeAny, {
|
|
355
|
+
message: string;
|
|
356
|
+
success: true;
|
|
357
|
+
responseCode: number;
|
|
363
358
|
data: {
|
|
364
359
|
id: string;
|
|
365
360
|
email: string;
|
|
366
361
|
name: string;
|
|
362
|
+
createdAt: Date;
|
|
367
363
|
goal: "lose" | "maintain" | "gain" | null;
|
|
368
364
|
sex: "male" | "female" | "prefer_not_to_say" | null;
|
|
369
365
|
age: number | null;
|
|
@@ -375,7 +371,7 @@ export declare const updateProfileResponseSchema: z.ZodObject<{
|
|
|
375
371
|
targetProteinG: number | null;
|
|
376
372
|
targetCarbsG: number | null;
|
|
377
373
|
targetFatG: number | null;
|
|
378
|
-
activityLevel: "
|
|
374
|
+
activityLevel: "active" | "sedentary" | "light" | "moderate" | "very_active" | null;
|
|
379
375
|
manualDailyTargetKcal: number | null;
|
|
380
376
|
notifyTimes: string[] | null;
|
|
381
377
|
timezone: string | null;
|
|
@@ -384,16 +380,16 @@ export declare const updateProfileResponseSchema: z.ZodObject<{
|
|
|
384
380
|
trialEndsAt: Date | null;
|
|
385
381
|
onboardingStep: number;
|
|
386
382
|
isOnboarded: boolean;
|
|
387
|
-
createdAt: Date;
|
|
388
383
|
};
|
|
389
|
-
meta?: z.objectOutputType<{
|
|
390
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
391
|
-
}, z.ZodUnknown, "strip"> | undefined;
|
|
392
384
|
}, {
|
|
385
|
+
message: string;
|
|
386
|
+
success: true;
|
|
387
|
+
responseCode: number;
|
|
393
388
|
data: {
|
|
394
389
|
id: string;
|
|
395
390
|
email: string;
|
|
396
391
|
name: string;
|
|
392
|
+
createdAt: Date;
|
|
397
393
|
goal: "lose" | "maintain" | "gain" | null;
|
|
398
394
|
sex: "male" | "female" | "prefer_not_to_say" | null;
|
|
399
395
|
age: number | null;
|
|
@@ -405,7 +401,7 @@ export declare const updateProfileResponseSchema: z.ZodObject<{
|
|
|
405
401
|
targetProteinG: number | null;
|
|
406
402
|
targetCarbsG: number | null;
|
|
407
403
|
targetFatG: number | null;
|
|
408
|
-
activityLevel: "
|
|
404
|
+
activityLevel: "active" | "sedentary" | "light" | "moderate" | "very_active" | null;
|
|
409
405
|
manualDailyTargetKcal: number | null;
|
|
410
406
|
notifyTimes: string[] | null;
|
|
411
407
|
timezone: string | null;
|
|
@@ -414,11 +410,7 @@ export declare const updateProfileResponseSchema: z.ZodObject<{
|
|
|
414
410
|
trialEndsAt: Date | null;
|
|
415
411
|
onboardingStep: number;
|
|
416
412
|
isOnboarded: boolean;
|
|
417
|
-
createdAt: Date;
|
|
418
413
|
};
|
|
419
|
-
meta?: z.objectInputType<{
|
|
420
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
421
|
-
}, z.ZodUnknown, "strip"> | undefined;
|
|
422
414
|
}>;
|
|
423
415
|
export declare const deleteMeResponseSchema: z.ZodNull;
|
|
424
416
|
export declare const userRoutes: {
|
package/dist/users.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../src/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,UAAU,yCAAuC,C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,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC;AAE/E,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAE/C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;CAgBkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beorchid-llc/thrivo-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Shared Thrivo API request and response contracts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -19,6 +19,14 @@
|
|
|
19
19
|
"./users": {
|
|
20
20
|
"types": "./dist/users.d.ts",
|
|
21
21
|
"import": "./dist/users.js"
|
|
22
|
+
},
|
|
23
|
+
"./auth": {
|
|
24
|
+
"types": "./dist/auth.d.ts",
|
|
25
|
+
"import": "./dist/auth.js"
|
|
26
|
+
},
|
|
27
|
+
"./admin": {
|
|
28
|
+
"types": "./dist/admin.d.ts",
|
|
29
|
+
"import": "./dist/admin.js"
|
|
22
30
|
}
|
|
23
31
|
},
|
|
24
32
|
"files": [
|