aeria-sdk 0.0.186 → 0.0.187

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/http.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { InstanceConfig } from './types.js';
2
2
  import { type RequestConfig } from '@aeriajs/common';
3
- export declare const request: <TResponseType = unknown>(config: InstanceConfig, url: string, payload?: unknown, _requestConfig?: RequestConfig) => Promise<Response & {
3
+ export declare const request: <TResponseType = unknown>(config: InstanceConfig, url: string, payload?: unknown, _requestConfig?: RequestConfig) => Promise<{
4
+ response: Awaited<ReturnType<typeof fetch>>;
5
+ } & {
4
6
  data: TResponseType;
5
7
  }>;
package/dist/http.js CHANGED
@@ -5,10 +5,10 @@ const common_1 = require("@aeriajs/common");
5
5
  const storage_js_1 = require("./storage.js");
6
6
  const request = (config, url, payload, _requestConfig) => {
7
7
  const requestConfig = Object.assign({}, _requestConfig);
8
- requestConfig.requestTransformer ??= async (url, payload, _params, next) => {
8
+ requestConfig.requestTransformer ??= async (context, next) => {
9
9
  const params = Object.assign({
10
10
  headers: {},
11
- }, _params);
11
+ }, context.params);
12
12
  const auth = (0, storage_js_1.getStorage)(config).get('auth');
13
13
  if (auth?.token && !params.headers.authorization) {
14
14
  switch (auth.token.type) {
@@ -18,7 +18,10 @@ const request = (config, url, payload, _requestConfig) => {
18
18
  }
19
19
  }
20
20
  }
21
- return next(url, payload, params);
21
+ return next({
22
+ ...context,
23
+ params,
24
+ });
22
25
  };
23
26
  return (0, common_1.request)(url, payload, requestConfig);
24
27
  };
package/dist/http.mjs CHANGED
@@ -3,10 +3,10 @@ import { request as originalRequest } from "@aeriajs/common";
3
3
  import { getStorage } from "./storage.mjs";
4
4
  export const request = (config, url, payload, _requestConfig) => {
5
5
  const requestConfig = Object.assign({}, _requestConfig);
6
- requestConfig.requestTransformer ??= async (url2, payload2, _params, next) => {
6
+ requestConfig.requestTransformer ??= async (context, next) => {
7
7
  const params = Object.assign({
8
8
  headers: {}
9
- }, _params);
9
+ }, context.params);
10
10
  const auth = getStorage(config).get("auth");
11
11
  if (auth?.token && !params.headers.authorization) {
12
12
  switch (auth.token.type) {
@@ -16,7 +16,10 @@ export const request = (config, url, payload, _requestConfig) => {
16
16
  }
17
17
  }
18
18
  }
19
- return next(url2, payload2, params);
19
+ return next({
20
+ ...context,
21
+ params
22
+ });
20
23
  };
21
24
  return originalRequest(url, payload, requestConfig);
22
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aeria-sdk",
3
- "version": "0.0.186",
3
+ "version": "0.0.187",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -47,7 +47,7 @@
47
47
  "@aeriajs/types": "link:../types"
48
48
  },
49
49
  "peerDependencies": {
50
- "@aeriajs/common": "^0.0.146",
50
+ "@aeriajs/common": "^0.0.147",
51
51
  "@aeriajs/types": "^0.0.127"
52
52
  },
53
53
  "scripts": {