@qodalis/cli-core 2.0.0-beta.11 → 2.0.0-beta.13

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/public-api.mjs CHANGED
@@ -2053,6 +2053,40 @@ var CliIcon = /* @__PURE__ */ ((CliIcon2) => {
2053
2053
  return CliIcon2;
2054
2054
  })(CliIcon || {});
2055
2055
 
2056
+ // src/lib/tokens.ts
2057
+ var ICliUserSessionService_TOKEN = "cli-user-session-service";
2058
+ var ICliUsersStoreService_TOKEN = "cli-users-store-service";
2059
+ var ICliGroupsStoreService_TOKEN = "cli-groups-store-service";
2060
+ var ICliAuthService_TOKEN = "cli-auth-service";
2061
+ var ICliCompletionProvider_TOKEN = "cli-completion-provider";
2062
+ var ICliDragDropService_TOKEN = "cli-drag-drop-service";
2063
+ var ICliFileTransferService_TOKEN = "cli-file-transfer-service";
2064
+ var ICliTranslationService_TOKEN = "cli-translation-service";
2065
+ var ICliPermissionService_TOKEN = "cli-permission-service";
2066
+ var ICliFilePickerProvider_TOKEN = "cli-file-picker-provider";
2067
+ var ICliHttpClient_TOKEN = "cli-http-client";
2068
+
2069
+ // src/lib/interfaces/services.ts
2070
+ var ICliServerAuthTokenProvider_TOKEN = "cli-server-auth-token-provider";
2071
+ var ICliServerAuthService_TOKEN = "cli-server-auth-service";
2072
+
2073
+ // src/lib/models/server.ts
2074
+ function resolveHeaders(provider) {
2075
+ if (!provider) return {};
2076
+ return typeof provider === "function" ? provider() : provider;
2077
+ }
2078
+ function resolveServerHeaders(services, serverName, configHeaders) {
2079
+ if (services) {
2080
+ const authService = services.get(
2081
+ ICliServerAuthService_TOKEN
2082
+ );
2083
+ if (authService) {
2084
+ return authService.getHeaders(serverName, configHeaders);
2085
+ }
2086
+ }
2087
+ return resolveHeaders(configHeaders);
2088
+ }
2089
+
2056
2090
  // src/lib/models/options.ts
2057
2091
  var CliLogLevel = /* @__PURE__ */ ((CliLogLevel2) => {
2058
2092
  CliLogLevel2[CliLogLevel2["None"] = 0] = "None";
@@ -2076,18 +2110,6 @@ var enums = {
2076
2110
  CliLogLevel
2077
2111
  };
2078
2112
 
2079
- // src/lib/tokens.ts
2080
- var ICliUserSessionService_TOKEN = "cli-user-session-service";
2081
- var ICliUsersStoreService_TOKEN = "cli-users-store-service";
2082
- var ICliGroupsStoreService_TOKEN = "cli-groups-store-service";
2083
- var ICliAuthService_TOKEN = "cli-auth-service";
2084
- var ICliCompletionProvider_TOKEN = "cli-completion-provider";
2085
- var ICliDragDropService_TOKEN = "cli-drag-drop-service";
2086
- var ICliFileTransferService_TOKEN = "cli-file-transfer-service";
2087
- var ICliTranslationService_TOKEN = "cli-translation-service";
2088
- var ICliPermissionService_TOKEN = "cli-permission-service";
2089
- var ICliFilePickerProvider_TOKEN = "cli-file-picker-provider";
2090
-
2091
2113
  // src/lib/constants/index.ts
2092
2114
  var DefaultLibraryAuthor = {
2093
2115
  name: "Nicolae Lupei",
@@ -2250,7 +2272,7 @@ function getConfigValue(state, category, key, defaultValue) {
2250
2272
  }
2251
2273
  function getPluginConfigValue(context, category, key, defaultValue) {
2252
2274
  try {
2253
- const storeManager = context.services.get(
2275
+ const storeManager = context.services.getRequired(
2254
2276
  "cli-state-store-manager"
2255
2277
  );
2256
2278
  if (!storeManager) return defaultValue;
@@ -2315,7 +2337,7 @@ function satisfiesVersionRange(installed, range) {
2315
2337
  }
2316
2338
 
2317
2339
  // src/lib/version.ts
2318
- var LIBRARY_VERSION = "2.0.0-beta.11";
2340
+ var LIBRARY_VERSION = "2.0.0-beta.13";
2319
2341
  var API_VERSION = 2;
2320
2342
 
2321
2343
  // src/lib/utils/server-version-negotiator.ts
@@ -2339,9 +2361,12 @@ var ServerVersionNegotiator = class {
2339
2361
  * Returns the negotiated API version and the base path for all subsequent calls,
2340
2362
  * or null if the server is unreachable or incompatible.
2341
2363
  */
2342
- static async discover(baseUrl) {
2364
+ static async discover(baseUrl, headers) {
2343
2365
  try {
2344
- const response = await fetch(`${baseUrl}${VERSIONS_ENDPOINT}`);
2366
+ const resolved = resolveHeaders(headers);
2367
+ const response = await fetch(`${baseUrl}${VERSIONS_ENDPOINT}`, {
2368
+ headers: Object.keys(resolved).length > 0 ? resolved : void 0
2369
+ });
2345
2370
  if (!response.ok) return null;
2346
2371
  const info = await response.json();
2347
2372
  const version = this.negotiate(info);
@@ -2356,6 +2381,19 @@ var ServerVersionNegotiator = class {
2356
2381
  }
2357
2382
  };
2358
2383
 
2384
+ // src/lib/utils/websocket-auth.ts
2385
+ function buildAuthenticatedWebSocketUrl(wsUrl, headers) {
2386
+ const resolved = resolveHeaders(headers);
2387
+ if (Object.keys(resolved).length === 0) {
2388
+ return wsUrl;
2389
+ }
2390
+ const separator = wsUrl.includes("?") ? "&" : "?";
2391
+ const params = Object.entries(resolved).map(
2392
+ ([key, value]) => `_header_${encodeURIComponent(key)}=${encodeURIComponent(value)}`
2393
+ ).join("&");
2394
+ return `${wsUrl}${separator}${params}`;
2395
+ }
2396
+
2359
2397
  // src/lib/utils/panel-theme-sync.ts
2360
2398
  function hexToRgb(hex) {
2361
2399
  const m = /^#?([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/.exec(hex);
@@ -2428,7 +2466,32 @@ function stripAnsi(text) {
2428
2466
  return text.replace(ANSI_RE, "");
2429
2467
  }
2430
2468
  function visibleLength(text) {
2431
- return stripAnsi(text).length;
2469
+ const stripped = stripAnsi(text);
2470
+ let width = 0;
2471
+ for (const ch of stripped) {
2472
+ const cp = ch.codePointAt(0);
2473
+ if (cp >= 65024 && cp <= 65039) continue;
2474
+ if (cp === 8205) continue;
2475
+ if (cp >= 768 && cp <= 879) continue;
2476
+ width += isWideCharacter(cp) ? 2 : 1;
2477
+ }
2478
+ return width;
2479
+ }
2480
+ function isWideCharacter(cp) {
2481
+ if (cp >= 126976) return true;
2482
+ if (cp >= 9728 && cp <= 10175) return true;
2483
+ if (cp >= 9984 && cp <= 10175) return true;
2484
+ if (cp >= 19968 && cp <= 40959) return true;
2485
+ if (cp >= 63744 && cp <= 64255) return true;
2486
+ if (cp >= 65281 && cp <= 65376) return true;
2487
+ if (cp >= 65504 && cp <= 65510) return true;
2488
+ if (cp >= 11904 && cp <= 12255) return true;
2489
+ if (cp >= 12288 && cp <= 12543) return true;
2490
+ if (cp >= 12800 && cp <= 13055) return true;
2491
+ if (cp >= 13056 && cp <= 13311) return true;
2492
+ if (cp >= 127232 && cp <= 127487) return true;
2493
+ if (cp >= 8960 && cp <= 9215) return true;
2494
+ return false;
2432
2495
  }
2433
2496
 
2434
2497
  // src/lib/utils/index.ts
@@ -3630,6 +3693,6 @@ var BrowserFileTransferService = class {
3630
3693
  }
3631
3694
  };
3632
3695
 
3633
- export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CancellablePromise, CliBackgroundColor, CliForegroundColor, CliIcon, CliLogLevel, CliModuleRegistry, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuthService_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliPermissionService_TOKEN, ICliTranslationService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, bootCliModule, bootUmdModule, clearTerminalLine, colorFirstWord, colorizeJson, compareVersions, constants, createWorkerService, delay, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, loadPanelPosition, nextPanelPosition, resolveConfigurationCategories, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, stripAnsi, toQueryString, utils, visibleLength };
3696
+ export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CancellablePromise, CliBackgroundColor, CliForegroundColor, CliIcon, CliLogLevel, CliModuleRegistry, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuthService_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliTranslationService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, bootCliModule, bootUmdModule, buildAuthenticatedWebSocketUrl, clearTerminalLine, colorFirstWord, colorizeJson, compareVersions, constants, createWorkerService, delay, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, loadPanelPosition, nextPanelPosition, resolveConfigurationCategories, resolveHeaders, resolveServerHeaders, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, stripAnsi, toQueryString, utils, visibleLength };
3634
3697
  //# sourceMappingURL=public-api.mjs.map
3635
3698
  //# sourceMappingURL=public-api.mjs.map