@zyphr-dev/node-sdk 0.1.43 → 0.1.45

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
@@ -850,6 +850,84 @@ function ApiErrorToJSONTyped(value, ignoreDiscriminator = false) {
850
850
  };
851
851
  }
852
852
 
853
+ // src/src/models/ApplicationSelf.ts
854
+ var ApplicationSelfEnvironmentEnum = {
855
+ TEST: "test",
856
+ LIVE: "live"
857
+ };
858
+ var ApplicationSelfSigningAlgorithmEnum = {
859
+ HS256: "HS256",
860
+ RS256: "RS256",
861
+ ES256: "ES256"
862
+ };
863
+ function instanceOfApplicationSelf(value) {
864
+ if (!("id" in value) || value["id"] === void 0) return false;
865
+ if (!("name" in value) || value["name"] === void 0) return false;
866
+ if (!("environment" in value) || value["environment"] === void 0) return false;
867
+ if (!("signingAlgorithm" in value) || value["signingAlgorithm"] === void 0) return false;
868
+ if (!("testRecipients" in value) || value["testRecipients"] === void 0) return false;
869
+ return true;
870
+ }
871
+ function ApplicationSelfFromJSON(json) {
872
+ return ApplicationSelfFromJSONTyped(json, false);
873
+ }
874
+ function ApplicationSelfFromJSONTyped(json, ignoreDiscriminator) {
875
+ if (json == null) {
876
+ return json;
877
+ }
878
+ return {
879
+ "id": json["id"],
880
+ "name": json["name"],
881
+ "environment": json["environment"],
882
+ "signingAlgorithm": json["signing_algorithm"],
883
+ "testRecipients": json["test_recipients"]
884
+ };
885
+ }
886
+ function ApplicationSelfToJSON(json) {
887
+ return ApplicationSelfToJSONTyped(json, false);
888
+ }
889
+ function ApplicationSelfToJSONTyped(value, ignoreDiscriminator = false) {
890
+ if (value == null) {
891
+ return value;
892
+ }
893
+ return {
894
+ "id": value["id"],
895
+ "name": value["name"],
896
+ "environment": value["environment"],
897
+ "signing_algorithm": value["signingAlgorithm"],
898
+ "test_recipients": value["testRecipients"]
899
+ };
900
+ }
901
+
902
+ // src/src/models/ApplicationSelfResponse.ts
903
+ function instanceOfApplicationSelfResponse(value) {
904
+ return true;
905
+ }
906
+ function ApplicationSelfResponseFromJSON(json) {
907
+ return ApplicationSelfResponseFromJSONTyped(json, false);
908
+ }
909
+ function ApplicationSelfResponseFromJSONTyped(json, ignoreDiscriminator) {
910
+ if (json == null) {
911
+ return json;
912
+ }
913
+ return {
914
+ "data": json["data"] == null ? void 0 : ApplicationSelfFromJSON(json["data"]),
915
+ "meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
916
+ };
917
+ }
918
+ function ApplicationSelfResponseToJSON(json) {
919
+ return ApplicationSelfResponseToJSONTyped(json, false);
920
+ }
921
+ function ApplicationSelfResponseToJSONTyped(value, ignoreDiscriminator = false) {
922
+ if (value == null) {
923
+ return value;
924
+ }
925
+ return {
926
+ "data": ApplicationSelfToJSON(value["data"]),
927
+ "meta": RequestMetaToJSON(value["meta"])
928
+ };
929
+ }
930
+
853
931
  // src/src/models/AuthEmailType.ts
854
932
  var AuthEmailType = {
855
933
  MAGIC_LINK: "magic_link",
@@ -1598,6 +1676,49 @@ function AuthLoginResponseToJSONTyped(value, ignoreDiscriminator = false) {
1598
1676
  };
1599
1677
  }
1600
1678
 
1679
+ // src/src/models/AuthMethods.ts
1680
+ function instanceOfAuthMethods(value) {
1681
+ if (!("hasPassword" in value) || value["hasPassword"] === void 0) return false;
1682
+ if (!("oauthProviders" in value) || value["oauthProviders"] === void 0) return false;
1683
+ if (!("mfaEnabled" in value) || value["mfaEnabled"] === void 0) return false;
1684
+ if (!("emailVerified" in value) || value["emailVerified"] === void 0) return false;
1685
+ if (!("phoneVerified" in value) || value["phoneVerified"] === void 0) return false;
1686
+ if (!("passkeys" in value) || value["passkeys"] === void 0) return false;
1687
+ return true;
1688
+ }
1689
+ function AuthMethodsFromJSON(json) {
1690
+ return AuthMethodsFromJSONTyped(json, false);
1691
+ }
1692
+ function AuthMethodsFromJSONTyped(json, ignoreDiscriminator) {
1693
+ if (json == null) {
1694
+ return json;
1695
+ }
1696
+ return {
1697
+ "hasPassword": json["has_password"],
1698
+ "oauthProviders": json["oauth_providers"],
1699
+ "mfaEnabled": json["mfa_enabled"],
1700
+ "emailVerified": json["email_verified"],
1701
+ "phoneVerified": json["phone_verified"],
1702
+ "passkeys": json["passkeys"]
1703
+ };
1704
+ }
1705
+ function AuthMethodsToJSON(json) {
1706
+ return AuthMethodsToJSONTyped(json, false);
1707
+ }
1708
+ function AuthMethodsToJSONTyped(value, ignoreDiscriminator = false) {
1709
+ if (value == null) {
1710
+ return value;
1711
+ }
1712
+ return {
1713
+ "has_password": value["hasPassword"],
1714
+ "oauth_providers": value["oauthProviders"],
1715
+ "mfa_enabled": value["mfaEnabled"],
1716
+ "email_verified": value["emailVerified"],
1717
+ "phone_verified": value["phoneVerified"],
1718
+ "passkeys": value["passkeys"]
1719
+ };
1720
+ }
1721
+
1601
1722
  // src/src/models/AuthResult.ts
1602
1723
  function instanceOfAuthResult(value) {
1603
1724
  return true;
@@ -2087,6 +2208,37 @@ function CategoryResponseToJSONTyped(value, ignoreDiscriminator = false) {
2087
2208
  };
2088
2209
  }
2089
2210
 
2211
+ // src/src/models/ChangePasswordRequest.ts
2212
+ function instanceOfChangePasswordRequest(value) {
2213
+ if (!("currentPassword" in value) || value["currentPassword"] === void 0) return false;
2214
+ if (!("newPassword" in value) || value["newPassword"] === void 0) return false;
2215
+ return true;
2216
+ }
2217
+ function ChangePasswordRequestFromJSON(json) {
2218
+ return ChangePasswordRequestFromJSONTyped(json, false);
2219
+ }
2220
+ function ChangePasswordRequestFromJSONTyped(json, ignoreDiscriminator) {
2221
+ if (json == null) {
2222
+ return json;
2223
+ }
2224
+ return {
2225
+ "currentPassword": json["current_password"],
2226
+ "newPassword": json["new_password"]
2227
+ };
2228
+ }
2229
+ function ChangePasswordRequestToJSON(json) {
2230
+ return ChangePasswordRequestToJSONTyped(json, false);
2231
+ }
2232
+ function ChangePasswordRequestToJSONTyped(value, ignoreDiscriminator = false) {
2233
+ if (value == null) {
2234
+ return value;
2235
+ }
2236
+ return {
2237
+ "current_password": value["currentPassword"],
2238
+ "new_password": value["newPassword"]
2239
+ };
2240
+ }
2241
+
2090
2242
  // src/src/models/GetDomain200ResponseMeta.ts
2091
2243
  function instanceOfGetDomain200ResponseMeta(value) {
2092
2244
  return true;
@@ -5006,6 +5158,35 @@ function GetDomain200ResponseToJSONTyped(value, ignoreDiscriminator = false) {
5006
5158
  };
5007
5159
  }
5008
5160
 
5161
+ // src/src/models/GetEndUserAuthMethods200Response.ts
5162
+ function instanceOfGetEndUserAuthMethods200Response(value) {
5163
+ return true;
5164
+ }
5165
+ function GetEndUserAuthMethods200ResponseFromJSON(json) {
5166
+ return GetEndUserAuthMethods200ResponseFromJSONTyped(json, false);
5167
+ }
5168
+ function GetEndUserAuthMethods200ResponseFromJSONTyped(json, ignoreDiscriminator) {
5169
+ if (json == null) {
5170
+ return json;
5171
+ }
5172
+ return {
5173
+ "data": json["data"] == null ? void 0 : AuthMethodsFromJSON(json["data"]),
5174
+ "meta": json["meta"] == null ? void 0 : GetDomain200ResponseMetaFromJSON(json["meta"])
5175
+ };
5176
+ }
5177
+ function GetEndUserAuthMethods200ResponseToJSON(json) {
5178
+ return GetEndUserAuthMethods200ResponseToJSONTyped(json, false);
5179
+ }
5180
+ function GetEndUserAuthMethods200ResponseToJSONTyped(value, ignoreDiscriminator = false) {
5181
+ if (value == null) {
5182
+ return value;
5183
+ }
5184
+ return {
5185
+ "data": AuthMethodsToJSON(value["data"]),
5186
+ "meta": GetDomain200ResponseMetaToJSON(value["meta"])
5187
+ };
5188
+ }
5189
+
5009
5190
  // src/src/models/GetEndUserById200Response.ts
5010
5191
  function instanceOfGetEndUserById200Response(value) {
5011
5192
  return true;
@@ -11812,6 +11993,34 @@ function SetPreferencesRequestToJSONTyped(value, ignoreDiscriminator = false) {
11812
11993
  };
11813
11994
  }
11814
11995
 
11996
+ // src/src/models/SetSelfApplicationTestRecipientsRequest.ts
11997
+ function instanceOfSetSelfApplicationTestRecipientsRequest(value) {
11998
+ if (!("testRecipients" in value) || value["testRecipients"] === void 0) return false;
11999
+ return true;
12000
+ }
12001
+ function SetSelfApplicationTestRecipientsRequestFromJSON(json) {
12002
+ return SetSelfApplicationTestRecipientsRequestFromJSONTyped(json, false);
12003
+ }
12004
+ function SetSelfApplicationTestRecipientsRequestFromJSONTyped(json, ignoreDiscriminator) {
12005
+ if (json == null) {
12006
+ return json;
12007
+ }
12008
+ return {
12009
+ "testRecipients": json["test_recipients"]
12010
+ };
12011
+ }
12012
+ function SetSelfApplicationTestRecipientsRequestToJSON(json) {
12013
+ return SetSelfApplicationTestRecipientsRequestToJSONTyped(json, false);
12014
+ }
12015
+ function SetSelfApplicationTestRecipientsRequestToJSONTyped(value, ignoreDiscriminator = false) {
12016
+ if (value == null) {
12017
+ return value;
12018
+ }
12019
+ return {
12020
+ "test_recipients": value["testRecipients"]
12021
+ };
12022
+ }
12023
+
11815
12024
  // src/src/models/SignInAnonymouslyRequest.ts
11816
12025
  function instanceOfSignInAnonymouslyRequest(value) {
11817
12026
  if (!("deviceId" in value) || value["deviceId"] === void 0) return false;
@@ -15644,6 +15853,60 @@ function WebhookDeleteResponseToJSONTyped(value, ignoreDiscriminator = false) {
15644
15853
  };
15645
15854
  }
15646
15855
 
15856
+ // src/src/models/WebhookEventType.ts
15857
+ var WebhookEventType = {
15858
+ EMAIL_QUEUED: "email.queued",
15859
+ EMAIL_SENT: "email.sent",
15860
+ EMAIL_DELIVERED: "email.delivered",
15861
+ EMAIL_BOUNCED: "email.bounced",
15862
+ EMAIL_SOFT_BOUNCED: "email.soft_bounced",
15863
+ EMAIL_COMPLAINED: "email.complained",
15864
+ EMAIL_OPENED: "email.opened",
15865
+ EMAIL_CLICKED: "email.clicked",
15866
+ EMAIL_FAILED: "email.failed",
15867
+ EMAIL_RECEIVED: "email.received",
15868
+ PUSH_SENT: "push.sent",
15869
+ PUSH_DELIVERED: "push.delivered",
15870
+ PUSH_FAILED: "push.failed",
15871
+ PUSH_EXPIRED: "push.expired",
15872
+ USER_CREATED: "user.created",
15873
+ USER_LOGIN: "user.login",
15874
+ USER_LOGOUT: "user.logout",
15875
+ USER_PASSWORD_CHANGED: "user.password_changed",
15876
+ USER_PASSWORD_RESET_REQUESTED: "user.password_reset_requested",
15877
+ USER_EMAIL_VERIFIED: "user.email_verified",
15878
+ USER_PHONE_VERIFIED: "user.phone_verified",
15879
+ USER_DELETED: "user.deleted",
15880
+ USER_SESSION_REVOKED: "user.session_revoked",
15881
+ USER_MFA_ENABLED: "user.mfa_enabled",
15882
+ USER_MFA_DISABLED: "user.mfa_disabled",
15883
+ USER_IMPERSONATED: "user.impersonated",
15884
+ DOMAIN_VERIFIED: "domain.verified",
15885
+ DOMAIN_VERIFICATION_FAILED: "domain.verification_failed"
15886
+ };
15887
+ function instanceOfWebhookEventType(value) {
15888
+ for (const key in WebhookEventType) {
15889
+ if (Object.prototype.hasOwnProperty.call(WebhookEventType, key)) {
15890
+ if (WebhookEventType[key] === value) {
15891
+ return true;
15892
+ }
15893
+ }
15894
+ }
15895
+ return false;
15896
+ }
15897
+ function WebhookEventTypeFromJSON(json) {
15898
+ return WebhookEventTypeFromJSONTyped(json, false);
15899
+ }
15900
+ function WebhookEventTypeFromJSONTyped(json, ignoreDiscriminator) {
15901
+ return json;
15902
+ }
15903
+ function WebhookEventTypeToJSON(value) {
15904
+ return value;
15905
+ }
15906
+ function WebhookEventTypeToJSONTyped(value, ignoreDiscriminator) {
15907
+ return value;
15908
+ }
15909
+
15647
15910
  // src/src/models/WebhookDelivery.ts
15648
15911
  var WebhookDeliveryStatusEnum = {
15649
15912
  PENDING: "pending",
@@ -15666,7 +15929,7 @@ function WebhookDeliveryFromJSONTyped(json, ignoreDiscriminator) {
15666
15929
  "id": json["id"] == null ? void 0 : json["id"],
15667
15930
  "msgId": json["msg_id"] == null ? void 0 : json["msg_id"],
15668
15931
  "eventId": json["event_id"] == null ? void 0 : json["event_id"],
15669
- "eventType": json["event_type"] == null ? void 0 : json["event_type"],
15932
+ "eventType": json["event_type"] == null ? void 0 : WebhookEventTypeFromJSON(json["event_type"]),
15670
15933
  "status": json["status"] == null ? void 0 : json["status"],
15671
15934
  "attempts": json["attempts"] == null ? void 0 : json["attempts"],
15672
15935
  "maxAttempts": json["max_attempts"] == null ? void 0 : json["max_attempts"],
@@ -15692,7 +15955,7 @@ function WebhookDeliveryToJSONTyped(value, ignoreDiscriminator = false) {
15692
15955
  "id": value["id"],
15693
15956
  "msg_id": value["msgId"],
15694
15957
  "event_id": value["eventId"],
15695
- "event_type": value["eventType"],
15958
+ "event_type": WebhookEventTypeToJSON(value["eventType"]),
15696
15959
  "status": value["status"],
15697
15960
  "attempts": value["attempts"],
15698
15961
  "max_attempts": value["maxAttempts"],
@@ -15730,7 +15993,7 @@ function WebhookDeliveryDetailFromJSONTyped(json, ignoreDiscriminator) {
15730
15993
  "id": json["id"] == null ? void 0 : json["id"],
15731
15994
  "msgId": json["msg_id"] == null ? void 0 : json["msg_id"],
15732
15995
  "eventId": json["event_id"] == null ? void 0 : json["event_id"],
15733
- "eventType": json["event_type"] == null ? void 0 : json["event_type"],
15996
+ "eventType": json["event_type"] == null ? void 0 : WebhookEventTypeFromJSON(json["event_type"]),
15734
15997
  "status": json["status"] == null ? void 0 : json["status"],
15735
15998
  "attempts": json["attempts"] == null ? void 0 : json["attempts"],
15736
15999
  "maxAttempts": json["max_attempts"] == null ? void 0 : json["max_attempts"],
@@ -15760,7 +16023,7 @@ function WebhookDeliveryDetailToJSONTyped(value, ignoreDiscriminator = false) {
15760
16023
  "id": value["id"],
15761
16024
  "msg_id": value["msgId"],
15762
16025
  "event_id": value["eventId"],
15763
- "event_type": value["eventType"],
16026
+ "event_type": WebhookEventTypeToJSON(value["eventType"]),
15764
16027
  "status": value["status"],
15765
16028
  "attempts": value["attempts"],
15766
16029
  "max_attempts": value["maxAttempts"],
@@ -15910,7 +16173,7 @@ function WebhookEventTypesResponseDataFromJSONTyped(json, ignoreDiscriminator) {
15910
16173
  return json;
15911
16174
  }
15912
16175
  return {
15913
- "eventTypes": json["event_types"] == null ? void 0 : json["event_types"],
16176
+ "eventTypes": json["event_types"] == null ? void 0 : json["event_types"].map(WebhookEventTypeFromJSON),
15914
16177
  "registry": json["registry"] == null ? void 0 : json["registry"],
15915
16178
  "categories": json["categories"] == null ? void 0 : json["categories"],
15916
16179
  "apiVersion": json["api_version"] == null ? void 0 : json["api_version"]
@@ -15924,7 +16187,7 @@ function WebhookEventTypesResponseDataToJSONTyped(value, ignoreDiscriminator = f
15924
16187
  return value;
15925
16188
  }
15926
16189
  return {
15927
- "event_types": value["eventTypes"],
16190
+ "event_types": value["eventTypes"] == null ? void 0 : value["eventTypes"].map(WebhookEventTypeToJSON),
15928
16191
  "registry": value["registry"],
15929
16192
  "categories": value["categories"],
15930
16193
  "api_version": value["apiVersion"]
@@ -16325,7 +16588,7 @@ function WebhookTestEventResponseDataFromJSONTyped(json, ignoreDiscriminator) {
16325
16588
  }
16326
16589
  return {
16327
16590
  "deliveryId": json["delivery_id"] == null ? void 0 : json["delivery_id"],
16328
- "eventType": json["event_type"] == null ? void 0 : json["event_type"],
16591
+ "eventType": json["event_type"] == null ? void 0 : WebhookEventTypeFromJSON(json["event_type"]),
16329
16592
  "payload": json["payload"] == null ? void 0 : json["payload"],
16330
16593
  "status": json["status"] == null ? void 0 : json["status"]
16331
16594
  };
@@ -16339,7 +16602,7 @@ function WebhookTestEventResponseDataToJSONTyped(value, ignoreDiscriminator = fa
16339
16602
  }
16340
16603
  return {
16341
16604
  "delivery_id": value["deliveryId"],
16342
- "event_type": value["eventType"],
16605
+ "event_type": WebhookEventTypeToJSON(value["eventType"]),
16343
16606
  "payload": value["payload"],
16344
16607
  "status": value["status"]
16345
16608
  };
@@ -16558,6 +16821,76 @@ function WithdrawSubscriberConsentRequestToJSONTyped(value, ignoreDiscriminator
16558
16821
  };
16559
16822
  }
16560
16823
 
16824
+ // src/src/apis/AuthApplicationApi.ts
16825
+ var AuthApplicationApi = class extends BaseAPI {
16826
+ /**
16827
+ * Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment\'s mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
16828
+ * Get the authenticating application
16829
+ */
16830
+ async getSelfApplicationRaw(initOverrides) {
16831
+ const queryParameters = {};
16832
+ const headerParameters = {};
16833
+ if (this.configuration && this.configuration.apiKey) {
16834
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
16835
+ }
16836
+ if (this.configuration && this.configuration.apiKey) {
16837
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16838
+ }
16839
+ const response = await this.request({
16840
+ path: `/auth/application`,
16841
+ method: "GET",
16842
+ headers: headerParameters,
16843
+ query: queryParameters
16844
+ }, initOverrides);
16845
+ return new JSONApiResponse(response, (jsonValue) => ApplicationSelfResponseFromJSON(jsonValue));
16846
+ }
16847
+ /**
16848
+ * Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment\'s mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
16849
+ * Get the authenticating application
16850
+ */
16851
+ async getSelfApplication(initOverrides) {
16852
+ const response = await this.getSelfApplicationRaw(initOverrides);
16853
+ return await response.value();
16854
+ }
16855
+ /**
16856
+ * Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
16857
+ * Set the authenticating application\'s auth-email test allowlist
16858
+ */
16859
+ async setSelfApplicationTestRecipientsRaw(requestParameters, initOverrides) {
16860
+ if (requestParameters["setSelfApplicationTestRecipientsRequest"] == null) {
16861
+ throw new RequiredError(
16862
+ "setSelfApplicationTestRecipientsRequest",
16863
+ 'Required parameter "setSelfApplicationTestRecipientsRequest" was null or undefined when calling setSelfApplicationTestRecipients().'
16864
+ );
16865
+ }
16866
+ const queryParameters = {};
16867
+ const headerParameters = {};
16868
+ headerParameters["Content-Type"] = "application/json";
16869
+ if (this.configuration && this.configuration.apiKey) {
16870
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
16871
+ }
16872
+ if (this.configuration && this.configuration.apiKey) {
16873
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16874
+ }
16875
+ const response = await this.request({
16876
+ path: `/auth/application`,
16877
+ method: "PATCH",
16878
+ headers: headerParameters,
16879
+ query: queryParameters,
16880
+ body: SetSelfApplicationTestRecipientsRequestToJSON(requestParameters["setSelfApplicationTestRecipientsRequest"])
16881
+ }, initOverrides);
16882
+ return new JSONApiResponse(response, (jsonValue) => ApplicationSelfResponseFromJSON(jsonValue));
16883
+ }
16884
+ /**
16885
+ * Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
16886
+ * Set the authenticating application\'s auth-email test allowlist
16887
+ */
16888
+ async setSelfApplicationTestRecipients(setSelfApplicationTestRecipientsRequest, initOverrides) {
16889
+ const response = await this.setSelfApplicationTestRecipientsRaw({ setSelfApplicationTestRecipientsRequest }, initOverrides);
16890
+ return await response.value();
16891
+ }
16892
+ };
16893
+
16561
16894
  // src/src/apis/AuthEmailOTPApi.ts
16562
16895
  var AuthEmailOTPApi = class extends BaseAPI {
16563
16896
  /**
@@ -17021,7 +17354,7 @@ var AuthEmailTemplatesApi = class extends BaseAPI {
17021
17354
  return await response.value();
17022
17355
  }
17023
17356
  /**
17024
- * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
17357
+ * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
17025
17358
  * Send a test render of a template
17026
17359
  */
17027
17360
  async sendAuthEmailTemplateTestRaw(requestParameters, initOverrides) {
@@ -17056,7 +17389,7 @@ var AuthEmailTemplatesApi = class extends BaseAPI {
17056
17389
  return new JSONApiResponse(response, (jsonValue) => AuthEmailTemplateTestResponseFromJSON(jsonValue));
17057
17390
  }
17058
17391
  /**
17059
- * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
17392
+ * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
17060
17393
  * Send a test render of a template
17061
17394
  */
17062
17395
  async sendAuthEmailTemplateTest(type, authEmailTemplateTestRequest, initOverrides) {
@@ -18987,6 +19320,41 @@ var AuthUserDirectoryApi = class extends BaseAPI {
18987
19320
  async deleteEndUserByApplication(userId, initOverrides) {
18988
19321
  await this.deleteEndUserByApplicationRaw({ userId }, initOverrides);
18989
19322
  }
19323
+ /**
19324
+ * Secret-key-scoped, aggregate view of the sign-in methods configured for a single end user within the authenticating application. Reports whether the user has a password, which OAuth providers are linked, whether MFA is enabled, whether email/phone are verified, and how many passkeys are registered — everything a customer admin needs to build a \"sign-in methods\" screen. Scoped to the application — a caller can never read a user belonging to another application.
19325
+ * Get an end user\'s sign-in methods (server-side admin)
19326
+ */
19327
+ async getEndUserAuthMethodsRaw(requestParameters, initOverrides) {
19328
+ if (requestParameters["userId"] == null) {
19329
+ throw new RequiredError(
19330
+ "userId",
19331
+ 'Required parameter "userId" was null or undefined when calling getEndUserAuthMethods().'
19332
+ );
19333
+ }
19334
+ const queryParameters = {};
19335
+ const headerParameters = {};
19336
+ if (this.configuration && this.configuration.apiKey) {
19337
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
19338
+ }
19339
+ if (this.configuration && this.configuration.apiKey) {
19340
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
19341
+ }
19342
+ const response = await this.request({
19343
+ path: `/auth/users/{user_id}/auth-methods`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
19344
+ method: "GET",
19345
+ headers: headerParameters,
19346
+ query: queryParameters
19347
+ }, initOverrides);
19348
+ return new JSONApiResponse(response, (jsonValue) => GetEndUserAuthMethods200ResponseFromJSON(jsonValue));
19349
+ }
19350
+ /**
19351
+ * Secret-key-scoped, aggregate view of the sign-in methods configured for a single end user within the authenticating application. Reports whether the user has a password, which OAuth providers are linked, whether MFA is enabled, whether email/phone are verified, and how many passkeys are registered — everything a customer admin needs to build a \"sign-in methods\" screen. Scoped to the application — a caller can never read a user belonging to another application.
19352
+ * Get an end user\'s sign-in methods (server-side admin)
19353
+ */
19354
+ async getEndUserAuthMethods(userId, initOverrides) {
19355
+ const response = await this.getEndUserAuthMethodsRaw({ userId }, initOverrides);
19356
+ return await response.value();
19357
+ }
18990
19358
  /**
18991
19359
  * 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.
18992
19360
  * Look up an end user by email (server-side admin)
@@ -19267,6 +19635,47 @@ var ListEndUsersEnvironmentEnum = {
19267
19635
 
19268
19636
  // src/src/apis/AuthUserProfileApi.ts
19269
19637
  var AuthUserProfileApi = class extends BaseAPI {
19638
+ /**
19639
+ * Change the currently authenticated end user\'s password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
19640
+ * Change password (authenticated session)
19641
+ */
19642
+ async changeEndUserPasswordRaw(requestParameters, initOverrides) {
19643
+ if (requestParameters["changePasswordRequest"] == null) {
19644
+ throw new RequiredError(
19645
+ "changePasswordRequest",
19646
+ 'Required parameter "changePasswordRequest" was null or undefined when calling changeEndUserPassword().'
19647
+ );
19648
+ }
19649
+ const queryParameters = {};
19650
+ const headerParameters = {};
19651
+ headerParameters["Content-Type"] = "application/json";
19652
+ if (this.configuration && this.configuration.accessToken) {
19653
+ const token = this.configuration.accessToken;
19654
+ const tokenString = await token("EndUserToken", []);
19655
+ if (tokenString) {
19656
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
19657
+ }
19658
+ }
19659
+ if (this.configuration && this.configuration.apiKey) {
19660
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
19661
+ }
19662
+ const response = await this.request({
19663
+ path: `/auth/users/change-password`,
19664
+ method: "POST",
19665
+ headers: headerParameters,
19666
+ query: queryParameters,
19667
+ body: ChangePasswordRequestToJSON(requestParameters["changePasswordRequest"])
19668
+ }, initOverrides);
19669
+ return new JSONApiResponse(response, (jsonValue) => RefreshTokenResponseFromJSON(jsonValue));
19670
+ }
19671
+ /**
19672
+ * Change the currently authenticated end user\'s password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
19673
+ * Change password (authenticated session)
19674
+ */
19675
+ async changeEndUserPassword(changePasswordRequest, initOverrides) {
19676
+ const response = await this.changeEndUserPasswordRaw({ changePasswordRequest }, initOverrides);
19677
+ return await response.value();
19678
+ }
19270
19679
  /**
19271
19680
  * 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.
19272
19681
  * Delete current end user account
@@ -25845,7 +26254,8 @@ var Zyphr = class {
25845
26254
  emailOtp: new AuthEmailOTPApi(config),
25846
26255
  profile: new AuthUserProfileApi(config),
25847
26256
  userDirectory: new AuthUserDirectoryApi(config),
25848
- webauthn: new AuthWebAuthnApi(config)
26257
+ webauthn: new AuthWebAuthnApi(config),
26258
+ application: new AuthApplicationApi(config)
25849
26259
  };
25850
26260
  }
25851
26261
  /**
@@ -25892,7 +26302,14 @@ var ZyphrClientCredentialError = class extends Error {
25892
26302
  this.name = "ZyphrClientCredentialError";
25893
26303
  }
25894
26304
  };
25895
- var SECRET_KEY_PREFIXES = ["za_sec_", "zy_live_", "zy_test_"];
26305
+ var PUBLISHABLE_KEY_PREFIXES = ["za_live_pub_", "za_test_pub_", "za_pub_"];
26306
+ var SECRET_KEY_PREFIXES = [
26307
+ "za_live_sec_",
26308
+ "za_test_sec_",
26309
+ "za_sec_",
26310
+ "zy_live_",
26311
+ "zy_test_"
26312
+ ];
25896
26313
  var ZyphrClient = class {
25897
26314
  auth;
25898
26315
  /** Device registration for push (takes an OS-acquired token). */
@@ -25901,16 +26318,16 @@ var ZyphrClient = class {
25901
26318
  accessToken;
25902
26319
  constructor(options) {
25903
26320
  if (!options.applicationKey) {
25904
- throw new ZyphrClientCredentialError("applicationKey (za_pub_*) is required");
26321
+ throw new ZyphrClientCredentialError("applicationKey (za_live_pub_* / za_test_pub_*) is required");
25905
26322
  }
25906
26323
  if (SECRET_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
25907
26324
  throw new ZyphrClientCredentialError(
25908
- "ZyphrClient must be constructed with a publishable application key (za_pub_*), never a secret key. Secret keys must stay server-side."
26325
+ "ZyphrClient must be constructed with a publishable application key (za_live_pub_* / za_test_pub_*), never a secret key. Secret keys must stay server-side."
25909
26326
  );
25910
26327
  }
25911
- if (!options.applicationKey.startsWith("za_pub_")) {
26328
+ if (!PUBLISHABLE_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
25912
26329
  throw new ZyphrClientCredentialError(
25913
- "applicationKey must be a publishable application key (za_pub_*)."
26330
+ "applicationKey must be a publishable application key (za_live_pub_* / za_test_pub_*)."
25914
26331
  );
25915
26332
  }
25916
26333
  this.applicationKey = options.applicationKey;
@@ -26014,6 +26431,17 @@ export {
26014
26431
  ApiErrorMetaToJSONTyped,
26015
26432
  ApiErrorToJSON,
26016
26433
  ApiErrorToJSONTyped,
26434
+ ApplicationSelfEnvironmentEnum,
26435
+ ApplicationSelfFromJSON,
26436
+ ApplicationSelfFromJSONTyped,
26437
+ ApplicationSelfResponseFromJSON,
26438
+ ApplicationSelfResponseFromJSONTyped,
26439
+ ApplicationSelfResponseToJSON,
26440
+ ApplicationSelfResponseToJSONTyped,
26441
+ ApplicationSelfSigningAlgorithmEnum,
26442
+ ApplicationSelfToJSON,
26443
+ ApplicationSelfToJSONTyped,
26444
+ AuthApplicationApi,
26017
26445
  AuthEmailOTPApi,
26018
26446
  AuthEmailTemplateDefaultFromJSON,
26019
26447
  AuthEmailTemplateDefaultFromJSONTyped,
@@ -26103,6 +26531,10 @@ export {
26103
26531
  AuthLoginResultToJSONTyped,
26104
26532
  AuthMFAApi,
26105
26533
  AuthMagicLinksApi,
26534
+ AuthMethodsFromJSON,
26535
+ AuthMethodsFromJSONTyped,
26536
+ AuthMethodsToJSON,
26537
+ AuthMethodsToJSONTyped,
26106
26538
  AuthOAuthApi,
26107
26539
  AuthOrganizationsApi,
26108
26540
  AuthPasswordResetApi,
@@ -26178,6 +26610,10 @@ export {
26178
26610
  CategoryResponseToJSONTyped,
26179
26611
  CategoryToJSON,
26180
26612
  CategoryToJSONTyped,
26613
+ ChangePasswordRequestFromJSON,
26614
+ ChangePasswordRequestFromJSONTyped,
26615
+ ChangePasswordRequestToJSON,
26616
+ ChangePasswordRequestToJSONTyped,
26181
26617
  CloseWaaSEndpointCircuit200ResponseDataFromJSON,
26182
26618
  CloseWaaSEndpointCircuit200ResponseDataFromJSONTyped,
26183
26619
  CloseWaaSEndpointCircuit200ResponseDataStateEnum,
@@ -26510,6 +26946,10 @@ export {
26510
26946
  GetDomain200ResponseMetaToJSONTyped,
26511
26947
  GetDomain200ResponseToJSON,
26512
26948
  GetDomain200ResponseToJSONTyped,
26949
+ GetEndUserAuthMethods200ResponseFromJSON,
26950
+ GetEndUserAuthMethods200ResponseFromJSONTyped,
26951
+ GetEndUserAuthMethods200ResponseToJSON,
26952
+ GetEndUserAuthMethods200ResponseToJSONTyped,
26513
26953
  GetEndUserById200ResponseFromJSON,
26514
26954
  GetEndUserById200ResponseFromJSONTyped,
26515
26955
  GetEndUserById200ResponseToJSON,
@@ -27354,6 +27794,10 @@ export {
27354
27794
  SetPreferencesRequestPreferencesInnerToJSONTyped,
27355
27795
  SetPreferencesRequestToJSON,
27356
27796
  SetPreferencesRequestToJSONTyped,
27797
+ SetSelfApplicationTestRecipientsRequestFromJSON,
27798
+ SetSelfApplicationTestRecipientsRequestFromJSONTyped,
27799
+ SetSelfApplicationTestRecipientsRequestToJSON,
27800
+ SetSelfApplicationTestRecipientsRequestToJSONTyped,
27357
27801
  SignInAnonymouslyRequestFromJSON,
27358
27802
  SignInAnonymouslyRequestFromJSONTyped,
27359
27803
  SignInAnonymouslyRequestToJSON,
@@ -27936,6 +28380,11 @@ export {
27936
28380
  WebhookDeliveryStatusEnum,
27937
28381
  WebhookDeliveryToJSON,
27938
28382
  WebhookDeliveryToJSONTyped,
28383
+ WebhookEventType,
28384
+ WebhookEventTypeFromJSON,
28385
+ WebhookEventTypeFromJSONTyped,
28386
+ WebhookEventTypeToJSON,
28387
+ WebhookEventTypeToJSONTyped,
27939
28388
  WebhookEventTypesResponseDataFromJSON,
27940
28389
  WebhookEventTypesResponseDataFromJSONTyped,
27941
28390
  WebhookEventTypesResponseDataToJSON,
@@ -28092,6 +28541,8 @@ export {
28092
28541
  instanceOfApiError,
28093
28542
  instanceOfApiErrorError,
28094
28543
  instanceOfApiErrorMeta,
28544
+ instanceOfApplicationSelf,
28545
+ instanceOfApplicationSelfResponse,
28095
28546
  instanceOfAuthEmailTemplate,
28096
28547
  instanceOfAuthEmailTemplateDefault,
28097
28548
  instanceOfAuthEmailTemplateDefaultResponse,
@@ -28112,6 +28563,7 @@ export {
28112
28563
  instanceOfAuthLoginResponse,
28113
28564
  instanceOfAuthLoginResult,
28114
28565
  instanceOfAuthLoginResultMfaChallenge,
28566
+ instanceOfAuthMethods,
28115
28567
  instanceOfAuthResult,
28116
28568
  instanceOfAuthResultResponse,
28117
28569
  instanceOfAuthSession,
@@ -28127,6 +28579,7 @@ export {
28127
28579
  instanceOfCategory,
28128
28580
  instanceOfCategoryListResponse,
28129
28581
  instanceOfCategoryResponse,
28582
+ instanceOfChangePasswordRequest,
28130
28583
  instanceOfCloseWaaSEndpointCircuit200Response,
28131
28584
  instanceOfCloseWaaSEndpointCircuit200ResponseData,
28132
28585
  instanceOfConfirmEmailVerificationRequest,
@@ -28204,6 +28657,7 @@ export {
28204
28657
  instanceOfGenerateWaaSPortalToken201Response,
28205
28658
  instanceOfGetDomain200Response,
28206
28659
  instanceOfGetDomain200ResponseMeta,
28660
+ instanceOfGetEndUserAuthMethods200Response,
28207
28661
  instanceOfGetEndUserById200Response,
28208
28662
  instanceOfGetEndUserClaims200Response,
28209
28663
  instanceOfGetEndUserClaims200ResponseData,
@@ -28404,6 +28858,7 @@ export {
28404
28858
  instanceOfSetEndUserClaimsRequest,
28405
28859
  instanceOfSetPreferencesRequest,
28406
28860
  instanceOfSetPreferencesRequestPreferencesInner,
28861
+ instanceOfSetSelfApplicationTestRecipientsRequest,
28407
28862
  instanceOfSignInAnonymouslyRequest,
28408
28863
  instanceOfSignInWithGameCenterRequest,
28409
28864
  instanceOfSignInWithGooglePlayGamesRequest,
@@ -28541,6 +28996,7 @@ export {
28541
28996
  instanceOfWebhookDeliveryResponse,
28542
28997
  instanceOfWebhookDeliveryRetryResponse,
28543
28998
  instanceOfWebhookDeliveryRetryResponseData,
28999
+ instanceOfWebhookEventType,
28544
29000
  instanceOfWebhookEventTypesResponse,
28545
29001
  instanceOfWebhookEventTypesResponseData,
28546
29002
  instanceOfWebhookIpsResponse,