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

@oasislabs/parcel

Package Overview
Dependencies
Maintainers
59
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oasislabs/parcel - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

35

lib/client.js

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

const res = this.getHeaders().then((headers) => __awaiter(this, void 0, void 0, function* () {
return fetch(`${this.apiUrl}${endpoint}`, {
const res = yield fetch(`${this.apiUrl}${endpoint}`, {
method: 'GET',

@@ -85,9 +85,21 @@ headers,

});
if (!res.ok) {
const errorMessage = (yield res.json()).error;
const error = new Error(`failed to fetch dataset: ${errorMessage}`);
error.response = res;
throw error;
}
return res;
}));
const dl = new Download({
read() {
res.then((res) => __awaiter(this, void 0, void 0, function* () {
if (!res.body)
const reader = res.then((res) => {
if (!res.body)
return null;
return res.body.getReader();
});
const dl = new (class extends Download {
_read() {
reader
.then((rdr) => __awaiter(this, void 0, void 0, function* () {
if (!rdr)
return this.push(null);
const rdr = res.body.getReader();
let chunk;

@@ -104,10 +116,11 @@ do {

this.push(null);
})).catch((error) => this.destroy(error));
},
destroy(error, cb) {
}))
.catch((error) => this.destroy(error));
}
_destroy(error, cb) {
abortController.abort();
void res.then((res) => { var _a; return (_a = res.body) === null || _a === void 0 ? void 0 : _a.cancel(); });
cb(error);
},
});
}
})();
res.catch((error) => dl.destroy(error));

@@ -114,0 +127,0 @@ return dl;

import EventEmitter from 'eventemitter3';
import { Readable } from 'readable-stream';
import type { JsonObject, Opaque, RequireAtLeastOne } from 'type-fest';
import type { JsonObject, Opaque, RequireAtLeastOne, RequireExactlyOne } from 'type-fest';
import type { AppId } from './app';

@@ -92,5 +92,9 @@ import type { Client, Download } from './client';

export declare type ListDatasetsFilter = Partial<{
creator: IdentityId;
owner: IdentityId;
creator: IdentityId;
sharedWith: IdentityId;
tags: string[] | RequireExactlyOne<{
any: string[];
all: string[];
}>;
}>;

@@ -97,0 +101,0 @@ /**

@@ -40,4 +40,12 @@ "use strict";

static list(client, filter) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const podPage = yield client.get(DATASETS_EP, filter);
let tagsFilter;
if (filter === null || filter === void 0 ? void 0 : filter.tags) {
const tagsSpec = filter.tags;
const prefix = Array.isArray(tagsSpec) || tagsSpec.all ? 'all' : 'any';
const tags = Array.isArray(tagsSpec) ? tagsSpec : (_a = tagsSpec.all) !== null && _a !== void 0 ? _a : tagsSpec.any;
tagsFilter = `${prefix}:${tags.join(',')}`;
}
const podPage = yield client.get(DATASETS_EP, Object.assign(Object.assign({}, filter), { tags: tagsFilter }));
const results = podPage.results.map((podDataset) => new DatasetImpl(client, podDataset));

@@ -44,0 +52,0 @@ return {

{
"name": "@oasislabs/parcel",
"version": "0.1.2",
"version": "0.1.3",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "author": "Oasis Labs <feedback@oasislabs.com>",

@@ -94,3 +94,3 @@ import type { WriteStream } from 'fs';

const res = this.getHeaders().then(async (headers) => {
return fetch(`${this.apiUrl}${endpoint}`, {
const res = await fetch(`${this.apiUrl}${endpoint}`, {
method: 'GET',

@@ -100,26 +100,41 @@ headers,

});
if (!res.ok) {
const errorMessage: string = (await res.json()).error;
const error = new Error(`failed to fetch dataset: ${errorMessage}`);
(error as any).response = res;
throw error;
}
return res;
});
const dl = new Download({
read() {
res.then(async (res) => {
if (!res.body) return this.push(null);
const reader = res.then((res) => {
if (!res.body) return null;
return res.body.getReader();
});
const dl = new (class extends Download {
public _read(): void {
reader
.then(async (rdr) => {
if (!rdr) return this.push(null);
const rdr = res.body.getReader();
let chunk;
do {
// eslint-disable-next-line no-await-in-loop
chunk = await rdr.read(); // Loop iterations are not independent.
if (!chunk.value) continue;
if (!this.push(chunk.value)) break;
} while (!chunk.done);
let chunk;
do {
// eslint-disable-next-line no-await-in-loop
chunk = await rdr.read(); // Loop iterations are not independent.
if (!chunk.value) continue;
if (!this.push(chunk.value)) break;
} while (!chunk.done);
if (chunk.done) this.push(null);
}).catch((error) => this.destroy(error));
},
destroy(error, cb) {
if (chunk.done) this.push(null);
})
.catch((error: any) => this.destroy(error));
}
public _destroy(error: Error, cb: (error?: Error) => void): void {
abortController.abort();
void res.then((res) => res.body?.cancel());
cb(error);
},
});
}
})();
res.catch((error) => dl.destroy(error));

@@ -126,0 +141,0 @@ return dl;

@@ -5,3 +5,3 @@ import axios, { CancelTokenSource } from 'axios';

import { Readable } from 'readable-stream';
import type { JsonObject, Opaque, RequireAtLeastOne } from 'type-fest';
import type { JsonObject, Opaque, RequireAtLeastOne, RequireExactlyOne } from 'type-fest';

@@ -106,3 +106,14 @@ import type { AppId } from './app';

): Promise<Page<Dataset>> {
const podPage = await client.get<Page<PODDataset>>(DATASETS_EP, filter);
let tagsFilter;
if (filter?.tags) {
const tagsSpec = filter.tags;
const prefix = Array.isArray(tagsSpec) || tagsSpec.all ? 'all' : 'any';
const tags = Array.isArray(tagsSpec) ? tagsSpec : tagsSpec.all ?? tagsSpec.any;
tagsFilter = `${prefix}:${tags.join(',')}`;
}
const podPage = await client.get<Page<PODDataset>>(DATASETS_EP, {
...filter,
tags: tagsFilter,
});
const results = podPage.results.map((podDataset) => new DatasetImpl(client, podDataset));

@@ -172,5 +183,11 @@ return {

export type ListDatasetsFilter = Partial<{
creator: IdentityId;
owner: IdentityId;
creator: IdentityId;
sharedWith: IdentityId;
tags:
| string[]
| RequireExactlyOne<{
any: string[];
all: string[];
}>;
}>;

@@ -177,0 +194,0 @@

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