lucid-extension-sdk 0.0.182 → 0.0.184

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/commandtypes.d.ts CHANGED
@@ -54,6 +54,7 @@ export declare const enum CommandName {
54
54
  ElementExists = "ee",
55
55
  ExecuteFormula = "ef",
56
56
  FindAvailableSpace = "fas",
57
+ GetOAuthClientId = "goci",
57
58
  GetConnectedLines = "gcl",
58
59
  GetCurrentPage = "gcp",
59
60
  GetCustomShape = "gcs",
@@ -274,6 +275,10 @@ export type CommandArgs = {
274
275
  query: FindAvailableSpaceQuery;
275
276
  result: FindAvailableSpaceResult;
276
277
  };
278
+ [CommandName.GetOAuthClientId]: {
279
+ query: GetOAuthClientIdQuery;
280
+ result: GetOAuthClientIdResult;
281
+ };
277
282
  [CommandName.GetConnectedLines]: {
278
283
  query: GetConnectedLinesQuery;
279
284
  result: GetConnectedLinesResult;
@@ -1003,6 +1008,11 @@ export type GetOAuthTokenQuery = {
1003
1008
  export type GetOAuthTokenResult = Promise<string | undefined>;
1004
1009
  export type GetProductQuery = undefined;
1005
1010
  export type GetProductResult = LucidProduct;
1011
+ export type GetOAuthClientIdQuery = {
1012
+ /** OAuth provider name as specified in the package manifest */
1013
+ 'p': string;
1014
+ };
1015
+ export type GetOAuthClientIdResult = Promise<string | undefined>;
1006
1016
  export type GetPropertyQuery = {
1007
1017
  /** ID of the LucidElement to read a property from, or undefined to read from the LucidDocument */
1008
1018
  'id'?: string | undefined;
package/commandtypes.js CHANGED
@@ -34,6 +34,7 @@ exports.commandTitles = new Map([
34
34
  ["ee" /* CommandName.ElementExists */, 'ElementExists'],
35
35
  ["ef" /* CommandName.ExecuteFormula */, 'ExecuteFormula'],
36
36
  ["fas" /* CommandName.FindAvailableSpace */, 'FindAvailableSpace'],
37
+ ["goci" /* CommandName.GetOAuthClientId */, 'GetOAuthClientId'],
37
38
  ["gcl" /* CommandName.GetConnectedLines */, 'GetConnectedLines'],
38
39
  ["gcp" /* CommandName.GetCurrentPage */, 'GetCurrentPage'],
39
40
  ["gcs" /* CommandName.GetCustomShape */, 'GetCustomShape'],
package/editorclient.d.ts CHANGED
@@ -139,12 +139,19 @@ export declare class EditorClient {
139
139
  oauthXhr(providerName: string, request: OAuthXHRRequest): Promise<XHRResponse>;
140
140
  triggerAuthFlow(providerName: string): TriggerAuthFlowResult;
141
141
  /**
142
- * Fetch the OAuth token if there is one
142
+ * Returns an OAuth token for the given provider, prompting the user to grant access if necessary
143
143
  *
144
144
  * @param providerName Name of the OAuth provider
145
- * @returns An oauth token or undefined if it doesn't exist
145
+ * @returns An oauth token, or undefined if a valid token cannot be obtained
146
146
  */
147
147
  getOAuthToken(providerName: string): Promise<string | undefined>;
148
+ /**
149
+ * Fetch the OAuth Client Id if there is one
150
+ *
151
+ * @param providerName Name of the OAuth provider
152
+ * @returns A oauth client id or undefined if it doesn't exist
153
+ */
154
+ getOAuthClientId(providerName: string): Promise<string | undefined>;
148
155
  /**
149
156
  * Make a request with a permanent token like a merge account token or API key.
150
157
  * @param providerName The name of the authorization provider from the manifest
package/editorclient.js CHANGED
@@ -207,14 +207,23 @@ class EditorClient {
207
207
  });
208
208
  }
209
209
  /**
210
- * Fetch the OAuth token if there is one
210
+ * Returns an OAuth token for the given provider, prompting the user to grant access if necessary
211
211
  *
212
212
  * @param providerName Name of the OAuth provider
213
- * @returns An oauth token or undefined if it doesn't exist
213
+ * @returns An oauth token, or undefined if a valid token cannot be obtained
214
214
  */
215
215
  async getOAuthToken(providerName) {
216
216
  return await this.sendCommand("got" /* CommandName.GetOAuthToken */, { 'p': providerName });
217
217
  }
218
+ /**
219
+ * Fetch the OAuth Client Id if there is one
220
+ *
221
+ * @param providerName Name of the OAuth provider
222
+ * @returns A oauth client id or undefined if it doesn't exist
223
+ */
224
+ async getOAuthClientId(providerName) {
225
+ return await this.sendCommand("goci" /* CommandName.GetOAuthClientId */, { 'p': providerName });
226
+ }
218
227
  permanentTokenXhr(providerName, request) {
219
228
  const responseFormat = request.responseFormat || 'utf8';
220
229
  return this.sendCommand("perm" /* CommandName.SendPermanentTokenRequest */, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.182",
3
+ "version": "0.0.184",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",