@xstd/async-function 1.2.0 → 1.3.1

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.
Files changed (35) hide show
  1. package/CONTRIBUTING.md +30 -31
  2. package/README.md +5 -5
  3. package/package.json +3 -2
  4. package/src/async-function.d.ts +8 -8
  5. package/src/async-function.js +6 -7
  6. package/src/async-function.js.map +1 -1
  7. package/src/index.d.ts +1 -4
  8. package/src/index.js +1 -4
  9. package/src/index.js.map +1 -1
  10. package/src/types/async-function-like.d.ts +6 -0
  11. package/src/types/methods/share-concurrent-calls/share-concurrent-calls-options.d.ts +22 -0
  12. package/src/types/methods/share-concurrent-calls/share-concurrent-calls-options.js +2 -0
  13. package/src/types/methods/share-concurrent-calls/share-concurrent-calls-options.js.map +1 -0
  14. package/src/types/methods/then/async-function.then.on-fulfilled-function.d.ts +10 -0
  15. package/src/types/methods/then/async-function.then.on-rejected-function.d.ts +9 -0
  16. package/src/types/methods/then/default.async-function.then.on-fulfilled-function.private.d.ts +3 -0
  17. package/src/types/methods/then/default.async-function.then.on-fulfilled-function.private.js +3 -0
  18. package/src/types/methods/then/default.async-function.then.on-fulfilled-function.private.js.map +1 -1
  19. package/src/types/methods/then/default.async-function.then.on-rejected-function.private.d.ts +3 -0
  20. package/src/types/methods/then/default.async-function.then.on-rejected-function.private.js +3 -0
  21. package/src/types/methods/then/default.async-function.then.on-rejected-function.private.js.map +1 -1
  22. package/src/types/methods/transform/transform-async-function-function.d.ts +9 -0
  23. package/src/types/static-methods/from-send-and-receive/async-function-from-send-and-receive-options.d.ts +12 -0
  24. package/src/types/methods/map-arguments/built-in/map-one-argument.d.ts +0 -16
  25. package/src/types/methods/map-arguments/built-in/map-one-argument.js +0 -18
  26. package/src/types/methods/map-arguments/built-in/map-one-argument.js.map +0 -1
  27. package/src/types/methods/map-arguments/built-in/set-arguments.d.ts +0 -14
  28. package/src/types/methods/map-arguments/built-in/set-arguments.js +0 -16
  29. package/src/types/methods/map-arguments/built-in/set-arguments.js.map +0 -1
  30. package/src/types/methods/map-arguments/map-function-arguments.d.ts +0 -3
  31. package/src/types/methods/map-arguments/map-function-arguments.js +0 -2
  32. package/src/types/methods/map-arguments/map-function-arguments.js.map +0 -1
  33. package/src/types/methods/share-concurent-calls/share-concurent-calls-options.d.ts +0 -6
  34. package/src/types/methods/share-concurent-calls/share-concurent-calls-options.js +0 -2
  35. package/src/types/methods/share-concurent-calls/share-concurent-calls-options.js.map +0 -1
package/CONTRIBUTING.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Contributing
2
2
 
3
- This projet is open to everyone. Feel free to test the library, share it, improve it, and create merge requests.
3
+ This project is open to everyone. Feel free to test the library, share it, improve it, and create pull requests.
4
4
 
5
5
  ## Getting started
6
6
 
@@ -38,40 +38,34 @@ yarn install
38
38
  ### Code
39
39
 
40
40
  - The source code is located in the `src` directory.
41
- - The projet uses [prettier](https://prettier.io/) to format the code. You'll want to enable and configure it in your IDE.
41
+ - The project uses [prettier](https://prettier.io/) to format the code. You'll want to enable and configure it in your IDE.
42
42
  - The tests run with [vitest](https://vitest.dev)
43
43
 
44
44
  ### Commands
45
45
 
46
46
  - `fb:build`: builds the library.
47
- - converts the typescript files into javascript files, copies the scss files, and assembles all the assets to create a package ready to be published.
47
+ - converts the TypeScript files into JavaScript files, copies the SCSS files, and assembles all the assets to create a package ready to be published.
48
48
  - some files are handled differently:
49
- - `*.protected.{ts,scss}` or `**/*.protected/**`: these files are exported under `package-name/protected`
50
- - this is indented to expose parts of the code that should be restricted to advanced users only, or shared to other libraries requiring _internal_ control.
49
+ - `*.protected.{ts,scss}` or `**/*.protected/**`: these files are exported under `package-name/protected`.
50
+ - this is intended to expose parts of the code that should be restricted to advanced users only, or shared with other libraries requiring _internal_ control.
51
51
  - `*.private.{ts,scss}` or `/*.private/**`: these files are **not** exported.
52
- - this is indented to consume parts of the code internally, and not expose them publicly.
52
+ - this is intended to consume parts of the code internally, without exposing them publicly.
53
53
  - `fb:format`: formats the code using `prettier`.
54
- - `fb:test`: runs the tests using `vitest`.
55
- - `fb:test:coverage`: runs the tests with coverage.
56
- - by default, 100% code coverage is required, to enforce good quality.
57
- - `fb:bench`: runs the bench tests.
58
- - `fb:typedoc`: generates the documentation.
59
- - if the library exposes publicly only a few and/or simple parts, the documentation may be defined in the `README.md` instead.
60
54
 
61
55
  ### To create a PR
62
56
 
63
- 1. fork the repository
64
- 1. add the feature/fix by modifying the code in the `src/` directory
65
- 1. add/write some tests until 100% code coverage is reached (run the tests with `yarn fb:test:coverage`)
66
- 1. format the code, using the command `yarn fb:format`
67
- 1. commit and push your work following the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) convention
68
- 1. create a PR from your repository to the upstream repository, explaining clearly what was added/fixed.
57
+ 1. Fork the repository
58
+ 1. Add the feature or fix by modifying the code in the `src/` directory
59
+ 1. Add/write some tests with good code coverage (run them with `yarn fb:test:coverage`)
60
+ 1. Format the code using the command `yarn fb:format`
61
+ 1. Commit and push your work following the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) convention
62
+ 1. Create a PR from your fork to the upstream repository, clearly explaining what was added or fixed.
69
63
 
70
64
  ## Release Workflow
71
65
 
72
- > The `release.yml` workflow runs on `pull_request` and `push` events on the `main` and `develop` branches.
73
- > It invokes the `yarn fb:ci:release` used to build and publish the package.
74
- > Note that the `publish` step runs only if the equivalent stable version (`x.y.z`) does not already exist on npm
66
+ > The `release.yml` workflow runs on `pull_request` and `push` events for the `main` and `develop` branches.
67
+ > It invokes `yarn fb:ci:release`, which builds and publishes the packages.
68
+ > Note that the `publish` step runs only if the equivalent stable version (`x.y.z`) does not already exist on npm.
75
69
 
76
70
  ### 1. Pull Request to `main` or `develop`
77
71
 
@@ -81,6 +75,10 @@ yarn install
81
75
 
82
76
  > Use the `dev` versions only if required.
83
77
 
78
+ > [!NOTE]
79
+ > The PR is published only if it carries the `dev` label — add it to the PR to get a `dev` release; otherwise the release is skipped.
80
+ > Pull requests coming from forks always run in dry-run mode: nothing is published.
81
+
84
82
  ### 2. Push to `develop`
85
83
 
86
84
  - Impacted packages are published as: `x.y.z-rc.<timestamp>`
@@ -96,14 +94,14 @@ yarn install
96
94
  ```mermaid
97
95
  flowchart LR
98
96
  EVENT("WORKFLOW TRIGGER")
99
- HAS_DEV_TAG{"has &quotdev&quot tag ?"}
97
+ HAS_DEV_TAG{"has &quot;dev&quot; label?"}
100
98
  SKIP_BUILD(["skip build"])
101
- BUILD_DEV_PACKAGES["build &quotdev&quot package"]
102
- PUBLISH_DEV_PACKAGES["publish &quotdev&quot package"]
103
- BUILD_RC_PACKAGES["build &quotrc&quot package"]
104
- PUBLISH_RC_PACKAGES["publish &quotrc&quot package"]
105
- BUILD_PROD_PACKAGES["build &quotprod&quot package"]
106
- PUBLISH_PROD_PACKAGES["publish &quotprod&quot package"]
99
+ BUILD_DEV_PACKAGES["build &quot;dev&quot; packages"]
100
+ PUBLISH_DEV_PACKAGES["publish &quot;dev&quot; packages"]
101
+ BUILD_RC_PACKAGES["build &quot;rc&quot; packages"]
102
+ PUBLISH_RC_PACKAGES["publish &quot;rc&quot; packages"]
103
+ BUILD_PROD_PACKAGES["build &quot;prod&quot; packages"]
104
+ PUBLISH_PROD_PACKAGES["publish &quot;prod&quot; packages"]
107
105
  TARGET_BRANCH{"branch"}
108
106
 
109
107
  EVENT -- "pull_request" --> HAS_DEV_TAG
@@ -122,6 +120,7 @@ flowchart LR
122
120
 
123
121
  ## Important Rules
124
122
 
125
- - if an equivalent **stable** version already exists on npm: the release is skipped
126
- - the `package.json` file in the repo must keep stable versions (`x.y.z`)
127
- - `-dev` / `-rc` suffixes are generated in CI
123
+ - If an equivalent **stable** version already exists on npm, the release fails — bump the `package.json#version` before releasing (this also blocks `dev` / `rc` releases of a stable version that was already published).
124
+ - The `package.json` version in the repo must always be a stable version (`x.y.z`).
125
+ - The `-dev` / `-rc` suffixes are generated in CI.
126
+ - The npm publish authenticates with [GitHub Actions OIDC](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-oidc): no `NPM_TOKEN` secret is required (the `release.yml` workflow requests the `id-token: write` permission).
package/README.md CHANGED
@@ -42,7 +42,7 @@ const fetchUser = fetchJson
42
42
  });
43
43
 
44
44
  // deduplicate concurrent calls for the same key:
45
- const getUser = fetchUser.shareConcurentCalls({ keyGenerator: ([id]) => id as string });
45
+ const getUser = fetchUser.shareConcurrentCalls({ keyGenerator: ([id]) => id as string });
46
46
 
47
47
  const controller = new AbortController();
48
48
  const user = await getUser.call(controller.signal, '42');
@@ -175,7 +175,7 @@ Applies a transformation function to the current instance and returns the result
175
175
 
176
176
  ```ts
177
177
  mapArguments<GNewArguments extends readonly unknown[]>(
178
- mapFnc: MapFunctionArguments<GArguments, GNewArguments>,
178
+ mapFnc: MapFunctionArguments<GNewArguments, GArguments>,
179
179
  ): AsyncFunction<GNewArguments, GReturn>
180
180
  ```
181
181
 
@@ -253,10 +253,10 @@ const safe = fnc.catch((error) => null);
253
253
  const result = await safe.call(signal); // Response, or null if the request failed
254
254
  ```
255
255
 
256
- ##### `shareConcurentCalls` (experimental)
256
+ ##### `shareConcurrentCalls` (experimental)
257
257
 
258
258
  ```ts
259
- shareConcurentCalls(options: ShareConcurentCallsOptions<GArguments>): AsyncFunction<GArguments, GReturn>
259
+ shareConcurrentCalls(options: ShareConcurrentCallsOptions<GArguments>): AsyncFunction<GArguments, GReturn>
260
260
  ```
261
261
 
262
262
  Returns a new async function that deduplicates concurrent calls sharing the same key: while a call is in-flight, subsequent calls with the same key await the same underlying promise instead of triggering a new call.
@@ -270,7 +270,7 @@ The first call starts the underlying call with its own `AbortController`. Each c
270
270
  ```ts
271
271
  const loadUser = new AsyncFunction(async (signal, id: string) =>
272
272
  fetchUser(id, { signal }),
273
- ).shareConcurentCalls({ keyGenerator: ([id]) => id });
273
+ ).shareConcurrentCalls({ keyGenerator: ([id]) => id });
274
274
 
275
275
  // 'fetchUser' is called once, both calls await the same result:
276
276
  const [a, b] = await Promise.all([loadUser.call(signal, 'a'), loadUser.call(signal, 'a')]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xstd/async-function",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "description": "Universal API around async functions",
6
6
  "keywords": [],
@@ -19,6 +19,7 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@xstd/abortable": "^1.2.3"
22
+ "@xstd/abortable": "^1.2.3",
23
+ "@xstd/map-function": "^1.3.0"
23
24
  }
24
25
  }
@@ -1,6 +1,6 @@
1
+ import type { MapFunctionArguments } from '@xstd/map-function';
1
2
  import { type AsyncFunctionLike } from './types/async-function-like.ts';
2
- import { type MapFunctionArguments } from './types/methods/map-arguments/map-function-arguments.ts';
3
- import { type ShareConcurentCallsOptions } from './types/methods/share-concurent-calls/share-concurent-calls-options.js';
3
+ import { type ShareConcurrentCallsOptions } from './types/methods/share-concurrent-calls/share-concurrent-calls-options.ts';
4
4
  import { type AsyncFunctionThenOnFulfilledFunction } from './types/methods/then/async-function.then.on-fulfilled-function.ts';
5
5
  import { type AsyncFunctionThenOnRejectedFunction } from './types/methods/then/async-function.then.on-rejected-function.ts';
6
6
  import { type TransformAsyncFunctionFunction } from './types/methods/transform/transform-async-function-function.ts';
@@ -89,10 +89,10 @@ export declare class AsyncFunction<GArguments extends readonly unknown[], GRetur
89
89
  * Maps and transforms the arguments of the current async function using the provided mapping function.
90
90
  *
91
91
  * @template GNewArguments The tuple type of the new arguments to be provided to the async function.
92
- * @param {MapFunctionArguments<GArguments, GNewArguments>} mapFnc A function that receives the arguments for the new async function and transforms them into arguments for the current async function.
92
+ * @param {MapFunctionArguments<GNewArguments, GArguments>} mapFnc A function that receives the arguments for the new async function and transforms them into arguments for the current async function.
93
93
  * @return {AsyncFunction<GNewArguments, GReturn>} A new async function instance that uses the specified mapping function to map its arguments.
94
94
  */
95
- mapArguments<GNewArguments extends readonly unknown[]>(mapFnc: MapFunctionArguments<GArguments, GNewArguments>): AsyncFunction<GNewArguments, GReturn>;
95
+ mapArguments<GNewArguments extends readonly unknown[]>(mapFnc: MapFunctionArguments<GNewArguments, GArguments>): AsyncFunction<GNewArguments, GReturn>;
96
96
  /**
97
97
  * Creates a new async function with the same behaviour as this one (neither a fulfilment nor a rejection handler provided).
98
98
  *
@@ -137,18 +137,18 @@ export declare class AsyncFunction<GArguments extends readonly unknown[], GRetur
137
137
  * The first call starts the underlying call with its own `AbortController`. Each caller may abort its own wait without affecting the shared call. When the last consumer settles, the shared controller is aborted, the entry is removed, and a subsequent call starts a new one.
138
138
  *
139
139
  * @experimental
140
- * @param {ShareConcurentCallsOptions<GArguments>} options Configuration object.
141
- * @param {ShareConcurentCallsKeyGenerator<GArguments>} options.keyGenerator A function that generates a cache key from the call's arguments. Calls producing the same key share their result.
140
+ * @param {ShareConcurrentCallsOptions<GArguments>} options Configuration object.
141
+ * @param {ShareConcurrentCallsKeyGenerator<GArguments>} options.keyGenerator A function that generates a cache key from the call's arguments. Calls producing the same key share their result.
142
142
  * @returns {AsyncFunction<GArguments, GReturn>} A new async function sharing concurrent calls with identical keys.
143
143
  *
144
144
  * @example
145
145
  * ```ts
146
146
  * const loadUser = new AsyncFunction(async (signal, id: string) => fetchUser(id, { signal }))
147
- * .shareConcurentCalls({ keyGenerator: ([id]) => id });
147
+ * .shareConcurrentCalls({ keyGenerator: ([id]) => id });
148
148
  *
149
149
  * // 'fetchUser' is called once, both calls await the same result:
150
150
  * const [a, b] = await Promise.all([loadUser.call(signal, 'a'), loadUser.call(signal, 'a')]);
151
151
  * ```
152
152
  */
153
- shareConcurentCalls({ keyGenerator, }: ShareConcurentCallsOptions<GArguments>): AsyncFunction<GArguments, GReturn>;
153
+ shareConcurrentCalls({ keyGenerator, }: ShareConcurrentCallsOptions<GArguments>): AsyncFunction<GArguments, GReturn>;
154
154
  }
@@ -1,8 +1,7 @@
1
1
  import { abortify } from '@xstd/abortable';
2
2
  import {} from './types/async-function-like.js';
3
3
  import {} from './types/call-async-function.js';
4
- import {} from './types/methods/map-arguments/map-function-arguments.js';
5
- import {} from './types/methods/share-concurent-calls/share-concurent-calls-options.js';
4
+ import {} from './types/methods/share-concurrent-calls/share-concurrent-calls-options.js';
6
5
  import {} from './types/methods/then/async-function.then.on-fulfilled-function.js';
7
6
  import {} from './types/methods/then/async-function.then.on-rejected-function.js';
8
7
  import { DEFAULT_ASYNC_FUNCTION_THEN_ON_FULFILLED_FUNCTION } from './types/methods/then/default.async-function.then.on-fulfilled-function.private.js';
@@ -122,7 +121,7 @@ export class AsyncFunction {
122
121
  * Maps and transforms the arguments of the current async function using the provided mapping function.
123
122
  *
124
123
  * @template GNewArguments The tuple type of the new arguments to be provided to the async function.
125
- * @param {MapFunctionArguments<GArguments, GNewArguments>} mapFnc A function that receives the arguments for the new async function and transforms them into arguments for the current async function.
124
+ * @param {MapFunctionArguments<GNewArguments, GArguments>} mapFnc A function that receives the arguments for the new async function and transforms them into arguments for the current async function.
126
125
  * @return {AsyncFunction<GNewArguments, GReturn>} A new async function instance that uses the specified mapping function to map its arguments.
127
126
  */
128
127
  mapArguments(mapFnc) {
@@ -184,20 +183,20 @@ export class AsyncFunction {
184
183
  * The first call starts the underlying call with its own `AbortController`. Each caller may abort its own wait without affecting the shared call. When the last consumer settles, the shared controller is aborted, the entry is removed, and a subsequent call starts a new one.
185
184
  *
186
185
  * @experimental
187
- * @param {ShareConcurentCallsOptions<GArguments>} options Configuration object.
188
- * @param {ShareConcurentCallsKeyGenerator<GArguments>} options.keyGenerator A function that generates a cache key from the call's arguments. Calls producing the same key share their result.
186
+ * @param {ShareConcurrentCallsOptions<GArguments>} options Configuration object.
187
+ * @param {ShareConcurrentCallsKeyGenerator<GArguments>} options.keyGenerator A function that generates a cache key from the call's arguments. Calls producing the same key share their result.
189
188
  * @returns {AsyncFunction<GArguments, GReturn>} A new async function sharing concurrent calls with identical keys.
190
189
  *
191
190
  * @example
192
191
  * ```ts
193
192
  * const loadUser = new AsyncFunction(async (signal, id: string) => fetchUser(id, { signal }))
194
- * .shareConcurentCalls({ keyGenerator: ([id]) => id });
193
+ * .shareConcurrentCalls({ keyGenerator: ([id]) => id });
195
194
  *
196
195
  * // 'fetchUser' is called once, both calls await the same result:
197
196
  * const [a, b] = await Promise.all([loadUser.call(signal, 'a'), loadUser.call(signal, 'a')]);
198
197
  * ```
199
198
  */
200
- shareConcurentCalls({ keyGenerator, }) {
199
+ shareConcurrentCalls({ keyGenerator, }) {
201
200
  const map = new Map();
202
201
  return new AsyncFunction(async (signal, ...args) => {
203
202
  signal.throwIfAborted();
@@ -1 +1 @@
1
- {"version":3,"file":"async-function.js","sourceRoot":"","sources":["../../src/async-function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAA0B,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAA0B,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAA6B,MAAM,yDAAyD,CAAC;AACpG,OAAO,EAAmC,MAAM,wEAAwE,CAAC;AACzH,OAAO,EAA6C,MAAM,mEAAmE,CAAC;AAC9H,OAAO,EAA4C,MAAM,kEAAkE,CAAC;AAC5H,OAAO,EAAE,iDAAiD,EAAE,MAAM,mFAAmF,CAAC;AACtJ,OAAO,EAAE,gDAAgD,EAAE,MAAM,kFAAkF,CAAC;AACpJ,OAAO,EAAuC,MAAM,gEAAgE,CAAC;AACrH,OAAO,EAA+C,MAAM,8FAA8F,CAAC;AAE3J;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IACxB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CACP,KAA6C;QAE7C,OAAO,KAAK,YAAY,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,aAAa,CAAsB,KAAK,CAAC,CAAC;IAChG,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,MAAM,CAAC,k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  export * from './types/methods/transform/transform-async-function-function.ts';
6
6
  export * from './types/methods/then/async-function.then.on-fulfilled-function.ts';
7
7
  export * from './types/methods/then/async-function.then.on-rejected-function.ts';
8
- export * from './types/methods/share-concurent-calls/share-concurent-calls-options.ts';
9
- export * from './types/methods/map-arguments/map-function-arguments.ts';
10
- export * from './types/methods/map-arguments/built-in/map-one-argument.ts';
11
- export * from './types/methods/map-arguments/built-in/set-arguments.ts';
8
+ export * from './types/methods/share-concurrent-calls/share-concurrent-calls-options.ts';
package/src/index.js CHANGED
@@ -5,8 +5,5 @@ export * from './types/static-methods/from-send-and-receive/async-function-from-
5
5
  export * from './types/methods/transform/transform-async-function-function.js';
6
6
  export * from './types/methods/then/async-function.then.on-fulfilled-function.js';
7
7
  export * from './types/methods/then/async-function.then.on-rejected-function.js';
8
- export * from './types/methods/share-concurent-calls/share-concurent-calls-options.js';
9
- export * from './types/methods/map-arguments/map-function-arguments.js';
10
- export * from './types/methods/map-arguments/built-in/map-one-argument.js';
11
- export * from './types/methods/map-arguments/built-in/set-arguments.js';
8
+ export * from './types/methods/share-concurrent-calls/share-concurrent-calls-options.js';
12
9
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8FAA8F,CAAC;AAC7G,cAAc,gEAAgE,CAAC;AAC/E,cAAc,mEAAmE,CAAC;AAClF,cAAc,kEAAkE,CAAC;AACjF,cAAc,wEAAwE,CAAC;AACvF,cAAc,yDAAyD,CAAC;AACxE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yDAAyD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8FAA8F,CAAC;AAC7G,cAAc,gEAAgE,CAAC;AAC/E,cAAc,mEAAmE,CAAC;AAClF,cAAc,kEAAkE,CAAC;AACjF,cAAc,0EAA0E,CAAC"}
@@ -1,3 +1,9 @@
1
1
  import { type AsyncFunction } from '../async-function.ts';
2
2
  import { type CallAsyncFunction } from './call-async-function.ts';
3
+ /**
4
+ * Represents anything that can be wrapped into an `AsyncFunction`: either an existing `AsyncFunction` instance, or a plain call function.
5
+ *
6
+ * @template GArguments The tuple type representing the arguments to be provided to the function.
7
+ * @template GReturn The type of the value returned by the async function.
8
+ */
3
9
  export type AsyncFunctionLike<GArguments extends readonly unknown[], GReturn> = AsyncFunction<GArguments, GReturn> | CallAsyncFunction<GArguments, GReturn>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Options for the `AsyncFunction.shareConcurrentCalls` method.
3
+ *
4
+ * @template GArguments The tuple type representing the arguments to be provided to the function.
5
+ */
6
+ export interface ShareConcurrentCallsOptions<GArguments extends readonly unknown[]> {
7
+ /**
8
+ * Generates a cache key from the call's arguments. Concurrent calls producing the same key share their result.
9
+ */
10
+ readonly keyGenerator: ShareConcurrentCallsKeyGenerator<GArguments>;
11
+ }
12
+ /**
13
+ * Generates a cache key from the call's arguments.
14
+ *
15
+ * @template GArguments The tuple type representing the arguments to be provided to the function.
16
+ *
17
+ * @param {...GArguments} args The arguments to be provided to the function.
18
+ * @returns {string} The key identifying concurrent calls to share.
19
+ */
20
+ export interface ShareConcurrentCallsKeyGenerator<GArguments extends readonly unknown[]> {
21
+ (args: GArguments): string;
22
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=share-concurrent-calls-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-concurrent-calls-options.js","sourceRoot":"","sources":["../../../../../src/types/methods/share-concurrent-calls/share-concurrent-calls-options.ts"],"names":[],"mappings":""}
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Handles the resolved value of an async function call, like the first parameter of `Promise.then`.
3
+ *
4
+ * @template GReturn The type of the value resolved by the async function.
5
+ * @template GNewReturn The type of the value returned by the handler.
6
+ *
7
+ * @param {GReturn} value The value resolved by the async function.
8
+ * @param {AbortSignal} signal The `AbortSignal` received by the call, forwarded to the handler.
9
+ * @returns {PromiseLike<GNewReturn> | GNewReturn} The new value, or a promise of it.
10
+ */
1
11
  export interface AsyncFunctionThenOnFulfilledFunction<GReturn, GNewReturn> {
2
12
  (value: GReturn, signal: AbortSignal): PromiseLike<GNewReturn> | GNewReturn;
3
13
  }
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Handles the error thrown by an async function call, like the second parameter of `Promise.then`.
3
+ *
4
+ * @template GNewReturn The type of the value returned by the handler.
5
+ *
6
+ * @param {unknown} error The error thrown by the async function.
7
+ * @param {AbortSignal} signal The `AbortSignal` received by the call, forwarded to the handler.
8
+ * @returns {PromiseLike<GNewReturn> | GNewReturn} A fallback value, or a promise of it.
9
+ */
1
10
  export interface AsyncFunctionThenOnRejectedFunction<GNewReturn> {
2
11
  (error: unknown, signal: AbortSignal): PromiseLike<GNewReturn> | GNewReturn;
3
12
  }
@@ -1,2 +1,5 @@
1
1
  import { type AsyncFunctionThenOnFulfilledFunction } from './async-function.then.on-fulfilled-function.ts';
2
+ /**
3
+ * Default fulfilment handler: passes the resolved value through unchanged.
4
+ */
2
5
  export declare const DEFAULT_ASYNC_FUNCTION_THEN_ON_FULFILLED_FUNCTION: AsyncFunctionThenOnFulfilledFunction<any, any>;
@@ -1,3 +1,6 @@
1
1
  import {} from './async-function.then.on-fulfilled-function.js';
2
+ /**
3
+ * Default fulfilment handler: passes the resolved value through unchanged.
4
+ */
2
5
  export const DEFAULT_ASYNC_FUNCTION_THEN_ON_FULFILLED_FUNCTION = (value) => value;
3
6
  //# sourceMappingURL=default.async-function.then.on-fulfilled-function.private.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"default.async-function.then.on-fulfilled-function.private.js","sourceRoot":"","sources":["../../../../../src/types/methods/then/default.async-function.then.on-fulfilled-function.private.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,MAAM,gDAAgD,CAAC;AAE3G,MAAM,CAAC,MAAM,iDAAiD,GAAmD,CAC/G,KAAU,EACL,EAAE,CAAC,KAAK,CAAC"}
1
+ {"version":3,"file":"default.async-function.then.on-fulfilled-function.private.js","sourceRoot":"","sources":["../../../../../src/types/methods/then/default.async-function.then.on-fulfilled-function.private.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,MAAM,gDAAgD,CAAC;AAE3G;;GAEG;AACH,MAAM,CAAC,MAAM,iDAAiD,GAG1D,CAAC,KAAU,EAAO,EAAE,CAAC,KAAK,CAAC"}
@@ -1,2 +1,5 @@
1
1
  import { type AsyncFunctionThenOnRejectedFunction } from './async-function.then.on-rejected-function.ts';
2
+ /**
3
+ * Default rejection handler: re-throws the received error.
4
+ */
2
5
  export declare const DEFAULT_ASYNC_FUNCTION_THEN_ON_REJECTED_FUNCTION: AsyncFunctionThenOnRejectedFunction<any>;
@@ -1,4 +1,7 @@
1
1
  import {} from './async-function.then.on-rejected-function.js';
2
+ /**
3
+ * Default rejection handler: re-throws the received error.
4
+ */
2
5
  export const DEFAULT_ASYNC_FUNCTION_THEN_ON_REJECTED_FUNCTION = (error) => {
3
6
  throw error;
4
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"default.async-function.then.on-rejected-function.private.js","sourceRoot":"","sources":["../../../../../src/types/methods/then/default.async-function.then.on-rejected-function.private.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,MAAM,+CAA+C,CAAC;AAEzG,MAAM,CAAC,MAAM,gDAAgD,GAA6C,CACxG,KAAU,EACL,EAAE;IACP,MAAM,KAAK,CAAC;AACd,CAAC,CAAC"}
1
+ {"version":3,"file":"default.async-function.then.on-rejected-function.private.js","sourceRoot":"","sources":["../../../../../src/types/methods/then/default.async-function.then.on-rejected-function.private.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,MAAM,+CAA+C,CAAC;AAEzG;;GAEG;AACH,MAAM,CAAC,MAAM,gDAAgD,GAEzD,CAAC,KAAU,EAAO,EAAE;IACtB,MAAM,KAAK,CAAC;AACd,CAAC,CAAC"}
@@ -1,4 +1,13 @@
1
1
  import { type AsyncFunction } from '../../../async-function.ts';
2
+ /**
3
+ * Transforms an `AsyncFunction` instance into another value.
4
+ *
5
+ * @template GSelf The type of the `AsyncFunction` instance to transform.
6
+ * @template GReturn The type of the value returned by the transformation.
7
+ *
8
+ * @param {GSelf} self The `AsyncFunction` instance to transform.
9
+ * @returns {GReturn} The result of the transformation.
10
+ */
2
11
  export interface TransformAsyncFunctionFunction<GSelf extends AsyncFunction<any, any>, GReturn> {
3
12
  (self: GSelf): GReturn;
4
13
  }
@@ -1,5 +1,17 @@
1
1
  import { type AsyncFunctionLike } from '../../async-function-like.ts';
2
+ /**
3
+ * Options for the `AsyncFunction.fromSendAndReceive` static method.
4
+ *
5
+ * @template GArguments The tuple type representing the arguments to be provided to the send and receive functions.
6
+ * @template GReturn The type of the value returned by the receive function.
7
+ */
2
8
  export interface AsyncFunctionFromSendAndReceiveOptions<GArguments extends readonly unknown[], GReturn> {
9
+ /**
10
+ * The "push" async function to trigger (e.g. sending a command or message). Must not return a value.
11
+ */
3
12
  readonly send: AsyncFunctionLike<GArguments, void>;
13
+ /**
14
+ * The "pull" async function to await (e.g. listening for a response or event). Returns the result.
15
+ */
4
16
  readonly receive: AsyncFunctionLike<GArguments, GReturn>;
5
17
  }
@@ -1,16 +0,0 @@
1
- import type { MapFunctionArguments } from '../map-function-arguments.ts';
2
- /**
3
- * Used to map the first argument of a Flow to another one.
4
- *
5
- * @template GIn - The type of the source argument.
6
- * @template GOut - The type of the destination argument.
7
- * @param {(value: GIn) => GOut} mapFnc - The function to map the source argument to the destination one.
8
- * @returns {MapFunctionArguments<[GOut], [GIn]>} - A function that maps one argument to another one.
9
- *
10
- * @example
11
- *
12
- * ```ts
13
- * const value = await fnc.mapArguments(mapOneArgument(Number)).call(signal, '10');
14
- * ``
15
- */
16
- export declare function mapOneArgument<GIn, GOut>(mapFnc: (value: GIn) => GOut): MapFunctionArguments<[GOut], [GIn]>;
@@ -1,18 +0,0 @@
1
- /**
2
- * Used to map the first argument of a Flow to another one.
3
- *
4
- * @template GIn - The type of the source argument.
5
- * @template GOut - The type of the destination argument.
6
- * @param {(value: GIn) => GOut} mapFnc - The function to map the source argument to the destination one.
7
- * @returns {MapFunctionArguments<[GOut], [GIn]>} - A function that maps one argument to another one.
8
- *
9
- * @example
10
- *
11
- * ```ts
12
- * const value = await fnc.mapArguments(mapOneArgument(Number)).call(signal, '10');
13
- * ``
14
- */
15
- export function mapOneArgument(mapFnc) {
16
- return (value) => [mapFnc(value)];
17
- }
18
- //# sourceMappingURL=map-one-argument.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"map-one-argument.js","sourceRoot":"","sources":["../../../../../../src/types/methods/map-arguments/built-in/map-one-argument.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAAY,MAA4B;IACpE,OAAO,CAAC,KAAU,EAAU,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC"}
@@ -1,14 +0,0 @@
1
- import type { MapFunctionArguments } from '../map-function-arguments.ts';
2
- /**
3
- * Used to set the arguments of an AsyncFunction.
4
- *
5
- * @param args - The arguments to set.
6
- * @returns {MapFunctionArguments<GArguments, []>} - A function that maps no arguments to a list of predefined ones.
7
- *
8
- * @example
9
- *
10
- * ```ts
11
- * const value = await fnc.mapArguments(setArguments(10)).call(signal);
12
- * ``
13
- */
14
- export declare function setArguments<GArguments extends readonly unknown[]>(...args: GArguments): MapFunctionArguments<GArguments, []>;
@@ -1,16 +0,0 @@
1
- /**
2
- * Used to set the arguments of an AsyncFunction.
3
- *
4
- * @param args - The arguments to set.
5
- * @returns {MapFunctionArguments<GArguments, []>} - A function that maps no arguments to a list of predefined ones.
6
- *
7
- * @example
8
- *
9
- * ```ts
10
- * const value = await fnc.mapArguments(setArguments(10)).call(signal);
11
- * ``
12
- */
13
- export function setArguments(...args) {
14
- return () => args;
15
- }
16
- //# sourceMappingURL=set-arguments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"set-arguments.js","sourceRoot":"","sources":["../../../../../../src/types/methods/map-arguments/built-in/set-arguments.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAC1B,GAAG,IAAgB;IAEnB,OAAO,GAAe,EAAE,CAAC,IAAI,CAAC;AAChC,CAAC"}
@@ -1,3 +0,0 @@
1
- export interface MapFunctionArguments<GArguments extends readonly unknown[], GNewArguments extends readonly unknown[]> {
2
- (...args: GNewArguments): GArguments;
3
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=map-function-arguments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"map-function-arguments.js","sourceRoot":"","sources":["../../../../../src/types/methods/map-arguments/map-function-arguments.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- export interface ShareConcurentCallsOptions<GArguments extends readonly unknown[]> {
2
- readonly keyGenerator: ShareConcurentCallsKeyGenerator<GArguments>;
3
- }
4
- export interface ShareConcurentCallsKeyGenerator<GArguments extends readonly unknown[]> {
5
- (args: GArguments): string;
6
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=share-concurent-calls-options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"share-concurent-calls-options.js","sourceRoot":"","sources":["../../../../../src/types/methods/share-concurent-calls/share-concurent-calls-options.ts"],"names":[],"mappings":""}