Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/workerd/api/streams/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ class ReadableStreamSource {
};

struct PipeToOptions {
jsg::Optional<bool> preventClose;
jsg::Optional<bool> preventAbort;
jsg::Optional<bool> preventCancel;
jsg::Optional<bool> preventClose;
jsg::Optional<jsg::Ref<AbortSignal>> signal;

JSG_STRUCT(preventClose, preventAbort, preventCancel, signal);
JSG_STRUCT(preventAbort, preventCancel, preventClose, signal);
JSG_STRUCT_TS_OVERRIDE(StreamPipeOptions);

// An additional, internal only property that is used to indicate
Expand Down
4 changes: 2 additions & 2 deletions src/workerd/api/streams/readable.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ class ReadableStream: public jsg::Object {
returnFunction,
ValuesOptions);
struct Transform {
jsg::Ref<WritableStream> writable;
jsg::Ref<ReadableStream> readable;
jsg::Ref<WritableStream> writable;

JSG_STRUCT(writable, readable);
JSG_STRUCT(readable, writable);
JSG_STRUCT_TS_OVERRIDE(ReadableWritablePair<R = any, W = any> {
readable: ReadableStream<R>;
writable: WritableStream<W>;
Expand Down
38 changes: 6 additions & 32 deletions src/wpt/streams-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,11 @@ export default {
],
},
'piping/pipe-through.any.js': {
comment: 'To be investigated',
expectedFailures: [
"pipeThrough should brand-check readable and not allow 'null'",
"pipeThrough should brand-check readable and not allow 'undefined'",
"pipeThrough should brand-check readable and not allow '0'",
"pipeThrough should brand-check readable and not allow 'NaN'",
"pipeThrough should brand-check readable and not allow 'true'",
"pipeThrough should brand-check readable and not allow 'ReadableStream'",
"pipeThrough should brand-check readable and not allow '[object ReadableStream]'",
"pipeThrough should brand-check writable and not allow 'null'",
"pipeThrough should brand-check writable and not allow 'undefined'",
"pipeThrough should brand-check writable and not allow '0'",
"pipeThrough should brand-check writable and not allow 'NaN'",
"pipeThrough should brand-check writable and not allow 'true'",
"pipeThrough should brand-check writable and not allow 'WritableStream'",
"pipeThrough should brand-check writable and not allow '[object WritableStream]'",
'pipeThrough should rethrow errors from accessing readable or writable',
'pipeThrough() should throw if readable/writable getters throw',
],
comment: 'Windows has different property access order',
expectedFailures:
process.platform === 'win32'
? ['pipeThrough() should throw if readable/writable getters throw']
: [],
},
'piping/then-interception.any.js': {
comment:
Expand All @@ -113,19 +99,7 @@ export default {
'tee should not be observable',
],
},
'piping/throwing-options.any.js': {
comment: 'To be investigated',
expectedFailures: [
'pipeThrough should stop after getting preventAbort throws',
'pipeThrough should stop after getting preventCancel throws',
'pipeThrough should stop after getting preventClose throws',
'pipeThrough should stop after getting signal throws',
'pipeTo should stop after getting preventAbort throws',
'pipeTo should stop after getting preventCancel throws',
'pipeTo should stop after getting preventClose throws',
'pipeTo should stop after getting signal throws',
],
},
'piping/throwing-options.any.js': {},
'piping/transform-streams.any.js': {},

'queuing-strategies-size-function-per-global.window.js': {
Expand Down
6 changes: 3 additions & 3 deletions types/generated-snapshot/experimental/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2641,6 +2641,8 @@ interface Transformer<I = any, O = any> {
expectedLength?: number;
}
interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
/**
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
*
Expand All @@ -2659,8 +2661,6 @@ interface StreamPipeOptions {
* The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
*/
preventClose?: boolean;
preventAbort?: boolean;
preventCancel?: boolean;
signal?: AbortSignal;
}
type ReadableStreamReadResult<R = any> =
Expand Down Expand Up @@ -2953,13 +2953,13 @@ declare abstract class TransformStreamDefaultController<O = any> {
terminate(): void;
}
interface ReadableWritablePair<R = any, W = any> {
readable: ReadableStream<R>;
/**
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
*
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
*/
writable: WritableStream<W>;
readable: ReadableStream<R>;
}
/**
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
Expand Down
6 changes: 3 additions & 3 deletions types/generated-snapshot/experimental/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,8 @@ export interface Transformer<I = any, O = any> {
expectedLength?: number;
}
export interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
/**
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
*
Expand All @@ -2667,8 +2669,6 @@ export interface StreamPipeOptions {
* The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
*/
preventClose?: boolean;
preventAbort?: boolean;
preventCancel?: boolean;
signal?: AbortSignal;
}
export type ReadableStreamReadResult<R = any> =
Expand Down Expand Up @@ -2961,13 +2961,13 @@ export declare abstract class TransformStreamDefaultController<O = any> {
terminate(): void;
}
export interface ReadableWritablePair<R = any, W = any> {
readable: ReadableStream<R>;
/**
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
*
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
*/
writable: WritableStream<W>;
readable: ReadableStream<R>;
}
/**
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
Expand Down
6 changes: 3 additions & 3 deletions types/generated-snapshot/latest/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2545,6 +2545,8 @@ interface Transformer<I = any, O = any> {
expectedLength?: number;
}
interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
/**
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
*
Expand All @@ -2563,8 +2565,6 @@ interface StreamPipeOptions {
* The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
*/
preventClose?: boolean;
preventAbort?: boolean;
preventCancel?: boolean;
signal?: AbortSignal;
}
type ReadableStreamReadResult<R = any> =
Expand Down Expand Up @@ -2857,13 +2857,13 @@ declare abstract class TransformStreamDefaultController<O = any> {
terminate(): void;
}
interface ReadableWritablePair<R = any, W = any> {
readable: ReadableStream<R>;
/**
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
*
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
*/
writable: WritableStream<W>;
readable: ReadableStream<R>;
}
/**
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
Expand Down
6 changes: 3 additions & 3 deletions types/generated-snapshot/latest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2553,6 +2553,8 @@ export interface Transformer<I = any, O = any> {
expectedLength?: number;
}
export interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
/**
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
*
Expand All @@ -2571,8 +2573,6 @@ export interface StreamPipeOptions {
* The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
*/
preventClose?: boolean;
preventAbort?: boolean;
preventCancel?: boolean;
signal?: AbortSignal;
}
export type ReadableStreamReadResult<R = any> =
Expand Down Expand Up @@ -2865,13 +2865,13 @@ export declare abstract class TransformStreamDefaultController<O = any> {
terminate(): void;
}
export interface ReadableWritablePair<R = any, W = any> {
readable: ReadableStream<R>;
/**
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
*
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
*/
writable: WritableStream<W>;
readable: ReadableStream<R>;
}
/**
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
Expand Down