@contrail/extensions-sdk 1.0.13 → 1.0.14
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/.github/pull_request_template.md +30 -30
- package/.github/workflows/empty.yml +11 -11
- package/.github/workflows/sdk-lib.yml +27 -27
- package/README.md +2 -2
- package/home-hero.svg +11 -11
- package/lib/actions/actions.d.ts +16 -16
- package/lib/actions/actions.js +11 -11
- package/lib/apps/app-context.d.ts +55 -55
- package/lib/apps/app-context.js +19 -19
- package/lib/apps/boards.d.ts +32 -30
- package/lib/apps/boards.js +88 -75
- package/lib/apps/index.d.ts +3 -3
- package/lib/apps/index.js +22 -22
- package/lib/apps/plan.d.ts +15 -15
- package/lib/apps/plan.js +59 -59
- package/lib/entities/entities-action-handler.d.ts +22 -22
- package/lib/entities/entities-action-handler.js +57 -57
- package/lib/entities/entities-client.d.ts +22 -22
- package/lib/entities/entities-client.js +68 -68
- package/lib/entities/index.d.ts +1 -1
- package/lib/entities/index.js +17 -17
- package/lib/extensions/app-extension-host.d.ts +6 -6
- package/lib/extensions/app-extension-host.js +52 -52
- package/lib/extensions/app-extension-message-handler.d.ts +7 -7
- package/lib/extensions/app-extension-message-handler.js +2 -2
- package/lib/extensions/app-extension.d.ts +7 -7
- package/lib/extensions/app-extension.js +58 -58
- package/lib/extensions/index.d.ts +3 -3
- package/lib/extensions/index.js +19 -19
- package/lib/index.d.ts +4 -4
- package/lib/index.js +20 -20
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +17 -17
- package/lib/types/types-action-handler.d.ts +18 -18
- package/lib/types/types-action-handler.js +45 -45
- package/lib/types/types-client.d.ts +8 -8
- package/lib/types/types-client.js +43 -43
- package/package.json +51 -51
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
## What
|
|
2
|
-
- [ ] Bugfix
|
|
3
|
-
- [ ] Feature
|
|
4
|
-
- [ ] Enhancement
|
|
5
|
-
|
|
6
|
-
Description:
|
|
7
|
-
<!--
|
|
8
|
-
Describe the functional changes of the PR.
|
|
9
|
-
|
|
10
|
-
If the mechanism of your change are complex, describe them in detail as you
|
|
11
|
-
would if you were explaining them to a team mate.
|
|
12
|
-
|
|
13
|
-
If the PR is simple, there is no need to repeat yourself. A small description
|
|
14
|
-
is sufficient.
|
|
15
|
-
-->
|
|
16
|
-
|
|
17
|
-
## Why
|
|
18
|
-
<!--
|
|
19
|
-
why is this change needed? Same rules as with #What
|
|
20
|
-
-->
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Testing added
|
|
24
|
-
<!--
|
|
25
|
-
Describe the testing you added to this PR
|
|
26
|
-
-->
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## Link to Jira ticket(s)
|
|
30
|
-
|
|
1
|
+
## What
|
|
2
|
+
- [ ] Bugfix
|
|
3
|
+
- [ ] Feature
|
|
4
|
+
- [ ] Enhancement
|
|
5
|
+
|
|
6
|
+
Description:
|
|
7
|
+
<!--
|
|
8
|
+
Describe the functional changes of the PR.
|
|
9
|
+
|
|
10
|
+
If the mechanism of your change are complex, describe them in detail as you
|
|
11
|
+
would if you were explaining them to a team mate.
|
|
12
|
+
|
|
13
|
+
If the PR is simple, there is no need to repeat yourself. A small description
|
|
14
|
+
is sufficient.
|
|
15
|
+
-->
|
|
16
|
+
|
|
17
|
+
## Why
|
|
18
|
+
<!--
|
|
19
|
+
why is this change needed? Same rules as with #What
|
|
20
|
+
-->
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Testing added
|
|
24
|
+
<!--
|
|
25
|
+
Describe the testing you added to this PR
|
|
26
|
+
-->
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Link to Jira ticket(s)
|
|
30
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
name: empty-passing-test
|
|
2
|
-
on:
|
|
3
|
-
pull_request
|
|
4
|
-
jobs:
|
|
5
|
-
test:
|
|
6
|
-
runs-on: ubuntu-20.04
|
|
7
|
-
strategy:
|
|
8
|
-
matrix:
|
|
9
|
-
node-version: [16.17.0]
|
|
10
|
-
steps:
|
|
11
|
-
- run: 'echo "empty test for passing status checks"'
|
|
1
|
+
name: empty-passing-test
|
|
2
|
+
on:
|
|
3
|
+
pull_request
|
|
4
|
+
jobs:
|
|
5
|
+
test:
|
|
6
|
+
runs-on: ubuntu-20.04
|
|
7
|
+
strategy:
|
|
8
|
+
matrix:
|
|
9
|
+
node-version: [16.17.0]
|
|
10
|
+
steps:
|
|
11
|
+
- run: 'echo "empty test for passing status checks"'
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
name: sdk-lib-tests
|
|
2
|
-
on:
|
|
3
|
-
pull_request:
|
|
4
|
-
# run this workflow when files these files change
|
|
5
|
-
paths:
|
|
6
|
-
- "**"
|
|
7
|
-
workflow_dispatch: # allow running in github actions manually
|
|
8
|
-
jobs:
|
|
9
|
-
test:
|
|
10
|
-
runs-on: ubuntu-20.04
|
|
11
|
-
steps:
|
|
12
|
-
- name: Node.js
|
|
13
|
-
uses: actions/setup-node@v3
|
|
14
|
-
with:
|
|
15
|
-
node-version: ${{ matrix.node-version }}
|
|
16
|
-
|
|
17
|
-
- uses: actions/checkout@v3
|
|
18
|
-
|
|
19
|
-
- name: NPM Install
|
|
20
|
-
env:
|
|
21
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
22
|
-
run: npm ci
|
|
23
|
-
|
|
24
|
-
- name: Unit Tests -
|
|
25
|
-
env:
|
|
26
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
27
|
-
run: npm test
|
|
1
|
+
name: sdk-lib-tests
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
# run this workflow when files these files change
|
|
5
|
+
paths:
|
|
6
|
+
- "**"
|
|
7
|
+
workflow_dispatch: # allow running in github actions manually
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-20.04
|
|
11
|
+
steps:
|
|
12
|
+
- name: Node.js
|
|
13
|
+
uses: actions/setup-node@v3
|
|
14
|
+
with:
|
|
15
|
+
node-version: ${{ matrix.node-version }}
|
|
16
|
+
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
|
|
19
|
+
- name: NPM Install
|
|
20
|
+
env:
|
|
21
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
22
|
+
run: npm ci
|
|
23
|
+
|
|
24
|
+
- name: Unit Tests -
|
|
25
|
+
env:
|
|
26
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
27
|
+
run: npm test
|
package/README.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
# Contrail Extensions SDK
|
|
2
|
-
Client library for interfacing with VibeIQ's services and apps from an extension.
|
|
1
|
+
# Contrail Extensions SDK
|
|
2
|
+
Client library for interfacing with VibeIQ's services and apps from an extension.
|
package/home-hero.svg
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<svg width="635" height="433" viewBox="0 0 635 433" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g clip-path="url(#clip0_309_15692)">
|
|
3
|
-
<path d="M656.604 384.076C457.662 384.076 414.538 48.9114 216.574 48.9114C172.144 48.9339 129.54 66.5999 98.1308 98.0252C66.7213 129.451 49.077 172.063 49.077 216.494" stroke="#202532" stroke-width="97.8221" stroke-miterlimit="10"/>
|
|
4
|
-
<path d="M49.077 216.494C49.077 309.04 128.454 384.076 216.66 384.076C415.601 384.076 457.747 48.9114 656.689 48.9114C701.134 48.9114 743.76 66.5673 775.188 97.9952C806.615 129.423 824.272 172.048 824.272 216.494C824.272 260.94 806.615 303.565 775.188 334.993C743.76 366.421 701.134 384.076 656.689 384.076" stroke="#00ABE9" stroke-width="97.8221" stroke-miterlimit="10"/>
|
|
5
|
-
</g>
|
|
6
|
-
<defs>
|
|
7
|
-
<clipPath id="clip0_309_15692">
|
|
8
|
-
<rect width="873.016" height="432.987" fill="white" transform="translate(0.166809)"/>
|
|
9
|
-
</clipPath>
|
|
10
|
-
</defs>
|
|
11
|
-
</svg>
|
|
1
|
+
<svg width="635" height="433" viewBox="0 0 635 433" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_309_15692)">
|
|
3
|
+
<path d="M656.604 384.076C457.662 384.076 414.538 48.9114 216.574 48.9114C172.144 48.9339 129.54 66.5999 98.1308 98.0252C66.7213 129.451 49.077 172.063 49.077 216.494" stroke="#202532" stroke-width="97.8221" stroke-miterlimit="10"/>
|
|
4
|
+
<path d="M49.077 216.494C49.077 309.04 128.454 384.076 216.66 384.076C415.601 384.076 457.747 48.9114 656.689 48.9114C701.134 48.9114 743.76 66.5673 775.188 97.9952C806.615 129.423 824.272 172.048 824.272 216.494C824.272 260.94 806.615 303.565 775.188 334.993C743.76 366.421 701.134 384.076 656.689 384.076" stroke="#00ABE9" stroke-width="97.8221" stroke-miterlimit="10"/>
|
|
5
|
+
</g>
|
|
6
|
+
<defs>
|
|
7
|
+
<clipPath id="clip0_309_15692">
|
|
8
|
+
<rect width="873.016" height="432.987" fill="white" transform="translate(0.166809)"/>
|
|
9
|
+
</clipPath>
|
|
10
|
+
</defs>
|
|
11
|
+
</svg>
|
package/lib/actions/actions.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { AppContext } from "../apps/app-context";
|
|
2
|
-
import { EntitiesClientAction } from "../entities/entities-action-handler";
|
|
3
|
-
import { AppExtensionMessage } from "../extensions/app-extension-message-handler";
|
|
4
|
-
import { TypesClientAction } from "../types/types-action-handler";
|
|
5
|
-
export interface RegisterExtensionActions {
|
|
6
|
-
init(context: AppContext): void;
|
|
7
|
-
}
|
|
8
|
-
export interface ExtensionActions {
|
|
9
|
-
close(): void;
|
|
10
|
-
sendMessageToEntitiesClient(message: EntitiesClientAction): Promise<any>;
|
|
11
|
-
sendMessageToTypesClient(message: TypesClientAction): Promise<any>;
|
|
12
|
-
sendMessageToHost(message: AppExtensionMessage): Promise<any>;
|
|
13
|
-
}
|
|
14
|
-
export declare let EXTENSION_ACTIONS: ExtensionActions;
|
|
15
|
-
export declare function setExtensionActions(actions: ExtensionActions): void;
|
|
16
|
-
export declare function getExtensionActions(): ExtensionActions;
|
|
1
|
+
import { AppContext } from "../apps/app-context";
|
|
2
|
+
import { EntitiesClientAction } from "../entities/entities-action-handler";
|
|
3
|
+
import { AppExtensionMessage } from "../extensions/app-extension-message-handler";
|
|
4
|
+
import { TypesClientAction } from "../types/types-action-handler";
|
|
5
|
+
export interface RegisterExtensionActions {
|
|
6
|
+
init(context: AppContext): void;
|
|
7
|
+
}
|
|
8
|
+
export interface ExtensionActions {
|
|
9
|
+
close(): void;
|
|
10
|
+
sendMessageToEntitiesClient(message: EntitiesClientAction): Promise<any>;
|
|
11
|
+
sendMessageToTypesClient(message: TypesClientAction): Promise<any>;
|
|
12
|
+
sendMessageToHost(message: AppExtensionMessage): Promise<any>;
|
|
13
|
+
}
|
|
14
|
+
export declare let EXTENSION_ACTIONS: ExtensionActions;
|
|
15
|
+
export declare function setExtensionActions(actions: ExtensionActions): void;
|
|
16
|
+
export declare function getExtensionActions(): ExtensionActions;
|
package/lib/actions/actions.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExtensionActions = exports.setExtensionActions = exports.EXTENSION_ACTIONS = void 0;
|
|
4
|
-
function setExtensionActions(actions) {
|
|
5
|
-
exports.EXTENSION_ACTIONS = actions;
|
|
6
|
-
}
|
|
7
|
-
exports.setExtensionActions = setExtensionActions;
|
|
8
|
-
function getExtensionActions() {
|
|
9
|
-
return exports.EXTENSION_ACTIONS;
|
|
10
|
-
}
|
|
11
|
-
exports.getExtensionActions = getExtensionActions;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExtensionActions = exports.setExtensionActions = exports.EXTENSION_ACTIONS = void 0;
|
|
4
|
+
function setExtensionActions(actions) {
|
|
5
|
+
exports.EXTENSION_ACTIONS = actions;
|
|
6
|
+
}
|
|
7
|
+
exports.setExtensionActions = setExtensionActions;
|
|
8
|
+
function getExtensionActions() {
|
|
9
|
+
return exports.EXTENSION_ACTIONS;
|
|
10
|
+
}
|
|
11
|
+
exports.getExtensionActions = getExtensionActions;
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { User } from "@contrail/entity-types";
|
|
2
|
-
export declare enum VibeIQAppType {
|
|
3
|
-
BOARDS = "boards",
|
|
4
|
-
PLAN = "plan",
|
|
5
|
-
SHOWCASE = "showcase",
|
|
6
|
-
ADMIN_CONSOLE = "admin_console"
|
|
7
|
-
}
|
|
8
|
-
export interface AppContext {
|
|
9
|
-
appContext?: {
|
|
10
|
-
plan?: PlanContext;
|
|
11
|
-
board?: BoardContext;
|
|
12
|
-
selectedElements?: any[];
|
|
13
|
-
vibeIQApp?: VibeIQAppType;
|
|
14
|
-
};
|
|
15
|
-
user?: User;
|
|
16
|
-
}
|
|
17
|
-
export interface PlanContext {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
orgId: string;
|
|
21
|
-
targetAssortmentId: string;
|
|
22
|
-
workspaceId: string;
|
|
23
|
-
itemIds?: string[];
|
|
24
|
-
planPlaceholders?: any[];
|
|
25
|
-
filteredPlanPlaceholderIds?: string[];
|
|
26
|
-
hasFilter: boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface BoardContext {
|
|
29
|
-
id: string;
|
|
30
|
-
name: string;
|
|
31
|
-
orgId: string;
|
|
32
|
-
backingAssortmentId?: string;
|
|
33
|
-
documentId?: string;
|
|
34
|
-
document?: {
|
|
35
|
-
id: string;
|
|
36
|
-
name: string;
|
|
37
|
-
orgId: string;
|
|
38
|
-
ownedByReference: string;
|
|
39
|
-
size: {
|
|
40
|
-
width: string;
|
|
41
|
-
height: string;
|
|
42
|
-
};
|
|
43
|
-
elements: any[];
|
|
44
|
-
documentElementSortOrder: any;
|
|
45
|
-
modelBindings: any;
|
|
46
|
-
workspaceId: string;
|
|
47
|
-
};
|
|
48
|
-
previewFileId?: string;
|
|
49
|
-
rootWorkspaceId?: string;
|
|
50
|
-
typeId?: string;
|
|
51
|
-
workspaceId?: string;
|
|
52
|
-
}
|
|
53
|
-
export declare const CONTEXT: AppContext;
|
|
54
|
-
export declare function setAppContext(context: AppContext): void;
|
|
55
|
-
export declare function getAppContext(): AppContext;
|
|
1
|
+
import { User } from "@contrail/entity-types";
|
|
2
|
+
export declare enum VibeIQAppType {
|
|
3
|
+
BOARDS = "boards",
|
|
4
|
+
PLAN = "plan",
|
|
5
|
+
SHOWCASE = "showcase",
|
|
6
|
+
ADMIN_CONSOLE = "admin_console"
|
|
7
|
+
}
|
|
8
|
+
export interface AppContext {
|
|
9
|
+
appContext?: {
|
|
10
|
+
plan?: PlanContext;
|
|
11
|
+
board?: BoardContext;
|
|
12
|
+
selectedElements?: any[];
|
|
13
|
+
vibeIQApp?: VibeIQAppType;
|
|
14
|
+
};
|
|
15
|
+
user?: User;
|
|
16
|
+
}
|
|
17
|
+
export interface PlanContext {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
orgId: string;
|
|
21
|
+
targetAssortmentId: string;
|
|
22
|
+
workspaceId: string;
|
|
23
|
+
itemIds?: string[];
|
|
24
|
+
planPlaceholders?: any[];
|
|
25
|
+
filteredPlanPlaceholderIds?: string[];
|
|
26
|
+
hasFilter: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface BoardContext {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
orgId: string;
|
|
32
|
+
backingAssortmentId?: string;
|
|
33
|
+
documentId?: string;
|
|
34
|
+
document?: {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
orgId: string;
|
|
38
|
+
ownedByReference: string;
|
|
39
|
+
size: {
|
|
40
|
+
width: string;
|
|
41
|
+
height: string;
|
|
42
|
+
};
|
|
43
|
+
elements: any[];
|
|
44
|
+
documentElementSortOrder: any;
|
|
45
|
+
modelBindings: any;
|
|
46
|
+
workspaceId: string;
|
|
47
|
+
};
|
|
48
|
+
previewFileId?: string;
|
|
49
|
+
rootWorkspaceId?: string;
|
|
50
|
+
typeId?: string;
|
|
51
|
+
workspaceId?: string;
|
|
52
|
+
}
|
|
53
|
+
export declare const CONTEXT: AppContext;
|
|
54
|
+
export declare function setAppContext(context: AppContext): void;
|
|
55
|
+
export declare function getAppContext(): AppContext;
|
package/lib/apps/app-context.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAppContext = exports.setAppContext = exports.CONTEXT = exports.VibeIQAppType = void 0;
|
|
4
|
-
var VibeIQAppType;
|
|
5
|
-
(function (VibeIQAppType) {
|
|
6
|
-
VibeIQAppType["BOARDS"] = "boards";
|
|
7
|
-
VibeIQAppType["PLAN"] = "plan";
|
|
8
|
-
VibeIQAppType["SHOWCASE"] = "showcase";
|
|
9
|
-
VibeIQAppType["ADMIN_CONSOLE"] = "admin_console";
|
|
10
|
-
})(VibeIQAppType = exports.VibeIQAppType || (exports.VibeIQAppType = {}));
|
|
11
|
-
exports.CONTEXT = {};
|
|
12
|
-
function setAppContext(context) {
|
|
13
|
-
Object.assign(exports.CONTEXT, context);
|
|
14
|
-
}
|
|
15
|
-
exports.setAppContext = setAppContext;
|
|
16
|
-
function getAppContext() {
|
|
17
|
-
return exports.CONTEXT;
|
|
18
|
-
}
|
|
19
|
-
exports.getAppContext = getAppContext;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAppContext = exports.setAppContext = exports.CONTEXT = exports.VibeIQAppType = void 0;
|
|
4
|
+
var VibeIQAppType;
|
|
5
|
+
(function (VibeIQAppType) {
|
|
6
|
+
VibeIQAppType["BOARDS"] = "boards";
|
|
7
|
+
VibeIQAppType["PLAN"] = "plan";
|
|
8
|
+
VibeIQAppType["SHOWCASE"] = "showcase";
|
|
9
|
+
VibeIQAppType["ADMIN_CONSOLE"] = "admin_console";
|
|
10
|
+
})(VibeIQAppType = exports.VibeIQAppType || (exports.VibeIQAppType = {}));
|
|
11
|
+
exports.CONTEXT = {};
|
|
12
|
+
function setAppContext(context) {
|
|
13
|
+
Object.assign(exports.CONTEXT, context);
|
|
14
|
+
}
|
|
15
|
+
exports.setAppContext = setAppContext;
|
|
16
|
+
function getAppContext() {
|
|
17
|
+
return exports.CONTEXT;
|
|
18
|
+
}
|
|
19
|
+
exports.getAppContext = getAppContext;
|
package/lib/apps/boards.d.ts
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
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
|
-
GET_ELEMENTS = "board:get_elements",
|
|
7
|
-
RECOLOR_IMAGES = "board:recolor_images"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
static
|
|
24
|
-
static
|
|
25
|
-
static
|
|
26
|
-
static
|
|
27
|
-
static
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
GET_ELEMENTS = "board:get_elements",
|
|
7
|
+
RECOLOR_IMAGES = "board:recolor_images",
|
|
8
|
+
ADD_CONTENT_TO_ENTITY_FROM_ELEMENTS = "board:add_content_to_entity_from_elements"
|
|
9
|
+
}
|
|
10
|
+
export interface BoardDocumentElement extends DocumentElement {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface BoardDocumentElementChanges {
|
|
14
|
+
id: string;
|
|
15
|
+
changes: BoardDocumentElement;
|
|
16
|
+
}
|
|
17
|
+
export interface AppClientResults {
|
|
18
|
+
success: boolean;
|
|
19
|
+
data?: any;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class BoardsApp {
|
|
23
|
+
static getCurrentBoard(): any;
|
|
24
|
+
static addElements(elements: Array<BoardDocumentElement>): void;
|
|
25
|
+
static deleteElements(elements: Array<BoardDocumentElement>): void;
|
|
26
|
+
static modifyElements(changeObjects: Array<BoardDocumentElementChanges>): void;
|
|
27
|
+
static getElements(criteria: object): Promise<Array<DocumentElement>>;
|
|
28
|
+
static createNewContentAndAssignToEntity(assignmentOptions: any, entity: any, elements: Array<DocumentElement>): Promise<Array<DocumentElement>>;
|
|
29
|
+
static recolorImages(imageElements: Array<DocumentElement>, hexCode: string, hexMap?: {}): Promise<Array<DocumentElement>>;
|
|
30
|
+
private static validateBoardContext;
|
|
31
|
+
private static validateAndReturnResults;
|
|
32
|
+
}
|
package/lib/apps/boards.js
CHANGED
|
@@ -1,75 +1,88 @@
|
|
|
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
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.BoardsApp = exports.BoardCommand = void 0;
|
|
13
|
-
const actions_1 = require("../actions/actions");
|
|
14
|
-
const app_context_1 = require("./app-context");
|
|
15
|
-
var BoardCommand;
|
|
16
|
-
(function (BoardCommand) {
|
|
17
|
-
BoardCommand["ADD_ELEMENTS"] = "board:add_elements";
|
|
18
|
-
BoardCommand["DELETE_ELEMENTS"] = "board:delete_elements";
|
|
19
|
-
BoardCommand["MODIFY_ELEMENTS"] = "board:modify_elements";
|
|
20
|
-
BoardCommand["GET_ELEMENTS"] = "board:get_elements";
|
|
21
|
-
BoardCommand["RECOLOR_IMAGES"] = "board:recolor_images";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
static
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
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
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BoardsApp = exports.BoardCommand = void 0;
|
|
13
|
+
const actions_1 = require("../actions/actions");
|
|
14
|
+
const app_context_1 = require("./app-context");
|
|
15
|
+
var BoardCommand;
|
|
16
|
+
(function (BoardCommand) {
|
|
17
|
+
BoardCommand["ADD_ELEMENTS"] = "board:add_elements";
|
|
18
|
+
BoardCommand["DELETE_ELEMENTS"] = "board:delete_elements";
|
|
19
|
+
BoardCommand["MODIFY_ELEMENTS"] = "board:modify_elements";
|
|
20
|
+
BoardCommand["GET_ELEMENTS"] = "board:get_elements";
|
|
21
|
+
BoardCommand["RECOLOR_IMAGES"] = "board:recolor_images";
|
|
22
|
+
BoardCommand["ADD_CONTENT_TO_ENTITY_FROM_ELEMENTS"] = "board:add_content_to_entity_from_elements";
|
|
23
|
+
})(BoardCommand = exports.BoardCommand || (exports.BoardCommand = {}));
|
|
24
|
+
class BoardsApp {
|
|
25
|
+
static getCurrentBoard() {
|
|
26
|
+
BoardsApp.validateBoardContext();
|
|
27
|
+
return (0, app_context_1.getAppContext)().appContext.board;
|
|
28
|
+
}
|
|
29
|
+
static addElements(elements) {
|
|
30
|
+
BoardsApp.validateBoardContext();
|
|
31
|
+
if (elements === null || elements === void 0 ? void 0 : elements.length) {
|
|
32
|
+
(0, actions_1.getExtensionActions)().sendMessageToHost({ command: BoardCommand.ADD_ELEMENTS, data: elements });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
static deleteElements(elements) {
|
|
36
|
+
BoardsApp.validateBoardContext();
|
|
37
|
+
const elementsWithIds = elements.filter((element) => !!element.id);
|
|
38
|
+
if (elementsWithIds === null || elementsWithIds === void 0 ? void 0 : elementsWithIds.length) {
|
|
39
|
+
(0, actions_1.getExtensionActions)().sendMessageToHost({ command: BoardCommand.DELETE_ELEMENTS, data: elementsWithIds });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
static modifyElements(changeObjects) {
|
|
43
|
+
BoardsApp.validateBoardContext();
|
|
44
|
+
if (changeObjects === null || changeObjects === void 0 ? void 0 : changeObjects.length) {
|
|
45
|
+
(0, actions_1.getExtensionActions)().sendMessageToHost({ command: BoardCommand.MODIFY_ELEMENTS, data: changeObjects });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
static getElements(criteria) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
BoardsApp.validateBoardContext();
|
|
51
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToHost({ command: BoardCommand.GET_ELEMENTS, data: criteria });
|
|
52
|
+
return this.validateAndReturnResults(results);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
static createNewContentAndAssignToEntity(assignmentOptions, entity, elements) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
BoardsApp.validateBoardContext();
|
|
58
|
+
const data = {
|
|
59
|
+
assignmentOptions,
|
|
60
|
+
entity,
|
|
61
|
+
elements
|
|
62
|
+
};
|
|
63
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToHost({ command: BoardCommand.ADD_CONTENT_TO_ENTITY_FROM_ELEMENTS, data });
|
|
64
|
+
return this.validateAndReturnResults(results);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
static recolorImages(imageElements, hexCode, hexMap = {}) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
BoardsApp.validateBoardContext();
|
|
70
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToHost({ command: BoardCommand.RECOLOR_IMAGES, data: { imageElements, hexCode, hexMap } });
|
|
71
|
+
return this.validateAndReturnResults(results);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
static validateBoardContext() {
|
|
75
|
+
const context = (0, app_context_1.getAppContext)();
|
|
76
|
+
if (context.appContext.vibeIQApp !== app_context_1.VibeIQAppType.BOARDS || !context.appContext.board) {
|
|
77
|
+
throw new Error("App extension has not been initialized with Board context.");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
static validateAndReturnResults(results) {
|
|
81
|
+
var _a;
|
|
82
|
+
if (!results.success) {
|
|
83
|
+
throw new Error((_a = results.error) !== null && _a !== void 0 ? _a : 'App operation failed.');
|
|
84
|
+
}
|
|
85
|
+
return results.data;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.BoardsApp = BoardsApp;
|
package/lib/apps/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getAppContext, AppContext, BoardContext, PlanContext, VibeIQAppType } from './app-context';
|
|
2
|
-
export * from './boards';
|
|
3
|
-
export * from './plan';
|
|
1
|
+
export { getAppContext, AppContext, BoardContext, PlanContext, VibeIQAppType } from './app-context';
|
|
2
|
+
export * from './boards';
|
|
3
|
+
export * from './plan';
|