@zyphr-dev/node-sdk 0.1.37 → 0.1.39

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/dist/index.js CHANGED
@@ -5092,6 +5092,47 @@ function InboxNotificationResponseToJSONTyped(value, ignoreDiscriminator = false
5092
5092
  };
5093
5093
  }
5094
5094
 
5095
+ // src/src/models/InviteEndUserRequest.ts
5096
+ var InviteEndUserRequestSendLinkEnum = {
5097
+ MAGIC: "magic",
5098
+ PASSWORD_RESET: "password_reset",
5099
+ NONE: "none"
5100
+ };
5101
+ function instanceOfInviteEndUserRequest(value) {
5102
+ if (!("email" in value) || value["email"] === void 0) return false;
5103
+ return true;
5104
+ }
5105
+ function InviteEndUserRequestFromJSON(json) {
5106
+ return InviteEndUserRequestFromJSONTyped(json, false);
5107
+ }
5108
+ function InviteEndUserRequestFromJSONTyped(json, ignoreDiscriminator) {
5109
+ if (json == null) {
5110
+ return json;
5111
+ }
5112
+ return {
5113
+ "email": json["email"],
5114
+ "name": json["name"] == null ? void 0 : json["name"],
5115
+ "metadata": json["metadata"] == null ? void 0 : json["metadata"],
5116
+ "sendLink": json["send_link"] == null ? void 0 : json["send_link"],
5117
+ "redirectUrl": json["redirect_url"] == null ? void 0 : json["redirect_url"]
5118
+ };
5119
+ }
5120
+ function InviteEndUserRequestToJSON(json) {
5121
+ return InviteEndUserRequestToJSONTyped(json, false);
5122
+ }
5123
+ function InviteEndUserRequestToJSONTyped(value, ignoreDiscriminator = false) {
5124
+ if (value == null) {
5125
+ return value;
5126
+ }
5127
+ return {
5128
+ "email": value["email"],
5129
+ "name": value["name"],
5130
+ "metadata": value["metadata"],
5131
+ "send_link": value["sendLink"],
5132
+ "redirect_url": value["redirectUrl"]
5133
+ };
5134
+ }
5135
+
5095
5136
  // src/src/models/ListWaaSApplications200Response.ts
5096
5137
  function instanceOfListWaaSApplications200Response(value) {
5097
5138
  return true;
@@ -6471,6 +6512,37 @@ function OAuthProviderToJSONTyped(value, ignoreDiscriminator = false) {
6471
6512
  };
6472
6513
  }
6473
6514
 
6515
+ // src/src/models/OAuthProviderName.ts
6516
+ var OAuthProviderName = {
6517
+ GOOGLE: "google",
6518
+ APPLE: "apple",
6519
+ FACEBOOK: "facebook",
6520
+ GITHUB: "github",
6521
+ MICROSOFT: "microsoft"
6522
+ };
6523
+ function instanceOfOAuthProviderName(value) {
6524
+ for (const key in OAuthProviderName) {
6525
+ if (Object.prototype.hasOwnProperty.call(OAuthProviderName, key)) {
6526
+ if (OAuthProviderName[key] === value) {
6527
+ return true;
6528
+ }
6529
+ }
6530
+ }
6531
+ return false;
6532
+ }
6533
+ function OAuthProviderNameFromJSON(json) {
6534
+ return OAuthProviderNameFromJSONTyped(json, false);
6535
+ }
6536
+ function OAuthProviderNameFromJSONTyped(json, ignoreDiscriminator) {
6537
+ return json;
6538
+ }
6539
+ function OAuthProviderNameToJSON(value) {
6540
+ return value;
6541
+ }
6542
+ function OAuthProviderNameToJSONTyped(value, ignoreDiscriminator) {
6543
+ return value;
6544
+ }
6545
+
6474
6546
  // src/src/models/OAuthProvidersResponseData.ts
6475
6547
  function instanceOfOAuthProvidersResponseData(value) {
6476
6548
  return true;
@@ -10054,6 +10126,33 @@ function SetDomainInboundRequestToJSONTyped(value, ignoreDiscriminator = false)
10054
10126
  };
10055
10127
  }
10056
10128
 
10129
+ // src/src/models/SetEndUserClaimsRequest.ts
10130
+ function instanceOfSetEndUserClaimsRequest(value) {
10131
+ return true;
10132
+ }
10133
+ function SetEndUserClaimsRequestFromJSON(json) {
10134
+ return SetEndUserClaimsRequestFromJSONTyped(json, false);
10135
+ }
10136
+ function SetEndUserClaimsRequestFromJSONTyped(json, ignoreDiscriminator) {
10137
+ if (json == null) {
10138
+ return json;
10139
+ }
10140
+ return {
10141
+ "claims": json["claims"] == null ? void 0 : json["claims"]
10142
+ };
10143
+ }
10144
+ function SetEndUserClaimsRequestToJSON(json) {
10145
+ return SetEndUserClaimsRequestToJSONTyped(json, false);
10146
+ }
10147
+ function SetEndUserClaimsRequestToJSONTyped(value, ignoreDiscriminator = false) {
10148
+ if (value == null) {
10149
+ return value;
10150
+ }
10151
+ return {
10152
+ "claims": value["claims"]
10153
+ };
10154
+ }
10155
+
10057
10156
  // src/src/models/SetPreferencesRequestPreferencesInner.ts
10058
10157
  function instanceOfSetPreferencesRequestPreferencesInner(value) {
10059
10158
  return true;
@@ -10128,7 +10227,9 @@ function SignInAnonymouslyRequestFromJSONTyped(json, ignoreDiscriminator) {
10128
10227
  return {
10129
10228
  "deviceId": json["device_id"],
10130
10229
  "name": json["name"] == null ? void 0 : json["name"],
10131
- "metadata": json["metadata"] == null ? void 0 : json["metadata"]
10230
+ "metadata": json["metadata"] == null ? void 0 : json["metadata"],
10231
+ "organizationId": json["organization_id"] == null ? void 0 : json["organization_id"],
10232
+ "organizationRole": json["organization_role"] == null ? void 0 : json["organization_role"]
10132
10233
  };
10133
10234
  }
10134
10235
  function SignInAnonymouslyRequestToJSON(json) {
@@ -10141,7 +10242,80 @@ function SignInAnonymouslyRequestToJSONTyped(value, ignoreDiscriminator = false)
10141
10242
  return {
10142
10243
  "device_id": value["deviceId"],
10143
10244
  "name": value["name"],
10144
- "metadata": value["metadata"]
10245
+ "metadata": value["metadata"],
10246
+ "organization_id": value["organizationId"],
10247
+ "organization_role": value["organizationRole"]
10248
+ };
10249
+ }
10250
+
10251
+ // src/src/models/SignInWithGameCenterRequest.ts
10252
+ function instanceOfSignInWithGameCenterRequest(value) {
10253
+ if (!("playerId" in value) || value["playerId"] === void 0) return false;
10254
+ if (!("publicKeyUrl" in value) || value["publicKeyUrl"] === void 0) return false;
10255
+ if (!("signature" in value) || value["signature"] === void 0) return false;
10256
+ if (!("salt" in value) || value["salt"] === void 0) return false;
10257
+ if (!("timestamp" in value) || value["timestamp"] === void 0) return false;
10258
+ if (!("bundleId" in value) || value["bundleId"] === void 0) return false;
10259
+ return true;
10260
+ }
10261
+ function SignInWithGameCenterRequestFromJSON(json) {
10262
+ return SignInWithGameCenterRequestFromJSONTyped(json, false);
10263
+ }
10264
+ function SignInWithGameCenterRequestFromJSONTyped(json, ignoreDiscriminator) {
10265
+ if (json == null) {
10266
+ return json;
10267
+ }
10268
+ return {
10269
+ "playerId": json["playerId"],
10270
+ "publicKeyUrl": json["publicKeyUrl"],
10271
+ "signature": json["signature"],
10272
+ "salt": json["salt"],
10273
+ "timestamp": json["timestamp"],
10274
+ "bundleId": json["bundleId"]
10275
+ };
10276
+ }
10277
+ function SignInWithGameCenterRequestToJSON(json) {
10278
+ return SignInWithGameCenterRequestToJSONTyped(json, false);
10279
+ }
10280
+ function SignInWithGameCenterRequestToJSONTyped(value, ignoreDiscriminator = false) {
10281
+ if (value == null) {
10282
+ return value;
10283
+ }
10284
+ return {
10285
+ "playerId": value["playerId"],
10286
+ "publicKeyUrl": value["publicKeyUrl"],
10287
+ "signature": value["signature"],
10288
+ "salt": value["salt"],
10289
+ "timestamp": value["timestamp"],
10290
+ "bundleId": value["bundleId"]
10291
+ };
10292
+ }
10293
+
10294
+ // src/src/models/SignInWithGooglePlayGamesRequest.ts
10295
+ function instanceOfSignInWithGooglePlayGamesRequest(value) {
10296
+ if (!("serverAuthCode" in value) || value["serverAuthCode"] === void 0) return false;
10297
+ return true;
10298
+ }
10299
+ function SignInWithGooglePlayGamesRequestFromJSON(json) {
10300
+ return SignInWithGooglePlayGamesRequestFromJSONTyped(json, false);
10301
+ }
10302
+ function SignInWithGooglePlayGamesRequestFromJSONTyped(json, ignoreDiscriminator) {
10303
+ if (json == null) {
10304
+ return json;
10305
+ }
10306
+ return {
10307
+ "serverAuthCode": json["serverAuthCode"]
10308
+ };
10309
+ }
10310
+ function SignInWithGooglePlayGamesRequestToJSON(json) {
10311
+ return SignInWithGooglePlayGamesRequestToJSONTyped(json, false);
10312
+ }
10313
+ function SignInWithGooglePlayGamesRequestToJSONTyped(value, ignoreDiscriminator = false) {
10314
+ if (value == null) {
10315
+ return value;
10316
+ }
10317
+ return {
10318
+ "serverAuthCode": value["serverAuthCode"]
10145
10319
  };
10146
10320
  }
10147
10321
 
@@ -11800,6 +11974,41 @@ function UpdateCategoryRequestToJSONTyped(value, ignoreDiscriminator = false) {
11800
11974
  };
11801
11975
  }
11802
11976
 
11977
+ // src/src/models/UpdateEndUserByApplicationRequest.ts
11978
+ function instanceOfUpdateEndUserByApplicationRequest(value) {
11979
+ return true;
11980
+ }
11981
+ function UpdateEndUserByApplicationRequestFromJSON(json) {
11982
+ return UpdateEndUserByApplicationRequestFromJSONTyped(json, false);
11983
+ }
11984
+ function UpdateEndUserByApplicationRequestFromJSONTyped(json, ignoreDiscriminator) {
11985
+ if (json == null) {
11986
+ return json;
11987
+ }
11988
+ return {
11989
+ "email": json["email"] == null ? void 0 : json["email"],
11990
+ "name": json["name"] == null ? void 0 : json["name"],
11991
+ "avatarUrl": json["avatar_url"] == null ? void 0 : json["avatar_url"],
11992
+ "metadata": json["metadata"] == null ? void 0 : json["metadata"],
11993
+ "status": json["status"] == null ? void 0 : json["status"]
11994
+ };
11995
+ }
11996
+ function UpdateEndUserByApplicationRequestToJSON(json) {
11997
+ return UpdateEndUserByApplicationRequestToJSONTyped(json, false);
11998
+ }
11999
+ function UpdateEndUserByApplicationRequestToJSONTyped(value, ignoreDiscriminator = false) {
12000
+ if (value == null) {
12001
+ return value;
12002
+ }
12003
+ return {
12004
+ "email": value["email"],
12005
+ "name": value["name"],
12006
+ "avatar_url": value["avatarUrl"],
12007
+ "metadata": value["metadata"],
12008
+ "status": value["status"]
12009
+ };
12010
+ }
12011
+
11803
12012
  // src/src/models/UpdateEndUserRequest.ts
11804
12013
  function instanceOfUpdateEndUserRequest(value) {
11805
12014
  return true;
@@ -16685,7 +16894,7 @@ var AuthRegistrationApi = class extends BaseAPI {
16685
16894
  return await response.value();
16686
16895
  }
16687
16896
  /**
16688
- * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
16897
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert. Pass an optional `organization_id` to create the anonymous user directly in an organization; the returned access token then carries `org_id` (and `orgs`), matching the org-scoped register/login flow.
16689
16898
  * Sign in anonymously
16690
16899
  */
16691
16900
  async signInAnonymouslyRaw(requestParameters, initOverrides) {
@@ -16711,13 +16920,81 @@ var AuthRegistrationApi = class extends BaseAPI {
16711
16920
  return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
16712
16921
  }
16713
16922
  /**
16714
- * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
16923
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert. Pass an optional `organization_id` to create the anonymous user directly in an organization; the returned access token then carries `org_id` (and `orgs`), matching the org-scoped register/login flow.
16715
16924
  * Sign in anonymously
16716
16925
  */
16717
16926
  async signInAnonymously(signInAnonymouslyRequest, initOverrides) {
16718
16927
  const response = await this.signInAnonymouslyRaw({ signInAnonymouslyRequest }, initOverrides);
16719
16928
  return await response.value();
16720
16929
  }
16930
+ /**
16931
+ * Exchange an Apple Game Center identity-verification assertion for a Zyphr end-user session. Zyphr independently re-verifies the assertion server-side (Apple certificate chain, RSA-SHA256 signature, timestamp freshness, single-use replay guard, and bundle-id binding) before provisioning-or-looking-up the user and minting tokens. The user is keyed on the modern scoped `playerId` (gamePlayerID). ## Producing the assertion (Integration) The assertion is produced **on-device by the iOS app** — there is no server-side way to mint it. The app calls GameKit\'s `GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)`, which returns `publicKeyURL`, `signature`, `salt`, and `timestamp`; combine those with the local player\'s `gamePlayerID` and the app\'s bundle identifier and submit them here. Two integration shapes are supported: - **client-direct** — the iOS app holds the Zyphr application public key and calls this endpoint itself. - **backend-relayed** — the app forwards the fetched assertion fields to the customer\'s own backend, which relays them to this endpoint; the app never holds Zyphr keys. (This is the common shape for games.) On any verification failure the response is a single opaque `401` `invalid_assertion` — the specific control that failed is never disclosed.
16932
+ * Sign in with Apple Game Center
16933
+ */
16934
+ async signInWithGameCenterRaw(requestParameters, initOverrides) {
16935
+ if (requestParameters["signInWithGameCenterRequest"] == null) {
16936
+ throw new RequiredError(
16937
+ "signInWithGameCenterRequest",
16938
+ 'Required parameter "signInWithGameCenterRequest" was null or undefined when calling signInWithGameCenter().'
16939
+ );
16940
+ }
16941
+ const queryParameters = {};
16942
+ const headerParameters = {};
16943
+ headerParameters["Content-Type"] = "application/json";
16944
+ if (this.configuration && this.configuration.apiKey) {
16945
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16946
+ }
16947
+ const response = await this.request({
16948
+ path: `/auth/game-center`,
16949
+ method: "POST",
16950
+ headers: headerParameters,
16951
+ query: queryParameters,
16952
+ body: SignInWithGameCenterRequestToJSON(requestParameters["signInWithGameCenterRequest"])
16953
+ }, initOverrides);
16954
+ return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
16955
+ }
16956
+ /**
16957
+ * Exchange an Apple Game Center identity-verification assertion for a Zyphr end-user session. Zyphr independently re-verifies the assertion server-side (Apple certificate chain, RSA-SHA256 signature, timestamp freshness, single-use replay guard, and bundle-id binding) before provisioning-or-looking-up the user and minting tokens. The user is keyed on the modern scoped `playerId` (gamePlayerID). ## Producing the assertion (Integration) The assertion is produced **on-device by the iOS app** — there is no server-side way to mint it. The app calls GameKit\'s `GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)`, which returns `publicKeyURL`, `signature`, `salt`, and `timestamp`; combine those with the local player\'s `gamePlayerID` and the app\'s bundle identifier and submit them here. Two integration shapes are supported: - **client-direct** — the iOS app holds the Zyphr application public key and calls this endpoint itself. - **backend-relayed** — the app forwards the fetched assertion fields to the customer\'s own backend, which relays them to this endpoint; the app never holds Zyphr keys. (This is the common shape for games.) On any verification failure the response is a single opaque `401` `invalid_assertion` — the specific control that failed is never disclosed.
16958
+ * Sign in with Apple Game Center
16959
+ */
16960
+ async signInWithGameCenter(signInWithGameCenterRequest, initOverrides) {
16961
+ const response = await this.signInWithGameCenterRaw({ signInWithGameCenterRequest }, initOverrides);
16962
+ return await response.value();
16963
+ }
16964
+ /**
16965
+ * Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google\'s OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer\'s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr\'s own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
16966
+ * Sign in with Google Play Games Services
16967
+ */
16968
+ async signInWithGooglePlayGamesRaw(requestParameters, initOverrides) {
16969
+ if (requestParameters["signInWithGooglePlayGamesRequest"] == null) {
16970
+ throw new RequiredError(
16971
+ "signInWithGooglePlayGamesRequest",
16972
+ 'Required parameter "signInWithGooglePlayGamesRequest" was null or undefined when calling signInWithGooglePlayGames().'
16973
+ );
16974
+ }
16975
+ const queryParameters = {};
16976
+ const headerParameters = {};
16977
+ headerParameters["Content-Type"] = "application/json";
16978
+ if (this.configuration && this.configuration.apiKey) {
16979
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16980
+ }
16981
+ const response = await this.request({
16982
+ path: `/auth/google-play-games`,
16983
+ method: "POST",
16984
+ headers: headerParameters,
16985
+ query: queryParameters,
16986
+ body: SignInWithGooglePlayGamesRequestToJSON(requestParameters["signInWithGooglePlayGamesRequest"])
16987
+ }, initOverrides);
16988
+ return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
16989
+ }
16990
+ /**
16991
+ * Exchange a Google Play Games Services (GPGS) **server auth code** for a Zyphr end-user session. Unlike Game Center (which submits an Apple-signed assertion), GPGS is verified by Google: Zyphr exchanges the single-use server auth code at Google\'s OAuth2 token endpoint, then calls the Play Games REST API (`players/me`) server-side to obtain the trusted, tamper-proof `playerId`. The user is provisioned-or-looked-up on that server-fetched `playerId` and tokens are minted. ## Producing the server auth code (Integration) The server auth code is obtained **on-device by the Android app** — there is no server-side way to mint it. The app calls `GamesSignInClient.requestServerSideAccess(serverClientId, …)` using the Google Cloud **web (server) client id** configured for the game, which returns a single-use auth code string. Submit that string here as `serverAuthCode`. The **backend-relayed** shape is the common one: the app forwards the auth code to the customer\'s own backend, which relays it to this endpoint; the app never holds Zyphr keys. ## Security The `playerId` is derived **only** from Zyphr\'s own server-side call to Google after the token exchange — a client-supplied player id is never accepted or trusted. On any verification failure the response is a single opaque `401` `invalid_auth_code`; the specific control that failed is never disclosed.
16992
+ * Sign in with Google Play Games Services
16993
+ */
16994
+ async signInWithGooglePlayGames(signInWithGooglePlayGamesRequest, initOverrides) {
16995
+ const response = await this.signInWithGooglePlayGamesRaw({ signInWithGooglePlayGamesRequest }, initOverrides);
16996
+ return await response.value();
16997
+ }
16721
16998
  };
16722
16999
 
16723
17000
  // src/src/apis/AuthSessionsApi.ts
@@ -16867,50 +17144,88 @@ var AuthSessionsApi = class extends BaseAPI {
16867
17144
  }
16868
17145
  };
16869
17146
 
16870
- // src/src/apis/AuthUserProfileApi.ts
16871
- var AuthUserProfileApi = class extends BaseAPI {
17147
+ // src/src/apis/AuthUserDirectoryApi.ts
17148
+ var AuthUserDirectoryApi = class extends BaseAPI {
16872
17149
  /**
16873
- * Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
16874
- * Delete current end user account
17150
+ * Secret-key-scoped admin soft-delete for an arbitrary end user in the authenticating application. Works in both test and live environments. Scoped to the application via the application_id filter — a caller can never delete a user belonging to another application. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status=\'deleted\'), and emits a `user.deleted` webhook with `method=\'application_admin\'`. The audit log row survives (no FK to end_users), so org-history queries still resolve.
17151
+ * Delete an end user (server-side admin)
16875
17152
  */
16876
- async deleteEndUserRaw(initOverrides) {
17153
+ async deleteEndUserByApplicationRaw(requestParameters, initOverrides) {
17154
+ if (requestParameters["userId"] == null) {
17155
+ throw new RequiredError(
17156
+ "userId",
17157
+ 'Required parameter "userId" was null or undefined when calling deleteEndUserByApplication().'
17158
+ );
17159
+ }
16877
17160
  const queryParameters = {};
16878
17161
  const headerParameters = {};
16879
- if (this.configuration && this.configuration.accessToken) {
16880
- const token = this.configuration.accessToken;
16881
- const tokenString = await token("EndUserToken", []);
16882
- if (tokenString) {
16883
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
16884
- }
17162
+ if (this.configuration && this.configuration.apiKey) {
17163
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
16885
17164
  }
16886
17165
  if (this.configuration && this.configuration.apiKey) {
16887
17166
  headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16888
17167
  }
16889
17168
  const response = await this.request({
16890
- path: `/auth/users/me`,
17169
+ path: `/auth/users/{user_id}`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
16891
17170
  method: "DELETE",
16892
17171
  headers: headerParameters,
16893
17172
  query: queryParameters
16894
17173
  }, initOverrides);
16895
- return new JSONApiResponse(response, (jsonValue) => EndUserDeleteResponseFromJSON(jsonValue));
17174
+ return new VoidApiResponse(response);
16896
17175
  }
16897
17176
  /**
16898
- * Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
16899
- * Delete current end user account
17177
+ * Secret-key-scoped admin soft-delete for an arbitrary end user in the authenticating application. Works in both test and live environments. Scoped to the application via the application_id filter — a caller can never delete a user belonging to another application. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status=\'deleted\'), and emits a `user.deleted` webhook with `method=\'application_admin\'`. The audit log row survives (no FK to end_users), so org-history queries still resolve.
17178
+ * Delete an end user (server-side admin)
16900
17179
  */
16901
- async deleteEndUser(initOverrides) {
16902
- const response = await this.deleteEndUserRaw(initOverrides);
16903
- return await response.value();
17180
+ async deleteEndUserByApplication(userId, initOverrides) {
17181
+ await this.deleteEndUserByApplicationRaw({ userId }, initOverrides);
16904
17182
  }
16905
17183
  /**
16906
- * App-credentialed soft-delete for an end user, scoped to the test environment only. Live-mode credentials receive 403 — this is the intentional safety guard against a misconfigured CI runner nuking production users. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status=\'deleted\'), and emits a `user.deleted` webhook with `method=\'application_admin\'`. The audit log row survives (no FK to end_users), so org-history queries still resolve. Intended for smoke / test-fixture cleanup. Production deletes should continue to use `DELETE /auth/users/me` from the end-user\'s own session or the dashboard.
16907
- * Delete an end user (test environment only)
17184
+ * Secret-key-scoped lookup of a single end user by email address within the authenticating application. Scoped to the application — never resolves a user from another application. Does not return the password hash.
17185
+ * Look up an end user by email (server-side admin)
16908
17186
  */
16909
- async deleteEndUserByApplicationRaw(requestParameters, initOverrides) {
17187
+ async getEndUserByEmailRaw(requestParameters, initOverrides) {
17188
+ if (requestParameters["email"] == null) {
17189
+ throw new RequiredError(
17190
+ "email",
17191
+ 'Required parameter "email" was null or undefined when calling getEndUserByEmail().'
17192
+ );
17193
+ }
17194
+ const queryParameters = {};
17195
+ if (requestParameters["email"] != null) {
17196
+ queryParameters["email"] = requestParameters["email"];
17197
+ }
17198
+ const headerParameters = {};
17199
+ if (this.configuration && this.configuration.apiKey) {
17200
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
17201
+ }
17202
+ if (this.configuration && this.configuration.apiKey) {
17203
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
17204
+ }
17205
+ const response = await this.request({
17206
+ path: `/auth/users/by-email`,
17207
+ method: "GET",
17208
+ headers: headerParameters,
17209
+ query: queryParameters
17210
+ }, initOverrides);
17211
+ return new VoidApiResponse(response);
17212
+ }
17213
+ /**
17214
+ * Secret-key-scoped lookup of a single end user by email address within the authenticating application. Scoped to the application — never resolves a user from another application. Does not return the password hash.
17215
+ * Look up an end user by email (server-side admin)
17216
+ */
17217
+ async getEndUserByEmail(email, initOverrides) {
17218
+ await this.getEndUserByEmailRaw({ email }, initOverrides);
17219
+ }
17220
+ /**
17221
+ * Secret-key-scoped fetch of a single end user by id within the authenticating application. Scoped to the application — a caller can never read a user belonging to another application.
17222
+ * Get an end user by id (server-side admin)
17223
+ */
17224
+ async getEndUserByIdRaw(requestParameters, initOverrides) {
16910
17225
  if (requestParameters["userId"] == null) {
16911
17226
  throw new RequiredError(
16912
17227
  "userId",
16913
- 'Required parameter "userId" was null or undefined when calling deleteEndUserByApplication().'
17228
+ 'Required parameter "userId" was null or undefined when calling getEndUserById().'
16914
17229
  );
16915
17230
  }
16916
17231
  const queryParameters = {};
@@ -16923,18 +17238,253 @@ var AuthUserProfileApi = class extends BaseAPI {
16923
17238
  }
16924
17239
  const response = await this.request({
16925
17240
  path: `/auth/users/{user_id}`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
16926
- method: "DELETE",
17241
+ method: "GET",
16927
17242
  headers: headerParameters,
16928
17243
  query: queryParameters
16929
17244
  }, initOverrides);
16930
17245
  return new VoidApiResponse(response);
16931
17246
  }
16932
17247
  /**
16933
- * App-credentialed soft-delete for an end user, scoped to the test environment only. Live-mode credentials receive 403 — this is the intentional safety guard against a misconfigured CI runner nuking production users. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status=\'deleted\'), and emits a `user.deleted` webhook with `method=\'application_admin\'`. The audit log row survives (no FK to end_users), so org-history queries still resolve. Intended for smoke / test-fixture cleanup. Production deletes should continue to use `DELETE /auth/users/me` from the end-user\'s own session or the dashboard.
16934
- * Delete an end user (test environment only)
17248
+ * Secret-key-scoped fetch of a single end user by id within the authenticating application. Scoped to the application — a caller can never read a user belonging to another application.
17249
+ * Get an end user by id (server-side admin)
16935
17250
  */
16936
- async deleteEndUserByApplication(userId, initOverrides) {
16937
- await this.deleteEndUserByApplicationRaw({ userId }, initOverrides);
17251
+ async getEndUserById(userId, initOverrides) {
17252
+ await this.getEndUserByIdRaw({ userId }, initOverrides);
17253
+ }
17254
+ /**
17255
+ * Secret-key-scoped read of the authoritative custom_claims stored for an end user. These are the TRUSTED claims embedded into the user\'s JWTs on login/refresh — use them (not the client-writable `metadata` field) for authorization decisions. Returns an empty object when none are set.
17256
+ * Get an end user\'s stored custom claims (server-side admin)
17257
+ */
17258
+ async getEndUserClaimsRaw(requestParameters, initOverrides) {
17259
+ if (requestParameters["userId"] == null) {
17260
+ throw new RequiredError(
17261
+ "userId",
17262
+ 'Required parameter "userId" was null or undefined when calling getEndUserClaims().'
17263
+ );
17264
+ }
17265
+ const queryParameters = {};
17266
+ const headerParameters = {};
17267
+ if (this.configuration && this.configuration.apiKey) {
17268
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
17269
+ }
17270
+ if (this.configuration && this.configuration.apiKey) {
17271
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
17272
+ }
17273
+ const response = await this.request({
17274
+ path: `/auth/users/{user_id}/claims`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
17275
+ method: "GET",
17276
+ headers: headerParameters,
17277
+ query: queryParameters
17278
+ }, initOverrides);
17279
+ return new VoidApiResponse(response);
17280
+ }
17281
+ /**
17282
+ * Secret-key-scoped read of the authoritative custom_claims stored for an end user. These are the TRUSTED claims embedded into the user\'s JWTs on login/refresh — use them (not the client-writable `metadata` field) for authorization decisions. Returns an empty object when none are set.
17283
+ * Get an end user\'s stored custom claims (server-side admin)
17284
+ */
17285
+ async getEndUserClaims(userId, initOverrides) {
17286
+ await this.getEndUserClaimsRaw({ userId }, initOverrides);
17287
+ }
17288
+ /**
17289
+ * Secret-key-scoped pre-provisioning for an end user. Creates a passwordless user in the authenticating application (idempotent on email — an existing, non-deleted user is reused, not duplicated) and, when `send_link` is set, sends a first-login link so the user can set up their account without self-registration. - `send_link: \"magic\"` sends a magic-link sign-in email. - `send_link: \"password_reset\"` sends a set-password email. - `send_link: \"none\"` (default) creates the user with no email. A `redirect_url` is required when `send_link` is \"magic\" or \"password_reset\"; it must match the application\'s redirect_uris allowlist (custom schemes such as yourapp://path are permitted).
17290
+ * Pre-provision (invite) an end user (server-side admin)
17291
+ */
17292
+ async inviteEndUserRaw(requestParameters, initOverrides) {
17293
+ if (requestParameters["inviteEndUserRequest"] == null) {
17294
+ throw new RequiredError(
17295
+ "inviteEndUserRequest",
17296
+ 'Required parameter "inviteEndUserRequest" was null or undefined when calling inviteEndUser().'
17297
+ );
17298
+ }
17299
+ const queryParameters = {};
17300
+ const headerParameters = {};
17301
+ headerParameters["Content-Type"] = "application/json";
17302
+ if (this.configuration && this.configuration.apiKey) {
17303
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
17304
+ }
17305
+ if (this.configuration && this.configuration.apiKey) {
17306
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
17307
+ }
17308
+ const response = await this.request({
17309
+ path: `/auth/users/invite`,
17310
+ method: "POST",
17311
+ headers: headerParameters,
17312
+ query: queryParameters,
17313
+ body: InviteEndUserRequestToJSON(requestParameters["inviteEndUserRequest"])
17314
+ }, initOverrides);
17315
+ return new VoidApiResponse(response);
17316
+ }
17317
+ /**
17318
+ * Secret-key-scoped pre-provisioning for an end user. Creates a passwordless user in the authenticating application (idempotent on email — an existing, non-deleted user is reused, not duplicated) and, when `send_link` is set, sends a first-login link so the user can set up their account without self-registration. - `send_link: \"magic\"` sends a magic-link sign-in email. - `send_link: \"password_reset\"` sends a set-password email. - `send_link: \"none\"` (default) creates the user with no email. A `redirect_url` is required when `send_link` is \"magic\" or \"password_reset\"; it must match the application\'s redirect_uris allowlist (custom schemes such as yourapp://path are permitted).
17319
+ * Pre-provision (invite) an end user (server-side admin)
17320
+ */
17321
+ async inviteEndUser(inviteEndUserRequest, initOverrides) {
17322
+ await this.inviteEndUserRaw({ inviteEndUserRequest }, initOverrides);
17323
+ }
17324
+ /**
17325
+ * Secret-key-scoped directory listing of end users in the authenticating application. Supports substring search over email, name, and phone, an optional environment filter (test/live), and pagination. Scoped to the application — never returns users from another application.
17326
+ * List / search end users (server-side admin)
17327
+ */
17328
+ async listEndUsersRaw(requestParameters, initOverrides) {
17329
+ const queryParameters = {};
17330
+ if (requestParameters["page"] != null) {
17331
+ queryParameters["page"] = requestParameters["page"];
17332
+ }
17333
+ if (requestParameters["perPage"] != null) {
17334
+ queryParameters["per_page"] = requestParameters["perPage"];
17335
+ }
17336
+ if (requestParameters["search"] != null) {
17337
+ queryParameters["search"] = requestParameters["search"];
17338
+ }
17339
+ if (requestParameters["environment"] != null) {
17340
+ queryParameters["environment"] = requestParameters["environment"];
17341
+ }
17342
+ const headerParameters = {};
17343
+ if (this.configuration && this.configuration.apiKey) {
17344
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
17345
+ }
17346
+ if (this.configuration && this.configuration.apiKey) {
17347
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
17348
+ }
17349
+ const response = await this.request({
17350
+ path: `/auth/users`,
17351
+ method: "GET",
17352
+ headers: headerParameters,
17353
+ query: queryParameters
17354
+ }, initOverrides);
17355
+ return new VoidApiResponse(response);
17356
+ }
17357
+ /**
17358
+ * Secret-key-scoped directory listing of end users in the authenticating application. Supports substring search over email, name, and phone, an optional environment filter (test/live), and pagination. Scoped to the application — never returns users from another application.
17359
+ * List / search end users (server-side admin)
17360
+ */
17361
+ async listEndUsers(page, perPage, search, environment, initOverrides) {
17362
+ await this.listEndUsersRaw({ page, perPage, search, environment }, initOverrides);
17363
+ }
17364
+ /**
17365
+ * Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user\'s JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. To make a change take effect immediately on already-issued tokens (e.g. revoking admin), call POST /auth/sessions/revoke-all for the user after updating claims — that bumps the revocation epoch so outstanding access tokens stop verifying.
17366
+ * Set an end user\'s stored custom claims (server-side admin)
17367
+ */
17368
+ async setEndUserClaimsRaw(requestParameters, initOverrides) {
17369
+ if (requestParameters["userId"] == null) {
17370
+ throw new RequiredError(
17371
+ "userId",
17372
+ 'Required parameter "userId" was null or undefined when calling setEndUserClaims().'
17373
+ );
17374
+ }
17375
+ if (requestParameters["setEndUserClaimsRequest"] == null) {
17376
+ throw new RequiredError(
17377
+ "setEndUserClaimsRequest",
17378
+ 'Required parameter "setEndUserClaimsRequest" was null or undefined when calling setEndUserClaims().'
17379
+ );
17380
+ }
17381
+ const queryParameters = {};
17382
+ const headerParameters = {};
17383
+ headerParameters["Content-Type"] = "application/json";
17384
+ if (this.configuration && this.configuration.apiKey) {
17385
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
17386
+ }
17387
+ if (this.configuration && this.configuration.apiKey) {
17388
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
17389
+ }
17390
+ const response = await this.request({
17391
+ path: `/auth/users/{user_id}/claims`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
17392
+ method: "PUT",
17393
+ headers: headerParameters,
17394
+ query: queryParameters,
17395
+ body: SetEndUserClaimsRequestToJSON(requestParameters["setEndUserClaimsRequest"])
17396
+ }, initOverrides);
17397
+ return new VoidApiResponse(response);
17398
+ }
17399
+ /**
17400
+ * Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user\'s JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. To make a change take effect immediately on already-issued tokens (e.g. revoking admin), call POST /auth/sessions/revoke-all for the user after updating claims — that bumps the revocation epoch so outstanding access tokens stop verifying.
17401
+ * Set an end user\'s stored custom claims (server-side admin)
17402
+ */
17403
+ async setEndUserClaims(userId, setEndUserClaimsRequest, initOverrides) {
17404
+ await this.setEndUserClaimsRaw({ userId, setEndUserClaimsRequest }, initOverrides);
17405
+ }
17406
+ /**
17407
+ * Secret-key-scoped update of an arbitrary end user in the authenticating application. Updatable fields: email, name, avatar_url, metadata, status. Scoped to the application — a caller can never modify a user belonging to another application.
17408
+ * Update an end user (server-side admin)
17409
+ */
17410
+ async updateEndUserByApplicationRaw(requestParameters, initOverrides) {
17411
+ if (requestParameters["userId"] == null) {
17412
+ throw new RequiredError(
17413
+ "userId",
17414
+ 'Required parameter "userId" was null or undefined when calling updateEndUserByApplication().'
17415
+ );
17416
+ }
17417
+ if (requestParameters["updateEndUserByApplicationRequest"] == null) {
17418
+ throw new RequiredError(
17419
+ "updateEndUserByApplicationRequest",
17420
+ 'Required parameter "updateEndUserByApplicationRequest" was null or undefined when calling updateEndUserByApplication().'
17421
+ );
17422
+ }
17423
+ const queryParameters = {};
17424
+ const headerParameters = {};
17425
+ headerParameters["Content-Type"] = "application/json";
17426
+ if (this.configuration && this.configuration.apiKey) {
17427
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
17428
+ }
17429
+ if (this.configuration && this.configuration.apiKey) {
17430
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
17431
+ }
17432
+ const response = await this.request({
17433
+ path: `/auth/users/{user_id}`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
17434
+ method: "PATCH",
17435
+ headers: headerParameters,
17436
+ query: queryParameters,
17437
+ body: UpdateEndUserByApplicationRequestToJSON(requestParameters["updateEndUserByApplicationRequest"])
17438
+ }, initOverrides);
17439
+ return new VoidApiResponse(response);
17440
+ }
17441
+ /**
17442
+ * Secret-key-scoped update of an arbitrary end user in the authenticating application. Updatable fields: email, name, avatar_url, metadata, status. Scoped to the application — a caller can never modify a user belonging to another application.
17443
+ * Update an end user (server-side admin)
17444
+ */
17445
+ async updateEndUserByApplication(userId, updateEndUserByApplicationRequest, initOverrides) {
17446
+ await this.updateEndUserByApplicationRaw({ userId, updateEndUserByApplicationRequest }, initOverrides);
17447
+ }
17448
+ };
17449
+ var ListEndUsersEnvironmentEnum = {
17450
+ TEST: "test",
17451
+ LIVE: "live"
17452
+ };
17453
+
17454
+ // src/src/apis/AuthUserProfileApi.ts
17455
+ var AuthUserProfileApi = class extends BaseAPI {
17456
+ /**
17457
+ * Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
17458
+ * Delete current end user account
17459
+ */
17460
+ async deleteEndUserRaw(initOverrides) {
17461
+ const queryParameters = {};
17462
+ const headerParameters = {};
17463
+ if (this.configuration && this.configuration.accessToken) {
17464
+ const token = this.configuration.accessToken;
17465
+ const tokenString = await token("EndUserToken", []);
17466
+ if (tokenString) {
17467
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
17468
+ }
17469
+ }
17470
+ if (this.configuration && this.configuration.apiKey) {
17471
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
17472
+ }
17473
+ const response = await this.request({
17474
+ path: `/auth/users/me`,
17475
+ method: "DELETE",
17476
+ headers: headerParameters,
17477
+ query: queryParameters
17478
+ }, initOverrides);
17479
+ return new JSONApiResponse(response, (jsonValue) => EndUserDeleteResponseFromJSON(jsonValue));
17480
+ }
17481
+ /**
17482
+ * Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
17483
+ * Delete current end user account
17484
+ */
17485
+ async deleteEndUser(initOverrides) {
17486
+ const response = await this.deleteEndUserRaw(initOverrides);
17487
+ return await response.value();
16938
17488
  }
16939
17489
  /**
16940
17490
  * Retrieve the profile of the currently authenticated end user.
@@ -23105,34 +23655,34 @@ var ZyphrError = class extends Error {
23105
23655
  }
23106
23656
  };
23107
23657
  var ZyphrValidationError = class extends ZyphrError {
23108
- constructor(message, details) {
23109
- super({ message, status: 422, code: "validation_error", details });
23658
+ constructor(message, details, code = "validation_error") {
23659
+ super({ message, status: 422, code, details });
23110
23660
  this.name = "ZyphrValidationError";
23111
23661
  }
23112
23662
  };
23113
23663
  var ZyphrAuthenticationError = class extends ZyphrError {
23114
- constructor(message) {
23115
- super({ message, status: 401, code: "authentication_error" });
23664
+ constructor(message, code = "authentication_error") {
23665
+ super({ message, status: 401, code });
23116
23666
  this.name = "ZyphrAuthenticationError";
23117
23667
  }
23118
23668
  };
23119
23669
  var ZyphrRateLimitError = class extends ZyphrError {
23120
23670
  retryAfter;
23121
- constructor(message, retryAfter) {
23122
- super({ message, status: 429, code: "rate_limit_exceeded" });
23671
+ constructor(message, retryAfter, code = "rate_limit_exceeded") {
23672
+ super({ message, status: 429, code });
23123
23673
  this.name = "ZyphrRateLimitError";
23124
23674
  this.retryAfter = retryAfter;
23125
23675
  }
23126
23676
  };
23127
23677
  var ZyphrNotFoundError = class extends ZyphrError {
23128
- constructor(message) {
23129
- super({ message, status: 404, code: "not_found" });
23678
+ constructor(message, code = "not_found") {
23679
+ super({ message, status: 404, code });
23130
23680
  this.name = "ZyphrNotFoundError";
23131
23681
  }
23132
23682
  };
23133
23683
  var ZyphrPayloadTooLargeError = class extends ZyphrError {
23134
- constructor(message, details, requestId) {
23135
- super({ message, status: 413, code: "payload_too_large", details, requestId });
23684
+ constructor(message, details, requestId, code = "payload_too_large") {
23685
+ super({ message, status: 413, code, details, requestId });
23136
23686
  this.name = "ZyphrPayloadTooLargeError";
23137
23687
  }
23138
23688
  /** Maximum allowed request body size in bytes (server-enforced). */
@@ -23162,24 +23712,24 @@ async function parseErrorResponse(response) {
23162
23712
  const error = body.error ?? {};
23163
23713
  const meta = body.meta ?? {};
23164
23714
  const message = error.message ?? response.statusText ?? "Unknown error";
23165
- const code = error.code;
23715
+ const code = error.code || void 0;
23166
23716
  const requestId = meta.request_id;
23167
23717
  const details = error.details;
23168
23718
  switch (response.status) {
23169
23719
  case 400:
23170
23720
  case 422:
23171
- return new ZyphrValidationError(message, details);
23721
+ return new ZyphrValidationError(message, details, code);
23172
23722
  case 401:
23173
23723
  case 403:
23174
- return new ZyphrAuthenticationError(message);
23724
+ return new ZyphrAuthenticationError(message, code);
23175
23725
  case 404:
23176
- return new ZyphrNotFoundError(message);
23726
+ return new ZyphrNotFoundError(message, code);
23177
23727
  case 413:
23178
- return new ZyphrPayloadTooLargeError(message, details, requestId);
23728
+ return new ZyphrPayloadTooLargeError(message, details, requestId, code);
23179
23729
  case 429: {
23180
23730
  const retryAfterHeader = response.headers.get("Retry-After");
23181
23731
  const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : void 0;
23182
- return new ZyphrRateLimitError(message, retryAfter);
23732
+ return new ZyphrRateLimitError(message, retryAfter, code);
23183
23733
  }
23184
23734
  default:
23185
23735
  return new ZyphrError({ message, status: response.status, code, requestId, details });
@@ -23290,6 +23840,99 @@ var Zyphr = class {
23290
23840
  }
23291
23841
  };
23292
23842
 
23843
+ // src/clientAuth.ts
23844
+ var errorMiddleware2 = {
23845
+ async post(context) {
23846
+ if (context.response.status >= 200 && context.response.status < 300) {
23847
+ return;
23848
+ }
23849
+ throw await parseErrorResponse(context.response);
23850
+ }
23851
+ };
23852
+ var ZyphrClientCredentialError = class extends Error {
23853
+ constructor(message) {
23854
+ super(message);
23855
+ this.name = "ZyphrClientCredentialError";
23856
+ }
23857
+ };
23858
+ var SECRET_KEY_PREFIXES = ["za_sec_", "zy_live_", "zy_test_"];
23859
+ var ZyphrClient = class {
23860
+ auth;
23861
+ /** Device registration for push (takes an OS-acquired token). */
23862
+ devices;
23863
+ applicationKey;
23864
+ accessToken;
23865
+ constructor(options) {
23866
+ if (!options.applicationKey) {
23867
+ throw new ZyphrClientCredentialError("applicationKey (za_pub_*) is required");
23868
+ }
23869
+ if (SECRET_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
23870
+ throw new ZyphrClientCredentialError(
23871
+ "ZyphrClient must be constructed with a publishable application key (za_pub_*), never a secret key. Secret keys must stay server-side."
23872
+ );
23873
+ }
23874
+ if (!options.applicationKey.startsWith("za_pub_")) {
23875
+ throw new ZyphrClientCredentialError(
23876
+ "applicationKey must be a publishable application key (za_pub_*)."
23877
+ );
23878
+ }
23879
+ this.applicationKey = options.applicationKey;
23880
+ this.accessToken = options.accessToken;
23881
+ const config = new Configuration({
23882
+ basePath: options.baseUrl,
23883
+ // The only credential this client sends automatically is the publishable
23884
+ // application key. End-user Bearer tokens are attached per-request via
23885
+ // authedRequest() so token rotation doesn't require rebuilding the client.
23886
+ apiKey: (name) => name === "X-Application-Key" ? this.applicationKey : "",
23887
+ middleware: [errorMiddleware2]
23888
+ });
23889
+ this.auth = {
23890
+ login: new AuthLoginApi(config),
23891
+ registration: new AuthRegistrationApi(config),
23892
+ sessions: new AuthSessionsApi(config),
23893
+ emailVerification: new AuthEmailVerificationApi(config),
23894
+ passwordReset: new AuthPasswordResetApi(config),
23895
+ mfa: new AuthMFAApi(config),
23896
+ magicLinks: new AuthMagicLinksApi(config),
23897
+ oauth: new AuthOAuthApi(config),
23898
+ organizations: new AuthOrganizationsApi(config),
23899
+ phone: new AuthPhoneApi(config),
23900
+ emailOtp: new AuthEmailOTPApi(config),
23901
+ profile: new AuthUserProfileApi(config),
23902
+ webauthn: new AuthWebAuthnApi(config)
23903
+ };
23904
+ this.devices = new DevicesApi(config);
23905
+ }
23906
+ /** Store the end-user access token for subsequent authedRequest() calls. */
23907
+ setAccessToken(accessToken) {
23908
+ this.accessToken = accessToken;
23909
+ }
23910
+ /** True when an end-user access token is currently set. */
23911
+ get isAuthenticated() {
23912
+ return Boolean(this.accessToken);
23913
+ }
23914
+ /**
23915
+ * Build request overrides that authenticate as the current end user: the
23916
+ * stored Bearer token plus the publishable application key required by
23917
+ * user-scoped endpoints. Pass an explicit token to override the stored one.
23918
+ *
23919
+ * @example
23920
+ * ```ts
23921
+ * const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest());
23922
+ * ```
23923
+ */
23924
+ authedRequest(accessToken) {
23925
+ const token = accessToken ?? this.accessToken;
23926
+ const headers = {
23927
+ "X-Application-Key": this.applicationKey
23928
+ };
23929
+ if (token) {
23930
+ headers.Authorization = `Bearer ${token}`;
23931
+ }
23932
+ return { headers };
23933
+ }
23934
+ };
23935
+
23293
23936
  // src/index.ts
23294
23937
  var SDK_VERSION = "0.1.0";
23295
23938
  export {
@@ -23436,6 +24079,7 @@ export {
23436
24079
  AuthTokensFromJSONTyped,
23437
24080
  AuthTokensToJSON,
23438
24081
  AuthTokensToJSONTyped,
24082
+ AuthUserDirectoryApi,
23439
24083
  AuthUserFromJSON,
23440
24084
  AuthUserFromJSONTyped,
23441
24085
  AuthUserProfileApi,
@@ -23850,10 +24494,16 @@ export {
23850
24494
  InboxNotificationResponseFromJSONTyped,
23851
24495
  InboxNotificationResponseToJSON,
23852
24496
  InboxNotificationResponseToJSONTyped,
24497
+ InviteEndUserRequestFromJSON,
24498
+ InviteEndUserRequestFromJSONTyped,
24499
+ InviteEndUserRequestSendLinkEnum,
24500
+ InviteEndUserRequestToJSON,
24501
+ InviteEndUserRequestToJSONTyped,
23853
24502
  JSONApiResponse,
23854
24503
  ListAllInboxStatusEnum,
23855
24504
  ListDevicesPlatformEnum,
23856
24505
  ListEmailsStatusEnum,
24506
+ ListEndUsersEnvironmentEnum,
23857
24507
  ListInboundEmailsStatusEnum,
23858
24508
  ListPushStatusEnum,
23859
24509
  ListSlackMessagesStatusEnum,
@@ -24040,6 +24690,11 @@ export {
24040
24690
  OAuthProviderInfoFromJSONTyped,
24041
24691
  OAuthProviderInfoToJSON,
24042
24692
  OAuthProviderInfoToJSONTyped,
24693
+ OAuthProviderName,
24694
+ OAuthProviderNameFromJSON,
24695
+ OAuthProviderNameFromJSONTyped,
24696
+ OAuthProviderNameToJSON,
24697
+ OAuthProviderNameToJSONTyped,
24043
24698
  OAuthProviderToJSON,
24044
24699
  OAuthProviderToJSONTyped,
24045
24700
  OAuthProvidersResponseDataFromJSON,
@@ -24469,6 +25124,10 @@ export {
24469
25124
  SetDomainInboundRequestFromJSONTyped,
24470
25125
  SetDomainInboundRequestToJSON,
24471
25126
  SetDomainInboundRequestToJSONTyped,
25127
+ SetEndUserClaimsRequestFromJSON,
25128
+ SetEndUserClaimsRequestFromJSONTyped,
25129
+ SetEndUserClaimsRequestToJSON,
25130
+ SetEndUserClaimsRequestToJSONTyped,
24472
25131
  SetPreferencesRequestFromJSON,
24473
25132
  SetPreferencesRequestFromJSONTyped,
24474
25133
  SetPreferencesRequestPreferencesInnerFromJSON,
@@ -24481,6 +25140,14 @@ export {
24481
25140
  SignInAnonymouslyRequestFromJSONTyped,
24482
25141
  SignInAnonymouslyRequestToJSON,
24483
25142
  SignInAnonymouslyRequestToJSONTyped,
25143
+ SignInWithGameCenterRequestFromJSON,
25144
+ SignInWithGameCenterRequestFromJSONTyped,
25145
+ SignInWithGameCenterRequestToJSON,
25146
+ SignInWithGameCenterRequestToJSONTyped,
25147
+ SignInWithGooglePlayGamesRequestFromJSON,
25148
+ SignInWithGooglePlayGamesRequestFromJSONTyped,
25149
+ SignInWithGooglePlayGamesRequestToJSON,
25150
+ SignInWithGooglePlayGamesRequestToJSONTyped,
24484
25151
  SlackApi,
24485
25152
  SlackMessageFromJSON,
24486
25153
  SlackMessageFromJSONTyped,
@@ -24714,6 +25381,10 @@ export {
24714
25381
  UpdateCategoryRequestFromJSONTyped,
24715
25382
  UpdateCategoryRequestToJSON,
24716
25383
  UpdateCategoryRequestToJSONTyped,
25384
+ UpdateEndUserByApplicationRequestFromJSON,
25385
+ UpdateEndUserByApplicationRequestFromJSONTyped,
25386
+ UpdateEndUserByApplicationRequestToJSON,
25387
+ UpdateEndUserByApplicationRequestToJSONTyped,
24717
25388
  UpdateEndUserRequestFromJSON,
24718
25389
  UpdateEndUserRequestFromJSONTyped,
24719
25390
  UpdateEndUserRequestToJSON,
@@ -25131,6 +25802,8 @@ export {
25131
25802
  WorkflowStepExecutionToJSONTyped,
25132
25803
  Zyphr,
25133
25804
  ZyphrAuthenticationError,
25805
+ ZyphrClient,
25806
+ ZyphrClientCredentialError,
25134
25807
  ZyphrError,
25135
25808
  ZyphrNotFoundError,
25136
25809
  ZyphrPayloadTooLargeError,
@@ -25265,6 +25938,7 @@ export {
25265
25938
  instanceOfInboxListMeta,
25266
25939
  instanceOfInboxListResponse,
25267
25940
  instanceOfInboxNotificationResponse,
25941
+ instanceOfInviteEndUserRequest,
25268
25942
  instanceOfListWaaSApplications200Response,
25269
25943
  instanceOfListWaaSEndpointDeliveries200Response,
25270
25944
  instanceOfListWaaSEndpoints200Response,
@@ -25309,6 +25983,7 @@ export {
25309
25983
  instanceOfOAuthConnectionsResponseData,
25310
25984
  instanceOfOAuthProvider,
25311
25985
  instanceOfOAuthProviderInfo,
25986
+ instanceOfOAuthProviderName,
25312
25987
  instanceOfOAuthProvidersResponse,
25313
25988
  instanceOfOAuthProvidersResponseData,
25314
25989
  instanceOfOAuthTokensRefreshResponse,
@@ -25412,9 +26087,12 @@ export {
25412
26087
  instanceOfSessionListResponseData,
25413
26088
  instanceOfSessionListResponseDataSessionInfo,
25414
26089
  instanceOfSetDomainInboundRequest,
26090
+ instanceOfSetEndUserClaimsRequest,
25415
26091
  instanceOfSetPreferencesRequest,
25416
26092
  instanceOfSetPreferencesRequestPreferencesInner,
25417
26093
  instanceOfSignInAnonymouslyRequest,
26094
+ instanceOfSignInWithGameCenterRequest,
26095
+ instanceOfSignInWithGooglePlayGamesRequest,
25418
26096
  instanceOfSlackMessage,
25419
26097
  instanceOfSlackMessageListResponse,
25420
26098
  instanceOfSlackMessageListResponseMeta,
@@ -25470,6 +26148,7 @@ export {
25470
26148
  instanceOfUnsubscribeRequest,
25471
26149
  instanceOfUnsubscribeResponse,
25472
26150
  instanceOfUpdateCategoryRequest,
26151
+ instanceOfUpdateEndUserByApplicationRequest,
25473
26152
  instanceOfUpdateEndUserRequest,
25474
26153
  instanceOfUpdateOrganizationMemberRoleRequest,
25475
26154
  instanceOfUpdateOrganizationRequest,