import type { GenericId as ConvexGenericId } from "convex/values"; import type { Option } from "effect"; import * as Schema from "effect/Schema"; import * as SchemaAST from "effect/SchemaAST"; const ConvexId = Symbol.for("ConvexId"); export const GenericId = ( tableName: TableName, ): Schema.Schema> => Schema.String.pipe( Schema.annotations({ [ConvexId]: tableName }), ) as unknown as Schema.Schema>; export type GenericId = ConvexGenericId; export const tableName = ( ast: SchemaAST.AST, ): Option.Option => SchemaAST.getAnnotation(ConvexId)(ast);