@scalar/workspace-store 0.4.1 → 0.5.2
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 +20 -0
- package/dist/client.d.ts +39257 -4989
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -4
- package/dist/client.js.map +2 -2
- package/dist/helpers/general.d.ts +1 -0
- package/dist/helpers/general.d.ts.map +1 -1
- package/dist/helpers/general.js +5 -1
- package/dist/helpers/general.js.map +2 -2
- package/dist/navigation/helpers/traverse-document.d.ts +2 -2
- package/dist/navigation/helpers/traverse-document.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-document.js.map +2 -2
- package/dist/navigation/helpers/traverse-paths.d.ts +2 -2
- package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-paths.js +4 -0
- package/dist/navigation/helpers/traverse-paths.js.map +2 -2
- package/dist/navigation/helpers/traverse-schemas.d.ts +2 -2
- package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-schemas.js +1 -1
- package/dist/navigation/helpers/traverse-schemas.js.map +2 -2
- package/dist/navigation/helpers/traverse-tags.d.ts +2 -2
- package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-tags.js +2 -2
- package/dist/navigation/helpers/traverse-tags.js.map +2 -2
- package/dist/navigation/helpers/traverse-webhooks.d.ts +2 -2
- package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-webhooks.js +4 -0
- package/dist/navigation/helpers/traverse-webhooks.js.map +2 -2
- package/dist/navigation/types.d.ts +11 -10
- package/dist/navigation/types.d.ts.map +1 -1
- package/dist/schemas/typebox-coerce.d.ts +26 -0
- package/dist/schemas/typebox-coerce.d.ts.map +1 -0
- package/dist/schemas/typebox-coerce.js +8 -0
- package/dist/schemas/typebox-coerce.js.map +7 -0
- package/dist/schemas/v3.1/compose.d.ts +6 -0
- package/dist/schemas/v3.1/compose.d.ts.map +1 -0
- package/dist/schemas/v3.1/compose.js +8 -0
- package/dist/schemas/v3.1/compose.js.map +7 -0
- package/dist/schemas/v3.1/strict/callback.d.ts +3 -0
- package/dist/schemas/v3.1/strict/callback.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/callback.js +15 -0
- package/dist/schemas/v3.1/strict/callback.js.map +7 -0
- package/dist/schemas/v3.1/strict/components.d.ts +7824 -0
- package/dist/schemas/v3.1/strict/components.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/components.js +46 -0
- package/dist/schemas/v3.1/strict/components.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/contact.d.ts +4 -2
- package/dist/schemas/v3.1/strict/contact.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/contact.js +18 -0
- package/dist/schemas/v3.1/strict/contact.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/discriminator.d.ts +4 -2
- package/dist/schemas/v3.1/strict/discriminator.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/discriminator.js +16 -0
- package/dist/schemas/v3.1/strict/discriminator.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/encoding.d.ts +7 -16
- package/dist/schemas/v3.1/strict/encoding.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/encoding.js +17 -0
- package/dist/schemas/v3.1/strict/encoding.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/example.d.ts +4 -2
- package/dist/schemas/v3.1/strict/example.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/example.js +20 -0
- package/dist/schemas/v3.1/strict/example.js.map +7 -0
- package/dist/schemas/v3.1/strict/extensions.d.ts +4 -0
- package/dist/schemas/v3.1/strict/extensions.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/extensions.js +6 -0
- package/dist/schemas/v3.1/strict/extensions.js.map +7 -0
- package/dist/schemas/v3.1/strict/external-documentation.d.ts +10 -0
- package/dist/schemas/v3.1/strict/external-documentation.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/external-documentation.js +16 -0
- package/dist/schemas/v3.1/strict/external-documentation.js.map +7 -0
- package/dist/schemas/v3.1/strict/header.d.ts +133 -0
- package/dist/schemas/v3.1/strict/header.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/header.js +48 -0
- package/dist/schemas/v3.1/strict/header.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/info.d.ts +8 -6
- package/dist/schemas/v3.1/strict/info.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/info.js +28 -0
- package/dist/schemas/v3.1/strict/info.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/license.d.ts +4 -2
- package/dist/schemas/v3.1/strict/license.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/license.js +18 -0
- package/dist/schemas/v3.1/strict/license.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/link.d.ts +8 -6
- package/dist/schemas/v3.1/strict/link.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/link.js +25 -0
- package/dist/schemas/v3.1/strict/link.js.map +7 -0
- package/dist/schemas/v3.1/strict/media-header-encoding.d.ts +329 -0
- package/dist/schemas/v3.1/strict/media-header-encoding.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/media-header-encoding.js +19 -0
- package/dist/schemas/v3.1/strict/media-header-encoding.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/media-type.d.ts +20 -34
- package/dist/schemas/v3.1/strict/media-type.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/media-type.js +27 -0
- package/dist/schemas/v3.1/strict/media-type.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/oauth-flow.d.ts +4 -2
- package/dist/schemas/v3.1/strict/oauth-flow.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/oauth-flow.js +20 -0
- package/dist/schemas/v3.1/strict/oauth-flow.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/oauthflows.d.ts +12 -10
- package/dist/schemas/v3.1/strict/oauthflows.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/oauthflows.js +21 -0
- package/dist/schemas/v3.1/strict/oauthflows.js.map +7 -0
- package/dist/schemas/v3.1/strict/openapi-document.d.ts +49 -0
- package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/openapi-document.js +55 -0
- package/dist/schemas/v3.1/strict/openapi-document.js.map +7 -0
- package/dist/schemas/v3.1/strict/operation.d.ts +572 -0
- package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/operation.js +46 -0
- package/dist/schemas/v3.1/strict/operation.js.map +7 -0
- package/dist/schemas/v3.1/strict/parameter.d.ts +396 -0
- package/dist/schemas/v3.1/strict/parameter.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/parameter.js +56 -0
- package/dist/schemas/v3.1/strict/parameter.js.map +7 -0
- package/dist/schemas/v3.1/strict/path-item.d.ts +205 -0
- package/dist/schemas/v3.1/strict/path-item.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/path-item.js +41 -0
- package/dist/schemas/v3.1/strict/path-item.js.map +7 -0
- package/dist/schemas/v3.1/strict/path-operations.d.ts +7816 -0
- package/dist/schemas/v3.1/strict/path-operations.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/path-operations.js +19 -0
- package/dist/schemas/v3.1/strict/path-operations.js.map +7 -0
- package/dist/schemas/v3.1/strict/paths.d.ts +3536 -0
- package/dist/schemas/{openapi-v3/openapi-document.d.ts.map → v3.1/strict/paths.d.ts.map} +1 -1
- package/dist/schemas/v3.1/strict/paths.js +16 -0
- package/dist/schemas/v3.1/strict/paths.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/reference.d.ts +15 -6
- package/dist/schemas/v3.1/strict/reference.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/reference.js +26 -0
- package/dist/schemas/v3.1/strict/reference.js.map +7 -0
- package/dist/schemas/v3.1/strict/request-body.d.ts +112 -0
- package/dist/schemas/v3.1/strict/request-body.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/request-body.js +19 -0
- package/dist/schemas/v3.1/strict/request-body.js.map +7 -0
- package/dist/schemas/v3.1/strict/response.d.ts +242 -0
- package/dist/schemas/v3.1/strict/response.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/response.js +23 -0
- package/dist/schemas/v3.1/strict/response.js.map +7 -0
- package/dist/schemas/v3.1/strict/responses.d.ts +254 -0
- package/dist/schemas/v3.1/strict/responses.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/responses.js +13 -0
- package/dist/schemas/v3.1/strict/responses.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/schema.d.ts +12 -8
- package/dist/schemas/v3.1/strict/schema.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/schema.js +34 -0
- package/dist/schemas/v3.1/strict/schema.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/security-requirement.d.ts +3 -1
- package/dist/schemas/v3.1/strict/security-requirement.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/security-requirement.js +15 -0
- package/dist/schemas/v3.1/strict/security-requirement.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/security-scheme.d.ts +40 -38
- package/dist/schemas/v3.1/strict/security-scheme.d.ts.map +1 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/security-scheme.js +21 -16
- package/dist/schemas/v3.1/strict/security-scheme.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/server-variable.d.ts +4 -2
- package/dist/schemas/v3.1/strict/server-variable.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/server-variable.js +18 -0
- package/dist/schemas/v3.1/strict/server-variable.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/server.d.ts +6 -4
- package/dist/schemas/v3.1/strict/server.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/server.js +19 -0
- package/dist/schemas/v3.1/strict/server.js.map +7 -0
- package/dist/schemas/v3.1/strict/tag.d.ts +17 -0
- package/dist/schemas/v3.1/strict/tag.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/tag.js +25 -0
- package/dist/schemas/v3.1/strict/tag.js.map +7 -0
- package/dist/schemas/{openapi-v3 → v3.1/strict}/xml.d.ts +4 -2
- package/dist/schemas/v3.1/strict/xml.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/xml.js +22 -0
- package/dist/schemas/v3.1/strict/xml.js.map +7 -0
- package/dist/schemas/v3.1/type-guard.d.ts +3 -0
- package/dist/schemas/v3.1/type-guard.d.ts.map +1 -0
- package/dist/schemas/v3.1/type-guard.js +7 -0
- package/dist/schemas/v3.1/type-guard.js.map +7 -0
- package/dist/schemas/workspace.d.ts +49 -14750
- package/dist/schemas/workspace.d.ts.map +1 -1
- package/dist/schemas/workspace.js +5 -4
- package/dist/schemas/workspace.js.map +2 -2
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js.map +2 -2
- package/dist/server.d.ts +2579 -5
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +16 -8
- package/dist/server.js.map +2 -2
- package/package.json +5 -4
- package/dist/schemas/openapi-v3/callback.d.ts +0 -1156
- package/dist/schemas/openapi-v3/callback.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/callback.js +0 -11
- package/dist/schemas/openapi-v3/callback.js.map +0 -7
- package/dist/schemas/openapi-v3/components.d.ts +0 -2597
- package/dist/schemas/openapi-v3/components.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/components.js +0 -38
- package/dist/schemas/openapi-v3/components.js.map +0 -7
- package/dist/schemas/openapi-v3/contact.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/contact.js +0 -13
- package/dist/schemas/openapi-v3/contact.js.map +0 -7
- package/dist/schemas/openapi-v3/discriminator.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/discriminator.js +0 -11
- package/dist/schemas/openapi-v3/discriminator.js.map +0 -7
- package/dist/schemas/openapi-v3/encoding.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/encoding.js +0 -13
- package/dist/schemas/openapi-v3/encoding.js.map +0 -7
- package/dist/schemas/openapi-v3/example.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/example.js +0 -15
- package/dist/schemas/openapi-v3/example.js.map +0 -7
- package/dist/schemas/openapi-v3/external-documentation.d.ts +0 -8
- package/dist/schemas/openapi-v3/external-documentation.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/external-documentation.js +0 -11
- package/dist/schemas/openapi-v3/external-documentation.js.map +0 -7
- package/dist/schemas/openapi-v3/header.d.ts +0 -18
- package/dist/schemas/openapi-v3/header.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/header.js +0 -13
- package/dist/schemas/openapi-v3/header.js.map +0 -7
- package/dist/schemas/openapi-v3/info.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/info.js +0 -23
- package/dist/schemas/openapi-v3/info.js.map +0 -7
- package/dist/schemas/openapi-v3/license.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/license.js +0 -13
- package/dist/schemas/openapi-v3/license.js.map +0 -7
- package/dist/schemas/openapi-v3/link.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/link.js +0 -20
- package/dist/schemas/openapi-v3/link.js.map +0 -7
- package/dist/schemas/openapi-v3/media-type.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/media-type.js +0 -19
- package/dist/schemas/openapi-v3/media-type.js.map +0 -7
- package/dist/schemas/openapi-v3/oauth-flow.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/oauth-flow.js +0 -15
- package/dist/schemas/openapi-v3/oauth-flow.js.map +0 -7
- package/dist/schemas/openapi-v3/oauthflows.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/oauthflows.js +0 -16
- package/dist/schemas/openapi-v3/oauthflows.js.map +0 -7
- package/dist/schemas/openapi-v3/openapi-document.d.ts +0 -4941
- package/dist/schemas/openapi-v3/openapi-document.js +0 -35
- package/dist/schemas/openapi-v3/openapi-document.js.map +0 -7
- package/dist/schemas/openapi-v3/operation-without-callback.d.ts +0 -200
- package/dist/schemas/openapi-v3/operation-without-callback.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/operation-without-callback.js +0 -39
- package/dist/schemas/openapi-v3/operation-without-callback.js.map +0 -7
- package/dist/schemas/openapi-v3/parameter.d.ts +0 -25
- package/dist/schemas/openapi-v3/parameter.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/parameter.js +0 -22
- package/dist/schemas/openapi-v3/parameter.js.map +0 -7
- package/dist/schemas/openapi-v3/path-item.d.ts +0 -1167
- package/dist/schemas/openapi-v3/path-item.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/path-item.js +0 -37
- package/dist/schemas/openapi-v3/path-item.js.map +0 -7
- package/dist/schemas/openapi-v3/paths.d.ts +0 -1154
- package/dist/schemas/openapi-v3/paths.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/paths.js +0 -11
- package/dist/schemas/openapi-v3/paths.js.map +0 -7
- package/dist/schemas/openapi-v3/reference.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/reference.js +0 -17
- package/dist/schemas/openapi-v3/reference.js.map +0 -7
- package/dist/schemas/openapi-v3/request-body.d.ts +0 -56
- package/dist/schemas/openapi-v3/request-body.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/request-body.js +0 -14
- package/dist/schemas/openapi-v3/request-body.js.map +0 -7
- package/dist/schemas/openapi-v3/response.d.ts +0 -88
- package/dist/schemas/openapi-v3/response.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/response.js +0 -19
- package/dist/schemas/openapi-v3/response.js.map +0 -7
- package/dist/schemas/openapi-v3/responses.d.ts +0 -99
- package/dist/schemas/openapi-v3/responses.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/responses.js +0 -8
- package/dist/schemas/openapi-v3/responses.js.map +0 -7
- package/dist/schemas/openapi-v3/schema.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/schema.js +0 -22
- package/dist/schemas/openapi-v3/schema.js.map +0 -7
- package/dist/schemas/openapi-v3/security-requirement.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/security-requirement.js +0 -10
- package/dist/schemas/openapi-v3/security-requirement.js.map +0 -7
- package/dist/schemas/openapi-v3/security-scheme.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/security-scheme.js.map +0 -7
- package/dist/schemas/openapi-v3/server-variable.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/server-variable.js +0 -13
- package/dist/schemas/openapi-v3/server-variable.js.map +0 -7
- package/dist/schemas/openapi-v3/server.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/server.js +0 -14
- package/dist/schemas/openapi-v3/server.js.map +0 -7
- package/dist/schemas/openapi-v3/tag.d.ts +0 -13
- package/dist/schemas/openapi-v3/tag.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/tag.js +0 -14
- package/dist/schemas/openapi-v3/tag.js.map +0 -7
- package/dist/schemas/openapi-v3/xml.d.ts.map +0 -1
- package/dist/schemas/openapi-v3/xml.js +0 -17
- package/dist/schemas/openapi-v3/xml.js.map +0 -7
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getTag } from "./get-tag.js";
|
|
2
|
+
import { isReference } from "../../schemas/v3.1/type-guard.js";
|
|
2
3
|
const createWebhookEntry = (ref, method, name = "Unknown", title = "Unknown", titlesMap, getWebhookId, tag) => {
|
|
3
4
|
const id = getWebhookId({ name, method }, tag);
|
|
4
5
|
titlesMap.set(id, title);
|
|
@@ -16,6 +17,9 @@ const traverseWebhooks = (content, tagsMap, titlesMap, getWebhookId) => {
|
|
|
16
17
|
Object.entries(content.webhooks ?? {}).forEach(([name, pathItemObject]) => {
|
|
17
18
|
const pathEntries = Object.entries(pathItemObject ?? {});
|
|
18
19
|
pathEntries.forEach(([method, operation]) => {
|
|
20
|
+
if (isReference(operation)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
19
23
|
const ref = `#/webhooks/${name}/${method}`;
|
|
20
24
|
if (operation["x-internal"] || operation["x-scalar-ignore"]) {
|
|
21
25
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-webhooks.ts"],
|
|
4
|
-
"sourcesContent": ["import type {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { getTag } from './get-tag'\nimport type { TagsMap, TraversedWebhook, TraverseSpecOptions } from '@/navigation/types'\nimport type { OpenApiDocument } from '@/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@/schemas/v3.1/strict/path-operations'\nimport type { TagObject } from '@/schemas/v3.1/strict/tag'\nimport { isReference } from '@/schemas/v3.1/type-guard'\n\n/** Creates a traversed webhook entry from an OpenAPI webhook object.\n *\n * @param ref - JSON pointer reference to the webhook in the OpenAPI document\n * @param method - HTTP method of the webhook\n * @param name - Name of the webhook, defaults to 'Unknown'\n * @param title - Title of the webhook, defaults to 'Unknown'\n * @param titlesMap - Map to store webhook IDs and titles for mobile header navigation\n * @param getWebhookId - Function to generate unique IDs for webhooks\n * @param tag - Optional tag object associated with the webhook\n * @returns A traversed webhook entry with ID, title, name, method and reference\n */\nconst createWebhookEntry = (\n ref: string,\n method: string,\n name = 'Unknown',\n title = 'Unknown',\n titlesMap: Map<string, string>,\n getWebhookId: TraverseSpecOptions['getWebhookId'],\n tag?: TagObject,\n): TraversedWebhook => {\n const id = getWebhookId({ name, method }, tag)\n titlesMap.set(id, title)\n\n return {\n id,\n title,\n name,\n ref,\n method: method,\n type: 'webhook',\n }\n}\n\n/** Traverses the webhooks in an OpenAPI document to build an array of webhook entries.\n *\n * This function processes each webhook in the document to:\n * - Filter out internal webhooks (marked with x-internal) and webhooks to ignore (marked with x-scalar-ignore)\n * - Group webhooks by their tags\n * - Create webhook entries with unique references and IDs\n * - Store webhook IDs and titles for mobile header navigation\n *\n * @param content - The OpenAPI document to traverse\n * @param tagsMap - Map of tag names to arrays of traversed entries from operations\n * @param tagsDict - Dictionary mapping tag names to their OpenAPI tag objects\n * @param titlesMap - Map to store webhook IDs and titles for mobile header navigation\n * @param getWebhookId - Function to generate unique IDs for webhooks\n * @returns Array of untagged webhook entries\n */\nexport const traverseWebhooks = (\n content: OpenApiDocument,\n /** The tag map from from traversing paths */\n tagsMap: TagsMap,\n /** Map of titles for the mobile title */\n titlesMap: Map<string, string>,\n getWebhookId: TraverseSpecOptions['getWebhookId'],\n): TraversedWebhook[] => {\n const untagged: TraversedWebhook[] = []\n\n // Traverse webhooks\n Object.entries(content.webhooks ?? {}).forEach(([name, pathItemObject]) => {\n const pathEntries = Object.entries(pathItemObject ?? {}) as [string, OperationObject][]\n\n pathEntries.forEach(([method, operation]) => {\n if (isReference(operation)) {\n return\n }\n\n const ref = `#/webhooks/${name}/${method}`\n\n // Skip if the operation is internal or scalar-ignore\n if (operation['x-internal'] || operation['x-scalar-ignore']) {\n return\n }\n\n if (operation.tags?.length) {\n operation.tags.forEach((tagName: string) => {\n const { tag } = getTag(tagsMap, tagName)\n tagsMap\n .get(tagName)\n ?.entries.push(\n createWebhookEntry(ref, method, name, operation.summary ?? name, titlesMap, getWebhookId, tag),\n )\n })\n }\n // Add to untagged\n else {\n untagged.push(createWebhookEntry(ref, method, name, operation.summary ?? name, titlesMap, getWebhookId))\n }\n })\n })\n\n return untagged\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AAKvB,SAAS,mBAAmB;AAa5B,MAAM,qBAAqB,CACzB,KACA,QACA,OAAO,WACP,QAAQ,WACR,WACA,cACA,QACqB;AACrB,QAAM,KAAK,aAAa,EAAE,MAAM,OAAO,GAAG,GAAG;AAC7C,YAAU,IAAI,IAAI,KAAK;AAEvB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACR;AACF;AAiBO,MAAM,mBAAmB,CAC9B,SAEA,SAEA,WACA,iBACuB;AACvB,QAAM,WAA+B,CAAC;AAGtC,SAAO,QAAQ,QAAQ,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,cAAc,MAAM;AACzE,UAAM,cAAc,OAAO,QAAQ,kBAAkB,CAAC,CAAC;AAEvD,gBAAY,QAAQ,CAAC,CAAC,QAAQ,SAAS,MAAM;AAC3C,UAAI,YAAY,SAAS,GAAG;AAC1B;AAAA,MACF;AAEA,YAAM,MAAM,cAAc,IAAI,IAAI,MAAM;AAGxC,UAAI,UAAU,YAAY,KAAK,UAAU,iBAAiB,GAAG;AAC3D;AAAA,MACF;AAEA,UAAI,UAAU,MAAM,QAAQ;AAC1B,kBAAU,KAAK,QAAQ,CAAC,YAAoB;AAC1C,gBAAM,EAAE,IAAI,IAAI,OAAO,SAAS,OAAO;AACvC,kBACG,IAAI,OAAO,GACV,QAAQ;AAAA,YACR,mBAAmB,KAAK,QAAQ,MAAM,UAAU,WAAW,MAAM,WAAW,cAAc,GAAG;AAAA,UAC/F;AAAA,QACJ,CAAC;AAAA,MACH,OAEK;AACH,iBAAS,KAAK,mBAAmB,KAAK,QAAQ,MAAM,UAAU,WAAW,MAAM,WAAW,YAAY,CAAC;AAAA,MACzG;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OperationObject } from '../schemas/v3.1/strict/path-operations.js';
|
|
2
|
+
import type { TagObject } from '../schemas/v3.1/strict/tag.js';
|
|
2
3
|
/** Map of tagNames and their entries */
|
|
3
4
|
export type TagsMap = Map<string, {
|
|
4
|
-
tag:
|
|
5
|
+
tag: TagObject;
|
|
5
6
|
entries: TraversedEntry[];
|
|
6
7
|
}>;
|
|
7
8
|
type TraverseEntryBase = {
|
|
@@ -18,7 +19,7 @@ export type TraversedDescription = TraverseEntryBase & {
|
|
|
18
19
|
export type TraversedOperation = TraverseEntryBase & {
|
|
19
20
|
type: 'operation';
|
|
20
21
|
ref: string;
|
|
21
|
-
method:
|
|
22
|
+
method: string;
|
|
22
23
|
path: string;
|
|
23
24
|
};
|
|
24
25
|
/** Model entry returned form traversing the document */
|
|
@@ -38,7 +39,7 @@ export type TraversedTag = TraverseEntryBase & {
|
|
|
38
39
|
export type TraversedWebhook = TraverseEntryBase & {
|
|
39
40
|
type: 'webhook';
|
|
40
41
|
ref: string;
|
|
41
|
-
method:
|
|
42
|
+
method: string;
|
|
42
43
|
name: string;
|
|
43
44
|
};
|
|
44
45
|
/** Entries returned form traversing the document */
|
|
@@ -57,7 +58,7 @@ type OperationSortValue = {
|
|
|
57
58
|
*/
|
|
58
59
|
export type TraverseSpecOptions = {
|
|
59
60
|
/** Controls how tags are sorted - either alphabetically or using a custom sort function */
|
|
60
|
-
tagsSorter: 'alpha' | ((a:
|
|
61
|
+
tagsSorter: 'alpha' | ((a: TagObject, b: TagObject) => number);
|
|
61
62
|
/** Controls how operations are sorted - alphabetically, by method, or using a custom sort function */
|
|
62
63
|
operationsSorter: 'alpha' | 'method' | ((a: OperationSortValue, b: OperationSortValue) => number);
|
|
63
64
|
/** Whether to hide model schemas from the navigation */
|
|
@@ -71,19 +72,19 @@ export type TraverseSpecOptions = {
|
|
|
71
72
|
/** Function to generate unique IDs for operations */
|
|
72
73
|
getOperationId: (operation: {
|
|
73
74
|
path: string;
|
|
74
|
-
method:
|
|
75
|
-
} &
|
|
75
|
+
method: string;
|
|
76
|
+
} & OperationObject, parentTag: TagObject) => string;
|
|
76
77
|
/** Function to generate unique IDs for webhooks */
|
|
77
78
|
getWebhookId: (webhook?: {
|
|
78
79
|
name: string;
|
|
79
80
|
method?: string;
|
|
80
|
-
}, parentTag?:
|
|
81
|
+
}, parentTag?: TagObject) => string;
|
|
81
82
|
/** Function to generate unique IDs for models/schemas */
|
|
82
83
|
getModelId: (model?: {
|
|
83
84
|
name: string;
|
|
84
|
-
}, parentTag?:
|
|
85
|
+
}, parentTag?: TagObject) => string;
|
|
85
86
|
/** Function to generate unique IDs for tags */
|
|
86
|
-
getTagId: (tag:
|
|
87
|
+
getTagId: (tag: TagObject) => string;
|
|
87
88
|
};
|
|
88
89
|
export type Heading = {
|
|
89
90
|
depth: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/navigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/navigation/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TSchema } from '@sinclair/typebox';
|
|
2
|
+
/**
|
|
3
|
+
* Coerces a value to match the provided TypeBox schema by first converting and then casting the value.
|
|
4
|
+
* This is useful for ensuring values match their expected types, especially when dealing with
|
|
5
|
+
* form inputs or API responses that may need type conversion.
|
|
6
|
+
*
|
|
7
|
+
* @param schema - The TypeBox schema to coerce the value against
|
|
8
|
+
* @param value - The value to coerce
|
|
9
|
+
* @returns The coerced value that matches the schema
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Convert string "123" to number
|
|
13
|
+
* const schema = Type.Number()
|
|
14
|
+
* const value = "123"
|
|
15
|
+
* const coerced = coerceValue(schema, value) // Returns 123
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Convert string "true" to boolean
|
|
19
|
+
* const schema = Type.Boolean()
|
|
20
|
+
* const value = "true"
|
|
21
|
+
* const coerced = coerceValue(schema, value) // Returns true
|
|
22
|
+
*/
|
|
23
|
+
export declare const coerceValue: <T extends TSchema>(schema: T, value: unknown) => (T & {
|
|
24
|
+
params: [];
|
|
25
|
+
})["static"];
|
|
26
|
+
//# sourceMappingURL=typebox-coerce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typebox-coerce.d.ts","sourceRoot":"","sources":["../../src/schemas/typebox-coerce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAGhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,OAAO,UAAU,CAAC,SAAS,OAAO;;YAEvE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/schemas/typebox-coerce.ts"],
|
|
4
|
+
"sourcesContent": ["import type { TSchema } from '@sinclair/typebox'\nimport { Value } from '@sinclair/typebox/value'\n\n/**\n * Coerces a value to match the provided TypeBox schema by first converting and then casting the value.\n * This is useful for ensuring values match their expected types, especially when dealing with\n * form inputs or API responses that may need type conversion.\n *\n * @param schema - The TypeBox schema to coerce the value against\n * @param value - The value to coerce\n * @returns The coerced value that matches the schema\n *\n * @example\n * // Convert string \"123\" to number\n * const schema = Type.Number()\n * const value = \"123\"\n * const coerced = coerceValue(schema, value) // Returns 123\n *\n * @example\n * // Convert string \"true\" to boolean\n * const schema = Type.Boolean()\n * const value = \"true\"\n * const coerced = coerceValue(schema, value) // Returns true\n */\nexport const coerceValue = <T extends TSchema>(schema: T, value: unknown) => {\n return Value.Cast(schema, Value.Convert(schema, value))\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,aAAa;AAuBf,MAAM,cAAc,CAAoB,QAAW,UAAmB;AAC3E,SAAO,MAAM,KAAK,QAAQ,MAAM,QAAQ,QAAQ,KAAK,CAAC;AACxD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Type, type TSchema } from '@sinclair/typebox';
|
|
2
|
+
/**
|
|
3
|
+
* Work around for: https://github.com/sinclairzx81/typebox/issues/1264
|
|
4
|
+
*/
|
|
5
|
+
export declare const compose: <A extends TSchema[]>(...args: A) => ReturnType<typeof Type.Intersect<A>>;
|
|
6
|
+
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../../src/schemas/v3.1/compose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,OAAO,EAAE,WAAW,CAAC,KACX,UAAU,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAC9E,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/schemas/v3.1/compose.ts"],
|
|
4
|
+
"sourcesContent": ["import { Type, type TSchema } from '@sinclair/typebox'\n\n/**\n * Work around for: https://github.com/sinclairzx81/typebox/issues/1264\n */\nexport const compose = <A extends TSchema[]>(...args: A) => {\n return Type.Composite(args) as unknown as ReturnType<typeof Type.Intersect<A>>\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAA0B;AAK5B,MAAM,UAAU,IAAyB,SAAY;AAC1D,SAAO,KAAK,UAAU,IAAI;AAC5B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type TSchema } from '@sinclair/typebox';
|
|
2
|
+
export declare const callbackObjectSchemaBuilder: <P extends TSchema>(pathItem: P) => import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, P>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TTemplateLiteralSyntax<"x-${string}">, import("@sinclair/typebox").TUnknown>]>;
|
|
3
|
+
//# sourceMappingURL=callback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../../../src/schemas/v3.1/strict/callback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAItD,eAAO,MAAM,2BAA2B,GAAI,CAAC,SAAS,OAAO,YAAY,CAAC,wQAQvE,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { ExtensionsSchema } from "../../../schemas/v3.1/strict/extensions.js";
|
|
3
|
+
import { compose } from "../../../schemas/v3.1/compose.js";
|
|
4
|
+
const callbackObjectSchemaBuilder = (pathItem) => compose(
|
|
5
|
+
Type.Record(
|
|
6
|
+
Type.String(),
|
|
7
|
+
/** A Path Item Object used to define a callback request and expected responses. A complete example is available. */
|
|
8
|
+
pathItem
|
|
9
|
+
),
|
|
10
|
+
ExtensionsSchema
|
|
11
|
+
);
|
|
12
|
+
export {
|
|
13
|
+
callbackObjectSchemaBuilder
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=callback.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/schemas/v3.1/strict/callback.ts"],
|
|
4
|
+
"sourcesContent": ["import { Type, type TSchema } from '@sinclair/typebox'\nimport { ExtensionsSchema } from '@/schemas/v3.1/strict/extensions'\nimport { compose } from '@/schemas/v3.1/compose'\n\nexport const callbackObjectSchemaBuilder = <P extends TSchema>(pathItem: P) =>\n compose(\n Type.Record(\n Type.String(),\n /** A Path Item Object used to define a callback request and expected responses. A complete example is available. */\n pathItem,\n ),\n ExtensionsSchema,\n )\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,eAAe;AAEjB,MAAM,8BAA8B,CAAoB,aAC7D;AAAA,EACE,KAAK;AAAA,IACH,KAAK,OAAO;AAAA;AAAA,IAEZ;AAAA,EACF;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|