@scalar/oas-utils 0.6.39 → 0.6.42
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 +41 -0
- package/dist/helpers/client-plugins.d.ts +74 -0
- package/dist/helpers/client-plugins.d.ts.map +1 -0
- package/dist/helpers/client-plugins.js +15 -0
- package/dist/helpers/client-plugins.js.map +7 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +2 -0
- package/dist/helpers/index.js.map +2 -2
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.6.42
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
#### Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- **@scalar/workspace-store@0.32.1**
|
|
10
|
+
- [#8159](https://github.com/scalar/scalar/pull/8159): fix: do not mutate document after ingress
|
|
11
|
+
- [#8178](https://github.com/scalar/scalar/pull/8178): chore: package bump due to ci failure
|
|
12
|
+
|
|
13
|
+
- **@scalar/helpers@0.2.12**
|
|
14
|
+
- [#8178](https://github.com/scalar/scalar/pull/8178): chore: package bump due to ci failure
|
|
15
|
+
|
|
16
|
+
- **@scalar/json-magic@0.11.1**
|
|
17
|
+
|
|
18
|
+
- **@scalar/object-utils@1.2.26**
|
|
19
|
+
|
|
20
|
+
- **@scalar/types@0.6.3**
|
|
21
|
+
|
|
22
|
+
## 0.6.41
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
#### Updated Dependencies
|
|
27
|
+
|
|
28
|
+
- **@scalar/workspace-store@0.32.0**
|
|
29
|
+
- [#8135](https://github.com/scalar/scalar/pull/8135): feat: added support for OpenID Connect Discovery
|
|
30
|
+
- [#8152](https://github.com/scalar/scalar/pull/8152): feat: support custom themes
|
|
31
|
+
|
|
32
|
+
## 0.6.40
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- [#8121](https://github.com/scalar/scalar/pull/8121): chore: moved client plugin types to oas-utils so they can be shared
|
|
37
|
+
|
|
38
|
+
#### Updated Dependencies
|
|
39
|
+
|
|
40
|
+
- **@scalar/workspace-store@0.31.2**
|
|
41
|
+
- [#8120](https://github.com/scalar/scalar/pull/8120): refactor: make navigation router-agnostic
|
|
42
|
+
- [#8121](https://github.com/scalar/scalar/pull/8121): feat: added post response scripts/testing to api client v2
|
|
43
|
+
|
|
3
44
|
## 0.6.39
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ApiReferenceEvents } from '@scalar/workspace-store/events';
|
|
2
|
+
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
|
|
3
|
+
import type { DefineComponent } from 'vue';
|
|
4
|
+
/** A type representing the hooks that a client plugin can define */
|
|
5
|
+
type ClientPluginHooks = {
|
|
6
|
+
beforeRequest: (payload: {
|
|
7
|
+
request: Request;
|
|
8
|
+
}) => {
|
|
9
|
+
request: Request;
|
|
10
|
+
} | void | Promise<{
|
|
11
|
+
request: Request;
|
|
12
|
+
} | void>;
|
|
13
|
+
responseReceived: (payload: {
|
|
14
|
+
response: Response;
|
|
15
|
+
request: Request;
|
|
16
|
+
operation: OperationObject;
|
|
17
|
+
}) => void | Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
/** A vue component which accepts the specified props */
|
|
20
|
+
type ClientPluginComponent<Props extends Record<string, unknown>, Emits extends Record<string, (...args: any[]) => void> = {}> = {
|
|
21
|
+
component: DefineComponent<Props, {}, {}, {}, {}, {}, {}, Emits>;
|
|
22
|
+
additionalProps?: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
type ClientPluginComponents = {
|
|
25
|
+
request: ClientPluginComponent<{
|
|
26
|
+
operation: OperationObject;
|
|
27
|
+
}, {
|
|
28
|
+
'operation:update:extension': (payload: ApiReferenceEvents['operation:update:extension']['payload']) => void;
|
|
29
|
+
}>;
|
|
30
|
+
response: ClientPluginComponent<{}>;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* ClientPlugin is used to extend the API Client with custom hooks and UI components.
|
|
34
|
+
*
|
|
35
|
+
* Example usage:
|
|
36
|
+
*
|
|
37
|
+
* const myPlugin: ClientPlugin = {
|
|
38
|
+
* hooks: {
|
|
39
|
+
* beforeRequest: (request) => {
|
|
40
|
+
* // Modify the request before it is sent
|
|
41
|
+
* request.headers.set('X-Custom-Header', 'foo');
|
|
42
|
+
* return request;
|
|
43
|
+
* },
|
|
44
|
+
* responseReceived: async (response, operation) => {
|
|
45
|
+
* // Handle post-response logic
|
|
46
|
+
* const data = await response.json();
|
|
47
|
+
* console.log('Received:', data, 'for operation:', operation.operationId);
|
|
48
|
+
* }
|
|
49
|
+
* },
|
|
50
|
+
* components: {
|
|
51
|
+
* request: MyRequestComponent, // Custom Vue component for rendering the request section
|
|
52
|
+
* response: MyResponseComponent // Custom Vue component for rendering the response section
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
*/
|
|
56
|
+
export type ClientPlugin = {
|
|
57
|
+
hooks?: Partial<ClientPluginHooks>;
|
|
58
|
+
components?: Partial<ClientPluginComponents>;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Maps hook names to their expected payload types.
|
|
62
|
+
* This ensures type safety when executing hooks with their corresponding payloads.
|
|
63
|
+
* Derived from the ClientPlugin hooks definition.
|
|
64
|
+
*/
|
|
65
|
+
type HookPayloadMap = {
|
|
66
|
+
[K in keyof ClientPluginHooks]: Parameters<ClientPluginHooks[K]>[0];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Execute any hook with type-safe payload handling.
|
|
70
|
+
* The payload type is inferred from the hook name to ensure correct usage.
|
|
71
|
+
*/
|
|
72
|
+
export declare const executeHook: <K extends keyof HookPayloadMap>(payload: HookPayloadMap[K], hookName: K, plugins: ClientPlugin[]) => Promise<HookPayloadMap[K]>;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=client-plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-plugins.d.ts","sourceRoot":"","sources":["../../src/helpers/client-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAC5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,KAAK,CAAA;AAE1C,oEAAoE;AACpE,KAAK,iBAAiB,GAAG;IACvB,aAAa,EAAE,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;IACpH,gBAAgB,EAAE,CAAC,OAAO,EAAE;QAC1B,QAAQ,EAAE,QAAQ,CAAA;QAClB,OAAO,EAAE,OAAO,CAAA;QAChB,SAAS,EAAE,eAAe,CAAA;KAC3B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B,CAAA;AAED,wDAAwD;AACxD,KAAK,qBAAqB,CACxB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC,GAAG,EAAE,IACzD;IACF,SAAS,EAAE,eAAe,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAA;IAChE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,qBAAqB,CAC5B;QACE,SAAS,EAAE,eAAe,CAAA;KAG3B,EACD;QACE,4BAA4B,EAAE,CAAC,OAAO,EAAE,kBAAkB,CAAC,4BAA4B,CAAC,CAAC,SAAS,CAAC,KAAK,IAAI,CAAA;KAC7G,CACF,CAAA;IACD,QAAQ,EAAE,qBAAqB,CAAC,EAI/B,CAAC,CAAA;CACH,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;CAC7C,CAAA;AAED;;;;GAIG;AACH,KAAK,cAAc,GAAG;KACnB,CAAC,IAAI,MAAM,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACpE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,SAAS,MAAM,cAAc,EAC9D,SAAS,cAAc,CAAC,CAAC,CAAC,EAC1B,UAAU,CAAC,EACX,SAAS,YAAY,EAAE,KACtB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAY3B,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const executeHook = async (payload, hookName, plugins) => {
|
|
2
|
+
let currentPayload = payload;
|
|
3
|
+
for (const plugin of plugins) {
|
|
4
|
+
const hook = plugin.hooks?.[hookName];
|
|
5
|
+
if (hook) {
|
|
6
|
+
const modifiedPayload = await hook(currentPayload);
|
|
7
|
+
currentPayload = modifiedPayload ?? currentPayload;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return currentPayload;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
executeHook
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=client-plugins.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/helpers/client-plugins.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\nimport type { DefineComponent } from 'vue'\n\n/** A type representing the hooks that a client plugin can define */\ntype ClientPluginHooks = {\n beforeRequest: (payload: { request: Request }) => { request: Request } | void | Promise<{ request: Request } | void>\n responseReceived: (payload: {\n response: Response\n request: Request\n operation: OperationObject\n }) => void | Promise<void>\n}\n\n/** A vue component which accepts the specified props */\ntype ClientPluginComponent<\n Props extends Record<string, unknown>,\n Emits extends Record<string, (...args: any[]) => void> = {},\n> = {\n component: DefineComponent<Props, {}, {}, {}, {}, {}, {}, Emits>\n additionalProps?: Record<string, unknown>\n}\n\ntype ClientPluginComponents = {\n request: ClientPluginComponent<\n {\n operation: OperationObject\n // We could pre-build the js request and pass it here in the future if needed\n // request: Request\n },\n {\n 'operation:update:extension': (payload: ApiReferenceEvents['operation:update:extension']['payload']) => void\n }\n >\n response: ClientPluginComponent<{\n // response: Response\n // request: Request\n // operation: OperationObject\n }>\n}\n\n/**\n * ClientPlugin is used to extend the API Client with custom hooks and UI components.\n *\n * Example usage:\n *\n * const myPlugin: ClientPlugin = {\n * hooks: {\n * beforeRequest: (request) => {\n * // Modify the request before it is sent\n * request.headers.set('X-Custom-Header', 'foo');\n * return request;\n * },\n * responseReceived: async (response, operation) => {\n * // Handle post-response logic\n * const data = await response.json();\n * console.log('Received:', data, 'for operation:', operation.operationId);\n * }\n * },\n * components: {\n * request: MyRequestComponent, // Custom Vue component for rendering the request section\n * response: MyResponseComponent // Custom Vue component for rendering the response section\n * }\n * }\n */\nexport type ClientPlugin = {\n hooks?: Partial<ClientPluginHooks>\n components?: Partial<ClientPluginComponents>\n}\n\n/**\n * Maps hook names to their expected payload types.\n * This ensures type safety when executing hooks with their corresponding payloads.\n * Derived from the ClientPlugin hooks definition.\n */\ntype HookPayloadMap = {\n [K in keyof ClientPluginHooks]: Parameters<ClientPluginHooks[K]>[0]\n}\n\n/**\n * Execute any hook with type-safe payload handling.\n * The payload type is inferred from the hook name to ensure correct usage.\n */\nexport const executeHook = async <K extends keyof HookPayloadMap>(\n payload: HookPayloadMap[K],\n hookName: K,\n plugins: ClientPlugin[],\n): Promise<HookPayloadMap[K]> => {\n let currentPayload = payload\n\n for (const plugin of plugins) {\n const hook = plugin.hooks?.[hookName]\n if (hook) {\n const modifiedPayload = await hook(currentPayload as any)\n currentPayload = (modifiedPayload ?? currentPayload) as HookPayloadMap[K]\n }\n }\n\n return currentPayload\n}\n"],
|
|
5
|
+
"mappings": "AAmFO,MAAM,cAAc,OACzB,SACA,UACA,YAC+B;AAC/B,MAAI,iBAAiB;AAErB,aAAW,UAAU,SAAS;AAC5B,UAAM,OAAO,OAAO,QAAQ,QAAQ;AACpC,QAAI,MAAM;AACR,YAAM,kBAAkB,MAAM,KAAK,cAAqB;AACxD,uBAAkB,mBAAmB;AAAA,IACvC;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ combineUrlAndPath,
|
|
|
72
72
|
mergeSearchParams,
|
|
73
73
|
/** @deprecated Please use mergeUrls from \@scalar/helpers/url/merge-urls instead */
|
|
74
74
|
mergeUrls, } from '@scalar/helpers/url/merge-urls';
|
|
75
|
+
export { type ClientPlugin, executeHook } from './client-plugins.js';
|
|
75
76
|
export { fetchDocument } from './fetch-document.js';
|
|
76
77
|
export { type FetchWithProxyFallbackOptions, fetchWithProxyFallback } from './fetch-with-proxy-fallback.js';
|
|
77
78
|
export { normalizeMimeType } from './normalize-mime-type.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index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V,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,KAAK,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAChH,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC5G,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAA;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA"}
|
package/dist/helpers/index.js
CHANGED
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
mergeSearchParams,
|
|
62
62
|
mergeUrls
|
|
63
63
|
} from "@scalar/helpers/url/merge-urls";
|
|
64
|
+
import { executeHook } from "./client-plugins.js";
|
|
64
65
|
import { fetchDocument } from "./fetch-document.js";
|
|
65
66
|
import { fetchWithProxyFallback } from "./fetch-with-proxy-fallback.js";
|
|
66
67
|
import { normalizeMimeType } from "./normalize-mime-type.js";
|
|
@@ -80,6 +81,7 @@ export {
|
|
|
80
81
|
combineUrlAndPath,
|
|
81
82
|
createHash,
|
|
82
83
|
ensureProtocol,
|
|
84
|
+
executeHook,
|
|
83
85
|
fetchDocument,
|
|
84
86
|
fetchWithProxyFallback,
|
|
85
87
|
findVariables,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers/index.ts"],
|
|
4
|
-
"sourcesContent": ["export {\n /** @deprecated Please use isDefined from \\@scalar/helpers/array/is-defined instead */\n isDefined,\n} from '@scalar/helpers/array/is-defined'\nexport {\n /** @deprecated Please use json2xml from \\@scalar/helpers/file/json2xml instead */\n json2xml,\n} from '@scalar/helpers/file/json2xml'\nexport {\n /** @deprecated Please use canMethodHaveBody from \\@scalar/helpers/http/can-method-have-body instead */\n canMethodHaveBody,\n} from '@scalar/helpers/http/can-method-have-body'\nexport {\n /** @deprecated Please use REQUEST_METHODS from \\@scalar/helpers/http/http-methods instead */\n REQUEST_METHODS,\n /** @deprecated Please use getHttpMethodInfo from \\@scalar/helpers/http/http-info instead */\n getHttpMethodInfo,\n} from '@scalar/helpers/http/http-info'\nexport {\n /** @deprecated Please use HttpStatusCode from \\@scalar/helpers/http/http-status-codes instead */\n type HttpStatusCode,\n /** @deprecated Please use HttpStatusCodes from \\@scalar/helpers/http/http-status-codes instead */\n type HttpStatusCodes,\n /** @deprecated Please use httpStatusCodes from \\@scalar/helpers/http/http-status-codes instead */\n httpStatusCodes,\n} from '@scalar/helpers/http/http-status-codes'\nexport {\n /** @deprecated Please use isHttpMethod from \\@scalar/helpers/http/is-http-method instead */\n isHttpMethod,\n} from '@scalar/helpers/http/is-http-method'\nexport {\n /** @deprecated Please use objectKeys from \\@scalar/helpers/object/object-keys instead */\n objectKeys as getObjectKeys,\n} from '@scalar/helpers/object/object-keys'\nexport {\n /** @deprecated Please use findVariables from \\@scalar/helpers/regex/find-variables instead */\n findVariables,\n} from '@scalar/helpers/regex/find-variables'\nexport {\n /** @deprecated Please use REGEX from \\@scalar/helpers/regex/regex-helpers instead */\n REGEX,\n} from '@scalar/helpers/regex/regex-helpers'\nexport {\n /** @deprecated Please use replaceVariables from \\@scalar/helpers/regex/replace-variables instead */\n replaceVariables,\n} from '@scalar/helpers/regex/replace-variables'\nexport {\n /** @deprecated Please use camelToTitleWords from \\@scalar/helpers/string/camel-to-title instead */\n camelToTitleWords,\n} from '@scalar/helpers/string/camel-to-title'\nexport {\n /** @deprecated Please use capitalize from \\@scalar/helpers/string/capitalize instead */\n capitalize,\n} from '@scalar/helpers/string/capitalize'\n/**\n * @deprecated These helpers are being phased out. Please import directly from @scalar/helpers instead.\n * For example: import { createHash } from '\\@scalar/helpers/string/create-hash'\n */\nexport {\n /** @deprecated Please use createHash from \\@scalar/helpers/string/create-hash instead */\n createHash,\n} from '@scalar/helpers/string/create-hash'\nexport {\n /** @deprecated Please use iterateTitle from \\@scalar/helpers/string/iterate-title instead */\n iterateTitle,\n} from '@scalar/helpers/string/iterate-title'\nexport {\n /** @deprecated Please use ensureProtocol from \\@scalar/helpers/url/ensure-protocol instead */\n ensureProtocol,\n} from '@scalar/helpers/url/ensure-protocol'\nexport {\n /** @deprecated Please use isLocalUrl from \\@scalar/helpers/url/is-local-url instead */\n isLocalUrl,\n} from '@scalar/helpers/url/is-local-url'\nexport {\n /** @deprecated Please use isRelativePath from \\@scalar/helpers/url/is-relative-path instead */\n isRelativePath,\n} from '@scalar/helpers/url/is-relative-path'\nexport {\n /** @deprecated Please use isValidUrl from \\@scalar/helpers/url/is-valid-url instead */\n isValidUrl,\n} from '@scalar/helpers/url/is-valid-url'\nexport {\n /** @deprecated Please use makeUrlAbsolute from \\@scalar/helpers/url/make-url-absolute instead */\n makeUrlAbsolute,\n} from '@scalar/helpers/url/make-url-absolute'\nexport {\n /** @deprecated Please use combineUrlAndPath from \\@scalar/helpers/url/merge-urls instead */\n combineUrlAndPath,\n /** @deprecated Please use mergeSearchParams from \\@scalar/helpers/url/merge-urls instead */\n mergeSearchParams,\n /** @deprecated Please use mergeUrls from \\@scalar/helpers/url/merge-urls instead */\n mergeUrls,\n} from '@scalar/helpers/url/merge-urls'\n\nexport { fetchDocument } from './fetch-document'\nexport { type FetchWithProxyFallbackOptions, fetchWithProxyFallback } from './fetch-with-proxy-fallback'\nexport { normalizeMimeType } from './normalize-mime-type'\nexport { normalizeMimeTypeObject } from './normalize-mime-type-object'\nexport { getOperationStability, getOperationStabilityColor, isOperationDeprecated } from './operation-stability'\nexport { formatJsonOrYamlString, isJsonString, json, parseJsonOrYaml, transformToJson, yaml } from './parse'\nexport { prettyPrintJson, replaceCircularDependencies } from './pretty-print-json'\nexport { schemaModel } from './schema-model'\nexport { getServersFromDocument } from './servers'\nexport { shouldIgnoreEntity } from './should-ignore-entity'\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EAME;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEgB;AAAA,OACT;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AAKP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AAEP,SAAS,qBAAqB;AAC9B,SAA6C,8BAA8B;AAC3E,SAAS,yBAAyB;AAClC,SAAS,+BAA+B;AACxC,SAAS,uBAAuB,4BAA4B,6BAA6B;AACzF,SAAS,wBAAwB,cAAc,MAAM,iBAAiB,iBAAiB,YAAY;AACnG,SAAS,iBAAiB,mCAAmC;AAC7D,SAAS,mBAAmB;AAC5B,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;",
|
|
4
|
+
"sourcesContent": ["export {\n /** @deprecated Please use isDefined from \\@scalar/helpers/array/is-defined instead */\n isDefined,\n} from '@scalar/helpers/array/is-defined'\nexport {\n /** @deprecated Please use json2xml from \\@scalar/helpers/file/json2xml instead */\n json2xml,\n} from '@scalar/helpers/file/json2xml'\nexport {\n /** @deprecated Please use canMethodHaveBody from \\@scalar/helpers/http/can-method-have-body instead */\n canMethodHaveBody,\n} from '@scalar/helpers/http/can-method-have-body'\nexport {\n /** @deprecated Please use REQUEST_METHODS from \\@scalar/helpers/http/http-methods instead */\n REQUEST_METHODS,\n /** @deprecated Please use getHttpMethodInfo from \\@scalar/helpers/http/http-info instead */\n getHttpMethodInfo,\n} from '@scalar/helpers/http/http-info'\nexport {\n /** @deprecated Please use HttpStatusCode from \\@scalar/helpers/http/http-status-codes instead */\n type HttpStatusCode,\n /** @deprecated Please use HttpStatusCodes from \\@scalar/helpers/http/http-status-codes instead */\n type HttpStatusCodes,\n /** @deprecated Please use httpStatusCodes from \\@scalar/helpers/http/http-status-codes instead */\n httpStatusCodes,\n} from '@scalar/helpers/http/http-status-codes'\nexport {\n /** @deprecated Please use isHttpMethod from \\@scalar/helpers/http/is-http-method instead */\n isHttpMethod,\n} from '@scalar/helpers/http/is-http-method'\nexport {\n /** @deprecated Please use objectKeys from \\@scalar/helpers/object/object-keys instead */\n objectKeys as getObjectKeys,\n} from '@scalar/helpers/object/object-keys'\nexport {\n /** @deprecated Please use findVariables from \\@scalar/helpers/regex/find-variables instead */\n findVariables,\n} from '@scalar/helpers/regex/find-variables'\nexport {\n /** @deprecated Please use REGEX from \\@scalar/helpers/regex/regex-helpers instead */\n REGEX,\n} from '@scalar/helpers/regex/regex-helpers'\nexport {\n /** @deprecated Please use replaceVariables from \\@scalar/helpers/regex/replace-variables instead */\n replaceVariables,\n} from '@scalar/helpers/regex/replace-variables'\nexport {\n /** @deprecated Please use camelToTitleWords from \\@scalar/helpers/string/camel-to-title instead */\n camelToTitleWords,\n} from '@scalar/helpers/string/camel-to-title'\nexport {\n /** @deprecated Please use capitalize from \\@scalar/helpers/string/capitalize instead */\n capitalize,\n} from '@scalar/helpers/string/capitalize'\n/**\n * @deprecated These helpers are being phased out. Please import directly from @scalar/helpers instead.\n * For example: import { createHash } from '\\@scalar/helpers/string/create-hash'\n */\nexport {\n /** @deprecated Please use createHash from \\@scalar/helpers/string/create-hash instead */\n createHash,\n} from '@scalar/helpers/string/create-hash'\nexport {\n /** @deprecated Please use iterateTitle from \\@scalar/helpers/string/iterate-title instead */\n iterateTitle,\n} from '@scalar/helpers/string/iterate-title'\nexport {\n /** @deprecated Please use ensureProtocol from \\@scalar/helpers/url/ensure-protocol instead */\n ensureProtocol,\n} from '@scalar/helpers/url/ensure-protocol'\nexport {\n /** @deprecated Please use isLocalUrl from \\@scalar/helpers/url/is-local-url instead */\n isLocalUrl,\n} from '@scalar/helpers/url/is-local-url'\nexport {\n /** @deprecated Please use isRelativePath from \\@scalar/helpers/url/is-relative-path instead */\n isRelativePath,\n} from '@scalar/helpers/url/is-relative-path'\nexport {\n /** @deprecated Please use isValidUrl from \\@scalar/helpers/url/is-valid-url instead */\n isValidUrl,\n} from '@scalar/helpers/url/is-valid-url'\nexport {\n /** @deprecated Please use makeUrlAbsolute from \\@scalar/helpers/url/make-url-absolute instead */\n makeUrlAbsolute,\n} from '@scalar/helpers/url/make-url-absolute'\nexport {\n /** @deprecated Please use combineUrlAndPath from \\@scalar/helpers/url/merge-urls instead */\n combineUrlAndPath,\n /** @deprecated Please use mergeSearchParams from \\@scalar/helpers/url/merge-urls instead */\n mergeSearchParams,\n /** @deprecated Please use mergeUrls from \\@scalar/helpers/url/merge-urls instead */\n mergeUrls,\n} from '@scalar/helpers/url/merge-urls'\n\nexport { type ClientPlugin, executeHook } from './client-plugins'\nexport { fetchDocument } from './fetch-document'\nexport { type FetchWithProxyFallbackOptions, fetchWithProxyFallback } from './fetch-with-proxy-fallback'\nexport { normalizeMimeType } from './normalize-mime-type'\nexport { normalizeMimeTypeObject } from './normalize-mime-type-object'\nexport { getOperationStability, getOperationStabilityColor, isOperationDeprecated } from './operation-stability'\nexport { formatJsonOrYamlString, isJsonString, json, parseJsonOrYaml, transformToJson, yaml } from './parse'\nexport { prettyPrintJson, replaceCircularDependencies } from './pretty-print-json'\nexport { schemaModel } from './schema-model'\nexport { getServersFromDocument } from './servers'\nexport { shouldIgnoreEntity } from './should-ignore-entity'\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EAME;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEgB;AAAA,OACT;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AAKP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AAEP,SAA4B,mBAAmB;AAC/C,SAAS,qBAAqB;AAC9B,SAA6C,8BAA8B;AAC3E,SAAS,yBAAyB;AAClC,SAAS,+BAA+B;AACxC,SAAS,uBAAuB,4BAA4B,6BAA6B;AACzF,SAAS,wBAAwB,cAAc,MAAM,iBAAiB,iBAAiB,YAAY;AACnG,SAAS,iBAAiB,mCAAmC;AAC7D,SAAS,mBAAmB;AAC5B,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"specification",
|
|
17
17
|
"yaml"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.6.
|
|
19
|
+
"version": "0.6.42",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=20"
|
|
22
22
|
},
|
|
@@ -87,22 +87,23 @@
|
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"flatted": "^3.3.3",
|
|
89
89
|
"type-fest": "^5.3.1",
|
|
90
|
+
"vue": "^3.5.26",
|
|
90
91
|
"yaml": "^2.8.0",
|
|
91
92
|
"zod": "^4.3.5",
|
|
92
|
-
"@scalar/
|
|
93
|
-
"@scalar/
|
|
94
|
-
"@scalar/object-utils": "1.2.
|
|
93
|
+
"@scalar/helpers": "0.2.12",
|
|
94
|
+
"@scalar/json-magic": "0.11.1",
|
|
95
|
+
"@scalar/object-utils": "1.2.26",
|
|
96
|
+
"@scalar/openapi-types": "0.5.3",
|
|
95
97
|
"@scalar/themes": "0.14.0",
|
|
96
|
-
"@scalar/types": "0.6.
|
|
97
|
-
"@scalar/workspace-store": "0.
|
|
98
|
-
"@scalar/openapi-types": "0.5.3"
|
|
98
|
+
"@scalar/types": "0.6.3",
|
|
99
|
+
"@scalar/workspace-store": "0.32.1"
|
|
99
100
|
},
|
|
100
101
|
"devDependencies": {
|
|
101
102
|
"@types/node": "^22.19.3",
|
|
102
103
|
"vite": "^7.3.1",
|
|
103
104
|
"vitest": "4.0.16",
|
|
104
105
|
"zod-to-ts": "github:amritk/zod-to-ts#build",
|
|
105
|
-
"@scalar/openapi-parser": "0.24.
|
|
106
|
+
"@scalar/openapi-parser": "0.24.10",
|
|
106
107
|
"@scalar/build-tooling": "0.4.1",
|
|
107
108
|
"@scalar/openapi-types": "0.5.3"
|
|
108
109
|
},
|