Spaces:
Sleeping
Sleeping
File size: 844 Bytes
cb43fbd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import { z } from 'zod';
/**
* User-settings API contract — per-user key/value preferences under
* /api/settings (get all, upsert one, bulk upsert).
*
* Values are intentionally untyped (settings hold strings, numbers, booleans
* and small objects). A masked value of '••••••••' on a single upsert is a
* no-op sentinel (the client echoes the masked secret back unchanged).
*/
export const MASKED_SETTING_VALUE = '••••••••';
export const settingUpsertRequestSchema = z.object({
key: z.string().min(1),
value: z.unknown().optional(),
});
export type SettingUpsertRequest = z.infer<typeof settingUpsertRequestSchema>;
export const settingsBulkRequestSchema = z.object({
settings: z.record(z.string(), z.unknown()),
});
export type SettingsBulkRequest = z.infer<typeof settingsBulkRequestSchema>;
|