@vtex/faststore 0.0.1
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 +18 -0
- package/LICENSE +21 -0
- package/README.md +95 -0
- package/dist/actions.json +334 -0
- package/dist/catalog.json +6615 -0
- package/dist/client.d.ts +17 -0
- package/dist/client.js +8 -0
- package/dist/components.d.ts +87 -0
- package/dist/components.js +87 -0
- package/dist/content-types.json +684 -0
- package/dist/core/dist/actions/mock-action.d.ts +24 -0
- package/dist/core/dist/actions/mock-action.js +28 -0
- package/dist/core/dist/actions/mock-action.js.map +1 -0
- package/dist/core/dist/actions/registry.d.ts +24 -0
- package/dist/core/dist/actions/registry.js +28 -0
- package/dist/core/dist/actions/registry.js.map +1 -0
- package/dist/core/dist/define-component.d.ts +100 -0
- package/dist/core/dist/define-component.js +8 -0
- package/dist/core/dist/define-component.js.map +1 -0
- package/dist/core/dist/define-content-type.d.ts +95 -0
- package/dist/core/dist/define-content-type.js +283 -0
- package/dist/core/dist/define-content-type.js.map +1 -0
- package/dist/core/dist/index.d.ts +7 -0
- package/dist/core/dist/index.js +5 -0
- package/dist/core/dist/schema/generated/schema.d.ts +28 -0
- package/dist/core/dist/types.d.ts +1 -0
- package/dist/docs/access-code-field.md +100 -0
- package/dist/docs/access-code-sign-in.md +174 -0
- package/dist/docs/account-entry-point.md +155 -0
- package/dist/docs/address-summary.md +50 -0
- package/dist/docs/buy-button.md +162 -0
- package/dist/docs/carousel.md +105 -0
- package/dist/docs/cart-item.md +162 -0
- package/dist/docs/cart-totalizer.md +197 -0
- package/dist/docs/cart.md +495 -0
- package/dist/docs/client-preferences.md +184 -0
- package/dist/docs/client-profile-form.md +192 -0
- package/dist/docs/client-profile.md +117 -0
- package/dist/docs/container.md +97 -0
- package/dist/docs/document-field.md +97 -0
- package/dist/docs/email-field.md +93 -0
- package/dist/docs/email-identification.md +102 -0
- package/dist/docs/footer-copyright.md +112 -0
- package/dist/docs/footer-link-group.md +162 -0
- package/dist/docs/footer-root.md +145 -0
- package/dist/docs/footer-social.md +151 -0
- package/dist/docs/free-shipping-progress.md +87 -0
- package/dist/docs/gallery.md +84 -0
- package/dist/docs/header-root.md +150 -0
- package/dist/docs/identity-edit.md +88 -0
- package/dist/docs/identity-summary.md +106 -0
- package/dist/docs/incentives.md +151 -0
- package/dist/docs/logo.md +135 -0
- package/dist/docs/meter.md +67 -0
- package/dist/docs/navigation-link-list.md +171 -0
- package/dist/docs/navigation-link.md +163 -0
- package/dist/docs/navigation-menu.md +264 -0
- package/dist/docs/payment-methods.md +139 -0
- package/dist/docs/phone-field.md +106 -0
- package/dist/docs/postal-code-field.md +126 -0
- package/dist/docs/pricing.md +499 -0
- package/dist/docs/product-gallery.md +409 -0
- package/dist/docs/product-information.md +295 -0
- package/dist/docs/product-list.md +170 -0
- package/dist/docs/product-quantity.md +88 -0
- package/dist/docs/product-shelf.md +141 -0
- package/dist/docs/promotion.md +109 -0
- package/dist/docs/region.md +225 -0
- package/dist/docs/session.md +123 -0
- package/dist/docs/shipping-address.md +390 -0
- package/dist/docs/shipping-simulator.md +147 -0
- package/dist/docs/sign-in-form.md +117 -0
- package/dist/docs/tabs.md +176 -0
- package/dist/docs/toast.md +124 -0
- package/dist/docs/variant-selector.md +450 -0
- package/dist/graphql/define-subgraph.d.ts +12 -0
- package/dist/graphql/define-subgraph.js +15 -0
- package/dist/graphql/define-subgraph.js.map +1 -0
- package/dist/graphql/gql.d.ts +10 -0
- package/dist/graphql/gql.js +16 -0
- package/dist/graphql/gql.js.map +1 -0
- package/dist/graphql/types.d.ts +88 -0
- package/dist/graphql.d.ts +4 -0
- package/dist/graphql.js +3 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +5 -0
- package/dist/internal/client.d.ts +24 -0
- package/dist/internal/client.js +23 -0
- package/dist/internal/content.d.ts +2 -0
- package/dist/internal/content.js +2 -0
- package/dist/internal/server.d.ts +7 -0
- package/dist/internal/server.js +6 -0
- package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +111 -0
- package/dist/matter/access-code-sign-in/access-code-sign-in.js +387 -0
- package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -0
- package/dist/matter/account-entry-point/account-entry-point.d.ts +64 -0
- package/dist/matter/account-entry-point/account-entry-point.js +151 -0
- package/dist/matter/account-entry-point/account-entry-point.js.map +1 -0
- package/dist/matter/breadcrumb/breadcrumb.d.ts +40 -0
- package/dist/matter/breadcrumb/breadcrumb.js +155 -0
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/matter/buy-button/buy-button.d.ts +95 -0
- package/dist/matter/buy-button/buy-button.js +259 -0
- package/dist/matter/buy-button/buy-button.js.map +1 -0
- package/dist/matter/cart/cart-namespace.d.ts +48 -0
- package/dist/matter/cart/cart-namespace.js +50 -0
- package/dist/matter/cart/cart-namespace.js.map +1 -0
- package/dist/matter/cart/cart.d.ts +312 -0
- package/dist/matter/cart/cart.js +1034 -0
- package/dist/matter/cart/cart.js.map +1 -0
- package/dist/matter/cart-item/cart-item.d.ts +103 -0
- package/dist/matter/cart-item/cart-item.js +672 -0
- package/dist/matter/cart-item/cart-item.js.map +1 -0
- package/dist/matter/cart-item-compositions/cart-item-compositions.d.ts +49 -0
- package/dist/matter/cart-item-compositions/cart-item-compositions.js +165 -0
- package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -0
- package/dist/matter/cart-item-customizations/cart-item-customizations.d.ts +28 -0
- package/dist/matter/cart-item-customizations/cart-item-customizations.js +73 -0
- package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -0
- package/dist/matter/cart-item-discounts/cart-item-discounts.d.ts +33 -0
- package/dist/matter/cart-item-discounts/cart-item-discounts.js +70 -0
- package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -0
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.d.ts +24 -0
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +54 -0
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -0
- package/dist/matter/cart-item-variations/cart-item-variations.d.ts +27 -0
- package/dist/matter/cart-item-variations/cart-item-variations.js +69 -0
- package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -0
- package/dist/matter/cart-totalizer/cart-totalizer.d.ts +78 -0
- package/dist/matter/cart-totalizer/cart-totalizer.js +220 -0
- package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences.d.ts +50 -0
- package/dist/matter/client-preferences/client-preferences.js +206 -0
- package/dist/matter/client-preferences/client-preferences.js.map +1 -0
- package/dist/matter/client-profile/client-profile.d.ts +59 -0
- package/dist/matter/client-profile/client-profile.js +185 -0
- package/dist/matter/client-profile/client-profile.js.map +1 -0
- package/dist/matter/client-profile-form/client-profile-form.d.ts +126 -0
- package/dist/matter/client-profile-form/client-profile-form.js +660 -0
- package/dist/matter/client-profile-form/client-profile-form.js.map +1 -0
- package/dist/matter/delivery-options/delivery-options-accordion.d.ts +30 -0
- package/dist/matter/delivery-options/delivery-options-accordion.js +189 -0
- package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -0
- package/dist/matter/delivery-options/delivery-options-controller.d.ts +49 -0
- package/dist/matter/delivery-options/delivery-options-controller.js +203 -0
- package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -0
- package/dist/matter/delivery-options/delivery-options.d.ts +31 -0
- package/dist/matter/delivery-options/delivery-options.js +103 -0
- package/dist/matter/delivery-options/delivery-options.js.map +1 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +9 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js +76 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -0
- package/dist/matter/email-identification/email-identification.d.ts +37 -0
- package/dist/matter/email-identification/email-identification.js +111 -0
- package/dist/matter/email-identification/email-identification.js.map +1 -0
- package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +44 -0
- package/dist/matter/free-shipping-progress/free-shipping-progress.js +170 -0
- package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -0
- package/dist/matter/identity-edit/identity-edit.d.ts +52 -0
- package/dist/matter/identity-edit/identity-edit.js +148 -0
- package/dist/matter/identity-edit/identity-edit.js.map +1 -0
- package/dist/matter/identity-summary/identity-summary.d.ts +128 -0
- package/dist/matter/identity-summary/identity-summary.js +344 -0
- package/dist/matter/identity-summary/identity-summary.js.map +1 -0
- package/dist/matter/pricing/pricing.d.ts +162 -0
- package/dist/matter/pricing/pricing.js +793 -0
- package/dist/matter/pricing/pricing.js.map +1 -0
- package/dist/matter/product-gallery/product-gallery.d.ts +23 -0
- package/dist/matter/product-gallery/product-gallery.js +188 -0
- package/dist/matter/product-gallery/product-gallery.js.map +1 -0
- package/dist/matter/product-information/product-information.d.ts +61 -0
- package/dist/matter/product-information/product-information.js +355 -0
- package/dist/matter/product-information/product-information.js.map +1 -0
- package/dist/matter/product-list/product-list.d.ts +86 -0
- package/dist/matter/product-list/product-list.js +342 -0
- package/dist/matter/product-list/product-list.js.map +1 -0
- package/dist/matter/product-quantity/product-quantity.d.ts +50 -0
- package/dist/matter/product-quantity/product-quantity.js +111 -0
- package/dist/matter/product-quantity/product-quantity.js.map +1 -0
- package/dist/matter/product-shelf/product-shelf.d.ts +125 -0
- package/dist/matter/product-shelf/product-shelf.js +376 -0
- package/dist/matter/product-shelf/product-shelf.js.map +1 -0
- package/dist/matter/region/region.d.ts +211 -0
- package/dist/matter/region/region.js +579 -0
- package/dist/matter/region/region.js.map +1 -0
- package/dist/matter/session/session.d.ts +58 -0
- package/dist/matter/session/session.js +112 -0
- package/dist/matter/session/session.js.map +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +101 -0
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -0
- package/dist/matter/shipping-address/shipping-address.d.ts +284 -0
- package/dist/matter/shipping-address/shipping-address.js +1036 -0
- package/dist/matter/shipping-address/shipping-address.js.map +1 -0
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +143 -0
- package/dist/matter/shipping-simulator/shipping-simulator.js +644 -0
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -0
- package/dist/matter/sign-in-form/sign-in-form.d.ts +79 -0
- package/dist/matter/sign-in-form/sign-in-form.js +226 -0
- package/dist/matter/sign-in-form/sign-in-form.js.map +1 -0
- package/dist/matter/variant-selector/variant-selector.d.ts +183 -0
- package/dist/matter/variant-selector/variant-selector.js +840 -0
- package/dist/matter/variant-selector/variant-selector.js.map +1 -0
- package/dist/message-locales.json +7 -0
- package/dist/particles/access-code-field/access-code-field.d.ts +33 -0
- package/dist/particles/access-code-field/access-code-field.js +95 -0
- package/dist/particles/access-code-field/access-code-field.js.map +1 -0
- package/dist/particles/accordion/accordion.d.ts +45 -0
- package/dist/particles/accordion/accordion.js +156 -0
- package/dist/particles/accordion/accordion.js.map +1 -0
- package/dist/particles/address-summary/address-summary.d.ts +50 -0
- package/dist/particles/address-summary/address-summary.js +129 -0
- package/dist/particles/address-summary/address-summary.js.map +1 -0
- package/dist/particles/badge/badge.d.ts +10 -0
- package/dist/particles/badge/badge.js +27 -0
- package/dist/particles/badge/badge.js.map +1 -0
- package/dist/particles/button/button.d.ts +18 -0
- package/dist/particles/button/button.js +37 -0
- package/dist/particles/button/button.js.map +1 -0
- package/dist/particles/carousel/carousel.d.ts +60 -0
- package/dist/particles/carousel/carousel.js +335 -0
- package/dist/particles/carousel/carousel.js.map +1 -0
- package/dist/particles/checkbox/checkbox.d.ts +40 -0
- package/dist/particles/checkbox/checkbox.js +82 -0
- package/dist/particles/checkbox/checkbox.js.map +1 -0
- package/dist/particles/container/container.d.ts +20 -0
- package/dist/particles/container/container.js +36 -0
- package/dist/particles/container/container.js.map +1 -0
- package/dist/particles/dialog/dialog.d.ts +54 -0
- package/dist/particles/dialog/dialog.js +192 -0
- package/dist/particles/dialog/dialog.js.map +1 -0
- package/dist/particles/document-field/document-field.d.ts +61 -0
- package/dist/particles/document-field/document-field.js +146 -0
- package/dist/particles/document-field/document-field.js.map +1 -0
- package/dist/particles/drawer/drawer.d.ts +52 -0
- package/dist/particles/drawer/drawer.js +183 -0
- package/dist/particles/drawer/drawer.js.map +1 -0
- package/dist/particles/email-field/email-field.d.ts +37 -0
- package/dist/particles/email-field/email-field.js +106 -0
- package/dist/particles/email-field/email-field.js.map +1 -0
- package/dist/particles/field/field.d.ts +50 -0
- package/dist/particles/field/field.js +133 -0
- package/dist/particles/field/field.js.map +1 -0
- package/dist/particles/fieldset/fieldset.d.ts +16 -0
- package/dist/particles/fieldset/fieldset.js +52 -0
- package/dist/particles/fieldset/fieldset.js.map +1 -0
- package/dist/particles/footer-copyright/footer-copyright.d.ts +32 -0
- package/dist/particles/footer-copyright/footer-copyright.js +50 -0
- package/dist/particles/footer-copyright/footer-copyright.js.map +1 -0
- package/dist/particles/footer-link-group/footer-link-group.d.ts +66 -0
- package/dist/particles/footer-link-group/footer-link-group.js +154 -0
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -0
- package/dist/particles/footer-root/footer-root.d.ts +21 -0
- package/dist/particles/footer-root/footer-root.js +38 -0
- package/dist/particles/footer-root/footer-root.js.map +1 -0
- package/dist/particles/footer-social/footer-social.d.ts +79 -0
- package/dist/particles/footer-social/footer-social.js +176 -0
- package/dist/particles/footer-social/footer-social.js.map +1 -0
- package/dist/particles/gallery/gallery.d.ts +181 -0
- package/dist/particles/gallery/gallery.js +920 -0
- package/dist/particles/gallery/gallery.js.map +1 -0
- package/dist/particles/header-root/header-root.d.ts +21 -0
- package/dist/particles/header-root/header-root.js +38 -0
- package/dist/particles/header-root/header-root.js.map +1 -0
- package/dist/particles/icon/icon.d.ts +22 -0
- package/dist/particles/icon/icon.js +48 -0
- package/dist/particles/icon/icon.js.map +1 -0
- package/dist/particles/image/image.d.ts +13 -0
- package/dist/particles/image/image.js +59 -0
- package/dist/particles/image/image.js.map +1 -0
- package/dist/particles/incentives/incentives.d.ts +85 -0
- package/dist/particles/incentives/incentives.js +200 -0
- package/dist/particles/incentives/incentives.js.map +1 -0
- package/dist/particles/input/input.d.ts +9 -0
- package/dist/particles/input/input.js +28 -0
- package/dist/particles/input/input.js.map +1 -0
- package/dist/particles/logo/logo.d.ts +55 -0
- package/dist/particles/logo/logo.js +96 -0
- package/dist/particles/logo/logo.js.map +1 -0
- package/dist/particles/menu/menu.d.ts +103 -0
- package/dist/particles/menu/menu.js +409 -0
- package/dist/particles/menu/menu.js.map +1 -0
- package/dist/particles/menubar/menubar.d.ts +18 -0
- package/dist/particles/menubar/menubar.js +42 -0
- package/dist/particles/menubar/menubar.js.map +1 -0
- package/dist/particles/meter/meter.d.ts +36 -0
- package/dist/particles/meter/meter.js +132 -0
- package/dist/particles/meter/meter.js.map +1 -0
- package/dist/particles/navigation-link/navigation-link.d.ts +43 -0
- package/dist/particles/navigation-link/navigation-link.js +82 -0
- package/dist/particles/navigation-link/navigation-link.js.map +1 -0
- package/dist/particles/navigation-link-list/navigation-link-list.d.ts +59 -0
- package/dist/particles/navigation-link-list/navigation-link-list.js +103 -0
- package/dist/particles/navigation-link-list/navigation-link-list.js.map +1 -0
- package/dist/particles/navigation-menu/navigation-menu.d.ts +78 -0
- package/dist/particles/navigation-menu/navigation-menu.js +295 -0
- package/dist/particles/navigation-menu/navigation-menu.js.map +1 -0
- package/dist/particles/number-field/number-field.d.ts +46 -0
- package/dist/particles/number-field/number-field.js +169 -0
- package/dist/particles/number-field/number-field.js.map +1 -0
- package/dist/particles/password-field/password-field.d.ts +31 -0
- package/dist/particles/password-field/password-field.js +109 -0
- package/dist/particles/password-field/password-field.js.map +1 -0
- package/dist/particles/payment-methods/payment-methods.d.ts +72 -0
- package/dist/particles/payment-methods/payment-methods.js +151 -0
- package/dist/particles/payment-methods/payment-methods.js.map +1 -0
- package/dist/particles/phone-field/phone-field.d.ts +67 -0
- package/dist/particles/phone-field/phone-field.js +250 -0
- package/dist/particles/phone-field/phone-field.js.map +1 -0
- package/dist/particles/popover/popover.d.ts +68 -0
- package/dist/particles/popover/popover.js +284 -0
- package/dist/particles/popover/popover.js.map +1 -0
- package/dist/particles/postal-code-field/postal-code-field.d.ts +75 -0
- package/dist/particles/postal-code-field/postal-code-field.js +169 -0
- package/dist/particles/postal-code-field/postal-code-field.js.map +1 -0
- package/dist/particles/promotion/promotion.d.ts +46 -0
- package/dist/particles/promotion/promotion.js +78 -0
- package/dist/particles/promotion/promotion.js.map +1 -0
- package/dist/particles/quantity-selector/quantity-selector.d.ts +30 -0
- package/dist/particles/quantity-selector/quantity-selector.js +116 -0
- package/dist/particles/quantity-selector/quantity-selector.js.map +1 -0
- package/dist/particles/radio/radio.d.ts +36 -0
- package/dist/particles/radio/radio.js +76 -0
- package/dist/particles/radio/radio.js.map +1 -0
- package/dist/particles/scroll-area/scroll-area.d.ts +36 -0
- package/dist/particles/scroll-area/scroll-area.js +145 -0
- package/dist/particles/scroll-area/scroll-area.js.map +1 -0
- package/dist/particles/select/select.d.ts +125 -0
- package/dist/particles/select/select.js +478 -0
- package/dist/particles/select/select.js.map +1 -0
- package/dist/particles/separator/separator.d.ts +12 -0
- package/dist/particles/separator/separator.js +33 -0
- package/dist/particles/separator/separator.js.map +1 -0
- package/dist/particles/shared/input-mask.d.ts +5 -0
- package/dist/particles/shared/input-mask.js +58 -0
- package/dist/particles/shared/input-mask.js.map +1 -0
- package/dist/particles/spinner/spinner.d.ts +13 -0
- package/dist/particles/spinner/spinner.js +31 -0
- package/dist/particles/spinner/spinner.js.map +1 -0
- package/dist/particles/switch/switch.d.ts +27 -0
- package/dist/particles/switch/switch.js +59 -0
- package/dist/particles/switch/switch.js.map +1 -0
- package/dist/particles/tabs/tabs.d.ts +45 -0
- package/dist/particles/tabs/tabs.js +164 -0
- package/dist/particles/tabs/tabs.js.map +1 -0
- package/dist/particles/text/text.d.ts +24 -0
- package/dist/particles/text/text.js +40 -0
- package/dist/particles/text/text.js.map +1 -0
- package/dist/particles/toast/toast.d.ts +83 -0
- package/dist/particles/toast/toast.js +194 -0
- package/dist/particles/toast/toast.js.map +1 -0
- package/dist/particles/toggle/toggle.d.ts +26 -0
- package/dist/particles/toggle/toggle.js +61 -0
- package/dist/particles/toggle/toggle.js.map +1 -0
- package/dist/particles/tooltip/tooltip.d.ts +61 -0
- package/dist/particles/tooltip/tooltip.js +240 -0
- package/dist/particles/tooltip/tooltip.js.map +1 -0
- package/dist/schema.graphql +2953 -0
- package/dist/sdk/actions/cart-action-provider.d.ts +19 -0
- package/dist/sdk/actions/cart-action-provider.js +23 -0
- package/dist/sdk/actions/cart-action-provider.js.map +1 -0
- package/dist/sdk/actions/identity-action-provider.d.ts +15 -0
- package/dist/sdk/actions/identity-action-provider.js +19 -0
- package/dist/sdk/actions/identity-action-provider.js.map +1 -0
- package/dist/sdk/actions/index.d.ts +7 -0
- package/dist/sdk/actions/index.js +6 -0
- package/dist/sdk/actions/inject-actions.d.ts +14 -0
- package/dist/sdk/actions/inject-actions.js +36 -0
- package/dist/sdk/actions/inject-actions.js.map +1 -0
- package/dist/sdk/actions/region-action-provider.d.ts +15 -0
- package/dist/sdk/actions/region-action-provider.js +19 -0
- package/dist/sdk/actions/region-action-provider.js.map +1 -0
- package/dist/sdk/actions/session-action-provider.d.ts +15 -0
- package/dist/sdk/actions/session-action-provider.js +19 -0
- package/dist/sdk/actions/session-action-provider.js.map +1 -0
- package/dist/sdk/actions/shipping-action-provider.d.ts +15 -0
- package/dist/sdk/actions/shipping-action-provider.js +19 -0
- package/dist/sdk/actions/shipping-action-provider.js.map +1 -0
- package/dist/sdk/actions/types.d.ts +21 -0
- package/dist/sdk/cache/storefront-cache.js +35 -0
- package/dist/sdk/cache/storefront-cache.js.map +1 -0
- package/dist/sdk/cart/operations.d.ts +31 -0
- package/dist/sdk/cart/operations.js +215 -0
- package/dist/sdk/cart/operations.js.map +1 -0
- package/dist/sdk/cart/optimistic.d.ts +24 -0
- package/dist/sdk/cart/optimistic.js +164 -0
- package/dist/sdk/cart/optimistic.js.map +1 -0
- package/dist/sdk/cart/use-cart-actions.d.ts +56 -0
- package/dist/sdk/cart/use-cart-actions.js +348 -0
- package/dist/sdk/cart/use-cart-actions.js.map +1 -0
- package/dist/sdk/cart/use-cart-validate-on-open.js +50 -0
- package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -0
- package/dist/sdk/cart/write-gate.js +54 -0
- package/dist/sdk/cart/write-gate.js.map +1 -0
- package/dist/sdk/client/assert-api-url.js +20 -0
- package/dist/sdk/client/assert-api-url.js.map +1 -0
- package/dist/sdk/client/create-client.d.ts +23 -0
- package/dist/sdk/client/create-client.js +46 -0
- package/dist/sdk/client/create-client.js.map +1 -0
- package/dist/sdk/client/fetch-page-data.d.ts +39 -0
- package/dist/sdk/client/fetch-page-data.js +33 -0
- package/dist/sdk/client/fetch-page-data.js.map +1 -0
- package/dist/sdk/client/register-preload-query.d.ts +24 -0
- package/dist/sdk/client/register-preload-query.js +33 -0
- package/dist/sdk/client/register-preload-query.js.map +1 -0
- package/dist/sdk/content/create-content-runtime.d.ts +68 -0
- package/dist/sdk/content/create-content-runtime.js +503 -0
- package/dist/sdk/content/create-content-runtime.js.map +1 -0
- package/dist/sdk/context/headers.d.ts +15 -0
- package/dist/sdk/context/headers.js +21 -0
- package/dist/sdk/context/headers.js.map +1 -0
- package/dist/sdk/context/storefront-context.d.ts +11 -0
- package/dist/sdk/context/storefront-context.js +29 -0
- package/dist/sdk/context/storefront-context.js.map +1 -0
- package/dist/sdk/data/data-override-context.d.ts +12 -0
- package/dist/sdk/data/data-override-context.js +19 -0
- package/dist/sdk/data/data-override-context.js.map +1 -0
- package/dist/sdk/data/entity-subscriber.js +28 -0
- package/dist/sdk/data/entity-subscriber.js.map +1 -0
- package/dist/sdk/data/hot-data-provider.d.ts +19 -0
- package/dist/sdk/data/hot-data-provider.js +33 -0
- package/dist/sdk/data/hot-data-provider.js.map +1 -0
- package/dist/sdk/data/index.d.ts +8 -0
- package/dist/sdk/data/index.js +8 -0
- package/dist/sdk/data/list-item-ref-context.d.ts +20 -0
- package/dist/sdk/data/list-item-ref-context.js +11 -0
- package/dist/sdk/data/list-item-ref-context.js.map +1 -0
- package/dist/sdk/data/multiple-reactive-data-provider.d.ts +32 -0
- package/dist/sdk/data/multiple-reactive-data-provider.js +20 -0
- package/dist/sdk/data/multiple-reactive-data-provider.js.map +1 -0
- package/dist/sdk/data/page-reactive-data-root.d.ts +53 -0
- package/dist/sdk/data/page-reactive-data-root.js +153 -0
- package/dist/sdk/data/page-reactive-data-root.js.map +1 -0
- package/dist/sdk/data/reactive-data-provider.d.ts +25 -0
- package/dist/sdk/data/reactive-data-provider.js +24 -0
- package/dist/sdk/data/reactive-data-provider.js.map +1 -0
- package/dist/sdk/data/reactive-list-item-data-provider.d.ts +26 -0
- package/dist/sdk/data/reactive-list-item-data-provider.js +42 -0
- package/dist/sdk/data/reactive-list-item-data-provider.js.map +1 -0
- package/dist/sdk/data/use-reactive-entity.js +40 -0
- package/dist/sdk/data/use-reactive-entity.js.map +1 -0
- package/dist/sdk/format/client.d.ts +12 -0
- package/dist/sdk/format/client.js +20 -0
- package/dist/sdk/format/client.js.map +1 -0
- package/dist/sdk/format/formatters.d.ts +32 -0
- package/dist/sdk/format/formatters.js +45 -0
- package/dist/sdk/format/formatters.js.map +1 -0
- package/dist/sdk/generated/fragment-types.js +23 -0
- package/dist/sdk/generated/fragment-types.js.map +1 -0
- package/dist/sdk/generated/gql.js +51 -0
- package/dist/sdk/generated/gql.js.map +1 -0
- package/dist/sdk/generated/graphql.d.ts +622 -0
- package/dist/sdk/generated/graphql.js +11917 -0
- package/dist/sdk/generated/graphql.js.map +1 -0
- package/dist/sdk/graphql-tag.d.ts +10 -0
- package/dist/sdk/graphql-tag.js +21 -0
- package/dist/sdk/graphql-tag.js.map +1 -0
- package/dist/sdk/i18n/client.d.ts +4 -0
- package/dist/sdk/i18n/client.js +4 -0
- package/dist/sdk/i18n/locales.d.ts +8 -0
- package/dist/sdk/i18n/locales.js +57 -0
- package/dist/sdk/i18n/locales.js.map +1 -0
- package/dist/sdk/i18n/messages/en-US.js +24 -0
- package/dist/sdk/i18n/messages/en-US.js.map +1 -0
- package/dist/sdk/i18n/messages/en-US.json +19 -0
- package/dist/sdk/i18n/messages/en-US.json.d.ts +23 -0
- package/dist/sdk/i18n/messages/es-ES.js +24 -0
- package/dist/sdk/i18n/messages/es-ES.js.map +1 -0
- package/dist/sdk/i18n/messages/es-ES.json +19 -0
- package/dist/sdk/i18n/messages/pt-BR.js +24 -0
- package/dist/sdk/i18n/messages/pt-BR.js.map +1 -0
- package/dist/sdk/i18n/messages/pt-BR.json +19 -0
- package/dist/sdk/i18n/provider.d.ts +1 -0
- package/dist/sdk/i18n/provider.js +30 -0
- package/dist/sdk/i18n/provider.js.map +1 -0
- package/dist/sdk/i18n/server.d.ts +28 -0
- package/dist/sdk/i18n/server.js +59 -0
- package/dist/sdk/i18n/server.js.map +1 -0
- package/dist/sdk/identity/operations.d.ts +34 -0
- package/dist/sdk/identity/operations.js +78 -0
- package/dist/sdk/identity/operations.js.map +1 -0
- package/dist/sdk/identity/use-identity-actions.d.ts +62 -0
- package/dist/sdk/identity/use-identity-actions.js +180 -0
- package/dist/sdk/identity/use-identity-actions.js.map +1 -0
- package/dist/sdk/provider/index.d.ts +2 -0
- package/dist/sdk/provider/index.js +2 -0
- package/dist/sdk/provider/storefront-provider.d.ts +32 -0
- package/dist/sdk/provider/storefront-provider.js +111 -0
- package/dist/sdk/provider/storefront-provider.js.map +1 -0
- package/dist/sdk/region/operations.d.ts +6 -0
- package/dist/sdk/region/region-operations.d.ts +30 -0
- package/dist/sdk/region/region-operations.js +23 -0
- package/dist/sdk/region/region-operations.js.map +1 -0
- package/dist/sdk/region/use-region-actions.d.ts +23 -0
- package/dist/sdk/region/use-region-actions.js +66 -0
- package/dist/sdk/region/use-region-actions.js.map +1 -0
- package/dist/sdk/seller.js +11 -0
- package/dist/sdk/seller.js.map +1 -0
- package/dist/sdk/session/auth-operations.d.ts +47 -0
- package/dist/sdk/session/auth-operations.js +79 -0
- package/dist/sdk/session/auth-operations.js.map +1 -0
- package/dist/sdk/session/operations.d.ts +6 -0
- package/dist/sdk/session/use-session-actions.d.ts +27 -0
- package/dist/sdk/session/use-session-actions.js +126 -0
- package/dist/sdk/session/use-session-actions.js.map +1 -0
- package/dist/sdk/shipping/cart-operations.d.ts +3 -0
- package/dist/sdk/shipping/cart-operations.js +33 -0
- package/dist/sdk/shipping/cart-operations.js.map +1 -0
- package/dist/sdk/shipping/operations.d.ts +3 -0
- package/dist/sdk/shipping/operations.js +33 -0
- package/dist/sdk/shipping/operations.js.map +1 -0
- package/dist/sdk/shipping/option-select-operations.d.ts +24 -0
- package/dist/sdk/shipping/option-select-operations.js +45 -0
- package/dist/sdk/shipping/option-select-operations.js.map +1 -0
- package/dist/sdk/shipping/request-timeout.js +41 -0
- package/dist/sdk/shipping/request-timeout.js.map +1 -0
- package/dist/sdk/shipping/shipping-operations.d.ts +38 -0
- package/dist/sdk/shipping/shipping-operations.js +77 -0
- package/dist/sdk/shipping/shipping-operations.js.map +1 -0
- package/dist/sdk/shipping/use-cart-shipping-simulation.d.ts +7 -0
- package/dist/sdk/shipping/use-cart-shipping-simulation.js +72 -0
- package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -0
- package/dist/sdk/shipping/use-shipping-actions.d.ts +27 -0
- package/dist/sdk/shipping/use-shipping-actions.js +113 -0
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -0
- package/dist/sdk/shipping/use-shipping-simulation.d.ts +7 -0
- package/dist/sdk/shipping/use-shipping-simulation.js +72 -0
- package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -0
- package/dist/sdk/state/cart.d.ts +42 -0
- package/dist/sdk/state/cart.js +64 -0
- package/dist/sdk/state/cart.js.map +1 -0
- package/dist/sdk/state/index.js +3 -0
- package/dist/sdk/state/variant-selector.d.ts +17 -0
- package/dist/sdk/state/variant-selector.js +14 -0
- package/dist/sdk/state/variant-selector.js.map +1 -0
- package/dist/utils/safe-href.js +63 -0
- package/dist/utils/safe-href.js.map +1 -0
- package/package.json +84 -0
- package/src/styles/tailwind.css +32 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region ../core/dist/actions/mock-action.js
|
|
2
|
+
/**
|
|
3
|
+
* Builds a typed `$actions` value for a selector without going through the compiler wrapper, so
|
|
4
|
+
* Storybook, unit tests, and manual JSX can render components that declare `actions` — the
|
|
5
|
+
* defense-in-depth path the actions RFC mandates ($actions is the only sanctioned write surface
|
|
6
|
+
* for the compiler, but handlers stay directly callable off the compiled path).
|
|
7
|
+
*
|
|
8
|
+
* Any method in the selector without a provided implementation falls back to a no-op that resolves
|
|
9
|
+
* to an empty `userErrors` array, so a test that only cares about one method need not stub the rest.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const $actions = mockAction({ cart: ['addItem'] }, { cart: { addItem: vi.fn() } });
|
|
13
|
+
* render(<AddToCartButton $actions={$actions} />);
|
|
14
|
+
*/
|
|
15
|
+
function mockAction(selector, impl = {}) {
|
|
16
|
+
const actions = {};
|
|
17
|
+
for (const [namespace, methods] of Object.entries(selector)) {
|
|
18
|
+
const providedForNamespace = impl[namespace] ?? {};
|
|
19
|
+
const methodMap = {};
|
|
20
|
+
for (const method of methods ?? []) methodMap[method] = providedForNamespace[method] ?? (() => Promise.resolve([]));
|
|
21
|
+
actions[namespace] = methodMap;
|
|
22
|
+
}
|
|
23
|
+
return actions;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { mockAction };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=mock-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-action.js","names":[],"sources":["../../../../../core/dist/actions/mock-action.js"],"sourcesContent":["/**\n * Builds a typed `$actions` value for a selector without going through the compiler wrapper, so\n * Storybook, unit tests, and manual JSX can render components that declare `actions` — the\n * defense-in-depth path the actions RFC mandates ($actions is the only sanctioned write surface\n * for the compiler, but handlers stay directly callable off the compiled path).\n *\n * Any method in the selector without a provided implementation falls back to a no-op that resolves\n * to an empty `userErrors` array, so a test that only cares about one method need not stub the rest.\n *\n * @example\n * const $actions = mockAction({ cart: ['addItem'] }, { cart: { addItem: vi.fn() } });\n * render(<AddToCartButton $actions={$actions} />);\n */\nexport function mockAction(selector, impl = {}) {\n const actions = {};\n for (const [namespace, methods] of Object.entries(selector)) {\n const providedForNamespace = impl[namespace] ?? {};\n const methodMap = {};\n for (const method of methods ?? []) {\n methodMap[method] = providedForNamespace[method] ?? (() => Promise.resolve([]));\n }\n actions[namespace] = methodMap;\n }\n return actions;\n}\n//# sourceMappingURL=mock-action.js.map"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,WAAW,UAAU,OAAO,CAAC,GAAG;CAC5C,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,WAAW,YAAY,OAAO,QAAQ,QAAQ,GAAG;EACzD,MAAM,uBAAuB,KAAK,cAAc,CAAC;EACjD,MAAM,YAAY,CAAC;EACnB,KAAK,MAAM,UAAU,WAAW,CAAC,GAC7B,UAAU,UAAU,qBAAqB,kBAAkB,QAAQ,QAAQ,CAAC,CAAC;EAEjF,QAAQ,aAAa;CACzB;CACA,OAAO;AACX"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region ../core/dist/actions/registry.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* First-party action model — the write-side counterpart to the data layer's read side
|
|
4
|
+
* (docs/storefront-core/rfc-actions.md, docs/storefront-core/adr-0010-actions-own-the-write-side.md).
|
|
5
|
+
*
|
|
6
|
+
* `defineActions` is the single source of truth for an action namespace, exactly as `defineComponent`
|
|
7
|
+
* is for a component. A first-party module (co-located with the namespace's `use` hook) declares the
|
|
8
|
+
* namespace, its method/payload metadata, the runtime provider binding, and the hook in one place.
|
|
9
|
+
* The native catalog builder (`@vtex/sukima-node`'s `buildPackageCatalog`) scans those call sites
|
|
10
|
+
* and emits `actions.json` (compiler-facing), mirroring how it emits `catalog.json` from
|
|
11
|
+
* `defineComponent`.
|
|
12
|
+
*
|
|
13
|
+
* There is no hardcoded namespace list here: fs-core ships the *types* and the factory, never the
|
|
14
|
+
* catalog data. The catalog is whatever the first-party `defineActions` calls declare (v1: `cart`).
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Write-side selector declared on `defineComponent`: a flat map from namespace to method names. Both
|
|
18
|
+
* namespace keys and method names are plain strings, validated at build time by
|
|
19
|
+
* `validateActionConstraints` in the sukima compiler against the generated action catalog —
|
|
20
|
+
* exactly like `requiresContext` is validated by `validateContextConstraints`.
|
|
21
|
+
*/
|
|
22
|
+
export type ActionSelector = Record<string, readonly string[]>;
|
|
23
|
+
//#endregion
|
|
24
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region ../core/dist/actions/registry.js
|
|
2
|
+
/**
|
|
3
|
+
* First-party action model — the write-side counterpart to the data layer's read side
|
|
4
|
+
* (docs/storefront-core/rfc-actions.md, docs/storefront-core/adr-0010-actions-own-the-write-side.md).
|
|
5
|
+
*
|
|
6
|
+
* `defineActions` is the single source of truth for an action namespace, exactly as `defineComponent`
|
|
7
|
+
* is for a component. A first-party module (co-located with the namespace's `use` hook) declares the
|
|
8
|
+
* namespace, its method/payload metadata, the runtime provider binding, and the hook in one place.
|
|
9
|
+
* The native catalog builder (`@vtex/sukima-node`'s `buildPackageCatalog`) scans those call sites
|
|
10
|
+
* and emits `actions.json` (compiler-facing), mirroring how it emits `catalog.json` from
|
|
11
|
+
* `defineComponent`.
|
|
12
|
+
*
|
|
13
|
+
* There is no hardcoded namespace list here: fs-core ships the *types* and the factory, never the
|
|
14
|
+
* catalog data. The catalog is whatever the first-party `defineActions` calls declare (v1: `cart`).
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Declares a first-party action namespace. Pure identity, like `defineComponent`: it returns the
|
|
18
|
+
* definition unchanged so the runtime can call `use`, while the build-time generator statically reads
|
|
19
|
+
* the metadata off the call site. Internal — extensions never call this; they consume the selector
|
|
20
|
+
* only and can never add a namespace.
|
|
21
|
+
*/
|
|
22
|
+
function defineActions(definition) {
|
|
23
|
+
return definition;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { defineActions };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","names":[],"sources":["../../../../../core/dist/actions/registry.js"],"sourcesContent":["/**\n * First-party action model — the write-side counterpart to the data layer's read side\n * (docs/storefront-core/rfc-actions.md, docs/storefront-core/adr-0010-actions-own-the-write-side.md).\n *\n * `defineActions` is the single source of truth for an action namespace, exactly as `defineComponent`\n * is for a component. A first-party module (co-located with the namespace's `use` hook) declares the\n * namespace, its method/payload metadata, the runtime provider binding, and the hook in one place.\n * The native catalog builder (`@vtex/sukima-node`'s `buildPackageCatalog`) scans those call sites\n * and emits `actions.json` (compiler-facing), mirroring how it emits `catalog.json` from\n * `defineComponent`.\n *\n * There is no hardcoded namespace list here: fs-core ships the *types* and the factory, never the\n * catalog data. The catalog is whatever the first-party `defineActions` calls declare (v1: `cart`).\n */\n/**\n * Declares a first-party action namespace. Pure identity, like `defineComponent`: it returns the\n * definition unchanged so the runtime can call `use`, while the build-time generator statically reads\n * the metadata off the call site. Internal — extensions never call this; they consume the selector\n * only and can never add a namespace.\n */\nexport function defineActions(definition) {\n return definition;\n}\n//# sourceMappingURL=registry.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,cAAc,YAAY;CACtC,OAAO;AACX"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ActionSelector } from "./actions/registry.js";
|
|
2
|
+
import { ContentTypeDefinition, ContentValue } from "./define-content-type.js";
|
|
3
|
+
import { ComponentType } from "react";
|
|
4
|
+
import { DocumentNode } from "graphql";
|
|
5
|
+
//#region ../core/dist/define-component.d.ts
|
|
6
|
+
export interface EditorMetadata {
|
|
7
|
+
label: string;
|
|
8
|
+
category: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
icon?: string;
|
|
11
|
+
}
|
|
12
|
+
export type PropType = 'string' | 'number' | 'boolean' | 'object' | 'array' | readonly string[];
|
|
13
|
+
export type PropSchemaField = {
|
|
14
|
+
/**
|
|
15
|
+
* Prop type keyword. The catalog wire value `"icon"` is a sukima convention (collected at
|
|
16
|
+
* compile time); it is a plain string here, not a branded PropType member.
|
|
17
|
+
*/
|
|
18
|
+
type: PropType | (string & {});
|
|
19
|
+
/**
|
|
20
|
+
* Allowed element values, honored only when `type === 'array'`: validates an array-of-enum prop
|
|
21
|
+
* (e.g. `{ type: 'array', items: ['anonymous', 'identified', 'loggedIn'] as const }`) — the value
|
|
22
|
+
* must be an array AND every element must be in this set. Omit for an untyped array (any element).
|
|
23
|
+
*/
|
|
24
|
+
items?: readonly string[];
|
|
25
|
+
default?: unknown;
|
|
26
|
+
label?: string;
|
|
27
|
+
};
|
|
28
|
+
export type PropSchema = Record<string, PropSchemaField>;
|
|
29
|
+
export type FetchStrategy = 'static' | 'lazy' | 'reactive' | 'reactive-list-item';
|
|
30
|
+
export interface ComponentDefinition<TProps = Record<string, unknown>> {
|
|
31
|
+
name: string;
|
|
32
|
+
importPath: string;
|
|
33
|
+
component: ComponentType<TProps>;
|
|
34
|
+
editor: EditorMetadata;
|
|
35
|
+
schema: PropSchema;
|
|
36
|
+
fragment?: string | DocumentNode;
|
|
37
|
+
fetchStrategy?: FetchStrategy;
|
|
38
|
+
skeleton?: ComponentType;
|
|
39
|
+
guideline?: string;
|
|
40
|
+
docPath?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Context names this component **provides** to its descendants. Pair with `requiresContext`
|
|
43
|
+
* on consumers — the schema compiler asserts that every required context is provided by some
|
|
44
|
+
* ancestor of the consuming element. Use a stable string identifier (e.g.
|
|
45
|
+
* `'product-information'`, `'cart'`) tied to the React context the component owns; many
|
|
46
|
+
* implementations of the same contract (`ProductInformationRoot`, `B2BProductInformationRoot`)
|
|
47
|
+
* can declare the same value. Pass a single string for the common case or an array when one
|
|
48
|
+
* provider owns multiple contexts. Omit when the component provides none.
|
|
49
|
+
*/
|
|
50
|
+
providesContext?: string | string[];
|
|
51
|
+
/**
|
|
52
|
+
* Context names this component **requires** to be provided by some ancestor when the schema
|
|
53
|
+
* compiler validates a page or layout. The check is contract-based, not name-based: any
|
|
54
|
+
* ancestor whose definition declares the same value under `providesContext` satisfies the
|
|
55
|
+
* requirement (so a `B2BProductInformationRoot` substitutes for `ProductInformationRoot`
|
|
56
|
+
* without editing consumers). Pass a single string for the common case
|
|
57
|
+
* (`'product-information'`) or an array when more than one context is required. Omit to skip
|
|
58
|
+
* the check entirely (default).
|
|
59
|
+
*
|
|
60
|
+
* Enforced at build time by `validateContextConstraints` in the sukima compiler. Runtime
|
|
61
|
+
* context guards inside components remain in place as defense-in-depth for consumers that
|
|
62
|
+
* bypass the compiler (Storybook, tests, manual JSX).
|
|
63
|
+
*/
|
|
64
|
+
requiresContext?: string | string[];
|
|
65
|
+
/**
|
|
66
|
+
* Write-side dependency declaration: the action namespaces and methods this component dispatches.
|
|
67
|
+
* The compiler resolves each key against the first-party action catalog (`actions.json`, generated
|
|
68
|
+
* from `defineActions`), validates it, and threads a narrowed `$actions` prop into the component —
|
|
69
|
+
* the write-side mirror of `fragment` -> `$data`. Because the selector is declared here,
|
|
70
|
+
* `catalog.json` records exactly which actions each component touches as static data.
|
|
71
|
+
*
|
|
72
|
+
* Namespace keys and method names are plain strings validated at build time by
|
|
73
|
+
* `validateActionConstraints` in the sukima compiler (typo-style errors with candidate
|
|
74
|
+
* suggestions), mirroring how `requiresContext` is validated rather than type-checked. Omit when
|
|
75
|
+
* the component performs no writes. Extensions consume the selector but can never add a namespace.
|
|
76
|
+
*/
|
|
77
|
+
actions?: ActionSelector;
|
|
78
|
+
/**
|
|
79
|
+
* Zero-or-one content model consumed as `$content` (content-only CMS integration). A component
|
|
80
|
+
* with a model receives merchant-authored editorial values; the compiler slices them out of the
|
|
81
|
+
* page's or layout's composite entry by the element's own id. Element-level placement and the
|
|
82
|
+
* page/layout locator are the compiler's concern; this field only fixes the declaration shape.
|
|
83
|
+
*/
|
|
84
|
+
content?: ContentTypeDefinition;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* When a `content` model is declared, the component's `$content` prop must be assignable to the
|
|
88
|
+
* model-derived value; a mismatch resolves to a marker that makes `content` impossible to pass, so
|
|
89
|
+
* the correlation is enforced at the definition site. Components without a model are unaffected.
|
|
90
|
+
*/
|
|
91
|
+
type CorrelateContent<TProps, TContent extends ContentTypeDefinition> = [TProps extends {
|
|
92
|
+
$content?: infer C;
|
|
93
|
+
} ? C : undefined] extends [ContentValue<TContent> | undefined] ? unknown : {
|
|
94
|
+
content: 'the $content prop is not assignable to ContentValue<the declared content model>';
|
|
95
|
+
};
|
|
96
|
+
export declare function defineComponent<TProps = Record<string, unknown>, const TContent extends ContentTypeDefinition = ContentTypeDefinition>(definition: ComponentDefinition<TProps> & {
|
|
97
|
+
content?: TContent;
|
|
98
|
+
} & CorrelateContent<TProps, TContent>): ComponentDefinition<TProps>;
|
|
99
|
+
//#endregion
|
|
100
|
+
//# sourceMappingURL=define-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-component.js","names":[],"sources":["../../../../core/dist/define-component.js"],"sourcesContent":["export function defineComponent(definition) {\n return definition;\n}\n//# sourceMappingURL=define-component.js.map"],"mappings":";AAAA,SAAgB,gBAAgB,YAAY;CACxC,OAAO;AACX"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { JsonValue } from "./schema/generated/schema.js";
|
|
2
|
+
//#region ../core/dist/define-content-type.d.ts
|
|
3
|
+
export type ContentScalarType = 'string' | 'number' | 'integer' | 'boolean';
|
|
4
|
+
export type ContentPropertyType = ContentScalarType | 'array' | 'object';
|
|
5
|
+
/**
|
|
6
|
+
* The JSON Schema vocabulary subset accepted per scalar property. `widget` carries presentation
|
|
7
|
+
* annotations (e.g. `{ 'ui:widget': 'media-gallery' }`) passed through to the Schema Registry
|
|
8
|
+
* uninterpreted. Anything outside this shape is rejected at definition time.
|
|
9
|
+
*/
|
|
10
|
+
export type ContentScalarSchema = {
|
|
11
|
+
type: ContentScalarType;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
/** JSON literal only; executable defaults are forbidden in v1. */
|
|
15
|
+
default?: string | number | boolean;
|
|
16
|
+
enum?: readonly (string | number)[];
|
|
17
|
+
format?: string;
|
|
18
|
+
minLength?: number;
|
|
19
|
+
maxLength?: number;
|
|
20
|
+
pattern?: string;
|
|
21
|
+
minimum?: number;
|
|
22
|
+
maximum?: number;
|
|
23
|
+
widget?: Record<string, JsonValue>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A closed object shape one level below the root. Its properties are scalars only, which is what
|
|
27
|
+
* bounds nesting at two levels: a third level is not representable rather than merely rejected.
|
|
28
|
+
*/
|
|
29
|
+
export type ContentNestedObjectShape = {
|
|
30
|
+
type: 'object';
|
|
31
|
+
additionalProperties: false;
|
|
32
|
+
required?: readonly string[];
|
|
33
|
+
properties: Record<string, ContentScalarSchema>;
|
|
34
|
+
};
|
|
35
|
+
export type ContentArraySchema = {
|
|
36
|
+
type: 'array';
|
|
37
|
+
title?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
items: ContentNestedObjectShape;
|
|
40
|
+
minItems?: number;
|
|
41
|
+
maxItems?: number;
|
|
42
|
+
widget?: Record<string, JsonValue>;
|
|
43
|
+
};
|
|
44
|
+
export type ContentObjectPropertySchema = ContentNestedObjectShape & {
|
|
45
|
+
title?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
widget?: Record<string, JsonValue>;
|
|
48
|
+
};
|
|
49
|
+
export type ContentPropertySchema = ContentScalarSchema | ContentArraySchema | ContentObjectPropertySchema;
|
|
50
|
+
/** V1 content models are closed objects. Collections are admitted only at this level. */
|
|
51
|
+
export type ContentObjectSchema = {
|
|
52
|
+
type: 'object';
|
|
53
|
+
additionalProperties: false;
|
|
54
|
+
required?: readonly string[];
|
|
55
|
+
properties: Record<string, ContentPropertySchema>;
|
|
56
|
+
};
|
|
57
|
+
export type ContentTypeDefinition = {
|
|
58
|
+
/** Stable, URL-safe id (`^[a-z][a-z0-9-]*$`): becomes the Registry content-type key and the Data Plane path segment. */
|
|
59
|
+
id: string;
|
|
60
|
+
/** Human title shown in the Content Platform Admin. */
|
|
61
|
+
title: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
schema: ContentObjectSchema;
|
|
64
|
+
};
|
|
65
|
+
/** Distributes over a naked type parameter so a union of property types maps member-by-member. */
|
|
66
|
+
type PropertyTypeValue<T> = T extends 'string' ? string : T extends 'number' | 'integer' ? number : T extends 'boolean' ? boolean : never;
|
|
67
|
+
type RequiredName<S> = S extends {
|
|
68
|
+
required: readonly (infer R extends string)[];
|
|
69
|
+
} ? R : never;
|
|
70
|
+
/** Flattens the required/optional intersection into a single object type (preserves modifiers). */
|
|
71
|
+
type Flatten<T> = { [K in keyof T]: T[K]; };
|
|
72
|
+
/** The value of a closed object shape, at the root or one level down. */
|
|
73
|
+
type ObjectValue<S> = S extends {
|
|
74
|
+
properties: infer P;
|
|
75
|
+
} ? Flatten<{ [K in Extract<keyof P, RequiredName<S>>]: ContentPropertyValue<P[K]>; } & { [K in Exclude<keyof P, RequiredName<S>>]?: ContentPropertyValue<P[K]>; }> : never;
|
|
76
|
+
type ContentPropertyValue<P> = P extends {
|
|
77
|
+
type: 'array';
|
|
78
|
+
items: infer I;
|
|
79
|
+
} ? readonly ObjectValue<I>[] : P extends {
|
|
80
|
+
type: 'object';
|
|
81
|
+
} ? ObjectValue<P> : P extends {
|
|
82
|
+
enum: readonly (infer E)[];
|
|
83
|
+
} ? E : P extends {
|
|
84
|
+
type: infer T;
|
|
85
|
+
} ? PropertyTypeValue<T> : never;
|
|
86
|
+
/** JSON-Schema → TS inference for the `$content` prop. Usage: ContentValue<typeof PromotionContent>. */
|
|
87
|
+
export type ContentValue<T extends ContentTypeDefinition> = ObjectValue<T['schema']>;
|
|
88
|
+
/**
|
|
89
|
+
* Declares a standalone content model. Unlike `defineComponent` (pure identity), this validates at
|
|
90
|
+
* definition time and throws one aggregated Error listing every violation. The `const` type
|
|
91
|
+
* parameter preserves literal types so `ContentValue<typeof X>` can infer enums and required keys.
|
|
92
|
+
*/
|
|
93
|
+
export declare function defineContentType<const T extends ContentTypeDefinition>(definition: T): T;
|
|
94
|
+
//#endregion
|
|
95
|
+
//# sourceMappingURL=define-content-type.d.ts.map
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
//#region ../core/dist/define-content-type.js
|
|
2
|
+
const ID_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
3
|
+
const CONTENT_SCALAR_TYPES = [
|
|
4
|
+
"string",
|
|
5
|
+
"number",
|
|
6
|
+
"integer",
|
|
7
|
+
"boolean"
|
|
8
|
+
];
|
|
9
|
+
const CONTENT_PROPERTY_TYPES = [
|
|
10
|
+
...CONTENT_SCALAR_TYPES,
|
|
11
|
+
"array",
|
|
12
|
+
"object"
|
|
13
|
+
];
|
|
14
|
+
const SCALAR_TYPE_LIST = "'string' | 'number' | 'integer' | 'boolean'";
|
|
15
|
+
const PROPERTY_TYPE_LIST = `${SCALAR_TYPE_LIST} | 'array' | 'object'`;
|
|
16
|
+
const ROOT_KEYWORDS = /* @__PURE__ */ new Set([
|
|
17
|
+
"type",
|
|
18
|
+
"additionalProperties",
|
|
19
|
+
"required",
|
|
20
|
+
"properties"
|
|
21
|
+
]);
|
|
22
|
+
/** The closed top-level envelope. An unknown key would survive canonicalize + hash and ship to the
|
|
23
|
+
* Registry, so it is rejected here rather than at artifact load. */
|
|
24
|
+
const ENVELOPE_KEYS = /* @__PURE__ */ new Set([
|
|
25
|
+
"id",
|
|
26
|
+
"title",
|
|
27
|
+
"description",
|
|
28
|
+
"schema"
|
|
29
|
+
]);
|
|
30
|
+
const SCALAR_KEYWORDS = /* @__PURE__ */ new Set([
|
|
31
|
+
"type",
|
|
32
|
+
"title",
|
|
33
|
+
"description",
|
|
34
|
+
"default",
|
|
35
|
+
"enum",
|
|
36
|
+
"format",
|
|
37
|
+
"minLength",
|
|
38
|
+
"maxLength",
|
|
39
|
+
"pattern",
|
|
40
|
+
"minimum",
|
|
41
|
+
"maximum",
|
|
42
|
+
"widget"
|
|
43
|
+
]);
|
|
44
|
+
const ARRAY_KEYWORDS = /* @__PURE__ */ new Set([
|
|
45
|
+
"type",
|
|
46
|
+
"title",
|
|
47
|
+
"description",
|
|
48
|
+
"items",
|
|
49
|
+
"minItems",
|
|
50
|
+
"maxItems",
|
|
51
|
+
"widget"
|
|
52
|
+
]);
|
|
53
|
+
const OBJECT_KEYWORDS = /* @__PURE__ */ new Set([
|
|
54
|
+
"type",
|
|
55
|
+
"title",
|
|
56
|
+
"description",
|
|
57
|
+
"additionalProperties",
|
|
58
|
+
"required",
|
|
59
|
+
"properties",
|
|
60
|
+
"widget"
|
|
61
|
+
]);
|
|
62
|
+
const STRING_ONLY_KEYWORDS = [
|
|
63
|
+
"format",
|
|
64
|
+
"minLength",
|
|
65
|
+
"maxLength",
|
|
66
|
+
"pattern"
|
|
67
|
+
];
|
|
68
|
+
const NUMERIC_ONLY_KEYWORDS = ["minimum", "maximum"];
|
|
69
|
+
const STRING_ANNOTATION_KEYWORDS = ["title", "description"];
|
|
70
|
+
const STRING_LENGTH_KEYWORDS = ["minLength", "maxLength"];
|
|
71
|
+
const STRING_PATTERN_KEYWORDS = ["format", "pattern"];
|
|
72
|
+
const ITEM_BOUND_KEYWORDS = ["minItems", "maxItems"];
|
|
73
|
+
/**
|
|
74
|
+
* Declares a standalone content model. Unlike `defineComponent` (pure identity), this validates at
|
|
75
|
+
* definition time and throws one aggregated Error listing every violation. The `const` type
|
|
76
|
+
* parameter preserves literal types so `ContentValue<typeof X>` can infer enums and required keys.
|
|
77
|
+
*/
|
|
78
|
+
function defineContentType(definition) {
|
|
79
|
+
if (!isRecord(definition)) throw new Error("Invalid content type \"<unknown>\":\n- definition must be an object");
|
|
80
|
+
const violations = [];
|
|
81
|
+
collectEnvelopeViolations(definition, violations);
|
|
82
|
+
collectIdentityViolations(definition, violations);
|
|
83
|
+
collectSchemaViolations(definition.schema, violations);
|
|
84
|
+
collectSerializabilityViolations(definition, "definition", [], violations);
|
|
85
|
+
if (violations.length > 0) {
|
|
86
|
+
const label = typeof definition.id === "string" && definition.id.length > 0 ? definition.id : "<unknown>";
|
|
87
|
+
throw new Error(`Invalid content type "${label}":\n- ${violations.join("\n- ")}`);
|
|
88
|
+
}
|
|
89
|
+
return definition;
|
|
90
|
+
}
|
|
91
|
+
function isRecord(value) {
|
|
92
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
93
|
+
}
|
|
94
|
+
/** V6 (envelope): the top-level model shape is closed. */
|
|
95
|
+
function collectEnvelopeViolations(definition, violations) {
|
|
96
|
+
for (const key of Object.keys(definition)) if (!ENVELOPE_KEYS.has(key)) violations.push(`unknown model key "${key}"`);
|
|
97
|
+
}
|
|
98
|
+
/** V1 (id) and V2 (title). */
|
|
99
|
+
function collectIdentityViolations(definition, violations) {
|
|
100
|
+
if (typeof definition.id !== "string" || !ID_PATTERN.test(definition.id)) violations.push(`id must be a URL-safe string matching /^[a-z][a-z0-9-]*$/ (got ${JSON.stringify(definition.id)})`);
|
|
101
|
+
if (typeof definition.title !== "string" || definition.title.length === 0) violations.push("title must be a non-empty string");
|
|
102
|
+
}
|
|
103
|
+
/** V4 (root shape) and V6 (root keyword whitelist), delegating to per-property checks (V5, V6). */
|
|
104
|
+
function collectSchemaViolations(schema, violations) {
|
|
105
|
+
if (!isRecord(schema)) {
|
|
106
|
+
violations.push("schema must be an object");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
collectKeywordViolations("schema", schema, ROOT_KEYWORDS, violations);
|
|
110
|
+
if (schema.type !== "object") violations.push("schema.type must be 'object'");
|
|
111
|
+
if (schema.additionalProperties !== false) violations.push("schema.additionalProperties must be false");
|
|
112
|
+
const { properties, required } = schema;
|
|
113
|
+
if (!isRecord(properties) || Object.keys(properties).length === 0) violations.push("schema.properties must declare at least one property");
|
|
114
|
+
else for (const [name, property] of Object.entries(properties)) collectRootPropertyViolations(name, property, violations);
|
|
115
|
+
collectRequiredViolations("schema", required, properties, violations);
|
|
116
|
+
}
|
|
117
|
+
/** The keyword whitelist for one level, plus the v1 `$ref` prohibition. */
|
|
118
|
+
function collectKeywordViolations(path, value, allowed, violations) {
|
|
119
|
+
for (const key of Object.keys(value)) if (key === "$ref") violations.push(`${path}: $ref is forbidden in v1`);
|
|
120
|
+
else if (!allowed.has(key)) violations.push(`${path}: unknown keyword "${key}"`);
|
|
121
|
+
}
|
|
122
|
+
/** `required` names only declared properties, at the root and inside a nested shape. */
|
|
123
|
+
function collectRequiredViolations(path, required, properties, violations) {
|
|
124
|
+
if (required === void 0) return;
|
|
125
|
+
if (!Array.isArray(required)) {
|
|
126
|
+
violations.push(`${path}.required must be an array of property names`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const known = isRecord(properties) ? Object.keys(properties) : [];
|
|
130
|
+
for (const name of required) if (typeof name !== "string" || !known.includes(name)) violations.push(`${path}.required names unknown property ${JSON.stringify(name)}`);
|
|
131
|
+
}
|
|
132
|
+
/** V5 (vocabulary subset) and V6 (v1 prohibitions) for one root property: six admitted types. */
|
|
133
|
+
function collectRootPropertyViolations(name, property, violations) {
|
|
134
|
+
const path = `properties.${name}`;
|
|
135
|
+
if (name === "__proto__") {
|
|
136
|
+
violations.push(`${path}: property name "${name}" is not allowed`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (!isRecord(property)) {
|
|
140
|
+
violations.push(`${path} must be an object`);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const type = property.type;
|
|
144
|
+
collectKeywordViolations(path, property, keywordsFor(type), violations);
|
|
145
|
+
collectAnnotationViolations(path, property, violations);
|
|
146
|
+
if (type === "array") {
|
|
147
|
+
collectArrayViolations(path, property, violations);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (type === "object") {
|
|
151
|
+
collectObjectShapeViolations(path, property, violations);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (typeof type !== "string" || !CONTENT_PROPERTY_TYPES.includes(type)) {
|
|
155
|
+
violations.push(`${path}.type must be one of ${PROPERTY_TYPE_LIST} (got ${JSON.stringify(type)})`);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
collectScalarViolations(path, property, type, violations);
|
|
159
|
+
}
|
|
160
|
+
/** The same rules one level down, where only the four scalar types are admitted. */
|
|
161
|
+
function collectNestedPropertyViolations(path, name, property, violations) {
|
|
162
|
+
if (name === "__proto__") {
|
|
163
|
+
violations.push(`${path}: property name "${name}" is not allowed`);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (!isRecord(property)) {
|
|
167
|
+
violations.push(`${path} must be an object`);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const type = property.type;
|
|
171
|
+
collectKeywordViolations(path, property, SCALAR_KEYWORDS, violations);
|
|
172
|
+
collectAnnotationViolations(path, property, violations);
|
|
173
|
+
if (typeof type !== "string" || !CONTENT_SCALAR_TYPES.includes(type)) {
|
|
174
|
+
violations.push(`${path}.type must be one of ${SCALAR_TYPE_LIST} (got ${JSON.stringify(type)})`);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
collectScalarViolations(path, property, type, violations);
|
|
178
|
+
}
|
|
179
|
+
function keywordsFor(type) {
|
|
180
|
+
if (type === "array") return ARRAY_KEYWORDS;
|
|
181
|
+
if (type === "object") return OBJECT_KEYWORDS;
|
|
182
|
+
return SCALAR_KEYWORDS;
|
|
183
|
+
}
|
|
184
|
+
function collectAnnotationViolations(path, property, violations) {
|
|
185
|
+
for (const keyword of STRING_ANNOTATION_KEYWORDS) if (property[keyword] !== void 0 && typeof property[keyword] !== "string") violations.push(`${path}.${keyword} must be a string`);
|
|
186
|
+
if (property.widget !== void 0 && !isRecord(property.widget)) violations.push(`${path}.widget must be an object`);
|
|
187
|
+
}
|
|
188
|
+
/** An array property: a closed object `items` shape plus the optional item-count bounds. */
|
|
189
|
+
function collectArrayViolations(path, property, violations) {
|
|
190
|
+
collectItemsViolations(`${path}.items`, property.items, violations);
|
|
191
|
+
for (const keyword of ITEM_BOUND_KEYWORDS) if (property[keyword] !== void 0 && !isNonNegativeInteger(property[keyword])) violations.push(`${path}.${keyword} must be a non-negative integer`);
|
|
192
|
+
const { minItems, maxItems } = property;
|
|
193
|
+
if (isNonNegativeInteger(minItems) && isNonNegativeInteger(maxItems) && minItems > maxItems) violations.push(`${path}.minItems must not exceed maxItems`);
|
|
194
|
+
}
|
|
195
|
+
/** An `items` shape carries the shape envelope only, so its keyword whitelist is the root one. */
|
|
196
|
+
function collectItemsViolations(path, shape, violations) {
|
|
197
|
+
if (!isRecord(shape)) {
|
|
198
|
+
violations.push(`${path} must be an object`);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
collectKeywordViolations(path, shape, ROOT_KEYWORDS, violations);
|
|
202
|
+
collectObjectShapeViolations(path, shape, violations);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The closed-object body shared by an `items` shape and an `object` property: `type`,
|
|
206
|
+
* `additionalProperties`, a non-empty `properties` map of scalars, and a valid `required`.
|
|
207
|
+
*/
|
|
208
|
+
function collectObjectShapeViolations(path, shape, violations) {
|
|
209
|
+
if (shape.type !== "object") violations.push(`${path}.type must be 'object'`);
|
|
210
|
+
if (shape.additionalProperties !== false) violations.push(`${path}.additionalProperties must be false`);
|
|
211
|
+
const { properties, required } = shape;
|
|
212
|
+
if (!isRecord(properties) || Object.keys(properties).length === 0) violations.push(`${path}.properties must declare at least one property`);
|
|
213
|
+
else for (const [name, property] of Object.entries(properties)) collectNestedPropertyViolations(`${path}.properties.${name}`, name, property, violations);
|
|
214
|
+
collectRequiredViolations(path, required, properties, violations);
|
|
215
|
+
}
|
|
216
|
+
/** The scalar constraint domains, unchanged from v1 and applied at both levels. */
|
|
217
|
+
function collectScalarViolations(path, property, type, violations) {
|
|
218
|
+
if (type === "string") {
|
|
219
|
+
for (const keyword of STRING_LENGTH_KEYWORDS) if (property[keyword] !== void 0 && !isNonNegativeInteger(property[keyword])) violations.push(`${path}.${keyword} must be a non-negative integer`);
|
|
220
|
+
for (const keyword of STRING_PATTERN_KEYWORDS) if (property[keyword] !== void 0 && typeof property[keyword] !== "string") violations.push(`${path}.${keyword} must be a string`);
|
|
221
|
+
if (typeof property.pattern === "string" && !isValidRegExp(property.pattern)) violations.push(`${path}.pattern must be a valid regular expression`);
|
|
222
|
+
} else for (const keyword of STRING_ONLY_KEYWORDS) if (property[keyword] !== void 0) violations.push(`${path}.${keyword} only applies to type 'string'`);
|
|
223
|
+
if (type === "number" || type === "integer") {
|
|
224
|
+
for (const keyword of NUMERIC_ONLY_KEYWORDS) if (property[keyword] !== void 0 && !isFiniteNumber(property[keyword])) violations.push(`${path}.${keyword} must be a finite number`);
|
|
225
|
+
} else for (const keyword of NUMERIC_ONLY_KEYWORDS) if (property[keyword] !== void 0) violations.push(`${path}.${keyword} only applies to types 'number' and 'integer'`);
|
|
226
|
+
if (property.default !== void 0 && !matchesPropertyType(property.default, type)) violations.push(`${path}.default must be a JSON literal of type '${type}'`);
|
|
227
|
+
if (property.enum !== void 0) {
|
|
228
|
+
if (type === "boolean") violations.push(`${path}.enum is not allowed on type 'boolean'`);
|
|
229
|
+
else if (!Array.isArray(property.enum)) violations.push(`${path}.enum must be an array of literals matching type '${type}'`);
|
|
230
|
+
else if (property.enum.length === 0) violations.push(`${path}.enum must declare at least one member`);
|
|
231
|
+
else {
|
|
232
|
+
for (const member of property.enum) if (!matchesPropertyType(member, type)) violations.push(`${path}.enum member ${JSON.stringify(member)} does not match type '${type}'`);
|
|
233
|
+
if (property.default !== void 0 && !property.enum.includes(property.default)) violations.push(`${path}.default must be one of the enum members`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function isFiniteNumber(value) {
|
|
238
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
239
|
+
}
|
|
240
|
+
function isNonNegativeInteger(value) {
|
|
241
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
242
|
+
}
|
|
243
|
+
function isValidRegExp(pattern) {
|
|
244
|
+
try {
|
|
245
|
+
new RegExp(pattern);
|
|
246
|
+
return true;
|
|
247
|
+
} catch {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function matchesPropertyType(value, type) {
|
|
252
|
+
switch (type) {
|
|
253
|
+
case "string": return typeof value === "string";
|
|
254
|
+
case "number": return isFiniteNumber(value);
|
|
255
|
+
case "integer": return typeof value === "number" && Number.isInteger(value);
|
|
256
|
+
case "boolean": return typeof value === "boolean";
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/** V7 (JSON serializability), applied to the whole definition including `widget` values. */
|
|
260
|
+
function collectSerializabilityViolations(value, path, ancestors, violations) {
|
|
261
|
+
if (value === null) return;
|
|
262
|
+
if (typeof value === "function" || typeof value === "undefined" || typeof value === "symbol" || typeof value === "bigint") {
|
|
263
|
+
violations.push(`${path} is not JSON-serializable (${typeof value})`);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (typeof value !== "object") return;
|
|
267
|
+
if (ancestors.includes(value)) {
|
|
268
|
+
violations.push(`${path} is a cyclic reference`);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const nextAncestors = [...ancestors, value];
|
|
272
|
+
if (Array.isArray(value)) {
|
|
273
|
+
value.forEach((member, index) => {
|
|
274
|
+
collectSerializabilityViolations(member, `${path}[${index}]`, nextAncestors, violations);
|
|
275
|
+
});
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
for (const [key, member] of Object.entries(value)) collectSerializabilityViolations(member, `${path}.${key}`, nextAncestors, violations);
|
|
279
|
+
}
|
|
280
|
+
//#endregion
|
|
281
|
+
export { defineContentType };
|
|
282
|
+
|
|
283
|
+
//# sourceMappingURL=define-content-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-content-type.js","names":[],"sources":["../../../../core/dist/define-content-type.js"],"sourcesContent":["const ID_PATTERN = /^[a-z][a-z0-9-]*$/;\nconst CONTENT_SCALAR_TYPES = ['string', 'number', 'integer', 'boolean'];\nconst CONTENT_PROPERTY_TYPES = [...CONTENT_SCALAR_TYPES, 'array', 'object'];\nconst SCALAR_TYPE_LIST = \"'string' | 'number' | 'integer' | 'boolean'\";\nconst PROPERTY_TYPE_LIST = `${SCALAR_TYPE_LIST} | 'array' | 'object'`;\nconst ROOT_KEYWORDS = new Set(['type', 'additionalProperties', 'required', 'properties']);\n/** The closed top-level envelope. An unknown key would survive canonicalize + hash and ship to the\n * Registry, so it is rejected here rather than at artifact load. */\nconst ENVELOPE_KEYS = new Set(['id', 'title', 'description', 'schema']);\nconst SCALAR_KEYWORDS = new Set([\n 'type',\n 'title',\n 'description',\n 'default',\n 'enum',\n 'format',\n 'minLength',\n 'maxLength',\n 'pattern',\n 'minimum',\n 'maximum',\n 'widget',\n]);\nconst ARRAY_KEYWORDS = new Set(['type', 'title', 'description', 'items', 'minItems', 'maxItems', 'widget']);\nconst OBJECT_KEYWORDS = new Set([\n 'type',\n 'title',\n 'description',\n 'additionalProperties',\n 'required',\n 'properties',\n 'widget',\n]);\nconst STRING_ONLY_KEYWORDS = ['format', 'minLength', 'maxLength', 'pattern'];\nconst NUMERIC_ONLY_KEYWORDS = ['minimum', 'maximum'];\nconst STRING_ANNOTATION_KEYWORDS = ['title', 'description'];\nconst STRING_LENGTH_KEYWORDS = ['minLength', 'maxLength'];\nconst STRING_PATTERN_KEYWORDS = ['format', 'pattern'];\nconst ITEM_BOUND_KEYWORDS = ['minItems', 'maxItems'];\n/**\n * Declares a standalone content model. Unlike `defineComponent` (pure identity), this validates at\n * definition time and throws one aggregated Error listing every violation. The `const` type\n * parameter preserves literal types so `ContentValue<typeof X>` can infer enums and required keys.\n */\nexport function defineContentType(definition) {\n if (!isRecord(definition)) {\n throw new Error('Invalid content type \"<unknown>\":\\n- definition must be an object');\n }\n const violations = [];\n collectEnvelopeViolations(definition, violations);\n collectIdentityViolations(definition, violations);\n collectSchemaViolations(definition.schema, violations);\n collectSerializabilityViolations(definition, 'definition', [], violations);\n if (violations.length > 0) {\n const label = typeof definition.id === 'string' && definition.id.length > 0 ? definition.id : '<unknown>';\n throw new Error(`Invalid content type \"${label}\":\\n- ${violations.join('\\n- ')}`);\n }\n return definition;\n}\nfunction isRecord(value) {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n/** V6 (envelope): the top-level model shape is closed. */\nfunction collectEnvelopeViolations(definition, violations) {\n for (const key of Object.keys(definition)) {\n if (!ENVELOPE_KEYS.has(key)) {\n violations.push(`unknown model key \"${key}\"`);\n }\n }\n}\n/** V1 (id) and V2 (title). */\nfunction collectIdentityViolations(definition, violations) {\n if (typeof definition.id !== 'string' || !ID_PATTERN.test(definition.id)) {\n violations.push(`id must be a URL-safe string matching /^[a-z][a-z0-9-]*$/ (got ${JSON.stringify(definition.id)})`);\n }\n if (typeof definition.title !== 'string' || definition.title.length === 0) {\n violations.push('title must be a non-empty string');\n }\n}\n/** V4 (root shape) and V6 (root keyword whitelist), delegating to per-property checks (V5, V6). */\nfunction collectSchemaViolations(schema, violations) {\n if (!isRecord(schema)) {\n violations.push('schema must be an object');\n return;\n }\n collectKeywordViolations('schema', schema, ROOT_KEYWORDS, violations);\n if (schema.type !== 'object') {\n violations.push(\"schema.type must be 'object'\");\n }\n if (schema.additionalProperties !== false) {\n violations.push('schema.additionalProperties must be false');\n }\n const { properties, required } = schema;\n if (!isRecord(properties) || Object.keys(properties).length === 0) {\n violations.push('schema.properties must declare at least one property');\n }\n else {\n for (const [name, property] of Object.entries(properties)) {\n collectRootPropertyViolations(name, property, violations);\n }\n }\n collectRequiredViolations('schema', required, properties, violations);\n}\n/** The keyword whitelist for one level, plus the v1 `$ref` prohibition. */\nfunction collectKeywordViolations(path, value, allowed, violations) {\n for (const key of Object.keys(value)) {\n if (key === '$ref') {\n violations.push(`${path}: $ref is forbidden in v1`);\n }\n else if (!allowed.has(key)) {\n violations.push(`${path}: unknown keyword \"${key}\"`);\n }\n }\n}\n/** `required` names only declared properties, at the root and inside a nested shape. */\nfunction collectRequiredViolations(path, required, properties, violations) {\n if (required === undefined) {\n return;\n }\n if (!Array.isArray(required)) {\n violations.push(`${path}.required must be an array of property names`);\n return;\n }\n const known = isRecord(properties) ? Object.keys(properties) : [];\n for (const name of required) {\n if (typeof name !== 'string' || !known.includes(name)) {\n violations.push(`${path}.required names unknown property ${JSON.stringify(name)}`);\n }\n }\n}\n/** V5 (vocabulary subset) and V6 (v1 prohibitions) for one root property: six admitted types. */\nfunction collectRootPropertyViolations(name, property, violations) {\n const path = `properties.${name}`;\n // In a JS object literal `__proto__:` sets the prototype instead of creating an own property, so the model silently loses the property at runtime.\n if (name === '__proto__') {\n violations.push(`${path}: property name \"${name}\" is not allowed`);\n return;\n }\n if (!isRecord(property)) {\n violations.push(`${path} must be an object`);\n return;\n }\n const type = property.type;\n collectKeywordViolations(path, property, keywordsFor(type), violations);\n collectAnnotationViolations(path, property, violations);\n if (type === 'array') {\n collectArrayViolations(path, property, violations);\n return;\n }\n if (type === 'object') {\n collectObjectShapeViolations(path, property, violations);\n return;\n }\n if (typeof type !== 'string' || !CONTENT_PROPERTY_TYPES.includes(type)) {\n violations.push(`${path}.type must be one of ${PROPERTY_TYPE_LIST} (got ${JSON.stringify(type)})`);\n return;\n }\n collectScalarViolations(path, property, type, violations);\n}\n/** The same rules one level down, where only the four scalar types are admitted. */\nfunction collectNestedPropertyViolations(path, name, property, violations) {\n if (name === '__proto__') {\n violations.push(`${path}: property name \"${name}\" is not allowed`);\n return;\n }\n if (!isRecord(property)) {\n violations.push(`${path} must be an object`);\n return;\n }\n const type = property.type;\n collectKeywordViolations(path, property, SCALAR_KEYWORDS, violations);\n collectAnnotationViolations(path, property, violations);\n if (typeof type !== 'string' || !CONTENT_SCALAR_TYPES.includes(type)) {\n violations.push(`${path}.type must be one of ${SCALAR_TYPE_LIST} (got ${JSON.stringify(type)})`);\n return;\n }\n collectScalarViolations(path, property, type, violations);\n}\nfunction keywordsFor(type) {\n if (type === 'array') {\n return ARRAY_KEYWORDS;\n }\n if (type === 'object') {\n return OBJECT_KEYWORDS;\n }\n return SCALAR_KEYWORDS;\n}\nfunction collectAnnotationViolations(path, property, violations) {\n for (const keyword of STRING_ANNOTATION_KEYWORDS) {\n if (property[keyword] !== undefined && typeof property[keyword] !== 'string') {\n violations.push(`${path}.${keyword} must be a string`);\n }\n }\n if (property.widget !== undefined && !isRecord(property.widget)) {\n violations.push(`${path}.widget must be an object`);\n }\n}\n/** An array property: a closed object `items` shape plus the optional item-count bounds. */\nfunction collectArrayViolations(path, property, violations) {\n collectItemsViolations(`${path}.items`, property.items, violations);\n for (const keyword of ITEM_BOUND_KEYWORDS) {\n if (property[keyword] !== undefined && !isNonNegativeInteger(property[keyword])) {\n violations.push(`${path}.${keyword} must be a non-negative integer`);\n }\n }\n const { minItems, maxItems } = property;\n if (isNonNegativeInteger(minItems) && isNonNegativeInteger(maxItems) && minItems > maxItems) {\n violations.push(`${path}.minItems must not exceed maxItems`);\n }\n}\n/** An `items` shape carries the shape envelope only, so its keyword whitelist is the root one. */\nfunction collectItemsViolations(path, shape, violations) {\n if (!isRecord(shape)) {\n violations.push(`${path} must be an object`);\n return;\n }\n collectKeywordViolations(path, shape, ROOT_KEYWORDS, violations);\n collectObjectShapeViolations(path, shape, violations);\n}\n/**\n * The closed-object body shared by an `items` shape and an `object` property: `type`,\n * `additionalProperties`, a non-empty `properties` map of scalars, and a valid `required`.\n */\nfunction collectObjectShapeViolations(path, shape, violations) {\n if (shape.type !== 'object') {\n violations.push(`${path}.type must be 'object'`);\n }\n if (shape.additionalProperties !== false) {\n violations.push(`${path}.additionalProperties must be false`);\n }\n const { properties, required } = shape;\n if (!isRecord(properties) || Object.keys(properties).length === 0) {\n violations.push(`${path}.properties must declare at least one property`);\n }\n else {\n for (const [name, property] of Object.entries(properties)) {\n collectNestedPropertyViolations(`${path}.properties.${name}`, name, property, violations);\n }\n }\n collectRequiredViolations(path, required, properties, violations);\n}\n/** The scalar constraint domains, unchanged from v1 and applied at both levels. */\nfunction collectScalarViolations(path, property, type, violations) {\n if (type === 'string') {\n for (const keyword of STRING_LENGTH_KEYWORDS) {\n if (property[keyword] !== undefined && !isNonNegativeInteger(property[keyword])) {\n violations.push(`${path}.${keyword} must be a non-negative integer`);\n }\n }\n for (const keyword of STRING_PATTERN_KEYWORDS) {\n if (property[keyword] !== undefined && typeof property[keyword] !== 'string') {\n violations.push(`${path}.${keyword} must be a string`);\n }\n }\n if (typeof property.pattern === 'string' && !isValidRegExp(property.pattern)) {\n violations.push(`${path}.pattern must be a valid regular expression`);\n }\n }\n else {\n for (const keyword of STRING_ONLY_KEYWORDS) {\n if (property[keyword] !== undefined) {\n violations.push(`${path}.${keyword} only applies to type 'string'`);\n }\n }\n }\n if (type === 'number' || type === 'integer') {\n for (const keyword of NUMERIC_ONLY_KEYWORDS) {\n if (property[keyword] !== undefined && !isFiniteNumber(property[keyword])) {\n violations.push(`${path}.${keyword} must be a finite number`);\n }\n }\n }\n else {\n for (const keyword of NUMERIC_ONLY_KEYWORDS) {\n if (property[keyword] !== undefined) {\n violations.push(`${path}.${keyword} only applies to types 'number' and 'integer'`);\n }\n }\n }\n if (property.default !== undefined && !matchesPropertyType(property.default, type)) {\n violations.push(`${path}.default must be a JSON literal of type '${type}'`);\n }\n if (property.enum !== undefined) {\n if (type === 'boolean') {\n violations.push(`${path}.enum is not allowed on type 'boolean'`);\n }\n else if (!Array.isArray(property.enum)) {\n violations.push(`${path}.enum must be an array of literals matching type '${type}'`);\n }\n else if (property.enum.length === 0) {\n violations.push(`${path}.enum must declare at least one member`);\n }\n else {\n for (const member of property.enum) {\n if (!matchesPropertyType(member, type)) {\n violations.push(`${path}.enum member ${JSON.stringify(member)} does not match type '${type}'`);\n }\n }\n if (property.default !== undefined && !property.enum.includes(property.default)) {\n violations.push(`${path}.default must be one of the enum members`);\n }\n }\n }\n}\nfunction isFiniteNumber(value) {\n return typeof value === 'number' && Number.isFinite(value);\n}\nfunction isNonNegativeInteger(value) {\n return typeof value === 'number' && Number.isInteger(value) && value >= 0;\n}\nfunction isValidRegExp(pattern) {\n try {\n new RegExp(pattern);\n return true;\n }\n catch {\n return false;\n }\n}\nfunction matchesPropertyType(value, type) {\n switch (type) {\n case 'string':\n return typeof value === 'string';\n case 'number':\n return isFiniteNumber(value);\n case 'integer':\n return typeof value === 'number' && Number.isInteger(value);\n case 'boolean':\n return typeof value === 'boolean';\n }\n}\n/** V7 (JSON serializability), applied to the whole definition including `widget` values. */\nfunction collectSerializabilityViolations(value, path, ancestors, violations) {\n if (value === null) {\n return;\n }\n if (typeof value === 'function' ||\n typeof value === 'undefined' ||\n typeof value === 'symbol' ||\n typeof value === 'bigint') {\n violations.push(`${path} is not JSON-serializable (${typeof value})`);\n return;\n }\n if (typeof value !== 'object') {\n return;\n }\n if (ancestors.includes(value)) {\n violations.push(`${path} is a cyclic reference`);\n return;\n }\n const nextAncestors = [...ancestors, value];\n if (Array.isArray(value)) {\n value.forEach((member, index) => {\n collectSerializabilityViolations(member, `${path}[${index}]`, nextAncestors, violations);\n });\n return;\n }\n for (const [key, member] of Object.entries(value)) {\n collectSerializabilityViolations(member, `${path}.${key}`, nextAncestors, violations);\n }\n}\n//# sourceMappingURL=define-content-type.js.map"],"mappings":";AAAA,MAAM,aAAa;AACnB,MAAM,uBAAuB;CAAC;CAAU;CAAU;CAAW;AAAS;AACtE,MAAM,yBAAyB;CAAC,GAAG;CAAsB;CAAS;AAAQ;AAC1E,MAAM,mBAAmB;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U,YAAY,OAAO,UAAU,KAAK;EAC9D,KAAK,WACD,OAAO,OAAO,UAAU;CAChC;AACJ;;AAEA,SAAS,iCAAiC,OAAO,MAAM,WAAW,YAAY;CAC1E,IAAI,UAAU,MACV;CAEJ,IAAI,OAAO,UAAU,cACjB,OAAO,UAAU,eACjB,OAAO,UAAU,YACjB,OAAO,UAAU,UAAU;EAC3B,WAAW,KAAK,GAAG,KAAK,6BAA6B,OAAO,MAAM,EAAE;EACpE;CACJ;CACA,IAAI,OAAO,UAAU,UACjB;CAEJ,IAAI,UAAU,SAAS,KAAK,GAAG;EAC3B,WAAW,KAAK,GAAG,KAAK,uBAAuB;EAC/C;CACJ;CACA,MAAM,gBAAgB,CAAC,GAAG,WAAW,KAAK;CAC1C,IAAI,MAAM,QAAQ,KAAK,GAAG;EACtB,MAAM,SAAS,QAAQ,UAAU;GAC7B,iCAAiC,QAAQ,GAAG,KAAK,GAAG,MAAM,IAAI,eAAe,UAAU;EAC3F,CAAC;EACD;CACJ;CACA,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,KAAK,GAC5C,iCAAiC,QAAQ,GAAG,KAAK,GAAG,OAAO,eAAe,UAAU;AAE5F"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionSelector } from "./actions/registry.js";
|
|
2
|
+
import { MockActions, mockAction } from "./actions/mock-action.js";
|
|
3
|
+
import { Direction, JsonValue, StorefrontContext } from "./schema/generated/schema.js";
|
|
4
|
+
import { ContentArraySchema, ContentNestedObjectShape, ContentObjectPropertySchema, ContentObjectSchema, ContentPropertySchema, ContentPropertyType, ContentScalarSchema, ContentScalarType, ContentTypeDefinition, ContentValue, defineContentType } from "./define-content-type.js";
|
|
5
|
+
import { ComponentDefinition, EditorMetadata, FetchStrategy, PropSchema, PropSchemaField, PropType, defineComponent } from "./define-component.js";
|
|
6
|
+
import "./types.js";
|
|
7
|
+
export { type ActionSelector, type ComponentDefinition, type ContentArraySchema, type ContentNestedObjectShape, type ContentObjectPropertySchema, type ContentObjectSchema, type ContentPropertySchema, type ContentPropertyType, type ContentScalarSchema, type ContentScalarType, type ContentTypeDefinition, type ContentValue, type EditorMetadata, type FetchStrategy, type JsonValue, type MockActions, type PropSchema, type PropSchemaField, type PropType, type StorefrontContext, defineComponent, defineContentType, mockAction };
|