@scalar/workspace-store 0.43.0 → 0.44.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/entities/auth/schema.d.ts +30 -0
  3. package/dist/entities/auth/schema.d.ts.map +1 -1
  4. package/dist/events/definitions/document.d.ts +5 -0
  5. package/dist/events/definitions/document.d.ts.map +1 -1
  6. package/dist/mutators/document.d.ts +6 -0
  7. package/dist/mutators/document.d.ts.map +1 -1
  8. package/dist/mutators/document.js +11 -0
  9. package/dist/mutators/index.d.ts +2 -0
  10. package/dist/mutators/index.d.ts.map +1 -1
  11. package/dist/request-example/builder/build-request.d.ts.map +1 -1
  12. package/dist/request-example/builder/build-request.js +41 -55
  13. package/dist/request-example/builder/index.d.ts +1 -0
  14. package/dist/request-example/builder/index.d.ts.map +1 -1
  15. package/dist/request-example/builder/request-factory.d.ts +150 -12
  16. package/dist/request-example/builder/request-factory.d.ts.map +1 -1
  17. package/dist/request-example/builder/request-factory.js +3 -9
  18. package/dist/request-example/builder/resolve-request-factory-url.d.ts +11 -0
  19. package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -0
  20. package/dist/request-example/builder/resolve-request-factory-url.js +28 -0
  21. package/dist/request-example/builder/security/build-request-security.d.ts +39 -6
  22. package/dist/request-example/builder/security/build-request-security.d.ts.map +1 -1
  23. package/dist/request-example/builder/security/build-request-security.js +14 -6
  24. package/dist/request-example/context/get-request-example-context.d.ts +3 -0
  25. package/dist/request-example/context/get-request-example-context.d.ts.map +1 -1
  26. package/dist/request-example/context/get-request-example-context.js +2 -2
  27. package/dist/request-example/context/security/get-selected-security.d.ts +9 -4
  28. package/dist/request-example/context/security/get-selected-security.d.ts.map +1 -1
  29. package/dist/request-example/context/security/get-selected-security.js +58 -8
  30. package/dist/request-example/index.d.ts +4 -2
  31. package/dist/request-example/index.d.ts.map +1 -1
  32. package/dist/request-example/index.js +1 -0
  33. package/dist/request-example/variable-store/index.d.ts +7 -0
  34. package/dist/request-example/variable-store/index.d.ts.map +1 -0
  35. package/dist/request-example/variable-store/index.js +41 -0
  36. package/dist/request-example/variable-store/types.d.ts +59 -0
  37. package/dist/request-example/variable-store/types.d.ts.map +1 -0
  38. package/dist/request-example/variable-store/types.js +11 -0
  39. package/dist/schemas/extensions/general/x-post-response.d.ts.map +1 -0
  40. package/dist/schemas/extensions/general/x-pre-request.d.ts +25 -0
  41. package/dist/schemas/extensions/general/x-pre-request.d.ts.map +1 -0
  42. package/dist/schemas/extensions/general/x-pre-request.js +26 -0
  43. package/dist/schemas/extensions/operation/index.d.ts +0 -1
  44. package/dist/schemas/extensions/operation/index.d.ts.map +1 -1
  45. package/dist/schemas/extensions/operation/index.js +0 -1
  46. package/dist/schemas/inmemory-workspace.d.ts +18 -0
  47. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  48. package/dist/schemas/reference-config/index.d.ts +6 -0
  49. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  50. package/dist/schemas/reference-config/settings.d.ts +6 -0
  51. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  52. package/dist/schemas/v3.1/openapi/index.d.ts +4 -0
  53. package/dist/schemas/v3.1/openapi/index.d.ts.map +1 -1
  54. package/dist/schemas/v3.1/openapi/index.js +5 -1
  55. package/dist/schemas/v3.1/strict/openapi-document.d.ts +217 -1
  56. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  57. package/dist/schemas/v3.1/strict/openapi-document.js +3 -1
  58. package/dist/schemas/v3.1/strict/operation.d.ts +5 -2
  59. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  60. package/dist/schemas/v3.1/strict/operation.js +3 -2
  61. package/dist/schemas/workspace.d.ts +18 -0
  62. package/dist/schemas/workspace.d.ts.map +1 -1
  63. package/package.json +5 -5
  64. package/dist/schemas/extensions/operation/x-post-response.d.ts.map +0 -1
  65. /package/dist/schemas/extensions/{operation → general}/x-post-response.d.ts +0 -0
  66. /package/dist/schemas/extensions/{operation → general}/x-post-response.js +0 -0
@@ -0,0 +1,11 @@
1
+ import type { RequestFactory } from '../../request-example/builder/request-factory.js';
2
+ /**
3
+ * Resolves the request URL string from a {@link RequestFactory} using the same
4
+ * rules as {@link buildRequest} (path variables, query, security query params),
5
+ * without proxy rewriting or reserved-query encoding.
6
+ */
7
+ export declare const resolveRequestFactoryUrl: (request: RequestFactory, options: {
8
+ envVariables: Record<string, string>;
9
+ securityQueryParams: URLSearchParams;
10
+ }) => string;
11
+ //# sourceMappingURL=resolve-request-factory-url.d.ts.map
@@ -0,0 +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;IAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,mBAAmB,EAAE,eAAe,CAAA;CAAE,KACtF,MA2BF,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { replaceEnvVariables, replacePathVariables } from '@scalar/helpers/regex/replace-variables';
2
+ import { mergeUrls } from '@scalar/helpers/url/merge-urls';
3
+ /**
4
+ * Resolves the request URL string from a {@link RequestFactory} using the same
5
+ * rules as {@link buildRequest} (path variables, query, security query params),
6
+ * without proxy rewriting or reserved-query encoding.
7
+ */
8
+ export const resolveRequestFactoryUrl = (request, options) => {
9
+ const variables = options.envVariables;
10
+ const pathVariables = Object.fromEntries(Object.entries(request.path.variables).map(([key, value]) => [
11
+ key,
12
+ encodeURIComponent(replaceEnvVariables(value, variables)),
13
+ ]));
14
+ const baseUrl = replaceEnvVariables(request.baseUrl, variables);
15
+ const path = replacePathVariables(request.path.raw, pathVariables);
16
+ const mergedUrl = mergeUrls(baseUrl, path);
17
+ const urlBase = globalThis.window?.location?.origin ?? 'http://localhost:3000';
18
+ const url = new URL(mergedUrl, urlBase);
19
+ // Merge in operation query params
20
+ for (const [key, value] of request.query.entries()) {
21
+ url.searchParams.set(replaceEnvVariables(key, variables), replaceEnvVariables(value, variables));
22
+ }
23
+ // Merge in security query params
24
+ for (const [key, value] of options.securityQueryParams.entries()) {
25
+ url.searchParams.set(key, value);
26
+ }
27
+ return url.toString();
28
+ };
@@ -1,14 +1,47 @@
1
1
  import type { SecuritySchemeObjectSecret } from '../../../request-example/builder/security/secret-types.js';
2
+ /**
3
+ * BuildRequestSecurityResult
4
+ *
5
+ * Represents an extracted and normalized security credential for an OpenAPI operation input,
6
+ * to be used directly when building HTTP requests (headers, query params, or cookies).
7
+ *
8
+ * This type is produced by the security builder whenever a user selects a security scheme
9
+ * (such as API key, HTTP Basic, or HTTP Bearer) for an operation. Each object here maps directly
10
+ * to one HTTP request authentication mechanism, with its resolved, ready-to-use value.
11
+ *
12
+ * Detailed Fields:
13
+ * - `in`: Where to apply this security value in the outgoing HTTP request.
14
+ * - `'header'`: Set as an HTTP header (e.g., `Authorization`, or API key header).
15
+ * - `'query'`: Set as a query parameter (e.g., `/path?apikey=123`).
16
+ * - `'cookie'`: Set as a cookie header (`Cookie: apikey=123`).
17
+ *
18
+ * - `name`: The key name to use for the security credential in the selected location.
19
+ * - For headers/params, the header or query name.
20
+ * - For cookies, the cookie key.
21
+ *
22
+ * - `format` (optional): Clarifies the expected format, especially for HTTP schemes.
23
+ * - `'basic'`: HTTP Basic Auth.
24
+ * - `'bearer'`: HTTP Bearer token.
25
+ * - Not present for schemes without a special format (e.g., generic API keys).
26
+ *
27
+ * - `value`: The fully resolved secret value to use in the request.
28
+ * - This may already include necessary prefixes (e.g., "Bearer x", "Basic y"),
29
+ * or be a direct value depending on the scheme and usage.
30
+ *
31
+ * NOTE: This type does not capture UI display info, secret labels, or environment binding.
32
+ * It is intended purely for producing the final request input object. Multiple
33
+ * BuildRequestSecurityResult objects may be generated from a single operation if multiple
34
+ * security schemes are selected and must be included simultaneously.
35
+ */
2
36
  export type BuildRequestSecurityResult = {
3
- /** The location of the security scheme */
37
+ /** The location of the security scheme in the HTTP request */
4
38
  in: 'header' | 'query' | 'cookie';
5
- /** The name of the security scheme */
39
+ /** The key/name for the authentication value (header/query/cookie name) */
6
40
  name: string;
7
- /** The type of security scheme */
8
- type: 'simple' | 'basic' | 'bearer';
41
+ /** Format code for HTTP schemes (e.g., 'basic' | 'bearer'), if relevant */
42
+ format?: 'basic' | 'bearer';
9
43
  /**
10
- * The value of the security scheme
11
- * For basic auth we need to base64 encode the value when we build the request
44
+ * The fully resolved authentication value to use (may include tokens, encoded credentials, etc.)
12
45
  */
13
46
  value: string;
14
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/security/build-request-security.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAEjG,MAAM,MAAM,0BAA0B,GAAG;IACvC,0CAA0C;IAC1C,EAAE,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;IACjC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,kCAAkC;IAClC,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;IACnC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,4DAA4D;AAC5D,yBAAyB,0BAA0B,EAAE;AACrD,qEAAqE;AACrE,8BAA0B,KACzB,0BAA0B,EA6E5B,CAAA"}
1
+ {"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/security/build-request-security.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAEjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,8DAA8D;IAC9D,EAAE,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;IACjC,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAA;IACZ,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,4DAA4D;AAC5D,yBAAyB,0BAA0B,EAAE;AACrD,qEAAqE;AACrE,8BAA0B,KACzB,0BAA0B,EAuF5B,CAAA"}
@@ -19,7 +19,6 @@ emptyTokenPlaceholder = '') => {
19
19
  in: scheme.in,
20
20
  name,
21
21
  value,
22
- type: 'simple',
23
22
  });
24
23
  }
25
24
  if (scheme.in === 'query') {
@@ -27,7 +26,6 @@ emptyTokenPlaceholder = '') => {
27
26
  in: 'query',
28
27
  name,
29
28
  value,
30
- type: 'simple',
31
29
  });
32
30
  }
33
31
  if (scheme.in === 'cookie') {
@@ -35,7 +33,6 @@ emptyTokenPlaceholder = '') => {
35
33
  in: 'cookie',
36
34
  name,
37
35
  value,
38
- type: 'simple',
39
36
  });
40
37
  }
41
38
  }
@@ -50,7 +47,7 @@ emptyTokenPlaceholder = '') => {
50
47
  name: 'Authorization',
51
48
  // We encode the value when we build the request since we want to be able to replace the variables in the value
52
49
  value: value === ':' ? 'username:password' : value,
53
- type: 'basic',
50
+ format: 'basic',
54
51
  });
55
52
  }
56
53
  // Bearer auth
@@ -59,7 +56,7 @@ emptyTokenPlaceholder = '') => {
59
56
  in: 'header',
60
57
  name: 'Authorization',
61
58
  value: value || emptyTokenPlaceholder,
62
- type: 'bearer',
59
+ format: 'bearer',
63
60
  });
64
61
  }
65
62
  // OAuth2
@@ -70,7 +67,18 @@ emptyTokenPlaceholder = '') => {
70
67
  in: 'header',
71
68
  name: 'Authorization',
72
69
  value: token || emptyTokenPlaceholder,
73
- type: 'bearer',
70
+ format: 'bearer',
71
+ });
72
+ }
73
+ // OpenID Connect
74
+ if (scheme.type === 'openIdConnect') {
75
+ const flows = Object.values(scheme?.flows ?? {});
76
+ const token = flows.filter(isDefined).find((f) => f['x-scalar-secret-token'])?.['x-scalar-secret-token'] ?? '';
77
+ return result.push({
78
+ in: 'header',
79
+ name: 'Authorization',
80
+ value: token || emptyTokenPlaceholder,
81
+ format: 'bearer',
74
82
  });
75
83
  }
76
84
  return null;
@@ -1,3 +1,4 @@
1
+ import type { AuthenticationConfiguration } from '@scalar/types/api-reference';
1
2
  import type { WorkspaceStore } from '../../client.js';
2
3
  import type { SelectedSecurity } from '../../entities/auth/index.js';
3
4
  import type { AuthMeta, ServerMeta } from '../../events/index.js';
@@ -46,6 +47,8 @@ export declare const getRequestExampleContext: (workspaceStore: WorkspaceStore,
46
47
  layout: Layout;
47
48
  appVersion: string;
48
49
  isElectron: boolean;
50
+ /** User facing authentication configuration */
51
+ authentication: AuthenticationConfiguration;
49
52
  /**
50
53
  * When the document is not in `workspace.documents[documentName]` yet, use this copy (same shape as the
51
54
  * workspace entry). Callers that already hold the resolved document should pass it so behavior matches
@@ -1 +1 @@
1
- {"version":3,"file":"get-request-example-context.d.ts","sourceRoot":"","sources":["../../../src/request-example/context/get-request-example-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAIjG,OAAO,EAAE,KAAK,MAAM,EAAqB,MAAM,iCAAiC,CAAA;AAIhF,OAAO,EAAE,KAAK,qBAAqB,EAAiB,MAAM,mDAAmD,CAAA;AAE7G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAA;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,KAAK,0BAA0B,GAAG;IAChC,SAAS,EAAE,eAAe,CAAA;IAC1B,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,WAAW,EAAE,kBAAkB,CAAA;KAChC,CAAA;IACD,OAAO,EAAE;QACP,SAAS,EAAE,aAAa,EAAE,CAAA;QAC1B,QAAQ,EAAE,aAAa,EAAE,CAAA;KAC1B,CAAA;IACD,OAAO,EAAE;QACP,IAAI,EAAE,YAAY,EAAE,CAAA;QACpB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAA;QAC7B,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;IACD,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KACnB,CAAA;IACD,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAChC,CAAA;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,qBAAqB,CAAA;QAC9B,YAAY,EAAE,yBAAyB,EAAE,CAAA;QACzC,QAAQ,EAAE,gBAAgB,CAAA;QAC1B,eAAe,EAAE,0BAA0B,EAAE,CAAA;QAC7C,IAAI,EAAE,QAAQ,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,cAAc,EAC9B,cAAc,MAAM,EACpB,oBAAoB,kBAAkB,EACtC,UAAS,OAAO,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAC3C,CAAM,KACN,MAAM,CAAC,0BAA0B,CAmInC,CAAA"}
1
+ {"version":3,"file":"get-request-example-context.d.ts","sourceRoot":"","sources":["../../../src/request-example/context/get-request-example-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAIjG,OAAO,EAAE,KAAK,MAAM,EAAqB,MAAM,iCAAiC,CAAA;AAIhF,OAAO,EAAE,KAAK,qBAAqB,EAAiB,MAAM,mDAAmD,CAAA;AAE7G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAA;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,KAAK,0BAA0B,GAAG;IAChC,SAAS,EAAE,eAAe,CAAA;IAC1B,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,WAAW,EAAE,kBAAkB,CAAA;KAChC,CAAA;IACD,OAAO,EAAE;QACP,SAAS,EAAE,aAAa,EAAE,CAAA;QAC1B,QAAQ,EAAE,aAAa,EAAE,CAAA;KAC1B,CAAA;IACD,OAAO,EAAE;QACP,IAAI,EAAE,YAAY,EAAE,CAAA;QACpB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAA;QAC7B,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;IACD,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KACnB,CAAA;IACD,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAChC,CAAA;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,qBAAqB,CAAA;QAC9B,YAAY,EAAE,yBAAyB,EAAE,CAAA;QACzC,QAAQ,EAAE,gBAAgB,CAAA;QAC1B,eAAe,EAAE,0BAA0B,EAAE,CAAA;QAC7C,IAAI,EAAE,QAAQ,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,cAAc,EAC9B,cAAc,MAAM,EACpB,oBAAoB,kBAAkB,EACtC,UAAS,OAAO,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;IACnB,+CAA+C;IAC/C,cAAc,EAAE,2BAA2B,CAAA;IAC3C;;;;OAIG;IACH,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAC3C,CAAM,KACN,MAAM,CAAC,0BAA0B,CAoInC,CAAA"}
@@ -63,9 +63,9 @@ export const getRequestExampleContext = (workspaceStore, documentName, requestEx
63
63
  path: path ?? '',
64
64
  method: method ?? 'get',
65
65
  });
66
- const securitySchemes = mergeSecurity(document.components?.securitySchemes ?? {}, {}, workspaceStore.auth, documentName);
66
+ const securitySchemes = mergeSecurity(document.components?.securitySchemes ?? {}, options.authentication?.securitySchemes ?? {}, workspaceStore.auth, documentName);
67
67
  const securityRequirements = getSecurityRequirements(document.security, operation.security);
68
- const selectedSecurity = getSelectedSecurity(documentSelectedSecurity, operationSelectedSecurity, securityRequirements, securitySchemes);
68
+ const selectedSecurity = getSelectedSecurity(documentSelectedSecurity, operationSelectedSecurity, securityRequirements, securitySchemes, options.authentication?.preferredSecurityScheme);
69
69
  /** The above selected requirements in scheme form */
70
70
  const selectedSecuritySchemes = getSecuritySchemes(securitySchemes, selectedSecurity.selectedSchemes);
71
71
  const serverMeta = operation.servers != null ? { type: 'operation', path: path ?? '', method: method ?? 'get' } : { type: 'document' };
@@ -1,3 +1,4 @@
1
+ import type { AuthenticationConfiguration } from '@scalar/types/api-reference';
1
2
  import type { SelectedSecurity } from '@scalar/workspace-store/entities/auth';
2
3
  import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
4
  type DefaultScopeScheme = {
@@ -6,10 +7,14 @@ type DefaultScopeScheme = {
6
7
  };
7
8
  /**
8
9
  * Resolves which security selection to use for an operation.
9
- * Priority: operation-level selection, then document-level selection, then a default.
10
- * When neither level has a selection, returns the first security requirement unless
11
- * authentication is optional or there are no requirements, in which case returns no selection.
10
+ *
11
+ * Priority order:
12
+ * 1. Operation-level selection (if set)
13
+ * 2. Document-level selection (if set)
14
+ * 3. Preferred security scheme from configuration (if provided)
15
+ * 4. First security requirement from the OpenAPI spec
16
+ * 5. No selection (if auth is optional or no requirements exist)
12
17
  */
13
- export declare const getSelectedSecurity: (documentSelectedSecurity: SelectedSecurity | undefined, operationSelectedSecurity: SelectedSecurity | undefined, securityRequirements?: NonNullable<OpenApiDocument["security"]>, securitySchemes?: Record<string, DefaultScopeScheme | undefined>) => SelectedSecurity;
18
+ export declare const getSelectedSecurity: (documentSelectedSecurity: SelectedSecurity | undefined, operationSelectedSecurity: SelectedSecurity | undefined, securityRequirements?: NonNullable<OpenApiDocument["security"]>, securitySchemes?: Record<string, DefaultScopeScheme | undefined>, preferredSecurityScheme?: AuthenticationConfiguration["preferredSecurityScheme"]) => SelectedSecurity;
14
19
  export {};
15
20
  //# sourceMappingURL=get-selected-security.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-selected-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/get-selected-security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAE7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAInG,KAAK,kBAAkB,GAAG;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AA4BD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,0BAA0B,gBAAgB,GAAG,SAAS,EACtD,2BAA2B,gBAAgB,GAAG,SAAS,EACvD,uBAAsB,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAM,EACnE,kBAAiB,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,SAAS,CAAM,KACnE,gBA4BF,CAAA"}
1
+ {"version":3,"file":"get-selected-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/get-selected-security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAE7E,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,8DAA8D,CAAA;AAIrE,KAAK,kBAAkB,GAAG;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAkED;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAC9B,0BAA0B,gBAAgB,GAAG,SAAS,EACtD,2BAA2B,gBAAgB,GAAG,SAAS,EACvD,uBAAsB,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAM,EACnE,kBAAiB,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,SAAS,CAAM,EACpE,0BAA0B,2BAA2B,CAAC,yBAAyB,CAAC,KAC/E,gBAgDF,CAAA"}
@@ -1,5 +1,12 @@
1
1
  import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref';
2
2
  import { isAuthOptional } from './is-auth-optional.js';
3
+ /** Extracts the default scopes for a security scheme (only OAuth2 schemes support this) */
4
+ const getDefaultScopes = (scheme) => {
5
+ if (!scheme || scheme.type !== 'oauth2') {
6
+ return [];
7
+ }
8
+ return scheme['x-default-scopes'] ?? [];
9
+ };
3
10
  const applyDefaultScopes = (requirement, securitySchemes) => {
4
11
  let didApplyDefaultScopes = false;
5
12
  const hydratedRequirement = Object.fromEntries(Object.entries(requirement).map(([name, scopes]) => {
@@ -16,25 +23,68 @@ const applyDefaultScopes = (requirement, securitySchemes) => {
16
23
  }));
17
24
  return didApplyDefaultScopes ? hydratedRequirement : requirement;
18
25
  };
26
+ /**
27
+ * Builds a security requirement from the preferred security scheme configuration.
28
+ * Handles both string and array formats for complex auth scenarios.
29
+ */
30
+ const buildSecurityRequirementFromPreferred = (preferredSecurityScheme, securitySchemes) => {
31
+ if (!Array.isArray(preferredSecurityScheme)) {
32
+ const scheme = getResolvedRef(securitySchemes[preferredSecurityScheme]);
33
+ return { [preferredSecurityScheme]: getDefaultScopes(scheme) };
34
+ }
35
+ const requirement = {};
36
+ for (const item of preferredSecurityScheme) {
37
+ if (Array.isArray(item)) {
38
+ for (const schemeName of item) {
39
+ const scheme = getResolvedRef(securitySchemes[schemeName]);
40
+ requirement[schemeName] = getDefaultScopes(scheme);
41
+ }
42
+ }
43
+ else {
44
+ const scheme = getResolvedRef(securitySchemes[item]);
45
+ requirement[item] = getDefaultScopes(scheme);
46
+ }
47
+ }
48
+ return requirement;
49
+ };
19
50
  /**
20
51
  * Resolves which security selection to use for an operation.
21
- * Priority: operation-level selection, then document-level selection, then a default.
22
- * When neither level has a selection, returns the first security requirement unless
23
- * authentication is optional or there are no requirements, in which case returns no selection.
52
+ *
53
+ * Priority order:
54
+ * 1. Operation-level selection (if set)
55
+ * 2. Document-level selection (if set)
56
+ * 3. Preferred security scheme from configuration (if provided)
57
+ * 4. First security requirement from the OpenAPI spec
58
+ * 5. No selection (if auth is optional or no requirements exist)
24
59
  */
25
- export const getSelectedSecurity = (documentSelectedSecurity, operationSelectedSecurity, securityRequirements = [], securitySchemes = {}) => {
26
- // Operation level security
60
+ export const getSelectedSecurity = (documentSelectedSecurity, operationSelectedSecurity, securityRequirements = [], securitySchemes = {}, preferredSecurityScheme) => {
61
+ // Operation level security takes highest priority
27
62
  if (operationSelectedSecurity) {
28
63
  return operationSelectedSecurity;
29
64
  }
30
- // Document level security
65
+ // Document level security is next
31
66
  if (documentSelectedSecurity) {
32
67
  return documentSelectedSecurity;
33
68
  }
34
69
  const isOptional = isAuthOptional(securityRequirements);
70
+ // No need to default if auth is optional and no preferred scheme
71
+ if (isOptional && !preferredSecurityScheme) {
72
+ return {
73
+ selectedIndex: -1,
74
+ selectedSchemes: [],
75
+ };
76
+ }
77
+ // Use preferred security scheme if configured
78
+ if (preferredSecurityScheme) {
79
+ const requirement = buildSecurityRequirementFromPreferred(preferredSecurityScheme, securitySchemes);
80
+ return {
81
+ selectedIndex: 0,
82
+ selectedSchemes: [requirement],
83
+ };
84
+ }
35
85
  const firstRequirement = securityRequirements[0];
36
- // No need to default if auth is optional
37
- if (isOptional || !firstRequirement) {
86
+ // No requirements and no preferred scheme
87
+ if (!firstRequirement) {
38
88
  return {
39
89
  selectedIndex: -1,
40
90
  selectedSchemes: [],
@@ -1,5 +1,7 @@
1
- export { buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
2
1
  export type { ApiKeyObjectSecret, HttpObjectSecret, OAuth2ObjectSecret, OAuthFlowAuthorizationCodeSecret, OAuthFlowClientCredentialsSecret, OAuthFlowImplicitSecret, OAuthFlowPasswordSecret, OAuthFlowsObjectSecret, OpenIdConnectObjectSecret, SecuritySchemeObjectSecret, } from './builder/index.js';
3
- export { combineParams, getActiveEnvironment, getActiveProxyUrl, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, } from './context/index.js';
2
+ export { type RequestFactory, buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
4
3
  export type { MergedSecuritySchemes } from './context/index.js';
4
+ export { combineParams, getActiveEnvironment, getActiveProxyUrl, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, } from './context/index.js';
5
+ export { createVariablesStoreForRequest } from './variable-store/index.js';
6
+ export type { VariableEntry, VariablesStore } from './variable-store/types.js';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-example/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,WAAW,CAAA;AAClB,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-example/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,KAAK,cAAc,EACnB,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAA;AACjE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA"}
@@ -1,2 +1,3 @@
1
1
  export { buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
2
2
  export { combineParams, getActiveEnvironment, getActiveProxyUrl, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, } from './context/index.js';
3
+ export { createVariablesStoreForRequest } from './variable-store/index.js';
@@ -0,0 +1,7 @@
1
+ import type { VariablesStore } from '../../request-example/variable-store/types.js';
2
+ /**
3
+ * Creates an in-memory VariablesStore for a single request execution,
4
+ * managing environment, collection, global, and local variables in priority order.
5
+ */
6
+ export declare function createVariablesStoreForRequest(): VariablesStore;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/request-example/variable-store/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,wCAAwC,CAAA;AAE3F;;;GAGG;AACH,wBAAgB,8BAA8B,IAAI,cAAc,CAuC/D"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Creates an in-memory VariablesStore for a single request execution,
3
+ * managing environment, collection, global, and local variables in priority order.
4
+ */
5
+ export function createVariablesStoreForRequest() {
6
+ const environmentEntries = [];
7
+ const collectionEntries = [];
8
+ const worksapceEntries = [];
9
+ const localVariables = [];
10
+ return {
11
+ getEnvironment: () => environmentEntries,
12
+ getGlobals: () => worksapceEntries,
13
+ getCollectionVariables: () => collectionEntries,
14
+ getData: () => ({}),
15
+ getLocalVariables: () => {
16
+ return localVariables;
17
+ },
18
+ setLocalVariables: (variables) => {
19
+ localVariables.length = 0;
20
+ localVariables.push(...variables);
21
+ },
22
+ setCollectionVariables: (variables) => {
23
+ collectionEntries.length = 0;
24
+ collectionEntries.push(...variables);
25
+ },
26
+ setEnvironment: (variables) => {
27
+ environmentEntries.length = 0;
28
+ environmentEntries.push(...variables);
29
+ },
30
+ setGlobals: (variables) => {
31
+ worksapceEntries.length = 0;
32
+ worksapceEntries.push(...variables);
33
+ },
34
+ getVariables: () => {
35
+ return Object.fromEntries([...worksapceEntries, ...collectionEntries, ...environmentEntries, ...localVariables].map((v) => [
36
+ v.key,
37
+ v.value,
38
+ ]));
39
+ },
40
+ };
41
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * External store for pm.variables used by post-response (and pre-request) scripts.
3
+ *
4
+ * Mirrors the Postman variable precedence: local (in-memory) overrides data, then
5
+ * environment, then collection, then globals. Scripts can read all scopes via
6
+ * pm.variables.get() and only write to the local scope via pm.variables.set();
7
+ * after execution, the adapter writes local variables back through setLocalVariables.
8
+ *
9
+ * @see https://github.com/postmanlabs/postman-sandbox test/unit/pm-variables.test.js
10
+ */
11
+ export type VariableEntry = {
12
+ key: string;
13
+ value: string;
14
+ };
15
+ /**
16
+ * Store interface for workspace/env and in-memory local variables used by the
17
+ * Postman sandbox. The host (e.g. api-client) can implement this to provide
18
+ * environment/globals/collection variables and to persist local variables
19
+ * set by scripts (pm.variables.set), collection variables (pm.collectionVariables.set),
20
+ * and globals (pm.globals.set).
21
+ */
22
+ export type VariablesStore = {
23
+ /** Workspace / environment variables (read-only in scripts). */
24
+ getEnvironment(): VariableEntry[] | Record<string, string>;
25
+ /** Global variables; scripts can set via pm.globals.set. */
26
+ getGlobals(): VariableEntry[] | Record<string, string>;
27
+ /** Collection-level variables; scripts can set via pm.collectionVariables.set. */
28
+ getCollectionVariables(): VariableEntry[] | Record<string, string>;
29
+ /** Request/iteration data (read-only in scripts). */
30
+ getData(): Record<string, string>;
31
+ /** In-memory local variables; scripts can set these via pm.variables.set. */
32
+ getLocalVariables(): VariableEntry[] | Record<string, string>;
33
+ /**
34
+ * Called after script execution with the updated local variables so the host
35
+ * can persist them for the next request or display.
36
+ */
37
+ setLocalVariables(variables: VariableEntry[]): void;
38
+ /**
39
+ * Optional. Called after script execution with collection variables set by
40
+ * the script (pm.collectionVariables.set). If implemented, the host can
41
+ * persist or merge these for the next request.
42
+ */
43
+ setCollectionVariables?(variables: VariableEntry[]): void;
44
+ /**
45
+ * Optional. Called after script execution with environment variables set by the script
46
+ * (pm.environment.set). If implemented, the host can persist or merge these
47
+ * for the next request.
48
+ */
49
+ setEnvironment?(variables: VariableEntry[]): void;
50
+ /**
51
+ * Optional. Called after script execution with globals set by the script
52
+ * (pm.globals.set). If implemented, the host can persist or merge these
53
+ * for the next request.
54
+ */
55
+ setGlobals?(variables: VariableEntry[]): void;
56
+ /** Merged variables from all scopes based on the different leyers. */
57
+ getVariables(): Record<string, string>;
58
+ };
59
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/request-example/variable-store/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1D;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,gEAAgE;IAChE,cAAc,IAAI,aAAa,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC1D,4DAA4D;IAC5D,UAAU,IAAI,aAAa,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtD,kFAAkF;IAClF,sBAAsB,IAAI,aAAa,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClE,qDAAqD;IACrD,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,6EAA6E;IAC7E,iBAAiB,IAAI,aAAa,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7D;;;OAGG;IACH,iBAAiB,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAA;IACnD;;;;OAIG;IACH,sBAAsB,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAA;IACzD;;;;OAIG;IACH,cAAc,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAA;IACjD;;;;OAIG;IACH,UAAU,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAA;IAC7C,sEAAsE;IACtE,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC,CAAA"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * External store for pm.variables used by post-response (and pre-request) scripts.
3
+ *
4
+ * Mirrors the Postman variable precedence: local (in-memory) overrides data, then
5
+ * environment, then collection, then globals. Scripts can read all scopes via
6
+ * pm.variables.get() and only write to the local scope via pm.variables.set();
7
+ * after execution, the adapter writes local variables back through setLocalVariables.
8
+ *
9
+ * @see https://github.com/postmanlabs/postman-sandbox test/unit/pm-variables.test.js
10
+ */
11
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-post-response.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/general/x-post-response.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB;;EAE9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,aAAa;;EAYzB,CAAA"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Pre-request scripts run before a request is sent. They are used to prepare or modify anything needed for the request to succeed.
3
+ *
4
+ * Common uses:
5
+ * - Set up data and variables
6
+ * - Generate timestamps, random values, IDs, or nonces
7
+ * - Set environment or collection variables for use in the URL, headers, or body
8
+ *
9
+ * @example
10
+ * ```yaml
11
+ * x-pre-request: |
12
+ * var token = pm.environment.get("token")
13
+ * pm.request.headers.set("Authorization", `Bearer ${token}`)
14
+ * ```
15
+ */
16
+ export declare const XPreRequestSchema: import("@scalar/typebox").TObject<{
17
+ 'x-pre-request': import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
18
+ }>;
19
+ export declare const XPreRequest: import("@scalar/validation").ObjectSchema<{
20
+ 'x-pre-request': import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
21
+ }>;
22
+ export type XPreRequest = {
23
+ 'x-pre-request'?: string;
24
+ };
25
+ //# sourceMappingURL=x-pre-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-pre-request.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/general/x-pre-request.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB;;EAE5B,CAAA;AAEF,eAAO,MAAM,WAAW;;EAQvB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { Type } from '@scalar/typebox';
2
+ import { object, optional, string } from '@scalar/validation';
3
+ /**
4
+ * Pre-request scripts run before a request is sent. They are used to prepare or modify anything needed for the request to succeed.
5
+ *
6
+ * Common uses:
7
+ * - Set up data and variables
8
+ * - Generate timestamps, random values, IDs, or nonces
9
+ * - Set environment or collection variables for use in the URL, headers, or body
10
+ *
11
+ * @example
12
+ * ```yaml
13
+ * x-pre-request: |
14
+ * var token = pm.environment.get("token")
15
+ * pm.request.headers.set("Authorization", `Bearer ${token}`)
16
+ * ```
17
+ */
18
+ export const XPreRequestSchema = Type.Object({
19
+ 'x-pre-request': Type.Optional(Type.String()),
20
+ });
21
+ export const XPreRequest = object({
22
+ 'x-pre-request': optional(string()),
23
+ }, {
24
+ typeName: 'XPreRequest',
25
+ typeComment: 'Pre-request script to run before the request is sent.',
26
+ });
@@ -1,6 +1,5 @@
1
1
  export { type XBadge, XBadgeSchema, type XBadges, XBadgesSchema, } from './x-badge.js';
2
2
  export { type XCodeSample, type XCodeSamples, XCodeSamplesSchema, } from './x-code-samples.js';
3
- export { type XPostResponse, XPostResponseSchema, } from './x-post-response.js';
4
3
  export { type XScalarSelectedContentType, XScalarSelectedContentTypeSchema, } from './x-scalar-selected-content-type.js';
5
4
  export { XScalarStabilitySchema, XScalarStabilityValues, } from './x-scalar-stability.js';
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,YAAY,EACZ,KAAK,OAAO,EACZ,aAAa,GACd,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,KAAK,aAAa,EAClB,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,GACjC,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,YAAY,EACZ,KAAK,OAAO,EACZ,aAAa,GACd,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,GACjC,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,sBAAsB,CAAA"}
@@ -1,5 +1,4 @@
1
1
  export { XBadgeSchema, XBadgesSchema, } from './x-badge.js';
2
2
  export { XCodeSamplesSchema, } from './x-code-samples.js';
3
- export { XPostResponseSchema, } from './x-post-response.js';
4
3
  export { XScalarSelectedContentTypeSchema, } from './x-scalar-selected-content-type.js';
5
4
  export { XScalarStabilitySchema, XScalarStabilityValues, } from './x-scalar-stability.js';