feat: also emit dxt signature info schema (#44)
This commit is contained in:
parent
9ce2d6fd0e
commit
2654e313b9
3 changed files with 30 additions and 18 deletions
|
|
@ -1,14 +1,23 @@
|
|||
import { DxtManifestSchema } from "../src/schemas.ts";
|
||||
import { DxtManifestSchema, DxtSignatureInfoSchema } from "../src/schemas.ts";
|
||||
import * as z from "zod/v4";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const schema = z.toJSONSchema(DxtManifestSchema);
|
||||
const schemasToWrite = {
|
||||
'dxt-manifest': DxtManifestSchema,
|
||||
'dxt-signature-info': DxtSignatureInfoSchema
|
||||
}
|
||||
|
||||
await fs.mkdir(path.join(import.meta.dirname, "../dist"), { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(import.meta.dirname, "../dist", "dxt-manifest.schema.json"),
|
||||
JSON.stringify(schema, null, 2),
|
||||
{
|
||||
encoding: "utf8",
|
||||
},
|
||||
);
|
||||
|
||||
for (const key in schemasToWrite) {
|
||||
const schema = z.toJSONSchema(schemasToWrite[key]);
|
||||
await fs.writeFile(
|
||||
path.join(import.meta.dirname, "../dist", `${key}.schema.json`),
|
||||
JSON.stringify(schema, null, 2),
|
||||
{
|
||||
encoding: "utf8",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export const DxtUserConfigurationOptionSchema = z.object({
|
|||
|
||||
export const DxtUserConfigValuesSchema = z.record(
|
||||
z.string(),
|
||||
z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]),
|
||||
z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])
|
||||
);
|
||||
|
||||
export const DxtManifestSchema = z.object({
|
||||
|
|
@ -103,3 +103,12 @@ export const DxtManifestSchema = z.object({
|
|||
.record(z.string(), DxtUserConfigurationOptionSchema)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const DxtSignatureInfoSchema = z.object({
|
||||
status: z.enum(["signed", "unsigned", "self-signed"]),
|
||||
publisher: z.string().optional(),
|
||||
issuer: z.string().optional(),
|
||||
valid_from: z.string().optional(),
|
||||
valid_to: z.string().optional(),
|
||||
fingerprint: z.string().optional(),
|
||||
});
|
||||
|
|
|
|||
10
src/types.ts
10
src/types.ts
|
|
@ -10,6 +10,7 @@ import type {
|
|||
DxtManifestSchema,
|
||||
DxtManifestServerSchema,
|
||||
DxtManifestToolSchema,
|
||||
DxtSignatureInfoSchema,
|
||||
DxtUserConfigurationOptionSchema,
|
||||
DxtUserConfigValuesSchema,
|
||||
McpServerConfigSchema,
|
||||
|
|
@ -48,14 +49,7 @@ export type DxtManifest = z.infer<typeof DxtManifestSchema>;
|
|||
/**
|
||||
* Information about a DXT package signature
|
||||
*/
|
||||
export interface DxtSignatureInfo {
|
||||
status: "signed" | "unsigned" | "self-signed";
|
||||
publisher?: string;
|
||||
issuer?: string;
|
||||
valid_from?: string;
|
||||
valid_to?: string;
|
||||
fingerprint?: string;
|
||||
}
|
||||
export type DxtSignatureInfo = z.infer<typeof DxtSignatureInfoSchema>;
|
||||
|
||||
export interface Logger {
|
||||
log: (...args: unknown[]) => void;
|
||||
|
|
|
|||
Loading…
Reference in a new issue