@unifiedcommerce/core 0.0.1 → 0.0.2
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/auth/access.d.ts +1 -1
- package/dist/auth/access.d.ts.map +1 -1
- package/dist/auth/auth-schema.js +3 -3
- package/dist/auth/middleware.d.ts +2 -2
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +37 -10
- package/dist/auth/org.js +1 -1
- package/dist/auth/permissions.d.ts +1 -1
- package/dist/auth/permissions.d.ts.map +1 -1
- package/dist/auth/permissions.js +1 -1
- package/dist/auth/setup.d.ts +19 -10
- package/dist/auth/setup.d.ts.map +1 -1
- package/dist/auth/setup.js +3 -4
- package/dist/auth/system-actor.d.ts +1 -1
- package/dist/auth/system-actor.d.ts.map +1 -1
- package/dist/auth/system-actor.js +1 -1
- package/dist/config/defaults.d.ts +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/define-config.d.ts +1 -1
- package/dist/config/define-config.d.ts.map +1 -1
- package/dist/config/define-config.js +2 -2
- package/dist/config/types.d.ts +11 -11
- package/dist/config/types.d.ts.map +1 -1
- package/dist/hooks/checkout-completion.d.ts +2 -2
- package/dist/hooks/checkout-completion.d.ts.map +1 -1
- package/dist/hooks/checkout-completion.js +2 -2
- package/dist/hooks/checkout.d.ts +3 -3
- package/dist/hooks/checkout.d.ts.map +1 -1
- package/dist/hooks/checkout.js +3 -3
- package/dist/hooks/order-emails.d.ts +1 -1
- package/dist/hooks/order-emails.d.ts.map +1 -1
- package/dist/index.d.ts +81 -81
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -13381
- package/dist/interfaces/mcp/context-enrichment.d.ts +2 -2
- package/dist/interfaces/mcp/context-enrichment.d.ts.map +1 -1
- package/dist/interfaces/mcp/context-enrichment.js +1 -1
- package/dist/interfaces/mcp/server.d.ts +2 -2
- package/dist/interfaces/mcp/server.d.ts.map +1 -1
- package/dist/interfaces/mcp/server.js +3 -3
- package/dist/interfaces/mcp/transport.d.ts +2 -2
- package/dist/interfaces/mcp/transport.d.ts.map +1 -1
- package/dist/interfaces/mcp/transport.js +1 -1
- package/dist/interfaces/rest/customer-portal.d.ts +2 -2
- package/dist/interfaces/rest/customer-portal.d.ts.map +1 -1
- package/dist/interfaces/rest/customer-portal.js +3 -3
- package/dist/interfaces/rest/index.d.ts +2 -2
- package/dist/interfaces/rest/index.d.ts.map +1 -1
- package/dist/interfaces/rest/index.js +13 -13
- package/dist/interfaces/rest/router.d.ts +1 -1
- package/dist/interfaces/rest/router.d.ts.map +1 -1
- package/dist/interfaces/rest/router.js +4 -4
- package/dist/interfaces/rest/routes/admin-jobs.d.ts +2 -2
- package/dist/interfaces/rest/routes/admin-jobs.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/admin-jobs.js +4 -4
- package/dist/interfaces/rest/routes/audit.d.ts +2 -2
- package/dist/interfaces/rest/routes/audit.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/audit.js +3 -3
- package/dist/interfaces/rest/routes/carts.d.ts +2 -2
- package/dist/interfaces/rest/routes/carts.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/carts.js +2 -2
- package/dist/interfaces/rest/routes/catalog.d.ts +2 -2
- package/dist/interfaces/rest/routes/catalog.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/catalog.js +2 -2
- package/dist/interfaces/rest/routes/checkout.d.ts +2 -2
- package/dist/interfaces/rest/routes/checkout.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/checkout.js +7 -7
- package/dist/interfaces/rest/routes/inventory.d.ts +2 -2
- package/dist/interfaces/rest/routes/inventory.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/inventory.js +2 -2
- package/dist/interfaces/rest/routes/media.d.ts +2 -2
- package/dist/interfaces/rest/routes/media.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/media.js +2 -2
- package/dist/interfaces/rest/routes/orders.d.ts +2 -2
- package/dist/interfaces/rest/routes/orders.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/orders.js +2 -2
- package/dist/interfaces/rest/routes/payments.d.ts +2 -2
- package/dist/interfaces/rest/routes/payments.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/payments.js +2 -2
- package/dist/interfaces/rest/routes/pricing.d.ts +2 -2
- package/dist/interfaces/rest/routes/pricing.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/pricing.js +2 -2
- package/dist/interfaces/rest/routes/promotions.d.ts +2 -2
- package/dist/interfaces/rest/routes/promotions.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/promotions.js +3 -3
- package/dist/interfaces/rest/routes/search.d.ts +2 -2
- package/dist/interfaces/rest/routes/search.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/search.js +2 -2
- package/dist/interfaces/rest/routes/webhooks.d.ts +2 -2
- package/dist/interfaces/rest/routes/webhooks.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/webhooks.js +2 -2
- package/dist/interfaces/rest/schemas/admin-jobs.js +1 -1
- package/dist/interfaces/rest/schemas/carts.d.ts +1 -1
- package/dist/interfaces/rest/schemas/carts.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/carts.js +3 -3
- package/dist/interfaces/rest/schemas/catalog.js +3 -3
- package/dist/interfaces/rest/schemas/checkout.js +1 -1
- package/dist/interfaces/rest/schemas/customer-portal.js +2 -2
- package/dist/interfaces/rest/schemas/inventory.d.ts +1 -1
- package/dist/interfaces/rest/schemas/inventory.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/inventory.js +2 -2
- package/dist/interfaces/rest/schemas/media.js +1 -1
- package/dist/interfaces/rest/schemas/orders.js +2 -2
- package/dist/interfaces/rest/schemas/pricing.d.ts +1 -1
- package/dist/interfaces/rest/schemas/pricing.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/pricing.js +2 -2
- package/dist/interfaces/rest/schemas/promotions.d.ts +1 -1
- package/dist/interfaces/rest/schemas/promotions.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/promotions.js +2 -2
- package/dist/interfaces/rest/schemas/responses.js +5 -5
- package/dist/interfaces/rest/schemas/search.js +1 -1
- package/dist/interfaces/rest/schemas/webhooks.js +1 -1
- package/dist/interfaces/rest/utils.d.ts +2 -2
- package/dist/interfaces/rest/utils.d.ts.map +1 -1
- package/dist/interfaces/rest/utils.js +2 -2
- package/dist/interfaces/rest/webhook-router.d.ts +1 -1
- package/dist/interfaces/rest/webhook-router.d.ts.map +1 -1
- package/dist/kernel/compensation/executor.d.ts +2 -2
- package/dist/kernel/compensation/executor.d.ts.map +1 -1
- package/dist/kernel/compensation/types.d.ts +3 -3
- package/dist/kernel/compensation/types.d.ts.map +1 -1
- package/dist/kernel/database/drizzle-db.d.ts +1 -1
- package/dist/kernel/database/drizzle-db.d.ts.map +1 -1
- package/dist/kernel/database/drizzle-db.js +1 -1
- package/dist/kernel/database/migrate.d.ts +2 -2
- package/dist/kernel/database/migrate.d.ts.map +1 -1
- package/dist/kernel/database/migrate.js +1 -1
- package/dist/kernel/database/schema.d.ts +13 -13
- package/dist/kernel/database/schema.d.ts.map +1 -1
- package/dist/kernel/database/schema.js +13 -13
- package/dist/kernel/database/tx-context.d.ts +2 -2
- package/dist/kernel/database/tx-context.d.ts.map +1 -1
- package/dist/kernel/error-mapper.js +1 -1
- package/dist/kernel/factory/repository-factory.d.ts +2 -2
- package/dist/kernel/factory/repository-factory.d.ts.map +1 -1
- package/dist/kernel/factory/repository-factory.js +1 -1
- package/dist/kernel/hooks/create-context.d.ts +4 -4
- package/dist/kernel/hooks/create-context.d.ts.map +1 -1
- package/dist/kernel/hooks/create-context.js +1 -1
- package/dist/kernel/hooks/executor.d.ts +1 -1
- package/dist/kernel/hooks/executor.d.ts.map +1 -1
- package/dist/kernel/hooks/types.d.ts +3 -3
- package/dist/kernel/hooks/types.d.ts.map +1 -1
- package/dist/kernel/http-error.d.ts +1 -1
- package/dist/kernel/http-error.d.ts.map +1 -1
- package/dist/kernel/jobs/drizzle-adapter.d.ts +3 -3
- package/dist/kernel/jobs/drizzle-adapter.d.ts.map +1 -1
- package/dist/kernel/jobs/drizzle-adapter.js +2 -2
- package/dist/kernel/jobs/runner.d.ts +3 -3
- package/dist/kernel/jobs/runner.d.ts.map +1 -1
- package/dist/kernel/jobs/runner.js +1 -1
- package/dist/kernel/jobs/schema.js +1 -1
- package/dist/kernel/jobs/types.d.ts +2 -2
- package/dist/kernel/jobs/types.d.ts.map +1 -1
- package/dist/kernel/local-api.d.ts +21 -21
- package/dist/kernel/local-api.d.ts.map +1 -1
- package/dist/kernel/plugin/manifest.d.ts +1 -1
- package/dist/kernel/plugin/manifest.d.ts.map +1 -1
- package/dist/kernel/query/executor.d.ts +1 -1
- package/dist/kernel/query/executor.d.ts.map +1 -1
- package/dist/kernel/query/executor.js +1 -1
- package/dist/kernel/result.d.ts +1 -1
- package/dist/kernel/result.d.ts.map +1 -1
- package/dist/kernel/state-machine/machine.js +1 -1
- package/dist/modules/analytics/drizzle-adapter.d.ts +3 -3
- package/dist/modules/analytics/drizzle-adapter.d.ts.map +1 -1
- package/dist/modules/analytics/drizzle-adapter.js +2 -2
- package/dist/modules/analytics/models.d.ts +1 -1
- package/dist/modules/analytics/models.d.ts.map +1 -1
- package/dist/modules/analytics/repository/index.d.ts +1 -1
- package/dist/modules/analytics/repository/index.d.ts.map +1 -1
- package/dist/modules/analytics/service.d.ts +4 -4
- package/dist/modules/analytics/service.d.ts.map +1 -1
- package/dist/modules/analytics/service.js +2 -2
- package/dist/modules/analytics/types.d.ts +1 -1
- package/dist/modules/analytics/types.d.ts.map +1 -1
- package/dist/modules/audit/hooks.d.ts +1 -1
- package/dist/modules/audit/hooks.d.ts.map +1 -1
- package/dist/modules/audit/schema.js +1 -1
- package/dist/modules/audit/service.d.ts +4 -4
- package/dist/modules/audit/service.d.ts.map +1 -1
- package/dist/modules/audit/service.js +2 -2
- package/dist/modules/cart/access.d.ts +2 -2
- package/dist/modules/cart/access.d.ts.map +1 -1
- package/dist/modules/cart/matcher.d.ts +1 -1
- package/dist/modules/cart/matcher.d.ts.map +1 -1
- package/dist/modules/cart/repository/index.d.ts +3 -3
- package/dist/modules/cart/repository/index.d.ts.map +1 -1
- package/dist/modules/cart/repository/index.js +1 -1
- package/dist/modules/cart/schema.js +2 -2
- package/dist/modules/cart/service.d.ts +10 -10
- package/dist/modules/cart/service.d.ts.map +1 -1
- package/dist/modules/cart/service.js +8 -8
- package/dist/modules/catalog/repository/index.d.ts +3 -3
- package/dist/modules/catalog/repository/index.d.ts.map +1 -1
- package/dist/modules/catalog/repository/index.js +1 -1
- package/dist/modules/catalog/schema.js +1 -1
- package/dist/modules/catalog/service.d.ts +9 -9
- package/dist/modules/catalog/service.d.ts.map +1 -1
- package/dist/modules/catalog/service.js +8 -8
- package/dist/modules/customers/repository/index.d.ts +3 -3
- package/dist/modules/customers/repository/index.d.ts.map +1 -1
- package/dist/modules/customers/repository/index.js +1 -1
- package/dist/modules/customers/schema.js +1 -1
- package/dist/modules/customers/service.d.ts +4 -4
- package/dist/modules/customers/service.d.ts.map +1 -1
- package/dist/modules/customers/service.js +3 -3
- package/dist/modules/fulfillment/repository/index.d.ts +3 -3
- package/dist/modules/fulfillment/repository/index.d.ts.map +1 -1
- package/dist/modules/fulfillment/repository/index.js +1 -1
- package/dist/modules/fulfillment/schema.js +2 -2
- package/dist/modules/fulfillment/service.d.ts +6 -6
- package/dist/modules/fulfillment/service.d.ts.map +1 -1
- package/dist/modules/fulfillment/service.js +4 -4
- package/dist/modules/fulfillment/types.d.ts +2 -2
- package/dist/modules/fulfillment/types.d.ts.map +1 -1
- package/dist/modules/inventory/repository/index.d.ts +3 -3
- package/dist/modules/inventory/repository/index.d.ts.map +1 -1
- package/dist/modules/inventory/repository/index.js +1 -1
- package/dist/modules/inventory/schema.js +2 -2
- package/dist/modules/inventory/service.d.ts +9 -9
- package/dist/modules/inventory/service.d.ts.map +1 -1
- package/dist/modules/inventory/service.js +8 -8
- package/dist/modules/media/adapter.d.ts +1 -1
- package/dist/modules/media/adapter.d.ts.map +1 -1
- package/dist/modules/media/repository/index.d.ts +3 -3
- package/dist/modules/media/repository/index.d.ts.map +1 -1
- package/dist/modules/media/repository/index.js +1 -1
- package/dist/modules/media/schema.js +2 -2
- package/dist/modules/media/service.d.ts +6 -6
- package/dist/modules/media/service.d.ts.map +1 -1
- package/dist/modules/media/service.js +4 -4
- package/dist/modules/orders/repository/index.d.ts +3 -3
- package/dist/modules/orders/repository/index.d.ts.map +1 -1
- package/dist/modules/orders/repository/index.js +1 -1
- package/dist/modules/orders/schema.js +2 -2
- package/dist/modules/orders/service.d.ts +8 -8
- package/dist/modules/orders/service.d.ts.map +1 -1
- package/dist/modules/orders/service.js +9 -9
- package/dist/modules/orders/stale-order-cleanup.d.ts +1 -1
- package/dist/modules/orders/stale-order-cleanup.d.ts.map +1 -1
- package/dist/modules/orders/stale-order-cleanup.js +1 -1
- package/dist/modules/organization/service.d.ts +1 -1
- package/dist/modules/organization/service.d.ts.map +1 -1
- package/dist/modules/organization/service.js +1 -1
- package/dist/modules/payments/adapter.d.ts +1 -1
- package/dist/modules/payments/adapter.d.ts.map +1 -1
- package/dist/modules/payments/repository/index.d.ts +1 -1
- package/dist/modules/payments/repository/index.d.ts.map +1 -1
- package/dist/modules/payments/service.d.ts +3 -3
- package/dist/modules/payments/service.d.ts.map +1 -1
- package/dist/modules/payments/service.js +2 -2
- package/dist/modules/pricing/repository/index.d.ts +3 -3
- package/dist/modules/pricing/repository/index.d.ts.map +1 -1
- package/dist/modules/pricing/repository/index.js +1 -1
- package/dist/modules/pricing/schema.js +2 -2
- package/dist/modules/pricing/service.d.ts +7 -7
- package/dist/modules/pricing/service.d.ts.map +1 -1
- package/dist/modules/pricing/service.js +3 -3
- package/dist/modules/promotions/repository/index.d.ts +3 -3
- package/dist/modules/promotions/repository/index.d.ts.map +1 -1
- package/dist/modules/promotions/repository/index.js +1 -1
- package/dist/modules/promotions/schema.js +1 -1
- package/dist/modules/promotions/service.d.ts +8 -8
- package/dist/modules/promotions/service.d.ts.map +1 -1
- package/dist/modules/promotions/service.js +3 -3
- package/dist/modules/search/adapter.d.ts +1 -1
- package/dist/modules/search/adapter.d.ts.map +1 -1
- package/dist/modules/search/hooks.d.ts +1 -1
- package/dist/modules/search/hooks.d.ts.map +1 -1
- package/dist/modules/search/repository/index.d.ts +1 -1
- package/dist/modules/search/repository/index.d.ts.map +1 -1
- package/dist/modules/search/service.d.ts +4 -4
- package/dist/modules/search/service.d.ts.map +1 -1
- package/dist/modules/search/service.js +2 -2
- package/dist/modules/shipping/calculator.d.ts +3 -3
- package/dist/modules/shipping/calculator.d.ts.map +1 -1
- package/dist/modules/shipping/repository/index.d.ts +1 -1
- package/dist/modules/shipping/repository/index.d.ts.map +1 -1
- package/dist/modules/shipping/service.d.ts +5 -5
- package/dist/modules/shipping/service.d.ts.map +1 -1
- package/dist/modules/shipping/service.js +2 -2
- package/dist/modules/tax/adapter.d.ts +1 -1
- package/dist/modules/tax/adapter.d.ts.map +1 -1
- package/dist/modules/tax/repository/index.d.ts +1 -1
- package/dist/modules/tax/repository/index.d.ts.map +1 -1
- package/dist/modules/tax/service.d.ts +2 -2
- package/dist/modules/tax/service.d.ts.map +1 -1
- package/dist/modules/tax/service.js +2 -2
- package/dist/modules/webhooks/hook.d.ts +1 -1
- package/dist/modules/webhooks/hook.d.ts.map +1 -1
- package/dist/modules/webhooks/repository/index.d.ts +3 -3
- package/dist/modules/webhooks/repository/index.d.ts.map +1 -1
- package/dist/modules/webhooks/repository/index.js +1 -1
- package/dist/modules/webhooks/schema.js +1 -1
- package/dist/modules/webhooks/service.d.ts +4 -4
- package/dist/modules/webhooks/service.d.ts.map +1 -1
- package/dist/modules/webhooks/service.js +3 -3
- package/dist/modules/webhooks/tasks.d.ts +1 -1
- package/dist/modules/webhooks/tasks.d.ts.map +1 -1
- package/dist/modules/webhooks/tasks.js +1 -1
- package/dist/modules/webhooks/worker.d.ts +1 -1
- package/dist/modules/webhooks/worker.d.ts.map +1 -1
- package/dist/modules/webhooks/worker.js +2 -2
- package/dist/runtime/commerce.d.ts +9 -9
- package/dist/runtime/commerce.d.ts.map +1 -1
- package/dist/runtime/commerce.js +5 -5
- package/dist/runtime/kernel.d.ts +21 -21
- package/dist/runtime/kernel.d.ts.map +1 -1
- package/dist/runtime/kernel.js +41 -41
- package/dist/runtime/logger.d.ts +1 -1
- package/dist/runtime/logger.d.ts.map +1 -1
- package/dist/runtime/server.d.ts +6 -6
- package/dist/runtime/server.d.ts.map +1 -1
- package/dist/runtime/server.js +8 -6
- package/dist/runtime/shutdown.d.ts +1 -1
- package/dist/runtime/shutdown.d.ts.map +1 -1
- package/dist/test-utils/create-pglite-adapter.d.ts +2 -2
- package/dist/test-utils/create-pglite-adapter.d.ts.map +1 -1
- package/dist/test-utils/create-pglite-adapter.js +3 -3
- package/dist/test-utils/create-plugin-test-app.d.ts +3 -3
- package/dist/test-utils/create-plugin-test-app.d.ts.map +1 -1
- package/dist/test-utils/create-plugin-test-app.js +4 -4
- package/dist/test-utils/create-repository-test-harness.d.ts +2 -2
- package/dist/test-utils/create-repository-test-harness.d.ts.map +1 -1
- package/dist/test-utils/create-repository-test-harness.js +2 -2
- package/dist/test-utils/create-test-config.d.ts +1 -1
- package/dist/test-utils/create-test-config.d.ts.map +1 -1
- package/dist/test-utils/create-test-config.js +4 -4
- package/dist/test-utils/create-test-kernel.d.ts +2 -2
- package/dist/test-utils/create-test-kernel.d.ts.map +1 -1
- package/dist/test-utils/create-test-kernel.js +2 -2
- package/dist/test-utils/create-test-plugin-context.d.ts +2 -2
- package/dist/test-utils/create-test-plugin-context.d.ts.map +1 -1
- package/dist/test-utils/create-test-plugin-context.js +3 -3
- package/dist/test-utils/rest-api-test-utils.d.ts +4 -4
- package/dist/test-utils/rest-api-test-utils.d.ts.map +1 -1
- package/dist/test-utils/rest-api-test-utils.js +8 -8
- package/dist/test-utils/test-actors.d.ts +1 -1
- package/dist/test-utils/test-actors.d.ts.map +1 -1
- package/dist/test-utils/typed-hooks.d.ts +2 -2
- package/dist/test-utils/typed-hooks.d.ts.map +1 -1
- package/dist/types/commerce-types.d.ts +5 -5
- package/dist/types/commerce-types.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/package.json +17 -9
- package/src/auth/access.ts +1 -1
- package/src/auth/auth-schema.ts +3 -3
- package/src/auth/middleware.ts +43 -14
- package/src/auth/org.ts +1 -1
- package/src/auth/permissions.ts +2 -2
- package/src/auth/setup.ts +18 -14
- package/src/auth/system-actor.ts +2 -2
- package/src/config/defaults.ts +1 -1
- package/src/config/define-config.ts +3 -3
- package/src/config/types.ts +11 -11
- package/src/hooks/checkout-completion.ts +4 -4
- package/src/hooks/checkout.ts +8 -8
- package/src/hooks/order-emails.ts +1 -1
- package/src/index.ts +83 -83
- package/src/interfaces/mcp/context-enrichment.ts +3 -3
- package/src/interfaces/mcp/server.ts +6 -6
- package/src/interfaces/mcp/transport.ts +3 -3
- package/src/interfaces/rest/customer-portal.ts +6 -6
- package/src/interfaces/rest/index.ts +15 -15
- package/src/interfaces/rest/router.ts +5 -5
- package/src/interfaces/rest/routes/admin-jobs.ts +5 -5
- package/src/interfaces/rest/routes/audit.ts +4 -4
- package/src/interfaces/rest/routes/carts.ts +4 -4
- package/src/interfaces/rest/routes/catalog.ts +5 -5
- package/src/interfaces/rest/routes/checkout.ts +11 -11
- package/src/interfaces/rest/routes/inventory.ts +3 -3
- package/src/interfaces/rest/routes/media.ts +4 -4
- package/src/interfaces/rest/routes/orders.ts +3 -3
- package/src/interfaces/rest/routes/payments.ts +3 -3
- package/src/interfaces/rest/routes/pricing.ts +3 -3
- package/src/interfaces/rest/routes/promotions.ts +4 -4
- package/src/interfaces/rest/routes/search.ts +3 -3
- package/src/interfaces/rest/routes/webhooks.ts +3 -3
- package/src/interfaces/rest/schemas/admin-jobs.ts +1 -1
- package/src/interfaces/rest/schemas/carts.ts +3 -3
- package/src/interfaces/rest/schemas/catalog.ts +3 -3
- package/src/interfaces/rest/schemas/checkout.ts +1 -1
- package/src/interfaces/rest/schemas/customer-portal.ts +2 -2
- package/src/interfaces/rest/schemas/inventory.ts +2 -2
- package/src/interfaces/rest/schemas/media.ts +1 -1
- package/src/interfaces/rest/schemas/orders.ts +2 -2
- package/src/interfaces/rest/schemas/pricing.ts +2 -2
- package/src/interfaces/rest/schemas/promotions.ts +2 -2
- package/src/interfaces/rest/schemas/responses.ts +5 -5
- package/src/interfaces/rest/schemas/search.ts +1 -1
- package/src/interfaces/rest/schemas/webhooks.ts +1 -1
- package/src/interfaces/rest/utils.ts +4 -4
- package/src/interfaces/rest/webhook-router.ts +1 -1
- package/src/kernel/compensation/executor.ts +2 -2
- package/src/kernel/compensation/types.ts +3 -3
- package/src/kernel/database/drizzle-db.ts +1 -1
- package/src/kernel/database/migrate.ts +2 -2
- package/src/kernel/database/schema.ts +13 -13
- package/src/kernel/database/tx-context.ts +2 -2
- package/src/kernel/error-mapper.ts +1 -1
- package/src/kernel/factory/repository-factory.ts +3 -3
- package/src/kernel/hooks/create-context.ts +5 -5
- package/src/kernel/hooks/executor.ts +1 -1
- package/src/kernel/hooks/types.ts +3 -3
- package/src/kernel/http-error.ts +1 -1
- package/src/kernel/jobs/drizzle-adapter.ts +5 -5
- package/src/kernel/jobs/runner.ts +4 -4
- package/src/kernel/jobs/schema.ts +1 -1
- package/src/kernel/jobs/types.ts +2 -2
- package/src/kernel/local-api.ts +4 -4
- package/src/kernel/plugin/manifest.ts +1 -1
- package/src/kernel/query/executor.ts +2 -2
- package/src/kernel/result.ts +1 -1
- package/src/kernel/state-machine/machine.ts +1 -1
- package/src/modules/analytics/drizzle-adapter.ts +4 -4
- package/src/modules/analytics/models.ts +1 -1
- package/src/modules/analytics/repository/index.ts +1 -1
- package/src/modules/analytics/service.ts +5 -5
- package/src/modules/analytics/types.ts +1 -1
- package/src/modules/audit/hooks.ts +3 -3
- package/src/modules/audit/schema.ts +1 -1
- package/src/modules/audit/service.ts +5 -5
- package/src/modules/cart/access.ts +2 -2
- package/src/modules/cart/matcher.ts +1 -1
- package/src/modules/cart/repository/index.ts +3 -3
- package/src/modules/cart/schema.ts +2 -2
- package/src/modules/cart/service.ts +17 -17
- package/src/modules/catalog/repository/index.ts +3 -3
- package/src/modules/catalog/schema.ts +1 -1
- package/src/modules/catalog/service.ts +16 -16
- package/src/modules/customers/repository/index.ts +3 -3
- package/src/modules/customers/schema.ts +1 -1
- package/src/modules/customers/service.ts +6 -6
- package/src/modules/fulfillment/repository/index.ts +3 -3
- package/src/modules/fulfillment/schema.ts +2 -2
- package/src/modules/fulfillment/service.ts +9 -9
- package/src/modules/fulfillment/types.ts +2 -2
- package/src/modules/inventory/repository/index.ts +3 -3
- package/src/modules/inventory/schema.ts +2 -2
- package/src/modules/inventory/service.ts +16 -16
- package/src/modules/media/adapter.ts +1 -1
- package/src/modules/media/repository/index.ts +3 -3
- package/src/modules/media/schema.ts +2 -2
- package/src/modules/media/service.ts +9 -9
- package/src/modules/orders/repository/index.ts +3 -3
- package/src/modules/orders/schema.ts +2 -2
- package/src/modules/orders/service.ts +15 -15
- package/src/modules/orders/stale-order-cleanup.ts +2 -2
- package/src/modules/organization/service.ts +2 -2
- package/src/modules/payments/adapter.ts +1 -1
- package/src/modules/payments/repository/index.ts +1 -1
- package/src/modules/payments/service.ts +3 -3
- package/src/modules/pricing/repository/index.ts +3 -3
- package/src/modules/pricing/schema.ts +2 -2
- package/src/modules/pricing/service.ts +9 -9
- package/src/modules/promotions/repository/index.ts +3 -3
- package/src/modules/promotions/schema.ts +1 -1
- package/src/modules/promotions/service.ts +10 -10
- package/src/modules/search/adapter.ts +1 -1
- package/src/modules/search/hooks.ts +2 -2
- package/src/modules/search/repository/index.ts +1 -1
- package/src/modules/search/service.ts +5 -5
- package/src/modules/shipping/calculator.ts +3 -3
- package/src/modules/shipping/repository/index.ts +1 -1
- package/src/modules/shipping/service.ts +5 -5
- package/src/modules/tax/adapter.ts +1 -1
- package/src/modules/tax/repository/index.ts +1 -1
- package/src/modules/tax/service.ts +3 -3
- package/src/modules/webhooks/hook.ts +1 -1
- package/src/modules/webhooks/repository/index.ts +3 -3
- package/src/modules/webhooks/schema.ts +1 -1
- package/src/modules/webhooks/service.ts +6 -6
- package/src/modules/webhooks/tasks.ts +3 -3
- package/src/modules/webhooks/worker.ts +3 -3
- package/src/runtime/commerce.ts +11 -11
- package/src/runtime/kernel.ts +45 -45
- package/src/runtime/logger.ts +1 -1
- package/src/runtime/server.ts +17 -13
- package/src/runtime/shutdown.ts +1 -1
- package/src/test-utils/create-pglite-adapter.ts +5 -5
- package/src/test-utils/create-plugin-test-app.ts +7 -7
- package/src/test-utils/create-repository-test-harness.ts +3 -3
- package/src/test-utils/create-test-config.ts +6 -6
- package/src/test-utils/create-test-kernel.ts +3 -3
- package/src/test-utils/create-test-plugin-context.ts +4 -4
- package/src/test-utils/rest-api-test-utils.ts +11 -11
- package/src/test-utils/test-actors.ts +1 -1
- package/src/test-utils/typed-hooks.ts +2 -2
- package/src/types/commerce-types.ts +5 -5
- package/src/utils/logger.ts +1 -1
- package/dist/auth/pos.d.ts +0 -3
- package/dist/auth/pos.d.ts.map +0 -1
- package/dist/auth/pos.js +0 -62
- package/dist/index.js.map +0 -156
- package/dist/interfaces/graphql/index.d.ts +0 -4
- package/dist/interfaces/graphql/index.d.ts.map +0 -1
- package/dist/interfaces/graphql/index.js +0 -415
- package/dist/kernel/factory/in-memory-repository-factory.d.ts +0 -20
- package/dist/kernel/factory/in-memory-repository-factory.d.ts.map +0 -1
- package/dist/kernel/factory/in-memory-repository-factory.js +0 -83
- package/dist/kernel/plugin/capability-registry.d.ts +0 -9
- package/dist/kernel/plugin/capability-registry.d.ts.map +0 -1
- package/dist/kernel/plugin/capability-registry.js +0 -28
- package/dist/kernel/plugin/dependency-graph.d.ts +0 -6
- package/dist/kernel/plugin/dependency-graph.d.ts.map +0 -1
- package/dist/kernel/plugin/dependency-graph.js +0 -55
- package/dist/modules/analytics/cubes.d.ts +0 -19
- package/dist/modules/analytics/cubes.d.ts.map +0 -1
- package/dist/modules/analytics/cubes.js +0 -187
- package/dist/modules/cart/repository/in-memory.d.ts +0 -30
- package/dist/modules/cart/repository/in-memory.d.ts.map +0 -1
- package/dist/modules/cart/repository/in-memory.js +0 -159
- package/dist/modules/catalog/repository/in-memory.d.ts +0 -82
- package/dist/modules/catalog/repository/in-memory.d.ts.map +0 -1
- package/dist/modules/catalog/repository/in-memory.js +0 -444
- package/dist/modules/customers/repository/in-memory.d.ts +0 -37
- package/dist/modules/customers/repository/in-memory.d.ts.map +0 -1
- package/dist/modules/customers/repository/in-memory.js +0 -278
- package/dist/modules/fulfillment/repository/in-memory.d.ts +0 -53
- package/dist/modules/fulfillment/repository/in-memory.d.ts.map +0 -1
- package/dist/modules/fulfillment/repository/in-memory.js +0 -327
- package/dist/modules/inventory/repository/in-memory.d.ts +0 -51
- package/dist/modules/inventory/repository/in-memory.d.ts.map +0 -1
- package/dist/modules/inventory/repository/in-memory.js +0 -281
- package/dist/modules/media/repository/in-memory.d.ts +0 -26
- package/dist/modules/media/repository/in-memory.d.ts.map +0 -1
- package/dist/modules/media/repository/in-memory.js +0 -145
- package/dist/modules/orders/repository/in-memory.d.ts +0 -40
- package/dist/modules/orders/repository/in-memory.d.ts.map +0 -1
- package/dist/modules/orders/repository/in-memory.js +0 -245
- package/dist/modules/pricing/repository/in-memory.d.ts +0 -25
- package/dist/modules/pricing/repository/in-memory.d.ts.map +0 -1
- package/dist/modules/pricing/repository/in-memory.js +0 -288
- package/dist/modules/promotions/repository/in-memory.d.ts +0 -32
- package/dist/modules/promotions/repository/in-memory.d.ts.map +0 -1
- package/dist/modules/promotions/repository/in-memory.js +0 -227
- package/dist/modules/webhooks/repository/in-memory.d.ts +0 -31
- package/dist/modules/webhooks/repository/in-memory.d.ts.map +0 -1
- package/dist/modules/webhooks/repository/in-memory.js +0 -187
- package/dist/runtime/state-manager.d.ts +0 -14
- package/dist/runtime/state-manager.d.ts.map +0 -1
- package/dist/runtime/state-manager.js +0 -84
- package/dist/runtime/state-repository.d.ts +0 -13
- package/dist/runtime/state-repository.d.ts.map +0 -1
- package/dist/runtime/state-repository.js +0 -160
- package/dist/runtime/state.d.ts +0 -382
- package/dist/runtime/state.d.ts.map +0 -1
- package/dist/runtime/state.js +0 -37
- package/dist/runtime/store.d.ts +0 -382
- package/dist/runtime/store.d.ts.map +0 -1
- package/dist/runtime/store.js +0 -37
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { boolean, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
|
|
2
|
-
import { organization } from "../../auth/auth-schema";
|
|
2
|
+
import { organization } from "../../auth/auth-schema.js";
|
|
3
3
|
|
|
4
4
|
export const promotions = pgTable(
|
|
5
5
|
"promotions",
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CommerceNotFoundError,
|
|
3
3
|
CommerceValidationError,
|
|
4
|
-
} from "../../kernel/errors";
|
|
5
|
-
import { Err, Ok, type Result } from "../../kernel/result";
|
|
6
|
-
import type { TxContext } from "../../kernel/database/tx-context";
|
|
4
|
+
} from "../../kernel/errors.js";
|
|
5
|
+
import { Err, Ok, type Result } from "../../kernel/result.js";
|
|
6
|
+
import type { TxContext } from "../../kernel/database/tx-context.js";
|
|
7
7
|
import type {
|
|
8
8
|
PromotionsRepository,
|
|
9
9
|
Promotion,
|
|
10
10
|
PromotionUsage,
|
|
11
|
-
} from "./repository";
|
|
12
|
-
import type { CatalogRepository } from "../catalog/repository";
|
|
13
|
-
import type { OrdersRepository } from "../orders/repository";
|
|
14
|
-
import { DEFAULT_ORG_ID, resolveOrgId } from "../../auth/org";
|
|
15
|
-
import type { Actor } from "../../auth/types";
|
|
11
|
+
} from "./repository/index.js";
|
|
12
|
+
import type { CatalogRepository } from "../catalog/repository/index.js";
|
|
13
|
+
import type { OrdersRepository } from "../orders/repository/index.js";
|
|
14
|
+
import { DEFAULT_ORG_ID, resolveOrgId } from "../../auth/org.js";
|
|
15
|
+
import type { Actor } from "../../auth/types.js";
|
|
16
16
|
|
|
17
17
|
// Re-export PromotionType for external use
|
|
18
18
|
export type PromotionType =
|
|
@@ -58,8 +58,8 @@ export interface PromotionConditions {
|
|
|
58
58
|
firstOrderOnly?: boolean;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export type { CreatePromotionInput } from "./schemas";
|
|
62
|
-
import type { CreatePromotionInput } from "./schemas";
|
|
61
|
+
export type { CreatePromotionInput } from "./schemas.js";
|
|
62
|
+
import type { CreatePromotionInput } from "./schemas.js";
|
|
63
63
|
|
|
64
64
|
export interface AppliedPromotion {
|
|
65
65
|
promotionId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HookContext } from "../../kernel/hooks/types";
|
|
2
|
-
import type { SearchService } from "./service";
|
|
1
|
+
import type { HookContext } from "../../kernel/hooks/types.js";
|
|
2
|
+
import type { SearchService } from "./service.js";
|
|
3
3
|
|
|
4
4
|
export async function syncToSearchIndex(args: {
|
|
5
5
|
result: { id: string };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Ok, type Result } from "../../kernel/result";
|
|
2
|
-
import { resolveOrgId } from "../../auth/org";
|
|
3
|
-
import type { TxContext } from "../../kernel/database/tx-context";
|
|
4
|
-
import type { CatalogRepository, SellableEntity } from "../catalog/repository";
|
|
1
|
+
import { Ok, type Result } from "../../kernel/result.js";
|
|
2
|
+
import { resolveOrgId } from "../../auth/org.js";
|
|
3
|
+
import type { TxContext } from "../../kernel/database/tx-context.js";
|
|
4
|
+
import type { CatalogRepository, SellableEntity } from "../catalog/repository/index.js";
|
|
5
5
|
import type {
|
|
6
6
|
SearchAdapter,
|
|
7
7
|
SearchDocument,
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
SearchQueryParams,
|
|
10
10
|
SearchQueryResult,
|
|
11
11
|
SearchSuggestParams,
|
|
12
|
-
} from "./adapter";
|
|
12
|
+
} from "./adapter.js";
|
|
13
13
|
|
|
14
14
|
interface SearchServiceDeps {
|
|
15
15
|
catalogRepository: CatalogRepository;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CommerceConfig } from "../../config/types";
|
|
2
|
-
import type { TxContext } from "../../kernel/database/tx-context";
|
|
3
|
-
import type { CatalogRepository } from "../catalog/repository";
|
|
1
|
+
import type { CommerceConfig } from "../../config/types.js";
|
|
2
|
+
import type { TxContext } from "../../kernel/database/tx-context.js";
|
|
3
|
+
import type { CatalogRepository } from "../catalog/repository/index.js";
|
|
4
4
|
|
|
5
5
|
export interface ShippingAddress {
|
|
6
6
|
country: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { CommerceConfig } from "../../config/types";
|
|
2
|
-
import { Ok, type Result } from "../../kernel/result";
|
|
3
|
-
import type { TxContext } from "../../kernel/database/tx-context";
|
|
4
|
-
import type { CatalogRepository } from "../catalog/repository";
|
|
1
|
+
import type { CommerceConfig } from "../../config/types.js";
|
|
2
|
+
import { Ok, type Result } from "../../kernel/result.js";
|
|
3
|
+
import type { TxContext } from "../../kernel/database/tx-context.js";
|
|
4
|
+
import type { CatalogRepository } from "../catalog/repository/index.js";
|
|
5
5
|
import {
|
|
6
6
|
calculateShippingCost,
|
|
7
7
|
type ShippingAddress,
|
|
8
8
|
type ShippingLineItem,
|
|
9
|
-
} from "./calculator";
|
|
9
|
+
} from "./calculator.js";
|
|
10
10
|
|
|
11
11
|
interface ShippingServiceDeps {
|
|
12
12
|
config: CommerceConfig;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CommerceValidationError } from "../../kernel/errors";
|
|
2
|
-
import { Err, Ok, type Result } from "../../kernel/result";
|
|
1
|
+
import { CommerceValidationError } from "../../kernel/errors.js";
|
|
2
|
+
import { Err, Ok, type Result } from "../../kernel/result.js";
|
|
3
3
|
import type {
|
|
4
4
|
TaxAdapter,
|
|
5
5
|
TaxCalculationParams,
|
|
6
6
|
TaxCalculationResult,
|
|
7
7
|
TaxReportParams,
|
|
8
8
|
TaxVoidParams,
|
|
9
|
-
} from "./adapter";
|
|
9
|
+
} from "./adapter.js";
|
|
10
10
|
|
|
11
11
|
interface TaxServiceDeps {
|
|
12
12
|
adapter: TaxAdapter | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { eq, and, lte, isNull, or, desc, sql } from "drizzle-orm";
|
|
2
|
-
import type { TxContext } from "../../../kernel/database/tx-context";
|
|
2
|
+
import type { TxContext } from "../../../kernel/database/tx-context.js";
|
|
3
3
|
import type {
|
|
4
4
|
DrizzleDatabase,
|
|
5
5
|
DbOrTx,
|
|
6
|
-
} from "../../../kernel/database/drizzle-db";
|
|
7
|
-
import { webhookEndpoints, webhookDeliveries } from "../schema";
|
|
6
|
+
} from "../../../kernel/database/drizzle-db.js";
|
|
7
|
+
import { webhookEndpoints, webhookDeliveries } from "../schema.js";
|
|
8
8
|
|
|
9
9
|
// Infer types from Drizzle schema
|
|
10
10
|
export type WebhookEndpoint = typeof webhookEndpoints.$inferSelect;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { resolveOrgId } from "../../auth/org";
|
|
2
|
-
import type { Actor } from "../../auth/types";
|
|
3
|
-
import { CommerceNotFoundError, CommerceValidationError } from "../../kernel/errors";
|
|
4
|
-
import { Err, Ok, type Result } from "../../kernel/result";
|
|
5
|
-
import type { TxContext } from "../../kernel/database/tx-context";
|
|
6
|
-
import type { WebhooksRepository, WebhookEndpoint } from "./repository";
|
|
1
|
+
import { resolveOrgId } from "../../auth/org.js";
|
|
2
|
+
import type { Actor } from "../../auth/types.js";
|
|
3
|
+
import { CommerceNotFoundError, CommerceValidationError } from "../../kernel/errors.js";
|
|
4
|
+
import { Err, Ok, type Result } from "../../kernel/result.js";
|
|
5
|
+
import type { TxContext } from "../../kernel/database/tx-context.js";
|
|
6
|
+
import type { WebhooksRepository, WebhookEndpoint } from "./repository/index.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Checks whether a URL points to a private/internal IP address.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { TaskDefinition } from "../../kernel/jobs/types";
|
|
2
|
-
import { WebhookDeliveryWorker } from "./worker";
|
|
3
|
-
import type { WebhooksRepository } from "./repository";
|
|
1
|
+
import type { TaskDefinition } from "../../kernel/jobs/types.js";
|
|
2
|
+
import { WebhookDeliveryWorker } from "./worker.js";
|
|
3
|
+
import type { WebhooksRepository } from "./repository/index.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Background task for async webhook delivery.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { signWebhookPayload } from "./signing";
|
|
2
|
-
import { isPrivateIp } from "./ssrf-guard";
|
|
3
|
-
import type { WebhooksRepository } from "./repository";
|
|
1
|
+
import { signWebhookPayload } from "./signing.js";
|
|
2
|
+
import { isPrivateIp } from "./ssrf-guard.js";
|
|
3
|
+
import type { WebhooksRepository } from "./repository/index.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* SSRF prevention: reject webhook URLs targeting private/internal hosts.
|
package/src/runtime/commerce.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Actor } from "../auth/types";
|
|
2
|
-
import type { CommerceConfig } from "../config/types";
|
|
3
|
-
import type { Kernel } from "./kernel";
|
|
4
|
-
import { createKernel } from "./kernel";
|
|
5
|
-
import { ensureDefaultOrg } from "../auth/org";
|
|
6
|
-
import { createAuth, type AuthInstance } from "../auth/setup";
|
|
7
|
-
import { createLogger, type Logger } from "./logger";
|
|
8
|
-
import { createLocalAPI, type CommerceLocalAPI, type LocalAPIOptions } from "../kernel/local-api";
|
|
1
|
+
import type { Actor } from "../auth/types.js";
|
|
2
|
+
import type { CommerceConfig } from "../config/types.js";
|
|
3
|
+
import type { Kernel } from "./kernel.js";
|
|
4
|
+
import { createKernel } from "./kernel.js";
|
|
5
|
+
import { ensureDefaultOrg } from "../auth/org.js";
|
|
6
|
+
import { createAuth, type AuthInstance } from "../auth/setup.js";
|
|
7
|
+
import { createLogger, type Logger } from "./logger.js";
|
|
8
|
+
import { createLocalAPI, type CommerceLocalAPI, type LocalAPIOptions } from "../kernel/local-api.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The commerce instance returned by `createCommerce()`.
|
|
@@ -18,7 +18,7 @@ import { createLocalAPI, type CommerceLocalAPI, type LocalAPIOptions } from "../
|
|
|
18
18
|
* ```typescript
|
|
19
19
|
* // lib/commerce.ts
|
|
20
20
|
* import { createCommerce } from "@unifiedcommerce/core";
|
|
21
|
-
* import config from "../commerce.config";
|
|
21
|
+
* import config from "../commerce.config.js";
|
|
22
22
|
*
|
|
23
23
|
* export const commerce = await createCommerce(config);
|
|
24
24
|
*
|
|
@@ -37,7 +37,7 @@ import { createLocalAPI, type CommerceLocalAPI, type LocalAPIOptions } from "../
|
|
|
37
37
|
* ```typescript
|
|
38
38
|
* // app/routes/products.tsx
|
|
39
39
|
* import { createServerFn } from "@tanstack/start";
|
|
40
|
-
* import { commerce } from "../lib/commerce";
|
|
40
|
+
* import { commerce } from "../lib/commerce.js";
|
|
41
41
|
*
|
|
42
42
|
* const getProducts = createServerFn("GET", async () => {
|
|
43
43
|
* return commerce.api.catalog.list({ limit: 20 });
|
|
@@ -49,7 +49,7 @@ import { createLocalAPI, type CommerceLocalAPI, type LocalAPIOptions } from "../
|
|
|
49
49
|
* ```typescript
|
|
50
50
|
* // src/lib/server/commerce.ts
|
|
51
51
|
* import { createCommerce } from "@unifiedcommerce/core";
|
|
52
|
-
* import config from "./commerce.config";
|
|
52
|
+
* import config from "./commerce.config.js";
|
|
53
53
|
* export const commerce = await createCommerce(config);
|
|
54
54
|
*
|
|
55
55
|
* // src/routes/products/+page.server.ts
|
package/src/runtime/kernel.ts
CHANGED
|
@@ -2,59 +2,59 @@ import type {
|
|
|
2
2
|
CommerceConfig,
|
|
3
3
|
MCPResource,
|
|
4
4
|
MCPTool,
|
|
5
|
-
} from "../config/types";
|
|
6
|
-
import { HookRegistry, type HookHandler } from "../kernel/hooks/registry";
|
|
5
|
+
} from "../config/types.js";
|
|
6
|
+
import { HookRegistry, type HookHandler } from "../kernel/hooks/registry.js";
|
|
7
7
|
import {
|
|
8
8
|
createDatabaseConnection,
|
|
9
9
|
type DatabaseAdapter,
|
|
10
|
-
} from "../kernel/database/adapter";
|
|
11
|
-
import type { PluginDb } from "../kernel/database/plugin-types";
|
|
12
|
-
|
|
13
|
-
import { CatalogServiceImpl } from "../modules/catalog/service";
|
|
14
|
-
import { CatalogRepository } from "../modules/catalog/repository";
|
|
15
|
-
import { InventoryRepository } from "../modules/inventory/repository";
|
|
16
|
-
import { CartRepository } from "../modules/cart/repository";
|
|
17
|
-
import { OrdersRepository } from "../modules/orders/repository";
|
|
18
|
-
import { CustomersRepository } from "../modules/customers/repository";
|
|
19
|
-
import { PricingRepository } from "../modules/pricing/repository";
|
|
20
|
-
import { PromotionsRepository } from "../modules/promotions/repository";
|
|
21
|
-
import { FulfillmentRepository } from "../modules/fulfillment/repository";
|
|
22
|
-
import { WebhooksRepository } from "../modules/webhooks/repository";
|
|
23
|
-
import { MediaRepository } from "../modules/media/repository";
|
|
24
|
-
import type { DrizzleDatabase } from "../kernel/database/drizzle-db";
|
|
25
|
-
import { InventoryService } from "../modules/inventory/service";
|
|
26
|
-
import { MediaService } from "../modules/media/service";
|
|
27
|
-
import { CartService } from "../modules/cart/service";
|
|
28
|
-
import { OrderService } from "../modules/orders/service";
|
|
29
|
-
import { PaymentsService } from "../modules/payments/service";
|
|
30
|
-
import { FulfillmentService } from "../modules/fulfillment/service";
|
|
31
|
-
import { CustomerService } from "../modules/customers/service";
|
|
32
|
-
import { WebhookService } from "../modules/webhooks/service";
|
|
33
|
-
import { AnalyticsService } from "../modules/analytics/service";
|
|
34
|
-
import { DrizzleAnalyticsAdapter } from "../modules/analytics/drizzle-adapter";
|
|
35
|
-
import { BUILTIN_ANALYTICS_MODELS } from "../modules/analytics/models";
|
|
36
|
-
import { PricingService } from "../modules/pricing/service";
|
|
37
|
-
import { PromotionService } from "../modules/promotions/service";
|
|
38
|
-
import { TaxService } from "../modules/tax/service";
|
|
39
|
-
import { ShippingService } from "../modules/shipping/service";
|
|
40
|
-
import { SearchService } from "../modules/search/service";
|
|
41
|
-
import { WebhookDeliveryWorker } from "../modules/webhooks/worker";
|
|
10
|
+
} from "../kernel/database/adapter.js";
|
|
11
|
+
import type { PluginDb } from "../kernel/database/plugin-types.js";
|
|
12
|
+
|
|
13
|
+
import { CatalogServiceImpl } from "../modules/catalog/service.js";
|
|
14
|
+
import { CatalogRepository } from "../modules/catalog/repository/index.js";
|
|
15
|
+
import { InventoryRepository } from "../modules/inventory/repository/index.js";
|
|
16
|
+
import { CartRepository } from "../modules/cart/repository/index.js";
|
|
17
|
+
import { OrdersRepository } from "../modules/orders/repository/index.js";
|
|
18
|
+
import { CustomersRepository } from "../modules/customers/repository/index.js";
|
|
19
|
+
import { PricingRepository } from "../modules/pricing/repository/index.js";
|
|
20
|
+
import { PromotionsRepository } from "../modules/promotions/repository/index.js";
|
|
21
|
+
import { FulfillmentRepository } from "../modules/fulfillment/repository/index.js";
|
|
22
|
+
import { WebhooksRepository } from "../modules/webhooks/repository/index.js";
|
|
23
|
+
import { MediaRepository } from "../modules/media/repository/index.js";
|
|
24
|
+
import type { DrizzleDatabase } from "../kernel/database/drizzle-db.js";
|
|
25
|
+
import { InventoryService } from "../modules/inventory/service.js";
|
|
26
|
+
import { MediaService } from "../modules/media/service.js";
|
|
27
|
+
import { CartService } from "../modules/cart/service.js";
|
|
28
|
+
import { OrderService } from "../modules/orders/service.js";
|
|
29
|
+
import { PaymentsService } from "../modules/payments/service.js";
|
|
30
|
+
import { FulfillmentService } from "../modules/fulfillment/service.js";
|
|
31
|
+
import { CustomerService } from "../modules/customers/service.js";
|
|
32
|
+
import { WebhookService } from "../modules/webhooks/service.js";
|
|
33
|
+
import { AnalyticsService } from "../modules/analytics/service.js";
|
|
34
|
+
import { DrizzleAnalyticsAdapter } from "../modules/analytics/drizzle-adapter.js";
|
|
35
|
+
import { BUILTIN_ANALYTICS_MODELS } from "../modules/analytics/models.js";
|
|
36
|
+
import { PricingService } from "../modules/pricing/service.js";
|
|
37
|
+
import { PromotionService } from "../modules/promotions/service.js";
|
|
38
|
+
import { TaxService } from "../modules/tax/service.js";
|
|
39
|
+
import { ShippingService } from "../modules/shipping/service.js";
|
|
40
|
+
import { SearchService } from "../modules/search/service.js";
|
|
41
|
+
import { WebhookDeliveryWorker } from "../modules/webhooks/worker.js";
|
|
42
42
|
import {
|
|
43
43
|
createAuditService,
|
|
44
44
|
type AuditService,
|
|
45
|
-
} from "../modules/audit/service";
|
|
46
|
-
import { OrganizationService } from "../modules/organization/service";
|
|
47
|
-
import { createLogger } from "../utils/logger";
|
|
48
|
-
import { withTiming } from "../kernel/service-timing";
|
|
49
|
-
import { extendOrderStateMachine } from "../kernel/state-machine/machine";
|
|
50
|
-
import { DEFAULT_ORG_ID } from "../auth/org";
|
|
51
|
-
import { deliverWebhooks } from "../modules/webhooks/hook";
|
|
45
|
+
} from "../modules/audit/service.js";
|
|
46
|
+
import { OrganizationService } from "../modules/organization/service.js";
|
|
47
|
+
import { createLogger } from "../utils/logger.js";
|
|
48
|
+
import { withTiming } from "../kernel/service-timing.js";
|
|
49
|
+
import { extendOrderStateMachine } from "../kernel/state-machine/machine.js";
|
|
50
|
+
import { DEFAULT_ORG_ID } from "../auth/org.js";
|
|
51
|
+
import { deliverWebhooks } from "../modules/webhooks/hook.js";
|
|
52
52
|
// Analytics event recording hooks removed (RFC-006): source tables ARE the events.
|
|
53
53
|
// The DrizzleAnalyticsAdapter queries orders/inventory directly via SQL.
|
|
54
|
-
import { syncToSearchIndex } from "../modules/search/hooks";
|
|
55
|
-
import { auditHooks } from "../modules/audit/hooks";
|
|
56
|
-
import { sendOrderStatusEmail } from "../hooks/order-emails";
|
|
57
|
-
import { DrizzleJobsAdapter } from "../kernel/jobs/drizzle-adapter";
|
|
54
|
+
import { syncToSearchIndex } from "../modules/search/hooks.js";
|
|
55
|
+
import { auditHooks } from "../modules/audit/hooks.js";
|
|
56
|
+
import { sendOrderStatusEmail } from "../hooks/order-emails.js";
|
|
57
|
+
import { DrizzleJobsAdapter } from "../kernel/jobs/drizzle-adapter.js";
|
|
58
58
|
|
|
59
59
|
export interface WebhookDeliveryPayload {
|
|
60
60
|
endpoint: { id: string; url: string; secret: string };
|
package/src/runtime/logger.ts
CHANGED
package/src/runtime/server.ts
CHANGED
|
@@ -4,18 +4,17 @@ import { cors } from "hono/cors";
|
|
|
4
4
|
import { csrf } from "hono/csrf";
|
|
5
5
|
import { bodyLimit } from "hono/body-limit";
|
|
6
6
|
import { rateLimiter } from "hono-rate-limiter";
|
|
7
|
-
import type { Actor } from "../auth/types";
|
|
8
|
-
import type { AuthInstance } from "../auth/setup";
|
|
9
|
-
import type { CommerceConfig } from "../config/types";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { createCommerce, type CommerceInstance } from "./commerce";
|
|
7
|
+
import type { Actor } from "../auth/types.js";
|
|
8
|
+
import type { AuthInstance } from "../auth/setup.js";
|
|
9
|
+
import type { CommerceConfig } from "../config/types.js";
|
|
10
|
+
import { authMiddleware } from "../auth/middleware.js";
|
|
11
|
+
import { createMCPHandler } from "../interfaces/mcp/transport.js";
|
|
12
|
+
import { createRestRoutes } from "../interfaces/rest/index.js";
|
|
13
|
+
import { createCustomerPortalRoutes } from "../interfaces/rest/customer-portal.js";
|
|
14
|
+
import { createKernel } from "./kernel.js";
|
|
15
|
+
import { ensureDefaultOrg } from "../auth/org.js";
|
|
16
|
+
import { createLogger, type Logger } from "./logger.js";
|
|
17
|
+
import { createCommerce, type CommerceInstance } from "./commerce.js";
|
|
19
18
|
|
|
20
19
|
type ServerEnv = {
|
|
21
20
|
Variables: {
|
|
@@ -36,6 +35,11 @@ export async function createServer(config: CommerceConfig) {
|
|
|
36
35
|
const commerce = await createCommerce(config);
|
|
37
36
|
const { kernel, auth, logger } = commerce;
|
|
38
37
|
const isProdEnv = process.env.NODE_ENV === "production";
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
console.log("config", config);
|
|
41
|
+
console.log("isProdEnv", isProdEnv);
|
|
42
|
+
|
|
39
43
|
const app = new OpenAPIHono<ServerEnv>({
|
|
40
44
|
defaultHook: (result, c) => {
|
|
41
45
|
if (!result.success) {
|
|
@@ -277,7 +281,7 @@ export async function createServer(config: CommerceConfig) {
|
|
|
277
281
|
// 2. GET /api/jobs/run: cron endpoint (serverless — Vercel, Cloudflare)
|
|
278
282
|
// 3. runPendingJobs() export (custom worker process)
|
|
279
283
|
|
|
280
|
-
const { runPendingJobs } = await import("../kernel/jobs/runner");
|
|
284
|
+
const { runPendingJobs } = await import("../kernel/jobs/runner.js");
|
|
281
285
|
const taskMap = new Map<string, unknown>();
|
|
282
286
|
for (const task of config.jobs?.tasks ?? []) {
|
|
283
287
|
taskMap.set((task as unknown as { slug?: string; name?: string }).slug ?? (task as unknown as { name: string }).name, task);
|
package/src/runtime/shutdown.ts
CHANGED
|
@@ -17,13 +17,13 @@ import { drizzle } from "drizzle-orm/pglite";
|
|
|
17
17
|
import { sql } from "drizzle-orm";
|
|
18
18
|
import { createRequire } from "node:module";
|
|
19
19
|
import type { PgDatabase, PgQueryResultHKT } from "drizzle-orm/pg-core";
|
|
20
|
-
import type { DatabaseAdapter } from "../kernel/database/adapter";
|
|
21
|
-
import { getSchema } from "../kernel/database/migrate";
|
|
22
|
-
import { ensureDefaultOrg } from "../auth/org";
|
|
20
|
+
import type { DatabaseAdapter } from "../kernel/database/adapter.js";
|
|
21
|
+
import { getSchema } from "../kernel/database/migrate.js";
|
|
22
|
+
import { ensureDefaultOrg } from "../auth/org.js";
|
|
23
23
|
|
|
24
24
|
// Single barrel import --- includes all core modules + auth tables
|
|
25
|
-
import * as fullSchema from "../kernel/database/schema";
|
|
26
|
-
import type { DrizzleDatabase } from "../kernel/database/drizzle-db";
|
|
25
|
+
import * as fullSchema from "../kernel/database/schema.js";
|
|
26
|
+
import type { DrizzleDatabase } from "../kernel/database/drizzle-db.js";
|
|
27
27
|
|
|
28
28
|
// drizzle-kit/api uses CJS internally; createRequire provides ESM compat.
|
|
29
29
|
const require = createRequire(import.meta.url);
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
21
21
|
import { createRequire } from "node:module";
|
|
22
22
|
import type { PgDatabase, PgQueryResultHKT } from "drizzle-orm/pg-core";
|
|
23
|
-
import type { CommerceConfig, CommercePlugin } from "../config/types";
|
|
24
|
-
import type { Actor } from "../auth/types";
|
|
25
|
-
import { createTestConfig } from "./create-test-config";
|
|
26
|
-
import { createKernel } from "../runtime/kernel";
|
|
27
|
-
import type { Kernel } from "../runtime/kernel";
|
|
28
|
-
import { buildSchema } from "../kernel/database/migrate";
|
|
29
|
-
import { ensureDefaultOrg } from "../auth/org";
|
|
23
|
+
import type { CommerceConfig, CommercePlugin } from "../config/types.js";
|
|
24
|
+
import type { Actor } from "../auth/types.js";
|
|
25
|
+
import { createTestConfig } from "./create-test-config.js";
|
|
26
|
+
import { createKernel } from "../runtime/kernel.js";
|
|
27
|
+
import type { Kernel } from "../runtime/kernel.js";
|
|
28
|
+
import { buildSchema } from "../kernel/database/migrate.js";
|
|
29
|
+
import { ensureDefaultOrg } from "../auth/org.js";
|
|
30
30
|
|
|
31
31
|
// drizzle-kit/api uses CJS internally; createRequire provides ESM compat.
|
|
32
32
|
const require = createRequire(import.meta.url);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CommerceConfig } from "../config/types";
|
|
2
|
-
import { createTestConfig } from "./create-test-config";
|
|
3
|
-
import { createKernel } from "../runtime/kernel";
|
|
1
|
+
import type { CommerceConfig } from "../config/types.js";
|
|
2
|
+
import { createTestConfig } from "./create-test-config.js";
|
|
3
|
+
import { createKernel } from "../runtime/kernel.js";
|
|
4
4
|
|
|
5
5
|
export interface RepositoryTestHarness {
|
|
6
6
|
config: CommerceConfig;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineConfig } from "../config/define-config";
|
|
2
|
-
import type { CommerceConfig } from "../config/types";
|
|
3
|
-
import { Ok } from "../kernel/result";
|
|
4
|
-
import type { StorageAdapter } from "../modules/media/adapter";
|
|
1
|
+
import { defineConfig } from "../config/define-config.js";
|
|
2
|
+
import type { CommerceConfig } from "../config/types.js";
|
|
3
|
+
import { Ok } from "../kernel/result.js";
|
|
4
|
+
import type { StorageAdapter } from "../modules/media/adapter.js";
|
|
5
5
|
|
|
6
6
|
function createInMemoryStorageAdapter(): StorageAdapter {
|
|
7
7
|
const files = new Map<string, { data: ArrayBuffer; contentType: string }>();
|
|
@@ -52,7 +52,7 @@ export async function createTestConfig(
|
|
|
52
52
|
): Promise<CommerceConfig> {
|
|
53
53
|
// Auto-provision PGlite when no databaseAdapter is provided
|
|
54
54
|
if (!overrides.databaseAdapter) {
|
|
55
|
-
const { createPGliteTestAdapter } = await import("./create-pglite-adapter");
|
|
55
|
+
const { createPGliteTestAdapter } = await import("./create-pglite-adapter.js");
|
|
56
56
|
const { adapter } = await createPGliteTestAdapter();
|
|
57
57
|
overrides = { ...overrides, databaseAdapter: adapter };
|
|
58
58
|
}
|
|
@@ -178,7 +178,7 @@ export async function createTestConfig(
|
|
|
178
178
|
export async function createPGliteTestConfig(
|
|
179
179
|
overrides: Partial<CommerceConfig> = {},
|
|
180
180
|
): Promise<{ config: CommerceConfig; cleanup: () => Promise<void> }> {
|
|
181
|
-
const { createPGliteTestAdapter } = await import("./create-pglite-adapter");
|
|
181
|
+
const { createPGliteTestAdapter } = await import("./create-pglite-adapter.js");
|
|
182
182
|
const { adapter, cleanup } = await createPGliteTestAdapter();
|
|
183
183
|
|
|
184
184
|
const config = await createTestConfig({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CommerceConfig } from "../config/types";
|
|
2
|
-
import { createKernel } from "../runtime/kernel";
|
|
3
|
-
import { createTestConfig } from "./create-test-config";
|
|
1
|
+
import type { CommerceConfig } from "../config/types.js";
|
|
2
|
+
import { createKernel } from "../runtime/kernel.js";
|
|
3
|
+
import { createTestConfig } from "./create-test-config.js";
|
|
4
4
|
|
|
5
5
|
export async function createTestKernel(overrides: Partial<CommerceConfig> = {}) {
|
|
6
6
|
return createKernel(await createTestConfig(overrides));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HookRegistry } from "../kernel/hooks/registry";
|
|
2
|
-
import { createLogger } from "../utils/logger";
|
|
3
|
-
import { createTestConfig } from "./create-test-config";
|
|
4
|
-
import type { CommerceConfig, MCPTool } from "../config/types";
|
|
1
|
+
import { HookRegistry } from "../kernel/hooks/registry.js";
|
|
2
|
+
import { createLogger } from "../utils/logger.js";
|
|
3
|
+
import { createTestConfig } from "./create-test-config.js";
|
|
4
|
+
import type { CommerceConfig, MCPTool } from "../config/types.js";
|
|
5
5
|
|
|
6
6
|
interface PluginContextShape {
|
|
7
7
|
hooks: HookRegistry;
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { Hono } from "hono";
|
|
9
|
-
import { createKernel } from "../runtime/kernel";
|
|
10
|
-
import { createAuth } from "../auth/setup";
|
|
11
|
-
import { authMiddleware } from "../auth/middleware";
|
|
12
|
-
import { createRestRoutes } from "../interfaces/rest";
|
|
13
|
-
import { createPGliteTestConfig } from "./create-test-config";
|
|
14
|
-
import { CommerceValidationError } from "../kernel/errors";
|
|
15
|
-
import { Ok, Err } from "../kernel/result";
|
|
16
|
-
import type { CommerceConfig } from "../config/types";
|
|
17
|
-
import type { Actor } from "../auth/types";
|
|
18
|
-
import type { AuthInstance } from "../auth/setup";
|
|
9
|
+
import { createKernel } from "../runtime/kernel.js";
|
|
10
|
+
import { createAuth } from "../auth/setup.js";
|
|
11
|
+
import { authMiddleware } from "../auth/middleware.js";
|
|
12
|
+
import { createRestRoutes } from "../interfaces/rest/index.js";
|
|
13
|
+
import { createPGliteTestConfig } from "./create-test-config.js";
|
|
14
|
+
import { CommerceValidationError } from "../kernel/errors.js";
|
|
15
|
+
import { Ok, Err } from "../kernel/result.js";
|
|
16
|
+
import type { CommerceConfig } from "../config/types.js";
|
|
17
|
+
import type { Actor } from "../auth/types.js";
|
|
18
|
+
import type { AuthInstance } from "../auth/setup.js";
|
|
19
19
|
|
|
20
20
|
type ServerEnv = {
|
|
21
21
|
Variables: {
|
|
@@ -122,7 +122,7 @@ export async function createTestServer(
|
|
|
122
122
|
await next();
|
|
123
123
|
} catch (error) {
|
|
124
124
|
// Import error handling utilities
|
|
125
|
-
const { mapErrorToResponse, mapErrorToStatus } = await import("../interfaces/rest/utils");
|
|
125
|
+
const { mapErrorToResponse, mapErrorToStatus } = await import("../interfaces/rest/utils.js");
|
|
126
126
|
return c.json(
|
|
127
127
|
mapErrorToResponse(error),
|
|
128
128
|
mapErrorToStatus(error),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PluginHookRegistration } from "../kernel/plugin/manifest";
|
|
2
|
-
import type { HookContext, HookOperation } from "../kernel/hooks/types";
|
|
1
|
+
import type { PluginHookRegistration } from "../kernel/plugin/manifest.js";
|
|
2
|
+
import type { HookContext, HookOperation } from "../kernel/hooks/types.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates a typed before-hook registration for plugins.
|