@wtfalch/foundry 0.72.2 → 0.73.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.
@@ -70,12 +70,14 @@ export declare const AUTH_TUNNEL_ROUTES_VERSION = "2";
70
70
  export declare const PLATFORM_AUTH_TUNNEL_ROUTES_SCOPE_KEY = "auth_tunnel_routes_applied";
71
71
  /**
72
72
  * The version of the env `provisionAuthStack` writes to the login apps (`LOGIN_MAIL_FROM`,
73
- * `LETTERMINT_API_TOKEN`, `LOGIN_PASSKEY_RP_ID`). Raise it when a key is added or its meaning changes, so an applied
73
+ * `LETTERMINT_API_TOKEN`, `LOGIN_PASSKEY_RP_ID`, `ZITADEL_DOMAIN`, `LOGIN_COMPANY_NAME`). Raise it when a key is added or its meaning changes, so an applied
74
74
  * sign-in plans its step once more and the apps get the env. Never holds a value.
75
75
  * 1: the login apps send their own invite and verification mail (auth 0.35.0, foundry 0.68.0).
76
76
  * 2: a company's login apps get `LOGIN_PASSKEY_RP_ID` (foundry 0.70.2).
77
+ * 3: the login apps get `ZITADEL_DOMAIN` (foundry 0.72.2; written from 0.72.3).
78
+ * 4: the login apps get `LOGIN_COMPANY_NAME`, the sign-in page's wordmark (foundry 0.73.0).
77
79
  */
78
- export declare const AUTH_LOGIN_ENV_VERSION = "2";
80
+ export declare const AUTH_LOGIN_ENV_VERSION = "4";
79
81
  /**
80
82
  * What the login apps' env is written for: the version, the sender address (`LOGIN_MAIL_FROM`) and the
81
83
  * passkey RP ID (`LOGIN_PASSKEY_RP_ID`, none for the platform and a company without its own domain).
@@ -77,12 +77,14 @@ export const AUTH_TUNNEL_ROUTES_VERSION = '2';
77
77
  export const PLATFORM_AUTH_TUNNEL_ROUTES_SCOPE_KEY = 'auth_tunnel_routes_applied';
78
78
  /**
79
79
  * The version of the env `provisionAuthStack` writes to the login apps (`LOGIN_MAIL_FROM`,
80
- * `LETTERMINT_API_TOKEN`, `LOGIN_PASSKEY_RP_ID`). Raise it when a key is added or its meaning changes, so an applied
80
+ * `LETTERMINT_API_TOKEN`, `LOGIN_PASSKEY_RP_ID`, `ZITADEL_DOMAIN`, `LOGIN_COMPANY_NAME`). Raise it when a key is added or its meaning changes, so an applied
81
81
  * sign-in plans its step once more and the apps get the env. Never holds a value.
82
82
  * 1: the login apps send their own invite and verification mail (auth 0.35.0, foundry 0.68.0).
83
83
  * 2: a company's login apps get `LOGIN_PASSKEY_RP_ID` (foundry 0.70.2).
84
+ * 3: the login apps get `ZITADEL_DOMAIN` (foundry 0.72.2; written from 0.72.3).
85
+ * 4: the login apps get `LOGIN_COMPANY_NAME`, the sign-in page's wordmark (foundry 0.73.0).
84
86
  */
85
- export const AUTH_LOGIN_ENV_VERSION = '2';
87
+ export const AUTH_LOGIN_ENV_VERSION = '4';
86
88
  /**
87
89
  * What the login apps' env is written for: the version, the sender address (`LOGIN_MAIL_FROM`) and the
88
90
  * passkey RP ID (`LOGIN_PASSKEY_RP_ID`, none for the platform and a company without its own domain).
@@ -1575,11 +1575,12 @@ const PLATFORM_AUTH_RESERVED_USERNAME = 'admin';
1575
1575
  /** #216 (building on #209/#215): the narrower `IAM_LOGIN_CLIENT` machine user for the login app and the broker. */
1576
1576
  const PLATFORM_AUTH_LOGIN_CLIENT_USER_NAME = 'foundry-login-client';
1577
1577
  export const PLATFORM_AUTH_ORG_NAME = 'foundry';
1578
+ const LOGIN_COMPANY_NAME_ENV = 'LOGIN_COMPANY_NAME';
1578
1579
  /**
1579
1580
  * The instance's first organisation (the default one, whose name the login shows as its wordmark).
1580
1581
  * A company's own instance passes the recorded id (the platform passes none and keeps the name `foundry`);
1581
- * found by that id when there is one, because a company's own instance has it renamed to the
1582
- * company's name (`applySigninMail`), and a lookup by name would then make a second `foundry` org. The
1582
+ * found by that id when there is one, because a company's own instance may have it renamed (foundry
1583
+ * before 0.73.0 did), and a lookup by name would then make a second `foundry` org. The
1583
1584
  * name is the way in only before the id is recorded. A recorded id ZITADEL no longer has is a failure,
1584
1585
  * never a reason to make another org.
1585
1586
  */
@@ -2228,6 +2229,11 @@ export async function provisionAuthStack(scope, deps, target, input) {
2228
2229
  },
2229
2230
  // #1086: the login builds redirects for an unbound host from this, never from a header.
2230
2231
  { key: 'ZITADEL_DOMAIN', value: hostname },
2232
+ // The wordmark on the sign-in page: a company's own name, `Archon` for the platform's login.
2233
+ {
2234
+ key: LOGIN_COMPANY_NAME_ENV,
2235
+ value: input.mailBranding ? signinMailName(input.mailBranding.companyName) : 'Archon',
2236
+ },
2231
2237
  { key: 'OTEL_NODE_RESOURCE_DETECTORS', value: 'none' },
2232
2238
  { key: 'API_CACHE_CONFIG', value: '{"defaultMinutes":2,"longMinutes":5}' },
2233
2239
  // #405: the login app's own requestId-free fallback (`resolveRedirectUri`
@@ -2856,17 +2862,12 @@ export async function provisionAuthStack(scope, deps, target, input) {
2856
2862
  (deps.signinMailWritable !== true ||
2857
2863
  typeof mailZitadel.ensureEmailOtpMessageText !== 'function' ||
2858
2864
  typeof mailZitadel.ensureLabelPolicy !== 'function' ||
2859
- typeof mailZitadel.ensureOrgName !== 'function' ||
2860
2865
  typeof mailZitadel.ensureEmailOtpGenerator !== 'function')) {
2861
2866
  console.info(`${label}: the host cannot write message texts, so the sign-in mail keeps ZITADEL's default text`);
2862
2867
  }
2863
2868
  else if (input.mailBranding) {
2864
- const firstOrgId = scope.recordedIds()[PLATFORM_ZITADEL_ORG_SCOPE_KEY];
2865
- if (!firstOrgId) {
2866
- throw new Error(`${label}: the instance's first organisation is not recorded`);
2867
- }
2868
2869
  try {
2869
- await applySigninMail(mailZitadel, input.mailBranding.companyName, firstOrgId);
2870
+ await applySigninMail(mailZitadel, input.mailBranding.companyName);
2870
2871
  }
2871
2872
  catch (error) {
2872
2873
  const cause = redactSecrets(error instanceof Error ? error.message : String(error), [
@@ -18,16 +18,8 @@ export declare const SIGNIN_MAIL_CODE: {
18
18
  readonly length: 6;
19
19
  readonly expirySeconds: 300;
20
20
  };
21
- /** The four ZITADEL calls the sign-in mail needs. */
21
+ /** The three ZITADEL calls the sign-in mail needs. */
22
22
  export interface PlatformZitadelMailBranding {
23
- /**
24
- * Renames an organisation, only when its name differs (`PUT /management/v1/orgs/me` as that
25
- * organisation). The login shows the instance's default organisation's name as its wordmark when the
26
- * host is bound to no company, so a company's own instance names it after the company.
27
- */
28
- ensureOrgName(orgId: string, name: string): Promise<{
29
- changed: boolean;
30
- }>;
31
23
  ensureEmailOtpMessageText(language: string, text: {
32
24
  title: string;
33
25
  preHeader: string;
@@ -104,7 +96,7 @@ export declare const SIGNIN_MAIL_LABEL_POLICY: {
104
96
  readonly warnColorDark: "#FF9C8C";
105
97
  readonly disableWatermark: true;
106
98
  };
107
- /** Names the default organisation after the company, then writes the text, the look and the code, each only when it differs. Throws the client's fixed-text error. */
108
- export declare function applySigninMail(zitadel: PlatformZitadelMailBranding, companyName: string, defaultOrgId: string): Promise<{
99
+ /** Writes the text, the look and the code, each only when it differs. Throws the client's fixed-text error. The wordmark is the login's `LOGIN_COMPANY_NAME`, not an organisation name. */
100
+ export declare function applySigninMail(zitadel: PlatformZitadelMailBranding, companyName: string): Promise<{
109
101
  changed: boolean;
110
102
  }>;
@@ -71,13 +71,12 @@ export const SIGNIN_MAIL_LABEL_POLICY = {
71
71
  warnColorDark: '#FF9C8C',
72
72
  disableWatermark: true,
73
73
  };
74
- /** Names the default organisation after the company, then writes the text, the look and the code, each only when it differs. Throws the client's fixed-text error. */
75
- export async function applySigninMail(zitadel, companyName, defaultOrgId) {
76
- const name = await zitadel.ensureOrgName(defaultOrgId, signinMailName(companyName));
74
+ /** Writes the text, the look and the code, each only when it differs. Throws the client's fixed-text error. The wordmark is the login's `LOGIN_COMPANY_NAME`, not an organisation name. */
75
+ export async function applySigninMail(zitadel, companyName) {
77
76
  const text = await zitadel.ensureEmailOtpMessageText(SIGNIN_MAIL_LANGUAGE, signinMailText(companyName));
78
77
  const look = await zitadel.ensureLabelPolicy({ ...SIGNIN_MAIL_LABEL_POLICY });
79
78
  const code = await zitadel.ensureEmailOtpGenerator({ ...SIGNIN_MAIL_CODE });
80
79
  return {
81
- changed: name.changed || text.changed || look.changed || code.changed,
80
+ changed: text.changed || look.changed || code.changed,
82
81
  };
83
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.72.2",
3
+ "version": "0.73.0",
4
4
  "description": "Foundry's SDK: the declared org's types, the plan and apply contracts, and the state store's interface.",
5
5
  "repository": {
6
6
  "type": "git",