@qodalis/cli-core 2.0.0 → 2.0.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/package.json +1 -1
- package/public-api.d.mts +57 -23
- package/public-api.d.ts +57 -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
|
@@ -3342,6 +3342,34 @@ type CliServerConfig = {
|
|
|
3342
3342
|
headers?: CliHeadersProvider;
|
|
3343
3343
|
/** Request timeout in milliseconds. @default 30000 */
|
|
3344
3344
|
timeout?: number;
|
|
3345
|
+
/**
|
|
3346
|
+
* Copy `headers` into WebSocket URLs as `_header_<name>` query params
|
|
3347
|
+
* (the behaviour up to 2.0.0). Off by default: tokens in URLs end up in
|
|
3348
|
+
* access, proxy and CDN logs and in browser history. Without it, sockets
|
|
3349
|
+
* authenticate with a single-use ticket from
|
|
3350
|
+
* `POST /api/v1/qcli/sessions/ws-ticket` (users plugin) fetched with these
|
|
3351
|
+
* headers. Only for servers that still read `_header_Authorization`, such
|
|
3352
|
+
* as a shell `accessToken` without the users plugin.
|
|
3353
|
+
* @deprecated use the users plugin's WebSocket tickets
|
|
3354
|
+
*/
|
|
3355
|
+
unsafeHeadersInWebSocketUrl?: boolean;
|
|
3356
|
+
};
|
|
3357
|
+
/**
|
|
3358
|
+
* Which rows of a longer result a server table holds. Commands that page (`--skip`,
|
|
3359
|
+
* `--take`) send it; servers also send it, with `truncated`, when they cut a
|
|
3360
|
+
* table from a command that does not page.
|
|
3361
|
+
*/
|
|
3362
|
+
type CliServerTablePage = {
|
|
3363
|
+
/** Rows skipped before these */
|
|
3364
|
+
skip: number;
|
|
3365
|
+
/** Rows asked for */
|
|
3366
|
+
take: number;
|
|
3367
|
+
/** All rows, when the command knows it */
|
|
3368
|
+
total?: number;
|
|
3369
|
+
/** Whether more rows follow */
|
|
3370
|
+
hasMore: boolean;
|
|
3371
|
+
/** The server cut the table: `--skip` will not show the rest */
|
|
3372
|
+
truncated?: boolean;
|
|
3345
3373
|
};
|
|
3346
3374
|
/**
|
|
3347
3375
|
* A single output item in a server response
|
|
@@ -3354,6 +3382,7 @@ type CliServerOutput = {
|
|
|
3354
3382
|
type: 'table';
|
|
3355
3383
|
headers: string[];
|
|
3356
3384
|
rows: string[][];
|
|
3385
|
+
page?: CliServerTablePage;
|
|
3357
3386
|
} | {
|
|
3358
3387
|
type: 'list';
|
|
3359
3388
|
items: string[];
|
|
@@ -3740,35 +3769,40 @@ declare class ServerVersionNegotiator {
|
|
|
3740
3769
|
}
|
|
3741
3770
|
|
|
3742
3771
|
/**
|
|
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.
|
|
3772
|
+
* Copies headers into a WebSocket URL as `_header_<name>` query params.
|
|
3750
3773
|
*
|
|
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.
|
|
3774
|
+
* **Unsafe:** query parameters are visible in browser history and in server,
|
|
3775
|
+
* proxy and CDN access logs. Used only for servers configured with
|
|
3776
|
+
* `unsafeHeadersInWebSocketUrl: true`; everything else goes through
|
|
3777
|
+
* {@link buildServerWebSocketUrl}, which keeps headers out of the URL.
|
|
3759
3778
|
*
|
|
3760
3779
|
* @param wsUrl The base WebSocket URL (may already contain query parameters)
|
|
3761
3780
|
* @param headers The headers provider from CliServerConfig (may include Authorization, etc.)
|
|
3762
|
-
* @returns The WebSocket URL with
|
|
3781
|
+
* @returns The WebSocket URL with the headers appended as query parameters
|
|
3763
3782
|
*/
|
|
3764
3783
|
declare function buildAuthenticatedWebSocketUrl(wsUrl: string, headers?: CliHeadersProvider): string;
|
|
3784
|
+
/** Options for {@link buildServerWebSocketUrl} and {@link resolveServerWebSocketUrl}. */
|
|
3785
|
+
interface CliWebSocketAuthOptions {
|
|
3786
|
+
/** See `CliServerConfig.unsafeHeadersInWebSocketUrl` */
|
|
3787
|
+
unsafeHeadersInWebSocketUrl?: boolean;
|
|
3788
|
+
}
|
|
3789
|
+
/** Ticket endpoint of the users plugin, relative to the server root */
|
|
3790
|
+
declare const CLI_WS_TICKET_PATH = "/api/v1/qcli/sessions/ws-ticket";
|
|
3791
|
+
/**
|
|
3792
|
+
* Authenticates a WebSocket URL with headers without putting them in it:
|
|
3793
|
+
* fetches a single-use ticket from `POST /api/v1/qcli/sessions/ws-ticket`
|
|
3794
|
+
* with the headers and appends `?ticket=`. When no ticket can be had, the
|
|
3795
|
+
* socket connects without credentials and a warning is logged once.
|
|
3796
|
+
* Headers are copied into the URL only with `unsafeHeadersInWebSocketUrl`.
|
|
3797
|
+
*/
|
|
3798
|
+
declare function buildServerWebSocketUrl(wsUrl: string, headers?: CliHeadersProvider, options?: CliWebSocketAuthOptions): Promise<string>;
|
|
3765
3799
|
/**
|
|
3766
3800
|
* 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
|
-
*
|
|
3801
|
+
* from auth providers (e.g. a single-use ticket from the users module);
|
|
3802
|
+
* otherwise authenticates with the server's headers through
|
|
3803
|
+
* {@link buildServerWebSocketUrl}.
|
|
3770
3804
|
*/
|
|
3771
|
-
declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undefined, serverName: string, wsUrl: string, configHeaders?: CliHeadersProvider): Promise<string>;
|
|
3805
|
+
declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undefined, serverName: string, wsUrl: string, configHeaders?: CliHeadersProvider, options?: CliWebSocketAuthOptions): Promise<string>;
|
|
3772
3806
|
/** Append query params to a URL that may already have some. */
|
|
3773
3807
|
declare function appendQueryParams(url: string, params: Record<string, string>): string;
|
|
3774
3808
|
|
|
@@ -4100,7 +4134,7 @@ interface CliThemeInfo {
|
|
|
4100
4134
|
|
|
4101
4135
|
declare const DefaultThemeInfos: Record<string, CliThemeInfo>;
|
|
4102
4136
|
|
|
4103
|
-
declare const LIBRARY_VERSION = "2.0.
|
|
4137
|
+
declare const LIBRARY_VERSION = "2.0.1";
|
|
4104
4138
|
declare const API_VERSION = 2;
|
|
4105
4139
|
|
|
4106
4140
|
/**
|
|
@@ -4161,5 +4195,5 @@ declare class BrowserFileTransferService implements ICliFileTransferService {
|
|
|
4161
4195
|
private _pickFile;
|
|
4162
4196
|
}
|
|
4163
4197
|
|
|
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 };
|
|
4198
|
+
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 };
|
|
4199
|
+
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, 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
|
@@ -3342,6 +3342,34 @@ type CliServerConfig = {
|
|
|
3342
3342
|
headers?: CliHeadersProvider;
|
|
3343
3343
|
/** Request timeout in milliseconds. @default 30000 */
|
|
3344
3344
|
timeout?: number;
|
|
3345
|
+
/**
|
|
3346
|
+
* Copy `headers` into WebSocket URLs as `_header_<name>` query params
|
|
3347
|
+
* (the behaviour up to 2.0.0). Off by default: tokens in URLs end up in
|
|
3348
|
+
* access, proxy and CDN logs and in browser history. Without it, sockets
|
|
3349
|
+
* authenticate with a single-use ticket from
|
|
3350
|
+
* `POST /api/v1/qcli/sessions/ws-ticket` (users plugin) fetched with these
|
|
3351
|
+
* headers. Only for servers that still read `_header_Authorization`, such
|
|
3352
|
+
* as a shell `accessToken` without the users plugin.
|
|
3353
|
+
* @deprecated use the users plugin's WebSocket tickets
|
|
3354
|
+
*/
|
|
3355
|
+
unsafeHeadersInWebSocketUrl?: boolean;
|
|
3356
|
+
};
|
|
3357
|
+
/**
|
|
3358
|
+
* Which rows of a longer result a server table holds. Commands that page (`--skip`,
|
|
3359
|
+
* `--take`) send it; servers also send it, with `truncated`, when they cut a
|
|
3360
|
+
* table from a command that does not page.
|
|
3361
|
+
*/
|
|
3362
|
+
type CliServerTablePage = {
|
|
3363
|
+
/** Rows skipped before these */
|
|
3364
|
+
skip: number;
|
|
3365
|
+
/** Rows asked for */
|
|
3366
|
+
take: number;
|
|
3367
|
+
/** All rows, when the command knows it */
|
|
3368
|
+
total?: number;
|
|
3369
|
+
/** Whether more rows follow */
|
|
3370
|
+
hasMore: boolean;
|
|
3371
|
+
/** The server cut the table: `--skip` will not show the rest */
|
|
3372
|
+
truncated?: boolean;
|
|
3345
3373
|
};
|
|
3346
3374
|
/**
|
|
3347
3375
|
* A single output item in a server response
|
|
@@ -3354,6 +3382,7 @@ type CliServerOutput = {
|
|
|
3354
3382
|
type: 'table';
|
|
3355
3383
|
headers: string[];
|
|
3356
3384
|
rows: string[][];
|
|
3385
|
+
page?: CliServerTablePage;
|
|
3357
3386
|
} | {
|
|
3358
3387
|
type: 'list';
|
|
3359
3388
|
items: string[];
|
|
@@ -3740,35 +3769,40 @@ declare class ServerVersionNegotiator {
|
|
|
3740
3769
|
}
|
|
3741
3770
|
|
|
3742
3771
|
/**
|
|
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.
|
|
3772
|
+
* Copies headers into a WebSocket URL as `_header_<name>` query params.
|
|
3750
3773
|
*
|
|
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.
|
|
3774
|
+
* **Unsafe:** query parameters are visible in browser history and in server,
|
|
3775
|
+
* proxy and CDN access logs. Used only for servers configured with
|
|
3776
|
+
* `unsafeHeadersInWebSocketUrl: true`; everything else goes through
|
|
3777
|
+
* {@link buildServerWebSocketUrl}, which keeps headers out of the URL.
|
|
3759
3778
|
*
|
|
3760
3779
|
* @param wsUrl The base WebSocket URL (may already contain query parameters)
|
|
3761
3780
|
* @param headers The headers provider from CliServerConfig (may include Authorization, etc.)
|
|
3762
|
-
* @returns The WebSocket URL with
|
|
3781
|
+
* @returns The WebSocket URL with the headers appended as query parameters
|
|
3763
3782
|
*/
|
|
3764
3783
|
declare function buildAuthenticatedWebSocketUrl(wsUrl: string, headers?: CliHeadersProvider): string;
|
|
3784
|
+
/** Options for {@link buildServerWebSocketUrl} and {@link resolveServerWebSocketUrl}. */
|
|
3785
|
+
interface CliWebSocketAuthOptions {
|
|
3786
|
+
/** See `CliServerConfig.unsafeHeadersInWebSocketUrl` */
|
|
3787
|
+
unsafeHeadersInWebSocketUrl?: boolean;
|
|
3788
|
+
}
|
|
3789
|
+
/** Ticket endpoint of the users plugin, relative to the server root */
|
|
3790
|
+
declare const CLI_WS_TICKET_PATH = "/api/v1/qcli/sessions/ws-ticket";
|
|
3791
|
+
/**
|
|
3792
|
+
* Authenticates a WebSocket URL with headers without putting them in it:
|
|
3793
|
+
* fetches a single-use ticket from `POST /api/v1/qcli/sessions/ws-ticket`
|
|
3794
|
+
* with the headers and appends `?ticket=`. When no ticket can be had, the
|
|
3795
|
+
* socket connects without credentials and a warning is logged once.
|
|
3796
|
+
* Headers are copied into the URL only with `unsafeHeadersInWebSocketUrl`.
|
|
3797
|
+
*/
|
|
3798
|
+
declare function buildServerWebSocketUrl(wsUrl: string, headers?: CliHeadersProvider, options?: CliWebSocketAuthOptions): Promise<string>;
|
|
3765
3799
|
/**
|
|
3766
3800
|
* 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
|
-
*
|
|
3801
|
+
* from auth providers (e.g. a single-use ticket from the users module);
|
|
3802
|
+
* otherwise authenticates with the server's headers through
|
|
3803
|
+
* {@link buildServerWebSocketUrl}.
|
|
3770
3804
|
*/
|
|
3771
|
-
declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undefined, serverName: string, wsUrl: string, configHeaders?: CliHeadersProvider): Promise<string>;
|
|
3805
|
+
declare function resolveServerWebSocketUrl(services: ICliServiceProvider | undefined, serverName: string, wsUrl: string, configHeaders?: CliHeadersProvider, options?: CliWebSocketAuthOptions): Promise<string>;
|
|
3772
3806
|
/** Append query params to a URL that may already have some. */
|
|
3773
3807
|
declare function appendQueryParams(url: string, params: Record<string, string>): string;
|
|
3774
3808
|
|
|
@@ -4100,7 +4134,7 @@ interface CliThemeInfo {
|
|
|
4100
4134
|
|
|
4101
4135
|
declare const DefaultThemeInfos: Record<string, CliThemeInfo>;
|
|
4102
4136
|
|
|
4103
|
-
declare const LIBRARY_VERSION = "2.0.
|
|
4137
|
+
declare const LIBRARY_VERSION = "2.0.1";
|
|
4104
4138
|
declare const API_VERSION = 2;
|
|
4105
4139
|
|
|
4106
4140
|
/**
|
|
@@ -4161,5 +4195,5 @@ declare class BrowserFileTransferService implements ICliFileTransferService {
|
|
|
4161
4195
|
private _pickFile;
|
|
4162
4196
|
}
|
|
4163
4197
|
|
|
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 };
|
|
4198
|
+
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 };
|
|
4199
|
+
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, 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.0.
|
|
2602
|
+
var LIBRARY_VERSION = "2.0.1";
|
|
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;
|