@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 +262 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +238 -3
- package/dist/index.d.ts +238 -3
- package/dist/index.js +242 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/.openapi-generator/FILES +4 -0
- package/src/src/apis/AuthOAuthApi.ts +165 -0
- package/src/src/models/OAuthAuthorizeResponse.ts +88 -0
- package/src/src/models/OAuthAuthorizeResponseData.ts +73 -0
- package/src/src/models/OAuthLinkResponse.ts +88 -0
- package/src/src/models/OAuthLinkResponseData.ts +81 -0
- package/src/src/models/PasswordPolicy.ts +9 -0
- package/src/src/models/PasswordStrength.ts +20 -2
- package/src/src/models/index.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -7733,6 +7733,64 @@ function OAuthAuthorizationUrlResponseToJSONTyped(value, ignoreDiscriminator = f
|
|
|
7733
7733
|
};
|
|
7734
7734
|
}
|
|
7735
7735
|
|
|
7736
|
+
// src/src/models/OAuthAuthorizeResponseData.ts
|
|
7737
|
+
function instanceOfOAuthAuthorizeResponseData(value) {
|
|
7738
|
+
return true;
|
|
7739
|
+
}
|
|
7740
|
+
function OAuthAuthorizeResponseDataFromJSON(json) {
|
|
7741
|
+
return OAuthAuthorizeResponseDataFromJSONTyped(json, false);
|
|
7742
|
+
}
|
|
7743
|
+
function OAuthAuthorizeResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
7744
|
+
if (json == null) {
|
|
7745
|
+
return json;
|
|
7746
|
+
}
|
|
7747
|
+
return {
|
|
7748
|
+
"authorizationUrl": json["authorization_url"] == null ? void 0 : json["authorization_url"],
|
|
7749
|
+
"state": json["state"] == null ? void 0 : json["state"]
|
|
7750
|
+
};
|
|
7751
|
+
}
|
|
7752
|
+
function OAuthAuthorizeResponseDataToJSON(json) {
|
|
7753
|
+
return OAuthAuthorizeResponseDataToJSONTyped(json, false);
|
|
7754
|
+
}
|
|
7755
|
+
function OAuthAuthorizeResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
7756
|
+
if (value == null) {
|
|
7757
|
+
return value;
|
|
7758
|
+
}
|
|
7759
|
+
return {
|
|
7760
|
+
"authorization_url": value["authorizationUrl"],
|
|
7761
|
+
"state": value["state"]
|
|
7762
|
+
};
|
|
7763
|
+
}
|
|
7764
|
+
|
|
7765
|
+
// src/src/models/OAuthAuthorizeResponse.ts
|
|
7766
|
+
function instanceOfOAuthAuthorizeResponse(value) {
|
|
7767
|
+
return true;
|
|
7768
|
+
}
|
|
7769
|
+
function OAuthAuthorizeResponseFromJSON(json) {
|
|
7770
|
+
return OAuthAuthorizeResponseFromJSONTyped(json, false);
|
|
7771
|
+
}
|
|
7772
|
+
function OAuthAuthorizeResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
7773
|
+
if (json == null) {
|
|
7774
|
+
return json;
|
|
7775
|
+
}
|
|
7776
|
+
return {
|
|
7777
|
+
"data": json["data"] == null ? void 0 : OAuthAuthorizeResponseDataFromJSON(json["data"]),
|
|
7778
|
+
"meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
|
|
7779
|
+
};
|
|
7780
|
+
}
|
|
7781
|
+
function OAuthAuthorizeResponseToJSON(json) {
|
|
7782
|
+
return OAuthAuthorizeResponseToJSONTyped(json, false);
|
|
7783
|
+
}
|
|
7784
|
+
function OAuthAuthorizeResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
7785
|
+
if (value == null) {
|
|
7786
|
+
return value;
|
|
7787
|
+
}
|
|
7788
|
+
return {
|
|
7789
|
+
"data": OAuthAuthorizeResponseDataToJSON(value["data"]),
|
|
7790
|
+
"meta": RequestMetaToJSON(value["meta"])
|
|
7791
|
+
};
|
|
7792
|
+
}
|
|
7793
|
+
|
|
7736
7794
|
// src/src/models/OAuthCallbackRequest.ts
|
|
7737
7795
|
function instanceOfOAuthCallbackRequest(value) {
|
|
7738
7796
|
if (!("code" in value) || value["code"] === void 0) return false;
|
|
@@ -8028,6 +8086,64 @@ function OAuthConnectionsResponseToJSONTyped(value, ignoreDiscriminator = false)
|
|
|
8028
8086
|
};
|
|
8029
8087
|
}
|
|
8030
8088
|
|
|
8089
|
+
// src/src/models/OAuthLinkResponseData.ts
|
|
8090
|
+
function instanceOfOAuthLinkResponseData(value) {
|
|
8091
|
+
return true;
|
|
8092
|
+
}
|
|
8093
|
+
function OAuthLinkResponseDataFromJSON(json) {
|
|
8094
|
+
return OAuthLinkResponseDataFromJSONTyped(json, false);
|
|
8095
|
+
}
|
|
8096
|
+
function OAuthLinkResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
8097
|
+
if (json == null) {
|
|
8098
|
+
return json;
|
|
8099
|
+
}
|
|
8100
|
+
return {
|
|
8101
|
+
"success": json["success"] == null ? void 0 : json["success"],
|
|
8102
|
+
"providerInfo": json["provider_info"] == null ? void 0 : OAuthProviderInfoFromJSON(json["provider_info"])
|
|
8103
|
+
};
|
|
8104
|
+
}
|
|
8105
|
+
function OAuthLinkResponseDataToJSON(json) {
|
|
8106
|
+
return OAuthLinkResponseDataToJSONTyped(json, false);
|
|
8107
|
+
}
|
|
8108
|
+
function OAuthLinkResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
8109
|
+
if (value == null) {
|
|
8110
|
+
return value;
|
|
8111
|
+
}
|
|
8112
|
+
return {
|
|
8113
|
+
"success": value["success"],
|
|
8114
|
+
"provider_info": OAuthProviderInfoToJSON(value["providerInfo"])
|
|
8115
|
+
};
|
|
8116
|
+
}
|
|
8117
|
+
|
|
8118
|
+
// src/src/models/OAuthLinkResponse.ts
|
|
8119
|
+
function instanceOfOAuthLinkResponse(value) {
|
|
8120
|
+
return true;
|
|
8121
|
+
}
|
|
8122
|
+
function OAuthLinkResponseFromJSON(json) {
|
|
8123
|
+
return OAuthLinkResponseFromJSONTyped(json, false);
|
|
8124
|
+
}
|
|
8125
|
+
function OAuthLinkResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
8126
|
+
if (json == null) {
|
|
8127
|
+
return json;
|
|
8128
|
+
}
|
|
8129
|
+
return {
|
|
8130
|
+
"data": json["data"] == null ? void 0 : OAuthLinkResponseDataFromJSON(json["data"]),
|
|
8131
|
+
"meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
|
|
8132
|
+
};
|
|
8133
|
+
}
|
|
8134
|
+
function OAuthLinkResponseToJSON(json) {
|
|
8135
|
+
return OAuthLinkResponseToJSONTyped(json, false);
|
|
8136
|
+
}
|
|
8137
|
+
function OAuthLinkResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
8138
|
+
if (value == null) {
|
|
8139
|
+
return value;
|
|
8140
|
+
}
|
|
8141
|
+
return {
|
|
8142
|
+
"data": OAuthLinkResponseDataToJSON(value["data"]),
|
|
8143
|
+
"meta": RequestMetaToJSON(value["meta"])
|
|
8144
|
+
};
|
|
8145
|
+
}
|
|
8146
|
+
|
|
8031
8147
|
// src/src/models/OAuthProvider.ts
|
|
8032
8148
|
function instanceOfOAuthProvider(value) {
|
|
8033
8149
|
return true;
|
|
@@ -8581,6 +8697,7 @@ function instanceOfPasswordPolicy(value) {
|
|
|
8581
8697
|
if (!("requireNumbers" in value) || value["requireNumbers"] === void 0) return false;
|
|
8582
8698
|
if (!("requireSpecial" in value) || value["requireSpecial"] === void 0) return false;
|
|
8583
8699
|
if (!("disallowCommon" in value) || value["disallowCommon"] === void 0) return false;
|
|
8700
|
+
if (!("disallowBreached" in value) || value["disallowBreached"] === void 0) return false;
|
|
8584
8701
|
return true;
|
|
8585
8702
|
}
|
|
8586
8703
|
function PasswordPolicyFromJSON(json) {
|
|
@@ -8597,7 +8714,8 @@ function PasswordPolicyFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8597
8714
|
"requireLowercase": json["require_lowercase"],
|
|
8598
8715
|
"requireNumbers": json["require_numbers"],
|
|
8599
8716
|
"requireSpecial": json["require_special"],
|
|
8600
|
-
"disallowCommon": json["disallow_common"]
|
|
8717
|
+
"disallowCommon": json["disallow_common"],
|
|
8718
|
+
"disallowBreached": json["disallow_breached"]
|
|
8601
8719
|
};
|
|
8602
8720
|
}
|
|
8603
8721
|
function PasswordPolicyToJSON(json) {
|
|
@@ -8614,7 +8732,8 @@ function PasswordPolicyToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
8614
8732
|
"require_lowercase": value["requireLowercase"],
|
|
8615
8733
|
"require_numbers": value["requireNumbers"],
|
|
8616
8734
|
"require_special": value["requireSpecial"],
|
|
8617
|
-
"disallow_common": value["disallowCommon"]
|
|
8735
|
+
"disallow_common": value["disallowCommon"],
|
|
8736
|
+
"disallow_breached": value["disallowBreached"]
|
|
8618
8737
|
};
|
|
8619
8738
|
}
|
|
8620
8739
|
|
|
@@ -8687,6 +8806,8 @@ var PasswordStrengthLabelEnum = {
|
|
|
8687
8806
|
};
|
|
8688
8807
|
function instanceOfPasswordStrength(value) {
|
|
8689
8808
|
if (!("valid" in value) || value["valid"] === void 0) return false;
|
|
8809
|
+
if (!("breached" in value) || value["breached"] === void 0) return false;
|
|
8810
|
+
if (!("breachCount" in value) || value["breachCount"] === void 0) return false;
|
|
8690
8811
|
if (!("score" in value) || value["score"] === void 0) return false;
|
|
8691
8812
|
if (!("label" in value) || value["label"] === void 0) return false;
|
|
8692
8813
|
if (!("feedback" in value) || value["feedback"] === void 0) return false;
|
|
@@ -8701,6 +8822,8 @@ function PasswordStrengthFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8701
8822
|
}
|
|
8702
8823
|
return {
|
|
8703
8824
|
"valid": json["valid"],
|
|
8825
|
+
"breached": json["breached"],
|
|
8826
|
+
"breachCount": json["breach_count"],
|
|
8704
8827
|
"score": json["score"],
|
|
8705
8828
|
"label": json["label"],
|
|
8706
8829
|
"feedback": json["feedback"]
|
|
@@ -8715,6 +8838,8 @@ function PasswordStrengthToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
8715
8838
|
}
|
|
8716
8839
|
return {
|
|
8717
8840
|
"valid": value["valid"],
|
|
8841
|
+
"breached": value["breached"],
|
|
8842
|
+
"breach_count": value["breachCount"],
|
|
8718
8843
|
"score": value["score"],
|
|
8719
8844
|
"label": value["label"],
|
|
8720
8845
|
"feedback": value["feedback"]
|
|
@@ -18071,6 +18196,53 @@ var AuthMagicLinksApi = class extends BaseAPI {
|
|
|
18071
18196
|
|
|
18072
18197
|
// src/src/apis/AuthOAuthApi.ts
|
|
18073
18198
|
var AuthOAuthApi = class extends BaseAPI {
|
|
18199
|
+
/**
|
|
18200
|
+
* 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.
|
|
18201
|
+
* Complete linking an OAuth provider to the current account
|
|
18202
|
+
*/
|
|
18203
|
+
async completeOAuthLinkRaw(requestParameters, initOverrides) {
|
|
18204
|
+
if (requestParameters["provider"] == null) {
|
|
18205
|
+
throw new RequiredError(
|
|
18206
|
+
"provider",
|
|
18207
|
+
'Required parameter "provider" was null or undefined when calling completeOAuthLink().'
|
|
18208
|
+
);
|
|
18209
|
+
}
|
|
18210
|
+
if (requestParameters["oAuthCallbackRequest"] == null) {
|
|
18211
|
+
throw new RequiredError(
|
|
18212
|
+
"oAuthCallbackRequest",
|
|
18213
|
+
'Required parameter "oAuthCallbackRequest" was null or undefined when calling completeOAuthLink().'
|
|
18214
|
+
);
|
|
18215
|
+
}
|
|
18216
|
+
const queryParameters = {};
|
|
18217
|
+
const headerParameters = {};
|
|
18218
|
+
headerParameters["Content-Type"] = "application/json";
|
|
18219
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
18220
|
+
const token = this.configuration.accessToken;
|
|
18221
|
+
const tokenString = await token("EndUserToken", []);
|
|
18222
|
+
if (tokenString) {
|
|
18223
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
18224
|
+
}
|
|
18225
|
+
}
|
|
18226
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
18227
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
18228
|
+
}
|
|
18229
|
+
const response = await this.request({
|
|
18230
|
+
path: `/auth/oauth/{provider}/link/callback`.replace(`{${"provider"}}`, encodeURIComponent(String(requestParameters["provider"]))),
|
|
18231
|
+
method: "POST",
|
|
18232
|
+
headers: headerParameters,
|
|
18233
|
+
query: queryParameters,
|
|
18234
|
+
body: OAuthCallbackRequestToJSON(requestParameters["oAuthCallbackRequest"])
|
|
18235
|
+
}, initOverrides);
|
|
18236
|
+
return new JSONApiResponse(response, (jsonValue) => OAuthLinkResponseFromJSON(jsonValue));
|
|
18237
|
+
}
|
|
18238
|
+
/**
|
|
18239
|
+
* 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.
|
|
18240
|
+
* Complete linking an OAuth provider to the current account
|
|
18241
|
+
*/
|
|
18242
|
+
async completeOAuthLink(provider, oAuthCallbackRequest, initOverrides) {
|
|
18243
|
+
const response = await this.completeOAuthLinkRaw({ provider, oAuthCallbackRequest }, initOverrides);
|
|
18244
|
+
return await response.value();
|
|
18245
|
+
}
|
|
18074
18246
|
/**
|
|
18075
18247
|
* Disconnect an OAuth provider from the current user.
|
|
18076
18248
|
* Disconnect OAuth provider
|
|
@@ -18373,6 +18545,54 @@ var AuthOAuthApi = class extends BaseAPI {
|
|
|
18373
18545
|
const response = await this.refreshOAuthTokensRaw({ provider, refreshOAuthTokensRequest }, initOverrides);
|
|
18374
18546
|
return await response.value();
|
|
18375
18547
|
}
|
|
18548
|
+
/**
|
|
18549
|
+
* 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.
|
|
18550
|
+
* Start linking an OAuth provider to the current account
|
|
18551
|
+
*/
|
|
18552
|
+
async startOAuthLinkRaw(requestParameters, initOverrides) {
|
|
18553
|
+
if (requestParameters["provider"] == null) {
|
|
18554
|
+
throw new RequiredError(
|
|
18555
|
+
"provider",
|
|
18556
|
+
'Required parameter "provider" was null or undefined when calling startOAuthLink().'
|
|
18557
|
+
);
|
|
18558
|
+
}
|
|
18559
|
+
if (requestParameters["redirectUri"] == null) {
|
|
18560
|
+
throw new RequiredError(
|
|
18561
|
+
"redirectUri",
|
|
18562
|
+
'Required parameter "redirectUri" was null or undefined when calling startOAuthLink().'
|
|
18563
|
+
);
|
|
18564
|
+
}
|
|
18565
|
+
const queryParameters = {};
|
|
18566
|
+
if (requestParameters["redirectUri"] != null) {
|
|
18567
|
+
queryParameters["redirect_uri"] = requestParameters["redirectUri"];
|
|
18568
|
+
}
|
|
18569
|
+
const headerParameters = {};
|
|
18570
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
18571
|
+
const token = this.configuration.accessToken;
|
|
18572
|
+
const tokenString = await token("EndUserToken", []);
|
|
18573
|
+
if (tokenString) {
|
|
18574
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
18575
|
+
}
|
|
18576
|
+
}
|
|
18577
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
18578
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
18579
|
+
}
|
|
18580
|
+
const response = await this.request({
|
|
18581
|
+
path: `/auth/oauth/{provider}/link`.replace(`{${"provider"}}`, encodeURIComponent(String(requestParameters["provider"]))),
|
|
18582
|
+
method: "GET",
|
|
18583
|
+
headers: headerParameters,
|
|
18584
|
+
query: queryParameters
|
|
18585
|
+
}, initOverrides);
|
|
18586
|
+
return new JSONApiResponse(response, (jsonValue) => OAuthAuthorizeResponseFromJSON(jsonValue));
|
|
18587
|
+
}
|
|
18588
|
+
/**
|
|
18589
|
+
* 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.
|
|
18590
|
+
* Start linking an OAuth provider to the current account
|
|
18591
|
+
*/
|
|
18592
|
+
async startOAuthLink(provider, redirectUri, initOverrides) {
|
|
18593
|
+
const response = await this.startOAuthLinkRaw({ provider, redirectUri }, initOverrides);
|
|
18594
|
+
return await response.value();
|
|
18595
|
+
}
|
|
18376
18596
|
};
|
|
18377
18597
|
|
|
18378
18598
|
// src/src/apis/AuthOrganizationsApi.ts
|
|
@@ -27470,6 +27690,14 @@ export {
|
|
|
27470
27690
|
OAuthAuthorizationUrlResponseFromJSONTyped,
|
|
27471
27691
|
OAuthAuthorizationUrlResponseToJSON,
|
|
27472
27692
|
OAuthAuthorizationUrlResponseToJSONTyped,
|
|
27693
|
+
OAuthAuthorizeResponseDataFromJSON,
|
|
27694
|
+
OAuthAuthorizeResponseDataFromJSONTyped,
|
|
27695
|
+
OAuthAuthorizeResponseDataToJSON,
|
|
27696
|
+
OAuthAuthorizeResponseDataToJSONTyped,
|
|
27697
|
+
OAuthAuthorizeResponseFromJSON,
|
|
27698
|
+
OAuthAuthorizeResponseFromJSONTyped,
|
|
27699
|
+
OAuthAuthorizeResponseToJSON,
|
|
27700
|
+
OAuthAuthorizeResponseToJSONTyped,
|
|
27473
27701
|
OAuthCallbackRequestFromJSON,
|
|
27474
27702
|
OAuthCallbackRequestFromJSONTyped,
|
|
27475
27703
|
OAuthCallbackRequestToJSON,
|
|
@@ -27502,6 +27730,14 @@ export {
|
|
|
27502
27730
|
OAuthConnectionsResponseFromJSONTyped,
|
|
27503
27731
|
OAuthConnectionsResponseToJSON,
|
|
27504
27732
|
OAuthConnectionsResponseToJSONTyped,
|
|
27733
|
+
OAuthLinkResponseDataFromJSON,
|
|
27734
|
+
OAuthLinkResponseDataFromJSONTyped,
|
|
27735
|
+
OAuthLinkResponseDataToJSON,
|
|
27736
|
+
OAuthLinkResponseDataToJSONTyped,
|
|
27737
|
+
OAuthLinkResponseFromJSON,
|
|
27738
|
+
OAuthLinkResponseFromJSONTyped,
|
|
27739
|
+
OAuthLinkResponseToJSON,
|
|
27740
|
+
OAuthLinkResponseToJSONTyped,
|
|
27505
27741
|
OAuthProviderFromJSON,
|
|
27506
27742
|
OAuthProviderFromJSONTyped,
|
|
27507
27743
|
OAuthProviderInfoFromJSON,
|
|
@@ -28939,6 +29175,8 @@ export {
|
|
|
28939
29175
|
instanceOfMfaVerifyRequest,
|
|
28940
29176
|
instanceOfOAuthAuthorizationUrlResponse,
|
|
28941
29177
|
instanceOfOAuthAuthorizationUrlResponseData,
|
|
29178
|
+
instanceOfOAuthAuthorizeResponse,
|
|
29179
|
+
instanceOfOAuthAuthorizeResponseData,
|
|
28942
29180
|
instanceOfOAuthCallbackRequest,
|
|
28943
29181
|
instanceOfOAuthCallbackResponse,
|
|
28944
29182
|
instanceOfOAuthCallbackResponseData,
|
|
@@ -28947,6 +29185,8 @@ export {
|
|
|
28947
29185
|
instanceOfOAuthConnectionInfoResponseData,
|
|
28948
29186
|
instanceOfOAuthConnectionsResponse,
|
|
28949
29187
|
instanceOfOAuthConnectionsResponseData,
|
|
29188
|
+
instanceOfOAuthLinkResponse,
|
|
29189
|
+
instanceOfOAuthLinkResponseData,
|
|
28950
29190
|
instanceOfOAuthProvider,
|
|
28951
29191
|
instanceOfOAuthProviderInfo,
|
|
28952
29192
|
instanceOfOAuthProviderName,
|