@scalar/mock-server 0.5.12 → 0.5.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @scalar/mock-server
2
2
 
3
+ ## 0.5.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [58287f8]
8
+ - Updated dependencies [74fdc0e]
9
+ - @scalar/oas-utils@0.4.11
10
+ - @scalar/openapi-parser@0.18.1
11
+
12
+ ## 0.5.13
13
+
14
+ ### Patch Changes
15
+
16
+ - 2d7f995: refactor: use more common straight apostrophe ' instead of the real apostrophe ’
17
+ - Updated dependencies [2d7f995]
18
+ - @scalar/openapi-parser@0.18.1
19
+ - @scalar/openapi-types@0.3.5
20
+ - @scalar/oas-utils@0.4.10
21
+
3
22
  ## 0.5.12
4
23
 
5
24
  ### Patch Changes
package/README.md CHANGED
@@ -185,7 +185,7 @@ The given OpenAPI document is automatically exposed:
185
185
 
186
186
  ## Community
187
187
 
188
- We are API nerds. You too? Lets chat on Discord: <https://discord.gg/scalar>
188
+ We are API nerds. You too? Let's chat on Discord: <https://discord.gg/scalar>
189
189
 
190
190
  ## License
191
191
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/routes/mockAnyResponse.ts"],
4
- "sourcesContent": ["import { getExampleFromSchema } from '@scalar/oas-utils/spec-getters'\nimport type { OpenAPI } from '@scalar/openapi-types'\nimport type { Context } from 'hono'\nimport { accepts } from 'hono/accepts'\nimport type { StatusCode } from 'hono/utils/http-status'\n// @ts-expect-error Doesn\u2019t come with types\nimport objectToXML from 'object-to-xml'\n\nimport type { MockServerOptions } from '@/types'\nimport { findPreferredResponseKey } from '@/utils/findPreferredResponseKey'\n\n/**\n * Mock any response\n */\nexport function mockAnyResponse(c: Context, operation: OpenAPI.Operation, options: MockServerOptions) {\n // Call onRequest callback\n if (options?.onRequest) {\n options.onRequest({\n context: c,\n operation,\n })\n }\n\n // Response\n // default, 200, 201 \u2026\n const preferredResponseKey = findPreferredResponseKey(Object.keys(operation.responses ?? {}))\n const preferredResponse = preferredResponseKey ? operation.responses?.[preferredResponseKey] : null\n\n if (!preferredResponse) {\n c.status(500)\n\n return c.json({ error: 'No response defined for this operation.' })\n }\n\n const supportedContentTypes = Object.keys(preferredResponse?.content ?? {})\n\n // Headers\n const headers = preferredResponse?.headers ?? {}\n Object.keys(headers).forEach((header) => {\n const value = headers[header].schema ? getExampleFromSchema(headers[header].schema) : null\n if (value !== null) {\n c.header(header, value)\n }\n })\n\n // Content-Type\n const acceptedContentType = accepts(c, {\n header: 'Accept',\n supports: supportedContentTypes,\n default: supportedContentTypes.includes('application/json')\n ? 'application/json'\n : (supportedContentTypes[0] ?? 'text/plain;charset=UTF-8'),\n })\n\n c.header('Content-Type', acceptedContentType)\n\n const acceptedResponse = preferredResponse?.content?.[acceptedContentType]\n\n // Body\n const body = acceptedResponse?.example\n ? acceptedResponse.example\n : acceptedResponse?.schema\n ? getExampleFromSchema(acceptedResponse.schema, {\n emptyString: 'string',\n variables: c.req.param(),\n mode: 'read',\n })\n : null\n\n // Status code\n const statusCode = Number.parseInt(\n preferredResponseKey === 'default' ? '200' : (preferredResponseKey ?? '200'),\n 10,\n ) as StatusCode\n\n c.status(statusCode)\n\n return c.body(\n typeof body === 'object'\n ? // XML\n acceptedContentType?.includes('xml')\n ? `<?xml version=\"1.0\" encoding=\"UTF-8\"?>${objectToXML(body)}`\n : // JSON\n JSON.stringify(body, null, 2)\n : // String\n body,\n )\n}\n"],
4
+ "sourcesContent": ["import { getExampleFromSchema } from '@scalar/oas-utils/spec-getters'\nimport type { OpenAPI } from '@scalar/openapi-types'\nimport type { Context } from 'hono'\nimport { accepts } from 'hono/accepts'\nimport type { StatusCode } from 'hono/utils/http-status'\n// @ts-expect-error Doesn't come with types\nimport objectToXML from 'object-to-xml'\n\nimport type { MockServerOptions } from '@/types'\nimport { findPreferredResponseKey } from '@/utils/findPreferredResponseKey'\n\n/**\n * Mock any response\n */\nexport function mockAnyResponse(c: Context, operation: OpenAPI.Operation, options: MockServerOptions) {\n // Call onRequest callback\n if (options?.onRequest) {\n options.onRequest({\n context: c,\n operation,\n })\n }\n\n // Response\n // default, 200, 201 \u2026\n const preferredResponseKey = findPreferredResponseKey(Object.keys(operation.responses ?? {}))\n const preferredResponse = preferredResponseKey ? operation.responses?.[preferredResponseKey] : null\n\n if (!preferredResponse) {\n c.status(500)\n\n return c.json({ error: 'No response defined for this operation.' })\n }\n\n const supportedContentTypes = Object.keys(preferredResponse?.content ?? {})\n\n // Headers\n const headers = preferredResponse?.headers ?? {}\n Object.keys(headers).forEach((header) => {\n const value = headers[header].schema ? getExampleFromSchema(headers[header].schema) : null\n if (value !== null) {\n c.header(header, value)\n }\n })\n\n // Content-Type\n const acceptedContentType = accepts(c, {\n header: 'Accept',\n supports: supportedContentTypes,\n default: supportedContentTypes.includes('application/json')\n ? 'application/json'\n : (supportedContentTypes[0] ?? 'text/plain;charset=UTF-8'),\n })\n\n c.header('Content-Type', acceptedContentType)\n\n const acceptedResponse = preferredResponse?.content?.[acceptedContentType]\n\n // Body\n const body = acceptedResponse?.example\n ? acceptedResponse.example\n : acceptedResponse?.schema\n ? getExampleFromSchema(acceptedResponse.schema, {\n emptyString: 'string',\n variables: c.req.param(),\n mode: 'read',\n })\n : null\n\n // Status code\n const statusCode = Number.parseInt(\n preferredResponseKey === 'default' ? '200' : (preferredResponseKey ?? '200'),\n 10,\n ) as StatusCode\n\n c.status(statusCode)\n\n return c.body(\n typeof body === 'object'\n ? // XML\n acceptedContentType?.includes('xml')\n ? `<?xml version=\"1.0\" encoding=\"UTF-8\"?>${objectToXML(body)}`\n : // JSON\n JSON.stringify(body, null, 2)\n : // String\n body,\n )\n}\n"],
5
5
  "mappings": "AAAA,SAAS,4BAA4B;AAGrC,SAAS,eAAe;AAGxB,OAAO,iBAAiB;AAGxB,SAAS,gCAAgC;AAKlC,SAAS,gBAAgB,GAAY,WAA8B,SAA4B;AAEpG,MAAI,SAAS,WAAW;AACtB,YAAQ,UAAU;AAAA,MAChB,SAAS;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AAIA,QAAM,uBAAuB,yBAAyB,OAAO,KAAK,UAAU,aAAa,CAAC,CAAC,CAAC;AAC5F,QAAM,oBAAoB,uBAAuB,UAAU,YAAY,oBAAoB,IAAI;AAE/F,MAAI,CAAC,mBAAmB;AACtB,MAAE,OAAO,GAAG;AAEZ,WAAO,EAAE,KAAK,EAAE,OAAO,0CAA0C,CAAC;AAAA,EACpE;AAEA,QAAM,wBAAwB,OAAO,KAAK,mBAAmB,WAAW,CAAC,CAAC;AAG1E,QAAM,UAAU,mBAAmB,WAAW,CAAC;AAC/C,SAAO,KAAK,OAAO,EAAE,QAAQ,CAAC,WAAW;AACvC,UAAM,QAAQ,QAAQ,MAAM,EAAE,SAAS,qBAAqB,QAAQ,MAAM,EAAE,MAAM,IAAI;AACtF,QAAI,UAAU,MAAM;AAClB,QAAE,OAAO,QAAQ,KAAK;AAAA,IACxB;AAAA,EACF,CAAC;AAGD,QAAM,sBAAsB,QAAQ,GAAG;AAAA,IACrC,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS,sBAAsB,SAAS,kBAAkB,IACtD,qBACC,sBAAsB,CAAC,KAAK;AAAA,EACnC,CAAC;AAED,IAAE,OAAO,gBAAgB,mBAAmB;AAE5C,QAAM,mBAAmB,mBAAmB,UAAU,mBAAmB;AAGzE,QAAM,OAAO,kBAAkB,UAC3B,iBAAiB,UACjB,kBAAkB,SAChB,qBAAqB,iBAAiB,QAAQ;AAAA,IAC5C,aAAa;AAAA,IACb,WAAW,EAAE,IAAI,MAAM;AAAA,IACvB,MAAM;AAAA,EACR,CAAC,IACD;AAGN,QAAM,aAAa,OAAO;AAAA,IACxB,yBAAyB,YAAY,QAAS,wBAAwB;AAAA,IACtE;AAAA,EACF;AAEA,IAAE,OAAO,UAAU;AAEnB,SAAO,EAAE;AAAA,IACP,OAAO,SAAS;AAAA;AAAA,MAEZ,qBAAqB,SAAS,KAAK,IACjC,yCAAyC,YAAY,IAAI,CAAC;AAAA;AAAA,QAE1D,KAAK,UAAU,MAAM,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA,MAE9B;AAAA;AAAA,EACN;AACF;",
6
6
  "names": []
7
7
  }
@@ -65,7 +65,7 @@ function generateAuthorizationHtml(redirectUrl, deniedUrl, title = "") {
65
65
  This application is requesting access to your account. By granting authorization, you allow the application to perform certain actions on your behalf.
66
66
  </p>
67
67
  <p>
68
- If you\u2019re comfortable with the access being requested, click the button below to grant authorization:
68
+ If you're comfortable with the access being requested, click the button below to grant authorization:
69
69
  </p>
70
70
  </div>
71
71
  <div class="px-6 py-4 pt-0 flex justify-between">
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/routes/respondWithAuthorizePage.ts"],
4
- "sourcesContent": ["import type { Context } from 'hono'\n\n/** Always responds with this code */\nconst EXAMPLE_AUTHORIZATION_CODE = 'super-secret-token'\n\n/**\n * Responds with an HTML page that simulates an OAuth 2.0 authorization page.\n */\nexport function respondWithAuthorizePage(c: Context, title = '') {\n const redirectUri = c.req.query('redirect_uri')\n const state = c.req.query('state')\n\n if (!redirectUri) {\n return c.html(\n generateErrorHtml(\n 'Missing redirect_uri parameter',\n 'This parameter is required for the OAuth 2.0 authorization flow to function correctly. Please provide a valid redirect URI in your request.',\n ),\n 400,\n )\n }\n\n try {\n // Validate redirect URI against allowed domains\n const redirectUrl = new URL(redirectUri)\n\n redirectUrl.searchParams.set('code', EXAMPLE_AUTHORIZATION_CODE)\n\n if (state) {\n redirectUrl.searchParams.set('state', state)\n }\n\n const deniedUrl = new URL(redirectUri)\n if (state) {\n deniedUrl.searchParams.set('state', state)\n }\n deniedUrl.searchParams.set('error', 'access_denied')\n deniedUrl.searchParams.set('error_description', 'User has denied the authorization request')\n\n const htmlContent = generateAuthorizationHtml(redirectUrl.toString(), deniedUrl.toString(), title)\n\n return c.html(htmlContent)\n } catch {\n return c.html(\n generateErrorHtml(\n 'Invalid redirect_uri format',\n 'Please provide a valid URL. The redirect_uri parameter must be a properly formatted URL that includes the protocol (e.g., https://) and a valid domain. This is essential for the OAuth 2.0 flow to securely redirect after authorization.',\n ),\n 400,\n )\n }\n}\n\nfunction generateAuthorizationHtml(redirectUrl: string, deniedUrl: string, title = '') {\n return `\n<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>OAuth 2.0 Authorization</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n </head>\n <body class=\"flex justify-center items-center h-screen bg-gray-100\">\n\n <div class=\"flex flex-col\">\n <div class=\"mb-5 flex justify-center items-center gap-2\">\n <img src=\"https://scalar.com/logo-dark.svg\" class=\"w-6 inline-block\" />\n <div class=\"font-medium truncate max-w-[26ch] text-lg\">\n ${title}\n </div>\n </div>\n <div class=\"bg-gray-50 rounded-lg p-1 rounded-lg w-[28rem] shadow\">\n <div class=\"\">\n <h1 class=\"text font-medium text-gray-800 px-6 pt-2 pb-3 flex gap-3 rounded-t-lg\">\n OAuth 2.0 Authorization\n </h1>\n <div class=\"bg-white rounded\">\n <div class=\"text-gray-600 text-base px-6 py-5 flex flex-col gap-3\">\n <p>\n This application is requesting access to your account. By granting authorization, you allow the application to perform certain actions on your behalf.\n </p>\n <p>\n If you\u2019re comfortable with the access being requested, click the button below to grant authorization:\n </p>\n </div>\n <div class=\"px-6 py-4 pt-0 flex justify-between\">\n <a href=\"${deniedUrl}\" class=\"inline-block px-6 py-2 text-gray-600 rounded border\" aria-label=\"Cancel authorization\">\n Cancel\n </a>\n <a href=\"${redirectUrl}\" class=\"inline-block px-6 py-2 bg-black text-white rounded transition-colors duration-300 hover:bg-gray-800\" aria-label=\"Authorize application\">\n Authorize\n </a>\n </div>\n </div>\n </div>\n </div>\n\n <p class=\"text-xs text-gray-400 mt-5 text-center\">\n This authorization page is provided by @scalar/mock-server\n </p>\n\n </div>\n </body>\n</html>\n `\n}\n\nfunction generateErrorHtml(title: string, message: string) {\n return `<html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>OAuth 2.0 Authorization</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n </head>\n <body>\n <div class=\"p-4 m-8 flex flex-col gap-4 text-lg\">\n <h1 class=\"font-bold\">\n Error: ${title}\n </h1>\n <p>\n ${message}\n </p>\n <p>\n Example: <code class=\"bg-gray-100 py-1 px-2 rounded text-base\"><a href=\"?redirect_uri=https://example.com/callback\">?redirect_uri=https://example.com/callback</a></code>\n </p>\n </div>\n </body>\n</html>`\n}\n"],
4
+ "sourcesContent": ["import type { Context } from 'hono'\n\n/** Always responds with this code */\nconst EXAMPLE_AUTHORIZATION_CODE = 'super-secret-token'\n\n/**\n * Responds with an HTML page that simulates an OAuth 2.0 authorization page.\n */\nexport function respondWithAuthorizePage(c: Context, title = '') {\n const redirectUri = c.req.query('redirect_uri')\n const state = c.req.query('state')\n\n if (!redirectUri) {\n return c.html(\n generateErrorHtml(\n 'Missing redirect_uri parameter',\n 'This parameter is required for the OAuth 2.0 authorization flow to function correctly. Please provide a valid redirect URI in your request.',\n ),\n 400,\n )\n }\n\n try {\n // Validate redirect URI against allowed domains\n const redirectUrl = new URL(redirectUri)\n\n redirectUrl.searchParams.set('code', EXAMPLE_AUTHORIZATION_CODE)\n\n if (state) {\n redirectUrl.searchParams.set('state', state)\n }\n\n const deniedUrl = new URL(redirectUri)\n if (state) {\n deniedUrl.searchParams.set('state', state)\n }\n deniedUrl.searchParams.set('error', 'access_denied')\n deniedUrl.searchParams.set('error_description', 'User has denied the authorization request')\n\n const htmlContent = generateAuthorizationHtml(redirectUrl.toString(), deniedUrl.toString(), title)\n\n return c.html(htmlContent)\n } catch {\n return c.html(\n generateErrorHtml(\n 'Invalid redirect_uri format',\n 'Please provide a valid URL. The redirect_uri parameter must be a properly formatted URL that includes the protocol (e.g., https://) and a valid domain. This is essential for the OAuth 2.0 flow to securely redirect after authorization.',\n ),\n 400,\n )\n }\n}\n\nfunction generateAuthorizationHtml(redirectUrl: string, deniedUrl: string, title = '') {\n return `\n<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>OAuth 2.0 Authorization</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n </head>\n <body class=\"flex justify-center items-center h-screen bg-gray-100\">\n\n <div class=\"flex flex-col\">\n <div class=\"mb-5 flex justify-center items-center gap-2\">\n <img src=\"https://scalar.com/logo-dark.svg\" class=\"w-6 inline-block\" />\n <div class=\"font-medium truncate max-w-[26ch] text-lg\">\n ${title}\n </div>\n </div>\n <div class=\"bg-gray-50 rounded-lg p-1 rounded-lg w-[28rem] shadow\">\n <div class=\"\">\n <h1 class=\"text font-medium text-gray-800 px-6 pt-2 pb-3 flex gap-3 rounded-t-lg\">\n OAuth 2.0 Authorization\n </h1>\n <div class=\"bg-white rounded\">\n <div class=\"text-gray-600 text-base px-6 py-5 flex flex-col gap-3\">\n <p>\n This application is requesting access to your account. By granting authorization, you allow the application to perform certain actions on your behalf.\n </p>\n <p>\n If you're comfortable with the access being requested, click the button below to grant authorization:\n </p>\n </div>\n <div class=\"px-6 py-4 pt-0 flex justify-between\">\n <a href=\"${deniedUrl}\" class=\"inline-block px-6 py-2 text-gray-600 rounded border\" aria-label=\"Cancel authorization\">\n Cancel\n </a>\n <a href=\"${redirectUrl}\" class=\"inline-block px-6 py-2 bg-black text-white rounded transition-colors duration-300 hover:bg-gray-800\" aria-label=\"Authorize application\">\n Authorize\n </a>\n </div>\n </div>\n </div>\n </div>\n\n <p class=\"text-xs text-gray-400 mt-5 text-center\">\n This authorization page is provided by @scalar/mock-server\n </p>\n\n </div>\n </body>\n</html>\n `\n}\n\nfunction generateErrorHtml(title: string, message: string) {\n return `<html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>OAuth 2.0 Authorization</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n </head>\n <body>\n <div class=\"p-4 m-8 flex flex-col gap-4 text-lg\">\n <h1 class=\"font-bold\">\n Error: ${title}\n </h1>\n <p>\n ${message}\n </p>\n <p>\n Example: <code class=\"bg-gray-100 py-1 px-2 rounded text-base\"><a href=\"?redirect_uri=https://example.com/callback\">?redirect_uri=https://example.com/callback</a></code>\n </p>\n </div>\n </body>\n</html>`\n}\n"],
5
5
  "mappings": "AAGA,MAAM,6BAA6B;AAK5B,SAAS,yBAAyB,GAAY,QAAQ,IAAI;AAC/D,QAAM,cAAc,EAAE,IAAI,MAAM,cAAc;AAC9C,QAAM,QAAQ,EAAE,IAAI,MAAM,OAAO;AAEjC,MAAI,CAAC,aAAa;AAChB,WAAO,EAAE;AAAA,MACP;AAAA,QACE;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI;AAEF,UAAM,cAAc,IAAI,IAAI,WAAW;AAEvC,gBAAY,aAAa,IAAI,QAAQ,0BAA0B;AAE/D,QAAI,OAAO;AACT,kBAAY,aAAa,IAAI,SAAS,KAAK;AAAA,IAC7C;AAEA,UAAM,YAAY,IAAI,IAAI,WAAW;AACrC,QAAI,OAAO;AACT,gBAAU,aAAa,IAAI,SAAS,KAAK;AAAA,IAC3C;AACA,cAAU,aAAa,IAAI,SAAS,eAAe;AACnD,cAAU,aAAa,IAAI,qBAAqB,2CAA2C;AAE3F,UAAM,cAAc,0BAA0B,YAAY,SAAS,GAAG,UAAU,SAAS,GAAG,KAAK;AAEjG,WAAO,EAAE,KAAK,WAAW;AAAA,EAC3B,QAAQ;AACN,WAAO,EAAE;AAAA,MACP;AAAA,QACE;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,0BAA0B,aAAqB,WAAmB,QAAQ,IAAI;AACrF,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAeG,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAkBQ,SAAS;AAAA;AAAA;AAAA,yBAGT,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBpC;AAEA,SAAS,kBAAkB,OAAe,SAAiB;AACzD,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAWQ,KAAK;AAAA;AAAA;AAAA,UAGZ,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQjB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/isAuthenticationRequired.ts"],
4
- "sourcesContent": ["import type { OpenAPIV3 } from '@scalar/openapi-types'\n\n/**\n * Check whether the given security scheme key is in the `security` configuration for this operation.\n */\nexport function isAuthenticationRequired(security?: OpenAPIV3.SecurityRequirementObject[]): boolean {\n // If security is not defined, auth is not required.\n if (!security) {\n return false\n }\n\n // Don\u2019t require auth if security is just an empty array []\n if (Array.isArray(security) && !security.length) {\n return false\n }\n\n // Includes empty object = auth is not required\n if ((security ?? []).some((securityRequirement) => !Object.keys(securityRequirement).length)) {\n return false\n }\n\n return true\n}\n"],
4
+ "sourcesContent": ["import type { OpenAPIV3 } from '@scalar/openapi-types'\n\n/**\n * Check whether the given security scheme key is in the `security` configuration for this operation.\n */\nexport function isAuthenticationRequired(security?: OpenAPIV3.SecurityRequirementObject[]): boolean {\n // If security is not defined, auth is not required.\n if (!security) {\n return false\n }\n\n // Don't require auth if security is just an empty array []\n if (Array.isArray(security) && !security.length) {\n return false\n }\n\n // Includes empty object = auth is not required\n if ((security ?? []).some((securityRequirement) => !Object.keys(securityRequirement).length)) {\n return false\n }\n\n return true\n}\n"],
5
5
  "mappings": "AAKO,SAAS,yBAAyB,UAA2D;AAElG,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,QAAQ,KAAK,CAAC,SAAS,QAAQ;AAC/C,WAAO;AAAA,EACT;AAGA,OAAK,YAAY,CAAC,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,mBAAmB,EAAE,MAAM,GAAG;AAC5F,WAAO;AAAA,EACT;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "swagger",
17
17
  "cli"
18
18
  ],
19
- "version": "0.5.12",
19
+ "version": "0.5.14",
20
20
  "engines": {
21
21
  "node": ">=20"
22
22
  },
@@ -38,16 +38,16 @@
38
38
  "dependencies": {
39
39
  "hono": "^4.6.5",
40
40
  "object-to-xml": "^2.0.0",
41
- "@scalar/oas-utils": "0.4.9",
42
- "@scalar/openapi-parser": "0.18.0",
43
- "@scalar/openapi-types": "0.3.4"
41
+ "@scalar/oas-utils": "0.4.11",
42
+ "@scalar/openapi-types": "0.3.5",
43
+ "@scalar/openapi-parser": "0.18.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@hono/node-server": "^1.11.0",
47
47
  "@types/node": "^22.9.0",
48
48
  "vite": "5.4.19",
49
- "@scalar/hono-api-reference": "0.9.7",
50
- "@scalar/build-tooling": "0.2.3"
49
+ "@scalar/hono-api-reference": "0.9.9",
50
+ "@scalar/build-tooling": "0.2.4"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "scalar-build-esbuild",