@qodalis/cli-core 2.0.0 → 2.1.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/package.json +1 -1
- package/public-api.d.mts +81 -23
- package/public-api.d.ts +81 -23
- package/public-api.js +53 -3
- package/public-api.js.map +1 -1
- package/public-api.mjs +52 -4
- package/public-api.mjs.map +1 -1
package/package.json
CHANGED
package/public-api.d.mts
CHANGED
|
@@ -2119,6 +2119,25 @@ interface CliBootOptions {
|
|
|
2119
2119
|
*/
|
|
2120
2120
|
slowStepMs?: number;
|
|
2121
2121
|
}
|
|
2122
|
+
/**
|
|
2123
|
+
* The name and icon an application ships the CLI under. Anything left out
|
|
2124
|
+
* keeps Qodalis CLI's; the copyright line, the docs link and `version` stay
|
|
2125
|
+
* Qodalis CLI's.
|
|
2126
|
+
*/
|
|
2127
|
+
interface CliBranding {
|
|
2128
|
+
/**
|
|
2129
|
+
* The product name: the welcome banner ("Welcome to RateBell CLI", shown
|
|
2130
|
+
* instead of the Qodalis CLI art), the panel's title and the startup log.
|
|
2131
|
+
* `version` adds it to the Qodalis CLI details.
|
|
2132
|
+
* @default 'Web CLI' (panel title 'CLI')
|
|
2133
|
+
*/
|
|
2134
|
+
name?: string;
|
|
2135
|
+
/**
|
|
2136
|
+
* The panel's icon (header and hide tab) instead of the terminal glyph:
|
|
2137
|
+
* an image URL (http(s), a path, or a `data:image` URL).
|
|
2138
|
+
*/
|
|
2139
|
+
icon?: string;
|
|
2140
|
+
}
|
|
2122
2141
|
/**
|
|
2123
2142
|
* Options for the CLI
|
|
2124
2143
|
*/
|
|
@@ -2127,6 +2146,11 @@ type CliOptions = Record<string, any> & {
|
|
|
2127
2146
|
* How the CLI reports its startup (boot log, spinner).
|
|
2128
2147
|
*/
|
|
2129
2148
|
boot?: CliBootOptions;
|
|
2149
|
+
/**
|
|
2150
|
+
* The name and icon the CLI shows (welcome banner, panel title, startup
|
|
2151
|
+
* log); defaults to Qodalis CLI's.
|
|
2152
|
+
*/
|
|
2153
|
+
branding?: CliBranding;
|
|
2130
2154
|
/**
|
|
2131
2155
|
* Custom terminal options
|
|
2132
2156
|
*/
|
|
@@ -3342,6 +3366,34 @@ type CliServerConfig = {
|
|
|
3342
3366
|
headers?: CliHeadersProvider;
|
|
3343
3367
|
/** Request timeout in milliseconds. @default 30000 */
|
|
3344
3368
|
timeout?: number;
|
|
3369
|
+
/**
|
|
3370
|
+
* Copy `headers` into WebSocket URLs as `_header_<name>` query params
|
|
3371
|
+
* (the behaviour up to 2.0.0). Off by default: tokens in URLs end up in
|
|
3372
|
+
* access, proxy and CDN logs and in browser history. Without it, sockets
|
|
3373
|
+
* authenticate with a single-use ticket from
|
|
3374
|
+
* `POST /api/v1/qcli/sessions/ws-ticket` (users plugin) fetched with these
|
|
3375
|
+
* headers. Only for servers that still read `_header_Authorization`, such
|
|
3376
|
+
* as a shell `accessToken` without the users plugin.
|
|
3377
|
+
* @deprecated use the users plugin's WebSocket tickets
|
|
3378
|
+
*/
|
|
3379
|
+
unsafeHeadersInWebSocketUrl?: boolean;
|
|
3380
|
+
};
|
|
3381
|
+
/**
|
|
3382
|
+
* Which rows of a longer result a server table holds. Commands that page (`--skip`,
|
|
3383
|
+
* `--take`) send it; servers also send it, with `truncated`, when they cut a
|
|
3384
|
+
* table from a command that does not page.
|
|
3385
|
+
*/
|
|
3386
|
+
type CliServerTablePage = {
|
|
3387
|
+
/** Rows skipped before these */
|
|
3388
|
+
skip: number;
|
|
3389
|
+
/** Rows asked for */
|
|
3390
|
+
take: number;
|
|
3391
|
+
/** All rows, when the command knows it */
|
|
3392
|
+
total?: number;
|
|
3393
|
+
/** Whether more rows follow */
|
|
3394
|
+
hasMore: boolean;
|
|
3395
|
+
/** The server cut the table: `--skip` will not show the rest */
|
|
3396
|
+
truncated?: boolean;
|
|
3345
3397
|
};
|
|
3346
3398
|
/**
|
|
3347
3399
|
* A single output item in a server response
|
|
@@ -3354,6 +3406,7 @@ type CliServerOutput = {
|
|
|
3354
3406
|
type: 'table';
|
|
3355
3407
|
headers: string[];
|
|
3356
3408
|
rows: string[][];
|
|
3409
|
+
page?: CliServerTablePage;
|
|
3357
3410
|
} | {
|
|
3358
3411
|
type: 'list';
|
|
3359
3412
|
items: string[];
|
|
@@ -3740,35 +3793,40 @@ declare class ServerVersionNegotiator {
|
|
|
3740
3793
|
}
|
|
3741
3794
|
|
|
3742
3795
|
/**
|
|
3743
|
-
*
|
|
3744
|
-
* as query parameters. Since the browser WebSocket API does not support custom
|
|
3745
|
-
* request headers, this allows the host server's auth middleware to validate
|
|
3746
|
-
* the connection during the HTTP upgrade handshake.
|
|
3747
|
-
*
|
|
3748
|
-
* All configured headers are forwarded as query parameters prefixed with
|
|
3749
|
-
* `_header_` to avoid collisions with application-level query params.
|
|
3796
|
+
* Copies headers into a WebSocket URL as `_header_<name>` query params.
|
|
3750
3797
|
*
|
|
3751
|
-
*
|
|
3752
|
-
*
|
|
3753
|
-
*
|
|
3754
|
-
*
|
|
3755
|
-
* URL are therefore more exposed than those sent via HTTP headers. This is an
|
|
3756
|
-
* inherent limitation of the browser WebSocket API (no custom headers).
|
|
3757
|
-
* Server-side middleware that reads `_header_*` params should strip them from
|
|
3758
|
-
* logs and avoid forwarding them in redirects.
|
|
3798
|
+
* **Unsafe:** query parameters are visible in browser history and in server,
|
|
3799
|
+
* proxy and CDN access logs. Used only for servers configured with
|
|
3800
|
+
* `unsafeHeadersInWebSocketUrl: true`; everything else goes through
|
|
3801
|
+
* {@link buildServerWebSocketUrl}, which keeps headers out of the URL.
|
|
3759
3802
|
*
|
|
3760
3803
|
* @param wsUrl The base WebSocket URL (may already contain query parameters)
|
|
3761
3804
|
* @param headers The headers provider from CliServerConfig (may include Authorization, etc.)
|
|
3762
|
-
* @returns The WebSocket URL with
|
|
3805
|
+
* @returns The WebSocket URL with the headers appended as query parameters
|
|
3763
3806
|
*/
|
|
3764
3807
|
declare function buildAuthenticatedWebSocketUrl(wsUrl: string, headers?: CliHeadersProvider): string;
|
|
3808
|
+
/** Options for {@link buildServerWebSocketUrl} and {@link resolveServerWebSocketUrl}. */
|
|
3809
|
+
interface CliWebSocketAuthOptions {
|
|
3810
|
+
/** See `CliServerConfig.unsafeHeadersInWebSocketUrl` */
|
|
3811
|
+
unsafeHeadersInWebSocketUrl?: boolean;
|
|
3812
|
+
}
|
|
3813
|
+
/** Ticket endpoint of the users plugin, relative to the server root */
|
|
3814
|
+
declare const CLI_WS_TICKET_PATH = "/api/v1/qcli/sessions/ws-ticket";
|
|
3815
|
+
/**
|
|
3816
|
+
* Authenticates a WebSocket URL with headers without putting them in it:
|
|
3817
|
+
* fetches a single-use ticket from `POST /api/v1/qcli/sessions/ws-ticket`
|
|
3818
|
+
* with the headers and appends `?ticket=`. When no ticket can be had, the
|
|
3819
|
+
* socket connects without credentials and a warning is logged once.
|
|
3820
|
+
* Headers are copied into the URL only with `unsafeHeadersInWebSocketUrl`.
|
|
3821
|
+
*/
|
|
3822
|
+
declare function buildServerWebSocketUrl(wsUrl: string, headers?: CliHeadersProvider, options?: CliWebSocketAuthOptions): Promise<string>;
|
|
3765
3823
|
/**
|
|
3766
3824
|
* Build the WebSocket URL for a configured server. Prefers upgrade params
|
|
3767
|
-
* from auth providers (e.g. a single-use ticket from the users module);
|
|
3768
|
-
*
|
|
3769
|
-
*
|
|
3825
|
+
* from auth providers (e.g. a single-use ticket from the users module);
|
|
3826
|
+
* otherwise authenticates with the server's headers through
|
|
3827
|
+
* {@link buildServerWebSocketUrl}.
|
|
3770
3828
|
*/
|
|
3771
|
-
declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undefined, serverName: string, wsUrl: string, configHeaders?: CliHeadersProvider): Promise<string>;
|
|
3829
|
+
declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undefined, serverName: string, wsUrl: string, configHeaders?: CliHeadersProvider, options?: CliWebSocketAuthOptions): Promise<string>;
|
|
3772
3830
|
/** Append query params to a URL that may already have some. */
|
|
3773
3831
|
declare function appendQueryParams(url: string, params: Record<string, string>): string;
|
|
3774
3832
|
|
|
@@ -4100,7 +4158,7 @@ interface CliThemeInfo {
|
|
|
4100
4158
|
|
|
4101
4159
|
declare const DefaultThemeInfos: Record<string, CliThemeInfo>;
|
|
4102
4160
|
|
|
4103
|
-
declare const LIBRARY_VERSION = "2.
|
|
4161
|
+
declare const LIBRARY_VERSION = "2.1.0";
|
|
4104
4162
|
declare const API_VERSION = 2;
|
|
4105
4163
|
|
|
4106
4164
|
/**
|
|
@@ -4161,5 +4219,5 @@ declare class BrowserFileTransferService implements ICliFileTransferService {
|
|
|
4161
4219
|
private _pickFile;
|
|
4162
4220
|
}
|
|
4163
4221
|
|
|
4164
|
-
export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
|
|
4165
|
-
export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
|
|
4222
|
+
export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CLI_WS_TICKET_PATH, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, buildServerWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
|
|
4223
|
+
export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliBranding, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServerTablePage, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWebSocketAuthOptions, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
|
package/public-api.d.ts
CHANGED
|
@@ -2119,6 +2119,25 @@ interface CliBootOptions {
|
|
|
2119
2119
|
*/
|
|
2120
2120
|
slowStepMs?: number;
|
|
2121
2121
|
}
|
|
2122
|
+
/**
|
|
2123
|
+
* The name and icon an application ships the CLI under. Anything left out
|
|
2124
|
+
* keeps Qodalis CLI's; the copyright line, the docs link and `version` stay
|
|
2125
|
+
* Qodalis CLI's.
|
|
2126
|
+
*/
|
|
2127
|
+
interface CliBranding {
|
|
2128
|
+
/**
|
|
2129
|
+
* The product name: the welcome banner ("Welcome to RateBell CLI", shown
|
|
2130
|
+
* instead of the Qodalis CLI art), the panel's title and the startup log.
|
|
2131
|
+
* `version` adds it to the Qodalis CLI details.
|
|
2132
|
+
* @default 'Web CLI' (panel title 'CLI')
|
|
2133
|
+
*/
|
|
2134
|
+
name?: string;
|
|
2135
|
+
/**
|
|
2136
|
+
* The panel's icon (header and hide tab) instead of the terminal glyph:
|
|
2137
|
+
* an image URL (http(s), a path, or a `data:image` URL).
|
|
2138
|
+
*/
|
|
2139
|
+
icon?: string;
|
|
2140
|
+
}
|
|
2122
2141
|
/**
|
|
2123
2142
|
* Options for the CLI
|
|
2124
2143
|
*/
|
|
@@ -2127,6 +2146,11 @@ type CliOptions = Record<string, any> & {
|
|
|
2127
2146
|
* How the CLI reports its startup (boot log, spinner).
|
|
2128
2147
|
*/
|
|
2129
2148
|
boot?: CliBootOptions;
|
|
2149
|
+
/**
|
|
2150
|
+
* The name and icon the CLI shows (welcome banner, panel title, startup
|
|
2151
|
+
* log); defaults to Qodalis CLI's.
|
|
2152
|
+
*/
|
|
2153
|
+
branding?: CliBranding;
|
|
2130
2154
|
/**
|
|
2131
2155
|
* Custom terminal options
|
|
2132
2156
|
*/
|
|
@@ -3342,6 +3366,34 @@ type CliServerConfig = {
|
|
|
3342
3366
|
headers?: CliHeadersProvider;
|
|
3343
3367
|
/** Request timeout in milliseconds. @default 30000 */
|
|
3344
3368
|
timeout?: number;
|
|
3369
|
+
/**
|
|
3370
|
+
* Copy `headers` into WebSocket URLs as `_header_<name>` query params
|
|
3371
|
+
* (the behaviour up to 2.0.0). Off by default: tokens in URLs end up in
|
|
3372
|
+
* access, proxy and CDN logs and in browser history. Without it, sockets
|
|
3373
|
+
* authenticate with a single-use ticket from
|
|
3374
|
+
* `POST /api/v1/qcli/sessions/ws-ticket` (users plugin) fetched with these
|
|
3375
|
+
* headers. Only for servers that still read `_header_Authorization`, such
|
|
3376
|
+
* as a shell `accessToken` without the users plugin.
|
|
3377
|
+
* @deprecated use the users plugin's WebSocket tickets
|
|
3378
|
+
*/
|
|
3379
|
+
unsafeHeadersInWebSocketUrl?: boolean;
|
|
3380
|
+
};
|
|
3381
|
+
/**
|
|
3382
|
+
* Which rows of a longer result a server table holds. Commands that page (`--skip`,
|
|
3383
|
+
* `--take`) send it; servers also send it, with `truncated`, when they cut a
|
|
3384
|
+
* table from a command that does not page.
|
|
3385
|
+
*/
|
|
3386
|
+
type CliServerTablePage = {
|
|
3387
|
+
/** Rows skipped before these */
|
|
3388
|
+
skip: number;
|
|
3389
|
+
/** Rows asked for */
|
|
3390
|
+
take: number;
|
|
3391
|
+
/** All rows, when the command knows it */
|
|
3392
|
+
total?: number;
|
|
3393
|
+
/** Whether more rows follow */
|
|
3394
|
+
hasMore: boolean;
|
|
3395
|
+
/** The server cut the table: `--skip` will not show the rest */
|
|
3396
|
+
truncated?: boolean;
|
|
3345
3397
|
};
|
|
3346
3398
|
/**
|
|
3347
3399
|
* A single output item in a server response
|
|
@@ -3354,6 +3406,7 @@ type CliServerOutput = {
|
|
|
3354
3406
|
type: 'table';
|
|
3355
3407
|
headers: string[];
|
|
3356
3408
|
rows: string[][];
|
|
3409
|
+
page?: CliServerTablePage;
|
|
3357
3410
|
} | {
|
|
3358
3411
|
type: 'list';
|
|
3359
3412
|
items: string[];
|
|
@@ -3740,35 +3793,40 @@ declare class ServerVersionNegotiator {
|
|
|
3740
3793
|
}
|
|
3741
3794
|
|
|
3742
3795
|
/**
|
|
3743
|
-
*
|
|
3744
|
-
* as query parameters. Since the browser WebSocket API does not support custom
|
|
3745
|
-
* request headers, this allows the host server's auth middleware to validate
|
|
3746
|
-
* the connection during the HTTP upgrade handshake.
|
|
3747
|
-
*
|
|
3748
|
-
* All configured headers are forwarded as query parameters prefixed with
|
|
3749
|
-
* `_header_` to avoid collisions with application-level query params.
|
|
3796
|
+
* Copies headers into a WebSocket URL as `_header_<name>` query params.
|
|
3750
3797
|
*
|
|
3751
|
-
*
|
|
3752
|
-
*
|
|
3753
|
-
*
|
|
3754
|
-
*
|
|
3755
|
-
* URL are therefore more exposed than those sent via HTTP headers. This is an
|
|
3756
|
-
* inherent limitation of the browser WebSocket API (no custom headers).
|
|
3757
|
-
* Server-side middleware that reads `_header_*` params should strip them from
|
|
3758
|
-
* logs and avoid forwarding them in redirects.
|
|
3798
|
+
* **Unsafe:** query parameters are visible in browser history and in server,
|
|
3799
|
+
* proxy and CDN access logs. Used only for servers configured with
|
|
3800
|
+
* `unsafeHeadersInWebSocketUrl: true`; everything else goes through
|
|
3801
|
+
* {@link buildServerWebSocketUrl}, which keeps headers out of the URL.
|
|
3759
3802
|
*
|
|
3760
3803
|
* @param wsUrl The base WebSocket URL (may already contain query parameters)
|
|
3761
3804
|
* @param headers The headers provider from CliServerConfig (may include Authorization, etc.)
|
|
3762
|
-
* @returns The WebSocket URL with
|
|
3805
|
+
* @returns The WebSocket URL with the headers appended as query parameters
|
|
3763
3806
|
*/
|
|
3764
3807
|
declare function buildAuthenticatedWebSocketUrl(wsUrl: string, headers?: CliHeadersProvider): string;
|
|
3808
|
+
/** Options for {@link buildServerWebSocketUrl} and {@link resolveServerWebSocketUrl}. */
|
|
3809
|
+
interface CliWebSocketAuthOptions {
|
|
3810
|
+
/** See `CliServerConfig.unsafeHeadersInWebSocketUrl` */
|
|
3811
|
+
unsafeHeadersInWebSocketUrl?: boolean;
|
|
3812
|
+
}
|
|
3813
|
+
/** Ticket endpoint of the users plugin, relative to the server root */
|
|
3814
|
+
declare const CLI_WS_TICKET_PATH = "/api/v1/qcli/sessions/ws-ticket";
|
|
3815
|
+
/**
|
|
3816
|
+
* Authenticates a WebSocket URL with headers without putting them in it:
|
|
3817
|
+
* fetches a single-use ticket from `POST /api/v1/qcli/sessions/ws-ticket`
|
|
3818
|
+
* with the headers and appends `?ticket=`. When no ticket can be had, the
|
|
3819
|
+
* socket connects without credentials and a warning is logged once.
|
|
3820
|
+
* Headers are copied into the URL only with `unsafeHeadersInWebSocketUrl`.
|
|
3821
|
+
*/
|
|
3822
|
+
declare function buildServerWebSocketUrl(wsUrl: string, headers?: CliHeadersProvider, options?: CliWebSocketAuthOptions): Promise<string>;
|
|
3765
3823
|
/**
|
|
3766
3824
|
* Build the WebSocket URL for a configured server. Prefers upgrade params
|
|
3767
|
-
* from auth providers (e.g. a single-use ticket from the users module);
|
|
3768
|
-
*
|
|
3769
|
-
*
|
|
3825
|
+
* from auth providers (e.g. a single-use ticket from the users module);
|
|
3826
|
+
* otherwise authenticates with the server's headers through
|
|
3827
|
+
* {@link buildServerWebSocketUrl}.
|
|
3770
3828
|
*/
|
|
3771
|
-
declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undefined, serverName: string, wsUrl: string, configHeaders?: CliHeadersProvider): Promise<string>;
|
|
3829
|
+
declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undefined, serverName: string, wsUrl: string, configHeaders?: CliHeadersProvider, options?: CliWebSocketAuthOptions): Promise<string>;
|
|
3772
3830
|
/** Append query params to a URL that may already have some. */
|
|
3773
3831
|
declare function appendQueryParams(url: string, params: Record<string, string>): string;
|
|
3774
3832
|
|
|
@@ -4100,7 +4158,7 @@ interface CliThemeInfo {
|
|
|
4100
4158
|
|
|
4101
4159
|
declare const DefaultThemeInfos: Record<string, CliThemeInfo>;
|
|
4102
4160
|
|
|
4103
|
-
declare const LIBRARY_VERSION = "2.
|
|
4161
|
+
declare const LIBRARY_VERSION = "2.1.0";
|
|
4104
4162
|
declare const API_VERSION = 2;
|
|
4105
4163
|
|
|
4106
4164
|
/**
|
|
@@ -4161,5 +4219,5 @@ declare class BrowserFileTransferService implements ICliFileTransferService {
|
|
|
4161
4219
|
private _pickFile;
|
|
4162
4220
|
}
|
|
4163
4221
|
|
|
4164
|
-
export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
|
|
4165
|
-
export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
|
|
4222
|
+
export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CLI_WS_TICKET_PATH, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, buildServerWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
|
|
4223
|
+
export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliBranding, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServerTablePage, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWebSocketAuthOptions, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
|
package/public-api.js
CHANGED
|
@@ -2599,7 +2599,7 @@ function satisfiesVersionRange(installed, range) {
|
|
|
2599
2599
|
}
|
|
2600
2600
|
|
|
2601
2601
|
// src/lib/version.ts
|
|
2602
|
-
var LIBRARY_VERSION = "2.
|
|
2602
|
+
var LIBRARY_VERSION = "2.1.0";
|
|
2603
2603
|
var API_VERSION = 2;
|
|
2604
2604
|
|
|
2605
2605
|
// src/lib/utils/server-version-negotiator.ts
|
|
@@ -2661,13 +2661,61 @@ function buildAuthenticatedWebSocketUrl(wsUrl, headers) {
|
|
|
2661
2661
|
).join("&");
|
|
2662
2662
|
return `${wsUrl}${separator}${params}`;
|
|
2663
2663
|
}
|
|
2664
|
-
|
|
2664
|
+
var CLI_WS_TICKET_PATH = "/api/v1/qcli/sessions/ws-ticket";
|
|
2665
|
+
var warnedServers = /* @__PURE__ */ new Set();
|
|
2666
|
+
async function buildServerWebSocketUrl(wsUrl, headers, options) {
|
|
2667
|
+
const resolved = resolveHeaders(headers);
|
|
2668
|
+
if (Object.keys(resolved).length === 0) {
|
|
2669
|
+
return wsUrl;
|
|
2670
|
+
}
|
|
2671
|
+
if (options?.unsafeHeadersInWebSocketUrl) {
|
|
2672
|
+
return buildAuthenticatedWebSocketUrl(wsUrl, resolved);
|
|
2673
|
+
}
|
|
2674
|
+
const httpBase = toHttpBaseUrl(wsUrl);
|
|
2675
|
+
const ticket = await fetchWebSocketTicket(httpBase, resolved);
|
|
2676
|
+
if (ticket) {
|
|
2677
|
+
return appendQueryParams(wsUrl, { ticket });
|
|
2678
|
+
}
|
|
2679
|
+
if (!warnedServers.has(httpBase)) {
|
|
2680
|
+
warnedServers.add(httpBase);
|
|
2681
|
+
console.warn(
|
|
2682
|
+
`[qodalis-cli] ${httpBase} issued no WebSocket ticket (${CLI_WS_TICKET_PATH}), so its sockets connect without credentials. Configured headers are never copied into WebSocket URLs; enable the users plugin on the server, or set \`unsafeHeadersInWebSocketUrl: true\` on the server config to keep the old behaviour.`
|
|
2683
|
+
);
|
|
2684
|
+
}
|
|
2685
|
+
return wsUrl;
|
|
2686
|
+
}
|
|
2687
|
+
async function resolveServerWebSocketUrl(services, serverName, wsUrl, configHeaders, options) {
|
|
2665
2688
|
const authService = services?.get(ICliServerAuthService_TOKEN);
|
|
2666
2689
|
const params = await authService?.getWebSocketParams?.(serverName);
|
|
2667
2690
|
if (params) {
|
|
2668
2691
|
return appendQueryParams(wsUrl, params);
|
|
2669
2692
|
}
|
|
2670
|
-
return
|
|
2693
|
+
return buildServerWebSocketUrl(
|
|
2694
|
+
wsUrl,
|
|
2695
|
+
() => resolveServerHeaders(services, serverName, configHeaders),
|
|
2696
|
+
options
|
|
2697
|
+
);
|
|
2698
|
+
}
|
|
2699
|
+
function toHttpBaseUrl(wsUrl) {
|
|
2700
|
+
const url = new URL(wsUrl);
|
|
2701
|
+
const wsSegment = url.pathname.indexOf("/ws/");
|
|
2702
|
+
const basePath = wsSegment >= 0 ? url.pathname.slice(0, wsSegment) : "";
|
|
2703
|
+
const protocol = url.protocol === "wss:" || url.protocol === "https:" ? "https:" : "http:";
|
|
2704
|
+
return `${protocol}//${url.host}${basePath}`;
|
|
2705
|
+
}
|
|
2706
|
+
async function fetchWebSocketTicket(httpBase, headers) {
|
|
2707
|
+
try {
|
|
2708
|
+
const response = await fetch(`${httpBase}${CLI_WS_TICKET_PATH}`, {
|
|
2709
|
+
method: "POST",
|
|
2710
|
+
headers: { ...headers, "Content-Type": "application/json" },
|
|
2711
|
+
body: "{}"
|
|
2712
|
+
});
|
|
2713
|
+
if (!response.ok) return void 0;
|
|
2714
|
+
const body = await response.json();
|
|
2715
|
+
return typeof body?.ticket === "string" && body.ticket ? body.ticket : void 0;
|
|
2716
|
+
} catch {
|
|
2717
|
+
return void 0;
|
|
2718
|
+
}
|
|
2671
2719
|
}
|
|
2672
2720
|
function appendQueryParams(url, params) {
|
|
2673
2721
|
const entries = Object.entries(params);
|
|
@@ -4211,6 +4259,7 @@ exports.API_VERSION = API_VERSION;
|
|
|
4211
4259
|
exports.BrowserFileTransferService = BrowserFileTransferService;
|
|
4212
4260
|
exports.CANCELLATION_ERROR_MESSAGE = CANCELLATION_ERROR_MESSAGE;
|
|
4213
4261
|
exports.CLI_CONFIGURE_STORE_NAME = CLI_CONFIGURE_STORE_NAME;
|
|
4262
|
+
exports.CLI_WS_TICKET_PATH = CLI_WS_TICKET_PATH;
|
|
4214
4263
|
exports.CancellablePromise = CancellablePromise;
|
|
4215
4264
|
exports.CliAccessDeniedError = CliAccessDeniedError;
|
|
4216
4265
|
exports.CliBackgroundColor = CliBackgroundColor;
|
|
@@ -4255,6 +4304,7 @@ exports.ServerVersionNegotiator = ServerVersionNegotiator;
|
|
|
4255
4304
|
exports.appendQueryParams = appendQueryParams;
|
|
4256
4305
|
exports.bootCliModule = bootCliModule;
|
|
4257
4306
|
exports.buildAuthenticatedWebSocketUrl = buildAuthenticatedWebSocketUrl;
|
|
4307
|
+
exports.buildServerWebSocketUrl = buildServerWebSocketUrl;
|
|
4258
4308
|
exports.clearTerminalLine = clearTerminalLine;
|
|
4259
4309
|
exports.cliAccessMetadataGuards = cliAccessMetadataGuards;
|
|
4260
4310
|
exports.cliAuthorize = cliAuthorize;
|