@scalar/blocks 0.7.3 → 0.8.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 +29 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +1 -2
- package/dist/code-example/components/AsyncApiCodeExample.vue.js +1 -2
- package/dist/code-example/components/AsyncApiCodeExample.vue.js.map +1 -1
- package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-example/components/CodeExample.vue.d.ts +2 -0
- package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
- package/dist/code-example/components/CodeExample.vue.js +4 -5
- package/dist/code-example/components/CodeExample.vue.js.map +1 -1
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +102 -100
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-example/components/ExamplePicker.vue.js +1 -2
- package/dist/code-example/components/ExamplePicker.vue.js.map +1 -1
- package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/code-example/components/HttpMethod.vue.js +1 -2
- package/dist/code-example/components/HttpMethod.vue.js.map +1 -1
- package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/code-example/helpers/filter-clients-by-query.js +1 -2
- package/dist/code-example/helpers/find-client.js +1 -2
- package/dist/code-example/helpers/format-language.js +1 -2
- package/dist/code-example/helpers/generate-client-options.js +1 -2
- package/dist/code-example/helpers/generate-code-snippet.d.ts +2 -1
- package/dist/code-example/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/code-example/helpers/generate-code-snippet.js +11 -11
- package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
- package/dist/code-example/helpers/get-asyncapi-example-context.js +1 -2
- package/dist/code-example/helpers/get-clients.js +8 -9
- package/dist/code-example/helpers/get-custom-code-samples.js +1 -2
- package/dist/code-example/helpers/get-generated-payload-example.js +1 -2
- package/dist/code-example/helpers/get-message-example-content.js +1 -2
- package/dist/code-example/helpers/get-secrets.js +1 -2
- package/dist/code-example/helpers/get-snippet.js +1 -2
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts +2 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.js +32 -31
- package/dist/code-example/helpers/operation-to-har/operation-to-har.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts +2 -2
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.js +80 -52
- package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts +2 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.js +65 -58
- package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-security-schemes.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-security-schemes.js +31 -28
- package/dist/code-example/helpers/operation-to-har/process-security-schemes.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-server-url.js +1 -2
- package/dist/code-example/index.js +10 -10
- package/dist/code-example/mount-asyncapi.js +7 -8
- package/dist/code-example/mount.js +5 -6
- package/dist/constants.js +2 -3
- package/dist/schema/LinkButton.vue.js +1 -2
- package/dist/schema/RenderString.vue.js +1 -2
- package/dist/schema/RenderString.vue.js.map +1 -1
- package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/Schema.vue.js +4 -5
- package/dist/schema/Schema.vue.js.map +1 -1
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +67 -68
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaCollapsedPreview.vue.js +1 -2
- package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -1
- package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaComposition.vue.js +4 -5
- package/dist/schema/SchemaComposition.vue.js.map +1 -1
- package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js +26 -27
- package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem.vue.js +1 -2
- package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaEnums.vue.js +4 -5
- package/dist/schema/SchemaEnums.vue.js.map +1 -1
- package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js +12 -13
- package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaGlyphPuck.vue.js +1 -2
- package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -1
- package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaGutterToggle.vue.js +1 -2
- package/dist/schema/SchemaGutterToggle.vue.js.map +1 -1
- package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaHeading.vue.js +4 -5
- package/dist/schema/SchemaHeading.vue.js.map +1 -1
- package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +1 -2
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
- package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaObjectProperties.vue.js +1 -2
- package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaProperty.vue.js +4 -5
- package/dist/schema/SchemaProperty.vue.js.map +1 -1
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +48 -49
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyDefault.vue.js +4 -5
- package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js +9 -10
- package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyDetail.vue.js +4 -5
- package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyExamples.vue.js +4 -5
- package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js +18 -19
- package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.js +4 -5
- package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +101 -102
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyPattern.vue.js +4 -5
- package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaRailPanel.vue.js +1 -2
- package/dist/schema/SchemaRailPanel.vue.js.map +1 -1
- package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/components/CopyLinkButton.vue.js +1 -2
- package/dist/schema/components/CopyLinkButton.vue.js.map +1 -1
- package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/components/WithBreadcrumb.vue.js +1 -2
- package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -1
- package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/discriminator-metadata.js +1 -2
- package/dist/schema/helpers/dynamic-scope.js +1 -2
- package/dist/schema/helpers/format-example.js +1 -2
- package/dist/schema/helpers/format-value.js +1 -2
- package/dist/schema/helpers/get-compositions-to-render.js +19 -20
- package/dist/schema/helpers/get-discriminator-values.js +1 -2
- package/dist/schema/helpers/get-enum-values.js +1 -2
- package/dist/schema/helpers/get-property-description.js +1 -2
- package/dist/schema/helpers/get-ref-name.js +1 -2
- package/dist/schema/helpers/get-rendered-example.js +1 -2
- package/dist/schema/helpers/get-schema-type.js +1 -2
- package/dist/schema/helpers/get-type-signature-tokens.d.ts +2 -2
- package/dist/schema/helpers/get-type-signature-tokens.d.ts.map +1 -1
- package/dist/schema/helpers/get-type-signature-tokens.js +3 -4
- package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -1
- package/dist/schema/helpers/has-complex-array-items.js +1 -2
- package/dist/schema/helpers/index.js +13 -13
- package/dist/schema/helpers/is-empty-schema-object.js +1 -2
- package/dist/schema/helpers/is-model-linkable.js +1 -2
- package/dist/schema/helpers/is-on-schema-target-path.js +1 -2
- package/dist/schema/helpers/is-type-object.js +1 -2
- package/dist/schema/helpers/merge-all-of-schemas.js +1 -2
- package/dist/schema/helpers/normalize-object-composition.js +1 -2
- package/dist/schema/helpers/optimize-value-for-display.js +1 -2
- package/dist/schema/helpers/partition-all-of-compositions.js +1 -2
- package/dist/schema/helpers/schema-composition.js +1 -2
- package/dist/schema/helpers/schema-cycle.js +1 -2
- package/dist/schema/helpers/schema-expansion.js +1 -2
- package/dist/schema/helpers/schema-keyboard-nav.js +1 -2
- package/dist/schema/helpers/schema-name.js +2 -3
- package/dist/schema/helpers/schema-name.js.map +1 -1
- package/dist/schema/helpers/should-display-description.js +1 -2
- package/dist/schema/helpers/should-display-heading.js +1 -2
- package/dist/schema/helpers/should-render-array-item-composition.js +1 -2
- package/dist/schema/helpers/sort-property-names.js +1 -2
- package/dist/schema/helpers/unwrap-for-read.js +1 -2
- package/dist/schema/index.js +8 -8
- package/dist/schema/localization/index.js +1 -2
- package/dist/schema/localization/locales/ar.js +1 -2
- package/dist/schema/localization/locales/de.js +1 -2
- package/dist/schema/localization/locales/en.js +1 -2
- package/dist/schema/localization/locales/es.js +1 -2
- package/dist/schema/localization/locales/fr.js +1 -2
- package/dist/schema/localization/locales/pt.js +1 -2
- package/dist/schema/localization/locales/ru.js +1 -2
- package/dist/schema/localization/locales/zh-cn.js +1 -2
- package/dist/schema/localization/locales/zh-tw.js +1 -2
- package/dist/schema/localization/translations.js +1 -2
- package/dist/schema/protobuf-metadata.js +1 -2
- package/dist/schema/recursive-metadata.js +1 -2
- package/dist/schema/request-body-composition-index.js +1 -2
- package/dist/shared/Badge.vue.d.ts.map +1 -1
- package/dist/shared/Badge.vue.js +4 -5
- package/dist/shared/Badge.vue.js.map +1 -1
- package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js +2 -3
- package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/shared/ExternalDocs.vue.js +1 -2
- package/dist/shared/ExternalDocs.vue.js.map +1 -1
- package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/shared/ScreenReader.vue.js +1 -2
- package/dist/shared/ScreenReader.vue.js.map +1 -1
- package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/shared/index.js +4 -4
- package/dist/specification-extensions/ExtensionValue.vue.js +1 -2
- package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -1
- package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js +5 -6
- package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/specification-extensions/SpecificationExtensions.vue.js +1 -2
- package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -1
- package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/style.css +42 -22
- package/dist/vue-styles.css +1 -1
- package/package.json +24 -24
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AVAILABLE_CLIENTS as e } from "@scalar/snippetz";
|
|
2
|
-
|
|
2
|
+
// src/code-example/helpers/find-client.ts
|
|
3
3
|
var t = "shell/curl", n = (t) => e.includes(t), r = (e) => n(e) || typeof e == "string" && e.startsWith("custom/"), i = (e, t) => {
|
|
4
4
|
let n = (t) => {
|
|
5
5
|
for (let n of e) {
|
|
@@ -14,7 +14,6 @@ var t = "shell/curl", n = (t) => e.includes(t), r = (e) => n(e) || typeof e == "
|
|
|
14
14
|
}
|
|
15
15
|
return r || (n("shell/curl") ?? e[0]?.options[0]);
|
|
16
16
|
};
|
|
17
|
-
//#endregion
|
|
18
17
|
export { t as DEFAULT_CLIENT, i as findClient, n as isClient, r as isSelectedClient };
|
|
19
18
|
|
|
20
19
|
//# sourceMappingURL=find-client.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { capitalize as e } from "@scalar/helpers/string/capitalize";
|
|
2
|
-
|
|
2
|
+
// src/code-example/helpers/format-language.ts
|
|
3
3
|
var t = {
|
|
4
4
|
c: "C",
|
|
5
5
|
clojure: "Clojure",
|
|
@@ -50,7 +50,6 @@ var t = {
|
|
|
50
50
|
}, n = (n) => {
|
|
51
51
|
if (n) return t[n.toLowerCase()] ?? e(n);
|
|
52
52
|
};
|
|
53
|
-
//#endregion
|
|
54
53
|
export { n as formatLanguage };
|
|
55
54
|
|
|
56
55
|
//# sourceMappingURL=format-language.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { capitalize as e } from "vue";
|
|
2
2
|
import { AVAILABLE_CLIENTS as t, snippetz as n } from "@scalar/snippetz";
|
|
3
|
-
|
|
3
|
+
// src/code-example/helpers/generate-client-options.ts
|
|
4
4
|
var r = (e) => {
|
|
5
5
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
6
6
|
return e.map((e) => {
|
|
@@ -37,7 +37,6 @@ var r = (e) => {
|
|
|
37
37
|
};
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
//#endregion
|
|
41
40
|
export { i as generateClientOptions, r as getCustomClientIds };
|
|
42
41
|
|
|
43
42
|
//# sourceMappingURL=generate-client-options.js.map
|
|
@@ -30,11 +30,12 @@ type GenerateCodeSnippetProps = {
|
|
|
30
30
|
/** Selected oneOf/anyOf variants for nested request body example generation. */
|
|
31
31
|
/** Originating OpenAPI version, used for XML mapping rules. */
|
|
32
32
|
openapiVersion?: string;
|
|
33
|
+
jsonSchemaDialect?: string;
|
|
33
34
|
requestBodyCompositionSelection?: Record<string, number>;
|
|
34
35
|
/** Whether to disable parameters by default. */
|
|
35
36
|
defaultDisabledParameters?: boolean;
|
|
36
37
|
};
|
|
37
38
|
/** Generate the code snippet for the selected example OR operation, or null when a linked sample is unavailable. */
|
|
38
|
-
export declare const generateCodeSnippet: ({ clientId, customCodeSamples, includeDefaultHeaders, operation, method, path, example, contentType, server, securitySchemes, globalCookies, openapiVersion, requestBodyCompositionSelection, defaultDisabledParameters, }: GenerateCodeSnippetProps) => string | null;
|
|
39
|
+
export declare const generateCodeSnippet: ({ clientId, customCodeSamples, includeDefaultHeaders, operation, method, path, example, contentType, server, securitySchemes, globalCookies, openapiVersion, jsonSchemaDialect, requestBodyCompositionSelection, defaultDisabledParameters, }: GenerateCodeSnippetProps) => string | null;
|
|
39
40
|
export {};
|
|
40
41
|
//# sourceMappingURL=generate-code-snippet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,kBAAkB,CAAA;AAE3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAA;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEjH,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,2BAA2B,CAAA;AAKvF,KAAK,wBAAwB,GAAG;IAC9B,wGAAwG;IACxG,QAAQ,EAAE,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAA;IAC1D,qFAAqF;IACrF,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,mFAAmF;IACnF,iBAAiB,EAAE,WAAW,EAAE,CAAA;IAChC,0EAA0E;IAC1E,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAA;IACd,wEAAwE;IACxE,SAAS,EAAE,eAAe,CAAA;IAC1B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,iFAAiF;IACjF,eAAe,EAAE,0BAA0B,EAAE,CAAA;IAC7C,mEAAmE;IACnE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mCAAmC;IACnC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B,qFAAqF;IACrF,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,gFAAgF;IAChF,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxD,gDAAgD;IAChD,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC,CAAA;AAED,oHAAoH;AACpH,eAAO,MAAM,mBAAmB,GAAI,
|
|
1
|
+
{"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,kBAAkB,CAAA;AAE3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAA;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEjH,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,2BAA2B,CAAA;AAKvF,KAAK,wBAAwB,GAAG;IAC9B,wGAAwG;IACxG,QAAQ,EAAE,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAA;IAC1D,qFAAqF;IACrF,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,mFAAmF;IACnF,iBAAiB,EAAE,WAAW,EAAE,CAAA;IAChC,0EAA0E;IAC1E,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAA;IACd,wEAAwE;IACxE,SAAS,EAAE,eAAe,CAAA;IAC1B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,iFAAiF;IACjF,eAAe,EAAE,0BAA0B,EAAE,CAAA;IAC7C,mEAAmE;IACnE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mCAAmC;IACnC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B,qFAAqF;IACrF,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,gFAAgF;IAChF,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxD,gDAAgD;IAChD,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC,CAAA;AAED,oHAAoH;AACpH,eAAO,MAAM,mBAAmB,GAAI,+OAgBjC,wBAAwB,KAAG,MAAM,GAAG,IAqDtC,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getCustomClientIds as e } from "./generate-client-options.js";
|
|
2
2
|
import { getSnippet as t } from "./get-snippet.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { operationToHar as n } from "./operation-to-har/operation-to-har.js";
|
|
4
|
+
import { CookieSerializationError as r } from "./operation-to-har/process-parameters.js";
|
|
5
5
|
import { getResolvedRef as i } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
6
|
-
|
|
7
|
-
var a = ({ clientId: a, customCodeSamples: o, includeDefaultHeaders: s = !1, operation: c, method: l, path: u, example: d, contentType: f, server: p, securitySchemes: m, globalCookies: h, openapiVersion: g,
|
|
6
|
+
// src/code-example/helpers/generate-code-snippet.ts
|
|
7
|
+
var a = ({ clientId: a, customCodeSamples: o, includeDefaultHeaders: s = !1, operation: c, method: l, path: u, example: d, contentType: f, server: p, securitySchemes: m, globalCookies: h, openapiVersion: g, jsonSchemaDialect: _, requestBodyCompositionSelection: v, defaultDisabledParameters: y }) => {
|
|
8
8
|
try {
|
|
9
9
|
if (!a) return "";
|
|
10
10
|
if (a.startsWith("custom")) {
|
|
@@ -16,7 +16,7 @@ var a = ({ clientId: a, customCodeSamples: o, includeDefaultHeaders: s = !1, ope
|
|
|
16
16
|
let r = i(c.requestBody)?.content ?? {}, s = f ?? Object.keys(r)[0], l = d ?? Object.keys(r[s ?? ""]?.examples ?? {})[0], u = n.find((e) => e.example === l && e.contentType === s) ?? n.find((e) => e.example === l && e.contentType === void 0);
|
|
17
17
|
return typeof u?.source == "string" ? u.source : null;
|
|
18
18
|
}
|
|
19
|
-
let
|
|
19
|
+
let r = n({
|
|
20
20
|
operation: c,
|
|
21
21
|
contentType: f,
|
|
22
22
|
method: l,
|
|
@@ -27,15 +27,15 @@ var a = ({ clientId: a, customCodeSamples: o, includeDefaultHeaders: s = !1, ope
|
|
|
27
27
|
globalCookies: h,
|
|
28
28
|
includeDefaultHeaders: s,
|
|
29
29
|
openapiVersion: g,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
jsonSchemaDialect: _,
|
|
31
|
+
requestBodyCompositionSelection: v,
|
|
32
|
+
defaultDisabledParameters: y
|
|
33
|
+
}), [b, x] = a.split("/"), [S, C] = t(b, x, r);
|
|
34
|
+
return S ? (console.error("[generateCodeSnippet]", S), S.message ?? "Error generating code snippet") : C;
|
|
34
35
|
} catch (e) {
|
|
35
|
-
return console.error("[generateCodeSnippet]", e), e instanceof
|
|
36
|
+
return console.error("[generateCodeSnippet]", e), e instanceof r ? e.message : "Error generating code snippet";
|
|
36
37
|
}
|
|
37
38
|
};
|
|
38
|
-
//#endregion
|
|
39
39
|
export { a as generateCodeSnippet };
|
|
40
40
|
|
|
41
41
|
//# sourceMappingURL=generate-code-snippet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-code-snippet.js","names":["generateCodeSnippet","clientId","ids","getCustomClientIds","customCodeSamples","samples","index","sample","source","content","getResolvedRef","operation","mediaType","contentType","exampleKey","example","harRequest","operationToHar","targetKey","clientKey","error","payload","getSnippet","CookieSerializationError"],"sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"sourcesContent":["import type { AvailableClient, ClientId, TargetId } from '@scalar/snippetz'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { type CustomCodeSampleId, getCustomClientIds } from './generate-client-options'\nimport { getSnippet } from './get-snippet'\nimport { operationToHar } from './operation-to-har/operation-to-har'\nimport { CookieSerializationError } from './operation-to-har/process-parameters'\n\ntype GenerateCodeSnippetProps = {\n /** The selected client/language for code generation (e.g., 'node/fetch') or a custom code sample ID. */\n clientId: AvailableClient | CustomCodeSampleId | undefined\n /** The Content-Type header value for the request body (e.g., 'application/json'). */\n contentType: string | undefined\n /** Array of custom code samples defined in the OpenAPI x-codeSamples extension. */\n customCodeSamples: XCodeSample[]\n /** The specific example value to use when generating the code snippet. */\n example: string | undefined\n /** The HTTP method for the operation (e.g., GET, POST, PUT). */\n method: string\n /** The OpenAPI operation object containing request/response details. */\n operation: OperationObject\n /** The API endpoint path (e.g., '/users/{id}'). */\n path: string\n /** Array of security schemes to apply to the request (e.g., API keys, OAuth). */\n securitySchemes: SecuritySchemeObjectSecret[]\n /** The server object defining the base URL for the API request. */\n server: ServerObject | null\n /** Workspace + document cookies */\n globalCookies?: XScalarCookie[]\n /** Whether to include default headers (e.g., Accept, Content-Type) automatically. */\n includeDefaultHeaders?: boolean\n /** Selected oneOf/anyOf variants for nested request body example generation. */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n requestBodyCompositionSelection?: Record<string, number>\n /** Whether to disable parameters by default. */\n defaultDisabledParameters?: boolean\n}\n\n/** Generate the code snippet for the selected example OR operation, or null when a linked sample is unavailable. */\nexport const generateCodeSnippet = ({\n clientId,\n customCodeSamples,\n includeDefaultHeaders = false,\n operation,\n method,\n path,\n example,\n contentType,\n server,\n securitySchemes,\n globalCookies,\n openapiVersion,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n}: GenerateCodeSnippetProps): string | null => {\n try {\n if (!clientId) {\n return ''\n }\n\n // Use the selected custom example, matched by its language-keyed id\n if (clientId.startsWith('custom')) {\n const ids = getCustomClientIds(customCodeSamples)\n const samples = customCodeSamples.filter((_, index) => ids[index] === clientId)\n if (!samples.some((sample) => sample.example !== undefined)) {\n const source = samples[0]?.source\n return typeof source === 'object' ? null : (source ?? 'Custom example not found')\n }\n\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const mediaType = contentType ?? Object.keys(content)[0]\n const exampleKey = example ?? Object.keys(content[mediaType ?? '']?.examples ?? {})[0]\n const sample =\n samples.find((sample) => sample.example === exampleKey && sample.contentType === mediaType) ??\n samples.find((sample) => sample.example === exampleKey && sample.contentType === undefined)\n return typeof sample?.source === 'string' ? sample.source : null\n }\n\n const harRequest = operationToHar({\n operation,\n contentType,\n method,\n path,\n server,\n securitySchemes,\n example,\n globalCookies,\n includeDefaultHeaders,\n openapiVersion,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n })\n\n const [targetKey, clientKey] = clientId.split('/') as [TargetId, ClientId<TargetId>]\n\n const [error, payload] = getSnippet(targetKey, clientKey, harRequest)\n if (error) {\n console.error('[generateCodeSnippet]', error)\n return error.message ?? 'Error generating code snippet'\n }\n\n return payload\n } catch (error) {\n console.error('[generateCodeSnippet]', error)\n return error instanceof CookieSerializationError ? error.message : 'Error generating code snippet'\n }\n}\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"generate-code-snippet.js","names":["generateCodeSnippet","clientId","ids","getCustomClientIds","customCodeSamples","samples","index","sample","source","content","getResolvedRef","operation","mediaType","contentType","exampleKey","example","harRequest","operationToHar","targetKey","clientKey","error","payload","getSnippet","CookieSerializationError"],"sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"sourcesContent":["import type { AvailableClient, ClientId, TargetId } from '@scalar/snippetz'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { type CustomCodeSampleId, getCustomClientIds } from './generate-client-options'\nimport { getSnippet } from './get-snippet'\nimport { operationToHar } from './operation-to-har/operation-to-har'\nimport { CookieSerializationError } from './operation-to-har/process-parameters'\n\ntype GenerateCodeSnippetProps = {\n /** The selected client/language for code generation (e.g., 'node/fetch') or a custom code sample ID. */\n clientId: AvailableClient | CustomCodeSampleId | undefined\n /** The Content-Type header value for the request body (e.g., 'application/json'). */\n contentType: string | undefined\n /** Array of custom code samples defined in the OpenAPI x-codeSamples extension. */\n customCodeSamples: XCodeSample[]\n /** The specific example value to use when generating the code snippet. */\n example: string | undefined\n /** The HTTP method for the operation (e.g., GET, POST, PUT). */\n method: string\n /** The OpenAPI operation object containing request/response details. */\n operation: OperationObject\n /** The API endpoint path (e.g., '/users/{id}'). */\n path: string\n /** Array of security schemes to apply to the request (e.g., API keys, OAuth). */\n securitySchemes: SecuritySchemeObjectSecret[]\n /** The server object defining the base URL for the API request. */\n server: ServerObject | null\n /** Workspace + document cookies */\n globalCookies?: XScalarCookie[]\n /** Whether to include default headers (e.g., Accept, Content-Type) automatically. */\n includeDefaultHeaders?: boolean\n /** Selected oneOf/anyOf variants for nested request body example generation. */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n requestBodyCompositionSelection?: Record<string, number>\n /** Whether to disable parameters by default. */\n defaultDisabledParameters?: boolean\n}\n\n/** Generate the code snippet for the selected example OR operation, or null when a linked sample is unavailable. */\nexport const generateCodeSnippet = ({\n clientId,\n customCodeSamples,\n includeDefaultHeaders = false,\n operation,\n method,\n path,\n example,\n contentType,\n server,\n securitySchemes,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n}: GenerateCodeSnippetProps): string | null => {\n try {\n if (!clientId) {\n return ''\n }\n\n // Use the selected custom example, matched by its language-keyed id\n if (clientId.startsWith('custom')) {\n const ids = getCustomClientIds(customCodeSamples)\n const samples = customCodeSamples.filter((_, index) => ids[index] === clientId)\n if (!samples.some((sample) => sample.example !== undefined)) {\n const source = samples[0]?.source\n return typeof source === 'object' ? null : (source ?? 'Custom example not found')\n }\n\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const mediaType = contentType ?? Object.keys(content)[0]\n const exampleKey = example ?? Object.keys(content[mediaType ?? '']?.examples ?? {})[0]\n const sample =\n samples.find((sample) => sample.example === exampleKey && sample.contentType === mediaType) ??\n samples.find((sample) => sample.example === exampleKey && sample.contentType === undefined)\n return typeof sample?.source === 'string' ? sample.source : null\n }\n\n const harRequest = operationToHar({\n operation,\n contentType,\n method,\n path,\n server,\n securitySchemes,\n example,\n globalCookies,\n includeDefaultHeaders,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n })\n\n const [targetKey, clientKey] = clientId.split('/') as [TargetId, ClientId<TargetId>]\n\n const [error, payload] = getSnippet(targetKey, clientKey, harRequest)\n if (error) {\n console.error('[generateCodeSnippet]', error)\n return error.message ?? 'Error generating code snippet'\n }\n\n return payload\n } catch (error) {\n console.error('[generateCodeSnippet]', error)\n return error instanceof CookieSerializationError ? error.message : 'Error generating code snippet'\n }\n}\n"],"mappings":";;;;;;AA6CA,IAAaA,KAAuB,EAClC,aACA,sBACA,2BAAwB,IACxB,cACA,WACA,SACA,YACA,gBACA,WACA,oBACA,kBACA,mBACA,sBACA,oCACA,mCAC6C;CAC7C,IAAI;EACF,IAAI,CAACC,GACH,OAAO;EAIT,IAAIA,EAAS,WAAW,QAAQ,GAAG;GACjC,IAAMC,IAAMC,EAAmBC,CAAiB,GAC1CC,IAAUD,EAAkB,QAAQ,GAAG,MAAUF,EAAII,OAAWL,CAAQ;GAC9E,IAAI,CAACI,EAAQ,MAAM,MAAWE,EAAO,YAAY,KAAA,CAAS,GAAG;IAC3D,IAAMC,IAASH,EAAQ,EAAE,EAAE;IAC3B,OAAO,OAAOG,KAAW,WAAW,OAAQA,KAAU;GACxD;GAEA,IAAMC,IAAUC,EAAeC,EAAU,WAAW,CAAC,EAAE,WAAW,CAAC,GAC7DC,IAAYC,KAAe,OAAO,KAAKJ,CAAO,CAAC,CAAC,IAChDK,IAAaC,KAAW,OAAO,KAAKN,EAAQG,KAAa,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,IAC9EL,IACJF,EAAQ,MAAM,MAAWE,EAAO,YAAYO,KAAcP,EAAO,gBAAgBK,CAAS,KAC1FP,EAAQ,MAAM,MAAWE,EAAO,YAAYO,KAAcP,EAAO,gBAAgB,KAAA,CAAS;GAC5F,OAAO,OAAOA,GAAQ,UAAW,WAAWA,EAAO,SAAS;EAC9D;EAEA,IAAMS,IAAaC,EAAe;GAChC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC,GAEK,CAACC,GAAWC,KAAalB,EAAS,MAAM,GAAG,GAE3C,CAACmB,GAAOC,KAAWC,EAAWJ,GAAWC,GAAWH,CAAU;EAMpE,OALII,KACF,QAAQ,MAAM,yBAAyBA,CAAK,GACrCA,EAAM,WAAW,mCAGnBC;CACT,SAASD,GAAO;EAEd,OADA,QAAQ,MAAM,yBAAyBA,CAAK,GACrCA,aAAiBG,IAA2BH,EAAM,UAAU;CACrE;AACF"}
|
|
@@ -2,7 +2,7 @@ import { getResolvedAsyncApiRef as e } from "@scalar/workspace-store/helpers/get
|
|
|
2
2
|
import { getAllChannelMessages as t, resolveOperationChannel as n, resolveOperationWithTraits as r } from "@scalar/workspace-store/channel-example";
|
|
3
3
|
import { getNameFromRef as i } from "@scalar/workspace-store/helpers/get-name-from-ref";
|
|
4
4
|
import { resolveTraits as a } from "@scalar/workspace-store/helpers/resolve-traits";
|
|
5
|
-
|
|
5
|
+
// src/code-example/helpers/get-asyncapi-example-context.ts
|
|
6
6
|
var o = (o, s) => {
|
|
7
7
|
let c = e(o.operations?.[s]);
|
|
8
8
|
if (!c) return;
|
|
@@ -27,7 +27,6 @@ var o = (o, s) => {
|
|
|
27
27
|
messages: f
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
//#endregion
|
|
31
30
|
export { o as getAsyncApiExampleContext };
|
|
32
31
|
|
|
33
32
|
//# sourceMappingURL=get-asyncapi-example-context.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { formatLanguage as e } from "./format-language.js";
|
|
2
|
+
import { getCustomClientIds as t } from "./generate-client-options.js";
|
|
3
3
|
import { CODE_EXAMPLES_GROUP_LABEL as n } from "./get-custom-code-samples.js";
|
|
4
|
-
|
|
4
|
+
// src/code-example/helpers/get-clients.ts
|
|
5
5
|
var r = (r, i, a = n) => {
|
|
6
6
|
if (!r.length) return i;
|
|
7
|
-
let o =
|
|
8
|
-
for (let [
|
|
9
|
-
let r = o[
|
|
10
|
-
if (!r || o.indexOf(r) !==
|
|
7
|
+
let o = t(r), s = /* @__PURE__ */ new Map();
|
|
8
|
+
for (let [t, n] of r.entries()) {
|
|
9
|
+
let r = o[t];
|
|
10
|
+
if (!r || o.indexOf(r) !== t) continue;
|
|
11
11
|
let i = typeof n.group == "string" && n.group.trim() || a, c = s.get(i) ?? {
|
|
12
12
|
label: i,
|
|
13
13
|
key: "custom",
|
|
14
14
|
options: []
|
|
15
|
-
}, l = n.label ||
|
|
15
|
+
}, l = n.label || e(n.lang) || r;
|
|
16
16
|
c.options.push({
|
|
17
17
|
id: r,
|
|
18
18
|
lang: n.lang || "plaintext",
|
|
@@ -23,7 +23,6 @@ var r = (r, i, a = n) => {
|
|
|
23
23
|
}
|
|
24
24
|
return [...s.values(), ...i];
|
|
25
25
|
};
|
|
26
|
-
//#endregion
|
|
27
26
|
export { r as getClients };
|
|
28
27
|
|
|
29
28
|
//# sourceMappingURL=get-clients.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/code-example/helpers/get-custom-code-samples.ts
|
|
2
2
|
var e = (e, t) => Object.entries(e ?? {}).map(([e, n]) => ({
|
|
3
3
|
lang: e,
|
|
4
4
|
source: n,
|
|
@@ -36,7 +36,6 @@ var e = (e, t) => Object.entries(e ?? {}).map(([e, n]) => ({
|
|
|
36
36
|
].flatMap((e) => a[e] ?? [])
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
-
//#endregion
|
|
40
39
|
export { i as CODE_EXAMPLES_GROUP_LABEL, a as getCustomCodeSamples };
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=get-custom-code-samples.js.map
|
|
@@ -3,7 +3,7 @@ import { isObject as t } from "@scalar/helpers/object/is-object";
|
|
|
3
3
|
import { resolveAsyncApiSchema as n } from "@scalar/workspace-store/helpers/resolve-async-api-schema";
|
|
4
4
|
import { snapshotSchema as r } from "@scalar/workspace-store/helpers/snapshot-schema";
|
|
5
5
|
import { getExampleFromSchema as i } from "@scalar/workspace-store/request-example";
|
|
6
|
-
|
|
6
|
+
// src/code-example/helpers/get-generated-payload-example.ts
|
|
7
7
|
var a = (n, r = /* @__PURE__ */ new Set()) => {
|
|
8
8
|
let i = e(n);
|
|
9
9
|
return i === !1 ? !0 : !t(i) || r.has(i) ? !1 : (r.add(i), Array.isArray(i.allOf) && i.allOf.some((e) => a(e, r)));
|
|
@@ -16,7 +16,6 @@ var a = (n, r = /* @__PURE__ */ new Set()) => {
|
|
|
16
16
|
let u = r(l);
|
|
17
17
|
return i(u, { emptyString: "string" });
|
|
18
18
|
};
|
|
19
|
-
//#endregion
|
|
20
19
|
export { o as getGeneratedPayloadExample };
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=get-generated-payload-example.js.map
|
|
@@ -3,7 +3,7 @@ import { isJsonMediaType as t } from "@scalar/helpers/http/is-json-media-type";
|
|
|
3
3
|
import { isXmlMediaType as n } from "@scalar/helpers/http/is-xml-media-type";
|
|
4
4
|
import { parseMimeType as r } from "@scalar/helpers/http/mime-type";
|
|
5
5
|
import { prettyPrintJson as i } from "@scalar/helpers/json/pretty-print-json";
|
|
6
|
-
|
|
6
|
+
// src/code-example/helpers/get-message-example-content.ts
|
|
7
7
|
var a = (a, o) => {
|
|
8
8
|
if (a === void 0) return;
|
|
9
9
|
let s = o === void 0 || t(o), c = Array.isArray(a) || e(a), l = !s && c, { subtype: u } = r(o), d = s || l ? "json" : n(o) ? "xml" : u === "yaml" || u === "x-yaml" || u.endsWith("+yaml") ? "yaml" : "plaintext";
|
|
@@ -23,7 +23,6 @@ var a = (a, o) => {
|
|
|
23
23
|
structural: l
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
//#endregion
|
|
27
26
|
export { a as getMessageExampleContent };
|
|
28
27
|
|
|
29
28
|
//# sourceMappingURL=get-message-example-content.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { encode as e } from "js-base64";
|
|
2
|
-
|
|
2
|
+
// src/code-example/helpers/get-secrets.ts
|
|
3
3
|
var t = (t) => t.flatMap((t) => t.type === "apiKey" ? t["x-scalar-secret-token"] : t?.type === "http" ? [
|
|
4
4
|
t["x-scalar-secret-token"],
|
|
5
5
|
t["x-scalar-secret-username"],
|
|
6
6
|
t["x-scalar-secret-password"],
|
|
7
7
|
e(`${t["x-scalar-secret-username"]}:${t["x-scalar-secret-password"]}`)
|
|
8
8
|
] : t.type === "oauth2" ? Object.values(t.flows).map((e) => e["x-scalar-secret-token"]) : []).filter(Boolean);
|
|
9
|
-
//#endregion
|
|
10
9
|
export { t as getSecrets };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=get-secrets.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { snippetz as e } from "@scalar/snippetz";
|
|
2
|
-
|
|
2
|
+
// src/code-example/helpers/get-snippet.ts
|
|
3
3
|
var t = "ws://replace.me", n = (n, r, i) => {
|
|
4
4
|
try {
|
|
5
5
|
if (!i.url) return [/* @__PURE__ */ Error("Please enter a URL to see a code snippet"), null];
|
|
@@ -23,7 +23,6 @@ var t = "ws://replace.me", n = (n, r, i) => {
|
|
|
23
23
|
}
|
|
24
24
|
return [/* @__PURE__ */ Error("No snippet found"), null];
|
|
25
25
|
};
|
|
26
|
-
//#endregion
|
|
27
26
|
export { n as getSnippet };
|
|
28
27
|
|
|
29
28
|
//# sourceMappingURL=get-snippet.js.map
|
|
@@ -40,6 +40,7 @@ export type OperationToHarProps = {
|
|
|
40
40
|
*/
|
|
41
41
|
/** Originating OpenAPI version, used for version-specific serialization. */
|
|
42
42
|
openapiVersion?: string;
|
|
43
|
+
jsonSchemaDialect?: string;
|
|
43
44
|
requestBodyCompositionSelection?: Record<string, number>;
|
|
44
45
|
/**
|
|
45
46
|
* Whether to disable parameters by default.
|
|
@@ -69,5 +70,5 @@ export type OperationToHarProps = {
|
|
|
69
70
|
* @see https://w3c.github.io/web-performance/specs/HAR/Overview.html
|
|
70
71
|
* @see https://spec.openapis.org/oas/v3.1.0#operation-object
|
|
71
72
|
*/
|
|
72
|
-
export declare const operationToHar: ({ includeDefaultHeaders, operation, contentType, method, path, server, example, securitySchemes, globalCookies, openapiVersion, requestBodyCompositionSelection, defaultDisabledParameters, }: OperationToHarProps) => HarRequest;
|
|
73
|
+
export declare const operationToHar: ({ includeDefaultHeaders, operation, contentType, method, path, server, example, securitySchemes, globalCookies, openapiVersion, jsonSchemaDialect, requestBodyCompositionSelection, defaultDisabledParameters, }: OperationToHarProps) => HarRequest;
|
|
73
74
|
//# sourceMappingURL=operation-to-har.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-to-har.d.ts","sourceRoot":"","sources":["../../../../src/code-example/helpers/operation-to-har/operation-to-har.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,0BAA0B,EAIhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AACjH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AASvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,+BAA+B;IAC/B,SAAS,EAAE,eAAe,CAAA;IAC1B,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,0BAA0B,EAAE,CAAA;IAC9C,mCAAmC;IACnC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;;OAGG;IACH,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxD;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI
|
|
1
|
+
{"version":3,"file":"operation-to-har.d.ts","sourceRoot":"","sources":["../../../../src/code-example/helpers/operation-to-har/operation-to-har.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,0BAA0B,EAIhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AACjH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AASvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,+BAA+B;IAC/B,SAAS,EAAE,eAAe,CAAA;IAC1B,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,0BAA0B,EAAE,CAAA;IAC9C,mCAAmC;IACnC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;;OAGG;IACH,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxD;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,kNAc5B,mBAAmB,KAAG,UA+JxB,CAAA"}
|
|
@@ -6,9 +6,9 @@ import { processServerUrl as i } from "./process-server-url.js";
|
|
|
6
6
|
import { filterGlobalCookie as a, getDefaultHeaders as o, restoreConventionalDefaultHeaderNames as s } from "@scalar/workspace-store/request-example";
|
|
7
7
|
import { getResolvedRef as c } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
8
8
|
import { isElectron as l } from "@scalar/helpers/general/is-electron";
|
|
9
|
-
|
|
10
|
-
var u = ({ includeDefaultHeaders: u = !1, operation: d, contentType: f, method: p, path: m, server: h = null, example: g, securitySchemes: _, globalCookies: v, openapiVersion: y,
|
|
11
|
-
let
|
|
9
|
+
// src/code-example/helpers/operation-to-har/operation-to-har.ts
|
|
10
|
+
var u = ({ includeDefaultHeaders: u = !1, operation: d, contentType: f, method: p, path: m, server: h = null, example: g, securitySchemes: _, globalCookies: v, openapiVersion: y, jsonSchemaDialect: b, requestBodyCompositionSelection: x, defaultDisabledParameters: S = !1 }) => {
|
|
11
|
+
let C = u ? o({
|
|
12
12
|
method: p,
|
|
13
13
|
operation: d,
|
|
14
14
|
exampleName: g ?? "default",
|
|
@@ -18,10 +18,10 @@ var u = ({ includeDefaultHeaders: u = !1, operation: d, contentType: f, method:
|
|
|
18
18
|
isElectron: l(),
|
|
19
19
|
appVersion: e
|
|
20
20
|
}
|
|
21
|
-
}) : {},
|
|
21
|
+
}) : {}, w = s(C), T = d["x-scalar-disable-parameters"]?.["global-cookies"]?.[g ?? "default"] ?? {}, E = {
|
|
22
22
|
method: p,
|
|
23
23
|
url: i(h, m),
|
|
24
|
-
headers: Object.entries(
|
|
24
|
+
headers: Object.entries(w).map(([e, t]) => ({
|
|
25
25
|
name: e,
|
|
26
26
|
value: t
|
|
27
27
|
})),
|
|
@@ -31,61 +31,62 @@ var u = ({ includeDefaultHeaders: u = !1, operation: d, contentType: f, method:
|
|
|
31
31
|
cookies: [],
|
|
32
32
|
headersSize: -1,
|
|
33
33
|
bodySize: -1
|
|
34
|
-
},
|
|
34
|
+
}, D = !1, O = !1;
|
|
35
35
|
if (d.parameters) {
|
|
36
36
|
let { url: e, headers: t, queryString: r, cookies: i, hasCookieStyleEntries: o, hasSerializedQuery: s } = n({
|
|
37
|
-
harRequest:
|
|
37
|
+
harRequest: E,
|
|
38
38
|
parameters: d.parameters,
|
|
39
39
|
openapiVersion: y,
|
|
40
|
+
jsonSchemaDialect: b,
|
|
40
41
|
example: g,
|
|
41
|
-
defaultDisabled:
|
|
42
|
+
defaultDisabled: S
|
|
42
43
|
}), c = v?.filter((t) => a({
|
|
43
44
|
cookie: t,
|
|
44
45
|
url: e,
|
|
45
|
-
disabledGlobalCookies:
|
|
46
|
+
disabledGlobalCookies: T
|
|
46
47
|
}))?.map((e) => ({
|
|
47
48
|
name: e.name,
|
|
48
49
|
value: e.value
|
|
49
50
|
})) ?? [];
|
|
50
|
-
|
|
51
|
+
D = o, O = s ?? !1, E.url = e, E.headers = t, E.queryString = r, E.cookies = [...c, ...i];
|
|
51
52
|
}
|
|
52
|
-
let
|
|
53
|
-
if (
|
|
53
|
+
let k = c(d.requestBody);
|
|
54
|
+
if (k?.content) {
|
|
54
55
|
let e = t({
|
|
55
|
-
requestBody:
|
|
56
|
+
requestBody: k,
|
|
56
57
|
contentType: f,
|
|
57
58
|
example: g,
|
|
58
59
|
openapiVersion: y,
|
|
59
|
-
|
|
60
|
+
jsonSchemaDialect: b,
|
|
61
|
+
requestBodyCompositionSelection: x
|
|
60
62
|
});
|
|
61
|
-
if (e && (
|
|
62
|
-
let t =
|
|
63
|
-
t && (!t.value || e.mimeType.startsWith("multipart/") && e.mimeType.includes("boundary=") && e.text !== void 0) ? t.value = e.mimeType : t ||
|
|
63
|
+
if (e && (E.postData = e, E.bodySize = e.text?.length ?? -1, e.mimeType)) {
|
|
64
|
+
let t = E.headers.find((e) => e.name.toLowerCase() === "content-type");
|
|
65
|
+
t && (!t.value || e.mimeType.startsWith("multipart/") && e.mimeType.includes("boundary=") && e.text !== void 0) ? t.value = e.mimeType : t || E.headers.push({
|
|
64
66
|
name: "Content-Type",
|
|
65
67
|
value: e.mimeType
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
|
-
let
|
|
71
|
+
let A = O || d.parameters?.some((e) => c(e)?.in === "querystring");
|
|
70
72
|
if (_) {
|
|
71
73
|
let { headers: e, queryString: t, cookies: n } = r(_);
|
|
72
|
-
|
|
74
|
+
E.headers.push(...e), E.queryString.push(...t), E.cookies.push(...n);
|
|
73
75
|
}
|
|
74
|
-
let
|
|
75
|
-
if (
|
|
76
|
-
let e =
|
|
77
|
-
|
|
76
|
+
let j = E.headers.find((e) => e.name.toLowerCase() === "cookie");
|
|
77
|
+
if (D && j && E.cookies.length) {
|
|
78
|
+
let e = E.cookies.map((e) => `${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`).join("; ");
|
|
79
|
+
j.value = j.value ? `${j.value}; ${e}` : e, E.cookies = [];
|
|
78
80
|
}
|
|
79
|
-
if (
|
|
80
|
-
let e =
|
|
81
|
-
|
|
81
|
+
if (A && E.queryString.length) {
|
|
82
|
+
let e = E.url.indexOf("#"), t = e === -1 ? "" : E.url.slice(e), n = e === -1 ? E.url : E.url.slice(0, e), r = E.queryString.map(({ name: e, value: t }) => `${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&");
|
|
83
|
+
E.url = `${n}${n.includes("?") ? "&" : "?"}${r}${t}`, E.queryString = [];
|
|
82
84
|
}
|
|
83
|
-
|
|
84
|
-
let
|
|
85
|
-
for (let e of
|
|
86
|
-
return
|
|
85
|
+
E.postData?.mimeType === "multipart/form-data" && E.postData.params?.length && (E.headers = E.headers.filter((e) => e.name.toLowerCase() !== "content-type"));
|
|
86
|
+
let M = 0;
|
|
87
|
+
for (let e of E.headers) M += (e.name?.length ?? 0) + 2 + (e.value?.length ?? 0) + 2;
|
|
88
|
+
return E.headersSize = M, E;
|
|
87
89
|
};
|
|
88
|
-
//#endregion
|
|
89
90
|
export { u as operationToHar };
|
|
90
91
|
|
|
91
92
|
//# sourceMappingURL=operation-to-har.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-to-har.js","names":["operationToHar","defaultHeaders","includeDefaultHeaders","getDefaultHeaders","example","isElectron","APP_VERSION","defaultHeadersWithConventionalNames","restoreConventionalDefaultHeaderNames","disabledGlobalCookies","operation","harRequest","processServerUrl","server","path","name","value","hasCookieStyleEntries","hasSerializedQuery","processedCookieStyleEntries","processedSerializedQuery","processParameters","defaultDisabledParameters","filteredGlobalCookies","globalCookies","filterGlobalCookie","cookie","url","headers","queryString","cookies","body","getResolvedRef","postData","processBody","existingContentTypeHeader","header","hasUriReadyQuery","parameter","securitySchemes","processSecuritySchemes","cookieHeader","extraCookies","hashIndex","hash","query","headersSize","h"],"sources":["../../../../src/code-example/helpers/operation-to-har/operation-to-har.ts"],"sourcesContent":["import { isElectron } from '@scalar/helpers/general/is-electron'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n type SecuritySchemeObjectSecret,\n filterGlobalCookie,\n getDefaultHeaders,\n restoreConventionalDefaultHeaderNames,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport type { Request as HarRequest } from 'har-format'\n\nimport { APP_VERSION } from '@/constants'\n\nimport { processBody } from './process-body'\nimport { processParameters } from './process-parameters'\nimport { processSecuritySchemes } from './process-security-schemes'\nimport { processServerUrl } from './process-server-url'\n\nexport type OperationToHarProps = {\n /** OpenAPI Operation object */\n operation: OperationObject\n /** HTTP method of the operation */\n method: string\n /** Path of the operation */\n path: string\n /**\n * Name of the currently selected operation example\n *\n * Applies to both the body and the parameters\n */\n example?: string\n /**\n * Content type of the operation\n *\n * Applies to both the body and the parameters (if applicable)\n * @defaults to the first content type in the MediaTypeObject\n */\n contentType?: string\n /** OpenAPI Server object */\n server?: ServerObject | null\n /** OpenAPI SecurityScheme objects which are applicable to the operation */\n securitySchemes?: SecuritySchemeObjectSecret[]\n /** Workspace + document cookies */\n globalCookies?: XScalarCookie[]\n /**\n * Whether to include default headers (e.g., Accept, Content-Type) automatically.\n * If false, default headers will be omitted from the HAR request.\n * @default true\n */\n includeDefaultHeaders?: boolean\n /**\n * Selected oneOf/anyOf variants for nested request body example generation\n * (e.g. from the schema dropdowns in the API reference).\n */\n /** Originating OpenAPI version, used for version-specific serialization. */\n openapiVersion?: string\n requestBodyCompositionSelection?: Record<string, number>\n /**\n * Whether to disable parameters by default.\n * @default false\n */\n defaultDisabledParameters?: boolean\n}\n\n/**\n * Converts an OpenAPI Operation to a HarRequest format for generating HTTP request snippets.\n *\n * This function transforms OpenAPI 3.1 operation objects into HAR (HTTP Archive) format requests,\n * which can be used to generate code snippets for various programming languages and HTTP clients.\n *\n * The conversion handles:\n * - Server URL processing and path parameter substitution\n * - Query parameter formatting based on OpenAPI parameter styles\n * - Request body processing with content type handling\n * - Security scheme integration (API keys, etc.)\n *\n * The resulting HarRequest object follows the HAR specification and includes:\n * - HTTP method and URL\n * - Headers and query parameters\n * - Request body (if present)\n * - Cookie information\n * - Size calculations for headers and body\n *\n * @see https://w3c.github.io/web-performance/specs/HAR/Overview.html\n * @see https://spec.openapis.org/oas/v3.1.0#operation-object\n */\nexport const operationToHar = ({\n includeDefaultHeaders = false,\n operation,\n contentType,\n method,\n path,\n server = null,\n example,\n securitySchemes,\n globalCookies,\n openapiVersion,\n requestBodyCompositionSelection,\n defaultDisabledParameters = false,\n}: OperationToHarProps): HarRequest => {\n const defaultHeaders = includeDefaultHeaders\n ? getDefaultHeaders({\n method,\n operation,\n exampleName: example ?? 'default',\n hideDisabledHeaders: true,\n hideOverriddenHeaders: true,\n options: { isElectron: isElectron(), appVersion: APP_VERSION },\n })\n : {}\n const defaultHeadersWithConventionalNames = restoreConventionalDefaultHeaderNames(defaultHeaders)\n\n const disabledGlobalCookies =\n operation['x-scalar-disable-parameters']?.['global-cookies']?.[example ?? 'default'] ?? {}\n\n const serverUrl = processServerUrl(server, path)\n\n // Initialize the HAR request with basic properties\n const harRequest: HarRequest = {\n method,\n url: serverUrl,\n headers: Object.entries(defaultHeadersWithConventionalNames).map(([name, value]) => ({ name, value })),\n queryString: [],\n postData: undefined,\n httpVersion: 'HTTP/1.1',\n cookies: [],\n headersSize: -1,\n bodySize: -1,\n }\n\n let hasCookieStyleEntries = false\n let hasSerializedQuery = false\n\n // Handle parameters\n if (operation.parameters) {\n const {\n url,\n headers,\n queryString,\n cookies,\n hasCookieStyleEntries: processedCookieStyleEntries,\n hasSerializedQuery: processedSerializedQuery,\n } = processParameters({\n harRequest,\n parameters: operation.parameters,\n openapiVersion,\n example,\n defaultDisabled: defaultDisabledParameters,\n })\n\n // Correctly filter the global cookies by the processed url\n const filteredGlobalCookies =\n globalCookies\n ?.filter((cookie) => filterGlobalCookie({ cookie, url, disabledGlobalCookies }))\n ?.map((cookie) => ({ name: cookie.name, value: cookie.value })) ?? []\n\n hasCookieStyleEntries = processedCookieStyleEntries\n hasSerializedQuery = processedSerializedQuery ?? false\n harRequest.url = url\n harRequest.headers = headers\n harRequest.queryString = queryString\n harRequest.cookies = [...filteredGlobalCookies, ...cookies]\n }\n\n const body = getResolvedRef(operation.requestBody)\n\n // Handle request body\n if (body?.content) {\n const postData = processBody({\n requestBody: body,\n contentType,\n example,\n openapiVersion,\n requestBodyCompositionSelection,\n })\n\n if (postData) {\n harRequest.postData = postData\n harRequest.bodySize = postData.text?.length ?? -1\n\n // Add or update Content-Type header\n if (postData.mimeType) {\n const existingContentTypeHeader = harRequest.headers.find(\n (header) => header.name.toLowerCase() === 'content-type',\n )\n // Update existing header if it has an empty value\n if (\n existingContentTypeHeader &&\n (!existingContentTypeHeader.value ||\n (postData.mimeType.startsWith('multipart/') &&\n postData.mimeType.includes('boundary=') &&\n postData.text !== undefined))\n ) {\n existingContentTypeHeader.value = postData.mimeType\n }\n // Add new header if none exists\n else if (!existingContentTypeHeader) {\n harRequest.headers.push({\n name: 'Content-Type',\n value: postData.mimeType,\n })\n }\n }\n }\n }\n\n const hasUriReadyQuery =\n hasSerializedQuery || operation.parameters?.some((parameter) => getResolvedRef(parameter)?.in === 'querystring')\n\n // Handle security schemes\n if (securitySchemes) {\n const { headers, queryString, cookies } = processSecuritySchemes(securitySchemes)\n harRequest.headers.push(...headers)\n harRequest.queryString.push(...queryString)\n harRequest.cookies.push(...cookies)\n }\n\n // Keep authentication and global cookies in the explicit header as well, so\n // snippet generators cannot replace cookie-style parameters with their own header.\n const cookieHeader = harRequest.headers.find((header) => header.name.toLowerCase() === 'cookie')\n if (hasCookieStyleEntries && cookieHeader && harRequest.cookies.length) {\n const extraCookies = harRequest.cookies\n .map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`)\n .join('; ')\n cookieHeader.value = cookieHeader.value ? `${cookieHeader.value}; ${extraCookies}` : extraCookies\n harRequest.cookies = []\n }\n\n // Whole-query content and serialized examples must retain their authored URI encoding.\n // Keeping all query data in the URL avoids snippet generators introducing a second question mark.\n if (hasUriReadyQuery && harRequest.queryString.length) {\n const hashIndex = harRequest.url.indexOf('#')\n const hash = hashIndex === -1 ? '' : harRequest.url.slice(hashIndex)\n const url = hashIndex === -1 ? harRequest.url : harRequest.url.slice(0, hashIndex)\n const query = harRequest.queryString\n .map(({ name, value }) => `${encodeURIComponent(name)}=${encodeURIComponent(value)}`)\n .join('&')\n harRequest.url = `${url}${url.includes('?') ? '&' : '?'}${query}${hash}`\n harRequest.queryString = []\n }\n\n // Structured multipart parts (with or without files) are encoded by the HTTP client, which owns the boundary.\n // Raw multipart text already has its boundary and must retain its Content-Type.\n if (harRequest.postData?.mimeType === 'multipart/form-data' && harRequest.postData.params?.length) {\n harRequest.headers = harRequest.headers.filter((header) => header.name.toLowerCase() !== 'content-type')\n }\n\n // Calculate headers size without allocating a large joined string\n let headersSize = 0\n for (const h of harRequest.headers) {\n // name + \": \" + value + \"\\r\\n\"\n headersSize += (h.name?.length ?? 0) + 2 + (h.value?.length ?? 0) + 2\n }\n harRequest.headersSize = headersSize\n\n return harRequest\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"operation-to-har.js","names":["operationToHar","defaultHeaders","includeDefaultHeaders","getDefaultHeaders","example","isElectron","APP_VERSION","defaultHeadersWithConventionalNames","restoreConventionalDefaultHeaderNames","disabledGlobalCookies","operation","harRequest","processServerUrl","server","path","name","value","hasCookieStyleEntries","hasSerializedQuery","processedCookieStyleEntries","processedSerializedQuery","processParameters","defaultDisabledParameters","filteredGlobalCookies","globalCookies","filterGlobalCookie","cookie","url","headers","queryString","cookies","body","getResolvedRef","postData","processBody","existingContentTypeHeader","header","hasUriReadyQuery","parameter","securitySchemes","processSecuritySchemes","cookieHeader","extraCookies","hashIndex","hash","query","headersSize","h"],"sources":["../../../../src/code-example/helpers/operation-to-har/operation-to-har.ts"],"sourcesContent":["import { isElectron } from '@scalar/helpers/general/is-electron'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n type SecuritySchemeObjectSecret,\n filterGlobalCookie,\n getDefaultHeaders,\n restoreConventionalDefaultHeaderNames,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport type { Request as HarRequest } from 'har-format'\n\nimport { APP_VERSION } from '@/constants'\n\nimport { processBody } from './process-body'\nimport { processParameters } from './process-parameters'\nimport { processSecuritySchemes } from './process-security-schemes'\nimport { processServerUrl } from './process-server-url'\n\nexport type OperationToHarProps = {\n /** OpenAPI Operation object */\n operation: OperationObject\n /** HTTP method of the operation */\n method: string\n /** Path of the operation */\n path: string\n /**\n * Name of the currently selected operation example\n *\n * Applies to both the body and the parameters\n */\n example?: string\n /**\n * Content type of the operation\n *\n * Applies to both the body and the parameters (if applicable)\n * @defaults to the first content type in the MediaTypeObject\n */\n contentType?: string\n /** OpenAPI Server object */\n server?: ServerObject | null\n /** OpenAPI SecurityScheme objects which are applicable to the operation */\n securitySchemes?: SecuritySchemeObjectSecret[]\n /** Workspace + document cookies */\n globalCookies?: XScalarCookie[]\n /**\n * Whether to include default headers (e.g., Accept, Content-Type) automatically.\n * If false, default headers will be omitted from the HAR request.\n * @default true\n */\n includeDefaultHeaders?: boolean\n /**\n * Selected oneOf/anyOf variants for nested request body example generation\n * (e.g. from the schema dropdowns in the API reference).\n */\n /** Originating OpenAPI version, used for version-specific serialization. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n requestBodyCompositionSelection?: Record<string, number>\n /**\n * Whether to disable parameters by default.\n * @default false\n */\n defaultDisabledParameters?: boolean\n}\n\n/**\n * Converts an OpenAPI Operation to a HarRequest format for generating HTTP request snippets.\n *\n * This function transforms OpenAPI 3.1 operation objects into HAR (HTTP Archive) format requests,\n * which can be used to generate code snippets for various programming languages and HTTP clients.\n *\n * The conversion handles:\n * - Server URL processing and path parameter substitution\n * - Query parameter formatting based on OpenAPI parameter styles\n * - Request body processing with content type handling\n * - Security scheme integration (API keys, etc.)\n *\n * The resulting HarRequest object follows the HAR specification and includes:\n * - HTTP method and URL\n * - Headers and query parameters\n * - Request body (if present)\n * - Cookie information\n * - Size calculations for headers and body\n *\n * @see https://w3c.github.io/web-performance/specs/HAR/Overview.html\n * @see https://spec.openapis.org/oas/v3.1.0#operation-object\n */\nexport const operationToHar = ({\n includeDefaultHeaders = false,\n operation,\n contentType,\n method,\n path,\n server = null,\n example,\n securitySchemes,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n defaultDisabledParameters = false,\n}: OperationToHarProps): HarRequest => {\n const defaultHeaders = includeDefaultHeaders\n ? getDefaultHeaders({\n method,\n operation,\n exampleName: example ?? 'default',\n hideDisabledHeaders: true,\n hideOverriddenHeaders: true,\n options: { isElectron: isElectron(), appVersion: APP_VERSION },\n })\n : {}\n const defaultHeadersWithConventionalNames = restoreConventionalDefaultHeaderNames(defaultHeaders)\n\n const disabledGlobalCookies =\n operation['x-scalar-disable-parameters']?.['global-cookies']?.[example ?? 'default'] ?? {}\n\n const serverUrl = processServerUrl(server, path)\n\n // Initialize the HAR request with basic properties\n const harRequest: HarRequest = {\n method,\n url: serverUrl,\n headers: Object.entries(defaultHeadersWithConventionalNames).map(([name, value]) => ({ name, value })),\n queryString: [],\n postData: undefined,\n httpVersion: 'HTTP/1.1',\n cookies: [],\n headersSize: -1,\n bodySize: -1,\n }\n\n let hasCookieStyleEntries = false\n let hasSerializedQuery = false\n\n // Handle parameters\n if (operation.parameters) {\n const {\n url,\n headers,\n queryString,\n cookies,\n hasCookieStyleEntries: processedCookieStyleEntries,\n hasSerializedQuery: processedSerializedQuery,\n } = processParameters({\n harRequest,\n parameters: operation.parameters,\n openapiVersion,\n jsonSchemaDialect,\n example,\n defaultDisabled: defaultDisabledParameters,\n })\n\n // Correctly filter the global cookies by the processed url\n const filteredGlobalCookies =\n globalCookies\n ?.filter((cookie) => filterGlobalCookie({ cookie, url, disabledGlobalCookies }))\n ?.map((cookie) => ({ name: cookie.name, value: cookie.value })) ?? []\n\n hasCookieStyleEntries = processedCookieStyleEntries\n hasSerializedQuery = processedSerializedQuery ?? false\n harRequest.url = url\n harRequest.headers = headers\n harRequest.queryString = queryString\n harRequest.cookies = [...filteredGlobalCookies, ...cookies]\n }\n\n const body = getResolvedRef(operation.requestBody)\n\n // Handle request body\n if (body?.content) {\n const postData = processBody({\n requestBody: body,\n contentType,\n example,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n })\n\n if (postData) {\n harRequest.postData = postData\n harRequest.bodySize = postData.text?.length ?? -1\n\n // Add or update Content-Type header\n if (postData.mimeType) {\n const existingContentTypeHeader = harRequest.headers.find(\n (header) => header.name.toLowerCase() === 'content-type',\n )\n // Update existing header if it has an empty value\n if (\n existingContentTypeHeader &&\n (!existingContentTypeHeader.value ||\n (postData.mimeType.startsWith('multipart/') &&\n postData.mimeType.includes('boundary=') &&\n postData.text !== undefined))\n ) {\n existingContentTypeHeader.value = postData.mimeType\n }\n // Add new header if none exists\n else if (!existingContentTypeHeader) {\n harRequest.headers.push({\n name: 'Content-Type',\n value: postData.mimeType,\n })\n }\n }\n }\n }\n\n const hasUriReadyQuery =\n hasSerializedQuery || operation.parameters?.some((parameter) => getResolvedRef(parameter)?.in === 'querystring')\n\n // Handle security schemes\n if (securitySchemes) {\n const { headers, queryString, cookies } = processSecuritySchemes(securitySchemes)\n harRequest.headers.push(...headers)\n harRequest.queryString.push(...queryString)\n harRequest.cookies.push(...cookies)\n }\n\n // Keep authentication and global cookies in the explicit header as well, so\n // snippet generators cannot replace cookie-style parameters with their own header.\n const cookieHeader = harRequest.headers.find((header) => header.name.toLowerCase() === 'cookie')\n if (hasCookieStyleEntries && cookieHeader && harRequest.cookies.length) {\n const extraCookies = harRequest.cookies\n .map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`)\n .join('; ')\n cookieHeader.value = cookieHeader.value ? `${cookieHeader.value}; ${extraCookies}` : extraCookies\n harRequest.cookies = []\n }\n\n // Whole-query content and serialized examples must retain their authored URI encoding.\n // Keeping all query data in the URL avoids snippet generators introducing a second question mark.\n if (hasUriReadyQuery && harRequest.queryString.length) {\n const hashIndex = harRequest.url.indexOf('#')\n const hash = hashIndex === -1 ? '' : harRequest.url.slice(hashIndex)\n const url = hashIndex === -1 ? harRequest.url : harRequest.url.slice(0, hashIndex)\n const query = harRequest.queryString\n .map(({ name, value }) => `${encodeURIComponent(name)}=${encodeURIComponent(value)}`)\n .join('&')\n harRequest.url = `${url}${url.includes('?') ? '&' : '?'}${query}${hash}`\n harRequest.queryString = []\n }\n\n // Structured multipart parts (with or without files) are encoded by the HTTP client, which owns the boundary.\n // Raw multipart text already has its boundary and must retain its Content-Type.\n if (harRequest.postData?.mimeType === 'multipart/form-data' && harRequest.postData.params?.length) {\n harRequest.headers = harRequest.headers.filter((header) => header.name.toLowerCase() !== 'content-type')\n }\n\n // Calculate headers size without allocating a large joined string\n let headersSize = 0\n for (const h of harRequest.headers) {\n // name + \": \" + value + \"\\r\\n\"\n headersSize += (h.name?.length ?? 0) + 2 + (h.value?.length ?? 0) + 2\n }\n harRequest.headersSize = headersSize\n\n return harRequest\n}\n"],"mappings":"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"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { RequestBodyObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
2
2
|
import type { PostData } from 'har-format';
|
|
3
3
|
import type { OperationToHarProps } from './operation-to-har';
|
|
4
|
-
type ProcessBodyProps = Pick<OperationToHarProps, 'contentType' | 'example' | 'requestBodyCompositionSelection' | 'openapiVersion'> & {
|
|
4
|
+
type ProcessBodyProps = Pick<OperationToHarProps, 'contentType' | 'example' | 'requestBodyCompositionSelection' | 'openapiVersion' | 'jsonSchemaDialect'> & {
|
|
5
5
|
requestBody: RequestBodyObject;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
8
|
* Processes the request body and returns the processed data
|
|
9
9
|
* Returns undefined if no example is found
|
|
10
10
|
*/
|
|
11
|
-
export declare const processBody: ({ requestBody, contentType, example, openapiVersion, requestBodyCompositionSelection, }: ProcessBodyProps) => PostData | undefined;
|
|
11
|
+
export declare const processBody: ({ requestBody, contentType, example, openapiVersion, jsonSchemaDialect, requestBodyCompositionSelection, }: ProcessBodyProps) => PostData | undefined;
|
|
12
12
|
export {};
|
|
13
13
|
//# sourceMappingURL=process-body.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-body.d.ts","sourceRoot":"","sources":["../../../../src/code-example/helpers/operation-to-har/process-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-body.d.ts","sourceRoot":"","sources":["../../../../src/code-example/helpers/operation-to-har/process-body.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,8DAA8D,CAAA;AAErE,OAAO,KAAK,EAAS,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,KAAK,gBAAgB,GAAG,IAAI,CAC1B,mBAAmB,EACnB,aAAa,GAAG,SAAS,GAAG,iCAAiC,GAAG,gBAAgB,GAAG,mBAAmB,CACvG,GAAG;IACF,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AA0LD;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,4GAOzB,gBAAgB,KAAG,QAAQ,GAAG,SA0KhC,CAAA"}
|