@scalar/workspace-store 0.46.1 → 0.46.3
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 +12 -0
- package/dist/request-example/builder/header/build-request-cookie-header.d.ts.map +1 -1
- package/dist/request-example/builder/header/build-request-cookie-header.js +2 -1
- package/dist/request-example/builder/request-factory.d.ts.map +1 -1
- package/dist/request-example/builder/request-factory.js +2 -1
- package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
- package/dist/request-example/builder/resolve-request-factory-url.js +2 -1
- package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/request-example/context/security/extract-security-scheme-secrets.js +11 -5
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @scalar/workspace-store
|
|
2
2
|
|
|
3
|
+
## 0.46.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#8952](https://github.com/scalar/scalar/pull/8952): Export shared Scalar custom header constants from `@scalar/helpers/http/scalar-headers` and consume them in request build/send flows.
|
|
8
|
+
|
|
9
|
+
## 0.46.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#8927](https://github.com/scalar/scalar/pull/8927): Resolve environment variables in raw request paths when building request URLs, so address bar placeholders like `{{path}}` are substituted during send.
|
|
14
|
+
|
|
3
15
|
## 0.46.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-request-cookie-header.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/build-request-cookie-header.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-request-cookie-header.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/build-request-cookie-header.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AAYxG;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,aAAa,EAAE,EAAE,sBAAsB,MAAM,GAAG,SAAS,KAAG,MAWzG,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,gEAKtC;IACD,uEAAuE;IACvE,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,0EAA0E;IAC1E,oBAAoB,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;IAC/C,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAA;CAC/B,KAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAsBvC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { X_SCALAR_COOKIE } from '@scalar/helpers/http/scalar-headers';
|
|
1
2
|
import { filterGlobalCookie } from './filter-global-cookies.js';
|
|
2
3
|
const CUSTOM_COOKIE_HEADER_WARNING = "We're using a `X-Scalar-Cookie` custom header to the request. The proxy will forward this as a `Cookie` header. We do this to avoid the browser omitting the `Cookie` header for cross-origin requests for security reasons.";
|
|
3
4
|
const COOKIE_HEADER_WARNING = `We're trying to add a Cookie header, but browsers often omit them for cross-origin requests for various security reasons. If it's not working, that's probably why. Here are the requirements for it to work:
|
|
@@ -29,7 +30,7 @@ export const buildRequestCookieHeader = ({ cookies, originalCookieHeader, url, u
|
|
|
29
30
|
// Add a custom header for the proxy (that's then forwarded as `Cookie`)
|
|
30
31
|
if (useCustomCookieHeader) {
|
|
31
32
|
console.warn(CUSTOM_COOKIE_HEADER_WARNING);
|
|
32
|
-
return { name:
|
|
33
|
+
return { name: X_SCALAR_COOKIE, value: cookieHeader };
|
|
33
34
|
}
|
|
34
35
|
// or stick to the original header (which might be removed by the browser)
|
|
35
36
|
console.warn(COOKIE_HEADER_WARNING);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-factory.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/request-factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"request-factory.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/request-factory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAG5F,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,2DAA2D,CAAA;AAClE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AACjG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,2BAA2B,CAAA;AAG9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,IAAI,EAAE;QACJ;;;;;WAKG;QACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACjC;;;;;WAKG;QACH,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IAED;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;OAGG;IACH,KAAK,EAAE,eAAe,CAAA;IAEtB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAA;IAEhB;;;;OAIG;IACH,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;IAExB;;;;OAIG;IACH,OAAO,EAAE,aAAa,EAAE,CAAA;IAExB;;;OAGG;IACH,KAAK,EAAE,YAAY,CAAA;IAEnB;;;;OAIG;IACH,QAAQ,EAAE,0BAA0B,EAAE,CAAA;IAEtC;;;OAGG;IACH,8BAA8B,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAE5C;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;QACf;;;WAGG;QACH,UAAU,EAAE,OAAO,CAAA;QACnB;;;WAGG;QACH,eAAe,EAAE,OAAO,CAAA;KACzB,CAAC,CAAA;CACH,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,kKAY5B,kBAAkB,GAAG;IACtB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,qEAAqE;IACrE,UAAU,EAAE,OAAO,CAAA;IACnB,8DAA8D;IAC9D,uBAAuB,EAAE,0BAA0B,EAAE,CAAA;IACrD,sEAAsE;IACtE,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACzD,KAAG;IACF,OAAO,EAAE,cAAc,CAAA;CAyExB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { canMethodHaveBody } from '@scalar/helpers/http/can-method-have-body';
|
|
2
|
+
import { X_SCALAR_USER_AGENT } from '@scalar/helpers/http/scalar-headers';
|
|
2
3
|
import { replacePathVariables } from '@scalar/helpers/regex/replace-variables';
|
|
3
4
|
import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref';
|
|
4
5
|
import { getServerVariables } from '../../request-example/builder/helpers/get-server-variables.js';
|
|
@@ -30,7 +31,7 @@ export const requestFactory = ({ exampleName, globalCookies, method, operation,
|
|
|
30
31
|
// that's then forwarded as a `User-Agent` header.
|
|
31
32
|
const userAgentHeader = headers.get('User-Agent');
|
|
32
33
|
if (isElectron && userAgentHeader) {
|
|
33
|
-
headers.set(
|
|
34
|
+
headers.set(X_SCALAR_USER_AGENT, userAgentHeader);
|
|
34
35
|
}
|
|
35
36
|
const globalCookieFilter = operation['x-scalar-disable-parameters']?.['global-cookies']?.[exampleName] ?? {};
|
|
36
37
|
const cookiesList = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-request-factory-url.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/resolve-request-factory-url.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAE/E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC,CAAA;IACzE,mBAAmB,EAAE,eAAe,CAAA;CACrC,KACA,
|
|
1
|
+
{"version":3,"file":"resolve-request-factory-url.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/resolve-request-factory-url.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAE/E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC,CAAA;IACzE,mBAAmB,EAAE,eAAe,CAAA;CACrC,KACA,MAkCF,CAAA"}
|
|
@@ -12,7 +12,8 @@ export const resolveRequestFactoryUrl = (request, options) => {
|
|
|
12
12
|
encodeURIComponent(replaceEnvVariables(value, variables)),
|
|
13
13
|
]));
|
|
14
14
|
const baseUrl = replaceEnvVariables(request.baseUrl, variables);
|
|
15
|
-
const
|
|
15
|
+
const rawPath = replaceEnvVariables(request.path.raw, variables);
|
|
16
|
+
const path = replacePathVariables(rawPath, pathVariables);
|
|
16
17
|
const mergedUrl = mergeUrls(baseUrl, path);
|
|
17
18
|
// When rendered inside an iframe with srcdoc, the browser reports
|
|
18
19
|
// window.location.origin as the string "null" instead of a real origin.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/extract-security-scheme-secrets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAA2C,MAAM,uCAAuC,CAAA;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAQlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,OAAO,KAAK,EAUV,0BAA0B,EAC3B,MAAM,iDAAiD,CAAA;AAExD,wGAAwG;AACxG,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"extract-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/extract-security-scheme-secrets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAA2C,MAAM,uCAAuC,CAAA;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAQlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,OAAO,KAAK,EAUV,0BAA0B,EAC3B,MAAM,iDAAiD,CAAA;AAExD,wGAAwG;AACxG,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;AAiLjF,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,GAEvC,QAAQ,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,EAC1D,WAAW,SAAS,EACpB,MAAM,MAAM,EACZ,cAAc,MAAM,KACnB,0BA2DF,CAAA"}
|
|
@@ -15,11 +15,17 @@ const SECRET_TO_INPUT_FIELD_MAP = {
|
|
|
15
15
|
'x-scalar-secret-token-url': 'tokenUrl',
|
|
16
16
|
};
|
|
17
17
|
const mergeFlowSecrets = (properties, configSecrets, authStoreSecrets = {}) => Object.fromEntries(properties.map((property) => {
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
// Redirect URI is the only OAuth secret where an explicit empty value from
|
|
19
|
+
// store must be preserved. Other secrets use falsy fallback behavior for backwards-compatibility
|
|
20
|
+
// with config defaults when the casted auth store value is an empty string.
|
|
21
|
+
const authStoreValue = typeof authStoreSecrets[property] === 'string' ? authStoreSecrets[property] : undefined;
|
|
22
|
+
const configValue = typeof configSecrets[property] === 'string' ? configSecrets[property] : undefined;
|
|
23
|
+
const configInputValue = typeof configSecrets[SECRET_TO_INPUT_FIELD_MAP[property]] === 'string'
|
|
24
|
+
? configSecrets[SECRET_TO_INPUT_FIELD_MAP[property]]
|
|
25
|
+
: undefined;
|
|
26
|
+
const value = property === 'x-scalar-secret-redirect-uri'
|
|
27
|
+
? (authStoreValue ?? configValue ?? configInputValue ?? '')
|
|
28
|
+
: authStoreValue || configValue || configInputValue || '';
|
|
23
29
|
return [property, value];
|
|
24
30
|
}));
|
|
25
31
|
const extractRefreshTokenSecret = (authStoreSecrets = {}) => {
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"openapi",
|
|
17
17
|
"scalar"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.46.
|
|
19
|
+
"version": "0.46.3",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=22"
|
|
22
22
|
},
|
|
@@ -144,12 +144,12 @@
|
|
|
144
144
|
"type-fest": "^5.3.1",
|
|
145
145
|
"vue": "^3.5.30",
|
|
146
146
|
"yaml": "^2.8.0",
|
|
147
|
-
"@scalar/
|
|
148
|
-
"@scalar/openapi-upgrader": "0.2.
|
|
149
|
-
"@scalar/
|
|
150
|
-
"@scalar/
|
|
147
|
+
"@scalar/json-magic": "0.12.8",
|
|
148
|
+
"@scalar/openapi-upgrader": "0.2.6",
|
|
149
|
+
"@scalar/snippetz": "0.9.2",
|
|
150
|
+
"@scalar/helpers": "0.5.2",
|
|
151
151
|
"@scalar/validation": "0.3.0",
|
|
152
|
-
"@scalar/
|
|
152
|
+
"@scalar/types": "0.9.2"
|
|
153
153
|
},
|
|
154
154
|
"devDependencies": {
|
|
155
155
|
"@google-cloud/storage": "7.16.0",
|