@teamscala/service-boot 0.23.284
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/package.json +1016 -0
- package/src/agreement-gate.test.ts +118 -0
- package/src/agreement-gate.ts +887 -0
- package/src/asset-cache-key.ts +59 -0
- package/src/asset-optimize.ts +93 -0
- package/src/asset-proxy.ts +148 -0
- package/src/asset-social-card.ts +58 -0
- package/src/attach-agreement-magic.ts +62 -0
- package/src/attach-portal-members.ts +107 -0
- package/src/attach-proposal-accept.ts +123 -0
- package/src/attach-proposal-magic.ts +55 -0
- package/src/attach-transfers-upload.ts +100 -0
- package/src/auth-gate.ts +385 -0
- package/src/bind-page-handler.ts +223 -0
- package/src/build-client-assets/input-hashing.ts +206 -0
- package/src/build-client-assets/source-candidates.ts +115 -0
- package/src/build-client-assets.test.ts +216 -0
- package/src/build-client-assets.ts +962 -0
- package/src/compose-page-title.test.ts +88 -0
- package/src/compose-page-title.ts +73 -0
- package/src/content-gate/access.ts +89 -0
- package/src/content-gate/config-types.ts +108 -0
- package/src/content-gate/gate.ts +74 -0
- package/src/content-gate/parse-cookie.ts +23 -0
- package/src/content-gate/token.test.ts +70 -0
- package/src/content-gate/token.ts +148 -0
- package/src/content-page-floor.test.ts +127 -0
- package/src/content-page-floor.ts +70 -0
- package/src/discover-blocks.ts +228 -0
- package/src/expand-roster.ts +197 -0
- package/src/fn-routers/agreement-completion-email.ts +115 -0
- package/src/fn-routers/agreement-send-router.ts +303 -0
- package/src/fn-routers/ai-health-router.ts +64 -0
- package/src/fn-routers/auth-router.ts +131 -0
- package/src/fn-routers/cache-admin-router.ts +50 -0
- package/src/fn-routers/chat-session-router.ts +455 -0
- package/src/fn-routers/email-defaults.ts +22 -0
- package/src/fn-routers/email-link-ttl.ts +23 -0
- package/src/fn-routers/index.ts +70 -0
- package/src/fn-routers/panel-data-router.ts +93 -0
- package/src/fn-routers/persist-chat-messages.test.ts +86 -0
- package/src/fn-routers/persist-chat-messages.ts +96 -0
- package/src/fn-routers/plans-router.ts +141 -0
- package/src/fn-routers/proposal-send-router.ts +207 -0
- package/src/fn-routers/public-agreement-router.ts +865 -0
- package/src/fn-routers/public-assessment-router.ts +421 -0
- package/src/fn-routers/public-gpt-session-router.ts +373 -0
- package/src/fn-routers/sign-in-flow-router.ts +196 -0
- package/src/fn-routers/task-sync-bind.test.ts +105 -0
- package/src/fn-routers/task-sync-classify.test.ts +109 -0
- package/src/fn-routers/task-sync-dispatch.test.ts +44 -0
- package/src/fn-routers/task-sync-dispatch.ts +124 -0
- package/src/fn-routers/task-sync-router.test.ts +279 -0
- package/src/fn-routers/task-sync-router.ts +1036 -0
- package/src/fn-routers/tasks-router.ts +77 -0
- package/src/fn-routers/user-preferences-router.ts +139 -0
- package/src/fn-routers/work-items-router.ts +341 -0
- package/src/gate-ttls.ts +56 -0
- package/src/gpt-gate.ts +76 -0
- package/src/handlers/bun-stable-watch.ts +89 -0
- package/src/handlers/projects-digest.ts +198 -0
- package/src/handlers/prune-stale-data.ts +110 -0
- package/src/handlers/registry-stale-inactive-sweep.ts +82 -0
- package/src/handlers/scala-tools-currency-watch.test.ts +60 -0
- package/src/handlers/scala-tools-currency-watch.ts +171 -0
- package/src/handlers/scheduled-browser-tests.ts +85 -0
- package/src/handlers/sweep-event-log.ts +98 -0
- package/src/handlers/sweep-host-cache.ts +211 -0
- package/src/handlers/upstream-issue-sync.ts +210 -0
- package/src/handlers/whatsapp-liveness-handler.test.ts +59 -0
- package/src/handlers/whatsapp-liveness-logic.ts +53 -0
- package/src/handlers/whatsapp-liveness.test.ts +78 -0
- package/src/handlers/whatsapp-liveness.ts +125 -0
- package/src/hono-error-handler.ts +55 -0
- package/src/install-harness.ts +80 -0
- package/src/install-logging.ts +182 -0
- package/src/load-service-install-row.ts +98 -0
- package/src/load-service-prisma-client.ts +53 -0
- package/src/mount-orpc-router.ts +148 -0
- package/src/mount-server-packages.ts +155 -0
- package/src/mount.ts +18 -0
- package/src/mutable-app-ref.ts +68 -0
- package/src/page-route-shell-types.ts +16 -0
- package/src/page-server-orpc/audit-revert-router.ts +102 -0
- package/src/page-server-orpc/hub-mcp-client.ts +20 -0
- package/src/page-server-orpc/portal-diagnostics-router.ts +170 -0
- package/src/page-server-orpc/puck-pages-router.ts +272 -0
- package/src/page-server-orpc/server-client.ts +31 -0
- package/src/page-server-orpc/templates-router.ts +116 -0
- package/src/page-server-orpc/user-preferences-router.ts +132 -0
- package/src/pg-boss-handler-registry.ts +36 -0
- package/src/pg-boss-mount.ts +295 -0
- package/src/proposal-authorized-emails.ts +65 -0
- package/src/proposal-chat-inject.ts +141 -0
- package/src/proposal-gate.ts +175 -0
- package/src/read-html-template.test.ts +74 -0
- package/src/read-html-template.ts +102 -0
- package/src/read-viewport-from-request.ts +36 -0
- package/src/readiness-gate.ts +39 -0
- package/src/register-api-routes.ts +127 -0
- package/src/register-crash-handlers.ts +39 -0
- package/src/register-page-routes.ts +62 -0
- package/src/register-page-server-client.ts +109 -0
- package/src/register-registry-page-route/ai-chat-prefetch.ts +106 -0
- package/src/register-registry-page-route/graph-cache.test.ts +84 -0
- package/src/register-registry-page-route/graph-cache.ts +90 -0
- package/src/register-registry-page-route/meta-title.ts +73 -0
- package/src/register-registry-page-route/proposal-approval-email-token.ts +78 -0
- package/src/register-registry-page-route/proposal-brand-stamping.ts +60 -0
- package/src/register-registry-page-route/resolve-page-data.ts +518 -0
- package/src/register-registry-page-route.ts +765 -0
- package/src/register-static-assets.ts +180 -0
- package/src/register-ws-routes.ts +180 -0
- package/src/resolve-app-base-url.ts +28 -0
- package/src/resolve-brand-favicon.ts +65 -0
- package/src/resolve-from-loader-config.test.ts +44 -0
- package/src/resolve-from-loader-config.ts +291 -0
- package/src/resolve-service-context.ts +67 -0
- package/src/resolve-theme-mode.ts +61 -0
- package/src/resolvers/fetch-org-brand.ts +28 -0
- package/src/resolvers/portal-route-paths.test.ts +102 -0
- package/src/resolvers/portal-route-paths.ts +83 -0
- package/src/resolvers/website-by-host-map.ts +49 -0
- package/src/resource-chat-inject.ts +168 -0
- package/src/resource-not-found.ts +263 -0
- package/src/run-boot-hook-list.ts +75 -0
- package/src/run-boot-hooks.ts +97 -0
- package/src/scala-tools-currency-watchdog.ts +160 -0
- package/src/security-headers.ts +59 -0
- package/src/serve/serve-ws.test.ts +135 -0
- package/src/serve/serve.ts +190 -0
- package/src/server-error-page.test.ts +102 -0
- package/src/server-error-page.ts +95 -0
- package/src/start-scheduled-jobs.ts +84 -0
- package/src/two-phase-boot.ts +449 -0
- package/src/types.ts +52 -0
- package/src/ui-service.ts +171 -0
- package/src/ws-boot-self-test.ts +114 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @system service-boot
|
|
3
|
+
* @status handwritten
|
|
4
|
+
* @edit edit directly
|
|
5
|
+
*
|
|
6
|
+
* Regression test for the new-flow agreement gate's body-region targeting.
|
|
7
|
+
* The body region of the public sign shell IS resolved.page (composed by
|
|
8
|
+
* register-registry-page-route.ts Branch 2 as extractPuckData(resolved.page)).
|
|
9
|
+
* A prior version of getBodyContentArray scored every region by top-level
|
|
10
|
+
* non-shell block count and picked the highest — which misruted to /header when
|
|
11
|
+
* the body wrapped its clauses inside a Container (body top-level count ~1-2
|
|
12
|
+
* vs nested clause count ~40). onUnauthorized then cleared the HEADER and
|
|
13
|
+
* injected the gate there, leaving the entire agreement body visible past the
|
|
14
|
+
* gate. This test pins the fix: the body is withheld, the header is untouched.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { describe, expect, test } from "bun:test";
|
|
18
|
+
import { agreementGateConfig } from "./agreement-gate.ts";
|
|
19
|
+
|
|
20
|
+
const AGREEMENT_UUID = "019ecae8-518d-7000-8786-7255ca8716eb";
|
|
21
|
+
|
|
22
|
+
/** A resolved graph shaped like the real sign shell at the failing case:
|
|
23
|
+
* body wraps its clauses in a Container (low top-level score), header has more
|
|
24
|
+
* top-level blocks (would out-score the body under the old heuristic). */
|
|
25
|
+
function makeResolved(): Record<string, unknown> {
|
|
26
|
+
return {
|
|
27
|
+
page: {
|
|
28
|
+
id: "page-1",
|
|
29
|
+
meta_title: "Demo Agreement",
|
|
30
|
+
name: "Demo Agreement",
|
|
31
|
+
puck_data: {
|
|
32
|
+
root: { props: {} },
|
|
33
|
+
zones: {},
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: "Container",
|
|
37
|
+
props: {
|
|
38
|
+
id: "body-container",
|
|
39
|
+
content: [
|
|
40
|
+
{ type: "Text", props: { id: "t1", text: "1. Parties" } },
|
|
41
|
+
{ type: "Text", props: { id: "t2", text: "16. Electronic Signature" } },
|
|
42
|
+
{ type: "Text", props: { id: "t3", text: "Scope of Services & Fees" } },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
header: {
|
|
50
|
+
id: "header-page",
|
|
51
|
+
puck_data: {
|
|
52
|
+
root: { props: {} },
|
|
53
|
+
zones: {},
|
|
54
|
+
// 4 top-level blocks — MORE than the body's single Container. The
|
|
55
|
+
// old scorer picked this region as the "body" and cleared it.
|
|
56
|
+
content: [
|
|
57
|
+
{ type: "OrgLogo", props: { id: "logo" } },
|
|
58
|
+
{ type: "Text", props: { id: "h1", text: "Brand" } },
|
|
59
|
+
{ type: "Text", props: { id: "h2", text: "Nav A" } },
|
|
60
|
+
{ type: "Text", props: { id: "h3", text: "Nav B" } },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
footer: {
|
|
65
|
+
id: "footer-page",
|
|
66
|
+
puck_data: {
|
|
67
|
+
root: { props: {} },
|
|
68
|
+
zones: {},
|
|
69
|
+
content: [{ type: "Text", props: { id: "f1", text: "© 2026" } }],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
describe("agreement-gate — body-region targeting", () => {
|
|
76
|
+
test("onUnauthorized withholds the BODY (resolved.page), not the header", async () => {
|
|
77
|
+
const resolved = makeResolved();
|
|
78
|
+
const bodyContent = (
|
|
79
|
+
(resolved.page as { puck_data: { content: unknown[] } }).puck_data
|
|
80
|
+
.content
|
|
81
|
+
);
|
|
82
|
+
const headerContent = (
|
|
83
|
+
(resolved.header as { puck_data: { content: unknown[] } }).puck_data
|
|
84
|
+
.content
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
await agreementGateConfig.onUnauthorized(resolved, AGREEMENT_UUID);
|
|
88
|
+
|
|
89
|
+
// Body is reduced to the injected SignIn gate — clauses are NOT leaked.
|
|
90
|
+
expect(bodyContent).toHaveLength(1);
|
|
91
|
+
const gate = bodyContent[0] as {
|
|
92
|
+
type: string;
|
|
93
|
+
props: { mode?: string; gateContextValue?: string };
|
|
94
|
+
};
|
|
95
|
+
expect(gate.type).toBe("SignIn");
|
|
96
|
+
expect(gate.props.mode).toBe("gate");
|
|
97
|
+
expect(gate.props.gateContextValue).toBe(AGREEMENT_UUID);
|
|
98
|
+
|
|
99
|
+
// Header is untouched — the old bug cleared this region instead.
|
|
100
|
+
expect(headerContent).toHaveLength(4);
|
|
101
|
+
expect((headerContent[0] as { type: string }).type).toBe("OrgLogo");
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test("onUnauthorized leaves no agreement body text reachable past the gate", async () => {
|
|
105
|
+
const resolved = makeResolved();
|
|
106
|
+
await agreementGateConfig.onUnauthorized(resolved, AGREEMENT_UUID);
|
|
107
|
+
|
|
108
|
+
const bodyContent = (
|
|
109
|
+
(resolved.page as { puck_data: { content: unknown[] } }).puck_data
|
|
110
|
+
.content
|
|
111
|
+
);
|
|
112
|
+
// The clause text must not survive anywhere in the withheld body tree.
|
|
113
|
+
const serialized = JSON.stringify(bodyContent);
|
|
114
|
+
expect(serialized).not.toContain("Parties");
|
|
115
|
+
expect(serialized).not.toContain("Electronic Signature");
|
|
116
|
+
expect(serialized).not.toContain("Scope of Services");
|
|
117
|
+
});
|
|
118
|
+
});
|