aspi 2.2.0 → 2.2.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.
package/README.md CHANGED
@@ -189,15 +189,15 @@ try {
189
189
  // Result mode wins (throwable is ignored)
190
190
  const result = await api
191
191
  .post('/login')
192
- .withResult() // enables Result mode
193
- .throwable() // ignored because withResult was called later
192
+ .withResult() // ignored because throwable was called later
193
+ .throwable() // enables throwable mode
194
194
  .json<{ token: string }>();
195
195
 
196
196
  // Throwable mode wins (Result is ignored)
197
197
  const data = await api
198
198
  .get('/profile')
199
- .throwable() // enables throwable mode
200
- .withResult() // ignored because throwable was called later
199
+ .throwable() // ignored because withResult was called later
200
+ .withResult() // enables Result mode
201
201
  .json();
202
202
  ```
203
203
 
package/dist/index.d.cts CHANGED
@@ -380,7 +380,7 @@ type CapabilityArgs<T extends AspiRequestInit = AspiRequestInit> = {
380
380
  * - mutate `request.requestInit.headers`, `signal`, or other properties
381
381
  * before the network call is made.
382
382
  */
383
- request: AspiRequest<AspiRequestInit>;
383
+ request: AspiRequest<T>;
384
384
  };
385
385
  /**
386
386
  * A capability is a small wrapper around the low-level `fetch` call that can
@@ -834,7 +834,7 @@ declare class Request<Method extends HttpMethods, TRequest extends AspiRequestIn
834
834
  error: {};
835
835
  }> {
836
836
  #private;
837
- constructor(method: HttpMethods, path: string, requestOptions: RequestOptions<TRequest>, capabilities?: Capability[]);
837
+ constructor(method: HttpMethods, path: string, requestOptions: RequestOptions<TRequest>, capabilities?: Capability<TRequest>[]);
838
838
  /**
839
839
  * Sets the base URL for the request.
840
840
  * @param url The base URL to set
package/dist/index.d.ts CHANGED
@@ -380,7 +380,7 @@ type CapabilityArgs<T extends AspiRequestInit = AspiRequestInit> = {
380
380
  * - mutate `request.requestInit.headers`, `signal`, or other properties
381
381
  * before the network call is made.
382
382
  */
383
- request: AspiRequest<AspiRequestInit>;
383
+ request: AspiRequest<T>;
384
384
  };
385
385
  /**
386
386
  * A capability is a small wrapper around the low-level `fetch` call that can
@@ -834,7 +834,7 @@ declare class Request<Method extends HttpMethods, TRequest extends AspiRequestIn
834
834
  error: {};
835
835
  }> {
836
836
  #private;
837
- constructor(method: HttpMethods, path: string, requestOptions: RequestOptions<TRequest>, capabilities?: Capability[]);
837
+ constructor(method: HttpMethods, path: string, requestOptions: RequestOptions<TRequest>, capabilities?: Capability<TRequest>[]);
838
838
  /**
839
839
  * Sets the base URL for the request.
840
840
  * @param url The base URL to set
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aspi",
3
3
  "description": "Rest API client for typescript projects with chain of responsibility design pattern.",
4
- "version": "2.2.0",
4
+ "version": "2.2.1",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
7
7
  "devDependencies": {