lucid-extension-sdk 0.0.126 → 0.0.127
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/package.json +1 -1
- package/sdk/commandtypes.d.ts +9 -0
- package/sdk/commandtypes.js +1 -0
- package/sdk/editorclient.d.ts +22 -0
- package/sdk/editorclient.js +11 -0
package/package.json
CHANGED
package/sdk/commandtypes.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ export declare const enum CommandName {
|
|
|
92
92
|
RegisterUnfurl = "ru",
|
|
93
93
|
ReloadExtension = "r",
|
|
94
94
|
SendOAuthRequest = "oauth",
|
|
95
|
+
SendAsyncOAuthRequest = "aoauth",
|
|
95
96
|
SendPermanentTokenRequest = "perm",
|
|
96
97
|
SendUIMessage = "suim",
|
|
97
98
|
SendXHR = "xhr",
|
|
@@ -410,6 +411,10 @@ export declare type CommandArgs = {
|
|
|
410
411
|
query: SendOAuthRequestQuery;
|
|
411
412
|
result: SendOAuthRequestResponse;
|
|
412
413
|
};
|
|
414
|
+
[CommandName.SendAsyncOAuthRequest]: {
|
|
415
|
+
query: SendAsyncOAuthRequestQuery;
|
|
416
|
+
result: SendOAuthRequestResponse;
|
|
417
|
+
};
|
|
413
418
|
[CommandName.SendPermanentTokenRequest]: {
|
|
414
419
|
query: SendPermanentTokenRequestQuery;
|
|
415
420
|
result: SendOAuthRequestResponse;
|
|
@@ -1025,6 +1030,10 @@ export declare type SendOAuthRequestQuery = SendXHRQuery & {
|
|
|
1025
1030
|
/** Post Result To */
|
|
1026
1031
|
'prt'?: string | undefined;
|
|
1027
1032
|
};
|
|
1033
|
+
export declare type SendAsyncOAuthRequestQuery = SendXHRQuery & {
|
|
1034
|
+
/** OAuth provider name as specified in the package manifest */
|
|
1035
|
+
'p': string;
|
|
1036
|
+
};
|
|
1028
1037
|
export declare type SendPermanentTokenRequestQuery = SendXHRQuery & {
|
|
1029
1038
|
/** Permanent token provider name as specified in the package manifest */
|
|
1030
1039
|
'p': string;
|
package/sdk/commandtypes.js
CHANGED
|
@@ -74,6 +74,7 @@ exports.commandTitles = new Map([
|
|
|
74
74
|
["ru" /* CommandName.RegisterUnfurl */, 'RegisterUnfurl'],
|
|
75
75
|
["r" /* CommandName.ReloadExtension */, 'ReloadExtension'],
|
|
76
76
|
["oauth" /* CommandName.SendOAuthRequest */, 'SendOAuthRequest'],
|
|
77
|
+
["aoauth" /* CommandName.SendAsyncOAuthRequest */, 'SendAsyncOAuthRequest'],
|
|
77
78
|
["suim" /* CommandName.SendUIMessage */, 'SendUIMessage'],
|
|
78
79
|
["xhr" /* CommandName.SendXHR */, 'SendXHR'],
|
|
79
80
|
["scp" /* CommandName.SetCurrentPage */, 'SetCurrentPage'],
|
package/sdk/editorclient.d.ts
CHANGED
|
@@ -107,6 +107,28 @@ export declare class EditorClient {
|
|
|
107
107
|
responseFormat: 'binary';
|
|
108
108
|
}): Promise<BinaryXHRResponse>;
|
|
109
109
|
xhr(request: XHRRequest): Promise<XHRResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Make an asyncronous OAuth network request. The request is enqueued to eventually execute. The request may be attempted multiple times with
|
|
112
|
+
* an overall timeout of 120 seconds.
|
|
113
|
+
* @param providerName Name of the OAuth provider
|
|
114
|
+
* @param request Settings for the request
|
|
115
|
+
* @returns A promise that will either resolve or reject with an XHRResponse. If the HTTP status
|
|
116
|
+
* code is not 2xx, the promise will reject.
|
|
117
|
+
*/
|
|
118
|
+
asyncOAuthXhr(providerName: string, request: OAuthXHRRequest & {
|
|
119
|
+
responseFormat: 'utf8';
|
|
120
|
+
}): Promise<TextXHRResponse>;
|
|
121
|
+
asyncOAuthXhr(providerName: string, request: OAuthXHRRequest & {
|
|
122
|
+
responseFormat: 'binary';
|
|
123
|
+
}): Promise<BinaryXHRResponse>;
|
|
124
|
+
asyncOAuthXhr(providerName: string, request: OAuthXHRRequest): Promise<XHRResponse>;
|
|
125
|
+
/**
|
|
126
|
+
* Make an OAuth network request. Make the request immediately and only once with a 10 second timeout.
|
|
127
|
+
* @param providerName Name of the OAuth provider
|
|
128
|
+
* @param request Settings for the request
|
|
129
|
+
* @returns A promise that will either resolve or reject with an XHRResponse. If the HTTP status
|
|
130
|
+
* code is not 2xx, the promise will reject.
|
|
131
|
+
*/
|
|
110
132
|
oauthXhr(providerName: string, request: OAuthXHRRequest & {
|
|
111
133
|
responseFormat: 'utf8';
|
|
112
134
|
}): Promise<TextXHRResponse>;
|
package/sdk/editorclient.js
CHANGED
|
@@ -183,6 +183,17 @@ class EditorClient {
|
|
|
183
183
|
throw parseRawXHRResponse(responseFormat, raw);
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
+
asyncOAuthXhr(providerName, request) {
|
|
187
|
+
const responseFormat = request.responseFormat || 'utf8';
|
|
188
|
+
return this.sendCommand("aoauth" /* CommandName.SendAsyncOAuthRequest */, Object.assign({ 'url': request.url, 'm': request.method, 'd': request.data, 'h': request.headers, 'ms': request.timeoutMs, 'p': providerName, 'f': responseFormat }, (request.postResultTo ? { 'prt': request.postResultTo } : {})))
|
|
189
|
+
.then((raw) => {
|
|
190
|
+
return parseRawXHRResponse(responseFormat, raw);
|
|
191
|
+
})
|
|
192
|
+
.catch((error) => {
|
|
193
|
+
const raw = (0, commandtypes_1.isRawSendXHRResponse)(error) ? error : undefined;
|
|
194
|
+
throw parseRawXHRResponse(responseFormat, raw);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
186
197
|
oauthXhr(providerName, request) {
|
|
187
198
|
const responseFormat = request.responseFormat || 'utf8';
|
|
188
199
|
return this.sendCommand("oauth" /* CommandName.SendOAuthRequest */, Object.assign({ 'url': request.url, 'm': request.method, 'd': request.data, 'h': request.headers, 'ms': request.timeoutMs, 'p': providerName, 'f': responseFormat }, (request.postResultTo ? { 'prt': request.postResultTo } : {})))
|