diff --git a/.changeset/update-forge-af1cbe5ccd4d.md b/.changeset/update-forge-af1cbe5ccd4d.md new file mode 100644 index 000000000..efbf19700 --- /dev/null +++ b/.changeset/update-forge-af1cbe5ccd4d.md @@ -0,0 +1,6 @@ +--- +"cf": minor +--- + +Update the generated command surface and vendored Forge packages for +Forge OpenAPI release `af1cbe5ccd4d92c232d8cd9c10a42a49e276238c`. diff --git a/packages/cli/generate.ts b/packages/cli/generate.ts index 7bc2cdd0a..1d81c965b 100644 --- a/packages/cli/generate.ts +++ b/packages/cli/generate.ts @@ -21,7 +21,7 @@ const sdkDir = fileURLToPath(new URL("./src/sdk", import.meta.url)); const sdkEntrypointPath = join(sdkDir, "sdk/index.ts"); const sdkVersionPath = join(sdkDir, "openapi-version"); // The SDK is committed. Bump this SHA to regenerate it from a new release. -const FORGE_OPENAPI_VERSION = "3a9c5f0fb42a5ce4e8c09b78a19f6f003a2ee7c8"; +const FORGE_OPENAPI_VERSION = "af1cbe5ccd4d92c232d8cd9c10a42a49e276238c"; const FORGE_OPENAPI_RELEASE = `openapi@${FORGE_OPENAPI_VERSION}`; const FORGE_OPENAPI_ASSET = "openapi.forge.json"; const FORGE_OPENAPI_ASSET_URL = `https://github.com/cloudflare/forge/releases/download/${FORGE_OPENAPI_RELEASE}/${FORGE_OPENAPI_ASSET}`; diff --git a/packages/cli/src/commands/_generated/_meta/commands.json b/packages/cli/src/commands/_generated/_meta/commands.json index 7b221cf57..ee4879447 100644 --- a/packages/cli/src/commands/_generated/_meta/commands.json +++ b/packages/cli/src/commands/_generated/_meta/commands.json @@ -1462,7 +1462,7 @@ "command": "cf accounts applications list", "name": "list", "fullPath": ["accounts", "applications", "list"], - "description": "List the applications available to an account, both the applications Cloudflare curates and the custom applications the account has defined. Results are paginated. Use `filter` and `search` to narrow the list, `order_by` to sort it, and `fields` to reduce each result to only the properties you need. Use `lookup` to find complete application names mentioned in a rule sentence, ignoring case. Lookup does not correct misspellings. It ranks matches by relevance and uses the same filters, fields, and pagination as listing. `lookup` cannot be combined with `search`. The authenticated principal must have access to the account identified by `account_id`.", + "description": "List the applications available to an account, both the applications Cloudflare curates and the custom applications the account has defined. Results are paginated. Use `filter` and `search` to narrow the list, `order_by` to sort it, and `fields` to reduce each result to only the properties you need. Use `lookup` to find complete application names mentioned in a rule sentence, ignoring case. Lookup does not correct misspellings. It ranks matches by relevance and uses the same filters, fields, and pagination as listing. `lookup` cannot be combined with `search`. Invalid UTF-8 or a NUL character (U+0000) in any query parameter name or value returns `400`. The authenticated principal must have access to the account identified by `account_id`.", "summary": "List applications", "usage": "cf accounts applications list [options]", "arguments": [], @@ -1501,7 +1501,7 @@ "name": "lookup", "type": "string", "required": false, - "description": "Find complete, case-insensitive application name mentions in a phrase or\nrule sentence. Misspelled names do not match. Returns matching applications\nranked by relevance. Must be between 2 and 1000 characters. Uses the same\nfilters, fields, and pagination as listing. `search` cannot be combined\nwith lookup. Results are ranked by relevance, so `order_by` is ignored." + "description": "Find complete, case-insensitive application name mentions in a phrase or\nrule sentence. Misspelled names do not match. Returns matching applications\nranked by relevance. Must be between 2 and 1000 characters, with no control\ncharacters other than tab and line breaks. Uses the same\nfilters, fields, and pagination as listing. `search` cannot be combined\nwith lookup. Results are ranked by relevance, so `order_by` is ignored.\nTo keep the text out of URLs, send it to `POST .../applications/lookup` instead." }, { "name": "fields", @@ -1524,6 +1524,60 @@ "operationId": "getResourceLibraryApplications", "hideCommand": false }, + { + "command": "cf accounts applications lookup", + "name": "lookup", + "fullPath": ["accounts", "applications", "lookup"], + "description": "Find complete application names mentioned in a rule sentence, ignoring case. Lookup does not correct misspellings. Matches are ranked by relevance. This endpoint takes the rule sentence in the request body, so the text stays out of URLs and request logs. Use it instead of the `lookup` query parameter on the list endpoint when the text may contain sensitive content. `fields`, `limit`, and `filter` work the same way as on the list endpoint and are passed as query parameters. Results are not paged: `offset`, `order_by`, `search`, and `lookup` query parameters return `400`. Unknown request body properties also return `400`. Invalid UTF-8 or a NUL character (U+0000) in any query parameter name or value returns `400`. The authenticated principal must have access to the account identified by `account_id`.", + "summary": "Look up applications in a rule sentence", + "usage": "cf accounts applications lookup [options]", + "arguments": [], + "options": [ + { + "name": "filter", + "type": "string", + "required": false, + "description": "Filter matches using the same `key:value` filters as the list endpoint." + }, + { + "name": "limit", + "type": "number", + "required": false, + "description": "Maximum number of matches to return. Defaults to 25; values are clamped to 1–250." + }, + { + "name": "fields", + "type": "string", + "required": false, + "description": "Return only the listed properties on each application, as a comma-separated list.\nAccepts the same properties as the list endpoint. `id` is always returned.\nOmit this parameter to receive the full application object." + }, + { + "name": "lookup", + "type": "string", + "required": true, + "description": "Rule sentence to search for complete application names. Leading and trailing\nwhitespace is trimmed before the length is checked. Control characters other\nthan tab and line breaks return `400`.\n" + }, + { + "name": "dry-run", + "type": "boolean", + "required": false, + "description": "Validate and show what would happen without executing", + "default": false + }, + { + "name": "body", + "type": "string", + "required": false, + "description": "Raw JSON request body (bypasses individual flags)" + } + ], + "category": "action", + "hasRequestBody": true, + "httpMethod": "POST", + "apiPath": "/accounts/{account_id}/resource-library/applications/lookup", + "operationId": "lookupResourceLibraryApplications", + "hideCommand": false + }, { "command": "cf accounts applications update", "name": "update", diff --git a/packages/cli/src/commands/_generated/_meta/schemas.json b/packages/cli/src/commands/_generated/_meta/schemas.json index be2fdcfc5..ddfec674c 100644 --- a/packages/cli/src/commands/_generated/_meta/schemas.json +++ b/packages/cli/src/commands/_generated/_meta/schemas.json @@ -935,6 +935,44 @@ "hasRequestBody": false, "requestBodyFields": [] }, + "accounts applications lookup": { + "operationId": "lookupResourceLibraryApplications", + "httpMethod": "POST", + "path": "/accounts/{account_id}/resource-library/applications/lookup", + "pathParams": [ + { + "name": "account_id", + "type": "string", + "required": true + } + ], + "queryParams": [ + { + "name": "filter", + "type": "string", + "required": false + }, + { + "name": "limit", + "type": "number", + "required": false + }, + { + "name": "fields", + "type": "string", + "required": false + } + ], + "hasRequestBody": true, + "requestBodyFields": [ + { + "name": "lookup", + "type": "string", + "required": true, + "description": "Rule sentence to search for complete application names. Leading and trailing\nwhitespace is trimmed before the length is checked. Control characters other\nthan tab and line breaks return `400`.\n" + } + ] + }, "accounts applications update": { "operationId": "updateResourceLibraryApplication", "httpMethod": "PATCH", diff --git a/packages/cli/src/commands/_generated/accounts/applications/create.ts b/packages/cli/src/commands/_generated/accounts/applications/create.ts index c7e3a0b4a..5deddb25a 100644 --- a/packages/cli/src/commands/_generated/accounts/applications/create.ts +++ b/packages/cli/src/commands/_generated/accounts/applications/create.ts @@ -64,7 +64,7 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: - "Defines a custom application. At least one hostname or IP subnet is required. Support domains and port/protocol pairs do not satisfy this requirement. ", + "Defines a custom application. At least one hostname or IP subnet is required. Support domains and port/protocol pairs do not satisfy this requirement. A NUL character (U+0000) in any string value returns \`400\`. ", }); } diff --git a/packages/cli/src/commands/_generated/accounts/applications/index.ts b/packages/cli/src/commands/_generated/accounts/applications/index.ts index 8a25368c5..519a411d6 100644 --- a/packages/cli/src/commands/_generated/accounts/applications/index.ts +++ b/packages/cli/src/commands/_generated/accounts/applications/index.ts @@ -2,6 +2,7 @@ import $create from "./create.js"; import $delete from "./delete.js"; import $get from "./get.js"; import $list from "./list.js"; +import $lookup from "./lookup.js"; import $update from "./update.js"; import type { CommonYargsOptions } from "#lib/cli-types.js"; /** @@ -21,6 +22,7 @@ const command: CommandModule = { .command($delete) .command($get) .command($list) + .command($lookup) .command($update) .demandCommand(1, "Please specify a subcommand"); }, diff --git a/packages/cli/src/commands/_generated/accounts/applications/list.ts b/packages/cli/src/commands/_generated/accounts/applications/list.ts index fca7c6e4e..ff70a3e22 100644 --- a/packages/cli/src/commands/_generated/accounts/applications/list.ts +++ b/packages/cli/src/commands/_generated/accounts/applications/list.ts @@ -20,7 +20,7 @@ import { runWithTelemetry } from "#lib/telemetry/index.js"; function builder(yargs: Argv) { return yargs .usage( - "$0 accounts applications list\n\nList the applications available to an account, both the applications Cloudflare curates and the custom applications the account has defined. Results are paginated. Use `filter` and `search` to narrow the list, `order_by` to sort it, and `fields` to reduce each result to only the properties you need. Use `lookup` to find complete application names mentioned in a rule sentence, ignoring case. Lookup does not correct misspellings. It ranks matches by relevance and uses the same filters, fields, and pagination as listing. `lookup` cannot be combined with `search`. The authenticated principal must have access to the account identified by `account_id`." + "$0 accounts applications list\n\nList the applications available to an account, both the applications Cloudflare curates and the custom applications the account has defined. Results are paginated. Use `filter` and `search` to narrow the list, `order_by` to sort it, and `fields` to reduce each result to only the properties you need. Use `lookup` to find complete application names mentioned in a rule sentence, ignoring case. Lookup does not correct misspellings. It ranks matches by relevance and uses the same filters, fields, and pagination as listing. `lookup` cannot be combined with `search`. Invalid UTF-8 or a NUL character (U+0000) in any query parameter name or value returns `400`. The authenticated principal must have access to the account identified by `account_id`." ) .option("filter", { type: "string", @@ -50,7 +50,7 @@ function builder(yargs: Argv) { .option("lookup", { type: "string", description: - "Find complete, case-insensitive application name mentions in a phrase or\nrule sentence. Misspelled names do not match. Returns matching applications\nranked by relevance. Must be between 2 and 1000 characters. Uses the same\nfilters, fields, and pagination as listing. `search` cannot be combined\nwith lookup. Results are ranked by relevance, so `order_by` is ignored.", + "Find complete, case-insensitive application name mentions in a phrase or\nrule sentence. Misspelled names do not match. Returns matching applications\nranked by relevance. Must be between 2 and 1000 characters, with no control\ncharacters other than tab and line breaks. Uses the same\nfilters, fields, and pagination as listing. `search` cannot be combined\nwith lookup. Results are ranked by relevance, so `order_by` is ignored.\nTo keep the text out of URLs, send it to `POST .../applications/lookup` instead.", }) .option("fields", { type: "string", diff --git a/packages/cli/src/commands/_generated/accounts/applications/lookup.ts b/packages/cli/src/commands/_generated/accounts/applications/lookup.ts new file mode 100644 index 000000000..4299067cc --- /dev/null +++ b/packages/cli/src/commands/_generated/accounts/applications/lookup.ts @@ -0,0 +1,159 @@ +import type { CommonYargsOptions, InferArgs } from "#lib/cli-types.js"; +import type { ArgClassification } from "#lib/telemetry/index.js"; +import type { SdkQuery, SdkRequest } from "#sdk"; +/** + * lookup command + * @generated from apis/overlays/accounts.ts + */ +import type { Argv, CommandModule } from "yargs"; +import { + createCommandClient, + getAccountId, + resolveAccountIdSilent, +} from "#lib/auth.js"; +import { compactBody, parseBody } from "#lib/body-parser.js"; +import { formatDryRun } from "#lib/dry-run.js"; +import { resolveFileToken } from "#lib/input-validation.js"; +import { LOCAL_ACCOUNT_ID } from "#lib/local.js"; +import { formatOutput } from "#lib/output.js"; +import { withProgress } from "#lib/progress.js"; +import { promptForRequiredField } from "#lib/prompt.js"; +import { runWithTelemetry } from "#lib/telemetry/index.js"; + +function builder(yargs: Argv) { + return yargs + .usage( + "$0 accounts applications lookup\n\nFind complete application names mentioned in a rule sentence, ignoring case. Lookup does not correct misspellings. Matches are ranked by relevance. This endpoint takes the rule sentence in the request body, so the text stays out of URLs and request logs. Use it instead of the `lookup` query parameter on the list endpoint when the text may contain sensitive content. `fields`, `limit`, and `filter` work the same way as on the list endpoint and are passed as query parameters. Results are not paged: `offset`, `order_by`, `search`, and `lookup` query parameters return `400`. Unknown request body properties also return `400`. Invalid UTF-8 or a NUL character (U+0000) in any query parameter name or value returns `400`. The authenticated principal must have access to the account identified by `account_id`." + ) + .option("filter", { + type: "string", + description: + "Filter matches using the same `key:value` filters as the list endpoint.", + }) + .option("limit", { + type: "number", + description: + "Maximum number of matches to return. Defaults to 25; values are clamped to 1–250.", + }) + .option("fields", { + type: "string", + description: + "Return only the listed properties on each application, as a comma-separated list.\nAccepts the same properties as the list endpoint. `id` is always returned.\nOmit this parameter to receive the full application object.", + }) + .option("lookup", { + type: "string", + description: + "Rule sentence to search for complete application names. Leading and trailing\nwhitespace is trimmed before the length is checked. Control characters other\nthan tab and line breaks return `400`.\n", + }) + .option("dry-run", { + type: "boolean", + description: "Validate and show what would happen without executing", + default: false, + }) + .option("body", { + type: "string", + description: "Raw JSON request body (bypasses individual flags)", + }); +} + +type Args = InferArgs; + +type Request = SdkRequest<"lookupResourceLibraryApplications">; +type Body = Request; +type Query = SdkQuery<"lookupResourceLibraryApplications">; + +const command: CommandModule = { + command: "lookup", + describe: "Look up applications in a rule sentence", + builder, + handler: async (argv): Promise => + runWithTelemetry( + { + command: "accounts applications lookup", + classification: { + safeFlags: ["dry-run"], + } satisfies ArgClassification, + }, + argv as Record, + async () => { + const queryParams: Query = { + filter: argv["filter"], + limit: argv["limit"], + fields: argv["fields"], + }; + if (argv.dryRun) { + const __cfDryRunAccountId = await resolveAccountIdSilent(); + formatDryRun({ + command: "cf accounts applications lookup", + method: "POST", + url: `https://api.cloudflare.com/client/v4/accounts/${__cfDryRunAccountId ?? ""}/resource-library/applications/lookup`, + pathParams: {}, + query: queryParams, + bodyKind: "json", + body: + argv.body !== undefined + ? parseBody(argv.body) + : compactBody({ + lookup: resolveFileToken( + argv["lookup"] as string | undefined, + "lookup", + "text" + ), + }), + }); + return; + } + const client = await createCommandClient(argv); + const accountId = argv.local ? LOCAL_ACCOUNT_ID : await getAccountId(); + argv.accountId = accountId; + + if (argv.body) { + const bodyData = parseBody(argv.body); + const qs = new URLSearchParams( + Object.entries(queryParams) + .filter(([, v]) => v !== undefined) + .map(([k, v]) => [k, String(v)]) + ).toString(); + const result = await withProgress(`Creating`, async () => + client.accounts.applications.lookup({ + ...bodyData, + account_id: accountId, + ...queryParams, + } satisfies Request) + ); + formatOutput(result, { successLabel: `Created` }); + return; + } + if (argv["lookup"] === undefined) { + argv["lookup"] = await promptForRequiredField( + "lookup", + "Rule sentence to search for complete application names. Leading and trailing whitespace is trimmed before the length is checked. Control characters other than tab and line breaks return \`400\`. " + ); + } + + // Assemble request body from individual flags + const bodyData = compactBody({ + lookup: resolveFileToken( + argv["lookup"] as string | undefined, + "lookup", + "text" + ), + }); + const qs = new URLSearchParams( + Object.entries(queryParams) + .filter(([, v]) => v !== undefined) + .map(([k, v]) => [k, String(v)]) + ).toString(); + const result = await withProgress(`Creating`, async () => + client.accounts.applications.lookup({ + ...bodyData, + account_id: accountId, + ...queryParams, + } satisfies Request) + ); + formatOutput(result, { successLabel: `Created` }); + } + ), +}; + +export default command; diff --git a/packages/cli/src/commands/_generated/accounts/applications/update.ts b/packages/cli/src/commands/_generated/accounts/applications/update.ts index 2a2e98f32..c05d9569f 100644 --- a/packages/cli/src/commands/_generated/accounts/applications/update.ts +++ b/packages/cli/src/commands/_generated/accounts/applications/update.ts @@ -58,7 +58,7 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: - "Update the network matchers for the application. The service preserves omitted matcher lists; send an empty array to clear a list. The resulting application must contain at least one hostname or IP subnet. Support domains and port/protocol pairs do not satisfy this requirement. ", + "Update the network matchers for the application. The service preserves omitted matcher lists; send an empty array to clear a list. The resulting application must contain at least one hostname or IP subnet. Support domains and port/protocol pairs do not satisfy this requirement. A NUL character (U+0000) in any string value returns \`400\`. ", }); } diff --git a/packages/cli/src/sdk/openapi-version b/packages/cli/src/sdk/openapi-version index 44816d7c2..1cdf134cf 100644 --- a/packages/cli/src/sdk/openapi-version +++ b/packages/cli/src/sdk/openapi-version @@ -1 +1 @@ -3a9c5f0fb42a5ce4e8c09b78a19f6f003a2ee7c8 +af1cbe5ccd4d92c232d8cd9c10a42a49e276238c diff --git a/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/Client.ts b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/Client.ts index afe9451af..584e52537 100644 --- a/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/Client.ts +++ b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/Client.ts @@ -35,6 +35,9 @@ export class ApplicationsClient { * relevance and uses the same filters, fields, and pagination as listing. * `lookup` cannot be combined with `search`. * + * Invalid UTF-8 or a NUL character (U+0000) in any query parameter name or value + * returns `400`. + * * The authenticated principal must have access to the account identified by * `account_id`. * @@ -213,6 +216,121 @@ export class ApplicationsClient { ); } + /** + * Find complete application names mentioned in a rule sentence, ignoring case. + * Lookup does not correct misspellings. Matches are ranked by relevance. + * + * This endpoint takes the rule sentence in the request body, so the text stays out + * of URLs and request logs. Use it instead of the `lookup` query parameter on the + * list endpoint when the text may contain sensitive content. + * + * `fields`, `limit`, and `filter` work the same way as on the list endpoint and are + * passed as query parameters. Results are not paged: `offset`, `order_by`, `search`, + * and `lookup` query parameters return `400`. Unknown request body properties also + * return `400`. Invalid UTF-8 or a NUL character (U+0000) in any query parameter + * name or value returns `400`. + * + * The authenticated principal must have access to the account identified by + * `account_id`. + * + * @param {CloudflareApi.accounts.AlexandriaLookupApplicationsRequest} request + * @param {ApplicationsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link CloudflareApi.ForbiddenError} + * @throws {@link CloudflareApi.BadGatewayError} + * @throws {@link CloudflareApi.ServiceUnavailableError} + * @throws {@link errors.CloudflareApiError} + * @throws {@link errors.CloudflareApiTimeoutError} + * + * @example + * await client.accounts.applications.lookup({ + * account_id: "023e105f4ecef8ad9ca31a8372d0c353", + * filter: "supported:GATEWAY", + * fields: "id,name", + * lookup: "block access to Google Chat" + * }) + */ + public lookup( + request: CloudflareApi.accounts.AlexandriaLookupApplicationsRequest, + requestOptions?: ApplicationsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__lookup(request, requestOptions)); + } + + private async __lookup( + request: CloudflareApi.accounts.AlexandriaLookupApplicationsRequest, + requestOptions?: ApplicationsClient.RequestOptions, + ): Promise> { + const { account_id: accountId, filter, limit, fields, ..._body } = request; + const _queryParams: Record = { + filter, + limit, + fields, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + let _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.CloudflareApiEnvironment.Default, + `accounts/${core.url.encodePathParam(accountId)}/resource-library/applications/lookup`, + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), + requestType: "json", + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: _response.body as CloudflareApi.accounts.LookupApplicationsResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 403: + throw new CloudflareApiErrors.ForbiddenError(_response.error.body as unknown, _response.rawResponse); + case 502: + throw new CloudflareApiErrors.BadGatewayError(_response.error.body as unknown, _response.rawResponse); + case 503: + throw new CloudflareApiErrors.ServiceUnavailableError( + _response.error.body as unknown, + _response.rawResponse, + ); + default: + throw new errors.CloudflareApiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/accounts/{account_id}/resource-library/applications/lookup", + ); + } + /** * Retrieve an application available to the account by its numeric application ID. * diff --git a/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/AlexandriaLookupApplicationsRequest.ts b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/AlexandriaLookupApplicationsRequest.ts new file mode 100644 index 000000000..8382f9624 --- /dev/null +++ b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/AlexandriaLookupApplicationsRequest.ts @@ -0,0 +1,31 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * account_id: "023e105f4ecef8ad9ca31a8372d0c353", + * filter: "supported:GATEWAY", + * fields: "id,name", + * lookup: "block access to Google Chat" + * } + */ +export interface AlexandriaLookupApplicationsRequest { + /** Account ID. */ + account_id: string; + /** Filter matches using the same `key:value` filters as the list endpoint. */ + filter?: string; + /** Maximum number of matches to return. Defaults to 25; values are clamped to 1–250. */ + limit?: number; + /** + * Return only the listed properties on each application, as a comma-separated list. + * Accepts the same properties as the list endpoint. `id` is always returned. + * Omit this parameter to receive the full application object. + */ + fields?: string; + /** + * Rule sentence to search for complete application names. Leading and trailing + * whitespace is trimmed before the length is checked. Control characters other + * than tab and line breaks return `400`. + */ + lookup: string; +} diff --git a/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/ListApplicationsRequest.ts b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/ListApplicationsRequest.ts index 053bb4a75..c42d46b3a 100644 --- a/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/ListApplicationsRequest.ts +++ b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/ListApplicationsRequest.ts @@ -44,9 +44,11 @@ export interface ListApplicationsRequest { /** * Find complete, case-insensitive application name mentions in a phrase or * rule sentence. Misspelled names do not match. Returns matching applications - * ranked by relevance. Must be between 2 and 1000 characters. Uses the same + * ranked by relevance. Must be between 2 and 1000 characters, with no control + * characters other than tab and line breaks. Uses the same * filters, fields, and pagination as listing. `search` cannot be combined * with lookup. Results are ranked by relevance, so `order_by` is ignored. + * To keep the text out of URLs, send it to `POST .../applications/lookup` instead. */ lookup?: string; /** diff --git a/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/index.ts b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/index.ts index 176f12eda..121cd7125 100644 --- a/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/index.ts +++ b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/client/requests/index.ts @@ -1,3 +1,4 @@ +export type { AlexandriaLookupApplicationsRequest } from "./AlexandriaLookupApplicationsRequest.js"; export type { AlexandriaUpdateApplicationRequest } from "./AlexandriaUpdateApplicationRequest.js"; export type { CreateApplicationsRequest } from "./CreateApplicationsRequest.js"; export type { DeleteApplicationsRequest } from "./DeleteApplicationsRequest.js"; diff --git a/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/types/LookupApplicationsResponse.ts b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/types/LookupApplicationsResponse.ts new file mode 100644 index 000000000..4475fd58b --- /dev/null +++ b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/types/LookupApplicationsResponse.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as CloudflareApi from "../../../../../index.js"; + +export interface LookupApplicationsResponse { + result: CloudflareApi.AlexandriaApplications; + result_info?: LookupApplicationsResponse.ResultInfo | undefined; +} + +export namespace LookupApplicationsResponse { + export interface ResultInfo { + /** Returns the number of results in this response. */ + count?: number | undefined; + /** Returns the zero-based result offset, not a page number. */ + page?: number | undefined; + /** Returns the effective `limit` for this response. */ + per_page?: number | undefined; + /** Returns the number of results matching the request before pagination. */ + total_count?: number | undefined; + /** Returns the number of pages at the effective `limit`, including 0 when there are no matches. */ + total_pages?: number | undefined; + } +} diff --git a/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/types/index.ts b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/types/index.ts index eb323f1ba..5fd0cc48b 100644 --- a/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/types/index.ts +++ b/packages/cli/src/sdk/sdk/api/resources/accounts/resources/applications/types/index.ts @@ -1 +1,2 @@ export * from "./ListApplicationsResponse.js"; +export * from "./LookupApplicationsResponse.js"; diff --git a/packages/cli/src/sdk/sdk/api/types/AlexandriaCreateApplicationRequest.ts b/packages/cli/src/sdk/sdk/api/types/AlexandriaCreateApplicationRequest.ts index 7ef5fcff4..37186371b 100644 --- a/packages/cli/src/sdk/sdk/api/types/AlexandriaCreateApplicationRequest.ts +++ b/packages/cli/src/sdk/sdk/api/types/AlexandriaCreateApplicationRequest.ts @@ -5,6 +5,7 @@ import * as CloudflareApi from "../index.js"; /** * Defines a custom application. At least one hostname or IP subnet is required. * Support domains and port/protocol pairs do not satisfy this requirement. + * A NUL character (U+0000) in any string value returns `400`. */ export type AlexandriaCreateApplicationRequest = | ({ diff --git a/packages/cli/src/sdk/sdk/sdk-map.json b/packages/cli/src/sdk/sdk/sdk-map.json index b0fc25bd9..9d8bf8f7b 100644 --- a/packages/cli/src/sdk/sdk/sdk-map.json +++ b/packages/cli/src/sdk/sdk/sdk-map.json @@ -26132,7 +26132,7 @@ "path": "/user/load_balancers/pools", "responseType": "PoolsPoolsResponse", "requiredRequestProperties": [ - "__@iterator@7081", + "__@iterator@7090", "anchor", "at", "big", @@ -26321,6 +26321,21 @@ "start" ] }, + "lookupResourceLibraryApplications": { + "accessor": [ + "accounts", + "applications" + ], + "method": "lookup", + "httpMethod": "POST", + "path": "/accounts/{account_id}/resource-library/applications/lookup", + "requestType": "AlexandriaLookupApplicationsRequest", + "responseType": "LookupApplicationsResponse", + "requiredRequestProperties": [ + "account_id", + "lookup" + ] + }, "m-tls-certificate-management-delete-m-tls-certificate": { "accessor": [ "mtlsCertificates" diff --git a/packages/cli/src/sdk/sdk/sdk-operation-types.ts b/packages/cli/src/sdk/sdk/sdk-operation-types.ts index f2d2f0b38..09641d579 100644 --- a/packages/cli/src/sdk/sdk/sdk-operation-types.ts +++ b/packages/cli/src/sdk/sdk/sdk-operation-types.ts @@ -1622,6 +1622,7 @@ export interface SdkOperationRequestMap { "load-balancer-regions-list-regions": CloudflareApi.loadBalancers.ListRegionsRequest; "logpull-list-log-files": CloudflareApi.logs.GetListRequest; "logpull-retrieve-logs": CloudflareApi.logs.GetRetrieveRequest; + "lookupResourceLibraryApplications": CloudflareApi.accounts.AlexandriaLookupApplicationsRequest; "m-tls-certificate-management-delete-m-tls-certificate": CloudflareApi.DeleteMtlsCertificatesRequest; "m-tls-certificate-management-get-m-tls-certificate": CloudflareApi.GetMtlsCertificatesRequest; "m-tls-certificate-management-list-m-tls-certificate-associations": CloudflareApi.mtlsCertificates.GetAssociationsRequest; @@ -3498,6 +3499,7 @@ export interface SdkOperationQueryMap { "load-balancer-regions-list-regions": Pick>; "logpull-list-log-files": Pick>; "logpull-retrieve-logs": Pick>; + "lookupResourceLibraryApplications": Pick>; "m-tls-certificate-management-list-m-tls-certificates": Pick>; "magic-ipsec-tunnels-set-pre-shared-keys-for-ipsec-tunnels": Pick>; "magic-sites-list-sites": Pick>; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ebb1ed481..c23d58ada 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -539,7 +539,7 @@ packages: resolution: {integrity: sha512-87zwEhdT0k26tiLe8F4sdo6MZvfoHDji3GzoPn480aJwgD4OBobEz4Z/Tjf2QVsDyFNhX0+L1rgZQnIErTWEqA==} '@cloudflare/forge-transformer-sdk-ts@file:vendor/cloudflare-forge-transformer-sdk-ts-0.1.0.tgz': - resolution: {integrity: sha512-XF1sH4PZhgSbnBah4OUCJ1WlPJzQHh/gyCC0bgZ04Og3WbadCAbaFPvJlnKNqVBP0hz/uZAxrgnpvE8F3asPog==, tarball: file:vendor/cloudflare-forge-transformer-sdk-ts-0.1.0.tgz} + resolution: {integrity: sha512-/AVcz9RE3WUYcSifly2Qd2sLOCtw359/KntVDOBOIawkzHEhwEsyvFArFaApdH624/xdFkqN0mDRv0vCICNkEA==, tarball: file:vendor/cloudflare-forge-transformer-sdk-ts-0.1.0.tgz} version: 0.1.0 engines: {node: '>=22'} hasBin: true diff --git a/vendor/cloudflare-forge-transformer-sdk-ts-0.1.0.tgz b/vendor/cloudflare-forge-transformer-sdk-ts-0.1.0.tgz index e60496f5c..9820f73c9 100644 Binary files a/vendor/cloudflare-forge-transformer-sdk-ts-0.1.0.tgz and b/vendor/cloudflare-forge-transformer-sdk-ts-0.1.0.tgz differ