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

newsware

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

newsware - npm Package Compare versions

Comparing version 6.0.1 to 6.1.0

36

lib/src/api.test.js

@@ -133,15 +133,15 @@ "use strict";

let actualNews = yield api.search({
filter: (0, filters_1.categoryCodes)(enums_1.FilterArrayAction.ANY, ["categoryCode1", "categoryCode2"])
filter: (0, filters_1.categoryCodes)(enums_1.FilterAction.ANY, ["categoryCode1", "categoryCode2"])
});
(0, chai_1.expect)(actualNews.length).to.eq(2);
actualNews = yield api.search({
filter: (0, filters_1.categoryCodes)(enums_1.FilterArrayAction.ALL, ["categoryCode1", "categoryCode2"])
filter: (0, filters_1.categoryCodes)(enums_1.FilterAction.ALL, ["categoryCode1", "categoryCode2"])
});
(0, chai_1.expect)(actualNews.length).to.eq(0);
actualNews = yield api.search({
filter: (0, filters_1.categoryCodes)(enums_1.FilterArrayAction.ALL, ["categoryCode1", "categoryCode11"])
filter: (0, filters_1.categoryCodes)(enums_1.FilterAction.ALL, ["categoryCode1", "categoryCode11"])
});
(0, chai_1.expect)(actualNews.length).to.eq(1);
actualNews = yield api.search({
filter: (0, filters_1.categoryCodes)(enums_1.FilterArrayAction.EXCLUDE, ["categoryCode1", "categoryCode2"])
filter: (0, filters_1.categoryCodes)(enums_1.FilterAction.EXCLUDE, ["categoryCode1", "categoryCode2"])
});

@@ -153,15 +153,15 @@ (0, chai_1.expect)(actualNews.length).to.eq(4);

let actualNews = yield api.search({
filter: (0, filters_1.tickers)(enums_1.FilterArrayAction.ANY, ["ticker1", "ticker2"])
filter: (0, filters_1.tickers)(enums_1.FilterAction.ANY, ["ticker1", "ticker2"])
});
(0, chai_1.expect)(actualNews.length).to.eq(2);
actualNews = yield api.search({
filter: (0, filters_1.tickers)(enums_1.FilterArrayAction.ALL, ["ticker1", "ticker2"])
filter: (0, filters_1.tickers)(enums_1.FilterAction.ALL, ["ticker1", "ticker2"])
});
(0, chai_1.expect)(actualNews.length).to.eq(0);
actualNews = yield api.search({
filter: (0, filters_1.tickers)(enums_1.FilterArrayAction.ALL, ["ticker1", "ticker11"])
filter: (0, filters_1.tickers)(enums_1.FilterAction.ALL, ["ticker1", "ticker11"])
});
(0, chai_1.expect)(actualNews.length).to.eq(1);
actualNews = yield api.search({
filter: (0, filters_1.tickers)(enums_1.FilterArrayAction.EXCLUDE, ["ticker1", "ticker2"])
filter: (0, filters_1.tickers)(enums_1.FilterAction.EXCLUDE, ["ticker1", "ticker2"])
});

@@ -173,15 +173,15 @@ (0, chai_1.expect)(actualNews.length).to.eq(4);

let actualNews = yield api.search({
filter: (0, filters_1.ciks)(enums_1.FilterArrayAction.ANY, [1, 2])
filter: (0, filters_1.ciks)(enums_1.FilterAction.ANY, [1, 2])
});
(0, chai_1.expect)(actualNews.length).to.eq(2);
actualNews = yield api.search({
filter: (0, filters_1.ciks)(enums_1.FilterArrayAction.ALL, [1, 2])
filter: (0, filters_1.ciks)(enums_1.FilterAction.ALL, [1, 2])
});
(0, chai_1.expect)(actualNews.length).to.eq(0);
actualNews = yield api.search({
filter: (0, filters_1.ciks)(enums_1.FilterArrayAction.ALL, [1, 11])
filter: (0, filters_1.ciks)(enums_1.FilterAction.ALL, [1, 11])
});
(0, chai_1.expect)(actualNews.length).to.eq(1);
actualNews = yield api.search({
filter: (0, filters_1.ciks)(enums_1.FilterArrayAction.EXCLUDE, [1, 2])
filter: (0, filters_1.ciks)(enums_1.FilterAction.EXCLUDE, [1, 2])
});

@@ -193,7 +193,7 @@ (0, chai_1.expect)(actualNews.length).to.eq(4);

let actualNews = yield api.search({
filter: (0, filters_1.source)(enums_1.FilterArrayAction.ANY, ["source1", "source2"])
filter: (0, filters_1.source)(enums_1.FilterAction.ANY, ["source1", "source2"])
});
(0, chai_1.expect)(actualNews.length).to.eq(2);
actualNews = yield api.search({
filter: (0, filters_1.source)(enums_1.FilterArrayAction.EXCLUDE, ["source1", "source2"])
filter: (0, filters_1.source)(enums_1.FilterAction.EXCLUDE, ["source1", "source2"])
});

@@ -205,7 +205,7 @@ (0, chai_1.expect)(actualNews.length).to.eq(4);

let actualNews = yield api.search({
filter: (0, filters_1.and)((0, filters_1.text)(["1"]), (0, filters_1.ciks)(enums_1.FilterArrayAction.ANY, [1]))
filter: (0, filters_1.and)((0, filters_1.text)(["1"]), (0, filters_1.ciks)(enums_1.FilterAction.ANY, [1]))
});
(0, chai_1.expect)(actualNews.length).to.eq(1);
actualNews = yield api.search({
filter: (0, filters_1.and)((0, filters_1.text)(["2"]), (0, filters_1.ciks)(enums_1.FilterArrayAction.ANY, [1]))
filter: (0, filters_1.and)((0, filters_1.text)(["2"]), (0, filters_1.ciks)(enums_1.FilterAction.ANY, [1]))
});

@@ -217,7 +217,7 @@ (0, chai_1.expect)(actualNews.length).to.eq(0);

let actualNews = yield api.search({
filter: (0, filters_1.or)((0, filters_1.text)(["1"]), (0, filters_1.ciks)(enums_1.FilterArrayAction.ANY, [2]))
filter: (0, filters_1.or)((0, filters_1.text)(["1"]), (0, filters_1.ciks)(enums_1.FilterAction.ANY, [2]))
});
(0, chai_1.expect)(actualNews.length).to.eq(2);
actualNews = yield api.search({
filter: (0, filters_1.or)((0, filters_1.text)(["2"]), (0, filters_1.ciks)(enums_1.FilterArrayAction.ANY, [1]), (0, filters_1.tickers)(enums_1.FilterArrayAction.ANY, ["ticker3"]))
filter: (0, filters_1.or)((0, filters_1.text)(["2"]), (0, filters_1.ciks)(enums_1.FilterAction.ANY, [1]), (0, filters_1.tickers)(enums_1.FilterAction.ANY, ["ticker3"]))
});

@@ -224,0 +224,0 @@ (0, chai_1.expect)(actualNews.length).to.eq(3);

@@ -11,7 +11,3 @@ import { EndpointDescription } from "./types";

}
export declare enum FilterTextAction {
MATCH = "match",
EXCLUDE = "exclude"
}
export declare enum FilterArrayAction {
export declare enum FilterAction {
ALL = "all",

@@ -18,0 +14,0 @@ ANY = "any",

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Endpoint = exports.WebsocketResponseType = exports.WebsocketMethod = exports.Source = exports.FilterArrayAction = exports.FilterTextAction = exports.FilterType = void 0;
exports.Endpoint = exports.WebsocketResponseType = exports.WebsocketMethod = exports.Source = exports.FilterAction = exports.FilterType = void 0;
var FilterType;

@@ -14,13 +14,8 @@ (function (FilterType) {

})(FilterType || (exports.FilterType = FilterType = {}));
var FilterTextAction;
(function (FilterTextAction) {
FilterTextAction["MATCH"] = "match";
FilterTextAction["EXCLUDE"] = "exclude";
})(FilterTextAction || (exports.FilterTextAction = FilterTextAction = {}));
var FilterArrayAction;
(function (FilterArrayAction) {
FilterArrayAction["ALL"] = "all";
FilterArrayAction["ANY"] = "any";
FilterArrayAction["EXCLUDE"] = "exclude";
})(FilterArrayAction || (exports.FilterArrayAction = FilterArrayAction = {}));
var FilterAction;
(function (FilterAction) {
FilterAction["ALL"] = "all";
FilterAction["ANY"] = "any";
FilterAction["EXCLUDE"] = "exclude";
})(FilterAction || (exports.FilterAction = FilterAction = {}));
var Source;

@@ -27,0 +22,0 @@ (function (Source) {

import { Filter, FilterArray, TextOptions } from "./types";
import { FilterArrayAction } from "./enums";
import { FilterAction } from "./enums";
export declare const and: (...queries: Filter[]) => Filter;
export declare const or: (...queries: Filter[]) => Filter;
export declare const text: (value: string[], options?: TextOptions) => Filter;
export declare const tickers: (action: FilterArrayAction, value: string[]) => FilterArray;
export declare const ciks: (action: FilterArrayAction, value: number[]) => FilterArray;
export declare const categoryCodes: (action: FilterArrayAction, value: string[]) => FilterArray;
export declare const source: (action: FilterArrayAction.ANY | FilterArrayAction.EXCLUDE, value: string[]) => FilterArray;
export declare const tickers: (action: FilterAction, value: string[]) => FilterArray;
export declare const ciks: (action: FilterAction, value: number[]) => FilterArray;
export declare const categoryCodes: (action: FilterAction, value: string[]) => FilterArray;
export declare const source: (action: FilterAction.ANY | FilterAction.EXCLUDE, value: string[]) => FilterArray;

@@ -5,2 +5,2 @@ export { or, and, text, ciks, tickers, source, categoryCodes } from "./filters";

export { News, Filter, TextOptions, WebsocketResponse, WebsocketErrorResponse, ConnectOptions, HistoricalFilter } from "./types";
export { Source, WebsocketMethod, WebsocketResponseType, FilterType, FilterArrayAction, FilterTextAction } from "./enums";
export { Source, WebsocketMethod, WebsocketResponseType, FilterType, FilterAction } from "./enums";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilterTextAction = exports.FilterArrayAction = exports.FilterType = exports.WebsocketResponseType = exports.WebsocketMethod = exports.Source = exports.WsApi = exports.Api = exports.categoryCodes = exports.source = exports.tickers = exports.ciks = exports.text = exports.and = exports.or = void 0;
exports.FilterAction = exports.FilterType = exports.WebsocketResponseType = exports.WebsocketMethod = exports.Source = exports.WsApi = exports.Api = exports.categoryCodes = exports.source = exports.tickers = exports.ciks = exports.text = exports.and = exports.or = void 0;
var filters_1 = require("./filters");

@@ -21,4 +21,3 @@ Object.defineProperty(exports, "or", { enumerable: true, get: function () { return filters_1.or; } });

Object.defineProperty(exports, "FilterType", { enumerable: true, get: function () { return enums_1.FilterType; } });
Object.defineProperty(exports, "FilterArrayAction", { enumerable: true, get: function () { return enums_1.FilterArrayAction; } });
Object.defineProperty(exports, "FilterTextAction", { enumerable: true, get: function () { return enums_1.FilterTextAction; } });
Object.defineProperty(exports, "FilterAction", { enumerable: true, get: function () { return enums_1.FilterAction; } });
//# sourceMappingURL=index.js.map
/// <reference types="ws" />
import { CloseEvent } from "isomorphic-ws";
import { FilterArrayAction, FilterTextAction, FilterType, WebsocketMethod, WebsocketResponseType } from "./enums";
import { FilterAction, FilterType, WebsocketMethod, WebsocketResponseType } from "./enums";
export interface RestResponse {

@@ -32,3 +32,3 @@ error: ApiResponseError;

export interface TextOptions {
action?: FilterTextAction;
action?: FilterAction;
onlyBody?: boolean;

@@ -39,11 +39,11 @@ onlyHeadline?: boolean;

type: FilterType.CATEGORY_CODES | FilterType.TICKERS;
action: FilterArrayAction;
action: FilterAction;
value: string[];
} | {
type: FilterType.SOURCE;
action: FilterArrayAction.ANY | FilterArrayAction.EXCLUDE;
action: FilterAction.ANY | FilterAction.EXCLUDE;
value: string[];
} | {
type: FilterType.CIKS;
action: FilterArrayAction;
action: FilterAction;
value: number[];

@@ -50,0 +50,0 @@ };

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

return __awaiter(this, void 0, void 0, function* () {
this.timeout(10000);
const config = yaml.load(fs.readFileSync("./test/config.yml", "utf8"));

@@ -44,0 +45,0 @@ if (!config.index.endsWith("_tests")) {

{
"name": "newsware",
"version": "6.0.1",
"version": "6.1.0",
"description": "Typescript client for interacting with the Newsware API",

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

import {Api} from "./api";
import {Endpoint, FilterArrayAction} from "./enums";
import {Endpoint, FilterAction} from "./enums";
import {expect} from "chai"

@@ -149,3 +149,3 @@ import {TestsContext} from "../test/setup";

let actualNews = await api.search({
filter: categoryCodes(FilterArrayAction.ANY, ["categoryCode1", "categoryCode2"])
filter: categoryCodes(FilterAction.ANY, ["categoryCode1", "categoryCode2"])
})

@@ -155,3 +155,3 @@ expect(actualNews.length).to.eq(2)

actualNews = await api.search({
filter: categoryCodes(FilterArrayAction.ALL, ["categoryCode1", "categoryCode2"])
filter: categoryCodes(FilterAction.ALL, ["categoryCode1", "categoryCode2"])
})

@@ -161,3 +161,3 @@ expect(actualNews.length).to.eq(0)

actualNews = await api.search({
filter: categoryCodes(FilterArrayAction.ALL, ["categoryCode1", "categoryCode11"])
filter: categoryCodes(FilterAction.ALL, ["categoryCode1", "categoryCode11"])
})

@@ -167,3 +167,3 @@ expect(actualNews.length).to.eq(1)

actualNews = await api.search({
filter: categoryCodes(FilterArrayAction.EXCLUDE, ["categoryCode1", "categoryCode2"])
filter: categoryCodes(FilterAction.EXCLUDE, ["categoryCode1", "categoryCode2"])
})

@@ -177,3 +177,3 @@ expect(actualNews.length).to.eq(4)

let actualNews = await api.search({
filter: tickers(FilterArrayAction.ANY, ["ticker1", "ticker2"])
filter: tickers(FilterAction.ANY, ["ticker1", "ticker2"])
})

@@ -183,3 +183,3 @@ expect(actualNews.length).to.eq(2)

actualNews = await api.search({
filter: tickers(FilterArrayAction.ALL, ["ticker1", "ticker2"])
filter: tickers(FilterAction.ALL, ["ticker1", "ticker2"])
})

@@ -189,3 +189,3 @@ expect(actualNews.length).to.eq(0)

actualNews = await api.search({
filter: tickers(FilterArrayAction.ALL, ["ticker1", "ticker11"])
filter: tickers(FilterAction.ALL, ["ticker1", "ticker11"])
})

@@ -195,3 +195,3 @@ expect(actualNews.length).to.eq(1)

actualNews = await api.search({
filter: tickers(FilterArrayAction.EXCLUDE, ["ticker1", "ticker2"])
filter: tickers(FilterAction.EXCLUDE, ["ticker1", "ticker2"])
})

@@ -205,3 +205,3 @@ expect(actualNews.length).to.eq(4)

let actualNews = await api.search({
filter: ciks(FilterArrayAction.ANY, [1, 2])
filter: ciks(FilterAction.ANY, [1, 2])
})

@@ -211,3 +211,3 @@ expect(actualNews.length).to.eq(2)

actualNews = await api.search({
filter: ciks(FilterArrayAction.ALL, [1, 2])
filter: ciks(FilterAction.ALL, [1, 2])
})

@@ -217,3 +217,3 @@ expect(actualNews.length).to.eq(0)

actualNews = await api.search({
filter: ciks(FilterArrayAction.ALL, [1, 11])
filter: ciks(FilterAction.ALL, [1, 11])
})

@@ -223,3 +223,3 @@ expect(actualNews.length).to.eq(1)

actualNews = await api.search({
filter: ciks(FilterArrayAction.EXCLUDE, [1, 2])
filter: ciks(FilterAction.EXCLUDE, [1, 2])
})

@@ -233,3 +233,3 @@ expect(actualNews.length).to.eq(4)

let actualNews = await api.search({
filter: source(FilterArrayAction.ANY, ["source1", "source2"])
filter: source(FilterAction.ANY, ["source1", "source2"])
})

@@ -239,3 +239,3 @@ expect(actualNews.length).to.eq(2)

actualNews = await api.search({
filter: source(FilterArrayAction.EXCLUDE, ["source1", "source2"])
filter: source(FilterAction.EXCLUDE, ["source1", "source2"])
})

@@ -251,3 +251,3 @@ expect(actualNews.length).to.eq(4)

text(["1"]),
ciks(FilterArrayAction.ANY, [1])
ciks(FilterAction.ANY, [1])
)

@@ -260,3 +260,3 @@ })

text(["2"]),
ciks(FilterArrayAction.ANY, [1])
ciks(FilterAction.ANY, [1])
)

@@ -273,3 +273,3 @@ })

text(["1"]),
ciks(FilterArrayAction.ANY, [2])
ciks(FilterAction.ANY, [2])
)

@@ -282,4 +282,4 @@ })

text(["2"]),
ciks(FilterArrayAction.ANY, [1]),
tickers(FilterArrayAction.ANY, ["ticker3"])
ciks(FilterAction.ANY, [1]),
tickers(FilterAction.ANY, ["ticker3"])
)

@@ -286,0 +286,0 @@ })

@@ -12,8 +12,4 @@ import {EndpointDescription} from "./types";

}
export enum FilterTextAction {
MATCH = "match",
EXCLUDE = "exclude"
}
export enum FilterArrayAction {
export enum FilterAction {
ALL = "all",

@@ -20,0 +16,0 @@ ANY = "any",

import {Filter, FilterArray, TextOptions} from "./types";
import {FilterArrayAction, FilterType} from "./enums";
import {FilterAction, FilterType} from "./enums";

@@ -27,3 +27,3 @@ export const and = (...queries: Filter[]): Filter => {

export const tickers = (
action: FilterArrayAction,
action: FilterAction,
value: string[]

@@ -39,3 +39,3 @@ ): FilterArray => {

export const ciks = (
action: FilterArrayAction,
action: FilterAction,
value: number[]

@@ -51,3 +51,3 @@ ): FilterArray => {

export const categoryCodes = (
action: FilterArrayAction,
action: FilterAction,
value: string[]

@@ -63,3 +63,3 @@ ): FilterArray => {

export const source = (
action: FilterArrayAction.ANY | FilterArrayAction.EXCLUDE,
action: FilterAction.ANY | FilterAction.EXCLUDE,
value: string[]

@@ -66,0 +66,0 @@ ): FilterArray => {

@@ -13,2 +13,2 @@ export {or, and, text, ciks, tickers, source, categoryCodes} from "./filters";

} from "./types"
export {Source, WebsocketMethod, WebsocketResponseType, FilterType, FilterArrayAction, FilterTextAction} from "./enums"
export {Source, WebsocketMethod, WebsocketResponseType, FilterType, FilterAction} from "./enums"
import {CloseEvent} from "isomorphic-ws"
import {FilterArrayAction, FilterTextAction, FilterType, WebsocketMethod, WebsocketResponseType} from "./enums"
import {FilterAction, FilterType, WebsocketMethod, WebsocketResponseType} from "./enums"

@@ -37,3 +37,3 @@ export interface RestResponse {

export interface TextOptions {
action?: FilterTextAction // Defaults to "match"
action?: FilterAction
onlyBody?: boolean

@@ -45,11 +45,11 @@ onlyHeadline?: boolean

type: FilterType.CATEGORY_CODES | FilterType.TICKERS
action: FilterArrayAction
action: FilterAction
value: string[]
} | {
type: FilterType.SOURCE
action: FilterArrayAction.ANY | FilterArrayAction.EXCLUDE
action: FilterAction.ANY | FilterAction.EXCLUDE
value: string[]
} | {
type: FilterType.CIKS
action: FilterArrayAction
action: FilterAction
value: number[]

@@ -56,0 +56,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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