@vonall/auth 0.4.0 → 0.6.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +14 -7
  3. package/dist/index.d.ts +1 -1
  4. package/dist/messages.d.ts +460 -16
  5. package/dist/messages.js +4 -14
  6. package/dist/remote/app_user.remote.d.ts +2 -2
  7. package/dist/remote/app_user.remote.js +13 -13
  8. package/dist/remote/einladung.remote.js +15 -12
  9. package/dist/server/{registry.d.ts → context.d.ts} +13 -16
  10. package/dist/server/context.js +22 -0
  11. package/dist/server/create.d.ts +27 -22
  12. package/dist/server/create.js +50 -33
  13. package/dist/server/index.d.ts +7 -7
  14. package/dist/server/index.js +6 -6
  15. package/dist/server/loads.d.ts +14 -2
  16. package/dist/server/loads.js +19 -14
  17. package/dist/server/repositories/EinladungRepo.d.ts +4 -1
  18. package/dist/server/repositories/EinladungRepo.js +66 -73
  19. package/dist/server/repositories/UserRepo.d.ts +4 -1
  20. package/dist/server/repositories/UserRepo.js +49 -57
  21. package/dist/server/service/einladung.service.d.ts +6 -2
  22. package/dist/server/service/einladung.service.js +56 -51
  23. package/dist/server/service/mail.d.ts +16 -12
  24. package/dist/server/service/mail.js +32 -34
  25. package/dist/testing/index.d.ts +6 -8
  26. package/dist/testing/index.js +16 -19
  27. package/dist/ui/AdminView.svelte +2 -1
  28. package/dist/ui/InvitationsTab.svelte +2 -1
  29. package/dist/ui/LoginForm.svelte +1 -1
  30. package/dist/ui/ResetPasswordForm.svelte +2 -2
  31. package/dist/ui/context.d.ts +6 -7
  32. package/dist/ui/context.js +15 -9
  33. package/dist/util/signup.d.ts +2 -0
  34. package/dist/util/signup.js +2 -0
  35. package/package.json +3 -2
  36. package/dist/server/registry.js +0 -22
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @vonall/auth
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#17](https://github.com/SebastianvonAllmen/vonall-libs/pull/17) [`f1d99ba`](https://github.com/SebastianvonAllmen/vonall-libs/commit/f1d99ba19b46d4f3a0eb8dd7ed595c9a513b6d0f) Thanks [@SebastianvonAllmen](https://github.com/SebastianvonAllmen)! - An explicit context instead of the registry singleton. `@vonall/auth`: `createAuth(options)` returns `{ options, register }`; `register(auth)` gives `{ ctx, sessionHandle, apiHandler }` and checks the instance's plugins against the schema's options (`admin` is read off the schema, no longer an option). The repositories, services and mails are functions of the context (`userRepo(ctx)`, `einladungRepo(ctx)`, `einladungService(ctx)`, `authMails(ctx)`); remote functions read it with `authContext()`, loads with `contextOf(locals)`; the session handle puts it into `event.locals.auth`. `setAuthUi({ authClient })` takes only the client: the app's name, locale and signup mode come through the page data of the package's loads. `testAuth(db)` returns the context, `createUser(ctx, email)`. `@vonall/mcp`: `createMcp({ auth: ctx, … })`, `mcpPlugins(origin)` replaces `mcpPluginOptions`/`CIMD_OPTIONS`, `agentRepo(ctx)`, `mcpContext()`, `agentsTab()` with its own strings; `ConsentPage` and `AgentsTab` take no `appName`/`locale`; `@vonall/auth` is a peer dependency.
8
+
9
+ ## 0.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#16](https://github.com/SebastianvonAllmen/vonall-libs/pull/16) [`b2b45e6`](https://github.com/SebastianvonAllmen/vonall-libs/commit/b2b45e653396341b0023777d0d8de1ddee62f50d) Thanks [@SebastianvonAllmen](https://github.com/SebastianvonAllmen)! - One messages helper: `@vonall/messages` exports `defineMessages({ en, de })`, and every package's `configure…Messages({ locale })` takes the app's locale as is ("de-CH", "en-GB"), the language derived from it. In development, reading a package's strings before configuring them throws. The `Locale` type is gone. `@vonall/auth`: the near-duplicate keys `invalidEmailDot`, `passwordsDontMatchDot` and `passwordTooShortDot` are merged into `invalidEmail`, `passwordsMismatch` and `passwordTooShort`; `inviteIntro` takes the number of days.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`b2b45e6`](https://github.com/SebastianvonAllmen/vonall-libs/commit/b2b45e653396341b0023777d0d8de1ddee62f50d)]:
18
+ - @vonall/messages@0.1.0
19
+ - @vonall/mail@0.2.0
20
+
3
21
  ## 0.4.0
4
22
 
5
23
  ### Minor Changes
package/README.md CHANGED
@@ -13,16 +13,19 @@ export const { user, session, account, verification, twoFactor, rateLimit, einla
13
13
 
14
14
  // src/lib/auth.ts: the wiring, once; the instance is built here so its types (every plugin's) are inferred here
15
15
  import { ac, roles } from "@vonall/auth";
16
- import { authOptions, registerAuth } from "@vonall/auth/server";
16
+ import { createAuth } from "@vonall/auth/server";
17
17
  import { betterAuth } from "better-auth";
18
18
  import { admin } from "better-auth/plugins";
19
19
  import { twoFactor } from "better-auth/plugins/two-factor";
20
20
  import { sveltekitCookies } from "better-auth/svelte-kit";
21
+ const wiring = createAuth({ db, schema, secret: BETTER_AUTH_SECRET, origin: ORIGIN, appName: APP_NAME, locale: LOCALE, signupMode: SIGNUP_MODE, mailer, social: { github: { clientId, clientSecret } }, log: logger });
21
22
  export const auth = betterAuth({
22
- ...authOptions({ db, schema, secret: BETTER_AUTH_SECRET, origin: ORIGIN, appName: APP_NAME, locale: LOCALE, signupMode: SIGNUP_MODE, mailer, admin: true, social: { github: { clientId, clientSecret } }, log: logger }),
23
+ ...wiring.options,
23
24
  plugins: [twoFactor(), admin({ ac, roles }), /* the MCP endpoint's, from @vonall/mcp */ sveltekitCookies(getRequestEvent)],
24
25
  });
25
- export const { handle: sessionHandle, apiHandler, providers } = registerAuth(auth);
26
+ // The context: everything with accounts outside a request takes it (createMcp, scripts, tests); inside a request it is
27
+ // `event.locals.auth`. register() checks the instance's plugins against the schema's options (admin, mcp).
28
+ export const { ctx, sessionHandle, apiHandler } = wiring.register(auth);
26
29
 
27
30
  // src/lib/auth-client.ts createAuthClient({ baseURL: PUBLIC_ORIGIN, plugins: [twoFactorClient(), adminClient({ ac, roles })] }) (from "better-auth/svelte")
28
31
  // src/hooks.server.ts sequence(securityHeaders, sessionHandle)
@@ -33,10 +36,13 @@ export const { handle: sessionHandle, apiHandler, providers } = registerAuth(aut
33
36
 
34
37
  Entry points: `@vonall/auth` (types, validation schemas, `ac`/`roles` for the admin plugins, `isAdmin`, `mayInvite`, the
35
38
  fresh-session helpers, the messages), `@vonall/auth/schema`, `@vonall/auth/server`, `@vonall/auth/remote` (the remote
36
- functions a Product's components call), `@vonall/auth/testing` (`createUser`, `testAuth` for db tests). `better-auth` is
39
+ functions a Product's components call), `@vonall/auth/testing` (`testAuth(db)` gives the context, `createUser(ctx)` an account, for db tests). `better-auth` is
37
40
  this package's dependency; the Product imports its plugins from the same version. `@node-rs/argon2` (the password
38
41
  hash, a native module) is a peer dependency: the Product lists it, so its server bundle can leave it external.
39
42
 
43
+ The server side is functions of the context: `userRepo(ctx)`, `einladungRepo(ctx)`, `einladungService(ctx)`, `authMails(ctx)`;
44
+ a remote function gets it with `authContext()`, a load with `contextOf(locals)`.
45
+
40
46
  Strings come in English and German: `configureAuthMessages({ locale, overrides })`. A Product's own user-owned tables
41
47
  reference `user.id` with `onDelete: "cascade"`, so deleting a Konto takes everything with it. The MCP endpoint's
42
48
  better-auth plugins and rate limit rule come from `@vonall/mcp` through `plugins` and `rateLimitRules`.
@@ -44,17 +50,18 @@ better-auth plugins and rate limit rule come from `@vonall/mcp` through `plugins
44
50
  ## The pages and the settings (`@vonall/auth/ui`)
45
51
 
46
52
  ```svelte
47
- <!-- src/routes/+layout.svelte: once, so the components know the client, the app and its language -->
53
+ <!-- src/routes/+layout.svelte: once, so the components know the client; the app's name, locale and signup mode
54
+ reach them through the page data of this package's loads (authLayoutLoad, homeLayoutLoad, einladungLoad) -->
48
55
  <script lang="ts">
49
56
  import { setAuthUi } from "@vonall/auth/ui";
50
- setAuthUi({ authClient, appName: APP_NAME, locale: LOCALE, signupMode: SIGNUP_MODE });
57
+ setAuthUi({ authClient });
51
58
  </script>
52
59
 
53
60
  <!-- src/routes/auth/login/+page.svelte --> <LoginForm>{#snippet footer()}…the privacy line…{/snippet}</LoginForm>
54
61
  <!-- src/routes/auth/signup/+page.svelte --> <RegisterForm />
55
62
  <!-- src/routes/auth/reset-password --> <ResetPasswordForm />
56
63
  <!-- src/routes/einladung/[token] --> <EinladungPage {data} tagline={APP_TAGLINE} />
57
- <!-- src/routes/home/settings --> <SettingsPage extraTabs={[{ id: "agents", label, hint, icon: Bot }]}>{#snippet extra(id)}…{/snippet}</SettingsPage>
64
+ <!-- src/routes/home/settings --> <SettingsPage extraTabs={[agentsTab()]}>{#snippet extra(id)}…{/snippet}</SettingsPage>
58
65
  <!-- src/routes/home/manage_user --> <AdminView currentUserId={data.currentUserId} />
59
66
  ```
60
67
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { configureAuthMessages, m, type AuthMessages, type Locale } from "./messages.js";
1
+ export { configureAuthMessages, m, type AuthMessages } from "./messages.js";
2
2
  export { ac, adminRole, roles, userRole } from "./permissions.js";
3
3
  export { emailSchema, MIN_PASSWORD_LENGTH, nameSchema, passwordSchema, SIGNUP_MODES, SIGNUP_STATES, type AppUserClient, type EinladungInfo, type OffeneEinladung, type SessionUser, type SignupMode, type SignupState, type UserInsert, type UserSelect, } from "./types.js";
4
4
  export { isSessionNotFresh, isStale, reauthPath, SESSION_NOT_FRESH } from "./util/fresh.js";
@@ -1,8 +1,3 @@
1
- /**
2
- * The package's strings, in English and German (Swiss spelling): what the server answers, what the mails say, and
3
- * (from the UI release on) what the pages show. A Product calls configureAuthMessages once, from a module its root
4
- * layout and its server wiring import, with its LOCALE and the few words it wants differently; code reads `m()`.
5
- */
6
1
  export declare const en: {
7
2
  needsEinladung: string;
8
3
  noMail: string;
@@ -61,7 +56,6 @@ export declare const en: {
61
56
  resetLinkNotSent: string;
62
57
  resetLinkSent: string;
63
58
  resetLinkNotRequested: string;
64
- invalidEmailDot: string;
65
59
  twoFactorTitle: string;
66
60
  twoFactorEnterCode: string;
67
61
  confirm: string;
@@ -78,7 +72,6 @@ export declare const en: {
78
72
  inviteOnly: (app: string) => string;
79
73
  alreadyHaveAccount: string;
80
74
  repeatPassword: string;
81
- passwordsDontMatchDot: string;
82
75
  needsValidEinladung: string;
83
76
  emailInUse: string;
84
77
  signupFailed: string;
@@ -86,7 +79,6 @@ export declare const en: {
86
79
  resetIntro: string;
87
80
  resetNoToken: string;
88
81
  resetLinkInvalid: string;
89
- passwordTooShortDot: (min: number) => string;
90
82
  newPassword: string;
91
83
  confirmNewPassword: string;
92
84
  savePassword: string;
@@ -192,7 +184,7 @@ export declare const en: {
192
184
  providerNotLinked: (provider: string) => string;
193
185
  providerNotUnlinked: (provider: string) => string;
194
186
  inviteSomeone: string;
195
- inviteIntro: string;
187
+ inviteIntro: (days: number) => string;
196
188
  linkWord: string;
197
189
  validUntil: (date: string) => string;
198
190
  withdrawInvitation: string;
@@ -238,10 +230,462 @@ export declare const en: {
238
230
  };
239
231
  export type AuthMessages = typeof en;
240
232
  export declare const de: AuthMessages;
241
- export type Locale = "en" | "de";
242
- export declare function configureAuthMessages({ locale, overrides }: {
243
- locale: Locale;
244
- overrides?: Partial<AuthMessages>;
245
- }): void;
246
- /** The configured messages. */
247
- export declare const m: () => AuthMessages;
233
+ export declare const m: () => {
234
+ needsEinladung: string;
235
+ noMail: string;
236
+ onlyAdminsInvite: string;
237
+ einladungUnbekannt: string;
238
+ einladungAbgelaufen: string;
239
+ einladungAngenommen: string;
240
+ unauthorized: string;
241
+ forbidden: string;
242
+ ownRole: string;
243
+ ownAccount: string;
244
+ passwordsMismatch: string;
245
+ mailFailed: string;
246
+ invalidEmail: string;
247
+ passwordTooShort: (min: number) => string;
248
+ nameRequired: string;
249
+ nameTooLong: (max: number) => string;
250
+ hello: (name: string) => string;
251
+ resetSubject: (app: string) => string;
252
+ resetText: (name: string, app: string, link: string) => string;
253
+ resetButton: string;
254
+ resetBody: (app: string) => string;
255
+ resetNotYou: string;
256
+ verifySubject: (app: string) => string;
257
+ verifyText: (name: string, app: string, link: string) => string;
258
+ verifyButton: string;
259
+ verifyBody: (app: string) => string;
260
+ verifyNotYou: string;
261
+ einladungSubject: (inviter: string, app: string) => string;
262
+ einladungText: (inviter: string, app: string, link: string, validUntil: string) => string;
263
+ einladungTitle: (app: string) => string;
264
+ einladungButton: string;
265
+ einladungHello: string;
266
+ einladungBody: (inviter: string, app: string) => string;
267
+ einladungValid: (validUntil: string) => string;
268
+ welcomeBack: string;
269
+ logInTo: (app: string) => string;
270
+ forgotPassword: string;
271
+ forgotIntro: string;
272
+ email: string;
273
+ emailPlaceholder: string;
274
+ password: string;
275
+ sendTheLink: string;
276
+ backToLogin: string;
277
+ orWithEmail: string;
278
+ logIn: string;
279
+ noAccountYet: string;
280
+ signUp: string;
281
+ continueWith: (provider: string) => string;
282
+ accountNotLinked: string;
283
+ noNewAccountInvite: string;
284
+ noNewAccountOpen: string;
285
+ loginTooOld: string;
286
+ confirmEmailFirst: string;
287
+ loginFailed: string;
288
+ resetLinkNotSent: string;
289
+ resetLinkSent: string;
290
+ resetLinkNotRequested: string;
291
+ twoFactorTitle: string;
292
+ twoFactorEnterCode: string;
293
+ confirm: string;
294
+ cancel: string;
295
+ invalidCode: string;
296
+ wrongCode: string;
297
+ codeNotVerified: string;
298
+ createAccount: string;
299
+ invitesYouTo: (inviter: string, app: string) => string;
300
+ signUpWith: (providers: string) => string;
301
+ or: string;
302
+ almostDone: (email: string, app: string) => string;
303
+ accountReady: string;
304
+ inviteOnly: (app: string) => string;
305
+ alreadyHaveAccount: string;
306
+ repeatPassword: string;
307
+ needsValidEinladung: string;
308
+ emailInUse: string;
309
+ signupFailed: string;
310
+ resetTitle: string;
311
+ resetIntro: string;
312
+ resetNoToken: string;
313
+ resetLinkInvalid: string;
314
+ newPassword: string;
315
+ confirmNewPassword: string;
316
+ savePassword: string;
317
+ passwordNotReset: string;
318
+ passwordWasReset: string;
319
+ somethingWentWrong: string;
320
+ invitationTitle: string;
321
+ invitationTo: (app: string) => string;
322
+ invitesYou: (inviter: string) => string;
323
+ askForNewLink: string;
324
+ toStartPage: string;
325
+ alreadyHaveAccountNoInvite: string;
326
+ openApp: (app: string) => string;
327
+ iHaveAnAccount: string;
328
+ settingsTitle: string;
329
+ backToOverview: string;
330
+ user: string;
331
+ profile: string;
332
+ memberSince: (since: string) => string;
333
+ tabProfile: string;
334
+ tabProfileHint: string;
335
+ tabSecurity: string;
336
+ tabSecurityHint: string;
337
+ tabSessions: string;
338
+ tabSessionsHint: string;
339
+ tabLinks: string;
340
+ tabLinksHint: string;
341
+ tabInvitations: string;
342
+ tabInvitationsHint: string;
343
+ tabDeletion: string;
344
+ tabDeletionHint: string;
345
+ name: string;
346
+ yourName: string;
347
+ save: string;
348
+ saving: string;
349
+ profileUpdated: string;
350
+ profileNotUpdated: string;
351
+ loadingSecurity: string;
352
+ changePassword: string;
353
+ changing: string;
354
+ passwordChanged: string;
355
+ passwordNotChanged: string;
356
+ currentPassword: string;
357
+ confirmNewPasswordShort: string;
358
+ setPassword: string;
359
+ setPasswordIntro: string;
360
+ setPasswordButton: string;
361
+ passwordSet: string;
362
+ passwordNotSet: string;
363
+ twoFactorHeading: string;
364
+ twoFactorIntro: string;
365
+ on: string;
366
+ off: string;
367
+ twoFactorProtects: string;
368
+ yourPassword: string;
369
+ turningOff: string;
370
+ turnOff: string;
371
+ turnOff2fa: string;
372
+ scanQr: string;
373
+ qrAlt: string;
374
+ scanWithApp: string;
375
+ saveBackupCodes: string;
376
+ backupCodesIntro: string;
377
+ copyBackupCodes: string;
378
+ backupCodesCopied: string;
379
+ confirmSetup: string;
380
+ enterCodeFromApp: string;
381
+ checking: string;
382
+ turnOn2fa: string;
383
+ setup2faIntro: string;
384
+ starting: string;
385
+ start2faSetup: string;
386
+ enterPasswordOn: string;
387
+ enterPasswordOff: string;
388
+ twoFactorNotOn: string;
389
+ twoFactorNotOff: string;
390
+ twoFactorIsOn: string;
391
+ twoFactorIsOff: string;
392
+ setupNotStarted: string;
393
+ activeSessions: string;
394
+ devicesLoggedIn: string;
395
+ endAllOthers: string;
396
+ noActiveSessions: string;
397
+ unknownBrowser: string;
398
+ thisSession: string;
399
+ noIpAddress: string;
400
+ lastActive: (when: string) => string;
401
+ unknown: string;
402
+ sessionEnded: string;
403
+ sessionNotEnded: string;
404
+ otherSessionsEnded: string;
405
+ otherSessionsNotEnded: string;
406
+ linkedAccounts: string;
407
+ linkedIntro: string;
408
+ linked: string;
409
+ notLinked: string;
410
+ unlink: string;
411
+ link: string;
412
+ noSocialLogin: string;
413
+ autoLinkNote: string;
414
+ providerLinked: (provider: string) => string;
415
+ providerUnlinked: (provider: string) => string;
416
+ providerNotLinked: (provider: string) => string;
417
+ providerNotUnlinked: (provider: string) => string;
418
+ inviteSomeone: string;
419
+ inviteIntro: (days: number) => string;
420
+ linkWord: string;
421
+ validUntil: (date: string) => string;
422
+ withdrawInvitation: string;
423
+ invitationWithdrawn: string;
424
+ invitationNotWithdrawn: string;
425
+ emailOptional: string;
426
+ creating: string;
427
+ createInvitation: string;
428
+ copy: string;
429
+ share: string;
430
+ linkShownOnce: string;
431
+ invitationText: (app: string, link: string) => string;
432
+ shareYourself: (error: string) => string;
433
+ invitationSentTo: (email: string) => string;
434
+ invitationNotCreated: string;
435
+ linkCopied: string;
436
+ copyLinkFailed: string;
437
+ deleteForGood: string;
438
+ cannotBeUndone: string;
439
+ deletionText: string;
440
+ deletionAgents: string;
441
+ deletionNoLogin: string;
442
+ typeToContinue: string;
443
+ type: string;
444
+ deleteWord: string;
445
+ deleting: string;
446
+ deletePermanently: string;
447
+ accountDeleted: string;
448
+ accountNotDeleted: string;
449
+ administration: string;
450
+ accounts: string;
451
+ since: (date: string) => string;
452
+ you: string;
453
+ roleOf: (name: string) => string;
454
+ roleChanged: string;
455
+ deleteAccountOf: (name: string) => string;
456
+ confirmDeleteAccount: (name: string) => string;
457
+ accountDeletedAdmin: string;
458
+ invitations: string;
459
+ noOpenInvitations: string;
460
+ by: (inviter: string) => string;
461
+ didntWork: string;
462
+ }, configureAuthMessages: import("@vonall/messages").Configure<{
463
+ needsEinladung: string;
464
+ noMail: string;
465
+ onlyAdminsInvite: string;
466
+ einladungUnbekannt: string;
467
+ einladungAbgelaufen: string;
468
+ einladungAngenommen: string;
469
+ unauthorized: string;
470
+ forbidden: string;
471
+ ownRole: string;
472
+ ownAccount: string;
473
+ passwordsMismatch: string;
474
+ mailFailed: string;
475
+ invalidEmail: string;
476
+ passwordTooShort: (min: number) => string;
477
+ nameRequired: string;
478
+ nameTooLong: (max: number) => string;
479
+ hello: (name: string) => string;
480
+ resetSubject: (app: string) => string;
481
+ resetText: (name: string, app: string, link: string) => string;
482
+ resetButton: string;
483
+ resetBody: (app: string) => string;
484
+ resetNotYou: string;
485
+ verifySubject: (app: string) => string;
486
+ verifyText: (name: string, app: string, link: string) => string;
487
+ verifyButton: string;
488
+ verifyBody: (app: string) => string;
489
+ verifyNotYou: string;
490
+ einladungSubject: (inviter: string, app: string) => string;
491
+ einladungText: (inviter: string, app: string, link: string, validUntil: string) => string;
492
+ einladungTitle: (app: string) => string;
493
+ einladungButton: string;
494
+ einladungHello: string;
495
+ einladungBody: (inviter: string, app: string) => string;
496
+ einladungValid: (validUntil: string) => string;
497
+ welcomeBack: string;
498
+ logInTo: (app: string) => string;
499
+ forgotPassword: string;
500
+ forgotIntro: string;
501
+ email: string;
502
+ emailPlaceholder: string;
503
+ password: string;
504
+ sendTheLink: string;
505
+ backToLogin: string;
506
+ orWithEmail: string;
507
+ logIn: string;
508
+ noAccountYet: string;
509
+ signUp: string;
510
+ continueWith: (provider: string) => string;
511
+ accountNotLinked: string;
512
+ noNewAccountInvite: string;
513
+ noNewAccountOpen: string;
514
+ loginTooOld: string;
515
+ confirmEmailFirst: string;
516
+ loginFailed: string;
517
+ resetLinkNotSent: string;
518
+ resetLinkSent: string;
519
+ resetLinkNotRequested: string;
520
+ twoFactorTitle: string;
521
+ twoFactorEnterCode: string;
522
+ confirm: string;
523
+ cancel: string;
524
+ invalidCode: string;
525
+ wrongCode: string;
526
+ codeNotVerified: string;
527
+ createAccount: string;
528
+ invitesYouTo: (inviter: string, app: string) => string;
529
+ signUpWith: (providers: string) => string;
530
+ or: string;
531
+ almostDone: (email: string, app: string) => string;
532
+ accountReady: string;
533
+ inviteOnly: (app: string) => string;
534
+ alreadyHaveAccount: string;
535
+ repeatPassword: string;
536
+ needsValidEinladung: string;
537
+ emailInUse: string;
538
+ signupFailed: string;
539
+ resetTitle: string;
540
+ resetIntro: string;
541
+ resetNoToken: string;
542
+ resetLinkInvalid: string;
543
+ newPassword: string;
544
+ confirmNewPassword: string;
545
+ savePassword: string;
546
+ passwordNotReset: string;
547
+ passwordWasReset: string;
548
+ somethingWentWrong: string;
549
+ invitationTitle: string;
550
+ invitationTo: (app: string) => string;
551
+ invitesYou: (inviter: string) => string;
552
+ askForNewLink: string;
553
+ toStartPage: string;
554
+ alreadyHaveAccountNoInvite: string;
555
+ openApp: (app: string) => string;
556
+ iHaveAnAccount: string;
557
+ settingsTitle: string;
558
+ backToOverview: string;
559
+ user: string;
560
+ profile: string;
561
+ memberSince: (since: string) => string;
562
+ tabProfile: string;
563
+ tabProfileHint: string;
564
+ tabSecurity: string;
565
+ tabSecurityHint: string;
566
+ tabSessions: string;
567
+ tabSessionsHint: string;
568
+ tabLinks: string;
569
+ tabLinksHint: string;
570
+ tabInvitations: string;
571
+ tabInvitationsHint: string;
572
+ tabDeletion: string;
573
+ tabDeletionHint: string;
574
+ name: string;
575
+ yourName: string;
576
+ save: string;
577
+ saving: string;
578
+ profileUpdated: string;
579
+ profileNotUpdated: string;
580
+ loadingSecurity: string;
581
+ changePassword: string;
582
+ changing: string;
583
+ passwordChanged: string;
584
+ passwordNotChanged: string;
585
+ currentPassword: string;
586
+ confirmNewPasswordShort: string;
587
+ setPassword: string;
588
+ setPasswordIntro: string;
589
+ setPasswordButton: string;
590
+ passwordSet: string;
591
+ passwordNotSet: string;
592
+ twoFactorHeading: string;
593
+ twoFactorIntro: string;
594
+ on: string;
595
+ off: string;
596
+ twoFactorProtects: string;
597
+ yourPassword: string;
598
+ turningOff: string;
599
+ turnOff: string;
600
+ turnOff2fa: string;
601
+ scanQr: string;
602
+ qrAlt: string;
603
+ scanWithApp: string;
604
+ saveBackupCodes: string;
605
+ backupCodesIntro: string;
606
+ copyBackupCodes: string;
607
+ backupCodesCopied: string;
608
+ confirmSetup: string;
609
+ enterCodeFromApp: string;
610
+ checking: string;
611
+ turnOn2fa: string;
612
+ setup2faIntro: string;
613
+ starting: string;
614
+ start2faSetup: string;
615
+ enterPasswordOn: string;
616
+ enterPasswordOff: string;
617
+ twoFactorNotOn: string;
618
+ twoFactorNotOff: string;
619
+ twoFactorIsOn: string;
620
+ twoFactorIsOff: string;
621
+ setupNotStarted: string;
622
+ activeSessions: string;
623
+ devicesLoggedIn: string;
624
+ endAllOthers: string;
625
+ noActiveSessions: string;
626
+ unknownBrowser: string;
627
+ thisSession: string;
628
+ noIpAddress: string;
629
+ lastActive: (when: string) => string;
630
+ unknown: string;
631
+ sessionEnded: string;
632
+ sessionNotEnded: string;
633
+ otherSessionsEnded: string;
634
+ otherSessionsNotEnded: string;
635
+ linkedAccounts: string;
636
+ linkedIntro: string;
637
+ linked: string;
638
+ notLinked: string;
639
+ unlink: string;
640
+ link: string;
641
+ noSocialLogin: string;
642
+ autoLinkNote: string;
643
+ providerLinked: (provider: string) => string;
644
+ providerUnlinked: (provider: string) => string;
645
+ providerNotLinked: (provider: string) => string;
646
+ providerNotUnlinked: (provider: string) => string;
647
+ inviteSomeone: string;
648
+ inviteIntro: (days: number) => string;
649
+ linkWord: string;
650
+ validUntil: (date: string) => string;
651
+ withdrawInvitation: string;
652
+ invitationWithdrawn: string;
653
+ invitationNotWithdrawn: string;
654
+ emailOptional: string;
655
+ creating: string;
656
+ createInvitation: string;
657
+ copy: string;
658
+ share: string;
659
+ linkShownOnce: string;
660
+ invitationText: (app: string, link: string) => string;
661
+ shareYourself: (error: string) => string;
662
+ invitationSentTo: (email: string) => string;
663
+ invitationNotCreated: string;
664
+ linkCopied: string;
665
+ copyLinkFailed: string;
666
+ deleteForGood: string;
667
+ cannotBeUndone: string;
668
+ deletionText: string;
669
+ deletionAgents: string;
670
+ deletionNoLogin: string;
671
+ typeToContinue: string;
672
+ type: string;
673
+ deleteWord: string;
674
+ deleting: string;
675
+ deletePermanently: string;
676
+ accountDeleted: string;
677
+ accountNotDeleted: string;
678
+ administration: string;
679
+ accounts: string;
680
+ since: (date: string) => string;
681
+ you: string;
682
+ roleOf: (name: string) => string;
683
+ roleChanged: string;
684
+ deleteAccountOf: (name: string) => string;
685
+ confirmDeleteAccount: (name: string) => string;
686
+ accountDeletedAdmin: string;
687
+ invitations: string;
688
+ noOpenInvitations: string;
689
+ by: (inviter: string) => string;
690
+ didntWork: string;
691
+ }>;
package/dist/messages.js CHANGED
@@ -3,6 +3,7 @@
3
3
  * (from the UI release on) what the pages show. A Product calls configureAuthMessages once, from a module its root
4
4
  * layout and its server wiring import, with its LOCALE and the few words it wants differently; code reads `m()`.
5
5
  */
6
+ import { defineMessages } from "@vonall/messages";
6
7
  export const en = {
7
8
  // Signup
8
9
  needsEinladung: "Signing up needs an invitation",
@@ -67,7 +68,6 @@ export const en = {
67
68
  resetLinkNotSent: "The reset link could not be sent.",
68
69
  resetLinkSent: "If an account with this email address exists, a link to reset the password has been sent.",
69
70
  resetLinkNotRequested: "The reset link could not be requested.",
70
- invalidEmailDot: "Please enter a valid email address.",
71
71
  // Two-factor on login
72
72
  twoFactorTitle: "Two-factor authentication",
73
73
  twoFactorEnterCode: "Enter the 6-digit code from your authenticator app.",
@@ -86,7 +86,6 @@ export const en = {
86
86
  inviteOnly: (app) => `${app} is invite only. Ask someone who already has an account for an invitation link and open it on this device.`,
87
87
  alreadyHaveAccount: "Already have an account?",
88
88
  repeatPassword: "Repeat the password",
89
- passwordsDontMatchDot: "The passwords don't match.",
90
89
  needsValidEinladung: "Signing up needs a valid invitation.",
91
90
  emailInUse: "This email address is already in use.",
92
91
  signupFailed: "Signing up failed.",
@@ -95,7 +94,6 @@ export const en = {
95
94
  resetIntro: "Enter your new password",
96
95
  resetNoToken: "No valid token found. Please request a new link to reset your password.",
97
96
  resetLinkInvalid: "The reset link is invalid or incomplete.",
98
- passwordTooShortDot: (min) => `The password needs at least ${min} characters.`,
99
97
  newPassword: "New password",
100
98
  confirmNewPassword: "Confirm the new password",
101
99
  savePassword: "Save the password",
@@ -207,7 +205,7 @@ export const en = {
207
205
  providerNotUnlinked: (provider) => `${provider} could not be unlinked`,
208
206
  // Invitations
209
207
  inviteSomeone: "Invite someone",
210
- inviteIntro: "An invitation link works once and for 14 days. Whoever opens it can create an account.",
208
+ inviteIntro: (days) => `An invitation link works once and for ${days} days. Whoever opens it can create an account.`,
211
209
  linkWord: "Link",
212
210
  validUntil: (date) => `valid until ${date}`,
213
211
  withdrawInvitation: "Withdraw invitation",
@@ -311,7 +309,6 @@ export const de = {
311
309
  resetLinkNotSent: "Der Link zum Zurücksetzen konnte nicht verschickt werden.",
312
310
  resetLinkSent: "Wenn es ein Konto mit dieser E-Mail-Adresse gibt, ist ein Link zum Zurücksetzen des Passworts unterwegs.",
313
311
  resetLinkNotRequested: "Der Link zum Zurücksetzen konnte nicht angefordert werden.",
314
- invalidEmailDot: "Bitte gib eine gültige E-Mail-Adresse ein.",
315
312
  twoFactorTitle: "Zwei-Faktor-Authentisierung",
316
313
  twoFactorEnterCode: "Gib den 6-stelligen Code aus deiner Authenticator-App ein.",
317
314
  confirm: "Bestätigen",
@@ -328,7 +325,6 @@ export const de = {
328
325
  inviteOnly: (app) => `${app} gibt es nur auf Einladung. Frag jemanden, der schon ein Konto hat, nach einem Einladungslink und öffne ihn auf diesem Gerät.`,
329
326
  alreadyHaveAccount: "Schon ein Konto?",
330
327
  repeatPassword: "Passwort wiederholen",
331
- passwordsDontMatchDot: "Die Passwörter stimmen nicht überein.",
332
328
  needsValidEinladung: "Zum Registrieren braucht es eine gültige Einladung.",
333
329
  emailInUse: "Diese E-Mail-Adresse wird schon verwendet.",
334
330
  signupFailed: "Die Registrierung hat nicht geklappt.",
@@ -336,7 +332,6 @@ export const de = {
336
332
  resetIntro: "Gib dein neues Passwort ein",
337
333
  resetNoToken: "Kein gültiger Link. Bitte fordere einen neuen Link zum Zurücksetzen an.",
338
334
  resetLinkInvalid: "Der Link zum Zurücksetzen ist ungültig oder unvollständig.",
339
- passwordTooShortDot: (min) => `Das Passwort braucht mindestens ${min} Zeichen.`,
340
335
  newPassword: "Neues Passwort",
341
336
  confirmNewPassword: "Neues Passwort bestätigen",
342
337
  savePassword: "Passwort speichern",
@@ -442,7 +437,7 @@ export const de = {
442
437
  providerNotLinked: (provider) => `${provider} konnte nicht verknüpft werden`,
443
438
  providerNotUnlinked: (provider) => `${provider} konnte nicht getrennt werden`,
444
439
  inviteSomeone: "Jemanden einladen",
445
- inviteIntro: "Ein Einladungslink funktioniert einmal und 14 Tage lang. Wer ihn öffnet, kann ein Konto erstellen.",
440
+ inviteIntro: (days) => `Ein Einladungslink funktioniert einmal und ${days} Tage lang. Wer ihn öffnet, kann ein Konto erstellen.`,
446
441
  linkWord: "Link",
447
442
  validUntil: (date) => `gültig bis ${date}`,
448
443
  withdrawInvitation: "Einladung zurückziehen",
@@ -486,9 +481,4 @@ export const de = {
486
481
  by: (inviter) => `von ${inviter}`,
487
482
  didntWork: "Das hat nicht geklappt.",
488
483
  };
489
- let current = en;
490
- export function configureAuthMessages({ locale, overrides }) {
491
- current = { ...(locale === "de" ? de : en), ...overrides };
492
- }
493
- /** The configured messages. */
494
- export const m = () => current;
484
+ export const { m, configure: configureAuthMessages } = defineMessages({ en, de });