@scalar/api-client 3.0.0 → 3.2.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.
- package/CHANGELOG.md +29 -0
- package/README.md +41 -0
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts +2 -2
- package/dist/plugins/posthog/index.d.ts +23 -0
- package/dist/plugins/posthog/index.d.ts.map +1 -0
- package/dist/plugins/posthog/index.js +58 -0
- package/dist/plugins/posthog/index.js.map +1 -0
- package/dist/style.css +121 -61
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +15 -12
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.d.ts +5 -2
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.js +5 -2
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.d.ts +8 -9
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.js +8 -10
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/response-cache.d.ts +2 -1
- package/dist/v2/blocks/operation-block/helpers/response-cache.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/response-cache.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +11 -3
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.js +19 -12
- package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js +4 -0
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +1 -0
- package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +1 -0
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +3 -2
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +12 -6
- package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.d.ts +2 -0
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js +34 -14
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/helpers/process-response-body.d.ts +1 -1
- package/dist/v2/blocks/response-block/helpers/process-response-body.js +2 -3
- package/dist/v2/blocks/response-block/helpers/process-response-body.js.map +1 -1
- package/dist/v2/blocks/response-block/helpers/resolve-response-body-handler.d.ts +11 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-body-handler.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-body-handler.js +44 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-body-handler.js.map +1 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.d.ts +14 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.js +13 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.js.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js +3 -3
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +131 -48
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +16 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +43 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +6 -2
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.script.js +9 -4
- package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts +3 -0
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.script.js +7 -1
- package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.d.ts +2 -2
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js.map +1 -1
- package/dist/v2/features/app/App.vue.script.js +17 -4
- package/dist/v2/features/app/App.vue.script.js.map +1 -1
- package/dist/v2/features/app/app-state.d.ts +6 -1
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +5 -3
- package/dist/v2/features/app/app-state.js.map +1 -1
- package/dist/v2/features/app/components/DesktopTab.vue.d.ts +2 -2
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts +9 -1
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-api-client-app.js +3 -2
- package/dist/v2/features/app/helpers/create-api-client-app.js.map +1 -1
- package/dist/v2/features/app/helpers/create-temp-operation.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-temp-operation.js +4 -1
- package/dist/v2/features/app/helpers/create-temp-operation.js.map +1 -1
- package/dist/v2/features/app/helpers/routes.d.ts +4 -2
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js.map +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.script.js +2 -1
- package/dist/v2/features/collection/DocumentCollection.vue.script.js.map +1 -1
- package/dist/v2/features/collection/OperationCollection.vue.script.js +2 -1
- package/dist/v2/features/collection/OperationCollection.vue.script.js.map +1 -1
- package/dist/v2/features/collection/WorkspaceCollection.vue.script.js +2 -1
- package/dist/v2/features/collection/WorkspaceCollection.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.js.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.script.js +10 -1
- package/dist/v2/features/collection/components/Authentication.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Cookies.vue.script.js +1 -0
- package/dist/v2/features/collection/components/Cookies.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Editor/Editor.vue.script.js +1 -0
- package/dist/v2/features/collection/components/Editor/Editor.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Environment.vue.script.js +1 -0
- package/dist/v2/features/collection/components/Environment.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Form.vue.d.ts +2 -0
- package/dist/v2/features/collection/components/Form.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Form.vue.js.map +1 -1
- package/dist/v2/features/collection/components/Form.vue.script.js +4 -1
- package/dist/v2/features/collection/components/Form.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/LabelInput.vue.d.ts +1 -1
- package/dist/v2/features/collection/components/Overview.vue.script.js +1 -0
- package/dist/v2/features/collection/components/Overview.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Runner/components/Runner.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Runner/components/Runner.vue.js.map +1 -1
- package/dist/v2/features/collection/components/Runner/components/Runner.vue.script.js +4 -2
- package/dist/v2/features/collection/components/Runner/components/Runner.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Runner/components/RunnerTree.vue.d.ts +2 -2
- package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.d.ts +4 -2
- package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.js +3 -2
- package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.js.map +1 -1
- package/dist/v2/features/collection/components/Scripts.vue.script.js +1 -0
- package/dist/v2/features/collection/components/Scripts.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Servers.vue.js.map +1 -1
- package/dist/v2/features/collection/components/Servers.vue.script.js +3 -1
- package/dist/v2/features/collection/components/Servers.vue.script.js.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.script.js +1 -0
- package/dist/v2/features/collection/components/Settings.vue.script.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts +2 -2
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.script.js +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.script.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImportPostman.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImportPostman.vue.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImportPostman.vue.script.js +26 -21
- package/dist/v2/features/command-palette/components/CommandPaletteImportPostman.vue.script.js.map +1 -1
- package/dist/v2/features/command-palette/components/PostmanImportPreview.vue.js +1 -1
- package/dist/v2/features/command-palette/components/PostmanImportPreview.vue.js.map +1 -1
- package/dist/v2/features/command-palette/components/PostmanImportPreview.vue.script.js +1 -1
- package/dist/v2/features/command-palette/components/PostmanImportPreview.vue.script.js.map +1 -1
- package/dist/v2/features/command-palette/helpers/get-postman-convert-options.d.ts +14 -0
- package/dist/v2/features/command-palette/helpers/get-postman-convert-options.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-postman-convert-options.js +19 -0
- package/dist/v2/features/command-palette/helpers/get-postman-convert-options.js.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.js +1 -1
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.js.map +1 -1
- package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/load-document-from-source.js +1 -1
- package/dist/v2/features/command-palette/helpers/load-document-from-source.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts +2 -2
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +2 -2
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
- package/dist/v2/features/global-cookies/components/CookiesTable.vue.d.ts.map +1 -1
- package/dist/v2/features/global-cookies/components/CookiesTable.vue.js +1 -1
- package/dist/v2/features/global-cookies/components/CookiesTable.vue.js.map +1 -1
- package/dist/v2/features/global-cookies/components/CookiesTable.vue.script.js +2 -0
- package/dist/v2/features/global-cookies/components/CookiesTable.vue.script.js.map +1 -1
- package/dist/v2/features/modal/Modal.vue.d.ts +7 -6
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js.map +1 -1
- package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +5 -5
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.js +11 -0
- package/dist/v2/features/modal/helpers/create-api-client-modal.js.map +1 -1
- package/dist/v2/features/modal/helpers/types.d.ts +1 -7
- package/dist/v2/features/modal/helpers/types.d.ts.map +1 -1
- package/dist/v2/features/modal/index.d.ts +1 -1
- package/dist/v2/features/modal/index.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.d.ts +0 -5
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js.map +1 -1
- package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
- package/dist/v2/types/options.d.ts +15 -0
- package/dist/v2/types/options.d.ts.map +1 -0
- package/package.json +21 -16
- package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts +0 -11
- package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts.map +0 -1
- package/dist/v2/features/command-palette/helpers/is-postman-collection.js +0 -24
- package/dist/v2/features/command-palette/helpers/is-postman-collection.js.map +0 -1
- package/dist/v2/posthog.d.ts +0 -3
- package/dist/v2/posthog.d.ts.map +0 -1
- package/dist/v2/posthog.js +0 -20
- package/dist/v2/posthog.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#8891](https://github.com/scalar/scalar/pull/8891): feat: support refreshing the token
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#8877](https://github.com/scalar/scalar/pull/8877): fix(api-client): prefill oauth2 redirect URI after switching documents
|
|
12
|
+
- [#8943](https://github.com/scalar/scalar/pull/8943): feat: added customFetch config to the client
|
|
13
|
+
- [#8931](https://github.com/scalar/scalar/pull/8931): fix: close environment selector dropdown after selection
|
|
14
|
+
- [#8933](https://github.com/scalar/scalar/pull/8933): feat(api-client): add app-level oauth2 redirect URI override plumbing for auth prefill
|
|
15
|
+
- [#8932](https://github.com/scalar/scalar/pull/8932): fix: only enable fake data suggestion for parameteres and request body
|
|
16
|
+
- [#8907](https://github.com/scalar/scalar/pull/8907): Fix code sample missing body content type update
|
|
17
|
+
|
|
18
|
+
## 3.1.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- [#8865](https://github.com/scalar/scalar/pull/8865): feat: add plugin support for custom response body content types
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#8810](https://github.com/scalar/scalar/pull/8810): refactor: move telemetry to an optional plugin
|
|
27
|
+
- [#8912](https://github.com/scalar/scalar/pull/8912): fix: provide a default summary when creating a new temp operation
|
|
28
|
+
- [#8903](https://github.com/scalar/scalar/pull/8903): fix: share Postman collection detection from postman-to-openapi
|
|
29
|
+
- [#8911](https://github.com/scalar/scalar/pull/8911): feat: switch from Request to RequestPayload to support body with GET
|
|
30
|
+
- [#8887](https://github.com/scalar/scalar/pull/8887): fix: invalid json body handling and add root document for bulk operation selection
|
|
31
|
+
|
|
3
32
|
## 3.0.0
|
|
4
33
|
|
|
5
34
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -165,6 +165,47 @@ The `createApiClientModal` call returns:
|
|
|
165
165
|
```
|
|
166
166
|
|
|
167
167
|
|
|
168
|
+
## Plugins
|
|
169
|
+
|
|
170
|
+
The `plugins` option accepts an array of `ClientPlugin` objects that extend the API Client with custom behavior. Plugins can add lifecycle hooks, custom UI components, and custom response body handlers for content types that the client does not natively support.
|
|
171
|
+
|
|
172
|
+
### Custom Response Body Handling
|
|
173
|
+
|
|
174
|
+
When your API returns a non-standard content type (for example, MessagePack), you can register a plugin with a `responseBody` handler to decode and display it:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
import type { ClientPlugin } from '@scalar/oas-utils/helpers'
|
|
178
|
+
|
|
179
|
+
const msgpackPlugin: ClientPlugin = {
|
|
180
|
+
responseBody: [
|
|
181
|
+
{
|
|
182
|
+
mimeTypes: ['application/msgpack', 'application/x-msgpack'],
|
|
183
|
+
decode: async (buffer) => {
|
|
184
|
+
const { decode } = await import('@msgpack/msgpack')
|
|
185
|
+
const decoded = decode(new Uint8Array(buffer))
|
|
186
|
+
return JSON.stringify(decoded, null, 2)
|
|
187
|
+
},
|
|
188
|
+
language: 'json',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
createApiClientApp(el, {
|
|
194
|
+
layout: 'web',
|
|
195
|
+
plugins: [msgpackPlugin],
|
|
196
|
+
})
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Each handler in `responseBody` supports:
|
|
200
|
+
|
|
201
|
+
| Property | Description |
|
|
202
|
+
|---|---|
|
|
203
|
+
| `mimeTypes` | MIME type patterns to match (exact or wildcard like `application/vnd.*+json`). |
|
|
204
|
+
| `decode` | Transforms the raw `ArrayBuffer` into a string or Blob for display. |
|
|
205
|
+
| `language` | CodeMirror language hint for the built-in raw renderer (for example, `json`). |
|
|
206
|
+
| `rawComponent` | A custom Vue component for the raw view (mutually exclusive with `language`). |
|
|
207
|
+
| `previewComponent` | A custom Vue component for the preview view. |
|
|
208
|
+
|
|
168
209
|
## Community
|
|
169
210
|
|
|
170
211
|
We are API nerds. You too? Let's chat on Discord: <https://discord.gg/scalar>
|
|
@@ -4,9 +4,9 @@ type __VLS_Props = {
|
|
|
4
4
|
isEditable?: boolean;
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
|
-
change: (value: "
|
|
7
|
+
change: (value: "head" | "delete" | "get" | "options" | "patch" | "post" | "put" | "trace") => any;
|
|
8
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
-
onChange?: ((value: "
|
|
9
|
+
onChange?: ((value: "head" | "delete" | "get" | "options" | "patch" | "post" | "put" | "trace") => any) | undefined;
|
|
10
10
|
}>, {
|
|
11
11
|
isSquare: boolean;
|
|
12
12
|
isEditable: boolean;
|
|
@@ -7,11 +7,11 @@ type __VLS_Slots = {} & {
|
|
|
7
7
|
default?: (props: typeof __VLS_1) => any;
|
|
8
8
|
};
|
|
9
9
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
10
|
-
submit: () => any;
|
|
11
10
|
cancel: () => any;
|
|
11
|
+
submit: () => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
-
onSubmit?: (() => any) | undefined;
|
|
14
13
|
onCancel?: (() => any) | undefined;
|
|
14
|
+
onSubmit?: (() => any) | undefined;
|
|
15
15
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
16
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
17
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ClientPlugin } from '@scalar/oas-utils/helpers';
|
|
2
|
+
import type { ConfigDefaults } from 'posthog-js';
|
|
3
|
+
export type PostHogConfig = {
|
|
4
|
+
/** Your PostHog project API key */
|
|
5
|
+
apiKey: string;
|
|
6
|
+
/** The PostHog API host URL */
|
|
7
|
+
apiHost: string;
|
|
8
|
+
/** The PostHog UI host URL (for session recordings, surveys, etc.) */
|
|
9
|
+
uiHost?: string;
|
|
10
|
+
/** PostHog defaults version identifier */
|
|
11
|
+
defaults?: ConfigDefaults;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* PostHog analytics plugin for the API Client.
|
|
15
|
+
*
|
|
16
|
+
* Loading this plugin opts in to analytics. If the plugin is not loaded,
|
|
17
|
+
* no tracking occurs.
|
|
18
|
+
*
|
|
19
|
+
* Respects the `telemetry` configuration option — when set to `false`,
|
|
20
|
+
* capturing is disabled. Reacts dynamically to config changes at runtime.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PostHogClientPlugin: (config: PostHogConfig) => ClientPlugin;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/posthog/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAW,MAAM,YAAY,CAAA;AAGzD,MAAM,MAAM,aAAa,GAAG;IAC1B,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,aAAa,KAAG,YA4D3D,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import ph from "posthog-js";
|
|
2
|
+
//#region src/plugins/posthog/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* PostHog analytics plugin for the API Client.
|
|
5
|
+
*
|
|
6
|
+
* Loading this plugin opts in to analytics. If the plugin is not loaded,
|
|
7
|
+
* no tracking occurs.
|
|
8
|
+
*
|
|
9
|
+
* Respects the `telemetry` configuration option — when set to `false`,
|
|
10
|
+
* capturing is disabled. Reacts dynamically to config changes at runtime.
|
|
11
|
+
*/
|
|
12
|
+
var PostHogClientPlugin = (config) => {
|
|
13
|
+
let posthog = null;
|
|
14
|
+
return {
|
|
15
|
+
on: {
|
|
16
|
+
"hooks:on:request:sent": () => posthog?.capture("hooks:on:request:sent"),
|
|
17
|
+
"operation:create:operation": () => posthog?.capture("operation:create:operation"),
|
|
18
|
+
"operation:delete:operation": () => posthog?.capture("operation:delete:operation"),
|
|
19
|
+
"document:create:empty-document": () => posthog?.capture("document:create:empty-document"),
|
|
20
|
+
"document:delete:document": () => posthog?.capture("document:delete:document"),
|
|
21
|
+
"tag:create:tag": () => posthog?.capture("tag:create:tag"),
|
|
22
|
+
"server:add:server": () => posthog?.capture("server:add:server"),
|
|
23
|
+
"auth:update:selected-security-schemes": () => posthog?.capture("auth:update:selected-security-schemes"),
|
|
24
|
+
"environment:upsert:environment": () => posthog?.capture("environment:upsert:environment"),
|
|
25
|
+
"ui:open:client-modal": () => posthog?.capture("ui:open:client-modal"),
|
|
26
|
+
"ui:download:document": () => posthog?.capture("ui:download:document")
|
|
27
|
+
},
|
|
28
|
+
lifecycle: {
|
|
29
|
+
onInit(context) {
|
|
30
|
+
if (typeof window === "undefined") return;
|
|
31
|
+
const instance = ph.init(config.apiKey, {
|
|
32
|
+
api_host: config.apiHost,
|
|
33
|
+
...config.uiHost ? { ui_host: config.uiHost } : {},
|
|
34
|
+
...config.defaults ? { defaults: config.defaults } : {},
|
|
35
|
+
opt_out_capturing_by_default: true
|
|
36
|
+
}, "scalar-api-client");
|
|
37
|
+
if (instance) {
|
|
38
|
+
posthog = instance;
|
|
39
|
+
posthog.register({ product: "api-client" });
|
|
40
|
+
if (context?.config.telemetry !== false) posthog.opt_in_capturing();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
onConfigChange(context) {
|
|
44
|
+
if (!posthog) return;
|
|
45
|
+
if (context.config.telemetry === false) posthog.opt_out_capturing();
|
|
46
|
+
else posthog.opt_in_capturing();
|
|
47
|
+
},
|
|
48
|
+
onDestroy() {
|
|
49
|
+
posthog?.reset();
|
|
50
|
+
posthog = null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
export { PostHogClientPlugin };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/plugins/posthog/index.ts"],"sourcesContent":["import type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { ConfigDefaults, PostHog } from 'posthog-js'\nimport ph from 'posthog-js'\n\nexport type PostHogConfig = {\n /** Your PostHog project API key */\n apiKey: string\n /** The PostHog API host URL */\n apiHost: string\n /** The PostHog UI host URL (for session recordings, surveys, etc.) */\n uiHost?: string\n /** PostHog defaults version identifier */\n defaults?: ConfigDefaults\n}\n\n/**\n * PostHog analytics plugin for the API Client.\n *\n * Loading this plugin opts in to analytics. If the plugin is not loaded,\n * no tracking occurs.\n *\n * Respects the `telemetry` configuration option — when set to `false`,\n * capturing is disabled. Reacts dynamically to config changes at runtime.\n */\nexport const PostHogClientPlugin = (config: PostHogConfig): ClientPlugin => {\n let posthog: PostHog | null = null\n\n return {\n on: {\n 'hooks:on:request:sent': () => posthog?.capture('hooks:on:request:sent'),\n 'operation:create:operation': () => posthog?.capture('operation:create:operation'),\n 'operation:delete:operation': () => posthog?.capture('operation:delete:operation'),\n 'document:create:empty-document': () => posthog?.capture('document:create:empty-document'),\n 'document:delete:document': () => posthog?.capture('document:delete:document'),\n 'tag:create:tag': () => posthog?.capture('tag:create:tag'),\n 'server:add:server': () => posthog?.capture('server:add:server'),\n 'auth:update:selected-security-schemes': () => posthog?.capture('auth:update:selected-security-schemes'),\n 'environment:upsert:environment': () => posthog?.capture('environment:upsert:environment'),\n 'ui:open:client-modal': () => posthog?.capture('ui:open:client-modal'),\n 'ui:download:document': () => posthog?.capture('ui:download:document'),\n },\n lifecycle: {\n onInit(context) {\n if (typeof window === 'undefined') {\n return\n }\n\n const instance = ph.init(\n config.apiKey,\n {\n api_host: config.apiHost,\n ...(config.uiHost ? { ui_host: config.uiHost } : {}),\n ...(config.defaults ? { defaults: config.defaults } : {}),\n opt_out_capturing_by_default: true,\n },\n 'scalar-api-client',\n )\n\n if (instance) {\n posthog = instance\n posthog.register({ product: 'api-client' })\n\n if (context?.config.telemetry !== false) {\n posthog.opt_in_capturing()\n }\n }\n },\n onConfigChange(context) {\n if (!posthog) {\n return\n }\n\n if (context.config.telemetry === false) {\n posthog.opt_out_capturing()\n } else {\n posthog.opt_in_capturing()\n }\n },\n onDestroy() {\n posthog?.reset()\n posthog = null\n },\n },\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,IAAa,uBAAuB,WAAwC;CAC1E,IAAI,UAA0B;AAE9B,QAAO;EACL,IAAI;GACF,+BAA+B,SAAS,QAAQ,wBAAwB;GACxE,oCAAoC,SAAS,QAAQ,6BAA6B;GAClF,oCAAoC,SAAS,QAAQ,6BAA6B;GAClF,wCAAwC,SAAS,QAAQ,iCAAiC;GAC1F,kCAAkC,SAAS,QAAQ,2BAA2B;GAC9E,wBAAwB,SAAS,QAAQ,iBAAiB;GAC1D,2BAA2B,SAAS,QAAQ,oBAAoB;GAChE,+CAA+C,SAAS,QAAQ,wCAAwC;GACxG,wCAAwC,SAAS,QAAQ,iCAAiC;GAC1F,8BAA8B,SAAS,QAAQ,uBAAuB;GACtE,8BAA8B,SAAS,QAAQ,uBAAuB;GACvE;EACD,WAAW;GACT,OAAO,SAAS;AACd,QAAI,OAAO,WAAW,YACpB;IAGF,MAAM,WAAW,GAAG,KAClB,OAAO,QACP;KACE,UAAU,OAAO;KACjB,GAAI,OAAO,SAAS,EAAE,SAAS,OAAO,QAAQ,GAAG,EAAE;KACnD,GAAI,OAAO,WAAW,EAAE,UAAU,OAAO,UAAU,GAAG,EAAE;KACxD,8BAA8B;KAC/B,EACD,oBACD;AAED,QAAI,UAAU;AACZ,eAAU;AACV,aAAQ,SAAS,EAAE,SAAS,cAAc,CAAC;AAE3C,SAAI,SAAS,OAAO,cAAc,MAChC,SAAQ,kBAAkB;;;GAIhC,eAAe,SAAS;AACtB,QAAI,CAAC,QACH;AAGF,QAAI,QAAQ,OAAO,cAAc,MAC/B,SAAQ,mBAAmB;QAE3B,SAAQ,kBAAkB;;GAG9B,YAAY;AACV,aAAS,OAAO;AAChB,cAAU;;GAEb;EACF"}
|