Comparing version 1.1.0 to 1.1.2
{ | ||
"name": "redisess", | ||
"description": "Powerful redis session manager for NodeJS", | ||
"version": "1.1.0", | ||
"version": "1.1.2", | ||
"author": "Panates Ltd.", | ||
@@ -23,22 +23,22 @@ "contributors": [ | ||
"peerDependencies": { | ||
"ioredis": ">4.17.3" | ||
"ioredis": "^4.x.x" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "^8.0.3", | ||
"@types/node": "^14.6.0", | ||
"@types/ioredis": "^4.17.3", | ||
"@typescript-eslint/eslint-plugin": "^3.9.1", | ||
"@typescript-eslint/parser": "^3.9.1", | ||
"@types/node": "^14.14.2", | ||
"@types/ioredis": "^4.17.6", | ||
"@typescript-eslint/eslint-plugin": "^4.5.0", | ||
"@typescript-eslint/parser": "^4.5.0", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^7.7.0", | ||
"eslint": "^7.12.0", | ||
"eslint-config-google": "^0.14.0", | ||
"mocha": "^8.1.1", | ||
"mocha": "^8.2.0", | ||
"nyc": "^15.1.0", | ||
"ioredis": "^4.17.3", | ||
"ioredis": "^4.19.0", | ||
"rejected-or-not": "^2.0.0", | ||
"ts-cleanup": "^0.2.1", | ||
"ts-loader": "^8.0.2", | ||
"ts-node": "^8.6.2", | ||
"ts-cleanup": "^0.2.2", | ||
"ts-loader": "^8.0.7", | ||
"ts-node": "^9.0.0", | ||
"tsconfig-paths": "^3.9.0", | ||
"typescript": "^3.8.3" | ||
"typescript": "^4.0.3" | ||
}, | ||
@@ -45,0 +45,0 @@ "engines": { |
204
README.md
@@ -68,7 +68,7 @@ | ||
--- | ||
### SessionManager | ||
## SessionManager | ||
#### prototype.count() | ||
### prototype.count() | ||
@@ -85,5 +85,5 @@ Returns the number of sessions within the last n seconds. Get all session count if n is not defined or zero | ||
--- | ||
### prototype.countForUser() | ||
#### prototype.countForUser() | ||
Retrieves session count of single user which were active within the last n seconds. | ||
@@ -100,5 +100,5 @@ | ||
--- | ||
### prototype.create() | ||
#### prototype.create() | ||
Creates a new session for the user | ||
@@ -117,63 +117,249 @@ | ||
--- | ||
#### prototype.get() | ||
Retrieves session by sessionId | ||
`get(sessionId: string, noUpdate: boolean = false): Promise<Session>` | ||
##### Parameters | ||
- sessionId: Id of the session | ||
- noUpdate: Update state of the session | ||
- *Return value :* Returns new created session. | ||
--- | ||
#### prototype.getAllSessions() | ||
Retrieves all session ids which were active within the last n seconds. | ||
`getAllSessions(secs: number): Promise<string[]>` | ||
##### Parameters | ||
- secs: The elapsed time since the last activity of the session. Returns total count of sessions If not defined or zero | ||
- *Return value :* Returns the string array of all sessions. | ||
--- | ||
#### prototype.getAllUsers() | ||
Retrieves all user ids which were active within the last n seconds. | ||
`getAllUsers(secs: number): Promise<string[]>` | ||
##### Parameters | ||
- secs: The elapsed time since the last activity of the session. Returns total count of sessions If not defined or zero | ||
- *Return value :* Returns the string array of all users. | ||
--- | ||
#### prototype.getUserSessions() | ||
Retrieves session ids of single user which were active within the last n seconds. | ||
`getUserSessions(userId: string, n: number = 0): Promise<string[]>` | ||
##### Parameters | ||
- userId: Id of the user | ||
- n: The elapsed time since the last activity of the session. | ||
- *Return value :* Returns the string array of all sessions for an user. | ||
--- | ||
#### prototype.getOldestUserSession() | ||
Retrieves oldest session of user | ||
`getOldestUserSession(userId: string, noUpdate: boolean = false): Promise<Session>` | ||
##### Parameters | ||
- userId: Id of the user | ||
- noUpdate: Update state of the session | ||
- *Return value :* Returns new created session. | ||
--- | ||
#### prototype.exists() | ||
Returns true if sessionId exists, false otherwise | ||
`exists(sessionId: string): Promise<Boolean>` | ||
##### Parameters | ||
- sessionId: Id of the session | ||
- *Return value :* Returns Boolean. | ||
--- | ||
#### prototype.kill() | ||
Kills single session | ||
`kill(sessionId: string): Promise<void>` | ||
##### Parameters | ||
- sessionId: Id of the session | ||
- *Return value :* No return value. | ||
--- | ||
#### prototype.killUser() | ||
Kills all sessions of user | ||
`killUser(userId: string): Promise<void>` | ||
##### Parameters | ||
- userId: Id of the user | ||
- *Return value :* No return value. | ||
--- | ||
#### prototype.killAll() | ||
Kills all sessions for application | ||
`killAll(): Promise<void>` | ||
##### Parameters | ||
- No parameter value | ||
- *Return value :* No return value. | ||
--- | ||
#### prototype.now() | ||
Retrieves present time. | ||
`now(): Promise<number>` | ||
##### Parameters | ||
- No parameter value | ||
- *Return value :* Returns number. | ||
--- | ||
#### prototype.quit() | ||
Stops wipe timer | ||
`quit(): void` | ||
##### Parameters | ||
- No parameter value | ||
- *Return value :* No return value. | ||
--- | ||
## Session | ||
--- | ||
#### prototype.sessionId | ||
Returns session id value | ||
`sessionId(): string` | ||
--- | ||
#### prototype.userId | ||
Returns user id value | ||
`userId(): string` | ||
--- | ||
#### prototype.ttl | ||
Returns Time-To-Live value | ||
`ttl(): number` | ||
--- | ||
#### prototype.lastAccess | ||
Returns the time (unix) of last access | ||
`lastAccess(): number` | ||
--- | ||
#### prototype.expires | ||
Returns the time (unix) that session be expired. | ||
`expires(): number` | ||
--- | ||
#### prototype.expiresIn | ||
Returns duration that session be expired. | ||
`expiresIn(): number` | ||
--- | ||
#### prototype.valid | ||
Returns validation of session and user with last access control. | ||
`valid(): boolean` | ||
--- | ||
#### prototype.idle | ||
Returns idle duration in seconds. | ||
`idle(): number` | ||
--- | ||
#### prototype.[additionalField] | ||
Returns any additional field value | ||
--- | ||
#### prototype.read() | ||
Reads session info from redis server | ||
`read(): Promise<void>` | ||
--- | ||
#### prototype.get() | ||
Retrieves user data from session. | ||
`get(key): Promise<any>` | ||
##### Parameters | ||
- key: string | Array<String> | Object<String,*> | ||
- *Return value :* No return value. | ||
--- | ||
#### prototype.set() | ||
Stores user data to session | ||
`set(key, value): Promise<number>` | ||
##### Parameters | ||
- key: string | Object | ||
- value: * | ||
- *Return value :* Length of values. | ||
--- | ||
#### prototype.kill() | ||
#### prototype.write() | ||
Kills the session | ||
`kill(): Promise<void>` | ||
--- | ||
#### prototype.write() | ||
Write session to redis server. | ||
`write(): Promise<void>` | ||
--- | ||
## Node Compatibility | ||
@@ -180,0 +366,0 @@ |
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
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
54902
387