@scalar/workspace-store 0.20.0 → 0.21.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 (174) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +2 -2
  3. package/dist/client.d.ts +40 -4
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +58 -23
  6. package/dist/client.js.map +2 -2
  7. package/dist/events/bus.d.ts +13 -1
  8. package/dist/events/bus.d.ts.map +1 -1
  9. package/dist/events/bus.js +46 -10
  10. package/dist/events/bus.js.map +3 -3
  11. package/dist/events/definitions/cookie.d.ts +20 -0
  12. package/dist/events/definitions/cookie.d.ts.map +1 -0
  13. package/dist/events/definitions/cookie.js +1 -0
  14. package/dist/events/definitions/cookie.js.map +7 -0
  15. package/dist/events/definitions/document.d.ts +8 -2
  16. package/dist/events/definitions/document.d.ts.map +1 -1
  17. package/dist/events/definitions/index.d.ts +4 -1
  18. package/dist/events/definitions/index.d.ts.map +1 -1
  19. package/dist/events/definitions/operation.d.ts +0 -13
  20. package/dist/events/definitions/operation.d.ts.map +1 -1
  21. package/dist/events/definitions/server.d.ts +2 -2
  22. package/dist/events/definitions/server.d.ts.map +1 -1
  23. package/dist/events/definitions/tabs.d.ts +40 -0
  24. package/dist/events/definitions/tabs.d.ts.map +1 -0
  25. package/dist/events/definitions/tabs.js +1 -0
  26. package/dist/events/definitions/tabs.js.map +7 -0
  27. package/dist/events/definitions/ui.d.ts +39 -4
  28. package/dist/events/definitions/ui.d.ts.map +1 -1
  29. package/dist/events/definitions/workspace.d.ts +18 -0
  30. package/dist/events/definitions/workspace.d.ts.map +1 -0
  31. package/dist/events/definitions/workspace.js +1 -0
  32. package/dist/events/definitions/workspace.js.map +7 -0
  33. package/dist/helpers/generate-unique-value.d.ts +19 -6
  34. package/dist/helpers/generate-unique-value.d.ts.map +1 -1
  35. package/dist/helpers/generate-unique-value.js +12 -7
  36. package/dist/helpers/generate-unique-value.js.map +2 -2
  37. package/dist/helpers/unpack-proxy.d.ts +14 -1
  38. package/dist/helpers/unpack-proxy.d.ts.map +1 -1
  39. package/dist/helpers/unpack-proxy.js +51 -1
  40. package/dist/helpers/unpack-proxy.js.map +3 -3
  41. package/dist/mutators/auth.d.ts +1 -1
  42. package/dist/mutators/auth.d.ts.map +1 -1
  43. package/dist/mutators/auth.js +24 -21
  44. package/dist/mutators/auth.js.map +2 -2
  45. package/dist/mutators/cookie.d.ts +21 -13
  46. package/dist/mutators/cookie.d.ts.map +1 -1
  47. package/dist/mutators/cookie.js +34 -26
  48. package/dist/mutators/cookie.js.map +3 -3
  49. package/dist/mutators/document.d.ts +9 -2
  50. package/dist/mutators/document.d.ts.map +1 -1
  51. package/dist/mutators/document.js +18 -3
  52. package/dist/mutators/document.js.map +2 -2
  53. package/dist/mutators/index.d.ts +4 -14
  54. package/dist/mutators/index.d.ts.map +1 -1
  55. package/dist/mutators/index.js +15 -9
  56. package/dist/mutators/index.js.map +2 -2
  57. package/dist/mutators/operation.d.ts +23 -101
  58. package/dist/mutators/operation.d.ts.map +1 -1
  59. package/dist/mutators/operation.js +132 -96
  60. package/dist/mutators/operation.js.map +2 -2
  61. package/dist/mutators/server.d.ts +1 -1
  62. package/dist/mutators/server.d.ts.map +1 -1
  63. package/dist/mutators/server.js +6 -5
  64. package/dist/mutators/server.js.map +2 -2
  65. package/dist/mutators/workspace.d.ts +6 -0
  66. package/dist/mutators/workspace.d.ts.map +1 -0
  67. package/dist/mutators/workspace.js +24 -0
  68. package/dist/mutators/workspace.js.map +7 -0
  69. package/dist/navigation/get-navigation-options.d.ts.map +1 -1
  70. package/dist/navigation/get-navigation-options.js +4 -4
  71. package/dist/navigation/get-navigation-options.js.map +2 -2
  72. package/dist/navigation/helpers/traverse-document.d.ts +1 -0
  73. package/dist/navigation/helpers/traverse-document.d.ts.map +1 -1
  74. package/dist/navigation/helpers/traverse-document.js +16 -2
  75. package/dist/navigation/helpers/traverse-document.js.map +2 -2
  76. package/dist/navigation/helpers/traverse-examples.js +2 -2
  77. package/dist/navigation/helpers/traverse-examples.js.map +2 -2
  78. package/dist/navigation/helpers/traverse-paths.d.ts +6 -3
  79. package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
  80. package/dist/navigation/helpers/traverse-paths.js +4 -9
  81. package/dist/navigation/helpers/traverse-paths.js.map +2 -2
  82. package/dist/navigation/helpers/traverse-tags.d.ts +0 -1
  83. package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
  84. package/dist/navigation/helpers/traverse-tags.js +57 -49
  85. package/dist/navigation/helpers/traverse-tags.js.map +3 -3
  86. package/dist/persistence/index.d.ts +6 -0
  87. package/dist/persistence/index.d.ts.map +1 -1
  88. package/dist/persistence/index.js +18 -0
  89. package/dist/persistence/index.js.map +2 -2
  90. package/dist/persistence/indexdb.d.ts +1 -0
  91. package/dist/persistence/indexdb.d.ts.map +1 -1
  92. package/dist/persistence/indexdb.js +6 -1
  93. package/dist/persistence/indexdb.js.map +2 -2
  94. package/dist/plugins/client/persistence.d.ts.map +1 -1
  95. package/dist/plugins/client/persistence.js +6 -0
  96. package/dist/plugins/client/persistence.js.map +2 -2
  97. package/dist/schemas/extensions/document/x-scalar-environments.d.ts +1 -0
  98. package/dist/schemas/extensions/document/x-scalar-environments.d.ts.map +1 -1
  99. package/dist/schemas/extensions/document/x-scalar-environments.js.map +2 -2
  100. package/dist/schemas/extensions/document/x-scalar-set-operation-security.d.ts +13 -0
  101. package/dist/schemas/extensions/document/x-scalar-set-operation-security.d.ts.map +1 -0
  102. package/dist/schemas/extensions/document/x-scalar-set-operation-security.js +8 -0
  103. package/dist/schemas/extensions/document/x-scalar-set-operation-security.js.map +7 -0
  104. package/dist/schemas/extensions/general/x-scalar-cookies.d.ts +36 -0
  105. package/dist/schemas/extensions/general/x-scalar-cookies.d.ts.map +1 -0
  106. package/dist/schemas/extensions/general/x-scalar-cookies.js +15 -0
  107. package/dist/schemas/extensions/general/x-scalar-cookies.js.map +7 -0
  108. package/dist/schemas/extensions/general/x-scalar-order.d.ts +12 -0
  109. package/dist/schemas/extensions/general/x-scalar-order.d.ts.map +1 -0
  110. package/dist/schemas/extensions/general/x-scalar-order.js +8 -0
  111. package/dist/schemas/extensions/general/x-scalar-order.js.map +7 -0
  112. package/dist/schemas/extensions/tag/x-tag-groups.d.ts +10 -5
  113. package/dist/schemas/extensions/tag/x-tag-groups.d.ts.map +1 -1
  114. package/dist/schemas/extensions/tag/x-tag-groups.js +15 -10
  115. package/dist/schemas/extensions/tag/x-tag-groups.js.map +2 -2
  116. package/dist/schemas/extensions/workspace/x-scalar-active-proxy.d.ts +18 -0
  117. package/dist/schemas/extensions/workspace/x-scalar-active-proxy.d.ts.map +1 -0
  118. package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js +8 -0
  119. package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js.map +7 -0
  120. package/dist/schemas/extensions.d.ts +1 -1
  121. package/dist/schemas/extensions.js +1 -1
  122. package/dist/schemas/extensions.js.map +2 -2
  123. package/dist/schemas/inmemory-workspace.d.ts +41 -27
  124. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  125. package/dist/schemas/navigation.d.ts +4 -1
  126. package/dist/schemas/navigation.d.ts.map +1 -1
  127. package/dist/schemas/navigation.js +2 -1
  128. package/dist/schemas/navigation.js.map +2 -2
  129. package/dist/schemas/reference-config/index.d.ts +20 -13
  130. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  131. package/dist/schemas/reference-config/settings.d.ts +20 -13
  132. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  133. package/dist/schemas/reference-config/settings.js +2 -0
  134. package/dist/schemas/reference-config/settings.js.map +2 -2
  135. package/dist/schemas/v3.1/strict/openapi-document.d.ts +685 -448
  136. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  137. package/dist/schemas/v3.1/strict/openapi-document.js +10 -10
  138. package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
  139. package/dist/schemas/v3.1/strict/operation.d.ts +1 -5
  140. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  141. package/dist/schemas/v3.1/strict/operation.js +1 -5
  142. package/dist/schemas/v3.1/strict/operation.js.map +2 -2
  143. package/dist/schemas/v3.1/strict/tag.d.ts +4 -1
  144. package/dist/schemas/v3.1/strict/tag.d.ts.map +1 -1
  145. package/dist/schemas/v3.1/strict/tag.js +3 -1
  146. package/dist/schemas/v3.1/strict/tag.js.map +2 -2
  147. package/dist/schemas/v3.1/strict/type-guards.d.ts +6 -0
  148. package/dist/schemas/v3.1/strict/type-guards.d.ts.map +1 -1
  149. package/dist/schemas/v3.1/strict/type-guards.js +4 -0
  150. package/dist/schemas/v3.1/strict/type-guards.js.map +2 -2
  151. package/dist/schemas/workspace-specification/config.d.ts +20 -13
  152. package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
  153. package/dist/schemas/workspace-specification/index.d.ts +21 -14
  154. package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
  155. package/dist/schemas/workspace.d.ts +170 -109
  156. package/dist/schemas/workspace.d.ts.map +1 -1
  157. package/dist/schemas/workspace.js +8 -6
  158. package/dist/schemas/workspace.js.map +2 -2
  159. package/dist/server.d.ts +1 -1
  160. package/dist/workspace-plugin.d.ts +3 -0
  161. package/dist/workspace-plugin.d.ts.map +1 -1
  162. package/package.json +8 -7
  163. package/dist/schemas/extensions/document/x-scalar-document-security.d.ts +0 -13
  164. package/dist/schemas/extensions/document/x-scalar-document-security.d.ts.map +0 -1
  165. package/dist/schemas/extensions/document/x-scalar-document-security.js +0 -8
  166. package/dist/schemas/extensions/document/x-scalar-document-security.js.map +0 -7
  167. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.d.ts +0 -13
  168. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.d.ts.map +0 -1
  169. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.js +0 -9
  170. package/dist/schemas/extensions/operation/x-scalar-operation-identifiers.js.map +0 -7
  171. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts +0 -32
  172. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts.map +0 -1
  173. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js +0 -13
  174. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js.map +0 -7
@@ -2,16 +2,6 @@ import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
2
  import type { OperationExampleMeta, OperationMeta } from '../../mutators/index.js';
3
3
  /** Event definitions for the operation */
4
4
  export type OperationEvents = {
5
- /**
6
- * Update the selected example for the operation
7
- */
8
- 'update:selected-example': {
9
- /** The name of the example to select */
10
- name: string;
11
- };
12
- /** ------------------------------------------------------------------------------------------------
13
- * Operation Actions
14
- * ------------------------------------------------------------------------------------------------ */
15
5
  /**
16
6
  * Fires when the user requests to send the operation (e.g., triggers "Try It" or sends a request).
17
7
  * Contains the OperationExampleMeta, which identifies the operation and the example variant to use.
@@ -19,9 +9,6 @@ export type OperationEvents = {
19
9
  'operation:send:request': {
20
10
  meta: OperationExampleMeta;
21
11
  };
22
- /** ------------------------------------------------------------------------------------------------
23
- * Operation Draft Mutators
24
- * ------------------------------------------------------------------------------------------------ */
25
12
  /**
26
13
  * Update the summary for the operation.
27
14
  * Triggers when the user edits the summary/description for an endpoint.
@@ -1 +1 @@
1
- {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAErE,0CAA0C;AAC1C,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,yBAAyB,EAAE;QACzB,wCAAwC;QACxC,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IAED;;0GAEsG;IACtG;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ACxE,OAAO,EAAE,OAAO,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;SAAE,CAAC,CAAA;QAC/D,2CAA2C;QAC3C,WAAW,EAAE,MAAM,CAAA;QACnB,wFAAwF;QACxF,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IAED;;;OAGG;IACH,sCAAsC,EAAE;QACtC,gFAAgF;QAChF,KAAK,EAAE,MAAM,CAAA;QACb,2CAA2C;QAC3C,WAAW,EAAE,MAAM,CAAA;QACnB,wFAAwF;QACxF,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;CACF,CAAA"}
1
+ {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAErE,0CAA0C;AAC1C,MAAM,MAAM,eAAe,GAAG;IAK5B;;;OAGG;IACH,wBAAwB,EAAE;QACxB,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IAMD;;;;OAIG;IACH,0BAA0B,EAAE;QAC1B,uDAAuD;QACvD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAA;SAChB,CAAA;QACD,kFAAkF;QAClF,IAAI,EAAE,aAAa,CAAA;KACpB,CAAA;IAED;;;OAGG;IACH,yBAAyB,EAAE;QACzB,OAAO,EAAE;YACP,uCAAuC;YACvC,MAAM,EAAE,UAAU,CAAA;SACnB,CAAA;QACD,kEAAkE;QAClE,IAAI,EAAE,aAAa,CAAA;KACpB,CAAA;IAED;;;;;OAKG;IACH,uBAAuB,EAAE;QACvB,OAAO,EAAE;YACP,qCAAqC;YACrC,IAAI,EAAE,MAAM,CAAA;SACb,CAAA;QACD,kEAAkE;QAClE,IAAI,EAAE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AM,CAAA;SACpB,CAAA;QACD,uFAAuF;QACvF,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IAED;;;OAGG;IACH,oCAAoC,EAAE;QACpC,OAAO,EAAE;YACP,iDAAiD;YACjD,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;SACjC,CAAA;QACD,2CAA2C;QAC3C,WAAW,EAAE,MAAM,CAAA;QACnB,6FAA6F;QAC7F,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IAED;;;OAGG;IACH,mCAAmC,EAAE;QACnC,qEAAqE;QACrE,OAAO,EAAE,OAAO,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAC,CAAA;QACvD,2CAA2C;QAC3C,WAAW,EAAE,MAAM,CAAA;QACnB,sFAAsF;QACtF,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IAED;;;OAGG;IACH,sCAAsC,EAAE;QACtC,gFAAgF;QAChF,KAAK,EAAE,MAAM,CAAA;QACb,wEAAwE;QACxE,OAAO,EAAE,OAAO,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;SAAE,CAAC,CAAA;QAC/D,2CAA2C;QAC3C,WAAW,EAAE,MAAM,CAAA;QACnB,wFAAwF;QACxF,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IAED;;;OAGG;IACH,sCAAsC,EAAE;QACtC,gFAAgF;QAChF,KAAK,EAAE,MAAM,CAAA;QACb,2CAA2C;QAC3C,WAAW,EAAE,MAAM,CAAA;QACnB,wFAAwF;QACxF,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;CACF,CAAA"}
@@ -35,8 +35,8 @@ export type ServerEvents = {
35
35
  * Update the selected server for the document
36
36
  */
37
37
  'server:update:selected': {
38
- /** The index of the server to update */
39
- index: number;
38
+ /** The URL of the server to select */
39
+ url: string;
40
40
  };
41
41
  };
42
42
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,mBAAmB,EAAE,SAAS,CAAA;IAC9B;;OAEG;IACH,sBAAsB,EAAE;QACtB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;QACb,uCAAuC;QACvC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;KAC9B,CAAA;IACD;;OAEG;IACH,sBAAsB,EAAE;QACtB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD;;OAEG;IACH,yBAAyB,EAAE;QACzB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;QACb,wCAAwC;QACxC,GAAG,EAAE,MAAM,CAAA;QACX,oCAAoC;QACpC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD;;OAEG;IACH,wBAAwB,EAAE;QACxB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,CAAA"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,mBAAmB,EAAE,SAAS,CAAA;IAC9B;;OAEG;IACH,sBAAsB,EAAE;QACtB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;QACb,uCAAuC;QACvC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;KAC9B,CAAA;IACD;;OAEG;IACH,sBAAsB,EAAE;QACtB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD;;OAEG;IACH,yBAAyB,EAAE;QACzB,wCAAwC;QACxC,KAAK,EAAE,MAAM,CAAA;QACb,wCAAwC;QACxC,GAAG,EAAE,MAAM,CAAA;QACX,oCAAoC;QACpC,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD;;OAEG;IACH,wBAAwB,EAAE;QACxB,sCAAsC;QACtC,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;CACF,CAAA"}
@@ -0,0 +1,40 @@
1
+ /** Event definitions to control the tabs */
2
+ export type TabEvents = {
3
+ /**
4
+ * Add a new tab
5
+ */
6
+ 'tabs:add:tab': {
7
+ event: KeyboardEvent;
8
+ };
9
+ /**
10
+ * Closes the current tab
11
+ */
12
+ 'tabs:close:tab': {
13
+ event: KeyboardEvent;
14
+ };
15
+ /**
16
+ * Navigates to the previous tab
17
+ */
18
+ 'tabs:navigate:previous': {
19
+ event: KeyboardEvent;
20
+ };
21
+ /**
22
+ * Navigates to the next tab
23
+ */
24
+ 'tabs:navigate:next': {
25
+ event: KeyboardEvent;
26
+ };
27
+ /**
28
+ * Jumps to a specific tab, we can grab the number from the keyboard event
29
+ */
30
+ 'tabs:focus:tab': {
31
+ event: KeyboardEvent;
32
+ };
33
+ /**
34
+ * Focuses the last tab
35
+ */
36
+ 'tabs:focus:tab-last': {
37
+ event: KeyboardEvent;
38
+ };
39
+ };
40
+ //# sourceMappingURL=tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/tabs.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,cAAc,EAAE;QACd,KAAK,EAAE,aAAa,CAAA;KACrB,CAAA;IACD;;OAEG;IACH,gBAAgB,EAAE;QAChB,KAAK,EAAE,aAAa,CAAA;KACrB,CAAA;IACD;;OAEG;IACH,wBAAwB,EAAE;QACxB,KAAK,EAAE,aAAa,CAAA;KACrB,CAAA;IACD;;OAEG;IACH,oBAAoB,EAAE;QACpB,KAAK,EAAE,aAAa,CAAA;KACrB,CAAA;IACD;;OAEG;IACH,gBAAgB,EAAE;QAChB,KAAK,EAAE,aAAa,CAAA;KACrB,CAAA;IACD;;OAEG;IACH,qBAAqB,EAAE;QACrB,KAAK,EAAE,aAAa,CAAA;KACrB,CAAA;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=tabs.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -4,23 +4,58 @@ export type UIEvents = {
4
4
  /**
5
5
  * Download the document from the store
6
6
  */
7
- 'download:document': {
7
+ 'ui:download:document': {
8
8
  /** Format to download the document in */
9
9
  format: 'json' | 'yaml' | 'direct';
10
10
  };
11
+ /**
12
+ * Focus the address bar
13
+ */
14
+ 'ui:focus:address-bar': {
15
+ event: KeyboardEvent;
16
+ };
17
+ /**
18
+ * Focus the send button
19
+ */
20
+ 'ui:focus:send-button': {
21
+ event: KeyboardEvent;
22
+ };
23
+ /**
24
+ * Focus the search
25
+ */
26
+ 'ui:focus:search': {
27
+ event: KeyboardEvent;
28
+ };
29
+ /**
30
+ * Toggle the sidebar
31
+ */
32
+ 'ui:toggle:sidebar': {
33
+ event: KeyboardEvent;
34
+ };
11
35
  /**
12
36
  * Open the Api Client modal to a specific operation
13
37
  */
14
- 'open:client': {
38
+ 'ui:open:client-modal': {
15
39
  /** The HTTP method of the operation to load */
16
40
  method: HttpMethod;
17
41
  /** The path of the operation to load */
18
42
  path: string;
43
+ /** The example name to load */
44
+ exampleName?: string;
45
+ };
46
+ /**
47
+ * Close the client modal
48
+ */
49
+ 'ui:close:client-modal': {
50
+ event: KeyboardEvent;
19
51
  };
20
52
  /**
21
- * Open our command palette
53
+ * Open the command palette
22
54
  */
23
- 'open:command-palette': 'import' | 'addServer' | 'addCollection' | 'addTag' | 'addExample' | 'addOperation' | undefined;
55
+ 'ui:open:command-palette': {
56
+ action?: 'import' | 'addServer' | 'addCollection' | 'addTag' | 'addExample' | 'addOperation' | undefined;
57
+ event?: KeyboardEvent;
58
+ } | undefined;
24
59
  /** Set a navigation item's (such as a tag or operation) expanded state */
25
60
  'toggle:nav-item': {
26
61
  /** The name of the nav item to toggle */
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,0CAA0C;AAC1C,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,mBAAmB,EAAE;QACnB,yCAAyC;QACzC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;KACnC,CAAA;IACD;;OAEG;IACH,aAAa,EAAE;QACb,+CAA+C;QAC/C,MAAM,EAAE,UAAU,CAAA;QAClB,wCAAwC;QACxC,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD;;OAEG;IACH,sBAAsB,EAClB,QAAQ,GACR,WAAW,GACX,eAAe,GACf,QAAQ,GACR,YAAY,GACZ,cAAc,GACd,SAAS,CAAA;IAEb,0EAA0E;IAC1E,iBAAiB,EAAE;QACjB,yCAAyC;QACzC,EAAE,EAAE,MAAM,CAAA;QACV,+CAA+C;QAC/C,IAAI,CAAC,EAAE,OAAO,CAAA;KACf,CAAA;IAED,yGAAyG;IACzG,iBAAiB,EAAE;QACjB,uCAAuC;QACvC,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,gEAAgE;IAChE,uBAAuB,EAAE;QACvB,kDAAkD;QAClD,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,4CAA4C;IAC5C,oBAAoB,EAAE;QACpB,0CAA0C;QAC1C,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,kEAAkE;IAClE,mBAAmB,EAAE;QAC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AC1E,iBAAiB,EAAE;QACjB,yCAAyC;QACzC,EAAE,EAAE,MAAM,CAAA;QACV,+CAA+C;QAC/C,IAAI,CAAC,EAAE,OAAO,CAAA;KACf,CAAA;IAED,yGAAyG;IACzG,iBAAiB,EAAE;QACjB,uCAAuC;QACvC,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,gEAAgE;IAChE,uBAAuB,EAAE;QACvB,kDAAkD;QAClD,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,4CAA4C;IAC5C,oBAAoB,EAAE;QACpB,0CAA0C;QAC1C,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,kEAAkE;IAClE,mBAAmB,EAAE;QACnB,wDAAwD;QACxD,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IAED,mCAAmC;IACnC,YAAY,EAAE,SAAS,CAAA;IAEvB,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,CAAA"}
@@ -0,0 +1,18 @@
1
+ import type { ThemeId } from '@scalar/themes';
2
+ import type { ColorMode } from '../../schemas/workspace.js';
3
+ /** Event definitions for the openapi document */
4
+ export type WorkspaceEvents = {
5
+ /**
6
+ * Update the active proxy
7
+ */
8
+ 'workspace:update:active-proxy': string | null;
9
+ /**
10
+ * Update the color mode of the workspace
11
+ */
12
+ 'workspace:update:color-mode': ColorMode;
13
+ /**
14
+ * Update the theme of the workspace
15
+ */
16
+ 'workspace:update:theme': ThemeId;
17
+ };
18
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,iDAAiD;AACjD,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,+BAA+B,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9C;;OAEG;IACH,6BAA6B,EAAE,SAAS,CAAA;IACxC;;OAEG;IACH,wBAAwB,EAAE,OAAO,CAAA;CAClC,CAAA"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=workspace.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -25,16 +25,29 @@ export declare function generateUniqueValue({ defaultValue,
25
25
  /** Check function to verify the uniqueness of the value */
26
26
  validation,
27
27
  /** Transformation function to transform the default value (such as into a slug) */
28
- transformation, maxRetries, }: {
28
+ transformation,
29
+ /** The maximum number of attempts to create a unique value by incrementing. */
30
+ maxRetries, }: {
29
31
  /**
30
- * Value which will be used to derive a new unique value.
32
+ * The original value to base the unique generation upon.
33
+ * Example: "workspace", which may end up producing "workspace 2", "workspace 3", etc.
31
34
  */
32
35
  defaultValue: string;
33
- /** Validate if the new generated value is unique */
36
+ /**
37
+ * Validation function that determines if a generated value is unique.
38
+ * Should return true if the value is unique; false if not.
39
+ * Can be asynchronous or synchronous.
40
+ */
34
41
  validation: (value: string) => Promise<boolean> | boolean;
35
- /** Transform the default value to get a new value which will match the schema of the value we need to derive */
42
+ /**
43
+ * Optional function to transform the default value before attempting uniqueness.
44
+ * Example: Transform "Workspace A" into "workspace-a" to follow a slug schema.
45
+ */
36
46
  transformation?: (value: string) => string;
37
- /** The maximum number of retry attempts to generate a unique value. */
47
+ /**
48
+ * The maximum number of attempts to create a unique value by incrementing.
49
+ * For example, if set to 5: "foo", "foo 1", "foo 2", "foo 3", "foo 4" will be attempted.
50
+ */
38
51
  maxRetries: number;
39
- }): string | undefined;
52
+ }): Promise<string | undefined>;
40
53
  //# sourceMappingURL=generate-unique-value.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-unique-value.d.ts","sourceRoot":"","sources":["../../src/helpers/generate-unique-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,YAAY;AACZ,2DAA2D;AAC3D,UAAU;AACV,mFAAmF;AACnF,cAAc,EACd,UAAc,GACf,EAAE;IACD;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,oDAAoD;IACpD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IACzD,gHAAgH;IAChH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAC1C,uEAAuE;IACvE,UAAU,EAAE,MAAM,CAAA;CACnB,sBAYA"}
1
+ {"version":3,"file":"generate-unique-value.d.ts","sourceRoot":"","sources":["../../src/helpers/generate-unique-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,YAAY;AACZ,2DAA2D;AAC3D,UAAU;AACV,mFAAmF;AACnF,cAAc;AACd,+EAA+E;AAC/E,UAAc,GACf,EAAE;IACD;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB;;;;OAIG;IACH,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAEzD;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAE1C;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAA;CACnB,+BAaA"}
@@ -1,38 +1,43 @@
1
- function generateUniqueValue({
1
+ async function generateUniqueValue({
2
2
  defaultValue,
3
3
  /** Check function to verify the uniqueness of the value */
4
4
  validation,
5
5
  /** Transformation function to transform the default value (such as into a slug) */
6
6
  transformation,
7
+ /** The maximum number of attempts to create a unique value by incrementing. */
7
8
  maxRetries = 5
8
9
  }) {
9
10
  const transformed = transformation?.(defaultValue) ?? defaultValue;
10
- if (validation(transformed)) {
11
+ if (await validation(transformed)) {
11
12
  return transformed;
12
13
  }
13
14
  return incrementValue({
14
15
  value: [transformed, 1],
15
16
  validation,
16
- maxRetries
17
+ maxRetries,
18
+ transformation
17
19
  });
18
20
  }
19
- function incrementValue({
21
+ async function incrementValue({
20
22
  value,
21
23
  validation,
22
24
  maxRetries,
23
- attempts = 0
25
+ attempts = 0,
26
+ transformation
24
27
  }) {
25
28
  if (attempts >= maxRetries) {
26
29
  return;
27
30
  }
28
31
  const incremented = value.join(" ");
29
- if (validation(incremented)) {
30
- return incremented;
32
+ const transformed = transformation?.(incremented) ?? incremented;
33
+ if (await validation(transformed)) {
34
+ return transformed;
31
35
  }
32
36
  return incrementValue({
33
37
  value: [value[0], value[1] + 1],
34
38
  validation,
35
39
  maxRetries,
40
+ transformation,
36
41
  attempts: attempts + 1
37
42
  });
38
43
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/helpers/generate-unique-value.ts"],
4
- "sourcesContent": ["/**\n * Generates a unique value based on a given default value and a validation function.\n *\n * The process works as follows:\n * 1. Optionally transform (e.g., slugify) the default value using a transformation function.\n * 2. Check if this value is unique by executing the provided validation function.\n * 3. If not unique, repeatedly append an incrementing integer (e.g., \"my-name 1\", \"my-name 2\", ...) and re-check uniqueness,\n * up to a maximum number of attempts (maxRetries).\n * 4. Returns the first unique value found or undefined if a unique value cannot be generated within the maximum retries.\n *\n * Example:\n * ```ts\n * // Existing names in use\n * const existing = new Set(['foo', 'foo 1', 'foo 2']);\n * const uniqueName = generateUniqueValue({\n * defaultValue: 'foo',\n * validation: (value) => !existing.has(value),\n * // transformation is optional, e.g. (val) => val.toLowerCase().replace(/[^\\w]+/g, '-'),\n * maxRetries: 10,\n * });\n * // uniqueName === 'foo 3'\n * ```\n */\nexport function generateUniqueValue({\n defaultValue,\n /** Check function to verify the uniqueness of the value */\n validation,\n /** Transformation function to transform the default value (such as into a slug) */\n transformation,\n maxRetries = 5,\n}: {\n /**\n * Value which will be used to derive a new unique value.\n */\n defaultValue: string\n /** Validate if the new generated value is unique */\n validation: (value: string) => Promise<boolean> | boolean\n /** Transform the default value to get a new value which will match the schema of the value we need to derive */\n transformation?: (value: string) => string\n /** The maximum number of retry attempts to generate a unique value. */\n maxRetries: number\n}) {\n const transformed = transformation?.(defaultValue) ?? defaultValue\n\n if (validation(transformed)) {\n return transformed\n }\n\n return incrementValue({\n value: [transformed, 1],\n validation,\n maxRetries,\n })\n}\n\n/**\n * Attempts to generate a unique value by appending and incrementing a counter to a base string.\n *\n * On each attempt, appends the next incrementing integer (e.g. \"foo 1\", \"foo 2\", etc.) to the original value,\n * and checks with the validation function whether the candidate value is unique.\n *\n * Continues until a unique value is found, or the maximum number of attempts is reached.\n *\n * Returns the first unique value found, or undefined if a unique value cannot be generated within maxRetries.\n *\n * Example:\n * ```ts\n * const existing = new Set(['bar', 'bar 1']);\n * const result = incrementValue({\n * value: ['bar', 1],\n * validation: (val) => !existing.has(val),\n * maxRetries: 5,\n * });\n * // result === \"bar 2\"\n * ```\n */\nfunction incrementValue({\n value,\n validation,\n maxRetries,\n attempts = 0,\n}: {\n value: [string, number] // [base value, next increment]\n validation: (value: string) => Promise<boolean> | boolean\n maxRetries: number\n attempts?: number\n}) {\n if (attempts >= maxRetries) {\n return\n }\n\n const incremented = value.join(' ')\n\n if (validation(incremented)) {\n return incremented\n }\n\n return incrementValue({\n value: [value[0], value[1] + 1],\n validation,\n maxRetries,\n attempts: attempts + 1,\n })\n}\n"],
5
- "mappings": "AAuBO,SAAS,oBAAoB;AAAA,EAClC;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA,aAAa;AACf,GAWG;AACD,QAAM,cAAc,iBAAiB,YAAY,KAAK;AAEtD,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,SAAO,eAAe;AAAA,IACpB,OAAO,CAAC,aAAa,CAAC;AAAA,IACtB;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAuBA,SAAS,eAAe;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAKG;AACD,MAAI,YAAY,YAAY;AAC1B;AAAA,EACF;AAEA,QAAM,cAAc,MAAM,KAAK,GAAG;AAElC,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,SAAO,eAAe;AAAA,IACpB,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC;AAAA,IAC9B;AAAA,IACA;AAAA,IACA,UAAU,WAAW;AAAA,EACvB,CAAC;AACH;",
4
+ "sourcesContent": ["/**\n * Generates a unique value based on a given default value and a validation function.\n *\n * The process works as follows:\n * 1. Optionally transform (e.g., slugify) the default value using a transformation function.\n * 2. Check if this value is unique by executing the provided validation function.\n * 3. If not unique, repeatedly append an incrementing integer (e.g., \"my-name 1\", \"my-name 2\", ...) and re-check uniqueness,\n * up to a maximum number of attempts (maxRetries).\n * 4. Returns the first unique value found or undefined if a unique value cannot be generated within the maximum retries.\n *\n * Example:\n * ```ts\n * // Existing names in use\n * const existing = new Set(['foo', 'foo 1', 'foo 2']);\n * const uniqueName = generateUniqueValue({\n * defaultValue: 'foo',\n * validation: (value) => !existing.has(value),\n * // transformation is optional, e.g. (val) => val.toLowerCase().replace(/[^\\w]+/g, '-'),\n * maxRetries: 10,\n * });\n * // uniqueName === 'foo 3'\n * ```\n */\nexport async function generateUniqueValue({\n defaultValue,\n /** Check function to verify the uniqueness of the value */\n validation,\n /** Transformation function to transform the default value (such as into a slug) */\n transformation,\n /** The maximum number of attempts to create a unique value by incrementing. */\n maxRetries = 5,\n}: {\n /**\n * The original value to base the unique generation upon.\n * Example: \"workspace\", which may end up producing \"workspace 2\", \"workspace 3\", etc.\n */\n defaultValue: string\n\n /**\n * Validation function that determines if a generated value is unique.\n * Should return true if the value is unique; false if not.\n * Can be asynchronous or synchronous.\n */\n validation: (value: string) => Promise<boolean> | boolean\n\n /**\n * Optional function to transform the default value before attempting uniqueness.\n * Example: Transform \"Workspace A\" into \"workspace-a\" to follow a slug schema.\n */\n transformation?: (value: string) => string\n\n /**\n * The maximum number of attempts to create a unique value by incrementing.\n * For example, if set to 5: \"foo\", \"foo 1\", \"foo 2\", \"foo 3\", \"foo 4\" will be attempted.\n */\n maxRetries: number\n}) {\n const transformed = transformation?.(defaultValue) ?? defaultValue\n\n if (await validation(transformed)) {\n return transformed\n }\n\n return incrementValue({\n value: [transformed, 1],\n validation,\n maxRetries,\n transformation,\n })\n}\n\n/**\n * Attempts to generate a unique value by appending and incrementing a counter to a base string.\n *\n * On each attempt, appends the next incrementing integer (e.g. \"foo 1\", \"foo 2\", etc.) to the original value,\n * and checks with the validation function whether the candidate value is unique.\n *\n * Continues until a unique value is found, or the maximum number of attempts is reached.\n *\n * Returns the first unique value found, or undefined if a unique value cannot be generated within maxRetries.\n *\n * Example:\n * ```ts\n * const existing = new Set(['bar', 'bar 1']);\n * const result = incrementValue({\n * value: ['bar', 1],\n * validation: (val) => !existing.has(val),\n * maxRetries: 5,\n * });\n * // result === \"bar 2\"\n * ```\n */\nasync function incrementValue({\n value,\n validation,\n maxRetries,\n attempts = 0,\n transformation,\n}: {\n /**\n * Tuple containing the base value and the starting increment number.\n * Example: [\"workspace\", 1] will try \"workspace 1\", \"workspace 2\", etc.\n */\n value: [string, number] // [base value, next increment]\n\n /**\n * Function to validate if the generated value is unique.\n * Should return true if the value is unique, otherwise false.\n * Supports both synchronous and asynchronous operation.\n */\n validation: (value: string) => Promise<boolean> | boolean\n\n /**\n * The maximum number of retry attempts to generate a unique value.\n * Generation will stop and return undefined if this number is exceeded.\n */\n maxRetries: number\n\n /**\n * The current attempt count.\n * Used internally for recursion; users should generally omit this field.\n */\n attempts?: number\n\n /**\n * Optional function to transform the value before passing it to validation.\n * E.g., for slugifying a value for URLs.\n */\n transformation?: (value: string) => string\n}) {\n if (attempts >= maxRetries) {\n return\n }\n\n const incremented = value.join(' ')\n const transformed = transformation?.(incremented) ?? incremented\n\n if (await validation(transformed)) {\n return transformed\n }\n\n return incrementValue({\n value: [value[0], value[1] + 1],\n validation,\n maxRetries,\n transformation,\n attempts: attempts + 1,\n })\n}\n"],
5
+ "mappings": "AAuBA,eAAsB,oBAAoB;AAAA,EACxC;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA,aAAa;AACf,GAyBG;AACD,QAAM,cAAc,iBAAiB,YAAY,KAAK;AAEtD,MAAI,MAAM,WAAW,WAAW,GAAG;AACjC,WAAO;AAAA,EACT;AAEA,SAAO,eAAe;AAAA,IACpB,OAAO,CAAC,aAAa,CAAC;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAuBA,eAAe,eAAe;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AACF,GA+BG;AACD,MAAI,YAAY,YAAY;AAC1B;AAAA,EACF;AAEA,QAAM,cAAc,MAAM,KAAK,GAAG;AAClC,QAAM,cAAc,iBAAiB,WAAW,KAAK;AAErD,MAAI,MAAM,WAAW,WAAW,GAAG;AACjC,WAAO;AAAA,EACT;AAEA,SAAO,eAAe;AAAA,IACpB,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,WAAW;AAAA,EACvB,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,19 @@
1
1
  /**
2
2
  * Unpacks special vue reactivity & override & detect-changes & magic proxy from an input object or array,
3
3
  * returning the "raw" plain object or array.
4
+ *
5
+ * This function recursively traverses the input object or array, removing any proxies
6
+ * (e.g. Vue reactivity proxies, magic proxies, override proxies, detect-changes proxies)
7
+ * to obtain and return the underlying "raw" plain object or array.
8
+ *
9
+ * The recursion is controlled by the `depth` parameter. If `depth` is `null`, unlimited depth is allowed.
10
+ * If a proxied object is detected and unwrapped at non-root level, a warning is logged.
11
+ *
12
+ * @param input - The object or array (possibly deeply nested or proxied) to recursively unwrap.
13
+ * @param depth - Optional, limits recursion depth. `null` means unlimited depth (default is 1).
14
+ * @returns - A plain object or array with all proxies removed up to the specified depth.
4
15
  */
5
- export declare const unpackProxyObject: <T>(input: T) => T;
16
+ export declare const unpackProxyObject: <T>(input: T, { depth }?: {
17
+ depth?: number | null;
18
+ }) => T;
6
19
  //# sourceMappingURL=unpack-proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unpack-proxy.d.ts","sourceRoot":"","sources":["../../src/helpers/unpack-proxy.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,CACsB,CAAA"}
1
+ {"version":3,"file":"unpack-proxy.d.ts","sourceRoot":"","sources":["../../src/helpers/unpack-proxy.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,OAAO,CAAC,EAAE,YAAe;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,KAAG,CAsE9F,CAAA"}
@@ -2,7 +2,57 @@ import { getRaw } from "@scalar/json-magic/magic-proxy";
2
2
  import { toRaw } from "vue";
3
3
  import { unpackDetectChangesProxy } from "../helpers/detect-changes-proxy.js";
4
4
  import { unpackOverridesProxy } from "../helpers/overrides-proxy.js";
5
- const unpackProxyObject = (input) => unpackDetectChangesProxy(toRaw(getRaw(unpackOverridesProxy(input))));
5
+ const unpackProxyObject = (input, { depth = 0 } = {}) => {
6
+ const dfs = (value, currentDepth = 0) => {
7
+ if (typeof value !== "object" || value === null) {
8
+ return value;
9
+ }
10
+ const raw = unpackDetectChangesProxy(toRaw(getRaw(unpackOverridesProxy(value))));
11
+ if (depth !== null && currentDepth >= depth) {
12
+ return raw;
13
+ }
14
+ if (currentDepth !== 0 && raw !== value) {
15
+ console.warn(
16
+ "%c\u26A0 Warning:%c You tried to assign a proxied object (depth: %d).\n%c\u{1F4A1} Tip:%c Pass a plain object instead \u2014 wrapping a proxy inside another proxy may cause weird bugs.\n%c\u{1F50D} Debug Info:%c The problematic value is shown below:",
17
+ // styles
18
+ "background: #fdd835; color: #000; font-weight: bold; padding: 2px 4px; border-radius: 3px;",
19
+ "color: inherit;",
20
+ currentDepth,
21
+ "color: #00bfa5; font-weight: bold;",
22
+ "color: inherit;",
23
+ "color: #03a9f4; font-weight: bold;",
24
+ "color: inherit;",
25
+ value,
26
+ input
27
+ );
28
+ console.groupCollapsed("%c\u{1F4DC} Proxy assignment trace", "color: #9c27b0; font-weight: bold;");
29
+ console.trace({ value, raw });
30
+ console.groupEnd();
31
+ }
32
+ Object.entries(raw).forEach(([key, value2]) => {
33
+ const propertyResult = dfs(value2, currentDepth + 1);
34
+ const result = Reflect.set(raw, key, propertyResult);
35
+ if (!result) {
36
+ console.warn(
37
+ '%c\u{1F6AB} Readonly Property Error:%c Failed to set property "%s" on object.\n%c\u{1F4A1} Tip:%c This property is readonly or non-configurable. You cannot unpack a readonly property \u2014 the value was not updated.\n%c\u{1F50D} Debug Info:%c Property: %s | Value: %o | Object: %o',
38
+ // styles
39
+ "background: #f44336; color: #fff; font-weight: bold; padding: 2px 4px; border-radius: 3px;",
40
+ "color: inherit;",
41
+ key,
42
+ "color: #00bfa5; font-weight: bold;",
43
+ "color: inherit;",
44
+ "color: #03a9f4; font-weight: bold;",
45
+ "color: inherit;",
46
+ key,
47
+ propertyResult,
48
+ raw
49
+ );
50
+ }
51
+ });
52
+ return raw;
53
+ };
54
+ return dfs(input);
55
+ };
6
56
  export {
7
57
  unpackProxyObject
8
58
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/helpers/unpack-proxy.ts"],
4
- "sourcesContent": ["import { getRaw } from '@scalar/json-magic/magic-proxy'\nimport { toRaw } from 'vue'\n\nimport { unpackDetectChangesProxy } from '@/helpers/detect-changes-proxy'\nimport { unpackOverridesProxy } from '@/helpers/overrides-proxy'\n\n/**\n * Unpacks special vue reactivity & override & detect-changes & magic proxy from an input object or array,\n * returning the \"raw\" plain object or array.\n */\nexport const unpackProxyObject = <T>(input: T): T =>\n unpackDetectChangesProxy(toRaw(getRaw(unpackOverridesProxy(input))))\n"],
5
- "mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,aAAa;AAEtB,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AAM9B,MAAM,oBAAoB,CAAI,UACnC,yBAAyB,MAAM,OAAO,qBAAqB,KAAK,CAAC,CAAC,CAAC;",
6
- "names": []
4
+ "sourcesContent": ["import { getRaw } from '@scalar/json-magic/magic-proxy'\nimport { toRaw } from 'vue'\n\nimport { unpackDetectChangesProxy } from '@/helpers/detect-changes-proxy'\nimport { unpackOverridesProxy } from '@/helpers/overrides-proxy'\n\n/**\n * Unpacks special vue reactivity & override & detect-changes & magic proxy from an input object or array,\n * returning the \"raw\" plain object or array.\n *\n * This function recursively traverses the input object or array, removing any proxies\n * (e.g. Vue reactivity proxies, magic proxies, override proxies, detect-changes proxies)\n * to obtain and return the underlying \"raw\" plain object or array.\n *\n * The recursion is controlled by the `depth` parameter. If `depth` is `null`, unlimited depth is allowed.\n * If a proxied object is detected and unwrapped at non-root level, a warning is logged.\n *\n * @param input - The object or array (possibly deeply nested or proxied) to recursively unwrap.\n * @param depth - Optional, limits recursion depth. `null` means unlimited depth (default is 1).\n * @returns - A plain object or array with all proxies removed up to the specified depth.\n */\nexport const unpackProxyObject = <T>(input: T, { depth = 0 }: { depth?: number | null } = {}): T => {\n // Internal DFS helper to recursively strip all known proxies (Vue, overrides, detect-changes, magic proxies)\n const dfs = (value: any, currentDepth: number = 0): any => {\n // Base case: non-objects (primitives, null) are returned as-is\n if (typeof value !== 'object' || value === null) {\n return value\n }\n\n // Compose all the proxy unwraps in order\n const raw = unpackDetectChangesProxy(toRaw(getRaw(unpackOverridesProxy(value))))\n\n // If we have reached the maximum depth, return the value (potentially still partially proxied)\n if (depth !== null && currentDepth >= depth) {\n return raw\n }\n\n // Show a warning if a nested value was a proxy (usually undesired, can cause subtle bugs)\n if (currentDepth !== 0 && raw !== value) {\n console.warn(\n '%c\u26A0 Warning:%c You tried to assign a proxied object (depth: %d).\\n' +\n '%c\uD83D\uDCA1 Tip:%c Pass a plain object instead \u2014 wrapping a proxy inside another proxy may cause weird bugs.\\n' +\n '%c\uD83D\uDD0D Debug Info:%c The problematic value is shown below:',\n // styles\n 'background: #fdd835; color: #000; font-weight: bold; padding: 2px 4px; border-radius: 3px;',\n 'color: inherit;',\n currentDepth,\n 'color: #00bfa5; font-weight: bold;',\n 'color: inherit;',\n 'color: #03a9f4; font-weight: bold;',\n 'color: inherit;',\n value,\n input,\n )\n\n // Collapsed trace group for cleaner output\n console.groupCollapsed('%c\uD83D\uDCDC Proxy assignment trace', 'color: #9c27b0; font-weight: bold;')\n console.trace({ value, raw })\n console.groupEnd()\n }\n\n // Recursively process all properties/entries to make sure we are not assigning proxies directly,\n // but are always assigning plain objects at any level.\n Object.entries(raw).forEach(([key, value]) => {\n const propertyResult = dfs(value, currentDepth + 1)\n const result = Reflect.set(raw, key, propertyResult)\n\n if (!result) {\n console.warn(\n '%c\uD83D\uDEAB Readonly Property Error:%c Failed to set property \"%s\" on object.\\n' +\n '%c\uD83D\uDCA1 Tip:%c This property is readonly or non-configurable. You cannot unpack a readonly property \u2014 the value was not updated.\\n' +\n '%c\uD83D\uDD0D Debug Info:%c Property: %s | Value: %o | Object: %o',\n // styles\n 'background: #f44336; color: #fff; font-weight: bold; padding: 2px 4px; border-radius: 3px;',\n 'color: inherit;',\n key,\n 'color: #00bfa5; font-weight: bold;',\n 'color: inherit;',\n 'color: #03a9f4; font-weight: bold;',\n 'color: inherit;',\n key,\n propertyResult,\n raw,\n )\n }\n })\n\n return raw\n }\n\n return dfs(input)\n}\n"],
5
+ "mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,aAAa;AAEtB,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AAiB9B,MAAM,oBAAoB,CAAI,OAAU,EAAE,QAAQ,EAAE,IAA+B,CAAC,MAAS;AAElG,QAAM,MAAM,CAAC,OAAY,eAAuB,MAAW;AAEzD,QAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,aAAO;AAAA,IACT;AAGA,UAAM,MAAM,yBAAyB,MAAM,OAAO,qBAAqB,KAAK,CAAC,CAAC,CAAC;AAG/E,QAAI,UAAU,QAAQ,gBAAgB,OAAO;AAC3C,aAAO;AAAA,IACT;AAGA,QAAI,iBAAiB,KAAK,QAAQ,OAAO;AACvC,cAAQ;AAAA,QACN;AAAA;AAAA,QAIA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAGA,cAAQ,eAAe,sCAA+B,oCAAoC;AAC1F,cAAQ,MAAM,EAAE,OAAO,IAAI,CAAC;AAC5B,cAAQ,SAAS;AAAA,IACnB;AAIA,WAAO,QAAQ,GAAG,EAAE,QAAQ,CAAC,CAAC,KAAKA,MAAK,MAAM;AAC5C,YAAM,iBAAiB,IAAIA,QAAO,eAAe,CAAC;AAClD,YAAM,SAAS,QAAQ,IAAI,KAAK,KAAK,cAAc;AAEnD,UAAI,CAAC,QAAQ;AACX,gBAAQ;AAAA,UACN;AAAA;AAAA,UAIA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAEA,SAAO,IAAI,KAAK;AAClB;",
6
+ "names": ["value"]
7
7
  }
@@ -39,7 +39,7 @@ export type AuthMeta = {
39
39
  * })
40
40
  * ```
41
41
  */
42
- export declare const updateSelectedSecuritySchemes: (document: WorkspaceDocument | null, { selectedRequirements, newSchemes, meta }: AuthEvents["auth:update:selected-security-schemes"]) => void;
42
+ export declare const updateSelectedSecuritySchemes: (document: WorkspaceDocument | null, { selectedRequirements, newSchemes, meta }: AuthEvents["auth:update:selected-security-schemes"]) => Promise<void>;
43
43
  /**
44
44
  * Updates a security scheme in the OpenAPI document's components object.
45
45
  * Handles updates for HTTP, API Key, and OAuth2 types, saving secret information and configuration for UI-auth flows.
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/mutators/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAI3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAGlD;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAChB;IACE,IAAI,EAAE,UAAU,CAAA;CACjB,GACD;IACE,IAAI,EAAE,WAAW,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAA;CACnB,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,iBAAiB,GAAG,IAAI,EAClC,4CAA4C,UAAU,CAAC,uCAAuC,CAAC,SA6EhG,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,iBAAiB,GAAG,IAAI,EAClC,mBAAmB,UAAU,CAAC,6BAA6B,CAAC,mRAc7D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAU,iBAAiB,GAAG,IAAI,EAClC,iBAAiB,UAAU,CAAC,0BAA0B,CAAC,SA+BxD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,oBAAoB,GAC/B,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AClC,4BAA4B,UAAU,CAAC,6BAA6B,CAAC,SAqCtE,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,iBAAiB,GAAG,IAAI,EAClC,WAAW,UAAU,CAAC,6BAA6B,CAAC,SA6DrD,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { generateUniqueValue } from "../helpers/generate-unique-value.js";
2
2
  import { getResolvedRef } from "../helpers/get-resolved-ref.js";
3
3
  import { mergeObjects } from "../helpers/merge-object.js";
4
- const updateSelectedSecuritySchemes = (document, { selectedRequirements, newSchemes, meta }) => {
4
+ const updateSelectedSecuritySchemes = async (document, { selectedRequirements, newSchemes, meta }) => {
5
5
  if (!document) {
6
6
  return;
7
7
  }
@@ -11,26 +11,29 @@ const updateSelectedSecuritySchemes = (document, { selectedRequirements, newSche
11
11
  }
12
12
  return getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
13
13
  };
14
- const createdSchemes = newSchemes.map((scheme) => {
15
- const name = generateUniqueValue({
16
- defaultValue: scheme.name,
17
- validation: (value) => !document.components?.securitySchemes?.[value],
18
- maxRetries: 100
19
- });
20
- if (!name) {
21
- return;
22
- }
23
- if (!document.components) {
24
- document.components = {};
25
- }
26
- if (!document.components.securitySchemes) {
27
- document.components.securitySchemes = {};
28
- }
29
- document.components.securitySchemes[name] = scheme.scheme;
30
- return {
31
- [name]: []
32
- };
33
- }).filter(Boolean);
14
+ const createdSecurityRequirements = await Promise.all(
15
+ newSchemes.map(async (newScheme) => {
16
+ const uniqueSchemeName = await generateUniqueValue({
17
+ defaultValue: newScheme.name,
18
+ validation: (value) => !document.components?.securitySchemes?.[value],
19
+ maxRetries: 100
20
+ });
21
+ if (!uniqueSchemeName) {
22
+ return;
23
+ }
24
+ if (!document.components) {
25
+ document.components = {};
26
+ }
27
+ if (!document.components.securitySchemes) {
28
+ document.components.securitySchemes = {};
29
+ }
30
+ document.components.securitySchemes[uniqueSchemeName] = newScheme.scheme;
31
+ return {
32
+ [uniqueSchemeName]: []
33
+ };
34
+ })
35
+ );
36
+ const createdSchemes = createdSecurityRequirements.filter(Boolean);
34
37
  const target = getTarget();
35
38
  const newSelectedSecuritySchemes = [...selectedRequirements, ...createdSchemes];
36
39
  if (!target) {