feat: allow secret workbench resources
This commit is contained in:
parent
f4f79cf1d0
commit
e2d07145d6
|
|
@ -181,7 +181,7 @@ export interface ContributionStatusBarItem {
|
||||||
position?: 'left' | 'right';
|
position?: 'left' | 'right';
|
||||||
handler?: string;
|
handler?: string;
|
||||||
}
|
}
|
||||||
export type OpenResourceKind = 'vault-file';
|
export type OpenResourceKind = 'vault-file' | 'secret';
|
||||||
export type OpenResourceMode = 'view' | 'edit';
|
export type OpenResourceMode = 'view' | 'edit';
|
||||||
export type OpenResourceContextName = 'generic-text' | 'generic-markdown' | 'notes-markdown' | string;
|
export type OpenResourceContextName = 'generic-text' | 'generic-markdown' | 'notes-markdown' | string;
|
||||||
export interface OpenProviderSupport {
|
export interface OpenProviderSupport {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -380,7 +380,7 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"kind": {
|
"kind": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["vault-file"]
|
"enum": ["vault-file", "secret"]
|
||||||
},
|
},
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import capabilitiesSchema from '../schemas/capabilities.json';
|
||||||
import manifestSchema from '../schemas/manifest.json';
|
import manifestSchema from '../schemas/manifest.json';
|
||||||
import permissionsSchema from '../schemas/permissions.json';
|
import permissionsSchema from '../schemas/permissions.json';
|
||||||
import vaultEventsSchema from '../schemas/events/vault.json';
|
import vaultEventsSchema from '../schemas/events/vault.json';
|
||||||
import type { OpenResourceRequest, PluginManifest } from './types';
|
import type { OpenProviderSupport, OpenResourceRequest, PluginManifest } from './types';
|
||||||
import { createMockPluginAPI } from './test-utils';
|
import { createMockPluginAPI } from './test-utils';
|
||||||
|
|
||||||
describe('VerstakPluginAPI contract', () => {
|
describe('VerstakPluginAPI contract', () => {
|
||||||
|
|
@ -152,6 +152,18 @@ describe('VerstakPluginAPI contract', () => {
|
||||||
expect(manifest.contributes?.openProviders?.[0].supports[1].contexts).toContain('generic-text');
|
expect(manifest.contributes?.openProviders?.[0].supports[1].contexts).toContain('generic-text');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('secret links are valid workbench open-provider resources', () => {
|
||||||
|
const supportSchema = (manifestSchema as any).$defs.OpenProviderSupport;
|
||||||
|
expect(supportSchema.properties.kind.enum).toEqual(expect.arrayContaining(['vault-file', 'secret']));
|
||||||
|
|
||||||
|
const support: OpenProviderSupport = {
|
||||||
|
kind: 'secret',
|
||||||
|
modes: ['view'],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(support.kind).toBe('secret');
|
||||||
|
});
|
||||||
|
|
||||||
test('OpenResourceRequest and no-provider result shape are typed', () => {
|
test('OpenResourceRequest and no-provider result shape are typed', () => {
|
||||||
const request: OpenResourceRequest = {
|
const request: OpenResourceRequest = {
|
||||||
kind: 'vault-file',
|
kind: 'vault-file',
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ export interface ContributionStatusBarItem {
|
||||||
handler?: string;
|
handler?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type OpenResourceKind = 'vault-file';
|
export type OpenResourceKind = 'vault-file' | 'secret';
|
||||||
export type OpenResourceMode = 'view' | 'edit';
|
export type OpenResourceMode = 'view' | 'edit';
|
||||||
export type OpenResourceContextName = 'generic-text' | 'generic-markdown' | 'notes-markdown' | string;
|
export type OpenResourceContextName = 'generic-text' | 'generic-markdown' | 'notes-markdown' | string;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue