@fugood/bricks-cli 2.26.0-beta.14 → 2.26.0-beta.16

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/9387.js CHANGED
@@ -1,4 +1,4 @@
1
- export const __rspack_esm_id=9387;export const __rspack_esm_ids=[9387];export const __webpack_modules__={75149(t,r,e){e.d(r,{P:()=>i});var a=e(79657),o=e(64007);function i(t){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!t.startsWith("https://"))return a.Ay;var e=new o(r);return(t,r={})=>(0,a.Ay)(t,{...r,agent:e})}},30182(t,r,e){e.r(r),e.d(r,{BANK_PROPERTY_META_VALUES:()=>i.YC,createBankClient:()=>c,resolveBankEndpoint:()=>n,validateBankPropertyMeta:()=>i.jR});var a=e(99436),o=e(75149),i=e(31596),p={"https://display.bricks.tools":"https://bank.bricks.tools","https://display-beta.bricks.tools":"https://bank-beta.bricks.tools"},n=t=>{if(process.env.BRICKS_BANK_ENDPOINT)return process.env.BRICKS_BANK_ENDPOINT;var r=p[t];if(r)return r;try{var e=new URL(t).hostname;if("localhost"===e||"127.0.0.1"===e)return"http://localhost:8080"}catch{}throw Error(`Cannot derive the Data Bank endpoint from ${t}; set BRICKS_BANK_ENDPOINT to override`)},s=`
1
+ export const __rspack_esm_id=9387;export const __rspack_esm_ids=[9387];export const __webpack_modules__={75149(r,t,e){e.d(t,{P:()=>p});var a=e(79657),o=e(64007);function p(r){var t=process.env.HTTPS_PROXY||process.env.https_proxy;if(!t||!r.startsWith("https://"))return a.Ay;var e=new o(t);return(r,t={})=>(0,a.Ay)(r,{...t,agent:e})}},30182(r,t,e){e.r(t),e.d(t,{BANK_PROPERTY_META_VALUES:()=>p.YC,createBankClient:()=>f,resolveBankEndpoint:()=>n,validateBankPropertyMeta:()=>p.jR});var a=e(99436),o=e(75149),p=e(31596),i={"https://display.bricks.tools":"https://bank.bricks.tools","https://display-beta.bricks.tools":"https://bank-beta.bricks.tools"},n=r=>{if(process.env.BRICKS_BANK_ENDPOINT)return process.env.BRICKS_BANK_ENDPOINT;var t=i[r];if(t)return t;try{var e=new URL(r).hostname;if("localhost"===e||"127.0.0.1"===e)return"http://localhost:8080"}catch{}throw Error(`Cannot derive the Data Bank endpoint from ${r}; set BRICKS_BANK_ENDPOINT to override`)},s=`
2
2
  propertyId
3
3
  meta
4
4
  definition
@@ -9,7 +9,7 @@ export const __rspack_esm_id=9387;export const __rspack_esm_ids=[9387];export co
9
9
  lastUpdateKey
10
10
  createAt
11
11
  updateAt
12
- `,l={InSubspace:"IN_SUBSPACE",Global:"GLOBAL"},d={IN_SUBSPACE:"InSubspace",GLOBAL:"Global"},u=t=>void 0===t?void 0:JSON.stringify(t),y=t=>t&&d[t.meta]?{...t,meta:d[t.meta]}:t,c=({endpoint:t,spacename:r,spacekey:e})=>{var p,n=`${t}/api/graphql`,d=(0,o.P)(t),c=(p=a(function*(t,a){var o,i=yield d(n,{method:"POST",headers:{"content-type":"application/json",SPACENAME:r,SPACEKEY:e},body:JSON.stringify({query:t,variables:a})}),p=yield i.text();try{o=JSON.parse(p)}catch{o=null}if(o?.errors?.length)throw Error(o.errors.map(({message:t})=>t).join("\n"));if(!i.ok){var s=Error(`Data Bank API error (${i.status}): ${p.trim()}`);throw 403===i.status&&(s.isBankAuthError=!0),s}return o?.data||{}}),function(t,r){return p.apply(this,arguments)});return{listProperties(){return a(function*({keyword:t,meta:r,ids:e}={}){return(0,i.jR)(r),((yield c(`#graphql
12
+ `,l={InSubspace:"IN_SUBSPACE",Global:"GLOBAL"},d={IN_SUBSPACE:"InSubspace",GLOBAL:"Global"},y=r=>void 0===r?void 0:JSON.stringify(r),u=r=>r&&d[r.meta]?{...r,meta:d[r.meta]}:r,c=(r,t)=>{var e=r[t];if(null!==e&&!Array.isArray(e))throw Error(`Invalid Data Bank API response: expected ${t} to be an array or null`);return(e||[]).map(u)},f=({endpoint:r,spacename:t,spacekey:e})=>{var i,n=`${r}/api/graphql`,d=(0,o.P)(r),u=(i=a(function*(r,a){var o,p=yield d(n,{method:"POST",headers:{"content-type":"application/json",SPACENAME:t,SPACEKEY:e},body:JSON.stringify({query:r,variables:a})}),i=yield p.text();try{o=JSON.parse(i)}catch{if(p.ok)throw Error(`Invalid Data Bank API response (${p.status}): expected JSON`)}if(o?.errors?.length)throw Error(o.errors.map(({message:r})=>r).join("\n"));if(!p.ok){var s=Error(`Data Bank API error (${p.status}): ${i.trim()}`);throw 403===p.status&&(s.isBankAuthError=!0),s}if(!o?.data||"object"!=typeof o.data||Array.isArray(o.data))throw Error("Invalid Data Bank API response: expected a data object");return o.data}),function(r,t){return i.apply(this,arguments)});return{listProperties(){return a(function*({keyword:r,meta:t,ids:e}={}){return(0,p.jR)(t),c((yield u(`#graphql
13
13
  query(
14
14
  $filterUpdateHashes: [PropertyFilterUpdateHash!]
15
15
  $filterMeta: String
@@ -21,12 +21,12 @@ export const __rspack_esm_id=9387;export const __rspack_esm_ids=[9387];export co
21
21
  filterKeyword: $filterKeyword
22
22
  ) { ${s} }
23
23
  }
24
- `,{filterUpdateHashes:e?.map(t=>({propertyId:t,value:""})),filterMeta:r,filterKeyword:t})).properties||[]).map(y)}).apply(this,arguments)},getProperty(t){var r=this;return a(function*(){return(yield r.listProperties({ids:[t]})).find(r=>r.propertyId===t)||null})()},updateProperties:(t,r)=>a(function*(){if(!t?.length)throw Error("No properties to update.");var e=t.map(t=>{var r=t.meta||"InSubspace";return(0,i.jR)(r),{propertyId:t.propertyId,meta:l[r],definition:u(t.definition),newDefinitionFallback:u(t.newDefinitionFallback),value:u(t.value),updateNote:t.updateNote||"Updated via bricks-cli",upsert:!1!==t.upsert,tags:t.tags}});return((yield c(`#graphql
24
+ `,{filterUpdateHashes:e?.map(r=>({propertyId:r,value:""})),filterMeta:t,filterKeyword:r})),"properties")}).apply(this,arguments)},getProperty(r){var t=this;return a(function*(){return(yield t.listProperties({ids:[r]})).find(t=>t.propertyId===r)||null})()},updateProperties:(r,t)=>a(function*(){if(!r?.length)throw Error("No properties to update.");var e=r.map(r=>{var t=r.meta||"InSubspace";return(0,p.jR)(t),{propertyId:r.propertyId,meta:l[t],definition:y(r.definition),newDefinitionFallback:y(r.newDefinitionFallback),value:y(r.value),updateNote:r.updateNote||"Updated via bricks-cli",upsert:!1!==r.upsert,tags:r.tags}});return c((yield u(`#graphql
25
25
  mutation($properties: [PropertyInput!]!, $dontNotify: Boolean) {
26
26
  updateProperty(properties: $properties, dontNotify: $dontNotify) { ${s} }
27
27
  }
28
- `,{properties:e,dontNotify:r})).updateProperty||[]).map(y)})(),removeProperty:t=>a(function*(){return(yield c(`#graphql
28
+ `,{properties:e,dontNotify:t})),"updateProperty")})(),removeProperty:r=>a(function*(){var t=yield u(`#graphql
29
29
  mutation($propertyId: String!) {
30
30
  removeProperty(propertyId: $propertyId)
31
31
  }
32
- `,{propertyId:t})).removeProperty??!1})()}}}};
32
+ `,{propertyId:r});if(null!==t.removeProperty&&"boolean"!=typeof t.removeProperty)throw Error("Invalid Data Bank API response: expected removeProperty to be a boolean or null");return t.removeProperty??!1})()}}}};