@contrail/extensions-sdk 1.0.6 → 1.0.7-alpha.0
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/actions/actions.d.ts +1 -1
- package/lib/apps/boards.d.ts +16 -1
- package/lib/apps/boards.js +23 -3
- package/lib/apps/plan.d.ts +5 -0
- package/lib/apps/plan.js +13 -5
- package/lib/extensions/app-extension-host.js +1 -1
- package/lib/extensions/app-extension-message-handler.d.ts +1 -1
- package/package.json +2 -1
package/lib/actions/actions.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface ExtensionActions {
|
|
|
9
9
|
close(): void;
|
|
10
10
|
sendMessageToEntitiesClient(message: EntitiesClientAction): Promise<any>;
|
|
11
11
|
sendMessageToTypesClient(message: TypesClientAction): Promise<any>;
|
|
12
|
-
sendMessageToHost(message: AppExtensionMessage):
|
|
12
|
+
sendMessageToHost(message: AppExtensionMessage): Promise<any>;
|
|
13
13
|
}
|
|
14
14
|
export declare let EXTENSION_ACTIONS: ExtensionActions;
|
|
15
15
|
export declare function setExtensionActions(actions: ExtensionActions): void;
|
package/lib/apps/boards.d.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
import { DocumentElement } from '@contrail/documents';
|
|
2
|
+
export declare enum BoardCommand {
|
|
3
|
+
ADD_ELEMENTS = "board:add_elements",
|
|
4
|
+
DELETE_ELEMENTS = "board:delete_elements",
|
|
5
|
+
MODIFY_ELEMENTS = "board:modify_elements"
|
|
6
|
+
}
|
|
7
|
+
export interface BoardDocumentElement extends DocumentElement {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
export interface BoardDocumentElementChanges {
|
|
11
|
+
id: string;
|
|
12
|
+
changes: BoardDocumentElement;
|
|
13
|
+
}
|
|
1
14
|
export declare class BoardsApp {
|
|
2
15
|
static getCurrentBoard(): any;
|
|
3
|
-
static addElements(elements: Array<
|
|
16
|
+
static addElements(elements: Array<BoardDocumentElement>): void;
|
|
17
|
+
static deleteElements(elements: Array<BoardDocumentElement>): void;
|
|
18
|
+
static modifyElements(changeObjects: Array<BoardDocumentElementChanges>): void;
|
|
4
19
|
private static validateBoardContext;
|
|
5
20
|
}
|
package/lib/apps/boards.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BoardsApp = void 0;
|
|
3
|
+
exports.BoardsApp = exports.BoardCommand = void 0;
|
|
4
4
|
const actions_1 = require("../actions/actions");
|
|
5
5
|
const app_context_1 = require("./app-context");
|
|
6
|
+
var BoardCommand;
|
|
7
|
+
(function (BoardCommand) {
|
|
8
|
+
BoardCommand["ADD_ELEMENTS"] = "board:add_elements";
|
|
9
|
+
BoardCommand["DELETE_ELEMENTS"] = "board:delete_elements";
|
|
10
|
+
BoardCommand["MODIFY_ELEMENTS"] = "board:modify_elements";
|
|
11
|
+
})(BoardCommand = exports.BoardCommand || (exports.BoardCommand = {}));
|
|
6
12
|
class BoardsApp {
|
|
7
13
|
static getCurrentBoard() {
|
|
8
14
|
BoardsApp.validateBoardContext();
|
|
@@ -10,8 +16,22 @@ class BoardsApp {
|
|
|
10
16
|
}
|
|
11
17
|
static addElements(elements) {
|
|
12
18
|
BoardsApp.validateBoardContext();
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
if (elements === null || elements === void 0 ? void 0 : elements.length) {
|
|
20
|
+
(0, actions_1.getExtensionActions)().sendMessageToHost({ command: BoardCommand.ADD_ELEMENTS, data: elements });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
static deleteElements(elements) {
|
|
24
|
+
BoardsApp.validateBoardContext();
|
|
25
|
+
const elementsWithIds = elements.filter((element) => !!element.id);
|
|
26
|
+
if (elementsWithIds === null || elementsWithIds === void 0 ? void 0 : elementsWithIds.length) {
|
|
27
|
+
(0, actions_1.getExtensionActions)().sendMessageToHost({ command: BoardCommand.DELETE_ELEMENTS, data: elementsWithIds });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
static modifyElements(changeObjects) {
|
|
31
|
+
BoardsApp.validateBoardContext();
|
|
32
|
+
if (changeObjects === null || changeObjects === void 0 ? void 0 : changeObjects.length) {
|
|
33
|
+
(0, actions_1.getExtensionActions)().sendMessageToHost({ command: BoardCommand.MODIFY_ELEMENTS, data: changeObjects });
|
|
34
|
+
}
|
|
15
35
|
}
|
|
16
36
|
static validateBoardContext() {
|
|
17
37
|
const context = (0, app_context_1.getAppContext)();
|
package/lib/apps/plan.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { PlanContext } from "./app-context";
|
|
2
|
+
export declare enum PlanCommand {
|
|
3
|
+
ADD_ROWS = "plan:add_rows",
|
|
4
|
+
SHOW_MESSAGE = "plan:show_message",
|
|
5
|
+
CLEAR_SELECTED_ROWS = "plan:clear_selected_rows"
|
|
6
|
+
}
|
|
2
7
|
export declare class PlanApp {
|
|
3
8
|
static getCurrentPlan(): PlanContext;
|
|
4
9
|
static getAllPlanPlaceholders(): any[];
|
package/lib/apps/plan.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlanApp = void 0;
|
|
3
|
+
exports.PlanApp = exports.PlanCommand = void 0;
|
|
4
4
|
const actions_1 = require("../actions/actions");
|
|
5
5
|
const app_context_1 = require("./app-context");
|
|
6
|
+
var PlanCommand;
|
|
7
|
+
(function (PlanCommand) {
|
|
8
|
+
PlanCommand["ADD_ROWS"] = "plan:add_rows";
|
|
9
|
+
PlanCommand["SHOW_MESSAGE"] = "plan:show_message";
|
|
10
|
+
PlanCommand["CLEAR_SELECTED_ROWS"] = "plan:clear_selected_rows";
|
|
11
|
+
})(PlanCommand = exports.PlanCommand || (exports.PlanCommand = {}));
|
|
6
12
|
class PlanApp {
|
|
7
13
|
static getCurrentPlan() {
|
|
8
14
|
PlanApp.validatePlanContext();
|
|
@@ -28,18 +34,20 @@ class PlanApp {
|
|
|
28
34
|
}
|
|
29
35
|
static addRows(collectionElements) {
|
|
30
36
|
PlanApp.validatePlanContext();
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
if (collectionElements === null || collectionElements === void 0 ? void 0 : collectionElements.length) {
|
|
38
|
+
const actions = (0, actions_1.getExtensionActions)();
|
|
39
|
+
actions.sendMessageToHost({ command: PlanCommand.ADD_ROWS, data: collectionElements });
|
|
40
|
+
}
|
|
33
41
|
}
|
|
34
42
|
static clearSelectedRows() {
|
|
35
43
|
PlanApp.validatePlanContext();
|
|
36
44
|
const actions = (0, actions_1.getExtensionActions)();
|
|
37
|
-
actions.sendMessageToHost({ command:
|
|
45
|
+
actions.sendMessageToHost({ command: PlanCommand.CLEAR_SELECTED_ROWS });
|
|
38
46
|
}
|
|
39
47
|
static showMessage(message) {
|
|
40
48
|
PlanApp.validatePlanContext();
|
|
41
49
|
const actions = (0, actions_1.getExtensionActions)();
|
|
42
|
-
actions.sendMessageToHost({ command:
|
|
50
|
+
actions.sendMessageToHost({ command: PlanCommand.SHOW_MESSAGE, data: message });
|
|
43
51
|
}
|
|
44
52
|
static validatePlanContext() {
|
|
45
53
|
const context = (0, app_context_1.getAppContext)();
|
|
@@ -44,7 +44,7 @@ class AppExtensionHost {
|
|
|
44
44
|
return types_action_handler_1.TypesActionHandler.handleActionFromExtension(message);
|
|
45
45
|
},
|
|
46
46
|
sendMessageToHost(message) {
|
|
47
|
-
customMessageHandler.handleMessage(message);
|
|
47
|
+
return customMessageHandler.handleMessage(message);
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/extensions-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7-alpha.0",
|
|
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",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@contrail/entity-types": "^1.1.35",
|
|
19
|
+
"@contrail/documents": "^1.0.86",
|
|
19
20
|
"penpal": "^6.2.2"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|