@contrail/extensions-sdk
Advanced tools
Comparing version 1.0.5 to 1.0.6
import { AppContext } from "../apps/app-context"; | ||
import { EntitiesClientAction } from "../entities/entities-action-handler"; | ||
import { AppExtensionMessage } from "../extensions/app-extension-message-handler"; | ||
import { TypesClientAction } from "../types/types-action-handler"; | ||
export interface RegisterExtensionActions { | ||
@@ -10,2 +11,3 @@ init(context: AppContext): void; | ||
sendMessageToEntitiesClient(message: EntitiesClientAction): Promise<any>; | ||
sendMessageToTypesClient(message: TypesClientAction): Promise<any>; | ||
sendMessageToHost(message: AppExtensionMessage): void; | ||
@@ -12,0 +14,0 @@ } |
export interface EntitiesClientAction { | ||
method: string; | ||
method: EntitiesClientMethods; | ||
options: any; | ||
} | ||
export declare enum EntitiesClientMethods { | ||
GET = "get", | ||
CREATE = "create", | ||
BATCH_CREATE = "batchCreate", | ||
UPDATE = "update", | ||
BATCH_UPDATE = "batchUpdate", | ||
DELETE = "delete", | ||
BATCH_DELETE = "batchDelete" | ||
} | ||
export interface EntitiesClientResults { | ||
@@ -6,0 +15,0 @@ success: boolean; |
@@ -12,4 +12,14 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EntitiesActionHandler = void 0; | ||
exports.EntitiesActionHandler = exports.EntitiesClientMethods = void 0; | ||
const sdk_1 = require("@contrail/sdk"); | ||
var EntitiesClientMethods; | ||
(function (EntitiesClientMethods) { | ||
EntitiesClientMethods["GET"] = "get"; | ||
EntitiesClientMethods["CREATE"] = "create"; | ||
EntitiesClientMethods["BATCH_CREATE"] = "batchCreate"; | ||
EntitiesClientMethods["UPDATE"] = "update"; | ||
EntitiesClientMethods["BATCH_UPDATE"] = "batchUpdate"; | ||
EntitiesClientMethods["DELETE"] = "delete"; | ||
EntitiesClientMethods["BATCH_DELETE"] = "batchDelete"; | ||
})(EntitiesClientMethods = exports.EntitiesClientMethods || (exports.EntitiesClientMethods = {})); | ||
class EntitiesActionHandler { | ||
@@ -30,15 +40,15 @@ static handleActionFromExtension(action) { | ||
switch (action.method) { | ||
case 'get': | ||
case EntitiesClientMethods.GET: | ||
return yield new sdk_1.Entities().get(action.options); | ||
case 'create': | ||
case EntitiesClientMethods.CREATE: | ||
return yield new sdk_1.Entities().create(action.options); | ||
case 'batchCreate': | ||
case EntitiesClientMethods.BATCH_CREATE: | ||
return yield new sdk_1.Entities().batchCreate(action.options); | ||
case 'update': | ||
case EntitiesClientMethods.UPDATE: | ||
return yield new sdk_1.Entities().update(action.options); | ||
case 'batchUpdate': | ||
case EntitiesClientMethods.BATCH_UPDATE: | ||
return yield new sdk_1.Entities().batchUpdate(action.options); | ||
case 'delete': | ||
case EntitiesClientMethods.DELETE: | ||
return yield new sdk_1.Entities().delete(action.options); | ||
case 'batchDelete': | ||
case EntitiesClientMethods.BATCH_DELETE: | ||
return yield new sdk_1.Entities().batchDelete(action.options); | ||
@@ -45,0 +55,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export * from './entities-web-client'; | ||
export * from './entities-client'; |
@@ -17,2 +17,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./entities-web-client"), exports); | ||
__exportStar(require("./entities-client"), exports); |
@@ -15,2 +15,3 @@ "use strict"; | ||
const entities_action_handler_1 = require("../entities/entities-action-handler"); | ||
const types_action_handler_1 = require("../types/types-action-handler"); | ||
class AppExtensionHost { | ||
@@ -43,2 +44,5 @@ static registerHostWithAppExtension(iframe, context, customMessageHandler) { | ||
}, | ||
sendMessageToTypesClient(message) { | ||
return types_action_handler_1.TypesActionHandler.handleActionFromExtension(message); | ||
}, | ||
sendMessageToHost(message) { | ||
@@ -45,0 +49,0 @@ customMessageHandler.handleMessage(message); |
export * from './apps'; | ||
export * from './entities'; | ||
export * from './extensions'; | ||
export * from './types'; |
@@ -20,1 +20,2 @@ "use strict"; | ||
__exportStar(require("./extensions"), exports); | ||
__exportStar(require("./types"), exports); |
{ | ||
"name": "@contrail/extensions-sdk", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Client library for interfacing with VibeIQ's services and apps from an extension.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41117
42
817