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

@quadient/evolve-data-transformations

Package Overview
Dependencies
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@quadient/evolve-data-transformations - npm Package Compare versions

Comparing version 0.0.7 to 0.0.10

dist/fixedLength/fixed-parser.d.ts

6

dist/csv/csv-parser.d.ts

@@ -5,3 +5,9 @@ interface CsvParserOptions {

}
/**
* Obsolete
*/
export declare type CsvEventType = "header" | "values";
/**
* Obsolete
*/
export declare type CsvEvent = {

@@ -8,0 +14,0 @@ type: "header";

4

dist/csv/string-to-csv-transform-stream.d.ts

@@ -1,3 +0,3 @@

import { CsvEvent } from "./csv-parser";
export declare class StringToCsvTransformStream extends TransformStream<string, CsvEvent> {
import { FlatEvent } from "../utils/flat-events";
export declare class StringToCsvTransformStream extends TransformStream<string, FlatEvent> {
private readonly parser;

@@ -4,0 +4,0 @@ private controller;

export * from "./csv/index";
export * from "./fixedLength/index";
export * from "./json/index";
export * from "./xml/index";
export * from "./utils/index";
export * from "./csv/index";
export * from "./fixedLength/index";
export * from "./json/index";
export * from "./xml/index";
export * from "./utils/index";

@@ -7,2 +7,3 @@ import { JsonEvent } from "./json-common";

private token;
private unicodeSequence;
private stateStack;

@@ -9,0 +10,0 @@ private prevCharWasCR;

@@ -10,8 +10,11 @@ import { JsonEventType, E_START_OBJECT, E_END_OBJECT, E_START_ARRAY, E_END_ARRAY } from "./json-common";

State[State["UNICODE"] = 5] = "UNICODE";
State[State["PROPERTY_AFTER_NAME"] = 6] = "PROPERTY_AFTER_NAME";
State[State["PROPERTY_AFTER_VALUE"] = 7] = "PROPERTY_AFTER_VALUE";
State[State["OBJECT_AFTER_COMMA"] = 8] = "OBJECT_AFTER_COMMA";
State[State["ARRAY_AFTER_VALUE"] = 9] = "ARRAY_AFTER_VALUE";
State[State["NON_STRING_VALUE"] = 10] = "NON_STRING_VALUE";
State[State["ARRAY_START"] = 11] = "ARRAY_START";
State[State["UNICODE2"] = 6] = "UNICODE2";
State[State["UNICODE3"] = 7] = "UNICODE3";
State[State["UNICODE4"] = 8] = "UNICODE4";
State[State["PROPERTY_AFTER_NAME"] = 9] = "PROPERTY_AFTER_NAME";
State[State["PROPERTY_AFTER_VALUE"] = 10] = "PROPERTY_AFTER_VALUE";
State[State["OBJECT_AFTER_COMMA"] = 11] = "OBJECT_AFTER_COMMA";
State[State["ARRAY_AFTER_VALUE"] = 12] = "ARRAY_AFTER_VALUE";
State[State["NON_STRING_VALUE"] = 13] = "NON_STRING_VALUE";
State[State["ARRAY_START"] = 14] = "ARRAY_START";
})(State || (State = {}));

@@ -24,2 +27,3 @@ const MAX_STACK_SIZE = 10000;

this.token = "";
this.unicodeSequence = "";
this.stateStack = [State.END];

@@ -238,2 +242,3 @@ this.prevCharWasCR = false;

this.state = State.UNICODE;
this.unicodeSequence = "";
break;

@@ -246,2 +251,19 @@ default:

break;
case State.UNICODE:
this.unicodeSequence += c;
this.state = State.UNICODE2;
break;
case State.UNICODE2:
this.unicodeSequence += c;
this.state = State.UNICODE3;
break;
case State.UNICODE3:
this.unicodeSequence += c;
this.state = State.UNICODE4;
break;
case State.UNICODE4:
this.unicodeSequence += c;
this.token += String.fromCharCode(parseInt(this.unicodeSequence, 16));
this.state = State.STRING;
break;
case State.PROPERTY_AFTER_NAME:

@@ -248,0 +270,0 @@ switch (c) {

export * from "./utils";
export * from "./flat-events";
export * from "./utils";
export * from "./flat-events";

@@ -5,3 +5,3 @@ {

"description": "Library for data transformations.",
"version": "0.0.7",
"version": "0.0.10",
"main": "dist/index.js",

@@ -8,0 +8,0 @@ "types": "dist/index.d.ts",

@@ -1,2 +0,2 @@

import { StringToCsvTransformStream, CsvEvent } from "../../src";
import { StringToCsvTransformStream, FlatEvent } from "../../src";
import { describe, it, expect } from "../../../test/src";

@@ -6,3 +6,3 @@

it("csv parser", async () => {
const result: CsvEvent[] = [];
const result: FlatEvent[] = [];
await new ReadableStream<string>({

@@ -16,3 +16,3 @@ start(controller) {

.pipeTo(
new WritableStream<CsvEvent>({
new WritableStream<FlatEvent>({
write(event) {

@@ -19,0 +19,0 @@ result.push(event);

@@ -27,2 +27,14 @@ import { JsonEventType, JsonWriter } from "../../src";

it("Unicode sequence", async () => {
await t(
'{"a":"\\u003c"}',
`
START_OBJECT
PROPERTY_NAME a
TEXT_VALUE <
END_OBJECT
`
);
});
it("Basic test", async () => {

@@ -29,0 +41,0 @@ await t(

@@ -13,3 +13,10 @@ enum CsvParserState {

/**
* Obsolete
*/
export type CsvEventType = "header" | "values";
/**
* Obsolete
*/
export type CsvEvent = { type: "header"; data: string[] } | { type: "values"; data: string[] };

@@ -16,0 +23,0 @@

@@ -1,13 +0,14 @@

import { CsvEvent, CsvParser } from "./csv-parser";
import { CsvParser } from "./csv-parser";
import { FlatEvent } from "../utils/flat-events";
export class StringToCsvTransformStream extends TransformStream<string, CsvEvent> {
export class StringToCsvTransformStream extends TransformStream<string, FlatEvent> {
private readonly parser: CsvParser;
private controller: TransformStreamDefaultController<CsvEvent> | undefined;
private controller: TransformStreamDefaultController<FlatEvent> | undefined;
constructor() {
super({
transform: async (s: string, controller: TransformStreamDefaultController<CsvEvent>) => {
transform: async (s: string, controller: TransformStreamDefaultController<FlatEvent>) => {
this.controller = controller;
await this.parser.parse(s);
},
flush: async (controller: TransformStreamDefaultController<CsvEvent>) => {
flush: async (controller: TransformStreamDefaultController<FlatEvent>) => {
this.controller = controller;

@@ -14,0 +15,0 @@ await this.parser.flush();

export * from "./csv/index";
export * from "./fixedLength/index";
export * from "./json/index";
export * from "./xml/index";
export * from "./utils/index";

@@ -12,2 +12,5 @@ import { JsonEvent, JsonEventType, E_START_OBJECT, E_END_OBJECT, E_START_ARRAY, E_END_ARRAY } from "./json-common";

UNICODE,
UNICODE2,
UNICODE3,
UNICODE4,
PROPERTY_AFTER_NAME,

@@ -28,2 +31,3 @@ PROPERTY_AFTER_VALUE,

private token = "";
private unicodeSequence = "";
private stateStack: Array<State> = [State.END];

@@ -253,2 +257,3 @@ private prevCharWasCR = false;

this.state = State.UNICODE;
this.unicodeSequence = "";
break;

@@ -262,2 +267,23 @@ default:

case State.UNICODE:
this.unicodeSequence += c;
this.state = State.UNICODE2;
break;
case State.UNICODE2:
this.unicodeSequence += c;
this.state = State.UNICODE3;
break;
case State.UNICODE3:
this.unicodeSequence += c;
this.state = State.UNICODE4;
break;
case State.UNICODE4:
this.unicodeSequence += c;
this.token += String.fromCharCode(parseInt(this.unicodeSequence, 16));
this.state = State.STRING;
break;
case State.PROPERTY_AFTER_NAME:

@@ -264,0 +290,0 @@ switch (c) {

export * from "./utils";
export * from "./flat-events";
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