@scalar/api-reference 1.60.0 → 1.61.0
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 +17 -0
- package/dist/browser/chunks/{AgentScalarChatInterface-CesFQ_Ax.js → AgentScalarChatInterface-BhUn0w1j.js} +2 -2
- package/dist/browser/chunks/{ScalarTextInput.vue-C14zmVNI.js → ScalarTextInput.vue-BUzf4Z_k.js} +2 -2
- package/dist/browser/chunks/basic-shape-diamond.svg-BTEOT1FL.js +1 -1
- package/dist/browser/chunks/basic-shape-hexagon.svg-BSPzaCgF.js +1 -1
- package/dist/browser/chunks/basic-shape-primary-circle-ellipse-round.svg-DKmZ8UUU.js +1 -1
- package/dist/browser/chunks/basic-shape-primary-square-rectangle.svg-n2YRykHD.js +1 -1
- package/dist/browser/chunks/basic-shape-shield.svg-Bec9cJDA.js +1 -1
- package/dist/browser/chunks/browser-67K6wmG9.js +1 -1
- package/dist/browser/chunks/computer-device-desktop-monitor.svg-m6j893Hb.js +1 -1
- package/dist/browser/chunks/computer-device-desktop.svg-Dk1VVO7k.js +1 -1
- package/dist/browser/chunks/computer-device-laptop.svg-BNGVUCYS.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-android-samsung-back.svg-CC4UUTFw.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-android-samsung.svg-D8ExpMpL.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-iphone-x-back.svg-CLm7sgMM.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-iphone-x.svg-Xrttg6_7.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-tablet-touch.svg-DQ2oTvOG.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-tablet.svg-DCr0XlRc.js +1 -1
- package/dist/browser/chunks/computer-device-network-ethernet-cat6.svg-AK9l0iOl.js +1 -1
- package/dist/browser/chunks/computer-device-network-lan-www.svg-gUIdFBlE.js +1 -1
- package/dist/browser/chunks/computer-device-network-wifi-connection.svg-Be-EMm4e.js +1 -1
- package/dist/browser/chunks/computer-device-network-wifi-router.svg-Dc2VzyqK.js +1 -1
- package/dist/browser/chunks/ecology-science-erlenmeyer-flask.svg-DHgy7Jfd.js +1 -1
- package/dist/browser/chunks/image-flash-lightning.svg-EETR_y1q.js +1 -1
- package/dist/browser/chunks/image-picture-flower.svg-DN1AYzJU.js +1 -1
- package/dist/browser/chunks/interface-alert-exclamation-diamond.svg-C5NozMV_.js +1 -1
- package/dist/browser/chunks/interface-alert-exclamation-triangle-warning.svg-DaAg2fF5.js +1 -1
- package/dist/browser/chunks/interface-alert-information-circle.svg-ckkkt9Mv.js +1 -1
- package/dist/browser/chunks/interface-award-crown.svg-pjvn9hY-.js +1 -1
- package/dist/browser/chunks/interface-bookmark-tag.svg-r2r-lQq4.js +1 -1
- package/dist/browser/chunks/interface-bookmark.svg-BK9HKQBT.js +1 -1
- package/dist/browser/chunks/interface-calendar-date-one.svg-DNnF0M1I.js +1 -1
- package/dist/browser/chunks/interface-content-book-open-pages.svg-CQj_w9Vp.js +1 -1
- package/dist/browser/chunks/interface-content-book-page.svg-DppoeJRe.js +1 -1
- package/dist/browser/chunks/interface-content-file.svg-CvcD7OiY.js +1 -1
- package/dist/browser/chunks/interface-content-folder.svg-BmtS5I9A.js +1 -1
- package/dist/browser/chunks/interface-copy-clipboard.svg-Be6EI50X.js +1 -1
- package/dist/browser/chunks/interface-edit-attachment.svg-G5TKzpWX.js +1 -1
- package/dist/browser/chunks/interface-edit-binocular.svg-jzL-DvGB.js +1 -1
- package/dist/browser/chunks/interface-edit-magic-wand.svg-BOTlymvp.js +1 -1
- package/dist/browser/chunks/interface-edit-tool-paint-roller.svg-s9dwryx7.js +1 -1
- package/dist/browser/chunks/interface-edit-tool-pencil.svg-C7v0dbB3.js +1 -1
- package/dist/browser/chunks/interface-favorite-award.svg-CYHUgUG0.js +1 -1
- package/dist/browser/chunks/interface-favorite-flag.svg-C10zlKOb.js +1 -1
- package/dist/browser/chunks/interface-favorite-heart.svg-eoduXxlz.js +1 -1
- package/dist/browser/chunks/interface-favorite-star.svg-BSmxJetr.js +1 -1
- package/dist/browser/chunks/interface-favorite-stars-sparkles.svg-JTFLj3Ls.js +1 -1
- package/dist/browser/chunks/interface-hierarchy-flowchart.svg-Cg_Wy0kN.js +1 -1
- package/dist/browser/chunks/interface-home-house.svg-DytoGRnv.js +1 -1
- package/dist/browser/chunks/interface-hyperlink.svg-CuEfmmQI.js +1 -1
- package/dist/browser/chunks/interface-lighting-brightness.svg-DSK0h_Pa.js +1 -1
- package/dist/browser/chunks/interface-lock-closed.svg-Cn6TaLYv.js +1 -1
- package/dist/browser/chunks/interface-lock-open-unlock.svg-CVkG5-9W.js +1 -1
- package/dist/browser/chunks/interface-login-key.svg-y-cwwXjN.js +1 -1
- package/dist/browser/chunks/interface-search.svg-S-puVFJB.js +1 -1
- package/dist/browser/chunks/interface-setting-cog.svg-CTH4_lLg.js +1 -1
- package/dist/browser/chunks/interface-share-megaphone-bullhorn.svg-Pbp39MyC.js +1 -1
- package/dist/browser/chunks/interface-share-rocket.svg-BgCsIRZO.js +1 -1
- package/dist/browser/chunks/interface-share-satellite.svg-DAMN9d5G.js +1 -1
- package/dist/browser/chunks/interface-share-space-ship.svg-Dt-Mejxk.js +1 -1
- package/dist/browser/chunks/interface-share.svg-vFYTXSti.js +1 -1
- package/dist/browser/chunks/interface-signal-square.svg-DNG4LpAe.js +1 -1
- package/dist/browser/chunks/interface-time-clock-circle.svg-Bpz-nLxo.js +1 -1
- package/dist/browser/chunks/interface-time-hour-glass.svg-D7agfKsH.js +1 -1
- package/dist/browser/chunks/interface-users-multiple.svg-CkPJBBnG.js +1 -1
- package/dist/browser/chunks/interface-weather-moon.svg-CaTZFMPO.js +1 -1
- package/dist/browser/chunks/mail-chat-bubble-square.svg-DC8RIihp.js +1 -1
- package/dist/browser/chunks/mail-send-email-paper-airplane.svg-D8OLs9jz.js +1 -1
- package/dist/browser/chunks/mail-send-envelope.svg-CV33h5Sx.js +1 -1
- package/dist/browser/chunks/{modal-LBDjZSmM.js → modal-CKthJJWy.js} +2 -2
- package/dist/browser/chunks/{modal-BZzcBkVp.js → modal-CZI71Aau.js} +19 -19
- package/dist/browser/chunks/money-cashier-receipt.svg-CJL8C2gs.js +1 -1
- package/dist/browser/chunks/money-currency-dollar-pay.svg-VdBplCTx.js +1 -1
- package/dist/browser/chunks/money-graph-arrow-increase.svg-DcRov3zk.js +1 -1
- package/dist/browser/chunks/money-graph-bar-chart-increase.svg-Cc7KxjX-.js +1 -1
- package/dist/browser/chunks/nature-ecology-leaf.svg-DR3cTZxt.js +1 -1
- package/dist/browser/chunks/phone-telephone.svg-DyY0gUlk.js +1 -1
- package/dist/browser/chunks/programming-bug.svg-BHLT-Qhp.js +1 -1
- package/dist/browser/chunks/programming-cloud.svg-B6YW33ba.js +1 -1
- package/dist/browser/chunks/programming-computer-database-server.svg-B6o5Sdn-.js +1 -1
- package/dist/browser/chunks/programming-computer-database.svg-Cl7OVtpJ.js +1 -1
- package/dist/browser/chunks/programming-module-four-layout.svg-BQrerL1x.js +1 -1
- package/dist/browser/chunks/programming-module-three.svg-B2KTQzBM.js +1 -1
- package/dist/browser/chunks/programming-module.svg-CiID7kPm.js +1 -1
- package/dist/browser/chunks/programming-script-code.svg-D1M5rtkN.js +1 -1
- package/dist/browser/chunks/runtime-core.esm-bundler-Byrbbu5Q.js +1 -1
- package/dist/browser/chunks/shopping-cart.svg-BEegiIR9.js +1 -1
- package/dist/browser/chunks/shopping-gift-present.svg-BUHwuLix.js +1 -1
- package/dist/browser/chunks/shopping-shipping-box-parcel-package.svg-D6fxWdYx.js +1 -1
- package/dist/browser/chunks/tag-new-circle.svg-jsg1bGs0.js +1 -1
- package/dist/browser/chunks/travel-map-earth-globe.svg-ClbMiU-f.js +1 -1
- package/dist/browser/chunks/{vendor-wW8jg8wN.js → vendor-BeJNu9KM.js} +2 -2
- package/dist/browser/standalone.esm.js +6 -6
- package/dist/browser/standalone.js +248 -248
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReference.vue.js.map +1 -1
- package/dist/components/ApiReference.vue.script.js +12 -6
- package/dist/components/ApiReference.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.d.ts +10 -0
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.js +9 -0
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.js.map +1 -0
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.script.js +43 -0
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.script.js.map +1 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.d.ts.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.js.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js +2 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.d.ts +4 -1
- package/dist/components/Content/AsyncApi/Channel.vue.d.ts.map +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.js +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.js.map +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.script.js +98 -44
- package/dist/components/Content/AsyncApi/Channel.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/Message.vue.d.ts +18 -0
- package/dist/components/Content/AsyncApi/Message.vue.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/Message.vue.js +9 -0
- package/dist/components/Content/AsyncApi/Message.vue.js.map +1 -0
- package/dist/components/Content/AsyncApi/Message.vue.script.js +159 -0
- package/dist/components/Content/AsyncApi/Message.vue.script.js.map +1 -0
- package/dist/components/Content/AsyncApi/Operation.vue.d.ts +18 -0
- package/dist/components/Content/AsyncApi/Operation.vue.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/Operation.vue.js +9 -0
- package/dist/components/Content/AsyncApi/Operation.vue.js.map +1 -0
- package/dist/components/Content/AsyncApi/Operation.vue.script.js +84 -0
- package/dist/components/Content/AsyncApi/Operation.vue.script.js.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/async-api-render-options.d.ts +14 -0
- package/dist/components/Content/AsyncApi/helpers/async-api-render-options.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/async-api-render-options.js +14 -0
- package/dist/components/Content/AsyncApi/helpers/async-api-render-options.js.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/filter-children-by-type.d.ts +9 -0
- package/dist/components/Content/AsyncApi/helpers/filter-children-by-type.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/filter-children-by-type.js +12 -0
- package/dist/components/Content/AsyncApi/helpers/filter-children-by-type.js.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/get-async-api-labels.d.ts +13 -0
- package/dist/components/Content/AsyncApi/helpers/get-async-api-labels.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/get-async-api-labels.js +23 -0
- package/dist/components/Content/AsyncApi/helpers/get-async-api-labels.js.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/pick-heading.d.ts +10 -0
- package/dist/components/Content/AsyncApi/helpers/pick-heading.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/pick-heading.js +20 -0
- package/dist/components/Content/AsyncApi/helpers/pick-heading.js.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/resolve-async-api-nodes.d.ts +21 -0
- package/dist/components/Content/AsyncApi/helpers/resolve-async-api-nodes.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/resolve-async-api-nodes.js +35 -0
- package/dist/components/Content/AsyncApi/helpers/resolve-async-api-nodes.js.map +1 -0
- package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.js +1 -1
- package/dist/components/Content/Schema/Schema.vue.js.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.script.js +2 -1
- package/dist/components/Content/Schema/Schema.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.script.js +16 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaHeading.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.script.js +21 -6
- package/dist/components/Content/Schema/SchemaProperty.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js +10 -9
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js.map +1 -1
- package/dist/helpers/get-async-api-message-payload-schema.d.ts +18 -0
- package/dist/helpers/get-async-api-message-payload-schema.d.ts.map +1 -0
- package/dist/helpers/get-async-api-message-payload-schema.js +33 -0
- package/dist/helpers/get-async-api-message-payload-schema.js.map +1 -0
- package/dist/helpers/get-async-api-model-schema.d.ts.map +1 -1
- package/dist/helpers/get-async-api-model-schema.js +2 -11
- package/dist/helpers/get-async-api-model-schema.js.map +1 -1
- package/dist/helpers/map-config-plugins.d.ts +8 -3
- package/dist/helpers/map-config-plugins.d.ts.map +1 -1
- package/dist/helpers/map-config-plugins.js +22 -4
- package/dist/helpers/map-config-plugins.js.map +1 -1
- package/dist/style.css +416 -311
- package/dist/vue-styles.css +398 -298
- package/package.json +12 -12
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AsyncApiMessageObject } from '@scalar/types/asyncapi/3.1';
|
|
2
|
+
import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
3
|
+
/**
|
|
4
|
+
* Unwraps an AsyncAPI schema-bearing value into the `SchemaObject` shape the shared OpenAPI
|
|
5
|
+
* `Schema`/`Model` components expect.
|
|
6
|
+
*
|
|
7
|
+
* AsyncAPI reuses JSON Schema, but a value may need extra handling:
|
|
8
|
+
* - The value itself may be a `$ref`; it is resolved to its `$ref-value`.
|
|
9
|
+
* - A Multi Format Schema Object (`schemaFormat` plus a nested `schema`) is unwrapped to its
|
|
10
|
+
* payload, so we render the inner JSON Schema rather than the wrapper.
|
|
11
|
+
* - Boolean (`true`/`false`) and non-JSON-Schema payloads are skipped.
|
|
12
|
+
*/
|
|
13
|
+
export declare const unwrapAsyncApiSchema: (value: unknown) => SchemaObject | undefined;
|
|
14
|
+
/** Resolves an AsyncAPI message `payload` into the `SchemaObject` the shared Schema component expects. */
|
|
15
|
+
export declare const getAsyncApiMessagePayloadSchema: (message: AsyncApiMessageObject) => SchemaObject | undefined;
|
|
16
|
+
/** Resolves an AsyncAPI message `headers` into the `SchemaObject` the shared Schema component expects. */
|
|
17
|
+
export declare const getAsyncApiMessageHeadersSchema: (message: AsyncApiMessageObject) => SchemaObject | undefined;
|
|
18
|
+
//# sourceMappingURL=get-async-api-message-payload-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-async-api-message-payload-schema.d.ts","sourceRoot":"","sources":["../../src/helpers/get-async-api-message-payload-schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAShG;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,KAAG,YAAY,GAAG,SAYpE,CAAA;AAED,0GAA0G;AAC1G,eAAO,MAAM,+BAA+B,GAAI,SAAS,qBAAqB,KAAG,YAAY,GAAG,SACzD,CAAA;AAEvC,0GAA0G;AAC1G,eAAO,MAAM,+BAA+B,GAAI,SAAS,qBAAqB,KAAG,YAAY,GAAG,SACzD,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
|
+
import { isObject } from "@scalar/helpers/object/is-object";
|
|
3
|
+
//#region src/helpers/get-async-api-message-payload-schema.ts
|
|
4
|
+
/**
|
|
5
|
+
* A resolved schema-bearing value may be a JSON Schema object, a boolean (`true`/`false`)
|
|
6
|
+
* schema, or a Multi Format Schema wrapper, so accept only plain objects and treat them as the
|
|
7
|
+
* `SchemaObject` the shared Schema/Model rendering expects.
|
|
8
|
+
*/
|
|
9
|
+
var isSchemaObject = (value) => isObject(value);
|
|
10
|
+
/**
|
|
11
|
+
* Unwraps an AsyncAPI schema-bearing value into the `SchemaObject` shape the shared OpenAPI
|
|
12
|
+
* `Schema`/`Model` components expect.
|
|
13
|
+
*
|
|
14
|
+
* AsyncAPI reuses JSON Schema, but a value may need extra handling:
|
|
15
|
+
* - The value itself may be a `$ref`; it is resolved to its `$ref-value`.
|
|
16
|
+
* - A Multi Format Schema Object (`schemaFormat` plus a nested `schema`) is unwrapped to its
|
|
17
|
+
* payload, so we render the inner JSON Schema rather than the wrapper.
|
|
18
|
+
* - Boolean (`true`/`false`) and non-JSON-Schema payloads are skipped.
|
|
19
|
+
*/
|
|
20
|
+
var unwrapAsyncApiSchema = (value) => {
|
|
21
|
+
if (value === void 0) return;
|
|
22
|
+
const resolved = getResolvedRef(value);
|
|
23
|
+
const schema = isObject(resolved) && "schemaFormat" in resolved ? getResolvedRef(resolved.schema) : resolved;
|
|
24
|
+
return isSchemaObject(schema) ? schema : void 0;
|
|
25
|
+
};
|
|
26
|
+
/** Resolves an AsyncAPI message `payload` into the `SchemaObject` the shared Schema component expects. */
|
|
27
|
+
var getAsyncApiMessagePayloadSchema = (message) => unwrapAsyncApiSchema(message.payload);
|
|
28
|
+
/** Resolves an AsyncAPI message `headers` into the `SchemaObject` the shared Schema component expects. */
|
|
29
|
+
var getAsyncApiMessageHeadersSchema = (message) => unwrapAsyncApiSchema(message.headers);
|
|
30
|
+
//#endregion
|
|
31
|
+
export { getAsyncApiMessageHeadersSchema, getAsyncApiMessagePayloadSchema, unwrapAsyncApiSchema };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=get-async-api-message-payload-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-async-api-message-payload-schema.js","names":[],"sources":["../../src/helpers/get-async-api-message-payload-schema.ts"],"sourcesContent":["import { isObject } from '@scalar/helpers/object/is-object'\nimport type { AsyncApiMessageObject } from '@scalar/types/asyncapi/3.1'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/**\n * A resolved schema-bearing value may be a JSON Schema object, a boolean (`true`/`false`)\n * schema, or a Multi Format Schema wrapper, so accept only plain objects and treat them as the\n * `SchemaObject` the shared Schema/Model rendering expects.\n */\nconst isSchemaObject = (value: unknown): value is SchemaObject => isObject(value)\n\n/**\n * Unwraps an AsyncAPI schema-bearing value into the `SchemaObject` shape the shared OpenAPI\n * `Schema`/`Model` components expect.\n *\n * AsyncAPI reuses JSON Schema, but a value may need extra handling:\n * - The value itself may be a `$ref`; it is resolved to its `$ref-value`.\n * - A Multi Format Schema Object (`schemaFormat` plus a nested `schema`) is unwrapped to its\n * payload, so we render the inner JSON Schema rather than the wrapper.\n * - Boolean (`true`/`false`) and non-JSON-Schema payloads are skipped.\n */\nexport const unwrapAsyncApiSchema = (value: unknown): SchemaObject | undefined => {\n if (value === undefined) {\n return undefined\n }\n\n // Resolve the value the same way OpenAPI model rendering does (plain `$ref-value`).\n const resolved = getResolvedRef(value)\n\n // Multi Format Schema Objects carry the real schema under `schema`; unwrap to that payload.\n const schema = isObject(resolved) && 'schemaFormat' in resolved ? getResolvedRef(resolved.schema) : resolved\n\n return isSchemaObject(schema) ? schema : undefined\n}\n\n/** Resolves an AsyncAPI message `payload` into the `SchemaObject` the shared Schema component expects. */\nexport const getAsyncApiMessagePayloadSchema = (message: AsyncApiMessageObject): SchemaObject | undefined =>\n unwrapAsyncApiSchema(message.payload)\n\n/** Resolves an AsyncAPI message `headers` into the `SchemaObject` the shared Schema component expects. */\nexport const getAsyncApiMessageHeadersSchema = (message: AsyncApiMessageObject): SchemaObject | undefined =>\n unwrapAsyncApiSchema(message.headers)\n"],"mappings":";;;;;;;;AAUA,IAAM,kBAAkB,UAA0C,SAAS,MAAM;;;;;;;;;;;AAYjF,IAAa,wBAAwB,UAA6C;AAChF,KAAI,UAAU,KAAA,EACZ;CAIF,MAAM,WAAW,eAAe,MAAM;CAGtC,MAAM,SAAS,SAAS,SAAS,IAAI,kBAAkB,WAAW,eAAe,SAAS,OAAO,GAAG;AAEpG,QAAO,eAAe,OAAO,GAAG,SAAS,KAAA;;;AAI3C,IAAa,mCAAmC,YAC9C,qBAAqB,QAAQ,QAAQ;;AAGvC,IAAa,mCAAmC,YAC9C,qBAAqB,QAAQ,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-async-api-model-schema.d.ts","sourceRoot":"","sources":["../../src/helpers/get-async-api-model-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-async-api-model-schema.d.ts","sourceRoot":"","sources":["../../src/helpers/get-async-api-model-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIhG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,gBAAgB,EAAE,MAAM,MAAM,KAAG,YAAY,GAAG,SAWhG,CAAA"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
+
import { unwrapAsyncApiSchema } from "./get-async-api-message-payload-schema.js";
|
|
1
2
|
import { getResolvedRef, mergeSiblingReferences } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
|
-
import { isObject } from "@scalar/helpers/object/is-object";
|
|
3
3
|
//#region src/helpers/get-async-api-model-schema.ts
|
|
4
4
|
/**
|
|
5
|
-
* A resolved `components.schemas` entry may be a JSON Schema object, a boolean (`true`/`false`)
|
|
6
|
-
* schema, or a Multi Format Schema wrapper, so accept only plain objects and treat them as the
|
|
7
|
-
* `SchemaObject` the shared Model rendering and search helpers expect.
|
|
8
|
-
*/
|
|
9
|
-
var isSchemaObject = (value) => isObject(value);
|
|
10
|
-
/**
|
|
11
5
|
* Resolves a named schema from an AsyncAPI document's `components.schemas` into the `SchemaObject`
|
|
12
6
|
* shape the shared OpenAPI Model components and search indexing expect.
|
|
13
7
|
*
|
|
@@ -21,10 +15,7 @@ var isSchemaObject = (value) => isObject(value);
|
|
|
21
15
|
var getAsyncApiModelSchema = (document, name) => {
|
|
22
16
|
if (!document.components) return;
|
|
23
17
|
const entry = getResolvedRef(document.components, mergeSiblingReferences).schemas?.[name];
|
|
24
|
-
|
|
25
|
-
const resolved = getResolvedRef(entry);
|
|
26
|
-
const schema = isObject(resolved) && "schemaFormat" in resolved ? getResolvedRef(resolved.schema) : resolved;
|
|
27
|
-
return isSchemaObject(schema) ? schema : void 0;
|
|
18
|
+
return unwrapAsyncApiSchema(entry);
|
|
28
19
|
};
|
|
29
20
|
//#endregion
|
|
30
21
|
export { getAsyncApiModelSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-async-api-model-schema.js","names":[],"sources":["../../src/helpers/get-async-api-model-schema.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"get-async-api-model-schema.js","names":[],"sources":["../../src/helpers/get-async-api-model-schema.ts"],"sourcesContent":["import type { AsyncApiDocument } from '@scalar/types/asyncapi/3.1'\nimport { getResolvedRef, mergeSiblingReferences } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { unwrapAsyncApiSchema } from './get-async-api-message-payload-schema'\n\n/**\n * Resolves a named schema from an AsyncAPI document's `components.schemas` into the `SchemaObject`\n * shape the shared OpenAPI Model components and search indexing expect.\n *\n * AsyncAPI keeps reusable schemas in the same place OpenAPI does, but an entry may need extra handling:\n * - `components` or the schema itself may be a `$ref`; siblings are merged so keys declared alongside\n * a `$ref` are kept rather than dropped.\n * - A Multi Format Schema Object (`schemaFormat` plus a nested `schema`) is unwrapped to its payload,\n * so we index and render the inner JSON Schema rather than the wrapper.\n * - Boolean (`true`/`false`) and non-JSON-Schema payloads are skipped.\n */\nexport const getAsyncApiModelSchema = (document: AsyncApiDocument, name: string): SchemaObject | undefined => {\n if (!document.components) {\n return undefined\n }\n\n // Merge siblings at the components level so schemas declared alongside a `$ref` are kept.\n const components = getResolvedRef(document.components, mergeSiblingReferences)\n const entry = components.schemas?.[name]\n\n // Resolve `$ref`s and unwrap Multi Format Schema Objects into the plain JSON Schema shape.\n return unwrapAsyncApiSchema(entry)\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAa,0BAA0B,UAA4B,SAA2C;AAC5G,KAAI,CAAC,SAAS,WACZ;CAKF,MAAM,QADa,eAAe,SAAS,YAAY,uBAAuB,CACrD,UAAU;AAGnC,QAAO,qBAAqB,MAAM"}
|
|
@@ -5,9 +5,14 @@ import { type ComputedRef } from 'vue';
|
|
|
5
5
|
/**
|
|
6
6
|
* Maps API reference configuration callbacks to client plugins.
|
|
7
7
|
*
|
|
8
|
-
* This function transforms the
|
|
9
|
-
* into the new plugin hook system. The mapping is reactive, so changes
|
|
10
|
-
* configuration will automatically update the plugin hooks.
|
|
8
|
+
* This function transforms the onBeforeRequest, onRequestBuilt, and onRequestSent
|
|
9
|
+
* callbacks into the new plugin hook system. The mapping is reactive, so changes
|
|
10
|
+
* to the configuration will automatically update the plugin hooks.
|
|
11
|
+
*
|
|
12
|
+
* Note: onRequestBuilt is mapped to the requestBuilt hook so the callback receives
|
|
13
|
+
* the exact fetch Request that is sent over the wire. Mutating its headers modifies
|
|
14
|
+
* the outgoing request, and hashing its body produces a hash that matches what the
|
|
15
|
+
* server receives (a rebuilt multipart body would get a different boundary).
|
|
11
16
|
*
|
|
12
17
|
* Note: onRequestSent is mapped to responseReceived hook. This is not a perfect
|
|
13
18
|
* one-to-one mapping, but it maintains backward compatibility with the old API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-config-plugins.d.ts","sourceRoot":"","sources":["../../src/helpers/map-config-plugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,EAAE,KAAK,WAAW,EAAS,MAAM,KAAK,CAAA;AAE7C
|
|
1
|
+
{"version":3,"file":"map-config-plugins.d.ts","sourceRoot":"","sources":["../../src/helpers/map-config-plugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,EAAE,KAAK,WAAW,EAAS,MAAM,KAAK,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,WAAW,CAAC,yBAAyB,CAAC,EAC9C,aAAa,WAAW,CAAC,kBAAkB,CAAC,KAC3C,YAAY,EAuEd,CAAA"}
|
|
@@ -5,9 +5,14 @@ import { buildSafeBodyRequest } from "@scalar/helpers/http/can-method-have-body"
|
|
|
5
5
|
/**
|
|
6
6
|
* Maps API reference configuration callbacks to client plugins.
|
|
7
7
|
*
|
|
8
|
-
* This function transforms the
|
|
9
|
-
* into the new plugin hook system. The mapping is reactive, so changes
|
|
10
|
-
* configuration will automatically update the plugin hooks.
|
|
8
|
+
* This function transforms the onBeforeRequest, onRequestBuilt, and onRequestSent
|
|
9
|
+
* callbacks into the new plugin hook system. The mapping is reactive, so changes
|
|
10
|
+
* to the configuration will automatically update the plugin hooks.
|
|
11
|
+
*
|
|
12
|
+
* Note: onRequestBuilt is mapped to the requestBuilt hook so the callback receives
|
|
13
|
+
* the exact fetch Request that is sent over the wire. Mutating its headers modifies
|
|
14
|
+
* the outgoing request, and hashing its body produces a hash that matches what the
|
|
15
|
+
* server receives (a rebuilt multipart body would get a different boundary).
|
|
11
16
|
*
|
|
12
17
|
* Note: onRequestSent is mapped to responseReceived hook. This is not a perfect
|
|
13
18
|
* one-to-one mapping, but it maintains backward compatibility with the old API.
|
|
@@ -21,9 +26,10 @@ var mapConfigPlugins = (config, environment) => {
|
|
|
21
26
|
const plugin = { hooks: {} };
|
|
22
27
|
watch([
|
|
23
28
|
() => config.value.onBeforeRequest,
|
|
29
|
+
() => config.value.onRequestBuilt,
|
|
24
30
|
() => config.value.onRequestSent,
|
|
25
31
|
() => environment.value
|
|
26
|
-
], ([onBeforeRequest, onRequestSent, environment]) => {
|
|
32
|
+
], ([onBeforeRequest, onRequestBuilt, onRequestSent, environment]) => {
|
|
27
33
|
const envVariables = getEnvironmentVariables(environment);
|
|
28
34
|
if (!plugin.hooks) plugin.hooks = {};
|
|
29
35
|
plugin.hooks.beforeRequest = onBeforeRequest ? async (payload) => {
|
|
@@ -42,6 +48,18 @@ var mapConfigPlugins = (config, environment) => {
|
|
|
42
48
|
});
|
|
43
49
|
} : void 0;
|
|
44
50
|
/**
|
|
51
|
+
* Maps onRequestBuilt to the requestBuilt hook. The payload request is the
|
|
52
|
+
* exact fetch Request that will be sent, so header mutations apply and body
|
|
53
|
+
* hashes match what goes over the wire.
|
|
54
|
+
*/
|
|
55
|
+
plugin.hooks.requestBuilt = onRequestBuilt ? async (payload) => {
|
|
56
|
+
await onRequestBuilt({
|
|
57
|
+
request: payload.request,
|
|
58
|
+
requestBuilder: payload.requestBuilder,
|
|
59
|
+
envVariables
|
|
60
|
+
});
|
|
61
|
+
} : void 0;
|
|
62
|
+
/**
|
|
45
63
|
* Maps onRequestSent to responseReceived hook.
|
|
46
64
|
* The old API only passed the URL string, so we extract it from the request.
|
|
47
65
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-config-plugins.js","names":[],"sources":["../../src/helpers/map-config-plugins.ts"],"sourcesContent":["import { buildSafeBodyRequest } from '@scalar/helpers/http/can-method-have-body'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { ApiReferenceConfiguration } from '@scalar/types/api-reference'\nimport { buildRequest, getEnvironmentVariables } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type ComputedRef, watch } from 'vue'\n\n/**\n * Maps API reference configuration callbacks to client plugins.\n *\n * This function transforms the
|
|
1
|
+
{"version":3,"file":"map-config-plugins.js","names":[],"sources":["../../src/helpers/map-config-plugins.ts"],"sourcesContent":["import { buildSafeBodyRequest } from '@scalar/helpers/http/can-method-have-body'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { ApiReferenceConfiguration } from '@scalar/types/api-reference'\nimport { buildRequest, getEnvironmentVariables } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type ComputedRef, watch } from 'vue'\n\n/**\n * Maps API reference configuration callbacks to client plugins.\n *\n * This function transforms the onBeforeRequest, onRequestBuilt, and onRequestSent\n * callbacks into the new plugin hook system. The mapping is reactive, so changes\n * to the configuration will automatically update the plugin hooks.\n *\n * Note: onRequestBuilt is mapped to the requestBuilt hook so the callback receives\n * the exact fetch Request that is sent over the wire. Mutating its headers modifies\n * the outgoing request, and hashing its body produces a hash that matches what the\n * server receives (a rebuilt multipart body would get a different boundary).\n *\n * Note: onRequestSent is mapped to responseReceived hook. This is not a perfect\n * one-to-one mapping, but it maintains backward compatibility with the old API.\n * The old callback receives only the URL string, while the new hook receives\n * the full response object.\n *\n * @param config - Reactive configuration object containing optional hook callbacks\n * @returns Array containing a single plugin with the mapped hooks\n */\nexport const mapConfigPlugins = (\n config: ComputedRef<ApiReferenceConfiguration>,\n environment: ComputedRef<XScalarEnvironment>,\n): ClientPlugin[] => {\n // Create a new plugin with the hooks which is going to be updated by the watcher when config changes\n const plugin: ClientPlugin = { hooks: {} }\n\n watch(\n [\n () => config.value.onBeforeRequest,\n () => config.value.onRequestBuilt,\n () => config.value.onRequestSent,\n () => environment.value,\n ],\n ([onBeforeRequest, onRequestBuilt, onRequestSent, environment]) => {\n // Get the environment variables for the current environment\n const envVariables = getEnvironmentVariables(environment)\n\n // Initialize the hooks object if it doesn't exist\n if (!plugin.hooks) {\n plugin.hooks = {}\n }\n\n plugin.hooks.beforeRequest = onBeforeRequest\n ? async (payload) => {\n const built = buildRequest(payload.requestBuilder, {\n envVariables,\n allowMissingRequestServerBase: true,\n })\n if (!built.ok) {\n console.error(\n '[@scalar/api-reference] onBeforeRequest was not run because the request could not be built:',\n built.message ?? built.error,\n )\n return\n }\n await onBeforeRequest({\n // We need to build the request to get the fetch `Request`\n request: buildSafeBodyRequest(...built.data.requestPayload),\n requestBuilder: payload.requestBuilder,\n envVariables,\n })\n }\n : undefined\n\n /**\n * Maps onRequestBuilt to the requestBuilt hook. The payload request is the\n * exact fetch Request that will be sent, so header mutations apply and body\n * hashes match what goes over the wire.\n */\n plugin.hooks.requestBuilt = onRequestBuilt\n ? async (payload) => {\n await onRequestBuilt({\n request: payload.request,\n requestBuilder: payload.requestBuilder,\n envVariables,\n })\n }\n : undefined\n\n /**\n * Maps onRequestSent to responseReceived hook.\n * The old API only passed the URL string, so we extract it from the request.\n */\n plugin.hooks.responseReceived = onRequestSent\n ? (payload) => {\n onRequestSent(payload.request.url)\n }\n : undefined\n },\n { immediate: true },\n )\n\n return [plugin]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAa,oBACX,QACA,gBACmB;CAEnB,MAAM,SAAuB,EAAE,OAAO,EAAE,EAAE;AAE1C,OACE;QACQ,OAAO,MAAM;QACb,OAAO,MAAM;QACb,OAAO,MAAM;QACb,YAAY;EACnB,GACA,CAAC,iBAAiB,gBAAgB,eAAe,iBAAiB;EAEjE,MAAM,eAAe,wBAAwB,YAAY;AAGzD,MAAI,CAAC,OAAO,MACV,QAAO,QAAQ,EAAE;AAGnB,SAAO,MAAM,gBAAgB,kBACzB,OAAO,YAAY;GACjB,MAAM,QAAQ,aAAa,QAAQ,gBAAgB;IACjD;IACA,+BAA+B;IAChC,CAAC;AACF,OAAI,CAAC,MAAM,IAAI;AACb,YAAQ,MACN,+FACA,MAAM,WAAW,MAAM,MACxB;AACD;;AAEF,SAAM,gBAAgB;IAEpB,SAAS,qBAAqB,GAAG,MAAM,KAAK,eAAe;IAC3D,gBAAgB,QAAQ;IACxB;IACD,CAAC;MAEJ,KAAA;;;;;;AAOJ,SAAO,MAAM,eAAe,iBACxB,OAAO,YAAY;AACjB,SAAM,eAAe;IACnB,SAAS,QAAQ;IACjB,gBAAgB,QAAQ;IACxB;IACD,CAAC;MAEJ,KAAA;;;;;AAMJ,SAAO,MAAM,mBAAmB,iBAC3B,YAAY;AACX,iBAAc,QAAQ,QAAQ,IAAI;MAEpC,KAAA;IAEN,EAAE,WAAW,MAAM,CACpB;AAED,QAAO,CAAC,OAAO"}
|