feat(plugins): add connection authentication and importer providers

This commit is contained in:
ryan-wong-coder committed 2026-07-26 00:39:28 +08:00
1 parent 5e5c98a682
commit 04a1c0c45e
87 files changed
+7648 -69

No files matched your search

+10 -2
View File
@@ -94,7 +94,7 @@ function settingPatternError(source: string): string | null {
return null;
}
function restrictedSettingSchemaErrors(root: unknown): string[] {
function restrictedSettingSchemaErrors(root: unknown, rootType: "array" | null = "array"): string[] {
const errors: string[] = [];
const stack: Array<{ schema: unknown; depth: number }> = [{ schema: root, depth: 0 }];
let nodes = 0;
@@ -116,7 +116,9 @@ function restrictedSettingSchemaErrors(root: unknown): string[] {
if (!RESTRICTED_SCHEMA_TYPES.has(schema.type as string)) {
errors.push("every valueSchema node must declare one supported type");
}
if (current.depth === 0 && schema.type !== "array") errors.push("valueSchema root must use type array");
if (current.depth === 0 && rootType && schema.type !== rootType) {
errors.push(`valueSchema root must use type ${rootType}`);
}
if (schema.type === "array") {
if (!plainRecord(schema.items)) errors.push("array valueSchema nodes require one items schema");
else stack.push({ schema: schema.items, depth: current.depth + 1 });
@@ -473,6 +475,12 @@ function validateSemantics(manifest: PluginManifest): string[] {
errors.push(`Provider ${provider.id} requires a Node utility entrypoint`);
}
}
if (provider.configurationSchema !== undefined) {
const schemaErrors = restrictedSettingSchemaErrors(provider.configurationSchema, null);
for (const error of schemaErrors) {
errors.push(`Provider ${provider.id} configurationSchema ${error}`);
}
}
}
for (const companion of manifest.companionExecutables ?? []) {
for (const permission of companion.permissions ?? []) {