@shuffleio/shuffle-mcps 0.0.64 → 0.0.66
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/{appsCache-A4OIDXIN.mjs → appsCache-QAL2GC5W.mjs} +1 -2
- package/dist/{chunk-2PFFYHRO.mjs → chunk-V3R4HDJT.mjs} +65 -16
- package/dist/index.d.mts +340 -334
- package/dist/index.d.ts +340 -334
- package/dist/index.js +13941 -70932
- package/dist/index.mjs +14911 -71180
- package/package.json +13 -3
- package/dist/analytics-JGBV375U.mjs +0 -20
- package/dist/auth-utils-HYVXQKTL.mjs +0 -12
- package/dist/chunk-2NCPSII6.mjs +0 -105
- package/dist/chunk-C7HCHOHU.mjs +0 -1208
- package/dist/chunk-PL74JBB4.mjs +0 -64
- package/dist/chunk-TUSSDUVQ.mjs +0 -155
- package/dist/datastore-TTQFTTDP.mjs +0 -27
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// fetchBreaker.ts
|
|
1
|
+
// ../Shuffle-Core/fetchBreaker.ts
|
|
2
2
|
var rewriteShufflerApiToShuffleSecurity = (input) => {
|
|
3
3
|
if (typeof window === "undefined") return input;
|
|
4
4
|
const currentHost = window.location.hostname.toLowerCase();
|
|
@@ -148,7 +148,11 @@ var synthetic503 = (key, retryInMs) => new Response(
|
|
|
148
148
|
{
|
|
149
149
|
status: 503,
|
|
150
150
|
statusText: "Service Unavailable (circuit breaker)",
|
|
151
|
-
headers: {
|
|
151
|
+
headers: {
|
|
152
|
+
"Content-Type": "application/json",
|
|
153
|
+
"Retry-After": String(Math.ceil(retryInMs / 1e3)),
|
|
154
|
+
"X-Circuit-Breaker": "open"
|
|
155
|
+
}
|
|
152
156
|
}
|
|
153
157
|
);
|
|
154
158
|
var registerProtectedOrigin = (url) => {
|
|
@@ -552,12 +556,6 @@ var isCapacitorNative = () => {
|
|
|
552
556
|
const cap = window.Capacitor;
|
|
553
557
|
return Boolean(cap?.isNativePlatform && cap.isNativePlatform());
|
|
554
558
|
};
|
|
555
|
-
var isIos = () => {
|
|
556
|
-
return getPlatform() === "ios";
|
|
557
|
-
};
|
|
558
|
-
var isAndroid = () => {
|
|
559
|
-
return getPlatform() === "android";
|
|
560
|
-
};
|
|
561
559
|
var isIosWebView = () => {
|
|
562
560
|
if (typeof window === "undefined") return false;
|
|
563
561
|
const cap = window.Capacitor;
|
|
@@ -589,7 +587,7 @@ if (typeof window !== "undefined") {
|
|
|
589
587
|
window.getPlatform = getPlatform;
|
|
590
588
|
}
|
|
591
589
|
|
|
592
|
-
// api.ts
|
|
590
|
+
// ../Shuffle-Core/api.ts
|
|
593
591
|
installFetchBreaker();
|
|
594
592
|
var DEV_BACKEND = "https://tunnel.schemaless.org";
|
|
595
593
|
var PROD_BACKEND = "https://uk.shuffle.security";
|
|
@@ -1003,18 +1001,66 @@ var hasShuffleAuth = () => {
|
|
|
1003
1001
|
}
|
|
1004
1002
|
};
|
|
1005
1003
|
|
|
1004
|
+
// ../Shuffle-Core/appsCache.ts
|
|
1005
|
+
var TTL_MS = 3e4;
|
|
1006
|
+
var ERROR_TTL_MS = 3e4;
|
|
1007
|
+
var cache = /* @__PURE__ */ new Map();
|
|
1008
|
+
var cacheKey = (o) => `${o.baseUrl}|${o.path || "/api/v1/apps"}|${o.apiKey || ""}|${o.orgId || ""}`;
|
|
1009
|
+
var doFetch = async (o) => {
|
|
1010
|
+
const headers = {
|
|
1011
|
+
...getAuthHeader(o.orgId || void 0)
|
|
1012
|
+
};
|
|
1013
|
+
if (o.apiKey) headers["Authorization"] = `Bearer ${o.apiKey}`;
|
|
1014
|
+
if (o.orgId) headers["Org-Id"] = o.orgId;
|
|
1015
|
+
const response = await fetch(`${o.baseUrl}${o.path || "/api/v1/apps"}`, {
|
|
1016
|
+
credentials: "include",
|
|
1017
|
+
headers
|
|
1018
|
+
});
|
|
1019
|
+
if (!response.ok) return [];
|
|
1020
|
+
const data = await response.json();
|
|
1021
|
+
if (Array.isArray(data)) return data;
|
|
1022
|
+
return Array.isArray(data?.data) ? data.data : [];
|
|
1023
|
+
};
|
|
1024
|
+
var fetchApps = (opts) => {
|
|
1025
|
+
const key = cacheKey(opts);
|
|
1026
|
+
const entry = cache.get(key) || {};
|
|
1027
|
+
if (entry.data && entry.fetchedAt && Date.now() - entry.fetchedAt < TTL_MS) {
|
|
1028
|
+
return Promise.resolve(entry.data);
|
|
1029
|
+
}
|
|
1030
|
+
if (entry.promise) return entry.promise;
|
|
1031
|
+
const promise = doFetch(opts).then((data) => {
|
|
1032
|
+
cache.set(key, { data, fetchedAt: Date.now() });
|
|
1033
|
+
return data;
|
|
1034
|
+
}).catch(() => {
|
|
1035
|
+
cache.set(key, { data: [], fetchedAt: Date.now() - (TTL_MS - ERROR_TTL_MS) });
|
|
1036
|
+
return [];
|
|
1037
|
+
});
|
|
1038
|
+
cache.set(key, { ...entry, promise });
|
|
1039
|
+
return promise;
|
|
1040
|
+
};
|
|
1041
|
+
var invalidateAppsCache = (opts) => {
|
|
1042
|
+
if (!opts) {
|
|
1043
|
+
cache.clear();
|
|
1044
|
+
return;
|
|
1045
|
+
}
|
|
1046
|
+
cache.delete(cacheKey(opts));
|
|
1047
|
+
};
|
|
1048
|
+
var fetchAppsViaApiConfig = () => {
|
|
1049
|
+
const headers = getAuthHeader();
|
|
1050
|
+
const orgId = headers["Org-Id"] || null;
|
|
1051
|
+
return fetchApps({
|
|
1052
|
+
baseUrl: API_CONFIG.baseUrl,
|
|
1053
|
+
apiKey: API_CONFIG.apiKey,
|
|
1054
|
+
orgId
|
|
1055
|
+
});
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1006
1058
|
export {
|
|
1007
1059
|
registerProtectedOrigin,
|
|
1008
1060
|
installFetchBreaker,
|
|
1009
1061
|
resolveProductLink,
|
|
1010
|
-
isCapacitorNative,
|
|
1011
|
-
isIos,
|
|
1012
|
-
isAndroid,
|
|
1013
|
-
isIosWebView,
|
|
1014
|
-
isAndroidWebView,
|
|
1015
1062
|
isShuffleCloudDomain,
|
|
1016
1063
|
mapCloudRegionUrl,
|
|
1017
|
-
isDevEnvironment,
|
|
1018
1064
|
isCloudDomain,
|
|
1019
1065
|
isCloud,
|
|
1020
1066
|
isOnprem,
|
|
@@ -1030,5 +1076,8 @@ export {
|
|
|
1030
1076
|
getApiUrl,
|
|
1031
1077
|
shuffleFetch,
|
|
1032
1078
|
getAuthHeader,
|
|
1033
|
-
hasShuffleAuth
|
|
1079
|
+
hasShuffleAuth,
|
|
1080
|
+
fetchApps,
|
|
1081
|
+
invalidateAppsCache,
|
|
1082
|
+
fetchAppsViaApiConfig
|
|
1034
1083
|
};
|