@serwist/streams 9.0.0-preview.1 → 9.0.0-preview.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -111,7 +111,7 @@ function isSupported() {
111
111
  return canConstructReadableStream();
112
112
  }
113
113
 
114
- function strategy(sourceFunctions, headersInit) {
114
+ const strategy = (sourceFunctions, headersInit)=>{
115
115
  return async ({ event, request, url, params })=>{
116
116
  const sourcePromises = sourceFunctions.map((fn)=>{
117
117
  return Promise.resolve(fn({
@@ -144,6 +144,6 @@ function strategy(sourceFunctions, headersInit) {
144
144
  headers
145
145
  });
146
146
  };
147
- }
147
+ };
148
148
 
149
149
  export { concatenate, concatenateToResponse, isSupported, strategy };
@@ -15,6 +15,5 @@ export interface StreamsHandlerCallback {
15
15
  * @param headersInit If there's no `Content-Type` specified, `'text/html'` will be used by default.
16
16
  * @returns
17
17
  */
18
- declare function strategy(sourceFunctions: StreamsHandlerCallback[], headersInit: HeadersInit): RouteHandlerCallback;
19
- export { strategy };
18
+ export declare const strategy: (sourceFunctions: StreamsHandlerCallback[], headersInit: HeadersInit) => RouteHandlerCallback;
20
19
  //# sourceMappingURL=strategy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAGvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,MAAM,WAAW,sBAAsB;IACrC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,2BAA2B,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;CACtG;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,QAAQ,CAAC,eAAe,EAAE,sBAAsB,EAAE,EAAE,WAAW,EAAE,WAAW,GAAG,oBAAoB,CAwC3G;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAGvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,MAAM,WAAW,sBAAsB;IACrC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,2BAA2B,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;CACtG;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,oBAAqB,sBAAsB,EAAE,eAAe,WAAW,KAAG,oBAwC9F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/streams",
3
- "version": "9.0.0-preview.1",
3
+ "version": "9.0.0-preview.10",
4
4
  "type": "module",
5
5
  "description": "A library that makes it easier to work with Streams in the browser.",
6
6
  "files": [
@@ -30,13 +30,13 @@
30
30
  "./package.json": "./package.json"
31
31
  },
32
32
  "dependencies": {
33
- "@serwist/core": "9.0.0-preview.1",
34
- "@serwist/routing": "9.0.0-preview.1"
33
+ "@serwist/core": "9.0.0-preview.10",
34
+ "@serwist/routing": "9.0.0-preview.10"
35
35
  },
36
36
  "devDependencies": {
37
37
  "rollup": "4.9.6",
38
- "typescript": "5.4.0-dev.20240203",
39
- "@serwist/constants": "9.0.0-preview.1"
38
+ "typescript": "5.4.0-dev.20240206",
39
+ "@serwist/constants": "9.0.0-preview.10"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "typescript": ">=5.0.0"
package/src/strategy.ts CHANGED
@@ -30,7 +30,7 @@ export interface StreamsHandlerCallback {
30
30
  * @param headersInit If there's no `Content-Type` specified, `'text/html'` will be used by default.
31
31
  * @returns
32
32
  */
33
- function strategy(sourceFunctions: StreamsHandlerCallback[], headersInit: HeadersInit): RouteHandlerCallback {
33
+ export const strategy = (sourceFunctions: StreamsHandlerCallback[], headersInit: HeadersInit): RouteHandlerCallback => {
34
34
  return async ({ event, request, url, params }: RouteHandlerCallbackOptions) => {
35
35
  const sourcePromises = sourceFunctions.map((fn) => {
36
36
  // Ensure the return value of the function is always a promise.
@@ -70,6 +70,4 @@ function strategy(sourceFunctions: StreamsHandlerCallback[], headersInit: Header
70
70
  // So is constructing a new Blob from multiple source Blobs or strings.
71
71
  return new Response(new Blob(blobParts), { headers });
72
72
  };
73
- }
74
-
75
- export { strategy };
73
+ };