feat(document-workbench): wire customer upload, structuring, credits and readiness
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
masterplan-lock / check (push) Successful in 10s
CI (SIAX Cloud) / sonar (pull_request) Skipped
Security Scan (SIAX Cloud) / security (push) Successful in 13s
masterplan-lock / check (pull_request) Successful in 7s
CI (SIAX Cloud) / security (push) Successful in 26s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 17s
CI (SIAX Cloud) / security (pull_request) Successful in 19s
CI (SIAX Cloud) / quality (push) Successful in 1m9s
CI (SIAX Cloud) / quality (pull_request) Successful in 2m26s
CI (SIAX Cloud) / integration (pull_request) Successful in 2m33s

- POST /api/0pt/documents/upload: real multipart bytes into DOC0 through the
  durable attempt journal and the existing coordinator; verified tenant/actor
  only, project authorization fail-closed.
- POST /api/0pt/documents/structure: DOC0 segments -> INF0 -> evidence-bound
  validation -> optional JSON/CSV export, with credit reserve/settle.
- Credits: balance, server-owned price book, Stripe Checkout and idempotent
  webhook reconciliation via a Stripe re-read of session + payment intent.
- /portal/dokument and /portal/krediter: SIAX-styled workspace.
- @siax/access: universal, framework-neutral OpenFGA project relationship
  primitive reusable by DOC0/N0D/other products.
- Readiness: real Redis PING probe instead of presence-only; queue is now a
  live dependency when configured.
- Dockerfile: copy every workspace manifest so --frozen-lockfile works.
- Format/build hygiene: .prettierignore, .worktrees ignored, valid manifest YAML.
This commit is contained in:
2026-11-02 14:46:10 +01:00
parent ac1ac73be8
commit b3239487b7
37 changed files with 3152 additions and 59 deletions
+35
View File
@@ -0,0 +1,35 @@
/**
* 0pt project authorization for the document workbench.
*
* Reuses the universal `@siax/access` OpenFGA relationship primitive (the same
* one DOC0 proved) instead of a per-repo copy. FAIL CLOSED: when OpenFGA is not
* configured, or the relationship source is unavailable, the answer is "no".
*/
import { OpenFgaRelationships, isProjectAccessAllowed } from '@siax/access';
import { readDocumentWorkbenchRuntime } from './runtime-config';
export interface ProjectScope {
tenantId: string;
projectId: string;
actorId: string;
}
export type ProjectAuthorizer = (scope: ProjectScope) => Promise<boolean>;
export function createProjectAuthorizer(env: NodeJS.ProcessEnv = process.env): ProjectAuthorizer {
const runtime = readDocumentWorkbenchRuntime(env);
let relationships: OpenFgaRelationships | undefined;
if (runtime.openfga) {
try {
relationships = new OpenFgaRelationships(runtime.openfga);
} catch {
relationships = undefined;
}
}
return async (scope) => isProjectAccessAllowed(scope, { relationships });
}
/** True when the server has enough configuration to authorize at all. */
export function projectAuthorizationConfigured(env: NodeJS.ProcessEnv = process.env): boolean {
return Boolean(readDocumentWorkbenchRuntime(env).openfga);
}