@dev-fastn-ai/react-core 1.0.20 → 2.0.1
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 +12 -11
- package/dist/core/src/utils/errors.d.ts +3 -3
- package/dist/index.cjs.js +720 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.esm.js +717 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/react-core/src/index.d.ts +2 -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",
|
|
@@ -1352,7 +1352,6 @@ async function initializeGooglePicker() {
|
|
|
1352
1352
|
return new Promise((resolve) => {
|
|
1353
1353
|
// @ts-ignore
|
|
1354
1354
|
gapi.load('picker', () => {
|
|
1355
|
-
console.log('gapi loaded');
|
|
1356
1355
|
resolve();
|
|
1357
1356
|
});
|
|
1358
1357
|
});
|
|
@@ -1410,7 +1409,10 @@ function openGoogleFilesPicker(parentArgs) {
|
|
|
1410
1409
|
const config = getConfig();
|
|
1411
1410
|
let accessToken = null;
|
|
1412
1411
|
let apiKey = null;
|
|
1413
|
-
const cachedToken = localStorage.getItem(config.spaceId +
|
|
1412
|
+
const cachedToken = localStorage.getItem(config.spaceId +
|
|
1413
|
+
parentArgs.connectorId +
|
|
1414
|
+
config.tenantId +
|
|
1415
|
+
"access_token");
|
|
1414
1416
|
if (cachedToken) {
|
|
1415
1417
|
const token = safeParse(cachedToken);
|
|
1416
1418
|
if ((token === null || token === void 0 ? void 0 : token.expires_at) && token.expires_at > Date.now()) {
|
|
@@ -1428,7 +1430,10 @@ function openGoogleFilesPicker(parentArgs) {
|
|
|
1428
1430
|
});
|
|
1429
1431
|
const token = data === null || data === void 0 ? void 0 : data.connectorConnection;
|
|
1430
1432
|
// cache token in local storage
|
|
1431
|
-
localStorage.setItem(config.spaceId +
|
|
1433
|
+
localStorage.setItem(config.spaceId +
|
|
1434
|
+
parentArgs.connectorId +
|
|
1435
|
+
config.tenantId +
|
|
1436
|
+
"access_token", safeStringify({
|
|
1432
1437
|
access_token: token.access_token,
|
|
1433
1438
|
api_key: (_a = token.metadata) === null || _a === void 0 ? void 0 : _a.google_picker_api_key,
|
|
1434
1439
|
expires_at: token.expires_at || Date.now() + token.expires_in * 1000,
|
|
@@ -1453,10 +1458,13 @@ function openGoogleFilesPicker(parentArgs) {
|
|
|
1453
1458
|
* Returns a submit handler for a configuration form.
|
|
1454
1459
|
* Handles both creation and update flows.
|
|
1455
1460
|
*/
|
|
1456
|
-
function getSubmitHandler({ configuration, configurationId, connectorId, }) {
|
|
1461
|
+
function getSubmitHandler({ configuration, configurationId, connectorId, connectorIdUiCode, configurationIdUiCode, }) {
|
|
1457
1462
|
return async ({ formData }) => {
|
|
1463
|
+
var _a, _b, _c, _d, _e;
|
|
1458
1464
|
const config = getConfig();
|
|
1459
|
-
const uiCode =
|
|
1465
|
+
const uiCodeObject = Object.assign(Object.assign({}, safeParse(configuration.uiCode)), { target: Object.assign(Object.assign({}, (_a = safeParse(configuration.uiCode)) === null || _a === void 0 ? void 0 : _a.target), { connectorId: Object.assign(Object.assign({}, (_c = (_b = safeParse(configuration.uiCode)) === null || _b === void 0 ? void 0 : _b.target) === null || _c === void 0 ? void 0 : _c.connectorId), { target: connectorIdUiCode }), id: Object.assign(Object.assign({}, (_e = (_d = safeParse(configuration.uiCode)) === null || _d === void 0 ? void 0 : _d.target) === null || _e === void 0 ? void 0 : _e.id), { target: configurationIdUiCode }) }) });
|
|
1466
|
+
const formDataObject = Object.assign(Object.assign({}, formData), { connectorId: connectorId, id: configurationId });
|
|
1467
|
+
const uiCode = populateFormDataInUiCode(safeStringify(uiCodeObject), formDataObject);
|
|
1460
1468
|
try {
|
|
1461
1469
|
if (configuration.status === "ENABLED") {
|
|
1462
1470
|
await updateTenantConfiguration({
|
|
@@ -1468,7 +1476,7 @@ function getSubmitHandler({ configuration, configurationId, connectorId, }) {
|
|
|
1468
1476
|
uiCode: safeStringify(uiCode),
|
|
1469
1477
|
id: configurationId,
|
|
1470
1478
|
connectorId: connectorId,
|
|
1471
|
-
configurations:
|
|
1479
|
+
configurations: formDataObject,
|
|
1472
1480
|
}),
|
|
1473
1481
|
});
|
|
1474
1482
|
}
|
|
@@ -1482,7 +1490,7 @@ function getSubmitHandler({ configuration, configurationId, connectorId, }) {
|
|
|
1482
1490
|
uiCode: safeStringify(uiCode),
|
|
1483
1491
|
id: configurationId,
|
|
1484
1492
|
connectorId: connectorId,
|
|
1485
|
-
configurations:
|
|
1493
|
+
configurations: formDataObject,
|
|
1486
1494
|
}),
|
|
1487
1495
|
});
|
|
1488
1496
|
}
|
|
@@ -1530,7 +1538,7 @@ async function fetchOptions(context, pagination, resetCursor = false, query) {
|
|
|
1530
1538
|
const total = (_b = response.total) !== null && _b !== void 0 ? _b : pagination.total;
|
|
1531
1539
|
const cursor = response.cursor || response.curser;
|
|
1532
1540
|
const hasNextPage = Boolean(cursor || response.hasNextPage) ||
|
|
1533
|
-
(typeof total ===
|
|
1541
|
+
(typeof total === "number"
|
|
1534
1542
|
? total > newOffset
|
|
1535
1543
|
: newOptions.length === limit && !pagination.cursor);
|
|
1536
1544
|
return {
|
|
@@ -1558,8 +1566,8 @@ async function refreshOptions(pagination, context) {
|
|
|
1558
1566
|
/**
|
|
1559
1567
|
* Gets options for a select field.
|
|
1560
1568
|
*/
|
|
1561
|
-
async function getOptions(pagination, context) {
|
|
1562
|
-
return fetchOptions(context || {}, pagination, false);
|
|
1569
|
+
async function getOptions(pagination, context, query) {
|
|
1570
|
+
return fetchOptions(context || {}, pagination, false, query);
|
|
1563
1571
|
}
|
|
1564
1572
|
/**
|
|
1565
1573
|
* Searches options for a select field.
|
|
@@ -1574,7 +1582,7 @@ async function searchOptions(query, pagination, context) {
|
|
|
1574
1582
|
* @returns Promise<ConfigurationForm>
|
|
1575
1583
|
*/
|
|
1576
1584
|
async function getConfigurationForm(input) {
|
|
1577
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
1585
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1578
1586
|
try {
|
|
1579
1587
|
const config = getConfig();
|
|
1580
1588
|
const { data: configurationFormData } = await getConfigurationSubscriptionById({
|
|
@@ -1589,22 +1597,31 @@ async function getConfigurationForm(input) {
|
|
|
1589
1597
|
});
|
|
1590
1598
|
const uiCodeString = (_b = configurationFormData === null || configurationFormData === void 0 ? void 0 : configurationFormData.tenantConfigurationsById) === null || _b === void 0 ? void 0 : _b.uiCode;
|
|
1591
1599
|
const uiCode = safeParse(uiCodeString || "") || {};
|
|
1592
|
-
|
|
1600
|
+
// remove connectorId and id field from uiCode.target and save that in separate fields
|
|
1601
|
+
const connectorIdUiCode = (_c = uiCode === null || uiCode === void 0 ? void 0 : uiCode.target) === null || _c === void 0 ? void 0 : _c.connectorId;
|
|
1602
|
+
const configurationIdUiCode = (_d = uiCode === null || uiCode === void 0 ? void 0 : uiCode.target) === null || _d === void 0 ? void 0 : _d.id;
|
|
1603
|
+
(_e = uiCode === null || uiCode === void 0 ? void 0 : uiCode.target) === null || _e === void 0 ? true : delete _e.connectorId;
|
|
1604
|
+
(_f = uiCode === null || uiCode === void 0 ? void 0 : uiCode.target) === null || _f === void 0 ? true : delete _f.id;
|
|
1605
|
+
const fields = uiCodeToFormFields(uiCode, {
|
|
1593
1606
|
getOptions,
|
|
1594
1607
|
loadMore: loadMoreOptions,
|
|
1595
1608
|
refresh: refreshOptions,
|
|
1596
1609
|
searchOptions,
|
|
1597
|
-
openGoogleFilesPicker: openGoogleFilesPicker({
|
|
1610
|
+
openGoogleFilesPicker: openGoogleFilesPicker({
|
|
1611
|
+
connectorId: input.connectorId,
|
|
1612
|
+
}),
|
|
1598
1613
|
});
|
|
1599
1614
|
return {
|
|
1600
|
-
name: ((
|
|
1601
|
-
description: ((
|
|
1602
|
-
imageUri: ((
|
|
1615
|
+
name: ((_g = input === null || input === void 0 ? void 0 : input.configuration) === null || _g === void 0 ? void 0 : _g.name) || "",
|
|
1616
|
+
description: ((_h = input === null || input === void 0 ? void 0 : input.configuration) === null || _h === void 0 ? void 0 : _h.description) || "",
|
|
1617
|
+
imageUri: ((_j = input === null || input === void 0 ? void 0 : input.configuration) === null || _j === void 0 ? void 0 : _j.imageUri) || "",
|
|
1603
1618
|
fields: fields,
|
|
1604
1619
|
submitHandler: getSubmitHandler({
|
|
1605
1620
|
configuration: configurationFormData === null || configurationFormData === void 0 ? void 0 : configurationFormData.tenantConfigurationsById,
|
|
1606
1621
|
configurationId: input === null || input === void 0 ? void 0 : input.configurationId,
|
|
1607
1622
|
connectorId: input === null || input === void 0 ? void 0 : input.connectorId,
|
|
1623
|
+
connectorIdUiCode: connectorIdUiCode,
|
|
1624
|
+
configurationIdUiCode: configurationIdUiCode,
|
|
1608
1625
|
}),
|
|
1609
1626
|
};
|
|
1610
1627
|
}
|
|
@@ -1614,7 +1631,6 @@ async function getConfigurationForm(input) {
|
|
|
1614
1631
|
}
|
|
1615
1632
|
|
|
1616
1633
|
const registerRefetchFunction = (input) => {
|
|
1617
|
-
console.log("registering refetch function", input);
|
|
1618
1634
|
const { refetchFunction, refetchKey } = input;
|
|
1619
1635
|
};
|
|
1620
1636
|
|
|
@@ -1721,6 +1737,666 @@ const useConnectors = () => {
|
|
|
1721
1737
|
return query;
|
|
1722
1738
|
};
|
|
1723
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
|
+
|
|
1724
2400
|
/**
|
|
1725
2401
|
* Custom hook to manage async select field options with search, pagination, and error handling using React Query.
|
|
1726
2402
|
*
|
|
@@ -1748,10 +2424,10 @@ function useFieldOptions(field) {
|
|
|
1748
2424
|
var _a, _b, _c, _d, _e, _f;
|
|
1749
2425
|
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1750
2426
|
const queryClient = reactQuery.useQueryClient();
|
|
1751
|
-
// Generate a unique query key for this field
|
|
2427
|
+
// Generate a unique query key for this field including search query
|
|
1752
2428
|
const queryKey = react.useMemo(() => {
|
|
1753
|
-
return ["field-options", field.key, field.name];
|
|
1754
|
-
}, [field.key, field.name]);
|
|
2429
|
+
return ["field-options", field.key, field.name, searchQuery];
|
|
2430
|
+
}, [field.key, field.name, searchQuery]);
|
|
1755
2431
|
// Initial fetch query for static options or first page
|
|
1756
2432
|
const initialQuery = reactQuery.useQuery({
|
|
1757
2433
|
queryKey: [...queryKey, "initial"],
|
|
@@ -1763,7 +2439,8 @@ function useFieldOptions(field) {
|
|
|
1763
2439
|
.pagination) !== null && _b !== void 0 ? _b : {
|
|
1764
2440
|
sourceId: "",
|
|
1765
2441
|
sourceProject: "",
|
|
1766
|
-
limit:
|
|
2442
|
+
limit: 20,
|
|
2443
|
+
query: searchQuery,
|
|
1767
2444
|
offset: 0,
|
|
1768
2445
|
type: "OFFSET",
|
|
1769
2446
|
hasNextPage: false,
|
|
@@ -1787,7 +2464,8 @@ function useFieldOptions(field) {
|
|
|
1787
2464
|
initialPageParam: ((_c = (_b = field.optionsSource) === null || _b === void 0 ? void 0 : _b.pagination) !== null && _c !== void 0 ? _c : {
|
|
1788
2465
|
sourceId: "",
|
|
1789
2466
|
sourceProject: "",
|
|
1790
|
-
|
|
2467
|
+
query: searchQuery,
|
|
2468
|
+
limit: 20,
|
|
1791
2469
|
offset: 0,
|
|
1792
2470
|
type: "OFFSET",
|
|
1793
2471
|
hasNextPage: false,
|
|
@@ -1824,10 +2502,20 @@ function useFieldOptions(field) {
|
|
|
1824
2502
|
// and create a separate query for search results
|
|
1825
2503
|
return allOptions.filter((option) => option.label.toLowerCase().includes(searchQuery.toLowerCase()));
|
|
1826
2504
|
}, [allOptions, searchQuery]);
|
|
1827
|
-
//
|
|
1828
|
-
const
|
|
2505
|
+
// Create debounced search function
|
|
2506
|
+
const debouncedSearch = react.useMemo(() => debounce((query) => {
|
|
1829
2507
|
setSearchQuery(query);
|
|
1830
|
-
}, []);
|
|
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]);
|
|
1831
2519
|
// Load more handler
|
|
1832
2520
|
const loadMore = react.useCallback(async () => {
|
|
1833
2521
|
if (infiniteQuery.hasNextPage && !infiniteQuery.isFetchingNextPage) {
|
|
@@ -1880,15 +2568,13 @@ function useFieldOptions(field) {
|
|
|
1880
2568
|
};
|
|
1881
2569
|
}
|
|
1882
2570
|
|
|
2571
|
+
Object.defineProperty(exports, "Fastn", {
|
|
2572
|
+
enumerable: true,
|
|
2573
|
+
get: function () { return core.Fastn; }
|
|
2574
|
+
});
|
|
1883
2575
|
exports.FastnProvider = FastnProvider;
|
|
1884
2576
|
exports.useConfigurationForm = useConfigurationForm;
|
|
1885
2577
|
exports.useConfigurations = useConfigurations;
|
|
1886
2578
|
exports.useConnectors = useConnectors;
|
|
1887
2579
|
exports.useFieldOptions = useFieldOptions;
|
|
1888
|
-
Object.keys(core).forEach(function (k) {
|
|
1889
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
1890
|
-
enumerable: true,
|
|
1891
|
-
get: function () { return core[k]; }
|
|
1892
|
-
});
|
|
1893
|
-
});
|
|
1894
2580
|
//# sourceMappingURL=index.cjs.js.map
|