@scalar/api-reference 1.41.1 → 1.43.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 (202) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/dist/blocks/index.d.ts +0 -1
  3. package/dist/blocks/index.d.ts.map +1 -1
  4. package/dist/blocks/index.js +4 -6
  5. package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts +4 -1
  6. package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts.map +1 -1
  7. package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.js +1 -1
  8. package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue2.js +9 -13
  9. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.d.ts +4 -1
  10. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.d.ts.map +1 -1
  11. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.js +1 -1
  12. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue2.js +10 -9
  13. package/dist/blocks/scalar-info-block/components/DownloadLink.vue.d.ts +4 -0
  14. package/dist/blocks/scalar-info-block/components/DownloadLink.vue.d.ts.map +1 -1
  15. package/dist/blocks/scalar-info-block/components/DownloadLink.vue.js +1 -1
  16. package/dist/blocks/scalar-info-block/components/DownloadLink.vue2.js +4 -7
  17. package/dist/blocks/scalar-info-block/components/InfoBlock.vue.d.ts +7 -9
  18. package/dist/blocks/scalar-info-block/components/InfoBlock.vue.d.ts.map +1 -1
  19. package/dist/blocks/scalar-info-block/components/InfoBlock.vue.js +9 -6
  20. package/dist/blocks/scalar-server-selector-block/components/Selector.vue.d.ts +2 -9
  21. package/dist/blocks/scalar-server-selector-block/components/Selector.vue.d.ts.map +1 -1
  22. package/dist/blocks/scalar-server-selector-block/components/Selector.vue.js +13 -25
  23. package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.d.ts +8 -4
  24. package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.d.ts.map +1 -1
  25. package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.js +18 -41
  26. package/dist/browser/standalone.js +20335 -23246
  27. package/dist/browser/webpack-stats.json +1 -1
  28. package/dist/components/ApiReference.vue.d.ts +2 -254
  29. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  30. package/dist/components/ApiReference.vue.js +1 -1
  31. package/dist/components/ApiReference.vue2.js +71 -83
  32. package/dist/components/Content/Auth/Auth.vue.d.ts +17 -0
  33. package/dist/components/Content/Auth/Auth.vue.d.ts.map +1 -0
  34. package/dist/components/Content/Auth/Auth.vue.js +70 -0
  35. package/dist/components/Content/Auth/Auth.vue2.js +4 -0
  36. package/dist/components/Content/Auth/helpers/get-default-security.d.ts +18 -0
  37. package/dist/components/Content/Auth/helpers/get-default-security.d.ts.map +1 -0
  38. package/dist/components/Content/Auth/helpers/get-default-security.js +43 -0
  39. package/dist/components/Content/Auth/index.d.ts +2 -0
  40. package/dist/components/Content/Auth/index.d.ts.map +1 -0
  41. package/dist/components/Content/Content.vue.d.ts +9 -19
  42. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  43. package/dist/components/Content/Content.vue.js +46 -47
  44. package/dist/components/Content/Models/Model.vue.d.ts +3 -6
  45. package/dist/components/Content/Models/Model.vue.d.ts.map +1 -1
  46. package/dist/components/Content/Models/Model.vue.js +2 -2
  47. package/dist/components/Content/Models/ModelTag.vue.d.ts +2 -7
  48. package/dist/components/Content/Models/ModelTag.vue.d.ts.map +1 -1
  49. package/dist/components/Content/Models/ModelTag.vue.js +3 -3
  50. package/dist/components/Content/Models/components/ClassicLayout.vue.d.ts +3 -5
  51. package/dist/components/Content/Models/components/ClassicLayout.vue.d.ts.map +1 -1
  52. package/dist/components/Content/Models/components/ClassicLayout.vue.js +1 -1
  53. package/dist/components/Content/Models/components/ClassicLayout.vue2.js +2 -8
  54. package/dist/components/Content/Models/components/ModernLayout.vue.d.ts +1 -1
  55. package/dist/components/Content/Models/components/ModernLayout.vue.d.ts.map +1 -1
  56. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +20 -25
  57. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
  58. package/dist/components/Content/Operations/TraversedEntry.vue.js +38 -56
  59. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +1 -1
  60. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  61. package/dist/components/Content/index.d.ts +0 -1
  62. package/dist/components/Content/index.d.ts.map +1 -1
  63. package/dist/components/ShowMoreButton.vue.d.ts +1 -4
  64. package/dist/components/ShowMoreButton.vue.d.ts.map +1 -1
  65. package/dist/components/ShowMoreButton.vue.js +1 -1
  66. package/dist/components/ShowMoreButton.vue2.js +7 -17
  67. package/dist/components/index.d.ts +1 -1
  68. package/dist/components/index.d.ts.map +1 -1
  69. package/dist/components/index.js +12 -14
  70. package/dist/features/Operation/Operation.vue.d.ts +23 -25
  71. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  72. package/dist/features/Operation/Operation.vue.js +28 -19
  73. package/dist/features/Operation/components/OperationParameters.vue.d.ts +2 -4
  74. package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
  75. package/dist/features/Operation/components/OperationParameters.vue.js +17 -6
  76. package/dist/features/Operation/components/OperationResponses.vue.d.ts +3 -5
  77. package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
  78. package/dist/features/Operation/components/OperationResponses.vue.js +3 -1
  79. package/dist/features/Operation/components/ParameterList.vue.d.ts +3 -6
  80. package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
  81. package/dist/features/Operation/components/ParameterList.vue.js +6 -8
  82. package/dist/features/Operation/components/ParameterListItem.vue.d.ts +3 -6
  83. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  84. package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
  85. package/dist/features/Operation/components/ParameterListItem.vue2.js +6 -8
  86. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +2 -4
  87. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
  88. package/dist/features/Operation/components/callbacks/Callback.vue.js +1 -1
  89. package/dist/features/Operation/components/callbacks/Callback.vue2.js +1 -5
  90. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +2 -8
  91. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
  92. package/dist/features/Operation/components/callbacks/Callbacks.vue.js +35 -24
  93. package/dist/features/Operation/helpers/filter-selected-security.d.ts +9 -0
  94. package/dist/features/Operation/helpers/filter-selected-security.d.ts.map +1 -0
  95. package/dist/features/Operation/helpers/filter-selected-security.js +27 -0
  96. package/dist/features/Operation/helpers/get-first-server.d.ts +1 -1
  97. package/dist/features/Operation/helpers/get-first-server.d.ts.map +1 -1
  98. package/dist/features/Operation/helpers/get-first-server.js +3 -3
  99. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +7 -23
  100. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  101. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  102. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +24 -23
  103. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +7 -23
  104. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  105. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  106. package/dist/features/Operation/layouts/ModernLayout.vue2.js +25 -27
  107. package/dist/features/example-responses/ExampleResponse.vue.d.ts.map +1 -1
  108. package/dist/features/example-responses/ExampleResponse.vue.js +1 -1
  109. package/dist/features/example-responses/ExampleResponse.vue2.js +1 -2
  110. package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
  111. package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
  112. package/dist/features/example-responses/ExampleResponses.vue2.js +1 -2
  113. package/dist/features/test-request-button/TestRequestButton.vue.d.ts +3 -0
  114. package/dist/features/test-request-button/TestRequestButton.vue.d.ts.map +1 -1
  115. package/dist/features/test-request-button/TestRequestButton.vue.js +1 -1
  116. package/dist/features/test-request-button/TestRequestButton.vue2.js +5 -9
  117. package/dist/helpers/index.d.ts +0 -4
  118. package/dist/helpers/index.d.ts.map +1 -1
  119. package/dist/helpers/index.js +1 -9
  120. package/dist/helpers/map-config-plugins.d.ts +5 -0
  121. package/dist/helpers/map-config-plugins.d.ts.map +1 -0
  122. package/dist/helpers/map-config-plugins.js +29 -0
  123. package/dist/helpers/map-config-to-workspace-store.d.ts.map +1 -1
  124. package/dist/helpers/map-config-to-workspace-store.js +5 -0
  125. package/dist/helpers/map-configuration.d.ts +2 -2
  126. package/dist/helpers/storage.d.ts +347 -0
  127. package/dist/helpers/storage.d.ts.map +1 -0
  128. package/dist/helpers/storage.js +61 -0
  129. package/dist/hooks/index.d.ts +0 -2
  130. package/dist/hooks/index.d.ts.map +1 -1
  131. package/dist/hooks/index.js +1 -5
  132. package/dist/index.d.ts +0 -1
  133. package/dist/index.d.ts.map +1 -1
  134. package/dist/index.js +1 -3
  135. package/dist/plugins/persistance-plugin.d.ts +16 -0
  136. package/dist/plugins/persistance-plugin.d.ts.map +1 -0
  137. package/dist/plugins/persistance-plugin.js +54 -0
  138. package/dist/style.css +220 -542
  139. package/package.json +17 -17
  140. package/dist/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +0 -11
  141. package/dist/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +0 -1
  142. package/dist/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +0 -7
  143. package/dist/blocks/scalar-auth-selector-block/components/AuthSelector.vue2.js +0 -259
  144. package/dist/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts +0 -21
  145. package/dist/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +0 -1
  146. package/dist/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js +0 -66
  147. package/dist/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue2.js +0 -4
  148. package/dist/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +0 -17
  149. package/dist/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +0 -1
  150. package/dist/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +0 -273
  151. package/dist/blocks/scalar-auth-selector-block/components/OAuth2.vue2.js +0 -4
  152. package/dist/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +0 -9
  153. package/dist/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +0 -1
  154. package/dist/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js +0 -150
  155. package/dist/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue2.js +0 -4
  156. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +0 -20
  157. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +0 -1
  158. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +0 -7
  159. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue2.js +0 -116
  160. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts +0 -50
  161. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts.map +0 -1
  162. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.js +0 -55
  163. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue2.js +0 -4
  164. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +0 -17
  165. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +0 -1
  166. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +0 -288
  167. package/dist/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue2.js +0 -4
  168. package/dist/blocks/scalar-auth-selector-block/helpers/filter-security-requirements.d.ts +0 -6
  169. package/dist/blocks/scalar-auth-selector-block/helpers/filter-security-requirements.d.ts.map +0 -1
  170. package/dist/blocks/scalar-auth-selector-block/helpers/update-scheme.d.ts +0 -8
  171. package/dist/blocks/scalar-auth-selector-block/helpers/update-scheme.d.ts.map +0 -1
  172. package/dist/blocks/scalar-auth-selector-block/helpers/update-scheme.js +0 -26
  173. package/dist/blocks/scalar-auth-selector-block/index.d.ts +0 -2
  174. package/dist/blocks/scalar-auth-selector-block/index.d.ts.map +0 -1
  175. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts +0 -16
  176. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts.map +0 -1
  177. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.js +0 -7
  178. package/dist/components/Content/ClientLibraries/ClientLibraries.vue2.js +0 -142
  179. package/dist/components/Content/ClientLibraries/ClientSelector.vue.d.ts +0 -13
  180. package/dist/components/Content/ClientLibraries/ClientSelector.vue.d.ts.map +0 -1
  181. package/dist/components/Content/ClientLibraries/ClientSelector.vue.js +0 -7
  182. package/dist/components/Content/ClientLibraries/ClientSelector.vue2.js +0 -125
  183. package/dist/components/Content/ClientLibraries/featured-clients.d.ts +0 -11
  184. package/dist/components/Content/ClientLibraries/featured-clients.d.ts.map +0 -1
  185. package/dist/components/Content/ClientLibraries/featured-clients.js +0 -24
  186. package/dist/components/Content/ClientLibraries/index.d.ts +0 -2
  187. package/dist/components/Content/ClientLibraries/index.d.ts.map +0 -1
  188. package/dist/features/example-responses/helpers/get-resolved-ref-deep.d.ts +0 -26
  189. package/dist/features/example-responses/helpers/get-resolved-ref-deep.d.ts.map +0 -1
  190. package/dist/features/example-responses/helpers/get-resolved-ref-deep.js +0 -39
  191. package/dist/helpers/convert-security-scheme.d.ts +0 -9
  192. package/dist/helpers/convert-security-scheme.d.ts.map +0 -1
  193. package/dist/helpers/convert-security-scheme.js +0 -34
  194. package/dist/helpers/map-config-to-client-store.d.ts +0 -72
  195. package/dist/helpers/map-config-to-client-store.d.ts.map +0 -1
  196. package/dist/helpers/map-config-to-client-store.js +0 -146
  197. package/dist/hooks/use-legacy-store-events.d.ts +0 -14
  198. package/dist/hooks/use-legacy-store-events.d.ts.map +0 -1
  199. package/dist/hooks/use-legacy-store-events.js +0 -91
  200. package/dist/hooks/use-workspace-store-events.d.ts +0 -4
  201. package/dist/hooks/use-workspace-store-events.d.ts.map +0 -1
  202. package/dist/hooks/use-workspace-store-events.js +0 -68
@@ -0,0 +1,347 @@
1
+ import { type XScalarSelectedSecurity } from '@scalar/workspace-store/schemas/extensions/security/x-scalar-selected-security';
2
+ import { type SecuritySchemes } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ /**
4
+ * Provides an interface to store and retrieve the selected client value
5
+ * in local storage.
6
+ */
7
+ export declare const clientStorage: () => {
8
+ /**
9
+ * Gets the stored selected client from local storage.
10
+ */
11
+ get: () => string | null;
12
+ /**
13
+ * Stores the selected client value in local storage.
14
+ * @param value The value to store
15
+ */
16
+ set: (value: string) => void;
17
+ };
18
+ /**
19
+ * Provides an interface to store and retrieve authentication scheme
20
+ * information in local storage, including both the available schemes and
21
+ * the user's selected schemes.
22
+ */
23
+ export declare const authStorage: () => {
24
+ /**
25
+ * Retrieves and coerces the authentication schemes stored in local storage.
26
+ */
27
+ getSchemas: () => {
28
+ [x: string]: ({
29
+ description?: string | undefined;
30
+ } & {
31
+ 'x-scalar-secret-token': string;
32
+ } & {
33
+ type: "apiKey";
34
+ name: string;
35
+ in: "header" | "query" | "cookie";
36
+ }) | ({
37
+ description?: string | undefined;
38
+ } & {
39
+ 'x-scalar-secret-token': string;
40
+ } & {
41
+ 'x-scalar-secret-username': string;
42
+ 'x-scalar-secret-password': string;
43
+ } & {
44
+ bearerFormat?: string | undefined;
45
+ type: "http";
46
+ scheme: "basic" | "bearer";
47
+ }) | ({
48
+ description?: string | undefined;
49
+ } & {
50
+ type: "oauth2";
51
+ flows: {
52
+ password?: ({
53
+ refreshUrl: string;
54
+ scopes: {
55
+ [x: string]: string;
56
+ };
57
+ } & {
58
+ 'x-scalar-secret-client-id': string;
59
+ } & {
60
+ 'x-scalar-secret-token': string;
61
+ } & {
62
+ 'x-scalar-security-query'?: {
63
+ [x: string]: string;
64
+ } | undefined;
65
+ } & {
66
+ 'x-scalar-security-body'?: {
67
+ [x: string]: string;
68
+ } | undefined;
69
+ } & {
70
+ 'x-tokenName'?: string | undefined;
71
+ } & {
72
+ 'x-scalar-credentials-location'?: "body" | "header" | undefined;
73
+ } & {
74
+ tokenUrl: string;
75
+ } & {
76
+ 'x-scalar-secret-username': string;
77
+ 'x-scalar-secret-password': string;
78
+ } & {
79
+ 'x-scalar-secret-client-secret': string;
80
+ }) | undefined;
81
+ implicit?: ({
82
+ refreshUrl: string;
83
+ scopes: {
84
+ [x: string]: string;
85
+ };
86
+ } & {
87
+ 'x-scalar-secret-client-id': string;
88
+ } & {
89
+ 'x-scalar-secret-token': string;
90
+ } & {
91
+ 'x-scalar-security-query'?: {
92
+ [x: string]: string;
93
+ } | undefined;
94
+ } & {
95
+ 'x-scalar-security-body'?: {
96
+ [x: string]: string;
97
+ } | undefined;
98
+ } & {
99
+ 'x-tokenName'?: string | undefined;
100
+ } & {
101
+ 'x-scalar-credentials-location'?: "body" | "header" | undefined;
102
+ } & {
103
+ authorizationUrl: string;
104
+ } & {
105
+ 'x-scalar-secret-redirect-uri': string;
106
+ }) | undefined;
107
+ clientCredentials?: ({
108
+ refreshUrl: string;
109
+ scopes: {
110
+ [x: string]: string;
111
+ };
112
+ } & {
113
+ 'x-scalar-secret-client-id': string;
114
+ } & {
115
+ 'x-scalar-secret-token': string;
116
+ } & {
117
+ 'x-scalar-security-query'?: {
118
+ [x: string]: string;
119
+ } | undefined;
120
+ } & {
121
+ 'x-scalar-security-body'?: {
122
+ [x: string]: string;
123
+ } | undefined;
124
+ } & {
125
+ 'x-tokenName'?: string | undefined;
126
+ } & {
127
+ 'x-scalar-credentials-location'?: "body" | "header" | undefined;
128
+ } & {
129
+ tokenUrl: string;
130
+ } & {
131
+ 'x-scalar-secret-client-secret': string;
132
+ }) | undefined;
133
+ authorizationCode?: ({
134
+ refreshUrl: string;
135
+ scopes: {
136
+ [x: string]: string;
137
+ };
138
+ } & {
139
+ 'x-scalar-secret-client-id': string;
140
+ } & {
141
+ 'x-scalar-secret-token': string;
142
+ } & {
143
+ 'x-scalar-security-query'?: {
144
+ [x: string]: string;
145
+ } | undefined;
146
+ } & {
147
+ 'x-scalar-security-body'?: {
148
+ [x: string]: string;
149
+ } | undefined;
150
+ } & {
151
+ 'x-tokenName'?: string | undefined;
152
+ } & {
153
+ 'x-scalar-credentials-location'?: "body" | "header" | undefined;
154
+ } & {
155
+ authorizationUrl: string;
156
+ tokenUrl: string;
157
+ } & {
158
+ 'x-scalar-secret-client-secret': string;
159
+ } & {
160
+ 'x-scalar-secret-redirect-uri': string;
161
+ } & {
162
+ 'x-usePkce': "SHA-256" | "plain" | "no";
163
+ }) | undefined;
164
+ };
165
+ } & {
166
+ 'x-default-scopes'?: string[] | undefined;
167
+ }) | ({
168
+ description?: string | undefined;
169
+ } & {
170
+ type: "openIdConnect";
171
+ openIdConnectUrl: string;
172
+ }) | ({
173
+ summary?: string | undefined;
174
+ description?: string | undefined;
175
+ $ref: string;
176
+ } & {
177
+ $status?: "loading" | "error" | undefined;
178
+ $global?: boolean | undefined;
179
+ } & {
180
+ '$ref-value': ({
181
+ description?: string | undefined;
182
+ } & {
183
+ 'x-scalar-secret-token': string;
184
+ } & {
185
+ type: "apiKey";
186
+ name: string;
187
+ in: "header" | "query" | "cookie";
188
+ }) | ({
189
+ description?: string | undefined;
190
+ } & {
191
+ 'x-scalar-secret-token': string;
192
+ } & {
193
+ 'x-scalar-secret-username': string;
194
+ 'x-scalar-secret-password': string;
195
+ } & {
196
+ bearerFormat?: string | undefined;
197
+ type: "http";
198
+ scheme: "basic" | "bearer";
199
+ }) | ({
200
+ description?: string | undefined;
201
+ } & {
202
+ type: "oauth2";
203
+ flows: {
204
+ password?: ({
205
+ refreshUrl: string;
206
+ scopes: {
207
+ [x: string]: string;
208
+ };
209
+ } & {
210
+ 'x-scalar-secret-client-id': string;
211
+ } & {
212
+ 'x-scalar-secret-token': string;
213
+ } & {
214
+ 'x-scalar-security-query'?: {
215
+ [x: string]: string;
216
+ } | undefined;
217
+ } & {
218
+ 'x-scalar-security-body'?: {
219
+ [x: string]: string;
220
+ } | undefined;
221
+ } & {
222
+ 'x-tokenName'?: string | undefined;
223
+ } & {
224
+ 'x-scalar-credentials-location'?: "body" | "header" | undefined;
225
+ } & {
226
+ tokenUrl: string;
227
+ } & {
228
+ 'x-scalar-secret-username': string;
229
+ 'x-scalar-secret-password': string;
230
+ } & {
231
+ 'x-scalar-secret-client-secret': string;
232
+ }) | undefined;
233
+ implicit?: ({
234
+ refreshUrl: string;
235
+ scopes: {
236
+ [x: string]: string;
237
+ };
238
+ } & {
239
+ 'x-scalar-secret-client-id': string;
240
+ } & {
241
+ 'x-scalar-secret-token': string;
242
+ } & {
243
+ 'x-scalar-security-query'?: {
244
+ [x: string]: string;
245
+ } | undefined;
246
+ } & {
247
+ 'x-scalar-security-body'?: {
248
+ [x: string]: string;
249
+ } | undefined;
250
+ } & {
251
+ 'x-tokenName'?: string | undefined;
252
+ } & {
253
+ 'x-scalar-credentials-location'?: "body" | "header" | undefined;
254
+ } & {
255
+ authorizationUrl: string;
256
+ } & {
257
+ 'x-scalar-secret-redirect-uri': string;
258
+ }) | undefined;
259
+ clientCredentials?: ({
260
+ refreshUrl: string;
261
+ scopes: {
262
+ [x: string]: string;
263
+ };
264
+ } & {
265
+ 'x-scalar-secret-client-id': string;
266
+ } & {
267
+ 'x-scalar-secret-token': string;
268
+ } & {
269
+ 'x-scalar-security-query'?: {
270
+ [x: string]: string;
271
+ } | undefined;
272
+ } & {
273
+ 'x-scalar-security-body'?: {
274
+ [x: string]: string;
275
+ } | undefined;
276
+ } & {
277
+ 'x-tokenName'?: string | undefined;
278
+ } & {
279
+ 'x-scalar-credentials-location'?: "body" | "header" | undefined;
280
+ } & {
281
+ tokenUrl: string;
282
+ } & {
283
+ 'x-scalar-secret-client-secret': string;
284
+ }) | undefined;
285
+ authorizationCode?: ({
286
+ refreshUrl: string;
287
+ scopes: {
288
+ [x: string]: string;
289
+ };
290
+ } & {
291
+ 'x-scalar-secret-client-id': string;
292
+ } & {
293
+ 'x-scalar-secret-token': string;
294
+ } & {
295
+ 'x-scalar-security-query'?: {
296
+ [x: string]: string;
297
+ } | undefined;
298
+ } & {
299
+ 'x-scalar-security-body'?: {
300
+ [x: string]: string;
301
+ } | undefined;
302
+ } & {
303
+ 'x-tokenName'?: string | undefined;
304
+ } & {
305
+ 'x-scalar-credentials-location'?: "body" | "header" | undefined;
306
+ } & {
307
+ authorizationUrl: string;
308
+ tokenUrl: string;
309
+ } & {
310
+ 'x-scalar-secret-client-secret': string;
311
+ } & {
312
+ 'x-scalar-secret-redirect-uri': string;
313
+ } & {
314
+ 'x-usePkce': "SHA-256" | "plain" | "no";
315
+ }) | undefined;
316
+ };
317
+ } & {
318
+ 'x-default-scopes'?: string[] | undefined;
319
+ }) | ({
320
+ description?: string | undefined;
321
+ } & {
322
+ type: "openIdConnect";
323
+ openIdConnectUrl: string;
324
+ });
325
+ });
326
+ };
327
+ /**
328
+ * Stores the authentication schemes in local storage.
329
+ * @param value The SecuritySchemes object to stringify and store.
330
+ */
331
+ setSchemas: (prefix: string, value: SecuritySchemes) => void;
332
+ /**
333
+ * Retrieves and coerces the selected authentication schemes stored in local storage.
334
+ */
335
+ getSelectedSchemes: () => {
336
+ 'x-scalar-selected-security'?: {
337
+ selectedIndex: number;
338
+ selectedSchemes: unknown[];
339
+ } | undefined;
340
+ };
341
+ /**
342
+ * Stores the user's selected authentication schemes in local storage.
343
+ * @param value The XScalarSelectedSecurity object to stringify and store.
344
+ */
345
+ setSelectedSchemes: (prefix: string, value: XScalarSelectedSecurity) => void;
346
+ };
347
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/helpers/storage.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,gFAAgF,CAAA;AAEvF,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,8DAA8D,CAAA;AAKrE;;;GAGG;AACH,eAAO,MAAM,aAAa;IAGtB;;OAEG;;IAIH;;;OAGG;iBACU,MAAM;CAItB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW;IAIpB;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKH;;;OAGG;yBACkB,MAAM,SAAS,eAAe;IAGnD;;OAEG;;;;;;;IAKH;;;OAGG;iCAC0B,MAAM,SAAS,uBAAuB;CAItE,CAAA"}
@@ -0,0 +1,61 @@
1
+ import { REFERENCE_LS_KEYS, safeLocalStorage } from "@scalar/helpers/object/local-storage";
2
+ import { XScalarSelectedSecuritySchema } from "@scalar/workspace-store/schemas/extensions/security/x-scalar-selected-security";
3
+ import { coerceValue } from "@scalar/workspace-store/schemas/typebox-coerce";
4
+ import { SecuritySchemesSchema } from "@scalar/workspace-store/schemas/v3.1/strict/openapi-document";
5
+ const storage = safeLocalStorage();
6
+ const clientStorage = () => {
7
+ const key = REFERENCE_LS_KEYS.SELECTED_CLIENT;
8
+ return {
9
+ /**
10
+ * Gets the stored selected client from local storage.
11
+ */
12
+ get: () => {
13
+ return storage.getItem(key);
14
+ },
15
+ /**
16
+ * Stores the selected client value in local storage.
17
+ * @param value The value to store
18
+ */
19
+ set: (value) => {
20
+ storage.setItem(key, value);
21
+ }
22
+ };
23
+ };
24
+ const authStorage = () => {
25
+ const schemasKey = REFERENCE_LS_KEYS.AUTH_SCHEMES;
26
+ const selectedSchemesKey = REFERENCE_LS_KEYS.SELECTED_AUTH_SCHEMES;
27
+ return {
28
+ /**
29
+ * Retrieves and coerces the authentication schemes stored in local storage.
30
+ */
31
+ getSchemas: () => {
32
+ const parsed = JSON.parse(storage.getItem(schemasKey) ?? "{}");
33
+ return coerceValue(SecuritySchemesSchema, parsed);
34
+ },
35
+ /**
36
+ * Stores the authentication schemes in local storage.
37
+ * @param value The SecuritySchemes object to stringify and store.
38
+ */
39
+ setSchemas: (prefix, value) => {
40
+ storage.setItem(`${prefix}-schemasKey`, JSON.stringify(value));
41
+ },
42
+ /**
43
+ * Retrieves and coerces the selected authentication schemes stored in local storage.
44
+ */
45
+ getSelectedSchemes: () => {
46
+ const parsed = JSON.parse(storage.getItem(selectedSchemesKey) ?? "{}");
47
+ return coerceValue(XScalarSelectedSecuritySchema, parsed);
48
+ },
49
+ /**
50
+ * Stores the user's selected authentication schemes in local storage.
51
+ * @param value The XScalarSelectedSecurity object to stringify and store.
52
+ */
53
+ setSelectedSchemes: (prefix, value) => {
54
+ storage.setItem(`${prefix}-selectedSchemesKey`, JSON.stringify(value));
55
+ }
56
+ };
57
+ };
58
+ export {
59
+ authStorage,
60
+ clientStorage
61
+ };
@@ -1,4 +1,2 @@
1
1
  export { useIntersection } from './use-intersection.js';
2
- export { useLegacyStoreEvents } from './use-legacy-store-events.js';
3
- export { useWorkspaceStoreEvents } from './use-workspace-store-events.js';
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA"}
@@ -1,8 +1,4 @@
1
1
  import { useIntersection } from "./use-intersection.js";
2
- import { useLegacyStoreEvents } from "./use-legacy-store-events.js";
3
- import { useWorkspaceStoreEvents } from "./use-workspace-store-events.js";
4
2
  export {
5
- useIntersection,
6
- useLegacyStoreEvents,
7
- useWorkspaceStoreEvents
3
+ useIntersection
8
4
  };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,6 @@ export { default as ApiReference } from './components/ApiReference.vue.js';
4
4
  export { default as GettingStarted } from './components/GettingStarted.vue.js';
5
5
  export { SearchButton, SearchModal } from './features/Search';
6
6
  export { createEmptySpecification } from './helpers/openapi.js';
7
- export { useWorkspaceStoreEvents } from './hooks/use-workspace-store-events.js';
8
7
  export { createApiReference } from './standalone/lib/html-api.js';
9
8
  export type ReferenceProps = {
10
9
  configuration?: AnyApiReferenceConfiguration;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAE/E,YAAY,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAE5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,4BAA4B,CAAA;CAC7C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAE/E,YAAY,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,4BAA4B,CAAA;CAC7C,CAAA"}
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { default as default2 } from "./components/ApiReference.vue.js";
2
2
  import { default as default3 } from "./components/GettingStarted.vue.js";
3
3
  import { createEmptySpecification } from "./helpers/openapi.js";
4
- import { useWorkspaceStoreEvents } from "./hooks/use-workspace-store-events.js";
5
4
  import { createApiReference } from "./standalone/lib/html-api.js";
6
5
  import { default as default4 } from "./features/Search/components/SearchButton.vue.js";
7
6
  import { default as default5 } from "./features/Search/components/SearchModal.vue.js";
@@ -11,6 +10,5 @@ export {
11
10
  default4 as SearchButton,
12
11
  default5 as SearchModal,
13
12
  createApiReference,
14
- createEmptySpecification,
15
- useWorkspaceStoreEvents
13
+ createEmptySpecification
16
14
  };
@@ -0,0 +1,16 @@
1
+ import type { WorkspacePlugin } from '@scalar/workspace-store/workspace-plugin';
2
+ /**
3
+ * Plugin to persist workspace state changes with debounced writes.
4
+ */
5
+ export declare const persistencePlugin: ({ debounceDelay, maxWait, prefix, }: {
6
+ debounceDelay?: number;
7
+ /** Maximum time in milliseconds to wait before forcing execution, even with continuous calls. */
8
+ maxWait?: number;
9
+ /**
10
+ * Prefix to use for local storage keys.
11
+ * This can be a string or a function returning a string.
12
+ * For example, to persist data per document, use the document name as the prefix.
13
+ */
14
+ prefix?: string | (() => string);
15
+ }) => WorkspacePlugin;
16
+ //# sourceMappingURL=persistance-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistance-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/persistance-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAA;AAI/E;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,qCAI/B;IACD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAA;CACjC,KAAG,eA8DH,CAAA"}
@@ -0,0 +1,54 @@
1
+ import { debounce } from "@scalar/helpers/general/debounce";
2
+ import { authStorage, clientStorage } from "../helpers/storage.js";
3
+ const persistencePlugin = ({
4
+ debounceDelay = 500,
5
+ maxWait = 1e4,
6
+ prefix = ""
7
+ }) => {
8
+ const { execute } = debounce({ delay: debounceDelay, maxWait });
9
+ const authPersistence = authStorage();
10
+ const clientPersistence = clientStorage();
11
+ const getPrefix = () => {
12
+ if (typeof prefix === "string") {
13
+ return prefix;
14
+ }
15
+ return prefix();
16
+ };
17
+ return {
18
+ hooks: {
19
+ /**
20
+ * Handles all workspace state change events.
21
+ * Each write is debounced by a key to prevent frequent writes for the same entity.
22
+ */
23
+ onWorkspaceStateChanges(event) {
24
+ if (event.type === "meta") {
25
+ const defaultClient = event.value["x-scalar-default-client"];
26
+ if (defaultClient !== void 0) {
27
+ execute("x-scalar-default-client", () => clientPersistence.set(defaultClient));
28
+ }
29
+ return;
30
+ }
31
+ if (event.type === "documents") {
32
+ const { path, value: document } = event;
33
+ const { securitySchemes = {} } = document.components ?? {};
34
+ if (path[0] === "components" && path[1] === "securitySchemes") {
35
+ execute("x-scalar-security-schemes", () => authPersistence.setSchemas(getPrefix(), securitySchemes));
36
+ }
37
+ const selectedSecurity = document["x-scalar-selected-security"];
38
+ if (path[0] === "x-scalar-selected-security" && selectedSecurity) {
39
+ execute(
40
+ "x-scalar-selected-security-schemes",
41
+ () => authPersistence.setSelectedSchemes(getPrefix(), {
42
+ "x-scalar-selected-security": selectedSecurity
43
+ })
44
+ );
45
+ }
46
+ }
47
+ return;
48
+ }
49
+ }
50
+ };
51
+ };
52
+ export {
53
+ persistencePlugin
54
+ };