@contrail/extensions-sdk 1.0.9 → 1.0.11
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/lib/apps/boards.d.ts +6 -0
- package/lib/apps/boards.js +21 -2
- package/package.json +2 -2
package/lib/apps/boards.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export interface BoardDocumentElementChanges {
|
|
|
12
12
|
id: string;
|
|
13
13
|
changes: BoardDocumentElement;
|
|
14
14
|
}
|
|
15
|
+
export interface AppClientResults {
|
|
16
|
+
success: boolean;
|
|
17
|
+
data?: any;
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
15
20
|
export declare class BoardsApp {
|
|
16
21
|
static getCurrentBoard(): any;
|
|
17
22
|
static addElements(elements: Array<BoardDocumentElement>): void;
|
|
@@ -19,4 +24,5 @@ export declare class BoardsApp {
|
|
|
19
24
|
static modifyElements(changeObjects: Array<BoardDocumentElementChanges>): void;
|
|
20
25
|
static getElements(criteria: object): Promise<Array<DocumentElement>>;
|
|
21
26
|
private static validateBoardContext;
|
|
27
|
+
private static validateAndReturnResults;
|
|
22
28
|
}
|
package/lib/apps/boards.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.BoardsApp = exports.BoardCommand = void 0;
|
|
4
13
|
const actions_1 = require("../actions/actions");
|
|
@@ -35,8 +44,11 @@ class BoardsApp {
|
|
|
35
44
|
}
|
|
36
45
|
}
|
|
37
46
|
static getElements(criteria) {
|
|
38
|
-
|
|
39
|
-
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
BoardsApp.validateBoardContext();
|
|
49
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToHost({ command: BoardCommand.GET_ELEMENTS, data: criteria });
|
|
50
|
+
return this.validateAndReturnResults(results);
|
|
51
|
+
});
|
|
40
52
|
}
|
|
41
53
|
static validateBoardContext() {
|
|
42
54
|
const context = (0, app_context_1.getAppContext)();
|
|
@@ -44,5 +56,12 @@ class BoardsApp {
|
|
|
44
56
|
throw new Error("App extension has not been initialized with Board context.");
|
|
45
57
|
}
|
|
46
58
|
}
|
|
59
|
+
static validateAndReturnResults(results) {
|
|
60
|
+
var _a;
|
|
61
|
+
if (!results.success) {
|
|
62
|
+
throw new Error((_a = results.error) !== null && _a !== void 0 ? _a : 'App operation failed.');
|
|
63
|
+
}
|
|
64
|
+
return results.data;
|
|
65
|
+
}
|
|
47
66
|
}
|
|
48
67
|
exports.BoardsApp = BoardsApp;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/extensions-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Client library for interfacing with VibeIQ's services and apps from an extension.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@contrail/entity-types": "^1.1.35",
|
|
19
18
|
"@contrail/documents": "^1.0.86",
|
|
19
|
+
"@contrail/entity-types": "^1.1.35",
|
|
20
20
|
"penpal": "^6.2.2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|