Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
require('util.promisify/shim')()
let PicoEngineCore = require('pico-engine-core')
let leveljs = require('level-js')
let levelup = require('levelup')
let fs = require('fs')
let krlCompiler = require('krl-compiler')
let krlCompilerVersion = require('krl-compiler/package.json').version
let crypto = require('crypto')
/* eslint-disable */
let builtInRulesets = [
{
src: fs.readFileSync(__dirname + '/../../pico-engine/krl/io.picolabs.wrangler.krl', 'utf8'),
meta: { url: 'pico-engine.js/io.picolabs.wrangler.krl' }
},
{
src: fs.readFileSync(__dirname + '/../../pico-engine/krl/io.picolabs.visual_params.krl', 'utf8'),
meta: { url: 'pico-engine.js/io.picolabs.visual_params.krl' }
},
{
src: fs.readFileSync(__dirname + '/../../pico-engine/krl/io.picolabs.subscription.krl', 'utf8'),
meta: { url: 'pico-engine.js/io.picolabs.subscription.krl' }
}
import * as fs from "fs";
import leveldown from "leveldown";
import { default as level, LevelUp } from "levelup";
import * as makeDir from "make-dir";
import * as path from "path";
import { Ruleset } from "pico-framework";
const krlCompiler = require("krl-compiler");
const krlCompilerVersion = require("krl-compiler/package.json").version;
const charwise = require("charwise");
const encode = require("encoding-down");
const safeJsonCodec = require("level-json-coerce-null");
function normalizeVersion(version: string) {
if (typeof version !== "string") {
version = "";
}
version = version.trim().toLowerCase();
if (version === "") {
version = "draft";
}
if (version === "draft") {
return version;
}
const isDraft = /draft$/.test(version);
var fs = require("fs");
var path = require("path");
var mkdirp = require("mkdirp");
var compiler = require("krl-compiler");
var version_key = [
require("pico-engine-core/package.json").version,
require("krl-compiler/package.json").version
].join("-");
var fsExist = function(file_path, callback){
fs.stat(file_path, function(err, stats){
if(err){
if(err.code === "ENOENT"){
return callback(undefined, false);
}else{
return callback(err);
}
}
callback(undefined, true);
});
};
var storeFile = function(file_path, src, callback){
var fs = require("fs");
var path = require("path");
var mkdirp = require("mkdirp");
var compiler = require("krl-compiler");
var version_key = require("../package.json").version + "-" + require("krl-compiler/package.json").version;
var fsExist = function(file_path, callback){
fs.stat(file_path, function(err, stats){
if(err){
if(err.code === "ENOENT"){
return callback(undefined, false);
}else{
return callback(err);
}
}
callback(undefined, true);
});
};
var storeFile = function(file_path, src, callback){
mkdirp(path.dirname(file_path), function(err){
var _ = require('lodash')
var fs = require('fs')
var util = require('util')
var path = require('path')
var mkdirp = require('mkdirp')
var compiler = require('krl-compiler')
var versionKey = [
require('pico-engine-core/package.json').version,
require('krl-compiler/package.json').version
].join('-')
var fsExist = function (filePath, callback) {
fs.stat(filePath, function (err, stats) {
if (err) {
if (err.code === 'ENOENT') {
return callback(null, false)
} else {
return callback(err)
}
}
callback(null, true)
})
}
var storeFile = function (filePath, src, callback) {