sessioncore 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -13
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
if (!session.id ||
|
|
3
|
-
!session.principalId ||
|
|
4
|
-
session.expiresAt <= session.issuedAt)
|
|
5
|
-
throw new TypeError("Invalid session.");
|
|
6
|
-
return Object.freeze({
|
|
7
|
-
...session,
|
|
8
|
-
methods: Object.freeze([...session.methods]),
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
export function isSessionActive(session, now = Date.now()) {
|
|
12
|
-
return session.issuedAt <= now && now < session.expiresAt;
|
|
13
|
-
}
|
|
1
|
+
function r(e){if(!e.id||!e.principalId||e.expiresAt<=e.issuedAt)throw new TypeError("Invalid session.");return Object.freeze({...e,methods:Object.freeze([...e.methods])})}function i(e,t=Date.now()){return e.issuedAt<=t&&t<e.expiresAt}export{r as createSession,i as isSessionActive};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sessioncore",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Framework-neutral session primitives for identity systems.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "tsc --project tsconfig.json",
|
|
22
|
+
"postbuild": "npm run dist --prefix \"$npm_config_local_prefix\" -- \"$PWD\"",
|
|
23
|
+
"prepack": "npm run build",
|
|
22
24
|
"prepublishOnly": "npm run build"
|
|
23
25
|
},
|
|
24
26
|
"keywords": [
|