@wtfalch/foundry 0.50.0 → 0.50.1

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.
@@ -4016,8 +4016,8 @@ async function switchOnArchonIdTokenUserinfo(context, deps) {
4016
4016
  try {
4017
4017
  done = await zitadel.updateOidcAppIdTokenUserinfoAssertion(orgId, projectId, appId);
4018
4018
  }
4019
- catch {
4020
- throw new Error(`platform:archon: switching on user info in the ID token failed for the sign-in client ${appId}`);
4019
+ catch (error) {
4020
+ throw new Error(`platform:archon: switching on user info in the ID token failed for the sign-in client ${appId}${zitadelRefusal(error)}`);
4021
4021
  }
4022
4022
  // A client that answers every property (`packages/local`) resolves to something else: no marker.
4023
4023
  if (typeof done !== 'boolean')
@@ -4052,13 +4052,29 @@ async function updateArchonPostLogoutUris(context, deps) {
4052
4052
  try {
4053
4053
  await zitadel.updateOidcAppPostLogoutRedirectUris(orgId, projectId, appId, uris);
4054
4054
  }
4055
- catch {
4056
- throw new Error(`platform:archon: updating the post-logout addresses failed for the sign-in client ${appId}`);
4055
+ catch (error) {
4056
+ throw new Error(`platform:archon: updating the post-logout addresses failed for the sign-in client ${appId}${zitadelRefusal(error)}`);
4057
4057
  }
4058
4058
  context.recordScopeId(PLATFORM_ARCHON_POST_LOGOUT_APPLIED_SCOPE_KEY, postLogoutAppliedValue(appId, uris));
4059
4059
  await context.persist?.();
4060
4060
  return {};
4061
4061
  }
4062
+ /**
4063
+ * What ZITADEL answered, for an error about one of Archon's sign-in client repairs: its HTTP status,
4064
+ * gRPC code and own message (ZITADEL's error ids, never a token or a request body), capped. Empty for
4065
+ * anything that is not a ZITADEL answer, so a network failure names no cause it cannot vouch for.
4066
+ */
4067
+ function zitadelRefusal(error) {
4068
+ if (!(error instanceof Error) || error.name !== 'ZitadelError')
4069
+ return '';
4070
+ const { status, code } = error;
4071
+ const parts = [
4072
+ typeof status === 'number' ? `HTTP ${status}` : '',
4073
+ typeof code === 'number' ? `code ${code}` : '',
4074
+ ];
4075
+ const said = error.message.slice(0, 200);
4076
+ return ` (ZITADEL answered ${[...parts.filter(Boolean), said].join(', ')})`;
4077
+ }
4062
4078
  /**
4063
4079
  * #339: registers `/auth/desktop/callback` on Archon's sign-in client
4064
4080
  * (`zitadel:desktop-callback` keyed {@link PLATFORM_ARCHON_KEY}), keeping the
@@ -4089,8 +4105,8 @@ async function registerArchonDesktopCallback(context, deps) {
4089
4105
  await zitadel.updateOidcAppRedirectUris(orgId, projectId, appId, union);
4090
4106
  }
4091
4107
  }
4092
- catch {
4093
- throw new Error(`platform:archon: registering the desktop callback failed for the sign-in client ${appId}`);
4108
+ catch (error) {
4109
+ throw new Error(`platform:archon: registering the desktop callback failed for the sign-in client ${appId}${zitadelRefusal(error)}`);
4094
4110
  }
4095
4111
  context.recordScopeId(PLATFORM_ARCHON_DESKTOP_CALLBACK_APPLIED_SCOPE_KEY, appId);
4096
4112
  await context.persist?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.50.0",
3
+ "version": "0.50.1",
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",