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

@polywrap/logger-plugin-js

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polywrap/logger-plugin-js - npm Package Compare versions

Comparing version 0.10.0 to 0.10.1

4

build/index.d.ts

@@ -1,4 +0,4 @@

import { Module, Args_log, Logger_LogLevel } from "./wrap";
import { Module, Args_log, LogLevel } from "./wrap";
import { PluginFactory } from "@polywrap/plugin-js";
export declare type LogFunc = (level: Logger_LogLevel, message: string) => void;
export declare type LogFunc = (level: LogLevel, message: string) => void;
export interface LoggerPluginConfig {

@@ -5,0 +5,0 @@ logFunc?: LogFunc;

@@ -31,15 +31,15 @@ "use strict";

case "DEBUG":
case wrap_1.Logger_LogLevelEnum.DEBUG:
case wrap_1.LogLevelEnum.DEBUG:
console.debug(args.message);
break;
case "WARN":
case wrap_1.Logger_LogLevelEnum.WARN:
case wrap_1.LogLevelEnum.WARN:
console.warn(args.message);
break;
case "ERROR":
case wrap_1.Logger_LogLevelEnum.ERROR:
case wrap_1.LogLevelEnum.ERROR:
console.error(args.message);
break;
case "INFO":
case wrap_1.Logger_LogLevelEnum.INFO:
case wrap_1.LogLevelEnum.INFO:
console.log(args.message);

@@ -46,0 +46,0 @@ break;

@@ -5,7 +5,7 @@ import * as Types from "./types";

export interface Args_log {
level: Types.Logger_LogLevel;
level: Types.LogLevel;
message: Types.String;
}
export declare abstract class Module<TConfig> extends PluginModule<TConfig> {
abstract log(args: Args_log, client: CoreClient): MaybeAsync<Types.Boolean>;
abstract log(args: Args_log, client: CoreClient, env?: null): MaybeAsync<Types.Boolean>;
}

@@ -1,3 +0,1 @@

import * as Types from "./";
import { CoreClient, InvokeResult } from "@polywrap/core-js";
export declare type UInt = number;

@@ -17,3 +15,3 @@ export declare type UInt8 = number;

export declare type Boolean = boolean;
export declare enum Logger_LogLevelEnum {
export declare enum LogLevelEnum {
DEBUG = 0,

@@ -24,11 +22,3 @@ INFO = 1,

}
export declare type Logger_LogLevelString = "DEBUG" | "INFO" | "WARN" | "ERROR";
export declare type Logger_LogLevel = Logger_LogLevelEnum | Logger_LogLevelString;
interface Logger_Module_Args_log {
level: Types.Logger_LogLevel;
message: Types.String;
}
export declare const Logger_Module: {
log: (args: Logger_Module_Args_log, client: CoreClient) => Promise<InvokeResult<Types.Boolean>>;
};
export {};
export declare type LogLevelString = "DEBUG" | "INFO" | "WARN" | "ERROR";
export declare type LogLevel = LogLevelEnum | LogLevelString;
"use strict";
/// NOTE: This is an auto-generated file.
/// All modifications will be overwritten.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger_Module = exports.Logger_LogLevelEnum = void 0;
exports.LogLevelEnum = void 0;
/// Env START ///

@@ -47,25 +11,14 @@ /// Env END ///

/// Enums START ///
var LogLevelEnum;
(function (LogLevelEnum) {
LogLevelEnum[LogLevelEnum["DEBUG"] = 0] = "DEBUG";
LogLevelEnum[LogLevelEnum["INFO"] = 1] = "INFO";
LogLevelEnum[LogLevelEnum["WARN"] = 2] = "WARN";
LogLevelEnum[LogLevelEnum["ERROR"] = 3] = "ERROR";
})(LogLevelEnum = exports.LogLevelEnum || (exports.LogLevelEnum = {}));
/// Enums END ///
/// Imported Objects START ///
/* URI: "ens/wrappers.polywrap.eth:logger@1.0.0" */
var Logger_LogLevelEnum;
(function (Logger_LogLevelEnum) {
Logger_LogLevelEnum[Logger_LogLevelEnum["DEBUG"] = 0] = "DEBUG";
Logger_LogLevelEnum[Logger_LogLevelEnum["INFO"] = 1] = "INFO";
Logger_LogLevelEnum[Logger_LogLevelEnum["WARN"] = 2] = "WARN";
Logger_LogLevelEnum[Logger_LogLevelEnum["ERROR"] = 3] = "ERROR";
})(Logger_LogLevelEnum = exports.Logger_LogLevelEnum || (exports.Logger_LogLevelEnum = {}));
/* URI: "ens/wrappers.polywrap.eth:logger@1.0.0" */
exports.Logger_Module = {
log: function (args, client) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, client.invoke({
uri: "ens/wrappers.polywrap.eth:logger@1.0.0",
method: "log",
args: args,
})];
});
}); }
};
/// Imported Objects END ///
/// Imported Modules START ///
/// Imported Modules END ///
//# sourceMappingURL=types.js.map

@@ -9,3 +9,3 @@ "use strict";

abi: {
"importedEnumTypes": [
"enumTypes": [
{

@@ -18,80 +18,7 @@ "constants": [

],
"kind": 520,
"namespace": "Logger",
"nativeType": "LogLevel",
"type": "Logger_LogLevel",
"uri": "ens/wrappers.polywrap.eth:logger@1.0.0"
"kind": 8,
"type": "LogLevel"
}
],
"importedModuleTypes": [
{
"isInterface": false,
"kind": 256,
"methods": [
{
"arguments": [
{
"enum": {
"kind": 16384,
"name": "level",
"required": true,
"type": "Logger_LogLevel"
},
"kind": 34,
"name": "level",
"required": true,
"type": "Logger_LogLevel"
},
{
"kind": 34,
"name": "message",
"required": true,
"scalar": {
"kind": 4,
"name": "message",
"required": true,
"type": "String"
},
"type": "String"
}
],
"kind": 64,
"name": "log",
"required": true,
"return": {
"kind": 34,
"name": "log",
"required": true,
"scalar": {
"kind": 4,
"name": "log",
"required": true,
"type": "Boolean"
},
"type": "Boolean"
},
"type": "Method"
}
],
"namespace": "Logger",
"nativeType": "Module",
"type": "Logger_Module",
"uri": "ens/wrappers.polywrap.eth:logger@1.0.0"
}
],
"moduleType": {
"imports": [
{
"type": "Logger_Module"
},
{
"type": "Logger_LogLevel"
}
],
"interfaces": [
{
"kind": 2048,
"type": "Logger_Module"
}
],
"kind": 128,

@@ -106,3 +33,3 @@ "methods": [

"required": true,
"type": "Logger_LogLevel"
"type": "LogLevel"
},

@@ -112,3 +39,3 @@ "kind": 34,

"required": true,
"type": "Logger_LogLevel"
"type": "LogLevel"
},

@@ -115,0 +42,0 @@ {

@@ -12,20 +12,25 @@ {

],
"version": "0.10.0",
"version": "0.10.1",
"main": "build/index.js",
"scripts": {
"build": "rimraf ./build && yarn codegen && tsc",
"build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json",
"codegen": "polywrap codegen",
"test": "jest --passWithNoTests --runInBand --verbose",
"publish:npm": "yarn publish --access public --non-interactive --verbose"
"publish:npm": "yarn publish --access public --non-interactive --verbose",
"publish:pre:npm": "yarn publish --access public --non-interactive --verbose --tag pre"
},
"dependencies": {
"@polywrap/core-js": "0.10.0-pre.5",
"@polywrap/plugin-js": "0.10.0-pre.5"
"@polywrap/core-js": "0.10.0",
"@polywrap/plugin-js": "0.10.0"
},
"peerDependencies": {
"@polywrap/core-js": "0.10.x",
"@polywrap/plugin-js": "0.10.x"
},
"devDependencies": {
"@polywrap/client-js": "0.10.0-pre.5",
"@polywrap/uri-resolvers-js": "0.10.0-pre.5",
"@polywrap/client-js": "0.10.0",
"@polywrap/uri-resolvers-js": "0.10.0",
"@types/jest": "26.0.8",
"jest": "26.6.3",
"polywrap": "0.10.0-pre.5",
"polywrap": "0.10.2",
"rimraf": "3.0.2",

@@ -32,0 +37,0 @@ "ts-jest": "26.5.4",

# @polywrap/logger-plugin-js
The Logger plugin implements the `logger-interface` @ [ens/wrappers.polywrap.eth:logger@1.0.0](https://app.ens.domains/name/wrappers.polywrap.eth/details) (see [./src/schema.graphql](./src/schema.graphql)). By default, it logs all events using the Javascript `console` global object. You can circumvent this functionality by setting the `logFunc` property on the plugin's config (examples below).
The Logger plugin implements the `logger-interface` @ [ens/wraps.eth:logger@1.0.0](https://app.ens.domains/name/wraps.eth/details) (see [./src/schema.graphql](./src/schema.graphql)). By default, it logs all events using the Javascript `console` global object. You can circumvent this functionality by setting the `logFunc` property on the plugin's config (examples below).

@@ -8,22 +8,24 @@ ## Usage

```typescript
import { PolywrapClient } from "@polywrap/client-js";
import { PolywrapClient, ClientConfigBuilder } from "@polywrap/client-js";
import { loggerPlugin } from "@polywrap/logger-plugin-js";
const client = new PolywrapClient({
const config = new ClientConfigBuilder()
// 1. Add the plugin package @ an arbitrary URI
packages: [{
uri: "plugin/logger",
package: loggerPlugin({ })
}],
.addPackage(
"plugin/logger",
loggerPlugin({ })
)
// 2. Register this plugin as an implementation of the interface
interfaces: [{
interface: "ens/wrappers.polywrap.eth:logger@1.0.0",
implementations: ["plugin/logger"]
}],
.addInterfaceImplementation(
"ens/wraps.eth:logger@1.0.0",
"plugin/logger"
)
// 3. Redirect invocations @ the interface to the plugin (default impl)
redirects: [{
from: "ens/wrappers.polywrap.eth:logger@1.0.0",
to: "plugin/logger",
}]
});
.addRedirect(
"ens/wraps.eth:logger@1.0.0",
"plugin/logger"
)
.build();
const client = new PolywrapClient(config));
```

@@ -35,3 +37,3 @@

await client.invoke({
uri: "ens/wrappers.polywrap.eth:logger@1.0.0" | "plugin/logger",
uri: "ens/wraps.eth:logger@1.0.0" | "plugin/logger",
method: "log",

@@ -48,6 +50,6 @@ args: {

```typescript
new PolywrapClient({
packages: [{
uri: "plugin/logger",
package: loggerPlugin({
const config = new ClientConfigBuilder()
.addPackage(
"plugin/logger",
loggerPlugin({
logFunc: (level: string, message: string): void => {

@@ -57,5 +59,6 @@ // add your own logic here...

})
}],
...
})
)
.build();
const client = new PolywrapClient(config);
```

@@ -66,22 +69,22 @@

```typescript
const client = new PolywrapClient({
packages: [
{
uri: "plugin/logger",
package: loggerPlugin({ })
},
{
uri: "plugin/custom-logger",
package: loggerPlugin({ logFunc: ... })
}
],
redirects: [{
from: "ens/wrappers.polywrap.eth:logger@1.0.0",
to: "plugin/logger"
}],
interfaces: [{
interface: "ens/wrappers.polywrap.eth:logger@1.0.0",
implementations: ["plugin/logger", "plugin/custom-logger"]
}]
});
const config = new ClientConfigBuilder()
.addPackage(
"plugin/logger",
loggerPlugin({ })
)
.addPackage(
"plugin/custom-logger",
loggerPlugin({ logFunc: ... })
)
.addInterfaceImplementations(
"ens/wraps.eth:logger@1.0.0",
["plugin/logger", "plugin/custom-logger"]
)
.addRedirect(
"ens/wraps.eth:logger@1.0.0",
"plugin/logger"
)
.build();
const client = new PolywrapClient(config);
```

@@ -93,3 +96,3 @@

const result = await client.getImplementations(
"ens/wrappers.polywrap.eth:logger@1.0.0"
"ens/wraps.eth:logger@1.0.0"
);

@@ -96,0 +99,0 @@

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc