@zyphr-dev/node-sdk 0.1.51 → 0.1.53
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 +260 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +231 -2
- package/dist/index.d.ts +231 -2
- package/dist/index.js +240 -4
- 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/ApplicationSelf.ts +9 -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/SetSelfApplicationTestRecipientsRequest.ts +9 -1
- package/src/src/models/index.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -871,6 +871,7 @@ function instanceOfApplicationSelf(value) {
|
|
|
871
871
|
if (!("signingAlgorithm" in value) || value["signingAlgorithm"] === void 0) return false;
|
|
872
872
|
if (!("testRecipients" in value) || value["testRecipients"] === void 0) return false;
|
|
873
873
|
if (!("authEmailMode" in value) || value["authEmailMode"] === void 0) return false;
|
|
874
|
+
if (!("passwordDisallowBreached" in value) || value["passwordDisallowBreached"] === void 0) return false;
|
|
874
875
|
return true;
|
|
875
876
|
}
|
|
876
877
|
function ApplicationSelfFromJSON(json) {
|
|
@@ -886,7 +887,8 @@ function ApplicationSelfFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
886
887
|
"environment": json["environment"],
|
|
887
888
|
"signingAlgorithm": json["signing_algorithm"],
|
|
888
889
|
"testRecipients": json["test_recipients"],
|
|
889
|
-
"authEmailMode": json["auth_email_mode"]
|
|
890
|
+
"authEmailMode": json["auth_email_mode"],
|
|
891
|
+
"passwordDisallowBreached": json["password_disallow_breached"]
|
|
890
892
|
};
|
|
891
893
|
}
|
|
892
894
|
function ApplicationSelfToJSON(json) {
|
|
@@ -902,7 +904,8 @@ function ApplicationSelfToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
902
904
|
"environment": value["environment"],
|
|
903
905
|
"signing_algorithm": value["signingAlgorithm"],
|
|
904
906
|
"test_recipients": value["testRecipients"],
|
|
905
|
-
"auth_email_mode": value["authEmailMode"]
|
|
907
|
+
"auth_email_mode": value["authEmailMode"],
|
|
908
|
+
"password_disallow_breached": value["passwordDisallowBreached"]
|
|
906
909
|
};
|
|
907
910
|
}
|
|
908
911
|
|
|
@@ -7733,6 +7736,64 @@ function OAuthAuthorizationUrlResponseToJSONTyped(value, ignoreDiscriminator = f
|
|
|
7733
7736
|
};
|
|
7734
7737
|
}
|
|
7735
7738
|
|
|
7739
|
+
// src/src/models/OAuthAuthorizeResponseData.ts
|
|
7740
|
+
function instanceOfOAuthAuthorizeResponseData(value) {
|
|
7741
|
+
return true;
|
|
7742
|
+
}
|
|
7743
|
+
function OAuthAuthorizeResponseDataFromJSON(json) {
|
|
7744
|
+
return OAuthAuthorizeResponseDataFromJSONTyped(json, false);
|
|
7745
|
+
}
|
|
7746
|
+
function OAuthAuthorizeResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
7747
|
+
if (json == null) {
|
|
7748
|
+
return json;
|
|
7749
|
+
}
|
|
7750
|
+
return {
|
|
7751
|
+
"authorizationUrl": json["authorization_url"] == null ? void 0 : json["authorization_url"],
|
|
7752
|
+
"state": json["state"] == null ? void 0 : json["state"]
|
|
7753
|
+
};
|
|
7754
|
+
}
|
|
7755
|
+
function OAuthAuthorizeResponseDataToJSON(json) {
|
|
7756
|
+
return OAuthAuthorizeResponseDataToJSONTyped(json, false);
|
|
7757
|
+
}
|
|
7758
|
+
function OAuthAuthorizeResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
7759
|
+
if (value == null) {
|
|
7760
|
+
return value;
|
|
7761
|
+
}
|
|
7762
|
+
return {
|
|
7763
|
+
"authorization_url": value["authorizationUrl"],
|
|
7764
|
+
"state": value["state"]
|
|
7765
|
+
};
|
|
7766
|
+
}
|
|
7767
|
+
|
|
7768
|
+
// src/src/models/OAuthAuthorizeResponse.ts
|
|
7769
|
+
function instanceOfOAuthAuthorizeResponse(value) {
|
|
7770
|
+
return true;
|
|
7771
|
+
}
|
|
7772
|
+
function OAuthAuthorizeResponseFromJSON(json) {
|
|
7773
|
+
return OAuthAuthorizeResponseFromJSONTyped(json, false);
|
|
7774
|
+
}
|
|
7775
|
+
function OAuthAuthorizeResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
7776
|
+
if (json == null) {
|
|
7777
|
+
return json;
|
|
7778
|
+
}
|
|
7779
|
+
return {
|
|
7780
|
+
"data": json["data"] == null ? void 0 : OAuthAuthorizeResponseDataFromJSON(json["data"]),
|
|
7781
|
+
"meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
|
|
7782
|
+
};
|
|
7783
|
+
}
|
|
7784
|
+
function OAuthAuthorizeResponseToJSON(json) {
|
|
7785
|
+
return OAuthAuthorizeResponseToJSONTyped(json, false);
|
|
7786
|
+
}
|
|
7787
|
+
function OAuthAuthorizeResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
7788
|
+
if (value == null) {
|
|
7789
|
+
return value;
|
|
7790
|
+
}
|
|
7791
|
+
return {
|
|
7792
|
+
"data": OAuthAuthorizeResponseDataToJSON(value["data"]),
|
|
7793
|
+
"meta": RequestMetaToJSON(value["meta"])
|
|
7794
|
+
};
|
|
7795
|
+
}
|
|
7796
|
+
|
|
7736
7797
|
// src/src/models/OAuthCallbackRequest.ts
|
|
7737
7798
|
function instanceOfOAuthCallbackRequest(value) {
|
|
7738
7799
|
if (!("code" in value) || value["code"] === void 0) return false;
|
|
@@ -8028,6 +8089,64 @@ function OAuthConnectionsResponseToJSONTyped(value, ignoreDiscriminator = false)
|
|
|
8028
8089
|
};
|
|
8029
8090
|
}
|
|
8030
8091
|
|
|
8092
|
+
// src/src/models/OAuthLinkResponseData.ts
|
|
8093
|
+
function instanceOfOAuthLinkResponseData(value) {
|
|
8094
|
+
return true;
|
|
8095
|
+
}
|
|
8096
|
+
function OAuthLinkResponseDataFromJSON(json) {
|
|
8097
|
+
return OAuthLinkResponseDataFromJSONTyped(json, false);
|
|
8098
|
+
}
|
|
8099
|
+
function OAuthLinkResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
8100
|
+
if (json == null) {
|
|
8101
|
+
return json;
|
|
8102
|
+
}
|
|
8103
|
+
return {
|
|
8104
|
+
"success": json["success"] == null ? void 0 : json["success"],
|
|
8105
|
+
"providerInfo": json["provider_info"] == null ? void 0 : OAuthProviderInfoFromJSON(json["provider_info"])
|
|
8106
|
+
};
|
|
8107
|
+
}
|
|
8108
|
+
function OAuthLinkResponseDataToJSON(json) {
|
|
8109
|
+
return OAuthLinkResponseDataToJSONTyped(json, false);
|
|
8110
|
+
}
|
|
8111
|
+
function OAuthLinkResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
8112
|
+
if (value == null) {
|
|
8113
|
+
return value;
|
|
8114
|
+
}
|
|
8115
|
+
return {
|
|
8116
|
+
"success": value["success"],
|
|
8117
|
+
"provider_info": OAuthProviderInfoToJSON(value["providerInfo"])
|
|
8118
|
+
};
|
|
8119
|
+
}
|
|
8120
|
+
|
|
8121
|
+
// src/src/models/OAuthLinkResponse.ts
|
|
8122
|
+
function instanceOfOAuthLinkResponse(value) {
|
|
8123
|
+
return true;
|
|
8124
|
+
}
|
|
8125
|
+
function OAuthLinkResponseFromJSON(json) {
|
|
8126
|
+
return OAuthLinkResponseFromJSONTyped(json, false);
|
|
8127
|
+
}
|
|
8128
|
+
function OAuthLinkResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
8129
|
+
if (json == null) {
|
|
8130
|
+
return json;
|
|
8131
|
+
}
|
|
8132
|
+
return {
|
|
8133
|
+
"data": json["data"] == null ? void 0 : OAuthLinkResponseDataFromJSON(json["data"]),
|
|
8134
|
+
"meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
|
|
8135
|
+
};
|
|
8136
|
+
}
|
|
8137
|
+
function OAuthLinkResponseToJSON(json) {
|
|
8138
|
+
return OAuthLinkResponseToJSONTyped(json, false);
|
|
8139
|
+
}
|
|
8140
|
+
function OAuthLinkResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
8141
|
+
if (value == null) {
|
|
8142
|
+
return value;
|
|
8143
|
+
}
|
|
8144
|
+
return {
|
|
8145
|
+
"data": OAuthLinkResponseDataToJSON(value["data"]),
|
|
8146
|
+
"meta": RequestMetaToJSON(value["meta"])
|
|
8147
|
+
};
|
|
8148
|
+
}
|
|
8149
|
+
|
|
8031
8150
|
// src/src/models/OAuthProvider.ts
|
|
8032
8151
|
function instanceOfOAuthProvider(value) {
|
|
8033
8152
|
return true;
|
|
@@ -12144,7 +12263,8 @@ function SetSelfApplicationTestRecipientsRequestFromJSONTyped(json, ignoreDiscri
|
|
|
12144
12263
|
}
|
|
12145
12264
|
return {
|
|
12146
12265
|
"testRecipients": json["test_recipients"] == null ? void 0 : json["test_recipients"],
|
|
12147
|
-
"authEmailMode": json["auth_email_mode"] == null ? void 0 : json["auth_email_mode"]
|
|
12266
|
+
"authEmailMode": json["auth_email_mode"] == null ? void 0 : json["auth_email_mode"],
|
|
12267
|
+
"passwordDisallowBreached": json["password_disallow_breached"] == null ? void 0 : json["password_disallow_breached"]
|
|
12148
12268
|
};
|
|
12149
12269
|
}
|
|
12150
12270
|
function SetSelfApplicationTestRecipientsRequestToJSON(json) {
|
|
@@ -12156,7 +12276,8 @@ function SetSelfApplicationTestRecipientsRequestToJSONTyped(value, ignoreDiscrim
|
|
|
12156
12276
|
}
|
|
12157
12277
|
return {
|
|
12158
12278
|
"test_recipients": value["testRecipients"],
|
|
12159
|
-
"auth_email_mode": value["authEmailMode"]
|
|
12279
|
+
"auth_email_mode": value["authEmailMode"],
|
|
12280
|
+
"password_disallow_breached": value["passwordDisallowBreached"]
|
|
12160
12281
|
};
|
|
12161
12282
|
}
|
|
12162
12283
|
|
|
@@ -18080,6 +18201,53 @@ var AuthMagicLinksApi = class extends BaseAPI {
|
|
|
18080
18201
|
|
|
18081
18202
|
// src/src/apis/AuthOAuthApi.ts
|
|
18082
18203
|
var AuthOAuthApi = class extends BaseAPI {
|
|
18204
|
+
/**
|
|
18205
|
+
* 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.
|
|
18206
|
+
* Complete linking an OAuth provider to the current account
|
|
18207
|
+
*/
|
|
18208
|
+
async completeOAuthLinkRaw(requestParameters, initOverrides) {
|
|
18209
|
+
if (requestParameters["provider"] == null) {
|
|
18210
|
+
throw new RequiredError(
|
|
18211
|
+
"provider",
|
|
18212
|
+
'Required parameter "provider" was null or undefined when calling completeOAuthLink().'
|
|
18213
|
+
);
|
|
18214
|
+
}
|
|
18215
|
+
if (requestParameters["oAuthCallbackRequest"] == null) {
|
|
18216
|
+
throw new RequiredError(
|
|
18217
|
+
"oAuthCallbackRequest",
|
|
18218
|
+
'Required parameter "oAuthCallbackRequest" was null or undefined when calling completeOAuthLink().'
|
|
18219
|
+
);
|
|
18220
|
+
}
|
|
18221
|
+
const queryParameters = {};
|
|
18222
|
+
const headerParameters = {};
|
|
18223
|
+
headerParameters["Content-Type"] = "application/json";
|
|
18224
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
18225
|
+
const token = this.configuration.accessToken;
|
|
18226
|
+
const tokenString = await token("EndUserToken", []);
|
|
18227
|
+
if (tokenString) {
|
|
18228
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
18229
|
+
}
|
|
18230
|
+
}
|
|
18231
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
18232
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
18233
|
+
}
|
|
18234
|
+
const response = await this.request({
|
|
18235
|
+
path: `/auth/oauth/{provider}/link/callback`.replace(`{${"provider"}}`, encodeURIComponent(String(requestParameters["provider"]))),
|
|
18236
|
+
method: "POST",
|
|
18237
|
+
headers: headerParameters,
|
|
18238
|
+
query: queryParameters,
|
|
18239
|
+
body: OAuthCallbackRequestToJSON(requestParameters["oAuthCallbackRequest"])
|
|
18240
|
+
}, initOverrides);
|
|
18241
|
+
return new JSONApiResponse(response, (jsonValue) => OAuthLinkResponseFromJSON(jsonValue));
|
|
18242
|
+
}
|
|
18243
|
+
/**
|
|
18244
|
+
* 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.
|
|
18245
|
+
* Complete linking an OAuth provider to the current account
|
|
18246
|
+
*/
|
|
18247
|
+
async completeOAuthLink(provider, oAuthCallbackRequest, initOverrides) {
|
|
18248
|
+
const response = await this.completeOAuthLinkRaw({ provider, oAuthCallbackRequest }, initOverrides);
|
|
18249
|
+
return await response.value();
|
|
18250
|
+
}
|
|
18083
18251
|
/**
|
|
18084
18252
|
* Disconnect an OAuth provider from the current user.
|
|
18085
18253
|
* Disconnect OAuth provider
|
|
@@ -18382,6 +18550,54 @@ var AuthOAuthApi = class extends BaseAPI {
|
|
|
18382
18550
|
const response = await this.refreshOAuthTokensRaw({ provider, refreshOAuthTokensRequest }, initOverrides);
|
|
18383
18551
|
return await response.value();
|
|
18384
18552
|
}
|
|
18553
|
+
/**
|
|
18554
|
+
* 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.
|
|
18555
|
+
* Start linking an OAuth provider to the current account
|
|
18556
|
+
*/
|
|
18557
|
+
async startOAuthLinkRaw(requestParameters, initOverrides) {
|
|
18558
|
+
if (requestParameters["provider"] == null) {
|
|
18559
|
+
throw new RequiredError(
|
|
18560
|
+
"provider",
|
|
18561
|
+
'Required parameter "provider" was null or undefined when calling startOAuthLink().'
|
|
18562
|
+
);
|
|
18563
|
+
}
|
|
18564
|
+
if (requestParameters["redirectUri"] == null) {
|
|
18565
|
+
throw new RequiredError(
|
|
18566
|
+
"redirectUri",
|
|
18567
|
+
'Required parameter "redirectUri" was null or undefined when calling startOAuthLink().'
|
|
18568
|
+
);
|
|
18569
|
+
}
|
|
18570
|
+
const queryParameters = {};
|
|
18571
|
+
if (requestParameters["redirectUri"] != null) {
|
|
18572
|
+
queryParameters["redirect_uri"] = requestParameters["redirectUri"];
|
|
18573
|
+
}
|
|
18574
|
+
const headerParameters = {};
|
|
18575
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
18576
|
+
const token = this.configuration.accessToken;
|
|
18577
|
+
const tokenString = await token("EndUserToken", []);
|
|
18578
|
+
if (tokenString) {
|
|
18579
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
18580
|
+
}
|
|
18581
|
+
}
|
|
18582
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
18583
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
18584
|
+
}
|
|
18585
|
+
const response = await this.request({
|
|
18586
|
+
path: `/auth/oauth/{provider}/link`.replace(`{${"provider"}}`, encodeURIComponent(String(requestParameters["provider"]))),
|
|
18587
|
+
method: "GET",
|
|
18588
|
+
headers: headerParameters,
|
|
18589
|
+
query: queryParameters
|
|
18590
|
+
}, initOverrides);
|
|
18591
|
+
return new JSONApiResponse(response, (jsonValue) => OAuthAuthorizeResponseFromJSON(jsonValue));
|
|
18592
|
+
}
|
|
18593
|
+
/**
|
|
18594
|
+
* 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.
|
|
18595
|
+
* Start linking an OAuth provider to the current account
|
|
18596
|
+
*/
|
|
18597
|
+
async startOAuthLink(provider, redirectUri, initOverrides) {
|
|
18598
|
+
const response = await this.startOAuthLinkRaw({ provider, redirectUri }, initOverrides);
|
|
18599
|
+
return await response.value();
|
|
18600
|
+
}
|
|
18385
18601
|
};
|
|
18386
18602
|
|
|
18387
18603
|
// src/src/apis/AuthOrganizationsApi.ts
|
|
@@ -27479,6 +27695,14 @@ export {
|
|
|
27479
27695
|
OAuthAuthorizationUrlResponseFromJSONTyped,
|
|
27480
27696
|
OAuthAuthorizationUrlResponseToJSON,
|
|
27481
27697
|
OAuthAuthorizationUrlResponseToJSONTyped,
|
|
27698
|
+
OAuthAuthorizeResponseDataFromJSON,
|
|
27699
|
+
OAuthAuthorizeResponseDataFromJSONTyped,
|
|
27700
|
+
OAuthAuthorizeResponseDataToJSON,
|
|
27701
|
+
OAuthAuthorizeResponseDataToJSONTyped,
|
|
27702
|
+
OAuthAuthorizeResponseFromJSON,
|
|
27703
|
+
OAuthAuthorizeResponseFromJSONTyped,
|
|
27704
|
+
OAuthAuthorizeResponseToJSON,
|
|
27705
|
+
OAuthAuthorizeResponseToJSONTyped,
|
|
27482
27706
|
OAuthCallbackRequestFromJSON,
|
|
27483
27707
|
OAuthCallbackRequestFromJSONTyped,
|
|
27484
27708
|
OAuthCallbackRequestToJSON,
|
|
@@ -27511,6 +27735,14 @@ export {
|
|
|
27511
27735
|
OAuthConnectionsResponseFromJSONTyped,
|
|
27512
27736
|
OAuthConnectionsResponseToJSON,
|
|
27513
27737
|
OAuthConnectionsResponseToJSONTyped,
|
|
27738
|
+
OAuthLinkResponseDataFromJSON,
|
|
27739
|
+
OAuthLinkResponseDataFromJSONTyped,
|
|
27740
|
+
OAuthLinkResponseDataToJSON,
|
|
27741
|
+
OAuthLinkResponseDataToJSONTyped,
|
|
27742
|
+
OAuthLinkResponseFromJSON,
|
|
27743
|
+
OAuthLinkResponseFromJSONTyped,
|
|
27744
|
+
OAuthLinkResponseToJSON,
|
|
27745
|
+
OAuthLinkResponseToJSONTyped,
|
|
27514
27746
|
OAuthProviderFromJSON,
|
|
27515
27747
|
OAuthProviderFromJSONTyped,
|
|
27516
27748
|
OAuthProviderInfoFromJSON,
|
|
@@ -28948,6 +29180,8 @@ export {
|
|
|
28948
29180
|
instanceOfMfaVerifyRequest,
|
|
28949
29181
|
instanceOfOAuthAuthorizationUrlResponse,
|
|
28950
29182
|
instanceOfOAuthAuthorizationUrlResponseData,
|
|
29183
|
+
instanceOfOAuthAuthorizeResponse,
|
|
29184
|
+
instanceOfOAuthAuthorizeResponseData,
|
|
28951
29185
|
instanceOfOAuthCallbackRequest,
|
|
28952
29186
|
instanceOfOAuthCallbackResponse,
|
|
28953
29187
|
instanceOfOAuthCallbackResponseData,
|
|
@@ -28956,6 +29190,8 @@ export {
|
|
|
28956
29190
|
instanceOfOAuthConnectionInfoResponseData,
|
|
28957
29191
|
instanceOfOAuthConnectionsResponse,
|
|
28958
29192
|
instanceOfOAuthConnectionsResponseData,
|
|
29193
|
+
instanceOfOAuthLinkResponse,
|
|
29194
|
+
instanceOfOAuthLinkResponseData,
|
|
28959
29195
|
instanceOfOAuthProvider,
|
|
28960
29196
|
instanceOfOAuthProviderInfo,
|
|
28961
29197
|
instanceOfOAuthProviderName,
|