Huakun 48e2e47f96
Remove supabase (#263)
* remove supabase package

* upgrade valibot

* removed supabase package

Migration not complete yet

* update submodule

* fixed some supabase errors

* Add new fields to extension models

- Added `id` field to `ExtPublish`
- Expanded `DBExtension` with multiple new properties:
  - `api_version`, `author_id`, `created_at`,
  - `downloads`, `icon`, `identifier`,
  - `long_description`, `name`,
  - `readme`, `short_description`,
  - and `tarball_size`

* Refactor: clean up unused Supabase imports

- Removed commented-out Supabase imports from various files to streamline the codebase.
- Updated `created_at` type in `ExtPublish` model from `date` to `string` for consistency.

* update icon enum to union

* fix type errors after removing supabase

* format

* more types fixed

* feat: enhance command handling and update SDK version
2025-03-26 08:50:55 -04:00

57 lines
1.5 KiB
TypeScript

import * as v from "valibot"
import { NodeName, NodeNameEnum } from "./constants"
/* -------------------------------------------------------------------------- */
/* Icon */
/* -------------------------------------------------------------------------- */
// export enum IconEnum {
// Iconify = "iconify",
// RemoteUrl = "remote-url",
// Svg = "svg",
// Base64PNG = "base64-png",
// Text = "text"
// }
export const IconEnum = {
Iconify: "iconify",
RemoteUrl: "remote-url",
Svg: "svg",
Base64PNG: "base64-png",
Text: "text"
}
export const IconType = v.picklist(Object.values(IconEnum))
export type IconType = v.InferOutput<typeof IconType>
export type Icon = {
type: IconType
value: string
invert?: boolean
darkInvert?: boolean
hexColor?: string
bgColor?: string
fallback?: Icon
}
export const BaseIcon = v.object({
type: IconType,
value: v.string(),
invert: v.optional(v.boolean()),
darkInvert: v.optional(v.boolean()),
hexColor: v.optional(v.string()),
bgColor: v.optional(v.string())
// hexColor: v.optional(v.pipe(v.string(), v.hexColor("The hex color is badly formatted."))),
// bgColor: v.optional(v.pipe(v.string(), v.hexColor("The hex color is badly formatted.")))
})
export const Icon: v.GenericSchema<Icon> = v.object({
...BaseIcon.entries,
fallback: v.optional(v.lazy(() => Icon))
})
export const IconNode = v.object({
...BaseIcon.entries,
nodeName: NodeName,
fallback: v.optional(v.lazy(() => Icon))
})
export type IconNode = v.InferOutput<typeof IconNode>