lambder 1.0.86 → 1.0.88
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 +1 -1
- package/dist/Lambder.d.ts +3 -0
- package/dist/Lambder.js +4 -0
- package/package.json +1 -1
- package/src/Lambder.ts +4 -0
package/Readme.md
CHANGED
|
@@ -191,7 +191,7 @@ lambder.addApi("getCompanyName", async (ctx, res) => {
|
|
|
191
191
|
// attempts to serve the fallback file.
|
|
192
192
|
// Returns a JSON error if neither file is found.
|
|
193
193
|
|
|
194
|
-
return res.api({ payload,
|
|
194
|
+
return res.api({ payload, notAuthorized, message, errorMessage }, headers);
|
|
195
195
|
// This function works together with the LambderCaller from the frontend.
|
|
196
196
|
// Sends a standardized API response including the payload and status
|
|
197
197
|
// flags like versionExpired, sessionExpired, notAuthorized, along with
|
package/dist/Lambder.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ export default class Lambder {
|
|
|
59
59
|
private validateSession;
|
|
60
60
|
private handleNoMatchedAction;
|
|
61
61
|
addModule(moduleFn: Function): Promise<void>;
|
|
62
|
+
addModuleImport(moduleImport: Promise<{
|
|
63
|
+
default: Function;
|
|
64
|
+
}>): Promise<void>;
|
|
62
65
|
addRoute(condition: Path | ConditionFunction | RegExp, actionFn: ActionFunction): void;
|
|
63
66
|
addSessionRoute(condition: Path | ConditionFunction | RegExp, actionFn: ActionFunction): void;
|
|
64
67
|
addApi(apiName: string | ConditionFunction | RegExp, actionFn: ActionFunction): void;
|
package/dist/Lambder.js
CHANGED
|
@@ -114,6 +114,10 @@ export default class Lambder {
|
|
|
114
114
|
async addModule(moduleFn) {
|
|
115
115
|
await moduleFn(this);
|
|
116
116
|
}
|
|
117
|
+
async addModuleImport(moduleImport) {
|
|
118
|
+
const module = await moduleImport;
|
|
119
|
+
await module.default(this);
|
|
120
|
+
}
|
|
117
121
|
addRoute(condition, actionFn) {
|
|
118
122
|
this.actionList.push({
|
|
119
123
|
conditionFn: (ctx) => (ctx.method === "GET" &&
|
package/package.json
CHANGED
package/src/Lambder.ts
CHANGED
|
@@ -161,6 +161,10 @@ export default class Lambder {
|
|
|
161
161
|
async addModule(moduleFn: Function): Promise<void>{
|
|
162
162
|
await moduleFn(this);
|
|
163
163
|
}
|
|
164
|
+
async addModuleImport(moduleImport: Promise<{ default: Function }>): Promise<void>{
|
|
165
|
+
const module = await moduleImport;
|
|
166
|
+
await module.default(this);
|
|
167
|
+
}
|
|
164
168
|
addRoute(condition: Path|ConditionFunction|RegExp, actionFn: ActionFunction):void{
|
|
165
169
|
this.actionList.push({
|
|
166
170
|
conditionFn: (ctx:LambderRenderContext) => (
|