@mochabug/adapt-plugin-toolkit
Version:
The API toolkit to facilitate mochabug adapt plugin development
241 lines • 8.62 kB
TypeScript
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
import type { GroupedDefinition, GroupedDefinitionJson, OneOfDefinition, OneOfDefinitionJson } from "./compound_services_pb";
import type { HttpProxyDefinition, HttpProxyDefinitionJson } from "./http_proxy_service_pb";
import type { Oauth2Definition, Oauth2DefinitionJson } from "./oauth2_service_pb";
import type { VariableDefinition, VariableDefinitionJson } from "./variable_service_pb";
import type { Message } from "@bufbuild/protobuf";
/**
* Describes the file mochabugapis/adapt/plugins/v1/service_definition.proto.
*/
export declare const file_mochabugapis_adapt_plugins_v1_service_definition: GenFile;
/**
* The service definition - a flat declaration of a service that can be referenced by bindings.
*
* ## Architecture Principle: Service Definitions Are Always Flat
*
* Service definitions exist ONLY at the Manifest.service_definitions level and are NEVER nested.
* Each definition has a unique name and a specific type (Variable, OAuth2, HTTP Proxy, Group, OneOf).
*
* ## Referencing from Service Lists
*
* Service lists (Manifest.system_services and Vertex.user_services) are string arrays that
* directly reference service definitions by name. Each string must match a ServiceDefinition's `name`.
*
* ## Service Types
*
* - **VariableDefinition**: JSON variable with schema validation
* - **Oauth2Definition**: OAuth2 authentication (various grant types)
* - **HttpProxyDefinition**: HTTP proxy with TLS and header injection
* - **GroupedDefinition**: References multiple other flat definitions as a group
* - **OneOfDefinition**: Allows user to choose one from multiple flat definitions
*
* ## Example
*
* ```protobuf
* // In Manifest.service_definitions
* [
* { name: "api_key", variable: { schema: {...} } },
* { name: "oauth", oauth2: { grant_type: AUTHORIZATION_CODE, ... } },
* { name: "proxy", http_proxy: { allowed_hosts: [...], ... } }
* ]
*
* // Referenced in service lists (strings matching service definition names)
* system_services: ["oauth"]
* ```
*
* @generated from message mochabugapis.adapt.plugins.v1.ServiceDefinition
*/
export type ServiceDefinition = Message<"mochabugapis.adapt.plugins.v1.ServiceDefinition"> & {
/**
* 'name' is the identifier of the service, referenced in code
*
* @generated from field: string name = 1;
*/
name: string;
/**
* 'label' is a human-friendly label shown in the UI
*
* @generated from field: string label = 2;
*/
label: string;
/**
* 'description' is an optional detailed description of the service
*
* @generated from field: optional string description = 3;
*/
description?: string;
/**
* Whether this service is optional.
*
* If false (default):
* - User MUST configure this service during installation
* - Plugin can safely assume the service exists
*
* If true:
* - User MAY skip configuring this service
* - Plugin must handle the service being absent
* - Useful for optional features (analytics, monitoring, etc.)
*
* @generated from field: optional bool optional = 4;
*/
optional?: boolean;
/**
* The actual type of service that the definition is
*
* @generated from oneof mochabugapis.adapt.plugins.v1.ServiceDefinition.type
*/
type: {
/**
* Variable service containing arbitrary JSON
*
* @generated from field: mochabugapis.adapt.plugins.v1.VariableDefinition variable = 5;
*/
value: VariableDefinition;
case: "variable";
} | {
/**
* An OAuth2 service
*
* @generated from field: mochabugapis.adapt.plugins.v1.Oauth2Definition oauth2 = 6;
*/
value: Oauth2Definition;
case: "oauth2";
} | {
/**
* HTTP proxy service with TLS and header injection
*
* @generated from field: mochabugapis.adapt.plugins.v1.HttpProxyDefinition http_proxy = 7;
*/
value: HttpProxyDefinition;
case: "httpProxy";
} | {
/**
* A group definition, requiring it to be submitted as a group
*
* @generated from field: mochabugapis.adapt.plugins.v1.GroupedDefinition group = 8;
*/
value: GroupedDefinition;
case: "group";
} | {
/**
* A oneof definition, allowing one of several sub-definitions to be chosen
*
* @generated from field: mochabugapis.adapt.plugins.v1.OneOfDefinition oneof = 9;
*/
value: OneOfDefinition;
case: "oneof";
} | {
case: undefined;
value?: undefined;
};
};
/**
* The service definition - a flat declaration of a service that can be referenced by bindings.
*
* ## Architecture Principle: Service Definitions Are Always Flat
*
* Service definitions exist ONLY at the Manifest.service_definitions level and are NEVER nested.
* Each definition has a unique name and a specific type (Variable, OAuth2, HTTP Proxy, Group, OneOf).
*
* ## Referencing from Service Lists
*
* Service lists (Manifest.system_services and Vertex.user_services) are string arrays that
* directly reference service definitions by name. Each string must match a ServiceDefinition's `name`.
*
* ## Service Types
*
* - **VariableDefinition**: JSON variable with schema validation
* - **Oauth2Definition**: OAuth2 authentication (various grant types)
* - **HttpProxyDefinition**: HTTP proxy with TLS and header injection
* - **GroupedDefinition**: References multiple other flat definitions as a group
* - **OneOfDefinition**: Allows user to choose one from multiple flat definitions
*
* ## Example
*
* ```protobuf
* // In Manifest.service_definitions
* [
* { name: "api_key", variable: { schema: {...} } },
* { name: "oauth", oauth2: { grant_type: AUTHORIZATION_CODE, ... } },
* { name: "proxy", http_proxy: { allowed_hosts: [...], ... } }
* ]
*
* // Referenced in service lists (strings matching service definition names)
* system_services: ["oauth"]
* ```
*
* @generated from message mochabugapis.adapt.plugins.v1.ServiceDefinition
*/
export type ServiceDefinitionJson = {
/**
* 'name' is the identifier of the service, referenced in code
*
* @generated from field: string name = 1;
*/
name?: string;
/**
* 'label' is a human-friendly label shown in the UI
*
* @generated from field: string label = 2;
*/
label?: string;
/**
* 'description' is an optional detailed description of the service
*
* @generated from field: optional string description = 3;
*/
description?: string;
/**
* Whether this service is optional.
*
* If false (default):
* - User MUST configure this service during installation
* - Plugin can safely assume the service exists
*
* If true:
* - User MAY skip configuring this service
* - Plugin must handle the service being absent
* - Useful for optional features (analytics, monitoring, etc.)
*
* @generated from field: optional bool optional = 4;
*/
optional?: boolean;
/**
* Variable service containing arbitrary JSON
*
* @generated from field: mochabugapis.adapt.plugins.v1.VariableDefinition variable = 5;
*/
variable?: VariableDefinitionJson;
/**
* An OAuth2 service
*
* @generated from field: mochabugapis.adapt.plugins.v1.Oauth2Definition oauth2 = 6;
*/
oauth2?: Oauth2DefinitionJson;
/**
* HTTP proxy service with TLS and header injection
*
* @generated from field: mochabugapis.adapt.plugins.v1.HttpProxyDefinition http_proxy = 7;
*/
httpProxy?: HttpProxyDefinitionJson;
/**
* A group definition, requiring it to be submitted as a group
*
* @generated from field: mochabugapis.adapt.plugins.v1.GroupedDefinition group = 8;
*/
group?: GroupedDefinitionJson;
/**
* A oneof definition, allowing one of several sub-definitions to be chosen
*
* @generated from field: mochabugapis.adapt.plugins.v1.OneOfDefinition oneof = 9;
*/
oneof?: OneOfDefinitionJson;
};
/**
* Describes the message mochabugapis.adapt.plugins.v1.ServiceDefinition.
* Use `create(ServiceDefinitionSchema)` to create a new message.
*/
export declare const ServiceDefinitionSchema: GenMessage<ServiceDefinition, {
jsonType: ServiceDefinitionJson;
}>;
//# sourceMappingURL=service_definition_pb.d.ts.map