@gallop.software/studio 1.2.5 → 1.2.7

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.
@@ -361,6 +361,8 @@ async function handleList(request) {
361
361
  const thumbnailUrl = cdnBaseUrl ? `${cdnBaseUrl}${thumb.path}` : thumb.path;
362
362
  const isPushedToCloud = cdnIndex !== void 0;
363
363
  const isRemote = isPushedToCloud && cdnBaseUrl !== r2PublicUrl;
364
+ const thumbDims = _optionalChain([originalEntry, 'optionalAccess', _9 => _9[thumb.size]]);
365
+ const dimensions = thumbDims ? { width: thumbDims.w, height: thumbDims.h } : void 0;
364
366
  if (imagesSubPath === "") {
365
367
  const slashIndex = thumbRelative.indexOf("/");
366
368
  if (slashIndex === -1) {
@@ -374,7 +376,8 @@ async function handleList(request) {
374
376
  isProtected: true,
375
377
  cdnPushed: isPushedToCloud,
376
378
  cdnBaseUrl,
377
- isRemote
379
+ isRemote,
380
+ dimensions
378
381
  });
379
382
  } else {
380
383
  const folderName = thumbRelative.slice(0, slashIndex);
@@ -408,7 +411,8 @@ async function handleList(request) {
408
411
  isProtected: true,
409
412
  cdnPushed: isPushedToCloud,
410
413
  cdnBaseUrl,
411
- isRemote
414
+ isRemote,
415
+ dimensions
412
416
  });
413
417
  } else {
414
418
  const folderName = remaining.slice(0, slashIndex);
@@ -579,7 +583,7 @@ async function handleList(request) {
579
583
  }
580
584
  async function handleSearch(request) {
581
585
  const searchParams = request.nextUrl.searchParams;
582
- const query = _optionalChain([searchParams, 'access', _9 => _9.get, 'call', _10 => _10("q"), 'optionalAccess', _11 => _11.toLowerCase, 'call', _12 => _12()]) || "";
586
+ const query = _optionalChain([searchParams, 'access', _10 => _10.get, 'call', _11 => _11("q"), 'optionalAccess', _12 => _12.toLowerCase, 'call', _13 => _13()]) || "";
583
587
  if (query.length < 2) {
584
588
  return _server.NextResponse.json({ items: [] });
585
589
  }
@@ -587,7 +591,7 @@ async function handleSearch(request) {
587
591
  const meta = await loadMeta();
588
592
  const fileEntries = getFileEntries(meta);
589
593
  const cdnUrls = getCdnUrls(meta);
590
- const r2PublicUrl = _optionalChain([process, 'access', _13 => _13.env, 'access', _14 => _14.CLOUDFLARE_R2_PUBLIC_URL, 'optionalAccess', _15 => _15.replace, 'call', _16 => _16(/\/$/, "")]) || "";
594
+ const r2PublicUrl = _optionalChain([process, 'access', _14 => _14.env, 'access', _15 => _15.CLOUDFLARE_R2_PUBLIC_URL, 'optionalAccess', _16 => _16.replace, 'call', _17 => _17(/\/$/, "")]) || "";
591
595
  const items = [];
592
596
  for (const [key, entry] of fileEntries) {
593
597
  if (!key.toLowerCase().includes(query)) continue;
@@ -846,7 +850,7 @@ async function handleDelete(request) {
846
850
  const absolutePath = _path2.default.join(process.cwd(), itemPath);
847
851
  const imageKey = "/" + itemPath.replace(/^public\//, "");
848
852
  const entry = meta[imageKey];
849
- const isPushedToCloud = _optionalChain([entry, 'optionalAccess', _17 => _17.c]) !== void 0;
853
+ const isPushedToCloud = _optionalChain([entry, 'optionalAccess', _18 => _18.c]) !== void 0;
850
854
  try {
851
855
  const stats = await _fs.promises.stat(absolutePath);
852
856
  if (stats.isDirectory()) {
@@ -1038,7 +1042,7 @@ async function handleMoveStream(request) {
1038
1042
  await _fs.promises.mkdir(absoluteDestination, { recursive: true });
1039
1043
  const meta = await loadMeta();
1040
1044
  const cdnUrls = getCdnUrls(meta);
1041
- const r2PublicUrl = _optionalChain([process, 'access', _18 => _18.env, 'access', _19 => _19.CLOUDFLARE_R2_PUBLIC_URL, 'optionalAccess', _20 => _20.replace, 'call', _21 => _21(/\/$/, "")]) || "";
1045
+ const r2PublicUrl = _optionalChain([process, 'access', _19 => _19.env, 'access', _20 => _20.CLOUDFLARE_R2_PUBLIC_URL, 'optionalAccess', _21 => _21.replace, 'call', _22 => _22(/\/$/, "")]) || "";
1042
1046
  const moved = [];
1043
1047
  const errors = [];
1044
1048
  const total = paths.length;
@@ -1065,7 +1069,7 @@ async function handleMoveStream(request) {
1065
1069
  }
1066
1070
  const entry = meta[oldKey];
1067
1071
  const isImage = isImageFile(itemName);
1068
- const isInCloud = _optionalChain([entry, 'optionalAccess', _22 => _22.c]) !== void 0;
1072
+ const isInCloud = _optionalChain([entry, 'optionalAccess', _23 => _23.c]) !== void 0;
1069
1073
  const fileCdnUrl = isInCloud && entry.c !== void 0 ? cdnUrls[entry.c] : void 0;
1070
1074
  const isRemote = isInCloud && (!r2PublicUrl || fileCdnUrl !== r2PublicUrl);
1071
1075
  const isPushedToR2 = isInCloud && r2PublicUrl && fileCdnUrl === r2PublicUrl;
@@ -1077,8 +1081,8 @@ async function handleMoveStream(request) {
1077
1081
  await _fs.promises.mkdir(_path2.default.dirname(newAbsolutePath), { recursive: true });
1078
1082
  await _fs.promises.writeFile(newAbsolutePath, buffer);
1079
1083
  const newEntry = {
1080
- o: _optionalChain([entry, 'optionalAccess', _23 => _23.o]),
1081
- b: _optionalChain([entry, 'optionalAccess', _24 => _24.b])
1084
+ o: _optionalChain([entry, 'optionalAccess', _24 => _24.o]),
1085
+ b: _optionalChain([entry, 'optionalAccess', _25 => _25.b])
1082
1086
  };
1083
1087
  delete meta[oldKey];
1084
1088
  meta[newKey] = newEntry;
@@ -1088,8 +1092,8 @@ async function handleMoveStream(request) {
1088
1092
  await _fs.promises.mkdir(_path2.default.dirname(newAbsolutePath), { recursive: true });
1089
1093
  await _fs.promises.writeFile(newAbsolutePath, buffer);
1090
1094
  let newEntry = {
1091
- o: _optionalChain([entry, 'optionalAccess', _25 => _25.o]),
1092
- b: _optionalChain([entry, 'optionalAccess', _26 => _26.b])
1095
+ o: _optionalChain([entry, 'optionalAccess', _26 => _26.o]),
1096
+ b: _optionalChain([entry, 'optionalAccess', _27 => _27.b])
1093
1097
  };
1094
1098
  if (hasProcessedThumbnails) {
1095
1099
  const processedEntry = await processImage(buffer, newKey);
@@ -1107,7 +1111,7 @@ async function handleMoveStream(request) {
1107
1111
  if (hasProcessedThumbnails) {
1108
1112
  await deleteLocalThumbnails(newKey);
1109
1113
  }
1110
- newEntry.c = _optionalChain([entry, 'optionalAccess', _27 => _27.c]);
1114
+ newEntry.c = _optionalChain([entry, 'optionalAccess', _28 => _28.c]);
1111
1115
  delete meta[oldKey];
1112
1116
  meta[newKey] = newEntry;
1113
1117
  moved.push(itemPath);
@@ -1197,7 +1201,7 @@ async function handleSync(request) {
1197
1201
  const accessKeyId = process.env.CLOUDFLARE_R2_ACCESS_KEY_ID;
1198
1202
  const secretAccessKey = process.env.CLOUDFLARE_R2_SECRET_ACCESS_KEY;
1199
1203
  const bucketName = process.env.CLOUDFLARE_R2_BUCKET_NAME;
1200
- const publicUrl = _optionalChain([process, 'access', _28 => _28.env, 'access', _29 => _29.CLOUDFLARE_R2_PUBLIC_URL, 'optionalAccess', _30 => _30.replace, 'call', _31 => _31(/\/\s*$/, "")]);
1204
+ const publicUrl = _optionalChain([process, 'access', _29 => _29.env, 'access', _30 => _30.CLOUDFLARE_R2_PUBLIC_URL, 'optionalAccess', _31 => _31.replace, 'call', _32 => _32(/\/\s*$/, "")]);
1201
1205
  if (!accountId || !accessKeyId || !secretAccessKey || !bucketName || !publicUrl) {
1202
1206
  return _server.NextResponse.json(
1203
1207
  { error: "R2 not configured. Set CLOUDFLARE_R2_* environment variables." },
@@ -1313,7 +1317,7 @@ async function handleSync(request) {
1313
1317
  }
1314
1318
  }
1315
1319
  async function handleReprocess(request) {
1316
- const publicUrl = _optionalChain([process, 'access', _32 => _32.env, 'access', _33 => _33.CLOUDFLARE_R2_PUBLIC_URL, 'optionalAccess', _34 => _34.replace, 'call', _35 => _35(/\/\s*$/, "")]);
1320
+ const publicUrl = _optionalChain([process, 'access', _33 => _33.env, 'access', _34 => _34.CLOUDFLARE_R2_PUBLIC_URL, 'optionalAccess', _35 => _35.replace, 'call', _36 => _36(/\/\s*$/, "")]);
1317
1321
  try {
1318
1322
  const { imageKeys } = await request.json();
1319
1323
  if (!imageKeys || !Array.isArray(imageKeys) || imageKeys.length === 0) {
@@ -1331,7 +1335,7 @@ async function handleReprocess(request) {
1331
1335
  try {
1332
1336
  let buffer;
1333
1337
  const entry = getMetaEntry(meta, imageKey);
1334
- const existingCdnIndex = _optionalChain([entry, 'optionalAccess', _36 => _36.c]);
1338
+ const existingCdnIndex = _optionalChain([entry, 'optionalAccess', _37 => _37.c]);
1335
1339
  const existingCdnUrl = existingCdnIndex !== void 0 ? cdnUrls[existingCdnIndex] : void 0;
1336
1340
  const isInOurR2 = existingCdnUrl === publicUrl;
1337
1341
  const isRemote = existingCdnIndex !== void 0 && !isInOurR2;
@@ -1390,7 +1394,7 @@ async function handleReprocess(request) {
1390
1394
  }
1391
1395
  }
1392
1396
  async function handleProcessAllStream() {
1393
- const publicUrl = _optionalChain([process, 'access', _37 => _37.env, 'access', _38 => _38.CLOUDFLARE_R2_PUBLIC_URL, 'optionalAccess', _39 => _39.replace, 'call', _40 => _40(/\/\s*$/, "")]);
1397
+ const publicUrl = _optionalChain([process, 'access', _38 => _38.env, 'access', _39 => _39.CLOUDFLARE_R2_PUBLIC_URL, 'optionalAccess', _40 => _40.replace, 'call', _41 => _41(/\/\s*$/, "")]);
1394
1398
  const encoder = new TextEncoder();
1395
1399
  const stream = new ReadableStream({
1396
1400
  async start(controller) {