@zyphr-dev/node-sdk 0.1.48 → 0.1.49

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
@@ -8565,30 +8565,38 @@ function OrganizationResponseToJSONTyped(value, ignoreDiscriminator = false) {
8565
8565
  };
8566
8566
  }
8567
8567
 
8568
- // src/src/models/PasswordRequirements.ts
8569
- function instanceOfPasswordRequirements(value) {
8568
+ // src/src/models/PasswordPolicy.ts
8569
+ function instanceOfPasswordPolicy(value) {
8570
+ if (!("minLength" in value) || value["minLength"] === void 0) return false;
8571
+ if (!("maxLength" in value) || value["maxLength"] === void 0) return false;
8572
+ if (!("requireUppercase" in value) || value["requireUppercase"] === void 0) return false;
8573
+ if (!("requireLowercase" in value) || value["requireLowercase"] === void 0) return false;
8574
+ if (!("requireNumbers" in value) || value["requireNumbers"] === void 0) return false;
8575
+ if (!("requireSpecial" in value) || value["requireSpecial"] === void 0) return false;
8576
+ if (!("disallowCommon" in value) || value["disallowCommon"] === void 0) return false;
8570
8577
  return true;
8571
8578
  }
8572
- function PasswordRequirementsFromJSON(json) {
8573
- return PasswordRequirementsFromJSONTyped(json, false);
8579
+ function PasswordPolicyFromJSON(json) {
8580
+ return PasswordPolicyFromJSONTyped(json, false);
8574
8581
  }
8575
- function PasswordRequirementsFromJSONTyped(json, ignoreDiscriminator) {
8582
+ function PasswordPolicyFromJSONTyped(json, ignoreDiscriminator) {
8576
8583
  if (json == null) {
8577
8584
  return json;
8578
8585
  }
8579
8586
  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"]
8587
+ "minLength": json["min_length"],
8588
+ "maxLength": json["max_length"],
8589
+ "requireUppercase": json["require_uppercase"],
8590
+ "requireLowercase": json["require_lowercase"],
8591
+ "requireNumbers": json["require_numbers"],
8592
+ "requireSpecial": json["require_special"],
8593
+ "disallowCommon": json["disallow_common"]
8586
8594
  };
8587
8595
  }
8588
- function PasswordRequirementsToJSON(json) {
8589
- return PasswordRequirementsToJSONTyped(json, false);
8596
+ function PasswordPolicyToJSON(json) {
8597
+ return PasswordPolicyToJSONTyped(json, false);
8590
8598
  }
8591
- function PasswordRequirementsToJSONTyped(value, ignoreDiscriminator = false) {
8599
+ function PasswordPolicyToJSONTyped(value, ignoreDiscriminator = false) {
8592
8600
  if (value == null) {
8593
8601
  return value;
8594
8602
  }
@@ -8598,12 +8606,15 @@ function PasswordRequirementsToJSONTyped(value, ignoreDiscriminator = false) {
8598
8606
  "require_uppercase": value["requireUppercase"],
8599
8607
  "require_lowercase": value["requireLowercase"],
8600
8608
  "require_numbers": value["requireNumbers"],
8601
- "require_special": value["requireSpecial"]
8609
+ "require_special": value["requireSpecial"],
8610
+ "disallow_common": value["disallowCommon"]
8602
8611
  };
8603
8612
  }
8604
8613
 
8605
8614
  // src/src/models/PasswordRequirementsResponseData.ts
8606
8615
  function instanceOfPasswordRequirementsResponseData(value) {
8616
+ if (!("policy" in value) || value["policy"] === void 0) return false;
8617
+ if (!("requirements" in value) || value["requirements"] === void 0) return false;
8607
8618
  return true;
8608
8619
  }
8609
8620
  function PasswordRequirementsResponseDataFromJSON(json) {
@@ -8614,7 +8625,8 @@ function PasswordRequirementsResponseDataFromJSONTyped(json, ignoreDiscriminator
8614
8625
  return json;
8615
8626
  }
8616
8627
  return {
8617
- "requirements": json["requirements"] == null ? void 0 : PasswordRequirementsFromJSON(json["requirements"])
8628
+ "policy": PasswordPolicyFromJSON(json["policy"]),
8629
+ "requirements": json["requirements"]
8618
8630
  };
8619
8631
  }
8620
8632
  function PasswordRequirementsResponseDataToJSON(json) {
@@ -8625,7 +8637,8 @@ function PasswordRequirementsResponseDataToJSONTyped(value, ignoreDiscriminator
8625
8637
  return value;
8626
8638
  }
8627
8639
  return {
8628
- "requirements": PasswordRequirementsToJSON(value["requirements"])
8640
+ "policy": PasswordPolicyToJSON(value["policy"]),
8641
+ "requirements": value["requirements"]
8629
8642
  };
8630
8643
  }
8631
8644
 
@@ -8658,6 +8671,108 @@ function PasswordRequirementsResponseToJSONTyped(value, ignoreDiscriminator = fa
8658
8671
  };
8659
8672
  }
8660
8673
 
8674
+ // src/src/models/PasswordStrength.ts
8675
+ var PasswordStrengthLabelEnum = {
8676
+ WEAK: "weak",
8677
+ FAIR: "fair",
8678
+ GOOD: "good",
8679
+ STRONG: "strong"
8680
+ };
8681
+ function instanceOfPasswordStrength(value) {
8682
+ if (!("valid" in value) || value["valid"] === void 0) return false;
8683
+ if (!("score" in value) || value["score"] === void 0) return false;
8684
+ if (!("label" in value) || value["label"] === void 0) return false;
8685
+ if (!("feedback" in value) || value["feedback"] === void 0) return false;
8686
+ return true;
8687
+ }
8688
+ function PasswordStrengthFromJSON(json) {
8689
+ return PasswordStrengthFromJSONTyped(json, false);
8690
+ }
8691
+ function PasswordStrengthFromJSONTyped(json, ignoreDiscriminator) {
8692
+ if (json == null) {
8693
+ return json;
8694
+ }
8695
+ return {
8696
+ "valid": json["valid"],
8697
+ "score": json["score"],
8698
+ "label": json["label"],
8699
+ "feedback": json["feedback"]
8700
+ };
8701
+ }
8702
+ function PasswordStrengthToJSON(json) {
8703
+ return PasswordStrengthToJSONTyped(json, false);
8704
+ }
8705
+ function PasswordStrengthToJSONTyped(value, ignoreDiscriminator = false) {
8706
+ if (value == null) {
8707
+ return value;
8708
+ }
8709
+ return {
8710
+ "valid": value["valid"],
8711
+ "score": value["score"],
8712
+ "label": value["label"],
8713
+ "feedback": value["feedback"]
8714
+ };
8715
+ }
8716
+
8717
+ // src/src/models/PasswordStrengthRequest.ts
8718
+ function instanceOfPasswordStrengthRequest(value) {
8719
+ if (!("password" in value) || value["password"] === void 0) return false;
8720
+ return true;
8721
+ }
8722
+ function PasswordStrengthRequestFromJSON(json) {
8723
+ return PasswordStrengthRequestFromJSONTyped(json, false);
8724
+ }
8725
+ function PasswordStrengthRequestFromJSONTyped(json, ignoreDiscriminator) {
8726
+ if (json == null) {
8727
+ return json;
8728
+ }
8729
+ return {
8730
+ "password": json["password"],
8731
+ "email": json["email"] == null ? void 0 : json["email"]
8732
+ };
8733
+ }
8734
+ function PasswordStrengthRequestToJSON(json) {
8735
+ return PasswordStrengthRequestToJSONTyped(json, false);
8736
+ }
8737
+ function PasswordStrengthRequestToJSONTyped(value, ignoreDiscriminator = false) {
8738
+ if (value == null) {
8739
+ return value;
8740
+ }
8741
+ return {
8742
+ "password": value["password"],
8743
+ "email": value["email"]
8744
+ };
8745
+ }
8746
+
8747
+ // src/src/models/PasswordStrengthResponse.ts
8748
+ function instanceOfPasswordStrengthResponse(value) {
8749
+ return true;
8750
+ }
8751
+ function PasswordStrengthResponseFromJSON(json) {
8752
+ return PasswordStrengthResponseFromJSONTyped(json, false);
8753
+ }
8754
+ function PasswordStrengthResponseFromJSONTyped(json, ignoreDiscriminator) {
8755
+ if (json == null) {
8756
+ return json;
8757
+ }
8758
+ return {
8759
+ "data": json["data"] == null ? void 0 : PasswordStrengthFromJSON(json["data"]),
8760
+ "meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
8761
+ };
8762
+ }
8763
+ function PasswordStrengthResponseToJSON(json) {
8764
+ return PasswordStrengthResponseToJSONTyped(json, false);
8765
+ }
8766
+ function PasswordStrengthResponseToJSONTyped(value, ignoreDiscriminator = false) {
8767
+ if (value == null) {
8768
+ return value;
8769
+ }
8770
+ return {
8771
+ "data": PasswordStrengthToJSON(value["data"]),
8772
+ "meta": RequestMetaToJSON(value["meta"])
8773
+ };
8774
+ }
8775
+
8661
8776
  // src/src/models/PayloadTooLargeErrorErrorDetails.ts
8662
8777
  function instanceOfPayloadTooLargeErrorErrorDetails(value) {
8663
8778
  return true;
@@ -23690,7 +23805,41 @@ var TopicsApi = class extends BaseAPI {
23690
23805
  // src/src/apis/UtilityApi.ts
23691
23806
  var UtilityApi = class extends BaseAPI {
23692
23807
  /**
23693
- * Get password requirements for the application. Useful for client-side validation before registration.
23808
+ * 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.
23809
+ * Check password strength
23810
+ */
23811
+ async checkPasswordStrengthRaw(requestParameters, initOverrides) {
23812
+ if (requestParameters["passwordStrengthRequest"] == null) {
23813
+ throw new RequiredError(
23814
+ "passwordStrengthRequest",
23815
+ 'Required parameter "passwordStrengthRequest" was null or undefined when calling checkPasswordStrength().'
23816
+ );
23817
+ }
23818
+ const queryParameters = {};
23819
+ const headerParameters = {};
23820
+ headerParameters["Content-Type"] = "application/json";
23821
+ if (this.configuration && this.configuration.apiKey) {
23822
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
23823
+ }
23824
+ const response = await this.request({
23825
+ path: `/auth/password-strength`,
23826
+ method: "POST",
23827
+ headers: headerParameters,
23828
+ query: queryParameters,
23829
+ body: PasswordStrengthRequestToJSON(requestParameters["passwordStrengthRequest"])
23830
+ }, initOverrides);
23831
+ return new JSONApiResponse(response, (jsonValue) => PasswordStrengthResponseFromJSON(jsonValue));
23832
+ }
23833
+ /**
23834
+ * 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.
23835
+ * Check password strength
23836
+ */
23837
+ async checkPasswordStrength(passwordStrengthRequest, initOverrides) {
23838
+ const response = await this.checkPasswordStrengthRaw({ passwordStrengthRequest }, initOverrides);
23839
+ return await response.value();
23840
+ }
23841
+ /**
23842
+ * 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
23843
  * Get password requirements
23695
23844
  */
23696
23845
  async getPasswordRequirementsRaw(initOverrides) {
@@ -23708,7 +23857,7 @@ var UtilityApi = class extends BaseAPI {
23708
23857
  return new JSONApiResponse(response, (jsonValue) => PasswordRequirementsResponseFromJSON(jsonValue));
23709
23858
  }
23710
23859
  /**
23711
- * Get password requirements for the application. Useful for client-side validation before registration.
23860
+ * 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
23861
  * Get password requirements
23713
23862
  */
23714
23863
  async getPasswordRequirements(initOverrides) {
@@ -26206,6 +26355,8 @@ var Zyphr = class {
26206
26355
  webhooks;
26207
26356
  topics;
26208
26357
  devices;
26358
+ /** Publishable-key-safe utilities: password policy + pre-submit strength check. */
26359
+ utility;
26209
26360
  domains;
26210
26361
  /** Inbound (received) email — read access. Requires the `email:read` scope. */
26211
26362
  inbound;
@@ -26233,6 +26384,7 @@ var Zyphr = class {
26233
26384
  this.webhooks = new WebhooksApi(config);
26234
26385
  this.topics = new TopicsApi(config);
26235
26386
  this.devices = new DevicesApi(config);
26387
+ this.utility = new UtilityApi(config);
26236
26388
  this.domains = new DomainsApi(config);
26237
26389
  this.inbound = new InboundEmailApi(config);
26238
26390
  this.waas = {
@@ -26319,6 +26471,12 @@ var ZyphrClient = class {
26319
26471
  auth;
26320
26472
  /** Device registration for push (takes an OS-acquired token). */
26321
26473
  devices;
26474
+ /**
26475
+ * Utility endpoints that are publishable-key-safe: the application's password
26476
+ * policy (`getPasswordRequirements`) and a pre-submit password strength check
26477
+ * (`checkPasswordStrength`). Useful for building a live registration UX.
26478
+ */
26479
+ utility;
26322
26480
  applicationKey;
26323
26481
  accessToken;
26324
26482
  constructor(options) {
@@ -26369,6 +26527,7 @@ var ZyphrClient = class {
26369
26527
  webauthn: new AuthWebAuthnApi(config)
26370
26528
  };
26371
26529
  this.devices = new DevicesApi(config);
26530
+ this.utility = new UtilityApi(config);
26372
26531
  }
26373
26532
  /** Store the end-user access token; it is applied automatically to subsequent user-scoped calls. */
26374
26533
  setAccessToken(accessToken) {
@@ -27403,8 +27562,10 @@ export {
27403
27562
  PaginationMetaFromJSONTyped,
27404
27563
  PaginationMetaToJSON,
27405
27564
  PaginationMetaToJSONTyped,
27406
- PasswordRequirementsFromJSON,
27407
- PasswordRequirementsFromJSONTyped,
27565
+ PasswordPolicyFromJSON,
27566
+ PasswordPolicyFromJSONTyped,
27567
+ PasswordPolicyToJSON,
27568
+ PasswordPolicyToJSONTyped,
27408
27569
  PasswordRequirementsResponseDataFromJSON,
27409
27570
  PasswordRequirementsResponseDataFromJSONTyped,
27410
27571
  PasswordRequirementsResponseDataToJSON,
@@ -27413,8 +27574,19 @@ export {
27413
27574
  PasswordRequirementsResponseFromJSONTyped,
27414
27575
  PasswordRequirementsResponseToJSON,
27415
27576
  PasswordRequirementsResponseToJSONTyped,
27416
- PasswordRequirementsToJSON,
27417
- PasswordRequirementsToJSONTyped,
27577
+ PasswordStrengthFromJSON,
27578
+ PasswordStrengthFromJSONTyped,
27579
+ PasswordStrengthLabelEnum,
27580
+ PasswordStrengthRequestFromJSON,
27581
+ PasswordStrengthRequestFromJSONTyped,
27582
+ PasswordStrengthRequestToJSON,
27583
+ PasswordStrengthRequestToJSONTyped,
27584
+ PasswordStrengthResponseFromJSON,
27585
+ PasswordStrengthResponseFromJSONTyped,
27586
+ PasswordStrengthResponseToJSON,
27587
+ PasswordStrengthResponseToJSONTyped,
27588
+ PasswordStrengthToJSON,
27589
+ PasswordStrengthToJSONTyped,
27418
27590
  PayloadTooLargeErrorErrorCodeEnum,
27419
27591
  PayloadTooLargeErrorErrorDetailsFromJSON,
27420
27592
  PayloadTooLargeErrorErrorDetailsFromJSONTyped,
@@ -28779,9 +28951,12 @@ export {
28779
28951
  instanceOfOrganizationMembershipWithUser,
28780
28952
  instanceOfOrganizationResponse,
28781
28953
  instanceOfPaginationMeta,
28782
- instanceOfPasswordRequirements,
28954
+ instanceOfPasswordPolicy,
28783
28955
  instanceOfPasswordRequirementsResponse,
28784
28956
  instanceOfPasswordRequirementsResponseData,
28957
+ instanceOfPasswordStrength,
28958
+ instanceOfPasswordStrengthRequest,
28959
+ instanceOfPasswordStrengthResponse,
28785
28960
  instanceOfPayloadTooLargeError,
28786
28961
  instanceOfPayloadTooLargeErrorError,
28787
28962
  instanceOfPayloadTooLargeErrorErrorDetails,