lucid-extension-sdk 0.0.231 → 0.0.233

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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataConnector = exports.DataConnectorResponseError = exports.DataConnectorRequestError = exports.DataConnectorRunError = void 0;
4
4
  const checks_1 = require("../core/checks");
5
+ const validators_1 = require("../core/validators/validators");
5
6
  const action_1 = require("./actions/action");
6
7
  const dataconnectoractionkeys_1 = require("./actions/dataconnectoractionkeys");
7
8
  const managewebhookresponsebody_1 = require("./actions/managewebhookresponsebody");
@@ -135,6 +136,7 @@ class DataConnector {
135
136
  }
136
137
  exports.DataConnector = DataConnector;
137
138
  // instanceof DataConnectorRunError will not work in some environments
138
- function isDataConnectorRunError(e) {
139
- return (0, checks_1.isObjectUnsafe)(e) && (0, checks_1.isNumber)(e.status) && e.hasOwnProperty('body');
140
- }
139
+ const isDataConnectorRunError = (0, validators_1.objectValidator)({
140
+ status: checks_1.isNumber,
141
+ body: checks_1.isUnknown,
142
+ });
@@ -20,6 +20,10 @@ export interface BlockEndpointDefinition extends EndpointStyle {
20
20
  /** If set, the distance from the connected block this endpoint should be */
21
21
  padding?: number;
22
22
  }
23
+ /**
24
+ * Checks if the endpoint is a BlockEndpointDefinition.
25
+ */
26
+ export declare function isBlockEndpointDefinition(endpoint: EndpointDefinition): endpoint is BlockEndpointDefinition;
23
27
  /**
24
28
  * A line endpoint that is connected to another line at some distance along that other
25
29
  * line, where 0 is at that line's endpoint1, and 1 is at that line's endpoint2.
@@ -29,6 +33,10 @@ export interface LineEndpointDefinition extends EndpointStyle {
29
33
  /** 0 to 1, distance along the target line */
30
34
  position: number;
31
35
  }
36
+ /**
37
+ * Checks if the endpoint is a LineEndpointDefinition.
38
+ */
39
+ export declare function isLineEndpointDefinition(endpoint: EndpointDefinition): endpoint is LineEndpointDefinition;
32
40
  /**
33
41
  * A line endpoint that is free-floating at the given x/y location on the page
34
42
  */
@@ -37,6 +45,10 @@ export interface PositionEndpointDefinition extends EndpointStyle {
37
45
  x: number;
38
46
  y: number;
39
47
  }
48
+ /**
49
+ * Checks if the endpoint is a PositionEndpointDefinition.
50
+ */
51
+ export declare function isPositionEndpointDefinition(endpoint: EndpointDefinition): endpoint is PositionEndpointDefinition;
40
52
  /**
41
53
  * The definition of one line endpoint, which may be free-floating at a given location, or attached
42
54
  * to another block or line
@@ -1,2 +1,41 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPositionEndpointDefinition = exports.isLineEndpointDefinition = exports.isBlockEndpointDefinition = void 0;
4
+ const checks_1 = require("../core/checks");
5
+ const validators_1 = require("../core/validators/validators");
6
+ const blockproxy_1 = require("./blockproxy");
7
+ const lineproxy_1 = require("./lineproxy");
8
+ /**
9
+ * Checks if the endpoint is a BlockEndpointDefinition.
10
+ */
11
+ function isBlockEndpointDefinition(endpoint) {
12
+ return (0, validators_1.objectValidator)({
13
+ connection: (0, checks_1.isInstanceOf)(blockproxy_1.BlockProxy),
14
+ linkX: checks_1.isNumber,
15
+ linkY: checks_1.isNumber,
16
+ inside: (0, validators_1.option)(checks_1.isBoolean),
17
+ autoLink: (0, validators_1.option)(checks_1.isBoolean),
18
+ padding: (0, validators_1.option)(checks_1.isNumber),
19
+ })(endpoint);
20
+ }
21
+ exports.isBlockEndpointDefinition = isBlockEndpointDefinition;
22
+ /**
23
+ * Checks if the endpoint is a LineEndpointDefinition.
24
+ */
25
+ function isLineEndpointDefinition(endpoint) {
26
+ return (0, validators_1.objectValidator)({
27
+ connection: (0, checks_1.isInstanceOf)(lineproxy_1.LineProxy),
28
+ position: checks_1.isNumber,
29
+ })(endpoint);
30
+ }
31
+ exports.isLineEndpointDefinition = isLineEndpointDefinition;
32
+ /**
33
+ * Checks if the endpoint is a PositionEndpointDefinition.
34
+ */
35
+ function isPositionEndpointDefinition(endpoint) {
36
+ return (0, validators_1.objectValidator)({
37
+ x: checks_1.isNumber,
38
+ y: checks_1.isNumber,
39
+ })(endpoint);
40
+ }
41
+ exports.isPositionEndpointDefinition = isPositionEndpointDefinition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.231",
3
+ "version": "0.0.233",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",