{"id":20975769,"url":"https://github.com/imsamtar/hasurafire","last_synced_at":"2025-05-14T14:31:04.207Z","repository":{"id":42668074,"uuid":"250530490","full_name":"imsamtar/hasurafire","owner":"imsamtar","description":"Collection of svelte components for firebase authentication and hasura","archived":false,"fork":false,"pushed_at":"2023-05-09T14:06:44.000Z","size":399,"stargazers_count":6,"open_issues_count":8,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-15T06:31:14.097Z","etag":null,"topics":["authentication","firebase","firebase-auth","hasura","svelte"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/hasurafire","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imsamtar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-27T12:37:33.000Z","updated_at":"2021-04-11T20:36:42.000Z","dependencies_parsed_at":"2024-11-15T06:29:25.247Z","dependency_job_id":"5b0cd3a6-e796-424e-8559-eb1c2d7131c9","html_url":"https://github.com/imsamtar/hasurafire","commit_stats":{"total_commits":127,"total_committers":1,"mean_commits":127.0,"dds":0.0,"last_synced_commit":"cc5d05accb618d58b380a21521a853265e6c1551"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsamtar%2Fhasurafire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsamtar%2Fhasurafire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsamtar%2Fhasurafire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsamtar%2Fhasurafire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imsamtar","download_url":"https://codeload.github.com/imsamtar/hasurafire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225297737,"owners_count":17452010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","firebase","firebase-auth","hasura","svelte"],"created_at":"2024-11-19T04:47:18.111Z","updated_at":"2024-11-19T04:47:18.558Z","avatar_url":"https://github.com/imsamtar.png","language":"Svelte","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hasurafire\n\n### Collection of svelte components for firebase authentication and hasura\n\n## Setup\n\n```bash\nnpm i -D hasurafire\n```\n\n### Might need to edit _rollup.config.js_ (only if using rollup template)\n\n```javascript\nresolve({\n  mainFields: ['module', 'browser', 'main']\n}),\n```\n\n\n## API\n---\n\n### Root Component\n\n```html\n\u003cscript\u003e\n  import { Root } from \"hasurafire\";\n  const config = {\n    firebaseConfig,\n    endpoint, // hasura graphql endpoint\n    schema: 'v1', // %s in queries, mutations and subscriptions will be replaced by this value\n    queries: {\n      getMessages: `\n        query get_messages {\n          %s_messages {\n            content\n            sender_id\n            chat_id\n          }\n        }\n      `\n    }, // graphql queries, mutations and subscriptions\n  };\n\u003c/script\u003e\n\n\u003cRoot {...config} global={{uid: '100'}} let:firebase\u003e\n  \u003c!-- Here you have access to firebase object --\u003e\n  \u003c!-- prop: firebaseConfig --\u003e\n  \u003c!-- prop: endpoint, hasura graphql endpoint --\u003e\n  \u003c!-- optional prop: queries, object with all queries, mutations and subscriptions --\u003e\n  \u003c!-- optional prop: global, fallback values for query variables if variable undefined --\u003e\n  \u003c!-- optional prop: analytics, firebase analytics --\u003e\n  \u003c!-- optional prop: perf, firebase performence --\u003e\n  \u003c!-- optional prop: schema, value which will replace %s in queries --\u003e\n  \u003c!-- component props --\u003e\n    \u003c!-- component --\u003e\n\u003c/Root\u003e\n```\n---\n\n### User Component\n\n```html\n\u003cscript\u003e\n  import { User } from \"hasurafire\";\n\u003c/script\u003e\n\n\u003cUser (let|bind):user (let|bind):auth (let|bind):fresh_signin on:signin on:signout on:in on:out\u003e\n  \u003c!-- Here you have access to user object [current firebase user] --\u003e\n  \u003c!-- Here you have access to auth object [firebase.auth()] --\u003e\n  \u003c!-- let:user current firebase user --\u003e\n  \u003c!-- let:auth firebase.auth() --\u003e\n  \u003c!-- let:fresh_signin just signed in --\u003e\n  \u003c!-- let:signout signout function --\u003e\n  \u003c!-- bind:user current firebase user --\u003e\n  \u003c!-- bind:auth firebase.auth() --\u003e\n  \u003c!-- bind:fresh_signin just signed in --\u003e\n  \u003c!-- bind:signout signout function --\u003e\n  \u003c!-- on:signin is fired when user signs in --\u003e\n  \u003c!-- on:signout  is fired when user signs out --\u003e\n  \u003c!-- on:in is fired when user is already signed in as well as when user signs in --\u003e\n  \u003c!-- on:out is fired when user is already signed in as well as when user signs out --\u003e\n  \u003c!-- slot:default if user is signed in --\u003e\n  \u003c!-- slot:signed-out if user is signed out --\u003e\n  \u003c!-- slot:pending if not sure signed in or not --\u003e\n  \u003c!-- slot:start which is rendered all the time--\u003e\n  \u003c!-- slot:end which is rendered all the time--\u003e\n  \u003c!-- component props --\u003e\n    \u003c!-- pending --\u003e\n    \u003c!-- component --\u003e\n    \u003c!-- out --\u003e\n\u003c/User\u003e\n```\n---\n\n### SaveUser Component\n\n```html\n\u003cscript\u003e\n  import { User, SaveUser } from \"hasurafire\";\n\u003c/script\u003e\n\n\u003cUser let:user={{ email }} let:fresh_signin let:signout\u003e\n  {#if fresh_signin}\n    \u003cSaveUser {mutation} variables={{ email }} on:error={signout} \u003e\n      \u003c!-- Here you have access to response object [mutation response] --\u003e\n      \u003c!-- let:response response of mutation --\u003e\n      \u003c!-- let:data response.data object --\u003e\n      \u003c!-- let:error error if any --\u003e\n      \u003c!-- bind:response response of mutation --\u003e\n      \u003c!-- bind:data response.data object --\u003e\n      \u003c!-- bind:error error if any --\u003e\n      \u003c!-- on:new is fired when user successfull saved --\u003e\n      \u003c!-- on:already_exists  is fired when user is already exists --\u003e\n      \u003c!-- on:error is fired when some problem occours --\u003e\n      \u003c!-- optional prop: role, save user while using a specific role --\u003e\n      \u003c!-- optional prop: headers, save user while passing custom request headers to hasura --\u003e\n      \u003c!-- optional prop: noauth, save user without authentication --\u003e\n      \u003c!-- optional prop: adminsecret, save user using admin secret insead of firebase auth --\u003e\n      \u003c!-- slot:default if saved successfully --\u003e\n      \u003c!-- slot:already_exists if user already exists --\u003e\n      \u003c!-- slot:error if some problem occours saving --\u003e\n      \u003c!-- slot:pending while user is being saved --\u003e\n      \u003c!-- slot:start which is rendered all the time--\u003e\n      \u003c!-- slot:end which is rendered all the time--\u003e\n      \u003c!-- component props --\u003e\n        \u003c!-- pending --\u003e\n        \u003c!-- component --\u003e\n        \u003c!-- exists --\u003e\n        \u003c!-- alt --\u003e\n    \u003c/SaveUser\u003e\n  {/if}\n\u003c/User\u003e\n```\n---\n\n### Query Component\n\n```html\n\u003cscript\u003e\n  import { Query } from \"hasurafire\";\n  const variables = {};\n\u003c/script\u003e\n\n\u003cQuery started {query} {variables} let:execute let:response on:response on:error\u003e\n  \u003c!-- prop: started, which is passed if query is to be started on mount --\u003e\n  \u003c!-- prop: query, which accepts three types of input queryName|stringQuery|gqlTagQuery --\u003e\n  \u003c!-- Here you have access to execute function, calling this function will execute this query --\u003e\n  \u003c!-- Here you have access to response object [graphql query response] --\u003e\n  \u003c!-- let:response response of query --\u003e\n  \u003c!-- let:data response.data object --\u003e\n  \u003c!-- let:error error if any --\u003e\n  \u003c!-- bind:response response of query --\u003e\n  \u003c!-- bind:data response.data object --\u003e\n  \u003c!-- bind:error error if any --\u003e\n  \u003c!-- on:response is fired when new response is recieved from query --\u003e\n  \u003c!-- on:error  is fired when some error occurs while quering --\u003e\n  \u003c!-- optional prop: variables, which accepts an object containing all the variables needed for this graplql query --\u003e\n  \u003c!-- optional prop: every, which accepts some number in seconds after which re-execute this query --\u003e\n  \u003c!-- optional prop: started, which accepts some boolean value (not used with every prop) to start quering on mount) --\u003e\n  \u003c!-- optional prop: role, do this query hasura using a specific role --\u003e\n  \u003c!-- optional prop: headers, do this query while passing custom request headers to hasura --\u003e\n  \u003c!-- optional prop: noauth, do this query without authentication --\u003e\n  \u003c!-- optional prop: adminsecret, do this query using admin secret insead of firebase auth --\u003e\n  \u003c!-- slot:default if query successfull --\u003e\n  \u003c!-- slot:error if some problem occours while quering --\u003e\n  \u003c!-- slot:pending while query is being executed --\u003e\n  \u003c!-- slot:start which is rendered all the time--\u003e\n  \u003c!-- slot:end which is rendered all the time--\u003e\n  \u003c!-- component props --\u003e\n    \u003c!-- pending --\u003e\n    \u003c!-- component --\u003e\n    \u003c!-- alt --\u003e\n\u003c/Query\u003e\n```\n---\n\n### Mutate Component\n\n```html\n\u003cscript\u003e\n  import { Mutate } from \"hasurafire\";\n  const variables = {};\n\u003c/script\u003e\n\n\u003cMutate started {mutation} {variables} let:execute let:response on:response on:error\u003e\n  \u003c!-- prop: started, which is passed if mutation is to be started on mount --\u003e\n  \u003c!-- prop: mutation, which accepts three types of input mutationName|stringMutation|gqlTagMutation --\u003e\n  \u003c!-- Here you have access to execute function, calling this function will execute this mutation --\u003e\n  \u003c!-- Here you have access to response object [graphql mutation response] --\u003e\n  \u003c!-- let:response response of mutation --\u003e\n  \u003c!-- let:data response.data object --\u003e\n  \u003c!-- let:error error if any --\u003e\n  \u003c!-- bind:response response of mutation --\u003e\n  \u003c!-- bind:data response.data object --\u003e\n  \u003c!-- bind:error error if any --\u003e\n  \u003c!-- on:response is fired when new response is recieved from mutation --\u003e\n  \u003c!-- on:error  is fired when some error occurs while quering --\u003e\n  \u003c!-- optional prop: variables, which accepts an object containing all the variables needed for this graplql mutation --\u003e\n  \u003c!-- optional prop: every, which accepts some number in seconds after which re-execute this mutation --\u003e\n  \u003c!-- optional prop: started, which accepts some boolean value (not used with every prop) to start quering on mount) --\u003e\n  \u003c!-- optional prop: role, do this mutation hasura using a specific role --\u003e\n  \u003c!-- optional prop: headers, do this mutation while passing custom request headers to hasura --\u003e\n  \u003c!-- optional prop: noauth, do this mutation without authentication --\u003e\n  \u003c!-- optional prop: adminsecret, do this mutation using admin secret insead of firebase auth --\u003e\n  \u003c!-- slot:default if mutation successfull --\u003e\n  \u003c!-- slot:error if some problem occours while mutating --\u003e\n  \u003c!-- slot:pending while mutation is being executed --\u003e\n  \u003c!-- slot:start which is rendered all the time--\u003e\n  \u003c!-- slot:end which is rendered all the time--\u003e\n  \u003c!-- component props --\u003e\n    \u003c!-- pending --\u003e\n    \u003c!-- component --\u003e\n    \u003c!-- alt --\u003e\n\u003c/Mutate\u003e\n```\n---\n\n### Subscribe Component\n\n```html\n\u003cscript\u003e\n  import { Subscribe } from \"hasurafire\";\n  const variables = {};\n\u003c/script\u003e\n\n\u003cSubscribe {query} {variables} let:response on:response\u003e\n  \u003c!-- prop: query, which accepts three types of input queryName|stringQuery|gqlTagQuery --\u003e\n  \u003c!-- Here you have access to response object [graphql subscription response] --\u003e\n  \u003c!-- let:response response of query --\u003e\n  \u003c!-- let:data response.data object --\u003e\n  \u003c!-- let:error error if any --\u003e\n  \u003c!-- bind:response response of query --\u003e\n  \u003c!-- bind:data response.data object --\u003e\n  \u003c!-- bind:error error if any --\u003e\n  \u003c!-- on:response is fired when new response is recieved from subscription --\u003e\n  \u003c!-- optional prop: variables, which accepts an object containing all the variables needed for this graplql subscription --\u003e\n  \u003c!-- optional prop: role, do this query hasura using a specific role --\u003e\n  \u003c!-- optional prop: headers, do this query while passing custom request headers to hasura --\u003e\n  \u003c!-- optional prop: noauth, do this query without authentication --\u003e\n  \u003c!-- optional prop: adminsecret, do this query using admin secret insead of firebase auth --\u003e\n  \u003c!-- slot:default if subscription successfull --\u003e\n  \u003c!-- slot:pending while subscribing --\u003e\n  \u003c!-- slot:start which is rendered all the time--\u003e\n  \u003c!-- slot:end which is rendered all the time--\u003e\n  \u003c!-- component props --\u003e\n    \u003c!-- pending --\u003e\n    \u003c!-- component --\u003e\n    \u003c!-- alt --\u003e\n\u003c/Subscribe\u003e\n```\n---\n\n### query:\n\n- Type: function\n- Parameters:\n  - query\n  - variables (optional)\n  - options (optional) e.g. { role, headers, noauth, adminsecret }\n- Returns\n  - graphql query response\n---\n\n### mutate:\n\n- Type: function\n- Parameters:\n  - mutatation\n  - variables (optional)\n  - options (optional) e.g. { role, headers, noauth, adminsecret }\n- Returns\n  - graphql mutatation response\n---\n\n### subscribe:\n\n- Type: function\n- Parameters:\n  - query\n  - variables (optional)\n  - options (optional) e.g. { role, headers, noauth, adminsecret }\n- Returns\n  - object\n    - observable\n      - qraphql subscription observable\n    - client\n      - client.close() function to disconnect this websocket connection\n---\n\n### firebase\n\n- svelte store for firebase object\n---\n\n### user\n\n- firebase current user\n---\n\n### loginStatus\n\n- -1 if signed out\n- 0 if not sure (pending)\n- 1 if signed in\n---\n\n### accessToken\n\n- JWT access token of currently signed-in user\n---\n\n### global\n\n- fallback values for query, mutation and subscription variables\n---\n\n### signInWithGoogle\n\n- call this function to signin with popup with google\n---\n\n### signInWithGithub\n\n- call this function to signin with popup with github\n---\n\n### signInWithFacebook\n\n- call this function to signin with popup with facebook\n---\n\n### signInWithTwitter\n\n- call this function to signin with popup with twitter\n---\n\n### signInWithOAuth\n\n- call this function to signin with popup with 0Auth\n---\n\n### signInWithGoogleRedirect\n\n- call this function to signin with redirect with google\n---\n\n### signInWithGithubRedirect\n\n- call this function to signin with redirect with github\n---\n\n### signInWithFacebookRedirect\n\n- call this function to signin with redirect with facebook\n---\n\n### signInWithTwitterRedirect\n\n- call this function to signin with redirect with twitter\n---\n\n### signInWithOAuthRedirect\n\n- call this function to signin with redirect with 0Auth\n---\n\n### signIn\n\n- call this function to signin with email and password\n- accepts email and password\n---\n\n### verifyEmail\n\n- call this function to send verification email to user\n---\n\n### updateProfile\n\n- call this function to update user's profile\n- accepts an object\n```javascript\n{\n  displayName: \"\", // optional\n  photoURL: \"\" // optional\n}\n```\n---\n\n### updateEmail\n\n- call this function to update user's email\n- accepts email\n---\n\n### updatePassword\n\n- call this function to update user's password\n- accepts password\n---\n\n### resetPassword\n\n- call this function to send password reset email to user\n---\n\n### signOut\n\n- call this function to signout\n---\n\n### deleteAccount\n\n- call this function to delete user's account\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimsamtar%2Fhasurafire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimsamtar%2Fhasurafire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimsamtar%2Fhasurafire/lists"}