@fugood/bricks-cli 2.26.0-beta.21 → 2.26.0-beta.23

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/lib/6818.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=6818;export const __rspack_esm_ids=[6818];export const __webpack_modules__={53241(e,t,r){r.r(t),r.d(t,{detectChannel:()=>i,detectInstallMethod:()=>o});var a=r(73024),n=r(76760),s=r(48161),l=e=>{if(!e)return e;try{return a.realpathSync(e)}catch{return e}},i=({version:e,execPath:t}={})=>{var r=t||process.execPath;return r&&/[\\/]bricks-beta(?:\.exe)?$/i.test(r)||/-(beta|alpha|rc|next)\b/i.test(e||"2.26.0-beta.21")?"beta":"release"},o=({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:r=s.homedir(),realpath:a=l}={})=>{let i;var o=(i=e)?n.basename(i).replace(/\.exe$/i,""):"";if("bricks"===o||"bricks-beta"===o)return{method:"binary",execPath:e,installDir:n.dirname(e)};var c=a(t),p=((e,t)=>{if(!e)return null;var r=n.sep,a=`${r}node_modules${r}${t.replace(/\//g,r)}${r}`,s=e.indexOf(a);return -1===s?null:e.slice(0,s)})(c,"@fugood/bricks-cli");if(p){var b=n.sep,d=n.join(r,".bun","install","global");return p===d||p.startsWith(d+b)?{method:"bun",installRoot:p}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(p)?{method:"pnpm",installRoot:p}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(p)?{method:"yarn",installRoot:p}:{method:"npm",installRoot:p.endsWith(`${b}lib`)?p.slice(0,-`${b}lib`.length):p}}return{method:"unknown",execPath:e,scriptPath:c}}}};
1
+ export const __rspack_esm_id=6818;export const __rspack_esm_ids=[6818];export const __webpack_modules__={53241(e,t,r){r.r(t),r.d(t,{detectChannel:()=>i,detectInstallMethod:()=>o});var a=r(73024),n=r(76760),s=r(48161),l=e=>{if(!e)return e;try{return a.realpathSync(e)}catch{return e}},i=({version:e,execPath:t}={})=>{var r=t||process.execPath;return r&&/[\\/]bricks-beta(?:\.exe)?$/i.test(r)||/-(beta|alpha|rc|next)\b/i.test(e||"2.26.0-beta.23")?"beta":"release"},o=({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:r=s.homedir(),realpath:a=l}={})=>{let i;var o=(i=e)?n.basename(i).replace(/\.exe$/i,""):"";if("bricks"===o||"bricks-beta"===o)return{method:"binary",execPath:e,installDir:n.dirname(e)};var c=a(t),p=((e,t)=>{if(!e)return null;var r=n.sep,a=`${r}node_modules${r}${t.replace(/\//g,r)}${r}`,s=e.indexOf(a);return -1===s?null:e.slice(0,s)})(c,"@fugood/bricks-cli");if(p){var b=n.sep,d=n.join(r,".bun","install","global");return p===d||p.startsWith(d+b)?{method:"bun",installRoot:p}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(p)?{method:"pnpm",installRoot:p}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(p)?{method:"yarn",installRoot:p}:{method:"npm",installRoot:p.endsWith(`${b}lib`)?p.slice(0,-`${b}lib`.length):p}}return{method:"unknown",execPath:e,scriptPath:c}}}};
package/lib/7294.js CHANGED
@@ -16,4 +16,4 @@ import*as e from"ink";import*as r from"react";import*as t from"react/jsx-runtime
16
16
  timestamp
17
17
  }
18
18
  }
19
- `,B=["authorization"];function C(e){var r,t,n,l=2;for("u">typeof Symbol&&(t=Symbol.asyncIterator,n=Symbol.iterator);l--;){if(t&&null!=(r=e[t]))return r.call(e);if(n&&null!=(r=e[n]))return new k(r.call(e));t="@@asyncIterator",n="@@iterator"}throw TypeError("Object is not async iterable")}function k(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(k=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new k(e)}var w=d(function e(r,t){var n;u(this,e),this.baseUrl=r,this.auth="string"==typeof t?{kind:"token",token:t,getHeaders:(n=c(function*(){return{authorization:`Bearer ${t}`}}),function(){return n.apply(this,arguments)})}:t,this.token=this.auth?.token,this.graphqlUrl=`${r}/api/graphql`,this.fetch=function(e){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!e.startsWith("https://"))return m.Ay;var t=new p(r);return(e,r={})=>(0,m.Ay)(e,{...r,agent:t})}(r)},[{key:"authHeaders",value:(n=c(function*(){var e=yield this.auth.getHeaders();return{Authorization:e.authorization,...s(e,B)}}),function(){return n.apply(this,arguments)})},{key:"authenticatedFetch",value:(l=c(function*(e,r={}){var t,n=this,l=(t=c(function*(){return n.fetch(e,{...r,headers:{...r.headers,...yield n.authHeaders()}})}),function(){return t.apply(this,arguments)}),i=yield l();return 401!==i.status||"function"!=typeof this.auth.refresh?i:(i.body?.destroy?.(),yield this.auth.refresh(),l())}),function(e){return l.apply(this,arguments)})},{key:"streamQuery",value:function(e,r){var t=this;return x(function*(e,r,{signal:n}={}){var l=yield h(t.authenticatedFetch(t.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:'multipart/mixed; boundary="-", application/json'},body:JSON.stringify({query:e,variables:r}),signal:n}));if(!l.ok){var i=yield h(l.text().catch(()=>""));throw Error(`Activity-log query failed (${l.status}): ${i}`)}yield*f(C(function(e){return j.apply(this,arguments)}(l)),h)}).apply(this,arguments)}},{key:"events",value:function(e,r){var t=this;return x(function*(){yield*f(C(t.streamQuery(I,{filter:e},r)),h)})()}},{key:"screenshots",value:function(e,r){var t=this;return x(function*(){yield*f(C(t.streamQuery(A,{filter:e},r)),h)})()}},{key:"collectEvents",value:(i=c(function*(e,{limit:r,signal:t}={}){var n=[],l=!1,i=!1;try{for(var o,a,s=C(this.events(e,{signal:t}));l=!(a=yield s.next()).done;l=!1){var c=a.value;if(n.push(c),r&&n.length>=r)break}}catch(e){i=!0,o=e}finally{try{l&&null!=s.return&&(yield s.return())}finally{if(i)throw o}}return n}),function(e){return i.apply(this,arguments)})},{key:"collectScreenshots",value:(o=c(function*(e,{signal:r}={}){var t=[],n=!1,l=!1;try{for(var i,o,a=C(this.screenshots(e,{signal:r}));n=!(o=yield a.next()).done;n=!1){var s=o.value;t.push(s)}}catch(e){l=!0,i=e}finally{try{n&&null!=a.return&&(yield a.return())}finally{if(l)throw i}}return t}),function(e){return o.apply(this,arguments)})},{key:"downloadScreenshot",value:(a=c(function*(e,r,t,{signal:n}={}){var l=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(r)}/screenshot?ts=${encodeURIComponent(t)}`,i=yield this.authenticatedFetch(l,{signal:n});if(!i.ok){var o=yield i.text().catch(()=>"");throw Error(`Screenshot fetch failed (${i.status}): ${o}`)}return Buffer.from((yield i.arrayBuffer()))}),function(e,r,t){return a.apply(this,arguments)})},{key:"streamScreenshots",value:function(e,r,t,n){var l=this;return x(function*(e,r,t,n,{signal:i}={}){var o=`${l.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(r)}/screenshot/stream?from=${encodeURIComponent(t)}&to=${encodeURIComponent(n)}`,a=yield h(l.authenticatedFetch(o,{signal:i}));if(!a.ok){var s=yield h(a.text().catch(()=>""));throw Error(`Screenshot stream failed (${a.status}): ${s}`)}yield*f(C(function(e){return D.apply(this,arguments)}(a)),h)}).apply(this,arguments)}}]),L=(e,r)=>new w(e,r)},77768(e,r,t){t.d(r,{BZ:()=>v,KN:()=>p,kU:()=>m,o0:()=>g,oz:()=>y});var n,l,i,o,a=t(99436),s=t(16928),c=t(79896),u=t(35317),d=t(10750),x=e=>{try{return(0,u.execSync)(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}},h=(e,r,t)=>new Promise((n,l)=>{var i=[e,...r].join(" "),o=(0,u.spawn)(i,[],{cwd:t,stdio:["pipe","ignore","pipe"],shell:!0}),a=[];o.stderr.on("data",e=>a.push(e)),o.on("close",e=>{0===e?n():l(Error(Buffer.concat(a).toString().trim()||`Command failed with code ${e}`))}),o.on("error",l)}),f=(n=a(function*(e,r){try{var n=(yield t.e(7456).then(t.bind(t,79491))).format;return(yield n(r,e,{trailingComma:"all",tabWidth:2,semi:!1,singleQuote:!0,printWidth:100})).code}catch{}return e}),function(e,r){return n.apply(this,arguments)}),m=(e=[])=>{var r=e.find(e=>"application.json"===e.name);if(!r)return"bricks-ctor";try{var t=JSON.parse(r.input);return d(t.name||"bricks-ctor")}catch{return"bricks-ctor"}},p=(l=a(function*(e,r){var t;return Promise.all(e.map((t=a(function*(e){var t=s.join(r,e.name),n=e.input;return e.formatable&&(n=yield f(n,t)),{...e,filePath:t,content:n}}),function(e){return t.apply(this,arguments)})))}),function(e,r){return l.apply(this,arguments)}),y=e=>{e.forEach(e=>{c.mkdirSync(s.dirname(e.filePath),{recursive:!0}),c.writeFileSync(e.filePath,e.content)})},g=(i=a(function*(e,r={}){var t="function"==typeof r.onStatus?r.onStatus:()=>{},n=!1,l=!1;if(!1!==r.install&&x("bun")){t("Installing dependencies (bun install)...");try{yield h("bun",["install"],e),n=!0}catch{}}if(!1!==r.git&&x("git")){t("Initializing git repository...");try{yield h("git",["init"],e),yield h("git",["add","."],e),yield h("git",["-c 'user.name=BRICKS CLI'","-c 'user.email=cli@bricks.tools'","commit","-m 'chore: initialize commit'"],e),l=!0}catch{}}return{bunInstalled:n,gitInitialized:l}}),function(e){return i.apply(this,arguments)}),v=(o=a(function*(e,r,t){var n=t.client,l=t.output,i=t.outputAsTarget;if(!n)throw Error("client is required");if(!l)throw Error("output directory is required");var o=(e=>{for(var r=s.resolve(e);;){if(c.existsSync(s.join(r,"application.json"))||c.existsSync(s.join(r,"module.json")))return r;var t=s.dirname(r);if(t===r)return null;r=t}})(i?s.dirname(s.resolve(l)):l);if(o)throw Error(`Cannot initialize a new BRICKS project inside an existing project (${o}). Choose a directory outside the project.`);var a="application"===e?n.applicationProject:n.moduleProject,u=yield a({id:r,buildApplicationOnly:!1,setupGitHubActions:!1!==t.githubActions,setupAgents:!1!==t.agents,setupClaudeCode:!1!==t.claude,setupGeminiCLI:!0===t.gemini});if(!u?.files)throw Error(`${e} project not found`);var d=m(u.files),x=i?s.resolve(l):s.resolve(l,d);if(c.existsSync(x))throw Error(`Directory already exists: ${x}`);c.mkdirSync(x,{recursive:!0}),y((yield p(u.files,x)));var h=yield g(x,t),f=h.bunInstalled,v=h.gitInitialized;return{success:!0,path:x,files:u.files.length,bunInstalled:f,gitInitialized:v}}),function(e,r,t){return o.apply(this,arguments)})},60450(e,r,t){t.r(r),t.d(r,{buildScreenshotUrl:()=>f,downloadScreenshot:()=>m,fetchAndSaveScreenshot:()=>p,getDeviceScreenshot:()=>h,getSystemMediaBoxId:()=>x,isMediaEnabled:()=>d});var n,l,i,o=t(99436),a=t(79657),s=t(73024),c=t(76760),u=t(48161),d=e=>e?.media_resource?.enable_media_workspace===!0,x=e=>d(e)&&e.media_resource?.system_media_box_id||null,h=(n=o(function*(e,r,t){var n=yield e.mediaFiles({boxId:r,userTags:[`bricks_screenshot_${t}`],limit:1});return n?.[0]||null}),function(e,r,t){return n.apply(this,arguments)}),f=(e,{preferThumbnail:r=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var t=e.meta,n=t.storageEndpoint,l=t.originalFileKey,i=(r?(e=>{var r=e?.meta;if(!r)return null;if("Video"===e.fileType&&r.videoThumbOriginalFileKey)return r.videoThumbOriginalFileKey;var t=r.imageVersions||[];if(!Array.isArray(t)||0===t.length)return null;var n=t.filter(e=>e?.strategy==="BOUNDED"&&"number"==typeof e.width).sort((e,r)=>e.width-r.width);return(n[0]||t[0])?.key||null})(e):null)||l;return i?`${n}/${i}`:null},m=(l=o(function*(e,r=null){var t=yield(0,a.Ay)(e);if(!t.ok)throw Error(`Failed to download screenshot: ${t.statusText}`);var n=yield t.buffer(),l=r||c.join(u.tmpdir(),`bricks-screenshot-${Date.now()}.png`),i=c.dirname(l);return s.existsSync(i)||s.mkdirSync(i,{recursive:!0}),s.writeFileSync(l,n),l}),function(e){return l.apply(this,arguments)}),p=(i=o(function*(e,r,t,n=null,l={}){var i=x(r);if(!i)return{error:"Media workspace not enabled for this workspace"};var o=yield h(e,i,t);if(!o)return{error:"No screenshot available for this device"};var a=f(o,l);return a?{path:yield m(a,n),file:o,url:a}:{error:"Could not build screenshot URL"}}),function(e,r,t){return i.apply(this,arguments)})}};
19
+ `,B=["authorization"];function C(e){var r,t,n,l=2;for("u">typeof Symbol&&(t=Symbol.asyncIterator,n=Symbol.iterator);l--;){if(t&&null!=(r=e[t]))return r.call(e);if(n&&null!=(r=e[n]))return new k(r.call(e));t="@@asyncIterator",n="@@iterator"}throw TypeError("Object is not async iterable")}function k(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(k=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new k(e)}var w=d(function e(r,t){var n;u(this,e),this.baseUrl=r,this.auth="string"==typeof t?{kind:"token",token:t,getHeaders:(n=c(function*(){return{authorization:`Bearer ${t}`}}),function(){return n.apply(this,arguments)})}:t,this.token=this.auth?.token,this.graphqlUrl=`${r}/api/graphql`,this.fetch=function(e){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!e.startsWith("https://"))return m.Ay;var t=new p(r);return(e,r={})=>(0,m.Ay)(e,{...r,agent:t})}(r)},[{key:"authHeaders",value:(n=c(function*(){var e=yield this.auth.getHeaders();return{Authorization:e.authorization,...s(e,B)}}),function(){return n.apply(this,arguments)})},{key:"authenticatedFetch",value:(l=c(function*(e,r={}){var t,n=this,l=(t=c(function*(){return n.fetch(e,{...r,headers:{...r.headers,...yield n.authHeaders()}})}),function(){return t.apply(this,arguments)}),i=yield l();return 401!==i.status||"function"!=typeof this.auth.refresh?i:(i.body?.destroy?.(),yield this.auth.refresh(),l())}),function(e){return l.apply(this,arguments)})},{key:"streamQuery",value:function(e,r){var t=this;return x(function*(e,r,{signal:n}={}){var l=yield h(t.authenticatedFetch(t.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:'multipart/mixed; boundary="-", application/json'},body:JSON.stringify({query:e,variables:r}),signal:n}));if(!l.ok){var i=yield h(l.text().catch(()=>""));throw Error(`Activity-log query failed (${l.status}): ${i}`)}yield*f(C(function(e){return j.apply(this,arguments)}(l)),h)}).apply(this,arguments)}},{key:"events",value:function(e,r){var t=this;return x(function*(){yield*f(C(t.streamQuery(I,{filter:e},r)),h)})()}},{key:"screenshots",value:function(e,r){var t=this;return x(function*(){yield*f(C(t.streamQuery(A,{filter:e},r)),h)})()}},{key:"collectEvents",value:(i=c(function*(e,{limit:r,signal:t}={}){var n=[],l=!1,i=!1;try{for(var o,a,s=C(this.events(e,{signal:t}));l=!(a=yield s.next()).done;l=!1){var c=a.value;if(n.push(c),r&&n.length>=r)break}}catch(e){i=!0,o=e}finally{try{l&&null!=s.return&&(yield s.return())}finally{if(i)throw o}}return n}),function(e){return i.apply(this,arguments)})},{key:"collectScreenshots",value:(o=c(function*(e,{signal:r}={}){var t=[],n=!1,l=!1;try{for(var i,o,a=C(this.screenshots(e,{signal:r}));n=!(o=yield a.next()).done;n=!1){var s=o.value;t.push(s)}}catch(e){l=!0,i=e}finally{try{n&&null!=a.return&&(yield a.return())}finally{if(l)throw i}}return t}),function(e){return o.apply(this,arguments)})},{key:"downloadScreenshot",value:(a=c(function*(e,r,t,{signal:n}={}){var l=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(r)}/screenshot?ts=${encodeURIComponent(t)}`,i=yield this.authenticatedFetch(l,{signal:n});if(!i.ok){var o=yield i.text().catch(()=>"");throw Error(`Screenshot fetch failed (${i.status}): ${o}`)}return Buffer.from((yield i.arrayBuffer()))}),function(e,r,t){return a.apply(this,arguments)})},{key:"streamScreenshots",value:function(e,r,t,n){var l=this;return x(function*(e,r,t,n,{signal:i}={}){var o=`${l.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(r)}/screenshot/stream?from=${encodeURIComponent(t)}&to=${encodeURIComponent(n)}`,a=yield h(l.authenticatedFetch(o,{signal:i}));if(!a.ok){var s=yield h(a.text().catch(()=>""));throw Error(`Screenshot stream failed (${a.status}): ${s}`)}yield*f(C(function(e){return D.apply(this,arguments)}(a)),h)}).apply(this,arguments)}}]),L=(e,r)=>new w(e,r)},77768(e,r,t){t.d(r,{BZ:()=>v,KN:()=>p,kU:()=>m,o0:()=>g,oz:()=>y});var n,l,i,o,a=t(99436),s=t(16928),c=t(79896),u=t(35317),d=t(10750),x=e=>{try{return(0,u.execSync)(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}},h=(e,r,t)=>new Promise((n,l)=>{var i=[e,...r].join(" "),o=(0,u.spawn)(i,[],{cwd:t,stdio:["pipe","ignore","pipe"],shell:!0}),a=[];o.stderr.on("data",e=>a.push(e)),o.on("close",e=>{0===e?n():l(Error(Buffer.concat(a).toString().trim()||`Command failed with code ${e}`))}),o.on("error",l)}),f=(n=a(function*(e,r){try{var n=(yield t.e(7456).then(t.bind(t,79491))).format;return(yield n(r,e,{trailingComma:"all",tabWidth:2,semi:!1,singleQuote:!0,printWidth:100})).code}catch{}return e}),function(e,r){return n.apply(this,arguments)}),m=(e=[])=>{var r=e.find(e=>"application.json"===e.name);if(!r)return"bricks-ctor";try{var t=JSON.parse(r.input);return d(t.name||"bricks-ctor")}catch{return"bricks-ctor"}},p=(l=a(function*(e,r){var t;return Promise.all(e.map((t=a(function*(e){var t=s.join(r,e.name),n=e.input;return e.formatable&&(n=yield f(n,t)),{...e,filePath:t,content:n}}),function(e){return t.apply(this,arguments)})))}),function(e,r){return l.apply(this,arguments)}),y=e=>{e.forEach(e=>{c.mkdirSync(s.dirname(e.filePath),{recursive:!0}),c.writeFileSync(e.filePath,e.content)})},g=(i=a(function*(e,r={}){var t="function"==typeof r.onStatus?r.onStatus:()=>{},n=!1,l=!1;if(!1!==r.install&&x("bun")){t("Installing dependencies (bun install)...");try{yield h("bun",["install"],e),n=!0}catch{}}if(!1!==r.git&&x("git")){t("Initializing git repository...");try{yield h("git",["init"],e),yield h("git",["add","."],e),yield h("git",["-c 'user.name=BRICKS CLI'","-c 'user.email=cli@bricks.tools'","commit","-m 'chore: initialize commit'"],e),l=!0}catch{}}return{bunInstalled:n,gitInitialized:l}}),function(e){return i.apply(this,arguments)}),v=(o=a(function*(e,r,t){var n=t.client,l=t.output,i=t.outputAsTarget;if(!n)throw Error("client is required");if(!l)throw Error("output directory is required");var o=(e=>{for(var r=s.resolve(e);;){if(c.existsSync(s.join(r,"application.json"))||c.existsSync(s.join(r,"module.json")))return r;var t=s.dirname(r);if(t===r)return null;r=t}})(i?s.dirname(s.resolve(l)):l);if(o)throw Error(`Cannot initialize a new BRICKS project inside an existing project (${o}). Choose a directory outside the project.`);var a="application"===e?n.applicationProject:n.moduleProject,u=yield a({id:r,buildApplicationOnly:!1,setupGitHubActions:!1!==t.githubActions,setupAgents:!1!==t.agents,setupClaudeCode:!1!==t.claude,setupGeminiCLI:!0===t.gemini});if(!u?.files)throw Error(`${e} project not found`);var d=m(u.files),x=i?s.resolve(l):s.resolve(l,d);if(c.existsSync(x))throw Error(`Directory already exists: ${x}`);c.mkdirSync(x,{recursive:!0}),y((yield p(u.files,x)));var h=yield g(x,t),f=h.bunInstalled,v=h.gitInitialized;return{success:!0,path:x,files:u.files.length,bunInstalled:f,gitInitialized:v}}),function(e,r,t){return o.apply(this,arguments)})},60450(e,r,t){t.r(r),t.d(r,{buildScreenshotUrl:()=>f,downloadScreenshot:()=>m,fetchAndSaveScreenshot:()=>p,getDeviceScreenshot:()=>h,getSystemMediaBoxId:()=>x,isMediaEnabled:()=>d});var n,l,i,o=t(99436),a=t(79657),s=t(73024),c=t(76760),u=t(48161),d=e=>e?.media_resource?.enable_media_workspace===!0,x=e=>d(e)&&e.media_resource?.system_media_box_id||null,h=(n=o(function*(e,r,t){var n=yield e.mediaFiles({boxId:r,userTags:[`bricks_screenshot_${t}`],limit:1});return n?.[0]||null}),function(e,r,t){return n.apply(this,arguments)}),f=(e,{preferThumbnail:r=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var t=e.meta,n=t.storageEndpoint,l=t.originalFileKey,i=(r?(e=>{var r=e?.meta;if(!r)return null;if("Video"===e.fileType&&r.videoThumbOriginalFileKey)return r.videoThumbOriginalFileKey;var t=r.imageVersions||[];if(!Array.isArray(t)||0===t.length)return null;var n=t.filter(e=>e?.strategy==="BOUNDED"&&"number"==typeof e.width).sort((e,r)=>e.width-r.width);return(n[0]||t[0])?.key||null})(e):null)||l;return i?`${n}/${i}`:null},m=(l=o(function*(e,r=null){var t,n=new AbortController;try{var l=yield(0,a.Ay)(e,{signal:n.signal});if(!l.ok)throw Error(`Failed to download screenshot: ${l.statusText}`);t=yield l.buffer()}finally{n.abort()}var i=r||c.join(u.tmpdir(),`bricks-screenshot-${Date.now()}.png`),o=c.dirname(i);return s.existsSync(o)||s.mkdirSync(o,{recursive:!0}),s.writeFileSync(i,t),i}),function(e){return l.apply(this,arguments)}),p=(i=o(function*(e,r,t,n=null,l={}){var i=x(r);if(!i)return{error:"Media workspace not enabled for this workspace"};var o=yield h(e,i,t);if(!o)return{error:"No screenshot available for this device"};var a=f(o,l);return a?{path:yield m(a,n),file:o,url:a}:{error:"Could not build screenshot URL"}}),function(e,r,t){return i.apply(this,arguments)})}};
package/lib/831.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=831;export const __rspack_esm_ids=[831];export const __webpack_modules__={60450(e,r,i){i.r(r),i.d(r,{buildScreenshotUrl:()=>p,downloadScreenshot:()=>_,fetchAndSaveScreenshot:()=>f,getDeviceScreenshot:()=>y,getSystemMediaBoxId:()=>h,isMediaEnabled:()=>c});var t,n,o,a=i(99436),s=i(79657),l=i(73024),u=i(76760),d=i(48161),c=e=>e?.media_resource?.enable_media_workspace===!0,h=e=>c(e)&&e.media_resource?.system_media_box_id||null,y=(t=a(function*(e,r,i){var t=yield e.mediaFiles({boxId:r,userTags:[`bricks_screenshot_${i}`],limit:1});return t?.[0]||null}),function(e,r,i){return t.apply(this,arguments)}),p=(e,{preferThumbnail:r=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var i=e.meta,t=i.storageEndpoint,n=i.originalFileKey,o=(r?(e=>{var r=e?.meta;if(!r)return null;if("Video"===e.fileType&&r.videoThumbOriginalFileKey)return r.videoThumbOriginalFileKey;var i=r.imageVersions||[];if(!Array.isArray(i)||0===i.length)return null;var t=i.filter(e=>e?.strategy==="BOUNDED"&&"number"==typeof e.width).sort((e,r)=>e.width-r.width);return(t[0]||i[0])?.key||null})(e):null)||n;return o?`${t}/${o}`:null},_=(n=a(function*(e,r=null){var i=yield(0,s.Ay)(e);if(!i.ok)throw Error(`Failed to download screenshot: ${i.statusText}`);var t=yield i.buffer(),n=r||u.join(d.tmpdir(),`bricks-screenshot-${Date.now()}.png`),o=u.dirname(n);return l.existsSync(o)||l.mkdirSync(o,{recursive:!0}),l.writeFileSync(n,t),n}),function(e){return n.apply(this,arguments)}),f=(o=a(function*(e,r,i,t=null,n={}){var o=h(r);if(!o)return{error:"Media workspace not enabled for this workspace"};var a=yield y(e,o,i);if(!a)return{error:"No screenshot available for this device"};var s=p(a,n);return s?{path:yield _(s,t),file:a,url:s}:{error:"Could not build screenshot URL"}}),function(e,r,i){return o.apply(this,arguments)})}};
1
+ export const __rspack_esm_id=831;export const __rspack_esm_ids=[831];export const __webpack_modules__={60450(e,r,i){i.r(r),i.d(r,{buildScreenshotUrl:()=>f,downloadScreenshot:()=>p,fetchAndSaveScreenshot:()=>_,getDeviceScreenshot:()=>h,getSystemMediaBoxId:()=>y,isMediaEnabled:()=>c});var n,t,o,a=i(99436),l=i(79657),s=i(73024),u=i(76760),d=i(48161),c=e=>e?.media_resource?.enable_media_workspace===!0,y=e=>c(e)&&e.media_resource?.system_media_box_id||null,h=(n=a(function*(e,r,i){var n=yield e.mediaFiles({boxId:r,userTags:[`bricks_screenshot_${i}`],limit:1});return n?.[0]||null}),function(e,r,i){return n.apply(this,arguments)}),f=(e,{preferThumbnail:r=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var i=e.meta,n=i.storageEndpoint,t=i.originalFileKey,o=(r?(e=>{var r=e?.meta;if(!r)return null;if("Video"===e.fileType&&r.videoThumbOriginalFileKey)return r.videoThumbOriginalFileKey;var i=r.imageVersions||[];if(!Array.isArray(i)||0===i.length)return null;var n=i.filter(e=>e?.strategy==="BOUNDED"&&"number"==typeof e.width).sort((e,r)=>e.width-r.width);return(n[0]||i[0])?.key||null})(e):null)||t;return o?`${n}/${o}`:null},p=(t=a(function*(e,r=null){var i,n=new AbortController;try{var t=yield(0,l.Ay)(e,{signal:n.signal});if(!t.ok)throw Error(`Failed to download screenshot: ${t.statusText}`);i=yield t.buffer()}finally{n.abort()}var o=r||u.join(d.tmpdir(),`bricks-screenshot-${Date.now()}.png`),a=u.dirname(o);return s.existsSync(a)||s.mkdirSync(a,{recursive:!0}),s.writeFileSync(o,i),o}),function(e){return t.apply(this,arguments)}),_=(o=a(function*(e,r,i,n=null,t={}){var o=y(r);if(!o)return{error:"Media workspace not enabled for this workspace"};var a=yield h(e,o,i);if(!a)return{error:"No screenshot available for this device"};var l=f(a,t);return l?{path:yield p(l,n),file:a,url:l}:{error:"Could not build screenshot URL"}}),function(e,r,i){return o.apply(this,arguments)})}};