gloomberb 0.19.6 → 0.20.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/LICENSE +0 -4
- package/package.json +6 -5
- package/patches/electrobun-devkit@2.0.5.patch +408 -0
- package/src/api-client/bond-trades.ts +59 -0
- package/src/api-client/crypto-markets.ts +20 -2
- package/src/api-client/data.ts +21 -0
- package/src/api-client/fund-facts.ts +23 -1
- package/src/api-client/index.ts +2 -0
- package/src/api-client/types/account.ts +86 -0
- package/src/api-client/types/assist.ts +32 -0
- package/src/api-client/types/auth.ts +63 -0
- package/src/api-client/types/billing.ts +54 -0
- package/src/api-client/types/chat.ts +180 -0
- package/src/api-client/types/congress.ts +107 -0
- package/src/api-client/types/credit.ts +110 -0
- package/src/api-client/types/econ.ts +158 -0
- package/src/api-client/types/equity-diagnostic.ts +73 -0
- package/src/api-client/types/filings-and-calls.ts +356 -0
- package/src/api-client/types/index.ts +25 -0
- package/src/api-client/types/jobs.ts +147 -0
- package/src/api-client/types/market.ts +122 -0
- package/src/api-client/types/news.ts +91 -0
- package/src/api-client/types/notes-and-theses.ts +172 -0
- package/src/api-client/types/quotes.ts +28 -0
- package/src/api-client/types/scanners.ts +125 -0
- package/src/api-client/types/screener.ts +65 -0
- package/src/api-client/types/search.ts +107 -0
- package/src/api-client/types/sync.ts +14 -0
- package/src/api-client/types/team-collections.ts +43 -0
- package/src/api-client/types/team-views.ts +32 -0
- package/src/api-client/types/teams.ts +135 -0
- package/src/api-client/types/ticker-data.ts +57 -0
- package/src/api-client/types/tweets.ts +59 -0
- package/src/api-client/types/world-venues.ts +23 -0
- package/src/app/runtime/desktop-deeplink.ts +41 -6
- package/src/app/runtime/plugin-seed.ts +119 -0
- package/src/app/runtime/startup.ts +45 -9
- package/src/app/star-prompt/status-line.tsx +1 -1
- package/src/app.tsx +2 -7
- package/src/architecture/ui-tokens-allowlist.json +0 -8
- package/src/cli/board-coins.ts +38 -5
- package/src/cli/commands/crypto-hints.ts +8 -1
- package/src/cli/commands/market.ts +29 -26
- package/src/cli/commands/overview.ts +13 -6
- package/src/cli/commands/ticker.ts +78 -18
- package/src/cli/company-name-hint.ts +19 -0
- package/src/cli/desktop-pane-shot-browser.ts +69 -3
- package/src/cli/entry.ts +10 -4
- package/src/cli/glossary.ts +25 -0
- package/src/cli/helpers.ts +4 -2
- package/src/cli/not-a-ticker.ts +26 -1
- package/src/cli/pane-functions/catalog.ts +3 -1
- package/src/cli/pane-functions/freshness.ts +45 -29
- package/src/cli/pane-functions/market-session.ts +14 -5
- package/src/cli/restore-plugins.ts +164 -51
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +11 -2
- package/src/components/chart-table/header.tsx +10 -1
- package/src/components/chart-table/layout.ts +14 -5
- package/src/components/command-bar/panel/index.tsx +13 -0
- package/src/components/command-bar/panel/layout.ts +7 -0
- package/src/components/command-bar/panel/runtime.ts +1 -0
- package/src/components/command-bar/panel/types.ts +2 -0
- package/src/components/data-table/export.ts +4 -1
- package/src/components/layout/detached-pane-shell.tsx +10 -37
- package/src/components/layout/double-escape-close.ts +90 -0
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +6 -3
- package/src/components/layout/pane/footer/index.tsx +2 -6
- package/src/components/layout/pane/footer/model.ts +6 -12
- package/src/components/layout/shell/active-drag.ts +53 -11
- package/src/components/layout/shell/drag/magnets.ts +128 -19
- package/src/components/layout/shell/pane/actions.ts +6 -2
- package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
- package/src/components/layout/status-bar.tsx +4 -78
- package/src/components/layout/status-widget-space.ts +5 -5
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +1 -1
- package/src/components/ui/data-table/index.tsx +5 -1
- package/src/components/ui/data-table/render-cell.ts +19 -0
- package/src/components/ui/delayed-mark.tsx +59 -7
- package/src/components/ui/icon.tsx +1 -8
- package/src/components/ui/menu.tsx +6 -1
- package/src/i18n/es.ts +6 -3
- package/src/i18n/ja.ts +6 -3
- package/src/i18n/ko.ts +6 -3
- package/src/i18n/zh-cn.ts +6 -3
- package/src/i18n/zh-tw.ts +6 -3
- package/src/market-data/fund-facts.ts +7 -1
- package/src/market-data/market/change-basis.ts +20 -0
- package/src/market-data/market/format.ts +62 -2
- package/src/market-data/market/futures-week.ts +3 -1
- package/src/plugins/builtin/chart-composer/headless.ts +57 -17
- package/src/plugins/builtin/chart-composer/session-range.ts +82 -3
- package/src/plugins/builtin/chat/content/composer.tsx +21 -27
- package/src/plugins/builtin/chat/content/index.tsx +31 -3
- package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
- package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
- package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
- package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +32 -25
- package/src/plugins/builtin/congress-trades/model.ts +2 -1
- package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
- package/src/plugins/builtin/correlation/compute.ts +8 -2
- package/src/plugins/builtin/correlation/headless.ts +10 -9
- package/src/plugins/builtin/correlation/history.ts +30 -0
- package/src/plugins/builtin/correlation/matrix/model.ts +10 -10
- package/src/plugins/builtin/correlation/relationship/model.ts +3 -6
- package/src/plugins/builtin/correlation/relationship/pane.tsx +1 -2
- package/src/plugins/builtin/crypto-board/client.ts +6 -1
- package/src/plugins/builtin/crypto-board/defi-view.tsx +12 -1
- package/src/plugins/builtin/crypto-board/defi.ts +44 -7
- package/src/plugins/builtin/crypto-board/headless.ts +83 -12
- package/src/plugins/builtin/crypto-board/model.ts +30 -6
- package/src/plugins/builtin/crypto-board/pane.tsx +13 -2
- package/src/plugins/builtin/custom-view/index.tsx +1 -1
- package/src/plugins/builtin/custom-view/loader.ts +85 -8
- package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +13 -4
- package/src/plugins/builtin/equity-screener/headless.ts +33 -1
- package/src/plugins/builtin/equity-screener/model.ts +58 -15
- package/src/plugins/builtin/equity-screener/pane.tsx +36 -6
- package/src/plugins/builtin/executives/format.ts +5 -4
- package/src/plugins/builtin/executives/pane.tsx +1 -1
- package/src/plugins/builtin/help/index.tsx +55 -1
- package/src/plugins/builtin/insider/model.ts +30 -2
- package/src/plugins/builtin/jobs/model.ts +2 -2
- package/src/plugins/builtin/mna/model.ts +2 -2
- package/src/plugins/builtin/notes/files.ts +2 -0
- package/src/plugins/builtin/notes/owner.tsx +20 -1
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
- package/src/plugins/builtin/notes/store.ts +6 -1
- package/src/plugins/builtin/perps/headless.ts +8 -2
- package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
- package/src/plugins/builtin/risk-factors/index.tsx +2 -28
- package/src/plugins/builtin/risk-factors/lock-note.ts +58 -0
- package/src/plugins/builtin/risk-factors/pane.tsx +10 -3
- package/src/plugins/builtin/scanner/hilo-model.ts +4 -3
- package/src/plugins/builtin/sec/fund-facts.ts +45 -11
- package/src/plugins/builtin/sec/headless.ts +30 -1
- package/src/plugins/builtin/sec/index.tsx +26 -5
- package/src/plugins/builtin/series-inventory.ts +1 -0
- package/src/plugins/builtin/shared/earnings-report.ts +7 -2
- package/src/plugins/builtin/shared/pro-lock-note.ts +5 -1
- package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
- package/src/plugins/builtin/short-interest/headless.ts +1 -1
- package/src/plugins/builtin/short-interest/model.ts +15 -6
- package/src/plugins/builtin/short-interest/types.ts +2 -0
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +19 -9
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
- package/src/plugins/builtin/time-sales/headless.ts +23 -7
- package/src/plugins/builtin/time-sales/index.tsx +2 -2
- package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
- package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
- package/src/plugins/builtin/trace-bonds/history.ts +155 -0
- package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
- package/src/plugins/extracted-plugins.ts +49 -24
- package/src/plugins/installer.ts +234 -32
- package/src/plugins/plugin-names.ts +11 -2
- package/src/plugins/running-installs.ts +34 -0
- package/src/plugins/seed-progress.ts +72 -0
- package/src/remote/controller.ts +9 -2
- package/src/remote/schema.ts +2 -1
- package/src/renderers/cloudflare/http-proxy.ts +67 -8
- package/src/renderers/cloudflare/proxy-session.ts +1 -1
- package/src/renderers/cloudflare/worker.ts +29 -2
- package/src/renderers/dom/desktop/icons.tsx +0 -2
- package/src/renderers/dom/styles.css +0 -3
- package/src/renderers/electrobun/bun/desktop/backend.ts +14 -0
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +14 -7
- package/src/renderers/electrobun/bun/desktop/initialization.ts +24 -14
- package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
- package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
- package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
- package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
- package/src/renderers/electrobun/bun/index.ts +24 -13
- package/src/renderers/electrobun/bun/window/context-menu-thread.ts +84 -0
- package/src/renderers/electrobun/bun/window/create.ts +23 -3
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +4 -4
- package/src/renderers/electrobun/bun/window/events.ts +4 -4
- package/src/renderers/electrobun/bun/window/frame.ts +2 -1
- package/src/renderers/electrobun/bun/window/native-call-thread.ts +224 -0
- package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
- package/src/renderers/electrobun/bun/window/native-timing.ts +10 -0
- package/src/renderers/electrobun/bun/window/script-for-webview.ts +15 -0
- package/src/renderers/electrobun/bun/window/webview-script-thread.ts +82 -0
- package/src/renderers/electrobun/shared/protocol.ts +13 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +8 -1
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +1 -1
- package/src/renderers/electrobun/view/main.tsx +4 -3
- package/src/renderers/opentui/start.tsx +3 -0
- package/src/sources/gloomberb-cloud/index.ts +5 -7
- package/src/sources/provider-router/batches.ts +18 -3
- package/src/sources/provider-router/financials.ts +18 -4
- package/src/telemetry/stall-reports.ts +21 -4
- package/src/types/data-provider.ts +14 -0
- package/src/types/financials.ts +15 -3
- package/src/types/headless.ts +2 -0
- package/src/utils/double-escape-close.ts +38 -16
- package/src/utils/format.ts +23 -3
- package/src/utils/main-thread-stall.ts +21 -5
- package/src/utils/perf-marks.ts +88 -9
- package/src/utils/price-earnings.ts +18 -0
- package/src/utils/reported-money.ts +9 -2
- package/src/utils/sec.ts +34 -3
- package/patches/electrobun@1.18.1.patch +0 -633
- package/src/api-client/types.ts +0 -2441
- package/src/plugins/seed-notice.ts +0 -20
package/LICENSE
CHANGED
|
@@ -12,10 +12,6 @@ furnished to do so, subject to the following conditions:
|
|
|
12
12
|
The above copyright notice and this permission notice shall be included in all
|
|
13
13
|
copies or substantial portions of the Software.
|
|
14
14
|
|
|
15
|
-
When using this software in a product or service, attribution to the Gloomberb
|
|
16
|
-
project (https://github.com/gloom-sh/gloomberb) is appreciated and encouraged,
|
|
17
|
-
though not legally required beyond preserving the above copyright notice.
|
|
18
|
-
|
|
19
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gloomberb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"description": "Market research and portfolio tracker for the terminal",
|
|
6
6
|
"module": "src/public/index.ts",
|
|
@@ -61,12 +61,14 @@
|
|
|
61
61
|
"cloudflare:dry-run": "bun run web:build && wrangler deploy --dry-run --env production",
|
|
62
62
|
"desktop:dev": "bun run scripts/electrobun-dev.ts",
|
|
63
63
|
"desktop:build": "electrobun build",
|
|
64
|
-
"desktop:release": "electrobun build --env=stable",
|
|
65
|
-
"desktop:release:windows": "electrobun build --env=stable
|
|
64
|
+
"desktop:release": "electrobun build --env=stable && bun scripts/name-desktop-artifacts.ts artifacts stable",
|
|
65
|
+
"desktop:release:windows": "electrobun build --env=stable && bun scripts/name-desktop-artifacts.ts artifacts stable",
|
|
66
|
+
"desktop:sync": "electrobun sync && bun run scripts/patch-electrobun-devkit.ts",
|
|
66
67
|
"docs:snapshot": "bun run scripts/update-docs-snapshot.ts",
|
|
67
68
|
"plugins:manifest": "bun run scripts/generate-plugin-manifest.ts",
|
|
68
69
|
"plugins:manifest:check": "bun run scripts/generate-plugin-manifest.ts --check",
|
|
69
70
|
"plugins:registry:check": "bun run scripts/check-registry-plugins.ts",
|
|
71
|
+
"plugins:registry:packaged": "bun run scripts/check-packaged-registry-plugins.ts",
|
|
70
72
|
"web:proxy-hosts": "bun run scripts/generate-web-proxy-hosts.ts",
|
|
71
73
|
"map:data": "bun run scripts/generate-world-map-data.ts",
|
|
72
74
|
"glyphs:terminal": "bun run scripts/generate-terminal-glyphs.ts",
|
|
@@ -119,7 +121,7 @@
|
|
|
119
121
|
"@types/bun": "^1.3.14",
|
|
120
122
|
"@types/react-dom": "^19.2.3",
|
|
121
123
|
"@types/three": "0.165.0",
|
|
122
|
-
"electrobun": "
|
|
124
|
+
"electrobun": "2.0.5",
|
|
123
125
|
"gloom-polls": "github:gloom-sh/gloom-polls",
|
|
124
126
|
"gloom-prediction-markets": "github:gloom-sh/gloom-prediction-markets",
|
|
125
127
|
"happy-dom": "^20.11.1",
|
|
@@ -143,7 +145,6 @@
|
|
|
143
145
|
},
|
|
144
146
|
"patchedDependencies": {
|
|
145
147
|
"@opentui/core@0.3.2": "patches/@opentui%2Fcore@0.3.2.patch",
|
|
146
|
-
"electrobun@1.18.1": "patches/electrobun@1.18.1.patch",
|
|
147
148
|
"react-reconciler@0.33.0": "patches/react-reconciler@0.33.0.patch"
|
|
148
149
|
}
|
|
149
150
|
}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
diff --git a/api/preload/encryption.ts b/api/preload/encryption.ts
|
|
2
|
+
index 8cf3ab6ce..0f70f2107 100644
|
|
3
|
+
--- a/api/preload/encryption.ts
|
|
4
|
+
+++ b/api/preload/encryption.ts
|
|
5
|
+
@@ -3,27 +3,30 @@
|
|
6
|
+
|
|
7
|
+
import "./globals.d.ts";
|
|
8
|
+
|
|
9
|
+
+// Native base64 where the engine has it (WebKit since Safari 18.2, Chromium
|
|
10
|
+
+// since 140); the fallbacks copy bytes in a loop and join strings in chunks.
|
|
11
|
+
+// Splitting the decoded string into an array of characters, or growing a
|
|
12
|
+
+// string one byte at a time, costs tens of milliseconds per megabyte on the
|
|
13
|
+
+// main thread, and every message from the host is decrypted here.
|
|
14
|
+
function base64ToUint8Array(base64: string): Uint8Array {
|
|
15
|
+
+ const native = Uint8Array as unknown as { fromBase64?: (value: string) => Uint8Array };
|
|
16
|
+
+ if (typeof native.fromBase64 === "function") return native.fromBase64(base64);
|
|
17
|
+
const binary = atob(base64);
|
|
18
|
+
- if (window.__electrobunPlatform === "linux") {
|
|
19
|
+
- // WebKitGTK becomes allocation-bound on large RPC bursts if every byte
|
|
20
|
+
- // is first expanded into a split/map array.
|
|
21
|
+
- const bytes = new Uint8Array(binary.length);
|
|
22
|
+
- for (let i = 0; i < binary.length; i++) {
|
|
23
|
+
- bytes[i] = binary.charCodeAt(i);
|
|
24
|
+
- }
|
|
25
|
+
- return bytes;
|
|
26
|
+
+ const bytes = new Uint8Array(binary.length);
|
|
27
|
+
+ for (let i = 0; i < binary.length; i++) {
|
|
28
|
+
+ bytes[i] = binary.charCodeAt(i);
|
|
29
|
+
}
|
|
30
|
+
-
|
|
31
|
+
- return new Uint8Array(binary.split("").map((char) => char.charCodeAt(0)));
|
|
32
|
+
+ return bytes;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function uint8ArrayToBase64(uint8Array: Uint8Array): string {
|
|
36
|
+
- let binary = "";
|
|
37
|
+
- for (let i = 0; i < uint8Array.length; i++) {
|
|
38
|
+
- binary += String.fromCharCode(uint8Array[i]!);
|
|
39
|
+
+ const native = (uint8Array as unknown as { toBase64?: () => string }).toBase64;
|
|
40
|
+
+ if (typeof native === "function") return native.call(uint8Array);
|
|
41
|
+
+ const parts: string[] = [];
|
|
42
|
+
+ for (let i = 0; i < uint8Array.length; i += 32768) {
|
|
43
|
+
+ parts.push(String.fromCharCode.apply(null, uint8Array.subarray(i, i + 32768) as unknown as number[]));
|
|
44
|
+
}
|
|
45
|
+
- return btoa(binary);
|
|
46
|
+
+ return btoa(parts.join(""));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function toArrayBuffer(bytes: Uint8Array): ArrayBuffer {
|
|
50
|
+
diff --git a/api/sdks/main/core/Updater.ts b/api/sdks/main/core/Updater.ts
|
|
51
|
+
index 4c47ed9d2..fde979421 100644
|
|
52
|
+
--- a/api/sdks/main/core/Updater.ts
|
|
53
|
+
+++ b/api/sdks/main/core/Updater.ts
|
|
54
|
+
@@ -7,6 +7,7 @@ import {
|
|
55
|
+
read,
|
|
56
|
+
fchmodSync,
|
|
57
|
+
fstatSync,
|
|
58
|
+
+ fsync,
|
|
59
|
+
fsyncSync,
|
|
60
|
+
lstatSync,
|
|
61
|
+
mkdirSync,
|
|
62
|
+
@@ -323,6 +324,39 @@ let updateInfo: UpdateInfo = {
|
|
63
|
+
error: "",
|
|
64
|
+
};
|
|
65
|
+
let checkedManifest: UpdateManifestV1 | undefined;
|
|
66
|
+
+
|
|
67
|
+
+// Where updates are fetched from when it is not the channel and baseUrl that
|
|
68
|
+
+// version.json names: a release whose files carry another prefix (`nightly-*`)
|
|
69
|
+
+// under its own URL. Only the URLs read it. The manifest is still checked
|
|
70
|
+
+// against the installed build's identity and channel, and the app data
|
|
71
|
+
+// folder and the "dev" check keep that channel too.
|
|
72
|
+
+let updateSource: { channel: string; baseUrl: string } | null = null;
|
|
73
|
+
+
|
|
74
|
+
+function updateSourceBaseUrl(info: LocalUpdateInfo): string {
|
|
75
|
+
+ return updateSource?.baseUrl ?? info.baseUrl;
|
|
76
|
+
+}
|
|
77
|
+
+
|
|
78
|
+
+/** The prefix of the source's files: `<channel>-<os>-<arch>`. */
|
|
79
|
+
+function updateSourcePrefix(
|
|
80
|
+
+ channel: BuildEnvironment,
|
|
81
|
+
+ os: SupportedOS,
|
|
82
|
+
+ arch: SupportedArch,
|
|
83
|
+
+): string {
|
|
84
|
+
+ if (!updateSource) return getPlatformPrefix(channel, os, arch);
|
|
85
|
+
+ return `${updateSource.channel}-${os}-${arch}`;
|
|
86
|
+
+}
|
|
87
|
+
+
|
|
88
|
+
+/**
|
|
89
|
+
+ * The manifest names its archive under the channel it was built for; a
|
|
90
|
+
+ * source that carries the files under its own prefix has it under that one.
|
|
91
|
+
+ */
|
|
92
|
+
+function updateSourceArtifactFile(manifest: UpdateManifestV1): string {
|
|
93
|
+
+ const built = `${manifest.channel}-`;
|
|
94
|
+
+ if (!updateSource || !manifest.artifact.file.startsWith(built)) {
|
|
95
|
+
+ return manifest.artifact.file;
|
|
96
|
+
+ }
|
|
97
|
+
+ return `${updateSource.channel}-${manifest.artifact.file.slice(built.length)}`;
|
|
98
|
+
+}
|
|
99
|
+
let checkInFlight: Promise<UpdateInfo> | undefined;
|
|
100
|
+
let downloadInFlight: Promise<void> | undefined;
|
|
101
|
+
let applyInFlight: Promise<void> | undefined;
|
|
102
|
+
@@ -679,6 +713,56 @@ function atomicWriteJson(path: string, value: unknown): void {
|
|
103
|
+
atomicWriteFile(path, new TextEncoder().encode(`${JSON.stringify(value)}\n`));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
+/**
|
|
107
|
+
+ * `syncFile` without holding this thread while the disk takes a bundle
|
|
108
|
+
+ * hundreds of megabytes large: the app's windows keep answering.
|
|
109
|
+
+ */
|
|
110
|
+
+async function syncFileOffThread(path: string): Promise<void> {
|
|
111
|
+
+ const fileDescriptor = openSync(path, fsConstants.O_RDWR);
|
|
112
|
+
+ try {
|
|
113
|
+
+ await syncDescriptorOffThread(fileDescriptor);
|
|
114
|
+
+ } finally {
|
|
115
|
+
+ closeSync(fileDescriptor);
|
|
116
|
+
+ }
|
|
117
|
+
+}
|
|
118
|
+
+
|
|
119
|
+
+function syncDescriptorOffThread(fileDescriptor: number): Promise<void> {
|
|
120
|
+
+ return new Promise((resolve, reject) => {
|
|
121
|
+
+ fsync(fileDescriptor, (error) => (error ? reject(error) : resolve()));
|
|
122
|
+
+ });
|
|
123
|
+
+}
|
|
124
|
+
+
|
|
125
|
+
+/**
|
|
126
|
+
+ * Runs one of the update's tools (zig-zstd, bspatch) without holding this
|
|
127
|
+
+ * thread while it unpacks or patches a bundle: the app's windows keep
|
|
128
|
+
+ * answering meanwhile. Fails as execFileSync did, naming the command.
|
|
129
|
+
+ */
|
|
130
|
+
+async function runUpdateTool(
|
|
131
|
+
+ executable: string,
|
|
132
|
+
+ args: readonly string[],
|
|
133
|
+
+ options: { timeoutMs?: number; keepStderr?: boolean } = {},
|
|
134
|
+
+): Promise<void> {
|
|
135
|
+
+ const child = Bun.spawn([executable, ...args], {
|
|
136
|
+
+ stdin: "ignore",
|
|
137
|
+
+ stdout: "ignore",
|
|
138
|
+
+ stderr: options.keepStderr ? "pipe" : "ignore",
|
|
139
|
+
+ windowsHide: true,
|
|
140
|
+
+ ...(options.timeoutMs ? { timeout: options.timeoutMs } : {}),
|
|
141
|
+
+ });
|
|
142
|
+
+ const [code, stderr] = await Promise.all([
|
|
143
|
+
+ child.exited,
|
|
144
|
+
+ options.keepStderr && child.stderr instanceof ReadableStream
|
|
145
|
+
+ ? new Response(child.stderr).text()
|
|
146
|
+
+ : Promise.resolve(""),
|
|
147
|
+
+ ]);
|
|
148
|
+
+ if (code !== 0) {
|
|
149
|
+
+ const detail = stderr.trim().slice(-64 * 1024);
|
|
150
|
+
+ throw new Error(
|
|
151
|
+
+ `Command failed: ${[executable, ...args].join(" ")} (${child.signalCode ?? `exit ${code}`})${detail ? `\n${detail}` : ""}`,
|
|
152
|
+
+ );
|
|
153
|
+
+ }
|
|
154
|
+
+}
|
|
155
|
+
+
|
|
156
|
+
export function syncFile(path: string): void {
|
|
157
|
+
// Cottontail's Windows fsync path requires a read/write handle. Opening an
|
|
158
|
+
// otherwise valid update file read-only can surface EBADF at the durability
|
|
159
|
+
@@ -1164,7 +1248,7 @@ export async function downloadResponseToFile(
|
|
160
|
+
} catch {}
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
- fsyncSync(fileDescriptor);
|
|
164
|
+
+ await syncDescriptorOffThread(fileDescriptor);
|
|
165
|
+
closeSync(fileDescriptor);
|
|
166
|
+
fileDescriptor = undefined;
|
|
167
|
+
return bytesDownloaded;
|
|
168
|
+
@@ -1228,24 +1312,21 @@ async function downloadArtifact(
|
|
169
|
+
type DeltaPatchExecutor = (
|
|
170
|
+
executable: string,
|
|
171
|
+
args: readonly string[],
|
|
172
|
+
-) => void;
|
|
173
|
+
+) => void | Promise<void>;
|
|
174
|
+
|
|
175
|
+
-export function applyDeltaPatch(
|
|
176
|
+
+export async function applyDeltaPatch(
|
|
177
|
+
options: {
|
|
178
|
+
bspatchPath: string;
|
|
179
|
+
currentTarPath: string;
|
|
180
|
+
patchPath: string;
|
|
181
|
+
outputPath: string;
|
|
182
|
+
},
|
|
183
|
+
- execute: DeltaPatchExecutor = (executable, args) => {
|
|
184
|
+
- execFileSync(executable, [...args], {
|
|
185
|
+
- stdio: ["ignore", "ignore", "pipe"],
|
|
186
|
+
- maxBuffer: 64 * 1024,
|
|
187
|
+
- windowsHide: true,
|
|
188
|
+
- timeout: 10 * 60_000,
|
|
189
|
+
- });
|
|
190
|
+
- },
|
|
191
|
+
-): void {
|
|
192
|
+
+ execute: DeltaPatchExecutor = (executable, args) =>
|
|
193
|
+
+ runUpdateTool(executable, args, {
|
|
194
|
+
+ keepStderr: true,
|
|
195
|
+
+ timeoutMs: 10 * 60_000,
|
|
196
|
+
+ }),
|
|
197
|
+
+): Promise<void> {
|
|
198
|
+
requireRegularFile(options.bspatchPath, "bspatch executable");
|
|
199
|
+
requireRegularFile(options.currentTarPath, "Current update archive");
|
|
200
|
+
requireRegularFile(options.patchPath, "Downloaded update patch");
|
|
201
|
+
@@ -1253,7 +1334,7 @@ export function applyDeltaPatch(
|
|
202
|
+
throw new Error("Refusing to replace an existing patch output");
|
|
203
|
+
}
|
|
204
|
+
try {
|
|
205
|
+
- execute(options.bspatchPath, [
|
|
206
|
+
+ await execute(options.bspatchPath, [
|
|
207
|
+
options.currentTarPath,
|
|
208
|
+
options.outputPath,
|
|
209
|
+
options.patchPath,
|
|
210
|
+
@@ -1262,7 +1343,7 @@ export function applyDeltaPatch(
|
|
211
|
+
if (lstatSync(options.outputPath).size <= 0) {
|
|
212
|
+
throw new Error("Patched update archive is empty");
|
|
213
|
+
}
|
|
214
|
+
- syncFile(options.outputPath);
|
|
215
|
+
+ await syncFileOffThread(options.outputPath);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
rmSync(options.outputPath, { force: true });
|
|
218
|
+
throw error;
|
|
219
|
+
@@ -1773,8 +1854,8 @@ async function checkForUpdateOperation(): Promise<UpdateInfo> {
|
|
220
|
+
return updateInfo;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
- const platformPrefix = getPlatformPrefix(info.channel, currentOS, currentArch);
|
|
224
|
+
- const updateInfoUrl = `${info.baseUrl.replace(/\/+$/, "")}/${platformPrefix}-update.json?${randomBytes(8).toString("hex")}`;
|
|
225
|
+
+ const platformPrefix = updateSourcePrefix(info.channel, currentOS, currentArch);
|
|
226
|
+
+ const updateInfoUrl = `${updateSourceBaseUrl(info).replace(/\/+$/, "")}/${platformPrefix}-update.json?${randomBytes(8).toString("hex")}`;
|
|
227
|
+
try {
|
|
228
|
+
const response = await fetch(updateInfoUrl, {
|
|
229
|
+
signal: AbortSignal.timeout(30_000),
|
|
230
|
+
@@ -1938,7 +2019,7 @@ export async function preparePatchChainForUpdate(
|
|
231
|
+
const bspatchPath =
|
|
232
|
+
dependencies.bspatchPath ??
|
|
233
|
+
join(dirname(process.execPath), currentOS === "win" ? "bspatch.exe" : "bspatch");
|
|
234
|
+
- const platformPrefix = getPlatformPrefix(
|
|
235
|
+
+ const platformPrefix = updateSourcePrefix(
|
|
236
|
+
channel,
|
|
237
|
+
manifest.platform,
|
|
238
|
+
manifest.arch,
|
|
239
|
+
@@ -1952,7 +2033,7 @@ export async function preparePatchChainForUpdate(
|
|
240
|
+
try {
|
|
241
|
+
while (currentHash !== manifest.hash) {
|
|
242
|
+
const patchNumber = patchesApplied + 1;
|
|
243
|
+
- patchUrl = getPatchFileUrl(info.baseUrl, platformPrefix, currentHash);
|
|
244
|
+
+ patchUrl = getPatchFileUrl(updateSourceBaseUrl(info), platformPrefix, currentHash);
|
|
245
|
+
const pathPrefix = join(
|
|
246
|
+
extractionFolder,
|
|
247
|
+
`.${transactionId}.${patchNumber}.${currentHash}`,
|
|
248
|
+
@@ -2136,8 +2217,8 @@ async function downloadUpdateOperation(): Promise<void> {
|
|
249
|
+
join(extractionFolder, `${manifest.hash}.tar`),
|
|
250
|
+
);
|
|
251
|
+
const artifactUrl = buildUpdateArtifactUrl(
|
|
252
|
+
- info.baseUrl,
|
|
253
|
+
- manifest.artifact.file,
|
|
254
|
+
+ updateSourceBaseUrl(info),
|
|
255
|
+
+ updateSourceArtifactFile(manifest),
|
|
256
|
+
);
|
|
257
|
+
const artifactRequestUrl = addUpdateArtifactCacheBuster(
|
|
258
|
+
artifactUrl,
|
|
259
|
+
@@ -2175,23 +2256,19 @@ async function downloadUpdateOperation(): Promise<void> {
|
|
260
|
+
emitStatus("decompressing", "Decompressing update bundle...", {
|
|
261
|
+
zstdPath,
|
|
262
|
+
});
|
|
263
|
+
- execFileSync(
|
|
264
|
+
- zstdPath,
|
|
265
|
+
- [
|
|
266
|
+
- "decompress",
|
|
267
|
+
- "-i",
|
|
268
|
+
- compressedPath,
|
|
269
|
+
- "-o",
|
|
270
|
+
- tarPartialPath,
|
|
271
|
+
- "--no-timing",
|
|
272
|
+
- ],
|
|
273
|
+
- { stdio: "ignore", windowsHide: true },
|
|
274
|
+
- );
|
|
275
|
+
+ await runUpdateTool(zstdPath, [
|
|
276
|
+
+ "decompress",
|
|
277
|
+
+ "-i",
|
|
278
|
+
+ compressedPath,
|
|
279
|
+
+ "-o",
|
|
280
|
+
+ tarPartialPath,
|
|
281
|
+
+ "--no-timing",
|
|
282
|
+
+ ]);
|
|
283
|
+
requireRegularFile(tarPartialPath, "Decompressed update archive");
|
|
284
|
+
if (lstatSync(tarPartialPath).size <= 0) {
|
|
285
|
+
throw new Error("Decompressed update archive is empty");
|
|
286
|
+
}
|
|
287
|
+
- syncFile(tarPartialPath);
|
|
288
|
+
+ await syncFileOffThread(tarPartialPath);
|
|
289
|
+
publishFileReplacingRegular(tarPartialPath, retainedTarPath);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@@ -2388,6 +2465,14 @@ const Updater = {
|
|
293
|
+
onStatusChangeCallback = callback;
|
|
294
|
+
if (callback) scheduleNativeUpdateResultReconciliation();
|
|
295
|
+
},
|
|
296
|
+
+ // Checks and downloads from `source` (a file prefix and the URL its files
|
|
297
|
+
+ // sit under) until it is set again; null goes back to version.json.
|
|
298
|
+
+ setUpdateSource: (source: { channel: string; baseUrl: string } | null): void => {
|
|
299
|
+
+ if (source && !/^[a-z0-9][a-z0-9-]*$/.test(source.channel)) {
|
|
300
|
+
+ throw new Error(`Invalid update source channel: ${source.channel}`);
|
|
301
|
+
+ }
|
|
302
|
+
+ updateSource = source;
|
|
303
|
+
+ },
|
|
304
|
+
checkForUpdate,
|
|
305
|
+
downloadUpdate,
|
|
306
|
+
applyUpdate,
|
|
307
|
+
diff --git a/api/sdks/main/core/BrowserView.ts b/api/sdks/main/core/BrowserView.ts
|
|
308
|
+
index ced422137..43e8e905c 100644
|
|
309
|
+
--- a/api/sdks/main/core/BrowserView.ts
|
|
310
|
+
+++ b/api/sdks/main/core/BrowserView.ts
|
|
311
|
+
@@ -33,6 +33,22 @@ const HOST_MESSAGE_SEND_TURN_MS = 8;
|
|
312
|
+
const HOST_MESSAGE_SOCKET_AVAILABLE = process.platform !== "win32";
|
|
313
|
+
const HOST_MESSAGE_RESPONSE_PRIORITY = process.platform === "linux";
|
|
314
|
+
|
|
315
|
+
+/**
|
|
316
|
+
+ * Where set, runs a script in a webview instead of this thread when it
|
|
317
|
+
+ * returns true. On Windows every message to a page goes as a script, and the
|
|
318
|
+
+ * native call waits on the thread that runs the windows until it takes it.
|
|
319
|
+
+ * `webview` is the native pointer, which a webview made after this one is
|
|
320
|
+
+ * removed can reuse; `webviewId` is never reused. `runHere` runs it on this
|
|
321
|
+
+ * thread, for a script the runner took and then could not run.
|
|
322
|
+
+ */
|
|
323
|
+
+type WebviewScriptRunner = (
|
|
324
|
+
+ js: string,
|
|
325
|
+
+ webviewId: number,
|
|
326
|
+
+ webview: number,
|
|
327
|
+
+ runHere: () => void,
|
|
328
|
+
+) => boolean;
|
|
329
|
+
+let webviewScriptRunner: WebviewScriptRunner | null = null;
|
|
330
|
+
+
|
|
331
|
+
function isRpcResponsePacket(message: unknown): boolean {
|
|
332
|
+
return (
|
|
333
|
+
typeof message === "object" &&
|
|
334
|
+
@@ -267,10 +283,22 @@ export class BrowserView<T extends RPCWithTransport = RPCWithTransport> {
|
|
335
|
+
// so we have to chunk it
|
|
336
|
+
// TODO: is this still needed after switching from named pipes
|
|
337
|
+
executeJavascript(js: string) {
|
|
338
|
+
- if (!this.ptr || this.isRemoved) {
|
|
339
|
+
+ const webview = this.ptr;
|
|
340
|
+
+ if (!webview || this.isRemoved) {
|
|
341
|
+
+ return;
|
|
342
|
+
+ }
|
|
343
|
+
+ const runHere = () => ffi.request.evaluateJavascriptWithNoCompletion({ id: this.id, js });
|
|
344
|
+
+ if (
|
|
345
|
+
+ webviewScriptRunner &&
|
|
346
|
+
+ webviewScriptRunner(js, this.id, webview as unknown as number, runHere)
|
|
347
|
+
+ ) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
- ffi.request.evaluateJavascriptWithNoCompletion({ id: this.id, js });
|
|
351
|
+
+ runHere();
|
|
352
|
+
+ }
|
|
353
|
+
+
|
|
354
|
+
+ static setScriptRunner(runner: WebviewScriptRunner | null): void {
|
|
355
|
+
+ webviewScriptRunner = runner;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
loadURL(url: string) {
|
|
359
|
+
diff --git a/api/sdks/main/core/ContextMenu.ts b/api/sdks/main/core/ContextMenu.ts
|
|
360
|
+
index 807fd20e2..9f8bc899e 100644
|
|
361
|
+
--- a/api/sdks/main/core/ContextMenu.ts
|
|
362
|
+
+++ b/api/sdks/main/core/ContextMenu.ts
|
|
363
|
+
@@ -7,6 +7,8 @@ import { ffi, type ApplicationMenuItemConfig } from "../proc/native";
|
|
364
|
+
import electrobunEventEmitter from "../events/eventEmitter";
|
|
365
|
+
import { roleLabelMap } from "./menuRoles";
|
|
366
|
+
|
|
367
|
+
+export { setContextMenuRunner } from "../proc/native";
|
|
368
|
+
+
|
|
369
|
+
type NonDividerMenuItem = {
|
|
370
|
+
type?: "normal";
|
|
371
|
+
label?: string;
|
|
372
|
+
diff --git a/api/sdks/main/proc/native.ts b/api/sdks/main/proc/native.ts
|
|
373
|
+
index 449853c5b..fc1500c52 100644
|
|
374
|
+
--- a/api/sdks/main/proc/native.ts
|
|
375
|
+
+++ b/api/sdks/main/proc/native.ts
|
|
376
|
+
@@ -1279,6 +1279,19 @@ function createFfiRequestProxy(ffiRequest: Record<string, Function>): Record<str
|
|
377
|
+
const core_ = core!;
|
|
378
|
+
const native_ = native!;
|
|
379
|
+
|
|
380
|
+
+/**
|
|
381
|
+
+ * Where set, makes a context menu's native call instead of this thread when
|
|
382
|
+
+ * it returns true. On Windows that call waits on the thread that runs the
|
|
383
|
+
+ * windows, which answers only once the menu closes. `showHere` makes the
|
|
384
|
+
+ * call on this thread, for a menu the runner took and then could not show.
|
|
385
|
+
+ */
|
|
386
|
+
+type ContextMenuRunner = (menuConfig: string, handler: number, showHere: () => void) => boolean;
|
|
387
|
+
+let contextMenuRunner: ContextMenuRunner | null = null;
|
|
388
|
+
+
|
|
389
|
+
+export function setContextMenuRunner(runner: ContextMenuRunner | null): void {
|
|
390
|
+
+ contextMenuRunner = runner;
|
|
391
|
+
+}
|
|
392
|
+
+
|
|
393
|
+
type DarwinNativeWrapperSymbols = {
|
|
394
|
+
wgpuViewSetAlphaBlending: (view: Pointer, enabled: boolean) => void;
|
|
395
|
+
setWGPUPointerHandler: (handler: Pointer | null) => void;
|
|
396
|
+
@@ -2349,8 +2362,11 @@ const _ffiImpl = {
|
|
397
|
+
},
|
|
398
|
+
showContextMenu: (params: { menuConfig: string }): void => {
|
|
399
|
+
const { menuConfig } = params;
|
|
400
|
+
+ const handler = contextMenuHandler.ptr as unknown as number | null;
|
|
401
|
+
+ const showHere = () => core_.symbols.showContextMenu(toCString(menuConfig), contextMenuHandler);
|
|
402
|
+
+ if (contextMenuRunner && handler && contextMenuRunner(menuConfig, handler, showHere)) return;
|
|
403
|
+
|
|
404
|
+
- core_.symbols.showContextMenu(toCString(menuConfig), contextMenuHandler);
|
|
405
|
+
+ showHere();
|
|
406
|
+
},
|
|
407
|
+
moveToTrash: (params: { path: string }): boolean => {
|
|
408
|
+
const { path } = params;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/cloud/bond-trades`: US corporate bond prints Gloom Cloud keeps, read by
|
|
3
|
+
* CUSIP or by company. A bond read here that its store did not keep yet is
|
|
4
|
+
* kept from then on, with the history the source still publishes for it;
|
|
5
|
+
* `keptSince` says from when prints are held, and nothing before it is.
|
|
6
|
+
* Gloom Pro.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface StoredBondPrint {
|
|
10
|
+
date: string;
|
|
11
|
+
/** New York time, as published. */
|
|
12
|
+
time: string | null;
|
|
13
|
+
status: "trade" | "cancel" | "correction";
|
|
14
|
+
/** A later cancel names this print. */
|
|
15
|
+
cancelled: boolean;
|
|
16
|
+
price: number | null;
|
|
17
|
+
yield: number | null;
|
|
18
|
+
/** Par amount; with `quantityCapped`, published only as at least this much. */
|
|
19
|
+
quantity: number | null;
|
|
20
|
+
quantityCapped: boolean;
|
|
21
|
+
/** Whether the reporting dealer bought or sold. */
|
|
22
|
+
side: "buy" | "sell" | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** A day's last trade standing: the history the price chart draws. A zero price is null. */
|
|
26
|
+
export interface StoredBondDay {
|
|
27
|
+
date: string;
|
|
28
|
+
prints: number;
|
|
29
|
+
price: number | null;
|
|
30
|
+
yield: number | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface StoredBondPayload {
|
|
34
|
+
cusip: string;
|
|
35
|
+
issuerName: string;
|
|
36
|
+
coupon: number | null;
|
|
37
|
+
maturity: string | null;
|
|
38
|
+
issuer: { symbol: string; name: string };
|
|
39
|
+
from: string;
|
|
40
|
+
to: string;
|
|
41
|
+
/** Newest first. */
|
|
42
|
+
trades: StoredBondPrint[];
|
|
43
|
+
truncated: boolean;
|
|
44
|
+
/** The first date prints are held from; null before any day was read. */
|
|
45
|
+
keptSince: string | null;
|
|
46
|
+
/** The source's own history of the bond is still to be read: prints are held from the day it was first looked up until then. */
|
|
47
|
+
backfillPending: boolean;
|
|
48
|
+
/** Oldest first. */
|
|
49
|
+
days: StoredBondDay[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface StoredIssuerBondsPayload {
|
|
53
|
+
symbol: string;
|
|
54
|
+
name: string;
|
|
55
|
+
keptSince: string | null;
|
|
56
|
+
backfillPending: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const BOND_HISTORY_MAX_DAYS = 1100;
|
|
@@ -6,12 +6,14 @@ interface CryptoDailyCloses {
|
|
|
6
6
|
|
|
7
7
|
export type CryptoAssetKind = "coin" | "stablecoin";
|
|
8
8
|
|
|
9
|
-
/** What a stablecoin holds to: a currency,
|
|
9
|
+
/** What a stablecoin holds to: a currency, a dollar value that accrues yield, or a dollar at a bond's maturity. */
|
|
10
10
|
export interface CryptoPeg {
|
|
11
11
|
/** The currency it is pegged to: USD, EUR. */
|
|
12
12
|
currency: string;
|
|
13
|
-
/**
|
|
13
|
+
/** Its price is not held at par: yield accrues into it (USDY), or it is a bond token priced toward par at maturity (BUSD0). It has no par to be off. */
|
|
14
14
|
accrues: boolean;
|
|
15
|
+
/** What a coin that accrues is: `yield` (USDY) or `bond` (BUSD0), `par` for the rest; absent from servers before it was served, where an accruing coin is a yield one. */
|
|
16
|
+
kind?: "par" | "yield" | "bond";
|
|
15
17
|
/** The target in dollars: 1 for USD, the EUR/USD rate for EUR; null when it accrues or the rate is unavailable. */
|
|
16
18
|
price: number | null;
|
|
17
19
|
/** When a target that moves (an exchange rate) was quoted; null for USD. */
|
|
@@ -71,6 +73,8 @@ export interface CryptoMarketsPayload {
|
|
|
71
73
|
generatedAt: string;
|
|
72
74
|
/** Each asset's change is since 00:00 UTC; a server before it sent the screener's 24-hour move. */
|
|
73
75
|
dayChangeBasis?: "utc-day";
|
|
76
|
+
/** Each asset's market cap is its price times its circulating supply; a server before it sent the source's own figure. */
|
|
77
|
+
marketCapBasis?: "circulating";
|
|
74
78
|
asOf: string | null;
|
|
75
79
|
status: "available" | "partial" | "unavailable";
|
|
76
80
|
source: {
|
|
@@ -167,6 +171,18 @@ export interface DefiTvlProtocol {
|
|
|
167
171
|
change7dPercent: number | null;
|
|
168
172
|
change30d: number | null;
|
|
169
173
|
change30dPercent: number | null;
|
|
174
|
+
/**
|
|
175
|
+
* USD its users paid in fees over the last 24 hours, 7 and 30 days, its
|
|
176
|
+
* versions together, read with its TVL; null where the source has no
|
|
177
|
+
* figure. Absent from servers before them.
|
|
178
|
+
*/
|
|
179
|
+
fees24h?: number | null;
|
|
180
|
+
fees7d?: number | null;
|
|
181
|
+
fees30d?: number | null;
|
|
182
|
+
/** The part of those fees the protocol kept (the source's revenue), USD. */
|
|
183
|
+
revenue24h?: number | null;
|
|
184
|
+
revenue7d?: number | null;
|
|
185
|
+
revenue30d?: number | null;
|
|
170
186
|
}
|
|
171
187
|
|
|
172
188
|
export interface DefiTvlChain {
|
|
@@ -197,6 +213,8 @@ export interface DefiTvlPayload {
|
|
|
197
213
|
protocols: DefiTvlProtocol[];
|
|
198
214
|
/** When the protocols' figures were read: the source's latest, not a daily close. */
|
|
199
215
|
protocolsAsOf: string | null;
|
|
216
|
+
/** When the protocols' fees and revenue were read; null when they could not be, absent from servers before them. */
|
|
217
|
+
incomeAsOf?: string | null;
|
|
200
218
|
/** The largest chains by TVL, largest first. */
|
|
201
219
|
chains: DefiTvlChain[];
|
|
202
220
|
/** Total DeFi TVL in USD per UTC day since `start`, its first day with value locked. */
|
package/src/api-client/data.ts
CHANGED
|
@@ -17,6 +17,7 @@ import type { EarningsEvent } from "../types/data-provider";
|
|
|
17
17
|
import type { MarketDividendsPayload, MarketHeatmapResult, MarketHeatmapUniverseId, MarketMoversPayload } from "./market-discovery";
|
|
18
18
|
import type { BankFiguresPayload } from "./bank-figures";
|
|
19
19
|
import type { DebtMaturitiesPayload } from "./debt-maturities";
|
|
20
|
+
import type { StoredBondPayload, StoredIssuerBondsPayload } from "./bond-trades";
|
|
20
21
|
import type { RevenueBreakdownPayload, RevenueBreakdownView } from "./revenue-breakdown";
|
|
21
22
|
import type { MnaDealPayload, MnaDealsParams, MnaDealsPayload } from "./mna";
|
|
22
23
|
import {
|
|
@@ -1118,6 +1119,26 @@ export class CloudDataApi {
|
|
|
1118
1119
|
return this.request<DebtMaturitiesPayload>(cloudDebtMaturitiesPath(symbol, listing), { signal: AbortSignal.timeout(45_000) });
|
|
1119
1120
|
}
|
|
1120
1121
|
|
|
1122
|
+
/** One bond's kept prints and daily closes over `from` to `to` (at most 1,100 days); reading it keeps the bond from now on. */
|
|
1123
|
+
async getCloudStoredBond(
|
|
1124
|
+
cusip: string,
|
|
1125
|
+
params: { from: string; to: string; limit?: number },
|
|
1126
|
+
options: { signal?: AbortSignal } = {},
|
|
1127
|
+
): Promise<StoredBondPayload> {
|
|
1128
|
+
const query = new URLSearchParams({ from: params.from, to: params.to, ...(params.limit ? { limit: String(params.limit) } : {}) });
|
|
1129
|
+
return this.request<StoredBondPayload>(`/cloud/bond-trades/bond/${encodeURIComponent(cusip)}?${query}`, {
|
|
1130
|
+
signal: options.signal ?? AbortSignal.timeout(20_000),
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/** A company's bonds as kept; reading it keeps them from now on. Only the first page of bonds and prints is asked. */
|
|
1135
|
+
async getCloudStoredIssuerBonds(symbol: string, options: { signal?: AbortSignal } = {}): Promise<StoredIssuerBondsPayload> {
|
|
1136
|
+
const query = new URLSearchParams({ symbol, limit: "1", bondsLimit: "1" });
|
|
1137
|
+
return this.request<StoredIssuerBondsPayload>(`/cloud/bond-trades/issuer?${query}`, {
|
|
1138
|
+
signal: options.signal ?? AbortSignal.timeout(20_000),
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1121
1142
|
async getCloudBankFigures(symbol: string): Promise<BankFiguresPayload> {
|
|
1122
1143
|
return this.request<BankFiguresPayload>(cloudBankFiguresPath(symbol), { signal: AbortSignal.timeout(30_000) });
|
|
1123
1144
|
}
|
|
@@ -15,7 +15,8 @@ interface FundFact<T> {
|
|
|
15
15
|
* premium or discount to NAV. Servers before them say null.
|
|
16
16
|
*/
|
|
17
17
|
export type FundStructure = "registered" | "trust" | "closed-end" | "bdc";
|
|
18
|
-
|
|
18
|
+
/** `management-fee`: a Hong Kong fund's management fee, which its issuer states apart from the ongoing charges. */
|
|
19
|
+
type ExpenseRatioKind = "net" | "gross" | "sponsor-fee" | "management-fee";
|
|
19
20
|
/**
|
|
20
21
|
* A bond fund as its sponsor classes it: `municipal` when its interest is
|
|
21
22
|
* exempt from federal income tax, `taxable` otherwise.
|
|
@@ -146,7 +147,28 @@ export interface FundFactsPayload {
|
|
|
146
147
|
sharesOutstanding?: FundFact<number> | null;
|
|
147
148
|
/** The 1M change in shares outstanding; null until a month of counts is kept. Servers before it leave it out. */
|
|
148
149
|
flows?: FundFlows | null;
|
|
150
|
+
/**
|
|
151
|
+
* The currency the NAV and closing price are in: a Hong Kong counter's own
|
|
152
|
+
* (HKD for 3046, USD for 9046). Absent for a US fund, whose figures are in
|
|
153
|
+
* US dollars.
|
|
154
|
+
*/
|
|
155
|
+
currency?: string;
|
|
156
|
+
/**
|
|
157
|
+
* A spot bitcoin or ether fund's coins as its issuer states them, and the
|
|
158
|
+
* units in issue per coin on the same day (the Hong Kong spot funds).
|
|
159
|
+
* Absent for any other fund and from servers before it.
|
|
160
|
+
*/
|
|
161
|
+
coinHoldings?: FundCoinHoldings | null;
|
|
149
162
|
/** The newest NAV is older than a few US trading days: every figure is older than it looks. */
|
|
150
163
|
stale: boolean;
|
|
151
164
|
fetchedAt: string | null;
|
|
152
165
|
}
|
|
166
|
+
|
|
167
|
+
export interface FundCoinHoldings {
|
|
168
|
+
asset: "BTC" | "ETH";
|
|
169
|
+
coins: number;
|
|
170
|
+
unitsPerCoin: number;
|
|
171
|
+
asOf: string;
|
|
172
|
+
source: string;
|
|
173
|
+
url?: string;
|
|
174
|
+
}
|
package/src/api-client/index.ts
CHANGED
|
@@ -992,6 +992,8 @@ class GloomApiClient {
|
|
|
992
992
|
optionsPositioning = this.data.optionsPositioning.bind(this.data);
|
|
993
993
|
getCloudBankFigures = this.data.getCloudBankFigures.bind(this.data);
|
|
994
994
|
getCloudDebtMaturities = this.data.getCloudDebtMaturities.bind(this.data);
|
|
995
|
+
getCloudStoredBond = this.data.getCloudStoredBond.bind(this.data);
|
|
996
|
+
getCloudStoredIssuerBonds = this.data.getCloudStoredIssuerBonds.bind(this.data);
|
|
995
997
|
getCloudRevenueBreakdown = this.data.getCloudRevenueBreakdown.bind(this.data);
|
|
996
998
|
getCloudMnaDeals = this.data.getCloudMnaDeals.bind(this.data);
|
|
997
999
|
getCloudMnaDeal = this.data.getCloudMnaDeal.bind(this.data);
|