@unifiedcommerce/core 0.4.4 → 0.4.5
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 +1475 -0
- package/dist/auth/auth-schema.d.ts.map +1 -0
- package/dist/auth/auth-schema.js +124 -0
- package/dist/auth/middleware.d.ts +5 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +141 -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/setup.d.ts +29 -0
- package/dist/auth/setup.d.ts.map +1 -0
- package/dist/auth/setup.js +117 -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 +327 -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 +77 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -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 +5 -0
- package/dist/interfaces/mcp/server.d.ts.map +1 -0
- package/dist/interfaces/mcp/server.js +30 -0
- package/dist/interfaces/mcp/tool-builder.d.ts +120 -0
- package/dist/interfaces/mcp/tool-builder.d.ts.map +1 -0
- package/dist/interfaces/mcp/tool-builder.js +224 -0
- package/dist/interfaces/mcp/tools/analytics.d.ts +42 -0
- package/dist/interfaces/mcp/tools/analytics.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/analytics.js +70 -0
- package/dist/interfaces/mcp/tools/cart.d.ts +14 -0
- package/dist/interfaces/mcp/tools/cart.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/cart.js +47 -0
- package/dist/interfaces/mcp/tools/catalog.d.ts +53 -0
- package/dist/interfaces/mcp/tools/catalog.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/catalog.js +284 -0
- package/dist/interfaces/mcp/tools/index.d.ts +3 -0
- package/dist/interfaces/mcp/tools/index.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/index.js +20 -0
- package/dist/interfaces/mcp/tools/inventory.d.ts +27 -0
- package/dist/interfaces/mcp/tools/inventory.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/inventory.js +143 -0
- package/dist/interfaces/mcp/tools/orders.d.ts +18 -0
- package/dist/interfaces/mcp/tools/orders.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/orders.js +82 -0
- package/dist/interfaces/mcp/tools/pricing.d.ts +29 -0
- package/dist/interfaces/mcp/tools/pricing.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/pricing.js +90 -0
- package/dist/interfaces/mcp/tools/promotions.d.ts +44 -0
- package/dist/interfaces/mcp/tools/promotions.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/promotions.js +109 -0
- package/dist/interfaces/mcp/tools/registry.d.ts +32 -0
- package/dist/interfaces/mcp/tools/registry.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/registry.js +55 -0
- package/dist/interfaces/mcp/tools/search.d.ts +14 -0
- package/dist/interfaces/mcp/tools/search.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/search.js +39 -0
- package/dist/interfaces/mcp/tools/webhooks.d.ts +15 -0
- package/dist/interfaces/mcp/tools/webhooks.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/webhooks.js +48 -0
- package/dist/interfaces/mcp/transport.d.ts +20 -0
- package/dist/interfaces/mcp/transport.d.ts.map +1 -0
- package/dist/interfaces/mcp/transport.js +99 -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/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/customers.d.ts +5 -0
- package/dist/interfaces/rest/routes/customers.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/customers.js +74 -0
- package/dist/interfaces/rest/routes/entity-aliases.d.ts +18 -0
- package/dist/interfaces/rest/routes/entity-aliases.d.ts.map +1 -0
- package/dist/interfaces/rest/routes/entity-aliases.js +39 -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 +72 -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 +76 -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 +1456 -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 +5452 -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 +2203 -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/customers.d.ts +422 -0
- package/dist/interfaces/rest/schemas/customers.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/customers.js +150 -0
- package/dist/interfaces/rest/schemas/inventory.d.ts +561 -0
- package/dist/interfaces/rest/schemas/inventory.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/inventory.js +148 -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 +1792 -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 +4086 -0
- package/dist/interfaces/rest/schemas/responses.d.ts.map +1 -0
- package/dist/interfaces/rest/schemas/responses.js +74 -0
- package/dist/interfaces/rest/schemas/search.d.ts +247 -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 +18 -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/repository-factory.d.ts +71 -0
- package/dist/kernel/factory/repository-factory.d.ts.map +1 -0
- package/dist/kernel/factory/repository-factory.js +138 -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 +89 -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 +169 -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/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/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/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/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 +27 -0
- package/dist/modules/customers/service.d.ts.map +1 -0
- package/dist/modules/customers/service.js +106 -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/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 +69 -0
- package/dist/modules/inventory/service.d.ts.map +1 -0
- package/dist/modules/inventory/service.js +283 -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/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/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/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/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/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 +71 -0
- package/dist/runtime/kernel.d.ts.map +1 -0
- package/dist/runtime/kernel.js +306 -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/shutdown.d.ts +15 -0
- package/dist/runtime/shutdown.d.ts.map +1 -0
- package/dist/runtime/shutdown.js +34 -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 +107 -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 +172 -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/testing.d.ts +14 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +13 -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 +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-schema.d.ts","sourceRoot":"","sources":["../../src/auth/auth-schema.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaf,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAclB,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBlB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUvB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOvB,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUjB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAarB,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBjB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMf,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { pgTable, text, timestamp, boolean, integer, } from "drizzle-orm/pg-core";
|
|
2
|
+
export const user = pgTable("user", {
|
|
3
|
+
id: text("id").primaryKey(),
|
|
4
|
+
name: text("name").notNull(),
|
|
5
|
+
email: text("email").notNull().unique(),
|
|
6
|
+
emailVerified: boolean("email_verified").default(false).notNull(),
|
|
7
|
+
image: text("image"),
|
|
8
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
9
|
+
updatedAt: timestamp("updated_at")
|
|
10
|
+
.defaultNow()
|
|
11
|
+
.$onUpdate(() => /* @__PURE__ */ new Date())
|
|
12
|
+
.notNull(),
|
|
13
|
+
vendorId: text("vendor_id"),
|
|
14
|
+
posOperatorPin: text("pos_operator_pin"),
|
|
15
|
+
});
|
|
16
|
+
export const session = pgTable("session", {
|
|
17
|
+
id: text("id").primaryKey(),
|
|
18
|
+
expiresAt: timestamp("expires_at").notNull(),
|
|
19
|
+
token: text("token").notNull().unique(),
|
|
20
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
21
|
+
updatedAt: timestamp("updated_at")
|
|
22
|
+
.$onUpdate(() => /* @__PURE__ */ new Date())
|
|
23
|
+
.notNull(),
|
|
24
|
+
ipAddress: text("ip_address"),
|
|
25
|
+
userAgent: text("user_agent"),
|
|
26
|
+
userId: text("user_id")
|
|
27
|
+
.notNull()
|
|
28
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
29
|
+
activeOrganizationId: text("active_organization_id"),
|
|
30
|
+
});
|
|
31
|
+
export const account = pgTable("account", {
|
|
32
|
+
id: text("id").primaryKey(),
|
|
33
|
+
accountId: text("account_id").notNull(),
|
|
34
|
+
providerId: text("provider_id").notNull(),
|
|
35
|
+
userId: text("user_id")
|
|
36
|
+
.notNull()
|
|
37
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
38
|
+
accessToken: text("access_token"),
|
|
39
|
+
refreshToken: text("refresh_token"),
|
|
40
|
+
idToken: text("id_token"),
|
|
41
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
|
42
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
|
43
|
+
scope: text("scope"),
|
|
44
|
+
password: text("password"),
|
|
45
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
46
|
+
updatedAt: timestamp("updated_at")
|
|
47
|
+
.$onUpdate(() => /* @__PURE__ */ new Date())
|
|
48
|
+
.notNull(),
|
|
49
|
+
});
|
|
50
|
+
export const verification = pgTable("verification", {
|
|
51
|
+
id: text("id").primaryKey(),
|
|
52
|
+
identifier: text("identifier").notNull(),
|
|
53
|
+
value: text("value").notNull(),
|
|
54
|
+
expiresAt: timestamp("expires_at").notNull(),
|
|
55
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
56
|
+
updatedAt: timestamp("updated_at")
|
|
57
|
+
.defaultNow()
|
|
58
|
+
.$onUpdate(() => /* @__PURE__ */ new Date())
|
|
59
|
+
.notNull(),
|
|
60
|
+
});
|
|
61
|
+
export const organization = pgTable("organization", {
|
|
62
|
+
id: text("id").primaryKey(),
|
|
63
|
+
name: text("name").notNull(),
|
|
64
|
+
slug: text("slug").notNull().unique(),
|
|
65
|
+
logo: text("logo"),
|
|
66
|
+
createdAt: timestamp("created_at").notNull(),
|
|
67
|
+
metadata: text("metadata"),
|
|
68
|
+
});
|
|
69
|
+
export const member = pgTable("member", {
|
|
70
|
+
id: text("id").primaryKey(),
|
|
71
|
+
organizationId: text("organization_id")
|
|
72
|
+
.notNull()
|
|
73
|
+
.references(() => organization.id, { onDelete: "cascade" }),
|
|
74
|
+
userId: text("user_id")
|
|
75
|
+
.notNull()
|
|
76
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
77
|
+
role: text("role").default("member").notNull(),
|
|
78
|
+
createdAt: timestamp("created_at").notNull(),
|
|
79
|
+
});
|
|
80
|
+
export const invitation = pgTable("invitation", {
|
|
81
|
+
id: text("id").primaryKey(),
|
|
82
|
+
organizationId: text("organization_id")
|
|
83
|
+
.notNull()
|
|
84
|
+
.references(() => organization.id, { onDelete: "cascade" }),
|
|
85
|
+
email: text("email").notNull(),
|
|
86
|
+
role: text("role"),
|
|
87
|
+
status: text("status").default("pending").notNull(),
|
|
88
|
+
expiresAt: timestamp("expires_at").notNull(),
|
|
89
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
90
|
+
inviterId: text("inviter_id")
|
|
91
|
+
.notNull()
|
|
92
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
93
|
+
});
|
|
94
|
+
export const apikey = pgTable("apikey", {
|
|
95
|
+
id: text("id").primaryKey(),
|
|
96
|
+
configId: text("config_id").default("default").notNull(),
|
|
97
|
+
name: text("name"),
|
|
98
|
+
start: text("start"),
|
|
99
|
+
referenceId: text("reference_id").notNull(),
|
|
100
|
+
prefix: text("prefix"),
|
|
101
|
+
key: text("key").notNull(),
|
|
102
|
+
refillInterval: integer("refill_interval"),
|
|
103
|
+
refillAmount: integer("refill_amount"),
|
|
104
|
+
lastRefillAt: timestamp("last_refill_at"),
|
|
105
|
+
enabled: boolean("enabled").default(true),
|
|
106
|
+
rateLimitEnabled: boolean("rate_limit_enabled").default(false),
|
|
107
|
+
rateLimitTimeWindow: integer("rate_limit_time_window").default(3600000),
|
|
108
|
+
rateLimitMax: integer("rate_limit_max").default(10000),
|
|
109
|
+
requestCount: integer("request_count").default(0),
|
|
110
|
+
remaining: integer("remaining"),
|
|
111
|
+
lastRequest: timestamp("last_request"),
|
|
112
|
+
expiresAt: timestamp("expires_at"),
|
|
113
|
+
createdAt: timestamp("created_at").notNull(),
|
|
114
|
+
updatedAt: timestamp("updated_at").notNull(),
|
|
115
|
+
permissions: text("permissions"),
|
|
116
|
+
metadata: text("metadata"),
|
|
117
|
+
});
|
|
118
|
+
export const jwks = pgTable("jwks", {
|
|
119
|
+
id: text("id").primaryKey(),
|
|
120
|
+
publicKey: text("public_key").notNull(),
|
|
121
|
+
privateKey: text("private_key").notNull(),
|
|
122
|
+
createdAt: timestamp("created_at").notNull(),
|
|
123
|
+
expiresAt: timestamp("expires_at"),
|
|
124
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MiddlewareHandler } from "hono";
|
|
2
|
+
import type { CommerceConfig } from "../config/types.js";
|
|
3
|
+
import type { AuthInstance } from "./setup.js";
|
|
4
|
+
export declare function authMiddleware(auth: AuthInstance, config: CommerceConfig): MiddlewareHandler;
|
|
5
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/auth/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA0B/C,wBAAgB,cAAc,CAC5B,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,cAAc,GACrB,iBAAiB,CAsInB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { DEFAULT_ORG_ID } from "./org.js";
|
|
2
|
+
function resolvePermissions(session, config) {
|
|
3
|
+
const role = session.session.activeOrganizationRole;
|
|
4
|
+
if (!role) {
|
|
5
|
+
return (config.auth?.customerPermissions ?? [
|
|
6
|
+
"catalog:read",
|
|
7
|
+
"cart:create",
|
|
8
|
+
"cart:read",
|
|
9
|
+
"cart:update",
|
|
10
|
+
"orders:create",
|
|
11
|
+
"orders:read:own",
|
|
12
|
+
"customers:read:self",
|
|
13
|
+
"customers:update:self",
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
const roleConfig = config.auth?.roles?.[role];
|
|
17
|
+
return roleConfig ? roleConfig.permissions : [];
|
|
18
|
+
}
|
|
19
|
+
export function authMiddleware(auth, config) {
|
|
20
|
+
return async (c, next) => {
|
|
21
|
+
const session = (await auth.api.getSession({
|
|
22
|
+
headers: c.req.raw.headers,
|
|
23
|
+
}));
|
|
24
|
+
if (session) {
|
|
25
|
+
// Better Auth's session stores activeOrganizationId, but often not the role.
|
|
26
|
+
// For single-store apps (org_default), users may never call set-active,
|
|
27
|
+
// so activeOrganizationId can be null even for valid org members.
|
|
28
|
+
let role = session.session.activeOrganizationRole;
|
|
29
|
+
let orgId = session.session.activeOrganizationId;
|
|
30
|
+
// If no active org, try to resolve the user's membership in org_default.
|
|
31
|
+
// This handles the common case where the user is a member but hasn't
|
|
32
|
+
// called organization/set-active (single-store apps, seed scripts, tests).
|
|
33
|
+
if (!role && auth.api.getFullOrganization) {
|
|
34
|
+
try {
|
|
35
|
+
const org = await auth.api.getFullOrganization({
|
|
36
|
+
query: { organizationId: orgId ?? DEFAULT_ORG_ID },
|
|
37
|
+
headers: c.req.raw.headers,
|
|
38
|
+
});
|
|
39
|
+
if (org?.members) {
|
|
40
|
+
const membership = org.members.find((m) => m.userId === session.user.id);
|
|
41
|
+
if (membership) {
|
|
42
|
+
role = membership.role;
|
|
43
|
+
orgId = orgId ?? DEFAULT_ORG_ID;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// fall through — treat as customer
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Also try getActiveMemberRole if active org is set
|
|
52
|
+
if (!role && orgId && auth.api.getActiveMemberRole) {
|
|
53
|
+
try {
|
|
54
|
+
const roleResult = await auth.api.getActiveMemberRole({
|
|
55
|
+
headers: c.req.raw.headers,
|
|
56
|
+
});
|
|
57
|
+
role = roleResult?.role;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// fall through — treat as customer
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const enrichedSession = {
|
|
64
|
+
...session,
|
|
65
|
+
session: { ...session.session, activeOrganizationRole: role ?? null },
|
|
66
|
+
};
|
|
67
|
+
c.set("actor", {
|
|
68
|
+
type: "user",
|
|
69
|
+
userId: session.user.id,
|
|
70
|
+
email: session.user.email ?? null,
|
|
71
|
+
name: session.user.name ?? "User",
|
|
72
|
+
vendorId: session.user.vendorId ?? null,
|
|
73
|
+
organizationId: orgId ?? DEFAULT_ORG_ID,
|
|
74
|
+
role: role ?? "customer",
|
|
75
|
+
permissions: resolvePermissions(enrichedSession, config),
|
|
76
|
+
});
|
|
77
|
+
await next();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// Extract API key from headers
|
|
81
|
+
const apiKeyHeader = c.req.header("x-api-key") ??
|
|
82
|
+
c.req.header("authorization")?.replace("Bearer ", "");
|
|
83
|
+
if (apiKeyHeader &&
|
|
84
|
+
config.auth?.apiKeys?.enabled &&
|
|
85
|
+
auth.api.verifyApiKey) {
|
|
86
|
+
try {
|
|
87
|
+
// Better Auth server-side calls require { body: { ... } } wrapper.
|
|
88
|
+
// Returns { valid, error, key: Omit<ApiKey,"key"> | null }.
|
|
89
|
+
// See: https://better-auth.com/docs/plugins/api-key/reference
|
|
90
|
+
const result = await auth.api.verifyApiKey({
|
|
91
|
+
body: { key: apiKeyHeader },
|
|
92
|
+
});
|
|
93
|
+
if (result?.valid && result.key) {
|
|
94
|
+
const apiKey = result.key;
|
|
95
|
+
// v1.5+ renamed userId → referenceId on the apikey table.
|
|
96
|
+
const userId = (apiKey.referenceId ?? "");
|
|
97
|
+
const name = (apiKey.name ?? "API Key");
|
|
98
|
+
const orgId = (apiKey.organizationId ?? DEFAULT_ORG_ID);
|
|
99
|
+
// Better Auth stores permissions as Record<string, string[]>
|
|
100
|
+
// (e.g. {"catalog":["read","create"]}). Flatten to the
|
|
101
|
+
// "resource:action" string[] format the engine expects.
|
|
102
|
+
let permissions;
|
|
103
|
+
const rawPerms = apiKey.permissions;
|
|
104
|
+
if (Array.isArray(rawPerms)) {
|
|
105
|
+
permissions = rawPerms;
|
|
106
|
+
}
|
|
107
|
+
else if (rawPerms && typeof rawPerms === "object") {
|
|
108
|
+
permissions = [];
|
|
109
|
+
for (const [resource, actions] of Object.entries(rawPerms)) {
|
|
110
|
+
for (const action of actions) {
|
|
111
|
+
permissions.push(`${resource}:${action}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
permissions = config.auth?.apiKeys?.defaultPermissions ?? [];
|
|
117
|
+
}
|
|
118
|
+
c.set("actor", {
|
|
119
|
+
type: "api_key",
|
|
120
|
+
userId,
|
|
121
|
+
email: null,
|
|
122
|
+
name,
|
|
123
|
+
vendorId: null,
|
|
124
|
+
organizationId: orgId,
|
|
125
|
+
role: "api_key",
|
|
126
|
+
permissions,
|
|
127
|
+
});
|
|
128
|
+
await next();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// invalid, expired, or rate-limited key — fall through
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (!c.get("actor")) {
|
|
137
|
+
c.set("actor", null);
|
|
138
|
+
}
|
|
139
|
+
await next();
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic ID for the default organization.
|
|
3
|
+
* Auto-created on kernel boot / test setup for single-tenant deployments.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_ORG_ID = "org_default";
|
|
6
|
+
/**
|
|
7
|
+
* Extracts the organization ID from an actor.
|
|
8
|
+
* Falls back to the default org when the actor is null or has no org set.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveOrgId(actor: unknown): string;
|
|
11
|
+
/**
|
|
12
|
+
* Ensures the default organization row exists in the database.
|
|
13
|
+
* Idempotent — safe to call multiple times (no-ops if the row exists).
|
|
14
|
+
*
|
|
15
|
+
* Uses OrganizationService which creates both the org row and
|
|
16
|
+
* (when auth is available) a member record for the creator.
|
|
17
|
+
*
|
|
18
|
+
* Accepts `unknown` so callers never need casts — the function
|
|
19
|
+
* handles the Drizzle type narrowing internally.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ensureDefaultOrg(db: unknown, storeName?: string): Promise<void>;
|
|
22
|
+
//# sourceMappingURL=org.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/auth/org.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMnD;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,OAAO,EACX,SAAS,SAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
package/dist/auth/org.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { OrganizationService } from "../modules/organization/service.js";
|
|
2
|
+
/**
|
|
3
|
+
* Deterministic ID for the default organization.
|
|
4
|
+
* Auto-created on kernel boot / test setup for single-tenant deployments.
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_ORG_ID = "org_default";
|
|
7
|
+
/**
|
|
8
|
+
* Extracts the organization ID from an actor.
|
|
9
|
+
* Falls back to the default org when the actor is null or has no org set.
|
|
10
|
+
*/
|
|
11
|
+
export function resolveOrgId(actor) {
|
|
12
|
+
if (actor != null && typeof actor === "object" && "organizationId" in actor) {
|
|
13
|
+
const orgId = actor.organizationId;
|
|
14
|
+
if (typeof orgId === "string")
|
|
15
|
+
return orgId;
|
|
16
|
+
}
|
|
17
|
+
return DEFAULT_ORG_ID;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Ensures the default organization row exists in the database.
|
|
21
|
+
* Idempotent — safe to call multiple times (no-ops if the row exists).
|
|
22
|
+
*
|
|
23
|
+
* Uses OrganizationService which creates both the org row and
|
|
24
|
+
* (when auth is available) a member record for the creator.
|
|
25
|
+
*
|
|
26
|
+
* Accepts `unknown` so callers never need casts — the function
|
|
27
|
+
* handles the Drizzle type narrowing internally.
|
|
28
|
+
*/
|
|
29
|
+
export async function ensureDefaultOrg(db, storeName = "Default Store") {
|
|
30
|
+
const orgService = new OrganizationService(db);
|
|
31
|
+
await orgService.create({
|
|
32
|
+
id: DEFAULT_ORG_ID,
|
|
33
|
+
name: storeName,
|
|
34
|
+
slug: "default",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Actor } from "./types.js";
|
|
2
|
+
export declare function assertPermission(actor: Actor | null, required: string): void;
|
|
3
|
+
export declare function assertOwnership(actor: Actor | null, resourceOwnerId: string | null): void;
|
|
4
|
+
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/auth/permissions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAc5E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAQzF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CommerceForbiddenError } from "../kernel/errors.js";
|
|
2
|
+
export function assertPermission(actor, required) {
|
|
3
|
+
if (!actor) {
|
|
4
|
+
throw new CommerceForbiddenError("Authentication required.");
|
|
5
|
+
}
|
|
6
|
+
if (actor.permissions.includes("*:*"))
|
|
7
|
+
return;
|
|
8
|
+
const [resource] = required.split(":");
|
|
9
|
+
if (resource && actor.permissions.includes(`${resource}:*`))
|
|
10
|
+
return;
|
|
11
|
+
if (actor.permissions.includes(required))
|
|
12
|
+
return;
|
|
13
|
+
throw new CommerceForbiddenError(`Permission "${required}" is required. Your role "${actor.role}" does not include this permission.`);
|
|
14
|
+
}
|
|
15
|
+
export function assertOwnership(actor, resourceOwnerId) {
|
|
16
|
+
if (!actor) {
|
|
17
|
+
throw new CommerceForbiddenError("Authentication required.");
|
|
18
|
+
}
|
|
19
|
+
if (actor.permissions.includes("*:*"))
|
|
20
|
+
return;
|
|
21
|
+
if (actor.userId !== resourceOwnerId) {
|
|
22
|
+
throw new CommerceForbiddenError("You do not have access to this resource.");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { betterAuth } from "better-auth";
|
|
2
|
+
import { apiKey } from "@better-auth/api-key";
|
|
3
|
+
import { organization, twoFactor, phoneNumber, jwt, bearer } from "better-auth/plugins";
|
|
4
|
+
import type { CommerceConfig } from "../config/types.js";
|
|
5
|
+
import type { DatabaseAdapter } from "../kernel/database/adapter.js";
|
|
6
|
+
/**
|
|
7
|
+
* The auth type is inferred from `typeof betterAuth(...)` with all plugins enabled.
|
|
8
|
+
* This gives us the full API surface without manual interface maintenance.
|
|
9
|
+
*
|
|
10
|
+
* We use a type-level-only reference (never executed) to capture the complete type.
|
|
11
|
+
*/
|
|
12
|
+
type FullBetterAuth = ReturnType<typeof betterAuth<{
|
|
13
|
+
plugins: [
|
|
14
|
+
ReturnType<typeof organization>,
|
|
15
|
+
ReturnType<typeof bearer>,
|
|
16
|
+
ReturnType<typeof jwt>,
|
|
17
|
+
ReturnType<typeof twoFactor>,
|
|
18
|
+
ReturnType<typeof apiKey>,
|
|
19
|
+
ReturnType<typeof phoneNumber>
|
|
20
|
+
];
|
|
21
|
+
}>>;
|
|
22
|
+
/**
|
|
23
|
+
* AuthInstance — inferred from Better Auth with all plugins.
|
|
24
|
+
* No manual type maintenance needed.
|
|
25
|
+
*/
|
|
26
|
+
export type AuthInstance = FullBetterAuth;
|
|
27
|
+
export declare function createAuth(db: DatabaseAdapter, config: CommerceConfig): AuthInstance;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/auth/setup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAiBrE;;;;;GAKG;AACH,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC;IACjD,OAAO,EAAE;QACP,UAAU,CAAC,OAAO,YAAY,CAAC;QAC/B,UAAU,CAAC,OAAO,MAAM,CAAC;QACzB,UAAU,CAAC,OAAO,GAAG,CAAC;QACtB,UAAU,CAAC,OAAO,SAAS,CAAC;QAC5B,UAAU,CAAC,OAAO,MAAM,CAAC;QACzB,UAAU,CAAC,OAAO,WAAW,CAAC;KAC/B,CAAC;CACH,CAAC,CAAC,CAAC;AAEJ;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC;AAE1C,wBAAgB,UAAU,CACxB,EAAE,EAAE,eAAe,EACnB,MAAM,EAAE,cAAc,GACrB,YAAY,CA+Gd"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { drizzleAdapter } from "@better-auth/drizzle-adapter";
|
|
2
|
+
import { betterAuth } from "better-auth";
|
|
3
|
+
import { apiKey } from "@better-auth/api-key";
|
|
4
|
+
import { organization, twoFactor, phoneNumber, jwt, bearer } from "better-auth/plugins";
|
|
5
|
+
import * as authSchema from "./auth-schema.js";
|
|
6
|
+
function resolveAuthDbProvider(provider) {
|
|
7
|
+
if (provider === "postgres" || provider === "postgresql" || provider === "pg")
|
|
8
|
+
return "pg";
|
|
9
|
+
if (provider === "mysql")
|
|
10
|
+
return "mysql";
|
|
11
|
+
if (provider === "sqlite")
|
|
12
|
+
return "sqlite";
|
|
13
|
+
throw new Error(`Unsupported auth database provider "${provider}".`);
|
|
14
|
+
}
|
|
15
|
+
export function createAuth(db, config) {
|
|
16
|
+
const plugins = [
|
|
17
|
+
organization({
|
|
18
|
+
roles: (config.auth?.roles ?? {}),
|
|
19
|
+
}),
|
|
20
|
+
bearer(),
|
|
21
|
+
jwt(),
|
|
22
|
+
];
|
|
23
|
+
if (config.auth?.twoFactor?.enabled) {
|
|
24
|
+
plugins.push(twoFactor({ issuer: config.storeName ?? "UnifiedCommerce" }));
|
|
25
|
+
}
|
|
26
|
+
const scopes = config.auth?.apiKeyScopes;
|
|
27
|
+
if (scopes && Object.keys(scopes).length > 0) {
|
|
28
|
+
const apiKeyConfigs = Object.entries(scopes).map(([scopeId, scope]) => ({
|
|
29
|
+
configId: scopeId,
|
|
30
|
+
defaultPrefix: scope.prefix,
|
|
31
|
+
...(scope.rateLimit
|
|
32
|
+
? {
|
|
33
|
+
rateLimit: {
|
|
34
|
+
enabled: true,
|
|
35
|
+
maxRequests: scope.rateLimit.maxRequests,
|
|
36
|
+
timeWindow: scope.rateLimit.timeWindow,
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
: {}),
|
|
40
|
+
}));
|
|
41
|
+
plugins.push(apiKey(apiKeyConfigs));
|
|
42
|
+
}
|
|
43
|
+
else if (config.auth?.apiKeys?.enabled) {
|
|
44
|
+
plugins.push(apiKey());
|
|
45
|
+
}
|
|
46
|
+
if (config.auth?.phoneAuth) {
|
|
47
|
+
plugins.push(phoneNumber({
|
|
48
|
+
sendOTP: config.auth.phoneAuth.sendOTP,
|
|
49
|
+
verifyOTP: config.auth.phoneAuth.verifyOTP,
|
|
50
|
+
otpLength: config.auth.phoneAuth.otpLength ?? 6,
|
|
51
|
+
expiresIn: config.auth.phoneAuth.expiresIn ?? 300,
|
|
52
|
+
signUpOnVerification: config.auth.phoneAuth.signUpOnVerification ?? {
|
|
53
|
+
getTempEmail: (phone) => `${phone.replace(/\+/g, "")}@phone.local`,
|
|
54
|
+
},
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const auth = betterAuth({
|
|
59
|
+
database: drizzleAdapter(db.db, {
|
|
60
|
+
provider: resolveAuthDbProvider(db.provider),
|
|
61
|
+
schema: authSchema,
|
|
62
|
+
}),
|
|
63
|
+
trustedOrigins: config.auth?.trustedOrigins ?? [],
|
|
64
|
+
emailAndPassword: {
|
|
65
|
+
enabled: true,
|
|
66
|
+
requireEmailVerification: config.auth?.requireEmailVerification ?? true,
|
|
67
|
+
sendResetPassword: async ({ user, url }) => {
|
|
68
|
+
if (!config.email)
|
|
69
|
+
return;
|
|
70
|
+
await config.email.send({
|
|
71
|
+
template: "password-reset",
|
|
72
|
+
to: user.email,
|
|
73
|
+
data: { resetUrl: url, userName: user.name },
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
sendVerificationEmail: async ({ user, url }) => {
|
|
77
|
+
if (!config.email)
|
|
78
|
+
return;
|
|
79
|
+
await config.email.send({
|
|
80
|
+
template: "email-verification",
|
|
81
|
+
to: user.email,
|
|
82
|
+
data: { verifyUrl: url, userName: user.name },
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
socialProviders: config.auth?.socialProviders ?? {},
|
|
87
|
+
session: {
|
|
88
|
+
expiresIn: config.auth?.sessionDuration ?? 60 * 60 * 24 * 7,
|
|
89
|
+
updateAge: 60 * 60 * 24,
|
|
90
|
+
cookieCache: {
|
|
91
|
+
enabled: true,
|
|
92
|
+
maxAge: 60 * 5,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
advanced: {
|
|
96
|
+
cookiePrefix: "uc",
|
|
97
|
+
useSecureCookies: process.env.NODE_ENV === "production",
|
|
98
|
+
},
|
|
99
|
+
plugins,
|
|
100
|
+
user: {
|
|
101
|
+
additionalFields: {
|
|
102
|
+
vendorId: { type: "string", required: false },
|
|
103
|
+
posOperatorPin: { type: "string", required: false },
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
// The runtime return matches FullBetterAuth structurally — plugins may differ
|
|
108
|
+
// at runtime (conditional) but the API surface is a superset.
|
|
109
|
+
return auth;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
const message = error instanceof Error
|
|
113
|
+
? error.message
|
|
114
|
+
: "Unknown better-auth initialization error.";
|
|
115
|
+
throw new Error(`Failed to initialize authentication: ${message}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Actor } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a system actor for internal operations (webhooks, jobs, compensation chains).
|
|
4
|
+
* System actors have full permissions and are scoped to a specific organization.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createSystemActor(orgId?: string): Actor;
|
|
7
|
+
//# sourceMappingURL=system-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-actor.d.ts","sourceRoot":"","sources":["../../src/auth/system-actor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,MAAuB,GAAG,KAAK,CAWvE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DEFAULT_ORG_ID } from "./org.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a system actor for internal operations (webhooks, jobs, compensation chains).
|
|
4
|
+
* System actors have full permissions and are scoped to a specific organization.
|
|
5
|
+
*/
|
|
6
|
+
export function createSystemActor(orgId = DEFAULT_ORG_ID) {
|
|
7
|
+
return {
|
|
8
|
+
type: "api_key",
|
|
9
|
+
userId: "system:internal",
|
|
10
|
+
email: null,
|
|
11
|
+
name: "System",
|
|
12
|
+
vendorId: null,
|
|
13
|
+
organizationId: orgId,
|
|
14
|
+
role: "system",
|
|
15
|
+
permissions: ["*:*"],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,cAAc,CA+EjD,CAAC"}
|