@fugood/bricks-cli 2.26.0-beta.24 → 2.26.0-beta.25
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/README.md +6 -1
- package/lib/1010.js +1 -1
- package/lib/1215.js +1 -1
- package/lib/1708.js +4 -4
- package/lib/2486.js +1 -1
- package/lib/2517.js +1 -1
- package/lib/6194.js +1 -1
- package/lib/6818.js +1 -1
- package/lib/907.js +30 -19
- package/lib/9320.js +3 -3
- package/lib/9439.js +1 -1
- package/lib/index.js +12 -12
- package/lib/lib.js +133 -122
- package/package.json +5 -5
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.
|
|
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.25")?"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/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:()=>
|
|
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:()=>S,BricksPublicClient:()=>k,createClient:()=>D,createFetchForUrl:()=>_.P,createPublicClient:()=>A});var n,a,r,o,s=t(99436),d=t(5018),l=t(44668),u=t(54506),c=t(78549),p=t(94370),m=t(90424),$=t(43741),g=t(89293),_=t(75149),v=u.ApolloClient,f=u.InMemoryCache,y=u.HttpLink,h=c.o,I={query:"query",mutation:"mutate"},k=l(function e(i){d(this,e),this.baseUrl=i,this.endpoint="/api/graphql-nonauth";var t=new y({uri:`${i}${this.endpoint}`,fetch:(0,_.P)(i)});this.apolloClient=new v({link:t,cache:new f,defaultOptions:{query:{errorPolicy:"all",fetchPolicy:"no-cache"}}})},[{key:"checkWorkspaceOTP",value:(n=s(function*(e){var i=(0,p.default)`
|
|
2
2
|
query checkWorkspaceOTP($passcode: String!) {
|
|
3
3
|
checkWorkspaceOTP(passcode: $passcode)
|
|
4
4
|
}
|
|
@@ -10,9 +10,9 @@ export const __rspack_esm_id=907;export const __rspack_esm_ids=[907];export cons
|
|
|
10
10
|
workspaceName
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
`,t=yield this.apolloClient.mutate({mutation:i,variables:{passcode:e}}),n=t.data,a=t.errors;if(a?.length>0)throw Error(a.map(({message:e})=>e).join("\n"));return n.exchangeWorkspaceOTP}),function(e){return a.apply(this,arguments)})}]),
|
|
13
|
+
`,t=yield this.apolloClient.mutate({mutation:i,variables:{passcode:e}}),n=t.data,a=t.errors;if(a?.length>0)throw Error(a.map(({message:e})=>e).join("\n"));return n.exchangeWorkspaceOTP}),function(e){return a.apply(this,arguments)})}]),A=e=>new k(e),b="Note: OAuth workspace access is awaiting the next production server release. Until then, use workspace auth (passcode or token; CLI: `bricks auth login-workspace`).",C=(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(b))return e;var n=Error(`${t}
|
|
14
14
|
|
|
15
|
-
${
|
|
15
|
+
${b}`);return n.cause=e,n},S=l(function e(i,t){var n,a=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 y({uri:`${i}${this.endpoint}`,fetch:(0,_.P)(i)}),o=h((n=s(function*(e,{headers:i}){return{headers:{...i,...a.auth?yield a.auth.getHeaders():{}}}}),function(e,i){return n.apply(this,arguments)}));this.apolloClient=new v({link:o.concat(r),cache:new f,defaultOptions:{watchQuery:{errorPolicy:"all",fetchPolicy:"no-cache"},query:{errorPolicy:"all",fetchPolicy:"no-cache"}}}),this.queries=$,this.mutations=g,this.generateMethods()},[{key:"generateMethods",value:function(){var e=this,i=i=>([t,n])=>{if(!this[t]){var a,r=(a=s(function*(a,r,o=!1){try{var s=e.apolloClient[I[i]].bind(e.apolloClient),d=yield s({[i]:o?(0,m.YR)(n,{FragmentDefinition(e){if("BlueprintRun"===e.typeCondition.name.value)return{...e,selectionSet:{...e.selectionSet,selections:e.selectionSet.selections.filter(e=>!["instance_id","sessions"].includes(e.name?.value))}}},VariableDefinition:e=>"instanceId"===e.variable.name.value?null:void 0,Argument:e=>"instanceId"===e.name.value?null:void 0}):n,variables:o?Object.fromEntries(Object.entries(a).filter(([e])=>"instanceId"!==e)):a,...r}),l=d.data,u=d.errors;if(u)throw Error(u.map(({message:e})=>e).join("\n"));return l[t]}catch(e){var c=e.cause?.result?.errors||e.networkError?.result?.errors;if(c)throw Error(c.map(({message:e})=>e).join("\n"));throw e}}),function(e,i){return a.apply(this,arguments)});this[t]=s(function*(i={},n={}){try{return yield r(i,n)}catch(o){let a;if(/blueprint/i.test(t)&&(a=o.message,/Unknown argument "instanceId".*acquireBlueprintRun|Cannot query field "(?:instance_id|sessions)" on type "BlueprintRun"/.test(a)))return r(i,n,!0);if(e.auth?.kind==="oauth"&&e.auth.refresh&&/401|unauthoriz|jwt expired|token.*expired|invalid.*token/i.test(o?.message||"")){yield e.auth.refresh();try{return yield r(i,n)}catch(i){throw C(i,e.auth)}}throw C(o,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"}),n=t.data,a=t.errors;if(a?.length>0)throw Error(a.map(({message:e})=>e).join("\n"));return n}),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}),n=t.data,a=t.errors;if(a?.length>0)throw Error(a.map(({message:e})=>e).join("\n"));return n}),function(e){return o.apply(this,arguments)})}]),D=(e,i)=>new S(e,i)},75149(e,i,t){t.d(i,{P:()=>r});var n=t(79657),a=t(64007);function r(e){var i=process.env.HTTPS_PROXY||process.env.https_proxy;if(!i||!e.startsWith("https://"))return n.Ay;var t=new a(i);return(e,i={})=>(0,n.Ay)(e,{...i,agent:t})}},48596(e,i,t){t.d(i,{$7:()=>u,$V:()=>c,C$:()=>_,F3:()=>r,J6:()=>p,NJ:()=>s,VZ:()=>o,Yi:()=>a,_A:()=>g,lI:()=>l,mJ:()=>d,zL:()=>$});var n=t(94370),a=(0,n.default)`
|
|
16
16
|
fragment cliWorkspaceArguments on Workspace {
|
|
17
17
|
_id
|
|
18
18
|
name
|
|
@@ -304,6 +304,12 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
304
304
|
}
|
|
305
305
|
`,$=(0,n.default)`
|
|
306
306
|
fragment cliBlueprintRunArguments on BlueprintRun {
|
|
307
|
+
instance_id
|
|
308
|
+
sessions {
|
|
309
|
+
session_id
|
|
310
|
+
started_at
|
|
311
|
+
heartbeat_at
|
|
312
|
+
}
|
|
307
313
|
host
|
|
308
314
|
user_id
|
|
309
315
|
session_id
|
|
@@ -366,7 +372,7 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
366
372
|
last_modify_datetime
|
|
367
373
|
}
|
|
368
374
|
${$}
|
|
369
|
-
`},89293(e,i,t){t.r(i),t.d(i,{acquireBlueprintRun:()=>
|
|
375
|
+
`},89293(e,i,t){t.r(i),t.d(i,{acquireBlueprintRun:()=>E,bindApplication:()=>f,bindButtressServer:()=>B,controlDevice:()=>o,createApplication:()=>p,createApplicationWithShareVersion:()=>m,createBlueprint:()=>q,createDevice:()=>r,createMediaFileUploadRequest:()=>S,createModule:()=>h,createVirtualDevice:()=>s,dispatchDeviceGroupAction:()=>c,heartbeatBlueprintRun:()=>V,issueButtressAccessToken:()=>w,issueDevtoolsAccessToken:()=>P,releaseApplication:()=>C,releaseBlueprintRun:()=>M,releaseModule:()=>D,removeApplication:()=>_,removeBlueprint:()=>R,removeDevice:()=>u,removeModule:()=>k,revertBlueprint:()=>x,shortEditApplication:()=>v,shortEditModule:()=>A,triggerApplicationCanvasControl:()=>y,unbindButtressServer:()=>L,updateApplication:()=>$,updateBlueprint:()=>T,updateDevice:()=>l,updateModule:()=>I,updateVirtualDevice:()=>d,updateWorkspace:()=>b,useApplicationReleaseVersion:()=>g});var n=t(94370),a=t(48596),r=(0,n.default)`
|
|
370
376
|
mutation CLI_createDevice($bindPasscode: String, $name: String, $deviceName: String) {
|
|
371
377
|
createDevice(bindPasscode: $bindPasscode, name: $name, deviceName: $deviceName) {
|
|
372
378
|
...cliDeviceArguments
|
|
@@ -551,7 +557,7 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
551
557
|
}
|
|
552
558
|
}
|
|
553
559
|
}
|
|
554
|
-
`,
|
|
560
|
+
`,y=(0,n.default)`
|
|
555
561
|
mutation CLI_triggerApplicationCanvasControl(
|
|
556
562
|
$id: ID!
|
|
557
563
|
$testId: String!
|
|
@@ -569,7 +575,7 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
569
575
|
_id
|
|
570
576
|
}
|
|
571
577
|
}
|
|
572
|
-
`,
|
|
578
|
+
`,h=(0,n.default)`
|
|
573
579
|
mutation CLI_createModule(
|
|
574
580
|
$name: String
|
|
575
581
|
$description: String
|
|
@@ -631,7 +637,7 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
631
637
|
name
|
|
632
638
|
}
|
|
633
639
|
}
|
|
634
|
-
`,
|
|
640
|
+
`,b=(0,n.default)`
|
|
635
641
|
mutation CLI_updateWorkspace(
|
|
636
642
|
$name: String
|
|
637
643
|
$description: String
|
|
@@ -655,7 +661,7 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
655
661
|
}
|
|
656
662
|
}
|
|
657
663
|
}
|
|
658
|
-
`,
|
|
664
|
+
`,C=(0,n.default)`
|
|
659
665
|
mutation CLI_releaseApplication(
|
|
660
666
|
$id: ID!
|
|
661
667
|
$config: String
|
|
@@ -784,13 +790,18 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
784
790
|
}
|
|
785
791
|
}
|
|
786
792
|
${a._A}
|
|
787
|
-
`,
|
|
793
|
+
`,R=(0,n.default)`
|
|
788
794
|
mutation CLI_removeBlueprint($id: ID!) {
|
|
789
795
|
removeBlueprint(id: $id)
|
|
790
796
|
}
|
|
791
|
-
`,
|
|
792
|
-
mutation CLI_acquireBlueprintRun(
|
|
793
|
-
|
|
797
|
+
`,E=(0,n.default)`
|
|
798
|
+
mutation CLI_acquireBlueprintRun(
|
|
799
|
+
$id: ID!
|
|
800
|
+
$host: String!
|
|
801
|
+
$sessionId: String!
|
|
802
|
+
$instanceId: String
|
|
803
|
+
) {
|
|
804
|
+
acquireBlueprintRun(id: $id, host: $host, sessionId: $sessionId, instanceId: $instanceId) {
|
|
794
805
|
ok
|
|
795
806
|
run {
|
|
796
807
|
...cliBlueprintRunArguments
|
|
@@ -812,7 +823,7 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
812
823
|
mutation CLI_releaseBlueprintRun($id: ID!, $sessionId: String!) {
|
|
813
824
|
releaseBlueprintRun(id: $id, sessionId: $sessionId)
|
|
814
825
|
}
|
|
815
|
-
`},43741(e,i,t){t.r(i),t.d(i,{application:()=>p,applicationDeviceSettings:()=>m,applicationProject:()=>D,applicationReleaseVersions:()=>$,applications:()=>g,blueprint:()=>w,blueprintEvents:()=>
|
|
826
|
+
`},43741(e,i,t){t.r(i),t.d(i,{application:()=>p,applicationDeviceSettings:()=>m,applicationProject:()=>D,applicationReleaseVersions:()=>$,applications:()=>g,blueprint:()=>w,blueprintEvents:()=>R,blueprintProjection:()=>T,blueprintRevisions:()=>x,blueprints:()=>P,blueprintsByInstance:()=>q,buttressServers:()=>L,checkBindDevicePasscode:()=>h,device:()=>o,deviceGroup:()=>l,deviceGroups:()=>u,deviceUsage:()=>S,devices:()=>s,devicesApplicationStatus:()=>E,devicesByGroup:()=>c,devicesPanel:()=>d,mediaBox:()=>b,mediaBoxes:()=>A,mediaFile:()=>C,mediaFiles:()=>I,mediaWorkspace:()=>k,module:()=>v,moduleProject:()=>B,modules:()=>f,publicApplicationShareInfo:()=>_,publicModules:()=>y,workspace:()=>r});var n=t(94370),a=t(48596),r=(0,n.default)`
|
|
816
827
|
query CLI_workspace {
|
|
817
828
|
workspace {
|
|
818
829
|
...cliWorkspaceArguments
|
|
@@ -962,14 +973,14 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
962
973
|
}
|
|
963
974
|
}
|
|
964
975
|
${a.J6}
|
|
965
|
-
`,
|
|
976
|
+
`,y=(0,n.default)`
|
|
966
977
|
query CLI_publicModules($keyword: String!, $limit: Int) {
|
|
967
978
|
publicModules(keyword: $keyword, paginate: { limit: $limit }) {
|
|
968
979
|
...cliModuleShortArguments
|
|
969
980
|
}
|
|
970
981
|
}
|
|
971
982
|
${a.J6}
|
|
972
|
-
`,
|
|
983
|
+
`,h=(0,n.default)`
|
|
973
984
|
query CLI_checkBindDevicePasscode($passcode: String!) {
|
|
974
985
|
checkBindDevicePasscode(passcode: $passcode)
|
|
975
986
|
}
|
|
@@ -1050,7 +1061,7 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
1050
1061
|
}
|
|
1051
1062
|
}
|
|
1052
1063
|
}
|
|
1053
|
-
`,
|
|
1064
|
+
`,b=(0,n.default)`
|
|
1054
1065
|
query CLI_mediaBox($id: ID!) {
|
|
1055
1066
|
mediaBox(id: $id) {
|
|
1056
1067
|
id
|
|
@@ -1071,7 +1082,7 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
1071
1082
|
}
|
|
1072
1083
|
}
|
|
1073
1084
|
}
|
|
1074
|
-
`,
|
|
1085
|
+
`,C=(0,n.default)`
|
|
1075
1086
|
query CLI_mediaFile($id: ID!) {
|
|
1076
1087
|
mediaFile(id: $id) {
|
|
1077
1088
|
id
|
|
@@ -1201,7 +1212,7 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
1201
1212
|
created_at
|
|
1202
1213
|
}
|
|
1203
1214
|
}
|
|
1204
|
-
`,
|
|
1215
|
+
`,R=(0,n.default)`
|
|
1205
1216
|
query CLI_blueprintEvents($id: ID!, $limit: Int) {
|
|
1206
1217
|
blueprintEvents(id: $id, limit: $limit) {
|
|
1207
1218
|
_id
|
|
@@ -1217,7 +1228,7 @@ ${A}`);return n.cause=e,n},b=l(function e(i,t){var n,a=this;d(this,e),this.baseU
|
|
|
1217
1228
|
created_at
|
|
1218
1229
|
}
|
|
1219
1230
|
}
|
|
1220
|
-
`,
|
|
1231
|
+
`,E=(0,n.default)`
|
|
1221
1232
|
query CLI_devicesApplicationStatus($filter: DeviceApplicationStatusFilter, $paginate: Paginate) {
|
|
1222
1233
|
devicesApplicationStatus(filter: $filter, paginate: $paginate) {
|
|
1223
1234
|
device_id
|
package/lib/9320.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const __rspack_esm_id=9320;export const __rspack_esm_ids=[9320];export const __webpack_modules__={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}},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 c,
|
|
1
|
+
export const __rspack_esm_id=9320;export const __rspack_esm_ids=[9320];export const __webpack_modules__={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}},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,p,l,h,d,f=0,v=!1,m=!1,y=!0;if("function"!=typeof e)throw TypeError("Expected a function");function w(t){var r=u,o=c;return u=c=void 0,f=t,l=e.apply(o,r)}function g(e){var r=e-d,o=e-f;return void 0===d||r>=t||r<0||m&&o>=p}function x(){var e,r,o,s=n();if(g(s))return _(s);h=setTimeout(x,(e=s-d,r=s-f,o=t-e,m?a(o,p-r):o))}function _(e){return(h=void 0,y&&u)?w(e):(u=c=void 0,l)}function b(){var e,r=n(),o=g(r);if(u=arguments,c=this,d=r,o){if(void 0===h)return f=e=d,h=setTimeout(x,t),v?w(e):l;if(m)return clearTimeout(h),h=setTimeout(x,t),w(d)}return void 0===h&&(h=setTimeout(x,t)),l}return t=s(t)||0,o(r)&&(v=!!r.leading,p=(m="maxWait"in r)?i(s(r.maxWait)||0,t):p,y="trailing"in r?!!r.trailing:y),b.cancel=function(){void 0!==h&&clearTimeout(h),f=0,u=d=c=h=void 0},b.flush=function(){return void 0===h?l:_(n())},b}},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,p=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)?p(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},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:()=>l,sh:()=>f});var o,n,s=r(90250),i=r(99436),a=r(5018),u=r(44668),c=r(31421),p=r(73024),l=()=>{var e=process.argv[1];return e&&!(e.includes("$bunfs")||e.includes("~BUN"))&&(0,p.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 p=yield new Promise((e,t)=>{i.on("error",t),i.on("close",(t,r)=>e({code:t,signal:r}))}),l=p.code,h=p.signal,d=l??1,f=Buffer.concat(a),v=Buffer.concat(u);if(0!==d&&this._throw){var m=h?`signal ${h}`:`exit ${d}`,y=Error(`sh: command failed with ${m}: ${this.args.join(" ")}`);throw y.exitCode=d,y.stdout=f,y.stderr=v,y}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,p=new h(u);return c&&p.cwd(c),p}},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:()=>d});var o=r(99436),n=r(31421),s=r(51455),i=r(73024),a=r(80481),
|
|
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),p=r(75720),l=r(16749),h=`Usage: bricks ctor simulator [options]
|
|
4
4
|
|
|
5
5
|
Compile the project and run it in the web-preview Simulator. Without
|
|
6
6
|
--no-keep-open the Simulator stays open and reloads on source changes.
|
|
@@ -21,4 +21,4 @@ Options:
|
|
|
21
21
|
--clear-cache Clear the preview cache at start
|
|
22
22
|
--show-menu Show the preview menu
|
|
23
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,
|
|
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 m=!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})),m=!r["no-keep-open"]),r["capture-plan"]&&(v.push("--capture-plan",r["capture-plan"]),m=!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 y=parseInt(r["cdp-port"]||"",10)||19852;v.push("--cdp-port",String(y))}var w=!r["skip-typecheck"],g=(t=o(function*(){yield(0,p.sh)`${(0,p.p)()} ctor compile ${w?[]:["--no-check"]}`}),function(){return t.apply(this,arguments)});yield g();var x=c(o(function*(){try{yield g()}catch(e){console.error(`Recompile failed: ${e.message}`)}}),500),_=null;m&&(_=(0,i.watch)(`${d}/subspaces`,{recursive:!0},(e,t)=>{console.log(`Detected ${e} in ${t}`),x()}));var b=`${d}/.bricks/devtools.json`,k=()=>{try{(0,i.unlinkSync)(b)}catch{}};try{var S=JSON.parse((yield(0,s.readFile)(b,"utf8")));if(S.pid){try{process.kill(S.pid)}catch{}k()}}catch{}var T=(0,l.W)(import.meta.url),$=(0,n.spawn)("bunx",["--bun","electron",T,...v],{env:{...process.env,BRICKS_STAGE:f.stage||"production"},stdio:["inherit","pipe","inherit"]});(0,a.createInterface)({input:$.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:$.pid,address:"localhost",name:`${f.name||"Unnamed"} (CTOR Simulator)`,startedAt:new Date().toISOString()};(0,s.writeFile)(b,JSON.stringify(r,null,2))}console.log(e)}});try{var j=yield new Promise((e,t)=>{$.on("error",t),$.on("close",(t,r)=>e({code:t,signal:r}))}),E=j.code,O=j.signal;if(0!==E)throw Error(`Simulator exited with ${O?`signal ${O}`:`code ${E}`}`)}finally{x.cancel(),k(),_&&_.close()}})).apply(this,arguments)}}};
|
package/lib/9439.js
CHANGED
|
@@ -2530,7 +2530,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
|
|
|
2530
2530
|
timestamp
|
|
2531
2531
|
}
|
|
2532
2532
|
}
|
|
2533
|
-
`,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),t.abort()}}),function(e,i){return l.apply(this,arguments)}),t8="2.26.0-beta.24";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.
|
|
2533
|
+
`,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),t.abort()}}),function(e,i){return l.apply(this,arguments)}),t8="2.26.0-beta.25";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.
|
|
2534
2534
|
|
|
2535
2535
|
Before doing any complex work (application design, deployments, etc.),
|
|
2536
2536
|
always consult the official docs rather than guessing.
|