New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@polywrap/plugin-js

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polywrap/plugin-js - npm Package Compare versions

Comparing version

to
0.10.0-pre.8

6

build/PluginPackage.d.ts

@@ -7,5 +7,5 @@ import { PluginModule } from "./PluginModule";

export declare class PluginPackage<TConfig, TEnv extends Record<string, unknown> = Record<string, unknown>> implements IWrapPackage {
private pluginModule;
private manifest;
constructor(pluginModule: PluginModule<TConfig, TEnv>, manifest: WrapManifest);
private _pluginModule;
private _manifest;
constructor(_pluginModule: PluginModule<TConfig, TEnv>, _manifest: WrapManifest);
static from<TConfig, TEnv extends Record<string, unknown> = Record<string, unknown>>(pluginModule: PluginModule<TConfig>, manifest?: WrapManifest): PluginPackage<TConfig, TEnv>;

@@ -12,0 +12,0 @@ static from<TEnv extends Record<string, unknown> = Record<string, unknown>>(getPluginFuncs: GetPluginMethodsFunc<TEnv>, manifest?: WrapManifest): PluginPackage<never, TEnv>;

@@ -44,5 +44,5 @@ "use strict";

var PluginPackage = /** @class */ (function () {
function PluginPackage(pluginModule, manifest) {
this.pluginModule = pluginModule;
this.manifest = manifest;
function PluginPackage(_pluginModule, _manifest) {
this._pluginModule = _pluginModule;
this._manifest = _manifest;
}

@@ -61,3 +61,3 @@ PluginPackage.from = function (pluginModuleOrGetPluginFuncs, manifest) {

return __generator(this, function (_a) {
return [2 /*return*/, result_1.ResultOk(this.manifest)];
return [2 /*return*/, result_1.ResultOk(this._manifest)];
});

@@ -69,3 +69,3 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, result_1.ResultOk(new PluginWrapper_1.PluginWrapper(this.manifest, this.pluginModule))];
return [2 /*return*/, result_1.ResultOk(new PluginWrapper_1.PluginWrapper(this._manifest, this._pluginModule))];
});

@@ -72,0 +72,0 @@ });

import { PluginModule } from "./PluginModule";
import { Wrapper, CoreClient, InvokeOptions, InvocableResult, Uri, GetFileOptions } from "@polywrap/core-js";
import { Wrapper, CoreClient, InvokeOptions, InvocableResult, GetFileOptions } from "@polywrap/core-js";
import { WrapManifest } from "@polywrap/wrap-manifest-types-js";
import { Result } from "@polywrap/result";
export declare class PluginWrapper implements Wrapper {
private manifest;
private module;
constructor(manifest: WrapManifest, module: PluginModule<unknown>);
private _manifest;
private _module;
constructor(_manifest: WrapManifest, _module: PluginModule<unknown>);
getFile(_: GetFileOptions): Promise<Result<Uint8Array | string, Error>>;
getManifest(): WrapManifest;
invoke(options: InvokeOptions<Uri>, client: CoreClient): Promise<InvocableResult<unknown>>;
invoke(options: InvokeOptions, client: CoreClient): Promise<InvocableResult<unknown>>;
}

@@ -13,8 +13,2 @@ "use strict";

};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -61,13 +55,7 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

var msgpack_js_1 = require("@polywrap/msgpack-js");
var tracing_js_1 = require("@polywrap/tracing-js");
var result_1 = require("@polywrap/result");
var PluginWrapper = /** @class */ (function () {
function PluginWrapper(manifest, module) {
this.manifest = manifest;
this.module = module;
tracing_js_1.Tracer.startSpan("PluginWrapper: constructor");
tracing_js_1.Tracer.setAttribute("args", {
plugin: this.module,
});
tracing_js_1.Tracer.endSpan();
function PluginWrapper(_manifest, _module) {
this._manifest = _manifest;
this._module = _module;
}

@@ -82,3 +70,3 @@ PluginWrapper.prototype.getFile = function (_) {

PluginWrapper.prototype.getManifest = function () {
return this.manifest;
return this._manifest;
};

@@ -92,6 +80,5 @@ PluginWrapper.prototype.invoke = function (options, client) {

case 0:
tracing_js_1.Tracer.setAttribute("label", "Plugin Wrapper invoked: " + options.uri.uri + ", with method " + options.method, tracing_js_1.TracingLevel.High);
method = options.method;
args = options.args || {};
if (!this.module.getMethod(method)) {
if (!this._module.getMethod(method)) {
error = new core_js_1.WrapError("Plugin missing method \"" + method + "\"", {

@@ -105,7 +92,6 @@ code: core_js_1.WrapErrorCode.WRAPPER_METHOD_NOT_FOUND,

// Set the module's environment
this.module.setEnv(options.env || {});
this._module.setEnv(options.env || {});
// If the args are a msgpack buffer, deserialize it
if (core_js_1.isBuffer(args)) {
result_2 = msgpack_js_1.msgpackDecode(args);
tracing_js_1.Tracer.addEvent("msgpack-decoded", result_2);
if (typeof result_2 !== "object") {

@@ -125,3 +111,3 @@ error = new core_js_1.WrapError("Decoded MsgPack args did not result in an object.\nResult: " + result_2, {

}
return [4 /*yield*/, this.module._wrap_invoke(method, jsArgs, client)];
return [4 /*yield*/, this._module._wrap_invoke(method, jsArgs, client)];
case 1:

@@ -131,3 +117,2 @@ result = _e.sent();

data = result.value;
tracing_js_1.Tracer.addEvent("Result", data);
return [2 /*return*/, __assign(__assign({}, result_1.ResultOk(data)), { encoded: false })];

@@ -152,8 +137,2 @@ }

};
__decorate([
tracing_js_1.Tracer.traceMethod("PluginWrapper: getManifest")
], PluginWrapper.prototype, "getManifest", null);
__decorate([
tracing_js_1.Tracer.traceMethod("PluginWrapper: invoke", tracing_js_1.TracingLevel.High)
], PluginWrapper.prototype, "invoke", null);
return PluginWrapper;

@@ -160,0 +139,0 @@ }());

@@ -7,6 +7,6 @@ import { PluginMethod } from "../PluginMethod";

export declare class PluginModuleWithMethods<TEnv extends Record<string, unknown> = Record<string, unknown>> extends PluginModule<never, TEnv> {
private getPluginMethods;
constructor(getPluginMethods: GetPluginMethodsFunc<TEnv>);
private _getPluginMethods;
constructor(_getPluginMethods: GetPluginMethodsFunc<TEnv>);
_wrap_invoke<TArgs extends Record<string, unknown> = Record<string, unknown>, TResult = unknown>(method: string, args: TArgs, client: CoreClient): Promise<Result<TResult, Error>>;
getMethod<TArgs extends Record<string, unknown> = Record<string, unknown>, TResult = unknown>(method: string): PluginMethod<TArgs, TResult> | undefined;
}

@@ -59,5 +59,5 @@ "use strict";

__extends(PluginModuleWithMethods, _super);
function PluginModuleWithMethods(getPluginMethods) {
function PluginModuleWithMethods(_getPluginMethods) {
var _this = _super.call(this, {}) || this;
_this.getPluginMethods = getPluginMethods;
_this._getPluginMethods = _getPluginMethods;
return _this;

@@ -95,3 +95,3 @@ }

PluginModuleWithMethods.prototype.getMethod = function (method) {
var fn = this.getPluginMethods(this)[method];
var fn = this._getPluginMethods(this)[method];
return fn === null || fn === void 0 ? void 0 : fn.bind(this);

@@ -98,0 +98,0 @@ };

{
"name": "@polywrap/plugin-js",
"description": "Polywrap plugin core package for plugin wrappers",
"version": "0.10.0-pre.7",
"version": "0.10.0-pre.8",
"license": "MIT",

@@ -22,7 +22,7 @@ "repository": {

"dependencies": {
"@polywrap/core-js": "0.10.0-pre.7",
"@polywrap/msgpack-js": "0.10.0-pre.7",
"@polywrap/result": "0.10.0-pre.7",
"@polywrap/tracing-js": "0.10.0-pre.7",
"@polywrap/wrap-manifest-types-js": "0.10.0-pre.7"
"@polywrap/core-js": "0.10.0-pre.8",
"@polywrap/msgpack-js": "0.10.0-pre.8",
"@polywrap/result": "0.10.0-pre.8",
"@polywrap/tracing-js": "0.10.0-pre.8",
"@polywrap/wrap-manifest-types-js": "0.10.0-pre.8"
},

@@ -29,0 +29,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet