@axiumine/koa-utils 5.6.0 → 5.6.1

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.
@@ -30,6 +30,7 @@ export async function uploadTemp(img) {
30
30
  }
31
31
  catch (e) {
32
32
  // error for file handling
33
+ console.error('Error storing image:', e);
33
34
  throw new Error('Error storing image');
34
35
  }
35
36
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"uploadTempImage.mjs","sourceRoot":"","sources":["../../src/files/uploadTempImage.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAErE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAyB;IACzD,IAAI,cAAc,GAAG,EAAE,CAAA;IAEvB,IAAI,CAAC;QACJ,qBAAqB;QACrB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAC3D,MAAM,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QACjD,MAAM,sBAAsB,CAAC,QAAQ,CAAC,CAAA;QACtC,SAAS;QACT,MAAM,SAAS,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAA;QAC9B,SAAS;QAET,cAAc,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAA;QAC/C,+BAA+B;QAC/B,+BAA+B;QAC/B,2BAA2B;QAC3B,cAAc;QACd,cAAc;QACd,cAAc;QACd,8CAA8C;QAC9C,iEAAiE;IAClE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,0BAA0B;QAC1B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACvC,CAAC;IAED,OAAO;QACN,GAAG,EAAE,MAAM;QACX,QAAQ,EAAE,cAAc;KACxB,CAAA;AACF,CAAC","sourcesContent":["import { IFileUpload } from '../koa/IFileUpload.mjs'\nimport { IUploadTemp } from './IUploadTemp.mjs'\nimport { reEncodeToWebp } from './reEncodeToWebp.mjs'\nimport { scanVirus } from './scanVirus.mjs'\nimport { storeUploadAsTemp } from './storeUploadAsTemp.mjs'\nimport { validateJpgPngExtension } from './validateJpgPngExtension.mjs'\nimport { validateJpgPngMimeType } from './validateMimeTypeImages.mjs'\n\n/**\n * Validate file extension, Mime Type, scan with ClamAV, re encode to webp, rename final file\n * @todo log uploaded file\n * @param img\n */\nexport async function uploadTemp(img: Promise<IFileUpload>): Promise<IUploadTemp> {\n\tlet storedTempFile = ''\n\n\ttry {\n\t\t// Step 1 - Readme.md\n\t\tconst { fileName, filePath } = await storeUploadAsTemp(img)\n\t\tawait validateJpgPngExtension(fileName, filePath)\n\t\tawait validateJpgPngMimeType(filePath)\n\t\t// step 2\n\t\tawait scanVirus(`${filePath}`)\n\t\t// step 3\n\n\t\tstoredTempFile = await reEncodeToWebp(filePath)\n\t\t// await checkForNSFW(filePath)\n\t\t// step 4 - safe file name (ok)\n\t\t// step 5 - rate limit (ok)\n\t\t// step 6 - ok\n\t\t// step 7 - ok\n\t\t// step8 - log\n\t\t// user's IP address, filename, and timestamp,\n\t\t// @todo await logUpload('team', uId, originalFilename, fileName)\n\t} catch (e) {\n\t\t// error for file handling\n\t\tthrow new Error('Error storing image')\n\t}\n\n\treturn {\n\t\text: 'webp',\n\t\ttempFile: storedTempFile\n\t}\n}\n"]}
1
+ {"version":3,"file":"uploadTempImage.mjs","sourceRoot":"","sources":["../../src/files/uploadTempImage.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAErE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAyB;IACzD,IAAI,cAAc,GAAG,EAAE,CAAA;IAEvB,IAAI,CAAC;QACJ,qBAAqB;QACrB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAC3D,MAAM,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QACjD,MAAM,sBAAsB,CAAC,QAAQ,CAAC,CAAA;QACtC,SAAS;QACT,MAAM,SAAS,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAA;QAC9B,SAAS;QAET,cAAc,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAA;QAC/C,+BAA+B;QAC/B,+BAA+B;QAC/B,2BAA2B;QAC3B,cAAc;QACd,cAAc;QACd,cAAc;QACd,8CAA8C;QAC9C,iEAAiE;IAClE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,0BAA0B;QAC1B,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAA;QACxC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACvC,CAAC;IAED,OAAO;QACN,GAAG,EAAE,MAAM;QACX,QAAQ,EAAE,cAAc;KACxB,CAAA;AACF,CAAC","sourcesContent":["import { IFileUpload } from '../koa/IFileUpload.mjs'\nimport { IUploadTemp } from './IUploadTemp.mjs'\nimport { reEncodeToWebp } from './reEncodeToWebp.mjs'\nimport { scanVirus } from './scanVirus.mjs'\nimport { storeUploadAsTemp } from './storeUploadAsTemp.mjs'\nimport { validateJpgPngExtension } from './validateJpgPngExtension.mjs'\nimport { validateJpgPngMimeType } from './validateMimeTypeImages.mjs'\n\n/**\n * Validate file extension, Mime Type, scan with ClamAV, re encode to webp, rename final file\n * @todo log uploaded file\n * @param img\n */\nexport async function uploadTemp(img: Promise<IFileUpload>): Promise<IUploadTemp> {\n\tlet storedTempFile = ''\n\n\ttry {\n\t\t// Step 1 - Readme.md\n\t\tconst { fileName, filePath } = await storeUploadAsTemp(img)\n\t\tawait validateJpgPngExtension(fileName, filePath)\n\t\tawait validateJpgPngMimeType(filePath)\n\t\t// step 2\n\t\tawait scanVirus(`${filePath}`)\n\t\t// step 3\n\n\t\tstoredTempFile = await reEncodeToWebp(filePath)\n\t\t// await checkForNSFW(filePath)\n\t\t// step 4 - safe file name (ok)\n\t\t// step 5 - rate limit (ok)\n\t\t// step 6 - ok\n\t\t// step 7 - ok\n\t\t// step8 - log\n\t\t// user's IP address, filename, and timestamp,\n\t\t// @todo await logUpload('team', uId, originalFilename, fileName)\n\t} catch (e) {\n\t\t// error for file handling\n\t\tconsole.error('Error storing image:', e)\n\t\tthrow new Error('Error storing image')\n\t}\n\n\treturn {\n\t\text: 'webp',\n\t\ttempFile: storedTempFile\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiumine/koa-utils",
3
- "version": "5.6.0",
3
+ "version": "5.6.1",
4
4
  "description": "Koa Utils",
5
5
  "type": "module",
6
6
  "repository": {