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

ddf-query-validator

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ddf-query-validator - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

15

lib/dataset-manager.service.js

@@ -7,2 +7,3 @@ "use strict";

const get = require("lodash.get");
const path = require("path");
const helper_service_1 = require("./helper.service");

@@ -15,7 +16,9 @@ function getDatasetPath(basePath, queryParam) {

function getDatapackagePath(datasetPath) {
return datasetPath + '/datapackage.json';
return path.resolve(datasetPath, 'datapackage.json');
}
function isDatasetPathAlreadyInBasePath(fileReader, basePath) {
return new Promise((resolve) => {
fileReader.readText(getDatapackagePath(basePath), (error) => resolve(!error));
fileReader.readText(getDatapackagePath(basePath), (error) => {
return resolve(!error);
});
});

@@ -35,3 +38,3 @@ }

const { dataset: originDataset, branch: originBranch, commit: originCommit } = queryParam;
const { dataset = DEFAULT_DATASET, branch = DEFAULT_BRANCH, commit = DEFAULT_COMMIT } = queryParam;
let { dataset = DEFAULT_DATASET, branch = DEFAULT_BRANCH, commit = DEFAULT_COMMIT } = queryParam;
const basePath = get(options, 'basePath', helper_service_1.DEFAULT_DATASET_DIR);

@@ -52,3 +55,7 @@ const fileReader = get(options, 'fileReader');

try {
if (yield isDatasetPathAlreadyInBasePath(fileReader, basePath)) {
const isAlreadyDataset = yield isDatasetPathAlreadyInBasePath(fileReader, basePath);
if (isAlreadyDataset) {
dataset = basePath;
branch = null;
commit = null;
datasetPath = basePath;

@@ -55,0 +62,0 @@ datapackagePath = getDatapackagePath(basePath);

{
"name": "ddf-query-validator",
"version": "1.0.2",
"version": "1.0.3",
"description": "DDF query validator",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

import * as isNil from 'lodash.isnil';
import * as includes from 'lodash.includes';
import * as get from 'lodash.get';
import * as path from 'path';
import {

@@ -22,3 +23,3 @@ DEFAULT_DATASET_BRANCH,

function getDatapackagePath(datasetPath): string {
return datasetPath + '/datapackage.json';
return path.resolve(datasetPath, 'datapackage.json');
}

@@ -28,3 +29,5 @@

return new Promise((resolve) => {
fileReader.readText(getDatapackagePath(basePath), (error) => resolve(!error));
fileReader.readText(getDatapackagePath(basePath), (error) => {
return resolve(!error);
});
});

@@ -55,3 +58,3 @@ }

} = queryParam;
const {
let {
dataset = DEFAULT_DATASET,

@@ -82,3 +85,7 @@ branch = DEFAULT_BRANCH,

try {
if (await isDatasetPathAlreadyInBasePath(fileReader, basePath)) {
const isAlreadyDataset = await isDatasetPathAlreadyInBasePath(fileReader, basePath);
if (isAlreadyDataset) {
dataset = basePath;
branch = null;
commit = null;
datasetPath = basePath;

@@ -85,0 +92,0 @@ datapackagePath = getDatapackagePath(basePath);

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