strapi-plugin-comments 3.0.11 → 3.0.12
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 +17 -0
- package/dist/_chunks/{index-tUit0Fx4.mjs → index-AFEDE3U9.mjs} +2 -2
- package/dist/_chunks/{index-CLWGT_vP.js → index-BJ-cmAR2.js} +1 -1
- package/dist/_chunks/{index-CFRFtK93.mjs → index-BpOlLizi.mjs} +416 -403
- package/dist/_chunks/{index-670UMREc.js → index-C4akpgH_.js} +1 -1
- package/dist/_chunks/{index-BcTMW0bl.mjs → index-CpBNh6Rx.mjs} +8135 -7897
- package/dist/_chunks/{index-DexwEcn3.mjs → index-DImm7PZM.mjs} +2 -2
- package/dist/_chunks/index-DYUGPksR.js +2228 -0
- package/dist/_chunks/index-hoQGufqY.js +18 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.mjs +2 -1
- package/dist/server/src/controllers/index.d.ts +111 -1
- package/dist/server/src/index.d.ts +444 -1
- package/dist/server/src/services/admin/admin.service.d.ts +111 -0
- package/dist/server/src/services/client.service.d.ts +111 -0
- package/dist/server/src/services/index.d.ts +333 -0
- package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +111 -0
- package/package.json +10 -3
- package/dist/_chunks/index-BgxJUAmG.js +0 -2238
- package/dist/_chunks/index-QMZY5BnX.js +0 -18
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";const z=require("react/jsx-runtime"),b=require("./index-DYUGPksR.js"),dr=require("@tanstack/react-query"),Y=require("react"),rt=require("@strapi/strapi/admin"),a=require("zod");function Xt(r){if(r&&r.__esModule)return r;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ae=Xt(Y),Zt=()=>{const r=()=>window.matchMedia("(prefers-color-scheme: dark)").matches,[e,t]=Y.useState();return Y.useEffect(()=>{const o=r()?"dark":"light",i=window.localStorage?.STRAPI_THEME;t(i==="system"?o:i)},[]),{theme:e==="dark"?b.darkTheme:b.lightTheme,themeName:e}};var ce=TypeError;const en={},rn=Object.freeze(Object.defineProperty({__proto__:null,default:en},Symbol.toStringTag,{value:"Module"})),tn=b.getAugmentedNamespace(rn);var mr=typeof Map=="function"&&Map.prototype,De=Object.getOwnPropertyDescriptor&&mr?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Re=mr&&De&&typeof De.get=="function"?De.get:null,$r=mr&&Map.prototype.forEach,vr=typeof Set=="function"&&Set.prototype,Le=Object.getOwnPropertyDescriptor&&vr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,we=vr&&Le&&typeof Le.get=="function"?Le.get:null,Rr=vr&&Set.prototype.forEach,nn=typeof WeakMap=="function"&&WeakMap.prototype,fe=nn?WeakMap.prototype.has:null,on=typeof WeakSet=="function"&&WeakSet.prototype,pe=on?WeakSet.prototype.has:null,an=typeof WeakRef=="function"&&WeakRef.prototype,wr=an?WeakRef.prototype.deref:null,ln=Boolean.prototype.valueOf,un=Object.prototype.toString,cn=Function.prototype.toString,sn=String.prototype.match,gr=String.prototype.slice,H=String.prototype.replace,fn=String.prototype.toUpperCase,zr=String.prototype.toLowerCase,tt=RegExp.prototype.test,Tr=Array.prototype.concat,L=Array.prototype.join,pn=Array.prototype.slice,_r=Math.floor,or=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Be=Object.getOwnPropertySymbols,ar=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ie=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ye=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ie||!0)?Symbol.toStringTag:null,nt=Object.prototype.propertyIsEnumerable,Cr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function xr(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||tt.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-_r(-r):_r(r);if(n!==r){var o=String(n),i=gr.call(e,o.length+1);return H.call(o,t,"$&_")+"."+H.call(H.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return H.call(e,t,"$&_")}var ir=tn,Ir=ir.custom,Nr=it(Ir)?Ir:null,ot={__proto__:null,double:'"',single:"'"},yn={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Ce=function r(e,t,n,o){var i=t||{};if(j(i,"quoteStyle")&&!j(ot,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(j(i,"maxStringLength")&&(typeof i.maxStringLength=="number"?i.maxStringLength<0&&i.maxStringLength!==1/0:i.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=j(i,"customInspect")?i.customInspect:!0;if(typeof c!="boolean"&&c!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(j(i,"indent")&&i.indent!==null&&i.indent!==" "&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(j(i,"numericSeparator")&&typeof i.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=i.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return ut(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var s=String(e);return l?xr(e,s):s}if(typeof e=="bigint"){var u=String(e)+"n";return l?xr(e,u):u}var p=typeof i.depth>"u"?5:i.depth;if(typeof n>"u"&&(n=0),n>=p&&p>0&&typeof e=="object")return lr(e)?"[Array]":"[Object]";var y=Cn(i,n);if(typeof o>"u")o=[];else if(lt(o,e)>=0)return"[Circular]";function m(N,G,ee){if(G&&(o=pn.call(o),o.push(G)),ee){var V={depth:i.depth};return j(i,"quoteStyle")&&(V.quoteStyle=i.quoteStyle),r(N,V,n+1,o)}return r(N,i,n+1,o)}if(typeof e=="function"&&!Mr(e)){var h=An(e),v=Ee(e,m);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(v.length>0?" { "+L.call(v,", ")+" }":"")}if(it(e)){var $=ie?H.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):ar.call(e);return typeof e=="object"&&!ie?se($):$}if(zn(e)){for(var _="<"+zr.call(String(e.nodeName)),g=e.attributes||[],x=0;x<g.length;x++)_+=" "+g[x].name+"="+at(dn(g[x].value),"double",i);return _+=">",e.childNodes&&e.childNodes.length&&(_+="..."),_+="</"+zr.call(String(e.nodeName))+">",_}if(lr(e)){if(e.length===0)return"[]";var O=Ee(e,m);return y&&!_n(O)?"["+ur(O,y)+"]":"[ "+L.call(O,", ")+" ]"}if(vn(e)){var R=Ee(e,m);return!("cause"in Error.prototype)&&"cause"in e&&!nt.call(e,"cause")?"{ ["+String(e)+"] "+L.call(Tr.call("[cause]: "+m(e.cause),R),", ")+" }":R.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+L.call(R,", ")+" }"}if(typeof e=="object"&&c){if(Nr&&typeof e[Nr]=="function"&&ir)return ir(e,{depth:p-n});if(c!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Pn(e)){var f=[];return $r&&$r.call(e,function(N,G){f.push(m(G,e,!0)+" => "+m(N,e))}),Fr("Map",Re.call(e),f,y)}if(Rn(e)){var M=[];return Rr&&Rr.call(e,function(N){M.push(m(N,e))}),Fr("Set",we.call(e),M,y)}if(On(e))return Ue("WeakMap");if(wn(e))return Ue("WeakSet");if($n(e))return Ue("WeakRef");if(hn(e))return se(m(Number(e)));if(bn(e))return se(m(or.call(e)));if(Sn(e))return se(ln.call(e));if(gn(e))return se(m(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof b.commonjsGlobal<"u"&&e===b.commonjsGlobal)return"{ [object globalThis] }";if(!mn(e)&&!Mr(e)){var B=Ee(e,m),F=Cr?Cr(e)===Object.prototype:e instanceof Object||e.constructor===Object,k=e instanceof Object?"":"null prototype",W=!F&&ye&&Object(e)===e&&ye in e?gr.call(K(e),8,-1):k?"Object":"",Q=F||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",I=Q+(W||k?"["+L.call(Tr.call([],W||[],k||[]),": ")+"] ":"");return B.length===0?I+"{}":y?I+"{"+ur(B,y)+"}":I+"{ "+L.call(B,", ")+" }"}return String(e)};function at(r,e,t){var n=t.quoteStyle||e,o=ot[n];return o+r+o}function dn(r){return H.call(String(r),/"/g,""")}function Z(r){return!ye||!(typeof r=="object"&&(ye in r||typeof r[ye]<"u"))}function lr(r){return K(r)==="[object Array]"&&Z(r)}function mn(r){return K(r)==="[object Date]"&&Z(r)}function Mr(r){return K(r)==="[object RegExp]"&&Z(r)}function vn(r){return K(r)==="[object Error]"&&Z(r)}function gn(r){return K(r)==="[object String]"&&Z(r)}function hn(r){return K(r)==="[object Number]"&&Z(r)}function Sn(r){return K(r)==="[object Boolean]"&&Z(r)}function it(r){if(ie)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!ar)return!1;try{return ar.call(r),!0}catch{}return!1}function bn(r){if(!r||typeof r!="object"||!or)return!1;try{return or.call(r),!0}catch{}return!1}var En=Object.prototype.hasOwnProperty||function(r){return r in this};function j(r,e){return En.call(r,e)}function K(r){return un.call(r)}function An(r){if(r.name)return r.name;var e=sn.call(cn.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function lt(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return t;return-1}function Pn(r){if(!Re||!r||typeof r!="object")return!1;try{Re.call(r);try{we.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function On(r){if(!fe||!r||typeof r!="object")return!1;try{fe.call(r,fe);try{pe.call(r,pe)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function $n(r){if(!wr||!r||typeof r!="object")return!1;try{return wr.call(r),!0}catch{}return!1}function Rn(r){if(!we||!r||typeof r!="object")return!1;try{we.call(r);try{Re.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function wn(r){if(!pe||!r||typeof r!="object")return!1;try{pe.call(r,pe);try{fe.call(r,fe)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function zn(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function ut(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return ut(gr.call(r,0,e.maxStringLength),e)+n}var o=yn[e.quoteStyle||"single"];o.lastIndex=0;var i=H.call(H.call(r,o,"\\$1"),/[\x00-\x1f]/g,Tn);return at(i,"single",e)}function Tn(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+fn.call(e.toString(16))}function se(r){return"Object("+r+")"}function Ue(r){return r+" { ? }"}function Fr(r,e,t,n){var o=n?ur(t,n):L.call(t,", ");return r+" ("+e+") {"+o+"}"}function _n(r){for(var e=0;e<r.length;e++)if(lt(r[e],`
|
|
2
|
+
`)>=0)return!1;return!0}function Cn(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=L.call(Array(r.indent+1)," ");else return null;return{base:t,prev:L.call(Array(e+1),t)}}function ur(r,e){if(r.length===0)return"";var t=`
|
|
3
|
+
`+e.prev+e.base;return t+L.call(r,","+t)+`
|
|
4
|
+
`+e.prev}function Ee(r,e){var t=lr(r),n=[];if(t){n.length=r.length;for(var o=0;o<r.length;o++)n[o]=j(r,o)?e(r[o],r):""}var i=typeof Be=="function"?Be(r):[],c;if(ie){c={};for(var l=0;l<i.length;l++)c["$"+i[l]]=i[l]}for(var s in r)j(r,s)&&(t&&String(Number(s))===s&&s<r.length||ie&&c["$"+s]instanceof Symbol||(tt.call(/[^\w$]/,s)?n.push(e(s,r)+": "+e(r[s],r)):n.push(s+": "+e(r[s],r))));if(typeof Be=="function")for(var u=0;u<i.length;u++)nt.call(r,i[u])&&n.push("["+e(i[u])+"]: "+e(r[i[u]],r));return n}var xn=Ce,In=ce,xe=function(r,e,t){for(var n=r,o;(o=n.next)!=null;n=o)if(o.key===e)return n.next=o.next,t||(o.next=r.next,r.next=o),o},Nn=function(r,e){if(r){var t=xe(r,e);return t&&t.value}},Mn=function(r,e,t){var n=xe(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},Fn=function(r,e){return r?!!xe(r,e):!1},Dn=function(r,e){if(r)return xe(r,e,!0)},Ln=function(){var e,t={assert:function(n){if(!t.has(n))throw new In("Side channel does not contain "+xn(n))},delete:function(n){var o=e&&e.next,i=Dn(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return Nn(e,n)},has:function(n){return Fn(e,n)},set:function(n,o){e||(e={next:void 0}),Mn(e,n,o)}};return t},ct=Object,Bn=Error,Un=EvalError,jn=RangeError,qn=ReferenceError,kn=SyntaxError,Wn=URIError,Gn=Math.abs,Vn=Math.floor,Hn=Math.max,Yn=Math.min,Kn=Math.pow,Qn=Math.round,Jn=Number.isNaN||function(e){return e!==e},Xn=Jn,Zn=function(e){return Xn(e)||e===0?e:e<0?-1:1},eo=Object.getOwnPropertyDescriptor,Pe=eo;if(Pe)try{Pe([],"length")}catch{Pe=null}var st=Pe,Oe=Object.defineProperty||!1;if(Oe)try{Oe({},"a",{value:1})}catch{Oe=!1}var ro=Oe,je,Dr;function to(){return Dr||(Dr=1,je=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;e[t]=o;for(var i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var c=Object.getOwnPropertySymbols(e);if(c.length!==1||c[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,t);if(l.value!==o||l.enumerable!==!0)return!1}return!0}),je}var qe,Lr;function no(){if(Lr)return qe;Lr=1;var r=typeof Symbol<"u"&&Symbol,e=to();return qe=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},qe}var ke,Br;function ft(){return Br||(Br=1,ke=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),ke}var We,Ur;function pt(){if(Ur)return We;Ur=1;var r=ct;return We=r.getPrototypeOf||null,We}var Ge,jr;function oo(){if(jr)return Ge;jr=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",o=function(s,u){for(var p=[],y=0;y<s.length;y+=1)p[y]=s[y];for(var m=0;m<u.length;m+=1)p[m+s.length]=u[m];return p},i=function(s,u){for(var p=[],y=u,m=0;y<s.length;y+=1,m+=1)p[m]=s[y];return p},c=function(l,s){for(var u="",p=0;p<l.length;p+=1)u+=l[p],p+1<l.length&&(u+=s);return u};return Ge=function(s){var u=this;if(typeof u!="function"||e.apply(u)!==n)throw new TypeError(r+u);for(var p=i(arguments,1),y,m=function(){if(this instanceof y){var g=u.apply(this,o(p,arguments));return Object(g)===g?g:this}return u.apply(s,o(p,arguments))},h=t(0,u.length-p.length),v=[],$=0;$<h;$++)v[$]="$"+$;if(y=Function("binder","return function ("+c(v,",")+"){ return binder.apply(this,arguments); }")(m),u.prototype){var _=function(){};_.prototype=u.prototype,y.prototype=new _,_.prototype=null}return y},Ge}var Ve,qr;function Ie(){if(qr)return Ve;qr=1;var r=oo();return Ve=Function.prototype.bind||r,Ve}var He,kr;function hr(){return kr||(kr=1,He=Function.prototype.call),He}var Ye,Wr;function yt(){return Wr||(Wr=1,Ye=Function.prototype.apply),Ye}var ao=typeof Reflect<"u"&&Reflect&&Reflect.apply,io=Ie(),lo=yt(),uo=hr(),co=ao,so=co||io.call(uo,lo),fo=Ie(),po=ce,yo=hr(),mo=so,dt=function(e){if(e.length<1||typeof e[0]!="function")throw new po("a function is required");return mo(fo,yo,e)},Ke,Gr;function vo(){if(Gr)return Ke;Gr=1;var r=dt,e=st,t;try{t=[].__proto__===Array.prototype}catch(c){if(!c||typeof c!="object"||!("code"in c)||c.code!=="ERR_PROTO_ACCESS")throw c}var n=!!t&&e&&e(Object.prototype,"__proto__"),o=Object,i=o.getPrototypeOf;return Ke=n&&typeof n.get=="function"?r([n.get]):typeof i=="function"?function(l){return i(l==null?l:o(l))}:!1,Ke}var Qe,Vr;function go(){if(Vr)return Qe;Vr=1;var r=ft(),e=pt(),t=vo();return Qe=r?function(o){return r(o)}:e?function(o){if(!o||typeof o!="object"&&typeof o!="function")throw new TypeError("getProto: not an object");return e(o)}:t?function(o){return t(o)}:null,Qe}var Je,Hr;function ho(){if(Hr)return Je;Hr=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=Ie();return Je=t.call(r,e),Je}var S,So=ct,bo=Bn,Eo=Un,Ao=jn,Po=qn,le=kn,oe=ce,Oo=Wn,$o=Gn,Ro=Vn,wo=Hn,zo=Yn,To=Kn,_o=Qn,Co=Zn,mt=Function,Xe=function(r){try{return mt('"use strict"; return ('+r+").constructor;")()}catch{}},me=st,xo=ro,Ze=function(){throw new oe},Io=me?function(){try{return arguments.callee,Ze}catch{try{return me(arguments,"callee").get}catch{return Ze}}}():Ze,re=no()(),T=go(),No=pt(),Mo=ft(),vt=yt(),ve=hr(),ne={},Fo=typeof Uint8Array>"u"||!T?S:T(Uint8Array),X={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?S:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?S:ArrayBuffer,"%ArrayIteratorPrototype%":re&&T?T([][Symbol.iterator]()):S,"%AsyncFromSyncIteratorPrototype%":S,"%AsyncFunction%":ne,"%AsyncGenerator%":ne,"%AsyncGeneratorFunction%":ne,"%AsyncIteratorPrototype%":ne,"%Atomics%":typeof Atomics>"u"?S:Atomics,"%BigInt%":typeof BigInt>"u"?S:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?S:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?S:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?S:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":bo,"%eval%":eval,"%EvalError%":Eo,"%Float16Array%":typeof Float16Array>"u"?S:Float16Array,"%Float32Array%":typeof Float32Array>"u"?S:Float32Array,"%Float64Array%":typeof Float64Array>"u"?S:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?S:FinalizationRegistry,"%Function%":mt,"%GeneratorFunction%":ne,"%Int8Array%":typeof Int8Array>"u"?S:Int8Array,"%Int16Array%":typeof Int16Array>"u"?S:Int16Array,"%Int32Array%":typeof Int32Array>"u"?S:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":re&&T?T(T([][Symbol.iterator]())):S,"%JSON%":typeof JSON=="object"?JSON:S,"%Map%":typeof Map>"u"?S:Map,"%MapIteratorPrototype%":typeof Map>"u"||!re||!T?S:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":So,"%Object.getOwnPropertyDescriptor%":me,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?S:Promise,"%Proxy%":typeof Proxy>"u"?S:Proxy,"%RangeError%":Ao,"%ReferenceError%":Po,"%Reflect%":typeof Reflect>"u"?S:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?S:Set,"%SetIteratorPrototype%":typeof Set>"u"||!re||!T?S:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?S:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":re&&T?T(""[Symbol.iterator]()):S,"%Symbol%":re?Symbol:S,"%SyntaxError%":le,"%ThrowTypeError%":Io,"%TypedArray%":Fo,"%TypeError%":oe,"%Uint8Array%":typeof Uint8Array>"u"?S:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?S:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?S:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?S:Uint32Array,"%URIError%":Oo,"%WeakMap%":typeof WeakMap>"u"?S:WeakMap,"%WeakRef%":typeof WeakRef>"u"?S:WeakRef,"%WeakSet%":typeof WeakSet>"u"?S:WeakSet,"%Function.prototype.call%":ve,"%Function.prototype.apply%":vt,"%Object.defineProperty%":xo,"%Object.getPrototypeOf%":No,"%Math.abs%":$o,"%Math.floor%":Ro,"%Math.max%":wo,"%Math.min%":zo,"%Math.pow%":To,"%Math.round%":_o,"%Math.sign%":Co,"%Reflect.getPrototypeOf%":Mo};if(T)try{null.error}catch(r){var Do=T(T(r));X["%Error.prototype%"]=Do}var Lo=function r(e){var t;if(e==="%AsyncFunction%")t=Xe("async function () {}");else if(e==="%GeneratorFunction%")t=Xe("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Xe("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=r("%AsyncGenerator%");o&&T&&(t=T(o.prototype))}return X[e]=t,t},Yr={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ge=Ie(),ze=ho(),Bo=ge.call(ve,Array.prototype.concat),Uo=ge.call(vt,Array.prototype.splice),Kr=ge.call(ve,String.prototype.replace),Te=ge.call(ve,String.prototype.slice),jo=ge.call(ve,RegExp.prototype.exec),qo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ko=/\\(\\)?/g,Wo=function(e){var t=Te(e,0,1),n=Te(e,-1);if(t==="%"&&n!=="%")throw new le("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new le("invalid intrinsic syntax, expected opening `%`");var o=[];return Kr(e,qo,function(i,c,l,s){o[o.length]=l?Kr(s,ko,"$1"):c||i}),o},Go=function(e,t){var n=e,o;if(ze(Yr,n)&&(o=Yr[n],n="%"+o[0]+"%"),ze(X,n)){var i=X[n];if(i===ne&&(i=Lo(n)),typeof i>"u"&&!t)throw new oe("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new le("intrinsic "+e+" does not exist!")},Sr=function(e,t){if(typeof e!="string"||e.length===0)throw new oe("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new oe('"allowMissing" argument must be a boolean');if(jo(/^%?[^%]*%?$/,e)===null)throw new le("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Wo(e),o=n.length>0?n[0]:"",i=Go("%"+o+"%",t),c=i.name,l=i.value,s=!1,u=i.alias;u&&(o=u[0],Uo(n,Bo([0,1],u)));for(var p=1,y=!0;p<n.length;p+=1){var m=n[p],h=Te(m,0,1),v=Te(m,-1);if((h==='"'||h==="'"||h==="`"||v==='"'||v==="'"||v==="`")&&h!==v)throw new le("property names with quotes must have matching quotes");if((m==="constructor"||!y)&&(s=!0),o+="."+m,c="%"+o+"%",ze(X,c))l=X[c];else if(l!=null){if(!(m in l)){if(!t)throw new oe("base intrinsic for "+e+" exists, but the property is not available.");return}if(me&&p+1>=n.length){var $=me(l,m);y=!!$,y&&"get"in $&&!("originalValue"in $.get)?l=$.get:l=l[m]}else y=ze(l,m),l=l[m];y&&!s&&(X[c]=l)}}return l},gt=Sr,ht=dt,Vo=ht([gt("%String.prototype.indexOf%")]),St=function(e,t){var n=gt(e,!!t);return typeof n=="function"&&Vo(e,".prototype.")>-1?ht([n]):n},Ho=Sr,he=St,Yo=Ce,Ko=ce,Qr=Ho("%Map%",!0),Qo=he("Map.prototype.get",!0),Jo=he("Map.prototype.set",!0),Xo=he("Map.prototype.has",!0),Zo=he("Map.prototype.delete",!0),ea=he("Map.prototype.size",!0),bt=!!Qr&&function(){var e,t={assert:function(n){if(!t.has(n))throw new Ko("Side channel does not contain "+Yo(n))},delete:function(n){if(e){var o=Zo(e,n);return ea(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return Qo(e,n)},has:function(n){return e?Xo(e,n):!1},set:function(n,o){e||(e=new Qr),Jo(e,n,o)}};return t},ra=Sr,Ne=St,ta=Ce,Ae=bt,na=ce,te=ra("%WeakMap%",!0),oa=Ne("WeakMap.prototype.get",!0),aa=Ne("WeakMap.prototype.set",!0),ia=Ne("WeakMap.prototype.has",!0),la=Ne("WeakMap.prototype.delete",!0),ua=te?function(){var e,t,n={assert:function(o){if(!n.has(o))throw new na("Side channel does not contain "+ta(o))},delete:function(o){if(te&&o&&(typeof o=="object"||typeof o=="function")){if(e)return la(e,o)}else if(Ae&&t)return t.delete(o);return!1},get:function(o){return te&&o&&(typeof o=="object"||typeof o=="function")&&e?oa(e,o):t&&t.get(o)},has:function(o){return te&&o&&(typeof o=="object"||typeof o=="function")&&e?ia(e,o):!!t&&t.has(o)},set:function(o,i){te&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new te),aa(e,o,i)):Ae&&(t||(t=Ae()),t.set(o,i))}};return n}:Ae,ca=ce,sa=Ce,fa=Ln,pa=bt,ya=ua,da=ya||pa||fa,ma=function(){var e,t={assert:function(n){if(!t.has(n))throw new ca("Side channel does not contain "+sa(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,o){e||(e=da()),e.set(n,o)}};return t},va=String.prototype.replace,ga=/%20/g,er={RFC1738:"RFC1738",RFC3986:"RFC3986"},br={default:er.RFC3986,formatters:{RFC1738:function(r){return va.call(r,ga,"+")},RFC3986:function(r){return String(r)}},RFC1738:er.RFC1738,RFC3986:er.RFC3986},ha=br,rr=Object.prototype.hasOwnProperty,J=Array.isArray,D=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Sa=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(J(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);t.obj[t.prop]=o}}},Et=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},o=0;o<e.length;++o)typeof e[o]<"u"&&(n[o]=e[o]);return n},ba=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(J(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!rr.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var o=e;return J(e)&&!J(t)&&(o=Et(e,n)),J(e)&&J(t)?(t.forEach(function(i,c){if(rr.call(e,c)){var l=e[c];l&&typeof l=="object"&&i&&typeof i=="object"?e[c]=r(l,i,n):e.push(i)}else e[c]=i}),e):Object.keys(t).reduce(function(i,c){var l=t[c];return rr.call(i,c)?i[c]=r(i[c],l,n):i[c]=l,i},o)},Ea=function(e,t){return Object.keys(t).reduce(function(n,o){return n[o]=t[o],n},e)},Aa=function(r,e,t){var n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Pa=function(e,t,n,o,i){if(e.length===0)return e;var c=e;if(typeof e=="symbol"?c=Symbol.prototype.toString.call(e):typeof e!="string"&&(c=String(e)),n==="iso-8859-1")return escape(c).replace(/%u[0-9a-f]{4}/gi,function(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});for(var l="",s=0;s<c.length;++s){var u=c.charCodeAt(s);if(u===45||u===46||u===95||u===126||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===ha.RFC1738&&(u===40||u===41)){l+=c.charAt(s);continue}if(u<128){l=l+D[u];continue}if(u<2048){l=l+(D[192|u>>6]+D[128|u&63]);continue}if(u<55296||u>=57344){l=l+(D[224|u>>12]+D[128|u>>6&63]+D[128|u&63]);continue}s+=1,u=65536+((u&1023)<<10|c.charCodeAt(s)&1023),l+=D[240|u>>18]+D[128|u>>12&63]+D[128|u>>6&63]+D[128|u&63]}return l},Oa=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],o=0;o<t.length;++o)for(var i=t[o],c=i.obj[i.prop],l=Object.keys(c),s=0;s<l.length;++s){var u=l[s],p=c[u];typeof p=="object"&&p!==null&&n.indexOf(p)===-1&&(t.push({obj:c,prop:u}),n.push(p))}return Sa(t),e},$a=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Ra=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},wa=function(e,t){return[].concat(e,t)},za=function(e,t){if(J(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(t(e[o]));return n}return t(e)},At={arrayToObject:Et,assign:Ea,combine:wa,compact:Oa,decode:Aa,encode:Pa,isBuffer:Ra,isRegExp:$a,maybeMap:za,merge:ba},Pt=ma,$e=At,de=br,Ta=Object.prototype.hasOwnProperty,Jr={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},q=Array.isArray,_a=Array.prototype.push,Ot=function(r,e){_a.apply(r,q(e)?e:[e])},Ca=Date.prototype.toISOString,Xr=de.default,C={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:$e.encode,encodeValuesOnly:!1,format:Xr,formatter:de.formatters[Xr],indices:!1,serializeDate:function(e){return Ca.call(e)},skipNulls:!1,strictNullHandling:!1},xa=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},tr={},Ia=function r(e,t,n,o,i,c,l,s,u,p,y,m,h,v,$,_){for(var g=e,x=_,O=0,R=!1;(x=x.get(tr))!==void 0&&!R;){var f=x.get(e);if(O+=1,typeof f<"u"){if(f===O)throw new RangeError("Cyclic object value");R=!0}typeof x.get(tr)>"u"&&(O=0)}if(typeof s=="function"?g=s(t,g):g instanceof Date?g=y(g):n==="comma"&&q(g)&&(g=$e.maybeMap(g,function(V){return V instanceof Date?y(V):V})),g===null){if(i)return l&&!v?l(t,C.encoder,$,"key",m):t;g=""}if(xa(g)||$e.isBuffer(g)){if(l){var M=v?t:l(t,C.encoder,$,"key",m);return[h(M)+"="+h(l(g,C.encoder,$,"value",m))]}return[h(t)+"="+h(String(g))]}var B=[];if(typeof g>"u")return B;var F;if(n==="comma"&&q(g))v&&l&&(g=$e.maybeMap(g,l)),F=[{value:g.length>0?g.join(",")||null:void 0}];else if(q(s))F=s;else{var k=Object.keys(g);F=u?k.sort(u):k}for(var W=o&&q(g)&&g.length===1?t+"[]":t,Q=0;Q<F.length;++Q){var I=F[Q],N=typeof I=="object"&&typeof I.value<"u"?I.value:g[I];if(!(c&&N===null)){var G=q(g)?typeof n=="function"?n(W,I):W:W+(p?"."+I:"["+I+"]");_.set(e,O);var ee=Pt();ee.set(tr,_),Ot(B,r(N,G,n,o,i,c,n==="comma"&&v&&q(g)?null:l,s,u,p,y,m,h,v,$,ee))}}return B},Na=function(e){if(!e)return C;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||C.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=de.default;if(typeof e.format<"u"){if(!Ta.call(de.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=de.formatters[n],i=C.filter;return(typeof e.filter=="function"||q(e.filter))&&(i=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:C.addQueryPrefix,allowDots:typeof e.allowDots>"u"?C.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:C.charsetSentinel,delimiter:typeof e.delimiter>"u"?C.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:C.encode,encoder:typeof e.encoder=="function"?e.encoder:C.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:C.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:C.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:C.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:C.strictNullHandling}},Ma=function(r,e){var t=r,n=Na(e),o,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):q(n.filter)&&(i=n.filter,o=i);var c=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in Jr?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var s=Jr[l];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=s==="comma"&&e&&e.commaRoundTrip;o||(o=Object.keys(t)),n.sort&&o.sort(n.sort);for(var p=Pt(),y=0;y<o.length;++y){var m=o[y];n.skipNulls&&t[m]===null||Ot(c,Ia(t[m],m,s,u,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,p))}var h=c.join(n.delimiter),v=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?v+="utf8=%26%2310003%3B&":v+="utf8=%E2%9C%93&"),h.length>0?v+h:""},ue=At,cr=Object.prototype.hasOwnProperty,Fa=Array.isArray,w={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:ue.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Da=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},$t=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},La="utf8=%26%2310003%3B",Ba="utf8=%E2%9C%93",Ua=function(e,t){var n={},o=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,c=o.split(t.delimiter,i),l=-1,s,u=t.charset;if(t.charsetSentinel)for(s=0;s<c.length;++s)c[s].indexOf("utf8=")===0&&(c[s]===Ba?u="utf-8":c[s]===La&&(u="iso-8859-1"),l=s,s=c.length);for(s=0;s<c.length;++s)if(s!==l){var p=c[s],y=p.indexOf("]="),m=y===-1?p.indexOf("="):y+1,h,v;m===-1?(h=t.decoder(p,w.decoder,u,"key"),v=t.strictNullHandling?null:""):(h=t.decoder(p.slice(0,m),w.decoder,u,"key"),v=ue.maybeMap($t(p.slice(m+1),t),function($){return t.decoder($,w.decoder,u,"value")})),v&&t.interpretNumericEntities&&u==="iso-8859-1"&&(v=Da(v)),p.indexOf("[]=")>-1&&(v=Fa(v)?[v]:v),cr.call(n,h)?n[h]=ue.combine(n[h],v):n[h]=v}return n},ja=function(r,e,t,n){for(var o=n?e:$t(e,t),i=r.length-1;i>=0;--i){var c,l=r[i];if(l==="[]"&&t.parseArrays)c=[].concat(o);else{c=t.plainObjects?Object.create(null):{};var s=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=parseInt(s,10);!t.parseArrays&&s===""?c={0:o}:!isNaN(u)&&l!==s&&String(u)===s&&u>=0&&t.parseArrays&&u<=t.arrayLimit?(c=[],c[u]=o):s!=="__proto__"&&(c[s]=o)}o=c}return o},qa=function(e,t,n,o){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,c=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,s=n.depth>0&&c.exec(i),u=s?i.slice(0,s.index):i,p=[];if(u){if(!n.plainObjects&&cr.call(Object.prototype,u)&&!n.allowPrototypes)return;p.push(u)}for(var y=0;n.depth>0&&(s=l.exec(i))!==null&&y<n.depth;){if(y+=1,!n.plainObjects&&cr.call(Object.prototype,s[1].slice(1,-1))&&!n.allowPrototypes)return;p.push(s[1])}return s&&p.push("["+i.slice(s.index)+"]"),ja(p,t,n,o)}},ka=function(e){if(!e)return w;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?w.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?w.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:w.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:w.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:w.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:w.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:w.comma,decoder:typeof e.decoder=="function"?e.decoder:w.decoder,delimiter:typeof e.delimiter=="string"||ue.isRegExp(e.delimiter)?e.delimiter:w.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:w.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:w.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:w.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:w.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:w.strictNullHandling}},Wa=function(r,e){var t=ka(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var n=typeof r=="string"?Ua(r,t):r,o=t.plainObjects?Object.create(null):{},i=Object.keys(n),c=0;c<i.length;++c){var l=i[c],s=qa(l,n[l],t,typeof r=="string");o=ue.merge(o,s,t)}return t.allowSparse===!0?o:ue.compact(o)},Ga=Ma,Va=Wa,Ha=br,nr={formats:Ha,parse:Va,stringify:Ga};const Rt={PENDING:"PENDING",APPROVED:"APPROVED",REJECTED:"REJECTED"},Ya={...Rt,BLOCKED:"BLOCKED",OPEN:"OPEN",RESOLVED:"RESOLVED"};var wt=(r=>(r.BAD_LANGUAGE="BAD_LANGUAGE",r.DISCRIMINATION="DISCRIMINATION",r.OTHER="OTHER",r))(wt||{});const U={...Rt,BLOCKED:"BLOCKED",OPEN:"OPEN",REMOVED:"REMOVED",TO_REVIEW:"TO_REVIEW",UNKNOWN:"UNKNOWN"},Ka=a.z.object({entryLabel:a.z.record(a.z.array(a.z.string())),approvalFlow:a.z.array(a.z.string()),blockedAuthorProps:a.z.array(a.z.string()),reportReasons:a.z.object({BAD_LANGUAGE:a.z.literal("BAD_LANGUAGE"),DISCRIMINATION:a.z.literal("DISCRIMINATION"),OTHER:a.z.literal("OTHER")}),regex:a.z.object({uid:a.z.string(),relatedUid:a.z.string(),email:a.z.string(),sorting:a.z.string()}),enabledCollections:a.z.array(a.z.string()),moderatorRoles:a.z.array(a.z.string()),isGQLPluginEnabled:a.z.boolean(),badWords:a.z.boolean().nullable().optional(),gql:a.z.object({auth:a.z.boolean().nullable()}).optional(),client:a.z.object({url:a.z.string().nullable(),contactEmail:a.z.string().nullable()}).default({url:null,contactEmail:null})}),zt=a.z.intersection(a.z.object({id:a.z.number(),uid:a.z.string(),documentId:a.z.string(),createdAt:a.z.string(),updatedAt:a.z.string(),publishedAt:a.z.string().nullable(),locale:a.z.string().nullable().optional()}),a.z.record(a.z.unknown())),Qa=a.z.object({id:a.z.union([a.z.number(),a.z.string()]),name:a.z.string().optional().nullable(),email:a.z.string(),avatar:a.z.union([a.z.object({url:a.z.string()}),a.z.object({url:a.z.string(),formats:a.z.object({thumbnail:a.z.object({url:a.z.string()}).nullable()})}),a.z.string()]).nullable().optional()}),Tt=a.z.union([a.z.literal(U.PENDING),a.z.literal(U.APPROVED),a.z.literal(U.REJECTED),a.z.literal(U.BLOCKED),a.z.literal(U.OPEN),a.z.literal(U.REMOVED),a.z.literal(U.TO_REVIEW),a.z.literal(U.UNKNOWN)]),_t=a.z.union([a.z.literal("BAD_LANGUAGE"),a.z.literal("DISCRIMINATION"),a.z.literal("OTHER")]),Ja=a.z.object({id:a.z.number(),reason:_t,content:a.z.string(),resolved:a.z.boolean(),createdAt:a.z.string(),updatedAt:a.z.string().nullable()}),_e=a.z.object({id:a.z.number(),content:a.z.string(),blocked:a.z.boolean().nullable(),blockedThread:a.z.boolean().nullable(),blockReason:a.z.string().nullable(),isAdminComment:a.z.boolean().nullable(),removed:a.z.boolean().nullable(),approvalStatus:Tt.nullable(),createdAt:a.z.string(),updatedAt:a.z.string(),reports:a.z.array(Ja).nullable().optional(),author:Qa,gotThread:a.z.boolean().nullable().optional(),threadFirstItemId:a.z.number().nullable().optional()}),Ct=a.z.object({page:a.z.number(),pageSize:a.z.number(),pageCount:a.z.number(),total:a.z.number()});function sr(){return _e.extend({related:zt.optional(),documentId:a.z.string(),threadOf:a.z.lazy(()=>_e.merge(a.z.object({related:a.z.string(),threadOf:xt.nullable().optional(),documentId:a.z.string().optional()}))).nullable().optional()})}const xt=sr(),Xa=a.z.object({pagination:Ct,result:a.z.array(xt)}),Za=a.z.object({entity:zt,selected:_e.merge(a.z.object({related:a.z.string(),threadOf:sr().omit({related:!0}).merge(a.z.object({related:a.z.string()})).nullable().optional()})).nullable(),level:a.z.array(sr().omit({threadOf:!0,related:!0}))}),It=a.z.object({apiID:a.z.string(),uid:a.z.string(),schema:a.z.object({attributes:a.z.record(a.z.object({type:a.z.union([a.z.literal("string"),a.z.string()])})),collectionName:a.z.string(),description:a.z.string(),displayName:a.z.string(),draftAndPublish:a.z.boolean(),kind:a.z.string(),pluralName:a.z.string(),singularName:a.z.string(),visible:a.z.boolean()})}),ei=a.z.object({data:It}),ri=a.z.object({data:a.z.array(It)}),ti=a.z.object({author:a.z.unknown(),content:a.z.string(),id:a.z.number(),approvalStatus:Tt.nullable().optional(),reason:_t,reports:a.z.array(a.z.unknown()),resolved:a.z.boolean().optional(),updatedAt:a.z.string().nullable(),createdAt:a.z.string(),related:_e}),ni=a.z.object({pagination:Ct,result:a.z.array(ti)}),oi=a.z.object({id:a.z.number(),documentId:a.z.string(),name:a.z.string(),code:a.z.string(),description:a.z.string(),createdAt:a.z.string(),updatedAt:a.z.string(),publishedAt:a.z.string(),locale:a.z.string().nullable(),usersCount:a.z.number()}),ai=a.z.object({data:a.z.array(oi)}),ii=a.z.object({data:a.z.object({id:a.z.number(),documentId:a.z.string(),firstname:a.z.string(),lastname:a.z.string(),username:a.z.string().nullable(),email:a.z.string(),isActive:a.z.boolean(),blocked:a.z.boolean(),preferedLanguage:a.z.string().nullable(),createdAt:a.z.string(),updatedAt:a.z.string(),publishedAt:a.z.string(),locale:a.z.null(),roles:a.z.array(a.z.object({id:a.z.number(),name:a.z.string(),description:a.z.string(),code:a.z.string()}))})}),P="comments",li=b.lodashExports.once(r=>({config:{getKey(){return[P,"config"]},async query(){const e=await r.get(`/${P}/settings/config`);return Ka.parseAsync(e.data)}},contentTypeBuilder:{single:{getKey(e,t){return[P,"moderate","content-type",t,e]},async query(e){const t=await r.get(`/content-type-builder/content-types/${e}`);return ei.parseAsync(t.data).then(n=>n.data)}},all:{getKey(){return[P,"moderate","content-types"]},async query(){const e=await r.get("/content-type-builder/content-types");return ri.parseAsync(e.data).then(t=>t.data)}}},roles:{getKey(){return[P,"moderate","roles"]},async query(){const e=await r.get("/admin/roles");return ai.parseAsync(e.data).then(t=>t.data)}},user:{getKey(){return[P,"moderate","user"]},async query(){const e=await r.get("/admin/users/me");return ii.parseAsync(e.data).then(t=>t.data)}},comments:{findAll:{getKey(e){return[P,"moderate","all",e?JSON.stringify(e):void 0].filter(Boolean)},async query(e){const t=await r.get(`/${P}/moderate/all?${nr.stringify(e,{encode:!1})}`);return Xa.parseAsync(t.data)}},findOne:{getKey(e,t){return[P,"details",e?.toString(),t?JSON.stringify(t):void 0].filter(Boolean)},async query(e,t){const n=b.lodashExports.isEmpty(t)?"":`?${nr.stringify(t,{encode:!1})}`,o=await r.get(`/${P}/moderate/single/${e}${n}`);return Za.parseAsync(o.data)}},approve(e){return r.put(`/${P}/moderate/single/${e}/approve`)},reject(e){return r.put(`/${P}/moderate/single/${e}/reject`)},block(e){return r.put(`/${P}/moderate/single/${e}/block`)},unblock(e){return r.put(`/${P}/moderate/single/${e}/unblock`)},blockThread(e){return r.put(`/${P}/moderate/thread/${e}/block`)},unBlockThread(e){return r.put(`/${P}/moderate/thread/${e}/unblock`)},delete(e){return r.del(`/${P}/moderate/single/${e}/delete`)},postComment({id:e,content:t,author:n}){return r.post(`/${P}/moderate/thread/${e}/postComment`,{content:t,author:n})},updateComment({id:e,content:t}){return r.put(`/${P}/moderate/single/${e}/update`,{content:t})}},reports:{findAll:{getKey(e){return[P,"moderate","reports",e?JSON.stringify(e):void 0].filter(Boolean)},async query(e){const t=await r.get(`/${P}/moderate/reports${e?`?${nr.stringify(e,{encode:!1})}`:""}`);return ni.parseAsync(t.data)}},resolve({id:e,reportId:t}){return r.put(`/${P}/moderate/single/${e}/report/${t}/resolve`)},resolveMultipleReports({reportIds:e}){return r.put(`/${P}/moderate/multiple/report/resolve`,{reportIds:e})},resolveCommentMultipleReports({id:e,reportIds:t}){return r.put(`/${P}/moderate/single/${e}/report/resolve`,{reportIds:t})},resolveAllAbuseReportsForComment(e){return r.put(`/${P}/moderate/all/${e}/report/resolve`)},resolveAllAbuseReportsForThread(e){return r.put(`/${P}/moderate/thread/${e}/report/resolve-thread`)}},settings:{update(e){return r.put(`/${P}/settings/config`,e)},restore(){return r.del(`/${P}/settings/config`)},restart(){return r.post(`/${P}/settings/restart`)}}})),Nt=()=>{const r=rt.getFetchClient();return Y.useMemo(()=>li(r),[r])},Mt=Y.createContext(null),ui=({children:r})=>{const e=Nt(),{data:t}=dr.useQuery({queryKey:e.user.getKey(),queryFn:e.user.query});return t?z.jsx(Mt.Provider,{value:t,children:r}):null},ci=new dr.QueryClient({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}),si=({children:r})=>{const e=Zt();return z.jsx(dr.QueryClientProvider,{client:ci,children:z.jsx(b.DesignSystemProvider,{theme:{theme:e},children:z.jsx(ui,{children:r})})})},fi=()=>{const r=Y.useMemo(()=>({access:b.pluginPermissions.access,moderate:b.pluginPermissions.moderate,accessReports:b.pluginPermissions.reports,reviewReports:b.pluginPermissions.reportsReview,settings:b.pluginPermissions.settings,settingsChange:b.pluginPermissions.settingsChange}),[]),{isLoading:e,allowedActions:{canCommentsModerate:t,canCommentsRead:n,canReportsRead:o,canSettingsChange:i,canSettingsRead:c,canReportsReview:l}}=rt.useRBAC(r);return{isLoadingForPermissions:e,canAccess:n||o||c,canModerate:t,canAccessReports:o,canReviewReports:l,canSettings:c,canSettingsChange:i}};var fr={exports:{}},E={};/** @license React v16.13.1
|
|
5
|
+
* react-is.production.min.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/var Zr;function pi(){if(Zr)return E;Zr=1;var r=typeof Symbol=="function"&&Symbol.for,e=r?Symbol.for("react.element"):60103,t=r?Symbol.for("react.portal"):60106,n=r?Symbol.for("react.fragment"):60107,o=r?Symbol.for("react.strict_mode"):60108,i=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,l=r?Symbol.for("react.context"):60110,s=r?Symbol.for("react.async_mode"):60111,u=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,y=r?Symbol.for("react.suspense"):60113,m=r?Symbol.for("react.suspense_list"):60120,h=r?Symbol.for("react.memo"):60115,v=r?Symbol.for("react.lazy"):60116,$=r?Symbol.for("react.block"):60121,_=r?Symbol.for("react.fundamental"):60117,g=r?Symbol.for("react.responder"):60118,x=r?Symbol.for("react.scope"):60119;function O(f){if(typeof f=="object"&&f!==null){var M=f.$$typeof;switch(M){case e:switch(f=f.type,f){case s:case u:case n:case i:case o:case y:return f;default:switch(f=f&&f.$$typeof,f){case l:case p:case v:case h:case c:return f;default:return M}}case t:return M}}}function R(f){return O(f)===u}return E.AsyncMode=s,E.ConcurrentMode=u,E.ContextConsumer=l,E.ContextProvider=c,E.Element=e,E.ForwardRef=p,E.Fragment=n,E.Lazy=v,E.Memo=h,E.Portal=t,E.Profiler=i,E.StrictMode=o,E.Suspense=y,E.isAsyncMode=function(f){return R(f)||O(f)===s},E.isConcurrentMode=R,E.isContextConsumer=function(f){return O(f)===l},E.isContextProvider=function(f){return O(f)===c},E.isElement=function(f){return typeof f=="object"&&f!==null&&f.$$typeof===e},E.isForwardRef=function(f){return O(f)===p},E.isFragment=function(f){return O(f)===n},E.isLazy=function(f){return O(f)===v},E.isMemo=function(f){return O(f)===h},E.isPortal=function(f){return O(f)===t},E.isProfiler=function(f){return O(f)===i},E.isStrictMode=function(f){return O(f)===o},E.isSuspense=function(f){return O(f)===y},E.isValidElementType=function(f){return typeof f=="string"||typeof f=="function"||f===n||f===u||f===i||f===o||f===y||f===m||typeof f=="object"&&f!==null&&(f.$$typeof===v||f.$$typeof===h||f.$$typeof===c||f.$$typeof===l||f.$$typeof===p||f.$$typeof===_||f.$$typeof===g||f.$$typeof===x||f.$$typeof===$)},E.typeOf=O,E}var A={};/** @license React v16.13.1
|
|
12
|
+
* react-is.development.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var et;function yi(){return et||(et=1,process.env.NODE_ENV!=="production"&&function(){var r=typeof Symbol=="function"&&Symbol.for,e=r?Symbol.for("react.element"):60103,t=r?Symbol.for("react.portal"):60106,n=r?Symbol.for("react.fragment"):60107,o=r?Symbol.for("react.strict_mode"):60108,i=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,l=r?Symbol.for("react.context"):60110,s=r?Symbol.for("react.async_mode"):60111,u=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,y=r?Symbol.for("react.suspense"):60113,m=r?Symbol.for("react.suspense_list"):60120,h=r?Symbol.for("react.memo"):60115,v=r?Symbol.for("react.lazy"):60116,$=r?Symbol.for("react.block"):60121,_=r?Symbol.for("react.fundamental"):60117,g=r?Symbol.for("react.responder"):60118,x=r?Symbol.for("react.scope"):60119;function O(d){return typeof d=="string"||typeof d=="function"||d===n||d===u||d===i||d===o||d===y||d===m||typeof d=="object"&&d!==null&&(d.$$typeof===v||d.$$typeof===h||d.$$typeof===c||d.$$typeof===l||d.$$typeof===p||d.$$typeof===_||d.$$typeof===g||d.$$typeof===x||d.$$typeof===$)}function R(d){if(typeof d=="object"&&d!==null){var Fe=d.$$typeof;switch(Fe){case e:var be=d.type;switch(be){case s:case u:case n:case i:case o:case y:return be;default:var Or=be&&be.$$typeof;switch(Or){case l:case p:case v:case h:case c:return Or;default:return Fe}}case t:return Fe}}}var f=s,M=u,B=l,F=c,k=e,W=p,Q=n,I=v,N=h,G=t,ee=i,V=o,Bt=y,Ar=!1;function Ut(d){return Ar||(Ar=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),Pr(d)||R(d)===s}function Pr(d){return R(d)===u}function jt(d){return R(d)===l}function qt(d){return R(d)===c}function kt(d){return typeof d=="object"&&d!==null&&d.$$typeof===e}function Wt(d){return R(d)===p}function Gt(d){return R(d)===n}function Vt(d){return R(d)===v}function Ht(d){return R(d)===h}function Yt(d){return R(d)===t}function Kt(d){return R(d)===i}function Qt(d){return R(d)===o}function Jt(d){return R(d)===y}A.AsyncMode=f,A.ConcurrentMode=M,A.ContextConsumer=B,A.ContextProvider=F,A.Element=k,A.ForwardRef=W,A.Fragment=Q,A.Lazy=I,A.Memo=N,A.Portal=G,A.Profiler=ee,A.StrictMode=V,A.Suspense=Bt,A.isAsyncMode=Ut,A.isConcurrentMode=Pr,A.isContextConsumer=jt,A.isContextProvider=qt,A.isElement=kt,A.isForwardRef=Wt,A.isFragment=Gt,A.isLazy=Vt,A.isMemo=Ht,A.isPortal=Yt,A.isProfiler=Kt,A.isStrictMode=Qt,A.isSuspense=Jt,A.isValidElementType=O,A.typeOf=R}()),A}process.env.NODE_ENV==="production"?fr.exports=pi():fr.exports=yi();var di=fr.exports,Ft=di,mi={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},vi={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Dt={};Dt[Ft.ForwardRef]=mi;Dt[Ft.Memo]=vi;function gi(r,e,t){if(t===void 0&&(t=Error),!r)throw new t(e)}var hi=function(r){process.env.NODE_ENV!=="production"&&console.error(r)},Si=function(r){process.env.NODE_ENV!=="production"&&console.warn(r)},bi={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:hi,onWarn:Si};function Ei(r){gi(r,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}b.__assign(b.__assign({},bi),{textComponent:ae.Fragment});var Er=typeof window<"u"&&!window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__?window.__REACT_INTL_CONTEXT__||(window.__REACT_INTL_CONTEXT__=ae.createContext(null)):ae.createContext(null);Er.Consumer;Er.Provider;var Ai=Er;function Me(){var r=ae.useContext(Ai);return Ei(r),r}var pr;(function(r){r.formatDate="FormattedDate",r.formatTime="FormattedTime",r.formatNumber="FormattedNumber",r.formatList="FormattedList",r.formatDisplayName="FormattedDisplayName"})(pr||(pr={}));var yr;(function(r){r.formatDate="FormattedDateParts",r.formatTime="FormattedTimeParts",r.formatNumber="FormattedNumberParts",r.formatList="FormattedListParts"})(yr||(yr={}));function Lt(r){var e=function(t){var n=Me(),o=t.value,i=t.children,c=b.__rest(t,["value","children"]),l=typeof o=="string"?new Date(o||0):o,s=r==="formatDate"?n.formatDateToParts(l,c):n.formatTimeToParts(l,c);return i(s)};return e.displayName=yr[r],e}function Se(r){var e=function(t){var n=Me(),o=t.value,i=t.children,c=b.__rest(t,["value","children"]),l=n[r](o,c);if(typeof i=="function")return i(l);var s=n.textComponent||ae.Fragment;return ae.createElement(s,null,l)};return e.displayName=pr[r],e}Se("formatDate");Se("formatTime");Se("formatNumber");Se("formatList");Se("formatDisplayName");Lt("formatDate");Lt("formatTime");const Pi=(r,e="",t=!0)=>{const{formatMessage:n}=Me();let o="";return typeof r=="string"?o=r:o=r?.id.toString()||o,n({id:`${t?b.pluginId:"app.components"}.${o}`,defaultMessage:e},typeof r=="string"?void 0:r?.props)},Oi=({title:r,onConfirm:e,Trigger:t,labelConfirm:n,iconConfirm:o,labelCancel:i,children:c})=>{const[l,s]=Y.useState(!1),[u,p]=Y.useState(!1),y=()=>s(h=>!h),m=async()=>{p(!0),await e(),p(!1),y()};return z.jsxs(b.Dialog.Root,{open:l,children:[z.jsx(b.Dialog.Trigger,{children:z.jsx(t,{onClick:y})}),z.jsxs(b.Dialog.Content,{children:[z.jsx(b.Dialog.Header,{children:r}),z.jsx(b.Dialog.Body,{children:z.jsxs(b.Flex,{justifyContent:"center",direction:"column",children:[z.jsx(b.ForwardRef$3,{fill:"danger500",stroke:"danger500",height:"24",width:"24"}),z.jsx(b.Typography,{id:"confirm-description",children:c})]})}),z.jsxs(b.Dialog.Footer,{children:[z.jsx(b.Dialog.Cancel,{children:z.jsx(b.Button,{onClick:y,disabled:u,variant:"tertiary",children:i||"Cancel"})}),z.jsx(b.Dialog.Action,{children:z.jsx(b.Button,{onClick:m,variant:"danger-light",loading:u,disabled:u,startIcon:o,children:n})})]})]})]})};exports.COMMENT_STATUS=U;exports.CommonProviders=si;exports.ConfirmationDialog=Oi;exports.REPORT_REASON=wt;exports.REPORT_STATUS=Ya;exports.UserContext=Mt;exports.getMessage=Pi;exports.useAPI=Nt;exports.useIntl=Me;exports.usePermissions=fi;
|
package/dist/admin/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("../_chunks/index-
|
|
1
|
+
"use strict";const e=require("../_chunks/index-DYUGPksR.js");require("react");module.exports=e.index;
|
package/dist/admin/index.mjs
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -73,7 +73,7 @@ spurious results.`)}}return!1},g0=5;function m0(i,u){const[o,h]=u?[i,u]:[void 0,
|
|
|
73
73
|
`)))!==null&&u!==void 0?u:!1}function _m(i,u){switch(i.kind){case Xt.NULL:return null;case Xt.INT:return parseInt(i.value,10);case Xt.FLOAT:return parseFloat(i.value);case Xt.STRING:case Xt.ENUM:case Xt.BOOLEAN:return i.value;case Xt.LIST:return i.values.map(o=>_m(o,u));case Xt.OBJECT:return Om(i.fields,o=>o.name.value,o=>_m(o.value,u));case Xt.VARIABLE:return u?.[i.name.value]}}function cr(i){if(i!=null||He(!1,"Must provide name."),typeof i=="string"||He(!1,"Expected name to be a string."),i.length===0)throw new Bn("Expected name to be a non-empty string.");for(let u=1;u<i.length;++u)if(!u0(i.charCodeAt(u)))throw new Bn(`Names must only contain [_a-zA-Z0-9] but "${i}" does not.`);if(!o0(i.charCodeAt(0)))throw new Bn(`Names must start with [_a-zA-Z] but "${i}" does not.`);return i}function N0(i){if(i==="true"||i==="false"||i==="null")throw new Bn(`Enum values cannot be named: ${i}`);return cr(i)}function sl(i){return L0(i)||z0(i)||P0(i)||D0(i)||F0(i)||U0(i)||M0(i)||Tm(i)}function L0(i){return Ui(i,ev)}function z0(i){return Ui(i,$0)}function P0(i){return Ui(i,G0)}function D0(i){return Ui(i,q0)}function F0(i){return Ui(i,Y0)}function U0(i){return Ui(i,Q0)}function M0(i){return Ui(i,W0)}function Tm(i){return Ui(i,B0)}class W0{constructor(u){sl(u)||He(!1,`Expected ${jn(u)} to be a GraphQL type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class B0{constructor(u){j0(u)||He(!1,`Expected ${jn(u)} to be a GraphQL nullable type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function j0(i){return sl(i)&&!Tm(i)}function Zm(i){return typeof i=="function"?i():i}function Km(i){return typeof i=="function"?i():i}class ev{constructor(u){var o,h,m,A;const E=(o=u.parseValue)!==null&&o!==void 0?o:Dm;this.name=cr(u.name),this.description=u.description,this.specifiedByURL=u.specifiedByURL,this.serialize=(h=u.serialize)!==null&&h!==void 0?h:Dm,this.parseValue=E,this.parseLiteral=(m=u.parseLiteral)!==null&&m!==void 0?m:(T,R)=>E(_m(T,R)),this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(A=u.extensionASTNodes)!==null&&A!==void 0?A:[],u.specifiedByURL==null||typeof u.specifiedByURL=="string"||He(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${jn(u.specifiedByURL)}.`),u.serialize==null||typeof u.serialize=="function"||He(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),u.parseLiteral&&(typeof u.parseValue=="function"&&typeof u.parseLiteral=="function"||He(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class $0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.isTypeOf=u.isTypeOf,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=()=>nv(u),this._interfaces=()=>tv(u),u.isTypeOf==null||typeof u.isTypeOf=="function"||He(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${jn(u.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:rv(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function tv(i){var u;const o=Zm((u=i.interfaces)!==null&&u!==void 0?u:[]);return Array.isArray(o)||He(!1,`${i.name} interfaces must be an Array or a function which returns an Array.`),o}function nv(i){const u=Km(i.fields);return aa(u)||He(!1,`${i.name} fields must be an object with field names as keys or a function which returns such an object.`),Pf(u,(o,h)=>{var m;aa(o)||He(!1,`${i.name}.${h} field config must be an object.`),o.resolve==null||typeof o.resolve=="function"||He(!1,`${i.name}.${h} field resolver must be a function if provided, but got: ${jn(o.resolve)}.`);const A=(m=o.args)!==null&&m!==void 0?m:{};return aa(A)||He(!1,`${i.name}.${h} args must be an object with argument names as keys.`),{name:cr(h),description:o.description,type:o.type,args:k0(A),resolve:o.resolve,subscribe:o.subscribe,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}})}function k0(i){return Object.entries(i).map(([u,o])=>({name:cr(u),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}))}function aa(i){return Hm(i)&&!Array.isArray(i)}function rv(i){return Pf(i,u=>({description:u.description,type:u.type,args:V0(u.args),resolve:u.resolve,subscribe:u.subscribe,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}function V0(i){return Om(i,u=>u.name,u=>({description:u.description,type:u.type,defaultValue:u.defaultValue,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}class G0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=nv.bind(void 0,u),this._interfaces=tv.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${jn(u.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:rv(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class q0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._types=H0.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${jn(u.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return typeof this._types=="function"&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function H0(i){const u=Zm(i.types);return Array.isArray(u)||He(!1,`Must provide Array of types or a function which returns such an array for Union ${i.name}.`),u}class Y0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._values=typeof u.values=="function"?u.values:Wm(this.name,u.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=Wm(this.name,this._values())),this._values}getValue(u){return this._nameLookup===null&&(this._nameLookup=v0(this.getValues(),o=>o.name)),this._nameLookup[u]}serialize(u){this._valueLookup===null&&(this._valueLookup=new Map(this.getValues().map(h=>[h.value,h])));const o=this._valueLookup.get(u);if(o===void 0)throw new Bn(`Enum "${this.name}" cannot represent value: ${jn(u)}`);return o.name}parseValue(u){if(typeof u!="string"){const h=jn(u);throw new Bn(`Enum "${this.name}" cannot represent non-string value: ${h}.`+Ef(this,h))}const o=this.getValue(u);if(o==null)throw new Bn(`Value "${u}" does not exist in "${this.name}" enum.`+Ef(this,u));return o.value}parseLiteral(u,o){if(u.kind!==Xt.ENUM){const m=Um(u);throw new Bn(`Enum "${this.name}" cannot represent non-enum value: ${m}.`+Ef(this,m),{nodes:u})}const h=this.getValue(u.value);if(h==null){const m=Um(u);throw new Bn(`Value "${m}" does not exist in "${this.name}" enum.`+Ef(this,m),{nodes:u})}return h.value}toConfig(){const u=Om(this.getValues(),o=>o.name,o=>({description:o.description,value:o.value,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}));return{name:this.name,description:this.description,values:u,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Ef(i,u){const o=i.getValues().map(m=>m.name),h=b0(u,o);return m0("the enum value",h)}function Wm(i,u){return aa(u)||He(!1,`${i} values must be an object with value names as keys.`),Object.entries(u).map(([o,h])=>(aa(h)||He(!1,`${i}.${o} must refer to an object with a "value" key representing an internal value but got: ${jn(h)}.`),{name:N0(o),description:h.description,value:h.value!==void 0?h.value:o,deprecationReason:h.deprecationReason,extensions:Rr(h.extensions),astNode:h.astNode}))}class Q0{constructor(u){var o,h;this.name=cr(u.name),this.description=u.description,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this.isOneOf=(h=u.isOneOf)!==null&&h!==void 0?h:!1,this._fields=J0.bind(void 0,u)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){const u=Pf(this.getFields(),o=>({description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}));return{name:this.name,description:this.description,fields:u,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function J0(i){const u=Km(i.fields);return aa(u)||He(!1,`${i.name} fields must be an object with field names as keys or a function which returns such an object.`),Pf(u,(o,h)=>(!("resolve"in o)||He(!1,`${i.name}.${h} field has a resolve property, but Input Types cannot define resolvers.`),{name:cr(h),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}))}function Mi(i){const u=X0(i);if(u)throw u;return i}function X0(i){if(typeof i=="string"||He(!1,"Expected name to be a string."),i.startsWith("__"))return new Bn(`Name "${i}" must not begin with "__", which is reserved by GraphQL introspection.`);try{cr(i)}catch(u){return u}}const Z0=i=>i.scalarType({name:"ID",asNexusMethod:"id",description:"id as string or integer",serialize:u=>u,parseValue(u){const o=parseInt(u);return Ce.isNumber(o)?o:u},parseLiteral(u){return u.kind===Xt.INT||u.kind===Xt.STRING?u.value:null}}),K0=i=>i.inputObjectType({name:"IdentifyCommentAuthor",definition(u){u.nonNull.id("id")}}),ey=i=>i.inputObjectType({name:"RemoveComment",definition(u){u.id("id"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),ty=i=>i.objectType({name:"Report",definition(u){u.id("id"),u.nonNull.string("content"),u.field("reason",{type:"ReportReason"}),u.field("related",{type:"CommentSingle"}),u.string("createdAt"),u.string("updatedAt")}}),ny=(i,{reportReasons:u})=>i.enumType({name:"ReportReason",description:"Reason of abuse report",members:Object.values(u)}),ry=i=>i.objectType({name:"ResponseFindAll",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),iy=i=>i.objectType({name:"ResponseFindAllPerAuthor",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),oy=i=>i.objectType({name:"ResponseMeta",definition(u){u.field("pagination",{type:"ResponsePagination"})}}),uy=i=>i.objectType({name:"ResponsePagination",definition(u){u.int("page"),u.int("pageSize"),u.int("pageCount"),u.int("total"),u.int("start"),u.int("limit")}}),ay=i=>i.inputObjectType({name:"UpdateComment",definition(u){u.id("id"),u.nonNull.string("content"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),sy=[qv,Hv,Yv,Qv,Jv,Xv,Zv,Z0,K0,ey,ny,ry,iy,oy,uy,ay,ty],ly=(i,u)=>sy.map(o=>o(u,i)),iv=i=>i.plugin("graphql").service("extension"),cy=i=>{const u=iv(i);u.shadowCRUD(lr(i,"comment")).disable(),u.shadowCRUD(lr(i,"comment")).disableQueries(),u.shadowCRUD(lr(i,"comment")).disableMutations(),u.shadowCRUD(lr(i,"comment-report")).disable(),u.shadowCRUD(lr(i,"comment-report")).disableQueries(),u.shadowCRUD(lr(i,"comment-report")).disableMutations()},fy=async({strapi:i})=>{i.plugin("graphql")&&(cy(i),(await ft(i,"common").getConfig(oa.ENABLED_COLLECTIONS,[])).length&&await hy(i))},hy=async i=>{const u=iv(i),o=await ft(i,"common").getConfig();u.use(({strapi:h,nexus:m})=>{const A=ly(o,m),E=Gv(h,m),T=Bv(h,m),R=Dv(o);return{types:[A,E,T],resolversConfig:R}})},ra={comments:{read:"comments-read",moderate:"comments-moderate"},reports:{read:"reports-read",review:"reports-review"},settings:{read:"settings-read",change:"settings-change"}},py=async({strapi:i})=>{if(i.plugin("graphql")&&await fy({strapi:i}),Object.keys(i.plugins).indexOf("users-permissions")===-1)throw new Error("In order to make the comments plugin work the users-permissions plugin is required");const u=[{section:"plugins",displayName:"Comments: Read",uid:ra.comments.read,pluginName:"comments"},{section:"plugins",displayName:"Comments: Moderate",uid:ra.comments.moderate,pluginName:"comments"},{section:"plugins",displayName:"Reports: Read",uid:ra.reports.read,pluginName:"comments"},{section:"plugins",displayName:"Reports: Moderate",uid:ra.reports.review,pluginName:"comments"},{section:"plugins",displayName:"Settings: Read",uid:ra.settings.read,pluginName:"comments"},{section:"plugins",displayName:"Settings: Change",uid:ra.settings.change,pluginName:"comments"}];await i.admin.services.permission.actionProvider.registerMany(u);const o=ft(i,"common");i.db.lifecycles.subscribe({afterDelete:async h=>{const m=h.model.uid,{documentId:A,locale:E}=h.result,T=[m,A].join(":");await o.perRemove(T,E)},afterCreate:async h=>{const m=h.model.uid,{documentId:A,locale:E}=h.result,T=[m,A].join(":");await o.perRestore(T,E)}})},dy={isValidationEnabled:!0,enabledCollections:[],moderatorRoles:[],approvalFlow:[],entryLabel:{"*":["Title","title","Name","name","Subject","subject"]},reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER},blockedAuthorProps:[]},gy=v.z.object({[Zt.BAD_LANGUAGE]:v.z.literal(Zt.BAD_LANGUAGE),[Zt.OTHER]:v.z.literal(Zt.OTHER),[Zt.DISCRIMINATION]:v.z.literal(Zt.DISCRIMINATION)}),bm=v.z.object({isValidationEnabled:v.z.boolean().optional(),reportReasons:gy.optional(),isGQLPluginEnabled:v.z.boolean().optional(),[Ir.ENABLED_COLLECTIONS]:v.z.array(v.z.string()),[Ir.MODERATOR_ROLES]:v.z.array(v.z.string()),[Ir.APPROVAL_FLOW]:v.z.array(v.z.string()),[Ir.ENTRY_LABEL]:v.z.record(v.z.array(v.z.string())),[Ir.BAD_WORDS]:v.z.boolean().optional(),[Ir.AUTHOR_BLOCKED_PROPS]:v.z.array(v.z.string()),gql:v.z.object({auth:v.z.boolean().optional()}).optional(),client:v.z.object({url:v.z.string().nullable(),contactEmail:v.z.string().nullable()}).default({url:null,contactEmail:null})}),my={default:bm.parse(dy),validate:i=>bm.safeParse(i)},Y=({left:i,right:u})=>{if(u!==void 0&&i!==void 0)throw new Error(`Received both left and right values at runtime when opening an Either
|
|
74
74
|
Left: ${JSON.stringify(i)}
|
|
75
75
|
Right: ${JSON.stringify(u)}`);if(i!==void 0)return i;if(u!==void 0)return u;throw new Error("Received no left or right values at runtime when opening Either")},vy=i=>i.left!==void 0,pe=i=>i.right!==void 0,ov=i=>({left:i}),il=i=>({right:i});let An=class uv extends Error{constructor(u,o,h=void 0){super(),this.name="Strapi:Plugin:Comments",this.status=u||500,this.message=o||"Internal error",this.payload=h,Object.setPrototypeOf(this,uv.prototype)}toString(u=this){return`${u.name} - ${u.message}`}toJSON(){return this.payload?{...this.payload,name:this.name,message:this.message}:this}};const ce=(i,u)=>u instanceof An?i.throw(u.status,JSON.stringify(u)):u,yy=v.z.union([v.z.object({$eq:v.z.string().min(1)}),v.z.object({$eqi:v.z.string().min(1)})]),_y=v.z.union([v.z.object({$ne:v.z.string().min(1)}),v.z.object({$nei:v.z.string().min(1)})]),by=v.z.union([v.z.object({$gt:v.z.string().min(1)}),v.z.object({$gte:v.z.string().min(1)})]),wy=v.z.union([v.z.object({$lt:v.z.string().min(1)}),v.z.object({$lte:v.z.string().min(1)})]),Ay=v.z.union([v.z.object({$startsWith:v.z.string().min(1)}),v.z.object({$startsWithi:v.z.string().min(1)})]),Sy=v.z.union([v.z.object({$endsWith:v.z.string().min(1)}),v.z.object({$endsWithi:v.z.string().min(1)})]),Ey=v.z.union([v.z.object({$contains:v.z.string().min(1)}),v.z.object({$containsi:v.z.string().min(1)})]),Oy=v.z.union([v.z.object({$notContains:v.z.string().min(1)}),v.z.object({$notContainsi:v.z.string().min(1)})]),Xr=v.z.union([v.z.string(),v.z.number()]).transform(i=>Number(i)).pipe(v.z.number()),Ty=v.z.union([v.z.string(),v.z.boolean()]).transform(i=>typeof i=="string"?["t","true"].includes(i):i).pipe(v.z.boolean()),Iy=v.z.object({_q:v.z.string().optional()}),av=v.z.string().regex(/^(createdAt|updatedAt|id):(desc|asc|ASC|DESC)$/,"Invalid orderBy options"),Cy=v.z.union([v.z.string(),v.z.number(),yy,_y,by,wy,Ay,Sy,Ey,Oy,v.z.object({$null:v.z.string().min(1)}),v.z.object({$notNull:v.z.boolean()})]),wm=i=>v.z.object(Object.keys(i).reduce((u,o)=>({...u,[o]:Cy.optional()}),{})),Zr={single:"single",array:"array"},sa=i=>{const u=Object.entries(i).reduce((o,[h,m])=>({...o,[h]:m===Zr.single?Xr:v.z.array(Xr)}),{});return v.z.object(u)},xy=v.z.object({pageSize:Xr.default(10),page:Xr.default(1)}).merge(Iy).merge(v.z.object({orderBy:av.optional().nullable()})).merge(v.z.object({filters:wm({removed:!0,approvalStatus:!0}).merge(v.z.object({$or:v.z.array(wm({blocked:!0,blockedThread:!0})).optional()})).optional()})),Nt=i=>{if(!i.success){const u=i.error.issues.map(o=>`Path: ${o.path.join(".")} Code: ${o.code} Message: ${o.message}`).join(`
|
|
76
|
-
`);return ov(new An(400,u))}return il(i.data)},Df=i=>v.z.string().regex(gm.relatedUid,{message:'Field "relation" got incorrect format, use format like "api::<collection name>.<content type name>:<document id>"'}).refine(u=>i.some(o=>u.startsWith(o)),"Invalid relation or not enabled collections"),Ry=v.z.object({id:v.z.union([v.z.number(),v.z.string()]),name:v.z.string().min(1).max(100).optional(),email:v.z.string().email(),avatar:v.z.string().url().optional()});v.z.union([v.z.string(),v.z.number(),v.z.boolean()]);const sv=xy.merge(v.z.object({_q:v.z.string().optional()})),Jr=i=>Nt(sa({id:Zr.single}).safeParse(i)),Ny=i=>Nt(sv.safeParse(i)),Ly=i=>Nt(sv.safeParse(i)),zy=(i,u)=>{const o=sa({id:Zr.single}).merge(v.z.object({removed:v.z.string().optional().transform(h=>h==="true")})).safeParse({...u,id:i});return Nt(o)},Py=i=>Nt(sa({id:Zr.single,reportId:Zr.single}).safeParse(i)),Dy=i=>{const u=sa({id:Zr.single,reportIds:Zr.array}).safeParse(i);return Nt(u)},Fy=i=>{const u=sa({reportIds:Zr.array}).safeParse(i);return Nt(u)},Uy=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),email:v.z.string().email(),lastname:v.z.string().nullable().optional(),username:v.z.string().nullable().optional(),firstname:v.z.string().nullable().optional()}),lv=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),content:v.z.string(),author:Uy}),My=i=>Nt(lv.safeParse(i)),Wy=i=>Nt(lv.pick({content:!0,id:!0}).safeParse(i)),By=i=>Nt(bm.safeParse(i)),cv=i=>v.z.object({relation:Df(i),content:v.z.string().min(1),author:Ry.optional(),threadOf:v.z.union([v.z.string(),v.z.number()]).optional(),approvalStatus:v.z.nativeEnum(Fi).optional(),locale:v.z.string().optional()}),jy=(i,u,o)=>Nt(cv(i).safeParse({...o,relation:u})),$y=(i,u)=>Nt(cv(i).pick({content:!0,relation:!0,author:!0}).merge(sa({commentId:Zr.single})).safeParse(u)),ky=i=>v.z.object({relation:Df(i)}),Vy=v.z.object({pagination:v.z.object({pageSize:Xr.default(10),page:Xr.default(1),withCount:Ty.optional().default(!1)}).optional()}),Im=i=>v.z.object({sort:av.optional().nullable().default("createdAt:desc"),fields:v.z.string().array().optional(),omit:v.z.string().array().optional(),filters:wm({id:!0,content:!0,authorId:!0,authorName:!0,authorEmail:!0,createdAt:!0,updatedAt:!0,removed:!0,blocked:!0,blockedThread:!0,approvalStatus:!0}).optional(),isAdmin:v.z.boolean().optional().default(!1),populate:v.z.record(v.z.union([v.z.boolean(),v.z.object({populate:v.z.boolean()})])).optional(),limit:Xr.optional(),skip:Xr.optional(),locale:v.z.string().optional()}).merge(ky(i)).merge(Vy),Gy=(i,u,o)=>Nt(Im(i).safeParse({...o,relation:u})),qy=(i,u,o)=>{const h=Im(i).pick({sort:!0,fields:!0,omit:!0,filters:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,relation:!0,locale:!0}).merge(v.z.object({startingFromId:v.z.number().optional(),dropBlockedThreads:v.z.boolean().optional().default(!1)}));return Nt(h.safeParse({...o,relation:u}))},Hy=(i,u)=>{const o=Im([]).pick({sort:!0,fields:!0,omit:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,pagination:!0,filters:!0,locale:!0}).merge(v.z.object({type:v.z.union([v.z.literal(ol.GENERIC),v.z.literal("generic")]).optional(),authorId:v.z.union([v.z.string(),v.z.number()])}));return Nt(o.safeParse({...u,...i}))},Yy=i=>v.z.object({relation:Df(i[Ir.ENABLED_COLLECTIONS]),commentId:Xr,content:v.z.string().min(1),reason:v.z.nativeEnum(i.reportReasons)}),Qy=(i,u)=>Nt(Yy(i).safeParse(u)),Jy=i=>v.z.object({relation:Df(i),commentId:v.z.union([v.z.string(),v.z.number()]),authorId:v.z.union([v.z.string(),v.z.number()])}),Xy=(i,u)=>Nt(Jy(i).safeParse(u)),Zy=({strapi:i})=>({getService(u){return ft(i,u)},async findAll(u){const o=Ny(u.query);if(pe(o))return this.getService("admin").findAll(Y(o));throw ce(u,Y(o))},async findReports(u){const o=Ly(u.query);if(pe(o))return this.getService("admin").findReports(Y(o));throw ce(u,Y(o))},async findOne(u){const o=zy(u.params.id,u.query);if(pe(o))return this.getService("admin").findOneAndThread(Y(o));throw ce(u,Y(o))},async blockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!0);throw ce(u,Y(o))},async unblockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!1);throw ce(u,Y(o))},async deleteComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").deleteComment(Y(o).id);throw ce(u,Y(o))},async blockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!0);throw ce(u,Y(o))},async unblockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!1);throw ce(u,Y(o))},async resolveAbuseReport(u){const o=Py(u.params);if(pe(o))return this.getService("admin").resolveAbuseReport(Y(o));throw ce(u,Y(o))},async resolveCommentMultipleAbuseReports(u){const o=Dy({...u.request.body,id:u.params.id});if(pe(o))return this.getService("admin").resolveCommentMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async resolveAllAbuseReportsForComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForComment(Y(o).id);throw ce(u,Y(o))},async resolveAllAbuseReportsForThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForThread(Y(o).id);throw ce(u,Y(o))},async resolveMultipleAbuseReports(u){const o=Fy(u.request.body);if(pe(o))return this.getService("admin").resolveMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async postComment(u){const o=My({id:u.params.id,content:u.request.body.content,author:u.request.body.author});if(pe(o))return this.getService("admin").postComment(Y(o));throw ce(u,Y(o))},async updateComment(u){const o=Wy({id:u.params.id,content:u.request.body.content});if(pe(o))return this.getService("admin").updateComment(Y(o));throw ce(u,Y(o))},async approveComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").approveComment(Y(o).id);throw ce(u,Y(o))},async rejectComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").rejectComment(Y(o).id);throw ce(u,Y(o))}}),Cr=async(i,u,o)=>Ff(i).getLocalConfig(u,o),fv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),blocked:v.z.boolean().nullable(),blockedThread:v.z.boolean().nullable(),blockReason:v.z.string().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string().nullable(),publishedAt:v.z.string().nullable(),authorId:v.z.string().nullable(),authorName:v.z.string().nullable(),authorEmail:v.z.string().email().nullable(),authorAvatar:v.z.string().nullable(),authorUser:v.z.union([v.z.string(),v.z.object({id:v.z.number(),email:v.z.string().email()})]).optional().nullable(),locale:v.z.string().nullable()}),hv=v.z.object({page:v.z.number(),pageSize:v.z.number(),pageCount:v.z.number(),total:v.z.number()}),Di=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),pv=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),Ky=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),Bm=fv.merge(v.z.object({gotThread:v.z.boolean().nullable().optional(),threadFirstItemId:v.z.number().nullable().optional(),reports:v.z.array(Ky).default([]),author:v.z.any()})),ul=Bm.extend({threadOf:v.z.lazy(()=>v.z.union([v.z.number(),Bm])).nullable().optional()}),e_=v.z.object({id:v.z.number(),uid:v.z.string(),documentId:v.z.string(),requireCommentsApproval:v.z.boolean().nullable().optional(),locale:v.z.string().nullable().optional()});ul.omit({related:!0}).extend({related:e_.nullable().optional()});const t_=v.z.array(ul),n_=v.z.object({pagination:hv,results:v.z.array(ul)}),ia={findMany:t_,findWithCount:n_,findOne:ul,create:ul},r_=v.z.object({id:v.z.number(),documentId:v.z.string(),content:v.z.string(),blocked:v.z.boolean(),blockedThread:v.z.boolean(),blockReason:v.z.string().nullable(),authorId:v.z.string(),authorName:v.z.string(),authorEmail:v.z.string(),authorAvatar:v.z.string().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string(),locale:v.z.string().nullable()}),dv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:r_.nullable().optional()}),i_=v.z.object({results:v.z.array(dv),pagination:hv}),o_=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),u_=v.z.array(v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:fv.nullable()})),Of={findMany:u_,findPage:i_,update:o_,create:dv},a_=i=>{const u=lr(i,"comment-report"),o=i.query(u);return{async findPage(h){const m=await Cr(i,"isValidationEnabled",!1);return o.findPage(h).then(Di(m,Of.findPage))},async findMany(h){const m=await Cr(i,"isValidationEnabled",!1);return o.findMany(h).then(pv(m,Of.findMany))},async update(h){const m=await Cr(i,"isValidationEnabled",!1);return o.update(h).then(Di(m,Of.update))},async updateMany(h){return o.updateMany(h)},async create(h){const m=await Cr(i,"isValidationEnabled",!1);return o.create(h).then(Di(m,Of.create))}}},Pi=Ce.once(a_),s_=i=>{const u=lr(i,"comment");return{async findMany(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findMany(o).then(pv(h,ia.findMany))},async findWithCount(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findPage(o).then(Di(h,ia.findWithCount))},async findOne(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findOne(o).then(m=>m?Di(h,ia.findOne)(m):null)},async update(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).update(o).then(Di(h,ia.findOne))},async delete(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).delete(o).then(m=>m?Di(h,ia.findOne)(m):null)},async deleteMany(o){return i.query(u).deleteMany(o)},updateMany(o){return i.query(u).updateMany(o)},async create(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).create(o).then(Di(h,ia.create))}}},Ze=Ce.once(s_),l_=i=>({getLocalConfig(u,o){return i.config.get([Ov,u].filter(Boolean).join("."),o)},async getStore(){return await i.store({type:"plugin",name:"comments"})},async getConfig(){return await(await this.getStore()).get({key:"config"})},async get(u){const o=await this.getConfig(),h={regex:Object.keys(gm).reduce((I,F)=>({...I,[F]:gm[F].toString()}),{})},m=!!i.plugin("graphql");if(o)return il({...o,...h,isGQLPluginEnabled:u?m:void 0});const A=this.getLocalConfig("entryLabel"),E=this.getLocalConfig("approvalFlow"),T=this.getLocalConfig("reportReasons"),R=this.getLocalConfig("blockedAuthorProps"),z={entryLabel:A,approvalFlow:E,blockedAuthorProps:R,reportReasons:T,...h};if(u){const I=this.getLocalConfig("enabledCollections"),F=this.getLocalConfig("moderatorRoles");return il({...z,enabledCollections:I,moderatorRoles:F,isGQLPluginEnabled:m})}return il(z)},async update(u){return await(await this.getStore()).set({key:"config",value:{...u,reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER}}}),this.get()},async restore(){return await(await this.getStore()).delete({key:"config"}),this.get()}}),Ff=Ce.once(l_),c_=({strapi:i})=>({getService(u){return ft(i,u)},getStoreRepository(){return Ff(i)},async post(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=jy(h.enabledCollections,u.params.relation,u.request.body);if(pe(m))return this.getService("client").create(m.right,u.state.user);throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllFlat(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=Gy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllFlat(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllInHierarchy(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=qy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllInHierarchy(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllPerAuthor(u){const o=Hy(u.params,u.query);if(pe(o))return this.getService("common").findAllPerAuthor(ua(o.right),u.params.type?![ol.GENERIC.toLowerCase(),ol.GENERIC].includes(u.params.type):!1);throw ce(u,Y(o))},async put(u){const{user:o}=u.state,h=await this.getStoreRepository().get(!0);if(pe(h)){const m=Y(h),A=$y(m.enabledCollections,{...u.params,content:u.request.body.content,author:u.request.body.author});if(pe(A))return await this.getService("client").update(A.right,o);throw ce(u,Y(A))}throw ce(u,Y(h))},async reportAbuse(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),E=Qy(A,{...u.request.body,...u.params});if(pe(E))return await this.getService("client").reportAbuse(E.right,h);throw ce(u,Y(E))}throw ce(u,Y(m))},async removeComment(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),E=Xy(A.enabledCollections,{...u.query,...u.params});if(pe(E))return await this.getService("client").markAsRemoved(E.right,h);throw ce(u,Y(E))}throw ce(u,Y(m))}}),f_=({strapi:i})=>{const u=ft(i,"settings");return{async get(o){try{return await u.getConfig()}catch(h){throw ce(o,h)}},async getForSettingsPage(o){try{return await u.getConfig(!0)}catch(h){throw ce(o,h)}},async update(o){const h=By(o.request.body);if(pe(h))return await u.update(Y(h));throw ce(o,Y(h))},async restore(o){try{return await u.restore()}catch(h){throw ce(o,h)}},async restart(o){try{return u.restart(),o.send({message:"Restarted",status:200})}catch(h){throw ce(o,h)}}}},h_={admin:Zy,client:c_,settings:f_},p_=[{method:"GET",path:"/moderate/all",handler:"admin.findAll",config:{policies:[]}},{method:"GET",path:"/moderate/reports",handler:"admin.findReports",config:{policies:[]}},{method:"GET",path:"/moderate/single/:id",handler:"admin.findOne",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/approve",handler:"admin.approveComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/reject",handler:"admin.rejectComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/block",handler:"admin.blockComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/unblock",handler:"admin.unblockComment",config:{policies:[]}},{method:"DELETE",path:"/moderate/single/:id/delete",handler:"admin.deleteComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/:reportId/resolve",handler:"admin.resolveAbuseReport",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/resolve",handler:"admin.resolveCommentMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve",handler:"admin.resolveAllAbuseReportsForComment",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve-thread",handler:"admin.resolveAllAbuseReportsForThread",config:{policies:[]}},{method:"PUT",path:"/moderate/multiple/report/resolve",handler:"admin.resolveMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/update",handler:"admin.updateComment",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/block",handler:"admin.blockCommentThread",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/unblock",handler:"admin.unblockCommentThread",config:{policies:[]}},{method:"POST",path:"/moderate/thread/:id/postComment",handler:"admin.postComment",config:{policies:[]}}],d_=[{method:"PUT",path:"/settings/config",handler:"settings.update",config:{policies:[]}},{method:"DELETE",path:"/settings/config",handler:"settings.restore",config:{policies:[]}},{method:"POST",path:"/settings/restart",handler:"settings.restart",config:{policies:[]}},{method:"GET",path:"/settings/config",handler:"settings.getForSettingsPage",config:{policies:[]}},{method:"GET",path:"/moderate/config",handler:"settings.get",config:{policies:[]}}],g_=[...p_,...d_],m_=[{method:"GET",path:"/:relation",handler:"client.findAllInHierarchy",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a nested structure",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"POST",path:"/:relation",handler:"client.post",config:{policies:[],description:"Post a comment against configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"GET",path:"/:relation/flat",handler:"client.findAllFlat",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a flat structure for further processing",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"PUT",path:"/:relation/comment/:commentId",handler:"client.put",config:{policies:[],description:"Update comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"update"}}},{method:"POST",path:"/:relation/comment/:commentId/report-abuse",handler:"client.reportAbuse",config:{policies:[],description:"Report an abuse against comment for configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"DELETE",path:"/:relation/comment/:commentId",handler:"client.removeComment",config:{policies:[],description:"Remove comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"delete"}}},{method:"GET",path:"/author/:authorId",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by Strapi user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"GET",path:"/author/:authorId/:type",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by specified type of user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}}],v_={"content-api":{type:"content-api",routes:m_},admin:{type:"admin",routes:g_}};class fn extends Error{constructor(u,o,h=void 0){super(),this.name="Strapi:Plugin:Comments",this.status=u||500,this.message=o||"Internal error",this.payload=h,Object.setPrototypeOf(this,fn.prototype)}toString(u=this){return`${u.name} - ${u.message}`}toJSON(){return this.payload?{...this.payload,name:this.name,message:this.message}:this}}const gv=(i,u=null,o="threadOf",h=!1,m=!1)=>i.filter(A=>{const E=Ce.get(A,o);if(E===null&&u===null)return!0;let T=E;return T&&typeof u=="string"&&(T=T.toString()),T&&T==u||Ce.isObject(E)&&E.id===u}).map(A=>({...A,[o]:void 0,related:void 0,blockedThread:m||A.blockedThread,children:A.blockedThread&&h?[]:gv(i,A.id,o,h,A.blockedThread)})),jm=i=>i.split(kv.relatedUid).filter(u=>u&&u.length>0),mv=i=>i&&{...i,reports:(i.reports||[]).filter(u=>!u.resolved)},$m=(i,u,o=[])=>{const{authorUser:h,authorId:m,authorName:A,authorEmail:E,authorAvatar:T,...R}=i;let z={};if(h&&typeof h!="string"){const I=h;z=o.reduce((F,U)=>({...F,[U]:I[U]}),{id:I.id,name:I.username,email:I.email,avatar:I.avatar})}else m&&(z={id:m,name:A,email:E,avatar:T});return z=Ce.isEmpty(z)?z:Object.fromEntries(Object.entries(z).filter(([I])=>!u.includes(I))),{...R,author:Ce.isEmpty(z)?i.author||{}:z}},Tf=i=>{throw i?new fn(401,"Not authenticated"):new fn(403,"Not authorized")},y_=i=>{const{lastname:u,username:o,firstname:h}=i;return u&&h?`${h} ${u}`:o||h||""},__=Ce.once(i=>({findAll:{createParams(u,o,h,m,A){const[E,T]=mm(u),R={orderBy:u?{[E]:T}:void 0,where:A,page:o,pageSize:h};return m&&Ce.set(R,"where.content.$contains",m),R},getPopulate(){return{authorUser:rl(i),threadOf:{populate:{authorUser:rl(i)}},reports:{where:{resolved:!1}}}}},findReports:{getDefaultWhere(){return{resolved:{$notNull:!0}}},createParams(u,o,h,m){const[A,E]=mm(u),T={orderBy:u?{[A]:E}:void 0,where:this.getDefaultWhere(),page:o,pageSize:h};return m&&Ce.set(T,"where.content.$contains",m),T}},findOneAndThread:{getDefaultWhere(u){return u?{$or:[{removed:!1},{removed:{$notNull:!1}}]}:{}},getPopulate(){const u=rl(i),o={reports:{where:{resolved:!1}}},h={populate:{threadOf:{populate:{...o}},...o}};return{populate:{...h.populate,authorUser:u,threadOf:{populate:{...h.populate.threadOf.populate,authorUser:u}}}}}}})),b_=({strapi:i})=>{const u=__(i);return{getCommonService(){return ft(i,"common")},async findAll({_q:o,orderBy:h,page:m,pageSize:A,filters:E}){const T=u.findAll.createParams(h,m,A,o,E),R=u.findAll.getPopulate(),z=Ze(i),{pagination:I,results:F}=await z.findWithCount({...T,count:!0,populate:R}),U=await this.getCommonService().findRelatedEntitiesFor(F);return{pagination:I,result:F.map(ee=>this.getCommonService().sanitizeCommentEntity(ee,[],[])).map(ee=>this.getCommonService().mergeRelatedEntityTo(ee,U))}},async findReports({_q:o,orderBy:h,page:m,pageSize:A}){const E=u.findReports.createParams(h,m,A,o),{pagination:T,results:R}=await Pi(i).findPage({...E,populate:["related"]}),z=R.map(j=>typeof j.related=="object"?j.related.id:null).filter(Boolean),I=rl(i),F=await Ze(i).findMany({where:{threadOf:z},populate:["threadOf"],limit:Number.MAX_SAFE_INTEGER}),U=Array.from(new Set(F.map(({threadOf:j})=>typeof j=="object"?j.id:null).filter(Boolean)));return{result:R.map(j=>{const Z=U.includes(j.related.id),te=this.getCommonService(),Q={...j,related:te.sanitizeCommentEntity({...j.related,gotThread:Z},[])},we=typeof I!="boolean"?I?.populate:{};return mv(te.sanitizeCommentEntity(Q,[],[],we))}),pagination:T}},async findOneAndThread({id:o,removed:h,...m}){const A=rl(i),E=u.findOneAndThread.getDefaultWhere(h),T=u.findOneAndThread.getPopulate(),R=await Ze(i).findOne({...T,where:{id:o}});if(!R)throw new An(404,"Not found");const{relatedId:z,uid:I}=this.getCommonService().parseRelationString(R.related),F=await i.documents(I).findOne({documentId:z}).then(te=>{if(!te)throw new An(404,"Relation not found");return{...te,uid:I}}),U=R.threadOf&&typeof R.threadOf=="object"?R.threadOf.id:null,ee=await this.getCommonService().findAllInHierarchy({filters:{...E,...m,threadOf:U,related:R.related},...T,startingFromId:U,isAdmin:!0,limit:Number.MAX_SAFE_INTEGER},!1),j=typeof A!="boolean"?A?.populate:{},Z=this.getCommonService().sanitizeCommentEntity({...R,threadOf:R.threadOf||null},[],[],j);return{entity:F,selected:Z,level:ee}},async changeBlockedComment(o,h){const m=await this.getCommonService().findOne({id:o});return this.getCommonService().updateComment({id:o},{blocked:Ce.isNil(h)?!m.blocked:h})},async deleteComment(o){return Ze(i).update({where:{id:o},data:{removed:!0}})},async blockCommentThread(o,h){const m=await this.getCommonService().findOne({id:o}),A=h||!m.blocked,E=await this.getCommonService().updateComment({id:o},{blocked:A,blockedThread:A});return await this.blockNestedThreads(o,A),this.getCommonService().sanitizeCommentEntity(E,[])},async approveComment(o){const h=await Ze(i).update({where:{id:o},data:{approvalStatus:Fi.APPROVED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async rejectComment(o){const h=await Ze(i).update({where:{id:o},data:{approvalStatus:Fi.REJECTED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async blockNestedThreads(o,h){return this.getCommonService().modifiedNestedNestedComments(o,"blockedThread",h)},async resolveAbuseReport({id:o,reportId:h}){return Pi(i).update({where:{id:h,related:o},data:{resolved:!0}})},async resolveCommentMultipleAbuseReports({id:o,reportIds:h}){if((await Pi(i).findMany({where:{id:h,related:o},populate:["related"]})).length===h.length)return Pi(i).updateMany({where:{id:h},data:{resolved:!0}});throw new An(400,"At least one of selected reports got invalid comment entity relation. Try again.")},async resolveAllAbuseReportsForComment(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");return Pi(i).updateMany({where:{related:o,resolved:!1},data:{resolved:!0}})},async resolveAllAbuseReportsForThread(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");const h=await Ze(i).findMany({where:{threadOf:o},select:["id"]});return Pi(i).updateMany({where:{related:h.map(({id:m})=>m).concat([o]),resolved:!1},data:{resolved:!0}})},async resolveMultipleAbuseReports({reportIds:o}){return Pi(i).updateMany({where:{id:{$in:o}},data:{resolved:!0}})},async postComment({id:o,author:h,content:m}){const A=await Ze(i).findOne({where:{id:o}});if(!A)throw new An(404,"Not found");return Ze(i).create({data:{content:m,threadOf:o,authorId:h.id,authorName:y_(h),authorEmail:h.email,related:A.related,isAdminComment:!0}})},async updateComment({id:o,content:h}){const m=await Ze(i).update({where:{id:o},data:{content:h}});if(!m)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(m,[])}}},w_=async(i,u)=>{try{return il(await i())}catch{return ov(u)}},A_=({strapi:i})=>{const u=async(o,h)=>{if(h){const m=await i.query("plugin::users-permissions.user").findOne({where:{id:h.id},populate:["avatar"]});return{authorId:h.id,authorName:h.username,authorEmail:h.email,authorAvatar:m?.avatar?.url||null}}else if(o)return{authorId:o.id,authorName:o.name,authorEmail:o.email,authorAvatar:o.avatar}};return{getCommonService(){return ft(i,"common")},async create({relation:o,content:h,threadOf:m,author:A,approvalStatus:E,locale:T},R){const{uid:z,relatedId:I}=this.getCommonService().parseRelationString(o),F=await i.documents(z).findOne({documentId:I,locale:T});if(!F)throw new fn(400,'Relation for field "related" does not exist. Check your payload please.');const ee=(await this.getCommonService().getConfig(oa.APPROVAL_FLOW,[])).includes(z)||F.requireCommentsApproval,j=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),Z=await w_(async()=>m?await this.getCommonService().findOne({id:m,related:o,locale:T||null}):null,new fn(400,"Thread does not exist"));if(vy(Z))throw Y(Z);const te=Y(Z);if(!A&&!this.getCommonService().isValidUserContext(R))throw Tf(R);const[Q,we]=await Promise.all([this.getCommonService().checkBadWords(h),u(A,R)]),me=!Ce.isEmpty(we)&&!we.authorId;if(Ce.isEmpty(we)||me)throw new fn(400,`Not able to recognise author of a comment. Make sure you've provided "author" property in a payload or authenticated your request properly.`);if(ee&&E&&E!==Fi.PENDING)throw new fn(400,"Invalid approval status");const Ve={...await Ze(i).create({data:{...we,threadOf:m,locale:T,content:Q,related:o,approvalStatus:ee?Fi.PENDING:Fi.APPROVED}}),threadOf:te},Ye=this.getCommonService().sanitizeCommentEntity(Ve,j);try{await this.sendResponseNotification(Ye)}catch(Me){console.error(Me)}return Ye},async update({commentId:o,content:h,author:m,relation:A},E){if(!m&&!this.getCommonService().isValidUserContext(E))throw Tf(E);const T=E?.id||m?.id;if(await this.getCommonService().checkBadWords(h)){const R=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),z=await this.getCommonService().findOne({id:o,related:A});if(z&&z.author?.id?.toString()===T?.toString()){const I=await Ze(i).update({where:{id:o},data:{content:h},populate:{threadOf:!0,authorUser:!0}});return this.getCommonService().sanitizeCommentEntity(I,R)}}},async reportAbuse({commentId:o,relation:h,...m},A){if(!this.getCommonService().isValidUserContext(A))throw Tf(A);try{const E=await this.getCommonService().findOne({id:o,related:h});if(E.isAdminComment)throw new fn(403,"You're not allowed to take an action on that entity. This in a admin comment.");if(E){const T=await Pi(i).create({data:{...m,resolved:!1,related:o}});if(T){const R={...T,related:E};try{return await this.sendAbuseReportEmail(T.reason,T.content),R}catch{return R}}else throw new fn(500,"Report cannot be created")}throw new fn(403,"You're not allowed to take an action on that entity. Make sure that comment exist or you've authenticated your request properly.")}catch(E){throw E}},async markAsRemoved({commentId:o,relation:h,authorId:m},A){if(!m&&!this.getCommonService().isValidUserContext(A))throw Tf(A);const E=A?.id||m;if(!E)throw new fn(403,`You're not allowed to take an action on that entity. Make sure that you've provided proper "authorId" or authenticated your request properly.`);try{const T=A?.id?{authorUser:E}:{authorId:E};if(await this.getCommonService().findOne({id:o,related:h,...T})){const z=await Ze(i).update({where:{id:o,related:h},data:{removed:!0},populate:{threadOf:!0,authorUser:!0}});await this.markAsRemovedNested(o,!0);const I=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]);return this.getCommonService().sanitizeCommentEntity(z,I)}else throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}catch{throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}},async sendAbuseReportEmail(o,h){const m="strapi-super-admin",A=await this.getCommonService().getConfig(oa.MODERATOR_ROLES,[m]);if(A.length>0){const E=await i.query("admin::user").findMany({where:{roles:{code:A}}}).then(T=>T.map(R=>R.email));if(E.length>0){const T=await i.query("admin::user").findOne({where:{roles:{code:m}}});i.plugin("email")&&await i.plugin("email").service("email").send({to:E,from:T.email,subject:"New abuse report on comment",text:`
|
|
76
|
+
`);return ov(new An(400,u))}return il(i.data)},Df=i=>v.z.string().regex(gm.relatedUid,{message:'Field "relation" got incorrect format, use format like "api::<collection name>.<content type name>:<document id>"'}).refine(u=>i.some(o=>u.startsWith(o)),"Invalid relation or not enabled collections"),Ry=v.z.object({id:v.z.union([v.z.number(),v.z.string()]),name:v.z.string().min(1).max(100).optional(),email:v.z.string().email(),avatar:v.z.string().url().optional()});v.z.union([v.z.string(),v.z.number(),v.z.boolean()]);const sv=xy.merge(v.z.object({_q:v.z.string().optional()})),Jr=i=>Nt(sa({id:Zr.single}).safeParse(i)),Ny=i=>Nt(sv.safeParse(i)),Ly=i=>Nt(sv.safeParse(i)),zy=(i,u)=>{const o=sa({id:Zr.single}).merge(v.z.object({removed:v.z.string().optional().transform(h=>h==="true")})).safeParse({...u,id:i});return Nt(o)},Py=i=>Nt(sa({id:Zr.single,reportId:Zr.single}).safeParse(i)),Dy=i=>{const u=sa({id:Zr.single,reportIds:Zr.array}).safeParse(i);return Nt(u)},Fy=i=>{const u=sa({reportIds:Zr.array}).safeParse(i);return Nt(u)},Uy=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),email:v.z.string().email(),lastname:v.z.string().nullable().optional(),username:v.z.string().nullable().optional(),firstname:v.z.string().nullable().optional()}),lv=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),content:v.z.string(),author:Uy}),My=i=>Nt(lv.safeParse(i)),Wy=i=>Nt(lv.pick({content:!0,id:!0}).safeParse(i)),By=i=>Nt(bm.safeParse(i)),cv=i=>v.z.object({relation:Df(i),content:v.z.string().min(1),author:Ry.optional(),threadOf:v.z.union([v.z.string(),v.z.number()]).optional(),approvalStatus:v.z.nativeEnum(Fi).optional(),locale:v.z.string().optional()}),jy=(i,u,o)=>Nt(cv(i).safeParse({...o,relation:u})),$y=(i,u)=>Nt(cv(i).pick({content:!0,relation:!0,author:!0}).merge(sa({commentId:Zr.single})).safeParse(u)),ky=i=>v.z.object({relation:Df(i)}),Vy=v.z.object({pagination:v.z.object({pageSize:Xr.default(10),page:Xr.default(1),withCount:Ty.optional().default(!1)}).optional()}),Im=i=>v.z.object({sort:av.optional().nullable().default("createdAt:desc"),fields:v.z.string().array().optional(),omit:v.z.string().array().optional(),filters:wm({id:!0,content:!0,authorId:!0,authorName:!0,authorEmail:!0,createdAt:!0,updatedAt:!0,removed:!0,blocked:!0,blockedThread:!0,approvalStatus:!0,isAdminComment:!0}).optional(),isAdmin:v.z.boolean().optional().default(!1),populate:v.z.record(v.z.union([v.z.boolean(),v.z.object({populate:v.z.boolean()})])).optional(),limit:Xr.optional(),skip:Xr.optional(),locale:v.z.string().optional()}).merge(ky(i)).merge(Vy),Gy=(i,u,o)=>Nt(Im(i).safeParse({...o,relation:u})),qy=(i,u,o)=>{const h=Im(i).pick({sort:!0,fields:!0,omit:!0,filters:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,relation:!0,locale:!0}).merge(v.z.object({startingFromId:v.z.number().optional(),dropBlockedThreads:v.z.boolean().optional().default(!1)}));return Nt(h.safeParse({...o,relation:u}))},Hy=(i,u)=>{const o=Im([]).pick({sort:!0,fields:!0,omit:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,pagination:!0,filters:!0,locale:!0}).merge(v.z.object({type:v.z.union([v.z.literal(ol.GENERIC),v.z.literal("generic")]).optional(),authorId:v.z.union([v.z.string(),v.z.number()])}));return Nt(o.safeParse({...u,...i}))},Yy=i=>v.z.object({relation:Df(i[Ir.ENABLED_COLLECTIONS]),commentId:Xr,content:v.z.string().min(1),reason:v.z.nativeEnum(i.reportReasons)}),Qy=(i,u)=>Nt(Yy(i).safeParse(u)),Jy=i=>v.z.object({relation:Df(i),commentId:v.z.union([v.z.string(),v.z.number()]),authorId:v.z.union([v.z.string(),v.z.number()])}),Xy=(i,u)=>Nt(Jy(i).safeParse(u)),Zy=({strapi:i})=>({getService(u){return ft(i,u)},async findAll(u){const o=Ny(u.query);if(pe(o))return this.getService("admin").findAll(Y(o));throw ce(u,Y(o))},async findReports(u){const o=Ly(u.query);if(pe(o))return this.getService("admin").findReports(Y(o));throw ce(u,Y(o))},async findOne(u){const o=zy(u.params.id,u.query);if(pe(o))return this.getService("admin").findOneAndThread(Y(o));throw ce(u,Y(o))},async blockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!0);throw ce(u,Y(o))},async unblockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!1);throw ce(u,Y(o))},async deleteComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").deleteComment(Y(o).id);throw ce(u,Y(o))},async blockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!0);throw ce(u,Y(o))},async unblockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!1);throw ce(u,Y(o))},async resolveAbuseReport(u){const o=Py(u.params);if(pe(o))return this.getService("admin").resolveAbuseReport(Y(o));throw ce(u,Y(o))},async resolveCommentMultipleAbuseReports(u){const o=Dy({...u.request.body,id:u.params.id});if(pe(o))return this.getService("admin").resolveCommentMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async resolveAllAbuseReportsForComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForComment(Y(o).id);throw ce(u,Y(o))},async resolveAllAbuseReportsForThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForThread(Y(o).id);throw ce(u,Y(o))},async resolveMultipleAbuseReports(u){const o=Fy(u.request.body);if(pe(o))return this.getService("admin").resolveMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async postComment(u){const o=My({id:u.params.id,content:u.request.body.content,author:u.request.body.author});if(pe(o))return this.getService("admin").postComment(Y(o));throw ce(u,Y(o))},async updateComment(u){const o=Wy({id:u.params.id,content:u.request.body.content});if(pe(o))return this.getService("admin").updateComment(Y(o));throw ce(u,Y(o))},async approveComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").approveComment(Y(o).id);throw ce(u,Y(o))},async rejectComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").rejectComment(Y(o).id);throw ce(u,Y(o))}}),Cr=async(i,u,o)=>Ff(i).getLocalConfig(u,o),fv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),blocked:v.z.boolean().nullable(),blockedThread:v.z.boolean().nullable(),blockReason:v.z.string().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string().nullable(),publishedAt:v.z.string().nullable(),authorId:v.z.string().nullable(),authorName:v.z.string().nullable(),authorEmail:v.z.string().email().nullable(),authorAvatar:v.z.string().nullable(),authorUser:v.z.union([v.z.string(),v.z.object({id:v.z.number(),email:v.z.string().email()})]).optional().nullable(),locale:v.z.string().nullable()}),hv=v.z.object({page:v.z.number(),pageSize:v.z.number(),pageCount:v.z.number(),total:v.z.number()}),Di=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),pv=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),Ky=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),Bm=fv.merge(v.z.object({gotThread:v.z.boolean().nullable().optional(),threadFirstItemId:v.z.number().nullable().optional(),reports:v.z.array(Ky).default([]),author:v.z.any()})),ul=Bm.extend({threadOf:v.z.lazy(()=>v.z.union([v.z.number(),Bm])).nullable().optional()}),e_=v.z.object({id:v.z.number(),uid:v.z.string(),documentId:v.z.string(),requireCommentsApproval:v.z.boolean().nullable().optional(),locale:v.z.string().nullable().optional()});ul.omit({related:!0}).extend({related:e_.nullable().optional()});const t_=v.z.array(ul),n_=v.z.object({pagination:hv,results:v.z.array(ul)}),ia={findMany:t_,findWithCount:n_,findOne:ul,create:ul},r_=v.z.object({id:v.z.number(),documentId:v.z.string(),content:v.z.string(),blocked:v.z.boolean(),blockedThread:v.z.boolean(),blockReason:v.z.string().nullable(),authorId:v.z.string(),authorName:v.z.string(),authorEmail:v.z.string(),authorAvatar:v.z.string().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string(),locale:v.z.string().nullable()}),dv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:r_.nullable().optional()}),i_=v.z.object({results:v.z.array(dv),pagination:hv}),o_=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),u_=v.z.array(v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:fv.nullable()})),Of={findMany:u_,findPage:i_,update:o_,create:dv},a_=i=>{const u=lr(i,"comment-report"),o=i.query(u);return{async findPage(h){const m=await Cr(i,"isValidationEnabled",!1);return o.findPage(h).then(Di(m,Of.findPage))},async findMany(h){const m=await Cr(i,"isValidationEnabled",!1);return o.findMany(h).then(pv(m,Of.findMany))},async update(h){const m=await Cr(i,"isValidationEnabled",!1);return o.update(h).then(Di(m,Of.update))},async updateMany(h){return o.updateMany(h)},async create(h){const m=await Cr(i,"isValidationEnabled",!1);return o.create(h).then(Di(m,Of.create))}}},Pi=Ce.once(a_),s_=i=>{const u=lr(i,"comment");return{async findMany(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findMany(o).then(pv(h,ia.findMany))},async findWithCount(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findPage(o).then(Di(h,ia.findWithCount))},async findOne(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findOne(o).then(m=>m?Di(h,ia.findOne)(m):null)},async update(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).update(o).then(Di(h,ia.findOne))},async delete(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).delete(o).then(m=>m?Di(h,ia.findOne)(m):null)},async deleteMany(o){return i.query(u).deleteMany(o)},updateMany(o){return i.query(u).updateMany(o)},async create(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).create(o).then(Di(h,ia.create))}}},Ze=Ce.once(s_),l_=i=>({getLocalConfig(u,o){return i.config.get([Ov,u].filter(Boolean).join("."),o)},async getStore(){return await i.store({type:"plugin",name:"comments"})},async getConfig(){return await(await this.getStore()).get({key:"config"})},async get(u){const o=await this.getConfig(),h={regex:Object.keys(gm).reduce((I,F)=>({...I,[F]:gm[F].toString()}),{})},m=!!i.plugin("graphql");if(o)return il({...o,...h,isGQLPluginEnabled:u?m:void 0});const A=this.getLocalConfig("entryLabel"),E=this.getLocalConfig("approvalFlow"),T=this.getLocalConfig("reportReasons"),R=this.getLocalConfig("blockedAuthorProps"),z={entryLabel:A,approvalFlow:E,blockedAuthorProps:R,reportReasons:T,...h};if(u){const I=this.getLocalConfig("enabledCollections"),F=this.getLocalConfig("moderatorRoles");return il({...z,enabledCollections:I,moderatorRoles:F,isGQLPluginEnabled:m})}return il(z)},async update(u){return await(await this.getStore()).set({key:"config",value:{...u,reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER}}}),this.get()},async restore(){return await(await this.getStore()).delete({key:"config"}),this.get()}}),Ff=Ce.once(l_),c_=({strapi:i})=>({getService(u){return ft(i,u)},getStoreRepository(){return Ff(i)},async post(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=jy(h.enabledCollections,u.params.relation,u.request.body);if(pe(m))return this.getService("client").create(m.right,u.state.user);throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllFlat(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=Gy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllFlat(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllInHierarchy(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=qy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllInHierarchy(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllPerAuthor(u){const o=Hy(u.params,u.query);if(pe(o))return this.getService("common").findAllPerAuthor(ua(o.right),u.params.type?![ol.GENERIC.toLowerCase(),ol.GENERIC].includes(u.params.type):!1);throw ce(u,Y(o))},async put(u){const{user:o}=u.state,h=await this.getStoreRepository().get(!0);if(pe(h)){const m=Y(h),A=$y(m.enabledCollections,{...u.params,content:u.request.body.content,author:u.request.body.author});if(pe(A))return await this.getService("client").update(A.right,o);throw ce(u,Y(A))}throw ce(u,Y(h))},async reportAbuse(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),E=Qy(A,{...u.request.body,...u.params});if(pe(E))return await this.getService("client").reportAbuse(E.right,h);throw ce(u,Y(E))}throw ce(u,Y(m))},async removeComment(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),E=Xy(A.enabledCollections,{...u.query,...u.params});if(pe(E))return await this.getService("client").markAsRemoved(E.right,h);throw ce(u,Y(E))}throw ce(u,Y(m))}}),f_=({strapi:i})=>{const u=ft(i,"settings");return{async get(o){try{return await u.getConfig()}catch(h){throw ce(o,h)}},async getForSettingsPage(o){try{return await u.getConfig(!0)}catch(h){throw ce(o,h)}},async update(o){const h=By(o.request.body);if(pe(h))return await u.update(Y(h));throw ce(o,Y(h))},async restore(o){try{return await u.restore()}catch(h){throw ce(o,h)}},async restart(o){try{return u.restart(),o.send({message:"Restarted",status:200})}catch(h){throw ce(o,h)}}}},h_={admin:Zy,client:c_,settings:f_},p_=[{method:"GET",path:"/moderate/all",handler:"admin.findAll",config:{policies:[]}},{method:"GET",path:"/moderate/reports",handler:"admin.findReports",config:{policies:[]}},{method:"GET",path:"/moderate/single/:id",handler:"admin.findOne",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/approve",handler:"admin.approveComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/reject",handler:"admin.rejectComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/block",handler:"admin.blockComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/unblock",handler:"admin.unblockComment",config:{policies:[]}},{method:"DELETE",path:"/moderate/single/:id/delete",handler:"admin.deleteComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/:reportId/resolve",handler:"admin.resolveAbuseReport",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/resolve",handler:"admin.resolveCommentMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve",handler:"admin.resolveAllAbuseReportsForComment",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve-thread",handler:"admin.resolveAllAbuseReportsForThread",config:{policies:[]}},{method:"PUT",path:"/moderate/multiple/report/resolve",handler:"admin.resolveMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/update",handler:"admin.updateComment",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/block",handler:"admin.blockCommentThread",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/unblock",handler:"admin.unblockCommentThread",config:{policies:[]}},{method:"POST",path:"/moderate/thread/:id/postComment",handler:"admin.postComment",config:{policies:[]}}],d_=[{method:"PUT",path:"/settings/config",handler:"settings.update",config:{policies:[]}},{method:"DELETE",path:"/settings/config",handler:"settings.restore",config:{policies:[]}},{method:"POST",path:"/settings/restart",handler:"settings.restart",config:{policies:[]}},{method:"GET",path:"/settings/config",handler:"settings.getForSettingsPage",config:{policies:[]}},{method:"GET",path:"/moderate/config",handler:"settings.get",config:{policies:[]}}],g_=[...p_,...d_],m_=[{method:"GET",path:"/:relation",handler:"client.findAllInHierarchy",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a nested structure",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"POST",path:"/:relation",handler:"client.post",config:{policies:[],description:"Post a comment against configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"GET",path:"/:relation/flat",handler:"client.findAllFlat",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a flat structure for further processing",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"PUT",path:"/:relation/comment/:commentId",handler:"client.put",config:{policies:[],description:"Update comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"update"}}},{method:"POST",path:"/:relation/comment/:commentId/report-abuse",handler:"client.reportAbuse",config:{policies:[],description:"Report an abuse against comment for configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"DELETE",path:"/:relation/comment/:commentId",handler:"client.removeComment",config:{policies:[],description:"Remove comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"delete"}}},{method:"GET",path:"/author/:authorId",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by Strapi user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"GET",path:"/author/:authorId/:type",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by specified type of user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}}],v_={"content-api":{type:"content-api",routes:m_},admin:{type:"admin",routes:g_}};class fn extends Error{constructor(u,o,h=void 0){super(),this.name="Strapi:Plugin:Comments",this.status=u||500,this.message=o||"Internal error",this.payload=h,Object.setPrototypeOf(this,fn.prototype)}toString(u=this){return`${u.name} - ${u.message}`}toJSON(){return this.payload?{...this.payload,name:this.name,message:this.message}:this}}const gv=(i,u=null,o="threadOf",h=!1,m=!1)=>i.filter(A=>{const E=Ce.get(A,o);if(E===null&&u===null)return!0;let T=E;return T&&typeof u=="string"&&(T=T.toString()),T&&T==u||Ce.isObject(E)&&E.id===u}).map(A=>({...A,[o]:void 0,related:void 0,blockedThread:m||A.blockedThread,children:A.blockedThread&&h?[]:gv(i,A.id,o,h,A.blockedThread)})),jm=i=>i.split(kv.relatedUid).filter(u=>u&&u.length>0),mv=i=>i&&{...i,reports:(i.reports||[]).filter(u=>!u.resolved)},$m=(i,u,o=[])=>{const{authorUser:h,authorId:m,authorName:A,authorEmail:E,authorAvatar:T,...R}=i;let z={};if(h&&typeof h!="string"){const I=h;z=o.reduce((F,U)=>({...F,[U]:I[U]}),{id:I.id,name:I.username,email:I.email,avatar:I.avatar})}else m&&(z={id:m,name:A,email:E,avatar:T});return z=Ce.isEmpty(z)?z:Object.fromEntries(Object.entries(z).filter(([I])=>!u.includes(I))),{...R,author:Ce.isEmpty(z)?i.author||{}:z}},Tf=i=>{throw i?new fn(401,"Not authenticated"):new fn(403,"Not authorized")},y_=i=>{const{lastname:u,username:o,firstname:h}=i;return u&&h?`${h} ${u}`:o||h||""},__=Ce.once(i=>({findAll:{createParams(u,o,h,m,A){const[E,T]=mm(u),R={orderBy:u?{[E]:T}:void 0,where:A,page:o,pageSize:h};return m&&Ce.set(R,"where.content.$contains",m),R},getPopulate(){return{authorUser:rl(i),threadOf:{populate:{authorUser:rl(i)}},reports:{where:{resolved:!1}}}}},findReports:{getDefaultWhere(){return{resolved:{$notNull:!0}}},createParams(u,o,h,m){const[A,E]=mm(u),T={orderBy:u?{[A]:E}:void 0,where:this.getDefaultWhere(),page:o,pageSize:h};return m&&Ce.set(T,"where.content.$contains",m),T}},findOneAndThread:{getDefaultWhere(u){return u?{$or:[{removed:!1},{removed:{$notNull:!1}}]}:{}},getPopulate(){const u=rl(i),o={reports:{where:{resolved:!1}}},h={populate:{threadOf:{populate:{...o}},...o}};return{populate:{...h.populate,authorUser:u,threadOf:{populate:{...h.populate.threadOf.populate,authorUser:u}}}}}}})),b_=({strapi:i})=>{const u=__(i);return{getCommonService(){return ft(i,"common")},async findAll({_q:o,orderBy:h,page:m,pageSize:A,filters:E}){const T=u.findAll.createParams(h,m,A,o,E),R=u.findAll.getPopulate(),z=Ze(i),{pagination:I,results:F}=await z.findWithCount({...T,count:!0,populate:R}),U=await this.getCommonService().findRelatedEntitiesFor(F);return{pagination:I,result:F.map(ee=>this.getCommonService().sanitizeCommentEntity(ee,[],[])).map(ee=>this.getCommonService().mergeRelatedEntityTo(ee,U))}},async findReports({_q:o,orderBy:h,page:m,pageSize:A}){const E=u.findReports.createParams(h,m,A,o),{pagination:T,results:R}=await Pi(i).findPage({...E,populate:["related"]}),z=R.map(j=>typeof j.related=="object"?j.related.id:null).filter(Boolean),I=rl(i),F=await Ze(i).findMany({where:{threadOf:z},populate:["threadOf"],limit:Number.MAX_SAFE_INTEGER}),U=Array.from(new Set(F.map(({threadOf:j})=>typeof j=="object"?j.id:null).filter(Boolean)));return{result:R.map(j=>{const Z=U.includes(j.related.id),te=this.getCommonService(),Q={...j,related:te.sanitizeCommentEntity({...j.related,gotThread:Z},[])},we=typeof I!="boolean"?I?.populate:{};return mv(te.sanitizeCommentEntity(Q,[],[],we))}),pagination:T}},async findOneAndThread({id:o,removed:h,...m}){const A=rl(i),E=u.findOneAndThread.getDefaultWhere(h),T=u.findOneAndThread.getPopulate(),R=await Ze(i).findOne({...T,where:{id:o}});if(!R)throw new An(404,"Not found");const{relatedId:z,uid:I}=this.getCommonService().parseRelationString(R.related),F=await i.documents(I).findOne({documentId:z}).then(te=>{if(!te)throw new An(404,"Relation not found");return{...te,uid:I}}),U=R.threadOf&&typeof R.threadOf=="object"?R.threadOf.id:null,ee=await this.getCommonService().findAllInHierarchy({filters:{...E,...m,threadOf:U,related:R.related},...T,startingFromId:U,isAdmin:!0,limit:Number.MAX_SAFE_INTEGER},!1),j=typeof A!="boolean"?A?.populate:{},Z=this.getCommonService().sanitizeCommentEntity({...R,threadOf:R.threadOf||null},[],[],j);return{entity:F,selected:Z,level:ee}},async changeBlockedComment(o,h){const m=await this.getCommonService().findOne({id:o});return this.getCommonService().updateComment({id:o},{blocked:Ce.isNil(h)?!m.blocked:h})},async deleteComment(o){return Ze(i).update({where:{id:o},data:{removed:!0}})},async blockCommentThread(o,h){const m=await this.getCommonService().findOne({id:o}),A=h||!m.blocked,E=await this.getCommonService().updateComment({id:o},{blocked:A,blockedThread:A});return await this.blockNestedThreads(o,A),this.getCommonService().sanitizeCommentEntity(E,[])},async approveComment(o){const h=await Ze(i).update({where:{id:o},data:{approvalStatus:Fi.APPROVED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async rejectComment(o){const h=await Ze(i).update({where:{id:o},data:{approvalStatus:Fi.REJECTED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async blockNestedThreads(o,h){return this.getCommonService().modifiedNestedNestedComments(o,"blockedThread",h)},async resolveAbuseReport({id:o,reportId:h}){return Pi(i).update({where:{id:h,related:o},data:{resolved:!0}})},async resolveCommentMultipleAbuseReports({id:o,reportIds:h}){if((await Pi(i).findMany({where:{id:h,related:o},populate:["related"]})).length===h.length)return Pi(i).updateMany({where:{id:h},data:{resolved:!0}});throw new An(400,"At least one of selected reports got invalid comment entity relation. Try again.")},async resolveAllAbuseReportsForComment(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");return Pi(i).updateMany({where:{related:o,resolved:!1},data:{resolved:!0}})},async resolveAllAbuseReportsForThread(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");const h=await Ze(i).findMany({where:{threadOf:o},select:["id"]});return Pi(i).updateMany({where:{related:h.map(({id:m})=>m).concat([o]),resolved:!1},data:{resolved:!0}})},async resolveMultipleAbuseReports({reportIds:o}){return Pi(i).updateMany({where:{id:{$in:o}},data:{resolved:!0}})},async postComment({id:o,author:h,content:m}){const A=await Ze(i).findOne({where:{id:o}});if(!A)throw new An(404,"Not found");return Ze(i).create({data:{content:m,threadOf:o,authorId:h.id,authorName:y_(h),authorEmail:h.email,related:A.related,isAdminComment:!0}})},async updateComment({id:o,content:h}){const m=await Ze(i).update({where:{id:o},data:{content:h}});if(!m)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(m,[])}}},w_=async(i,u)=>{try{return il(await i())}catch{return ov(u)}},A_=({strapi:i})=>{const u=async(o,h)=>{if(h){const m=await i.query("plugin::users-permissions.user").findOne({where:{id:h.id},populate:["avatar"]});return{authorId:h.id,authorName:h.username,authorEmail:h.email,authorAvatar:m?.avatar?.url||null}}else if(o)return{authorId:o.id,authorName:o.name,authorEmail:o.email,authorAvatar:o.avatar}};return{getCommonService(){return ft(i,"common")},async create({relation:o,content:h,threadOf:m,author:A,approvalStatus:E,locale:T},R){const{uid:z,relatedId:I}=this.getCommonService().parseRelationString(o),F=await i.documents(z).findOne({documentId:I,locale:T});if(!F)throw new fn(400,'Relation for field "related" does not exist. Check your payload please.');const ee=(await this.getCommonService().getConfig(oa.APPROVAL_FLOW,[])).includes(z)||F.requireCommentsApproval,j=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),Z=await w_(async()=>m?await this.getCommonService().findOne({id:m,related:o,locale:T||null}):null,new fn(400,"Thread does not exist"));if(vy(Z))throw Y(Z);const te=Y(Z);if(!A&&!this.getCommonService().isValidUserContext(R))throw Tf(R);const[Q,we]=await Promise.all([this.getCommonService().checkBadWords(h),u(A,R)]),me=!Ce.isEmpty(we)&&!we.authorId;if(Ce.isEmpty(we)||me)throw new fn(400,`Not able to recognise author of a comment. Make sure you've provided "author" property in a payload or authenticated your request properly.`);if(ee&&E&&E!==Fi.PENDING)throw new fn(400,"Invalid approval status");const Ve={...await Ze(i).create({data:{...we,threadOf:m,locale:T,content:Q,related:o,approvalStatus:ee?Fi.PENDING:Fi.APPROVED}}),threadOf:te},Ye=this.getCommonService().sanitizeCommentEntity(Ve,j);try{await this.sendResponseNotification(Ye)}catch(Me){console.error(Me)}return Ye},async update({commentId:o,content:h,author:m,relation:A},E){if(!m&&!this.getCommonService().isValidUserContext(E))throw Tf(E);const T=E?.id||m?.id;if(await this.getCommonService().checkBadWords(h)){const R=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),z=await this.getCommonService().findOne({id:o,related:A});if(z&&z.author?.id?.toString()===T?.toString()){const I=await Ze(i).update({where:{id:o},data:{content:h},populate:{threadOf:!0,authorUser:!0}});return this.getCommonService().sanitizeCommentEntity(I,R)}}},async reportAbuse({commentId:o,relation:h,...m},A){if(!this.getCommonService().isValidUserContext(A))throw Tf(A);try{const E=await this.getCommonService().findOne({id:o,related:h});if(E.isAdminComment)throw new fn(403,"You're not allowed to take an action on that entity. This in a admin comment.");if(E){const T=await Pi(i).create({data:{...m,resolved:!1,related:o}});if(T){const R={...T,related:E};try{return await this.sendAbuseReportEmail(T.reason,T.content),R}catch{return R}}else throw new fn(500,"Report cannot be created")}throw new fn(403,"You're not allowed to take an action on that entity. Make sure that comment exist or you've authenticated your request properly.")}catch(E){throw E}},async markAsRemoved({commentId:o,relation:h,authorId:m},A){if(!m&&!this.getCommonService().isValidUserContext(A))throw Tf(A);const E=A?.id||m;if(!E)throw new fn(403,`You're not allowed to take an action on that entity. Make sure that you've provided proper "authorId" or authenticated your request properly.`);try{const T=A?.id?{authorUser:E}:{authorId:E};if(await this.getCommonService().findOne({id:o,related:h,...T})){const z=await Ze(i).update({where:{id:o,related:h},data:{removed:!0},populate:{threadOf:!0,authorUser:!0}});await this.markAsRemovedNested(o,!0);const I=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]);return this.getCommonService().sanitizeCommentEntity(z,I)}else throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}catch{throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}},async sendAbuseReportEmail(o,h){const m="strapi-super-admin",A=await this.getCommonService().getConfig(oa.MODERATOR_ROLES,[m]);if(A.length>0){const E=await i.query("admin::user").findMany({where:{roles:{code:A}}}).then(T=>T.map(R=>R.email));if(E.length>0){const T=await i.query("admin::user").findOne({where:{roles:{code:m}}});i.plugin("email")&&await i.plugin("email").service("email").send({to:E,from:T.email,subject:"New abuse report on comment",text:`
|
|
77
77
|
There was a new abuse report on your app.
|
|
78
78
|
Reason: ${o}
|
|
79
79
|
Message: ${h}
|
package/dist/server/index.mjs
CHANGED
|
@@ -6082,7 +6082,8 @@ const av = Ry.merge(v.object({ _q: v.string().optional() })), Jr = (i) => Nt(sa(
|
|
|
6082
6082
|
removed: !0,
|
|
6083
6083
|
blocked: !0,
|
|
6084
6084
|
blockedThread: !0,
|
|
6085
|
-
approvalStatus: !0
|
|
6085
|
+
approvalStatus: !0,
|
|
6086
|
+
isAdminComment: !0
|
|
6086
6087
|
}).optional(),
|
|
6087
6088
|
isAdmin: v.boolean().optional().default(!1),
|
|
6088
6089
|
populate: v.record(v.union([v.boolean(), v.object({ populate: v.boolean() })])).optional(),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="koa" />
|
|
2
1
|
declare const controllers: {
|
|
3
2
|
admin: ({ strapi }: import("../@types").StrapiContext) => {
|
|
4
3
|
getService<T extends "gql" | "client" | "admin" | "common" | "settings">(name: T): import("../services").PluginServices[T];
|
|
@@ -1682,6 +1681,43 @@ declare const controllers: {
|
|
|
1682
1681
|
} | {
|
|
1683
1682
|
$notNull?: boolean;
|
|
1684
1683
|
};
|
|
1684
|
+
isAdminComment?: string | number | {
|
|
1685
|
+
$eq?: string;
|
|
1686
|
+
} | {
|
|
1687
|
+
$eqi?: string;
|
|
1688
|
+
} | {
|
|
1689
|
+
$ne?: string;
|
|
1690
|
+
} | {
|
|
1691
|
+
$nei?: string;
|
|
1692
|
+
} | {
|
|
1693
|
+
$gt?: string;
|
|
1694
|
+
} | {
|
|
1695
|
+
$gte?: string;
|
|
1696
|
+
} | {
|
|
1697
|
+
$lt?: string;
|
|
1698
|
+
} | {
|
|
1699
|
+
$lte?: string;
|
|
1700
|
+
} | {
|
|
1701
|
+
$startsWith?: string;
|
|
1702
|
+
} | {
|
|
1703
|
+
$startsWithi?: string;
|
|
1704
|
+
} | {
|
|
1705
|
+
$endsWith?: string;
|
|
1706
|
+
} | {
|
|
1707
|
+
$endsWithi?: string;
|
|
1708
|
+
} | {
|
|
1709
|
+
$contains?: string;
|
|
1710
|
+
} | {
|
|
1711
|
+
$containsi?: string;
|
|
1712
|
+
} | {
|
|
1713
|
+
$notContains?: string;
|
|
1714
|
+
} | {
|
|
1715
|
+
$notContainsi?: string;
|
|
1716
|
+
} | {
|
|
1717
|
+
$null?: string;
|
|
1718
|
+
} | {
|
|
1719
|
+
$notNull?: boolean;
|
|
1720
|
+
};
|
|
1685
1721
|
removed?: string | number | {
|
|
1686
1722
|
$eq?: string;
|
|
1687
1723
|
} | {
|
|
@@ -2268,6 +2304,43 @@ declare const controllers: {
|
|
|
2268
2304
|
} | {
|
|
2269
2305
|
$notNull?: boolean;
|
|
2270
2306
|
};
|
|
2307
|
+
isAdminComment?: string | number | {
|
|
2308
|
+
$eq?: string;
|
|
2309
|
+
} | {
|
|
2310
|
+
$eqi?: string;
|
|
2311
|
+
} | {
|
|
2312
|
+
$ne?: string;
|
|
2313
|
+
} | {
|
|
2314
|
+
$nei?: string;
|
|
2315
|
+
} | {
|
|
2316
|
+
$gt?: string;
|
|
2317
|
+
} | {
|
|
2318
|
+
$gte?: string;
|
|
2319
|
+
} | {
|
|
2320
|
+
$lt?: string;
|
|
2321
|
+
} | {
|
|
2322
|
+
$lte?: string;
|
|
2323
|
+
} | {
|
|
2324
|
+
$startsWith?: string;
|
|
2325
|
+
} | {
|
|
2326
|
+
$startsWithi?: string;
|
|
2327
|
+
} | {
|
|
2328
|
+
$endsWith?: string;
|
|
2329
|
+
} | {
|
|
2330
|
+
$endsWithi?: string;
|
|
2331
|
+
} | {
|
|
2332
|
+
$contains?: string;
|
|
2333
|
+
} | {
|
|
2334
|
+
$containsi?: string;
|
|
2335
|
+
} | {
|
|
2336
|
+
$notContains?: string;
|
|
2337
|
+
} | {
|
|
2338
|
+
$notContainsi?: string;
|
|
2339
|
+
} | {
|
|
2340
|
+
$null?: string;
|
|
2341
|
+
} | {
|
|
2342
|
+
$notNull?: boolean;
|
|
2343
|
+
};
|
|
2271
2344
|
removed?: string | number | {
|
|
2272
2345
|
$eq?: string;
|
|
2273
2346
|
} | {
|
|
@@ -2773,6 +2846,43 @@ declare const controllers: {
|
|
|
2773
2846
|
} | {
|
|
2774
2847
|
$notNull?: boolean;
|
|
2775
2848
|
};
|
|
2849
|
+
isAdminComment?: string | number | {
|
|
2850
|
+
$eq?: string;
|
|
2851
|
+
} | {
|
|
2852
|
+
$eqi?: string;
|
|
2853
|
+
} | {
|
|
2854
|
+
$ne?: string;
|
|
2855
|
+
} | {
|
|
2856
|
+
$nei?: string;
|
|
2857
|
+
} | {
|
|
2858
|
+
$gt?: string;
|
|
2859
|
+
} | {
|
|
2860
|
+
$gte?: string;
|
|
2861
|
+
} | {
|
|
2862
|
+
$lt?: string;
|
|
2863
|
+
} | {
|
|
2864
|
+
$lte?: string;
|
|
2865
|
+
} | {
|
|
2866
|
+
$startsWith?: string;
|
|
2867
|
+
} | {
|
|
2868
|
+
$startsWithi?: string;
|
|
2869
|
+
} | {
|
|
2870
|
+
$endsWith?: string;
|
|
2871
|
+
} | {
|
|
2872
|
+
$endsWithi?: string;
|
|
2873
|
+
} | {
|
|
2874
|
+
$contains?: string;
|
|
2875
|
+
} | {
|
|
2876
|
+
$containsi?: string;
|
|
2877
|
+
} | {
|
|
2878
|
+
$notContains?: string;
|
|
2879
|
+
} | {
|
|
2880
|
+
$notContainsi?: string;
|
|
2881
|
+
} | {
|
|
2882
|
+
$null?: string;
|
|
2883
|
+
} | {
|
|
2884
|
+
$notNull?: boolean;
|
|
2885
|
+
};
|
|
2776
2886
|
removed?: string | number | {
|
|
2777
2887
|
$eq?: string;
|
|
2778
2888
|
} | {
|