@unifiedcommerce/core 0.0.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/console-email.d.ts +23 -0
- package/dist/adapters/console-email.d.ts.map +1 -0
- package/dist/adapters/console-email.js +38 -0
- package/dist/auth/access.d.ts +101 -0
- package/dist/auth/access.d.ts.map +1 -0
- package/dist/auth/access.js +128 -0
- package/dist/auth/auth-schema.d.ts +1383 -0
- package/dist/auth/auth-schema.d.ts.map +1 -0
- package/dist/auth/auth-schema.js +117 -0
- package/dist/auth/middleware.d.ts +5 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +91 -0
- package/dist/auth/org.d.ts +22 -0
- package/dist/auth/org.d.ts.map +1 -0
- package/dist/auth/org.js +36 -0
- package/dist/auth/permissions.d.ts +4 -0
- package/dist/auth/permissions.d.ts.map +1 -0
- package/dist/auth/permissions.js +24 -0
- package/dist/auth/pos.d.ts +3 -0
- package/dist/auth/pos.d.ts.map +1 -0
- package/dist/auth/pos.js +62 -0
- package/dist/auth/setup.d.ts +31 -0
- package/dist/auth/setup.d.ts.map +1 -0
- package/dist/auth/setup.js +106 -0
- package/dist/auth/system-actor.d.ts +7 -0
- package/dist/auth/system-actor.d.ts.map +1 -0
- package/dist/auth/system-actor.js +17 -0
- package/dist/auth/types.d.ts +11 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +1 -0
- package/dist/config/defaults.d.ts +3 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +80 -0
- package/dist/config/define-config.d.ts +9 -0
- package/dist/config/define-config.d.ts.map +1 -0
- package/dist/config/define-config.js +44 -0
- package/dist/config/types.d.ts +299 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +1 -0
- package/dist/generated/plugin-manifest.d.ts +48 -0
- package/dist/generated/plugin-manifest.d.ts.map +1 -0
- package/dist/generated/plugin-manifest.js +20 -0
- package/dist/hooks/checkout-completion.d.ts +58 -0
- package/dist/hooks/checkout-completion.d.ts.map +1 -0
- package/dist/hooks/checkout-completion.js +137 -0
- package/dist/hooks/checkout.d.ts +99 -0
- package/dist/hooks/checkout.d.ts.map +1 -0
- package/dist/hooks/checkout.js +317 -0
- package/dist/hooks/order-emails.d.ts +16 -0
- package/dist/hooks/order-emails.d.ts.map +1 -0
- package/dist/hooks/order-emails.js +44 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13381 -0
- package/dist/index.js.map +156 -0
- package/dist/interfaces/graphql/index.d.ts +4 -0
- package/dist/interfaces/graphql/index.d.ts.map +1 -0
- package/dist/interfaces/graphql/index.js +415 -0
- package/dist/interfaces/mcp/agent-prompt.d.ts +16 -0
- package/dist/interfaces/mcp/agent-prompt.d.ts.map +1 -0
- package/dist/interfaces/mcp/agent-prompt.js +172 -0
- package/dist/interfaces/mcp/context-enrichment.d.ts +39 -0
- package/dist/interfaces/mcp/context-enrichment.d.ts.map +1 -0
- package/dist/interfaces/mcp/context-enrichment.js +119 -0
- package/dist/interfaces/mcp/server.d.ts +7 -0
- package/dist/interfaces/mcp/server.d.ts.map +1 -0
- package/dist/interfaces/mcp/server.js +515 -0
- package/dist/interfaces/mcp/transport.d.ts +5 -0
- package/dist/interfaces/mcp/transport.d.ts.map +1 -0
- package/dist/interfaces/mcp/transport.js +52 -0
- package/dist/interfaces/rest/customer-portal.d.ts +5 -0
- package/dist/interfaces/rest/customer-portal.d.ts.map +1 -0
- package/dist/interfaces/rest/customer-portal.js +206 -0
- package/dist/interfaces/rest/index.d.ts +5 -0
- package/dist/interfaces/rest/index.d.ts.map +1 -0
- package/dist/interfaces/rest/index.js +68 -0
- package/dist/interfaces/rest/router.d.ts +164 -0
- package/dist/interfaces/rest/router.d.ts.map +1 -0
- package/dist/interfaces/rest/router.js +259 -0
- package/dist/interfaces/rest/routes/admin-jobs.d.ts +5 -0
- package/dist/interfaces/rest/routes/admin-jobs.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/admin-jobs.js +48 -0
- package/dist/interfaces/rest/routes/audit.d.ts +5 -0
- package/dist/interfaces/rest/routes/audit.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/audit.js +43 -0
- package/dist/interfaces/rest/routes/carts.d.ts +5 -0
- package/dist/interfaces/rest/routes/carts.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/carts.js +55 -0
- package/dist/interfaces/rest/routes/catalog.d.ts +5 -0
- package/dist/interfaces/rest/routes/catalog.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/catalog.js +256 -0
- package/dist/interfaces/rest/routes/checkout.d.ts +5 -0
- package/dist/interfaces/rest/routes/checkout.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/checkout.js +216 -0
- package/dist/interfaces/rest/routes/inventory.d.ts +5 -0
- package/dist/interfaces/rest/routes/inventory.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/inventory.js +59 -0
- package/dist/interfaces/rest/routes/media.d.ts +5 -0
- package/dist/interfaces/rest/routes/media.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/media.js +65 -0
- package/dist/interfaces/rest/routes/orders.d.ts +5 -0
- package/dist/interfaces/rest/routes/orders.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/orders.js +64 -0
- package/dist/interfaces/rest/routes/payments.d.ts +5 -0
- package/dist/interfaces/rest/routes/payments.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/payments.js +45 -0
- package/dist/interfaces/rest/routes/pricing.d.ts +5 -0
- package/dist/interfaces/rest/routes/pricing.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/pricing.js +48 -0
- package/dist/interfaces/rest/routes/promotions.d.ts +5 -0
- package/dist/interfaces/rest/routes/promotions.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/promotions.js +75 -0
- package/dist/interfaces/rest/routes/search.d.ts +5 -0
- package/dist/interfaces/rest/routes/search.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/search.js +60 -0
- package/dist/interfaces/rest/routes/webhooks.d.ts +5 -0
- package/dist/interfaces/rest/routes/webhooks.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/webhooks.js +39 -0
- package/dist/interfaces/rest/schemas/admin-jobs.d.ts +327 -0
- package/dist/interfaces/rest/schemas/admin-jobs.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/admin-jobs.js +37 -0
- package/dist/interfaces/rest/schemas/audit.d.ts +59 -0
- package/dist/interfaces/rest/schemas/audit.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/audit.js +43 -0
- package/dist/interfaces/rest/schemas/carts.d.ts +1446 -0
- package/dist/interfaces/rest/schemas/carts.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/carts.js +109 -0
- package/dist/interfaces/rest/schemas/catalog.d.ts +5416 -0
- package/dist/interfaces/rest/schemas/catalog.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/catalog.js +397 -0
- package/dist/interfaces/rest/schemas/checkout.d.ts +160 -0
- package/dist/interfaces/rest/schemas/checkout.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/checkout.js +60 -0
- package/dist/interfaces/rest/schemas/customer-portal.d.ts +2197 -0
- package/dist/interfaces/rest/schemas/customer-portal.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/customer-portal.js +177 -0
- package/dist/interfaces/rest/schemas/inventory.d.ts +469 -0
- package/dist/interfaces/rest/schemas/inventory.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/inventory.js +128 -0
- package/dist/interfaces/rest/schemas/media.d.ts +303 -0
- package/dist/interfaces/rest/schemas/media.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/media.js +69 -0
- package/dist/interfaces/rest/schemas/orders.d.ts +1782 -0
- package/dist/interfaces/rest/schemas/orders.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/orders.js +93 -0
- package/dist/interfaces/rest/schemas/pricing.d.ts +256 -0
- package/dist/interfaces/rest/schemas/pricing.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/pricing.js +72 -0
- package/dist/interfaces/rest/schemas/promotions.d.ts +363 -0
- package/dist/interfaces/rest/schemas/promotions.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/promotions.js +98 -0
- package/dist/interfaces/rest/schemas/responses.d.ts +4062 -0
- package/dist/interfaces/rest/schemas/responses.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/responses.js +63 -0
- package/dist/interfaces/rest/schemas/search.d.ts +245 -0
- package/dist/interfaces/rest/schemas/search.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/search.js +55 -0
- package/dist/interfaces/rest/schemas/shared.d.ts +95 -0
- package/dist/interfaces/rest/schemas/shared.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/shared.js +51 -0
- package/dist/interfaces/rest/schemas/webhooks.d.ts +221 -0
- package/dist/interfaces/rest/schemas/webhooks.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/webhooks.js +62 -0
- package/dist/interfaces/rest/utils.d.ts +45 -0
- package/dist/interfaces/rest/utils.d.ts.map +1 -0
- package/dist/interfaces/rest/utils.js +71 -0
- package/dist/interfaces/rest/webhook-router.d.ts +41 -0
- package/dist/interfaces/rest/webhook-router.d.ts.map +1 -0
- package/dist/interfaces/rest/webhook-router.js +36 -0
- package/dist/kernel/compensation/executor.d.ts +21 -0
- package/dist/kernel/compensation/executor.d.ts.map +1 -0
- package/dist/kernel/compensation/executor.js +36 -0
- package/dist/kernel/compensation/types.d.ts +25 -0
- package/dist/kernel/compensation/types.d.ts.map +1 -0
- package/dist/kernel/compensation/types.js +1 -0
- package/dist/kernel/database/adapter.d.ts +10 -0
- package/dist/kernel/database/adapter.d.ts.map +1 -0
- package/dist/kernel/database/adapter.js +3 -0
- package/dist/kernel/database/drizzle-db.d.ts +49 -0
- package/dist/kernel/database/drizzle-db.d.ts.map +1 -0
- package/dist/kernel/database/drizzle-db.js +20 -0
- package/dist/kernel/database/migrate.d.ts +38 -0
- package/dist/kernel/database/migrate.d.ts.map +1 -0
- package/dist/kernel/database/migrate.js +61 -0
- package/dist/kernel/database/plugin-types.d.ts +32 -0
- package/dist/kernel/database/plugin-types.d.ts.map +1 -0
- package/dist/kernel/database/plugin-types.js +10 -0
- package/dist/kernel/database/schema.d.ts +24 -0
- package/dist/kernel/database/schema.d.ts.map +1 -0
- package/dist/kernel/database/schema.js +36 -0
- package/dist/kernel/database/scoped-db.d.ts +20 -0
- package/dist/kernel/database/scoped-db.d.ts.map +1 -0
- package/dist/kernel/database/scoped-db.js +62 -0
- package/dist/kernel/database/tx-context.d.ts +15 -0
- package/dist/kernel/database/tx-context.d.ts.map +1 -0
- package/dist/kernel/database/tx-context.js +19 -0
- package/dist/kernel/error-mapper.d.ts +3 -0
- package/dist/kernel/error-mapper.d.ts.map +1 -0
- package/dist/kernel/error-mapper.js +12 -0
- package/dist/kernel/errors.d.ts +38 -0
- package/dist/kernel/errors.d.ts.map +1 -0
- package/dist/kernel/errors.js +69 -0
- package/dist/kernel/factory/in-memory-repository-factory.d.ts +20 -0
- package/dist/kernel/factory/in-memory-repository-factory.d.ts.map +1 -0
- package/dist/kernel/factory/in-memory-repository-factory.js +83 -0
- package/dist/kernel/factory/repository-factory.d.ts +71 -0
- package/dist/kernel/factory/repository-factory.d.ts.map +1 -0
- package/dist/kernel/factory/repository-factory.js +136 -0
- package/dist/kernel/hooks/create-context.d.ts +25 -0
- package/dist/kernel/hooks/create-context.d.ts.map +1 -0
- package/dist/kernel/hooks/create-context.js +22 -0
- package/dist/kernel/hooks/executor.d.ts +12 -0
- package/dist/kernel/hooks/executor.d.ts.map +1 -0
- package/dist/kernel/hooks/executor.js +50 -0
- package/dist/kernel/hooks/registry.d.ts +28 -0
- package/dist/kernel/hooks/registry.d.ts.map +1 -0
- package/dist/kernel/hooks/registry.js +58 -0
- package/dist/kernel/hooks/types.d.ts +37 -0
- package/dist/kernel/hooks/types.d.ts.map +1 -0
- package/dist/kernel/hooks/types.js +1 -0
- package/dist/kernel/http-error.d.ts +30 -0
- package/dist/kernel/http-error.d.ts.map +1 -0
- package/dist/kernel/http-error.js +35 -0
- package/dist/kernel/jobs/adapter.d.ts +25 -0
- package/dist/kernel/jobs/adapter.d.ts.map +1 -0
- package/dist/kernel/jobs/adapter.js +9 -0
- package/dist/kernel/jobs/drizzle-adapter.d.ts +15 -0
- package/dist/kernel/jobs/drizzle-adapter.d.ts.map +1 -0
- package/dist/kernel/jobs/drizzle-adapter.js +42 -0
- package/dist/kernel/jobs/runner.d.ts +24 -0
- package/dist/kernel/jobs/runner.d.ts.map +1 -0
- package/dist/kernel/jobs/runner.js +114 -0
- package/dist/kernel/jobs/schema.d.ts +280 -0
- package/dist/kernel/jobs/schema.d.ts.map +1 -0
- package/dist/kernel/jobs/schema.js +37 -0
- package/dist/kernel/jobs/types.d.ts +30 -0
- package/dist/kernel/jobs/types.d.ts.map +1 -0
- package/dist/kernel/jobs/types.js +1 -0
- package/dist/kernel/local-api.d.ts +103 -0
- package/dist/kernel/local-api.d.ts.map +1 -0
- package/dist/kernel/local-api.js +87 -0
- package/dist/kernel/plugin/capability-registry.d.ts +9 -0
- package/dist/kernel/plugin/capability-registry.d.ts.map +1 -0
- package/dist/kernel/plugin/capability-registry.js +28 -0
- package/dist/kernel/plugin/dependency-graph.d.ts +6 -0
- package/dist/kernel/plugin/dependency-graph.d.ts.map +1 -0
- package/dist/kernel/plugin/dependency-graph.js +55 -0
- package/dist/kernel/plugin/manifest.d.ts +90 -0
- package/dist/kernel/plugin/manifest.d.ts.map +1 -0
- package/dist/kernel/plugin/manifest.js +140 -0
- package/dist/kernel/query/executor.d.ts +21 -0
- package/dist/kernel/query/executor.d.ts.map +1 -0
- package/dist/kernel/query/executor.js +128 -0
- package/dist/kernel/query/registry.d.ts +33 -0
- package/dist/kernel/query/registry.d.ts.map +1 -0
- package/dist/kernel/query/registry.js +20 -0
- package/dist/kernel/result.d.ts +36 -0
- package/dist/kernel/result.d.ts.map +1 -0
- package/dist/kernel/result.js +16 -0
- package/dist/kernel/schema/extra-columns.d.ts +23 -0
- package/dist/kernel/schema/extra-columns.d.ts.map +1 -0
- package/dist/kernel/schema/extra-columns.js +10 -0
- package/dist/kernel/service-registry.d.ts +109 -0
- package/dist/kernel/service-registry.d.ts.map +1 -0
- package/dist/kernel/service-registry.js +26 -0
- package/dist/kernel/service-timing.d.ts +25 -0
- package/dist/kernel/service-timing.d.ts.map +1 -0
- package/dist/kernel/service-timing.js +62 -0
- package/dist/kernel/state-machine/machine.d.ts +24 -0
- package/dist/kernel/state-machine/machine.d.ts.map +1 -0
- package/dist/kernel/state-machine/machine.js +70 -0
- package/dist/modules/analytics/cubes.d.ts +19 -0
- package/dist/modules/analytics/cubes.d.ts.map +1 -0
- package/dist/modules/analytics/cubes.js +187 -0
- package/dist/modules/analytics/drizzle-adapter.d.ts +13 -0
- package/dist/modules/analytics/drizzle-adapter.d.ts.map +1 -0
- package/dist/modules/analytics/drizzle-adapter.js +358 -0
- package/dist/modules/analytics/hooks.d.ts +13 -0
- package/dist/modules/analytics/hooks.d.ts.map +1 -0
- package/dist/modules/analytics/hooks.js +12 -0
- package/dist/modules/analytics/models.d.ts +14 -0
- package/dist/modules/analytics/models.d.ts.map +1 -0
- package/dist/modules/analytics/models.js +118 -0
- package/dist/modules/analytics/repository/index.d.ts +5 -0
- package/dist/modules/analytics/repository/index.d.ts.map +1 -0
- package/dist/modules/analytics/repository/index.js +1 -0
- package/dist/modules/analytics/service.d.ts +45 -0
- package/dist/modules/analytics/service.d.ts.map +1 -0
- package/dist/modules/analytics/service.js +196 -0
- package/dist/modules/analytics/types.d.ts +119 -0
- package/dist/modules/analytics/types.d.ts.map +1 -0
- package/dist/modules/analytics/types.js +25 -0
- package/dist/modules/audit/hooks.d.ts +7 -0
- package/dist/modules/audit/hooks.d.ts.map +1 -0
- package/dist/modules/audit/hooks.js +67 -0
- package/dist/modules/audit/schema.d.ts +178 -0
- package/dist/modules/audit/schema.d.ts.map +1 -0
- package/dist/modules/audit/schema.js +21 -0
- package/dist/modules/audit/service.d.ts +38 -0
- package/dist/modules/audit/service.d.ts.map +1 -0
- package/dist/modules/audit/service.js +109 -0
- package/dist/modules/cart/access.d.ts +11 -0
- package/dist/modules/cart/access.d.ts.map +1 -0
- package/dist/modules/cart/access.js +18 -0
- package/dist/modules/cart/matcher.d.ts +20 -0
- package/dist/modules/cart/matcher.d.ts.map +1 -0
- package/dist/modules/cart/matcher.js +2 -0
- package/dist/modules/cart/repository/in-memory.d.ts +30 -0
- package/dist/modules/cart/repository/in-memory.d.ts.map +1 -0
- package/dist/modules/cart/repository/in-memory.js +159 -0
- package/dist/modules/cart/repository/index.d.ts +45 -0
- package/dist/modules/cart/repository/index.d.ts.map +1 -0
- package/dist/modules/cart/repository/index.js +158 -0
- package/dist/modules/cart/schema.d.ts +359 -0
- package/dist/modules/cart/schema.d.ts.map +1 -0
- package/dist/modules/cart/schema.js +40 -0
- package/dist/modules/cart/schemas.d.ts +29 -0
- package/dist/modules/cart/schemas.d.ts.map +1 -0
- package/dist/modules/cart/schemas.js +14 -0
- package/dist/modules/cart/service.d.ts +63 -0
- package/dist/modules/cart/service.d.ts.map +1 -0
- package/dist/modules/cart/service.js +339 -0
- package/dist/modules/catalog/repository/in-memory.d.ts +82 -0
- package/dist/modules/catalog/repository/in-memory.d.ts.map +1 -0
- package/dist/modules/catalog/repository/in-memory.js +444 -0
- package/dist/modules/catalog/repository/index.d.ts +106 -0
- package/dist/modules/catalog/repository/index.d.ts.map +1 -0
- package/dist/modules/catalog/repository/index.js +455 -0
- package/dist/modules/catalog/schema.d.ts +1193 -0
- package/dist/modules/catalog/schema.d.ts.map +1 -0
- package/dist/modules/catalog/schema.js +149 -0
- package/dist/modules/catalog/schemas.d.ts +81 -0
- package/dist/modules/catalog/schemas.d.ts.map +1 -0
- package/dist/modules/catalog/schemas.js +62 -0
- package/dist/modules/catalog/service.d.ts +160 -0
- package/dist/modules/catalog/service.d.ts.map +1 -0
- package/dist/modules/catalog/service.js +759 -0
- package/dist/modules/customers/repository/in-memory.d.ts +37 -0
- package/dist/modules/customers/repository/in-memory.d.ts.map +1 -0
- package/dist/modules/customers/repository/in-memory.js +278 -0
- package/dist/modules/customers/repository/index.d.ts +47 -0
- package/dist/modules/customers/repository/index.d.ts.map +1 -0
- package/dist/modules/customers/repository/index.js +206 -0
- package/dist/modules/customers/schema.d.ts +560 -0
- package/dist/modules/customers/schema.d.ts.map +1 -0
- package/dist/modules/customers/schema.js +60 -0
- package/dist/modules/customers/service.d.ts +25 -0
- package/dist/modules/customers/service.d.ts.map +1 -0
- package/dist/modules/customers/service.js +91 -0
- package/dist/modules/fulfillment/repository/in-memory.d.ts +53 -0
- package/dist/modules/fulfillment/repository/in-memory.d.ts.map +1 -0
- package/dist/modules/fulfillment/repository/in-memory.js +327 -0
- package/dist/modules/fulfillment/repository/index.d.ts +63 -0
- package/dist/modules/fulfillment/repository/index.d.ts.map +1 -0
- package/dist/modules/fulfillment/repository/index.js +268 -0
- package/dist/modules/fulfillment/schema.d.ts +655 -0
- package/dist/modules/fulfillment/schema.d.ts.map +1 -0
- package/dist/modules/fulfillment/schema.js +83 -0
- package/dist/modules/fulfillment/service.d.ts +58 -0
- package/dist/modules/fulfillment/service.d.ts.map +1 -0
- package/dist/modules/fulfillment/service.js +338 -0
- package/dist/modules/fulfillment/types.d.ts +44 -0
- package/dist/modules/fulfillment/types.d.ts.map +1 -0
- package/dist/modules/fulfillment/types.js +1 -0
- package/dist/modules/inventory/repository/in-memory.d.ts +51 -0
- package/dist/modules/inventory/repository/in-memory.d.ts.map +1 -0
- package/dist/modules/inventory/repository/in-memory.js +281 -0
- package/dist/modules/inventory/repository/index.d.ts +81 -0
- package/dist/modules/inventory/repository/index.d.ts.map +1 -0
- package/dist/modules/inventory/repository/index.js +310 -0
- package/dist/modules/inventory/schema.d.ts +570 -0
- package/dist/modules/inventory/schema.d.ts.map +1 -0
- package/dist/modules/inventory/schema.js +69 -0
- package/dist/modules/inventory/schemas.d.ts +31 -0
- package/dist/modules/inventory/schemas.d.ts.map +1 -0
- package/dist/modules/inventory/schemas.js +28 -0
- package/dist/modules/inventory/service.d.ts +65 -0
- package/dist/modules/inventory/service.d.ts.map +1 -0
- package/dist/modules/inventory/service.js +271 -0
- package/dist/modules/media/adapter.d.ts +16 -0
- package/dist/modules/media/adapter.d.ts.map +1 -0
- package/dist/modules/media/adapter.js +1 -0
- package/dist/modules/media/repository/in-memory.d.ts +26 -0
- package/dist/modules/media/repository/in-memory.d.ts.map +1 -0
- package/dist/modules/media/repository/in-memory.js +145 -0
- package/dist/modules/media/repository/index.d.ts +35 -0
- package/dist/modules/media/repository/index.d.ts.map +1 -0
- package/dist/modules/media/repository/index.js +176 -0
- package/dist/modules/media/schema.d.ts +289 -0
- package/dist/modules/media/schema.d.ts.map +1 -0
- package/dist/modules/media/schema.js +35 -0
- package/dist/modules/media/service.d.ts +42 -0
- package/dist/modules/media/service.d.ts.map +1 -0
- package/dist/modules/media/service.js +89 -0
- package/dist/modules/orders/repository/in-memory.d.ts +40 -0
- package/dist/modules/orders/repository/in-memory.d.ts.map +1 -0
- package/dist/modules/orders/repository/in-memory.js +245 -0
- package/dist/modules/orders/repository/index.d.ts +48 -0
- package/dist/modules/orders/repository/index.d.ts.map +1 -0
- package/dist/modules/orders/repository/index.js +199 -0
- package/dist/modules/orders/schema.d.ts +672 -0
- package/dist/modules/orders/schema.d.ts.map +1 -0
- package/dist/modules/orders/schema.js +63 -0
- package/dist/modules/orders/service.d.ts +85 -0
- package/dist/modules/orders/service.d.ts.map +1 -0
- package/dist/modules/orders/service.js +313 -0
- package/dist/modules/orders/stale-order-cleanup.d.ts +27 -0
- package/dist/modules/orders/stale-order-cleanup.d.ts.map +1 -0
- package/dist/modules/orders/stale-order-cleanup.js +55 -0
- package/dist/modules/organization/service.d.ts +53 -0
- package/dist/modules/organization/service.d.ts.map +1 -0
- package/dist/modules/organization/service.js +151 -0
- package/dist/modules/payments/adapter.d.ts +42 -0
- package/dist/modules/payments/adapter.d.ts.map +1 -0
- package/dist/modules/payments/adapter.js +1 -0
- package/dist/modules/payments/repository/index.d.ts +5 -0
- package/dist/modules/payments/repository/index.d.ts.map +1 -0
- package/dist/modules/payments/repository/index.js +1 -0
- package/dist/modules/payments/service.d.ts +23 -0
- package/dist/modules/payments/service.d.ts.map +1 -0
- package/dist/modules/payments/service.js +72 -0
- package/dist/modules/pricing/repository/in-memory.d.ts +25 -0
- package/dist/modules/pricing/repository/in-memory.d.ts.map +1 -0
- package/dist/modules/pricing/repository/in-memory.js +288 -0
- package/dist/modules/pricing/repository/index.d.ts +34 -0
- package/dist/modules/pricing/repository/index.d.ts.map +1 -0
- package/dist/modules/pricing/repository/index.js +176 -0
- package/dist/modules/pricing/schema.d.ts +565 -0
- package/dist/modules/pricing/schema.d.ts.map +1 -0
- package/dist/modules/pricing/schema.js +57 -0
- package/dist/modules/pricing/schemas.d.ts +37 -0
- package/dist/modules/pricing/schemas.d.ts.map +1 -0
- package/dist/modules/pricing/schemas.js +30 -0
- package/dist/modules/pricing/service.d.ts +62 -0
- package/dist/modules/pricing/service.d.ts.map +1 -0
- package/dist/modules/pricing/service.js +308 -0
- package/dist/modules/promotions/repository/in-memory.d.ts +32 -0
- package/dist/modules/promotions/repository/in-memory.d.ts.map +1 -0
- package/dist/modules/promotions/repository/in-memory.js +227 -0
- package/dist/modules/promotions/repository/index.d.ts +41 -0
- package/dist/modules/promotions/repository/index.d.ts.map +1 -0
- package/dist/modules/promotions/repository/index.js +204 -0
- package/dist/modules/promotions/schema.d.ts +427 -0
- package/dist/modules/promotions/schema.d.ts.map +1 -0
- package/dist/modules/promotions/schema.js +52 -0
- package/dist/modules/promotions/schemas.d.ts +33 -0
- package/dist/modules/promotions/schemas.d.ts.map +1 -0
- package/dist/modules/promotions/schemas.js +32 -0
- package/dist/modules/promotions/service.d.ts +80 -0
- package/dist/modules/promotions/service.d.ts.map +1 -0
- package/dist/modules/promotions/service.js +347 -0
- package/dist/modules/search/adapter.d.ts +51 -0
- package/dist/modules/search/adapter.d.ts.map +1 -0
- package/dist/modules/search/adapter.js +1 -0
- package/dist/modules/search/hooks.d.ts +8 -0
- package/dist/modules/search/hooks.d.ts.map +1 -0
- package/dist/modules/search/hooks.js +6 -0
- package/dist/modules/search/repository/index.d.ts +5 -0
- package/dist/modules/search/repository/index.d.ts.map +1 -0
- package/dist/modules/search/repository/index.js +1 -0
- package/dist/modules/search/service.d.ts +24 -0
- package/dist/modules/search/service.d.ts.map +1 -0
- package/dist/modules/search/service.js +217 -0
- package/dist/modules/shipping/calculator.d.ts +42 -0
- package/dist/modules/shipping/calculator.d.ts.map +1 -0
- package/dist/modules/shipping/calculator.js +91 -0
- package/dist/modules/shipping/repository/index.d.ts +5 -0
- package/dist/modules/shipping/repository/index.d.ts.map +1 -0
- package/dist/modules/shipping/repository/index.js +1 -0
- package/dist/modules/shipping/service.d.ts +28 -0
- package/dist/modules/shipping/service.d.ts.map +1 -0
- package/dist/modules/shipping/service.js +20 -0
- package/dist/modules/tax/adapter.d.ts +58 -0
- package/dist/modules/tax/adapter.d.ts.map +1 -0
- package/dist/modules/tax/adapter.js +1 -0
- package/dist/modules/tax/repository/index.d.ts +5 -0
- package/dist/modules/tax/repository/index.d.ts.map +1 -0
- package/dist/modules/tax/repository/index.js +1 -0
- package/dist/modules/tax/service.d.ts +19 -0
- package/dist/modules/tax/service.d.ts.map +1 -0
- package/dist/modules/tax/service.js +34 -0
- package/dist/modules/webhooks/hook.d.ts +13 -0
- package/dist/modules/webhooks/hook.d.ts.map +1 -0
- package/dist/modules/webhooks/hook.js +29 -0
- package/dist/modules/webhooks/repository/in-memory.d.ts +31 -0
- package/dist/modules/webhooks/repository/in-memory.d.ts.map +1 -0
- package/dist/modules/webhooks/repository/in-memory.js +187 -0
- package/dist/modules/webhooks/repository/index.d.ts +40 -0
- package/dist/modules/webhooks/repository/index.d.ts.map +1 -0
- package/dist/modules/webhooks/repository/index.js +175 -0
- package/dist/modules/webhooks/schema.d.ts +404 -0
- package/dist/modules/webhooks/schema.d.ts.map +1 -0
- package/dist/modules/webhooks/schema.js +40 -0
- package/dist/modules/webhooks/service.d.ts +23 -0
- package/dist/modules/webhooks/service.d.ts.map +1 -0
- package/dist/modules/webhooks/service.js +92 -0
- package/dist/modules/webhooks/signing.d.ts +2 -0
- package/dist/modules/webhooks/signing.d.ts.map +1 -0
- package/dist/modules/webhooks/signing.js +5 -0
- package/dist/modules/webhooks/ssrf-guard.d.ts +19 -0
- package/dist/modules/webhooks/ssrf-guard.d.ts.map +1 -0
- package/dist/modules/webhooks/ssrf-guard.js +79 -0
- package/dist/modules/webhooks/tasks.d.ts +16 -0
- package/dist/modules/webhooks/tasks.d.ts.map +1 -0
- package/dist/modules/webhooks/tasks.js +35 -0
- package/dist/modules/webhooks/worker.d.ts +21 -0
- package/dist/modules/webhooks/worker.d.ts.map +1 -0
- package/dist/modules/webhooks/worker.js +113 -0
- package/dist/runtime/commerce.d.ts +110 -0
- package/dist/runtime/commerce.d.ts.map +1 -0
- package/dist/runtime/commerce.js +37 -0
- package/dist/runtime/kernel.d.ts +72 -0
- package/dist/runtime/kernel.d.ts.map +1 -0
- package/dist/runtime/kernel.js +298 -0
- package/dist/runtime/logger.d.ts +11 -0
- package/dist/runtime/logger.d.ts.map +1 -0
- package/dist/runtime/logger.js +32 -0
- package/dist/runtime/server.d.ts +28 -0
- package/dist/runtime/server.d.ts.map +1 -0
- package/dist/runtime/server.js +277 -0
- package/dist/runtime/shutdown.d.ts +15 -0
- package/dist/runtime/shutdown.d.ts.map +1 -0
- package/dist/runtime/shutdown.js +34 -0
- package/dist/runtime/state-manager.d.ts +14 -0
- package/dist/runtime/state-manager.d.ts.map +1 -0
- package/dist/runtime/state-manager.js +84 -0
- package/dist/runtime/state-repository.d.ts +13 -0
- package/dist/runtime/state-repository.d.ts.map +1 -0
- package/dist/runtime/state-repository.js +160 -0
- package/dist/runtime/state.d.ts +382 -0
- package/dist/runtime/state.d.ts.map +1 -0
- package/dist/runtime/state.js +37 -0
- package/dist/runtime/store.d.ts +382 -0
- package/dist/runtime/store.d.ts.map +1 -0
- package/dist/runtime/store.js +37 -0
- package/dist/test-utils/create-pglite-adapter.d.ts +32 -0
- package/dist/test-utils/create-pglite-adapter.d.ts.map +1 -0
- package/dist/test-utils/create-pglite-adapter.js +106 -0
- package/dist/test-utils/create-plugin-test-app.d.ts +50 -0
- package/dist/test-utils/create-plugin-test-app.d.ts.map +1 -0
- package/dist/test-utils/create-plugin-test-app.js +74 -0
- package/dist/test-utils/create-repository-test-harness.d.ts +8 -0
- package/dist/test-utils/create-repository-test-harness.d.ts.map +1 -0
- package/dist/test-utils/create-repository-test-harness.js +7 -0
- package/dist/test-utils/create-test-config.d.ts +18 -0
- package/dist/test-utils/create-test-config.d.ts.map +1 -0
- package/dist/test-utils/create-test-config.js +174 -0
- package/dist/test-utils/create-test-kernel.d.ts +3 -0
- package/dist/test-utils/create-test-kernel.d.ts.map +1 -0
- package/dist/test-utils/create-test-kernel.js +5 -0
- package/dist/test-utils/create-test-plugin-context.d.ts +42 -0
- package/dist/test-utils/create-test-plugin-context.d.ts.map +1 -0
- package/dist/test-utils/create-test-plugin-context.js +46 -0
- package/dist/test-utils/rest-api-test-utils.d.ts +64 -0
- package/dist/test-utils/rest-api-test-utils.d.ts.map +1 -0
- package/dist/test-utils/rest-api-test-utils.js +207 -0
- package/dist/test-utils/test-actors.d.ts +15 -0
- package/dist/test-utils/test-actors.d.ts.map +1 -0
- package/dist/test-utils/test-actors.js +57 -0
- package/dist/test-utils/typed-hooks.d.ts +43 -0
- package/dist/test-utils/typed-hooks.d.ts.map +1 -0
- package/dist/test-utils/typed-hooks.js +35 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/commerce-types.d.ts +34 -0
- package/dist/types/commerce-types.d.ts.map +1 -0
- package/dist/types/commerce-types.js +1 -0
- package/dist/utils/id.d.ts +2 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/id.js +3 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +16 -0
- package/dist/utils/pagination.d.ts +11 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/pagination.js +15 -0
- package/package.json +63 -0
- package/src/adapters/console-email.ts +43 -0
- package/src/auth/access.ts +187 -0
- package/src/auth/auth-schema.ts +131 -0
- package/src/auth/middleware.ts +115 -0
- package/src/auth/org.ts +41 -0
- package/src/auth/permissions.ts +28 -0
- package/src/auth/setup.ts +160 -0
- package/src/auth/system-actor.ts +19 -0
- package/src/auth/types.ts +10 -0
- package/src/config/defaults.ts +82 -0
- package/src/config/define-config.ts +53 -0
- package/src/config/types.ts +299 -0
- package/src/generated/plugin-capabilities.d.ts +20 -0
- package/src/generated/plugin-manifest.ts +23 -0
- package/src/generated/plugin-repositories.d.ts +20 -0
- package/src/hooks/checkout-completion.ts +262 -0
- package/src/hooks/checkout.ts +677 -0
- package/src/hooks/order-emails.ts +62 -0
- package/src/index.ts +214 -0
- package/src/interfaces/mcp/agent-prompt.ts +174 -0
- package/src/interfaces/mcp/context-enrichment.ts +177 -0
- package/src/interfaces/mcp/server.ts +617 -0
- package/src/interfaces/mcp/transport.ts +68 -0
- package/src/interfaces/rest/customer-portal.ts +299 -0
- package/src/interfaces/rest/index.ts +74 -0
- package/src/interfaces/rest/router.ts +334 -0
- package/src/interfaces/rest/routes/admin-jobs.ts +58 -0
- package/src/interfaces/rest/routes/audit.ts +50 -0
- package/src/interfaces/rest/routes/carts.ts +89 -0
- package/src/interfaces/rest/routes/catalog.ts +493 -0
- package/src/interfaces/rest/routes/checkout.ts +283 -0
- package/src/interfaces/rest/routes/inventory.ts +70 -0
- package/src/interfaces/rest/routes/media.ts +86 -0
- package/src/interfaces/rest/routes/orders.ts +78 -0
- package/src/interfaces/rest/routes/payments.ts +60 -0
- package/src/interfaces/rest/routes/pricing.ts +57 -0
- package/src/interfaces/rest/routes/promotions.ts +92 -0
- package/src/interfaces/rest/routes/search.ts +71 -0
- package/src/interfaces/rest/routes/webhooks.ts +46 -0
- package/src/interfaces/rest/schemas/admin-jobs.ts +40 -0
- package/src/interfaces/rest/schemas/audit.ts +46 -0
- package/src/interfaces/rest/schemas/carts.ts +125 -0
- package/src/interfaces/rest/schemas/catalog.ts +450 -0
- package/src/interfaces/rest/schemas/checkout.ts +66 -0
- package/src/interfaces/rest/schemas/customer-portal.ts +195 -0
- package/src/interfaces/rest/schemas/inventory.ts +138 -0
- package/src/interfaces/rest/schemas/media.ts +75 -0
- package/src/interfaces/rest/schemas/orders.ts +104 -0
- package/src/interfaces/rest/schemas/pricing.ts +80 -0
- package/src/interfaces/rest/schemas/promotions.ts +110 -0
- package/src/interfaces/rest/schemas/responses.ts +85 -0
- package/src/interfaces/rest/schemas/search.ts +58 -0
- package/src/interfaces/rest/schemas/shared.ts +62 -0
- package/src/interfaces/rest/schemas/webhooks.ts +68 -0
- package/src/interfaces/rest/utils.ts +104 -0
- package/src/interfaces/rest/webhook-router.ts +50 -0
- package/src/kernel/compensation/executor.ts +61 -0
- package/src/kernel/compensation/types.ts +26 -0
- package/src/kernel/database/adapter.ts +13 -0
- package/src/kernel/database/drizzle-db.ts +56 -0
- package/src/kernel/database/migrate.ts +76 -0
- package/src/kernel/database/plugin-types.ts +34 -0
- package/src/kernel/database/schema.ts +49 -0
- package/src/kernel/database/scoped-db.ts +68 -0
- package/src/kernel/database/tx-context.ts +46 -0
- package/src/kernel/error-mapper.ts +15 -0
- package/src/kernel/errors.ts +89 -0
- package/src/kernel/factory/repository-factory.ts +242 -0
- package/src/kernel/hooks/create-context.ts +43 -0
- package/src/kernel/hooks/executor.ts +88 -0
- package/src/kernel/hooks/registry.ts +74 -0
- package/src/kernel/hooks/types.ts +52 -0
- package/src/kernel/http-error.ts +44 -0
- package/src/kernel/jobs/adapter.ts +36 -0
- package/src/kernel/jobs/drizzle-adapter.ts +58 -0
- package/src/kernel/jobs/runner.ts +153 -0
- package/src/kernel/jobs/schema.ts +46 -0
- package/src/kernel/jobs/types.ts +30 -0
- package/src/kernel/local-api.ts +185 -0
- package/src/kernel/plugin/manifest.ts +253 -0
- package/src/kernel/query/executor.ts +184 -0
- package/src/kernel/query/registry.ts +46 -0
- package/src/kernel/result.ts +33 -0
- package/src/kernel/schema/extra-columns.ts +37 -0
- package/src/kernel/service-registry.ts +76 -0
- package/src/kernel/service-timing.ts +89 -0
- package/src/kernel/state-machine/machine.ts +101 -0
- package/src/modules/analytics/drizzle-adapter.ts +426 -0
- package/src/modules/analytics/hooks.ts +11 -0
- package/src/modules/analytics/models.ts +125 -0
- package/src/modules/analytics/repository/index.ts +6 -0
- package/src/modules/analytics/service.ts +245 -0
- package/src/modules/analytics/types.ts +180 -0
- package/src/modules/audit/hooks.ts +78 -0
- package/src/modules/audit/schema.ts +33 -0
- package/src/modules/audit/service.ts +151 -0
- package/src/modules/cart/access.ts +27 -0
- package/src/modules/cart/matcher.ts +26 -0
- package/src/modules/cart/repository/index.ts +234 -0
- package/src/modules/cart/schema.ts +42 -0
- package/src/modules/cart/schemas.ts +38 -0
- package/src/modules/cart/service.ts +541 -0
- package/src/modules/catalog/repository/index.ts +772 -0
- package/src/modules/catalog/schema.ts +203 -0
- package/src/modules/catalog/schemas.ts +104 -0
- package/src/modules/catalog/service.ts +1544 -0
- package/src/modules/customers/repository/index.ts +327 -0
- package/src/modules/customers/schema.ts +64 -0
- package/src/modules/customers/service.ts +171 -0
- package/src/modules/fulfillment/repository/index.ts +426 -0
- package/src/modules/fulfillment/schema.ts +101 -0
- package/src/modules/fulfillment/service.ts +555 -0
- package/src/modules/fulfillment/types.ts +59 -0
- package/src/modules/inventory/repository/index.ts +509 -0
- package/src/modules/inventory/schema.ts +94 -0
- package/src/modules/inventory/schemas.ts +38 -0
- package/src/modules/inventory/service.ts +490 -0
- package/src/modules/media/adapter.ts +17 -0
- package/src/modules/media/repository/index.ts +274 -0
- package/src/modules/media/schema.ts +41 -0
- package/src/modules/media/service.ts +151 -0
- package/src/modules/orders/repository/index.ts +287 -0
- package/src/modules/orders/schema.ts +66 -0
- package/src/modules/orders/service.ts +619 -0
- package/src/modules/orders/stale-order-cleanup.ts +76 -0
- package/src/modules/organization/service.ts +191 -0
- package/src/modules/payments/adapter.ts +47 -0
- package/src/modules/payments/repository/index.ts +6 -0
- package/src/modules/payments/service.ts +107 -0
- package/src/modules/pricing/repository/index.ts +291 -0
- package/src/modules/pricing/schema.ts +71 -0
- package/src/modules/pricing/schemas.ts +38 -0
- package/src/modules/pricing/service.ts +494 -0
- package/src/modules/promotions/repository/index.ts +325 -0
- package/src/modules/promotions/schema.ts +62 -0
- package/src/modules/promotions/schemas.ts +38 -0
- package/src/modules/promotions/service.ts +598 -0
- package/src/modules/search/adapter.ts +57 -0
- package/src/modules/search/hooks.ts +12 -0
- package/src/modules/search/repository/index.ts +6 -0
- package/src/modules/search/service.ts +315 -0
- package/src/modules/shipping/calculator.ts +188 -0
- package/src/modules/shipping/repository/index.ts +6 -0
- package/src/modules/shipping/service.ts +51 -0
- package/src/modules/tax/adapter.ts +60 -0
- package/src/modules/tax/repository/index.ts +6 -0
- package/src/modules/tax/service.ts +53 -0
- package/src/modules/webhooks/hook.ts +34 -0
- package/src/modules/webhooks/repository/index.ts +278 -0
- package/src/modules/webhooks/schema.ts +56 -0
- package/src/modules/webhooks/service.ts +117 -0
- package/src/modules/webhooks/signing.ts +6 -0
- package/src/modules/webhooks/ssrf-guard.ts +71 -0
- package/src/modules/webhooks/tasks.ts +52 -0
- package/src/modules/webhooks/worker.ts +134 -0
- package/src/runtime/commerce.ts +145 -0
- package/src/runtime/kernel.ts +419 -0
- package/src/runtime/logger.ts +36 -0
- package/src/runtime/server.ts +345 -0
- package/src/runtime/shutdown.ts +43 -0
- package/src/test-utils/create-pglite-adapter.ts +129 -0
- package/src/test-utils/create-plugin-test-app.ts +128 -0
- package/src/test-utils/create-repository-test-harness.ts +16 -0
- package/src/test-utils/create-test-config.ts +190 -0
- package/src/test-utils/create-test-kernel.ts +7 -0
- package/src/test-utils/create-test-plugin-context.ts +75 -0
- package/src/test-utils/rest-api-test-utils.ts +265 -0
- package/src/test-utils/test-actors.ts +62 -0
- package/src/test-utils/typed-hooks.ts +54 -0
- package/src/types/commerce-types.ts +34 -0
- package/src/utils/id.ts +3 -0
- package/src/utils/logger.ts +18 -0
- package/src/utils/pagination.ts +22 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
// ─── Zod Body Schemas (single source of truth) ─────────────────────────────
|
|
3
|
+
export const InventoryAdjustBodySchema = z.object({
|
|
4
|
+
entityId: z.string().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
|
|
5
|
+
variantId: z.string().optional().openapi({ example: "variant-uuid" }),
|
|
6
|
+
warehouseId: z.string().optional().openapi({ example: "warehouse-uuid" }),
|
|
7
|
+
adjustment: z.number().int().refine((v) => v !== 0, { message: "Adjustment cannot be zero" }).openapi({ example: 10 }),
|
|
8
|
+
reason: z.string().openapi({ example: "Restock from supplier" }),
|
|
9
|
+
performedBy: z.string().optional(),
|
|
10
|
+
referenceType: z.string().optional(),
|
|
11
|
+
referenceId: z.string().optional(),
|
|
12
|
+
}).openapi("InventoryAdjustRequest");
|
|
13
|
+
export const InventoryReserveBodySchema = z.object({
|
|
14
|
+
entityId: z.string().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
|
|
15
|
+
variantId: z.string().optional(),
|
|
16
|
+
warehouseId: z.string().optional(),
|
|
17
|
+
quantity: z.number().int().min(1).openapi({ example: 2 }),
|
|
18
|
+
orderId: z.string().openapi({ example: "order-uuid" }),
|
|
19
|
+
performedBy: z.string().optional(),
|
|
20
|
+
}).openapi("InventoryReserveRequest");
|
|
21
|
+
export const InventoryReleaseBodySchema = z.object({
|
|
22
|
+
entityId: z.string().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
|
|
23
|
+
variantId: z.string().optional(),
|
|
24
|
+
warehouseId: z.string().optional(),
|
|
25
|
+
quantity: z.number().int().min(1).openapi({ example: 2 }),
|
|
26
|
+
orderId: z.string().openapi({ example: "order-uuid" }),
|
|
27
|
+
performedBy: z.string().optional(),
|
|
28
|
+
}).openapi("InventoryReleaseRequest");
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Actor } from "../../auth/types";
|
|
2
|
+
import type { CommerceConfig } from "../../config/types";
|
|
3
|
+
import type { HookRegistry } from "../../kernel/hooks/registry";
|
|
4
|
+
import { type Result } from "../../kernel/result";
|
|
5
|
+
import type { DatabaseAdapter } from "../../kernel/database/adapter";
|
|
6
|
+
import { type TxContext } from "../../kernel/database/tx-context";
|
|
7
|
+
import { InventoryRepository, type Warehouse, type InventoryLevel } from "./repository";
|
|
8
|
+
export type { InventoryAdjustInput, InventoryReserveInput, InventoryReleaseInput } from "./schemas";
|
|
9
|
+
import type { InventoryAdjustInput, InventoryReserveInput, InventoryReleaseInput } from "./schemas";
|
|
10
|
+
export interface InventoryServiceDeps {
|
|
11
|
+
repository: InventoryRepository;
|
|
12
|
+
hooks: HookRegistry;
|
|
13
|
+
config: CommerceConfig;
|
|
14
|
+
services: Record<string, unknown>;
|
|
15
|
+
database: DatabaseAdapter;
|
|
16
|
+
}
|
|
17
|
+
export declare class InventoryService {
|
|
18
|
+
private deps;
|
|
19
|
+
private readonly repo;
|
|
20
|
+
constructor(deps: InventoryServiceDeps);
|
|
21
|
+
private pickWarehouse;
|
|
22
|
+
createWarehouse(input: Partial<Warehouse>, actor?: Actor | null, ctx?: TxContext): Promise<Result<Warehouse>>;
|
|
23
|
+
listWarehouses(actor?: Actor | null, ctx?: TxContext): Promise<Result<Warehouse[]>>;
|
|
24
|
+
getAvailable(entityId: string, variantId?: string, ctx?: TxContext): Promise<Result<number>>;
|
|
25
|
+
checkMultiple(entityIds: string[], ctx?: TxContext): Promise<Result<Record<string, number>>>;
|
|
26
|
+
getLevelsByEntityId(entityId: string, ctx?: TxContext): Promise<Result<InventoryLevel[]>>;
|
|
27
|
+
reserve(input: InventoryReserveInput, actor?: Actor | null, ctx?: TxContext): Promise<Result<void>>;
|
|
28
|
+
release(input: InventoryReleaseInput, actor?: Actor | null, ctx?: TxContext): Promise<Result<void>>;
|
|
29
|
+
adjust(input: InventoryAdjustInput, actor?: Actor | null, ctx?: TxContext): Promise<Result<InventoryLevel>>;
|
|
30
|
+
/**
|
|
31
|
+
* Set inventory to an absolute quantity (not a delta).
|
|
32
|
+
*
|
|
33
|
+
* Used by external store webhooks where the source system reports
|
|
34
|
+
* the current stock level (e.g., Shopify sends `{ available: 6 }`).
|
|
35
|
+
* Computes the delta internally so audit movements stay correct.
|
|
36
|
+
*/
|
|
37
|
+
setAbsolute(input: {
|
|
38
|
+
entityId: string;
|
|
39
|
+
quantity: number;
|
|
40
|
+
warehouseId?: string;
|
|
41
|
+
variantId?: string;
|
|
42
|
+
reason?: string;
|
|
43
|
+
}, actor?: Actor | null, ctx?: TxContext): Promise<Result<InventoryLevel>>;
|
|
44
|
+
/**
|
|
45
|
+
* Deduct inventory on fulfillment (system-level, no permission check).
|
|
46
|
+
*
|
|
47
|
+
* Decrements quantityOnHand for fulfilled items. This is a system
|
|
48
|
+
* operation triggered by order status → fulfilled, not a manual
|
|
49
|
+
* stock adjustment. Creates a "fulfillment" type movement for audit.
|
|
50
|
+
*
|
|
51
|
+
* Net effect when paired with release():
|
|
52
|
+
* Before: on_hand=100, reserved=5, available=95
|
|
53
|
+
* After deduct+release: on_hand=95, reserved=0, available=95
|
|
54
|
+
*/
|
|
55
|
+
deductForFulfillment(input: {
|
|
56
|
+
entityId: string;
|
|
57
|
+
variantId?: string;
|
|
58
|
+
warehouseId?: string;
|
|
59
|
+
quantity: number;
|
|
60
|
+
orderId: string;
|
|
61
|
+
orgId?: string;
|
|
62
|
+
}, ctx?: TxContext): Promise<Result<void>>;
|
|
63
|
+
setUnitCost(entityId: string, warehouseId: string, unitCost: number, variantId?: string, ctx?: TxContext): Promise<Result<InventoryLevel>>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/modules/inventory/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AASzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EACL,mBAAmB,EACnB,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEpG,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,mBAAmB,CAAC;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,qBAAa,gBAAgB;IAGf,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsB;gBAEvB,IAAI,EAAE,oBAAoB;YAIhC,aAAa;IAuBrB,eAAe,CACnB,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,EACzB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EACpB,GAAG,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAyBvB,cAAc,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IAMnF,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,GAAG,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IASpB,aAAa,CACjB,SAAS,EAAE,MAAM,EAAE,EACnB,GAAG,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAKpC,mBAAmB,CACvB,QAAQ,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;IAK9B,OAAO,CACX,KAAK,EAAE,qBAAqB,EAC5B,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EACpB,GAAG,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAuFlB,OAAO,CACX,KAAK,EAAE,qBAAqB,EAC5B,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EACpB,GAAG,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAgDlB,MAAM,CACV,KAAK,EAAE,oBAAoB,EAC3B,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EACpB,GAAG,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAsFlC;;;;;;OAMG;IACG,WAAW,CACf,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,EACD,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EACpB,GAAG,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IA2BlC;;;;;;;;;;OAUG;IACG,oBAAoB,CACxB,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,EACD,GAAG,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAwClB,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,GAAG,CAAC,EAAE,SAAS,GACd,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;CAiBnC"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { resolveOrgId } from "../../auth/org";
|
|
2
|
+
import { assertPermission } from "../../auth/permissions";
|
|
3
|
+
import { CommerceNotFoundError, CommerceValidationError, toCommerceError, } from "../../kernel/errors";
|
|
4
|
+
import { runAfterHooks } from "../../kernel/hooks/executor";
|
|
5
|
+
import { createHookContext } from "../../kernel/hooks/create-context";
|
|
6
|
+
import { Err, Ok } from "../../kernel/result";
|
|
7
|
+
import { createLogger } from "../../utils/logger";
|
|
8
|
+
import { createTxContext } from "../../kernel/database/tx-context";
|
|
9
|
+
export class InventoryService {
|
|
10
|
+
deps;
|
|
11
|
+
repo;
|
|
12
|
+
constructor(deps) {
|
|
13
|
+
this.deps = deps;
|
|
14
|
+
this.repo = deps.repository;
|
|
15
|
+
}
|
|
16
|
+
async pickWarehouse(actor, ctx) {
|
|
17
|
+
const orgId = resolveOrgId(actor ?? ctx?.actor ?? null);
|
|
18
|
+
const warehouses = await this.repo.findAllWarehouses(orgId, ctx);
|
|
19
|
+
const sorted = warehouses.sort((a, b) => a.priority - b.priority);
|
|
20
|
+
if (sorted.length > 0) {
|
|
21
|
+
return sorted[0].id;
|
|
22
|
+
}
|
|
23
|
+
// Create default warehouse if none exists
|
|
24
|
+
const defaultWarehouse = await this.repo.createWarehouse({
|
|
25
|
+
organizationId: orgId,
|
|
26
|
+
name: "Default Warehouse",
|
|
27
|
+
code: "DEFAULT",
|
|
28
|
+
isActive: true,
|
|
29
|
+
priority: 0,
|
|
30
|
+
metadata: {},
|
|
31
|
+
}, ctx);
|
|
32
|
+
return defaultWarehouse.id;
|
|
33
|
+
}
|
|
34
|
+
async createWarehouse(input, actor, ctx) {
|
|
35
|
+
if (!input.name || !input.code) {
|
|
36
|
+
return Err(new CommerceValidationError("Warehouse name and code are required."));
|
|
37
|
+
}
|
|
38
|
+
const orgId = resolveOrgId(actor ?? ctx?.actor ?? null);
|
|
39
|
+
const warehouse = await this.repo.createWarehouse({
|
|
40
|
+
organizationId: orgId,
|
|
41
|
+
name: input.name,
|
|
42
|
+
code: input.code,
|
|
43
|
+
isActive: input.isActive ?? true,
|
|
44
|
+
priority: input.priority ?? 0,
|
|
45
|
+
metadata: input.metadata ?? {},
|
|
46
|
+
...(input.address !== undefined ? { address: input.address } : {}),
|
|
47
|
+
}, ctx);
|
|
48
|
+
return Ok(warehouse);
|
|
49
|
+
}
|
|
50
|
+
async listWarehouses(actor, ctx) {
|
|
51
|
+
const orgId = resolveOrgId(actor ?? ctx?.actor ?? null);
|
|
52
|
+
const warehouses = await this.repo.findAllWarehouses(orgId, ctx);
|
|
53
|
+
return Ok(warehouses.sort((a, b) => a.priority - b.priority));
|
|
54
|
+
}
|
|
55
|
+
async getAvailable(entityId, variantId, ctx) {
|
|
56
|
+
const available = await this.repo.getAvailableQuantity(entityId, variantId, ctx);
|
|
57
|
+
return Ok(available);
|
|
58
|
+
}
|
|
59
|
+
async checkMultiple(entityIds, ctx) {
|
|
60
|
+
const data = await this.repo.getAvailableQuantities(entityIds, ctx);
|
|
61
|
+
return Ok(data);
|
|
62
|
+
}
|
|
63
|
+
async getLevelsByEntityId(entityId, ctx) {
|
|
64
|
+
const levels = await this.repo.findLevelsByEntityId(entityId, ctx);
|
|
65
|
+
return Ok(levels);
|
|
66
|
+
}
|
|
67
|
+
async reserve(input, actor, ctx) {
|
|
68
|
+
if (input.quantity <= 0) {
|
|
69
|
+
return Err(new CommerceValidationError("Reservation quantity must be greater than zero."));
|
|
70
|
+
}
|
|
71
|
+
const warehouseId = input.warehouseId ?? (await this.pickWarehouse(actor, ctx));
|
|
72
|
+
const performedBy = input.performedBy ?? actor?.userId ?? "system";
|
|
73
|
+
const variantId = input.variantId ?? null;
|
|
74
|
+
// If we have a transaction context, use the concurrency-safe
|
|
75
|
+
// reserveWithLock (SELECT FOR UPDATE). This is the correct path
|
|
76
|
+
// for checkout — it prevents two concurrent requests from both
|
|
77
|
+
// reserving the last unit.
|
|
78
|
+
if (ctx?.tx) {
|
|
79
|
+
const reserveResult = await this.repo.reserveWithLock(input.entityId, variantId, warehouseId, input.quantity, ctx);
|
|
80
|
+
if (!reserveResult.ok) {
|
|
81
|
+
return Err(new CommerceValidationError(reserveResult.reason));
|
|
82
|
+
}
|
|
83
|
+
await this.repo.createMovement({
|
|
84
|
+
entityId: input.entityId,
|
|
85
|
+
warehouseId,
|
|
86
|
+
type: "reservation",
|
|
87
|
+
quantity: input.quantity,
|
|
88
|
+
performedBy,
|
|
89
|
+
referenceType: "order",
|
|
90
|
+
referenceId: input.orderId,
|
|
91
|
+
...(input.variantId != null
|
|
92
|
+
? { variantId: input.variantId }
|
|
93
|
+
: {}),
|
|
94
|
+
}, ctx);
|
|
95
|
+
return Ok(undefined);
|
|
96
|
+
}
|
|
97
|
+
// Fallback: no transaction provided. Wrap in a transaction so we can
|
|
98
|
+
// use reserveWithLock (SELECT FOR UPDATE) for concurrency safety.
|
|
99
|
+
const result = await this.deps.database.transaction(async (tx) => {
|
|
100
|
+
const txCtx = createTxContext(tx, { actor: actor ?? null });
|
|
101
|
+
const reserveResult = await this.repo.reserveWithLock(input.entityId, variantId, warehouseId, input.quantity, txCtx);
|
|
102
|
+
if (!reserveResult.ok) {
|
|
103
|
+
return Err(new CommerceValidationError(reserveResult.reason));
|
|
104
|
+
}
|
|
105
|
+
await this.repo.createMovement({
|
|
106
|
+
entityId: input.entityId,
|
|
107
|
+
warehouseId,
|
|
108
|
+
type: "reservation",
|
|
109
|
+
quantity: input.quantity,
|
|
110
|
+
performedBy,
|
|
111
|
+
referenceType: "order",
|
|
112
|
+
referenceId: input.orderId,
|
|
113
|
+
...(input.variantId != null
|
|
114
|
+
? { variantId: input.variantId }
|
|
115
|
+
: {}),
|
|
116
|
+
}, txCtx);
|
|
117
|
+
return Ok(undefined);
|
|
118
|
+
});
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
async release(input, actor, ctx) {
|
|
122
|
+
const warehouseId = input.warehouseId ?? (await this.pickWarehouse(actor, ctx));
|
|
123
|
+
const performedBy = input.performedBy ?? actor?.userId ?? "system";
|
|
124
|
+
const variantId = input.variantId ?? null;
|
|
125
|
+
const doRelease = async (txCtx) => {
|
|
126
|
+
const releaseResult = await this.repo.releaseWithLock(input.entityId, variantId, warehouseId, input.quantity, txCtx);
|
|
127
|
+
if (!releaseResult.ok) {
|
|
128
|
+
return Err(new CommerceValidationError(releaseResult.reason));
|
|
129
|
+
}
|
|
130
|
+
await this.repo.createMovement({
|
|
131
|
+
entityId: input.entityId,
|
|
132
|
+
warehouseId,
|
|
133
|
+
type: "release",
|
|
134
|
+
quantity: input.quantity,
|
|
135
|
+
performedBy,
|
|
136
|
+
referenceType: "order",
|
|
137
|
+
referenceId: input.orderId,
|
|
138
|
+
...(input.variantId != null
|
|
139
|
+
? { variantId: input.variantId }
|
|
140
|
+
: {}),
|
|
141
|
+
}, txCtx);
|
|
142
|
+
return Ok(undefined);
|
|
143
|
+
};
|
|
144
|
+
// If we already have a transaction, use it directly
|
|
145
|
+
if (ctx?.tx) {
|
|
146
|
+
return doRelease(ctx);
|
|
147
|
+
}
|
|
148
|
+
// Otherwise wrap in a new transaction for locking safety
|
|
149
|
+
return this.deps.database.transaction(async (tx) => {
|
|
150
|
+
return doRelease(createTxContext(tx, { actor: actor ?? null }));
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
async adjust(input, actor, ctx) {
|
|
154
|
+
try {
|
|
155
|
+
assertPermission(actor ?? null, "inventory:adjust");
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
return Err(toCommerceError(error));
|
|
159
|
+
}
|
|
160
|
+
const warehouseId = input.warehouseId ?? (await this.pickWarehouse(actor, ctx));
|
|
161
|
+
// Use upsertLevel to create or update
|
|
162
|
+
const existingLevel = await this.repo.findLevelByKey(input.entityId, warehouseId, input.variantId, ctx);
|
|
163
|
+
let level;
|
|
164
|
+
if (existingLevel) {
|
|
165
|
+
const newQuantity = Math.max(0, existingLevel.quantityOnHand + input.adjustment);
|
|
166
|
+
const updated = await this.repo.updateLevel(existingLevel.id, { quantityOnHand: newQuantity }, ctx);
|
|
167
|
+
level = updated;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
level = await this.repo.createLevel({
|
|
171
|
+
entityId: input.entityId,
|
|
172
|
+
warehouseId,
|
|
173
|
+
quantityOnHand: Math.max(0, input.adjustment),
|
|
174
|
+
quantityReserved: 0,
|
|
175
|
+
quantityIncoming: 0,
|
|
176
|
+
...(input.variantId !== undefined
|
|
177
|
+
? { variantId: input.variantId }
|
|
178
|
+
: {}),
|
|
179
|
+
}, ctx);
|
|
180
|
+
}
|
|
181
|
+
await this.repo.createMovement({
|
|
182
|
+
entityId: input.entityId,
|
|
183
|
+
warehouseId,
|
|
184
|
+
type: "adjustment",
|
|
185
|
+
quantity: input.adjustment,
|
|
186
|
+
reason: input.reason,
|
|
187
|
+
performedBy: input.performedBy ?? actor?.userId ?? "system",
|
|
188
|
+
...(input.variantId !== undefined
|
|
189
|
+
? { variantId: input.variantId }
|
|
190
|
+
: {}),
|
|
191
|
+
...(input.referenceType !== undefined
|
|
192
|
+
? { referenceType: input.referenceType }
|
|
193
|
+
: {}),
|
|
194
|
+
...(input.referenceId !== undefined
|
|
195
|
+
? { referenceId: input.referenceId }
|
|
196
|
+
: {}),
|
|
197
|
+
}, ctx);
|
|
198
|
+
const context = createHookContext({
|
|
199
|
+
actor: actor ?? null,
|
|
200
|
+
tx: ctx?.tx ?? null,
|
|
201
|
+
logger: createLogger("inventory.adjust"),
|
|
202
|
+
services: this.deps.services,
|
|
203
|
+
context: { moduleName: "inventory" },
|
|
204
|
+
});
|
|
205
|
+
const afterHooks = this.deps.hooks.resolve("inventory.afterAdjust");
|
|
206
|
+
await runAfterHooks(afterHooks, null, level, "update", context);
|
|
207
|
+
return Ok(level);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Set inventory to an absolute quantity (not a delta).
|
|
211
|
+
*
|
|
212
|
+
* Used by external store webhooks where the source system reports
|
|
213
|
+
* the current stock level (e.g., Shopify sends `{ available: 6 }`).
|
|
214
|
+
* Computes the delta internally so audit movements stay correct.
|
|
215
|
+
*/
|
|
216
|
+
async setAbsolute(input, actor, ctx) {
|
|
217
|
+
const warehouseId = input.warehouseId ?? (await this.pickWarehouse(actor, ctx));
|
|
218
|
+
const existingLevel = await this.repo.findLevelByKey(input.entityId, warehouseId, input.variantId, ctx);
|
|
219
|
+
const currentOnHand = existingLevel?.quantityOnHand ?? 0;
|
|
220
|
+
const delta = input.quantity - currentOnHand;
|
|
221
|
+
// Delegate to adjust() so hooks, movements, and permission checks are consistent
|
|
222
|
+
return this.adjust({
|
|
223
|
+
entityId: input.entityId,
|
|
224
|
+
warehouseId,
|
|
225
|
+
adjustment: delta,
|
|
226
|
+
reason: input.reason ?? "External store absolute inventory sync",
|
|
227
|
+
...(input.variantId !== undefined ? { variantId: input.variantId } : {}),
|
|
228
|
+
}, actor, ctx);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Deduct inventory on fulfillment (system-level, no permission check).
|
|
232
|
+
*
|
|
233
|
+
* Decrements quantityOnHand for fulfilled items. This is a system
|
|
234
|
+
* operation triggered by order status → fulfilled, not a manual
|
|
235
|
+
* stock adjustment. Creates a "fulfillment" type movement for audit.
|
|
236
|
+
*
|
|
237
|
+
* Net effect when paired with release():
|
|
238
|
+
* Before: on_hand=100, reserved=5, available=95
|
|
239
|
+
* After deduct+release: on_hand=95, reserved=0, available=95
|
|
240
|
+
*/
|
|
241
|
+
async deductForFulfillment(input, ctx) {
|
|
242
|
+
const warehouseId = input.warehouseId ?? (await this.pickWarehouse(null, ctx));
|
|
243
|
+
const variantId = input.variantId ?? null;
|
|
244
|
+
const level = await this.repo.findLevelByKey(input.entityId, warehouseId, variantId != null ? variantId : undefined, ctx);
|
|
245
|
+
if (!level) {
|
|
246
|
+
// No inventory record — nothing to deduct
|
|
247
|
+
return Ok(undefined);
|
|
248
|
+
}
|
|
249
|
+
const newOnHand = Math.max(0, level.quantityOnHand - input.quantity);
|
|
250
|
+
await this.repo.updateLevel(level.id, { quantityOnHand: newOnHand }, ctx);
|
|
251
|
+
await this.repo.createMovement({
|
|
252
|
+
entityId: input.entityId,
|
|
253
|
+
warehouseId,
|
|
254
|
+
type: "fulfillment",
|
|
255
|
+
quantity: -input.quantity,
|
|
256
|
+
performedBy: "system",
|
|
257
|
+
referenceType: "order",
|
|
258
|
+
referenceId: input.orderId,
|
|
259
|
+
...(variantId != null ? { variantId } : {}),
|
|
260
|
+
}, ctx);
|
|
261
|
+
return Ok(undefined);
|
|
262
|
+
}
|
|
263
|
+
async setUnitCost(entityId, warehouseId, unitCost, variantId, ctx) {
|
|
264
|
+
const level = await this.repo.findLevelByKey(entityId, warehouseId, variantId, ctx);
|
|
265
|
+
if (!level) {
|
|
266
|
+
return Err(new CommerceNotFoundError(`Inventory level not found for entity ${entityId} at warehouse ${warehouseId}.`));
|
|
267
|
+
}
|
|
268
|
+
const updated = await this.repo.updateLevel(level.id, { unitCost }, ctx);
|
|
269
|
+
return Ok(updated);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Result } from "../../kernel/result";
|
|
2
|
+
export interface StoredFile {
|
|
3
|
+
key: string;
|
|
4
|
+
url: string;
|
|
5
|
+
contentType: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface StorageAdapter {
|
|
9
|
+
readonly providerId: string;
|
|
10
|
+
upload(key: string, data: ArrayBuffer | ReadableStream, contentType: string): Promise<Result<StoredFile>>;
|
|
11
|
+
getUrl(key: string): Promise<Result<string>>;
|
|
12
|
+
getSignedUrl(key: string, expiresIn: number): Promise<Result<string>>;
|
|
13
|
+
delete(key: string): Promise<Result<void>>;
|
|
14
|
+
list(prefix: string): Promise<Result<StoredFile[]>>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/modules/media/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1G,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACtE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;CACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TxContext } from "../../../kernel/database/tx-context";
|
|
2
|
+
import type { MediaAsset, MediaAssetInsert, EntityMedia, EntityMediaInsert } from "./index";
|
|
3
|
+
/**
|
|
4
|
+
* In-memory implementation of MediaRepository for testing.
|
|
5
|
+
* Provides the same interface as the Drizzle-based repository but stores data in memory.
|
|
6
|
+
*/
|
|
7
|
+
export declare class InMemoryMediaRepository {
|
|
8
|
+
private assets;
|
|
9
|
+
private entityMediaList;
|
|
10
|
+
findAssetById(id: string, _ctx?: TxContext): Promise<MediaAsset | undefined>;
|
|
11
|
+
findAssetByStorageKey(storageKey: string, _ctx?: TxContext): Promise<MediaAsset | undefined>;
|
|
12
|
+
findAssetsByIds(ids: string[], _ctx?: TxContext): Promise<MediaAsset[]>;
|
|
13
|
+
createAsset(data: MediaAssetInsert, _ctx?: TxContext): Promise<MediaAsset>;
|
|
14
|
+
updateAsset(id: string, data: Partial<Omit<MediaAssetInsert, "id">>, _ctx?: TxContext): Promise<MediaAsset | undefined>;
|
|
15
|
+
deleteAsset(id: string, _ctx?: TxContext): Promise<boolean>;
|
|
16
|
+
findEntityMedia(entityId: string, variantId?: string, _ctx?: TxContext): Promise<EntityMedia[]>;
|
|
17
|
+
findEntityMediaByRole(entityId: string, role: EntityMedia["role"], variantId?: string, _ctx?: TxContext): Promise<EntityMedia[]>;
|
|
18
|
+
findPrimaryMedia(entityId: string, variantId?: string, _ctx?: TxContext): Promise<EntityMedia | undefined>;
|
|
19
|
+
createEntityMedia(data: EntityMediaInsert, _ctx?: TxContext): Promise<EntityMedia>;
|
|
20
|
+
createEntityMediaBatch(data: EntityMediaInsert[], _ctx?: TxContext): Promise<EntityMedia[]>;
|
|
21
|
+
updateEntityMediaSortOrder(entityId: string, mediaAssetId: string, sortOrder: number, variantId?: string, _ctx?: TxContext): Promise<EntityMedia | undefined>;
|
|
22
|
+
removeEntityMedia(entityId: string, mediaAssetId: string, variantId?: string, _ctx?: TxContext): Promise<boolean>;
|
|
23
|
+
removeAllEntityMedia(entityId: string, _ctx?: TxContext): Promise<void>;
|
|
24
|
+
findAssetsForEntity(entityId: string, variantId?: string, _ctx?: TxContext): Promise<MediaAsset[]>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=in-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../../../src/modules/media/repository/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAMjB;;;GAGG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,eAAe,CAAqB;IAMtC,aAAa,CACjB,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAI5B,qBAAqB,CACzB,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAI5B,eAAe,CACnB,GAAG,EAAE,MAAM,EAAE,EACb,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,UAAU,EAAE,CAAC;IAKlB,WAAW,CACf,IAAI,EAAE,gBAAgB,EACtB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,UAAU,CAAC;IAiBhB,WAAW,CACf,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,EAC3C,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAqB5B,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ3D,eAAe,CACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,WAAW,EAAE,CAAC;IAYnB,qBAAqB,CACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,WAAW,EAAE,CAAC;IAQnB,gBAAgB,CACpB,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAU7B,iBAAiB,CACrB,IAAI,EAAE,iBAAiB,EACvB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,WAAW,CAAC;IAYjB,sBAAsB,CAC1B,IAAI,EAAE,iBAAiB,EAAE,EACzB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,WAAW,EAAE,CAAC;IASnB,0BAA0B,CAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAiB7B,iBAAiB,CACrB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,OAAO,CAAC;IAWb,oBAAoB,CACxB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,IAAI,CAAC;IAUV,mBAAmB,CACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,UAAU,EAAE,CAAC;CAMzB"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
function makeId() {
|
|
2
|
+
return crypto.randomUUID();
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* In-memory implementation of MediaRepository for testing.
|
|
6
|
+
* Provides the same interface as the Drizzle-based repository but stores data in memory.
|
|
7
|
+
*/
|
|
8
|
+
export class InMemoryMediaRepository {
|
|
9
|
+
assets = new Map();
|
|
10
|
+
entityMediaList = [];
|
|
11
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
12
|
+
// Media Assets
|
|
13
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
14
|
+
async findAssetById(id, _ctx) {
|
|
15
|
+
return this.assets.get(id);
|
|
16
|
+
}
|
|
17
|
+
async findAssetByStorageKey(storageKey, _ctx) {
|
|
18
|
+
return [...this.assets.values()].find((a) => a.storageKey === storageKey);
|
|
19
|
+
}
|
|
20
|
+
async findAssetsByIds(ids, _ctx) {
|
|
21
|
+
if (ids.length === 0)
|
|
22
|
+
return [];
|
|
23
|
+
return [...this.assets.values()].filter((a) => ids.includes(a.id));
|
|
24
|
+
}
|
|
25
|
+
async createAsset(data, _ctx) {
|
|
26
|
+
const asset = {
|
|
27
|
+
id: data.id ?? makeId(),
|
|
28
|
+
storageKey: data.storageKey,
|
|
29
|
+
filename: data.filename,
|
|
30
|
+
contentType: data.contentType,
|
|
31
|
+
size: data.size,
|
|
32
|
+
width: data.width === undefined ? null : data.width,
|
|
33
|
+
height: data.height === undefined ? null : data.height,
|
|
34
|
+
alt: data.alt === undefined ? null : data.alt,
|
|
35
|
+
metadata: data.metadata === undefined ? {} : data.metadata,
|
|
36
|
+
uploadedAt: data.uploadedAt ?? new Date(),
|
|
37
|
+
};
|
|
38
|
+
this.assets.set(asset.id, asset);
|
|
39
|
+
return asset;
|
|
40
|
+
}
|
|
41
|
+
async updateAsset(id, data, _ctx) {
|
|
42
|
+
const existing = this.assets.get(id);
|
|
43
|
+
if (!existing)
|
|
44
|
+
return undefined;
|
|
45
|
+
const updated = {
|
|
46
|
+
id: existing.id,
|
|
47
|
+
storageKey: data.storageKey ?? existing.storageKey,
|
|
48
|
+
filename: data.filename ?? existing.filename,
|
|
49
|
+
contentType: data.contentType ?? existing.contentType,
|
|
50
|
+
size: data.size ?? existing.size,
|
|
51
|
+
width: data.width !== undefined ? (data.width ?? null) : existing.width,
|
|
52
|
+
height: data.height !== undefined ? (data.height ?? null) : existing.height,
|
|
53
|
+
alt: data.alt !== undefined ? (data.alt ?? null) : existing.alt,
|
|
54
|
+
metadata: data.metadata !== undefined ? (data.metadata ?? {}) : existing.metadata,
|
|
55
|
+
uploadedAt: data.uploadedAt ?? existing.uploadedAt,
|
|
56
|
+
};
|
|
57
|
+
this.assets.set(id, updated);
|
|
58
|
+
return updated;
|
|
59
|
+
}
|
|
60
|
+
async deleteAsset(id, _ctx) {
|
|
61
|
+
return this.assets.delete(id);
|
|
62
|
+
}
|
|
63
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
64
|
+
// Entity Media (Associations)
|
|
65
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
66
|
+
async findEntityMedia(entityId, variantId, _ctx) {
|
|
67
|
+
if (variantId === undefined) {
|
|
68
|
+
return this.entityMediaList.filter((em) => em.entityId === entityId && em.variantId === null);
|
|
69
|
+
}
|
|
70
|
+
return this.entityMediaList.filter((em) => em.entityId === entityId && em.variantId === variantId);
|
|
71
|
+
}
|
|
72
|
+
async findEntityMediaByRole(entityId, role, variantId, _ctx) {
|
|
73
|
+
return this.entityMediaList.filter((em) => {
|
|
74
|
+
if (em.entityId !== entityId || em.role !== role)
|
|
75
|
+
return false;
|
|
76
|
+
if (variantId === undefined)
|
|
77
|
+
return em.variantId === null;
|
|
78
|
+
return em.variantId === variantId;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async findPrimaryMedia(entityId, variantId, _ctx) {
|
|
82
|
+
const media = await this.findEntityMediaByRole(entityId, "primary", variantId, _ctx);
|
|
83
|
+
return media[0];
|
|
84
|
+
}
|
|
85
|
+
async createEntityMedia(data, _ctx) {
|
|
86
|
+
const em = {
|
|
87
|
+
entityId: data.entityId,
|
|
88
|
+
variantId: data.variantId === undefined ? null : data.variantId,
|
|
89
|
+
mediaAssetId: data.mediaAssetId,
|
|
90
|
+
role: data.role,
|
|
91
|
+
sortOrder: data.sortOrder ?? 0,
|
|
92
|
+
};
|
|
93
|
+
this.entityMediaList.push(em);
|
|
94
|
+
return em;
|
|
95
|
+
}
|
|
96
|
+
async createEntityMediaBatch(data, _ctx) {
|
|
97
|
+
if (data.length === 0)
|
|
98
|
+
return [];
|
|
99
|
+
const results = [];
|
|
100
|
+
for (const d of data) {
|
|
101
|
+
results.push(await this.createEntityMedia(d, _ctx));
|
|
102
|
+
}
|
|
103
|
+
return results;
|
|
104
|
+
}
|
|
105
|
+
async updateEntityMediaSortOrder(entityId, mediaAssetId, sortOrder, variantId, _ctx) {
|
|
106
|
+
const idx = this.entityMediaList.findIndex((em) => {
|
|
107
|
+
if (em.entityId !== entityId || em.mediaAssetId !== mediaAssetId)
|
|
108
|
+
return false;
|
|
109
|
+
if (variantId === undefined)
|
|
110
|
+
return em.variantId === null;
|
|
111
|
+
return em.variantId === variantId;
|
|
112
|
+
});
|
|
113
|
+
if (idx === -1)
|
|
114
|
+
return undefined;
|
|
115
|
+
this.entityMediaList[idx] = {
|
|
116
|
+
...this.entityMediaList[idx],
|
|
117
|
+
sortOrder,
|
|
118
|
+
};
|
|
119
|
+
return this.entityMediaList[idx];
|
|
120
|
+
}
|
|
121
|
+
async removeEntityMedia(entityId, mediaAssetId, variantId, _ctx) {
|
|
122
|
+
const initialLength = this.entityMediaList.length;
|
|
123
|
+
this.entityMediaList = this.entityMediaList.filter((em) => {
|
|
124
|
+
if (em.entityId !== entityId || em.mediaAssetId !== mediaAssetId)
|
|
125
|
+
return true;
|
|
126
|
+
if (variantId === undefined)
|
|
127
|
+
return em.variantId !== null;
|
|
128
|
+
return em.variantId !== variantId;
|
|
129
|
+
});
|
|
130
|
+
return this.entityMediaList.length < initialLength;
|
|
131
|
+
}
|
|
132
|
+
async removeAllEntityMedia(entityId, _ctx) {
|
|
133
|
+
this.entityMediaList = this.entityMediaList.filter((em) => em.entityId !== entityId);
|
|
134
|
+
}
|
|
135
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
136
|
+
// Aggregates
|
|
137
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
138
|
+
async findAssetsForEntity(entityId, variantId, _ctx) {
|
|
139
|
+
const associations = await this.findEntityMedia(entityId, variantId, _ctx);
|
|
140
|
+
const assetIds = associations.map((a) => a.mediaAssetId);
|
|
141
|
+
if (assetIds.length === 0)
|
|
142
|
+
return [];
|
|
143
|
+
return this.findAssetsByIds(assetIds, _ctx);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { TxContext } from "../../../kernel/database/tx-context";
|
|
2
|
+
import type { DrizzleDatabase } from "../../../kernel/database/drizzle-db";
|
|
3
|
+
import { mediaAssets, entityMedia } from "../schema";
|
|
4
|
+
export type MediaAsset = typeof mediaAssets.$inferSelect;
|
|
5
|
+
export type MediaAssetInsert = typeof mediaAssets.$inferInsert;
|
|
6
|
+
export type EntityMedia = typeof entityMedia.$inferSelect;
|
|
7
|
+
export type EntityMediaInsert = typeof entityMedia.$inferInsert;
|
|
8
|
+
/**
|
|
9
|
+
* MediaRepository provides type-safe database operations for media assets.
|
|
10
|
+
*
|
|
11
|
+
* This repository manages media assets and their associations with entities.
|
|
12
|
+
* All methods support an optional TxContext parameter for transaction participation.
|
|
13
|
+
*/
|
|
14
|
+
export declare class MediaRepository {
|
|
15
|
+
private readonly db;
|
|
16
|
+
constructor(db: DrizzleDatabase);
|
|
17
|
+
private getDb;
|
|
18
|
+
findAssetById(id: string, ctx?: TxContext, orgId?: string): Promise<MediaAsset | undefined>;
|
|
19
|
+
findAssetByStorageKey(storageKey: string, ctx?: TxContext): Promise<MediaAsset | undefined>;
|
|
20
|
+
findAssetsByIds(ids: string[], ctx?: TxContext): Promise<MediaAsset[]>;
|
|
21
|
+
createAsset(data: MediaAssetInsert, ctx?: TxContext): Promise<MediaAsset>;
|
|
22
|
+
updateAsset(id: string, data: Partial<Omit<MediaAssetInsert, "id">>, ctx?: TxContext): Promise<MediaAsset | undefined>;
|
|
23
|
+
deleteAsset(id: string, ctx?: TxContext): Promise<boolean>;
|
|
24
|
+
findEntityMedia(entityId: string, variantId?: string, ctx?: TxContext): Promise<EntityMedia[]>;
|
|
25
|
+
findEntityMediaByRole(entityId: string, role: EntityMedia["role"], variantId?: string, ctx?: TxContext): Promise<EntityMedia[]>;
|
|
26
|
+
findPrimaryMedia(entityId: string, variantId?: string, ctx?: TxContext): Promise<EntityMedia | undefined>;
|
|
27
|
+
createEntityMedia(data: EntityMediaInsert, ctx?: TxContext): Promise<EntityMedia>;
|
|
28
|
+
createEntityMediaBatch(data: EntityMediaInsert[], ctx?: TxContext): Promise<EntityMedia[]>;
|
|
29
|
+
updateEntityMediaSortOrder(entityId: string, mediaAssetId: string, sortOrder: number, variantId?: string, ctx?: TxContext): Promise<EntityMedia | undefined>;
|
|
30
|
+
removeEntityMedia(entityId: string, mediaAssetId: string, variantId?: string, ctx?: TxContext): Promise<boolean>;
|
|
31
|
+
removeAllEntityMedia(entityId: string, ctx?: TxContext): Promise<void>;
|
|
32
|
+
removeAllMediaByAssetId(mediaAssetId: string, ctx?: TxContext): Promise<void>;
|
|
33
|
+
findAssetsForEntity(entityId: string, variantId?: string, ctx?: TxContext): Promise<MediaAsset[]>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/media/repository/index.ts"],"names":[],"mappings":"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"}
|