@scalar/workspace-store 0.20.0 → 0.22.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 +58 -0
- package/README.md +2 -2
- package/dist/client.d.ts +54 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +66 -29
- package/dist/client.js.map +2 -2
- package/dist/events/bus.d.ts +14 -2
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/events/bus.js +46 -10
- package/dist/events/bus.js.map +3 -3
- package/dist/events/definitions/auth.d.ts +2 -1
- package/dist/events/definitions/auth.d.ts.map +1 -1
- package/dist/events/definitions/cookie.d.ts +20 -0
- package/dist/events/definitions/cookie.d.ts.map +1 -0
- package/dist/events/definitions/cookie.js +1 -0
- package/dist/events/definitions/cookie.js.map +7 -0
- package/dist/events/definitions/document.d.ts +19 -2
- package/dist/events/definitions/document.d.ts.map +1 -1
- package/dist/events/definitions/index.d.ts +6 -1
- package/dist/events/definitions/index.d.ts.map +1 -1
- package/dist/events/definitions/operation.d.ts +20 -14
- package/dist/events/definitions/operation.d.ts.map +1 -1
- package/dist/events/definitions/server.d.ts +2 -2
- package/dist/events/definitions/server.d.ts.map +1 -1
- package/dist/events/definitions/tabs.d.ts +55 -0
- package/dist/events/definitions/tabs.d.ts.map +1 -0
- package/dist/events/definitions/tabs.js +1 -0
- package/dist/events/definitions/tabs.js.map +7 -0
- package/dist/events/definitions/tag.d.ts +15 -0
- package/dist/events/definitions/tag.d.ts.map +1 -0
- package/dist/events/definitions/tag.js +1 -0
- package/dist/events/definitions/tag.js.map +7 -0
- package/dist/events/definitions/ui.d.ts +131 -39
- package/dist/events/definitions/ui.d.ts.map +1 -1
- package/dist/events/definitions/workspace.d.ts +18 -0
- package/dist/events/definitions/workspace.d.ts.map +1 -0
- package/dist/events/definitions/workspace.js +1 -0
- package/dist/events/definitions/workspace.js.map +7 -0
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js.map +2 -2
- package/dist/helpers/generate-unique-value.d.ts +19 -6
- package/dist/helpers/generate-unique-value.d.ts.map +1 -1
- package/dist/helpers/generate-unique-value.js +12 -7
- package/dist/helpers/generate-unique-value.js.map +2 -2
- package/dist/helpers/unpack-proxy.d.ts +14 -1
- package/dist/helpers/unpack-proxy.d.ts.map +1 -1
- package/dist/helpers/unpack-proxy.js +51 -1
- package/dist/helpers/unpack-proxy.js.map +3 -3
- package/dist/mutators/auth.d.ts +7 -2
- package/dist/mutators/auth.d.ts.map +1 -1
- package/dist/mutators/auth.js +24 -21
- package/dist/mutators/auth.js.map +2 -2
- package/dist/mutators/cookie.d.ts +21 -13
- package/dist/mutators/cookie.d.ts.map +1 -1
- package/dist/mutators/cookie.js +34 -26
- package/dist/mutators/cookie.js.map +3 -3
- package/dist/mutators/document.d.ts +12 -2
- package/dist/mutators/document.d.ts.map +1 -1
- package/dist/mutators/document.js +42 -3
- package/dist/mutators/document.js.map +2 -2
- package/dist/mutators/index.d.ts +30 -20
- package/dist/mutators/index.d.ts.map +1 -1
- package/dist/mutators/index.js +38 -9
- package/dist/mutators/index.js.map +2 -2
- package/dist/mutators/operation.d.ts +49 -108
- package/dist/mutators/operation.d.ts.map +1 -1
- package/dist/mutators/operation.js +198 -94
- package/dist/mutators/operation.js.map +2 -2
- package/dist/mutators/request.d.ts +2 -1
- package/dist/mutators/request.d.ts.map +1 -1
- package/dist/mutators/request.js.map +1 -1
- package/dist/mutators/server.d.ts +1 -1
- package/dist/mutators/server.d.ts.map +1 -1
- package/dist/mutators/server.js +6 -5
- package/dist/mutators/server.js.map +2 -2
- package/dist/mutators/tabs.d.ts +44 -0
- package/dist/mutators/tabs.d.ts.map +1 -0
- package/dist/mutators/tabs.js +133 -0
- package/dist/mutators/tabs.js.map +7 -0
- package/dist/mutators/tag.d.ts +12 -0
- package/dist/mutators/tag.d.ts.map +1 -0
- package/dist/mutators/tag.js +19 -0
- package/dist/mutators/tag.js.map +7 -0
- package/dist/mutators/workspace.d.ts +6 -0
- package/dist/mutators/workspace.d.ts.map +1 -0
- package/dist/mutators/workspace.js +24 -0
- package/dist/mutators/workspace.js.map +7 -0
- package/dist/navigation/get-navigation-options.d.ts.map +1 -1
- package/dist/navigation/get-navigation-options.js +4 -4
- package/dist/navigation/get-navigation-options.js.map +2 -2
- package/dist/navigation/helpers/get-openapi-object.d.ts +35 -0
- package/dist/navigation/helpers/get-openapi-object.d.ts.map +1 -0
- package/dist/navigation/helpers/get-openapi-object.js +31 -0
- package/dist/navigation/helpers/get-openapi-object.js.map +7 -0
- package/dist/navigation/helpers/get-operation-entries.d.ts +24 -0
- package/dist/navigation/helpers/get-operation-entries.d.ts.map +1 -0
- package/dist/navigation/helpers/get-operation-entries.js +33 -0
- package/dist/navigation/helpers/get-operation-entries.js.map +7 -0
- package/dist/navigation/helpers/get-parent-entry.d.ts +15 -0
- package/dist/navigation/helpers/get-parent-entry.d.ts.map +1 -0
- package/dist/navigation/helpers/get-parent-entry.js +13 -0
- package/dist/navigation/helpers/get-parent-entry.js.map +7 -0
- package/dist/navigation/helpers/traverse-description.d.ts +0 -1
- package/dist/navigation/helpers/traverse-description.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-description.js +0 -1
- package/dist/navigation/helpers/traverse-description.js.map +2 -2
- package/dist/navigation/helpers/traverse-document.d.ts +1 -0
- package/dist/navigation/helpers/traverse-document.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-document.js +16 -2
- package/dist/navigation/helpers/traverse-document.js.map +2 -2
- package/dist/navigation/helpers/traverse-examples.js +2 -2
- package/dist/navigation/helpers/traverse-examples.js.map +2 -2
- package/dist/navigation/helpers/traverse-paths.d.ts +6 -3
- package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-paths.js +5 -10
- package/dist/navigation/helpers/traverse-paths.js.map +2 -2
- package/dist/navigation/helpers/traverse-tags.d.ts +0 -1
- package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-tags.js +57 -49
- package/dist/navigation/helpers/traverse-tags.js.map +3 -3
- package/dist/navigation/helpers/utils.d.ts +2 -1
- package/dist/navigation/helpers/utils.d.ts.map +1 -1
- package/dist/navigation/helpers/utils.js.map +1 -1
- package/dist/navigation/index.d.ts +2 -1
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +5 -3
- package/dist/navigation/index.js.map +2 -2
- package/dist/persistence/index.d.ts +6 -0
- package/dist/persistence/index.d.ts.map +1 -1
- package/dist/persistence/index.js +18 -0
- package/dist/persistence/index.js.map +2 -2
- package/dist/persistence/indexdb.d.ts +1 -0
- package/dist/persistence/indexdb.d.ts.map +1 -1
- package/dist/persistence/indexdb.js +6 -1
- package/dist/persistence/indexdb.js.map +2 -2
- package/dist/plugins/client/persistence.d.ts.map +1 -1
- package/dist/plugins/client/persistence.js +6 -0
- package/dist/plugins/client/persistence.js.map +2 -2
- package/dist/schemas/extensions/document/x-scalar-environments.d.ts +1 -0
- package/dist/schemas/extensions/document/x-scalar-environments.d.ts.map +1 -1
- package/dist/schemas/extensions/document/x-scalar-environments.js.map +2 -2
- package/dist/schemas/extensions/document/x-scalar-set-operation-security.d.ts +13 -0
- package/dist/schemas/extensions/document/x-scalar-set-operation-security.d.ts.map +1 -0
- package/dist/schemas/extensions/document/x-scalar-set-operation-security.js +8 -0
- package/dist/schemas/extensions/document/x-scalar-set-operation-security.js.map +7 -0
- package/dist/schemas/extensions/general/x-scalar-cookies.d.ts +36 -0
- package/dist/schemas/extensions/general/x-scalar-cookies.d.ts.map +1 -0
- package/dist/schemas/extensions/general/x-scalar-cookies.js +15 -0
- package/dist/schemas/extensions/general/x-scalar-cookies.js.map +7 -0
- package/dist/schemas/extensions/general/x-scalar-order.d.ts +12 -0
- package/dist/schemas/extensions/general/x-scalar-order.d.ts.map +1 -0
- package/dist/schemas/extensions/general/x-scalar-order.js +8 -0
- package/dist/schemas/extensions/general/x-scalar-order.js.map +7 -0
- package/dist/schemas/extensions/operation/index.d.ts +4 -1
- package/dist/schemas/extensions/operation/index.d.ts.map +1 -1
- package/dist/schemas/extensions/operation/index.js +22 -0
- package/dist/schemas/extensions/operation/index.js.map +3 -3
- package/dist/schemas/extensions/operation/x-code-samples.d.ts +0 -5
- package/dist/schemas/extensions/operation/x-code-samples.d.ts.map +1 -1
- package/dist/schemas/extensions/operation/x-code-samples.js +0 -1
- package/dist/schemas/extensions/operation/x-code-samples.js.map +2 -2
- package/dist/schemas/extensions/operation/x-post-response.d.ts +0 -18
- package/dist/schemas/extensions/operation/x-post-response.d.ts.map +1 -1
- package/dist/schemas/extensions/operation/x-post-response.js.map +1 -1
- package/dist/schemas/extensions/tag/x-tag-groups.d.ts +8 -14
- package/dist/schemas/extensions/tag/x-tag-groups.d.ts.map +1 -1
- package/dist/schemas/extensions/tag/x-tag-groups.js +15 -11
- package/dist/schemas/extensions/tag/x-tag-groups.js.map +2 -2
- package/dist/schemas/extensions/workspace/index.d.ts +4 -0
- package/dist/schemas/extensions/workspace/index.d.ts.map +1 -0
- package/dist/schemas/extensions/workspace/index.js +15 -0
- package/dist/schemas/extensions/workspace/index.js.map +7 -0
- package/dist/schemas/extensions/workspace/x-scalar-active-proxy.d.ts +18 -0
- package/dist/schemas/extensions/workspace/x-scalar-active-proxy.d.ts.map +1 -0
- package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js +8 -0
- package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js.map +7 -0
- package/dist/schemas/extensions/workspace/x-scalar-tabs.d.ts +36 -0
- package/dist/schemas/extensions/workspace/x-scalar-tabs.d.ts.map +1 -0
- package/dist/schemas/extensions/workspace/x-scalar-tabs.js +16 -0
- package/dist/schemas/extensions/workspace/x-scalar-tabs.js.map +7 -0
- package/dist/schemas/extensions.d.ts +1 -1
- package/dist/schemas/extensions.js +1 -1
- package/dist/schemas/extensions.js.map +2 -2
- package/dist/schemas/inmemory-workspace.d.ts +46 -33
- package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
- package/dist/schemas/navigation.d.ts +12 -1
- package/dist/schemas/navigation.d.ts.map +1 -1
- package/dist/schemas/navigation.js +2 -1
- package/dist/schemas/navigation.js.map +2 -2
- package/dist/schemas/reference-config/index.d.ts +22 -16
- package/dist/schemas/reference-config/index.d.ts.map +1 -1
- package/dist/schemas/reference-config/settings.d.ts +22 -16
- package/dist/schemas/reference-config/settings.d.ts.map +1 -1
- package/dist/schemas/reference-config/settings.js +2 -0
- package/dist/schemas/reference-config/settings.js.map +2 -2
- package/dist/schemas/v3.1/strict/header.d.ts +0 -45
- package/dist/schemas/v3.1/strict/header.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/header.js +1 -3
- package/dist/schemas/v3.1/strict/header.js.map +2 -2
- package/dist/schemas/v3.1/strict/oauth-flow.d.ts +0 -99
- package/dist/schemas/v3.1/strict/oauth-flow.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/oauth-flow.js +0 -7
- package/dist/schemas/v3.1/strict/oauth-flow.js.map +2 -2
- package/dist/schemas/v3.1/strict/openapi-document.d.ts +756 -552
- package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.js +10 -11
- package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
- package/dist/schemas/v3.1/strict/operation.d.ts +1 -5
- package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/operation.js +1 -5
- package/dist/schemas/v3.1/strict/operation.js.map +2 -2
- package/dist/schemas/v3.1/strict/parameter.d.ts +1 -101
- package/dist/schemas/v3.1/strict/parameter.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/parameter.js +1 -4
- package/dist/schemas/v3.1/strict/parameter.js.map +2 -2
- package/dist/schemas/v3.1/strict/ref-definitions.d.ts +0 -1
- package/dist/schemas/v3.1/strict/ref-definitions.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/ref-definitions.js +0 -2
- package/dist/schemas/v3.1/strict/ref-definitions.js.map +2 -2
- package/dist/schemas/v3.1/strict/schema.d.ts +28 -11
- package/dist/schemas/v3.1/strict/schema.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/schema.js +2 -2
- package/dist/schemas/v3.1/strict/schema.js.map +2 -2
- package/dist/schemas/v3.1/strict/security-scheme.d.ts +1 -54
- package/dist/schemas/v3.1/strict/security-scheme.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/security-scheme.js +0 -5
- package/dist/schemas/v3.1/strict/security-scheme.js.map +2 -2
- package/dist/schemas/v3.1/strict/tag.d.ts +4 -1
- package/dist/schemas/v3.1/strict/tag.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/tag.js +3 -1
- package/dist/schemas/v3.1/strict/tag.js.map +2 -2
- package/dist/schemas/v3.1/strict/type-guards.d.ts +6 -0
- package/dist/schemas/v3.1/strict/type-guards.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/type-guards.js +4 -0
- package/dist/schemas/v3.1/strict/type-guards.js.map +2 -2
- package/dist/schemas/workspace-specification/config.d.ts +22 -16
- package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
- package/dist/schemas/workspace-specification/index.d.ts +23 -17
- package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
- package/dist/schemas/workspace.d.ts +204 -130
- package/dist/schemas/workspace.d.ts.map +1 -1
- package/dist/schemas/workspace.js +18 -11
- package/dist/schemas/workspace.js.map +2 -2
- package/dist/server.d.ts +1 -1
- package/dist/workspace-plugin.d.ts +3 -0
- package/dist/workspace-plugin.d.ts.map +1 -1
- package/package.json +50 -35
- package/dist/schemas/extensions/document/x-scalar-document-security.d.ts +0 -13
- package/dist/schemas/extensions/document/x-scalar-document-security.d.ts.map +0 -1
- package/dist/schemas/extensions/document/x-scalar-document-security.js +0 -8
- package/dist/schemas/extensions/document/x-scalar-document-security.js.map +0 -7
- package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.d.ts +0 -13
- package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.d.ts.map +0 -1
- package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.js +0 -9
- package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.js.map +0 -7
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts +0 -32
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts.map +0 -1
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js +0 -13
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpack-proxy.d.ts","sourceRoot":"","sources":["../../src/helpers/unpack-proxy.ts"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"unpack-proxy.d.ts","sourceRoot":"","sources":["../../src/helpers/unpack-proxy.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,OAAO,CAAC,EAAE,YAAe;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,KAAG,CAsE9F,CAAA"}
|
|
@@ -2,7 +2,57 @@ import { getRaw } from "@scalar/json-magic/magic-proxy";
|
|
|
2
2
|
import { toRaw } from "vue";
|
|
3
3
|
import { unpackDetectChangesProxy } from "../helpers/detect-changes-proxy.js";
|
|
4
4
|
import { unpackOverridesProxy } from "../helpers/overrides-proxy.js";
|
|
5
|
-
const unpackProxyObject = (input) =>
|
|
5
|
+
const unpackProxyObject = (input, { depth = 0 } = {}) => {
|
|
6
|
+
const dfs = (value, currentDepth = 0) => {
|
|
7
|
+
if (typeof value !== "object" || value === null) {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
const raw = unpackDetectChangesProxy(toRaw(getRaw(unpackOverridesProxy(value))));
|
|
11
|
+
if (depth !== null && currentDepth >= depth) {
|
|
12
|
+
return raw;
|
|
13
|
+
}
|
|
14
|
+
if (currentDepth !== 0 && raw !== value) {
|
|
15
|
+
console.warn(
|
|
16
|
+
"%c\u26A0 Warning:%c You tried to assign a proxied object (depth: %d).\n%c\u{1F4A1} Tip:%c Pass a plain object instead \u2014 wrapping a proxy inside another proxy may cause weird bugs.\n%c\u{1F50D} Debug Info:%c The problematic value is shown below:",
|
|
17
|
+
// styles
|
|
18
|
+
"background: #fdd835; color: #000; font-weight: bold; padding: 2px 4px; border-radius: 3px;",
|
|
19
|
+
"color: inherit;",
|
|
20
|
+
currentDepth,
|
|
21
|
+
"color: #00bfa5; font-weight: bold;",
|
|
22
|
+
"color: inherit;",
|
|
23
|
+
"color: #03a9f4; font-weight: bold;",
|
|
24
|
+
"color: inherit;",
|
|
25
|
+
value,
|
|
26
|
+
input
|
|
27
|
+
);
|
|
28
|
+
console.groupCollapsed("%c\u{1F4DC} Proxy assignment trace", "color: #9c27b0; font-weight: bold;");
|
|
29
|
+
console.trace({ value, raw });
|
|
30
|
+
console.groupEnd();
|
|
31
|
+
}
|
|
32
|
+
Object.entries(raw).forEach(([key, value2]) => {
|
|
33
|
+
const propertyResult = dfs(value2, currentDepth + 1);
|
|
34
|
+
const result = Reflect.set(raw, key, propertyResult);
|
|
35
|
+
if (!result) {
|
|
36
|
+
console.warn(
|
|
37
|
+
'%c\u{1F6AB} Readonly Property Error:%c Failed to set property "%s" on object.\n%c\u{1F4A1} Tip:%c This property is readonly or non-configurable. You cannot unpack a readonly property \u2014 the value was not updated.\n%c\u{1F50D} Debug Info:%c Property: %s | Value: %o | Object: %o',
|
|
38
|
+
// styles
|
|
39
|
+
"background: #f44336; color: #fff; font-weight: bold; padding: 2px 4px; border-radius: 3px;",
|
|
40
|
+
"color: inherit;",
|
|
41
|
+
key,
|
|
42
|
+
"color: #00bfa5; font-weight: bold;",
|
|
43
|
+
"color: inherit;",
|
|
44
|
+
"color: #03a9f4; font-weight: bold;",
|
|
45
|
+
"color: inherit;",
|
|
46
|
+
key,
|
|
47
|
+
propertyResult,
|
|
48
|
+
raw
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return raw;
|
|
53
|
+
};
|
|
54
|
+
return dfs(input);
|
|
55
|
+
};
|
|
6
56
|
export {
|
|
7
57
|
unpackProxyObject
|
|
8
58
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers/unpack-proxy.ts"],
|
|
4
|
-
"sourcesContent": ["import { getRaw } from '@scalar/json-magic/magic-proxy'\nimport { toRaw } from 'vue'\n\nimport { unpackDetectChangesProxy } from '@/helpers/detect-changes-proxy'\nimport { unpackOverridesProxy } from '@/helpers/overrides-proxy'\n\n/**\n * Unpacks special vue reactivity & override & detect-changes & magic proxy from an input object or array,\n * returning the \"raw\" plain object or array.\n */\nexport const unpackProxyObject = <T>(input: T): T
|
|
5
|
-
"mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,aAAa;AAEtB,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { getRaw } from '@scalar/json-magic/magic-proxy'\nimport { toRaw } from 'vue'\n\nimport { unpackDetectChangesProxy } from '@/helpers/detect-changes-proxy'\nimport { unpackOverridesProxy } from '@/helpers/overrides-proxy'\n\n/**\n * Unpacks special vue reactivity & override & detect-changes & magic proxy from an input object or array,\n * returning the \"raw\" plain object or array.\n *\n * This function recursively traverses the input object or array, removing any proxies\n * (e.g. Vue reactivity proxies, magic proxies, override proxies, detect-changes proxies)\n * to obtain and return the underlying \"raw\" plain object or array.\n *\n * The recursion is controlled by the `depth` parameter. If `depth` is `null`, unlimited depth is allowed.\n * If a proxied object is detected and unwrapped at non-root level, a warning is logged.\n *\n * @param input - The object or array (possibly deeply nested or proxied) to recursively unwrap.\n * @param depth - Optional, limits recursion depth. `null` means unlimited depth (default is 1).\n * @returns - A plain object or array with all proxies removed up to the specified depth.\n */\nexport const unpackProxyObject = <T>(input: T, { depth = 0 }: { depth?: number | null } = {}): T => {\n // Internal DFS helper to recursively strip all known proxies (Vue, overrides, detect-changes, magic proxies)\n const dfs = (value: any, currentDepth: number = 0): any => {\n // Base case: non-objects (primitives, null) are returned as-is\n if (typeof value !== 'object' || value === null) {\n return value\n }\n\n // Compose all the proxy unwraps in order\n const raw = unpackDetectChangesProxy(toRaw(getRaw(unpackOverridesProxy(value))))\n\n // If we have reached the maximum depth, return the value (potentially still partially proxied)\n if (depth !== null && currentDepth >= depth) {\n return raw\n }\n\n // Show a warning if a nested value was a proxy (usually undesired, can cause subtle bugs)\n if (currentDepth !== 0 && raw !== value) {\n console.warn(\n '%c\u26A0 Warning:%c You tried to assign a proxied object (depth: %d).\\n' +\n '%c\uD83D\uDCA1 Tip:%c Pass a plain object instead \u2014 wrapping a proxy inside another proxy may cause weird bugs.\\n' +\n '%c\uD83D\uDD0D Debug Info:%c The problematic value is shown below:',\n // styles\n 'background: #fdd835; color: #000; font-weight: bold; padding: 2px 4px; border-radius: 3px;',\n 'color: inherit;',\n currentDepth,\n 'color: #00bfa5; font-weight: bold;',\n 'color: inherit;',\n 'color: #03a9f4; font-weight: bold;',\n 'color: inherit;',\n value,\n input,\n )\n\n // Collapsed trace group for cleaner output\n console.groupCollapsed('%c\uD83D\uDCDC Proxy assignment trace', 'color: #9c27b0; font-weight: bold;')\n console.trace({ value, raw })\n console.groupEnd()\n }\n\n // Recursively process all properties/entries to make sure we are not assigning proxies directly,\n // but are always assigning plain objects at any level.\n Object.entries(raw).forEach(([key, value]) => {\n const propertyResult = dfs(value, currentDepth + 1)\n const result = Reflect.set(raw, key, propertyResult)\n\n if (!result) {\n console.warn(\n '%c\uD83D\uDEAB Readonly Property Error:%c Failed to set property \"%s\" on object.\\n' +\n '%c\uD83D\uDCA1 Tip:%c This property is readonly or non-configurable. You cannot unpack a readonly property \u2014 the value was not updated.\\n' +\n '%c\uD83D\uDD0D Debug Info:%c Property: %s | Value: %o | Object: %o',\n // styles\n 'background: #f44336; color: #fff; font-weight: bold; padding: 2px 4px; border-radius: 3px;',\n 'color: inherit;',\n key,\n 'color: #00bfa5; font-weight: bold;',\n 'color: inherit;',\n 'color: #03a9f4; font-weight: bold;',\n 'color: inherit;',\n key,\n propertyResult,\n raw,\n )\n }\n })\n\n return raw\n }\n\n return dfs(input)\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,aAAa;AAEtB,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AAiB9B,MAAM,oBAAoB,CAAI,OAAU,EAAE,QAAQ,EAAE,IAA+B,CAAC,MAAS;AAElG,QAAM,MAAM,CAAC,OAAY,eAAuB,MAAW;AAEzD,QAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,aAAO;AAAA,IACT;AAGA,UAAM,MAAM,yBAAyB,MAAM,OAAO,qBAAqB,KAAK,CAAC,CAAC,CAAC;AAG/E,QAAI,UAAU,QAAQ,gBAAgB,OAAO;AAC3C,aAAO;AAAA,IACT;AAGA,QAAI,iBAAiB,KAAK,QAAQ,OAAO;AACvC,cAAQ;AAAA,QACN;AAAA;AAAA,QAIA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAGA,cAAQ,eAAe,sCAA+B,oCAAoC;AAC1F,cAAQ,MAAM,EAAE,OAAO,IAAI,CAAC;AAC5B,cAAQ,SAAS;AAAA,IACnB;AAIA,WAAO,QAAQ,GAAG,EAAE,QAAQ,CAAC,CAAC,KAAKA,MAAK,MAAM;AAC5C,YAAM,iBAAiB,IAAIA,QAAO,eAAe,CAAC;AAClD,YAAM,SAAS,QAAQ,IAAI,KAAK,KAAK,cAAc;AAEnD,UAAI,CAAC,QAAQ;AACX,gBAAQ;AAAA,UACN;AAAA;AAAA,UAIA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAEA,SAAO,IAAI,KAAK;AAClB;",
|
|
6
|
+
"names": ["value"]
|
|
7
7
|
}
|
package/dist/mutators/auth.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type AuthMeta = {
|
|
|
39
39
|
* })
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export declare const updateSelectedSecuritySchemes: (document: WorkspaceDocument | null, { selectedRequirements, newSchemes, meta }: AuthEvents["auth:update:selected-security-schemes"]) => void
|
|
42
|
+
export declare const updateSelectedSecuritySchemes: (document: WorkspaceDocument | null, { selectedRequirements, newSchemes, meta }: AuthEvents["auth:update:selected-security-schemes"]) => Promise<void>;
|
|
43
43
|
/**
|
|
44
44
|
* Updates a security scheme in the OpenAPI document's components object.
|
|
45
45
|
* Handles updates for HTTP, API Key, and OAuth2 types, saving secret information and configuration for UI-auth flows.
|
|
@@ -63,7 +63,12 @@ export declare const updateSelectedSecuritySchemes: (document: WorkspaceDocument
|
|
|
63
63
|
* name: 'MyHttpAuth',
|
|
64
64
|
* })
|
|
65
65
|
*/
|
|
66
|
-
export declare const updateSecurityScheme: (document: WorkspaceDocument | null, { payload, name }: AuthEvents["auth:update:security-scheme"]) => import("../schemas/v3.1/strict/security-scheme.js").ApiKeyObject | import("../schemas/v3.1/strict/security-scheme.js").HttpObject | import("../schemas/v3.1/strict/security-scheme.js").OAuth2Object |
|
|
66
|
+
export declare const updateSecurityScheme: (document: WorkspaceDocument | null, { payload, name }: AuthEvents["auth:update:security-scheme"]) => import("../schemas/v3.1/strict/security-scheme.js").ApiKeyObject | import("../schemas/v3.1/strict/security-scheme.js").HttpObject | import("../schemas/v3.1/strict/security-scheme.js").OAuth2Object | ({
|
|
67
|
+
description?: string;
|
|
68
|
+
} & {
|
|
69
|
+
type: "openIdConnect";
|
|
70
|
+
openIdConnectUrl: string;
|
|
71
|
+
}) | undefined;
|
|
67
72
|
/**
|
|
68
73
|
* Sets the selected authentication tab (scheme) index for the given OpenAPI document or operation.
|
|
69
74
|
* - When on the document level, updates the 'selectedIndex' on the document's x-scalar-selected-security extension.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/mutators/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAI3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAGlD;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAChB;IACE,IAAI,EAAE,UAAU,CAAA;CACjB,GACD;IACE,IAAI,EAAE,WAAW,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAA;CACnB,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,iBAAiB,GAAG,IAAI,EAClC,4CAA4C,UAAU,CAAC,uCAAuC,CAAC,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/mutators/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAI3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAGlD;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAChB;IACE,IAAI,EAAE,UAAU,CAAA;CACjB,GACD;IACE,IAAI,EAAE,WAAW,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAA;CACnB,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,iBAAiB,GAAG,IAAI,EAClC,4CAA4C,UAAU,CAAC,uCAAuC,CAAC,kBA+EhG,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,iBAAiB,GAAG,IAAI,EAClC,mBAAmB,UAAU,CAAC,6BAA6B,CAAC;;;;;cAc7D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAU,iBAAiB,GAAG,IAAI,EAClC,iBAAiB,UAAU,CAAC,0BAA0B,CAAC,SA+BxD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,iBAAiB,GAAG,IAAI,EAClC,4BAA4B,UAAU,CAAC,6BAA6B,CAAC,SAqCtE,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,iBAAiB,GAAG,IAAI,EAClC,WAAW,UAAU,CAAC,6BAA6B,CAAC,SA6DrD,CAAA"}
|
package/dist/mutators/auth.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { generateUniqueValue } from "../helpers/generate-unique-value.js";
|
|
2
2
|
import { getResolvedRef } from "../helpers/get-resolved-ref.js";
|
|
3
3
|
import { mergeObjects } from "../helpers/merge-object.js";
|
|
4
|
-
const updateSelectedSecuritySchemes = (document, { selectedRequirements, newSchemes, meta }) => {
|
|
4
|
+
const updateSelectedSecuritySchemes = async (document, { selectedRequirements, newSchemes, meta }) => {
|
|
5
5
|
if (!document) {
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
@@ -11,26 +11,29 @@ const updateSelectedSecuritySchemes = (document, { selectedRequirements, newSche
|
|
|
11
11
|
}
|
|
12
12
|
return getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
|
|
13
13
|
};
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
document.components
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
document.components.securitySchemes
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
const createdSecurityRequirements = await Promise.all(
|
|
15
|
+
newSchemes.map(async (newScheme) => {
|
|
16
|
+
const uniqueSchemeName = await generateUniqueValue({
|
|
17
|
+
defaultValue: newScheme.name,
|
|
18
|
+
validation: (value) => !document.components?.securitySchemes?.[value],
|
|
19
|
+
maxRetries: 100
|
|
20
|
+
});
|
|
21
|
+
if (!uniqueSchemeName) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!document.components) {
|
|
25
|
+
document.components = {};
|
|
26
|
+
}
|
|
27
|
+
if (!document.components.securitySchemes) {
|
|
28
|
+
document.components.securitySchemes = {};
|
|
29
|
+
}
|
|
30
|
+
document.components.securitySchemes[uniqueSchemeName] = newScheme.scheme;
|
|
31
|
+
return {
|
|
32
|
+
[uniqueSchemeName]: []
|
|
33
|
+
};
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
const createdSchemes = createdSecurityRequirements.filter(Boolean);
|
|
34
37
|
const target = getTarget();
|
|
35
38
|
const newSelectedSecuritySchemes = [...selectedRequirements, ...createdSchemes];
|
|
36
39
|
if (!target) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mutators/auth.ts"],
|
|
4
|
-
"sourcesContent": ["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\n\nimport type { AuthEvents } from '@/events/definitions/auth'\nimport { generateUniqueValue } from '@/helpers/generate-unique-value'\nimport { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport type { WorkspaceDocument } from '@/schemas'\nimport type { SecurityRequirementObject } from '@/schemas/v3.1/strict/security-requirement'\n\n/**\n * AuthMeta defines the meta information needed to specify whether the authentication operation\n * is being performed at the document level (entire API), or for a specific operation (specific path and method).\n *\n * - If type is 'document', the operation applies to the whole OpenAPI document.\n * - If type is 'operation', it targets a specific operation, identified by its path and method.\n */\nexport type AuthMeta =\n | {\n type: 'document'\n }\n | {\n type: 'operation'\n path: string\n method: HttpMethod\n }\n\n/**\n * Updates the selected security schemes for either the entire document or a specific operation.\n * - Adds newly created security schemes (if any) to the workspace document's components.\n * - Ensures that each new scheme name is unique within the document by using `generateUniqueValue`.\n * - Updates the `x-scalar-selected-security` property on the target (document or operation) to reflect the new set of selected security schemes.\n * - Corrects and maintains the selected index so it points to a valid security scheme.\n *\n * @param document - The workspace OpenAPI document to mutate (can be null, in which case nothing happens)\n * @param selectedSecuritySchemes - The current list of selected security scheme objects\n * @param create - Array of new schemes to create, each with a name and a scheme definition\n * @param meta - Location to update: whole document or a specific operation (`{ type: 'document' }` or `{ type: 'operation', path, method }`)\n *\n * Example usage:\n * ```\n * updateSelectedSecuritySchemes({\n * document,\n * selectedSecuritySchemes: [{ bearerAuth: [] }],\n * create: [\n * { name: 'ApiKeyAuth', scheme: { type: 'apiKey', in: 'header', name: 'X-API-Key' } }\n * ],\n * meta: { type: 'document' }\n * })\n * ```\n */\nexport const updateSelectedSecuritySchemes = (\n document: WorkspaceDocument | null,\n { selectedRequirements, newSchemes, meta }: AuthEvents['auth:update:selected-security-schemes'],\n) => {\n if (!document) {\n return\n }\n\n // Helper to get the target (whole document or a specific operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return document\n }\n\n return getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n }\n\n // Create any new security schemes required, ensuring unique names for the components\n const createdSchemes = newSchemes\n .map((scheme) => {\n const name = generateUniqueValue({\n defaultValue: scheme.name,\n validation: (value) => !document.components?.securitySchemes?.[value],\n maxRetries: 100,\n })\n\n if (!name) {\n return\n }\n\n // Ensure components and securitySchemes exist\n if (!document.components) {\n document.components = {}\n }\n if (!document.components.securitySchemes) {\n document.components.securitySchemes = {}\n }\n\n // Add the new security scheme definition\n document.components.securitySchemes[name] = scheme.scheme\n\n // Return an OpenAPI Security Requirement Object for this new scheme (empty scope array)\n return {\n [name]: [],\n }\n })\n .filter(Boolean) as SecurityRequirementObject[]\n\n const target = getTarget()\n\n const newSelectedSecuritySchemes = [...selectedRequirements, ...createdSchemes]\n\n // If the target (document/operation) doesn't exist, do nothing\n if (!target) {\n return\n }\n\n // Ensure the x-scalar-selected-security structure exists on the target\n if (!target['x-scalar-selected-security']) {\n target['x-scalar-selected-security'] = {\n selectedIndex: -1,\n selectedSchemes: [],\n }\n }\n\n const selectedIndex = target['x-scalar-selected-security'].selectedIndex\n\n // Update the schemes array\n target['x-scalar-selected-security'].selectedSchemes = newSelectedSecuritySchemes\n\n // Adjust selected index if there are schemes and the index is unset/invalid\n if (newSelectedSecuritySchemes.length > 0 && selectedIndex < 0) {\n target['x-scalar-selected-security'].selectedIndex = 0\n }\n\n // If the selected index is now out of bounds, select the last available\n if (selectedIndex >= newSelectedSecuritySchemes.length) {\n target['x-scalar-selected-security'].selectedIndex = newSelectedSecuritySchemes.length - 1\n }\n}\n\n/**\n * Updates a security scheme in the OpenAPI document's components object.\n * Handles updates for HTTP, API Key, and OAuth2 types, saving secret information and configuration for UI-auth flows.\n *\n * @param document - The OpenAPI workspace document (can be null)\n * @param data - The update information, including type and payload\n * @param name - The name of the security scheme in document.components.securitySchemes\n *\n * Example usage:\n *\n * updateSecurityScheme({\n * document,\n * data: {\n * type: 'http',\n * payload: {\n * username: 'user123',\n * password: 'pw123',\n * token: 'tokenval'\n * }\n * },\n * name: 'MyHttpAuth',\n * })\n */\nexport const updateSecurityScheme = (\n document: WorkspaceDocument | null,\n { payload, name }: AuthEvents['auth:update:security-scheme'],\n) => {\n const target = getResolvedRef(document?.components?.securitySchemes?.[name])\n if (!target) {\n console.error(`Security scheme ${name} not found`)\n return\n }\n\n // Handle HTTP (basic, bearer, etc.)\n if (target.type === payload.type) {\n mergeObjects(target, payload)\n }\n\n return target\n}\n\n/**\n * Sets the selected authentication tab (scheme) index for the given OpenAPI document or operation.\n * - When on the document level, updates the 'selectedIndex' on the document's x-scalar-selected-security extension.\n * - When on an operation (endpoint) level, updates the 'selectedIndex' for that operation's x-scalar-selected-security.\n *\n * Also initializes the x-scalar-selected-security extension if it does not exist.\n *\n * @param document The OpenAPI document object (may be null)\n * @param index The index to set as selected\n * @param meta Context where the selection applies ('document' or specific operation)\n *\n * @example\n * // Document-level tab selection\n * updateSelectedAuthTab({\n * document,\n * index: 1,\n * meta: { type: 'document' }\n * });\n *\n * // Operation-level tab selection (e.g., GET /pets)\n * updateSelectedAuthTab({\n * document,\n * index: 0,\n * meta: { type: 'operation', path: '/pets', method: 'get' }\n * });\n */\nexport const updateSelectedAuthTab = (\n document: WorkspaceDocument | null,\n { index, meta }: AuthEvents['auth:update:active-index'],\n) => {\n if (!document) {\n return\n }\n\n // Determine the target object for setting the auth tab index:\n // - Document/root level\n // - Operation/endpoint level (if meta specifies operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return document\n }\n return getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n }\n\n const target = getTarget()\n if (!target) {\n return\n }\n\n // Ensure the 'x-scalar-selected-security' extension exists\n if (!target['x-scalar-selected-security']) {\n target['x-scalar-selected-security'] = {\n selectedIndex: 0,\n selectedSchemes: [],\n }\n }\n\n // Set the selected auth tab index\n target['x-scalar-selected-security'].selectedIndex = index\n}\n\n/**\n * Updates the scopes for a specific security requirement in the selected security schemes of\n * a document or operation.\n *\n * @param document - The OpenAPI WorkspaceDocument to update.\n * @param id - An array of scheme names that uniquely identifies the target security requirement.\n * For example: ['OAuth', 'ApiKeyAuth']\n * @param name - The security scheme name to update scopes for (e.g., 'OAuth').\n * @param scopes - The new list of scopes to set. For example: ['read:pets', 'write:pets']\n * @param meta - The context specifying whether the update is at the document-level or operation-level.\n *\n * Example usage:\n * ```ts\n * // Suppose your document (or operation) x-scalar-selected-security looks like:\n * // \"x-scalar-selected-security\": {\n * // selectedIndex: 0,\n * // selectedSchemes: [\n * // { \"OAuth\": [\"read:pets\"] },\n * // { \"ApiKeyAuth\": [] }\n * // ]\n * // }\n *\n * updateSelectedScopes({\n * document,\n * id: [\"OAuth\"], // identifies the scheme object: { \"OAuth\": [...] }\n * name: \"OAuth\", // scheme name to update within this security requirement\n * scopes: [\"write:pets\"], // new scopes array\n * meta: { type: \"document\" }\n * })\n * // After, the first scheme becomes: { \"OAuth\": [\"write:pets\"] }\n * ```\n */\nexport const updateSelectedScopes = (\n document: WorkspaceDocument | null,\n { id, name, scopes, meta }: AuthEvents['auth:update:selected-scopes'],\n) => {\n if (!document) {\n return\n }\n\n // Determine the target object (document or the operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return document\n }\n return getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n }\n\n const target = getTarget()\n\n if (!target) {\n return\n }\n\n // Array of security requirement objects under x-scalar-selected-security\n const selectedSchemes = target['x-scalar-selected-security']?.selectedSchemes\n\n if (!selectedSchemes) {\n return\n }\n\n // Find the security requirement that matches the given id (scheme key names)\n // For example: if id = [\"OAuth\"], matches { OAuth: [...] }\n const scheme = selectedSchemes.find((scheme) => JSON.stringify(Object.keys(scheme)) === JSON.stringify(id))\n\n if (!scheme) {\n return\n }\n\n // Set the scopes array for the named security scheme within the found security requirement\n scheme[name] = scopes\n}\n\n/**\n * Deletes one or more security schemes from an OpenAPI WorkspaceDocument,\n * and removes all references to those schemes from selected security, document-level security,\n * and operation-level security/selected security (e.g., on paths).\n *\n * Example usage:\n *\n * ```ts\n * deleteSecurityScheme({\n * document, // The OpenAPI document to update\n * names: ['ApiKeyAuth', 'BearerAuth'], // The names of security schemes you want to delete\n * });\n * ```\n *\n * After running this function:\n * - The named security schemes are removed from the components.securitySchemes section.\n * - All document-level and operation-level security entries referencing those schemes are removed.\n * - Any extended x-scalar-selected-security references to those schemes are also removed.\n */\nexport const deleteSecurityScheme = (\n document: WorkspaceDocument | null,\n { names }: AuthEvents['auth:delete:security-scheme'],\n) => {\n if (!document) {\n // Early exit if there is no document to modify\n return\n }\n\n // Get the mutable reference to securitySchemes in components (may be a proxy/resolved reference)\n const target = getResolvedRef(document.components?.securitySchemes)\n\n if (!target) {\n // If there are no security schemes to delete from, return early\n return\n }\n\n // Remove each named security scheme from the components.securitySchemes object\n names.forEach((name) => {\n delete target[name]\n })\n\n // Function to remove any security requirement objects that reference given scheme names.\n const filterSecuritySchemes = (schemes: SecurityRequirementObject[]) => {\n // Remove schemes whose key is included in the `names` to be deleted.\n return schemes.filter((scheme) => !names.some((name) => Object.keys(scheme).includes(name)))\n }\n\n // -- Remove from document-level `x-scalar-selected-security` extension, if present\n if (document['x-scalar-selected-security']) {\n const selectedSecurity = document['x-scalar-selected-security']\n selectedSecurity.selectedSchemes = filterSecuritySchemes(selectedSecurity.selectedSchemes)\n }\n\n // -- Remove from document-level `security` property, if present\n if (document['security']) {\n document['security'] = filterSecuritySchemes(document['security'])\n }\n\n // -- For each path and operation, remove deleted security schemes from operation-level security and custom extension\n Object.values(document.paths ?? {}).forEach((path) => {\n Object.values(path).forEach((operation) => {\n if (typeof operation !== 'object') {\n // Ignore operations that are not objects (could be undefined)\n return\n }\n\n // Get mutable reference for the operation (could resolve $ref proxies)\n const resolvedOperation = getResolvedRef(operation)\n\n // Remove from operation-level security array\n if ('security' in resolvedOperation && resolvedOperation['security']) {\n resolvedOperation['security'] = filterSecuritySchemes(resolvedOperation['security'])\n }\n\n // Remove from operation-level x-scalar-selected-security array\n if ('x-scalar-selected-security' in resolvedOperation && resolvedOperation['x-scalar-selected-security']) {\n resolvedOperation['x-scalar-selected-security'].selectedSchemes = filterSecuritySchemes(\n resolvedOperation['x-scalar-selected-security'].selectedSchemes,\n )\n }\n })\n })\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AA6CtB,MAAM,gCAAgC,
|
|
4
|
+
"sourcesContent": ["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\n\nimport type { AuthEvents } from '@/events/definitions/auth'\nimport { generateUniqueValue } from '@/helpers/generate-unique-value'\nimport { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport type { WorkspaceDocument } from '@/schemas'\nimport type { SecurityRequirementObject } from '@/schemas/v3.1/strict/security-requirement'\n\n/**\n * AuthMeta defines the meta information needed to specify whether the authentication operation\n * is being performed at the document level (entire API), or for a specific operation (specific path and method).\n *\n * - If type is 'document', the operation applies to the whole OpenAPI document.\n * - If type is 'operation', it targets a specific operation, identified by its path and method.\n */\nexport type AuthMeta =\n | {\n type: 'document'\n }\n | {\n type: 'operation'\n path: string\n method: HttpMethod\n }\n\n/**\n * Updates the selected security schemes for either the entire document or a specific operation.\n * - Adds newly created security schemes (if any) to the workspace document's components.\n * - Ensures that each new scheme name is unique within the document by using `generateUniqueValue`.\n * - Updates the `x-scalar-selected-security` property on the target (document or operation) to reflect the new set of selected security schemes.\n * - Corrects and maintains the selected index so it points to a valid security scheme.\n *\n * @param document - The workspace OpenAPI document to mutate (can be null, in which case nothing happens)\n * @param selectedSecuritySchemes - The current list of selected security scheme objects\n * @param create - Array of new schemes to create, each with a name and a scheme definition\n * @param meta - Location to update: whole document or a specific operation (`{ type: 'document' }` or `{ type: 'operation', path, method }`)\n *\n * Example usage:\n * ```\n * updateSelectedSecuritySchemes({\n * document,\n * selectedSecuritySchemes: [{ bearerAuth: [] }],\n * create: [\n * { name: 'ApiKeyAuth', scheme: { type: 'apiKey', in: 'header', name: 'X-API-Key' } }\n * ],\n * meta: { type: 'document' }\n * })\n * ```\n */\nexport const updateSelectedSecuritySchemes = async (\n document: WorkspaceDocument | null,\n { selectedRequirements, newSchemes, meta }: AuthEvents['auth:update:selected-security-schemes'],\n) => {\n if (!document) {\n return\n }\n\n // Helper to get the target (whole document or a specific operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return document\n }\n\n return getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n }\n\n const createdSecurityRequirements = await Promise.all(\n newSchemes.map(async (newScheme) => {\n const uniqueSchemeName = await generateUniqueValue({\n defaultValue: newScheme.name,\n validation: (value) => !document.components?.securitySchemes?.[value],\n maxRetries: 100,\n })\n\n if (!uniqueSchemeName) {\n return\n }\n\n // Ensure components and securitySchemes exist\n if (!document.components) {\n document.components = {}\n }\n if (!document.components.securitySchemes) {\n document.components.securitySchemes = {}\n }\n\n // Add the new security scheme definition\n document.components.securitySchemes[uniqueSchemeName] = newScheme.scheme\n\n // Return an OpenAPI Security Requirement Object for this new scheme (empty scope array)\n return {\n [uniqueSchemeName]: [],\n }\n }),\n )\n\n // Create any new security schemes required, ensuring unique names for the components\n const createdSchemes = createdSecurityRequirements.filter(Boolean) as SecurityRequirementObject[]\n\n const target = getTarget()\n\n const newSelectedSecuritySchemes = [...selectedRequirements, ...createdSchemes]\n\n // If the target (document/operation) doesn't exist, do nothing\n if (!target) {\n return\n }\n\n // Ensure the x-scalar-selected-security structure exists on the target\n if (!target['x-scalar-selected-security']) {\n target['x-scalar-selected-security'] = {\n selectedIndex: -1,\n selectedSchemes: [],\n }\n }\n\n const selectedIndex = target['x-scalar-selected-security'].selectedIndex\n\n // Update the schemes array\n target['x-scalar-selected-security'].selectedSchemes = newSelectedSecuritySchemes\n\n // Adjust selected index if there are schemes and the index is unset/invalid\n if (newSelectedSecuritySchemes.length > 0 && selectedIndex < 0) {\n target['x-scalar-selected-security'].selectedIndex = 0\n }\n\n // If the selected index is now out of bounds, select the last available\n if (selectedIndex >= newSelectedSecuritySchemes.length) {\n target['x-scalar-selected-security'].selectedIndex = newSelectedSecuritySchemes.length - 1\n }\n}\n\n/**\n * Updates a security scheme in the OpenAPI document's components object.\n * Handles updates for HTTP, API Key, and OAuth2 types, saving secret information and configuration for UI-auth flows.\n *\n * @param document - The OpenAPI workspace document (can be null)\n * @param data - The update information, including type and payload\n * @param name - The name of the security scheme in document.components.securitySchemes\n *\n * Example usage:\n *\n * updateSecurityScheme({\n * document,\n * data: {\n * type: 'http',\n * payload: {\n * username: 'user123',\n * password: 'pw123',\n * token: 'tokenval'\n * }\n * },\n * name: 'MyHttpAuth',\n * })\n */\nexport const updateSecurityScheme = (\n document: WorkspaceDocument | null,\n { payload, name }: AuthEvents['auth:update:security-scheme'],\n) => {\n const target = getResolvedRef(document?.components?.securitySchemes?.[name])\n if (!target) {\n console.error(`Security scheme ${name} not found`)\n return\n }\n\n // Handle HTTP (basic, bearer, etc.)\n if (target.type === payload.type) {\n mergeObjects(target, payload)\n }\n\n return target\n}\n\n/**\n * Sets the selected authentication tab (scheme) index for the given OpenAPI document or operation.\n * - When on the document level, updates the 'selectedIndex' on the document's x-scalar-selected-security extension.\n * - When on an operation (endpoint) level, updates the 'selectedIndex' for that operation's x-scalar-selected-security.\n *\n * Also initializes the x-scalar-selected-security extension if it does not exist.\n *\n * @param document The OpenAPI document object (may be null)\n * @param index The index to set as selected\n * @param meta Context where the selection applies ('document' or specific operation)\n *\n * @example\n * // Document-level tab selection\n * updateSelectedAuthTab({\n * document,\n * index: 1,\n * meta: { type: 'document' }\n * });\n *\n * // Operation-level tab selection (e.g., GET /pets)\n * updateSelectedAuthTab({\n * document,\n * index: 0,\n * meta: { type: 'operation', path: '/pets', method: 'get' }\n * });\n */\nexport const updateSelectedAuthTab = (\n document: WorkspaceDocument | null,\n { index, meta }: AuthEvents['auth:update:active-index'],\n) => {\n if (!document) {\n return\n }\n\n // Determine the target object for setting the auth tab index:\n // - Document/root level\n // - Operation/endpoint level (if meta specifies operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return document\n }\n return getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n }\n\n const target = getTarget()\n if (!target) {\n return\n }\n\n // Ensure the 'x-scalar-selected-security' extension exists\n if (!target['x-scalar-selected-security']) {\n target['x-scalar-selected-security'] = {\n selectedIndex: 0,\n selectedSchemes: [],\n }\n }\n\n // Set the selected auth tab index\n target['x-scalar-selected-security'].selectedIndex = index\n}\n\n/**\n * Updates the scopes for a specific security requirement in the selected security schemes of\n * a document or operation.\n *\n * @param document - The OpenAPI WorkspaceDocument to update.\n * @param id - An array of scheme names that uniquely identifies the target security requirement.\n * For example: ['OAuth', 'ApiKeyAuth']\n * @param name - The security scheme name to update scopes for (e.g., 'OAuth').\n * @param scopes - The new list of scopes to set. For example: ['read:pets', 'write:pets']\n * @param meta - The context specifying whether the update is at the document-level or operation-level.\n *\n * Example usage:\n * ```ts\n * // Suppose your document (or operation) x-scalar-selected-security looks like:\n * // \"x-scalar-selected-security\": {\n * // selectedIndex: 0,\n * // selectedSchemes: [\n * // { \"OAuth\": [\"read:pets\"] },\n * // { \"ApiKeyAuth\": [] }\n * // ]\n * // }\n *\n * updateSelectedScopes({\n * document,\n * id: [\"OAuth\"], // identifies the scheme object: { \"OAuth\": [...] }\n * name: \"OAuth\", // scheme name to update within this security requirement\n * scopes: [\"write:pets\"], // new scopes array\n * meta: { type: \"document\" }\n * })\n * // After, the first scheme becomes: { \"OAuth\": [\"write:pets\"] }\n * ```\n */\nexport const updateSelectedScopes = (\n document: WorkspaceDocument | null,\n { id, name, scopes, meta }: AuthEvents['auth:update:selected-scopes'],\n) => {\n if (!document) {\n return\n }\n\n // Determine the target object (document or the operation)\n const getTarget = () => {\n if (meta.type === 'document') {\n return document\n }\n return getResolvedRef(document.paths?.[meta.path]?.[meta.method])\n }\n\n const target = getTarget()\n\n if (!target) {\n return\n }\n\n // Array of security requirement objects under x-scalar-selected-security\n const selectedSchemes = target['x-scalar-selected-security']?.selectedSchemes\n\n if (!selectedSchemes) {\n return\n }\n\n // Find the security requirement that matches the given id (scheme key names)\n // For example: if id = [\"OAuth\"], matches { OAuth: [...] }\n const scheme = selectedSchemes.find((scheme) => JSON.stringify(Object.keys(scheme)) === JSON.stringify(id))\n\n if (!scheme) {\n return\n }\n\n // Set the scopes array for the named security scheme within the found security requirement\n scheme[name] = scopes\n}\n\n/**\n * Deletes one or more security schemes from an OpenAPI WorkspaceDocument,\n * and removes all references to those schemes from selected security, document-level security,\n * and operation-level security/selected security (e.g., on paths).\n *\n * Example usage:\n *\n * ```ts\n * deleteSecurityScheme({\n * document, // The OpenAPI document to update\n * names: ['ApiKeyAuth', 'BearerAuth'], // The names of security schemes you want to delete\n * });\n * ```\n *\n * After running this function:\n * - The named security schemes are removed from the components.securitySchemes section.\n * - All document-level and operation-level security entries referencing those schemes are removed.\n * - Any extended x-scalar-selected-security references to those schemes are also removed.\n */\nexport const deleteSecurityScheme = (\n document: WorkspaceDocument | null,\n { names }: AuthEvents['auth:delete:security-scheme'],\n) => {\n if (!document) {\n // Early exit if there is no document to modify\n return\n }\n\n // Get the mutable reference to securitySchemes in components (may be a proxy/resolved reference)\n const target = getResolvedRef(document.components?.securitySchemes)\n\n if (!target) {\n // If there are no security schemes to delete from, return early\n return\n }\n\n // Remove each named security scheme from the components.securitySchemes object\n names.forEach((name) => {\n delete target[name]\n })\n\n // Function to remove any security requirement objects that reference given scheme names.\n const filterSecuritySchemes = (schemes: SecurityRequirementObject[]) => {\n // Remove schemes whose key is included in the `names` to be deleted.\n return schemes.filter((scheme) => !names.some((name) => Object.keys(scheme).includes(name)))\n }\n\n // -- Remove from document-level `x-scalar-selected-security` extension, if present\n if (document['x-scalar-selected-security']) {\n const selectedSecurity = document['x-scalar-selected-security']\n selectedSecurity.selectedSchemes = filterSecuritySchemes(selectedSecurity.selectedSchemes)\n }\n\n // -- Remove from document-level `security` property, if present\n if (document['security']) {\n document['security'] = filterSecuritySchemes(document['security'])\n }\n\n // -- For each path and operation, remove deleted security schemes from operation-level security and custom extension\n Object.values(document.paths ?? {}).forEach((path) => {\n Object.values(path).forEach((operation) => {\n if (typeof operation !== 'object') {\n // Ignore operations that are not objects (could be undefined)\n return\n }\n\n // Get mutable reference for the operation (could resolve $ref proxies)\n const resolvedOperation = getResolvedRef(operation)\n\n // Remove from operation-level security array\n if ('security' in resolvedOperation && resolvedOperation['security']) {\n resolvedOperation['security'] = filterSecuritySchemes(resolvedOperation['security'])\n }\n\n // Remove from operation-level x-scalar-selected-security array\n if ('x-scalar-selected-security' in resolvedOperation && resolvedOperation['x-scalar-selected-security']) {\n resolvedOperation['x-scalar-selected-security'].selectedSchemes = filterSecuritySchemes(\n resolvedOperation['x-scalar-selected-security'].selectedSchemes,\n )\n }\n })\n })\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["scheme"]
|
|
7
7
|
}
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { CookieEvents } from '../events/definitions/cookie.js';
|
|
2
|
+
import type { Workspace, WorkspaceDocument } from '../schemas.js';
|
|
3
|
+
import { type XScalarCookie } from '../schemas/extensions/general/x-scalar-cookies.js';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
* Provides functions to add and delete cookies from the document's x-scalar-client-config-cookies extension.
|
|
5
|
+
* Adds OR updates a cookie to the document or workspace.
|
|
6
6
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @
|
|
7
|
+
* @param document - current document if available
|
|
8
|
+
* @param workspace - current workspace if available
|
|
9
|
+
* @param payload - The cookie configuration to add or update
|
|
10
|
+
* @param index - Optional index for updating an existing cookie
|
|
11
|
+
* @param collectionType - Whether this is for a document or workspace
|
|
12
|
+
* @returns the parsed cookie that was added or updated or undefined if the collection is not found
|
|
10
13
|
*/
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export declare const upsertCookie: (collection: WorkspaceDocument | Workspace | null, { payload, index }: CookieEvents["cookie:upsert:cookie"]) => XScalarCookie | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Deletes a cookie from the document or workspace by index.
|
|
17
|
+
*
|
|
18
|
+
* @param document - current document if available
|
|
19
|
+
* @param workspace - current workspace if available
|
|
20
|
+
* @param index - Index of the cookie to delete
|
|
21
|
+
* @param collectionType - Whether this is for a document or workspace
|
|
22
|
+
* @returns true if the cookie was deleted, false otherwise
|
|
23
|
+
*/
|
|
24
|
+
export declare const deleteCookie: (collection: WorkspaceDocument | Workspace | null, { index }: CookieEvents["cookie:delete:cookie"]) => boolean;
|
|
17
25
|
//# sourceMappingURL=cookie.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../src/mutators/cookie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../src/mutators/cookie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,+CAA+C,CAAA;AAGvG;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GACvB,YAAY,iBAAiB,GAAG,SAAS,GAAG,IAAI,EAChD,oBAAoB,YAAY,CAAC,sBAAsB,CAAC,KACvD,aAAa,GAAG,SA8BlB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GACvB,YAAY,iBAAiB,GAAG,SAAS,GAAG,IAAI,EAChD,WAAW,YAAY,CAAC,sBAAsB,CAAC,KAC9C,OAWF,CAAA"}
|
package/dist/mutators/cookie.js
CHANGED
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { xScalarCookieSchema } from "../schemas/extensions/general/x-scalar-cookies.js";
|
|
2
|
+
import { coerceValue } from "../schemas/typebox-coerce.js";
|
|
3
|
+
const upsertCookie = (collection, { payload, index }) => {
|
|
4
|
+
if (!collection) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
if (!collection["x-scalar-cookies"]) {
|
|
8
|
+
collection["x-scalar-cookies"] = [];
|
|
9
|
+
}
|
|
10
|
+
if (index !== void 0) {
|
|
11
|
+
if (index < 0 || index >= collection["x-scalar-cookies"].length) {
|
|
12
|
+
return;
|
|
5
13
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
14
|
+
const parsed2 = coerceValue(xScalarCookieSchema, {
|
|
15
|
+
...collection["x-scalar-cookies"][index],
|
|
16
|
+
...payload
|
|
17
|
+
});
|
|
18
|
+
collection["x-scalar-cookies"][index] = parsed2;
|
|
19
|
+
return parsed2;
|
|
20
|
+
}
|
|
21
|
+
const parsed = coerceValue(xScalarCookieSchema, payload);
|
|
22
|
+
collection["x-scalar-cookies"].push(parsed);
|
|
23
|
+
return parsed;
|
|
24
|
+
};
|
|
25
|
+
const deleteCookie = (collection, { index }) => {
|
|
26
|
+
if (!collection || !collection["x-scalar-cookies"]) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (index < 0 || index >= collection["x-scalar-cookies"].length) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
collection["x-scalar-cookies"].splice(index, 1);
|
|
33
|
+
return true;
|
|
27
34
|
};
|
|
28
35
|
export {
|
|
29
|
-
|
|
36
|
+
deleteCookie,
|
|
37
|
+
upsertCookie
|
|
30
38
|
};
|
|
31
39
|
//# sourceMappingURL=cookie.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mutators/cookie.ts"],
|
|
4
|
-
"sourcesContent": ["import type {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import type { CookieEvents } from '@/events/definitions/cookie'\nimport type { Workspace, WorkspaceDocument } from '@/schemas'\nimport { type XScalarCookie, xScalarCookieSchema } from '@/schemas/extensions/general/x-scalar-cookies'\nimport { coerceValue } from '@/schemas/typebox-coerce'\n\n/**\n * Adds OR updates a cookie to the document or workspace.\n *\n * @param document - current document if available\n * @param workspace - current workspace if available\n * @param payload - The cookie configuration to add or update\n * @param index - Optional index for updating an existing cookie\n * @param collectionType - Whether this is for a document or workspace\n * @returns the parsed cookie that was added or updated or undefined if the collection is not found\n */\nexport const upsertCookie = (\n collection: WorkspaceDocument | Workspace | null,\n { payload, index }: CookieEvents['cookie:upsert:cookie'],\n): XScalarCookie | undefined => {\n if (!collection) {\n return\n }\n\n if (!collection['x-scalar-cookies']) {\n collection['x-scalar-cookies'] = []\n }\n\n if (index !== undefined) {\n // Update existing cookie at index\n if (index < 0 || index >= collection['x-scalar-cookies'].length) {\n return\n }\n\n // Ensure we parse the payload but keep the existing cookie data\n const parsed = coerceValue(xScalarCookieSchema, {\n ...collection['x-scalar-cookies'][index],\n ...payload,\n })\n\n // Update\n collection['x-scalar-cookies'][index] = parsed\n return parsed\n }\n\n // Add new cookie\n const parsed = coerceValue(xScalarCookieSchema, payload)\n collection['x-scalar-cookies'].push(parsed)\n return parsed\n}\n\n/**\n * Deletes a cookie from the document or workspace by index.\n *\n * @param document - current document if available\n * @param workspace - current workspace if available\n * @param index - Index of the cookie to delete\n * @param collectionType - Whether this is for a document or workspace\n * @returns true if the cookie was deleted, false otherwise\n */\nexport const deleteCookie = (\n collection: WorkspaceDocument | Workspace | null,\n { index }: CookieEvents['cookie:delete:cookie'],\n): boolean => {\n if (!collection || !collection['x-scalar-cookies']) {\n return false\n }\n\n if (index < 0 || index >= collection['x-scalar-cookies'].length) {\n return false\n }\n\n collection['x-scalar-cookies'].splice(index, 1)\n return true\n}\n"],
|
|
5
|
+
"mappings": "AAEA,SAA6B,2BAA2B;AACxD,SAAS,mBAAmB;AAYrB,MAAM,eAAe,CAC1B,YACA,EAAE,SAAS,MAAM,MACa;AAC9B,MAAI,CAAC,YAAY;AACf;AAAA,EACF;AAEA,MAAI,CAAC,WAAW,kBAAkB,GAAG;AACnC,eAAW,kBAAkB,IAAI,CAAC;AAAA,EACpC;AAEA,MAAI,UAAU,QAAW;AAEvB,QAAI,QAAQ,KAAK,SAAS,WAAW,kBAAkB,EAAE,QAAQ;AAC/D;AAAA,IACF;AAGA,UAAMA,UAAS,YAAY,qBAAqB;AAAA,MAC9C,GAAG,WAAW,kBAAkB,EAAE,KAAK;AAAA,MACvC,GAAG;AAAA,IACL,CAAC;AAGD,eAAW,kBAAkB,EAAE,KAAK,IAAIA;AACxC,WAAOA;AAAA,EACT;AAGA,QAAM,SAAS,YAAY,qBAAqB,OAAO;AACvD,aAAW,kBAAkB,EAAE,KAAK,MAAM;AAC1C,SAAO;AACT;AAWO,MAAM,eAAe,CAC1B,YACA,EAAE,MAAM,MACI;AACZ,MAAI,CAAC,cAAc,CAAC,WAAW,kBAAkB,GAAG;AAClD,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,KAAK,SAAS,WAAW,kBAAkB,EAAE,QAAQ;AAC/D,WAAO;AAAA,EACT;AAEA,aAAW,kBAAkB,EAAE,OAAO,OAAO,CAAC;AAC9C,SAAO;AACT;",
|
|
6
|
+
"names": ["parsed"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '../client.js';
|
|
2
|
+
import type { DocumentEvents } from '../events/definitions/document.js';
|
|
1
3
|
import type { WorkspaceDocument } from '../schemas.js';
|
|
2
4
|
/**
|
|
3
|
-
* Toggle
|
|
5
|
+
* Toggle setting selected security schemes at the operation level
|
|
4
6
|
*/
|
|
5
|
-
export declare const
|
|
7
|
+
export declare const toggleSecurity: (document: WorkspaceDocument | null) => void;
|
|
8
|
+
export declare const updateWatchMode: (document: WorkspaceDocument | null, watchMode: boolean) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Update the document icon and also update the corresponding sidebar entry
|
|
11
|
+
*
|
|
12
|
+
* Does not perform a sidebar rebuild for performance benefit
|
|
13
|
+
*/
|
|
14
|
+
export declare const updateDocumentIcon: (document: WorkspaceDocument | null, icon: string) => void;
|
|
15
|
+
export declare const createEmptyDocument: (store: WorkspaceStore | null, payload: DocumentEvents["document:create:empty-document"]) => Promise<void>;
|
|
6
16
|
//# sourceMappingURL=document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/mutators/document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAElD;;GAEG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/mutators/document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAElD;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,iBAAiB,GAAG,IAAI,SAMhE,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,UAAU,iBAAiB,GAAG,IAAI,EAAE,WAAW,OAAO,SAMrF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,iBAAiB,GAAG,IAAI,EAAE,MAAM,MAAM,SASlF,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,OAAO,cAAc,GAAG,IAAI,EAC5B,SAAS,cAAc,CAAC,gCAAgC,CAAC,kBA4B1D,CAAA"}
|
|
@@ -1,10 +1,49 @@
|
|
|
1
|
-
const
|
|
1
|
+
const toggleSecurity = (document) => {
|
|
2
2
|
if (!document) {
|
|
3
3
|
return;
|
|
4
4
|
}
|
|
5
|
-
document["x-scalar-
|
|
5
|
+
document["x-scalar-set-operation-security"] = !document["x-scalar-set-operation-security"];
|
|
6
|
+
};
|
|
7
|
+
const updateWatchMode = (document, watchMode) => {
|
|
8
|
+
if (!document) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
document["x-scalar-watch-mode"] = watchMode;
|
|
12
|
+
};
|
|
13
|
+
const updateDocumentIcon = (document, icon) => {
|
|
14
|
+
if (!document || !document["x-scalar-navigation"]) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
document["x-scalar-icon"] = icon;
|
|
18
|
+
document["x-scalar-navigation"].icon = icon;
|
|
19
|
+
};
|
|
20
|
+
const createEmptyDocument = async (store, payload) => {
|
|
21
|
+
if (!store) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (store.workspace.documents[payload.name]) {
|
|
25
|
+
payload.callback?.(false);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
await store.addDocument({
|
|
29
|
+
name: payload.name,
|
|
30
|
+
document: {
|
|
31
|
+
openapi: "3.1.0",
|
|
32
|
+
info: { title: payload.name, version: "1.0.0" },
|
|
33
|
+
paths: {
|
|
34
|
+
"/": {
|
|
35
|
+
get: {}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"x-scalar-icon": payload.icon
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
payload.callback?.(true);
|
|
6
42
|
};
|
|
7
43
|
export {
|
|
8
|
-
|
|
44
|
+
createEmptyDocument,
|
|
45
|
+
toggleSecurity,
|
|
46
|
+
updateDocumentIcon,
|
|
47
|
+
updateWatchMode
|
|
9
48
|
};
|
|
10
49
|
//# sourceMappingURL=document.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mutators/document.ts"],
|
|
4
|
-
"sourcesContent": ["import type { WorkspaceDocument } from '@/schemas'\n\n/**\n * Toggle
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { WorkspaceStore } from '@/client'\nimport type { DocumentEvents } from '@/events/definitions/document'\nimport type { WorkspaceDocument } from '@/schemas'\n\n/**\n * Toggle setting selected security schemes at the operation level\n */\nexport const toggleSecurity = (document: WorkspaceDocument | null) => {\n if (!document) {\n return\n }\n\n document['x-scalar-set-operation-security'] = !document['x-scalar-set-operation-security']\n}\n\nexport const updateWatchMode = (document: WorkspaceDocument | null, watchMode: boolean) => {\n if (!document) {\n return\n }\n\n document['x-scalar-watch-mode'] = watchMode\n}\n\n/**\n * Update the document icon and also update the corresponding sidebar entry\n *\n * Does not perform a sidebar rebuild for performance benefit\n */\nexport const updateDocumentIcon = (document: WorkspaceDocument | null, icon: string) => {\n if (!document || !document['x-scalar-navigation']) {\n return\n }\n\n // Update the document icon\n document['x-scalar-icon'] = icon\n // Update the sidebar document icon\n document['x-scalar-navigation'].icon = icon\n}\n\nexport const createEmptyDocument = async (\n store: WorkspaceStore | null,\n payload: DocumentEvents['document:create:empty-document'],\n) => {\n if (!store) {\n return\n }\n\n // Check if the document already exists\n // name should be unique\n if (store.workspace.documents[payload.name]) {\n payload.callback?.(false)\n return\n }\n\n await store.addDocument({\n name: payload.name,\n document: {\n openapi: '3.1.0',\n info: { title: payload.name, version: '1.0.0' },\n paths: {\n '/': {\n get: {},\n },\n },\n 'x-scalar-icon': payload.icon,\n },\n })\n\n payload.callback?.(true)\n}\n"],
|
|
5
|
+
"mappings": "AAOO,MAAM,iBAAiB,CAAC,aAAuC;AACpE,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAEA,WAAS,iCAAiC,IAAI,CAAC,SAAS,iCAAiC;AAC3F;AAEO,MAAM,kBAAkB,CAAC,UAAoC,cAAuB;AACzF,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAEA,WAAS,qBAAqB,IAAI;AACpC;AAOO,MAAM,qBAAqB,CAAC,UAAoC,SAAiB;AACtF,MAAI,CAAC,YAAY,CAAC,SAAS,qBAAqB,GAAG;AACjD;AAAA,EACF;AAGA,WAAS,eAAe,IAAI;AAE5B,WAAS,qBAAqB,EAAE,OAAO;AACzC;AAEO,MAAM,sBAAsB,OACjC,OACA,YACG;AACH,MAAI,CAAC,OAAO;AACV;AAAA,EACF;AAIA,MAAI,MAAM,UAAU,UAAU,QAAQ,IAAI,GAAG;AAC3C,YAAQ,WAAW,KAAK;AACxB;AAAA,EACF;AAEA,QAAM,MAAM,YAAY;AAAA,IACtB,MAAM,QAAQ;AAAA,IACd,UAAU;AAAA,MACR,SAAS;AAAA,MACT,MAAM,EAAE,OAAO,QAAQ,MAAM,SAAS,QAAQ;AAAA,MAC9C,OAAO;AAAA,QACL,KAAK;AAAA,UACH,KAAK,CAAC;AAAA,QACR;AAAA,MACF;AAAA,MACA,iBAAiB,QAAQ;AAAA,IAC3B;AAAA,EACF,CAAC;AAED,UAAQ,WAAW,IAAI;AACzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/mutators/index.d.ts
CHANGED
|
@@ -14,10 +14,6 @@ export declare function generateClientMutators(store: WorkspaceStore): {
|
|
|
14
14
|
* Returns mutators for the workspace-level configuration.
|
|
15
15
|
*/
|
|
16
16
|
workspace: () => {
|
|
17
|
-
cookieMutators: {
|
|
18
|
-
addCookie: (cookie: import("../schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js").XScalarClientConfigCookie) => boolean;
|
|
19
|
-
deleteCookie: (cookieName: string) => boolean;
|
|
20
|
-
};
|
|
21
17
|
serverMutators: {
|
|
22
18
|
addServer: (server: ServerObject) => boolean;
|
|
23
19
|
deleteServer: (url: string) => boolean;
|
|
@@ -34,19 +30,24 @@ export declare function generateClientMutators(store: WorkspaceStore): {
|
|
|
34
30
|
active: () => {
|
|
35
31
|
requestMutators: {
|
|
36
32
|
moveRequest: ({ source, destination, }: {
|
|
37
|
-
source:
|
|
38
|
-
|
|
33
|
+
source: {
|
|
34
|
+
path: string;
|
|
35
|
+
method: Exclude<import("@scalar/helpers/http/http-methods").HttpMethod, "head" | "options">;
|
|
36
|
+
};
|
|
37
|
+
destination: {
|
|
38
|
+
path: string;
|
|
39
|
+
method: Exclude<import("@scalar/helpers/http/http-methods").HttpMethod, "head" | "options">;
|
|
40
|
+
};
|
|
41
|
+
}) => boolean;
|
|
42
|
+
deleteRequest: ({ path, method }: {
|
|
43
|
+
path: string;
|
|
44
|
+
method: Exclude<import("@scalar/helpers/http/http-methods").HttpMethod, "head" | "options">;
|
|
39
45
|
}) => boolean;
|
|
40
|
-
deleteRequest: ({ path, method }: import("../mutators/request.js").OperationIdentifier) => boolean;
|
|
41
46
|
};
|
|
42
47
|
securitySchemeMutators: {
|
|
43
48
|
addSecurityScheme: (name: string, securityScheme: import("../schemas/v3.1/strict/openapi-document.js").SecuritySchemeObject) => boolean;
|
|
44
49
|
deleteSecurityScheme: (name: string) => boolean;
|
|
45
50
|
};
|
|
46
|
-
cookieMutators: {
|
|
47
|
-
addCookie: (cookie: import("../schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js").XScalarClientConfigCookie) => boolean;
|
|
48
|
-
deleteCookie: (cookieName: string) => boolean;
|
|
49
|
-
};
|
|
50
51
|
serverMutators: {
|
|
51
52
|
addServer: (server: ServerObject) => boolean;
|
|
52
53
|
deleteServer: (url: string) => boolean;
|
|
@@ -60,19 +61,24 @@ export declare function generateClientMutators(store: WorkspaceStore): {
|
|
|
60
61
|
doc: (name: string) => {
|
|
61
62
|
requestMutators: {
|
|
62
63
|
moveRequest: ({ source, destination, }: {
|
|
63
|
-
source:
|
|
64
|
-
|
|
64
|
+
source: {
|
|
65
|
+
path: string;
|
|
66
|
+
method: Exclude<import("@scalar/helpers/http/http-methods").HttpMethod, "head" | "options">;
|
|
67
|
+
};
|
|
68
|
+
destination: {
|
|
69
|
+
path: string;
|
|
70
|
+
method: Exclude<import("@scalar/helpers/http/http-methods").HttpMethod, "head" | "options">;
|
|
71
|
+
};
|
|
72
|
+
}) => boolean;
|
|
73
|
+
deleteRequest: ({ path, method }: {
|
|
74
|
+
path: string;
|
|
75
|
+
method: Exclude<import("@scalar/helpers/http/http-methods").HttpMethod, "head" | "options">;
|
|
65
76
|
}) => boolean;
|
|
66
|
-
deleteRequest: ({ path, method }: import("../mutators/request.js").OperationIdentifier) => boolean;
|
|
67
77
|
};
|
|
68
78
|
securitySchemeMutators: {
|
|
69
79
|
addSecurityScheme: (name: string, securityScheme: import("../schemas/v3.1/strict/openapi-document.js").SecuritySchemeObject) => boolean;
|
|
70
80
|
deleteSecurityScheme: (name: string) => boolean;
|
|
71
81
|
};
|
|
72
|
-
cookieMutators: {
|
|
73
|
-
addCookie: (cookie: import("../schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js").XScalarClientConfigCookie) => boolean;
|
|
74
|
-
deleteCookie: (cookieName: string) => boolean;
|
|
75
|
-
};
|
|
76
82
|
serverMutators: {
|
|
77
83
|
addServer: (server: ServerObject) => boolean;
|
|
78
84
|
deleteServer: (url: string) => boolean;
|
|
@@ -80,8 +86,12 @@ export declare function generateClientMutators(store: WorkspaceStore): {
|
|
|
80
86
|
};
|
|
81
87
|
};
|
|
82
88
|
export { type AuthMeta, deleteSecurityScheme, updateSecurityScheme, updateSelectedAuthTab, updateSelectedScopes, updateSelectedSecuritySchemes, } from './auth.js';
|
|
83
|
-
export {
|
|
89
|
+
export { deleteCookie, upsertCookie } from './cookie.js';
|
|
90
|
+
export { createEmptyDocument, toggleSecurity, updateDocumentIcon, updateWatchMode } from './document.js';
|
|
84
91
|
export { upsertEnvironment, upsertEnvironmentVariable, } from './environment.js';
|
|
85
|
-
export { type OperationExampleMeta, type OperationMeta, addOperationParameter, addOperationRequestBodyFormRow, deleteAllOperationParameters, deleteOperationParameter, deleteOperationRequestBodyFormRow,
|
|
92
|
+
export { type OperationExampleMeta, type OperationMeta, addOperationParameter, addOperationRequestBodyFormRow, createOperation, deleteAllOperationParameters, deleteOperationParameter, deleteOperationRequestBodyFormRow, updateOperationMethod, updateOperationParameter, updateOperationPath, updateOperationRequestBodyContentType, updateOperationRequestBodyExample, updateOperationRequestBodyFormRow, updateOperationSummary, } from './operation.js';
|
|
86
93
|
export { addServer, deleteServer, updateSelectedServer, updateServer, updateServerVariables, } from './server.js';
|
|
94
|
+
export { addTab, closeOtherTabs, closeTab, focusLastTab, focusTab, navigateNextTab, navigatePreviousTab, updateTabs, } from './tabs.js';
|
|
95
|
+
export { createTag } from './tag.js';
|
|
96
|
+
export { updateActiveProxy, updateColorMode, updateTheme } from './workspace.js';
|
|
87
97
|
//# sourceMappingURL=index.d.ts.map
|