@scalar/api-client 3.23.6 → 3.25.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 +27 -0
- package/dist/plugins/posthog/sanitize-event-payload.d.ts.map +1 -1
- package/dist/plugins/posthog/sanitize-event-payload.js +1 -0
- package/dist/plugins/posthog/sanitize-event-payload.js.map +1 -1
- package/dist/style.css +97 -69
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/v2/blocks/operation-block/OperationBlock.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue_vue_type_script_setup_true_lang.js +10 -7
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +4 -0
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.js +36 -23
- package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +2 -0
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue_vue_type_script_setup_true_lang.js +15 -0
- package/dist/v2/blocks/request-block/RequestBlock.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts +8 -2
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue_vue_type_script_setup_true_lang.js +88 -31
- package/dist/v2/blocks/request-block/components/RequestBody.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts +3 -1
- package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyForm.vue_vue_type_script_setup_true_lang.js +20 -5
- package/dist/v2/blocks/request-block/components/RequestBodyForm.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyMultipart.vue.d.ts +15 -0
- package/dist/v2/blocks/request-block/components/RequestBodyMultipart.vue.d.ts.map +1 -0
- package/dist/v2/blocks/request-block/components/RequestBodyMultipart.vue.js +7 -0
- package/dist/v2/blocks/request-block/components/RequestBodyMultipart.vue.js.map +1 -0
- package/dist/v2/blocks/request-block/components/RequestBodyMultipart.vue_vue_type_script_setup_true_lang.js +156 -0
- package/dist/v2/blocks/request-block/components/RequestBodyMultipart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -0
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue_vue_type_script_setup_true_lang.js +6 -0
- package/dist/v2/blocks/request-block/components/RequestTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +4 -0
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue_vue_type_script_setup_true_lang.js +10 -3
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts +2 -2
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +8 -4
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/multipart-body.d.ts +18 -0
- package/dist/v2/blocks/request-block/helpers/multipart-body.d.ts.map +1 -0
- package/dist/v2/blocks/request-block/helpers/multipart-body.js +80 -0
- package/dist/v2/blocks/request-block/helpers/multipart-body.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue_vue_type_script_setup_true_lang.js +12 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +6 -2
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/localization/locales/ar.d.ts +5 -0
- package/dist/v2/features/localization/locales/ar.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/ar.js +5 -0
- package/dist/v2/features/localization/locales/ar.js.map +1 -1
- package/dist/v2/features/localization/locales/de.d.ts +5 -0
- package/dist/v2/features/localization/locales/de.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/de.js +5 -0
- package/dist/v2/features/localization/locales/de.js.map +1 -1
- package/dist/v2/features/localization/locales/es.d.ts +5 -0
- package/dist/v2/features/localization/locales/es.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/es.js +5 -0
- package/dist/v2/features/localization/locales/es.js.map +1 -1
- package/dist/v2/features/localization/locales/fr.d.ts +5 -0
- package/dist/v2/features/localization/locales/fr.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/fr.js +5 -0
- package/dist/v2/features/localization/locales/fr.js.map +1 -1
- package/dist/v2/features/localization/locales/pt.d.ts +5 -0
- package/dist/v2/features/localization/locales/pt.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/pt.js +5 -0
- package/dist/v2/features/localization/locales/pt.js.map +1 -1
- package/dist/v2/features/localization/locales/ru.d.ts +5 -0
- package/dist/v2/features/localization/locales/ru.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/ru.js +5 -0
- package/dist/v2/features/localization/locales/ru.js.map +1 -1
- package/dist/v2/features/localization/locales/zh-cn.d.ts +5 -0
- package/dist/v2/features/localization/locales/zh-cn.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/zh-cn.js +5 -0
- package/dist/v2/features/localization/locales/zh-cn.js.map +1 -1
- package/dist/v2/features/localization/locales/zh-tw.d.ts +5 -0
- package/dist/v2/features/localization/locales/zh-tw.d.ts.map +1 -1
- package/dist/v2/features/localization/locales/zh-tw.js +5 -0
- package/dist/v2/features/localization/locales/zh-tw.js.map +1 -1
- package/dist/v2/features/localization/translations.d.ts +5 -0
- package/dist/v2/features/localization/translations.d.ts.map +1 -1
- package/dist/v2/features/localization/translations.js +5 -0
- package/dist/v2/features/localization/translations.js.map +1 -1
- package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts.map +1 -1
- package/dist/v2/features/modal/helpers/resolve-route-parameters.js +2 -1
- package/dist/v2/features/modal/helpers/resolve-route-parameters.js.map +1 -1
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +1 -0
- package/dist/v2/workspace-events.js.map +1 -1
- package/dist/vue-styles.css +12 -12
- package/package.json +15 -18
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { MAX_MULTIPART_NESTING, getMultipartItemSchema } from "@scalar/workspace-store/request-example";
|
|
2
|
+
import { parseMimeType } from "@scalar/helpers/http/mime-type";
|
|
3
|
+
import { unpackProxyShallow } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
4
|
+
import { isObject } from "@scalar/helpers/object/is-object";
|
|
5
|
+
import { getExampleValue } from "@scalar/workspace-store/helpers/get-example-value";
|
|
6
|
+
import { isArraySchema } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
7
|
+
import { isFileSchema } from "@scalar/workspace-store/helpers/is-file-schema";
|
|
8
|
+
import { resolveFormSchema } from "@scalar/workspace-store/helpers/resolve-form-schema";
|
|
9
|
+
//#region src/v2/blocks/request-block/helpers/multipart-body.ts
|
|
10
|
+
/** Raw wire examples stay in the raw editor, while JSON arrays/objects can expose individual parts. */
|
|
11
|
+
var parseMultipartBody = (example) => {
|
|
12
|
+
const selected = getExampleValue(example ?? void 0);
|
|
13
|
+
if (!selected || selected.source === "serialized") return;
|
|
14
|
+
try {
|
|
15
|
+
const value = typeof selected.value === "string" ? JSON.parse(selected.value) : unpackProxyShallow(selected.value);
|
|
16
|
+
return Array.isArray(value) || isObject(value) ? value : void 0;
|
|
17
|
+
} catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
/** Match the serializer's positional and named layouts without flattening JSON parts into form fields. */
|
|
22
|
+
var getMultipartBodyParts = (value, media, compositionSelection) => {
|
|
23
|
+
const walk = (body, encoding, schema, path, schemaPath, nesting = 0) => {
|
|
24
|
+
const part = (partValue, rawSchema, partEncoding, partPath, partSchemaPath) => {
|
|
25
|
+
const partSchema = resolveFormSchema(rawSchema, compositionSelection, partSchemaPath);
|
|
26
|
+
if (nesting + 1 < MAX_MULTIPART_NESTING && parseMimeType(partEncoding?.contentType).type === "multipart" && (Array.isArray(partValue) || isObject(partValue))) return walk(partValue, partEncoding ?? {}, partSchema, partPath, partSchemaPath, nesting + 1);
|
|
27
|
+
return [{
|
|
28
|
+
path: partPath,
|
|
29
|
+
value: unpackProxyShallow(partValue),
|
|
30
|
+
schema: partSchema,
|
|
31
|
+
contentType: partEncoding?.contentType,
|
|
32
|
+
canUpload: partSchema === void 0 || !isArraySchema(partSchema) && isFileSchema(partSchema, true, partEncoding?.contentType)
|
|
33
|
+
}];
|
|
34
|
+
};
|
|
35
|
+
if (Array.isArray(body)) return (body.length === 0 && path.length > 0 && !(schema && "maxItems" in schema && schema.maxItems === 0) ? [""] : body).flatMap((item, index) => part(item, getMultipartItemSchema(schema, index, encoding.itemSchema), index < (encoding.prefixEncoding?.length ?? 0) ? encoding.prefixEncoding?.[index] : encoding.itemEncoding, [...path, index], schema && "prefixItems" in schema && schema.prefixItems?.[index] ? [
|
|
36
|
+
...schemaPath,
|
|
37
|
+
"prefixItems",
|
|
38
|
+
String(index)
|
|
39
|
+
] : [...schemaPath, "items"]));
|
|
40
|
+
return Object.entries(body).flatMap(([name, item]) => {
|
|
41
|
+
const properties = schema && "properties" in schema ? schema.properties : void 0;
|
|
42
|
+
const additional = schema && "additionalProperties" in schema ? schema.additionalProperties : void 0;
|
|
43
|
+
const propertySchema = resolveFormSchema(properties?.[name] ?? (typeof additional === "object" ? additional : void 0), compositionSelection, [...schemaPath, name]);
|
|
44
|
+
return Array.isArray(item) ? (item.length || propertySchema && "maxItems" in propertySchema && propertySchema.maxItems === 0 ? item : [""]).flatMap((entry, index) => part(entry, getMultipartItemSchema(propertySchema, index), encoding.encoding?.[name], [
|
|
45
|
+
...path,
|
|
46
|
+
name,
|
|
47
|
+
index
|
|
48
|
+
], propertySchema && "prefixItems" in propertySchema && propertySchema.prefixItems?.[index] ? [
|
|
49
|
+
...schemaPath,
|
|
50
|
+
name,
|
|
51
|
+
"prefixItems",
|
|
52
|
+
String(index)
|
|
53
|
+
] : [
|
|
54
|
+
...schemaPath,
|
|
55
|
+
name,
|
|
56
|
+
"items"
|
|
57
|
+
])) : part(item, propertySchema, encoding.encoding?.[name], [...path, name], [...schemaPath, name]);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return walk(value, media, resolveFormSchema(media.schema, compositionSelection), [], ["requestBody"]);
|
|
61
|
+
};
|
|
62
|
+
/** Copy only the edited path so uploading a file never serializes sibling File objects or mutates the example. */
|
|
63
|
+
var updateMultipartBodyPart = (body, path, value) => {
|
|
64
|
+
const update = (current, remaining) => {
|
|
65
|
+
const [key, ...rest] = remaining;
|
|
66
|
+
if (key === void 0) return value;
|
|
67
|
+
if (Array.isArray(current) && typeof key === "number") return key === current.length ? [...current, update(void 0, rest)] : current.map((item, index) => index === key ? update(item, rest) : item);
|
|
68
|
+
if (isObject(current) && Object.hasOwn(current, key)) return {
|
|
69
|
+
...current,
|
|
70
|
+
[key]: update(current[key], rest)
|
|
71
|
+
};
|
|
72
|
+
return current;
|
|
73
|
+
};
|
|
74
|
+
const result = update(body, path);
|
|
75
|
+
return Array.isArray(result) || isObject(result) ? result : body;
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
export { getMultipartBodyParts, parseMultipartBody, updateMultipartBodyPart };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=multipart-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multipart-body.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/multipart-body.ts"],"sourcesContent":["import { parseMimeType } from '@scalar/helpers/http/mime-type'\nimport { isObject } from '@scalar/helpers/object/is-object'\nimport { getExampleValue } from '@scalar/workspace-store/helpers/get-example-value'\nimport { isFileSchema } from '@scalar/workspace-store/helpers/is-file-schema'\nimport { resolveFormSchema } from '@scalar/workspace-store/helpers/resolve-form-schema'\nimport { unpackProxyShallow } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport { MAX_MULTIPART_NESTING, getMultipartItemSchema } from '@scalar/workspace-store/request-example'\nimport type {\n EncodingObject,\n ExampleObject,\n MediaTypeObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\n/** Keep structured parts and File objects intact until the existing multipart serializer runs. */\nexport type MultipartBodyValue = unknown[] | Record<string, unknown>\n\n/** One editable leaf part; paths retain positions and literal property names. */\nexport type MultipartBodyPart = {\n path: (string | number)[]\n value: unknown\n schema?: SchemaObject\n contentType?: string\n canUpload: boolean\n}\n\n/** Raw wire examples stay in the raw editor, while JSON arrays/objects can expose individual parts. */\nexport const parseMultipartBody = (example: ExampleObject | null | undefined): MultipartBodyValue | undefined => {\n const selected = getExampleValue(example ?? undefined)\n if (!selected || selected.source === 'serialized') {\n return undefined\n }\n try {\n const value: unknown =\n typeof selected.value === 'string' ? JSON.parse(selected.value) : unpackProxyShallow(selected.value)\n return Array.isArray(value) || isObject(value) ? value : undefined\n } catch {\n return undefined\n }\n}\n\n/** Match the serializer's positional and named layouts without flattening JSON parts into form fields. */\nexport const getMultipartBodyParts = (\n value: MultipartBodyValue,\n media: MediaTypeObject,\n compositionSelection?: Record<string, number>,\n): MultipartBodyPart[] => {\n const walk = (\n body: MultipartBodyValue,\n encoding: Pick<MediaTypeObject, 'encoding' | 'prefixEncoding' | 'itemEncoding' | 'itemSchema'>,\n schema: SchemaObject | undefined,\n path: (string | number)[],\n schemaPath: string[],\n nesting = 0,\n ): MultipartBodyPart[] => {\n const part = (\n partValue: unknown,\n rawSchema: SchemaObject | undefined,\n partEncoding: EncodingObject | undefined,\n partPath: (string | number)[],\n partSchemaPath: string[],\n ): MultipartBodyPart[] => {\n const partSchema = resolveFormSchema(rawSchema, compositionSelection, partSchemaPath)\n if (\n nesting + 1 < MAX_MULTIPART_NESTING &&\n parseMimeType(partEncoding?.contentType).type === 'multipart' &&\n (Array.isArray(partValue) || isObject(partValue))\n ) {\n return walk(partValue, partEncoding ?? {}, partSchema, partPath, partSchemaPath, nesting + 1)\n }\n return [\n {\n path: partPath,\n value: unpackProxyShallow(partValue),\n schema: partSchema,\n contentType: partEncoding?.contentType,\n canUpload:\n partSchema === undefined ||\n (!isArraySchema(partSchema) && isFileSchema(partSchema, true, partEncoding?.contentType)),\n },\n ]\n }\n if (Array.isArray(body)) {\n const items =\n body.length === 0 && path.length > 0 && !(schema && 'maxItems' in schema && schema.maxItems === 0) ? [''] : body\n return items.flatMap((item, index) =>\n part(\n item,\n getMultipartItemSchema(schema, index, encoding.itemSchema),\n index < (encoding.prefixEncoding?.length ?? 0) ? encoding.prefixEncoding?.[index] : encoding.itemEncoding,\n [...path, index],\n schema && 'prefixItems' in schema && schema.prefixItems?.[index]\n ? [...schemaPath, 'prefixItems', String(index)]\n : [...schemaPath, 'items'],\n ),\n )\n }\n return Object.entries(body).flatMap(([name, item]) => {\n const properties = schema && 'properties' in schema ? schema.properties : undefined\n const additional = schema && 'additionalProperties' in schema ? schema.additionalProperties : undefined\n const propertySchema = resolveFormSchema(\n properties?.[name] ?? (typeof additional === 'object' ? additional : undefined),\n compositionSelection,\n [...schemaPath, name],\n )\n return Array.isArray(item)\n ? (item.length || (propertySchema && 'maxItems' in propertySchema && propertySchema.maxItems === 0)\n ? item\n : ['']\n ).flatMap((entry, index) =>\n part(\n entry,\n getMultipartItemSchema(propertySchema, index),\n encoding.encoding?.[name],\n [...path, name, index],\n propertySchema && 'prefixItems' in propertySchema && propertySchema.prefixItems?.[index]\n ? [...schemaPath, name, 'prefixItems', String(index)]\n : [...schemaPath, name, 'items'],\n ),\n )\n : part(item, propertySchema, encoding.encoding?.[name], [...path, name], [...schemaPath, name])\n })\n }\n return walk(value, media, resolveFormSchema(media.schema, compositionSelection), [], ['requestBody'])\n}\n\n/** Copy only the edited path so uploading a file never serializes sibling File objects or mutates the example. */\nexport const updateMultipartBodyPart = (\n body: MultipartBodyValue,\n path: (string | number)[],\n value: unknown,\n): MultipartBodyValue => {\n const update = (current: unknown, remaining: (string | number)[]): unknown => {\n const [key, ...rest] = remaining\n if (key === undefined) {\n return value\n }\n if (Array.isArray(current) && typeof key === 'number') {\n return key === current.length\n ? [...current, update(undefined, rest)]\n : current.map((item, index) => (index === key ? update(item, rest) : item))\n }\n if (isObject(current) && Object.hasOwn(current, key)) {\n return { ...current, [key]: update(current[key], rest) }\n }\n return current\n }\n const result = update(body, path)\n return Array.isArray(result) || isObject(result) ? result : body\n}\n"],"mappings":";;;;;;;;;;AA4BA,IAAa,sBAAsB,YAA8E;CAC/G,MAAM,WAAW,g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AAO,MAAM,IAAI,IAAI,IAAK;EAE9E,IAAI,SAAS,OAAO,KAAK,OAAO,OAAO,SAAS,GAAG,GACjD,OAAO;GAAE,GAAG;IAAU,MAAM,OAAO,QAAQ,MAAM,IAAI;EAAE;EAEzD,OAAO;CACT;CACA,MAAM,SAAS,OAAO,MAAM,IAAI;CAChC,OAAO,MAAM,QAAQ,MAAM,KAAK,SAAS,MAAM,IAAI,SAAS;AAC9D"}
|
|
@@ -11,6 +11,8 @@ type __VLS_Props = {
|
|
|
11
11
|
eventBus: WorkspaceEventBus;
|
|
12
12
|
/** Allows adding authentication which is not in the document */
|
|
13
13
|
createAnySecurityScheme?: boolean;
|
|
14
|
+
/** Limits visible schemes without changing request authentication. */
|
|
15
|
+
allowedSecuritySchemes?: string[];
|
|
14
16
|
/**
|
|
15
17
|
* Whether schemes can be deleted from the selector. Enabled for the editable client, disabled in
|
|
16
18
|
* the read-only reference where the schemes come from the document and cannot be removed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthSelector.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthSelector.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue"],"names":[],"mappings":"AAwaA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAKnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AAGvC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EACV,eAAe,EAEf,YAAY,EACb,MAAM,8DAA8D,CAAA;AAIrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AACjG,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,gEAAgE,CAAA;AAMvE,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,gEAAgE;IAChE,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,sEAAsE;IACtE,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAA;IACjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,kEAAkE;IAClE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,6FAA6F;IAC7F,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,oBAAoB,EAAE,eAAe,CAAC,UAAU,CAAC,CAAA;IACjD,eAAe,EAAE,qBAAqB,CAAA;IACtC,gBAAgB,EAAE,gBAAgB,GAAG,SAAS,CAAA;IAC9C,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,yFAAyF;IACzF,YAAY,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;CACtC,CAAC;AA4kBF,QAAA,MAAM,YAAY;;cAniBqB,IAAI;cAAQ,MAAM;;;;oPAsiBvD,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthSelector.vue.js","names":["_sfc_main"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarButton,\n type ScalarButton as ScalarButtonType,\n} from '@scalar/components/button'\nimport { ScalarComboboxMultiselect } from '@scalar/components/combobox'\nimport type { Icon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarListboxCheckbox } from '@scalar/components/listbox'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarIconCaretDown, ScalarIconTrash } from '@scalar/icons'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type {\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n isAuthOptional,\n type MergedSecuritySchemes,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n OpenApiDocument,\n SecurityRequirementObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref, useId } from 'vue'\n\nimport DeleteRequestAuthModal from '@/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue'\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport {\n formatComplexScheme,\n formatScheme,\n getSecuritySchemeOptions,\n type SecuritySchemeOption,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { CollapsibleSection } from '@/v2/components/layout'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthDataTable from './RequestAuthDataTable.vue'\n\nconst {\n environment,\n eventBus,\n createAnySecurityScheme = false,\n canDeleteSchemes = true,\n defaultOpen = true,\n heading = true,\n hideSingleRequiredScheme = false,\n isStatic = false,\n meta,\n proxyUrl,\n securityRequirements,\n securitySchemes,\n selectedSecurity,\n server,\n title,\n options,\n documentType,\n} = defineProps<{\n environment: XScalarEnvironment\n eventBus: WorkspaceEventBus\n /** Allows adding authentication which is not in the document */\n createAnySecurityScheme?: boolean\n /**\n * Whether schemes can be deleted from the selector. Enabled for the editable client, disabled in\n * the read-only reference where the schemes come from the document and cannot be removed.\n */\n canDeleteSchemes?: boolean\n /** Whether the authentication disclosure should start expanded */\n defaultOpen?: boolean\n /**\n * Whether the title belongs in the document outline. The client renders the\n * selector as one section of a request, so it is a heading there. A surface\n * that only offers the schemes as a card of controls, such as the reference,\n * turns it off and the card is named as a group instead.\n */\n heading?: boolean\n /** Hides a sole active required choice in the reference while preserving client controls. */\n hideSingleRequiredScheme?: boolean\n /** Creates a static disclosure that cannot be collapsed */\n isStatic?: boolean\n meta: AuthMeta\n proxyUrl: string\n securityRequirements: OpenApiDocument['security']\n securitySchemes: MergedSecuritySchemes\n selectedSecurity: SelectedSecurity | undefined\n server: ServerObject | null\n title: string\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, used to label the missing-type warning */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst { translate, translations } = useLocalization()\n\nconst titleId = useId()\nconst comboboxButtonRef = ref<typeof ScalarButtonType | null>(null)\nconst isDisclosureOpen = ref(false)\n\nconst deleteModal = useModal()\nconst schemeToDelete = ref<{\n label: string\n payload: SecurityRequirementObject\n} | null>(null)\n\n/**\n * Determines if authentication is required or optional\n *\n * Auth is optional when there is an empty security requirement and no complex requirements.\n * Complex requirements have multiple auth schemes combined (e.g., API key + OAuth).\n */\nconst authIndicator = computed<{ icon: Icon; text: string } | null>(() => {\n if (!securityRequirements?.length) {\n return null\n }\n\n const isOptional = isAuthOptional(securityRequirements)\n\n return {\n icon: isOptional ? 'Unlock' : 'Lock',\n text: isOptional\n ? translate('apiClient.authSelector.optional')\n : translate('apiClient.authSelector.required'),\n }\n})\n\n/** All available auth scheme options for the dropdown */\nconst availableSchemeOptions = computed(() =>\n getSecuritySchemeOptions(\n securityRequirements ?? [],\n securitySchemes ?? {},\n selectedSecurity?.selectedSchemes ?? [],\n createAnySecurityScheme,\n translations.value.apiClient,\n ),\n)\n\n/** Currently active auth schemes selected for this operation or collection */\nconst activeSchemeOptions = computed<SecuritySchemeOption[]>(() => {\n const schemes = selectedSecurity?.selectedSchemes\n if (!schemes?.length) {\n return []\n }\n\n return schemes.flatMap((requirement) => {\n const schemeNames = Object.keys(requirement)\n\n if (schemeNames.length === 0) {\n return []\n }\n\n // Complex auth requirement with multiple schemes\n if (schemeNames.length > 1) {\n return formatComplexScheme(requirement)\n }\n\n // Simple auth requirement with single scheme\n const schemeName = schemeNames[0]\n if (!schemeName) {\n return []\n }\n\n const scheme = getResolvedRef(securitySchemes?.[schemeName])\n if (!scheme) {\n return []\n }\n\n return formatScheme({\n name: schemeName,\n value: requirement,\n })\n })\n})\n\n/** Keep selection available whenever it can change auth or recover an empty saved selection. */\nconst showSchemeSelector = computed<boolean>(() => {\n if (\n !hideSingleRequiredScheme ||\n createAnySecurityScheme ||\n securityRequirements?.length !== 1 ||\n Object.keys(securityRequirements[0] ?? {}).length === 0\n ) {\n return true\n }\n\n const schemeOptions = availableSchemeOptions.value.flatMap((option) =>\n 'options' in option ? option.options : [option],\n )\n\n return (\n schemeOptions.length !== 1 ||\n activeSchemeOptions.value.length !== 1 ||\n activeSchemeOptions.value[0]?.id !== schemeOptions[0]?.id\n )\n})\n\n/**\n * Opens the combobox dropdown when clicking the auth indicator badge.\n * Prevents the disclosure from toggling if it is already open.\n */\nconst handleAuthIndicatorClick = (event: Event): void => {\n if (!showSchemeSelector.value) {\n return\n }\n\n if (isDisclosureOpen.value) {\n event.stopPropagation()\n }\n comboboxButtonRef.value?.$el.click()\n}\n\n/**\n * Updates the selected auth schemes.\n * Separates existing schemes from newly created ones for the event payload.\n */\nconst handleSchemeSelection = (selected: SecuritySchemeOption[]): void => {\n const existingSchemes = selected\n .filter((option) => option.payload === undefined)\n .map((option) => unpackProxyObject(option.value, { depth: 2 }))\n\n const newSchemes = selected\n .filter((option) => option.payload !== undefined)\n .map((option) => ({\n name: option.label,\n scheme: option.payload!,\n }))\n\n eventBus.emit('auth:update:selected-security-schemes', {\n selectedRequirements: existingSchemes,\n newSchemes,\n meta,\n })\n}\n\n/** Shows the delete confirmation modal for the selected scheme */\nconst handleDeleteRequest = (option: {\n label: string\n value: SecurityRequirementObject\n}): void => {\n schemeToDelete.value = { label: option.label, payload: option.value }\n deleteModal.show()\n}\n\n/** Deletes the selected auth scheme after confirmation */\nconst handleDeleteConfirm = (): void => {\n if (!schemeToDelete.value) {\n return\n }\n\n eventBus.emit('auth:delete:security-scheme', {\n names: Object.keys(schemeToDelete.value.payload),\n })\n\n schemeToDelete.value = null\n deleteModal.hide()\n}\n\ndefineExpose({\n authIndicator,\n selectedSchemeOptions: activeSchemeOptions,\n schemeOptions: availableSchemeOptions,\n})\n</script>\n<template>\n <CollapsibleSection\n class=\"group/params relative\"\n :defaultOpen\n :heading\n :isStatic=\"isStatic\"\n :itemCount=\"activeSchemeOptions.length\"\n @update:modelValue=\"(open) => (isDisclosureOpen = open)\">\n <template #title>\n <div\n :id=\"titleId\"\n class=\"inline-flex items-center gap-0.5 leading-[20px]\">\n <span>{{ title }}</span>\n\n <span\n v-if=\"authIndicator\"\n class=\"text-c-3 -my-0.5 -mr-1 rounded px-1 py-0.5 leading-[normal] font-normal\"\n :class=\"{\n 'text-c-1': authIndicator.icon === 'Lock',\n 'hover:bg-b-3 hover:text-c-1 cursor-pointer': showSchemeSelector,\n }\"\n data-testid=\"auth-indicator\"\n @click=\"handleAuthIndicatorClick\">\n {{ authIndicator.text }}\n </span>\n </div>\n </template>\n\n <!-- The client keeps its selection and deletion controls. -->\n <template\n v-if=\"showSchemeSelector\"\n #actions>\n <ScalarComboboxMultiselect\n class=\"w-72 text-xs\"\n :modelValue=\"activeSchemeOptions\"\n multiple\n :options=\"availableSchemeOptions\"\n placement=\"bottom-end\"\n teleport\n @delete=\"handleDeleteRequest\"\n @update:modelValue=\"handleSchemeSelection\">\n <ScalarButton\n ref=\"comboboxButtonRef\"\n :aria-describedby=\"titleId\"\n class=\"group/combobox-button hover:text-c-1 text-c-2 flex h-fit w-full items-center gap-1 px-0.75 py-0.25 text-base font-normal\"\n variant=\"ghost\">\n <!-- Single auth scheme selected -->\n <template v-if=\"activeSchemeOptions.length === 1\">\n {{\n translate('apiClient.authSelector.selectedType', {\n type: activeSchemeOptions[0]?.label ?? '',\n })\n }}\n </template>\n\n <!-- Multiple auth schemes selected -->\n <template v-else-if=\"activeSchemeOptions.length > 1\">\n {{ translate('apiClient.authSelector.multipleTypes') }}\n </template>\n\n <!-- No auth schemes selected -->\n <template v-else>\n {{ translate('apiClient.authSelector.selectType') }}\n </template>\n\n <ScalarIconCaretDown\n class=\"size-3 shrink-0 transition-transform duration-100 group-aria-expanded/combobox-button:rotate-180\"\n weight=\"bold\" />\n </ScalarButton>\n\n <template #option=\"{ option, selected }\">\n <ScalarListboxCheckbox\n multiselect\n :selected=\"selected\" />\n <div class=\"min-w-0 flex-1 truncate\">\n {{ option.label }}\n </div>\n <ScalarIconButton\n v-if=\"option.isDeletable && canDeleteSchemes\"\n class=\"-m-0.5 shrink-0 p-0.5 opacity-0 group-hover/item:opacity-100\"\n :icon=\"ScalarIconTrash\"\n :label=\"\n translate('apiClient.authSelector.deleteScheme', {\n name: option.label,\n })\n \"\n size=\"xs\"\n @click.stop=\"handleDeleteRequest(option)\" />\n </template>\n </ScalarComboboxMultiselect>\n </template>\n\n <!-- Auth Table -->\n <RequestAuthDataTable\n :activeAuthIndex=\"selectedSecurity?.selectedIndex ?? 0\"\n :documentType\n :environment\n :eventBus\n :isStatic\n :meta\n :options\n :proxyUrl\n :securitySchemes\n :selectedSchemeOptions=\"activeSchemeOptions\"\n :server />\n\n <!-- Delete Auth Modal -->\n <DeleteRequestAuthModal\n v-if=\"schemeToDelete\"\n :label=\"schemeToDelete.label\"\n :scheme=\"schemeToDelete\"\n :state=\"deleteModal\"\n @close=\"deleteModal.hide()\"\n @delete=\"handleDeleteConfirm\" />\n </CollapsibleSection>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"AuthSelector.vue.js","names":["_sfc_main"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarButton,\n type ScalarButton as ScalarButtonType,\n} from '@scalar/components/button'\nimport { ScalarComboboxMultiselect } from '@scalar/components/combobox'\nimport type { Icon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarListboxCheckbox } from '@scalar/components/listbox'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarIconCaretDown, ScalarIconTrash } from '@scalar/icons'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type {\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n isAuthOptional,\n type MergedSecuritySchemes,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n OpenApiDocument,\n SecurityRequirementObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref, useId } from 'vue'\n\nimport DeleteRequestAuthModal from '@/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue'\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport {\n formatComplexScheme,\n formatScheme,\n getSecuritySchemeOptions,\n type SecuritySchemeOption,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { CollapsibleSection } from '@/v2/components/layout'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthDataTable from './RequestAuthDataTable.vue'\n\nconst {\n environment,\n eventBus,\n createAnySecurityScheme = false,\n allowedSecuritySchemes,\n canDeleteSchemes = true,\n defaultOpen = true,\n heading = true,\n hideSingleRequiredScheme = false,\n isStatic = false,\n meta,\n proxyUrl,\n securityRequirements,\n securitySchemes,\n selectedSecurity,\n server,\n title,\n options,\n documentType,\n} = defineProps<{\n environment: XScalarEnvironment\n eventBus: WorkspaceEventBus\n /** Allows adding authentication which is not in the document */\n createAnySecurityScheme?: boolean\n /** Limits visible schemes without changing request authentication. */\n allowedSecuritySchemes?: string[]\n /**\n * Whether schemes can be deleted from the selector. Enabled for the editable client, disabled in\n * the read-only reference where the schemes come from the document and cannot be removed.\n */\n canDeleteSchemes?: boolean\n /** Whether the authentication disclosure should start expanded */\n defaultOpen?: boolean\n /**\n * Whether the title belongs in the document outline. The client renders the\n * selector as one section of a request, so it is a heading there. A surface\n * that only offers the schemes as a card of controls, such as the reference,\n * turns it off and the card is named as a group instead.\n */\n heading?: boolean\n /** Hides a sole active required choice in the reference while preserving client controls. */\n hideSingleRequiredScheme?: boolean\n /** Creates a static disclosure that cannot be collapsed */\n isStatic?: boolean\n meta: AuthMeta\n proxyUrl: string\n securityRequirements: OpenApiDocument['security']\n securitySchemes: MergedSecuritySchemes\n selectedSecurity: SelectedSecurity | undefined\n server: ServerObject | null\n title: string\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, used to label the missing-type warning */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst { translate, translations } = useLocalization()\n\nconst titleId = useId()\nconst comboboxButtonRef = ref<typeof ScalarButtonType | null>(null)\nconst isDisclosureOpen = ref(false)\n\nconst deleteModal = useModal()\nconst schemeToDelete = ref<{\n label: string\n payload: SecurityRequirementObject\n} | null>(null)\n\n/**\n * Determines if authentication is required or optional\n *\n * Auth is optional when there is an empty security requirement and no complex requirements.\n * Complex requirements have multiple auth schemes combined (e.g., API key + OAuth).\n */\nconst authIndicator = computed<{ icon: Icon; text: string } | null>(() => {\n if (!securityRequirements?.length) {\n return null\n }\n\n const isOptional = isAuthOptional(securityRequirements)\n\n return {\n icon: isOptional ? 'Unlock' : 'Lock',\n text: isOptional\n ? translate('apiClient.authSelector.optional')\n : translate('apiClient.authSelector.required'),\n }\n})\n\n/** Excluded schemes must also stay out of secondary forms such as OAuth acquisition. */\nconst visibleSecuritySchemes = computed<MergedSecuritySchemes>(() =>\n allowedSecuritySchemes\n ? Object.fromEntries(\n Object.entries(securitySchemes).filter(([name]) =>\n allowedSecuritySchemes.includes(name),\n ),\n )\n : securitySchemes,\n)\n\n/** All available auth scheme options for the dropdown */\nconst availableSchemeOptions = computed(() =>\n getSecuritySchemeOptions(\n securityRequirements ?? [],\n securitySchemes ?? {},\n selectedSecurity?.selectedSchemes ?? [],\n createAnySecurityScheme,\n translations.value.apiClient,\n allowedSecuritySchemes,\n ),\n)\n\n/** Currently active auth schemes selected for this operation or collection */\nconst activeSchemeOptions = computed<SecuritySchemeOption[]>(() => {\n const schemes = selectedSecurity?.selectedSchemes\n if (!schemes?.length) {\n return []\n }\n\n return schemes.flatMap((requirement) => {\n const schemeNames = Object.keys(requirement)\n\n if (\n schemeNames.length === 0 ||\n (allowedSecuritySchemes &&\n schemeNames.some((name) => !allowedSecuritySchemes.includes(name)))\n ) {\n return []\n }\n\n // Complex auth requirement with multiple schemes\n if (schemeNames.length > 1) {\n return formatComplexScheme(requirement)\n }\n\n // Simple auth requirement with single scheme\n const schemeName = schemeNames[0]\n if (!schemeName) {\n return []\n }\n\n const scheme = getResolvedRef(securitySchemes?.[schemeName])\n if (!scheme) {\n return []\n }\n\n return formatScheme({\n name: schemeName,\n value: requirement,\n })\n })\n})\n\n/** Preserve store indexes when the allowlist hides earlier saved selections. */\nconst visibleSchemeIndexes = computed<number[]>(() =>\n activeSchemeOptions.value.map(\n (option) =>\n selectedSecurity?.selectedSchemes.findIndex(\n (requirement) => formatComplexScheme(requirement).id === option.id,\n ) ?? -1,\n ),\n)\nconst visibleActiveIndex = computed<number>(() =>\n visibleSchemeIndexes.value.indexOf(selectedSecurity?.selectedIndex ?? 0),\n)\n\n/** Keep selection available whenever it can change auth or recover an empty saved selection. */\nconst showSchemeSelector = computed<boolean>(() => {\n if (\n !hideSingleRequiredScheme ||\n createAnySecurityScheme ||\n securityRequirements?.length !== 1 ||\n Object.keys(securityRequirements[0] ?? {}).length === 0\n ) {\n return true\n }\n\n const schemeOptions = availableSchemeOptions.value.flatMap((option) =>\n 'options' in option ? option.options : [option],\n )\n\n return (\n schemeOptions.length !== 1 ||\n activeSchemeOptions.value.length !== 1 ||\n activeSchemeOptions.value[0]?.id !== schemeOptions[0]?.id\n )\n})\n\n/**\n * Opens the combobox dropdown when clicking the auth indicator badge.\n * Prevents the disclosure from toggling if it is already open.\n */\nconst handleAuthIndicatorClick = (event: Event): void => {\n if (!showSchemeSelector.value) {\n return\n }\n\n if (isDisclosureOpen.value) {\n event.stopPropagation()\n }\n comboboxButtonRef.value?.$el.click()\n}\n\n/**\n * Updates the selected auth schemes.\n * Separates existing schemes from newly created ones for the event payload.\n */\nconst handleSchemeSelection = (selected: SecuritySchemeOption[]): void => {\n const existingSchemes = selected\n .filter((option) => option.payload === undefined)\n .map((option) => unpackProxyObject(option.value, { depth: 2 }))\n\n const newSchemes = selected\n .filter((option) => option.payload !== undefined)\n .map((option) => ({\n name: option.label,\n scheme: option.payload!,\n }))\n\n eventBus.emit('auth:update:selected-security-schemes', {\n selectedRequirements: existingSchemes,\n newSchemes,\n meta,\n })\n}\n\n/** Shows the delete confirmation modal for the selected scheme */\nconst handleDeleteRequest = (option: {\n label: string\n value: SecurityRequirementObject\n}): void => {\n schemeToDelete.value = { label: option.label, payload: option.value }\n deleteModal.show()\n}\n\n/** Deletes the selected auth scheme after confirmation */\nconst handleDeleteConfirm = (): void => {\n if (!schemeToDelete.value) {\n return\n }\n\n eventBus.emit('auth:delete:security-scheme', {\n names: Object.keys(schemeToDelete.value.payload),\n })\n\n schemeToDelete.value = null\n deleteModal.hide()\n}\n\ndefineExpose({\n authIndicator,\n selectedSchemeOptions: activeSchemeOptions,\n schemeOptions: availableSchemeOptions,\n})\n</script>\n<template>\n <CollapsibleSection\n class=\"group/params relative\"\n :defaultOpen\n :heading\n :isStatic=\"isStatic\"\n :itemCount=\"activeSchemeOptions.length\"\n @update:modelValue=\"(open) => (isDisclosureOpen = open)\">\n <template #title>\n <div\n :id=\"titleId\"\n class=\"inline-flex items-center gap-0.5 leading-[20px]\">\n <span>{{ title }}</span>\n\n <span\n v-if=\"authIndicator\"\n class=\"text-c-3 -my-0.5 -mr-1 rounded px-1 py-0.5 leading-[normal] font-normal\"\n :class=\"{\n 'text-c-1': authIndicator.icon === 'Lock',\n 'hover:bg-b-3 hover:text-c-1 cursor-pointer': showSchemeSelector,\n }\"\n data-testid=\"auth-indicator\"\n @click=\"handleAuthIndicatorClick\">\n {{ authIndicator.text }}\n </span>\n </div>\n </template>\n\n <!-- The client keeps its selection and deletion controls. -->\n <template\n v-if=\"showSchemeSelector\"\n #actions>\n <ScalarComboboxMultiselect\n class=\"w-72 text-xs\"\n :modelValue=\"activeSchemeOptions\"\n multiple\n :options=\"availableSchemeOptions\"\n placement=\"bottom-end\"\n teleport\n @delete=\"handleDeleteRequest\"\n @update:modelValue=\"handleSchemeSelection\">\n <ScalarButton\n ref=\"comboboxButtonRef\"\n :aria-describedby=\"titleId\"\n class=\"group/combobox-button hover:text-c-1 text-c-2 flex h-fit w-full items-center gap-1 px-0.75 py-0.25 text-base font-normal\"\n variant=\"ghost\">\n <!-- Single auth scheme selected -->\n <template v-if=\"activeSchemeOptions.length === 1\">\n {{\n translate('apiClient.authSelector.selectedType', {\n type: activeSchemeOptions[0]?.label ?? '',\n })\n }}\n </template>\n\n <!-- Multiple auth schemes selected -->\n <template v-else-if=\"activeSchemeOptions.length > 1\">\n {{ translate('apiClient.authSelector.multipleTypes') }}\n </template>\n\n <!-- No auth schemes selected -->\n <template v-else>\n {{ translate('apiClient.authSelector.selectType') }}\n </template>\n\n <ScalarIconCaretDown\n class=\"size-3 shrink-0 transition-transform duration-100 group-aria-expanded/combobox-button:rotate-180\"\n weight=\"bold\" />\n </ScalarButton>\n\n <template #option=\"{ option, selected }\">\n <ScalarListboxCheckbox\n multiselect\n :selected=\"selected\" />\n <div class=\"min-w-0 flex-1 truncate\">\n {{ option.label }}\n </div>\n <ScalarIconButton\n v-if=\"option.isDeletable && canDeleteSchemes\"\n class=\"-m-0.5 shrink-0 p-0.5 opacity-0 group-hover/item:opacity-100\"\n :icon=\"ScalarIconTrash\"\n :label=\"\n translate('apiClient.authSelector.deleteScheme', {\n name: option.label,\n })\n \"\n size=\"xs\"\n @click.stop=\"handleDeleteRequest(option)\" />\n </template>\n </ScalarComboboxMultiselect>\n </template>\n\n <!-- Auth Table -->\n <RequestAuthDataTable\n :activeAuthIndex=\"visibleActiveIndex\"\n :documentType\n :environment\n :eventBus\n :isStatic\n :meta\n :options\n :proxyUrl\n :securitySchemes=\"visibleSecuritySchemes\"\n :selectedSchemeIndexes=\"visibleSchemeIndexes\"\n :selectedSchemeOptions=\"activeSchemeOptions\"\n :server />\n\n <!-- Delete Auth Modal -->\n <DeleteRequestAuthModal\n v-if=\"schemeToDelete\"\n :label=\"schemeToDelete.label\"\n :scheme=\"schemeToDelete\"\n :state=\"deleteModal\"\n @close=\"deleteModal.hide()\"\n @delete=\"handleDeleteConfirm\" />\n </CollapsibleSection>\n</template>\n"],"mappings":""}
|
|
@@ -25,6 +25,7 @@ var AuthSelector_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
25
25
|
type: Boolean,
|
|
26
26
|
default: false
|
|
27
27
|
},
|
|
28
|
+
allowedSecuritySchemes: {},
|
|
28
29
|
canDeleteSchemes: {
|
|
29
30
|
type: Boolean,
|
|
30
31
|
default: true
|
|
@@ -76,15 +77,17 @@ var AuthSelector_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
76
77
|
text: isOptional ? translate("apiClient.authSelector.optional") : translate("apiClient.authSelector.required")
|
|
77
78
|
};
|
|
78
79
|
});
|
|
80
|
+
/** Excluded schemes must also stay out of secondary forms such as OAuth acquisition. */
|
|
81
|
+
const visibleSecuritySchemes = computed(() => __props.allowedSecuritySchemes ? Object.fromEntries(Object.entries(__props.securitySchemes).filter(([name]) => __props.allowedSecuritySchemes.includes(name))) : __props.securitySchemes);
|
|
79
82
|
/** All available auth scheme options for the dropdown */
|
|
80
|
-
const availableSchemeOptions = computed(() => getSecuritySchemeOptions(__props.securityRequirements ?? [], __props.securitySchemes ?? {}, __props.selectedSecurity?.selectedSchemes ?? [], __props.createAnySecurityScheme, translations.value.apiClient));
|
|
83
|
+
const availableSchemeOptions = computed(() => getSecuritySchemeOptions(__props.securityRequirements ?? [], __props.securitySchemes ?? {}, __props.selectedSecurity?.selectedSchemes ?? [], __props.createAnySecurityScheme, translations.value.apiClient, __props.allowedSecuritySchemes));
|
|
81
84
|
/** Currently active auth schemes selected for this operation or collection */
|
|
82
85
|
const activeSchemeOptions = computed(() => {
|
|
83
86
|
const schemes = __props.selectedSecurity?.selectedSchemes;
|
|
84
87
|
if (!schemes?.length) return [];
|
|
85
88
|
return schemes.flatMap((requirement) => {
|
|
86
89
|
const schemeNames = Object.keys(requirement);
|
|
87
|
-
if (schemeNames.length === 0) return [];
|
|
90
|
+
if (schemeNames.length === 0 || __props.allowedSecuritySchemes && schemeNames.some((name) => !__props.allowedSecuritySchemes.includes(name))) return [];
|
|
88
91
|
if (schemeNames.length > 1) return formatComplexScheme(requirement);
|
|
89
92
|
const schemeName = schemeNames[0];
|
|
90
93
|
if (!schemeName) return [];
|
|
@@ -95,6 +98,9 @@ var AuthSelector_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
95
98
|
});
|
|
96
99
|
});
|
|
97
100
|
});
|
|
101
|
+
/** Preserve store indexes when the allowlist hides earlier saved selections. */
|
|
102
|
+
const visibleSchemeIndexes = computed(() => activeSchemeOptions.value.map((option) => __props.selectedSecurity?.selectedSchemes.findIndex((requirement) => formatComplexScheme(requirement).id === option.id) ?? -1));
|
|
103
|
+
const visibleActiveIndex = computed(() => visibleSchemeIndexes.value.indexOf(__props.selectedSecurity?.selectedIndex ?? 0));
|
|
98
104
|
/** Keep selection available whenever it can change auth or recover an empty saved selection. */
|
|
99
105
|
const showSchemeSelector = computed(() => {
|
|
100
106
|
if (!__props.hideSingleRequiredScheme || __props.createAnySecurityScheme || __props.securityRequirements?.length !== 1 || Object.keys(__props.securityRequirements[0] ?? {}).length === 0) return true;
|
|
@@ -168,7 +174,7 @@ var AuthSelector_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
168
174
|
onClick: handleAuthIndicatorClick
|
|
169
175
|
}, toDisplayString(authIndicator.value.text), 3)) : createCommentVNode("", true)], 8, _hoisted_1)]),
|
|
170
176
|
default: withCtx(() => [createVNode(RequestAuthDataTable_default, {
|
|
171
|
-
activeAuthIndex:
|
|
177
|
+
activeAuthIndex: visibleActiveIndex.value,
|
|
172
178
|
documentType: __props.documentType,
|
|
173
179
|
environment: __props.environment,
|
|
174
180
|
eventBus: __props.eventBus,
|
|
@@ -176,7 +182,8 @@ var AuthSelector_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
176
182
|
meta: __props.meta,
|
|
177
183
|
options: __props.options,
|
|
178
184
|
proxyUrl: __props.proxyUrl,
|
|
179
|
-
securitySchemes:
|
|
185
|
+
securitySchemes: visibleSecuritySchemes.value,
|
|
186
|
+
selectedSchemeIndexes: visibleSchemeIndexes.value,
|
|
180
187
|
selectedSchemeOptions: activeSchemeOptions.value,
|
|
181
188
|
server: __props.server
|
|
182
189
|
}, null, 8, [
|
|
@@ -189,6 +196,7 @@ var AuthSelector_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
189
196
|
"options",
|
|
190
197
|
"proxyUrl",
|
|
191
198
|
"securitySchemes",
|
|
199
|
+
"selectedSchemeIndexes",
|
|
192
200
|
"selectedSchemeOptions",
|
|
193
201
|
"server"
|
|
194
202
|
]), schemeToDelete.value ? (openBlock(), createBlock(DeleteRequestAuthModal_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthSelector.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","CollapsibleSection","_createSlots","_withCtx","_createElementVNode","_toDisplayString","_createElementBlock","_normalizeClass","_createCommentVNode","_createVNode","RequestAuthDataTable","DeleteRequestAuthModal","_withModifiers","_Fragment","_createTextVNode"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarButton,\n type ScalarButton as ScalarButtonType,\n} from '@scalar/components/button'\nimport { ScalarComboboxMultiselect } from '@scalar/components/combobox'\nimport type { Icon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarListboxCheckbox } from '@scalar/components/listbox'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarIconCaretDown, ScalarIconTrash } from '@scalar/icons'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type {\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n isAuthOptional,\n type MergedSecuritySchemes,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n OpenApiDocument,\n SecurityRequirementObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref, useId } from 'vue'\n\nimport DeleteRequestAuthModal from '@/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue'\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport {\n formatComplexScheme,\n formatScheme,\n getSecuritySchemeOptions,\n type SecuritySchemeOption,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { CollapsibleSection } from '@/v2/components/layout'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthDataTable from './RequestAuthDataTable.vue'\n\nconst {\n environment,\n eventBus,\n createAnySecurityScheme = false,\n canDeleteSchemes = true,\n defaultOpen = true,\n heading = true,\n hideSingleRequiredScheme = false,\n isStatic = false,\n meta,\n proxyUrl,\n securityRequirements,\n securitySchemes,\n selectedSecurity,\n server,\n title,\n options,\n documentType,\n} = defineProps<{\n environment: XScalarEnvironment\n eventBus: WorkspaceEventBus\n /** Allows adding authentication which is not in the document */\n createAnySecurityScheme?: boolean\n /**\n * Whether schemes can be deleted from the selector. Enabled for the editable client, disabled in\n * the read-only reference where the schemes come from the document and cannot be removed.\n */\n canDeleteSchemes?: boolean\n /** Whether the authentication disclosure should start expanded */\n defaultOpen?: boolean\n /**\n * Whether the title belongs in the document outline. The client renders the\n * selector as one section of a request, so it is a heading there. A surface\n * that only offers the schemes as a card of controls, such as the reference,\n * turns it off and the card is named as a group instead.\n */\n heading?: boolean\n /** Hides a sole active required choice in the reference while preserving client controls. */\n hideSingleRequiredScheme?: boolean\n /** Creates a static disclosure that cannot be collapsed */\n isStatic?: boolean\n meta: AuthMeta\n proxyUrl: string\n securityRequirements: OpenApiDocument['security']\n securitySchemes: MergedSecuritySchemes\n selectedSecurity: SelectedSecurity | undefined\n server: ServerObject | null\n title: string\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, used to label the missing-type warning */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst { translate, translations } = useLocalization()\n\nconst titleId = useId()\nconst comboboxButtonRef = ref<typeof ScalarButtonType | null>(null)\nconst isDisclosureOpen = ref(false)\n\nconst deleteModal = useModal()\nconst schemeToDelete = ref<{\n label: string\n payload: SecurityRequirementObject\n} | null>(null)\n\n/**\n * Determines if authentication is required or optional\n *\n * Auth is optional when there is an empty security requirement and no complex requirements.\n * Complex requirements have multiple auth schemes combined (e.g., API key + OAuth).\n */\nconst authIndicator = computed<{ icon: Icon; text: string } | null>(() => {\n if (!securityRequirements?.length) {\n return null\n }\n\n const isOptional = isAuthOptional(securityRequirements)\n\n return {\n icon: isOptional ? 'Unlock' : 'Lock',\n text: isOptional\n ? translate('apiClient.authSelector.optional')\n : translate('apiClient.authSelector.required'),\n }\n})\n\n/** All available auth scheme options for the dropdown */\nconst availableSchemeOptions = computed(() =>\n getSecuritySchemeOptions(\n securityRequirements ?? [],\n securitySchemes ?? {},\n selectedSecurity?.selectedSchemes ?? [],\n createAnySecurityScheme,\n translations.value.apiClient,\n ),\n)\n\n/** Currently active auth schemes selected for this operation or collection */\nconst activeSchemeOptions = computed<SecuritySchemeOption[]>(() => {\n const schemes = selectedSecurity?.selectedSchemes\n if (!schemes?.length) {\n return []\n }\n\n return schemes.flatMap((requirement) => {\n const schemeNames = Object.keys(requirement)\n\n if (schemeNames.length === 0) {\n return []\n }\n\n // Complex auth requirement with multiple schemes\n if (schemeNames.length > 1) {\n return formatComplexScheme(requirement)\n }\n\n // Simple auth requirement with single scheme\n const schemeName = schemeNames[0]\n if (!schemeName) {\n return []\n }\n\n const scheme = getResolvedRef(securitySchemes?.[schemeName])\n if (!scheme) {\n return []\n }\n\n return formatScheme({\n name: schemeName,\n value: requirement,\n })\n })\n})\n\n/** Keep selection available whenever it can change auth or recover an empty saved selection. */\nconst showSchemeSelector = computed<boolean>(() => {\n if (\n !hideSingleRequiredScheme ||\n createAnySecurityScheme ||\n securityRequirements?.length !== 1 ||\n Object.keys(securityRequirements[0] ?? {}).length === 0\n ) {\n return true\n }\n\n const schemeOptions = availableSchemeOptions.value.flatMap((option) =>\n 'options' in option ? option.options : [option],\n )\n\n return (\n schemeOptions.length !== 1 ||\n activeSchemeOptions.value.length !== 1 ||\n activeSchemeOptions.value[0]?.id !== schemeOptions[0]?.id\n )\n})\n\n/**\n * Opens the combobox dropdown when clicking the auth indicator badge.\n * Prevents the disclosure from toggling if it is already open.\n */\nconst handleAuthIndicatorClick = (event: Event): void => {\n if (!showSchemeSelector.value) {\n return\n }\n\n if (isDisclosureOpen.value) {\n event.stopPropagation()\n }\n comboboxButtonRef.value?.$el.click()\n}\n\n/**\n * Updates the selected auth schemes.\n * Separates existing schemes from newly created ones for the event payload.\n */\nconst handleSchemeSelection = (selected: SecuritySchemeOption[]): void => {\n const existingSchemes = selected\n .filter((option) => option.payload === undefined)\n .map((option) => unpackProxyObject(option.value, { depth: 2 }))\n\n const newSchemes = selected\n .filter((option) => option.payload !== undefined)\n .map((option) => ({\n name: option.label,\n scheme: option.payload!,\n }))\n\n eventBus.emit('auth:update:selected-security-schemes', {\n selectedRequirements: existingSchemes,\n newSchemes,\n meta,\n })\n}\n\n/** Shows the delete confirmation modal for the selected scheme */\nconst handleDeleteRequest = (option: {\n label: string\n value: SecurityRequirementObject\n}): void => {\n schemeToDelete.value = { label: option.label, payload: option.value }\n deleteModal.show()\n}\n\n/** Deletes the selected auth scheme after confirmation */\nconst handleDeleteConfirm = (): void => {\n if (!schemeToDelete.value) {\n return\n }\n\n eventBus.emit('auth:delete:security-scheme', {\n names: Object.keys(schemeToDelete.value.payload),\n })\n\n schemeToDelete.value = null\n deleteModal.hide()\n}\n\ndefineExpose({\n authIndicator,\n selectedSchemeOptions: activeSchemeOptions,\n schemeOptions: availableSchemeOptions,\n})\n</script>\n<template>\n <CollapsibleSection\n class=\"group/params relative\"\n :defaultOpen\n :heading\n :isStatic=\"isStatic\"\n :itemCount=\"activeSchemeOptions.length\"\n @update:modelValue=\"(open) => (isDisclosureOpen = open)\">\n <template #title>\n <div\n :id=\"titleId\"\n class=\"inline-flex items-center gap-0.5 leading-[20px]\">\n <span>{{ title }}</span>\n\n <span\n v-if=\"authIndicator\"\n class=\"text-c-3 -my-0.5 -mr-1 rounded px-1 py-0.5 leading-[normal] font-normal\"\n :class=\"{\n 'text-c-1': authIndicator.icon === 'Lock',\n 'hover:bg-b-3 hover:text-c-1 cursor-pointer': showSchemeSelector,\n }\"\n data-testid=\"auth-indicator\"\n @click=\"handleAuthIndicatorClick\">\n {{ authIndicator.text }}\n </span>\n </div>\n </template>\n\n <!-- The client keeps its selection and deletion controls. -->\n <template\n v-if=\"showSchemeSelector\"\n #actions>\n <ScalarComboboxMultiselect\n class=\"w-72 text-xs\"\n :modelValue=\"activeSchemeOptions\"\n multiple\n :options=\"availableSchemeOptions\"\n placement=\"bottom-end\"\n teleport\n @delete=\"handleDeleteRequest\"\n @update:modelValue=\"handleSchemeSelection\">\n <ScalarButton\n ref=\"comboboxButtonRef\"\n :aria-describedby=\"titleId\"\n class=\"group/combobox-button hover:text-c-1 text-c-2 flex h-fit w-full items-center gap-1 px-0.75 py-0.25 text-base font-normal\"\n variant=\"ghost\">\n <!-- Single auth scheme selected -->\n <template v-if=\"activeSchemeOptions.length === 1\">\n {{\n translate('apiClient.authSelector.selectedType', {\n type: activeSchemeOptions[0]?.label ?? '',\n })\n }}\n </template>\n\n <!-- Multiple auth schemes selected -->\n <template v-else-if=\"activeSchemeOptions.length > 1\">\n {{ translate('apiClient.authSelector.multipleTypes') }}\n </template>\n\n <!-- No auth schemes selected -->\n <template v-else>\n {{ translate('apiClient.authSelector.selectType') }}\n </template>\n\n <ScalarIconCaretDown\n class=\"size-3 shrink-0 transition-transform duration-100 group-aria-expanded/combobox-button:rotate-180\"\n weight=\"bold\" />\n </ScalarButton>\n\n <template #option=\"{ option, selected }\">\n <ScalarListboxCheckbox\n multiselect\n :selected=\"selected\" />\n <div class=\"min-w-0 flex-1 truncate\">\n {{ option.label }}\n </div>\n <ScalarIconButton\n v-if=\"option.isDeletable && canDeleteSchemes\"\n class=\"-m-0.5 shrink-0 p-0.5 opacity-0 group-hover/item:opacity-100\"\n :icon=\"ScalarIconTrash\"\n :label=\"\n translate('apiClient.authSelector.deleteScheme', {\n name: option.label,\n })\n \"\n size=\"xs\"\n @click.stop=\"handleDeleteRequest(option)\" />\n </template>\n </ScalarComboboxMultiselect>\n </template>\n\n <!-- Auth Table -->\n <RequestAuthDataTable\n :activeAuthIndex=\"selectedSecurity?.selectedIndex ?? 0\"\n :documentType\n :environment\n :eventBus\n :isStatic\n :meta\n :options\n :proxyUrl\n :securitySchemes\n :selectedSchemeOptions=\"activeSchemeOptions\"\n :server />\n\n <!-- Delete Auth Modal -->\n <DeleteRequestAuthModal\n v-if=\"schemeToDelete\"\n :label=\"schemeToDelete.label\"\n :scheme=\"schemeToDelete\"\n :state=\"deleteModal\"\n @close=\"deleteModal.hide()\"\n @delete=\"handleDeleteConfirm\" />\n </CollapsibleSection>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiGA,MAAM,EAAE,WAAW,iBAAiB,gBAAgB;EAEpD,MAAM,UAAU,MAAM;EACtB,MAAM,oBAAoB,IAAoC,IAAI;EAClE,MAAM,mBAAmB,IAAI,KAAK;EAElC,MAAM,cAAc,SAAS;EAC7B,MAAM,iBAAiB,IAGb,IAAI;;;;;;;EAQd,MAAM,gBAAgB,eAAoD;GACxE,IAAI,CAAC,QAAA,sBAAsB,QACzB,OAAO;GAGT,MAAM,aAAa,eAAe,QAAA,oBAAoB;GAEtD,OAAO;IACL,MAAM,aAAa,WAAW;IAC9B,MAAM,aACF,UAAU,iCAAiC,IAC3C,UAAU,iCAAiC;GACjD;EACF,CAAC;;EAGD,MAAM,yBAAyB,eAC7B,yBACE,QAAA,wBAAwB,CAAC,GACzB,QAAA,mBAAmB,CAAC,GACpB,QAAA,kBAAkB,mBAAmB,CAAC,GACtC,QAAA,yBACA,aAAa,MAAM,SACrB,CACF;;EAGA,MAAM,sBAAsB,eAAuC;GACjE,MAAM,UAAU,QAAA,kBAAkB;GAClC,IAAI,CAAC,SAAS,QACZ,OAAO,CAAC;GAGV,OAAO,QAAQ,SAAS,gBAAgB;IACtC,MAAM,cAAc,OAAO,KAAK,WAAW;IAE3C,IAAI,YAAY,WAAW,G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,C,WAIdF,UAAA,GAAAQ,mBAEWO,UAAA,EAAA,KAAA,EAAA,GAAA,CADNC,gBAAAT,gBAAAL,MAAA,SAAA,CAAS,CAAA,mCAAA,CAAA,GAAA,CAAA,C,SAGdS,YAEkBT,MAAA,mBAAA,GAAA;OADhB,OAAM;OACN,QAAO"}
|
|
1
|
+
{"version":3,"file":"AuthSelector.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","CollapsibleSection","_createSlots","_withCtx","_createElementVNode","_toDisplayString","_createElementBlock","_normalizeClass","_createCommentVNode","_createVNode","RequestAuthDataTable","DeleteRequestAuthModal","_withModifiers","_Fragment","_createTextVNode"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarButton,\n type ScalarButton as ScalarButtonType,\n} from '@scalar/components/button'\nimport { ScalarComboboxMultiselect } from '@scalar/components/combobox'\nimport type { Icon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarListboxCheckbox } from '@scalar/components/listbox'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarIconCaretDown, ScalarIconTrash } from '@scalar/icons'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type {\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n isAuthOptional,\n type MergedSecuritySchemes,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n OpenApiDocument,\n SecurityRequirementObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref, useId } from 'vue'\n\nimport DeleteRequestAuthModal from '@/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue'\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport {\n formatComplexScheme,\n formatScheme,\n getSecuritySchemeOptions,\n type SecuritySchemeOption,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { CollapsibleSection } from '@/v2/components/layout'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthDataTable from './RequestAuthDataTable.vue'\n\nconst {\n environment,\n eventBus,\n createAnySecurityScheme = false,\n allowedSecuritySchemes,\n canDeleteSchemes = true,\n defaultOpen = true,\n heading = true,\n hideSingleRequiredScheme = false,\n isStatic = false,\n meta,\n proxyUrl,\n securityRequirements,\n securitySchemes,\n selectedSecurity,\n server,\n title,\n options,\n documentType,\n} = defineProps<{\n environment: XScalarEnvironment\n eventBus: WorkspaceEventBus\n /** Allows adding authentication which is not in the document */\n createAnySecurityScheme?: boolean\n /** Limits visible schemes without changing request authentication. */\n allowedSecuritySchemes?: string[]\n /**\n * Whether schemes can be deleted from the selector. Enabled for the editable client, disabled in\n * the read-only reference where the schemes come from the document and cannot be removed.\n */\n canDeleteSchemes?: boolean\n /** Whether the authentication disclosure should start expanded */\n defaultOpen?: boolean\n /**\n * Whether the title belongs in the document outline. The client renders the\n * selector as one section of a request, so it is a heading there. A surface\n * that only offers the schemes as a card of controls, such as the reference,\n * turns it off and the card is named as a group instead.\n */\n heading?: boolean\n /** Hides a sole active required choice in the reference while preserving client controls. */\n hideSingleRequiredScheme?: boolean\n /** Creates a static disclosure that cannot be collapsed */\n isStatic?: boolean\n meta: AuthMeta\n proxyUrl: string\n securityRequirements: OpenApiDocument['security']\n securitySchemes: MergedSecuritySchemes\n selectedSecurity: SelectedSecurity | undefined\n server: ServerObject | null\n title: string\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, used to label the missing-type warning */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst { translate, translations } = useLocalization()\n\nconst titleId = useId()\nconst comboboxButtonRef = ref<typeof ScalarButtonType | null>(null)\nconst isDisclosureOpen = ref(false)\n\nconst deleteModal = useModal()\nconst schemeToDelete = ref<{\n label: string\n payload: SecurityRequirementObject\n} | null>(null)\n\n/**\n * Determines if authentication is required or optional\n *\n * Auth is optional when there is an empty security requirement and no complex requirements.\n * Complex requirements have multiple auth schemes combined (e.g., API key + OAuth).\n */\nconst authIndicator = computed<{ icon: Icon; text: string } | null>(() => {\n if (!securityRequirements?.length) {\n return null\n }\n\n const isOptional = isAuthOptional(securityRequirements)\n\n return {\n icon: isOptional ? 'Unlock' : 'Lock',\n text: isOptional\n ? translate('apiClient.authSelector.optional')\n : translate('apiClient.authSelector.required'),\n }\n})\n\n/** Excluded schemes must also stay out of secondary forms such as OAuth acquisition. */\nconst visibleSecuritySchemes = computed<MergedSecuritySchemes>(() =>\n allowedSecuritySchemes\n ? Object.fromEntries(\n Object.entries(securitySchemes).filter(([name]) =>\n allowedSecuritySchemes.includes(name),\n ),\n )\n : securitySchemes,\n)\n\n/** All available auth scheme options for the dropdown */\nconst availableSchemeOptions = computed(() =>\n getSecuritySchemeOptions(\n securityRequirements ?? [],\n securitySchemes ?? {},\n selectedSecurity?.selectedSchemes ?? [],\n createAnySecurityScheme,\n translations.value.apiClient,\n allowedSecuritySchemes,\n ),\n)\n\n/** Currently active auth schemes selected for this operation or collection */\nconst activeSchemeOptions = computed<SecuritySchemeOption[]>(() => {\n const schemes = selectedSecurity?.selectedSchemes\n if (!schemes?.length) {\n return []\n }\n\n return schemes.flatMap((requirement) => {\n const schemeNames = Object.keys(requirement)\n\n if (\n schemeNames.length === 0 ||\n (allowedSecuritySchemes &&\n schemeNames.some((name) => !allowedSecuritySchemes.includes(name)))\n ) {\n return []\n }\n\n // Complex auth requirement with multiple schemes\n if (schemeNames.length > 1) {\n return formatComplexScheme(requirement)\n }\n\n // Simple auth requirement with single scheme\n const schemeName = schemeNames[0]\n if (!schemeName) {\n return []\n }\n\n const scheme = getResolvedRef(securitySchemes?.[schemeName])\n if (!scheme) {\n return []\n }\n\n return formatScheme({\n name: schemeName,\n value: requirement,\n })\n })\n})\n\n/** Preserve store indexes when the allowlist hides earlier saved selections. */\nconst visibleSchemeIndexes = computed<number[]>(() =>\n activeSchemeOptions.value.map(\n (option) =>\n selectedSecurity?.selectedSchemes.findIndex(\n (requirement) => formatComplexScheme(requirement).id === option.id,\n ) ?? -1,\n ),\n)\nconst visibleActiveIndex = computed<number>(() =>\n visibleSchemeIndexes.value.indexOf(selectedSecurity?.selectedIndex ?? 0),\n)\n\n/** Keep selection available whenever it can change auth or recover an empty saved selection. */\nconst showSchemeSelector = computed<boolean>(() => {\n if (\n !hideSingleRequiredScheme ||\n createAnySecurityScheme ||\n securityRequirements?.length !== 1 ||\n Object.keys(securityRequirements[0] ?? {}).length === 0\n ) {\n return true\n }\n\n const schemeOptions = availableSchemeOptions.value.flatMap((option) =>\n 'options' in option ? option.options : [option],\n )\n\n return (\n schemeOptions.length !== 1 ||\n activeSchemeOptions.value.length !== 1 ||\n activeSchemeOptions.value[0]?.id !== schemeOptions[0]?.id\n )\n})\n\n/**\n * Opens the combobox dropdown when clicking the auth indicator badge.\n * Prevents the disclosure from toggling if it is already open.\n */\nconst handleAuthIndicatorClick = (event: Event): void => {\n if (!showSchemeSelector.value) {\n return\n }\n\n if (isDisclosureOpen.value) {\n event.stopPropagation()\n }\n comboboxButtonRef.value?.$el.click()\n}\n\n/**\n * Updates the selected auth schemes.\n * Separates existing schemes from newly created ones for the event payload.\n */\nconst handleSchemeSelection = (selected: SecuritySchemeOption[]): void => {\n const existingSchemes = selected\n .filter((option) => option.payload === undefined)\n .map((option) => unpackProxyObject(option.value, { depth: 2 }))\n\n const newSchemes = selected\n .filter((option) => option.payload !== undefined)\n .map((option) => ({\n name: option.label,\n scheme: option.payload!,\n }))\n\n eventBus.emit('auth:update:selected-security-schemes', {\n selectedRequirements: existingSchemes,\n newSchemes,\n meta,\n })\n}\n\n/** Shows the delete confirmation modal for the selected scheme */\nconst handleDeleteRequest = (option: {\n label: string\n value: SecurityRequirementObject\n}): void => {\n schemeToDelete.value = { label: option.label, payload: option.value }\n deleteModal.show()\n}\n\n/** Deletes the selected auth scheme after confirmation */\nconst handleDeleteConfirm = (): void => {\n if (!schemeToDelete.value) {\n return\n }\n\n eventBus.emit('auth:delete:security-scheme', {\n names: Object.keys(schemeToDelete.value.payload),\n })\n\n schemeToDelete.value = null\n deleteModal.hide()\n}\n\ndefineExpose({\n authIndicator,\n selectedSchemeOptions: activeSchemeOptions,\n schemeOptions: availableSchemeOptions,\n})\n</script>\n<template>\n <CollapsibleSection\n class=\"group/params relative\"\n :defaultOpen\n :heading\n :isStatic=\"isStatic\"\n :itemCount=\"activeSchemeOptions.length\"\n @update:modelValue=\"(open) => (isDisclosureOpen = open)\">\n <template #title>\n <div\n :id=\"titleId\"\n class=\"inline-flex items-center gap-0.5 leading-[20px]\">\n <span>{{ title }}</span>\n\n <span\n v-if=\"authIndicator\"\n class=\"text-c-3 -my-0.5 -mr-1 rounded px-1 py-0.5 leading-[normal] font-normal\"\n :class=\"{\n 'text-c-1': authIndicator.icon === 'Lock',\n 'hover:bg-b-3 hover:text-c-1 cursor-pointer': showSchemeSelector,\n }\"\n data-testid=\"auth-indicator\"\n @click=\"handleAuthIndicatorClick\">\n {{ authIndicator.text }}\n </span>\n </div>\n </template>\n\n <!-- The client keeps its selection and deletion controls. -->\n <template\n v-if=\"showSchemeSelector\"\n #actions>\n <ScalarComboboxMultiselect\n class=\"w-72 text-xs\"\n :modelValue=\"activeSchemeOptions\"\n multiple\n :options=\"availableSchemeOptions\"\n placement=\"bottom-end\"\n teleport\n @delete=\"handleDeleteRequest\"\n @update:modelValue=\"handleSchemeSelection\">\n <ScalarButton\n ref=\"comboboxButtonRef\"\n :aria-describedby=\"titleId\"\n class=\"group/combobox-button hover:text-c-1 text-c-2 flex h-fit w-full items-center gap-1 px-0.75 py-0.25 text-base font-normal\"\n variant=\"ghost\">\n <!-- Single auth scheme selected -->\n <template v-if=\"activeSchemeOptions.length === 1\">\n {{\n translate('apiClient.authSelector.selectedType', {\n type: activeSchemeOptions[0]?.label ?? '',\n })\n }}\n </template>\n\n <!-- Multiple auth schemes selected -->\n <template v-else-if=\"activeSchemeOptions.length > 1\">\n {{ translate('apiClient.authSelector.multipleTypes') }}\n </template>\n\n <!-- No auth schemes selected -->\n <template v-else>\n {{ translate('apiClient.authSelector.selectType') }}\n </template>\n\n <ScalarIconCaretDown\n class=\"size-3 shrink-0 transition-transform duration-100 group-aria-expanded/combobox-button:rotate-180\"\n weight=\"bold\" />\n </ScalarButton>\n\n <template #option=\"{ option, selected }\">\n <ScalarListboxCheckbox\n multiselect\n :selected=\"selected\" />\n <div class=\"min-w-0 flex-1 truncate\">\n {{ option.label }}\n </div>\n <ScalarIconButton\n v-if=\"option.isDeletable && canDeleteSchemes\"\n class=\"-m-0.5 shrink-0 p-0.5 opacity-0 group-hover/item:opacity-100\"\n :icon=\"ScalarIconTrash\"\n :label=\"\n translate('apiClient.authSelector.deleteScheme', {\n name: option.label,\n })\n \"\n size=\"xs\"\n @click.stop=\"handleDeleteRequest(option)\" />\n </template>\n </ScalarComboboxMultiselect>\n </template>\n\n <!-- Auth Table -->\n <RequestAuthDataTable\n :activeAuthIndex=\"visibleActiveIndex\"\n :documentType\n :environment\n :eventBus\n :isStatic\n :meta\n :options\n :proxyUrl\n :securitySchemes=\"visibleSecuritySchemes\"\n :selectedSchemeIndexes=\"visibleSchemeIndexes\"\n :selectedSchemeOptions=\"activeSchemeOptions\"\n :server />\n\n <!-- Delete Auth Modal -->\n <DeleteRequestAuthModal\n v-if=\"schemeToDelete\"\n :label=\"schemeToDelete.label\"\n :scheme=\"schemeToDelete\"\n :state=\"deleteModal\"\n @close=\"deleteModal.hide()\"\n @delete=\"handleDeleteConfirm\" />\n </CollapsibleSection>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA,CAAS,CAAA,sCAAA,CAAA,GAAA,CAAA,C,WAIdF,UAAA,GAAAQ,mBAEWO,UAAA,EAAA,KAAA,EAAA,GAAA,CADNC,gBAAAT,gBAAAL,MAAA,SAAA,CAAS,CAAA,mCAAA,CAAA,GAAA,CAAA,C,SAGdS,YAEkBT,MAAA,mBAAA,GAAA;OADhB,OAAM;OACN,QAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
2
|
+
import type { OpenIdConnectObjectSecret } from '@scalar/workspace-store/request-example';
|
|
2
3
|
import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
|
|
3
|
-
import { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
4
4
|
import type { CustomFetch } from '../../operation-block/helpers/send-request.js';
|
|
5
5
|
type __VLS_Props = {
|
|
6
6
|
/** Current environment configuration */
|
|
@@ -14,7 +14,7 @@ type __VLS_Props = {
|
|
|
14
14
|
/** Proxy URL */
|
|
15
15
|
proxyUrl: string;
|
|
16
16
|
/** OpenID Connect scheme */
|
|
17
|
-
scheme:
|
|
17
|
+
scheme: OpenIdConnectObjectSecret;
|
|
18
18
|
/** Optional fetch override (IPC-backed on desktop) used for discovery requests */
|
|
19
19
|
customFetch?: CustomFetch;
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenIDConnect.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OpenIDConnect.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"names":[],"mappings":"AAmIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAA;AACxF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAEnH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAA;AAQnF,KAAK,WAAW,GAAG;IACjB,wCAAwC;IACxC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,kCAAkC;IAClC,oBAAoB,EAAE,MAAM,MAAM,GAAG,KAAK,CAAA;IAC1C,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,MAAM,EAAE,yBAAyB,CAAA;IACjC,kFAAkF;IAClF,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAC;AAgMF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenIDConnect.vue.js","names":["_sfc_main"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type {
|
|
1
|
+
{"version":3,"file":"OpenIDConnect.vue.js","names":["_sfc_main"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { OpenIdConnectObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\nimport { DataTableRow } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n eventBus,\n getStaticBorderClass,\n name,\n scheme,\n proxyUrl,\n customFetch,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObjectSecret\n /** Optional fetch override (IPC-backed on desktop) used for discovery requests */\n customFetch?: CustomFetch\n}>()\n\nconst { translate } = useLocalization()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n customFetch,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message ??\n translate('apiClient.openIdConnect.failedToFetchConfiguration'),\n 'error',\n )\n return\n }\n\n /** Set the newly discovered params in the secret store */\n const openIdConnect = openIDDiscoveryToFlows(_discovery)\n // Seed PKCE once so later user edits keep precedence over the configured default.\n const configuredPkce =\n scheme.configuredFlows?.authorizationCode?.['x-usePkce']\n if (openIdConnect.authorizationCode && configuredPkce !== undefined) {\n openIdConnect.authorizationCode['x-usePkce'] = configuredPkce\n }\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: openIdConnect,\n name,\n overwrite: true,\n })\n}\n\nconst handleUpdateOpenIdConnectUrl = (value: string): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: 'openIdConnect',\n openIdConnectUrl: value,\n },\n name,\n })\n</script>\n\n<template>\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.openIdConnectUrl\"\n placeholder=\"https://example.com/.well-known/openid-configuration\"\n required\n @update:modelValue=\"handleUpdateOpenIdConnectUrl\">\n {{ translate('apiClient.openIdConnect.discoveryUrl') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :disabled=\"!scheme.openIdConnectUrl\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleOpenIdConnect\">\n {{ translate('apiClient.openIdConnect.fetchConfiguration') }}\n </ScalarButton>\n </div>\n </DataTableRow>\n</template>\n"],"mappings":""}
|
|
@@ -39,6 +39,8 @@ var OpenIDConnect_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
39
39
|
}
|
|
40
40
|
/** Set the newly discovered params in the secret store */
|
|
41
41
|
const openIdConnect = openIDDiscoveryToFlows(_discovery);
|
|
42
|
+
const configuredPkce = __props.scheme.configuredFlows?.authorizationCode?.["x-usePkce"];
|
|
43
|
+
if (openIdConnect.authorizationCode && configuredPkce !== void 0) openIdConnect.authorizationCode["x-usePkce"] = configuredPkce;
|
|
42
44
|
__props.eventBus.emit("auth:update:security-scheme-secrets", {
|
|
43
45
|
payload: openIdConnect,
|
|
44
46
|
name: __props.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenIDConnect.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","DataTableRow","_withCtx","RequestAuthDataTableInput","_createTextVNode","_toDisplayString","_createElementVNode"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type {
|
|
1
|
+
{"version":3,"file":"OpenIDConnect.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","DataTableRow","_withCtx","RequestAuthDataTableInput","_createTextVNode","_toDisplayString","_createElementVNode"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { OpenIdConnectObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\nimport { DataTableRow } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n eventBus,\n getStaticBorderClass,\n name,\n scheme,\n proxyUrl,\n customFetch,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObjectSecret\n /** Optional fetch override (IPC-backed on desktop) used for discovery requests */\n customFetch?: CustomFetch\n}>()\n\nconst { translate } = useLocalization()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n customFetch,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message ??\n translate('apiClient.openIdConnect.failedToFetchConfiguration'),\n 'error',\n )\n return\n }\n\n /** Set the newly discovered params in the secret store */\n const openIdConnect = openIDDiscoveryToFlows(_discovery)\n // Seed PKCE once so later user edits keep precedence over the configured default.\n const configuredPkce =\n scheme.configuredFlows?.authorizationCode?.['x-usePkce']\n if (openIdConnect.authorizationCode && configuredPkce !== undefined) {\n openIdConnect.authorizationCode['x-usePkce'] = configuredPkce\n }\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: openIdConnect,\n name,\n overwrite: true,\n })\n}\n\nconst handleUpdateOpenIdConnectUrl = (value: string): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: 'openIdConnect',\n openIdConnectUrl: value,\n },\n name,\n })\n</script>\n\n<template>\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.openIdConnectUrl\"\n placeholder=\"https://example.com/.well-known/openid-configuration\"\n required\n @update:modelValue=\"handleUpdateOpenIdConnectUrl\">\n {{ translate('apiClient.openIdConnect.discoveryUrl') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :disabled=\"!scheme.openIdConnectUrl\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleOpenIdConnect\">\n {{ translate('apiClient.openIdConnect.fetchConfiguration') }}\n </ScalarButton>\n </div>\n </DataTableRow>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAyCA,MAAM,EAAE,cAAc,gBAAgB;EAEtC,MAAM,SAAS,gBAAgB;EAC/B,MAAM,EAAE,UAAU,UAAU;;;;EAK5B,MAAM,sBAAsB,YAA2B;GACrD,IAAI,OAAO,aAAa,CAAC,QAAA,OAAO,kBAC9B;GAGF,OAAO,MAAM;GACb,MAAM,CAAC,OAAO,cAAc,MAAM,4BAChC,QAAA,OAAO,kBACP,QAAA,UACA,QAAA,WACF;GACA,MAAM,OAAO,MAAM;GAGnB,IAAI,OAAO;IACT,QAAQ,MAAM,KAAK;IACnB,MACE,OAAO,WACL,UAAU,oDAAoD,GAChE,OACF;IACA;GACF;;GAGA,MAAM,gBAAgB,uBAAuB,UAAU;GAEvD,MAAM,iBACJ,QAAA,OAAO,iBAAiB,oBAAoB;GAC9C,IAAI,cAAc,qBAAqB,mBAAmB,KAAA,GACxD,cAAc,kBAAkB,eAAe;GAEjD,QAAA,SAAS,KAAK,uCAAuC;IACnD,SAAS;IACT,MAAG,QAAA;IACH,WAAW;GACb,CAAC;EACH;EAEA,MAAM,gCAAgC,UACpC,QAAA,SAAS,KAAK,+BAA+B;GAC3C,SAAS;IACP,MAAM;IACN,kBAAkB;GACpB;GACA,MAAG,QAAA;EACL,CAAC;;G,wDAIDG,YAUeC,MAAAC,oBAAA,GAAA,MAAA;IATb,SAAAC,cAQ4B,CAR5BH,YAQ4BI,mCAAA;KAPzB,gBAAgB,QAAA,qBAAoB;KACpC,aAAA,QAAA;KACA,YAAY,QAAA,OAAO;KACpB,aAAY;KACZ,UAAA;KACC,uBAAmB;;KACpB,SAAAD,cAAuD,CAApDE,gBAAAC,gBAAAL,MAAA,SAAA,CAAS,CAAA,sCAAA,CAAA,GAAA,CAAA,C;;;;;;;;G,IAIhBD,YAYeC,MAAAC,oBAAA,GAAA,EAZD,OAAM,aAAY,GAAA;IAC9B,SAAAC,cAUM,CAVNI,mBAUM,OAVN,YAUM,CATJP,YAQeC,MAAA,YAAA,GAAA;KAPb,OAAM;KACL,UAAQ,CAAG,QAAA,OAAO;KAClB,QAAAA,MAAA,MAAA;KACD,MAAK;KACL,SAAQ;KACP,SAAO;;KACR,SAAAE,cAA6D,CAA1DE,gBAAAC,gBAAAL,MAAA,SAAA,CAAS,CAAA,4CAAA,CAAA,GAAA,CAAA,C"}
|
|
@@ -11,6 +11,8 @@ type __VLS_Props = {
|
|
|
11
11
|
isStatic: boolean;
|
|
12
12
|
/** Available authentication scheme options */
|
|
13
13
|
selectedSchemeOptions: SecuritySchemeOption[];
|
|
14
|
+
/** Original store indexes when visible choices are filtered. */
|
|
15
|
+
selectedSchemeIndexes?: number[];
|
|
14
16
|
/** Index of the currently active authentication tab */
|
|
15
17
|
activeAuthIndex: number;
|
|
16
18
|
/** Proxy URL */
|
package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestAuthDataTable.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestAuthDataTable.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"names":[],"mappings":"AAwKA,OAAO,KAAK,EAEV,QAAQ,EACR,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AACjG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAA;AAM1G,KAAK,WAAW,GAAG;IACjB,4CAA4C;IAC5C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAA;IACjB,8CAA8C;IAC9C,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;IAC7C,gEAAgE;IAChE,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;IAChC,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,0CAA0C;IAC1C,eAAe,EAAE,qBAAqB,CAAA;IACtC,mCAAmC;IACnC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,0CAA0C;IAC1C,IAAI,EAAE,QAAQ,CAAA;IACd,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;CACtC,CAAC;AAkQF,QAAA,MAAM,YAAY;;oPAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestAuthDataTable.vue.js","names":["_sfc_main"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst { translate } = useLocalization()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n {{ translate('apiClient.requestAuthDataTable.noauthenticationSelected') }}\n </div>\n </form>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"RequestAuthDataTable.vue.js","names":["_sfc_main"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n selectedSchemeIndexes,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Original store indexes when visible choices are filtered. */\n selectedSchemeIndexes?: number[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst { translate } = useLocalization()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index: selectedSchemeIndexes?.[index] ?? index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n {{ translate('apiClient.requestAuthDataTable.noauthenticationSelected') }}\n </div>\n </form>\n</template>\n"],"mappings":""}
|
|
@@ -15,6 +15,7 @@ var RequestAuthDataTable_vue_vue_type_script_setup_true_lang_default = /*@__PURE
|
|
|
15
15
|
environment: {},
|
|
16
16
|
isStatic: { type: Boolean },
|
|
17
17
|
selectedSchemeOptions: {},
|
|
18
|
+
selectedSchemeIndexes: {},
|
|
18
19
|
activeAuthIndex: {},
|
|
19
20
|
proxyUrl: {},
|
|
20
21
|
securitySchemes: { default: () => ({}) },
|
|
@@ -35,7 +36,7 @@ var RequestAuthDataTable_vue_vue_type_script_setup_true_lang_default = /*@__PURE
|
|
|
35
36
|
const shouldShowTabs = computed(() => __props.selectedSchemeOptions.length > 1);
|
|
36
37
|
/** Handles authentication tab selection */
|
|
37
38
|
const handleTabChange = (index) => __props.eventBus.emit("auth:update:active-index", {
|
|
38
|
-
index,
|
|
39
|
+
index: __props.selectedSchemeIndexes?.[index] ?? index,
|
|
39
40
|
meta: __props.meta
|
|
40
41
|
});
|
|
41
42
|
/** Handles updates to OAuth scope selection */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestAuthDataTable.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_withModifiers","_normalizeClass","_Fragment","_renderList","_createElementVNode","_toDisplayString","_createCommentVNode","_createBlock","_unref","DataTable","_withCtx","_createVNode","RequestAuthTab"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst { translate } = useLocalization()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n {{ translate('apiClient.requestAuthDataTable.noauthenticationSelected') }}\n </div>\n </form>\n</template>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestAuthDataTable.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_withModifiers","_normalizeClass","_Fragment","_renderList","_createElementVNode","_toDisplayString","_createCommentVNode","_createBlock","_unref","DataTable","_withCtx","_createVNode","RequestAuthTab"],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n selectedSchemeIndexes,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Original store indexes when visible choices are filtered. */\n selectedSchemeIndexes?: number[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst { translate } = useLocalization()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index: selectedSchemeIndexes?.[index] ?? index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n {{ translate('apiClient.requestAuthDataTable.noauthenticationSelected') }}\n </div>\n </form>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyDA,MAAM,EAAE,cAAc,gBAAgB;;EAGtC,MAAM,eAAe,eACb,QAAA,sBAAsB,QAAA,gBAC9B;;;;;EAMA,MAAM,iBAAiB,eAAwB,QAAA,sBAAsB,SAAS,CAAC;;EAG/E,MAAM,mBAAmB,UACvB,QAAA,SAAS,KAAK,4BAA4B;GACxC,OAAO,QAAA,wBAAwB,UAAU;GACzC,MAAG,QAAA;EACL,CAAC;;EAGH,MAAM,sBACJ,WAEA,QAAA,SAAS,KAAK,+BAA+B;GAC3C,GAAG;GACH,MAAG,QAAA;EACL,CAAC;;EAGH,MAAM,qBACJ,WACS,QAAA,SAAS,KAAK,sBAAsB,MAAM;;EAGrD,MAAM,qBACJ,WACS,QAAA,SAAS,KAAK,sBAAsB,MAAM;;EAGrD,MAAM,eA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CAAC,mFAAiF,EAAA,gDAC7B,QAAA,SAAQ,CAAA,CAAA;GAC/D,GAAAI,gBAAAG,MAAA,SAAA,CAAS,CAAA,yDAAA,CAAA,GAAA,CAAA,E"}
|
|
@@ -60,5 +60,5 @@ export declare const getSecuritySchemeOptions: (security: NonNullable<OpenApiDoc
|
|
|
60
60
|
/** We need to add the selected schemes if they do not already exist in the calculated options */
|
|
61
61
|
selectedSchemes: SecurityRequirementObject[],
|
|
62
62
|
/** Allows adding authentication which is not in the document */
|
|
63
|
-
canAddNewAuth?: boolean, labels?: Pick<ApiClientTranslations, "authSelector" | "authOptions"
|
|
63
|
+
canAddNewAuth?: boolean, labels?: Pick<ApiClientTranslations, "authSelector" | "authOptions">, allowedSecuritySchemes?: string[]) => SecuritySchemeOption[] | SecuritySchemeGroup[];
|
|
64
64
|
//# sourceMappingURL=security-scheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-scheme.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAGxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAC5G,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAYrE,gEAAgE;AAChE,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,yBAAyB,CAAA;IAChC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,oBAAoB,CAAA;CAC/B,CAAA;AAED,mEAAmE;AACnE,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,oBAAoB,EAAE,CAAA;CAChC,CAAA;AAKD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,iBAAiB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,yBAAyB,CAAA;CAAE;;;;;CAK9F,CAAA;AAEF,uCAAuC;AACvC,eAAO,MAAM,mBAAmB,GAAI,QAAQ,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;;;;;CAIxF,CAAA;AAuCJ;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GACrC,iBAAiB,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,GAAG,qBAAqB,KACxF;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,sBAAsB,CAAA;IAC7B,QAAQ,EAAE,mBAAmB,GAAG,UAAU,CAAA;IAC1C,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB,GAAG,IAgCH,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,UAAU,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,EAClD,iBAAiB,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,GAAG,qBAAqB;AACzF,iGAAiG;AACjG,iBAAiB,yBAAyB,EAAE;AAC5C,gEAAgE;AAChE,uBAAqB,EACrB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,cAAc,GAAG,aAAa,CAAM,
|
|
1
|
+
{"version":3,"file":"security-scheme.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAGxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAC5G,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,yBAAyB,EACzB,oBAAo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