diff --git a/.changeset/scope-nested-body-validation.md b/.changeset/scope-nested-body-validation.md new file mode 100644 index 0000000000..02f169b173 --- /dev/null +++ b/.changeset/scope-nested-body-validation.md @@ -0,0 +1,9 @@ +--- +"cf": patch +--- + +Correct generated validation for nested optional request-body objects. + +Required fields are now enforced only when their containing object is supplied. This prevents flags in sibling objects from incorrectly requiring one another and keeps defaults from creating absent optional objects. + +Raw `--body` requests continue to bypass validation for individual body flags. diff --git a/docs/architecture.md b/docs/architecture.md index 65a5de47d1..6a7b9d325e 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -651,7 +651,12 @@ cursor / page flags the underlying op exposes. ### Required-field interactive prompting -When stdin is a TTY and a required body field isn't supplied: +Required fields inside an optional request-body object are validated only when a +flag supplies that object. Omitting the object leaves those nested fields +optional. Because yargs performs this validation before the handler, missing +fields in a supplied optional object are rejected rather than prompted for. + +For other required body fields, when stdin is a TTY and the field is not supplied: - **Plain string fields** → `clack.text` via `promptForRequiredField`. - **Fields marked `x-sensitive: true` by OpenAPI** → diff --git a/packages/cli/generator/plugin/args.ts b/packages/cli/generator/plugin/args.ts index 948ee62925..a9e93ce3dc 100644 --- a/packages/cli/generator/plugin/args.ts +++ b/packages/cli/generator/plugin/args.ts @@ -62,6 +62,8 @@ export interface Arg { required: boolean; positional: boolean; origin: Origin; + /** The nearest optional body object containing this field. */ + optionalParentPath?: readonly string[]; conflicts?: string[]; implies?: string[]; secret: boolean; @@ -397,7 +399,7 @@ export function derive( headerParams(args, op, workers); bodyParams(args, op, overrides, workers); - const optionalParentGroups = optionalParents(args, op); + const optionalParentGroups = optionalParents(args); const upper = op.method.toUpperCase(); const isMutating = upper !== "GET" && upper !== "HEAD"; const hasBody = isMutating && op.hasRequestBody; @@ -478,53 +480,53 @@ export function downgradeOptionalParents(derived: Derived): void { } } -function optionalParents( - args: readonly Arg[], - op: OperationInfo -): OptionalParentGroup[] { - interface Entry { - flag: string; - required: boolean; - hasDefault: boolean; - } - const byParent: [string, Entry[]][] = []; - for (const arg of args) { - if (!isBody(arg) || arg.positional) { +function optionalParents(args: readonly Arg[]): OptionalParentGroup[] { + const bodyArgs = args.filter((arg) => isBody(arg) && !arg.positional); + const parentPaths: string[][] = []; + for (const arg of bodyArgs) { + if (!arg.required || arg.optionalParentPath === undefined) { continue; } - const path = bodyPath(arg); - if (path === undefined || path.length < 2) { - continue; - } - const entry: Entry = { - flag: arg.name, - required: arg.required, - hasDefault: arg.default !== undefined, - }; - const parent = path[0] as string; - const existing = byParent.find(([p]) => p === parent); - if (existing) { - existing[1].push(entry); - } else { - byParent.push([parent, [entry]]); + const parentPath = arg.optionalParentPath; + if (!parentPaths.some((path) => samePath(path, parentPath))) { + parentPaths.push([...parentPath]); } } - const groups: OptionalParentGroup[] = []; - for (const [parent, entries] of byParent) { - if (op.requestBodyRequired.includes(parent)) { - continue; - } - const required = entries.filter((e) => e.required).map((e) => e.flag); - if (required.length === 0) { - continue; - } - groups.push({ - parentName: parent, - groupSetFlags: entries.filter((e) => !e.hasDefault).map((e) => e.flag), - requiredFlags: required, + + return parentPaths.map((parentPath) => { + const entries = bodyArgs.filter((arg) => { + const path = bodyPath(arg); + return path !== undefined && startsWithPath(path, parentPath); }); - } - return groups; + return { + parentName: parentPath.map(kebab).join("-"), + groupSetFlags: entries + .filter((arg) => arg.default === undefined) + .map((arg) => arg.name), + requiredFlags: bodyArgs + .filter( + (arg) => + arg.required && + arg.optionalParentPath !== undefined && + samePath(arg.optionalParentPath, parentPath) + ) + .map((arg) => arg.name), + }; + }); +} + +function samePath(a: readonly string[], b: readonly string[]): boolean { + return a.length === b.length && a.every((segment, i) => segment === b[i]); +} + +function startsWithPath( + path: readonly string[], + prefix: readonly string[] +): boolean { + return ( + path.length > prefix.length && + prefix.every((segment, i) => segment === path[i]) + ); } function arg( @@ -761,6 +763,9 @@ function bodyParams( { in: "body", path }, cls ); + if (bp.optionalParentPath !== null) { + a.optionalParentPath = bp.optionalParentPath; + } a.choices = enumValues; out.push(a); continue; @@ -788,8 +793,7 @@ function bodyParams( } else { effectiveDefault = bp.default; } - const nestedUnderOptional = - path.length > 1 && !op.requestBodyRequired.includes(path[0] as string); + const nestedUnderOptional = bp.optionalParentPath !== null; const dflt = nestedUnderOptional ? undefined : effectiveDefault; const bodyType = bodyArgType(effectiveType, bp.itemType); const type: ArgType = @@ -828,6 +832,9 @@ function bodyParams( { in: "body", path }, cls ); + if (bp.optionalParentPath !== null) { + a.optionalParentPath = bp.optionalParentPath; + } if (type === "enum") { a.choices = enumValues; } diff --git a/packages/cli/generator/plugin/body.ts b/packages/cli/generator/plugin/body.ts index b7372b9ee8..0f76443ed9 100644 --- a/packages/cli/generator/plugin/body.ts +++ b/packages/cli/generator/plugin/body.ts @@ -231,11 +231,19 @@ function scalarProperty( prop: Prop, flag: string, path: string[], - required: boolean + required: boolean, + optionalParentPath: readonly string[] | null ): BodyParamInfo | undefined { const scalar = scalarSchema(schema); if (scalar !== undefined) - return scalarBodyParam(scalar, prop, flag, path, required); + return scalarBodyParam( + scalar, + prop, + flag, + path, + required, + optionalParentPath + ); const variants = schema.oneOf ?? schema.anyOf; if (variants === undefined || variants.length === 0) return undefined; const members = variants.map((variant) => scalarSchema(variant)); @@ -254,12 +262,14 @@ function scalarProperty( prop, flag, path, - required + required, + optionalParentPath ); } return { name: flag, required, + optionalParentPath, type: "scalarUnion", apiFieldPath: path, description: prop.description, @@ -338,7 +348,8 @@ function arrayBodyParam( prop: Prop, name: string, path: string[], - required: boolean + required: boolean, + optionalParentPath: readonly string[] | null ): BodyParamInfo | undefined { const items = array.items; if (!items) { @@ -355,6 +366,7 @@ function arrayBodyParam( const info: BodyParamInfo = { name, required, + optionalParentPath, type: "array", apiFieldPath: path, sensitive: false, @@ -373,11 +385,13 @@ function mapBodyParam( prop: Prop, name: string, path: string[], - required: boolean + required: boolean, + optionalParentPath: readonly string[] | null ): BodyParamInfo { return { name, required, + optionalParentPath, type: "object", apiFieldPath: path, description: prop.description, @@ -390,11 +404,13 @@ function scalarBodyParam( prop: Prop, name: string, path: string[], - required: boolean + required: boolean, + optionalParentPath: readonly string[] | null ): BodyParamInfo { return { name, required, + optionalParentPath, type: resolved.kind === "number" ? "number" @@ -430,6 +446,7 @@ function propertiesFromSchema( prefix: string, path: readonly string[], required: readonly string[], + optionalParentPath: readonly string[] | null, depth: number ): BodyParamInfo[] { if (depth > 3) { @@ -452,22 +469,45 @@ function propertiesFromSchema( const flag = prefix === "" ? segment : `${prefix}-${segment}`; const current = [...path, name]; const isRequired = required.includes(name); - const scalar = scalarProperty(resolved, prop, flag, current, isRequired); + const scalar = scalarProperty( + resolved, + prop, + flag, + current, + isRequired, + optionalParentPath + ); if (scalar !== undefined) { results.push(scalar); continue; } if (resolved.oneOf !== undefined) { + const childOptionalParentPath = isRequired ? optionalParentPath : current; results.push( - ...oneOfConstraints(resolved.oneOf, flag, current, depth + 1) + ...oneOfConstraints( + resolved.oneOf, + flag, + current, + childOptionalParentPath, + depth + 1 + ) ); continue; } if (resolved.allOf !== undefined) { const merged = flattenAllOf(resolved.allOf); if (merged.oneOf !== undefined) { + const childOptionalParentPath = isRequired + ? optionalParentPath + : current; results.push( - ...oneOfConstraints(merged.oneOf, flag, current, depth + 1) + ...oneOfConstraints( + merged.oneOf, + flag, + current, + childOptionalParentPath, + depth + 1 + ) ); continue; } @@ -476,15 +516,19 @@ function propertiesFromSchema( const nested = resolved.allOf !== undefined ? flattenAllOf(resolved.allOf) : resolved; if (nested.map) { - results.push(mapBodyParam(prop, flag, current, isRequired)); + results.push( + mapBodyParam(prop, flag, current, isRequired, optionalParentPath) + ); continue; } + const childOptionalParentPath = isRequired ? optionalParentPath : current; results.push( ...propertiesFromSchema( nested, flag, current, nested.required, + childOptionalParentPath, depth + 1 ) ); @@ -493,9 +537,25 @@ function propertiesFromSchema( resolved.kind === "number" || resolved.kind === "boolean" ) { - results.push(scalarBodyParam(resolved, prop, flag, current, isRequired)); + results.push( + scalarBodyParam( + resolved, + prop, + flag, + current, + isRequired, + optionalParentPath + ) + ); } else if (resolved.kind === "array" && resolved.items !== undefined) { - const info = arrayBodyParam(resolved, prop, flag, current, isRequired); + const info = arrayBodyParam( + resolved, + prop, + flag, + current, + isRequired, + optionalParentPath + ); if (info) { results.push(info); } @@ -610,6 +670,7 @@ function oneOfConstraints( variants: readonly Schema[], prefix: string, path: readonly string[], + optionalParentPath: readonly string[] | null, depth: number ): BodyParamInfo[] { if (depth > 3) { @@ -656,6 +717,7 @@ function oneOfConstraints( prefix, path, common, + optionalParentPath, depth ); @@ -704,7 +766,7 @@ export function bodyProperties(type: Type): BodyParamInfo[] { resolved = flattenAllOf(resolved.allOf); } if (resolved.oneOf !== undefined && resolved.properties === undefined) { - return oneOfConstraints(resolved.oneOf, "", [], 0); + return oneOfConstraints(resolved.oneOf, "", [], null, 0); } const required = resolved.required; const results: BodyParamInfo[] = []; @@ -716,37 +778,67 @@ export function bodyProperties(type: Type): BodyParamInfo[] { const prefix = flagSegment(raw); const path = [raw.name]; const isRequired = required.includes(raw.name); - const scalar = scalarProperty(prop, raw, prefix, path, isRequired); + const scalar = scalarProperty(prop, raw, prefix, path, isRequired, null); if (scalar !== undefined) { results.push(scalar); continue; } if (prop.oneOf !== undefined) { - results.push(...oneOfConstraints(prop.oneOf, prefix, path, 1)); + results.push( + ...oneOfConstraints( + prop.oneOf, + prefix, + path, + isRequired ? null : path, + 1 + ) + ); continue; } if (prop.allOf !== undefined) { const merged = flattenAllOf(prop.allOf); if (merged.map) { - results.push(mapBodyParam(raw, prefix, path, isRequired)); + results.push(mapBodyParam(raw, prefix, path, isRequired, null)); continue; } if (merged.oneOf !== undefined) { - results.push(...oneOfConstraints(merged.oneOf, prefix, path, 1)); + results.push( + ...oneOfConstraints( + merged.oneOf, + prefix, + path, + isRequired ? null : path, + 1 + ) + ); } else { results.push( - ...propertiesFromSchema(merged, prefix, path, merged.required, 1) + ...propertiesFromSchema( + merged, + prefix, + path, + merged.required, + isRequired ? null : path, + 1 + ) ); } continue; } if (prop.map) { - results.push(mapBodyParam(raw, prefix, path, isRequired)); + results.push(mapBodyParam(raw, prefix, path, isRequired, null)); continue; } if (isObjectKind(prop)) { results.push( - ...propertiesFromSchema(prop, prefix, path, prop.required, 1) + ...propertiesFromSchema( + prop, + prefix, + path, + prop.required, + isRequired ? null : path, + 1 + ) ); continue; } @@ -755,9 +847,9 @@ export function bodyProperties(type: Type): BodyParamInfo[] { prop.kind === "number" || prop.kind === "boolean" ) { - results.push(scalarBodyParam(prop, raw, prefix, path, isRequired)); + results.push(scalarBodyParam(prop, raw, prefix, path, isRequired, null)); } else if (prop.kind === "array" && prop.items !== undefined) { - const info = arrayBodyParam(prop, raw, prefix, path, isRequired); + const info = arrayBodyParam(prop, raw, prefix, path, isRequired, null); if (info) { results.push(info); } diff --git a/packages/cli/generator/plugin/emit/builder.ts b/packages/cli/generator/plugin/emit/builder.ts index 5cfe3e5cfe..ffbe324f8e 100644 --- a/packages/cli/generator/plugin/emit/builder.ts +++ b/packages/cli/generator/plugin/emit/builder.ts @@ -175,7 +175,12 @@ export function builderLines(ctx: Ctx): string[] { } } for (const group of d.optionalParentGroups) { - if (group.groupSetFlags.length === 0) { + if ( + group.groupSetFlags.length === 0 || + (group.requiredFlags.length === 1 && + group.groupSetFlags.length === 1 && + group.requiredFlags[0] === group.groupSetFlags[0]) + ) { continue; } const set = `[${quoted(group.groupSetFlags)}]`; @@ -190,7 +195,7 @@ export function builderLines(ctx: Ctx): string[] { lines.push( ` const groupSet = ${set}.some((k) => argv[k] !== undefined);` ); - lines.push(" if (groupSet) {"); + lines.push(" if (!argv.body && groupSet) {"); if (pairs.length === 0) { lines.push( ` const missing = ${required}.filter((k) => argv[k] === undefined);` diff --git a/packages/cli/generator/plugin/operation.ts b/packages/cli/generator/plugin/operation.ts index 7dd9bd2f5c..0832874fcf 100644 --- a/packages/cli/generator/plugin/operation.ts +++ b/packages/cli/generator/plugin/operation.ts @@ -49,6 +49,11 @@ export interface ParameterInfo { export interface BodyParamInfo { name: string; required: boolean; + /** + * The nearest optional object containing this field. A required field is + * required only when this object is present; defaults must not create it. + */ + optionalParentPath: readonly string[] | null; type: string; itemType?: string; description?: string; diff --git a/packages/cli/src/__tests__/generator/plugin/arg-derivation.test.ts b/packages/cli/src/__tests__/generator/plugin/arg-derivation.test.ts index 695f1c355e..04603b8a9b 100644 --- a/packages/cli/src/__tests__/generator/plugin/arg-derivation.test.ts +++ b/packages/cli/src/__tests__/generator/plugin/arg-derivation.test.ts @@ -519,8 +519,14 @@ describe("nested body defaults", () => { name: string, path: string[], required: boolean, - dflt?: string - ) => bodyParam(name, "string", path, { required, default: dflt }); + dflt?: string, + optionalParentPath: string[] | null = null + ) => + bodyParam(name, "string", path, { + required, + default: dflt, + optionalParentPath, + }); const createMethod = baseMethod("create", "test-create", { description: "Create a test resource", }); @@ -530,12 +536,13 @@ describe("nested body defaults", () => { it("does not create an optional parent object", () => { const op = create( [ - field("format-type", ["format", "type"], true), + field("format-type", ["format", "type"], true, undefined, ["format"]), field( "format-compression", ["format", "compression"], false, - "uncompressed" + "uncompressed", + ["format"] ), ], [] @@ -551,6 +558,68 @@ describe("nested body defaults", () => { ]); }); + it("scopes requirements to the nearest optional object", () => { + const op = create( + [ + field( + "rule-settings-add-headers", + ["rule_settings", "add_headers"], + false, + undefined, + ["rule_settings"] + ), + field( + "rule-settings-forward-enabled", + ["rule_settings", "forward", "enabled"], + false, + undefined, + ["rule_settings", "forward"] + ), + field( + "rule-settings-forward-worker-id", + ["rule_settings", "forward", "worker_id"], + true, + undefined, + ["rule_settings", "forward"] + ), + field( + "rule-settings-redirect-include-context", + ["rule_settings", "redirect", "include_context"], + false, + undefined, + ["rule_settings", "redirect"] + ), + field( + "rule-settings-redirect-target-uri", + ["rule_settings", "redirect", "target_uri"], + true, + undefined, + ["rule_settings", "redirect"] + ), + ], + [] + ); + const d = derive(createMethod, "test", op); + expect(d.optionalParentGroups).toEqual([ + { + parentName: "rule-settings-forward", + groupSetFlags: [ + "rule-settings-forward-enabled", + "rule-settings-forward-worker-id", + ], + requiredFlags: ["rule-settings-forward-worker-id"], + }, + { + parentName: "rule-settings-redirect", + groupSetFlags: [ + "rule-settings-redirect-include-context", + "rule-settings-redirect-target-uri", + ], + requiredFlags: ["rule-settings-redirect-target-uri"], + }, + ]); + }); + it("retains a nested default when its parent is required", () => { const op = create( [field("settings-mode", ["settings", "mode"], false, "automatic")], diff --git a/packages/cli/src/__tests__/generator/plugin/emit.test.ts b/packages/cli/src/__tests__/generator/plugin/emit.test.ts index 28150a01b1..8075f4d883 100644 --- a/packages/cli/src/__tests__/generator/plugin/emit.test.ts +++ b/packages/cli/src/__tests__/generator/plugin/emit.test.ts @@ -322,6 +322,72 @@ describe("file-backed enum arguments", () => { }); }); +describe("optional body-object validation", () => { + it("bypasses conditional flag validation only for a non-empty raw body", async () => { + const ctx = context( + method("create", "example-create"), + "example", + operation("post", "/example", { + bodyParams: [ + bodyParam( + "parameters-order-by-order", + "string", + ["parameters", "order_by", "order"], + { + required: true, + optionalParentPath: ["parameters", "order_by"], + } + ), + bodyParam( + "parameters-order-by-value", + "string", + ["parameters", "order_by", "value"], + { + required: true, + optionalParentPath: ["parameters", "order_by"], + } + ), + ], + hasRequestBody: true, + requestContentTypes: ["application/json"], + }) + ); + const builder = new Script( + `(yargs) => yargs\n${builderLines(ctx).join("\n")}` + ).runInNewContext() as (args: Argv) => Argv; + const parse = async (args: string[]) => + yargs(args) + .exitProcess(false) + .fail((message, error) => { + throw error ?? new Error(message); + }) + .command("create", "", builder, () => {}) + .strict() + .parseAsync(); + + await expect( + parse(["create", "--parameters-order-by-order", "asc"]) + ).rejects.toThrow("--parameters-order-by-value is required"); + await expect( + parse(["create", "--body", "", "--parameters-order-by-order", "asc"]) + ).rejects.toThrow("--parameters-order-by-value is required"); + await expect( + parse([ + "create", + "--body", + "", + "--parameters-order-by-order", + "asc", + "--parameters-order-by-value", + "count", + ]) + ).resolves.toMatchObject({ body: "" }); + await expect( + parse(["create", "--body", "{}", "--parameters-order-by-order", "asc"]) + ).resolves.toMatchObject({ body: "{}" }); + }); +}); + describe("passthrough body assembly", () => { it("keeps required headers and query parameters out of the JSON body", () => { const ctx = context( diff --git a/packages/cli/src/__tests__/generator/plugin/forge-model.test.ts b/packages/cli/src/__tests__/generator/plugin/forge-model.test.ts index 1b9fe72f28..e11731dac6 100644 --- a/packages/cli/src/__tests__/generator/plugin/forge-model.test.ts +++ b/packages/cli/src/__tests__/generator/plugin/forge-model.test.ts @@ -366,6 +366,101 @@ describe("the forge model", () => { expect(code).toContain("promptForRequiredField('display-name'"); }); + it("scopes nested required fields to their optional object", () => { + const code = file( + create({ + type: "object", + properties: { + rule_settings: { + type: "object", + properties: { + add_headers: { type: "string" }, + forward: { + type: "object", + required: ["worker_id"], + properties: { + enabled: { type: "boolean" }, + worker_id: { type: "string" }, + }, + }, + redirect: { + type: "object", + required: ["target_uri"], + properties: { + include_context: { type: "boolean" }, + target_uri: { type: "string" }, + }, + }, + }, + }, + }, + }), + "things/create.ts" + ); + expect(code).toContain( + "required when any --rule-settings-forward-* flag is set" + ); + expect(code).toContain( + "required when any --rule-settings-redirect-* flag is set" + ); + expect(code).not.toContain( + "required when any --rule-settings-* flag is set" + ); + }); + + it("carries requirements through required nested objects", () => { + const code = file( + create({ + type: "object", + properties: { + settings: { + type: "object", + required: ["format"], + properties: { + format: { + type: "object", + required: ["type"], + properties: { type: { type: "string" } }, + }, + label: { type: "string" }, + }, + }, + }, + }), + "things/create.ts" + ); + expect(code).toContain("required when any --settings-* flag is set"); + expect(code).toContain("const missing = ['settings-format-type']"); + }); + + it("recognizes an optional nested object under a required object", () => { + const code = file( + create({ + type: "object", + required: ["settings"], + properties: { + settings: { + type: "object", + properties: { + format: { + type: "object", + required: ["type"], + properties: { + compression: { type: "string" }, + type: { type: "string" }, + }, + }, + label: { type: "string" }, + }, + }, + }, + }), + "things/create.ts" + ); + expect(code).toContain("required when any --settings-format-* flag is set"); + expect(code).not.toContain("required when any --settings-* flag is set"); + }); + it("makes the members of a union conflict", () => { const code = file( create( diff --git a/packages/cli/src/__tests__/helpers/cli-plugin.ts b/packages/cli/src/__tests__/helpers/cli-plugin.ts index 987d06d22e..aecfa25557 100644 --- a/packages/cli/src/__tests__/helpers/cli-plugin.ts +++ b/packages/cli/src/__tests__/helpers/cli-plugin.ts @@ -60,6 +60,7 @@ export function bodyParam( type, apiFieldPath: path, required: false, + optionalParentPath: null, sensitive: false, ...rest, }; diff --git a/packages/cli/src/commands/_generated/_meta/commands.json b/packages/cli/src/commands/_generated/_meta/commands.json index 827cfb7765..3c321dac41 100644 --- a/packages/cli/src/commands/_generated/_meta/commands.json +++ b/packages/cli/src/commands/_generated/_meta/commands.json @@ -11503,8 +11503,7 @@ "name": "ai-search-options-reranking-match-threshold", "type": "number", "required": false, - "description": "The ai_search_options.reranking.match_threshold field", - "default": 0.4 + "description": "The ai_search_options.reranking.match_threshold field" }, { "name": "ai-search-options-reranking-model", @@ -11522,8 +11521,7 @@ "name": "ai-search-options-retrieval-context-expansion", "type": "number", "required": false, - "description": "The ai_search_options.retrieval.context_expansion field", - "default": 0 + "description": "The ai_search_options.retrieval.context_expansion field" }, { "name": "ai-search-options-retrieval-filters", @@ -11568,8 +11566,7 @@ "name": "ai-search-options-retrieval-return-on-failure", "type": "boolean", "required": false, - "description": "The ai_search_options.retrieval.return_on_failure field", - "default": true + "description": "The ai_search_options.retrieval.return_on_failure field" }, { "name": "messages", @@ -11692,8 +11689,7 @@ "name": "ai-search-options-reranking-match-threshold", "type": "number", "required": false, - "description": "The ai_search_options.reranking.match_threshold field", - "default": 0.4 + "description": "The ai_search_options.reranking.match_threshold field" }, { "name": "ai-search-options-reranking-model", @@ -11711,8 +11707,7 @@ "name": "ai-search-options-retrieval-context-expansion", "type": "number", "required": false, - "description": "The ai_search_options.retrieval.context_expansion field", - "default": 0 + "description": "The ai_search_options.retrieval.context_expansion field" }, { "name": "ai-search-options-retrieval-filters", @@ -11757,8 +11752,7 @@ "name": "ai-search-options-retrieval-return-on-failure", "type": "boolean", "required": false, - "description": "The ai_search_options.retrieval.return_on_failure field", - "default": true + "description": "The ai_search_options.retrieval.return_on_failure field" }, { "name": "messages", @@ -40167,8 +40161,7 @@ "name": "target-configuration-observability-logs-enabled", "type": "boolean", "required": false, - "description": "The target_configuration.observability.logs.enabled field", - "default": false + "description": "The target_configuration.observability.logs.enabled field" }, { "name": "dry-run", @@ -80241,7 +80234,7 @@ { "name": "parameters-order-by-value", "type": "string", - "required": true, + "required": false, "description": "Configure which Calculation to order the results by." }, { @@ -80391,7 +80384,7 @@ { "name": "parameters-order-by-value", "type": "string", - "required": true, + "required": false, "description": "Configure which Calculation to order the results by." }, { @@ -86632,19 +86625,19 @@ { "name": "destination-credentials-access-key-id", "type": "string", - "required": true, + "required": false, "description": "Specifies the R2 Bucket Access Key Id." }, { "name": "destination-credentials-endpoint", "type": "string", - "required": true, + "required": false, "description": "Specifies the R2 Endpoint." }, { "name": "destination-credentials-secret-access-key", "type": "string", - "required": true, + "required": false, "description": "Specifies the R2 Bucket Secret Access Key." }, { @@ -138258,13 +138251,13 @@ { "name": "settings-context-enricher-escaped-worker-name", "type": "string", - "required": true, + "required": false, "description": "The settings.contextEnricher.escapedWorkerName field" }, { "name": "settings-context-enricher-worker-tag", "type": "string", - "required": true, + "required": false, "description": "The settings.contextEnricher.workerTag field" }, { diff --git a/packages/cli/src/commands/_generated/_meta/schemas.json b/packages/cli/src/commands/_generated/_meta/schemas.json index 0433ed2b3a..acacc8d533 100644 --- a/packages/cli/src/commands/_generated/_meta/schemas.json +++ b/packages/cli/src/commands/_generated/_meta/schemas.json @@ -56277,7 +56277,7 @@ { "name": "parameters-order-by-value", "type": "string", - "required": true, + "required": false, "description": "Configure which Calculation to order the results by." } ] @@ -56396,7 +56396,7 @@ { "name": "parameters-order-by-value", "type": "string", - "required": true, + "required": false, "description": "Configure which Calculation to order the results by." } ] @@ -60932,19 +60932,19 @@ { "name": "destination-credentials-access-key-id", "type": "string", - "required": true, + "required": false, "description": "Specifies the R2 Bucket Access Key Id." }, { "name": "destination-credentials-endpoint", "type": "string", - "required": true, + "required": false, "description": "Specifies the R2 Endpoint." }, { "name": "destination-credentials-secret-access-key", "type": "string", - "required": true, + "required": false, "description": "Specifies the R2 Bucket Secret Access Key." }, { @@ -96224,13 +96224,13 @@ { "name": "settings-context-enricher-escaped-worker-name", "type": "string", - "required": true, + "required": false, "description": "The settings.contextEnricher.escapedWorkerName field" }, { "name": "settings-context-enricher-worker-tag", "type": "string", - "required": true, + "required": false, "description": "The settings.contextEnricher.workerTag field" }, { diff --git a/packages/cli/src/commands/_generated/abuse-reports/mitigations/review.ts b/packages/cli/src/commands/_generated/abuse-reports/mitigations/review.ts index 8eb1d6a9b9..b00ab916e3 100644 --- a/packages/cli/src/commands/_generated/abuse-reports/mitigations/review.ts +++ b/packages/cli/src/commands/_generated/abuse-reports/mitigations/review.ts @@ -126,7 +126,7 @@ function builder(yargs: Argv) { "data-urls", "data-zip-code", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "data-city", "data-country", diff --git a/packages/cli/src/commands/_generated/ai-gateway/gateways/create.ts b/packages/cli/src/commands/_generated/ai-gateway/gateways/create.ts index d9d1588762..dcbd6f867d 100644 --- a/packages/cli/src/commands/_generated/ai-gateway/gateways/create.ts +++ b/packages/cli/src/commands/_generated/ai-gateway/gateways/create.ts @@ -376,7 +376,7 @@ function builder(yargs: Argv) { const groupSet = ["stripe-authorization", "stripe-usage-events"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["stripe-authorization", "stripe-usage-events"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/ai-gateway/gateways/update.ts b/packages/cli/src/commands/_generated/ai-gateway/gateways/update.ts index 8a65e49e4e..b81c93f13f 100644 --- a/packages/cli/src/commands/_generated/ai-gateway/gateways/update.ts +++ b/packages/cli/src/commands/_generated/ai-gateway/gateways/update.ts @@ -380,7 +380,7 @@ function builder(yargs: Argv) { const groupSet = ["stripe-authorization", "stripe-usage-events"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["stripe-authorization", "stripe-usage-events"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/ai-search/create.ts b/packages/cli/src/commands/_generated/ai-search/create.ts index ea069074b6..f5fbe19033 100644 --- a/packages/cli/src/commands/_generated/ai-search/create.ts +++ b/packages/cli/src/commands/_generated/ai-search/create.ts @@ -378,13 +378,13 @@ function builder(yargs: Argv) { const groupSet = ["index-method-keyword", "index-method-vector"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["index-method-keyword", "index-method-vector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --index_method-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --index-method-* flag is set` ); } } @@ -392,19 +392,17 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "metadata-created-from-aisearch-wizard", "metadata-created-from-emdash-plugin-type", "metadata-created-from-emdash-plugin-version", - "metadata-worker-domain", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "metadata-created-from-emdash-plugin-type", "metadata-created-from-emdash-plugin-version", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --metadata-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --metadata-created-from-emdash-plugin-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/ai-search/multi-chat-completions.ts b/packages/cli/src/commands/_generated/ai-search/multi-chat-completions.ts index 6bfd59a726..d13282744f 100644 --- a/packages/cli/src/commands/_generated/ai-search/multi-chat-completions.ts +++ b/packages/cli/src/commands/_generated/ai-search/multi-chat-completions.ts @@ -82,7 +82,6 @@ function builder(yargs: Argv) { .option("ai-search-options-reranking-match-threshold", { type: "number", description: "The ai_search_options.reranking.match_threshold field", - default: 0.4, }) .option("ai-search-options-reranking-model", { type: "string", @@ -96,7 +95,6 @@ function builder(yargs: Argv) { .option("ai-search-options-retrieval-context-expansion", { type: "number", description: "The ai_search_options.retrieval.context_expansion field", - default: 0, }) .option("ai-search-options-retrieval-filters", { type: "string", @@ -153,7 +151,6 @@ function builder(yargs: Argv) { .option("ai-search-options-retrieval-return-on-failure", { type: "boolean", description: "The ai_search_options.retrieval.return_on_failure field", - default: true, }) .option("messages", { type: "string", diff --git a/packages/cli/src/commands/_generated/ai-search/multi-search.ts b/packages/cli/src/commands/_generated/ai-search/multi-search.ts index 3e978a00d0..f331ba08e2 100644 --- a/packages/cli/src/commands/_generated/ai-search/multi-search.ts +++ b/packages/cli/src/commands/_generated/ai-search/multi-search.ts @@ -86,7 +86,6 @@ function builder(yargs: Argv) { .option("ai-search-options-reranking-match-threshold", { type: "number", description: "The ai_search_options.reranking.match_threshold field", - default: 0.4, }) .option("ai-search-options-reranking-model", { type: "string", @@ -100,7 +99,6 @@ function builder(yargs: Argv) { .option("ai-search-options-retrieval-context-expansion", { type: "number", description: "The ai_search_options.retrieval.context_expansion field", - default: 0, }) .option("ai-search-options-retrieval-filters", { type: "string", @@ -157,7 +155,6 @@ function builder(yargs: Argv) { .option("ai-search-options-retrieval-return-on-failure", { type: "boolean", description: "The ai_search_options.retrieval.return_on_failure field", - default: true, }) .option("messages", { type: "string", diff --git a/packages/cli/src/commands/_generated/ai-search/update.ts b/packages/cli/src/commands/_generated/ai-search/update.ts index 63ecb587a3..fa8fdcec4b 100644 --- a/packages/cli/src/commands/_generated/ai-search/update.ts +++ b/packages/cli/src/commands/_generated/ai-search/update.ts @@ -373,13 +373,13 @@ function builder(yargs: Argv) { const groupSet = ["index-method-keyword", "index-method-vector"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["index-method-keyword", "index-method-vector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --index_method-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --index-method-* flag is set` ); } } @@ -387,19 +387,17 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "metadata-created-from-aisearch-wizard", "metadata-created-from-emdash-plugin-type", "metadata-created-from-emdash-plugin-version", - "metadata-worker-domain", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "metadata-created-from-emdash-plugin-type", "metadata-created-from-emdash-plugin-version", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --metadata-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --metadata-created-from-emdash-plugin-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/api-security/vulnerability-scanner/target-environments/edit.ts b/packages/cli/src/commands/_generated/api-security/vulnerability-scanner/target-environments/edit.ts index f7aecb3533..b3fed7a89f 100644 --- a/packages/cli/src/commands/_generated/api-security/vulnerability-scanner/target-environments/edit.ts +++ b/packages/cli/src/commands/_generated/api-security/vulnerability-scanner/target-environments/edit.ts @@ -62,7 +62,7 @@ function builder(yargs: Argv) { const groupSet = ["target-type", "target-zone-tag"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["target-type", "target-zone-tag"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/basin-catalog/enable.ts b/packages/cli/src/commands/_generated/basin-catalog/enable.ts index afd14ada73..e3fcb2f4ca 100644 --- a/packages/cli/src/commands/_generated/basin-catalog/enable.ts +++ b/packages/cli/src/commands/_generated/basin-catalog/enable.ts @@ -42,20 +42,6 @@ function builder(yargs: Argv) { type: "string", description: "Contains the optional request to enable a catalog. Send an empty body to keep the defaults. If you include \`credential\`, the service checks that the token can access the bucket, then stores it as the catalog's maintenance credential, like the store credentials operation. ", - }) - .check((argv) => { - const groupSet = ["credential-token"].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = ["credential-token"].filter( - (k) => argv[k] === undefined - ); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --credential-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/browser-run/devtools/browser/live-view/create.ts b/packages/cli/src/commands/_generated/browser-run/devtools/browser/live-view/create.ts index ae63c6e4a9..2142f721b1 100644 --- a/packages/cli/src/commands/_generated/browser-run/devtools/browser/live-view/create.ts +++ b/packages/cli/src/commands/_generated/browser-run/devtools/browser/live-view/create.ts @@ -66,20 +66,6 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Raw JSON request body (bypasses individual flags)", - }) - .check((argv) => { - const groupSet = ["guardrails-mode"].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = ["guardrails-mode"].filter( - (k) => argv[k] === undefined - ); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --guardrails-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/browser-run/quick-action/accessibility-tree.ts b/packages/cli/src/commands/_generated/browser-run/quick-action/accessibility-tree.ts index 89541e0570..b204200b8c 100644 --- a/packages/cli/src/commands/_generated/browser-run/quick-action/accessibility-tree.ts +++ b/packages/cli/src/commands/_generated/browser-run/quick-action/accessibility-tree.ts @@ -197,7 +197,7 @@ function builder(yargs: Argv) { const groupSet = ["authenticate-password", "authenticate-username"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "authenticate-password", "authenticate-username", @@ -219,7 +219,7 @@ function builder(yargs: Argv) { "viewport-is-mobile", "viewport-width", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["viewport-height", "viewport-width"].filter( (k) => argv[k] === undefined ); @@ -238,13 +238,13 @@ function builder(yargs: Argv) { "wait-for-selector-timeout", "wait-for-selector-visible", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["wait-for-selector-selector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --waitForSelector-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --wait-for-selector-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/browser-run/quick-action/content.ts b/packages/cli/src/commands/_generated/browser-run/quick-action/content.ts index 9941dd4fda..a7414c5d7f 100644 --- a/packages/cli/src/commands/_generated/browser-run/quick-action/content.ts +++ b/packages/cli/src/commands/_generated/browser-run/quick-action/content.ts @@ -192,7 +192,7 @@ function builder(yargs: Argv) { const groupSet = ["authenticate-password", "authenticate-username"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "authenticate-password", "authenticate-username", @@ -214,7 +214,7 @@ function builder(yargs: Argv) { "viewport-is-mobile", "viewport-width", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["viewport-height", "viewport-width"].filter( (k) => argv[k] === undefined ); @@ -233,13 +233,13 @@ function builder(yargs: Argv) { "wait-for-selector-timeout", "wait-for-selector-visible", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["wait-for-selector-selector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --waitForSelector-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --wait-for-selector-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/browser-run/quick-action/json.ts b/packages/cli/src/commands/_generated/browser-run/quick-action/json.ts index caab8461f8..b77c8e65cd 100644 --- a/packages/cli/src/commands/_generated/browser-run/quick-action/json.ts +++ b/packages/cli/src/commands/_generated/browser-run/quick-action/json.ts @@ -207,7 +207,7 @@ function builder(yargs: Argv) { const groupSet = ["authenticate-password", "authenticate-username"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "authenticate-password", "authenticate-username", @@ -225,13 +225,13 @@ function builder(yargs: Argv) { "response-format-json-schema", "response-format-type", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["response-format-type"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --response_format-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --response-format-* flag is set` ); } } @@ -246,7 +246,7 @@ function builder(yargs: Argv) { "viewport-is-mobile", "viewport-width", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["viewport-height", "viewport-width"].filter( (k) => argv[k] === undefined ); @@ -265,13 +265,13 @@ function builder(yargs: Argv) { "wait-for-selector-timeout", "wait-for-selector-visible", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["wait-for-selector-selector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --waitForSelector-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --wait-for-selector-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/browser-run/quick-action/links.ts b/packages/cli/src/commands/_generated/browser-run/quick-action/links.ts index 5574aa55f3..1db6b3ea6f 100644 --- a/packages/cli/src/commands/_generated/browser-run/quick-action/links.ts +++ b/packages/cli/src/commands/_generated/browser-run/quick-action/links.ts @@ -200,7 +200,7 @@ function builder(yargs: Argv) { const groupSet = ["authenticate-password", "authenticate-username"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "authenticate-password", "authenticate-username", @@ -222,7 +222,7 @@ function builder(yargs: Argv) { "viewport-is-mobile", "viewport-width", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["viewport-height", "viewport-width"].filter( (k) => argv[k] === undefined ); @@ -241,13 +241,13 @@ function builder(yargs: Argv) { "wait-for-selector-timeout", "wait-for-selector-visible", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["wait-for-selector-selector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --waitForSelector-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --wait-for-selector-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/browser-run/quick-action/markdown.ts b/packages/cli/src/commands/_generated/browser-run/quick-action/markdown.ts index 2932a2c899..877046e306 100644 --- a/packages/cli/src/commands/_generated/browser-run/quick-action/markdown.ts +++ b/packages/cli/src/commands/_generated/browser-run/quick-action/markdown.ts @@ -192,7 +192,7 @@ function builder(yargs: Argv) { const groupSet = ["authenticate-password", "authenticate-username"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "authenticate-password", "authenticate-username", @@ -214,7 +214,7 @@ function builder(yargs: Argv) { "viewport-is-mobile", "viewport-width", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["viewport-height", "viewport-width"].filter( (k) => argv[k] === undefined ); @@ -233,13 +233,13 @@ function builder(yargs: Argv) { "wait-for-selector-timeout", "wait-for-selector-visible", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["wait-for-selector-selector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --waitForSelector-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --wait-for-selector-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/browser-run/quick-action/pdf.ts b/packages/cli/src/commands/_generated/browser-run/quick-action/pdf.ts index afb2524842..f2f7d6190b 100644 --- a/packages/cli/src/commands/_generated/browser-run/quick-action/pdf.ts +++ b/packages/cli/src/commands/_generated/browser-run/quick-action/pdf.ts @@ -300,7 +300,7 @@ function builder(yargs: Argv) { const groupSet = ["authenticate-password", "authenticate-username"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "authenticate-password", "authenticate-username", @@ -322,7 +322,7 @@ function builder(yargs: Argv) { "viewport-is-mobile", "viewport-width", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["viewport-height", "viewport-width"].filter( (k) => argv[k] === undefined ); @@ -341,13 +341,13 @@ function builder(yargs: Argv) { "wait-for-selector-timeout", "wait-for-selector-visible", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["wait-for-selector-selector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --waitForSelector-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --wait-for-selector-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/browser-run/quick-action/scrape.ts b/packages/cli/src/commands/_generated/browser-run/quick-action/scrape.ts index e76ddbf212..b84a8ab276 100644 --- a/packages/cli/src/commands/_generated/browser-run/quick-action/scrape.ts +++ b/packages/cli/src/commands/_generated/browser-run/quick-action/scrape.ts @@ -197,7 +197,7 @@ function builder(yargs: Argv) { const groupSet = ["authenticate-password", "authenticate-username"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "authenticate-password", "authenticate-username", @@ -219,7 +219,7 @@ function builder(yargs: Argv) { "viewport-is-mobile", "viewport-width", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["viewport-height", "viewport-width"].filter( (k) => argv[k] === undefined ); @@ -238,13 +238,13 @@ function builder(yargs: Argv) { "wait-for-selector-timeout", "wait-for-selector-visible", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["wait-for-selector-selector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --waitForSelector-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --wait-for-selector-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/browser-run/quick-action/screenshot.ts b/packages/cli/src/commands/_generated/browser-run/quick-action/screenshot.ts index 6154dee1c5..ecf7cc21e2 100644 --- a/packages/cli/src/commands/_generated/browser-run/quick-action/screenshot.ts +++ b/packages/cli/src/commands/_generated/browser-run/quick-action/screenshot.ts @@ -264,7 +264,7 @@ function builder(yargs: Argv) { const groupSet = ["authenticate-password", "authenticate-username"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "authenticate-password", "authenticate-username", @@ -279,21 +279,13 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "screenshot-options-capture-beyond-viewport", "screenshot-options-clip-height", "screenshot-options-clip-scale", "screenshot-options-clip-width", "screenshot-options-clip-x", "screenshot-options-clip-y", - "screenshot-options-encoding", - "screenshot-options-from-surface", - "screenshot-options-full-page", - "screenshot-options-omit-background", - "screenshot-options-optimize-for-speed", - "screenshot-options-quality", - "screenshot-options-type", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "screenshot-options-clip-height", "screenshot-options-clip-width", @@ -302,7 +294,7 @@ function builder(yargs: Argv) { ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --screenshotOptions-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --screenshot-options-clip-* flag is set` ); } } @@ -317,7 +309,7 @@ function builder(yargs: Argv) { "viewport-is-mobile", "viewport-width", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["viewport-height", "viewport-width"].filter( (k) => argv[k] === undefined ); @@ -336,13 +328,13 @@ function builder(yargs: Argv) { "wait-for-selector-timeout", "wait-for-selector-visible", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["wait-for-selector-selector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --waitForSelector-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --wait-for-selector-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/browser-run/quick-action/snapshot.ts b/packages/cli/src/commands/_generated/browser-run/quick-action/snapshot.ts index 874dc1c306..e0c11da4cb 100644 --- a/packages/cli/src/commands/_generated/browser-run/quick-action/snapshot.ts +++ b/packages/cli/src/commands/_generated/browser-run/quick-action/snapshot.ts @@ -249,7 +249,7 @@ function builder(yargs: Argv) { const groupSet = ["authenticate-password", "authenticate-username"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "authenticate-password", "authenticate-username", @@ -264,20 +264,13 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "screenshot-options-capture-beyond-viewport", "screenshot-options-clip-height", "screenshot-options-clip-scale", "screenshot-options-clip-width", "screenshot-options-clip-x", "screenshot-options-clip-y", - "screenshot-options-from-surface", - "screenshot-options-full-page", - "screenshot-options-omit-background", - "screenshot-options-optimize-for-speed", - "screenshot-options-quality", - "screenshot-options-type", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "screenshot-options-clip-height", "screenshot-options-clip-width", @@ -286,7 +279,7 @@ function builder(yargs: Argv) { ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --screenshotOptions-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --screenshot-options-clip-* flag is set` ); } } @@ -301,7 +294,7 @@ function builder(yargs: Argv) { "viewport-is-mobile", "viewport-width", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["viewport-height", "viewport-width"].filter( (k) => argv[k] === undefined ); @@ -320,13 +313,13 @@ function builder(yargs: Argv) { "wait-for-selector-timeout", "wait-for-selector-visible", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["wait-for-selector-selector"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --waitForSelector-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --wait-for-selector-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/builds/create.ts b/packages/cli/src/commands/_generated/builds/create.ts index d9e0d22dcb..6da54ad863 100644 --- a/packages/cli/src/commands/_generated/builds/create.ts +++ b/packages/cli/src/commands/_generated/builds/create.ts @@ -84,7 +84,7 @@ function builder(yargs: Argv) { "seed-repo-provider", "seed-repo-repository", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "seed-repo-owner", "seed-repo-provider", @@ -92,7 +92,7 @@ function builder(yargs: Argv) { ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --seed_repo-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --seed-repo-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/cloudforce-one/priority-intelligence/create.ts b/packages/cli/src/commands/_generated/cloudforce-one/priority-intelligence/create.ts index d618136557..52722f0179 100644 --- a/packages/cli/src/commands/_generated/cloudforce-one/priority-intelligence/create.ts +++ b/packages/cli/src/commands/_generated/cloudforce-one/priority-intelligence/create.ts @@ -135,13 +135,13 @@ function builder(yargs: Argv) { const groupSet = ["dataset-scope-type", "dataset-scope-dataset-ids"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["dataset-scope-type"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --dataset_scope-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --dataset-scope-* flag is set` ); } } @@ -153,7 +153,7 @@ function builder(yargs: Argv) { "intent-indicators", "intent-unsupported-terms", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "intent-clauses", "intent-indicators", @@ -171,7 +171,7 @@ function builder(yargs: Argv) { const groupSet = ["query-branches", "query-version"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["query-branches"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( diff --git a/packages/cli/src/commands/_generated/cloudforce-one/priority-intelligence/update.ts b/packages/cli/src/commands/_generated/cloudforce-one/priority-intelligence/update.ts index 60e79d37c5..6872f6fec0 100644 --- a/packages/cli/src/commands/_generated/cloudforce-one/priority-intelligence/update.ts +++ b/packages/cli/src/commands/_generated/cloudforce-one/priority-intelligence/update.ts @@ -133,13 +133,13 @@ function builder(yargs: Argv) { const groupSet = ["dataset-scope-type", "dataset-scope-dataset-ids"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["dataset-scope-type"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --dataset_scope-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --dataset-scope-* flag is set` ); } } @@ -151,7 +151,7 @@ function builder(yargs: Argv) { "intent-indicators", "intent-unsupported-terms", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "intent-clauses", "intent-indicators", @@ -169,7 +169,7 @@ function builder(yargs: Argv) { const groupSet = ["query-branches", "query-version"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["query-branches"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( diff --git a/packages/cli/src/commands/_generated/cloudforce-one/rules/email/update.ts b/packages/cli/src/commands/_generated/cloudforce-one/rules/email/update.ts index d6d7c7cffd..433856e725 100644 --- a/packages/cli/src/commands/_generated/cloudforce-one/rules/email/update.ts +++ b/packages/cli/src/commands/_generated/cloudforce-one/rules/email/update.ts @@ -88,7 +88,7 @@ function builder(yargs: Argv) { "condition-operator", "condition-type", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "condition-conditions", "condition-operator", diff --git a/packages/cli/src/commands/_generated/cloudforce-one/threat-intel/events/create.ts b/packages/cli/src/commands/_generated/cloudforce-one/threat-intel/events/create.ts index d89bd08adf..4a10c6cb7c 100644 --- a/packages/cli/src/commands/_generated/cloudforce-one/threat-intel/events/create.ts +++ b/packages/cli/src/commands/_generated/cloudforce-one/threat-intel/events/create.ts @@ -122,7 +122,7 @@ function builder(yargs: Argv) { "source-system", "source-title", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "source-resource-id", "source-resource-type", diff --git a/packages/cli/src/commands/_generated/containers/applications/rollouts/create.ts b/packages/cli/src/commands/_generated/containers/applications/rollouts/create.ts index 327baebe5b..f8763a7d66 100644 --- a/packages/cli/src/commands/_generated/containers/applications/rollouts/create.ts +++ b/packages/cli/src/commands/_generated/containers/applications/rollouts/create.ts @@ -114,7 +114,6 @@ function builder(yargs: Argv) { .option("target-configuration-observability-logs-enabled", { type: "boolean", description: "The target_configuration.observability.logs.enabled field", - default: false, }) .option("dry-run", { type: "boolean", diff --git a/packages/cli/src/commands/_generated/d1/create.ts b/packages/cli/src/commands/_generated/d1/create.ts index e6d6485767..843853222c 100644 --- a/packages/cli/src/commands/_generated/d1/create.ts +++ b/packages/cli/src/commands/_generated/d1/create.ts @@ -59,22 +59,6 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Raw JSON request body (bypasses individual flags)", - }) - .check((argv) => { - const groupSet = ["read-replication-mode"].some( - (k) => argv[k] !== undefined - ); - if (groupSet) { - const missing = ["read-replication-mode"].filter( - (k) => argv[k] === undefined - ); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --read_replication-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/d1/edit.ts b/packages/cli/src/commands/_generated/d1/edit.ts index 57aa8bb14c..fd8d449937 100644 --- a/packages/cli/src/commands/_generated/d1/edit.ts +++ b/packages/cli/src/commands/_generated/d1/edit.ts @@ -46,22 +46,6 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Raw JSON request body (bypasses individual flags)", - }) - .check((argv) => { - const groupSet = ["read-replication-mode"].some( - (k) => argv[k] !== undefined - ); - if (groupSet) { - const missing = ["read-replication-mode"].filter( - (k) => argv[k] === undefined - ); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --read_replication-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/email-sending/suppressions/create.ts b/packages/cli/src/commands/_generated/email-sending/suppressions/create.ts index 2be429b241..1e88bd573a 100644 --- a/packages/cli/src/commands/_generated/email-sending/suppressions/create.ts +++ b/packages/cli/src/commands/_generated/email-sending/suppressions/create.ts @@ -67,7 +67,7 @@ function builder(yargs: Argv) { const groupSet = ["scope-type", "scope-value"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["scope-type"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( diff --git a/packages/cli/src/commands/_generated/fraud/update.ts b/packages/cli/src/commands/_generated/fraud/update.ts index 78f954f462..c8b4623fb7 100644 --- a/packages/cli/src/commands/_generated/fraud/update.ts +++ b/packages/cli/src/commands/_generated/fraud/update.ts @@ -84,17 +84,31 @@ function builder(yargs: Argv) { const groupSet = [ "authentication-settings-failure-criteria-kind", "authentication-settings-failure-criteria-status-codes", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = [ + "authentication-settings-failure-criteria-kind", + ].filter((k) => argv[k] === undefined); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --authentication-settings-failure-criteria-* flag is set` + ); + } + } + return true; + }) + .check((argv) => { + const groupSet = [ "authentication-settings-success-criteria-kind", "authentication-settings-success-criteria-status-codes", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ - "authentication-settings-failure-criteria-kind", "authentication-settings-success-criteria-kind", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --authentication_settings-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --authentication-settings-success-criteria-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/iam/resource-groups/update.ts b/packages/cli/src/commands/_generated/iam/resource-groups/update.ts index c7b3c1423c..74e6e51e0c 100644 --- a/packages/cli/src/commands/_generated/iam/resource-groups/update.ts +++ b/packages/cli/src/commands/_generated/iam/resource-groups/update.ts @@ -46,18 +46,6 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Raw JSON request body (bypasses individual flags)", - }) - .check((argv) => { - const groupSet = ["scope-objects"].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = ["scope-objects"].filter((k) => argv[k] === undefined); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --scope-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/k2/streams/create.ts b/packages/cli/src/commands/_generated/k2/streams/create.ts index 75abfffa81..368537cd9c 100644 --- a/packages/cli/src/commands/_generated/k2/streams/create.ts +++ b/packages/cli/src/commands/_generated/k2/streams/create.ts @@ -71,7 +71,7 @@ function builder(yargs: Argv) { "http-cors-origins", "http-enabled", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["http-enabled"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( @@ -80,22 +80,6 @@ function builder(yargs: Argv) { } } return true; - }) - .check((argv) => { - const groupSet = ["worker-binding-enabled"].some( - (k) => argv[k] !== undefined - ); - if (groupSet) { - const missing = ["worker-binding-enabled"].filter( - (k) => argv[k] === undefined - ); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --worker_binding-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/k2/streams/update.ts b/packages/cli/src/commands/_generated/k2/streams/update.ts index 73a853985c..cfc0c50e50 100644 --- a/packages/cli/src/commands/_generated/k2/streams/update.ts +++ b/packages/cli/src/commands/_generated/k2/streams/update.ts @@ -69,7 +69,7 @@ function builder(yargs: Argv) { "http-cors-origins", "http-enabled", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["http-enabled"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( @@ -78,22 +78,6 @@ function builder(yargs: Argv) { } } return true; - }) - .check((argv) => { - const groupSet = ["worker-binding-enabled"].some( - (k) => argv[k] !== undefined - ); - if (groupSet) { - const missing = ["worker-binding-enabled"].filter( - (k) => argv[k] === undefined - ); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --worker_binding-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/magic-transit/gre-tunnels/create.ts b/packages/cli/src/commands/_generated/magic-transit/gre-tunnels/create.ts index 68abe0e5f5..f5308d2891 100644 --- a/packages/cli/src/commands/_generated/magic-transit/gre-tunnels/create.ts +++ b/packages/cli/src/commands/_generated/magic-transit/gre-tunnels/create.ts @@ -154,7 +154,7 @@ function builder(yargs: Argv) { "bgp-import-filter-id", "bgp-md5-key", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["bgp-customer-asn"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/magic-transit/ipsec-tunnels/create.ts b/packages/cli/src/commands/_generated/magic-transit/ipsec-tunnels/create.ts index 9c4743ffe5..4bfe14e578 100644 --- a/packages/cli/src/commands/_generated/magic-transit/ipsec-tunnels/create.ts +++ b/packages/cli/src/commands/_generated/magic-transit/ipsec-tunnels/create.ts @@ -159,7 +159,7 @@ function builder(yargs: Argv) { "bgp-import-filter-id", "bgp-md5-key", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["bgp-customer-asn"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/magic-transit/ipsec-tunnels/update.ts b/packages/cli/src/commands/_generated/magic-transit/ipsec-tunnels/update.ts index 2df683eebe..ddb44b41b4 100644 --- a/packages/cli/src/commands/_generated/magic-transit/ipsec-tunnels/update.ts +++ b/packages/cli/src/commands/_generated/magic-transit/ipsec-tunnels/update.ts @@ -162,7 +162,7 @@ function builder(yargs: Argv) { "bgp-import-filter-id", "bgp-md5-key", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["bgp-customer-asn"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/magic-transit/sites/acls/edit.ts b/packages/cli/src/commands/_generated/magic-transit/sites/acls/edit.ts index cdbe8aac71..97b6aa9faf 100644 --- a/packages/cli/src/commands/_generated/magic-transit/sites/acls/edit.ts +++ b/packages/cli/src/commands/_generated/magic-transit/sites/acls/edit.ts @@ -112,11 +112,11 @@ function builder(yargs: Argv) { "lan-1-port-ranges", "lan-1-ports", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["lan-1-lan-id"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --lan_1-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --lan-1-* flag is set` ); } } @@ -129,11 +129,11 @@ function builder(yargs: Argv) { "lan-2-port-ranges", "lan-2-ports", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["lan-2-lan-id"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --lan_2-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --lan-2-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/magic-transit/sites/acls/update.ts b/packages/cli/src/commands/_generated/magic-transit/sites/acls/update.ts index ca05724375..34b82df9f3 100644 --- a/packages/cli/src/commands/_generated/magic-transit/sites/acls/update.ts +++ b/packages/cli/src/commands/_generated/magic-transit/sites/acls/update.ts @@ -112,11 +112,11 @@ function builder(yargs: Argv) { "lan-1-port-ranges", "lan-1-ports", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["lan-1-lan-id"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --lan_1-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --lan-1-* flag is set` ); } } @@ -129,11 +129,11 @@ function builder(yargs: Argv) { "lan-2-port-ranges", "lan-2-ports", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["lan-2-lan-id"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --lan_2-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --lan-2-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/magic-transit/sites/lans/create.ts b/packages/cli/src/commands/_generated/magic-transit/sites/lans/create.ts index 5e0e56c28e..0d3aaab0b1 100644 --- a/packages/cli/src/commands/_generated/magic-transit/sites/lans/create.ts +++ b/packages/cli/src/commands/_generated/magic-transit/sites/lans/create.ts @@ -131,13 +131,13 @@ function builder(yargs: Argv) { "static-addressing-secondary-address", "static-addressing-virtual-address", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["static-addressing-address"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --static_addressing-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --static-addressing-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/magic-transit/sites/lans/edit.ts b/packages/cli/src/commands/_generated/magic-transit/sites/lans/edit.ts index 0f4ed0cd23..d0cd752cdf 100644 --- a/packages/cli/src/commands/_generated/magic-transit/sites/lans/edit.ts +++ b/packages/cli/src/commands/_generated/magic-transit/sites/lans/edit.ts @@ -136,13 +136,13 @@ function builder(yargs: Argv) { "static-addressing-secondary-address", "static-addressing-virtual-address", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["static-addressing-address"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --static_addressing-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --static-addressing-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/magic-transit/sites/lans/update.ts b/packages/cli/src/commands/_generated/magic-transit/sites/lans/update.ts index 87db295528..ec2e2226e8 100644 --- a/packages/cli/src/commands/_generated/magic-transit/sites/lans/update.ts +++ b/packages/cli/src/commands/_generated/magic-transit/sites/lans/update.ts @@ -136,13 +136,13 @@ function builder(yargs: Argv) { "static-addressing-secondary-address", "static-addressing-virtual-address", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["static-addressing-address"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --static_addressing-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --static-addressing-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/magic-transit/sites/wans/create.ts b/packages/cli/src/commands/_generated/magic-transit/sites/wans/create.ts index 3c355fb447..663d6266ea 100644 --- a/packages/cli/src/commands/_generated/magic-transit/sites/wans/create.ts +++ b/packages/cli/src/commands/_generated/magic-transit/sites/wans/create.ts @@ -94,14 +94,14 @@ function builder(yargs: Argv) { "static-addressing-secondary-address", "static-addressing-secondary-gateway-address", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "static-addressing-address", "static-addressing-gateway-address", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --static_addressing-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --static-addressing-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/managed-defense/vulnerability-discovery/scans/create.ts b/packages/cli/src/commands/_generated/managed-defense/vulnerability-discovery/scans/create.ts index 20168dff72..400db2f1b7 100644 --- a/packages/cli/src/commands/_generated/managed-defense/vulnerability-discovery/scans/create.ts +++ b/packages/cli/src/commands/_generated/managed-defense/vulnerability-discovery/scans/create.ts @@ -60,14 +60,14 @@ function builder(yargs: Argv) { const groupSet = ["telemetry-window-end", "telemetry-window-start"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "telemetry-window-end", "telemetry-window-start", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --telemetry_window-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --telemetry-window-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/network-interconnects/cnis/create.ts b/packages/cli/src/commands/_generated/network-interconnects/cnis/create.ts index 9e88b09e58..26ecd9d44f 100644 --- a/packages/cli/src/commands/_generated/network-interconnects/cnis/create.ts +++ b/packages/cli/src/commands/_generated/network-interconnects/cnis/create.ts @@ -69,7 +69,7 @@ function builder(yargs: Argv) { "bgp-extra-prefixes", "bgp-md5-key", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["bgp-customer-asn", "bgp-extra-prefixes"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/network-interconnects/cnis/update.ts b/packages/cli/src/commands/_generated/network-interconnects/cnis/update.ts index 1a19b4b86e..d9b3e15336 100644 --- a/packages/cli/src/commands/_generated/network-interconnects/cnis/update.ts +++ b/packages/cli/src/commands/_generated/network-interconnects/cnis/update.ts @@ -91,7 +91,7 @@ function builder(yargs: Argv) { "bgp-extra-prefixes", "bgp-md5-key", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["bgp-customer-asn", "bgp-extra-prefixes"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/o11y/destinations/update.ts b/packages/cli/src/commands/_generated/o11y/destinations/update.ts index 1b8c541324..0e145a1ea4 100644 --- a/packages/cli/src/commands/_generated/o11y/destinations/update.ts +++ b/packages/cli/src/commands/_generated/o11y/destinations/update.ts @@ -67,7 +67,7 @@ function builder(yargs: Argv) { "configuration-type", "configuration-url", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "configuration-headers", "configuration-type", diff --git a/packages/cli/src/commands/_generated/o11y/queries/create.ts b/packages/cli/src/commands/_generated/o11y/queries/create.ts index d8e9276eb4..2a99c96dce 100644 --- a/packages/cli/src/commands/_generated/o11y/queries/create.ts +++ b/packages/cli/src/commands/_generated/o11y/queries/create.ts @@ -96,6 +96,23 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Specify the new contents of the query.", + }) + .check((argv) => { + const groupSet = [ + "parameters-order-by-order", + "parameters-order-by-value", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = ["parameters-order-by-value"].filter( + (k) => argv[k] === undefined + ); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --parameters-order-by-* flag is set` + ); + } + } + return true; }); } @@ -203,12 +220,6 @@ const command: CommandModule = { if (argv["name"] === undefined) { argv["name"] = await promptForRequiredField("name", "Query name"); } - if (argv["parameters-order-by-value"] === undefined) { - argv["parameters-order-by-value"] = await promptForRequiredField( - "parameters-order-by-value", - "Configure which Calculation to order the results by." - ); - } // Assemble request body from individual flags const bodyData = compactBody({ diff --git a/packages/cli/src/commands/_generated/o11y/queries/edit.ts b/packages/cli/src/commands/_generated/o11y/queries/edit.ts index ea2d911acd..9c7edeba43 100644 --- a/packages/cli/src/commands/_generated/o11y/queries/edit.ts +++ b/packages/cli/src/commands/_generated/o11y/queries/edit.ts @@ -101,6 +101,23 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Specify the new contents of the query.", + }) + .check((argv) => { + const groupSet = [ + "parameters-order-by-order", + "parameters-order-by-value", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = ["parameters-order-by-value"].filter( + (k) => argv[k] === undefined + ); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --parameters-order-by-* flag is set` + ); + } + } + return true; }); } @@ -212,12 +229,6 @@ const command: CommandModule = { if (argv["name"] === undefined) { argv["name"] = await promptForRequiredField("name", "Query name"); } - if (argv["parameters-order-by-value"] === undefined) { - argv["parameters-order-by-value"] = await promptForRequiredField( - "parameters-order-by-value", - "Configure which Calculation to order the results by." - ); - } // Assemble request body from individual flags const bodyData = compactBody({ diff --git a/packages/cli/src/commands/_generated/o11y/shared-queries/create.ts b/packages/cli/src/commands/_generated/o11y/shared-queries/create.ts index 878587cbe3..b111f2922d 100644 --- a/packages/cli/src/commands/_generated/o11y/shared-queries/create.ts +++ b/packages/cli/src/commands/_generated/o11y/shared-queries/create.ts @@ -194,25 +194,16 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "parameters-calculations", - "parameters-datasets", - "parameters-filter-combination", - "parameters-filters", - "parameters-group-bys", - "parameters-havings", - "parameters-limit", - "parameters-needle-is-regex", - "parameters-needle-match-case", "parameters-order-by-order", "parameters-order-by-value", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["parameters-order-by-value"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --parameters-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --parameters-order-by-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/o11y/telemetry/query.ts b/packages/cli/src/commands/_generated/o11y/telemetry/query.ts index 528fe3d481..1706b2b195 100644 --- a/packages/cli/src/commands/_generated/o11y/telemetry/query.ts +++ b/packages/cli/src/commands/_generated/o11y/telemetry/query.ts @@ -193,25 +193,16 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "parameters-calculations", - "parameters-datasets", - "parameters-filter-combination", - "parameters-filters", - "parameters-group-bys", - "parameters-havings", - "parameters-limit", - "parameters-needle-is-regex", - "parameters-needle-match-case", "parameters-order-by-order", "parameters-order-by-value", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["parameters-order-by-value"].filter( (k) => argv[k] === undefined ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --parameters-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --parameters-order-by-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/organization/create.ts b/packages/cli/src/commands/_generated/organization/create.ts index e215b1a185..744da5ab81 100644 --- a/packages/cli/src/commands/_generated/organization/create.ts +++ b/packages/cli/src/commands/_generated/organization/create.ts @@ -51,18 +51,6 @@ function builder(yargs: Argv) { type: "string", description: "References an Organization in the Cloudflare data model.", }) - .check((argv) => { - const groupSet = ["parent-id"].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = ["parent-id"].filter((k) => argv[k] === undefined); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --parent-* flag is set` - ); - } - } - return true; - }) .check((argv) => { const groupSet = [ "profile-business-address", @@ -71,7 +59,7 @@ function builder(yargs: Argv) { "profile-business-phone", "profile-external-metadata", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "profile-business-address", "profile-business-email", diff --git a/packages/cli/src/commands/_generated/organization/update.ts b/packages/cli/src/commands/_generated/organization/update.ts index 4d4f5adcc9..f0a50e7b6f 100644 --- a/packages/cli/src/commands/_generated/organization/update.ts +++ b/packages/cli/src/commands/_generated/organization/update.ts @@ -57,18 +57,6 @@ function builder(yargs: Argv) { description: 'The new details of the organization. Only accepts updates to "name" currently.', }) - .check((argv) => { - const groupSet = ["parent-id"].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = ["parent-id"].filter((k) => argv[k] === undefined); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --parent-* flag is set` - ); - } - } - return true; - }) .check((argv) => { const groupSet = [ "profile-business-address", @@ -77,7 +65,7 @@ function builder(yargs: Argv) { "profile-business-phone", "profile-external-metadata", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "profile-business-address", "profile-business-email", diff --git a/packages/cli/src/commands/_generated/pages/create.ts b/packages/cli/src/commands/_generated/pages/create.ts index 78e140c13b..3941688753 100644 --- a/packages/cli/src/commands/_generated/pages/create.ts +++ b/packages/cli/src/commands/_generated/pages/create.ts @@ -374,68 +374,6 @@ function builder(yargs: Argv) { type: "string", description: "Raw JSON request body (bypasses individual flags)", }) - .check((argv) => { - const groupSet = [ - "deployment-configs-preview-ai-bindings", - "deployment-configs-preview-always-use-latest-compatibility-date", - "deployment-configs-preview-analytics-engine-datasets", - "deployment-configs-preview-browsers", - "deployment-configs-preview-build-image-major-version", - "deployment-configs-preview-compatibility-date", - "deployment-configs-preview-compatibility-flags", - "deployment-configs-preview-d1-databases", - "deployment-configs-preview-durable-object-namespaces", - "deployment-configs-preview-env-vars", - "deployment-configs-preview-fail-open", - "deployment-configs-preview-hyperdrive-bindings", - "deployment-configs-preview-kv-namespaces", - "deployment-configs-preview-limits-cpu-ms", - "deployment-configs-preview-mtls-certificates", - "deployment-configs-preview-placement-mode", - "deployment-configs-preview-queue-producers", - "deployment-configs-preview-r2-buckets", - "deployment-configs-preview-services", - "deployment-configs-preview-usage-model", - "deployment-configs-preview-vectorize-bindings", - "deployment-configs-preview-wrangler-config-hash", - "deployment-configs-production-ai-bindings", - "deployment-configs-production-always-use-latest-compatibility-date", - "deployment-configs-production-analytics-engine-datasets", - "deployment-configs-production-browsers", - "deployment-configs-production-build-image-major-version", - "deployment-configs-production-compatibility-date", - "deployment-configs-production-compatibility-flags", - "deployment-configs-production-d1-databases", - "deployment-configs-production-durable-object-namespaces", - "deployment-configs-production-env-vars", - "deployment-configs-production-fail-open", - "deployment-configs-production-hyperdrive-bindings", - "deployment-configs-production-kv-namespaces", - "deployment-configs-production-limits-cpu-ms", - "deployment-configs-production-mtls-certificates", - "deployment-configs-production-placement-mode", - "deployment-configs-production-queue-producers", - "deployment-configs-production-r2-buckets", - "deployment-configs-production-services", - "deployment-configs-production-usage-model", - "deployment-configs-production-vectorize-bindings", - "deployment-configs-production-wrangler-config-hash", - ].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = [ - "deployment-configs-preview-limits-cpu-ms", - "deployment-configs-preview-placement-mode", - "deployment-configs-production-limits-cpu-ms", - "deployment-configs-production-placement-mode", - ].filter((k) => argv[k] === undefined); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --deployment_configs-* flag is set` - ); - } - } - return true; - }) .check((argv) => { const groupSet = [ "source-config-deployments-enabled", @@ -453,7 +391,7 @@ function builder(yargs: Argv) { "source-config-repo-name", "source-type", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["source-type"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( diff --git a/packages/cli/src/commands/_generated/pages/edit.ts b/packages/cli/src/commands/_generated/pages/edit.ts index 6ca93319d3..55fb9917b6 100644 --- a/packages/cli/src/commands/_generated/pages/edit.ts +++ b/packages/cli/src/commands/_generated/pages/edit.ts @@ -379,68 +379,6 @@ function builder(yargs: Argv) { type: "string", description: "Raw JSON request body (bypasses individual flags)", }) - .check((argv) => { - const groupSet = [ - "deployment-configs-preview-ai-bindings", - "deployment-configs-preview-always-use-latest-compatibility-date", - "deployment-configs-preview-analytics-engine-datasets", - "deployment-configs-preview-browsers", - "deployment-configs-preview-build-image-major-version", - "deployment-configs-preview-compatibility-date", - "deployment-configs-preview-compatibility-flags", - "deployment-configs-preview-d1-databases", - "deployment-configs-preview-durable-object-namespaces", - "deployment-configs-preview-env-vars", - "deployment-configs-preview-fail-open", - "deployment-configs-preview-hyperdrive-bindings", - "deployment-configs-preview-kv-namespaces", - "deployment-configs-preview-limits-cpu-ms", - "deployment-configs-preview-mtls-certificates", - "deployment-configs-preview-placement-mode", - "deployment-configs-preview-queue-producers", - "deployment-configs-preview-r2-buckets", - "deployment-configs-preview-services", - "deployment-configs-preview-usage-model", - "deployment-configs-preview-vectorize-bindings", - "deployment-configs-preview-wrangler-config-hash", - "deployment-configs-production-ai-bindings", - "deployment-configs-production-always-use-latest-compatibility-date", - "deployment-configs-production-analytics-engine-datasets", - "deployment-configs-production-browsers", - "deployment-configs-production-build-image-major-version", - "deployment-configs-production-compatibility-date", - "deployment-configs-production-compatibility-flags", - "deployment-configs-production-d1-databases", - "deployment-configs-production-durable-object-namespaces", - "deployment-configs-production-env-vars", - "deployment-configs-production-fail-open", - "deployment-configs-production-hyperdrive-bindings", - "deployment-configs-production-kv-namespaces", - "deployment-configs-production-limits-cpu-ms", - "deployment-configs-production-mtls-certificates", - "deployment-configs-production-placement-mode", - "deployment-configs-production-queue-producers", - "deployment-configs-production-r2-buckets", - "deployment-configs-production-services", - "deployment-configs-production-usage-model", - "deployment-configs-production-vectorize-bindings", - "deployment-configs-production-wrangler-config-hash", - ].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = [ - "deployment-configs-preview-limits-cpu-ms", - "deployment-configs-preview-placement-mode", - "deployment-configs-production-limits-cpu-ms", - "deployment-configs-production-placement-mode", - ].filter((k) => argv[k] === undefined); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --deployment_configs-* flag is set` - ); - } - } - return true; - }) .check((argv) => { const groupSet = [ "source-config-deployments-enabled", @@ -458,7 +396,7 @@ function builder(yargs: Argv) { "source-config-repo-name", "source-type", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["source-type"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( diff --git a/packages/cli/src/commands/_generated/pipelines/legacy-update.ts b/packages/cli/src/commands/_generated/pipelines/legacy-update.ts index 391fb945f6..098376ab86 100644 --- a/packages/cli/src/commands/_generated/pipelines/legacy-update.ts +++ b/packages/cli/src/commands/_generated/pipelines/legacy-update.ts @@ -114,6 +114,26 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Raw JSON request body (bypasses individual flags)", + }) + .check((argv) => { + const groupSet = [ + "destination-credentials-access-key-id", + "destination-credentials-endpoint", + "destination-credentials-secret-access-key", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = [ + "destination-credentials-access-key-id", + "destination-credentials-endpoint", + "destination-credentials-secret-access-key", + ].filter((k) => argv[k] === undefined); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --destination-credentials-* flag is set` + ); + } + } + return true; }); } @@ -240,27 +260,6 @@ const command: CommandModule = { formatOutput(result, { successLabel: `Updated` }); return; } - if (argv["destination-credentials-access-key-id"] === undefined) { - argv["destination-credentials-access-key-id"] = - await promptForRequiredField( - "destination-credentials-access-key-id", - "Specifies the R2 Bucket Access Key Id." - ); - } - if (argv["destination-credentials-endpoint"] === undefined) { - argv["destination-credentials-endpoint"] = - await promptForRequiredField( - "destination-credentials-endpoint", - "Specifies the R2 Endpoint." - ); - } - if (argv["destination-credentials-secret-access-key"] === undefined) { - argv["destination-credentials-secret-access-key"] = - await promptForRequiredField( - "destination-credentials-secret-access-key", - "Specifies the R2 Bucket Secret Access Key." - ); - } if (argv["destination-format"] === undefined) { argv["destination-format"] = await promptForRequiredEnumField( "destination-format", diff --git a/packages/cli/src/commands/_generated/pipelines/sinks/create.ts b/packages/cli/src/commands/_generated/pipelines/sinks/create.ts index d807c0bb77..bcfa234d3a 100644 --- a/packages/cli/src/commands/_generated/pipelines/sinks/create.ts +++ b/packages/cli/src/commands/_generated/pipelines/sinks/create.ts @@ -299,7 +299,7 @@ function builder(yargs: Argv) { "sink-config-table-name", "sink-config-token", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["sink-config-account-id", "sink-config-bucket"].filter( (k) => argv[k] === undefined ); @@ -320,7 +320,7 @@ function builder(yargs: Argv) { "format-type", "format-row-group-bytes", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["format-type"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( diff --git a/packages/cli/src/commands/_generated/pipelines/streams/create.ts b/packages/cli/src/commands/_generated/pipelines/streams/create.ts index 87d5569984..bf4b5bf8f0 100644 --- a/packages/cli/src/commands/_generated/pipelines/streams/create.ts +++ b/packages/cli/src/commands/_generated/pipelines/streams/create.ts @@ -134,7 +134,7 @@ function builder(yargs: Argv) { "format-compression", "format-row-group-bytes", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["format-type"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( @@ -150,7 +150,7 @@ function builder(yargs: Argv) { "http-cors-origins", "http-enabled", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["http-authentication", "http-enabled"].filter( (k) => argv[k] === undefined ); @@ -161,22 +161,6 @@ function builder(yargs: Argv) { } } return true; - }) - .check((argv) => { - const groupSet = ["worker-binding-enabled"].some( - (k) => argv[k] !== undefined - ); - if (groupSet) { - const missing = ["worker-binding-enabled"].filter( - (k) => argv[k] === undefined - ); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --worker_binding-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/pipelines/streams/update.ts b/packages/cli/src/commands/_generated/pipelines/streams/update.ts index 6970976b64..b44daf3e40 100644 --- a/packages/cli/src/commands/_generated/pipelines/streams/update.ts +++ b/packages/cli/src/commands/_generated/pipelines/streams/update.ts @@ -59,7 +59,7 @@ function builder(yargs: Argv) { "http-cors-origins", "http-enabled", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["http-authentication", "http-enabled"].filter( (k) => argv[k] === undefined ); @@ -70,22 +70,6 @@ function builder(yargs: Argv) { } } return true; - }) - .check((argv) => { - const groupSet = ["worker-binding-enabled"].some( - (k) => argv[k] !== undefined - ); - if (groupSet) { - const missing = ["worker-binding-enabled"].filter( - (k) => argv[k] === undefined - ); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --worker_binding-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/queues/subscriptions/create.ts b/packages/cli/src/commands/_generated/queues/subscriptions/create.ts index c07753dc77..aef9eabc3c 100644 --- a/packages/cli/src/commands/_generated/queues/subscriptions/create.ts +++ b/packages/cli/src/commands/_generated/queues/subscriptions/create.ts @@ -93,7 +93,7 @@ function builder(yargs: Argv) { const groupSet = ["destination-queue-id", "destination-type"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["destination-queue-id", "destination-type"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/queues/subscriptions/update.ts b/packages/cli/src/commands/_generated/queues/subscriptions/update.ts index f756915075..598b8461b8 100644 --- a/packages/cli/src/commands/_generated/queues/subscriptions/update.ts +++ b/packages/cli/src/commands/_generated/queues/subscriptions/update.ts @@ -64,7 +64,7 @@ function builder(yargs: Argv) { const groupSet = ["destination-queue-id", "destination-type"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["destination-queue-id", "destination-type"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/r2/super-slurper/jobs/create.ts b/packages/cli/src/commands/_generated/r2/super-slurper/jobs/create.ts index a44fa432f6..fdf669284a 100644 --- a/packages/cli/src/commands/_generated/r2/super-slurper/jobs/create.ts +++ b/packages/cli/src/commands/_generated/r2/super-slurper/jobs/create.ts @@ -188,7 +188,7 @@ function builder(yargs: Argv) { "source-vendor", "source-jurisdiction", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["source-bucket", "source-vendor"].filter( (k) => argv[k] === undefined ); @@ -208,7 +208,7 @@ function builder(yargs: Argv) { "target-secret-secret-access-key", "target-vendor", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "target-bucket", "target-secret-access-key-id", diff --git a/packages/cli/src/commands/_generated/realtime/kit/meetings/create.ts b/packages/cli/src/commands/_generated/realtime/kit/meetings/create.ts index 395398aeeb..4de2059cb7 100644 --- a/packages/cli/src/commands/_generated/realtime/kit/meetings/create.ts +++ b/packages/cli/src/commands/_generated/realtime/kit/meetings/create.ts @@ -221,35 +221,6 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Create meeting body", - }) - .check((argv) => { - const groupSet = [ - "recording-config-audio-config-channel", - "recording-config-audio-config-codec", - "recording-config-audio-config-export-file", - "recording-config-file-name-prefix", - "recording-config-live-streaming-config-rtmp-url", - "recording-config-max-seconds", - "recording-config-realtimekit-bucket-config-enabled", - "recording-config-storage-config-type", - "recording-config-video-config-codec", - "recording-config-video-config-export-file", - "recording-config-video-config-height", - "recording-config-video-config-watermark-position", - "recording-config-video-config-watermark-url", - "recording-config-video-config-width", - ].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = [ - "recording-config-realtimekit-bucket-config-enabled", - ].filter((k) => argv[k] === undefined); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --recording_config-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/realtime/kit/meetings/replace.ts b/packages/cli/src/commands/_generated/realtime/kit/meetings/replace.ts index be0d657c9e..71fde24283 100644 --- a/packages/cli/src/commands/_generated/realtime/kit/meetings/replace.ts +++ b/packages/cli/src/commands/_generated/realtime/kit/meetings/replace.ts @@ -221,35 +221,6 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Create meeting body", - }) - .check((argv) => { - const groupSet = [ - "recording-config-audio-config-channel", - "recording-config-audio-config-codec", - "recording-config-audio-config-export-file", - "recording-config-file-name-prefix", - "recording-config-live-streaming-config-rtmp-url", - "recording-config-max-seconds", - "recording-config-realtimekit-bucket-config-enabled", - "recording-config-storage-config-type", - "recording-config-video-config-codec", - "recording-config-video-config-export-file", - "recording-config-video-config-height", - "recording-config-video-config-watermark-position", - "recording-config-video-config-watermark-url", - "recording-config-video-config-width", - ].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = [ - "recording-config-realtimekit-bucket-config-enabled", - ].filter((k) => argv[k] === undefined); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --recording_config-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/realtime/kit/meetings/update.ts b/packages/cli/src/commands/_generated/realtime/kit/meetings/update.ts index 9a6ca6f8f2..83a42b4f15 100644 --- a/packages/cli/src/commands/_generated/realtime/kit/meetings/update.ts +++ b/packages/cli/src/commands/_generated/realtime/kit/meetings/update.ts @@ -228,35 +228,6 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Update meeting body", - }) - .check((argv) => { - const groupSet = [ - "recording-config-audio-config-channel", - "recording-config-audio-config-codec", - "recording-config-audio-config-export-file", - "recording-config-file-name-prefix", - "recording-config-live-streaming-config-rtmp-url", - "recording-config-max-seconds", - "recording-config-realtimekit-bucket-config-enabled", - "recording-config-storage-config-type", - "recording-config-video-config-codec", - "recording-config-video-config-export-file", - "recording-config-video-config-height", - "recording-config-video-config-watermark-position", - "recording-config-video-config-watermark-url", - "recording-config-video-config-width", - ].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = [ - "recording-config-realtimekit-bucket-config-enabled", - ].filter((k) => argv[k] === undefined); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --recording_config-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/realtime/kit/recordings/start.ts b/packages/cli/src/commands/_generated/realtime/kit/recordings/start.ts index 12a817e689..65a234b797 100644 --- a/packages/cli/src/commands/_generated/realtime/kit/recordings/start.ts +++ b/packages/cli/src/commands/_generated/realtime/kit/recordings/start.ts @@ -148,22 +148,6 @@ function builder(yargs: Argv) { .option("body", { type: "string", description: "Raw JSON request body (bypasses individual flags)", - }) - .check((argv) => { - const groupSet = ["realtimekit-bucket-config-enabled"].some( - (k) => argv[k] !== undefined - ); - if (groupSet) { - const missing = ["realtimekit-bucket-config-enabled"].filter( - (k) => argv[k] === undefined - ); - if (missing.length > 0) { - throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --realtimekit_bucket_config-* flag is set` - ); - } - } - return true; }); } diff --git a/packages/cli/src/commands/_generated/registrar-sandbox/registrations/create.ts b/packages/cli/src/commands/_generated/registrar-sandbox/registrations/create.ts index f56d1ca7ec..77131fbb7d 100644 --- a/packages/cli/src/commands/_generated/registrar-sandbox/registrations/create.ts +++ b/packages/cli/src/commands/_generated/registrar-sandbox/registrations/create.ts @@ -187,40 +187,82 @@ function builder(yargs: Argv) { "contacts-administrator-phone", "contacts-administrator-postal-info-name", "contacts-administrator-postal-info-organization", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = [ + "contacts-administrator-email", + "contacts-administrator-phone", + "contacts-administrator-postal-info-name", + ].filter((k) => argv[k] === undefined); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --contacts-administrator-* flag is set` + ); + } + } + return true; + }) + .check((argv) => { + const groupSet = [ "contacts-billing-email", "contacts-billing-fax", "contacts-billing-phone", "contacts-billing-postal-info-name", "contacts-billing-postal-info-organization", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = [ + "contacts-billing-email", + "contacts-billing-phone", + "contacts-billing-postal-info-name", + ].filter((k) => argv[k] === undefined); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --contacts-billing-* flag is set` + ); + } + } + return true; + }) + .check((argv) => { + const groupSet = [ "contacts-registrant-email", "contacts-registrant-fax", "contacts-registrant-phone", "contacts-registrant-postal-info-name", "contacts-registrant-postal-info-organization", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = [ + "contacts-registrant-email", + "contacts-registrant-phone", + "contacts-registrant-postal-info-name", + ].filter((k) => argv[k] === undefined); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --contacts-registrant-* flag is set` + ); + } + } + return true; + }) + .check((argv) => { + const groupSet = [ "contacts-technical-email", "contacts-technical-fax", "contacts-technical-phone", "contacts-technical-postal-info-name", "contacts-technical-postal-info-organization", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ - "contacts-administrator-email", - "contacts-administrator-phone", - "contacts-administrator-postal-info-name", - "contacts-billing-email", - "contacts-billing-phone", - "contacts-billing-postal-info-name", - "contacts-registrant-email", - "contacts-registrant-phone", - "contacts-registrant-postal-info-name", "contacts-technical-email", "contacts-technical-phone", "contacts-technical-postal-info-name", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --contacts-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --contacts-technical-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/registrar/registrations/transfer-in.ts b/packages/cli/src/commands/_generated/registrar/registrations/transfer-in.ts index 24133ffeeb..3803c70afd 100644 --- a/packages/cli/src/commands/_generated/registrar/registrations/transfer-in.ts +++ b/packages/cli/src/commands/_generated/registrar/registrations/transfer-in.ts @@ -180,40 +180,82 @@ function builder(yargs: Argv) { "contacts-administrator-phone", "contacts-administrator-postal-info-name", "contacts-administrator-postal-info-organization", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = [ + "contacts-administrator-email", + "contacts-administrator-phone", + "contacts-administrator-postal-info-name", + ].filter((k) => argv[k] === undefined); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --contacts-administrator-* flag is set` + ); + } + } + return true; + }) + .check((argv) => { + const groupSet = [ "contacts-billing-email", "contacts-billing-fax", "contacts-billing-phone", "contacts-billing-postal-info-name", "contacts-billing-postal-info-organization", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = [ + "contacts-billing-email", + "contacts-billing-phone", + "contacts-billing-postal-info-name", + ].filter((k) => argv[k] === undefined); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --contacts-billing-* flag is set` + ); + } + } + return true; + }) + .check((argv) => { + const groupSet = [ "contacts-registrant-email", "contacts-registrant-fax", "contacts-registrant-phone", "contacts-registrant-postal-info-name", "contacts-registrant-postal-info-organization", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = [ + "contacts-registrant-email", + "contacts-registrant-phone", + "contacts-registrant-postal-info-name", + ].filter((k) => argv[k] === undefined); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --contacts-registrant-* flag is set` + ); + } + } + return true; + }) + .check((argv) => { + const groupSet = [ "contacts-technical-email", "contacts-technical-fax", "contacts-technical-phone", "contacts-technical-postal-info-name", "contacts-technical-postal-info-organization", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ - "contacts-administrator-email", - "contacts-administrator-phone", - "contacts-administrator-postal-info-name", - "contacts-billing-email", - "contacts-billing-phone", - "contacts-billing-postal-info-name", - "contacts-registrant-email", - "contacts-registrant-phone", - "contacts-registrant-postal-info-name", "contacts-technical-email", "contacts-technical-phone", "contacts-technical-postal-info-name", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --contacts-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --contacts-technical-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/sql/query.ts b/packages/cli/src/commands/_generated/sql/query.ts index a95ca44129..8214a7debf 100644 --- a/packages/cli/src/commands/_generated/sql/query.ts +++ b/packages/cli/src/commands/_generated/sql/query.ts @@ -61,11 +61,11 @@ function builder(yargs: Argv) { const groupSet = ["time-until", "time-since"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["time-since"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --time_range-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --time-range-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/ssl/keyless-certificates/create.ts b/packages/cli/src/commands/_generated/ssl/keyless-certificates/create.ts index 3eea6746be..3e00dda269 100644 --- a/packages/cli/src/commands/_generated/ssl/keyless-certificates/create.ts +++ b/packages/cli/src/commands/_generated/ssl/keyless-certificates/create.ts @@ -64,7 +64,7 @@ function builder(yargs: Argv) { const groupSet = ["tunnel-private-ip", "tunnel-vnet-id"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["tunnel-private-ip", "tunnel-vnet-id"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/ssl/keyless-certificates/edit.ts b/packages/cli/src/commands/_generated/ssl/keyless-certificates/edit.ts index 7b94a40040..b6dedbdf50 100644 --- a/packages/cli/src/commands/_generated/ssl/keyless-certificates/edit.ts +++ b/packages/cli/src/commands/_generated/ssl/keyless-certificates/edit.ts @@ -56,7 +56,7 @@ function builder(yargs: Argv) { const groupSet = ["tunnel-private-ip", "tunnel-vnet-id"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["tunnel-private-ip", "tunnel-vnet-id"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/tunnels/config/update.ts b/packages/cli/src/commands/_generated/tunnels/config/update.ts index cd3939e518..6d826f0658 100644 --- a/packages/cli/src/commands/_generated/tunnels/config/update.ts +++ b/packages/cli/src/commands/_generated/tunnels/config/update.ts @@ -129,33 +129,18 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "tunnel-config-ingress", "tunnel-config-origin-request-access-aud-tag", "tunnel-config-origin-request-access-required", "tunnel-config-origin-request-access-team-name", - "tunnel-config-origin-request-ca-pool", - "tunnel-config-origin-request-connect-timeout", - "tunnel-config-origin-request-disable-chunked-encoding", - "tunnel-config-origin-request-http2origin", - "tunnel-config-origin-request-http-host-header", - "tunnel-config-origin-request-keep-alive-connections", - "tunnel-config-origin-request-keep-alive-timeout", - "tunnel-config-origin-request-match-snito-host", - "tunnel-config-origin-request-no-happy-eyeballs", - "tunnel-config-origin-request-no-tlsverify", - "tunnel-config-origin-request-origin-server-name", - "tunnel-config-origin-request-proxy-type", - "tunnel-config-origin-request-tcp-keep-alive", - "tunnel-config-origin-request-tls-timeout", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "tunnel-config-origin-request-access-aud-tag", "tunnel-config-origin-request-access-team-name", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --config-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --config-origin-request-access-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/workers-builds/workers/previews/create-build.ts b/packages/cli/src/commands/_generated/workers-builds/workers/previews/create-build.ts index 4bc6296cfe..a6ddad5f3f 100644 --- a/packages/cli/src/commands/_generated/workers-builds/workers/previews/create-build.ts +++ b/packages/cli/src/commands/_generated/workers-builds/workers/previews/create-build.ts @@ -90,7 +90,7 @@ function builder(yargs: Argv) { "seed-repo-provider", "seed-repo-repository", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "seed-repo-owner", "seed-repo-provider", @@ -98,7 +98,7 @@ function builder(yargs: Argv) { ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --seed_repo-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --seed-repo-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zaraz/config/update.ts b/packages/cli/src/commands/_generated/zaraz/config/update.ts index ffd177cf05..551f601ff1 100644 --- a/packages/cli/src/commands/_generated/zaraz/config/update.ts +++ b/packages/cli/src/commands/_generated/zaraz/config/update.ts @@ -205,6 +205,26 @@ function builder(yargs: Argv) { type: "string", description: "Zaraz configuration.", }) + .check((argv) => { + const groupSet = [ + "consent-button-text-translations-accept-all", + "consent-button-text-translations-confirm-my-choices", + "consent-button-text-translations-reject-all", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = [ + "consent-button-text-translations-accept-all", + "consent-button-text-translations-confirm-my-choices", + "consent-button-text-translations-reject-all", + ].filter((k) => argv[k] === undefined); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --consent-button-text-translations-* flag is set` + ); + } + } + return true; + }) .check((argv) => { const groupSet = [ "consent-button-text-translations-accept-all", @@ -225,16 +245,31 @@ function builder(yargs: Argv) { "consent-purposes-with-translations", "consent-tcf-compliant", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { + const missing = ["consent-enabled"].filter( + (k) => argv[k] === undefined + ); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --consent-* flag is set` + ); + } + } + return true; + }) + .check((argv) => { + const groupSet = [ + "settings-context-enricher-escaped-worker-name", + "settings-context-enricher-worker-tag", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { const missing = [ - "consent-button-text-translations-accept-all", - "consent-button-text-translations-confirm-my-choices", - "consent-button-text-translations-reject-all", - "consent-enabled", + "settings-context-enricher-escaped-worker-name", + "settings-context-enricher-worker-tag", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --consent-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --settings-context-enricher-* flag is set` ); } } @@ -512,22 +547,6 @@ const command: CommandModule = { "--settings-auto-inject-script is required (or pass --body with this field set)." ); } - if ( - argv["settings-context-enricher-escaped-worker-name"] === undefined - ) { - argv["settings-context-enricher-escaped-worker-name"] = - await promptForRequiredField( - "settings-context-enricher-escaped-worker-name", - "The settings.contextEnricher.escapedWorkerName field" - ); - } - if (argv["settings-context-enricher-worker-tag"] === undefined) { - argv["settings-context-enricher-worker-tag"] = - await promptForRequiredField( - "settings-context-enricher-worker-tag", - "The settings.contextEnricher.workerTag field" - ); - } if (argv["triggers"] === undefined) { throw new Error( "--triggers is required (or pass --body with this field set)." diff --git a/packages/cli/src/commands/_generated/zero-trust/devices/networks/update.ts b/packages/cli/src/commands/_generated/zero-trust/devices/networks/update.ts index 07afc4f25f..4f35975187 100644 --- a/packages/cli/src/commands/_generated/zero-trust/devices/networks/update.ts +++ b/packages/cli/src/commands/_generated/zero-trust/devices/networks/update.ts @@ -64,7 +64,7 @@ function builder(yargs: Argv) { "network-config-sha256", "network-config-tls-sockaddr", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["network-config-tls-sockaddr"].filter( (k) => argv[k] === undefined ); diff --git a/packages/cli/src/commands/_generated/zero-trust/devices/profiles/custom/create.ts b/packages/cli/src/commands/_generated/zero-trust/devices/profiles/custom/create.ts index 85f2d6121e..ea754c2e8c 100644 --- a/packages/cli/src/commands/_generated/zero-trust/devices/profiles/custom/create.ts +++ b/packages/cli/src/commands/_generated/zero-trust/devices/profiles/custom/create.ts @@ -245,14 +245,14 @@ function builder(yargs: Argv) { "browser-extension-config-proxy-control", "browser-extension-config-proxy-enabled", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "browser-extension-config-proxy-control", "browser-extension-config-proxy-enabled", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --browser_extension_config-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --browser-extension-config-* flag is set` ); } } @@ -267,7 +267,7 @@ function builder(yargs: Argv) { "global-acceleration-masque-endpoints", "global-acceleration-wireguard-endpoints", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "global-acceleration-api-endpoints", "global-acceleration-enabled", @@ -276,7 +276,7 @@ function builder(yargs: Argv) { ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --global_acceleration-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --global-acceleration-* flag is set` ); } } @@ -287,14 +287,14 @@ function builder(yargs: Argv) { "virtual-networks-allowed", "virtual-networks-default", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "virtual-networks-allowed", "virtual-networks-default", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --virtual_networks-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --virtual-networks-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/devices/profiles/custom/update.ts b/packages/cli/src/commands/_generated/zero-trust/devices/profiles/custom/update.ts index ba39ec38e8..382c2f3206 100644 --- a/packages/cli/src/commands/_generated/zero-trust/devices/profiles/custom/update.ts +++ b/packages/cli/src/commands/_generated/zero-trust/devices/profiles/custom/update.ts @@ -223,14 +223,14 @@ function builder(yargs: Argv) { "browser-extension-config-proxy-control", "browser-extension-config-proxy-enabled", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "browser-extension-config-proxy-control", "browser-extension-config-proxy-enabled", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --browser_extension_config-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --browser-extension-config-* flag is set` ); } } @@ -245,7 +245,7 @@ function builder(yargs: Argv) { "global-acceleration-masque-endpoints", "global-acceleration-wireguard-endpoints", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "global-acceleration-api-endpoints", "global-acceleration-enabled", @@ -254,7 +254,7 @@ function builder(yargs: Argv) { ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --global_acceleration-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --global-acceleration-* flag is set` ); } } @@ -265,14 +265,14 @@ function builder(yargs: Argv) { "virtual-networks-allowed", "virtual-networks-default", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "virtual-networks-allowed", "virtual-networks-default", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --virtual_networks-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --virtual-networks-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/devices/profiles/default/update.ts b/packages/cli/src/commands/_generated/zero-trust/devices/profiles/default/update.ts index ce2650651b..3c60f1aa1c 100644 --- a/packages/cli/src/commands/_generated/zero-trust/devices/profiles/default/update.ts +++ b/packages/cli/src/commands/_generated/zero-trust/devices/profiles/default/update.ts @@ -183,7 +183,7 @@ function builder(yargs: Argv) { "global-acceleration-masque-endpoints", "global-acceleration-wireguard-endpoints", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "global-acceleration-api-endpoints", "global-acceleration-enabled", @@ -192,7 +192,7 @@ function builder(yargs: Argv) { ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --global_acceleration-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --global-acceleration-* flag is set` ); } } @@ -203,14 +203,14 @@ function builder(yargs: Argv) { "virtual-networks-allowed", "virtual-networks-default", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "virtual-networks-allowed", "virtual-networks-default", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --virtual_networks-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --virtual-networks-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/custom/create.ts b/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/custom/create.ts index 89945255d6..ccf19c278e 100644 --- a/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/custom/create.ts +++ b/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/custom/create.ts @@ -100,14 +100,14 @@ function builder(yargs: Argv) { "context-awareness-enabled", "context-awareness-skip-files", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "context-awareness-enabled", "context-awareness-skip-files", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --context_awareness-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --context-awareness-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/custom/update.ts b/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/custom/update.ts index 3615eaa89b..cb6a4bbe41 100644 --- a/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/custom/update.ts +++ b/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/custom/update.ts @@ -102,14 +102,14 @@ function builder(yargs: Argv) { "context-awareness-enabled", "context-awareness-skip-files", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "context-awareness-enabled", "context-awareness-skip-files", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --context_awareness-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --context-awareness-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/predefined/update.ts b/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/predefined/update.ts index 3cdf2c3d8b..9ada6e1840 100644 --- a/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/predefined/update.ts +++ b/packages/cli/src/commands/_generated/zero-trust/dlp/profiles/predefined/update.ts @@ -74,14 +74,14 @@ function builder(yargs: Argv) { "context-awareness-enabled", "context-awareness-skip-files", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "context-awareness-enabled", "context-awareness-skip-files", ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --context_awareness-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --context-awareness-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/gateway/configurations/edit.ts b/packages/cli/src/commands/_generated/zero-trust/gateway/configurations/edit.ts index c61c6c98a0..b951d0d36b 100644 --- a/packages/cli/src/commands/_generated/zero-trust/gateway/configurations/edit.ts +++ b/packages/cli/src/commands/_generated/zero-trust/gateway/configurations/edit.ts @@ -216,50 +216,16 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "settings-activity-log-enabled", - "settings-antivirus-enabled-download-phase", - "settings-antivirus-enabled-upload-phase", - "settings-antivirus-fail-closed", - "settings-antivirus-notification-settings-enabled", - "settings-antivirus-notification-settings-include-context", - "settings-antivirus-notification-settings-msg", - "settings-antivirus-notification-settings-support-url", - "settings-block-page-background-color", - "settings-block-page-enabled", - "settings-block-page-footer-text", - "settings-block-page-header-text", - "settings-block-page-include-context", - "settings-block-page-logo-path", - "settings-block-page-mailto-address", - "settings-block-page-mailto-subject", - "settings-block-page-mode", - "settings-block-page-name", - "settings-block-page-suppress-footer", - "settings-block-page-target-uri", - "settings-body-scanning-inspection-mode", - "settings-browser-isolation-non-identity-enabled", - "settings-browser-isolation-url-browser-isolation-enabled", - "settings-certificate-id", "settings-custom-certificate-enabled", "settings-custom-certificate-id", - "settings-extended-email-matching-enabled", - "settings-fips-tls", - "settings-host-selector-enabled", - "settings-inspection-mode", - "settings-max-ttl-secs", - "settings-protocol-detection-enabled", - "settings-sandbox-enabled", - "settings-sandbox-fallback-action", - "settings-tls-decrypt-enabled", ].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = [ - "settings-certificate-id", - "settings-custom-certificate-enabled", - ].filter((k) => argv[k] === undefined); + if (!argv.body && groupSet) { + const missing = ["settings-custom-certificate-enabled"].filter( + (k) => argv[k] === undefined + ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --settings-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --settings-custom-certificate-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/gateway/configurations/update.ts b/packages/cli/src/commands/_generated/zero-trust/gateway/configurations/update.ts index dc345b526b..8558187a98 100644 --- a/packages/cli/src/commands/_generated/zero-trust/gateway/configurations/update.ts +++ b/packages/cli/src/commands/_generated/zero-trust/gateway/configurations/update.ts @@ -216,50 +216,16 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "settings-activity-log-enabled", - "settings-antivirus-enabled-download-phase", - "settings-antivirus-enabled-upload-phase", - "settings-antivirus-fail-closed", - "settings-antivirus-notification-settings-enabled", - "settings-antivirus-notification-settings-include-context", - "settings-antivirus-notification-settings-msg", - "settings-antivirus-notification-settings-support-url", - "settings-block-page-background-color", - "settings-block-page-enabled", - "settings-block-page-footer-text", - "settings-block-page-header-text", - "settings-block-page-include-context", - "settings-block-page-logo-path", - "settings-block-page-mailto-address", - "settings-block-page-mailto-subject", - "settings-block-page-mode", - "settings-block-page-name", - "settings-block-page-suppress-footer", - "settings-block-page-target-uri", - "settings-body-scanning-inspection-mode", - "settings-browser-isolation-non-identity-enabled", - "settings-browser-isolation-url-browser-isolation-enabled", - "settings-certificate-id", "settings-custom-certificate-enabled", "settings-custom-certificate-id", - "settings-extended-email-matching-enabled", - "settings-fips-tls", - "settings-host-selector-enabled", - "settings-inspection-mode", - "settings-max-ttl-secs", - "settings-protocol-detection-enabled", - "settings-sandbox-enabled", - "settings-sandbox-fallback-action", - "settings-tls-decrypt-enabled", ].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = [ - "settings-certificate-id", - "settings-custom-certificate-enabled", - ].filter((k) => argv[k] === undefined); + if (!argv.body && groupSet) { + const missing = ["settings-custom-certificate-enabled"].filter( + (k) => argv[k] === undefined + ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --settings-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --settings-custom-certificate-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/gateway/locations/create.ts b/packages/cli/src/commands/_generated/zero-trust/gateway/locations/create.ts index 0f94852216..521cd6cbde 100644 --- a/packages/cli/src/commands/_generated/zero-trust/gateway/locations/create.ts +++ b/packages/cli/src/commands/_generated/zero-trust/gateway/locations/create.ts @@ -122,11 +122,11 @@ function builder(yargs: Argv) { const groupSet = ["max-ttl-mode", "max-ttl-ttl-secs"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["max-ttl-mode"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --max_ttl-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --max-ttl-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/gateway/locations/update.ts b/packages/cli/src/commands/_generated/zero-trust/gateway/locations/update.ts index d3b462aa76..e6819621ce 100644 --- a/packages/cli/src/commands/_generated/zero-trust/gateway/locations/update.ts +++ b/packages/cli/src/commands/_generated/zero-trust/gateway/locations/update.ts @@ -124,11 +124,11 @@ function builder(yargs: Argv) { const groupSet = ["max-ttl-mode", "max-ttl-ttl-secs"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["max-ttl-mode"].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --max_ttl-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --max-ttl-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/gateway/rules/create.ts b/packages/cli/src/commands/_generated/zero-trust/gateway/rules/create.ts index d0044e9019..a0e1fe7f4d 100644 --- a/packages/cli/src/commands/_generated/zero-trust/gateway/rules/create.ts +++ b/packages/cli/src/commands/_generated/zero-trust/gateway/rules/create.ts @@ -464,7 +464,7 @@ function builder(yargs: Argv) { const groupSet = ["expiration-duration", "expiration-expires-at"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["expiration-expires-at"].filter( (k) => argv[k] === undefined ); @@ -478,66 +478,34 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "rule-settings-add-headers", - "rule-settings-allow-child-bypass", - "rule-settings-biso-admin-controls-copy", - "rule-settings-biso-admin-controls-dcp", - "rule-settings-biso-admin-controls-dd", - "rule-settings-biso-admin-controls-dk", - "rule-settings-biso-admin-controls-download", - "rule-settings-biso-admin-controls-dp", - "rule-settings-biso-admin-controls-du", - "rule-settings-biso-admin-controls-keyboard", - "rule-settings-biso-admin-controls-paste", - "rule-settings-biso-admin-controls-printing", - "rule-settings-biso-admin-controls-upload", - "rule-settings-biso-admin-controls-version", - "rule-settings-biso-admin-controls-wm-id", "rule-settings-block-page-include-context", "rule-settings-block-page-target-uri", - "rule-settings-block-page-enabled", - "rule-settings-block-reason", - "rule-settings-bypass-parent-rule", - "rule-settings-check-session-duration", - "rule-settings-check-session-enforce", - "rule-settings-delete-headers", - "rule-settings-dns-resolvers-ipv4", - "rule-settings-dns-resolvers-ipv6", - "rule-settings-egress-ipv4", - "rule-settings-egress-ipv4-fallback", - "rule-settings-egress-ipv6", - "rule-settings-forensic-copy-enabled", - "rule-settings-ignore-cname-category-matches", - "rule-settings-insecure-disable-dnssec-validation", - "rule-settings-ip-categories", - "rule-settings-ip-indicator-feeds", - "rule-settings-l4override-ip", - "rule-settings-l4override-port", - "rule-settings-notification-settings-enabled", - "rule-settings-notification-settings-include-context", - "rule-settings-notification-settings-msg", - "rule-settings-notification-settings-support-url", - "rule-settings-override-host", - "rule-settings-override-ips", - "rule-settings-payload-log-enabled", - "rule-settings-quarantine-file-types", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = ["rule-settings-block-page-target-uri"].filter( + (k) => argv[k] === undefined + ); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --rule-settings-block-page-* flag is set` + ); + } + } + return true; + }) + .check((argv) => { + const groupSet = [ "rule-settings-redirect-include-context", "rule-settings-redirect-preserve-path-and-query", "rule-settings-redirect-target-uri", - "rule-settings-resolve-dns-internally-fallback", - "rule-settings-resolve-dns-internally-view-id", - "rule-settings-resolve-dns-through-cloudflare", - "rule-settings-set-headers", - "rule-settings-untrusted-cert-action", ].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = [ - "rule-settings-block-page-target-uri", - "rule-settings-redirect-target-uri", - ].filter((k) => argv[k] === undefined); + if (!argv.body && groupSet) { + const missing = ["rule-settings-redirect-target-uri"].filter( + (k) => argv[k] === undefined + ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --rule_settings-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --rule-settings-redirect-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/gateway/rules/update.ts b/packages/cli/src/commands/_generated/zero-trust/gateway/rules/update.ts index 071c553dd8..fea420e7bc 100644 --- a/packages/cli/src/commands/_generated/zero-trust/gateway/rules/update.ts +++ b/packages/cli/src/commands/_generated/zero-trust/gateway/rules/update.ts @@ -465,7 +465,7 @@ function builder(yargs: Argv) { const groupSet = ["expiration-duration", "expiration-expires-at"].some( (k) => argv[k] !== undefined ); - if (groupSet) { + if (!argv.body && groupSet) { const missing = ["expiration-expires-at"].filter( (k) => argv[k] === undefined ); @@ -479,66 +479,34 @@ function builder(yargs: Argv) { }) .check((argv) => { const groupSet = [ - "rule-settings-add-headers", - "rule-settings-allow-child-bypass", - "rule-settings-biso-admin-controls-copy", - "rule-settings-biso-admin-controls-dcp", - "rule-settings-biso-admin-controls-dd", - "rule-settings-biso-admin-controls-dk", - "rule-settings-biso-admin-controls-download", - "rule-settings-biso-admin-controls-dp", - "rule-settings-biso-admin-controls-du", - "rule-settings-biso-admin-controls-keyboard", - "rule-settings-biso-admin-controls-paste", - "rule-settings-biso-admin-controls-printing", - "rule-settings-biso-admin-controls-upload", - "rule-settings-biso-admin-controls-version", - "rule-settings-biso-admin-controls-wm-id", "rule-settings-block-page-include-context", "rule-settings-block-page-target-uri", - "rule-settings-block-page-enabled", - "rule-settings-block-reason", - "rule-settings-bypass-parent-rule", - "rule-settings-check-session-duration", - "rule-settings-check-session-enforce", - "rule-settings-delete-headers", - "rule-settings-dns-resolvers-ipv4", - "rule-settings-dns-resolvers-ipv6", - "rule-settings-egress-ipv4", - "rule-settings-egress-ipv4-fallback", - "rule-settings-egress-ipv6", - "rule-settings-forensic-copy-enabled", - "rule-settings-ignore-cname-category-matches", - "rule-settings-insecure-disable-dnssec-validation", - "rule-settings-ip-categories", - "rule-settings-ip-indicator-feeds", - "rule-settings-l4override-ip", - "rule-settings-l4override-port", - "rule-settings-notification-settings-enabled", - "rule-settings-notification-settings-include-context", - "rule-settings-notification-settings-msg", - "rule-settings-notification-settings-support-url", - "rule-settings-override-host", - "rule-settings-override-ips", - "rule-settings-payload-log-enabled", - "rule-settings-quarantine-file-types", + ].some((k) => argv[k] !== undefined); + if (!argv.body && groupSet) { + const missing = ["rule-settings-block-page-target-uri"].filter( + (k) => argv[k] === undefined + ); + if (missing.length > 0) { + throw new Error( + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --rule-settings-block-page-* flag is set` + ); + } + } + return true; + }) + .check((argv) => { + const groupSet = [ "rule-settings-redirect-include-context", "rule-settings-redirect-preserve-path-and-query", "rule-settings-redirect-target-uri", - "rule-settings-resolve-dns-internally-fallback", - "rule-settings-resolve-dns-internally-view-id", - "rule-settings-resolve-dns-through-cloudflare", - "rule-settings-set-headers", - "rule-settings-untrusted-cert-action", ].some((k) => argv[k] !== undefined); - if (groupSet) { - const missing = [ - "rule-settings-block-page-target-uri", - "rule-settings-redirect-target-uri", - ].filter((k) => argv[k] === undefined); + if (!argv.body && groupSet) { + const missing = ["rule-settings-redirect-target-uri"].filter( + (k) => argv[k] === undefined + ); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --rule_settings-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --rule-settings-redirect-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/organization/create.ts b/packages/cli/src/commands/_generated/zero-trust/organization/create.ts index b88c21e498..e28e938b7a 100644 --- a/packages/cli/src/commands/_generated/zero-trust/organization/create.ts +++ b/packages/cli/src/commands/_generated/zero-trust/organization/create.ts @@ -216,7 +216,7 @@ function builder(yargs: Argv) { "service-token-inactivity-enabled", "service-token-inactivity-inactivity-threshold-days", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "service-token-inactivity-action", "service-token-inactivity-enabled", @@ -224,7 +224,7 @@ function builder(yargs: Argv) { ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --service_token_inactivity-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --service-token-inactivity-* flag is set` ); } } diff --git a/packages/cli/src/commands/_generated/zero-trust/organization/update.ts b/packages/cli/src/commands/_generated/zero-trust/organization/update.ts index f6bd1c37f8..57ce90a318 100644 --- a/packages/cli/src/commands/_generated/zero-trust/organization/update.ts +++ b/packages/cli/src/commands/_generated/zero-trust/organization/update.ts @@ -220,7 +220,7 @@ function builder(yargs: Argv) { "service-token-inactivity-enabled", "service-token-inactivity-inactivity-threshold-days", ].some((k) => argv[k] !== undefined); - if (groupSet) { + if (!argv.body && groupSet) { const missing = [ "service-token-inactivity-action", "service-token-inactivity-enabled", @@ -228,7 +228,7 @@ function builder(yargs: Argv) { ].filter((k) => argv[k] === undefined); if (missing.length > 0) { throw new Error( - `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --service_token_inactivity-* flag is set` + `${missing.map((m) => "--" + m).join(", ")} ${missing.length === 1 ? "is" : "are"} required when any --service-token-inactivity-* flag is set` ); } }