lucid-extension-sdk 0.0.71 → 0.0.73
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 +10 -0
- package/sdk/core/checks.d.ts +6 -0
- package/sdk/core/checks.js +10 -1
- 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;
|
|
@@ -887,7 +892,12 @@ export declare type SendOAuthRequestQuery = SendXHRQuery & {
|
|
|
887
892
|
/** OAuth provider name as specified in the package manifest */
|
|
888
893
|
'p': string;
|
|
889
894
|
};
|
|
895
|
+
export declare type SendPermanentTokenRequestQuery = SendXHRQuery & {
|
|
896
|
+
/** Permanent token provider name as specified in the package manifest */
|
|
897
|
+
'p': string;
|
|
898
|
+
};
|
|
890
899
|
export declare type SendOAuthRequestResponse = SendXHRResponse;
|
|
900
|
+
export declare type SendPermanentTokenRequestResponse = SendXHRResponse;
|
|
891
901
|
export declare type SendUIMessageQuery = {
|
|
892
902
|
/** Name of the UI component's action for receiving events, e.g. ShowModalQuery['n'] */
|
|
893
903
|
'n': string;
|
package/sdk/core/checks.d.ts
CHANGED
|
@@ -53,6 +53,12 @@ export declare function isNumber(val: unknown): val is number;
|
|
|
53
53
|
* @return Whether variable is an integer.
|
|
54
54
|
*/
|
|
55
55
|
export declare function isInt(val: unknown): val is number;
|
|
56
|
+
/**
|
|
57
|
+
* Returns true if the specified value is either positive or negative infinity.
|
|
58
|
+
* @param val Variable to test.
|
|
59
|
+
* @returns Whether variable is positive or negative infinity.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isInfinite(val: unknown): val is number;
|
|
56
62
|
export declare function isFunction(val: unknown): val is (...unknownArgs: any[]) => unknown;
|
|
57
63
|
/**
|
|
58
64
|
* Returns true if the specified value is an object (i.e. it's safe to do property accesses on it).
|
package/sdk/core/checks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isInstanceOf = exports.isLiteral = exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isTypedArray = exports.isArray = exports.isRecord = exports.isObject = exports.isFunction = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isUndefined = exports.isNull = exports.isDef = void 0;
|
|
3
|
+
exports.isInstanceOf = exports.isLiteral = exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isTypedArray = exports.isArray = exports.isRecord = exports.isObject = exports.isFunction = exports.isInfinite = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isUndefined = exports.isNull = exports.isDef = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Returns true if the specified value is not undefined.
|
|
6
6
|
*
|
|
@@ -83,6 +83,15 @@ function isInt(val) {
|
|
|
83
83
|
return isNumber(val) && isFinite(val) && val % 1 == 0;
|
|
84
84
|
}
|
|
85
85
|
exports.isInt = isInt;
|
|
86
|
+
/**
|
|
87
|
+
* Returns true if the specified value is either positive or negative infinity.
|
|
88
|
+
* @param val Variable to test.
|
|
89
|
+
* @returns Whether variable is positive or negative infinity.
|
|
90
|
+
*/
|
|
91
|
+
function isInfinite(val) {
|
|
92
|
+
return isNumber(val) && !isNaN(val) && !isFinite(val);
|
|
93
|
+
}
|
|
94
|
+
exports.isInfinite = isInfinite;
|
|
86
95
|
function isFunction(val) {
|
|
87
96
|
return typeof val === 'function';
|
|
88
97
|
}
|
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.
|