@zodic/shared 0.0.347 → 0.0.349

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 (2) hide show
  1. package/app/api/index.ts +6 -20
  2. package/package.json +1 -1
package/app/api/index.ts CHANGED
@@ -839,14 +839,9 @@ export const Api = (env: BackendBindings) => ({
839
839
  }
840
840
  };
841
841
 
842
- const getKey = (filePath: string) => {
843
- const fileNameParts = filePath.split('.');
844
- const extension = fileNameParts.pop();
845
- const fileNameWithoutExtension = fileNameParts.join('.');
846
-
847
- const newFileName = `${fileNameWithoutExtension}-${v4()}.${extension}`;
848
- const key = `${newFileName.replace(/ /g, '_')}`;
849
-
842
+ const getKey = (label: string) => {
843
+ const timestamp = Date.now();
844
+ const key = `${label.toLowerCase().replace(/ /g, '_')}_${timestamp}.jpg`;
850
845
  return key;
851
846
  };
852
847
 
@@ -857,17 +852,8 @@ export const Api = (env: BackendBindings) => ({
857
852
  ): Promise<string> => {
858
853
  const key = getKey(label);
859
854
  await env.PHOTOS_BUCKET.put(key, imageData);
860
- const imageUrl = `https://pub-c4bb4b3e4ccd46b59eed7fa434c59b60.r2.dev/${key}`;
855
+ const imageUrl = `https://pub-bbc0cdb569734925ab1c39512bc4765d.r2.dev/${key}`;
861
856
  return imageUrl;
862
- // Replace this with your actual storage service implementation (e.g., Cloudflare R2, AWS S3)
863
- // Example for Cloudflare R2:
864
- // const r2Response = await env.R2_BUCKET.put(fileName, imageData, {
865
- // httpMetadata: { contentType: 'image/jpeg' },
866
- // });
867
- // return `https://your-r2-bucket-url/${fileName}`;
868
-
869
- // For now, we'll throw an error if this isn't implemented
870
- throw new Error(`Storage service not implemented for ${label}`);
871
857
  };
872
858
 
873
859
  try {
@@ -888,11 +874,11 @@ export const Api = (env: BackendBindings) => ({
888
874
  // Upload resized images to storage to get public URLs
889
875
  const resizedSourceUrl = await uploadImageToStorage(
890
876
  resizedSourceData,
891
- 'Source image'
877
+ 'user_photo'
892
878
  );
893
879
  const resizedTargetUrl = await uploadImageToStorage(
894
880
  resizedTargetData,
895
- 'Target image'
881
+ 'generated_image'
896
882
  );
897
883
 
898
884
  const body = JSON.stringify({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.347",
3
+ "version": "0.0.349",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {