lucid-extension-sdk 0.0.127 → 0.0.129

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.127",
3
+ "version": "0.0.129",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataConnector = exports.DataConnectorRequestError = exports.DataConnectorRunError = void 0;
4
+ const checks_1 = require("../core/checks");
4
5
  const action_1 = require("./actions/action");
5
6
  const dataconnectoractionkeys_1 = require("./actions/dataconnectoractionkeys");
6
7
  const managewebhookresponsebody_1 = require("./actions/managewebhookresponsebody");
@@ -100,12 +101,11 @@ class DataConnector {
100
101
  }
101
102
  catch (e) {
102
103
  const errorLogger = console.error ? console.error : console.log;
103
- if (e instanceof DataConnectorRunError) {
104
- errorLogger(`Error running ${actionName} action`, e);
104
+ errorLogger(`Error running ${actionName} action`, e);
105
+ if (isDataConnectorRunError(e)) {
105
106
  return { status: e.status, body: e.body };
106
107
  }
107
108
  else {
108
- errorLogger(`Error running ${actionName} action`, e);
109
109
  return { status: 500, body: { error: `error running ${actionName} action` } };
110
110
  }
111
111
  }
@@ -122,3 +122,7 @@ class DataConnector {
122
122
  }
123
123
  }
124
124
  exports.DataConnector = DataConnector;
125
+ // instanceof DataConnectorRunError will not work in some environments
126
+ function isDataConnectorRunError(e) {
127
+ return (0, checks_1.isObject)(e) && (0, checks_1.isNumber)(e.status) && e.hasOwnProperty('body');
128
+ }
@@ -2,7 +2,7 @@
2
2
  * An enumeration of document element types. A Document element represents a collection of data that is stored on a document.
3
3
  */
4
4
  export declare enum DocumentElementType {
5
- DerivedStructure = "DerivedStructure",
5
+ DataTransformation = "DerivedStructure",
6
6
  Path = "Path",
7
7
  Tag = "Tag",
8
8
  CommentThreadMetadata = "ThreadMetadata",
@@ -6,7 +6,7 @@ exports.DocumentElementType = void 0;
6
6
  */
7
7
  var DocumentElementType;
8
8
  (function (DocumentElementType) {
9
- DocumentElementType["DerivedStructure"] = "DerivedStructure";
9
+ DocumentElementType["DataTransformation"] = "DerivedStructure";
10
10
  DocumentElementType["Path"] = "Path";
11
11
  DocumentElementType["Tag"] = "Tag";
12
12
  DocumentElementType["CommentThreadMetadata"] = "ThreadMetadata";