@box/metadata-editor 0.67.1 → 0.67.3

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,9 +1,10 @@
1
- import { useReducer as i } from "react";
1
+ import { useReducer as O } from "react";
2
2
  import { RequestStates as u } from "./request.js";
3
+ import { isAbortError as I } from "./utils/is-abort-error.js";
3
4
  var s = /* @__PURE__ */ function(r) {
4
5
  return r.LOAD_MORE = "LOAD_MORE", r.RELOAD = "RELOAD", r.SEARCH = "SEARCH", r.SET_ERROR = "SET_ERROR", r.SET_LOADING = "SET_LOADING", r;
5
6
  }(s || {});
6
- function I(r, e) {
7
+ function a(r, e) {
7
8
  switch (e.type) {
8
9
  case s.LOAD_MORE:
9
10
  return {
@@ -58,52 +59,52 @@ function E(r, e) {
58
59
  function S(r, e) {
59
60
  return e.requestInitiator === s.LOAD_MORE && e.requestState === u.IN_PROGRESS && r.type === s.LOAD_MORE;
60
61
  }
61
- function a(r, e) {
62
+ function m(r, e) {
62
63
  return E(r, e) || S(r, e);
63
64
  }
64
- function m(r, e) {
65
+ function p(r, e) {
65
66
  var t;
66
67
  E(r, e) && e.abortController.abort(), S(r, e) && ((t = r.abortController) == null || t.abort());
67
68
  }
68
- function p(r, e) {
69
+ function h(r, e) {
69
70
  return S(r, e);
70
71
  }
71
72
  async function R(r, e, t, n) {
72
- const l = new AbortController();
73
- if (a(r, t) && m(r, t), !p(r, t)) {
73
+ const o = new AbortController();
74
+ if (m(r, t) && p(r, t), !h(r, t)) {
74
75
  n({
75
76
  type: s.SET_LOADING,
76
77
  requestInitiator: r.type,
77
- abortController: l
78
+ abortController: o
78
79
  });
79
80
  try {
80
- const o = await e({
81
+ const l = await e({
81
82
  items: t.items.slice(),
82
- signal: l.signal,
83
+ signal: o.signal,
83
84
  marker: r.type === s.LOAD_MORE ? t.marker : null,
84
85
  searchInput: r.searchInput ?? t.searchInput
85
- }), O = o.searchInput ?? r.searchInput ?? t.searchInput;
86
+ }), i = l.searchInput ?? r.searchInput ?? t.searchInput;
86
87
  n({
87
88
  type: r.type,
88
- ...o,
89
- searchInput: O,
90
- abortController: l
89
+ ...l,
90
+ searchInput: i,
91
+ abortController: o
91
92
  });
92
- } catch (o) {
93
- if ((o == null ? void 0 : o.name) === "AbortError")
93
+ } catch (l) {
94
+ if (I(l))
94
95
  return;
95
96
  n({
96
97
  type: s.SET_ERROR,
97
- error: o,
98
- abortController: l
98
+ error: l,
99
+ abortController: o
99
100
  });
100
101
  }
101
102
  }
102
103
  }
103
- function C(r) {
104
+ function _(r) {
104
105
  const {
105
106
  load: e
106
- } = r, [t, n] = i(I, {
107
+ } = r, [t, n] = O(a, {
107
108
  error: null,
108
109
  items: [],
109
110
  requestInitiator: null,
@@ -125,12 +126,12 @@ function C(r) {
125
126
  }, e, t, n),
126
127
  requestInitiator: t.requestInitiator,
127
128
  searchInput: t.searchInput,
128
- search: (l) => R({
129
+ search: (o) => R({
129
130
  type: s.SEARCH,
130
- searchInput: l
131
+ searchInput: o
131
132
  }, e, t, n)
132
133
  };
133
134
  }
134
135
  export {
135
- C as useAsyncList
136
+ _ as useAsyncList
136
137
  };
@@ -0,0 +1,13 @@
1
+ const o = "AbortError";
2
+ function t(r) {
3
+ return !!(r && r.__CANCEL__);
4
+ }
5
+ function n(r) {
6
+ return !!(r && typeof r == "object" && r.name === o);
7
+ }
8
+ function c(r) {
9
+ return t(r) || n(r);
10
+ }
11
+ export {
12
+ c as isAbortError
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.67.1",
3
+ "version": "0.67.3",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.5",
6
6
  "@box/blueprint-web": "^7.30.3",
@@ -53,5 +53,5 @@
53
53
  "**/*.css"
54
54
  ],
55
55
  "license": "SEE LICENSE IN LICENSE",
56
- "gitHead": "4ba02b87e8c84ad8f951540f77eb1efc83a13918"
56
+ "gitHead": "254f87a48e69399b6138d000899e0fd2217f179a"
57
57
  }
@@ -0,0 +1 @@
1
+ export declare function isAbortError(error: unknown): boolean;