@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseCapability } from '../capabilities/base.capability.js';
|
|
3
3
|
import type { RequestContext } from '../schemas/session.schema.js';
|
|
4
4
|
import type { Cache } from '../cache/cache.interface.js';
|
|
5
5
|
import {
|
|
@@ -18,11 +18,11 @@ import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
|
18
18
|
import { SpanStatusCode, trace } from '@opentelemetry/api';
|
|
19
19
|
import { hrTimeToMilliseconds } from '@opentelemetry/core';
|
|
20
20
|
|
|
21
|
-
export function
|
|
21
|
+
export function createTestableCapability(
|
|
22
22
|
decoratorOptions: Partial<ReactionaryDecoratorOptions>,
|
|
23
23
|
fn?: any
|
|
24
24
|
) {
|
|
25
|
-
class
|
|
25
|
+
class TestableCapability extends BaseCapability {
|
|
26
26
|
constructor(
|
|
27
27
|
public override cache: Cache,
|
|
28
28
|
public override context: RequestContext
|
|
@@ -53,36 +53,36 @@ export function createTestableProvider(
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
public getResourceName(): string {
|
|
56
|
-
return '
|
|
56
|
+
return 'TestableCapability';
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const cache = new MemoryCache();
|
|
61
61
|
const context = createInitialRequestContext();
|
|
62
62
|
|
|
63
|
-
return new
|
|
63
|
+
return new TestableCapability(cache, context);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
describe('@Reactionary decorator', () => {
|
|
67
67
|
describe('Input validation', () => {
|
|
68
68
|
it('should reject invalid input with a failure', async () => {
|
|
69
|
-
const
|
|
69
|
+
const capability = createTestableCapability({
|
|
70
70
|
cache: false,
|
|
71
71
|
inputSchema: z.string(),
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
const result = await
|
|
74
|
+
const result = await capability.decoratedFunction(42);
|
|
75
75
|
|
|
76
76
|
expect(result.success).toBe(false);
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
it('should allow valid input through with a success', async () => {
|
|
80
|
-
const
|
|
80
|
+
const capability = createTestableCapability({
|
|
81
81
|
cache: false,
|
|
82
82
|
inputSchema: z.string(),
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
const result = await
|
|
85
|
+
const result = await capability.decoratedFunction('42');
|
|
86
86
|
|
|
87
87
|
expect(result.success).toBe(true);
|
|
88
88
|
});
|
|
@@ -90,7 +90,7 @@ describe('@Reactionary decorator', () => {
|
|
|
90
90
|
|
|
91
91
|
describe('Output validation', () => {
|
|
92
92
|
it('should reject invalid output with a failure', async () => {
|
|
93
|
-
const
|
|
93
|
+
const capability = createTestableCapability(
|
|
94
94
|
{
|
|
95
95
|
cache: false,
|
|
96
96
|
outputSchema: z.string(),
|
|
@@ -100,13 +100,13 @@ describe('@Reactionary decorator', () => {
|
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
102
|
|
|
103
|
-
const result = await
|
|
103
|
+
const result = await capability.decoratedFunction();
|
|
104
104
|
|
|
105
105
|
expect(result.success).toBe(false);
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
it('should allow valid output with a success', async () => {
|
|
109
|
-
const
|
|
109
|
+
const capability = createTestableCapability(
|
|
110
110
|
{
|
|
111
111
|
cache: false,
|
|
112
112
|
outputSchema: z.string(),
|
|
@@ -116,7 +116,7 @@ describe('@Reactionary decorator', () => {
|
|
|
116
116
|
}
|
|
117
117
|
);
|
|
118
118
|
|
|
119
|
-
const result = await
|
|
119
|
+
const result = await capability.decoratedFunction();
|
|
120
120
|
|
|
121
121
|
expect(result.success).toBe(true);
|
|
122
122
|
});
|
|
@@ -124,11 +124,11 @@ describe('@Reactionary decorator', () => {
|
|
|
124
124
|
|
|
125
125
|
describe('Error handling', () => {
|
|
126
126
|
it('will wrap errors thrown by the provider in a GenericError', async () => {
|
|
127
|
-
const
|
|
127
|
+
const capability = createTestableCapability({}, function () {
|
|
128
128
|
throw new Error('42');
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
-
const result = await
|
|
131
|
+
const result = await capability.decoratedFunction();
|
|
132
132
|
|
|
133
133
|
if (result.success) {
|
|
134
134
|
assert.fail();
|
|
@@ -157,14 +157,14 @@ describe('@Reactionary decorator', () => {
|
|
|
157
157
|
});
|
|
158
158
|
|
|
159
159
|
it('records a timed span for entering the decorated function', async () => {
|
|
160
|
-
const
|
|
160
|
+
const capability = createTestableCapability({
|
|
161
161
|
cache: false,
|
|
162
162
|
}, async function() {
|
|
163
163
|
await new Promise(resolve => setTimeout(resolve, 200));
|
|
164
164
|
|
|
165
165
|
return "42";
|
|
166
166
|
});
|
|
167
|
-
const result = await
|
|
167
|
+
const result = await capability.decoratedFunction();
|
|
168
168
|
const spans = exporter.getFinishedSpans();
|
|
169
169
|
|
|
170
170
|
expect(spans.length).toBe(1);
|
|
@@ -176,20 +176,20 @@ describe('@Reactionary decorator', () => {
|
|
|
176
176
|
|
|
177
177
|
console.log('unset expected: ', status);
|
|
178
178
|
|
|
179
|
-
expect(name).toBe('
|
|
179
|
+
expect(name).toBe('TestableCapability.decoratedFunction');
|
|
180
180
|
expect(duration).toBeGreaterThanOrEqual(200);
|
|
181
181
|
expect(duration).toBeLessThanOrEqual(300);
|
|
182
182
|
expect(status.code).toBe(SpanStatusCode.UNSET);
|
|
183
183
|
});
|
|
184
184
|
|
|
185
185
|
it('records exceptions as events and marks the span as an error', async () => {
|
|
186
|
-
const
|
|
186
|
+
const capability = createTestableCapability({
|
|
187
187
|
cache: false,
|
|
188
188
|
}, async function() {
|
|
189
189
|
throw new Error('42');
|
|
190
190
|
});
|
|
191
191
|
|
|
192
|
-
const result = await
|
|
192
|
+
const result = await capability.decoratedFunction();
|
|
193
193
|
const spans = exporter.getFinishedSpans();
|
|
194
194
|
|
|
195
195
|
expect(spans.length).toBe(1);
|
|
@@ -198,17 +198,17 @@ describe('@Reactionary decorator', () => {
|
|
|
198
198
|
const name = span.name;
|
|
199
199
|
const status = span.status;
|
|
200
200
|
|
|
201
|
-
expect(name).toBe('
|
|
201
|
+
expect(name).toBe('TestableCapability.decoratedFunction');
|
|
202
202
|
expect(status.code).toBe(SpanStatusCode.ERROR);
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
205
|
|
|
206
206
|
describe('Caching', () => {
|
|
207
207
|
it('should not cache repeat lookups if the decorator is set to uncached', async () => {
|
|
208
|
-
const
|
|
208
|
+
const capability = createTestableCapability({
|
|
209
209
|
cache: false,
|
|
210
210
|
});
|
|
211
|
-
const result = await
|
|
211
|
+
const result = await capability.decoratedFunction();
|
|
212
212
|
|
|
213
213
|
if (!result.success) {
|
|
214
214
|
assert.fail();
|
|
@@ -216,7 +216,7 @@ describe('@Reactionary decorator', () => {
|
|
|
216
216
|
|
|
217
217
|
expect(result.meta.cache.hit).toBe(false);
|
|
218
218
|
|
|
219
|
-
const secondResult = await
|
|
219
|
+
const secondResult = await capability.decoratedFunction();
|
|
220
220
|
|
|
221
221
|
if (!secondResult.success) {
|
|
222
222
|
assert.fail();
|
|
@@ -226,10 +226,10 @@ describe('@Reactionary decorator', () => {
|
|
|
226
226
|
});
|
|
227
227
|
|
|
228
228
|
it('should cache repeat lookups if the decorator is set to cached', async () => {
|
|
229
|
-
const
|
|
229
|
+
const capability = createTestableCapability({
|
|
230
230
|
cache: true,
|
|
231
231
|
});
|
|
232
|
-
const result = await
|
|
232
|
+
const result = await capability.decoratedFunction();
|
|
233
233
|
|
|
234
234
|
if (!result.success) {
|
|
235
235
|
assert.fail();
|
|
@@ -237,7 +237,7 @@ describe('@Reactionary decorator', () => {
|
|
|
237
237
|
|
|
238
238
|
expect(result.meta.cache.hit).toBe(false);
|
|
239
239
|
|
|
240
|
-
const secondResult = await
|
|
240
|
+
const secondResult = await capability.decoratedFunction();
|
|
241
241
|
|
|
242
242
|
if (!secondResult.success) {
|
|
243
243
|
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/core',
|
|
9
|
+
plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
10
|
+
// Uncomment this if you are using workers.
|
|
11
|
+
// worker: {
|
|
12
|
+
// plugins: () => [ nxViteTsPaths() ],
|
|
13
|
+
// },
|
|
14
|
+
test: {
|
|
15
|
+
name: 'core',
|
|
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/core',
|
|
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/core',
|
|
8
|
+
plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
9
|
+
test: {
|
|
10
|
+
name: 'core',
|
|
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/core',
|
|
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,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@reactionary/
|
|
2
|
+
"name": "@reactionary/fake",
|
|
3
3
|
"version": "0.0.1",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
6
7
|
"dependencies": {
|
|
8
|
+
"vitest": "^4.0.9",
|
|
9
|
+
"@nx/vite": "22.4.5",
|
|
7
10
|
"@reactionary/core": "0.0.1",
|
|
8
11
|
"zod": "4.1.9",
|
|
9
12
|
"@faker-js/faker": "^9.8.0"
|
|
10
13
|
},
|
|
11
|
-
"type": "module",
|
|
12
14
|
"sideEffects": false
|
|
13
15
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fake",
|
|
3
3
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "
|
|
4
|
+
"sourceRoot": "packages/fake/src",
|
|
5
5
|
"projectType": "library",
|
|
6
6
|
"release": {
|
|
7
7
|
"version": {
|
|
8
|
+
"manifestRootsToUpdate": ["dist/{projectRoot}"],
|
|
8
9
|
"currentVersionResolver": "git-tag",
|
|
9
|
-
"fallbackCurrentVersionResolver": "disk"
|
|
10
|
-
"preserveLocalDependencyProtocols": false,
|
|
11
|
-
"manifestRootsToUpdate": ["dist/{projectRoot}"]
|
|
10
|
+
"fallbackCurrentVersionResolver": "disk"
|
|
12
11
|
}
|
|
13
12
|
},
|
|
14
13
|
"tags": [],
|
|
@@ -17,10 +16,10 @@
|
|
|
17
16
|
"executor": "@nx/esbuild:esbuild",
|
|
18
17
|
"outputs": ["{options.outputPath}"],
|
|
19
18
|
"options": {
|
|
20
|
-
"outputPath": "dist/
|
|
21
|
-
"main": "
|
|
22
|
-
"tsConfig": "
|
|
23
|
-
"assets": ["
|
|
19
|
+
"outputPath": "dist/packages/fake",
|
|
20
|
+
"main": "packages/fake/src/index.ts",
|
|
21
|
+
"tsConfig": "packages/fake/tsconfig.lib.json",
|
|
22
|
+
"assets": ["packages/fake/*.md"],
|
|
24
23
|
"format": ["esm"],
|
|
25
24
|
"bundle": false
|
|
26
25
|
}
|
|
@@ -3,12 +3,12 @@ import type {
|
|
|
3
3
|
Cache,
|
|
4
4
|
RequestContext} from '@reactionary/core';
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
AnalyticsCapability
|
|
7
7
|
} from '@reactionary/core';
|
|
8
8
|
import type * as z from 'zod';
|
|
9
9
|
import type { FakeConfiguration } from '../schema/configuration.schema.js';
|
|
10
10
|
|
|
11
|
-
export class
|
|
11
|
+
export class FakeAnalyticsCapability extends AnalyticsCapability {
|
|
12
12
|
protected config: FakeConfiguration;
|
|
13
13
|
|
|
14
14
|
constructor(config: FakeConfiguration, cache: Cache, context: RequestContext) {
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
CartMutationItemQuantityChangeSchema,
|
|
27
27
|
CartMutationItemRemoveSchema,
|
|
28
28
|
CartMutationRemoveCouponSchema,
|
|
29
|
-
|
|
29
|
+
CartCapability,
|
|
30
30
|
CartQueryByIdSchema,
|
|
31
31
|
CartSchema,
|
|
32
32
|
Reactionary,
|
|
@@ -38,9 +38,9 @@ import type { FakeConfiguration } from '../schema/configuration.schema.js';
|
|
|
38
38
|
import { Faker, en, base } from '@faker-js/faker';
|
|
39
39
|
import type { FakeCartFactory } from '../factories/cart/cart.factory.js';
|
|
40
40
|
|
|
41
|
-
export class
|
|
41
|
+
export class FakeCartCapability<
|
|
42
42
|
TFactory extends CartFactory = FakeCartFactory,
|
|
43
|
-
> extends
|
|
43
|
+
> extends CartCapability<CartFactoryCartOutput<TFactory>, CartIdentifier> {
|
|
44
44
|
protected config: FakeConfiguration;
|
|
45
45
|
protected factory: CartFactoryWithOutput<TFactory>;
|
|
46
46
|
private carts: Map<string, Cart> = new Map();
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
} from '@reactionary/core';
|
|
18
18
|
import {
|
|
19
19
|
CategoryPaginatedResultSchema,
|
|
20
|
-
|
|
20
|
+
CategoryCapability,
|
|
21
21
|
CategoryQueryByIdSchema,
|
|
22
22
|
CategoryQueryBySlugSchema,
|
|
23
23
|
CategoryQueryForBreadcrumbSchema,
|
|
@@ -33,9 +33,9 @@ import * as z from 'zod';
|
|
|
33
33
|
import { Faker, en, base } from '@faker-js/faker';
|
|
34
34
|
import type { FakeCategoryFactory } from '../factories/category/category.factory.js';
|
|
35
35
|
|
|
36
|
-
export class
|
|
36
|
+
export class FakeCategoryCapability<
|
|
37
37
|
TFactory extends CategoryFactory = FakeCategoryFactory,
|
|
38
|
-
> extends
|
|
38
|
+
> extends CategoryCapability<
|
|
39
39
|
CategoryFactoryCategoryOutput<TFactory>,
|
|
40
40
|
CategoryFactoryPaginatedOutput<TFactory>
|
|
41
41
|
> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
CheckoutCapability,
|
|
3
3
|
type Checkout,
|
|
4
4
|
type CheckoutMutationAddPaymentInstruction,
|
|
5
5
|
type CheckoutMutationFinalizeCheckout,
|
|
@@ -42,9 +42,9 @@ import { base, en, Faker } from '@faker-js/faker';
|
|
|
42
42
|
import * as z from 'zod';
|
|
43
43
|
import type { FakeCheckoutFactory } from '../factories/checkout/checkout.factory.js';
|
|
44
44
|
|
|
45
|
-
export class
|
|
45
|
+
export class FakeCheckoutCapability<
|
|
46
46
|
TFactory extends CheckoutFactory = FakeCheckoutFactory,
|
|
47
|
-
> extends
|
|
47
|
+
> extends CheckoutCapability<
|
|
48
48
|
CheckoutFactoryCheckoutOutput<TFactory>,
|
|
49
49
|
CheckoutFactoryShippingMethodOutput<TFactory>,
|
|
50
50
|
CheckoutFactoryPaymentMethodOutput<TFactory>
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
IdentityMutationRegisterSchema,
|
|
14
14
|
type IdentityQuerySelf,
|
|
15
15
|
IdentityQuerySelfSchema,
|
|
16
|
-
|
|
16
|
+
IdentityCapability,
|
|
17
17
|
IdentitySchema,
|
|
18
18
|
type RegisteredIdentity,
|
|
19
19
|
type RequestContext,
|
|
@@ -25,9 +25,9 @@ import type { FakeConfiguration } from '../schema/configuration.schema.js';
|
|
|
25
25
|
import { base, en, Faker } from '@faker-js/faker';
|
|
26
26
|
import type { FakeIdentityFactory } from '../factories/identity/identity.factory.js';
|
|
27
27
|
|
|
28
|
-
export class
|
|
28
|
+
export class FakeIdentityCapability<
|
|
29
29
|
TFactory extends IdentityFactory = FakeIdentityFactory,
|
|
30
|
-
> extends
|
|
30
|
+
> extends IdentityCapability<IdentityFactoryOutput<TFactory>> {
|
|
31
31
|
protected config: FakeConfiguration;
|
|
32
32
|
protected factory: IdentityFactoryWithOutput<TFactory>;
|
|
33
33
|
private currentIdentity: Identity | null = null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './analytics.capability.js';
|
|
2
|
+
export * from './cart.capability.js';
|
|
3
|
+
export * from './category.capability.js';
|
|
4
|
+
export * from './checkout.capability.js';
|
|
5
|
+
export * from './identity.capability.js';
|
|
6
|
+
export * from './inventory.capability.js';
|
|
7
|
+
export * from './order-search.capability.js';
|
|
8
|
+
export * from './order.capability.js';
|
|
9
|
+
export * from './price.capability.js';
|
|
10
|
+
export * from './product.capability.js';
|
|
11
|
+
export * from './product-associations.capability.js';
|
|
12
|
+
export * from './product-reviews.capability.js';
|
|
13
|
+
export * from './product-search.capability.js';
|
|
14
|
+
export * from './profile.capability.js';
|
|
15
|
+
export * from './store.capability.js';
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
Result,
|
|
13
13
|
} from '@reactionary/core';
|
|
14
14
|
import {
|
|
15
|
-
|
|
15
|
+
InventoryCapability,
|
|
16
16
|
InventoryQueryBySKUSchema,
|
|
17
17
|
InventorySchema,
|
|
18
18
|
Reactionary,
|
|
@@ -21,9 +21,9 @@ import {
|
|
|
21
21
|
import type { FakeConfiguration } from '../schema/configuration.schema.js';
|
|
22
22
|
import type { FakeInventoryFactory } from '../factories/inventory/inventory.factory.js';
|
|
23
23
|
|
|
24
|
-
export class
|
|
24
|
+
export class FakeInventoryCapability<
|
|
25
25
|
TFactory extends InventoryFactory = FakeInventoryFactory,
|
|
26
|
-
> extends
|
|
26
|
+
> extends InventoryCapability<InventoryFactoryOutput<TFactory>> {
|
|
27
27
|
protected config: FakeConfiguration;
|
|
28
28
|
protected factory: InventoryFactoryWithOutput<TFactory>;
|
|
29
29
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
OrderSearchCapability,
|
|
3
3
|
OrderSearchQueryByTermSchema,
|
|
4
4
|
OrderSearchResultSchema,
|
|
5
5
|
Reactionary,
|
|
@@ -18,9 +18,9 @@ import type { FakeConfiguration } from '../schema/configuration.schema.js';
|
|
|
18
18
|
import { Faker, en, base } from '@faker-js/faker';
|
|
19
19
|
import type { FakeOrderSearchFactory } from '../factories/order-search/order-search.factory.js';
|
|
20
20
|
|
|
21
|
-
export class
|
|
21
|
+
export class FakeOrderSearchCapability<
|
|
22
22
|
TFactory extends OrderSearchFactory = FakeOrderSearchFactory,
|
|
23
|
-
> extends
|
|
23
|
+
> extends OrderSearchCapability<OrderSearchFactoryOutput<TFactory>> {
|
|
24
24
|
protected config: FakeConfiguration;
|
|
25
25
|
protected generator: Faker;
|
|
26
26
|
protected factory: OrderSearchFactoryWithOutput<TFactory>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
OrderCapability,
|
|
3
3
|
OrderQueryByIdSchema,
|
|
4
4
|
OrderSchema,
|
|
5
5
|
Reactionary,
|
|
@@ -18,9 +18,9 @@ import type { FakeConfiguration } from '../schema/configuration.schema.js';
|
|
|
18
18
|
import { Faker, en, base } from '@faker-js/faker';
|
|
19
19
|
import type { FakeOrderFactory } from '../factories/order/order.factory.js';
|
|
20
20
|
|
|
21
|
-
export class
|
|
21
|
+
export class FakeOrderCapability<
|
|
22
22
|
TFactory extends OrderFactory = FakeOrderFactory,
|
|
23
|
-
> extends
|
|
23
|
+
> extends OrderCapability<OrderFactoryOutput<TFactory>> {
|
|
24
24
|
protected config: FakeConfiguration;
|
|
25
25
|
protected generator: Faker;
|
|
26
26
|
protected factory: OrderFactoryWithOutput<TFactory>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CustomerPriceQuerySchema,
|
|
3
3
|
ListPriceQuerySchema,
|
|
4
|
-
|
|
4
|
+
PriceCapability,
|
|
5
5
|
PriceSchema,
|
|
6
6
|
Reactionary,
|
|
7
7
|
success,
|
|
@@ -20,9 +20,9 @@ import { base, en, Faker } from '@faker-js/faker';
|
|
|
20
20
|
import { calcSeed } from '../utilities/seed.js';
|
|
21
21
|
import type { FakePriceFactory } from '../factories/price/price.factory.js';
|
|
22
22
|
|
|
23
|
-
export class
|
|
23
|
+
export class FakePriceCapability<
|
|
24
24
|
TFactory extends PriceFactory = FakePriceFactory,
|
|
25
|
-
> extends
|
|
25
|
+
> extends PriceCapability<PriceFactoryOutput<TFactory>> {
|
|
26
26
|
protected config: FakeConfiguration;
|
|
27
27
|
protected faker: Faker;
|
|
28
28
|
protected factory: PriceFactoryWithOutput<TFactory>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ProductAssociationsCapability,
|
|
3
3
|
Reactionary,
|
|
4
4
|
type ProductAssociationsGetAccessoriesQuery,
|
|
5
5
|
type ProductAssociationsGetSparepartsQuery,
|
|
@@ -21,9 +21,9 @@ import { en, Faker } from '@faker-js/faker';
|
|
|
21
21
|
import { calcSeed } from '../utilities/seed.js';
|
|
22
22
|
import type { FakeProductAssociationsFactory } from '../factories/product-associations/product-associations.factory.js';
|
|
23
23
|
|
|
24
|
-
export class
|
|
24
|
+
export class FakeProductAssociationsCapability<
|
|
25
25
|
TFactory extends ProductAssociationsFactory = FakeProductAssociationsFactory,
|
|
26
|
-
> extends
|
|
26
|
+
> extends ProductAssociationsCapability<ProductAssociationsFactoryOutput<TFactory>> {
|
|
27
27
|
protected config: FakeConfiguration;
|
|
28
28
|
protected factory: ProductAssociationsFactoryWithOutput<TFactory>;
|
|
29
29
|
protected faker: Faker;
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ProductRatingSummarySchema,
|
|
3
3
|
ProductReviewPaginatedResultSchema,
|
|
4
4
|
ProductReviewSchema,
|
|
5
|
-
|
|
5
|
+
ProductReviewsCapability,
|
|
6
6
|
Reactionary,
|
|
7
7
|
error,
|
|
8
8
|
success,
|
|
@@ -27,9 +27,9 @@ import { base, en, Faker } from '@faker-js/faker';
|
|
|
27
27
|
import { calcSeed } from '../utilities/seed.js';
|
|
28
28
|
import type { FakeProductReviewsFactory } from '../factories/product-reviews/product-reviews.factory.js';
|
|
29
29
|
|
|
30
|
-
export class
|
|
30
|
+
export class FakeProductReviewsCapability<
|
|
31
31
|
TFactory extends ProductReviewsFactory = FakeProductReviewsFactory,
|
|
32
|
-
> extends
|
|
32
|
+
> extends ProductReviewsCapability<
|
|
33
33
|
ProductReviewsFactoryRatingOutput<TFactory>,
|
|
34
34
|
ProductReviewsFactoryReviewPaginatedOutput<TFactory>,
|
|
35
35
|
ProductReviewsFactoryReviewOutput<TFactory>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImageSchema,
|
|
3
|
-
|
|
3
|
+
ProductSearchCapability,
|
|
4
4
|
ProductSearchQueryByTermSchema,
|
|
5
5
|
ProductSearchResultItemSchema,
|
|
6
6
|
ProductSearchResultSchema,
|
|
@@ -26,9 +26,9 @@ import { Faker, en, base } from '@faker-js/faker';
|
|
|
26
26
|
import { jitter } from '../utilities/jitter.js';
|
|
27
27
|
import type { FakeProductSearchFactory } from '../factories/product-search/product-search.factory.js';
|
|
28
28
|
|
|
29
|
-
export class
|
|
29
|
+
export class FakeProductSearchCapability<
|
|
30
30
|
TFactory extends ProductSearchFactory = FakeProductSearchFactory,
|
|
31
|
-
> extends
|
|
31
|
+
> extends ProductSearchCapability<ProductSearchFactoryOutput<TFactory>> {
|
|
32
32
|
protected config: FakeConfiguration;
|
|
33
33
|
protected factory: ProductSearchFactoryWithOutput<TFactory>;
|
|
34
34
|
|