lucid-extension-sdk 0.0.72 → 0.0.74
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 +12 -0
- package/sdk/editorclient.d.ts +14 -0
- package/sdk/editorclient.js +19 -0
package/package.json
CHANGED
package/sdk/commandtypes.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ export declare const enum CommandName {
|
|
|
81
81
|
RegisterUnfurl = "ru",
|
|
82
82
|
ReloadExtension = "r",
|
|
83
83
|
SendOAuthRequest = "oauth",
|
|
84
|
+
SendPermanentTokenRequest = "perm",
|
|
84
85
|
SendUIMessage = "suim",
|
|
85
86
|
SendXHR = "xhr",
|
|
86
87
|
SetCurrentPage = "scp",
|
|
@@ -358,6 +359,10 @@ export declare type CommandArgs = {
|
|
|
358
359
|
query: SendOAuthRequestQuery;
|
|
359
360
|
result: SendOAuthRequestResponse;
|
|
360
361
|
};
|
|
362
|
+
[CommandName.SendPermanentTokenRequest]: {
|
|
363
|
+
query: SendPermanentTokenRequestQuery;
|
|
364
|
+
result: SendOAuthRequestResponse;
|
|
365
|
+
};
|
|
361
366
|
[CommandName.SendUIMessage]: {
|
|
362
367
|
query: SendUIMessageQuery;
|
|
363
368
|
result: SendUIMessageResult;
|
|
@@ -872,6 +877,8 @@ export declare type RegisterPanelQuery = {
|
|
|
872
877
|
'c': string;
|
|
873
878
|
/** Icon URL, preferably a base64-encoded URL */
|
|
874
879
|
'i': string;
|
|
880
|
+
/** tooltip */
|
|
881
|
+
'to'?: string;
|
|
875
882
|
};
|
|
876
883
|
export declare type RegisterPanelResult = undefined;
|
|
877
884
|
export declare type RegisterUnfurlQuery = {
|
|
@@ -887,7 +894,12 @@ export declare type SendOAuthRequestQuery = SendXHRQuery & {
|
|
|
887
894
|
/** OAuth provider name as specified in the package manifest */
|
|
888
895
|
'p': string;
|
|
889
896
|
};
|
|
897
|
+
export declare type SendPermanentTokenRequestQuery = SendXHRQuery & {
|
|
898
|
+
/** Permanent token provider name as specified in the package manifest */
|
|
899
|
+
'p': string;
|
|
900
|
+
};
|
|
890
901
|
export declare type SendOAuthRequestResponse = SendXHRResponse;
|
|
902
|
+
export declare type SendPermanentTokenRequestResponse = SendXHRResponse;
|
|
891
903
|
export declare type SendUIMessageQuery = {
|
|
892
904
|
/** Name of the UI component's action for receiving events, e.g. ShowModalQuery['n'] */
|
|
893
905
|
'n': string;
|
package/sdk/editorclient.d.ts
CHANGED
|
@@ -82,6 +82,20 @@ export declare class EditorClient {
|
|
|
82
82
|
responseFormat: 'binary';
|
|
83
83
|
}): Promise<BinaryXHRResponse>;
|
|
84
84
|
oauthXhr(providerName: string, request: XHRRequest): Promise<XHRResponse>;
|
|
85
|
+
/**
|
|
86
|
+
* Make a request with a permanent token like a merge account token or API key.
|
|
87
|
+
* @param providerName The name of the authorization provider from the manifest
|
|
88
|
+
* @param request Settings for the network request
|
|
89
|
+
* @returns A promise that will either resolve or reject with an XHRResponse. If the HTTP status
|
|
90
|
+
* code is not 2xx, the promise will reject.
|
|
91
|
+
* @ignore */
|
|
92
|
+
permanentTokenXhr(providerName: string, request: XHRRequest & {
|
|
93
|
+
responseFormat: 'utf8';
|
|
94
|
+
}): Promise<TextXHRResponse>;
|
|
95
|
+
permanentTokenXhr(providerName: string, request: XHRRequest & {
|
|
96
|
+
responseFormat: 'binary';
|
|
97
|
+
}): Promise<BinaryXHRResponse>;
|
|
98
|
+
permanentTokenXhr(providerName: string, request: XHRRequest): Promise<XHRResponse>;
|
|
85
99
|
/**
|
|
86
100
|
* Register a named action. These actions can be triggered from custom UI, for example as the action of a
|
|
87
101
|
* custom menu item.
|
package/sdk/editorclient.js
CHANGED
|
@@ -159,6 +159,25 @@ class EditorClient {
|
|
|
159
159
|
throw parseRawXHRResponse(responseFormat, raw);
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
+
permanentTokenXhr(providerName, request) {
|
|
163
|
+
const responseFormat = request.responseFormat || 'utf8';
|
|
164
|
+
return this.sendCommand("perm" /* CommandName.SendPermanentTokenRequest */, {
|
|
165
|
+
'url': request.url,
|
|
166
|
+
'm': request.method,
|
|
167
|
+
'd': request.data,
|
|
168
|
+
'h': request.headers,
|
|
169
|
+
'ms': request.timeoutMs,
|
|
170
|
+
'p': providerName,
|
|
171
|
+
'f': responseFormat,
|
|
172
|
+
})
|
|
173
|
+
.then((raw) => {
|
|
174
|
+
return parseRawXHRResponse(responseFormat, raw);
|
|
175
|
+
})
|
|
176
|
+
.catch((error) => {
|
|
177
|
+
const raw = (0, commandtypes_1.isRawSendXHRResponse)(error) ? error : undefined;
|
|
178
|
+
throw parseRawXHRResponse(responseFormat, raw);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
162
181
|
/**
|
|
163
182
|
* Register a named action. These actions can be triggered from custom UI, for example as the action of a
|
|
164
183
|
* custom menu item.
|