feat: complete TASK-WP4-03 text templates
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { Type, type Static } from "@sinclair/typebox";
|
||||
|
||||
const stableResourcePattern = "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,119}$";
|
||||
|
||||
export const RecentAssetKindSchema = Type.Union(
|
||||
[Type.Literal("static_sticker"), Type.Literal("text_template")],
|
||||
{ $id: "RecentAssetKind" },
|
||||
);
|
||||
|
||||
export const RecentAssetItemSchema = Type.Object(
|
||||
{
|
||||
asset_id: Type.String({ maxLength: 120, pattern: stableResourcePattern }),
|
||||
asset_kind: Type.Ref(RecentAssetKindSchema),
|
||||
resource_version: Type.String({ maxLength: 120, pattern: stableResourcePattern }),
|
||||
},
|
||||
{ additionalProperties: false, $id: "RecentAssetItem" },
|
||||
);
|
||||
|
||||
export const RecentAssetQuerySchema = Type.Object(
|
||||
{ asset_kind: Type.Ref(RecentAssetKindSchema) },
|
||||
{ additionalProperties: false, $id: "RecentAssetQuery" },
|
||||
);
|
||||
|
||||
export const RecentAssetListResponseSchema = Type.Object(
|
||||
{ items: Type.Array(Type.Ref(RecentAssetItemSchema), { maxItems: 12 }) },
|
||||
{ additionalProperties: false, $id: "RecentAssetListResponse" },
|
||||
);
|
||||
|
||||
export const RecentAssetRecordRequestSchema = Type.Object(
|
||||
{
|
||||
asset_id: Type.String({ maxLength: 120, pattern: stableResourcePattern }),
|
||||
asset_kind: Type.Ref(RecentAssetKindSchema),
|
||||
resource_version: Type.String({ maxLength: 120, pattern: stableResourcePattern }),
|
||||
},
|
||||
{ additionalProperties: false, $id: "RecentAssetRecordRequest" },
|
||||
);
|
||||
|
||||
export const RecentAssetRecordResponseSchema = Type.Object(
|
||||
{ status: Type.Literal("recorded") },
|
||||
{ additionalProperties: false, $id: "RecentAssetRecordResponse" },
|
||||
);
|
||||
|
||||
export type RecentAssetQuery = Static<typeof RecentAssetQuerySchema>;
|
||||
export type RecentAssetRecordRequest = Static<typeof RecentAssetRecordRequestSchema>;
|
||||
@@ -1,5 +1,6 @@
|
||||
export { Type } from "@sinclair/typebox";
|
||||
export * from "./api.js";
|
||||
export * from "./assets.js";
|
||||
export * from "./auth.js";
|
||||
export * from "./bootstrap.js";
|
||||
export * from "./canvas.js";
|
||||
|
||||
Reference in New Issue
Block a user