@fugood/bricks-cli 2.24.10 → 2.24.11

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/996.js ADDED
@@ -0,0 +1 @@
1
+ export const __webpack_esm_id__=996;export const __webpack_esm_ids__=[996];export const __webpack_esm_modules__={7996:(t,e,r)=>{r.r(e),r.d(e,{BANK_PROPERTY_META_VALUES:()=>o.YC,createBankClient:()=>d,resolveBankEndpoint:()=>i,validateBankPropertyMeta:()=>o.jR});var n=r(99436),a=r(72535),o=r(63402),p={"https://display.bricks.tools":"https://bank.bricks.tools","https://display-beta.bricks.tools":"https://bank-beta.bricks.tools"},i=t=>{if(process.env.BRICKS_BANK_ENDPOINT)return process.env.BRICKS_BANK_ENDPOINT;var e=p[t];if(e)return e;try{var r=new URL(t).hostname;if("localhost"===r||"127.0.0.1"===r)return"http://localhost:8080"}catch{}throw new Error(`Cannot derive the Data Bank endpoint from ${t}; set BRICKS_BANK_ENDPOINT to override`)},s="\n propertyId\n meta\n definition\n value\n tags\n lastUpdateHash\n lastUpdateNote\n lastUpdateKey\n createAt\n updateAt\n",d=({endpoint:t,spacename:e,spacekey:r})=>{var p,i=`${t}/api/graphql`,d=(0,a.P)(t),l=(p=n(function*(t,n){var a,o=yield d(i,{method:"POST",headers:{"content-type":"application/json",SPACENAME:e,SPACEKEY:r},body:JSON.stringify({query:t,variables:n})}),p=yield o.text();try{a=JSON.parse(p)}catch{a=null}if(a?.errors?.length)throw new Error(a.errors.map(({message:t})=>t).join("\n"));if(!o.ok){var s=new Error(`Data Bank API error (${o.status}): ${p.trim()}`);throw 403===o.status&&(s.isBankAuthError=!0),s}return a?.data||{}}),function(t,e){return p.apply(this,arguments)});return{listProperties(){return n(function*({keyword:t,meta:e,ids:r}={}){return(0,o.jR)(e),(yield l(`#graphql\n query(\n $filterUpdateHashes: [PropertyFilterUpdateHash!]\n $filterMeta: String\n $filterKeyword: String\n ) {\n properties(\n filterUpdateHashes: $filterUpdateHashes\n filterMeta: $filterMeta\n filterKeyword: $filterKeyword\n ) { ${s} }\n }\n `,{filterUpdateHashes:r?.map(t=>({propertyId:t,value:""})),filterMeta:e,filterKeyword:t})).properties||[]}).apply(this,arguments)},getProperty(t){var e=this;return n(function*(){return(yield e.listProperties({ids:[t]})).find(e=>e.propertyId===t)||null})()},updateProperties:(t,e)=>n(function*(){if(!t?.length)throw new Error("No properties to update.");var r=t.map(t=>{var e=t.meta||"InSubspace";return(0,o.jR)(e),{propertyId:t.propertyId,meta:e,definition:t.definition,newDefinitionFallback:t.newDefinitionFallback,value:t.value,updateNote:t.updateNote||"Updated via bricks-cli",upsert:!1!==t.upsert,tags:t.tags}});return(yield l(`#graphql\n mutation($properties: [PropertyInput!]!, $dontNotify: Boolean) {\n updateProperty(properties: $properties, dontNotify: $dontNotify) { ${s} }\n }\n `,{properties:r,dontNotify:e})).updateProperty||[]})(),removeProperty:t=>n(function*(){return(yield l("#graphql\n mutation($propertyId: String!) {\n removeProperty(propertyId: $propertyId)\n }\n ",{propertyId:t})).removeProperty??!1})()}}},72535:(t,e,r)=>{r.d(e,{P:()=>o});var n=r(79657),a=r(64007);function o(t){var e=process.env.HTTPS_PROXY||process.env.https_proxy;if(!e||!t.startsWith("https://"))return n.Ay;var r=new a(e);return(t,e={})=>(0,n.Ay)(t,{...e,agent:r})}}};