@scalar/mock-server 0.10.0 → 0.10.2

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,13 @@
1
1
  # @scalar/mock-server
2
2
 
3
+ ## 0.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#8936](https://github.com/scalar/scalar/pull/8936): feat: support oauth refreshUrl endpoints in mock server authentication routes
8
+
9
+ ## 0.10.1
10
+
3
11
  ## 0.10.0
4
12
 
5
13
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"get-open-auth-token-urls.d.ts","sourceRoot":"","sources":["../../src/utils/get-open-auth-token-urls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA0B,MAAM,uBAAuB,CAAA;AAE5E;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAYlD;AAiBD,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,GAAG,MAAM,EAAE,CAgCxE"}
1
+ {"version":3,"file":"get-open-auth-token-urls.d.ts","sourceRoot":"","sources":["../../src/utils/get-open-auth-token-urls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA0B,MAAM,uBAAuB,CAAA;AAE5E;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAYlD;AAiBD,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,GAAG,MAAM,EAAE,CAoCxE"}
@@ -15,14 +15,14 @@ export function getPathFromUrl(url) {
15
15
  }
16
16
  }
17
17
  /**
18
- * Returns all token URLs mentioned in the securitySchemes, without the domain
18
+ * Returns OAuth token and refresh URLs without the domain.
19
19
  */
20
20
  // Type guard for OAuth2 security scheme
21
21
  function isOAuth2Scheme(scheme) {
22
22
  return scheme.type === 'oauth2';
23
23
  }
24
- // Validate token URL
25
- function isValidTokenUrl(url) {
24
+ // Validate OAuth URL
25
+ function isValidOAuthUrl(url) {
26
26
  return url.trim().length > 0;
27
27
  }
28
28
  export function getOpenAuthTokenUrls(schema) {
@@ -31,22 +31,26 @@ export function getOpenAuthTokenUrls(schema) {
31
31
  }
32
32
  const securitySchemes = schema.components.securitySchemes;
33
33
  // Use Set from the start for better memory efficiency
34
- const tokenUrls = new Set();
34
+ const oauthUrls = new Set();
35
35
  // Iterate through all security schemes
36
36
  for (const scheme of Object.values(securitySchemes)) {
37
37
  if (!isOAuth2Scheme(scheme)) {
38
38
  continue;
39
39
  }
40
40
  const flows = scheme.flows; // Type assertion no longer needed
41
- // Helper to safely add valid token URLs
42
- const addTokenUrl = (url) => {
43
- if (url && isValidTokenUrl(url)) {
44
- tokenUrls.add(getPathFromUrl(url));
41
+ // Helper to safely add valid OAuth URLs
42
+ const addOAuthUrl = (url) => {
43
+ if (url && isValidOAuthUrl(url)) {
44
+ oauthUrls.add(getPathFromUrl(url));
45
45
  }
46
46
  };
47
- addTokenUrl(flows?.password?.tokenUrl);
48
- addTokenUrl(flows?.clientCredentials?.tokenUrl);
49
- addTokenUrl(flows?.authorizationCode?.tokenUrl);
47
+ addOAuthUrl(flows?.password?.tokenUrl);
48
+ addOAuthUrl(flows?.password?.refreshUrl);
49
+ addOAuthUrl(flows?.clientCredentials?.tokenUrl);
50
+ addOAuthUrl(flows?.clientCredentials?.refreshUrl);
51
+ addOAuthUrl(flows?.authorizationCode?.tokenUrl);
52
+ addOAuthUrl(flows?.authorizationCode?.refreshUrl);
53
+ addOAuthUrl(flows?.implicit?.refreshUrl);
50
54
  }
51
- return Array.from(tokenUrls);
55
+ return Array.from(oauthUrls);
52
56
  }
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "swagger",
17
17
  "cli"
18
18
  ],
19
- "version": "0.10.0",
19
+ "version": "0.10.2",
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
@@ -53,12 +53,12 @@
53
53
  "dependencies": {
54
54
  "@faker-js/faker": "10.4.0",
55
55
  "hono": "^4.12.7",
56
- "@scalar/json-magic": "0.12.6",
57
- "@scalar/helpers": "0.5.0",
58
- "@scalar/openapi-parser": "0.25.9",
59
- "@scalar/openapi-types": "0.7.0",
60
- "@scalar/openapi-upgrader": "0.2.5",
61
- "@scalar/workspace-store": "0.46.0"
56
+ "@scalar/helpers": "0.5.1",
57
+ "@scalar/openapi-types": "0.8.0",
58
+ "@scalar/workspace-store": "0.46.2",
59
+ "@scalar/openapi-upgrader": "0.2.6",
60
+ "@scalar/openapi-parser": "0.25.11",
61
+ "@scalar/json-magic": "0.12.7"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/node": "^24.1.0",