{"schemaVersion":1,"id":"recommended.sm-import-media","version":"1.0.0","name":"Import media workflow","description":"An editable production workflow using Import media v2.0.0.","stages":[{"id":"main","blockId":"sm.import-media","version":"2.0.0","label":"Import media"}],"connections":[],"packages":[{"manifest":{"schemaVersion":1,"sdkVersion":"0.1.0","id":"sm.import-media","version":"2.0.0","name":"Import media","description":"Upload or choose images, video and audio, arrange the selection, and return original media for the next Block.","kind":"task","runtime":"javascript","entry":"src/run.js","license":"MIT","provenance":{"notice":"Original source (authorship declared by the packager)\nLicense: MIT\nChanges: Original implementation declared by the packager; no reused repository or dependency code.\nFiles: LICENSE, src/run.js\n\nMIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and \nassociated documentation files (the \"Software\"), to deal in the Software without restriction, including \nwithout limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell \ncopies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the \nfollowing conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial \nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT \nLIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO \nEVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER \nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE \nUSE OR OTHER DEALINGS IN THE SOFTWARE.\n","portableSources":[{"kind":"original","license":"MIT","paths":["LICENSE","src/run.js"],"evidence":["upstream/0/LICENSE","upstream/0/src/run.js"],"changes":"Original implementation declared by the packager; no reused repository or dependency code."}]},"inputs":{"files":{"type":"asset[]","primary":true,"default":[],"description":"Upload or select original media, then arrange its order."},"include":{"type":"text","default":"All"},"duplicates":{"type":"text","default":"Keep all"}},"outputs":{"assets":{"type":"asset[]","primary":true}},"permissions":{"project":["asset.read"],"network":[],"filesystem":[],"secrets":[]},"ui":[{"port":"include","control":"select","options":["All","Images","Video","Audio"]},{"port":"duplicates","control":"select","options":["Keep all","Remove duplicates"]}]},"code":"function collect(input){\n if(input.files.length>64)throw Error('Import up to 64 files at a time.');\n const kind={All:null,Images:'image',Video:'video',Audio:'audio'}[input.include];\n if(kind===undefined)throw Error('Choose All, Images, Video or Audio.');\n if(!['Keep all','Remove duplicates'].includes(input.duplicates))throw Error('Choose a supported duplicate policy.');\n const seen=new Set(),assets=[];\n for(const file of input.files){\n  if(kind&&file.kind!==kind)continue;\n  const key=JSON.stringify([file.kind,file.assetId,file.versionId,file.url]);\n  if(input.duplicates==='Remove duplicates'&&seen.has(key))continue;\n  seen.add(key);assets.push({...file});\n }\n return {assets};\n}\nreturn collect(input);\n","tests":[{"name":"Keep original media metadata and order","input":{"files":[{"kind":"image","assetId":"image","versionId":"original","url":"https://example.com/image.png","name":"Image","width":1920,"height":1080},{"kind":"audio","assetId":"audio","versionId":"original","url":"https://example.com/audio.mp3","name":"Audio","duration":4},{"kind":"video","assetId":"video","versionId":"original","url":"https://example.com/video.mp4","duration":3}],"include":"All","duplicates":"Keep all"},"expected":{"assets":[{"kind":"image","assetId":"image","versionId":"original","url":"https://example.com/image.png","name":"Image","width":1920,"height":1080},{"kind":"audio","assetId":"audio","versionId":"original","url":"https://example.com/audio.mp3","name":"Audio","duration":4},{"kind":"video","assetId":"video","versionId":"original","url":"https://example.com/video.mp4","duration":3}]}},{"name":"Filter and remove exact duplicate selections","input":{"files":[{"kind":"video","assetId":"video","versionId":"original","url":"https://example.com/video.mp4","duration":3},{"kind":"image","assetId":"image","versionId":"original","url":"https://example.com/image.png","name":"Image","width":1920,"height":1080},{"kind":"audio","assetId":"audio","versionId":"original","url":"https://example.com/audio.mp3","name":"Audio","duration":4},{"kind":"image","assetId":"image","versionId":"original","url":"https://example.com/image.png","name":"Image","width":1920,"height":1080}],"include":"Images","duplicates":"Remove duplicates"},"expected":{"assets":[{"kind":"image","assetId":"image","versionId":"original","url":"https://example.com/image.png","name":"Image","width":1920,"height":1080}]}},{"name":"Keep intentional repeated audio","input":{"files":[{"kind":"audio","assetId":"audio","versionId":"original","url":"https://example.com/audio.mp3","name":"Audio","duration":4},{"kind":"audio","assetId":"audio","versionId":"original","url":"https://example.com/audio.mp3","name":"Audio","duration":4}],"include":"Audio","duplicates":"Keep all"},"expected":{"assets":[{"kind":"audio","assetId":"audio","versionId":"original","url":"https://example.com/audio.mp3","name":"Audio","duration":4},{"kind":"audio","assetId":"audio","versionId":"original","url":"https://example.com/audio.mp3","name":"Audio","duration":4}]}},{"name":"Empty selection","input":{"files":[],"include":"All","duplicates":"Keep all"},"expected":{"assets":[]}}],"portable":{"format":"stillmade-block/1","dependencies":[],"sources":[{"kind":"original","license":"MIT","paths":["LICENSE","src/run.js"],"evidence":["upstream/0/LICENSE","upstream/0/src/run.js"],"changes":"Original implementation declared by the packager; no reused repository or dependency code."}],"files":{"upstream/0/LICENSE":"MIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and \nassociated documentation files (the \"Software\"), to deal in the Software without restriction, including \nwithout limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell \ncopies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the \nfollowing conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial \nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT \nLIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO \nEVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER \nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE \nUSE OR OTHER DEALINGS IN THE SOFTWARE.\n","upstream/0/src/run.js":"function collect(input){\n if(input.files.length>64)throw Error('Import up to 64 files at a time.');\n const kind={All:null,Images:'image',Video:'video',Audio:'audio'}[input.include];\n if(kind===undefined)throw Error('Choose All, Images, Video or Audio.');\n if(!['Keep all','Remove duplicates'].includes(input.duplicates))throw Error('Choose a supported duplicate policy.');\n const seen=new Set(),assets=[];\n for(const file of input.files){\n  if(kind&&file.kind!==kind)continue;\n  const key=JSON.stringify([file.kind,file.assetId,file.versionId,file.url]);\n  if(input.duplicates==='Remove duplicates'&&seen.has(key))continue;\n  seen.add(key);assets.push({...file});\n }\n return {assets};\n}\nreturn collect(input);\n"},"lineage":{"parents":[],"changes":"Packaged original Block source for StillMade."}}}],"license":"MIT"}