@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.js CHANGED
@@ -2055,6 +2055,40 @@ var CliIcon = /* @__PURE__ */ ((CliIcon2) => {
2055
2055
  return CliIcon2;
2056
2056
  })(CliIcon || {});
2057
2057
 
2058
+ // src/lib/tokens.ts
2059
+ var ICliUserSessionService_TOKEN = "cli-user-session-service";
2060
+ var ICliUsersStoreService_TOKEN = "cli-users-store-service";
2061
+ var ICliGroupsStoreService_TOKEN = "cli-groups-store-service";
2062
+ var ICliAuthService_TOKEN = "cli-auth-service";
2063
+ var ICliCompletionProvider_TOKEN = "cli-completion-provider";
2064
+ var ICliDragDropService_TOKEN = "cli-drag-drop-service";
2065
+ var ICliFileTransferService_TOKEN = "cli-file-transfer-service";
2066
+ var ICliTranslationService_TOKEN = "cli-translation-service";
2067
+ var ICliPermissionService_TOKEN = "cli-permission-service";
2068
+ var ICliFilePickerProvider_TOKEN = "cli-file-picker-provider";
2069
+ var ICliHttpClient_TOKEN = "cli-http-client";
2070
+
2071
+ // src/lib/interfaces/services.ts
2072
+ var ICliServerAuthTokenProvider_TOKEN = "cli-server-auth-token-provider";
2073
+ var ICliServerAuthService_TOKEN = "cli-server-auth-service";
2074
+
2075
+ // src/lib/models/server.ts
2076
+ function resolveHeaders(provider) {
2077
+ if (!provider) return {};
2078
+ return typeof provider === "function" ? provider() : provider;
2079
+ }
2080
+ function resolveServerHeaders(services, serverName, configHeaders) {
2081
+ if (services) {
2082
+ const authService = services.get(
2083
+ ICliServerAuthService_TOKEN
2084
+ );
2085
+ if (authService) {
2086
+ return authService.getHeaders(serverName, configHeaders);
2087
+ }
2088
+ }
2089
+ return resolveHeaders(configHeaders);
2090
+ }
2091
+
2058
2092
  // src/lib/models/options.ts
2059
2093
  var CliLogLevel = /* @__PURE__ */ ((CliLogLevel2) => {
2060
2094
  CliLogLevel2[CliLogLevel2["None"] = 0] = "None";
@@ -2078,18 +2112,6 @@ var enums = {
2078
2112
  CliLogLevel
2079
2113
  };
2080
2114
 
2081
- // src/lib/tokens.ts
2082
- var ICliUserSessionService_TOKEN = "cli-user-session-service";
2083
- var ICliUsersStoreService_TOKEN = "cli-users-store-service";
2084
- var ICliGroupsStoreService_TOKEN = "cli-groups-store-service";
2085
- var ICliAuthService_TOKEN = "cli-auth-service";
2086
- var ICliCompletionProvider_TOKEN = "cli-completion-provider";
2087
- var ICliDragDropService_TOKEN = "cli-drag-drop-service";
2088
- var ICliFileTransferService_TOKEN = "cli-file-transfer-service";
2089
- var ICliTranslationService_TOKEN = "cli-translation-service";
2090
- var ICliPermissionService_TOKEN = "cli-permission-service";
2091
- var ICliFilePickerProvider_TOKEN = "cli-file-picker-provider";
2092
-
2093
2115
  // src/lib/constants/index.ts
2094
2116
  var DefaultLibraryAuthor = {
2095
2117
  name: "Nicolae Lupei",
@@ -2252,7 +2274,7 @@ function getConfigValue(state, category, key, defaultValue) {
2252
2274
  }
2253
2275
  function getPluginConfigValue(context, category, key, defaultValue) {
2254
2276
  try {
2255
- const storeManager = context.services.get(
2277
+ const storeManager = context.services.getRequired(
2256
2278
  "cli-state-store-manager"
2257
2279
  );
2258
2280
  if (!storeManager) return defaultValue;
@@ -2317,7 +2339,7 @@ function satisfiesVersionRange(installed, range) {
2317
2339
  }
2318
2340
 
2319
2341
  // src/lib/version.ts
2320
- var LIBRARY_VERSION = "2.0.0-beta.11";
2342
+ var LIBRARY_VERSION = "2.0.0-beta.13";
2321
2343
  var API_VERSION = 2;
2322
2344
 
2323
2345
  // src/lib/utils/server-version-negotiator.ts
@@ -2341,9 +2363,12 @@ var ServerVersionNegotiator = class {
2341
2363
  * Returns the negotiated API version and the base path for all subsequent calls,
2342
2364
  * or null if the server is unreachable or incompatible.
2343
2365
  */
2344
- static async discover(baseUrl) {
2366
+ static async discover(baseUrl, headers) {
2345
2367
  try {
2346
- const response = await fetch(`${baseUrl}${VERSIONS_ENDPOINT}`);
2368
+ const resolved = resolveHeaders(headers);
2369
+ const response = await fetch(`${baseUrl}${VERSIONS_ENDPOINT}`, {
2370
+ headers: Object.keys(resolved).length > 0 ? resolved : void 0
2371
+ });
2347
2372
  if (!response.ok) return null;
2348
2373
  const info = await response.json();
2349
2374
  const version = this.negotiate(info);
@@ -2358,6 +2383,19 @@ var ServerVersionNegotiator = class {
2358
2383
  }
2359
2384
  };
2360
2385
 
2386
+ // src/lib/utils/websocket-auth.ts
2387
+ function buildAuthenticatedWebSocketUrl(wsUrl, headers) {
2388
+ const resolved = resolveHeaders(headers);
2389
+ if (Object.keys(resolved).length === 0) {
2390
+ return wsUrl;
2391
+ }
2392
+ const separator = wsUrl.includes("?") ? "&" : "?";
2393
+ const params = Object.entries(resolved).map(
2394
+ ([key, value]) => `_header_${encodeURIComponent(key)}=${encodeURIComponent(value)}`
2395
+ ).join("&");
2396
+ return `${wsUrl}${separator}${params}`;
2397
+ }
2398
+
2361
2399
  // src/lib/utils/panel-theme-sync.ts
2362
2400
  function hexToRgb(hex) {
2363
2401
  const m = /^#?([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/.exec(hex);
@@ -2430,7 +2468,32 @@ function stripAnsi(text) {
2430
2468
  return text.replace(ANSI_RE, "");
2431
2469
  }
2432
2470
  function visibleLength(text) {
2433
- return stripAnsi(text).length;
2471
+ const stripped = stripAnsi(text);
2472
+ let width = 0;
2473
+ for (const ch of stripped) {
2474
+ const cp = ch.codePointAt(0);
2475
+ if (cp >= 65024 && cp <= 65039) continue;
2476
+ if (cp === 8205) continue;
2477
+ if (cp >= 768 && cp <= 879) continue;
2478
+ width += isWideCharacter(cp) ? 2 : 1;
2479
+ }
2480
+ return width;
2481
+ }
2482
+ function isWideCharacter(cp) {
2483
+ if (cp >= 126976) return true;
2484
+ if (cp >= 9728 && cp <= 10175) return true;
2485
+ if (cp >= 9984 && cp <= 10175) return true;
2486
+ if (cp >= 19968 && cp <= 40959) return true;
2487
+ if (cp >= 63744 && cp <= 64255) return true;
2488
+ if (cp >= 65281 && cp <= 65376) return true;
2489
+ if (cp >= 65504 && cp <= 65510) return true;
2490
+ if (cp >= 11904 && cp <= 12255) return true;
2491
+ if (cp >= 12288 && cp <= 12543) return true;
2492
+ if (cp >= 12800 && cp <= 13055) return true;
2493
+ if (cp >= 13056 && cp <= 13311) return true;
2494
+ if (cp >= 127232 && cp <= 127487) return true;
2495
+ if (cp >= 8960 && cp <= 9215) return true;
2496
+ return false;
2434
2497
  }
2435
2498
 
2436
2499
  // src/lib/utils/index.ts
@@ -3653,7 +3716,10 @@ exports.ICliDragDropService_TOKEN = ICliDragDropService_TOKEN;
3653
3716
  exports.ICliFilePickerProvider_TOKEN = ICliFilePickerProvider_TOKEN;
3654
3717
  exports.ICliFileTransferService_TOKEN = ICliFileTransferService_TOKEN;
3655
3718
  exports.ICliGroupsStoreService_TOKEN = ICliGroupsStoreService_TOKEN;
3719
+ exports.ICliHttpClient_TOKEN = ICliHttpClient_TOKEN;
3656
3720
  exports.ICliPermissionService_TOKEN = ICliPermissionService_TOKEN;
3721
+ exports.ICliServerAuthService_TOKEN = ICliServerAuthService_TOKEN;
3722
+ exports.ICliServerAuthTokenProvider_TOKEN = ICliServerAuthTokenProvider_TOKEN;
3657
3723
  exports.ICliTranslationService_TOKEN = ICliTranslationService_TOKEN;
3658
3724
  exports.ICliUserSessionService_TOKEN = ICliUserSessionService_TOKEN;
3659
3725
  exports.ICliUsersStoreService_TOKEN = ICliUsersStoreService_TOKEN;
@@ -3662,6 +3728,7 @@ exports.ObjectDescriber = ObjectDescriber;
3662
3728
  exports.ServerVersionNegotiator = ServerVersionNegotiator;
3663
3729
  exports.bootCliModule = bootCliModule;
3664
3730
  exports.bootUmdModule = bootUmdModule;
3731
+ exports.buildAuthenticatedWebSocketUrl = buildAuthenticatedWebSocketUrl;
3665
3732
  exports.clearTerminalLine = clearTerminalLine;
3666
3733
  exports.colorFirstWord = colorFirstWord;
3667
3734
  exports.colorizeJson = colorizeJson;
@@ -3681,6 +3748,8 @@ exports.initializeBrowserEnvironment = initializeBrowserEnvironment;
3681
3748
  exports.loadPanelPosition = loadPanelPosition;
3682
3749
  exports.nextPanelPosition = nextPanelPosition;
3683
3750
  exports.resolveConfigurationCategories = resolveConfigurationCategories;
3751
+ exports.resolveHeaders = resolveHeaders;
3752
+ exports.resolveServerHeaders = resolveServerHeaders;
3684
3753
  exports.satisfiesMinVersion = satisfiesMinVersion;
3685
3754
  exports.satisfiesVersionRange = satisfiesVersionRange;
3686
3755
  exports.savePanelPosition = savePanelPosition;