@zyphr-dev/node-sdk 0.1.48 → 0.1.50

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
@@ -860,12 +860,17 @@ var ApplicationSelfSigningAlgorithmEnum = {
860
860
  RS256: "RS256",
861
861
  ES256: "ES256"
862
862
  };
863
+ var ApplicationSelfAuthEmailModeEnum = {
864
+ ALLOWLIST: "allowlist",
865
+ UNRESTRICTED: "unrestricted"
866
+ };
863
867
  function instanceOfApplicationSelf(value) {
864
868
  if (!("id" in value) || value["id"] === void 0) return false;
865
869
  if (!("name" in value) || value["name"] === void 0) return false;
866
870
  if (!("environment" in value) || value["environment"] === void 0) return false;
867
871
  if (!("signingAlgorithm" in value) || value["signingAlgorithm"] === void 0) return false;
868
872
  if (!("testRecipients" in value) || value["testRecipients"] === void 0) return false;
873
+ if (!("authEmailMode" in value) || value["authEmailMode"] === void 0) return false;
869
874
  return true;
870
875
  }
871
876
  function ApplicationSelfFromJSON(json) {
@@ -880,7 +885,8 @@ function ApplicationSelfFromJSONTyped(json, ignoreDiscriminator) {
880
885
  "name": json["name"],
881
886
  "environment": json["environment"],
882
887
  "signingAlgorithm": json["signing_algorithm"],
883
- "testRecipients": json["test_recipients"]
888
+ "testRecipients": json["test_recipients"],
889
+ "authEmailMode": json["auth_email_mode"]
884
890
  };
885
891
  }
886
892
  function ApplicationSelfToJSON(json) {
@@ -895,7 +901,8 @@ function ApplicationSelfToJSONTyped(value, ignoreDiscriminator = false) {
895
901
  "name": value["name"],
896
902
  "environment": value["environment"],
897
903
  "signing_algorithm": value["signingAlgorithm"],
898
- "test_recipients": value["testRecipients"]
904
+ "test_recipients": value["testRecipients"],
905
+ "auth_email_mode": value["authEmailMode"]
899
906
  };
900
907
  }
901
908
 
@@ -8565,30 +8572,38 @@ function OrganizationResponseToJSONTyped(value, ignoreDiscriminator = false) {
8565
8572
  };
8566
8573
  }
8567
8574
 
8568
- // src/src/models/PasswordRequirements.ts
8569
- function instanceOfPasswordRequirements(value) {
8575
+ // src/src/models/PasswordPolicy.ts
8576
+ function instanceOfPasswordPolicy(value) {
8577
+ if (!("minLength" in value) || value["minLength"] === void 0) return false;
8578
+ if (!("maxLength" in value) || value["maxLength"] === void 0) return false;
8579
+ if (!("requireUppercase" in value) || value["requireUppercase"] === void 0) return false;
8580
+ if (!("requireLowercase" in value) || value["requireLowercase"] === void 0) return false;
8581
+ if (!("requireNumbers" in value) || value["requireNumbers"] === void 0) return false;
8582
+ if (!("requireSpecial" in value) || value["requireSpecial"] === void 0) return false;
8583
+ if (!("disallowCommon" in value) || value["disallowCommon"] === void 0) return false;
8570
8584
  return true;
8571
8585
  }
8572
- function PasswordRequirementsFromJSON(json) {
8573
- return PasswordRequirementsFromJSONTyped(json, false);
8586
+ function PasswordPolicyFromJSON(json) {
8587
+ return PasswordPolicyFromJSONTyped(json, false);
8574
8588
  }
8575
- function PasswordRequirementsFromJSONTyped(json, ignoreDiscriminator) {
8589
+ function PasswordPolicyFromJSONTyped(json, ignoreDiscriminator) {
8576
8590
  if (json == null) {
8577
8591
  return json;
8578
8592
  }
8579
8593
  return {
8580
- "minLength": json["min_length"] == null ? void 0 : json["min_length"],
8581
- "maxLength": json["max_length"] == null ? void 0 : json["max_length"],
8582
- "requireUppercase": json["require_uppercase"] == null ? void 0 : json["require_uppercase"],
8583
- "requireLowercase": json["require_lowercase"] == null ? void 0 : json["require_lowercase"],
8584
- "requireNumbers": json["require_numbers"] == null ? void 0 : json["require_numbers"],
8585
- "requireSpecial": json["require_special"] == null ? void 0 : json["require_special"]
8594
+ "minLength": json["min_length"],
8595
+ "maxLength": json["max_length"],
8596
+ "requireUppercase": json["require_uppercase"],
8597
+ "requireLowercase": json["require_lowercase"],
8598
+ "requireNumbers": json["require_numbers"],
8599
+ "requireSpecial": json["require_special"],
8600
+ "disallowCommon": json["disallow_common"]
8586
8601
  };
8587
8602
  }
8588
- function PasswordRequirementsToJSON(json) {
8589
- return PasswordRequirementsToJSONTyped(json, false);
8603
+ function PasswordPolicyToJSON(json) {
8604
+ return PasswordPolicyToJSONTyped(json, false);
8590
8605
  }
8591
- function PasswordRequirementsToJSONTyped(value, ignoreDiscriminator = false) {
8606
+ function PasswordPolicyToJSONTyped(value, ignoreDiscriminator = false) {
8592
8607
  if (value == null) {
8593
8608
  return value;
8594
8609
  }
@@ -8598,12 +8613,15 @@ function PasswordRequirementsToJSONTyped(value, ignoreDiscriminator = false) {
8598
8613
  "require_uppercase": value["requireUppercase"],
8599
8614
  "require_lowercase": value["requireLowercase"],
8600
8615
  "require_numbers": value["requireNumbers"],
8601
- "require_special": value["requireSpecial"]
8616
+ "require_special": value["requireSpecial"],
8617
+ "disallow_common": value["disallowCommon"]
8602
8618
  };
8603
8619
  }
8604
8620
 
8605
8621
  // src/src/models/PasswordRequirementsResponseData.ts
8606
8622
  function instanceOfPasswordRequirementsResponseData(value) {
8623
+ if (!("policy" in value) || value["policy"] === void 0) return false;
8624
+ if (!("requirements" in value) || value["requirements"] === void 0) return false;
8607
8625
  return true;
8608
8626
  }
8609
8627
  function PasswordRequirementsResponseDataFromJSON(json) {
@@ -8614,7 +8632,8 @@ function PasswordRequirementsResponseDataFromJSONTyped(json, ignoreDiscriminator
8614
8632
  return json;
8615
8633
  }
8616
8634
  return {
8617
- "requirements": json["requirements"] == null ? void 0 : PasswordRequirementsFromJSON(json["requirements"])
8635
+ "policy": PasswordPolicyFromJSON(json["policy"]),
8636
+ "requirements": json["requirements"]
8618
8637
  };
8619
8638
  }
8620
8639
  function PasswordRequirementsResponseDataToJSON(json) {
@@ -8625,7 +8644,8 @@ function PasswordRequirementsResponseDataToJSONTyped(value, ignoreDiscriminator
8625
8644
  return value;
8626
8645
  }
8627
8646
  return {
8628
- "requirements": PasswordRequirementsToJSON(value["requirements"])
8647
+ "policy": PasswordPolicyToJSON(value["policy"]),
8648
+ "requirements": value["requirements"]
8629
8649
  };
8630
8650
  }
8631
8651
 
@@ -8658,6 +8678,108 @@ function PasswordRequirementsResponseToJSONTyped(value, ignoreDiscriminator = fa
8658
8678
  };
8659
8679
  }
8660
8680
 
8681
+ // src/src/models/PasswordStrength.ts
8682
+ var PasswordStrengthLabelEnum = {
8683
+ WEAK: "weak",
8684
+ FAIR: "fair",
8685
+ GOOD: "good",
8686
+ STRONG: "strong"
8687
+ };
8688
+ function instanceOfPasswordStrength(value) {
8689
+ if (!("valid" in value) || value["valid"] === void 0) return false;
8690
+ if (!("score" in value) || value["score"] === void 0) return false;
8691
+ if (!("label" in value) || value["label"] === void 0) return false;
8692
+ if (!("feedback" in value) || value["feedback"] === void 0) return false;
8693
+ return true;
8694
+ }
8695
+ function PasswordStrengthFromJSON(json) {
8696
+ return PasswordStrengthFromJSONTyped(json, false);
8697
+ }
8698
+ function PasswordStrengthFromJSONTyped(json, ignoreDiscriminator) {
8699
+ if (json == null) {
8700
+ return json;
8701
+ }
8702
+ return {
8703
+ "valid": json["valid"],
8704
+ "score": json["score"],
8705
+ "label": json["label"],
8706
+ "feedback": json["feedback"]
8707
+ };
8708
+ }
8709
+ function PasswordStrengthToJSON(json) {
8710
+ return PasswordStrengthToJSONTyped(json, false);
8711
+ }
8712
+ function PasswordStrengthToJSONTyped(value, ignoreDiscriminator = false) {
8713
+ if (value == null) {
8714
+ return value;
8715
+ }
8716
+ return {
8717
+ "valid": value["valid"],
8718
+ "score": value["score"],
8719
+ "label": value["label"],
8720
+ "feedback": value["feedback"]
8721
+ };
8722
+ }
8723
+
8724
+ // src/src/models/PasswordStrengthRequest.ts
8725
+ function instanceOfPasswordStrengthRequest(value) {
8726
+ if (!("password" in value) || value["password"] === void 0) return false;
8727
+ return true;
8728
+ }
8729
+ function PasswordStrengthRequestFromJSON(json) {
8730
+ return PasswordStrengthRequestFromJSONTyped(json, false);
8731
+ }
8732
+ function PasswordStrengthRequestFromJSONTyped(json, ignoreDiscriminator) {
8733
+ if (json == null) {
8734
+ return json;
8735
+ }
8736
+ return {
8737
+ "password": json["password"],
8738
+ "email": json["email"] == null ? void 0 : json["email"]
8739
+ };
8740
+ }
8741
+ function PasswordStrengthRequestToJSON(json) {
8742
+ return PasswordStrengthRequestToJSONTyped(json, false);
8743
+ }
8744
+ function PasswordStrengthRequestToJSONTyped(value, ignoreDiscriminator = false) {
8745
+ if (value == null) {
8746
+ return value;
8747
+ }
8748
+ return {
8749
+ "password": value["password"],
8750
+ "email": value["email"]
8751
+ };
8752
+ }
8753
+
8754
+ // src/src/models/PasswordStrengthResponse.ts
8755
+ function instanceOfPasswordStrengthResponse(value) {
8756
+ return true;
8757
+ }
8758
+ function PasswordStrengthResponseFromJSON(json) {
8759
+ return PasswordStrengthResponseFromJSONTyped(json, false);
8760
+ }
8761
+ function PasswordStrengthResponseFromJSONTyped(json, ignoreDiscriminator) {
8762
+ if (json == null) {
8763
+ return json;
8764
+ }
8765
+ return {
8766
+ "data": json["data"] == null ? void 0 : PasswordStrengthFromJSON(json["data"]),
8767
+ "meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
8768
+ };
8769
+ }
8770
+ function PasswordStrengthResponseToJSON(json) {
8771
+ return PasswordStrengthResponseToJSONTyped(json, false);
8772
+ }
8773
+ function PasswordStrengthResponseToJSONTyped(value, ignoreDiscriminator = false) {
8774
+ if (value == null) {
8775
+ return value;
8776
+ }
8777
+ return {
8778
+ "data": PasswordStrengthToJSON(value["data"]),
8779
+ "meta": RequestMetaToJSON(value["meta"])
8780
+ };
8781
+ }
8782
+
8661
8783
  // src/src/models/PayloadTooLargeErrorErrorDetails.ts
8662
8784
  function instanceOfPayloadTooLargeErrorErrorDetails(value) {
8663
8785
  return true;
@@ -11997,8 +12119,11 @@ function SetPreferencesRequestToJSONTyped(value, ignoreDiscriminator = false) {
11997
12119
  }
11998
12120
 
11999
12121
  // src/src/models/SetSelfApplicationTestRecipientsRequest.ts
12122
+ var SetSelfApplicationTestRecipientsRequestAuthEmailModeEnum = {
12123
+ ALLOWLIST: "allowlist",
12124
+ UNRESTRICTED: "unrestricted"
12125
+ };
12000
12126
  function instanceOfSetSelfApplicationTestRecipientsRequest(value) {
12001
- if (!("testRecipients" in value) || value["testRecipients"] === void 0) return false;
12002
12127
  return true;
12003
12128
  }
12004
12129
  function SetSelfApplicationTestRecipientsRequestFromJSON(json) {
@@ -12009,7 +12134,8 @@ function SetSelfApplicationTestRecipientsRequestFromJSONTyped(json, ignoreDiscri
12009
12134
  return json;
12010
12135
  }
12011
12136
  return {
12012
- "testRecipients": json["test_recipients"]
12137
+ "testRecipients": json["test_recipients"] == null ? void 0 : json["test_recipients"],
12138
+ "authEmailMode": json["auth_email_mode"] == null ? void 0 : json["auth_email_mode"]
12013
12139
  };
12014
12140
  }
12015
12141
  function SetSelfApplicationTestRecipientsRequestToJSON(json) {
@@ -12020,7 +12146,8 @@ function SetSelfApplicationTestRecipientsRequestToJSONTyped(value, ignoreDiscrim
12020
12146
  return value;
12021
12147
  }
12022
12148
  return {
12023
- "test_recipients": value["testRecipients"]
12149
+ "test_recipients": value["testRecipients"],
12150
+ "auth_email_mode": value["authEmailMode"]
12024
12151
  };
12025
12152
  }
12026
12153
 
@@ -23690,7 +23817,41 @@ var TopicsApi = class extends BaseAPI {
23690
23817
  // src/src/apis/UtilityApi.ts
23691
23818
  var UtilityApi = class extends BaseAPI {
23692
23819
  /**
23693
- * Get password requirements for the application. Useful for client-side validation before registration.
23820
+ * Pre-submit password check for a live registration/reset experience. Returns whether the password would be accepted by the server (`valid`), a strength `score` (0-100) and `label`, and actionable `feedback`. When an `email` is supplied, a password that resembles the email\'s local-part is flagged and marked invalid. The password is never logged or persisted.
23821
+ * Check password strength
23822
+ */
23823
+ async checkPasswordStrengthRaw(requestParameters, initOverrides) {
23824
+ if (requestParameters["passwordStrengthRequest"] == null) {
23825
+ throw new RequiredError(
23826
+ "passwordStrengthRequest",
23827
+ 'Required parameter "passwordStrengthRequest" was null or undefined when calling checkPasswordStrength().'
23828
+ );
23829
+ }
23830
+ const queryParameters = {};
23831
+ const headerParameters = {};
23832
+ headerParameters["Content-Type"] = "application/json";
23833
+ if (this.configuration && this.configuration.apiKey) {
23834
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
23835
+ }
23836
+ const response = await this.request({
23837
+ path: `/auth/password-strength`,
23838
+ method: "POST",
23839
+ headers: headerParameters,
23840
+ query: queryParameters,
23841
+ body: PasswordStrengthRequestToJSON(requestParameters["passwordStrengthRequest"])
23842
+ }, initOverrides);
23843
+ return new JSONApiResponse(response, (jsonValue) => PasswordStrengthResponseFromJSON(jsonValue));
23844
+ }
23845
+ /**
23846
+ * Pre-submit password check for a live registration/reset experience. Returns whether the password would be accepted by the server (`valid`), a strength `score` (0-100) and `label`, and actionable `feedback`. When an `email` is supplied, a password that resembles the email\'s local-part is flagged and marked invalid. The password is never logged or persisted.
23847
+ * Check password strength
23848
+ */
23849
+ async checkPasswordStrength(passwordStrengthRequest, initOverrides) {
23850
+ const response = await this.checkPasswordStrengthRaw({ passwordStrengthRequest }, initOverrides);
23851
+ return await response.value();
23852
+ }
23853
+ /**
23854
+ * Get password requirements for the application. Returns both a structured `policy` object (for driving a live requirements checklist) and human-readable `requirements` display strings. Useful for client-side validation before registration.
23694
23855
  * Get password requirements
23695
23856
  */
23696
23857
  async getPasswordRequirementsRaw(initOverrides) {
@@ -23708,7 +23869,7 @@ var UtilityApi = class extends BaseAPI {
23708
23869
  return new JSONApiResponse(response, (jsonValue) => PasswordRequirementsResponseFromJSON(jsonValue));
23709
23870
  }
23710
23871
  /**
23711
- * Get password requirements for the application. Useful for client-side validation before registration.
23872
+ * Get password requirements for the application. Returns both a structured `policy` object (for driving a live requirements checklist) and human-readable `requirements` display strings. Useful for client-side validation before registration.
23712
23873
  * Get password requirements
23713
23874
  */
23714
23875
  async getPasswordRequirements(initOverrides) {
@@ -26206,6 +26367,8 @@ var Zyphr = class {
26206
26367
  webhooks;
26207
26368
  topics;
26208
26369
  devices;
26370
+ /** Publishable-key-safe utilities: password policy + pre-submit strength check. */
26371
+ utility;
26209
26372
  domains;
26210
26373
  /** Inbound (received) email — read access. Requires the `email:read` scope. */
26211
26374
  inbound;
@@ -26233,6 +26396,7 @@ var Zyphr = class {
26233
26396
  this.webhooks = new WebhooksApi(config);
26234
26397
  this.topics = new TopicsApi(config);
26235
26398
  this.devices = new DevicesApi(config);
26399
+ this.utility = new UtilityApi(config);
26236
26400
  this.domains = new DomainsApi(config);
26237
26401
  this.inbound = new InboundEmailApi(config);
26238
26402
  this.waas = {
@@ -26319,6 +26483,12 @@ var ZyphrClient = class {
26319
26483
  auth;
26320
26484
  /** Device registration for push (takes an OS-acquired token). */
26321
26485
  devices;
26486
+ /**
26487
+ * Utility endpoints that are publishable-key-safe: the application's password
26488
+ * policy (`getPasswordRequirements`) and a pre-submit password strength check
26489
+ * (`checkPasswordStrength`). Useful for building a live registration UX.
26490
+ */
26491
+ utility;
26322
26492
  applicationKey;
26323
26493
  accessToken;
26324
26494
  constructor(options) {
@@ -26369,6 +26539,7 @@ var ZyphrClient = class {
26369
26539
  webauthn: new AuthWebAuthnApi(config)
26370
26540
  };
26371
26541
  this.devices = new DevicesApi(config);
26542
+ this.utility = new UtilityApi(config);
26372
26543
  }
26373
26544
  /** Store the end-user access token; it is applied automatically to subsequent user-scoped calls. */
26374
26545
  setAccessToken(accessToken) {
@@ -26451,6 +26622,7 @@ export {
26451
26622
  ApiErrorMetaToJSONTyped,
26452
26623
  ApiErrorToJSON,
26453
26624
  ApiErrorToJSONTyped,
26625
+ ApplicationSelfAuthEmailModeEnum,
26454
26626
  ApplicationSelfEnvironmentEnum,
26455
26627
  ApplicationSelfFromJSON,
26456
26628
  ApplicationSelfFromJSONTyped,
@@ -27403,8 +27575,10 @@ export {
27403
27575
  PaginationMetaFromJSONTyped,
27404
27576
  PaginationMetaToJSON,
27405
27577
  PaginationMetaToJSONTyped,
27406
- PasswordRequirementsFromJSON,
27407
- PasswordRequirementsFromJSONTyped,
27578
+ PasswordPolicyFromJSON,
27579
+ PasswordPolicyFromJSONTyped,
27580
+ PasswordPolicyToJSON,
27581
+ PasswordPolicyToJSONTyped,
27408
27582
  PasswordRequirementsResponseDataFromJSON,
27409
27583
  PasswordRequirementsResponseDataFromJSONTyped,
27410
27584
  PasswordRequirementsResponseDataToJSON,
@@ -27413,8 +27587,19 @@ export {
27413
27587
  PasswordRequirementsResponseFromJSONTyped,
27414
27588
  PasswordRequirementsResponseToJSON,
27415
27589
  PasswordRequirementsResponseToJSONTyped,
27416
- PasswordRequirementsToJSON,
27417
- PasswordRequirementsToJSONTyped,
27590
+ PasswordStrengthFromJSON,
27591
+ PasswordStrengthFromJSONTyped,
27592
+ PasswordStrengthLabelEnum,
27593
+ PasswordStrengthRequestFromJSON,
27594
+ PasswordStrengthRequestFromJSONTyped,
27595
+ PasswordStrengthRequestToJSON,
27596
+ PasswordStrengthRequestToJSONTyped,
27597
+ PasswordStrengthResponseFromJSON,
27598
+ PasswordStrengthResponseFromJSONTyped,
27599
+ PasswordStrengthResponseToJSON,
27600
+ PasswordStrengthResponseToJSONTyped,
27601
+ PasswordStrengthToJSON,
27602
+ PasswordStrengthToJSONTyped,
27418
27603
  PayloadTooLargeErrorErrorCodeEnum,
27419
27604
  PayloadTooLargeErrorErrorDetailsFromJSON,
27420
27605
  PayloadTooLargeErrorErrorDetailsFromJSONTyped,
@@ -27814,6 +27999,7 @@ export {
27814
27999
  SetPreferencesRequestPreferencesInnerToJSONTyped,
27815
28000
  SetPreferencesRequestToJSON,
27816
28001
  SetPreferencesRequestToJSONTyped,
28002
+ SetSelfApplicationTestRecipientsRequestAuthEmailModeEnum,
27817
28003
  SetSelfApplicationTestRecipientsRequestFromJSON,
27818
28004
  SetSelfApplicationTestRecipientsRequestFromJSONTyped,
27819
28005
  SetSelfApplicationTestRecipientsRequestToJSON,
@@ -28779,9 +28965,12 @@ export {
28779
28965
  instanceOfOrganizationMembershipWithUser,
28780
28966
  instanceOfOrganizationResponse,
28781
28967
  instanceOfPaginationMeta,
28782
- instanceOfPasswordRequirements,
28968
+ instanceOfPasswordPolicy,
28783
28969
  instanceOfPasswordRequirementsResponse,
28784
28970
  instanceOfPasswordRequirementsResponseData,
28971
+ instanceOfPasswordStrength,
28972
+ instanceOfPasswordStrengthRequest,
28973
+ instanceOfPasswordStrengthResponse,
28785
28974
  instanceOfPayloadTooLargeError,
28786
28975
  instanceOfPayloadTooLargeErrorError,
28787
28976
  instanceOfPayloadTooLargeErrorErrorDetails,