@zyphr-dev/node-sdk 0.1.51 → 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 +251 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +218 -1
- package/dist/index.d.ts +218 -1
- package/dist/index.js +231 -0
- 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/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;
|
|
@@ -18080,6 +18196,53 @@ var AuthMagicLinksApi = class extends BaseAPI {
|
|
|
18080
18196
|
|
|
18081
18197
|
// src/src/apis/AuthOAuthApi.ts
|
|
18082
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
|
+
}
|
|
18083
18246
|
/**
|
|
18084
18247
|
* Disconnect an OAuth provider from the current user.
|
|
18085
18248
|
* Disconnect OAuth provider
|
|
@@ -18382,6 +18545,54 @@ var AuthOAuthApi = class extends BaseAPI {
|
|
|
18382
18545
|
const response = await this.refreshOAuthTokensRaw({ provider, refreshOAuthTokensRequest }, initOverrides);
|
|
18383
18546
|
return await response.value();
|
|
18384
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
|
+
}
|
|
18385
18596
|
};
|
|
18386
18597
|
|
|
18387
18598
|
// src/src/apis/AuthOrganizationsApi.ts
|
|
@@ -27479,6 +27690,14 @@ export {
|
|
|
27479
27690
|
OAuthAuthorizationUrlResponseFromJSONTyped,
|
|
27480
27691
|
OAuthAuthorizationUrlResponseToJSON,
|
|
27481
27692
|
OAuthAuthorizationUrlResponseToJSONTyped,
|
|
27693
|
+
OAuthAuthorizeResponseDataFromJSON,
|
|
27694
|
+
OAuthAuthorizeResponseDataFromJSONTyped,
|
|
27695
|
+
OAuthAuthorizeResponseDataToJSON,
|
|
27696
|
+
OAuthAuthorizeResponseDataToJSONTyped,
|
|
27697
|
+
OAuthAuthorizeResponseFromJSON,
|
|
27698
|
+
OAuthAuthorizeResponseFromJSONTyped,
|
|
27699
|
+
OAuthAuthorizeResponseToJSON,
|
|
27700
|
+
OAuthAuthorizeResponseToJSONTyped,
|
|
27482
27701
|
OAuthCallbackRequestFromJSON,
|
|
27483
27702
|
OAuthCallbackRequestFromJSONTyped,
|
|
27484
27703
|
OAuthCallbackRequestToJSON,
|
|
@@ -27511,6 +27730,14 @@ export {
|
|
|
27511
27730
|
OAuthConnectionsResponseFromJSONTyped,
|
|
27512
27731
|
OAuthConnectionsResponseToJSON,
|
|
27513
27732
|
OAuthConnectionsResponseToJSONTyped,
|
|
27733
|
+
OAuthLinkResponseDataFromJSON,
|
|
27734
|
+
OAuthLinkResponseDataFromJSONTyped,
|
|
27735
|
+
OAuthLinkResponseDataToJSON,
|
|
27736
|
+
OAuthLinkResponseDataToJSONTyped,
|
|
27737
|
+
OAuthLinkResponseFromJSON,
|
|
27738
|
+
OAuthLinkResponseFromJSONTyped,
|
|
27739
|
+
OAuthLinkResponseToJSON,
|
|
27740
|
+
OAuthLinkResponseToJSONTyped,
|
|
27514
27741
|
OAuthProviderFromJSON,
|
|
27515
27742
|
OAuthProviderFromJSONTyped,
|
|
27516
27743
|
OAuthProviderInfoFromJSON,
|
|
@@ -28948,6 +29175,8 @@ export {
|
|
|
28948
29175
|
instanceOfMfaVerifyRequest,
|
|
28949
29176
|
instanceOfOAuthAuthorizationUrlResponse,
|
|
28950
29177
|
instanceOfOAuthAuthorizationUrlResponseData,
|
|
29178
|
+
instanceOfOAuthAuthorizeResponse,
|
|
29179
|
+
instanceOfOAuthAuthorizeResponseData,
|
|
28951
29180
|
instanceOfOAuthCallbackRequest,
|
|
28952
29181
|
instanceOfOAuthCallbackResponse,
|
|
28953
29182
|
instanceOfOAuthCallbackResponseData,
|
|
@@ -28956,6 +29185,8 @@ export {
|
|
|
28956
29185
|
instanceOfOAuthConnectionInfoResponseData,
|
|
28957
29186
|
instanceOfOAuthConnectionsResponse,
|
|
28958
29187
|
instanceOfOAuthConnectionsResponseData,
|
|
29188
|
+
instanceOfOAuthLinkResponse,
|
|
29189
|
+
instanceOfOAuthLinkResponseData,
|
|
28959
29190
|
instanceOfOAuthProvider,
|
|
28960
29191
|
instanceOfOAuthProviderInfo,
|
|
28961
29192
|
instanceOfOAuthProviderName,
|