@scalar/mock-server 0.21.2 → 0.21.4
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
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @scalar/mock-server
|
|
2
2
|
|
|
3
|
+
## 0.21.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#10816](https://github.com/scalar/scalar/pull/10816): Keep plugin document classification consistent through replacement, hydration, and rebasing. Exclude plugin documents from Ask AI and reject unsupported request, authentication, and mock-server processing even when plugin data contains OpenAPI or AsyncAPI fields.
|
|
8
|
+
- [#11004](https://github.com/scalar/scalar/pull/11004): Preserve package output paths and application aliases when building with TypeScript 6.
|
|
9
|
+
|
|
10
|
+
## 0.21.3
|
|
11
|
+
|
|
12
|
+
No changes in this release.
|
|
13
|
+
|
|
3
14
|
## 0.21.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-document.d.ts","sourceRoot":"","sources":["../../src/utils/process-document.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"process-document.d.ts","sourceRoot":"","sources":["../../src/utils/process-document.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAOlE,8FAA8F;AAC9F,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAA;CAAE,GAC1E;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,CAAA;AAEpD;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACtD,SAAS,MAAM,KACd,OAAO,CAAC,iBAAiB,CAmF3B,CAAA"}
|
|
@@ -8,6 +8,8 @@ import { isHttpUrl } from '@scalar/json-magic/helpers/is-http-url';
|
|
|
8
8
|
import { createMagicProxy } from '@scalar/json-magic/magic-proxy';
|
|
9
9
|
import { upgrade } from '@scalar/openapi-upgrader';
|
|
10
10
|
import { openApiDocument, resolveOpenApiDocument } from '@scalar/workspace-store/plugins/bundler';
|
|
11
|
+
import { isPluginDocument } from '@scalar/workspace-store/schemas/plugin-document';
|
|
12
|
+
import { isAsyncApiDocument } from '@scalar/workspace-store/schemas/type-guards';
|
|
11
13
|
import { cloneDocument } from './clone-document.js';
|
|
12
14
|
/**
|
|
13
15
|
* Bundle API descriptions once, retaining AsyncAPI and upgrading compatible OpenAPI input.
|
|
@@ -15,6 +17,9 @@ import { cloneDocument } from './clone-document.js';
|
|
|
15
17
|
* An object input is never modified; the returned document is built from a copy of it.
|
|
16
18
|
*/
|
|
17
19
|
export const processDocument = async (document, origin) => {
|
|
20
|
+
if (isPluginDocument(document)) {
|
|
21
|
+
throw new Error('Plugin documents are not supported by the mock server');
|
|
22
|
+
}
|
|
18
23
|
// Handle empty/undefined input gracefully
|
|
19
24
|
if (!document || (typeof document === 'object' && Object.keys(document).length === 0)) {
|
|
20
25
|
// Return a minimal valid OpenAPI 3.2 document
|
|
@@ -59,7 +64,10 @@ export const processDocument = async (document, origin) => {
|
|
|
59
64
|
if (!isObjectLike(bundled)) {
|
|
60
65
|
throw new Error('Bundled document is invalid: expected an object');
|
|
61
66
|
}
|
|
62
|
-
if (
|
|
67
|
+
if (isPluginDocument(bundled)) {
|
|
68
|
+
throw new Error('Plugin documents are not supported by the mock server');
|
|
69
|
+
}
|
|
70
|
+
if (isAsyncApiDocument(bundled)) {
|
|
63
71
|
return { type: 'asyncapi', document: createMagicProxy(bundled) };
|
|
64
72
|
}
|
|
65
73
|
// Upgrading must not activate a $self field authored in an older OpenAPI version.
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"swagger",
|
|
17
17
|
"cli"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.21.
|
|
19
|
+
"version": "0.21.4",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=22.19.0"
|
|
22
22
|
},
|
|
@@ -52,24 +52,24 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@faker-js/faker": "10.6.0",
|
|
55
|
-
"@scalar/helpers": "0.18.
|
|
56
|
-
"@scalar/json-magic": "0.
|
|
57
|
-
"@scalar/json-schema-validator": "0.1.
|
|
58
|
-
"@scalar/openapi-types": "0.9.
|
|
59
|
-
"@scalar/openapi-upgrader": "0.4.
|
|
60
|
-
"@scalar/types": "0.
|
|
61
|
-
"@scalar/workspace-store": "0.
|
|
55
|
+
"@scalar/helpers": "0.18.1",
|
|
56
|
+
"@scalar/json-magic": "0.20.1",
|
|
57
|
+
"@scalar/json-schema-validator": "0.1.22",
|
|
58
|
+
"@scalar/openapi-types": "0.9.10",
|
|
59
|
+
"@scalar/openapi-upgrader": "0.4.11",
|
|
60
|
+
"@scalar/types": "0.30.0",
|
|
61
|
+
"@scalar/workspace-store": "0.73.0",
|
|
62
62
|
"ajv": "^8.20.0",
|
|
63
63
|
"ajv-formats": "^3.0.1",
|
|
64
|
-
"hono": "^4.13.
|
|
64
|
+
"hono": "^4.13.16",
|
|
65
65
|
"quickjs-emscripten": "0.32.0",
|
|
66
66
|
"yaml": "^2.9.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@hono/node-server": "^2.1.
|
|
69
|
+
"@hono/node-server": "^2.1.6",
|
|
70
70
|
"@types/node": "^24.19.2",
|
|
71
71
|
"@types/ws": "8.18.2",
|
|
72
|
-
"undici": "8.12.
|
|
72
|
+
"undici": "^8.12.4",
|
|
73
73
|
"vite": "8.3.4",
|
|
74
74
|
"ws": "8.22.0"
|
|
75
75
|
},
|