diff --git a/.changeset/environments-client-scalar-types.md b/.changeset/environments-client-scalar-types.md new file mode 100644 index 00000000..64ac10cc --- /dev/null +++ b/.changeset/environments-client-scalar-types.md @@ -0,0 +1,17 @@ +--- +"@epilot/environments-client": minor +"@epilot/sdk": minor +"@epilot/cli": patch +--- + +Add the scalar environment variable types `Text`, `Number`, `Boolean` and `Options` (ER-5350) + +`EnvironmentValueType` widens from `"String" | "SecretString"` to include `Text`, `Number`, `Boolean` and `Options`, and a variable's `value` widens from `string` to `string | number | boolean | OptionsValue` accordingly — a `Number` variable holds a JSON number, a `Boolean` a JSON boolean, and an `Options` variable an object of selectable entries. Two new exported types come with it: `EnvironmentValue` for the value union and `EnvironmentOption` for one entry of an `Options` list, which carries either a single `label` or a `labels` map keyed by language. + +The split matters to browser-facing consumers: `Text`, `Number`, `Boolean` and `Options` may be served to a browser, while `String` and `SecretString` may not. `SecretString` keeps its existing behaviour — encrypted at rest, value never returned. + +`value` also becomes genuinely optional rather than merely absent for secrets: a variable created without one — as a blueprint install does, syncing a variable's key and type but never its value — reads back with no `value` at all. + +`protected` is now declared on the variable payloads, marking a variable as guarded against editing. + +Consumers that exhaustively switch on `EnvironmentValueType`, or that assign `value` straight to a `string`, will need to widen. Everything that only reads `String` and `SecretString` variables is unaffected at runtime. diff --git a/clients/environments-client/src/openapi.d.ts b/clients/environments-client/src/openapi.d.ts index 3390600b..3180e329 100644 --- a/clients/environments-client/src/openapi.d.ts +++ b/clients/environments-client/src/openapi.d.ts @@ -20,44 +20,129 @@ declare namespace Components { export interface EnvironmentGroupUpsertRequest { description?: string; } - export type EnvironmentValueType = "String" | "SecretString"; + export type EnvironmentOption = { + value: string; + label: string; + } | { + value: string; + labels: { + [name: string]: string; + }; + }; + /** + * A variable's value. The JSON type corresponds to the variable's `type`: + * `String`, `SecretString` and `Text` are strings, `Number` is a number, + * `Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754 + * doubles; integers above 2^53 may lose precision on round-trip. + * + */ + export type EnvironmentValue = /** + * A variable's value. The JSON type corresponds to the variable's `type`: + * `String`, `SecretString` and `Text` are strings, `Number` is a number, + * `Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754 + * doubles; integers above 2^53 may lose precision on round-trip. + * + */ + string | number | boolean | OptionsValue; + /** + * The structure a variable's value holds. `SecretString` is encrypted at rest and + * its value is never returned. `Text`, `Number`, `Boolean` and `Options` may be + * served to browser-facing consumers; `String` and `SecretString` may not. + * + */ + export type EnvironmentValueType = "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Options"; export interface EnvironmentVariable { key: string; // ^[a-z0-9][a-z0-9_.\-]{0,127}$ - type: EnvironmentValueType; + type: /** + * The structure a variable's value holds. `SecretString` is encrypted at rest and + * its value is never returned. `Text`, `Number`, `Boolean` and `Options` may be + * served to browser-facing consumers; `String` and `SecretString` may not. + * + */ + EnvironmentValueType; description?: string; /** * Optional group name for organising variables in the UI */ group?: string; /** - * Value is returned for String type, omitted for SecretString + * Returned for non-secret types, omitted for SecretString. Also omitted when + * the variable has been created without a value — for example by a blueprint + * install, which syncs a variable's key and type but never its value. + * + */ + value?: /** + * Returned for non-secret types, omitted for SecretString. Also omitted when + * the variable has been created without a value — for example by a blueprint + * install, which syncs a variable's key and type but never its value. + * */ - value?: string; + string | number | boolean | OptionsValue; + /** + * Whether the variable is protected from editing + */ + protected?: boolean; created_at: string; // date-time updated_at: string; // date-time } export interface EnvironmentVariableCreateRequest { key: string; // ^[a-z0-9][a-z0-9_.\-]{0,127}$ - type: EnvironmentValueType; + type: /** + * The structure a variable's value holds. `SecretString` is encrypted at rest and + * its value is never returned. `Text`, `Number`, `Boolean` and `Options` may be + * served to browser-facing consumers; `String` and `SecretString` may not. + * + */ + EnvironmentValueType; description?: string; group?: string; - value?: string; + value?: /** + * A variable's value. The JSON type corresponds to the variable's `type`: + * `String`, `SecretString` and `Text` are strings, `Number` is a number, + * `Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754 + * doubles; integers above 2^53 may lose precision on round-trip. + * + */ + EnvironmentValue; + /** + * Whether the variable is protected from editing + */ + protected?: boolean; } export interface EnvironmentVariableList { items: EnvironmentVariableListItem[]; } export interface EnvironmentVariableListItem { key: string; - type: EnvironmentValueType; + type: /** + * The structure a variable's value holds. `SecretString` is encrypted at rest and + * its value is never returned. `Text`, `Number`, `Boolean` and `Options` may be + * served to browser-facing consumers; `String` and `SecretString` may not. + * + */ + EnvironmentValueType; description?: string; /** * Optional group name for organising variables in the UI */ group?: string; /** - * Value is returned for String type, omitted for SecretString + * Returned for non-secret types, omitted for SecretString. Also omitted when + * the variable has been created without a value — for example by a blueprint + * install, which syncs a variable's key and type but never its value. + * + */ + value?: /** + * Returned for non-secret types, omitted for SecretString. Also omitted when + * the variable has been created without a value — for example by a blueprint + * install, which syncs a variable's key and type but never its value. + * + */ + string | number | boolean | OptionsValue; + /** + * Whether the variable is protected from editing */ - value?: string; + protected?: boolean; created_at: string; // date-time updated_at: string; // date-time } @@ -65,10 +150,28 @@ declare namespace Components { /** * Type of variable. Used when creating a new variable. Defaults to String. */ - type?: "String" | "SecretString"; - value?: string; + type?: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Options"; + value?: /** + * A variable's value. The JSON type corresponds to the variable's `type`: + * `String`, `SecretString` and `Text` are strings, `Number` is a number, + * `Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754 + * doubles; integers above 2^53 may lose precision on round-trip. + * + */ + EnvironmentValue; description?: string; group?: string; + /** + * Whether the variable is protected from editing + */ + protected?: boolean; + } + export interface OptionsValue { + fallbackLanguage?: string; + options: [ + EnvironmentOption, + ...EnvironmentOption[] + ]; } } } @@ -176,6 +279,8 @@ declare namespace Paths { } export interface $403 { } + export interface $409 { + } export interface $500 { } } @@ -201,7 +306,7 @@ declare namespace Paths { export interface OperationMethods { /** - * listEnvironmentVariables - List environment variables + * listEnvironmentVariables - listEnvironmentVariables * * List all environment variables for the organization. Returns metadata only, no secret values. */ @@ -211,9 +316,9 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * createEnvironmentVariable - Create environment variable + * createEnvironmentVariable - createEnvironmentVariable * - * Create a new environment variable or secret for the organization. + * Create a new environment variable or secret for the organization. If `group` is provided and the group does not yet exist, it is created automatically. */ 'createEnvironmentVariable'( parameters?: Parameters | null, @@ -221,7 +326,7 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * listEnvironmentGroups - List environment groups + * listEnvironmentGroups - listEnvironmentGroups * * List all environment groups for the organization. */ @@ -232,6 +337,8 @@ export interface OperationMethods { ): OperationResponse /** * putEnvironmentGroup - putEnvironmentGroup + * + * Create or update an environment group by name. Acts as an upsert — creates the group if it does not exist. */ 'putEnvironmentGroup'( parameters?: Parameters | null, @@ -239,7 +346,7 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * deleteEnvironmentGroup - Delete an environment group + * deleteEnvironmentGroup - deleteEnvironmentGroup * * Deletes a group. Variables assigned to this group become ungrouped. */ @@ -249,9 +356,9 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * getEnvironmentVariable - Get environment variable + * getEnvironmentVariable - getEnvironmentVariable * - * Get an environment variable by key. Returns value only for String type, omitted for SecretString. + * Get an environment variable by key. Returns value for non-secret types, omitted for SecretString. */ 'getEnvironmentVariable'( parameters?: Parameters | null, @@ -259,9 +366,9 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * updateEnvironmentVariable - Update environment variable + * updateEnvironmentVariable - updateEnvironmentVariable * - * Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist. + * Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist. If `group` is provided and the group does not yet exist, it is created automatically. */ 'updateEnvironmentVariable'( parameters?: Parameters | null, @@ -269,7 +376,7 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * deleteEnvironmentVariable - Delete environment variable + * deleteEnvironmentVariable - deleteEnvironmentVariable * * Delete an environment variable by key. */ @@ -283,7 +390,7 @@ export interface OperationMethods { export interface PathsDictionary { ['/v1/environments']: { /** - * listEnvironmentVariables - List environment variables + * listEnvironmentVariables - listEnvironmentVariables * * List all environment variables for the organization. Returns metadata only, no secret values. */ @@ -293,9 +400,9 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse /** - * createEnvironmentVariable - Create environment variable + * createEnvironmentVariable - createEnvironmentVariable * - * Create a new environment variable or secret for the organization. + * Create a new environment variable or secret for the organization. If `group` is provided and the group does not yet exist, it is created automatically. */ 'post'( parameters?: Parameters | null, @@ -305,7 +412,7 @@ export interface PathsDictionary { } ['/v1/environments/groups']: { /** - * listEnvironmentGroups - List environment groups + * listEnvironmentGroups - listEnvironmentGroups * * List all environment groups for the organization. */ @@ -318,6 +425,8 @@ export interface PathsDictionary { ['/v1/environments/groups/{name}']: { /** * putEnvironmentGroup - putEnvironmentGroup + * + * Create or update an environment group by name. Acts as an upsert — creates the group if it does not exist. */ 'put'( parameters?: Parameters | null, @@ -325,7 +434,7 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse /** - * deleteEnvironmentGroup - Delete an environment group + * deleteEnvironmentGroup - deleteEnvironmentGroup * * Deletes a group. Variables assigned to this group become ungrouped. */ @@ -337,9 +446,9 @@ export interface PathsDictionary { } ['/v1/environments/{key}']: { /** - * getEnvironmentVariable - Get environment variable + * getEnvironmentVariable - getEnvironmentVariable * - * Get an environment variable by key. Returns value only for String type, omitted for SecretString. + * Get an environment variable by key. Returns value for non-secret types, omitted for SecretString. */ 'get'( parameters?: Parameters | null, @@ -347,9 +456,9 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse /** - * updateEnvironmentVariable - Update environment variable + * updateEnvironmentVariable - updateEnvironmentVariable * - * Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist. + * Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist. If `group` is provided and the group does not yet exist, it is created automatically. */ 'put'( parameters?: Parameters | null, @@ -357,7 +466,7 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse /** - * deleteEnvironmentVariable - Delete environment variable + * deleteEnvironmentVariable - deleteEnvironmentVariable * * Delete an environment variable by key. */ @@ -375,9 +484,12 @@ export type Client = OpenAPIClient export type EnvironmentGroup = Components.Schemas.EnvironmentGroup; export type EnvironmentGroupList = Components.Schemas.EnvironmentGroupList; export type EnvironmentGroupUpsertRequest = Components.Schemas.EnvironmentGroupUpsertRequest; +export type EnvironmentOption = Components.Schemas.EnvironmentOption; +export type EnvironmentValue = Components.Schemas.EnvironmentValue; export type EnvironmentValueType = Components.Schemas.EnvironmentValueType; export type EnvironmentVariable = Components.Schemas.EnvironmentVariable; export type EnvironmentVariableCreateRequest = Components.Schemas.EnvironmentVariableCreateRequest; export type EnvironmentVariableList = Components.Schemas.EnvironmentVariableList; export type EnvironmentVariableListItem = Components.Schemas.EnvironmentVariableListItem; export type EnvironmentVariableUpdateRequest = Components.Schemas.EnvironmentVariableUpdateRequest; +export type OptionsValue = Components.Schemas.OptionsValue; diff --git a/clients/environments-client/src/openapi.json b/clients/environments-client/src/openapi.json index 85120c98..3632dce7 100644 --- a/clients/environments-client/src/openapi.json +++ b/clients/environments-client/src/openapi.json @@ -20,7 +20,7 @@ "/v1/environments": { "get": { "operationId": "listEnvironmentVariables", - "summary": "List environment variables", + "summary": "listEnvironmentVariables", "description": "List all environment variables for the organization. Returns metadata only, no secret values.", "tags": [ "environments" @@ -49,8 +49,8 @@ }, "post": { "operationId": "createEnvironmentVariable", - "summary": "Create environment variable", - "description": "Create a new environment variable or secret for the organization.", + "summary": "createEnvironmentVariable", + "description": "Create a new environment variable or secret for the organization. If `group` is provided and the group does not yet exist, it is created automatically.", "tags": [ "environments" ], @@ -96,7 +96,7 @@ "/v1/environments/groups": { "get": { "operationId": "listEnvironmentGroups", - "summary": "List environment groups", + "summary": "listEnvironmentGroups", "description": "List all environment groups for the organization.", "tags": [ "environments" @@ -138,6 +138,7 @@ "put": { "operationId": "putEnvironmentGroup", "summary": "putEnvironmentGroup", + "description": "Create or update an environment group by name. Acts as an upsert — creates the group if it does not exist.", "tags": [ "environments" ], @@ -185,7 +186,7 @@ }, "delete": { "operationId": "deleteEnvironmentGroup", - "summary": "Delete an environment group", + "summary": "deleteEnvironmentGroup", "description": "Deletes a group. Variables assigned to this group become ungrouped.", "tags": [ "environments" @@ -224,8 +225,8 @@ ], "get": { "operationId": "getEnvironmentVariable", - "summary": "Get environment variable", - "description": "Get an environment variable by key. Returns value only for String type, omitted for SecretString.", + "summary": "getEnvironmentVariable", + "description": "Get an environment variable by key. Returns value for non-secret types, omitted for SecretString.", "tags": [ "environments" ], @@ -256,8 +257,8 @@ }, "put": { "operationId": "updateEnvironmentVariable", - "summary": "Update environment variable", - "description": "Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist.", + "summary": "updateEnvironmentVariable", + "description": "Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist. If `group` is provided and the group does not yet exist, it is created automatically.", "tags": [ "environments" ], @@ -301,6 +302,9 @@ "403": { "description": "Forbidden" }, + "409": { + "description": "Cannot change the type of a variable that currently holds a value" + }, "500": { "description": "Internal server error" } @@ -308,7 +312,7 @@ }, "delete": { "operationId": "deleteEnvironmentVariable", - "summary": "Delete environment variable", + "summary": "deleteEnvironmentVariable", "description": "Delete an environment variable by key.", "tags": [ "environments" @@ -344,9 +348,99 @@ "schemas": { "EnvironmentValueType": { "type": "string", + "description": "The structure a variable's value holds. `SecretString` is encrypted at rest and\nits value is never returned. `Text`, `Number`, `Boolean` and `Options` may be\nserved to browser-facing consumers; `String` and `SecretString` may not.\n", "enum": [ "String", - "SecretString" + "SecretString", + "Text", + "Number", + "Boolean", + "Options" + ] + }, + "EnvironmentOption": { + "oneOf": [ + { + "type": "object", + "required": [ + "value", + "label" + ], + "additionalProperties": false, + "properties": { + "value": { + "type": "string", + "minLength": 1 + }, + "label": { + "type": "string", + "minLength": 1 + } + } + }, + { + "type": "object", + "required": [ + "value", + "labels" + ], + "additionalProperties": false, + "properties": { + "value": { + "type": "string", + "minLength": 1 + }, + "labels": { + "type": "object", + "minProperties": 1, + "propertyNames": { + "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]+)*$" + }, + "additionalProperties": { + "type": "string", + "minLength": 1 + } + } + } + } + ] + }, + "OptionsValue": { + "type": "object", + "required": [ + "options" + ], + "additionalProperties": false, + "properties": { + "fallbackLanguage": { + "type": "string", + "minLength": 2, + "default": "de" + }, + "options": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/EnvironmentOption" + } + } + } + }, + "EnvironmentValue": { + "description": "A variable's value. The JSON type corresponds to the variable's `type`:\n`String`, `SecretString` and `Text` are strings, `Number` is a number,\n`Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754\ndoubles; integers above 2^53 may lose precision on round-trip.\n", + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "$ref": "#/components/schemas/OptionsValue" + } ] }, "EnvironmentVariable": { @@ -373,8 +467,16 @@ "description": "Optional group name for organising variables in the UI" }, "value": { - "type": "string", - "description": "Value is returned for String type, omitted for SecretString" + "allOf": [ + { + "$ref": "#/components/schemas/EnvironmentValue" + } + ], + "description": "Returned for non-secret types, omitted for SecretString. Also omitted when\nthe variable has been created without a value — for example by a blueprint\ninstall, which syncs a variable's key and type but never its value.\n" + }, + "protected": { + "type": "boolean", + "description": "Whether the variable is protected from editing" }, "created_at": { "type": "string", @@ -409,8 +511,16 @@ "description": "Optional group name for organising variables in the UI" }, "value": { - "type": "string", - "description": "Value is returned for String type, omitted for SecretString" + "allOf": [ + { + "$ref": "#/components/schemas/EnvironmentValue" + } + ], + "description": "Returned for non-secret types, omitted for SecretString. Also omitted when\nthe variable has been created without a value — for example by a blueprint\ninstall, which syncs a variable's key and type but never its value.\n" + }, + "protected": { + "type": "boolean", + "description": "Whether the variable is protected from editing" }, "created_at": { "type": "string", @@ -457,7 +567,11 @@ "type": "string" }, "value": { - "type": "string" + "$ref": "#/components/schemas/EnvironmentValue" + }, + "protected": { + "type": "boolean", + "description": "Whether the variable is protected from editing" } } }, @@ -473,13 +587,17 @@ ] }, "value": { - "type": "string" + "$ref": "#/components/schemas/EnvironmentValue" }, "description": { "type": "string" }, "group": { "type": "string" + }, + "protected": { + "type": "boolean", + "description": "Whether the variable is protected from editing" } } }, diff --git a/packages/epilot-sdk-v2/docs/environments.md b/packages/epilot-sdk-v2/docs/environments.md index 32b7a3fd..a9a9b53d 100644 --- a/packages/epilot-sdk-v2/docs/environments.md +++ b/packages/epilot-sdk-v2/docs/environments.md @@ -36,6 +36,9 @@ const { data } = await environmentsClient.listEnvironmentVariables(...) **Schemas** - [`EnvironmentValueType`](#environmentvaluetype) +- [`EnvironmentOption`](#environmentoption) +- [`OptionsValue`](#optionsvalue) +- [`EnvironmentValue`](#environmentvalue) - [`EnvironmentVariable`](#environmentvariable) - [`EnvironmentVariableListItem`](#environmentvariablelistitem) - [`EnvironmentVariableList`](#environmentvariablelist) @@ -47,7 +50,7 @@ const { data } = await environmentsClient.listEnvironmentVariables(...) ### `listEnvironmentVariables` -List environment variables +List all environment variables for the organization. Returns metadata only, no secret values. `GET /v1/environments` @@ -67,6 +70,7 @@ const { data } = await client.listEnvironmentVariables() "description": "string", "group": "string", "value": "string", + "protected": true, "created_at": "1970-01-01T00:00:00.000Z", "updated_at": "1970-01-01T00:00:00.000Z" } @@ -80,7 +84,7 @@ const { data } = await client.listEnvironmentVariables() ### `createEnvironmentVariable` -Create environment variable +Create a new environment variable or secret for the organization. If `group` is provided and the group does not yet exist, it is created automatically. `POST /v1/environments` @@ -92,7 +96,8 @@ const { data } = await client.createEnvironmentVariable( type: 'String', description: 'string', group: 'string', - value: 'string' + value: 'string', + protected: true }, ) ``` @@ -107,6 +112,7 @@ const { data } = await client.createEnvironmentVariable( "description": "string", "group": "string", "value": "string", + "protected": true, "created_at": "1970-01-01T00:00:00.000Z", "updated_at": "1970-01-01T00:00:00.000Z" } @@ -118,7 +124,7 @@ const { data } = await client.createEnvironmentVariable( ### `listEnvironmentGroups` -List environment groups +List all environment groups for the organization. `GET /v1/environments/groups` @@ -148,6 +154,8 @@ const { data } = await client.listEnvironmentGroups() ### `putEnvironmentGroup` +Create or update an environment group by name. Acts as an upsert — creates the group if it does not exist. + `PUT /v1/environments/groups/{name}` ```ts @@ -179,7 +187,7 @@ const { data } = await client.putEnvironmentGroup( ### `deleteEnvironmentGroup` -Delete an environment group +Deletes a group. Variables assigned to this group become ungrouped. `DELETE /v1/environments/groups/{name}` @@ -193,7 +201,7 @@ const { data } = await client.deleteEnvironmentGroup({ ### `getEnvironmentVariable` -Get environment variable +Get an environment variable by key. Returns value for non-secret types, omitted for SecretString. `GET /v1/environments/{key}` @@ -213,6 +221,7 @@ const { data } = await client.getEnvironmentVariable({ "description": "string", "group": "string", "value": "string", + "protected": true, "created_at": "1970-01-01T00:00:00.000Z", "updated_at": "1970-01-01T00:00:00.000Z" } @@ -224,7 +233,7 @@ const { data } = await client.getEnvironmentVariable({ ### `updateEnvironmentVariable` -Update environment variable +Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist. If `group` is provided and the group does not yet exist, it is created automatically. `PUT /v1/environments/{key}` @@ -237,7 +246,8 @@ const { data } = await client.updateEnvironmentVariable( type: 'String', value: 'string', description: 'string', - group: 'string' + group: 'string', + protected: true }, ) ``` @@ -252,6 +262,7 @@ const { data } = await client.updateEnvironmentVariable( "description": "string", "group": "string", "value": "string", + "protected": true, "created_at": "1970-01-01T00:00:00.000Z", "updated_at": "1970-01-01T00:00:00.000Z" } @@ -263,7 +274,7 @@ const { data } = await client.updateEnvironmentVariable( ### `deleteEnvironmentVariable` -Delete environment variable +Delete an environment variable by key. `DELETE /v1/environments/{key}` @@ -279,8 +290,61 @@ const { data } = await client.deleteEnvironmentVariable({ ### `EnvironmentValueType` +The structure a variable's value holds. `SecretString` is encrypted at rest and +its value is never returned. `Text`, `Number`, `Boolean` and `Options` may be +served to browser-facing consumers; `String` and `SecretString` may not. + + ```ts -type EnvironmentValueType = "String" | "SecretString" +type EnvironmentValueType = "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Options" +``` + +### `EnvironmentOption` + +```ts +type EnvironmentOption = { + value: string + label: string +} | { + value: string + labels: Record +} +``` + +### `OptionsValue` + +```ts +type OptionsValue = { + fallbackLanguage?: string + options: Array<{ + value: string + label: string + } | { + value: string + labels: Record + }> +} +``` + +### `EnvironmentValue` + +A variable's value. The JSON type corresponds to the variable's `type`: +`String`, `SecretString` and `Text` are strings, `Number` is a number, +`Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754 +doubles; integers above 2^53 may lose precision on round-trip. + + +```ts +type EnvironmentValue = string | number | boolean | { + fallbackLanguage?: string + options: Array<{ + value: string + label: string + } | { + value: string + labels: Record + }> +} ``` ### `EnvironmentVariable` @@ -288,10 +352,20 @@ type EnvironmentValueType = "String" | "SecretString" ```ts type EnvironmentVariable = { key: string - type: "String" | "SecretString" + type: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Options" description?: string group?: string - value?: string + value?: string | number | boolean | { + fallbackLanguage?: string + options: Array<{ + value: { ... } + label: { ... } + } | { + value: { ... } + labels: { ... } + }> + } + protected?: boolean created_at: string // date-time updated_at: string // date-time } @@ -302,10 +376,20 @@ type EnvironmentVariable = { ```ts type EnvironmentVariableListItem = { key: string - type: "String" | "SecretString" + type: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Options" description?: string group?: string - value?: string + value?: string | number | boolean | { + fallbackLanguage?: string + options: Array<{ + value: { ... } + label: { ... } + } | { + value: { ... } + labels: { ... } + }> + } + protected?: boolean created_at: string // date-time updated_at: string // date-time } @@ -317,10 +401,14 @@ type EnvironmentVariableListItem = { type EnvironmentVariableList = { items: Array<{ key: string - type: "String" | "SecretString" + type: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Options" description?: string group?: string - value?: string + value?: string | number | boolean | { + fallbackLanguage?: { ... } + options: { ... } + } + protected?: boolean created_at: string // date-time updated_at: string // date-time }> @@ -332,10 +420,20 @@ type EnvironmentVariableList = { ```ts type EnvironmentVariableCreateRequest = { key: string - type: "String" | "SecretString" + type: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Options" description?: string group?: string - value?: string + value?: string | number | boolean | { + fallbackLanguage?: string + options: Array<{ + value: { ... } + label: { ... } + } | { + value: { ... } + labels: { ... } + }> + } + protected?: boolean } ``` @@ -343,10 +441,20 @@ type EnvironmentVariableCreateRequest = { ```ts type EnvironmentVariableUpdateRequest = { - type?: "String" | "SecretString" - value?: string + type?: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Options" + value?: string | number | boolean | { + fallbackLanguage?: string + options: Array<{ + value: { ... } + label: { ... } + } | { + value: { ... } + labels: { ... } + }> + } description?: string group?: string + protected?: boolean } ``` diff --git a/packages/epilot-sdk-v2/src/docs/environments.json b/packages/epilot-sdk-v2/src/docs/environments.json index a716c89e..65e06ed0 100644 --- a/packages/epilot-sdk-v2/src/docs/environments.json +++ b/packages/epilot-sdk-v2/src/docs/environments.json @@ -1 +1 @@ -"# Environments API\n\n- **Base URL:** `https://environments.sls.epilot.io`\n- **Full API Docs:** [https://docs.epilot.io/api/environments](https://docs.epilot.io/api/environments)\n\n## Usage\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '')\nconst { data } = await epilot.environments.listEnvironmentVariables(...)\n```\n\n### Tree-shakeable import\n\n```ts\nimport { getClient, authorize } from '@epilot/sdk/environments'\n\nconst environmentsClient = getClient()\nauthorize(environmentsClient, () => '')\nconst { data } = await environmentsClient.listEnvironmentVariables(...)\n```\n\n## Operations\n\n**environments**\n- [`listEnvironmentVariables`](#listenvironmentvariables)\n- [`createEnvironmentVariable`](#createenvironmentvariable)\n- [`listEnvironmentGroups`](#listenvironmentgroups)\n- [`putEnvironmentGroup`](#putenvironmentgroup)\n- [`deleteEnvironmentGroup`](#deleteenvironmentgroup)\n- [`getEnvironmentVariable`](#getenvironmentvariable)\n- [`updateEnvironmentVariable`](#updateenvironmentvariable)\n- [`deleteEnvironmentVariable`](#deleteenvironmentvariable)\n\n**Schemas**\n- [`EnvironmentValueType`](#environmentvaluetype)\n- [`EnvironmentVariable`](#environmentvariable)\n- [`EnvironmentVariableListItem`](#environmentvariablelistitem)\n- [`EnvironmentVariableList`](#environmentvariablelist)\n- [`EnvironmentVariableCreateRequest`](#environmentvariablecreaterequest)\n- [`EnvironmentVariableUpdateRequest`](#environmentvariableupdaterequest)\n- [`EnvironmentGroup`](#environmentgroup)\n- [`EnvironmentGroupList`](#environmentgrouplist)\n- [`EnvironmentGroupUpsertRequest`](#environmentgroupupsertrequest)\n\n### `listEnvironmentVariables`\n\nList environment variables\n\n`GET /v1/environments`\n\n```ts\nconst { data } = await client.listEnvironmentVariables()\n```\n\n
\nResponse\n\n```json\n{\n \"items\": [\n {\n \"key\": \"string\",\n \"type\": \"String\",\n \"description\": \"string\",\n \"group\": \"string\",\n \"value\": \"string\",\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n }\n ]\n}\n```\n\n
\n\n---\n\n### `createEnvironmentVariable`\n\nCreate environment variable\n\n`POST /v1/environments`\n\n```ts\nconst { data } = await client.createEnvironmentVariable(\n null,\n {\n key: 'string',\n type: 'String',\n description: 'string',\n group: 'string',\n value: 'string'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"key\": \"string\",\n \"type\": \"String\",\n \"description\": \"string\",\n \"group\": \"string\",\n \"value\": \"string\",\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n}\n```\n\n
\n\n---\n\n### `listEnvironmentGroups`\n\nList environment groups\n\n`GET /v1/environments/groups`\n\n```ts\nconst { data } = await client.listEnvironmentGroups()\n```\n\n
\nResponse\n\n```json\n{\n \"items\": [\n {\n \"name\": \"string\",\n \"description\": \"string\",\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n }\n ]\n}\n```\n\n
\n\n---\n\n### `putEnvironmentGroup`\n\n`PUT /v1/environments/groups/{name}`\n\n```ts\nconst { data } = await client.putEnvironmentGroup(\n {\n name: 'example',\n },\n {\n description: 'string'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"name\": \"string\",\n \"description\": \"string\",\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n}\n```\n\n
\n\n---\n\n### `deleteEnvironmentGroup`\n\nDelete an environment group\n\n`DELETE /v1/environments/groups/{name}`\n\n```ts\nconst { data } = await client.deleteEnvironmentGroup({\n name: 'example',\n})\n```\n\n---\n\n### `getEnvironmentVariable`\n\nGet environment variable\n\n`GET /v1/environments/{key}`\n\n```ts\nconst { data } = await client.getEnvironmentVariable({\n key: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"key\": \"string\",\n \"type\": \"String\",\n \"description\": \"string\",\n \"group\": \"string\",\n \"value\": \"string\",\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n}\n```\n\n
\n\n---\n\n### `updateEnvironmentVariable`\n\nUpdate environment variable\n\n`PUT /v1/environments/{key}`\n\n```ts\nconst { data } = await client.updateEnvironmentVariable(\n {\n key: 'example',\n },\n {\n type: 'String',\n value: 'string',\n description: 'string',\n group: 'string'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"key\": \"string\",\n \"type\": \"String\",\n \"description\": \"string\",\n \"group\": \"string\",\n \"value\": \"string\",\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n}\n```\n\n
\n\n---\n\n### `deleteEnvironmentVariable`\n\nDelete environment variable\n\n`DELETE /v1/environments/{key}`\n\n```ts\nconst { data } = await client.deleteEnvironmentVariable({\n key: 'example',\n})\n```\n\n---\n\n## Schemas\n\n### `EnvironmentValueType`\n\n```ts\ntype EnvironmentValueType = \"String\" | \"SecretString\"\n```\n\n### `EnvironmentVariable`\n\n```ts\ntype EnvironmentVariable = {\n key: string\n type: \"String\" | \"SecretString\"\n description?: string\n group?: string\n value?: string\n created_at: string // date-time\n updated_at: string // date-time\n}\n```\n\n### `EnvironmentVariableListItem`\n\n```ts\ntype EnvironmentVariableListItem = {\n key: string\n type: \"String\" | \"SecretString\"\n description?: string\n group?: string\n value?: string\n created_at: string // date-time\n updated_at: string // date-time\n}\n```\n\n### `EnvironmentVariableList`\n\n```ts\ntype EnvironmentVariableList = {\n items: Array<{\n key: string\n type: \"String\" | \"SecretString\"\n description?: string\n group?: string\n value?: string\n created_at: string // date-time\n updated_at: string // date-time\n }>\n}\n```\n\n### `EnvironmentVariableCreateRequest`\n\n```ts\ntype EnvironmentVariableCreateRequest = {\n key: string\n type: \"String\" | \"SecretString\"\n description?: string\n group?: string\n value?: string\n}\n```\n\n### `EnvironmentVariableUpdateRequest`\n\n```ts\ntype EnvironmentVariableUpdateRequest = {\n type?: \"String\" | \"SecretString\"\n value?: string\n description?: string\n group?: string\n}\n```\n\n### `EnvironmentGroup`\n\n```ts\ntype EnvironmentGroup = {\n name: string\n description?: string\n created_at: string // date-time\n updated_at: string // date-time\n}\n```\n\n### `EnvironmentGroupList`\n\n```ts\ntype EnvironmentGroupList = {\n items: Array<{\n name: string\n description?: string\n created_at: string // date-time\n updated_at: string // date-time\n }>\n}\n```\n\n### `EnvironmentGroupUpsertRequest`\n\n```ts\ntype EnvironmentGroupUpsertRequest = {\n description?: string\n}\n```\n" +"# Environments API\n\n- **Base URL:** `https://environments.sls.epilot.io`\n- **Full API Docs:** [https://docs.epilot.io/api/environments](https://docs.epilot.io/api/environments)\n\n## Usage\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '')\nconst { data } = await epilot.environments.listEnvironmentVariables(...)\n```\n\n### Tree-shakeable import\n\n```ts\nimport { getClient, authorize } from '@epilot/sdk/environments'\n\nconst environmentsClient = getClient()\nauthorize(environmentsClient, () => '')\nconst { data } = await environmentsClient.listEnvironmentVariables(...)\n```\n\n## Operations\n\n**environments**\n- [`listEnvironmentVariables`](#listenvironmentvariables)\n- [`createEnvironmentVariable`](#createenvironmentvariable)\n- [`listEnvironmentGroups`](#listenvironmentgroups)\n- [`putEnvironmentGroup`](#putenvironmentgroup)\n- [`deleteEnvironmentGroup`](#deleteenvironmentgroup)\n- [`getEnvironmentVariable`](#getenvironmentvariable)\n- [`updateEnvironmentVariable`](#updateenvironmentvariable)\n- [`deleteEnvironmentVariable`](#deleteenvironmentvariable)\n\n**Schemas**\n- [`EnvironmentValueType`](#environmentvaluetype)\n- [`EnvironmentOption`](#environmentoption)\n- [`OptionsValue`](#optionsvalue)\n- [`EnvironmentValue`](#environmentvalue)\n- [`EnvironmentVariable`](#environmentvariable)\n- [`EnvironmentVariableListItem`](#environmentvariablelistitem)\n- [`EnvironmentVariableList`](#environmentvariablelist)\n- [`EnvironmentVariableCreateRequest`](#environmentvariablecreaterequest)\n- [`EnvironmentVariableUpdateRequest`](#environmentvariableupdaterequest)\n- [`EnvironmentGroup`](#environmentgroup)\n- [`EnvironmentGroupList`](#environmentgrouplist)\n- [`EnvironmentGroupUpsertRequest`](#environmentgroupupsertrequest)\n\n### `listEnvironmentVariables`\n\nList all environment variables for the organization. Returns metadata only, no secret values.\n\n`GET /v1/environments`\n\n```ts\nconst { data } = await client.listEnvironmentVariables()\n```\n\n
\nResponse\n\n```json\n{\n \"items\": [\n {\n \"key\": \"string\",\n \"type\": \"String\",\n \"description\": \"string\",\n \"group\": \"string\",\n \"value\": \"string\",\n \"protected\": true,\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n }\n ]\n}\n```\n\n
\n\n---\n\n### `createEnvironmentVariable`\n\nCreate a new environment variable or secret for the organization. If `group` is provided and the group does not yet exist, it is created automatically.\n\n`POST /v1/environments`\n\n```ts\nconst { data } = await client.createEnvironmentVariable(\n null,\n {\n key: 'string',\n type: 'String',\n description: 'string',\n group: 'string',\n value: 'string',\n protected: true\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"key\": \"string\",\n \"type\": \"String\",\n \"description\": \"string\",\n \"group\": \"string\",\n \"value\": \"string\",\n \"protected\": true,\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n}\n```\n\n
\n\n---\n\n### `listEnvironmentGroups`\n\nList all environment groups for the organization.\n\n`GET /v1/environments/groups`\n\n```ts\nconst { data } = await client.listEnvironmentGroups()\n```\n\n
\nResponse\n\n```json\n{\n \"items\": [\n {\n \"name\": \"string\",\n \"description\": \"string\",\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n }\n ]\n}\n```\n\n
\n\n---\n\n### `putEnvironmentGroup`\n\nCreate or update an environment group by name. Acts as an upsert — creates the group if it does not exist.\n\n`PUT /v1/environments/groups/{name}`\n\n```ts\nconst { data } = await client.putEnvironmentGroup(\n {\n name: 'example',\n },\n {\n description: 'string'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"name\": \"string\",\n \"description\": \"string\",\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n}\n```\n\n
\n\n---\n\n### `deleteEnvironmentGroup`\n\nDeletes a group. Variables assigned to this group become ungrouped.\n\n`DELETE /v1/environments/groups/{name}`\n\n```ts\nconst { data } = await client.deleteEnvironmentGroup({\n name: 'example',\n})\n```\n\n---\n\n### `getEnvironmentVariable`\n\nGet an environment variable by key. Returns value for non-secret types, omitted for SecretString.\n\n`GET /v1/environments/{key}`\n\n```ts\nconst { data } = await client.getEnvironmentVariable({\n key: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"key\": \"string\",\n \"type\": \"String\",\n \"description\": \"string\",\n \"group\": \"string\",\n \"value\": \"string\",\n \"protected\": true,\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n}\n```\n\n
\n\n---\n\n### `updateEnvironmentVariable`\n\nCreate or update an environment variable. Acts as an upsert — creates the variable if it does not exist. If `group` is provided and the group does not yet exist, it is created automatically.\n\n`PUT /v1/environments/{key}`\n\n```ts\nconst { data } = await client.updateEnvironmentVariable(\n {\n key: 'example',\n },\n {\n type: 'String',\n value: 'string',\n description: 'string',\n group: 'string',\n protected: true\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"key\": \"string\",\n \"type\": \"String\",\n \"description\": \"string\",\n \"group\": \"string\",\n \"value\": \"string\",\n \"protected\": true,\n \"created_at\": \"1970-01-01T00:00:00.000Z\",\n \"updated_at\": \"1970-01-01T00:00:00.000Z\"\n}\n```\n\n
\n\n---\n\n### `deleteEnvironmentVariable`\n\nDelete an environment variable by key.\n\n`DELETE /v1/environments/{key}`\n\n```ts\nconst { data } = await client.deleteEnvironmentVariable({\n key: 'example',\n})\n```\n\n---\n\n## Schemas\n\n### `EnvironmentValueType`\n\nThe structure a variable's value holds. `SecretString` is encrypted at rest and\nits value is never returned. `Text`, `Number`, `Boolean` and `Options` may be\nserved to browser-facing consumers; `String` and `SecretString` may not.\n\n\n```ts\ntype EnvironmentValueType = \"String\" | \"SecretString\" | \"Text\" | \"Number\" | \"Boolean\" | \"Options\"\n```\n\n### `EnvironmentOption`\n\n```ts\ntype EnvironmentOption = {\n value: string\n label: string\n} | {\n value: string\n labels: Record\n}\n```\n\n### `OptionsValue`\n\n```ts\ntype OptionsValue = {\n fallbackLanguage?: string\n options: Array<{\n value: string\n label: string\n } | {\n value: string\n labels: Record\n }>\n}\n```\n\n### `EnvironmentValue`\n\nA variable's value. The JSON type corresponds to the variable's `type`:\n`String`, `SecretString` and `Text` are strings, `Number` is a number,\n`Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754\ndoubles; integers above 2^53 may lose precision on round-trip.\n\n\n```ts\ntype EnvironmentValue = string | number | boolean | {\n fallbackLanguage?: string\n options: Array<{\n value: string\n label: string\n } | {\n value: string\n labels: Record\n }>\n}\n```\n\n### `EnvironmentVariable`\n\n```ts\ntype EnvironmentVariable = {\n key: string\n type: \"String\" | \"SecretString\" | \"Text\" | \"Number\" | \"Boolean\" | \"Options\"\n description?: string\n group?: string\n value?: string | number | boolean | {\n fallbackLanguage?: string\n options: Array<{\n value: { ... }\n label: { ... }\n } | {\n value: { ... }\n labels: { ... }\n }>\n }\n protected?: boolean\n created_at: string // date-time\n updated_at: string // date-time\n}\n```\n\n### `EnvironmentVariableListItem`\n\n```ts\ntype EnvironmentVariableListItem = {\n key: string\n type: \"String\" | \"SecretString\" | \"Text\" | \"Number\" | \"Boolean\" | \"Options\"\n description?: string\n group?: string\n value?: string | number | boolean | {\n fallbackLanguage?: string\n options: Array<{\n value: { ... }\n label: { ... }\n } | {\n value: { ... }\n labels: { ... }\n }>\n }\n protected?: boolean\n created_at: string // date-time\n updated_at: string // date-time\n}\n```\n\n### `EnvironmentVariableList`\n\n```ts\ntype EnvironmentVariableList = {\n items: Array<{\n key: string\n type: \"String\" | \"SecretString\" | \"Text\" | \"Number\" | \"Boolean\" | \"Options\"\n description?: string\n group?: string\n value?: string | number | boolean | {\n fallbackLanguage?: { ... }\n options: { ... }\n }\n protected?: boolean\n created_at: string // date-time\n updated_at: string // date-time\n }>\n}\n```\n\n### `EnvironmentVariableCreateRequest`\n\n```ts\ntype EnvironmentVariableCreateRequest = {\n key: string\n type: \"String\" | \"SecretString\" | \"Text\" | \"Number\" | \"Boolean\" | \"Options\"\n description?: string\n group?: string\n value?: string | number | boolean | {\n fallbackLanguage?: string\n options: Array<{\n value: { ... }\n label: { ... }\n } | {\n value: { ... }\n labels: { ... }\n }>\n }\n protected?: boolean\n}\n```\n\n### `EnvironmentVariableUpdateRequest`\n\n```ts\ntype EnvironmentVariableUpdateRequest = {\n type?: \"String\" | \"SecretString\" | \"Text\" | \"Number\" | \"Boolean\" | \"Options\"\n value?: string | number | boolean | {\n fallbackLanguage?: string\n options: Array<{\n value: { ... }\n label: { ... }\n } | {\n value: { ... }\n labels: { ... }\n }>\n }\n description?: string\n group?: string\n protected?: boolean\n}\n```\n\n### `EnvironmentGroup`\n\n```ts\ntype EnvironmentGroup = {\n name: string\n description?: string\n created_at: string // date-time\n updated_at: string // date-time\n}\n```\n\n### `EnvironmentGroupList`\n\n```ts\ntype EnvironmentGroupList = {\n items: Array<{\n name: string\n description?: string\n created_at: string // date-time\n updated_at: string // date-time\n }>\n}\n```\n\n### `EnvironmentGroupUpsertRequest`\n\n```ts\ntype EnvironmentGroupUpsertRequest = {\n description?: string\n}\n```\n" diff --git a/packages/epilot-sdk-v2/src/types/environments.d.ts b/packages/epilot-sdk-v2/src/types/environments.d.ts index 6021d37b..a59fd1b7 100644 --- a/packages/epilot-sdk-v2/src/types/environments.d.ts +++ b/packages/epilot-sdk-v2/src/types/environments.d.ts @@ -21,44 +21,129 @@ export declare namespace Components { export interface EnvironmentGroupUpsertRequest { description?: string; } - export type EnvironmentValueType = "String" | "SecretString"; + export type EnvironmentOption = { + value: string; + label: string; + } | { + value: string; + labels: { + [name: string]: string; + }; + }; + /** + * A variable's value. The JSON type corresponds to the variable's `type`: + * `String`, `SecretString` and `Text` are strings, `Number` is a number, + * `Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754 + * doubles; integers above 2^53 may lose precision on round-trip. + * + */ + export type EnvironmentValue = /** + * A variable's value. The JSON type corresponds to the variable's `type`: + * `String`, `SecretString` and `Text` are strings, `Number` is a number, + * `Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754 + * doubles; integers above 2^53 may lose precision on round-trip. + * + */ + string | number | boolean | OptionsValue; + /** + * The structure a variable's value holds. `SecretString` is encrypted at rest and + * its value is never returned. `Text`, `Number`, `Boolean` and `Options` may be + * served to browser-facing consumers; `String` and `SecretString` may not. + * + */ + export type EnvironmentValueType = "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Options"; export interface EnvironmentVariable { key: string; // ^[a-z0-9][a-z0-9_.\-]{0,127}$ - type: EnvironmentValueType; + type: /** + * The structure a variable's value holds. `SecretString` is encrypted at rest and + * its value is never returned. `Text`, `Number`, `Boolean` and `Options` may be + * served to browser-facing consumers; `String` and `SecretString` may not. + * + */ + EnvironmentValueType; description?: string; /** * Optional group name for organising variables in the UI */ group?: string; /** - * Value is returned for String type, omitted for SecretString + * Returned for non-secret types, omitted for SecretString. Also omitted when + * the variable has been created without a value — for example by a blueprint + * install, which syncs a variable's key and type but never its value. + * + */ + value?: /** + * Returned for non-secret types, omitted for SecretString. Also omitted when + * the variable has been created without a value — for example by a blueprint + * install, which syncs a variable's key and type but never its value. + * */ - value?: string; + string | number | boolean | OptionsValue; + /** + * Whether the variable is protected from editing + */ + protected?: boolean; created_at: string; // date-time updated_at: string; // date-time } export interface EnvironmentVariableCreateRequest { key: string; // ^[a-z0-9][a-z0-9_.\-]{0,127}$ - type: EnvironmentValueType; + type: /** + * The structure a variable's value holds. `SecretString` is encrypted at rest and + * its value is never returned. `Text`, `Number`, `Boolean` and `Options` may be + * served to browser-facing consumers; `String` and `SecretString` may not. + * + */ + EnvironmentValueType; description?: string; group?: string; - value?: string; + value?: /** + * A variable's value. The JSON type corresponds to the variable's `type`: + * `String`, `SecretString` and `Text` are strings, `Number` is a number, + * `Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754 + * doubles; integers above 2^53 may lose precision on round-trip. + * + */ + EnvironmentValue; + /** + * Whether the variable is protected from editing + */ + protected?: boolean; } export interface EnvironmentVariableList { items: EnvironmentVariableListItem[]; } export interface EnvironmentVariableListItem { key: string; - type: EnvironmentValueType; + type: /** + * The structure a variable's value holds. `SecretString` is encrypted at rest and + * its value is never returned. `Text`, `Number`, `Boolean` and `Options` may be + * served to browser-facing consumers; `String` and `SecretString` may not. + * + */ + EnvironmentValueType; description?: string; /** * Optional group name for organising variables in the UI */ group?: string; /** - * Value is returned for String type, omitted for SecretString + * Returned for non-secret types, omitted for SecretString. Also omitted when + * the variable has been created without a value — for example by a blueprint + * install, which syncs a variable's key and type but never its value. + * + */ + value?: /** + * Returned for non-secret types, omitted for SecretString. Also omitted when + * the variable has been created without a value — for example by a blueprint + * install, which syncs a variable's key and type but never its value. + * + */ + string | number | boolean | OptionsValue; + /** + * Whether the variable is protected from editing */ - value?: string; + protected?: boolean; created_at: string; // date-time updated_at: string; // date-time } @@ -66,10 +151,28 @@ export declare namespace Components { /** * Type of variable. Used when creating a new variable. Defaults to String. */ - type?: "String" | "SecretString"; - value?: string; + type?: "String" | "SecretString" | "Text" | "Number" | "Boolean" | "Options"; + value?: /** + * A variable's value. The JSON type corresponds to the variable's `type`: + * `String`, `SecretString` and `Text` are strings, `Number` is a number, + * `Boolean` is a boolean, and `Options` is an object. Numbers are IEEE 754 + * doubles; integers above 2^53 may lose precision on round-trip. + * + */ + EnvironmentValue; description?: string; group?: string; + /** + * Whether the variable is protected from editing + */ + protected?: boolean; + } + export interface OptionsValue { + fallbackLanguage?: string; + options: [ + EnvironmentOption, + ...EnvironmentOption[] + ]; } } } @@ -177,6 +280,8 @@ export declare namespace Paths { } export interface $403 { } + export interface $409 { + } export interface $500 { } } @@ -202,7 +307,7 @@ export declare namespace Paths { export interface OperationMethods { /** - * listEnvironmentVariables - List environment variables + * listEnvironmentVariables - listEnvironmentVariables * * List all environment variables for the organization. Returns metadata only, no secret values. */ @@ -212,9 +317,9 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * createEnvironmentVariable - Create environment variable + * createEnvironmentVariable - createEnvironmentVariable * - * Create a new environment variable or secret for the organization. + * Create a new environment variable or secret for the organization. If `group` is provided and the group does not yet exist, it is created automatically. */ 'createEnvironmentVariable'( parameters?: Parameters | null, @@ -222,7 +327,7 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * listEnvironmentGroups - List environment groups + * listEnvironmentGroups - listEnvironmentGroups * * List all environment groups for the organization. */ @@ -233,6 +338,8 @@ export interface OperationMethods { ): OperationResponse /** * putEnvironmentGroup - putEnvironmentGroup + * + * Create or update an environment group by name. Acts as an upsert — creates the group if it does not exist. */ 'putEnvironmentGroup'( parameters?: Parameters | null, @@ -240,7 +347,7 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * deleteEnvironmentGroup - Delete an environment group + * deleteEnvironmentGroup - deleteEnvironmentGroup * * Deletes a group. Variables assigned to this group become ungrouped. */ @@ -250,9 +357,9 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * getEnvironmentVariable - Get environment variable + * getEnvironmentVariable - getEnvironmentVariable * - * Get an environment variable by key. Returns value only for String type, omitted for SecretString. + * Get an environment variable by key. Returns value for non-secret types, omitted for SecretString. */ 'getEnvironmentVariable'( parameters?: Parameters | null, @@ -260,9 +367,9 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * updateEnvironmentVariable - Update environment variable + * updateEnvironmentVariable - updateEnvironmentVariable * - * Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist. + * Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist. If `group` is provided and the group does not yet exist, it is created automatically. */ 'updateEnvironmentVariable'( parameters?: Parameters | null, @@ -270,7 +377,7 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * deleteEnvironmentVariable - Delete environment variable + * deleteEnvironmentVariable - deleteEnvironmentVariable * * Delete an environment variable by key. */ @@ -284,7 +391,7 @@ export interface OperationMethods { export interface PathsDictionary { ['/v1/environments']: { /** - * listEnvironmentVariables - List environment variables + * listEnvironmentVariables - listEnvironmentVariables * * List all environment variables for the organization. Returns metadata only, no secret values. */ @@ -294,9 +401,9 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse /** - * createEnvironmentVariable - Create environment variable + * createEnvironmentVariable - createEnvironmentVariable * - * Create a new environment variable or secret for the organization. + * Create a new environment variable or secret for the organization. If `group` is provided and the group does not yet exist, it is created automatically. */ 'post'( parameters?: Parameters | null, @@ -306,7 +413,7 @@ export interface PathsDictionary { } ['/v1/environments/groups']: { /** - * listEnvironmentGroups - List environment groups + * listEnvironmentGroups - listEnvironmentGroups * * List all environment groups for the organization. */ @@ -319,6 +426,8 @@ export interface PathsDictionary { ['/v1/environments/groups/{name}']: { /** * putEnvironmentGroup - putEnvironmentGroup + * + * Create or update an environment group by name. Acts as an upsert — creates the group if it does not exist. */ 'put'( parameters?: Parameters | null, @@ -326,7 +435,7 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse /** - * deleteEnvironmentGroup - Delete an environment group + * deleteEnvironmentGroup - deleteEnvironmentGroup * * Deletes a group. Variables assigned to this group become ungrouped. */ @@ -338,9 +447,9 @@ export interface PathsDictionary { } ['/v1/environments/{key}']: { /** - * getEnvironmentVariable - Get environment variable + * getEnvironmentVariable - getEnvironmentVariable * - * Get an environment variable by key. Returns value only for String type, omitted for SecretString. + * Get an environment variable by key. Returns value for non-secret types, omitted for SecretString. */ 'get'( parameters?: Parameters | null, @@ -348,9 +457,9 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse /** - * updateEnvironmentVariable - Update environment variable + * updateEnvironmentVariable - updateEnvironmentVariable * - * Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist. + * Create or update an environment variable. Acts as an upsert — creates the variable if it does not exist. If `group` is provided and the group does not yet exist, it is created automatically. */ 'put'( parameters?: Parameters | null, @@ -358,7 +467,7 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse /** - * deleteEnvironmentVariable - Delete environment variable + * deleteEnvironmentVariable - deleteEnvironmentVariable * * Delete an environment variable by key. */ @@ -376,9 +485,12 @@ export type Client = OpenAPIClient export type EnvironmentGroup = Components.Schemas.EnvironmentGroup; export type EnvironmentGroupList = Components.Schemas.EnvironmentGroupList; export type EnvironmentGroupUpsertRequest = Components.Schemas.EnvironmentGroupUpsertRequest; +export type EnvironmentOption = Components.Schemas.EnvironmentOption; +export type EnvironmentValue = Components.Schemas.EnvironmentValue; export type EnvironmentValueType = Components.Schemas.EnvironmentValueType; export type EnvironmentVariable = Components.Schemas.EnvironmentVariable; export type EnvironmentVariableCreateRequest = Components.Schemas.EnvironmentVariableCreateRequest; export type EnvironmentVariableList = Components.Schemas.EnvironmentVariableList; export type EnvironmentVariableListItem = Components.Schemas.EnvironmentVariableListItem; export type EnvironmentVariableUpdateRequest = Components.Schemas.EnvironmentVariableUpdateRequest; +export type OptionsValue = Components.Schemas.OptionsValue;