@mframework/core 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/README.md +0 -0
- package/bin/create-adapter +18 -0
- package/bin/create-adapter.cjs +18 -0
- package/createNormalizer.ts +7 -0
- package/dist/adapters/auth.d.ts +9 -0
- package/dist/adapters/auth.js +1 -0
- package/dist/adapters/cart.d.ts +22 -0
- package/dist/adapters/cart.js +1 -0
- package/dist/adapters/catalog.d.ts +17 -0
- package/dist/adapters/catalog.js +1 -0
- package/dist/adapters/common.d.ts +9 -0
- package/dist/adapters/common.js +1 -0
- package/dist/adapters/search.d.ts +21 -0
- package/dist/adapters/search.js +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +72 -0
- package/dist/plugins/defineAdapter.d.ts +6 -0
- package/dist/plugins/defineAdapter.js +3 -0
- package/dist/plugins/defineModule.d.ts +2 -0
- package/dist/plugins/defineModule.js +3 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +3 -0
- package/dist/plugins/registry.d.ts +10 -0
- package/dist/plugins/registry.js +27 -0
- package/dist/runtime/app.d.ts +2 -0
- package/dist/runtime/app.js +20 -0
- package/dist/runtime/config.d.ts +7 -0
- package/dist/runtime/config.js +9 -0
- package/dist/runtime/context.d.ts +9 -0
- package/dist/runtime/context.js +11 -0
- package/dist/runtime/hooks.d.ts +5 -0
- package/dist/runtime/hooks.js +18 -0
- package/dist/runtime/lifecycle.d.ts +4 -0
- package/dist/runtime/lifecycle.js +5 -0
- package/dist/src/adapters/auth.d.ts +9 -0
- package/dist/src/adapters/auth.js +1 -0
- package/dist/src/adapters/cart.d.ts +22 -0
- package/dist/src/adapters/cart.js +1 -0
- package/dist/src/adapters/catalog.d.ts +17 -0
- package/dist/src/adapters/catalog.js +1 -0
- package/dist/src/adapters/common.d.ts +9 -0
- package/dist/src/adapters/common.js +1 -0
- package/dist/src/adapters/lists.d.ts +17 -0
- package/dist/src/adapters/lists.js +1 -0
- package/dist/src/adapters/search.d.ts +21 -0
- package/dist/src/adapters/search.js +1 -0
- package/dist/src/plugins/defineAdapter.d.ts +2 -0
- package/dist/src/plugins/defineAdapter.js +3 -0
- package/dist/src/plugins/defineModule.d.ts +2 -0
- package/dist/src/plugins/defineModule.js +3 -0
- package/dist/src/plugins/index.d.ts +1 -0
- package/dist/src/plugins/index.js +3 -0
- package/dist/src/plugins/registry.d.ts +14 -0
- package/dist/src/plugins/registry.js +46 -0
- package/dist/src/runtime/app.d.ts +6 -0
- package/dist/src/runtime/app.js +20 -0
- package/dist/src/runtime/config.d.ts +18 -0
- package/dist/src/runtime/config.js +20 -0
- package/dist/src/runtime/context.d.ts +9 -0
- package/dist/src/runtime/context.js +11 -0
- package/dist/src/runtime/hooks.d.ts +6 -0
- package/dist/src/runtime/hooks.js +21 -0
- package/dist/src/runtime/lifecycle.d.ts +4 -0
- package/dist/src/runtime/lifecycle.js +5 -0
- package/dist/src/types/adapters.d.ts +14 -0
- package/dist/src/types/adapters.js +1 -0
- package/dist/src/types/app.d.ts +13 -0
- package/dist/src/types/app.js +1 -0
- package/dist/src/types/auth/adapter.d.ts +6 -0
- package/dist/src/types/auth/adapter.js +1 -0
- package/dist/src/types/auth/inputs.d.ts +22 -0
- package/dist/src/types/auth/inputs.js +21 -0
- package/dist/src/types/auth/providers.d.ts +6 -0
- package/dist/src/types/auth/providers.js +1 -0
- package/dist/src/types/auth/session.d.ts +7 -0
- package/dist/src/types/auth/session.js +1 -0
- package/dist/src/types/auth/user.d.ts +9 -0
- package/dist/src/types/auth/user.js +1 -0
- package/dist/src/types/commerce/adapter.d.ts +18 -0
- package/dist/src/types/commerce/adapter.js +1 -0
- package/dist/src/types/commerce/cart.d.ts +14 -0
- package/dist/src/types/commerce/cart.js +1 -0
- package/dist/src/types/commerce/category.d.ts +7 -0
- package/dist/src/types/commerce/category.js +1 -0
- package/dist/src/types/commerce/order.d.ts +12 -0
- package/dist/src/types/commerce/order.js +1 -0
- package/dist/src/types/commerce/product.d.ts +28 -0
- package/dist/src/types/commerce/product.js +1 -0
- package/dist/src/types/compat/legacy.d.ts +21 -0
- package/dist/src/types/compat/legacy.js +1 -0
- package/dist/src/types/config.d.ts +8 -0
- package/dist/src/types/config.js +1 -0
- package/dist/src/types/core/common.d.ts +2 -0
- package/dist/src/types/core/common.js +1 -0
- package/dist/src/types/core/error.d.ts +5 -0
- package/dist/src/types/core/error.js +1 -0
- package/dist/src/types/core/id.d.ts +1 -0
- package/dist/src/types/core/id.js +1 -0
- package/dist/src/types/core/pagination.d.ts +6 -0
- package/dist/src/types/core/pagination.js +1 -0
- package/dist/src/types/core/result.d.ts +9 -0
- package/dist/src/types/core/result.js +1 -0
- package/dist/src/types/core/utility.d.ts +5 -0
- package/dist/src/types/core/utility.js +1 -0
- package/dist/src/types/events.d.ts +20 -0
- package/dist/src/types/events.js +22 -0
- package/dist/src/types/index.d.ts +38 -0
- package/dist/src/types/index.js +35 -0
- package/dist/src/types/module.d.ts +15 -0
- package/dist/src/types/module.js +1 -0
- package/dist/src/types/sdk/adapter.d.ts +5 -0
- package/dist/src/types/sdk/adapter.js +1 -0
- package/dist/src/types/sdk/endpoint.d.ts +7 -0
- package/dist/src/types/sdk/endpoint.js +1 -0
- package/dist/src/types/sdk/errors.d.ts +6 -0
- package/dist/src/types/sdk/errors.js +1 -0
- package/dist/src/types/sdk/request.d.ts +6 -0
- package/dist/src/types/sdk/request.js +1 -0
- package/dist/src/types/sdk/response.d.ts +5 -0
- package/dist/src/types/sdk/response.js +1 -0
- package/dist/src/types/search/adapter.d.ts +6 -0
- package/dist/src/types/search/adapter.js +1 -0
- package/dist/src/types/search/facet.d.ts +8 -0
- package/dist/src/types/search/facet.js +1 -0
- package/dist/src/types/search/opensearch.d.ts +21 -0
- package/dist/src/types/search/opensearch.js +1 -0
- package/dist/src/types/search/query.d.ts +17 -0
- package/dist/src/types/search/query.js +1 -0
- package/dist/src/types/search/result.d.ts +15 -0
- package/dist/src/types/search/result.js +1 -0
- package/dist/src/types/ui/api/global-search.d.ts +8 -0
- package/dist/src/types/ui/api/global-search.js +1 -0
- package/dist/src/types/ui/blocks/block-button-group.d.ts +6 -0
- package/dist/src/types/ui/blocks/block-button-group.js +1 -0
- package/dist/src/types/ui/blocks/block-button.d.ts +13 -0
- package/dist/src/types/ui/blocks/block-button.js +1 -0
- package/dist/src/types/ui/blocks/block-column.d.ts +18 -0
- package/dist/src/types/ui/blocks/block-column.js +1 -0
- package/dist/src/types/ui/blocks/block-cta.d.ts +11 -0
- package/dist/src/types/ui/blocks/block-cta.js +1 -0
- package/dist/src/types/ui/blocks/block-divider.d.ts +4 -0
- package/dist/src/types/ui/blocks/block-divider.js +1 -0
- package/dist/src/types/ui/blocks/block-faq.d.ts +11 -0
- package/dist/src/types/ui/blocks/block-faq.js +1 -0
- package/dist/src/types/ui/blocks/block-form.d.ts +7 -0
- package/dist/src/types/ui/blocks/block-form.js +1 -0
- package/dist/src/types/ui/blocks/block-gallery.d.ts +13 -0
- package/dist/src/types/ui/blocks/block-gallery.js +1 -0
- package/dist/src/types/ui/blocks/block-hero.d.ts +11 -0
- package/dist/src/types/ui/blocks/block-hero.js +1 -0
- package/dist/src/types/ui/blocks/block-html.d.ts +4 -0
- package/dist/src/types/ui/blocks/block-html.js +1 -0
- package/dist/src/types/ui/blocks/block-logocloud.d.ts +13 -0
- package/dist/src/types/ui/blocks/block-logocloud.js +1 -0
- package/dist/src/types/ui/blocks/block-quote.d.ts +10 -0
- package/dist/src/types/ui/blocks/block-quote.js +1 -0
- package/dist/src/types/ui/blocks/block-richtext.d.ts +7 -0
- package/dist/src/types/ui/blocks/block-richtext.js +1 -0
- package/dist/src/types/ui/blocks/block-steps.d.ts +21 -0
- package/dist/src/types/ui/blocks/block-steps.js +1 -0
- package/dist/src/types/ui/blocks/block-team.d.ts +6 -0
- package/dist/src/types/ui/blocks/block-team.js +1 -0
- package/dist/src/types/ui/blocks/block-testimonial.d.ts +13 -0
- package/dist/src/types/ui/blocks/block-testimonial.js +1 -0
- package/dist/src/types/ui/blocks/block-video.d.ts +9 -0
- package/dist/src/types/ui/blocks/block-video.js +1 -0
- package/dist/src/types/ui/blocks/block.d.ts +17 -0
- package/dist/src/types/ui/blocks/block.js +1 -0
- package/dist/src/types/ui/blocks/index.d.ts +18 -0
- package/dist/src/types/ui/blocks/index.js +1 -0
- package/dist/src/types/ui/component.d.ts +6 -0
- package/dist/src/types/ui/component.js +1 -0
- package/dist/src/types/ui/content/category.d.ts +10 -0
- package/dist/src/types/ui/content/category.js +1 -0
- package/dist/src/types/ui/content/form.d.ts +21 -0
- package/dist/src/types/ui/content/form.js +1 -0
- package/dist/src/types/ui/content/index.d.ts +6 -0
- package/dist/src/types/ui/content/index.js +1 -0
- package/dist/src/types/ui/content/page.d.ts +38 -0
- package/dist/src/types/ui/content/page.js +1 -0
- package/dist/src/types/ui/content/post.d.ts +38 -0
- package/dist/src/types/ui/content/post.js +1 -0
- package/dist/src/types/ui/content/team.d.ts +17 -0
- package/dist/src/types/ui/content/team.js +1 -0
- package/dist/src/types/ui/content/testimonial.d.ts +18 -0
- package/dist/src/types/ui/content/testimonial.js +1 -0
- package/dist/src/types/ui/form.d.ts +12 -0
- package/dist/src/types/ui/form.js +1 -0
- package/dist/src/types/ui/help/index.d.ts +51 -0
- package/dist/src/types/ui/help/index.js +1 -0
- package/dist/src/types/ui/meta/analytics.d.ts +21 -0
- package/dist/src/types/ui/meta/analytics.js +1 -0
- package/dist/src/types/ui/meta/config.d.ts +22 -0
- package/dist/src/types/ui/meta/config.js +1 -0
- package/dist/src/types/ui/meta/globals.d.ts +33 -0
- package/dist/src/types/ui/meta/globals.js +1 -0
- package/dist/src/types/ui/meta/index.d.ts +6 -0
- package/dist/src/types/ui/meta/index.js +1 -0
- package/dist/src/types/ui/meta/navigation.d.ts +31 -0
- package/dist/src/types/ui/meta/navigation.js +1 -0
- package/dist/src/types/ui/meta/redirect.d.ts +12 -0
- package/dist/src/types/ui/meta/redirect.js +1 -0
- package/dist/src/types/ui/meta/seo.d.ts +19 -0
- package/dist/src/types/ui/meta/seo.js +1 -0
- package/dist/src/types/ui/os/contact.d.ts +22 -0
- package/dist/src/types/ui/os/contact.js +1 -0
- package/dist/src/types/ui/os/conversation.d.ts +23 -0
- package/dist/src/types/ui/os/conversation.js +1 -0
- package/dist/src/types/ui/os/index.d.ts +16 -0
- package/dist/src/types/ui/os/index.js +1 -0
- package/dist/src/types/ui/os/organization.d.ts +51 -0
- package/dist/src/types/ui/os/organization.js +1 -0
- package/dist/src/types/ui/os/os-activity.d.ts +26 -0
- package/dist/src/types/ui/os/os-activity.js +1 -0
- package/dist/src/types/ui/os/os-deal.d.ts +42 -0
- package/dist/src/types/ui/os/os-deal.js +1 -0
- package/dist/src/types/ui/os/os-expense.d.ts +21 -0
- package/dist/src/types/ui/os/os-expense.js +1 -0
- package/dist/src/types/ui/os/os-invoice.d.ts +46 -0
- package/dist/src/types/ui/os/os-invoice.js +1 -0
- package/dist/src/types/ui/os/os-item.d.ts +17 -0
- package/dist/src/types/ui/os/os-item.js +1 -0
- package/dist/src/types/ui/os/os-payment.d.ts +27 -0
- package/dist/src/types/ui/os/os-payment.js +1 -0
- package/dist/src/types/ui/os/os-project.d.ts +45 -0
- package/dist/src/types/ui/os/os-project.js +1 -0
- package/dist/src/types/ui/os/os-proposal.d.ts +61 -0
- package/dist/src/types/ui/os/os-proposal.js +1 -0
- package/dist/src/types/ui/os/os-settings.d.ts +17 -0
- package/dist/src/types/ui/os/os-settings.js +1 -0
- package/dist/src/types/ui/os/os-subscription.d.ts +12 -0
- package/dist/src/types/ui/os/os-subscription.js +1 -0
- package/dist/src/types/ui/os/os-task.d.ts +32 -0
- package/dist/src/types/ui/os/os-task.js +1 -0
- package/dist/src/types/ui/os/os-tax-rate.d.ts +12 -0
- package/dist/src/types/ui/os/os-tax-rate.js +1 -0
- package/dist/src/types/ui/pageComponentMap.d.ts +2 -0
- package/dist/src/types/ui/pageComponentMap.js +7 -0
- package/dist/src/types/ui/pagination.d.ts +6 -0
- package/dist/src/types/ui/pagination.js +1 -0
- package/dist/src/types/ui/schema.d.ts +78 -0
- package/dist/src/types/ui/schema.js +1 -0
- package/dist/src/types/ui/state.d.ts +5 -0
- package/dist/src/types/ui/state.js +1 -0
- package/dist/src/types/ui/system/file.d.ts +47 -0
- package/dist/src/types/ui/system/file.js +1 -0
- package/dist/src/types/ui/system/folder.d.ts +8 -0
- package/dist/src/types/ui/system/folder.js +1 -0
- package/dist/src/types/ui/system/index.d.ts +4 -0
- package/dist/src/types/ui/system/index.js +1 -0
- package/dist/src/types/ui/system/role.d.ts +20 -0
- package/dist/src/types/ui/system/role.js +1 -0
- package/dist/src/types/ui/system/user.d.ts +57 -0
- package/dist/src/types/ui/system/user.js +1 -0
- package/dist/src/utils/adapterValidation.d.ts +2 -0
- package/dist/src/utils/adapterValidation.js +8 -0
- package/dist/src/utils/env.d.ts +7 -0
- package/dist/src/utils/env.js +20 -0
- package/dist/src/utils/errors.d.ts +9 -0
- package/dist/src/utils/errors.js +13 -0
- package/dist/src/utils/logger.d.ts +9 -0
- package/dist/src/utils/logger.js +29 -0
- package/dist/types/adapters.d.ts +12 -0
- package/dist/types/adapters.js +1 -0
- package/dist/types/app.d.ts +13 -0
- package/dist/types/app.js +1 -0
- package/dist/types/config.d.ts +8 -0
- package/dist/types/config.js +1 -0
- package/dist/types/events.d.ts +16 -0
- package/dist/types/events.js +22 -0
- package/dist/types/module.d.ts +15 -0
- package/dist/types/module.js +1 -0
- package/dist/utils/errors.d.ts +9 -0
- package/dist/utils/errors.js +13 -0
- package/dist/utils/logger.d.ts +9 -0
- package/dist/utils/logger.js +29 -0
- package/errors.ts +21 -0
- package/index.ts +93 -0
- package/package.json +39 -0
- package/src/adapters/auth.ts +11 -0
- package/src/adapters/cart.ts +27 -0
- package/src/adapters/catalog.ts +21 -0
- package/src/adapters/common.ts +10 -0
- package/src/adapters/lists.ts +23 -0
- package/src/adapters/search.ts +26 -0
- package/src/normalizers/factories/apiClientFactory/context.d.ts +14 -0
- package/src/normalizers/factories/apiClientFactory/index.d.ts +3 -0
- package/src/normalizers/factories/index.d.ts +19 -0
- package/src/normalizers/factories/useBillingFactory.d.ts +12 -0
- package/src/normalizers/factories/useCartFactory.d.ts +45 -0
- package/src/normalizers/factories/useCategoryFactory.d.ts +7 -0
- package/src/normalizers/factories/useContentFactory.d.ts +16 -0
- package/src/normalizers/factories/useFacetFactory.d.ts +6 -0
- package/src/normalizers/factories/useForgotPasswordFactory.d.ts +20 -0
- package/src/normalizers/factories/useMakeOrderFactory.d.ts +7 -0
- package/src/normalizers/factories/useProductFactory.d.ts +7 -0
- package/src/normalizers/factories/useReviewFactory.d.ts +10 -0
- package/src/normalizers/factories/useSearchFactory.d.ts +7 -0
- package/src/normalizers/factories/useShippingFactory.d.ts +12 -0
- package/src/normalizers/factories/useShippingProviderFactory.d.ts +14 -0
- package/src/normalizers/factories/useStoreFactory.d.ts +2 -0
- package/src/normalizers/factories/useUserBillingFactory.d.ts +27 -0
- package/src/normalizers/factories/useUserFactory.d.ts +32 -0
- package/src/normalizers/factories/useUserOrderFactory.d.ts +7 -0
- package/src/normalizers/factories/useUserShippingFactory.d.ts +27 -0
- package/src/normalizers/factories/useWishlistFactory.d.ts +24 -0
- package/src/normalizers/utils/context/index.d.ts +8 -0
- package/src/normalizers/utils/factoryParams/commonMethods.d.ts +2 -0
- package/src/normalizers/utils/factoryParams/index.d.ts +2 -0
- package/src/normalizers/utils/factoryParams/platformMethods.d.ts +2 -0
- package/src/normalizers/utils/helpers/index.d.ts +7 -0
- package/src/normalizers/utils/i18n-redirects/index.d.ts +12 -0
- package/src/normalizers/utils/logger/defaultLogger.d.ts +7 -0
- package/src/normalizers/utils/logger/index.d.ts +5 -0
- package/src/normalizers/utils/logger/makeMessageStyle.d.ts +2 -0
- package/src/normalizers/utils/logger/makeMethod.d.ts +2 -0
- package/src/normalizers/utils/logger/mask.d.ts +2 -0
- package/src/normalizers/utils/logger/types.d.ts +13 -0
- package/src/normalizers/utils/logger/utils.d.ts +4 -0
- package/src/normalizers/utils/shared/index.d.ts +4 -0
- package/src/normalizers/utils/ssr/index.d.ts +11 -0
- package/src/normalizers/utils/wrap/index.d.ts +3 -0
- package/src/plugins/defineAdapter.ts +5 -0
- package/src/plugins/defineModule.ts +5 -0
- package/src/plugins/index.ts +3 -0
- package/src/plugins/registry.ts +58 -0
- package/src/runtime/app.ts +31 -0
- package/src/runtime/config.ts +24 -0
- package/src/runtime/context.ts +18 -0
- package/src/runtime/hooks.ts +28 -0
- package/src/runtime/lifecycle.ts +16 -0
- package/src/types/adapters.ts +17 -0
- package/src/types/app.ts +15 -0
- package/src/types/auth/adapter.ts +7 -0
- package/src/types/auth/inputs.ts +33 -0
- package/src/types/auth/providers.ts +6 -0
- package/src/types/auth/session.ts +8 -0
- package/src/types/auth/user.ts +9 -0
- package/src/types/commerce/adapter.ts +21 -0
- package/src/types/commerce/cart.ts +16 -0
- package/src/types/commerce/category.ts +7 -0
- package/src/types/commerce/order.ts +13 -0
- package/src/types/commerce/product.ts +31 -0
- package/src/types/compat/legacy.ts +19 -0
- package/src/types/config.ts +9 -0
- package/src/types/core/common.ts +2 -0
- package/src/types/core/error.ts +11 -0
- package/src/types/core/id.ts +1 -0
- package/src/types/core/pagination.ts +6 -0
- package/src/types/core/result.ts +11 -0
- package/src/types/core/utility.ts +7 -0
- package/src/types/events.ts +47 -0
- package/src/types/index.ts +49 -0
- package/src/types/module.ts +18 -0
- package/src/types/sdk/adapter.ts +10 -0
- package/src/types/sdk/endpoint.ts +11 -0
- package/src/types/sdk/errors.ts +6 -0
- package/src/types/sdk/request.ts +6 -0
- package/src/types/sdk/response.ts +5 -0
- package/src/types/search/adapter.ts +7 -0
- package/src/types/search/facet.ts +9 -0
- package/src/types/search/opensearch.ts +19 -0
- package/src/types/search/query.ts +19 -0
- package/src/types/search/result.ts +17 -0
- package/src/types/ui/api/global-search.ts +8 -0
- package/src/types/ui/blocks/block-button-group.ts +7 -0
- package/src/types/ui/blocks/block-button.ts +14 -0
- package/src/types/ui/blocks/block-column.ts +20 -0
- package/src/types/ui/blocks/block-cta.ts +10 -0
- package/src/types/ui/blocks/block-divider.ts +4 -0
- package/src/types/ui/blocks/block-faq.ts +12 -0
- package/src/types/ui/blocks/block-form.ts +8 -0
- package/src/types/ui/blocks/block-gallery.ts +14 -0
- package/src/types/ui/blocks/block-hero.ts +12 -0
- package/src/types/ui/blocks/block-html.ts +4 -0
- package/src/types/ui/blocks/block-logocloud.ts +14 -0
- package/src/types/ui/blocks/block-quote.ts +11 -0
- package/src/types/ui/blocks/block-richtext.ts +7 -0
- package/src/types/ui/blocks/block-steps.ts +22 -0
- package/src/types/ui/blocks/block-team.ts +6 -0
- package/src/types/ui/blocks/block-testimonial.ts +14 -0
- package/src/types/ui/blocks/block-video.ts +10 -0
- package/src/types/ui/blocks/block.ts +49 -0
- package/src/types/ui/blocks/index.ts +18 -0
- package/src/types/ui/component.ts +7 -0
- package/src/types/ui/content/category.ts +11 -0
- package/src/types/ui/content/form.ts +20 -0
- package/src/types/ui/content/index.ts +6 -0
- package/src/types/ui/content/page.ts +76 -0
- package/src/types/ui/content/post.ts +39 -0
- package/src/types/ui/content/team.ts +16 -0
- package/src/types/ui/content/testimonial.ts +19 -0
- package/src/types/ui/env.d.ts +8 -0
- package/src/types/ui/form.ts +17 -0
- package/src/types/ui/help/index.ts +53 -0
- package/src/types/ui/meta/analytics.ts +18 -0
- package/src/types/ui/meta/config.ts +21 -0
- package/src/types/ui/meta/globals.ts +30 -0
- package/src/types/ui/meta/index.ts +6 -0
- package/src/types/ui/meta/navigation.ts +32 -0
- package/src/types/ui/meta/redirect.ts +13 -0
- package/src/types/ui/meta/seo.ts +19 -0
- package/src/types/ui/os/contact.ts +23 -0
- package/src/types/ui/os/conversation.ts +25 -0
- package/src/types/ui/os/index.ts +16 -0
- package/src/types/ui/os/organization.ts +54 -0
- package/src/types/ui/os/os-activity.ts +28 -0
- package/src/types/ui/os/os-deal.ts +45 -0
- package/src/types/ui/os/os-expense.ts +22 -0
- package/src/types/ui/os/os-invoice.ts +48 -0
- package/src/types/ui/os/os-item.ts +18 -0
- package/src/types/ui/os/os-payment.ts +29 -0
- package/src/types/ui/os/os-project.ts +47 -0
- package/src/types/ui/os/os-proposal.ts +84 -0
- package/src/types/ui/os/os-settings.ts +19 -0
- package/src/types/ui/os/os-subscription.ts +12 -0
- package/src/types/ui/os/os-task.ts +34 -0
- package/src/types/ui/os/os-tax-rate.ts +13 -0
- package/src/types/ui/pageComponentMap.ts +8 -0
- package/src/types/ui/pagination.ts +6 -0
- package/src/types/ui/schema.d.ts +39 -0
- package/src/types/ui/schema.ts +151 -0
- package/src/types/ui/state.ts +5 -0
- package/src/types/ui/system/file.ts +46 -0
- package/src/types/ui/system/folder.ts +8 -0
- package/src/types/ui/system/index.ts +4 -0
- package/src/types/ui/system/role.ts +21 -0
- package/src/types/ui/system/user.ts +56 -0
- package/src/utils/adapterValidation.ts +10 -0
- package/src/utils/env.ts +18 -0
- package/src/utils/errors.ts +15 -0
- package/src/utils/index.d.ts +11 -0
- package/src/utils/logger.ts +37 -0
- package/tsconfig.json +15 -0
- package/validation.ts +89 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { UseUserBilling, Context, FactoryParams, CustomQuery, PlatformApi } from '../types';
|
|
2
|
+
export interface UseUserBillingFactoryParams<USER_BILLING, USER_BILLING_ITEM, API extends PlatformApi = any> extends FactoryParams<API> {
|
|
3
|
+
addAddress: (context: Context, params: {
|
|
4
|
+
address: Readonly<USER_BILLING_ITEM>;
|
|
5
|
+
billing: Readonly<USER_BILLING>;
|
|
6
|
+
customQuery?: CustomQuery;
|
|
7
|
+
}) => Promise<USER_BILLING>;
|
|
8
|
+
deleteAddress: (context: Context, params: {
|
|
9
|
+
address: Readonly<USER_BILLING_ITEM>;
|
|
10
|
+
billing: Readonly<USER_BILLING>;
|
|
11
|
+
customQuery?: CustomQuery;
|
|
12
|
+
}) => Promise<USER_BILLING>;
|
|
13
|
+
updateAddress: (context: Context, params: {
|
|
14
|
+
address: Readonly<USER_BILLING_ITEM>;
|
|
15
|
+
billing: Readonly<USER_BILLING>;
|
|
16
|
+
customQuery?: CustomQuery;
|
|
17
|
+
}) => Promise<USER_BILLING>;
|
|
18
|
+
load: (context: Context, params: {
|
|
19
|
+
billing: Readonly<USER_BILLING>;
|
|
20
|
+
}) => Promise<USER_BILLING>;
|
|
21
|
+
setDefaultAddress: (context: Context, params: {
|
|
22
|
+
address: Readonly<USER_BILLING_ITEM>;
|
|
23
|
+
billing: Readonly<USER_BILLING>;
|
|
24
|
+
customQuery?: CustomQuery;
|
|
25
|
+
}) => Promise<USER_BILLING>;
|
|
26
|
+
}
|
|
27
|
+
export declare const useUserBillingFactory: <USER_BILLING, USER_BILLING_ITEM, API extends PlatformApi = any>(factoryParams: UseUserBillingFactoryParams<USER_BILLING, USER_BILLING_ITEM, API>) => () => UseUserBilling<USER_BILLING, USER_BILLING_ITEM, API>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { UseUser, Context, FactoryParams, CustomQuery, PlatformApi } from '../types';
|
|
2
|
+
export interface UseUserFactoryParams<USER, UPDATE_USER_PARAMS, REGISTER_USER_PARAMS, API extends PlatformApi = any> extends FactoryParams<API> {
|
|
3
|
+
load: (context: Context, params?: {
|
|
4
|
+
customQuery: CustomQuery;
|
|
5
|
+
}) => Promise<USER>;
|
|
6
|
+
logOut: (context: Context, params?: {
|
|
7
|
+
currentUser: USER;
|
|
8
|
+
}) => Promise<void>;
|
|
9
|
+
updateUser: (context: Context, params: {
|
|
10
|
+
currentUser: USER;
|
|
11
|
+
updatedUserData: UPDATE_USER_PARAMS;
|
|
12
|
+
customQuery?: CustomQuery;
|
|
13
|
+
}) => Promise<USER>;
|
|
14
|
+
register: (context: Context, params: REGISTER_USER_PARAMS & {
|
|
15
|
+
customQuery?: CustomQuery;
|
|
16
|
+
}) => Promise<USER>;
|
|
17
|
+
logIn: (context: Context, params: {
|
|
18
|
+
username: string;
|
|
19
|
+
password: string;
|
|
20
|
+
customQuery?: CustomQuery;
|
|
21
|
+
}) => Promise<USER>;
|
|
22
|
+
changePassword: (context: Context, params: {
|
|
23
|
+
currentUser: USER;
|
|
24
|
+
currentPassword: string;
|
|
25
|
+
newPassword: string;
|
|
26
|
+
customQuery?: CustomQuery;
|
|
27
|
+
}) => Promise<USER>;
|
|
28
|
+
}
|
|
29
|
+
export declare const useUserFactory: <USER, UPDATE_USER_PARAMS, REGISTER_USER_PARAMS extends {
|
|
30
|
+
email: string;
|
|
31
|
+
password: string;
|
|
32
|
+
}, API extends PlatformApi = any>(factoryParams: UseUserFactoryParams<USER, UPDATE_USER_PARAMS, REGISTER_USER_PARAMS, API>) => () => UseUser<USER, UPDATE_USER_PARAMS, API>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CustomQuery, UseUserOrder, Context, FactoryParams, PlatformApi } from '../../../../normalizer-core/types';
|
|
2
|
+
export interface UseUserOrderFactoryParams<ORDERS, ORDER_SEARCH_PARAMS, API extends PlatformApi = any> extends FactoryParams<API> {
|
|
3
|
+
searchOrders: (context: Context, params: ORDER_SEARCH_PARAMS & {
|
|
4
|
+
customQuery?: CustomQuery;
|
|
5
|
+
}) => Promise<ORDERS>;
|
|
6
|
+
}
|
|
7
|
+
export declare function useUserOrderFactory<ORDERS, ORDER_SEARCH_PARAMS, API extends PlatformApi = any>(factoryParams: UseUserOrderFactoryParams<ORDERS, ORDER_SEARCH_PARAMS, API>): () => UseUserOrder<ORDERS, ORDER_SEARCH_PARAMS, API>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { UseUserShipping, Context, FactoryParams, CustomQuery, PlatformApi } from '../types';
|
|
2
|
+
export interface UseUserShippingFactoryParams<USER_SHIPPING, USER_SHIPPING_ITEM, API extends PlatformApi = any> extends FactoryParams<API> {
|
|
3
|
+
addAddress: (context: Context, params: {
|
|
4
|
+
address: Readonly<USER_SHIPPING_ITEM>;
|
|
5
|
+
shipping: Readonly<USER_SHIPPING>;
|
|
6
|
+
customQuery?: CustomQuery;
|
|
7
|
+
}) => Promise<USER_SHIPPING>;
|
|
8
|
+
deleteAddress: (context: Context, params: {
|
|
9
|
+
address: Readonly<USER_SHIPPING_ITEM>;
|
|
10
|
+
shipping: Readonly<USER_SHIPPING>;
|
|
11
|
+
customQuery?: CustomQuery;
|
|
12
|
+
}) => Promise<USER_SHIPPING>;
|
|
13
|
+
updateAddress: (context: Context, params: {
|
|
14
|
+
address: Readonly<USER_SHIPPING_ITEM>;
|
|
15
|
+
shipping: Readonly<USER_SHIPPING>;
|
|
16
|
+
customQuery?: CustomQuery;
|
|
17
|
+
}) => Promise<USER_SHIPPING>;
|
|
18
|
+
load: (context: Context, params: {
|
|
19
|
+
shipping: Readonly<USER_SHIPPING>;
|
|
20
|
+
}) => Promise<USER_SHIPPING>;
|
|
21
|
+
setDefaultAddress: (context: Context, params: {
|
|
22
|
+
address: Readonly<USER_SHIPPING_ITEM>;
|
|
23
|
+
shipping: Readonly<USER_SHIPPING>;
|
|
24
|
+
customQuery?: CustomQuery;
|
|
25
|
+
}) => Promise<USER_SHIPPING>;
|
|
26
|
+
}
|
|
27
|
+
export declare const useUserShippingFactory: <USER_SHIPPING, USER_SHIPPING_ITEM, API extends PlatformApi = any>(factoryParams: UseUserShippingFactoryParams<USER_SHIPPING, USER_SHIPPING_ITEM, API>) => () => UseUserShipping<USER_SHIPPING, USER_SHIPPING_ITEM, API>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UseWishlist, CustomQuery, Context, FactoryParams, PlatformApi } from '../types';
|
|
2
|
+
export interface UseWishlistFactoryParams<WISHLIST, WISHLIST_ITEM, PRODUCT, API extends PlatformApi = any> extends FactoryParams<API> {
|
|
3
|
+
load: (context: Context, params: {
|
|
4
|
+
customQuery?: CustomQuery;
|
|
5
|
+
}) => Promise<WISHLIST>;
|
|
6
|
+
addItem: (context: Context, params: {
|
|
7
|
+
currentWishlist: WISHLIST;
|
|
8
|
+
product: PRODUCT;
|
|
9
|
+
customQuery?: CustomQuery;
|
|
10
|
+
}) => Promise<WISHLIST>;
|
|
11
|
+
removeItem: (context: Context, params: {
|
|
12
|
+
currentWishlist: WISHLIST;
|
|
13
|
+
product: WISHLIST_ITEM;
|
|
14
|
+
customQuery?: CustomQuery;
|
|
15
|
+
}) => Promise<WISHLIST>;
|
|
16
|
+
clear: (context: Context, params: {
|
|
17
|
+
currentWishlist: WISHLIST;
|
|
18
|
+
}) => Promise<WISHLIST>;
|
|
19
|
+
isInWishlist: (context: Context, params: {
|
|
20
|
+
currentWishlist: WISHLIST;
|
|
21
|
+
product: PRODUCT;
|
|
22
|
+
}) => boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const useWishlistFactory: <WISHLIST, WISHLIST_ITEM, PRODUCT, API extends PlatformApi = any>(factoryParams: UseWishlistFactoryParams<WISHLIST, WISHLIST_ITEM, PRODUCT, API>) => () => UseWishlist<WISHLIST, WISHLIST_ITEM, PRODUCT, API>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Context } from '../../../../../normalizer-core/types';
|
|
2
|
+
interface ContextConfiguration {
|
|
3
|
+
useVSFContext: () => Context;
|
|
4
|
+
}
|
|
5
|
+
declare let useVSFContext: () => Context<any, any, any>;
|
|
6
|
+
declare const configureContext: (config: ContextConfiguration) => void;
|
|
7
|
+
declare const generateContext: (factoryParams: any) => any;
|
|
8
|
+
export { generateContext, useVSFContext, configureContext };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds prefix with base path configured in router.base to provided url
|
|
3
|
+
* @param {string} path - url to which base path will be added
|
|
4
|
+
* @returns Relative path prefixed with router.base or not modified absolute path (it needs start from http or https)
|
|
5
|
+
*/
|
|
6
|
+
declare function addBasePath(path: string): string;
|
|
7
|
+
export { addBasePath };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const i18nRedirectsUtil: ({ path, defaultLocale, availableLocales, cookieLocale, acceptedLanguages, autoRedirectByLocale }: {
|
|
2
|
+
path: string;
|
|
3
|
+
defaultLocale: string;
|
|
4
|
+
cookieLocale: string;
|
|
5
|
+
availableLocales: string[];
|
|
6
|
+
acceptedLanguages: string[];
|
|
7
|
+
autoRedirectByLocale: boolean;
|
|
8
|
+
}) => {
|
|
9
|
+
getRedirectPath: () => string;
|
|
10
|
+
getTargetLocale: () => string;
|
|
11
|
+
};
|
|
12
|
+
export default i18nRedirectsUtil;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VSFLogger } from '../../types';
|
|
2
|
+
declare let Logger: VSFLogger;
|
|
3
|
+
declare type LoggerImplementation = VSFLogger | ((verbosity: string) => VSFLogger);
|
|
4
|
+
declare const registerLogger: (loggerImplementation: LoggerImplementation, verbosity: string) => void;
|
|
5
|
+
export { Logger, registerLogger };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare type LogMessage = string[] | Error | Record<string, any> | string | boolean;
|
|
2
|
+
export declare const getMessage: (message: LogMessage) => string | undefined;
|
|
3
|
+
export declare const detectNode: boolean;
|
|
4
|
+
export declare const mountLog: (name: string, style: string) => string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare type VsfRef = <T>(data?: T, key?: string) => Ref<T>;
|
|
4
|
+
interface SSRConfiguration {
|
|
5
|
+
onSSR: (fn: () => void) => any;
|
|
6
|
+
vsfRef: VsfRef;
|
|
7
|
+
}
|
|
8
|
+
declare let onSSR: (callback: Function, target?: import("vue").ComponentInternalInstance) => Function;
|
|
9
|
+
declare let vsfRef: VsfRef;
|
|
10
|
+
declare const configureSSR: (config: SSRConfiguration) => void;
|
|
11
|
+
export { onSSR, vsfRef, configureSSR };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { M FrameworkModule } from '../types/module'
|
|
2
|
+
import { M FrameworkContext } from '../runtime/context'
|
|
3
|
+
import {
|
|
4
|
+
M FrameworkAdapterKey,
|
|
5
|
+
M FrameworkAdapterMap,
|
|
6
|
+
M FrameworkAdapterOf
|
|
7
|
+
} from '../types/adapters'
|
|
8
|
+
import { M FrameworkEventBus } from '../types/events'
|
|
9
|
+
|
|
10
|
+
export class ModuleRegistry {
|
|
11
|
+
private modules = new Map<string, M FrameworkModule>()
|
|
12
|
+
private adapters = new Map<M FrameworkAdapterKey, M FrameworkAdapterMap[M FrameworkAdapterKey]>()
|
|
13
|
+
private bus: M FrameworkEventBus | null = null
|
|
14
|
+
|
|
15
|
+
constructor(bus?: M FrameworkEventBus) {
|
|
16
|
+
if (bus) this.bus = bus
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
registerModule(module: M FrameworkModule, ctx: M FrameworkContext) {
|
|
20
|
+
if (this.modules.has(module.id)) return
|
|
21
|
+
|
|
22
|
+
this.modules.set(module.id, module)
|
|
23
|
+
if (module.adapters) {
|
|
24
|
+
for (const [key, adapter] of Object.entries(module.adapters)) {
|
|
25
|
+
const typedKey = key as M FrameworkAdapterKey
|
|
26
|
+
this.registerAdapter(typedKey, adapter as M FrameworkAdapterMap[typeof typedKey])
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
module.setup?.(ctx)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getAdapter<K extends M FrameworkAdapterKey>(key: K): M FrameworkAdapterOf<K> | undefined {
|
|
33
|
+
return this.adapters.get(key) as M FrameworkAdapterOf<K> | undefined
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Register an adapter at runtime. Emits `adapter:registered` so modules
|
|
37
|
+
// depending on adapters can react when new adapters become available.
|
|
38
|
+
registerAdapter<K extends M FrameworkAdapterKey>(key: K, adapter: M FrameworkAdapterMap[K]) {
|
|
39
|
+
this.adapters.set(key, adapter)
|
|
40
|
+
if (this.bus) {
|
|
41
|
+
try {
|
|
42
|
+
// notify listeners asynchronously
|
|
43
|
+
this.bus.emit('adapter:registered', { key } as any).catch(() => {})
|
|
44
|
+
} catch (e) {
|
|
45
|
+
// ignore emit errors
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async runLifecycle(hook: keyof M FrameworkModule, ctx: M FrameworkContext) {
|
|
51
|
+
for (const module of this.modules.values()) {
|
|
52
|
+
const fn = module[hook]
|
|
53
|
+
if (typeof fn === 'function') {
|
|
54
|
+
await fn.call(module, ctx)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { M FrameworkConfig } from '../types/config'
|
|
2
|
+
import { M FrameworkContext } from './context'
|
|
3
|
+
import { ModuleRegistry } from '../plugins/registry'
|
|
4
|
+
import { createEventBus } from '../types/events'
|
|
5
|
+
import type { M FrameworkEventBus } from '../types/events'
|
|
6
|
+
import { setRuntimeContext } from './hooks'
|
|
7
|
+
import { runAppLifecycle } from './lifecycle'
|
|
8
|
+
import type { M FrameworkApp, M FrameworkAppOptions } from '../types/app'
|
|
9
|
+
|
|
10
|
+
export function createM FrameworkApp(options: M FrameworkAppOptions): M FrameworkApp {
|
|
11
|
+
const eventBus: M FrameworkEventBus = createEventBus()
|
|
12
|
+
const registry = new ModuleRegistry(eventBus)
|
|
13
|
+
const context = new M FrameworkContext(options.config, registry)
|
|
14
|
+
|
|
15
|
+
setRuntimeContext(context, eventBus)
|
|
16
|
+
|
|
17
|
+
options.modules?.forEach((mod) => registry.registerModule(mod, context))
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
context,
|
|
21
|
+
events: eventBus,
|
|
22
|
+
async start() {
|
|
23
|
+
await runAppLifecycle(registry, context, eventBus)
|
|
24
|
+
return context
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { M FrameworkAppOptions }
|
|
30
|
+
export type { M FrameworkApp }
|
|
31
|
+
export type { M FrameworkConfig }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function defineMeeoviConfig() {
|
|
2
|
+
return {
|
|
3
|
+
productProvider: 'directus',
|
|
4
|
+
cartProvider: 'directus',
|
|
5
|
+
contentProvider: 'directus',
|
|
6
|
+
authUrl: '/api/auth',
|
|
7
|
+
searchUrl: '/api/search',
|
|
8
|
+
adapters: {
|
|
9
|
+
commerce: '',
|
|
10
|
+
social: '',
|
|
11
|
+
search: '',
|
|
12
|
+
auth: '',
|
|
13
|
+
chat: '',
|
|
14
|
+
lists: ''
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function defineMeeoviTheme(theme: any) {
|
|
20
|
+
return theme
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type MeeoviConfig = ReturnType<typeof defineMeeoviConfig>
|
|
24
|
+
export type MeeoviTheme = ReturnType<typeof defineMeeoviTheme>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { M FrameworkConfig } from '../types/config'
|
|
2
|
+
import { ModuleRegistry } from '../plugins/registry'
|
|
3
|
+
import { M FrameworkAdapterKey, M FrameworkAdapterOf } from '../types/adapters'
|
|
4
|
+
|
|
5
|
+
export class M FrameworkContext {
|
|
6
|
+
readonly config: M FrameworkConfig
|
|
7
|
+
readonly modules: ModuleRegistry
|
|
8
|
+
|
|
9
|
+
constructor(config: M FrameworkConfig, modules: ModuleRegistry) {
|
|
10
|
+
this.config = config
|
|
11
|
+
this.modules = modules
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getAdapter<K extends M FrameworkAdapterKey>(key: K): M FrameworkAdapterOf<K> | undefined {
|
|
15
|
+
return this.modules.getAdapter<K>(key)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { M FrameworkContext } from './context'
|
|
2
|
+
import { M FrameworkEventBus } from '../types/events'
|
|
3
|
+
|
|
4
|
+
let currentContext: M FrameworkContext | null = null
|
|
5
|
+
let currentEventBus: M FrameworkEventBus | null = null
|
|
6
|
+
|
|
7
|
+
export function setRuntimeContext(ctx: M FrameworkContext, bus: M FrameworkEventBus) {
|
|
8
|
+
currentContext = ctx
|
|
9
|
+
currentEventBus = bus
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function useM FrameworkContext(): M FrameworkContext {
|
|
13
|
+
if (!currentContext) {
|
|
14
|
+
throw new Error('[@mframework/core] useM FrameworkContext() called before app initialization')
|
|
15
|
+
}
|
|
16
|
+
return currentContext
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function useM FrameworkEventBus(): M FrameworkEventBus {
|
|
20
|
+
if (!currentEventBus) {
|
|
21
|
+
throw new Error('[@mframework/core] useM FrameworkEventBus() called before app initialization')
|
|
22
|
+
}
|
|
23
|
+
return currentEventBus
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function useRuntimeConfig() {
|
|
27
|
+
return useM FrameworkContext().config
|
|
28
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { M FrameworkContext } from './context'
|
|
2
|
+
import { ModuleRegistry } from '../plugins/registry'
|
|
3
|
+
import { M FrameworkEventBus } from '../types/events'
|
|
4
|
+
|
|
5
|
+
export async function runAppLifecycle(
|
|
6
|
+
registry: ModuleRegistry,
|
|
7
|
+
ctx: M FrameworkContext,
|
|
8
|
+
bus: M FrameworkEventBus
|
|
9
|
+
) {
|
|
10
|
+
// Example lifecycle sequence
|
|
11
|
+
await registry.runLifecycle('onAppInit', ctx)
|
|
12
|
+
|
|
13
|
+
bus.emit('app:ready', { context: ctx })
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SearchAdapter } from '../adapters/search'
|
|
2
|
+
import type { ListsAdapter } from '../adapters/lists'
|
|
3
|
+
import type { CatalogAdapter } from '../adapters/catalog'
|
|
4
|
+
import type { CartAdapter } from '../adapters/cart'
|
|
5
|
+
import type { AuthAdapter } from '../adapters/auth' // when you add it
|
|
6
|
+
|
|
7
|
+
export interface M FrameworkAdapterMap {
|
|
8
|
+
search: SearchAdapter
|
|
9
|
+
lists: ListsAdapter
|
|
10
|
+
catalog: CatalogAdapter
|
|
11
|
+
cart: CartAdapter
|
|
12
|
+
auth: AuthAdapter
|
|
13
|
+
// modules can extend this via declaration merging
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type M FrameworkAdapterKey = keyof M FrameworkAdapterMap
|
|
17
|
+
export type M FrameworkAdapterOf<K extends M FrameworkAdapterKey> = M FrameworkAdapterMap[K]
|
package/src/types/app.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { M FrameworkConfig } from './config'
|
|
2
|
+
import { M FrameworkContext } from '../runtime/context'
|
|
3
|
+
import { M FrameworkEventBus } from './events'
|
|
4
|
+
import { M FrameworkModule } from './module'
|
|
5
|
+
|
|
6
|
+
export interface M FrameworkApp {
|
|
7
|
+
context: M FrameworkContext
|
|
8
|
+
events: M FrameworkEventBus
|
|
9
|
+
start(): Promise<M FrameworkContext>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface M FrameworkAppOptions {
|
|
13
|
+
config: M FrameworkConfig
|
|
14
|
+
modules?: M FrameworkModule[]
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
export const LoginInputSchema = z.object({
|
|
4
|
+
email: z.string().email(),
|
|
5
|
+
password: z.string().min(8)
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
export type LoginInput = z.infer<typeof LoginInputSchema>
|
|
9
|
+
|
|
10
|
+
export const RegisterInputSchema = z.object({
|
|
11
|
+
email: z.string().email(),
|
|
12
|
+
password: z.string().min(8),
|
|
13
|
+
confirmPassword: z.string().min(8)
|
|
14
|
+
}).refine((data) => data.password === data.confirmPassword, {
|
|
15
|
+
message: 'Passwords do not match',
|
|
16
|
+
path: ['confirmPassword']
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export type RegisterInput = z.infer<typeof RegisterInputSchema>
|
|
20
|
+
|
|
21
|
+
export const ForgotPasswordInputSchema = z.object({
|
|
22
|
+
email: z.string().email()
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export type ForgotPasswordInput = z.infer<typeof ForgotPasswordInputSchema>
|
|
26
|
+
|
|
27
|
+
export const ResetPasswordInputSchema = z.object({
|
|
28
|
+
token: z.string(),
|
|
29
|
+
password: z.string().min(8),
|
|
30
|
+
confirmPassword: z.string().min(8)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
export type ResetPasswordInput = z.infer<typeof ResetPasswordInputSchema>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CommerceCart } from "./cart"
|
|
2
|
+
import { CommerceCategory } from "./category"
|
|
3
|
+
import { CommerceProduct } from "./product"
|
|
4
|
+
|
|
5
|
+
export interface CommerceAdapter {
|
|
6
|
+
getProductBySlug(slug: string): Promise<CommerceProduct | null>
|
|
7
|
+
getProducts(params: {
|
|
8
|
+
search?: string
|
|
9
|
+
categoryId?: string
|
|
10
|
+
limit?: number
|
|
11
|
+
offset?: number
|
|
12
|
+
}): Promise<CommerceProduct[]>
|
|
13
|
+
|
|
14
|
+
getCategoryTree(): Promise<CommerceCategory[]>
|
|
15
|
+
|
|
16
|
+
getCart(cartId: string): Promise<CommerceCart | null>
|
|
17
|
+
addToCart(
|
|
18
|
+
cartId: string | null,
|
|
19
|
+
input: { productId: string; quantity: number }
|
|
20
|
+
): Promise<CommerceCart>
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CommercePrice } from "./product"
|
|
2
|
+
|
|
3
|
+
export interface CommerceCartItem {
|
|
4
|
+
id: string
|
|
5
|
+
productId: string
|
|
6
|
+
quantity: number
|
|
7
|
+
price: CommercePrice
|
|
8
|
+
[key: string]: unknown
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CommerceCart {
|
|
12
|
+
id: string
|
|
13
|
+
items: CommerceCartItem[]
|
|
14
|
+
total: CommercePrice
|
|
15
|
+
[key: string]: unknown
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommerceCartItem } from "./cart"
|
|
2
|
+
import { CommercePrice } from "./product"
|
|
3
|
+
|
|
4
|
+
export interface Order {
|
|
5
|
+
id: string
|
|
6
|
+
items: CommerceCartItem[]
|
|
7
|
+
subtotal: CommercePrice
|
|
8
|
+
total: CommercePrice
|
|
9
|
+
currency: string
|
|
10
|
+
status: 'pending' | 'paid' | 'shipped' | 'completed' | 'cancelled'
|
|
11
|
+
createdAt: string
|
|
12
|
+
updatedAt: string
|
|
13
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface CommercePrice {
|
|
2
|
+
amount: number
|
|
3
|
+
currency: string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface CommerceImage {
|
|
7
|
+
url: string
|
|
8
|
+
alt?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CommerceProduct {
|
|
12
|
+
id: string
|
|
13
|
+
slug: string
|
|
14
|
+
sku?: string
|
|
15
|
+
name: string
|
|
16
|
+
description?: string
|
|
17
|
+
shortDescription?: string
|
|
18
|
+
price: CommercePrice
|
|
19
|
+
images: CommerceImage[]
|
|
20
|
+
categories?: string[]
|
|
21
|
+
variants?: CommerceVariant[]
|
|
22
|
+
attributes?: Record<string, string | number | boolean>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CommerceVariant {
|
|
26
|
+
id: string
|
|
27
|
+
sku?: string
|
|
28
|
+
name?: string
|
|
29
|
+
price?: CommercePrice
|
|
30
|
+
attributes?: Record<string, string | number | boolean>
|
|
31
|
+
}
|