@openlup/platform 0.0.0 → 0.16.0
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/CHANGELOG.md +59 -0
- package/LICENSE +204 -0
- package/README.md +471 -1
- package/dist/bff/dispatch.d.ts +27 -0
- package/dist/bff/dispatch.js +47 -0
- package/dist/bff/envelope.d.ts +46 -0
- package/dist/bff/envelope.js +80 -0
- package/dist/bff/health.d.ts +24 -0
- package/dist/bff/health.js +19 -0
- package/dist/bff/index.d.ts +6 -0
- package/dist/bff/index.js +6 -0
- package/dist/bff/lazyRoute.d.ts +4 -0
- package/dist/bff/lazyRoute.js +13 -0
- package/dist/bff/requestContext.d.ts +17 -0
- package/dist/bff/requestContext.js +26 -0
- package/dist/bff/routerRewrite.d.ts +2 -0
- package/dist/bff/routerRewrite.js +31 -0
- package/dist/blob/binding.d.ts +16 -0
- package/dist/blob/binding.js +37 -0
- package/dist/blob/filesystem.d.ts +8 -0
- package/dist/blob/filesystem.js +71 -0
- package/dist/blob/index.d.ts +6 -0
- package/dist/blob/index.js +6 -0
- package/dist/blob/s3.d.ts +32 -0
- package/dist/blob/s3.js +56 -0
- package/dist/blob/s3Client.d.ts +25 -0
- package/dist/blob/s3Client.js +76 -0
- package/dist/blob/supabase.d.ts +40 -0
- package/dist/blob/supabase.js +59 -0
- package/dist/blob/vercel.d.ts +63 -0
- package/dist/blob/vercel.js +69 -0
- package/dist/composition/composeBundle.d.ts +47 -0
- package/dist/composition/composeBundle.js +45 -0
- package/dist/composition/httpBinding.d.ts +8 -0
- package/dist/composition/httpBinding.js +18 -0
- package/dist/composition/index.d.ts +3 -0
- package/dist/composition/index.js +3 -0
- package/dist/composition/nodeHost.d.ts +103 -0
- package/dist/composition/nodeHost.js +145 -0
- package/dist/data/binding.d.ts +34 -0
- package/dist/data/binding.js +92 -0
- package/dist/data/index.d.ts +5 -0
- package/dist/data/index.js +5 -0
- package/dist/data/postgresGateway.d.ts +42 -0
- package/dist/data/postgresGateway.js +135 -0
- package/dist/data/queryBuilder.d.ts +54 -0
- package/dist/data/queryBuilder.js +240 -0
- package/dist/data/queryBuilderSql.d.ts +76 -0
- package/dist/data/queryBuilderSql.js +145 -0
- package/dist/data/supabaseClientFactory.d.ts +34 -0
- package/dist/data/supabaseClientFactory.js +56 -0
- package/dist/data/supabaseGateway.d.ts +22 -0
- package/dist/data/supabaseGateway.js +49 -0
- package/dist/http/deadline.d.ts +20 -0
- package/dist/http/deadline.js +93 -0
- package/dist/http/index.d.ts +6 -0
- package/dist/http/index.js +5 -0
- package/dist/http/requestAdapter.d.ts +38 -0
- package/dist/http/requestAdapter.js +203 -0
- package/dist/http/runtime.d.ts +83 -0
- package/dist/http/runtime.js +199 -0
- package/dist/http/security.d.ts +44 -0
- package/dist/http/security.js +114 -0
- package/dist/http/staticAssets.d.ts +3 -0
- package/dist/http/staticAssets.js +42 -0
- package/dist/http/types.d.ts +23 -0
- package/dist/http/types.js +6 -0
- package/dist/identity/adminAuthBinding.d.ts +28 -0
- package/dist/identity/adminAuthBinding.js +66 -0
- package/dist/identity/adminAuthorization.d.ts +34 -0
- package/dist/identity/adminAuthorization.js +72 -0
- package/dist/identity/adminContracts.d.ts +70 -0
- package/dist/identity/adminContracts.js +43 -0
- package/dist/identity/adminMagicLinkHandler.d.ts +39 -0
- package/dist/identity/adminMagicLinkHandler.js +94 -0
- package/dist/identity/adminMeHandler.d.ts +15 -0
- package/dist/identity/adminMeHandler.js +49 -0
- package/dist/identity/adminPreflight.d.ts +16 -0
- package/dist/identity/adminPreflight.js +38 -0
- package/dist/identity/adminUserActionPorts.d.ts +31 -0
- package/dist/identity/adminUserActionPorts.js +51 -0
- package/dist/identity/adminUserHandlers.d.ts +38 -0
- package/dist/identity/adminUserHandlers.js +140 -0
- package/dist/identity/authVerifyUrl.d.ts +6 -0
- package/dist/identity/authVerifyUrl.js +54 -0
- package/dist/identity/contracts/contracts.d.ts +8 -0
- package/dist/identity/contracts/contracts.js +2 -0
- package/dist/identity/contracts/emailTrust.d.ts +3 -0
- package/dist/identity/contracts/emailTrust.js +4 -0
- package/dist/identity/contracts/index.d.ts +8 -0
- package/dist/identity/contracts/index.js +8 -0
- package/dist/identity/contracts/oidc.d.ts +3 -0
- package/dist/identity/contracts/oidc.js +9 -0
- package/dist/identity/contracts/operatorAuth.d.ts +35 -0
- package/dist/identity/contracts/operatorAuth.js +53 -0
- package/dist/identity/contracts/operatorInvitations.d.ts +37 -0
- package/dist/identity/contracts/operatorInvitations.js +1 -0
- package/dist/identity/contracts/ports.d.ts +22 -0
- package/dist/identity/contracts/ports.js +1 -0
- package/dist/identity/contracts/privacy.d.ts +62 -0
- package/dist/identity/contracts/privacy.js +99 -0
- package/dist/identity/contracts/providerList.d.ts +3 -0
- package/dist/identity/contracts/providerList.js +11 -0
- package/dist/identity/contracts/types.d.ts +16 -0
- package/dist/identity/contracts/types.js +4 -0
- package/dist/identity/contribution.d.ts +8 -0
- package/dist/identity/contribution.js +22 -0
- package/dist/identity/customerAuth.d.ts +8 -0
- package/dist/identity/customerAuth.js +1 -0
- package/dist/identity/customerAuthorization.d.ts +5 -0
- package/dist/identity/customerAuthorization.js +22 -0
- package/dist/identity/customerContracts.d.ts +42 -0
- package/dist/identity/customerContracts.js +43 -0
- package/dist/identity/customerIdentityBinding.d.ts +44 -0
- package/dist/identity/customerIdentityBinding.js +60 -0
- package/dist/identity/customerIdentityVerifier.d.ts +8 -0
- package/dist/identity/customerIdentityVerifier.js +101 -0
- package/dist/identity/customerMagicLinkHandler.d.ts +38 -0
- package/dist/identity/customerMagicLinkHandler.js +115 -0
- package/dist/identity/customerMeHandler.d.ts +11 -0
- package/dist/identity/customerMeHandler.js +46 -0
- package/dist/identity/customerPorts.d.ts +4 -0
- package/dist/identity/customerPorts.js +1 -0
- package/dist/identity/customerSessionBinding.d.ts +38 -0
- package/dist/identity/customerSessionBinding.js +80 -0
- package/dist/identity/customerSessionIssuer.d.ts +10 -0
- package/dist/identity/customerSessionIssuer.js +57 -0
- package/dist/identity/customerVerifyOtpHandler.d.ts +8 -0
- package/dist/identity/customerVerifyOtpHandler.js +41 -0
- package/dist/identity/directOperatorInvitationStore.d.ts +19 -0
- package/dist/identity/directOperatorInvitationStore.js +193 -0
- package/dist/identity/emailTrustPolicy.d.ts +14 -0
- package/dist/identity/emailTrustPolicy.js +16 -0
- package/dist/identity/identityPersonalDataContributor.d.ts +7 -0
- package/dist/identity/identityPersonalDataContributor.js +46 -0
- package/dist/identity/identityReadiness.d.ts +10 -0
- package/dist/identity/identityReadiness.js +25 -0
- package/dist/identity/index.d.ts +67 -0
- package/dist/identity/index.js +66 -0
- package/dist/identity/inviteAdminUserUseCase.d.ts +89 -0
- package/dist/identity/inviteAdminUserUseCase.js +75 -0
- package/dist/identity/jwtLibrary.d.ts +54 -0
- package/dist/identity/jwtLibrary.js +1 -0
- package/dist/identity/machineActorWriteFence.d.ts +4 -0
- package/dist/identity/machineActorWriteFence.js +13 -0
- package/dist/identity/magicLinkPorts.d.ts +28 -0
- package/dist/identity/magicLinkPorts.js +1 -0
- package/dist/identity/managedAccountLinkStore.d.ts +2 -0
- package/dist/identity/managedAccountLinkStore.js +93 -0
- package/dist/identity/managedAdminAuthVerifier.d.ts +7 -0
- package/dist/identity/managedAdminAuthVerifier.js +27 -0
- package/dist/identity/managedAdminUserGateways.d.ts +123 -0
- package/dist/identity/managedAdminUserGateways.js +127 -0
- package/dist/identity/managedClient.d.ts +90 -0
- package/dist/identity/managedClient.js +10 -0
- package/dist/identity/managedClientAuthLink.d.ts +3 -0
- package/dist/identity/managedClientAuthLink.js +115 -0
- package/dist/identity/managedCustomerMe.d.ts +13 -0
- package/dist/identity/managedCustomerMe.js +30 -0
- package/dist/identity/managedEmailTrustPolicy.d.ts +11 -0
- package/dist/identity/managedEmailTrustPolicy.js +105 -0
- package/dist/identity/managedIdentityVerifier.d.ts +2 -0
- package/dist/identity/managedIdentityVerifier.js +16 -0
- package/dist/identity/managedPrivacy.d.ts +4 -0
- package/dist/identity/managedPrivacy.js +39 -0
- package/dist/identity/messages.d.ts +29 -0
- package/dist/identity/messages.js +39 -0
- package/dist/identity/oidcIdentityVerifier.d.ts +45 -0
- package/dist/identity/oidcIdentityVerifier.js +309 -0
- package/dist/identity/oidcPrincipal.d.ts +2 -0
- package/dist/identity/oidcPrincipal.js +10 -0
- package/dist/identity/operatorAdminAuth.d.ts +6 -0
- package/dist/identity/operatorAdminAuth.js +13 -0
- package/dist/identity/operatorAuthHandlers.d.ts +18 -0
- package/dist/identity/operatorAuthHandlers.js +71 -0
- package/dist/identity/operatorIdentityVerifier.d.ts +8 -0
- package/dist/identity/operatorIdentityVerifier.js +19 -0
- package/dist/identity/operatorInvitationLifecycle.d.ts +7 -0
- package/dist/identity/operatorInvitationLifecycle.js +15 -0
- package/dist/identity/operatorInvitationPorts.d.ts +31 -0
- package/dist/identity/operatorInvitationPorts.js +1 -0
- package/dist/identity/operatorPorts.d.ts +37 -0
- package/dist/identity/operatorPorts.js +1 -0
- package/dist/identity/operatorSession.d.ts +13 -0
- package/dist/identity/operatorSession.js +31 -0
- package/dist/identity/operatorTokenAdminAuth.d.ts +15 -0
- package/dist/identity/operatorTokenAdminAuth.js +50 -0
- package/dist/identity/personalDataRegistry.d.ts +4 -0
- package/dist/identity/personalDataRegistry.js +11 -0
- package/dist/identity/platformAdminAuth.d.ts +15 -0
- package/dist/identity/platformAdminAuth.js +1 -0
- package/dist/identity/ports.d.ts +127 -0
- package/dist/identity/ports.js +38 -0
- package/dist/identity/postgresAccountLinkStore.d.ts +7 -0
- package/dist/identity/postgresAccountLinkStore.js +52 -0
- package/dist/identity/postgresCustomerMe.d.ts +3 -0
- package/dist/identity/postgresCustomerMe.js +21 -0
- package/dist/identity/postgresCustomerRecovery.d.ts +11 -0
- package/dist/identity/postgresCustomerRecovery.js +57 -0
- package/dist/identity/postgresOperatorIdentity.d.ts +5 -0
- package/dist/identity/postgresOperatorIdentity.js +137 -0
- package/dist/identity/postgresPrivacy.d.ts +7 -0
- package/dist/identity/postgresPrivacy.js +126 -0
- package/dist/identity/privacyHandlers.d.ts +10 -0
- package/dist/identity/privacyHandlers.js +35 -0
- package/dist/identity/privacyPorts.d.ts +72 -0
- package/dist/identity/privacyPorts.js +8 -0
- package/dist/identity/privacyUseCases.d.ts +5 -0
- package/dist/identity/privacyUseCases.js +55 -0
- package/dist/identity/reconcileAccountForPrincipal.d.ts +20 -0
- package/dist/identity/reconcileAccountForPrincipal.js +66 -0
- package/dist/identity/reconcileAccountHandler.d.ts +11 -0
- package/dist/identity/reconcileAccountHandler.js +30 -0
- package/dist/identity/removeAdminUserUseCase.d.ts +31 -0
- package/dist/identity/removeAdminUserUseCase.js +60 -0
- package/dist/identity/response.d.ts +3 -0
- package/dist/identity/response.js +2 -0
- package/dist/identity/sql.d.ts +44 -0
- package/dist/identity/sql.js +10 -0
- package/dist/job-ledger/index.d.ts +5 -0
- package/dist/job-ledger/index.js +3 -0
- package/dist/job-ledger/ports.d.ts +10 -0
- package/dist/job-ledger/ports.js +7 -0
- package/dist/job-ledger/postgres.d.ts +10 -0
- package/dist/job-ledger/postgres.js +101 -0
- package/dist/job-ledger/sql.d.ts +7 -0
- package/dist/job-ledger/sql.js +10 -0
- package/dist/job-ledger/supabase.d.ts +77 -0
- package/dist/job-ledger/supabase.js +202 -0
- package/dist/kernel/index.d.ts +1 -0
- package/dist/kernel/index.js +1 -0
- package/dist/kernel/platformKernel.d.ts +34 -0
- package/dist/kernel/platformKernel.js +115 -0
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.js +1 -0
- package/dist/migrations/postgresRunner.d.ts +50 -0
- package/dist/migrations/postgresRunner.js +176 -0
- package/dist/scheduler/advisoryLock.d.ts +44 -0
- package/dist/scheduler/advisoryLock.js +114 -0
- package/dist/scheduler/cronGuard.d.ts +10 -0
- package/dist/scheduler/cronGuard.js +19 -0
- package/dist/scheduler/cronSecret.d.ts +5 -0
- package/dist/scheduler/cronSecret.js +23 -0
- package/dist/scheduler/handlers.d.ts +9 -0
- package/dist/scheduler/handlers.js +10 -0
- package/dist/scheduler/httpEntry.d.ts +16 -0
- package/dist/scheduler/httpEntry.js +31 -0
- package/dist/scheduler/index.d.ts +9 -0
- package/dist/scheduler/index.js +9 -0
- package/dist/scheduler/jobRegistry.d.ts +21 -0
- package/dist/scheduler/jobRegistry.js +39 -0
- package/dist/scheduler/jobs.d.ts +48 -0
- package/dist/scheduler/jobs.js +92 -0
- package/dist/scheduler/nodeScheduler.d.ts +42 -0
- package/dist/scheduler/nodeScheduler.js +73 -0
- package/dist/scheduler/vercelScheduler.d.ts +29 -0
- package/dist/scheduler/vercelScheduler.js +51 -0
- package/package.json +116 -3
- package/release-gates.json +143 -0
- package/sql/20260809150000_job_run_ledger.sql +301 -0
- package/sql/20260809150001_job_run_ledger_v3.sql +70 -0
- package/sql/20260810180001_self_host_actor_auth.sql +40 -0
- package/sql/20260810204057_customer_identity_read.sql +31 -0
- package/sql/20260814090000_customer_selfservice_recovery.sql +477 -0
- package/sql/20260901143000_admin_membership_authority_foundation.sql +234 -0
- package/sql/20261018120000_identity_operator_invitations.sql +42 -0
- package/sql/20261018180000_identity_operator_challenges.sql +56 -0
- package/sql/20261018190000_identity_privacy_erasures.sql +15 -0
- package/src/bff/dispatch.ts +81 -0
- package/src/bff/envelope.ts +142 -0
- package/src/bff/health.ts +37 -0
- package/src/bff/index.ts +30 -0
- package/src/bff/lazyRoute.ts +28 -0
- package/src/bff/requestContext.ts +48 -0
- package/src/bff/routerRewrite.ts +38 -0
- package/src/blob/binding.ts +55 -0
- package/src/blob/filesystem.ts +86 -0
- package/src/blob/index.ts +17 -0
- package/src/blob/s3.ts +87 -0
- package/src/blob/s3Client.ts +91 -0
- package/src/blob/supabase.ts +88 -0
- package/src/blob/vercel.ts +127 -0
- package/src/composition/composeBundle.ts +109 -0
- package/src/composition/httpBinding.ts +30 -0
- package/src/composition/index.ts +17 -0
- package/src/composition/nodeHost.ts +289 -0
- package/src/data/binding.ts +157 -0
- package/src/data/index.ts +33 -0
- package/src/data/postgresGateway.ts +186 -0
- package/src/data/queryBuilder.ts +300 -0
- package/src/data/queryBuilderSql.ts +183 -0
- package/src/data/supabaseClientFactory.ts +92 -0
- package/src/data/supabaseGateway.ts +76 -0
- package/src/http/deadline.ts +117 -0
- package/src/http/index.ts +36 -0
- package/src/http/requestAdapter.ts +215 -0
- package/src/http/runtime.ts +319 -0
- package/src/http/security.ts +155 -0
- package/src/http/staticAssets.ts +42 -0
- package/src/http/types.ts +31 -0
- package/src/identity/adminAuthBinding.ts +76 -0
- package/src/identity/adminAuthorization.ts +106 -0
- package/src/identity/adminContracts.ts +52 -0
- package/src/identity/adminMagicLinkHandler.ts +132 -0
- package/src/identity/adminMeHandler.ts +64 -0
- package/src/identity/adminPreflight.ts +46 -0
- package/src/identity/adminUserActionPorts.ts +78 -0
- package/src/identity/adminUserHandlers.ts +174 -0
- package/src/identity/authVerifyUrl.ts +56 -0
- package/src/identity/contracts/contracts.ts +15 -0
- package/src/identity/contracts/emailTrust.ts +5 -0
- package/src/identity/contracts/index.ts +8 -0
- package/src/identity/contracts/oidc.ts +10 -0
- package/src/identity/contracts/operatorAuth.ts +61 -0
- package/src/identity/contracts/operatorInvitations.ts +32 -0
- package/src/identity/contracts/ports.ts +25 -0
- package/src/identity/contracts/privacy.ts +86 -0
- package/src/identity/contracts/providerList.ts +13 -0
- package/src/identity/contracts/types.ts +25 -0
- package/src/identity/contribution.ts +29 -0
- package/src/identity/customerAuth.ts +3 -0
- package/src/identity/customerAuthorization.ts +38 -0
- package/src/identity/customerContracts.ts +52 -0
- package/src/identity/customerIdentityBinding.ts +125 -0
- package/src/identity/customerIdentityVerifier.ts +141 -0
- package/src/identity/customerMagicLinkHandler.ts +171 -0
- package/src/identity/customerMeHandler.ts +64 -0
- package/src/identity/customerPorts.ts +2 -0
- package/src/identity/customerSessionBinding.ts +114 -0
- package/src/identity/customerSessionIssuer.ts +71 -0
- package/src/identity/customerVerifyOtpHandler.ts +44 -0
- package/src/identity/directOperatorInvitationStore.ts +178 -0
- package/src/identity/emailTrustPolicy.ts +16 -0
- package/src/identity/identityPersonalDataContributor.ts +48 -0
- package/src/identity/identityReadiness.ts +26 -0
- package/src/identity/index.ts +69 -0
- package/src/identity/inviteAdminUserUseCase.ts +134 -0
- package/src/identity/jwtLibrary.ts +24 -0
- package/src/identity/machineActorWriteFence.ts +19 -0
- package/src/identity/magicLinkPorts.ts +7 -0
- package/src/identity/managedAccountLinkStore.ts +105 -0
- package/src/identity/managedAdminAuthVerifier.ts +40 -0
- package/src/identity/managedAdminUserGateways.ts +164 -0
- package/src/identity/managedClient.ts +58 -0
- package/src/identity/managedClientAuthLink.ts +120 -0
- package/src/identity/managedCustomerMe.ts +52 -0
- package/src/identity/managedEmailTrustPolicy.ts +90 -0
- package/src/identity/managedIdentityVerifier.ts +20 -0
- package/src/identity/managedPrivacy.ts +37 -0
- package/src/identity/messages.ts +41 -0
- package/src/identity/oidcIdentityVerifier.ts +229 -0
- package/src/identity/oidcPrincipal.ts +10 -0
- package/src/identity/operatorAdminAuth.ts +14 -0
- package/src/identity/operatorAuthHandlers.ts +52 -0
- package/src/identity/operatorIdentityVerifier.ts +19 -0
- package/src/identity/operatorInvitationLifecycle.ts +14 -0
- package/src/identity/operatorInvitationPorts.ts +11 -0
- package/src/identity/operatorPorts.ts +11 -0
- package/src/identity/operatorSession.ts +30 -0
- package/src/identity/operatorTokenAdminAuth.ts +79 -0
- package/src/identity/personalDataRegistry.ts +8 -0
- package/src/identity/platformAdminAuth.ts +7 -0
- package/src/identity/ports.ts +158 -0
- package/src/identity/postgresAccountLinkStore.ts +49 -0
- package/src/identity/postgresCustomerMe.ts +33 -0
- package/src/identity/postgresCustomerRecovery.ts +72 -0
- package/src/identity/postgresOperatorIdentity.ts +123 -0
- package/src/identity/postgresPrivacy.ts +117 -0
- package/src/identity/privacyHandlers.ts +33 -0
- package/src/identity/privacyPorts.ts +52 -0
- package/src/identity/privacyUseCases.ts +48 -0
- package/src/identity/reconcileAccountForPrincipal.ts +99 -0
- package/src/identity/reconcileAccountHandler.ts +36 -0
- package/src/identity/removeAdminUserUseCase.ts +85 -0
- package/src/identity/response.ts +3 -0
- package/src/identity/sql.ts +10 -0
- package/src/job-ledger/index.ts +25 -0
- package/src/job-ledger/ports.ts +27 -0
- package/src/job-ledger/postgres.ts +121 -0
- package/src/job-ledger/sql.ts +12 -0
- package/src/job-ledger/supabase.ts +294 -0
- package/src/kernel/index.ts +17 -0
- package/src/kernel/platformKernel.ts +153 -0
- package/src/migrations/index.ts +10 -0
- package/src/migrations/postgresRunner.ts +255 -0
- package/src/scheduler/advisoryLock.ts +145 -0
- package/src/scheduler/cronGuard.ts +30 -0
- package/src/scheduler/cronSecret.ts +26 -0
- package/src/scheduler/handlers.ts +24 -0
- package/src/scheduler/httpEntry.ts +49 -0
- package/src/scheduler/index.ts +47 -0
- package/src/scheduler/jobRegistry.ts +57 -0
- package/src/scheduler/jobs.ts +119 -0
- package/src/scheduler/nodeScheduler.ts +123 -0
- package/src/scheduler/vercelScheduler.ts +71 -0
package/README.md
CHANGED
|
@@ -1,3 +1,473 @@
|
|
|
1
1
|
# @openlup/platform
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Development preview. This package joins core and outbox in the publishable set from the next set version; this configuration does not establish a registry release or a stable API. Its repository-directory publish command refuses publication; the authorized package-release workflow owns publication.
|
|
4
|
+
|
|
5
|
+
It holds the runnable server substrate an OpenLup application composes: the Node HTTP runtime, BFF dispatch, scheduling and job leases, blob storage, data gateways, the node-postgres migration runner and bundle composition. Ports and their contracts stay in `@openlup/core/platform-runtime`.
|
|
6
|
+
|
|
7
|
+
## Package surface
|
|
8
|
+
|
|
9
|
+
`release-gates.json` declares kind `rail`: this foundation provides runtime infrastructure over core ports, matching the architecture's rail responsibility. Its eleven experimental entries each bind a declaration snapshot and package-owned smoke tests. The API checker reads this same inventory.
|
|
10
|
+
|
|
11
|
+
| Export | Contents |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `./http` | Node request adaptation, deadlines, security headers and static documents, and `createNodeHttpRuntime` with its fixed request order |
|
|
14
|
+
| `./bff` | `createBffDispatcher`, `lazyBffRoute`, the hosted router URL rewrite, the response envelope (`createBffResponder`), the observed request context and the health route |
|
|
15
|
+
| `./scheduler` | Transport-neutral scheduled jobs (`ScheduledJob`, the job registry, the lease-aware runner and the authenticated HTTP cron entry), path-declared jobs from configuration, the node-cron scheduler with per-job advisory locks, hosted cron verification, the cron entrypoint guard (it compares the presented bearer token with `CRON_SECRET` in constant time) and direct job bindings |
|
|
16
|
+
| `./blob` | Filesystem, S3-compatible, Supabase Storage and Vercel Blob adapters, and `bindBlobPort` |
|
|
17
|
+
| `./data` | Supabase and node-postgres data gateways, the role-free transaction lane, the query builder and the data bindings |
|
|
18
|
+
| `./migrations` | The node-postgres `MigrationRunnerPort` |
|
|
19
|
+
| `./job-ledger` | The job-run ledger port, its PostgreSQL and managed (Supabase) adapters, the managed v2/v3 compatibility calls and the location of its SQL |
|
|
20
|
+
| `./kernel` | The bundle identifiers, descriptors and readiness |
|
|
21
|
+
| `./composition` | `createBundleComposer`, the Node HTTP binding helpers and `createNodeHost` |
|
|
22
|
+
| `./identity` | Experimental capability: identity engine, authorization, profile readers, session adapters and BFF factories |
|
|
23
|
+
| `./identity/contracts` | Experimental capability: browser-safe customer auth port, value types and provider parser |
|
|
24
|
+
|
|
25
|
+
## Scheduled jobs
|
|
26
|
+
|
|
27
|
+
A job is `{ id, schedule, lease?, run(context) }` with a UTC cron expression. Domains and packages contribute jobs to `createScheduledJobRegistry`, which refuses duplicate ids and ships empty. The Node host runs registry jobs on its own timers and calls `run` directly, with no HTTP request and no secret. `createScheduledJobHttpEntry` mounts the same job behind the cron guard for a hosted cron. A job that declares `lease` runs only after the injected job-lease port grants it; a lease held elsewhere skips the run, and a finish the port refuses fails the run. `scheduledJobsFromContribution` turns a contribution's cadence schedules into jobs and refuses a cadence that no cron expression matches exactly; a contribution run that reports a failed outcome fails the job.
|
|
28
|
+
|
|
29
|
+
## Bundle readiness
|
|
30
|
+
|
|
31
|
+
`PLATFORM_BUNDLE` selects `vercel-supabase` (the default when absent), `node-supabase` or `node-postgres`. A bundle's readiness refuses, before any traffic or timer: an unknown `PLATFORM_BUNDLE` (resolution itself still falls back to the default); a self-host bundle without `APP_BASE_URL`; and, reported together under `OPENLUP_E_ENV_MISSING`, every selected capability without its settings: the scheduler without `CRON_SECRET`, Node scheduling without `DATABASE_URL` for its cluster lock (never a silent single-instance lock), and the selected blob capability without its settings (see Blob storage). An unknown `PLATFORM_BLOB` is refused too. The Node host checks readiness at boot.
|
|
32
|
+
|
|
33
|
+
## Blob storage
|
|
34
|
+
|
|
35
|
+
`PLATFORM_BLOB` selects the blob capability; without it the bundle's own applies (filesystem for node-postgres, the local development default). `bindBlobPort` builds each one from the environment and the clients the application injects:
|
|
36
|
+
|
|
37
|
+
- `filesystem`: `BLOB_FS_ROOT`, `BLOB_FS_BASE_URL`;
|
|
38
|
+
- `s3`: `BLOB_S3_BUCKET`, `BLOB_S3_BASE_URL`, and a default client from `createS3ClientFromEnv` (`BLOB_S3_REGION`, `BLOB_S3_ENDPOINT`, `BLOB_S3_FORCE_PATH_STYLE`, `BLOB_S3_ACCESS_KEY_ID` with `BLOB_S3_SECRET_ACCESS_KEY`). `@aws-sdk/client-s3` is an optional peer loaded on first use, so only an application that selects S3 installs it;
|
|
39
|
+
- `supabase`: `BLOB_SUPABASE_BUCKET` and `BlobBindingDeps.supabaseStorageClient`, a factory returning the structural `SupabaseStorageClient` declared in blob. Blob itself reads no data-gateway settings. The default composer supplies this factory from the data-gateway settings and its optional `createSupabaseClient` dependency, using the service-role key with `persistSession: false` and `autoRefreshToken: false`. For this binding, a blank `SUPABASE_URL` falls back to `VITE_SUPABASE_URL`, consistently with readiness;
|
|
40
|
+
- `vercel-blob`: the injected `@vercel/blob` module and `BLOB_READ_WRITE_TOKEN`.
|
|
41
|
+
|
|
42
|
+
The Node host passes the composed ports, blob storage included, to the HTTP runtime builder and to the jobs contributed to it. The reference repository's compose file starts a local S3-compatible service with `--profile local-storage`; missing storage credentials refuse at service startup, while an omitted `OBJECT_STORAGE_PORT` selects an ephemeral loopback port. The inactive profile requires no storage settings. A conformance test runs upload, read-back, delete and access refusal against that image; initialization failure with Docker available fails the test. Hosted S3 provider certification is not claimed.
|
|
43
|
+
|
|
44
|
+
## What the application supplies
|
|
45
|
+
|
|
46
|
+
The package carries no deployment identity. The application passes it every value that names a deployment or a domain:
|
|
47
|
+
|
|
48
|
+
- the BFF route table, the not-found response, the request preflight and the per-request hook;
|
|
49
|
+
- how a request reference is chosen, and the health payload with its strict contract;
|
|
50
|
+
- the security header policy, including the content security policy, the production hosts and the robots.txt body;
|
|
51
|
+
- its own entrypoints, by exact path or by path rule;
|
|
52
|
+
- the job configuration file or object, the direct job bindings and the host admission check;
|
|
53
|
+
- the migration catalogue, the migration lock name and the object-inventory projector;
|
|
54
|
+
- the release correlation, default failure reason and read-failure messages that the job-run ledgers record;
|
|
55
|
+
- the environment, passed explicitly, and the provider clients it needs (the Supabase `createClient`, the `@vercel/blob` module, optionally its own PostgreSQL gateway factory), so the package itself reads no environment variable (an injected SDK may read its own credentials; the static and migration roots default to the working directory). Its optional SDK peers are `pg`, whose types its PostgreSQL declarations use, and `@aws-sdk/client-s3`, loaded lazily by the default S3 client. Blob declarations use structural types and need no S3 SDK;
|
|
56
|
+
- an optional scheduler profile for the Node host: a fenced projection of the declared jobs with its own bindings and validation hooks.
|
|
57
|
+
|
|
58
|
+
`createBundleComposer` binds the blob slot by default; pass `createBundleComposer({ createSupabaseClient })` to enable its Supabase Storage binding when the data-gateway settings and bucket are present. Without that client Supabase Storage stays unbound. A custom `blob` binder still overrides the default. The HTTP, scheduler, data, migrations, analytics and transactional slots stay `null` until the application supplies their binders; `createDataBindings` builds the data binder from the application's database client factory.
|
|
59
|
+
|
|
60
|
+
## Job-run ledger SQL
|
|
61
|
+
|
|
62
|
+
`JOB_RUN_LEDGER_MIGRATIONS` lists the two files a fresh installation applies, in order, through its own migration chain:
|
|
63
|
+
|
|
64
|
+
1. [`sql/20260809150000_job_run_ledger.sql`](sql/20260809150000_job_run_ledger.sql): the job controls, runs, and the v2 claim and finish; its bytes and migration identity equal the reference application's platform migration of that name.
|
|
65
|
+
2. [`sql/20260809150001_job_run_ledger_v3.sql`](sql/20260809150001_job_run_ledger_v3.sql): the v3 claim and finish the PostgreSQL ledger calls, as `CREATE OR REPLACE`, with bodies byte-equal to the reference chain's definitions.
|
|
66
|
+
|
|
67
|
+
The package SQL and the reference application's platform migration chain are alternative install paths, never applied together: the reference chain defines all four job-control functions itself, with plain `CREATE FUNCTION`, so it fails on a database where the package SQL already created them. The package file `20260809150001_job_run_ledger_v3` has a migration identity no reference migration uses. Importing the package never applies SQL.
|
|
68
|
+
|
|
69
|
+
## Optional peers
|
|
70
|
+
|
|
71
|
+
`pg`, `@types/pg` and `@aws-sdk/client-s3` are optional peers. Install `pg` and
|
|
72
|
+
`@types/pg` alongside this package when selecting PostgreSQL adapters; install
|
|
73
|
+
`@aws-sdk/client-s3` when selecting S3 blob storage. Loading an unselected adapter
|
|
74
|
+
never installs or initializes its SDK. The PostgreSQL scheduler lock also loads
|
|
75
|
+
`pg` only on its first operation.
|
|
76
|
+
|
|
77
|
+
A selected capability whose SDK is absent rejects its first loading operation
|
|
78
|
+
with `OPENLUP_E_PEER_MISSING: <package> is required by <capability>; install it
|
|
79
|
+
alongside @openlup/platform`. The original module-resolution error is the cause.
|
|
80
|
+
A broken SDK, a missing transitive dependency or a provider error propagates
|
|
81
|
+
unchanged. Blob `exists` retains its boolean contract and returns false on a
|
|
82
|
+
failed HEAD; use an upload or list operation to observe an S3 loading refusal.
|
|
83
|
+
|
|
84
|
+
## Verification
|
|
85
|
+
|
|
86
|
+
This package's tests are part of the repository's required test selection; from this directory, `npm test` runs them alone. The tests rewrite the originating application's characterization with neutral names and synthetic data, and a boundary test refuses any environment read or provider import in the package source.
|
|
87
|
+
|
|
88
|
+
The module-boundary proof permits one optional `./<module>/contracts` export
|
|
89
|
+
only when that module declares `contracts: true` in `PLATFORM_MODULE_GRAPH` in
|
|
90
|
+
[`eslint.config.js`](../../eslint.config.js). Its `types`, `import` and `default`
|
|
91
|
+
targets follow the module entry shape at `dist/<module>/contracts/index`.
|
|
92
|
+
Contracts files may import only their own contracts subtree through canonical
|
|
93
|
+
relative `.js` paths and exact public `@openlup/core` entries. Both ESLint and
|
|
94
|
+
[`packageBoundary.test.ts`](test/packageBoundary.test.ts) enforce this allowlist
|
|
95
|
+
for static imports and re-exports (including types) and literal `import()`;
|
|
96
|
+
they refuse non-literal `import()` targets. Both checks reserve the identifier
|
|
97
|
+
names `require`, `module`, `exports`, `process`, `globalThis`, `global`,
|
|
98
|
+
`__dirname`, `__filename` and `Buffer` in every value and type position,
|
|
99
|
+
including local and property identifiers, and refuse every use of `import.meta`.
|
|
100
|
+
This rejects loader aliases and wrapped calls regardless of the load target.
|
|
101
|
+
The existing non-literal `require` member-call guard also remains, including
|
|
102
|
+
computed property calls.
|
|
103
|
+
The package test additionally requires every file in the contracts subtree to
|
|
104
|
+
be a scanned `.ts` file, refuses triple-slash type and path references and all
|
|
105
|
+
meta-properties (also `new.target`), and retains member-call `require` detection
|
|
106
|
+
outside contracts. Identity declares this entry; synthetic graphs also exercise these checks.
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
The job-run ledger SQL asset test verifies a readable, nonempty file within the
|
|
110
|
+
package SQL directory. Its SQL parity tests bind the actual adapter calls to the
|
|
111
|
+
shipped routine signatures; the asset's explanatory header may be edited freely.
|
|
112
|
+
|
|
113
|
+
`npm run api:check` compares each of the eleven declaration entry graphs with the
|
|
114
|
+
committed `api/*.api.md` reports. After building, deliberately regenerate them
|
|
115
|
+
with `node --experimental-strip-types ./scripts/api-contract.ts --update` from
|
|
116
|
+
this package, and review the declaration changes.
|
|
117
|
+
|
|
118
|
+
The source-checkout binding `npm run test:consumer` runs
|
|
119
|
+
[`platform-cold-consumer.ts`](../../scripts/packages/platform-cold-consumer.ts).
|
|
120
|
+
It requires the cold package producer's verified `OPENLUP_PACK_MANIFEST` and
|
|
121
|
+
exact `OPENLUP_PACK_COMMIT`; it never substitutes a workspace build or repacks
|
|
122
|
+
on refusal. `ci:required` invokes that proof; API checks remain in the shared
|
|
123
|
+
cheap phase. The producer must include publishable core and platform tarballs;
|
|
124
|
+
the package inventory includes both at the same set version. Cold packing requires a clean committed package tree; an uncommitted preparation cannot produce the manifest.
|
|
125
|
+
|
|
126
|
+
The proof installs those tarballs, locked Zod and explicit Node type tooling
|
|
127
|
+
offline from the default npm cache into an OS temporary directory outside the checkout.
|
|
128
|
+
It verifies optional-peer absence physically and through both CommonJS and ESM
|
|
129
|
+
resolution, refuses symlinks and ancestor package sources, checks the complete
|
|
130
|
+
export classification, imports every nonadapter entry with an empty environment,
|
|
131
|
+
and compiles its types in strict NodeNext and Bundler modes without skipping
|
|
132
|
+
library checks. A type leak fails the proof even if runtime imports pass.
|
|
133
|
+
|
|
134
|
+
It then checks actual missing-SDK refusals, installs the three peers at the root
|
|
135
|
+
lockfile's exact versions using `npm install --prefer-offline --no-audit --fund=false`
|
|
136
|
+
and the default npm cache, compiles all adapter declarations and runs the real SDKs against owned
|
|
137
|
+
in-memory fixtures: S3 upload/HEAD/list/delete through the real SDK and
|
|
138
|
+
deterministic invalid-URL refusals after the default SDK/driver loads.
|
|
139
|
+
These fixtures contact no live provider. The PostgreSQL adapters then run their SQL conformance
|
|
140
|
+
against a disposable database: the CI job's pinned PostgreSQL service when the job supplies its
|
|
141
|
+
identity (`OPENLUP_PROOF_SERVICE_CONTAINER` and `OPENLUP_PROOF_SERVICE_PORT`), as the outbox proof
|
|
142
|
+
uses it, or otherwise an owned, labelled container of the same pinned image. There is no skip:
|
|
143
|
+
without either the proof fails. Temporary consumer files, the proof database and an owned container
|
|
144
|
+
are removed on completion. Missing cached packages fail the initial offline installation;
|
|
145
|
+
the SDK-present install can fetch missing registry metadata or packages. Neither
|
|
146
|
+
phase redirects npm to an empty temporary cache.
|
|
147
|
+
|
|
148
|
+
The composition declarations describe the injected Supabase factory structurally;
|
|
149
|
+
they do not import the data entry or its PostgreSQL types. The cold proof still
|
|
150
|
+
requires all six nonadapter entries (including `./identity/contracts`) to import in fresh processes and compile
|
|
151
|
+
in both resolution modes with all three optional peers absent.
|
|
152
|
+
|
|
153
|
+
<!-- openlup-doc-impact {"unit":"platform-substrate","digest":"sha256-00994d288cfec0c8dc0ae9aeae2ff542e2e9af2fedcb4dd2dfeb6c99523be92d","reason":"The manifest moves to the 0.15.0 set version with the exact @openlup/core 0.15.0 peer pin. The package surface, settings and verification described here are unchanged by this preparation delta."} -->
|
|
154
|
+
|
|
155
|
+
## Identity import candidate
|
|
156
|
+
|
|
157
|
+
The OIDC API adds `createOidcIdentityVerifier`,
|
|
158
|
+
`deriveOidcPrincipalId`, `createPostgresAccountLinkStore` and
|
|
159
|
+
`identityOidcReadiness` from `@openlup/platform/identity`, which also exports
|
|
160
|
+
`OIDC_FAILURE_CODES` and `OidcFailureCode` for hosts. The browser-shared
|
|
161
|
+
`@openlup/platform/identity/contracts` entry excludes OIDC refusals.
|
|
162
|
+
Inject the host's selected JWT library through `IdentityJwtLibraryLoader`.
|
|
163
|
+
Discovery and rotating keys load only on verification or readiness. The opt-in
|
|
164
|
+
direct composition uses normal reconcile with an explicit email-trust policy,
|
|
165
|
+
authenticated actor reads and live operator membership. Managed storage requires
|
|
166
|
+
native federation sessions and refuses raw upstream-token composition. Run
|
|
167
|
+
`node tests/postgres/runOidcIdentityConformance.mjs` from the repository root with
|
|
168
|
+
its cached pinned issuer and local prerequisites; the [OIDC recipe](../../docs/platform/IDENTITY.md#real-issuer-oidc-recipe)
|
|
169
|
+
owns timing, refusal, session and certification boundaries. There is no schema or
|
|
170
|
+
default login flow change; existing static session verification and default
|
|
171
|
+
reference/browser flows retain their runtime behaviour.
|
|
172
|
+
|
|
173
|
+
The existing `IdentityJwtLibrary.jwtVerify` contract widens with optional
|
|
174
|
+
`currentDate?: Date` and `clockTolerance?: number` verify options and now returns
|
|
175
|
+
`{ payload: IdentityJwtClaims }`, whose claims interface includes a string index
|
|
176
|
+
signature. **Migration:** hosts implementing or typing their own
|
|
177
|
+
`IdentityJwtLibrary` or `IdentityJwtLibraryLoader` must accept the optional verify
|
|
178
|
+
options and return claims as `IdentityJwtClaims`.
|
|
179
|
+
|
|
180
|
+
The direct operator API adds `createPostgresOperatorIdentityStore`,
|
|
181
|
+
`createOperatorSessionService`, `createOperatorIdentityVerifier`,
|
|
182
|
+
`createOperatorAdminAuth` and `createOperatorAuthHandlers` to `./identity`.
|
|
183
|
+
`./identity/contracts` exposes strict operator challenge/session schemas and
|
|
184
|
+
`OperatorBrowserAuthPort` without a server or provider import. Challenge delivery
|
|
185
|
+
and session signing use the existing structural ports. Operator handlers send
|
|
186
|
+
the padded generic acceptance before awaiting mailbox delivery, keeping delivery
|
|
187
|
+
latency out of the response. Custom HTTP composition uses the session service's
|
|
188
|
+
optional acceptance callback for the same ordering. Restoration reads preserve
|
|
189
|
+
in-flight browser redemption; explicit sign-out still cancels it. Active operator
|
|
190
|
+
login needs no pending invitation and preserves membership and invitation history. The new store's public
|
|
191
|
+
signature exposes no driver types and loads its optional driver only on use.
|
|
192
|
+
|
|
193
|
+
Apply the complete direct catalogue through position 68 before enabling human
|
|
194
|
+
login; `sql/20261018180000_identity_operator_challenges.sql` is its exact projection.
|
|
195
|
+
Configure a distinct operator audience and an adopter deployment route policy:
|
|
196
|
+
the public policy refuses all mounted operator routes, including `me`, with
|
|
197
|
+
`adopter_policy_required` before input or authentication-binding construction. The reference dispatcher accepts a
|
|
198
|
+
session-binding factory through `createReferenceBffDispatch`; use it to compose
|
|
199
|
+
separate operator delivery. Caller-supplied operator handlers retain the same
|
|
200
|
+
policy boundary. The browser hook consumes guarded auth-port notifications rather
|
|
201
|
+
than signing out from a stale post-redemption check. Use the
|
|
202
|
+
explicit bootstrap/prune commands in the [identity guide](../../docs/platform/IDENTITY.md#direct-human-login).
|
|
203
|
+
The bounded reference browser builds do not mount the admin shell; application
|
|
204
|
+
composition must mount the provided pages and hook. First redemption activates the existing invitation and consumes the challenge in
|
|
205
|
+
one transaction. Live membership, not a JWT role, authorizes each request. The
|
|
206
|
+
cold consumer includes both identity entries and the new adapter's missing-peer
|
|
207
|
+
refusal; real concurrency and upgrade proof needs the complete PostgreSQL chain.
|
|
208
|
+
|
|
209
|
+
Creating a client/contact records commerce contact data, not an authentication
|
|
210
|
+
identity. Creating an auth user provisions a principal. Neither a typed address
|
|
211
|
+
nor a soft-account link proves mailbox ownership; reconcile may create a contact
|
|
212
|
+
for an existing authenticated principal without creating that principal.
|
|
213
|
+
|
|
214
|
+
Customer soft-account provisioning now creates unconfirmed auth users
|
|
215
|
+
(`email_confirm:false`). The soft-account linker retains create-first lookup,
|
|
216
|
+
normalized duplicate recovery and conditional linking. Checkout and paid-order
|
|
217
|
+
retry are adopter composition that must call the linker. Failed links retain
|
|
218
|
+
the provisioned identity for retry. Customer magic links keep
|
|
219
|
+
`shouldCreateUser:false`: captured mailbox proof confirms that existing user;
|
|
220
|
+
unknown addresses cannot sign themselves up through this path.
|
|
221
|
+
|
|
222
|
+
The managed link store requires an injected `emailTrustPolicy`, assessed before
|
|
223
|
+
creation or linking an existing identity by email. Unsafe or unavailable settings
|
|
224
|
+
return a non-fatal soft-account refusal (`EMAIL_TRUST_ENVELOPE_REFUSED` or
|
|
225
|
+
`EMAIL_TRUST_SETTINGS_UNAVAILABLE`) without creating an identity or link. Matching
|
|
226
|
+
existing links retain their replay behaviour. The reference adapter binds managed
|
|
227
|
+
settings assessment regardless of the selected bundle.
|
|
228
|
+
|
|
229
|
+
**Migration:** soft-account provisioning requires a trusted envelope: automatic
|
|
230
|
+
email confirmation disabled and every enabled non-email provider explicitly
|
|
231
|
+
declared email-verifying. Automatic signup can otherwise confirm an unconfirmed
|
|
232
|
+
user and issue a session to someone who merely knows the contact's address.
|
|
233
|
+
Pass the policy to `createSupabaseClientAuthLinkStore(client, emailTrustPolicy)`;
|
|
234
|
+
custom `ClientAuthLinkStore` implementations must expose `emailTrustPolicy`.
|
|
235
|
+
An adopter may explicitly bind `createVerifierResultOnlyEmailTrustPolicy()` when
|
|
236
|
+
its own trust boundary supplies the guarantee. Ensure the selected Auth installation can deliver and verify the
|
|
237
|
+
first-login link for an existing unconfirmed user. Run the documented joint local conformance
|
|
238
|
+
command after building core/platform. Existing identities, contact links,
|
|
239
|
+
subscription references and migration history are not rewritten.
|
|
240
|
+
|
|
241
|
+
Managed verification now requires the confirmation timestamp. Email-derived
|
|
242
|
+
reconcile requires an injected `emailTrustPolicy`. Managed hosts share
|
|
243
|
+
`createManagedEmailTrustPolicy` with `identityEmailTrustReadiness`; it reports
|
|
244
|
+
module `identity` using core's existing codes. Hosts retaining verifier-only
|
|
245
|
+
admission explicitly bind `createVerifierResultOnlyEmailTrustPolicy()`.
|
|
246
|
+
See the [identity policy and migration](../../docs/platform/IDENTITY.md#responsibility-and-composition)
|
|
247
|
+
for the empty provider allowlist, cache/deadline, 403/503 failures and the opt-in
|
|
248
|
+
`node tests/postgres/runIdentityEnvelopeConformance.mjs --phase email-trust` and
|
|
249
|
+
`node tests/postgres/runIdentityEnvelopeConformance.mjs --phase joint` prerequisites
|
|
250
|
+
and conformance scope. Both phases replay the committed managed chain, including
|
|
251
|
+
the identity capabilities forward, and prove association under the shipped managed
|
|
252
|
+
reference grants.
|
|
253
|
+
Construction and imports perform no settings read or SDK initialization.
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
The `./identity` server entry imports the existing identity engine, authorization,
|
|
257
|
+
profile readers, session adapters and BFF factories into one capability. Its
|
|
258
|
+
`./identity/contracts` entry is declared browser-safe and currently exposes the
|
|
259
|
+
customer auth port, value types and provider parser. Runtime-schema extraction
|
|
260
|
+
is pending the contracts-boundary choice described in the
|
|
261
|
+
[identity owner page](../../docs/platform/IDENTITY.md). Both entries remain an
|
|
262
|
+
unpublished development-preview import candidate.
|
|
263
|
+
|
|
264
|
+
Application composition supplies SDK clients/loaders, feature admission, redirect
|
|
265
|
+
policy, rate limiting, messages, sender and deployment URLs. Factories use the
|
|
266
|
+
foundation BFF envelope and accept the application's observed request-ID reader.
|
|
267
|
+
The module depends only on the declared foundation entries, without changing the
|
|
268
|
+
artifact's rail kind. Its schema contribution requires a host-selected inventory;
|
|
269
|
+
its seven SQL files are verbatim projections at canonical positions 11, 12, 29,
|
|
270
|
+
60, 67, 68 and 69, not an independent migration chain. The owner page maps the characterization
|
|
271
|
+
witnesses and records the remaining evidence.
|
|
272
|
+
|
|
273
|
+
Identity authorizes stored operator roles only when they are `admin` or
|
|
274
|
+
`distributor`; null and unknown values return `FORBIDDEN` (HTTP 403). The reference
|
|
275
|
+
admin-profile reader reports those rows as non-admin, and admin magic links do
|
|
276
|
+
not send for them while retaining the generic accepted response, padding and
|
|
277
|
+
quota. Adopters needing legacy role mapping must do it in their own adapter
|
|
278
|
+
before passing the role to the package; there is no package fallback option.
|
|
279
|
+
|
|
280
|
+
Both managed contact stores match normalized addresses case-insensitively,
|
|
281
|
+
including mixed-case stored contacts. Literal matching uses an anchored, escaped
|
|
282
|
+
`imatch` database prefilter plus an exact `email.trim().toLowerCase()` comparison
|
|
283
|
+
with the normalized input. Unicode regex folding alone cannot establish identity.
|
|
284
|
+
Both lookups select email and fetch at most ten candidates. Soft linking selects
|
|
285
|
+
the oldest accepted contact; reconciliation requires a single accepted contact
|
|
286
|
+
and throws the existing multiple-row error if several remain. A match beyond the
|
|
287
|
+
candidate bound is not selected. Injected structural query clients must implement
|
|
288
|
+
`filter(column, "imatch", value)` and the bounded array query. The direct customer
|
|
289
|
+
challenge already compares `lower(email)` to normalized input; no migration is
|
|
290
|
+
needed.
|
|
291
|
+
|
|
292
|
+
Magic-link factories default to the shared strict origin resolver. Pass
|
|
293
|
+
`redirectOrigins: ["https://example.com", "https://secondary.example.com:8443"]`;
|
|
294
|
+
the first configured origin builds the callback and every entry must be an exact
|
|
295
|
+
HTTP(S) origin, without credentials, a path, query or fragment (a root trailing
|
|
296
|
+
slash is accepted). Request headers never authorize an origin. Missing or invalid
|
|
297
|
+
configuration returns BFF `UPSTREAM_UNAVAILABLE` (503), with details reason
|
|
298
|
+
`magic_link_origin_not_configured`, before provider access. Customer `returnTo`
|
|
299
|
+
is normalized to a same-origin relative path; unsafe targets are omitted for the
|
|
300
|
+
callback's default landing page. An adopter needing its existing policy can keep
|
|
301
|
+
passing `resolveOrigin`; that explicit injection overrides the default. See the
|
|
302
|
+
[identity redirect contract](../../docs/platform/IDENTITY.md#magic-link-redirect-policy)
|
|
303
|
+
for reference configuration and migration.
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
### Operator invitations
|
|
307
|
+
|
|
308
|
+
`identity/contracts` exposes distinct direct pending-invitation and managed
|
|
309
|
+
active-membership results. Matching runtime schemas remain in the server entry.
|
|
310
|
+
The admin-action port returns `OperatorInviteResult`, a union of those results.
|
|
311
|
+
|
|
312
|
+
`createDirectOperatorInvitationStore` provides the new pending, active, expired and
|
|
313
|
+
revoked lifecycle in its trusted PostgreSQL transaction lane, including ordered
|
|
314
|
+
membership locks and atomic membership/audit writes. Direct callers inject the
|
|
315
|
+
store and a parsed TTL. `createDirectOperatorIdentityDirectory` commits principal
|
|
316
|
+
creation/reuse separately. Apply the complete direct catalogue through position
|
|
317
|
+
67; the byte-identical package projection is for inspection and composition, not
|
|
318
|
+
a standalone fresh chain. Direct human acceptance is a trusted command,
|
|
319
|
+
unmounted from machine authentication.
|
|
320
|
+
|
|
321
|
+
Managed hosts use `createInviteAdminUserGateway().activateMembership` in
|
|
322
|
+
`runInviteAdminUserUseCase`. Insertion immediately creates active `admin_users`
|
|
323
|
+
membership with invitation provenance; it omits `is_machine_actor` and relies on
|
|
324
|
+
the database default false. The result carries principal ID, role, active state
|
|
325
|
+
and `MEMBERSHIP_CREATED` or `ALREADY_ACTIVE`, without pending timestamps or an
|
|
326
|
+
invitation ID. Identical repeats and concurrent insert losers return the existing
|
|
327
|
+
membership without a second notification. Role differences conflict; revoked
|
|
328
|
+
members refuse with `MANAGED_REINVITE_UNSUPPORTED`. Failures retain identities
|
|
329
|
+
for retry, including after notification failure. No Auth metadata store,
|
|
330
|
+
first-entry acceptance, expiry or compensation is used. Magic-link eligibility
|
|
331
|
+
requires active membership and a known role. Authorization, removal and admin
|
|
332
|
+
`me` retain their actor bindings without a service key for lifecycle state.
|
|
333
|
+
|
|
334
|
+
**Migration:** direct hosts can adopt the new pending lifecycle by applying
|
|
335
|
+
`20261018120000_identity_operator_invitations` after the existing direct catalogue
|
|
336
|
+
and composing the store, trusted human acceptance and parsed TTL. Existing
|
|
337
|
+
memberships are preserved. Managed immediate activation is retained; managed
|
|
338
|
+
consumers must now parse the structured active result and its
|
|
339
|
+
`MEMBERSHIP_CREATED`/`ALREADY_ACTIVE` codes instead of message-only success.
|
|
340
|
+
Duplicates return existing membership rather than `ALREADY_ADDED`, and
|
|
341
|
+
notification failure returns 503 `INVITATION_NOTIFICATION_FAILED` while keeping
|
|
342
|
+
membership active. Managed pending/expiry remains a compatibility gap requiring
|
|
343
|
+
a separate transactional store and reviewed forward. No managed SQL, RPC or SDK
|
|
344
|
+
dependency is added. See the
|
|
345
|
+
[identity lifecycle owner](../../docs/platform/IDENTITY.md#operator-invitation-lifecycle).
|
|
346
|
+
|
|
347
|
+
The managed chain's identity capabilities forward
|
|
348
|
+
`20261018160000_identity_service_role_capabilities.sql` grants `service_role`
|
|
349
|
+
SELECT(email) and INSERT(id, email, role, membership_state, membership_provenance,
|
|
350
|
+
membership_accepted_at) on `admin_users`.
|
|
351
|
+
The opt-in managed conformance replays the complete committed chain with ambient
|
|
352
|
+
default ACLs removed and adds no grant. It proves immediate activation,
|
|
353
|
+
repeat/concurrent recovery and revoked-member refusal under the shipped grants.
|
|
354
|
+
It does not establish managed/direct lifecycle parity.
|
|
355
|
+
|
|
356
|
+
With a fresh local managed stack running, export its API URL, service key and
|
|
357
|
+
PostgreSQL owner (`supabase_admin`) connection URL as `OPENLUP_MANAGED_CONFORMANCE_URL`,
|
|
358
|
+
`OPENLUP_MANAGED_CONFORMANCE_SERVICE_KEY` and
|
|
359
|
+
`OPENLUP_MANAGED_CONFORMANCE_DATABASE_URL`, then run from the repository root:
|
|
360
|
+
|
|
361
|
+
```sh
|
|
362
|
+
npm --workspace @openlup/platform run build
|
|
363
|
+
node --import tsx tests/postgres/operatorInvitationManaged.conformance.ts
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
The module refuses non-loopback endpoints, an already-installed public schema,
|
|
367
|
+
and existing synthetic fixture identities. It retains synthetic identities;
|
|
368
|
+
discard the disposable stack after the run. Its database owner connection must
|
|
369
|
+
be able to replay the committed prerequisites, baseline and ordered forwards.
|
|
370
|
+
|
|
371
|
+
## Personal data
|
|
372
|
+
|
|
373
|
+
The experimental identity entry exposes `createPersonalDataContributorRegistry`,
|
|
374
|
+
`createIdentityPersonalDataContributor`, `createPrivacyOperations`,
|
|
375
|
+
`exportPersonalData`, `erasePersonalData`, `createPrivacyExportHandler` and
|
|
376
|
+
`createPrivacyEraseHandler`. Browser requests, versioned contributor documents and
|
|
377
|
+
receipts come from `@openlup/platform/identity/contracts`. Register every required
|
|
378
|
+
contributor explicitly, with its owned fields, assessment, erase/retain operation
|
|
379
|
+
and remote/retention obligations. Missing required owners refuse erasure; export
|
|
380
|
+
reports missing coverage. This capability erases identity-owned data only.
|
|
381
|
+
|
|
382
|
+
Direct hosts compose `createPostgresPrivacyUnitOfWork` and
|
|
383
|
+
`createPostgresPrivacyStore` with the identity contributor and their domain vetoes
|
|
384
|
+
using the same executor. The reference subscriptions contributor holds a relation
|
|
385
|
+
lock through commit, refusing active and paused subscriptions without changing
|
|
386
|
+
them. `IdentityPrivacyPolicy.retainedContactFields` names explicit retention
|
|
387
|
+
owners for populated opaque columns; unknown ownership refuses. The reference
|
|
388
|
+
retains lifecycle/acquisition fields, and refuses nonempty metadata or external
|
|
389
|
+
references until an owner declares their disposition.
|
|
390
|
+
|
|
391
|
+
Migration: apply the complete direct catalogue including
|
|
392
|
+
`20261018190000_identity_privacy_erasures` before using privacy or the updated
|
|
393
|
+
customer challenge store. The forward appends one receipt table at position 69
|
|
394
|
+
without grants or stored functions. Direct erasure pseudonymizes identity-owned
|
|
395
|
+
fields, deletes challenges and outstanding invitations, uses guarded membership
|
|
396
|
+
revocation, clears only the selected contact's direct principal link, and commits
|
|
397
|
+
an idempotent audit receipt atomically. Contact IDs and managed auth links never
|
|
398
|
+
change. Failed writes roll back. Retained audit references are pseudonymous, not
|
|
399
|
+
an assertion of anonymization. Already-issued tokens may remain valid until expiry.
|
|
400
|
+
Customer challenge issuance and redemption reject a receipt for either the
|
|
401
|
+
contact or principal under the same transaction-held challenge relation lock as
|
|
402
|
+
erasure, including late challenges inserted after cleanup. Hosts must use the
|
|
403
|
+
package adapters; calling the retained raw challenge SQL functions directly
|
|
404
|
+
bypasses this erasure receipt fence.
|
|
405
|
+
|
|
406
|
+
Managed hosts compose `createManagedPrivacyStore` with their structural service
|
|
407
|
+
client for export. Coverage explicitly excludes inaccessible country and
|
|
408
|
+
identity history/receipt fields. Managed erasure refuses with
|
|
409
|
+
`MANAGED_PRIVACY_ERASURE_UNAVAILABLE`: a managed adopter must provide its own
|
|
410
|
+
erasure path. The committed grants and structural client cannot provide the
|
|
411
|
+
required mutations and atomic receipt. This change adds no managed forward or
|
|
412
|
+
erasure grants. Provider identity is never deleted; any future composed provider
|
|
413
|
+
erasure must disable it after committed local success. The managed refusal here
|
|
414
|
+
occurs before reaching any provider mutation.
|
|
415
|
+
|
|
416
|
+
The reference mounts authenticated human-admin export/erase POSTs and an Admin
|
|
417
|
+
Settings readback panel. Direct and managed mounts require the adopter deployment
|
|
418
|
+
policy under admin mutation risk; the public default returns
|
|
419
|
+
`adopter_policy_required` before body/query reads, and direct mounts also refuse
|
|
420
|
+
before authentication or privacy binding construction. The shipped dispatcher mounts
|
|
421
|
+
both routes for managed bundles even when its caller supplies no routes. After admission,
|
|
422
|
+
exports and receipts stay in memory with no-store
|
|
423
|
+
responses. The maintenance `prune-challenges` command prunes separate bounded
|
|
424
|
+
operator/customer batches. See [identity privacy](../../docs/platform/IDENTITY.md#identity-personal-data)
|
|
425
|
+
for refusals, token limits and retained obligations.
|
|
426
|
+
|
|
427
|
+
The complete direct conformance is included in
|
|
428
|
+
`ai-resource-gate run --wait openlup:coverage -- npx vitest run tests/postgres/operatorIdentityUpgrade.test.ts`.
|
|
429
|
+
For managed conformance, supply the same three `OPENLUP_MANAGED_CONFORMANCE_*`
|
|
430
|
+
local disposable-stack settings described for operator invitations, with
|
|
431
|
+
`OPENLUP_MANAGED_CONFORMANCE_DATABASE_URL` set to the database owner
|
|
432
|
+
(`supabase_admin`) connection, then run
|
|
433
|
+
`node --experimental-strip-types tests/postgres/identityPrivacyManaged.conformance.ts`.
|
|
434
|
+
Use a fresh public schema and reset the disposable stack between proofs; the
|
|
435
|
+
managed privacy proof replays the committed chain without fixture erasure grants.
|
|
436
|
+
Replay through node-postgres omits only the psql-only pg_dump `\restrict` and
|
|
437
|
+
`\unrestrict` guard lines; all migration SQL remains unchanged.
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
Reference startup can compose identity through `createReferenceIdentity` and
|
|
441
|
+
`startPublicReferenceServer({ identity })`, with explicit route functions,
|
|
442
|
+
selected adapters, trusted schema/migration observation and the bundle-specific
|
|
443
|
+
inventory. It consumes email-trust readiness before listening, and rejects
|
|
444
|
+
unknown or unsatisfied candidates. Direct reconcile reads the existing actor
|
|
445
|
+
link; direct invite/remove select the pending-invitation stores. The default
|
|
446
|
+
static reference and browser page sets remain unchanged. See the
|
|
447
|
+
[composition contract](../../docs/platform/IDENTITY.md#responsibility-and-composition).
|
|
448
|
+
|
|
449
|
+
Both identity entries already belong to the public export map and build output;
|
|
450
|
+
artifact availability does not imply registry publication or release activation.
|
|
451
|
+
The cold installed-artifact consumer imports both entries without optional peers,
|
|
452
|
+
compiles contracts without driver types, and invokes every driver-owning direct
|
|
453
|
+
identity adapter for its missing-peer refusal. Managed factories consume
|
|
454
|
+
structural clients. Server declarations compile after peer selection. Full
|
|
455
|
+
installed-artifact and database proof require the existing supervisor-run package
|
|
456
|
+
consumer command and an owned disposable database.
|
|
457
|
+
|
|
458
|
+
The managed identity service-role capabilities forward in the committed chain
|
|
459
|
+
supplies client link writes and operator membership insert/email-read
|
|
460
|
+
permissions; the local conformance runners add no fixture grant. No migration is
|
|
461
|
+
added by reference composition.
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
## Disposable identity composition
|
|
465
|
+
|
|
466
|
+
The reference application's opt-in identity shell consumes the existing
|
|
467
|
+
`./identity` and `./identity/contracts` exports without changing their maturity
|
|
468
|
+
or publishing a registry version. It reuses the customer/operator pages and
|
|
469
|
+
captured-delivery port, with a private local mailbox and administrator privacy
|
|
470
|
+
panel. Its explicit runtime must supply actual routes and readiness admission;
|
|
471
|
+
the shell refuses a missing composition. See the
|
|
472
|
+
[identity reference guide](../../docs/platform/IDENTITY.md#disposable-identity-reference)
|
|
473
|
+
for both-bundle commands, the committed managed grants and installation limits.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HttpRequest, HttpResponse } from "../http/index.js";
|
|
2
|
+
export type RouteEntry = {
|
|
3
|
+
route: string;
|
|
4
|
+
pattern: RegExp;
|
|
5
|
+
params: string[];
|
|
6
|
+
handler: (req: HttpRequest, res: HttpResponse) => unknown;
|
|
7
|
+
/** Fail unsupported hosted bundles closed before auth without weakening direct-route auth. */
|
|
8
|
+
availability?: "direct-postgres";
|
|
9
|
+
};
|
|
10
|
+
/** Match `routes` against one request and run the handler, or answer not found. */
|
|
11
|
+
export type BffDispatch = (routes: readonly RouteEntry[], req: HttpRequest, res: HttpResponse) => Promise<unknown>;
|
|
12
|
+
export interface BffDispatcherOptions {
|
|
13
|
+
/** Environment read on each request to decide a route's bundle availability. */
|
|
14
|
+
env: () => Record<string, string | undefined>;
|
|
15
|
+
/** Writes the deployment's not-found response for an unmatched or unavailable path. */
|
|
16
|
+
notFound: (res: HttpResponse, pathname: string) => void;
|
|
17
|
+
/** Runs once per request before matching (for example, ambient request configuration). */
|
|
18
|
+
beforeDispatch?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Runs after matching and before the handler, for example route authorization; resolving false
|
|
21
|
+
* means it already answered. Required, so no composition skips it by omission; a deployment
|
|
22
|
+
* without guarded routes passes `() => true`.
|
|
23
|
+
*/
|
|
24
|
+
preflight: (req: HttpRequest, res: HttpResponse, route: string) => Promise<boolean> | boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Build the dispatcher a deployment mounts on its hosted and Node entrypoints alike. */
|
|
27
|
+
export declare function createBffDispatcher(options: BffDispatcherOptions): BffDispatch;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// BFF dispatch mechanism.
|
|
2
|
+
//
|
|
3
|
+
// The route table and its handlers belong to the deployment. This module owns the
|
|
4
|
+
// platform-neutral matching loop, so every HttpRuntimePort adapter (a hosted function or the Node
|
|
5
|
+
// runtime of this package) mounts the same route table without duplicating dispatch logic.
|
|
6
|
+
//
|
|
7
|
+
// Per request, in order: the deployment's `beforeDispatch` hook, path normalization, the first
|
|
8
|
+
// matching route, its availability, its decoded path parameters, the deployment's `preflight`
|
|
9
|
+
// hook, then the handler. An unmatched or unavailable path goes to the deployment's `notFound`.
|
|
10
|
+
import { getBundleDescriptor, resolveBundleId } from "../kernel/index.js";
|
|
11
|
+
// Only the pathname is read, and it does not depend on the URL base; this host only completes a
|
|
12
|
+
// request that carries no Host header.
|
|
13
|
+
const FALLBACK_HOST = "bff.invalid";
|
|
14
|
+
function requestPath(req) {
|
|
15
|
+
const rawUrl = typeof req.url === "string" ? req.url : "/";
|
|
16
|
+
const host = typeof req.headers?.host === "string" ? req.headers.host : FALLBACK_HOST;
|
|
17
|
+
return new URL(rawUrl, "https://" + host).pathname.replace(/\/+$/, "") || "/";
|
|
18
|
+
}
|
|
19
|
+
/** Build the dispatcher a deployment mounts on its hosted and Node entrypoints alike. */
|
|
20
|
+
export function createBffDispatcher(options) {
|
|
21
|
+
return async function dispatch(routes, req, res) {
|
|
22
|
+
options.beforeDispatch?.();
|
|
23
|
+
const pathname = requestPath(req);
|
|
24
|
+
for (const entry of routes) {
|
|
25
|
+
const match = entry.pattern.exec(pathname);
|
|
26
|
+
if (!match)
|
|
27
|
+
continue;
|
|
28
|
+
if (entry.availability === "direct-postgres"
|
|
29
|
+
&& getBundleDescriptor(resolveBundleId(options.env())).capabilities.data !== "postgres") {
|
|
30
|
+
options.notFound(res, pathname);
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
if (entry.params.length > 0) {
|
|
34
|
+
const query = { ...(req.query ?? {}) };
|
|
35
|
+
entry.params.forEach((param, index) => {
|
|
36
|
+
query[param] = decodeURIComponent(match[index + 1] ?? "");
|
|
37
|
+
});
|
|
38
|
+
req.query = query;
|
|
39
|
+
}
|
|
40
|
+
if (!(await options.preflight(req, res, entry.route)))
|
|
41
|
+
return undefined;
|
|
42
|
+
return entry.handler(req, res);
|
|
43
|
+
}
|
|
44
|
+
options.notFound(res, pathname);
|
|
45
|
+
return undefined;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { HttpResponse } from "../http/index.js";
|
|
2
|
+
export declare const BFF_REQUEST_REFERENCE_HEADER = "x-request-id";
|
|
3
|
+
export declare const BFF_ERROR_CODES: readonly ["BAD_REQUEST", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "METHOD_NOT_ALLOWED", "CONFLICT", "RATE_LIMITED", "UPSTREAM_UNAVAILABLE", "INTERNAL", "INVALID_RESPONSE"];
|
|
4
|
+
export type BffErrorCode = (typeof BFF_ERROR_CODES)[number];
|
|
5
|
+
export type BffMeta = {
|
|
6
|
+
requestId?: string;
|
|
7
|
+
contractVersion?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
export type BffError = {
|
|
11
|
+
code: BffErrorCode;
|
|
12
|
+
message: string;
|
|
13
|
+
details?: unknown;
|
|
14
|
+
};
|
|
15
|
+
export type BffSuccessResponse<T> = {
|
|
16
|
+
ok: true;
|
|
17
|
+
data: T;
|
|
18
|
+
meta?: BffMeta;
|
|
19
|
+
};
|
|
20
|
+
export type BffErrorResponse = {
|
|
21
|
+
ok: false;
|
|
22
|
+
error: BffError;
|
|
23
|
+
meta?: BffMeta;
|
|
24
|
+
};
|
|
25
|
+
export type BffResponse<T> = BffSuccessResponse<T> | BffErrorResponse;
|
|
26
|
+
/** The HTTP status each error code answers with unless the caller names another. */
|
|
27
|
+
export declare const BFF_ERROR_STATUS: Readonly<Record<BffErrorCode, number>>;
|
|
28
|
+
export interface BffErrorOptions {
|
|
29
|
+
status?: number;
|
|
30
|
+
details?: unknown;
|
|
31
|
+
meta?: BffMeta;
|
|
32
|
+
}
|
|
33
|
+
export interface BffSuccessOptions {
|
|
34
|
+
cacheControl?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface BffResponderOptions {
|
|
37
|
+
/** The request reference observed for this response, if the deployment records one. */
|
|
38
|
+
responseRequestId?: (res: HttpResponse) => string | undefined;
|
|
39
|
+
}
|
|
40
|
+
export interface BffResponder {
|
|
41
|
+
sendBffSuccess<T>(res: HttpResponse, data: T, meta?: BffMeta, options?: BffSuccessOptions): void;
|
|
42
|
+
sendBffError(res: HttpResponse, code: BffErrorCode, message: string, options?: BffErrorOptions): void;
|
|
43
|
+
sendMethodNotAllowed(res: HttpResponse, allowedMethods: readonly string[]): void;
|
|
44
|
+
}
|
|
45
|
+
/** Build the envelope writers a deployment's handlers share. */
|
|
46
|
+
export declare function createBffResponder(options?: BffResponderOptions): BffResponder;
|