Comparing version 0.2.2 to 0.2.3
@@ -8,3 +8,2 @@ import { Candle, MetricId, ProtocolId, QueryFn, SubscribeFn, Timeframe } from "./protofun"; | ||
}; | ||
export declare function loadMetricFns(protocolId: ProtocolId, metricId: MetricId, packagePath?: string): Promise<MetricFnsResult>; | ||
export declare function getLowestTimeframe(supportedTimeframes: Timeframe[]): Timeframe; | ||
@@ -11,0 +10,0 @@ export declare function isProtocolId(value: string): value is ProtocolId; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isCandleArray = exports.isCandle = exports.isTimeframe = exports.isMetric = exports.isProtocolId = exports.getLowestTimeframe = exports.loadMetricFns = exports.allTimeframes = exports.wait = void 0; | ||
exports.isCandleArray = exports.isCandle = exports.isTimeframe = exports.isMetric = exports.isProtocolId = exports.getLowestTimeframe = exports.allTimeframes = exports.wait = void 0; | ||
const protofun_1 = require("./protofun"); | ||
@@ -33,8 +10,2 @@ async function wait(ms) { | ||
exports.allTimeframes = ["Block", "Minute", "Hour", "Day", "Week"]; | ||
async function loadMetricFns(protocolId, metricId, packagePath = "protofun/dist/metrics") { | ||
const module = await Promise.resolve().then(() => __importStar(require(`${packagePath}/${protocolId}/${metricId}`))); | ||
const { default: query, subscribe } = module; | ||
return { query, subscribe }; | ||
} | ||
exports.loadMetricFns = loadMetricFns; | ||
function getLowestTimeframe(supportedTimeframes) { | ||
@@ -41,0 +12,0 @@ return supportedTimeframes.find((x) => x !== "Block"); |
{ | ||
"name": "protofun", | ||
"license": "UNLICENSED", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"files": [ | ||
@@ -13,4 +13,3 @@ "dist", | ||
"scripts": { | ||
"start": "concurrently 'vite build --watch' 'npm run types --watch --preserveWatchOutput' --names 'vite,tsc' -c 'green,blue'", | ||
"build": "tsc --project tsconfig.prod.json", | ||
"build": "rm -rf dist/ && tsc --project tsconfig.prod.json", | ||
"check-types": "tsc --noEmit", | ||
@@ -17,0 +16,0 @@ "prepublish": "npm run build", |
@@ -24,12 +24,2 @@ import { | ||
export async function loadMetricFns( | ||
protocolId: ProtocolId, | ||
metricId: MetricId, | ||
packagePath = "protofun/dist/metrics" | ||
): Promise<MetricFnsResult> { | ||
const module = await import(`${packagePath}/${protocolId}/${metricId}`) | ||
const { default: query, subscribe } = module | ||
return { query, subscribe } | ||
} | ||
export function getLowestTimeframe(supportedTimeframes: Timeframe[]) { | ||
@@ -36,0 +26,0 @@ return supportedTimeframes.find((x) => x !== "Block") as Timeframe |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
1
1
65023
57
1272