@zeroin.earth/appwrite-graphql 0.14.11 → 0.15.1

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.mjs CHANGED
@@ -116,6 +116,7 @@ var CreateSessionDocument = { "kind": "Document", "definitions": [{ "kind": "Ope
116
116
  var DeleteIdentityDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DeleteIdentity" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "identityId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountDeleteIdentity" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "identityId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "identityId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] };
117
117
  var DeleteMfaAuthenticatorDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DeleteMfaAuthenticator" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "type" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "otp" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountDeleteMfaAuthenticator" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "type" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "type" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "otp" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "otp" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "mfa" } }] } }] } }] };
118
118
  var DeleteSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DeleteSession" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountDeleteSession" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "sessionId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] };
119
+ var DeleteSessionsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DeleteSessions" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountDeleteSessions" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] };
119
120
  var GetMfaRecoveryCodesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetMfaRecoveryCodes" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountGetMfaRecoveryCodes" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "recoveryCodes" } }] } }] } }] };
120
121
  var GetPrefsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetPrefs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountGetPrefs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "data" } }] } }] } }] };
121
122
  var GetSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetSession" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountGetSession" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "sessionId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "userId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "expire" } }, { "kind": "Field", "name": { "kind": "Name", "value": "current" } }] } }] } }] };
@@ -168,6 +169,7 @@ var documents = {
168
169
  "\n mutation DeleteIdentity($identityId: String!) {\n accountDeleteIdentity(identityId: $identityId) {\n status\n }\n }\n": DeleteIdentityDocument,
169
170
  "\n mutation DeleteMfaAuthenticator($type: String!, $otp: String!) {\n accountDeleteMfaAuthenticator(type: $type, otp: $otp) {\n mfa\n }\n }\n": DeleteMfaAuthenticatorDocument,
170
171
  "\n mutation DeleteSession($sessionId: String!) {\n accountDeleteSession(sessionId: $sessionId) {\n status\n }\n }\n": DeleteSessionDocument,
172
+ "\n mutation DeleteSessions {\n accountDeleteSessions {\n status\n }\n }\n": DeleteSessionsDocument,
171
173
  "\n query GetMfaRecoveryCodes {\n accountGetMfaRecoveryCodes {\n recoveryCodes\n }\n }\n": GetMfaRecoveryCodesDocument,
172
174
  "\n query GetPrefs {\n accountGetPrefs {\n data\n }\n }\n": GetPrefsDocument,
173
175
  "\n query GetSession($sessionId: String!) {\n accountGetSession(sessionId: $sessionId) {\n userId\n expire\n current\n }\n }\n": GetSessionDocument,
@@ -692,11 +694,11 @@ function useDeleteSession() {
692
694
  }
693
695
 
694
696
  // src/account/useDeleteSessions.ts
695
- var deleteSession2 = gql(
697
+ var deleteSessions = gql(
696
698
  /* GraphQL */
697
699
  `
698
- mutation DeleteSession($sessionId: String!) {
699
- accountDeleteSession(sessionId: $sessionId) {
700
+ mutation DeleteSessions {
701
+ accountDeleteSessions {
700
702
  status
701
703
  }
702
704
  }
@@ -705,17 +707,14 @@ var deleteSession2 = gql(
705
707
  function useDeleteSessions() {
706
708
  const { graphql: graphql2 } = useAppwrite();
707
709
  const queryResult = useMutation({
708
- mutationFn: async ({ sessionId }) => {
710
+ mutationFn: async () => {
709
711
  const { data, errors } = await graphql2.mutation({
710
- query: deleteSession2,
711
- variables: {
712
- sessionId
713
- }
712
+ query: deleteSessions
714
713
  });
715
714
  if (errors) {
716
715
  throw errors;
717
716
  }
718
- return data.accountDeleteSession;
717
+ return data.accountDeleteSessions;
719
718
  }
720
719
  });
721
720
  return { ...queryResult };
@@ -947,7 +946,7 @@ function useLogin() {
947
946
  }
948
947
 
949
948
  // src/account/useLogout.ts
950
- var deleteSession3 = gql(
949
+ var deleteSession2 = gql(
951
950
  /* GraphQL */
952
951
  `
953
952
  mutation DeleteSession($sessionId: String!) {
@@ -963,7 +962,7 @@ function useLogout() {
963
962
  const queryResult = useMutation({
964
963
  mutationFn: async ({ sessionId }) => {
965
964
  const { data, errors } = await graphql2.mutation({
966
- query: deleteSession3,
965
+ query: deleteSession2,
967
966
  variables: {
968
967
  sessionId
969
968
  }
@@ -1526,19 +1525,11 @@ var accountUpdatePrefs = gql(
1526
1525
  `
1527
1526
  );
1528
1527
  function useUpdatePrefs() {
1529
- const { graphql: graphql2 } = useAppwrite();
1528
+ const { account: account2 } = useAppwrite();
1530
1529
  const queryResult = useMutation({
1531
1530
  mutationFn: async ({ prefs }) => {
1532
- const { data, errors } = await graphql2.mutation({
1533
- query: accountUpdatePrefs,
1534
- variables: {
1535
- prefs: JSON.stringify(prefs)
1536
- }
1537
- });
1538
- if (errors) {
1539
- throw errors;
1540
- }
1541
- return data.accountUpdatePrefs;
1531
+ const newPrefs = await account2.updatePrefs(prefs);
1532
+ return newPrefs;
1542
1533
  }
1543
1534
  });
1544
1535
  return { ...queryResult };