lambder 1.0.88 → 1.0.90
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/Lambder.d.ts +4 -3
- package/dist/Lambder.js +2 -3
- package/package.json +1 -1
- package/src/Lambder.ts +8 -4
package/dist/Lambder.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ type LambderRenderContext = {
|
|
|
25
25
|
session: LambderSession | null;
|
|
26
26
|
lambdaContext: Context;
|
|
27
27
|
};
|
|
28
|
+
type LambderModuleFunction = (lambderInstance: Lambder) => void | Promise<void>;
|
|
28
29
|
type ConditionFunction = (ctx: LambderRenderContext) => boolean;
|
|
29
30
|
type ActionFunction = (ctx: LambderRenderContext, resolver: LambderResolver) => LambderResolverResponse | Promise<LambderResolverResponse>;
|
|
30
31
|
type HookCreatedFunction = (lambderInstance: Lambder) => Promise<void>;
|
|
@@ -58,9 +59,9 @@ export default class Lambder {
|
|
|
58
59
|
testPatternMatch(pattern: string, path: string): boolean;
|
|
59
60
|
private validateSession;
|
|
60
61
|
private handleNoMatchedAction;
|
|
61
|
-
addModule(moduleFn:
|
|
62
|
-
|
|
63
|
-
default:
|
|
62
|
+
addModule(moduleFn: LambderModuleFunction): Promise<void>;
|
|
63
|
+
importModule(moduleImport: Promise<{
|
|
64
|
+
default: LambderModuleFunction;
|
|
64
65
|
}>): Promise<void>;
|
|
65
66
|
addRoute(condition: Path | ConditionFunction | RegExp, actionFn: ActionFunction): void;
|
|
66
67
|
addSessionRoute(condition: Path | ConditionFunction | RegExp, actionFn: ActionFunction): void;
|
package/dist/Lambder.js
CHANGED
|
@@ -114,9 +114,8 @@ export default class Lambder {
|
|
|
114
114
|
async addModule(moduleFn) {
|
|
115
115
|
await moduleFn(this);
|
|
116
116
|
}
|
|
117
|
-
async
|
|
118
|
-
|
|
119
|
-
await module.default(this);
|
|
117
|
+
async importModule(moduleImport) {
|
|
118
|
+
await (await moduleImport).default(this);
|
|
120
119
|
}
|
|
121
120
|
addRoute(condition, actionFn) {
|
|
122
121
|
this.actionList.push({
|
package/package.json
CHANGED
package/src/Lambder.ts
CHANGED
|
@@ -33,6 +33,9 @@ type LambderRenderContext = {
|
|
|
33
33
|
lambdaContext: Context;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
type LambderModuleFunction = (lambderInstance: Lambder) => void | Promise<void>;
|
|
37
|
+
|
|
38
|
+
|
|
36
39
|
type ConditionFunction = (ctx: LambderRenderContext) => boolean;
|
|
37
40
|
type ActionFunction = (ctx: LambderRenderContext, resolver: LambderResolver) => LambderResolverResponse|Promise<LambderResolverResponse>;
|
|
38
41
|
type ActionObject = { conditionFn: ConditionFunction, actionFn: ActionFunction };
|
|
@@ -158,13 +161,14 @@ export default class Lambder {
|
|
|
158
161
|
}
|
|
159
162
|
}
|
|
160
163
|
|
|
161
|
-
async addModule(moduleFn:
|
|
164
|
+
async addModule(moduleFn: LambderModuleFunction): Promise<void>{
|
|
162
165
|
await moduleFn(this);
|
|
163
166
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
await
|
|
167
|
+
|
|
168
|
+
async importModule(moduleImport: Promise<{ default: LambderModuleFunction }>): Promise<void>{
|
|
169
|
+
await (await moduleImport).default(this);
|
|
167
170
|
}
|
|
171
|
+
|
|
168
172
|
addRoute(condition: Path|ConditionFunction|RegExp, actionFn: ActionFunction):void{
|
|
169
173
|
this.actionList.push({
|
|
170
174
|
conditionFn: (ctx:LambderRenderContext) => (
|