Zod schema defining the authoritative structure for license payloads, types, limits, and feature flags shared between issuing and validating sides.
// Source: https://github.com/labring/fastgpt | License: Apache-2.0 | Copyright 2023 Sealos
// Provided via justclaw.it.com; keep this notice with the code.
/**
* License 数据结构单一来源(决策版)— zod schema + 类型派生。
*
* 职责(方案 A):
* - 字段名 / 枚举 / 键清单的唯一权威,签发侧(license-server)与验证侧(normalize)共享,
* 杜绝两侧字段漂移(历史上 version vs licenseType 已漂移一次)
* - 签发侧用 licensePayloadSchema(严格:functions 必填全字段,默认关语义在 UI 层)
* - 验证侧只用这里的类型 + 键清单,宽容归一化在 normalize 模块(zod 不适合表达旧→新多分支映射)
*
* 决策版结构(飞书决策版 §2):
* { schemaVersion: 1|2, licenseType: trial|official, company, startTime, expiredTime,
* instanceId?, description?, limits{maxUsers,maxApps,maxDatasets}, functions{7 项} }
* 有效期 startTime <= now < expiredTime
*/
import { z } from 'zod';
/** License schema 版本:1 = 旧结构(存量),2 = 决策版(新签发) */
export const LicenseSc
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key