@scalar/workspace-store 0.40.2 → 0.40.3
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 +7 -0
- package/dist/client.d.ts +7 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +820 -681
- package/dist/entities/auth/index.js +96 -101
- package/dist/entities/auth/schema.js +42 -116
- package/dist/entities/history/index.js +80 -60
- package/dist/entities/history/schema.js +94 -88
- package/dist/events/bus.js +146 -93
- package/dist/events/definitions/analytics.js +1 -1
- package/dist/events/definitions/auth.js +1 -1
- package/dist/events/definitions/common.js +1 -1
- package/dist/events/definitions/cookie.js +1 -1
- package/dist/events/definitions/document.js +1 -1
- package/dist/events/definitions/environment.js +1 -1
- package/dist/events/definitions/hooks.js +1 -1
- package/dist/events/definitions/index.js +1 -1
- package/dist/events/definitions/meta.js +1 -1
- package/dist/events/definitions/operation.js +1 -1
- package/dist/events/definitions/server.js +1 -1
- package/dist/events/definitions/tabs.js +1 -1
- package/dist/events/definitions/tag.js +1 -1
- package/dist/events/definitions/ui.js +1 -1
- package/dist/events/definitions/workspace.js +1 -1
- package/dist/events/index.js +3 -9
- package/dist/events/listeners.js +20 -22
- package/dist/events/old-definitions.js +15 -12
- package/dist/helpers/deep-clone.js +33 -17
- package/dist/helpers/detect-changes-proxy.js +95 -57
- package/dist/helpers/general.js +78 -23
- package/dist/helpers/generate-unique-value.js +77 -45
- package/dist/helpers/get-fetch.js +12 -10
- package/dist/helpers/get-resolved-ref.js +11 -10
- package/dist/helpers/is-non-optional-security-requirement.js +3 -6
- package/dist/helpers/merge-object.js +71 -30
- package/dist/helpers/overrides-proxy.js +98 -58
- package/dist/helpers/unpack-proxy.js +60 -58
- package/dist/mutators/auth.js +358 -230
- package/dist/mutators/cookie.js +59 -42
- package/dist/mutators/document.js +104 -66
- package/dist/mutators/environment.js +97 -72
- package/dist/mutators/helpers.js +9 -13
- package/dist/mutators/index.js +62 -49
- package/dist/mutators/operation/body.js +88 -57
- package/dist/mutators/operation/extensions.js +20 -12
- package/dist/mutators/operation/helpers/fetch-request-to-har.js +144 -107
- package/dist/mutators/operation/helpers/fetch-response-to-har.js +143 -95
- package/dist/mutators/operation/helpers/get-parameter-position.js +12 -12
- package/dist/mutators/operation/helpers/har-to-operation.js +169 -132
- package/dist/mutators/operation/helpers/sync-path-parameters.js +109 -60
- package/dist/mutators/operation/history.js +60 -64
- package/dist/mutators/operation/index.js +25 -49
- package/dist/mutators/operation/operation.js +349 -240
- package/dist/mutators/operation/parameters.js +157 -93
- package/dist/mutators/server.js +213 -152
- package/dist/mutators/tabs.js +173 -130
- package/dist/mutators/tag.js +131 -97
- package/dist/mutators/workspace.js +72 -42
- package/dist/navigation/get-navigation-options.js +97 -84
- package/dist/navigation/helpers/get-openapi-object.js +46 -29
- package/dist/navigation/helpers/get-operation-entries.js +72 -32
- package/dist/navigation/helpers/get-parent-entry.js +16 -12
- package/dist/navigation/helpers/get-tag-entries.js +56 -29
- package/dist/navigation/helpers/get-tag.js +22 -23
- package/dist/navigation/helpers/get-x-keys.js +13 -9
- package/dist/navigation/helpers/traverse-description.js +90 -72
- package/dist/navigation/helpers/traverse-document.js +111 -98
- package/dist/navigation/helpers/traverse-examples.js +35 -31
- package/dist/navigation/helpers/traverse-paths.js +118 -106
- package/dist/navigation/helpers/traverse-schemas.js +65 -64
- package/dist/navigation/helpers/traverse-tags.js +158 -129
- package/dist/navigation/helpers/traverse-webhooks.js +96 -90
- package/dist/navigation/helpers/update-order-ids.js +59 -51
- package/dist/navigation/helpers/utils.js +71 -21
- package/dist/navigation/index.js +5 -13
- package/dist/navigation/types.js +1 -1
- package/dist/persistence/index.js +283 -285
- package/dist/persistence/indexdb.js +263 -126
- package/dist/plugins/bundler/helpers.js +21 -12
- package/dist/plugins/bundler/index.d.ts +7 -0
- package/dist/plugins/bundler/index.d.ts.map +1 -1
- package/dist/plugins/bundler/index.js +305 -171
- package/dist/plugins/client/index.js +1 -5
- package/dist/plugins/client/persistence.js +95 -90
- package/dist/resolve.js +18 -25
- package/dist/schemas/compose.js +6 -7
- package/dist/schemas/extensions/document/x-internal.js +3 -7
- package/dist/schemas/extensions/document/x-scalar-environments.js +16 -22
- package/dist/schemas/extensions/document/x-scalar-icon.js +3 -7
- package/dist/schemas/extensions/document/x-scalar-ignore.js +3 -7
- package/dist/schemas/extensions/document/x-scalar-is-dirty.js +21 -8
- package/dist/schemas/extensions/document/x-scalar-original-document-hash.js +17 -8
- package/dist/schemas/extensions/document/x-scalar-registry-meta.js +15 -21
- package/dist/schemas/extensions/document/x-scalar-sdk-installation.js +5 -13
- package/dist/schemas/extensions/document/x-scalar-watch-mode.js +4 -8
- package/dist/schemas/extensions/document/x-tags.js +3 -7
- package/dist/schemas/extensions/example/x-disabled.js +17 -7
- package/dist/schemas/extensions/general/x-scalar-active-environment.js +4 -7
- package/dist/schemas/extensions/general/x-scalar-cookies.js +9 -14
- package/dist/schemas/extensions/general/x-scalar-order.js +8 -7
- package/dist/schemas/extensions/operation/index.js +4 -23
- package/dist/schemas/extensions/operation/x-badge.js +42 -50
- package/dist/schemas/extensions/operation/x-code-samples.js +8 -12
- package/dist/schemas/extensions/operation/x-draft-examples.js +3 -7
- package/dist/schemas/extensions/operation/x-post-response.js +18 -7
- package/dist/schemas/extensions/operation/x-scalar-disable-parameters.js +57 -13
- package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js +9 -7
- package/dist/schemas/extensions/operation/x-scalar-stability.js +15 -14
- package/dist/schemas/extensions/parameter/x-global.js +12 -7
- package/dist/schemas/extensions/schema/x-additional-properties-name.js +10 -7
- package/dist/schemas/extensions/schema/x-enum-descriptions.js +17 -12
- package/dist/schemas/extensions/schema/x-enum-varnames.js +21 -8
- package/dist/schemas/extensions/schema/x-examples.js +3 -7
- package/dist/schemas/extensions/schema/x-variable.js +3 -7
- package/dist/schemas/extensions/security/index.js +1 -1
- package/dist/schemas/extensions/security/x-default-scopes.js +16 -7
- package/dist/schemas/extensions/security/x-scalar-credentials-location.js +16 -7
- package/dist/schemas/extensions/security/x-scalar-security-body.js +14 -7
- package/dist/schemas/extensions/security/x-scalar-security-query.js +14 -7
- package/dist/schemas/extensions/security/x-scalar-security-secrets.js +66 -37
- package/dist/schemas/extensions/security/x-tokenName.js +11 -7
- package/dist/schemas/extensions/security/x-use-pkce.js +6 -10
- package/dist/schemas/extensions/server/x-scalar-selected-server.js +3 -7
- package/dist/schemas/extensions/tag/index.js +1 -1
- package/dist/schemas/extensions/tag/x-display-name.js +11 -7
- package/dist/schemas/extensions/tag/x-tag-groups.js +13 -15
- package/dist/schemas/extensions/workspace/index.js +2 -11
- package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js +13 -7
- package/dist/schemas/extensions/workspace/x-scalar-tabs.js +15 -13
- package/dist/schemas/extensions.js +11 -15
- package/dist/schemas/inmemory-workspace.js +13 -21
- package/dist/schemas/navigation.js +48 -85
- package/dist/schemas/reference-config/appearance.js +15 -22
- package/dist/schemas/reference-config/features.js +14 -21
- package/dist/schemas/reference-config/index.js +42 -44
- package/dist/schemas/reference-config/meta.js +11 -18
- package/dist/schemas/reference-config/routing.js +7 -14
- package/dist/schemas/reference-config/settings.js +10 -17
- package/dist/schemas/typebox-coerce.js +23 -6
- package/dist/schemas/v3.1/strict/callback.js +6 -12
- package/dist/schemas/v3.1/strict/components.js +26 -48
- package/dist/schemas/v3.1/strict/contact.js +9 -12
- package/dist/schemas/v3.1/strict/discriminator.js +11 -10
- package/dist/schemas/v3.1/strict/encoding.js +15 -12
- package/dist/schemas/v3.1/strict/example.js +11 -13
- package/dist/schemas/v3.1/strict/external-documentation.js +7 -10
- package/dist/schemas/v3.1/strict/header.js +27 -28
- package/dist/schemas/v3.1/strict/info.js +10 -16
- package/dist/schemas/v3.1/strict/license.js +9 -12
- package/dist/schemas/v3.1/strict/link.js +22 -19
- package/dist/schemas/v3.1/strict/media-type.js +17 -16
- package/dist/schemas/v3.1/strict/oauth-flow.js +28 -62
- package/dist/schemas/v3.1/strict/oauthflows.js +14 -20
- package/dist/schemas/v3.1/strict/openapi-document.js +126 -210
- package/dist/schemas/v3.1/strict/operation.js +16 -43
- package/dist/schemas/v3.1/strict/parameter.js +27 -35
- package/dist/schemas/v3.1/strict/path-item.js +36 -40
- package/dist/schemas/v3.1/strict/paths.js +8 -11
- package/dist/schemas/v3.1/strict/ref-definitions.js +76 -100
- package/dist/schemas/v3.1/strict/reference.js +18 -21
- package/dist/schemas/v3.1/strict/request-body.js +8 -16
- package/dist/schemas/v3.1/strict/response.js +12 -16
- package/dist/schemas/v3.1/strict/responses.js +13 -11
- package/dist/schemas/v3.1/strict/schema.js +149 -157
- package/dist/schemas/v3.1/strict/security-requirement.js +13 -12
- package/dist/schemas/v3.1/strict/security-scheme.js +29 -41
- package/dist/schemas/v3.1/strict/server-variable.js +9 -12
- package/dist/schemas/v3.1/strict/server.js +10 -13
- package/dist/schemas/v3.1/strict/tag.js +11 -20
- package/dist/schemas/v3.1/strict/type-guards.js +20 -20
- package/dist/schemas/v3.1/strict/xml.js +17 -16
- package/dist/schemas/workspace-specification/index.js +11 -23
- package/dist/schemas/workspace-specification/info.js +4 -8
- package/dist/schemas/workspace.js +25 -51
- package/dist/schemas.js +2 -6
- package/dist/server.js +286 -176
- package/dist/workspace-plugin.js +1 -1
- package/package.json +13 -19
- package/dist/client.js.map +0 -7
- package/dist/entities/auth/index.js.map +0 -7
- package/dist/entities/auth/schema.js.map +0 -7
- package/dist/entities/history/index.js.map +0 -7
- package/dist/entities/history/schema.js.map +0 -7
- package/dist/events/bus.js.map +0 -7
- package/dist/events/definitions/analytics.js.map +0 -7
- package/dist/events/definitions/auth.js.map +0 -7
- package/dist/events/definitions/common.js.map +0 -7
- package/dist/events/definitions/cookie.js.map +0 -7
- package/dist/events/definitions/document.js.map +0 -7
- package/dist/events/definitions/environment.js.map +0 -7
- package/dist/events/definitions/hooks.js.map +0 -7
- package/dist/events/definitions/index.js.map +0 -7
- package/dist/events/definitions/meta.js.map +0 -7
- package/dist/events/definitions/operation.js.map +0 -7
- package/dist/events/definitions/server.js.map +0 -7
- package/dist/events/definitions/tabs.js.map +0 -7
- package/dist/events/definitions/tag.js.map +0 -7
- package/dist/events/definitions/ui.js.map +0 -7
- package/dist/events/definitions/workspace.js.map +0 -7
- package/dist/events/index.js.map +0 -7
- package/dist/events/listeners.js.map +0 -7
- package/dist/events/old-definitions.js.map +0 -7
- package/dist/helpers/apply-selective-updates.d.ts +0 -19
- package/dist/helpers/apply-selective-updates.d.ts.map +0 -1
- package/dist/helpers/apply-selective-updates.js +0 -37
- package/dist/helpers/apply-selective-updates.js.map +0 -7
- package/dist/helpers/deep-clone.js.map +0 -7
- package/dist/helpers/detect-changes-proxy.js.map +0 -7
- package/dist/helpers/general.js.map +0 -7
- package/dist/helpers/generate-unique-value.js.map +0 -7
- package/dist/helpers/get-fetch.js.map +0 -7
- package/dist/helpers/get-resolved-ref.js.map +0 -7
- package/dist/helpers/is-non-optional-security-requirement.js.map +0 -7
- package/dist/helpers/merge-object.js.map +0 -7
- package/dist/helpers/overrides-proxy.js.map +0 -7
- package/dist/helpers/unpack-proxy.js.map +0 -7
- package/dist/mutators/auth.js.map +0 -7
- package/dist/mutators/cookie.js.map +0 -7
- package/dist/mutators/document.js.map +0 -7
- package/dist/mutators/environment.js.map +0 -7
- package/dist/mutators/helpers.js.map +0 -7
- package/dist/mutators/index.js.map +0 -7
- package/dist/mutators/operation/body.js.map +0 -7
- package/dist/mutators/operation/extensions.js.map +0 -7
- package/dist/mutators/operation/helpers/fetch-request-to-har.js.map +0 -7
- package/dist/mutators/operation/helpers/fetch-response-to-har.js.map +0 -7
- package/dist/mutators/operation/helpers/get-parameter-position.js.map +0 -7
- package/dist/mutators/operation/helpers/har-to-operation.js.map +0 -7
- package/dist/mutators/operation/helpers/sync-path-parameters.js.map +0 -7
- package/dist/mutators/operation/history.js.map +0 -7
- package/dist/mutators/operation/index.js.map +0 -7
- package/dist/mutators/operation/operation.js.map +0 -7
- package/dist/mutators/operation/parameters.js.map +0 -7
- package/dist/mutators/server.js.map +0 -7
- package/dist/mutators/tabs.js.map +0 -7
- package/dist/mutators/tag.js.map +0 -7
- package/dist/mutators/workspace.js.map +0 -7
- package/dist/navigation/get-navigation-options.js.map +0 -7
- package/dist/navigation/helpers/get-openapi-object.js.map +0 -7
- package/dist/navigation/helpers/get-operation-entries.js.map +0 -7
- package/dist/navigation/helpers/get-parent-entry.js.map +0 -7
- package/dist/navigation/helpers/get-tag-entries.js.map +0 -7
- package/dist/navigation/helpers/get-tag.js.map +0 -7
- package/dist/navigation/helpers/get-x-keys.js.map +0 -7
- package/dist/navigation/helpers/traverse-description.js.map +0 -7
- package/dist/navigation/helpers/traverse-document.js.map +0 -7
- package/dist/navigation/helpers/traverse-examples.js.map +0 -7
- package/dist/navigation/helpers/traverse-paths.js.map +0 -7
- package/dist/navigation/helpers/traverse-schemas.js.map +0 -7
- package/dist/navigation/helpers/traverse-tags.js.map +0 -7
- package/dist/navigation/helpers/traverse-webhooks.js.map +0 -7
- package/dist/navigation/helpers/update-order-ids.js.map +0 -7
- package/dist/navigation/helpers/utils.js.map +0 -7
- package/dist/navigation/index.js.map +0 -7
- package/dist/navigation/types.js.map +0 -7
- package/dist/persistence/index.js.map +0 -7
- package/dist/persistence/indexdb.js.map +0 -7
- package/dist/plugins/bundler/helpers.js.map +0 -7
- package/dist/plugins/bundler/index.js.map +0 -7
- package/dist/plugins/client/index.js.map +0 -7
- package/dist/plugins/client/persistence.js.map +0 -7
- package/dist/resolve.js.map +0 -7
- package/dist/schemas/compose.js.map +0 -7
- package/dist/schemas/extensions/document/x-internal.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-environments.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-icon.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-ignore.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-is-dirty.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-original-document-hash.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-registry-meta.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-sdk-installation.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-watch-mode.js.map +0 -7
- package/dist/schemas/extensions/document/x-tags.js.map +0 -7
- package/dist/schemas/extensions/example/x-disabled.js.map +0 -7
- package/dist/schemas/extensions/general/x-scalar-active-environment.js.map +0 -7
- package/dist/schemas/extensions/general/x-scalar-cookies.js.map +0 -7
- package/dist/schemas/extensions/general/x-scalar-order.js.map +0 -7
- package/dist/schemas/extensions/operation/index.js.map +0 -7
- package/dist/schemas/extensions/operation/x-badge.js.map +0 -7
- package/dist/schemas/extensions/operation/x-code-samples.js.map +0 -7
- package/dist/schemas/extensions/operation/x-draft-examples.js.map +0 -7
- package/dist/schemas/extensions/operation/x-post-response.js.map +0 -7
- package/dist/schemas/extensions/operation/x-scalar-disable-parameters.js.map +0 -7
- package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js.map +0 -7
- package/dist/schemas/extensions/operation/x-scalar-stability.js.map +0 -7
- package/dist/schemas/extensions/parameter/x-global.js.map +0 -7
- package/dist/schemas/extensions/schema/x-additional-properties-name.js.map +0 -7
- package/dist/schemas/extensions/schema/x-enum-descriptions.js.map +0 -7
- package/dist/schemas/extensions/schema/x-enum-varnames.js.map +0 -7
- package/dist/schemas/extensions/schema/x-examples.js.map +0 -7
- package/dist/schemas/extensions/schema/x-variable.js.map +0 -7
- package/dist/schemas/extensions/security/index.js.map +0 -7
- package/dist/schemas/extensions/security/x-default-scopes.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-credentials-location.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-security-body.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-security-query.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-security-secrets.js.map +0 -7
- package/dist/schemas/extensions/security/x-tokenName.js.map +0 -7
- package/dist/schemas/extensions/security/x-use-pkce.js.map +0 -7
- package/dist/schemas/extensions/server/x-scalar-selected-server.js.map +0 -7
- package/dist/schemas/extensions/tag/index.js.map +0 -7
- package/dist/schemas/extensions/tag/x-display-name.js.map +0 -7
- package/dist/schemas/extensions/tag/x-tag-groups.js.map +0 -7
- package/dist/schemas/extensions/workspace/index.js.map +0 -7
- package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js.map +0 -7
- package/dist/schemas/extensions/workspace/x-scalar-tabs.js.map +0 -7
- package/dist/schemas/extensions.js.map +0 -7
- package/dist/schemas/inmemory-workspace.js.map +0 -7
- package/dist/schemas/navigation.js.map +0 -7
- package/dist/schemas/reference-config/appearance.js.map +0 -7
- package/dist/schemas/reference-config/features.js.map +0 -7
- package/dist/schemas/reference-config/index.js.map +0 -7
- package/dist/schemas/reference-config/meta.js.map +0 -7
- package/dist/schemas/reference-config/routing.js.map +0 -7
- package/dist/schemas/reference-config/settings.js.map +0 -7
- package/dist/schemas/typebox-coerce.js.map +0 -7
- package/dist/schemas/v3.1/strict/callback.js.map +0 -7
- package/dist/schemas/v3.1/strict/components.js.map +0 -7
- package/dist/schemas/v3.1/strict/contact.js.map +0 -7
- package/dist/schemas/v3.1/strict/discriminator.js.map +0 -7
- package/dist/schemas/v3.1/strict/encoding.js.map +0 -7
- package/dist/schemas/v3.1/strict/example.js.map +0 -7
- package/dist/schemas/v3.1/strict/external-documentation.js.map +0 -7
- package/dist/schemas/v3.1/strict/header.js.map +0 -7
- package/dist/schemas/v3.1/strict/info.js.map +0 -7
- package/dist/schemas/v3.1/strict/license.js.map +0 -7
- package/dist/schemas/v3.1/strict/link.js.map +0 -7
- package/dist/schemas/v3.1/strict/media-type.js.map +0 -7
- package/dist/schemas/v3.1/strict/oauth-flow.js.map +0 -7
- package/dist/schemas/v3.1/strict/oauthflows.js.map +0 -7
- package/dist/schemas/v3.1/strict/openapi-document.js.map +0 -7
- package/dist/schemas/v3.1/strict/operation.js.map +0 -7
- package/dist/schemas/v3.1/strict/parameter.js.map +0 -7
- package/dist/schemas/v3.1/strict/path-item.js.map +0 -7
- package/dist/schemas/v3.1/strict/paths.js.map +0 -7
- package/dist/schemas/v3.1/strict/ref-definitions.js.map +0 -7
- package/dist/schemas/v3.1/strict/reference.js.map +0 -7
- package/dist/schemas/v3.1/strict/request-body.js.map +0 -7
- package/dist/schemas/v3.1/strict/response.js.map +0 -7
- package/dist/schemas/v3.1/strict/responses.js.map +0 -7
- package/dist/schemas/v3.1/strict/schema.js.map +0 -7
- package/dist/schemas/v3.1/strict/security-requirement.js.map +0 -7
- package/dist/schemas/v3.1/strict/security-scheme.js.map +0 -7
- package/dist/schemas/v3.1/strict/server-variable.js.map +0 -7
- package/dist/schemas/v3.1/strict/server.js.map +0 -7
- package/dist/schemas/v3.1/strict/tag.js.map +0 -7
- package/dist/schemas/v3.1/strict/type-guards.js.map +0 -7
- package/dist/schemas/v3.1/strict/xml.js.map +0 -7
- package/dist/schemas/workspace-specification/index.js.map +0 -7
- package/dist/schemas/workspace-specification/info.js.map +0 -7
- package/dist/schemas/workspace.js.map +0 -7
- package/dist/schemas.js.map +0 -7
- package/dist/server.js.map +0 -7
- package/dist/workspace-plugin.js.map +0 -7
|
@@ -1,103 +1,98 @@
|
|
|
1
|
-
import { preventPollution } from
|
|
2
|
-
import { reactive } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
import { preventPollution } from '@scalar/helpers/object/prevent-pollution';
|
|
2
|
+
import { reactive } from 'vue';
|
|
3
|
+
import { DocumentAuthSchema, SecretsAuthUnionSchema, } from '../../entities/auth/schema.js';
|
|
4
|
+
import { safeAssign } from '../../helpers/general.js';
|
|
5
|
+
import { unpackProxyObject } from '../../helpers/unpack-proxy.js';
|
|
6
|
+
import { coerceValue } from '../../schemas/typebox-coerce.js';
|
|
7
|
+
export { AuthSchema, OpenIDConnectSchema, SecretsAuthSchema, } from './schema.js';
|
|
8
|
+
/**
|
|
9
|
+
* Factory function to create a new AuthStore instance.
|
|
10
|
+
*/
|
|
11
|
+
export const createAuthStore = ({ hooks } = {}) => {
|
|
12
|
+
// Vue reactive object to hold all authentication state
|
|
13
|
+
const auth = reactive({});
|
|
14
|
+
const getAuthSecrets = (documentName, schemeName) => {
|
|
15
|
+
return auth[documentName]?.secrets?.[schemeName];
|
|
16
|
+
};
|
|
17
|
+
const setAuthSecrets = (documentName, schemeName, data) => {
|
|
18
|
+
auth[documentName] ||= { secrets: {}, selected: { document: undefined, path: undefined } };
|
|
19
|
+
auth[documentName].secrets[schemeName] = coerceValue(SecretsAuthUnionSchema, data);
|
|
20
|
+
hooks?.onAuthChange?.(documentName);
|
|
21
|
+
};
|
|
22
|
+
const clearAuthSecrets = (documentName, schemeName) => {
|
|
23
|
+
delete auth[documentName]?.secrets?.[schemeName];
|
|
24
|
+
hooks?.onAuthChange?.(documentName);
|
|
25
|
+
};
|
|
26
|
+
const getAuthSelectedSchemas = (payload) => {
|
|
27
|
+
if (payload.type === 'document') {
|
|
28
|
+
return auth[payload.documentName]?.selected?.document;
|
|
29
|
+
}
|
|
30
|
+
return auth[payload.documentName]?.selected?.path?.[payload.path]?.[payload.method];
|
|
31
|
+
};
|
|
32
|
+
const setAuthSelectedSchemas = (payload, selectedSchemes) => {
|
|
33
|
+
auth[payload.documentName] ||= {
|
|
34
|
+
secrets: {},
|
|
35
|
+
selected: { document: undefined, path: undefined },
|
|
36
|
+
};
|
|
37
|
+
// TypeScript needs a non-null assertion here since we just ensured it exists
|
|
38
|
+
const documentAuth = auth[payload.documentName];
|
|
39
|
+
if (payload.type === 'document') {
|
|
40
|
+
documentAuth.selected.document = selectedSchemes;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Prevent assigning dangerous keys to the path items object
|
|
44
|
+
preventPollution(payload.path);
|
|
45
|
+
preventPollution(payload.method);
|
|
46
|
+
documentAuth.selected.path ||= {};
|
|
47
|
+
documentAuth.selected.path[payload.path] ||= {};
|
|
48
|
+
const pathAuth = documentAuth.selected.path[payload.path];
|
|
49
|
+
pathAuth[payload.method] = selectedSchemes;
|
|
50
|
+
}
|
|
51
|
+
hooks?.onAuthChange?.(payload.documentName);
|
|
52
|
+
};
|
|
53
|
+
const clearAuthSelectedSchemas = (payload) => {
|
|
54
|
+
const documentAuth = auth[payload.documentName];
|
|
55
|
+
if (!documentAuth) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (payload.type === 'document') {
|
|
59
|
+
delete documentAuth.selected.document;
|
|
60
|
+
hooks?.onAuthChange?.(payload.documentName);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// Prevent altering dangerous keys to the path items object
|
|
64
|
+
preventPollution(payload.method);
|
|
65
|
+
preventPollution(payload.path);
|
|
66
|
+
const pathAuth = documentAuth.selected.path?.[payload.path];
|
|
67
|
+
if (!pathAuth) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
delete pathAuth[payload.method];
|
|
71
|
+
hooks?.onAuthChange?.(payload.documentName);
|
|
72
|
+
};
|
|
73
|
+
const clearDocumentAuth = (documentName) => {
|
|
74
|
+
delete auth[documentName];
|
|
75
|
+
hooks?.onAuthChange?.(documentName);
|
|
76
|
+
};
|
|
77
|
+
const load = (data) => {
|
|
78
|
+
safeAssign(auth, coerceValue(DocumentAuthSchema, data));
|
|
79
|
+
// Trigger change events for all loaded documents
|
|
80
|
+
Object.keys(data).forEach((documentName) => {
|
|
81
|
+
hooks?.onAuthChange?.(documentName);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const exportAuth = () => {
|
|
85
|
+
return unpackProxyObject(auth);
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
clearAuthSelectedSchemas,
|
|
89
|
+
getAuthSecrets,
|
|
90
|
+
setAuthSecrets,
|
|
91
|
+
clearAuthSecrets,
|
|
92
|
+
getAuthSelectedSchemas,
|
|
93
|
+
setAuthSelectedSchemas,
|
|
94
|
+
clearDocumentAuth,
|
|
95
|
+
load,
|
|
96
|
+
export: exportAuth,
|
|
39
97
|
};
|
|
40
|
-
const documentAuth = auth[payload.documentName];
|
|
41
|
-
if (payload.type === "document") {
|
|
42
|
-
documentAuth.selected.document = selectedSchemes;
|
|
43
|
-
} else {
|
|
44
|
-
preventPollution(payload.path);
|
|
45
|
-
preventPollution(payload.method);
|
|
46
|
-
documentAuth.selected.path ||= {};
|
|
47
|
-
documentAuth.selected.path[payload.path] ||= {};
|
|
48
|
-
const pathAuth = documentAuth.selected.path[payload.path];
|
|
49
|
-
pathAuth[payload.method] = selectedSchemes;
|
|
50
|
-
}
|
|
51
|
-
hooks?.onAuthChange?.(payload.documentName);
|
|
52
|
-
};
|
|
53
|
-
const clearAuthSelectedSchemas = (payload) => {
|
|
54
|
-
const documentAuth = auth[payload.documentName];
|
|
55
|
-
if (!documentAuth) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (payload.type === "document") {
|
|
59
|
-
delete documentAuth.selected.document;
|
|
60
|
-
hooks?.onAuthChange?.(payload.documentName);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
preventPollution(payload.method);
|
|
64
|
-
preventPollution(payload.path);
|
|
65
|
-
const pathAuth = documentAuth.selected.path?.[payload.path];
|
|
66
|
-
if (!pathAuth) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
delete pathAuth[payload.method];
|
|
70
|
-
hooks?.onAuthChange?.(payload.documentName);
|
|
71
|
-
};
|
|
72
|
-
const clearDocumentAuth = (documentName) => {
|
|
73
|
-
delete auth[documentName];
|
|
74
|
-
hooks?.onAuthChange?.(documentName);
|
|
75
|
-
};
|
|
76
|
-
const load = (data) => {
|
|
77
|
-
safeAssign(auth, coerceValue(DocumentAuthSchema, data));
|
|
78
|
-
Object.keys(data).forEach((documentName) => {
|
|
79
|
-
hooks?.onAuthChange?.(documentName);
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
const exportAuth = () => {
|
|
83
|
-
return unpackProxyObject(auth);
|
|
84
|
-
};
|
|
85
|
-
return {
|
|
86
|
-
clearAuthSelectedSchemas,
|
|
87
|
-
getAuthSecrets,
|
|
88
|
-
setAuthSecrets,
|
|
89
|
-
clearAuthSecrets,
|
|
90
|
-
getAuthSelectedSchemas,
|
|
91
|
-
setAuthSelectedSchemas,
|
|
92
|
-
clearDocumentAuth,
|
|
93
|
-
load,
|
|
94
|
-
export: exportAuth
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
export {
|
|
98
|
-
AuthSchema,
|
|
99
|
-
OpenIDConnectSchema,
|
|
100
|
-
SecretsAuthSchema,
|
|
101
|
-
createAuthStore
|
|
102
98
|
};
|
|
103
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,123 +1,49 @@
|
|
|
1
|
-
import { Type } from
|
|
2
|
-
import { compose } from
|
|
3
|
-
import { XScalarCredentialsLocationSchema } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
OAuthFlowClientCredentialsSchema,
|
|
15
|
-
OAuthFlowImplicitSchema,
|
|
16
|
-
OAuthFlowPasswordSchema
|
|
17
|
-
} from "../../schemas/v3.1/strict/oauth-flow.js";
|
|
18
|
-
import { SecurityRequirementObjectSchema } from "../../schemas/v3.1/strict/openapi-document.js";
|
|
19
|
-
const SecretsApiKeySchema = compose(
|
|
20
|
-
Type.Object({
|
|
21
|
-
type: Type.Literal("apiKey")
|
|
22
|
-
}),
|
|
23
|
-
XScalarSecretTokenSchema
|
|
24
|
-
);
|
|
25
|
-
const SecretsHttpSchema = compose(
|
|
26
|
-
Type.Object({
|
|
27
|
-
type: Type.Literal("http")
|
|
28
|
-
}),
|
|
29
|
-
XScalarSecretTokenSchema,
|
|
30
|
-
XScalarSecretHTTPSchema
|
|
31
|
-
);
|
|
32
|
-
const SecretsOAuthFlowCommonSchema = compose(
|
|
33
|
-
XScalarSecretClientIdSchema,
|
|
34
|
-
XScalarSecretTokenSchema,
|
|
35
|
-
XScalarSecretRefreshTokenSchema
|
|
36
|
-
);
|
|
1
|
+
import { Type } from '@scalar/typebox';
|
|
2
|
+
import { compose } from '../../schemas/compose.js';
|
|
3
|
+
import { XScalarCredentialsLocationSchema } from '../../schemas/extensions/security/x-scalar-credentials-location.js';
|
|
4
|
+
import { XScalarSecretClientIdSchema, XScalarSecretClientSecretSchema, XScalarSecretHTTPSchema, XScalarSecretRefreshTokenSchema, XScalarSecretRedirectUriSchema, XScalarSecretTokenSchema, } from '../../schemas/extensions/security/x-scalar-security-secrets.js';
|
|
5
|
+
import { OAuthFlowAuthorizationCodeSchema, OAuthFlowClientCredentialsSchema, OAuthFlowImplicitSchema, OAuthFlowPasswordSchema, } from '../../schemas/v3.1/strict/oauth-flow.js';
|
|
6
|
+
import { SecurityRequirementObjectSchema } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
7
|
+
const SecretsApiKeySchema = compose(Type.Object({
|
|
8
|
+
type: Type.Literal('apiKey'),
|
|
9
|
+
}), XScalarSecretTokenSchema);
|
|
10
|
+
const SecretsHttpSchema = compose(Type.Object({
|
|
11
|
+
type: Type.Literal('http'),
|
|
12
|
+
}), XScalarSecretTokenSchema, XScalarSecretHTTPSchema);
|
|
13
|
+
const SecretsOAuthFlowCommonSchema = compose(XScalarSecretClientIdSchema, XScalarSecretTokenSchema, XScalarSecretRefreshTokenSchema);
|
|
37
14
|
const SecretsOAuthFlowsSchema = Type.Object({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
compose(
|
|
41
|
-
|
|
42
|
-
XScalarSecretHTTPSchema,
|
|
43
|
-
XScalarSecretClientSecretSchema,
|
|
44
|
-
XScalarCredentialsLocationSchema
|
|
45
|
-
)
|
|
46
|
-
),
|
|
47
|
-
clientCredentials: Type.Optional(
|
|
48
|
-
compose(SecretsOAuthFlowCommonSchema, XScalarSecretClientSecretSchema, XScalarCredentialsLocationSchema)
|
|
49
|
-
),
|
|
50
|
-
authorizationCode: Type.Optional(
|
|
51
|
-
compose(
|
|
52
|
-
SecretsOAuthFlowCommonSchema,
|
|
53
|
-
XScalarSecretClientSecretSchema,
|
|
54
|
-
XScalarSecretRedirectUriSchema,
|
|
55
|
-
XScalarCredentialsLocationSchema
|
|
56
|
-
)
|
|
57
|
-
)
|
|
15
|
+
implicit: Type.Optional(compose(SecretsOAuthFlowCommonSchema, XScalarSecretRedirectUriSchema)),
|
|
16
|
+
password: Type.Optional(compose(SecretsOAuthFlowCommonSchema, XScalarSecretHTTPSchema, XScalarSecretClientSecretSchema, XScalarCredentialsLocationSchema)),
|
|
17
|
+
clientCredentials: Type.Optional(compose(SecretsOAuthFlowCommonSchema, XScalarSecretClientSecretSchema, XScalarCredentialsLocationSchema)),
|
|
18
|
+
authorizationCode: Type.Optional(compose(SecretsOAuthFlowCommonSchema, XScalarSecretClientSecretSchema, XScalarSecretRedirectUriSchema, XScalarCredentialsLocationSchema)),
|
|
58
19
|
});
|
|
59
|
-
const OAuthSchema = compose(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
compose(
|
|
69
|
-
),
|
|
70
|
-
password: Type.Optional(
|
|
71
|
-
compose(
|
|
72
|
-
OAuthFlowPasswordSchema,
|
|
73
|
-
SecretsOAuthFlowCommonSchema,
|
|
74
|
-
XScalarSecretHTTPSchema,
|
|
75
|
-
XScalarSecretClientSecretSchema,
|
|
76
|
-
XScalarCredentialsLocationSchema
|
|
77
|
-
)
|
|
78
|
-
),
|
|
79
|
-
clientCredentials: Type.Optional(
|
|
80
|
-
compose(
|
|
81
|
-
OAuthFlowClientCredentialsSchema,
|
|
82
|
-
SecretsOAuthFlowCommonSchema,
|
|
83
|
-
XScalarSecretClientSecretSchema,
|
|
84
|
-
XScalarCredentialsLocationSchema
|
|
85
|
-
)
|
|
86
|
-
),
|
|
87
|
-
authorizationCode: Type.Optional(
|
|
88
|
-
compose(
|
|
89
|
-
OAuthFlowAuthorizationCodeSchema,
|
|
90
|
-
SecretsOAuthFlowCommonSchema,
|
|
91
|
-
XScalarSecretClientSecretSchema,
|
|
92
|
-
XScalarSecretRedirectUriSchema,
|
|
93
|
-
XScalarCredentialsLocationSchema
|
|
94
|
-
)
|
|
95
|
-
)
|
|
20
|
+
const OAuthSchema = compose(Type.Object({
|
|
21
|
+
type: Type.Literal('oauth2'),
|
|
22
|
+
}), SecretsOAuthFlowsSchema);
|
|
23
|
+
/** OpenID Connect schema contain the base flows as well since it doesn't exist in the spec */
|
|
24
|
+
export const OpenIDConnectSchema = Type.Object({
|
|
25
|
+
type: Type.Literal('openIdConnect'),
|
|
26
|
+
implicit: Type.Optional(compose(OAuthFlowImplicitSchema, SecretsOAuthFlowCommonSchema, XScalarSecretRedirectUriSchema)),
|
|
27
|
+
password: Type.Optional(compose(OAuthFlowPasswordSchema, SecretsOAuthFlowCommonSchema, XScalarSecretHTTPSchema, XScalarSecretClientSecretSchema, XScalarCredentialsLocationSchema)),
|
|
28
|
+
clientCredentials: Type.Optional(compose(OAuthFlowClientCredentialsSchema, SecretsOAuthFlowCommonSchema, XScalarSecretClientSecretSchema, XScalarCredentialsLocationSchema)),
|
|
29
|
+
authorizationCode: Type.Optional(compose(OAuthFlowAuthorizationCodeSchema, SecretsOAuthFlowCommonSchema, XScalarSecretClientSecretSchema, XScalarSecretRedirectUriSchema, XScalarCredentialsLocationSchema)),
|
|
96
30
|
});
|
|
97
|
-
const SecretsAuthUnionSchema = Type.Union([
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
31
|
+
export const SecretsAuthUnionSchema = Type.Union([
|
|
32
|
+
SecretsApiKeySchema,
|
|
33
|
+
SecretsHttpSchema,
|
|
34
|
+
OAuthSchema,
|
|
35
|
+
OpenIDConnectSchema,
|
|
102
36
|
]);
|
|
103
|
-
const SecretsAuthSchema = Type.Record(Type.String(), SecretsAuthUnionSchema);
|
|
37
|
+
export const SecretsAuthSchema = Type.Record(Type.String(), SecretsAuthUnionSchema);
|
|
104
38
|
const SelectedSecuritySchema = Type.Object({
|
|
105
|
-
|
|
106
|
-
|
|
39
|
+
selectedIndex: Type.Number(),
|
|
40
|
+
selectedSchemes: Type.Array(SecurityRequirementObjectSchema),
|
|
107
41
|
});
|
|
108
|
-
const AuthSchema = Type.Object({
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
42
|
+
export const AuthSchema = Type.Object({
|
|
43
|
+
secrets: SecretsAuthSchema,
|
|
44
|
+
selected: Type.Object({
|
|
45
|
+
document: Type.Optional(SelectedSecuritySchema),
|
|
46
|
+
path: Type.Optional(Type.Record(Type.String(), Type.Record(Type.String(), Type.Optional(SelectedSecuritySchema)))),
|
|
47
|
+
}),
|
|
114
48
|
});
|
|
115
|
-
const DocumentAuthSchema = Type.Record(Type.String(), AuthSchema);
|
|
116
|
-
export {
|
|
117
|
-
AuthSchema,
|
|
118
|
-
DocumentAuthSchema,
|
|
119
|
-
OpenIDConnectSchema,
|
|
120
|
-
SecretsAuthSchema,
|
|
121
|
-
SecretsAuthUnionSchema
|
|
122
|
-
};
|
|
123
|
-
//# sourceMappingURL=schema.js.map
|
|
49
|
+
export const DocumentAuthSchema = Type.Record(Type.String(), AuthSchema);
|
|
@@ -1,62 +1,82 @@
|
|
|
1
|
-
import { reactive } from
|
|
2
|
-
import { DocumentHistorySchema } from
|
|
3
|
-
import { safeAssign } from
|
|
4
|
-
import { unpackProxyObject } from
|
|
5
|
-
import { coerceValue } from
|
|
1
|
+
import { reactive } from 'vue';
|
|
2
|
+
import { DocumentHistorySchema } from '../../entities/history/schema.js';
|
|
3
|
+
import { safeAssign } from '../../helpers/general.js';
|
|
4
|
+
import { unpackProxyObject } from '../../helpers/unpack-proxy.js';
|
|
5
|
+
import { coerceValue } from '../../schemas/typebox-coerce.js';
|
|
6
6
|
const HISTORY_LIMIT = 5;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Creates a reactive history store for tracking request and response entries for documents and operations.
|
|
9
|
+
*
|
|
10
|
+
* @param hooks (Optional) - Lifecycle hooks for store events, such as onHistoryChange.
|
|
11
|
+
* @returns HistoryStore - Methods for interacting with the operation history.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const historyStore = createHistoryStore({
|
|
16
|
+
* hooks: {
|
|
17
|
+
* onHistoryChange: (documentName, operationName, history) => {
|
|
18
|
+
* console.log(`History changed for ${documentName}/${operationName}`, history)
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* // Add a history entry
|
|
24
|
+
* historyStore.addHistory('petstore.yaml', 'getPets', { ...entry })
|
|
25
|
+
*
|
|
26
|
+
* // Get history entries for an operation
|
|
27
|
+
* const entries = historyStore.getHistory('petstore.yaml', 'getPets')
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export const createHistoryStore = ({ hooks, }) => {
|
|
31
|
+
const history = reactive({});
|
|
32
|
+
const getHistory = (documentName, path, method) => {
|
|
33
|
+
return history[documentName]?.[path]?.[method];
|
|
34
|
+
};
|
|
35
|
+
const addHistory = (documentName, path, method, entry) => {
|
|
36
|
+
history[documentName] ||= {};
|
|
37
|
+
history[documentName][path] ||= {};
|
|
38
|
+
history[documentName][path][method] ||= [];
|
|
39
|
+
// We want to make sure that the history is not full
|
|
40
|
+
if (history[documentName][path][method].length >= HISTORY_LIMIT) {
|
|
41
|
+
// Delete the oldest entry
|
|
42
|
+
// We need to unpack the history array to avoid proxy object issues
|
|
43
|
+
history[documentName][path][method] = unpackProxyObject(history[documentName][path][method].filter((_, i) => i !== 0), { depth: 1 });
|
|
44
|
+
}
|
|
45
|
+
// Add the new entry to the history
|
|
46
|
+
history[documentName][path][method].push(entry);
|
|
47
|
+
// Explicitly trigger the change event once after all modifications
|
|
48
|
+
hooks?.onHistoryChange?.(documentName);
|
|
49
|
+
};
|
|
50
|
+
const clearOperationHistory = (documentName, path, method) => {
|
|
51
|
+
delete history[documentName]?.[path]?.[method];
|
|
52
|
+
hooks?.onHistoryChange?.(documentName);
|
|
53
|
+
};
|
|
54
|
+
const clearPathHistory = (documentName, path) => {
|
|
55
|
+
delete history[documentName]?.[path];
|
|
56
|
+
hooks?.onHistoryChange?.(documentName);
|
|
57
|
+
};
|
|
58
|
+
const clearDocumentHistory = (documentName) => {
|
|
59
|
+
delete history[documentName];
|
|
60
|
+
hooks?.onHistoryChange?.(documentName);
|
|
61
|
+
};
|
|
62
|
+
const load = (data) => {
|
|
63
|
+
const coercedData = coerceValue(DocumentHistorySchema, data);
|
|
64
|
+
safeAssign(history, coercedData);
|
|
65
|
+
// Trigger change events for all loaded documents
|
|
66
|
+
Object.keys(coercedData).forEach((documentName) => {
|
|
67
|
+
hooks?.onHistoryChange?.(documentName);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const exportHistory = () => {
|
|
71
|
+
return unpackProxyObject(history);
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
getHistory,
|
|
75
|
+
addHistory,
|
|
76
|
+
clearOperationHistory,
|
|
77
|
+
clearPathHistory,
|
|
78
|
+
clearDocumentHistory,
|
|
79
|
+
load,
|
|
80
|
+
export: exportHistory,
|
|
81
|
+
};
|
|
58
82
|
};
|
|
59
|
-
export {
|
|
60
|
-
createHistoryStore
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=index.js.map
|