@immich/cli 2.2.97 → 2.2.99

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.
Files changed (3) hide show
  1. package/.nvmrc +1 -1
  2. package/dist/index.js +35 -14
  3. package/package.json +3 -3
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 22.20.0
1
+ 24.11.0
package/dist/index.js CHANGED
@@ -3364,6 +3364,7 @@ var Permission;
3364
3364
  Permission2["AssetDownload"] = "asset.download";
3365
3365
  Permission2["AssetUpload"] = "asset.upload";
3366
3366
  Permission2["AssetReplace"] = "asset.replace";
3367
+ Permission2["AssetCopy"] = "asset.copy";
3367
3368
  Permission2["AlbumCreate"] = "album.create";
3368
3369
  Permission2["AlbumRead"] = "album.read";
3369
3370
  Permission2["AlbumUpdate"] = "album.update";
@@ -3472,6 +3473,7 @@ var Permission;
3472
3473
  Permission2["AdminUserRead"] = "adminUser.read";
3473
3474
  Permission2["AdminUserUpdate"] = "adminUser.update";
3474
3475
  Permission2["AdminUserDelete"] = "adminUser.delete";
3476
+ Permission2["AdminSessionRead"] = "adminSession.read";
3475
3477
  Permission2["AdminAuthUnlinkAll"] = "adminAuth.unlinkAll";
3476
3478
  })(Permission || (Permission = {}));
3477
3479
  var AssetMetadataKey;
@@ -3533,6 +3535,7 @@ var JobName;
3533
3535
  JobName2["Library"] = "library";
3534
3536
  JobName2["Notifications"] = "notifications";
3535
3537
  JobName2["BackupDatabase"] = "backupDatabase";
3538
+ JobName2["Ocr"] = "ocr";
3536
3539
  })(JobName || (JobName = {}));
3537
3540
  var JobCommand;
3538
3541
  (function(JobCommand2) {
@@ -3558,6 +3561,7 @@ var SearchSuggestionType;
3558
3561
  SearchSuggestionType2["City"] = "city";
3559
3562
  SearchSuggestionType2["CameraMake"] = "camera-make";
3560
3563
  SearchSuggestionType2["CameraModel"] = "camera-model";
3564
+ SearchSuggestionType2["CameraLensModel"] = "camera-lens-model";
3561
3565
  })(SearchSuggestionType || (SearchSuggestionType = {}));
3562
3566
  var SharedLinkType;
3563
3567
  (function(SharedLinkType2) {
@@ -19645,10 +19649,7 @@ const uploadBatch = async (files, options2) => {
19645
19649
  console.log(JSON.stringify({ newFiles, duplicates, newAssets }, void 0, 4));
19646
19650
  }
19647
19651
  await updateAlbums([...newAssets, ...duplicates], options2);
19648
- await deleteFiles(
19649
- newAssets.map(({ filepath }) => filepath),
19650
- options2
19651
- );
19652
+ await deleteFiles(newAssets, duplicates, options2);
19652
19653
  };
19653
19654
  const startWatch = async (paths, options2, {
19654
19655
  batchSize = UPLOAD_WATCH_BATCH_SIZE,
@@ -19903,12 +19904,19 @@ const uploadFile = async (input, stats) => {
19903
19904
  }
19904
19905
  return response.json();
19905
19906
  };
19906
- const deleteFiles = async (files, options2) => {
19907
- if (!options2.delete) {
19908
- return;
19907
+ const deleteFiles = async (uploaded, duplicates, options2) => {
19908
+ let fileCount = 0;
19909
+ if (options2.delete) {
19910
+ fileCount += uploaded.length;
19911
+ }
19912
+ if (options2.deleteDuplicates) {
19913
+ fileCount += duplicates.length;
19909
19914
  }
19910
19915
  if (options2.dryRun) {
19911
- console.log(`Would have deleted ${files.length} local asset${s(files.length)}`);
19916
+ console.log(`Would have deleted ${fileCount} local asset${s(fileCount)}`);
19917
+ return;
19918
+ }
19919
+ if (fileCount === 0) {
19912
19920
  return;
19913
19921
  }
19914
19922
  console.log("Deleting assets that have been uploaded...");
@@ -19916,12 +19924,20 @@ const deleteFiles = async (files, options2) => {
19916
19924
  { format: "Deleting local assets | {bar} | {percentage}% | ETA: {eta}s | {value}/{total} assets" },
19917
19925
  cliProgressExports.Presets.shades_classic
19918
19926
  );
19919
- deletionProgress.start(files.length, 0);
19920
- try {
19927
+ deletionProgress.start(fileCount, 0);
19928
+ const chunkDelete = async (files) => {
19921
19929
  for (const assetBatch of chunk(files, options2.concurrency)) {
19922
- await Promise.all(assetBatch.map((input) => unlink(input)));
19930
+ await Promise.all(assetBatch.map((input) => unlink(input.filepath)));
19923
19931
  deletionProgress.update(assetBatch.length);
19924
19932
  }
19933
+ };
19934
+ try {
19935
+ if (options2.delete) {
19936
+ await chunkDelete(uploaded);
19937
+ }
19938
+ if (options2.deleteDuplicates) {
19939
+ await chunkDelete(duplicates);
19940
+ }
19925
19941
  } finally {
19926
19942
  deletionProgress.stop();
19927
19943
  }
@@ -20047,8 +20063,9 @@ const serverInfo = async (options2) => {
20047
20063
  console.log(` Videos: ${stats.videos}`);
20048
20064
  console.log(` Total: ${stats.total}`);
20049
20065
  };
20050
- const version = "2.2.97";
20066
+ const version = "2.2.99";
20051
20067
  const defaultConfigDirectory = path$1.join(os.homedir(), ".config/immich/");
20068
+ const defaultConcurrency = Math.max(1, os.cpus().length - 1);
20052
20069
  const program = new Command().name("immich").version(version).description("Command line interface for Immich").addOption(
20053
20070
  new Option("-d, --config-directory <directory>", "Configuration directory where auth.yml will be stored").env("IMMICH_CONFIG_DIR").default(defaultConfigDirectory)
20054
20071
  ).addOption(new Option("-u, --url [url]", "Immich server URL").env("IMMICH_INSTANCE_URL")).addOption(new Option("-k, --key [key]", "Immich API key").env("IMMICH_API_KEY"));
@@ -20062,10 +20079,14 @@ program.command("upload").description("Upload assets").usage("[paths...] [option
20062
20079
  ).addOption(
20063
20080
  new Option("-n, --dry-run", "Don't perform any actions, just show what will be done").env("IMMICH_DRY_RUN").default(false).conflicts("skipHash")
20064
20081
  ).addOption(
20065
- new Option("-c, --concurrency <number>", "Number of assets to upload at the same time").env("IMMICH_UPLOAD_CONCURRENCY").default(4)
20082
+ new Option("-c, --concurrency <number>", "Number of assets to upload at the same time").env("IMMICH_UPLOAD_CONCURRENCY").default(defaultConcurrency)
20066
20083
  ).addOption(
20067
20084
  new Option("-j, --json-output", "Output detailed information in json format").env("IMMICH_JSON_OUTPUT").default(false)
20068
- ).addOption(new Option("--delete", "Delete local assets after upload").env("IMMICH_DELETE_ASSETS")).addOption(new Option("--no-progress", "Hide progress bars").env("IMMICH_PROGRESS_BAR").default(true)).addOption(
20085
+ ).addOption(new Option("--delete", "Delete local assets after upload").env("IMMICH_DELETE_ASSETS")).addOption(
20086
+ new Option("--delete-duplicates", "Delete local assets that are duplicates (already exist on server)").env(
20087
+ "IMMICH_DELETE_DUPLICATES"
20088
+ )
20089
+ ).addOption(new Option("--no-progress", "Hide progress bars").env("IMMICH_PROGRESS_BAR").default(true)).addOption(
20069
20090
  new Option("--watch", "Watch for changes and upload automatically").env("IMMICH_WATCH_CHANGES").default(false).implies({ progress: false })
20070
20091
  ).argument("[paths...]", "One or more paths to assets to be uploaded").action((paths, options2) => upload(paths, program.opts(), options2));
20071
20092
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/cli",
3
- "version": "2.2.97",
3
+ "version": "2.2.99",
4
4
  "description": "Command Line Interface (CLI) for Immich",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "@types/lodash-es": "^4.17.12",
21
21
  "@types/micromatch": "^4.0.9",
22
22
  "@types/mock-fs": "^4.13.1",
23
- "@types/node": "^22.18.8",
23
+ "@types/node": "^22.18.12",
24
24
  "@vitest/coverage-v8": "^3.0.0",
25
25
  "byte-size": "^9.0.0",
26
26
  "cli-progress": "^3.12.0",
@@ -57,7 +57,7 @@
57
57
  "micromatch": "^4.0.8"
58
58
  },
59
59
  "volta": {
60
- "node": "22.20.0"
60
+ "node": "24.11.0"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "vite build",