@sssb/kit 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/dist/core/webhook-hmac.d.ts +69 -0
- package/dist/release.json +1 -0
- package/dist/testing/e2e.d.ts +15 -0
- package/dist/testing/e2e.js +195 -0
- package/package.json +209 -3
- package/src/adapters/README.md +6 -0
- package/src/adapters/dev-server.ts +21 -0
- package/src/adapters/fake/agreements.ts +81 -0
- package/src/adapters/fake/analytics.ts +93 -0
- package/src/adapters/fake/atomic-write.ts +161 -0
- package/src/adapters/fake/audit.ts +58 -0
- package/src/adapters/fake/auth.ts +312 -0
- package/src/adapters/fake/clock.ts +54 -0
- package/src/adapters/fake/data-dir.ts +27 -0
- package/src/adapters/fake/db.ts +88 -0
- package/src/adapters/fake/email.ts +46 -0
- package/src/adapters/fake/jobs.ts +270 -0
- package/src/adapters/fake/llm.ts +230 -0
- package/src/adapters/fake/pglite-dialect.ts +124 -0
- package/src/adapters/fake/service-auth.ts +145 -0
- package/src/adapters/fake/simulator-admin.ts +203 -0
- package/src/adapters/fake/simulator.ts +94 -0
- package/src/adapters/fake/sms.ts +43 -0
- package/src/adapters/fake/storage.ts +288 -0
- package/src/adapters/fake/webhooks.ts +98 -0
- package/src/adapters/index.ts +115 -0
- package/src/adapters/real/accept-invite-form.tsx +77 -0
- package/src/adapters/real/analytics.ts +28 -0
- package/src/adapters/real/auth.ts +216 -0
- package/src/adapters/real/contract-data-api.ts +104 -0
- package/src/adapters/real/contract-postgres.ts +167 -0
- package/src/adapters/real/database-transport.ts +34 -0
- package/src/adapters/real/db-data-api.ts +61 -0
- package/src/adapters/real/db.ts +88 -0
- package/src/adapters/real/email.ts +22 -0
- package/src/adapters/real/index.ts +89 -0
- package/src/adapters/real/jobs.ts +32 -0
- package/src/adapters/real/llm.ts +108 -0
- package/src/adapters/real/migrate-handler.ts +66 -0
- package/src/adapters/real/providers.tsx +12 -0
- package/src/adapters/real/rds-data-codec.ts +508 -0
- package/src/adapters/real/rds-data-dialect.ts +470 -0
- package/src/adapters/real/rds-data-emulator.ts +351 -0
- package/src/adapters/real/s3-storage.ts +233 -0
- package/src/adapters/real/sign-in-form.tsx +59 -0
- package/src/adapters/real/storage.ts +10 -0
- package/src/adapters/sentry/baseline.ts +90 -0
- package/src/adapters/sentry/client.ts +17 -0
- package/src/adapters/sentry/init.ts +17 -0
- package/src/authz/app-exemptions.ts +226 -0
- package/src/authz/authorize.ts +214 -0
- package/src/authz/route-policy.ts +153 -0
- package/src/authz/route-scan.ts +1516 -0
- package/src/components/agreements/acceptances-section.tsx +55 -0
- package/src/components/agreements/agreement-advisory-banner.tsx +33 -0
- package/src/components/agreements/agreement-body.tsx +34 -0
- package/src/components/agreements/agreement-gate.tsx +45 -0
- package/src/components/app-header.tsx +45 -0
- package/src/components/auth/accept-invite-screen.tsx +126 -0
- package/src/components/auth/auth-icons.tsx +68 -0
- package/src/components/auth/org-switcher.tsx +76 -0
- package/src/components/auth/people-picker.tsx +50 -0
- package/src/components/auth/preview-row.tsx +64 -0
- package/src/components/auth/sign-in-screen.tsx +24 -0
- package/src/components/auth/user-menu.tsx +64 -0
- package/src/components/demo-badge.tsx +20 -0
- package/src/components/demo-banner.tsx +14 -0
- package/src/components/gates/gate-interstitial.tsx +23 -0
- package/src/components/job-timeline.tsx +64 -0
- package/src/components/notifications/notification-bell.tsx +120 -0
- package/src/components/notifications/notification-prefs-section.tsx +112 -0
- package/src/components/org-screen.tsx +197 -0
- package/src/components/profile-screen.tsx +100 -0
- package/src/components/simulator/actor-runtime.ts +180 -0
- package/src/components/simulator/actor-shell.tsx +275 -0
- package/src/components/simulator/actors-app.tsx +119 -0
- package/src/components/simulator/errors-app.tsx +84 -0
- package/src/components/simulator/events-app.tsx +210 -0
- package/src/components/simulator/format-when.ts +20 -0
- package/src/components/simulator/hooks-app.tsx +319 -0
- package/src/components/simulator/inbound-app.tsx +210 -0
- package/src/components/simulator/jobs-app.tsx +471 -0
- package/src/components/simulator/mail-app.tsx +290 -0
- package/src/components/simulator/messages-app.tsx +64 -0
- package/src/components/simulator/people-app.tsx +140 -0
- package/src/components/simulator/people-dimensions.ts +16 -0
- package/src/components/simulator/simulator-panel.tsx +716 -0
- package/src/components/simulator/snapshots-app.tsx +398 -0
- package/src/components/simulator/tab-mount.ts +25 -0
- package/src/components/simulator/tours-app.tsx +105 -0
- package/src/components/webhook-endpoints-card.tsx +172 -0
- package/src/core/abilities.ts +459 -0
- package/src/core/agreements.ts +139 -0
- package/src/core/gates.ts +157 -0
- package/src/core/greeting.ts +11 -0
- package/src/core/inbound-email.ts +129 -0
- package/src/core/jobs.ts +51 -0
- package/src/core/keyset.ts +227 -0
- package/src/core/llm-models.ts +10 -0
- package/src/core/locale.ts +3 -0
- package/src/core/notifications.ts +182 -0
- package/src/core/presets.ts +456 -0
- package/src/core/roles.ts +47 -0
- package/src/core/schedules.ts +147 -0
- package/src/core/standard-schema.ts +56 -0
- package/src/core/state-machine.ts +43 -0
- package/src/core/webhook-events.ts +86 -0
- package/src/core/webhook-hmac.ts +248 -0
- package/src/core/webhook-signing.ts +27 -0
- package/src/cutover/rows.json +101 -0
- package/src/db/agreements.ts +176 -0
- package/src/db/app-roles.ts +197 -0
- package/src/db/audit.ts +356 -0
- package/src/db/inbound-email.ts +145 -0
- package/src/db/jobs.ts +300 -0
- package/src/db/jsonb.ts +18 -0
- package/src/db/keyset.ts +179 -0
- package/src/db/migrate.ts +73 -0
- package/src/db/migrations/0001_tenants.ts +25 -0
- package/src/db/migrations/0003_organizations.ts +27 -0
- package/src/db/migrations/0004_jobs.ts +64 -0
- package/src/db/migrations/0005_service_keys.ts +33 -0
- package/src/db/migrations/0008_audit_events.ts +51 -0
- package/src/db/migrations/0009_job_schedules.ts +52 -0
- package/src/db/migrations/0010_webhooks.ts +100 -0
- package/src/db/migrations/0011_notifications.ts +98 -0
- package/src/db/migrations/0012_inbound_email.ts +74 -0
- package/src/db/migrations/0013_agreements.ts +98 -0
- package/src/db/migrations/0014_audit_credential.ts +29 -0
- package/src/db/migrations/0015_app_user_grant.ts +67 -0
- package/src/db/migrations/0016_audit_detail.ts +26 -0
- package/src/db/migrations/index.ts +49 -0
- package/src/db/notifications.ts +185 -0
- package/src/db/org-lookup.ts +104 -0
- package/src/db/owner-pass.ts +252 -0
- package/src/db/rls-coverage.ts +259 -0
- package/src/db/rls-proof-runner.ts +94 -0
- package/src/db/rls-proofs.ts +1176 -0
- package/src/db/schedules.ts +187 -0
- package/src/db/schema.ts +235 -0
- package/src/db/seed.ts +176 -0
- package/src/db/service-keys.ts +50 -0
- package/src/db/tenant-lookup.ts +13 -0
- package/src/db/webhooks.ts +483 -0
- package/src/db/with-tenant.ts +26 -0
- package/src/demo-static/actor-drivers.ts +161 -0
- package/src/demo-static/assistant-replay.ts +61 -0
- package/src/demo-static/contracts.ts +282 -0
- package/src/demo-static/email-html.ts +58 -0
- package/src/demo-static/hash-route.ts +24 -0
- package/src/demo-static/rows.ts +105 -0
- package/src/demo-static/shell.tsx +440 -0
- package/src/demo-static/tour/contracts.ts +97 -0
- package/src/demo-static/tour/driver.ts +320 -0
- package/src/demo-static/tour/tour-overlay.tsx +226 -0
- package/src/demo-static/tour/use-tours.tsx +394 -0
- package/src/demo-static/world.ts +1479 -0
- package/src/email/send.ts +12 -0
- package/src/email/templates/digest-email.tsx +61 -0
- package/src/email/templates/invite-email.tsx +57 -0
- package/src/email/templates/notification-email.tsx +39 -0
- package/src/guide.md +118 -0
- package/src/i18n/messages/en.json +373 -0
- package/src/i18n/messages/es.json +373 -0
- package/src/i18n/messages.ts +34 -0
- package/src/i18n/namespaces.ts +32 -0
- package/src/i18n/request.ts +34 -0
- package/src/i18n/routing.ts +7 -0
- package/src/inbound-email/handlers.ts +67 -0
- package/src/inbound-email/intake.ts +180 -0
- package/src/jobs/digest-email.ts +97 -0
- package/src/observability/scrub.ts +42 -0
- package/src/ports/README.md +8 -0
- package/src/ports/analytics.ts +8 -0
- package/src/ports/auth.ts +87 -0
- package/src/ports/db.ts +27 -0
- package/src/ports/email.ts +14 -0
- package/src/ports/errors.ts +46 -0
- package/src/ports/jobs.ts +48 -0
- package/src/ports/llm.ts +85 -0
- package/src/ports/storage.ts +132 -0
- package/src/seed/contracts.ts +129 -0
- package/src/server-lib/assistant.ts +45 -0
- package/src/server-lib/defer.ts +53 -0
- package/src/server-lib/demo-presets.ts +85 -0
- package/src/server-lib/invite.ts +92 -0
- package/src/server-lib/notify-deps.ts +15 -0
- package/src/server-lib/notify.ts +252 -0
- package/src/server-lib/preset-operations.ts +121 -0
- package/src/server-lib/scheduled-tick.ts +38 -0
- package/src/server-lib/sms.ts +43 -0
- package/src/server-lib/webhook-dispatch.ts +75 -0
- package/src/service-auth/mailgun.ts +70 -0
- package/src/service-auth/verify.ts +73 -0
- package/src/service-auth/webhook.ts +60 -0
- package/src/testing/checks.json +103 -0
- package/src/testing/conformance/authz.ts +46 -0
- package/src/testing/conformance/db.ts +258 -0
- package/src/testing/conformance/demo-presets.ts +295 -0
- package/src/testing/conformance/i18n.ts +80 -0
- package/src/testing/conformance/register.ts +200 -0
- package/src/testing/conformance/seam-map.ts +205 -0
- package/src/testing/conformance/suite.ts +59 -0
- package/src/testing/conformance/types.ts +18 -0
- package/src/testing/contract.ts +200 -0
- package/src/testing/e2e.ts +15 -0
- package/src/testing/index.ts +6 -0
- package/src/testing/seam-specifiers.json +22 -0
- package/src/testing/tmp-dir-marker.d.mts +4 -0
- package/src/testing/tmp-dir-marker.mjs +5 -0
- package/src/testing/tmp-dir.ts +182 -0
- package/src/theme.ts +28 -0
- package/README.md +0 -3
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
{
|
|
2
|
+
"shell": {
|
|
3
|
+
"demoBadge": "demo",
|
|
4
|
+
"staticDemoBadge": "demo estática"
|
|
5
|
+
},
|
|
6
|
+
"auth": {
|
|
7
|
+
"signInTitle": "Iniciar sesión",
|
|
8
|
+
"signInSubtitle": "Una sola interfaz de acceso en todos los modos: personas locales en desarrollo y demo, Clerk en producción.",
|
|
9
|
+
"personHint": "Elige una persona sembrada para iniciar sesión:",
|
|
10
|
+
"personMeta": "{role} · {tenant}",
|
|
11
|
+
"emailLabel": "Correo electrónico",
|
|
12
|
+
"passwordLabel": "Contraseña",
|
|
13
|
+
"signInButton": "Iniciar sesión",
|
|
14
|
+
"signInError": "No se pudo iniciar sesión. Revisa tu correo y contraseña.",
|
|
15
|
+
"mfaNotImplemented": "Esta cuenta requiere MFA, que llegará en una fase posterior.",
|
|
16
|
+
"userMenuLabel": "{name}, menú de la cuenta",
|
|
17
|
+
"profileLink": "Perfil",
|
|
18
|
+
"signOut": "Cerrar sesión"
|
|
19
|
+
},
|
|
20
|
+
"profile": {
|
|
21
|
+
"title": "Tu perfil",
|
|
22
|
+
"emailLabel": "Correo electrónico",
|
|
23
|
+
"nameLabel": "Nombre para mostrar",
|
|
24
|
+
"localeLabel": "Idioma",
|
|
25
|
+
"saveButton": "Guardar",
|
|
26
|
+
"saved": "Guardado.",
|
|
27
|
+
"profileSection": "Perfil",
|
|
28
|
+
"securitySection": "Seguridad",
|
|
29
|
+
"securitySoon": "La contraseña, la autenticación de dos factores y las cuentas conectadas llegan en una fase posterior."
|
|
30
|
+
},
|
|
31
|
+
"org": {
|
|
32
|
+
"switchLabel": "Cambiar equipo",
|
|
33
|
+
"switchTriggerSuffix": ", cambiar equipo",
|
|
34
|
+
"title": "{org}",
|
|
35
|
+
"membersHeading": "Miembros",
|
|
36
|
+
"pendingHeading": "Invitaciones pendientes",
|
|
37
|
+
"colName": "Nombre",
|
|
38
|
+
"colEmail": "Correo",
|
|
39
|
+
"colRole": "Rol",
|
|
40
|
+
"colStatus": "Estado",
|
|
41
|
+
"statusActive": "activo",
|
|
42
|
+
"statusInvited": "invitado",
|
|
43
|
+
"inviteHeading": "Invitar a alguien",
|
|
44
|
+
"emailLabel": "Dirección de correo",
|
|
45
|
+
"emailInvalid": "Escribe una dirección de correo válida",
|
|
46
|
+
"roleLabel": "Rol",
|
|
47
|
+
"inviteButton": "Enviar invitación",
|
|
48
|
+
"inviteSent": "Invitación enviada a {email}",
|
|
49
|
+
"inviteDuplicate": "Esa dirección ya es miembro o tiene una invitación pendiente.",
|
|
50
|
+
"inviteFailed": "Algo salió mal al enviar la invitación. Inténtalo de nuevo."
|
|
51
|
+
},
|
|
52
|
+
"events": {
|
|
53
|
+
"toggleGlyph": "▸",
|
|
54
|
+
"empty": "Aún no hay eventos capturados — navega por la app o envía una invitación y aparecerán aquí.",
|
|
55
|
+
"analyticsHeading": "Eventos de analítica",
|
|
56
|
+
"auditHeading": "Registro de auditoría — expediente del producto",
|
|
57
|
+
"auditEmpty": "Aún no hay eventos de auditoría — realiza una acción en el producto y aparecerán aquí."
|
|
58
|
+
},
|
|
59
|
+
"errors": {
|
|
60
|
+
"title": "Depuración de errores",
|
|
61
|
+
"intro": "Provoca un error de prueba para ver exactamente qué enviaría el adaptador de Sentry tras la depuración — sin necesidad de DSN.",
|
|
62
|
+
"throwClient": "Provocar un error de cliente",
|
|
63
|
+
"throwServer": "Provocar un error de servidor",
|
|
64
|
+
"rawHeading": "Evento sin depurar",
|
|
65
|
+
"scrubbedHeading": "Evento depurado (lo que recibiría Sentry)",
|
|
66
|
+
"note": "Las cookies, cabeceras de autenticación, cadenas de consulta y el correo/IP del usuario se eliminan antes de que algo salga del proceso.",
|
|
67
|
+
"empty": "Provoca un error arriba para ver la carga depurada."
|
|
68
|
+
},
|
|
69
|
+
"banner": {
|
|
70
|
+
"demo": "El indicador de función demo-banner está activado — este aviso está controlado por el puerto de analítica."
|
|
71
|
+
},
|
|
72
|
+
"jobTimeline": {
|
|
73
|
+
"statusQueued": "En cola",
|
|
74
|
+
"statusRunning": "En curso",
|
|
75
|
+
"statusCompleted": "Completado",
|
|
76
|
+
"statusFailed": "Falló"
|
|
77
|
+
},
|
|
78
|
+
"simulator": {
|
|
79
|
+
"pillLabel": "Simulador",
|
|
80
|
+
"pillSuffix": ", abrir el panel",
|
|
81
|
+
"pillUnreadSuffix": ", {count, plural, one {# correo sin leer} other {# correos sin leer}}, abrir el panel",
|
|
82
|
+
"panelTitle": "Simulador",
|
|
83
|
+
"peopleTab": "Personas",
|
|
84
|
+
"mailTab": "Correo",
|
|
85
|
+
"messagesTab": "Mensajes",
|
|
86
|
+
"eventsTab": "Eventos",
|
|
87
|
+
"jobsTab": "Trabajos",
|
|
88
|
+
"actorsTab": "Actores",
|
|
89
|
+
"errorsTab": "Errores",
|
|
90
|
+
"collapseButton": "Ocultar",
|
|
91
|
+
"collapseAriaLabel": "Ocultar el panel Simulador",
|
|
92
|
+
"widthLabel": "Ancho del panel",
|
|
93
|
+
"localeLabel": "Idioma",
|
|
94
|
+
"personChipLabel": "Persona actual",
|
|
95
|
+
"personChipSignedOut": "Sesión cerrada",
|
|
96
|
+
"signedOutHint": "Nadie ha iniciado sesión — elige una persona abajo para iniciar sesión como ella; elegir a una persona invitada solo cambia qué mundo ves.",
|
|
97
|
+
"mailScopePerson": "Mío",
|
|
98
|
+
"mailScopeAll": "Correo de todos",
|
|
99
|
+
"mailEmpty": "Aún no hay correo — las invitaciones y otros correos aparecerán aquí.",
|
|
100
|
+
"mailToLine": "para {to}",
|
|
101
|
+
"mailLinksHeading": "Enlaces en este mensaje",
|
|
102
|
+
"peopleInvitedBadge": "invitado",
|
|
103
|
+
"peopleOrgRole": "{org} · {role}",
|
|
104
|
+
"peopleHint": "Haz clic en una persona para iniciar sesión como ella; elegir a una persona invitada solo cambia qué mundo ves.",
|
|
105
|
+
"snapshotsTab": "Instantáneas",
|
|
106
|
+
"snapshotsResetHeading": "Reiniciar el mundo",
|
|
107
|
+
"snapshotsResetHint": "Borra cuentas, correo y datos hasta volver al mundo semilla. Esto no se puede deshacer.",
|
|
108
|
+
"snapshotsResetButton": "Reiniciar mundo",
|
|
109
|
+
"snapshotsResetConfirm": "Sí, reiniciar todo",
|
|
110
|
+
"snapshotsResetCancel": "Cancelar",
|
|
111
|
+
"snapshotsSaveHeading": "Guardar una instantánea",
|
|
112
|
+
"snapshotsNamePlaceholder": "nombre-instantanea",
|
|
113
|
+
"snapshotsSaveButton": "Guardar",
|
|
114
|
+
"snapshotsNameInvalid": "Solo minúsculas, números y guiones.",
|
|
115
|
+
"snapshotsListHeading": "Instantáneas guardadas",
|
|
116
|
+
"snapshotsEmpty": "Aún no hay instantáneas guardadas.",
|
|
117
|
+
"snapshotsRestoreButton": "Restaurar",
|
|
118
|
+
"flagsHeading": "Indicadores de funciones",
|
|
119
|
+
"flagHint": "Al activar un indicador se guarda en .data/analytics/flags.json y controla la interfaz en toda la app.",
|
|
120
|
+
"flagLabelDemoBanner": "Cartel de demo",
|
|
121
|
+
"flagLabelJobsHeld": "Retener trabajos",
|
|
122
|
+
"jobsEmpty": "Aún no hay trabajos — ejecuta una exportación desde el panel y aparecerá aquí.",
|
|
123
|
+
"jobsRunPending": "Ejecutar trabajos pendientes",
|
|
124
|
+
"jobsHeldBadge": "Retenido",
|
|
125
|
+
"actorsHint": "Estos procesos se ejecutan por su cuenta — pausa uno y avanza paso a paso para ver cada solicitud que hace.",
|
|
126
|
+
"actorsWorldHeld": "Retenido",
|
|
127
|
+
"actorsWorldCounts": "En cola {queued} · En ejecución {running} · Completados {completed}",
|
|
128
|
+
"snapshotsSaveHint": "Guardar con un nombre existente sobrescribe esa instantánea.",
|
|
129
|
+
"snapshotsDeleteButton": "Eliminar",
|
|
130
|
+
"snapshotsWorking": "Trabajando…",
|
|
131
|
+
"coachmark": "Esto es el Simulador — el mundo alrededor de la app: las personas, su correo y los controles del mundo simulado.",
|
|
132
|
+
"coachmarkDismiss": "✕",
|
|
133
|
+
"coachmarkDismissAriaLabel": "Descartar esta pista",
|
|
134
|
+
"mailEmptyPerson": "Aún no hay correo para {email}.",
|
|
135
|
+
"mailShowAll": "Ver el correo de todos ({count})",
|
|
136
|
+
"mailCopyButton": "Copiar",
|
|
137
|
+
"mailClearButton": "Vaciar el buzón",
|
|
138
|
+
"mailClearConfirm": "Sí, vaciar todo el correo",
|
|
139
|
+
"mailClearCancel": "Cancelar",
|
|
140
|
+
"noticeNewMail": "Correo nuevo para {email}",
|
|
141
|
+
"noticeLinkOrigin": "Ese enlace apunta a {origin} — ábrelo allí.",
|
|
142
|
+
"noticeLinkUnusable": "Ese enlace no se puede abrir desde aquí: {href}",
|
|
143
|
+
"noticeLinkCopied": "Enlace copiado al portapapeles.",
|
|
144
|
+
"noticeLinkCopyFailed": "No se pudo copiar el enlace.",
|
|
145
|
+
"noticeMailCleared": "Buzón vaciado.",
|
|
146
|
+
"noticeWorldReset": "Mundo reiniciado a la línea base semilla.",
|
|
147
|
+
"noticeSnapshotSaved": "Instantánea «{name}» guardada.",
|
|
148
|
+
"noticeSnapshotRestored": "Instantánea «{name}» restaurada.",
|
|
149
|
+
"noticeSnapshotDeleted": "Instantánea «{name}» eliminada.",
|
|
150
|
+
"noticeJobsRan": "Se ejecutaron {count} trabajos pendientes.",
|
|
151
|
+
"noticeAgreementBumped": "Se subió el acuerdo a la v{version}.",
|
|
152
|
+
"agreementsHeading": "Acuerdos",
|
|
153
|
+
"agreementsHint": "Sube una versión para reactivar su barrera para todos los que aceptaron una versión anterior.",
|
|
154
|
+
"agreementsEmpty": "No hay acuerdos en este mundo.",
|
|
155
|
+
"agreementsBump": "Subir versión",
|
|
156
|
+
"agreementsRowTitle": "{tenant} · {title}",
|
|
157
|
+
"agreementsRowMeta": "v{version} · {gating} · {current}/{total} al día",
|
|
158
|
+
"agreementsGatingBlock": "bloqueante",
|
|
159
|
+
"agreementsGatingAdvisory": "informativa",
|
|
160
|
+
"actorFrameTitle": "Actor: {actor}",
|
|
161
|
+
"actorRunning": "En marcha",
|
|
162
|
+
"actorPaused": "En pausa",
|
|
163
|
+
"actorHeld": "Retenido",
|
|
164
|
+
"actorPauseButton": "Pausar",
|
|
165
|
+
"actorResumeButton": "Reanudar",
|
|
166
|
+
"actorStepButton": "Avanzar",
|
|
167
|
+
"actorLogHeading": "Registro de actividad",
|
|
168
|
+
"actorLogEmpty": "Aún no hay actividad — el actor registra aquí cada llamada mientras se ejecuta.",
|
|
169
|
+
"actorNoteIdle": "Nada que hacer — esperando trabajo.",
|
|
170
|
+
"actorNoteClaimed": "Se reclamó el trabajo {id} y pasó a en ejecución.",
|
|
171
|
+
"actorNoteCompleted": "Se completó el trabajo {id} con su artefacto exportado.",
|
|
172
|
+
"actorNoteLostRace": "Otro ejecutor se adelantó — el trabajo ya avanzó.",
|
|
173
|
+
"actorNoteVanished": "Ese trabajo ya no existe — se reinició por debajo.",
|
|
174
|
+
"actorNoteDelivered": "Se entregó el webhook de finalización para la compilación {id}.",
|
|
175
|
+
"actorNoteRedelivered": "Reentregado — esa compilación ya estaba completa.",
|
|
176
|
+
"actorNoteMovedOn": "Esa compilación ya había avanzado.",
|
|
177
|
+
"actorNoteFailedReported": "Se informó el trabajo {id} como fallido.",
|
|
178
|
+
"actorNoteCredentialsRefreshed": "Las credenciales caducaron — se emitió un token nuevo y se reintentó.",
|
|
179
|
+
"actorNoteError": "Algo salió mal: {message}.",
|
|
180
|
+
"clockTitle": "Reloj del mundo",
|
|
181
|
+
"clockRealTime": "Tiempo real",
|
|
182
|
+
"clockAhead": "+{hours} h por delante del tiempo real",
|
|
183
|
+
"clockAdvanceHour": "+1 h",
|
|
184
|
+
"clockAdvanceDay": "+1 d",
|
|
185
|
+
"clockAdvanceWeek": "+1 sem",
|
|
186
|
+
"clockRunDue": "Ejecutar pendientes",
|
|
187
|
+
"clockReset": "Restablecer reloj",
|
|
188
|
+
"tickerTitle": "Temporizador del planificador",
|
|
189
|
+
"tickerHint": "Solo en desarrollo. Ejecuta el tick programado en tiempo real, como pnpm tick, hasta que lo detengas. Apagado hasta que lo inicies.",
|
|
190
|
+
"tickerStopped": "Detenido",
|
|
191
|
+
"tickerRunning": "Activo cada {seconds, plural, one {# segundo} other {# segundos}}",
|
|
192
|
+
"tickerElsewhere": "Ya está activo cada {seconds, plural, one {# segundo} other {# segundos}}, iniciado fuera de este panel (pid {pid}, normalmente DEV_TICK_SECONDS). Detenlo allí.",
|
|
193
|
+
"tickerNoTickYet": "Aún sin ticks",
|
|
194
|
+
"tickerTicks": "{count, plural, one {# tick} other {# ticks}}; último: {when}",
|
|
195
|
+
"tickerLastError": "El último tick falló: {error}",
|
|
196
|
+
"tickerIntervalLabel": "Intervalo (segundos)",
|
|
197
|
+
"tickerStart": "Iniciar temporizador",
|
|
198
|
+
"tickerStop": "Detener temporizador",
|
|
199
|
+
"schedulesTitle": "Programaciones",
|
|
200
|
+
"schedulesEmpty": "Sin programaciones.",
|
|
201
|
+
"scheduleInterval": "Cada {minutes} min",
|
|
202
|
+
"scheduleDaily": "Diario · {time} UTC",
|
|
203
|
+
"scheduleWeekly": "{weekday} · {time} UTC",
|
|
204
|
+
"scheduleEnabled": "activa",
|
|
205
|
+
"scheduleDisabled": "inactiva",
|
|
206
|
+
"scheduleNextRun": "próxima {when}",
|
|
207
|
+
"weekday0": "Dom",
|
|
208
|
+
"weekday1": "Lun",
|
|
209
|
+
"weekday2": "Mar",
|
|
210
|
+
"weekday3": "Mié",
|
|
211
|
+
"weekday4": "Jue",
|
|
212
|
+
"weekday5": "Vie",
|
|
213
|
+
"weekday6": "Sáb",
|
|
214
|
+
"noticeScheduleFired": "{count} trabajo(s) programado(s) ejecutado(s).",
|
|
215
|
+
"noticeClockAdvanced": "Reloj del mundo adelantado.",
|
|
216
|
+
"noticeClockReset": "Reloj del mundo restablecido al tiempo real.",
|
|
217
|
+
"noticeNoDue": "No había programaciones pendientes.",
|
|
218
|
+
"noticeTickerStarted": "Temporizador iniciado: cada {seconds, plural, one {# segundo} other {# segundos}}.",
|
|
219
|
+
"noticeTickerStopped": "Temporizador detenido.",
|
|
220
|
+
"noticeTickerElsewhere": "No se inició: ya hay otro temporizador activo en este mundo.",
|
|
221
|
+
"noticeTickerInvalid": "No se inició: el intervalo debe ser un número entero de segundos entre {min} y {max}.",
|
|
222
|
+
"hooksTab": "Webhooks",
|
|
223
|
+
"noticeHookFailOn": "Endpoint configurado para fallar",
|
|
224
|
+
"noticeHookFailOff": "Endpoint configurado para entregar",
|
|
225
|
+
"noticeHooksDelivered": "Se entregaron {count} webhook(s)",
|
|
226
|
+
"inboundComposeHeading": "Redactar entrante",
|
|
227
|
+
"inboundComposeHint": "El mundo le escribe a la aplicación. Elige un remitente y un equipo, y el mensaje se entrega a la dirección de entrada de ese equipo.",
|
|
228
|
+
"inboundFromLabel": "De",
|
|
229
|
+
"inboundOrgLabel": "Al equipo",
|
|
230
|
+
"inboundHandlerLabel": "Controlador",
|
|
231
|
+
"inboundAddressPreview": "Entregado a {address}",
|
|
232
|
+
"inboundHandlersHint": "Controladores conocidos: {handlers}",
|
|
233
|
+
"inboundSubjectLabel": "Asunto",
|
|
234
|
+
"inboundBodyLabel": "Cuerpo",
|
|
235
|
+
"inboundSendButton": "Enviar a la app",
|
|
236
|
+
"inboundListHeading": "Entrantes",
|
|
237
|
+
"inboundEmpty": "Aún no hay correo entrante.",
|
|
238
|
+
"inboundNoSubject": "(sin asunto)",
|
|
239
|
+
"inboundStatus_received": "recibido",
|
|
240
|
+
"inboundStatus_handled": "procesado",
|
|
241
|
+
"inboundStatus_unmatched": "sin coincidencia",
|
|
242
|
+
"inboundStatus_failed": "fallido",
|
|
243
|
+
"inboundMetaLine": "para {to} · de {from}",
|
|
244
|
+
"inboundErrorLine": "nota: {error}",
|
|
245
|
+
"noticeInboundSent": "Correo entrante {status}",
|
|
246
|
+
"toursTab": "Recorridos",
|
|
247
|
+
"toursHeading": "Recorridos guiados",
|
|
248
|
+
"toursHint": "Un recorrido maneja la app por ti: un cursor fantasma pulsa los controles reales mientras la barra narra. Nada se envía hasta que pulsas Siguiente.",
|
|
249
|
+
"toursFastLabel": "Rápido (velocidad de vista previa)",
|
|
250
|
+
"toursStart": "Empezar",
|
|
251
|
+
"toursRunning": "En marcha",
|
|
252
|
+
"tourBarLabel": "Recorrido guiado",
|
|
253
|
+
"tourProgress": "{step} / {total}",
|
|
254
|
+
"tourNext": "Siguiente",
|
|
255
|
+
"tourBack": "Atrás",
|
|
256
|
+
"tourExit": "Salir del recorrido",
|
|
257
|
+
"tourFinish": "Terminar",
|
|
258
|
+
"tourResume": "Volver al recorrido",
|
|
259
|
+
"tourDerailedHint": "Te has salido del camino del recorrido. Sigue explorando o vuelve a donde estaba la historia.",
|
|
260
|
+
"tourMiss": "No encontrado ({action}): {target}",
|
|
261
|
+
"tourReportClean": "Recorrido terminado: {steps} pasos, no falta nada.",
|
|
262
|
+
"tourReportProblems": "Recorrido terminado: {steps} pasos, faltan {count}.",
|
|
263
|
+
"tourReportDismiss": "Descartar",
|
|
264
|
+
"presetsHeading": "Empezar desde un preajuste",
|
|
265
|
+
"presetsHint": "Reinicia el mundo y reproduce un punto de partida guionizado; funciona en todas las demos, incluida la de un solo archivo.",
|
|
266
|
+
"presetsLoad": "Cargar",
|
|
267
|
+
"noticePresetLoaded": "Preajuste cargado: {name}",
|
|
268
|
+
"snapshotsNameReserved": "Ese nombre pertenece al reinicio o a un preajuste; elige otro.",
|
|
269
|
+
"noticePresetFailed": "No se pudo cargar el preajuste: {name}. El mundo quedó a medio preparar; reinícialo para empezar de cero.",
|
|
270
|
+
"noticePresetFailedStale": "No se pudo cargar el preajuste: {name}. El mundo se reinició pero quedó a medio preparar, y esta página aún muestra el anterior; reinicia el mundo para empezar de cero."
|
|
271
|
+
},
|
|
272
|
+
"acceptInvite": {
|
|
273
|
+
"title": "Únete a {org}",
|
|
274
|
+
"subtitle": "Estás aceptando una invitación para unirte como {role}, usando {email}.",
|
|
275
|
+
"nameLabel": "Tu nombre",
|
|
276
|
+
"nameRequired": "Por favor escribe un nombre",
|
|
277
|
+
"acceptButton": "Aceptar invitación",
|
|
278
|
+
"agreementsNotice": "Al unirte, aceptas también los términos y políticas vigentes de este sitio — aparecen en tu perfil, y se te pedirá aceptarlos de nuevo aquí si cambian.",
|
|
279
|
+
"acceptError": "Algo salió mal al aceptar esta invitación. Inténtalo de nuevo.",
|
|
280
|
+
"invalidTitle": "Invitación no encontrada",
|
|
281
|
+
"invalidBody": "Este enlace de invitación no es válido o ya se ha utilizado.",
|
|
282
|
+
"backToSignIn": "Volver a iniciar sesión",
|
|
283
|
+
"ticketTitle": "Acepta tu invitación",
|
|
284
|
+
"ticketMissing": "Abre esta página desde el enlace de tu correo de invitación para aceptarla.",
|
|
285
|
+
"ticketAccepting": "Aceptando tu invitación…",
|
|
286
|
+
"ticketOneMoment": "Un momento…",
|
|
287
|
+
"ticketError": "No se pudo aceptar esta invitación. El enlace puede ser inválido o haber expirado."
|
|
288
|
+
},
|
|
289
|
+
"email": {
|
|
290
|
+
"inviteSubject": "Te invitaron a {org}",
|
|
291
|
+
"invitePreview": "Te han invitado a {org}",
|
|
292
|
+
"inviteHeading": "Te invitaron a {org}",
|
|
293
|
+
"inviteBody": "{inviter} te invitó a unirte a {org} como {role}.",
|
|
294
|
+
"inviteButton": "Aceptar la invitación",
|
|
295
|
+
"inviteLinkFallback": "O abre este enlace:",
|
|
296
|
+
"digestSubject": "Tu resumen de {org}",
|
|
297
|
+
"digestPreview": "Un resumen de la actividad reciente en {org}",
|
|
298
|
+
"digestHeading": "Resumen de {org}",
|
|
299
|
+
"digestIntro": "Esto es lo que ha pasado en {org}.",
|
|
300
|
+
"digestCount": "Tu equipo tiene {count} asuntos abiertos.",
|
|
301
|
+
"digestRecentHeading": "Más recientes",
|
|
302
|
+
"digestEmpty": "Nada que informar.",
|
|
303
|
+
"digestFooter": "Recibes este resumen según la programación de tu equipo."
|
|
304
|
+
},
|
|
305
|
+
"webhooks": {
|
|
306
|
+
"cardTitle": "Webhooks salientes",
|
|
307
|
+
"cardDescription": "Envía POST HTTP firmados a tus sistemas cuando ocurren eventos en este equipo.",
|
|
308
|
+
"secretHeading": "Secreto de firma",
|
|
309
|
+
"secretOnce": "Copia este secreto ahora — se muestra una sola vez y no se puede recuperar después.",
|
|
310
|
+
"secretDismiss": "Listo",
|
|
311
|
+
"endpointsEmpty": "Aún no hay endpoints.",
|
|
312
|
+
"toggleAriaLabel": "Activar o desactivar el endpoint",
|
|
313
|
+
"deleteButton": "Eliminar",
|
|
314
|
+
"urlLabel": "URL del endpoint",
|
|
315
|
+
"urlPlaceholder": "https://example.com/webhooks",
|
|
316
|
+
"eventKindsLabel": "Eventos",
|
|
317
|
+
"createButton": "Agregar endpoint",
|
|
318
|
+
"enabled": "activado",
|
|
319
|
+
"disabled": "desactivado",
|
|
320
|
+
"simulatorEndpointsTitle": "Endpoints",
|
|
321
|
+
"simulatorEndpointsEmpty": "No hay endpoints registrados.",
|
|
322
|
+
"simulatorRecover": "Recuperar",
|
|
323
|
+
"simulatorFail": "Fallar",
|
|
324
|
+
"simulatorDeliveriesTitle": "Entregas",
|
|
325
|
+
"simulatorDeliveriesEmpty": "Aún no hay entregas.",
|
|
326
|
+
"simulatorAttempts": "Intentos: {count}",
|
|
327
|
+
"simulatorNextRetry": "Próximo reintento {when}",
|
|
328
|
+
"simulatorSignature": "Firma",
|
|
329
|
+
"simulatorBody": "Cuerpo",
|
|
330
|
+
"simulatorRunDue": "Entregar pendientes ahora"
|
|
331
|
+
},
|
|
332
|
+
"messages": {
|
|
333
|
+
"empty": "Aún no se han enviado mensajes.",
|
|
334
|
+
"toLine": "Para {to}"
|
|
335
|
+
},
|
|
336
|
+
"notifications": {
|
|
337
|
+
"bellLabel": "Notificaciones, {count} sin leer",
|
|
338
|
+
"title": "Notificaciones",
|
|
339
|
+
"empty": "Aún no hay notificaciones.",
|
|
340
|
+
"prefsSection": "Preferencias de notificación",
|
|
341
|
+
"prefsHint": "Elige cómo te llega cada evento. Cada canal está activado salvo que lo desactives.",
|
|
342
|
+
"prefsKindColumn": "Evento",
|
|
343
|
+
"prefToggleAria": "Notificaciones de {channel} para {kind}",
|
|
344
|
+
"kindOrgInvited": "Invitación al equipo enviada",
|
|
345
|
+
"kindJobCompleted": "Trabajo finalizado",
|
|
346
|
+
"channelInApp": "En la app",
|
|
347
|
+
"channelEmail": "Correo",
|
|
348
|
+
"channelSms": "SMS",
|
|
349
|
+
"titleOrgInvited": "Nueva invitación al equipo",
|
|
350
|
+
"bodyOrgInvited": "{email} fue invitado a {org} como {role}.",
|
|
351
|
+
"subjectOrgInvited": "Se envió una nueva invitación en {org}",
|
|
352
|
+
"smsOrgInvited": "{org}: {email} fue invitado como {role}.",
|
|
353
|
+
"titleJobCompleted": "Trabajo completado",
|
|
354
|
+
"bodyJobCompleted": "Tu trabajo {jobKind} finalizó correctamente.",
|
|
355
|
+
"subjectJobCompleted": "Tu trabajo {jobKind} se completó",
|
|
356
|
+
"smsJobCompleted": "Tu trabajo {jobKind} se completó.",
|
|
357
|
+
"titleJobFailed": "Trabajo fallido",
|
|
358
|
+
"bodyJobFailed": "Tu trabajo {jobKind} no finalizó.",
|
|
359
|
+
"subjectJobFailed": "Tu trabajo {jobKind} falló",
|
|
360
|
+
"smsJobFailed": "Tu trabajo {jobKind} falló.",
|
|
361
|
+
"emailFooter": "Puedes gestionar las preferencias de notificación en tu perfil."
|
|
362
|
+
},
|
|
363
|
+
"agreements": {
|
|
364
|
+
"gateTitle": "Antes de continuar",
|
|
365
|
+
"gateLead": "Revisa y acepta lo siguiente para continuar.",
|
|
366
|
+
"acceptButton": "Acepto",
|
|
367
|
+
"advisoryBanner": "Por favor revisa: {titles}",
|
|
368
|
+
"advisoryDismiss": "Descartar",
|
|
369
|
+
"acceptancesTitle": "Acuerdos que has aceptado",
|
|
370
|
+
"acceptancesEmpty": "Aún no has aceptado ningún acuerdo.",
|
|
371
|
+
"acceptanceMeta": "v{version} · aceptado {date}"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The framework half of the i18n catalog, and the merge that composes it with the app's half
|
|
3
|
+
* (ADR-0012). The catalogs are PHYSICALLY split along the namespace partition:
|
|
4
|
+
* `packages/kit/src/i18n/messages/*.json` holds the FRAMEWORK_NAMESPACES, the host app's
|
|
5
|
+
* `messages/*.json` holds APP_NAMESPACES, and every load site merges the two.
|
|
6
|
+
*
|
|
7
|
+
* Three load sites, one merge: the Next request config (`./request.ts`), the static demo shell
|
|
8
|
+
* (`src/demo-static/main.tsx`), and the tests that prove en/es parity over the MERGED tree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** A next-intl message catalog: nested namespaces of ICU strings. */
|
|
12
|
+
export type MessageTree = { [key: string]: string | MessageTree }
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Deep-merge catalogs, later trees winning per leaf. The framework/app namespaces are disjoint at the
|
|
16
|
+
* top level (the conformance suite's `i18n-partition` check proves it), so this never actually overwrites today — the merge is deep
|
|
17
|
+
* anyway so an app CAN override a single framework string without forking a whole namespace.
|
|
18
|
+
*/
|
|
19
|
+
export function mergeMessages(...trees: MessageTree[]): MessageTree {
|
|
20
|
+
const out: MessageTree = {}
|
|
21
|
+
for (const tree of trees) {
|
|
22
|
+
for (const [key, value] of Object.entries(tree)) {
|
|
23
|
+
const existing = out[key]
|
|
24
|
+
out[key] =
|
|
25
|
+
typeof value === 'object' && typeof existing === 'object' ? mergeMessages(existing, value) : value
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return out
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The framework catalog for one locale (dynamic so each locale stays its own chunk). */
|
|
32
|
+
export async function loadFrameworkMessages(locale: string): Promise<MessageTree> {
|
|
33
|
+
return (await import(`./messages/${locale}.json`)).default as MessageTree
|
|
34
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The FRAMEWORK's reserved i18n namespaces — the top-level keys of the framework catalog
|
|
3
|
+
* (`./messages/*.json`) that the framework owns: shell chrome, auth, profile, org, events, errors,
|
|
4
|
+
* banner, simulator, invite acceptance, email templates, the job-status timeline, and the layered
|
|
5
|
+
* subsystems (agreements, messages/sms, notifications, webhooks). The app's namespaces register through
|
|
6
|
+
* the seam (src/app-config/messages.ts APP_NAMESPACES) and live in the host's `messages/*.json`.
|
|
7
|
+
*
|
|
8
|
+
* FRAMEWORK and APP namespaces are DISJOINT and together partition the merged catalog — enforced by
|
|
9
|
+
* the conformance suite's `i18n-partition` check (../testing/conformance/i18n.ts), in every app. That partition is PHYSICAL (ADR-0012): two catalogs, deep-merged at
|
|
10
|
+
* every load site (./messages.ts).
|
|
11
|
+
*
|
|
12
|
+
* `jobTimeline` resolves the old `jobs` caveat: the status labels the framework's JobTimeline renders
|
|
13
|
+
* are framework copy, so they split into their own namespace at the catalog split; the app's `jobs`
|
|
14
|
+
* namespace kept the export-card copy.
|
|
15
|
+
*/
|
|
16
|
+
export const FRAMEWORK_NAMESPACES = [
|
|
17
|
+
'shell',
|
|
18
|
+
'auth',
|
|
19
|
+
'profile',
|
|
20
|
+
'org',
|
|
21
|
+
'events',
|
|
22
|
+
'errors',
|
|
23
|
+
'banner',
|
|
24
|
+
'simulator',
|
|
25
|
+
'acceptInvite',
|
|
26
|
+
'email',
|
|
27
|
+
'agreements',
|
|
28
|
+
'messages',
|
|
29
|
+
'notifications',
|
|
30
|
+
'webhooks',
|
|
31
|
+
'jobTimeline',
|
|
32
|
+
] as const
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { loadAppMessages } from '@sssb/app-config/messages'
|
|
2
|
+
import { hasLocale } from 'next-intl'
|
|
3
|
+
import { getRequestConfig } from 'next-intl/server'
|
|
4
|
+
import { loadFrameworkMessages, mergeMessages } from './messages'
|
|
5
|
+
import { routing } from './routing'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* next-intl's request config — registered from next.config.ts, which points the plugin at this file's
|
|
9
|
+
* path inside the package. The catalog is COMPOSED at load: the framework's namespaces merged with the
|
|
10
|
+
* app's, which arrive through the ADR-0012 seam (`@sssb/app-config/messages`) — the framework never reaches
|
|
11
|
+
* the host's `messages/*.json` directly.
|
|
12
|
+
*/
|
|
13
|
+
// The merged tree is a pure function of the locale and the underlying JSON is static per build, so
|
|
14
|
+
// merge once per locale per process instead of re-walking the whole catalog on every request.
|
|
15
|
+
const mergedByLocale = new Map<string, ReturnType<typeof mergeMessages>>()
|
|
16
|
+
|
|
17
|
+
async function messagesFor(locale: string): Promise<ReturnType<typeof mergeMessages>> {
|
|
18
|
+
const cached = mergedByLocale.get(locale)
|
|
19
|
+
if (cached) return cached
|
|
20
|
+
const [framework, app] = await Promise.all([loadFrameworkMessages(locale), loadAppMessages(locale)])
|
|
21
|
+
const merged = mergeMessages(framework, app)
|
|
22
|
+
mergedByLocale.set(locale, merged)
|
|
23
|
+
return merged
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default getRequestConfig(async ({ requestLocale }) => {
|
|
27
|
+
const requested = await requestLocale
|
|
28
|
+
const locale = hasLocale(routing.locales, requested) ? requested : routing.defaultLocale
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
locale,
|
|
32
|
+
messages: await messagesFor(locale),
|
|
33
|
+
}
|
|
34
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Credential } from '../core/abilities'
|
|
2
|
+
import type { OrgIdentity } from '../db/org-lookup'
|
|
3
|
+
import type { AuthPort } from '../ports/auth'
|
|
4
|
+
import type { DbPort } from '../ports/db'
|
|
5
|
+
import { appInboundHandlers } from '@sssb/app-config/inbound-email'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The inbound-email handler registry — shaped like the job handler map in
|
|
9
|
+
* src/app-config/jobs.ts, but keyed by an OPEN
|
|
10
|
+
* string handler slug rather than an exhaustive union: adding email handlers is instance work (the
|
|
11
|
+
* "more email handlers" member of an already-demonstrated class), so the registry is a plain
|
|
12
|
+
* Record<string, InboundHandler>. The recipient address `<org-slug>+<handler>@domain` names the slug;
|
|
13
|
+
* intake looks it up here. A slug with no entry files the message 'unmatched' (handler NULL).
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** What a running handler is given: the ports it may touch plus the resolved tenant/org + the message. */
|
|
17
|
+
export interface InboundContext {
|
|
18
|
+
db: DbPort
|
|
19
|
+
auth: AuthPort
|
|
20
|
+
tenantId: string
|
|
21
|
+
orgId: string
|
|
22
|
+
orgSlug: string
|
|
23
|
+
/** The same org as `orgId` + `orgSlug`, as one value from `orgIdentityForSlug`'s one row, read in the
|
|
24
|
+
* tenant intake resolved: what `abilityActorFromCredential` takes, so a handler cannot pair one org's
|
|
25
|
+
* id with another's slug. */
|
|
26
|
+
org: OrgIdentity
|
|
27
|
+
/** Normalized sender addr-spec (lowercased, display name stripped). */
|
|
28
|
+
fromEmail: string
|
|
29
|
+
subject: string
|
|
30
|
+
/** Normalized plain-text body (quoted reply chain stripped — packages/kit/src/core/inbound-email.ts). */
|
|
31
|
+
bodyText: string
|
|
32
|
+
/** The inbound_emails row id this handler is processing. */
|
|
33
|
+
emailId: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A handler either PRODUCED its effect ('handled', naming the actor to attribute the audit event to) or
|
|
38
|
+
* DECLINED ('unmatched', with a reason — e.g. the sender is not a team member). A THROW is a third,
|
|
39
|
+
* separate outcome intake catches → 'failed' (the row is kept, the webhook still 200s). Handlers own
|
|
40
|
+
* their own domain audit event, with the same verb the equivalent product route would record; intake
|
|
41
|
+
* records the `inbound-email.received` intake event on top.
|
|
42
|
+
*
|
|
43
|
+
* `subjectId` is optional: the id of the row the handler created (the ticket an email opened), when it
|
|
44
|
+
* created one. Intake passes it through on its outcome, which is how a demo preset's `inbound` step can
|
|
45
|
+
* name what the email produced (`as`, @sssb/kit/core/presets.ts) for a later step to act on.
|
|
46
|
+
*/
|
|
47
|
+
export type InboundHandlerResult =
|
|
48
|
+
| {
|
|
49
|
+
status: 'handled'
|
|
50
|
+
actorUserId: string
|
|
51
|
+
/**
|
|
52
|
+
* The credential the actor acted with, for the intake's `inbound-email.received` row: the email
|
|
53
|
+
* itself when the handler matched a member (`auditActorOf(actor)` gives both fields). Omitted or
|
|
54
|
+
* null, the row records none, which is right for a synthetic or system actor.
|
|
55
|
+
*/
|
|
56
|
+
credential?: Credential | null
|
|
57
|
+
subjectId?: string
|
|
58
|
+
}
|
|
59
|
+
| { status: 'unmatched'; reason: string }
|
|
60
|
+
|
|
61
|
+
export type InboundHandler = (ctx: InboundContext) => Promise<InboundHandlerResult>
|
|
62
|
+
|
|
63
|
+
/** One handler per slug, composed like jobHandlers: framework handlers (none today) spread beside the
|
|
64
|
+
* app's registrations from the ADR-0012 seam. The slug is the `+tag` in `<org>+<slug>@domain`. */
|
|
65
|
+
export const inboundHandlers: Record<string, InboundHandler> = {
|
|
66
|
+
...appInboundHandlers,
|
|
67
|
+
}
|