@contrail/extensions-sdk 1.0.12 → 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
package/lib/apps/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.VibeIQAppType = exports.getAppContext = void 0;
|
|
18
|
-
var app_context_1 = require("./app-context");
|
|
19
|
-
Object.defineProperty(exports, "getAppContext", { enumerable: true, get: function () { return app_context_1.getAppContext; } });
|
|
20
|
-
Object.defineProperty(exports, "VibeIQAppType", { enumerable: true, get: function () { return app_context_1.VibeIQAppType; } });
|
|
21
|
-
__exportStar(require("./boards"), exports);
|
|
22
|
-
__exportStar(require("./plan"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.VibeIQAppType = exports.getAppContext = void 0;
|
|
18
|
+
var app_context_1 = require("./app-context");
|
|
19
|
+
Object.defineProperty(exports, "getAppContext", { enumerable: true, get: function () { return app_context_1.getAppContext; } });
|
|
20
|
+
Object.defineProperty(exports, "VibeIQAppType", { enumerable: true, get: function () { return app_context_1.VibeIQAppType; } });
|
|
21
|
+
__exportStar(require("./boards"), exports);
|
|
22
|
+
__exportStar(require("./plan"), exports);
|
package/lib/apps/plan.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
}
|
|
7
|
-
export declare class PlanApp {
|
|
8
|
-
static getCurrentPlan(): PlanContext;
|
|
9
|
-
static getAllPlanPlaceholders(): any[];
|
|
10
|
-
static getFilteredPlanPlaceholders(): any[];
|
|
11
|
-
static addRows(collectionElements: Array<any>): void;
|
|
12
|
-
static clearSelectedRows(): void;
|
|
13
|
-
static showMessage(message: string): void;
|
|
14
|
-
private static validatePlanContext;
|
|
15
|
-
}
|
|
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
|
+
}
|
|
7
|
+
export declare class PlanApp {
|
|
8
|
+
static getCurrentPlan(): PlanContext;
|
|
9
|
+
static getAllPlanPlaceholders(): any[];
|
|
10
|
+
static getFilteredPlanPlaceholders(): any[];
|
|
11
|
+
static addRows(collectionElements: Array<any>): void;
|
|
12
|
+
static clearSelectedRows(): void;
|
|
13
|
+
static showMessage(message: string): void;
|
|
14
|
+
private static validatePlanContext;
|
|
15
|
+
}
|
package/lib/apps/plan.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlanApp = exports.PlanCommand = void 0;
|
|
4
|
-
const actions_1 = require("../actions/actions");
|
|
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 = {}));
|
|
12
|
-
class PlanApp {
|
|
13
|
-
static getCurrentPlan() {
|
|
14
|
-
PlanApp.validatePlanContext();
|
|
15
|
-
return (0, app_context_1.getAppContext)().appContext.plan;
|
|
16
|
-
}
|
|
17
|
-
static getAllPlanPlaceholders() {
|
|
18
|
-
var _a;
|
|
19
|
-
PlanApp.validatePlanContext();
|
|
20
|
-
const plan = PlanApp.getCurrentPlan();
|
|
21
|
-
return (_a = plan === null || plan === void 0 ? void 0 : plan.planPlaceholders) !== null && _a !== void 0 ? _a : [];
|
|
22
|
-
}
|
|
23
|
-
static getFilteredPlanPlaceholders() {
|
|
24
|
-
var _a;
|
|
25
|
-
PlanApp.validatePlanContext();
|
|
26
|
-
const plan = PlanApp.getCurrentPlan();
|
|
27
|
-
const allPlanPlaceholders = PlanApp.getAllPlanPlaceholders();
|
|
28
|
-
if (!(plan === null || plan === void 0 ? void 0 : plan.hasFilter)) {
|
|
29
|
-
return allPlanPlaceholders;
|
|
30
|
-
}
|
|
31
|
-
const filteredPlanPlaceholderIds = (_a = plan.filteredPlanPlaceholderIds) !== null && _a !== void 0 ? _a : [];
|
|
32
|
-
const filteredResults = allPlanPlaceholders.filter((placeholder) => filteredPlanPlaceholderIds.includes(placeholder.id));
|
|
33
|
-
return filteredResults;
|
|
34
|
-
}
|
|
35
|
-
static addRows(collectionElements) {
|
|
36
|
-
PlanApp.validatePlanContext();
|
|
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
|
-
}
|
|
41
|
-
}
|
|
42
|
-
static clearSelectedRows() {
|
|
43
|
-
PlanApp.validatePlanContext();
|
|
44
|
-
const actions = (0, actions_1.getExtensionActions)();
|
|
45
|
-
actions.sendMessageToHost({ command: PlanCommand.CLEAR_SELECTED_ROWS });
|
|
46
|
-
}
|
|
47
|
-
static showMessage(message) {
|
|
48
|
-
PlanApp.validatePlanContext();
|
|
49
|
-
const actions = (0, actions_1.getExtensionActions)();
|
|
50
|
-
actions.sendMessageToHost({ command: PlanCommand.SHOW_MESSAGE, data: message });
|
|
51
|
-
}
|
|
52
|
-
static validatePlanContext() {
|
|
53
|
-
const context = (0, app_context_1.getAppContext)();
|
|
54
|
-
if (context.appContext.vibeIQApp !== app_context_1.VibeIQAppType.PLAN || !context.appContext.plan) {
|
|
55
|
-
throw new Error("App extension has not been initialized with Plan context.");
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.PlanApp = PlanApp;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlanApp = exports.PlanCommand = void 0;
|
|
4
|
+
const actions_1 = require("../actions/actions");
|
|
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 = {}));
|
|
12
|
+
class PlanApp {
|
|
13
|
+
static getCurrentPlan() {
|
|
14
|
+
PlanApp.validatePlanContext();
|
|
15
|
+
return (0, app_context_1.getAppContext)().appContext.plan;
|
|
16
|
+
}
|
|
17
|
+
static getAllPlanPlaceholders() {
|
|
18
|
+
var _a;
|
|
19
|
+
PlanApp.validatePlanContext();
|
|
20
|
+
const plan = PlanApp.getCurrentPlan();
|
|
21
|
+
return (_a = plan === null || plan === void 0 ? void 0 : plan.planPlaceholders) !== null && _a !== void 0 ? _a : [];
|
|
22
|
+
}
|
|
23
|
+
static getFilteredPlanPlaceholders() {
|
|
24
|
+
var _a;
|
|
25
|
+
PlanApp.validatePlanContext();
|
|
26
|
+
const plan = PlanApp.getCurrentPlan();
|
|
27
|
+
const allPlanPlaceholders = PlanApp.getAllPlanPlaceholders();
|
|
28
|
+
if (!(plan === null || plan === void 0 ? void 0 : plan.hasFilter)) {
|
|
29
|
+
return allPlanPlaceholders;
|
|
30
|
+
}
|
|
31
|
+
const filteredPlanPlaceholderIds = (_a = plan.filteredPlanPlaceholderIds) !== null && _a !== void 0 ? _a : [];
|
|
32
|
+
const filteredResults = allPlanPlaceholders.filter((placeholder) => filteredPlanPlaceholderIds.includes(placeholder.id));
|
|
33
|
+
return filteredResults;
|
|
34
|
+
}
|
|
35
|
+
static addRows(collectionElements) {
|
|
36
|
+
PlanApp.validatePlanContext();
|
|
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
|
+
}
|
|
41
|
+
}
|
|
42
|
+
static clearSelectedRows() {
|
|
43
|
+
PlanApp.validatePlanContext();
|
|
44
|
+
const actions = (0, actions_1.getExtensionActions)();
|
|
45
|
+
actions.sendMessageToHost({ command: PlanCommand.CLEAR_SELECTED_ROWS });
|
|
46
|
+
}
|
|
47
|
+
static showMessage(message) {
|
|
48
|
+
PlanApp.validatePlanContext();
|
|
49
|
+
const actions = (0, actions_1.getExtensionActions)();
|
|
50
|
+
actions.sendMessageToHost({ command: PlanCommand.SHOW_MESSAGE, data: message });
|
|
51
|
+
}
|
|
52
|
+
static validatePlanContext() {
|
|
53
|
+
const context = (0, app_context_1.getAppContext)();
|
|
54
|
+
if (context.appContext.vibeIQApp !== app_context_1.VibeIQAppType.PLAN || !context.appContext.plan) {
|
|
55
|
+
throw new Error("App extension has not been initialized with Plan context.");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.PlanApp = PlanApp;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export interface EntitiesClientAction {
|
|
2
|
-
method: EntitiesClientMethods;
|
|
3
|
-
options: any;
|
|
4
|
-
}
|
|
5
|
-
export declare enum EntitiesClientMethods {
|
|
6
|
-
GET = "get",
|
|
7
|
-
CREATE = "create",
|
|
8
|
-
BATCH_CREATE = "batchCreate",
|
|
9
|
-
UPDATE = "update",
|
|
10
|
-
BATCH_UPDATE = "batchUpdate",
|
|
11
|
-
DELETE = "delete",
|
|
12
|
-
BATCH_DELETE = "batchDelete"
|
|
13
|
-
}
|
|
14
|
-
export interface EntitiesClientResults {
|
|
15
|
-
success: boolean;
|
|
16
|
-
data?: any;
|
|
17
|
-
error?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare class EntitiesActionHandler {
|
|
20
|
-
static handleActionFromExtension(action: EntitiesClientAction): Promise<EntitiesClientResults>;
|
|
21
|
-
private static executeAction;
|
|
22
|
-
}
|
|
1
|
+
export interface EntitiesClientAction {
|
|
2
|
+
method: EntitiesClientMethods;
|
|
3
|
+
options: any;
|
|
4
|
+
}
|
|
5
|
+
export declare enum EntitiesClientMethods {
|
|
6
|
+
GET = "get",
|
|
7
|
+
CREATE = "create",
|
|
8
|
+
BATCH_CREATE = "batchCreate",
|
|
9
|
+
UPDATE = "update",
|
|
10
|
+
BATCH_UPDATE = "batchUpdate",
|
|
11
|
+
DELETE = "delete",
|
|
12
|
+
BATCH_DELETE = "batchDelete"
|
|
13
|
+
}
|
|
14
|
+
export interface EntitiesClientResults {
|
|
15
|
+
success: boolean;
|
|
16
|
+
data?: any;
|
|
17
|
+
error?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class EntitiesActionHandler {
|
|
20
|
+
static handleActionFromExtension(action: EntitiesClientAction): Promise<EntitiesClientResults>;
|
|
21
|
+
private static executeAction;
|
|
22
|
+
}
|
|
@@ -1,57 +1,57 @@
|
|
|
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.EntitiesActionHandler = exports.EntitiesClientMethods = void 0;
|
|
13
|
-
const sdk_1 = require("@contrail/sdk");
|
|
14
|
-
var EntitiesClientMethods;
|
|
15
|
-
(function (EntitiesClientMethods) {
|
|
16
|
-
EntitiesClientMethods["GET"] = "get";
|
|
17
|
-
EntitiesClientMethods["CREATE"] = "create";
|
|
18
|
-
EntitiesClientMethods["BATCH_CREATE"] = "batchCreate";
|
|
19
|
-
EntitiesClientMethods["UPDATE"] = "update";
|
|
20
|
-
EntitiesClientMethods["BATCH_UPDATE"] = "batchUpdate";
|
|
21
|
-
EntitiesClientMethods["DELETE"] = "delete";
|
|
22
|
-
EntitiesClientMethods["BATCH_DELETE"] = "batchDelete";
|
|
23
|
-
})(EntitiesClientMethods = exports.EntitiesClientMethods || (exports.EntitiesClientMethods = {}));
|
|
24
|
-
class EntitiesActionHandler {
|
|
25
|
-
static handleActionFromExtension(action) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
try {
|
|
28
|
-
const data = yield EntitiesActionHandler.executeAction(action);
|
|
29
|
-
return { success: true, data };
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
return { success: false, error: e.message };
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
static executeAction(action) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
switch (action.method) {
|
|
39
|
-
case EntitiesClientMethods.GET:
|
|
40
|
-
return yield new sdk_1.Entities().get(action.options);
|
|
41
|
-
case EntitiesClientMethods.CREATE:
|
|
42
|
-
return yield new sdk_1.Entities().create(action.options);
|
|
43
|
-
case EntitiesClientMethods.BATCH_CREATE:
|
|
44
|
-
return yield new sdk_1.Entities().batchCreate(action.options);
|
|
45
|
-
case EntitiesClientMethods.UPDATE:
|
|
46
|
-
return yield new sdk_1.Entities().update(action.options);
|
|
47
|
-
case EntitiesClientMethods.BATCH_UPDATE:
|
|
48
|
-
return yield new sdk_1.Entities().batchUpdate(action.options);
|
|
49
|
-
case EntitiesClientMethods.DELETE:
|
|
50
|
-
return yield new sdk_1.Entities().delete(action.options);
|
|
51
|
-
case EntitiesClientMethods.BATCH_DELETE:
|
|
52
|
-
return yield new sdk_1.Entities().batchDelete(action.options);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.EntitiesActionHandler = EntitiesActionHandler;
|
|
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.EntitiesActionHandler = exports.EntitiesClientMethods = void 0;
|
|
13
|
+
const sdk_1 = require("@contrail/sdk");
|
|
14
|
+
var EntitiesClientMethods;
|
|
15
|
+
(function (EntitiesClientMethods) {
|
|
16
|
+
EntitiesClientMethods["GET"] = "get";
|
|
17
|
+
EntitiesClientMethods["CREATE"] = "create";
|
|
18
|
+
EntitiesClientMethods["BATCH_CREATE"] = "batchCreate";
|
|
19
|
+
EntitiesClientMethods["UPDATE"] = "update";
|
|
20
|
+
EntitiesClientMethods["BATCH_UPDATE"] = "batchUpdate";
|
|
21
|
+
EntitiesClientMethods["DELETE"] = "delete";
|
|
22
|
+
EntitiesClientMethods["BATCH_DELETE"] = "batchDelete";
|
|
23
|
+
})(EntitiesClientMethods = exports.EntitiesClientMethods || (exports.EntitiesClientMethods = {}));
|
|
24
|
+
class EntitiesActionHandler {
|
|
25
|
+
static handleActionFromExtension(action) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
try {
|
|
28
|
+
const data = yield EntitiesActionHandler.executeAction(action);
|
|
29
|
+
return { success: true, data };
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
return { success: false, error: e.message };
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static executeAction(action) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
switch (action.method) {
|
|
39
|
+
case EntitiesClientMethods.GET:
|
|
40
|
+
return yield new sdk_1.Entities().get(action.options);
|
|
41
|
+
case EntitiesClientMethods.CREATE:
|
|
42
|
+
return yield new sdk_1.Entities().create(action.options);
|
|
43
|
+
case EntitiesClientMethods.BATCH_CREATE:
|
|
44
|
+
return yield new sdk_1.Entities().batchCreate(action.options);
|
|
45
|
+
case EntitiesClientMethods.UPDATE:
|
|
46
|
+
return yield new sdk_1.Entities().update(action.options);
|
|
47
|
+
case EntitiesClientMethods.BATCH_UPDATE:
|
|
48
|
+
return yield new sdk_1.Entities().batchUpdate(action.options);
|
|
49
|
+
case EntitiesClientMethods.DELETE:
|
|
50
|
+
return yield new sdk_1.Entities().delete(action.options);
|
|
51
|
+
case EntitiesClientMethods.BATCH_DELETE:
|
|
52
|
+
return yield new sdk_1.Entities().batchDelete(action.options);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.EntitiesActionHandler = EntitiesActionHandler;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { EntitiesClientBatchCreateOptions, EntitiesClientBatchDeleteOptions, EntitiesClientBatchUpdateOptions, EntitiesClientCreateOptions, EntitiesClientDeleteOptions, EntitiesClientGetOptions, API_VERSION } from "@contrail/sdk";
|
|
2
|
-
declare class EntitiesClientUpdateOptions {
|
|
3
|
-
entityName?: string;
|
|
4
|
-
object: any;
|
|
5
|
-
id?: string;
|
|
6
|
-
reference?: string;
|
|
7
|
-
relation?: string;
|
|
8
|
-
relationId?: string;
|
|
9
|
-
apiVersion?: API_VERSION;
|
|
10
|
-
suffix?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare class EntitiesClient {
|
|
13
|
-
get(options: EntitiesClientGetOptions): Promise<any | any[]>;
|
|
14
|
-
create(options: EntitiesClientCreateOptions): Promise<any>;
|
|
15
|
-
batchCreate(options: EntitiesClientBatchCreateOptions): Promise<any[]>;
|
|
16
|
-
update(options: EntitiesClientUpdateOptions): Promise<any>;
|
|
17
|
-
batchUpdate(options: EntitiesClientBatchUpdateOptions): Promise<any[]>;
|
|
18
|
-
delete(options: EntitiesClientDeleteOptions): Promise<any>;
|
|
19
|
-
batchDelete(options: EntitiesClientBatchDeleteOptions): Promise<any[]>;
|
|
20
|
-
private validateAndReturnEntityClientResults;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
1
|
+
import { EntitiesClientBatchCreateOptions, EntitiesClientBatchDeleteOptions, EntitiesClientBatchUpdateOptions, EntitiesClientCreateOptions, EntitiesClientDeleteOptions, EntitiesClientGetOptions, API_VERSION } from "@contrail/sdk";
|
|
2
|
+
declare class EntitiesClientUpdateOptions {
|
|
3
|
+
entityName?: string;
|
|
4
|
+
object: any;
|
|
5
|
+
id?: string;
|
|
6
|
+
reference?: string;
|
|
7
|
+
relation?: string;
|
|
8
|
+
relationId?: string;
|
|
9
|
+
apiVersion?: API_VERSION;
|
|
10
|
+
suffix?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class EntitiesClient {
|
|
13
|
+
get(options: EntitiesClientGetOptions): Promise<any | any[]>;
|
|
14
|
+
create(options: EntitiesClientCreateOptions): Promise<any>;
|
|
15
|
+
batchCreate(options: EntitiesClientBatchCreateOptions): Promise<any[]>;
|
|
16
|
+
update(options: EntitiesClientUpdateOptions): Promise<any>;
|
|
17
|
+
batchUpdate(options: EntitiesClientBatchUpdateOptions): Promise<any[]>;
|
|
18
|
+
delete(options: EntitiesClientDeleteOptions): Promise<any>;
|
|
19
|
+
batchDelete(options: EntitiesClientBatchDeleteOptions): Promise<any[]>;
|
|
20
|
+
private validateAndReturnEntityClientResults;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -1,68 +1,68 @@
|
|
|
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.EntitiesClient = void 0;
|
|
13
|
-
const actions_1 = require("../actions/actions");
|
|
14
|
-
const entities_action_handler_1 = require("./entities-action-handler");
|
|
15
|
-
class EntitiesClientUpdateOptions {
|
|
16
|
-
}
|
|
17
|
-
class EntitiesClient {
|
|
18
|
-
get(options) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.GET, options });
|
|
21
|
-
return this.validateAndReturnEntityClientResults(results);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
create(options) {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.CREATE, options });
|
|
27
|
-
return this.validateAndReturnEntityClientResults(results);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
batchCreate(options) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.BATCH_CREATE, options });
|
|
33
|
-
return this.validateAndReturnEntityClientResults(results);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
update(options) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.UPDATE, options });
|
|
39
|
-
return this.validateAndReturnEntityClientResults(results);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
batchUpdate(options) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.BATCH_UPDATE, options });
|
|
45
|
-
return this.validateAndReturnEntityClientResults(results);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
delete(options) {
|
|
49
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.DELETE, options });
|
|
51
|
-
return this.validateAndReturnEntityClientResults(results);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
batchDelete(options) {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.BATCH_DELETE, options });
|
|
57
|
-
return this.validateAndReturnEntityClientResults(results);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
validateAndReturnEntityClientResults(results) {
|
|
61
|
-
var _a;
|
|
62
|
-
if (!results.success) {
|
|
63
|
-
throw new Error((_a = results.error) !== null && _a !== void 0 ? _a : 'Entity operation failed.');
|
|
64
|
-
}
|
|
65
|
-
return results.data;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.EntitiesClient = EntitiesClient;
|
|
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.EntitiesClient = void 0;
|
|
13
|
+
const actions_1 = require("../actions/actions");
|
|
14
|
+
const entities_action_handler_1 = require("./entities-action-handler");
|
|
15
|
+
class EntitiesClientUpdateOptions {
|
|
16
|
+
}
|
|
17
|
+
class EntitiesClient {
|
|
18
|
+
get(options) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.GET, options });
|
|
21
|
+
return this.validateAndReturnEntityClientResults(results);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
create(options) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.CREATE, options });
|
|
27
|
+
return this.validateAndReturnEntityClientResults(results);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
batchCreate(options) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.BATCH_CREATE, options });
|
|
33
|
+
return this.validateAndReturnEntityClientResults(results);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
update(options) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.UPDATE, options });
|
|
39
|
+
return this.validateAndReturnEntityClientResults(results);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
batchUpdate(options) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.BATCH_UPDATE, options });
|
|
45
|
+
return this.validateAndReturnEntityClientResults(results);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
delete(options) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.DELETE, options });
|
|
51
|
+
return this.validateAndReturnEntityClientResults(results);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
batchDelete(options) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const results = yield (0, actions_1.getExtensionActions)().sendMessageToEntitiesClient({ method: entities_action_handler_1.EntitiesClientMethods.BATCH_DELETE, options });
|
|
57
|
+
return this.validateAndReturnEntityClientResults(results);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
validateAndReturnEntityClientResults(results) {
|
|
61
|
+
var _a;
|
|
62
|
+
if (!results.success) {
|
|
63
|
+
throw new Error((_a = results.error) !== null && _a !== void 0 ? _a : 'Entity operation failed.');
|
|
64
|
+
}
|
|
65
|
+
return results.data;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.EntitiesClient = EntitiesClient;
|
package/lib/entities/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './entities-client';
|
|
1
|
+
export * from './entities-client';
|
package/lib/entities/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./entities-client"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./entities-client"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AppContext } from '../apps/app-context';
|
|
2
|
-
import { AppExtensionMessageHandler } from './app-extension-message-handler';
|
|
3
|
-
export declare class AppExtensionHost {
|
|
4
|
-
static registerHostWithAppExtension(iframe: HTMLIFrameElement, context: AppContext, customMessageHandler: AppExtensionMessageHandler): Promise<void>;
|
|
5
|
-
private static getExtensionActionsToRunOnHost;
|
|
6
|
-
}
|
|
1
|
+
import { AppContext } from '../apps/app-context';
|
|
2
|
+
import { AppExtensionMessageHandler } from './app-extension-message-handler';
|
|
3
|
+
export declare class AppExtensionHost {
|
|
4
|
+
static registerHostWithAppExtension(iframe: HTMLIFrameElement, context: AppContext, customMessageHandler: AppExtensionMessageHandler): Promise<void>;
|
|
5
|
+
private static getExtensionActionsToRunOnHost;
|
|
6
|
+
}
|