@confighub/rtk-query 0.6.2 → 0.6.4

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/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
+ import * as _reduxjs_toolkit_query from '@reduxjs/toolkit/query';
2
+ import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
1
3
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
2
4
  import * as _reduxjs_toolkit_query_react from '@reduxjs/toolkit/query/react';
3
- import * as _reduxjs_toolkit_query from '@reduxjs/toolkit/query';
4
5
 
5
6
  interface ConfigHubConfig {
6
7
  /**
@@ -17,6 +18,12 @@ interface ConfigHubConfig {
17
18
  getToken?: () => string | undefined | Promise<string | undefined>;
18
19
  /** Called on a 401 so the app can refresh or re-login. The query is not retried. */
19
20
  onUnauthorized?: () => void | Promise<void>;
21
+ /**
22
+ * Called on a 403 with the error, whose `data.message` says why (for example an
23
+ * account pending approval), so the app can send the user somewhere that explains
24
+ * it. The query still fails with the error.
25
+ */
26
+ onForbidden?: (error: FetchBaseQueryError) => void | Promise<void>;
20
27
  }
21
28
  /**
22
29
  * Configure the ConfigHub API before dispatching any query — call once at store setup.
@@ -15457,11 +15464,12 @@ type PromoteUnitResult = {
15457
15464
  Mutations?: ResourceMutationList;
15458
15465
  PreviousHeadMutationNum?: number;
15459
15466
  PreviousHeadRevisionNum?: number;
15460
- /** For Skip and Unchanged: NotCovered, CreatedAfterChangeOrder, or AlreadyTaken. */
15467
+ /** For Skip and Unchanged: NotCovered, CreatedAfterChangeOrder, AlreadyTaken, or, for a Unit created in this Space, why the ChangeOrder does not cover it. For Mark: CreatedInSpace, when the Unit was created in this Space and the ChangeOrder is scoped over it. */
15461
15468
  Reason?: string;
15462
15469
  Slug?: string;
15463
15470
  /** Absent for a clone a dry run would create. */
15464
15471
  UnitID?: string;
15472
+ /** Absent for a Unit created in this Space. */
15465
15473
  UpstreamUnitID?: string;
15466
15474
  };
15467
15475
  type PromoteSpaceResult = {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
+ import * as _reduxjs_toolkit_query from '@reduxjs/toolkit/query';
2
+ import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
1
3
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
2
4
  import * as _reduxjs_toolkit_query_react from '@reduxjs/toolkit/query/react';
3
- import * as _reduxjs_toolkit_query from '@reduxjs/toolkit/query';
4
5
 
5
6
  interface ConfigHubConfig {
6
7
  /**
@@ -17,6 +18,12 @@ interface ConfigHubConfig {
17
18
  getToken?: () => string | undefined | Promise<string | undefined>;
18
19
  /** Called on a 401 so the app can refresh or re-login. The query is not retried. */
19
20
  onUnauthorized?: () => void | Promise<void>;
21
+ /**
22
+ * Called on a 403 with the error, whose `data.message` says why (for example an
23
+ * account pending approval), so the app can send the user somewhere that explains
24
+ * it. The query still fails with the error.
25
+ */
26
+ onForbidden?: (error: FetchBaseQueryError) => void | Promise<void>;
20
27
  }
21
28
  /**
22
29
  * Configure the ConfigHub API before dispatching any query — call once at store setup.
@@ -15457,11 +15464,12 @@ type PromoteUnitResult = {
15457
15464
  Mutations?: ResourceMutationList;
15458
15465
  PreviousHeadMutationNum?: number;
15459
15466
  PreviousHeadRevisionNum?: number;
15460
- /** For Skip and Unchanged: NotCovered, CreatedAfterChangeOrder, or AlreadyTaken. */
15467
+ /** For Skip and Unchanged: NotCovered, CreatedAfterChangeOrder, AlreadyTaken, or, for a Unit created in this Space, why the ChangeOrder does not cover it. For Mark: CreatedInSpace, when the Unit was created in this Space and the ChangeOrder is scoped over it. */
15461
15468
  Reason?: string;
15462
15469
  Slug?: string;
15463
15470
  /** Absent for a clone a dry run would create. */
15464
15471
  UnitID?: string;
15472
+ /** Absent for a Unit created in this Space. */
15465
15473
  UpstreamUnitID?: string;
15466
15474
  };
15467
15475
  type PromoteSpaceResult = {
package/dist/index.js CHANGED
@@ -45,6 +45,9 @@ var baseQuery = async (args, api, extraOptions) => {
45
45
  if (result.error && result.error.status === 401) {
46
46
  await config.onUnauthorized?.();
47
47
  }
48
+ if (result.error && result.error.status === 403) {
49
+ await config.onForbidden?.(result.error);
50
+ }
48
51
  return result;
49
52
  };
50
53
  var confighubApi = createApi({