@medusajs/utils 3.0.0-snapshot-20250410112222 → 3.0.0-snapshot-20251104004624
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics/abstract-analytics-provider.d.ts +110 -0
- package/dist/analytics/abstract-analytics-provider.d.ts.map +1 -0
- package/dist/analytics/abstract-analytics-provider.js +107 -0
- package/dist/analytics/abstract-analytics-provider.js.map +1 -0
- package/dist/analytics/index.d.ts +2 -0
- package/dist/analytics/index.d.ts.map +1 -0
- package/dist/{feature-flags/utils → analytics}/index.js +1 -1
- package/dist/analytics/index.js.map +1 -0
- package/dist/auth/token.d.ts +4 -2
- package/dist/auth/token.d.ts.map +1 -1
- package/dist/auth/token.js +5 -2
- package/dist/auth/token.js.map +1 -1
- package/dist/bundles.d.ts +1 -0
- package/dist/bundles.d.ts.map +1 -1
- package/dist/bundles.js +19 -8
- package/dist/bundles.js.map +1 -1
- package/dist/caching/index.d.ts +59 -0
- package/dist/caching/index.d.ts.map +1 -0
- package/dist/caching/index.js +132 -0
- package/dist/caching/index.js.map +1 -0
- package/dist/common/build-query.d.ts +1 -1
- package/dist/common/build-query.d.ts.map +1 -1
- package/dist/common/camel-to-snake-case.d.ts.map +1 -1
- package/dist/common/compress-name.d.ts +2 -0
- package/dist/common/compress-name.d.ts.map +1 -0
- package/dist/common/compress-name.js +34 -0
- package/dist/common/compress-name.js.map +1 -0
- package/dist/common/container.d.ts +1 -1
- package/dist/common/container.js +1 -1
- package/dist/common/create-container-like.d.ts.map +1 -1
- package/dist/common/create-container-like.js +9 -1
- package/dist/common/create-container-like.js.map +1 -1
- package/dist/common/create-psql-index-helper.d.ts +2 -2
- package/dist/common/create-psql-index-helper.d.ts.map +1 -1
- package/dist/common/create-psql-index-helper.js +4 -2
- package/dist/common/create-psql-index-helper.js.map +1 -1
- package/dist/common/deep-copy.js +20 -10
- package/dist/common/deep-copy.js.map +1 -1
- package/dist/common/define-config.d.ts.map +1 -1
- package/dist/common/define-config.js +122 -6
- package/dist/common/define-config.js.map +1 -1
- package/dist/common/define-file-config.d.ts +7 -0
- package/dist/common/define-file-config.d.ts.map +1 -0
- package/dist/common/define-file-config.js +31 -0
- package/dist/common/define-file-config.js.map +1 -0
- package/dist/common/dynamic-import.d.ts.map +1 -1
- package/dist/common/dynamic-import.js +6 -1
- package/dist/common/dynamic-import.js.map +1 -1
- package/dist/common/execute-with-concurrency.d.ts +7 -0
- package/dist/common/execute-with-concurrency.d.ts.map +1 -0
- package/dist/common/execute-with-concurrency.js +26 -0
- package/dist/common/execute-with-concurrency.js.map +1 -0
- package/dist/common/get-duplicates.d.ts.map +1 -1
- package/dist/common/get-iso-string-from-date.d.ts.map +1 -1
- package/dist/common/get-resolved-plugins.js +1 -1
- package/dist/common/get-resolved-plugins.js.map +1 -1
- package/dist/common/get-selects-and-relations-from-object-array.d.ts +2 -1
- package/dist/common/get-selects-and-relations-from-object-array.d.ts.map +1 -1
- package/dist/common/get-selects-and-relations-from-object-array.js +7 -5
- package/dist/common/get-selects-and-relations-from-object-array.js.map +1 -1
- package/dist/common/index.d.ts +9 -2
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +9 -2
- package/dist/common/index.js.map +1 -1
- package/dist/common/medusa-container.js +1 -1
- package/dist/common/medusa-container.js.map +1 -1
- package/dist/common/normalize-csv-value.d.ts +6 -0
- package/dist/common/normalize-csv-value.d.ts.map +1 -0
- package/dist/common/normalize-csv-value.js +14 -0
- package/dist/common/normalize-csv-value.js.map +1 -0
- package/dist/common/normalize-import-path-with-source.d.ts +1 -1
- package/dist/common/normalize-import-path-with-source.d.ts.map +1 -1
- package/dist/common/normalize-import-path-with-source.js +2 -2
- package/dist/common/normalize-import-path-with-source.js.map +1 -1
- package/dist/common/optional-numeric-serializer.d.ts.map +1 -1
- package/dist/common/parse-stringify-if-necessary.d.ts +11 -0
- package/dist/common/parse-stringify-if-necessary.d.ts.map +1 -0
- package/dist/common/parse-stringify-if-necessary.js +44 -0
- package/dist/common/parse-stringify-if-necessary.js.map +1 -0
- package/dist/common/partition-array.d.ts.map +1 -1
- package/dist/common/read-dir-recursive.d.ts +2 -1
- package/dist/common/read-dir-recursive.d.ts.map +1 -1
- package/dist/common/read-dir-recursive.js +4 -3
- package/dist/common/read-dir-recursive.js.map +1 -1
- package/dist/common/remove-undefined.d.ts.map +1 -1
- package/dist/common/retry-execution.d.ts +18 -0
- package/dist/common/retry-execution.d.ts.map +1 -0
- package/dist/common/retry-execution.js +50 -0
- package/dist/common/retry-execution.js.map +1 -0
- package/dist/common/to-handle.d.ts.map +1 -1
- package/dist/common/to-kebab-case.d.ts.map +1 -1
- package/dist/common/try-convert-to-boolean.d.ts +7 -0
- package/dist/common/try-convert-to-boolean.d.ts.map +1 -0
- package/dist/common/try-convert-to-boolean.js +15 -0
- package/dist/common/try-convert-to-boolean.js.map +1 -0
- package/dist/common/try-convert-to-number.d.ts +7 -0
- package/dist/common/try-convert-to-number.d.ts.map +1 -0
- package/dist/common/try-convert-to-number.js +10 -0
- package/dist/common/try-convert-to-number.js.map +1 -0
- package/dist/common/validate-handle.d.ts.map +1 -1
- package/dist/common/wrap-handler.d.ts.map +1 -1
- package/dist/core-flows/events.d.ts +783 -0
- package/dist/core-flows/events.d.ts.map +1 -1
- package/dist/core-flows/events.js +784 -1
- package/dist/core-flows/events.js.map +1 -1
- package/dist/dal/index.d.ts +4 -3
- package/dist/dal/index.d.ts.map +1 -1
- package/dist/dal/index.js +4 -3
- package/dist/dal/index.js.map +1 -1
- package/dist/dal/mikro-orm/base-entity.d.ts +1 -1
- package/dist/dal/mikro-orm/base-entity.d.ts.map +1 -1
- package/dist/dal/mikro-orm/base-entity.js +1 -1
- package/dist/dal/mikro-orm/base-entity.js.map +1 -1
- package/dist/dal/mikro-orm/big-number-field.d.ts +1 -1
- package/dist/dal/mikro-orm/big-number-field.d.ts.map +1 -1
- package/dist/dal/mikro-orm/big-number-field.js +38 -2
- package/dist/dal/mikro-orm/big-number-field.js.map +1 -1
- package/dist/dal/mikro-orm/custom-db-migrator.d.ts +8 -0
- package/dist/dal/mikro-orm/custom-db-migrator.d.ts.map +1 -0
- package/dist/dal/mikro-orm/custom-db-migrator.js +47 -0
- package/dist/dal/mikro-orm/custom-db-migrator.js.map +1 -0
- package/dist/dal/mikro-orm/db-error-mapper.d.ts.map +1 -1
- package/dist/dal/mikro-orm/db-error-mapper.js +1 -1
- package/dist/dal/mikro-orm/db-error-mapper.js.map +1 -1
- package/dist/dal/mikro-orm/decorators/foreign-key.d.ts.map +1 -1
- package/dist/dal/mikro-orm/decorators/foreign-key.js +1 -1
- package/dist/dal/mikro-orm/decorators/foreign-key.js.map +1 -1
- package/dist/dal/mikro-orm/decorators/searchable.d.ts.map +1 -1
- package/dist/dal/mikro-orm/decorators/searchable.js +1 -1
- package/dist/dal/mikro-orm/decorators/searchable.js.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-create-connection.d.ts +3 -3
- package/dist/dal/mikro-orm/mikro-orm-create-connection.d.ts.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-create-connection.js +32 -4
- package/dist/dal/mikro-orm/mikro-orm-create-connection.js.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-free-text-search-filter.d.ts +2 -2
- package/dist/dal/mikro-orm/mikro-orm-free-text-search-filter.d.ts.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-free-text-search-filter.js +3 -3
- package/dist/dal/mikro-orm/mikro-orm-free-text-search-filter.js.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-repository.d.ts +2 -1
- package/dist/dal/mikro-orm/mikro-orm-repository.d.ts.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-repository.js +282 -65
- package/dist/dal/mikro-orm/mikro-orm-repository.js.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-serializer-old.d.ts +29 -0
- package/dist/dal/mikro-orm/mikro-orm-serializer-old.d.ts.map +1 -0
- package/dist/dal/mikro-orm/mikro-orm-serializer-old.js +443 -0
- package/dist/dal/mikro-orm/mikro-orm-serializer-old.js.map +1 -0
- package/dist/dal/mikro-orm/mikro-orm-serializer.d.ts +25 -10
- package/dist/dal/mikro-orm/mikro-orm-serializer.d.ts.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-serializer.js +384 -175
- package/dist/dal/mikro-orm/mikro-orm-serializer.js.map +1 -1
- package/dist/dal/mikro-orm/utils.d.ts +1 -1
- package/dist/dal/mikro-orm/utils.d.ts.map +1 -1
- package/dist/defaults/countries.js +6 -6
- package/dist/defaults/countries.js.map +1 -1
- package/dist/defaults/currencies.d.ts.map +1 -1
- package/dist/defaults/currencies.js +27 -0
- package/dist/defaults/currencies.js.map +1 -1
- package/dist/dml/entity-builder.d.ts +1 -1
- package/dist/dml/entity-builder.js +1 -1
- package/dist/dml/helpers/create-graphql.d.ts.map +1 -1
- package/dist/dml/helpers/create-graphql.js +10 -3
- package/dist/dml/helpers/create-graphql.js.map +1 -1
- package/dist/dml/helpers/create-mikro-orm-entity.d.ts +0 -3
- package/dist/dml/helpers/create-mikro-orm-entity.d.ts.map +1 -1
- package/dist/dml/helpers/create-mikro-orm-entity.js +5 -4
- package/dist/dml/helpers/create-mikro-orm-entity.js.map +1 -1
- package/dist/dml/helpers/entity-builder/create-big-number-properties.d.ts.map +1 -1
- package/dist/dml/helpers/entity-builder/create-big-number-properties.js +16 -4
- package/dist/dml/helpers/entity-builder/create-big-number-properties.js.map +1 -1
- package/dist/dml/helpers/entity-builder/define-property.js +1 -1
- package/dist/dml/helpers/entity-builder/define-property.js.map +1 -1
- package/dist/dml/helpers/entity-builder/define-relationship.js +1 -1
- package/dist/dml/helpers/entity-builder/define-relationship.js.map +1 -1
- package/dist/dml/helpers/graphql-builder/get-attribute.d.ts.map +1 -1
- package/dist/dml/helpers/graphql-builder/get-attribute.js +3 -2
- package/dist/dml/helpers/graphql-builder/get-attribute.js.map +1 -1
- package/dist/dml/helpers/mikro-orm/apply-checks.js +1 -1
- package/dist/dml/helpers/mikro-orm/apply-checks.js.map +1 -1
- package/dist/dml/helpers/mikro-orm/build-indexes.js +1 -1
- package/dist/dml/helpers/mikro-orm/build-indexes.js.map +1 -1
- package/dist/dml/properties/autoincrement.d.ts +20 -1
- package/dist/dml/properties/autoincrement.d.ts.map +1 -1
- package/dist/dml/properties/autoincrement.js +19 -0
- package/dist/dml/properties/autoincrement.js.map +1 -1
- package/dist/dml/properties/big-number.d.ts +2 -0
- package/dist/dml/properties/big-number.d.ts.map +1 -1
- package/dist/dml/properties/big-number.js +4 -0
- package/dist/dml/properties/big-number.js.map +1 -1
- package/dist/dml/properties/id.d.ts +1 -1
- package/dist/dml/properties/id.d.ts.map +1 -1
- package/dist/dml/properties/id.js.map +1 -1
- package/dist/dml/properties/primary-key.d.ts +1 -0
- package/dist/dml/properties/primary-key.d.ts.map +1 -1
- package/dist/dml/properties/primary-key.js +8 -5
- package/dist/dml/properties/primary-key.js.map +1 -1
- package/dist/dml/relations/belongs-to.d.ts.map +1 -1
- package/dist/dml/relations/has-many.d.ts.map +1 -1
- package/dist/dml/relations/has-one-fk.d.ts.map +1 -1
- package/dist/dml/relations/has-one.d.ts.map +1 -1
- package/dist/dml/relations/many-to-many.d.ts.map +1 -1
- package/dist/event-bus/index.d.ts +30 -2
- package/dist/event-bus/index.d.ts.map +1 -1
- package/dist/event-bus/index.js +39 -0
- package/dist/event-bus/index.js.map +1 -1
- package/dist/event-bus/message-aggregator.d.ts +1 -1
- package/dist/event-bus/message-aggregator.d.ts.map +1 -1
- package/dist/event-bus/message-aggregator.js +30 -8
- package/dist/event-bus/message-aggregator.js.map +1 -1
- package/dist/event-bus/utils.d.ts.map +1 -1
- package/dist/event-bus/utils.js +1 -2
- package/dist/event-bus/utils.js.map +1 -1
- package/dist/exceptions/is-duplicate-error.d.ts.map +1 -1
- package/dist/feature-flags/discover-and-register-feature-flags.d.ts +15 -0
- package/dist/feature-flags/discover-and-register-feature-flags.d.ts.map +1 -0
- package/dist/feature-flags/discover-and-register-feature-flags.js +23 -0
- package/dist/feature-flags/discover-and-register-feature-flags.js.map +1 -0
- package/dist/feature-flags/discover-feature-flags.d.ts +6 -0
- package/dist/feature-flags/discover-feature-flags.d.ts.map +1 -0
- package/dist/feature-flags/discover-feature-flags.js +53 -0
- package/dist/feature-flags/discover-feature-flags.js.map +1 -0
- package/dist/feature-flags/{utils/flag-router.d.ts → flag-router.d.ts} +1 -0
- package/dist/feature-flags/flag-router.d.ts.map +1 -0
- package/dist/feature-flags/{utils/flag-router.js → flag-router.js} +3 -2
- package/dist/feature-flags/flag-router.js.map +1 -0
- package/dist/feature-flags/index.d.ts +4 -10
- package/dist/feature-flags/index.d.ts.map +1 -1
- package/dist/feature-flags/index.js +4 -10
- package/dist/feature-flags/index.js.map +1 -1
- package/dist/feature-flags/register-flag.d.ts +18 -0
- package/dist/feature-flags/register-flag.d.ts.map +1 -0
- package/dist/feature-flags/register-flag.js +41 -0
- package/dist/feature-flags/register-flag.js.map +1 -0
- package/dist/file/abstract-file-provider.d.ts +61 -9
- package/dist/file/abstract-file-provider.d.ts.map +1 -1
- package/dist/file/abstract-file-provider.js +64 -9
- package/dist/file/abstract-file-provider.js.map +1 -1
- package/dist/fulfillment/events.d.ts +6 -0
- package/dist/fulfillment/events.d.ts.map +1 -1
- package/dist/fulfillment/events.js +6 -0
- package/dist/fulfillment/events.js.map +1 -1
- package/dist/fulfillment/provider.d.ts +4 -4
- package/dist/fulfillment/provider.js +4 -4
- package/dist/graphql/graphql-to-ts-types.d.ts.map +1 -1
- package/dist/graphql/graphql-to-ts-types.js +40 -9
- package/dist/graphql/graphql-to-ts-types.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/link/compose-link-name.d.ts.map +1 -1
- package/dist/migrations/index.d.ts +3 -3
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +37 -3
- package/dist/migrations/index.js.map +1 -1
- package/dist/modules-sdk/build-query.d.ts.map +1 -1
- package/dist/modules-sdk/build-query.js +5 -11
- package/dist/modules-sdk/build-query.js.map +1 -1
- package/dist/modules-sdk/create-medusa-mikro-orm-event-subscriber.d.ts +16 -0
- package/dist/modules-sdk/create-medusa-mikro-orm-event-subscriber.d.ts.map +1 -0
- package/dist/modules-sdk/create-medusa-mikro-orm-event-subscriber.js +50 -0
- package/dist/modules-sdk/create-medusa-mikro-orm-event-subscriber.js.map +1 -0
- package/dist/modules-sdk/create-pg-connection.d.ts +1 -1
- package/dist/modules-sdk/create-pg-connection.d.ts.map +1 -1
- package/dist/modules-sdk/create-pg-connection.js +13 -2
- package/dist/modules-sdk/create-pg-connection.js.map +1 -1
- package/dist/modules-sdk/decorators/context-parameter.d.ts.map +1 -1
- package/dist/modules-sdk/decorators/emit-events.d.ts.map +1 -1
- package/dist/modules-sdk/decorators/inject-manager.d.ts.map +1 -1
- package/dist/modules-sdk/decorators/inject-manager.js +4 -3
- package/dist/modules-sdk/decorators/inject-manager.js.map +1 -1
- package/dist/modules-sdk/decorators/inject-transaction-manager.d.ts.map +1 -1
- package/dist/modules-sdk/decorators/inject-transaction-manager.js +7 -9
- package/dist/modules-sdk/decorators/inject-transaction-manager.js.map +1 -1
- package/dist/modules-sdk/define-link.d.ts +2 -0
- package/dist/modules-sdk/define-link.d.ts.map +1 -1
- package/dist/modules-sdk/define-link.js +11 -0
- package/dist/modules-sdk/define-link.js.map +1 -1
- package/dist/modules-sdk/definition.d.ts +9 -0
- package/dist/modules-sdk/definition.d.ts.map +1 -1
- package/dist/modules-sdk/definition.js +6 -0
- package/dist/modules-sdk/definition.js.map +1 -1
- package/dist/modules-sdk/event-builder-factory.d.ts.map +1 -1
- package/dist/modules-sdk/index.d.ts +1 -0
- package/dist/modules-sdk/index.d.ts.map +1 -1
- package/dist/modules-sdk/index.js +1 -0
- package/dist/modules-sdk/index.js.map +1 -1
- package/dist/modules-sdk/joiner-config-builder.d.ts +7 -1
- package/dist/modules-sdk/joiner-config-builder.d.ts.map +1 -1
- package/dist/modules-sdk/joiner-config-builder.js +42 -8
- package/dist/modules-sdk/joiner-config-builder.js.map +1 -1
- package/dist/modules-sdk/load-module-database-config.d.ts.map +1 -1
- package/dist/modules-sdk/load-module-database-config.js +15 -1
- package/dist/modules-sdk/load-module-database-config.js.map +1 -1
- package/dist/modules-sdk/loaders/container-loader-factory.js +1 -1
- package/dist/modules-sdk/loaders/container-loader-factory.js.map +1 -1
- package/dist/modules-sdk/loaders/mikro-orm-connection-loader.d.ts.map +1 -1
- package/dist/modules-sdk/loaders/mikro-orm-connection-loader.js +1 -1
- package/dist/modules-sdk/loaders/mikro-orm-connection-loader.js.map +1 -1
- package/dist/modules-sdk/medusa-internal-service.d.ts +14 -3
- package/dist/modules-sdk/medusa-internal-service.d.ts.map +1 -1
- package/dist/modules-sdk/medusa-internal-service.js +126 -3
- package/dist/modules-sdk/medusa-internal-service.js.map +1 -1
- package/dist/modules-sdk/medusa-service.d.ts.map +1 -1
- package/dist/modules-sdk/medusa-service.js +89 -56
- package/dist/modules-sdk/medusa-service.js.map +1 -1
- package/dist/modules-sdk/migration-scripts/migration-down.d.ts.map +1 -1
- package/dist/modules-sdk/migration-scripts/migration-down.js +4 -2
- package/dist/modules-sdk/migration-scripts/migration-down.js.map +1 -1
- package/dist/modules-sdk/migration-scripts/migration-generate.d.ts +1 -1
- package/dist/modules-sdk/migration-scripts/migration-generate.d.ts.map +1 -1
- package/dist/modules-sdk/migration-scripts/migration-generate.js +3 -3
- package/dist/modules-sdk/migration-scripts/migration-generate.js.map +1 -1
- package/dist/modules-sdk/migration-scripts/migration-up.d.ts.map +1 -1
- package/dist/modules-sdk/migration-scripts/migration-up.js +4 -2
- package/dist/modules-sdk/migration-scripts/migration-up.js.map +1 -1
- package/dist/modules-sdk/migration-scripts/seed.d.ts.map +1 -1
- package/dist/modules-sdk/migration-scripts/seed.js +4 -1
- package/dist/modules-sdk/migration-scripts/seed.js.map +1 -1
- package/dist/modules-sdk/mikro-orm-cli-config-builder.d.ts +1 -1
- package/dist/modules-sdk/mikro-orm-cli-config-builder.d.ts.map +1 -1
- package/dist/modules-sdk/mikro-orm-cli-config-builder.js +2 -1
- package/dist/modules-sdk/mikro-orm-cli-config-builder.js.map +1 -1
- package/dist/modules-sdk/module.d.ts.map +1 -1
- package/dist/modules-sdk/module.js +2 -0
- package/dist/modules-sdk/module.js.map +1 -1
- package/dist/modules-sdk/modules-to-container-types.d.ts.map +1 -1
- package/dist/modules-sdk/modules-to-container-types.js +2 -1
- package/dist/modules-sdk/modules-to-container-types.js.map +1 -1
- package/dist/modules-sdk/query-context.d.ts +2 -2
- package/dist/modules-sdk/query-context.d.ts.map +1 -1
- package/dist/modules-sdk/query-context.js.map +1 -1
- package/dist/modules-sdk/types/medusa-service.d.ts +15 -1
- package/dist/modules-sdk/types/medusa-service.d.ts.map +1 -1
- package/dist/payment/abstract-payment-provider.d.ts +145 -32
- package/dist/payment/abstract-payment-provider.d.ts.map +1 -1
- package/dist/payment/abstract-payment-provider.js +6 -3
- package/dist/payment/abstract-payment-provider.js.map +1 -1
- package/dist/payment/index.d.ts +0 -1
- package/dist/payment/index.d.ts.map +1 -1
- package/dist/payment/index.js +0 -1
- package/dist/payment/index.js.map +1 -1
- package/dist/pg/index.d.ts +1 -1
- package/dist/pg/index.d.ts.map +1 -1
- package/dist/pg/index.js +1 -1
- package/dist/pg/index.js.map +1 -1
- package/dist/product/csv-normalizer.d.ts +43 -0
- package/dist/product/csv-normalizer.d.ts.map +1 -0
- package/dist/product/csv-normalizer.js +382 -0
- package/dist/product/csv-normalizer.js.map +1 -0
- package/dist/product/enums.d.ts +7 -0
- package/dist/product/enums.d.ts.map +1 -0
- package/dist/product/enums.js +11 -0
- package/dist/product/enums.js.map +1 -0
- package/dist/product/events.d.ts +6 -0
- package/dist/product/events.d.ts.map +1 -1
- package/dist/product/events.js +1 -0
- package/dist/product/events.js.map +1 -1
- package/dist/product/get-variant-availability.d.ts +3 -3
- package/dist/product/get-variant-availability.d.ts.map +1 -1
- package/dist/product/get-variant-availability.js +13 -2
- package/dist/product/get-variant-availability.js.map +1 -1
- package/dist/product/index.d.ts +3 -6
- package/dist/product/index.d.ts.map +1 -1
- package/dist/product/index.js +26 -8
- package/dist/product/index.js.map +1 -1
- package/dist/product/validators.d.ts +894 -0
- package/dist/product/validators.d.ts.map +1 -0
- package/dist/product/validators.js +163 -0
- package/dist/product/validators.js.map +1 -0
- package/dist/promotion/index.d.ts +5 -2
- package/dist/promotion/index.d.ts.map +1 -1
- package/dist/promotion/index.js +3 -0
- package/dist/promotion/index.js.map +1 -1
- package/dist/totals/adjustment/index.d.ts +11 -6
- package/dist/totals/adjustment/index.d.ts.map +1 -1
- package/dist/totals/adjustment/index.js +25 -19
- package/dist/totals/adjustment/index.js.map +1 -1
- package/dist/totals/big-number.d.ts +5 -1
- package/dist/totals/big-number.d.ts.map +1 -1
- package/dist/totals/big-number.js +26 -14
- package/dist/totals/big-number.js.map +1 -1
- package/dist/totals/cart/index.d.ts +1 -0
- package/dist/totals/cart/index.d.ts.map +1 -1
- package/dist/totals/cart/index.js +19 -4
- package/dist/totals/cart/index.js.map +1 -1
- package/dist/totals/credit-lines/index.d.ts +3 -3
- package/dist/totals/credit-lines/index.d.ts.map +1 -1
- package/dist/totals/credit-lines/index.js +4 -3
- package/dist/totals/credit-lines/index.js.map +1 -1
- package/dist/totals/line-item/index.d.ts +2 -1
- package/dist/totals/line-item/index.d.ts.map +1 -1
- package/dist/totals/line-item/index.js +42 -18
- package/dist/totals/line-item/index.js.map +1 -1
- package/dist/totals/math.d.ts +4 -2
- package/dist/totals/math.d.ts.map +1 -1
- package/dist/totals/math.js +18 -10
- package/dist/totals/math.js.map +1 -1
- package/dist/totals/promotion/index.d.ts +2 -2
- package/dist/totals/promotion/index.d.ts.map +1 -1
- package/dist/totals/promotion/index.js +46 -26
- package/dist/totals/promotion/index.js.map +1 -1
- package/dist/totals/shipping-method/index.d.ts +1 -0
- package/dist/totals/shipping-method/index.d.ts.map +1 -1
- package/dist/totals/shipping-method/index.js +3 -1
- package/dist/totals/shipping-method/index.js.map +1 -1
- package/dist/totals/tax/index.d.ts +1 -1
- package/dist/totals/tax/index.d.ts.map +1 -1
- package/dist/totals/tax/index.js +0 -3
- package/dist/totals/tax/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -29
- package/dist/common/set-metadata.d.ts +0 -10
- package/dist/common/set-metadata.d.ts.map +0 -1
- package/dist/common/set-metadata.js +0 -37
- package/dist/common/set-metadata.js.map +0 -1
- package/dist/feature-flags/analytics.d.ts +0 -3
- package/dist/feature-flags/analytics.d.ts.map +0 -1
- package/dist/feature-flags/analytics.js +0 -10
- package/dist/feature-flags/analytics.js.map +0 -1
- package/dist/feature-flags/many-to-many-inventory.d.ts +0 -3
- package/dist/feature-flags/many-to-many-inventory.d.ts.map +0 -1
- package/dist/feature-flags/many-to-many-inventory.js +0 -10
- package/dist/feature-flags/many-to-many-inventory.js.map +0 -1
- package/dist/feature-flags/medusa-v2.d.ts +0 -3
- package/dist/feature-flags/medusa-v2.d.ts.map +0 -1
- package/dist/feature-flags/medusa-v2.js +0 -10
- package/dist/feature-flags/medusa-v2.js.map +0 -1
- package/dist/feature-flags/order-editing.d.ts +0 -3
- package/dist/feature-flags/order-editing.d.ts.map +0 -1
- package/dist/feature-flags/order-editing.js +0 -10
- package/dist/feature-flags/order-editing.js.map +0 -1
- package/dist/feature-flags/product-categories.d.ts +0 -3
- package/dist/feature-flags/product-categories.d.ts.map +0 -1
- package/dist/feature-flags/product-categories.js +0 -10
- package/dist/feature-flags/product-categories.js.map +0 -1
- package/dist/feature-flags/publishable-api-keys.d.ts +0 -3
- package/dist/feature-flags/publishable-api-keys.d.ts.map +0 -1
- package/dist/feature-flags/publishable-api-keys.js +0 -10
- package/dist/feature-flags/publishable-api-keys.js.map +0 -1
- package/dist/feature-flags/sales-channels.d.ts +0 -3
- package/dist/feature-flags/sales-channels.d.ts.map +0 -1
- package/dist/feature-flags/sales-channels.js +0 -10
- package/dist/feature-flags/sales-channels.js.map +0 -1
- package/dist/feature-flags/tax-inclusive-pricing.d.ts +0 -3
- package/dist/feature-flags/tax-inclusive-pricing.d.ts.map +0 -1
- package/dist/feature-flags/tax-inclusive-pricing.js +0 -10
- package/dist/feature-flags/tax-inclusive-pricing.js.map +0 -1
- package/dist/feature-flags/utils/flag-router.d.ts.map +0 -1
- package/dist/feature-flags/utils/flag-router.js.map +0 -1
- package/dist/feature-flags/utils/index.d.ts +0 -2
- package/dist/feature-flags/utils/index.d.ts.map +0 -1
- package/dist/feature-flags/utils/index.js.map +0 -1
- package/dist/feature-flags/workflows.d.ts +0 -3
- package/dist/feature-flags/workflows.d.ts.map +0 -1
- package/dist/feature-flags/workflows.js +0 -10
- package/dist/feature-flags/workflows.js.map +0 -1
- package/dist/payment/events.d.ts +0 -5
- package/dist/payment/events.d.ts.map +0 -1
- package/dist/payment/events.js +0 -8
- package/dist/payment/events.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-generate.js","sourceRoot":"","sources":["../../../src/modules-sdk/migration-scripts/migration-generate.ts"],"names":[],"mappings":";;AAgBA,
|
|
1
|
+
{"version":3,"file":"migration-generate.js","sourceRoot":"","sources":["../../../src/modules-sdk/migration-scripts/migration-generate.ts"],"names":[],"mappings":";;AAgBA,oEAmDC;AAlED,mCAAoD;AACpD,gFAAmE;AACnE,iDAA6C;AAC7C,mCAA8C;AAC9C,8DAAsD;AAEtD,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAA;AAE5C;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAAC,EAC3C,UAAU,EACV,MAAM,EACN,gBAAgB,GACjB;IACC;;;;;;OAMG;IACH,OAAO,KAAK,WACV,EAAE,OAAO,EAAE,MAAM,KAAK,EAGrB;QAED,MAAM,KAAK,OAA4B,CAAA;QAEvC,MAAM,CAAC,IAAI,CAAC,IAAI,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+
{"version":3,"file":"migration-up.d.ts","sourceRoot":"","sources":["../../../src/modules-sdk/migration-scripts/migration-up.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAQxE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,UAAU,EAAE,gBAAgB,EAAE;;;CAAA,IAQ5C,uBAGpB,IAAI,CACL,aAAa,CAAC,eAAe,CAAC,8BAA8B,CAAC,EAC7D,SAAS,GAAG,QAAQ,CAChB,mBA8BP"}
|
|
@@ -4,6 +4,7 @@ exports.buildMigrationScript = buildMigrationScript;
|
|
|
4
4
|
const dal_1 = require("../../dal");
|
|
5
5
|
const load_module_database_config_1 = require("../load-module-database-config");
|
|
6
6
|
const migrations_1 = require("../../migrations");
|
|
7
|
+
const errors_1 = require("../../common/errors");
|
|
7
8
|
const TERMINAL_SIZE = process.stdout.columns;
|
|
8
9
|
/**
|
|
9
10
|
* Utility function to build a migration script that will run the migrations.
|
|
@@ -21,8 +22,8 @@ function buildMigrationScript({ moduleName, pathToMigrations }) {
|
|
|
21
22
|
*/
|
|
22
23
|
return async function ({ options, logger, } = {}) {
|
|
23
24
|
logger ??= console;
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
logger.info(new Array(TERMINAL_SIZE).join("-"));
|
|
26
|
+
logger.info("");
|
|
26
27
|
logger.info(`MODULE: ${moduleName}`);
|
|
27
28
|
const dbData = (0, load_module_database_config_1.loadDatabaseConfig)(moduleName, options);
|
|
28
29
|
const orm = await (0, dal_1.mikroOrmCreateConnection)(dbData, [], pathToMigrations);
|
|
@@ -44,6 +45,7 @@ function buildMigrationScript({ moduleName, pathToMigrations }) {
|
|
|
44
45
|
}
|
|
45
46
|
catch (error) {
|
|
46
47
|
logger.error(`Failed with error ${error.message}`, error);
|
|
48
|
+
throw new errors_1.MedusaError(errors_1.MedusaError.Types.DB_ERROR, error.message);
|
|
47
49
|
}
|
|
48
50
|
};
|
|
49
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-up.js","sourceRoot":"","sources":["../../../src/modules-sdk/migration-scripts/migration-up.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"migration-up.js","sourceRoot":"","sources":["../../../src/modules-sdk/migration-scripts/migration-up.ts"],"names":[],"mappings":";;AAcA,oDA4CC;AAzDD,mCAAoD;AACpD,gFAAmE;AACnE,iDAA6C;AAC7C,gDAAiD;AAEjD,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAA;AAE5C;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,EAAE,UAAU,EAAE,gBAAgB,EAAE;IACnE;;;;;;OAMG;IACH,OAAO,KAAK,WAAW,EACrB,OAAO,EACP,MAAM,MAIJ,EAAE;QACJ,MAAM,KAAK,OAA4B,CAAA;QAEvC,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QAC/C,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACf,MAAM,CAAC,IAAI,CAAC,WAAW,UAAU,EAAE,CAAC,CAAA;QAEpC,MAAM,MAAM,GAAG,IAAA,gDAAkB,EAAC,UAAU,EAAE,OAAO,CAAE,CAAA;QACvD,MAAM,GAAG,GAAG,MAAM,IAAA,8BAAwB,EAAC,MAAM,EAAE,EAAE,EAAE,gBAAgB,CAAC,CAAA;QACxE,MAAM,UAAU,GAAG,IAAI,uBAAU,CAAC,GAAG,CAAC,CAAA;QAEtC,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,EAAE;YACvC,MAAM,CAAC,IAAI,CAAC,iBAAiB,SAAS,CAAC,IAAI,EAAE,CAAC,CAAA;QAChD,CAAC,CAAC,CAAA;QACF,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE;YACtC,MAAM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"seed.d.ts","sourceRoot":"","sources":["../../../src/modules-sdk/migration-scripts/seed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAQxE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,WAAW,GACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,gBAAgB,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,GAAG,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,GAAG,CAAA;KACV,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACpB,IACwB,4BAIpB,OAAO,CACR,IAAI,CACF,aAAa,CAAC,eAAe,CAAC,8BAA8B,CAAC,EAC7D,SAAS,GAAG,QAAQ,CACrB,CACF,GAAG;IACF,IAAI,EAAE,MAAM,CAAA;CACb,mBAsCF"}
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.buildSeedScript = buildSeedScript;
|
|
4
4
|
const os_1 = require("os");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
+
const common_1 = require("../../common");
|
|
6
7
|
const dal_1 = require("../../dal");
|
|
7
8
|
const load_module_database_config_1 = require("../load-module-database-config");
|
|
8
|
-
const common_1 = require("../../common");
|
|
9
9
|
/**
|
|
10
10
|
* Utility function to build a seed script that will insert the seed data.
|
|
11
11
|
* @param moduleName
|
|
@@ -21,6 +21,9 @@ function buildSeedScript({ moduleName, models, pathToMigrations, seedHandler, })
|
|
|
21
21
|
logger_.error(`Failed to load seed data from ${path}. Please, provide a relative path and check that you export the following productCategoriesData, productsData, variantsData.${os_1.EOL}${e}`);
|
|
22
22
|
throw e;
|
|
23
23
|
});
|
|
24
|
+
if ((0, common_1.isFileSkipped)(dataSeed)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
24
27
|
const dbData = (0, load_module_database_config_1.loadDatabaseConfig)(moduleName, options);
|
|
25
28
|
const entities = Object.values(models);
|
|
26
29
|
const orm = await (0, dal_1.mikroOrmCreateConnection)(dbData, entities, pathToMigrations);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.js","sourceRoot":"","sources":["../../../src/modules-sdk/migration-scripts/seed.ts"],"names":[],"mappings":";;AAeA,
|
|
1
|
+
{"version":3,"file":"seed.js","sourceRoot":"","sources":["../../../src/modules-sdk/migration-scripts/seed.ts"],"names":[],"mappings":";;AAeA,0CAgEC;AA7ED,2BAAwB;AACxB,+BAA8B;AAC9B,yCAA2D;AAC3D,mCAAoD;AACpD,gFAAmE;AAEnE;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,WAAW,GAUZ;IACC,OAAO,KAAK,WAAW,EACrB,OAAO,EACP,MAAM,EACN,IAAI,GAQL;QACC,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,OAAO,CAAsB,CAAA;QAExD,OAAO,CAAC,IAAI,CAAC,0BAA0B,IAAI,KAAK,CAAC,CAAA;QACjD,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAAC,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CACtE,CAAC,CAAC,EAAE,EAAE;YACJ,OAAO,CAAC,KAAK,CACX,iCAAiC,IAAI,+HAA+H,QAAG,GAAG,CAAC,EAAE,CAC9K,CAAA;YACD,MAAM,CAAC,CAAA;QACT,CAAC,CACF,CAAA;QAED,IAAI,IAAA,sBAAa,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAM;QACR,CAAC;QAED,MAAM,MAAM,GAAG,IAAA,gDAAkB,EAAC,UAAU,EAAE,OAAO,CAAE,CAAA;QACvD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAA8B,CAAA;QAEnE,MAAM,GAAG,GAAG,MAAM,IAAA,8BAAwB,EACxC,MAAM,EACN,QAAQ,EACR,gBAAgB,CACjB,CAAA;QACD,MAAM,OAAO,GAAG,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAA;QAE7B,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,aAAa,UAAU,UAAU,CAAC,CAAA;YAC/C,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;QAC3D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CACX,6DAA6D,MAAM,CAAC,SAAS,IAAI,QAAG,GAAG,CAAC,EAAE,CAC3F,CAAA;QACH,CAAC;QAED,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACvB,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyEntity, EntityClass, EntityClassGroup, EntitySchema, MikroORMOptions } from "@mikro-orm/core";
|
|
1
|
+
import type { AnyEntity, EntityClass, EntityClassGroup, EntitySchema, MikroORMOptions } from "@medusajs/deps/mikro-orm/core";
|
|
2
2
|
import { DmlEntity } from "../dml";
|
|
3
3
|
type Options = Partial<Omit<MikroORMOptions, "entities" | "entitiesTs">> & {
|
|
4
4
|
entities: (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema | DmlEntity<any, any>)[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mikro-orm-cli-config-builder.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/mikro-orm-cli-config-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"mikro-orm-cli-config-builder.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/mikro-orm-cli-config-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAChB,MAAM,+BAA+B,CAAA;AAItC,OAAO,EAAE,SAAS,EAAsB,MAAM,QAAQ,CAAA;AAEtD,KAAK,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,YAAY,CAAC,CAAC,GAAG;IACzE,QAAQ,EAAE,CACN,MAAM,GACN,WAAW,CAAC,SAAS,CAAC,GACtB,gBAAgB,CAAC,SAAS,CAAC,GAC3B,YAAY,GACZ,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CACtB,EAAE,CAAA;CACJ,CAAA;AAED,KAAK,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG;IAChD,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAA;IACrC,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;CAC1C,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,GACf,eAAe,CA+BjB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineMikroOrmCliConfig = defineMikroOrmCliConfig;
|
|
4
|
-
const postgresql_1 = require("@mikro-orm/postgresql");
|
|
4
|
+
const postgresql_1 = require("@medusajs/deps/mikro-orm/postgresql");
|
|
5
5
|
const common_1 = require("../common");
|
|
6
6
|
const dal_1 = require("../dal");
|
|
7
7
|
const dml_1 = require("../dml");
|
|
@@ -34,6 +34,7 @@ function defineMikroOrmCliConfig(moduleName, options) {
|
|
|
34
34
|
generator: dal_1.CustomTsMigrationGenerator,
|
|
35
35
|
...options.migrations,
|
|
36
36
|
},
|
|
37
|
+
extensions: [dal_1.CustomDBMigrator],
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
//# sourceMappingURL=mikro-orm-cli-config-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mikro-orm-cli-config-builder.js","sourceRoot":"","sources":["../../src/modules-sdk/mikro-orm-cli-config-builder.ts"],"names":[],"mappings":";;AAmCA,
|
|
1
|
+
{"version":3,"file":"mikro-orm-cli-config-builder.js","sourceRoot":"","sources":["../../src/modules-sdk/mikro-orm-cli-config-builder.ts"],"names":[],"mappings":";;AAmCA,0DAkCC;AA9DD,oEAAkE;AAClE,sCAAqC;AACrC,gCAAqE;AACrE,gCAAsD;AAiBtD;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CACrC,UAAkB,EAClB,OAAgB;IAEhB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAA;IAC9E,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAS,CAAC,WAAW,CAAC,CAAA;IAClE,MAAM,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAC5C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,CAAC,eAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CACrD,CAAA;IAED,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CACpC,IAAA,wBAAkB,EAAC,WAAW,CAAC,CACD,CAAA;IAEhC,MAAM,oBAAoB,GAAG,IAAA,kBAAS,EAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAA;IACzE,MAAM,YAAY,GAAG,UAAU,oBAAoB,EAAE,CAAA;IAErD,OAAO,IAAA,yBAAY,EAAC;QAClB,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,EAAE;QACZ,GAAI,OAAe;QACnB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;QAClC,UAAU,EAAE;YACV,YAAY,EAAE,aAAa,YAAY,EAAE;YACzC,SAAS,EAAE,gCAA0B;YACrC,GAAG,OAAO,CAAC,UAAU;SACtB;QACD,UAAU,EAAE,CAAC,sBAAgB,CAAC;KAC/B,CAAoB,CAAA;AACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AASxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAExD;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,KAAK,CAAC,WAAW,SAAS,MAAM,EAChC,KAAK,CAAC,OAAO,SAAS,WAAW,CAAC,GAAG,CAAC,EACtC,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,OAAO,SAAS;IAC1E,aAAa,EAAE,GAAG,CAAA;CACnB,GACG,OAAO,CAAC,eAAe,CAAC,GACxB,EAAE,EACN,QAAQ,GAAG,MAAM,YAAY,SAAS,KAAK,GACvC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnB,iBAAiB,CAAC,WAAW,EAAE,YAAY,CAAC,EAEhD,WAAW,EAAE,WAAW,EACxB,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,aAAa,CAAC,OAAO,CAAC,GAC3C,aAAa,CAAC,OAAO,CAAC,GAAG;IAC1B,QAAQ,EAAE,QAAQ,CAAA;CACnB,CA4CA"}
|
|
@@ -25,6 +25,8 @@ function Module(serviceName, { service, loaders }) {
|
|
|
25
25
|
// Thats in the case of manually providing models in custom joiner config.
|
|
26
26
|
// TODO: Add support for non linkable modifier DML object to be skipped from the linkable generation
|
|
27
27
|
const linkableKeys = service.prototype.__joinerConfig().linkableKeys;
|
|
28
|
+
service.prototype.__joinerConfig().idPrefixToEntityName =
|
|
29
|
+
(0, joiner_config_builder_1.buildIdPrefixToEntityNameFromDmlObjects)(dmlObjects.map(([, model]) => model));
|
|
28
30
|
if (dmlObjects.length) {
|
|
29
31
|
linkable = (0, joiner_config_builder_1.buildLinkConfigFromModelObjects)(serviceName, modelObjects, linkableKeys);
|
|
30
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/modules-sdk/module.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/modules-sdk/module.ts"],"names":[],"mappings":";;AAmBA,wBA4DC;AA9ED,gCAAkC;AAClC,mEAKgC;AAChC,qDAAkE;AAGlE;;;;;;;GAOG;AACH,SAAgB,MAAM,CAYpB,WAAwB,EACxB,EAAE,OAAO,EAAE,OAAO,EAA0B;IAI5C,MAAM,YAAY,GAAG,OAAO,CAAC,gDAA+B,CAAC,IAAI,EAAE,CAAA;IAEnE,OAAO,CAAC,SAAS,CAAC,cAAc,KAAK,GAAG,EAAE,CACxC,IAAA,0CAAkB,EAAC,WAAW,EAAE;QAC9B,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM;YACtC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;YAC7B,CAAC,CAAC,SAAS;KACd,CAAC,CAAA;IAEJ,IAAI,QAAQ,GAAG,EAAc,CAAA;IAE7B,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CACnE,eAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAC7B,CAAA;IAED,yFAAyF;IACzF,0EAA0E;IAC1E,oGAAoG;IAEpG,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,YAAY,CAAA;IACpE,OAAO,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,oBAAoB;QACrD,IAAA,+DAAuC,EACrC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAA0B,CAC9D,CAAA;IAEH,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;QACtB,QAAQ,GAAG,IAAA,uDAA+B,EACxC,WAAW,EACX,YAAY,EACZ,YAAY,CACD,CAAA;IACf,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,IAAA,uDAA+B,EACxC,WAAW,EACX,YAAY,CACD,CAAA;IACf,CAAC;IAED,OAAO;QACL,OAAO;QACP,OAAO;QACP,QAAQ;KACT,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules-to-container-types.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/modules-to-container-types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"modules-to-container-types.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/modules-to-container-types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AA6DnD;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC,EACtD,EACE,SAAS,EACT,aAAa,GACd,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;CACtB,iBAmEF"}
|
|
@@ -4,6 +4,7 @@ exports.generateContainerTypes = generateContainerTypes;
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const definition_1 = require("./definition");
|
|
6
6
|
const file_system_1 = require("../common/file-system");
|
|
7
|
+
const to_unix_slash_1 = require("../common/to-unix-slash");
|
|
7
8
|
const to_camel_case_1 = require("../common/to-camel-case");
|
|
8
9
|
const upper_case_first_1 = require("../common/upper-case-first");
|
|
9
10
|
/**
|
|
@@ -56,7 +57,7 @@ const SERVICES_INTERFACES = {
|
|
|
56
57
|
*/
|
|
57
58
|
function normalizeModuleResolvePath(modulePath) {
|
|
58
59
|
return modulePath.startsWith("./") || modulePath.startsWith("../")
|
|
59
|
-
? (0, path_1.join)("../", "../", modulePath)
|
|
60
|
+
? (0, to_unix_slash_1.toUnixSlash)((0, path_1.join)("../", "../", modulePath))
|
|
60
61
|
: modulePath;
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules-to-container-types.js","sourceRoot":"","sources":["../../src/modules-sdk/modules-to-container-types.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"modules-to-container-types.js","sourceRoot":"","sources":["../../src/modules-sdk/modules-to-container-types.ts"],"names":[],"mappings":";;AAmEA,wDA2EC;AA9ID,+BAA2B;AAC3B,6CAAsC;AAEtC,uDAAkD;AAClD,2DAAqD;AACrD,2DAAqD;AACrD,iEAA2D;AAE3D;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG;IAC1B,CAAC,oBAAO,CAAC,IAAI,CAAC,EAAE,oBAAoB;IACpC,CAAC,oBAAO,CAAC,KAAK,CAAC,EAAE,eAAe;IAChC,CAAC,oBAAO,CAAC,IAAI,CAAC,EAAE,oBAAoB;IACpC,CAAC,oBA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,iCAAc,EAAC,IAAA,2BAAW,EAAC,GAAG,CAAC,CAAC,CAAA;YAEpD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,WAAW,UAAU,WAAW,GAAG,CAAC,CAAA;YACvE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAClB,GAAG,YAAY,0BAA0B,WAAW,eAAe,CACpE,CAAA;QACH,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAA;IACf,CAAC,EACD;QACE,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,EAAE;KAIb,CACF,CAAA;IAED,MAAM,UAAU,GAAG,IAAI,wBAAU,CAAC,SAAS,CAAC,CAAA;IAC5C,MAAM,QAAQ,GAAG,uBAAuB,CAAA;IACxC,MAAM,YAAY,GAAG,GAAG,OAAO,CAAC,IAAI,CAClC,IAAI,CACL;cACW,aAAa;MACrB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;;EAE5B,CAAA;IAEA,MAAM,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;AACjD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
type
|
|
1
|
+
type QueryContexFnType = {
|
|
2
2
|
(query: Record<string, unknown>): Record<string, unknown>;
|
|
3
3
|
isQueryContext: (obj: any) => boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare const QueryContext:
|
|
5
|
+
export declare const QueryContext: QueryContexFnType;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=query-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-context.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/query-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query-context.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/query-context.ts"],"names":[],"mappings":"AAEA,KAAK,iBAAiB,GAAG;IACvB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzD,cAAc,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAA;CACtC,CAAA;AAeD,eAAO,MAAM,YAAY,EAAE,iBAAkC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-context.js","sourceRoot":"","sources":["../../src/modules-sdk/query-context.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"query-context.js","sourceRoot":"","sources":["../../src/modules-sdk/query-context.ts"],"names":[],"mappings":";;;AAOA,MAAM,MAAM,GAAG,cAAc,CAAA;AAE7B,SAAS,cAAc,CAAC,KAA8B;IACpD,OAAO;QACL,GAAG,KAAK;QACR,MAAM;KACP,CAAA;AACH,CAAC;AAED,cAAc,CAAC,cAAc,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC3C,OAAO,GAAG,CAAC,MAAM,KAAK,MAAM,CAAA;AAC9B,CAAC,CAAA;AAEY,QAAA,YAAY,GAAsB,cAAc,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Constructor, Context, FindConfig, IDmlEntity, Pluralize, Prettify, RestoreReturn, SoftDeleteReturn
|
|
1
|
+
import { Constructor, Context, FindConfig, IDmlEntity, InferEntityForModuleService, InferEntityType, Pluralize, Prettify, RestoreReturn, SoftDeleteReturn } from "@medusajs/types";
|
|
2
|
+
import { EventArgs } from "@mikro-orm/core";
|
|
2
3
|
import { DmlEntity } from "../../dml";
|
|
3
4
|
export type BaseMethods = "retrieve" | "list" | "listAndCount" | "delete" | "softDelete" | "restore" | "create" | "update";
|
|
4
5
|
export type ModelDTOConfig = {
|
|
@@ -135,6 +136,19 @@ export type MedusaServiceReturnType<ModelsConfig extends Record<string, any>> =
|
|
|
135
136
|
}[];
|
|
136
137
|
context: Context;
|
|
137
138
|
}): void;
|
|
139
|
+
/**
|
|
140
|
+
* this method is meant to react to any event the orm might emit
|
|
141
|
+
* when an entity is being mutated (created, updated, deleted).
|
|
142
|
+
* The default implementation will handle all event to be emitted as part
|
|
143
|
+
* of the message aggregator from the context.
|
|
144
|
+
*
|
|
145
|
+
* If you want to handle the event differently, you can override this method.
|
|
146
|
+
*
|
|
147
|
+
* @param event - The event type
|
|
148
|
+
* @param args - The event arguments
|
|
149
|
+
* @param context - The context
|
|
150
|
+
*/
|
|
151
|
+
interceptEntityMutationEvents(event: "afterCreate" | "afterUpdate" | "afterUpsert" | "afterDelete", args: EventArgs<any>, context: Context): void;
|
|
138
152
|
};
|
|
139
153
|
export {};
|
|
140
154
|
//# sourceMappingURL=medusa-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"medusa-service.d.ts","sourceRoot":"","sources":["../../../src/modules-sdk/types/medusa-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,aAAa,EACb,gBAAgB,
|
|
1
|
+
{"version":3,"file":"medusa-service.d.ts","sourceRoot":"","sources":["../../../src/modules-sdk/types/medusa-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,UAAU,EACV,2BAA2B,EAC3B,eAAe,EACf,SAAS,EACT,QAAQ,EACR,aAAa,EACb,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,MAAM,GACN,cAAc,GACd,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC3B,MAAM,CAAC,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AAa,EACpE,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,EACpB,OAAO,EAAE,OAAO,GACf,IAAI,CAAA;CACR,CAAA"}
|
|
@@ -10,11 +10,12 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
10
10
|
protected readonly container: Record<string, unknown>;
|
|
11
11
|
/**
|
|
12
12
|
* This method validates the options of the provider set in `medusa-config.ts`.
|
|
13
|
-
* Implementing this method is optional
|
|
13
|
+
* Implementing this method is optional, but it's useful to ensure that the required
|
|
14
|
+
* options are passed to the provider, or if you have any custom validation logic.
|
|
14
15
|
*
|
|
15
16
|
* If the options aren't valid, throw an error.
|
|
16
17
|
*
|
|
17
|
-
* @param options - The provider's options.
|
|
18
|
+
* @param options - The provider's options passed in `medusa-config.ts`.
|
|
18
19
|
*
|
|
19
20
|
* @example
|
|
20
21
|
* class MyPaymentProviderService extends AbstractPaymentProvider<Options> {
|
|
@@ -33,13 +34,15 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
33
34
|
* The constructor allows you to access resources from the [module's container](https://docs.medusajs.com/learn/fundamentals/modules/container)
|
|
34
35
|
* using the first parameter, and the module's options using the second parameter.
|
|
35
36
|
*
|
|
37
|
+
* If you're creating a client or establishing a connection with a third-party service, do it in the constructor.
|
|
38
|
+
*
|
|
36
39
|
* :::note
|
|
37
40
|
*
|
|
38
41
|
* A module's options are passed when you register it in the Medusa application.
|
|
39
42
|
*
|
|
40
43
|
* :::
|
|
41
44
|
*
|
|
42
|
-
* @param {Record<string, unknown>} cradle - The module's container
|
|
45
|
+
* @param {Record<string, unknown>} cradle - The module's container used to resolve resources.
|
|
43
46
|
* @param {Record<string, unknown>} config - The options passed to the Payment Module provider.
|
|
44
47
|
* @typeParam TConfig - The type of the provider's options passed as a second parameter.
|
|
45
48
|
*
|
|
@@ -111,13 +114,24 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
111
114
|
*/
|
|
112
115
|
getIdentifier(): string;
|
|
113
116
|
/**
|
|
114
|
-
* This method
|
|
117
|
+
* This method captures a payment using the third-party provider. In this method, use the third-party provider to capture the payment.
|
|
118
|
+
*
|
|
119
|
+
* When an order is placed, the payment is authorized using the {@link authorizePayment} method. Then, the admin
|
|
120
|
+
* user can capture the payment, which triggers this method.
|
|
121
|
+
*
|
|
122
|
+
* 
|
|
123
|
+
*
|
|
124
|
+
* This method can also be triggered by a webhook event if the {@link getWebhookActionAndData} method returns the action `captured`.
|
|
115
125
|
*
|
|
116
|
-
*
|
|
117
|
-
* - The merchant requests to capture the payment after its associated payment session was authorized.
|
|
118
|
-
* - A webhook event occurred that instructs the payment provider to capture the payment session. Learn more about handing webhook events in [this guide](https://docs.medusajs.com/resources/commerce-modules/payment/webhook-events).
|
|
126
|
+
* #### Understanding `data` property
|
|
119
127
|
*
|
|
120
|
-
*
|
|
128
|
+
* The `data` property of the input parameter contains data that was previously stored in the Payment record's `data` property, which was
|
|
129
|
+
* returned by the {@link authorizePayment} method.
|
|
130
|
+
*
|
|
131
|
+
* The `data` property returned by this method is then stored in the `Payment` record. You can store data relevant to later refund or process the payment.
|
|
132
|
+
* For example, you can store the ID of the payment in the third-party provider to reference it later.
|
|
133
|
+
*
|
|
134
|
+
* 
|
|
121
135
|
*
|
|
122
136
|
* @param input - The input to capture the payment. The `data` field should contain the data from the payment provider. when the payment was created.
|
|
123
137
|
* @returns The new data to store in the payment's `data` property. Throws in case of an error.
|
|
@@ -139,20 +153,42 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
139
153
|
*
|
|
140
154
|
* // assuming you have a client that captures the payment
|
|
141
155
|
* const newData = await this.client.capturePayment(externalId)
|
|
142
|
-
* return {
|
|
156
|
+
* return {
|
|
157
|
+
* data: {
|
|
158
|
+
* ...newData,
|
|
159
|
+
* id: externalId,
|
|
160
|
+
* }
|
|
161
|
+
* }
|
|
143
162
|
* }
|
|
144
163
|
* // ...
|
|
145
164
|
* }
|
|
146
165
|
*/
|
|
147
166
|
abstract capturePayment(input: CapturePaymentInput): Promise<CapturePaymentOutput>;
|
|
148
167
|
/**
|
|
149
|
-
* This method authorizes a payment session
|
|
150
|
-
*
|
|
168
|
+
* This method authorizes a payment session using the third-party payment provider.
|
|
169
|
+
*
|
|
170
|
+
* During checkout, the customer may need to perform actions required by the payment provider,
|
|
171
|
+
* such as entering their card details or confirming the payment. Once that is done,
|
|
172
|
+
* the customer can place their order.
|
|
173
|
+
*
|
|
174
|
+
* During cart-completion before placing the order, this method is used to authorize the cart's payment session with the
|
|
175
|
+
* third-party payment provider. The payment can later be captured
|
|
176
|
+
* using the {@link capturePayment} method.
|
|
177
|
+
*
|
|
178
|
+
* 
|
|
179
|
+
*
|
|
180
|
+
* When authorized successfully, a `Payment` is created by the Payment
|
|
181
|
+
* Module, and it's associated with the order.
|
|
151
182
|
*
|
|
152
|
-
*
|
|
153
|
-
* to learn more about how this fits into the payment flow and how to handle required actions.
|
|
183
|
+
* #### Understanding `data` property
|
|
154
184
|
*
|
|
155
|
-
*
|
|
185
|
+
* The `data` property of the method's parameter contains the `PaymentSession` record's `data` property, which was
|
|
186
|
+
* returned by the {@link initiatePayment} method.
|
|
187
|
+
*
|
|
188
|
+
* The `data` property returned by this method is then stored in the created `Payment` record. You can store data relevant to later capture or process the payment.
|
|
189
|
+
* For example, you can store the ID of the payment in the third-party provider to reference it later.
|
|
190
|
+
*
|
|
191
|
+
* 
|
|
156
192
|
*
|
|
157
193
|
* @param input - The input to authorize the payment. The `data` field should contain the data from the payment provider. when the payment was created.
|
|
158
194
|
* @returns The status of the authorization, along with the `data` field about the payment. Throws in case of an error.
|
|
@@ -188,7 +224,18 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
188
224
|
*/
|
|
189
225
|
abstract authorizePayment(input: AuthorizePaymentInput): Promise<AuthorizePaymentOutput>;
|
|
190
226
|
/**
|
|
191
|
-
* This method cancels a payment.
|
|
227
|
+
* This method cancels a payment in the third-party payment provider. It's used when
|
|
228
|
+
* the admin user cancels an order. The order can only be canceled if the payment
|
|
229
|
+
* is not captured yet.
|
|
230
|
+
*
|
|
231
|
+
* #### Understanding `data` property
|
|
232
|
+
*
|
|
233
|
+
* The `data` property of the method's parameter contains the `Payment` record's `data` property, which was
|
|
234
|
+
* returned by the {@link authorizePayment} method.
|
|
235
|
+
*
|
|
236
|
+
* The `data` property returned by this method is then stored in the `Payment` record. You can store data relevant for any further processing of the payment.
|
|
237
|
+
*
|
|
238
|
+
* 
|
|
192
239
|
*
|
|
193
240
|
* @param input - The input to cancel the payment. The `data` field should contain the data from the payment provider. when the payment was created.
|
|
194
241
|
* @returns The new data to store in the payment's `data` property, if any. Throws in case of an error.
|
|
@@ -219,8 +266,28 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
219
266
|
*/
|
|
220
267
|
abstract cancelPayment(input: CancelPaymentInput): Promise<CancelPaymentOutput>;
|
|
221
268
|
/**
|
|
222
|
-
* This method
|
|
223
|
-
*
|
|
269
|
+
* This method initializes a payment session with the third-party payment provider.
|
|
270
|
+
*
|
|
271
|
+
* When a customer chooses a payment method during checkout, this method is triggered to
|
|
272
|
+
* perform any initialization action with the third-party provider, such as creating a payment session.
|
|
273
|
+
*
|
|
274
|
+
* 
|
|
275
|
+
*
|
|
276
|
+
* #### Understanding `data` property
|
|
277
|
+
*
|
|
278
|
+
* The `data` property returned by this method will be stored in the created `PaymentSession` record. You can store data relevant to later authorize or process the payment.
|
|
279
|
+
* For example, you can store the ID of the payment session in the third-party provider to reference it later.
|
|
280
|
+
*
|
|
281
|
+
* The `data` property is also available to storefronts, allowing you to store data necessary for the storefront to integrate
|
|
282
|
+
* the payment provider in the checkout flow. For example, you can store the client token to use with the payment provider's SDK.
|
|
283
|
+
*
|
|
284
|
+
* :::note
|
|
285
|
+
*
|
|
286
|
+
* This also means you shouldn't store sensitive data and tokens in the `data` property, as it's publicly accessible.
|
|
287
|
+
*
|
|
288
|
+
* :::
|
|
289
|
+
*
|
|
290
|
+
* 
|
|
224
291
|
*
|
|
225
292
|
* @param input - The input to create the payment session.
|
|
226
293
|
* @returns The new data to store in the payment's `data` property. Throws in case of an error.
|
|
@@ -251,7 +318,7 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
251
318
|
* )
|
|
252
319
|
*
|
|
253
320
|
* return {
|
|
254
|
-
* id: response.id
|
|
321
|
+
* id: response.id,
|
|
255
322
|
* data: response,
|
|
256
323
|
* }
|
|
257
324
|
* }
|
|
@@ -261,9 +328,22 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
261
328
|
*/
|
|
262
329
|
abstract initiatePayment(input: InitiatePaymentInput): Promise<InitiatePaymentOutput>;
|
|
263
330
|
/**
|
|
264
|
-
* This method
|
|
331
|
+
* This method deletes a payment session in the third-party payment provider.
|
|
332
|
+
*
|
|
333
|
+
* When a customer chooses a payment method during checkout, then chooses a different one,
|
|
334
|
+
* this method is triggered to delete the previous payment session.
|
|
335
|
+
*
|
|
336
|
+
* If your provider doesn't support deleting a payment session, you can just return an empty object or
|
|
337
|
+
* an object that contains the same received `data` property.
|
|
338
|
+
*
|
|
339
|
+
* 
|
|
265
340
|
*
|
|
266
|
-
*
|
|
341
|
+
* #### Understanding `data` property
|
|
342
|
+
*
|
|
343
|
+
* The `data` property of the method's parameter contains the `PaymentSession` record's `data` property, which was
|
|
344
|
+
* returned by the {@link initiatePayment} method.
|
|
345
|
+
*
|
|
346
|
+
* 
|
|
267
347
|
*
|
|
268
348
|
* @param input - The input to delete the payment session. The `data` field should contain the data from the payment provider. when the payment was created.
|
|
269
349
|
* @returns The new data to store in the payment's `data` property, if any. Throws in case of an error.
|
|
@@ -286,8 +366,9 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
286
366
|
*
|
|
287
367
|
* // assuming you have a client that cancels the payment
|
|
288
368
|
* await this.client.cancelPayment(externalId)
|
|
289
|
-
* return {
|
|
290
|
-
*
|
|
369
|
+
* return {
|
|
370
|
+
* data: input.data
|
|
371
|
+
* }
|
|
291
372
|
* }
|
|
292
373
|
*
|
|
293
374
|
* // ...
|
|
@@ -337,7 +418,25 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
337
418
|
*/
|
|
338
419
|
abstract getPaymentStatus(input: GetPaymentStatusInput): Promise<GetPaymentStatusOutput>;
|
|
339
420
|
/**
|
|
340
|
-
* This method refunds an amount
|
|
421
|
+
* This method refunds an amount using the third-party payment provider. This method
|
|
422
|
+
* is triggered when the admin user refunds a payment of an order.
|
|
423
|
+
*
|
|
424
|
+
* #### Understanding `data` property
|
|
425
|
+
*
|
|
426
|
+
* The `data` property of the method's parameter contains the `Payment` record's `data` property, which was
|
|
427
|
+
* returned by the {@link capturePayment} or {@link refundPayment} method.
|
|
428
|
+
*
|
|
429
|
+
* The `data` property returned by this method is then stored in the `Payment` record. You can store data relevant to later refund or process the payment.
|
|
430
|
+
* For example, you can store the ID of the payment in the third-party provider to reference it later.
|
|
431
|
+
*
|
|
432
|
+
* :::note
|
|
433
|
+
*
|
|
434
|
+
* A payment may be refunded multiple times with different amounts. In this case, the `data` property
|
|
435
|
+
* of the input parameter contains the data from the last refund.
|
|
436
|
+
*
|
|
437
|
+
* :::
|
|
438
|
+
*
|
|
439
|
+
* 
|
|
341
440
|
*
|
|
342
441
|
* @param input - The input to refund the payment. The `data` field should contain the data from the payment provider. when the payment was created.
|
|
343
442
|
* @returns The new data to store in the payment's `data` property, or an error object.
|
|
@@ -364,14 +463,16 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
364
463
|
* input.amount
|
|
365
464
|
* )
|
|
366
465
|
*
|
|
367
|
-
* return {
|
|
466
|
+
* return {
|
|
467
|
+
* data: input.data,
|
|
468
|
+
* }
|
|
368
469
|
* }
|
|
369
470
|
* // ...
|
|
370
471
|
* }
|
|
371
472
|
*/
|
|
372
473
|
abstract refundPayment(input: RefundPaymentInput): Promise<RefundPaymentOutput>;
|
|
373
474
|
/**
|
|
374
|
-
*
|
|
475
|
+
* This method retrieves the payment's data from the third-party payment provider.
|
|
375
476
|
*
|
|
376
477
|
* @param input - The input to retrieve the payment. The `data` field should contain the data from the payment provider when the payment was created.
|
|
377
478
|
* @returns The payment's data as found in the the payment provider.
|
|
@@ -400,7 +501,7 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
400
501
|
*/
|
|
401
502
|
abstract retrievePayment(input: RetrievePaymentInput): Promise<RetrievePaymentOutput>;
|
|
402
503
|
/**
|
|
403
|
-
*
|
|
504
|
+
* This method updates a payment in the third-party service that was previously initiated with the {@link initiatePayment} method.
|
|
404
505
|
*
|
|
405
506
|
* @param input - The input to update the payment. The `data` field should contain the data from the payment provider. when the payment was created.
|
|
406
507
|
* @returns The new data to store in the payment's `data` property. Throws in case of an error.
|
|
@@ -433,7 +534,7 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
433
534
|
* {
|
|
434
535
|
* amount,
|
|
435
536
|
* currency_code,
|
|
436
|
-
* context.customer
|
|
537
|
+
* customer: context.customer
|
|
437
538
|
* }
|
|
438
539
|
* )
|
|
439
540
|
*
|
|
@@ -445,14 +546,16 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
445
546
|
*/
|
|
446
547
|
abstract updatePayment(input: UpdatePaymentInput): Promise<UpdatePaymentOutput>;
|
|
447
548
|
/**
|
|
448
|
-
* This method is executed when a webhook event is received from the third-party payment provider.
|
|
449
|
-
* to
|
|
549
|
+
* This method is executed when a webhook event is received from the third-party payment provider. Medusa uses
|
|
550
|
+
* the data returned by this method to perform actions in the Medusa application, such as completing the associated cart
|
|
551
|
+
* if the payment was authorized successfully.
|
|
450
552
|
*
|
|
451
|
-
* Learn more in [
|
|
553
|
+
* Learn more in the [Webhook Events](https://docs.medusajs.com/resources/commerce-modules/payment/webhook-events) documentation.
|
|
452
554
|
*
|
|
453
555
|
* @param data - The webhook event's data
|
|
454
556
|
* @returns The webhook result. If the `action`'s value is `captured`, the payment is captured within Medusa as well.
|
|
455
|
-
* If the `action`'s value is `authorized`, the associated payment session is authorized within Medusa
|
|
557
|
+
* If the `action`'s value is `authorized`, the associated payment session is authorized within Medusa and the associated cart
|
|
558
|
+
* will be completed to create an order.
|
|
456
559
|
*
|
|
457
560
|
* @example
|
|
458
561
|
* // other imports...
|
|
@@ -483,6 +586,8 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
483
586
|
* return {
|
|
484
587
|
* action: "authorized",
|
|
485
588
|
* data: {
|
|
589
|
+
* // assuming the session_id is stored in the metadata of the payment
|
|
590
|
+
* // in the third-party provider
|
|
486
591
|
* session_id: (data.metadata as Record<string, any>).session_id,
|
|
487
592
|
* amount: new BigNumber(data.amount as number)
|
|
488
593
|
* }
|
|
@@ -491,19 +596,27 @@ export declare abstract class AbstractPaymentProvider<TConfig = Record<string, u
|
|
|
491
596
|
* return {
|
|
492
597
|
* action: "captured",
|
|
493
598
|
* data: {
|
|
599
|
+
* // assuming the session_id is stored in the metadata of the payment
|
|
600
|
+
* // in the third-party provider
|
|
494
601
|
* session_id: (data.metadata as Record<string, any>).session_id,
|
|
495
602
|
* amount: new BigNumber(data.amount as number)
|
|
496
603
|
* }
|
|
497
604
|
* }
|
|
498
605
|
* default:
|
|
499
606
|
* return {
|
|
500
|
-
* action: "not_supported"
|
|
607
|
+
* action: "not_supported",
|
|
608
|
+
* data: {
|
|
609
|
+
* session_id: "",
|
|
610
|
+
* amount: new BigNumber(0)
|
|
611
|
+
* }
|
|
501
612
|
* }
|
|
502
613
|
* }
|
|
503
614
|
* } catch (e) {
|
|
504
615
|
* return {
|
|
505
616
|
* action: "failed",
|
|
506
617
|
* data: {
|
|
618
|
+
* // assuming the session_id is stored in the metadata of the payment
|
|
619
|
+
* // in the third-party provider
|
|
507
620
|
* session_id: (data.metadata as Record<string, any>).session_id,
|
|
508
621
|
* amount: new BigNumber(data.amount as number)
|
|
509
622
|
* }
|