@porulle/core 0.64.0 → 0.65.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/email-render.d.ts +18 -0
- package/dist/adapters/email-render.d.ts.map +1 -0
- package/dist/adapters/email-render.js +37 -0
- package/dist/auth/actor.d.ts.map +1 -1
- package/dist/auth/actor.js +11 -0
- package/dist/auth/auth-failure.d.ts +0 -2
- package/dist/auth/auth-failure.d.ts.map +1 -1
- package/dist/auth/auth-failure.js +0 -4
- package/dist/auth/middleware.d.ts +0 -1
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +7 -6
- package/dist/auth/permissions.d.ts +2 -0
- package/dist/auth/permissions.d.ts.map +1 -1
- package/dist/auth/permissions.js +8 -6
- package/dist/auth/role-authority.d.ts +0 -1
- package/dist/auth/role-authority.d.ts.map +1 -1
- package/dist/auth/role-authority.js +1 -8
- package/dist/auth/setup.d.ts.map +1 -1
- package/dist/auth/setup.js +5 -0
- package/dist/auth/strict-org-resolution.d.ts +8 -1
- package/dist/auth/strict-org-resolution.d.ts.map +1 -1
- package/dist/auth/strict-org-resolution.js +9 -19
- package/dist/auth/system-actor.d.ts +3 -2
- package/dist/auth/system-actor.d.ts.map +1 -1
- package/dist/auth/system-actor.js +3 -3
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +3 -20
- package/dist/config/define-config.d.ts +2 -2
- package/dist/config/define-config.d.ts.map +1 -1
- package/dist/config/define-config.js +3 -2
- package/dist/config/types.d.ts +2 -3
- package/dist/config/types.d.ts.map +1 -1
- package/dist/hooks/checkout.d.ts +2 -15
- package/dist/hooks/checkout.d.ts.map +1 -1
- package/dist/hooks/checkout.js +2 -51
- package/dist/index.d.ts +11 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -12
- package/dist/interfaces/rest/router.js +3 -3
- package/dist/interfaces/rest/routes/admin/compensation-failures.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/admin/compensation-failures.js +5 -5
- package/dist/interfaces/rest/routes/admin/entity-field-definitions.js +5 -5
- package/dist/interfaces/rest/routes/admin/staff.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/admin/staff.js +2 -3
- package/dist/interfaces/rest/routes/analytics.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/analytics.js +2 -2
- package/dist/interfaces/rest/routes/carts.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/carts.js +12 -12
- package/dist/interfaces/rest/routes/catalog.js +37 -37
- package/dist/interfaces/rest/routes/checkout.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/checkout.js +9 -10
- package/dist/interfaces/rest/routes/customers.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/customers.js +12 -12
- package/dist/interfaces/rest/routes/documents.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/documents.js +9 -9
- package/dist/interfaces/rest/routes/inventory.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/inventory.js +8 -8
- package/dist/interfaces/rest/routes/media.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/media.js +5 -5
- package/dist/interfaces/rest/routes/orders.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/orders.js +32 -32
- 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.map +1 -1
- package/dist/interfaces/rest/routes/pricing.js +8 -8
- package/dist/interfaces/rest/routes/promotions.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/promotions.js +7 -7
- package/dist/interfaces/rest/routes/search.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/search.js +3 -3
- package/dist/interfaces/rest/routes/settings.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/settings.js +4 -4
- package/dist/interfaces/rest/routes/shipping.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/shipping.js +9 -9
- package/dist/interfaces/rest/routes/tax.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/tax.js +9 -9
- package/dist/interfaces/rest/routes/webhooks.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/webhooks.js +4 -4
- package/dist/interfaces/rest/utils.d.ts +1 -1
- package/dist/interfaces/rest/utils.d.ts.map +1 -1
- package/dist/interfaces/rest/utils.js +4 -13
- package/dist/jobs.d.ts +1 -0
- package/dist/jobs.d.ts.map +1 -1
- package/dist/jobs.js +1 -0
- package/dist/kernel/database/adapter.d.ts +9 -0
- package/dist/kernel/database/adapter.d.ts.map +1 -1
- package/dist/kernel/database/adapter.js +1 -1
- package/dist/kernel/database/migrate.d.ts +0 -4
- package/dist/kernel/database/migrate.d.ts.map +1 -1
- package/dist/kernel/database/migrate.js +2 -14
- package/dist/kernel/database/pglite-transaction.d.ts +28 -0
- package/dist/kernel/database/pglite-transaction.d.ts.map +1 -0
- package/dist/kernel/database/pglite-transaction.js +52 -0
- package/dist/kernel/database/tx-context.d.ts +0 -1
- package/dist/kernel/database/tx-context.d.ts.map +1 -1
- package/dist/kernel/database/tx-context.js +2 -14
- package/dist/kernel/database/unique-violation.d.ts +3 -0
- package/dist/kernel/database/unique-violation.d.ts.map +1 -0
- package/dist/kernel/database/unique-violation.js +9 -0
- package/dist/kernel/error-mapper.d.ts.map +1 -1
- package/dist/kernel/error-mapper.js +1 -0
- package/dist/kernel/errors.d.ts +12 -0
- package/dist/kernel/errors.d.ts.map +1 -1
- package/dist/kernel/errors.js +16 -0
- package/dist/kernel/hooks/create-context.d.ts +18 -9
- package/dist/kernel/hooks/create-context.d.ts.map +1 -1
- package/dist/kernel/hooks/create-context.js +24 -3
- package/dist/kernel/hooks/registry.d.ts +0 -19
- package/dist/kernel/hooks/registry.d.ts.map +1 -1
- package/dist/kernel/hooks/registry.js +0 -32
- package/dist/kernel/jobs/drizzle-adapter.d.ts.map +1 -1
- package/dist/kernel/jobs/drizzle-adapter.js +3 -10
- package/dist/kernel/jobs/prepare-enqueue.d.ts +20 -0
- package/dist/kernel/jobs/prepare-enqueue.d.ts.map +1 -0
- package/dist/kernel/jobs/prepare-enqueue.js +24 -0
- package/dist/kernel/jobs/types.d.ts +0 -4
- package/dist/kernel/jobs/types.d.ts.map +1 -1
- package/dist/kernel/jobs/types.js +0 -4
- package/dist/kernel/local-api.d.ts +0 -33
- package/dist/kernel/local-api.d.ts.map +1 -1
- package/dist/kernel/local-api.js +0 -36
- package/dist/kernel/plugin/manifest.d.ts +3 -5
- package/dist/kernel/plugin/manifest.d.ts.map +1 -1
- package/dist/modules/analytics/service.d.ts +0 -6
- package/dist/modules/analytics/service.d.ts.map +1 -1
- package/dist/modules/analytics/service.js +0 -32
- package/dist/modules/cart/service.d.ts.map +1 -1
- package/dist/modules/cart/service.js +5 -17
- package/dist/modules/catalog/entity-service.d.ts.map +1 -1
- package/dist/modules/catalog/entity-service.js +9 -17
- package/dist/modules/catalog/import-service.d.ts.map +1 -1
- package/dist/modules/catalog/import-service.js +4 -13
- package/dist/modules/catalog/service.d.ts +1 -81
- package/dist/modules/catalog/service.d.ts.map +1 -1
- package/dist/modules/catalog/service.js +1 -8
- package/dist/modules/customers/service.d.ts.map +1 -1
- package/dist/modules/customers/service.js +5 -17
- package/dist/modules/documents/render.d.ts +0 -3
- package/dist/modules/documents/render.d.ts.map +1 -1
- package/dist/modules/documents/render.js +2 -17
- package/dist/modules/fulfillment/service.d.ts.map +1 -1
- package/dist/modules/fulfillment/service.js +8 -26
- package/dist/modules/inventory/service.d.ts.map +1 -1
- package/dist/modules/inventory/service.js +3 -20
- package/dist/modules/media/service.d.ts.map +1 -1
- package/dist/modules/media/service.js +2 -10
- package/dist/modules/orders/quote.d.ts.map +1 -1
- package/dist/modules/orders/quote.js +1 -2
- package/dist/modules/orders/service.d.ts.map +1 -1
- package/dist/modules/orders/service.js +4 -17
- package/dist/modules/pricing/service.d.ts.map +1 -1
- package/dist/modules/pricing/service.js +7 -18
- package/dist/modules/promotions/service.d.ts.map +1 -1
- package/dist/modules/promotions/service.js +4 -16
- package/dist/modules/tax/service.d.ts +1 -3
- package/dist/modules/tax/service.d.ts.map +1 -1
- package/dist/modules/tax/service.js +16 -52
- package/dist/modules/webhooks/hook.d.ts.map +1 -1
- package/dist/modules/webhooks/hook.js +3 -2
- package/dist/modules/webhooks/service.d.ts.map +1 -1
- package/dist/modules/webhooks/service.js +1 -50
- package/dist/runtime/commerce.d.ts.map +1 -1
- package/dist/runtime/commerce.js +4 -11
- package/dist/runtime/kernel-modules.d.ts +38 -1799
- package/dist/runtime/kernel-modules.d.ts.map +1 -1
- package/dist/runtime/kernel-modules.js +160 -66
- package/dist/runtime/kernel-types.d.ts +3 -15
- package/dist/runtime/kernel-types.d.ts.map +1 -1
- package/dist/runtime/kernel-types.js +0 -10
- package/dist/runtime/kernel.d.ts +2 -3
- package/dist/runtime/kernel.d.ts.map +1 -1
- package/dist/runtime/kernel.js +10 -51
- package/dist/runtime/server.d.ts +1 -1
- package/dist/runtime/server.d.ts.map +1 -1
- package/dist/test-utils/create-pglite-adapter.d.ts.map +1 -1
- package/dist/test-utils/create-pglite-adapter.js +5 -62
- package/dist/test-utils/create-plugin-test-app.d.ts.map +1 -1
- package/dist/test-utils/create-plugin-test-app.js +13 -32
- package/dist/test-utils/rest-api-test-utils.d.ts +0 -12
- package/dist/test-utils/rest-api-test-utils.d.ts.map +1 -1
- package/dist/test-utils/rest-api-test-utils.js +3 -70
- package/dist/test-utils/test-actors.d.ts +9 -0
- package/dist/test-utils/test-actors.d.ts.map +1 -1
- package/dist/test-utils/test-actors.js +62 -0
- package/dist/testing.d.ts +1 -4
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1 -4
- package/dist/utils/escape-html.d.ts +3 -0
- package/dist/utils/escape-html.d.ts.map +1 -0
- package/dist/utils/escape-html.js +9 -0
- package/dist/utils/id.d.ts +0 -1
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +0 -3
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/utils/money.d.ts +13 -0
- package/dist/utils/money.d.ts.map +1 -0
- package/dist/utils/money.js +58 -0
- package/package.json +26 -29
- package/src/adapters/email-render.ts +63 -0
- package/src/auth/actor.ts +14 -0
- package/src/auth/auth-failure.ts +0 -5
- package/src/auth/middleware.ts +7 -6
- package/src/auth/permissions.ts +12 -6
- package/src/auth/role-authority.ts +1 -10
- package/src/auth/setup.ts +8 -0
- package/src/auth/strict-org-resolution.ts +9 -16
- package/src/auth/system-actor.ts +3 -3
- package/src/config/defaults.ts +3 -20
- package/src/config/define-config.ts +5 -4
- package/src/config/types.ts +2 -2
- package/src/hooks/checkout.ts +2 -86
- package/src/index.ts +9 -36
- package/src/interfaces/rest/router.ts +3 -3
- package/src/interfaces/rest/routes/admin/compensation-failures.ts +5 -5
- package/src/interfaces/rest/routes/admin/entity-field-definitions.ts +5 -5
- package/src/interfaces/rest/routes/admin/staff.ts +2 -3
- package/src/interfaces/rest/routes/analytics.ts +2 -2
- package/src/interfaces/rest/routes/carts.ts +12 -12
- package/src/interfaces/rest/routes/catalog.ts +37 -37
- package/src/interfaces/rest/routes/checkout.ts +8 -10
- package/src/interfaces/rest/routes/customers.ts +12 -12
- package/src/interfaces/rest/routes/documents.ts +9 -9
- package/src/interfaces/rest/routes/inventory.ts +8 -8
- package/src/interfaces/rest/routes/media.ts +5 -5
- package/src/interfaces/rest/routes/orders.ts +32 -32
- package/src/interfaces/rest/routes/payments.ts +2 -2
- package/src/interfaces/rest/routes/pricing.ts +8 -8
- package/src/interfaces/rest/routes/promotions.ts +7 -7
- package/src/interfaces/rest/routes/search.ts +3 -3
- package/src/interfaces/rest/routes/settings.ts +4 -4
- package/src/interfaces/rest/routes/shipping.ts +9 -9
- package/src/interfaces/rest/routes/tax.ts +9 -9
- package/src/interfaces/rest/routes/webhooks.ts +4 -4
- package/src/interfaces/rest/utils.ts +4 -14
- package/src/jobs.ts +2 -1
- package/src/kernel/database/adapter.ts +1 -1
- package/src/kernel/database/migrate.ts +2 -17
- package/src/kernel/database/pglite-transaction.ts +61 -0
- package/src/kernel/database/tx-context.ts +2 -20
- package/src/kernel/database/unique-violation.ts +7 -0
- package/src/kernel/error-mapper.ts +1 -0
- package/src/kernel/errors.ts +18 -0
- package/src/kernel/hooks/create-context.ts +38 -8
- package/src/kernel/hooks/registry.ts +0 -37
- package/src/kernel/jobs/drizzle-adapter.ts +4 -15
- package/src/kernel/jobs/prepare-enqueue.ts +42 -0
- package/src/kernel/jobs/types.ts +0 -5
- package/src/kernel/local-api.ts +0 -44
- package/src/kernel/plugin/manifest.ts +3 -5
- package/src/modules/analytics/service.ts +0 -36
- package/src/modules/cart/service.ts +6 -29
- package/src/modules/catalog/entity-service.ts +9 -19
- package/src/modules/catalog/import-service.ts +4 -11
- package/src/modules/catalog/service.ts +2 -286
- package/src/modules/customers/service.ts +6 -27
- package/src/modules/documents/render.ts +2 -19
- package/src/modules/fulfillment/service.ts +8 -27
- package/src/modules/inventory/service.ts +3 -21
- package/src/modules/media/service.ts +2 -8
- package/src/modules/orders/quote.ts +1 -2
- package/src/modules/orders/service.ts +5 -30
- package/src/modules/pricing/service.ts +12 -30
- package/src/modules/promotions/service.ts +5 -28
- package/src/modules/tax/service.ts +20 -48
- package/src/modules/webhooks/hook.ts +3 -2
- package/src/modules/webhooks/service.ts +1 -42
- package/src/runtime/commerce.ts +4 -11
- package/src/runtime/kernel-modules.ts +191 -67
- package/src/runtime/kernel-types.ts +3 -26
- package/src/runtime/kernel.ts +11 -66
- package/src/runtime/server.ts +1 -3
- package/src/test-utils/create-pglite-adapter.ts +5 -67
- package/src/test-utils/create-plugin-test-app.ts +13 -52
- package/src/test-utils/rest-api-test-utils.ts +3 -70
- package/src/test-utils/test-actors.ts +66 -0
- package/src/testing.ts +1 -3
- package/src/utils/escape-html.ts +9 -0
- package/src/utils/id.ts +0 -4
- package/src/utils/logger.ts +1 -1
- package/src/utils/money.ts +62 -0
- package/dist/auth/access.d.ts +0 -101
- package/dist/auth/access.d.ts.map +0 -1
- package/dist/auth/access.js +0 -128
- package/dist/generated/plugin-manifest.d.ts +0 -51
- package/dist/generated/plugin-manifest.d.ts.map +0 -1
- package/dist/generated/plugin-manifest.js +0 -21
- package/dist/kernel/factory/repository-factory.d.ts +0 -71
- package/dist/kernel/factory/repository-factory.d.ts.map +0 -1
- package/dist/kernel/factory/repository-factory.js +0 -138
- package/dist/kernel/http-error.d.ts +0 -30
- package/dist/kernel/http-error.d.ts.map +0 -1
- package/dist/kernel/http-error.js +0 -35
- package/dist/kernel/jobs/builtin-job-tasks.d.ts +0 -3
- package/dist/kernel/jobs/builtin-job-tasks.d.ts.map +0 -1
- package/dist/kernel/jobs/builtin-job-tasks.js +0 -6
- package/dist/kernel/module/define.d.ts +0 -21
- package/dist/kernel/module/define.d.ts.map +0 -1
- package/dist/kernel/module/define.js +0 -3
- package/dist/kernel/module/index.d.ts +0 -4
- package/dist/kernel/module/index.d.ts.map +0 -1
- package/dist/kernel/module/index.js +0 -2
- package/dist/kernel/module/topo-sort.d.ts +0 -7
- package/dist/kernel/module/topo-sort.d.ts.map +0 -1
- package/dist/kernel/module/topo-sort.js +0 -89
- package/dist/kernel/query/executor.d.ts +0 -21
- package/dist/kernel/query/executor.d.ts.map +0 -1
- package/dist/kernel/query/executor.js +0 -128
- package/dist/kernel/query/registry.d.ts +0 -33
- package/dist/kernel/query/registry.d.ts.map +0 -1
- package/dist/kernel/query/registry.js +0 -20
- package/dist/kernel/service-registry.d.ts +0 -109
- package/dist/kernel/service-registry.d.ts.map +0 -1
- package/dist/kernel/service-registry.js +0 -26
- package/dist/modules/analytics/hooks.d.ts +0 -13
- package/dist/modules/analytics/hooks.d.ts.map +0 -1
- package/dist/modules/analytics/hooks.js +0 -12
- package/dist/modules/analytics/module.d.ts +0 -3
- package/dist/modules/analytics/module.d.ts.map +0 -1
- package/dist/modules/analytics/module.js +0 -24
- package/dist/modules/analytics/repository/index.d.ts +0 -5
- package/dist/modules/analytics/repository/index.d.ts.map +0 -1
- package/dist/modules/analytics/repository/index.js +0 -1
- package/dist/modules/audit/index.d.ts +0 -2
- package/dist/modules/audit/index.d.ts.map +0 -1
- package/dist/modules/audit/index.js +0 -1
- package/dist/modules/audit/module.d.ts +0 -180
- package/dist/modules/audit/module.d.ts.map +0 -1
- package/dist/modules/audit/module.js +0 -8
- package/dist/modules/cart/access.d.ts +0 -11
- package/dist/modules/cart/access.d.ts.map +0 -1
- package/dist/modules/cart/access.js +0 -18
- package/dist/modules/cart/module.d.ts +0 -14
- package/dist/modules/cart/module.d.ts.map +0 -1
- package/dist/modules/cart/module.js +0 -17
- package/dist/modules/catalog/module.d.ts +0 -26
- package/dist/modules/catalog/module.d.ts.map +0 -1
- package/dist/modules/catalog/module.js +0 -33
- package/dist/modules/customers/index.d.ts +0 -2
- package/dist/modules/customers/index.d.ts.map +0 -1
- package/dist/modules/customers/index.js +0 -1
- package/dist/modules/customers/module.d.ts +0 -563
- package/dist/modules/customers/module.d.ts.map +0 -1
- package/dist/modules/customers/module.js +0 -20
- package/dist/modules/documents/module.d.ts +0 -7
- package/dist/modules/documents/module.d.ts.map +0 -1
- package/dist/modules/documents/module.js +0 -13
- package/dist/modules/fulfillment/module.d.ts +0 -13
- package/dist/modules/fulfillment/module.d.ts.map +0 -1
- package/dist/modules/fulfillment/module.js +0 -23
- package/dist/modules/inventory/module.d.ts +0 -13
- package/dist/modules/inventory/module.d.ts.map +0 -1
- package/dist/modules/inventory/module.js +0 -20
- package/dist/modules/media/index.d.ts +0 -2
- package/dist/modules/media/index.d.ts.map +0 -1
- package/dist/modules/media/index.js +0 -1
- package/dist/modules/media/module.d.ts +0 -360
- package/dist/modules/media/module.d.ts.map +0 -1
- package/dist/modules/media/module.js +0 -24
- package/dist/modules/orders/module.d.ts +0 -25
- package/dist/modules/orders/module.d.ts.map +0 -1
- package/dist/modules/orders/module.js +0 -33
- package/dist/modules/organization/index.d.ts +0 -2
- package/dist/modules/organization/index.d.ts.map +0 -1
- package/dist/modules/organization/index.js +0 -1
- package/dist/modules/organization/module.d.ts +0 -205
- package/dist/modules/organization/module.d.ts.map +0 -1
- package/dist/modules/organization/module.js +0 -8
- package/dist/modules/payments/module.d.ts +0 -3
- package/dist/modules/payments/module.d.ts.map +0 -1
- package/dist/modules/payments/module.js +0 -7
- package/dist/modules/payments/repository/index.d.ts +0 -5
- package/dist/modules/payments/repository/index.d.ts.map +0 -1
- package/dist/modules/payments/repository/index.js +0 -1
- package/dist/modules/pricing/index.d.ts +0 -2
- package/dist/modules/pricing/index.d.ts.map +0 -1
- package/dist/modules/pricing/index.js +0 -1
- package/dist/modules/pricing/module.d.ts +0 -14
- package/dist/modules/pricing/module.d.ts.map +0 -1
- package/dist/modules/pricing/module.js +0 -17
- package/dist/modules/promotions/module.d.ts +0 -14
- package/dist/modules/promotions/module.d.ts.map +0 -1
- package/dist/modules/promotions/module.js +0 -19
- package/dist/modules/search/module.d.ts +0 -8
- package/dist/modules/search/module.d.ts.map +0 -1
- package/dist/modules/search/module.js +0 -22
- package/dist/modules/search/repository/index.d.ts +0 -5
- package/dist/modules/search/repository/index.d.ts.map +0 -1
- package/dist/modules/search/repository/index.js +0 -1
- package/dist/modules/settings/module.d.ts +0 -6
- package/dist/modules/settings/module.d.ts.map +0 -1
- package/dist/modules/settings/module.js +0 -12
- package/dist/modules/shipping/module.d.ts +0 -12
- package/dist/modules/shipping/module.d.ts.map +0 -1
- package/dist/modules/shipping/module.js +0 -14
- package/dist/modules/tax/module.d.ts +0 -7
- package/dist/modules/tax/module.d.ts.map +0 -1
- package/dist/modules/tax/module.js +0 -13
- package/dist/modules/webhooks/index.d.ts +0 -2
- package/dist/modules/webhooks/index.d.ts.map +0 -1
- package/dist/modules/webhooks/index.js +0 -1
- package/dist/modules/webhooks/module.d.ts +0 -403
- package/dist/modules/webhooks/module.d.ts.map +0 -1
- package/dist/modules/webhooks/module.js +0 -16
- package/dist/test-utils/create-repository-test-harness.d.ts +0 -8
- package/dist/test-utils/create-repository-test-harness.d.ts.map +0 -1
- package/dist/test-utils/create-repository-test-harness.js +0 -7
- package/dist/test-utils/create-test-plugin-context.d.ts +0 -38
- package/dist/test-utils/create-test-plugin-context.d.ts.map +0 -1
- package/dist/test-utils/create-test-plugin-context.js +0 -39
- package/dist/test-utils/typed-hooks.d.ts +0 -44
- package/dist/test-utils/typed-hooks.d.ts.map +0 -1
- package/dist/test-utils/typed-hooks.js +0 -36
- package/dist/types/commerce-types.d.ts +0 -34
- package/dist/types/commerce-types.d.ts.map +0 -1
- package/dist/types/commerce-types.js +0 -1
- package/src/auth/access.ts +0 -187
- package/src/generated/plugin-capabilities.d.ts +0 -21
- package/src/generated/plugin-manifest.ts +0 -24
- package/src/generated/plugin-repositories.d.ts +0 -21
- package/src/kernel/factory/repository-factory.ts +0 -244
- package/src/kernel/http-error.ts +0 -44
- package/src/kernel/jobs/builtin-job-tasks.ts +0 -17
- package/src/kernel/module/define.ts +0 -36
- package/src/kernel/module/index.ts +0 -3
- package/src/kernel/module/topo-sort.ts +0 -99
- package/src/kernel/query/executor.ts +0 -184
- package/src/kernel/query/registry.ts +0 -46
- package/src/kernel/service-registry.ts +0 -76
- package/src/modules/analytics/hooks.ts +0 -11
- package/src/modules/analytics/module.ts +0 -35
- package/src/modules/analytics/repository/index.ts +0 -5
- package/src/modules/audit/index.ts +0 -1
- package/src/modules/audit/module.ts +0 -11
- package/src/modules/cart/access.ts +0 -27
- package/src/modules/cart/module.ts +0 -32
- package/src/modules/catalog/module.ts +0 -80
- package/src/modules/customers/index.ts +0 -1
- package/src/modules/customers/module.ts +0 -29
- package/src/modules/documents/module.ts +0 -21
- package/src/modules/fulfillment/module.ts +0 -44
- package/src/modules/inventory/module.ts +0 -37
- package/src/modules/media/index.ts +0 -1
- package/src/modules/media/module.ts +0 -27
- package/src/modules/orders/module.ts +0 -67
- package/src/modules/organization/index.ts +0 -1
- package/src/modules/organization/module.ts +0 -11
- package/src/modules/payments/module.ts +0 -14
- package/src/modules/payments/repository/index.ts +0 -5
- package/src/modules/pricing/index.ts +0 -1
- package/src/modules/pricing/module.ts +0 -32
- package/src/modules/promotions/module.ts +0 -34
- package/src/modules/search/module.ts +0 -32
- package/src/modules/search/repository/index.ts +0 -5
- package/src/modules/settings/module.ts +0 -20
- package/src/modules/shipping/module.ts +0 -27
- package/src/modules/tax/module.ts +0 -21
- package/src/modules/webhooks/index.ts +0 -1
- package/src/modules/webhooks/module.ts +0 -24
- package/src/test-utils/create-repository-test-harness.ts +0 -16
- package/src/test-utils/create-test-plugin-context.ts +0 -66
- package/src/test-utils/typed-hooks.ts +0 -55
- package/src/types/commerce-types.ts +0 -34
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// AUTO-GENERATED by scripts/generate-plugin-types.mjs
|
|
3
|
-
// DO NOT EDIT MANUALLY.
|
|
4
|
-
export const resolvedPluginManifest = [
|
|
5
|
-
{ id: "appointments", directory: "plugin-appointments" },
|
|
6
|
-
{ id: "channel-connector", directory: "plugin-channel-connector" },
|
|
7
|
-
{ id: "gift-cards", directory: "plugin-gift-cards" },
|
|
8
|
-
{ id: "layaway", directory: "plugin-layaway" },
|
|
9
|
-
{ id: "loyalty", directory: "plugin-loyalty" },
|
|
10
|
-
{ id: "marketplace", directory: "plugin-marketplace" },
|
|
11
|
-
{ id: "notifications", directory: "plugin-notifications" },
|
|
12
|
-
{ id: "pos", directory: "plugin-pos" },
|
|
13
|
-
{ id: "pos-restaurant", directory: "plugin-pos-restaurant" },
|
|
14
|
-
{ id: "procurement", directory: "plugin-procurement" },
|
|
15
|
-
{ id: "production", directory: "plugin-production" },
|
|
16
|
-
{ id: "reviews", directory: "plugin-reviews" },
|
|
17
|
-
{ id: "scheduled-orders", directory: "plugin-scheduled-orders" },
|
|
18
|
-
{ id: "uom", directory: "plugin-uom" },
|
|
19
|
-
{ id: "warehouse", directory: "plugin-warehouse" },
|
|
20
|
-
{ id: "wishlist", directory: "plugin-wishlist" },
|
|
21
|
-
];
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { type InferSelectModel, type InferInsertModel } from "drizzle-orm";
|
|
2
|
-
import type { PgTableWithColumns, TableConfig } from "drizzle-orm/pg-core";
|
|
3
|
-
import type { TxContext } from "../database/tx-context.js";
|
|
4
|
-
import type { DrizzleDatabase } from "../database/drizzle-db.js";
|
|
5
|
-
/**
|
|
6
|
-
* Filter type — partial record of column values to match with eq().
|
|
7
|
-
* Only keys that exist on TRow and have non-undefined values are used.
|
|
8
|
-
*/
|
|
9
|
-
export type Filters<TRow> = Partial<TRow>;
|
|
10
|
-
/**
|
|
11
|
-
* Options for findMany / findAndCount queries.
|
|
12
|
-
*/
|
|
13
|
-
export interface FindOptions {
|
|
14
|
-
limit?: number;
|
|
15
|
-
offset?: number;
|
|
16
|
-
orderBy?: Array<{
|
|
17
|
-
column: string;
|
|
18
|
-
direction: "asc" | "desc";
|
|
19
|
-
}>;
|
|
20
|
-
withDeleted?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Standard CRUD operations derived from a Drizzle pgTable schema.
|
|
24
|
-
* All methods support optional TxContext for transaction participation.
|
|
25
|
-
*/
|
|
26
|
-
export interface BaseRepository<TRow, TInsert> {
|
|
27
|
-
findById(id: string, ctx?: TxContext): Promise<TRow | undefined>;
|
|
28
|
-
findMany(filters?: Filters<TRow>, options?: FindOptions, ctx?: TxContext): Promise<TRow[]>;
|
|
29
|
-
findAndCount(filters?: Filters<TRow>, options?: FindOptions, ctx?: TxContext): Promise<{
|
|
30
|
-
rows: TRow[];
|
|
31
|
-
total: number;
|
|
32
|
-
}>;
|
|
33
|
-
create(data: TInsert, ctx?: TxContext): Promise<TRow>;
|
|
34
|
-
createMany(data: TInsert[], ctx?: TxContext): Promise<TRow[]>;
|
|
35
|
-
update(id: string, data: Partial<TInsert>, ctx?: TxContext): Promise<TRow>;
|
|
36
|
-
delete(id: string, ctx?: TxContext): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Extended repository for tables with a `deleted_at` column.
|
|
40
|
-
* Adds softDelete and restore operations.
|
|
41
|
-
*/
|
|
42
|
-
export interface SoftDeletableRepository<TRow, TInsert> extends BaseRepository<TRow, TInsert> {
|
|
43
|
-
softDelete(id: string, ctx?: TxContext): Promise<void>;
|
|
44
|
-
restore(id: string, ctx?: TxContext): Promise<TRow>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Type-level check: does the table config have a `deletedAt` or `deleted_at` column?
|
|
48
|
-
*/
|
|
49
|
-
type HasDeletedAt<T extends PgTableWithColumns<TableConfig>> = "deletedAt" extends keyof T ? true : "deleted_at" extends keyof T ? true : false;
|
|
50
|
-
/**
|
|
51
|
-
* Conditional repository type: if the table has a deleted_at column,
|
|
52
|
-
* return SoftDeletableRepository; otherwise BaseRepository.
|
|
53
|
-
*/
|
|
54
|
-
export type RepositoryFor<T extends PgTableWithColumns<TableConfig>> = HasDeletedAt<T> extends true ? SoftDeletableRepository<InferSelectModel<T>, InferInsertModel<T>> : BaseRepository<InferSelectModel<T>, InferInsertModel<T>>;
|
|
55
|
-
/**
|
|
56
|
-
* Creates a typed repository with standard CRUD operations from a Drizzle table schema.
|
|
57
|
-
*
|
|
58
|
-
* Usage:
|
|
59
|
-
* ```typescript
|
|
60
|
-
* const repo = createRepository(schema.promotions, db)
|
|
61
|
-
* const row = await repo.findById("abc-123")
|
|
62
|
-
* const rows = await repo.findMany({ status: "active" }, { limit: 10 })
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* Tables with a `deletedAt` column automatically get `softDelete()` and `restore()`.
|
|
66
|
-
* Domain-specific queries should remain in dedicated repository classes that
|
|
67
|
-
* delegate standard CRUD to the factory-created instance.
|
|
68
|
-
*/
|
|
69
|
-
export declare function createRepository<T extends PgTableWithColumns<TableConfig>>(table: T, db: DrizzleDatabase): RepositoryFor<T>;
|
|
70
|
-
export {};
|
|
71
|
-
//# sourceMappingURL=repository-factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repository-factory.d.ts","sourceRoot":"","sources":["../../../src/kernel/factory/repository-factory.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { eq, and, isNull, sql, getTableColumns, } from "drizzle-orm";
|
|
2
|
-
import { CommerceNotFoundError } from "../errors.js";
|
|
3
|
-
/**
|
|
4
|
-
* Creates a typed repository with standard CRUD operations from a Drizzle table schema.
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* ```typescript
|
|
8
|
-
* const repo = createRepository(schema.promotions, db)
|
|
9
|
-
* const row = await repo.findById("abc-123")
|
|
10
|
-
* const rows = await repo.findMany({ status: "active" }, { limit: 10 })
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* Tables with a `deletedAt` column automatically get `softDelete()` and `restore()`.
|
|
14
|
-
* Domain-specific queries should remain in dedicated repository classes that
|
|
15
|
-
* delegate standard CRUD to the factory-created instance.
|
|
16
|
-
*/
|
|
17
|
-
export function createRepository(table, db) {
|
|
18
|
-
// Use getTableColumns for type-safe column access
|
|
19
|
-
const columns = getTableColumns(table);
|
|
20
|
-
// Runtime check for soft-delete column
|
|
21
|
-
const hasSoftDelete = "deletedAt" in columns || "deleted_at" in columns;
|
|
22
|
-
const deletedAtColumn = columns["deletedAt"] ?? columns["deleted_at"] ?? null;
|
|
23
|
-
const idColumn = columns["id"];
|
|
24
|
-
// Drizzle's generic types require PgTable at the boundary.
|
|
25
|
-
// We cast once here rather than at every call site.
|
|
26
|
-
const pgTable = table;
|
|
27
|
-
function getDb(ctx) {
|
|
28
|
-
return ctx?.tx ?? db;
|
|
29
|
-
}
|
|
30
|
-
function buildWhereConditions(filters, includeDeleted = false) {
|
|
31
|
-
const conditions = [];
|
|
32
|
-
// Automatically exclude soft-deleted rows unless explicitly requested
|
|
33
|
-
if (hasSoftDelete && !includeDeleted && deletedAtColumn) {
|
|
34
|
-
conditions.push(isNull(deletedAtColumn));
|
|
35
|
-
}
|
|
36
|
-
if (filters) {
|
|
37
|
-
for (const [key, value] of Object.entries(filters)) {
|
|
38
|
-
const col = columns[key];
|
|
39
|
-
if (value !== undefined && col) {
|
|
40
|
-
conditions.push(eq(col, value));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return conditions;
|
|
45
|
-
}
|
|
46
|
-
const repo = {
|
|
47
|
-
async findById(id, ctx) {
|
|
48
|
-
const conditions = buildWhereConditions(undefined, false);
|
|
49
|
-
conditions.push(eq(idColumn, id));
|
|
50
|
-
const rows = await getDb(ctx)
|
|
51
|
-
.select()
|
|
52
|
-
.from(pgTable)
|
|
53
|
-
.where(and(...conditions));
|
|
54
|
-
return rows[0];
|
|
55
|
-
},
|
|
56
|
-
async findMany(filters, options = {}, ctx) {
|
|
57
|
-
const conditions = buildWhereConditions(filters, options.withDeleted);
|
|
58
|
-
let query = getDb(ctx).select().from(pgTable).$dynamic();
|
|
59
|
-
if (conditions.length > 0) {
|
|
60
|
-
query = query.where(and(...conditions));
|
|
61
|
-
}
|
|
62
|
-
if (options.limit !== undefined) {
|
|
63
|
-
query = query.limit(options.limit);
|
|
64
|
-
}
|
|
65
|
-
if (options.offset !== undefined) {
|
|
66
|
-
query = query.offset(options.offset);
|
|
67
|
-
}
|
|
68
|
-
// Drizzle's $dynamic() erases the row type when using PgTable.
|
|
69
|
-
// Use .then() to narrow the resolved array type with a single cast.
|
|
70
|
-
return query.then((rows) => rows);
|
|
71
|
-
},
|
|
72
|
-
async findAndCount(filters, options = {}, ctx) {
|
|
73
|
-
const rows = await repo.findMany(filters, options, ctx);
|
|
74
|
-
const conditions = buildWhereConditions(filters, options.withDeleted);
|
|
75
|
-
let countQuery = getDb(ctx)
|
|
76
|
-
.select({ count: sql `count(*)::int` })
|
|
77
|
-
.from(pgTable)
|
|
78
|
-
.$dynamic();
|
|
79
|
-
if (conditions.length > 0) {
|
|
80
|
-
countQuery = countQuery.where(and(...conditions));
|
|
81
|
-
}
|
|
82
|
-
const countResult = await countQuery;
|
|
83
|
-
return { rows, total: countResult[0]?.count ?? 0 };
|
|
84
|
-
},
|
|
85
|
-
async create(data, ctx) {
|
|
86
|
-
const rows = await getDb(ctx)
|
|
87
|
-
.insert(pgTable)
|
|
88
|
-
.values(data)
|
|
89
|
-
.returning();
|
|
90
|
-
return rows[0];
|
|
91
|
-
},
|
|
92
|
-
async createMany(data, ctx) {
|
|
93
|
-
if (data.length === 0)
|
|
94
|
-
return [];
|
|
95
|
-
const rows = await getDb(ctx)
|
|
96
|
-
.insert(pgTable)
|
|
97
|
-
.values(data)
|
|
98
|
-
.returning();
|
|
99
|
-
return rows;
|
|
100
|
-
},
|
|
101
|
-
async update(id, data, ctx) {
|
|
102
|
-
const rows = await getDb(ctx)
|
|
103
|
-
.update(pgTable)
|
|
104
|
-
.set(data)
|
|
105
|
-
.where(eq(idColumn, id))
|
|
106
|
-
.returning();
|
|
107
|
-
if (!rows[0]) {
|
|
108
|
-
throw new CommerceNotFoundError(`Record ${id} not found.`);
|
|
109
|
-
}
|
|
110
|
-
return rows[0];
|
|
111
|
-
},
|
|
112
|
-
async delete(id, ctx) {
|
|
113
|
-
await getDb(ctx).delete(pgTable).where(eq(idColumn, id));
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
if (hasSoftDelete && deletedAtColumn) {
|
|
117
|
-
const softRepo = repo;
|
|
118
|
-
softRepo.softDelete = async (id, ctx) => {
|
|
119
|
-
await getDb(ctx)
|
|
120
|
-
.update(pgTable)
|
|
121
|
-
.set({ deletedAt: new Date() })
|
|
122
|
-
.where(eq(idColumn, id));
|
|
123
|
-
};
|
|
124
|
-
softRepo.restore = async (id, ctx) => {
|
|
125
|
-
const rows = await getDb(ctx)
|
|
126
|
-
.update(pgTable)
|
|
127
|
-
.set({ deletedAt: null })
|
|
128
|
-
.where(eq(idColumn, id))
|
|
129
|
-
.returning();
|
|
130
|
-
if (!rows[0]) {
|
|
131
|
-
throw new CommerceNotFoundError(`Record ${id} not found.`);
|
|
132
|
-
}
|
|
133
|
-
return rows[0];
|
|
134
|
-
};
|
|
135
|
-
return softRepo;
|
|
136
|
-
}
|
|
137
|
-
return repo;
|
|
138
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a PluginResultErr into a structured HTTP error response.
|
|
3
|
-
*
|
|
4
|
-
* Replaces the `throw new Error(result.error)` pattern in plugin routes
|
|
5
|
-
* which always produces HTTP 500 with no structured error code.
|
|
6
|
-
*
|
|
7
|
-
* Usage in routes:
|
|
8
|
-
* const result = await service.doSomething(orgId, input);
|
|
9
|
-
* if (!result.ok) return toHttpError(result);
|
|
10
|
-
* return result.value;
|
|
11
|
-
*
|
|
12
|
-
* The function infers HTTP status from the error code or message content:
|
|
13
|
-
* - "NOT_FOUND" or "not found" --> 404
|
|
14
|
-
* - "FORBIDDEN" or "permission" --> 403
|
|
15
|
-
* - "CONFLICT" or "already exists" --> 409
|
|
16
|
-
* - "VALIDATION" or "cannot/must" --> 422
|
|
17
|
-
* - Everything else --> 400
|
|
18
|
-
*/
|
|
19
|
-
import type { PluginResultErr } from "./result.js";
|
|
20
|
-
export interface HttpErrorResponse {
|
|
21
|
-
status: 400 | 403 | 404 | 409 | 422;
|
|
22
|
-
body: {
|
|
23
|
-
error: {
|
|
24
|
-
code: string;
|
|
25
|
-
message: string;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export declare function toHttpError(result: PluginResultErr): HttpErrorResponse;
|
|
30
|
-
//# sourceMappingURL=http-error.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../src/kernel/http-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACpC,IAAI,EAAE;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CACpD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,CAiBtE"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a PluginResultErr into a structured HTTP error response.
|
|
3
|
-
*
|
|
4
|
-
* Replaces the `throw new Error(result.error)` pattern in plugin routes
|
|
5
|
-
* which always produces HTTP 500 with no structured error code.
|
|
6
|
-
*
|
|
7
|
-
* Usage in routes:
|
|
8
|
-
* const result = await service.doSomething(orgId, input);
|
|
9
|
-
* if (!result.ok) return toHttpError(result);
|
|
10
|
-
* return result.value;
|
|
11
|
-
*
|
|
12
|
-
* The function infers HTTP status from the error code or message content:
|
|
13
|
-
* - "NOT_FOUND" or "not found" --> 404
|
|
14
|
-
* - "FORBIDDEN" or "permission" --> 403
|
|
15
|
-
* - "CONFLICT" or "already exists" --> 409
|
|
16
|
-
* - "VALIDATION" or "cannot/must" --> 422
|
|
17
|
-
* - Everything else --> 400
|
|
18
|
-
*/
|
|
19
|
-
export function toHttpError(result) {
|
|
20
|
-
const message = result.error;
|
|
21
|
-
const code = result.code;
|
|
22
|
-
if (code === "NOT_FOUND" || /not found/i.test(message)) {
|
|
23
|
-
return { status: 404, body: { error: { code: "NOT_FOUND", message } } };
|
|
24
|
-
}
|
|
25
|
-
if (code === "FORBIDDEN" || /permission|forbidden|unauthorized/i.test(message)) {
|
|
26
|
-
return { status: 403, body: { error: { code: "FORBIDDEN", message } } };
|
|
27
|
-
}
|
|
28
|
-
if (code === "CONFLICT" || /already|duplicate|exists|unique/i.test(message)) {
|
|
29
|
-
return { status: 409, body: { error: { code: "CONFLICT", message } } };
|
|
30
|
-
}
|
|
31
|
-
if (code === "VALIDATION" || /invalid|cannot|must|required|exceeded|negative/i.test(message)) {
|
|
32
|
-
return { status: 422, body: { error: { code: "VALIDATION_FAILED", message } } };
|
|
33
|
-
}
|
|
34
|
-
return { status: 400, body: { error: { code: code ?? "BAD_REQUEST", message } } };
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-job-tasks.d.ts","sourceRoot":"","sources":["../../../src/kernel/jobs/builtin-job-tasks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAChD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACxB,EASA,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { DatabaseAdapter } from "../database/adapter.js";
|
|
2
|
-
import type { HookRegistry } from "../hooks/registry.js";
|
|
3
|
-
import type { Logger } from "../hooks/types.js";
|
|
4
|
-
export interface ModuleDeps<TDeps extends Record<string, unknown> = Record<string, unknown>> {
|
|
5
|
-
db: DatabaseAdapter;
|
|
6
|
-
hooks: HookRegistry;
|
|
7
|
-
services: TDeps;
|
|
8
|
-
config: unknown;
|
|
9
|
-
logger: Logger;
|
|
10
|
-
}
|
|
11
|
-
export interface AppModule<TSchema = unknown, TService = unknown, TDeps extends Record<string, unknown> = Record<string, unknown>> {
|
|
12
|
-
id: string;
|
|
13
|
-
schema: () => TSchema;
|
|
14
|
-
dependencies?: ReadonlyArray<keyof TDeps & string>;
|
|
15
|
-
service: (deps: ModuleDeps<TDeps>) => TService;
|
|
16
|
-
}
|
|
17
|
-
export type ServiceMap<TModules extends Record<string, AppModule>> = {
|
|
18
|
-
[K in keyof TModules]: TModules[K] extends AppModule<infer _TSchema, infer TService, infer _TDeps> ? TService : never;
|
|
19
|
-
};
|
|
20
|
-
export declare function defineModule<TSchema, TService, TDeps extends Record<string, unknown> = Record<string, unknown>>(manifest: AppModule<TSchema, TService, TDeps>): AppModule<TSchema, TService, TDeps>;
|
|
21
|
-
//# sourceMappingURL=define.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../src/kernel/module/define.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,UAAU,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzF,EAAE,EAAE,eAAe,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS,CACxB,OAAO,GAAG,OAAO,EACjB,QAAQ,GAAG,OAAO,EAClB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE/D,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC;IACnD,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC;CAChD;AAED,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI;KAClE,CAAC,IAAI,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,QAAQ,EAAE,MAAM,QAAQ,EAAE,MAAM,MAAM,CAAC,GAC9F,QAAQ,GACR,KAAK;CACV,CAAC;AAEF,wBAAgB,YAAY,CAC1B,OAAO,EACP,QAAQ,EACR,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,QAAQ,EAAE,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAEpF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/kernel/module/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AppModule } from "./define.js";
|
|
2
|
-
export declare class ModuleCycleError extends Error {
|
|
3
|
-
readonly cycle: string[];
|
|
4
|
-
constructor(cycle: string[]);
|
|
5
|
-
}
|
|
6
|
-
export declare function topoSortModules(modules: Record<string, AppModule>): string[];
|
|
7
|
-
//# sourceMappingURL=topo-sort.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-sort.d.ts","sourceRoot":"","sources":["../../../src/kernel/module/topo-sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;gBAEb,KAAK,EAAE,MAAM,EAAE;CAM5B;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,MAAM,EAAE,CAiD5E"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
export class ModuleCycleError extends Error {
|
|
2
|
-
cycle;
|
|
3
|
-
constructor(cycle) {
|
|
4
|
-
const label = cycle.join(" → ");
|
|
5
|
-
super(`Module dependency cycle: ${label}`);
|
|
6
|
-
this.name = "ModuleCycleError";
|
|
7
|
-
this.cycle = cycle;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export function topoSortModules(modules) {
|
|
11
|
-
const keys = Object.keys(modules);
|
|
12
|
-
const keySet = new Set(keys);
|
|
13
|
-
for (const [id, mod] of Object.entries(modules)) {
|
|
14
|
-
for (const dep of mod.dependencies ?? []) {
|
|
15
|
-
const depKey = dep;
|
|
16
|
-
if (!keySet.has(depKey)) {
|
|
17
|
-
throw new Error(`Module "${id}" declares unknown dependency "${depKey}"`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const remaining = new Map();
|
|
22
|
-
for (const k of keys) {
|
|
23
|
-
const mod = modules[k];
|
|
24
|
-
remaining.set(k, new Set((mod.dependencies ?? [])));
|
|
25
|
-
}
|
|
26
|
-
const waitingOn = new Map();
|
|
27
|
-
for (const m of keys) {
|
|
28
|
-
const mod = modules[m];
|
|
29
|
-
for (const d of (mod.dependencies ?? [])) {
|
|
30
|
-
const list = waitingOn.get(d);
|
|
31
|
-
if (list)
|
|
32
|
-
list.push(m);
|
|
33
|
-
else
|
|
34
|
-
waitingOn.set(d, [m]);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const order = [];
|
|
38
|
-
const queue = keys.filter((k) => remaining.get(k).size === 0);
|
|
39
|
-
while (queue.length > 0) {
|
|
40
|
-
const n = queue.shift();
|
|
41
|
-
order.push(n);
|
|
42
|
-
for (const m of waitingOn.get(n) ?? []) {
|
|
43
|
-
const set = remaining.get(m);
|
|
44
|
-
if (set.delete(n) && set.size === 0) {
|
|
45
|
-
queue.push(m);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (order.length !== keys.length) {
|
|
50
|
-
const cycle = findCycleKeys(modules, keys);
|
|
51
|
-
throw new ModuleCycleError(cycle);
|
|
52
|
-
}
|
|
53
|
-
return order;
|
|
54
|
-
}
|
|
55
|
-
function findCycleKeys(modules, keys) {
|
|
56
|
-
const WHITE = 0;
|
|
57
|
-
const GRAY = 1;
|
|
58
|
-
const BLACK = 2;
|
|
59
|
-
const mark = new Map();
|
|
60
|
-
const stack = [];
|
|
61
|
-
function dfs(u) {
|
|
62
|
-
mark.set(u, GRAY);
|
|
63
|
-
stack.push(u);
|
|
64
|
-
const mod = modules[u];
|
|
65
|
-
for (const v of (mod.dependencies ?? [])) {
|
|
66
|
-
const mv = mark.get(v) ?? WHITE;
|
|
67
|
-
if (mv === WHITE) {
|
|
68
|
-
const found = dfs(v);
|
|
69
|
-
if (found)
|
|
70
|
-
return found;
|
|
71
|
-
}
|
|
72
|
-
else if (mv === GRAY) {
|
|
73
|
-
const idx = stack.indexOf(v);
|
|
74
|
-
return [...stack.slice(idx), v];
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
stack.pop();
|
|
78
|
-
mark.set(u, BLACK);
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
for (const k of keys) {
|
|
82
|
-
if ((mark.get(k) ?? WHITE) === WHITE) {
|
|
83
|
-
const found = dfs(k);
|
|
84
|
-
if (found)
|
|
85
|
-
return found;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
throw new Error("topoSortModules: expected a cycle but DFS did not find one");
|
|
89
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { QueryRegistry } from "./registry.js";
|
|
2
|
-
export interface QueryInput {
|
|
3
|
-
entity: string;
|
|
4
|
-
id?: string;
|
|
5
|
-
filters?: Record<string, unknown>;
|
|
6
|
-
include?: string[];
|
|
7
|
-
pagination?: {
|
|
8
|
-
limit?: number;
|
|
9
|
-
offset?: number;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export interface QueryResult<T = Record<string, unknown>> {
|
|
13
|
-
data: T[];
|
|
14
|
-
total?: number | undefined;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Executes a query against the registry, resolving includes via
|
|
18
|
-
* batched dataloader-style fetches (one WHERE IN per relation).
|
|
19
|
-
*/
|
|
20
|
-
export declare function executeQuery<T = Record<string, unknown>>(registry: QueryRegistry, services: Record<string, unknown>, input: QueryInput): Promise<QueryResult<T>>;
|
|
21
|
-
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/kernel/query/executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EAGd,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAClD;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtD,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5D,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAgDzB"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { CommerceNotFoundError } from "../errors.js";
|
|
2
|
-
/**
|
|
3
|
-
* Executes a query against the registry, resolving includes via
|
|
4
|
-
* batched dataloader-style fetches (one WHERE IN per relation).
|
|
5
|
-
*/
|
|
6
|
-
export async function executeQuery(registry, services, input) {
|
|
7
|
-
const definition = registry.get(input.entity);
|
|
8
|
-
if (!definition) {
|
|
9
|
-
throw new CommerceNotFoundError(`No entity registered with name "${input.entity}".`);
|
|
10
|
-
}
|
|
11
|
-
const service = services[definition.service];
|
|
12
|
-
// 1. Fetch primary records
|
|
13
|
-
let rows;
|
|
14
|
-
let total;
|
|
15
|
-
if (input.id) {
|
|
16
|
-
const result = (await service[definition.getByIdMethod](input.id));
|
|
17
|
-
const value = result?.value ?? result;
|
|
18
|
-
rows = value != null ? [value] : [];
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
const result = (await service[definition.listMethod](input.filters ?? {}, input.pagination));
|
|
22
|
-
const resolved = result?.value ?? result;
|
|
23
|
-
if (resolved && typeof resolved === "object" && "items" in resolved) {
|
|
24
|
-
rows = (resolved.items ?? []);
|
|
25
|
-
total = resolved.total;
|
|
26
|
-
}
|
|
27
|
-
else if (Array.isArray(resolved)) {
|
|
28
|
-
rows = resolved;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
rows = [];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// 2. Resolve includes
|
|
35
|
-
if (input.include?.length) {
|
|
36
|
-
await resolveIncludes(rows, input.include, definition, services, registry);
|
|
37
|
-
}
|
|
38
|
-
return { data: rows, total };
|
|
39
|
-
}
|
|
40
|
-
async function resolveIncludes(rows, includes, definition, services, registry) {
|
|
41
|
-
// Group includes by top-level segment
|
|
42
|
-
const topLevel = new Map();
|
|
43
|
-
for (const path of includes) {
|
|
44
|
-
const dot = path.indexOf(".");
|
|
45
|
-
if (dot === -1) {
|
|
46
|
-
if (!topLevel.has(path))
|
|
47
|
-
topLevel.set(path, []);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
const parent = path.substring(0, dot);
|
|
51
|
-
const child = path.substring(dot + 1);
|
|
52
|
-
const existing = topLevel.get(parent) ?? [];
|
|
53
|
-
existing.push(child);
|
|
54
|
-
topLevel.set(parent, existing);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
for (const [relationName, nestedIncludes] of topLevel) {
|
|
58
|
-
const relation = definition.relations[relationName];
|
|
59
|
-
if (!relation)
|
|
60
|
-
continue;
|
|
61
|
-
const targetService = services[relation.targetService];
|
|
62
|
-
if (!targetService)
|
|
63
|
-
continue;
|
|
64
|
-
// Collect foreign key values (deduplicated)
|
|
65
|
-
const ids = [
|
|
66
|
-
...new Set(rows
|
|
67
|
-
.map((r) => r[relation.foreignKey])
|
|
68
|
-
.filter((v) => v != null && typeof v === "string")),
|
|
69
|
-
];
|
|
70
|
-
if (ids.length === 0)
|
|
71
|
-
continue;
|
|
72
|
-
// One batched query
|
|
73
|
-
const batchFn = targetService[relation.batchMethod];
|
|
74
|
-
if (!batchFn)
|
|
75
|
-
continue;
|
|
76
|
-
const relatedResult = await batchFn(ids);
|
|
77
|
-
const relatedRows = extractRows(relatedResult);
|
|
78
|
-
// Build lookup
|
|
79
|
-
const map = new Map();
|
|
80
|
-
for (const related of relatedRows) {
|
|
81
|
-
const rec = related;
|
|
82
|
-
if (relation.isList) {
|
|
83
|
-
const key = rec[relation.foreignKey];
|
|
84
|
-
if (!map.has(key))
|
|
85
|
-
map.set(key, []);
|
|
86
|
-
map.get(key).push(rec);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
map.set(rec["id"], rec);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// Attach to parent rows
|
|
93
|
-
for (const row of rows) {
|
|
94
|
-
const fkValue = row[relation.foreignKey];
|
|
95
|
-
if (!fkValue)
|
|
96
|
-
continue;
|
|
97
|
-
row[relation.attachAs] =
|
|
98
|
-
map.get(fkValue) ?? (relation.isList ? [] : null);
|
|
99
|
-
}
|
|
100
|
-
// Resolve nested includes
|
|
101
|
-
if (nestedIncludes.length > 0) {
|
|
102
|
-
const targetDef = registry.get(relation.targetService);
|
|
103
|
-
if (targetDef) {
|
|
104
|
-
const nestedRows = relation.isList
|
|
105
|
-
? rows.flatMap((r) => r[relation.attachAs] ?? [])
|
|
106
|
-
: rows
|
|
107
|
-
.map((r) => r[relation.attachAs])
|
|
108
|
-
.filter(Boolean);
|
|
109
|
-
await resolveIncludes(nestedRows, nestedIncludes, targetDef, services, registry);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function extractRows(result) {
|
|
115
|
-
if (Array.isArray(result))
|
|
116
|
-
return result;
|
|
117
|
-
if (result && typeof result === "object") {
|
|
118
|
-
const r = result;
|
|
119
|
-
if (r.value != null) {
|
|
120
|
-
if (Array.isArray(r.value))
|
|
121
|
-
return r.value;
|
|
122
|
-
if (typeof r.value === "object" && "items" in r.value) {
|
|
123
|
-
return r.value.items;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return [];
|
|
128
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines a relation from a parent entity to a related entity.
|
|
3
|
-
* Used by the query executor to batch-load related records.
|
|
4
|
-
*/
|
|
5
|
-
export interface RelationDefinition {
|
|
6
|
-
foreignKey: string;
|
|
7
|
-
targetService: string;
|
|
8
|
-
batchMethod: string;
|
|
9
|
-
attachAs: string;
|
|
10
|
-
isList?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Defines an entity that can be queried via kernel.query().
|
|
14
|
-
*/
|
|
15
|
-
export interface EntityDefinition {
|
|
16
|
-
service: string;
|
|
17
|
-
getByIdMethod: string;
|
|
18
|
-
listMethod: string;
|
|
19
|
-
relations: Record<string, RelationDefinition>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Registry of queryable entities and their relations.
|
|
23
|
-
* Modules register their entities at kernel boot.
|
|
24
|
-
* Plugins can register additional entities.
|
|
25
|
-
*/
|
|
26
|
-
export declare class QueryRegistry {
|
|
27
|
-
private entities;
|
|
28
|
-
register(name: string, definition: EntityDefinition): void;
|
|
29
|
-
get(name: string): EntityDefinition | undefined;
|
|
30
|
-
has(name: string): boolean;
|
|
31
|
-
listEntities(): string[];
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=registry.d.ts.map
|