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

@effect/platform-node-shared

Package Overview
Dependencies
Maintainers
3
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/platform-node-shared - npm Package Compare versions

Comparing version 0.3.9 to 0.3.10

16

dist/cjs/internal/commandExecutor.js

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

var _Function = /*#__PURE__*/require("effect/Function");
var Inspectable = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Inspectable"));
var Layer = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Layer"));

@@ -60,2 +61,12 @@ var Option = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Option"));

};
const ProcessProto = {
[CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,
...Inspectable.BaseProto,
toJSON() {
return {
_id: "@effect/platform/CommandExecutor/Process",
pid: this.pid
};
}
};
const runCommand = fileSystem => command => {

@@ -121,4 +132,3 @@ switch (command._tag) {

}
return {
[CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,
return Object.assign(Object.create(ProcessProto), {
pid,

@@ -131,3 +141,3 @@ exitCode,

stdout
};
});
}), Effect.tap(process => Option.match(command.stdin, {

@@ -134,0 +144,0 @@ onNone: () => Effect.unit,

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

var _Function = /*#__PURE__*/require("effect/Function");
var Inspectable = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Inspectable"));
var Stream = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Stream"));

@@ -54,8 +55,17 @@ var _multipasta = /*#__PURE__*/require("multipasta");

}),
catch: error => Multipart.MultipartError("InternalError", error)
catch: error => new Multipart.MultipartError({
reason: "InternalError",
error
})
}));
exports.persisted = persisted;
const convertPart = part => part._tag === "Field" ? new FieldImpl(part.info, part.value) : new FileImpl(part);
class FieldImpl {
class PartBase extends Inspectable.Class {
[Multipart.TypeId];
constructor() {
super();
this[Multipart.TypeId] = Multipart.TypeId;
}
}
class FieldImpl extends PartBase {
_tag = "Field";

@@ -66,3 +76,3 @@ key;

constructor(info, value) {
this[Multipart.TypeId] = Multipart.TypeId;
super();
this.key = info.name;

@@ -72,7 +82,15 @@ this.contentType = info.contentType;

}
toJSON() {
return {
_id: "@effect/platform/Http/Multipart/Part",
_tag: "Field",
key: this.key,
value: this.value,
contentType: this.contentType
};
}
}
class FileImpl {
class FileImpl extends PartBase {
file;
_tag = "File";
[Multipart.TypeId];
key;

@@ -83,9 +101,21 @@ name;

constructor(file) {
super();
this.file = file;
this[Multipart.TypeId] = Multipart.TypeId;
this.key = file.info.name;
this.name = file.filename ?? file.info.name;
this.contentType = file.info.contentType;
this.content = NodeStream.fromReadable(() => file, error => Multipart.MultipartError("InternalError", error));
this.content = NodeStream.fromReadable(() => file, error => new Multipart.MultipartError({
reason: "InternalError",
error
}));
}
toJSON() {
return {
_id: "@effect/platform/Http/Multipart/Part",
_tag: "File",
key: this.key,
name: this.name,
contentType: this.contentType
};
}
}

@@ -102,15 +132,27 @@ /** @internal */

{
return Multipart.MultipartError("TooManyParts", error);
return new Multipart.MultipartError({
reason: "TooManyParts",
error
});
}
case "MaxFieldSize":
{
return Multipart.MultipartError("FieldTooLarge", error);
return new Multipart.MultipartError({
reason: "FieldTooLarge",
error
});
}
case "MaxPartSize":
{
return Multipart.MultipartError("FileTooLarge", error);
return new Multipart.MultipartError({
reason: "FileTooLarge",
error
});
}
case "MaxTotalSize":
{
return Multipart.MultipartError("BodyTooLarge", error);
return new Multipart.MultipartError({
reason: "BodyTooLarge",
error
});
}

@@ -121,3 +163,6 @@ }

{
return Multipart.MultipartError("Parse", error);
return new Multipart.MultipartError({
reason: "Parse",
error
});
}

@@ -124,0 +169,0 @@ }

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

const layerPosix = exports.layerPosix = /*#__PURE__*/Layer.succeed(_Path.Path, /*#__PURE__*/_Path.Path.of({
[_Path.TypeId]: _Path.TypeId,
...NodePath.posix,

@@ -63,2 +64,3 @@ fromFileUrl,

const layerWin32 = exports.layerWin32 = /*#__PURE__*/Layer.succeed(_Path.Path, /*#__PURE__*/_Path.Path.of({
[_Path.TypeId]: _Path.TypeId,
...NodePath.win32,

@@ -70,2 +72,3 @@ fromFileUrl,

const layer = exports.layer = /*#__PURE__*/Layer.succeed(_Path.Path, /*#__PURE__*/_Path.Path.of({
[_Path.TypeId]: _Path.TypeId,
...NodePath,

@@ -72,0 +75,0 @@ fromFileUrl,

@@ -7,2 +7,3 @@ import * as Command from "@effect/platform/Command";

import { constUndefined, pipe } from "effect/Function";
import * as Inspectable from "effect/Inspectable";
import * as Layer from "effect/Layer";

@@ -29,2 +30,12 @@ import * as Option from "effect/Option";

};
const ProcessProto = {
[CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,
...Inspectable.BaseProto,
toJSON() {
return {
_id: "@effect/platform/CommandExecutor/Process",
pid: this.pid
};
}
};
const runCommand = fileSystem => command => {

@@ -90,4 +101,3 @@ switch (command._tag) {

}
return {
[CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,
return Object.assign(Object.create(ProcessProto), {
pid,

@@ -100,3 +110,3 @@ exitCode,

stdout
};
});
}), Effect.tap(process => Option.match(command.stdin, {

@@ -103,0 +113,0 @@ onNone: () => Effect.unit,

import * as Multipart from "@effect/platform/Http/Multipart";
import * as Effect from "effect/Effect";
import { pipe } from "effect/Function";
import * as Inspectable from "effect/Inspectable";
import * as Stream from "effect/Stream";

@@ -21,7 +22,16 @@ import { decodeField } from "multipasta";

}),
catch: error => Multipart.MultipartError("InternalError", error)
catch: error => new Multipart.MultipartError({
reason: "InternalError",
error
})
}));
const convertPart = part => part._tag === "Field" ? new FieldImpl(part.info, part.value) : new FileImpl(part);
class FieldImpl {
class PartBase extends Inspectable.Class {
[Multipart.TypeId];
constructor() {
super();
this[Multipart.TypeId] = Multipart.TypeId;
}
}
class FieldImpl extends PartBase {
_tag = "Field";

@@ -32,3 +42,3 @@ key;

constructor(info, value) {
this[Multipart.TypeId] = Multipart.TypeId;
super();
this.key = info.name;

@@ -38,7 +48,15 @@ this.contentType = info.contentType;

}
toJSON() {
return {
_id: "@effect/platform/Http/Multipart/Part",
_tag: "Field",
key: this.key,
value: this.value,
contentType: this.contentType
};
}
}
class FileImpl {
class FileImpl extends PartBase {
file;
_tag = "File";
[Multipart.TypeId];
key;

@@ -49,9 +67,21 @@ name;

constructor(file) {
super();
this.file = file;
this[Multipart.TypeId] = Multipart.TypeId;
this.key = file.info.name;
this.name = file.filename ?? file.info.name;
this.contentType = file.info.contentType;
this.content = NodeStream.fromReadable(() => file, error => Multipart.MultipartError("InternalError", error));
this.content = NodeStream.fromReadable(() => file, error => new Multipart.MultipartError({
reason: "InternalError",
error
}));
}
toJSON() {
return {
_id: "@effect/platform/Http/Multipart/Part",
_tag: "File",
key: this.key,
name: this.name,
contentType: this.contentType
};
}
}

@@ -67,15 +97,27 @@ /** @internal */

{
return Multipart.MultipartError("TooManyParts", error);
return new Multipart.MultipartError({
reason: "TooManyParts",
error
});
}
case "MaxFieldSize":
{
return Multipart.MultipartError("FieldTooLarge", error);
return new Multipart.MultipartError({
reason: "FieldTooLarge",
error
});
}
case "MaxPartSize":
{
return Multipart.MultipartError("FileTooLarge", error);
return new Multipart.MultipartError({
reason: "FileTooLarge",
error
});
}
case "MaxTotalSize":
{
return Multipart.MultipartError("BodyTooLarge", error);
return new Multipart.MultipartError({
reason: "BodyTooLarge",
error
});
}

@@ -86,3 +128,6 @@ }

{
return Multipart.MultipartError("Parse", error);
return new Multipart.MultipartError({
reason: "Parse",
error
});
}

@@ -89,0 +134,0 @@ }

5

dist/esm/internal/path.js
import { BadArgument } from "@effect/platform/Error";
import { Path } from "@effect/platform/Path";
import { Path, TypeId } from "@effect/platform/Path";
import * as Effect from "effect/Effect";

@@ -25,2 +25,3 @@ import * as Layer from "effect/Layer";

export const layerPosix = /*#__PURE__*/Layer.succeed(Path, /*#__PURE__*/Path.of({
[TypeId]: TypeId,
...NodePath.posix,

@@ -32,2 +33,3 @@ fromFileUrl,

export const layerWin32 = /*#__PURE__*/Layer.succeed(Path, /*#__PURE__*/Path.of({
[TypeId]: TypeId,
...NodePath.win32,

@@ -39,2 +41,3 @@ fromFileUrl,

export const layer = /*#__PURE__*/Layer.succeed(Path, /*#__PURE__*/Path.of({
[TypeId]: TypeId,
...NodePath,

@@ -41,0 +44,0 @@ fromFileUrl,

{
"name": "@effect/platform-node-shared",
"version": "0.3.9",
"version": "0.3.10",
"description": "Unified interfaces for common platform-specific services",

@@ -17,4 +17,4 @@ "license": "MIT",

"peerDependencies": {
"effect": "^2.4.8",
"@effect/platform": "^0.48.9"
"@effect/platform": "^0.48.10",
"effect": "^2.4.9"
},

@@ -21,0 +21,0 @@ "exports": {

@@ -8,2 +8,3 @@ import * as Command from "@effect/platform/Command"

import { constUndefined, pipe } from "effect/Function"
import * as Inspectable from "effect/Inspectable"
import * as Layer from "effect/Layer"

@@ -42,2 +43,13 @@ import * as Option from "effect/Option"

const ProcessProto = {
[CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,
...Inspectable.BaseProto,
toJSON(this: CommandExecutor.Process) {
return {
_id: "@effect/platform/CommandExecutor/Process",
pid: this.pid
}
}
}
const runCommand =

@@ -151,4 +163,3 @@ (fileSystem: FileSystem.FileSystem) =>

}
return {
[CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,
return Object.assign(Object.create(ProcessProto), {
pid,

@@ -161,3 +172,3 @@ exitCode,

stdout
}
})
}),

@@ -164,0 +175,0 @@ Effect.tap((process) =>

import * as Multipart from "@effect/platform/Http/Multipart"
import * as Effect from "effect/Effect"
import { pipe } from "effect/Function"
import * as Inspectable from "effect/Inspectable"
import * as Stream from "effect/Stream"

@@ -41,3 +42,3 @@ import type { MultipartError, PartInfo } from "multipasta"

try: (signal) => NodeStreamP.pipeline((file as FileImpl).file, NFS.createWriteStream(path), { signal }),
catch: (error) => Multipart.MultipartError("InternalError", error)
catch: (error) => new Multipart.MultipartError({ reason: "InternalError", error })
}))

@@ -48,4 +49,11 @@

class FieldImpl implements Multipart.Field {
abstract class PartBase extends Inspectable.Class {
readonly [Multipart.TypeId]: Multipart.TypeId
constructor() {
super()
this[Multipart.TypeId] = Multipart.TypeId
}
}
class FieldImpl extends PartBase implements Multipart.Field {
readonly _tag = "Field"

@@ -60,3 +68,3 @@ readonly key: string

) {
this[Multipart.TypeId] = Multipart.TypeId
super()
this.key = info.name

@@ -66,7 +74,16 @@ this.contentType = info.contentType

}
toJSON(): unknown {
return {
_id: "@effect/platform/Http/Multipart/Part",
_tag: "Field",
key: this.key,
value: this.value,
contentType: this.contentType
}
}
}
class FileImpl implements Multipart.File {
class FileImpl extends PartBase implements Multipart.File {
readonly _tag = "File"
readonly [Multipart.TypeId]: Multipart.TypeId
readonly key: string

@@ -78,8 +95,21 @@ readonly name: string

constructor(readonly file: MP.FileStream) {
this[Multipart.TypeId] = Multipart.TypeId
super()
this.key = file.info.name
this.name = file.filename ?? file.info.name
this.contentType = file.info.contentType
this.content = NodeStream.fromReadable(() => file, (error) => Multipart.MultipartError("InternalError", error))
this.content = NodeStream.fromReadable(
() => file,
(error) => new Multipart.MultipartError({ reason: "InternalError", error })
)
}
toJSON(): unknown {
return {
_id: "@effect/platform/Http/Multipart/Part",
_tag: "File",
key: this.key,
name: this.name,
contentType: this.contentType
}
}
}

@@ -95,12 +125,12 @@

case "MaxParts": {
return Multipart.MultipartError("TooManyParts", error)
return new Multipart.MultipartError({ reason: "TooManyParts", error })
}
case "MaxFieldSize": {
return Multipart.MultipartError("FieldTooLarge", error)
return new Multipart.MultipartError({ reason: "FieldTooLarge", error })
}
case "MaxPartSize": {
return Multipart.MultipartError("FileTooLarge", error)
return new Multipart.MultipartError({ reason: "FileTooLarge", error })
}
case "MaxTotalSize": {
return Multipart.MultipartError("BodyTooLarge", error)
return new Multipart.MultipartError({ reason: "BodyTooLarge", error })
}

@@ -110,5 +140,5 @@ }

default: {
return Multipart.MultipartError("Parse", error)
return new Multipart.MultipartError({ reason: "Parse", error })
}
}
}
import { BadArgument } from "@effect/platform/Error"
import { Path } from "@effect/platform/Path"
import { Path, TypeId } from "@effect/platform/Path"
import * as Effect from "effect/Effect"

@@ -34,2 +34,3 @@ import * as Layer from "effect/Layer"

Path.of({
[TypeId]: TypeId,
...NodePath.posix,

@@ -45,2 +46,3 @@ fromFileUrl,

Path.of({
[TypeId]: TypeId,
...NodePath.win32,

@@ -56,2 +58,3 @@ fromFileUrl,

Path.of({
[TypeId]: TypeId,
...NodePath,

@@ -58,0 +61,0 @@ fromFileUrl,

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

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