@mochabug/adapt-plugin-toolkit
Version:
The API toolkit to facilitate mochabug adapt plugin development
539 lines • 19.4 kB
TypeScript
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
import type { HttpProxyConfig, HttpProxyConfigJson } from "./http_proxy_service_pb";
import type { Oauth2Config, Oauth2ConfigJson } from "./oauth2_service_pb";
import type { Message } from "@bufbuild/protobuf";
/**
* Describes the file mochabugapis/adapt/plugins/v1/service_settings.proto.
*/
export declare const file_mochabugapis_adapt_plugins_v1_service_settings: GenFile;
/**
* Configuration for a one-of service that records which option was selected
* and provides the configuration for that option.
*
* This message captures the user's choice and the corresponding configuration
* values for the selected option (either a service definition or group).
*
* ## Relationship to OneOfDefinition
*
* - OneOfDefinition: Defines the available options (part of the plugin definition)
* - OneOfConfig: Records the user's selection and configuration (runtime state)
*
* ## Examples
*
* Example 1: User selected OAuth2 service
* OneOfConfig {
* selected: "google_oauth",
* value: {
* name: "google_oauth",
* configured: true,
* oauth2: { /* Oauth2Config with tokens *\/ }
* }
* }
*
* Example 2: User selected HTTP proxy service
* OneOfConfig {
* selected: "stripe",
* value: {
* name: "stripe",
* configured: true,
* http_proxy: { /* HttpProxyConfig with TLS and headers *\/ }
* }
* }
*
* Example 3: User selected variable service
* OneOfConfig {
* selected: "api_key",
* value: {
* name: "api_key",
* configured: true,
* variable: "sk_live_abc123..."
* }
* }
*
* Example 4: User selected group service
* OneOfConfig {
* selected: "stripe_environments",
* value: {
* name: "stripe_environments",
* configured: true,
* group: { /* GroupConfig with multiple service configurations *\/ }
* }
* }
*
* @generated from message mochabugapis.adapt.plugins.v1.OneOfConfig
*/
export type OneOfConfig = Message<"mochabugapis.adapt.plugins.v1.OneOfConfig"> & {
/**
* The name of the selected service definition.
*
* This must match one of the service definition names from OneOfDefinition.options
* and should also match the value.name field of the ServiceSettings.
*
* If not set, the service has not been configured (only valid if the service definition is optional).
*
* @generated from field: optional string selected = 3;
*/
selected?: string;
/**
* The ServiceSettings configuration for the selected option.
*
* This contains the actual configuration values for the selected service.
* The name field in this ServiceSettings should match the `selected` field above.
*
* @generated from field: mochabugapis.adapt.plugins.v1.ServiceSettings value = 4;
*/
value?: ServiceSettings;
};
/**
* Configuration for a one-of service that records which option was selected
* and provides the configuration for that option.
*
* This message captures the user's choice and the corresponding configuration
* values for the selected option (either a service definition or group).
*
* ## Relationship to OneOfDefinition
*
* - OneOfDefinition: Defines the available options (part of the plugin definition)
* - OneOfConfig: Records the user's selection and configuration (runtime state)
*
* ## Examples
*
* Example 1: User selected OAuth2 service
* OneOfConfig {
* selected: "google_oauth",
* value: {
* name: "google_oauth",
* configured: true,
* oauth2: { /* Oauth2Config with tokens *\/ }
* }
* }
*
* Example 2: User selected HTTP proxy service
* OneOfConfig {
* selected: "stripe",
* value: {
* name: "stripe",
* configured: true,
* http_proxy: { /* HttpProxyConfig with TLS and headers *\/ }
* }
* }
*
* Example 3: User selected variable service
* OneOfConfig {
* selected: "api_key",
* value: {
* name: "api_key",
* configured: true,
* variable: "sk_live_abc123..."
* }
* }
*
* Example 4: User selected group service
* OneOfConfig {
* selected: "stripe_environments",
* value: {
* name: "stripe_environments",
* configured: true,
* group: { /* GroupConfig with multiple service configurations *\/ }
* }
* }
*
* @generated from message mochabugapis.adapt.plugins.v1.OneOfConfig
*/
export type OneOfConfigJson = {
/**
* The name of the selected service definition.
*
* This must match one of the service definition names from OneOfDefinition.options
* and should also match the value.name field of the ServiceSettings.
*
* If not set, the service has not been configured (only valid if the service definition is optional).
*
* @generated from field: optional string selected = 3;
*/
selected?: string;
/**
* The ServiceSettings configuration for the selected option.
*
* This contains the actual configuration values for the selected service.
* The name field in this ServiceSettings should match the `selected` field above.
*
* @generated from field: mochabugapis.adapt.plugins.v1.ServiceSettings value = 4;
*/
value?: ServiceSettingsJson;
};
/**
* Describes the message mochabugapis.adapt.plugins.v1.OneOfConfig.
* Use `create(OneOfConfigSchema)` to create a new message.
*/
export declare const OneOfConfigSchema: GenMessage<OneOfConfig, {
jsonType: OneOfConfigJson;
}>;
/**
* Runtime configuration for a grouped service - contains the actual values for all members.
*
* ## Purpose
*
* GroupConfig holds the runtime configuration values for a GroupedDefinition.
* While GroupedDefinition declares which services belong to the group,
* GroupConfig contains the actual configured values for each member service.
*
* ## Relationship to GroupedDefinition
*
* - GroupedDefinition: Declares the group structure (in plugin manifest)
* - GroupConfig: Contains the runtime values for each member
*
* ## Examples
*
* Example: Stripe environments group with production and sandbox
* GroupedDefinition {
* name: "stripe_envs",
* services: ["stripe_prod", "stripe_sandbox"]
* }
*
* GroupConfig {
* members: [
* {
* name: "stripe_prod",
* configured: true,
* oauth2: { /* production OAuth2 tokens *\/ }
* },
* {
* name: "stripe_sandbox",
* configured: true,
* oauth2: { /* sandbox OAuth2 tokens *\/ }
* }
* ]
* }
*
* ## Accessing Members in Plugin Code
*
* Plugin code accesses group members using dot notation:
* - "stripe_envs.stripe_prod" for production environment
* - "stripe_envs.stripe_sandbox" for sandbox environment
*
* @generated from message mochabugapis.adapt.plugins.v1.GroupConfig
*/
export type GroupConfig = Message<"mochabugapis.adapt.plugins.v1.GroupConfig"> & {
/**
* The ServiceSettings for each member of the group.
*
* Each entry corresponds to a service definition referenced in GroupedDefinition.services.
* The order doesn't matter, but each member's name must match a service from the group definition.
*
* Requirements:
* - At least one member must be present
* - Each member name must be unique
* - Member names must match services declared in GroupedDefinition.services
*
* @generated from field: repeated mochabugapis.adapt.plugins.v1.ServiceSettings members = 3;
*/
members: ServiceSettings[];
};
/**
* Runtime configuration for a grouped service - contains the actual values for all members.
*
* ## Purpose
*
* GroupConfig holds the runtime configuration values for a GroupedDefinition.
* While GroupedDefinition declares which services belong to the group,
* GroupConfig contains the actual configured values for each member service.
*
* ## Relationship to GroupedDefinition
*
* - GroupedDefinition: Declares the group structure (in plugin manifest)
* - GroupConfig: Contains the runtime values for each member
*
* ## Examples
*
* Example: Stripe environments group with production and sandbox
* GroupedDefinition {
* name: "stripe_envs",
* services: ["stripe_prod", "stripe_sandbox"]
* }
*
* GroupConfig {
* members: [
* {
* name: "stripe_prod",
* configured: true,
* oauth2: { /* production OAuth2 tokens *\/ }
* },
* {
* name: "stripe_sandbox",
* configured: true,
* oauth2: { /* sandbox OAuth2 tokens *\/ }
* }
* ]
* }
*
* ## Accessing Members in Plugin Code
*
* Plugin code accesses group members using dot notation:
* - "stripe_envs.stripe_prod" for production environment
* - "stripe_envs.stripe_sandbox" for sandbox environment
*
* @generated from message mochabugapis.adapt.plugins.v1.GroupConfig
*/
export type GroupConfigJson = {
/**
* The ServiceSettings for each member of the group.
*
* Each entry corresponds to a service definition referenced in GroupedDefinition.services.
* The order doesn't matter, but each member's name must match a service from the group definition.
*
* Requirements:
* - At least one member must be present
* - Each member name must be unique
* - Member names must match services declared in GroupedDefinition.services
*
* @generated from field: repeated mochabugapis.adapt.plugins.v1.ServiceSettings members = 3;
*/
members?: ServiceSettingsJson[];
};
/**
* Describes the message mochabugapis.adapt.plugins.v1.GroupConfig.
* Use `create(GroupConfigSchema)` to create a new message.
*/
export declare const GroupConfigSchema: GenMessage<GroupConfig, {
jsonType: GroupConfigJson;
}>;
/**
* Service settings - runtime configuration values for a service.
*
* ## Relationship to ServiceDefinition
*
* ServiceSettings is the direct runtime equivalent of a ServiceDefinition:
* - ServiceDefinition: Declares the schema/structure of a service (what it needs)
* - ServiceSettings: Contains the actual configured values for that service (what it has)
*
* The `name` field references the ServiceDefinition by its name from Manifest.service_definitions.
*
* ## Value Field Matching
*
* The `value` oneof must match the service type from the corresponding ServiceDefinition:
* - ServiceDefinition with `oauth2`: ServiceSettings must have `oauth2` config
* - ServiceDefinition with `http_proxy`: ServiceSettings must have `http_proxy` config
* - ServiceDefinition with `variable`: ServiceSettings must have `variable` data
* - ServiceDefinition with `group`: ServiceSettings must have `group` config
* - ServiceDefinition with `oneof`: ServiceSettings must have `oneof` config
*
* ## Optional Services and Empty Values
*
* IMPORTANT: The `value` field can be unset (empty) for optional services:
* - If ServiceDefinition.optional = true: The service MAY be left unconfigured
* - When unconfigured: `value` is unset AND `configured` = true
* - This allows optional services to be marked as "configured" without providing values
*
* Example: An optional analytics service
* ServiceDefinition { name: "analytics", oauth2: {...}, optional: true }
* ServiceSettings { name: "analytics", configured: true } // No value field set
*
* For required services (optional = false or not set), the value field MUST be populated.
*
* @generated from message mochabugapis.adapt.plugins.v1.ServiceSettings
*/
export type ServiceSettings = Message<"mochabugapis.adapt.plugins.v1.ServiceSettings"> & {
/**
* The name of the service this setting refers to.
*
* This must match a ServiceDefinition.name from Manifest.service_definitions.
* Since services are now referenced directly by name (as strings in system_services
* and user_services arrays), this field identifies which service definition these
* settings correspond to.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* Whether or not the service is fully configured.
*
* This field indicates if the service has been successfully configured:
* - true: Service is configured and ready to use
* - false: Service requires additional configuration
*
* For optional services (ServiceDefinition.optional = true):
* - Can be true even when `value` is unset (user chose not to configure it)
* - This allows optional services to be marked as "handled" without providing values
*
* For required services (ServiceDefinition.optional = false):
* - Must be true only when `value` is properly populated
* - Indicates all required configuration values have been provided
*
* @generated from field: bool configured = 2;
*/
configured: boolean;
/**
* The actual configuration value for this service.
*
* The value type must match the corresponding ServiceDefinition's type:
* - oauth2: If ServiceDefinition has Oauth2Definition
* - http_proxy: If ServiceDefinition has HttpProxyDefinition
* - variable: If ServiceDefinition has VariableDefinition
* - oneof: If ServiceDefinition has OneOfDefinition
* - group: If ServiceDefinition has GroupedDefinition
*
* ## Optional Services
*
* This field CAN be unset (empty) when ServiceDefinition.optional = true:
* - User chooses not to configure the optional service
* - `configured` can still be true (indicating the choice to skip configuration)
* - Plugin code must handle the absence of this optional service
*
* ## Deletion
*
* Unsetting this field in an update request means "delete this service configuration".
*
* @generated from oneof mochabugapis.adapt.plugins.v1.ServiceSettings.value
*/
value: {
/**
* The oauth2 state
*
* @generated from field: mochabugapis.adapt.plugins.v1.Oauth2Config oauth2 = 3;
*/
value: Oauth2Config;
case: "oauth2";
} | {
/**
* The http proxy state
*
* @generated from field: mochabugapis.adapt.plugins.v1.HttpProxyConfig http_proxy = 4;
*/
value: HttpProxyConfig;
case: "httpProxy";
} | {
/**
* The variable state
* Raw JSON bytes, already validated against the variable's schema
*
* @generated from field: bytes variable = 5;
*/
value: Uint8Array;
case: "variable";
} | {
/**
* The oneof state
*
* @generated from field: mochabugapis.adapt.plugins.v1.OneOfConfig oneof = 6;
*/
value: OneOfConfig;
case: "oneof";
} | {
/**
* The group state
*
* @generated from field: mochabugapis.adapt.plugins.v1.GroupConfig group = 7;
*/
value: GroupConfig;
case: "group";
} | {
case: undefined;
value?: undefined;
};
};
/**
* Service settings - runtime configuration values for a service.
*
* ## Relationship to ServiceDefinition
*
* ServiceSettings is the direct runtime equivalent of a ServiceDefinition:
* - ServiceDefinition: Declares the schema/structure of a service (what it needs)
* - ServiceSettings: Contains the actual configured values for that service (what it has)
*
* The `name` field references the ServiceDefinition by its name from Manifest.service_definitions.
*
* ## Value Field Matching
*
* The `value` oneof must match the service type from the corresponding ServiceDefinition:
* - ServiceDefinition with `oauth2`: ServiceSettings must have `oauth2` config
* - ServiceDefinition with `http_proxy`: ServiceSettings must have `http_proxy` config
* - ServiceDefinition with `variable`: ServiceSettings must have `variable` data
* - ServiceDefinition with `group`: ServiceSettings must have `group` config
* - ServiceDefinition with `oneof`: ServiceSettings must have `oneof` config
*
* ## Optional Services and Empty Values
*
* IMPORTANT: The `value` field can be unset (empty) for optional services:
* - If ServiceDefinition.optional = true: The service MAY be left unconfigured
* - When unconfigured: `value` is unset AND `configured` = true
* - This allows optional services to be marked as "configured" without providing values
*
* Example: An optional analytics service
* ServiceDefinition { name: "analytics", oauth2: {...}, optional: true }
* ServiceSettings { name: "analytics", configured: true } // No value field set
*
* For required services (optional = false or not set), the value field MUST be populated.
*
* @generated from message mochabugapis.adapt.plugins.v1.ServiceSettings
*/
export type ServiceSettingsJson = {
/**
* The name of the service this setting refers to.
*
* This must match a ServiceDefinition.name from Manifest.service_definitions.
* Since services are now referenced directly by name (as strings in system_services
* and user_services arrays), this field identifies which service definition these
* settings correspond to.
*
* @generated from field: string name = 1;
*/
name?: string;
/**
* Whether or not the service is fully configured.
*
* This field indicates if the service has been successfully configured:
* - true: Service is configured and ready to use
* - false: Service requires additional configuration
*
* For optional services (ServiceDefinition.optional = true):
* - Can be true even when `value` is unset (user chose not to configure it)
* - This allows optional services to be marked as "handled" without providing values
*
* For required services (ServiceDefinition.optional = false):
* - Must be true only when `value` is properly populated
* - Indicates all required configuration values have been provided
*
* @generated from field: bool configured = 2;
*/
configured?: boolean;
/**
* The oauth2 state
*
* @generated from field: mochabugapis.adapt.plugins.v1.Oauth2Config oauth2 = 3;
*/
oauth2?: Oauth2ConfigJson;
/**
* The http proxy state
*
* @generated from field: mochabugapis.adapt.plugins.v1.HttpProxyConfig http_proxy = 4;
*/
httpProxy?: HttpProxyConfigJson;
/**
* The variable state
* Raw JSON bytes, already validated against the variable's schema
*
* @generated from field: bytes variable = 5;
*/
variable?: string;
/**
* The oneof state
*
* @generated from field: mochabugapis.adapt.plugins.v1.OneOfConfig oneof = 6;
*/
oneof?: OneOfConfigJson;
/**
* The group state
*
* @generated from field: mochabugapis.adapt.plugins.v1.GroupConfig group = 7;
*/
group?: GroupConfigJson;
};
/**
* Describes the message mochabugapis.adapt.plugins.v1.ServiceSettings.
* Use `create(ServiceSettingsSchema)` to create a new message.
*/
export declare const ServiceSettingsSchema: GenMessage<ServiceSettings, {
jsonType: ServiceSettingsJson;
}>;
//# sourceMappingURL=service_settings_pb.d.ts.map