@joystick.js/node-canary 0.0.0-canary.463 → 0.0.0-canary.465
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.
- package/dist/app/uploaders/run_upload.js +1 -1
- package/dist/lib/dynamic_import.js +1 -1
- package/dist/lib/get_joystick_build_path.js +1 -1
- package/package.json +1 -1
- package/src/app/api/validate_input.js +0 -2
- package/src/app/uploaders/run_upload.js +1 -1
- package/src/lib/dynamic_import.js +0 -1
- package/src/lib/get_joystick_build_path.js +0 -1
- package/dist/lib/replace_file_protocol.js +0 -1
- package/src/lib/replace_file_protocol.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"fs";import l from"path";import{S3Client as _}from"@aws-sdk/client-s3";import{Upload as f}from"@aws-sdk/lib-storage";import y from"../websockets/emit_event.js";import p from"../../lib/float_to_decimal_place.js";import g from"../../lib/path_exists.js";const{mkdir:h,writeFile:d}=c.promises,w=async(e={},t={},a={})=>new Promise(async(n,r)=>{try{const i=new f({client:new _({region:e?.s3?.region,credentials:{accessKeyId:e?.s3?.accessKeyId||e?.s3?.access_key_id,secretAccessKey:e?.s3?.secretAccessKey||e?.s3?.secret_access_key}}),params:{Bucket:e?.s3?.bucket,Key:e.file_name,Body:e.content,ContentType:e.mime_type},queueSize:4,partSize:5242880});let s=0;i.on("httpUploadProgress",m=>{a("s3",m?.loaded-s),s=m?.loaded});const o=await i.done();return n({id:t?.req?.headers["x-joystick-upload-id"],provider:"s3",url:o?.Location,size:e?.fileSize,file_name:e?.file_name,fileName:e?.file_name,original_file_name:e?.original_file_name,originalFileName:e?.original_file_name,mime_type:e?.mime_type,mimeType:e?.mime_type})}catch(i){r(i?.message||"There was an error uploading your file to Amazon S3. Check the server logs for more information.")}}),k=async(e={},t={})=>{if(e?.local?.path)return new Promise(async(a,n)=>{try{await g(e?.local?.path)||await h(e?.local?.path,{recursive:!0});const r=l.dirname(`${e?.local?.path}/${e?.file_name}`);c.existsSync(r)||c.mkdirSync(r,{recursive:!0});const i=`${e?.local?.path}/${e?.file_name}
|
|
1
|
+
import c from"fs";import l from"path";import{S3Client as _}from"@aws-sdk/client-s3";import{Upload as f}from"@aws-sdk/lib-storage";import y from"../websockets/emit_event.js";import p from"../../lib/float_to_decimal_place.js";import g from"../../lib/path_exists.js";const{mkdir:h,writeFile:d}=c.promises,w=async(e={},t={},a={})=>new Promise(async(n,r)=>{try{const i=new f({client:new _({region:e?.s3?.region,credentials:{accessKeyId:e?.s3?.accessKeyId||e?.s3?.access_key_id,secretAccessKey:e?.s3?.secretAccessKey||e?.s3?.secret_access_key}}),params:{Bucket:e?.s3?.bucket,Key:e.file_name,Body:e.content,ContentType:e.mime_type},queueSize:4,partSize:5242880});let s=0;i.on("httpUploadProgress",m=>{a("s3",m?.loaded-s),s=m?.loaded});const o=await i.done();return n({id:t?.req?.headers["x-joystick-upload-id"],provider:"s3",url:o?.Location,size:e?.fileSize,file_name:e?.file_name,fileName:e?.file_name,original_file_name:e?.original_file_name,originalFileName:e?.original_file_name,mime_type:e?.mime_type,mimeType:e?.mime_type})}catch(i){r(i?.message||"There was an error uploading your file to Amazon S3. Check the server logs for more information.")}}),k=async(e={},t={})=>{if(e?.local?.path)return new Promise(async(a,n)=>{try{await g(e?.local?.path)||await h(e?.local?.path,{recursive:!0});const r=l.dirname(`${e?.local?.path}/${e?.file_name}`);c.existsSync(r)||c.mkdirSync(r,{recursive:!0});const i=`${e?.local?.path}/${e?.file_name}`||`_uploads/${e?.file_name}`;await d(i,e.content),a({id:t?.req?.headers["x-joystick-upload-id"],provider:"local",url:i,size:e?.file_size,file_name:e?.file_name,fileName:e?.file_name,original_file_name:e?.original_file_name,originalFileName:e?.original_file_name,mime_type:e?.mime_type,mimeType:e?.mime_type})}catch(r){n(r)}})},v=async(e={})=>{const t=[];let a=e?.existing_upload_progress;const n=(r="",i=0)=>{const s=a+i,o=p(s/e?.total_upload_size_all_providers*100);y(`uploaders_${e?.req?.headers["x-joystick-upload-id"]}`,"progress",{provider:r,progress:o}),a+=i};for(let r=0;r<e?.uploads?.length;r+=1){const i=e?.uploads[r];if(i?.providers?.includes("local")){const s=await k(i,e);t.push(s)}if(i?.providers?.includes("s3")){const s=await w(i,e,n);t.push(s)}}return t};var T=v;export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./get_platform_safe_path.js";const e=async(
|
|
1
|
+
import"./get_platform_safe_path.js";const e=async(t="")=>(await(process.platform==="win32"?import(`file://${t}`):import(t)))?.default;var f=e;export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"fs";const n=()=>["development","test"].includes(process.env.NODE_ENV)||e.existsSync(".joystick/build")?".joystick/build/":"",o=()=>{const t=n();return`${process.cwd().replace(t,"")}/${t}`};var s=o;export{s as default};
|
package/package.json
CHANGED
|
@@ -101,8 +101,6 @@ const add_to_validation_queue = (
|
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
const validate_input = async (input = {}, schema = {}, parent_path = '') => {
|
|
104
|
-
// console.log(input);
|
|
105
|
-
|
|
106
104
|
const validation_errors = [];
|
|
107
105
|
const queue = add_to_validation_queue([], schema, input, parent_path);
|
|
108
106
|
|
|
@@ -70,7 +70,7 @@ const upload_to_local = async (upload = {}, upload_options = {}) => {
|
|
|
70
70
|
fs.mkdirSync(directory_path, { recursive: true });
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
const file_path = `${upload?.local?.path}/${upload?.file_name}` ||
|
|
73
|
+
const file_path = `${upload?.local?.path}/${upload?.file_name}` || `_uploads/${upload?.file_name}`;
|
|
74
74
|
|
|
75
75
|
await writeFile(file_path, upload.content);
|
|
76
76
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import get_platform_safe_path from "./get_platform_safe_path.js";
|
|
2
2
|
|
|
3
3
|
const dynamic_import = async (path = '') => {
|
|
4
|
-
console.log(process.platform === 'win32' ? `file://${path}` : path);
|
|
5
4
|
const file = await import(process.platform === 'win32' ? `file://${path}` : path);
|
|
6
5
|
return file?.default;
|
|
7
6
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import r from"os";const e=(o="")=>r.platform()==="win32"?o.replace(/[a-zA-Z]:/gi,""):o;var t=e;export{t as default};
|