lucid-extension-sdk 0.0.181 → 0.0.183

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'],
@@ -103,8 +103,9 @@ export declare class Patch {
103
103
  **/
104
104
  export declare class DataConnectorPatchAction extends DataConnectorAction {
105
105
  /** changes applied by Lucid */ patches: Patch[];
106
+ client: DataSourceClient;
106
107
  constructor(context: DataConnectorActionContext,
107
- /** changes applied by Lucid */ patches: Patch[], name?: string);
108
+ /** changes applied by Lucid */ patches: Patch[], client: DataSourceClient, name?: string);
108
109
  }
109
110
  /**
110
111
  * A description of an existing webhook that Lucid is keeping track of.
@@ -95,9 +95,10 @@ exports.Patch = Patch;
95
95
  **/
96
96
  class DataConnectorPatchAction extends DataConnectorAction {
97
97
  constructor(context,
98
- /** changes applied by Lucid */ patches, name = dataconnectoractionkeys_1.DataConnectorActionKeys.Patch) {
98
+ /** changes applied by Lucid */ patches, client, name = dataconnectoractionkeys_1.DataConnectorActionKeys.Patch) {
99
99
  super(name, context);
100
100
  this.patches = patches;
101
+ this.client = client;
101
102
  }
102
103
  }
103
104
  exports.DataConnectorPatchAction = DataConnectorPatchAction;
@@ -20,7 +20,6 @@ const serializedActionsBaseValidator = (0, validators_1.objectValidator)({
20
20
  });
21
21
  const serializedPatchDataValidator = (0, validators_1.objectValidator)({
22
22
  'packageVersion': checks_1.isString,
23
- 'userCredential': checks_1.isString,
24
23
  'patches': (0, validators_1.arrayValidator)((0, validators_1.objectValidator)({
25
24
  'patch': (0, validators_1.objectValidator)({
26
25
  'itemsAdded': (0, validators_1.objectOfValidator)(checks_1.isObject),
@@ -33,6 +32,8 @@ const serializedPatchDataValidator = (0, validators_1.objectValidator)({
33
32
  }),
34
33
  'id': checks_1.isString,
35
34
  })),
35
+ 'userCredential': checks_1.isString,
36
+ 'documentUpdateToken': checks_1.isString,
36
37
  });
37
38
  const parseSerializedPatches = (patches) => {
38
39
  return patches.map((patch) => {
@@ -61,7 +62,7 @@ function deserializeActions(client, actions) {
61
62
  return data.map((item) => {
62
63
  const context = new action_1.DataConnectorActionContext(actions['packageId'], item['packageVersion'], item['userCredential'], actions['dataConnectorName'], actions['dataConnectorName'], actions['documentCollections'], actions['updateFilterType']);
63
64
  const patches = parseSerializedPatches(item['patches']);
64
- return new action_1.DataConnectorPatchAction(context, patches);
65
+ return new action_1.DataConnectorPatchAction(context, patches, client.getDataSourceClient(item['documentUpdateToken']));
65
66
  });
66
67
  }
67
68
  if (!actions['packageVersion'] || !actions['userCredential']) {
@@ -73,7 +74,7 @@ function deserializeActions(client, actions) {
73
74
  }
74
75
  const context = new action_1.DataConnectorActionContext(actions['packageId'], actions['packageVersion'], actions['userCredential'], actions['dataConnectorName'], actions['dataConnectorName'], actions['documentCollections'], actions['updateFilterType']);
75
76
  return [
76
- new action_1.DataConnectorPatchAction(context, parseSerializedPatches(data['patches']), dataconnectoractionkeys_1.DataConnectorActionKeys.UnbatchedPatch),
77
+ new action_1.DataConnectorPatchAction(context, parseSerializedPatches(data['patches']), client.getDataSourceClient(data['documentUpdateToken']), dataconnectoractionkeys_1.DataConnectorActionKeys.UnbatchedPatch),
77
78
  ];
78
79
  }
79
80
  const context = new action_1.DataConnectorActionContext(actions['packageId'], actions['packageVersion'], actions['userCredential'], actions['dataConnectorName'], actions['dataConnectorName'], actions['documentCollections'], actions['updateFilterType']);
package/editorclient.d.ts CHANGED
@@ -145,6 +145,13 @@ export declare class EditorClient {
145
145
  * @returns An oauth token or undefined if it doesn't exist
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
@@ -215,6 +215,15 @@ class EditorClient {
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.181",
3
+ "version": "0.0.183",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",