diff --git a/src/index.ts b/src/index.ts index d4103b5..f35a5a4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -106,14 +106,14 @@ const logger = { let currentApiKey: string | undefined = undefined; +const allGeneratedTools = await loadAllTools(); +logger.info(`Dynamically loaded ${allGeneratedTools.length} tools...`); + async function run() { const args = process.argv.slice(2); const isSSE = args.includes('--sse') || process.env.MCP_TRANSPORT === 'sse'; logger.info(`Transport mode determined: ${isSSE ? 'HTTP/SSE' : 'Stdio'}`); - const allGeneratedTools = await loadAllTools(); - logger.info(`Dynamically loaded ${allGeneratedTools.length} tools...`); - const server = new Server( { name: SERVER_NAME, version: APP_VERSION }, { capabilities: { tools: {} } } @@ -127,6 +127,8 @@ async function run() { process.exit(0); }); + logger.info(`Registering ${allGeneratedTools.length} tools...`); + server.setRequestHandler(CallToolRequestSchema, async (request) => { const toolName = request.params.name; const tool = allGeneratedTools.find((t) => t.method === toolName); diff --git a/src/tools/create_collection.ts b/src/tools/create_collection.ts index accf0f2..a441cd2 100644 --- a/src/tools/create_collection.ts +++ b/src/tools/create_collection.ts @@ -20,4081 +20,108 @@ export const parameters = z.object({ }) .describe('Information about the collection.'), item: z.array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z - .object({ - name: z.string().describe("The item's name.").optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z.string().describe("The description's contents.").optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z.string().nullable().describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } + z + .object({ + name: z.string().describe("The item's name.").optional(), + description: z.string().nullable().describe("The item's description.").optional(), + variable: z + .array( + z + .object({ + key: z.string().describe("The variable's key (name).").optional(), + value: z.string().describe("The key's value.").optional(), + type: z + .enum(['string', 'boolean', 'integer']) + .describe("The variable's type.") + .optional(), + description: z + .string() + .describe( + "The variable's description. Doesn't apply to collection-level variables." + ) + .optional(), + disabled: z.boolean().default(false), }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - variable: z - .array( - z + .describe('Information about the variable.') + ) + .describe( + "A list of the collection's [variables](https://learning.postman.com/docs/sending-requests/variables/variables/). Make certain not to include sensitive information in variables." + ) + .optional(), + event: z + .array( + z + .object({ + listen: z + .enum(['test', 'prerequest']) + .describe( + 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' + ), + script: z .object({ - key: z.string().describe("The variable's key (name).").optional(), - value: z.string().describe("The key's value.").optional(), type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) + .describe('The type of script. For example, `text/javascript`.') .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe( - "A list of the collection's [variables](https://learning.postman.com/docs/sending-requests/variables/variables/). Make certain not to include sensitive information in variables." - ) - .optional(), - event: z - .array( - z - .object({ - listen: z - .enum(['test', 'prerequest']) - .describe( - 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' - ), - script: z - .object({ - type: z - .string() - .describe('The type of script. For example, `text/javascript`.') - .optional(), - exec: z - .array(z.string().nullable()) - .describe( - 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' - ) - .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z.string().describe("The request's raw URL.").optional(), - protocol: z - .string() - .describe('The request protocol.') - .optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe( - "A list of the host's subdomain components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe("A list of the URL's path components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), - }) + exec: z + .array(z.string().nullable()) .describe( - 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' + 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' ) .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), }) - .describe("Information about the collection's events.") - ) - .describe( - 'A list of scripts configured to run when specific events occur. These scripts can be referenced in the collection by their ID.' - ) - .optional(), - request: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - url: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z.string().describe("The request's raw URL.").optional(), - protocol: z.string().describe('The request protocol.').optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe("A list of the host's subdomain components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe("A list of the URL's path components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - auth: z - .object({ - type: z - .enum([ - 'noauth', - 'basic', - 'bearer', - 'apikey', - 'digest', - 'oauth1', - 'oauth2', - 'hawk', - 'awsv4', - 'ntlm', - 'edgegrid', - ]) - .describe('The authorization type.'), - noauth: z.any().optional(), - apikey: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe("The API key's authentication information.") - .optional(), - awsv4: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [AWS Signature](https://learning.postman.com/docs/sending-requests/authorization/aws-signature/) authentication.' - ) - .optional(), - basic: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Basic Auth](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#basic-auth).' - ) - .optional(), - bearer: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Bearer Token](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#bearer-token) authentication.' - ) - .optional(), - digest: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Digest](https://learning.postman.com/docs/sending-requests/authorization/digest-auth/) access authentication.' - ) - .optional(), - edgegrid: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Akamai Edgegrid](https://learning.postman.com/docs/sending-requests/authorization/akamai-edgegrid/) authentication.' - ) - .optional(), - hawk: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Hawk](https://learning.postman.com/docs/sending-requests/authorization/hawk-authentication/) authentication.' - ) - .optional(), - ntlm: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [NTLM](https://learning.postman.com/docs/sending-requests/authorization/ntlm-authentication/) authentication.' - ) - .optional(), - oauth1: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth1](https://learning.postman.com/docs/sending-requests/authorization/oauth-10/) authentication.' - ) - .optional(), - oauth2: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/) authentication.' - ) - .optional(), - }) - .describe( - 'The [authorization type supported by Postman](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - .optional(), - proxy: z - .object({ - match: z - .string() - .describe('The URL match for the defined proxy configuration.') - .default('http+https://*/*'), - host: z.string().describe("The proxy server's host.").optional(), - port: z - .number() - .int() - .gte(0) - .describe("The proxy server's port.") - .default(8080), - tunnel: z - .boolean() - .describe('The tunneling details for the proxy configuration.') - .default(false), - disabled: z - .boolean() - .describe('If true, ignores the proxy configuration.') - .default(false), - }) - .describe('Information about custom proxy confiurations.') - .optional(), - certificate: z - .object({ - name: z.string().describe("The SSL certificate's name.").optional(), - matches: z - .array(z.string()) - .describe( - 'A list of URL match pattern strings to identify the URLs the certificate can be used for.' - ) - .optional(), - key: z - .object({ - src: z - .string() - .describe( - 'The path to the file that contains the certificate in the file system.' - ) - .optional(), - }) - .describe('Information about the private key.') - .optional(), - cert: z - .object({ - src: z - .string() - .describe( - 'The path to the file that contains the key for the certificate in the file system.' - ) - .optional(), - }) - .describe('Information about the file certificate.') - .optional(), - passphrase: z - .string() - .describe("The certificate's passphrase.") - .optional(), - }) - .optional(), - method: z - .union([ - z - .enum([ - 'GET', - 'PUT', - 'POST', - 'PATCH', - 'DELETE', - 'COPY', - 'HEAD', - 'OPTIONS', - 'LINK', - 'UNLINK', - 'PURGE', - 'LOCK', - 'UNLOCK', - 'PROPFIND', - 'VIEW', - ]) - .describe("The request's standard HTTP method."), - z.string().describe("The request's custom HTTP method."), - ]) - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z.string().nullable().describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - header: z - .array( - z - .object({ - key: z - .string() - .describe( - "The header's key, such as `Content-Type` or `X-Custom-Header`." - ), - value: z.string().describe("The header key's value."), - disabled: z - .boolean() - .describe("If true, the current header isn't sent with requests.") - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - .describe('Information about the header.') - ) - .describe('A list of headers.') - .optional(), - body: z - .object({ - mode: z - .enum(['raw', 'urlencoded', 'formdata', 'file', 'graphql']) - .describe('The data associated with the request.') - .optional(), - raw: z - .string() - .describe( - 'If the `mode` value is `raw`, the raw content of the request body.' - ) - .optional(), - urlencoded: z - .array( - z.object({ - key: z.string().describe('The key value.'), - value: z.string().describe("The key's value.").optional(), - disabled: z.boolean().default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe('A list of x-www-form-encoded key/value pairs.') - .optional(), - formdata: z - .array( - z.record(z.any()).and( - z.union([ - z.object({ - key: z.string().describe('The key value.').optional(), - value: z.string().describe("The key's value.").optional(), - disabled: z - .boolean() - .describe('If true, prevents sending the form-data entry.') - .default(false), - type: z - .literal('text') - .describe('The `text` value.') - .optional(), - contentType: z - .string() - .describe('The form-data Content-Type header.') - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }), - z.object({ - key: z.string().describe('The key value.').optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.array(z.string()), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - disabled: z - .boolean() - .describe('If true, prevents sending the form-data entry.') - .default(false), - type: z - .literal('file') - .describe('The `file` value.') - .optional(), - contentType: z - .string() - .describe('The form-data Content-Type header.') - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }), - ]) - ) - ) - .describe( - 'If the `mode` value is `formdata`, then a list of form-data key/pair values.' - ) - .optional(), - file: z - .object({ - src: z - .string() - .nullable() - .describe( - 'The name of the file to upload (not its path). A null value indicates that no file is selected as a part of the request body.' - ) - .optional(), - content: z.string().optional(), - }) - .describe( - 'If the `mode` value is `file`, an object containing the file request information.' - ) - .optional(), - graphql: z - .object({ - query: z.string().describe('The GraphQL query.').optional(), - variables: z - .string() - .nullable() - .describe('The GraphQL query variables, in JSON format.') - .optional(), - }) - .describe( - 'If the `mode` value is `graphql`, an object containing the GraphQL request information.' - ) - .optional(), - options: z - .record(z.any()) - .describe( - 'Additional configurations and options set for various modes.' - ) - .optional(), - disabled: z - .boolean() - .describe('When set to true, prevents request body from being sent.') - .default(false), - }) - .describe("Information about the collection's request body.") - .optional(), - }), - z.string().nullable(), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the collection request.'), - response: z - .array(z.any().describe("Information about the request's response.")) - .describe("A list of the collection's responses.") - .optional(), - protocolProfileBehavior: z - .object({ - strictSSL: z - .boolean() - .describe('If true, enables certificate verification.') - .optional(), - followRedirects: z - .boolean() - .describe('If true, follow HTTP 3xx responses as redirects.') - .optional(), - maxRedirects: z - .number() - .describe('The maximum number of redirects to follow.') - .optional(), - disableBodyPruning: z - .boolean() - .describe( - 'If true, disables request body pruning for the GET, COPY, HEAD, PURGE, and UNLOCK methods.' - ) - .optional(), - disableUrlEncoding: z - .boolean() .describe( - 'If true, disables the percent encoding of auth, path, query, and fragment URL segments.' + 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' ) .optional(), - disabledSystemHeaders: z - .object({ - 'cache-control': z.boolean().optional(), - 'postman-token': z.boolean().optional(), - 'content-type': z.boolean().optional(), - 'content-length': z.boolean().optional(), - 'accept-encoding': z.boolean().optional(), - connection: z.boolean().optional(), - host: z.boolean().optional(), - }) - .describe('Disable the system headers which are added implicitly.') - .optional(), - insecureHTTPParser: z - .boolean() - .describe( - 'If true, uses an insecure HTTP parser that accepts invalid HTTP headers.' - ) - .optional(), - followOriginalHttpMethod: z - .boolean() - .describe( - 'If true, redirects with the original HTTP method. Redirects with the GET HTTP method by default.' - ) - .optional(), - followAuthorizationHeader: z - .boolean() - .describe( - 'If true, retains the `authorization` header when a redirect happens to a different hostname.' - ) - .optional(), - protocolVersion: z - .enum(['http1', 'http2', 'auto']) - .describe( - 'The HTTP protocol version to use. Supports the `http1`, `http2`, and `auto` values.' - ) - .optional(), - removeRefererHeaderOnRedirect: z - .boolean() - .describe('If true, removes the `referer` header when a redirect happens.') - .optional(), - tlsPreferServerCiphers: z - .boolean() - .describe( - "If true, uses the server's cipher suite order instead of the client's during negotiation." - ) - .optional(), - tlsDisabledProtocols: z + }) + .describe("Information about the collection's events.") + ) + .describe('A list of scripts configured to run when specific events occur.') + .optional(), + request: z + .object({ + url: z + .object({ + raw: z.string().describe("The request's raw URL.").optional(), + protocol: z.string().describe('The request protocol.').optional(), + host: z.array(z.string().nullable()).describe("The host's URL.").optional(), + path: z .array(z.string()) - .describe('The SSL and TLS protocol versions to disable during negotiation.') + .describe("A list of the URL's path components.") .optional(), - tlsCipherSelection: z - .array(z.string()) + port: z + .string() .describe( - 'The order of cipher suites that the SSL server profile uses to establish a secure connection.' + "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." ) .optional(), - }) - .describe( - 'The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.' - ) - .optional(), - }) - .describe('Information about the collection request or folder.'), - z - .object({ - name: z.string().describe("The folder's name.").optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z.string().describe("The description's contents.").optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z.string().nullable().describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z.string().describe("The variable's key (name).").optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe( - "A list of the collection's [variables](https://learning.postman.com/docs/sending-requests/variables/variables/). Make certain not to include sensitive information in variables." - ) - .optional(), - item: z - .array( - z.union([ - z - .object({ - name: z.string().describe("The item's name.").optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z.string().nullable().describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z.string().describe("The variable's key (name).").optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe( - "A list of the collection's [variables](https://learning.postman.com/docs/sending-requests/variables/variables/). Make certain not to include sensitive information in variables." - ) - .optional(), - event: z - .array( - z - .object({ - listen: z - .enum(['test', 'prerequest']) - .describe( - 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' - ), - script: z - .object({ - type: z - .string() - .describe( - 'The type of script. For example, `text/javascript`.' - ) - .optional(), - exec: z - .array(z.string().nullable()) - .describe( - 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' - ) - .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z - .string() - .describe("The request's raw URL.") - .optional(), - protocol: z - .string() - .describe('The request protocol.') - .optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe( - "A list of the host's subdomain components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z - .string() - .nullable() - .optional(), - value: z - .string() - .nullable() - .optional(), - }), - ]; - const errors = schemas.reduce< - z.ZodError[] - >( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if ( - schemas.length - errors.length !== - 1 - ) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe( - "A list of the URL's path components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe( - "The description's contents." - ) - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe( - "The collection's description." - ), - ]; - const errors = schemas.reduce< - z.ZodError[] - >( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if ( - schemas.length - errors.length !== - 1 - ) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), - }) - .describe( - 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' - ) - .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), - }) - .describe("Information about the collection's events.") - ) - .describe( - 'A list of scripts configured to run when specific events occur. These scripts can be referenced in the collection by their ID.' - ) - .optional(), - request: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - url: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z - .string() - .describe("The request's raw URL.") - .optional(), - protocol: z - .string() - .describe('The request protocol.') - .optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe( - "A list of the host's subdomain components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe( - "A list of the URL's path components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe( - "The collection's description." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - auth: z - .object({ - type: z - .enum([ - 'noauth', - 'basic', - 'bearer', - 'apikey', - 'digest', - 'oauth1', - 'oauth2', - 'hawk', - 'awsv4', - 'ntlm', - 'edgegrid', - ]) - .describe('The authorization type.'), - noauth: z.any().optional(), - apikey: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe("The API key's authentication information.") - .optional(), - awsv4: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [AWS Signature](https://learning.postman.com/docs/sending-requests/authorization/aws-signature/) authentication.' - ) - .optional(), - basic: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Basic Auth](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#basic-auth).' - ) - .optional(), - bearer: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Bearer Token](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#bearer-token) authentication.' - ) - .optional(), - digest: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Digest](https://learning.postman.com/docs/sending-requests/authorization/digest-auth/) access authentication.' - ) - .optional(), - edgegrid: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Akamai Edgegrid](https://learning.postman.com/docs/sending-requests/authorization/akamai-edgegrid/) authentication.' - ) - .optional(), - hawk: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Hawk](https://learning.postman.com/docs/sending-requests/authorization/hawk-authentication/) authentication.' - ) - .optional(), - ntlm: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [NTLM](https://learning.postman.com/docs/sending-requests/authorization/ntlm-authentication/) authentication.' - ) - .optional(), - oauth1: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth1](https://learning.postman.com/docs/sending-requests/authorization/oauth-10/) authentication.' - ) - .optional(), - oauth2: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/) authentication.' - ) - .optional(), - }) - .describe( - 'The [authorization type supported by Postman](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - .optional(), - proxy: z - .object({ - match: z - .string() - .describe( - 'The URL match for the defined proxy configuration.' - ) - .default('http+https://*/*'), - host: z - .string() - .describe("The proxy server's host.") - .optional(), - port: z - .number() - .int() - .gte(0) - .describe("The proxy server's port.") - .default(8080), - tunnel: z - .boolean() - .describe( - 'The tunneling details for the proxy configuration.' - ) - .default(false), - disabled: z - .boolean() - .describe('If true, ignores the proxy configuration.') - .default(false), - }) - .describe('Information about custom proxy confiurations.') - .optional(), - certificate: z - .object({ - name: z - .string() - .describe("The SSL certificate's name.") - .optional(), - matches: z - .array(z.string()) - .describe( - 'A list of URL match pattern strings to identify the URLs the certificate can be used for.' - ) - .optional(), - key: z - .object({ - src: z - .string() - .describe( - 'The path to the file that contains the certificate in the file system.' - ) - .optional(), - }) - .describe('Information about the private key.') - .optional(), - cert: z - .object({ - src: z - .string() - .describe( - 'The path to the file that contains the key for the certificate in the file system.' - ) - .optional(), - }) - .describe('Information about the file certificate.') - .optional(), - passphrase: z - .string() - .describe("The certificate's passphrase.") - .optional(), - }) - .optional(), - method: z - .union([ - z - .enum([ - 'GET', - 'PUT', - 'POST', - 'PATCH', - 'DELETE', - 'COPY', - 'HEAD', - 'OPTIONS', - 'LINK', - 'UNLINK', - 'PURGE', - 'LOCK', - 'UNLOCK', - 'PROPFIND', - 'VIEW', - ]) - .describe("The request's standard HTTP method."), - z.string().describe("The request's custom HTTP method."), - ]) - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - header: z - .array( - z - .object({ - key: z - .string() - .describe( - "The header's key, such as `Content-Type` or `X-Custom-Header`." - ), - value: z.string().describe("The header key's value."), - disabled: z - .boolean() - .describe( - "If true, the current header isn't sent with requests." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - .describe('Information about the header.') - ) - .describe('A list of headers.') - .optional(), - body: z - .object({ - mode: z - .enum(['raw', 'urlencoded', 'formdata', 'file', 'graphql']) - .describe('The data associated with the request.') - .optional(), - raw: z - .string() - .describe( - 'If the `mode` value is `raw`, the raw content of the request body.' - ) - .optional(), - urlencoded: z - .array( - z.object({ - key: z.string().describe('The key value.'), - value: z - .string() - .describe("The key's value.") - .optional(), - disabled: z.boolean().default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe('A list of x-www-form-encoded key/value pairs.') - .optional(), - formdata: z - .array( - z.record(z.any()).and( - z.union([ - z.object({ - key: z - .string() - .describe('The key value.') - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - 'If true, prevents sending the form-data entry.' - ) - .default(false), - type: z - .literal('text') - .describe('The `text` value.') - .optional(), - contentType: z - .string() - .describe('The form-data Content-Type header.') - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }), - z.object({ - key: z - .string() - .describe('The key value.') - .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.array(z.string()), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - disabled: z - .boolean() - .describe( - 'If true, prevents sending the form-data entry.' - ) - .default(false), - type: z - .literal('file') - .describe('The `file` value.') - .optional(), - contentType: z - .string() - .describe('The form-data Content-Type header.') - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }), - ]) - ) - ) - .describe( - 'If the `mode` value is `formdata`, then a list of form-data key/pair values.' - ) - .optional(), - file: z - .object({ - src: z - .string() - .nullable() - .describe( - 'The name of the file to upload (not its path). A null value indicates that no file is selected as a part of the request body.' - ) - .optional(), - content: z.string().optional(), - }) - .describe( - 'If the `mode` value is `file`, an object containing the file request information.' - ) - .optional(), - graphql: z - .object({ - query: z - .string() - .describe('The GraphQL query.') - .optional(), - variables: z - .string() - .nullable() - .describe( - 'The GraphQL query variables, in JSON format.' - ) - .optional(), - }) - .describe( - 'If the `mode` value is `graphql`, an object containing the GraphQL request information.' - ) - .optional(), - options: z - .record(z.any()) - .describe( - 'Additional configurations and options set for various modes.' - ) - .optional(), - disabled: z - .boolean() - .describe( - 'When set to true, prevents request body from being sent.' - ) - .default(false), - }) - .describe("Information about the collection's request body.") - .optional(), - }), - z.string().nullable(), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the collection request.'), - response: z - .array(z.any().describe("Information about the request's response.")) - .describe("A list of the collection's responses.") - .optional(), - protocolProfileBehavior: z - .object({ - strictSSL: z - .boolean() - .describe('If true, enables certificate verification.') - .optional(), - followRedirects: z - .boolean() - .describe('If true, follow HTTP 3xx responses as redirects.') - .optional(), - maxRedirects: z - .number() - .describe('The maximum number of redirects to follow.') - .optional(), - disableBodyPruning: z - .boolean() - .describe( - 'If true, disables request body pruning for the GET, COPY, HEAD, PURGE, and UNLOCK methods.' - ) - .optional(), - disableUrlEncoding: z - .boolean() - .describe( - 'If true, disables the percent encoding of auth, path, query, and fragment URL segments.' - ) - .optional(), - disabledSystemHeaders: z - .object({ - 'cache-control': z.boolean().optional(), - 'postman-token': z.boolean().optional(), - 'content-type': z.boolean().optional(), - 'content-length': z.boolean().optional(), - 'accept-encoding': z.boolean().optional(), - connection: z.boolean().optional(), - host: z.boolean().optional(), - }) - .describe('Disable the system headers which are added implicitly.') - .optional(), - insecureHTTPParser: z - .boolean() - .describe( - 'If true, uses an insecure HTTP parser that accepts invalid HTTP headers.' - ) - .optional(), - followOriginalHttpMethod: z - .boolean() - .describe( - 'If true, redirects with the original HTTP method. Redirects with the GET HTTP method by default.' - ) - .optional(), - followAuthorizationHeader: z - .boolean() - .describe( - 'If true, retains the `authorization` header when a redirect happens to a different hostname.' - ) - .optional(), - protocolVersion: z - .enum(['http1', 'http2', 'auto']) - .describe( - 'The HTTP protocol version to use. Supports the `http1`, `http2`, and `auto` values.' - ) - .optional(), - removeRefererHeaderOnRedirect: z - .boolean() - .describe( - 'If true, removes the `referer` header when a redirect happens.' - ) - .optional(), - tlsPreferServerCiphers: z - .boolean() - .describe( - "If true, uses the server's cipher suite order instead of the client's during negotiation." - ) - .optional(), - tlsDisabledProtocols: z - .array(z.string()) - .describe( - 'The SSL and TLS protocol versions to disable during negotiation.' - ) - .optional(), - tlsCipherSelection: z - .array(z.string()) - .describe( - 'The order of cipher suites that the SSL server profile uses to establish a secure connection.' - ) - .optional(), - }) - .describe( - 'The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.' - ) + query: z + .array( + z.object({ + key: z + .string() + .nullable() + .describe("The query parameter's key.") .optional(), - }) - .describe('Information about the collection request or folder.'), - z - .object({ - name: z.string().describe("The folder's name.").optional(), + value: z.string().nullable().describe("The key's value.").optional(), + disabled: z + .boolean() + .describe("If true, the query parameter isn't sent with the request.") + .default(false), description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z.string().nullable().describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z.string().describe("The variable's key (name).").optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe( - "A list of the collection's [variables](https://learning.postman.com/docs/sending-requests/variables/variables/). Make certain not to include sensitive information in variables." - ) - .optional(), - item: z.any(), - event: z - .array( - z - .object({ - listen: z - .enum(['test', 'prerequest']) - .describe( - 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' - ), - script: z - .object({ - type: z - .string() - .describe( - 'The type of script. For example, `text/javascript`.' - ) - .optional(), - exec: z - .array(z.string().nullable()) - .describe( - 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' - ) - .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z - .string() - .describe("The request's raw URL.") - .optional(), - protocol: z - .string() - .describe('The request protocol.') - .optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe( - "A list of the host's subdomain components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z - .string() - .nullable() - .optional(), - value: z - .string() - .nullable() - .optional(), - }), - ]; - const errors = schemas.reduce< - z.ZodError[] - >( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if ( - schemas.length - errors.length !== - 1 - ) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe( - "A list of the URL's path components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe( - "The description's contents." - ) - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe( - "The collection's description." - ), - ]; - const errors = schemas.reduce< - z.ZodError[] - >( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if ( - schemas.length - errors.length !== - 1 - ) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), - }) - .describe( - 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' - ) - .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), - }) - .describe("Information about the collection's events.") - ) - .describe( - 'A list of scripts configured to run when specific events occur. These scripts can be referenced in the collection by their ID.' - ) - .optional(), - auth: z - .object({ - type: z - .enum([ - 'noauth', - 'basic', - 'bearer', - 'apikey', - 'digest', - 'oauth1', - 'oauth2', - 'hawk', - 'awsv4', - 'ntlm', - 'edgegrid', - ]) - .describe('The authorization type.'), - noauth: z.any().optional(), - apikey: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe("The API key's authentication information.") - .optional(), - awsv4: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [AWS Signature](https://learning.postman.com/docs/sending-requests/authorization/aws-signature/) authentication.' - ) - .optional(), - basic: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Basic Auth](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#basic-auth).' - ) - .optional(), - bearer: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Bearer Token](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#bearer-token) authentication.' - ) - .optional(), - digest: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Digest](https://learning.postman.com/docs/sending-requests/authorization/digest-auth/) access authentication.' - ) - .optional(), - edgegrid: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Akamai Edgegrid](https://learning.postman.com/docs/sending-requests/authorization/akamai-edgegrid/) authentication.' - ) - .optional(), - hawk: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Hawk](https://learning.postman.com/docs/sending-requests/authorization/hawk-authentication/) authentication.' - ) - .optional(), - ntlm: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [NTLM](https://learning.postman.com/docs/sending-requests/authorization/ntlm-authentication/) authentication.' - ) - .optional(), - oauth1: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth1](https://learning.postman.com/docs/sending-requests/authorization/oauth-10/) authentication.' - ) - .optional(), - oauth2: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/) authentication.' - ) - .optional(), - }) - .describe("Information about the folder's authentication.") - .optional(), - protocolProfileBehavior: z - .object({ - strictSSL: z - .boolean() - .describe('If true, enables certificate verification.') - .optional(), - followRedirects: z - .boolean() - .describe('If true, follow HTTP 3xx responses as redirects.') - .optional(), - maxRedirects: z - .number() - .describe('The maximum number of redirects to follow.') - .optional(), - disableBodyPruning: z - .boolean() - .describe( - 'If true, disables request body pruning for the GET, COPY, HEAD, PURGE, and UNLOCK methods.' - ) - .optional(), - disableUrlEncoding: z - .boolean() - .describe( - 'If true, disables the percent encoding of auth, path, query, and fragment URL segments.' - ) - .optional(), - disabledSystemHeaders: z - .object({ - 'cache-control': z.boolean().optional(), - 'postman-token': z.boolean().optional(), - 'content-type': z.boolean().optional(), - 'content-length': z.boolean().optional(), - 'accept-encoding': z.boolean().optional(), - connection: z.boolean().optional(), - host: z.boolean().optional(), - }) - .describe('Disable the system headers which are added implicitly.') - .optional(), - insecureHTTPParser: z - .boolean() - .describe( - 'If true, uses an insecure HTTP parser that accepts invalid HTTP headers.' - ) - .optional(), - followOriginalHttpMethod: z - .boolean() - .describe( - 'If true, redirects with the original HTTP method. Redirects with the GET HTTP method by default.' - ) - .optional(), - followAuthorizationHeader: z - .boolean() - .describe( - 'If true, retains the `authorization` header when a redirect happens to a different hostname.' - ) - .optional(), - protocolVersion: z - .enum(['http1', 'http2', 'auto']) - .describe( - 'The HTTP protocol version to use. Supports the `http1`, `http2`, and `auto` values.' - ) - .optional(), - removeRefererHeaderOnRedirect: z - .boolean() - .describe( - 'If true, removes the `referer` header when a redirect happens.' - ) - .optional(), - tlsPreferServerCiphers: z - .boolean() - .describe( - "If true, uses the server's cipher suite order instead of the client's during negotiation." - ) - .optional(), - tlsDisabledProtocols: z - .array(z.string()) - .describe( - 'The SSL and TLS protocol versions to disable during negotiation.' - ) - .optional(), - tlsCipherSelection: z - .array(z.string()) - .describe( - 'The order of cipher suites that the SSL server profile uses to establish a secure connection.' - ) - .optional(), - }) - .describe( - 'The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.' - ) + .string() + .nullable() + .describe("The query parameter's description.") .optional(), }) - .describe( - "Information about the collection's folders. A folder is an organized group of requests." - ), - ]) - ) - .describe( - "A list of the folder's contents, such as requests, responses, and additional folders." - ), - event: z - .array( - z - .object({ - listen: z - .enum(['test', 'prerequest']) - .describe( - 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' - ), - script: z - .object({ - type: z - .string() - .describe('The type of script. For example, `text/javascript`.') - .optional(), - exec: z - .array(z.string().nullable()) - .describe( - 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' - ) - .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z.string().describe("The request's raw URL.").optional(), - protocol: z - .string() - .describe('The request protocol.') - .optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe( - "A list of the host's subdomain components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe("A list of the URL's path components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), - }) - .describe( - 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' - ) - .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), - }) - .describe("Information about the collection's events.") - ) - .describe( - 'A list of scripts configured to run when specific events occur. These scripts can be referenced in the collection by their ID.' - ) + ) + .describe( + 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' + ) + .optional(), + }) + .describe('Information about the URL.') .optional(), auth: z .object({ @@ -4333,116 +360,258 @@ export const parameters = z.object({ ) .optional(), }) - .describe("Information about the folder's authentication.") + .describe( + 'The [authorization type supported by Postman](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' + ) .optional(), - protocolProfileBehavior: z - .object({ - strictSSL: z - .boolean() - .describe('If true, enables certificate verification.') - .optional(), - followRedirects: z - .boolean() - .describe('If true, follow HTTP 3xx responses as redirects.') - .optional(), - maxRedirects: z - .number() - .describe('The maximum number of redirects to follow.') - .optional(), - disableBodyPruning: z - .boolean() - .describe( - 'If true, disables request body pruning for the GET, COPY, HEAD, PURGE, and UNLOCK methods.' - ) - .optional(), - disableUrlEncoding: z - .boolean() - .describe( - 'If true, disables the percent encoding of auth, path, query, and fragment URL segments.' - ) - .optional(), - disabledSystemHeaders: z + method: z.string().describe("The request's standard HTTP method.").optional(), + description: z + .string() + .nullable() + .describe("The request's description.") + .optional(), + header: z + .array( + z .object({ - 'cache-control': z.boolean().optional(), - 'postman-token': z.boolean().optional(), - 'content-type': z.boolean().optional(), - 'content-length': z.boolean().optional(), - 'accept-encoding': z.boolean().optional(), - connection: z.boolean().optional(), - host: z.boolean().optional(), + key: z + .string() + .describe( + "The header's key, such as `Content-Type` or `X-Custom-Header`." + ), + value: z.string().describe("The header key's value."), + disabled: z + .boolean() + .describe("If true, the current header isn't sent with requests.") + .default(false), + description: z + .string() + .nullable() + .describe("The header's description.") + .optional(), }) - .describe('Disable the system headers which are added implicitly.') + .describe('Information about the header.') + ) + .describe('A list of headers.') + .optional(), + body: z + .object({ + mode: z + .enum(['raw', 'urlencoded', 'formdata', 'file', 'graphql']) + .describe('The data associated with the request.') .optional(), - insecureHTTPParser: z - .boolean() + raw: z + .string() .describe( - 'If true, uses an insecure HTTP parser that accepts invalid HTTP headers.' + 'If the `mode` value is `raw`, the raw content of the request body.' ) .optional(), - followOriginalHttpMethod: z - .boolean() - .describe( - 'If true, redirects with the original HTTP method. Redirects with the GET HTTP method by default.' + urlencoded: z + .array( + z.object({ + key: z.string().describe('The key value.'), + value: z.string().describe("The key's value.").optional(), + description: z + .string() + .nullable() + .describe("The key's description.") + .optional(), + }) ) + .describe('A list of x-www-form-encoded key/value pairs.') .optional(), - followAuthorizationHeader: z - .boolean() - .describe( - 'If true, retains the `authorization` header when a redirect happens to a different hostname.' + formdata: z + .array( + z.record(z.any()).and( + z.union([ + z.object({ + key: z.string().describe('The key value.').optional(), + value: z.string().describe("The key's value.").optional(), + type: z.literal('text').describe('The `text` value.').optional(), + contentType: z + .string() + .describe('The form-data Content-Type header.') + .optional(), + description: z + .string() + .nullable() + .describe("The key's description.") + .optional(), + }), + z.object({ + key: z.string().describe('The key value.').optional(), + src: z + .any() + .superRefine((x, ctx) => { + const schemas = [z.string().nullable(), z.array(z.string())]; + const errors = schemas.reduce( + (errors, schema) => + ((result) => + result.error ? [...errors, result.error] : errors)( + schema.safeParse(x) + ), + [] + ); + if (schemas.length - errors.length !== 1) { + ctx.addIssue({ + path: ctx.path, + code: 'invalid_union', + unionErrors: errors, + message: 'Invalid input: Should pass single schema', + }); + } + }) + .optional(), + type: z.literal('file').describe('The `file` value.').optional(), + contentType: z + .string() + .describe('The form-data Content-Type header.') + .optional(), + description: z + .string() + .nullable() + .describe("The key's description.") + .optional(), + }), + ]) + ) ) - .optional(), - protocolVersion: z - .enum(['http1', 'http2', 'auto']) .describe( - 'The HTTP protocol version to use. Supports the `http1`, `http2`, and `auto` values.' + 'If the `mode` value is `formdata`, then a list of form-data key/pair values.' ) .optional(), - removeRefererHeaderOnRedirect: z - .boolean() - .describe('If true, removes the `referer` header when a redirect happens.') - .optional(), - tlsPreferServerCiphers: z - .boolean() + file: z + .object({ + src: z + .string() + .nullable() + .describe( + 'The name of the file to upload (not its path). A null value indicates that no file is selected as a part of the request body.' + ) + .optional(), + }) .describe( - "If true, uses the server's cipher suite order instead of the client's during negotiation." + 'If the `mode` value is `file`, an object containing the file request information.' ) .optional(), - tlsDisabledProtocols: z - .array(z.string()) - .describe('The SSL and TLS protocol versions to disable during negotiation.') - .optional(), - tlsCipherSelection: z - .array(z.string()) + graphql: z + .object({ + query: z.string().describe('The GraphQL query.').optional(), + variables: z + .string() + .nullable() + .describe('The GraphQL query variables, in JSON format.') + .optional(), + }) .describe( - 'The order of cipher suites that the SSL server profile uses to establish a secure connection.' + 'If the `mode` value is `graphql`, an object containing the GraphQL request information.' ) .optional(), + options: z + .record(z.any()) + .describe('Additional configurations and options set for various modes.') + .optional(), }) .describe( - 'The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.' + 'Information about the collection\'s request body. To set this to "none", pass an empty object.' + ) + .optional(), + }) + .describe('Information about the collection request.') + .optional(), + response: z + .array(z.any().describe("Information about the request's response.")) + .describe("A list of the collection's responses.") + .optional(), + protocolProfileBehavior: z + .object({ + strictSSL: z + .boolean() + .describe('If true, enables certificate verification.') + .optional(), + followRedirects: z + .boolean() + .describe('If true, follow HTTP 3xx responses as redirects.') + .optional(), + maxRedirects: z + .number() + .describe('The maximum number of redirects to follow.') + .optional(), + disableBodyPruning: z + .boolean() + .describe( + 'If true, disables request body pruning for the GET, COPY, HEAD, PURGE, and UNLOCK methods.' + ) + .optional(), + disableUrlEncoding: z + .boolean() + .describe( + 'If true, disables the percent encoding of auth, path, query, and fragment URL segments.' + ) + .optional(), + disabledSystemHeaders: z + .object({ + 'cache-control': z.boolean().optional(), + 'postman-token': z.boolean().optional(), + 'content-type': z.boolean().optional(), + 'content-length': z.boolean().optional(), + 'accept-encoding': z.boolean().optional(), + connection: z.boolean().optional(), + host: z.boolean().optional(), + }) + .describe('Disable the system headers which are added implicitly.') + .optional(), + insecureHTTPParser: z + .boolean() + .describe( + 'If true, uses an insecure HTTP parser that accepts invalid HTTP headers.' + ) + .optional(), + followOriginalHttpMethod: z + .boolean() + .describe( + 'If true, redirects with the original HTTP method. Redirects with the GET HTTP method by default.' + ) + .optional(), + followAuthorizationHeader: z + .boolean() + .describe( + 'If true, retains the `authorization` header when a redirect happens to a different hostname.' + ) + .optional(), + protocolVersion: z + .enum(['http1', 'http2', 'auto']) + .describe( + 'The HTTP protocol version to use. Supports the `http1`, `http2`, and `auto` values.' + ) + .optional(), + removeRefererHeaderOnRedirect: z + .boolean() + .describe('If true, removes the `referer` header when a redirect happens.') + .optional(), + tlsPreferServerCiphers: z + .boolean() + .describe( + "If true, uses the server's cipher suite order instead of the client's during negotiation." + ) + .optional(), + tlsDisabledProtocols: z + .array(z.string()) + .describe('The SSL and TLS protocol versions to disable during negotiation.') + .optional(), + tlsCipherSelection: z + .array(z.string()) + .describe( + 'The order of cipher suites that the SSL server profile uses to establish a secure connection.' ) .optional(), }) .describe( - "Information about the collection's folders. A folder is an organized group of requests." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) + 'The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.' + ) + .optional(), + }) + .describe('Information about the collection request or folder.') ), event: z .array( @@ -4465,240 +634,15 @@ export const parameters = z.object({ 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' ) .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z.string().describe("The request's raw URL.").optional(), - protocol: z.string().describe('The request protocol.').optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe("A list of the host's subdomain components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe("A list of the URL's path components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), }) .describe( 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' ) .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), }) .describe("Information about the collection's events.") ) - .describe( - 'A list of scripts configured to run when specific events occur. These scripts can be referenced in the collection by their ID.' - ) + .describe('A list of scripts configured to run when specific events occur.') .optional(), variable: z .array( @@ -4710,7 +654,6 @@ export const parameters = z.object({ .enum(['string', 'boolean', 'integer']) .describe("The variable's type.") .optional(), - name: z.string().describe("The variable's name.").optional(), description: z .string() .describe( diff --git a/src/tools/create_collection_comment.ts b/src/tools/create_collection_comment.ts index 0fae155..d4a6adc 100644 --- a/src/tools/create_collection_comment.ts +++ b/src/tools/create_collection_comment.ts @@ -19,7 +19,7 @@ export const parameters = z.object({ userName: z .object({ type: z.literal('user').describe('The `user` value.'), - id: z.number().int().describe("The user's ID."), + id: z.string().describe("The user's ID."), }) .describe( "An object that contains information about the tagged user. The object's name is the user's Postman username. For example, `@user-postman`." diff --git a/src/tools/create_collection_request.ts b/src/tools/create_collection_request.ts index 2adb004..d09c54d 100644 --- a/src/tools/create_collection_request.ts +++ b/src/tools/create_collection_request.ts @@ -5,7 +5,7 @@ export const method = 'create-collection-request'; export const description = 'Creates a request in a collection. For a complete list of properties, refer to the **Request** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\n\n**Note:**\n\nIt is recommended that you pass the \\`name\\` property in the request body. If you do not, the system uses a null value. As a result, this creates a request with a blank name.\n'; export const parameters = z.object({ - collectionId: z.string(), + collectionId: z.string().describe("The collection's ID."), folderId: z .string() .describe( @@ -18,9 +18,6 @@ export const parameters = z.object({ "The request's name. It is recommended that you pass the `name` property in the request body. If you do not, the system uses a null value. As a result, this creates a request with a blank name." ) .optional(), - url: z.string().describe('The URL for the request.').optional(), - method: z.string().describe('The HTTP method for the request (e.g., POST, GET).').optional(), - body: z.record(z.any()).describe("The request's body.").optional(), }); export const annotations = { title: @@ -41,10 +38,6 @@ export async function handler( const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint; const bodyPayload: any = {}; if (params.name !== undefined) bodyPayload.name = params.name; - if (params.url !== undefined) bodyPayload.url = params.url; - if (params.method !== undefined) bodyPayload.method = params.method; - if (params.body !== undefined) bodyPayload.body = params.body; - if (params.collectionId !== undefined) bodyPayload.collectionId = params.collectionId; const result = await fetchPostmanAPI(url, { method: 'POST', body: JSON.stringify(bodyPayload), diff --git a/src/tools/create_environment.ts b/src/tools/create_environment.ts index f02caf4..9813946 100644 --- a/src/tools/create_environment.ts +++ b/src/tools/create_environment.ts @@ -15,7 +15,7 @@ export const parameters = z.object({ enabled: z.boolean().describe('If true, the variable is enabled.').optional(), key: z.string().describe("The variable's name.").optional(), value: z.string().describe("The variable's value.").optional(), - type: z.enum(['secret', 'default', 'any']).describe('The variable type.').optional(), + type: z.enum(['secret', 'default']).describe('The variable type.').optional(), }) ) .describe("Information about the environment's variables.") diff --git a/src/tools/create_folder_comment.ts b/src/tools/create_folder_comment.ts index 7e46c74..bc7c50f 100644 --- a/src/tools/create_folder_comment.ts +++ b/src/tools/create_folder_comment.ts @@ -20,7 +20,7 @@ export const parameters = z.object({ userName: z .object({ type: z.literal('user').describe('The `user` value.'), - id: z.number().int().describe("The user's ID."), + id: z.string().describe("The user's ID."), }) .describe( "An object that contains information about the tagged user. The object's name is the user's Postman username. For example, `@user-postman`." diff --git a/src/tools/create_request_comment.ts b/src/tools/create_request_comment.ts index 074c4e0..ac9b5c2 100644 --- a/src/tools/create_request_comment.ts +++ b/src/tools/create_request_comment.ts @@ -24,7 +24,7 @@ export const parameters = z.object({ userName: z .object({ type: z.literal('user').describe('The `user` value.'), - id: z.number().int().describe("The user's ID."), + id: z.string().describe("The user's ID."), }) .describe( "An object that contains information about the tagged user. The object's name is the user's Postman username. For example, `@user-postman`." diff --git a/src/tools/create_response_comment.ts b/src/tools/create_response_comment.ts index 95c5b3f..7d623e4 100644 --- a/src/tools/create_response_comment.ts +++ b/src/tools/create_response_comment.ts @@ -20,7 +20,7 @@ export const parameters = z.object({ userName: z .object({ type: z.literal('user').describe('The `user` value.'), - id: z.number().int().describe("The user's ID."), + id: z.string().describe("The user's ID."), }) .describe( "An object that contains information about the tagged user. The object's name is the user's Postman username. For example, `@user-postman`." diff --git a/src/tools/get_monitors.ts b/src/tools/get_monitors.ts index 58586be..da8c511 100644 --- a/src/tools/get_monitors.ts +++ b/src/tools/get_monitors.ts @@ -25,8 +25,10 @@ export const parameters = z.object({ limit: z .number() .int() - .describe('The maximum number of rows to return in the response.') - .default(10), + .describe( + 'The maximum number of rows to return in the response, up to a maximum value of 25. Any value greater than 25 returns a 400 Bad Request response.' + ) + .default(25), }); export const annotations = { title: 'Gets all monitors.', diff --git a/src/tools/patch_collection.ts b/src/tools/patch_collection.ts index 4d67f15..2934253 100644 --- a/src/tools/patch_collection.ts +++ b/src/tools/patch_collection.ts @@ -19,20 +19,28 @@ export const parameters = z.object({ .array( z .object({ + id: z + .string() + .describe("The variable's ID. Doesn't apply to collection-level variables.") + .optional(), key: z.string().describe("The variable's key (name).").optional(), + description: z + .string() + .describe( + "The variable's description. Doesn't apply to collection-level variables." + ) + .optional(), value: z.string().describe("The key's value.").optional(), type: z .enum(['string', 'boolean', 'integer']) .describe("The variable's type.") .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() + disabled: z + .boolean() .describe( - "The variable's description. Doesn't apply to collection-level variables." + 'If true, the variable is not enabled. Applies only to query parameter variables.' ) - .optional(), - disabled: z.boolean().default(false), + .default(false), }) .describe('Information about the variable.') ) @@ -54,6 +62,8 @@ export const parameters = z.object({ 'awsv4', 'ntlm', 'edgegrid', + 'jwt', + 'asap', ]) .describe('The authorization type.'), apikey: z @@ -274,6 +284,50 @@ export const parameters = z.object({ 'The attributes for [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/) authentication.' ) .optional(), + jwt: z + .array( + z + .object({ + key: z.string().describe("The auth method's key value."), + value: z + .union([z.string(), z.array(z.record(z.any()))]) + .describe("The key's value.") + .optional(), + type: z + .enum(['string', 'boolean', 'number', 'array', 'object', 'any']) + .describe("The value's type.") + .optional(), + }) + .describe( + 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' + ) + ) + .describe( + 'The attributes for JWT (JSON Web Token). Includes the `payload`, `secret`, `algorithm`, `addTokenTo`, and `headerPrefix` properties.' + ) + .optional(), + asap: z + .array( + z + .object({ + key: z.string().describe("The auth method's key value."), + value: z + .union([z.string(), z.array(z.record(z.any()))]) + .describe("The key's value.") + .optional(), + type: z + .enum(['string', 'boolean', 'number', 'array', 'object', 'any']) + .describe("The value's type.") + .optional(), + }) + .describe( + 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' + ) + ) + .describe( + 'The attributes for ASAP (Atlassian S2S Authentication Protocol). Includes the `kid`, `aud`, `iss`, `alg`, `privateKey`, and `claims` properties.' + ) + .optional(), }) .describe( 'The [authorization type supported by Postman](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' @@ -286,9 +340,7 @@ export const parameters = z.object({ id: z.string().describe("The event's ID.").optional(), listen: z .enum(['test', 'prerequest']) - .describe( - 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' - ), + .describe('The `prerequest` (pre-request) or `test` (post-response) value.'), script: z .object({ id: z.string().describe("The script's ID.").optional(), @@ -302,234 +354,11 @@ export const parameters = z.object({ 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' ) .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z.string().describe("The request's raw URL.").optional(), - protocol: z.string().describe('The request protocol.').optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe("A list of the host's subdomain components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe("A list of the URL's path components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), }) .describe( 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' ) .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), }) .describe("Information about the collection's events.") ) diff --git a/src/tools/publish_documentation.ts b/src/tools/publish_documentation.ts index 14e4fed..135a968 100644 --- a/src/tools/publish_documentation.ts +++ b/src/tools/publish_documentation.ts @@ -40,18 +40,17 @@ export const parameters = z.object({ .object({ metaTags: z .array( - z - .object({ - name: z - .string() - .describe( - "The key's name:\n - `title` — The title of your documentation. This value appears in relevant search queries and browser tabs. By default, the system uses the collection's name for the documentation title.\n - `description` — The documentation's description. This provides brief information about your document and lets users know what it contains. By default, the system uses the collection's description content.\n" - ), - value: z.string().describe("The `name` key's value."), - }) - .describe( - "The key-pair values that contain the documentation's `title` and `description` metadata information." - ) + z.object({ + name: z + .string() + .describe( + "The key's name:\n - `title` — The title of your documentation. This value appears in relevant search queries and browser tabs. By default, the system uses the collection's name for the documentation title.\n - `description` — The documentation's description. This provides brief information about your document and lets users know what it contains. By default, the system uses the collection's description content.\n" + ), + value: z.string().describe("The `name` key's value."), + }) + ) + .describe( + "The key-pair values that contain the documentation's `title` and `description` metadata information." ) .optional(), appearance: z diff --git a/src/tools/put_collection.ts b/src/tools/put_collection.ts index 1ef4a8e..34a882a 100644 --- a/src/tools/put_collection.ts +++ b/src/tools/put_collection.ts @@ -27,4088 +27,138 @@ export const parameters = z.object({ .describe( 'The "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" Postman Collection Format v2.1.0 schema.' ), + updatedAt: z + .string() + .datetime({ offset: true }) + .describe('The date and time when the collection was last updated.') + .optional(), + createdat: z + .string() + .datetime({ offset: true }) + .describe('The date and time when the collection was created.') + .optional(), + lastUpdatedBy: z + .string() + .describe('The user ID of the person who last updated the collection.') + .optional(), + uid: z.string().describe("The collection's unique ID.").optional(), }) .describe('Information about the collection.'), item: z.array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z - .object({ - id: z.string().describe("The collection item's ID.").optional(), - name: z.string().describe("The item's name.").optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z.string().describe("The description's contents.").optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z.string().nullable().describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z.string().describe("The variable's key (name).").optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe( - "A list of the collection's [variables](https://learning.postman.com/docs/sending-requests/variables/variables/). Make certain not to include sensitive information in variables." - ) - .optional(), - event: z - .array( - z - .object({ - id: z.string().describe("The event's ID.").optional(), - listen: z - .enum(['test', 'prerequest']) - .describe( - 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' - ), - script: z - .object({ - id: z.string().describe("The script's ID.").optional(), - type: z - .string() - .describe('The type of script. For example, `text/javascript`.') - .optional(), - exec: z - .array(z.string().nullable()) - .describe( - 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' - ) - .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z.string().describe("The request's raw URL.").optional(), - protocol: z - .string() - .describe('The request protocol.') - .optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe( - "A list of the host's subdomain components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe("A list of the URL's path components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), - }) - .describe( - 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' - ) - .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), - }) - .describe("Information about the collection's events.") - ) - .describe( - 'A list of scripts configured to run when specific events occur. These scripts can be referenced in the collection by their ID.' - ) - .optional(), - request: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - url: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z.string().describe("The request's raw URL.").optional(), - protocol: z.string().describe('The request protocol.').optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe("A list of the host's subdomain components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe("A list of the URL's path components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - auth: z - .object({ - type: z - .enum([ - 'basic', - 'bearer', - 'apikey', - 'digest', - 'oauth1', - 'oauth2', - 'hawk', - 'awsv4', - 'ntlm', - 'edgegrid', - ]) - .describe('The authorization type.'), - apikey: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe("The API key's authentication information.") - .optional(), - awsv4: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [AWS Signature](https://learning.postman.com/docs/sending-requests/authorization/aws-signature/) authentication.' - ) - .optional(), - basic: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Basic Auth](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#basic-auth).' - ) - .optional(), - bearer: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Bearer Token](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#bearer-token) authentication.' - ) - .optional(), - digest: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Digest](https://learning.postman.com/docs/sending-requests/authorization/digest-auth/) access authentication.' - ) - .optional(), - edgegrid: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Akamai Edgegrid](https://learning.postman.com/docs/sending-requests/authorization/akamai-edgegrid/) authentication.' - ) - .optional(), - hawk: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Hawk](https://learning.postman.com/docs/sending-requests/authorization/hawk-authentication/) authentication.' - ) - .optional(), - ntlm: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [NTLM](https://learning.postman.com/docs/sending-requests/authorization/ntlm-authentication/) authentication.' - ) - .optional(), - oauth1: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth1](https://learning.postman.com/docs/sending-requests/authorization/oauth-10/) authentication.' - ) - .optional(), - oauth2: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/) authentication.' - ) - .optional(), - }) - .describe( - 'The [authorization type supported by Postman](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - .optional(), - proxy: z - .object({ - match: z - .string() - .describe('The URL match for the defined proxy configuration.') - .default('http+https://*/*'), - host: z.string().describe("The proxy server's host.").optional(), - port: z - .number() - .int() - .gte(0) - .describe("The proxy server's port.") - .default(8080), - tunnel: z - .boolean() - .describe('The tunneling details for the proxy configuration.') - .default(false), - disabled: z - .boolean() - .describe('If true, ignores the proxy configuration.') - .default(false), - }) - .describe('Information about custom proxy confiurations.') - .optional(), - certificate: z - .object({ - name: z.string().describe("The SSL certificate's name.").optional(), - matches: z - .array(z.string()) - .describe( - 'A list of URL match pattern strings to identify the URLs the certificate can be used for.' - ) - .optional(), - key: z - .object({ - src: z - .string() - .describe( - 'The path to the file that contains the certificate in the file system.' - ) - .optional(), - }) - .describe('Information about the private key.') - .optional(), - cert: z - .object({ - src: z - .string() - .describe( - 'The path to the file that contains the key for the certificate in the file system.' - ) - .optional(), - }) - .describe('Information about the file certificate.') - .optional(), - passphrase: z - .string() - .describe("The certificate's passphrase.") - .optional(), - }) - .optional(), - method: z - .union([ - z - .enum([ - 'GET', - 'PUT', - 'POST', - 'PATCH', - 'DELETE', - 'COPY', - 'HEAD', - 'OPTIONS', - 'LINK', - 'UNLINK', - 'PURGE', - 'LOCK', - 'UNLOCK', - 'PROPFIND', - 'VIEW', - ]) - .describe("The request's standard HTTP method."), - z.string().describe("The request's custom HTTP method."), - ]) - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z.string().nullable().describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - header: z - .array( - z - .object({ - key: z - .string() - .describe( - "The header's key, such as `Content-Type` or `X-Custom-Header`." - ), - value: z.string().describe("The header key's value."), - disabled: z - .boolean() - .describe("If true, the current header isn't sent with requests.") - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - .describe('Information about the header.') - ) - .describe('A list of headers.') - .optional(), - body: z - .object({ - mode: z - .enum(['raw', 'urlencoded', 'formdata', 'file', 'graphql']) - .describe('The data associated with the request.') - .optional(), - raw: z - .string() - .describe( - 'If the `mode` value is `raw`, the raw content of the request body.' - ) - .optional(), - urlencoded: z - .array( - z.object({ - key: z.string().describe('The key value.'), - value: z.string().describe("The key's value.").optional(), - disabled: z.boolean().default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe('A list of x-www-form-encoded key/value pairs.') - .optional(), - formdata: z - .array( - z.record(z.any()).and( - z.union([ - z.object({ - key: z.string().describe('The key value.').optional(), - value: z.string().describe("The key's value.").optional(), - disabled: z - .boolean() - .describe('If true, prevents sending the form-data entry.') - .default(false), - type: z - .literal('text') - .describe('The `text` value.') - .optional(), - contentType: z - .string() - .describe('The form-data Content-Type header.') - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }), - z.object({ - key: z.string().describe('The key value.').optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.array(z.string()), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - disabled: z - .boolean() - .describe('If true, prevents sending the form-data entry.') - .default(false), - type: z - .literal('file') - .describe('The `file` value.') - .optional(), - contentType: z - .string() - .describe('The form-data Content-Type header.') - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }), - ]) - ) - ) - .describe( - 'If the `mode` value is `formdata`, then a list of form-data key/pair values.' - ) - .optional(), - file: z - .object({ - src: z - .string() - .nullable() - .describe( - 'The name of the file to upload (not its path). A null value indicates that no file is selected as a part of the request body.' - ) - .optional(), - content: z.string().optional(), - }) - .describe( - 'If the `mode` value is `file`, an object containing the file request information.' - ) - .optional(), - graphql: z - .object({ - query: z.string().describe('The GraphQL query.').optional(), - variables: z - .string() - .nullable() - .describe('The GraphQL query variables, in JSON format.') - .optional(), - }) - .describe( - 'If the `mode` value is `graphql`, an object containing the GraphQL request information.' - ) - .optional(), - options: z - .record(z.any()) - .describe( - 'Additional configurations and options set for various modes.' - ) - .optional(), - disabled: z - .boolean() - .describe('When set to true, prevents request body from being sent.') - .default(false), - }) - .describe("Information about the collection's request body.") - .optional(), - }), - z.string().nullable(), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the collection request.'), - response: z - .array(z.any().describe("Information about the request's response.")) - .describe("A list of the collection's responses.") - .optional(), - protocolProfileBehavior: z + z + .object({ + id: z.string().describe("The collection item's ID."), + name: z.string().describe("The item's name.").optional(), + description: z.string().nullable().describe("The item's description.").optional(), + variable: z + .array( + z .object({ - strictSSL: z - .boolean() - .describe('If true, enables certificate verification.') + id: z + .string() + .describe("The variable's ID. Doesn't apply to collection-level variables.") .optional(), - followRedirects: z - .boolean() - .describe('If true, follow HTTP 3xx responses as redirects.') - .optional(), - maxRedirects: z - .number() - .describe('The maximum number of redirects to follow.') - .optional(), - disableBodyPruning: z - .boolean() + key: z.string().describe("The variable's key (name).").optional(), + description: z + .string() .describe( - 'If true, disables request body pruning for the GET, COPY, HEAD, PURGE, and UNLOCK methods.' + "The variable's description. Doesn't apply to collection-level variables." ) .optional(), - disableUrlEncoding: z + value: z.string().describe("The key's value.").optional(), + type: z + .enum(['string', 'boolean', 'integer']) + .describe("The variable's type.") + .optional(), + disabled: z .boolean() .describe( - 'If true, disables the percent encoding of auth, path, query, and fragment URL segments.' + 'If true, the variable is not enabled. Applies only to query parameter variables.' ) - .optional(), - disabledSystemHeaders: z + .default(false), + }) + .describe('Information about the variable.') + ) + .describe( + "A list of the collection's [variables](https://learning.postman.com/docs/sending-requests/variables/variables/). Make certain not to include sensitive information in variables." + ) + .optional(), + event: z + .array( + z + .object({ + id: z.string().describe("The event's ID.").optional(), + listen: z + .enum(['test', 'prerequest']) + .describe('The `prerequest` (pre-request) or `test` (post-response) value.'), + script: z .object({ - 'cache-control': z.boolean().optional(), - 'postman-token': z.boolean().optional(), - 'content-type': z.boolean().optional(), - 'content-length': z.boolean().optional(), - 'accept-encoding': z.boolean().optional(), - connection: z.boolean().optional(), - host: z.boolean().optional(), + id: z.string().describe("The script's ID.").optional(), + type: z + .string() + .describe('The type of script. For example, `text/javascript`.') + .optional(), + exec: z + .array(z.string().nullable()) + .describe( + 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' + ) + .optional(), }) - .describe('Disable the system headers which are added implicitly.') - .optional(), - insecureHTTPParser: z - .boolean() - .describe( - 'If true, uses an insecure HTTP parser that accepts invalid HTTP headers.' - ) - .optional(), - followOriginalHttpMethod: z - .boolean() - .describe( - 'If true, redirects with the original HTTP method. Redirects with the GET HTTP method by default.' - ) - .optional(), - followAuthorizationHeader: z - .boolean() .describe( - 'If true, retains the `authorization` header when a redirect happens to a different hostname.' + 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' ) .optional(), - protocolVersion: z - .enum(['http1', 'http2', 'auto']) - .describe( - 'The HTTP protocol version to use. Supports the `http1`, `http2`, and `auto` values.' - ) - .optional(), - removeRefererHeaderOnRedirect: z - .boolean() - .describe('If true, removes the `referer` header when a redirect happens.') - .optional(), - tlsPreferServerCiphers: z - .boolean() - .describe( - "If true, uses the server's cipher suite order instead of the client's during negotiation." - ) - .optional(), - tlsDisabledProtocols: z + }) + .describe("Information about the collection's events.") + ) + .describe( + 'A list of scripts configured to run when specific events occur. These scripts can be referenced in the collection by their ID.' + ) + .optional(), + request: z + .object({ + url: z + .object({ + raw: z.string().describe("The request's raw URL.").optional(), + protocol: z.string().describe('The request protocol.').optional(), + host: z.array(z.string().nullable()).describe("The host's URL.").optional(), + path: z .array(z.string()) - .describe('The SSL and TLS protocol versions to disable during negotiation.') + .describe("A list of the URL's path components.") .optional(), - tlsCipherSelection: z - .array(z.string()) + port: z + .string() .describe( - 'The order of cipher suites that the SSL server profile uses to establish a secure connection.' + "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." ) .optional(), - }) - .describe( - 'The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.' - ) - .optional(), - }) - .describe('Information about the collection request or folder.'), - z - .object({ - name: z.string().describe("The folder's name.").optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z.string().describe("The description's contents.").optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z.string().nullable().describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z.string().describe("The variable's key (name).").optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe( - "A list of the collection's [variables](https://learning.postman.com/docs/sending-requests/variables/variables/). Make certain not to include sensitive information in variables." - ) - .optional(), - item: z - .array( - z.union([ - z - .object({ - id: z.string().describe("The collection item's ID.").optional(), - name: z.string().describe("The item's name.").optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z.string().nullable().describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z.string().describe("The variable's key (name).").optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe( - "A list of the collection's [variables](https://learning.postman.com/docs/sending-requests/variables/variables/). Make certain not to include sensitive information in variables." - ) - .optional(), - event: z - .array( - z - .object({ - id: z.string().describe("The event's ID.").optional(), - listen: z - .enum(['test', 'prerequest']) - .describe( - 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' - ), - script: z - .object({ - id: z.string().describe("The script's ID.").optional(), - type: z - .string() - .describe( - 'The type of script. For example, `text/javascript`.' - ) - .optional(), - exec: z - .array(z.string().nullable()) - .describe( - 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' - ) - .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z - .string() - .describe("The request's raw URL.") - .optional(), - protocol: z - .string() - .describe('The request protocol.') - .optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe( - "A list of the host's subdomain components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z - .string() - .nullable() - .optional(), - value: z - .string() - .nullable() - .optional(), - }), - ]; - const errors = schemas.reduce< - z.ZodError[] - >( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if ( - schemas.length - errors.length !== - 1 - ) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe( - "A list of the URL's path components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe( - "The description's contents." - ) - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe( - "The collection's description." - ), - ]; - const errors = schemas.reduce< - z.ZodError[] - >( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if ( - schemas.length - errors.length !== - 1 - ) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), - }) - .describe( - 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' - ) - .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), - }) - .describe("Information about the collection's events.") - ) - .describe( - 'A list of scripts configured to run when specific events occur. These scripts can be referenced in the collection by their ID.' - ) - .optional(), - request: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - url: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z - .string() - .describe("The request's raw URL.") - .optional(), - protocol: z - .string() - .describe('The request protocol.') - .optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe( - "A list of the host's subdomain components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe( - "A list of the URL's path components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe( - "The collection's description." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - auth: z - .object({ - type: z - .enum([ - 'basic', - 'bearer', - 'apikey', - 'digest', - 'oauth1', - 'oauth2', - 'hawk', - 'awsv4', - 'ntlm', - 'edgegrid', - ]) - .describe('The authorization type.'), - apikey: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe("The API key's authentication information.") - .optional(), - awsv4: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [AWS Signature](https://learning.postman.com/docs/sending-requests/authorization/aws-signature/) authentication.' - ) - .optional(), - basic: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Basic Auth](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#basic-auth).' - ) - .optional(), - bearer: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Bearer Token](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#bearer-token) authentication.' - ) - .optional(), - digest: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Digest](https://learning.postman.com/docs/sending-requests/authorization/digest-auth/) access authentication.' - ) - .optional(), - edgegrid: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Akamai Edgegrid](https://learning.postman.com/docs/sending-requests/authorization/akamai-edgegrid/) authentication.' - ) - .optional(), - hawk: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Hawk](https://learning.postman.com/docs/sending-requests/authorization/hawk-authentication/) authentication.' - ) - .optional(), - ntlm: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [NTLM](https://learning.postman.com/docs/sending-requests/authorization/ntlm-authentication/) authentication.' - ) - .optional(), - oauth1: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth1](https://learning.postman.com/docs/sending-requests/authorization/oauth-10/) authentication.' - ) - .optional(), - oauth2: z - .array( - z - .object({ - key: z - .string() - .describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/) authentication.' - ) - .optional(), - }) - .describe( - 'The [authorization type supported by Postman](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - .optional(), - proxy: z - .object({ - match: z - .string() - .describe( - 'The URL match for the defined proxy configuration.' - ) - .default('http+https://*/*'), - host: z - .string() - .describe("The proxy server's host.") - .optional(), - port: z - .number() - .int() - .gte(0) - .describe("The proxy server's port.") - .default(8080), - tunnel: z - .boolean() - .describe( - 'The tunneling details for the proxy configuration.' - ) - .default(false), - disabled: z - .boolean() - .describe('If true, ignores the proxy configuration.') - .default(false), - }) - .describe('Information about custom proxy confiurations.') - .optional(), - certificate: z - .object({ - name: z - .string() - .describe("The SSL certificate's name.") - .optional(), - matches: z - .array(z.string()) - .describe( - 'A list of URL match pattern strings to identify the URLs the certificate can be used for.' - ) - .optional(), - key: z - .object({ - src: z - .string() - .describe( - 'The path to the file that contains the certificate in the file system.' - ) - .optional(), - }) - .describe('Information about the private key.') - .optional(), - cert: z - .object({ - src: z - .string() - .describe( - 'The path to the file that contains the key for the certificate in the file system.' - ) - .optional(), - }) - .describe('Information about the file certificate.') - .optional(), - passphrase: z - .string() - .describe("The certificate's passphrase.") - .optional(), - }) - .optional(), - method: z - .union([ - z - .enum([ - 'GET', - 'PUT', - 'POST', - 'PATCH', - 'DELETE', - 'COPY', - 'HEAD', - 'OPTIONS', - 'LINK', - 'UNLINK', - 'PURGE', - 'LOCK', - 'UNLOCK', - 'PROPFIND', - 'VIEW', - ]) - .describe("The request's standard HTTP method."), - z.string().describe("The request's custom HTTP method."), - ]) - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - header: z - .array( - z - .object({ - key: z - .string() - .describe( - "The header's key, such as `Content-Type` or `X-Custom-Header`." - ), - value: z.string().describe("The header key's value."), - disabled: z - .boolean() - .describe( - "If true, the current header isn't sent with requests." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - .describe('Information about the header.') - ) - .describe('A list of headers.') - .optional(), - body: z - .object({ - mode: z - .enum(['raw', 'urlencoded', 'formdata', 'file', 'graphql']) - .describe('The data associated with the request.') - .optional(), - raw: z - .string() - .describe( - 'If the `mode` value is `raw`, the raw content of the request body.' - ) - .optional(), - urlencoded: z - .array( - z.object({ - key: z.string().describe('The key value.'), - value: z - .string() - .describe("The key's value.") - .optional(), - disabled: z.boolean().default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe('A list of x-www-form-encoded key/value pairs.') - .optional(), - formdata: z - .array( - z.record(z.any()).and( - z.union([ - z.object({ - key: z - .string() - .describe('The key value.') - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - 'If true, prevents sending the form-data entry.' - ) - .default(false), - type: z - .literal('text') - .describe('The `text` value.') - .optional(), - contentType: z - .string() - .describe('The form-data Content-Type header.') - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }), - z.object({ - key: z - .string() - .describe('The key value.') - .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.array(z.string()), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - disabled: z - .boolean() - .describe( - 'If true, prevents sending the form-data entry.' - ) - .default(false), - type: z - .literal('file') - .describe('The `file` value.') - .optional(), - contentType: z - .string() - .describe('The form-data Content-Type header.') - .optional(), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }), - ]) - ) - ) - .describe( - 'If the `mode` value is `formdata`, then a list of form-data key/pair values.' - ) - .optional(), - file: z - .object({ - src: z - .string() - .nullable() - .describe( - 'The name of the file to upload (not its path). A null value indicates that no file is selected as a part of the request body.' - ) - .optional(), - content: z.string().optional(), - }) - .describe( - 'If the `mode` value is `file`, an object containing the file request information.' - ) - .optional(), - graphql: z - .object({ - query: z - .string() - .describe('The GraphQL query.') - .optional(), - variables: z - .string() - .nullable() - .describe( - 'The GraphQL query variables, in JSON format.' - ) - .optional(), - }) - .describe( - 'If the `mode` value is `graphql`, an object containing the GraphQL request information.' - ) - .optional(), - options: z - .record(z.any()) - .describe( - 'Additional configurations and options set for various modes.' - ) - .optional(), - disabled: z - .boolean() - .describe( - 'When set to true, prevents request body from being sent.' - ) - .default(false), - }) - .describe("Information about the collection's request body.") - .optional(), - }), - z.string().nullable(), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the collection request.'), - response: z - .array(z.any().describe("Information about the request's response.")) - .describe("A list of the collection's responses.") - .optional(), - protocolProfileBehavior: z - .object({ - strictSSL: z - .boolean() - .describe('If true, enables certificate verification.') - .optional(), - followRedirects: z - .boolean() - .describe('If true, follow HTTP 3xx responses as redirects.') - .optional(), - maxRedirects: z - .number() - .describe('The maximum number of redirects to follow.') - .optional(), - disableBodyPruning: z - .boolean() - .describe( - 'If true, disables request body pruning for the GET, COPY, HEAD, PURGE, and UNLOCK methods.' - ) - .optional(), - disableUrlEncoding: z - .boolean() - .describe( - 'If true, disables the percent encoding of auth, path, query, and fragment URL segments.' - ) - .optional(), - disabledSystemHeaders: z - .object({ - 'cache-control': z.boolean().optional(), - 'postman-token': z.boolean().optional(), - 'content-type': z.boolean().optional(), - 'content-length': z.boolean().optional(), - 'accept-encoding': z.boolean().optional(), - connection: z.boolean().optional(), - host: z.boolean().optional(), - }) - .describe('Disable the system headers which are added implicitly.') - .optional(), - insecureHTTPParser: z - .boolean() - .describe( - 'If true, uses an insecure HTTP parser that accepts invalid HTTP headers.' - ) - .optional(), - followOriginalHttpMethod: z - .boolean() - .describe( - 'If true, redirects with the original HTTP method. Redirects with the GET HTTP method by default.' - ) - .optional(), - followAuthorizationHeader: z - .boolean() - .describe( - 'If true, retains the `authorization` header when a redirect happens to a different hostname.' - ) - .optional(), - protocolVersion: z - .enum(['http1', 'http2', 'auto']) - .describe( - 'The HTTP protocol version to use. Supports the `http1`, `http2`, and `auto` values.' - ) - .optional(), - removeRefererHeaderOnRedirect: z - .boolean() - .describe( - 'If true, removes the `referer` header when a redirect happens.' - ) - .optional(), - tlsPreferServerCiphers: z - .boolean() - .describe( - "If true, uses the server's cipher suite order instead of the client's during negotiation." - ) - .optional(), - tlsDisabledProtocols: z - .array(z.string()) - .describe( - 'The SSL and TLS protocol versions to disable during negotiation.' - ) - .optional(), - tlsCipherSelection: z - .array(z.string()) - .describe( - 'The order of cipher suites that the SSL server profile uses to establish a secure connection.' - ) - .optional(), - }) - .describe( - 'The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.' - ) + query: z + .array( + z.object({ + key: z + .string() + .nullable() + .describe("The query parameter's key.") .optional(), - }) - .describe('Information about the collection request or folder.'), - z - .object({ - name: z.string().describe("The folder's name.").optional(), + value: z.string().nullable().describe("The key's value.").optional(), + disabled: z + .boolean() + .describe("If true, the query parameter isn't sent with the request.") + .default(false), description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z.string().nullable().describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z.string().describe("The variable's key (name).").optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe( - "A list of the collection's [variables](https://learning.postman.com/docs/sending-requests/variables/variables/). Make certain not to include sensitive information in variables." - ) - .optional(), - item: z.any(), - event: z - .array( - z - .object({ - id: z.string().describe("The event's ID.").optional(), - listen: z - .enum(['test', 'prerequest']) - .describe( - 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' - ), - script: z - .object({ - id: z.string().describe("The script's ID.").optional(), - type: z - .string() - .describe( - 'The type of script. For example, `text/javascript`.' - ) - .optional(), - exec: z - .array(z.string().nullable()) - .describe( - 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' - ) - .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z - .string() - .describe("The request's raw URL.") - .optional(), - protocol: z - .string() - .describe('The request protocol.') - .optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe( - "A list of the host's subdomain components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z - .string() - .nullable() - .optional(), - value: z - .string() - .nullable() - .optional(), - }), - ]; - const errors = schemas.reduce< - z.ZodError[] - >( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if ( - schemas.length - errors.length !== - 1 - ) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe( - "A list of the URL's path components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe( - "The description's contents." - ) - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe( - "The collection's description." - ), - ]; - const errors = schemas.reduce< - z.ZodError[] - >( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if ( - schemas.length - errors.length !== - 1 - ) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), - }) - .describe( - 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' - ) - .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), - }) - .describe("Information about the collection's events.") - ) - .describe( - 'A list of scripts configured to run when specific events occur. These scripts can be referenced in the collection by their ID.' - ) - .optional(), - auth: z - .object({ - type: z - .enum([ - 'basic', - 'bearer', - 'apikey', - 'digest', - 'oauth1', - 'oauth2', - 'hawk', - 'awsv4', - 'ntlm', - 'edgegrid', - ]) - .describe('The authorization type.'), - apikey: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe("The API key's authentication information.") - .optional(), - awsv4: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [AWS Signature](https://learning.postman.com/docs/sending-requests/authorization/aws-signature/) authentication.' - ) - .optional(), - basic: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Basic Auth](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#basic-auth).' - ) - .optional(), - bearer: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Bearer Token](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#bearer-token) authentication.' - ) - .optional(), - digest: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Digest](https://learning.postman.com/docs/sending-requests/authorization/digest-auth/) access authentication.' - ) - .optional(), - edgegrid: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Akamai Edgegrid](https://learning.postman.com/docs/sending-requests/authorization/akamai-edgegrid/) authentication.' - ) - .optional(), - hawk: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [Hawk](https://learning.postman.com/docs/sending-requests/authorization/hawk-authentication/) authentication.' - ) - .optional(), - ntlm: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [NTLM](https://learning.postman.com/docs/sending-requests/authorization/ntlm-authentication/) authentication.' - ) - .optional(), - oauth1: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth1](https://learning.postman.com/docs/sending-requests/authorization/oauth-10/) authentication.' - ) - .optional(), - oauth2: z - .array( - z - .object({ - key: z.string().describe("The auth method's key value."), - value: z - .union([z.string(), z.array(z.record(z.any()))]) - .describe("The key's value.") - .optional(), - type: z - .enum([ - 'string', - 'boolean', - 'number', - 'array', - 'object', - 'any', - ]) - .describe("The value's type.") - .optional(), - }) - .describe( - 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' - ) - ) - .describe( - 'The attributes for [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/) authentication.' - ) - .optional(), - }) - .describe("Information about the folder's authentication.") - .optional(), - protocolProfileBehavior: z - .object({ - strictSSL: z - .boolean() - .describe('If true, enables certificate verification.') - .optional(), - followRedirects: z - .boolean() - .describe('If true, follow HTTP 3xx responses as redirects.') - .optional(), - maxRedirects: z - .number() - .describe('The maximum number of redirects to follow.') - .optional(), - disableBodyPruning: z - .boolean() - .describe( - 'If true, disables request body pruning for the GET, COPY, HEAD, PURGE, and UNLOCK methods.' - ) - .optional(), - disableUrlEncoding: z - .boolean() - .describe( - 'If true, disables the percent encoding of auth, path, query, and fragment URL segments.' - ) - .optional(), - disabledSystemHeaders: z - .object({ - 'cache-control': z.boolean().optional(), - 'postman-token': z.boolean().optional(), - 'content-type': z.boolean().optional(), - 'content-length': z.boolean().optional(), - 'accept-encoding': z.boolean().optional(), - connection: z.boolean().optional(), - host: z.boolean().optional(), - }) - .describe('Disable the system headers which are added implicitly.') - .optional(), - insecureHTTPParser: z - .boolean() - .describe( - 'If true, uses an insecure HTTP parser that accepts invalid HTTP headers.' - ) - .optional(), - followOriginalHttpMethod: z - .boolean() - .describe( - 'If true, redirects with the original HTTP method. Redirects with the GET HTTP method by default.' - ) - .optional(), - followAuthorizationHeader: z - .boolean() - .describe( - 'If true, retains the `authorization` header when a redirect happens to a different hostname.' - ) - .optional(), - protocolVersion: z - .enum(['http1', 'http2', 'auto']) - .describe( - 'The HTTP protocol version to use. Supports the `http1`, `http2`, and `auto` values.' - ) - .optional(), - removeRefererHeaderOnRedirect: z - .boolean() - .describe( - 'If true, removes the `referer` header when a redirect happens.' - ) - .optional(), - tlsPreferServerCiphers: z - .boolean() - .describe( - "If true, uses the server's cipher suite order instead of the client's during negotiation." - ) - .optional(), - tlsDisabledProtocols: z - .array(z.string()) - .describe( - 'The SSL and TLS protocol versions to disable during negotiation.' - ) - .optional(), - tlsCipherSelection: z - .array(z.string()) - .describe( - 'The order of cipher suites that the SSL server profile uses to establish a secure connection.' - ) - .optional(), - }) - .describe( - 'The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.' - ) + .string() + .nullable() + .describe("The query parameter's description.") .optional(), }) - .describe( - "Information about the collection's folders. A folder is an organized group of requests." - ), - ]) - ) - .describe( - "A list of the folder's contents, such as requests, responses, and additional folders." - ), - event: z - .array( - z - .object({ - id: z.string().describe("The event's ID.").optional(), - listen: z - .enum(['test', 'prerequest']) - .describe( - 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' - ), - script: z - .object({ - id: z.string().describe("The script's ID.").optional(), - type: z - .string() - .describe('The type of script. For example, `text/javascript`.') - .optional(), - exec: z - .array(z.string().nullable()) - .describe( - 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' - ) - .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z.string().describe("The request's raw URL.").optional(), - protocol: z - .string() - .describe('The request protocol.') - .optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe( - "A list of the host's subdomain components." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe("A list of the URL's path components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error - ? [...errors, result.error] - : errors)(schema.safeParse(x)), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: - 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z - .string() - .describe("The key's value.") - .optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z - .string() - .describe("The variable's name.") - .optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), - }) - .describe( - 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' - ) - .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), - }) - .describe("Information about the collection's events.") - ) - .describe( - 'A list of scripts configured to run when specific events occur. These scripts can be referenced in the collection by their ID.' - ) + ) + .describe( + 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' + ) + .optional(), + }) + .describe('Information about the URL.') .optional(), auth: z .object({ @@ -4124,6 +174,8 @@ export const parameters = z.object({ 'awsv4', 'ntlm', 'edgegrid', + 'jwt', + 'asap', ]) .describe('The authorization type.'), apikey: z @@ -4344,117 +396,298 @@ export const parameters = z.object({ 'The attributes for [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/) authentication.' ) .optional(), - }) - .describe("Information about the folder's authentication.") - .optional(), - protocolProfileBehavior: z - .object({ - strictSSL: z - .boolean() - .describe('If true, enables certificate verification.') - .optional(), - followRedirects: z - .boolean() - .describe('If true, follow HTTP 3xx responses as redirects.') - .optional(), - maxRedirects: z - .number() - .describe('The maximum number of redirects to follow.') - .optional(), - disableBodyPruning: z - .boolean() + jwt: z + .array( + z + .object({ + key: z.string().describe("The auth method's key value."), + value: z + .union([z.string(), z.array(z.record(z.any()))]) + .describe("The key's value.") + .optional(), + type: z + .enum(['string', 'boolean', 'number', 'array', 'object', 'any']) + .describe("The value's type.") + .optional(), + }) + .describe( + 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' + ) + ) .describe( - 'If true, disables request body pruning for the GET, COPY, HEAD, PURGE, and UNLOCK methods.' + 'The attributes for JWT (JSON Web Token). Includes the `payload`, `secret`, `algorithm`, `addTokenTo`, and `headerPrefix` properties.' ) .optional(), - disableUrlEncoding: z - .boolean() + asap: z + .array( + z + .object({ + key: z.string().describe("The auth method's key value."), + value: z + .union([z.string(), z.array(z.record(z.any()))]) + .describe("The key's value.") + .optional(), + type: z + .enum(['string', 'boolean', 'number', 'array', 'object', 'any']) + .describe("The value's type.") + .optional(), + }) + .describe( + 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' + ) + ) .describe( - 'If true, disables the percent encoding of auth, path, query, and fragment URL segments.' + 'The attributes for ASAP (Atlassian S2S Authentication Protocol). Includes the `kid`, `aud`, `iss`, `alg`, `privateKey`, and `claims` properties.' ) .optional(), - disabledSystemHeaders: z + }) + .describe( + 'The [authorization type supported by Postman](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' + ) + .optional(), + method: z.string().describe("The request's standard HTTP method.").optional(), + description: z + .string() + .nullable() + .describe("The request's description.") + .optional(), + header: z + .array( + z .object({ - 'cache-control': z.boolean().optional(), - 'postman-token': z.boolean().optional(), - 'content-type': z.boolean().optional(), - 'content-length': z.boolean().optional(), - 'accept-encoding': z.boolean().optional(), - connection: z.boolean().optional(), - host: z.boolean().optional(), + key: z + .string() + .describe( + "The header's key, such as `Content-Type` or `X-Custom-Header`." + ), + value: z.string().describe("The header key's value."), + description: z + .string() + .nullable() + .describe("The header's description.") + .optional(), }) - .describe('Disable the system headers which are added implicitly.') + .describe('Information about the header.') + ) + .describe('A list of headers.') + .optional(), + body: z + .object({ + mode: z + .enum(['raw', 'urlencoded', 'formdata', 'file', 'graphql']) + .describe('The data associated with the request.') .optional(), - insecureHTTPParser: z - .boolean() + raw: z + .string() .describe( - 'If true, uses an insecure HTTP parser that accepts invalid HTTP headers.' + 'If the `mode` value is `raw`, the raw content of the request body.' ) .optional(), - followOriginalHttpMethod: z - .boolean() - .describe( - 'If true, redirects with the original HTTP method. Redirects with the GET HTTP method by default.' + urlencoded: z + .array( + z.object({ + key: z.string().describe('The key value.'), + value: z.string().describe("The key's value.").optional(), + description: z + .string() + .nullable() + .describe("The key's description.") + .optional(), + }) ) + .describe('A list of x-www-form-encoded key/value pairs.') .optional(), - followAuthorizationHeader: z - .boolean() - .describe( - 'If true, retains the `authorization` header when a redirect happens to a different hostname.' + formdata: z + .array( + z.record(z.any()).and( + z.union([ + z.object({ + key: z.string().describe('The key value.').optional(), + value: z.string().describe("The key's value.").optional(), + type: z.literal('text').describe('The `text` value.').optional(), + contentType: z + .string() + .describe('The form-data Content-Type header.') + .optional(), + description: z + .string() + .nullable() + .describe("The key's description.") + .optional(), + }), + z.object({ + key: z.string().describe('The key value.').optional(), + src: z + .any() + .superRefine((x, ctx) => { + const schemas = [z.string().nullable(), z.array(z.string())]; + const errors = schemas.reduce( + (errors, schema) => + ((result) => + result.error ? [...errors, result.error] : errors)( + schema.safeParse(x) + ), + [] + ); + if (schemas.length - errors.length !== 1) { + ctx.addIssue({ + path: ctx.path, + code: 'invalid_union', + unionErrors: errors, + message: 'Invalid input: Should pass single schema', + }); + } + }) + .optional(), + type: z.literal('file').describe('The `file` value.').optional(), + contentType: z + .string() + .describe('The form-data Content-Type header.') + .optional(), + description: z + .string() + .nullable() + .describe("The key's description.") + .optional(), + }), + ]) + ) ) - .optional(), - protocolVersion: z - .enum(['http1', 'http2', 'auto']) .describe( - 'The HTTP protocol version to use. Supports the `http1`, `http2`, and `auto` values.' + 'If the `mode` value is `formdata`, then a list of form-data key/pair values.' ) .optional(), - removeRefererHeaderOnRedirect: z - .boolean() - .describe('If true, removes the `referer` header when a redirect happens.') - .optional(), - tlsPreferServerCiphers: z - .boolean() + file: z + .object({ + src: z + .string() + .nullable() + .describe( + 'The name of the file to upload (not its path). A null value indicates that no file is selected as a part of the request body.' + ) + .optional(), + }) .describe( - "If true, uses the server's cipher suite order instead of the client's during negotiation." + 'If the `mode` value is `file`, an object containing the file request information.' ) .optional(), - tlsDisabledProtocols: z - .array(z.string()) - .describe('The SSL and TLS protocol versions to disable during negotiation.') - .optional(), - tlsCipherSelection: z - .array(z.string()) + graphql: z + .object({ + query: z.string().describe('The GraphQL query.').optional(), + variables: z + .string() + .nullable() + .describe('The GraphQL query variables, in JSON format.') + .optional(), + }) .describe( - 'The order of cipher suites that the SSL server profile uses to establish a secure connection.' + 'If the `mode` value is `graphql`, an object containing the GraphQL request information.' ) .optional(), + options: z + .record(z.any()) + .describe('Additional configurations and options set for various modes.') + .optional(), }) + .describe("Information about the collection's request body.") + .optional(), + }) + .describe('Information about the collection request.') + .optional(), + response: z + .array(z.any().describe("Information about the request's response.")) + .describe("A list of the collection's responses.") + .optional(), + protocolProfileBehavior: z + .object({ + strictSSL: z + .boolean() + .describe('If true, enables certificate verification.') + .optional(), + followRedirects: z + .boolean() + .describe('If true, follow HTTP 3xx responses as redirects.') + .optional(), + maxRedirects: z + .number() + .describe('The maximum number of redirects to follow.') + .optional(), + disableBodyPruning: z + .boolean() + .describe( + 'If true, disables request body pruning for the GET, COPY, HEAD, PURGE, and UNLOCK methods.' + ) + .optional(), + disableUrlEncoding: z + .boolean() + .describe( + 'If true, disables the percent encoding of auth, path, query, and fragment URL segments.' + ) + .optional(), + disabledSystemHeaders: z + .object({ + 'cache-control': z.boolean().optional(), + 'postman-token': z.boolean().optional(), + 'content-type': z.boolean().optional(), + 'content-length': z.boolean().optional(), + 'accept-encoding': z.boolean().optional(), + connection: z.boolean().optional(), + host: z.boolean().optional(), + }) + .describe('Disable the system headers which are added implicitly.') + .optional(), + insecureHTTPParser: z + .boolean() + .describe( + 'If true, uses an insecure HTTP parser that accepts invalid HTTP headers.' + ) + .optional(), + followOriginalHttpMethod: z + .boolean() + .describe( + 'If true, redirects with the original HTTP method. Redirects with the GET HTTP method by default.' + ) + .optional(), + followAuthorizationHeader: z + .boolean() + .describe( + 'If true, retains the `authorization` header when a redirect happens to a different hostname.' + ) + .optional(), + protocolVersion: z + .enum(['http1', 'http2', 'auto']) + .describe( + 'The HTTP protocol version to use. Supports the `http1`, `http2`, and `auto` values.' + ) + .optional(), + removeRefererHeaderOnRedirect: z + .boolean() + .describe('If true, removes the `referer` header when a redirect happens.') + .optional(), + tlsPreferServerCiphers: z + .boolean() .describe( - 'The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.' + "If true, uses the server's cipher suite order instead of the client's during negotiation." + ) + .optional(), + tlsDisabledProtocols: z + .array(z.string()) + .describe('The SSL and TLS protocol versions to disable during negotiation.') + .optional(), + tlsCipherSelection: z + .array(z.string()) + .describe( + 'The order of cipher suites that the SSL server profile uses to establish a secure connection.' ) .optional(), }) .describe( - "Information about the collection's folders. A folder is an organized group of requests." - ), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) + 'The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.' + ) + .optional(), + uid: z.string().describe("The collection item's unique ID.").optional(), + }) + .describe('Information about the collection request or folder.') ), event: z .array( @@ -4463,9 +696,7 @@ export const parameters = z.object({ id: z.string().describe("The event's ID.").optional(), listen: z .enum(['test', 'prerequest']) - .describe( - 'Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.' - ), + .describe('The `prerequest` (pre-request) or `test` (post-response) value.'), script: z .object({ id: z.string().describe("The script's ID.").optional(), @@ -4479,234 +710,11 @@ export const parameters = z.object({ 'A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.' ) .optional(), - src: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z - .object({ - raw: z.string().describe("The request's raw URL.").optional(), - protocol: z.string().describe('The request protocol.').optional(), - host: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string().describe("The host's URL."), - z - .array(z.string().nullable()) - .describe("A list of the host's subdomain components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe("The host's URL.") - .optional(), - path: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.string(), - z - .array( - z.any().superRefine((x, ctx) => { - const schemas = [ - z.string().nullable(), - z.object({ - type: z.string().nullable().optional(), - value: z.string().nullable().optional(), - }), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - ) - .describe("A list of the URL's path components."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .optional(), - port: z - .string() - .describe( - "The URL's port number. An empty value indicates port `80` (http) or `443` (https)." - ) - .optional(), - query: z - .array( - z.object({ - key: z - .string() - .nullable() - .describe("The query parameter's key.") - .optional(), - value: z - .string() - .nullable() - .describe("The key's value.") - .optional(), - disabled: z - .boolean() - .describe( - "If true, the query parameter isn't sent with the request." - ) - .default(false), - description: z - .any() - .superRefine((x, ctx) => { - const schemas = [ - z.object({ - content: z - .string() - .describe("The description's contents.") - .optional(), - type: z - .string() - .describe( - "The raw description content's MIME type, such as `text/markdown` or `text/html`. The type is used to render the description in the Postman app or when generating documentation." - ) - .optional(), - }), - z - .string() - .nullable() - .describe("The collection's description."), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => - result.error ? [...errors, result.error] : errors)( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe( - 'A description can be a raw text or an object containing the description along with its format.' - ) - .optional(), - }) - ) - .describe( - 'A list of query parameters. These are the query string parts of the URL, parsed as separate variables.' - ) - .optional(), - hash: z - .string() - .describe( - 'Contains the URL fragment (if any). Usually this is not transmitted over the network, but it could be useful to store this in some cases.' - ) - .optional(), - variable: z - .array( - z - .object({ - key: z - .string() - .describe("The variable's key (name).") - .optional(), - value: z.string().describe("The key's value.").optional(), - type: z - .enum(['string', 'boolean', 'integer']) - .describe("The variable's type.") - .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() - .describe( - "The variable's description. Doesn't apply to collection-level variables." - ) - .optional(), - disabled: z.boolean().default(false), - }) - .describe('Information about the variable.') - ) - .describe('A list of variables.') - .optional(), - }) - .describe('Information about the URL.'), - z.string().describe('The literal request URL.'), - ]; - const errors = schemas.reduce( - (errors, schema) => - ((result) => (result.error ? [...errors, result.error] : errors))( - schema.safeParse(x) - ), - [] - ); - if (schemas.length - errors.length !== 1) { - ctx.addIssue({ - path: ctx.path, - code: 'invalid_union', - unionErrors: errors, - message: 'Invalid input: Should pass single schema', - }); - } - }) - .describe('Information about the URL.') - .optional(), - name: z.string().describe("The script's name.").optional(), }) .describe( 'Information about the Javascript code that can be used to to perform setup or teardown operations in a response.' ) .optional(), - disabled: z - .boolean() - .describe( - 'If true, the event is disabled. If this value is absent, then the event is considered enabled.' - ) - .default(false), }) .describe("Information about the collection's events.") ) @@ -4718,20 +726,28 @@ export const parameters = z.object({ .array( z .object({ + id: z + .string() + .describe("The variable's ID. Doesn't apply to collection-level variables.") + .optional(), key: z.string().describe("The variable's key (name).").optional(), + description: z + .string() + .describe( + "The variable's description. Doesn't apply to collection-level variables." + ) + .optional(), value: z.string().describe("The key's value.").optional(), type: z .enum(['string', 'boolean', 'integer']) .describe("The variable's type.") .optional(), - name: z.string().describe("The variable's name.").optional(), - description: z - .string() + disabled: z + .boolean() .describe( - "The variable's description. Doesn't apply to collection-level variables." + 'If true, the variable is not enabled. Applies only to query parameter variables.' ) - .optional(), - disabled: z.boolean().default(false), + .default(false), }) .describe('Information about the variable.') ) @@ -4753,6 +769,8 @@ export const parameters = z.object({ 'awsv4', 'ntlm', 'edgegrid', + 'jwt', + 'asap', ]) .describe('The authorization type.'), apikey: z @@ -4973,6 +991,50 @@ export const parameters = z.object({ 'The attributes for [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/) authentication.' ) .optional(), + jwt: z + .array( + z + .object({ + key: z.string().describe("The auth method's key value."), + value: z + .union([z.string(), z.array(z.record(z.any()))]) + .describe("The key's value.") + .optional(), + type: z + .enum(['string', 'boolean', 'number', 'array', 'object', 'any']) + .describe("The value's type.") + .optional(), + }) + .describe( + 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' + ) + ) + .describe( + 'The attributes for JWT (JSON Web Token). Includes the `payload`, `secret`, `algorithm`, `addTokenTo`, and `headerPrefix` properties.' + ) + .optional(), + asap: z + .array( + z + .object({ + key: z.string().describe("The auth method's key value."), + value: z + .union([z.string(), z.array(z.record(z.any()))]) + .describe("The key's value.") + .optional(), + type: z + .enum(['string', 'boolean', 'number', 'array', 'object', 'any']) + .describe("The value's type.") + .optional(), + }) + .describe( + 'Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' + ) + ) + .describe( + 'The attributes for ASAP (Atlassian S2S Authentication Protocol). Includes the `kid`, `aud`, `iss`, `alg`, `privateKey`, and `claims` properties.' + ) + .optional(), }) .describe( 'The [authorization type supported by Postman](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).' diff --git a/src/tools/put_environment.ts b/src/tools/put_environment.ts index f99dd58..1eeffa9 100644 --- a/src/tools/put_environment.ts +++ b/src/tools/put_environment.ts @@ -15,7 +15,7 @@ export const parameters = z.object({ enabled: z.boolean().describe('If true, the variable is enabled.').optional(), key: z.string().describe("The variable's name.").optional(), value: z.string().describe("The variable's value.").optional(), - type: z.enum(['secret', 'default', 'any']).describe('The variable type.').optional(), + type: z.enum(['secret', 'default']).describe('The variable type.').optional(), }) ) .describe("Information about the environment's variables.") diff --git a/src/tools/transfer_collection_folders.ts b/src/tools/transfer_collection_folders.ts index 0c9ef45..357e834 100644 --- a/src/tools/transfer_collection_folders.ts +++ b/src/tools/transfer_collection_folders.ts @@ -14,7 +14,7 @@ export const parameters = z.object({ model: z .enum(['collection', 'folder', 'request']) .describe( - 'The collection, folder, or request the items will be transferred to. For response transfers, use the `request` value.' + 'The collection, folder, or request that the items will be transferred to. For response transfers, use the `request` value.' ), }) .describe("Information about the item transfer's destination location."), diff --git a/src/tools/transfer_collection_requests.ts b/src/tools/transfer_collection_requests.ts index af0db26..2dc4b76 100644 --- a/src/tools/transfer_collection_requests.ts +++ b/src/tools/transfer_collection_requests.ts @@ -14,7 +14,7 @@ export const parameters = z.object({ model: z .enum(['collection', 'folder', 'request']) .describe( - 'The collection, folder, or request the items will be transferred to. For response transfers, use the `request` value.' + 'The collection, folder, or request that the items will be transferred to. For response transfers, use the `request` value.' ), }) .describe("Information about the item transfer's destination location."), diff --git a/src/tools/transfer_collection_responses.ts b/src/tools/transfer_collection_responses.ts index 09b6aa0..e6c0bd6 100644 --- a/src/tools/transfer_collection_responses.ts +++ b/src/tools/transfer_collection_responses.ts @@ -14,7 +14,7 @@ export const parameters = z.object({ model: z .enum(['collection', 'folder', 'request']) .describe( - 'The collection, folder, or request the items will be transferred to. For response transfers, use the `request` value.' + 'The collection, folder, or request that the items will be transferred to. For response transfers, use the `request` value.' ), }) .describe("Information about the item transfer's destination location."), diff --git a/src/tools/update_api_collection_comment.ts b/src/tools/update_api_collection_comment.ts index a3dfcdf..997d7af 100644 --- a/src/tools/update_api_collection_comment.ts +++ b/src/tools/update_api_collection_comment.ts @@ -11,10 +11,10 @@ export const parameters = z.object({ body: z.string().describe('The contents of the comment.'), tags: z .object({ - userName: z + '{{userName}}': z .object({ type: z.literal('user').describe('The `user` value.'), - id: z.number().int().describe("The user's ID."), + id: z.string().describe("The user's ID."), }) .describe( "An object that contains information about the tagged user. The object's name is the user's Postman username. For example, `@user-postman`." diff --git a/src/tools/update_collection_comment.ts b/src/tools/update_collection_comment.ts index 6995234..85ab1df 100644 --- a/src/tools/update_collection_comment.ts +++ b/src/tools/update_collection_comment.ts @@ -10,10 +10,10 @@ export const parameters = z.object({ body: z.string().describe('The contents of the comment.'), tags: z .object({ - userName: z + '{{userName}}': z .object({ type: z.literal('user').describe('The `user` value.'), - id: z.number().int().describe("The user's ID."), + id: z.string().describe("The user's ID."), }) .describe( "An object that contains information about the tagged user. The object's name is the user's Postman username. For example, `@user-postman`." diff --git a/src/tools/update_folder_comment.ts b/src/tools/update_folder_comment.ts index df08cd9..0dfbd65 100644 --- a/src/tools/update_folder_comment.ts +++ b/src/tools/update_folder_comment.ts @@ -11,10 +11,10 @@ export const parameters = z.object({ body: z.string().describe('The contents of the comment.'), tags: z .object({ - userName: z + '{{userName}}': z .object({ type: z.literal('user').describe('The `user` value.'), - id: z.number().int().describe("The user's ID."), + id: z.string().describe("The user's ID."), }) .describe( "An object that contains information about the tagged user. The object's name is the user's Postman username. For example, `@user-postman`." diff --git a/src/tools/update_request_comment.ts b/src/tools/update_request_comment.ts index 88722d6..0096da8 100644 --- a/src/tools/update_request_comment.ts +++ b/src/tools/update_request_comment.ts @@ -11,10 +11,10 @@ export const parameters = z.object({ body: z.string().describe('The contents of the comment.'), tags: z .object({ - userName: z + '{{userName}}': z .object({ type: z.literal('user').describe('The `user` value.'), - id: z.number().int().describe("The user's ID."), + id: z.string().describe("The user's ID."), }) .describe( "An object that contains information about the tagged user. The object's name is the user's Postman username. For example, `@user-postman`." diff --git a/src/tools/update_response_comment.ts b/src/tools/update_response_comment.ts index 75caa4b..c196314 100644 --- a/src/tools/update_response_comment.ts +++ b/src/tools/update_response_comment.ts @@ -11,10 +11,10 @@ export const parameters = z.object({ body: z.string().describe('The contents of the comment.'), tags: z .object({ - userName: z + '{{userName}}': z .object({ type: z.literal('user').describe('The `user` value.'), - id: z.number().int().describe("The user's ID."), + id: z.string().describe("The user's ID."), }) .describe( "An object that contains information about the tagged user. The object's name is the user's Postman username. For example, `@user-postman`."