@atproto-labs/pipe 0.1.1 → 0.2.0-next.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atproto-labs/pipe
2
2
 
3
+ ## 0.2.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`bb7491c`](https://github.com/bluesky-social/atproto/commit/bb7491c29e06181e1d2f8cf6eb454f9bb8ab961b) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Drop support for Node.js 18 and 20. Node.js 22 is now the minimum supported version. Docker images now use Node.js 24.
8
+
9
+ - [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`07ae5d4`](https://github.com/bluesky-social/atproto/commit/07ae5d4452df51e045e0239da7a04cf0bc154028) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Convert to pure ESM. All packages now ship `"type": "module"` with ES module output and Node16 module resolution.
10
+
11
+ Node.js 22's `require()` compatibility layer can still load these packages in CommonJS code.
12
+
13
+ - [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`042df15`](https://github.com/bluesky-social/atproto/commit/042df15087c0e62cd1e715fcbf58852fab875af9) Thanks [@devinivy](https://github.com/devinivy)! - Build with TypeScript 6.0. Emitted `.d.ts` files now use TypeScript 6's stricter `Uint8Array<ArrayBuffer>` typing in places where Web/Node APIs require buffer-backed (not shared-memory) byte arrays. Consumers compiling against these types on older TypeScript should see no runtime impact, but may need to widen or cast in spots that previously relied on `Uint8Array` defaulting to `<ArrayBufferLike>`.
14
+
15
+ Internal: tsconfig `moduleResolution: "node"` is silenced via `ignoreDeprecations: "6.0"` for now; the proper migration to `node16`/`bundler` resolution is deferred.
16
+
3
17
  ## 0.1.1
4
18
 
5
19
  ### Patch Changes
package/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  Dual MIT/Apache-2.0 License
2
2
 
3
- Copyright (c) 2022-2025 Bluesky Social PBC, and Contributors
3
+ Copyright (c) 2022-2026 Bluesky Social PBC, and Contributors
4
4
 
5
5
  Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
6
6
 
package/dist/index.js CHANGED
@@ -1,7 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pipeTwo = exports.pipe = void 0;
4
- var pipe_js_1 = require("./pipe.js");
5
- Object.defineProperty(exports, "pipe", { enumerable: true, get: function () { return pipe_js_1.pipe; } });
6
- Object.defineProperty(exports, "pipeTwo", { enumerable: true, get: function () { return pipe_js_1.pipeTwo; } });
1
+ export { pipe, pipeTwo } from './pipe.js';
7
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AAAhC,+FAAA,IAAI,OAAA;AAAE,kGAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA","sourcesContent":["export { pipe, pipeTwo } from './pipe.js'\nexport type * from './type.js'\n"]}
package/dist/pipe.js CHANGED
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pipe = pipe;
4
- exports.pipeTwo = pipeTwo;
5
1
  /**
6
2
  * This utility function allows to properly type a pipeline of transformers.
7
3
  *
@@ -18,10 +14,10 @@ exports.pipeTwo = pipeTwo;
18
14
  * )
19
15
  * ```
20
16
  */
21
- function pipe(...pipeline) {
17
+ export function pipe(...pipeline) {
22
18
  return pipeline.reduce(pipeTwo);
23
19
  }
24
- function pipeTwo(first, second) {
20
+ export function pipeTwo(first, second) {
25
21
  return async (...args) => second(await first(...args));
26
22
  }
27
23
  //# sourceMappingURL=pipe.js.map
package/dist/pipe.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pipe.js","sourceRoot":"","sources":["../src/pipe.ts"],"names":[],"mappings":";;AA+CA,oBAMC;AAED,0BAKC;AA7BD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,IAAI,CAClB,GAAG,QAAiD;IAEpD,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAEC,CAAA;AACjC,CAAC;AAED,SAAgB,OAAO,CACrB,KAAe,EACf,MAAyB;IAEzB,OAAO,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;AACxD,CAAC"}
1
+ {"version":3,"file":"pipe.js","sourceRoot":"","sources":["../src/pipe.ts"],"names":[],"mappings":"AA+BA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,IAAI,CAClB,GAAG,QAAiD;IAEpD,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAEC,CAAA;AACjC,CAAC;AAED,MAAM,UAAU,OAAO,CACrB,KAAe,EACf,MAAyB;IAEzB,OAAO,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;AACxD,CAAC","sourcesContent":["import { Fn, Transformer } from './type.js'\n\ntype PipelineArgs<T> = T extends [\n Fn<infer A extends readonly unknown[], any>,\n ...any[],\n]\n ? A\n : never\n\ntype PipelineOutput<T> = T extends [...any[], Fn<any, infer O>] ? O : never\n\ntype PipelineRecursive<\n F extends readonly Transformer<any>[],\n Acc extends any[],\n> = F extends readonly [Transformer<infer I, infer O>]\n ? [...Acc, Transformer<I, O>]\n : F extends readonly [Transformer<infer A, any>, ...infer Tail]\n ? Tail extends readonly [Transformer<infer B, any>, ...any[]]\n ? PipelineRecursive<Tail, [...Acc, Transformer<A, B>]>\n : never\n : never\n\ntype Pipeline<F extends readonly [Fn<any, any>, ...Transformer<any>[]]> =\n F extends readonly [Fn<infer A, infer O>]\n ? [Fn<A, O>]\n : F extends readonly [Fn<infer A, any>, ...infer Tail]\n ? Tail extends readonly [Transformer<infer B, any>, ...any[]]\n ? PipelineRecursive<Tail, [Fn<A, B>]>\n : never\n : never\n\n/**\n * This utility function allows to properly type a pipeline of transformers.\n *\n * @example\n * ```ts\n * // Will be typed as \"(input: string) => Promise<number>\"\n * const parse = pipe(\n * async (input: string) => JSON.parse(input),\n * async (input: unknown) => {\n * if (typeof input === 'number') return input\n * throw new TypeError('Invalid input')\n * },\n * (input: number) => input * 2,\n * )\n * ```\n */\nexport function pipe<T extends readonly [Fn<any, any>, ...Transformer<any>[]]>(\n ...pipeline: Pipeline<T> extends T ? T : Pipeline<T>\n) {\n return pipeline.reduce(pipeTwo) as (\n ...args: PipelineArgs<T>\n ) => Promise<PipelineOutput<T>>\n}\n\nexport function pipeTwo<A extends readonly unknown[], O, X = unknown>(\n first: Fn<A, X>,\n second: Transformer<X, O>,\n): (...args: A) => Promise<O> {\n return async (...args) => second(await first(...args))\n}\n"]}
package/dist/type.js CHANGED
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=type.js.map
package/dist/type.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Generic, potentially async, function. Parametrized for convenience reasons.\n */\nexport type Fn<A extends readonly unknown[], O> = (\n ...args: A\n) => O | PromiseLike<O>\n\n/**\n * Single input, single output, potentially async transformer function.\n */\nexport type Transformer<I, O = I> = (...args: [I]) => O | PromiseLike<O>\n"]}
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@atproto-labs/pipe",
3
- "version": "0.1.1",
3
+ "version": "0.2.0-next.0",
4
+ "engines": {
5
+ "node": ">=22"
6
+ },
4
7
  "license": "MIT",
5
8
  "description": "Library for combining multiple functions into a single function.",
6
9
  "keywords": [
@@ -13,9 +16,7 @@
13
16
  "url": "https://github.com/bluesky-social/atproto",
14
17
  "directory": "packages/internal/pipe"
15
18
  },
16
- "type": "commonjs",
17
- "main": "dist/index.js",
18
- "types": "dist/index.d.ts",
19
+ "type": "module",
19
20
  "exports": {
20
21
  ".": {
21
22
  "types": "./dist/index.d.ts",
@@ -23,7 +24,7 @@
23
24
  }
24
25
  },
25
26
  "devDependencies": {
26
- "typescript": "^5.6.3"
27
+ "typescript": "^6.0.3"
27
28
  },
28
29
  "scripts": {
29
30
  "build": "tsc --build tsconfig.json"
@@ -1 +1 @@
1
- {"root":["./src/index.ts","./src/pipe.ts","./src/type.ts"],"version":"5.8.2"}
1
+ {"root":["./src/index.ts","./src/pipe.ts","./src/type.ts"],"version":"6.0.3"}