@scalar/workspace-store 0.49.2 → 0.51.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 (135) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/dist/client.d.ts +2 -3
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +38 -15
  5. package/dist/entities/auth/schema.d.ts +10 -5
  6. package/dist/entities/auth/schema.d.ts.map +1 -1
  7. package/dist/events/bus.d.ts +70 -0
  8. package/dist/events/bus.d.ts.map +1 -1
  9. package/dist/events/bus.js +48 -11
  10. package/dist/events/definitions/analytics.d.ts +0 -12
  11. package/dist/events/definitions/analytics.d.ts.map +1 -1
  12. package/dist/events/definitions/auth.d.ts +44 -6
  13. package/dist/events/definitions/auth.d.ts.map +1 -1
  14. package/dist/events/definitions/index.d.ts +3 -2
  15. package/dist/events/definitions/index.d.ts.map +1 -1
  16. package/dist/events/definitions/log.d.ts +18 -0
  17. package/dist/events/definitions/log.d.ts.map +1 -0
  18. package/dist/events/definitions/log.js +1 -0
  19. package/dist/events/definitions/operation.d.ts +1 -1
  20. package/dist/events/definitions/operation.d.ts.map +1 -1
  21. package/dist/events/definitions/ui.d.ts +18 -1
  22. package/dist/events/definitions/ui.d.ts.map +1 -1
  23. package/dist/events/index.d.ts +1 -1
  24. package/dist/events/index.d.ts.map +1 -1
  25. package/dist/helpers/get-resolved-ref.d.ts +6 -0
  26. package/dist/helpers/get-resolved-ref.d.ts.map +1 -1
  27. package/dist/helpers/get-resolved-ref.js +9 -0
  28. package/dist/helpers/is-hidden.d.ts +8 -0
  29. package/dist/helpers/is-hidden.d.ts.map +1 -0
  30. package/dist/helpers/is-hidden.js +5 -0
  31. package/dist/mutators/auth.d.ts +22 -3
  32. package/dist/mutators/auth.d.ts.map +1 -1
  33. package/dist/mutators/auth.js +213 -37
  34. package/dist/mutators/cookie.d.ts.map +1 -1
  35. package/dist/mutators/cookie.js +3 -2
  36. package/dist/mutators/document.d.ts.map +1 -1
  37. package/dist/mutators/document.js +5 -4
  38. package/dist/mutators/environment.d.ts.map +1 -1
  39. package/dist/mutators/environment.js +12 -5
  40. package/dist/mutators/index.d.ts +4 -0
  41. package/dist/mutators/index.d.ts.map +1 -1
  42. package/dist/mutators/operation/body.d.ts.map +1 -1
  43. package/dist/mutators/operation/body.js +6 -2
  44. package/dist/mutators/operation/extensions.d.ts.map +1 -1
  45. package/dist/mutators/operation/extensions.js +5 -1
  46. package/dist/mutators/operation/history.d.ts.map +1 -1
  47. package/dist/mutators/operation/history.js +7 -3
  48. package/dist/mutators/operation/operation.d.ts.map +1 -1
  49. package/dist/mutators/operation/operation.js +15 -10
  50. package/dist/mutators/operation/parameters.d.ts.map +1 -1
  51. package/dist/mutators/operation/parameters.js +12 -5
  52. package/dist/mutators/server.d.ts.map +1 -1
  53. package/dist/mutators/server.js +2 -1
  54. package/dist/mutators/tag.d.ts.map +1 -1
  55. package/dist/mutators/tag.js +9 -4
  56. package/dist/navigation/helpers/get-openapi-object.d.ts.map +1 -1
  57. package/dist/navigation/helpers/get-openapi-object.js +5 -0
  58. package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
  59. package/dist/navigation/helpers/traverse-paths.js +4 -3
  60. package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
  61. package/dist/navigation/helpers/traverse-schemas.js +9 -4
  62. package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
  63. package/dist/navigation/helpers/traverse-tags.js +2 -1
  64. package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
  65. package/dist/navigation/helpers/traverse-webhooks.js +4 -3
  66. package/dist/navigation/helpers/update-order-ids.d.ts.map +1 -1
  67. package/dist/navigation/helpers/update-order-ids.js +4 -1
  68. package/dist/persistence/index.d.ts +123 -80
  69. package/dist/persistence/index.d.ts.map +1 -1
  70. package/dist/persistence/index.js +233 -167
  71. package/dist/persistence/migrations/v2-team-to-local.d.ts +22 -5
  72. package/dist/persistence/migrations/v2-team-to-local.d.ts.map +1 -1
  73. package/dist/persistence/migrations/v2-team-to-local.js +195 -137
  74. package/dist/request-example/builder/body/build-request-body.d.ts.map +1 -1
  75. package/dist/request-example/builder/body/build-request-body.js +48 -5
  76. package/dist/request-example/builder/build-request.d.ts +24 -3
  77. package/dist/request-example/builder/build-request.d.ts.map +1 -1
  78. package/dist/request-example/builder/build-request.js +89 -18
  79. package/dist/request-example/builder/index.d.ts +2 -1
  80. package/dist/request-example/builder/index.d.ts.map +1 -1
  81. package/dist/request-example/builder/index.js +2 -1
  82. package/dist/request-example/builder/request-factory.d.ts.map +1 -1
  83. package/dist/request-example/builder/request-factory.js +5 -8
  84. package/dist/request-example/builder/resolve-request-factory-url.d.ts +18 -1
  85. package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
  86. package/dist/request-example/builder/resolve-request-factory-url.js +29 -4
  87. package/dist/request-example/context/environment.d.ts.map +1 -1
  88. package/dist/request-example/context/environment.js +2 -1
  89. package/dist/request-example/context/get-request-example-context.d.ts.map +1 -1
  90. package/dist/request-example/context/get-request-example-context.js +7 -0
  91. package/dist/request-example/context/headers.d.ts +28 -13
  92. package/dist/request-example/context/headers.d.ts.map +1 -1
  93. package/dist/request-example/context/headers.js +84 -19
  94. package/dist/request-example/context/index.d.ts +1 -0
  95. package/dist/request-example/context/index.d.ts.map +1 -1
  96. package/dist/request-example/context/index.js +1 -0
  97. package/dist/request-example/context/security/get-selected-security.d.ts.map +1 -1
  98. package/dist/request-example/context/security/get-selected-security.js +3 -6
  99. package/dist/request-example/context/servers.d.ts.map +1 -1
  100. package/dist/request-example/context/servers.js +3 -3
  101. package/dist/request-example/index.d.ts +3 -3
  102. package/dist/request-example/index.d.ts.map +1 -1
  103. package/dist/request-example/index.js +2 -2
  104. package/dist/resolve.d.ts.map +1 -1
  105. package/dist/resolve.js +1 -8
  106. package/dist/schemas/asyncapi/asyncapi-document.d.ts +79 -0
  107. package/dist/schemas/asyncapi/asyncapi-document.d.ts.map +1 -0
  108. package/dist/schemas/asyncapi/asyncapi-document.js +58 -0
  109. package/dist/schemas/extensions/document/workspace-managed-extensions.d.ts +25 -0
  110. package/dist/schemas/extensions/document/workspace-managed-extensions.d.ts.map +1 -0
  111. package/dist/schemas/extensions/document/workspace-managed-extensions.js +26 -0
  112. package/dist/schemas/inmemory-workspace.d.ts +3 -4631
  113. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  114. package/dist/schemas/inmemory-workspace.js +1 -15
  115. package/dist/schemas/reference-config/index.d.ts +3 -2
  116. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  117. package/dist/schemas/reference-config/settings.d.ts +2 -1
  118. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  119. package/dist/schemas/type-guards.d.ts +24 -0
  120. package/dist/schemas/type-guards.d.ts.map +1 -0
  121. package/dist/schemas/type-guards.js +35 -0
  122. package/dist/schemas/v3.1/openapi/index.d.ts +2 -1
  123. package/dist/schemas/v3.1/openapi/index.d.ts.map +1 -1
  124. package/dist/schemas/v3.1/openapi/index.js +3 -3
  125. package/dist/schemas/v3.1/strict/openapi-document.d.ts +74 -39
  126. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  127. package/dist/schemas/v3.1/strict/openapi-document.js +6 -2
  128. package/dist/schemas/workspace-specification/index.d.ts +1 -1
  129. package/dist/schemas/workspace.d.ts +15 -4377
  130. package/dist/schemas/workspace.d.ts.map +1 -1
  131. package/dist/schemas/workspace.js +13 -8
  132. package/dist/schemas.d.ts +3 -1
  133. package/dist/schemas.d.ts.map +1 -1
  134. package/dist/schemas.js +3 -1
  135. package/package.json +6 -6
@@ -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,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
+ {"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;AA6DD;;;;;;;;;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"}
@@ -8,20 +8,17 @@ const getDefaultScopes = (scheme) => {
8
8
  return scheme['x-default-scopes'] ?? [];
9
9
  };
10
10
  const applyDefaultScopes = (requirement, securitySchemes) => {
11
- let didApplyDefaultScopes = false;
12
- const hydratedRequirement = Object.fromEntries(Object.entries(requirement).map(([name, scopes]) => {
11
+ return Object.fromEntries(Object.entries(requirement).map(([name, scopes]) => {
13
12
  if (Array.isArray(scopes) && scopes.length > 0) {
14
- return [name, scopes];
13
+ return [name, [...scopes]];
15
14
  }
16
15
  const scheme = getResolvedRef(securitySchemes[name]);
17
16
  const defaultScopes = scheme?.type === 'oauth2' ? scheme['x-default-scopes'] : undefined;
18
17
  if (Array.isArray(defaultScopes) && defaultScopes.length > 0) {
19
- didApplyDefaultScopes = true;
20
18
  return [name, [...defaultScopes]];
21
19
  }
22
- return [name, scopes];
20
+ return [name, Array.isArray(scopes) ? [...scopes] : scopes];
23
21
  }));
24
- return didApplyDefaultScopes ? hydratedRequirement : requirement;
25
22
  };
26
23
  /**
27
24
  * Builds a security requirement from the preferred security scheme configuration.
@@ -1 +1 @@
1
- {"version":3,"file":"servers.d.ts","sourceRoot":"","sources":["../../../src/request-example/context/servers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEhG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAEtE;;GAEG;AACH,KAAK,uBAAuB,GAAG;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,SAAS,EAAE,OAAO,GAAE,uBAA4B,GAAG,YAAY,EAAE,CASrH;AAoED,eAAO,MAAM,iBAAiB,GAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,WAAW,eAAe,GAAG,IAAI,EACjC,eAAe,YAAY,EAAE,GAAG,IAAI,EACpC,SAAS,YAAY,EAAE,KACtB,YAAY,GAAG,IAWjB,CAAA"}
1
+ {"version":3,"file":"servers.d.ts","sourceRoot":"","sources":["../../../src/request-example/context/servers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEhG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAEtE;;GAEG;AACH,KAAK,uBAAuB,GAAG;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,SAAS,EAAE,OAAO,GAAE,uBAA4B,GAAG,YAAY,EAAE,CASrH;AAoED,eAAO,MAAM,iBAAiB,GAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,WAAW,eAAe,GAAG,IAAI,EACjC,eAAe,YAAY,EAAE,GAAG,IAAI,EACpC,SAAS,YAAY,EAAE,KACtB,YAAY,GAAG,IAUjB,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { combineUrlAndPath } from '@scalar/helpers/url/merge-urls';
2
+ import { isOpenApiDocument } from '../../schemas/type-guards.js';
2
3
  /**
3
4
  * Retrieves and processes servers from an OpenAPI document.
4
5
  *
@@ -79,9 +80,8 @@ function processServerObject(server, options) {
79
80
  return server;
80
81
  }
81
82
  export const getSelectedServer = (document, operation, configServers, servers) => {
82
- const selectedServerUrl = configServers != null
83
- ? document?.['x-scalar-selected-server']
84
- : (operation?.['x-scalar-selected-server'] ?? document?.['x-scalar-selected-server']);
83
+ const documentSelectedServer = isOpenApiDocument(document) ? document['x-scalar-selected-server'] : undefined;
84
+ const selectedServerUrl = configServers != null ? documentSelectedServer : (operation?.['x-scalar-selected-server'] ?? documentSelectedServer);
85
85
  if (selectedServerUrl == null) {
86
86
  return servers[0] ?? null;
87
87
  }
@@ -1,7 +1,7 @@
1
- export type { ApiKeyObjectSecret, HttpObjectSecret, OAuth2ObjectSecret, OAuthFlowAuthorizationCodeSecret, OAuthFlowClientCredentialsSecret, OAuthFlowImplicitSecret, OAuthFlowPasswordSecret, OAuthFlowsObjectSecret, OpenIdConnectObjectSecret, RequestPayload, SecuritySchemeObjectSecret, } from './builder/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';
1
+ export type { ApiKeyObjectSecret, BuildRequestData, BuildRequestFailureCode, BuildRequestResult, HttpObjectSecret, OAuth2ObjectSecret, OAuthFlowAuthorizationCodeSecret, OAuthFlowClientCredentialsSecret, OAuthFlowImplicitSecret, OAuthFlowPasswordSecret, OAuthFlowsObjectSecret, OpenIdConnectObjectSecret, RequestPayload, ResolveRequestFactoryUrlError, ResolveRequestFactoryUrlResult, SecuritySchemeObjectSecret, } from './builder/index.js';
2
+ export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, type RequestFactory, buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, resolveExecutableRequestUrl, resolveRequestFactoryUrl, serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
3
3
  export type { MergedSecuritySchemes } from './context/index.js';
4
- export { type BuildRequestExampleContext, combineParams, getActiveEnvironment, getActiveProxyUrl, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, } from './context/index.js';
4
+ export { type BuildRequestExampleContext, combineParams, filterDisabledDefaultHeaders, getActiveEnvironment, getActiveProxyUrl, getDefaultHeaders, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, restoreConventionalDefaultHeaderNames, restoreConventionalHeaderName, } from './context/index.js';
5
5
  export { CONTEXT_FUNCTION_NAMES, type ContextFunctionEntry, type ContextFunctionName, POPULAR_CONTEXT_FUNCTION_KEYS, contextFunctions, getContextFunctionComment, isContextFunctionName, } from './functions.js';
6
6
  export { createVariablesStoreForRequest } from './variable-store/index.js';
7
7
  export type { VariableEntry, VariablesStore } from './variable-store/types.js';
@@ -1 +1 @@
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,cAAc,EACd,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,KAAK,0BAA0B,EAC/B,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,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,6BAA6B,EAC7B,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAA;AACjE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-example/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,6BAA6B,EAC7B,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,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,2BAA2B,EAC3B,wBAAwB,EACxB,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,KAAK,0BAA0B,EAC/B,aAAa,EACb,4BAA4B,EAC5B,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,EACb,qCAAqC,EACrC,6BAA6B,GAC9B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,6BAA6B,EAC7B,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAA;AACjE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA"}
@@ -1,4 +1,4 @@
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
- export { combineParams, getActiveEnvironment, getActiveProxyUrl, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, } from './context/index.js';
1
+ export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, resolveExecutableRequestUrl, resolveRequestFactoryUrl, serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
2
+ export { combineParams, filterDisabledDefaultHeaders, getActiveEnvironment, getActiveProxyUrl, getDefaultHeaders, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, restoreConventionalDefaultHeaderNames, restoreConventionalHeaderName, } from './context/index.js';
3
3
  export { CONTEXT_FUNCTION_NAMES, POPULAR_CONTEXT_FUNCTION_KEYS, contextFunctions, getContextFunctionComment, isContextFunctionName, } from './functions.js';
4
4
  export { createVariablesStoreForRequest } from './variable-store/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAUtF,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3F,eAAO,MAAM,OAAO;aACT,CAAC,SAAS,oBAAoB,GAAG,SAAS,UAAU,CAAC,KAAG,cAAc,CAAC,CAAC,CAAC;CAWnF,CAAA"}
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEtF,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3F,eAAO,MAAM,OAAO;aACT,CAAC,SAAS,oBAAoB,GAAG,SAAS,UAAU,CAAC,KAAG,cAAc,CAAC,CAAC,CAAC;CAWnF,CAAA"}
package/dist/resolve.js CHANGED
@@ -1,15 +1,8 @@
1
1
  import { Type } from '@scalar/typebox';
2
- import { getResolvedRef } from './helpers/get-resolved-ref.js';
2
+ import { getResolvedRef, mergeSiblingReferences } from './helpers/get-resolved-ref.js';
3
3
  import { compose } from './schemas/compose.js';
4
4
  import { coerceValue } from './schemas/typebox-coerce.js';
5
5
  import { SchemaObjectSchema } from './schemas/v3.1/strict/openapi-document.js';
6
- const mergeSiblingReferences = (node) => {
7
- const { '$ref-value': value, ...rest } = node;
8
- return {
9
- ...value,
10
- ...rest,
11
- };
12
- };
13
6
  export const resolve = {
14
7
  schema: (schema) => {
15
8
  if (schema === undefined) {
@@ -0,0 +1,79 @@
1
+ import { WorkspaceManagedExtensions } from '../../schemas/extensions/document/workspace-managed-extensions.js';
2
+ import { XScalarIsDirty } from '../../schemas/extensions/document/x-scalar-is-dirty.js';
3
+ import { XScalarOriginalDocumentHash } from '../../schemas/extensions/document/x-scalar-original-document-hash.js';
4
+ import { XScalarRegistryMeta } from '../../schemas/extensions/document/x-scalar-registry-meta.js';
5
+ /**
6
+ * Minimal AsyncAPI Info Object.
7
+ *
8
+ * Intentionally scoped to the fields we surface in the MVP. AsyncAPI's real Info Object
9
+ * is a superset (contact, license, termsOfService, tags, externalDocs, ...) — we can
10
+ * grow this as consumers need the extra fields.
11
+ */
12
+ export declare const AsyncApiInfoObject: import("@scalar/validation").ObjectSchema<{
13
+ title: import("@scalar/validation").StringSchema;
14
+ version: import("@scalar/validation").StringSchema;
15
+ description: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
16
+ }>;
17
+ export type AsyncApiInfoObject = {
18
+ /** REQUIRED. The title of the application. */
19
+ title: string;
20
+ /** REQUIRED. Provides the version of the application API (not the AsyncAPI Specification version). */
21
+ version: string;
22
+ /** A short description of the application. CommonMark syntax can be used for rich text representation. */
23
+ description?: string;
24
+ };
25
+ /**
26
+ * AsyncAPI-specific extensions. Store-managed metadata (source url, document
27
+ * hash, dirty flag, registry meta) is shared with the OpenAPI side via the
28
+ * dedicated extension modules so the two cannot drift apart.
29
+ *
30
+ * `x-original-aas-version` stays here because it is the AsyncAPI analog of
31
+ * `x-original-oas-version` — different field names per spec, so unified
32
+ * sharing is not a fit.
33
+ */
34
+ export declare const AsyncApiExtensions: import("@scalar/validation").ObjectSchema<{
35
+ 'x-original-aas-version': import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
36
+ }>;
37
+ export type AsyncApiExtensions = Partial<{
38
+ /** Original AsyncAPI Specification version the document was loaded with. */
39
+ 'x-original-aas-version': string;
40
+ }>;
41
+ /**
42
+ * Minimal AsyncAPI Document.
43
+ *
44
+ * MVP shape: the spec version discriminator, the minimal Info Object, and the shared
45
+ * store-managed metadata extensions. Present on the discriminated {@link WorkspaceDocument}
46
+ * union via the required `asyncapi` field.
47
+ */
48
+ export declare const AsyncApiDocument: import("@scalar/validation").IntersectionSchema<readonly [import("@scalar/validation").ObjectSchema<{
49
+ asyncapi: import("@scalar/validation").StringSchema;
50
+ info: import("@scalar/validation").ObjectSchema<{
51
+ title: import("@scalar/validation").StringSchema;
52
+ version: import("@scalar/validation").StringSchema;
53
+ description: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
54
+ }>;
55
+ }>, import("@scalar/validation").ObjectSchema<{
56
+ 'x-original-aas-version': import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
57
+ }>, import("@scalar/validation").ObjectSchema<{
58
+ 'x-scalar-original-source-url': import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
59
+ }>, import("@scalar/validation").ObjectSchema<{
60
+ 'x-scalar-original-document-hash': import("@scalar/validation").StringSchema;
61
+ }>, import("@scalar/validation").ObjectSchema<{
62
+ 'x-scalar-is-dirty': import("@scalar/validation").OptionalSchema<import("@scalar/validation").BooleanSchema>;
63
+ }>, import("@scalar/validation").ObjectSchema<{
64
+ 'x-scalar-registry-meta': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ObjectSchema<{
65
+ namespace: import("@scalar/validation").StringSchema;
66
+ slug: import("@scalar/validation").StringSchema;
67
+ version: import("@scalar/validation").StringSchema;
68
+ commitHash: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
69
+ conflictCheckedAgainstHash: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
70
+ hasConflict: import("@scalar/validation").OptionalSchema<import("@scalar/validation").BooleanSchema>;
71
+ }>>;
72
+ }>]>;
73
+ export type AsyncApiDocument = {
74
+ /** REQUIRED. The AsyncAPI Specification version the document uses (for example "3.0.0"). */
75
+ asyncapi: string;
76
+ /** REQUIRED. Provides metadata about the application. */
77
+ info: AsyncApiInfoObject;
78
+ } & AsyncApiExtensions & WorkspaceManagedExtensions & XScalarOriginalDocumentHash & XScalarIsDirty & XScalarRegistryMeta;
79
+ //# sourceMappingURL=asyncapi-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi-document.d.ts","sourceRoot":"","sources":["../../../src/schemas/asyncapi/asyncapi-document.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4DAA4D,CAAA;AACvG,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAA;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+DAA+D,CAAA;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAA;AAE1F;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;EAc9B,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAA;IACb,sGAAsG;IACtG,OAAO,EAAE,MAAM,CAAA;IACf,0GAA0G;IAC1G,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;EAO9B,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC;IACvC,4EAA4E;IAC5E,wBAAwB,EAAE,MAAM,CAAA;CACjC,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;IAuB5B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,4FAA4F;IAC5F,QAAQ,EAAE,MAAM,CAAA;IAChB,yDAAyD;IACzD,IAAI,EAAE,kBAAkB,CAAA;CACzB,GAAG,kBAAkB,GACpB,0BAA0B,GAC1B,2BAA2B,GAC3B,cAAc,GACd,mBAAmB,CAAA"}
@@ -0,0 +1,58 @@
1
+ import { intersection, object, optional, string } from '@scalar/validation';
2
+ import { WorkspaceManagedExtensions } from '../../schemas/extensions/document/workspace-managed-extensions.js';
3
+ import { XScalarIsDirty } from '../../schemas/extensions/document/x-scalar-is-dirty.js';
4
+ import { XScalarOriginalDocumentHash } from '../../schemas/extensions/document/x-scalar-original-document-hash.js';
5
+ import { XScalarRegistryMeta } from '../../schemas/extensions/document/x-scalar-registry-meta.js';
6
+ /**
7
+ * Minimal AsyncAPI Info Object.
8
+ *
9
+ * Intentionally scoped to the fields we surface in the MVP. AsyncAPI's real Info Object
10
+ * is a superset (contact, license, termsOfService, tags, externalDocs, ...) — we can
11
+ * grow this as consumers need the extra fields.
12
+ */
13
+ export const AsyncApiInfoObject = object({
14
+ title: string({ typeComment: 'REQUIRED. The title of the application.' }),
15
+ version: string({
16
+ typeComment: 'REQUIRED. Provides the version of the application API (not the AsyncAPI Specification version).',
17
+ }),
18
+ description: optional(string({
19
+ typeComment: 'A short description of the application. CommonMark syntax can be used for rich text representation.',
20
+ })),
21
+ }, { typeName: 'AsyncApiInfoObject' });
22
+ /**
23
+ * AsyncAPI-specific extensions. Store-managed metadata (source url, document
24
+ * hash, dirty flag, registry meta) is shared with the OpenAPI side via the
25
+ * dedicated extension modules so the two cannot drift apart.
26
+ *
27
+ * `x-original-aas-version` stays here because it is the AsyncAPI analog of
28
+ * `x-original-oas-version` — different field names per spec, so unified
29
+ * sharing is not a fit.
30
+ */
31
+ export const AsyncApiExtensions = object({
32
+ 'x-original-aas-version': optional(string({ typeComment: 'Original AsyncAPI Specification version the document was loaded with.' })),
33
+ }, { typeName: 'AsyncApiExtensions' });
34
+ /**
35
+ * Minimal AsyncAPI Document.
36
+ *
37
+ * MVP shape: the spec version discriminator, the minimal Info Object, and the shared
38
+ * store-managed metadata extensions. Present on the discriminated {@link WorkspaceDocument}
39
+ * union via the required `asyncapi` field.
40
+ */
41
+ export const AsyncApiDocument = intersection([
42
+ object({
43
+ asyncapi: string({
44
+ typeComment: 'REQUIRED. The AsyncAPI Specification version the document uses (for example "3.0.0").',
45
+ }),
46
+ info: AsyncApiInfoObject,
47
+ }, { typeName: 'AsyncApiDocumentCore' }),
48
+ AsyncApiExtensions,
49
+ // Shared store-managed metadata. Composed from the same extension modules
50
+ // the OpenAPI side uses so the two document shapes cannot drift apart.
51
+ WorkspaceManagedExtensions,
52
+ XScalarOriginalDocumentHash,
53
+ XScalarIsDirty,
54
+ XScalarRegistryMeta,
55
+ ], {
56
+ typeName: 'AsyncApiDocument',
57
+ typeComment: 'Root AsyncAPI document including Scalar workspace extensions.',
58
+ });
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Schema for workspace-store-managed metadata extensions that apply to every
3
+ * document type in the workspace, regardless of OpenAPI or AsyncAPI shape.
4
+ *
5
+ * Currently this is just `x-scalar-original-source-url`. The original document
6
+ * hash (`x-scalar-original-document-hash`) is intentionally kept in its own
7
+ * `XScalarOriginalDocumentHashSchema` because OpenAPI treats it as
8
+ * post-ingestion-required (so `coerce` defaults missing values to `""`),
9
+ * while AsyncAPI treats it as optional. Once that asymmetry is resolved this
10
+ * file can absorb it.
11
+ *
12
+ * Centralized here so the OpenAPI and AsyncAPI document schemas share one
13
+ * definition for the source-url field and cannot drift apart silently.
14
+ */
15
+ export declare const WorkspaceManagedExtensionsSchema: import("@scalar/typebox").TObject<{
16
+ 'x-scalar-original-source-url': import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
17
+ }>;
18
+ export type WorkspaceManagedExtensions = Partial<{
19
+ /** Original document source url — when loaded from an external source. */
20
+ 'x-scalar-original-source-url': string;
21
+ }>;
22
+ export declare const WorkspaceManagedExtensions: import("@scalar/validation").ObjectSchema<{
23
+ 'x-scalar-original-source-url': import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
24
+ }>;
25
+ //# sourceMappingURL=workspace-managed-extensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-managed-extensions.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/document/workspace-managed-extensions.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC;;EAK5C,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC;IAC/C,0EAA0E;IAC1E,8BAA8B,EAAE,MAAM,CAAA;CACvC,CAAC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;EAUtC,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { Type } from '@scalar/typebox';
2
+ import { object, optional, string } from '@scalar/validation';
3
+ /**
4
+ * Schema for workspace-store-managed metadata extensions that apply to every
5
+ * document type in the workspace, regardless of OpenAPI or AsyncAPI shape.
6
+ *
7
+ * Currently this is just `x-scalar-original-source-url`. The original document
8
+ * hash (`x-scalar-original-document-hash`) is intentionally kept in its own
9
+ * `XScalarOriginalDocumentHashSchema` because OpenAPI treats it as
10
+ * post-ingestion-required (so `coerce` defaults missing values to `""`),
11
+ * while AsyncAPI treats it as optional. Once that asymmetry is resolved this
12
+ * file can absorb it.
13
+ *
14
+ * Centralized here so the OpenAPI and AsyncAPI document schemas share one
15
+ * definition for the source-url field and cannot drift apart silently.
16
+ */
17
+ export const WorkspaceManagedExtensionsSchema = Type.Partial(Type.Object({
18
+ /** Original document source url — when loaded from an external source. */
19
+ 'x-scalar-original-source-url': Type.String(),
20
+ }));
21
+ export const WorkspaceManagedExtensions = object({
22
+ 'x-scalar-original-source-url': optional(string({ typeComment: 'Original document source url — when loaded from an external source.' })),
23
+ }, {
24
+ typeName: 'WorkspaceManagedExtensions',
25
+ typeComment: 'Workspace-store-managed metadata extensions shared by OpenAPI and AsyncAPI documents.',
26
+ });