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

@smithy/eventstream-serde-node

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/eventstream-serde-node - npm Package Compare versions

Comparing version 2.0.16 to 2.1.0

23

dist-cjs/EventStreamMarshaller.js

@@ -1,22 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventStreamMarshaller = void 0;
const eventstream_serde_universal_1 = require("@smithy/eventstream-serde-universal");
const stream_1 = require("stream");
const utils_1 = require("./utils");
class EventStreamMarshaller {
constructor({ utf8Encoder, utf8Decoder }) {
this.universalMarshaller = new eventstream_serde_universal_1.EventStreamMarshaller({
utf8Decoder,
utf8Encoder,
});
}
deserialize(body, deserializer) {
const bodyIterable = typeof body[Symbol.asyncIterator] === "function" ? body : (0, utils_1.readabletoIterable)(body);
return this.universalMarshaller.deserialize(bodyIterable, deserializer);
}
serialize(input, serializer) {
return stream_1.Readable.from(this.universalMarshaller.serialize(input, serializer));
}
}
exports.EventStreamMarshaller = EventStreamMarshaller;
module.exports = require("./index.js");

91

dist-cjs/index.js

@@ -1,5 +0,86 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./EventStreamMarshaller"), exports);
tslib_1.__exportStar(require("./provider"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
EventStreamMarshaller: () => EventStreamMarshaller,
eventStreamSerdeProvider: () => eventStreamSerdeProvider
});
module.exports = __toCommonJS(src_exports);
// src/EventStreamMarshaller.ts
var import_eventstream_serde_universal = require("@smithy/eventstream-serde-universal");
var import_stream = require("stream");
// src/utils.ts
async function* readabletoIterable(readStream) {
let streamEnded = false;
let generationEnded = false;
const records = new Array();
readStream.on("error", (err) => {
if (!streamEnded) {
streamEnded = true;
}
if (err) {
throw err;
}
});
readStream.on("data", (data) => {
records.push(data);
});
readStream.on("end", () => {
streamEnded = true;
});
while (!generationEnded) {
const value = await new Promise((resolve) => setTimeout(() => resolve(records.shift()), 0));
if (value) {
yield value;
}
generationEnded = streamEnded && records.length === 0;
}
}
__name(readabletoIterable, "readabletoIterable");
// src/EventStreamMarshaller.ts
var _EventStreamMarshaller = class _EventStreamMarshaller {
constructor({ utf8Encoder, utf8Decoder }) {
this.universalMarshaller = new import_eventstream_serde_universal.EventStreamMarshaller({
utf8Decoder,
utf8Encoder
});
}
deserialize(body, deserializer) {
const bodyIterable = typeof body[Symbol.asyncIterator] === "function" ? body : readabletoIterable(body);
return this.universalMarshaller.deserialize(bodyIterable, deserializer);
}
serialize(input, serializer) {
return import_stream.Readable.from(this.universalMarshaller.serialize(input, serializer));
}
};
__name(_EventStreamMarshaller, "EventStreamMarshaller");
var EventStreamMarshaller = _EventStreamMarshaller;
// src/provider.ts
var eventStreamSerdeProvider = /* @__PURE__ */ __name((options) => new EventStreamMarshaller(options), "eventStreamSerdeProvider");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
EventStreamMarshaller,
eventStreamSerdeProvider
});

@@ -1,6 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.eventStreamSerdeProvider = void 0;
const EventStreamMarshaller_1 = require("./EventStreamMarshaller");
const eventStreamSerdeProvider = (options) => new EventStreamMarshaller_1.EventStreamMarshaller(options);
exports.eventStreamSerdeProvider = eventStreamSerdeProvider;
module.exports = require("./index.js");

@@ -1,30 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readabletoIterable = void 0;
async function* readabletoIterable(readStream) {
let streamEnded = false;
let generationEnded = false;
const records = new Array();
readStream.on("error", (err) => {
if (!streamEnded) {
streamEnded = true;
}
if (err) {
throw err;
}
});
readStream.on("data", (data) => {
records.push(data);
});
readStream.on("end", () => {
streamEnded = true;
});
while (!generationEnded) {
const value = await new Promise((resolve) => setTimeout(() => resolve(records.shift()), 0));
if (value) {
yield value;
}
generationEnded = streamEnded && records.length === 0;
}
}
exports.readabletoIterable = readabletoIterable;
module.exports = require("./index.js");
{
"name": "@smithy/eventstream-serde-node",
"version": "2.0.16",
"version": "2.1.0",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
"build:cjs": "yarn g:tsc -p tsconfig.cjs.json",
"build:cjs": "node ../../scripts/inline eventstream-serde-node",
"build:es": "yarn g:tsc -p tsconfig.es.json",

@@ -25,4 +25,4 @@ "build:types": "yarn g:tsc -p tsconfig.types.json",

"dependencies": {
"@smithy/eventstream-serde-universal": "^2.0.16",
"@smithy/types": "^2.8.0",
"@smithy/eventstream-serde-universal": "^2.1.0",
"@smithy/types": "^2.9.0",
"tslib": "^2.5.0"

@@ -29,0 +29,0 @@ },

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