@harborclient/sdk 1.4.4 → 1.5.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/CHANGELOG.md +12 -0
- package/dist/components/SidebarItem/SidebarWebsiteItem.d.ts +11 -2
- package/dist/components/SidebarItem/SidebarWebsiteItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarWebsiteItem.js +6 -3
- package/dist/components/TabBar/index.d.ts +11 -1
- package/dist/components/TabBar/index.d.ts.map +1 -1
- package/dist/components/TabBar/index.js +51 -8
- package/dist/components/VariableInput/index.d.ts +10 -1
- package/dist/components/VariableInput/index.d.ts.map +1 -1
- package/dist/components/VariableInput/index.js +19 -2
- package/dist/runtime/createBridgedPluginContext.js +76 -19
- package/dist/runtime/livePageHandle.d.ts +50 -0
- package/dist/runtime/{webpageHandle.js → livePageHandle.js} +125 -47
- package/dist/snippets.d.ts +34 -12
- package/dist/types.d.ts +521 -14
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/runtime/webpageHandle.d.ts +0 -50
package/dist/types.d.ts
CHANGED
|
@@ -607,6 +607,55 @@ export interface RequestToolbarActionContribution {
|
|
|
607
607
|
*/
|
|
608
608
|
order?: number;
|
|
609
609
|
}
|
|
610
|
+
/**
|
|
611
|
+
* Context passed to a live-page chrome action command when the user clicks the button.
|
|
612
|
+
*/
|
|
613
|
+
export interface LivePageChromeActionContext {
|
|
614
|
+
/**
|
|
615
|
+
* Client-side id of the browser tab whose chrome rendered the button.
|
|
616
|
+
*/
|
|
617
|
+
tabId: string;
|
|
618
|
+
/**
|
|
619
|
+
* Current page URL shown in the address bar.
|
|
620
|
+
*/
|
|
621
|
+
url: string;
|
|
622
|
+
/**
|
|
623
|
+
* Document title shown in the tab bar.
|
|
624
|
+
*/
|
|
625
|
+
title: string;
|
|
626
|
+
/**
|
|
627
|
+
* Linked saved website database id when the tab is bound to a Website; otherwise null/undefined.
|
|
628
|
+
*/
|
|
629
|
+
websiteId?: number | null;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Adds a RoundButton to the embedded browser chrome bar (between Downloads and Ask AI).
|
|
633
|
+
*
|
|
634
|
+
* Register the command handler with {@link PluginCommands.register} separately.
|
|
635
|
+
* The handler receives a single {@link LivePageChromeActionContext} argument.
|
|
636
|
+
* Manifest: `contributes.livePageChromeActions` plus a matching `contributes.commands` entry.
|
|
637
|
+
* Requires the `ui` permission.
|
|
638
|
+
*
|
|
639
|
+
* Buttons sort by plugin activation order, then registration order within the plugin — not by title.
|
|
640
|
+
*/
|
|
641
|
+
export interface LivePageChromeActionContribution {
|
|
642
|
+
/**
|
|
643
|
+
* Action id — must match an entry in `contributes.livePageChromeActions`.
|
|
644
|
+
*/
|
|
645
|
+
id: string;
|
|
646
|
+
/**
|
|
647
|
+
* Button label / accessible name (and tooltip).
|
|
648
|
+
*/
|
|
649
|
+
title: string;
|
|
650
|
+
/**
|
|
651
|
+
* Command id to run on click — must match a registered command and manifest entry.
|
|
652
|
+
*/
|
|
653
|
+
command: string;
|
|
654
|
+
/**
|
|
655
|
+
* Optional curated icon name resolved by the host (falls back to a puzzle-piece icon).
|
|
656
|
+
*/
|
|
657
|
+
icon?: string;
|
|
658
|
+
}
|
|
610
659
|
/**
|
|
611
660
|
* Context passed to a script editor action command when the user clicks a row button.
|
|
612
661
|
*/
|
|
@@ -1340,6 +1389,23 @@ export interface LiveServerRoute {
|
|
|
1340
1389
|
*/
|
|
1341
1390
|
enabled?: boolean;
|
|
1342
1391
|
}
|
|
1392
|
+
/**
|
|
1393
|
+
* One custom error-page mapping for a Harbor Live Server (status code → HTML file).
|
|
1394
|
+
*/
|
|
1395
|
+
export interface LiveServerErrorPage {
|
|
1396
|
+
/**
|
|
1397
|
+
* Status pattern: exact (`404`), decade (`40x`), or class (`4xx`).
|
|
1398
|
+
*/
|
|
1399
|
+
code: string;
|
|
1400
|
+
/**
|
|
1401
|
+
* HTML file path, absolute or relative to the server root.
|
|
1402
|
+
*/
|
|
1403
|
+
path: string;
|
|
1404
|
+
/**
|
|
1405
|
+
* When false, the mapping is ignored. Defaults to true when omitted.
|
|
1406
|
+
*/
|
|
1407
|
+
enabled?: boolean;
|
|
1408
|
+
}
|
|
1343
1409
|
/**
|
|
1344
1410
|
* One reverse-proxy rule for a Harbor Live Server (path prefix → HTTP/HTTPS upstream).
|
|
1345
1411
|
*/
|
|
@@ -1457,6 +1523,10 @@ export interface LiveServerConfig {
|
|
|
1457
1523
|
* Path or file opened when the Live Page starts (always leading `/`).
|
|
1458
1524
|
*/
|
|
1459
1525
|
openPath: string;
|
|
1526
|
+
/**
|
|
1527
|
+
* When true, open a Live Page at the start path when the server starts.
|
|
1528
|
+
*/
|
|
1529
|
+
openPathOnStartup: boolean;
|
|
1460
1530
|
/**
|
|
1461
1531
|
* When true, navigations within the origin update {@link lastOpenedPath}.
|
|
1462
1532
|
*/
|
|
@@ -1481,6 +1551,10 @@ export interface LiveServerConfig {
|
|
|
1481
1551
|
* Ordered path routing rules applied after static miss (first match wins).
|
|
1482
1552
|
*/
|
|
1483
1553
|
routes: LiveServerRoute[];
|
|
1554
|
+
/**
|
|
1555
|
+
* Status-code → HTML file mappings for custom error responses.
|
|
1556
|
+
*/
|
|
1557
|
+
errorPages: LiveServerErrorPage[];
|
|
1484
1558
|
/**
|
|
1485
1559
|
* Ordered reverse-proxy rules applied before static (first match wins).
|
|
1486
1560
|
*/
|
|
@@ -1523,6 +1597,12 @@ export interface LiveServer {
|
|
|
1523
1597
|
* Stable portable identifier.
|
|
1524
1598
|
*/
|
|
1525
1599
|
uuid: string;
|
|
1600
|
+
/**
|
|
1601
|
+
* Id of the storage connection that stores this live server.
|
|
1602
|
+
*
|
|
1603
|
+
* Omitted for provider-local records before routed storage adds registry metadata.
|
|
1604
|
+
*/
|
|
1605
|
+
connectionId?: string;
|
|
1526
1606
|
/**
|
|
1527
1607
|
* Display name.
|
|
1528
1608
|
*/
|
|
@@ -1551,6 +1631,10 @@ export interface LiveServer {
|
|
|
1551
1631
|
* Path or file opened when the Live Page starts (always leading `/`).
|
|
1552
1632
|
*/
|
|
1553
1633
|
openPath: string;
|
|
1634
|
+
/**
|
|
1635
|
+
* When true, open a Live Page at the start path when the server starts.
|
|
1636
|
+
*/
|
|
1637
|
+
openPathOnStartup: boolean;
|
|
1554
1638
|
/**
|
|
1555
1639
|
* When true, navigations within the origin update {@link lastOpenedPath}.
|
|
1556
1640
|
*/
|
|
@@ -1575,6 +1659,10 @@ export interface LiveServer {
|
|
|
1575
1659
|
* Ordered path routing rules applied after static miss (first match wins).
|
|
1576
1660
|
*/
|
|
1577
1661
|
routes: LiveServerRoute[];
|
|
1662
|
+
/**
|
|
1663
|
+
* Status-code → HTML file mappings for custom error responses.
|
|
1664
|
+
*/
|
|
1665
|
+
errorPages: LiveServerErrorPage[];
|
|
1578
1666
|
/**
|
|
1579
1667
|
* Ordered reverse-proxy rules applied before static (first match wins).
|
|
1580
1668
|
*/
|
|
@@ -1621,6 +1709,10 @@ export interface LiveServer {
|
|
|
1621
1709
|
* Input for creating a saved Harbor Live Server.
|
|
1622
1710
|
*/
|
|
1623
1711
|
export interface CreateLiveServerInput {
|
|
1712
|
+
/**
|
|
1713
|
+
* Optional storage connection id; defaults to the active data provider when omitted.
|
|
1714
|
+
*/
|
|
1715
|
+
connectionId?: string;
|
|
1624
1716
|
/**
|
|
1625
1717
|
* Display name for the saved server.
|
|
1626
1718
|
*/
|
|
@@ -1649,6 +1741,10 @@ export interface CreateLiveServerInput {
|
|
|
1649
1741
|
* Entry / open path. Defaults to `/`.
|
|
1650
1742
|
*/
|
|
1651
1743
|
openPath?: string;
|
|
1744
|
+
/**
|
|
1745
|
+
* Whether to open a Live Page on start. Defaults to true.
|
|
1746
|
+
*/
|
|
1747
|
+
openPathOnStartup?: boolean;
|
|
1652
1748
|
/**
|
|
1653
1749
|
* Whether to remember the last opened URL. Defaults to false.
|
|
1654
1750
|
*/
|
|
@@ -1673,6 +1769,10 @@ export interface CreateLiveServerInput {
|
|
|
1673
1769
|
* Path routing rules. Defaults to `[]`.
|
|
1674
1770
|
*/
|
|
1675
1771
|
routes?: LiveServerRoute[];
|
|
1772
|
+
/**
|
|
1773
|
+
* Custom error-page mappings. Defaults to `[]`.
|
|
1774
|
+
*/
|
|
1775
|
+
errorPages?: LiveServerErrorPage[];
|
|
1676
1776
|
/**
|
|
1677
1777
|
* Reverse-proxy rules. Defaults to `[]`.
|
|
1678
1778
|
*/
|
|
@@ -1712,6 +1812,12 @@ export interface UpdateLiveServerInput {
|
|
|
1712
1812
|
* Database primary key of the server to update.
|
|
1713
1813
|
*/
|
|
1714
1814
|
id: number;
|
|
1815
|
+
/**
|
|
1816
|
+
* Optional destination storage connection id.
|
|
1817
|
+
*
|
|
1818
|
+
* Hosts that support routed storage move the live server before applying the update.
|
|
1819
|
+
*/
|
|
1820
|
+
connectionId?: string;
|
|
1715
1821
|
/**
|
|
1716
1822
|
* Display name for the saved server.
|
|
1717
1823
|
*/
|
|
@@ -1740,6 +1846,10 @@ export interface UpdateLiveServerInput {
|
|
|
1740
1846
|
* Entry / open path relative to the server origin.
|
|
1741
1847
|
*/
|
|
1742
1848
|
openPath: string;
|
|
1849
|
+
/**
|
|
1850
|
+
* Whether to open a Live Page on start.
|
|
1851
|
+
*/
|
|
1852
|
+
openPathOnStartup: boolean;
|
|
1743
1853
|
/**
|
|
1744
1854
|
* Whether to remember the last opened URL.
|
|
1745
1855
|
*/
|
|
@@ -1764,6 +1874,10 @@ export interface UpdateLiveServerInput {
|
|
|
1764
1874
|
* Path routing rules.
|
|
1765
1875
|
*/
|
|
1766
1876
|
routes: LiveServerRoute[];
|
|
1877
|
+
/**
|
|
1878
|
+
* Custom error-page mappings.
|
|
1879
|
+
*/
|
|
1880
|
+
errorPages: LiveServerErrorPage[];
|
|
1767
1881
|
/**
|
|
1768
1882
|
* Reverse-proxy rules.
|
|
1769
1883
|
*/
|
|
@@ -1799,7 +1913,7 @@ export interface UpdateLiveServerInput {
|
|
|
1799
1913
|
*
|
|
1800
1914
|
* Provide `savedId` to start from a persisted config (config optional override),
|
|
1801
1915
|
* or provide `config` alone for an ad-hoc run. Does not open a browser tab;
|
|
1802
|
-
* use {@link PluginContext.
|
|
1916
|
+
* use {@link PluginContext.livePage} when the `browser` permission is granted.
|
|
1803
1917
|
*/
|
|
1804
1918
|
export interface StartLiveServerInput {
|
|
1805
1919
|
/**
|
|
@@ -2103,6 +2217,343 @@ export interface PluginLiveServers {
|
|
|
2103
2217
|
*/
|
|
2104
2218
|
onRequestLog(listener: (entry: LiveServerRequestLogEntry) => void): Disposable;
|
|
2105
2219
|
}
|
|
2220
|
+
/**
|
|
2221
|
+
* Page-load points at which a saved website injection script may run.
|
|
2222
|
+
*
|
|
2223
|
+
* Mirrors `@harborclient/core` website script run-at values.
|
|
2224
|
+
*/
|
|
2225
|
+
export type WebsiteScriptRunAt = 'document-start' | 'dom-ready' | 'did-finish-load';
|
|
2226
|
+
/**
|
|
2227
|
+
* One plain JavaScript injection script persisted with a website.
|
|
2228
|
+
*
|
|
2229
|
+
* Mirrors `@harborclient/core` website injection script rows.
|
|
2230
|
+
*/
|
|
2231
|
+
export interface WebsiteInjectionScript {
|
|
2232
|
+
/**
|
|
2233
|
+
* Stable id within the website's script list.
|
|
2234
|
+
*/
|
|
2235
|
+
id: string;
|
|
2236
|
+
/**
|
|
2237
|
+
* Display name shown in browser settings.
|
|
2238
|
+
*/
|
|
2239
|
+
name: string;
|
|
2240
|
+
/**
|
|
2241
|
+
* When false, the script is skipped at injection time.
|
|
2242
|
+
*/
|
|
2243
|
+
enabled: boolean;
|
|
2244
|
+
/**
|
|
2245
|
+
* Guest lifecycle hook that triggers this script.
|
|
2246
|
+
*/
|
|
2247
|
+
runAt: WebsiteScriptRunAt;
|
|
2248
|
+
/**
|
|
2249
|
+
* JavaScript source executed in the page main world.
|
|
2250
|
+
*/
|
|
2251
|
+
source: string;
|
|
2252
|
+
}
|
|
2253
|
+
/**
|
|
2254
|
+
* One pre/post request script on a saved website (no path match).
|
|
2255
|
+
*
|
|
2256
|
+
* Mirrors `@harborclient/core` ScriptRef used by live pages.
|
|
2257
|
+
*/
|
|
2258
|
+
export interface WebsiteScriptRef {
|
|
2259
|
+
/**
|
|
2260
|
+
* Stable list key used for reordering and React keys.
|
|
2261
|
+
*/
|
|
2262
|
+
id: string;
|
|
2263
|
+
/**
|
|
2264
|
+
* When false, the script is skipped.
|
|
2265
|
+
*/
|
|
2266
|
+
enabled: boolean;
|
|
2267
|
+
/**
|
|
2268
|
+
* Inline JavaScript source or a live reference to a saved snippet.
|
|
2269
|
+
*/
|
|
2270
|
+
kind: 'inline' | 'snippet';
|
|
2271
|
+
/**
|
|
2272
|
+
* Optional display label for inline scripts.
|
|
2273
|
+
*/
|
|
2274
|
+
name?: string;
|
|
2275
|
+
/**
|
|
2276
|
+
* JavaScript source when {@link kind} is `inline`.
|
|
2277
|
+
*/
|
|
2278
|
+
code?: string;
|
|
2279
|
+
/**
|
|
2280
|
+
* Snippet uuid when {@link kind} is `snippet`.
|
|
2281
|
+
*/
|
|
2282
|
+
snippetUuid?: string;
|
|
2283
|
+
/**
|
|
2284
|
+
* When true, the script editor body is expanded in the list UI.
|
|
2285
|
+
*/
|
|
2286
|
+
expanded?: boolean;
|
|
2287
|
+
/**
|
|
2288
|
+
* Stage within a request stage list. Live pages coerce this to `main`.
|
|
2289
|
+
*/
|
|
2290
|
+
stage?: ScriptStage;
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Authorization stored on a saved website (includes OAuth 2.0 fields for parity with core).
|
|
2294
|
+
*
|
|
2295
|
+
* Mirrors `@harborclient/core` AuthConfig used by {@link Website}.
|
|
2296
|
+
*/
|
|
2297
|
+
export interface WebsiteAuthConfig {
|
|
2298
|
+
/**
|
|
2299
|
+
* Selected auth mode; none means no chrome-driven auth header.
|
|
2300
|
+
*/
|
|
2301
|
+
type: 'none' | 'basic' | 'bearer' | 'oauth2';
|
|
2302
|
+
/**
|
|
2303
|
+
* Username and password for Basic Auth.
|
|
2304
|
+
*/
|
|
2305
|
+
basic: {
|
|
2306
|
+
username: string;
|
|
2307
|
+
password: string;
|
|
2308
|
+
};
|
|
2309
|
+
/**
|
|
2310
|
+
* Token value for Bearer Token auth.
|
|
2311
|
+
*/
|
|
2312
|
+
bearer: {
|
|
2313
|
+
token: string;
|
|
2314
|
+
};
|
|
2315
|
+
/**
|
|
2316
|
+
* OAuth 2.0 Client Credentials settings (not applied to guest navigations today).
|
|
2317
|
+
*/
|
|
2318
|
+
oauth2: {
|
|
2319
|
+
tokenUrl: string;
|
|
2320
|
+
clientId: string;
|
|
2321
|
+
clientSecret: string;
|
|
2322
|
+
scope: string;
|
|
2323
|
+
audience: string;
|
|
2324
|
+
clientAuth: 'body' | 'header';
|
|
2325
|
+
};
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* A saved embedded-browser website (live page) in the local registry.
|
|
2329
|
+
*
|
|
2330
|
+
* Mirrors `@harborclient/core` Website entity shape.
|
|
2331
|
+
*/
|
|
2332
|
+
export interface Website {
|
|
2333
|
+
/**
|
|
2334
|
+
* Database primary key.
|
|
2335
|
+
*/
|
|
2336
|
+
id: number;
|
|
2337
|
+
/**
|
|
2338
|
+
* Stable portable identifier for export/import.
|
|
2339
|
+
*/
|
|
2340
|
+
uuid: string;
|
|
2341
|
+
/**
|
|
2342
|
+
* Display name shown in the sidebar (last page title).
|
|
2343
|
+
*/
|
|
2344
|
+
name: string;
|
|
2345
|
+
/**
|
|
2346
|
+
* Last committed URL when the website was saved.
|
|
2347
|
+
*/
|
|
2348
|
+
url: string;
|
|
2349
|
+
/**
|
|
2350
|
+
* Home URL for the browser Home button.
|
|
2351
|
+
*/
|
|
2352
|
+
homeUrl: string;
|
|
2353
|
+
/**
|
|
2354
|
+
* Favicon as a data URL when available.
|
|
2355
|
+
*/
|
|
2356
|
+
faviconDataUrl: string | null;
|
|
2357
|
+
/**
|
|
2358
|
+
* Applied injection scripts.
|
|
2359
|
+
*/
|
|
2360
|
+
scripts: WebsiteInjectionScript[];
|
|
2361
|
+
/**
|
|
2362
|
+
* Applied pre-request hc.* scripts.
|
|
2363
|
+
*/
|
|
2364
|
+
preRequestScripts: WebsiteScriptRef[];
|
|
2365
|
+
/**
|
|
2366
|
+
* Applied post-request hc.* scripts.
|
|
2367
|
+
*/
|
|
2368
|
+
postRequestScripts: WebsiteScriptRef[];
|
|
2369
|
+
/**
|
|
2370
|
+
* Website-scoped variables for address-bar and script substitution.
|
|
2371
|
+
*/
|
|
2372
|
+
variables: Variable[];
|
|
2373
|
+
/**
|
|
2374
|
+
* Headers sent with chrome-driven guest navigations.
|
|
2375
|
+
*/
|
|
2376
|
+
headers: KeyValue[];
|
|
2377
|
+
/**
|
|
2378
|
+
* User-Agent override for chrome-driven navigations; empty uses Chromium default.
|
|
2379
|
+
*/
|
|
2380
|
+
userAgent: string;
|
|
2381
|
+
/**
|
|
2382
|
+
* Authorization applied to chrome-driven guest navigations (Basic/Bearer).
|
|
2383
|
+
*/
|
|
2384
|
+
auth: WebsiteAuthConfig;
|
|
2385
|
+
/**
|
|
2386
|
+
* Id of the storage connection that stores this live page.
|
|
2387
|
+
*
|
|
2388
|
+
* Omitted for provider-local records before RoutingStorage merges registry metadata.
|
|
2389
|
+
*/
|
|
2390
|
+
connectionId?: string;
|
|
2391
|
+
/**
|
|
2392
|
+
* Creation timestamp in milliseconds since epoch.
|
|
2393
|
+
*/
|
|
2394
|
+
createdAt: number;
|
|
2395
|
+
/**
|
|
2396
|
+
* Last update timestamp in milliseconds since epoch.
|
|
2397
|
+
*/
|
|
2398
|
+
updatedAt: number;
|
|
2399
|
+
}
|
|
2400
|
+
/**
|
|
2401
|
+
* Input for creating a website in the local registry.
|
|
2402
|
+
*
|
|
2403
|
+
* Mirrors `@harborclient/core` CreateWebsiteInput.
|
|
2404
|
+
*/
|
|
2405
|
+
export interface CreateWebsiteInput {
|
|
2406
|
+
/**
|
|
2407
|
+
* Display name for the website.
|
|
2408
|
+
*/
|
|
2409
|
+
name: string;
|
|
2410
|
+
/**
|
|
2411
|
+
* Optional portable uuid; generated when omitted.
|
|
2412
|
+
*/
|
|
2413
|
+
uuid?: string;
|
|
2414
|
+
/**
|
|
2415
|
+
* Optional storage connection id; defaults to the active data provider when omitted.
|
|
2416
|
+
*/
|
|
2417
|
+
connectionId?: string;
|
|
2418
|
+
/**
|
|
2419
|
+
* Last committed URL.
|
|
2420
|
+
*/
|
|
2421
|
+
url: string;
|
|
2422
|
+
/**
|
|
2423
|
+
* Home URL for the browser Home button.
|
|
2424
|
+
*/
|
|
2425
|
+
homeUrl: string;
|
|
2426
|
+
/**
|
|
2427
|
+
* Optional favicon data URL.
|
|
2428
|
+
*/
|
|
2429
|
+
faviconDataUrl?: string | null;
|
|
2430
|
+
/**
|
|
2431
|
+
* Injection scripts to persist.
|
|
2432
|
+
*/
|
|
2433
|
+
scripts?: WebsiteInjectionScript[];
|
|
2434
|
+
/**
|
|
2435
|
+
* Pre-request hc.* scripts to persist.
|
|
2436
|
+
*/
|
|
2437
|
+
preRequestScripts?: WebsiteScriptRef[];
|
|
2438
|
+
/**
|
|
2439
|
+
* Post-request hc.* scripts to persist.
|
|
2440
|
+
*/
|
|
2441
|
+
postRequestScripts?: WebsiteScriptRef[];
|
|
2442
|
+
/**
|
|
2443
|
+
* Website-scoped variables to persist.
|
|
2444
|
+
*/
|
|
2445
|
+
variables?: Variable[];
|
|
2446
|
+
/**
|
|
2447
|
+
* Headers to persist for chrome-driven navigations.
|
|
2448
|
+
*/
|
|
2449
|
+
headers?: KeyValue[];
|
|
2450
|
+
/**
|
|
2451
|
+
* User-Agent override to persist; empty uses Chromium default.
|
|
2452
|
+
*/
|
|
2453
|
+
userAgent?: string;
|
|
2454
|
+
/**
|
|
2455
|
+
* Authorization settings to persist.
|
|
2456
|
+
*/
|
|
2457
|
+
auth?: WebsiteAuthConfig;
|
|
2458
|
+
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Input for updating a website in the local registry.
|
|
2461
|
+
*
|
|
2462
|
+
* Mirrors `@harborclient/core` UpdateWebsiteInput.
|
|
2463
|
+
*/
|
|
2464
|
+
export interface UpdateWebsiteInput {
|
|
2465
|
+
/**
|
|
2466
|
+
* Database primary key of the website to update.
|
|
2467
|
+
*/
|
|
2468
|
+
id: number;
|
|
2469
|
+
/**
|
|
2470
|
+
* Display name for the website.
|
|
2471
|
+
*/
|
|
2472
|
+
name: string;
|
|
2473
|
+
/**
|
|
2474
|
+
* Last committed URL.
|
|
2475
|
+
*/
|
|
2476
|
+
url: string;
|
|
2477
|
+
/**
|
|
2478
|
+
* Home URL for the browser Home button.
|
|
2479
|
+
*/
|
|
2480
|
+
homeUrl: string;
|
|
2481
|
+
/**
|
|
2482
|
+
* Optional favicon data URL.
|
|
2483
|
+
*/
|
|
2484
|
+
faviconDataUrl?: string | null;
|
|
2485
|
+
/**
|
|
2486
|
+
* Injection scripts to persist.
|
|
2487
|
+
*/
|
|
2488
|
+
scripts: WebsiteInjectionScript[];
|
|
2489
|
+
/**
|
|
2490
|
+
* Pre-request hc.* scripts to persist.
|
|
2491
|
+
*/
|
|
2492
|
+
preRequestScripts: WebsiteScriptRef[];
|
|
2493
|
+
/**
|
|
2494
|
+
* Post-request hc.* scripts to persist.
|
|
2495
|
+
*/
|
|
2496
|
+
postRequestScripts: WebsiteScriptRef[];
|
|
2497
|
+
/**
|
|
2498
|
+
* Website-scoped variables to persist.
|
|
2499
|
+
*/
|
|
2500
|
+
variables: Variable[];
|
|
2501
|
+
/**
|
|
2502
|
+
* Headers to persist for chrome-driven navigations.
|
|
2503
|
+
*/
|
|
2504
|
+
headers: KeyValue[];
|
|
2505
|
+
/**
|
|
2506
|
+
* User-Agent override to persist; empty uses Chromium default.
|
|
2507
|
+
*/
|
|
2508
|
+
userAgent: string;
|
|
2509
|
+
/**
|
|
2510
|
+
* Authorization settings to persist.
|
|
2511
|
+
*/
|
|
2512
|
+
auth: WebsiteAuthConfig;
|
|
2513
|
+
}
|
|
2514
|
+
/**
|
|
2515
|
+
* Saved live page (website) APIs available on {@link PluginContext.livePages}.
|
|
2516
|
+
*
|
|
2517
|
+
* Requires the `live-pages` permission. Mutations update the registry only; they do
|
|
2518
|
+
* not open or bind a browser tab.
|
|
2519
|
+
*/
|
|
2520
|
+
export interface PluginLivePages {
|
|
2521
|
+
/**
|
|
2522
|
+
* Lists all saved live pages from the local registry.
|
|
2523
|
+
*
|
|
2524
|
+
* @returns Saved website rows.
|
|
2525
|
+
*/
|
|
2526
|
+
list(): Promise<Website[]>;
|
|
2527
|
+
/**
|
|
2528
|
+
* Returns one saved live page by database id or uuid.
|
|
2529
|
+
*
|
|
2530
|
+
* @param idOrUuid - Numeric id or uuid string.
|
|
2531
|
+
* @returns The saved website, or null when not found.
|
|
2532
|
+
*/
|
|
2533
|
+
get(idOrUuid: number | string): Promise<Website | null>;
|
|
2534
|
+
/**
|
|
2535
|
+
* Creates a saved live page and returns the new row.
|
|
2536
|
+
*
|
|
2537
|
+
* @param input - Name, URLs, and optional scripts/headers/auth/variables.
|
|
2538
|
+
* @returns The created saved website.
|
|
2539
|
+
*/
|
|
2540
|
+
create(input: CreateWebsiteInput): Promise<Website>;
|
|
2541
|
+
/**
|
|
2542
|
+
* Updates a saved live page and returns the refreshed row.
|
|
2543
|
+
*
|
|
2544
|
+
* Does not open or bind a browser tab.
|
|
2545
|
+
*
|
|
2546
|
+
* @param input - Full update payload including id.
|
|
2547
|
+
* @returns The updated saved website.
|
|
2548
|
+
*/
|
|
2549
|
+
update(input: UpdateWebsiteInput): Promise<Website>;
|
|
2550
|
+
/**
|
|
2551
|
+
* Deletes a saved live page (moves it to trash).
|
|
2552
|
+
*
|
|
2553
|
+
* @param id - Database primary key.
|
|
2554
|
+
*/
|
|
2555
|
+
delete(id: number): Promise<void>;
|
|
2556
|
+
}
|
|
2106
2557
|
/**
|
|
2107
2558
|
* Config for {@link PluginAi.registerChatPointer}.
|
|
2108
2559
|
*/
|
|
@@ -2153,11 +2604,11 @@ export interface PluginCopyToChatInput {
|
|
|
2153
2604
|
};
|
|
2154
2605
|
}
|
|
2155
2606
|
/**
|
|
2156
|
-
* Live DOM helpers on a
|
|
2607
|
+
* Live DOM helpers on a live-page handle from {@link PluginContext.livePage}.
|
|
2157
2608
|
*
|
|
2158
2609
|
* Requires the `browser` permission.
|
|
2159
2610
|
*/
|
|
2160
|
-
export interface
|
|
2611
|
+
export interface PluginLivePageDom {
|
|
2161
2612
|
/**
|
|
2162
2613
|
* Queries the live page DOM with a CSS selector.
|
|
2163
2614
|
*
|
|
@@ -2196,17 +2647,29 @@ export interface PluginWebpageDom {
|
|
|
2196
2647
|
injectStylesheet(css: string): Promise<string>;
|
|
2197
2648
|
}
|
|
2198
2649
|
/**
|
|
2199
|
-
* Handle returned by {@link PluginContext.
|
|
2650
|
+
* Handle returned by {@link PluginContext.livePage} for an embedded browser tab.
|
|
2200
2651
|
*
|
|
2201
|
-
* Requires the `browser` permission. Same semantics as request-script `hc.
|
|
2652
|
+
* Requires the `browser` permission. Same semantics as request-script `hc.livePage`.
|
|
2202
2653
|
*/
|
|
2203
|
-
export interface
|
|
2654
|
+
export interface PluginLivePageHandle {
|
|
2204
2655
|
readonly tabId: string;
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2656
|
+
/**
|
|
2657
|
+
* Current page URL. Updated after navigate / goBack / goForward / reload.
|
|
2658
|
+
*/
|
|
2659
|
+
url: string;
|
|
2660
|
+
/**
|
|
2661
|
+
* Document title. Updated after navigate / goBack / goForward / reload.
|
|
2662
|
+
*/
|
|
2663
|
+
title: string;
|
|
2664
|
+
/**
|
|
2665
|
+
* Whether history can go back. Updated after navigation helpers.
|
|
2666
|
+
*/
|
|
2667
|
+
canGoBack: boolean;
|
|
2668
|
+
/**
|
|
2669
|
+
* Whether history can go forward. Updated after navigation helpers.
|
|
2670
|
+
*/
|
|
2671
|
+
canGoForward: boolean;
|
|
2672
|
+
readonly dom: PluginLivePageDom;
|
|
2210
2673
|
/**
|
|
2211
2674
|
* Focuses this browser tab in the tab bar.
|
|
2212
2675
|
*/
|
|
@@ -2215,6 +2678,36 @@ export interface PluginWebpageHandle {
|
|
|
2215
2678
|
* Closes this browser tab. Returns false when the user cancels a leave prompt.
|
|
2216
2679
|
*/
|
|
2217
2680
|
close(): Promise<boolean>;
|
|
2681
|
+
/**
|
|
2682
|
+
* Navigates history back one entry and waits for load.
|
|
2683
|
+
*
|
|
2684
|
+
* Updates {@link PluginLivePageHandle.url}, {@link PluginLivePageHandle.title},
|
|
2685
|
+
* {@link PluginLivePageHandle.canGoBack}, and {@link PluginLivePageHandle.canGoForward}.
|
|
2686
|
+
*/
|
|
2687
|
+
goBack(): Promise<void>;
|
|
2688
|
+
/**
|
|
2689
|
+
* Navigates history forward one entry and waits for load.
|
|
2690
|
+
*
|
|
2691
|
+
* Updates {@link PluginLivePageHandle.url}, {@link PluginLivePageHandle.title},
|
|
2692
|
+
* {@link PluginLivePageHandle.canGoBack}, and {@link PluginLivePageHandle.canGoForward}.
|
|
2693
|
+
*/
|
|
2694
|
+
goForward(): Promise<void>;
|
|
2695
|
+
/**
|
|
2696
|
+
* Reloads the current page and waits for load.
|
|
2697
|
+
*
|
|
2698
|
+
* Updates {@link PluginLivePageHandle.url}, {@link PluginLivePageHandle.title},
|
|
2699
|
+
* {@link PluginLivePageHandle.canGoBack}, and {@link PluginLivePageHandle.canGoForward}.
|
|
2700
|
+
*/
|
|
2701
|
+
reload(): Promise<void>;
|
|
2702
|
+
/**
|
|
2703
|
+
* Loads a URL in this tab and waits for load.
|
|
2704
|
+
*
|
|
2705
|
+
* Updates {@link PluginLivePageHandle.url}, {@link PluginLivePageHandle.title},
|
|
2706
|
+
* {@link PluginLivePageHandle.canGoBack}, and {@link PluginLivePageHandle.canGoForward}.
|
|
2707
|
+
*
|
|
2708
|
+
* @param url - Absolute http(s) or about:blank URL.
|
|
2709
|
+
*/
|
|
2710
|
+
navigate(url: string): Promise<void>;
|
|
2218
2711
|
/**
|
|
2219
2712
|
* Captures the visible viewport as PNG and writes it under an allowlisted path.
|
|
2220
2713
|
*
|
|
@@ -2517,6 +3010,16 @@ export interface PluginUi {
|
|
|
2517
3010
|
* @returns A {@link Disposable} that unregisters the action when disposed.
|
|
2518
3011
|
*/
|
|
2519
3012
|
registerRequestToolbarAction(action: RequestToolbarActionContribution): Disposable;
|
|
3013
|
+
/**
|
|
3014
|
+
* Adds a RoundButton to the embedded browser chrome bar.
|
|
3015
|
+
*
|
|
3016
|
+
* Manifest: `contributes.livePageChromeActions` plus a matching `contributes.commands` entry.
|
|
3017
|
+
* The command handler receives a {@link LivePageChromeActionContext} argument.
|
|
3018
|
+
*
|
|
3019
|
+
* @param action - Live-page chrome action contribution.
|
|
3020
|
+
* @returns A {@link Disposable} that unregisters the action when disposed.
|
|
3021
|
+
*/
|
|
3022
|
+
registerLivePageChromeAction(action: LivePageChromeActionContribution): Disposable;
|
|
2520
3023
|
/**
|
|
2521
3024
|
* Adds an icon button to each script row in the pre/post request script editor.
|
|
2522
3025
|
*
|
|
@@ -3962,6 +4465,10 @@ export interface PluginContext {
|
|
|
3962
4465
|
* permission.
|
|
3963
4466
|
*/
|
|
3964
4467
|
liveServers: PluginLiveServers;
|
|
4468
|
+
/**
|
|
4469
|
+
* Saved live page (website) CRUD. Requires the `live-pages` permission.
|
|
4470
|
+
*/
|
|
4471
|
+
livePages: PluginLivePages;
|
|
3965
4472
|
/**
|
|
3966
4473
|
* AI chat pointer registration and copy-to-chat. Requires the `ai` permission.
|
|
3967
4474
|
*/
|
|
@@ -3970,16 +4477,16 @@ export interface PluginContext {
|
|
|
3970
4477
|
* Opens or reuses an embedded browser tab and returns a control handle.
|
|
3971
4478
|
*
|
|
3972
4479
|
* Requires the `browser` permission (granted at install/enable). Same call shape
|
|
3973
|
-
* as request-script `hc.
|
|
4480
|
+
* as request-script `hc.livePage`: omit `url` to bind the active browser tab;
|
|
3974
4481
|
* `{ reuse }` defaults to true; new tabs wait for load.
|
|
3975
4482
|
*
|
|
3976
4483
|
* @param url - Optional URL to open or reuse.
|
|
3977
4484
|
* @param options - Optional `{ reuse }` (default true).
|
|
3978
4485
|
* @returns Handle with `focus` / `close` and `dom` helpers.
|
|
3979
4486
|
*/
|
|
3980
|
-
|
|
4487
|
+
livePage(url?: string, options?: {
|
|
3981
4488
|
reuse?: boolean;
|
|
3982
|
-
}): Promise<
|
|
4489
|
+
}): Promise<PluginLivePageHandle>;
|
|
3983
4490
|
/**
|
|
3984
4491
|
* Host-managed disposable list used for registration cleanup on deactivation.
|
|
3985
4492
|
*
|