CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (pull_request) Successful in 7s
masterplan-lock / check (push) Successful in 8s
CI (SIAX Cloud) / security (push) Successful in 15s
Security Scan (SIAX Cloud) / security (push) Successful in 18s
CI (SIAX Cloud) / security (pull_request) Successful in 20s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 19s
CI (SIAX Cloud) / quality (push) Failing after 1m31s
CI (SIAX Cloud) / quality (pull_request) Failing after 1m33s
CI (SIAX Cloud) / integration (pull_request) Successful in 1m34s
GET /api/orders returnerar per order frozen advance_action (resolveAction ur lib/order-flow); admin renderar via ActionGate — policy i serverlagret, presentation i klienten (DoD §21). Terminala/okända statusar → read_only med varför-text i stället för missvisande 'klar'. tests/order-flow.test.ts 3/3; full svit 1138 godkända; typecheck grön.
24 lines
995 B
TypeScript
24 lines
995 B
TypeScript
import { resolveAction, type ResolvedAction } from "@siax/contracts/authz-ux";
|
|
|
|
/** Kanonisk orderflöde — servern äger resolutionen (ADR-0001), UI renderar. */
|
|
export const NEXT_STATUS: Record<string, string> = {
|
|
draft: "quoted",
|
|
quoted: "in_production",
|
|
in_production: "review",
|
|
review: "accepted",
|
|
accepted: "delivered",
|
|
};
|
|
|
|
/**
|
|
* Server-renderad action-resolution för advance-steget (ADR-0001):
|
|
* ägarskapenforces redan av requireOrderOwner på GET/PATCH; tillståndet
|
|
* avgör read_only. Innan Session/roller finns i 0pt är permission alltid
|
|
* granted för autentiserade ägare — hårdkoda aldrig denna resolve i klienten.
|
|
*/
|
|
export function resolveAdvanceAction(status: string): ResolvedAction {
|
|
if (NEXT_STATUS[status]) {
|
|
return resolveAction({ permission: "granted", entitlement: "active", approval: "not_required", readOnly: false });
|
|
}
|
|
return resolveAction({ permission: "granted", entitlement: "active", approval: "not_required", readOnly: true });
|
|
}
|