@reactionary/source 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/examples/node/package.json +7 -7
- package/examples/node/src/basic/basic-node-provider-model-extension.spec.ts +1 -1
- package/examples/node/src/basic/basic-node-provider-query-extension.spec.ts +1 -1
- package/examples/node/src/basic/basic-node-setup.spec.ts +1 -1
- package/examples/node/src/basic/client-creation.spec.ts +3 -3
- package/examples/node/src/utils.ts +7 -7
- package/package.json +1 -1
- package/packages/algolia/README.md +11 -0
- package/{providers/google-analytics → packages/algolia}/eslint.config.mjs +0 -2
- package/{providers → packages}/algolia/package.json +7 -5
- package/{providers/posthog → packages/algolia}/project.json +6 -6
- package/{providers/algolia/src/providers/analytics.provider.ts → packages/algolia/src/capabilities/analytics.capability.ts} +2 -2
- package/packages/algolia/src/capabilities/index.ts +3 -0
- package/{providers/algolia/src/providers/product-recommendations.provider.ts → packages/algolia/src/capabilities/product-recommendations.capability.ts} +3 -3
- package/{providers/algolia/src/providers/product-search.provider.ts → packages/algolia/src/capabilities/product-search.capability.ts} +3 -3
- package/{providers → packages}/algolia/src/core/initialize.ts +12 -12
- package/packages/algolia/src/core/initialize.types.ts +107 -0
- package/{providers → packages}/algolia/src/index.ts +1 -1
- package/{providers → packages}/algolia/src/schema/capabilities.schema.ts +23 -23
- package/{providers → packages}/algolia/src/test/analytics.spec.ts +4 -4
- package/packages/algolia/vite.config.ts +26 -0
- package/packages/algolia/vitest.config.mts +21 -0
- package/packages/commercetools/README.md +11 -0
- package/{core → packages/commercetools}/eslint.config.mjs +2 -2
- package/packages/commercetools/package.json +17 -0
- package/{providers → packages}/commercetools/project.json +7 -8
- package/{providers/commercetools/src/providers/cart.provider.ts → packages/commercetools/src/capabilities/cart.capability.ts} +3 -3
- package/{providers/commercetools/src/providers/category.provider.ts → packages/commercetools/src/capabilities/category.capability.ts} +4 -4
- package/{providers/commercetools/src/providers/checkout.provider.ts → packages/commercetools/src/capabilities/checkout.capability.ts} +3 -3
- package/{providers/commercetools/src/providers/identity.provider.ts → packages/commercetools/src/capabilities/identity.capability.ts} +3 -3
- package/packages/commercetools/src/capabilities/index.ts +15 -0
- package/{providers/commercetools/src/providers/inventory.provider.ts → packages/commercetools/src/capabilities/inventory.capability.ts} +3 -3
- package/{providers/commercetools/src/providers/order-search.provider.ts → packages/commercetools/src/capabilities/order-search.capability.ts} +4 -4
- package/{providers/commercetools/src/providers/order.provider.ts → packages/commercetools/src/capabilities/order.capability.ts} +3 -3
- package/{providers/commercetools/src/providers/price.provider.ts → packages/commercetools/src/capabilities/price.capability.ts} +3 -3
- package/{providers/commercetools/src/providers/product-associations.provider.ts → packages/commercetools/src/capabilities/product-associations.capability.ts} +3 -3
- package/{providers/commercetools/src/providers/product-list.provider.ts → packages/commercetools/src/capabilities/product-list.capability.ts} +3 -3
- package/{providers/commercetools/src/providers/product-reviews.provider.ts → packages/commercetools/src/capabilities/product-reviews.capability.ts} +3 -3
- package/{providers/commercetools/src/providers/product-search.provider.ts → packages/commercetools/src/capabilities/product-search.capability.ts} +3 -3
- package/{providers/commercetools/src/providers/product.provider.ts → packages/commercetools/src/capabilities/product.capability.ts} +4 -4
- package/{providers/commercetools/src/providers/profile.provider.ts → packages/commercetools/src/capabilities/profile.capability.ts} +3 -3
- package/{providers/commercetools/src/providers/store.provider.ts → packages/commercetools/src/capabilities/store.capability.ts} +3 -3
- package/{providers → packages}/commercetools/src/core/capability-descriptors.ts +48 -48
- package/{providers → packages}/commercetools/src/core/client.ts +2 -2
- package/{providers → packages}/commercetools/src/core/initialize.ts +5 -5
- package/{providers → packages}/commercetools/src/core/initialize.types.ts +47 -47
- package/{providers → packages}/commercetools/src/factories/checkout/checkout-initializer-overrides.example.ts +4 -4
- package/{providers/commercetools/src/factories/product/product-provider-custom-method-only.example.ts → packages/commercetools/src/factories/product/product-capability-custom-method-only.example.ts} +6 -6
- package/{providers/commercetools/src/factories/product/product-provider-schema-signature-extension.example.ts → packages/commercetools/src/factories/product/product-capability-schema-signature-extension.example.ts} +4 -4
- package/{providers → packages}/commercetools/src/index.ts +9 -9
- package/{providers → packages}/commercetools/src/schema/capabilities.schema.ts +61 -61
- package/{providers → packages}/commercetools/src/test/caching.spec.ts +8 -8
- package/{providers/algolia → packages/commercetools}/tsconfig.json +1 -1
- package/{core → packages/commercetools}/tsconfig.lib.json +1 -1
- package/packages/commercetools/tsconfig.spec.json +28 -0
- package/packages/commercetools/vite.config.ts +26 -0
- package/packages/commercetools/vitest.config.mts +21 -0
- package/{providers/fake → packages/core}/eslint.config.mjs +2 -1
- package/{core → packages/core}/package.json +7 -7
- package/packages/core/project.json +33 -0
- package/{core/src/providers/analytics.provider.ts → packages/core/src/capabilities/analytics.capability.ts} +8 -8
- package/{core/src/providers/base.provider.ts → packages/core/src/capabilities/base.capability.ts} +2 -2
- package/{core/src/providers/cart.provider.ts → packages/core/src/capabilities/cart.capability.ts} +3 -3
- package/{core/src/providers/category.provider.ts → packages/core/src/capabilities/category.capability.ts} +5 -5
- package/{core/src/providers/checkout.provider.ts → packages/core/src/capabilities/checkout.capability.ts} +3 -3
- package/{core/src/providers/identity.provider.ts → packages/core/src/capabilities/identity.capability.ts} +2 -2
- package/packages/core/src/capabilities/index.ts +18 -0
- package/{core/src/providers/inventory.provider.ts → packages/core/src/capabilities/inventory.capability.ts} +2 -2
- package/{core/src/providers/order-search.provider.ts → packages/core/src/capabilities/order-search.capability.ts} +3 -3
- package/{core/src/providers/order.provider.ts → packages/core/src/capabilities/order.capability.ts} +2 -2
- package/{core/src/providers/price.provider.ts → packages/core/src/capabilities/price.capability.ts} +2 -2
- package/{core/src/providers/product-associations.provider.ts → packages/core/src/capabilities/product-associations.capability.ts} +3 -3
- package/{core/src/providers/product-list.provider.ts → packages/core/src/capabilities/product-list.capability.ts} +3 -3
- package/{core/src/providers/product-recommendations.provider.ts → packages/core/src/capabilities/product-recommendations.capability.ts} +21 -21
- package/{core/src/providers/product-reviews.provider.ts → packages/core/src/capabilities/product-reviews.capability.ts} +3 -3
- package/{core/src/providers/product-search.provider.ts → packages/core/src/capabilities/product-search.capability.ts} +3 -3
- package/{core/src/providers/product.provider.ts → packages/core/src/capabilities/product.capability.ts} +2 -2
- package/{core/src/providers/profile.provider.ts → packages/core/src/capabilities/profile.capability.ts} +2 -2
- package/{core/src/providers/store.provider.ts → packages/core/src/capabilities/store.capability.ts} +2 -2
- package/{core → packages/core}/src/client/client-builder.ts +13 -14
- package/packages/core/src/client/client.ts +35 -0
- package/{core → packages/core}/src/decorators/reactionary.decorator.ts +7 -7
- package/{core → packages/core}/src/index.ts +1 -1
- package/{core → packages/core}/src/test/client-builder.spec.ts +20 -20
- package/{core → packages/core}/src/test/reactionary.decorator.spec.ts +27 -27
- package/{providers/meilisearch → packages/core}/tsconfig.json +1 -1
- package/{providers/medusa → packages/core}/tsconfig.lib.json +1 -2
- package/packages/core/tsconfig.spec.json +28 -0
- package/packages/core/vite.config.ts +26 -0
- package/packages/core/vitest.config.mts +21 -0
- package/packages/fake/README.md +11 -0
- package/{providers/algolia → packages/fake}/eslint.config.mjs +2 -1
- package/{providers → packages}/fake/package.json +6 -4
- package/{providers → packages}/fake/project.json +7 -8
- package/{providers/fake/src/providers/analytics.provider.ts → packages/fake/src/capabilities/analytics.capability.ts} +2 -2
- package/{providers/fake/src/providers/cart.provider.ts → packages/fake/src/capabilities/cart.capability.ts} +3 -3
- package/{providers/fake/src/providers/category.provider.ts → packages/fake/src/capabilities/category.capability.ts} +3 -3
- package/{providers/fake/src/providers/checkout.provider.ts → packages/fake/src/capabilities/checkout.capability.ts} +3 -3
- package/{providers/fake/src/providers/identity.provider.ts → packages/fake/src/capabilities/identity.capability.ts} +3 -3
- package/packages/fake/src/capabilities/index.ts +15 -0
- package/{providers/fake/src/providers/inventory.provider.ts → packages/fake/src/capabilities/inventory.capability.ts} +3 -3
- package/{providers/fake/src/providers/order-search.provider.ts → packages/fake/src/capabilities/order-search.capability.ts} +3 -3
- package/{providers/fake/src/providers/order.provider.ts → packages/fake/src/capabilities/order.capability.ts} +3 -3
- package/{providers/fake/src/providers/price.provider.ts → packages/fake/src/capabilities/price.capability.ts} +3 -3
- package/{providers/fake/src/providers/product-associations.provider.ts → packages/fake/src/capabilities/product-associations.capability.ts} +3 -3
- package/{providers/fake/src/providers/product-reviews.provider.ts → packages/fake/src/capabilities/product-reviews.capability.ts} +3 -3
- package/{providers/fake/src/providers/product-search.provider.ts → packages/fake/src/capabilities/product-search.capability.ts} +3 -3
- package/{providers/fake/src/providers/product.provider.ts → packages/fake/src/capabilities/product.capability.ts} +3 -3
- package/{providers/fake/src/providers/profile.provider.ts → packages/fake/src/capabilities/profile.capability.ts} +3 -3
- package/{providers/fake/src/providers/store.provider.ts → packages/fake/src/capabilities/store.capability.ts} +3 -3
- package/{providers → packages}/fake/src/core/initialize.ts +73 -73
- package/{providers → packages}/fake/src/core/initialize.types.ts +45 -45
- package/{providers → packages}/fake/src/index.ts +1 -1
- package/{providers → packages}/fake/src/schema/capabilities.schema.ts +32 -32
- package/{providers/fake/src/test/cart.provider.spec.ts → packages/fake/src/test/cart.capability.spec.ts} +6 -6
- package/{providers/fake/src/test/category.provider.spec.ts → packages/fake/src/test/category.capability.spec.ts} +3 -3
- package/{providers/fake/src/test/checkout.provider.spec.ts → packages/fake/src/test/checkout.capability.spec.ts} +3 -3
- package/{providers/fake/src/test/order-search.provider.spec.ts → packages/fake/src/test/order-search.capability.spec.ts} +3 -3
- package/{providers/fake/src/test/order.provider.spec.ts → packages/fake/src/test/order.capability.spec.ts} +3 -3
- package/{providers/fake/src/test/price.provider.spec.ts → packages/fake/src/test/price.capability.spec.ts} +3 -3
- package/{providers/fake/src/test/product.provider.spec.ts → packages/fake/src/test/product.capability.spec.ts} +3 -3
- package/{providers/fake/src/test/profile.provider.spec.ts → packages/fake/src/test/profile.capability.spec.ts} +3 -3
- package/{providers/commercetools → packages/fake}/tsconfig.json +1 -1
- package/packages/fake/tsconfig.lib.json +23 -0
- package/packages/fake/tsconfig.spec.json +28 -0
- package/packages/fake/vite.config.ts +26 -0
- package/packages/fake/vitest.config.mts +21 -0
- package/packages/google-analytics/eslint.config.mjs +23 -0
- package/{providers → packages}/google-analytics/package.json +7 -5
- package/{providers → packages}/google-analytics/project.json +5 -5
- package/{providers/google-analytics/src/providers/analytics.provider.ts → packages/google-analytics/src/capabilities/analytics.capability.ts} +2 -2
- package/{providers → packages}/google-analytics/src/core/initialize.ts +4 -4
- package/packages/google-analytics/src/core/initialize.types.ts +47 -0
- package/{providers → packages}/google-analytics/src/index.ts +1 -1
- package/{providers → packages}/google-analytics/src/schema/capabilities.schema.ts +7 -7
- package/{providers/google-analytics/src/test/analytics.provider.spec.ts → packages/google-analytics/src/test/analytics.capability.spec.ts} +7 -7
- package/packages/google-analytics/tsconfig.json +24 -0
- package/packages/google-analytics/tsconfig.lib.json +23 -0
- package/packages/google-analytics/tsconfig.spec.json +28 -0
- package/{providers → packages}/google-analytics/vite.config.ts +2 -2
- package/{providers → packages}/google-analytics/vitest.config.mts +2 -2
- package/packages/medusa/README.md +11 -0
- package/packages/medusa/eslint.config.mjs +23 -0
- package/packages/medusa/package.json +17 -0
- package/{providers → packages}/medusa/project.json +7 -8
- package/{providers/medusa/src/providers/cart.provider.ts → packages/medusa/src/capabilities/cart.capability.ts} +3 -3
- package/{providers/medusa/src/providers/category.provider.ts → packages/medusa/src/capabilities/category.capability.ts} +3 -3
- package/{providers/medusa/src/providers/checkout.provider.ts → packages/medusa/src/capabilities/checkout.capability.ts} +3 -3
- package/{providers/medusa/src/providers/identity.provider.ts → packages/medusa/src/capabilities/identity.capability.ts} +2 -2
- package/{providers/medusa/src/providers/inventory.provider.ts → packages/medusa/src/capabilities/inventory.capability.ts} +3 -3
- package/{providers/medusa/src/providers/order-search.provider.ts → packages/medusa/src/capabilities/order-search.capability.ts} +3 -3
- package/{providers/medusa/src/providers/order.provider.ts → packages/medusa/src/capabilities/order.capability.ts} +3 -3
- package/{providers/medusa/src/providers/price.provider.ts → packages/medusa/src/capabilities/price.capability.ts} +3 -3
- package/{providers/medusa/src/providers/product-associations.provider.ts → packages/medusa/src/capabilities/product-associations.capability.ts} +3 -3
- package/{providers/medusa/src/providers/product-recommendations.provider.ts → packages/medusa/src/capabilities/product-recommendations.capability.ts} +3 -3
- package/{providers/medusa/src/providers/product-search.provider.ts → packages/medusa/src/capabilities/product-search.capability.ts} +3 -3
- package/{providers/medusa/src/providers/product.provider.ts → packages/medusa/src/capabilities/product.capability.ts} +3 -3
- package/{providers/medusa/src/providers/profile.provider.ts → packages/medusa/src/capabilities/profile.capability.ts} +4 -4
- package/{providers → packages}/medusa/src/core/initialize.ts +64 -64
- package/{providers → packages}/medusa/src/core/initialize.types.ts +52 -52
- package/packages/medusa/src/index.ts +17 -0
- package/{providers → packages}/medusa/src/schema/capabilities.schema.ts +64 -64
- package/{providers/medusa/src/test/cart.provider.spec.ts → packages/medusa/src/test/cart.capability.spec.ts} +3 -3
- package/{providers/medusa/src/test/category.provider.spec.ts → packages/medusa/src/test/category.capability.spec.ts} +3 -3
- package/{providers/medusa/src/test/identity.provider.spec.ts → packages/medusa/src/test/identity.capability.spec.ts} +3 -3
- package/{providers/medusa/src/test/inventory.provider.spec.ts → packages/medusa/src/test/inventory.capability.spec.ts} +3 -3
- package/{providers/medusa/src/test/large-cart.provider.spec.ts → packages/medusa/src/test/large-cart.capability.spec.ts} +6 -6
- package/{providers/medusa/src/test/price.provider.spec.ts → packages/medusa/src/test/price.capability.spec.ts} +3 -3
- package/{providers/medusa/src/test/product.provider.spec.ts → packages/medusa/src/test/product.capability.spec.ts} +3 -3
- package/{providers/medusa/src/test/search.provider.spec.ts → packages/medusa/src/test/search.capability.spec.ts} +4 -4
- package/{providers → packages}/medusa/src/utils/medusa-helpers.ts +1 -1
- package/packages/medusa/tsconfig.json +24 -0
- package/packages/medusa/tsconfig.lib.json +23 -0
- package/packages/medusa/tsconfig.spec.json +28 -0
- package/packages/medusa/vite.config.ts +26 -0
- package/packages/medusa/vitest.config.mts +21 -0
- package/packages/meilisearch/README.md +11 -0
- package/packages/meilisearch/eslint.config.mjs +23 -0
- package/packages/meilisearch/package.json +15 -0
- package/{providers → packages}/meilisearch/project.json +7 -8
- package/packages/meilisearch/src/capabilities/index.ts +3 -0
- package/{providers/meilisearch/src/providers/order-search.provider.ts → packages/meilisearch/src/capabilities/order-search.capability.ts} +3 -3
- package/{providers/meilisearch/src/providers/product-recommendations.provider.ts → packages/meilisearch/src/capabilities/product-recommendations.capability.ts} +3 -3
- package/{providers/meilisearch/src/providers/product-search.provider.ts → packages/meilisearch/src/capabilities/product-search.capability.ts} +3 -3
- package/{providers → packages}/meilisearch/src/core/initialize.ts +13 -13
- package/{providers → packages}/meilisearch/src/core/initialize.types.ts +37 -37
- package/{providers → packages}/meilisearch/src/index.ts +3 -3
- package/{providers → packages}/meilisearch/src/schema/capabilities.schema.ts +24 -24
- package/packages/meilisearch/tsconfig.json +24 -0
- package/packages/meilisearch/tsconfig.lib.json +23 -0
- package/packages/meilisearch/tsconfig.spec.json +28 -0
- package/packages/meilisearch/vite.config.ts +26 -0
- package/packages/meilisearch/vitest.config.mts +21 -0
- package/tsconfig.base.json +13 -21
- package/core/project.json +0 -34
- package/core/src/client/client.ts +0 -35
- package/core/src/providers/index.ts +0 -18
- package/core/tsconfig.json +0 -24
- package/core/tsconfig.spec.json +0 -4
- package/core/vitest.config.ts +0 -14
- package/providers/algolia/README.md +0 -56
- package/providers/algolia/project.json +0 -34
- package/providers/algolia/src/core/initialize.types.ts +0 -107
- package/providers/algolia/src/providers/index.ts +0 -3
- package/providers/algolia/tsconfig.lib.json +0 -10
- package/providers/algolia/tsconfig.spec.json +0 -4
- package/providers/algolia/vitest.config.ts +0 -14
- package/providers/commercetools/README.md +0 -65
- package/providers/commercetools/eslint.config.mjs +0 -22
- package/providers/commercetools/package.json +0 -15
- package/providers/commercetools/src/providers/index.ts +0 -15
- package/providers/commercetools/tsconfig.lib.json +0 -10
- package/providers/commercetools/tsconfig.spec.json +0 -4
- package/providers/commercetools/vitest.config.ts +0 -15
- package/providers/fake/README.md +0 -23
- package/providers/fake/src/providers/index.ts +0 -15
- package/providers/fake/tsconfig.json +0 -25
- package/providers/fake/tsconfig.lib.json +0 -11
- package/providers/fake/tsconfig.spec.json +0 -4
- package/providers/fake/vitest.config.ts +0 -14
- package/providers/google-analytics/src/core/initialize.types.ts +0 -47
- package/providers/medusa/README.md +0 -30
- package/providers/medusa/TESTING.md +0 -98
- package/providers/medusa/eslint.config.mjs +0 -19
- package/providers/medusa/package.json +0 -15
- package/providers/medusa/src/index.ts +0 -17
- package/providers/medusa/tsconfig.json +0 -24
- package/providers/medusa/tsconfig.spec.json +0 -4
- package/providers/medusa/vitest.config.ts +0 -15
- package/providers/meilisearch/README.md +0 -48
- package/providers/meilisearch/eslint.config.mjs +0 -22
- package/providers/meilisearch/package.json +0 -13
- package/providers/meilisearch/src/providers/index.ts +0 -3
- package/providers/meilisearch/tsconfig.lib.json +0 -10
- package/providers/meilisearch/tsconfig.spec.json +0 -4
- package/providers/meilisearch/vitest.config.ts +0 -14
- package/providers/posthog/README.md +0 -7
- package/providers/posthog/eslint.config.mjs +0 -22
- package/providers/posthog/package.json +0 -12
- package/providers/posthog/src/core/initialize.ts +0 -11
- package/providers/posthog/src/index.ts +0 -4
- package/providers/posthog/src/schema/capabilities.schema.ts +0 -8
- package/providers/posthog/src/schema/configuration.schema.ts +0 -8
- package/providers/posthog/tsconfig.json +0 -21
- package/providers/posthog/tsconfig.lib.json +0 -9
- /package/{providers → packages}/algolia/src/factories/index.ts +0 -0
- /package/{providers → packages}/algolia/src/factories/product-search/product-search.factory.ts +0 -0
- /package/{providers → packages}/algolia/src/schema/configuration.schema.ts +0 -0
- /package/{providers → packages}/algolia/src/schema/index.ts +0 -0
- /package/{providers → packages}/algolia/src/schema/product-recommendation.schema.ts +0 -0
- /package/{providers → packages}/algolia/src/schema/search.schema.ts +0 -0
- /package/{providers → packages}/algolia/src/test/client-builder-product-search-extension.example.ts +0 -0
- /package/{providers/google-analytics → packages/algolia}/tsconfig.json +0 -0
- /package/{providers/google-analytics → packages/algolia}/tsconfig.lib.json +0 -0
- /package/{providers/google-analytics → packages/algolia}/tsconfig.spec.json +0 -0
- /package/{providers → packages}/commercetools/src/core/token-cache.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/cart/cart.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/category/category.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/checkout/checkout.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/identity/identity.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/inventory/inventory.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/order/order.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/order-search/order-search.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/price/price.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/product/product-factory-baseline.example.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/product/product-factory-schema-and-parse-extension.example.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/product/product-factory-schema-extension.example.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/product/product-initializer-factory-extension.example.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/product/product.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/product/utils.example.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/product-associations/product-associations.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/product-list/product-list.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/product-reviews/product-reviews.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/product-search/product-search.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/profile/profile.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/factories/store/store.factory.ts +0 -0
- /package/{providers → packages}/commercetools/src/schema/commercetools.schema.ts +0 -0
- /package/{providers → packages}/commercetools/src/schema/configuration.schema.ts +0 -0
- /package/{providers → packages}/commercetools/src/schema/session.schema.ts +0 -0
- /package/{providers → packages}/commercetools/src/test/client-builder-merge-extensions.example.ts +0 -0
- /package/{providers → packages}/commercetools/src/test/identity.spec.ts +0 -0
- /package/{providers → packages}/commercetools/src/test/test-utils.ts +0 -0
- /package/{core → packages/core}/README.md +0 -0
- /package/{core → packages/core}/src/cache/cache.interface.ts +0 -0
- /package/{core → packages/core}/src/cache/index.ts +0 -0
- /package/{core → packages/core}/src/cache/memory-cache.ts +0 -0
- /package/{core → packages/core}/src/cache/noop-cache.ts +0 -0
- /package/{core → packages/core}/src/cache/redis-cache.ts +0 -0
- /package/{core → packages/core}/src/client/index.ts +0 -0
- /package/{core → packages/core}/src/decorators/index.ts +0 -0
- /package/{core → packages/core}/src/factories/cart.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/category.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/checkout.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/identity.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/index.ts +0 -0
- /package/{core → packages/core}/src/factories/inventory.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/order-search.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/order.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/price.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/product-associations.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/product-list.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/product-reviews.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/product-search.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/product.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/profile.factory.ts +0 -0
- /package/{core → packages/core}/src/factories/store.factory.ts +0 -0
- /package/{core → packages/core}/src/initialization.ts +0 -0
- /package/{core → packages/core}/src/metrics/metrics.ts +0 -0
- /package/{core → packages/core}/src/schemas/capabilities.schema.ts +0 -0
- /package/{core → packages/core}/src/schemas/errors/generic.error.ts +0 -0
- /package/{core → packages/core}/src/schemas/errors/index.ts +0 -0
- /package/{core → packages/core}/src/schemas/errors/invalid-input.error.ts +0 -0
- /package/{core → packages/core}/src/schemas/errors/invalid-output.error.ts +0 -0
- /package/{core → packages/core}/src/schemas/errors/not-found.error.ts +0 -0
- /package/{core → packages/core}/src/schemas/index.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/analytics.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/base.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/cart.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/category.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/checkout.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/cost.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/currency.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/identifiers.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/identity.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/index.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/inventory.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/order-search.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/order.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/payment.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/price.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/product-associations.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/product-list.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/product-recommendations.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/product-reviews.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/product-search.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/product.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/profile.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/shipping-method.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/models/store.model.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/analytics/index.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/analytics/product-add-to-cart.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/analytics/product-details-view.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/analytics/product-summary-click.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/analytics/product-summary-view.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/analytics/purchase.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/base.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/cart.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/checkout.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/identity.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/index.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/inventory.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/price.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/product-list.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/product-reviews.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/product.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/profile.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/mutations/search.mutation.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/analytics.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/base.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/cart.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/category.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/checkout.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/identity.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/index.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/inventory.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/order-search.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/order.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/price.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/product-associations.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/product-list.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/product-recommendations.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/product-reviews.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/product-search.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/product.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/profile.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/queries/store.query.ts +0 -0
- /package/{core → packages/core}/src/schemas/result.ts +0 -0
- /package/{core → packages/core}/src/schemas/session.schema.ts +0 -0
- /package/{core → packages/core}/src/test/request-context.spec.ts +0 -0
- /package/{core → packages/core}/src/zod-utils.ts +0 -0
- /package/{providers → packages}/fake/src/factories/cart/cart.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/category/category.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/checkout/checkout.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/identity/identity.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/index.ts +0 -0
- /package/{providers → packages}/fake/src/factories/inventory/inventory.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/order/order.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/order-search/order-search.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/price/price.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/product/product.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/product-associations/product-associations.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/product-reviews/product-reviews.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/product-search/product-search.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/profile/profile.factory.ts +0 -0
- /package/{providers → packages}/fake/src/factories/store/store.factory.ts +0 -0
- /package/{providers → packages}/fake/src/schema/configuration.schema.ts +0 -0
- /package/{providers → packages}/fake/src/test/client-builder-product-extension.example.ts +0 -0
- /package/{providers → packages}/fake/src/test/test-utils.ts +0 -0
- /package/{providers → packages}/fake/src/utilities/jitter.ts +0 -0
- /package/{providers → packages}/fake/src/utilities/seed.ts +0 -0
- /package/{providers → packages}/google-analytics/README.md +0 -0
- /package/{providers → packages}/google-analytics/src/schema/configuration.schema.ts +0 -0
- /package/{providers → packages}/medusa/src/core/client.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/cart/cart.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/category/category.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/checkout/checkout.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/identity/identity.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/index.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/inventory/inventory.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/order/order.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/order-search/order-search.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/price/price.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/product/product.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/product-associations/product-associations.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/product-search/product-search.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/factories/profile/profile.factory.ts +0 -0
- /package/{providers → packages}/medusa/src/schema/configuration.schema.ts +0 -0
- /package/{providers → packages}/medusa/src/schema/medusa.schema.ts +0 -0
- /package/{providers → packages}/medusa/src/test/checkout.spec.ts +0 -0
- /package/{providers → packages}/medusa/src/test/test-utils.ts +0 -0
- /package/{providers → packages}/meilisearch/src/factories/index.ts +0 -0
- /package/{providers → packages}/meilisearch/src/factories/order-search/order-search.factory.ts +0 -0
- /package/{providers → packages}/meilisearch/src/factories/product-search/product-search.factory.ts +0 -0
- /package/{providers → packages}/meilisearch/src/schema/configuration.schema.ts +0 -0
- /package/{providers → packages}/meilisearch/src/schema/index.ts +0 -0
- /package/{providers → packages}/meilisearch/src/schema/search.schema.ts +0 -0
|
@@ -2,50 +2,50 @@ import type {
|
|
|
2
2
|
Cache,
|
|
3
3
|
CartFactory,
|
|
4
4
|
CartFactoryWithOutput,
|
|
5
|
-
|
|
5
|
+
CartCapability,
|
|
6
6
|
CategoryFactory,
|
|
7
7
|
CategoryFactoryWithOutput,
|
|
8
|
-
|
|
8
|
+
CategoryCapability,
|
|
9
9
|
CheckoutFactory,
|
|
10
10
|
CheckoutFactoryWithOutput,
|
|
11
|
-
|
|
11
|
+
CheckoutCapability,
|
|
12
12
|
IdentityFactory,
|
|
13
13
|
IdentityFactoryWithOutput,
|
|
14
|
-
|
|
14
|
+
IdentityCapability,
|
|
15
15
|
InventoryFactory,
|
|
16
16
|
InventoryFactoryWithOutput,
|
|
17
|
-
|
|
17
|
+
InventoryCapability,
|
|
18
18
|
OrderFactory,
|
|
19
19
|
OrderFactoryWithOutput,
|
|
20
|
-
|
|
20
|
+
OrderCapability,
|
|
21
21
|
OrderSearchFactory,
|
|
22
22
|
OrderSearchFactoryWithOutput,
|
|
23
|
-
|
|
23
|
+
OrderSearchCapability,
|
|
24
24
|
PriceFactory,
|
|
25
25
|
PriceFactoryWithOutput,
|
|
26
|
-
|
|
26
|
+
PriceCapability,
|
|
27
27
|
ProductAssociationsFactory,
|
|
28
28
|
ProductAssociationsFactoryWithOutput,
|
|
29
|
-
|
|
29
|
+
ProductAssociationsCapability,
|
|
30
30
|
ProductFactory,
|
|
31
31
|
ProductFactoryWithOutput,
|
|
32
32
|
ProductListFactory,
|
|
33
33
|
ProductListFactoryWithOutput,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
ProductListCapability,
|
|
35
|
+
ProductCapability,
|
|
36
36
|
ProductReviewsFactory,
|
|
37
37
|
ProductReviewsFactoryWithOutput,
|
|
38
|
-
|
|
38
|
+
ProductReviewsCapability,
|
|
39
39
|
ProductSearchFactory,
|
|
40
40
|
ProductSearchFactoryWithOutput,
|
|
41
|
-
|
|
41
|
+
ProductSearchCapability,
|
|
42
42
|
ProfileFactory,
|
|
43
43
|
ProfileFactoryWithOutput,
|
|
44
|
-
|
|
44
|
+
ProfileCapability,
|
|
45
45
|
RequestContext,
|
|
46
46
|
StoreFactory,
|
|
47
47
|
StoreFactoryWithOutput,
|
|
48
|
-
|
|
48
|
+
StoreCapability,
|
|
49
49
|
} from '@reactionary/core';
|
|
50
50
|
import { CapabilitiesSchema } from '@reactionary/core';
|
|
51
51
|
import type { CommercetoolsAPI } from '../core/client.js';
|
|
@@ -59,7 +59,7 @@ const EnabledCapabilitySchema = z.looseObject({
|
|
|
59
59
|
const OverridableCapabilitySchema = z.looseObject({
|
|
60
60
|
enabled: z.boolean(),
|
|
61
61
|
factory: z.unknown().optional(),
|
|
62
|
-
|
|
62
|
+
capability: z.unknown().optional(),
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
export const CommercetoolsCapabilitiesSchema = CapabilitiesSchema.pick({
|
|
@@ -98,7 +98,7 @@ export const CommercetoolsCapabilitiesSchema = CapabilitiesSchema.pick({
|
|
|
98
98
|
})
|
|
99
99
|
.partial();
|
|
100
100
|
|
|
101
|
-
export interface
|
|
101
|
+
export interface CommercetoolsCapabilityFactoryArgs<TFactory> {
|
|
102
102
|
cache: Cache;
|
|
103
103
|
context: RequestContext;
|
|
104
104
|
config: CommercetoolsConfiguration;
|
|
@@ -106,131 +106,131 @@ export interface CommercetoolsCapabilityProviderFactoryArgs<TFactory> {
|
|
|
106
106
|
factory: TFactory;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
export interface CommercetoolsCapabilityConfig<TFactory,
|
|
109
|
+
export interface CommercetoolsCapabilityConfig<TFactory, TCapability> {
|
|
110
110
|
factory?: TFactory;
|
|
111
|
-
|
|
111
|
+
capability?: (args: CommercetoolsCapabilityFactoryArgs<TFactory>) => TCapability;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
type EnabledCapabilityConfig<TFactory,
|
|
114
|
+
type EnabledCapabilityConfig<TFactory, TCapability> = {
|
|
115
115
|
enabled: boolean;
|
|
116
|
-
} & CommercetoolsCapabilityConfig<TFactory,
|
|
116
|
+
} & CommercetoolsCapabilityConfig<TFactory, TCapability>;
|
|
117
117
|
|
|
118
118
|
export type CommercetoolsProductCapabilityConfig<
|
|
119
119
|
TFactory extends ProductFactory = ProductFactory,
|
|
120
|
-
|
|
121
|
-
> = CommercetoolsCapabilityConfig<ProductFactoryWithOutput<TFactory>,
|
|
120
|
+
TCapability extends ProductCapability = ProductCapability,
|
|
121
|
+
> = CommercetoolsCapabilityConfig<ProductFactoryWithOutput<TFactory>, TCapability>;
|
|
122
122
|
|
|
123
123
|
export type CommercetoolsCheckoutCapabilityConfig<
|
|
124
124
|
TFactory extends CheckoutFactory = CheckoutFactory,
|
|
125
|
-
|
|
126
|
-
> = CommercetoolsCapabilityConfig<CheckoutFactoryWithOutput<TFactory>,
|
|
125
|
+
TCapability extends CheckoutCapability = CheckoutCapability,
|
|
126
|
+
> = CommercetoolsCapabilityConfig<CheckoutFactoryWithOutput<TFactory>, TCapability>;
|
|
127
127
|
|
|
128
128
|
export type CommercetoolsProductSearchCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
129
129
|
ProductSearchFactoryWithOutput<ProductSearchFactory>,
|
|
130
|
-
|
|
130
|
+
ProductSearchCapability
|
|
131
131
|
>;
|
|
132
132
|
export type CommercetoolsProductAssociationsCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
133
133
|
ProductAssociationsFactoryWithOutput<ProductAssociationsFactory>,
|
|
134
|
-
|
|
134
|
+
ProductAssociationsCapability
|
|
135
135
|
>;
|
|
136
136
|
export type CommercetoolsProductReviewsCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
137
137
|
ProductReviewsFactoryWithOutput<ProductReviewsFactory>,
|
|
138
|
-
|
|
138
|
+
ProductReviewsCapability
|
|
139
139
|
>;
|
|
140
140
|
export type CommercetoolsProductListCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
141
141
|
ProductListFactoryWithOutput<ProductListFactory>,
|
|
142
|
-
|
|
142
|
+
ProductListCapability
|
|
143
143
|
>;
|
|
144
144
|
export type CommercetoolsIdentityCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
145
145
|
IdentityFactoryWithOutput<IdentityFactory>,
|
|
146
|
-
|
|
146
|
+
IdentityCapability
|
|
147
147
|
>;
|
|
148
148
|
export type CommercetoolsCartCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
149
149
|
CartFactoryWithOutput<CartFactory>,
|
|
150
|
-
|
|
150
|
+
CartCapability
|
|
151
151
|
>;
|
|
152
152
|
export type CommercetoolsInventoryCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
153
153
|
InventoryFactoryWithOutput<InventoryFactory>,
|
|
154
|
-
|
|
154
|
+
InventoryCapability
|
|
155
155
|
>;
|
|
156
156
|
export type CommercetoolsPriceCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
157
157
|
PriceFactoryWithOutput<PriceFactory>,
|
|
158
|
-
|
|
158
|
+
PriceCapability
|
|
159
159
|
>;
|
|
160
160
|
export type CommercetoolsCategoryCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
161
161
|
CategoryFactoryWithOutput<CategoryFactory>,
|
|
162
|
-
|
|
162
|
+
CategoryCapability
|
|
163
163
|
>;
|
|
164
164
|
export type CommercetoolsStoreCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
165
165
|
StoreFactoryWithOutput<StoreFactory>,
|
|
166
|
-
|
|
166
|
+
StoreCapability
|
|
167
167
|
>;
|
|
168
168
|
export type CommercetoolsProfileCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
169
169
|
ProfileFactoryWithOutput<ProfileFactory>,
|
|
170
|
-
|
|
170
|
+
ProfileCapability
|
|
171
171
|
>;
|
|
172
172
|
export type CommercetoolsOrderCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
173
173
|
OrderFactoryWithOutput<OrderFactory>,
|
|
174
|
-
|
|
174
|
+
OrderCapability
|
|
175
175
|
>;
|
|
176
176
|
export type CommercetoolsOrderSearchCapabilityConfig = CommercetoolsCapabilityConfig<
|
|
177
177
|
OrderSearchFactoryWithOutput<OrderSearchFactory>,
|
|
178
|
-
|
|
178
|
+
OrderSearchCapability
|
|
179
179
|
>;
|
|
180
180
|
|
|
181
181
|
export type CommercetoolsCapabilityConfigMap<
|
|
182
182
|
TProductFactory extends ProductFactory = ProductFactory,
|
|
183
|
-
|
|
183
|
+
TProductCapability extends ProductCapability = ProductCapability,
|
|
184
184
|
TCheckoutFactory extends CheckoutFactory = CheckoutFactory,
|
|
185
|
-
|
|
185
|
+
TCheckoutCapability extends CheckoutCapability = CheckoutCapability,
|
|
186
186
|
> = {
|
|
187
187
|
product: EnabledCapabilityConfig<
|
|
188
188
|
ProductFactoryWithOutput<TProductFactory>,
|
|
189
|
-
|
|
189
|
+
TProductCapability
|
|
190
190
|
>;
|
|
191
191
|
checkout: EnabledCapabilityConfig<
|
|
192
192
|
CheckoutFactoryWithOutput<TCheckoutFactory>,
|
|
193
|
-
|
|
193
|
+
TCheckoutCapability
|
|
194
194
|
>;
|
|
195
195
|
productSearch: EnabledCapabilityConfig<
|
|
196
196
|
ProductSearchFactoryWithOutput<ProductSearchFactory>,
|
|
197
|
-
|
|
197
|
+
ProductSearchCapability
|
|
198
198
|
>;
|
|
199
199
|
productAssociations: EnabledCapabilityConfig<
|
|
200
200
|
ProductAssociationsFactoryWithOutput<ProductAssociationsFactory>,
|
|
201
|
-
|
|
201
|
+
ProductAssociationsCapability
|
|
202
202
|
>;
|
|
203
203
|
productReviews: EnabledCapabilityConfig<
|
|
204
204
|
ProductReviewsFactoryWithOutput<ProductReviewsFactory>,
|
|
205
|
-
|
|
205
|
+
ProductReviewsCapability
|
|
206
206
|
>;
|
|
207
207
|
productList: EnabledCapabilityConfig<
|
|
208
208
|
ProductListFactoryWithOutput<ProductListFactory>,
|
|
209
|
-
|
|
209
|
+
ProductListCapability
|
|
210
210
|
>;
|
|
211
211
|
identity: EnabledCapabilityConfig<
|
|
212
212
|
IdentityFactoryWithOutput<IdentityFactory>,
|
|
213
|
-
|
|
213
|
+
IdentityCapability
|
|
214
214
|
>;
|
|
215
|
-
cart: EnabledCapabilityConfig<CartFactoryWithOutput<CartFactory>,
|
|
215
|
+
cart: EnabledCapabilityConfig<CartFactoryWithOutput<CartFactory>, CartCapability>;
|
|
216
216
|
inventory: EnabledCapabilityConfig<
|
|
217
217
|
InventoryFactoryWithOutput<InventoryFactory>,
|
|
218
|
-
|
|
218
|
+
InventoryCapability
|
|
219
219
|
>;
|
|
220
|
-
price: EnabledCapabilityConfig<PriceFactoryWithOutput<PriceFactory>,
|
|
220
|
+
price: EnabledCapabilityConfig<PriceFactoryWithOutput<PriceFactory>, PriceCapability>;
|
|
221
221
|
category: EnabledCapabilityConfig<
|
|
222
222
|
CategoryFactoryWithOutput<CategoryFactory>,
|
|
223
|
-
|
|
223
|
+
CategoryCapability
|
|
224
224
|
>;
|
|
225
|
-
store: EnabledCapabilityConfig<StoreFactoryWithOutput<StoreFactory>,
|
|
225
|
+
store: EnabledCapabilityConfig<StoreFactoryWithOutput<StoreFactory>, StoreCapability>;
|
|
226
226
|
profile: EnabledCapabilityConfig<
|
|
227
227
|
ProfileFactoryWithOutput<ProfileFactory>,
|
|
228
|
-
|
|
228
|
+
ProfileCapability
|
|
229
229
|
>;
|
|
230
|
-
order: EnabledCapabilityConfig<OrderFactoryWithOutput<OrderFactory>,
|
|
230
|
+
order: EnabledCapabilityConfig<OrderFactoryWithOutput<OrderFactory>, OrderCapability>;
|
|
231
231
|
orderSearch: EnabledCapabilityConfig<
|
|
232
232
|
OrderSearchFactoryWithOutput<OrderSearchFactory>,
|
|
233
|
-
|
|
233
|
+
OrderSearchCapability
|
|
234
234
|
>;
|
|
235
235
|
};
|
|
236
236
|
|
|
@@ -238,23 +238,23 @@ type CommercetoolsCapabilitiesBase = z.infer<typeof CommercetoolsCapabilitiesSch
|
|
|
238
238
|
|
|
239
239
|
export type CommercetoolsCapabilities<
|
|
240
240
|
TProductFactory extends ProductFactory = ProductFactory,
|
|
241
|
-
|
|
241
|
+
TProductCapability extends ProductCapability = ProductCapability,
|
|
242
242
|
TCheckoutFactory extends CheckoutFactory = CheckoutFactory,
|
|
243
|
-
|
|
243
|
+
TCheckoutCapability extends CheckoutCapability = CheckoutCapability,
|
|
244
244
|
> = Omit<
|
|
245
245
|
CommercetoolsCapabilitiesBase,
|
|
246
246
|
keyof CommercetoolsCapabilityConfigMap<
|
|
247
247
|
TProductFactory,
|
|
248
|
-
|
|
248
|
+
TProductCapability,
|
|
249
249
|
TCheckoutFactory,
|
|
250
|
-
|
|
250
|
+
TCheckoutCapability
|
|
251
251
|
>
|
|
252
252
|
> &
|
|
253
253
|
Partial<
|
|
254
254
|
CommercetoolsCapabilityConfigMap<
|
|
255
255
|
TProductFactory,
|
|
256
|
-
|
|
256
|
+
TProductCapability,
|
|
257
257
|
TCheckoutFactory,
|
|
258
|
-
|
|
258
|
+
TCheckoutCapability
|
|
259
259
|
>
|
|
260
260
|
>;
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
type ProductIdentifier,
|
|
10
10
|
type ProductSearchQueryByTerm,
|
|
11
11
|
} from '@reactionary/core';
|
|
12
|
-
import {
|
|
12
|
+
import { CommercetoolsProductCapability } from '../capabilities/product.capability.js';
|
|
13
13
|
import { CommercetoolsAPI } from '../core/client.js';
|
|
14
|
-
import {
|
|
14
|
+
import { CommercetoolsProductSearchCapability } from '../capabilities/product-search.capability.js';
|
|
15
15
|
import { CommercetoolsProductFactory } from '../factories/product/product.factory.js';
|
|
16
16
|
import { CommercetoolsProductSearchFactory } from '../factories/product-search/product-search.factory.js';
|
|
17
17
|
|
|
@@ -21,7 +21,7 @@ describe('Caching', () => {
|
|
|
21
21
|
const context = createInitialRequestContext();
|
|
22
22
|
const cache = new MemoryCache();
|
|
23
23
|
const client = new CommercetoolsAPI(config, context);
|
|
24
|
-
const
|
|
24
|
+
const capability = new CommercetoolsProductCapability(
|
|
25
25
|
cache,
|
|
26
26
|
context,
|
|
27
27
|
config,
|
|
@@ -33,7 +33,7 @@ describe('Caching', () => {
|
|
|
33
33
|
key: 'product_10959528'
|
|
34
34
|
} satisfies ProductIdentifier;
|
|
35
35
|
|
|
36
|
-
const uncached = await
|
|
36
|
+
const uncached = await capability.getById({
|
|
37
37
|
identifier
|
|
38
38
|
});
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ describe('Caching', () => {
|
|
|
43
43
|
|
|
44
44
|
expect(uncached.meta.cache.hit).toBe(false);
|
|
45
45
|
|
|
46
|
-
const cached = await
|
|
46
|
+
const cached = await capability.getById({
|
|
47
47
|
identifier
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -59,7 +59,7 @@ describe('Caching', () => {
|
|
|
59
59
|
const context = createInitialRequestContext();
|
|
60
60
|
const cache = new MemoryCache();
|
|
61
61
|
const client = new CommercetoolsAPI(config, context);
|
|
62
|
-
const
|
|
62
|
+
const capability = new CommercetoolsProductSearchCapability(
|
|
63
63
|
config,
|
|
64
64
|
cache,
|
|
65
65
|
context,
|
|
@@ -79,7 +79,7 @@ describe('Caching', () => {
|
|
|
79
79
|
}
|
|
80
80
|
} satisfies ProductSearchQueryByTerm;
|
|
81
81
|
|
|
82
|
-
const uncached = await
|
|
82
|
+
const uncached = await capability.queryByTerm(query);
|
|
83
83
|
|
|
84
84
|
if (!uncached.success) {
|
|
85
85
|
assert.fail();
|
|
@@ -87,7 +87,7 @@ describe('Caching', () => {
|
|
|
87
87
|
|
|
88
88
|
expect(uncached.meta.cache.hit).toBe(false);
|
|
89
89
|
|
|
90
|
-
const cached = await
|
|
90
|
+
const cached = await capability.queryByTerm(query);
|
|
91
91
|
|
|
92
92
|
if (!cached.success) {
|
|
93
93
|
assert.fail();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"types": [
|
|
6
|
+
"vitest/globals",
|
|
7
|
+
"vitest/importMeta",
|
|
8
|
+
"vite/client",
|
|
9
|
+
"node",
|
|
10
|
+
"vitest"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"vite.config.ts",
|
|
15
|
+
"vite.config.mts",
|
|
16
|
+
"vitest.config.ts",
|
|
17
|
+
"vitest.config.mts",
|
|
18
|
+
"src/**/*.test.ts",
|
|
19
|
+
"src/**/*.spec.ts",
|
|
20
|
+
"src/**/*.test.tsx",
|
|
21
|
+
"src/**/*.spec.tsx",
|
|
22
|
+
"src/**/*.test.js",
|
|
23
|
+
"src/**/*.spec.js",
|
|
24
|
+
"src/**/*.test.jsx",
|
|
25
|
+
"src/**/*.spec.jsx",
|
|
26
|
+
"src/**/*.d.ts"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types='vitest' />
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
4
|
+
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
5
|
+
|
|
6
|
+
export default defineConfig(() => ({
|
|
7
|
+
root: import.meta.dirname,
|
|
8
|
+
cacheDir: '../../node_modules/.vite/packages/commercetools',
|
|
9
|
+
plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
10
|
+
// Uncomment this if you are using workers.
|
|
11
|
+
// worker: {
|
|
12
|
+
// plugins: () => [ nxViteTsPaths() ],
|
|
13
|
+
// },
|
|
14
|
+
test: {
|
|
15
|
+
name: 'commercetools',
|
|
16
|
+
watch: false,
|
|
17
|
+
globals: true,
|
|
18
|
+
environment: 'node',
|
|
19
|
+
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
20
|
+
reporters: ['default'],
|
|
21
|
+
coverage: {
|
|
22
|
+
reportsDirectory: '../../coverage/packages/commercetools',
|
|
23
|
+
provider: 'v8' as const,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
3
|
+
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
4
|
+
|
|
5
|
+
export default defineConfig(() => ({
|
|
6
|
+
root: __dirname,
|
|
7
|
+
cacheDir: '../../node_modules/.vite/packages/commercetools',
|
|
8
|
+
plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
9
|
+
test: {
|
|
10
|
+
name: 'commercetools',
|
|
11
|
+
watch: false,
|
|
12
|
+
globals: true,
|
|
13
|
+
environment: 'node',
|
|
14
|
+
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
15
|
+
reporters: ['default'],
|
|
16
|
+
coverage: {
|
|
17
|
+
reportsDirectory: '../../coverage/packages/commercetools',
|
|
18
|
+
provider: 'v8' as const,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
@@ -9,8 +9,9 @@ export default [
|
|
|
9
9
|
'error',
|
|
10
10
|
{
|
|
11
11
|
ignoredFiles: [
|
|
12
|
-
'{projectRoot}/eslint.config.{js,cjs,mjs}',
|
|
12
|
+
'{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
|
|
13
13
|
'{projectRoot}/esbuild.config.{js,ts,mjs,mts}',
|
|
14
|
+
'{projectRoot}/vite.config.{js,ts,mjs,mts}',
|
|
14
15
|
],
|
|
15
16
|
},
|
|
16
17
|
],
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/core",
|
|
3
3
|
"version": "0.0.1",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
6
7
|
"dependencies": {
|
|
7
8
|
"zod": "4.1.9",
|
|
8
9
|
"@upstash/redis": "^1.34.9",
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"@
|
|
10
|
+
"@opentelemetry/api": "^1.9.0",
|
|
11
|
+
"node-object-hash": "^3.1.1",
|
|
12
|
+
"vitest": "^4.0.9",
|
|
13
|
+
"@nx/vite": "22.4.5"
|
|
13
14
|
},
|
|
14
|
-
"type": "module",
|
|
15
15
|
"sideEffects": false
|
|
16
16
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "core",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "packages/core/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"release": {
|
|
7
|
+
"version": {
|
|
8
|
+
"manifestRootsToUpdate": ["dist/{projectRoot}"],
|
|
9
|
+
"currentVersionResolver": "git-tag",
|
|
10
|
+
"fallbackCurrentVersionResolver": "disk"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"tags": [],
|
|
14
|
+
"targets": {
|
|
15
|
+
"build": {
|
|
16
|
+
"executor": "@nx/esbuild:esbuild",
|
|
17
|
+
"outputs": ["{options.outputPath}"],
|
|
18
|
+
"options": {
|
|
19
|
+
"outputPath": "dist/packages/core",
|
|
20
|
+
"main": "packages/core/src/index.ts",
|
|
21
|
+
"tsConfig": "packages/core/tsconfig.lib.json",
|
|
22
|
+
"assets": ["packages/core/*.md"],
|
|
23
|
+
"format": ["esm"],
|
|
24
|
+
"bundle": false
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"nx-release-publish": {
|
|
28
|
+
"options": {
|
|
29
|
+
"packageRoot": "dist/{projectRoot}"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequestContext } from '../schemas/session.schema.js';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseCapability } from './base.capability.js';
|
|
3
3
|
import type { Cache } from '../cache/cache.interface.js';
|
|
4
4
|
import {
|
|
5
5
|
AnalyticsMutationSchema,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '../schemas/index.js';
|
|
13
13
|
import { Reactionary } from '../decorators/reactionary.decorator.js';
|
|
14
14
|
|
|
15
|
-
export abstract class
|
|
15
|
+
export abstract class AnalyticsCapability extends BaseCapability {
|
|
16
16
|
protected override getResourceName(): string {
|
|
17
17
|
return 'analytics';
|
|
18
18
|
}
|
|
@@ -58,25 +58,25 @@ export abstract class AnalyticsProvider extends BaseProvider {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export class
|
|
62
|
-
protected
|
|
61
|
+
export class MulticastAnalyticsCapability extends AnalyticsCapability {
|
|
62
|
+
protected capabilities: Array<AnalyticsCapability>;
|
|
63
63
|
|
|
64
64
|
constructor(
|
|
65
65
|
cache: Cache,
|
|
66
66
|
requestContext: RequestContext,
|
|
67
|
-
|
|
67
|
+
capabilities: Array<AnalyticsCapability>
|
|
68
68
|
) {
|
|
69
69
|
super(cache, requestContext);
|
|
70
70
|
|
|
71
|
-
this.
|
|
71
|
+
this.capabilities = capabilities;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
@Reactionary({
|
|
75
75
|
inputSchema: AnalyticsMutationSchema,
|
|
76
76
|
})
|
|
77
77
|
public override async track(event: AnalyticsMutation) {
|
|
78
|
-
for (const
|
|
79
|
-
|
|
78
|
+
for (const capability of this.capabilities) {
|
|
79
|
+
capability.track(event);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
package/{core/src/providers/base.provider.ts → packages/core/src/capabilities/base.capability.ts}
RENAMED
|
@@ -3,10 +3,10 @@ import { type RequestContext } from '../schemas/session.schema.js';
|
|
|
3
3
|
import { hasher } from "node-object-hash";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Base capability
|
|
6
|
+
* Base capability abstraction, responsible for mutations (changes) and queries (fetches)
|
|
7
7
|
* for a given business object domain.
|
|
8
8
|
*/
|
|
9
|
-
export abstract class
|
|
9
|
+
export abstract class BaseCapability {
|
|
10
10
|
protected cache: Cache;
|
|
11
11
|
protected context: RequestContext;
|
|
12
12
|
|
package/{core/src/providers/cart.provider.ts → packages/core/src/capabilities/cart.capability.ts}
RENAMED
|
@@ -4,15 +4,15 @@ import type { CartIdentifier } from "../schemas/models/identifiers.model.js";
|
|
|
4
4
|
import type { CartMutationApplyCoupon, CartMutationChangeCurrency, CartMutationDeleteCart, CartMutationItemAdd, CartMutationItemQuantityChange, CartMutationItemRemove, CartMutationRemoveCoupon } from "../schemas/mutations/cart.mutation.js";
|
|
5
5
|
import type { CartQueryById } from "../schemas/queries/cart.query.js";
|
|
6
6
|
import type { Result } from "../schemas/result.js";
|
|
7
|
-
import {
|
|
7
|
+
import { BaseCapability } from "./base.capability.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @group Providers
|
|
11
11
|
*/
|
|
12
|
-
export abstract class
|
|
12
|
+
export abstract class CartCapability<
|
|
13
13
|
TCart extends Cart = Cart,
|
|
14
14
|
TCartIdentifier extends CartIdentifier = CartIdentifier,
|
|
15
|
-
> extends
|
|
15
|
+
> extends BaseCapability {
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Get cart by ID.
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { Category, CategoryPaginatedResult, NotFoundError, Result } from "../schemas/index.js";
|
|
2
2
|
import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories } from "../schemas/queries/category.query.js";
|
|
3
|
-
import {
|
|
3
|
+
import { BaseCapability } from "./base.capability.js";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* CategoryCapability
|
|
9
9
|
*
|
|
10
|
-
* This
|
|
10
|
+
* This capability allows fetching of single or sets of categories.
|
|
11
11
|
*
|
|
12
12
|
* We only allow fetching one hierachy level at a time, for now. This is to avoid development patterns of "fetch 5000 categories in one go.."
|
|
13
13
|
*
|
|
14
14
|
* @group Foo
|
|
15
15
|
*/
|
|
16
|
-
export abstract class
|
|
16
|
+
export abstract class CategoryCapability<
|
|
17
17
|
TCategory extends Category = Category,
|
|
18
18
|
TCategoryPaginatedResult extends CategoryPaginatedResult = CategoryPaginatedResult,
|
|
19
|
-
> extends
|
|
19
|
+
> extends BaseCapability {
|
|
20
20
|
/**
|
|
21
21
|
* Get a single category by its ID. Cannot return null, because HOW did you come across a categories ID that does not exist?
|
|
22
22
|
*
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { Checkout, PaymentMethod, ShippingMethod } from "../schemas/models/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { BaseCapability } from "./base.capability.js";
|
|
3
3
|
import type { CheckoutMutationFinalizeCheckout, CheckoutMutationInitiateCheckout, CheckoutMutationSetShippingAddress, CheckoutMutationAddPaymentInstruction, CheckoutMutationRemovePaymentInstruction, CheckoutMutationSetShippingInstruction } from "../schemas/mutations/checkout.mutation.js";
|
|
4
4
|
import type { CheckoutQueryById, CheckoutQueryForAvailablePaymentMethods, CheckoutQueryForAvailableShippingMethods } from "../schemas/queries/index.js";
|
|
5
5
|
import type { Result } from "../schemas/result.js";
|
|
6
6
|
import type { NotFoundError } from "../schemas/index.js";
|
|
7
7
|
|
|
8
|
-
export abstract class
|
|
8
|
+
export abstract class CheckoutCapability<
|
|
9
9
|
TCheckout extends Checkout = Checkout,
|
|
10
10
|
TShippingMethod extends ShippingMethod = ShippingMethod,
|
|
11
11
|
TPaymentMethod extends PaymentMethod = PaymentMethod,
|
|
12
|
-
> extends
|
|
12
|
+
> extends BaseCapability {
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* This starts a new checkout session for the given cart. The checkout might duplicate the cart, or just reference it, depending on implementation, but changes to the cart,
|
|
@@ -2,9 +2,9 @@ import type { Identity } from "../schemas/models/identity.model.js";
|
|
|
2
2
|
import type { IdentityMutationLogin, IdentityMutationLogout, IdentityMutationRegister } from "../schemas/mutations/identity.mutation.js";
|
|
3
3
|
import type { IdentityQuerySelf } from "../schemas/queries/identity.query.js";
|
|
4
4
|
import type { Result } from "../schemas/result.js";
|
|
5
|
-
import {
|
|
5
|
+
import { BaseCapability } from "./base.capability.js";
|
|
6
6
|
|
|
7
|
-
export abstract class
|
|
7
|
+
export abstract class IdentityCapability<TIdentity extends Identity = Identity> extends BaseCapability {
|
|
8
8
|
public abstract getSelf(payload: IdentityQuerySelf): Promise<Result<TIdentity>>;
|
|
9
9
|
public abstract login(payload: IdentityMutationLogin): Promise<Result<TIdentity>>;
|
|
10
10
|
public abstract logout(payload: IdentityMutationLogout): Promise<Result<TIdentity>>;
|