@hot-updater/console 0.36.7 → 1.0.0-rc.0
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/.output/nitro.json +1 -1
- package/.output/public/assets/AnalyticsCapabilityContext-BCke57-7.js +1 -0
- package/.output/public/assets/BundleActivityChart-CnsBe_1J.js +42 -0
- package/.output/public/assets/BundleIdDisplay-Dky75zLU.js +1 -0
- package/.output/public/assets/alert-C-1KvDW8.js +1 -0
- package/.output/public/assets/analytics-Bqz0c-BT.js +1 -0
- package/.output/public/assets/analytics-api-CJdrTLLO.js +1 -0
- package/.output/public/assets/api-B_Rh-uzC.js +1 -0
- package/.output/public/assets/api-keys-BurCFhzH.js +1 -0
- package/.output/public/assets/api-keys-api-BEDJdQg3.js +1 -0
- package/.output/public/assets/badge-Bf0fZ-Gx.js +1 -0
- package/.output/public/assets/chart-no-axes-combined-FaYMGmQS.js +1 -0
- package/.output/public/assets/createServerFn-gM2-LFBy.js +3 -0
- package/.output/public/assets/dialog-BS60BRr2.js +1 -0
- package/.output/public/assets/dist-DspNKfMj.js +1 -0
- package/.output/public/assets/download-O-yNBc9H.js +1 -0
- package/.output/public/assets/field-Buq148-A.js +1 -0
- package/.output/public/assets/index-kFhd2S78.js +10 -0
- package/.output/public/assets/installations-BrQ-od41.js +2 -0
- package/.output/public/assets/installations-CGlZ3ROz.js +1 -0
- package/.output/public/assets/lazyRouteComponent-rPzgA7S-.js +1 -0
- package/.output/public/assets/loader-circle-DCYF-wJl.js +1 -0
- package/.output/public/assets/preload-helper-TKOBYGYD.js +1 -0
- package/.output/public/assets/refresh-cw-n8XYbPPj.js +1 -0
- package/.output/public/assets/routes-CrdokJ80.js +1 -0
- package/.output/public/assets/routes-DcQnVajO.js +2 -0
- package/.output/public/assets/search-DLhbWw3W.js +1 -0
- package/.output/public/assets/shield-check-DE_hVuHu.js +1 -0
- package/.output/public/assets/signing-HRexfjsH.js +1 -0
- package/.output/public/assets/styles-eB4EtvFS.css +2 -0
- package/.output/public/assets/table-D8CLieHX.js +1 -0
- package/.output/public/assets/textarea-YJLTVAoq.js +1 -0
- package/.output/public/assets/useMutation-JsGVjQMY.js +1 -0
- package/.output/public/assets/useOpenInteractionType-4cRD5xO0.js +1 -0
- package/.output/server/__23tanstack-start-server-fn-resolver-DBP9TQ7K.mjs +146 -0
- package/.output/server/_libs/@base-ui/react+[...].mjs +16124 -0
- package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +1554 -0
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +41 -10
- package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +132 -0
- package/.output/server/_libs/d3-array.mjs +231 -0
- package/.output/server/_libs/d3-color.mjs +330 -0
- package/.output/server/_libs/d3-format.mjs +252 -0
- package/.output/server/_libs/d3-interpolate.mjs +207 -0
- package/.output/server/_libs/d3-path.mjs +77 -0
- package/.output/server/_libs/d3-scale+[...].mjs +1907 -0
- package/.output/server/_libs/d3-shape.mjs +818 -0
- package/.output/server/_libs/decimal.js-light.mjs +884 -0
- package/.output/server/_libs/es-toolkit.mjs +1134 -0
- package/.output/server/_libs/eventemitter3.mjs +236 -0
- package/.output/server/_libs/immer.mjs +532 -0
- package/.output/server/_libs/lucide-react.mjs +141 -13
- package/.output/server/_libs/next-themes.mjs +2 -2
- package/.output/server/_libs/react-redux+[...].mjs +205 -0
- package/.output/server/_libs/recharts+[...].mjs +14117 -0
- package/.output/server/_libs/sonner.mjs +2 -2
- package/.output/server/_libs/tanstack__query-core.mjs +114 -1
- package/.output/server/_libs/tanstack__react-query.mjs +3 -4
- package/.output/server/_runtime.mjs +10 -1
- package/.output/server/_ssr/AnalyticsCapabilityContext-ui4DX8GO.mjs +15 -0
- package/.output/server/_ssr/BundleActivityChart-BiB9ZORH.mjs +288 -0
- package/.output/server/_ssr/BundleIdDisplay-Czk6iR6p.mjs +13 -0
- package/.output/server/_ssr/alert-Dim3MGY5.mjs +86 -0
- package/.output/server/_ssr/analytics-DtMTn8fn.mjs +858 -0
- package/.output/server/_ssr/analytics-api-Cg1M5v_H.mjs +71 -0
- package/.output/server/_ssr/analytics-input-fRRRn0uA.mjs +96 -0
- package/.output/server/_ssr/analytics-rpc-DY5uXvHT.mjs +155 -0
- package/.output/server/_ssr/api-BTSv1tZb.mjs +282 -0
- package/.output/server/_ssr/api-keys-BnM_o2nS.mjs +300 -0
- package/.output/server/_ssr/api-keys-api-CIywsSF5.mjs +60 -0
- package/.output/server/_ssr/api-keys-rpc-BSp1wkIV.mjs +136 -0
- package/.output/server/_ssr/api-rpc-cG5wd_tO.mjs +1468 -0
- package/.output/server/_ssr/auth-BF8mbAgF.mjs +21 -0
- package/.output/server/_ssr/auth-rpc-BrJ6obHJ.mjs +24 -0
- package/.output/server/_ssr/auth.server-DwKoZoQM.mjs +50 -0
- package/.output/server/_ssr/badge-DCxbEeof.mjs +26 -0
- package/.output/server/_ssr/bundle-signing-rpc-COoQhW8E.mjs +16 -0
- package/.output/server/_ssr/bundle-signing.server-D5u8KkMp.mjs +51 -0
- package/.output/server/_ssr/config-Dv8qLDZ0.mjs +13 -0
- package/.output/server/_ssr/config.server-DEiLhKmy.mjs +361 -0
- package/.output/server/_ssr/{createServerFn-DzU0k62V.mjs → createServerFn-B2hcXoPM.mjs} +1 -1
- package/.output/server/_ssr/createServerRpc-DB29C_5p.mjs +12 -0
- package/.output/server/_ssr/{sidebar-Cv_H0_Jv.mjs → createSsrRpc-9P0S0lJ3.mjs} +68 -50
- package/.output/server/_ssr/databaseRows-CwbNwYSl.mjs +166 -0
- package/.output/server/_ssr/deleteBundle-Cu_XOMt0.mjs +66 -0
- package/.output/server/_ssr/dialog-CQuRMNZ4.mjs +170 -0
- package/.output/server/_ssr/dist-BVSLTpoP.mjs +250 -0
- package/.output/server/_ssr/downloadBundle-CNnYxYO2.mjs +24 -0
- package/.output/server/_ssr/{empty-plugin-adapters-B4HCzgmM.mjs → empty-plugin-adapters-B5QvGpEl.mjs} +1 -1
- package/.output/server/_ssr/field-DRIXKjZG.mjs +74 -0
- package/.output/server/_ssr/{getBundleChildren-CVtSiH5t.mjs → getBundleChildren-BcRMFoDF.mjs} +10 -18
- package/.output/server/_ssr/installations-B-azgAvX.mjs +19 -0
- package/.output/server/_ssr/installations-Ctvzp2JH.mjs +535 -0
- package/.output/server/_ssr/router-C-KUBfOi.mjs +513 -0
- package/.output/server/_ssr/routes-BM4ht9jb.mjs +2286 -0
- package/.output/server/_ssr/routes-Z7TwC6nC.mjs +37 -0
- package/.output/server/_ssr/runtime.server-awTLiiXW.mjs +527 -0
- package/.output/server/_ssr/server-BjzmvXnO.mjs +7468 -0
- package/.output/server/_ssr/signing-k8GxyBDF.mjs +202 -0
- package/.output/server/_ssr/ssr.mjs +4 -5740
- package/.output/server/_ssr/start-DpViQGnt.mjs +4 -0
- package/.output/server/_ssr/table-v1yCvYo7.mjs +53 -0
- package/.output/server/_ssr/textarea-DYHnskhb.mjs +14 -0
- package/.output/server/_ssr/uuidv7-BbJ-9D_I.mjs +31 -0
- package/.output/server/_tanstack-start-manifest_v-CH4StzJu.mjs +108 -0
- package/.output/server/index.mjs +256 -53
- package/README.md +29 -8
- package/lib/index.d.mts +36 -0
- package/lib/index.mjs +4 -0
- package/lib/vite-internal.mjs +127 -0
- package/lib/vite.d.mts +10 -0
- package/lib/vite.mjs +5 -0
- package/package.json +51 -29
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/logo.svg +1 -0
- package/public/manifest.json +30 -0
- package/public/robots.txt +3 -0
- package/src/components/AppSidebar.tsx +159 -0
- package/src/components/BundleIdDisplay.tsx +18 -0
- package/src/components/ChannelBadge.tsx +31 -0
- package/src/components/ConsoleAccessPage.tsx +122 -0
- package/src/components/EnabledStatusIcon.tsx +54 -0
- package/src/components/HashValueDisplay.tsx +85 -0
- package/src/components/HotUpdaterLogo.tsx +30 -0
- package/src/components/NotFoundPage.tsx +33 -0
- package/src/components/PlatformIcon.tsx +39 -0
- package/src/components/RolloutPercentageBadge.tsx +28 -0
- package/src/components/ThemeProvider.tsx +116 -0
- package/src/components/TimestampDisplay.tsx +41 -0
- package/src/components/features/analytics/ActivityChart.tsx +150 -0
- package/src/components/features/analytics/AnalyticsCapabilityContext.tsx +24 -0
- package/src/components/features/analytics/AnalyticsControls.tsx +115 -0
- package/src/components/features/analytics/AnalyticsErrorAlert.tsx +21 -0
- package/src/components/features/analytics/AnalyticsOverview.tsx +208 -0
- package/src/components/features/analytics/BundleDistribution.tsx +133 -0
- package/src/components/features/analytics/BundleSelector.tsx +114 -0
- package/src/components/features/analytics/InstallationHistoryCard.tsx +248 -0
- package/src/components/features/analytics/InstallationMatchesCard.tsx +132 -0
- package/src/components/features/analytics/InstallationPageHeader.tsx +138 -0
- package/src/components/features/analytics/InstallationPagination.tsx +48 -0
- package/src/components/features/analytics/InstallationSearch.tsx +230 -0
- package/src/components/features/analytics/UpdateOutcomes.tsx +147 -0
- package/src/components/features/api-keys/ApiKeysPage.tsx +377 -0
- package/src/components/features/bundles/BundleActivityChart.tsx +193 -0
- package/src/components/features/bundles/BundleAnalyticsSummary.tsx +123 -0
- package/src/components/features/bundles/BundleChildrenPanel.tsx +201 -0
- package/src/components/features/bundles/BundleMetadata.tsx +136 -0
- package/src/components/features/bundles/RolloutCohortsDialog.tsx +201 -0
- package/src/components/features/channels/ChannelManagementDialog.tsx +228 -0
- package/src/components/features/releases/ReleaseEditorSheet.tsx +879 -0
- package/src/components/features/releases/ReleaseStateBadge.tsx +20 -0
- package/src/components/features/signing/BundleSigningPage.tsx +247 -0
- package/src/components/ui/alert-dialog.tsx +185 -0
- package/src/components/ui/alert.tsx +76 -0
- package/src/components/ui/badge.tsx +49 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/card.tsx +89 -0
- package/src/components/ui/chart.tsx +371 -0
- package/src/components/ui/combobox.tsx +303 -0
- package/src/components/ui/dialog.tsx +156 -0
- package/src/components/ui/dropdown-menu.tsx +270 -0
- package/src/components/ui/field.tsx +235 -0
- package/src/components/ui/input-group.tsx +147 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/label.tsx +25 -0
- package/src/components/ui/progress.tsx +84 -0
- package/src/components/ui/select.tsx +205 -0
- package/src/components/ui/separator.tsx +23 -0
- package/src/components/ui/sheet.tsx +132 -0
- package/src/components/ui/sidebar.tsx +779 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +56 -0
- package/src/components/ui/sonner.tsx +45 -0
- package/src/components/ui/switch.tsx +25 -0
- package/src/components/ui/table.tsx +114 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/toggle-group.tsx +89 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +66 -0
- package/src/hooks/use-mobile.ts +30 -0
- package/src/index.ts +48 -0
- package/src/lib/analytics-api.ts +145 -0
- package/src/lib/analytics-error.ts +19 -0
- package/src/lib/analytics-input.ts +187 -0
- package/src/lib/analytics-overview.ts +170 -0
- package/src/lib/analytics-rpc.ts +218 -0
- package/src/lib/api-keys-api.ts +69 -0
- package/src/lib/api-keys-rpc.ts +87 -0
- package/src/lib/api-rpc.ts +478 -0
- package/src/lib/api.ts +444 -0
- package/src/lib/auth-rpc.ts +16 -0
- package/src/lib/bundle-signing-api.ts +14 -0
- package/src/lib/bundle-signing-rpc.ts +16 -0
- package/src/lib/constants.ts +1 -0
- package/src/lib/git.ts +51 -0
- package/src/lib/server/auth.server.ts +43 -0
- package/src/lib/server/bundle-signing.server.ts +100 -0
- package/src/lib/server/config.server.ts +109 -0
- package/src/lib/server/console-runtime.server.ts +70 -0
- package/src/lib/server/deleteBundle.ts +145 -0
- package/src/lib/server/downloadBundle.ts +46 -0
- package/src/lib/server/getBundleChildren.ts +130 -0
- package/src/lib/server/listReleases.ts +61 -0
- package/src/lib/server/releaseActivity.ts +27 -0
- package/src/lib/server/releaseReachability.ts +95 -0
- package/src/lib/server/runtime.server.ts +172 -0
- package/src/lib/utils.ts +9 -0
- package/src/logo.svg +1 -0
- package/src/routeTree.gen.ts +199 -0
- package/src/router.tsx +21 -0
- package/src/routes/-installations-search.ts +19 -0
- package/src/routes/-releases-search.ts +74 -0
- package/src/routes/__root.tsx +174 -0
- package/src/routes/analytics.tsx +139 -0
- package/src/routes/api/auth/$.ts +19 -0
- package/src/routes/api/bundles/$bundleId/download.ts +17 -0
- package/src/routes/api-keys.tsx +37 -0
- package/src/routes/index.tsx +982 -0
- package/src/routes/installations.tsx +194 -0
- package/src/routes/signing.tsx +37 -0
- package/src/styles.css +152 -0
- package/src/virtual-modules.d.ts +21 -0
- package/src/vite-env.d.ts +1 -0
- package/src/vite-internal.ts +195 -0
- package/src/vite.ts +12 -0
- package/.output/public/assets/dist-DJX53faP.js +0 -3
- package/.output/public/assets/index-Iylis5kY.js +0 -10
- package/.output/public/assets/routes-HT21hs0C.js +0 -54
- package/.output/public/assets/styles-C0Re4quB.css +0 -2
- package/.output/server/__23tanstack-start-server-fn-resolver-CgwgZ0-i.mjs +0 -66
- package/.output/server/_libs/@floating-ui/core+[...].mjs +0 -698
- package/.output/server/_libs/@floating-ui/dom+[...].mjs +0 -644
- package/.output/server/_libs/@floating-ui/react-dom+[...].mjs +0 -839
- package/.output/server/_libs/@radix-ui/react-alert-dialog+[...].mjs +0 -2138
- package/.output/server/_libs/@radix-ui/react-popper+[...].mjs +0 -308
- package/.output/server/_libs/@radix-ui/react-select+[...].mjs +0 -1038
- package/.output/server/_libs/@tanstack/devtools-event-client+[...].mjs +0 -196
- package/.output/server/_libs/@tanstack/form-core+[...].mjs +0 -3228
- package/.output/server/_libs/@tanstack/react-form+[...].mjs +0 -430
- package/.output/server/_libs/@tanstack/react-table+[...].mjs +0 -2382
- package/.output/server/_libs/radix-ui__number.mjs +0 -6
- package/.output/server/_libs/radix-ui__primitive.mjs +0 -9
- package/.output/server/_libs/radix-ui__react-arrow.mjs +0 -23
- package/.output/server/_libs/radix-ui__react-collection.mjs +0 -78
- package/.output/server/_libs/radix-ui__react-direction.mjs +0 -13
- package/.output/server/_libs/radix-ui__react-label.mjs +0 -22
- package/.output/server/_libs/radix-ui__react-separator.mjs +0 -30
- package/.output/server/_libs/radix-ui__react-slider.mjs +0 -510
- package/.output/server/_libs/radix-ui__react-switch.mjs +0 -157
- package/.output/server/_libs/radix-ui__react-tooltip.mjs +0 -493
- package/.output/server/_ssr/api-rpc-BIbDUKSz.mjs +0 -292
- package/.output/server/_ssr/config.server-BSS366KT.mjs +0 -41
- package/.output/server/_ssr/deleteBundle-BgbZTtpW.mjs +0 -141
- package/.output/server/_ssr/dist-KboydRVk.mjs +0 -120
- package/.output/server/_ssr/router-C3hqEy3k.mjs +0 -307
- package/.output/server/_ssr/routes-B0lQvvlC.mjs +0 -3048
- package/.output/server/_ssr/start-02sLteYG.mjs +0 -4
- package/.output/server/_ssr/storageProfile-FVkjPoGb.mjs +0 -9
- package/.output/server/_tanstack-start-manifest_v-Bpx52WOU.mjs +0 -20
- package/.output/server/node_modules/tslib/modules/index.js +0 -70
- package/.output/server/node_modules/tslib/modules/package.json +0 -3
- package/.output/server/node_modules/tslib/package.json +0 -47
- package/.output/server/node_modules/tslib/tslib.js +0 -484
- package/.output/server/package.json +0 -9
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@tanstack+devtools-event-client@0.4.3/node_modules/@tanstack/devtools-event-client/dist/esm/plugin.js
|
|
2
|
-
var EventClient = class {
|
|
3
|
-
#enabled = true;
|
|
4
|
-
#pluginId;
|
|
5
|
-
#eventTarget;
|
|
6
|
-
#debug;
|
|
7
|
-
#queuedEvents;
|
|
8
|
-
#connected;
|
|
9
|
-
#connectIntervalId;
|
|
10
|
-
#connectEveryMs;
|
|
11
|
-
#retryCount = 0;
|
|
12
|
-
#maxRetries = 5;
|
|
13
|
-
#connecting = false;
|
|
14
|
-
#failedToConnect = false;
|
|
15
|
-
#internalEventTarget = null;
|
|
16
|
-
#onConnected = () => {
|
|
17
|
-
this.debugLog("Connected to event bus");
|
|
18
|
-
this.#connected = true;
|
|
19
|
-
this.#connecting = false;
|
|
20
|
-
this.debugLog("Emitting queued events", this.#queuedEvents);
|
|
21
|
-
this.#queuedEvents.forEach((event) => this.emitEventToBus(event));
|
|
22
|
-
this.#queuedEvents = [];
|
|
23
|
-
this.stopConnectLoop();
|
|
24
|
-
this.#eventTarget().removeEventListener("tanstack-connect-success", this.#onConnected);
|
|
25
|
-
};
|
|
26
|
-
#retryConnection = () => {
|
|
27
|
-
if (this.#retryCount < this.#maxRetries) {
|
|
28
|
-
this.#retryCount++;
|
|
29
|
-
this.dispatchCustomEvent("tanstack-connect", {});
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
this.#eventTarget().removeEventListener("tanstack-connect", this.#retryConnection);
|
|
33
|
-
this.#failedToConnect = true;
|
|
34
|
-
this.debugLog("Max retries reached, giving up on connection");
|
|
35
|
-
this.stopConnectLoop();
|
|
36
|
-
};
|
|
37
|
-
#connectFunction = () => {
|
|
38
|
-
if (this.#connecting) return;
|
|
39
|
-
this.#connecting = true;
|
|
40
|
-
this.#eventTarget().addEventListener("tanstack-connect-success", this.#onConnected);
|
|
41
|
-
this.#retryConnection();
|
|
42
|
-
};
|
|
43
|
-
constructor({ pluginId, debug = false, enabled = true, reconnectEveryMs = 300 }) {
|
|
44
|
-
this.#pluginId = pluginId;
|
|
45
|
-
this.#enabled = enabled;
|
|
46
|
-
this.#eventTarget = this.getGlobalTarget;
|
|
47
|
-
this.#debug = debug;
|
|
48
|
-
this.debugLog(" Initializing event subscription for plugin", this.#pluginId);
|
|
49
|
-
this.#queuedEvents = [];
|
|
50
|
-
this.#connected = false;
|
|
51
|
-
this.#failedToConnect = false;
|
|
52
|
-
this.#connectIntervalId = null;
|
|
53
|
-
this.#connectEveryMs = reconnectEveryMs;
|
|
54
|
-
}
|
|
55
|
-
startConnectLoop() {
|
|
56
|
-
if (this.#connectIntervalId !== null || this.#connected) return;
|
|
57
|
-
this.debugLog(`Starting connect loop (every ${this.#connectEveryMs}ms)`);
|
|
58
|
-
this.#connectIntervalId = setInterval(this.#retryConnection, this.#connectEveryMs);
|
|
59
|
-
}
|
|
60
|
-
stopConnectLoop() {
|
|
61
|
-
this.#connecting = false;
|
|
62
|
-
if (this.#connectIntervalId === null) return;
|
|
63
|
-
clearInterval(this.#connectIntervalId);
|
|
64
|
-
this.#connectIntervalId = null;
|
|
65
|
-
this.#queuedEvents = [];
|
|
66
|
-
this.debugLog("Stopped connect loop");
|
|
67
|
-
}
|
|
68
|
-
debugLog(...args) {
|
|
69
|
-
if (this.#debug) console.log(`🌴 [tanstack-devtools:${this.#pluginId}-plugin]`, ...args);
|
|
70
|
-
}
|
|
71
|
-
getGlobalTarget() {
|
|
72
|
-
if (typeof globalThis !== "undefined" && globalThis.__TANSTACK_EVENT_TARGET__) {
|
|
73
|
-
this.debugLog("Using global event target");
|
|
74
|
-
return globalThis.__TANSTACK_EVENT_TARGET__;
|
|
75
|
-
}
|
|
76
|
-
if (typeof window !== "undefined" && typeof window.addEventListener !== "undefined") {
|
|
77
|
-
this.debugLog("Using window as event target");
|
|
78
|
-
return window;
|
|
79
|
-
}
|
|
80
|
-
const eventTarget = typeof EventTarget !== "undefined" ? new EventTarget() : void 0;
|
|
81
|
-
if (typeof eventTarget === "undefined" || typeof eventTarget.addEventListener === "undefined") {
|
|
82
|
-
this.debugLog("No event mechanism available, running in non-web environment");
|
|
83
|
-
return {
|
|
84
|
-
addEventListener: () => {},
|
|
85
|
-
removeEventListener: () => {},
|
|
86
|
-
dispatchEvent: () => false
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
this.debugLog("Using new EventTarget as fallback");
|
|
90
|
-
return eventTarget;
|
|
91
|
-
}
|
|
92
|
-
getPluginId() {
|
|
93
|
-
return this.#pluginId;
|
|
94
|
-
}
|
|
95
|
-
dispatchCustomEventShim(eventName, detail) {
|
|
96
|
-
try {
|
|
97
|
-
const event = new Event(eventName, { detail });
|
|
98
|
-
this.#eventTarget().dispatchEvent(event);
|
|
99
|
-
} catch (e) {
|
|
100
|
-
this.debugLog("Failed to dispatch shim event");
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
dispatchCustomEvent(eventName, detail) {
|
|
104
|
-
try {
|
|
105
|
-
this.#eventTarget().dispatchEvent(new CustomEvent(eventName, { detail }));
|
|
106
|
-
} catch (e) {
|
|
107
|
-
this.dispatchCustomEventShim(eventName, detail);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
emitEventToBus(event) {
|
|
111
|
-
this.debugLog("Emitting event to client bus", event);
|
|
112
|
-
this.dispatchCustomEvent("tanstack-dispatch-event", event);
|
|
113
|
-
}
|
|
114
|
-
createEventPayload(eventSuffix, payload) {
|
|
115
|
-
return {
|
|
116
|
-
type: `${this.#pluginId}:${eventSuffix}`,
|
|
117
|
-
payload,
|
|
118
|
-
pluginId: this.#pluginId
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
emit(eventSuffix, payload) {
|
|
122
|
-
if (!this.#enabled) {
|
|
123
|
-
this.debugLog("Event bus client is disabled, not emitting event", eventSuffix, payload);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (this.#internalEventTarget) {
|
|
127
|
-
this.debugLog("Emitting event to internal event target", eventSuffix, payload);
|
|
128
|
-
this.#internalEventTarget.dispatchEvent(new CustomEvent(`${this.#pluginId}:${eventSuffix}`, { detail: this.createEventPayload(eventSuffix, payload) }));
|
|
129
|
-
}
|
|
130
|
-
if (this.#failedToConnect) {
|
|
131
|
-
this.debugLog("Previously failed to connect, not emitting to bus");
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
if (!this.#connected) {
|
|
135
|
-
this.debugLog("Bus not available, will be pushed as soon as connected");
|
|
136
|
-
this.#queuedEvents.push(this.createEventPayload(eventSuffix, payload));
|
|
137
|
-
if (typeof CustomEvent !== "undefined" && !this.#connecting) {
|
|
138
|
-
this.#connectFunction();
|
|
139
|
-
this.startConnectLoop();
|
|
140
|
-
}
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
return this.emitEventToBus(this.createEventPayload(eventSuffix, payload));
|
|
144
|
-
}
|
|
145
|
-
on(eventSuffix, cb, options) {
|
|
146
|
-
const withEventTarget = options?.withEventTarget ?? false;
|
|
147
|
-
const eventName = `${this.#pluginId}:${eventSuffix}`;
|
|
148
|
-
if (withEventTarget) {
|
|
149
|
-
if (!this.#internalEventTarget) this.#internalEventTarget = new EventTarget();
|
|
150
|
-
this.#internalEventTarget.addEventListener(eventName, (e) => {
|
|
151
|
-
cb(e.detail);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
if (!this.#enabled) {
|
|
155
|
-
this.debugLog("Event bus client is disabled, not registering event", eventName);
|
|
156
|
-
return () => {};
|
|
157
|
-
}
|
|
158
|
-
const handler = (e) => {
|
|
159
|
-
this.debugLog("Received event from bus", e.detail);
|
|
160
|
-
cb(e.detail);
|
|
161
|
-
};
|
|
162
|
-
this.#eventTarget().addEventListener(eventName, handler);
|
|
163
|
-
this.debugLog("Registered event to bus", eventName);
|
|
164
|
-
return () => {
|
|
165
|
-
if (withEventTarget) this.#internalEventTarget?.removeEventListener(eventName, handler);
|
|
166
|
-
this.#eventTarget().removeEventListener(eventName, handler);
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
onAll(cb) {
|
|
170
|
-
if (!this.#enabled) {
|
|
171
|
-
this.debugLog("Event bus client is disabled, not registering event");
|
|
172
|
-
return () => {};
|
|
173
|
-
}
|
|
174
|
-
const handler = (e) => {
|
|
175
|
-
const event = e.detail;
|
|
176
|
-
cb(event);
|
|
177
|
-
};
|
|
178
|
-
this.#eventTarget().addEventListener("tanstack-devtools-global", handler);
|
|
179
|
-
return () => this.#eventTarget().removeEventListener("tanstack-devtools-global", handler);
|
|
180
|
-
}
|
|
181
|
-
onAllPluginEvents(cb) {
|
|
182
|
-
if (!this.#enabled) {
|
|
183
|
-
this.debugLog("Event bus client is disabled, not registering event");
|
|
184
|
-
return () => {};
|
|
185
|
-
}
|
|
186
|
-
const handler = (e) => {
|
|
187
|
-
const event = e.detail;
|
|
188
|
-
if (this.#pluginId && event.pluginId !== this.#pluginId) return;
|
|
189
|
-
cb(event);
|
|
190
|
-
};
|
|
191
|
-
this.#eventTarget().addEventListener("tanstack-devtools-global", handler);
|
|
192
|
-
return () => this.#eventTarget().removeEventListener("tanstack-devtools-global", handler);
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
//#endregion
|
|
196
|
-
export { EventClient as t };
|