netlify-graph-auth
Advanced tools
Comparing version 0.0.1-beta.5 to 0.0.1-beta.6
import type { Storage } from './storage'; | ||
declare type Timer = ReturnType<typeof setTimeout>; | ||
export declare type Service = 'adroll' | 'asana' | 'box' | 'contentful' | 'dev-to' | 'dribbble' | 'dropbox' | 'eggheadio' | 'eventil' | 'facebook' | 'firebase' | 'github' | 'gmail' | 'google' | 'google-ads' | 'google-analytics' | 'google-calendar' | 'google-compute' | 'google-docs' | 'google-search-console' | 'google-translate' | 'hubspot' | 'intercom' | 'mailchimp' | 'meetup' | 'netlify' | 'product-hunt' | 'quickbooks' | 'salesforce' | 'slack' | 'spotify' | 'stripe' | 'trello' | 'twilio' | 'twitch-tv' | 'twitter' | 'ynab' | 'youtube' | 'zeit' | 'zendesk'; | ||
export declare type NetlifyGraphAuthService = 'adroll' | 'asana' | 'box' | 'contentful' | 'dev-to' | 'dribbble' | 'dropbox' | 'eggheadio' | 'eventil' | 'facebook' | 'firebase' | 'github' | 'gmail' | 'google' | 'google-ads' | 'google-analytics' | 'google-calendar' | 'google-compute' | 'google-docs' | 'google-search-console' | 'google-translate' | 'hubspot' | 'intercom' | 'mailchimp' | 'meetup' | 'netlify' | 'product-hunt' | 'quickbooks' | 'salesforce' | 'slack' | 'spotify' | 'stripe' | 'trello' | 'twilio' | 'twitch-tv' | 'twitter' | 'ynab' | 'youtube' | 'zeit' | 'zendesk'; | ||
declare type CommunicationMode = 'post_message' | 'redirect'; | ||
@@ -42,3 +42,3 @@ export declare type Opts = { | ||
export declare type ServicesStatus = { | ||
[key in Service]?: ServiceStatus; | ||
[key in NetlifyGraphAuthService]?: ServiceStatus; | ||
}; | ||
@@ -53,3 +53,3 @@ export declare type AuthResponse = { | ||
scopes: Array<string> | undefined; | ||
service: Service; | ||
service: NetlifyGraphAuthService; | ||
stateParam: string; | ||
@@ -61,9 +61,9 @@ useTestFlow: boolean | undefined; | ||
_authWindows: { | ||
[key in Service]?: Window | null; | ||
[key in NetlifyGraphAuthService]?: Window | null; | ||
}; | ||
_intervalIds: { | ||
[key in Service]?: Timer; | ||
[key in NetlifyGraphAuthService]?: Timer; | ||
}; | ||
_messageListeners: { | ||
[key in Service]?: any; | ||
[key in NetlifyGraphAuthService]?: any; | ||
}; | ||
@@ -81,6 +81,6 @@ _fetchUrl: string; | ||
constructor(opts: Opts); | ||
_clearInterval: (service: Service) => void; | ||
_clearMessageListener: (service: Service) => void; | ||
closeAuthWindow: (service: Service) => void; | ||
cleanup: (service: Service, keepWindowOpen?: boolean) => void; | ||
_clearInterval: (service: NetlifyGraphAuthService) => void; | ||
_clearMessageListener: (service: NetlifyGraphAuthService) => void; | ||
closeAuthWindow: (service: NetlifyGraphAuthService) => void; | ||
cleanup: (service: NetlifyGraphAuthService, keepWindowOpen?: boolean) => void; | ||
accessToken: () => Token | null; | ||
@@ -93,12 +93,12 @@ tokenExpireDate: () => Date | null; | ||
}; | ||
friendlyServiceName(service: Service): string; | ||
friendlyServiceName(service: NetlifyGraphAuthService): string; | ||
_makeAuthUrl: (opts: _makeAuthUrlInput) => Promise<string>; | ||
setToken: (token: Token) => void; | ||
_waitForAuthFinishPostMessage: (service: Service, stateParam: StateParam, verifier: string) => Promise<AuthResponse>; | ||
_waitForAuthFinishRedirect: (service: Service, stateParam: StateParam, verifier: string) => Promise<AuthResponse>; | ||
_waitForAuthFinishPostMessage: (service: NetlifyGraphAuthService, stateParam: StateParam, verifier: string) => Promise<AuthResponse>; | ||
_waitForAuthFinishRedirect: (service: NetlifyGraphAuthService, stateParam: StateParam, verifier: string) => Promise<AuthResponse>; | ||
/** | ||
* @throws {OAuthError} | ||
*/ | ||
login: (service: Service, scopes: Array<string> | undefined, useTestFlow?: boolean) => Promise<AuthResponse>; | ||
isLoggedIn: (args: Service | { | ||
login: (service: NetlifyGraphAuthService, scopes: Array<string> | undefined, useTestFlow?: boolean) => Promise<AuthResponse>; | ||
isLoggedIn: (args: NetlifyGraphAuthService | { | ||
foreignUserId?: string; | ||
@@ -110,3 +110,3 @@ service: string; | ||
loggedInServices: () => Promise<LoggedInServices>; | ||
logout: (service: Service, foreignUserId?: string) => Promise<LogoutResult>; | ||
logout: (service: NetlifyGraphAuthService, foreignUserId?: string) => Promise<LogoutResult>; | ||
destroy: () => void; | ||
@@ -113,0 +113,0 @@ findMissingAuthServices: any; |
@@ -819,4 +819,8 @@ "use strict"; | ||
this.destroy = function () { | ||
Object.keys(_this._intervalIds).forEach(function (key) { return _this.cleanup(key); }); | ||
Object.keys(_this._authWindows).forEach(function (key) { return _this.cleanup(key); }); | ||
Object.keys(_this._intervalIds).forEach(function (key) { | ||
return _this.cleanup(key); | ||
}); | ||
Object.keys(_this._authWindows).forEach(function (key) { | ||
return _this.cleanup(key); | ||
}); | ||
_this._storage.removeItem(_this._storageKey); | ||
@@ -823,0 +827,0 @@ _this._accessToken = null; |
export * as default from './auth'; | ||
export * as NetlifyGraphAuth from './auth'; | ||
export { NetlifyGraphAuthService } from './auth'; | ||
export * as OAuthError from './oauthError'; | ||
export { InMemoryStorage, LocalStorage } from './storage'; | ||
export { findMissingAuthServices } from './helpers'; |
{ | ||
"name": "netlify-graph-auth", | ||
"version": "0.0.1-beta.5", | ||
"version": "0.0.1-beta.6", | ||
"description": "Client-side authentication for Netlify GraphQL APIs", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
89195
1317