@zeroin.earth/appwrite-graphql 23.0.3 → 23.0.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.
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -26
- package/dist/index.d.ts +26 -26
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/react-native/index.cjs +94 -94
- package/react-native/index.d.cts +25 -27
- package/react-native/index.d.ts +25 -27
- package/react-native/index.js +94 -94
package/dist/index.cjs
CHANGED
|
@@ -912,7 +912,7 @@
|
|
|
912
912
|
status
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
|
-
`);function Ei(){let{graphql:t}=n(),e=m();return p({mutationKey:i.teams().memberships().delete(),mutationFn:async({teamId:r,membershipId:o})=>{let{data:a,errors:u}=await t.mutation({query:ye,variables:{teamId:r,membershipId:o}});if(u)throw u;return a?.teamsDeleteMembership??{status:""}},onSuccess:(r,o)=>{e.removeQueries({queryKey:i.team(o.teamId).membership(o.membershipId).key()}),e.invalidateQueries({queryKey:i.team(o.teamId).memberships().key()}),e.invalidateQueries({queryKey:i.team(o.teamId).key()});}})}var fe=class t{queries=[];equal(e,s){return this.queries.push(appwrite.Query.equal(e,s)),this}notEqual(e,s){return this.queries.push(appwrite.Query.notEqual(e,s)),this}regex(e,s){return this.queries.push(appwrite.Query.regex(e,s)),this}lessThan(e,s){return this.queries.push(appwrite.Query.lessThan(e,s)),this}lessThanEqual(e,s){return this.queries.push(appwrite.Query.lessThanEqual(e,s)),this}greaterThan(e,s){return this.queries.push(appwrite.Query.greaterThan(e,s)),this}greaterThanEqual(e,s){return this.queries.push(appwrite.Query.greaterThanEqual(e,s)),this}isNull(e){return this.queries.push(appwrite.Query.isNull(e)),this}isNotNull(e){return this.queries.push(appwrite.Query.isNotNull(e)),this}exists(e){return this.queries.push(appwrite.Query.exists(e)),this}notExists(e){return this.queries.push(appwrite.Query.notExists(e)),this}between(e,s,r){return this.queries.push(appwrite.Query.between(e,s,r)),this}startsWith(e,s){return this.queries.push(appwrite.Query.startsWith(e,s)),this}endsWith(e,s){return this.queries.push(appwrite.Query.endsWith(e,s)),this}select(e){return this.queries.push(appwrite.Query.select(e)),this}search(e,s){return this.queries.push(appwrite.Query.search(e,s)),this}orderAsc(e){return this.queries.push(appwrite.Query.orderAsc(e)),this}orderDesc(e){return this.queries.push(appwrite.Query.orderDesc(e)),this}orderRandom(){return this.queries.push(appwrite.Query.orderRandom()),this}cursorAfter(e){return this.queries.push(appwrite.Query.cursorAfter(e)),this}cursorBefore(e){return this.queries.push(appwrite.Query.cursorBefore(e)),this}limit(e){return this.queries.push(appwrite.Query.limit(e)),this}offset(e){return this.queries.push(appwrite.Query.offset(e)),this}contains(e,s){return this.queries.push(appwrite.Query.contains(e,s)),this}containsAny(e,s){return this.queries.push(appwrite.Query.containsAny(e,s)),this}containsAll(e,s){return this.queries.push(appwrite.Query.containsAll(e,s)),this}notContains(e,s){return this.queries.push(appwrite.Query.notContains(e,s)),this}notSearch(e,s){return this.queries.push(appwrite.Query.notSearch(e,s)),this}notBetween(e,s,r){return this.queries.push(appwrite.Query.notBetween(e,s,r)),this}notStartsWith(e,s){return this.queries.push(appwrite.Query.notStartsWith(e,s)),this}notEndsWith(e,s){return this.queries.push(appwrite.Query.notEndsWith(e,s)),this}createdBefore(e){return this.queries.push(appwrite.Query.createdBefore(e)),this}createdAfter(e){return this.queries.push(appwrite.Query.createdAfter(e)),this}createdBetween(e,s){return this.queries.push(appwrite.Query.createdBetween(e,s)),this}updatedBefore(e){return this.queries.push(appwrite.Query.updatedBefore(e)),this}updatedAfter(e){return this.queries.push(appwrite.Query.updatedAfter(e)),this}updatedBetween(e,s){return this.queries.push(appwrite.Query.updatedBetween(e,s)),this}or(...e){let s=e.map(r=>r(new t).queries).flat();return this.queries.push(appwrite.Query.or(s)),this}and(...e){let s=e.map(r=>r(new t).queries).flat();return this.queries.push(appwrite.Query.and(s)),this}elemMatch(e,s){return this.queries.push(appwrite.Query.elemMatch(e,s.queries)),this}distanceEqual(e,s,r,o,a=true){return this.queries.push(appwrite.Query.distanceEqual(e,[s,r],o,a)),this}distanceNotEqual(e,s,r,o,a=true){return this.queries.push(appwrite.Query.distanceNotEqual(e,[s,r],o,a)),this}distanceGreaterThan(e,s,r,o,a=true){return this.queries.push(appwrite.Query.distanceGreaterThan(e,[s,r],o,a)),this}distanceLessThan(e,s,r,o,a=true){return this.queries.push(appwrite.Query.distanceLessThan(e,[s,r],o,a)),this}intersects(e,s){return this.queries.push(appwrite.Query.intersects(e,s)),this}notIntersects(e,s){return this.queries.push(appwrite.Query.notIntersects(e,s)),this}crosses(e,s){return this.queries.push(appwrite.Query.crosses(e,s)),this}notCrosses(e,s){return this.queries.push(appwrite.Query.notCrosses(e,s)),this}overlaps(e,s){return this.queries.push(appwrite.Query.overlaps(e,s)),this}notOverlaps(e,s){return this.queries.push(appwrite.Query.notOverlaps(e,s)),this}touches(e,s){return this.queries.push(appwrite.Query.touches(e,s)),this}notTouches(e,s){return this.queries.push(appwrite.Query.notTouches(e,s)),this}build(){return [...this.queries]}};function bx(){return new fe}function V(){}function Be(t){let e;if(t.then(s=>(e=s,s),V)?.catch(V),e!==void 0)return {data:e}}function Je(t){return t}function Ui(t){return {mutationKey:t.options.mutationKey,state:t.state,...t.options.scope&&{scope:t.options.scope},...t.meta&&{meta:t.meta}}}function Mi(t,e,s){let r=()=>{let o=t.promise?.then(e).catch(a=>s(a)?(process.env.NODE_ENV!=="production"&&console.error(`A query that was dehydrated as pending ended up rejecting. [${t.queryHash}]: ${a}; The error will be redacted in production builds`),Promise.reject(new Error("redacted"))):Promise.reject(a));return o?.catch(V),o};return {dehydratedAt:Date.now(),state:{...t.state,...t.state.data!==void 0&&{data:e(t.state.data)}},queryKey:t.queryKey,queryHash:t.queryHash,...t.state.status==="pending"&&{promise:r()},...t.meta&&{meta:t.meta}}}function je(t){return t.state.isPaused}function We(t){return t.state.status==="success"}function Ii(t){return true}function de(t,e={}){let s=e.shouldDehydrateMutation??t.getDefaultOptions().dehydrate?.shouldDehydrateMutation??je,r=t.getMutationCache().getAll().flatMap(l=>s(l)?[Ui(l)]:[]),o=e.shouldDehydrateQuery??t.getDefaultOptions().dehydrate?.shouldDehydrateQuery??We,a=e.shouldRedactErrors??t.getDefaultOptions().dehydrate?.shouldRedactErrors??Ii,u=e.serializeData??t.getDefaultOptions().dehydrate?.serializeData??Je,c=t.getQueryCache().getAll().flatMap(l=>o(l)?[Mi(l,u,a)]:[]);return {mutations:r,queries:c}}function he(t,e,s){if(typeof e!="object"||e===null)return;let r=t.getMutationCache(),o=t.getQueryCache(),a=s?.defaultOptions?.deserializeData??t.getDefaultOptions().hydrate?.deserializeData??Je,u=e.mutations||[],c=e.queries||[];u.forEach(({state:l,...y})=>{r.build(t,{...t.getDefaultOptions().hydrate?.mutations,...s?.defaultOptions?.mutations,...y},l);}),c.forEach(({queryKey:l,state:y,queryHash:f,meta:b,promise:x,dehydratedAt:g})=>{let q=x?Be(x):void 0,A=y.data===void 0?q?.data:y.data,P=A===void 0?A:a(A),R=o.get(f),C=R?.state.status==="pending",K=R?.state.fetchStatus==="fetching";if(R){let rt=q&&g!==void 0&&g>R.state.dataUpdatedAt;if(y.dataUpdatedAt>R.state.dataUpdatedAt||rt){let{fetchStatus:Yi,...ot}=y;R.setState({...ot,data:P});}}else R=o.build(t,{...t.getDefaultOptions().hydrate?.queries,...s?.defaultOptions?.queries,queryKey:l,queryHash:f,meta:b},{...y,data:P,fetchStatus:"idle",status:P!==void 0?"success":y.status});x&&!C&&!K&&(g===void 0||g>R.state.dataUpdatedAt)&&R.fetch(void 0,{initialPromise:Promise.resolve(x).then(a)}).catch(V);});}var vi=["added","removed","updated"];function ze(t){return vi.includes(t)}async function Qi({queryClient:t,persister:e,maxAge:s=1e3*60*60*24,buster:r="",hydrateOptions:o}){try{let a=await e.restoreClient();if(a)if(a.timestamp){let u=Date.now()-a.timestamp>s,c=a.buster!==r;if(u||c)return e.removeClient();he(t,a.clientState,o);}else return e.removeClient()}catch(a){throw process.env.NODE_ENV!=="production"&&(console.error(a),console.warn("Encountered an error attempting to restore client cache from persisted location. As a precaution, the persisted cache will be discarded.")),await e.removeClient(),a}}async function He({queryClient:t,persister:e,buster:s="",dehydrateOptions:r}){let o={buster:s,timestamp:Date.now(),clientState:de(t,r)};await e.persistClient(o);}function $i(t){let e=t.queryClient.getQueryCache().subscribe(r=>{ze(r.type)&&He(t);}),s=t.queryClient.getMutationCache().subscribe(r=>{ze(r.type)&&He(t);});return ()=>{e(),s();}}function Xe(t){let e=false,s,r=()=>{e=true,s?.();},o=Qi(t).then(()=>{e||(s=$i(t));});return [r,o]}function w(t,e,s){return async(r,o)=>{let a=s?.serializeData?{...o,data:JSON.stringify(o.data)}:o,{data:u,errors:c}=await r.graphql.mutation({query:t,variables:a});if(c)throw c;return u[e]}}var Ye=[{mutationKey:i.databases().collections().documents().create(),mutationFn:w(H,"databasesCreateDocument",{serializeData:true})},{mutationKey:i.databases().collections().documents().delete(),mutationFn:w(Y,"databasesDeleteDocument")},{mutationKey:i.databases().collections().documents().upsert(),mutationFn:w(oe,"databasesUpsertDocument",{serializeData:true})},{mutationKey:[...i.databases().transactions().operations().key(),"incrementAttribute"],mutationFn:w(Z,"databasesIncrementDocumentAttribute")},{mutationKey:[...i.databases().transactions().operations().key(),"decrementAttribute"],mutationFn:w(X,"databasesDecrementDocumentAttribute")},{mutationKey:i.account().prefs().update(),mutationFn:w(G,"accountUpdatePrefs")},{mutationKey:i.account().name().update(),mutationFn:w(L,"accountUpdateName")},{mutationKey:i.account().email().update(),mutationFn:w(F,"accountUpdateEmail")},{mutationKey:i.account().password().update(),mutationFn:w(N,"accountUpdatePassword")},{mutationKey:i.account().phone().update(),mutationFn:w(_,"accountUpdatePhone")},{mutationKey:i.teams().create(),mutationFn:w(ne,"teamsCreate")},{mutationKey:i.teams().delete(),mutationFn:w(ce,"teamsDelete")},{mutationKey:i.teams().teamName().update(),mutationFn:w(ue,"teamsUpdateName")},{mutationKey:i.teams().teamPrefs().update(),mutationFn:w(pe,"teamsUpdatePrefs")},{mutationKey:i.teams().memberships().create(),mutationFn:w(me,"teamsCreateMembership")},{mutationKey:i.teams().memberships().delete(),mutationFn:w(ye,"teamsDeleteMembership")},{mutationKey:i.teams().memberships().update(),mutationFn:w(le,"teamsUpdateMembership")},{mutationKey:i.messaging().subscriber().create(),mutationFn:w(se,"messagingCreateSubscriber")},{mutationKey:i.messaging().subscriber().delete(),mutationFn:w(ae,"messagingDeleteSubscriber")}];function ge(t,e,s){for(let o of Ye)t.setMutationDefaults(o.mutationKey,{mutationFn:a=>o.mutationFn(e,a,t),scope:{id:"appwrite"}});let r=s?.conflictStrategy??"last-write-wins";t.setMutationDefaults(i.databases().collections().documents().update(),{mutationFn:o=>O(r)(e,o,t),scope:{id:"appwrite"}});}var _i={shouldDehydrateMutation:t=>t.state.isPaused,shouldDehydrateQuery:t=>t.state.status==="success"};function Gi({endpoint:t,projectId:e,storage:s,persister:r,networkAdapter:o,throttleTime:a=1e3,conflictStrategy:u="last-write-wins"}){if(s&&r)throw new Error("Provide either `storage` or `persister`, not both.");let c=Q({endpoint:t,projectId:e}),l=new reactQuery.QueryClient({defaultOptions:{mutations:{networkMode:"offlineFirst",meta:{conflictStrategy:u}},queries:{networkMode:"offlineFirst",gcTime:1e3*60*60*24}}});ge(l,c,{conflictStrategy:u});let y=r??(s?queryAsyncStoragePersister.createAsyncStoragePersister({storage:s,key:"appwrite-graphql-offline-cache",throttleTime:a}):void 0);return o.listen(f=>{reactQuery.onlineManager.setOnline(f);}),{appwrite:c,queryClient:l,persister:y,startPersistence(){if(!y)throw new Error("No persister configured. Provide `storage` or `persister` to createOfflineClient.");let[f,b]=Xe({queryClient:l,persister:y,dehydrateOptions:_i}),x=b.then(()=>{l.resumePausedMutations();});return {unsubscribe:f,restored:x}}}}function Bi(){return {listen:t=>{let e=()=>{t(navigator.onLine);};return window.addEventListener("online",e),window.addEventListener("offline",e),t(navigator.onLine),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e);}}}}var tt=gql_tada.graphql(`
|
|
915
|
+
`);function Ei(){let{graphql:t}=n(),e=m();return p({mutationKey:i.teams().memberships().delete(),mutationFn:async({teamId:r,membershipId:o})=>{let{data:a,errors:u}=await t.mutation({query:ye,variables:{teamId:r,membershipId:o}});if(u)throw u;return a?.teamsDeleteMembership??{status:""}},onSuccess:(r,o)=>{e.removeQueries({queryKey:i.team(o.teamId).membership(o.membershipId).key()}),e.invalidateQueries({queryKey:i.team(o.teamId).memberships().key()}),e.invalidateQueries({queryKey:i.team(o.teamId).key()});}})}var fe=class t{queries=[];equal(e,s){return this.queries.push(appwrite.Query.equal(e,s)),this}notEqual(e,s){return this.queries.push(appwrite.Query.notEqual(e,s)),this}regex(e,s){return this.queries.push(appwrite.Query.regex(e,s)),this}lessThan(e,s){return this.queries.push(appwrite.Query.lessThan(e,s)),this}lessThanEqual(e,s){return this.queries.push(appwrite.Query.lessThanEqual(e,s)),this}greaterThan(e,s){return this.queries.push(appwrite.Query.greaterThan(e,s)),this}greaterThanEqual(e,s){return this.queries.push(appwrite.Query.greaterThanEqual(e,s)),this}isNull(e){return this.queries.push(appwrite.Query.isNull(e)),this}isNotNull(e){return this.queries.push(appwrite.Query.isNotNull(e)),this}exists(e){return this.queries.push(appwrite.Query.exists(e)),this}notExists(e){return this.queries.push(appwrite.Query.notExists(e)),this}between(e,s,r){return this.queries.push(appwrite.Query.between(e,s,r)),this}startsWith(e,s){return this.queries.push(appwrite.Query.startsWith(e,s)),this}endsWith(e,s){return this.queries.push(appwrite.Query.endsWith(e,s)),this}select(e){return this.queries.push(appwrite.Query.select(e)),this}search(e,s){return this.queries.push(appwrite.Query.search(e,s)),this}orderAsc(e){return this.queries.push(appwrite.Query.orderAsc(e)),this}orderDesc(e){return this.queries.push(appwrite.Query.orderDesc(e)),this}orderRandom(){return this.queries.push(appwrite.Query.orderRandom()),this}cursorAfter(e){return this.queries.push(appwrite.Query.cursorAfter(e)),this}cursorBefore(e){return this.queries.push(appwrite.Query.cursorBefore(e)),this}limit(e){return this.queries.push(appwrite.Query.limit(e)),this}offset(e){return this.queries.push(appwrite.Query.offset(e)),this}contains(e,s){return this.queries.push(appwrite.Query.contains(e,s)),this}containsAny(e,s){return this.queries.push(appwrite.Query.containsAny(e,s)),this}containsAll(e,s){return this.queries.push(appwrite.Query.containsAll(e,s)),this}notContains(e,s){return this.queries.push(appwrite.Query.notContains(e,s)),this}notSearch(e,s){return this.queries.push(appwrite.Query.notSearch(e,s)),this}notBetween(e,s,r){return this.queries.push(appwrite.Query.notBetween(e,s,r)),this}notStartsWith(e,s){return this.queries.push(appwrite.Query.notStartsWith(e,s)),this}notEndsWith(e,s){return this.queries.push(appwrite.Query.notEndsWith(e,s)),this}createdBefore(e){return this.queries.push(appwrite.Query.createdBefore(e)),this}createdAfter(e){return this.queries.push(appwrite.Query.createdAfter(e)),this}createdBetween(e,s){return this.queries.push(appwrite.Query.createdBetween(e,s)),this}updatedBefore(e){return this.queries.push(appwrite.Query.updatedBefore(e)),this}updatedAfter(e){return this.queries.push(appwrite.Query.updatedAfter(e)),this}updatedBetween(e,s){return this.queries.push(appwrite.Query.updatedBetween(e,s)),this}or(...e){let s=e.map(r=>r(new t).queries).flat();return this.queries.push(appwrite.Query.or(s)),this}and(...e){let s=e.map(r=>r(new t).queries).flat();return this.queries.push(appwrite.Query.and(s)),this}elemMatch(e,s){return this.queries.push(appwrite.Query.elemMatch(e,s.queries)),this}distanceEqual(e,s,r,o,a=true){return this.queries.push(appwrite.Query.distanceEqual(e,[s,r],o,a)),this}distanceNotEqual(e,s,r,o,a=true){return this.queries.push(appwrite.Query.distanceNotEqual(e,[s,r],o,a)),this}distanceGreaterThan(e,s,r,o,a=true){return this.queries.push(appwrite.Query.distanceGreaterThan(e,[s,r],o,a)),this}distanceLessThan(e,s,r,o,a=true){return this.queries.push(appwrite.Query.distanceLessThan(e,[s,r],o,a)),this}intersects(e,s){return this.queries.push(appwrite.Query.intersects(e,s)),this}notIntersects(e,s){return this.queries.push(appwrite.Query.notIntersects(e,s)),this}crosses(e,s){return this.queries.push(appwrite.Query.crosses(e,s)),this}notCrosses(e,s){return this.queries.push(appwrite.Query.notCrosses(e,s)),this}overlaps(e,s){return this.queries.push(appwrite.Query.overlaps(e,s)),this}notOverlaps(e,s){return this.queries.push(appwrite.Query.notOverlaps(e,s)),this}touches(e,s){return this.queries.push(appwrite.Query.touches(e,s)),this}notTouches(e,s){return this.queries.push(appwrite.Query.notTouches(e,s)),this}build(){return [...this.queries]}};function bx(){return new fe}function V(){}function Be(t){let e;if(t.then(s=>(e=s,s),V)?.catch(V),e!==void 0)return {data:e}}function Je(t){return t}function Ui(t){return {mutationKey:t.options.mutationKey,state:t.state,...t.options.scope&&{scope:t.options.scope},...t.meta&&{meta:t.meta}}}function Mi(t,e,s){let r=()=>{let o=t.promise?.then(e).catch(a=>s(a)?(process.env.NODE_ENV!=="production"&&console.error(`A query that was dehydrated as pending ended up rejecting. [${t.queryHash}]: ${a}; The error will be redacted in production builds`),Promise.reject(new Error("redacted"))):Promise.reject(a));return o?.catch(V),o};return {dehydratedAt:Date.now(),state:{...t.state,...t.state.data!==void 0&&{data:e(t.state.data)}},queryKey:t.queryKey,queryHash:t.queryHash,...t.state.status==="pending"&&{promise:r()},...t.meta&&{meta:t.meta}}}function je(t){return t.state.isPaused}function We(t){return t.state.status==="success"}function Ii(t){return true}function de(t,e={}){let s=e.shouldDehydrateMutation??t.getDefaultOptions().dehydrate?.shouldDehydrateMutation??je,r=t.getMutationCache().getAll().flatMap(l=>s(l)?[Ui(l)]:[]),o=e.shouldDehydrateQuery??t.getDefaultOptions().dehydrate?.shouldDehydrateQuery??We,a=e.shouldRedactErrors??t.getDefaultOptions().dehydrate?.shouldRedactErrors??Ii,u=e.serializeData??t.getDefaultOptions().dehydrate?.serializeData??Je,c=t.getQueryCache().getAll().flatMap(l=>o(l)?[Mi(l,u,a)]:[]);return {mutations:r,queries:c}}function he(t,e,s){if(typeof e!="object"||e===null)return;let r=t.getMutationCache(),o=t.getQueryCache(),a=s?.defaultOptions?.deserializeData??t.getDefaultOptions().hydrate?.deserializeData??Je,u=e.mutations||[],c=e.queries||[];u.forEach(({state:l,...y})=>{r.build(t,{...t.getDefaultOptions().hydrate?.mutations,...s?.defaultOptions?.mutations,...y},l);}),c.forEach(({queryKey:l,state:y,queryHash:f,meta:b,promise:x,dehydratedAt:g})=>{let q=x?Be(x):void 0,A=y.data===void 0?q?.data:y.data,P=A===void 0?A:a(A),R=o.get(f),C=R?.state.status==="pending",K=R?.state.fetchStatus==="fetching";if(R){let rt=q&&g!==void 0&&g>R.state.dataUpdatedAt;if(y.dataUpdatedAt>R.state.dataUpdatedAt||rt){let{fetchStatus:Yi,...ot}=y;R.setState({...ot,data:P});}}else R=o.build(t,{...t.getDefaultOptions().hydrate?.queries,...s?.defaultOptions?.queries,queryKey:l,queryHash:f,meta:b},{...y,data:P,fetchStatus:"idle",status:P!==void 0?"success":y.status});x&&!C&&!K&&(g===void 0||g>R.state.dataUpdatedAt)&&R.fetch(void 0,{initialPromise:Promise.resolve(x).then(a)}).catch(V);});}var vi=["added","removed","updated"];function ze(t){return vi.includes(t)}async function Qi({queryClient:t,persister:e,maxAge:s=1e3*60*60*24,buster:r="",hydrateOptions:o}){try{let a=await e.restoreClient();if(a)if(a.timestamp){let u=Date.now()-a.timestamp>s,c=a.buster!==r;if(u||c)return e.removeClient();he(t,a.clientState,o);}else return e.removeClient()}catch(a){throw process.env.NODE_ENV!=="production"&&(console.error(a),console.warn("Encountered an error attempting to restore client cache from persisted location. As a precaution, the persisted cache will be discarded.")),await e.removeClient(),a}}async function He({queryClient:t,persister:e,buster:s="",dehydrateOptions:r}){let o={buster:s,timestamp:Date.now(),clientState:de(t,r)};await e.persistClient(o);}function $i(t){let e=t.queryClient.getQueryCache().subscribe(r=>{ze(r.type)&&He(t);}),s=t.queryClient.getMutationCache().subscribe(r=>{ze(r.type)&&He(t);});return ()=>{e(),s();}}function Xe(t){let e=false,s,r=()=>{e=true,s?.();},o=Qi(t).then(()=>{e||(s=$i(t));});return [r,o]}function w(t,e,s){return async(r,o)=>{let a=s?.serializeData?{...o,data:JSON.stringify(o.data)}:o,{data:u,errors:c}=await r.graphql.mutation({query:t,variables:a});if(c)throw c;return u[e]}}var Ye=[{mutationKey:i.databases().collections().documents().create(),mutationFn:w(H,"databasesCreateDocument",{serializeData:true})},{mutationKey:i.databases().collections().documents().delete(),mutationFn:w(Y,"databasesDeleteDocument")},{mutationKey:i.databases().collections().documents().upsert(),mutationFn:w(oe,"databasesUpsertDocument",{serializeData:true})},{mutationKey:[...i.databases().transactions().operations().key(),"incrementAttribute"],mutationFn:w(Z,"databasesIncrementDocumentAttribute")},{mutationKey:[...i.databases().transactions().operations().key(),"decrementAttribute"],mutationFn:w(X,"databasesDecrementDocumentAttribute")},{mutationKey:i.account().prefs().update(),mutationFn:w(G,"accountUpdatePrefs")},{mutationKey:i.account().name().update(),mutationFn:w(L,"accountUpdateName")},{mutationKey:i.account().email().update(),mutationFn:w(F,"accountUpdateEmail")},{mutationKey:i.account().password().update(),mutationFn:w(N,"accountUpdatePassword")},{mutationKey:i.account().phone().update(),mutationFn:w(_,"accountUpdatePhone")},{mutationKey:i.teams().create(),mutationFn:w(ne,"teamsCreate")},{mutationKey:i.teams().delete(),mutationFn:w(ce,"teamsDelete")},{mutationKey:i.teams().teamName().update(),mutationFn:w(ue,"teamsUpdateName")},{mutationKey:i.teams().teamPrefs().update(),mutationFn:w(pe,"teamsUpdatePrefs")},{mutationKey:i.teams().memberships().create(),mutationFn:w(me,"teamsCreateMembership")},{mutationKey:i.teams().memberships().delete(),mutationFn:w(ye,"teamsDeleteMembership")},{mutationKey:i.teams().memberships().update(),mutationFn:w(le,"teamsUpdateMembership")},{mutationKey:i.messaging().subscriber().create(),mutationFn:w(se,"messagingCreateSubscriber")},{mutationKey:i.messaging().subscriber().delete(),mutationFn:w(ae,"messagingDeleteSubscriber")}];function ge(t,e,s){for(let o of Ye)t.setMutationDefaults(o.mutationKey,{mutationFn:a=>o.mutationFn(e,a,t),scope:{id:"appwrite"}});let r=s?.conflictStrategy??"last-write-wins";t.setMutationDefaults(i.databases().collections().documents().update(),{mutationFn:o=>O(r)(e,o,t),scope:{id:"appwrite"}});}var _i={shouldDehydrateMutation:t=>t.state.isPaused,shouldDehydrateQuery:t=>t.state.status==="success"};function Gi({endpoint:t,projectId:e,storage:s,persister:r,networkAdapter:o,throttleTime:a=1e3,conflictStrategy:u="last-write-wins"}){if(s&&r)throw new Error("Provide either `storage` or `persister`, not both.");let c=Q({endpoint:t,projectId:e}),l=new reactQuery.QueryClient({defaultOptions:{mutations:{networkMode:"offlineFirst",meta:{conflictStrategy:u}},queries:{networkMode:"offlineFirst",gcTime:1e3*60*60*24}}});ge(l,c,{conflictStrategy:u});let y=r??(s?queryAsyncStoragePersister.createAsyncStoragePersister({storage:s,key:"appwrite-graphql-offline-cache",throttleTime:a}):void 0);return o.listen(f=>{reactQuery.onlineManager.setOnline(f);}),{appwrite:c,queryClient:l,persister:y,startPersistence(){if(!y)throw new Error("No persister configured. Provide `storage` or `persister` to createOfflineClient.");let[f,b]=Xe({queryClient:l,persister:y,dehydrateOptions:_i}),x=b.then(()=>{l.resumePausedMutations();});return {unsubscribe:f,restored:x}}}}var tt=gql_tada.graphql(`
|
|
916
916
|
mutation CreateExecution(
|
|
917
917
|
$functionId: String!
|
|
918
918
|
$body: String
|
|
@@ -939,7 +939,7 @@
|
|
|
939
939
|
duration
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
`),
|
|
942
|
+
`),Bi=gql_tada.graphql(`
|
|
943
943
|
query GetFunctionExecution($functionId: String!, $executionId: String!) {
|
|
944
944
|
functionsGetExecution(functionId: $functionId, executionId: $executionId) {
|
|
945
945
|
status
|
|
@@ -949,7 +949,7 @@
|
|
|
949
949
|
requestPath
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
|
-
`);function
|
|
952
|
+
`);function Ji({currentExecution:t,currentFunction:e}){let{graphql:s}=n(),r=!!e&&!!t;return {...d({queryKey:r?i.function(e).execution(t).key():i.functions().key(),queryFn:async()=>{if(!t||!e)return null;let{data:a}=await s.query({query:Bi,variables:{functionId:e,executionId:t}});if(!a?.functionsGetExecution)throw new Error("Execution not found");return a.functionsGetExecution??null},enabled:r})}}function gw(){let{graphql:t}=n(),[e,s]=T.useState(null),[r,o]=T.useState(null),a=Ji({currentExecution:e,currentFunction:r});return {executeFunction:p({mutationKey:i.functions().executions().create(),mutationFn:async({functionId:c,body:l={},async:y=false,path:f="/",method:b="POST",headers:x={},scheduledAt:g})=>{o(c);let{data:q}=await t.mutation({query:tt,variables:{functionId:c,body:JSON.stringify(l),async:y,path:f,method:b,headers:JSON.stringify(x),scheduledAt:g}}),{_id:A,status:P,errors:R,responseBody:C}=q.functionsCreateExecution??{};if(P==="failed")throw new Error(R);if(s(A??null),typeof C=="string"){if(C.trim().startsWith("{")&&C.trim().endsWith("}"))try{return JSON.parse(C)}catch(K){return console.error("Failed to parse response body:",K),C}return C}}}),currentExecution:a}}function bw({functionId:t,body:e={},async:s=false,path:r="/",method:o="POST",headers:a={},scheduledAt:u}){let{graphql:c}=n();return {executeFunction:S({queryKey:[...i.function(t).key(),"execute",{path:r,method:o,body:e}],queryFn:async()=>{let{data:y}=await c.mutation({query:tt,variables:{functionId:t,body:JSON.stringify(e),async:s,path:r,method:o,headers:JSON.stringify(a),scheduledAt:u}});if(y?.functionsCreateExecution?.status==="failed")throw new Error(y.functionsCreateExecution.errors);let{responseBody:f}=y.functionsCreateExecution??{};if(typeof f=="string"&&f.trim().startsWith("{")&&f.trim().endsWith("}"))try{return JSON.parse(f)}catch(b){return console.error("Failed to parse response body:",b),f}return f},staleTime:1/0})}}var Wi=gql_tada.graphql(`
|
|
953
953
|
query GetExecution($functionId: String!, $executionId: String!) {
|
|
954
954
|
functionsGetExecution(functionId: $functionId, executionId: $executionId) {
|
|
955
955
|
_id
|
|
@@ -966,7 +966,7 @@
|
|
|
966
966
|
duration
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
|
-
`);function
|
|
969
|
+
`);function Aw({functionId:t,executionId:e},s={}){let{graphql:r}=n();return d({queryKey:i.function(t).execution(e).key(),queryFn:async()=>{let{data:a,errors:u}=await r.query({query:Wi,variables:{functionId:t,executionId:e}});if(u)throw u;return a.functionsGetExecution},...s})}var Hi=gql_tada.graphql(`
|
|
970
970
|
query ListExecutions($functionId: String!, $queries: [String!]) {
|
|
971
971
|
functionsListExecutions(functionId: $functionId, queries: $queries) {
|
|
972
972
|
total
|
|
@@ -986,5 +986,5 @@
|
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
|
-
`);function
|
|
989
|
+
`);function Ow({functionId:t,queries:e},s={}){let{graphql:r}=n();return d({queryKey:[...i.function(t).executions().key(),...e??[]],queryFn:async()=>{let{data:a,errors:u}=await r.query({query:Hi,variables:{functionId:t,queries:e}});if(u)throw u;return a.functionsListExecutions},...s})}function Xi(){return {listen:t=>{let e=()=>{t(navigator.onLine);};return window.addEventListener("online",e),window.addEventListener("offline",e),t(navigator.onLine),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e);}}}}Object.defineProperty(exports,"AppwriteException",{enumerable:true,get:function(){return appwrite.AppwriteException}});Object.defineProperty(exports,"AuthenticationFactor",{enumerable:true,get:function(){return appwrite.AuthenticationFactor}});Object.defineProperty(exports,"AuthenticatorType",{enumerable:true,get:function(){return appwrite.AuthenticatorType}});Object.defineProperty(exports,"ID",{enumerable:true,get:function(){return appwrite.ID}});Object.defineProperty(exports,"OAuthProvider",{enumerable:true,get:function(){return appwrite.OAuthProvider}});exports.AppwriteProvider=ut;exports.Keys=i;exports.QueryBuilder=fe;exports.createAppwriteClient=Q;exports.createOfflineClient=Gi;exports.getAccountQuery=$;exports.getCollectionQuery=W;exports.getDocumentQuery=j;exports.hydrateMutationDefaults=ge;exports.mutationRegistry=Ye;exports.q=bx;exports.resolveConflict=te;exports.teamQueryOptions=ie;exports.useAccount=St;exports.useAppwrite=n;exports.useAvatarBrowser=rs;exports.useAvatarCreditCard=ss;exports.useAvatarFavicon=is;exports.useAvatarFlag=us;exports.useAvatarImage=cs;exports.useAvatarInitials=ls;exports.useAvatarQR=fs;exports.useAvatarScreenshot=hs;exports.useCollection=k;exports.useCollectionWithPagination=Cs;exports.useCreateAnonymousSession=Ot;exports.useCreateDocument=Ts;exports.useCreateEmailToken=Et;exports.useCreateEmailVerification=cr;exports.useCreateFile=za;exports.useCreateJWT=Mt;exports.useCreateMagicURLToken=$t;exports.useCreateMembership=Ti;exports.useCreateMfaAuthenticator=Nt;exports.useCreateMfaChallenge=Bt;exports.useCreateMfaRecoveryCodes=Wt;exports.useCreateOAuth2Token=zt;exports.useCreateOperations=Ds;exports.useCreatePhoneToken=Yt;exports.useCreatePhoneVerification=tr;exports.useCreatePushTarget=sr;exports.useCreateSession=nr;exports.useCreateSubscriber=Ua;exports.useCreateTeam=bi;exports.useCreateTransaction=ks;exports.useDecrementAttribute=Us;exports.useDeleteDocument=Is;exports.useDeleteFile=ti;exports.useDeleteIdentity=yr;exports.useDeleteMembership=Ei;exports.useDeleteMfaAuthenticator=hr;exports.useDeletePushTarget=qr;exports.useDeleteSession=Rr;exports.useDeleteSessions=Pr;exports.useDeleteSubscriber=Ia;exports.useDeleteTeam=Ai;exports.useDeleteTransaction=$s;exports.useDocument=Ns;exports.useFile=$a;exports.useFileDownload=La;exports.useFilePreview=_a;exports.useFileView=Ba;exports.useFiles=Wa;exports.useFunction=gw;exports.useGetExecution=Aw;exports.useGetMfaRecoveryCodes=Kr;exports.useGetPrefs=Vr;exports.useGetSession=Ur;exports.useGetTransaction=Js;exports.useIncrementAttribute=Ws;exports.useInfiniteCollection=Hs;exports.useLazyAccount=Tt;exports.useLazyQuery=M;exports.useListExecutions=Ow;exports.useListIdentities=vr;exports.useListMfaFactors=Fr;exports.useListSessions=_r;exports.useListTransactions=Zs;exports.useLocale=ma;exports.useLocaleCodes=fa;exports.useLocaleContinents=ga;exports.useLocaleCountries=xa;exports.useLocaleCountriesEU=Ca;exports.useLocaleCountriesPhones=Ta;exports.useLocaleCurrencies=Da;exports.useLocaleLanguages=ka;exports.useLogin=Jr;exports.useLogout=zr;exports.useLogs=Yr;exports.useMutation=p;exports.usePasswordRecovery=to;exports.useQuery=d;exports.useQueryClient=m;exports.useResetPassword=so;exports.useSignUp=no;exports.useSuspenseCollection=z;exports.useSuspenseCollectionWithPagination=As;exports.useSuspenseCreateJWT=It;exports.useSuspenseDocument=_s;exports.useSuspenseFunction=bw;exports.useSuspenseQuery=S;exports.useTeam=si;exports.useTeamMembership=yi;exports.useTeamMemberships=hi;exports.useTeamPrefs=ci;exports.useTeams=ni;exports.useUpdateDocument=ra;exports.useUpdateEmail=po;exports.useUpdateEmailVerification=lo;exports.useUpdateFile=Ya;exports.useUpdateMagicURLSession=ho;exports.useUpdateMembership=Ki;exports.useUpdateMembershipStatus=Vi;exports.useUpdateMfa=qo;exports.useUpdateMfaAuthenticator=Ro;exports.useUpdateMfaChallenge=Po;exports.useUpdateMfaRecoveryCodes=Ko;exports.useUpdateName=Oo;exports.useUpdatePassword=ko;exports.useUpdatePhone=Uo;exports.useUpdatePhoneSession=vo;exports.useUpdatePhoneVerification=Fo;exports.useUpdatePrefs=No;exports.useUpdatePushTarget=Bo;exports.useUpdateSession=Wo;exports.useUpdateStatus=Xo;exports.useUpdateTeamName=xi;exports.useUpdateTeamPrefs=Ri;exports.useUpdateTransaction=aa;exports.useUpsertDocument=ua;exports.useVerification=es;exports.webNetworkAdapter=Xi;//# sourceMappingURL=index.cjs.map
|
|
990
990
|
//# sourceMappingURL=index.cjs.map
|