Socket
Socket
Sign inDemoInstall

svelte-session-manager

Package Overview
Dependencies
0
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.7 to 1.1.8

19

package.json
{
"name": "svelte-session-manager",
"version": "1.1.7",
"version": "1.1.8",
"publishConfig": {

@@ -24,4 +24,5 @@ "access": "public"

"scripts": {
"start": "rollup -c example/rollup.config.mjs -w",
"test": "testcafe $BROWSER:headless tests/*-test.js -s test-results --app-init-delay 1000 --app \"rollup -c example/rollup.config.mjs -w\"",
"start": "rollup -c tests/app/rollup.config.mjs -w",
"test": "npm run test:cafe",
"test:cafe": "testcafe $BROWSER:headless tests/cafe/*.js -s build/test --app-init-delay 1000 --app \"rollup -c tests/app/rollup.config.mjs -w\"",
"docs": "documentation readme ./src/index.mjs --section=API",

@@ -31,11 +32,11 @@ "lint": "documentation lint ./src/index.mjs"

"devDependencies": {
"@rollup/plugin-node-resolve": "^8.4.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"documentation": "^13.0.2",
"jsonwebtoken": "^8.5.1",
"rollup": "^2.23.0",
"rollup": "^2.32.0",
"rollup-plugin-dev": "^1.1.2",
"rollup-plugin-svelte": "git+https://github.com/ctavan/rollup-plugin-svelte.git#handle-missing-exports-gracefully",
"semantic-release": "^17.1.1",
"svelte": "^3.24.0",
"testcafe": "^1.8.8"
"rollup-plugin-svelte": "^6.0.2",
"semantic-release": "^17.2.1",
"svelte": "^3.29.0",
"testcafe": "^1.9.4"
},

@@ -42,0 +43,0 @@ "repository": {

@@ -7,5 +7,2 @@ [![Svelte v3](https://img.shields.io/badge/svelte-v3-orange.svg)](https://svelte.dev)

[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/arlac77/svelte-session-manager.git)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Known Vulnerabilities](https://snyk.io/test/github/arlac77/svelte-session-manager/badge.svg)](https://snyk.io/test/github/arlac77/svelte-session-manager)

@@ -63,118 +60,4 @@ # svelte-session-manager

### Table of Contents
## Table of Contents
- [SessionData](#sessiondata)
- [Properties](#properties)
- [Session](#session)
- [Parameters](#parameters)
- [Properties](#properties-1)
- [clear](#clear)
- [save](#save)
- [authorizationHeader](#authorizationheader)
- [isValid](#isvalid)
- [invalidate](#invalidate)
- [subscribe](#subscribe)
- [Parameters](#parameters-1)
- [login](#login)
- [Parameters](#parameters-2)
- [handleFailedResponse](#handlefailedresponse)
- [Parameters](#parameters-3)
## SessionData
Data as preserved in the backing store
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
### Properties
- `username` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** user name (id)
- `access_token` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** JWT token
## Session
User session
To create as session backed by browser local storage
```js
let session = new Session(localStorage);
```
or by browser session storage
```js
let session = new Session(sessionStorage);
```
### Parameters
- `data` **[SessionData](#sessiondata)**
### Properties
- `entitlements` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**
- `subscriptions` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** store subscriptions
- `expirationDate` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)**
- `access_token` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** token itself
- `store` **[SessionData](#sessiondata)** backing store to use for save same as data param
### clear
Invalidate session data
### save
persist into the backing store
### authorizationHeader
http header suitable for fetch
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** header The http header.
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** header.Authorization The Bearer access token.
### isValid
As long as the expirationTimer is running we must be valid
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if session is valid (not expired)
### invalidate
remove all tokens from the session and the backing store
### subscribe
Fired when the session changes
#### Parameters
- `subscription` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
## login
Bring session into the valid state by calling the authorization endpoint
and asking for a access_token.
Executess a POST on the endpoint url providing username, and password as json
### Parameters
- `session` **[Session](#session)** to be opened
- `endpoint` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** authorization url
- `username` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** id of the user
- `password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** user credentials
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** error message in case of failure or undefined on success
## handleFailedResponse
Extract error description from response
### Parameters
- `response`
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
# install

@@ -181,0 +64,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc