@scalar/workspace-store 0.40.2 → 0.40.3
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 +7 -0
- package/dist/client.d.ts +7 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +820 -681
- package/dist/entities/auth/index.js +96 -101
- package/dist/entities/auth/schema.js +42 -116
- package/dist/entities/history/index.js +80 -60
- package/dist/entities/history/schema.js +94 -88
- package/dist/events/bus.js +146 -93
- package/dist/events/definitions/analytics.js +1 -1
- package/dist/events/definitions/auth.js +1 -1
- package/dist/events/definitions/common.js +1 -1
- package/dist/events/definitions/cookie.js +1 -1
- package/dist/events/definitions/document.js +1 -1
- package/dist/events/definitions/environment.js +1 -1
- package/dist/events/definitions/hooks.js +1 -1
- package/dist/events/definitions/index.js +1 -1
- package/dist/events/definitions/meta.js +1 -1
- package/dist/events/definitions/operation.js +1 -1
- package/dist/events/definitions/server.js +1 -1
- package/dist/events/definitions/tabs.js +1 -1
- package/dist/events/definitions/tag.js +1 -1
- package/dist/events/definitions/ui.js +1 -1
- package/dist/events/definitions/workspace.js +1 -1
- package/dist/events/index.js +3 -9
- package/dist/events/listeners.js +20 -22
- package/dist/events/old-definitions.js +15 -12
- package/dist/helpers/deep-clone.js +33 -17
- package/dist/helpers/detect-changes-proxy.js +95 -57
- package/dist/helpers/general.js +78 -23
- package/dist/helpers/generate-unique-value.js +77 -45
- package/dist/helpers/get-fetch.js +12 -10
- package/dist/helpers/get-resolved-ref.js +11 -10
- package/dist/helpers/is-non-optional-security-requirement.js +3 -6
- package/dist/helpers/merge-object.js +71 -30
- package/dist/helpers/overrides-proxy.js +98 -58
- package/dist/helpers/unpack-proxy.js +60 -58
- package/dist/mutators/auth.js +358 -230
- package/dist/mutators/cookie.js +59 -42
- package/dist/mutators/document.js +104 -66
- package/dist/mutators/environment.js +97 -72
- package/dist/mutators/helpers.js +9 -13
- package/dist/mutators/index.js +62 -49
- package/dist/mutators/operation/body.js +88 -57
- package/dist/mutators/operation/extensions.js +20 -12
- package/dist/mutators/operation/helpers/fetch-request-to-har.js +144 -107
- package/dist/mutators/operation/helpers/fetch-response-to-har.js +143 -95
- package/dist/mutators/operation/helpers/get-parameter-position.js +12 -12
- package/dist/mutators/operation/helpers/har-to-operation.js +169 -132
- package/dist/mutators/operation/helpers/sync-path-parameters.js +109 -60
- package/dist/mutators/operation/history.js +60 -64
- package/dist/mutators/operation/index.js +25 -49
- package/dist/mutators/operation/operation.js +349 -240
- package/dist/mutators/operation/parameters.js +157 -93
- package/dist/mutators/server.js +213 -152
- package/dist/mutators/tabs.js +173 -130
- package/dist/mutators/tag.js +131 -97
- package/dist/mutators/workspace.js +72 -42
- package/dist/navigation/get-navigation-options.js +97 -84
- package/dist/navigation/helpers/get-openapi-object.js +46 -29
- package/dist/navigation/helpers/get-operation-entries.js +72 -32
- package/dist/navigation/helpers/get-parent-entry.js +16 -12
- package/dist/navigation/helpers/get-tag-entries.js +56 -29
- package/dist/navigation/helpers/get-tag.js +22 -23
- package/dist/navigation/helpers/get-x-keys.js +13 -9
- package/dist/navigation/helpers/traverse-description.js +90 -72
- package/dist/navigation/helpers/traverse-document.js +111 -98
- package/dist/navigation/helpers/traverse-examples.js +35 -31
- package/dist/navigation/helpers/traverse-paths.js +118 -106
- package/dist/navigation/helpers/traverse-schemas.js +65 -64
- package/dist/navigation/helpers/traverse-tags.js +158 -129
- package/dist/navigation/helpers/traverse-webhooks.js +96 -90
- package/dist/navigation/helpers/update-order-ids.js +59 -51
- package/dist/navigation/helpers/utils.js +71 -21
- package/dist/navigation/index.js +5 -13
- package/dist/navigation/types.js +1 -1
- package/dist/persistence/index.js +283 -285
- package/dist/persistence/indexdb.js +263 -126
- package/dist/plugins/bundler/helpers.js +21 -12
- package/dist/plugins/bundler/index.d.ts +7 -0
- package/dist/plugins/bundler/index.d.ts.map +1 -1
- package/dist/plugins/bundler/index.js +305 -171
- package/dist/plugins/client/index.js +1 -5
- package/dist/plugins/client/persistence.js +95 -90
- package/dist/resolve.js +18 -25
- package/dist/schemas/compose.js +6 -7
- package/dist/schemas/extensions/document/x-internal.js +3 -7
- package/dist/schemas/extensions/document/x-scalar-environments.js +16 -22
- package/dist/schemas/extensions/document/x-scalar-icon.js +3 -7
- package/dist/schemas/extensions/document/x-scalar-ignore.js +3 -7
- package/dist/schemas/extensions/document/x-scalar-is-dirty.js +21 -8
- package/dist/schemas/extensions/document/x-scalar-original-document-hash.js +17 -8
- package/dist/schemas/extensions/document/x-scalar-registry-meta.js +15 -21
- package/dist/schemas/extensions/document/x-scalar-sdk-installation.js +5 -13
- package/dist/schemas/extensions/document/x-scalar-watch-mode.js +4 -8
- package/dist/schemas/extensions/document/x-tags.js +3 -7
- package/dist/schemas/extensions/example/x-disabled.js +17 -7
- package/dist/schemas/extensions/general/x-scalar-active-environment.js +4 -7
- package/dist/schemas/extensions/general/x-scalar-cookies.js +9 -14
- package/dist/schemas/extensions/general/x-scalar-order.js +8 -7
- package/dist/schemas/extensions/operation/index.js +4 -23
- package/dist/schemas/extensions/operation/x-badge.js +42 -50
- package/dist/schemas/extensions/operation/x-code-samples.js +8 -12
- package/dist/schemas/extensions/operation/x-draft-examples.js +3 -7
- package/dist/schemas/extensions/operation/x-post-response.js +18 -7
- package/dist/schemas/extensions/operation/x-scalar-disable-parameters.js +57 -13
- package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js +9 -7
- package/dist/schemas/extensions/operation/x-scalar-stability.js +15 -14
- package/dist/schemas/extensions/parameter/x-global.js +12 -7
- package/dist/schemas/extensions/schema/x-additional-properties-name.js +10 -7
- package/dist/schemas/extensions/schema/x-enum-descriptions.js +17 -12
- package/dist/schemas/extensions/schema/x-enum-varnames.js +21 -8
- package/dist/schemas/extensions/schema/x-examples.js +3 -7
- package/dist/schemas/extensions/schema/x-variable.js +3 -7
- package/dist/schemas/extensions/security/index.js +1 -1
- package/dist/schemas/extensions/security/x-default-scopes.js +16 -7
- package/dist/schemas/extensions/security/x-scalar-credentials-location.js +16 -7
- package/dist/schemas/extensions/security/x-scalar-security-body.js +14 -7
- package/dist/schemas/extensions/security/x-scalar-security-query.js +14 -7
- package/dist/schemas/extensions/security/x-scalar-security-secrets.js +66 -37
- package/dist/schemas/extensions/security/x-tokenName.js +11 -7
- package/dist/schemas/extensions/security/x-use-pkce.js +6 -10
- package/dist/schemas/extensions/server/x-scalar-selected-server.js +3 -7
- package/dist/schemas/extensions/tag/index.js +1 -1
- package/dist/schemas/extensions/tag/x-display-name.js +11 -7
- package/dist/schemas/extensions/tag/x-tag-groups.js +13 -15
- package/dist/schemas/extensions/workspace/index.js +2 -11
- package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js +13 -7
- package/dist/schemas/extensions/workspace/x-scalar-tabs.js +15 -13
- package/dist/schemas/extensions.js +11 -15
- package/dist/schemas/inmemory-workspace.js +13 -21
- package/dist/schemas/navigation.js +48 -85
- package/dist/schemas/reference-config/appearance.js +15 -22
- package/dist/schemas/reference-config/features.js +14 -21
- package/dist/schemas/reference-config/index.js +42 -44
- package/dist/schemas/reference-config/meta.js +11 -18
- package/dist/schemas/reference-config/routing.js +7 -14
- package/dist/schemas/reference-config/settings.js +10 -17
- package/dist/schemas/typebox-coerce.js +23 -6
- package/dist/schemas/v3.1/strict/callback.js +6 -12
- package/dist/schemas/v3.1/strict/components.js +26 -48
- package/dist/schemas/v3.1/strict/contact.js +9 -12
- package/dist/schemas/v3.1/strict/discriminator.js +11 -10
- package/dist/schemas/v3.1/strict/encoding.js +15 -12
- package/dist/schemas/v3.1/strict/example.js +11 -13
- package/dist/schemas/v3.1/strict/external-documentation.js +7 -10
- package/dist/schemas/v3.1/strict/header.js +27 -28
- package/dist/schemas/v3.1/strict/info.js +10 -16
- package/dist/schemas/v3.1/strict/license.js +9 -12
- package/dist/schemas/v3.1/strict/link.js +22 -19
- package/dist/schemas/v3.1/strict/media-type.js +17 -16
- package/dist/schemas/v3.1/strict/oauth-flow.js +28 -62
- package/dist/schemas/v3.1/strict/oauthflows.js +14 -20
- package/dist/schemas/v3.1/strict/openapi-document.js +126 -210
- package/dist/schemas/v3.1/strict/operation.js +16 -43
- package/dist/schemas/v3.1/strict/parameter.js +27 -35
- package/dist/schemas/v3.1/strict/path-item.js +36 -40
- package/dist/schemas/v3.1/strict/paths.js +8 -11
- package/dist/schemas/v3.1/strict/ref-definitions.js +76 -100
- package/dist/schemas/v3.1/strict/reference.js +18 -21
- package/dist/schemas/v3.1/strict/request-body.js +8 -16
- package/dist/schemas/v3.1/strict/response.js +12 -16
- package/dist/schemas/v3.1/strict/responses.js +13 -11
- package/dist/schemas/v3.1/strict/schema.js +149 -157
- package/dist/schemas/v3.1/strict/security-requirement.js +13 -12
- package/dist/schemas/v3.1/strict/security-scheme.js +29 -41
- package/dist/schemas/v3.1/strict/server-variable.js +9 -12
- package/dist/schemas/v3.1/strict/server.js +10 -13
- package/dist/schemas/v3.1/strict/tag.js +11 -20
- package/dist/schemas/v3.1/strict/type-guards.js +20 -20
- package/dist/schemas/v3.1/strict/xml.js +17 -16
- package/dist/schemas/workspace-specification/index.js +11 -23
- package/dist/schemas/workspace-specification/info.js +4 -8
- package/dist/schemas/workspace.js +25 -51
- package/dist/schemas.js +2 -6
- package/dist/server.js +286 -176
- package/dist/workspace-plugin.js +1 -1
- package/package.json +13 -19
- package/dist/client.js.map +0 -7
- package/dist/entities/auth/index.js.map +0 -7
- package/dist/entities/auth/schema.js.map +0 -7
- package/dist/entities/history/index.js.map +0 -7
- package/dist/entities/history/schema.js.map +0 -7
- package/dist/events/bus.js.map +0 -7
- package/dist/events/definitions/analytics.js.map +0 -7
- package/dist/events/definitions/auth.js.map +0 -7
- package/dist/events/definitions/common.js.map +0 -7
- package/dist/events/definitions/cookie.js.map +0 -7
- package/dist/events/definitions/document.js.map +0 -7
- package/dist/events/definitions/environment.js.map +0 -7
- package/dist/events/definitions/hooks.js.map +0 -7
- package/dist/events/definitions/index.js.map +0 -7
- package/dist/events/definitions/meta.js.map +0 -7
- package/dist/events/definitions/operation.js.map +0 -7
- package/dist/events/definitions/server.js.map +0 -7
- package/dist/events/definitions/tabs.js.map +0 -7
- package/dist/events/definitions/tag.js.map +0 -7
- package/dist/events/definitions/ui.js.map +0 -7
- package/dist/events/definitions/workspace.js.map +0 -7
- package/dist/events/index.js.map +0 -7
- package/dist/events/listeners.js.map +0 -7
- package/dist/events/old-definitions.js.map +0 -7
- package/dist/helpers/apply-selective-updates.d.ts +0 -19
- package/dist/helpers/apply-selective-updates.d.ts.map +0 -1
- package/dist/helpers/apply-selective-updates.js +0 -37
- package/dist/helpers/apply-selective-updates.js.map +0 -7
- package/dist/helpers/deep-clone.js.map +0 -7
- package/dist/helpers/detect-changes-proxy.js.map +0 -7
- package/dist/helpers/general.js.map +0 -7
- package/dist/helpers/generate-unique-value.js.map +0 -7
- package/dist/helpers/get-fetch.js.map +0 -7
- package/dist/helpers/get-resolved-ref.js.map +0 -7
- package/dist/helpers/is-non-optional-security-requirement.js.map +0 -7
- package/dist/helpers/merge-object.js.map +0 -7
- package/dist/helpers/overrides-proxy.js.map +0 -7
- package/dist/helpers/unpack-proxy.js.map +0 -7
- package/dist/mutators/auth.js.map +0 -7
- package/dist/mutators/cookie.js.map +0 -7
- package/dist/mutators/document.js.map +0 -7
- package/dist/mutators/environment.js.map +0 -7
- package/dist/mutators/helpers.js.map +0 -7
- package/dist/mutators/index.js.map +0 -7
- package/dist/mutators/operation/body.js.map +0 -7
- package/dist/mutators/operation/extensions.js.map +0 -7
- package/dist/mutators/operation/helpers/fetch-request-to-har.js.map +0 -7
- package/dist/mutators/operation/helpers/fetch-response-to-har.js.map +0 -7
- package/dist/mutators/operation/helpers/get-parameter-position.js.map +0 -7
- package/dist/mutators/operation/helpers/har-to-operation.js.map +0 -7
- package/dist/mutators/operation/helpers/sync-path-parameters.js.map +0 -7
- package/dist/mutators/operation/history.js.map +0 -7
- package/dist/mutators/operation/index.js.map +0 -7
- package/dist/mutators/operation/operation.js.map +0 -7
- package/dist/mutators/operation/parameters.js.map +0 -7
- package/dist/mutators/server.js.map +0 -7
- package/dist/mutators/tabs.js.map +0 -7
- package/dist/mutators/tag.js.map +0 -7
- package/dist/mutators/workspace.js.map +0 -7
- package/dist/navigation/get-navigation-options.js.map +0 -7
- package/dist/navigation/helpers/get-openapi-object.js.map +0 -7
- package/dist/navigation/helpers/get-operation-entries.js.map +0 -7
- package/dist/navigation/helpers/get-parent-entry.js.map +0 -7
- package/dist/navigation/helpers/get-tag-entries.js.map +0 -7
- package/dist/navigation/helpers/get-tag.js.map +0 -7
- package/dist/navigation/helpers/get-x-keys.js.map +0 -7
- package/dist/navigation/helpers/traverse-description.js.map +0 -7
- package/dist/navigation/helpers/traverse-document.js.map +0 -7
- package/dist/navigation/helpers/traverse-examples.js.map +0 -7
- package/dist/navigation/helpers/traverse-paths.js.map +0 -7
- package/dist/navigation/helpers/traverse-schemas.js.map +0 -7
- package/dist/navigation/helpers/traverse-tags.js.map +0 -7
- package/dist/navigation/helpers/traverse-webhooks.js.map +0 -7
- package/dist/navigation/helpers/update-order-ids.js.map +0 -7
- package/dist/navigation/helpers/utils.js.map +0 -7
- package/dist/navigation/index.js.map +0 -7
- package/dist/navigation/types.js.map +0 -7
- package/dist/persistence/index.js.map +0 -7
- package/dist/persistence/indexdb.js.map +0 -7
- package/dist/plugins/bundler/helpers.js.map +0 -7
- package/dist/plugins/bundler/index.js.map +0 -7
- package/dist/plugins/client/index.js.map +0 -7
- package/dist/plugins/client/persistence.js.map +0 -7
- package/dist/resolve.js.map +0 -7
- package/dist/schemas/compose.js.map +0 -7
- package/dist/schemas/extensions/document/x-internal.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-environments.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-icon.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-ignore.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-is-dirty.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-original-document-hash.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-registry-meta.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-sdk-installation.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-watch-mode.js.map +0 -7
- package/dist/schemas/extensions/document/x-tags.js.map +0 -7
- package/dist/schemas/extensions/example/x-disabled.js.map +0 -7
- package/dist/schemas/extensions/general/x-scalar-active-environment.js.map +0 -7
- package/dist/schemas/extensions/general/x-scalar-cookies.js.map +0 -7
- package/dist/schemas/extensions/general/x-scalar-order.js.map +0 -7
- package/dist/schemas/extensions/operation/index.js.map +0 -7
- package/dist/schemas/extensions/operation/x-badge.js.map +0 -7
- package/dist/schemas/extensions/operation/x-code-samples.js.map +0 -7
- package/dist/schemas/extensions/operation/x-draft-examples.js.map +0 -7
- package/dist/schemas/extensions/operation/x-post-response.js.map +0 -7
- package/dist/schemas/extensions/operation/x-scalar-disable-parameters.js.map +0 -7
- package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js.map +0 -7
- package/dist/schemas/extensions/operation/x-scalar-stability.js.map +0 -7
- package/dist/schemas/extensions/parameter/x-global.js.map +0 -7
- package/dist/schemas/extensions/schema/x-additional-properties-name.js.map +0 -7
- package/dist/schemas/extensions/schema/x-enum-descriptions.js.map +0 -7
- package/dist/schemas/extensions/schema/x-enum-varnames.js.map +0 -7
- package/dist/schemas/extensions/schema/x-examples.js.map +0 -7
- package/dist/schemas/extensions/schema/x-variable.js.map +0 -7
- package/dist/schemas/extensions/security/index.js.map +0 -7
- package/dist/schemas/extensions/security/x-default-scopes.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-credentials-location.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-security-body.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-security-query.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-security-secrets.js.map +0 -7
- package/dist/schemas/extensions/security/x-tokenName.js.map +0 -7
- package/dist/schemas/extensions/security/x-use-pkce.js.map +0 -7
- package/dist/schemas/extensions/server/x-scalar-selected-server.js.map +0 -7
- package/dist/schemas/extensions/tag/index.js.map +0 -7
- package/dist/schemas/extensions/tag/x-display-name.js.map +0 -7
- package/dist/schemas/extensions/tag/x-tag-groups.js.map +0 -7
- package/dist/schemas/extensions/workspace/index.js.map +0 -7
- package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js.map +0 -7
- package/dist/schemas/extensions/workspace/x-scalar-tabs.js.map +0 -7
- package/dist/schemas/extensions.js.map +0 -7
- package/dist/schemas/inmemory-workspace.js.map +0 -7
- package/dist/schemas/navigation.js.map +0 -7
- package/dist/schemas/reference-config/appearance.js.map +0 -7
- package/dist/schemas/reference-config/features.js.map +0 -7
- package/dist/schemas/reference-config/index.js.map +0 -7
- package/dist/schemas/reference-config/meta.js.map +0 -7
- package/dist/schemas/reference-config/routing.js.map +0 -7
- package/dist/schemas/reference-config/settings.js.map +0 -7
- package/dist/schemas/typebox-coerce.js.map +0 -7
- package/dist/schemas/v3.1/strict/callback.js.map +0 -7
- package/dist/schemas/v3.1/strict/components.js.map +0 -7
- package/dist/schemas/v3.1/strict/contact.js.map +0 -7
- package/dist/schemas/v3.1/strict/discriminator.js.map +0 -7
- package/dist/schemas/v3.1/strict/encoding.js.map +0 -7
- package/dist/schemas/v3.1/strict/example.js.map +0 -7
- package/dist/schemas/v3.1/strict/external-documentation.js.map +0 -7
- package/dist/schemas/v3.1/strict/header.js.map +0 -7
- package/dist/schemas/v3.1/strict/info.js.map +0 -7
- package/dist/schemas/v3.1/strict/license.js.map +0 -7
- package/dist/schemas/v3.1/strict/link.js.map +0 -7
- package/dist/schemas/v3.1/strict/media-type.js.map +0 -7
- package/dist/schemas/v3.1/strict/oauth-flow.js.map +0 -7
- package/dist/schemas/v3.1/strict/oauthflows.js.map +0 -7
- package/dist/schemas/v3.1/strict/openapi-document.js.map +0 -7
- package/dist/schemas/v3.1/strict/operation.js.map +0 -7
- package/dist/schemas/v3.1/strict/parameter.js.map +0 -7
- package/dist/schemas/v3.1/strict/path-item.js.map +0 -7
- package/dist/schemas/v3.1/strict/paths.js.map +0 -7
- package/dist/schemas/v3.1/strict/ref-definitions.js.map +0 -7
- package/dist/schemas/v3.1/strict/reference.js.map +0 -7
- package/dist/schemas/v3.1/strict/request-body.js.map +0 -7
- package/dist/schemas/v3.1/strict/response.js.map +0 -7
- package/dist/schemas/v3.1/strict/responses.js.map +0 -7
- package/dist/schemas/v3.1/strict/schema.js.map +0 -7
- package/dist/schemas/v3.1/strict/security-requirement.js.map +0 -7
- package/dist/schemas/v3.1/strict/security-scheme.js.map +0 -7
- package/dist/schemas/v3.1/strict/server-variable.js.map +0 -7
- package/dist/schemas/v3.1/strict/server.js.map +0 -7
- package/dist/schemas/v3.1/strict/tag.js.map +0 -7
- package/dist/schemas/v3.1/strict/type-guards.js.map +0 -7
- package/dist/schemas/v3.1/strict/xml.js.map +0 -7
- package/dist/schemas/workspace-specification/index.js.map +0 -7
- package/dist/schemas/workspace-specification/info.js.map +0 -7
- package/dist/schemas/workspace.js.map +0 -7
- package/dist/schemas.js.map +0 -7
- package/dist/server.js.map +0 -7
- package/dist/workspace-plugin.js.map +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/persistence/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nimport type { PathMethodHistory } from '@/entities/history/schema'\nimport { createIndexDbConnection } from '@/persistence/indexdb'\nimport type { InMemoryWorkspace } from '@/schemas/inmemory-workspace'\nimport type { WorkspaceMeta } from '@/schemas/workspace'\n\ntype WorkspaceKey = {\n namespace?: string\n slug: string\n}\n\ntype WorkspaceStoreShape = {\n teamUid: string\n name: string\n workspace: InMemoryWorkspace\n}\n\n/** Generates a workspace ID from namespace and slug. */\nexport const getWorkspaceId = (namespace: string, slug: string) => `${namespace}/${slug}`\n\n/**\n * Creates the persistence layer for the workspace store using IndexedDB.\n * This sets up all the required tables for storing workspace chunk information,\n * such as workspace meta, documents, original documents, intermediate documents, overrides, etc.\n * Each logical group (meta, documents, etc) gets its own table keyed appropriately for efficient sub-document access.\n * Returns an object containing `meta`, `documents`, `originalDocuments`, `intermediateDocuments`, `overrides`,\n * `documentMeta`, `documentConfigs`, and `workspace` sections, each exposing a `setItem` method\n * for upsetting records, and in the case of `workspace`, also `getItem` and `deleteItem`.\n */\nexport const createWorkspaceStorePersistence = async () => {\n // Create the database connection and setup all required tables for workspace storage.\n const connection = await createIndexDbConnection({\n name: 'scalar-workspace-store',\n version: 1,\n tables: {\n workspace: {\n schema: Type.Object({\n /** Visual name for a given workspace */\n name: Type.String(),\n /** When logged in all new workspaces (remote and local) are scoped to a team */\n teamUid: Type.String({ default: 'local' }),\n /** Namespace associated with a remote workspace */\n namespace: Type.String({ default: 'local' }),\n /** Slug associated with a remote workspace */\n slug: Type.String({ default: 'local' }),\n }),\n keyPath: ['namespace', 'slug'],\n indexes: {\n teamUid: ['teamUid'],\n },\n },\n meta: {\n schema: Type.Object({ workspaceId: Type.String(), data: Type.Any() }),\n keyPath: ['workspaceId'],\n },\n documents: {\n schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),\n keyPath: ['workspaceId', 'documentName'],\n },\n originalDocuments: {\n schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),\n keyPath: ['workspaceId', 'documentName'],\n },\n intermediateDocuments: {\n schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),\n keyPath: ['workspaceId', 'documentName'],\n },\n overrides: {\n schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),\n keyPath: ['workspaceId', 'documentName'],\n },\n history: {\n schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),\n keyPath: ['workspaceId', 'documentName'],\n },\n auth: {\n schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),\n keyPath: ['workspaceId', 'documentName'],\n },\n },\n })\n\n // Tables wrappers for each logical section.\n const workspaceTable = connection.get('workspace')\n const metaTable = connection.get('meta')\n const documentsTable = connection.get('documents')\n const originalDocumentTable = connection.get('originalDocuments')\n const intermediateDocumentTable = connection.get('intermediateDocuments')\n const overridesTable = connection.get('overrides')\n const historyTable = connection.get('history')\n const authTable = connection.get('auth')\n\n // The returned persistence API with logical sections for each table and mapping.\n return {\n close: () => {\n connection.closeDatabase()\n },\n meta: {\n /**\n * Set meta data for a workspace.\n */\n setItem: async (workspaceId: string, data: WorkspaceMeta) => {\n await metaTable.addItem({ workspaceId }, { data })\n },\n },\n documents: {\n /**\n * Set (persist) a workspace document using workspaceId and documentName as composite key.\n */\n setItem: async (workspaceId: string, documentName: string, data: InMemoryWorkspace['documents'][string]) => {\n await documentsTable.addItem({ workspaceId, documentName }, { data })\n },\n },\n originalDocuments: {\n /**\n * Set an original (raw) document for a workspace/document pair.\n */\n setItem: async (\n workspaceId: string,\n documentName: string,\n data: InMemoryWorkspace['originalDocuments'][string],\n ) => {\n await originalDocumentTable.addItem({ workspaceId, documentName }, { data })\n },\n },\n intermediateDocuments: {\n /**\n * Set an intermediate (transformed) document for a workspace/document pair.\n */\n setItem: async (\n workspaceId: string,\n documentName: string,\n data: InMemoryWorkspace['intermediateDocuments'][string],\n ) => {\n await intermediateDocumentTable.addItem({ workspaceId, documentName }, { data })\n },\n },\n overrides: {\n /**\n * Set document overrides for a workspace/document pair.\n */\n setItem: async (workspaceId: string, documentName: string, data: InMemoryWorkspace['overrides'][string]) => {\n await overridesTable.addItem({ workspaceId, documentName }, { data })\n },\n },\n history: {\n /**\n * Set history for a document.\n */\n setItem: async (workspaceId: string, documentName: string, data: PathMethodHistory) => {\n await historyTable.addItem({ workspaceId, documentName }, { data })\n },\n },\n auth: {\n /**\n * Set auth for a document.\n */\n setItem: async (workspaceId: string, documentName: string, data: InMemoryWorkspace['auth'][string]) => {\n await authTable.addItem({ workspaceId, documentName }, { data })\n },\n },\n workspace: {\n /**\n * Retrieves a workspace by its ID.\n * Returns undefined if the workspace does not exist.\n * Gathers all workspace 'chunk' tables and assembles a full workspace shape.\n */\n getItem: async ({\n namespace,\n slug,\n }: Required<WorkspaceKey>): Promise<(WorkspaceStoreShape & Required<WorkspaceKey>) | undefined> => {\n const workspace = await workspaceTable.getItem({ namespace, slug })\n\n if (!workspace) {\n return undefined\n }\n\n // Create a composite key for the workspace chunks.\n const id = getWorkspaceId(namespace, slug)\n\n // Retrieve all chunk records for this workspace.\n const workspaceDocuments = await documentsTable.getRange([id])\n const workspaceOriginalDocuments = await originalDocumentTable.getRange([id])\n const workspaceIntermediateDocuments = await intermediateDocumentTable.getRange([id])\n const workspaceOverrides = await overridesTable.getRange([id])\n const workspaceMeta = await metaTable.getItem({ workspaceId: id })\n const workspaceHistory = await historyTable.getRange([id])\n const workspaceAuth = await authTable.getRange([id])\n\n // Compose the workspace structure from table records.\n return {\n name: workspace.name,\n teamUid: workspace.teamUid,\n namespace: workspace.namespace,\n slug: workspace.slug,\n workspace: {\n documents: Object.fromEntries(workspaceDocuments.map((item) => [item.documentName, item.data])),\n originalDocuments: Object.fromEntries(\n workspaceOriginalDocuments.map((item) => [item.documentName, item.data]),\n ),\n intermediateDocuments: Object.fromEntries(\n workspaceIntermediateDocuments.map((item) => [item.documentName, item.data]),\n ),\n overrides: Object.fromEntries(workspaceOverrides.map((item) => [item.documentName, item.data])),\n meta: workspaceMeta?.data,\n history: Object.fromEntries(workspaceHistory.map((item) => [item.documentName, item.data])),\n auth: Object.fromEntries(workspaceAuth.map((item) => [item.documentName, item.data])),\n },\n }\n },\n\n /**\n * Retrieves all workspaces from the database.\n * Returns only the workspace ID and name for each workspace.\n * To get the full workspace data including documents and metadata, use getItem() with a specific ID.\n * Returns an empty array if no workspaces exist.\n */\n getAll: async () => {\n return await workspaceTable.getAll()\n },\n\n /**\n * Retrieves all workspaces for a given team UID.\n */\n getAllByTeamUid: async (teamUid: string) => {\n return await workspaceTable.getRange([teamUid], 'teamUid')\n },\n\n /**\n * Saves a workspace to the database.\n * All chunks (meta, documents, configs, etc.) are upsert in their respective tables.\n * If a workspace with the same ID already exists, it will be replaced.\n */\n setItem: async (\n { namespace = 'local', slug }: WorkspaceKey,\n value: Omit<WorkspaceStoreShape, 'teamUid'> & Partial<Pick<WorkspaceStoreShape, 'teamUid'>>,\n ) => {\n const workspace = await workspaceTable.addItem(\n { namespace, slug },\n {\n name: value.name,\n teamUid: value.teamUid ?? 'local',\n },\n )\n const id = getWorkspaceId(namespace, slug)\n\n // Save all meta info for workspace.\n await metaTable.addItem({ workspaceId: id }, { data: value.workspace.meta })\n\n // Persist all workspace documents (chunks).\n await Promise.all(\n Object.entries(value.workspace.documents ?? {}).map(([name, data]) => {\n return documentsTable.addItem({ workspaceId: id, documentName: name }, { data })\n }),\n )\n\n // Persist all original documents.\n await Promise.all(\n Object.entries(value.workspace.originalDocuments ?? {}).map(([name, data]) => {\n return originalDocumentTable.addItem({ workspaceId: id, documentName: name }, { data })\n }),\n )\n\n // Persist all intermediate documents.\n await Promise.all(\n Object.entries(value.workspace.intermediateDocuments ?? {}).map(([name, data]) => {\n return intermediateDocumentTable.addItem({ workspaceId: id, documentName: name }, { data })\n }),\n )\n\n // Persist all document overrides.\n await Promise.all(\n Object.entries(value.workspace.overrides ?? {}).map(([name, data]) => {\n return overridesTable.addItem({ workspaceId: id, documentName: name }, { data })\n }),\n )\n\n // Persist all history.\n await Promise.all(\n Object.entries(value.workspace.history ?? {}).map(([name, data]) => {\n return historyTable.addItem({ workspaceId: id, documentName: name }, { data })\n }),\n )\n\n // Persist all auth.\n await Promise.all(\n Object.entries(value.workspace.auth ?? {}).map(([name, data]) => {\n return authTable.addItem({ workspaceId: id, documentName: name }, { data })\n }),\n )\n\n return workspace\n },\n\n /**\n * Deletes an entire workspace and all associated chunk records from all tables by ID.\n */\n deleteItem: async ({ namespace, slug }: Required<WorkspaceKey>): Promise<void> => {\n const id = getWorkspaceId(namespace, slug)\n\n await workspaceTable.deleteItem({ namespace, slug })\n\n // Remove all workspace-related records from all chunk tables.\n await Promise.all([\n // By id\n metaTable.deleteItem({ workspaceId: id }),\n\n // By range (composite-key tables)\n documentsTable.deleteRange([id]),\n originalDocumentTable.deleteRange([id]),\n intermediateDocumentTable.deleteRange([id]),\n overridesTable.deleteRange([id]),\n historyTable.deleteRange([id]),\n authTable.deleteRange([id]),\n ])\n },\n\n /**\n * Deletes a single document and all related records (overrides, history, auth, etc.)\n * for the given workspace and document name from all relevant tables.\n */\n deleteDocument: async (workspaceId: string, documentName: string): Promise<void> => {\n await Promise.all([\n documentsTable.deleteItem({ workspaceId, documentName }),\n intermediateDocumentTable.deleteItem({ workspaceId, documentName }),\n originalDocumentTable.deleteItem({ workspaceId, documentName }),\n overridesTable.deleteItem({ workspaceId, documentName }),\n historyTable.deleteItem({ workspaceId, documentName }),\n authTable.deleteItem({ workspaceId, documentName }),\n ])\n },\n\n /**\n * Updates the name of an existing workspace.\n * Returns the updated workspace object, or undefined if the workspace does not exist.\n */\n updateName: async ({ namespace, slug }: Required<WorkspaceKey>, name: string) => {\n const workspace = await workspaceTable.getItem({ namespace, slug })\n if (!workspace) {\n return undefined\n }\n\n // Update the workspace name\n return await workspaceTable.addItem({ namespace, slug }, { ...workspace, name })\n },\n\n /**\n * Checks if a workspace with the given ID exists in the store.\n */\n has: async ({ namespace, slug }: Required<WorkspaceKey>): Promise<boolean> => {\n return (await workspaceTable.getItem({ namespace, slug })) !== undefined\n },\n },\n clear: async () => {\n await workspaceTable.deleteAll()\n },\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAGrB,SAAS,+BAA+B;AAgBjC,MAAM,iBAAiB,CAAC,WAAmB,SAAiB,GAAG,SAAS,IAAI,IAAI;AAWhF,MAAM,kCAAkC,YAAY;AAEzD,QAAM,aAAa,MAAM,wBAAwB;AAAA,IAC/C,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,MACN,WAAW;AAAA,QACT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AE,aAAa,aAAa,CAAC;AAAA,UAC9D,eAAe,WAAW,EAAE,aAAa,aAAa,CAAC;AAAA,UACvD,aAAa,WAAW,EAAE,aAAa,aAAa,CAAC;AAAA,UACrD,UAAU,WAAW,EAAE,aAAa,aAAa,CAAC;AAAA,QACpD,CAAC;AAAA,MACH;AAAA;AAAA;AAAA;AAAA;AAAA,MAMA,YAAY,OAAO,EAAE,WAAW,KAAK,GAA2B,SAAiB;AAC/E,cAAM,YAAY,MAAM,eAAe,QAAQ,EAAE,WAAW,KAAK,CAAC;AAClE,YAAI,CAAC,WAAW;AACd,iBAAO;AAAA,QACT;AAGA,eAAO,MAAM,eAAe,QAAQ,EAAE,WAAW,KAAK,GAAG,EAAE,GAAG,WAAW,KAAK,CAAC;AAAA,MACjF;AAAA;AAAA;AAAA;AAAA,MAKA,KAAK,OAAO,EAAE,WAAW,KAAK,MAAgD;AAC5E,eAAQ,MAAM,eAAe,QAAQ,EAAE,WAAW,KAAK,CAAC,MAAO;AAAA,MACjE;AAAA,IACF;AAAA,IACA,OAAO,YAAY;AACjB,YAAM,eAAe,UAAU;AAAA,IACjC;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/persistence/indexdb.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Static, TObject, TRecord } from '@scalar/typebox'\n\ntype TableEntry<S extends TObject, K extends readonly (keyof Static<S>)[]> = {\n schema: S\n keyPath: K\n indexes?: Record<string, readonly (keyof Static<S>)[]>\n}\n\n/**\n * Initializes and manages an IndexedDB database connection for table-based persistence.\n *\n * @param name - The database name. Defaults to 'scalar-workspace-store'.\n * @param tables - Table definitions: the tables to create and their key schemas.\n * @param version - The database version. Bump this to trigger upgrades (default: 1).\n * @param migrations - Optional migration steps to run for version upgrades.\n * @returns An object with the following methods:\n * - `get(tableName)` \u2014 Get a wrapper to interact with the object store for the given table name.\n * - `closeDatabase()` \u2014 Closes the database connection.\n *\n * Example usage:\n * ```ts\n * import { Type } from '@scalar/typebox'\n * import { createIndexDbConnection } from './indexdb'\n *\n * // Define a schema for a user\n * const UserSchema = Type.Object({\n * id: Type.String(),\n * name: Type.String(),\n * age: Type.Number(),\n * })\n *\n * // Define tables in the database\n * const dbConfig = {\n * users: {\n * schema: UserSchema,\n * index: ['id'] as const,\n * },\n * }\n *\n * // Open the database connection and get table API\n * const { get, closeDatabase } = await createIndexDbConnection({\n * name: 'my-app-db',\n * tables: dbConfig,\n * version: 1,\n * })\n *\n * // Get a strongly-typed users table API\n * const usersTable = get('users')\n *\n * // Add a user\n * await usersTable.addItem({ id: 'user-1' }, { name: 'Alice', age: 25 })\n *\n * // Retrieve a user by id\n * const user = await usersTable.getItem({ id: 'user-1' })\n *\n * // Don't forget to close the database when done!\n * closeDatabase()\n * ```\n */\nexport const createIndexDbConnection = async <T extends Record<string, TableEntry<any, readonly (keyof any)[]>>>({\n name = 'scalar-workspace-store',\n tables,\n version = 1,\n migrations = [],\n}: {\n name: string\n tables: T\n version: number\n migrations?: { version: number; exec: (db: IDBDatabase, event: IDBVersionChangeEvent) => {} }[]\n}) => {\n const db = indexedDB.open(name, version)\n\n db.onupgradeneeded = (e) => {\n // Initial setup of object stores\n if (e.oldVersion < 1) {\n const database = db.result\n\n // Initialize all the tables\n Object.entries(tables).forEach(([name, options]) => {\n if (!database.objectStoreNames.contains(name)) {\n const objectStore = database.createObjectStore(name, {\n keyPath: options.keyPath.length === 1 ? (options.keyPath[0] as string) : (options.keyPath as string[]),\n })\n\n // Create any indexes for the object store\n Object.entries(options.indexes ?? {}).forEach(([indexName, indexPath]) => {\n objectStore.createIndex(indexName, indexPath as string[])\n })\n }\n })\n }\n\n // Run any future migrations here\n migrations.forEach((migration) => {\n if (e.oldVersion < migration.version) {\n migration.exec(db.result, e)\n }\n })\n }\n\n await new Promise((resolve, reject) => {\n db.onsuccess = () => resolve(true)\n db.onerror = () => reject(db.error)\n })\n\n return {\n get: <Name extends keyof T>(name: Name) => {\n return createTableWrapper<T[Name]['schema'], T[Name]['keyPath'][number]>(name as string, db.result)\n },\n closeDatabase: () => {\n db.result.close()\n },\n }\n}\n\n/**\n * Utility wrapper for interacting with an IndexedDB object store, typed by the schema.\n *\n * Usage example:\n * ```\n * // Define a TypeBox schema for users\n * const UserSchema = Type.Object({\n * id: Type.String(),\n * name: Type.String(),\n * age: Type.Number(),\n * })\n * \n * // Open or create the users table\n * const usersTable = createTableWrapper<typeof UserSchema, 'id'>('users', openDatabase)\n * \n * // Add a user\n await usersTable.addItem({ id: 'user-1' }, { name: 'Alice', age: 24 })\n * \n * // Get a user by id\n * const alic = await usersTable.getItem({ id: 'user-1' })\n * \n * // Get users with a partial key (use [] if no composite key)\n * const users = await usersTable.getRange(['user-1'])\n * \n * // Get all users\n * const allUsers = await usersTable.getAll()\n * ```\n *\n * @template T TypeBox schema type for objects in the store\n * @template K Key property names that compose the primary key\n *\n * @param name - Object store name\n * @param getDb - Function returning a Promise for the IDBDatabase\n * @returns Methods to interact with the object store\n */\nfunction createTableWrapper<T extends TRecord | TObject, const K extends keyof Static<T>>(\n name: string,\n db: IDBDatabase,\n) {\n /**\n * Gets the object store from the latest DB connection, for the given transaction mode.\n */\n const getStore = (mode: IDBTransactionMode): IDBObjectStore => {\n const tx = db.transaction(name, mode)\n return tx.objectStore(name)\n }\n\n /**\n * Adds or updates an item in the store.\n * @param key - The primary key values, as { key1, key2 }\n * @param value - The value for the other properties, omitting keys\n * @returns The full inserted/updated object\n */\n async function addItem(key: Record<K, IDBValidKey>, value: Omit<Static<T>, K>): Promise<Static<T>> {\n const store = getStore('readwrite')\n const finalValue = { ...value, ...key }\n await requestAsPromise(store.put(finalValue))\n\n return finalValue\n }\n\n /**\n * Retrieves a single item by composite key.\n * @param key - Key values. For a single key: { id: '...' }\n * @returns The found object or undefined\n */\n function getItem(key: Record<K, IDBValidKey>): Promise<Static<T> | undefined> {\n const store = getStore('readonly')\n const keyValues = Object.values(key)\n // For single keys, pass value directly; for compound keys, pass array\n const keyToUse = keyValues.length === 1 ? keyValues[0] : keyValues\n return requestAsPromise(store.get(keyToUse as IDBValidKey))\n }\n\n /**\n * Returns all records matching a partial (prefix) key. Use for composite keys.\n * For non-compound keys, pass single-element array: getRange(['some-id'])\n * For prefix search, pass subset of key parts.\n * @param partialKey - Array of partial key values\n * @returns Matching objects\n *\n * Example (composite [a,b]):\n * getRange(['foo']) // All with a === 'foo'\n * getRange(['foo', 'bar']) // All with a === 'foo' and b === 'bar'\n */\n function getRange(partialKey: IDBValidKey[], indexName?: string): Promise<Static<T>[]> {\n const store = getStore('readonly')\n const objectStoreOrIndex = indexName ? store.index(indexName as string) : store\n\n const results: Static<T>[] = []\n\n // Construct upper bound to match all keys starting with partialKey\n const upperBound = [...partialKey]\n upperBound.push([]) // ensures upper bound includes all keys with this prefix\n const range = IDBKeyRange.bound(partialKey, upperBound, false, true)\n\n return new Promise((resolve, reject) => {\n const request = objectStoreOrIndex.openCursor(range)\n request.onerror = () => reject(request.error)\n request.onsuccess = (event) => {\n const cursor = (event.target as IDBRequest<IDBCursorWithValue>).result\n if (cursor) {\n results.push(cursor.value)\n cursor.continue()\n } else {\n resolve(results)\n }\n }\n })\n }\n\n /**\n * Deletes an item from the store by its composite key.\n * @param key - Key values. For a single key: { id: '...' }\n * @returns void\n */\n async function deleteItem(key: Record<K, IDBValidKey>): Promise<void> {\n const store = getStore('readwrite')\n const keyValues = Object.values(key)\n // For single keys, pass value directly; for compound keys, pass array\n const keyToUse = keyValues.length === 1 ? keyValues[0] : keyValues\n await requestAsPromise(store.delete(keyToUse as IDBValidKey))\n }\n\n /**\n * Deletes all records matching a partial (prefix) key. Use for composite keys.\n * For non-compound keys, pass single-element array: deleteRange(['some-id'])\n * For prefix deletion, pass subset of key parts.\n * @param partialKey - Array of partial key values\n * @returns Number of deleted items\n *\n * Example (composite [a,b]):\n * deleteRange(['foo']) // Delete all with a === 'foo'\n * deleteRange(['foo', 'bar']) // Delete all with a === 'foo' and b === 'bar'\n */\n function deleteRange(partialKey: IDBValidKey[]): Promise<number> {\n const store = getStore('readwrite')\n let deletedCount = 0\n\n // Construct upper bound to match all keys starting with partialKey\n const upperBound = [...partialKey]\n upperBound.push([]) // ensures upper bound includes all keys with this prefix\n const range = IDBKeyRange.bound(partialKey, upperBound, false, true)\n\n return new Promise((resolve, reject) => {\n const request = store.openCursor(range)\n request.onerror = () => reject(request.error)\n request.onsuccess = (event) => {\n const cursor = (event.target as IDBRequest<IDBCursorWithValue>).result\n if (cursor) {\n cursor.delete()\n deletedCount++\n cursor.continue()\n } else {\n resolve(deletedCount)\n }\n }\n })\n }\n\n /**\n * Deletes all items from the table.\n * @returns void\n */\n async function deleteAll(): Promise<void> {\n const store = getStore('readwrite')\n await requestAsPromise(store.clear())\n }\n\n /**\n * Retrieves all items from the table.\n * @returns Array of all objects in the store\n */\n function getAll(): Promise<Static<T>[]> {\n const store = getStore('readonly')\n return requestAsPromise(store.getAll())\n }\n\n return {\n addItem,\n getItem,\n getRange,\n deleteItem,\n deleteRange,\n getAll,\n deleteAll,\n }\n}\n\n// ---- Utility ----\nfunction requestAsPromise<T>(req: IDBRequest<T>): Promise<T> {\n return new Promise((resolve, reject) => {\n req.onsuccess = () => resolve(req.result)\n req.onerror = () => reject(req.error)\n })\n}\n"],
|
|
5
|
-
"mappings": "AA2DO,MAAM,0BAA0B,OAA0E;AAAA,EAC/G,OAAO;AAAA,EACP;AAAA,EACA,UAAU;AAAA,EACV,aAAa,CAAC;AAChB,MAKM;AACJ,QAAM,KAAK,UAAU,KAAK,MAAM,OAAO;AAEvC,KAAG,kBAAkB,CAAC,MAAM;AAE1B,QAAI,EAAE,aAAa,GAAG;AACpB,YAAM,WAAW,GAAG;AAGpB,aAAO,QAAQ,MAAM,EAAE,QAAQ,CAAC,CAACA,OAAM,OAAO,MAAM;AAClD,YAAI,CAAC,SAAS,iBAAiB,SAASA,KAAI,GAAG;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C5C,cAAQ,YAAY,CAAC,UAAU;AAC7B,cAAM,SAAU,MAAM,OAA0C;AAChE,YAAI,QAAQ;AACV,iBAAO,OAAO;AACd;AACA,iBAAO,SAAS;AAAA,QAClB,OAAO;AACL,kBAAQ,YAAY;AAAA,QACtB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAMA,iBAAe,YAA2B;AACxC,UAAM,QAAQ,SAAS,WAAW;AAClC,UAAM,iBAAiB,MAAM,MAAM,CAAC;AAAA,EACtC;AAMA,WAAS,SAA+B;AACtC,UAAM,QAAQ,SAAS,UAAU;AACjC,WAAO,iBAAiB,MAAM,OAAO,CAAC;AAAA,EACxC;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAGA,SAAS,iBAAoB,KAAgC;AAC3D,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,QAAI,YAAY,MAAM,QAAQ,IAAI,MAAM;AACxC,QAAI,UAAU,MAAM,OAAO,IAAI,KAAK;AAAA,EACtC,CAAC;AACH;",
|
|
6
|
-
"names": ["name"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/bundler/helpers.ts"],
|
|
4
|
-
"sourcesContent": ["import { getValueAtPath } from '@scalar/helpers/object/get-value-at-path'\nimport { getSegmentsFromPath } from '@scalar/json-magic/helpers/get-segments-from-path'\n\nimport type { UnknownObject } from '@/helpers/general'\n\n/**\n * Recursively resolves the value behind a $ref pointer within the current document tree.\n * For example, given a node with { $ref: '#/some/path' }, this will locate and return\n * the referenced node, following the $ref chain if necessary.\n *\n * @param node - The node that may be a $ref object. If not, returns the node as is.\n * @returns The resolved node if a $ref chain exists, otherwise the original node.\n */\nexport const getResolvedRef = (node: unknown, context: { rootNode: UnknownObject }): unknown => {\n if (\n node &&\n typeof node === 'object' &&\n '$ref' in node &&\n typeof node['$ref'] === 'string' &&\n node['$ref'].startsWith('#')\n ) {\n const segments = getSegmentsFromPath(node['$ref'].slice(1))\n return getResolvedRef(getValueAtPath(context.rootNode, segments), context)\n }\n // If this node isn't a $ref, return it as the resolved value\n return node\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AAY7B,MAAM,iBAAiB,CAAC,MAAe,YAAkD;AAC9F,MACE,QACA,OAAO,SAAS,YAChB,UAAU,QACV,OAAO,KAAK,MAAM,MAAM,YACxB,KAAK,MAAM,EAAE,WAAW,GAAG,GAC3B;AACA,UAAM,WAAW,oBAAoB,KAAK,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1D,WAAO,eAAe,eAAe,QAAQ,UAAU,QAAQ,GAAG,OAAO;AAAA,EAC3E;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/bundler/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * This file contains a collection of plugins used for the bundler.\n * Plugins defined here can extend or modify the behavior of the bundling process,\n * such as adding lifecycle hooks or custom processing logic.\n */\n\nimport { HTTP_METHODS } from '@scalar/helpers/http/http-methods'\nimport { isObject } from '@scalar/helpers/object/is-object'\nimport type { LifecyclePlugin } from '@scalar/json-magic/bundle'\n\nimport { isLocalRef } from '@/helpers/general'\nimport {\n type MinimalParameterObject,\n syncParametersForPathChange,\n} from '@/mutators/operation/helpers/sync-path-parameters'\nimport { getResolvedRef } from '@/plugins/bundler/helpers'\n\n/**\n * A lifecycle plugin that adds a `$status` property to nodes during resolution.\n * - Sets `$status` to 'loading' when resolution starts.\n * - Sets `$status` to 'error' if resolution fails.\n * - Removes `$status` when resolution succeeds.\n */\nexport const loadingStatus = (): LifecyclePlugin => {\n return {\n type: 'lifecycle',\n onResolveStart: (node) => {\n node['$status'] = 'loading'\n },\n onResolveError: (node) => {\n node['$status'] = 'error'\n },\n onResolveSuccess: (node) => {\n delete node['$status']\n },\n }\n}\n\n/**\n * Lifecycle plugin to resolve and embed external content referenced by an 'externalValue' property in a node.\n *\n * When a node contains an 'externalValue' property (as a string), this plugin will:\n * - Fetch the external resource (such as a URL or file) using the fetchUrls plugin.\n * - If the fetch is successful, assign the fetched data to the node's 'value' property.\n *\n * This is useful for inlining external content (like examples or schemas) into the OpenAPI document during bundling.\n *\n * @param node - The node being processed, which may contain an 'externalValue' property.\n */\nexport const externalValueResolver = (): LifecyclePlugin => {\n return {\n type: 'lifecycle',\n onAfterNodeProcess: async (node, context) => {\n const externalValue = node['externalValue']\n const cache = context.resolutionCache\n\n // Only process if 'externalValue' is a string\n if (typeof externalValue !== 'string') {\n return\n }\n\n const loader = context.loaders.find((it) => it.validate(externalValue))\n\n // We can not process the external value\n if (!loader) {\n return\n }\n\n if (!cache.has(externalValue)) {\n cache.set(externalValue, loader.exec(externalValue))\n }\n\n const result = await cache.get(externalValue)\n\n // If fetch is successful, assign the data to the node's 'value' property\n if (result?.ok) {\n node['value'] = result.data\n }\n },\n }\n}\n\n/**\n * Lifecycle plugin to resolve $ref on any object, including non-standard locations like the info object.\n *\n * This plugin will:\n * - Detect if a node contains a $ref property (as a string).\n * - If the node is under the 'info' path, attempt to resolve the reference using fetchUrls.\n * - Replace the node's properties with the resolved data if successful.\n *\n * Note: This currently only supports refs on the 'info' object and does not handle primitive types.\n */\nexport const refsEverywhere = (): LifecyclePlugin => {\n return {\n type: 'lifecycle',\n onBeforeNodeProcess: async (node, context) => {\n const { path, resolutionCache, parentNode } = context\n const ref = node['$ref']\n\n // Only process nodes that have a $ref property as a string\n if (typeof ref !== 'string') {\n return\n }\n\n // Can not resolve top level refs\n if (!parentNode || !path.length) {\n return\n }\n\n const loader = context.loaders.find((it) => it.validate(ref))\n\n // Can not load the external ref\n if (!loader) {\n return\n }\n\n // Support resolving $ref on the info object\n if (path[0] === 'info') {\n // Use the cache to avoid duplicate fetches\n if (!resolutionCache.has(ref)) {\n resolutionCache.set(ref, loader.exec(ref))\n }\n\n const result = await resolutionCache.get(ref)\n\n if (result?.ok) {\n // Replace the ref with the resolved data\n parentNode[path.at(-1)!] = result.data\n }\n }\n },\n }\n}\n\n/**\n * Lifecycle plugin to restore original $ref values after processing.\n *\n * This plugin is intended to be used as a \"lifecycle\" plugin in the bundling process.\n * It operates in the `onAfterNodeProcess` hook, and its main purpose is to restore\n * the original $ref values for external references that may have been replaced or\n * rewritten during the bundling process.\n *\n * How it works:\n * - For each node processed, if the node contains a $ref property (as a string),\n * and the root document contains an \"x-ext-urls\" mapping object,\n * the plugin will attempt to restore the original $ref value.\n * - The \"x-ext-urls\" object is expected to be a mapping from the rewritten $ref\n * (e.g., a hashed or compressed reference) back to the original external URL or path.\n * - If a mapping exists for the current $ref, the plugin replaces the $ref value\n * with the original value from the mapping. If no mapping exists (e.g., for local refs),\n * the $ref value is left unchanged.\n *\n * This is useful for scenarios where you want to present or export the bundled document\n * with the original external $ref values, rather than the internal or rewritten ones.\n *\n * @returns {LifecyclePlugin} The plugin object for use in the bundler.\n */\nexport const restoreOriginalRefs = (): LifecyclePlugin => {\n return {\n type: 'lifecycle',\n onBeforeNodeProcess: (node, context) => {\n const ref = node['$ref']\n const root = context.rootNode\n const extUrls = root['x-ext-urls']\n\n // Only process if $ref is a string and x-ext-urls is a valid object\n if (typeof ref !== 'string' || typeof extUrls !== 'object' || extUrls === null || !isLocalRef(ref)) {\n return\n }\n\n // Working with local refs\n\n const segments = ref.split('/')\n const key = segments.at(-1) ?? ''\n\n // Replace the $ref with the original version from the mapping,\n // or keep the current version if there is no mapping (e.g., for local refs)\n node['$ref'] = (extUrls as Record<string, string>)[key] ?? ref\n },\n }\n}\n\n/**\n * Lifecycle plugin to normalize the `scheme` property in securitySchemes to lowercase.\n *\n * Our typebox schemas require the `scheme` property to be a lowercase string.\n * This plugin ensures that any `scheme` field under `components.securitySchemes` is normalized to lowercase, fixing\n * potential user input errors such as \"Bearer\" or \"BASIC\".\n *\n * Example:\n * ```yaml\n * Before normalization:\n * components:\n * securitySchemes:\n * bearerAuth:\n * type: http\n * scheme: Bearer\n * ```\n * After normalization:\n * ```yaml\n * components:\n * securitySchemes:\n * bearerAuth:\n * type: http\n * scheme: bearer\n * ```\n */\nexport const normalizeAuthSchemes = (): LifecyclePlugin => {\n return {\n type: 'lifecycle',\n onAfterNodeProcess: (node, context) => {\n const { path } = context\n\n // Check if we're at components.securitySchemes.{schemeName}\n if (path.length === 3 && path[0] === 'components' && path[1] === 'securitySchemes') {\n const targetNode = getResolvedRef(node, context)\n\n // If the scheme exists and is a string, normalize to lowercase if not already\n if (\n typeof targetNode === 'object' &&\n targetNode !== null &&\n 'scheme' in targetNode &&\n typeof targetNode['scheme'] === 'string' &&\n targetNode['scheme'].toLowerCase() !== targetNode['scheme']\n ) {\n targetNode['scheme'] = targetNode['scheme'].toLowerCase()\n }\n }\n },\n }\n}\n\n/**\n * Lifecycle plugin to normalize $ref nodes:\n * Ensures that for any non-schema object containing a $ref, only $ref,\n * summary, description, and $status properties are preserved.\n * This keeps $ref references clean and predictable for downstream consumers.\n */\nexport const normalizeRefs = (): LifecyclePlugin => {\n return {\n type: 'lifecycle',\n onBeforeNodeProcess: (node, context) => {\n const { path } = context\n\n // If the node is a $ref and we are not on the schema object, we need to normalize the $ref\n if (typeof node['$ref'] === 'string' && !(path[0] === 'components' && path[1] === 'schemas')) {\n // Remove any other properties from the node and only keep the '$ref', 'summary', 'description' and '$status'\n const keepProperties = new Set(['$ref', 'summary', 'description', '$status'])\n\n Object.keys(node).forEach((key) => {\n if (!keepProperties.has(key)) {\n delete node[key]\n }\n })\n }\n },\n }\n}\n\n/**\n * Lifecycle plugin to sync path parameters for all operations under a path item.\n *\n * When processing a path item (e.g., '/users/{id}'), this plugin will:\n * - Extract path variables from the path string\n * - For each HTTP method operation (get, post, put, delete, etc.)\n * - Sync the operation's parameters to match the path variables\n * - Preserve existing parameter configurations when possible\n *\n * This ensures that path parameters are always in sync with the path string,\n * even after bundling or other transformations.\n */\nexport const syncPathParameters = (): LifecyclePlugin => {\n return {\n type: 'lifecycle',\n onBeforeNodeProcess: (node, context) => {\n const { path } = context\n\n // Only process path items (e.g., paths -> /users/{id} -> operations)\n if (path.length !== 2 || path[0] !== 'paths' || typeof path[1] !== 'string') {\n return\n }\n\n const pathString = path[1]\n\n // Sync parameters for each operation method\n for (const method of HTTP_METHODS) {\n const operation = getResolvedRef(node[method], context)\n\n if (!isObject(operation)) {\n continue\n }\n\n const isParameterNode = (param: unknown): param is MinimalParameterObject => {\n const resolved = getResolvedRef(param, context)\n\n return (\n isObject(resolved) &&\n 'name' in resolved &&\n typeof resolved.name === 'string' &&\n 'in' in resolved &&\n typeof resolved.in === 'string'\n )\n }\n\n const isPathParameterNode = (param: unknown): param is MinimalParameterObject => {\n const resolved = getResolvedRef(param, context)\n return isParameterNode(resolved) && resolved.in === 'path'\n }\n\n const existingParameters = (\n 'parameters' in operation && Array.isArray(operation.parameters) ? operation.parameters : []\n ).filter(isParameterNode)\n\n const existingPathParameters = new Set<string>(\n existingParameters\n .map((param) => getResolvedRef(param, context))\n .filter(isPathParameterNode)\n .map((param) => param.name),\n )\n\n // Include path-item level path parameters as fallbacks for any that the operation does not declare.\n // Without this, syncParametersForPathChange would create bare `{ name, in: 'path' }` params,\n // losing description, schema, required, etc. from the path-item definition.\n const pathItemParameters = 'parameters' in node && Array.isArray(node.parameters) ? node.parameters : []\n\n const pathItemPathParameters = pathItemParameters.filter((param): param is MinimalParameterObject => {\n const resolved = getResolvedRef(param, context)\n\n if (!isPathParameterNode(resolved)) {\n return false\n }\n\n const result = !existingPathParameters.has(resolved.name)\n\n if (result) {\n existingPathParameters.add(resolved.name)\n }\n\n return result\n })\n\n const result = syncParametersForPathChange(\n pathString,\n pathString,\n [...existingParameters, ...pathItemPathParameters],\n (node) => getResolvedRef(node, context) as MinimalParameterObject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,OAAO;AAAA,QAE3B;AAEA,cAAM,sBAAsB,CAAC,UAAoD;AAC/E,gBAAM,WAAW,eAAe,OAAO,OAAO;AAC9C,iBAAO,gBAAgB,QAAQ,KAAK,SAAS,OAAO;AAAA,QACtD;AAEA,cAAM,sBACJ,gBAAgB,aAAa,MAAM,QAAQ,UAAU,UAAU,IAAI,UAAU,aAAa,CAAC,GAC3F,OAAO,eAAe;AAExB,cAAM,yBAAyB,IAAI;AAAA,UACjC,mBACG,IAAI,CAAC,UAAU,eAAe,OAAO,OAAO,CAAC,EAC7C,OAAO,mBAAmB,EAC1B,IAAI,CAAC,UAAU,MAAM,IAAI;AAAA,QAC9B;AAKA,cAAM,qBAAqB,gBAAgB,QAAQ,MAAM,QAAQ,KAAK,UAAU,IAAI,KAAK,aAAa,CAAC;AAEvG,cAAM,yBAAyB,mBAAmB,OAAO,CAAC,UAA2C;AACnG,gBAAM,WAAW,eAAe,OAAO,OAAO;AAE9C,cAAI,CAAC,oBAAoB,QAAQ,GAAG;AAClC,mBAAO;AAAA,UACT;AAEA,gBAAMA,UAAS,CAAC,uBAAuB,IAAI,SAAS,IAAI;AAExD,cAAIA,SAAQ;AACV,mCAAuB,IAAI,SAAS,IAAI;AAAA,UAC1C;AAEA,iBAAOA;AAAA,QACT,CAAC;AAED,cAAM,SAAS;AAAA,UACb;AAAA,UACA;AAAA,UACA,CAAC,GAAG,oBAAoB,GAAG,sBAAsB;AAAA,UACjD,CAACC,UAAS,eAAeA,OAAM,OAAO;AAAA,QACxC;AACA,YAAI,OAAO,SAAS,GAAG;AACrB,oBAAU,aAAa;AAAA,QACzB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
-
"names": ["result", "node"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/client/persistence.ts"],
|
|
4
|
-
"sourcesContent": ["import { debounce } from '@scalar/helpers/general/debounce'\n\nimport { createWorkspaceStorePersistence } from '@/persistence'\nimport type { WorkspacePlugin } from '@/workspace-plugin'\n\nconst pendingFlushes = new Set<() => void>()\n// Flag to ensure lifecycle event listeners are only initialized once\nlet persistenceLifecycleListenersInitialized = false\n\n/**\n * Runs (calls) all pending flush functions.\n */\nconst runPendingFlushes = (): void => {\n for (const flush of pendingFlushes) {\n flush() // Call the flush function\n }\n}\n\n/**\n * Adds event listeners to ensure flushing on important lifecycle events\n * (like navigation away or page hide). Ensures they're registered only once.\n */\nconst initializePersistenceLifecycleListeners = (): void => {\n // Avoid adding listeners multiple times or during SSR/non-browser environments\n if (persistenceLifecycleListenersInitialized || typeof window === 'undefined' || typeof document === 'undefined') {\n return\n }\n\n persistenceLifecycleListenersInitialized = true\n // Trigger flush on pagehide (browser is unloading or navigating away)\n window.addEventListener('pagehide', runPendingFlushes)\n // Also trigger flush on beforeunload as a fallback\n window.addEventListener('beforeunload', runPendingFlushes)\n // For SPAs: trigger flush when the page goes hidden (such as switching tabs)\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'hidden') {\n runPendingFlushes()\n }\n })\n}\n\n/**\n * Plugin to persist workspace state changes with debounced writes.\n * Each type of change (meta, documentConfigs, documents, etc.) is debounced by key (type + workspaceId + optional documentName).\n * The debounce delay can be customized, defaults to 500ms.\n *\n * This avoids excessive writes to IndexedDB or other persistence layer when changes occur rapidly.\n */\nexport const persistencePlugin = async ({\n workspaceId,\n debounceDelay = 500,\n /** Maximum time in milliseconds to wait before forcing execution, even with continuous calls. */\n maxWait = 10000,\n}: {\n workspaceId: string\n debounceDelay?: number\n maxWait?: number\n}): Promise<WorkspacePlugin> => {\n // Create the persistence instance (e.g., IndexedDB, localForage, etc.)\n const persistence = await createWorkspaceStorePersistence()\n // Debounced execute function for batching similar state changes\n const { execute, flushAll } = debounce({ delay: debounceDelay, maxWait })\n\n pendingFlushes.add(flushAll)\n initializePersistenceLifecycleListeners()\n\n const dispose = (): void => {\n // Flush any pending writes and clear timers before removing from the set.\n // Otherwise pending data can be lost if the workspace is torn down and a\n // lifecycle event (e.g. pagehide) never fires or fires after the callback was removed.\n flushAll()\n pendingFlushes.delete(flushAll)\n }\n\n return {\n dispose,\n hooks: {\n /**\n * Handles all workspace state change events.\n * Each write is debounced by a composite key to prevent frequent writes for the same entity.\n */\n onWorkspaceStateChanges(event) {\n // If the event is for workspace meta data, debounce by workspaceId\n if (event.type === 'meta') {\n return execute(`meta-${workspaceId}`, () => persistence.meta.setItem(workspaceId, event.value))\n }\n\n // Debounce per document content and workspace\n if (event.type === 'documents') {\n return execute(`documents-${workspaceId}-${event.documentName}`, () =>\n persistence.documents.setItem(workspaceId, event.documentName, event.value),\n )\n }\n\n // Debounce per intermediate document and workspace\n if (event.type === 'intermediateDocuments') {\n return execute(`intermediateDocuments-${workspaceId}-${event.documentName}`, () =>\n persistence.intermediateDocuments.setItem(workspaceId, event.documentName, event.value),\n )\n }\n\n // Debounce per original document and workspace\n if (event.type === 'originalDocuments') {\n return execute(`originalDocuments-${workspaceId}-${event.documentName}`, () =>\n persistence.originalDocuments.setItem(workspaceId, event.documentName, event.value),\n )\n }\n\n // Debounce per document override and workspace\n if (event.type === 'overrides') {\n return execute(`overrides-${workspaceId}-${event.documentName}`, () =>\n persistence.overrides.setItem(workspaceId, event.documentName, event.value),\n )\n }\n\n // Debounce per document history and workspace\n if (event.type === 'history') {\n return execute(`history-${workspaceId}-${event.documentName}`, () =>\n persistence.history.setItem(workspaceId, event.documentName, event.value),\n )\n }\n\n // Debounce per document auth and workspace\n if (event.type === 'auth') {\n return execute(`auth-${workspaceId}-${event.documentName}`, () =>\n persistence.auth.setItem(workspaceId, event.documentName, event.value),\n )\n }\n\n // Delete document\n if (event.type === 'deleteDocument') {\n return execute(`deleteDocument-${workspaceId}-${event.documentName}`, () =>\n persistence.workspace.deleteDocument(workspaceId, event.documentName),\n )\n }\n\n // No action for other event types\n return\n },\n },\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,S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["../src/resolve.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nimport { type RefNode, getResolvedRef } from '@/helpers/get-resolved-ref'\nimport { compose } from '@/schemas/compose'\nimport { coerceValue } from '@/schemas/typebox-coerce'\nimport { SchemaObjectSchema } from '@/schemas/v3.1/strict/openapi-document'\nimport type { MaybeRefSchemaObject, SchemaObject } from '@/schemas/v3.1/strict/schema'\n\nconst mergeSiblingReferences = <Node>(node: RefNode<Node>) => {\n const { '$ref-value': value, ...rest } = node\n return {\n ...value,\n ...rest,\n }\n}\n\ntype ResolvedSchema<T> = T extends undefined ? undefined : SchemaObject & { $ref?: string }\n\nexport const resolve = {\n schema: <T extends MaybeRefSchemaObject | undefined>(schema: T): ResolvedSchema<T> => {\n if (schema === undefined) {\n return undefined as ResolvedSchema<T>\n }\n\n const resoled = getResolvedRef(schema, mergeSiblingReferences)\n return coerceValue(\n compose(SchemaObjectSchema, Type.Object({ $ref: Type.Optional(Type.String()) })),\n resoled,\n ) as ResolvedSchema<T>\n },\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAErB,SAAuB,sBAAsB;AAC7C,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AAGnC,MAAM,yBAAyB,CAAO,SAAwB;AAC5D,QAAM,EAAE,cAAc,OAAO,GAAG,KAAK,IAAI;AACzC,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAIO,MAAM,UAAU;AAAA,EACrB,QAAQ,CAA6C,WAAiC;AACpF,QAAI,WAAW,QAAW;AACxB,aAAO;AAAA,IACT;AAEA,UAAM,UAAU,eAAe,QAAQ,sBAAsB;AAC7D,WAAO;AAAA,MACL,QAAQ,oBAAoB,KAAK,OAAO,EAAE,MAAM,KAAK,SAAS,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC;AAAA,MAC/E;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/schemas/compose.ts"],
|
|
4
|
-
"sourcesContent": ["import { type TSchema, Type } from '@scalar/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,SAAuB,YAAY;AAK5B,MAAM,UAAU,IAAyB,SAAY;AAC1D,SAAO,KAAK,UAAU,IAAI;AAC5B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/document/x-internal.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XInternalSchema = Type.Object({\n 'x-internal': Type.Optional(Type.Boolean()),\n})\n\nexport type XInternal = {\n /** Extension to mark an entity as internal */\n 'x-internal'?: boolean\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,kBAAkB,KAAK,OAAO;AAAA,EACzC,cAAc,KAAK,SAAS,KAAK,QAAQ,CAAC;AAC5C,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/document/x-scalar-environments.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const xScalarEnvVarSchema = Type.Object({\n name: Type.String(),\n value: Type.Union([\n Type.Object({\n description: Type.Optional(Type.String()),\n default: Type.String({ default: '' }),\n }),\n Type.String(),\n ]),\n})\n\n/** A scalar environment variable */\nexport type XScalarEnvVar = {\n name: string\n value:\n | {\n description?: string\n default: string\n }\n | string\n}\n\nexport const xScalarEnvironmentSchema = Type.Object({\n description: Type.Optional(Type.String()),\n color: Type.String({ default: '#FFFFFF' }),\n variables: Type.Array(xScalarEnvVarSchema),\n})\n\n/** An environment definition */\nexport type XScalarEnvironment = {\n /** Optional description for the environment */\n description?: string\n /** Color for the environment */\n color: string\n /** An array of variables */\n variables: XScalarEnvVar[]\n}\n\nexport const xScalarEnvironmentsSchema = Type.Object({\n 'x-scalar-environments': Type.Optional(Type.Record(Type.String(), xScalarEnvironmentSchema)),\n})\n\nexport type XScalarEnvironments = {\n /** A record of environments by name */\n 'x-scalar-environments'?: Record<string, XScalarEnvironment>\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,sBAAsB,KAAK,OAAO;AAAA,EAC7C,MAAM,KAAK,OAAO;AAAA,EAClB,OAAO,KAAK,MAAM;AAAA,IAChB,KAAK,OAAO;AAAA,MACV,aAAa,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,MACxC,SAAS,KAAK,OAAO,EAAE,SAAS,GAAG,CAAC;AAAA,IACtC,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,EACd,CAAC;AACH,CAAC;AAaM,MAAM,2BAA2B,KAAK,OAAO;AAAA,EAClD,aAAa,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EACxC,OAAO,KAAK,OAAO,EAAE,SAAS,UAAU,CAAC;AAAA,EACzC,WAAW,KAAK,MAAM,mBAAmB;AAC3C,CAAC;AAYM,MAAM,4BAA4B,KAAK,OAAO;AAAA,EACnD,yBAAyB,KAAK,SAAS,KAAK,OAAO,KAAK,OAAO,GAAG,wBAAwB,CAAC;AAC7F,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/document/x-scalar-icon.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XScalarIconSchema = Type.Object({\n 'x-scalar-icon': Type.Optional(Type.String()),\n})\n\nexport type XScalarIcon = {\n /** A custom icon representing the collection */\n 'x-scalar-icon'?: string\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,oBAAoB,KAAK,OAAO;AAAA,EAC3C,iBAAiB,KAAK,SAAS,KAAK,OAAO,CAAC;AAC9C,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/document/x-scalar-ignore.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XScalarIgnoreSchema = Type.Object({\n 'x-scalar-ignore': Type.Optional(Type.Boolean()),\n})\n\nexport type XScalarIgnore = {\n /** Interal extension to mark an entity as ignored */\n 'x-scalar-ignore'?: boolean\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,sBAAsB,KAAK,OAAO;AAAA,EAC7C,mBAAmB,KAAK,SAAS,KAAK,QAAQ,CAAC;AACjD,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/document/x-scalar-is-dirty.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * Schema for the \"x-scalar-is-dirty\" OpenAPI extension.\n * This extension allows specifying an optional boolean value,\n * which can be used to track if the document state is dirty.\n *\n * This is used to track if the document has been modified since it was last saved.\n *\n * @example\n * ```yaml\n * x-scalar-is-dirty: true\n * ```\n *\n * @example\n * ```yaml\n * x-scalar-is-dirty: false\n * ```\n */\nexport const XScalarIsDirtySchema = Type.Object({\n /** Whether the document state is dirty, this is used to track if the document has been modified since it was last saved */\n 'x-scalar-is-dirty': Type.Optional(Type.Boolean()),\n})\n\n/**\n * Schema for the \"x-scalar-is-dirty\" OpenAPI extension.\n * This extension allows specifying an optional boolean value,\n * which can be used to track if the document state is dirty.\n *\n * This is used to track if the document has been modified since it was last saved.\n *\n * @example\n * ```yaml\n * x-scalar-is-dirty: true\n * ```\n *\n * @example\n * ```yaml\n * x-scalar-is-dirty: false\n * ```\n */\nexport type XScalarIsDirty = {\n /** Whether the document state is dirty, this is used to track if the document has been modified since it was last saved */\n 'x-scalar-is-dirty'?: boolean\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAmBd,MAAM,uBAAuB,KAAK,OAAO;AAAA;AAAA,EAE9C,qBAAqB,KAAK,SAAS,KAAK,QAAQ,CAAC;AACnD,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/document/x-scalar-original-document-hash.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n/**\n * Schema for the \"x-scalar-original-document-hash\" OpenAPI extension.\n * This extension allows specifying an optional string value,\n * which can be used to track the original document hash.\n *\n * This is used to track the original document hash when loading a document from an external source.\n * Which can be helpful to track if the document has been modified since it was last saved.\n *\n * @example\n * ```yaml\n * x-scalar-original-document-hash: \"1234567890\"\n * ```\n */\nexport const XScalarOriginalDocumentHashSchema = Type.Object({\n /** Original input document hash */\n 'x-scalar-original-document-hash': Type.String(),\n})\n\nexport type XScalarOriginalDocumentHash = {\n /** Original input document hash */\n 'x-scalar-original-document-hash': string\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAcd,MAAM,oCAAoC,KAAK,OAAO;AAAA;AAAA,EAE3D,mCAAmC,KAAK,OAAO;AACjD,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/document/x-scalar-registry-meta.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XScalarRegistryMetaSchema = Type.Object({\n /**\n * The registry meta for the document.\n */\n 'x-scalar-registry-meta': Type.Optional(\n Type.Object({\n /**\n * The namespace under which this registry meta is scoped.\n */\n 'namespace': Type.String(),\n /**\n * A unique slug identifier for this registry meta within the namespace.\n */\n 'slug': Type.String(),\n }),\n ),\n})\n\nexport type XScalarRegistryMeta = {\n /**\n * The registry meta for the document.\n */\n 'x-scalar-registry-meta'?: {\n /**\n * The namespace under which this registry meta is scoped.\n */\n namespace: string\n /**\n * A unique slug identifier for this registry meta within the namespace.\n */\n slug: string\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,4BAA4B,KAAK,OAAO;AAAA;AAAA;AAAA;AAAA,EAInD,0BAA0B,KAAK;AAAA,IAC7B,KAAK,OAAO;AAAA;AAAA;AAAA;AAAA,MAIV,aAAa,KAAK,OAAO;AAAA;AAAA;AAAA;AAAA,MAIzB,QAAQ,KAAK,OAAO;AAAA,IACtB,CAAC;AAAA,EACH;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/document/x-scalar-sdk-installation.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XScalarSdkInstallationSchema = Type.Object({\n 'x-scalar-sdk-installation': Type.Optional(\n Type.Array(\n Type.Object({\n lang: Type.String(),\n source: Type.Optional(Type.String()),\n description: Type.Optional(Type.String()),\n }),\n ),\n ),\n})\n\nexport type XScalarSdkInstallation = {\n /** Scalar SDK installation information. */\n 'x-scalar-sdk-installation'?: {\n lang: string\n source?: string\n description?: string\n }[]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,+BAA+B,KAAK,OAAO;AAAA,EACtD,6BAA6B,KAAK;AAAA,IAChC,KAAK;AAAA,MACH,KAAK,OAAO;AAAA,QACV,MAAM,KAAK,OAAO;AAAA,QAClB,QAAQ,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,QACnC,aAAa,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,MAC1C,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/document/x-scalar-watch-mode.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XScalarWatchModeSchema = Type.Object({\n /** Whether the document is in watch mode */\n 'x-scalar-watch-mode': Type.Optional(Type.Boolean()),\n})\n\nexport type XScalarWatchMode = {\n /** Whether the document is in watch mode */\n 'x-scalar-watch-mode'?: boolean\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,yBAAyB,KAAK,OAAO;AAAA;AAAA,EAEhD,uBAAuB,KAAK,SAAS,KAAK,QAAQ,CAAC;AACrD,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/document/x-tags.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XTags = Type.Object({\n 'x-tags': Type.Optional(Type.Array(Type.String())),\n})\n\nexport type XTags = {\n 'x-tags'?: string[]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,QAAQ,KAAK,OAAO;AAAA,EAC/B,UAAU,KAAK,SAAS,KAAK,MAAM,KAAK,OAAO,CAAC,CAAC;AACnD,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/example/x-disabled.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * OpenAPI extension to control whether a parameter example is enabled (checkbox on) or disabled (checkbox off).\n *\n * This extension is typically used in API tools to determine if a parameter (such as a header, query, or cookie)\n * should be included in the request when sending an example. If `x-disabled: true`, the parameter example is considered\n * \"off\" (checkbox unchecked) and will not be sent with the request. If `x-disabled: false` or omitted, the parameter\n * example is \"on\" (checkbox checked) and will be sent.\n *\n * @example\n * ```yaml\n * x-disabled: true # Do not send this parameter example in the request\n * x-disabled: false # Send this parameter example in the request\n * ```\n */\nexport const XDisabled = Type.Object({\n 'x-disabled': Type.Optional(Type.Boolean()),\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAgBd,MAAM,YAAY,KAAK,OAAO;AAAA,EACnC,cAAc,KAAK,SAAS,KAAK,QAAQ,CAAC;AAC5C,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/general/x-scalar-active-environment.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n// Schema for the optional 'x-scalar-active-environment' extension property\nexport const XScalarActiveEnvironmentSchema = Type.Object({\n 'x-scalar-active-environment': Type.Optional(Type.String()),\n})\n\n// Type definition for the optional 'x-scalar-active-environment' property\nexport type XScalarActiveEnvironment = {\n /** The currently selected environment */\n 'x-scalar-active-environment'?: string\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAGd,MAAM,iCAAiC,KAAK,OAAO;AAAA,EACxD,+BAA+B,KAAK,SAAS,KAAK,OAAO,CAAC;AAC5D,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/general/x-scalar-cookies.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const xScalarCookieSchema = Type.Object({\n name: Type.String(),\n value: Type.String(),\n domain: Type.Optional(Type.String()),\n path: Type.Optional(Type.String()),\n isDisabled: Type.Optional(Type.Boolean()),\n})\n\nexport type XScalarCookie = {\n /**\n * Defines the cookie name and its value. A cookie definition begins with a name-value pair.\n */\n name: string\n /**\n * Defines the cookie value.\n */\n value: string\n /**\n * Allows this domain and all subdomains, is less restrictive than not setting a domain\n */\n domain?: string\n /**\n * Will restrict this cookie to only be sent with requests that contain this path\n */\n path?: string\n /**\n * Indicates if the cookie is disabled.\n */\n isDisabled?: boolean\n}\n\nexport const xScalarCookiesSchema = Type.Object({\n 'x-scalar-cookies': Type.Optional(Type.Array(xScalarCookieSchema)),\n})\nexport type XScalarCookies = {\n 'x-scalar-cookies'?: XScalarCookie[]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,sBAAsB,KAAK,OAAO;AAAA,EAC7C,MAAM,KAAK,OAAO;AAAA,EAClB,OAAO,KAAK,OAAO;AAAA,EACnB,QAAQ,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EACnC,MAAM,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EACjC,YAAY,KAAK,SAAS,KAAK,QAAQ,CAAC;AAC1C,CAAC;AAyBM,MAAM,uBAAuB,KAAK,OAAO;AAAA,EAC9C,oBAAoB,KAAK,SAAS,KAAK,MAAM,mBAAmB,CAAC;AACnE,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/general/x-scalar-order.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * Schema for the \"x-scalar-order\" OpenAPI extension.\n * This extension allows specifying an optional array of strings,\n * which can be used to represent a custom order for elements (e.g., tags, operations) in the Scalar UI.\n */\nexport const XScalarOrderSchema = Type.Object({\n 'x-scalar-order': Type.Optional(Type.Array(Type.String())),\n})\n\nexport type XScalarOrder = {\n 'x-scalar-order'?: string[]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAOd,MAAM,qBAAqB,KAAK,OAAO;AAAA,EAC5C,kBAAkB,KAAK,SAAS,KAAK,MAAM,KAAK,OAAO,CAAC,CAAC;AAC3D,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/operation/index.ts"],
|
|
4
|
-
"sourcesContent": ["export {\n type XBadge,\n XBadgeSchema,\n type XBadges,\n XBadgesSchema,\n} from './x-badge'\nexport {\n type XCodeSample,\n XCodeSamplesSchema,\n} from './x-code-samples'\nexport {\n type XScalarSelectedContentType,\n XScalarSelectedContentTypeSchema,\n} from './x-scalar-selected-content-type'\nexport {\n XScalarStabilitySchema,\n XScalarStabilityValues,\n} from './x-scalar-stability'\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA,EAEE;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/operation/x-badge.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * Schema for individual badge configuration in x-badges extension.\n * Badges are indicators that can be displayed in API documentation.\n */\nexport const XBadgeSchema = Type.Object(\n {\n /** The text that displays in the badge. This is required for all badges. */\n name: Type.String({\n description: 'The text that displays in the badge',\n minLength: 1,\n }),\n /**\n * The position of the badge in relation to the header.\n * Defaults to 'after' if not specified.\n */\n position: Type.Optional(\n Type.Union([Type.Literal('before'), Type.Literal('after')], {\n description: 'The position of the badge in relation to the header',\n default: 'after',\n }),\n ),\n /**\n * The color of the badge. Can be defined in various formats such as color keywords,\n * RGB, RGBA, HSL, HSLA, and Hexadecimal.\n */\n color: Type.Optional(\n Type.String({\n description: 'The color of the badge in various formats (keywords, RGB, RGBA, HSL, HSLA, Hexadecimal)',\n pattern:\n '^(#([0-9A-Fa-f]{3}){1,2}|rgb\\\\(\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*\\\\)|rgba\\\\(\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*,\\\\s*[0-9.]*\\\\s*\\\\)|hsl\\\\(\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+%\\\\s*,\\\\s*\\\\d+%\\\\s*\\\\)|hsla\\\\(\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+%\\\\s*,\\\\s*\\\\d+%\\\\s*,\\\\s*[0-9.]*\\\\s*\\\\)|[a-zA-Z]+)$',\n }),\n ),\n },\n {\n description: 'Configuration for a single badge in the x-badges extension',\n },\n)\n\n/**\n * Schema for individual badge configuration in x-badges extension.\n * Badges are indicators that can be displayed in API documentation.\n */\nexport type XBadge = {\n /** The text that displays in the badge. This is required for all badges. */\n name: string\n /**\n * The position of the badge in relation to the header.\n * @default 'after'\n */\n position?: 'before' | 'after'\n /**\n * The color of the badge. Can be defined in various formats such as color keywords,\n * RGB, RGBA, HSL, HSLA, and Hexadecimal.\n */\n color?: string\n}\n\nexport const XBadgesSchema = Type.Object({\n /**\n * You can add badges to operations to use as indicators in documentation. Each operation can have multiple badges, and the displayed color is also configurable. The following example sets badges on the GET `/hello-world` operation:\n *\n * ```yaml\n * openapi: 3.1.0\n * info:\n * title: x-badges\n * version: 1.0.0\n * paths:\n * /hello-world:\n * get:\n * summary: Hello World\n * x-badges:\n * - name: 'Alpha'\n * - name: 'Beta'\n * position: before\n * - name: 'Gamma'\n * position: after\n * color: '#ffcc00'\n ```\n */\n 'x-badges': Type.Optional(Type.Array(XBadgeSchema)),\n})\n\nexport type XBadges = {\n /**\n * You can add badges to operations to use as indicators in documentation. Each operation can have multiple badges, and the displayed color is also configurable. The following example sets badges on the GET `/hello-world` operation:\n *\n * ```yaml\n * openapi: 3.1.0\n * info:\n * title: x-badges\n * version: 1.0.0\n * paths:\n * /hello-world:\n * get:\n * summary: Hello World\n * x-badges:\n * - name: 'Alpha'\n * - name: 'Beta'\n * position: before\n * - name: 'Gamma'\n * position: after\n * color: '#ffcc00'\n ```\n */\n 'x-badges'?: XBadge[]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAMd,MAAM,eAAe,KAAK;AAAA,EAC/B;AAAA;AAAA,IAEE,MAAM,KAAK,OAAO;AAAA,MAChB,aAAa;AAAA,MACb,WAAW;AAAA,IACb,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKD,UAAU,KAAK;AAAA,MACb,KAAK,MAAM,CAAC,KAAK,QAAQ,QAAQ,GAAG,KAAK,QAAQ,OAAO,CAAC,GAAG;AAAA,QAC1D,aAAa;AAAA,QACb,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,OAAO,KAAK;AAAA,MACV,KAAK,OAAO;AAAA,QACV,aAAa;AAAA,QACb,SACE;AAAA,MACJ,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EACA;AAAA,IACE,aAAa;AAAA,EACf;AACF;AAqBO,MAAM,gBAAgB,KAAK,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBvC,YAAY,KAAK,SAAS,KAAK,MAAM,YAAY,CAAC;AACpD,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/operation/x-code-samples.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nconst XCodeSampleSchema = Type.Object({\n lang: Type.Optional(Type.String()),\n label: Type.Optional(Type.String()),\n source: Type.String(),\n})\n\nexport const XCodeSamplesSchema = Type.Object({\n 'x-codeSamples': Type.Optional(Type.Array(XCodeSampleSchema)),\n 'x-code-samples': Type.Optional(Type.Array(XCodeSampleSchema)),\n 'x-custom-examples': Type.Optional(Type.Array(XCodeSampleSchema)),\n})\n\nexport type XCodeSample = {\n lang?: string\n label?: string\n source: string\n}\n\nexport type XCodeSamples = {\n 'x-codeSamples'?: XCodeSample[]\n 'x-code-samples'?: XCodeSample[]\n 'x-custom-examples'?: XCodeSample[]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAErB,MAAM,oBAAoB,KAAK,OAAO;AAAA,EACpC,MAAM,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EACjC,OAAO,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EAClC,QAAQ,KAAK,OAAO;AACtB,CAAC;AAEM,MAAM,qBAAqB,KAAK,OAAO;AAAA,EAC5C,iBAAiB,KAAK,SAAS,KAAK,MAAM,iBAAiB,CAAC;AAAA,EAC5D,kBAAkB,KAAK,SAAS,KAAK,MAAM,iBAAiB,CAAC;AAAA,EAC7D,qBAAqB,KAAK,SAAS,KAAK,MAAM,iBAAiB,CAAC;AAClE,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/operation/x-draft-examples.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XDraftExamplesSchema = Type.Object({\n 'x-draft-examples': Type.Optional(Type.Array(Type.String())),\n})\n\nexport type XDraftExamples = {\n 'x-draft-examples'?: string[]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,uBAAuB,KAAK,OAAO;AAAA,EAC9C,oBAAoB,KAAK,SAAS,KAAK,MAAM,KAAK,OAAO,CAAC,CAAC;AAC7D,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/operation/x-post-response.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * Post response scripts allow to execute arbitrary code after a response is received\n *\n * This is useful for:\n * - Extracting data from the response, or\n * - Testing the response\n *\n * @example\n * ```yaml\n * x-post-response: |\n * pm.test(\"Status code is 200\", () => {\n * pm.response.to.have.status(200)\n * })\n * ```\n */\nexport const XPostResponseSchema = Type.Object({\n 'x-post-response': Type.Optional(Type.String()),\n})\n\nexport type XPostResponse = {\n /**\n * Post response scripts allow to execute arbitrary code after a response is received\n *\n * This is useful for:\n * - Extracting data from the response, or\n * - Testing the response\n *\n * @example\n * ```yaml\n * x-post-response: |\n * pm.test(\"Status code is 200\", () => {\n * pm.response.to.have.status(200)\n * })\n * ```\n */\n 'x-post-response'?: string\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAiBd,MAAM,sBAAsB,KAAK,OAAO;AAAA,EAC7C,mBAAmB,KAAK,SAAS,KAAK,OAAO,CAAC;AAChD,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/operation/x-scalar-disable-parameters.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * The name of a parameter (like \"Content-Type\" or \"Authorization\").\n * Used as keys in parameter state mappings.\n */\ntype ParameterName = string\n\n/**\n * The key identifying an example (like \"default\" or \"auth-example\").\n * Used to separate parameter states across different examples.\n */\ntype ExampleKey = string\n\n/**\n * Maps parameter names to their disabled state for a single example.\n * A parameter is disabled when its value is true, enabled when false.\n *\n * @example\n * {\n * \"Content-Type\": true, // This parameter is disabled\n * \"Accept\": false // This parameter is enabled\n * }\n */\ntype ExampleParameterState = Record<ParameterName, boolean>\n\n/**\n * Maps example keys to their parameter disabled states.\n * Each example can have a different set of disabled parameters.\n *\n * @example\n * {\n * \"default\": { \"Content-Type\": true },\n * \"auth-example\": { \"Authorization\": false }\n * }\n */\ntype ExamplesParameterStates = Record<ExampleKey, ExampleParameterState>\n\n/**\n * Configuration for disabled parameters across different parameter categories.\n * Organizes parameter states by their type (global cookies, headers, etc.).\n */\nexport type DisableParametersConfig = {\n /**\n * Tracks disabled state for global cookie parameters across examples.\n * Global cookies are shared across all operations in the workspace.\n */\n 'global-cookies'?: ExamplesParameterStates\n /**\n * Tracks disabled state for global header parameters across examples.\n * Global headers are shared across all operations in the workspace.\n */\n 'global-headers'?: ExamplesParameterStates\n /**\n * Tracks disabled state for default header parameters across examples.\n * Default headers are automatically injected by the client (like Content-Type).\n */\n 'default-headers'?: ExamplesParameterStates\n}\n\n/**\n * Schema for parameter disabled states within a single example.\n * Maps parameter names (strings) to their disabled state (boolean).\n */\nconst ExampleParameterStateSchema = Type.Record(Type.String(), Type.Boolean())\n\n/**\n * Schema for all example parameter states across multiple examples.\n * Maps example keys (strings) to their parameter disabled states.\n */\nconst ExamplesParameterStatesSchema = Type.Record(Type.String(), ExampleParameterStateSchema)\n\n/**\n * Custom OpenAPI extension to track which parameters are disabled across different contexts.\n *\n * This extension allows the API client to persist disabled states for different types of\n * parameters (global cookies, global headers, default headers) across multiple examples.\n *\n * This is necessary because:\n * - Different parameter types have different scopes and behaviors\n * - Users need to disable specific parameters per example without affecting others\n * - The disabled state must persist across sessions\n * - Global parameters can be disabled independently of operation-specific ones\n *\n * Structure:\n * - Top level: Parameter category (\"global-cookies\", \"global-headers\", \"default-headers\")\n * - Second level: Example keys (like \"default\", \"custom-example\")\n * - Third level: Parameter names (like \"Content-Type\", \"Cookie\")\n * - Values: true = disabled, false = enabled\n *\n * @example\n * ```json\n * {\n * \"x-scalar-disable-parameters\": {\n * \"global-cookies\": {\n * \"default\": {\n * \"session\": true\n * }\n * },\n * \"global-headers\": {\n * \"default\": {\n * \"X-API-Key\": false\n * }\n * },\n * \"default-headers\": {\n * \"default\": {\n * \"Content-Type\": true,\n * \"Accept\": false\n * }\n * }\n * }\n * }\n * ```\n */\nexport const XScalarDisableParametersSchema = Type.Object({\n 'x-scalar-disable-parameters': Type.Optional(\n Type.Object({\n 'global-cookies': Type.Optional(ExamplesParameterStatesSchema),\n 'global-headers': Type.Optional(ExamplesParameterStatesSchema),\n 'default-headers': Type.Optional(ExamplesParameterStatesSchema),\n }),\n ),\n})\n\n/**\n * Type definition for the x-scalar-disable-parameters extension.\n * Allows tracking disabled state for different parameter categories across examples.\n */\nexport type XScalarDisableParameters = {\n 'x-scalar-disable-parameters'?: DisableParametersConfig\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAgErB,MAAM,8BAA8B,KAAK,OAAO,KAAK,OAAO,GAAG,KAAK,QAAQ,CAAC;AAM7E,MAAM,gCAAgC,KAAK,OAAO,KAAK,OAAO,GAAG,2BAA2B;AA4CrF,MAAM,iCAAiC,KAAK,OAAO;AAAA,EACxD,+BAA+B,KAAK;AAAA,IAClC,KAAK,OAAO;AAAA,MACV,kBAAkB,KAAK,SAAS,6BAA6B;AAAA,MAC7D,kBAAkB,KAAK,SAAS,6BAA6B;AAAA,MAC7D,mBAAmB,KAAK,SAAS,6BAA6B;AAAA,IAChE,CAAC;AAAA,EACH;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/operation/x-scalar-selected-content-type.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * Schema for the x-scalar-selected-content-type extension on an OpenAPI operation.\n *\n * The key represents the example name, and the value is the selected content type string.\n * Used by Scalar to track which content type is selected for each example in request or response bodies.\n */\nexport const XScalarSelectedContentTypeSchema = Type.Object({\n 'x-scalar-selected-content-type': Type.Optional(Type.Record(Type.String(), Type.String())),\n})\n\n/**\n * Type definition for the x-scalar-selected-content-type extension on an OpenAPI operation.\n *\n * The key represents the example name, and the value is the selected content type string.\n * Used by Scalar to track which content type is selected for each example in request or response bodies.\n */\nexport type XScalarSelectedContentType = {\n 'x-scalar-selected-content-type'?: {\n [key: string]: string\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAQd,MAAM,mCAAmC,KAAK,OAAO;AAAA,EAC1D,kCAAkC,KAAK,SAAS,KAAK,OAAO,KAAK,OAAO,GAAG,KAAK,OAAO,CAAC,CAAC;AAC3F,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/operation/x-scalar-stability.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XScalarStabilityValues = {\n Deprecated: 'deprecated',\n Experimental: 'experimental',\n Stable: 'stable',\n} as const\n\nexport type XScalarStabilityValues = (typeof XScalarStabilityValues)[keyof typeof XScalarStabilityValues]\n\n/**\n * An OpenAPI extension to indicate the stability of the operation\n *\n * @example\n * ```yaml\n * x-scalar-stability: deprecated\n * ```\n */\nexport const XScalarStabilitySchema = Type.Object({\n 'x-scalar-stability': Type.Optional(\n Type.Union([Type.Literal('deprecated'), Type.Literal('experimental'), Type.Literal('stable')]),\n ),\n})\n\nexport type XScalarStability = {\n /**\n * An OpenAPI extension to indicate the stability of the operation\n *\n * @example\n * ```yaml\n * x-scalar-stability: deprecated\n * ```\n */\n 'x-scalar-stability'?: XScalarStabilityValues\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,yBAAyB;AAAA,EACpC,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,QAAQ;AACV;AAYO,MAAM,yBAAyB,KAAK,OAAO;AAAA,EAChD,sBAAsB,KAAK;AAAA,IACzB,KAAK,MAAM,CAAC,KAAK,QAAQ,YAAY,GAAG,KAAK,QAAQ,cAAc,GAAG,KAAK,QAAQ,QAAQ,CAAC,CAAC;AAAA,EAC/F;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/parameter/x-global.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * OpenAPI extension used by the api-client application to determine if a parameter is considered global in scope\n * for the entire workspace. When set, this parameter will be injected into every request automatically.\n *\n * @example\n * ```yaml\n * x-global: true\n * ```\n */\nexport const XGlobal = Type.Object({\n 'x-global': Type.Optional(Type.Boolean()),\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAWd,MAAM,UAAU,KAAK,OAAO;AAAA,EACjC,YAAY,KAAK,SAAS,KAAK,QAAQ,CAAC;AAC1C,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/schema/x-additional-properties-name.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * x-additionalPropertiesName\n *\n * Custom attribute name for additionalProperties in a schema.\n * This allows specifying a descriptive name for additional properties\n * that may be present in an object.\n */\nexport const XAdditionalPropertiesNameSchema = Type.Object({\n 'x-additionalPropertiesName': Type.Optional(Type.String()),\n})\n\nexport type XAdditionalPropertiesName = {\n /**\n * x-additionalPropertiesName\n *\n * Custom attribute name for additionalProperties in a schema.\n * This allows specifying a descriptive name for additional properties\n * that may be present in an object.\n */\n 'x-additionalPropertiesName'?: string\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AASd,MAAM,kCAAkC,KAAK,OAAO;AAAA,EACzD,8BAA8B,KAAK,SAAS,KAAK,OAAO,CAAC;AAC3D,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/schema/x-enum-descriptions.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * x-enumDescriptions\n *\n * Maps enum values to their descriptions. Each key should correspond to\n * an enum value, and the value is the description for that enum value.\n *\n * Example:\n * x-enumDescriptions:\n * missing_features: \"Missing features\"\n * too_expensive: \"Too expensive\"\n * unused: \"Unused\"\n * other: \"Other\"\n */\nexport const XEnumDescriptionsSchema = Type.Object({\n 'x-enumDescriptions': Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.String()), Type.Array(Type.String())]),\n ),\n 'x-enum-descriptions': Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.String()), Type.Array(Type.String())]),\n ),\n})\n\nexport type XEnumDescriptions = {\n /**\n * x-enumDescriptions\n *\n * Maps enum values to their descriptions. Each key should correspond to\n * an enum value, and the value is the description for that enum value.\n *\n * Example:\n * x-enumDescriptions:\n * missing_features: \"Missing features\"\n * too_expensive: \"Too expensive\"\n * unused: \"Unused\"\n * other: \"Other\"\n */\n 'x-enumDescriptions'?: Record<string, string> | string[]\n /**\n * x-enum-descriptions\n *\n * Maps enum values to their descriptions. Each key should correspond to\n * an enum value, and the value is the description for that enum value.\n *\n * Example:\n * x-enum-descriptions:\n * missing_features: \"Missing features\"\n * too_expensive: \"Too expensive\"\n * unused: \"Unused\"\n * other: \"Other\"\n */\n 'x-enum-descriptions'?: Record<string, string> | string[]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAed,MAAM,0BAA0B,KAAK,OAAO;AAAA,EACjD,sBAAsB,KAAK;AAAA,IACzB,KAAK,MAAM,CAAC,KAAK,OAAO,KAAK,OAAO,GAAG,KAAK,OAAO,CAAC,GAAG,KAAK,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC;AAAA,EACnF;AAAA,EACA,uBAAuB,KAAK;AAAA,IAC1B,KAAK,MAAM,CAAC,KAAK,OAAO,KAAK,OAAO,GAAG,KAAK,OAAO,CAAC,GAAG,KAAK,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC;AAAA,EACnF;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/schema/x-enum-varnames.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * x-enum-varnames\n *\n * Names the enum values, must be in the same order as the enum values.\n *\n * @example\n * ```yaml\n * enum:\n * - moon\n * - asteroid\n * - comet\n * x-enum-varnames:\n * - Moon\n * - Asteroid\n * - Comet\n * ```\n */\nexport const XEnumVarNamesSchema = Type.Object({\n 'x-enum-varnames': Type.Optional(Type.Array(Type.String())),\n 'x-enumNames': Type.Optional(Type.Array(Type.String())),\n})\n\nexport type XEnumVarNames = {\n /**\n * x-enum-varnames\n *\n * Names the enum values, must be in the same order as the enum values.\n *\n * @example\n * ```yaml\n * enum:\n * - moon\n * - asteroid\n * - comet\n * x-enum-varnames:\n * - Moon\n * - Asteroid\n * - Comet\n * ```\n */\n 'x-enum-varnames'?: string[]\n /**\n * x-enumNames\n *\n * Names the enum values, must be in the same order as the enum values.\n *\n * @example\n * ```yaml\n * enum:\n * - moon\n * - asteroid\n * - comet\n * x-enumNames:\n * - Moon\n * - Asteroid\n * - Comet\n * ```\n */\n 'x-enumNames'?: string[]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAmBd,MAAM,sBAAsB,KAAK,OAAO;AAAA,EAC7C,mBAAmB,KAAK,SAAS,KAAK,MAAM,KAAK,OAAO,CAAC,CAAC;AAAA,EAC1D,eAAe,KAAK,SAAS,KAAK,MAAM,KAAK,OAAO,CAAC,CAAC;AACxD,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/schema/x-examples.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XExamplesSchema = Type.Object({\n 'x-examples': Type.Optional(Type.Record(Type.String(), Type.Unknown())),\n})\n\nexport type XExamples = {\n /**\n * This is based on one example of x-examples we have seen where it is a record of example name to example value.\n */\n 'x-examples'?: Record<string, unknown>\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,kBAAkB,KAAK,OAAO;AAAA,EACzC,cAAc,KAAK,SAAS,KAAK,OAAO,KAAK,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC;AACxE,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/schema/x-variable.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XVariableSchema = Type.Object({\n 'x-variable': Type.Optional(Type.String()),\n})\n\nexport type XVariable = {\n 'x-variable'?: string\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,kBAAkB,KAAK,OAAO;AAAA,EACzC,cAAc,KAAK,SAAS,KAAK,OAAO,CAAC;AAC3C,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/security/x-default-scopes.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * Default selected scopes for the oauth flow\n *\n * @example\n * ```json\n * {\n * \"x-default-scopes\": [\n * \"profile\",\n * \"email\"\n * ]\n * }\n * ```\n */\nexport const XDefaultScopesSchema = Type.Object({\n 'x-default-scopes': Type.Optional(Type.Array(Type.String())),\n})\n\nexport type XDefaultScopes = {\n /**\n * Default selected scopes for the oauth flow\n *\n * @example\n * ```json\n * {\n * \"x-default-scopes\": [\n * \"profile\",\n * \"email\"\n * ]\n * }\n * ```\n */\n 'x-default-scopes'?: string[]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAed,MAAM,uBAAuB,KAAK,OAAO;AAAA,EAC9C,oBAAoB,KAAK,SAAS,KAAK,MAAM,KAAK,OAAO,CAAC,CAAC;AAC7D,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/security/x-scalar-credentials-location.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * An OpenAPI extension to specify where OAuth2 credentials should be sent\n *\n * @example\n * ```yaml\n * x-scalar-credentials-location: header\n * ```\n *\n * @example\n * ```yaml\n * x-scalar-credentials-location: body\n * ```\n */\nexport const XScalarCredentialsLocationSchema = Type.Object({\n 'x-scalar-credentials-location': Type.Optional(Type.Union([Type.Literal('header'), Type.Literal('body')])),\n})\n\n/**\n * An OpenAPI extension to specify where OAuth2 credentials should be sent\n *\n * @example\n * ```yaml\n * x-scalar-credentials-location: header\n * ```\n *\n * @example\n * ```yaml\n * x-scalar-credentials-location: body\n * ```\n */\nexport type XScalarCredentialsLocation = {\n 'x-scalar-credentials-location'?: 'header' | 'body'\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAed,MAAM,mCAAmC,KAAK,OAAO;AAAA,EAC1D,iCAAiC,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,QAAQ,QAAQ,GAAG,KAAK,QAAQ,MAAM,CAAC,CAAC,CAAC;AAC3G,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/security/x-scalar-security-body.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * An OpenAPI extension to set any additional body parameters for the OAuth token request\n *\n * @example\n * ```yaml\n * x-scalar-security-body: {\n * audience: 'https://api.example.com',\n * resource: 'user-profile'\n * }\n * ```\n */\nexport const XScalarSecurityBodySchema = Type.Object({\n 'x-scalar-security-body': Type.Optional(Type.Record(Type.String(), Type.String())),\n})\n\n/**\n * An OpenAPI extension to set any additional body parameters for the OAuth token request\n *\n * @example\n * ```yaml\n * x-scalar-security-body: {\n * audience: 'https://api.example.com',\n * resource: 'user-profile'\n * }\n * ```\n */\nexport type XScalarSecurityBody = {\n 'x-scalar-security-body'?: Record<string, string>\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAad,MAAM,4BAA4B,KAAK,OAAO;AAAA,EACnD,0BAA0B,KAAK,SAAS,KAAK,OAAO,KAAK,OAAO,GAAG,KAAK,OAAO,CAAC,CAAC;AACnF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/extensions/security/x-scalar-security-query.ts"],
|
|
4
|
-
"sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * An OpenAPI extension set any query parameters for the OAuth authorize request\n *\n * @example\n * ```yaml\n * x-scalar-security-query: {\n * prompt: 'consent',\n * audience: 'scalar'\n * }\n * ```\n */\nexport const XScalarSecurityQuerySchema = Type.Object({\n 'x-scalar-security-query': Type.Optional(Type.Record(Type.String(), Type.String())),\n})\n\n/**\n * An OpenAPI extension set any query parameters for the OAuth authorize request\n *\n * @example\n * ```yaml\n * x-scalar-security-query: {\n * prompt: 'consent',\n * audience: 'scalar'\n * }\n * ```\n */\nexport type XScalarSecurityQuery = {\n 'x-scalar-security-query'?: Record<string, string>\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAad,MAAM,6BAA6B,KAAK,OAAO;AAAA,EACpD,2BAA2B,KAAK,SAAS,KAAK,OAAO,KAAK,OAAO,GAAG,KAAK,OAAO,CAAC,CAAC;AACpF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|