@stanlemon/react-couchdb-authentication
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -7,3 +7,3 @@ import * as React from "react"; | ||
*/ | ||
children?: React.ReactElement<{}>; | ||
children?: React.ReactElement; | ||
/** | ||
@@ -44,3 +44,3 @@ * Adapter for use by the local PouchDB instance, defaults to "idb". | ||
*/ | ||
loading?: React.ReactElement<{}>; | ||
loading?: React.ReactElement; | ||
} | ||
@@ -47,0 +47,0 @@ interface State { |
@@ -12,2 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Authentication = exports.AuthenticationContext = void 0; | ||
const React = require("react"); | ||
@@ -36,3 +37,3 @@ const pouchdb_1 = require("pouchdb"); | ||
// Internal route path, defaults to the login screen | ||
internalRoute: ROUTE_LOGIN | ||
internalRoute: ROUTE_LOGIN, | ||
}; | ||
@@ -42,3 +43,3 @@ this.signUp = (username, password, email) => __awaiter(this, void 0, void 0, function* () { | ||
this.setState({ | ||
error: "Username, password and email are required fields." | ||
error: "Username, password and email are required fields.", | ||
}); | ||
@@ -55,3 +56,3 @@ return; | ||
// TODO: Allow for any metadata | ||
metadata: { email } | ||
metadata: { email }, | ||
}; | ||
@@ -61,3 +62,3 @@ try { | ||
method: "PUT", | ||
body: JSON.stringify(user) | ||
body: JSON.stringify(user), | ||
}); | ||
@@ -82,3 +83,3 @@ if (response.error) { | ||
yield this.fetch(this.props.url + "_session", { | ||
method: "DELETE" | ||
method: "DELETE", | ||
}); | ||
@@ -89,3 +90,3 @@ // Clear the user and redirect them to our login screen | ||
authenticated: false, | ||
internalRoute: ROUTE_LOGIN | ||
internalRoute: ROUTE_LOGIN, | ||
}); | ||
@@ -105,3 +106,3 @@ } | ||
method: "POST", | ||
body: JSON.stringify({ username, password }) | ||
body: JSON.stringify({ username, password }), | ||
}); | ||
@@ -161,5 +162,5 @@ this.setState({ authenticated: true, user }); | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
})).then(r => r.json()); | ||
"Content-Type": "application/json", | ||
}, | ||
})).then((r) => r.json()); | ||
} | ||
@@ -175,3 +176,3 @@ checkSession() { | ||
authenticated: isLoggedIn, | ||
user: session.userCtx | ||
user: session.userCtx, | ||
}); | ||
@@ -191,3 +192,3 @@ // If we are logged in and have not yet setup our remote db connection, set it up | ||
this.localDb = new pouchdb_1.default("user", { | ||
adapter: this.props.adapter | ||
adapter: this.props.adapter, | ||
}); | ||
@@ -200,3 +201,3 @@ const opts = { | ||
return pouchdb_1.default.fetch(url, opts); | ||
} | ||
}, | ||
}; | ||
@@ -213,9 +214,9 @@ const userDbUrl = this.getUserDbUrl(this.state.user.name); | ||
live: true, | ||
retry: true | ||
retry: true, | ||
}); | ||
this.syncHandler | ||
.on("change", info => this.log("Change", info)) | ||
.on("paused", err => this.error("Paused", err)) | ||
.on("complete", info => this.log("Complete", info)) | ||
.on("error", err => this.error("Error", err)); | ||
.on("change", (info) => this.log("Change", info)) | ||
.on("paused", (err) => this.error("Paused", err)) | ||
.on("complete", (info) => this.log("Complete", info)) | ||
.on("error", (err) => this.error("Error", err)); | ||
} | ||
@@ -254,6 +255,6 @@ componentDidMount() { | ||
error: null, | ||
internalRoute: ROUTE_LOGIN | ||
internalRoute: ROUTE_LOGIN, | ||
}), | ||
error: this.state.error, | ||
signUp: this.signUp | ||
signUp: this.signUp, | ||
}; | ||
@@ -271,6 +272,6 @@ if (!React.isValidElement(this.props.signup)) { | ||
error: null, | ||
internalRoute: ROUTE_SIGNUP | ||
internalRoute: ROUTE_SIGNUP, | ||
}), | ||
error: this.state.error, | ||
login: this.login | ||
login: this.login, | ||
}; | ||
@@ -293,3 +294,3 @@ // If we aren't on the signup screen we should return the login screen | ||
logout: this.logout, | ||
user: this.state.user | ||
user: this.state.user, | ||
}; | ||
@@ -311,4 +312,4 @@ // TODO: Remove the props overrides, the Context should be the only way to get these. | ||
sync: true, | ||
adapter: "idb" | ||
adapter: "idb", | ||
}; | ||
//# sourceMappingURL=Authentication.js.map |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./SignUp")); | ||
__export(require("./SignUpView")); | ||
__export(require("./Login")); | ||
__export(require("./LoginView")); | ||
__exportStar(require("./SignUp"), exports); | ||
__exportStar(require("./SignUpView"), exports); | ||
__exportStar(require("./Login"), exports); | ||
__exportStar(require("./LoginView"), exports); | ||
//# sourceMappingURL=index.js.map |
import * as React from "react"; | ||
import { LoginView } from "./LoginView"; | ||
interface Props { | ||
component?: React.ReactElement<{}>; | ||
component?: React.ReactElement; | ||
error?: string; | ||
@@ -6,0 +6,0 @@ login?(username: string, password: string): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Login = void 0; | ||
const React = require("react"); | ||
@@ -10,3 +11,3 @@ const LoginView_1 = require("./LoginView"); | ||
username: "", | ||
password: "" | ||
password: "", | ||
}; | ||
@@ -27,3 +28,3 @@ this.setUsername = (event) => this.setState({ username: event.target.value }); | ||
password: this.state.password, | ||
setPassword: this.setPassword | ||
setPassword: this.setPassword, | ||
}; | ||
@@ -40,4 +41,4 @@ if (!React.isValidElement(this.props.component)) { | ||
Login.defaultProps = { | ||
component: LoginView_1.LoginView | ||
component: LoginView_1.LoginView, | ||
}; | ||
//# sourceMappingURL=Login.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LoginView = void 0; | ||
const React = require("react"); | ||
@@ -4,0 +5,0 @@ function LoginView(props) { |
import * as React from "react"; | ||
import { SignUpView } from "./SignUpView"; | ||
interface Props { | ||
component?: React.ReactElement<{}>; | ||
component?: React.ReactElement; | ||
error?: string; | ||
@@ -6,0 +6,0 @@ signUp?(username: string, password: string, email: string): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SignUp = void 0; | ||
const React = require("react"); | ||
@@ -11,3 +12,3 @@ const SignUpView_1 = require("./SignUpView"); | ||
email: "", | ||
password: "" | ||
password: "", | ||
}; | ||
@@ -33,3 +34,3 @@ this.setUsername = (event) => { | ||
password: this.state.password, | ||
setPassword: this.setPassword | ||
setPassword: this.setPassword, | ||
}; | ||
@@ -46,4 +47,4 @@ if (!React.isValidElement(this.props.component)) { | ||
SignUp.defaultProps = { | ||
component: SignUpView_1.SignUpView | ||
component: SignUpView_1.SignUpView, | ||
}; | ||
//# sourceMappingURL=SignUp.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SignUpView = void 0; | ||
const React = require("react"); | ||
@@ -4,0 +5,0 @@ function SignUpView(props) { |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./Authentication")); | ||
__exportStar(require("./Authentication"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@stanlemon/react-couchdb-authentication", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "React component for authenticating against a CouchDB user db and syncing it locally with PouchDB.", | ||
@@ -18,4 +18,4 @@ "keywords": [ | ||
"test": "jest", | ||
"lint": "eslint --ext js,jsx,ts,tsx ./src/", | ||
"eslint-check": "eslint --print-config . | eslint-config-prettier-check" | ||
"lint": "eslint --ext js,jsx,ts,tsx ./src/ ./example/", | ||
"example": "parcel --out-dir ./example/out/ ./example/index.html" | ||
}, | ||
@@ -28,2 +28,13 @@ "author": "Stan Lemon <stanlemon@users.noreply.github.com>", | ||
"license": "MIT", | ||
"browserslist": [ | ||
"last 1 year, not dead", | ||
"edge > 18", | ||
"not ie 11", | ||
"not ie_mob 11", | ||
"not samsung < 1000", | ||
"not opera < 1000", | ||
"not kaios < 1000", | ||
"not android < 1000", | ||
"not and_qq < 1000" | ||
], | ||
"jest": { | ||
@@ -40,2 +51,6 @@ "roots": [ | ||
}, | ||
"testPathIgnorePatterns": [ | ||
"/node_modules/", | ||
"/out/" | ||
], | ||
"transform": { | ||
@@ -46,42 +61,44 @@ "^.+\\.(js|jsx|ts|tsx)?$": "babel-jest" | ||
"peerDependencies": { | ||
"pouchdb": "^7.1.1", | ||
"react": "^16.12.0" | ||
"pouchdb": "^7.2.1", | ||
"react": "^16.13.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.3", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/plugin-transform-runtime": "^7.8.3", | ||
"@babel/preset-env": "^7.8.3", | ||
"@babel/preset-react": "^7.8.3", | ||
"@babel/preset-typescript": "^7.8.3", | ||
"@types/enzyme": "^3.10.4", | ||
"@types/jest": "^24.9.0", | ||
"@types/lodash": "^4.14.149", | ||
"@babel/core": "^7.10.3", | ||
"@babel/plugin-proposal-class-properties": "^7.10.1", | ||
"@babel/plugin-transform-runtime": "^7.10.3", | ||
"@babel/preset-env": "^7.10.3", | ||
"@babel/preset-react": "^7.10.1", | ||
"@babel/preset-typescript": "^7.10.1", | ||
"@types/enzyme": "^3.10.5", | ||
"@types/jest": "^26.0.3", | ||
"@types/lodash": "^4.14.157", | ||
"@types/pouchdb": "^6.4.0", | ||
"@types/react": "^16.9.17", | ||
"@typescript-eslint/eslint-plugin": "^2.16.0", | ||
"@typescript-eslint/parser": "^2.16.0", | ||
"babel-eslint": "^10.0.3", | ||
"babel-jest": "^24.9.0", | ||
"@types/react": "^16.9.41", | ||
"@types/webpack-env": "^1.15.2", | ||
"@typescript-eslint/eslint-plugin": "^3.4.0", | ||
"@typescript-eslint/parser": "^3.4.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-jest": "^26.1.0", | ||
"enzyme": "^3.11.0", | ||
"enzyme-adapter-react-16": "^1.15.2", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.9.0", | ||
"eslint-plugin-jest": "^23.6.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"eslint-plugin-react": "^7.18.0", | ||
"jest": "^24.9.0", | ||
"eslint": "^7.3.1", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-jest": "^23.17.1", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"eslint-plugin-react": "^7.20.0", | ||
"jest": "^26.1.0", | ||
"jest-environment-enzyme": "^7.1.2", | ||
"jest-enzyme": "^7.1.2", | ||
"pouchdb": "^7.1.1", | ||
"pouchdb-adapter-memory": "^7.1.1", | ||
"prettier": "^1.19.1", | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"react-test-renderer": "^16.12.0", | ||
"typescript": "^3.7.5", | ||
"wait-for-expect": "^3.0.1" | ||
"parcel": "^1.12.4", | ||
"pouchdb": "^7.2.1", | ||
"pouchdb-adapter-memory": "^7.2.1", | ||
"prettier": "^2.0.5", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"react-test-renderer": "^16.13.1", | ||
"typescript": "^3.9.5", | ||
"wait-for-expect": "^3.0.2" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.8.3", | ||
"@babel/runtime": "^7.10.3", | ||
"async-retry": "^1.3.1", | ||
@@ -88,0 +105,0 @@ "isomorphic-fetch": "^2.2.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
54435
814
35
Updated@babel/runtime@^7.10.3