@flexkit/studio 0.2.31 → 0.2.33
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/dist/activity-nav-button-ZHQOZBCC.js +2 -0
- package/dist/{activity-nav-button-E4I4YC3X.js.map → activity-nav-button-ZHQOZBCC.js.map} +1 -1
- package/dist/astro.js +1 -1
- package/dist/chat-page-LR7XC2US.js +4 -0
- package/dist/{chat-page-JS5SJ4OG.js.map → chat-page-LR7XC2US.js.map} +1 -1
- package/dist/chunk-2MVQXXY7.js +4 -0
- package/dist/{chunk-OMYDXVWS.js.map → chunk-2MVQXXY7.js.map} +1 -1
- package/dist/{chunk-ERCVR23U.js → chunk-36DLIVZF.js} +2 -2
- package/dist/{chunk-ERCVR23U.js.map → chunk-36DLIVZF.js.map} +1 -1
- package/dist/chunk-3SY46ERM.js +2 -0
- package/dist/chunk-3SY46ERM.js.map +1 -0
- package/dist/chunk-4ZWQ44NZ.js +2 -0
- package/dist/{chunk-2NXQF2F7.js.map → chunk-4ZWQ44NZ.js.map} +1 -1
- package/dist/chunk-5JUG4BEF.js +2 -0
- package/dist/chunk-5JUG4BEF.js.map +1 -0
- package/dist/chunk-6I7D2JBA.js +3 -0
- package/dist/chunk-6I7D2JBA.js.map +1 -0
- package/dist/chunk-7ODGH7G2.js +2 -0
- package/dist/{chunk-5LGIALCK.js.map → chunk-7ODGH7G2.js.map} +1 -1
- package/dist/{chunk-SZEGGBOC.js → chunk-A4DPLZZF.js} +2 -2
- package/dist/{chunk-SZEGGBOC.js.map → chunk-A4DPLZZF.js.map} +1 -1
- package/dist/{chunk-C4XLDODU.js → chunk-C2KPTRYM.js} +3 -1
- package/dist/chunk-C3OHXPJV.js +2 -0
- package/dist/chunk-C3OHXPJV.js.map +1 -0
- package/dist/{chunk-D76P4TER.js → chunk-CFYO546Y.js} +3 -3
- package/dist/{chunk-D76P4TER.js.map → chunk-CFYO546Y.js.map} +1 -1
- package/dist/chunk-DHE6PO3V.js +2 -0
- package/dist/{chunk-57X5WRMY.js.map → chunk-DHE6PO3V.js.map} +1 -1
- package/dist/{chunk-V7C4EHK3.js → chunk-DSLPTDZX.js} +2 -2
- package/dist/{chunk-V7C4EHK3.js.map → chunk-DSLPTDZX.js.map} +1 -1
- package/dist/chunk-HSGUVQXU.js +10 -0
- package/dist/chunk-HSGUVQXU.js.map +1 -0
- package/dist/{chunk-EMFHKTAV.js → chunk-K3HW6YWS.js} +2 -2
- package/dist/{chunk-EMFHKTAV.js.map → chunk-K3HW6YWS.js.map} +1 -1
- package/dist/chunk-L5T56MRH.js +7 -0
- package/dist/chunk-L5T56MRH.js.map +1 -0
- package/dist/chunk-MBBE4RND.js +3 -0
- package/dist/chunk-MBBE4RND.js.map +1 -0
- package/dist/{chunk-USNXQOMJ.js → chunk-N33S7BSG.js} +2 -2
- package/dist/{chunk-USNXQOMJ.js.map → chunk-N33S7BSG.js.map} +1 -1
- package/dist/{chunk-KN7OJFEX.js → chunk-N52JTYBJ.js} +2 -2
- package/dist/{chunk-KN7OJFEX.js.map → chunk-N52JTYBJ.js.map} +1 -1
- package/dist/{chunk-SZ3DX7XD.js → chunk-NFEQBTIW.js} +2 -2
- package/dist/{chunk-SZ3DX7XD.js.map → chunk-NFEQBTIW.js.map} +1 -1
- package/dist/chunk-RFUMT6ZR.js +2 -0
- package/dist/{chunk-W74OKBZG.js.map → chunk-RFUMT6ZR.js.map} +1 -1
- package/dist/{chunk-6GXNHR6H.js → chunk-RLVHUIFC.js} +2 -2
- package/dist/{chunk-6GXNHR6H.js.map → chunk-RLVHUIFC.js.map} +1 -1
- package/dist/chunk-S26WK6RF.js +2 -0
- package/dist/{chunk-54AXLGAK.js.map → chunk-S26WK6RF.js.map} +1 -1
- package/dist/{chunk-T4SEZXGL.js → chunk-S7VNSSIK.js} +2 -2
- package/dist/{chunk-T4SEZXGL.js.map → chunk-S7VNSSIK.js.map} +1 -1
- package/dist/chunk-S7Z6KKIN.js +2 -0
- package/dist/chunk-S7Z6KKIN.js.map +1 -0
- package/dist/{chunk-KVYQ3O4F.js → chunk-U5XZWEPO.js} +3 -3
- package/dist/{chunk-KVYQ3O4F.js.map → chunk-U5XZWEPO.js.map} +1 -1
- package/dist/chunk-UB22GYFK.js +2 -0
- package/dist/{chunk-GQTWNWT7.js.map → chunk-UB22GYFK.js.map} +1 -1
- package/dist/chunk-VUZ7GHSO.js +7 -0
- package/dist/{chunk-5NQ47SWN.js.map → chunk-VUZ7GHSO.js.map} +1 -1
- package/dist/chunk-X3SHNHHM.js +2 -0
- package/dist/chunk-X3SHNHHM.js.map +1 -0
- package/dist/{chunk-GXQSNOGM.js → chunk-YKM3FUGK.js} +3 -3
- package/dist/{chunk-GXQSNOGM.js.map → chunk-YKM3FUGK.js.map} +1 -1
- package/dist/electron.js +1 -1
- package/dist/{entry-PFXS633U.js → entry-ROTT3ZDN.js} +2 -2
- package/dist/{entry-PFXS633U.js.map → entry-ROTT3ZDN.js.map} +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/list-N4E3VXM5.js +3 -0
- package/dist/{list-EWWRLK4I.js.map → list-N4E3VXM5.js.map} +1 -1
- package/dist/list-RCTHBJOK.js +2 -0
- package/dist/{list-R7SJFXCX.js.map → list-RCTHBJOK.js.map} +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/pages-XUJGIHQI.js +5 -0
- package/dist/pages-XUJGIHQI.js.map +1 -0
- package/dist/plugin-pages-FEQILAQR.js +2 -0
- package/dist/{plugin-pages-X3V2VPAU.js.map → plugin-pages-FEQILAQR.js.map} +1 -1
- package/dist/project-selector-U64ROZ5D.js +2 -0
- package/dist/project-selector-U64ROZ5D.js.map +1 -0
- package/dist/record-links-HO4SEHOA.js +2 -0
- package/dist/{record-links-VH2TPCK4.js.map → record-links-HO4SEHOA.js.map} +1 -1
- package/dist/root-BUXIQKA5.js +14 -0
- package/dist/{root-4QRY7KAC.js.map → root-BUXIQKA5.js.map} +1 -1
- package/dist/root-CCUROZVR.js +2 -0
- package/dist/{root-HQQ4TNTR.js.map → root-CCUROZVR.js.map} +1 -1
- package/dist/root-GQL3P63Z.js +31 -0
- package/dist/{root-NYAXP66A.js.map → root-GQL3P63Z.js.map} +1 -1
- package/dist/root-KXY4A6DW.js +2 -0
- package/dist/{root-OJ4UFMRX.js.map → root-KXY4A6DW.js.map} +1 -1
- package/dist/root-MLEJUEMJ.js +23 -0
- package/dist/{root-7YXE6DEA.js.map → root-MLEJUEMJ.js.map} +1 -1
- package/dist/root-VA3E6HEY.js +2 -0
- package/dist/{root-FNXHGVQT.js.map → root-VA3E6HEY.js.map} +1 -1
- package/dist/search-YY4GQQRM.js +2 -0
- package/dist/{search-LSIHN6OI.js.map → search-YY4GQQRM.js.map} +1 -1
- package/dist/skills-pages-SAOZTUOH.js +2 -0
- package/dist/{skills-pages-W47HECK3.js.map → skills-pages-SAOZTUOH.js.map} +1 -1
- package/dist/source-2S24MZ5D.js +2 -0
- package/dist/{source-3N7BQVYO.js.map → source-2S24MZ5D.js.map} +1 -1
- package/dist/spec-renderer-ZSIVMKVE.js +2 -0
- package/dist/{spec-renderer-3GAVSV52.js.map → spec-renderer-ZSIVMKVE.js.map} +1 -1
- package/dist/tanstack-start.js +1 -1
- package/dist/ui.js +1 -1
- package/dist/user-nav-ZH63YHX7.js +2 -0
- package/dist/{user-nav-OWTTAXZS.js.map → user-nav-ZH63YHX7.js.map} +1 -1
- package/package.json +4 -4
- package/dist/activity-nav-button-E4I4YC3X.js +0 -2
- package/dist/chat-page-JS5SJ4OG.js +0 -4
- package/dist/chunk-2NXQF2F7.js +0 -2
- package/dist/chunk-32ZU4MLE.js +0 -2
- package/dist/chunk-32ZU4MLE.js.map +0 -1
- package/dist/chunk-54AXLGAK.js +0 -2
- package/dist/chunk-57X5WRMY.js +0 -2
- package/dist/chunk-5LGIALCK.js +0 -2
- package/dist/chunk-5NQ47SWN.js +0 -7
- package/dist/chunk-6NRQMG26.js +0 -2
- package/dist/chunk-6NRQMG26.js.map +0 -1
- package/dist/chunk-AKQ6ELDX.js +0 -2
- package/dist/chunk-AKQ6ELDX.js.map +0 -1
- package/dist/chunk-DGIY4SKN.js +0 -7
- package/dist/chunk-DGIY4SKN.js.map +0 -1
- package/dist/chunk-GQTWNWT7.js +0 -2
- package/dist/chunk-HDOIOXMP.js +0 -2
- package/dist/chunk-HDOIOXMP.js.map +0 -1
- package/dist/chunk-LF4B2TQI.js +0 -10
- package/dist/chunk-LF4B2TQI.js.map +0 -1
- package/dist/chunk-O2QMYUPS.js +0 -2
- package/dist/chunk-O2QMYUPS.js.map +0 -1
- package/dist/chunk-OMYDXVWS.js +0 -4
- package/dist/chunk-W74OKBZG.js +0 -2
- package/dist/chunk-WPCPL2TQ.js +0 -3
- package/dist/chunk-WPCPL2TQ.js.map +0 -1
- package/dist/chunk-XLFAJBPN.js +0 -3
- package/dist/chunk-XLFAJBPN.js.map +0 -1
- package/dist/list-EWWRLK4I.js +0 -3
- package/dist/list-R7SJFXCX.js +0 -2
- package/dist/pages-UKJWXOMO.js +0 -5
- package/dist/pages-UKJWXOMO.js.map +0 -1
- package/dist/plugin-pages-X3V2VPAU.js +0 -2
- package/dist/project-selector-72VM6SUI.js +0 -2
- package/dist/project-selector-72VM6SUI.js.map +0 -1
- package/dist/record-links-VH2TPCK4.js +0 -2
- package/dist/root-4QRY7KAC.js +0 -14
- package/dist/root-7YXE6DEA.js +0 -23
- package/dist/root-FNXHGVQT.js +0 -2
- package/dist/root-HQQ4TNTR.js +0 -2
- package/dist/root-NYAXP66A.js +0 -31
- package/dist/root-OJ4UFMRX.js +0 -2
- package/dist/search-LSIHN6OI.js +0 -2
- package/dist/skills-pages-W47HECK3.js +0 -2
- package/dist/source-3N7BQVYO.js +0 -2
- package/dist/spec-renderer-3GAVSV52.js +0 -2
- package/dist/user-nav-OWTTAXZS.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import'./index.css';import {f as f$1}from'./chunk-
|
|
2
|
-
`)}function er(r,e){return r?C(r).some(t=>t.includes(`Cannot query field "${e}"`)):false}function C(r){if(CombinedGraphQLErrors.is(r))return r.errors.filter(y).map(({message:o})=>o);let e=L(r);if(e&&a(e))return [e];let t=f(r);if(t?.statusCode!==400)return [];let n=d(t.bodyText)??P(t)??b(r);return n?Array.isArray(n.errors)?n.errors.filter(y).map(o=>o.message):typeof n.message=="string"&&a(n.message)?[n.message]:typeof n.error=="string"&&a(n.error)?[n.error]:[]:[]}function P(r){let{result:e}=r;return !e||typeof e!="object"?null:e}function b(r){if(!A(r))return null;let{cause:e}=r,t=L(e);if(t&&a(t))return {message:t};if(!e||typeof e!="object")return null;let{result:n}=e;return n&&typeof n=="object"?n:null}function y(r){if(!r||typeof r!="object")return false;let{extensions:e,message:t}=r;return e?.code==="GRAPHQL_VALIDATION_FAILED"&&typeof t=="string"?true:typeof t=="string"&&a(t)}function a(r){return r.startsWith("Cannot query field ")||r.startsWith("Unknown type ")||r.startsWith('Cannot query field "')||r.includes("GRAPHQL_VALIDATION_FAILED")}function I(r){return /Cannot query field "[_A-Za-z][_0-9A-Za-z]*Total" on type "Query"/.test(r)}var U=ApolloProvider,v=createContext(void 0);function pr(){let r=useContext(v);if(!r)throw new Error("useGraphQLError must be used within GraphQLProvider");return r}var fr={userQuery:true};function H(r){return new ErrorLink(({error:e,operation:t})=>{if(t.getContext().userQuery===true)return;let n=k(e);if(n){r(n);return}CombinedGraphQLErrors.is(e)?e.errors.forEach(({message:s,locations:i,path:c})=>{console.warn(`[GraphQL error]: Message: ${s}, Location: ${i}, Path: ${c}`);}):CombinedProtocolErrors.is(e)&&e.errors.forEach(({message:s,extensions:i})=>{console.warn(`[Protocol error]: Message: ${s}, Extensions: ${JSON.stringify(i)}`);});let o=f(e);if(o?.statusCode===400){let s=d(o.bodyText),i=null;if(s&&typeof s=="object"){let{error:c,errors:g,message:E}=s;if(typeof E=="string")i=E;else if(Array.isArray(g)){let[p]=g;if(p&&typeof p.message=="string"){let{message:D}=p;i=D;}}else typeof c=="string"?i=c:i=JSON.stringify(s);}else i=o.bodyText;r(i??"There is an error in the deployed Flexkit schema. Fix flexkit.config.ts and run flexkit deploy.");}if(o){console.warn(`[Network error]: ${o.message}`);return}e&&console.warn(`[Network error]: ${e.message}`);})}function z(r,e){return from([H(e),new HttpLink({uri:`/api/flexkit/${r}/graphql`})])}function Z(r,e){return new ApolloClient({link:z(r??"",e),cache:new InMemoryCache({dataIdFromObject:t=>t._id?t._id:defaultDataIdFromObject(t)})})}function dr({children:r}){let{currentProjectId:e}=f$1(),[t,n]=useState(null),o=useMemo(()=>({schemaErrorMessage:t,setSchemaErrorMessage:n}),[t]),s=useMemo(()=>Z(e,n),[e]);return jsx(v.Provider,{value:o,children:jsx(U,{client:s,children:r})})}var G=createContext([]),M=createContext(()=>{});function K(r,e){let t=e.type;switch(e._id||(e._id=Date.now().toString()),t){case "DeleteEntity":return uniqBy(props(["type","_id"]),[...r,e]);case "AddEntity":return uniqBy(props(["type","_id"]),[...r,e]);case "EditEntity":return uniqBy(props(["type","_id"]),[...r,e]);case "EditRelationship":return uniqBy(props(["type","_id"]),[...r,e]);case "AlertDialog":return uniqBy(props(["type","_id"]),[...r,e]);case "Dismiss":return r.filter(n=>n._id!==e._id);default:throw Error(`Unknown action: ${t}`)}}function yr({children:r}){let[e,t]=useReducer(K,[]);return jsx(G.Provider,{value:e,children:jsx(M.Provider,{value:t,children:r})})}function Ar(){return useContext(G)}function Lr(){return useContext(M)}export{f as a,d as b,k as c,er as d,pr as e,fr as f,dr as g,yr as h,Ar as i,Lr as j};//# sourceMappingURL=chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import'./index.css';import {f as f$1}from'./chunk-6I7D2JBA.js';import {ApolloClient,InMemoryCache,defaultDataIdFromObject,from,HttpLink}from'@apollo/client';import {ApolloProvider}from'@apollo/client/react';import {ErrorLink}from'@apollo/client/link/error';import {ServerError,CombinedGraphQLErrors,CombinedProtocolErrors}from'@apollo/client/errors';import {createContext,useContext,useState,useMemo,useReducer}from'react';import {jsx}from'react/jsx-runtime';import {uniqBy,props}from'ramda';function A(r){return r?"cause"in r:false}function f(r){if(!r)return null;if(ServerError.is(r))return r;if(A(r)){let e=r.cause;if(ServerError.is(e))return e}return null}function L(r){if(!r||typeof r!="object")return null;let{message:e}=r;return typeof e=="string"?e:null}function d(r){if(!r)return null;try{return JSON.parse(r)}catch{return null}}function k(r){if(!r)return null;let e=C(r).filter(t=>!I(t));return e.length===0?null:["The deployed schema is out of sync with your local Flexkit schema.","Run `flexkit deploy` using the CLI to apply your latest schema changes.",...e.map(t=>`- ${t}`)].join(`
|
|
2
|
+
`)}function er(r,e){return r?C(r).some(t=>t.includes(`Cannot query field "${e}"`)):false}function C(r){if(CombinedGraphQLErrors.is(r))return r.errors.filter(y).map(({message:o})=>o);let e=L(r);if(e&&a(e))return [e];let t=f(r);if(t?.statusCode!==400)return [];let n=d(t.bodyText)??P(t)??b(r);return n?Array.isArray(n.errors)?n.errors.filter(y).map(o=>o.message):typeof n.message=="string"&&a(n.message)?[n.message]:typeof n.error=="string"&&a(n.error)?[n.error]:[]:[]}function P(r){let{result:e}=r;return !e||typeof e!="object"?null:e}function b(r){if(!A(r))return null;let{cause:e}=r,t=L(e);if(t&&a(t))return {message:t};if(!e||typeof e!="object")return null;let{result:n}=e;return n&&typeof n=="object"?n:null}function y(r){if(!r||typeof r!="object")return false;let{extensions:e,message:t}=r;return e?.code==="GRAPHQL_VALIDATION_FAILED"&&typeof t=="string"?true:typeof t=="string"&&a(t)}function a(r){return r.startsWith("Cannot query field ")||r.startsWith("Unknown type ")||r.startsWith('Cannot query field "')||r.includes("GRAPHQL_VALIDATION_FAILED")}function I(r){return /Cannot query field "[_A-Za-z][_0-9A-Za-z]*Total" on type "Query"/.test(r)}var U=ApolloProvider,v=createContext(void 0);function pr(){let r=useContext(v);if(!r)throw new Error("useGraphQLError must be used within GraphQLProvider");return r}var fr={userQuery:true};function H(r){return new ErrorLink(({error:e,operation:t})=>{if(t.getContext().userQuery===true)return;let n=k(e);if(n){r(n);return}CombinedGraphQLErrors.is(e)?e.errors.forEach(({message:s,locations:i,path:c})=>{console.warn(`[GraphQL error]: Message: ${s}, Location: ${i}, Path: ${c}`);}):CombinedProtocolErrors.is(e)&&e.errors.forEach(({message:s,extensions:i})=>{console.warn(`[Protocol error]: Message: ${s}, Extensions: ${JSON.stringify(i)}`);});let o=f(e);if(o?.statusCode===400){let s=d(o.bodyText),i=null;if(s&&typeof s=="object"){let{error:c,errors:g,message:E}=s;if(typeof E=="string")i=E;else if(Array.isArray(g)){let[p]=g;if(p&&typeof p.message=="string"){let{message:D}=p;i=D;}}else typeof c=="string"?i=c:i=JSON.stringify(s);}else i=o.bodyText;r(i??"There is an error in the deployed Flexkit schema. Fix flexkit.config.ts and run flexkit deploy.");}if(o){console.warn(`[Network error]: ${o.message}`);return}e&&console.warn(`[Network error]: ${e.message}`);})}function z(r,e){return from([H(e),new HttpLink({uri:`/api/flexkit/${r}/graphql`})])}function Z(r,e){return new ApolloClient({link:z(r??"",e),cache:new InMemoryCache({dataIdFromObject:t=>t._id?t._id:defaultDataIdFromObject(t)})})}function dr({children:r}){let{currentProjectId:e}=f$1(),[t,n]=useState(null),o=useMemo(()=>({schemaErrorMessage:t,setSchemaErrorMessage:n}),[t]),s=useMemo(()=>Z(e,n),[e]);return jsx(v.Provider,{value:o,children:jsx(U,{client:s,children:r})})}var G=createContext([]),M=createContext(()=>{});function K(r,e){let t=e.type;switch(e._id||(e._id=Date.now().toString()),t){case "DeleteEntity":return uniqBy(props(["type","_id"]),[...r,e]);case "AddEntity":return uniqBy(props(["type","_id"]),[...r,e]);case "EditEntity":return uniqBy(props(["type","_id"]),[...r,e]);case "EditRelationship":return uniqBy(props(["type","_id"]),[...r,e]);case "AlertDialog":return uniqBy(props(["type","_id"]),[...r,e]);case "Dismiss":return r.filter(n=>n._id!==e._id);default:throw Error(`Unknown action: ${t}`)}}function yr({children:r}){let[e,t]=useReducer(K,[]);return jsx(G.Provider,{value:e,children:jsx(M.Provider,{value:t,children:r})})}function Ar(){return useContext(G)}function Lr(){return useContext(M)}export{f as a,d as b,k as c,er as d,pr as e,fr as f,dr as g,yr as h,Ar as i,Lr as j};//# sourceMappingURL=chunk-YKM3FUGK.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-YKM3FUGK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphql-client/error-utils.ts","../src/graphql-client/graphql-context.tsx","../src/entities/actions-context.tsx"],"names":["hasCause","error","getServerError","ServerError","possibleServerError","getErrorMessage","message","parseErrorBody","bodyText","getGraphQLSchemaMismatchMessage","messages","getGraphQLValidationMessages","isMissingCountStoreFieldMessage","isMissingGraphQLFieldError","fieldName","CombinedGraphQLErrors","isSchemaValidationError","directMessage","isSchemaValidationMessage","serverError","responseBody","getServerErrorResult","getErrorCauseResponse","item","result","cause","causeMessage","extensions","ApolloProviderCompat","ApolloProvider","GraphQLErrorContext","createContext","useGraphQLError","ctx","useContext","USER_QUERY_CONTEXT","createErrorLink","setSchemaErrorMessage","ErrorLink","operation","schemaMismatchMessage","locations","path","CombinedProtocolErrors","responseError","errors","responseMessage","firstError","firstErrorMessage","additiveLink","currentProjectId","from","HttpLink","client","ApolloClient","InMemoryCache","responseObject","defaultDataIdFromObject","GraphQLProvider","children","useConfig","schemaErrorMessage","useState","useMemo","apolloClient","jsx","ActionsContext","EntityDispatchContext","actionsReducer","actions","action","actionType","uniqBy","props","ActionsProvider","entityActions","dispatchEntityActions","useReducer","useActions","useDispatch"],"mappings":"4eAsBA,SAASA,CAAAA,CAASC,EAA2C,CAC3D,OAAKA,EAIE,OAAA,GAAYA,CAAAA,CAHV,KAIX,CAEO,SAASC,CAAAA,CAAeD,CAAAA,CAAuC,CACpE,GAAI,CAACA,CAAAA,CACH,OAAO,IAAA,CAGT,GAAIE,YAAY,EAAA,CAAGF,CAAK,EACtB,OAAOA,CAAAA,CAGT,GAA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,OAAO7C,UAAAA,CAAWiC,CAAqB,CACzC","file":"chunk-GXQSNOGM.js","sourcesContent":["import type { ErrorLike } from '@apollo/client';\nimport { CombinedGraphQLErrors, ServerError } from '@apollo/client/errors';\n\ntype ErrorWithCause = ErrorLike & { cause?: unknown };\ntype ErrorWithMessage = {\n message?: unknown;\n};\ntype ServerErrorWithResult = ServerError & {\n result?: unknown;\n};\ntype GraphQLErrorResponse = {\n error?: unknown;\n errors?: unknown;\n message?: unknown;\n};\ntype GraphQLErrorItem = {\n extensions?: {\n code?: unknown;\n };\n message?: unknown;\n};\n\nfunction hasCause(error: ErrorLike): error is ErrorWithCause {\n if (!error) {\n return false;\n }\n\n return 'cause' in (error as ErrorWithCause);\n}\n\nexport function getServerError(error?: ErrorLike): ServerError | null {\n if (!error) {\n return null;\n }\n\n if (ServerError.is(error)) {\n return error;\n }\n\n if (hasCause(error)) {\n const possibleServerError = error.cause;\n\n if (ServerError.is(possibleServerError)) {\n return possibleServerError;\n }\n }\n\n return null;\n}\n\nfunction getErrorMessage(error: unknown): string | null {\n if (!error || typeof error !== 'object') {\n return null;\n }\n\n const { message } = error as ErrorWithMessage;\n\n return typeof message === 'string' ? message : null;\n}\n\nexport function parseErrorBody<T>(bodyText: string | undefined): T | null {\n if (!bodyText) {\n return null;\n }\n\n try {\n return JSON.parse(bodyText) as T;\n } catch {\n return null;\n }\n}\n\nexport function getGraphQLSchemaMismatchMessage(error?: ErrorLike): string | null {\n if (!error) {\n return null;\n }\n\n const messages = getGraphQLValidationMessages(error).filter((message) => !isMissingCountStoreFieldMessage(message));\n\n if (messages.length === 0) {\n return null;\n }\n\n return [\n 'The deployed schema is out of sync with your local Flexkit schema.',\n 'Run `flexkit deploy` using the CLI to apply your latest schema changes.',\n ...messages.map((message) => `- ${message}`),\n ].join('\\n');\n}\n\nexport function isMissingGraphQLFieldError(error: ErrorLike | undefined, fieldName: string): boolean {\n if (!error) {\n return false;\n }\n\n return getGraphQLValidationMessages(error).some((message) => {\n return message.includes(`Cannot query field \"${fieldName}\"`);\n });\n}\n\nfunction getGraphQLValidationMessages(error: ErrorLike): string[] {\n if (CombinedGraphQLErrors.is(error)) {\n return error.errors.filter(isSchemaValidationError).map(({ message }) => message);\n }\n\n const directMessage = getErrorMessage(error);\n\n if (directMessage && isSchemaValidationMessage(directMessage)) {\n return [directMessage];\n }\n\n const serverError = getServerError(error);\n\n if (serverError?.statusCode !== 400) {\n return [];\n }\n\n const responseBody =\n parseErrorBody<GraphQLErrorResponse>(serverError.bodyText) ??\n getServerErrorResult(serverError) ??\n getErrorCauseResponse(error);\n\n if (!responseBody) {\n return [];\n }\n\n if (Array.isArray(responseBody.errors)) {\n return responseBody.errors.filter(isSchemaValidationError).map((item) => item.message);\n }\n\n if (typeof responseBody.message === 'string' && isSchemaValidationMessage(responseBody.message)) {\n return [responseBody.message];\n }\n\n if (typeof responseBody.error === 'string' && isSchemaValidationMessage(responseBody.error)) {\n return [responseBody.error];\n }\n\n return [];\n}\n\nfunction getServerErrorResult(serverError: ServerError): GraphQLErrorResponse | null {\n const { result } = serverError as ServerErrorWithResult;\n\n if (!result || typeof result !== 'object') {\n return null;\n }\n\n return result as GraphQLErrorResponse;\n}\n\nfunction getErrorCauseResponse(error: ErrorLike): GraphQLErrorResponse | null {\n if (!hasCause(error)) {\n return null;\n }\n\n const { cause } = error;\n const causeMessage = getErrorMessage(cause);\n\n if (causeMessage && isSchemaValidationMessage(causeMessage)) {\n return { message: causeMessage };\n }\n\n if (!cause || typeof cause !== 'object') {\n return null;\n }\n\n const { result } = cause as { result?: unknown };\n\n if (result && typeof result === 'object') {\n return result as GraphQLErrorResponse;\n }\n\n return null;\n}\n\nfunction isSchemaValidationError(error: unknown): error is GraphQLErrorItem & { message: string } {\n if (!error || typeof error !== 'object') {\n return false;\n }\n\n const { extensions, message } = error as GraphQLErrorItem;\n const code = extensions?.code;\n\n if (code === 'GRAPHQL_VALIDATION_FAILED' && typeof message === 'string') {\n return true;\n }\n\n return typeof message === 'string' && isSchemaValidationMessage(message);\n}\n\nfunction isSchemaValidationMessage(message: string): boolean {\n return (\n message.startsWith('Cannot query field ') ||\n message.startsWith('Unknown type ') ||\n message.startsWith('Cannot query field \"') ||\n message.includes('GRAPHQL_VALIDATION_FAILED')\n );\n}\n\nfunction isMissingCountStoreFieldMessage(message: string): boolean {\n return /Cannot query field \"[_A-Za-z][_0-9A-Za-z]*Total\" on type \"Query\"/.test(message);\n}\n","'use client';\n\nimport type { JSX } from 'react';\nimport { ApolloClient, InMemoryCache, defaultDataIdFromObject, from, HttpLink } from '@apollo/client';\nimport type { ApolloLink } from '@apollo/client';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { ErrorLink } from '@apollo/client/link/error';\nimport { CombinedGraphQLErrors, CombinedProtocolErrors } from '@apollo/client/errors';\nimport { getGraphQLSchemaMismatchMessage, getServerError, parseErrorBody } from './error-utils';\nimport { useConfig } from '../core/config/config-context';\nimport React, { createContext, useContext, useMemo, useState } from 'react';\n\nconst ApolloProviderCompat = ApolloProvider as unknown as React.ComponentType<{\n children?: React.ReactNode;\n client: ApolloClient;\n}>;\n\ntype GraphQLErrorContextValue = {\n schemaErrorMessage: string | null;\n setSchemaErrorMessage: React.Dispatch<React.SetStateAction<string | null>>;\n};\n\nconst GraphQLErrorContext = createContext<GraphQLErrorContextValue | undefined>(undefined);\n\nfunction useGraphQLError(): GraphQLErrorContextValue {\n const ctx = useContext(GraphQLErrorContext);\n\n if (!ctx) {\n throw new Error('useGraphQLError must be used within GraphQLProvider');\n }\n\n return ctx;\n}\n\n/**\n * Context flag for operations the user writes themselves (the Graph app's\n * Query view): any error there, a mismatch or a 400, is a typo, not a\n * deployment that drifted from the local schema, so it must not raise the\n * schema banner. The caller shows the error itself.\n */\nexport const USER_QUERY_CONTEXT = { userQuery: true } as const;\n\nfunction createErrorLink(setSchemaErrorMessage: (msg: string | null) => void): ApolloLink {\n return new ErrorLink(({ error, operation }) => {\n if (operation.getContext().userQuery === true) {\n return;\n }\n\n const schemaMismatchMessage = getGraphQLSchemaMismatchMessage(error);\n\n if (schemaMismatchMessage) {\n setSchemaErrorMessage(schemaMismatchMessage);\n\n return;\n }\n\n if (CombinedGraphQLErrors.is(error)) {\n error.errors.forEach(({ message, locations, path }) => {\n console.warn(`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`);\n });\n } else if (CombinedProtocolErrors.is(error)) {\n error.errors.forEach(({ message, extensions }) => {\n console.warn(`[Protocol error]: Message: ${message}, Extensions: ${JSON.stringify(extensions)}`);\n });\n }\n\n const serverError = getServerError(error);\n\n if (serverError?.statusCode === 400) {\n const responseBody = parseErrorBody<Record<string, unknown>>(serverError.bodyText);\n let message: string | null = null;\n\n if (responseBody && typeof responseBody === 'object') {\n const {\n error: responseError,\n errors,\n message: responseMessage,\n } = responseBody as {\n error?: unknown;\n errors?: unknown;\n message?: unknown;\n };\n\n if (typeof responseMessage === 'string') {\n message = responseMessage;\n } else if (Array.isArray(errors)) {\n const [firstError] = errors as { message?: unknown }[];\n\n if (firstError && typeof firstError.message === 'string') {\n const { message: firstErrorMessage } = firstError;\n message = firstErrorMessage;\n }\n } else if (typeof responseError === 'string') {\n message = responseError;\n } else {\n message = JSON.stringify(responseBody);\n }\n } else {\n message = serverError.bodyText;\n }\n\n setSchemaErrorMessage(\n message ?? 'There is an error in the deployed Flexkit schema. Fix flexkit.config.ts and run flexkit deploy.'\n );\n }\n\n if (serverError) {\n console.warn(`[Network error]: ${serverError.message}`);\n\n return;\n }\n\n if (error) {\n console.warn(`[Network error]: ${error.message}`);\n }\n });\n}\n\nfunction additiveLink(currentProjectId: string, setSchemaErrorMessage: (msg: string | null) => void): ApolloLink {\n return from([\n createErrorLink(setSchemaErrorMessage),\n new HttpLink({ uri: `/api/flexkit/${currentProjectId}/graphql` }),\n ]);\n}\n\nfunction client(\n currentProjectId: string | undefined,\n setSchemaErrorMessage: (msg: string | null) => void\n): ApolloClient {\n return new ApolloClient({\n link: additiveLink(currentProjectId ?? '', setSchemaErrorMessage),\n cache: new InMemoryCache({\n dataIdFromObject: (responseObject) => {\n return responseObject._id ? (responseObject._id as string) : defaultDataIdFromObject(responseObject);\n },\n }),\n });\n}\n\nexport function GraphQLProvider({ children }: { children: React.ReactNode }): JSX.Element {\n const { currentProjectId } = useConfig();\n const [schemaErrorMessage, setSchemaErrorMessage] = useState<string | null>(null);\n const ctx = useMemo(() => ({ schemaErrorMessage, setSchemaErrorMessage }), [schemaErrorMessage]);\n const apolloClient = useMemo(() => client(currentProjectId, setSchemaErrorMessage), [currentProjectId]);\n\n return (\n <GraphQLErrorContext.Provider value={ctx}>\n <ApolloProviderCompat client={apolloClient}>{children}</ApolloProviderCompat>\n </GraphQLErrorContext.Provider>\n );\n}\n\nexport { useGraphQLError };\n","'use client';\n\nimport { createContext, useContext, useReducer } from 'react';\nimport type { Dispatch, JSX, ReactNode } from 'react';\nimport { props, uniqBy } from 'ramda';\nimport type {\n Action,\n ActionAddEntity,\n ActionAlertDialog,\n ActionDeleteEntity,\n ActionEditEntity,\n ActionEditRelationship,\n} from './types';\n\nconst ActionsContext = createContext<Action[] | []>([]);\nconst EntityDispatchContext = createContext<Dispatch<Action>>(() => undefined);\n\nfunction actionsReducer(actions: Action[], action: Action): Action[] {\n const actionType = action.type;\n\n if (!action._id) {\n action._id = Date.now().toString();\n }\n\n switch (actionType) {\n case 'DeleteEntity': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionDeleteEntity[]), action]);\n }\n case 'AddEntity': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionAddEntity[]), action]);\n }\n case 'EditEntity': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionEditEntity[]), action]);\n }\n case 'EditRelationship': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionEditRelationship[]), action]);\n }\n case 'AlertDialog': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionAlertDialog[]), action]);\n }\n case 'Dismiss': {\n return actions.filter((item) => item._id !== action._id);\n }\n default: {\n throw Error(`Unknown action: ${actionType as string}`);\n }\n }\n}\n\nfunction ActionsProvider({ children }: { children: ReactNode }): JSX.Element {\n const [entityActions, dispatchEntityActions] = useReducer(actionsReducer, []);\n\n return (\n <ActionsContext.Provider value={entityActions}>\n <EntityDispatchContext.Provider value={dispatchEntityActions}>{children}</EntityDispatchContext.Provider>\n </ActionsContext.Provider>\n );\n}\n\nfunction useActions(): Action[] {\n return useContext(ActionsContext);\n}\n\nfunction useDispatch(): Dispatch<Action> {\n return useContext(EntityDispatchContext);\n}\n\nexport { ActionsProvider, useActions, useDispatch };\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graphql-client/error-utils.ts","../src/graphql-client/graphql-context.tsx","../src/entities/actions-context.tsx"],"names":["hasCause","error","getServerError","ServerError","possibleServerError","getErrorMessage","message","parseErrorBody","bodyText","getGraphQLSchemaMismatchMessage","messages","getGraphQLValidationMessages","isMissingCountStoreFieldMessage","isMissingGraphQLFieldError","fieldName","CombinedGraphQLErrors","isSchemaValidationError","directMessage","isSchemaValidationMessage","serverError","responseBody","getServerErrorResult","getErrorCauseResponse","item","result","cause","causeMessage","extensions","ApolloProviderCompat","ApolloProvider","GraphQLErrorContext","createContext","useGraphQLError","ctx","useContext","USER_QUERY_CONTEXT","createErrorLink","setSchemaErrorMessage","ErrorLink","operation","schemaMismatchMessage","locations","path","CombinedProtocolErrors","responseError","errors","responseMessage","firstError","firstErrorMessage","additiveLink","currentProjectId","from","HttpLink","client","ApolloClient","InMemoryCache","responseObject","defaultDataIdFromObject","GraphQLProvider","children","useConfig","schemaErrorMessage","useState","useMemo","apolloClient","jsx","ActionsContext","EntityDispatchContext","actionsReducer","actions","action","actionType","uniqBy","props","ActionsProvider","entityActions","dispatchEntityActions","useReducer","useActions","useDispatch"],"mappings":"4eAsBA,SAASA,CAAAA,CAASC,EAA2C,CAC3D,OAAKA,EAIE,OAAA,GAAYA,CAAAA,CAHV,KAIX,CAEO,SAASC,CAAAA,CAAeD,CAAAA,CAAuC,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,CAC1E,CAEJ,CAEA,SAASmB,EAAAA,EAAuB,CAC9B,OAAO5C,UAAAA,CAAWgC,CAAc,CAClC,CAEA,SAASa,IAAgC,CACvC,OAAO7C,UAAAA,CAAWiC,CAAqB,CACzC","file":"chunk-YKM3FUGK.js","sourcesContent":["import type { ErrorLike } from '@apollo/client';\nimport { CombinedGraphQLErrors, ServerError } from '@apollo/client/errors';\n\ntype ErrorWithCause = ErrorLike & { cause?: unknown };\ntype ErrorWithMessage = {\n message?: unknown;\n};\ntype ServerErrorWithResult = ServerError & {\n result?: unknown;\n};\ntype GraphQLErrorResponse = {\n error?: unknown;\n errors?: unknown;\n message?: unknown;\n};\ntype GraphQLErrorItem = {\n extensions?: {\n code?: unknown;\n };\n message?: unknown;\n};\n\nfunction hasCause(error: ErrorLike): error is ErrorWithCause {\n if (!error) {\n return false;\n }\n\n return 'cause' in (error as ErrorWithCause);\n}\n\nexport function getServerError(error?: ErrorLike): ServerError | null {\n if (!error) {\n return null;\n }\n\n if (ServerError.is(error)) {\n return error;\n }\n\n if (hasCause(error)) {\n const possibleServerError = error.cause;\n\n if (ServerError.is(possibleServerError)) {\n return possibleServerError;\n }\n }\n\n return null;\n}\n\nfunction getErrorMessage(error: unknown): string | null {\n if (!error || typeof error !== 'object') {\n return null;\n }\n\n const { message } = error as ErrorWithMessage;\n\n return typeof message === 'string' ? message : null;\n}\n\nexport function parseErrorBody<T>(bodyText: string | undefined): T | null {\n if (!bodyText) {\n return null;\n }\n\n try {\n return JSON.parse(bodyText) as T;\n } catch {\n return null;\n }\n}\n\nexport function getGraphQLSchemaMismatchMessage(error?: ErrorLike): string | null {\n if (!error) {\n return null;\n }\n\n const messages = getGraphQLValidationMessages(error).filter((message) => !isMissingCountStoreFieldMessage(message));\n\n if (messages.length === 0) {\n return null;\n }\n\n return [\n 'The deployed schema is out of sync with your local Flexkit schema.',\n 'Run `flexkit deploy` using the CLI to apply your latest schema changes.',\n ...messages.map((message) => `- ${message}`),\n ].join('\\n');\n}\n\nexport function isMissingGraphQLFieldError(error: ErrorLike | undefined, fieldName: string): boolean {\n if (!error) {\n return false;\n }\n\n return getGraphQLValidationMessages(error).some((message) => {\n return message.includes(`Cannot query field \"${fieldName}\"`);\n });\n}\n\nfunction getGraphQLValidationMessages(error: ErrorLike): string[] {\n if (CombinedGraphQLErrors.is(error)) {\n return error.errors.filter(isSchemaValidationError).map(({ message }) => message);\n }\n\n const directMessage = getErrorMessage(error);\n\n if (directMessage && isSchemaValidationMessage(directMessage)) {\n return [directMessage];\n }\n\n const serverError = getServerError(error);\n\n if (serverError?.statusCode !== 400) {\n return [];\n }\n\n const responseBody =\n parseErrorBody<GraphQLErrorResponse>(serverError.bodyText) ??\n getServerErrorResult(serverError) ??\n getErrorCauseResponse(error);\n\n if (!responseBody) {\n return [];\n }\n\n if (Array.isArray(responseBody.errors)) {\n return responseBody.errors.filter(isSchemaValidationError).map((item) => item.message);\n }\n\n if (typeof responseBody.message === 'string' && isSchemaValidationMessage(responseBody.message)) {\n return [responseBody.message];\n }\n\n if (typeof responseBody.error === 'string' && isSchemaValidationMessage(responseBody.error)) {\n return [responseBody.error];\n }\n\n return [];\n}\n\nfunction getServerErrorResult(serverError: ServerError): GraphQLErrorResponse | null {\n const { result } = serverError as ServerErrorWithResult;\n\n if (!result || typeof result !== 'object') {\n return null;\n }\n\n return result as GraphQLErrorResponse;\n}\n\nfunction getErrorCauseResponse(error: ErrorLike): GraphQLErrorResponse | null {\n if (!hasCause(error)) {\n return null;\n }\n\n const { cause } = error;\n const causeMessage = getErrorMessage(cause);\n\n if (causeMessage && isSchemaValidationMessage(causeMessage)) {\n return { message: causeMessage };\n }\n\n if (!cause || typeof cause !== 'object') {\n return null;\n }\n\n const { result } = cause as { result?: unknown };\n\n if (result && typeof result === 'object') {\n return result as GraphQLErrorResponse;\n }\n\n return null;\n}\n\nfunction isSchemaValidationError(error: unknown): error is GraphQLErrorItem & { message: string } {\n if (!error || typeof error !== 'object') {\n return false;\n }\n\n const { extensions, message } = error as GraphQLErrorItem;\n const code = extensions?.code;\n\n if (code === 'GRAPHQL_VALIDATION_FAILED' && typeof message === 'string') {\n return true;\n }\n\n return typeof message === 'string' && isSchemaValidationMessage(message);\n}\n\nfunction isSchemaValidationMessage(message: string): boolean {\n return (\n message.startsWith('Cannot query field ') ||\n message.startsWith('Unknown type ') ||\n message.startsWith('Cannot query field \"') ||\n message.includes('GRAPHQL_VALIDATION_FAILED')\n );\n}\n\nfunction isMissingCountStoreFieldMessage(message: string): boolean {\n return /Cannot query field \"[_A-Za-z][_0-9A-Za-z]*Total\" on type \"Query\"/.test(message);\n}\n","'use client';\n\nimport type { JSX } from 'react';\nimport { ApolloClient, InMemoryCache, defaultDataIdFromObject, from, HttpLink } from '@apollo/client';\nimport type { ApolloLink } from '@apollo/client';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { ErrorLink } from '@apollo/client/link/error';\nimport { CombinedGraphQLErrors, CombinedProtocolErrors } from '@apollo/client/errors';\nimport { getGraphQLSchemaMismatchMessage, getServerError, parseErrorBody } from './error-utils';\nimport { useConfig } from '../core/config/config-context';\nimport React, { createContext, useContext, useMemo, useState } from 'react';\n\nconst ApolloProviderCompat = ApolloProvider as unknown as React.ComponentType<{\n children?: React.ReactNode;\n client: ApolloClient;\n}>;\n\ntype GraphQLErrorContextValue = {\n schemaErrorMessage: string | null;\n setSchemaErrorMessage: React.Dispatch<React.SetStateAction<string | null>>;\n};\n\nconst GraphQLErrorContext = createContext<GraphQLErrorContextValue | undefined>(undefined);\n\nfunction useGraphQLError(): GraphQLErrorContextValue {\n const ctx = useContext(GraphQLErrorContext);\n\n if (!ctx) {\n throw new Error('useGraphQLError must be used within GraphQLProvider');\n }\n\n return ctx;\n}\n\n/**\n * Context flag for operations the user writes themselves (the Graph app's\n * Query view): any error there, a mismatch or a 400, is a typo, not a\n * deployment that drifted from the local schema, so it must not raise the\n * schema banner. The caller shows the error itself.\n */\nexport const USER_QUERY_CONTEXT = { userQuery: true } as const;\n\nfunction createErrorLink(setSchemaErrorMessage: (msg: string | null) => void): ApolloLink {\n return new ErrorLink(({ error, operation }) => {\n if (operation.getContext().userQuery === true) {\n return;\n }\n\n const schemaMismatchMessage = getGraphQLSchemaMismatchMessage(error);\n\n if (schemaMismatchMessage) {\n setSchemaErrorMessage(schemaMismatchMessage);\n\n return;\n }\n\n if (CombinedGraphQLErrors.is(error)) {\n error.errors.forEach(({ message, locations, path }) => {\n console.warn(`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`);\n });\n } else if (CombinedProtocolErrors.is(error)) {\n error.errors.forEach(({ message, extensions }) => {\n console.warn(`[Protocol error]: Message: ${message}, Extensions: ${JSON.stringify(extensions)}`);\n });\n }\n\n const serverError = getServerError(error);\n\n if (serverError?.statusCode === 400) {\n const responseBody = parseErrorBody<Record<string, unknown>>(serverError.bodyText);\n let message: string | null = null;\n\n if (responseBody && typeof responseBody === 'object') {\n const {\n error: responseError,\n errors,\n message: responseMessage,\n } = responseBody as {\n error?: unknown;\n errors?: unknown;\n message?: unknown;\n };\n\n if (typeof responseMessage === 'string') {\n message = responseMessage;\n } else if (Array.isArray(errors)) {\n const [firstError] = errors as { message?: unknown }[];\n\n if (firstError && typeof firstError.message === 'string') {\n const { message: firstErrorMessage } = firstError;\n message = firstErrorMessage;\n }\n } else if (typeof responseError === 'string') {\n message = responseError;\n } else {\n message = JSON.stringify(responseBody);\n }\n } else {\n message = serverError.bodyText;\n }\n\n setSchemaErrorMessage(\n message ?? 'There is an error in the deployed Flexkit schema. Fix flexkit.config.ts and run flexkit deploy.'\n );\n }\n\n if (serverError) {\n console.warn(`[Network error]: ${serverError.message}`);\n\n return;\n }\n\n if (error) {\n console.warn(`[Network error]: ${error.message}`);\n }\n });\n}\n\nfunction additiveLink(currentProjectId: string, setSchemaErrorMessage: (msg: string | null) => void): ApolloLink {\n return from([\n createErrorLink(setSchemaErrorMessage),\n new HttpLink({ uri: `/api/flexkit/${currentProjectId}/graphql` }),\n ]);\n}\n\nfunction client(\n currentProjectId: string | undefined,\n setSchemaErrorMessage: (msg: string | null) => void\n): ApolloClient {\n return new ApolloClient({\n link: additiveLink(currentProjectId ?? '', setSchemaErrorMessage),\n cache: new InMemoryCache({\n dataIdFromObject: (responseObject) => {\n return responseObject._id ? (responseObject._id as string) : defaultDataIdFromObject(responseObject);\n },\n }),\n });\n}\n\nexport function GraphQLProvider({ children }: { children: React.ReactNode }): JSX.Element {\n const { currentProjectId } = useConfig();\n const [schemaErrorMessage, setSchemaErrorMessage] = useState<string | null>(null);\n const ctx = useMemo(() => ({ schemaErrorMessage, setSchemaErrorMessage }), [schemaErrorMessage]);\n const apolloClient = useMemo(() => client(currentProjectId, setSchemaErrorMessage), [currentProjectId]);\n\n return (\n <GraphQLErrorContext.Provider value={ctx}>\n <ApolloProviderCompat client={apolloClient}>{children}</ApolloProviderCompat>\n </GraphQLErrorContext.Provider>\n );\n}\n\nexport { useGraphQLError };\n","'use client';\n\nimport { createContext, useContext, useReducer } from 'react';\nimport type { Dispatch, JSX, ReactNode } from 'react';\nimport { props, uniqBy } from 'ramda';\nimport type {\n Action,\n ActionAddEntity,\n ActionAlertDialog,\n ActionDeleteEntity,\n ActionEditEntity,\n ActionEditRelationship,\n} from './types';\n\nconst ActionsContext = createContext<Action[] | []>([]);\nconst EntityDispatchContext = createContext<Dispatch<Action>>(() => undefined);\n\nfunction actionsReducer(actions: Action[], action: Action): Action[] {\n const actionType = action.type;\n\n if (!action._id) {\n action._id = Date.now().toString();\n }\n\n switch (actionType) {\n case 'DeleteEntity': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionDeleteEntity[]), action]);\n }\n case 'AddEntity': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionAddEntity[]), action]);\n }\n case 'EditEntity': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionEditEntity[]), action]);\n }\n case 'EditRelationship': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionEditRelationship[]), action]);\n }\n case 'AlertDialog': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionAlertDialog[]), action]);\n }\n case 'Dismiss': {\n return actions.filter((item) => item._id !== action._id);\n }\n default: {\n throw Error(`Unknown action: ${actionType as string}`);\n }\n }\n}\n\nfunction ActionsProvider({ children }: { children: ReactNode }): JSX.Element {\n const [entityActions, dispatchEntityActions] = useReducer(actionsReducer, []);\n\n return (\n <ActionsContext.Provider value={entityActions}>\n <EntityDispatchContext.Provider value={dispatchEntityActions}>{children}</EntityDispatchContext.Provider>\n </ActionsContext.Provider>\n );\n}\n\nfunction useActions(): Action[] {\n return useContext(ActionsContext);\n}\n\nfunction useDispatch(): Dispatch<Action> {\n return useContext(EntityDispatchContext);\n}\n\nexport { ActionsProvider, useActions, useDispatch };\n"]}
|
package/dist/electron.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./index.css';import {g,e,x}from'./chunk-4PUMSUJL.js';import'./chunk-YDVO6XWD.js';import'./chunk-ERDARDGB.js';import {f}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=entry-
|
|
1
|
+
import'./index.css';import {g,e,x}from'./chunk-4PUMSUJL.js';import'./chunk-YDVO6XWD.js';import'./chunk-ERDARDGB.js';import {f}from'./chunk-6I7D2JBA.js';import'./chunk-MBBE4RND.js';import'./chunk-5CVDMZUI.js';import'./chunk-L5T56MRH.js';import'./chunk-A4DPLZZF.js';import'./chunk-3SY46ERM.js';import'./chunk-5JUG4BEF.js';import'./chunk-S7Z6KKIN.js';import'./chunk-U45E5X3H.js';import {b,c,e as e$1,a}from'./chunk-N33S7BSG.js';import {c as c$1}from'./chunk-X3SHNHHM.js';import {Waypoints}from'lucide-react';import {useNavigate}from'react-router-dom';import {jsxs,jsx}from'react/jsx-runtime';function S({entityName:n,selectedIds:t}){let{currentProjectId:i,currentProjectSchema:r}=f(),l=useNavigate(),e$2=g(r,n);if(!i||!e$2||e(e$2).length===0)return null;let a=t.length>0?`Open ${t.length} in Graph`:"Open in Graph";return jsxs(b,{children:[jsx(c,{asChild:true,children:jsxs(c$1,{"aria-label":a,className:"fk:mr-2 fk:h-8",onClick:()=>l(x(i,{entity:n,ids:t})),size:"sm",variant:"outline",children:[jsx(Waypoints,{className:"fk:size-4",strokeWidth:1.5}),t.length>0?`Graph (${t.length})`:"Graph"]})}),jsx(e$1,{children:t.length>0?"Show the selected records and their relationships":"Explore these records as a graph"})]})}function B({entityName:n,recordId:t,onNavigate:i}){let{currentProjectId:r,currentProjectSchema:l}=f(),e$2=useNavigate(),a$1=g(l,n);return !r||!a$1||!t||e(a$1).length===0?null:jsx(a,{children:jsxs(b,{children:[jsx(c,{asChild:true,children:jsx(c$1,{"aria-label":"View in Graph",className:"fk:h-9 fk:w-9",onClick:()=>{e$2(x(r,{entity:n,ids:[t]})),i?.();},size:"icon",variant:"outline",children:jsx(Waypoints,{className:"fk:size-4",strokeWidth:1.5})})}),jsx(e$1,{children:"View in Graph"})]})})}export{S as EntityGraphButton,B as RecordGraphButton};//# sourceMappingURL=entry-ROTT3ZDN.js.map
|
|
2
|
+
//# sourceMappingURL=entry-ROTT3ZDN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apps/graph/entry.tsx"],"names":["EntityGraphButton","entityName","selectedIds","currentProjectId","currentProjectSchema","useConfig","navigate","useNavigate","entity","getEntity","getRelationshipAttributes","label","jsxs","Tooltip","jsx","TooltipTrigger","Button","graphPath","WaypointsIcon","TooltipContent","RecordGraphButton","recordId","onNavigate","TooltipProvider"],"mappings":"6kBAaO,SAASA,CAAAA,CAAkB,CAAE,UAAA,CAAAC,CAAAA,CAAY,WAAA,CAAAC,CAAY,CAAA,CAAsE,CAChI,GAAM,CAAE,gBAAA,CAAAC,CAAAA,CAAkB,oBAAA,CAAAC,CAAqB,CAAA,CAAIC,CAAAA,EAAU,CACvDC,CAAAA,CAAWC,WAAAA,EAAY,CACvBC,IAASC,CAAAA,CAAUL,CAAAA,CAAsBH,CAAU,CAAA,CAEzD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BC,IAASC,CAAAA,CAAUL,CAAAA,CAAsBH,CAAU,CAAA,CAEzD,OAAI,CAACE,GAAoB,CAACK,GAAAA,EAAU,CAACa,CAAAA,EAAYX,CAAAA,CAA0BF,GAAM,CAAA,CAAE,MAAA,GAAW,CAAA,CACrF,IAAA,CAIPM,GAAAA,CAACS,CAAAA,CAAA,CACC,QAAA,CAAAX,KAACC,CAAAA,CAAA,CACC,QAAA,CAAA,CAAAC,GAAAA,CAACC,CAAAA,CAAA,CAAe,QAAO,IAAA,CACrB,QAAA,CAAAD,GAAAA,CAACE,GAAAA,CAAA,CACC,YAAA,CAAW,gBACX,SAAA,CAAU,eAAA,CACV,OAAA,CAAS,IAAM,CACbV,GAAAA,CAASW,CAAAA,CAAUd,CAAAA,CAAkB,CAAE,MAAA,CAAQF,CAAAA,CAAY,GAAA,CAAK,CAACoB,CAAQ,CAAE,CAAC,CAAC,CAAA,CAC7EC,CAAAA,KACF,CAAA,CACA,IAAA,CAAK,MAAA,CACL,OAAA,CAAQ,SAAA,CAER,QAAA,CAAAR,GAAAA,CAACI,SAAAA,CAAA,CAAc,UAAU,WAAA,CAAY,WAAA,CAAa,GAAA,CAAK,CAAA,CACzD,CAAA,CACF,CAAA,CACAJ,GAAAA,CAACK,GAAAA,CAAA,CAAe,QAAA,CAAA,eAAA,CAAa,CAAA,CAAA,CAC/B,CAAA,CACF,CAEJ","file":"entry-
|
|
1
|
+
{"version":3,"sources":["../src/apps/graph/entry.tsx"],"names":["EntityGraphButton","entityName","selectedIds","currentProjectId","currentProjectSchema","useConfig","navigate","useNavigate","entity","getEntity","getRelationshipAttributes","label","jsxs","Tooltip","jsx","TooltipTrigger","Button","graphPath","WaypointsIcon","TooltipContent","RecordGraphButton","recordId","onNavigate","TooltipProvider"],"mappings":"6kBAaO,SAASA,CAAAA,CAAkB,CAAE,UAAA,CAAAC,CAAAA,CAAY,WAAA,CAAAC,CAAY,CAAA,CAAsE,CAChI,GAAM,CAAE,gBAAA,CAAAC,CAAA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,CACF,CAAA,CAIuB,CACrB,GAAM,CAAE,gBAAA,CAAAnB,CAAAA,CAAkB,oBAAA,CAAAC,CAAqB,CAAA,CAAIC,CAAAA,EAAU,CACvDC,GAAAA,CAAWC,WAAAA,EAAY,CACvBC,IAASC,CAAAA,CAAUL,CAAAA,CAAsBH,CAAU,CAAA,CAEzD,OAAI,CAACE,GAAoB,CAACK,GAAAA,EAAU,CAACa,CAAAA,EAAYX,CAAAA,CAA0BF,GAAM,CAAA,CAAE,MAAA,GAAW,CAAA,CACrF,IAAA,CAIPM,GAAAA,CAACS,CAAAA,CAAA,CACC,QAAA,CAAAX,KAACC,CAAAA,CAAA,CACC,QAAA,CAAA,CAAAC,GAAAA,CAACC,CAAAA,CAAA,CAAe,QAAO,IAAA,CACrB,QAAA,CAAAD,GAAAA,CAACE,GAAAA,CAAA,CACC,YAAA,CAAW,gBACX,SAAA,CAAU,eAAA,CACV,OAAA,CAAS,IAAM,CACbV,GAAAA,CAASW,CAAAA,CAAUd,CAAAA,CAAkB,CAAE,MAAA,CAAQF,CAAAA,CAAY,GAAA,CAAK,CAACoB,CAAQ,CAAE,CAAC,CAAC,CAAA,CAC7EC,CAAAA,KACF,CAAA,CACA,IAAA,CAAK,MAAA,CACL,OAAA,CAAQ,SAAA,CAER,QAAA,CAAAR,GAAAA,CAACI,SAAAA,CAAA,CAAc,UAAU,WAAA,CAAY,WAAA,CAAa,GAAA,CAAK,CAAA,CACzD,CAAA,CACF,CAAA,CACAJ,GAAAA,CAACK,GAAAA,CAAA,CAAe,QAAA,CAAA,eAAA,CAAa,CAAA,CAAA,CAC/B,CAAA,CACF,CAEJ","file":"entry-ROTT3ZDN.js","sourcesContent":["'use client';\n\nimport type { JSX } from 'react';\nimport { Waypoints as WaypointsIcon } from 'lucide-react';\nimport { useNavigate } from 'react-router-dom';\nimport { useConfig } from '../../core/config/config-context';\nimport { Button, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../ui';\nimport { getEntity, getRelationshipAttributes, graphPath } from './graph';\n\n/**\n * \"Open in Graph\" for a Desk list: the selected records, or a sample of the\n * entity when nothing is selected. Hidden for entities without relationships.\n */\nexport function EntityGraphButton({ entityName, selectedIds }: { entityName: string; selectedIds: string[] }): JSX.Element | null {\n const { currentProjectId, currentProjectSchema } = useConfig();\n const navigate = useNavigate();\n const entity = getEntity(currentProjectSchema, entityName);\n\n if (!currentProjectId || !entity || getRelationshipAttributes(entity).length === 0) {\n return null;\n }\n\n const label = selectedIds.length > 0 ? `Open ${selectedIds.length} in Graph` : 'Open in Graph';\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n aria-label={label}\n className=\"fk:mr-2 fk:h-8\"\n onClick={() => navigate(graphPath(currentProjectId, { entity: entityName, ids: selectedIds }))}\n size=\"sm\"\n variant=\"outline\"\n >\n <WaypointsIcon className=\"fk:size-4\" strokeWidth={1.5} />\n {selectedIds.length > 0 ? `Graph (${selectedIds.length})` : 'Graph'}\n </Button>\n </TooltipTrigger>\n <TooltipContent>\n {selectedIds.length > 0 ? 'Show the selected records and their relationships' : 'Explore these records as a graph'}\n </TooltipContent>\n </Tooltip>\n );\n}\n\n/**\n * \"View in Graph\" in a record drawer: the record expanded one hop. The drawer\n * is mounted outside any app, so the tooltip brings its own provider.\n */\nexport function RecordGraphButton({\n entityName,\n recordId,\n onNavigate,\n}: {\n entityName: string;\n recordId: string;\n onNavigate?: () => void;\n}): JSX.Element | null {\n const { currentProjectId, currentProjectSchema } = useConfig();\n const navigate = useNavigate();\n const entity = getEntity(currentProjectSchema, entityName);\n\n if (!currentProjectId || !entity || !recordId || getRelationshipAttributes(entity).length === 0) {\n return null;\n }\n\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n aria-label=\"View in Graph\"\n className=\"fk:h-9 fk:w-9\"\n onClick={() => {\n navigate(graphPath(currentProjectId, { entity: entityName, ids: [recordId] }));\n onNavigate?.();\n }}\n size=\"icon\"\n variant=\"outline\"\n >\n <WaypointsIcon className=\"fk:size-4\" strokeWidth={1.5} />\n </Button>\n </TooltipTrigger>\n <TooltipContent>View in Graph</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -190,6 +190,13 @@ interface ProjectSummary {
|
|
|
190
190
|
team: { id: string; name: string };
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
/** A team the signed-in user belongs to; owners can create projects in it. */
|
|
194
|
+
interface HostedTeam {
|
|
195
|
+
id: string;
|
|
196
|
+
name: string;
|
|
197
|
+
role: 'owner' | 'member';
|
|
198
|
+
}
|
|
199
|
+
|
|
193
200
|
interface HostedUser {
|
|
194
201
|
avatarUrl: string | null;
|
|
195
202
|
displayName: string | null;
|
|
@@ -250,6 +257,8 @@ interface ConfigContext {
|
|
|
250
257
|
projectIds: string[];
|
|
251
258
|
/** Hosted mode: name, avatar, role and team of each project, known before any schema loads. */
|
|
252
259
|
projectSummaries: ProjectSummary[];
|
|
260
|
+
/** Hosted mode: the user's teams with their role; owners can create projects in them. */
|
|
261
|
+
teams: HostedTeam[];
|
|
253
262
|
/** Per project id: why its schema could not be loaded. */
|
|
254
263
|
schemaErrors: {
|
|
255
264
|
[projectId: string]: ProjectSchemaError;
|
|
@@ -870,4 +879,4 @@ declare const assetSchema: UiEntity;
|
|
|
870
879
|
|
|
871
880
|
declare const tagSchema: UiEntity;
|
|
872
881
|
|
|
873
|
-
export { ALL_FIELDS_GROUP, ALL_FIELDS_GROUP_NAME, type AgentChatDetail, type AgentChatSearchResult, type AgentChatsList, type AttributeValue, type Automation, type AutomationApprovals, type AutomationArtifact, type AutomationCreditBalance, type AutomationInput, type AutomationToolChannel, type AutomationToolProvider, type ConfigContext, DESKTOP_LOGIN_CALLBACK, DataTable, DataTableColumnHeader, DataTableFacetedFilter, DataTableRowActions, DataTableSortedBy, DataTableToolbar, DataTableViewOptions, DefaultValueSwitch, type EntityData, type EntityListRowPatch, type FlexkitDesktopBridge, FlexkitStudio, type FlexkitStudioProps, type FormEntityItem, type FormFieldParams, type FormFieldValue, type HostedUser, IMAGES_BASE_URL, type MappedEntityItem, ProjectDisabled, type ProjectSchemaError, type ProjectSummary, type ProjectUiConfig, type RunHistory, type RunHistoryRun, SchemaError, type SearchRequestProps, type SearchResultItem, type Skill, type SkillInput, type SkillsList, type StudioMode, type UploadedFileResult, assetSchema, canAccessSpaces, canMutateData, filterAttributesForSpaces, filterEntitiesForSpaces, getDesktop, getEntityCreateMutation, getEntityDeleteMutation, getEntityDeleteWhere, getEntityQuery, getEntitySchema, getEntityUpdateMutation, getSortNotNullWhere, tagSchema, useAppContext, useAppDispatch, useAuth, useCanMutate, useConfig, useDispatch, useEntityMutation, useEntityQuery, useGraphQLError, useGridColumnsDefinition, usePatchEntityList, useRefreshEntityList, useSearch, useUploadAssets };
|
|
882
|
+
export { ALL_FIELDS_GROUP, ALL_FIELDS_GROUP_NAME, type AgentChatDetail, type AgentChatSearchResult, type AgentChatsList, type AttributeValue, type Automation, type AutomationApprovals, type AutomationArtifact, type AutomationCreditBalance, type AutomationInput, type AutomationToolChannel, type AutomationToolProvider, type ConfigContext, DESKTOP_LOGIN_CALLBACK, DataTable, DataTableColumnHeader, DataTableFacetedFilter, DataTableRowActions, DataTableSortedBy, DataTableToolbar, DataTableViewOptions, DefaultValueSwitch, type EntityData, type EntityListRowPatch, type FlexkitDesktopBridge, FlexkitStudio, type FlexkitStudioProps, type FormEntityItem, type FormFieldParams, type FormFieldValue, type HostedTeam, type HostedUser, IMAGES_BASE_URL, type MappedEntityItem, ProjectDisabled, type ProjectSchemaError, type ProjectSummary, type ProjectUiConfig, type RunHistory, type RunHistoryRun, SchemaError, type SearchRequestProps, type SearchResultItem, type Skill, type SkillInput, type SkillsList, type StudioMode, type UploadedFileResult, assetSchema, canAccessSpaces, canMutateData, filterAttributesForSpaces, filterEntitiesForSpaces, getDesktop, getEntityCreateMutation, getEntityDeleteMutation, getEntityDeleteWhere, getEntityQuery, getEntitySchema, getEntityUpdateMutation, getSortNotNullWhere, tagSchema, useAppContext, useAppDispatch, useAuth, useCanMutate, useConfig, useDispatch, useEntityMutation, useEntityQuery, useGraphQLError, useGridColumnsDefinition, usePatchEntityList, useRefreshEntityList, useSearch, useUploadAssets };
|