@gallop.software/studio 0.1.90 → 0.1.91

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.
@@ -24,4 +24,4 @@ export {
24
24
  getThumbnailPath,
25
25
  getAllThumbnailPaths
26
26
  };
27
- //# sourceMappingURL=chunk-ZGXOYJKZ.mjs.map
27
+ //# sourceMappingURL=chunk-63EAAMA3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * Meta entry - works for images and non-images\n * Images have w, h, b (after processing)\n * Non-images just have c (if pushed to CDN)\n */\nexport interface MetaEntry {\n w?: number // original width (images only)\n h?: number // original height (images only)\n b?: string // blurhash (images only, after processing)\n c?: 1 // pushed to CDN (omit if not pushed)\n}\n\n/**\n * Meta schema - keyed by path from public folder\n * Example: { \"/portfolio/photo.jpg\": { w: 2400, h: 1600, blur: \"...\" } }\n */\nexport type LeanMeta = Record<string, MetaEntry>\n\n// Legacy alias for compatibility\nexport type LeanImageEntry = MetaEntry\n\n/**\n * File/folder item for browser\n */\nexport interface FileItem {\n name: string\n path: string\n type: 'file' | 'folder'\n size?: number\n dimensions?: { width: number; height: number }\n cdnSynced?: boolean\n // Folder-specific properties\n fileCount?: number\n totalSize?: number\n // For showing thumbnails - path to -sm version if exists\n thumbnail?: string\n // Whether a processed thumbnail exists\n hasThumbnail?: boolean\n}\n\n/**\n * Studio configuration\n */\nexport interface StudioConfig {\n r2AccountId?: string\n r2AccessKeyId?: string\n r2SecretAccessKey?: string\n r2BucketName?: string\n r2PublicUrl?: string\n thumbnailSizes?: {\n small: number\n medium: number\n large: number\n }\n}\n\n/**\n * Get thumbnail path from original image path\n */\nexport function getThumbnailPath(originalPath: string, size: 'sm' | 'md' | 'lg' | 'full'): string {\n if (size === 'full') {\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}${outputExt}`\n }\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}-${size}${outputExt}`\n}\n\n/**\n * Get all thumbnail paths for an image\n */\nexport function getAllThumbnailPaths(originalPath: string): string[] {\n return [\n getThumbnailPath(originalPath, 'full'),\n getThumbnailPath(originalPath, 'lg'),\n getThumbnailPath(originalPath, 'md'),\n getThumbnailPath(originalPath, 'sm'),\n ]\n}\n"],"mappings":";AA2DO,SAAS,iBAAiB,cAAsB,MAA2C;AAChG,MAAI,SAAS,QAAQ;AACnB,UAAMA,OAAM,aAAa,MAAM,QAAQ,IAAI,CAAC,KAAK;AACjD,UAAMC,QAAO,aAAa,QAAQ,UAAU,EAAE;AAC9C,UAAMC,aAAYF,KAAI,YAAY,MAAM,SAAS,SAAS;AAC1D,WAAO,UAAUC,KAAI,GAAGC,UAAS;AAAA,EACnC;AACA,QAAM,MAAM,aAAa,MAAM,QAAQ,IAAI,CAAC,KAAK;AACjD,QAAM,OAAO,aAAa,QAAQ,UAAU,EAAE;AAC9C,QAAM,YAAY,IAAI,YAAY,MAAM,SAAS,SAAS;AAC1D,SAAO,UAAU,IAAI,IAAI,IAAI,GAAG,SAAS;AAC3C;AAKO,SAAS,qBAAqB,cAAgC;AACnE,SAAO;AAAA,IACL,iBAAiB,cAAc,MAAM;AAAA,IACrC,iBAAiB,cAAc,IAAI;AAAA,IACnC,iBAAiB,cAAc,IAAI;AAAA,IACnC,iBAAiB,cAAc,IAAI;AAAA,EACrC;AACF;","names":["ext","base","outputExt"]}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * Meta entry - works for images and non-images\n * Images have w, h, b (after processing)\n * Non-images just have c (if pushed to CDN)\n */\nexport interface MetaEntry {\n w?: number // original width (images only)\n h?: number // original height (images only)\n b?: string // blurhash (images only, after processing)\n c?: 1 // pushed to CDN (omit if not pushed)\n}\n\n/**\n * Meta schema - keyed by path from public folder\n * Example: { \"/portfolio/photo.jpg\": { w: 2400, h: 1600, blur: \"...\" } }\n */\nexport type LeanMeta = Record<string, MetaEntry>\n\n// Legacy alias for compatibility\nexport type LeanImageEntry = MetaEntry\n\n/**\n * File/folder item for browser\n */\nexport interface FileItem {\n name: string\n path: string\n type: 'file' | 'folder'\n size?: number\n dimensions?: { width: number; height: number }\n cdnPushed?: boolean\n // Folder-specific properties\n fileCount?: number\n totalSize?: number\n // For showing thumbnails - path to -sm version if exists\n thumbnail?: string\n // Whether a processed thumbnail exists\n hasThumbnail?: boolean\n}\n\n/**\n * Studio configuration\n */\nexport interface StudioConfig {\n r2AccountId?: string\n r2AccessKeyId?: string\n r2SecretAccessKey?: string\n r2BucketName?: string\n r2PublicUrl?: string\n thumbnailSizes?: {\n small: number\n medium: number\n large: number\n }\n}\n\n/**\n * Get thumbnail path from original image path\n */\nexport function getThumbnailPath(originalPath: string, size: 'sm' | 'md' | 'lg' | 'full'): string {\n if (size === 'full') {\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}${outputExt}`\n }\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}-${size}${outputExt}`\n}\n\n/**\n * Get all thumbnail paths for an image\n */\nexport function getAllThumbnailPaths(originalPath: string): string[] {\n return [\n getThumbnailPath(originalPath, 'full'),\n getThumbnailPath(originalPath, 'lg'),\n getThumbnailPath(originalPath, 'md'),\n getThumbnailPath(originalPath, 'sm'),\n ]\n}\n"],"mappings":";AA2DO,SAAS,iBAAiB,cAAsB,MAA2C;AAChG,MAAI,SAAS,QAAQ;AACnB,UAAMA,OAAM,aAAa,MAAM,QAAQ,IAAI,CAAC,KAAK;AACjD,UAAMC,QAAO,aAAa,QAAQ,UAAU,EAAE;AAC9C,UAAMC,aAAYF,KAAI,YAAY,MAAM,SAAS,SAAS;AAC1D,WAAO,UAAUC,KAAI,GAAGC,UAAS;AAAA,EACnC;AACA,QAAM,MAAM,aAAa,MAAM,QAAQ,IAAI,CAAC,KAAK;AACjD,QAAM,OAAO,aAAa,QAAQ,UAAU,EAAE;AAC9C,QAAM,YAAY,IAAI,YAAY,MAAM,SAAS,SAAS;AAC1D,SAAO,UAAU,IAAI,IAAI,IAAI,GAAG,SAAS;AAC3C;AAKO,SAAS,qBAAqB,cAAgC;AACnE,SAAO;AAAA,IACL,iBAAiB,cAAc,MAAM;AAAA,IACrC,iBAAiB,cAAc,IAAI;AAAA,IACnC,iBAAiB,cAAc,IAAI;AAAA,IACnC,iBAAiB,cAAc,IAAI;AAAA,EACrC;AACF;","names":["ext","base","outputExt"]}
@@ -24,4 +24,4 @@ function getAllThumbnailPaths(originalPath) {
24
24
 
25
25
 
26
26
  exports.getThumbnailPath = getThumbnailPath; exports.getAllThumbnailPaths = getAllThumbnailPaths;
27
- //# sourceMappingURL=chunk-JWAAU3NN.js.map
27
+ //# sourceMappingURL=chunk-RURSHIQJ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/chrisb/Sites/studio/dist/chunk-JWAAU3NN.js","../src/types.ts"],"names":["ext","base","outputExt"],"mappings":"AAAA;AC2DO,SAAS,gBAAA,CAAiB,YAAA,EAAsB,IAAA,EAA2C;AAChG,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ;AACnB,IAAA,MAAMA,KAAAA,kBAAM,YAAA,mBAAa,KAAA,mBAAM,QAAQ,CAAA,4BAAA,CAAI,CAAC,IAAA,GAAK,MAAA;AACjD,IAAA,MAAMC,MAAAA,EAAO,YAAA,CAAa,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAA;AAC9C,IAAA,MAAMC,WAAAA,EAAYF,IAAAA,CAAI,WAAA,CAAY,EAAA,IAAM,OAAA,EAAS,OAAA,EAAS,MAAA;AAC1D,IAAA,OAAO,CAAA,OAAA,EAAUC,KAAI,CAAA,EAAA;AACvB,EAAA;AACyB,EAAA;AACZ,EAAA;AACS,EAAA;AACG,EAAA;AAC3B;AAKgB;AACP,EAAA;AACY,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACnB,EAAA;AACF;AD7D2B;AACA;AACA;AACA;AACA","file":"/Users/chrisb/Sites/studio/dist/chunk-JWAAU3NN.js","sourcesContent":[null,"/**\n * Meta entry - works for images and non-images\n * Images have w, h, b (after processing)\n * Non-images just have c (if pushed to CDN)\n */\nexport interface MetaEntry {\n w?: number // original width (images only)\n h?: number // original height (images only)\n b?: string // blurhash (images only, after processing)\n c?: 1 // pushed to CDN (omit if not pushed)\n}\n\n/**\n * Meta schema - keyed by path from public folder\n * Example: { \"/portfolio/photo.jpg\": { w: 2400, h: 1600, blur: \"...\" } }\n */\nexport type LeanMeta = Record<string, MetaEntry>\n\n// Legacy alias for compatibility\nexport type LeanImageEntry = MetaEntry\n\n/**\n * File/folder item for browser\n */\nexport interface FileItem {\n name: string\n path: string\n type: 'file' | 'folder'\n size?: number\n dimensions?: { width: number; height: number }\n cdnSynced?: boolean\n // Folder-specific properties\n fileCount?: number\n totalSize?: number\n // For showing thumbnails - path to -sm version if exists\n thumbnail?: string\n // Whether a processed thumbnail exists\n hasThumbnail?: boolean\n}\n\n/**\n * Studio configuration\n */\nexport interface StudioConfig {\n r2AccountId?: string\n r2AccessKeyId?: string\n r2SecretAccessKey?: string\n r2BucketName?: string\n r2PublicUrl?: string\n thumbnailSizes?: {\n small: number\n medium: number\n large: number\n }\n}\n\n/**\n * Get thumbnail path from original image path\n */\nexport function getThumbnailPath(originalPath: string, size: 'sm' | 'md' | 'lg' | 'full'): string {\n if (size === 'full') {\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}${outputExt}`\n }\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}-${size}${outputExt}`\n}\n\n/**\n * Get all thumbnail paths for an image\n */\nexport function getAllThumbnailPaths(originalPath: string): string[] {\n return [\n getThumbnailPath(originalPath, 'full'),\n getThumbnailPath(originalPath, 'lg'),\n getThumbnailPath(originalPath, 'md'),\n getThumbnailPath(originalPath, 'sm'),\n ]\n}\n"]}
1
+ {"version":3,"sources":["/Users/chrisb/Sites/studio/dist/chunk-RURSHIQJ.js","../src/types.ts"],"names":["ext","base","outputExt"],"mappings":"AAAA;AC2DO,SAAS,gBAAA,CAAiB,YAAA,EAAsB,IAAA,EAA2C;AAChG,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ;AACnB,IAAA,MAAMA,KAAAA,kBAAM,YAAA,mBAAa,KAAA,mBAAM,QAAQ,CAAA,4BAAA,CAAI,CAAC,IAAA,GAAK,MAAA;AACjD,IAAA,MAAMC,MAAAA,EAAO,YAAA,CAAa,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAA;AAC9C,IAAA,MAAMC,WAAAA,EAAYF,IAAAA,CAAI,WAAA,CAAY,EAAA,IAAM,OAAA,EAAS,OAAA,EAAS,MAAA;AAC1D,IAAA,OAAO,CAAA,OAAA,EAAUC,KAAI,CAAA,EAAA;AACvB,EAAA;AACyB,EAAA;AACZ,EAAA;AACS,EAAA;AACG,EAAA;AAC3B;AAKgB;AACP,EAAA;AACY,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACnB,EAAA;AACF;AD7D2B;AACA;AACA;AACA;AACA","file":"/Users/chrisb/Sites/studio/dist/chunk-RURSHIQJ.js","sourcesContent":[null,"/**\n * Meta entry - works for images and non-images\n * Images have w, h, b (after processing)\n * Non-images just have c (if pushed to CDN)\n */\nexport interface MetaEntry {\n w?: number // original width (images only)\n h?: number // original height (images only)\n b?: string // blurhash (images only, after processing)\n c?: 1 // pushed to CDN (omit if not pushed)\n}\n\n/**\n * Meta schema - keyed by path from public folder\n * Example: { \"/portfolio/photo.jpg\": { w: 2400, h: 1600, blur: \"...\" } }\n */\nexport type LeanMeta = Record<string, MetaEntry>\n\n// Legacy alias for compatibility\nexport type LeanImageEntry = MetaEntry\n\n/**\n * File/folder item for browser\n */\nexport interface FileItem {\n name: string\n path: string\n type: 'file' | 'folder'\n size?: number\n dimensions?: { width: number; height: number }\n cdnPushed?: boolean\n // Folder-specific properties\n fileCount?: number\n totalSize?: number\n // For showing thumbnails - path to -sm version if exists\n thumbnail?: string\n // Whether a processed thumbnail exists\n hasThumbnail?: boolean\n}\n\n/**\n * Studio configuration\n */\nexport interface StudioConfig {\n r2AccountId?: string\n r2AccessKeyId?: string\n r2SecretAccessKey?: string\n r2BucketName?: string\n r2PublicUrl?: string\n thumbnailSizes?: {\n small: number\n medium: number\n large: number\n }\n}\n\n/**\n * Get thumbnail path from original image path\n */\nexport function getThumbnailPath(originalPath: string, size: 'sm' | 'md' | 'lg' | 'full'): string {\n if (size === 'full') {\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}${outputExt}`\n }\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}-${size}${outputExt}`\n}\n\n/**\n * Get all thumbnail paths for an image\n */\nexport function getAllThumbnailPaths(originalPath: string): string[] {\n return [\n getThumbnailPath(originalPath, 'full'),\n getThumbnailPath(originalPath, 'lg'),\n getThumbnailPath(originalPath, 'md'),\n getThumbnailPath(originalPath, 'sm'),\n ]\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { F as FileItem } from '../types-DzM_J-55.mjs';
1
+ import { F as FileItem } from '../types-DuX-sfUL.mjs';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { F as FileItem } from '../types-DzM_J-55.js';
1
+ import { F as FileItem } from '../types-DuX-sfUL.js';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkJWAAU3NNjs = require('../chunk-JWAAU3NN.js');
4
+ var _chunkRURSHIQJjs = require('../chunk-RURSHIQJ.js');
5
5
 
6
6
  // src/handlers/index.ts
7
7
  var _server = require('next/server');
@@ -156,7 +156,7 @@ async function uploadToCdn(imageKey) {
156
156
  const bucketName = process.env.CLOUDFLARE_R2_BUCKET_NAME;
157
157
  if (!bucketName) throw new Error("R2 bucket not configured");
158
158
  const r2 = getR2Client();
159
- for (const thumbPath of _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, imageKey)) {
159
+ for (const thumbPath of _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, imageKey)) {
160
160
  const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
161
161
  try {
162
162
  const fileBuffer = await _fs.promises.readFile(localPath);
@@ -173,7 +173,7 @@ async function uploadToCdn(imageKey) {
173
173
  }
174
174
  }
175
175
  async function deleteLocalThumbnails(imageKey) {
176
- for (const thumbPath of _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, imageKey)) {
176
+ for (const thumbPath of _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, imageKey)) {
177
177
  const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
178
178
  try {
179
179
  await _fs.promises.unlink(localPath);
@@ -222,13 +222,13 @@ async function handleList(request) {
222
222
  } else {
223
223
  const fileName = remaining;
224
224
  const isImage = isImageFile(fileName);
225
- const isSynced = entry.c === 1;
225
+ const isPushedToCloud = entry.c === 1;
226
226
  let thumbnail;
227
227
  let hasThumbnail = false;
228
228
  let fileSize;
229
229
  if (isImage && (entry.w || entry.b)) {
230
- const thumbPath = _chunkJWAAU3NNjs.getThumbnailPath.call(void 0, key, "sm");
231
- if (isSynced) {
230
+ const thumbPath = _chunkRURSHIQJjs.getThumbnailPath.call(void 0, key, "sm");
231
+ if (isPushedToCloud) {
232
232
  const cdnUrl = process.env.CLOUDFLARE_R2_PUBLIC_URL || process.env.NEXT_PUBLIC_CLOUDFLARE_R2_PUBLIC_URL;
233
233
  if (cdnUrl) {
234
234
  thumbnail = `${cdnUrl}${thumbPath}`;
@@ -249,7 +249,7 @@ async function handleList(request) {
249
249
  thumbnail = key;
250
250
  hasThumbnail = false;
251
251
  }
252
- if (!isSynced) {
252
+ if (!isPushedToCloud) {
253
253
  try {
254
254
  const filePath = _path2.default.join(process.cwd(), "public", key);
255
255
  const stats = await _fs.promises.stat(filePath);
@@ -264,7 +264,7 @@ async function handleList(request) {
264
264
  size: fileSize,
265
265
  thumbnail,
266
266
  hasThumbnail,
267
- cdnSynced: isSynced,
267
+ cdnPushed: isPushedToCloud,
268
268
  dimensions: entry.w && entry.h ? { width: entry.w, height: entry.h } : void 0
269
269
  });
270
270
  }
@@ -289,12 +289,12 @@ async function handleSearch(request) {
289
289
  const fileName = _path2.default.basename(key);
290
290
  const relativePath = key.slice(1);
291
291
  const isImage = isImageFile(fileName);
292
- const isSynced = entry.c === 1;
292
+ const isPushedToCloud = entry.c === 1;
293
293
  let thumbnail;
294
294
  let hasThumbnail = false;
295
295
  if (isImage && (entry.w || entry.b)) {
296
- const thumbPath = _chunkJWAAU3NNjs.getThumbnailPath.call(void 0, key, "sm");
297
- if (isSynced) {
296
+ const thumbPath = _chunkRURSHIQJjs.getThumbnailPath.call(void 0, key, "sm");
297
+ if (isPushedToCloud) {
298
298
  const cdnUrl = process.env.CLOUDFLARE_R2_PUBLIC_URL || process.env.NEXT_PUBLIC_CLOUDFLARE_R2_PUBLIC_URL;
299
299
  if (cdnUrl) {
300
300
  thumbnail = `${cdnUrl}${thumbPath}`;
@@ -321,7 +321,7 @@ async function handleSearch(request) {
321
321
  type: "file",
322
322
  thumbnail,
323
323
  hasThumbnail,
324
- cdnSynced: isSynced,
324
+ cdnPushed: isPushedToCloud,
325
325
  dimensions: entry.w && entry.h ? { width: entry.w, height: entry.h } : void 0
326
326
  });
327
327
  }
@@ -513,7 +513,7 @@ async function handleDelete(request) {
513
513
  const absolutePath = _path2.default.join(process.cwd(), itemPath);
514
514
  const imageKey = "/" + itemPath.replace(/^public\//, "");
515
515
  const entry = meta[imageKey];
516
- const isSynced = _optionalChain([entry, 'optionalAccess', _5 => _5.c]) === 1;
516
+ const isPushedToCloud = _optionalChain([entry, 'optionalAccess', _5 => _5.c]) === 1;
517
517
  try {
518
518
  const stats = await _fs.promises.stat(absolutePath);
519
519
  if (stats.isDirectory()) {
@@ -522,7 +522,7 @@ async function handleDelete(request) {
522
522
  for (const key of Object.keys(meta)) {
523
523
  if (key.startsWith(prefix) || key === imageKey) {
524
524
  if (!meta[key].c) {
525
- for (const thumbPath of _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, key)) {
525
+ for (const thumbPath of _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, key)) {
526
526
  const absoluteThumbPath = _path2.default.join(process.cwd(), "public", thumbPath);
527
527
  try {
528
528
  await _fs.promises.unlink(absoluteThumbPath);
@@ -537,8 +537,8 @@ async function handleDelete(request) {
537
537
  await _fs.promises.unlink(absolutePath);
538
538
  const isInImagesFolder = itemPath.startsWith("public/images/");
539
539
  if (!isInImagesFolder && entry) {
540
- if (!isSynced) {
541
- for (const thumbPath of _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, imageKey)) {
540
+ if (!isPushedToCloud) {
541
+ for (const thumbPath of _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, imageKey)) {
542
542
  const absoluteThumbPath = _path2.default.join(process.cwd(), "public", thumbPath);
543
543
  try {
544
544
  await _fs.promises.unlink(absoluteThumbPath);
@@ -650,8 +650,8 @@ async function handleRename(request) {
650
650
  const newKey = "/" + newRelativePath;
651
651
  if (meta[oldKey]) {
652
652
  const entry = meta[oldKey];
653
- const oldThumbPaths = _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, oldKey);
654
- const newThumbPaths = _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, newKey);
653
+ const oldThumbPaths = _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, oldKey);
654
+ const newThumbPaths = _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, newKey);
655
655
  for (let i = 0; i < oldThumbPaths.length; i++) {
656
656
  const oldThumbPath = _path2.default.join(process.cwd(), "public", oldThumbPaths[i]);
657
657
  const newThumbPath = _path2.default.join(process.cwd(), "public", newThumbPaths[i]);
@@ -730,8 +730,8 @@ async function handleMove(request) {
730
730
  const newKey = "/" + newRelativePath;
731
731
  if (meta[oldKey]) {
732
732
  const entry = meta[oldKey];
733
- const oldThumbPaths = _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, oldKey);
734
- const newThumbPaths = _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, newKey);
733
+ const oldThumbPaths = _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, oldKey);
734
+ const newThumbPaths = _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, newKey);
735
735
  for (let i = 0; i < oldThumbPaths.length; i++) {
736
736
  const oldThumbPath = _path2.default.join(process.cwd(), "public", oldThumbPaths[i]);
737
737
  const newThumbPath = _path2.default.join(process.cwd(), "public", newThumbPaths[i]);
@@ -793,7 +793,7 @@ async function handleSync(request) {
793
793
  endpoint: `https://${accountId}.r2.cloudflarestorage.com`,
794
794
  credentials: { accessKeyId, secretAccessKey }
795
795
  });
796
- const synced = [];
796
+ const pushed = [];
797
797
  const errors = [];
798
798
  for (const imageKey of imageKeys) {
799
799
  const entry = meta[imageKey];
@@ -802,7 +802,7 @@ async function handleSync(request) {
802
802
  continue;
803
803
  }
804
804
  if (entry.c) {
805
- synced.push(imageKey);
805
+ pushed.push(imageKey);
806
806
  continue;
807
807
  }
808
808
  try {
@@ -821,7 +821,7 @@ async function handleSync(request) {
821
821
  errors.push(`Original file not found: ${imageKey}`);
822
822
  continue;
823
823
  }
824
- for (const thumbPath of _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, imageKey)) {
824
+ for (const thumbPath of _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, imageKey)) {
825
825
  const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
826
826
  try {
827
827
  const fileBuffer = await _fs.promises.readFile(localPath);
@@ -837,7 +837,7 @@ async function handleSync(request) {
837
837
  }
838
838
  }
839
839
  entry.c = 1;
840
- for (const thumbPath of _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, imageKey)) {
840
+ for (const thumbPath of _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, imageKey)) {
841
841
  const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
842
842
  try {
843
843
  await _fs.promises.unlink(localPath);
@@ -848,16 +848,16 @@ async function handleSync(request) {
848
848
  await _fs.promises.unlink(originalLocalPath);
849
849
  } catch (e22) {
850
850
  }
851
- synced.push(imageKey);
851
+ pushed.push(imageKey);
852
852
  } catch (error) {
853
- console.error(`Failed to sync ${imageKey}:`, error);
854
- errors.push(`Failed to sync: ${imageKey}`);
853
+ console.error(`Failed to push ${imageKey}:`, error);
854
+ errors.push(`Failed to push: ${imageKey}`);
855
855
  }
856
856
  }
857
857
  await saveMeta(meta);
858
858
  return _server.NextResponse.json({
859
859
  success: true,
860
- synced,
860
+ pushed,
861
861
  errors: errors.length > 0 ? errors : void 0
862
862
  });
863
863
  } catch (error) {
@@ -878,12 +878,12 @@ async function handleReprocess(request) {
878
878
  try {
879
879
  let buffer;
880
880
  const entry = meta[imageKey];
881
- const isSynced = _optionalChain([entry, 'optionalAccess', _6 => _6.c]) === 1;
881
+ const isPushedToCloud = _optionalChain([entry, 'optionalAccess', _6 => _6.c]) === 1;
882
882
  const originalPath = _path2.default.join(process.cwd(), "public", imageKey);
883
883
  try {
884
884
  buffer = await _fs.promises.readFile(originalPath);
885
885
  } catch (e23) {
886
- if (isSynced) {
886
+ if (isPushedToCloud) {
887
887
  buffer = await downloadFromCdn(imageKey);
888
888
  const dir = _path2.default.dirname(originalPath);
889
889
  await _fs.promises.mkdir(dir, { recursive: true });
@@ -893,7 +893,7 @@ async function handleReprocess(request) {
893
893
  }
894
894
  }
895
895
  const updatedEntry = await processImage(buffer, imageKey);
896
- if (isSynced) {
896
+ if (isPushedToCloud) {
897
897
  updatedEntry.c = 1;
898
898
  await uploadToCdn(imageKey);
899
899
  await deleteLocalThumbnails(imageKey);
@@ -934,13 +934,20 @@ async function handleProcessAllStream() {
934
934
  const processed = [];
935
935
  const errors = [];
936
936
  const orphansRemoved = [];
937
+ let alreadyProcessed = 0;
938
+ let pushedToCloud = 0;
937
939
  const imagesToProcess = [];
938
940
  for (const [key, entry] of Object.entries(meta)) {
939
- if (entry.c) continue;
940
941
  const fileName = _path2.default.basename(key);
941
942
  if (!isImageFile(fileName)) continue;
943
+ if (entry.c) {
944
+ pushedToCloud++;
945
+ continue;
946
+ }
942
947
  if (!entry.b) {
943
948
  imagesToProcess.push({ key, entry });
949
+ } else {
950
+ alreadyProcessed++;
944
951
  }
945
952
  }
946
953
  const total = imagesToProcess.length;
@@ -986,7 +993,7 @@ async function handleProcessAllStream() {
986
993
  const trackedPaths = /* @__PURE__ */ new Set();
987
994
  for (const imageKey of Object.keys(meta)) {
988
995
  if (!meta[imageKey].c) {
989
- for (const thumbPath of _chunkJWAAU3NNjs.getAllThumbnailPaths.call(void 0, imageKey)) {
996
+ for (const thumbPath of _chunkRURSHIQJjs.getAllThumbnailPaths.call(void 0, imageKey)) {
990
997
  trackedPaths.add(thumbPath);
991
998
  }
992
999
  }
@@ -1048,6 +1055,8 @@ async function handleProcessAllStream() {
1048
1055
  sendEvent({
1049
1056
  type: "complete",
1050
1057
  processed: processed.length,
1058
+ alreadyProcessed,
1059
+ pushedToCloud,
1051
1060
  orphansRemoved: orphansRemoved.length,
1052
1061
  errors: errors.length
1053
1062
  });