Comparing version 2.0.1 to 3.0.0-beta.1
{ | ||
"name": "stytch", | ||
"version": "2.0.1", | ||
"version": "3.0.0-beta.1", | ||
"description": "A wrapper for the Stytch API", | ||
"main": "lib/stytch.js", | ||
"types": "./index.d.ts", | ||
"types": "./types/lib/index.d.ts", | ||
"main": "./dist/index.js", | ||
"exports": { | ||
"require": "./dist/index.js", | ||
"import": "./module.mjs" | ||
}, | ||
"files": [ | ||
"dist/**/*", | ||
"types/**/*" | ||
], | ||
"repository": { | ||
@@ -12,4 +20,6 @@ "type": "git", | ||
"scripts": { | ||
"build": "babel lib --out-dir dist --extensions '.ts' && tsc --declaration --outDir types --emitDeclarationOnly", | ||
"lint": "eslint lib", | ||
"test": "mocha --recursive" | ||
"test": "jest", | ||
"test-packages": "./test-packages/test.sh" | ||
}, | ||
@@ -22,16 +32,19 @@ "author": "Stytch", | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"eslint": "^3.18.0", | ||
"eslint-config-airbnb": "^14.1.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^4.0.0", | ||
"eslint-plugin-react": "^6.10.3", | ||
"mocha": "^5.2.0", | ||
"sinon": "^11.1.1" | ||
"@babel/cli": "^7.14.5", | ||
"@babel/core": "^7.14.6", | ||
"@babel/preset-env": "^7.14.7", | ||
"@babel/preset-typescript": "^7.14.5", | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^15.12.4", | ||
"@typescript-eslint/eslint-plugin": "^4.28.0", | ||
"@typescript-eslint/parser": "^4.28.0", | ||
"eslint": "^7.29.0", | ||
"jest": "^27.0.5", | ||
"prettier": "2.3.1", | ||
"ts-jest": "^27.0.3", | ||
"typescript": "^4.3.4" | ||
}, | ||
"dependencies": { | ||
"axios": "^0.21.1", | ||
"moment": "^2.17.1", | ||
"request": "^2.55.0", | ||
"tsc": "^1.20150623.0" | ||
"request": "^2.55.0" | ||
}, | ||
@@ -38,0 +51,0 @@ "eslintConfig": { |
# stytch-node | ||
The Stytch Node library provides support for the Stytch API for server-side Javscript applications. You can find out more about the Stytch API at | ||
The Stytch Node library provides support for the Stytch API for server-side Javscript | ||
applications. You can find out more about the Stytch API at | ||
[stytch.com/docs](https://stytch.com/docs). | ||
If you're looking for frontend support for our Javascript SDK, check out [stytch-js](https://www.npmjs.com/package/@stytch/stytch-js). | ||
If you're looking for frontend support for our Javascript SDK, check out | ||
[stytch-js](https://www.npmjs.com/package/@stytch/stytch-js). | ||
## Quickstart | ||
Install stytch | ||
@@ -14,35 +17,34 @@ ``` | ||
Example `login_or_create` usage | ||
Run `login_or_create` to send a magic link by email: | ||
```javascript | ||
import Stytch from 'stytch'; | ||
import * as stytch from "stytch"; | ||
// Or as a CommonJS module: | ||
// const stytch = require("stytch"); | ||
const stytchClient = new Stytch.Client({ | ||
const client = new stytch.Client({ | ||
project_id: "PROJECT_ID", | ||
secret: "SECRET", | ||
env: Stytch.envs.test | ||
secret: "SECRET", | ||
env: stytch.envs.test, | ||
}); | ||
client.magicLinks.email | ||
.loginOrCreate({ | ||
email: "sandbox@stytch.com", | ||
login_magic_link_url: "http://localhost:8000/login", | ||
signup_magic_link_url: "http://localhost:8000/signup", | ||
}) | ||
.then((res) => console.log(res)) | ||
.catch((err) => console.error(err)); | ||
const loginOrCreateWithMagicLink = async () => { | ||
const params: Stytch.loginOrCreateRequest = { | ||
email: 'sandbox@stytch.com', | ||
login_magic_link_url: 'https://www.stytch.com/login', | ||
signup_magic_link_url: 'https://www.stytch.com/signup', | ||
}; | ||
client.magicLinks | ||
.authenticate("TOKEN FROM EMAIL") | ||
.then((res) => console.log(res)) | ||
.catch((err) => console.error(err)); | ||
``` | ||
const response: Stytch.loginOrCreateResponse = await stytchClient.loginOrCreate(params); | ||
## Documentation | ||
console.log(response); | ||
}; | ||
const authenticateMagicLink = async (token) => { | ||
const response: Stytch.authenticateMagicLinkResponse = await stytchClient.authenticateMagicLink(token); | ||
console.log(response); | ||
}; | ||
loginOrCreateWithMagicLink().then().catch(err => console.log(err)); | ||
authenticateMagicLink('token from email').then().catch(err => console.log(err)); | ||
``` | ||
You can find all the documentation at https://stytch.com/docs, including an | ||
[API reference](https://stytch.com/docs/api) with example usage for every endpoint. We also | ||
maintain a set of [example apps](https://stytch.com/docs/example-apps) to start development from. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27321
2
19
50
13
587
2
1
- Removedmoment@^2.17.1
- Removedtsc@^1.20150623.0
- Removedmoment@2.30.1(transitive)
- Removedtsc@1.20150623.0(transitive)