@zyphr-dev/node-sdk 0.1.50 → 0.1.52

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.cjs CHANGED
@@ -909,6 +909,14 @@ __export(index_exports, {
909
909
  OAuthAuthorizationUrlResponseFromJSONTyped: () => OAuthAuthorizationUrlResponseFromJSONTyped,
910
910
  OAuthAuthorizationUrlResponseToJSON: () => OAuthAuthorizationUrlResponseToJSON,
911
911
  OAuthAuthorizationUrlResponseToJSONTyped: () => OAuthAuthorizationUrlResponseToJSONTyped,
912
+ OAuthAuthorizeResponseDataFromJSON: () => OAuthAuthorizeResponseDataFromJSON,
913
+ OAuthAuthorizeResponseDataFromJSONTyped: () => OAuthAuthorizeResponseDataFromJSONTyped,
914
+ OAuthAuthorizeResponseDataToJSON: () => OAuthAuthorizeResponseDataToJSON,
915
+ OAuthAuthorizeResponseDataToJSONTyped: () => OAuthAuthorizeResponseDataToJSONTyped,
916
+ OAuthAuthorizeResponseFromJSON: () => OAuthAuthorizeResponseFromJSON,
917
+ OAuthAuthorizeResponseFromJSONTyped: () => OAuthAuthorizeResponseFromJSONTyped,
918
+ OAuthAuthorizeResponseToJSON: () => OAuthAuthorizeResponseToJSON,
919
+ OAuthAuthorizeResponseToJSONTyped: () => OAuthAuthorizeResponseToJSONTyped,
912
920
  OAuthCallbackRequestFromJSON: () => OAuthCallbackRequestFromJSON,
913
921
  OAuthCallbackRequestFromJSONTyped: () => OAuthCallbackRequestFromJSONTyped,
914
922
  OAuthCallbackRequestToJSON: () => OAuthCallbackRequestToJSON,
@@ -941,6 +949,14 @@ __export(index_exports, {
941
949
  OAuthConnectionsResponseFromJSONTyped: () => OAuthConnectionsResponseFromJSONTyped,
942
950
  OAuthConnectionsResponseToJSON: () => OAuthConnectionsResponseToJSON,
943
951
  OAuthConnectionsResponseToJSONTyped: () => OAuthConnectionsResponseToJSONTyped,
952
+ OAuthLinkResponseDataFromJSON: () => OAuthLinkResponseDataFromJSON,
953
+ OAuthLinkResponseDataFromJSONTyped: () => OAuthLinkResponseDataFromJSONTyped,
954
+ OAuthLinkResponseDataToJSON: () => OAuthLinkResponseDataToJSON,
955
+ OAuthLinkResponseDataToJSONTyped: () => OAuthLinkResponseDataToJSONTyped,
956
+ OAuthLinkResponseFromJSON: () => OAuthLinkResponseFromJSON,
957
+ OAuthLinkResponseFromJSONTyped: () => OAuthLinkResponseFromJSONTyped,
958
+ OAuthLinkResponseToJSON: () => OAuthLinkResponseToJSON,
959
+ OAuthLinkResponseToJSONTyped: () => OAuthLinkResponseToJSONTyped,
944
960
  OAuthProviderFromJSON: () => OAuthProviderFromJSON,
945
961
  OAuthProviderFromJSONTyped: () => OAuthProviderFromJSONTyped,
946
962
  OAuthProviderInfoFromJSON: () => OAuthProviderInfoFromJSON,
@@ -2378,6 +2394,8 @@ __export(index_exports, {
2378
2394
  instanceOfMfaVerifyRequest: () => instanceOfMfaVerifyRequest,
2379
2395
  instanceOfOAuthAuthorizationUrlResponse: () => instanceOfOAuthAuthorizationUrlResponse,
2380
2396
  instanceOfOAuthAuthorizationUrlResponseData: () => instanceOfOAuthAuthorizationUrlResponseData,
2397
+ instanceOfOAuthAuthorizeResponse: () => instanceOfOAuthAuthorizeResponse,
2398
+ instanceOfOAuthAuthorizeResponseData: () => instanceOfOAuthAuthorizeResponseData,
2381
2399
  instanceOfOAuthCallbackRequest: () => instanceOfOAuthCallbackRequest,
2382
2400
  instanceOfOAuthCallbackResponse: () => instanceOfOAuthCallbackResponse,
2383
2401
  instanceOfOAuthCallbackResponseData: () => instanceOfOAuthCallbackResponseData,
@@ -2386,6 +2404,8 @@ __export(index_exports, {
2386
2404
  instanceOfOAuthConnectionInfoResponseData: () => instanceOfOAuthConnectionInfoResponseData,
2387
2405
  instanceOfOAuthConnectionsResponse: () => instanceOfOAuthConnectionsResponse,
2388
2406
  instanceOfOAuthConnectionsResponseData: () => instanceOfOAuthConnectionsResponseData,
2407
+ instanceOfOAuthLinkResponse: () => instanceOfOAuthLinkResponse,
2408
+ instanceOfOAuthLinkResponseData: () => instanceOfOAuthLinkResponseData,
2389
2409
  instanceOfOAuthProvider: () => instanceOfOAuthProvider,
2390
2410
  instanceOfOAuthProviderInfo: () => instanceOfOAuthProviderInfo,
2391
2411
  instanceOfOAuthProviderName: () => instanceOfOAuthProviderName,
@@ -10416,6 +10436,64 @@ function OAuthAuthorizationUrlResponseToJSONTyped(value, ignoreDiscriminator = f
10416
10436
  };
10417
10437
  }
10418
10438
 
10439
+ // src/src/models/OAuthAuthorizeResponseData.ts
10440
+ function instanceOfOAuthAuthorizeResponseData(value) {
10441
+ return true;
10442
+ }
10443
+ function OAuthAuthorizeResponseDataFromJSON(json) {
10444
+ return OAuthAuthorizeResponseDataFromJSONTyped(json, false);
10445
+ }
10446
+ function OAuthAuthorizeResponseDataFromJSONTyped(json, ignoreDiscriminator) {
10447
+ if (json == null) {
10448
+ return json;
10449
+ }
10450
+ return {
10451
+ "authorizationUrl": json["authorization_url"] == null ? void 0 : json["authorization_url"],
10452
+ "state": json["state"] == null ? void 0 : json["state"]
10453
+ };
10454
+ }
10455
+ function OAuthAuthorizeResponseDataToJSON(json) {
10456
+ return OAuthAuthorizeResponseDataToJSONTyped(json, false);
10457
+ }
10458
+ function OAuthAuthorizeResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
10459
+ if (value == null) {
10460
+ return value;
10461
+ }
10462
+ return {
10463
+ "authorization_url": value["authorizationUrl"],
10464
+ "state": value["state"]
10465
+ };
10466
+ }
10467
+
10468
+ // src/src/models/OAuthAuthorizeResponse.ts
10469
+ function instanceOfOAuthAuthorizeResponse(value) {
10470
+ return true;
10471
+ }
10472
+ function OAuthAuthorizeResponseFromJSON(json) {
10473
+ return OAuthAuthorizeResponseFromJSONTyped(json, false);
10474
+ }
10475
+ function OAuthAuthorizeResponseFromJSONTyped(json, ignoreDiscriminator) {
10476
+ if (json == null) {
10477
+ return json;
10478
+ }
10479
+ return {
10480
+ "data": json["data"] == null ? void 0 : OAuthAuthorizeResponseDataFromJSON(json["data"]),
10481
+ "meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
10482
+ };
10483
+ }
10484
+ function OAuthAuthorizeResponseToJSON(json) {
10485
+ return OAuthAuthorizeResponseToJSONTyped(json, false);
10486
+ }
10487
+ function OAuthAuthorizeResponseToJSONTyped(value, ignoreDiscriminator = false) {
10488
+ if (value == null) {
10489
+ return value;
10490
+ }
10491
+ return {
10492
+ "data": OAuthAuthorizeResponseDataToJSON(value["data"]),
10493
+ "meta": RequestMetaToJSON(value["meta"])
10494
+ };
10495
+ }
10496
+
10419
10497
  // src/src/models/OAuthCallbackRequest.ts
10420
10498
  function instanceOfOAuthCallbackRequest(value) {
10421
10499
  if (!("code" in value) || value["code"] === void 0) return false;
@@ -10711,6 +10789,64 @@ function OAuthConnectionsResponseToJSONTyped(value, ignoreDiscriminator = false)
10711
10789
  };
10712
10790
  }
10713
10791
 
10792
+ // src/src/models/OAuthLinkResponseData.ts
10793
+ function instanceOfOAuthLinkResponseData(value) {
10794
+ return true;
10795
+ }
10796
+ function OAuthLinkResponseDataFromJSON(json) {
10797
+ return OAuthLinkResponseDataFromJSONTyped(json, false);
10798
+ }
10799
+ function OAuthLinkResponseDataFromJSONTyped(json, ignoreDiscriminator) {
10800
+ if (json == null) {
10801
+ return json;
10802
+ }
10803
+ return {
10804
+ "success": json["success"] == null ? void 0 : json["success"],
10805
+ "providerInfo": json["provider_info"] == null ? void 0 : OAuthProviderInfoFromJSON(json["provider_info"])
10806
+ };
10807
+ }
10808
+ function OAuthLinkResponseDataToJSON(json) {
10809
+ return OAuthLinkResponseDataToJSONTyped(json, false);
10810
+ }
10811
+ function OAuthLinkResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
10812
+ if (value == null) {
10813
+ return value;
10814
+ }
10815
+ return {
10816
+ "success": value["success"],
10817
+ "provider_info": OAuthProviderInfoToJSON(value["providerInfo"])
10818
+ };
10819
+ }
10820
+
10821
+ // src/src/models/OAuthLinkResponse.ts
10822
+ function instanceOfOAuthLinkResponse(value) {
10823
+ return true;
10824
+ }
10825
+ function OAuthLinkResponseFromJSON(json) {
10826
+ return OAuthLinkResponseFromJSONTyped(json, false);
10827
+ }
10828
+ function OAuthLinkResponseFromJSONTyped(json, ignoreDiscriminator) {
10829
+ if (json == null) {
10830
+ return json;
10831
+ }
10832
+ return {
10833
+ "data": json["data"] == null ? void 0 : OAuthLinkResponseDataFromJSON(json["data"]),
10834
+ "meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
10835
+ };
10836
+ }
10837
+ function OAuthLinkResponseToJSON(json) {
10838
+ return OAuthLinkResponseToJSONTyped(json, false);
10839
+ }
10840
+ function OAuthLinkResponseToJSONTyped(value, ignoreDiscriminator = false) {
10841
+ if (value == null) {
10842
+ return value;
10843
+ }
10844
+ return {
10845
+ "data": OAuthLinkResponseDataToJSON(value["data"]),
10846
+ "meta": RequestMetaToJSON(value["meta"])
10847
+ };
10848
+ }
10849
+
10714
10850
  // src/src/models/OAuthProvider.ts
10715
10851
  function instanceOfOAuthProvider(value) {
10716
10852
  return true;
@@ -11264,6 +11400,7 @@ function instanceOfPasswordPolicy(value) {
11264
11400
  if (!("requireNumbers" in value) || value["requireNumbers"] === void 0) return false;
11265
11401
  if (!("requireSpecial" in value) || value["requireSpecial"] === void 0) return false;
11266
11402
  if (!("disallowCommon" in value) || value["disallowCommon"] === void 0) return false;
11403
+ if (!("disallowBreached" in value) || value["disallowBreached"] === void 0) return false;
11267
11404
  return true;
11268
11405
  }
11269
11406
  function PasswordPolicyFromJSON(json) {
@@ -11280,7 +11417,8 @@ function PasswordPolicyFromJSONTyped(json, ignoreDiscriminator) {
11280
11417
  "requireLowercase": json["require_lowercase"],
11281
11418
  "requireNumbers": json["require_numbers"],
11282
11419
  "requireSpecial": json["require_special"],
11283
- "disallowCommon": json["disallow_common"]
11420
+ "disallowCommon": json["disallow_common"],
11421
+ "disallowBreached": json["disallow_breached"]
11284
11422
  };
11285
11423
  }
11286
11424
  function PasswordPolicyToJSON(json) {
@@ -11297,7 +11435,8 @@ function PasswordPolicyToJSONTyped(value, ignoreDiscriminator = false) {
11297
11435
  "require_lowercase": value["requireLowercase"],
11298
11436
  "require_numbers": value["requireNumbers"],
11299
11437
  "require_special": value["requireSpecial"],
11300
- "disallow_common": value["disallowCommon"]
11438
+ "disallow_common": value["disallowCommon"],
11439
+ "disallow_breached": value["disallowBreached"]
11301
11440
  };
11302
11441
  }
11303
11442
 
@@ -11370,6 +11509,8 @@ var PasswordStrengthLabelEnum = {
11370
11509
  };
11371
11510
  function instanceOfPasswordStrength(value) {
11372
11511
  if (!("valid" in value) || value["valid"] === void 0) return false;
11512
+ if (!("breached" in value) || value["breached"] === void 0) return false;
11513
+ if (!("breachCount" in value) || value["breachCount"] === void 0) return false;
11373
11514
  if (!("score" in value) || value["score"] === void 0) return false;
11374
11515
  if (!("label" in value) || value["label"] === void 0) return false;
11375
11516
  if (!("feedback" in value) || value["feedback"] === void 0) return false;
@@ -11384,6 +11525,8 @@ function PasswordStrengthFromJSONTyped(json, ignoreDiscriminator) {
11384
11525
  }
11385
11526
  return {
11386
11527
  "valid": json["valid"],
11528
+ "breached": json["breached"],
11529
+ "breachCount": json["breach_count"],
11387
11530
  "score": json["score"],
11388
11531
  "label": json["label"],
11389
11532
  "feedback": json["feedback"]
@@ -11398,6 +11541,8 @@ function PasswordStrengthToJSONTyped(value, ignoreDiscriminator = false) {
11398
11541
  }
11399
11542
  return {
11400
11543
  "valid": value["valid"],
11544
+ "breached": value["breached"],
11545
+ "breach_count": value["breachCount"],
11401
11546
  "score": value["score"],
11402
11547
  "label": value["label"],
11403
11548
  "feedback": value["feedback"]
@@ -20754,6 +20899,53 @@ var AuthMagicLinksApi = class extends BaseAPI {
20754
20899
 
20755
20900
  // src/src/apis/AuthOAuthApi.ts
20756
20901
  var AuthOAuthApi = class extends BaseAPI {
20902
+ /**
20903
+ * Complete an authenticated account-linking flow started via the link authorize endpoint. Attaches the resolved provider identity to the current end user. Rejects if the provider identity is already linked to a different account, if the provider did not verify the email, or if the linking session does not belong to the authenticated user.
20904
+ * Complete linking an OAuth provider to the current account
20905
+ */
20906
+ async completeOAuthLinkRaw(requestParameters, initOverrides) {
20907
+ if (requestParameters["provider"] == null) {
20908
+ throw new RequiredError(
20909
+ "provider",
20910
+ 'Required parameter "provider" was null or undefined when calling completeOAuthLink().'
20911
+ );
20912
+ }
20913
+ if (requestParameters["oAuthCallbackRequest"] == null) {
20914
+ throw new RequiredError(
20915
+ "oAuthCallbackRequest",
20916
+ 'Required parameter "oAuthCallbackRequest" was null or undefined when calling completeOAuthLink().'
20917
+ );
20918
+ }
20919
+ const queryParameters = {};
20920
+ const headerParameters = {};
20921
+ headerParameters["Content-Type"] = "application/json";
20922
+ if (this.configuration && this.configuration.accessToken) {
20923
+ const token = this.configuration.accessToken;
20924
+ const tokenString = await token("EndUserToken", []);
20925
+ if (tokenString) {
20926
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
20927
+ }
20928
+ }
20929
+ if (this.configuration && this.configuration.apiKey) {
20930
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
20931
+ }
20932
+ const response = await this.request({
20933
+ path: `/auth/oauth/{provider}/link/callback`.replace(`{${"provider"}}`, encodeURIComponent(String(requestParameters["provider"]))),
20934
+ method: "POST",
20935
+ headers: headerParameters,
20936
+ query: queryParameters,
20937
+ body: OAuthCallbackRequestToJSON(requestParameters["oAuthCallbackRequest"])
20938
+ }, initOverrides);
20939
+ return new JSONApiResponse(response, (jsonValue) => OAuthLinkResponseFromJSON(jsonValue));
20940
+ }
20941
+ /**
20942
+ * Complete an authenticated account-linking flow started via the link authorize endpoint. Attaches the resolved provider identity to the current end user. Rejects if the provider identity is already linked to a different account, if the provider did not verify the email, or if the linking session does not belong to the authenticated user.
20943
+ * Complete linking an OAuth provider to the current account
20944
+ */
20945
+ async completeOAuthLink(provider, oAuthCallbackRequest, initOverrides) {
20946
+ const response = await this.completeOAuthLinkRaw({ provider, oAuthCallbackRequest }, initOverrides);
20947
+ return await response.value();
20948
+ }
20757
20949
  /**
20758
20950
  * Disconnect an OAuth provider from the current user.
20759
20951
  * Disconnect OAuth provider
@@ -21056,6 +21248,54 @@ var AuthOAuthApi = class extends BaseAPI {
21056
21248
  const response = await this.refreshOAuthTokensRaw({ provider, refreshOAuthTokensRequest }, initOverrides);
21057
21249
  return await response.value();
21058
21250
  }
21251
+ /**
21252
+ * Begin an authenticated account-linking flow. Unlike the sign-in authorize endpoint, this binds the current end user into the OAuth state so the matching link callback attaches the returned provider identity to THIS account instead of finding-or-creating a user. Requires an end-user token.
21253
+ * Start linking an OAuth provider to the current account
21254
+ */
21255
+ async startOAuthLinkRaw(requestParameters, initOverrides) {
21256
+ if (requestParameters["provider"] == null) {
21257
+ throw new RequiredError(
21258
+ "provider",
21259
+ 'Required parameter "provider" was null or undefined when calling startOAuthLink().'
21260
+ );
21261
+ }
21262
+ if (requestParameters["redirectUri"] == null) {
21263
+ throw new RequiredError(
21264
+ "redirectUri",
21265
+ 'Required parameter "redirectUri" was null or undefined when calling startOAuthLink().'
21266
+ );
21267
+ }
21268
+ const queryParameters = {};
21269
+ if (requestParameters["redirectUri"] != null) {
21270
+ queryParameters["redirect_uri"] = requestParameters["redirectUri"];
21271
+ }
21272
+ const headerParameters = {};
21273
+ if (this.configuration && this.configuration.accessToken) {
21274
+ const token = this.configuration.accessToken;
21275
+ const tokenString = await token("EndUserToken", []);
21276
+ if (tokenString) {
21277
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
21278
+ }
21279
+ }
21280
+ if (this.configuration && this.configuration.apiKey) {
21281
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
21282
+ }
21283
+ const response = await this.request({
21284
+ path: `/auth/oauth/{provider}/link`.replace(`{${"provider"}}`, encodeURIComponent(String(requestParameters["provider"]))),
21285
+ method: "GET",
21286
+ headers: headerParameters,
21287
+ query: queryParameters
21288
+ }, initOverrides);
21289
+ return new JSONApiResponse(response, (jsonValue) => OAuthAuthorizeResponseFromJSON(jsonValue));
21290
+ }
21291
+ /**
21292
+ * Begin an authenticated account-linking flow. Unlike the sign-in authorize endpoint, this binds the current end user into the OAuth state so the matching link callback attaches the returned provider identity to THIS account instead of finding-or-creating a user. Requires an end-user token.
21293
+ * Start linking an OAuth provider to the current account
21294
+ */
21295
+ async startOAuthLink(provider, redirectUri, initOverrides) {
21296
+ const response = await this.startOAuthLinkRaw({ provider, redirectUri }, initOverrides);
21297
+ return await response.value();
21298
+ }
21059
21299
  };
21060
21300
 
21061
21301
  // src/src/apis/AuthOrganizationsApi.ts
@@ -30154,6 +30394,14 @@ var SDK_VERSION = "0.1.0";
30154
30394
  OAuthAuthorizationUrlResponseFromJSONTyped,
30155
30395
  OAuthAuthorizationUrlResponseToJSON,
30156
30396
  OAuthAuthorizationUrlResponseToJSONTyped,
30397
+ OAuthAuthorizeResponseDataFromJSON,
30398
+ OAuthAuthorizeResponseDataFromJSONTyped,
30399
+ OAuthAuthorizeResponseDataToJSON,
30400
+ OAuthAuthorizeResponseDataToJSONTyped,
30401
+ OAuthAuthorizeResponseFromJSON,
30402
+ OAuthAuthorizeResponseFromJSONTyped,
30403
+ OAuthAuthorizeResponseToJSON,
30404
+ OAuthAuthorizeResponseToJSONTyped,
30157
30405
  OAuthCallbackRequestFromJSON,
30158
30406
  OAuthCallbackRequestFromJSONTyped,
30159
30407
  OAuthCallbackRequestToJSON,
@@ -30186,6 +30434,14 @@ var SDK_VERSION = "0.1.0";
30186
30434
  OAuthConnectionsResponseFromJSONTyped,
30187
30435
  OAuthConnectionsResponseToJSON,
30188
30436
  OAuthConnectionsResponseToJSONTyped,
30437
+ OAuthLinkResponseDataFromJSON,
30438
+ OAuthLinkResponseDataFromJSONTyped,
30439
+ OAuthLinkResponseDataToJSON,
30440
+ OAuthLinkResponseDataToJSONTyped,
30441
+ OAuthLinkResponseFromJSON,
30442
+ OAuthLinkResponseFromJSONTyped,
30443
+ OAuthLinkResponseToJSON,
30444
+ OAuthLinkResponseToJSONTyped,
30189
30445
  OAuthProviderFromJSON,
30190
30446
  OAuthProviderFromJSONTyped,
30191
30447
  OAuthProviderInfoFromJSON,
@@ -31623,6 +31879,8 @@ var SDK_VERSION = "0.1.0";
31623
31879
  instanceOfMfaVerifyRequest,
31624
31880
  instanceOfOAuthAuthorizationUrlResponse,
31625
31881
  instanceOfOAuthAuthorizationUrlResponseData,
31882
+ instanceOfOAuthAuthorizeResponse,
31883
+ instanceOfOAuthAuthorizeResponseData,
31626
31884
  instanceOfOAuthCallbackRequest,
31627
31885
  instanceOfOAuthCallbackResponse,
31628
31886
  instanceOfOAuthCallbackResponseData,
@@ -31631,6 +31889,8 @@ var SDK_VERSION = "0.1.0";
31631
31889
  instanceOfOAuthConnectionInfoResponseData,
31632
31890
  instanceOfOAuthConnectionsResponse,
31633
31891
  instanceOfOAuthConnectionsResponseData,
31892
+ instanceOfOAuthLinkResponse,
31893
+ instanceOfOAuthLinkResponseData,
31634
31894
  instanceOfOAuthProvider,
31635
31895
  instanceOfOAuthProviderInfo,
31636
31896
  instanceOfOAuthProviderName,