structured-fw 1.7.3 → 1.7.5
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/README.md
CHANGED
|
@@ -146,6 +146,7 @@ new Application(config);
|
|
|
146
146
|
- `sessionsStop` - runs after session handling is disabled, payload is instance of `Session`
|
|
147
147
|
- `sessionCreated` - runs after a new session is created, payload is `SessionEntry`
|
|
148
148
|
- `sessionExpired` - runs after a session expires, payload is `sessionId`
|
|
149
|
+
- `sessionExtended` - runs after client with an existing session makes a request, payload is `sessionId`
|
|
149
150
|
- `sessionValueSet` - runs after a value is set in session, payload is `[sessionId, key, value]`
|
|
150
151
|
- `sessionValueRemove` - runs after a value is removed from session, payload is `[sessionId, key]`
|
|
151
152
|
- `sessionClear` - runs after session data is cleared, payload is `string` (sessionId)
|
|
@@ -26,7 +26,7 @@ export declare class Application {
|
|
|
26
26
|
constructor(config: StructuredConfig);
|
|
27
27
|
init(): Promise<void>;
|
|
28
28
|
private start;
|
|
29
|
-
on<E extends ApplicationEvents>(evt: E, callback: (payload: E extends 'beforeRequestHandler' | 'afterRequestHandler' | 'beforeAssetAccess' | 'afterAssetAccess' | 'pageNotFound' | 'requestHandleError' ? RequestContext<RequestContextData> : E extends 'documentCreated' ? Document : E extends 'afterComponentsLoaded' ? Components : E extends 'serverStarted' ? Server : E extends 'sessionsStart' ? Session : E extends 'sessionsStop' ? Session : E extends 'sessionCreated' ? SessionEntry : E extends 'sessionExpired' ? string : E extends 'sessionValueSet' ? [string, string, any] : E extends 'sessionValueRemove' ? [string, string] :
|
|
29
|
+
on<E extends ApplicationEvents>(evt: E, callback: (payload: E extends 'beforeRequestHandler' | 'afterRequestHandler' | 'beforeAssetAccess' | 'afterAssetAccess' | 'pageNotFound' | 'requestHandleError' ? RequestContext<RequestContextData> : E extends 'documentCreated' ? Document : E extends 'afterComponentsLoaded' ? Components : E extends 'serverStarted' ? Server : E extends 'sessionsStart' ? Session : E extends 'sessionsStop' ? Session : E extends 'sessionCreated' ? SessionEntry : E extends 'sessionExpired' | 'sessionExtended' | 'sessionClear' ? string : E extends 'sessionValueSet' ? [string, string, any] : E extends 'sessionValueRemove' ? [string, string] : undefined) => void): void;
|
|
30
30
|
emit(eventName: ApplicationEvents, payload?: any): Promise<Array<any>>;
|
|
31
31
|
importEnv<T extends LooseObject>(smartPrimitives?: boolean): T;
|
|
32
32
|
exportContextFields(...fields: Array<keyof RequestContextData>): void;
|
|
@@ -17,6 +17,7 @@ export class Session {
|
|
|
17
17
|
if (ctx.sessionId) {
|
|
18
18
|
this.application.cookies.set(ctx.response, this.application.config.session.cookieName, ctx.sessionId, this.application.config.session.durationSeconds);
|
|
19
19
|
this.sessions[ctx.sessionId].lastRequest = new Date().getTime();
|
|
20
|
+
this.application.emit('sessionExtended', ctx.sessionId);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type ApplicationEvents = 'serverStarted' | 'beforeRequestHandler' | 'afterRequestHandler' | 'requestHandleError' | 'beforeRoutes' | 'afterRoutes' | 'beforeComponentsLoad' | 'afterComponentsLoaded' | 'documentCreated' | 'beforeAssetAccess' | 'afterAssetAccess' | 'pageNotFound' | 'sessionsStart' | 'sessionsStop' | 'sessionCreated' | 'sessionExpired' | 'sessionValueSet' | 'sessionValueRemove' | 'sessionClear';
|
|
1
|
+
export type ApplicationEvents = 'serverStarted' | 'beforeRequestHandler' | 'afterRequestHandler' | 'requestHandleError' | 'beforeRoutes' | 'afterRoutes' | 'beforeComponentsLoad' | 'afterComponentsLoaded' | 'documentCreated' | 'beforeAssetAccess' | 'afterAssetAccess' | 'pageNotFound' | 'sessionsStart' | 'sessionsStop' | 'sessionCreated' | 'sessionExtended' | 'sessionExpired' | 'sessionValueSet' | 'sessionValueRemove' | 'sessionClear';
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"main": "build/index",
|
|
22
|
-
"version": "1.7.
|
|
22
|
+
"version": "1.7.5",
|
|
23
23
|
"scripts": {
|
|
24
24
|
"develop": "tsc --watch",
|
|
25
25
|
"startDev": "cd build && nodemon --watch '../app/**/*' --watch '../build/**/*' -e js,html,hbs,css index.js",
|