obsidian-integration-testing 8.2.1 → 8.4.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/dist/lib/cjs/asar-fallback-detection.cjs +48 -0
- package/dist/lib/cjs/asar-fallback-detection.d.cts +75 -0
- package/dist/lib/cjs/compatibility-options.cjs +68 -0
- package/dist/lib/cjs/compatibility-options.d.cts +112 -0
- package/dist/lib/cjs/connect-to-cdp.cjs +19 -11
- package/dist/lib/cjs/connect-to-cdp.d.cts +64 -2
- package/dist/lib/cjs/ecmascript-version.cjs +63 -0
- package/dist/lib/cjs/ecmascript-version.d.cts +28 -0
- package/dist/lib/cjs/electron-compatibility.cjs +46 -0
- package/dist/lib/cjs/electron-compatibility.d.cts +74 -0
- package/dist/lib/cjs/index.cjs +10 -1
- package/dist/lib/cjs/index.d.cts +7 -1
- package/dist/lib/cjs/installer-asset.cjs +18 -3
- package/dist/lib/cjs/installer-asset.d.cts +26 -0
- package/dist/lib/cjs/installer-compatibility.cjs +1 -1
- package/dist/lib/cjs/installer-compatibility.d.cts +4 -1
- package/dist/lib/cjs/library.cjs +1 -1
- package/dist/lib/cjs/namespace-bootstrap.cjs +44 -7
- package/dist/lib/cjs/normalize-optional-properties.cjs +31 -0
- package/dist/lib/cjs/normalize-optional-properties.d.cts +26 -0
- package/dist/lib/cjs/obsidian-installer.cjs +6 -1
- package/dist/lib/cjs/obsidian-metadata.cjs +3775 -302
- package/dist/lib/cjs/obsidian-metadata.d.cts +71 -0
- package/dist/lib/cjs/obsidian-version-switch.cjs +5 -2
- package/dist/lib/cjs/owned-vault-seed.cjs +38 -0
- package/dist/lib/cjs/owned-vault-seed.d.cts +67 -0
- package/dist/lib/cjs/silent-asar-fallback-error.cjs +48 -0
- package/dist/lib/cjs/silent-asar-fallback-error.d.cts +40 -0
- package/dist/lib/cjs/transport-desktop-cdp.cjs +223 -45
- package/dist/lib/cjs/transport-desktop-cdp.d.cts +105 -1
- package/dist/lib/cjs/transport-factory.cjs +36 -16
- package/dist/lib/cjs/transport-options.cjs +1 -1
- package/dist/lib/cjs/transport-options.d.cts +48 -0
- package/dist/lib/esm/asar-fallback-detection.d.mts +75 -0
- package/dist/lib/esm/asar-fallback-detection.mjs +24 -0
- package/dist/lib/esm/compatibility-options.d.mts +112 -0
- package/dist/lib/esm/compatibility-options.mjs +40 -0
- package/dist/lib/esm/connect-to-cdp.d.mts +64 -2
- package/dist/lib/esm/connect-to-cdp.mjs +19 -11
- package/dist/lib/esm/ecmascript-version.d.mts +28 -0
- package/dist/lib/esm/ecmascript-version.mjs +39 -0
- package/dist/lib/esm/electron-compatibility.d.mts +74 -0
- package/dist/lib/esm/electron-compatibility.mjs +22 -0
- package/dist/lib/esm/index.d.mts +7 -1
- package/dist/lib/esm/index.mjs +7 -1
- package/dist/lib/esm/installer-asset.d.mts +26 -0
- package/dist/lib/esm/installer-asset.mjs +16 -2
- package/dist/lib/esm/installer-compatibility.d.mts +4 -1
- package/dist/lib/esm/installer-compatibility.mjs +1 -1
- package/dist/lib/esm/library.mjs +1 -1
- package/dist/lib/esm/namespace-bootstrap.mjs +44 -7
- package/dist/lib/esm/normalize-optional-properties.d.mts +26 -0
- package/dist/lib/esm/normalize-optional-properties.mjs +7 -0
- package/dist/lib/esm/obsidian-installer.mjs +8 -2
- package/dist/lib/esm/obsidian-metadata.d.mts +71 -0
- package/dist/lib/esm/obsidian-metadata.mjs +3775 -302
- package/dist/lib/esm/obsidian-version-switch.mjs +5 -2
- package/dist/lib/esm/owned-vault-seed.d.mts +67 -0
- package/dist/lib/esm/owned-vault-seed.mjs +14 -0
- package/dist/lib/esm/silent-asar-fallback-error.d.mts +40 -0
- package/dist/lib/esm/silent-asar-fallback-error.mjs +24 -0
- package/dist/lib/esm/transport-desktop-cdp.d.mts +105 -1
- package/dist/lib/esm/transport-desktop-cdp.mjs +223 -45
- package/dist/lib/esm/transport-factory.mjs +41 -16
- package/dist/lib/esm/transport-options.d.mts +48 -0
- package/dist/obsidian-integration-testing-8.4.0.tgz +0 -0
- package/package.json +3 -1
- package/dist/obsidian-integration-testing-8.2.1.tgz +0 -0
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Requirements: Node.js 22+ (uses built-in `WebSocket` and `fetch` globals).
|
|
18
18
|
*/
|
|
19
|
+
import type { AsarFallback } from './asar-fallback-detection.cjs';
|
|
20
|
+
import type { ElectronCompatibility } from './electron-compatibility.cjs';
|
|
19
21
|
import type { InstallerCompatibility } from './installer-compatibility.cjs';
|
|
20
22
|
import type { ObsidianTransport, TransportEvalOptions } from './transport.cjs';
|
|
21
23
|
/**
|
|
@@ -74,6 +76,25 @@ export interface DesktopCdpTransportConfig {
|
|
|
74
76
|
* @default `false`
|
|
75
77
|
*/
|
|
76
78
|
shouldDisableSandbox?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Whether a post-boot **silent asar fallback** (the running app version differs
|
|
81
|
+
* from the swapped-in pin) fails fast with {@link SilentAsarFallbackError}. The
|
|
82
|
+
* verdict is always computed and surfaced via
|
|
83
|
+
* {@link DesktopCdpTransport.getAsarFallback}; this gates only the throw. Only
|
|
84
|
+
* meaningful in owned mode running a swapped-in asar.
|
|
85
|
+
*
|
|
86
|
+
* @default `true`
|
|
87
|
+
*/
|
|
88
|
+
shouldThrowOnSilentAsarFallback?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Whether the post-boot runtime-Electron compatibility nag warning is emitted
|
|
91
|
+
* when the live Electron is below the app's recommended minimum. The verdict is
|
|
92
|
+
* always computed and surfaced via {@link DesktopCdpTransport.getElectronCompatibility};
|
|
93
|
+
* this only gates the log. Only meaningful in owned mode.
|
|
94
|
+
*
|
|
95
|
+
* @default `true`
|
|
96
|
+
*/
|
|
97
|
+
shouldWarnOnCompatibilityIssues?: boolean;
|
|
77
98
|
}
|
|
78
99
|
/**
|
|
79
100
|
* An asar to provision into a harness-owned instance's user-data dir before launch.
|
|
@@ -96,7 +117,10 @@ export interface OwnedInstanceConfig {
|
|
|
96
117
|
/**
|
|
97
118
|
* The resolved installer↔app compatibility verdict, when it could be determined
|
|
98
119
|
* (an asar-swap onto a known shell version). Surfaced by
|
|
99
|
-
* {@link DesktopCdpTransport.getCompatibility}.
|
|
120
|
+
* {@link DesktopCdpTransport.getCompatibility}. An `'unrunnable'` verdict reaches
|
|
121
|
+
* this surface only when the proactive throw is disabled
|
|
122
|
+
* (`shouldThrowOnIncompatibleInstaller: false`); otherwise it throws
|
|
123
|
+
* `IncompatibleInstallerVersionError` before the config is built.
|
|
100
124
|
*/
|
|
101
125
|
readonly compatibility?: InstallerCompatibility | undefined;
|
|
102
126
|
/** Absolute path to the Obsidian shell executable to launch. */
|
|
@@ -128,17 +152,21 @@ export declare class DesktopCdpTransport implements ObsidianTransport {
|
|
|
128
152
|
*/
|
|
129
153
|
readonly isMobile = false;
|
|
130
154
|
private activeVaultPath;
|
|
155
|
+
private asarFallback;
|
|
131
156
|
private readonly cdpHost;
|
|
132
157
|
private cdpPort;
|
|
133
158
|
private cdpUrl;
|
|
134
159
|
private readonly commandTimeoutInMilliseconds;
|
|
135
160
|
private readonly deadBootGraceInMilliseconds;
|
|
161
|
+
private electronCompatibility;
|
|
136
162
|
private readonly isHarnessOwnedInstance;
|
|
137
163
|
private readonly isObsidianAppVisible;
|
|
138
164
|
private messageId;
|
|
139
165
|
private readonly ownedConfig;
|
|
140
166
|
private ownedInstance;
|
|
141
167
|
private readonly shouldDisableSandbox;
|
|
168
|
+
private readonly shouldThrowOnSilentAsarFallback;
|
|
169
|
+
private readonly shouldWarnOnCompatibilityIssues;
|
|
142
170
|
private ws;
|
|
143
171
|
/**
|
|
144
172
|
* Creates a new CDP transport.
|
|
@@ -170,6 +198,19 @@ export declare class DesktopCdpTransport implements ObsidianTransport {
|
|
|
170
198
|
* @returns The normalized result string.
|
|
171
199
|
*/
|
|
172
200
|
evaluate(expression: string, options: TransportEvalOptions): Promise<string>;
|
|
201
|
+
/**
|
|
202
|
+
* Returns the silent-asar-fallback verdict for this owned instance — whether the
|
|
203
|
+
* app version it is actually running matches the swapped-in pin, or the installer
|
|
204
|
+
* silently reverted to its own bundled asar (read live post-boot). Returns
|
|
205
|
+
* `undefined` when this is not an owned instance, the instance has not booted
|
|
206
|
+
* yet, or the verdict could not be determined (no asar was swapped, or the live
|
|
207
|
+
* version was unreadable). A `'fallback'` verdict reaches this surface only when
|
|
208
|
+
* the throw is disabled ({@link DesktopCdpTransportConfig.shouldThrowOnSilentAsarFallback}
|
|
209
|
+
* `false`); otherwise it throws `SilentAsarFallbackError`.
|
|
210
|
+
*
|
|
211
|
+
* @returns The silent-asar-fallback verdict, or `undefined`.
|
|
212
|
+
*/
|
|
213
|
+
getAsarFallback(): AsarFallback | undefined;
|
|
173
214
|
/**
|
|
174
215
|
* Returns the resolved installer↔app compatibility verdict for this owned
|
|
175
216
|
* instance, so callers can assert on it. Returns `undefined` when this is not
|
|
@@ -179,6 +220,17 @@ export declare class DesktopCdpTransport implements ObsidianTransport {
|
|
|
179
220
|
* @returns The compatibility verdict, or `undefined`.
|
|
180
221
|
*/
|
|
181
222
|
getCompatibility(): InstallerCompatibility | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Returns the runtime Electron compatibility verdict for this owned instance —
|
|
225
|
+
* whether the Electron version it is actually running is new enough for the
|
|
226
|
+
* running app version (read live post-boot; see {@link ObsidianVersionMetadata.minRecommendedElectronVersion}).
|
|
227
|
+
* Returns `undefined` when this is not an owned instance, the instance has not
|
|
228
|
+
* booted yet, or the verdict could not be determined (the live version was
|
|
229
|
+
* unreadable, or the app version carries no recommended Electron version).
|
|
230
|
+
*
|
|
231
|
+
* @returns The runtime Electron compatibility verdict, or `undefined`.
|
|
232
|
+
*/
|
|
233
|
+
getElectronCompatibility(): ElectronCompatibility | undefined;
|
|
182
234
|
/**
|
|
183
235
|
* Returns the CDP endpoint of the owned, launched instance so the global setup
|
|
184
236
|
* can hand it to test workers (which then **attach** to it instead of
|
|
@@ -212,6 +264,47 @@ export declare class DesktopCdpTransport implements ObsidianTransport {
|
|
|
212
264
|
* @param vaultPath - The absolute path to the vault folder.
|
|
213
265
|
*/
|
|
214
266
|
unregisterVault(vaultPath: string): Promise<void>;
|
|
267
|
+
/**
|
|
268
|
+
* Computes and stores the runtime-Electron compatibility verdict (on
|
|
269
|
+
* {@link getElectronCompatibility}) from an already-read version pair, warning
|
|
270
|
+
* when the live Electron is below the app's recommended minimum. Never throws; a
|
|
271
|
+
* boot whose running app version was unreadable is skipped (nothing to judge).
|
|
272
|
+
*
|
|
273
|
+
* @param appVersion - The live running app version, or `undefined` when unreadable.
|
|
274
|
+
* @param actualElectronVersion - The live Electron version, or `undefined` when unreadable.
|
|
275
|
+
*/
|
|
276
|
+
private applyElectronCompatibility;
|
|
277
|
+
/**
|
|
278
|
+
* Verifies the running app (asar) version matches the swapped-in pin, storing the
|
|
279
|
+
* verdict on {@link getAsarFallback}. On a **silent fallback** (the installer ran
|
|
280
|
+
* its own bundled asar instead of the pin) it throws {@link SilentAsarFallbackError}
|
|
281
|
+
* when the throw is enabled, otherwise warns (when warnings are on) and lets the
|
|
282
|
+
* boot proceed. A boot with no swapped-in asar, or an unreadable running version,
|
|
283
|
+
* is `'unknown'` — nothing is thrown or warned. This is the healthy-UI companion to
|
|
284
|
+
* the black-screen {@link RendererFailedToInitializeError} dead-boot fast-fail.
|
|
285
|
+
*
|
|
286
|
+
* @param runningApiVersion - The live running app version, or `undefined` when unreadable.
|
|
287
|
+
*/
|
|
288
|
+
private checkRuntimeAsarFallback;
|
|
289
|
+
/**
|
|
290
|
+
* Runs the post-boot runtime compatibility checks for an owned instance, once the
|
|
291
|
+
* vault is ready. Reads the live running app version and Electron version **once**
|
|
292
|
+
* from the booted renderer's main process, then: (1) verifies the running app
|
|
293
|
+
* version matches the swapped-in pin — throwing {@link SilentAsarFallbackError} on
|
|
294
|
+
* a silent fallback (when enabled); and (2) runs the best-effort runtime-Electron
|
|
295
|
+
* nag. Only the asar-fallback check can throw, so this must run outside the
|
|
296
|
+
* readiness poll's try/catch (a swallowed throw would loop until timeout).
|
|
297
|
+
*
|
|
298
|
+
* Both are read at the renderer top level: `ipcRenderer.sendSync('version')` (the
|
|
299
|
+
* running app version, truthful even under a silent asar fallback) and
|
|
300
|
+
* `process.versions.electron` (the live shell Electron); neither uses
|
|
301
|
+
* `require('obsidian')`, which resolves only inside a plugin-load context. A read
|
|
302
|
+
* failure leaves both unknown (logged, non-fatal) — an unreadable running version
|
|
303
|
+
* cannot be judged a fallback, so the boot is not broken by a flaky read.
|
|
304
|
+
*
|
|
305
|
+
* @param vaultPath - The vault path to evaluate in.
|
|
306
|
+
*/
|
|
307
|
+
private checkRuntimeCompatibility;
|
|
215
308
|
/**
|
|
216
309
|
* Connects to a CDP target's WebSocket endpoint.
|
|
217
310
|
*
|
|
@@ -275,6 +368,17 @@ export declare class DesktopCdpTransport implements ObsidianTransport {
|
|
|
275
368
|
* @returns The list of page targets.
|
|
276
369
|
*/
|
|
277
370
|
private getPageTargets;
|
|
371
|
+
/**
|
|
372
|
+
* Kills the currently-running owned instance (if any) and waits for it to exit,
|
|
373
|
+
* so the next launch gets a pristine single-window instance.
|
|
374
|
+
*
|
|
375
|
+
* Relaunching over a live instance is forwarded by Electron's single-instance
|
|
376
|
+
* lock on the shared user-data dir and surfaces the vault picker, and opening a
|
|
377
|
+
* second window via IPC leaves stale windows that break vault-target routing —
|
|
378
|
+
* hence a full kill + wait-for-exit (releasing the lock) between launches. A
|
|
379
|
+
* no-op on the first attempt, when no instance is running yet.
|
|
380
|
+
*/
|
|
381
|
+
private killRunningOwnedInstance;
|
|
278
382
|
/**
|
|
279
383
|
* Moves the owned instance's window off-screen so a hidden run never steals
|
|
280
384
|
* focus. Uses Electron's remote bridge (`window.electron.remote`) — the only
|