UNPKG

@launchdarkly/mcp-server

Version:

The local [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for [LaunchDarkly](https://launchdarkly.com/) federal and European Union (EU) environments.

200 lines • 13.1 kB
"use strict"; /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.featureFlagsList = featureFlagsList; const encodings_js_1 = require("../lib/encodings.js"); const M = __importStar(require("../lib/matchers.js")); const primitives_js_1 = require("../lib/primitives.js"); const schemas_js_1 = require("../lib/schemas.js"); const security_js_1 = require("../lib/security.js"); const url_js_1 = require("../lib/url.js"); const components = __importStar(require("../models/components/index.js")); const errors = __importStar(require("../models/errors/index.js")); const operations = __importStar(require("../models/operations/index.js")); const async_js_1 = require("../types/async.js"); /** * List feature flags * * @remarks * Get a list of all feature flags in the given project. You can include information specific to different environments by adding `env` query parameter. For example, setting `env=production` adds configuration details about your production environment to the response. You can also filter feature flags by tag with the `tag` query parameter. * * > #### Recommended use * > * > This endpoint can return a large amount of information. We recommend using some or all of these query parameters to decrease response time and overall payload size: `limit`, `env`, `query`, and `filter=creationDate`. * * ### Filtering flags * * You can filter on certain fields using the `filter` query parameter. For example, setting `filter=query:dark-mode,tags:beta+test` matches flags with the string `dark-mode` in their key or name, ignoring case, which also have the tags `beta` and `test`. * * The `filter` query parameter supports the following arguments: * * | Filter argument | Description | Example | * |-----------------------|-------------|----------------------| * | `applicationEvaluated` | A string. It filters the list to flags that are evaluated in the application with the given key. | `filter=applicationEvaluated:com.launchdarkly.cafe` | * | `archived` | (deprecated) A boolean value. It filters the list to archived flags. | Use `filter=state:archived` instead | * | `contextKindsEvaluated` | A `+`-separated list of context kind keys. It filters the list to flags which have been evaluated in the past 30 days for all of the context kinds in the list. | `filter=contextKindsEvaluated:user+application` | * | `codeReferences.max` | An integer value. Use `0` to return flags that do not have code references. | `filter=codeReferences.max:0` | * | `codeReferences.min` | An integer value. Use `1` to return flags that do have code references. | `filter=codeReferences.min:1` | * | `creationDate` | An object with an optional `before` field whose value is Unix time in milliseconds. It filters the list to flags created before the date. | `filter=creationDate:{"before":1690527600000}` | * | `evaluated` | An object that contains a key of `after` and a value in Unix time in milliseconds. It filters the list to all flags that have been evaluated since the time you specify, in the environment provided. This filter requires the `filterEnv` filter. | `filter=evaluated:{"after":1690527600000},filterEnv:production` | * | `filterEnv` | A valid environment key. You must use this field for filters that are environment-specific. If there are multiple environment-specific filters, you only need to include this field once. | `filter=evaluated:{"after": 1590768455282},filterEnv:production` | * | `guardedRollout` | A string, one of `any`, `monitoring`, `regressed`, `rolledBack`, `completed`, `archived`. It filters the list to flags that are part of guarded rollouts. | `filter=guardedRollout:monitoring` | * | `hasExperiment` | A boolean value. It filters the list to flags that are used in an experiment. | `filter=hasExperiment:true` | * | `maintainerId` | A valid member ID. It filters the list to flags that are maintained by this member. | `filter=maintainerId:12ab3c45de678910abc12345` | * | `maintainerTeamKey` | A string. It filters the list to flags that are maintained by the team with this key. | `filter=maintainerTeamKey:example-team-key` | * | `query` | A string. It filters the list to flags that include the specified string in their key or name. It is not case sensitive. | `filter=query:example` | * | `releasePipeline` | A release pipeline key. It filters the list to flags that are either currently active in the release pipeline or have completed the release pipeline. | `filter=releasePipeline:default-release-pipeline` | * | `state` | A string, either `live`, `deprecated`, or `archived`. It filters the list to flags in this state. | `filter=state:archived` | * | `sdkAvailability` | A string, one of `client`, `mobile`, `anyClient`, `server`. Using `client` filters the list to flags whose client-side SDK availability is set to use the client-side ID. Using `mobile` filters to flags set to use the mobile key. Using `anyClient` filters to flags set to use either the client-side ID or the mobile key. Using `server` filters to flags set to use neither, that is, to flags only available in server-side SDKs. | `filter=sdkAvailability:client` | * | `tags` | A `+`-separated list of tags. It filters the list to flags that have all of the tags in the list. | `filter=tags:beta+test` | * | `type` | A string, either `temporary` or `permanent`. It filters the list to flags with the specified type. | `filter=type:permanent` | * * The documented values for the `filter` query are prior to URL encoding. For example, the `+` in `filter=tags:beta+test` must be encoded to `%2B`. * * By default, this endpoint returns all flags. You can page through the list with the `limit` parameter and by following the `first`, `prev`, `next`, and `last` links in the returned `_links` field. These links will not be present if the pages they refer to don't exist. For example, the `first` and `prev` links will be missing from the response on the first page. * * ### Sorting flags * * You can sort flags based on the following fields: * * - `creationDate` sorts by the creation date of the flag. * - `key` sorts by the key of the flag. * - `maintainerId` sorts by the flag maintainer. * - `name` sorts by flag name. * - `tags` sorts by tags. * - `targetingModifiedDate` sorts by the date that the flag's targeting rules were last modified in a given environment. It must be used with `env` parameter and it can not be combined with any other sort. If multiple `env` values are provided, it will perform sort using the first one. For example, `sort=-targetingModifiedDate&env=production&env=staging` returns results sorted by `targetingModifiedDate` for the `production` environment. * - `type` sorts by flag type * * All fields are sorted in ascending order by default. To sort in descending order, prefix the field with a dash ( - ). For example, `sort=-name` sorts the response by flag name in descending order. * * ### Expanding response * * LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields: * * - `codeReferences` includes code references for the feature flag * - `evaluation` includes evaluation information within returned environments, including which context kinds the flag has been evaluated for in the past 30 days * - `migrationSettings` includes migration settings information within the flag and within returned environments. These settings are only included for migration flags, that is, where `purpose` is `migration`. * * For example, `expand=evaluation` includes the `evaluation` field in the response. * * ### Migration flags * For migration flags, the cohort information is included in the `rules` property of a flag's response, and default cohort information is included in the `fallthrough` property of a flag's response. * To learn more, read [Migration Flags](https://launchdarkly.com/docs/home/flags/migration). */ function featureFlagsList(client, request, options) { return new async_js_1.APIPromise($do(client, request, options)); } async function $do(client, request, options) { const parsed = (0, schemas_js_1.safeParse)(request, (value) => operations.GetFeatureFlagsRequest$outboundSchema.parse(value), "Input validation failed"); if (!parsed.ok) { return [parsed, { status: "invalid" }]; } const payload = parsed.value; const body = null; const pathParams = { projectKey: (0, encodings_js_1.encodeSimple)("projectKey", payload.projectKey, { explode: false, charEncoding: "percent", }), }; const path = (0, url_js_1.pathToFunc)("/api/v2/flags/{projectKey}")(pathParams); const query = (0, encodings_js_1.encodeFormQuery)({ "archived": payload.archived, "compare": payload.compare, "env": payload.env, "expand": payload.expand, "filter": payload.filter, "limit": payload.limit, "offset": payload.offset, "sort": payload.sort, "summary": payload.summary, "tag": payload.tag, }); const headers = new Headers((0, primitives_js_1.compactMap)({ Accept: "application/json", })); const secConfig = await (0, security_js_1.extractSecurity)(client._options.apiKey); const securityInput = secConfig == null ? {} : { apiKey: secConfig }; const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput); const context = { options: client._options, baseURL: options?.serverURL ?? client._baseURL ?? "", operationID: "getFeatureFlags", oAuth2Scopes: null, resolvedSecurity: requestSecurity, securitySource: client._options.apiKey, retryConfig: options?.retries || client._options.retryConfig || { strategy: "none" }, retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", baseURL: options?.serverURL, path: path, headers: headers, query: query, body: body, userAgent: client._options.userAgent, timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, }, options); if (!requestRes.ok) { return [requestRes, { status: "invalid" }]; } const req = requestRes.value; const doResult = await client._do(req, { context, errorCodes: ["400", "401", "403", "404", "429", "4XX", "5XX"], retryConfig: context.retryConfig, retryCodes: context.retryCodes, }); if (!doResult.ok) { return [doResult, { status: "request-error", request: req }]; } const response = doResult.value; const responseFields = { HttpMeta: { Response: response, Request: req }, }; const [result] = await M.match(M.json(200, components.FeatureFlags$inboundSchema), M.jsonErr(400, errors.InvalidRequestErrorRep$inboundSchema), M.jsonErr(401, errors.UnauthorizedErrorRep$inboundSchema), M.jsonErr(403, errors.ForbiddenErrorRep$inboundSchema), M.jsonErr(404, errors.NotFoundErrorRep$inboundSchema), M.jsonErr(429, errors.RateLimitedErrorRep$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields }); if (!result.ok) { return [result, { status: "complete", request: req, response }]; } return [result, { status: "complete", request: req, response }]; } //# sourceMappingURL=featureFlagsList.js.map