ag-common 0.0.115 → 0.0.116

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.
@@ -1,3 +1,3 @@
1
1
  import { AxiosWrapper } from './jwt';
2
2
  import { ICallOpenApi } from './types';
3
- export declare const callOpenApi: <T, TDefaultApi>({ func, apiUrl, overrideAuth, refreshToken, logout, newDefaultApi, }: ICallOpenApi<T, TDefaultApi>) => Promise<AxiosWrapper<T>>;
3
+ export declare const callOpenApi: <T, TDefaultApi>({ func, apiUrl, overrideAuth, refreshToken, logout, newDefaultApi, headers, }: ICallOpenApi<T, TDefaultApi>) => Promise<AxiosWrapper<T>>;
@@ -13,14 +13,14 @@ exports.callOpenApi = void 0;
13
13
  const cookie_1 = require("./cookie");
14
14
  const sleep_1 = require("../../common/helpers/sleep");
15
15
  const array_1 = require("../../common/helpers/array");
16
- const callOpenApi = ({ func, apiUrl, overrideAuth, refreshToken, logout, newDefaultApi, }) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const callOpenApi = ({ func, apiUrl, overrideAuth, refreshToken, logout, newDefaultApi, headers, }) => __awaiter(void 0, void 0, void 0, function* () {
17
17
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
18
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
19
  let error;
20
20
  let data = undefined;
21
21
  const config = {
22
22
  basePath: apiUrl,
23
- baseOptions: { headers: { authorization: '' } },
23
+ baseOptions: { headers: Object.assign({ authorization: '' }, (headers || {})) },
24
24
  };
25
25
  const isAuthed = !!(0, cookie_1.getCookieWrapper)({ cname: 'id_token' });
26
26
  if (overrideAuth === null || overrideAuth === void 0 ? void 0 : overrideAuth.id_token) {
@@ -11,4 +11,5 @@ export interface ICallOpenApi<T, TDefaultApi> {
11
11
  refreshToken: () => Promise<User | undefined>;
12
12
  newDefaultApi: (config: any) => TDefaultApi;
13
13
  disabled?: boolean;
14
+ headers?: Record<string, string | number>;
14
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.115",
3
+ "version": "0.0.116",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",