@ynput/ayon-frontend-shared 0.3.3 → 0.3.4

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.
Files changed (30) hide show
  1. package/dist/_virtual/index.cjs10.js +1 -1
  2. package/dist/_virtual/index.cjs11.js +1 -1
  3. package/dist/_virtual/index.cjs12.js +1 -1
  4. package/dist/_virtual/index.es10.js +3 -3
  5. package/dist/_virtual/index.es11.js +5 -5
  6. package/dist/_virtual/index.es12.js +5 -5
  7. package/dist/node_modules/rehype/node_modules/unified/lib/index.cjs.js +1 -1
  8. package/dist/node_modules/rehype/node_modules/unified/lib/index.es.js +2 -2
  9. package/dist/node_modules/rehype/node_modules/vfile/lib/index.cjs.js +1 -1
  10. package/dist/node_modules/rehype/node_modules/vfile/lib/index.es.js +1 -1
  11. package/dist/node_modules/rehype-parse/lib/index.cjs.js +1 -1
  12. package/dist/node_modules/rehype-parse/lib/index.es.js +1 -1
  13. package/dist/shared/src/api/queries/views/getViews.cjs.js +1 -1
  14. package/dist/shared/src/api/queries/views/getViews.cjs.js.map +1 -1
  15. package/dist/shared/src/api/queries/views/getViews.es.js +20 -24
  16. package/dist/shared/src/api/queries/views/getViews.es.js.map +1 -1
  17. package/dist/shared/src/api/queries/views/updateViews.cjs.js +1 -1
  18. package/dist/shared/src/api/queries/views/updateViews.cjs.js.map +1 -1
  19. package/dist/shared/src/api/queries/views/updateViews.es.js +157 -103
  20. package/dist/shared/src/api/queries/views/updateViews.es.js.map +1 -1
  21. package/dist/shared/src/containers/Views/context/ViewsContext.cjs.js +1 -1
  22. package/dist/shared/src/containers/Views/context/ViewsContext.cjs.js.map +1 -1
  23. package/dist/shared/src/containers/Views/context/ViewsContext.es.js +32 -30
  24. package/dist/shared/src/containers/Views/context/ViewsContext.es.js.map +1 -1
  25. package/dist/shared/src/containers/Views/utils/viewUpdateHelper.cjs.js +1 -1
  26. package/dist/shared/src/containers/Views/utils/viewUpdateHelper.cjs.js.map +1 -1
  27. package/dist/shared/src/containers/Views/utils/viewUpdateHelper.es.js +54 -38
  28. package/dist/shared/src/containers/Views/utils/viewUpdateHelper.es.js.map +1 -1
  29. package/dist/types/containers/Views/utils/viewUpdateHelper.d.ts +3 -3
  30. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";const r=require("./_commonjsHelpers.cjs.js"),e=require("../node_modules/parse5/lib/parser/index.cjs.js");var s=e.__require();const t=r.getDefaultExportFromCjs(s);module.exports=t;
1
+ "use strict";const e=require("./_commonjsHelpers.cjs.js"),r=require("../node_modules/is-buffer/index.cjs.js");var s=r.__require();const t=e.getDefaultExportFromCjs(s);module.exports=t;
2
2
  //# sourceMappingURL=index.cjs10.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("./_commonjsHelpers.cjs.js"),r=require("../node_modules/is-buffer/index.cjs.js");var s=r.__require();const t=e.getDefaultExportFromCjs(s);module.exports=t;
1
+ "use strict";const e=require("./_commonjsHelpers.cjs.js"),r=require("../node_modules/extend/index.cjs.js");var t=r.__require();const s=e.getDefaultExportFromCjs(t);module.exports=s;
2
2
  //# sourceMappingURL=index.cjs11.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("./_commonjsHelpers.cjs.js"),r=require("../node_modules/extend/index.cjs.js");var t=r.__require();const s=e.getDefaultExportFromCjs(t);module.exports=s;
1
+ "use strict";const r=require("./_commonjsHelpers.cjs.js"),e=require("../node_modules/parse5/lib/parser/index.cjs.js");var s=e.__require();const t=r.getDefaultExportFromCjs(s);module.exports=t;
2
2
  //# sourceMappingURL=index.cjs12.js.map
@@ -1,7 +1,7 @@
1
1
  import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.es.js";
2
- import { __require as e } from "../node_modules/parse5/lib/parser/index.es.js";
3
- var o = e();
4
- const s = /* @__PURE__ */ r(o);
2
+ import { __require as e } from "../node_modules/is-buffer/index.es.js";
3
+ var f = e();
4
+ const s = /* @__PURE__ */ r(f);
5
5
  export {
6
6
  s as default
7
7
  };
@@ -1,8 +1,8 @@
1
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.es.js";
2
- import { __require as e } from "../node_modules/is-buffer/index.es.js";
3
- var f = e();
4
- const s = /* @__PURE__ */ r(f);
1
+ import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.es.js";
2
+ import { __require as r } from "../node_modules/extend/index.es.js";
3
+ var t = r();
4
+ const a = /* @__PURE__ */ e(t);
5
5
  export {
6
- s as default
6
+ a as default
7
7
  };
8
8
  //# sourceMappingURL=index.es11.js.map
@@ -1,8 +1,8 @@
1
- import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.es.js";
2
- import { __require as r } from "../node_modules/extend/index.es.js";
3
- var t = r();
4
- const a = /* @__PURE__ */ e(t);
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.es.js";
2
+ import { __require as e } from "../node_modules/parse5/lib/parser/index.es.js";
3
+ var o = e();
4
+ const s = /* @__PURE__ */ r(o);
5
5
  export {
6
- a as default
6
+ s as default
7
7
  };
8
8
  //# sourceMappingURL=index.es12.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../../../../bail/index.cjs.js"),B=require("../../../../../_virtual/index.cjs11.js"),z=require("../../../../../_virtual/index.cjs12.js"),E=require("../../../../is-plain-obj/index.cjs.js"),D=require("../../../../trough/lib/index.cjs.js"),M=require("../../vfile/lib/index.cjs.js"),Y=$().freeze(),A={}.hasOwnProperty;function $(){const t=D.trough(),s=[];let a={},w,h=-1;return n.data=j,n.Parser=void 0,n.Compiler=void 0,n.freeze=q,n.attachers=s,n.use=I,n.parse=O,n.stringify=V,n.run=F,n.runSync=N,n.process=L,n.processSync=U,n;function n(){const e=$();let r=-1;for(;++r<s.length;)e.use(...s[r]);return e.data(z(!0,{},a)),e}function j(e,r){return typeof e=="string"?arguments.length===2?(P("data",w),a[e]=r,n):A.call(a,e)&&a[e]||null:e?(P("data",w),a=e,n):a}function q(){if(w)return n;for(;++h<s.length;){const[e,...r]=s[h];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=e.call(n,...r);typeof i=="function"&&t.use(i)}return w=!0,h=Number.POSITIVE_INFINITY,n}function I(e,...r){let i;if(P("use",w),e!=null)if(typeof e=="function")d(e,...r);else if(typeof e=="object")Array.isArray(e)?y(e):p(e);else throw new TypeError("Expected usable value, not `"+e+"`");return i&&(a.settings=Object.assign(a.settings||{},i)),n;function u(o){if(typeof o=="function")d(o);else if(typeof o=="object")if(Array.isArray(o)){const[f,...c]=o;d(f,...c)}else p(o);else throw new TypeError("Expected usable value, not `"+o+"`")}function p(o){y(o.plugins),o.settings&&(i=Object.assign(i||{},o.settings))}function y(o){let f=-1;if(o!=null)if(Array.isArray(o))for(;++f<o.length;){const c=o[f];u(c)}else throw new TypeError("Expected a list of plugins, not `"+o+"`")}function d(o,f){let c=-1,l;for(;++c<s.length;)if(s[c][0]===o){l=s[c];break}l?(E(l[1])&&E(f)&&(f=z(!0,l[1],f)),l[1]=f):s.push([...arguments])}}function O(e){n.freeze();const r=g(e),i=n.Parser;return m("parse",i),C(i,"parse")?new i(String(r),r).parse():i(String(r),r)}function V(e,r){n.freeze();const i=g(r),u=n.Compiler;return x("stringify",u),b(e),C(u,"compile")?new u(e,i).compile():u(e,i)}function F(e,r,i){if(b(e),n.freeze(),!i&&typeof r=="function"&&(i=r,r=void 0),!i)return new Promise(u);u(null,i);function u(p,y){t.run(e,g(r),d);function d(o,f,c){f=f||e,o?y(o):p?p(f):i(null,f,c)}}}function N(e,r){let i,u;return n.run(e,r,p),T("runSync","run",u),i;function p(y,d){S.bail(y),i=d,u=!0}}function L(e,r){if(n.freeze(),m("process",n.Parser),x("process",n.Compiler),!r)return new Promise(i);i(null,r);function i(u,p){const y=g(e);n.run(n.parse(y),y,(o,f,c)=>{if(o||!f||!c)d(o);else{const l=n.stringify(f,c);l==null||(H(l)?c.value=l:c.result=l),d(o,c)}});function d(o,f){o||!f?p(o):u?u(f):r(null,f)}}}function U(e){let r;n.freeze(),m("processSync",n.Parser),x("processSync",n.Compiler);const i=g(e);return n.process(i,u),T("processSync","process",r),i;function u(p){r=!0,S.bail(p)}}}function C(t,s){return typeof t=="function"&&t.prototype&&(_(t.prototype)||s in t.prototype)}function _(t){let s;for(s in t)if(A.call(t,s))return!0;return!1}function m(t,s){if(typeof s!="function")throw new TypeError("Cannot `"+t+"` without `Parser`")}function x(t,s){if(typeof s!="function")throw new TypeError("Cannot `"+t+"` without `Compiler`")}function P(t,s){if(s)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function b(t){if(!E(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function T(t,s,a){if(!a)throw new Error("`"+t+"` finished async. Use `"+s+"` instead")}function g(t){return G(t)?t:new M.VFile(t)}function G(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function H(t){return typeof t=="string"||B(t)}exports.unified=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../../../../bail/index.cjs.js"),B=require("../../../../../_virtual/index.cjs10.js"),z=require("../../../../../_virtual/index.cjs11.js"),E=require("../../../../is-plain-obj/index.cjs.js"),D=require("../../../../trough/lib/index.cjs.js"),M=require("../../vfile/lib/index.cjs.js"),Y=$().freeze(),A={}.hasOwnProperty;function $(){const t=D.trough(),s=[];let a={},w,h=-1;return n.data=j,n.Parser=void 0,n.Compiler=void 0,n.freeze=q,n.attachers=s,n.use=I,n.parse=O,n.stringify=V,n.run=F,n.runSync=N,n.process=L,n.processSync=U,n;function n(){const e=$();let r=-1;for(;++r<s.length;)e.use(...s[r]);return e.data(z(!0,{},a)),e}function j(e,r){return typeof e=="string"?arguments.length===2?(P("data",w),a[e]=r,n):A.call(a,e)&&a[e]||null:e?(P("data",w),a=e,n):a}function q(){if(w)return n;for(;++h<s.length;){const[e,...r]=s[h];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=e.call(n,...r);typeof i=="function"&&t.use(i)}return w=!0,h=Number.POSITIVE_INFINITY,n}function I(e,...r){let i;if(P("use",w),e!=null)if(typeof e=="function")d(e,...r);else if(typeof e=="object")Array.isArray(e)?y(e):p(e);else throw new TypeError("Expected usable value, not `"+e+"`");return i&&(a.settings=Object.assign(a.settings||{},i)),n;function u(o){if(typeof o=="function")d(o);else if(typeof o=="object")if(Array.isArray(o)){const[f,...c]=o;d(f,...c)}else p(o);else throw new TypeError("Expected usable value, not `"+o+"`")}function p(o){y(o.plugins),o.settings&&(i=Object.assign(i||{},o.settings))}function y(o){let f=-1;if(o!=null)if(Array.isArray(o))for(;++f<o.length;){const c=o[f];u(c)}else throw new TypeError("Expected a list of plugins, not `"+o+"`")}function d(o,f){let c=-1,l;for(;++c<s.length;)if(s[c][0]===o){l=s[c];break}l?(E(l[1])&&E(f)&&(f=z(!0,l[1],f)),l[1]=f):s.push([...arguments])}}function O(e){n.freeze();const r=g(e),i=n.Parser;return m("parse",i),C(i,"parse")?new i(String(r),r).parse():i(String(r),r)}function V(e,r){n.freeze();const i=g(r),u=n.Compiler;return x("stringify",u),b(e),C(u,"compile")?new u(e,i).compile():u(e,i)}function F(e,r,i){if(b(e),n.freeze(),!i&&typeof r=="function"&&(i=r,r=void 0),!i)return new Promise(u);u(null,i);function u(p,y){t.run(e,g(r),d);function d(o,f,c){f=f||e,o?y(o):p?p(f):i(null,f,c)}}}function N(e,r){let i,u;return n.run(e,r,p),T("runSync","run",u),i;function p(y,d){S.bail(y),i=d,u=!0}}function L(e,r){if(n.freeze(),m("process",n.Parser),x("process",n.Compiler),!r)return new Promise(i);i(null,r);function i(u,p){const y=g(e);n.run(n.parse(y),y,(o,f,c)=>{if(o||!f||!c)d(o);else{const l=n.stringify(f,c);l==null||(H(l)?c.value=l:c.result=l),d(o,c)}});function d(o,f){o||!f?p(o):u?u(f):r(null,f)}}}function U(e){let r;n.freeze(),m("processSync",n.Parser),x("processSync",n.Compiler);const i=g(e);return n.process(i,u),T("processSync","process",r),i;function u(p){r=!0,S.bail(p)}}}function C(t,s){return typeof t=="function"&&t.prototype&&(_(t.prototype)||s in t.prototype)}function _(t){let s;for(s in t)if(A.call(t,s))return!0;return!1}function m(t,s){if(typeof s!="function")throw new TypeError("Cannot `"+t+"` without `Parser`")}function x(t,s){if(typeof s!="function")throw new TypeError("Cannot `"+t+"` without `Compiler`")}function P(t,s){if(s)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function b(t){if(!E(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function T(t,s,a){if(!a)throw new Error("`"+t+"` finished async. Use `"+s+"` instead")}function g(t){return G(t)?t:new M.VFile(t)}function G(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function H(t){return typeof t=="string"||B(t)}exports.unified=Y;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  import { bail as z } from "../../../../bail/index.es.js";
2
- import Y from "../../../../../_virtual/index.es11.js";
3
- import C from "../../../../../_virtual/index.es12.js";
2
+ import Y from "../../../../../_virtual/index.es10.js";
3
+ import C from "../../../../../_virtual/index.es11.js";
4
4
  import x from "../../../../is-plain-obj/index.es.js";
5
5
  import { trough as _ } from "../../../../trough/lib/index.es.js";
6
6
  import { VFile as q } from "../../vfile/lib/index.es.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../../../_virtual/index.cjs11.js"),i=require("./minpath.browser.cjs.js"),d=require("./minproc.browser.cjs.js"),c=require("./minurl.browser.cjs.js"),m=require("./minurl.shared.cjs.js"),l=require("../../vfile-message/lib/index.cjs.js"),a=["history","path","basename","stem","extname","dirname"];class g{constructor(t){let e;t?typeof t=="string"||w(t)?e={value:t}:m.isUrl(t)?e={path:t}:e=t:e={},this.data={},this.messages=[],this.history=[],this.cwd=d.proc.cwd(),this.value,this.stored,this.result,this.map;let r=-1;for(;++r<a.length;){const h=a[r];h in e&&e[h]!==void 0&&e[h]!==null&&(this[h]=h==="history"?[...e[h]]:e[h])}let s;for(s in e)a.includes(s)||(this[s]=e[s])}get path(){return this.history[this.history.length-1]}set path(t){m.isUrl(t)&&(t=c.urlToPath(t)),p(t,"path"),this.path!==t&&this.history.push(t)}get dirname(){return typeof this.path=="string"?i.path.dirname(this.path):void 0}set dirname(t){u(this.basename,"dirname"),this.path=i.path.join(t||"",this.basename)}get basename(){return typeof this.path=="string"?i.path.basename(this.path):void 0}set basename(t){p(t,"basename"),o(t,"basename"),this.path=i.path.join(this.dirname||"",t)}get extname(){return typeof this.path=="string"?i.path.extname(this.path):void 0}set extname(t){if(o(t,"extname"),u(this.dirname,"extname"),t){if(t.charCodeAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=i.path.join(this.dirname,this.stem+(t||""))}get stem(){return typeof this.path=="string"?i.path.basename(this.path,this.extname):void 0}set stem(t){p(t,"stem"),o(t,"stem"),this.path=i.path.join(this.dirname||"",t+(this.extname||""))}toString(t){return(this.value||"").toString(t||void 0)}message(t,e,r){const s=new l.VFileMessage(t,e,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}info(t,e,r){const s=this.message(t,e,r);return s.fatal=null,s}fail(t,e,r){const s=this.message(t,e,r);throw s.fatal=!0,s}}function o(n,t){if(n&&n.includes(i.path.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+i.path.sep+"`")}function p(n,t){if(!n)throw new Error("`"+t+"` cannot be empty")}function u(n,t){if(!n)throw new Error("Setting `"+t+"` requires `path` to be set too")}function w(n){return f(n)}exports.VFile=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../../../_virtual/index.cjs10.js"),i=require("./minpath.browser.cjs.js"),d=require("./minproc.browser.cjs.js"),c=require("./minurl.browser.cjs.js"),m=require("./minurl.shared.cjs.js"),l=require("../../vfile-message/lib/index.cjs.js"),a=["history","path","basename","stem","extname","dirname"];class g{constructor(t){let e;t?typeof t=="string"||w(t)?e={value:t}:m.isUrl(t)?e={path:t}:e=t:e={},this.data={},this.messages=[],this.history=[],this.cwd=d.proc.cwd(),this.value,this.stored,this.result,this.map;let r=-1;for(;++r<a.length;){const h=a[r];h in e&&e[h]!==void 0&&e[h]!==null&&(this[h]=h==="history"?[...e[h]]:e[h])}let s;for(s in e)a.includes(s)||(this[s]=e[s])}get path(){return this.history[this.history.length-1]}set path(t){m.isUrl(t)&&(t=c.urlToPath(t)),p(t,"path"),this.path!==t&&this.history.push(t)}get dirname(){return typeof this.path=="string"?i.path.dirname(this.path):void 0}set dirname(t){u(this.basename,"dirname"),this.path=i.path.join(t||"",this.basename)}get basename(){return typeof this.path=="string"?i.path.basename(this.path):void 0}set basename(t){p(t,"basename"),o(t,"basename"),this.path=i.path.join(this.dirname||"",t)}get extname(){return typeof this.path=="string"?i.path.extname(this.path):void 0}set extname(t){if(o(t,"extname"),u(this.dirname,"extname"),t){if(t.charCodeAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=i.path.join(this.dirname,this.stem+(t||""))}get stem(){return typeof this.path=="string"?i.path.basename(this.path,this.extname):void 0}set stem(t){p(t,"stem"),o(t,"stem"),this.path=i.path.join(this.dirname||"",t+(this.extname||""))}toString(t){return(this.value||"").toString(t||void 0)}message(t,e,r){const s=new l.VFileMessage(t,e,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}info(t,e,r){const s=this.message(t,e,r);return s.fatal=null,s}fail(t,e,r){const s=this.message(t,e,r);throw s.fatal=!0,s}}function o(n,t){if(n&&n.includes(i.path.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+i.path.sep+"`")}function p(n,t){if(!n)throw new Error("`"+t+"` cannot be empty")}function u(n,t){if(!n)throw new Error("Setting `"+t+"` requires `path` to be set too")}function w(n){return f(n)}exports.VFile=g;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1,4 +1,4 @@
1
- import d from "../../../../../_virtual/index.es11.js";
1
+ import d from "../../../../../_virtual/index.es10.js";
2
2
  import { path as i } from "./minpath.browser.es.js";
3
3
  import { proc as u } from "./minproc.browser.es.js";
4
4
  import { urlToPath as l } from "./minurl.browser.es.js";
@@ -1,2 +1,2 @@
1
- "use strict";const w=require("../../../_virtual/index.cjs10.js"),A=require("./errors.cjs.js"),E=require("../../hast-util-from-parse5/lib/index.cjs.js"),I="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",L={2:!0,1:!1,0:null};function j(r){const o=this.data("settings"),n=Object.assign({},o,r);Object.assign(this,{Parser:h});function h(a,l){const b=n.fragment?"parseFragment":"parse",C=n.emitParseErrors?x:null,O=new w({sourceCodeLocationInfo:!0,onParseError:C,scriptingEnabled:!1});return E.fromParse5(O[b](a),{space:n.space,file:l,verbose:n.verbose});function x(e){const c=e.code,u=y(c),i=n[u],f=i??!0,p=typeof f=="number"?f:f?1:0,P={line:e.startLine,column:e.startCol,offset:e.startOffset},q={line:e.endLine,column:e.endCol,offset:e.endOffset};if(p){const t=A.errors[u]||{reason:"",description:"",url:""},s=l.message(g(t.reason),{start:P,end:q});s.source="parse-error",s.ruleId=c,s.fatal=L[p],s.note=g(t.description),s.url="url"in t&&t.url===!1?null:I+c}function g(t){return t.replace(/%c(?:-(\d+))?/g,(s,d)=>{const v=d?-Number.parseInt(d,10):0,m=a.charAt(e.startOffset+v);return m==="`"?"` ` `":m}).replace(/%x/g,()=>"0x"+a.charCodeAt(e.startOffset).toString(16).toUpperCase())}}}}function y(r){return r.replace(/-[a-z]/g,o=>o.charAt(1).toUpperCase())}module.exports=j;
1
+ "use strict";const w=require("../../../_virtual/index.cjs12.js"),A=require("./errors.cjs.js"),E=require("../../hast-util-from-parse5/lib/index.cjs.js"),I="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",L={2:!0,1:!1,0:null};function j(r){const o=this.data("settings"),n=Object.assign({},o,r);Object.assign(this,{Parser:h});function h(a,l){const b=n.fragment?"parseFragment":"parse",C=n.emitParseErrors?x:null,O=new w({sourceCodeLocationInfo:!0,onParseError:C,scriptingEnabled:!1});return E.fromParse5(O[b](a),{space:n.space,file:l,verbose:n.verbose});function x(e){const c=e.code,u=y(c),i=n[u],f=i??!0,p=typeof f=="number"?f:f?1:0,P={line:e.startLine,column:e.startCol,offset:e.startOffset},q={line:e.endLine,column:e.endCol,offset:e.endOffset};if(p){const t=A.errors[u]||{reason:"",description:"",url:""},s=l.message(g(t.reason),{start:P,end:q});s.source="parse-error",s.ruleId=c,s.fatal=L[p],s.note=g(t.description),s.url="url"in t&&t.url===!1?null:I+c}function g(t){return t.replace(/%c(?:-(\d+))?/g,(s,d)=>{const v=d?-Number.parseInt(d,10):0,m=a.charAt(e.startOffset+v);return m==="`"?"` ` `":m}).replace(/%x/g,()=>"0x"+a.charCodeAt(e.startOffset).toString(16).toUpperCase())}}}}function y(r){return r.replace(/-[a-z]/g,o=>o.charAt(1).toUpperCase())}module.exports=j;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1,4 +1,4 @@
1
- import A from "../../../_virtual/index.es10.js";
1
+ import A from "../../../_virtual/index.es12.js";
2
2
  import { errors as E } from "./errors.es.js";
3
3
  import { fromParse5 as I } from "../../hast-util-from-parse5/lib/index.es.js";
4
4
  const L = "https://html.spec.whatwg.org/multipage/parsing.html#parse-error-", j = { 2: !0, 1: !1, 0: null };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../base/client.cjs.js");require("../../generated/graphql.cjs.js");require("../../generated/graphqlLinks.cjs.js");require("../../generated/access.cjs.js");require("../../generated/actions.cjs.js");require("../../generated/activityFeed.cjs.js");require("../../generated/addons.cjs.js");require("../../generated/anatomy.cjs.js");require("../../generated/attributes.cjs.js");require("../../generated/authentication.cjs.js");require("../../generated/bundles.cjs.js");require("../../generated/configuration.cjs.js");require("../../generated/desktop.cjs.js");require("../../generated/entityLists.cjs.js");require("../../generated/events.cjs.js");require("../../generated/files.cjs.js");require("../../generated/folders.cjs.js");require("../../generated/inbox.cjs.js");require("../../generated/links.cjs.js");require("../../generated/market.cjs.js");require("../../generated/onboarding.cjs.js");require("../../generated/operations.cjs.js");require("../../generated/products.cjs.js");require("../../generated/projectDashboard.cjs.js");require("../../generated/projects.cjs.js");require("../../generated/reviewables.cjs.js");require("../../generated/services.cjs.js");require("../../generated/system.cjs.js");require("../../generated/tasks.cjs.js");require("../../generated/teams.cjs.js");require("../../generated/thumbnails.cjs.js");require("../../generated/uRIs.cjs.js");require("../../generated/users.cjs.js");require("../../generated/versions.cjs.js");require("../../generated/workfiles.cjs.js");require("../../generated/ynputCloud.cjs.js");require("../../generated/grouping.cjs.js");const q=require("../../generated/views.cjs.js"),s=(e,u)=>({type:"view",id:`${e.toUpperCase()}${u?`:${u.toUpperCase()}`:""}`}),t={type:"view",id:"LIST"},a=q.api.enhanceEndpoints({endpoints:{listViews:{transformResponse:e=>e?.views||[],providesTags:(e,u,{viewType:r,projectName:i})=>e?[t,s(r,i),...e.map(o=>({type:"view",id:o.id}))]:[t],transformErrorResponse:e=>e.data?.detail},getWorkingView:{providesTags:(e,u,{viewType:r,projectName:i})=>[{type:"view",id:e?.id},s(r,i),t],transformErrorResponse:e=>e.data?.detail},getView:{providesTags:(e,u,r)=>[{type:"view",id:r.viewId},t],transformErrorResponse:e=>e.data?.detail},getDefaultView:{providesTags:(e,u,{viewType:r,projectName:i})=>e?[{type:"view",id:e.id},s(r,i)]:[s(r,i)],transformErrorResponse:e=>e.data?.detail},getBaseView:{providesTags:(e,u,{viewType:r,projectName:i})=>e?[{type:"view",id:e.id},s(r,i)]:[s(r,i)],transformErrorResponse:e=>e.data?.detail}}}),{useListViewsQuery:d,useGetWorkingViewQuery:n,useGetViewQuery:p,useGetDefaultViewQuery:w,useGetBaseViewQuery:g}=a;exports.getScopeTag=s;exports.getViewsApi=a;exports.useGetBaseViewQuery=g;exports.useGetDefaultViewQuery=w;exports.useGetViewQuery=p;exports.useGetWorkingViewQuery=n;exports.useListViewsQuery=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../base/client.cjs.js");require("../../generated/graphql.cjs.js");require("../../generated/graphqlLinks.cjs.js");require("../../generated/access.cjs.js");require("../../generated/actions.cjs.js");require("../../generated/activityFeed.cjs.js");require("../../generated/addons.cjs.js");require("../../generated/anatomy.cjs.js");require("../../generated/attributes.cjs.js");require("../../generated/authentication.cjs.js");require("../../generated/bundles.cjs.js");require("../../generated/configuration.cjs.js");require("../../generated/desktop.cjs.js");require("../../generated/entityLists.cjs.js");require("../../generated/events.cjs.js");require("../../generated/files.cjs.js");require("../../generated/folders.cjs.js");require("../../generated/inbox.cjs.js");require("../../generated/links.cjs.js");require("../../generated/market.cjs.js");require("../../generated/onboarding.cjs.js");require("../../generated/operations.cjs.js");require("../../generated/products.cjs.js");require("../../generated/projectDashboard.cjs.js");require("../../generated/projects.cjs.js");require("../../generated/reviewables.cjs.js");require("../../generated/services.cjs.js");require("../../generated/system.cjs.js");require("../../generated/tasks.cjs.js");require("../../generated/teams.cjs.js");require("../../generated/thumbnails.cjs.js");require("../../generated/uRIs.cjs.js");require("../../generated/users.cjs.js");require("../../generated/versions.cjs.js");require("../../generated/workfiles.cjs.js");require("../../generated/ynputCloud.cjs.js");require("../../generated/grouping.cjs.js");const q=require("../../generated/views.cjs.js"),s=(e,u)=>({type:"view",id:`${e.toUpperCase()}${u?`:${u.toUpperCase()}`:""}`}),t={type:"view",id:"LIST"},o=q.api.enhanceEndpoints({endpoints:{listViews:{transformResponse:e=>e?.views||[],providesTags:(e,u,{viewType:r,projectName:i})=>e?[t,s(r,i)]:[t],transformErrorResponse:e=>e.data?.detail},getWorkingView:{providesTags:(e,u,{viewType:r,projectName:i})=>[{type:"view",id:e?.id},s(r,i),t],transformErrorResponse:e=>e.data?.detail},getView:{providesTags:(e,u,r)=>[{type:"view",id:r.viewId},t],transformErrorResponse:e=>e.data?.detail},getDefaultView:{providesTags:(e,u,{viewType:r,projectName:i})=>e?[{type:"view",id:e.id},s(r,i)]:[s(r,i)],transformErrorResponse:e=>e.data?.detail},getBaseView:{providesTags:(e,u,{viewType:r,projectName:i})=>e?[{type:"view",id:e.id},s(r,i)]:[s(r,i)],transformErrorResponse:e=>e.data?.detail}}}),{useListViewsQuery:a,useGetWorkingViewQuery:d,useGetViewQuery:n,useGetDefaultViewQuery:p,useGetBaseViewQuery:w}=o;exports.getScopeTag=s;exports.getViewsApi=o;exports.useGetBaseViewQuery=w;exports.useGetDefaultViewQuery=p;exports.useGetViewQuery=n;exports.useGetWorkingViewQuery=d;exports.useListViewsQuery=a;
2
2
  //# sourceMappingURL=getViews.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getViews.cjs.js","sources":["../../../../../../src/api/queries/views/getViews.ts"],"sourcesContent":["import { ListViewsApiResponse, viewsApi } from '@shared/api/generated'\nimport { DefinitionsFromApi, OverrideResultType, TagTypesFromApi } from '@reduxjs/toolkit/query'\n\nexport const getScopeTag = (viewType: string, projectName?: string) => {\n return {\n type: 'view',\n id: `${viewType.toUpperCase()}${projectName ? `:${projectName.toUpperCase()}` : ''}`,\n }\n}\n\nconst VIEW_LIST_TAG = { type: 'view', id: 'LIST' }\n\ntype GetViewListResult = ListViewsApiResponse['views']\n\ntype Definitions = DefinitionsFromApi<typeof viewsApi>\ntype TagTypes = TagTypesFromApi<typeof viewsApi>\n// update the definitions to include the new types\ntype UpdatedDefinitions = Omit<Definitions, 'listViews'> & {\n listViews: OverrideResultType<Definitions['listViews'], GetViewListResult>\n}\n\nexport const getViewsApi = viewsApi.enhanceEndpoints<TagTypes, UpdatedDefinitions>({\n endpoints: {\n listViews: {\n transformResponse: (response: ListViewsApiResponse) => response?.views || [],\n providesTags: (result, _e, { viewType, projectName }) =>\n result\n ? [\n VIEW_LIST_TAG,\n getScopeTag(viewType, projectName),\n ...result.map((v) => ({ type: 'view', id: v.id })),\n ]\n : [VIEW_LIST_TAG],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getWorkingView: {\n providesTags: (result, _e, { viewType, projectName }) => [\n { type: 'view', id: result?.id },\n getScopeTag(viewType, projectName),\n VIEW_LIST_TAG,\n ],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getView: {\n providesTags: (result, error, arg) => [{ type: 'view', id: arg.viewId }, VIEW_LIST_TAG],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getDefaultView: {\n providesTags: (result, _e, { viewType, projectName }) =>\n result\n ? [{ type: 'view', id: result.id }, getScopeTag(viewType, projectName)]\n : [getScopeTag(viewType, projectName)],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getBaseView: {\n providesTags: (result, _e, { viewType, projectName }) =>\n result\n ? [{ type: 'view', id: result.id }, getScopeTag(viewType, projectName)]\n : [getScopeTag(viewType, projectName)],\n transformErrorResponse: (error: any) => error.data?.detail,\n }\n },\n})\n\nexport const {\n useListViewsQuery,\n useGetWorkingViewQuery,\n useGetViewQuery,\n useGetDefaultViewQuery,\n useGetBaseViewQuery,\n} = getViewsApi\n"],"names":["getScopeTag","viewType","projectName","VIEW_LIST_TAG","getViewsApi","viewsApi","response","result","_e","v","error","arg","useListViewsQuery","useGetWorkingViewQuery","useGetViewQuery","useGetDefaultViewQuery","useGetBaseViewQuery"],"mappings":"srDAGaA,EAAc,CAACC,EAAkBC,KACrC,CACL,KAAM,OACN,GAAI,GAAGD,EAAS,YAAA,CAAa,GAAGC,EAAc,IAAIA,EAAY,aAAa,GAAK,EAAE,EAAA,GAIhFC,EAAgB,CAAE,KAAM,OAAQ,GAAI,MAAA,EAW7BC,EAAcC,EAAAA,IAAS,iBAA+C,CACjF,UAAW,CACT,UAAW,CACT,kBAAoBC,GAAmCA,GAAU,OAAS,CAAA,EAC1E,aAAc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../../../src/api/queries/views/getViews.ts"],"sourcesContent":["import { ListViewsApiResponse, viewsApi } from '@shared/api/generated'\nimport { DefinitionsFromApi, OverrideResultType, TagTypesFromApi } from '@reduxjs/toolkit/query'\n\nexport const getScopeTag = (viewType: string, projectName?: string) => {\n return {\n type: 'view',\n id: `${viewType.toUpperCase()}${projectName ? `:${projectName.toUpperCase()}` : ''}`,\n }\n}\n\nconst VIEW_LIST_TAG = { type: 'view', id: 'LIST' }\n\ntype GetViewListResult = ListViewsApiResponse['views']\n\ntype Definitions = DefinitionsFromApi<typeof viewsApi>\ntype TagTypes = TagTypesFromApi<typeof viewsApi>\n// update the definitions to include the new types\ntype UpdatedDefinitions = Omit<Definitions, 'listViews'> & {\n listViews: OverrideResultType<Definitions['listViews'], GetViewListResult>\n}\n\nexport const getViewsApi = viewsApi.enhanceEndpoints<TagTypes, UpdatedDefinitions>({\n endpoints: {\n listViews: {\n transformResponse: (response: ListViewsApiResponse) => response?.views || [],\n providesTags: (result, _e, { viewType, projectName }) =>\n result ? [VIEW_LIST_TAG, getScopeTag(viewType, projectName)] : [VIEW_LIST_TAG],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getWorkingView: {\n providesTags: (result, _e, { viewType, projectName }) => [\n { type: 'view', id: result?.id },\n getScopeTag(viewType, projectName),\n VIEW_LIST_TAG,\n ],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getView: {\n providesTags: (result, error, arg) => [{ type: 'view', id: arg.viewId }, VIEW_LIST_TAG],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getDefaultView: {\n providesTags: (result, _e, { viewType, projectName }) =>\n result\n ? [{ type: 'view', id: result.id }, getScopeTag(viewType, projectName)]\n : [getScopeTag(viewType, projectName)],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getBaseView: {\n providesTags: (result, _e, { viewType, projectName }) =>\n result\n ? [{ type: 'view', id: result.id }, getScopeTag(viewType, projectName)]\n : [getScopeTag(viewType, projectName)],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n },\n})\n\nexport const {\n useListViewsQuery,\n useGetWorkingViewQuery,\n useGetViewQuery,\n useGetDefaultViewQuery,\n useGetBaseViewQuery,\n} = getViewsApi\n"],"names":["getScopeTag","viewType","projectName","VIEW_LIST_TAG","getViewsApi","viewsApi","response","result","_e","error","arg","useListViewsQuery","useGetWorkingViewQuery","useGetViewQuery","useGetDefaultViewQuery","useGetBaseViewQuery"],"mappings":"srDAGaA,EAAc,CAACC,EAAkBC,KACrC,CACL,KAAM,OACN,GAAI,GAAGD,EAAS,YAAA,CAAa,GAAGC,EAAc,IAAIA,EAAY,aAAa,GAAK,EAAE,EAAA,GAIhFC,EAAgB,CAAE,KAAM,OAAQ,GAAI,MAAA,EAW7BC,EAAcC,EAAAA,IAAS,iBAA+C,CACjF,UAAW,CACT,UAAW,CACT,kBAAoBC,GAAmCA,GAAU,OAAS,CAAA,EAC1E,aAAc,CAACC,EAAQC,EAAI,CAAE,SAAAP,EAAU,YAAAC,CAAA,IACrCK,EAAS,CAACJ,EAAeH,EAAYC,EAAUC,CAAW,CAAC,EAAI,CAACC,CAAa,EAC/E,uBAAyBM,GAAeA,EAAM,MAAM,MAAA,EAEtD,eAAgB,CACd,aAAc,CAACF,EAAQC,EAAI,CAAE,SAAAP,EAAU,YAAAC,KAAkB,CACvD,CAAE,KAAM,OAAQ,GAAIK,GAAQ,EAAA,EAC5BP,EAAYC,EAAUC,CAAW,EACjCC,CAAA,EAEF,uBAAyBM,GAAeA,EAAM,MAAM,MAAA,EAEtD,QAAS,CACP,aAAc,CAACF,EAAQE,EAAOC,IAAQ,CAAC,CAAE,KAAM,OAAQ,GAAIA,EAAI,MAAA,EAAUP,CAAa,EACtF,uBAAyBM,GAAeA,EAAM,MAAM,MAAA,EAEtD,eAAgB,CACd,aAAc,CAACF,EAAQC,EAAI,CAAE,SAAAP,EAAU,YAAAC,CAAA,IACrCK,EACI,CAAC,CAAE,KAAM,OAAQ,GAAIA,EAAO,EAAA,EAAMP,EAAYC,EAAUC,CAAW,CAAC,EACpE,CAACF,EAAYC,EAAUC,CAAW,CAAC,EACzC,uBAAyBO,GAAeA,EAAM,MAAM,MAAA,EAEtD,YAAa,CACX,aAAc,CAACF,EAAQC,EAAI,CAAE,SAAAP,EAAU,YAAAC,CAAA,IACrCK,EACI,CAAC,CAAE,KAAM,OAAQ,GAAIA,EAAO,EAAA,EAAMP,EAAYC,EAAUC,CAAW,CAAC,EACpE,CAACF,EAAYC,EAAUC,CAAW,CAAC,EACzC,uBAAyBO,GAAeA,EAAM,MAAM,MAAA,CACtD,CAEJ,CAAC,EAEY,CACX,kBAAAE,EACA,uBAAAC,EACA,gBAAAC,EACA,uBAAAC,EACA,oBAAAC,CACF,EAAIX"}
@@ -35,56 +35,52 @@ import "../../generated/versions.es.js";
35
35
  import "../../generated/workfiles.es.js";
36
36
  import "../../generated/ynputCloud.es.js";
37
37
  import "../../generated/grouping.es.js";
38
- import { api as m } from "../../generated/views.es.js";
38
+ import { api as s } from "../../generated/views.es.js";
39
39
  const o = (i, e) => ({
40
40
  type: "view",
41
41
  id: `${i.toUpperCase()}${e ? `:${e.toUpperCase()}` : ""}`
42
- }), p = { type: "view", id: "LIST" }, a = m.enhanceEndpoints({
42
+ }), p = { type: "view", id: "LIST" }, m = s.enhanceEndpoints({
43
43
  endpoints: {
44
44
  listViews: {
45
45
  transformResponse: (i) => i?.views || [],
46
- providesTags: (i, e, { viewType: t, projectName: r }) => i ? [
47
- p,
48
- o(t, r),
49
- ...i.map((s) => ({ type: "view", id: s.id }))
50
- ] : [p],
46
+ providesTags: (i, e, { viewType: r, projectName: t }) => i ? [p, o(r, t)] : [p],
51
47
  transformErrorResponse: (i) => i.data?.detail
52
48
  },
53
49
  getWorkingView: {
54
- providesTags: (i, e, { viewType: t, projectName: r }) => [
50
+ providesTags: (i, e, { viewType: r, projectName: t }) => [
55
51
  { type: "view", id: i?.id },
56
- o(t, r),
52
+ o(r, t),
57
53
  p
58
54
  ],
59
55
  transformErrorResponse: (i) => i.data?.detail
60
56
  },
61
57
  getView: {
62
- providesTags: (i, e, t) => [{ type: "view", id: t.viewId }, p],
58
+ providesTags: (i, e, r) => [{ type: "view", id: r.viewId }, p],
63
59
  transformErrorResponse: (i) => i.data?.detail
64
60
  },
65
61
  getDefaultView: {
66
- providesTags: (i, e, { viewType: t, projectName: r }) => i ? [{ type: "view", id: i.id }, o(t, r)] : [o(t, r)],
62
+ providesTags: (i, e, { viewType: r, projectName: t }) => i ? [{ type: "view", id: i.id }, o(r, t)] : [o(r, t)],
67
63
  transformErrorResponse: (i) => i.data?.detail
68
64
  },
69
65
  getBaseView: {
70
- providesTags: (i, e, { viewType: t, projectName: r }) => i ? [{ type: "view", id: i.id }, o(t, r)] : [o(t, r)],
66
+ providesTags: (i, e, { viewType: r, projectName: t }) => i ? [{ type: "view", id: i.id }, o(r, t)] : [o(r, t)],
71
67
  transformErrorResponse: (i) => i.data?.detail
72
68
  }
73
69
  }
74
70
  }), {
75
- useListViewsQuery: O,
76
- useGetWorkingViewQuery: P,
77
- useGetViewQuery: X,
78
- useGetDefaultViewQuery: Y,
79
- useGetBaseViewQuery: Z
80
- } = a;
71
+ useListViewsQuery: M,
72
+ useGetWorkingViewQuery: O,
73
+ useGetViewQuery: P,
74
+ useGetDefaultViewQuery: X,
75
+ useGetBaseViewQuery: Y
76
+ } = m;
81
77
  export {
82
78
  o as getScopeTag,
83
- a as getViewsApi,
84
- Z as useGetBaseViewQuery,
85
- Y as useGetDefaultViewQuery,
86
- X as useGetViewQuery,
87
- P as useGetWorkingViewQuery,
88
- O as useListViewsQuery
79
+ m as getViewsApi,
80
+ Y as useGetBaseViewQuery,
81
+ X as useGetDefaultViewQuery,
82
+ P as useGetViewQuery,
83
+ O as useGetWorkingViewQuery,
84
+ M as useListViewsQuery
89
85
  };
90
86
  //# sourceMappingURL=getViews.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getViews.es.js","sources":["../../../../../../src/api/queries/views/getViews.ts"],"sourcesContent":["import { ListViewsApiResponse, viewsApi } from '@shared/api/generated'\nimport { DefinitionsFromApi, OverrideResultType, TagTypesFromApi } from '@reduxjs/toolkit/query'\n\nexport const getScopeTag = (viewType: string, projectName?: string) => {\n return {\n type: 'view',\n id: `${viewType.toUpperCase()}${projectName ? `:${projectName.toUpperCase()}` : ''}`,\n }\n}\n\nconst VIEW_LIST_TAG = { type: 'view', id: 'LIST' }\n\ntype GetViewListResult = ListViewsApiResponse['views']\n\ntype Definitions = DefinitionsFromApi<typeof viewsApi>\ntype TagTypes = TagTypesFromApi<typeof viewsApi>\n// update the definitions to include the new types\ntype UpdatedDefinitions = Omit<Definitions, 'listViews'> & {\n listViews: OverrideResultType<Definitions['listViews'], GetViewListResult>\n}\n\nexport const getViewsApi = viewsApi.enhanceEndpoints<TagTypes, UpdatedDefinitions>({\n endpoints: {\n listViews: {\n transformResponse: (response: ListViewsApiResponse) => response?.views || [],\n providesTags: (result, _e, { viewType, projectName }) =>\n result\n ? [\n VIEW_LIST_TAG,\n getScopeTag(viewType, projectName),\n ...result.map((v) => ({ type: 'view', id: v.id })),\n ]\n : [VIEW_LIST_TAG],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getWorkingView: {\n providesTags: (result, _e, { viewType, projectName }) => [\n { type: 'view', id: result?.id },\n getScopeTag(viewType, projectName),\n VIEW_LIST_TAG,\n ],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getView: {\n providesTags: (result, error, arg) => [{ type: 'view', id: arg.viewId }, VIEW_LIST_TAG],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getDefaultView: {\n providesTags: (result, _e, { viewType, projectName }) =>\n result\n ? [{ type: 'view', id: result.id }, getScopeTag(viewType, projectName)]\n : [getScopeTag(viewType, projectName)],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getBaseView: {\n providesTags: (result, _e, { viewType, projectName }) =>\n result\n ? [{ type: 'view', id: result.id }, getScopeTag(viewType, projectName)]\n : [getScopeTag(viewType, projectName)],\n transformErrorResponse: (error: any) => error.data?.detail,\n }\n },\n})\n\nexport const {\n useListViewsQuery,\n useGetWorkingViewQuery,\n useGetViewQuery,\n useGetDefaultViewQuery,\n useGetBaseViewQuery,\n} = getViewsApi\n"],"names":["getScopeTag","viewType","projectName","VIEW_LIST_TAG","getViewsApi","viewsApi","response","result","_e","v","error","arg","useListViewsQuery","useGetWorkingViewQuery","useGetViewQuery","useGetDefaultViewQuery","useGetBaseViewQuery"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAMA,IAAc,CAACC,GAAkBC,OACrC;AAAA,EACL,MAAM;AAAA,EACN,IAAI,GAAGD,EAAS,YAAA,CAAa,GAAGC,IAAc,IAAIA,EAAY,aAAa,KAAK,EAAE;AAAA,IAIhFC,IAAgB,EAAE,MAAM,QAAQ,IAAI,OAAA,GAW7BC,IAAcC,EAAS,iBAA+C;AAAA,EACjF,WAAW;AAAA,IACT,WAAW;AAAA,MACT,mBAAmB,CAACC,MAAmCA,GAAU,SAAS,CAAA;AAAA,MAC1E,cAAc,CAACC,GAAQC,GAAI,EAAE,UAAAP,GAAU,aAAAC,EAAA,MACrCK,IACI;AAAA,QACEJ;AAAA,QACAH,EAAYC,GAAUC,CAAW;AAAA,QACjC,GAAGK,EAAO,IAAI,CAACE,OAAO,EAAE,MAAM,QAAQ,IAAIA,EAAE,KAAK;AAAA,MAAA,IAEnD,CAACN,CAAa;AAAA,MACpB,wBAAwB,CAACO,MAAeA,EAAM,MAAM;AAAA,IAAA;AAAA,IAEtD,gBAAgB;AAAA,MACd,cAAc,CAACH,GAAQC,GAAI,EAAE,UAAAP,GAAU,aAAAC,QAAkB;AAAA,QACvD,EAAE,MAAM,QAAQ,IAAIK,GAAQ,GAAA;AAAA,QAC5BP,EAAYC,GAAUC,CAAW;AAAA,QACjCC;AAAA,MAAA;AAAA,MAEF,wBAAwB,CAACO,MAAeA,EAAM,MAAM;AAAA,IAAA;AAAA,IAEtD,SAAS;AAAA,MACP,cAAc,CAACH,GAAQG,GAAOC,MAAQ,CAAC,EAAE,MAAM,QAAQ,IAAIA,EAAI,OAAA,GAAUR,CAAa;AAAA,MACtF,wBAAwB,CAACO,MAAeA,EAAM,MAAM;AAAA,IAAA;AAAA,IAEtD,gBAAgB;AAAA,MACd,cAAc,CAACH,GAAQC,GAAI,EAAE,UAAAP,GAAU,aAAAC,EAAA,MACrCK,IACI,CAAC,EAAE,MAAM,QAAQ,IAAIA,EAAO,GAAA,GAAMP,EAAYC,GAAUC,CAAW,CAAC,IACpE,CAACF,EAAYC,GAAUC,CAAW,CAAC;AAAA,MACzC,wBAAwB,CAACQ,MAAeA,EAAM,MAAM;AAAA,IAAA;AAAA,IAEtD,aAAa;AAAA,MACX,cAAc,CAACH,GAAQC,GAAI,EAAE,UAAAP,GAAU,aAAAC,EAAA,MACrCK,IACI,CAAC,EAAE,MAAM,QAAQ,IAAIA,EAAO,GAAA,GAAMP,EAAYC,GAAUC,CAAW,CAAC,IACpE,CAACF,EAAYC,GAAUC,CAAW,CAAC;AAAA,MACzC,wBAAwB,CAACQ,MAAeA,EAAM,MAAM;AAAA,IAAA;AAAA,EACtD;AAEJ,CAAC,GAEY;AAAA,EACX,mBAAAE;AAAA,EACA,wBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,qBAAAC;AACF,IAAIZ;"}
1
+ {"version":3,"file":"getViews.es.js","sources":["../../../../../../src/api/queries/views/getViews.ts"],"sourcesContent":["import { ListViewsApiResponse, viewsApi } from '@shared/api/generated'\nimport { DefinitionsFromApi, OverrideResultType, TagTypesFromApi } from '@reduxjs/toolkit/query'\n\nexport const getScopeTag = (viewType: string, projectName?: string) => {\n return {\n type: 'view',\n id: `${viewType.toUpperCase()}${projectName ? `:${projectName.toUpperCase()}` : ''}`,\n }\n}\n\nconst VIEW_LIST_TAG = { type: 'view', id: 'LIST' }\n\ntype GetViewListResult = ListViewsApiResponse['views']\n\ntype Definitions = DefinitionsFromApi<typeof viewsApi>\ntype TagTypes = TagTypesFromApi<typeof viewsApi>\n// update the definitions to include the new types\ntype UpdatedDefinitions = Omit<Definitions, 'listViews'> & {\n listViews: OverrideResultType<Definitions['listViews'], GetViewListResult>\n}\n\nexport const getViewsApi = viewsApi.enhanceEndpoints<TagTypes, UpdatedDefinitions>({\n endpoints: {\n listViews: {\n transformResponse: (response: ListViewsApiResponse) => response?.views || [],\n providesTags: (result, _e, { viewType, projectName }) =>\n result ? [VIEW_LIST_TAG, getScopeTag(viewType, projectName)] : [VIEW_LIST_TAG],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getWorkingView: {\n providesTags: (result, _e, { viewType, projectName }) => [\n { type: 'view', id: result?.id },\n getScopeTag(viewType, projectName),\n VIEW_LIST_TAG,\n ],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getView: {\n providesTags: (result, error, arg) => [{ type: 'view', id: arg.viewId }, VIEW_LIST_TAG],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getDefaultView: {\n providesTags: (result, _e, { viewType, projectName }) =>\n result\n ? [{ type: 'view', id: result.id }, getScopeTag(viewType, projectName)]\n : [getScopeTag(viewType, projectName)],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n getBaseView: {\n providesTags: (result, _e, { viewType, projectName }) =>\n result\n ? [{ type: 'view', id: result.id }, getScopeTag(viewType, projectName)]\n : [getScopeTag(viewType, projectName)],\n transformErrorResponse: (error: any) => error.data?.detail,\n },\n },\n})\n\nexport const {\n useListViewsQuery,\n useGetWorkingViewQuery,\n useGetViewQuery,\n useGetDefaultViewQuery,\n useGetBaseViewQuery,\n} = getViewsApi\n"],"names":["getScopeTag","viewType","projectName","VIEW_LIST_TAG","getViewsApi","viewsApi","response","result","_e","error","arg","useListViewsQuery","useGetWorkingViewQuery","useGetViewQuery","useGetDefaultViewQuery","useGetBaseViewQuery"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAA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tD,aAAa;AAAA,MACX,cAAc,CAACF,GAAQC,GAAI,EAAE,UAAAP,GAAU,aAAAC,EAAA,MACrCK,IACI,CAAC,EAAE,MAAM,QAAQ,IAAIA,EAAO,GAAA,GAAMP,EAAYC,GAAUC,CAAW,CAAC,IACpE,CAACF,EAAYC,GAAUC,CAAW,CAAC;AAAA,MACzC,wBAAwB,CAACO,MAAeA,EAAM,MAAM;AAAA,IAAA;AAAA,EACtD;AAEJ,CAAC,GAEY;AAAA,EACX,mBAAAE;AAAA,EACA,wBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,qBAAAC;AACF,IAAIX;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./getViews.cjs.js"),y=require("uuid"),V=a.getViewsApi.enhanceEndpoints({endpoints:{createView:{onQueryStarted:async(e,{dispatch:r,queryFulfilled:n,getState:c})=>{const{payload:i}=e,u=c().user?.name,g=r(a.getViewsApi.util.updateQueryData("listViews",{viewType:e.viewType,projectName:e.projectName},s=>{const t={...i,working:i.working||!1,scope:e.projectName?"project":"studio",visibility:"private",position:s.length+1,owner:u,accessLevel:30};if(i.working){const o=s.findIndex(p=>p.working===!0);if(o!==-1){const p=s[o].id;s[o]={...t,id:p}}else s.push(t)}else s.push(t);s.sort((o,p)=>o.position!==p.position?o.position-p.position:o.label.localeCompare(p.label))}));let w;i.working&&(w=r(a.getViewsApi.util.updateQueryData("getWorkingView",{viewType:e.viewType,projectName:e.projectName},s=>{const t=s?.id,o={...i,working:!0,scope:e.projectName?"project":"studio",visibility:"private",owner:u,...t&&{id:t}};Object.assign(s,o)})));let l;if(i.label==="__base__"){const s={id:y.v4(),...i,working:!1,scope:e.projectName?"project":"studio",visibility:"private",owner:u,accessLevel:30,position:0};l=r(a.getViewsApi.util.updateQueryData("getBaseView",{viewType:e.viewType,projectName:e.projectName},t=>{t&&Object.assign(t,s)})),l?.patches?.length||r(a.getViewsApi.util.upsertQueryData("getBaseView",{viewType:e.viewType,projectName:e.projectName},s))}try{await n}catch{g.undo(),w&&w.undo(),l&&l.undo()}},transformErrorResponse:e=>e.data?.detail,invalidatesTags:(e,r,{viewType:n,projectName:c,payload:i})=>[{type:"view",id:i.id},a.getScopeTag(n,c)]},updateView:{transformErrorResponse:e=>e.data?.detail,invalidatesTags:(e,r,{viewType:n,projectName:c,viewId:i})=>[{type:"view",id:i},a.getScopeTag(n,c)]},deleteView:{onQueryStarted:async(e,{dispatch:r,queryFulfilled:n,getState:c})=>{const{viewId:i,projectName:d,viewType:u}=e,g=c(),w=[];w.push(r(a.getViewsApi.util.updateQueryData("listViews",{viewType:u,projectName:d},t=>t.filter(o=>o.id!==i))));const l=[{projectName:d},{projectName:void 0}],s=["getBaseView","getDefaultView"];for(const t of l)for(const o of s){const p=a.getViewsApi.endpoints[o].select({viewType:u,projectName:t.projectName})(g);p?.isSuccess&&p.data?.id===i&&w.push(r(a.getViewsApi.util.updateQueryData(o,{viewType:u,projectName:t.projectName},()=>null)))}try{await n}catch(t){w.forEach(o=>o.undo()),console.error("Failed to delete view:",t)}},transformErrorResponse:e=>e.data?.detail,invalidatesTags:(e,r,{viewType:n,projectName:c,viewId:i})=>[{type:"view",id:i},a.getScopeTag(n,c),a.getScopeTag(n,void 0)]},setDefaultView:{onQueryStarted:async(e,{dispatch:r,queryFulfilled:n,getState:c})=>{const{setDefaultViewRequestModel:i,projectName:d,viewType:u}=e,{viewId:g}=i,w=c(),l=a.getViewsApi.endpoints.getDefaultView.select({viewType:u,projectName:d})(w);if(l?.isSuccess&&l.data?.id){const s=r(a.getViewsApi.util.updateQueryData("getDefaultView",{viewType:u,projectName:d},t=>{if(t){const p=a.getViewsApi.endpoints.listViews.select({viewType:u,projectName:d})(w)?.data?.find(v=>v.id===g);p?Object.assign(t,p):t.id=g}}));try{await n}catch(t){s.undo(),console.error("Failed to set default view:",t)}}else console.warn("No current default view found, skipping optimistic update and invalidating default view cache")},transformErrorResponse:e=>e.data?.detail,invalidatesTags:(e,r,{viewType:n,projectName:c,setDefaultViewRequestModel:i})=>[{type:"view",id:i.viewId},a.getScopeTag(n,c)]}}}),{useCreateViewMutation:f,useUpdateViewMutation:m,useDeleteViewMutation:j,useSetDefaultViewMutation:T}=V;exports.useCreateViewMutation=f;exports.useDeleteViewMutation=j;exports.useSetDefaultViewMutation=T;exports.useUpdateViewMutation=m;exports.viewsQueries=V;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./getViews.cjs.js"),v=require("uuid"),V=o.getViewsApi.enhanceEndpoints({endpoints:{createView:{onQueryStarted:async(e,{dispatch:r,queryFulfilled:p,getState:c})=>{const{payload:t}=e,n=c().user?.name,d=r(o.getViewsApi.util.updateQueryData("listViews",{viewType:e.viewType,projectName:e.projectName},a=>{const s={...t,working:t.working||!1,scope:e.projectName?"project":"studio",visibility:"private",position:a.length+1,owner:n,accessLevel:30};if(t.working){const u=a.findIndex(g=>g.working===!0);if(u!==-1){const g=a[u].id;a[u]={...s,id:g}}else a.push(s)}else a.push(s);a.sort((u,g)=>u.position!==g.position?u.position-g.position:u.label.localeCompare(g.label))}));let i;t.working&&(i=r(o.getViewsApi.util.updateQueryData("getWorkingView",{viewType:e.viewType,projectName:e.projectName},a=>{const s=a?.id,u={...t,working:!0,scope:e.projectName?"project":"studio",visibility:"private",owner:n,...s&&{id:s}};Object.assign(a,u)})));let w;if(t.label==="__base__"){const a={id:v.v4(),...t,working:!1,scope:e.projectName?"project":"studio",visibility:"private",owner:n,accessLevel:30,position:0};w=r(o.getViewsApi.util.updateQueryData("getBaseView",{viewType:e.viewType,projectName:e.projectName},s=>{s&&Object.assign(s,a)})),w?.patches?.length||r(o.getViewsApi.util.upsertQueryData("getBaseView",{viewType:e.viewType,projectName:e.projectName},a))}try{await p}catch{d.undo(),i&&i.undo(),w&&w.undo()}},transformErrorResponse:e=>e.data?.detail,invalidatesTags:(e,r,{viewType:p,projectName:c,payload:t})=>[{type:"view",id:t.id},o.getScopeTag(p,c)]},updateView:{onQueryStarted:async(e,{dispatch:r,queryFulfilled:p})=>{const{viewId:c,payload:t,viewType:l,projectName:n}=e,d=[];d.push(r(o.getViewsApi.util.updateQueryData("listViews",{viewType:l,projectName:n},i=>{const w=i.find(a=>a.id===c);w&&Object.assign(w,t)}))),d.push(r(o.getViewsApi.util.updateQueryData("getWorkingView",{viewType:l,projectName:n},i=>{i?.id===c&&Object.assign(i,t)}))),d.push(r(o.getViewsApi.util.updateQueryData("getDefaultView",{viewType:l,projectName:n},i=>{i?.id===c&&Object.assign(i,t)}))),d.push(r(o.getViewsApi.util.updateQueryData("getView",{viewType:l,viewId:c,projectName:n},i=>{i&&Object.assign(i,t)})));try{await p}catch{d.forEach(w=>w.undo())}},transformErrorResponse:e=>e.data?.detail,invalidatesTags:(e,r,{viewType:p,projectName:c,viewId:t,payload:l})=>{const n=[{type:"view",id:t}],d=["label","owner","position","visibility","scope","accessLevel","working"];return Object.keys(l).some(w=>d.includes(w))&&n.push(o.getScopeTag(p,c)),n}},deleteView:{onQueryStarted:async(e,{dispatch:r,queryFulfilled:p,getState:c})=>{const{viewId:t,projectName:l,viewType:n}=e,d=c(),i=[];i.push(r(o.getViewsApi.util.updateQueryData("listViews",{viewType:n,projectName:l},s=>s.filter(u=>u.id!==t))));const w=[{projectName:l},{projectName:void 0}],a=["getBaseView","getDefaultView"];for(const s of w)for(const u of a){const g=o.getViewsApi.endpoints[u].select({viewType:n,projectName:s.projectName})(d);g?.isSuccess&&g.data?.id===t&&i.push(r(o.getViewsApi.util.updateQueryData(u,{viewType:n,projectName:s.projectName},()=>null)))}try{await p}catch(s){i.forEach(u=>u.undo()),console.error("Failed to delete view:",s)}},transformErrorResponse:e=>e.data?.detail,invalidatesTags:(e,r,{viewType:p,projectName:c,viewId:t})=>[{type:"view",id:t},o.getScopeTag(p,c),o.getScopeTag(p,void 0)]},setDefaultView:{onQueryStarted:async(e,{dispatch:r,queryFulfilled:p,getState:c})=>{const{setDefaultViewRequestModel:t,projectName:l,viewType:n}=e,{viewId:d}=t,i=c(),w=o.getViewsApi.endpoints.getDefaultView.select({viewType:n,projectName:l})(i);if(w?.isSuccess&&w.data?.id){const a=r(o.getViewsApi.util.updateQueryData("getDefaultView",{viewType:n,projectName:l},s=>{if(s){const g=o.getViewsApi.endpoints.listViews.select({viewType:n,projectName:l})(i)?.data?.find(y=>y.id===d);g?Object.assign(s,g):s.id=d}}));try{await p}catch(s){a.undo(),console.error("Failed to set default view:",s)}}else console.warn("No current default view found, skipping optimistic update and invalidating default view cache")},transformErrorResponse:e=>e.data?.detail,invalidatesTags:(e,r,{viewType:p,projectName:c,setDefaultViewRequestModel:t})=>[{type:"view",id:t.viewId},o.getScopeTag(p,c)]}}}),{useCreateViewMutation:f,useUpdateViewMutation:j,useDeleteViewMutation:m,useSetDefaultViewMutation:h}=V;exports.useCreateViewMutation=f;exports.useDeleteViewMutation=m;exports.useSetDefaultViewMutation=h;exports.useUpdateViewMutation=j;exports.viewsQueries=V;
2
2
  //# sourceMappingURL=updateViews.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateViews.cjs.js","sources":["../../../../../../src/api/queries/views/updateViews.ts"],"sourcesContent":["import { ViewListItemModel } from '@shared/api/generated'\nimport { getScopeTag, getViewsApi } from './getViews'\nimport { v4 as uuidv4 } from 'uuid'\n\nconst updateViewsApi = getViewsApi.enhanceEndpoints({\n endpoints: {\n createView: {\n onQueryStarted: async (arg, { dispatch, queryFulfilled, getState }) => {\n const { payload } = arg\n const state = getState()\n // @ts-expect-error - user is not typed in the state\n const user = state.user?.name\n\n // Optimistically update the view list\n const patch = dispatch(\n getViewsApi.util.updateQueryData(\n 'listViews',\n { viewType: arg.viewType, projectName: arg.projectName },\n (draft) => {\n const newView: ViewListItemModel = {\n ...payload,\n working: payload.working || false,\n scope: arg.projectName ? 'project' : 'studio',\n visibility: 'private',\n position: draft.length + 1, // Add to the end of the list\n owner: user,\n accessLevel: 30,\n }\n if (payload.working) {\n // For working views, find and replace the existing working view\n const existingWorkingIndex = draft.findIndex((view) => view.working === true)\n if (existingWorkingIndex !== -1) {\n // Keep the existing ID but update all other properties\n const existingId = draft[existingWorkingIndex].id\n draft[existingWorkingIndex] = { ...newView, id: existingId }\n } else {\n // No existing working view, add the new one\n draft.push(newView)\n }\n } else {\n // For non-working views, add to the list as usual\n draft.push(newView)\n }\n\n // finally sort the view by position and then by label\n draft.sort((a, b) => {\n if (a.position !== b.position) {\n return a.position - b.position\n }\n return a.label.localeCompare(b.label)\n })\n },\n ),\n )\n\n // Also update the getWorkingView cache if this is a working view\n let workingViewPatch\n if (payload.working) {\n workingViewPatch = dispatch(\n getViewsApi.util.updateQueryData(\n 'getWorkingView',\n { viewType: arg.viewType, projectName: arg.projectName },\n (draft) => {\n // Preserve the existing ID if there's already a working view\n const existingId = draft?.id\n const updatedWorkingView = {\n ...payload,\n working: true,\n scope: arg.projectName ? 'project' : 'studio',\n visibility: 'private',\n owner: user,\n ...(existingId && { id: existingId }), // Keep existing ID if it exists\n }\n // Update the working view cache with the new view data\n Object.assign(draft, updatedWorkingView)\n },\n ),\n )\n }\n\n let baseViewPatch\n\n if (payload.label === '__base__') {\n const newBaseView = {\n id: uuidv4(),\n ...payload,\n working: false,\n scope: arg.projectName ? 'project' : 'studio',\n visibility: 'private',\n owner: user,\n accessLevel: 30,\n position: 0,\n }\n\n baseViewPatch = dispatch(\n getViewsApi.util.updateQueryData(\n 'getBaseView',\n { viewType: arg.viewType, projectName: arg.projectName },\n (draft) => {\n if (draft) {\n Object.assign(draft, newBaseView)\n }\n },\n ),\n )\n\n // If the cache wasn't updated (because it didn't exist), upsert it\n if (!baseViewPatch?.patches?.length) {\n dispatch(\n getViewsApi.util.upsertQueryData(\n 'getBaseView',\n { viewType: arg.viewType, projectName: arg.projectName },\n newBaseView as any,\n ),\n )\n }\n }\n\n try {\n await queryFulfilled\n } catch (error) {\n patch.undo()\n if (workingViewPatch) workingViewPatch.undo()\n if (baseViewPatch) baseViewPatch.undo()\n }\n },\n transformErrorResponse: (error: any) => error.data?.detail,\n // updates the view list cache for a specific view type and project\n invalidatesTags: (_r, _e, { viewType, projectName, payload }) => [\n { type: 'view', id: payload.id },\n getScopeTag(viewType, projectName),\n ],\n },\n updateView: {\n transformErrorResponse: (error: any) => error.data?.detail,\n invalidatesTags: (_r, _e, { viewType, projectName, viewId }) => [\n { type: 'view', id: viewId },\n getScopeTag(viewType, projectName),\n ],\n },\n deleteView: {\n onQueryStarted: async (arg, { dispatch, queryFulfilled, getState }) => {\n const { viewId, projectName, viewType } = arg\n const state = getState()\n\n // Optimistically remove the view from the list\n const patches: any[] = []\n\n patches.push(\n dispatch(\n getViewsApi.util.updateQueryData('listViews', { viewType, projectName }, (draft) => {\n return draft.filter((view) => view.id !== viewId)\n }),\n ),\n )\n\n // Check both project and studio level for base and default views\n const scopesToCheck = [\n { projectName },\n { projectName: undefined }, // studio level\n ]\n const queriesToCheck = ['getBaseView', 'getDefaultView'] as const\n\n for (const scope of scopesToCheck) {\n for (const queryName of queriesToCheck) {\n const currentView = getViewsApi.endpoints[queryName].select({\n viewType,\n projectName: scope.projectName,\n })(state)\n\n if (currentView?.isSuccess && currentView.data?.id === viewId) {\n patches.push(\n dispatch(\n getViewsApi.util.updateQueryData(\n queryName,\n { viewType, projectName: scope.projectName },\n () => null as any,\n ),\n ),\n )\n }\n }\n }\n\n try {\n await queryFulfilled\n } catch (error) {\n // If the query failed, roll back all optimistic updates\n patches.forEach((patch) => patch.undo())\n console.error('Failed to delete view:', error)\n }\n },\n transformErrorResponse: (error: any) => error.data?.detail,\n // updates the view list cache for a specific view type and project\n invalidatesTags: (_r, _e, { viewType, projectName, viewId }) => [\n { type: 'view', id: viewId },\n getScopeTag(viewType, projectName),\n getScopeTag(viewType, undefined),\n ],\n },\n setDefaultView: {\n onQueryStarted: async (arg, { dispatch, queryFulfilled, getState }) => {\n const { setDefaultViewRequestModel, projectName, viewType } = arg\n const { viewId } = setDefaultViewRequestModel\n const state = getState()\n // get current state of default view\n const currentDefaultView = getViewsApi.endpoints.getDefaultView.select({\n viewType,\n projectName,\n })(state)\n\n // check if there is even a cache for the default view\n if (currentDefaultView?.isSuccess && currentDefaultView.data?.id) {\n // Optimistically update the default view\n const patch = dispatch(\n getViewsApi.util.updateQueryData(\n 'getDefaultView',\n { viewType, projectName },\n (draft) => {\n if (draft) {\n // Try to find the view in the listViews cache\n const listViewData = getViewsApi.endpoints.listViews.select({\n viewType,\n projectName,\n })(state)\n const view = listViewData?.data?.find((v) => v.id === viewId)\n\n if (view) {\n // If the view is found in the listViews cache, update the getDefaultView cache with the full view data\n Object.assign(draft, view)\n } else {\n // If the view is not found, only update the ID\n draft.id = viewId\n }\n }\n },\n ),\n )\n\n try {\n await queryFulfilled\n } catch (error) {\n // If the query failed, we need to roll back the optimistic update\n patch.undo()\n console.error('Failed to set default view:', error)\n }\n } else {\n console.warn(\n 'No current default view found, skipping optimistic update and invalidating default view cache',\n )\n // If there is no current default view, we skip the optimistic update\n // it will be handled by the invalidation below\n }\n },\n transformErrorResponse: (error: any) => error.data?.detail,\n // updates the default view cache for a specific view type and project\n invalidatesTags: (_r, _e, { viewType, projectName, setDefaultViewRequestModel }) => [\n { type: 'view', id: setDefaultViewRequestModel.viewId },\n getScopeTag(viewType, projectName),\n ],\n },\n },\n})\n\nexport const {\n useCreateViewMutation,\n useUpdateViewMutation,\n useDeleteViewMutation,\n useSetDefaultViewMutation,\n} = updateViewsApi\nexport { updateViewsApi as viewsQueries }\n"],"names":["updateViewsApi","getViewsApi","arg","dispatch","queryFulfilled","getState","payload","user","patch","draft","newView","existingWorkingIndex","view","existingId","a","b","workingViewPatch","updatedWorkingView","baseViewPatch","newBaseView","uuidv4","error","_r","_e","viewType","projectName","getScopeTag","viewId","state","patches","scopesToCheck","queriesToCheck","scope","queryName","currentView","setDefaultViewRequestModel","currentDefaultView","useCreateViewMutation","useUpdateViewMutation","useDeleteViewMutation","useSetDefaultViewMutation"],"mappings":"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,YAAY,UAAU,eAAe,OAAO,CACrE,SAAAuB,EACA,YAAAC,CAAA,CACD,EAAEG,CAAK,EAGR,GAAIQ,GAAoB,WAAaA,EAAmB,MAAM,GAAI,CAEhE,MAAM5B,EAAQL,EACZF,EAAAA,YAAY,KAAK,gBACf,iBACA,CAAE,SAAAuB,EAAU,YAAAC,CAAA,EACXhB,GAAU,CACT,GAAIA,EAAO,CAMT,MAAMG,EAJeX,EAAAA,YAAY,UAAU,UAAU,OAAO,CAC1D,SAAAuB,EACA,YAAAC,CAAA,CACD,EAAEG,CAAK,GACmB,MAAM,KAAM,GAAM,EAAE,KAAOD,CAAM,EAExDf,EAEF,OAAO,OAAOH,EAAOG,CAAI,EAGzBH,EAAM,GAAKkB,CAEf,CACF,CAAA,CACF,EAGF,GAAI,CACF,MAAMvB,CACR,OAASiB,EAAO,CAEdb,EAAM,KAAA,EACN,QAAQ,MAAM,8BAA+Ba,CAAK,CACpD,CACF,MACE,QAAQ,KACN,+FAAA,CAKN,EACA,uBAAyBA,GAAeA,EAAM,MAAM,OAEpD,gBAAiB,CAACC,EAAIC,EAAI,CAAE,SAAAC,EAAU,YAAAC,EAAa,2BAAAU,KAAiC,CAClF,CAAE,KAAM,OAAQ,GAAIA,EAA2B,MAAA,EAC/CT,EAAAA,YAAYF,EAAUC,CAAW,CAAA,CACnC,CACF,CAEJ,CAAC,EAEY,CACX,sBAAAY,EACA,sBAAAC,EACA,sBAAAC,EACA,0BAAAC,CACF,EAAIxC"}
1
+ {"version":3,"file":"updateViews.cjs.js","sources":["../../../../../../src/api/queries/views/updateViews.ts"],"sourcesContent":["import { ViewListItemModel } from '@shared/api/generated'\nimport { getScopeTag, getViewsApi } from './getViews'\nimport { v4 as uuidv4 } from 'uuid'\n\nconst updateViewsApi = getViewsApi.enhanceEndpoints({\n endpoints: {\n createView: {\n onQueryStarted: async (arg, { dispatch, queryFulfilled, getState }) => {\n const { payload } = arg\n const state = getState()\n // @ts-expect-error - user is not typed in the state\n const user = state.user?.name\n\n // Optimistically update the view list\n const patch = dispatch(\n getViewsApi.util.updateQueryData(\n 'listViews',\n { viewType: arg.viewType, projectName: arg.projectName },\n (draft) => {\n const newView: ViewListItemModel = {\n ...payload,\n working: payload.working || false,\n scope: arg.projectName ? 'project' : 'studio',\n visibility: 'private',\n position: draft.length + 1, // Add to the end of the list\n owner: user,\n accessLevel: 30,\n }\n if (payload.working) {\n // For working views, find and replace the existing working view\n const existingWorkingIndex = draft.findIndex((view) => view.working === true)\n if (existingWorkingIndex !== -1) {\n // Keep the existing ID but update all other properties\n const existingId = draft[existingWorkingIndex].id\n draft[existingWorkingIndex] = { ...newView, id: existingId }\n } else {\n // No existing working view, add the new one\n draft.push(newView)\n }\n } else {\n // For non-working views, add to the list as usual\n draft.push(newView)\n }\n\n // finally sort the view by position and then by label\n draft.sort((a, b) => {\n if (a.position !== b.position) {\n return a.position - b.position\n }\n return a.label.localeCompare(b.label)\n })\n },\n ),\n )\n\n // Also update the getWorkingView cache if this is a working view\n let workingViewPatch\n if (payload.working) {\n workingViewPatch = dispatch(\n getViewsApi.util.updateQueryData(\n 'getWorkingView',\n { viewType: arg.viewType, projectName: arg.projectName },\n (draft) => {\n // Preserve the existing ID if there's already a working view\n const existingId = draft?.id\n const updatedWorkingView = {\n ...payload,\n working: true,\n scope: arg.projectName ? 'project' : 'studio',\n visibility: 'private',\n owner: user,\n ...(existingId && { id: existingId }), // Keep existing ID if it exists\n }\n // Update the working view cache with the new view data\n Object.assign(draft, updatedWorkingView)\n },\n ),\n )\n }\n\n let baseViewPatch\n\n if (payload.label === '__base__') {\n const newBaseView = {\n id: uuidv4(),\n ...payload,\n working: false,\n scope: arg.projectName ? 'project' : 'studio',\n visibility: 'private',\n owner: user,\n accessLevel: 30,\n position: 0,\n }\n\n baseViewPatch = dispatch(\n getViewsApi.util.updateQueryData(\n 'getBaseView',\n { viewType: arg.viewType, projectName: arg.projectName },\n (draft) => {\n if (draft) {\n Object.assign(draft, newBaseView)\n }\n },\n ),\n )\n\n // If the cache wasn't updated (because it didn't exist), upsert it\n if (!baseViewPatch?.patches?.length) {\n dispatch(\n getViewsApi.util.upsertQueryData(\n 'getBaseView',\n { viewType: arg.viewType, projectName: arg.projectName },\n newBaseView as any,\n ),\n )\n }\n }\n\n try {\n await queryFulfilled\n } catch (error) {\n patch.undo()\n if (workingViewPatch) workingViewPatch.undo()\n if (baseViewPatch) baseViewPatch.undo()\n }\n },\n transformErrorResponse: (error: any) => error.data?.detail,\n // updates the view list cache for a specific view type and project\n invalidatesTags: (_r, _e, { viewType, projectName, payload }) => [\n { type: 'view', id: payload.id },\n getScopeTag(viewType, projectName),\n ],\n },\n updateView: {\n onQueryStarted: async (arg, { dispatch, queryFulfilled }) => {\n const { viewId, payload, viewType, projectName } = arg\n\n const patches: any[] = []\n\n // 1. Update listViews\n patches.push(\n dispatch(\n getViewsApi.util.updateQueryData('listViews', { viewType, projectName }, (draft) => {\n const view = draft.find((v) => v.id === viewId)\n if (view) {\n Object.assign(view, payload)\n }\n }),\n ),\n )\n\n // 2. Update getWorkingView\n patches.push(\n dispatch(\n getViewsApi.util.updateQueryData(\n 'getWorkingView',\n { viewType, projectName },\n (draft) => {\n if (draft?.id === viewId) {\n Object.assign(draft, payload)\n }\n },\n ),\n ),\n )\n\n // 3. Update getDefaultView\n patches.push(\n dispatch(\n getViewsApi.util.updateQueryData(\n 'getDefaultView',\n { viewType, projectName },\n (draft) => {\n if (draft?.id === viewId) {\n Object.assign(draft, payload)\n }\n },\n ),\n ),\n )\n\n // 4. Update getView\n patches.push(\n dispatch(\n getViewsApi.util.updateQueryData(\n 'getView',\n { viewType, viewId, projectName },\n (draft) => {\n if (draft) {\n Object.assign(draft, payload)\n }\n },\n ),\n ),\n )\n\n try {\n await queryFulfilled\n } catch (error) {\n patches.forEach((patch) => patch.undo())\n }\n },\n transformErrorResponse: (error: any) => error.data?.detail,\n invalidatesTags: (_r, _e, { viewType, projectName, viewId, payload }) => {\n const tags: any[] = [{ type: 'view', id: viewId }]\n\n // Only invalidate the full list if metadata fields (like label) have changed\n const metadataFields = [\n 'label',\n 'owner',\n 'position',\n 'visibility',\n 'scope',\n 'accessLevel',\n 'working',\n ]\n const hasMetadataChanges = Object.keys(payload).some((key) => metadataFields.includes(key))\n\n if (hasMetadataChanges) {\n tags.push(getScopeTag(viewType, projectName))\n }\n\n return tags\n },\n },\n deleteView: {\n onQueryStarted: async (arg, { dispatch, queryFulfilled, getState }) => {\n const { viewId, projectName, viewType } = arg\n const state = getState()\n\n // Optimistically remove the view from the list\n const patches: any[] = []\n\n patches.push(\n dispatch(\n getViewsApi.util.updateQueryData('listViews', { viewType, projectName }, (draft) => {\n return draft.filter((view) => view.id !== viewId)\n }),\n ),\n )\n\n // Check both project and studio level for base and default views\n const scopesToCheck = [\n { projectName },\n { projectName: undefined }, // studio level\n ]\n const queriesToCheck = ['getBaseView', 'getDefaultView'] as const\n\n for (const scope of scopesToCheck) {\n for (const queryName of queriesToCheck) {\n const currentView = getViewsApi.endpoints[queryName].select({\n viewType,\n projectName: scope.projectName,\n })(state)\n\n if (currentView?.isSuccess && currentView.data?.id === viewId) {\n patches.push(\n dispatch(\n getViewsApi.util.updateQueryData(\n queryName,\n { viewType, projectName: scope.projectName },\n () => null as any,\n ),\n ),\n )\n }\n }\n }\n\n try {\n await queryFulfilled\n } catch (error) {\n // If the query failed, roll back all optimistic updates\n patches.forEach((patch) => patch.undo())\n console.error('Failed to delete view:', error)\n }\n },\n transformErrorResponse: (error: any) => error.data?.detail,\n // updates the view list cache for a specific view type and project\n invalidatesTags: (_r, _e, { viewType, projectName, viewId }) => [\n { type: 'view', id: viewId },\n getScopeTag(viewType, projectName),\n getScopeTag(viewType, undefined),\n ],\n },\n setDefaultView: {\n onQueryStarted: async (arg, { dispatch, queryFulfilled, getState }) => {\n const { setDefaultViewRequestModel, projectName, viewType } = arg\n const { viewId } = setDefaultViewRequestModel\n const state = getState()\n // get current state of default view\n const currentDefaultView = getViewsApi.endpoints.getDefaultView.select({\n viewType,\n projectName,\n })(state)\n\n // check if there is even a cache for the default view\n if (currentDefaultView?.isSuccess && currentDefaultView.data?.id) {\n // Optimistically update the default view\n const patch = dispatch(\n getViewsApi.util.updateQueryData(\n 'getDefaultView',\n { viewType, projectName },\n (draft) => {\n if (draft) {\n // Try to find the view in the listViews cache\n const listViewData = getViewsApi.endpoints.listViews.select({\n viewType,\n projectName,\n })(state)\n const view = listViewData?.data?.find((v) => v.id === viewId)\n\n if (view) {\n // If the view is found in the listViews cache, update the getDefaultView cache with the full view data\n Object.assign(draft, view)\n } else {\n // If the view is not found, only update the ID\n draft.id = viewId\n }\n }\n },\n ),\n )\n\n try {\n await queryFulfilled\n } catch (error) {\n // If the query failed, we need to roll back the optimistic update\n patch.undo()\n console.error('Failed to set default view:', error)\n }\n } else {\n console.warn(\n 'No current default view found, skipping optimistic update and invalidating default view cache',\n )\n // If there is no current default view, we skip the optimistic update\n // it will be handled by the invalidation below\n }\n },\n transformErrorResponse: (error: any) => error.data?.detail,\n // updates the default view cache for a specific view type and project\n invalidatesTags: (_r, _e, { viewType, projectName, setDefaultViewRequestModel }) => [\n { type: 'view', id: setDefaultViewRequestModel.viewId },\n getScopeTag(viewType, projectName),\n ],\n },\n },\n})\n\nexport const {\n useCreateViewMutation,\n useUpdateViewMutation,\n useDeleteViewMutation,\n useSetDefaultViewMutation,\n} = updateViewsApi\nexport { updateViewsApi as viewsQueries }\n"],"names":["updateViewsApi","getViewsApi","arg","dispatch","queryFulfilled","getState","payload","user","patch","draft","newView","existingWorkingIndex","view","existingId","a","b","workingViewPatch","updatedWorkingView","baseViewPatch","newBaseView","uuidv4","error","_r","_e","viewType","projectName","getScopeTag","viewId","patches","v","tags","metadataFields","key","state","scopesToCheck","queriesToCheck","scope","queryName","currentView","setDefaultViewRequestModel","currentDefaultView","useCreateViewMutation","useUpdateViewMutation","useDeleteViewMutation","useSetDefaultViewMutation"],"mappings":"uIAIMA,EAAiBC,EAAAA,YAAY,iBAAiB,CAClD,UAAW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