@qodalis/cli-files 2.0.0-beta.12 → 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.
@@ -1834,6 +1834,10 @@ var files = (() => {
1834
1834
  return CliForegroundColor2;
1835
1835
  })(CliForegroundColor || {});
1836
1836
  var ICliCompletionProvider_TOKEN = "cli-completion-provider";
1837
+ function resolveHeaders(provider) {
1838
+ if (!provider) return {};
1839
+ return typeof provider === "function" ? provider() : provider;
1840
+ }
1837
1841
  var DefaultLibraryAuthor = {
1838
1842
  name: "Nicolae Lupei",
1839
1843
  email: "nicolae.lupei@qodalis.com"
@@ -1860,9 +1864,12 @@ var files = (() => {
1860
1864
  * Returns the negotiated API version and the base path for all subsequent calls,
1861
1865
  * or null if the server is unreachable or incompatible.
1862
1866
  */
1863
- static async discover(baseUrl) {
1867
+ static async discover(baseUrl, headers) {
1864
1868
  try {
1865
- const response = await fetch(`${baseUrl}${VERSIONS_ENDPOINT}`);
1869
+ const resolved = resolveHeaders(headers);
1870
+ const response = await fetch(`${baseUrl}${VERSIONS_ENDPOINT}`, {
1871
+ headers: Object.keys(resolved).length > 0 ? resolved : void 0
1872
+ });
1866
1873
  if (!response.ok) return null;
1867
1874
  const info = await response.json();
1868
1875
  const version = this.negotiate(info);
@@ -2694,7 +2701,7 @@ var files = (() => {
2694
2701
  };
2695
2702
 
2696
2703
  // src/lib/version.ts
2697
- var LIBRARY_VERSION = "2.0.0-beta.12";
2704
+ var LIBRARY_VERSION = "2.0.0-beta.13";
2698
2705
  var API_VERSION2 = 2;
2699
2706
 
2700
2707
  // src/lib/interfaces/i-file-system-service.ts
@@ -3309,7 +3316,7 @@ var files = (() => {
3309
3316
  ];
3310
3317
  }
3311
3318
  async processCommand(command, context) {
3312
- const fs = context.services.get(
3319
+ const fs = context.services.getRequired(
3313
3320
  IFileSystemService_TOKEN
3314
3321
  );
3315
3322
  const targetPath = command.value || fs.getCurrentDirectory();
@@ -3382,7 +3389,7 @@ var files = (() => {
3382
3389
  this.metadata = { icon: "\u{1F4C1}", module: "file management" };
3383
3390
  }
3384
3391
  async processCommand(command, context) {
3385
- const fs = context.services.get(
3392
+ const fs = context.services.getRequired(
3386
3393
  IFileSystemService_TOKEN
3387
3394
  );
3388
3395
  const target = command.value || "~";
@@ -3405,7 +3412,7 @@ var files = (() => {
3405
3412
  this.metadata = { icon: "\u{1F4C2}", module: "file management" };
3406
3413
  }
3407
3414
  async processCommand(command, context) {
3408
- const fs = context.services.get(
3415
+ const fs = context.services.getRequired(
3409
3416
  IFileSystemService_TOKEN
3410
3417
  );
3411
3418
  context.writer.writeln(fs.getCurrentDirectory());
@@ -3433,7 +3440,7 @@ var files = (() => {
3433
3440
  ];
3434
3441
  }
3435
3442
  async processCommand(command, context) {
3436
- const fs = context.services.get(
3443
+ const fs = context.services.getRequired(
3437
3444
  IFileSystemService_TOKEN
3438
3445
  );
3439
3446
  const path = command.value;
@@ -3463,7 +3470,7 @@ var files = (() => {
3463
3470
  this.metadata = { icon: "\u{1F5D1}", module: "file management" };
3464
3471
  }
3465
3472
  async processCommand(command, context) {
3466
- const fs = context.services.get(
3473
+ const fs = context.services.getRequired(
3467
3474
  IFileSystemService_TOKEN
3468
3475
  );
3469
3476
  const path = command.value;
@@ -3509,7 +3516,7 @@ var files = (() => {
3509
3516
  this.metadata = { icon: "\u{1F4C4}", module: "file management" };
3510
3517
  }
3511
3518
  async processCommand(command, context) {
3512
- const fs = context.services.get(
3519
+ const fs = context.services.getRequired(
3513
3520
  IFileSystemService_TOKEN
3514
3521
  );
3515
3522
  const path = command.value;
@@ -3538,7 +3545,7 @@ var files = (() => {
3538
3545
  this.metadata = { icon: "\u{1F4D6}", module: "file management" };
3539
3546
  }
3540
3547
  async processCommand(command, context) {
3541
- const fs = context.services.get(
3548
+ const fs = context.services.getRequired(
3542
3549
  IFileSystemService_TOKEN
3543
3550
  );
3544
3551
  const path = command.value;
@@ -3579,7 +3586,7 @@ var files = (() => {
3579
3586
  }
3580
3587
  return;
3581
3588
  }
3582
- const fs = context.services.get(
3589
+ const fs = context.services.getRequired(
3583
3590
  IFileSystemService_TOKEN
3584
3591
  );
3585
3592
  let text;
@@ -3653,7 +3660,7 @@ var files = (() => {
3653
3660
  ];
3654
3661
  }
3655
3662
  async processCommand(command, context) {
3656
- const fs = context.services.get(
3663
+ const fs = context.services.getRequired(
3657
3664
  IFileSystemService_TOKEN
3658
3665
  );
3659
3666
  const path = command.value;
@@ -3704,7 +3711,7 @@ var files = (() => {
3704
3711
  ];
3705
3712
  }
3706
3713
  async processCommand(command, context) {
3707
- const fs = context.services.get(
3714
+ const fs = context.services.getRequired(
3708
3715
  IFileSystemService_TOKEN
3709
3716
  );
3710
3717
  const recursive = command.args["recursive"] || command.args["r"] || command.args["R"];
@@ -3742,7 +3749,7 @@ var files = (() => {
3742
3749
  this.metadata = { icon: "\u{1F4E6}", module: "file management" };
3743
3750
  }
3744
3751
  async processCommand(command, context) {
3745
- const fs = context.services.get(
3752
+ const fs = context.services.getRequired(
3746
3753
  IFileSystemService_TOKEN
3747
3754
  );
3748
3755
  const parts = this.parseArgs(command);
@@ -3786,7 +3793,7 @@ var files = (() => {
3786
3793
  ];
3787
3794
  }
3788
3795
  async processCommand(command, context) {
3789
- const fs = context.services.get(
3796
+ const fs = context.services.getRequired(
3790
3797
  IFileSystemService_TOKEN
3791
3798
  );
3792
3799
  const targetPath = command.value || fs.getCurrentDirectory();
@@ -3881,7 +3888,7 @@ var files = (() => {
3881
3888
  ];
3882
3889
  }
3883
3890
  async processCommand(command, context) {
3884
- const fs = context.services.get(
3891
+ const fs = context.services.getRequired(
3885
3892
  IFileSystemService_TOKEN
3886
3893
  );
3887
3894
  const count = parseInt(
@@ -3948,7 +3955,7 @@ var files = (() => {
3948
3955
  ];
3949
3956
  }
3950
3957
  async processCommand(command, context) {
3951
- const fs = context.services.get(
3958
+ const fs = context.services.getRequired(
3952
3959
  IFileSystemService_TOKEN
3953
3960
  );
3954
3961
  const count = parseInt(
@@ -4029,7 +4036,7 @@ var files = (() => {
4029
4036
  ];
4030
4037
  }
4031
4038
  async processCommand(command, context) {
4032
- const fs = context.services.get(
4039
+ const fs = context.services.getRequired(
4033
4040
  IFileSystemService_TOKEN
4034
4041
  );
4035
4042
  const showLines = command.args["lines"] || command.args["l"] || false;
@@ -4125,7 +4132,7 @@ var files = (() => {
4125
4132
  ];
4126
4133
  }
4127
4134
  async processCommand(command, context) {
4128
- const fs = context.services.get(
4135
+ const fs = context.services.getRequired(
4129
4136
  IFileSystemService_TOKEN
4130
4137
  );
4131
4138
  const searchPath = this.parseSearchPath(command) || fs.getCurrentDirectory();
@@ -4262,7 +4269,7 @@ var files = (() => {
4262
4269
  ];
4263
4270
  }
4264
4271
  async processCommand(command, context) {
4265
- const fs = context.services.get(
4272
+ const fs = context.services.getRequired(
4266
4273
  IFileSystemService_TOKEN
4267
4274
  );
4268
4275
  const ignoreCase = command.args["ignore-case"] || command.args["i"] || false;
@@ -4443,7 +4450,7 @@ var files = (() => {
4443
4450
  ];
4444
4451
  }
4445
4452
  async processCommand(command, context) {
4446
- const fs = context.services.get(
4453
+ const fs = context.services.getRequired(
4447
4454
  IFileSystemService_TOKEN
4448
4455
  );
4449
4456
  let filePath = (command.value || "").trim();
@@ -4571,7 +4578,6 @@ var files = (() => {
4571
4578
  }
4572
4579
 
4573
4580
  // src/cli-entrypoint.ts
4574
- var fsService = new IndexedDbFileSystemService();
4575
4581
  var module = {
4576
4582
  apiVersion: API_VERSION2,
4577
4583
  name: "@qodalis/cli-files",
@@ -4598,16 +4604,17 @@ var files = (() => {
4598
4604
  services: [
4599
4605
  {
4600
4606
  provide: IFileSystemService_TOKEN,
4601
- useValue: fsService
4607
+ useClass: IndexedDbFileSystemService
4602
4608
  },
4603
4609
  {
4604
4610
  provide: ICliCompletionProvider_TOKEN,
4605
- useValue: new FilePathCompletionProvider(fsService),
4611
+ useClass: FilePathCompletionProvider,
4612
+ deps: [IFileSystemService_TOKEN],
4606
4613
  multi: true
4607
4614
  }
4608
4615
  ],
4609
4616
  async onInit(context) {
4610
- const fs = context.services.get(
4617
+ const fs = context.services.getRequired(
4611
4618
  IFileSystemService_TOKEN
4612
4619
  );
4613
4620
  await fs.initialize();