@fugood/bricks-cli 2.26.0-beta.17 → 2.26.0-beta.18

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.17")?"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.18")?"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/7494.js CHANGED
@@ -1,4 +1,4 @@
1
- export const __rspack_esm_id=7494;export const __rspack_esm_ids=[7494];export const __webpack_modules__={59957(e,r,t){t.r(r),t.d(r,{BricksControllerClient:()=>k,createControllerClient:()=>_});var n,a,i=t(99436),o=t(5018),l=t(44668),s=t(54506),c=t(78549),p=t(94370),u=t(75149),h=s.ApolloClient,d=s.InMemoryCache,f=s.HttpLink,y=c.o,k=l(function e(r,t){o(this,e),this.baseUrl=r,this.endpoint="/api/graphql";var n,a=new f({uri:`${r}${this.endpoint}`,fetch:(0,u.P)(r)}),l=y((n=i(function*(e,{headers:r}){return{headers:{...r,authorization:`Bearer ${yield t()}`}}}),function(e,r){return n.apply(this,arguments)}));this.apolloClient=new h({link:l.concat(a),cache:new d,defaultOptions:{query:{errorPolicy:"all",fetchPolicy:"no-cache"}}})},[{key:"workspaces",value:(n=i(function*(){for(var e=(0,p.default)`
1
+ export const __rspack_esm_id=7494;export const __rspack_esm_ids=[7494];export const __webpack_modules__={59957(e,r,t){t.r(r),t.d(r,{BricksControllerClient:()=>m,createControllerClient:()=>v});var n,a,o,i=t(99436),s=t(5018),l=t(44668),c=t(54506),p=t(78549),u=t(94370),d=t(75149),h=c.ApolloClient,k=c.InMemoryCache,f=c.HttpLink,y=p.o,m=l(function e(r,t){s(this,e),this.baseUrl=r,this.endpoint="/api/graphql";var n,a=new f({uri:`${r}${this.endpoint}`,fetch:(0,d.P)(r)}),o=y((n=i(function*(e,{headers:r}){return{headers:{...r,authorization:`Bearer ${yield t()}`}}}),function(e,r){return n.apply(this,arguments)}));this.apolloClient=new h({link:o.concat(a),cache:new k,defaultOptions:{query:{errorPolicy:"all",fetchPolicy:"no-cache"}}})},[{key:"workspaces",value:(n=i(function*(){for(var e=(0,u.default)`
2
2
  query cliWorkspaces($paginate: Paginate) {
3
3
  workspaces(paginate: $paginate) {
4
4
  _id
@@ -15,7 +15,7 @@ export const __rspack_esm_id=7494;export const __rspack_esm_ids=[7494];export co
15
15
  }
16
16
  }
17
17
  }
18
- `,r=[],t=0;;t+=100){var n=yield this.apolloClient.query({query:e,variables:{paginate:{limit:100,offset:t}}}),a=n.data,i=n.errors;if(i?.length>0)throw Error(i.map(({message:e})=>e).join("\n"));var o=a.workspaces||[];if(r.push(...o),o.length<100)return r}}),function(){return n.apply(this,arguments)})},{key:"createWorkspace",value:(a=i(function*({name:e,description:r}){var t=(0,p.default)`
18
+ `,r=[],t=0;;t+=100){var n=yield this.apolloClient.query({query:e,variables:{paginate:{limit:100,offset:t}}}),a=n.data,o=n.errors;if(o?.length>0)throw Error(o.map(({message:e})=>e).join("\n"));var i=a.workspaces||[];if(r.push(...i),i.length<100)return r}}),function(){return n.apply(this,arguments)})},{key:"createWorkspace",value:(a=i(function*({name:e,description:r}){var t=(0,u.default)`
19
19
  mutation cliCreateWorkspace($name: String, $description: String) {
20
20
  createWorkspace(name: $name, description: $description) {
21
21
  _id
@@ -32,4 +32,13 @@ export const __rspack_esm_id=7494;export const __rspack_esm_ids=[7494];export co
32
32
  }
33
33
  }
34
34
  }
35
- `,n=yield this.apolloClient.mutate({mutation:t,variables:{name:e,description:r},errorPolicy:"all",fetchPolicy:"no-cache"}),a=n.data,i=n.errors;if(i?.length>0)throw Error(i.map(({message:e})=>e).join("\n"));return a.createWorkspace}),function(e){return a.apply(this,arguments)})}]),_=(e,r)=>new k(e,r)},75149(e,r,t){t.d(r,{P:()=>i});var n=t(79657),a=t(64007);function i(e){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!e.startsWith("https://"))return n.Ay;var t=new a(r);return(e,r={})=>(0,n.Ay)(e,{...r,agent:t})}}};
35
+ `,n=yield this.apolloClient.mutate({mutation:t,variables:{name:e,description:r},errorPolicy:"all",fetchPolicy:"no-cache"}),a=n.data,o=n.errors;if(o?.length>0)throw Error(o.map(({message:e})=>e).join("\n"));return a.createWorkspace}),function(e){return a.apply(this,arguments)})},{key:"updateWorkspaceTokens",value:(o=i(function*({id:e,tokens:r}){var t=(0,u.default)`
36
+ mutation cliUpdateWorkspaceTokens($id: ID!, $tokens: [WorkspaceTokenInput]) {
37
+ updateWorkspaceTokens(id: $id, tokens: $tokens) {
38
+ newTokens {
39
+ name
40
+ token
41
+ }
42
+ }
43
+ }
44
+ `,n=yield this.apolloClient.mutate({mutation:t,variables:{id:e,tokens:r},errorPolicy:"all",fetchPolicy:"no-cache"}),a=n.data,o=n.errors;if(o?.length>0)throw Error(o.map(({message:e})=>e).join("\n"));return a.updateWorkspaceTokens.newTokens}),function(e){return o.apply(this,arguments)})}]),v=(e,r)=>new m(e,r)},75149(e,r,t){t.d(r,{P:()=>o});var n=t(79657),a=t(64007);function o(e){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!e.startsWith("https://"))return n.Ay;var t=new a(r);return(e,r={})=>(0,n.Ay)(e,{...r,agent:t})}}};
package/lib/907.js CHANGED
@@ -1,4 +1,4 @@
1
- export const __rspack_esm_id=907;export const __rspack_esm_ids=[907];export const __webpack_modules__={85382(e,i,t){t.r(i),t.d(i,{BricksClient:()=>b,BricksPublicClient:()=>I,createClient:()=>S,createFetchForUrl:()=>g.P,createPublicClient:()=>k});var a,n,o,r,s=t(99436),d=t(5018),l=t(44668),c=t(54506),u=t(78549),p=t(94370),m=t(43741),$=t(89293),g=t(75149),_=c.ApolloClient,v=c.InMemoryCache,h=c.HttpLink,y=u.o,f={query:"query",mutation:"mutate"},I=l(function e(i){d(this,e),this.baseUrl=i,this.endpoint="/api/graphql-nonauth";var t=new h({uri:`${i}${this.endpoint}`,fetch:(0,g.P)(i)});this.apolloClient=new _({link:t,cache:new v,defaultOptions:{query:{errorPolicy:"all",fetchPolicy:"no-cache"}}})},[{key:"checkWorkspaceOTP",value:(a=s(function*(e){var i=(0,p.default)`
1
+ export const __rspack_esm_id=907;export const __rspack_esm_ids=[907];export const __webpack_modules__={85382(e,i,t){t.r(i),t.d(i,{BricksClient:()=>b,BricksPublicClient:()=>I,createClient:()=>S,createFetchForUrl:()=>g.P,createPublicClient:()=>k});var a,n,r,o,s=t(99436),d=t(5018),l=t(44668),c=t(54506),u=t(78549),p=t(94370),m=t(43741),$=t(89293),g=t(75149),_=c.ApolloClient,v=c.InMemoryCache,h=c.HttpLink,y=u.o,f={query:"query",mutation:"mutate"},I=l(function e(i){d(this,e),this.baseUrl=i,this.endpoint="/api/graphql-nonauth";var t=new h({uri:`${i}${this.endpoint}`,fetch:(0,g.P)(i)});this.apolloClient=new _({link:t,cache:new v,defaultOptions:{query:{errorPolicy:"all",fetchPolicy:"no-cache"}}})},[{key:"checkWorkspaceOTP",value:(a=s(function*(e){var i=(0,p.default)`
2
2
  query checkWorkspaceOTP($passcode: String!) {
3
3
  checkWorkspaceOTP(passcode: $passcode)
4
4
  }
@@ -12,7 +12,7 @@ export const __rspack_esm_id=907;export const __rspack_esm_ids=[907];export cons
12
12
  }
13
13
  `,t=yield this.apolloClient.mutate({mutation:i,variables:{passcode:e}}),a=t.data,n=t.errors;if(n?.length>0)throw Error(n.map(({message:e})=>e).join("\n"));return a.exchangeWorkspaceOTP}),function(e){return n.apply(this,arguments)})}]),k=e=>new I(e),C="Note: OAuth workspace access is awaiting the next production server release. Until then, use workspace auth (passcode or token; CLI: `bricks auth login-workspace`).",A=(e,i)=>{if(i?.kind!=="oauth")return e;var t=e?.message||String(e);if(!(403===(e?.statusCode||e?.networkError?.statusCode||e?.cause?.statusCode)||/\b403\b|invalid algorithm/i.test(t))||t.includes(C))return e;var a=Error(`${t}
14
14
 
15
- ${C}`);return a.cause=e,a},b=l(function e(i,t){var a,n=this;d(this,e),this.baseUrl=i,this.auth=(e=>{if(!e)return null;if("string"==typeof e){var i;return{kind:"token",token:e,getHeaders:(i=s(function*(){return{authorization:`Bearer ${e}`}}),function(){return i.apply(this,arguments)})}}return e})(t),this.token=this.auth?.token,this.endpoint="/api/graphql-workspace";var o=new h({uri:`${i}${this.endpoint}`,fetch:(0,g.P)(i)}),r=y((a=s(function*(e,{headers:i}){return{headers:{...i,...n.auth?yield n.auth.getHeaders():{}}}}),function(e,i){return a.apply(this,arguments)}));this.apolloClient=new _({link:r.concat(o),cache:new v,defaultOptions:{watchQuery:{errorPolicy:"all",fetchPolicy:"no-cache"},query:{errorPolicy:"all",fetchPolicy:"no-cache"}}}),this.queries=m,this.mutations=$,this.generateMethods()},[{key:"generateMethods",value:function(){var e=this,i=i=>([t,a])=>{if(!this[t]){var n,o=(n=s(function*(n,o){try{var r=e.apolloClient[f[i]].bind(e.apolloClient),s=yield r({[i]:a,variables:n,...o}),d=s.data,l=s.errors;if(l)throw Error(l.map(({message:e})=>e).join("\n"));return d[t]}catch(e){if(e.cause?.result?.errors)throw Error(e.cause.result.errors.map(({message:e})=>e).join("\n"));throw e}}),function(e,i){return n.apply(this,arguments)});this[t]=s(function*(i={},t={}){try{return yield o(i,t)}catch(a){if(e.auth?.kind==="oauth"&&e.auth.refresh&&/401|unauthoriz|jwt expired|token.*expired|invalid.*token/i.test(a?.message||"")){yield e.auth.refresh();try{return yield o(i,t)}catch(i){throw A(i,e.auth)}}throw A(a,e.auth)}})}};Object.entries(this.queries).forEach(i("query")),Object.entries(this.mutations).forEach(i("mutation"))}},{key:"query",value:(o=s(function*(e,i={}){var t=yield this.apolloClient.query({query:e,variables:i,fetchPolicy:"no-cache"}),a=t.data,n=t.errors;if(n?.length>0)throw Error(n.map(({message:e})=>e).join("\n"));return a}),function(e){return o.apply(this,arguments)})},{key:"mutate",value:(r=s(function*(e,i={}){var t=yield this.apolloClient.mutate({mutation:e,variables:i}),a=t.data,n=t.errors;if(n?.length>0)throw Error(n.map(({message:e})=>e).join("\n"));return a}),function(e){return r.apply(this,arguments)})}]),S=(e,i)=>new b(e,i)},75149(e,i,t){t.d(i,{P:()=>o});var a=t(79657),n=t(64007);function o(e){var i=process.env.HTTPS_PROXY||process.env.https_proxy;if(!i||!e.startsWith("https://"))return a.Ay;var t=new n(i);return(e,i={})=>(0,a.Ay)(e,{...i,agent:t})}},48596(e,i,t){t.d(i,{$7:()=>c,$V:()=>u,F3:()=>o,J6:()=>p,NJ:()=>s,VZ:()=>r,Yi:()=>n,lI:()=>l,mJ:()=>d});var a=t(94370),n=(0,a.default)`
15
+ ${C}`);return a.cause=e,a},b=l(function e(i,t){var a,n=this;d(this,e),this.baseUrl=i,this.auth=(e=>{if(!e)return null;if("string"==typeof e){var i;return{kind:"token",token:e,getHeaders:(i=s(function*(){return{authorization:`Bearer ${e}`}}),function(){return i.apply(this,arguments)})}}return e})(t),this.token=this.auth?.token,this.endpoint="/api/graphql-workspace";var r=new h({uri:`${i}${this.endpoint}`,fetch:(0,g.P)(i)}),o=y((a=s(function*(e,{headers:i}){return{headers:{...i,...n.auth?yield n.auth.getHeaders():{}}}}),function(e,i){return a.apply(this,arguments)}));this.apolloClient=new _({link:o.concat(r),cache:new v,defaultOptions:{watchQuery:{errorPolicy:"all",fetchPolicy:"no-cache"},query:{errorPolicy:"all",fetchPolicy:"no-cache"}}}),this.queries=m,this.mutations=$,this.generateMethods()},[{key:"generateMethods",value:function(){var e=this,i=i=>([t,a])=>{if(!this[t]){var n,r=(n=s(function*(n,r){try{var o=e.apolloClient[f[i]].bind(e.apolloClient),s=yield o({[i]:a,variables:n,...r}),d=s.data,l=s.errors;if(l)throw Error(l.map(({message:e})=>e).join("\n"));return d[t]}catch(e){if(e.cause?.result?.errors)throw Error(e.cause.result.errors.map(({message:e})=>e).join("\n"));throw e}}),function(e,i){return n.apply(this,arguments)});this[t]=s(function*(i={},t={}){try{return yield r(i,t)}catch(a){if(e.auth?.kind==="oauth"&&e.auth.refresh&&/401|unauthoriz|jwt expired|token.*expired|invalid.*token/i.test(a?.message||"")){yield e.auth.refresh();try{return yield r(i,t)}catch(i){throw A(i,e.auth)}}throw A(a,e.auth)}})}};Object.entries(this.queries).forEach(i("query")),Object.entries(this.mutations).forEach(i("mutation"))}},{key:"query",value:(r=s(function*(e,i={}){var t=yield this.apolloClient.query({query:e,variables:i,fetchPolicy:"no-cache"}),a=t.data,n=t.errors;if(n?.length>0)throw Error(n.map(({message:e})=>e).join("\n"));return a}),function(e){return r.apply(this,arguments)})},{key:"mutate",value:(o=s(function*(e,i={}){var t=yield this.apolloClient.mutate({mutation:e,variables:i}),a=t.data,n=t.errors;if(n?.length>0)throw Error(n.map(({message:e})=>e).join("\n"));return a}),function(e){return o.apply(this,arguments)})}]),S=(e,i)=>new b(e,i)},75149(e,i,t){t.d(i,{P:()=>r});var a=t(79657),n=t(64007);function r(e){var i=process.env.HTTPS_PROXY||process.env.https_proxy;if(!i||!e.startsWith("https://"))return a.Ay;var t=new n(i);return(e,i={})=>(0,a.Ay)(e,{...i,agent:t})}},48596(e,i,t){t.d(i,{$7:()=>c,$V:()=>u,F3:()=>r,J6:()=>p,NJ:()=>s,VZ:()=>o,Yi:()=>n,lI:()=>l,mJ:()=>d});var a=t(94370),n=(0,a.default)`
16
16
  fragment cliWorkspaceArguments on Workspace {
17
17
  _id
18
18
  name
@@ -38,7 +38,7 @@ ${C}`);return a.cause=e,a},b=l(function e(i,t){var a,n=this;d(this,e),this.baseU
38
38
  }
39
39
  }
40
40
  }
41
- `,o=(0,a.default)`
41
+ `,r=(0,a.default)`
42
42
  fragment cliDeviceArguments on Device {
43
43
  _id
44
44
  name
@@ -124,7 +124,7 @@ ${C}`);return a.cause=e,a},b=l(function e(i,t){var a,n=this;d(this,e),this.baseU
124
124
  create_datetime
125
125
  last_modify_datetime
126
126
  }
127
- `,r=(0,a.default)`
127
+ `,o=(0,a.default)`
128
128
  fragment cliDevicePanelArguments on Device {
129
129
  _id
130
130
  name
@@ -209,13 +209,16 @@ ${C}`);return a.cause=e,a},b=l(function e(i,t){var a,n=this;d(this,e),this.baseU
209
209
  }
210
210
  short_edit {
211
211
  enabled
212
+ use_unstable_features
212
213
  ref_map
213
214
  }
214
215
  canvas_control {
215
216
  enabled
217
+ use_unstable_features
216
218
  }
217
219
  device_control {
218
220
  enabled
221
+ use_unstable_features
219
222
  }
220
223
  lock {
221
224
  enabled
@@ -224,6 +227,12 @@ ${C}`);return a.cause=e,a},b=l(function e(i,t){var a,n=this;d(this,e),this.baseU
224
227
  device_id
225
228
  status
226
229
  frame
230
+ run_test
231
+ cron_tests {
232
+ test_id
233
+ cron
234
+ bind_id
235
+ }
227
236
  }
228
237
  id_for_devices
229
238
  sync_key
@@ -269,14 +278,14 @@ ${C}`);return a.cause=e,a},b=l(function e(i,t){var a,n=this;d(this,e),this.baseU
269
278
  description
270
279
  current_version
271
280
  }
272
- `},89293(e,i,t){t.r(i),t.d(i,{bindApplication:()=>_,bindButtressServer:()=>S,controlDevice:()=>r,createApplication:()=>u,createApplicationWithShareVersion:()=>p,createDevice:()=>o,createMediaFileUploadRequest:()=>A,createModule:()=>h,createVirtualDevice:()=>s,dispatchDeviceGroupAction:()=>c,issueButtressAccessToken:()=>w,issueDevtoolsAccessToken:()=>L,releaseApplication:()=>C,releaseModule:()=>b,removeApplication:()=>$,removeDevice:()=>l,removeModule:()=>f,shortEditApplication:()=>g,shortEditModule:()=>I,triggerApplicationCanvasControl:()=>v,unbindButtressServer:()=>D,updateApplication:()=>m,updateModule:()=>y,updateVirtualDevice:()=>d,updateWorkspace:()=>k});var a=t(94370),n=t(48596),o=(0,a.default)`
281
+ `},89293(e,i,t){t.r(i),t.d(i,{bindApplication:()=>_,bindButtressServer:()=>S,controlDevice:()=>o,createApplication:()=>u,createApplicationWithShareVersion:()=>p,createDevice:()=>r,createMediaFileUploadRequest:()=>A,createModule:()=>h,createVirtualDevice:()=>s,dispatchDeviceGroupAction:()=>c,issueButtressAccessToken:()=>w,issueDevtoolsAccessToken:()=>L,releaseApplication:()=>C,releaseModule:()=>b,removeApplication:()=>$,removeDevice:()=>l,removeModule:()=>f,shortEditApplication:()=>g,shortEditModule:()=>I,triggerApplicationCanvasControl:()=>v,unbindButtressServer:()=>D,updateApplication:()=>m,updateModule:()=>y,updateVirtualDevice:()=>d,updateWorkspace:()=>k});var a=t(94370),n=t(48596),r=(0,a.default)`
273
282
  mutation CLI_createDevice($bindPasscode: String, $name: String, $deviceName: String) {
274
283
  createDevice(bindPasscode: $bindPasscode, name: $name, deviceName: $deviceName) {
275
284
  ...cliDeviceArguments
276
285
  }
277
286
  }
278
287
  ${n.F3}
279
- `,r=(0,a.default)`
288
+ `,o=(0,a.default)`
280
289
  mutation CLI_controlDevice($id: ID!, $type: String!, $eventPayload: JSON) {
281
290
  controlDevice(id: $id, type: $type, eventPayload: $eventPayload) {
282
291
  _id
@@ -618,14 +627,14 @@ ${C}`);return a.cause=e,a},b=l(function e(i,t){var a,n=this;d(this,e),this.baseU
618
627
  jti
619
628
  }
620
629
  }
621
- `},43741(e,i,t){t.r(i),t.d(i,{application:()=>p,applicationProject:()=>b,applications:()=>m,buttressServers:()=>D,checkBindDevicePasscode:()=>h,device:()=>r,deviceGroup:()=>l,deviceGroups:()=>c,deviceUsage:()=>A,devices:()=>s,devicesByGroup:()=>u,devicesPanel:()=>d,mediaBox:()=>k,mediaBoxes:()=>I,mediaFile:()=>C,mediaFiles:()=>y,mediaWorkspace:()=>f,module:()=>g,moduleProject:()=>S,modules:()=>_,publicApplicationShareInfo:()=>$,publicModules:()=>v,workspace:()=>o});var a=t(94370),n=t(48596),o=(0,a.default)`
630
+ `},43741(e,i,t){t.r(i),t.d(i,{application:()=>p,applicationProject:()=>b,applications:()=>m,buttressServers:()=>D,checkBindDevicePasscode:()=>h,device:()=>o,deviceGroup:()=>l,deviceGroups:()=>c,deviceUsage:()=>A,devices:()=>s,devicesByGroup:()=>u,devicesPanel:()=>d,mediaBox:()=>k,mediaBoxes:()=>I,mediaFile:()=>C,mediaFiles:()=>y,mediaWorkspace:()=>f,module:()=>g,moduleProject:()=>S,modules:()=>_,publicApplicationShareInfo:()=>$,publicModules:()=>v,workspace:()=>r});var a=t(94370),n=t(48596),r=(0,a.default)`
622
631
  query CLI_workspace {
623
632
  workspace {
624
633
  ...cliWorkspaceArguments
625
634
  }
626
635
  }
627
636
  ${n.Yi}
628
- `,r=(0,a.default)`
637
+ `,o=(0,a.default)`
629
638
  query CLI_device($id: ID) {
630
639
  device(id: $id) {
631
640
  ...cliDeviceArguments
package/lib/9320.js CHANGED
@@ -1,3 +1,24 @@
1
- export const __rspack_esm_id=9320;export const __rspack_esm_ids=[9320];export const __webpack_modules__={65650(e,t,r){e.exports=r(78942).Symbol},87379(e,t,r){var o=r(65650),n=r(8870),i=r(29005),s=o?o.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?n(e):i(e)}},86403(e,t,r){var o=r(62945),n=/^\s+/;e.exports=function(e){return e?e.slice(0,o(e)+1).replace(n,""):e}},74967(e){e.exports="object"==typeof global&&global&&global.Object===Object&&global},8870(e,t,r){var o=r(65650),n=Object.prototype,i=n.hasOwnProperty,s=n.toString,a=o?o.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),r=e[a];try{e[a]=void 0;var o=!0}catch(e){}var n=s.call(e);return o&&(t?e[a]=r:delete e[a]),n}},29005(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},78942(e,t,r){var o=r(74967),n="object"==typeof self&&self&&self.Object===Object&&self;e.exports=o||n||Function("return this")()},62945(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},12784(e,t,r){var o=r(41580),n=r(94495),i=r(6131),s=Math.max,a=Math.min;e.exports=function(e,t,r){var u,l,c,p,f,h,d=0,v=!1,y=!1,m=!0;if("function"!=typeof e)throw TypeError("Expected a function");function b(t){var r=u,o=l;return u=l=void 0,d=t,p=e.apply(o,r)}function x(e){var r=e-h,o=e-d;return void 0===h||r>=t||r<0||y&&o>=c}function g(){var e,r,o,i=n();if(x(i))return _(i);f=setTimeout(g,(e=i-h,r=i-d,o=t-e,y?a(o,c-r):o))}function _(e){return(f=void 0,m&&u)?b(e):(u=l=void 0,p)}function w(){var e,r=n(),o=x(r);if(u=arguments,l=this,h=r,o){if(void 0===f)return d=e=h,f=setTimeout(g,t),v?b(e):p;if(y)return clearTimeout(f),f=setTimeout(g,t),b(h)}return void 0===f&&(f=setTimeout(g,t)),p}return t=i(t)||0,o(r)&&(v=!!r.leading,c=(y="maxWait"in r)?s(i(r.maxWait)||0,t):c,m="trailing"in r?!!r.trailing:m),w.cancel=function(){void 0!==f&&clearTimeout(f),d=0,u=h=l=f=void 0},w.flush=function(){return void 0===f?p:_(n())},w}},41580(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},80547(e){e.exports=function(e){return null!=e&&"object"==typeof e}},51187(e,t,r){var o=r(87379),n=r(80547);e.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==o(e)}},94495(e,t,r){var o=r(78942);e.exports=function(){return o.Date.now()}},6131(e,t,r){var o=r(86403),n=r(41580),i=r(51187),s=0/0,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return s;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=o(e);var r=u.test(e);return r||l.test(e)?c(e.slice(2),r?2:8):a.test(e)?s:+e}},5018(e){e.exports=function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},44668(e,t,r){var o=r(56347);function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},70604(e){e.exports=function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},90250(e,t,r){var o=r(3634),n=r(70604),i=r(78243),s=r(5523);e.exports=function(e){return o(e)||n(e)||i(e)||s()},e.exports.__esModule=!0,e.exports.default=e.exports},23878(e,t,r){var o=r(14319).default;e.exports=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=o(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},56347(e,t,r){var o=r(14319).default,n=r(23878);e.exports=function(e){var t=n(e,"string");return"symbol"==o(t)?t:t+""},e.exports.__esModule=!0,e.exports.default=e.exports},14319(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},75720(e,t,r){r.d(t,{p:()=>p,sh:()=>d});var o,n,i=r(90250),s=r(99436),a=r(5018),u=r(44668),l=r(31421),c=r(73024),p=()=>{var e=process.argv[1];return e&&!(e.includes("$bunfs")||e.includes("~BUN"))&&(0,c.existsSync)(e)?[process.execPath,e]:[process.execPath]},f=u(function e(t){a(this,e),this._cwd=void 0,this._mode="default",this._throw=!0,this._env=void 0,this._promise=null,this.args=t},[{key:"cwd",value:function(e){return this._cwd=e,this}},{key:"quiet",value:function(){return this._mode="quiet",this}},{key:"nothrow",value:function(){return this._throw=!1,this}},{key:"env",value:function(e){return this._env={...this._env,...e},this}},{key:"text",value:(o=s(function*(){return"default"===this._mode&&(this._mode="text"),(yield this.run()).stdout.toString("utf8")}),function(){return o.apply(this,arguments)})},{key:"then",value:function(e,t){return this.run().then(e,t)}},{key:"run",value:function(){return this._promise||(this._promise=this.exec()),this._promise}},{key:"exec",value:(n=s(function*(){var e=i(this.args),t=e[0],r=(function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o})(e).slice(1);if(!t)throw Error("sh: empty command");var o="default"===this._mode?["inherit","pipe","pipe"]:"quiet"===this._mode?["ignore","pipe","pipe"]:["inherit","pipe","pipe"],n=this._env?{...process.env,...this._env}:void 0,s=(0,l.spawn)(t,r,{cwd:this._cwd,stdio:o,env:n}),a=[],u=[];s.stdout?.on("data",e=>{a.push(e),"default"===this._mode&&process.stdout.write(e)}),s.stderr?.on("data",e=>{u.push(e),"default"===this._mode&&process.stderr.write(e)});var c=yield new Promise((e,t)=>{s.on("error",t),s.on("close",(t,r)=>e({code:t,signal:r}))}),p=c.code,f=c.signal,h=p??1,d=Buffer.concat(a),v=Buffer.concat(u);if(0!==h&&this._throw){var y=f?`signal ${f}`:`exit ${h}`,m=Error(`sh: command failed with ${y}: ${this.args.join(" ")}`);throw m.exitCode=h,m.stdout=d,m.stderr=v,m}return{exitCode:h,stdout:d,stderr:v}}),function(){return n.apply(this,arguments)})}]),h=/\s/;function d(e,...t){var r,o,n,i,s,a=(r=[],o="",n=!1,i=()=>{n&&(r.push(o),o="",n=!1)},s=e=>{o+=e,n=!0},(e.forEach((e,r)=>{for(var o=0;o<e.length;o++){var n=e[o];h.test(n)?i():s(n)}r<t.length&&(e=>{if(null!=e){if(Array.isArray(e))return e.forEach((e,t)=>{t>0&&i(),s(String(e))});s(String(e))}})(t[r])}),i(),r.length>=3&&"cd"===r[0]&&"&&"===r[2])?{tokens:r.slice(3),initialCwd:r[1]}:{tokens:r}),u=a.tokens,l=a.initialCwd,c=new f(u);return l&&c.cwd(l),c}},16749(e,t,r){r.d(t,{W:()=>s});var o=r(73024),n=r(76760),i=r(73136);function s(e){var t=(0,n.dirname)((0,i.fileURLToPath)(e)),r=[(0,n.join)(t,"simulator-main.mjs"),(0,n.join)(t,"..","simulator-main.mjs"),(0,n.join)((0,n.dirname)(process.execPath),"simulator-main.mjs")];for(var s of r)if((0,o.existsSync)(s))return s;throw Error(`Unable to locate the simulator entry (simulator-main.mjs). Probed paths:
1
+ export const __rspack_esm_id=9320;export const __rspack_esm_ids=[9320];export const __webpack_modules__={65650(e,t,r){e.exports=r(78942).Symbol},87379(e,t,r){var o=r(65650),n=r(8870),s=r(29005),i=o?o.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?n(e):s(e)}},86403(e,t,r){var o=r(62945),n=/^\s+/;e.exports=function(e){return e?e.slice(0,o(e)+1).replace(n,""):e}},74967(e){e.exports="object"==typeof global&&global&&global.Object===Object&&global},8870(e,t,r){var o=r(65650),n=Object.prototype,s=n.hasOwnProperty,i=n.toString,a=o?o.toStringTag:void 0;e.exports=function(e){var t=s.call(e,a),r=e[a];try{e[a]=void 0;var o=!0}catch(e){}var n=i.call(e);return o&&(t?e[a]=r:delete e[a]),n}},29005(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},78942(e,t,r){var o=r(74967),n="object"==typeof self&&self&&self.Object===Object&&self;e.exports=o||n||Function("return this")()},62945(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},12784(e,t,r){var o=r(41580),n=r(94495),s=r(6131),i=Math.max,a=Math.min;e.exports=function(e,t,r){var u,c,l,p,h,d,f=0,v=!1,y=!1,m=!0;if("function"!=typeof e)throw TypeError("Expected a function");function x(t){var r=u,o=c;return u=c=void 0,f=t,p=e.apply(o,r)}function b(e){var r=e-d,o=e-f;return void 0===d||r>=t||r<0||y&&o>=l}function g(){var e,r,o,s=n();if(b(s))return w(s);h=setTimeout(g,(e=s-d,r=s-f,o=t-e,y?a(o,l-r):o))}function w(e){return(h=void 0,m&&u)?x(e):(u=c=void 0,p)}function _(){var e,r=n(),o=b(r);if(u=arguments,c=this,d=r,o){if(void 0===h)return f=e=d,h=setTimeout(g,t),v?x(e):p;if(y)return clearTimeout(h),h=setTimeout(g,t),x(d)}return void 0===h&&(h=setTimeout(g,t)),p}return t=s(t)||0,o(r)&&(v=!!r.leading,l=(y="maxWait"in r)?i(s(r.maxWait)||0,t):l,m="trailing"in r?!!r.trailing:m),_.cancel=function(){void 0!==h&&clearTimeout(h),f=0,u=d=c=h=void 0},_.flush=function(){return void 0===h?p:w(n())},_}},41580(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},80547(e){e.exports=function(e){return null!=e&&"object"==typeof e}},51187(e,t,r){var o=r(87379),n=r(80547);e.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==o(e)}},94495(e,t,r){var o=r(78942);e.exports=function(){return o.Date.now()}},6131(e,t,r){var o=r(86403),n=r(41580),s=r(51187),i=0/0,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(s(e))return i;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=o(e);var r=u.test(e);return r||c.test(e)?l(e.slice(2),r?2:8):a.test(e)?i:+e}},5018(e){e.exports=function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},44668(e,t,r){var o=r(56347);function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},70604(e){e.exports=function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},90250(e,t,r){var o=r(3634),n=r(70604),s=r(78243),i=r(5523);e.exports=function(e){return o(e)||n(e)||s(e)||i()},e.exports.__esModule=!0,e.exports.default=e.exports},23878(e,t,r){var o=r(14319).default;e.exports=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=o(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},56347(e,t,r){var o=r(14319).default,n=r(23878);e.exports=function(e){var t=n(e,"string");return"symbol"==o(t)?t:t+""},e.exports.__esModule=!0,e.exports.default=e.exports},14319(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},75720(e,t,r){r.d(t,{p:()=>p,sh:()=>f});var o,n,s=r(90250),i=r(99436),a=r(5018),u=r(44668),c=r(31421),l=r(73024),p=()=>{var e=process.argv[1];return e&&!(e.includes("$bunfs")||e.includes("~BUN"))&&(0,l.existsSync)(e)?[process.execPath,e]:[process.execPath]},h=u(function e(t){a(this,e),this._cwd=void 0,this._mode="default",this._throw=!0,this._env=void 0,this._promise=null,this.args=t},[{key:"cwd",value:function(e){return this._cwd=e,this}},{key:"quiet",value:function(){return this._mode="quiet",this}},{key:"nothrow",value:function(){return this._throw=!1,this}},{key:"env",value:function(e){return this._env={...this._env,...e},this}},{key:"text",value:(o=i(function*(){return"default"===this._mode&&(this._mode="text"),(yield this.run()).stdout.toString("utf8")}),function(){return o.apply(this,arguments)})},{key:"then",value:function(e,t){return this.run().then(e,t)}},{key:"run",value:function(){return this._promise||(this._promise=this.exec()),this._promise}},{key:"exec",value:(n=i(function*(){var e=s(this.args),t=e[0],r=(function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o})(e).slice(1);if(!t)throw Error("sh: empty command");var o="default"===this._mode?["inherit","pipe","pipe"]:"quiet"===this._mode?["ignore","pipe","pipe"]:["inherit","pipe","pipe"],n=this._env?{...process.env,...this._env}:void 0,i=(0,c.spawn)(t,r,{cwd:this._cwd,stdio:o,env:n}),a=[],u=[];i.stdout?.on("data",e=>{a.push(e),"default"===this._mode&&process.stdout.write(e)}),i.stderr?.on("data",e=>{u.push(e),"default"===this._mode&&process.stderr.write(e)});var l=yield new Promise((e,t)=>{i.on("error",t),i.on("close",(t,r)=>e({code:t,signal:r}))}),p=l.code,h=l.signal,d=p??1,f=Buffer.concat(a),v=Buffer.concat(u);if(0!==d&&this._throw){var y=h?`signal ${h}`:`exit ${d}`,m=Error(`sh: command failed with ${y}: ${this.args.join(" ")}`);throw m.exitCode=d,m.stdout=f,m.stderr=v,m}return{exitCode:d,stdout:f,stderr:v}}),function(){return n.apply(this,arguments)})}]),d=/\s/;function f(e,...t){var r,o,n,s,i,a=(r=[],o="",n=!1,s=()=>{n&&(r.push(o),o="",n=!1)},i=e=>{o+=e,n=!0},(e.forEach((e,r)=>{for(var o=0;o<e.length;o++){var n=e[o];d.test(n)?s():i(n)}r<t.length&&(e=>{if(null!=e){if(Array.isArray(e))return e.forEach((e,t)=>{t>0&&s(),i(String(e))});i(String(e))}})(t[r])}),s(),r.length>=3&&"cd"===r[0]&&"&&"===r[2])?{tokens:r.slice(3),initialCwd:r[1]}:{tokens:r}),u=a.tokens,c=a.initialCwd,l=new h(u);return c&&l.cwd(c),l}},16749(e,t,r){r.d(t,{W:()=>i});var o=r(73024),n=r(76760),s=r(73136);function i(e){var t=(0,n.dirname)((0,s.fileURLToPath)(e)),r=[(0,n.join)(t,"simulator-main.mjs"),(0,n.join)(t,"..","simulator-main.mjs"),(0,n.join)((0,n.dirname)(process.execPath),"simulator-main.mjs")];for(var i of r)if((0,o.existsSync)(i))return i;throw Error(`Unable to locate the simulator entry (simulator-main.mjs). Probed paths:
2
2
  ${r.map(e=>` - ${e}`).join("\n")}
3
- If you installed the standalone bricks binary, re-run the installer to restore the simulator assets.`)}},7931(e,t,r){r.r(t),r.d(t,{simulator:()=>f});var o=r(99436),n=r(31421),i=r(51455),s=r(73024),a=r(80481),u=r(57975),l=r(12784),c=r(75720),p=r(16749);function f(){return h.apply(this,arguments)}function h(){return(h=o(function*(e=[]){var t,r=(0,u.parseArgs)({args:e,options:{"skip-typecheck":{type:"boolean"},"clear-cache":{type:"boolean"},screenshot:{type:"boolean"},"screenshot-delay":{type:"string"},"screenshot-width":{type:"string"},"screenshot-height":{type:"string"},"screenshot-path":{type:"string"},"screenshot-no-headless":{type:"boolean"},"show-menu":{type:"boolean"},"test-id":{type:"string"},"test-title-like":{type:"string"},"no-keep-open":{type:"boolean"},"cdp-port":{type:"string"},"no-cdp":{type:"boolean"},"capture-plan":{type:"string"}},strict:!0,allowPositionals:!0}).values,f=process.cwd(),h=JSON.parse((yield(0,i.readFile)(`${f}/application.json`,"utf8"))),d=[];r["clear-cache"]&&d.push("--clear-cache");var v=!0;if(r.screenshot&&(d.push("--take-screenshot"),d.push(JSON.stringify({delay:Number(r["screenshot-delay"])||1e3,width:Number(r["screenshot-width"])||600,height:Number(r["screenshot-height"])||480,path:r["screenshot-path"]||`${f}/screenshot.jpg`,noHeadless:r["screenshot-no-headless"]??!1})),v=!r["no-keep-open"]),r["capture-plan"]&&(d.push("--capture-plan",r["capture-plan"]),v=!1),r["show-menu"]&&d.push("--show-menu"),r["test-id"]&&d.push("--test-id",r["test-id"]),r["test-title-like"]&&d.push("--test-title-like",r["test-title-like"]),r["no-keep-open"]&&d.push("--no-keep-open"),!r["no-cdp"]){var y=parseInt(r["cdp-port"]||"",10)||19852;d.push("--cdp-port",String(y))}var m=!r["skip-typecheck"],b=(t=o(function*(){yield(0,c.sh)`${(0,c.p)()} ctor compile ${m?[]:["--no-check"]}`}),function(){return t.apply(this,arguments)});yield b();var x=null;if(v){var g=l(b,500);x=(0,s.watch)(`${f}/subspaces`,{recursive:!0},(e,t)=>{console.log(`Detected ${e} in ${t}`),g()})}var _=`${f}/.bricks/devtools.json`,w=()=>{try{(0,s.unlinkSync)(_)}catch{}};try{var k=JSON.parse((yield(0,i.readFile)(_,"utf8")));if(k.pid){try{process.kill(k.pid)}catch{}w()}}catch{}var S=(0,p.W)("file:///Users/jhen/workspace/mybigday-bricks/packages/bricks-cli/src/ctor/tools/simulator.js"),j=(0,n.spawn)("bunx",["--bun","electron",S,...d],{env:{...process.env,BRICKS_STAGE:h.stage||"production"},stdio:["inherit","pipe","inherit"]});(0,a.createInterface)({input:j.stdout}).on("line",e=>{if(e.startsWith("[TEST_RESULT_TOON]"))return void console.log(e.replace("[TEST_RESULT_TOON]",""));if(e){var t=e.match(/^CDP server: ws:\/\/localhost:(\d+)/);if(t){var r={port:parseInt(t[1],10),pid:j.pid,address:"localhost",name:`${h.name||"Unnamed"} (CTOR Simulator)`,startedAt:new Date().toISOString()};(0,i.writeFile)(_,JSON.stringify(r,null,2))}console.log(e)}}),yield new Promise(e=>{j.on("close",()=>e())}),w(),x&&x.close()})).apply(this,arguments)}}};
3
+ If you installed the standalone bricks binary, re-run the installer to restore the simulator assets.`)}},7931(e,t,r){r.r(t),r.d(t,{simulator:()=>d});var o=r(99436),n=r(31421),s=r(51455),i=r(73024),a=r(80481),u=r(57975),c=r(12784),l=r(75720),p=r(16749),h=`Usage: bricks ctor simulator [options]
4
+
5
+ Compile the project and run it in the web-preview Simulator. Without
6
+ --no-keep-open the Simulator stays open and reloads on source changes.
7
+
8
+ Options:
9
+ --test-id <id> Run the Automation test with this id
10
+ --test-title-like <text> Run the Automation test whose title contains the text
11
+ --screenshot Take a screenshot (see the --screenshot-* options)
12
+ --screenshot-path <file> Screenshot file (default: ./screenshot.jpg)
13
+ --screenshot-delay <ms> Wait before the screenshot (default: 1000)
14
+ --screenshot-width <px> Screenshot width (default: 600)
15
+ --screenshot-height <px> Screenshot height (default: 480)
16
+ --screenshot-no-headless Show the window during the screenshot
17
+ --no-keep-open Exit after the test / screenshot
18
+ --cdp-port <port> DevTools (CDP) port (default: 19852)
19
+ --no-cdp Do not start the DevTools (CDP) server
20
+ --skip-typecheck Compile without the type check
21
+ --clear-cache Clear the preview cache at start
22
+ --show-menu Show the preview menu
23
+ -h, --help Show this help
24
+ `;function d(){return f.apply(this,arguments)}function f(){return(f=o(function*(e=[]){var t,r=(0,u.parseArgs)({args:e,options:{help:{type:"boolean",short:"h"},"skip-typecheck":{type:"boolean"},"clear-cache":{type:"boolean"},screenshot:{type:"boolean"},"screenshot-delay":{type:"string"},"screenshot-width":{type:"string"},"screenshot-height":{type:"string"},"screenshot-path":{type:"string"},"screenshot-no-headless":{type:"boolean"},"show-menu":{type:"boolean"},"test-id":{type:"string"},"test-title-like":{type:"string"},"no-keep-open":{type:"boolean"},"cdp-port":{type:"string"},"no-cdp":{type:"boolean"},"capture-plan":{type:"string"}},strict:!0,allowPositionals:!0}).values;if(r.help)return void process.stdout.write(h);var d=process.cwd(),f=JSON.parse((yield(0,s.readFile)(`${d}/application.json`,"utf8"))),v=[];r["clear-cache"]&&v.push("--clear-cache");var y=!0;if(r.screenshot&&(v.push("--take-screenshot"),v.push(JSON.stringify({delay:Number(r["screenshot-delay"])||1e3,width:Number(r["screenshot-width"])||600,height:Number(r["screenshot-height"])||480,path:r["screenshot-path"]||`${d}/screenshot.jpg`,noHeadless:r["screenshot-no-headless"]??!1})),y=!r["no-keep-open"]),r["capture-plan"]&&(v.push("--capture-plan",r["capture-plan"]),y=!1),r["show-menu"]&&v.push("--show-menu"),r["test-id"]&&v.push("--test-id",r["test-id"]),r["test-title-like"]&&v.push("--test-title-like",r["test-title-like"]),r["no-keep-open"]&&v.push("--no-keep-open"),!r["no-cdp"]){var m=parseInt(r["cdp-port"]||"",10)||19852;v.push("--cdp-port",String(m))}var x=!r["skip-typecheck"],b=(t=o(function*(){yield(0,l.sh)`${(0,l.p)()} ctor compile ${x?[]:["--no-check"]}`}),function(){return t.apply(this,arguments)});yield b();var g=null;if(y){var w=c(b,500);g=(0,i.watch)(`${d}/subspaces`,{recursive:!0},(e,t)=>{console.log(`Detected ${e} in ${t}`),w()})}var _=`${d}/.bricks/devtools.json`,k=()=>{try{(0,i.unlinkSync)(_)}catch{}};try{var S=JSON.parse((yield(0,s.readFile)(_,"utf8")));if(S.pid){try{process.kill(S.pid)}catch{}k()}}catch{}var j=(0,p.W)("file:///Users/jhen/workspace/mybigday-bricks/packages/bricks-cli/src/ctor/tools/simulator.js"),T=(0,n.spawn)("bunx",["--bun","electron",j,...v],{env:{...process.env,BRICKS_STAGE:f.stage||"production"},stdio:["inherit","pipe","inherit"]});(0,a.createInterface)({input:T.stdout}).on("line",e=>{if(e.startsWith("[TEST_RESULT_TOON]"))return void console.log(e.replace("[TEST_RESULT_TOON]",""));if(e){var t=e.match(/^CDP server: ws:\/\/localhost:(\d+)/);if(t){var r={port:parseInt(t[1],10),pid:T.pid,address:"localhost",name:`${f.name||"Unnamed"} (CTOR Simulator)`,startedAt:new Date().toISOString()};(0,s.writeFile)(_,JSON.stringify(r,null,2))}console.log(e)}});try{var O=yield new Promise((e,t)=>{T.on("error",t),T.on("close",(t,r)=>e({code:t,signal:r}))}),$=O.code,E=O.signal;if(0!==$)throw Error(`Simulator exited with ${E?`signal ${E}`:`code ${$}`}`)}finally{k(),g&&g.close()}})).apply(this,arguments)}}};
package/lib/9439.js CHANGED
@@ -2520,7 +2520,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2520
2520
  timestamp
2521
2521
  }
2522
2522
  }
2523
- `,t1=Q(function e(i,t){var n;Z(this,e),this.baseUrl=i,this.auth="string"==typeof t?{token:t,getHeaders:(n=h(function*(){return{authorization:`Bearer ${t}`}}),function(){return n.apply(this,arguments)})}:t,this.token=this.auth?.token,this.graphqlUrl=`${i}/api/graphql`},[{key:"authHeaders",value:(o=h(function*(){var e=yield this.auth.getHeaders();return{Authorization:e.authorization,...tX(e,tQ)}}),function(){return o.apply(this,arguments)})},{key:"graphql",value:(r=h(function*(e,i){var t=yield(0,E.Ay)(this.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",...yield this.authHeaders(),Accept:"application/json"},body:JSON.stringify({query:e,variables:i})});if(!t.ok){var n=yield t.text().catch(()=>"");throw Error(`Activity-log query failed (${t.status}): ${n}`)}var a=yield t.json();if(a.errors?.length)throw Error(a.errors.map(e=>e.message).join("\n"));return a.data}),function(e,i){return r.apply(this,arguments)})},{key:"events",value:(s=h(function*(e,{limit:i,offset:t}={}){var n={...e};return null!=i&&(n.limit=i),null!=t&&(n.offset=t),(yield this.graphql(tZ,{filter:n})).events}),function(e){return s.apply(this,arguments)})},{key:"screenshots",value:(d=h(function*(e){return(yield this.graphql(t0,{filter:e})).screenshots}),function(e){return d.apply(this,arguments)})},{key:"downloadScreenshot",value:(c=h(function*(e,i,t){var n=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(i)}/screenshot?ts=${encodeURIComponent(t)}`,a=yield(0,E.Ay)(n,{headers:yield this.authHeaders()});if(!a.ok){var o=yield a.text().catch(()=>"");throw Error(`Screenshot fetch failed (${a.status}): ${o}`)}return Buffer.from((yield a.arrayBuffer()))}),function(e,i,t){return c.apply(this,arguments)})}]);function t4(e,i,t){switch(t){case"user":return new iO(e,i);case"workspace":return new tn(e,i);default:throw Error(`Invalid token type: ${t}.`)}}process.env.STAGE,process.env.URL_BASE;var t6="bricks-mcp",t2={bricks:process.env.BRICKS_API_SERVER||"https://display-beta.bricks.tools",media:process.env.MEDIA_API_SERVER||"https://media-beta.bricks.tools",activityLog:process.env.ACTIVITY_LOG_API_SERVER||"https://activity-log-beta.bricks.tools"};process.env.AUTH0_DOMAIN,process.env.CACHE_URL;var t5=t(1639);let t9=({type:e,title:i,template_key:t})=>{var n,a,o=(0,t5.M4)(e);switch(e){case"subspace":n={title:i,layout:{width:"number",height:"number"},root_canvas_id:"CANVAS_<UUID>",canvas_map:{},brick_map:{},animation_map:{},generator_map:{},property_bank_map:{},property_bank_calc_map:{}},a={"canvas_map.CANVAS_<UUID>.item_list":[{type:"subspace",subspace_id:"SUBSPACE_<UUID>",$note:"If not a root subspace, it can be linked to canvas in other subspace"}]};break;case"canvas":var r=G(K.Ji);n={title:i,item_list:[],property:{$definitions:Object.fromEntries(Object.entries(r.propTypes).map(([e,i])=>[e,{...i,description:r.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(r.eventTypes).map(([e])=>[e,{description:r.brickEventDescriptions[e]}]))}},a={property_bank_map:{[(0,t5.M4)("property_bank")]:{title:`Canvas ID: ${i}`,type:"string",value:o,routing:"read-only",kind:"auto-generated-item-id",idType:"canvas"}}};break;case"brick":var s=G(K.dK.Basic),d=G(K.brickMapping[t]);if(!d)throw Error(`Brick ${t} not found`);var c={...d,propTypes:{...s.propTypes,...d.propTypes},brickPropDescriptions:{...s.brickPropDescriptions,...d.brickPropDescriptions},eventTypes:{...s.eventTypes,...d.eventTypes},brickEventDescriptions:{...s.brickEventDescriptions,...d.brickEventDescriptions}};n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(c.propTypes).map(([e,i])=>[e,{...i,description:c.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(c.eventTypes).map(([e])=>[e,{description:c.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(c.outletTypes??{}).map(([e])=>[e,{description:(c.brickOutletDescriptions??{})[e]}]))},state_group:{"BRICK_STATE_GROUP_<UUID>":{}}},a={canvas_map:{"CANVAS_<UUID WHICH NEED DISPLAY THIS BRICK>":{item_list:[{type:"brick",brick_id:o,frame:{x:"number",y:"number",width:"number",height:"number",standby_mode:"custom|top|left|right|bottom",standby_delay:"number",standby_easing:{default:{method:"ease",duration:"number"}}}}]}}};break;case"state_group":n={title:i,description:"State Group Description",conds:[{type:"property_bank|inner_state",key:"PROPERTY_BANK#<Data Node ID>|[current_canvas|BRICK_<OUTLET NAME>]|",method:"==|!=|>|>=|<|<=",value:"value_to_compare"}],override:{property:!1,event:!1,outlet:!1},commented:!1,break:!1,property:{},outlet:{},animation:{}};break;case"generator":var l=G(K.generatorMapping[t]);if(!l)throw Error(`Generator ${t} not found`);n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(l.propTypes).map(([e,i])=>[e,{...i,description:l.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(l.eventTypes).map(([e])=>[e,{description:l.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(l.outletTypes).map(([e])=>[e,{description:l.brickOutletDescriptions[e]}]))}};break;case"animation":n={title:i,type:"timing|decay|spring",property:"opacity|transform.translateX|transform.scale|etc",config:{$note:"Config for the animation"},compose_type:"parallel|sequence",item_list:[{animation_id:"ANIMATION_<SUB ANIMATION UUID>"}]};break;case"property_bank":n={title:i,description:"Property Bank Description",linkedFrom:"SUBSPACE_<UUID WHICH IS CROSS SUBSPACE>",type:"string|number|bool|object|array|any",kind:"color|datetime|id|media-resource-*|lottie-file-uri",unit:"grid|px|ms",routing:"read-only|default",value:"fit-to-type",event_map:{$note:`Available events: ${Object.keys(K.qJ.eventTypes).join(", ")}`},local_sync:{update_mode:"all|main-only|minor-only|dont-sync"},$remote_update_additional:{$note:"Configure remote update behavior",enable_remote_update:!0,bank_type:"create|create-device-specific"}};break;case"property_bank_command":break;case"property_bank_calc":var p=(0,t5.M4)("property_bank_command"),u=(0,t5.M4)("property_bank_command"),m=(0,t5.M4)("property_bank_command"),_="const { arg_name } = inputs;\n\nreturn { arg_name };";n={title:i,map:{$note:"Required, actual implementation","PROPERTY_BANK_DATA_NODE_<UUID>":{type:"data-node",properties:{},in:{change:null},out:{value:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID>",port:"value"}]},$note:"Use this to input data to the sandbox"},"PROPERTY_BANK_COMMAND_NODE_<UUID FIRST>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:null,path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${p}`,port:"obj | inputs"}]}},"PROPERTY_BANK_COMMAND_NODE_<UUID SECOND>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PREVIOUS>",port:"result"}],path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID SECOND>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${p}`,port:"obj | inputs"}]}},[p]:{type:"command-node-sandbox",title:"Command: SANDBOX_RUN_JAVASCRIPT",properties:{command:"SANDBOX_RUN_JAVASCRIPT",args:{code:_,enable_async:!1}},in:{code:null,inputs:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID FINAL>",port:"result"}]},out:{result:[{id:m,port:"result"},{id:u,port:"result"}]}},[m]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_ERROR",properties:{command:"SANDBOX_GET_ERROR"},in:{result:[{id:p,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR>",port:"change"}],$note:"Set `result` as null if there is no error"}},[u]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_RETURN_VALUE",properties:{command:"SANDBOX_GET_RETURN_VALUE"},in:{result:[{id:p,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT> | null",port:"change"}]}},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT>":{type:"data-node",properties:{},in:{change:[{id:u,port:"result"}]},out:{value:null},$note:"Put full result into data node"},"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>":{type:"command-node-object",title:"Command: OBJECT_GET",properties:{command:"OBJECT_GET",args:{path:"obj_key"}},in:{obj:[{id:u,port:"obj"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>",port:"change"}]},$note:"Parse result object into data node"},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>":{type:"data-node",properties:{},in:{change:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>",port:"result"}]},out:{value:null},$note:"Put partial result into data node"}},editor_info:{},type:"script",script_config:{title:i,enable_async:!1,inputs:{"PROPERTY_BANK_DATA_NODE_<UUID>":"arg_name"},disabled_triggers:{},error:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR> | null",output:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | null",outputs:{obj_key:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>"},code:_,$note:"Required, info for GUI editor"}}}return x({id:o,example:n,extraInfo:a})};var t3=(l=h(function*(e,i){var t=new AbortController,n=setTimeout(()=>t.abort(),15e3);try{var a=yield(0,E.Ay)(e,{agent:i,size:0x6400000,signal:t.signal});if(!a.ok)throw Error(`source_url responded with HTTP ${a.status}`);var o=Number(a.headers.get("content-length"));if(Number.isFinite(o)&&o>0x6400000)throw Error("source_url response exceeds the 100 MiB download limit");var r=a.headers.get("content-type")||"application/octet-stream";return{data:yield a.blob(),contentType:r}}catch(e){if(e?.name==="AbortError")throw Error("source_url download exceeded the 15s time limit");throw e}finally{clearTimeout(n)}}),function(e,i){return l.apply(this,arguments)}),t8="2.26.0-beta.17";function t7(){return ne.apply(this,arguments)}function ne(){return(ne=h(function*(e={}){var i,t,n=e.baseUrl||t2.bricks,a=e.activityLogBaseUrl||t2.activityLog,o=!e.token&&!!e.getAuthHeaders,r=e.token||!e.getAuthHeaders&&process.env.BRICKS_API_TOKEN,s=null;if(!r&&e.getAuthHeaders){var d=yield e.getAuthHeaders();r=d.authorization?.replace(/^Bearer /,""),s=d["x-bricks-workspace-id"]||null}if(!r)throw console.error("Error: API token is required"),console.error(o?"OAuth sign-in did not produce credentials. Run `bricks auth login` again.":"Please provide a token via options or set BRICKS_API_TOKEN environment variable"),Error("API token is required");var c=function(e){try{var i=e.queryStringParameters?.token;if(!i){var t=new Headers(e.headers);i=t.get("authorization")?.replace("Bearer ","")}if(!i)return{success:!1,message:"Authentication failed: No token provided"};var n=function(e){try{var i=e.split(".");if(i.length<3)return null;var t=JSON.parse(Buffer.from(i[0],"base64url").toString());if(!A.includes(t?.alg))return null;return JSON.parse(Buffer.from(i[1],"base64url").toString())}catch{return null}}(i);if(!n)return{success:!1,message:"Authentication failed: Invalid token"};var a=S.includes(n.iss)?"user":"workspace";if("workspace"===a){var o=Array.isArray(n.t)?n.t:[];n.permissions=o.reduce((e,i)=>{var t=D[i];return t&&e.push(t),e},[])}else n.permissions=Object.keys(k);return{success:!0,token:i,tokenInfo:n,tokenType:a}}catch(e){return{success:!1,message:`Authentication failed: ${e.message}`}}}({queryStringParameters:{token:r}});if(!c.success){var l=o?"Invalid OAuth session credentials — run `bricks auth login` again":"Invalid BRICKS_API_TOKEN";throw console.error(`Error: ${l}`),console.error(c.message),Error(l)}var p=new b._({name:t6,version:t8});if(e.getAuthHeaders&&s){var u={token:r,getHeaders:e.getAuthHeaders};t={...c,tokenType:"workspace",tokenInfo:{...c.tokenInfo,w_id:s,permissions:Object.keys(k)},auth:u,client:t4(n,u,"workspace")}}else t={...c,client:t4(n,c.token,c.tokenType)};p.prompt("getting-started","Getting started with BRICKS",{},h(function*(){return{messages:[{role:"user",content:{type:"text",text:`Welcome to BRICKS — start here.
2523
+ `,t1=Q(function e(i,t){var n;Z(this,e),this.baseUrl=i,this.auth="string"==typeof t?{token:t,getHeaders:(n=h(function*(){return{authorization:`Bearer ${t}`}}),function(){return n.apply(this,arguments)})}:t,this.token=this.auth?.token,this.graphqlUrl=`${i}/api/graphql`},[{key:"authHeaders",value:(o=h(function*(){var e=yield this.auth.getHeaders();return{Authorization:e.authorization,...tX(e,tQ)}}),function(){return o.apply(this,arguments)})},{key:"graphql",value:(r=h(function*(e,i){var t=yield(0,E.Ay)(this.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",...yield this.authHeaders(),Accept:"application/json"},body:JSON.stringify({query:e,variables:i})});if(!t.ok){var n=yield t.text().catch(()=>"");throw Error(`Activity-log query failed (${t.status}): ${n}`)}var a=yield t.json();if(a.errors?.length)throw Error(a.errors.map(e=>e.message).join("\n"));return a.data}),function(e,i){return r.apply(this,arguments)})},{key:"events",value:(s=h(function*(e,{limit:i,offset:t}={}){var n={...e};return null!=i&&(n.limit=i),null!=t&&(n.offset=t),(yield this.graphql(tZ,{filter:n})).events}),function(e){return s.apply(this,arguments)})},{key:"screenshots",value:(d=h(function*(e){return(yield this.graphql(t0,{filter:e})).screenshots}),function(e){return d.apply(this,arguments)})},{key:"downloadScreenshot",value:(c=h(function*(e,i,t){var n=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(i)}/screenshot?ts=${encodeURIComponent(t)}`,a=yield(0,E.Ay)(n,{headers:yield this.authHeaders()});if(!a.ok){var o=yield a.text().catch(()=>"");throw Error(`Screenshot fetch failed (${a.status}): ${o}`)}return Buffer.from((yield a.arrayBuffer()))}),function(e,i,t){return c.apply(this,arguments)})}]);function t4(e,i,t){switch(t){case"user":return new iO(e,i);case"workspace":return new tn(e,i);default:throw Error(`Invalid token type: ${t}.`)}}process.env.STAGE,process.env.URL_BASE;var t6="bricks-mcp",t2={bricks:process.env.BRICKS_API_SERVER||"https://display-beta.bricks.tools",media:process.env.MEDIA_API_SERVER||"https://media-beta.bricks.tools",activityLog:process.env.ACTIVITY_LOG_API_SERVER||"https://activity-log-beta.bricks.tools"};process.env.AUTH0_DOMAIN,process.env.CACHE_URL;var t5=t(1639);let t9=({type:e,title:i,template_key:t})=>{var n,a,o=(0,t5.M4)(e);switch(e){case"subspace":n={title:i,layout:{width:"number",height:"number"},root_canvas_id:"CANVAS_<UUID>",canvas_map:{},brick_map:{},animation_map:{},generator_map:{},property_bank_map:{},property_bank_calc_map:{}},a={"canvas_map.CANVAS_<UUID>.item_list":[{type:"subspace",subspace_id:"SUBSPACE_<UUID>",$note:"If not a root subspace, it can be linked to canvas in other subspace"}]};break;case"canvas":var r=G(K.Ji);n={title:i,item_list:[],property:{$definitions:Object.fromEntries(Object.entries(r.propTypes).map(([e,i])=>[e,{...i,description:r.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(r.eventTypes).map(([e])=>[e,{description:r.brickEventDescriptions[e]}]))}},a={property_bank_map:{[(0,t5.M4)("property_bank")]:{title:`Canvas ID: ${i}`,type:"string",value:o,routing:"read-only",kind:"auto-generated-item-id",idType:"canvas"}}};break;case"brick":var s=G(K.dK.Basic),d=G(K.brickMapping[t]);if(!d)throw Error(`Brick ${t} not found`);var c={...d,propTypes:{...s.propTypes,...d.propTypes},brickPropDescriptions:{...s.brickPropDescriptions,...d.brickPropDescriptions},eventTypes:{...s.eventTypes,...d.eventTypes},brickEventDescriptions:{...s.brickEventDescriptions,...d.brickEventDescriptions}};n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(c.propTypes).map(([e,i])=>[e,{...i,description:c.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(c.eventTypes).map(([e])=>[e,{description:c.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(c.outletTypes??{}).map(([e])=>[e,{description:(c.brickOutletDescriptions??{})[e]}]))},state_group:{"BRICK_STATE_GROUP_<UUID>":{}}},a={canvas_map:{"CANVAS_<UUID WHICH NEED DISPLAY THIS BRICK>":{item_list:[{type:"brick",brick_id:o,frame:{x:"number",y:"number",width:"number",height:"number",standby_mode:"custom|top|left|right|bottom",standby_delay:"number",standby_easing:{default:{method:"ease",duration:"number"}}}}]}}};break;case"state_group":n={title:i,description:"State Group Description",conds:[{type:"property_bank|inner_state",key:"PROPERTY_BANK#<Data Node ID>|[current_canvas|BRICK_<OUTLET NAME>]|",method:"==|!=|>|>=|<|<=",value:"value_to_compare"}],override:{property:!1,event:!1,outlet:!1},commented:!1,break:!1,property:{},outlet:{},animation:{}};break;case"generator":var l=G(K.generatorMapping[t]);if(!l)throw Error(`Generator ${t} not found`);n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(l.propTypes).map(([e,i])=>[e,{...i,description:l.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(l.eventTypes).map(([e])=>[e,{description:l.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(l.outletTypes).map(([e])=>[e,{description:l.brickOutletDescriptions[e]}]))}};break;case"animation":n={title:i,type:"timing|decay|spring",property:"opacity|transform.translateX|transform.scale|etc",config:{$note:"Config for the animation"},compose_type:"parallel|sequence",item_list:[{animation_id:"ANIMATION_<SUB ANIMATION UUID>"}]};break;case"property_bank":n={title:i,description:"Property Bank Description",linkedFrom:"SUBSPACE_<UUID WHICH IS CROSS SUBSPACE>",type:"string|number|bool|object|array|any",kind:"color|datetime|id|media-resource-*|lottie-file-uri",unit:"grid|px|ms",routing:"read-only|default",value:"fit-to-type",event_map:{$note:`Available events: ${Object.keys(K.qJ.eventTypes).join(", ")}`},local_sync:{update_mode:"all|main-only|minor-only|dont-sync"},$remote_update_additional:{$note:"Configure remote update behavior",enable_remote_update:!0,bank_type:"create|create-device-specific"}};break;case"property_bank_command":break;case"property_bank_calc":var p=(0,t5.M4)("property_bank_command"),u=(0,t5.M4)("property_bank_command"),m=(0,t5.M4)("property_bank_command"),_="const { arg_name } = inputs;\n\nreturn { arg_name };";n={title:i,map:{$note:"Required, actual implementation","PROPERTY_BANK_DATA_NODE_<UUID>":{type:"data-node",properties:{},in:{change:null},out:{value:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID>",port:"value"}]},$note:"Use this to input data to the sandbox"},"PROPERTY_BANK_COMMAND_NODE_<UUID FIRST>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:null,path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${p}`,port:"obj | inputs"}]}},"PROPERTY_BANK_COMMAND_NODE_<UUID SECOND>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PREVIOUS>",port:"result"}],path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID SECOND>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${p}`,port:"obj | inputs"}]}},[p]:{type:"command-node-sandbox",title:"Command: SANDBOX_RUN_JAVASCRIPT",properties:{command:"SANDBOX_RUN_JAVASCRIPT",args:{code:_,enable_async:!1}},in:{code:null,inputs:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID FINAL>",port:"result"}]},out:{result:[{id:m,port:"result"},{id:u,port:"result"}]}},[m]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_ERROR",properties:{command:"SANDBOX_GET_ERROR"},in:{result:[{id:p,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR>",port:"change"}],$note:"Set `result` as null if there is no error"}},[u]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_RETURN_VALUE",properties:{command:"SANDBOX_GET_RETURN_VALUE"},in:{result:[{id:p,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT> | null",port:"change"}]}},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT>":{type:"data-node",properties:{},in:{change:[{id:u,port:"result"}]},out:{value:null},$note:"Put full result into data node"},"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>":{type:"command-node-object",title:"Command: OBJECT_GET",properties:{command:"OBJECT_GET",args:{path:"obj_key"}},in:{obj:[{id:u,port:"obj"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>",port:"change"}]},$note:"Parse result object into data node"},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>":{type:"data-node",properties:{},in:{change:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>",port:"result"}]},out:{value:null},$note:"Put partial result into data node"}},editor_info:{},type:"script",script_config:{title:i,enable_async:!1,inputs:{"PROPERTY_BANK_DATA_NODE_<UUID>":"arg_name"},disabled_triggers:{},error:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR> | null",output:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | null",outputs:{obj_key:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>"},code:_,$note:"Required, info for GUI editor"}}}return x({id:o,example:n,extraInfo:a})};var t3=(l=h(function*(e,i){var t=new AbortController,n=setTimeout(()=>t.abort(),15e3);try{var a=yield(0,E.Ay)(e,{agent:i,size:0x6400000,signal:t.signal});if(!a.ok)throw Error(`source_url responded with HTTP ${a.status}`);var o=Number(a.headers.get("content-length"));if(Number.isFinite(o)&&o>0x6400000)throw Error("source_url response exceeds the 100 MiB download limit");var r=a.headers.get("content-type")||"application/octet-stream";return{data:yield a.blob(),contentType:r}}catch(e){if(e?.name==="AbortError")throw Error("source_url download exceeded the 15s time limit");throw e}finally{clearTimeout(n)}}),function(e,i){return l.apply(this,arguments)}),t8="2.26.0-beta.18";function t7(){return ne.apply(this,arguments)}function ne(){return(ne=h(function*(e={}){var i,t,n=e.baseUrl||t2.bricks,a=e.activityLogBaseUrl||t2.activityLog,o=!e.token&&!!e.getAuthHeaders,r=e.token||!e.getAuthHeaders&&process.env.BRICKS_API_TOKEN,s=null;if(!r&&e.getAuthHeaders){var d=yield e.getAuthHeaders();r=d.authorization?.replace(/^Bearer /,""),s=d["x-bricks-workspace-id"]||null}if(!r)throw console.error("Error: API token is required"),console.error(o?"OAuth sign-in did not produce credentials. Run `bricks auth login` again.":"Please provide a token via options or set BRICKS_API_TOKEN environment variable"),Error("API token is required");var c=function(e){try{var i=e.queryStringParameters?.token;if(!i){var t=new Headers(e.headers);i=t.get("authorization")?.replace("Bearer ","")}if(!i)return{success:!1,message:"Authentication failed: No token provided"};var n=function(e){try{var i=e.split(".");if(i.length<3)return null;var t=JSON.parse(Buffer.from(i[0],"base64url").toString());if(!A.includes(t?.alg))return null;return JSON.parse(Buffer.from(i[1],"base64url").toString())}catch{return null}}(i);if(!n)return{success:!1,message:"Authentication failed: Invalid token"};var a=S.includes(n.iss)?"user":"workspace";if("workspace"===a){var o=Array.isArray(n.t)?n.t:[];n.permissions=o.reduce((e,i)=>{var t=D[i];return t&&e.push(t),e},[])}else n.permissions=Object.keys(k);return{success:!0,token:i,tokenInfo:n,tokenType:a}}catch(e){return{success:!1,message:`Authentication failed: ${e.message}`}}}({queryStringParameters:{token:r}});if(!c.success){var l=o?"Invalid OAuth session credentials — run `bricks auth login` again":"Invalid BRICKS_API_TOKEN";throw console.error(`Error: ${l}`),console.error(c.message),Error(l)}var p=new b._({name:t6,version:t8});if(e.getAuthHeaders&&s){var u={token:r,getHeaders:e.getAuthHeaders};t={...c,tokenType:"workspace",tokenInfo:{...c.tokenInfo,w_id:s,permissions:Object.keys(k)},auth:u,client:t4(n,u,"workspace")}}else t={...c,client:t4(n,c.token,c.tokenType)};p.prompt("getting-started","Getting started with BRICKS",{},h(function*(){return{messages:[{role:"user",content:{type:"text",text:`Welcome to BRICKS — start here.
2524
2524
 
2525
2525
  Before doing any complex work (application design, deployments, etc.),
2526
2526
  always consult the official docs rather than guessing.
package/lib/devtools.js CHANGED
@@ -1 +1 @@
1
- import{createRequire as e}from"node:module";let r=e(import.meta.url);var t,o,n,s,a,i,l,c={84361(e){e.exports=import("ws").then(function(e){return e})},41314(e){e.exports=r("node:dgram")},51455(e){e.exports=r("node:fs/promises")},48161(e){e.exports=r("node:os")},76760(e){e.exports=r("node:path")},66442(e){e.exports=function(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=Array(r);t<r;t++)o[t]=e[t];return o},e.exports.__esModule=!0,e.exports.default=e.exports},3634(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},99436(e){function r(e,r,t,o,n,s,a){try{var i=e[s](a),l=i.value}catch(e){return void t(e)}i.done?r(l):Promise.resolve(l).then(o,n)}e.exports=function(e){return function(){var t=this,o=arguments;return new Promise(function(n,s){var a=e.apply(t,o);function i(e){r(a,n,s,i,l,"next",e)}function l(e){r(a,n,s,i,l,"throw",e)}i(void 0)})}},e.exports.__esModule=!0,e.exports.default=e.exports},96525(e){e.exports=function(e,r){var t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var o,n,s,a,i=[],l=!0,c=!1;try{if(s=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;l=!1}else for(;!(l=(o=s.call(t)).done)&&(i.push(o.value),i.length!==r);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw n}}return i}},e.exports.__esModule=!0,e.exports.default=e.exports},5523(e){e.exports=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},68832(e,r,t){var o=t(3634),n=t(96525),s=t(78243),a=t(5523);e.exports=function(e,r){return o(e)||n(e,r)||s(e,r)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},78243(e,r,t){var o=t(66442);e.exports=function(e,r){if(e){if("string"==typeof e)return o(e,r);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,r):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},13346(e,r,t){t.a(e,async function(e,o){try{t.d(r,{TB:()=>a.verifyDevToolsServer,fl:()=>s.createCdpClient,le:()=>n.le});var n=t(38372),s=t(28193),a=t(75646),i=e([s]);s=(i.then?(await i)():i)[0],o()}catch(e){o(e)}})},28193(e,r,t){t.a(e,async function(e,o){try{t.d(r,{createCdpClient:()=>d});var n,s=t(99436),a=t(84361),i=e([a]);a=(i.then?(await i)():i)[0];var l=15e3,c=({address:e,port:r,method:t,phase:o="request",closeCode:n,closeReason:s,local:a=!1})=>{var i=s?Buffer.isBuffer(s)?s.toString("utf8"):String(s):"",l="connect"===o?"before the CDP session opened":t?`while waiting for ${t}`:"during the CDP session",c=`${e}:${r}`,u=[];null!=n&&u.push(`code ${n}`),i&&u.push(`reason: ${i}`);var d=[a?`CDP client closed the connection to ${c} ${l}.`:`CDP connection to ${c} closed ${l}.`,u.length>0?`WebSocket close ${u.join(", ")}.`:null,a?null:"The DevTools server currently accepts one CDP client at a time. Another DevTools window or CLI command may have replaced this session. Retry the command, close the other inspector, or avoid running DevTools commands in parallel."].filter(Boolean).join("\n"),p=Error(d);return p.code="CDP_CONNECTION_CLOSED",p.method=t,p.phase=o,p.closeCode=n,p.closeReason=i,p},u=(n=s(function*(e,r,t){var o,n=t?"string"==typeof t?{passcode:t}:t:{},s=n.passcode,a=n.accessToken;if(a)return`ws://${e}:${r}/ws?access_token=${encodeURIComponent(a)}`;if(!s)try{var i=new AbortController;o=setTimeout(()=>i.abort(),3e3);var l=yield fetch(`http://${e}:${r}/json/list`,{signal:i.signal});if(l.ok){var c=yield l.json(),u=c?.[0]?.webSocketDebuggerUrl;if(u){var d=u.match(/\/ws(?:\/.*)?$/);if(d)return`ws://${e}:${r}${d[0]}`}}}catch{}finally{void 0!==o&&clearTimeout(o)}return s?`ws://${e}:${r}/ws/${encodeURIComponent(s)}`:`ws://${e}:${r}/ws`}),function(e,r,t){return n.apply(this,arguments)}),d=(e,r,t)=>{var o,n,i=0,d=new Map,p=new Map,f=null,v=0,h=e=>{for(var r of d.values()){var t=r.reject,o=r.timer,n=r.method;clearTimeout(o),t(e(n))}d.clear()};return{connect:(o=s(function*(){var o=++v,s=yield u(e,r,t);if(o!==v)throw c({address:e,port:r,phase:"connect",local:!0});return new Promise((t,o)=>{n=new a.WebSocket(s,{handshakeTimeout:l});var i=!1;n.once("open",()=>{i=!0,f=null,t()}),n.once("error",t=>{i||o(Error(t.message||`Cannot connect to ${e}:${r}`))}),n.on("message",e=>{try{var r=JSON.parse(e.toString());if(null!=r.id&&d.has(r.id)){var t=d.get(r.id),o=t.resolve,n=t.reject,s=t.timer;clearTimeout(s),d.delete(r.id),r.error?n(Error(r.error.message)):o(r.result);return}if(r.method){var a=p.get(r.method);if(a)for(var i of a)i(r.params)}}catch{}}),n.on("close",(t,n)=>{f={closeCode:t,closeReason:n},i||o(c({address:e,port:r,phase:"connect",closeCode:t,closeReason:n})),h(o=>c({address:e,port:r,method:o,closeCode:t,closeReason:n}))})})}),function(){return o.apply(this,arguments)}),send:(t,o={},s=l)=>new Promise((a,l)=>{if(!n||n.readyState!==n.OPEN)return f?void l(c({address:e,port:r,method:t,closeCode:f.closeCode,closeReason:f.closeReason})):void l(Error(`Not connected to CDP at ${e}:${r} while sending ${t}`));var u=++i,p=setTimeout(()=>{d.delete(u),l(Error(`Timeout: ${t}`))},s);d.set(u,{resolve:a,reject:l,timer:p,method:t}),n.send(JSON.stringify({id:u,method:t,params:o}))}),on:(e,r)=>{p.has(e)||p.set(e,[]),p.get(e).push(r)},off:(e,r)=>{var t=p.get(e);if(t){var o=t.indexOf(r);o>=0&&t.splice(o,1)}},close:()=>{v++,h(t=>c({address:e,port:r,method:t,local:!0})),n&&(n.terminate(),n=null)}}};o()}catch(e){o(e)}})},38372(e,r,t){t.d(r,{le:()=>f});var o,n,s,a=t(68832),i=t(99436),l=t(51455),c=t(76760),u=t(75646),d=(o=i(function*(e,r,t=3e3){var o;try{var n=new AbortController;o=setTimeout(()=>n.abort(),t);var s=yield fetch(`http://${e}:${r}/json/list`,{signal:n.signal});if(!s.ok)return null;return yield s.json()}catch{return null}finally{void 0!==o&&clearTimeout(o)}}),function(e,r){return o.apply(this,arguments)}),p=(n=i(function*(e,r=1e3){for(var t=[],o=e,n=0;n<10;n++){var s=c.join(o,".bricks","devtools.json");try{var a=yield l.readFile(s,"utf8"),i=JSON.parse(a),d=yield(0,u.verifyDevToolsServer)(i.address||"localhost",i.port,r);d&&t.push({name:i.name||"BRICKS Simulator",address:i.address||"localhost",port:i.port,protocols:["cdp"],hasPasscode:!1,source:"project",projectPath:o,...d})}catch{}var p=c.dirname(o);if(p===o)break;o=p}return t}),function(e){return n.apply(this,arguments)}),f=(s=i(function*({timeout:e=3e3,verify:r=!1,udpOnly:t=!1,project:o=!0,port:n=19851,cwd:s=process.cwd(),onStatus:l}={}){var c,f=(0,u.discoverDevToolsServers)({timeout:e,idleTimeout:800}),v=t?Promise.resolve([]):(l?.("Scanning via UDP + HTTP probe..."),(0,u.httpProbeSubnet)({port:n,timeout:e})),h=o?p(s,1e3):Promise.resolve([]),m=a((yield Promise.all([f,v,h])),3),y=(e=>{var r=new Map;for(var t of e){var o=t.deviceId||`${t.address}:${t.port}`,n=r.get(o);if(!n){r.set(o,{...t,addresses:[t.address],protocols:[...t.protocols||[]]});continue}for(var s of(n.addresses.includes(t.address)||n.addresses.push(t.address),"127.0.0.1"===n.address&&"127.0.0.1"!==t.address&&(n.address=t.address),t.protocols||[]))n.protocols.includes(s)||n.protocols.push(s);for(var i of Object.entries(t)){var l=a(i,2),c=l[0],u=l[1];null!=u&&"address"!==c&&"addresses"!==c&&"protocols"!==c&&(void 0===n[c]||null===n[c])&&(n[c]=u)}}return[...r.values()]})([...m[0],...m[1],...m[2]]);if(0===y.length)return[];if(r){l?.(`Verifying ${y.length} server(s)...`);var b,w=yield Promise.all(y.map((b=i(function*(e){var r=yield(0,u.verifyDevToolsServer)(e.address,e.port);return{...e,...r||{},address:e.address,port:e.port,verified:!!r,version:r?.version||e.version}}),function(e){return b.apply(this,arguments)})));y.splice(0,y.length,...w)}return l?.("Checking chrome://inspect support..."),yield Promise.all(y.map((c=i(function*(e){var r=yield d(e.address,e.port);if(r){e.chromeInspect=!0;var t=(e=>{if(!e)return null;var r=e.match(/\/ws\/(.+)$/);return r?decodeURIComponent(r[1]):null})(r[0]?.webSocketDebuggerUrl);t&&(e.passcode=t)}}),function(e){return c.apply(this,arguments)}))),y}),function(){return s.apply(this,arguments)})},75646(e,r,t){t.d(r,{discoverDevToolsServers:()=>l,httpProbeSubnet:()=>c,verifyDevToolsServer:()=>u});var o,n,s=t(99436),a=t(19557),i="bricks-devtools",l=({timeout:e=3e3,idleTimeout:r=0}={})=>(0,a.YH)({port:19900,timeout:e,idleTimeout:r,buildQuery:()=>Buffer.from(JSON.stringify({t:"QUERY",v:"1.0",s:i,d:{id:`cli-${(0,a.BW)()}`}})),parseMessage:(e,r)=>{var t=(0,a.nl)(e,e=>e?.s===i);if(!t)return null;var o=r.address;return{key:`${o}:${t.port}`,value:{...t,address:o}}}}),c=(o=s(function*({port:e=19851,connectTimeout:r=500,concurrency:t=50,timeout:o=0}={}){var n=(0,a.r9)();if(0===n.length)return[];var i=[],l=o>0?Date.now()+o:0,c=[],d=new Set;for(var p of n){var f=p.address.split(".").slice(0,3).join(".");if(!d.has(f)){d.add(f);for(var v=1;v<255;v++)c.push(`${f}.${v}`)}}for(var h=0;h<c.length&&!(l&&Date.now()>=l);h+=t){var m=c.slice(h,h+t);yield Promise.allSettled(m.map(function(){var t=s(function*(t){var o=yield u(t,e,r);o&&i.push({...o,address:t,port:e})});return function(e){return t.apply(this,arguments)}}()))}return i}),function(){return o.apply(this,arguments)}),u=(n=s(function*(e,r,t=3e3){return(0,a.uE)(`http://${e}:${r}/devtools/info`,t)}),function(e,r){return n.apply(this,arguments)})},19557(e,r,t){t.d(r,{BW:()=>i,YH:()=>d,nl:()=>c,r9:()=>u,uE:()=>p});var o,n=t(99436),s=t(41314),a=t(48161),i=()=>Math.random().toString(36).slice(2,9),l=new Set(["ANNOUNCE","RESPONSE"]),c=(e,r)=>{var t=JSON.parse(e.toString());return r(t)&&l.has(t.t)&&t.d?.info||null},u=()=>{var e=[];for(var r of Object.values(a.networkInterfaces()))for(var t of r)if(function(){if("IPv4"!==t.family||t.internal)return 1;var r=t.address.split(".").map(Number),o=t.netmask.split(".").map(Number),n=r.map((e,r)=>(e|255&~o[r]).toString()).join(".");e.push({address:t.address,broadcast:n})}())continue;return e},d=({port:e,timeout:r=3e3,idleTimeout:t=0,buildQuery:o,parseMessage:n})=>new Promise((a,i)=>{var l=new Map,c=s.createSocket("udp4"),d=null,p=null,f=!1,v=()=>{if(!f){f=!0,clearTimeout(d),clearTimeout(p);try{c.close()}catch{}a([...l.values()])}};c.on("error",e=>{if(!f){f=!0,clearTimeout(d),clearTimeout(p);try{c.close()}catch{}i(e)}}),c.on("message",(e,r)=>{try{var o=n(e,r);if(!o||l.has(o.key))return;l.set(o.key,o.value),t&&!f&&(clearTimeout(p),p=setTimeout(v,t))}catch{}}),c.bind(()=>{c.setBroadcast(!0);var t=o();for(var n of(()=>{var e=new Set(["255.255.255.255","127.0.0.1"]);for(var r of u())e.add(r.broadcast);return[...e]})())c.send(t,0,t.length,e,n);d=setTimeout(v,r)})}),p=(o=n(function*(e,r=3e3){var t;try{var o=new AbortController;t=setTimeout(()=>o.abort(),r);var n=yield fetch(e,{signal:o.signal});if(!n.ok)return null;return yield n.json()}catch{return null}finally{void 0!==t&&clearTimeout(t)}}),function(e){return o.apply(this,arguments)})}},u={};function d(e){var r=u[e];if(void 0!==r)return r.exports;var t=u[e]={exports:{}};return c[e](t,t.exports,d),t.exports}o=(t="function"==typeof Symbol)?Symbol("rspack queues"):"__rspack_queues",n=d.aE=t?Symbol("rspack exports"):"__webpack_exports__",s=t?Symbol("rspack error"):"__rspack_error",a=t?Symbol("rspack done"):"__rspack_done",i=d.zS=t?Symbol("rspack defer"):"__rspack_defer",d.zT=e=>{if(e.some(e=>{var r=u[e];return!r||!1===r[a]}))return{then:(r,t)=>Promise.all(e.map(d)).then(r,t)}},l=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))},d.a=(e,r,t)=>{t&&((c=[]).d=-1);var c,u,p,f,v=new Set,h=e.exports,m=new Promise((e,r)=>{f=r,p=e});m[n]=h,m[o]=e=>{c&&e(c),v.forEach(e),m.catch(()=>{})},e.exports=m,r(e=>{u=e.map(e=>{if(null!==e&&"object"==typeof e){if(!e[o]&&e[i]){var r=d.zT(e[i]);if(!r)return e;var t=e;e={then(e,o){r.then(()=>e(t),o)}}}if(e[o])return e;if(e.then){var a=[];a.d=0,e.then(e=>{c[n]=e,l(a)},e=>{c[s]=e,l(a)});var c={};return c[i]=!1,c[o]=e=>e(a),c}}var u={};return u[o]=()=>{},u[n]=e,u});var r,t=()=>u.map(e=>{if(e[i])return e;if(e[s])throw e[s];return e[n]}),a=new Promise(e=>{(r=()=>e(t)).r=0;var n=e=>e!==c&&!v.has(e)&&(v.add(e),e&&!e.d&&(r.r++,e.push(r)));u.map(e=>e[i]||e[o](n))});return r.r?a:t()},e=>(e?f(m[s]=e):p(h),l(c),m[a]=!0)),c&&c.d<0&&(c.d=0)},d.d=(e,r)=>{for(var t in r)d.o(r,t)&&!d.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},d.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var p=d(13346),f=(p=await p).fl,v=p.le,h=p.TB;export{f as createCdpClient,v as scanDevToolsCore,h as verifyDevToolsServer};
1
+ import{createRequire as e}from"node:module";let r=e(import.meta.url);var t,o,n,s,a,i,l,c={84361(e){e.exports=import("ws").then(function(e){return e})},41314(e){e.exports=r("node:dgram")},51455(e){e.exports=r("node:fs/promises")},48161(e){e.exports=r("node:os")},76760(e){e.exports=r("node:path")},66442(e){e.exports=function(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=Array(r);t<r;t++)o[t]=e[t];return o},e.exports.__esModule=!0,e.exports.default=e.exports},3634(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},99436(e){function r(e,r,t,o,n,s,a){try{var i=e[s](a),l=i.value}catch(e){return void t(e)}i.done?r(l):Promise.resolve(l).then(o,n)}e.exports=function(e){return function(){var t=this,o=arguments;return new Promise(function(n,s){var a=e.apply(t,o);function i(e){r(a,n,s,i,l,"next",e)}function l(e){r(a,n,s,i,l,"throw",e)}i(void 0)})}},e.exports.__esModule=!0,e.exports.default=e.exports},96525(e){e.exports=function(e,r){var t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var o,n,s,a,i=[],l=!0,c=!1;try{if(s=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;l=!1}else for(;!(l=(o=s.call(t)).done)&&(i.push(o.value),i.length!==r);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw n}}return i}},e.exports.__esModule=!0,e.exports.default=e.exports},5523(e){e.exports=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},68832(e,r,t){var o=t(3634),n=t(96525),s=t(78243),a=t(5523);e.exports=function(e,r){return o(e)||n(e,r)||s(e,r)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},78243(e,r,t){var o=t(66442);e.exports=function(e,r){if(e){if("string"==typeof e)return o(e,r);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,r):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},13346(e,r,t){t.a(e,async function(e,o){try{t.d(r,{TB:()=>a.verifyDevToolsServer,fl:()=>s.createCdpClient,le:()=>n.le});var n=t(38372),s=t(28193),a=t(75646),i=e([s]);s=(i.then?(await i)():i)[0],o()}catch(e){o(e)}})},28193(e,r,t){t.a(e,async function(e,o){try{t.d(r,{createCdpClient:()=>v});var n,s=t(99436),a=t(73610),i=t(84361),l=e([i]);i=(l.then?(await l)():l)[0];var c=15e3,u={[a.AB.takenOver]:"Another DevTools client took this device.",[a.AB.targetGone]:"The device stopped its DevTools server (the app restarted or went to the background). Retry the command."},d=({address:e,port:r,method:t,phase:o="request",closeCode:n,closeReason:s,local:a=!1})=>{var i=s?Buffer.isBuffer(s)?s.toString("utf8"):String(s):"",l="connect"===o?"before the CDP session opened":t?`while waiting for ${t}`:"during the CDP session",c=`${e}:${r}`,d=[];null!=n&&d.push(`code ${n}`),i&&d.push(`reason: ${i}`);var p=[a?`CDP client closed the connection to ${c} ${l}.`:`CDP connection to ${c} closed ${l}.`,d.length>0?`WebSocket close ${d.join(", ")}.`:null,a?null:u[n]??"The DevTools server currently accepts one CDP client at a time. Another DevTools window or CLI command may have replaced this session. Retry the command, close the other inspector, or avoid running DevTools commands in parallel."].filter(Boolean).join("\n"),v=Error(p);return v.code="CDP_CONNECTION_CLOSED",v.method=t,v.phase=o,v.closeCode=n,v.closeReason=i,v},p=(n=s(function*(e,r,t){var o,n=t?"string"==typeof t?{passcode:t}:t:{},s=n.passcode,a=n.accessToken;if(a)return`ws://${e}:${r}/ws?access_token=${encodeURIComponent(a)}`;if(!s)try{var i=new AbortController;o=setTimeout(()=>i.abort(),3e3);var l=yield fetch(`http://${e}:${r}/json/list`,{signal:i.signal});if(l.ok){var c=yield l.json(),u=c?.[0]?.webSocketDebuggerUrl;if(u){var d=u.match(/\/ws(?:\/.*)?$/);if(d)return`ws://${e}:${r}${d[0]}`}}}catch{}finally{void 0!==o&&clearTimeout(o)}return s?`ws://${e}:${r}/ws/${encodeURIComponent(s)}`:`ws://${e}:${r}/ws`}),function(e,r,t){return n.apply(this,arguments)}),v=(e,r,t)=>{var o,n,a=0,l=new Map,u=new Map,v=null,f=0,h=e=>{for(var r of l.values()){var t=r.reject,o=r.timer,n=r.method;clearTimeout(o),t(e(n))}l.clear()};return{connect:(o=s(function*(){var o=++f,s=yield p(e,r,t);if(o!==f)throw d({address:e,port:r,phase:"connect",local:!0});return new Promise((t,o)=>{n=new i.WebSocket(s,{handshakeTimeout:c});var a=!1;n.once("open",()=>{a=!0,v=null,t()}),n.once("error",t=>{a||o(Error(t.message||`Cannot connect to ${e}:${r}`))}),n.on("message",e=>{try{var r=JSON.parse(e.toString());if(null!=r.id&&l.has(r.id)){var t=l.get(r.id),o=t.resolve,n=t.reject,s=t.timer;clearTimeout(s),l.delete(r.id),r.error?n(Error(r.error.message)):o(r.result);return}if(r.method){var a=u.get(r.method);if(a)for(var i of a)i(r.params)}}catch{}}),n.on("close",(t,n)=>{v={closeCode:t,closeReason:n},a||o(d({address:e,port:r,phase:"connect",closeCode:t,closeReason:n})),h(o=>d({address:e,port:r,method:o,closeCode:t,closeReason:n}))})})}),function(){return o.apply(this,arguments)}),send:(t,o={},s=c)=>new Promise((i,c)=>{if(!n||n.readyState!==n.OPEN)return v?void c(d({address:e,port:r,method:t,closeCode:v.closeCode,closeReason:v.closeReason})):void c(Error(`Not connected to CDP at ${e}:${r} while sending ${t}`));var u=++a,p=setTimeout(()=>{l.delete(u),c(Error(`Timeout: ${t}`))},s);l.set(u,{resolve:i,reject:c,timer:p,method:t}),n.send(JSON.stringify({id:u,method:t,params:o}))}),on:(e,r)=>{u.has(e)||u.set(e,[]),u.get(e).push(r)},off:(e,r)=>{var t=u.get(e);if(t){var o=t.indexOf(r);o>=0&&t.splice(o,1)}},close:()=>{f++,h(t=>d({address:e,port:r,method:t,local:!0})),n&&(n.terminate(),n=null)}}};o()}catch(e){o(e)}})},38372(e,r,t){t.d(r,{le:()=>v});var o,n,s,a=t(68832),i=t(99436),l=t(51455),c=t(76760),u=t(75646),d=(o=i(function*(e,r,t=3e3){var o;try{var n=new AbortController;o=setTimeout(()=>n.abort(),t);var s=yield fetch(`http://${e}:${r}/json/list`,{signal:n.signal});if(!s.ok)return null;return yield s.json()}catch{return null}finally{void 0!==o&&clearTimeout(o)}}),function(e,r){return o.apply(this,arguments)}),p=(n=i(function*(e,r=1e3){for(var t=[],o=e,n=0;n<10;n++){var s=c.join(o,".bricks","devtools.json");try{var a=yield l.readFile(s,"utf8"),i=JSON.parse(a),d=yield(0,u.verifyDevToolsServer)(i.address||"localhost",i.port,r);d&&t.push({name:i.name||"BRICKS Simulator",address:i.address||"localhost",port:i.port,protocols:["cdp"],hasPasscode:!1,source:"project",projectPath:o,...d})}catch{}var p=c.dirname(o);if(p===o)break;o=p}return t}),function(e){return n.apply(this,arguments)}),v=(s=i(function*({timeout:e=3e3,verify:r=!1,udpOnly:t=!1,project:o=!0,port:n=19851,cwd:s=process.cwd(),onStatus:l}={}){var c,v=(0,u.discoverDevToolsServers)({timeout:e,idleTimeout:800}),f=t?Promise.resolve([]):(l?.("Scanning via UDP + HTTP probe..."),(0,u.httpProbeSubnet)({port:n,timeout:e})),h=o?p(s,1e3):Promise.resolve([]),m=a((yield Promise.all([v,f,h])),3),y=(e=>{var r=new Map;for(var t of e){var o=t.deviceId||`${t.address}:${t.port}`,n=r.get(o);if(!n){r.set(o,{...t,addresses:[t.address],protocols:[...t.protocols||[]]});continue}for(var s of(n.addresses.includes(t.address)||n.addresses.push(t.address),"127.0.0.1"===n.address&&"127.0.0.1"!==t.address&&(n.address=t.address),t.protocols||[]))n.protocols.includes(s)||n.protocols.push(s);for(var i of Object.entries(t)){var l=a(i,2),c=l[0],u=l[1];null!=u&&"address"!==c&&"addresses"!==c&&"protocols"!==c&&(void 0===n[c]||null===n[c])&&(n[c]=u)}}return[...r.values()]})([...m[0],...m[1],...m[2]]);if(0===y.length)return[];if(r){l?.(`Verifying ${y.length} server(s)...`);var b,g=yield Promise.all(y.map((b=i(function*(e){var r=yield(0,u.verifyDevToolsServer)(e.address,e.port);return{...e,...r||{},address:e.address,port:e.port,verified:!!r,version:r?.version||e.version}}),function(e){return b.apply(this,arguments)})));y.splice(0,y.length,...g)}return l?.("Checking chrome://inspect support..."),yield Promise.all(y.map((c=i(function*(e){var r=yield d(e.address,e.port);if(r){e.chromeInspect=!0;var t=(e=>{if(!e)return null;var r=e.match(/\/ws\/(.+)$/);return r?decodeURIComponent(r[1]):null})(r[0]?.webSocketDebuggerUrl);t&&(e.passcode=t)}}),function(e){return c.apply(this,arguments)}))),y}),function(){return s.apply(this,arguments)})},75646(e,r,t){t.d(r,{discoverDevToolsServers:()=>l,httpProbeSubnet:()=>c,verifyDevToolsServer:()=>u});var o,n,s=t(99436),a=t(19557),i="bricks-devtools",l=({timeout:e=3e3,idleTimeout:r=0}={})=>(0,a.YH)({port:19900,timeout:e,idleTimeout:r,buildQuery:()=>Buffer.from(JSON.stringify({t:"QUERY",v:"1.0",s:i,d:{id:`cli-${(0,a.BW)()}`}})),parseMessage:(e,r)=>{var t=(0,a.nl)(e,e=>e?.s===i);if(!t)return null;var o=r.address;return{key:`${o}:${t.port}`,value:{...t,address:o}}}}),c=(o=s(function*({port:e=19851,connectTimeout:r=500,concurrency:t=50,timeout:o=0}={}){var n=(0,a.r9)();if(0===n.length)return[];var i=[],l=o>0?Date.now()+o:0,c=[],d=new Set;for(var p of n){var v=p.address.split(".").slice(0,3).join(".");if(!d.has(v)){d.add(v);for(var f=1;f<255;f++)c.push(`${v}.${f}`)}}for(var h=0;h<c.length&&!(l&&Date.now()>=l);h+=t){var m=c.slice(h,h+t);yield Promise.allSettled(m.map(function(){var t=s(function*(t){var o=yield u(t,e,r);o&&i.push({...o,address:t,port:e})});return function(e){return t.apply(this,arguments)}}()))}return i}),function(){return o.apply(this,arguments)}),u=(n=s(function*(e,r,t=3e3){return(0,a.uE)(`http://${e}:${r}/devtools/info`,t)}),function(e,r){return n.apply(this,arguments)})},19557(e,r,t){t.d(r,{BW:()=>i,YH:()=>d,nl:()=>c,r9:()=>u,uE:()=>p});var o,n=t(99436),s=t(41314),a=t(48161),i=()=>Math.random().toString(36).slice(2,9),l=new Set(["ANNOUNCE","RESPONSE"]),c=(e,r)=>{var t=JSON.parse(e.toString());return r(t)&&l.has(t.t)&&t.d?.info||null},u=()=>{var e=[];for(var r of Object.values(a.networkInterfaces()))for(var t of r)if(function(){if("IPv4"!==t.family||t.internal)return 1;var r=t.address.split(".").map(Number),o=t.netmask.split(".").map(Number),n=r.map((e,r)=>(e|255&~o[r]).toString()).join(".");e.push({address:t.address,broadcast:n})}())continue;return e},d=({port:e,timeout:r=3e3,idleTimeout:t=0,buildQuery:o,parseMessage:n})=>new Promise((a,i)=>{var l=new Map,c=s.createSocket("udp4"),d=null,p=null,v=!1,f=e=>{if(!v){v=!0,clearTimeout(d),clearTimeout(p);try{c.close()}catch{}e?i(e):a([...l.values()])}};c.on("error",f),c.on("message",(e,r)=>{if(!v)try{var o=n(e,r);if(!o||l.has(o.key))return;l.set(o.key,o.value),t&&!v&&(clearTimeout(p),p=setTimeout(f,t))}catch{}});try{c.bind(()=>{if(!v)try{c.setBroadcast(!0);var t=o();for(var n of(()=>{var e=new Set(["255.255.255.255","127.0.0.1"]);for(var r of u())e.add(r.broadcast);return[...e]})())c.send(t,0,t.length,e,n);d=setTimeout(f,r)}catch(e){f(e)}})}catch(e){f(e)}}),p=(o=n(function*(e,r=3e3){var t;try{var o=new AbortController;t=setTimeout(()=>o.abort(),r);var n=yield fetch(e,{signal:o.signal});if(!n.ok)return null;return yield n.json()}catch{return null}finally{void 0!==t&&clearTimeout(t)}}),function(e){return o.apply(this,arguments)})},73610(e,r,t){t.d(r,{AB:()=>o}),Object.freeze({ready:"bricks-devtools:ready",init:"bricks-devtools:init",hello:"bricks-devtools:hello",connect:"bricks-devtools:connect",disconnect:"bricks-devtools:disconnect",close:"bricks-devtools:close",openUrl:"bricks-devtools:open-url",save:"bricks-devtools:save",copy:"bricks-devtools:copy",shortcut:"bricks-devtools:shortcut",open:"bricks-devtools:open",closed:"bricks-devtools:closed",config:"bricks-devtools:config",target:"bricks-devtools:target"});let o=Object.freeze({takenOver:4e3,targetGone:4001,signedOut:4003,noTarget:1006})}},u={};function d(e){var r=u[e];if(void 0!==r)return r.exports;var t=u[e]={exports:{}};return c[e](t,t.exports,d),t.exports}o=(t="function"==typeof Symbol)?Symbol("rspack queues"):"__rspack_queues",n=d.aE=t?Symbol("rspack exports"):"__webpack_exports__",s=t?Symbol("rspack error"):"__rspack_error",a=t?Symbol("rspack done"):"__rspack_done",i=d.zS=t?Symbol("rspack defer"):"__rspack_defer",d.zT=e=>{if(e.some(e=>{var r=u[e];return!r||!1===r[a]}))return{then:(r,t)=>Promise.all(e.map(d)).then(r,t)}},l=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))},d.a=(e,r,t)=>{t&&((c=[]).d=-1);var c,u,p,v,f=new Set,h=e.exports,m=new Promise((e,r)=>{v=r,p=e});m[n]=h,m[o]=e=>{c&&e(c),f.forEach(e),m.catch(()=>{})},e.exports=m,r(e=>{u=e.map(e=>{if(null!==e&&"object"==typeof e){if(!e[o]&&e[i]){var r=d.zT(e[i]);if(!r)return e;var t=e;e={then(e,o){r.then(()=>e(t),o)}}}if(e[o])return e;if(e.then){var a=[];a.d=0,e.then(e=>{c[n]=e,l(a)},e=>{c[s]=e,l(a)});var c={};return c[i]=!1,c[o]=e=>e(a),c}}var u={};return u[o]=()=>{},u[n]=e,u});var r,t=()=>u.map(e=>{if(e[i])return e;if(e[s])throw e[s];return e[n]}),a=new Promise(e=>{(r=()=>e(t)).r=0;var n=e=>e!==c&&!f.has(e)&&(f.add(e),e&&!e.d&&(r.r++,e.push(r)));u.map(e=>e[i]||e[o](n))});return r.r?a:t()},e=>(e?v(m[s]=e):p(h),l(c),m[a]=!0)),c&&c.d<0&&(c.d=0)},d.d=(e,r)=>{for(var t in r)d.o(r,t)&&!d.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},d.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var p=d(13346),v=(p=await p).fl,f=p.le,h=p.TB;export{v as createCdpClient,f as scanDevToolsCore,h as verifyDevToolsServer};