@makeswift/runtime 0.28.8-canary.9 → 0.28.9-canary.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/dist/cjs/api/api-resources-client.js +3 -0
- package/dist/cjs/api/api-resources-client.js.map +1 -1
- package/dist/cjs/api/graphql-api-client.js +1 -1
- package/dist/cjs/api/ky.js +862 -0
- package/dist/cjs/api/ky.js.map +1 -0
- package/dist/cjs/api/rest-api-client.js +85 -43
- package/dist/cjs/api/rest-api-client.js.map +1 -1
- package/dist/cjs/api/types.js.map +1 -1
- package/dist/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/builder/host-to-builder-actions.js +5 -5
- package/dist/cjs/builder/host-to-builder-actions.js.map +1 -1
- package/dist/cjs/client/index.js +40 -44
- package/dist/cjs/client/index.js.map +1 -1
- package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
- package/dist/cjs/controls/rich-text/control.js +16 -3
- package/dist/cjs/controls/rich-text/control.js.map +1 -1
- package/dist/cjs/controls/rich-text/rich-text.js +2 -2
- package/dist/cjs/controls/rich-text/rich-text.js.map +1 -1
- package/dist/cjs/controls/rich-text-v2/control.js +15 -2
- package/dist/cjs/controls/rich-text-v2/control.js.map +1 -1
- package/dist/cjs/controls/rich-text-v2/rich-text-v2.js +2 -2
- package/dist/cjs/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/cjs/controls/slot.js.map +1 -1
- package/dist/cjs/next/testing/breakpoints.js +3 -15
- package/dist/cjs/next/testing/breakpoints.js.map +1 -1
- package/dist/cjs/next/testing/element-data.js +3 -82
- package/dist/cjs/next/testing/element-data.js.map +1 -1
- package/dist/cjs/next/testing/react-runtime.js.map +1 -1
- package/dist/cjs/prop-controllers/instances.js +20 -4
- package/dist/cjs/prop-controllers/instances.js.map +1 -1
- package/dist/cjs/runtimes/react/components/Element.js +53 -24
- package/dist/cjs/runtimes/react/components/Element.js.map +1 -1
- package/dist/cjs/runtimes/react/components/ElementRegistration.js +32 -11
- package/dist/cjs/runtimes/react/components/ElementRegistration.js.map +1 -1
- package/dist/cjs/runtimes/react/components/control-instances-context.js +38 -0
- package/dist/cjs/runtimes/react/components/control-instances-context.js.map +1 -0
- package/dist/cjs/runtimes/react/components/framework-context.js +1 -0
- package/dist/cjs/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/cjs/runtimes/react/components/resolve-props.js +5 -1
- package/dist/cjs/runtimes/react/components/resolve-props.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/node-value/editable-node-value.js +42 -0
- package/dist/cjs/runtimes/react/controls/node-value/editable-node-value.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/node-value/index.js +51 -0
- package/dist/cjs/runtimes/react/controls/node-value/index.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js +2 -2
- package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/slot/index.js +29 -0
- package/dist/cjs/runtimes/react/controls/slot/index.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/slot/render-slot.js +37 -0
- package/dist/cjs/runtimes/react/controls/slot/render-slot.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/{slot.js → slot/slot-value.js} +31 -26
- package/dist/cjs/runtimes/react/controls/slot/slot-value.js.map +1 -0
- package/dist/cjs/runtimes/react/element-imperative-handle.js +2 -2
- package/dist/cjs/runtimes/react/element-imperative-handle.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-control-instance.js +88 -0
- package/dist/cjs/runtimes/react/hooks/use-control-instance.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-control-instances.js +2 -12
- package/dist/cjs/runtimes/react/hooks/use-control-instances.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-disable-register-element.js +3 -3
- package/dist/cjs/runtimes/react/hooks/use-disable-register-element.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js +10 -9
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-resolved-value-override.js +58 -0
- package/dist/cjs/runtimes/react/hooks/use-resolved-value-override.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-selector.js +8 -2
- package/dist/cjs/runtimes/react/hooks/use-selector.js.map +1 -1
- package/dist/cjs/runtimes/react/testing/index.js +25 -0
- package/dist/cjs/runtimes/react/testing/index.js.map +1 -0
- package/dist/cjs/runtimes/react/testing/react-provider.js +38 -0
- package/dist/cjs/runtimes/react/testing/react-provider.js.map +1 -0
- package/dist/cjs/state/actions/index.js +4 -4
- package/dist/cjs/state/actions/index.js.map +1 -1
- package/dist/cjs/state/actions/internal/action-types.js +34 -0
- package/dist/cjs/state/actions/internal/action-types.js.map +1 -0
- package/dist/cjs/state/actions/internal/index.js +0 -17
- package/dist/cjs/state/actions/internal/index.js.map +1 -1
- package/dist/cjs/state/actions/internal/read-only-action-types.js +44 -0
- package/dist/cjs/state/actions/internal/read-only-action-types.js.map +1 -0
- package/dist/cjs/state/actions/internal/read-only-actions.js +13 -92
- package/dist/cjs/state/actions/internal/read-only-actions.js.map +1 -1
- package/dist/cjs/state/actions/internal/read-write-action-types.js +44 -0
- package/dist/cjs/state/actions/internal/read-write-action-types.js.map +1 -0
- package/dist/cjs/state/actions/internal/read-write-actions.js +135 -14
- package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -1
- package/dist/cjs/state/api-client/state.js +8 -0
- package/dist/cjs/state/api-client/state.js.map +1 -1
- package/dist/cjs/state/builder-api/action-types.js +49 -0
- package/dist/cjs/state/builder-api/action-types.js.map +1 -0
- package/dist/cjs/state/builder-api/actions.js +14 -36
- package/dist/cjs/state/builder-api/actions.js.map +1 -1
- package/dist/cjs/state/builder-api/proxy.js +2 -1
- package/dist/cjs/state/builder-api/proxy.js.map +1 -1
- package/dist/cjs/state/host-api/action-types.js +43 -0
- package/dist/cjs/state/host-api/action-types.js.map +1 -0
- package/dist/cjs/state/{host-api.js → host-api/actions.js} +17 -33
- package/dist/cjs/state/host-api/actions.js.map +1 -0
- package/dist/cjs/state/host-api/index.js +25 -0
- package/dist/cjs/state/host-api/index.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/builder-api/index.js +2 -58
- package/dist/cjs/state/middleware/read-write/builder-api/index.js.map +1 -1
- package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js +3 -0
- package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -1
- package/dist/cjs/state/middleware/read-write/builder-api/middleware.js +89 -0
- package/dist/cjs/state/middleware/read-write/builder-api/middleware.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/builder-api/mount-change-action-buffer.js +72 -0
- package/dist/cjs/state/middleware/read-write/builder-api/mount-change-action-buffer.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/measure-box-models.js +3 -3
- package/dist/cjs/state/middleware/read-write/measure-box-models.js.map +1 -1
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js +10 -47
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js.map +1 -1
- package/dist/cjs/state/modules/api-resources.js +5 -5
- package/dist/cjs/state/modules/api-resources.js.map +1 -1
- package/dist/cjs/state/modules/breakpoints.js +4 -4
- package/dist/cjs/state/modules/breakpoints.js.map +1 -1
- package/dist/cjs/state/modules/components-meta.js +3 -3
- package/dist/cjs/state/modules/components-meta.js.map +1 -1
- package/dist/cjs/state/modules/element-trees.js +5 -5
- package/dist/cjs/state/modules/element-trees.js.map +1 -1
- package/dist/cjs/state/modules/is-in-builder.js +2 -2
- package/dist/cjs/state/modules/is-in-builder.js.map +1 -1
- package/dist/cjs/state/modules/is-read-only.js +2 -2
- package/dist/cjs/state/modules/is-read-only.js.map +1 -1
- package/dist/cjs/state/modules/locale.js +2 -2
- package/dist/cjs/state/modules/locale.js.map +1 -1
- package/dist/cjs/state/modules/localized-resources-map.js +3 -3
- package/dist/cjs/state/modules/localized-resources-map.js.map +1 -1
- package/dist/cjs/state/modules/{prop-controllers.js → prop-controller-descriptors.js} +7 -7
- package/dist/cjs/state/modules/prop-controller-descriptors.js.map +1 -0
- package/dist/cjs/state/modules/react-components.js +3 -3
- package/dist/cjs/state/modules/react-components.js.map +1 -1
- package/dist/cjs/state/modules/read-write/box-models.js +5 -5
- package/dist/cjs/state/modules/read-write/box-models.js.map +1 -1
- package/dist/cjs/state/modules/read-write/element-imperative-handles.js +3 -3
- package/dist/cjs/state/modules/read-write/element-imperative-handles.js.map +1 -1
- package/dist/cjs/state/modules/{prop-controller-handles.js → read-write/prop-controllers.js} +5 -5
- package/dist/cjs/state/modules/read-write/prop-controllers.js.map +1 -0
- package/dist/cjs/state/modules/read-write/resolved-value-overrides.js +70 -0
- package/dist/cjs/state/modules/read-write/resolved-value-overrides.js.map +1 -0
- package/dist/cjs/state/read-only-state.js +9 -44
- package/dist/cjs/state/read-only-state.js.map +1 -1
- package/dist/cjs/state/read-write-state.js +61 -1
- package/dist/cjs/state/read-write-state.js.map +1 -1
- package/dist/cjs/state/shared-api/action-types.js +33 -0
- package/dist/cjs/state/shared-api/action-types.js.map +1 -0
- package/dist/cjs/state/{shared-api.js → shared-api/actions.js} +8 -14
- package/dist/cjs/state/shared-api/actions.js.map +1 -0
- package/dist/cjs/state/shared-api/index.js +25 -0
- package/dist/cjs/state/shared-api/index.js.map +1 -0
- package/dist/cjs/state/store.js +5 -3
- package/dist/cjs/state/store.js.map +1 -1
- package/dist/cjs/state/translations/get.js.map +1 -1
- package/dist/cjs/state/translations/merge.js.map +1 -1
- package/dist/cjs/state/unified-state.js +12 -0
- package/dist/cjs/state/unified-state.js.map +1 -1
- package/dist/cjs/testing/breakpoints.js +35 -0
- package/dist/cjs/testing/breakpoints.js.map +1 -0
- package/dist/cjs/testing/element-data.js +102 -0
- package/dist/cjs/testing/element-data.js.map +1 -0
- package/dist/cjs/testing/read-write-state.js +32 -0
- package/dist/cjs/testing/read-write-state.js.map +1 -0
- package/dist/cjs/translations/index.js.map +1 -1
- package/dist/esm/api/api-resources-client.js +3 -0
- package/dist/esm/api/api-resources-client.js.map +1 -1
- package/dist/esm/api/graphql-api-client.js +1 -1
- package/dist/esm/api/ky.js +7 -0
- package/dist/esm/api/ky.js.map +1 -0
- package/dist/esm/api/rest-api-client.js +84 -43
- package/dist/esm/api/rest-api-client.js.map +1 -1
- package/dist/esm/api/types.js.map +1 -1
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/builder/host-to-builder-actions.js +2 -4
- package/dist/esm/builder/host-to-builder-actions.js.map +1 -1
- package/dist/esm/client/index.js +45 -45
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/components/builtin/Form/Form.js.map +1 -1
- package/dist/esm/controls/rich-text/control.js +16 -3
- package/dist/esm/controls/rich-text/control.js.map +1 -1
- package/dist/esm/controls/rich-text/rich-text.js +2 -2
- package/dist/esm/controls/rich-text/rich-text.js.map +1 -1
- package/dist/esm/controls/rich-text-v2/control.js +15 -2
- package/dist/esm/controls/rich-text-v2/control.js.map +1 -1
- package/dist/esm/controls/rich-text-v2/rich-text-v2.js +2 -2
- package/dist/esm/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/esm/controls/slot.js.map +1 -1
- package/dist/esm/next/testing/breakpoints.js +1 -8
- package/dist/esm/next/testing/breakpoints.js.map +1 -1
- package/dist/esm/next/testing/element-data.js +1 -75
- package/dist/esm/next/testing/element-data.js.map +1 -1
- package/dist/esm/next/testing/react-runtime.js.map +1 -1
- package/dist/esm/prop-controllers/instances.js +20 -4
- package/dist/esm/prop-controllers/instances.js.map +1 -1
- package/dist/esm/runtimes/react/components/Element.js +51 -25
- package/dist/esm/runtimes/react/components/Element.js.map +1 -1
- package/dist/esm/runtimes/react/components/ElementRegistration.js +37 -12
- package/dist/esm/runtimes/react/components/ElementRegistration.js.map +1 -1
- package/dist/esm/runtimes/react/components/control-instances-context.js +13 -0
- package/dist/esm/runtimes/react/components/control-instances-context.js.map +1 -0
- package/dist/esm/runtimes/react/components/framework-context.js +1 -0
- package/dist/esm/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/esm/runtimes/react/components/resolve-props.js +5 -1
- package/dist/esm/runtimes/react/components/resolve-props.js.map +1 -1
- package/dist/esm/runtimes/react/controls/node-value/editable-node-value.js +21 -0
- package/dist/esm/runtimes/react/controls/node-value/editable-node-value.js.map +1 -0
- package/dist/esm/runtimes/react/controls/node-value/index.js +17 -0
- package/dist/esm/runtimes/react/controls/node-value/index.js.map +1 -0
- package/dist/esm/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/rich-text.js +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
- package/dist/esm/runtimes/react/controls/slot/index.js +5 -0
- package/dist/esm/runtimes/react/controls/slot/index.js.map +1 -0
- package/dist/esm/runtimes/react/controls/slot/render-slot.js +13 -0
- package/dist/esm/runtimes/react/controls/slot/render-slot.js.map +1 -0
- package/dist/esm/runtimes/react/controls/{slot.js → slot/slot-value.js} +34 -23
- package/dist/esm/runtimes/react/controls/slot/slot-value.js.map +1 -0
- package/dist/esm/runtimes/react/element-imperative-handle.js +1 -1
- package/dist/esm/runtimes/react/element-imperative-handle.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-control-instance.js +62 -0
- package/dist/esm/runtimes/react/hooks/use-control-instance.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-control-instances.js +1 -11
- package/dist/esm/runtimes/react/hooks/use-control-instances.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-disable-register-element.js +2 -2
- package/dist/esm/runtimes/react/hooks/use-disable-register-element.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js +10 -9
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-resolved-value-override.js +35 -0
- package/dist/esm/runtimes/react/hooks/use-resolved-value-override.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-selector.js +8 -2
- package/dist/esm/runtimes/react/hooks/use-selector.js.map +1 -1
- package/dist/esm/runtimes/react/testing/index.js +3 -0
- package/dist/esm/runtimes/react/testing/index.js.map +1 -0
- package/dist/esm/runtimes/react/testing/react-provider.js +14 -0
- package/dist/esm/runtimes/react/testing/react-provider.js.map +1 -0
- package/dist/esm/state/actions/index.js +2 -2
- package/dist/esm/state/actions/index.js.map +1 -1
- package/dist/esm/state/actions/internal/action-types.js +10 -0
- package/dist/esm/state/actions/internal/action-types.js.map +1 -0
- package/dist/esm/state/actions/internal/index.js +0 -9
- package/dist/esm/state/actions/internal/index.js.map +1 -1
- package/dist/esm/state/actions/internal/read-only-action-types.js +20 -0
- package/dist/esm/state/actions/internal/read-only-action-types.js.map +1 -0
- package/dist/esm/state/actions/internal/read-only-actions.js +1 -73
- package/dist/esm/state/actions/internal/read-only-actions.js.map +1 -1
- package/dist/esm/state/actions/internal/read-write-action-types.js +20 -0
- package/dist/esm/state/actions/internal/read-write-action-types.js.map +1 -0
- package/dist/esm/state/actions/internal/read-write-actions.js +108 -8
- package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -1
- package/dist/esm/state/api-client/state.js +7 -0
- package/dist/esm/state/api-client/state.js.map +1 -1
- package/dist/esm/state/builder-api/action-types.js +25 -0
- package/dist/esm/state/builder-api/action-types.js.map +1 -0
- package/dist/esm/state/builder-api/actions.js +1 -24
- package/dist/esm/state/builder-api/actions.js.map +1 -1
- package/dist/esm/state/builder-api/proxy.js +2 -1
- package/dist/esm/state/builder-api/proxy.js.map +1 -1
- package/dist/esm/state/host-api/action-types.js +19 -0
- package/dist/esm/state/host-api/action-types.js.map +1 -0
- package/dist/esm/state/{host-api.js → host-api/actions.js} +2 -17
- package/dist/esm/state/host-api/actions.js.map +1 -0
- package/dist/esm/state/host-api/index.js +3 -0
- package/dist/esm/state/host-api/index.js.map +1 -0
- package/dist/esm/state/middleware/read-write/builder-api/index.js +1 -57
- package/dist/esm/state/middleware/read-write/builder-api/index.js.map +1 -1
- package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js +3 -0
- package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -1
- package/dist/esm/state/middleware/read-write/builder-api/middleware.js +65 -0
- package/dist/esm/state/middleware/read-write/builder-api/middleware.js.map +1 -0
- package/dist/esm/state/middleware/read-write/builder-api/mount-change-action-buffer.js +48 -0
- package/dist/esm/state/middleware/read-write/builder-api/mount-change-action-buffer.js.map +1 -0
- package/dist/esm/state/middleware/read-write/measure-box-models.js +3 -3
- package/dist/esm/state/middleware/read-write/measure-box-models.js.map +1 -1
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js +13 -47
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js.map +1 -1
- package/dist/esm/state/modules/api-resources.js +2 -2
- package/dist/esm/state/modules/api-resources.js.map +1 -1
- package/dist/esm/state/modules/breakpoints.js +2 -2
- package/dist/esm/state/modules/breakpoints.js.map +1 -1
- package/dist/esm/state/modules/components-meta.js +1 -1
- package/dist/esm/state/modules/components-meta.js.map +1 -1
- package/dist/esm/state/modules/element-trees.js +2 -2
- package/dist/esm/state/modules/element-trees.js.map +1 -1
- package/dist/esm/state/modules/is-in-builder.js +1 -1
- package/dist/esm/state/modules/is-in-builder.js.map +1 -1
- package/dist/esm/state/modules/is-read-only.js +1 -1
- package/dist/esm/state/modules/is-read-only.js.map +1 -1
- package/dist/esm/state/modules/locale.js +1 -1
- package/dist/esm/state/modules/locale.js.map +1 -1
- package/dist/esm/state/modules/localized-resources-map.js +1 -1
- package/dist/esm/state/modules/localized-resources-map.js.map +1 -1
- package/dist/esm/state/modules/{prop-controllers.js → prop-controller-descriptors.js} +2 -2
- package/dist/esm/state/modules/prop-controller-descriptors.js.map +1 -0
- package/dist/esm/state/modules/react-components.js +1 -1
- package/dist/esm/state/modules/react-components.js.map +1 -1
- package/dist/esm/state/modules/read-write/box-models.js +2 -2
- package/dist/esm/state/modules/read-write/box-models.js.map +1 -1
- package/dist/esm/state/modules/read-write/element-imperative-handles.js +3 -3
- package/dist/esm/state/modules/read-write/element-imperative-handles.js.map +1 -1
- package/dist/esm/state/modules/{prop-controller-handles.js → read-write/prop-controllers.js} +2 -2
- package/dist/esm/state/modules/read-write/prop-controllers.js.map +1 -0
- package/dist/esm/state/modules/read-write/resolved-value-overrides.js +43 -0
- package/dist/esm/state/modules/read-write/resolved-value-overrides.js.map +1 -0
- package/dist/esm/state/read-only-state.js +9 -41
- package/dist/esm/state/read-only-state.js.map +1 -1
- package/dist/esm/state/read-write-state.js +56 -1
- package/dist/esm/state/read-write-state.js.map +1 -1
- package/dist/esm/state/shared-api/action-types.js +9 -0
- package/dist/esm/state/shared-api/action-types.js.map +1 -0
- package/dist/esm/state/{shared-api.js → shared-api/actions.js} +2 -7
- package/dist/esm/state/shared-api/actions.js.map +1 -0
- package/dist/esm/state/shared-api/index.js +3 -0
- package/dist/esm/state/shared-api/index.js.map +1 -0
- package/dist/esm/state/store.js +3 -1
- package/dist/esm/state/store.js.map +1 -1
- package/dist/esm/state/translations/get.js.map +1 -1
- package/dist/esm/state/translations/merge.js +3 -1
- package/dist/esm/state/translations/merge.js.map +1 -1
- package/dist/esm/state/unified-state.js +4 -0
- package/dist/esm/state/unified-state.js.map +1 -1
- package/dist/esm/testing/breakpoints.js +9 -0
- package/dist/esm/testing/breakpoints.js.map +1 -0
- package/dist/esm/testing/element-data.js +76 -0
- package/dist/esm/testing/element-data.js.map +1 -0
- package/dist/esm/testing/read-write-state.js +8 -0
- package/dist/esm/testing/read-write-state.js.map +1 -0
- package/dist/esm/translations/index.js.map +1 -1
- package/dist/types/api/__tests__/rest-api-client.retries.test.d.ts +2 -0
- package/dist/types/api/__tests__/rest-api-client.retries.test.d.ts.map +1 -0
- package/dist/types/api/api-resources-client.d.ts +1 -0
- package/dist/types/api/api-resources-client.d.ts.map +1 -1
- package/dist/types/api/ky.d.ts +3 -0
- package/dist/types/api/ky.d.ts.map +1 -0
- package/dist/types/api/rest-api-client.d.ts +4 -0
- package/dist/types/api/rest-api-client.d.ts.map +1 -1
- package/dist/types/api/schema/page-pathname-slice.d.ts +2 -2
- package/dist/types/api/types.d.ts +1 -1
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts +6 -6
- package/dist/types/api-handler/handlers/webhook/types.d.ts +20 -20
- package/dist/types/builder/host-to-builder-actions.d.ts.map +1 -1
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/Form.d.ts +1 -1
- package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
- package/dist/types/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/types/components/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/types/controls/__tests__/slot.test.d.ts +3 -0
- package/dist/types/controls/__tests__/slot.test.d.ts.map +1 -0
- package/dist/types/controls/rich-text/control.d.ts +5 -1
- package/dist/types/controls/rich-text/control.d.ts.map +1 -1
- package/dist/types/controls/rich-text/rich-text.d.ts +2 -2
- package/dist/types/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/controls/rich-text-v2/control.d.ts +6 -2
- package/dist/types/controls/rich-text-v2/control.d.ts.map +1 -1
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts +2 -2
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/controls/slot.d.ts +1 -1
- package/dist/types/controls/slot.d.ts.map +1 -1
- package/dist/types/locale.d.ts +1 -1
- package/dist/types/next/testing/breakpoints.d.ts +1 -3
- package/dist/types/next/testing/breakpoints.d.ts.map +1 -1
- package/dist/types/next/testing/element-data.d.ts +1 -54
- package/dist/types/next/testing/element-data.d.ts.map +1 -1
- package/dist/types/next/testing/react-runtime.d.ts.map +1 -1
- package/dist/types/prop-controllers/instances.d.ts +9 -3
- package/dist/types/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/Element.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/ElementRegistration.d.ts +4 -4
- package/dist/types/runtimes/react/components/ElementRegistration.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/__tests__/element-registration.test.d.ts +3 -0
- package/dist/types/runtimes/react/components/__tests__/element-registration.test.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/control-instances-context.d.ts +9 -0
- package/dist/types/runtimes/react/components/control-instances-context.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/framework-context.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/resolve-props.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/node-value/editable-node-value.d.ts +7 -0
- package/dist/types/runtimes/react/controls/node-value/editable-node-value.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/node-value/index.d.ts +6 -0
- package/dist/types/runtimes/react/controls/node-value/index.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts +1 -1
- package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/slot/index.d.ts +2 -0
- package/dist/types/runtimes/react/controls/slot/index.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/slot/render-slot.d.ts +9 -0
- package/dist/types/runtimes/react/controls/slot/render-slot.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/{slot.d.ts → slot/slot-value.d.ts} +7 -7
- package/dist/types/runtimes/react/controls/slot/slot-value.d.ts.map +1 -0
- package/dist/types/runtimes/react/element-imperative-handle.d.ts +1 -1
- package/dist/types/runtimes/react/element-imperative-handle.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/__tests__/use-control-instance.test.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/__tests__/use-control-instance.test.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-control-instance.d.ts +7 -0
- package/dist/types/runtimes/react/hooks/use-control-instance.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-control-instances.d.ts +1 -2
- package/dist/types/runtimes/react/hooks/use-control-instances.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-disable-register-element.d.ts +1 -1
- package/dist/types/runtimes/react/hooks/use-disable-register-element.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts +4 -3
- package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-resolved-value-override.d.ts +5 -0
- package/dist/types/runtimes/react/hooks/use-resolved-value-override.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-selector.d.ts +2 -5
- package/dist/types/runtimes/react/hooks/use-selector.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-store.d.ts +2 -4
- package/dist/types/runtimes/react/hooks/use-store.d.ts.map +1 -1
- package/dist/types/runtimes/react/testing/index.d.ts +3 -0
- package/dist/types/runtimes/react/testing/index.d.ts.map +1 -0
- package/dist/types/runtimes/react/testing/react-provider.d.ts +8 -0
- package/dist/types/runtimes/react/testing/react-provider.d.ts.map +1 -0
- package/dist/types/slate/InlineModePlugin/index.d.ts +1 -1
- package/dist/types/slate/LinkPlugin/getValue.d.ts.map +1 -1
- package/dist/types/slate/LinkPlugin/index.d.ts.map +1 -1
- package/dist/types/slate/TypographyPlugin/getValue.d.ts.map +1 -1
- package/dist/types/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/state/__tests__/test-store.d.ts +2 -4
- package/dist/types/state/__tests__/test-store.d.ts.map +1 -1
- package/dist/types/state/actions/index.d.ts +9 -6
- package/dist/types/state/actions/index.d.ts.map +1 -1
- package/dist/types/state/actions/internal/action-types.d.ts +29 -0
- package/dist/types/state/actions/internal/action-types.d.ts.map +1 -0
- package/dist/types/state/actions/internal/index.d.ts +0 -25
- package/dist/types/state/actions/internal/index.d.ts.map +1 -1
- package/dist/types/state/actions/internal/read-only-action-types.d.ts +15 -0
- package/dist/types/state/actions/internal/read-only-action-types.d.ts.map +1 -0
- package/dist/types/state/actions/internal/read-only-actions.d.ts +3 -76
- package/dist/types/state/actions/internal/read-only-actions.d.ts.map +1 -1
- package/dist/types/state/actions/internal/read-write-action-types.d.ts +17 -0
- package/dist/types/state/actions/internal/read-write-action-types.d.ts.map +1 -0
- package/dist/types/state/actions/internal/read-write-actions.d.ts +89 -8
- package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -1
- package/dist/types/state/api-client/state.d.ts +1 -0
- package/dist/types/state/api-client/state.d.ts.map +1 -1
- package/dist/types/state/builder-api/action-types.d.ts +22 -0
- package/dist/types/state/builder-api/action-types.d.ts.map +1 -0
- package/dist/types/state/builder-api/actions.d.ts +3 -23
- package/dist/types/state/builder-api/actions.d.ts.map +1 -1
- package/dist/types/state/builder-api/proxy.d.ts.map +1 -1
- package/dist/types/state/host-api/action-types.d.ts +17 -0
- package/dist/types/state/host-api/action-types.d.ts.map +1 -0
- package/dist/types/state/{host-api.d.ts → host-api/actions.d.ts} +7 -22
- package/dist/types/state/host-api/actions.d.ts.map +1 -0
- package/dist/types/state/host-api/index.d.ts +3 -0
- package/dist/types/state/host-api/index.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/__tests__/fixtures/operations.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/__tests__/fixtures/root-elements.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/__tests__/prop-controller-handles.test.d.ts +2 -0
- package/dist/types/state/middleware/read-write/__tests__/prop-controller-handles.test.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/__tests__/update-element-tree.test.d.ts +2 -0
- package/dist/types/state/middleware/read-write/__tests__/update-element-tree.test.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/builder-api/__tests__/middleware.test.d.ts +2 -0
- package/dist/types/state/middleware/read-write/builder-api/__tests__/middleware.test.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/builder-api/__tests__/mount-change-action-buffer.test.d.ts +2 -0
- package/dist/types/state/middleware/read-write/builder-api/__tests__/mount-change-action-buffer.test.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/builder-api/index.d.ts +1 -4
- package/dist/types/state/middleware/read-write/builder-api/index.d.ts.map +1 -1
- package/dist/types/state/middleware/read-write/builder-api/initialize-connection.d.ts.map +1 -1
- package/dist/types/state/middleware/read-write/builder-api/middleware.d.ts +5 -0
- package/dist/types/state/middleware/read-write/builder-api/middleware.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/builder-api/mount-change-action-buffer.d.ts +28 -0
- package/dist/types/state/middleware/read-write/builder-api/mount-change-action-buffer.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts.map +1 -1
- package/dist/types/state/modules/element-trees.d.ts +1 -1
- package/dist/types/state/modules/element-trees.d.ts.map +1 -1
- package/dist/types/state/modules/{prop-controllers.d.ts → prop-controller-descriptors.d.ts} +1 -1
- package/dist/types/state/modules/prop-controller-descriptors.d.ts.map +1 -0
- package/dist/types/state/modules/{prop-controller-handles.d.ts → read-write/prop-controllers.d.ts} +4 -4
- package/dist/types/state/modules/{prop-controller-handles.d.ts.map → read-write/prop-controllers.d.ts.map} +1 -1
- package/dist/types/state/modules/read-write/resolved-value-overrides.d.ts +15 -0
- package/dist/types/state/modules/read-write/resolved-value-overrides.d.ts.map +1 -0
- package/dist/types/state/read-only-state.d.ts +6 -70
- package/dist/types/state/read-only-state.d.ts.map +1 -1
- package/dist/types/state/read-write-state.d.ts +74 -4
- package/dist/types/state/read-write-state.d.ts.map +1 -1
- package/dist/types/state/shared-api/action-types.d.ts +6 -0
- package/dist/types/state/shared-api/action-types.d.ts.map +1 -0
- package/dist/types/state/{shared-api.d.ts → shared-api/actions.d.ts} +3 -7
- package/dist/types/state/shared-api/actions.d.ts.map +1 -0
- package/dist/types/state/shared-api/index.d.ts +3 -0
- package/dist/types/state/shared-api/index.d.ts.map +1 -0
- package/dist/types/state/store.d.ts +4 -8
- package/dist/types/state/store.d.ts.map +1 -1
- package/dist/types/state/translations/get.d.ts +1 -1
- package/dist/types/state/translations/get.d.ts.map +1 -1
- package/dist/types/state/translations/merge.d.ts +1 -1
- package/dist/types/state/translations/merge.d.ts.map +1 -1
- package/dist/types/state/unified-state.d.ts +2 -0
- package/dist/types/state/unified-state.d.ts.map +1 -1
- package/dist/types/testing/breakpoints.d.ts +4 -0
- package/dist/types/testing/breakpoints.d.ts.map +1 -0
- package/dist/types/testing/element-data.d.ts +59 -0
- package/dist/types/testing/element-data.d.ts.map +1 -0
- package/dist/types/testing/read-write-state.d.ts +3 -0
- package/dist/types/testing/read-write-state.d.ts.map +1 -0
- package/dist/types/translations/index.d.ts +1 -1
- package/dist/types/translations/index.d.ts.map +1 -1
- package/package.json +7 -5
- package/dist/cjs/runtimes/react/controls/slot.js.map +0 -1
- package/dist/cjs/state/host-api.js.map +0 -1
- package/dist/cjs/state/modules/prop-controller-handles.js.map +0 -1
- package/dist/cjs/state/modules/prop-controllers.js.map +0 -1
- package/dist/cjs/state/shared-api.js.map +0 -1
- package/dist/esm/runtimes/react/controls/slot.js.map +0 -1
- package/dist/esm/state/host-api.js.map +0 -1
- package/dist/esm/state/modules/prop-controller-handles.js.map +0 -1
- package/dist/esm/state/modules/prop-controllers.js.map +0 -1
- package/dist/esm/state/shared-api.js.map +0 -1
- package/dist/types/runtimes/react/controls/slot.d.ts.map +0 -1
- package/dist/types/state/__tests__/fixtures/operations.d.ts.map +0 -1
- package/dist/types/state/__tests__/fixtures/root-elements.d.ts.map +0 -1
- package/dist/types/state/__tests__/react-builder-preview.test.d.ts +0 -2
- package/dist/types/state/__tests__/react-builder-preview.test.d.ts.map +0 -1
- package/dist/types/state/host-api.d.ts.map +0 -1
- package/dist/types/state/modules/prop-controllers.d.ts.map +0 -1
- package/dist/types/state/shared-api.d.ts.map +0 -1
- /package/dist/types/state/{__tests__ → middleware/read-write/__tests__}/fixtures/operations.d.ts +0 -0
- /package/dist/types/state/{__tests__ → middleware/read-write/__tests__}/fixtures/root-elements.d.ts +0 -0
|
@@ -0,0 +1,862 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/api/ky.ts
|
|
21
|
+
var ky_exports = {};
|
|
22
|
+
__export(ky_exports, {
|
|
23
|
+
HTTPError: () => HTTPError,
|
|
24
|
+
default: () => distribution_default,
|
|
25
|
+
isHTTPError: () => isHTTPError
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(ky_exports);
|
|
28
|
+
|
|
29
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/errors/HTTPError.js
|
|
30
|
+
var HTTPError = class extends Error {
|
|
31
|
+
response;
|
|
32
|
+
request;
|
|
33
|
+
options;
|
|
34
|
+
constructor(response, request, options) {
|
|
35
|
+
const code = response.status || response.status === 0 ? response.status : "";
|
|
36
|
+
const title = response.statusText ?? "";
|
|
37
|
+
const status = `${code} ${title}`.trim();
|
|
38
|
+
const reason = status ? `status code ${status}` : "an unknown error";
|
|
39
|
+
super(`Request failed with ${reason}: ${request.method} ${request.url}`);
|
|
40
|
+
this.name = "HTTPError";
|
|
41
|
+
this.response = response;
|
|
42
|
+
this.request = request;
|
|
43
|
+
this.options = options;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/errors/NonError.js
|
|
48
|
+
var NonError = class extends Error {
|
|
49
|
+
name = "NonError";
|
|
50
|
+
value;
|
|
51
|
+
constructor(value) {
|
|
52
|
+
let message = "Non-error value was thrown";
|
|
53
|
+
try {
|
|
54
|
+
if (typeof value === "string") {
|
|
55
|
+
message = value;
|
|
56
|
+
} else if (value && typeof value === "object" && "message" in value && typeof value.message === "string") {
|
|
57
|
+
message = value.message;
|
|
58
|
+
}
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
super(message);
|
|
62
|
+
this.value = value;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/errors/ForceRetryError.js
|
|
67
|
+
var ForceRetryError = class extends Error {
|
|
68
|
+
name = "ForceRetryError";
|
|
69
|
+
customDelay;
|
|
70
|
+
code;
|
|
71
|
+
customRequest;
|
|
72
|
+
constructor(options) {
|
|
73
|
+
const cause = options?.cause ? options.cause instanceof Error ? options.cause : new NonError(options.cause) : void 0;
|
|
74
|
+
super(options?.code ? `Forced retry: ${options.code}` : "Forced retry", cause ? { cause } : void 0);
|
|
75
|
+
this.customDelay = options?.delay;
|
|
76
|
+
this.code = options?.code;
|
|
77
|
+
this.customRequest = options?.request;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/core/constants.js
|
|
82
|
+
var supportsRequestStreams = (() => {
|
|
83
|
+
let duplexAccessed = false;
|
|
84
|
+
let hasContentType = false;
|
|
85
|
+
const supportsReadableStream = typeof globalThis.ReadableStream === "function";
|
|
86
|
+
const supportsRequest = typeof globalThis.Request === "function";
|
|
87
|
+
if (supportsReadableStream && supportsRequest) {
|
|
88
|
+
try {
|
|
89
|
+
hasContentType = new globalThis.Request("https://empty.invalid", {
|
|
90
|
+
body: new globalThis.ReadableStream(),
|
|
91
|
+
method: "POST",
|
|
92
|
+
// @ts-expect-error - Types are outdated.
|
|
93
|
+
get duplex() {
|
|
94
|
+
duplexAccessed = true;
|
|
95
|
+
return "half";
|
|
96
|
+
}
|
|
97
|
+
}).headers.has("Content-Type");
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (error instanceof Error && error.message === "unsupported BodyInit type") {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return duplexAccessed && !hasContentType;
|
|
106
|
+
})();
|
|
107
|
+
var supportsAbortController = typeof globalThis.AbortController === "function";
|
|
108
|
+
var supportsAbortSignal = typeof globalThis.AbortSignal === "function" && typeof globalThis.AbortSignal.any === "function";
|
|
109
|
+
var supportsResponseStreams = typeof globalThis.ReadableStream === "function";
|
|
110
|
+
var supportsFormData = typeof globalThis.FormData === "function";
|
|
111
|
+
var requestMethods = ["get", "post", "put", "patch", "head", "delete"];
|
|
112
|
+
var validate = () => void 0;
|
|
113
|
+
validate();
|
|
114
|
+
var responseTypes = {
|
|
115
|
+
json: "application/json",
|
|
116
|
+
text: "text/*",
|
|
117
|
+
formData: "multipart/form-data",
|
|
118
|
+
arrayBuffer: "*/*",
|
|
119
|
+
blob: "*/*",
|
|
120
|
+
// Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
|
|
121
|
+
// We still feature-check at runtime before exposing the shortcut.
|
|
122
|
+
bytes: "*/*"
|
|
123
|
+
};
|
|
124
|
+
var maxSafeTimeout = 2147483647;
|
|
125
|
+
var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
|
|
126
|
+
var stop = Symbol("stop");
|
|
127
|
+
var RetryMarker = class {
|
|
128
|
+
options;
|
|
129
|
+
constructor(options) {
|
|
130
|
+
this.options = options;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
var retry = (options) => new RetryMarker(options);
|
|
134
|
+
var kyOptionKeys = {
|
|
135
|
+
json: true,
|
|
136
|
+
parseJson: true,
|
|
137
|
+
stringifyJson: true,
|
|
138
|
+
searchParams: true,
|
|
139
|
+
prefixUrl: true,
|
|
140
|
+
retry: true,
|
|
141
|
+
timeout: true,
|
|
142
|
+
hooks: true,
|
|
143
|
+
throwHttpErrors: true,
|
|
144
|
+
onDownloadProgress: true,
|
|
145
|
+
onUploadProgress: true,
|
|
146
|
+
fetch: true,
|
|
147
|
+
context: true
|
|
148
|
+
};
|
|
149
|
+
var vendorSpecificOptions = {
|
|
150
|
+
next: true
|
|
151
|
+
// Next.js cache revalidation (revalidate, tags)
|
|
152
|
+
};
|
|
153
|
+
var requestOptionsRegistry = {
|
|
154
|
+
method: true,
|
|
155
|
+
headers: true,
|
|
156
|
+
body: true,
|
|
157
|
+
mode: true,
|
|
158
|
+
credentials: true,
|
|
159
|
+
cache: true,
|
|
160
|
+
redirect: true,
|
|
161
|
+
referrer: true,
|
|
162
|
+
referrerPolicy: true,
|
|
163
|
+
integrity: true,
|
|
164
|
+
keepalive: true,
|
|
165
|
+
signal: true,
|
|
166
|
+
window: true,
|
|
167
|
+
duplex: true
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/utils/body.js
|
|
171
|
+
var getBodySize = (body) => {
|
|
172
|
+
if (!body) {
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
175
|
+
if (body instanceof FormData) {
|
|
176
|
+
let size = 0;
|
|
177
|
+
for (const [key, value] of body) {
|
|
178
|
+
size += usualFormBoundarySize;
|
|
179
|
+
size += new TextEncoder().encode(`Content-Disposition: form-data; name="${key}"`).length;
|
|
180
|
+
size += typeof value === "string" ? new TextEncoder().encode(value).length : value.size;
|
|
181
|
+
}
|
|
182
|
+
return size;
|
|
183
|
+
}
|
|
184
|
+
if (body instanceof Blob) {
|
|
185
|
+
return body.size;
|
|
186
|
+
}
|
|
187
|
+
if (body instanceof ArrayBuffer) {
|
|
188
|
+
return body.byteLength;
|
|
189
|
+
}
|
|
190
|
+
if (typeof body === "string") {
|
|
191
|
+
return new TextEncoder().encode(body).length;
|
|
192
|
+
}
|
|
193
|
+
if (body instanceof URLSearchParams) {
|
|
194
|
+
return new TextEncoder().encode(body.toString()).length;
|
|
195
|
+
}
|
|
196
|
+
if ("byteLength" in body) {
|
|
197
|
+
return body.byteLength;
|
|
198
|
+
}
|
|
199
|
+
if (typeof body === "object" && body !== null) {
|
|
200
|
+
try {
|
|
201
|
+
const jsonString = JSON.stringify(body);
|
|
202
|
+
return new TextEncoder().encode(jsonString).length;
|
|
203
|
+
} catch {
|
|
204
|
+
return 0;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return 0;
|
|
208
|
+
};
|
|
209
|
+
var withProgress = (stream, totalBytes, onProgress) => {
|
|
210
|
+
let previousChunk;
|
|
211
|
+
let transferredBytes = 0;
|
|
212
|
+
return stream.pipeThrough(new TransformStream({
|
|
213
|
+
transform(currentChunk, controller) {
|
|
214
|
+
controller.enqueue(currentChunk);
|
|
215
|
+
if (previousChunk) {
|
|
216
|
+
transferredBytes += previousChunk.byteLength;
|
|
217
|
+
let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
218
|
+
if (percent >= 1) {
|
|
219
|
+
percent = 1 - Number.EPSILON;
|
|
220
|
+
}
|
|
221
|
+
onProgress?.({ percent, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
|
|
222
|
+
}
|
|
223
|
+
previousChunk = currentChunk;
|
|
224
|
+
},
|
|
225
|
+
flush() {
|
|
226
|
+
if (previousChunk) {
|
|
227
|
+
transferredBytes += previousChunk.byteLength;
|
|
228
|
+
onProgress?.({ percent: 1, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}));
|
|
232
|
+
};
|
|
233
|
+
var streamResponse = (response, onDownloadProgress) => {
|
|
234
|
+
if (!response.body) {
|
|
235
|
+
return response;
|
|
236
|
+
}
|
|
237
|
+
if (response.status === 204) {
|
|
238
|
+
return new Response(null, {
|
|
239
|
+
status: response.status,
|
|
240
|
+
statusText: response.statusText,
|
|
241
|
+
headers: response.headers
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
const totalBytes = Math.max(0, Number(response.headers.get("content-length")) || 0);
|
|
245
|
+
return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
|
|
246
|
+
status: response.status,
|
|
247
|
+
statusText: response.statusText,
|
|
248
|
+
headers: response.headers
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
var streamRequest = (request, onUploadProgress, originalBody) => {
|
|
252
|
+
if (!request.body) {
|
|
253
|
+
return request;
|
|
254
|
+
}
|
|
255
|
+
const totalBytes = getBodySize(originalBody ?? request.body);
|
|
256
|
+
return new Request(request, {
|
|
257
|
+
// @ts-expect-error - Types are outdated.
|
|
258
|
+
duplex: "half",
|
|
259
|
+
body: withProgress(request.body, totalBytes, onUploadProgress)
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/utils/is.js
|
|
264
|
+
var isObject = (value) => value !== null && typeof value === "object";
|
|
265
|
+
|
|
266
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/utils/merge.js
|
|
267
|
+
var validateAndMerge = (...sources) => {
|
|
268
|
+
for (const source of sources) {
|
|
269
|
+
if ((!isObject(source) || Array.isArray(source)) && source !== void 0) {
|
|
270
|
+
throw new TypeError("The `options` argument must be an object");
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return deepMerge({}, ...sources);
|
|
274
|
+
};
|
|
275
|
+
var mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
276
|
+
const result = new globalThis.Headers(source1);
|
|
277
|
+
const isHeadersInstance = source2 instanceof globalThis.Headers;
|
|
278
|
+
const source = new globalThis.Headers(source2);
|
|
279
|
+
for (const [key, value] of source.entries()) {
|
|
280
|
+
if (isHeadersInstance && value === "undefined" || value === void 0) {
|
|
281
|
+
result.delete(key);
|
|
282
|
+
} else {
|
|
283
|
+
result.set(key, value);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return result;
|
|
287
|
+
};
|
|
288
|
+
function newHookValue(original, incoming, property) {
|
|
289
|
+
return Object.hasOwn(incoming, property) && incoming[property] === void 0 ? [] : deepMerge(original[property] ?? [], incoming[property] ?? []);
|
|
290
|
+
}
|
|
291
|
+
var mergeHooks = (original = {}, incoming = {}) => ({
|
|
292
|
+
beforeRequest: newHookValue(original, incoming, "beforeRequest"),
|
|
293
|
+
beforeRetry: newHookValue(original, incoming, "beforeRetry"),
|
|
294
|
+
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
295
|
+
beforeError: newHookValue(original, incoming, "beforeError")
|
|
296
|
+
});
|
|
297
|
+
var appendSearchParameters = (target, source) => {
|
|
298
|
+
const result = new URLSearchParams();
|
|
299
|
+
for (const input of [target, source]) {
|
|
300
|
+
if (input === void 0) {
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
if (input instanceof URLSearchParams) {
|
|
304
|
+
for (const [key, value] of input.entries()) {
|
|
305
|
+
result.append(key, value);
|
|
306
|
+
}
|
|
307
|
+
} else if (Array.isArray(input)) {
|
|
308
|
+
for (const pair of input) {
|
|
309
|
+
if (!Array.isArray(pair) || pair.length !== 2) {
|
|
310
|
+
throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
|
|
311
|
+
}
|
|
312
|
+
result.append(String(pair[0]), String(pair[1]));
|
|
313
|
+
}
|
|
314
|
+
} else if (isObject(input)) {
|
|
315
|
+
for (const [key, value] of Object.entries(input)) {
|
|
316
|
+
if (value !== void 0) {
|
|
317
|
+
result.append(key, String(value));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
} else {
|
|
321
|
+
const parameters = new URLSearchParams(input);
|
|
322
|
+
for (const [key, value] of parameters.entries()) {
|
|
323
|
+
result.append(key, value);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return result;
|
|
328
|
+
};
|
|
329
|
+
var deepMerge = (...sources) => {
|
|
330
|
+
let returnValue = {};
|
|
331
|
+
let headers = {};
|
|
332
|
+
let hooks = {};
|
|
333
|
+
let searchParameters;
|
|
334
|
+
const signals = [];
|
|
335
|
+
for (const source of sources) {
|
|
336
|
+
if (Array.isArray(source)) {
|
|
337
|
+
if (!Array.isArray(returnValue)) {
|
|
338
|
+
returnValue = [];
|
|
339
|
+
}
|
|
340
|
+
returnValue = [...returnValue, ...source];
|
|
341
|
+
} else if (isObject(source)) {
|
|
342
|
+
for (let [key, value] of Object.entries(source)) {
|
|
343
|
+
if (key === "signal" && value instanceof globalThis.AbortSignal) {
|
|
344
|
+
signals.push(value);
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
if (key === "context") {
|
|
348
|
+
if (value !== void 0 && value !== null && (!isObject(value) || Array.isArray(value))) {
|
|
349
|
+
throw new TypeError("The `context` option must be an object");
|
|
350
|
+
}
|
|
351
|
+
returnValue = {
|
|
352
|
+
...returnValue,
|
|
353
|
+
context: value === void 0 || value === null ? {} : { ...returnValue.context, ...value }
|
|
354
|
+
};
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
if (key === "searchParams") {
|
|
358
|
+
if (value === void 0 || value === null) {
|
|
359
|
+
searchParameters = void 0;
|
|
360
|
+
} else {
|
|
361
|
+
searchParameters = searchParameters === void 0 ? value : appendSearchParameters(searchParameters, value);
|
|
362
|
+
}
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
if (isObject(value) && key in returnValue) {
|
|
366
|
+
value = deepMerge(returnValue[key], value);
|
|
367
|
+
}
|
|
368
|
+
returnValue = { ...returnValue, [key]: value };
|
|
369
|
+
}
|
|
370
|
+
if (isObject(source.hooks)) {
|
|
371
|
+
hooks = mergeHooks(hooks, source.hooks);
|
|
372
|
+
returnValue.hooks = hooks;
|
|
373
|
+
}
|
|
374
|
+
if (isObject(source.headers)) {
|
|
375
|
+
headers = mergeHeaders(headers, source.headers);
|
|
376
|
+
returnValue.headers = headers;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (searchParameters !== void 0) {
|
|
381
|
+
returnValue.searchParams = searchParameters;
|
|
382
|
+
}
|
|
383
|
+
if (signals.length > 0) {
|
|
384
|
+
if (signals.length === 1) {
|
|
385
|
+
returnValue.signal = signals[0];
|
|
386
|
+
} else if (supportsAbortSignal) {
|
|
387
|
+
returnValue.signal = AbortSignal.any(signals);
|
|
388
|
+
} else {
|
|
389
|
+
returnValue.signal = signals.at(-1);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return returnValue;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/utils/normalize.js
|
|
396
|
+
var normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
|
|
397
|
+
var retryMethods = ["get", "put", "head", "delete", "options", "trace"];
|
|
398
|
+
var retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
|
|
399
|
+
var retryAfterStatusCodes = [413, 429, 503];
|
|
400
|
+
var defaultRetryOptions = {
|
|
401
|
+
limit: 2,
|
|
402
|
+
methods: retryMethods,
|
|
403
|
+
statusCodes: retryStatusCodes,
|
|
404
|
+
afterStatusCodes: retryAfterStatusCodes,
|
|
405
|
+
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
406
|
+
backoffLimit: Number.POSITIVE_INFINITY,
|
|
407
|
+
delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1e3,
|
|
408
|
+
jitter: void 0,
|
|
409
|
+
retryOnTimeout: false
|
|
410
|
+
};
|
|
411
|
+
var normalizeRetryOptions = (retry2 = {}) => {
|
|
412
|
+
if (typeof retry2 === "number") {
|
|
413
|
+
return {
|
|
414
|
+
...defaultRetryOptions,
|
|
415
|
+
limit: retry2
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
if (retry2.methods && !Array.isArray(retry2.methods)) {
|
|
419
|
+
throw new Error("retry.methods must be an array");
|
|
420
|
+
}
|
|
421
|
+
retry2.methods &&= retry2.methods.map((method) => method.toLowerCase());
|
|
422
|
+
if (retry2.statusCodes && !Array.isArray(retry2.statusCodes)) {
|
|
423
|
+
throw new Error("retry.statusCodes must be an array");
|
|
424
|
+
}
|
|
425
|
+
const normalizedRetry = Object.fromEntries(Object.entries(retry2).filter(([, value]) => value !== void 0));
|
|
426
|
+
return {
|
|
427
|
+
...defaultRetryOptions,
|
|
428
|
+
...normalizedRetry
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/errors/TimeoutError.js
|
|
433
|
+
var TimeoutError = class extends Error {
|
|
434
|
+
request;
|
|
435
|
+
constructor(request) {
|
|
436
|
+
super(`Request timed out: ${request.method} ${request.url}`);
|
|
437
|
+
this.name = "TimeoutError";
|
|
438
|
+
this.request = request;
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/utils/timeout.js
|
|
443
|
+
async function timeout(request, init, abortController, options) {
|
|
444
|
+
return new Promise((resolve, reject) => {
|
|
445
|
+
const timeoutId = setTimeout(() => {
|
|
446
|
+
if (abortController) {
|
|
447
|
+
abortController.abort();
|
|
448
|
+
}
|
|
449
|
+
reject(new TimeoutError(request));
|
|
450
|
+
}, options.timeout);
|
|
451
|
+
void options.fetch(request, init).then(resolve).catch(reject).then(() => {
|
|
452
|
+
clearTimeout(timeoutId);
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/utils/delay.js
|
|
458
|
+
async function delay(ms, { signal }) {
|
|
459
|
+
return new Promise((resolve, reject) => {
|
|
460
|
+
if (signal) {
|
|
461
|
+
signal.throwIfAborted();
|
|
462
|
+
signal.addEventListener("abort", abortHandler, { once: true });
|
|
463
|
+
}
|
|
464
|
+
function abortHandler() {
|
|
465
|
+
clearTimeout(timeoutId);
|
|
466
|
+
reject(signal.reason);
|
|
467
|
+
}
|
|
468
|
+
const timeoutId = setTimeout(() => {
|
|
469
|
+
signal?.removeEventListener("abort", abortHandler);
|
|
470
|
+
resolve();
|
|
471
|
+
}, ms);
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/utils/options.js
|
|
476
|
+
var findUnknownOptions = (request, options) => {
|
|
477
|
+
const unknownOptions = {};
|
|
478
|
+
for (const key in options) {
|
|
479
|
+
if (!Object.hasOwn(options, key)) {
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || key in vendorSpecificOptions)) {
|
|
483
|
+
unknownOptions[key] = options[key];
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return unknownOptions;
|
|
487
|
+
};
|
|
488
|
+
var hasSearchParameters = (search) => {
|
|
489
|
+
if (search === void 0) {
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
if (Array.isArray(search)) {
|
|
493
|
+
return search.length > 0;
|
|
494
|
+
}
|
|
495
|
+
if (search instanceof URLSearchParams) {
|
|
496
|
+
return search.size > 0;
|
|
497
|
+
}
|
|
498
|
+
if (typeof search === "object") {
|
|
499
|
+
return Object.keys(search).length > 0;
|
|
500
|
+
}
|
|
501
|
+
if (typeof search === "string") {
|
|
502
|
+
return search.trim().length > 0;
|
|
503
|
+
}
|
|
504
|
+
return Boolean(search);
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/utils/type-guards.js
|
|
508
|
+
function isHTTPError(error) {
|
|
509
|
+
return error instanceof HTTPError || error?.name === HTTPError.name;
|
|
510
|
+
}
|
|
511
|
+
function isTimeoutError(error) {
|
|
512
|
+
return error instanceof TimeoutError || error?.name === TimeoutError.name;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/core/Ky.js
|
|
516
|
+
var Ky = class _Ky {
|
|
517
|
+
static create(input, options) {
|
|
518
|
+
const ky2 = new _Ky(input, options);
|
|
519
|
+
const function_ = async () => {
|
|
520
|
+
if (typeof ky2.#options.timeout === "number" && ky2.#options.timeout > maxSafeTimeout) {
|
|
521
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
522
|
+
}
|
|
523
|
+
await Promise.resolve();
|
|
524
|
+
let response = await ky2.#fetch();
|
|
525
|
+
for (const hook of ky2.#options.hooks.afterResponse) {
|
|
526
|
+
const clonedResponse = ky2.#decorateResponse(response.clone());
|
|
527
|
+
let modifiedResponse;
|
|
528
|
+
try {
|
|
529
|
+
modifiedResponse = await hook(ky2.request, ky2.#getNormalizedOptions(), clonedResponse, { retryCount: ky2.#retryCount });
|
|
530
|
+
} catch (error) {
|
|
531
|
+
ky2.#cancelResponseBody(clonedResponse);
|
|
532
|
+
ky2.#cancelResponseBody(response);
|
|
533
|
+
throw error;
|
|
534
|
+
}
|
|
535
|
+
if (modifiedResponse instanceof RetryMarker) {
|
|
536
|
+
ky2.#cancelResponseBody(clonedResponse);
|
|
537
|
+
ky2.#cancelResponseBody(response);
|
|
538
|
+
throw new ForceRetryError(modifiedResponse.options);
|
|
539
|
+
}
|
|
540
|
+
const nextResponse = modifiedResponse instanceof globalThis.Response ? modifiedResponse : response;
|
|
541
|
+
if (clonedResponse !== nextResponse) {
|
|
542
|
+
ky2.#cancelResponseBody(clonedResponse);
|
|
543
|
+
}
|
|
544
|
+
if (response !== nextResponse) {
|
|
545
|
+
ky2.#cancelResponseBody(response);
|
|
546
|
+
}
|
|
547
|
+
response = nextResponse;
|
|
548
|
+
}
|
|
549
|
+
ky2.#decorateResponse(response);
|
|
550
|
+
if (!response.ok && (typeof ky2.#options.throwHttpErrors === "function" ? ky2.#options.throwHttpErrors(response.status) : ky2.#options.throwHttpErrors)) {
|
|
551
|
+
let error = new HTTPError(response, ky2.request, ky2.#getNormalizedOptions());
|
|
552
|
+
for (const hook of ky2.#options.hooks.beforeError) {
|
|
553
|
+
error = await hook(error, { retryCount: ky2.#retryCount });
|
|
554
|
+
}
|
|
555
|
+
throw error;
|
|
556
|
+
}
|
|
557
|
+
if (ky2.#options.onDownloadProgress) {
|
|
558
|
+
if (typeof ky2.#options.onDownloadProgress !== "function") {
|
|
559
|
+
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
560
|
+
}
|
|
561
|
+
if (!supportsResponseStreams) {
|
|
562
|
+
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
563
|
+
}
|
|
564
|
+
const progressResponse = response.clone();
|
|
565
|
+
ky2.#cancelResponseBody(response);
|
|
566
|
+
return streamResponse(progressResponse, ky2.#options.onDownloadProgress);
|
|
567
|
+
}
|
|
568
|
+
return response;
|
|
569
|
+
};
|
|
570
|
+
const result = ky2.#retry(function_).finally(() => {
|
|
571
|
+
const originalRequest = ky2.#originalRequest;
|
|
572
|
+
ky2.#cancelBody(originalRequest?.body ?? void 0);
|
|
573
|
+
ky2.#cancelBody(ky2.request.body ?? void 0);
|
|
574
|
+
});
|
|
575
|
+
for (const [type, mimeType] of Object.entries(responseTypes)) {
|
|
576
|
+
if (type === "bytes" && typeof globalThis.Response?.prototype?.bytes !== "function") {
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
result[type] = async () => {
|
|
580
|
+
ky2.request.headers.set("accept", ky2.request.headers.get("accept") || mimeType);
|
|
581
|
+
const response = await result;
|
|
582
|
+
if (type === "json") {
|
|
583
|
+
if (response.status === 204) {
|
|
584
|
+
return "";
|
|
585
|
+
}
|
|
586
|
+
const text = await response.text();
|
|
587
|
+
if (text === "") {
|
|
588
|
+
return "";
|
|
589
|
+
}
|
|
590
|
+
if (options.parseJson) {
|
|
591
|
+
return options.parseJson(text);
|
|
592
|
+
}
|
|
593
|
+
return JSON.parse(text);
|
|
594
|
+
}
|
|
595
|
+
return response[type]();
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
return result;
|
|
599
|
+
}
|
|
600
|
+
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
601
|
+
static #normalizeSearchParams(searchParams) {
|
|
602
|
+
if (searchParams && typeof searchParams === "object" && !Array.isArray(searchParams) && !(searchParams instanceof URLSearchParams)) {
|
|
603
|
+
return Object.fromEntries(Object.entries(searchParams).filter(([, value]) => value !== void 0));
|
|
604
|
+
}
|
|
605
|
+
return searchParams;
|
|
606
|
+
}
|
|
607
|
+
request;
|
|
608
|
+
#abortController;
|
|
609
|
+
#retryCount = 0;
|
|
610
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly -- False positive: #input is reassigned on line 202
|
|
611
|
+
#input;
|
|
612
|
+
#options;
|
|
613
|
+
#originalRequest;
|
|
614
|
+
#userProvidedAbortSignal;
|
|
615
|
+
#cachedNormalizedOptions;
|
|
616
|
+
// eslint-disable-next-line complexity
|
|
617
|
+
constructor(input, options = {}) {
|
|
618
|
+
this.#input = input;
|
|
619
|
+
this.#options = {
|
|
620
|
+
...options,
|
|
621
|
+
headers: mergeHeaders(this.#input.headers, options.headers),
|
|
622
|
+
hooks: mergeHooks({
|
|
623
|
+
beforeRequest: [],
|
|
624
|
+
beforeRetry: [],
|
|
625
|
+
beforeError: [],
|
|
626
|
+
afterResponse: []
|
|
627
|
+
}, options.hooks),
|
|
628
|
+
method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
|
|
629
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
630
|
+
prefixUrl: String(options.prefixUrl || ""),
|
|
631
|
+
retry: normalizeRetryOptions(options.retry),
|
|
632
|
+
throwHttpErrors: options.throwHttpErrors ?? true,
|
|
633
|
+
timeout: options.timeout ?? 1e4,
|
|
634
|
+
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
635
|
+
context: options.context ?? {}
|
|
636
|
+
};
|
|
637
|
+
if (typeof this.#input !== "string" && !(this.#input instanceof URL || this.#input instanceof globalThis.Request)) {
|
|
638
|
+
throw new TypeError("`input` must be a string, URL, or Request");
|
|
639
|
+
}
|
|
640
|
+
if (this.#options.prefixUrl && typeof this.#input === "string") {
|
|
641
|
+
if (this.#input.startsWith("/")) {
|
|
642
|
+
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
643
|
+
}
|
|
644
|
+
if (!this.#options.prefixUrl.endsWith("/")) {
|
|
645
|
+
this.#options.prefixUrl += "/";
|
|
646
|
+
}
|
|
647
|
+
this.#input = this.#options.prefixUrl + this.#input;
|
|
648
|
+
}
|
|
649
|
+
if (supportsAbortController && supportsAbortSignal) {
|
|
650
|
+
this.#userProvidedAbortSignal = this.#options.signal ?? this.#input.signal;
|
|
651
|
+
this.#abortController = new globalThis.AbortController();
|
|
652
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
653
|
+
}
|
|
654
|
+
if (supportsRequestStreams) {
|
|
655
|
+
this.#options.duplex = "half";
|
|
656
|
+
}
|
|
657
|
+
if (this.#options.json !== void 0) {
|
|
658
|
+
this.#options.body = this.#options.stringifyJson?.(this.#options.json) ?? JSON.stringify(this.#options.json);
|
|
659
|
+
this.#options.headers.set("content-type", this.#options.headers.get("content-type") ?? "application/json");
|
|
660
|
+
}
|
|
661
|
+
const userProvidedContentType = options.headers && new globalThis.Headers(options.headers).has("content-type");
|
|
662
|
+
if (this.#input instanceof globalThis.Request && (supportsFormData && this.#options.body instanceof globalThis.FormData || this.#options.body instanceof URLSearchParams) && !userProvidedContentType) {
|
|
663
|
+
this.#options.headers.delete("content-type");
|
|
664
|
+
}
|
|
665
|
+
this.request = new globalThis.Request(this.#input, this.#options);
|
|
666
|
+
if (hasSearchParameters(this.#options.searchParams)) {
|
|
667
|
+
const textSearchParams = typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(_Ky.#normalizeSearchParams(this.#options.searchParams)).toString();
|
|
668
|
+
const searchParams = "?" + textSearchParams;
|
|
669
|
+
const url = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
670
|
+
this.request = new globalThis.Request(url, this.#options);
|
|
671
|
+
}
|
|
672
|
+
if (this.#options.onUploadProgress) {
|
|
673
|
+
if (typeof this.#options.onUploadProgress !== "function") {
|
|
674
|
+
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
675
|
+
}
|
|
676
|
+
if (!supportsRequestStreams) {
|
|
677
|
+
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
678
|
+
}
|
|
679
|
+
this.request = this.#wrapRequestWithUploadProgress(this.request, this.#options.body ?? void 0);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
#calculateDelay() {
|
|
683
|
+
const retryDelay = this.#options.retry.delay(this.#retryCount);
|
|
684
|
+
let jitteredDelay = retryDelay;
|
|
685
|
+
if (this.#options.retry.jitter === true) {
|
|
686
|
+
jitteredDelay = Math.random() * retryDelay;
|
|
687
|
+
} else if (typeof this.#options.retry.jitter === "function") {
|
|
688
|
+
jitteredDelay = this.#options.retry.jitter(retryDelay);
|
|
689
|
+
if (!Number.isFinite(jitteredDelay) || jitteredDelay < 0) {
|
|
690
|
+
jitteredDelay = retryDelay;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
const backoffLimit = this.#options.retry.backoffLimit ?? Number.POSITIVE_INFINITY;
|
|
694
|
+
return Math.min(backoffLimit, jitteredDelay);
|
|
695
|
+
}
|
|
696
|
+
async #calculateRetryDelay(error) {
|
|
697
|
+
this.#retryCount++;
|
|
698
|
+
if (this.#retryCount > this.#options.retry.limit) {
|
|
699
|
+
throw error;
|
|
700
|
+
}
|
|
701
|
+
const errorObject = error instanceof Error ? error : new NonError(error);
|
|
702
|
+
if (errorObject instanceof ForceRetryError) {
|
|
703
|
+
return errorObject.customDelay ?? this.#calculateDelay();
|
|
704
|
+
}
|
|
705
|
+
if (!this.#options.retry.methods.includes(this.request.method.toLowerCase())) {
|
|
706
|
+
throw error;
|
|
707
|
+
}
|
|
708
|
+
if (this.#options.retry.shouldRetry !== void 0) {
|
|
709
|
+
const result = await this.#options.retry.shouldRetry({ error: errorObject, retryCount: this.#retryCount });
|
|
710
|
+
if (result === false) {
|
|
711
|
+
throw error;
|
|
712
|
+
}
|
|
713
|
+
if (result === true) {
|
|
714
|
+
return this.#calculateDelay();
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
if (isTimeoutError(error) && !this.#options.retry.retryOnTimeout) {
|
|
718
|
+
throw error;
|
|
719
|
+
}
|
|
720
|
+
if (isHTTPError(error)) {
|
|
721
|
+
if (!this.#options.retry.statusCodes.includes(error.response.status)) {
|
|
722
|
+
throw error;
|
|
723
|
+
}
|
|
724
|
+
const retryAfter = error.response.headers.get("Retry-After") ?? error.response.headers.get("RateLimit-Reset") ?? error.response.headers.get("X-RateLimit-Retry-After") ?? error.response.headers.get("X-RateLimit-Reset") ?? error.response.headers.get("X-Rate-Limit-Reset");
|
|
725
|
+
if (retryAfter && this.#options.retry.afterStatusCodes.includes(error.response.status)) {
|
|
726
|
+
let after = Number(retryAfter) * 1e3;
|
|
727
|
+
if (Number.isNaN(after)) {
|
|
728
|
+
after = Date.parse(retryAfter) - Date.now();
|
|
729
|
+
} else if (after >= Date.parse("2024-01-01")) {
|
|
730
|
+
after -= Date.now();
|
|
731
|
+
}
|
|
732
|
+
const max = this.#options.retry.maxRetryAfter ?? after;
|
|
733
|
+
return after < max ? after : max;
|
|
734
|
+
}
|
|
735
|
+
if (error.response.status === 413) {
|
|
736
|
+
throw error;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
return this.#calculateDelay();
|
|
740
|
+
}
|
|
741
|
+
#decorateResponse(response) {
|
|
742
|
+
if (this.#options.parseJson) {
|
|
743
|
+
response.json = async () => this.#options.parseJson(await response.text());
|
|
744
|
+
}
|
|
745
|
+
return response;
|
|
746
|
+
}
|
|
747
|
+
#cancelBody(body) {
|
|
748
|
+
if (!body) {
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
void body.cancel().catch(() => void 0);
|
|
752
|
+
}
|
|
753
|
+
#cancelResponseBody(response) {
|
|
754
|
+
this.#cancelBody(response.body ?? void 0);
|
|
755
|
+
}
|
|
756
|
+
async #retry(function_) {
|
|
757
|
+
try {
|
|
758
|
+
return await function_();
|
|
759
|
+
} catch (error) {
|
|
760
|
+
const ms = Math.min(await this.#calculateRetryDelay(error), maxSafeTimeout);
|
|
761
|
+
if (this.#retryCount < 1) {
|
|
762
|
+
throw error;
|
|
763
|
+
}
|
|
764
|
+
await delay(ms, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
|
|
765
|
+
if (error instanceof ForceRetryError && error.customRequest) {
|
|
766
|
+
const managedRequest = this.#options.signal ? new globalThis.Request(error.customRequest, { signal: this.#options.signal }) : new globalThis.Request(error.customRequest);
|
|
767
|
+
this.#assignRequest(managedRequest);
|
|
768
|
+
}
|
|
769
|
+
for (const hook of this.#options.hooks.beforeRetry) {
|
|
770
|
+
const hookResult = await hook({
|
|
771
|
+
request: this.request,
|
|
772
|
+
options: this.#getNormalizedOptions(),
|
|
773
|
+
error,
|
|
774
|
+
retryCount: this.#retryCount
|
|
775
|
+
});
|
|
776
|
+
if (hookResult instanceof globalThis.Request) {
|
|
777
|
+
this.#assignRequest(hookResult);
|
|
778
|
+
break;
|
|
779
|
+
}
|
|
780
|
+
if (hookResult instanceof globalThis.Response) {
|
|
781
|
+
return hookResult;
|
|
782
|
+
}
|
|
783
|
+
if (hookResult === stop) {
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
return this.#retry(function_);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
async #fetch() {
|
|
791
|
+
if (this.#abortController?.signal.aborted) {
|
|
792
|
+
this.#abortController = new globalThis.AbortController();
|
|
793
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
794
|
+
this.request = new globalThis.Request(this.request, { signal: this.#options.signal });
|
|
795
|
+
}
|
|
796
|
+
for (const hook of this.#options.hooks.beforeRequest) {
|
|
797
|
+
const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
|
|
798
|
+
if (result instanceof Response) {
|
|
799
|
+
return result;
|
|
800
|
+
}
|
|
801
|
+
if (result instanceof globalThis.Request) {
|
|
802
|
+
this.#assignRequest(result);
|
|
803
|
+
break;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
const nonRequestOptions = findUnknownOptions(this.request, this.#options);
|
|
807
|
+
this.#originalRequest = this.request;
|
|
808
|
+
this.request = this.#originalRequest.clone();
|
|
809
|
+
if (this.#options.timeout === false) {
|
|
810
|
+
return this.#options.fetch(this.#originalRequest, nonRequestOptions);
|
|
811
|
+
}
|
|
812
|
+
return timeout(this.#originalRequest, nonRequestOptions, this.#abortController, this.#options);
|
|
813
|
+
}
|
|
814
|
+
#getNormalizedOptions() {
|
|
815
|
+
if (!this.#cachedNormalizedOptions) {
|
|
816
|
+
const { hooks, ...normalizedOptions } = this.#options;
|
|
817
|
+
this.#cachedNormalizedOptions = Object.freeze(normalizedOptions);
|
|
818
|
+
}
|
|
819
|
+
return this.#cachedNormalizedOptions;
|
|
820
|
+
}
|
|
821
|
+
#assignRequest(request) {
|
|
822
|
+
this.#cachedNormalizedOptions = void 0;
|
|
823
|
+
this.request = this.#wrapRequestWithUploadProgress(request);
|
|
824
|
+
}
|
|
825
|
+
#wrapRequestWithUploadProgress(request, originalBody) {
|
|
826
|
+
if (!this.#options.onUploadProgress || !request.body) {
|
|
827
|
+
return request;
|
|
828
|
+
}
|
|
829
|
+
return streamRequest(request, this.#options.onUploadProgress, originalBody ?? this.#options.body ?? void 0);
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
// ../../node_modules/.pnpm/ky@1.14.3/node_modules/ky/distribution/index.js
|
|
834
|
+
var createInstance = (defaults) => {
|
|
835
|
+
const ky2 = (input, options) => Ky.create(input, validateAndMerge(defaults, options));
|
|
836
|
+
for (const method of requestMethods) {
|
|
837
|
+
ky2[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
|
|
838
|
+
}
|
|
839
|
+
ky2.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
|
|
840
|
+
ky2.extend = (newDefaults) => {
|
|
841
|
+
if (typeof newDefaults === "function") {
|
|
842
|
+
newDefaults = newDefaults(defaults ?? {});
|
|
843
|
+
}
|
|
844
|
+
return createInstance(validateAndMerge(defaults, newDefaults));
|
|
845
|
+
};
|
|
846
|
+
ky2.stop = stop;
|
|
847
|
+
ky2.retry = retry;
|
|
848
|
+
return ky2;
|
|
849
|
+
};
|
|
850
|
+
var ky = createInstance();
|
|
851
|
+
var distribution_default = ky;
|
|
852
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
853
|
+
0 && (module.exports = {
|
|
854
|
+
HTTPError,
|
|
855
|
+
isHTTPError
|
|
856
|
+
});
|
|
857
|
+
/*! Bundled license information:
|
|
858
|
+
|
|
859
|
+
ky/distribution/index.js:
|
|
860
|
+
(*! MIT License © Sindre Sorhus *)
|
|
861
|
+
*/
|
|
862
|
+
//# sourceMappingURL=ky.js.map
|