@dev-fastn-ai/react-core 2.0.0 → 2.0.2
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 +814 -211
- package/dist/core/src/core/activate-connector.d.ts +2 -4
- package/dist/core/src/core/configuration-form.d.ts +1 -1
- package/dist/core/src/types/index.d.ts +5 -4
- package/dist/index.cjs.js +697 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.esm.js +697 -17
- package/dist/index.esm.js.map +1 -1
- package/package.json +11 -9
package/dist/index.cjs.js
CHANGED
|
@@ -986,7 +986,7 @@ const activateConnector = async ({ connectorId, action, dependencyConnector, aut
|
|
|
986
986
|
formData: input,
|
|
987
987
|
});
|
|
988
988
|
if ((response === null || response === void 0 ? void 0 : response.status) === "CANCELLED") {
|
|
989
|
-
return
|
|
989
|
+
return { data: null, status: "CANCELLED" };
|
|
990
990
|
}
|
|
991
991
|
// Execute the action handler
|
|
992
992
|
response = await executeActionHandler(action === null || action === void 0 ? void 0 : action.handler, addCustomAuthContextHeader({}, { resourceId: connectorId, action: ResourceAction.ACTIVATION }));
|
|
@@ -1297,7 +1297,7 @@ async function getConfigurations({ configurationId, status = "ALL", }) {
|
|
|
1297
1297
|
const handler = async (formData = {}) => {
|
|
1298
1298
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1299
1299
|
if (((_a = configSubscription === null || configSubscription === void 0 ? void 0 : configSubscription.connector) === null || _a === void 0 ? void 0 : _a.status) === "ACTIVE")
|
|
1300
|
-
return {
|
|
1300
|
+
return { status: "SUCCESS" };
|
|
1301
1301
|
const result = await activateConnector({
|
|
1302
1302
|
connectorId: configSubscription.connector.id,
|
|
1303
1303
|
action: (_c = (_b = configSubscription === null || configSubscription === void 0 ? void 0 : configSubscription.connector) === null || _b === void 0 ? void 0 : _b.actions) === null || _c === void 0 ? void 0 : _c.find((action) => action.actionType === ResourceAction.ACTIVATION),
|
|
@@ -1307,7 +1307,7 @@ async function getConfigurations({ configurationId, status = "ALL", }) {
|
|
|
1307
1307
|
});
|
|
1308
1308
|
sendEvent("REFETCH_CONFIGURATIONS");
|
|
1309
1309
|
sendEvent("REFETCH_CONNECTORS");
|
|
1310
|
-
return
|
|
1310
|
+
return result;
|
|
1311
1311
|
};
|
|
1312
1312
|
actions.push({
|
|
1313
1313
|
name: "Enable",
|
|
@@ -1409,7 +1409,10 @@ function openGoogleFilesPicker(parentArgs) {
|
|
|
1409
1409
|
const config = getConfig();
|
|
1410
1410
|
let accessToken = null;
|
|
1411
1411
|
let apiKey = null;
|
|
1412
|
-
const cachedToken = localStorage.getItem(config.spaceId +
|
|
1412
|
+
const cachedToken = localStorage.getItem(config.spaceId +
|
|
1413
|
+
parentArgs.connectorId +
|
|
1414
|
+
config.tenantId +
|
|
1415
|
+
"access_token");
|
|
1413
1416
|
if (cachedToken) {
|
|
1414
1417
|
const token = safeParse(cachedToken);
|
|
1415
1418
|
if ((token === null || token === void 0 ? void 0 : token.expires_at) && token.expires_at > Date.now()) {
|
|
@@ -1427,7 +1430,10 @@ function openGoogleFilesPicker(parentArgs) {
|
|
|
1427
1430
|
});
|
|
1428
1431
|
const token = data === null || data === void 0 ? void 0 : data.connectorConnection;
|
|
1429
1432
|
// cache token in local storage
|
|
1430
|
-
localStorage.setItem(config.spaceId +
|
|
1433
|
+
localStorage.setItem(config.spaceId +
|
|
1434
|
+
parentArgs.connectorId +
|
|
1435
|
+
config.tenantId +
|
|
1436
|
+
"access_token", safeStringify({
|
|
1431
1437
|
access_token: token.access_token,
|
|
1432
1438
|
api_key: (_a = token.metadata) === null || _a === void 0 ? void 0 : _a.google_picker_api_key,
|
|
1433
1439
|
expires_at: token.expires_at || Date.now() + token.expires_in * 1000,
|
|
@@ -1532,7 +1538,7 @@ async function fetchOptions(context, pagination, resetCursor = false, query) {
|
|
|
1532
1538
|
const total = (_b = response.total) !== null && _b !== void 0 ? _b : pagination.total;
|
|
1533
1539
|
const cursor = response.cursor || response.curser;
|
|
1534
1540
|
const hasNextPage = Boolean(cursor || response.hasNextPage) ||
|
|
1535
|
-
(typeof total ===
|
|
1541
|
+
(typeof total === "number"
|
|
1536
1542
|
? total > newOffset
|
|
1537
1543
|
: newOptions.length === limit && !pagination.cursor);
|
|
1538
1544
|
return {
|
|
@@ -1560,8 +1566,8 @@ async function refreshOptions(pagination, context) {
|
|
|
1560
1566
|
/**
|
|
1561
1567
|
* Gets options for a select field.
|
|
1562
1568
|
*/
|
|
1563
|
-
async function getOptions(pagination, context) {
|
|
1564
|
-
return fetchOptions(context || {}, pagination, false);
|
|
1569
|
+
async function getOptions(pagination, context, query) {
|
|
1570
|
+
return fetchOptions(context || {}, pagination, false, query);
|
|
1565
1571
|
}
|
|
1566
1572
|
/**
|
|
1567
1573
|
* Searches options for a select field.
|
|
@@ -1601,7 +1607,9 @@ async function getConfigurationForm(input) {
|
|
|
1601
1607
|
loadMore: loadMoreOptions,
|
|
1602
1608
|
refresh: refreshOptions,
|
|
1603
1609
|
searchOptions,
|
|
1604
|
-
openGoogleFilesPicker: openGoogleFilesPicker({
|
|
1610
|
+
openGoogleFilesPicker: openGoogleFilesPicker({
|
|
1611
|
+
connectorId: input.connectorId,
|
|
1612
|
+
}),
|
|
1605
1613
|
});
|
|
1606
1614
|
return {
|
|
1607
1615
|
name: ((_g = input === null || input === void 0 ? void 0 : input.configuration) === null || _g === void 0 ? void 0 : _g.name) || "",
|
|
@@ -1729,6 +1737,666 @@ const useConnectors = () => {
|
|
|
1729
1737
|
return query;
|
|
1730
1738
|
};
|
|
1731
1739
|
|
|
1740
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1741
|
+
|
|
1742
|
+
function getDefaultExportFromCjs (x) {
|
|
1743
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
/**
|
|
1747
|
+
* Checks if `value` is the
|
|
1748
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
1749
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
1750
|
+
*
|
|
1751
|
+
* @static
|
|
1752
|
+
* @memberOf _
|
|
1753
|
+
* @since 0.1.0
|
|
1754
|
+
* @category Lang
|
|
1755
|
+
* @param {*} value The value to check.
|
|
1756
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
1757
|
+
* @example
|
|
1758
|
+
*
|
|
1759
|
+
* _.isObject({});
|
|
1760
|
+
* // => true
|
|
1761
|
+
*
|
|
1762
|
+
* _.isObject([1, 2, 3]);
|
|
1763
|
+
* // => true
|
|
1764
|
+
*
|
|
1765
|
+
* _.isObject(_.noop);
|
|
1766
|
+
* // => true
|
|
1767
|
+
*
|
|
1768
|
+
* _.isObject(null);
|
|
1769
|
+
* // => false
|
|
1770
|
+
*/
|
|
1771
|
+
|
|
1772
|
+
var isObject_1;
|
|
1773
|
+
var hasRequiredIsObject;
|
|
1774
|
+
|
|
1775
|
+
function requireIsObject () {
|
|
1776
|
+
if (hasRequiredIsObject) return isObject_1;
|
|
1777
|
+
hasRequiredIsObject = 1;
|
|
1778
|
+
function isObject(value) {
|
|
1779
|
+
var type = typeof value;
|
|
1780
|
+
return value != null && (type == 'object' || type == 'function');
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
isObject_1 = isObject;
|
|
1784
|
+
return isObject_1;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
/** Detect free variable `global` from Node.js. */
|
|
1788
|
+
|
|
1789
|
+
var _freeGlobal;
|
|
1790
|
+
var hasRequired_freeGlobal;
|
|
1791
|
+
|
|
1792
|
+
function require_freeGlobal () {
|
|
1793
|
+
if (hasRequired_freeGlobal) return _freeGlobal;
|
|
1794
|
+
hasRequired_freeGlobal = 1;
|
|
1795
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
1796
|
+
|
|
1797
|
+
_freeGlobal = freeGlobal;
|
|
1798
|
+
return _freeGlobal;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
var _root;
|
|
1802
|
+
var hasRequired_root;
|
|
1803
|
+
|
|
1804
|
+
function require_root () {
|
|
1805
|
+
if (hasRequired_root) return _root;
|
|
1806
|
+
hasRequired_root = 1;
|
|
1807
|
+
var freeGlobal = require_freeGlobal();
|
|
1808
|
+
|
|
1809
|
+
/** Detect free variable `self`. */
|
|
1810
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
1811
|
+
|
|
1812
|
+
/** Used as a reference to the global object. */
|
|
1813
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
1814
|
+
|
|
1815
|
+
_root = root;
|
|
1816
|
+
return _root;
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
var now_1;
|
|
1820
|
+
var hasRequiredNow;
|
|
1821
|
+
|
|
1822
|
+
function requireNow () {
|
|
1823
|
+
if (hasRequiredNow) return now_1;
|
|
1824
|
+
hasRequiredNow = 1;
|
|
1825
|
+
var root = require_root();
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
1829
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
1830
|
+
*
|
|
1831
|
+
* @static
|
|
1832
|
+
* @memberOf _
|
|
1833
|
+
* @since 2.4.0
|
|
1834
|
+
* @category Date
|
|
1835
|
+
* @returns {number} Returns the timestamp.
|
|
1836
|
+
* @example
|
|
1837
|
+
*
|
|
1838
|
+
* _.defer(function(stamp) {
|
|
1839
|
+
* console.log(_.now() - stamp);
|
|
1840
|
+
* }, _.now());
|
|
1841
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
1842
|
+
*/
|
|
1843
|
+
var now = function() {
|
|
1844
|
+
return root.Date.now();
|
|
1845
|
+
};
|
|
1846
|
+
|
|
1847
|
+
now_1 = now;
|
|
1848
|
+
return now_1;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/** Used to match a single whitespace character. */
|
|
1852
|
+
|
|
1853
|
+
var _trimmedEndIndex;
|
|
1854
|
+
var hasRequired_trimmedEndIndex;
|
|
1855
|
+
|
|
1856
|
+
function require_trimmedEndIndex () {
|
|
1857
|
+
if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
|
|
1858
|
+
hasRequired_trimmedEndIndex = 1;
|
|
1859
|
+
var reWhitespace = /\s/;
|
|
1860
|
+
|
|
1861
|
+
/**
|
|
1862
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
1863
|
+
* character of `string`.
|
|
1864
|
+
*
|
|
1865
|
+
* @private
|
|
1866
|
+
* @param {string} string The string to inspect.
|
|
1867
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
1868
|
+
*/
|
|
1869
|
+
function trimmedEndIndex(string) {
|
|
1870
|
+
var index = string.length;
|
|
1871
|
+
|
|
1872
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
1873
|
+
return index;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
_trimmedEndIndex = trimmedEndIndex;
|
|
1877
|
+
return _trimmedEndIndex;
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
var _baseTrim;
|
|
1881
|
+
var hasRequired_baseTrim;
|
|
1882
|
+
|
|
1883
|
+
function require_baseTrim () {
|
|
1884
|
+
if (hasRequired_baseTrim) return _baseTrim;
|
|
1885
|
+
hasRequired_baseTrim = 1;
|
|
1886
|
+
var trimmedEndIndex = require_trimmedEndIndex();
|
|
1887
|
+
|
|
1888
|
+
/** Used to match leading whitespace. */
|
|
1889
|
+
var reTrimStart = /^\s+/;
|
|
1890
|
+
|
|
1891
|
+
/**
|
|
1892
|
+
* The base implementation of `_.trim`.
|
|
1893
|
+
*
|
|
1894
|
+
* @private
|
|
1895
|
+
* @param {string} string The string to trim.
|
|
1896
|
+
* @returns {string} Returns the trimmed string.
|
|
1897
|
+
*/
|
|
1898
|
+
function baseTrim(string) {
|
|
1899
|
+
return string
|
|
1900
|
+
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
1901
|
+
: string;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
_baseTrim = baseTrim;
|
|
1905
|
+
return _baseTrim;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
var _Symbol;
|
|
1909
|
+
var hasRequired_Symbol;
|
|
1910
|
+
|
|
1911
|
+
function require_Symbol () {
|
|
1912
|
+
if (hasRequired_Symbol) return _Symbol;
|
|
1913
|
+
hasRequired_Symbol = 1;
|
|
1914
|
+
var root = require_root();
|
|
1915
|
+
|
|
1916
|
+
/** Built-in value references. */
|
|
1917
|
+
var Symbol = root.Symbol;
|
|
1918
|
+
|
|
1919
|
+
_Symbol = Symbol;
|
|
1920
|
+
return _Symbol;
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
var _getRawTag;
|
|
1924
|
+
var hasRequired_getRawTag;
|
|
1925
|
+
|
|
1926
|
+
function require_getRawTag () {
|
|
1927
|
+
if (hasRequired_getRawTag) return _getRawTag;
|
|
1928
|
+
hasRequired_getRawTag = 1;
|
|
1929
|
+
var Symbol = require_Symbol();
|
|
1930
|
+
|
|
1931
|
+
/** Used for built-in method references. */
|
|
1932
|
+
var objectProto = Object.prototype;
|
|
1933
|
+
|
|
1934
|
+
/** Used to check objects for own properties. */
|
|
1935
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1936
|
+
|
|
1937
|
+
/**
|
|
1938
|
+
* Used to resolve the
|
|
1939
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1940
|
+
* of values.
|
|
1941
|
+
*/
|
|
1942
|
+
var nativeObjectToString = objectProto.toString;
|
|
1943
|
+
|
|
1944
|
+
/** Built-in value references. */
|
|
1945
|
+
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
1946
|
+
|
|
1947
|
+
/**
|
|
1948
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
1949
|
+
*
|
|
1950
|
+
* @private
|
|
1951
|
+
* @param {*} value The value to query.
|
|
1952
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
1953
|
+
*/
|
|
1954
|
+
function getRawTag(value) {
|
|
1955
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
1956
|
+
tag = value[symToStringTag];
|
|
1957
|
+
|
|
1958
|
+
try {
|
|
1959
|
+
value[symToStringTag] = undefined;
|
|
1960
|
+
var unmasked = true;
|
|
1961
|
+
} catch (e) {}
|
|
1962
|
+
|
|
1963
|
+
var result = nativeObjectToString.call(value);
|
|
1964
|
+
if (unmasked) {
|
|
1965
|
+
if (isOwn) {
|
|
1966
|
+
value[symToStringTag] = tag;
|
|
1967
|
+
} else {
|
|
1968
|
+
delete value[symToStringTag];
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
return result;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
_getRawTag = getRawTag;
|
|
1975
|
+
return _getRawTag;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
/** Used for built-in method references. */
|
|
1979
|
+
|
|
1980
|
+
var _objectToString;
|
|
1981
|
+
var hasRequired_objectToString;
|
|
1982
|
+
|
|
1983
|
+
function require_objectToString () {
|
|
1984
|
+
if (hasRequired_objectToString) return _objectToString;
|
|
1985
|
+
hasRequired_objectToString = 1;
|
|
1986
|
+
var objectProto = Object.prototype;
|
|
1987
|
+
|
|
1988
|
+
/**
|
|
1989
|
+
* Used to resolve the
|
|
1990
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1991
|
+
* of values.
|
|
1992
|
+
*/
|
|
1993
|
+
var nativeObjectToString = objectProto.toString;
|
|
1994
|
+
|
|
1995
|
+
/**
|
|
1996
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
1997
|
+
*
|
|
1998
|
+
* @private
|
|
1999
|
+
* @param {*} value The value to convert.
|
|
2000
|
+
* @returns {string} Returns the converted string.
|
|
2001
|
+
*/
|
|
2002
|
+
function objectToString(value) {
|
|
2003
|
+
return nativeObjectToString.call(value);
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
_objectToString = objectToString;
|
|
2007
|
+
return _objectToString;
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
var _baseGetTag;
|
|
2011
|
+
var hasRequired_baseGetTag;
|
|
2012
|
+
|
|
2013
|
+
function require_baseGetTag () {
|
|
2014
|
+
if (hasRequired_baseGetTag) return _baseGetTag;
|
|
2015
|
+
hasRequired_baseGetTag = 1;
|
|
2016
|
+
var Symbol = require_Symbol(),
|
|
2017
|
+
getRawTag = require_getRawTag(),
|
|
2018
|
+
objectToString = require_objectToString();
|
|
2019
|
+
|
|
2020
|
+
/** `Object#toString` result references. */
|
|
2021
|
+
var nullTag = '[object Null]',
|
|
2022
|
+
undefinedTag = '[object Undefined]';
|
|
2023
|
+
|
|
2024
|
+
/** Built-in value references. */
|
|
2025
|
+
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
2026
|
+
|
|
2027
|
+
/**
|
|
2028
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
2029
|
+
*
|
|
2030
|
+
* @private
|
|
2031
|
+
* @param {*} value The value to query.
|
|
2032
|
+
* @returns {string} Returns the `toStringTag`.
|
|
2033
|
+
*/
|
|
2034
|
+
function baseGetTag(value) {
|
|
2035
|
+
if (value == null) {
|
|
2036
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
2037
|
+
}
|
|
2038
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
2039
|
+
? getRawTag(value)
|
|
2040
|
+
: objectToString(value);
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
_baseGetTag = baseGetTag;
|
|
2044
|
+
return _baseGetTag;
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
/**
|
|
2048
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
2049
|
+
* and has a `typeof` result of "object".
|
|
2050
|
+
*
|
|
2051
|
+
* @static
|
|
2052
|
+
* @memberOf _
|
|
2053
|
+
* @since 4.0.0
|
|
2054
|
+
* @category Lang
|
|
2055
|
+
* @param {*} value The value to check.
|
|
2056
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
2057
|
+
* @example
|
|
2058
|
+
*
|
|
2059
|
+
* _.isObjectLike({});
|
|
2060
|
+
* // => true
|
|
2061
|
+
*
|
|
2062
|
+
* _.isObjectLike([1, 2, 3]);
|
|
2063
|
+
* // => true
|
|
2064
|
+
*
|
|
2065
|
+
* _.isObjectLike(_.noop);
|
|
2066
|
+
* // => false
|
|
2067
|
+
*
|
|
2068
|
+
* _.isObjectLike(null);
|
|
2069
|
+
* // => false
|
|
2070
|
+
*/
|
|
2071
|
+
|
|
2072
|
+
var isObjectLike_1;
|
|
2073
|
+
var hasRequiredIsObjectLike;
|
|
2074
|
+
|
|
2075
|
+
function requireIsObjectLike () {
|
|
2076
|
+
if (hasRequiredIsObjectLike) return isObjectLike_1;
|
|
2077
|
+
hasRequiredIsObjectLike = 1;
|
|
2078
|
+
function isObjectLike(value) {
|
|
2079
|
+
return value != null && typeof value == 'object';
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
isObjectLike_1 = isObjectLike;
|
|
2083
|
+
return isObjectLike_1;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
var isSymbol_1;
|
|
2087
|
+
var hasRequiredIsSymbol;
|
|
2088
|
+
|
|
2089
|
+
function requireIsSymbol () {
|
|
2090
|
+
if (hasRequiredIsSymbol) return isSymbol_1;
|
|
2091
|
+
hasRequiredIsSymbol = 1;
|
|
2092
|
+
var baseGetTag = require_baseGetTag(),
|
|
2093
|
+
isObjectLike = requireIsObjectLike();
|
|
2094
|
+
|
|
2095
|
+
/** `Object#toString` result references. */
|
|
2096
|
+
var symbolTag = '[object Symbol]';
|
|
2097
|
+
|
|
2098
|
+
/**
|
|
2099
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
2100
|
+
*
|
|
2101
|
+
* @static
|
|
2102
|
+
* @memberOf _
|
|
2103
|
+
* @since 4.0.0
|
|
2104
|
+
* @category Lang
|
|
2105
|
+
* @param {*} value The value to check.
|
|
2106
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
2107
|
+
* @example
|
|
2108
|
+
*
|
|
2109
|
+
* _.isSymbol(Symbol.iterator);
|
|
2110
|
+
* // => true
|
|
2111
|
+
*
|
|
2112
|
+
* _.isSymbol('abc');
|
|
2113
|
+
* // => false
|
|
2114
|
+
*/
|
|
2115
|
+
function isSymbol(value) {
|
|
2116
|
+
return typeof value == 'symbol' ||
|
|
2117
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
isSymbol_1 = isSymbol;
|
|
2121
|
+
return isSymbol_1;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
var toNumber_1;
|
|
2125
|
+
var hasRequiredToNumber;
|
|
2126
|
+
|
|
2127
|
+
function requireToNumber () {
|
|
2128
|
+
if (hasRequiredToNumber) return toNumber_1;
|
|
2129
|
+
hasRequiredToNumber = 1;
|
|
2130
|
+
var baseTrim = require_baseTrim(),
|
|
2131
|
+
isObject = requireIsObject(),
|
|
2132
|
+
isSymbol = requireIsSymbol();
|
|
2133
|
+
|
|
2134
|
+
/** Used as references for various `Number` constants. */
|
|
2135
|
+
var NAN = 0 / 0;
|
|
2136
|
+
|
|
2137
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
2138
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
2139
|
+
|
|
2140
|
+
/** Used to detect binary string values. */
|
|
2141
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
2142
|
+
|
|
2143
|
+
/** Used to detect octal string values. */
|
|
2144
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
2145
|
+
|
|
2146
|
+
/** Built-in method references without a dependency on `root`. */
|
|
2147
|
+
var freeParseInt = parseInt;
|
|
2148
|
+
|
|
2149
|
+
/**
|
|
2150
|
+
* Converts `value` to a number.
|
|
2151
|
+
*
|
|
2152
|
+
* @static
|
|
2153
|
+
* @memberOf _
|
|
2154
|
+
* @since 4.0.0
|
|
2155
|
+
* @category Lang
|
|
2156
|
+
* @param {*} value The value to process.
|
|
2157
|
+
* @returns {number} Returns the number.
|
|
2158
|
+
* @example
|
|
2159
|
+
*
|
|
2160
|
+
* _.toNumber(3.2);
|
|
2161
|
+
* // => 3.2
|
|
2162
|
+
*
|
|
2163
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
2164
|
+
* // => 5e-324
|
|
2165
|
+
*
|
|
2166
|
+
* _.toNumber(Infinity);
|
|
2167
|
+
* // => Infinity
|
|
2168
|
+
*
|
|
2169
|
+
* _.toNumber('3.2');
|
|
2170
|
+
* // => 3.2
|
|
2171
|
+
*/
|
|
2172
|
+
function toNumber(value) {
|
|
2173
|
+
if (typeof value == 'number') {
|
|
2174
|
+
return value;
|
|
2175
|
+
}
|
|
2176
|
+
if (isSymbol(value)) {
|
|
2177
|
+
return NAN;
|
|
2178
|
+
}
|
|
2179
|
+
if (isObject(value)) {
|
|
2180
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
2181
|
+
value = isObject(other) ? (other + '') : other;
|
|
2182
|
+
}
|
|
2183
|
+
if (typeof value != 'string') {
|
|
2184
|
+
return value === 0 ? value : +value;
|
|
2185
|
+
}
|
|
2186
|
+
value = baseTrim(value);
|
|
2187
|
+
var isBinary = reIsBinary.test(value);
|
|
2188
|
+
return (isBinary || reIsOctal.test(value))
|
|
2189
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
2190
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
toNumber_1 = toNumber;
|
|
2194
|
+
return toNumber_1;
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
var debounce_1;
|
|
2198
|
+
var hasRequiredDebounce;
|
|
2199
|
+
|
|
2200
|
+
function requireDebounce () {
|
|
2201
|
+
if (hasRequiredDebounce) return debounce_1;
|
|
2202
|
+
hasRequiredDebounce = 1;
|
|
2203
|
+
var isObject = requireIsObject(),
|
|
2204
|
+
now = requireNow(),
|
|
2205
|
+
toNumber = requireToNumber();
|
|
2206
|
+
|
|
2207
|
+
/** Error message constants. */
|
|
2208
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
2209
|
+
|
|
2210
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2211
|
+
var nativeMax = Math.max,
|
|
2212
|
+
nativeMin = Math.min;
|
|
2213
|
+
|
|
2214
|
+
/**
|
|
2215
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
2216
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
2217
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
2218
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
2219
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
2220
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
2221
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
2222
|
+
* calls to the debounced function return the result of the last `func`
|
|
2223
|
+
* invocation.
|
|
2224
|
+
*
|
|
2225
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
2226
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
2227
|
+
* is invoked more than once during the `wait` timeout.
|
|
2228
|
+
*
|
|
2229
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
2230
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
2231
|
+
*
|
|
2232
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
2233
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
2234
|
+
*
|
|
2235
|
+
* @static
|
|
2236
|
+
* @memberOf _
|
|
2237
|
+
* @since 0.1.0
|
|
2238
|
+
* @category Function
|
|
2239
|
+
* @param {Function} func The function to debounce.
|
|
2240
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
2241
|
+
* @param {Object} [options={}] The options object.
|
|
2242
|
+
* @param {boolean} [options.leading=false]
|
|
2243
|
+
* Specify invoking on the leading edge of the timeout.
|
|
2244
|
+
* @param {number} [options.maxWait]
|
|
2245
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
2246
|
+
* @param {boolean} [options.trailing=true]
|
|
2247
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
2248
|
+
* @returns {Function} Returns the new debounced function.
|
|
2249
|
+
* @example
|
|
2250
|
+
*
|
|
2251
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
2252
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
2253
|
+
*
|
|
2254
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
2255
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
2256
|
+
* 'leading': true,
|
|
2257
|
+
* 'trailing': false
|
|
2258
|
+
* }));
|
|
2259
|
+
*
|
|
2260
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
2261
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
2262
|
+
* var source = new EventSource('/stream');
|
|
2263
|
+
* jQuery(source).on('message', debounced);
|
|
2264
|
+
*
|
|
2265
|
+
* // Cancel the trailing debounced invocation.
|
|
2266
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
2267
|
+
*/
|
|
2268
|
+
function debounce(func, wait, options) {
|
|
2269
|
+
var lastArgs,
|
|
2270
|
+
lastThis,
|
|
2271
|
+
maxWait,
|
|
2272
|
+
result,
|
|
2273
|
+
timerId,
|
|
2274
|
+
lastCallTime,
|
|
2275
|
+
lastInvokeTime = 0,
|
|
2276
|
+
leading = false,
|
|
2277
|
+
maxing = false,
|
|
2278
|
+
trailing = true;
|
|
2279
|
+
|
|
2280
|
+
if (typeof func != 'function') {
|
|
2281
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
2282
|
+
}
|
|
2283
|
+
wait = toNumber(wait) || 0;
|
|
2284
|
+
if (isObject(options)) {
|
|
2285
|
+
leading = !!options.leading;
|
|
2286
|
+
maxing = 'maxWait' in options;
|
|
2287
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
2288
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
function invokeFunc(time) {
|
|
2292
|
+
var args = lastArgs,
|
|
2293
|
+
thisArg = lastThis;
|
|
2294
|
+
|
|
2295
|
+
lastArgs = lastThis = undefined;
|
|
2296
|
+
lastInvokeTime = time;
|
|
2297
|
+
result = func.apply(thisArg, args);
|
|
2298
|
+
return result;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
function leadingEdge(time) {
|
|
2302
|
+
// Reset any `maxWait` timer.
|
|
2303
|
+
lastInvokeTime = time;
|
|
2304
|
+
// Start the timer for the trailing edge.
|
|
2305
|
+
timerId = setTimeout(timerExpired, wait);
|
|
2306
|
+
// Invoke the leading edge.
|
|
2307
|
+
return leading ? invokeFunc(time) : result;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
function remainingWait(time) {
|
|
2311
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
2312
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
2313
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
2314
|
+
|
|
2315
|
+
return maxing
|
|
2316
|
+
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
2317
|
+
: timeWaiting;
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
function shouldInvoke(time) {
|
|
2321
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
2322
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
2323
|
+
|
|
2324
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
2325
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
2326
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
2327
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
2328
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
function timerExpired() {
|
|
2332
|
+
var time = now();
|
|
2333
|
+
if (shouldInvoke(time)) {
|
|
2334
|
+
return trailingEdge(time);
|
|
2335
|
+
}
|
|
2336
|
+
// Restart the timer.
|
|
2337
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
function trailingEdge(time) {
|
|
2341
|
+
timerId = undefined;
|
|
2342
|
+
|
|
2343
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
2344
|
+
// debounced at least once.
|
|
2345
|
+
if (trailing && lastArgs) {
|
|
2346
|
+
return invokeFunc(time);
|
|
2347
|
+
}
|
|
2348
|
+
lastArgs = lastThis = undefined;
|
|
2349
|
+
return result;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
function cancel() {
|
|
2353
|
+
if (timerId !== undefined) {
|
|
2354
|
+
clearTimeout(timerId);
|
|
2355
|
+
}
|
|
2356
|
+
lastInvokeTime = 0;
|
|
2357
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
function flush() {
|
|
2361
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
function debounced() {
|
|
2365
|
+
var time = now(),
|
|
2366
|
+
isInvoking = shouldInvoke(time);
|
|
2367
|
+
|
|
2368
|
+
lastArgs = arguments;
|
|
2369
|
+
lastThis = this;
|
|
2370
|
+
lastCallTime = time;
|
|
2371
|
+
|
|
2372
|
+
if (isInvoking) {
|
|
2373
|
+
if (timerId === undefined) {
|
|
2374
|
+
return leadingEdge(lastCallTime);
|
|
2375
|
+
}
|
|
2376
|
+
if (maxing) {
|
|
2377
|
+
// Handle invocations in a tight loop.
|
|
2378
|
+
clearTimeout(timerId);
|
|
2379
|
+
timerId = setTimeout(timerExpired, wait);
|
|
2380
|
+
return invokeFunc(lastCallTime);
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
if (timerId === undefined) {
|
|
2384
|
+
timerId = setTimeout(timerExpired, wait);
|
|
2385
|
+
}
|
|
2386
|
+
return result;
|
|
2387
|
+
}
|
|
2388
|
+
debounced.cancel = cancel;
|
|
2389
|
+
debounced.flush = flush;
|
|
2390
|
+
return debounced;
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
debounce_1 = debounce;
|
|
2394
|
+
return debounce_1;
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
var debounceExports = requireDebounce();
|
|
2398
|
+
var debounce = /*@__PURE__*/getDefaultExportFromCjs(debounceExports);
|
|
2399
|
+
|
|
1732
2400
|
/**
|
|
1733
2401
|
* Custom hook to manage async select field options with search, pagination, and error handling using React Query.
|
|
1734
2402
|
*
|
|
@@ -1756,10 +2424,10 @@ function useFieldOptions(field) {
|
|
|
1756
2424
|
var _a, _b, _c, _d, _e, _f;
|
|
1757
2425
|
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1758
2426
|
const queryClient = reactQuery.useQueryClient();
|
|
1759
|
-
// Generate a unique query key for this field
|
|
2427
|
+
// Generate a unique query key for this field including search query
|
|
1760
2428
|
const queryKey = react.useMemo(() => {
|
|
1761
|
-
return ["field-options", field.key, field.name];
|
|
1762
|
-
}, [field.key, field.name]);
|
|
2429
|
+
return ["field-options", field.key, field.name, searchQuery];
|
|
2430
|
+
}, [field.key, field.name, searchQuery]);
|
|
1763
2431
|
// Initial fetch query for static options or first page
|
|
1764
2432
|
const initialQuery = reactQuery.useQuery({
|
|
1765
2433
|
queryKey: [...queryKey, "initial"],
|
|
@@ -1771,7 +2439,8 @@ function useFieldOptions(field) {
|
|
|
1771
2439
|
.pagination) !== null && _b !== void 0 ? _b : {
|
|
1772
2440
|
sourceId: "",
|
|
1773
2441
|
sourceProject: "",
|
|
1774
|
-
limit:
|
|
2442
|
+
limit: 20,
|
|
2443
|
+
query: searchQuery,
|
|
1775
2444
|
offset: 0,
|
|
1776
2445
|
type: "OFFSET",
|
|
1777
2446
|
hasNextPage: false,
|
|
@@ -1795,7 +2464,8 @@ function useFieldOptions(field) {
|
|
|
1795
2464
|
initialPageParam: ((_c = (_b = field.optionsSource) === null || _b === void 0 ? void 0 : _b.pagination) !== null && _c !== void 0 ? _c : {
|
|
1796
2465
|
sourceId: "",
|
|
1797
2466
|
sourceProject: "",
|
|
1798
|
-
|
|
2467
|
+
query: searchQuery,
|
|
2468
|
+
limit: 20,
|
|
1799
2469
|
offset: 0,
|
|
1800
2470
|
type: "OFFSET",
|
|
1801
2471
|
hasNextPage: false,
|
|
@@ -1832,10 +2502,20 @@ function useFieldOptions(field) {
|
|
|
1832
2502
|
// and create a separate query for search results
|
|
1833
2503
|
return allOptions.filter((option) => option.label.toLowerCase().includes(searchQuery.toLowerCase()));
|
|
1834
2504
|
}, [allOptions, searchQuery]);
|
|
1835
|
-
//
|
|
1836
|
-
const
|
|
2505
|
+
// Create debounced search function
|
|
2506
|
+
const debouncedSearch = react.useMemo(() => debounce((query) => {
|
|
1837
2507
|
setSearchQuery(query);
|
|
1838
|
-
}, []);
|
|
2508
|
+
}, 500), []);
|
|
2509
|
+
// Search handler with debounce
|
|
2510
|
+
const search = react.useCallback((query) => {
|
|
2511
|
+
debouncedSearch(query);
|
|
2512
|
+
}, [debouncedSearch]);
|
|
2513
|
+
// Cleanup debounced function
|
|
2514
|
+
react.useEffect(() => {
|
|
2515
|
+
return () => {
|
|
2516
|
+
debouncedSearch.cancel();
|
|
2517
|
+
};
|
|
2518
|
+
}, [debouncedSearch]);
|
|
1839
2519
|
// Load more handler
|
|
1840
2520
|
const loadMore = react.useCallback(async () => {
|
|
1841
2521
|
if (infiniteQuery.hasNextPage && !infiniteQuery.isFetchingNextPage) {
|