Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@promise-watch/core

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@promise-watch/core - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

23

dist/execute.js

@@ -33,10 +33,19 @@ "use strict";

const imports = await Promise.all(files.map(f => Promise.resolve().then(() => __importStar(require((0, path_1.resolve)(dir, "../", f))))));
return imports.map((r, idx) => {
return imports.map(({ name, run, options }, idx) => {
name = name !== null && name !== void 0 ? name : files[idx].replace("runs/", "");
return { name, run, options };
}).reduce((prev, next) => {
var _a;
return ({
name: (_a = r.name) !== null && _a !== void 0 ? _a : files[idx].replace("runs/", ""),
run: r.run,
options: r.options,
});
});
const errors = [];
if (typeof next.run !== "function")
errors.push(`* missing required export async function run()`);
if (typeof ((_a = next.options) === null || _a === void 0 ? void 0 : _a.interval) !== "number")
errors.push(`* missing required export const option.interval`);
if (errors.length) {
console.log(`${next.name} has errors and was skipped:`);
console.log(errors.join("\n"), "\n");
return [...prev];
}
return [...prev, next];
}, []);
}

@@ -43,0 +52,0 @@ async function sendNotifications({ title, body, notifiers, isSuccess = false }) {

{
"name": "@promise-watch/core",
"version": "0.0.8",
"version": "0.0.9",
"main": "dist/index.js",

@@ -18,3 +18,3 @@ "author": "Jason Raimondi <jason@raimondi.us> (https://jasonraimondi.com)",

"@types/glob": "^7.2.0",
"playwright": "^1.19.1",
"playwright": "^1.19.2",
"prettier": "^2.5.1"

@@ -21,0 +21,0 @@ },

@@ -32,7 +32,19 @@ import { resolve } from "path";

const imports = await Promise.all(files.map(f => import(resolve(dir, "../", f))));
return imports.map((r: RunPage, idx) => ({
name: r.name ?? files[idx].replace("runs/", ""),
run: r.run,
options: r.options,
}));
return imports.map(({ name, run, options }: RunPage, idx) => {
name = name ?? files[idx].replace("runs/", "")
return { name, run, options }
}).reduce((prev, next) => {
const errors = [];
if (typeof next.run !== "function") errors.push(`* missing required export async function run()`);
if (typeof next.options?.interval !== "number") errors.push(`* missing required export const option.interval`);
if (errors.length) {
console.log(`${next.name} has errors and was skipped:`);
console.log(errors.join("\n"), "\n");
return [...prev];
}
return [...prev, next];
}, [] as Required<RunPage>[])
}

@@ -68,2 +80,3 @@

} catch (err: any) {
// if we have already notified about the error,

@@ -70,0 +83,0 @@ // wait until success before sending another notification

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