@alanszp/express 16.1.1 → 16.3.2
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.
|
@@ -9,16 +9,17 @@ export declare type AuthRequest = Request & {
|
|
|
9
9
|
interface Viewable<T> {
|
|
10
10
|
toView: () => T;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
declare type DefaultViewFnReturn<CommandReturnType> = CommandReturnType extends Viewable<infer ViewReturnType> ? ViewReturnType : CommandReturnType;
|
|
13
|
+
declare type InferReturnType<ViewFunction extends ((crt: CommandReturnType, input: unknown) => unknown) | undefined, CommandReturnType> = ViewFunction extends (crt: CommandReturnType, input: unknown) => unknown ? ReturnType<ViewFunction> : DefaultViewFnReturn<CommandReturnType>;
|
|
14
|
+
export declare type BuildAuthEndpointOptions<Input extends BaseModel, CommandReturnType, ViewFunction extends ((crt: CommandReturnType, input: Input) => unknown) | undefined> = {
|
|
13
15
|
request: AuthRequest;
|
|
14
16
|
inputConstructor: (jwtUser: JWTUser) => Promise<Input> | Input;
|
|
15
|
-
command: (input: Input) => Promise<CommandReturnType
|
|
17
|
+
command: (input: Input) => Promise<CommandReturnType>;
|
|
16
18
|
returnCode?: number;
|
|
17
19
|
view?: ViewFunction;
|
|
18
20
|
getLogger: () => ILogger;
|
|
19
21
|
};
|
|
20
|
-
declare type InferReturnType<ViewFunction, CommandReturnType, ViewReturnType> = ViewFunction extends undefined ? CommandReturnType extends Viewable<ViewReturnType> ? ViewReturnType : CommandReturnType : ViewReturnType;
|
|
21
22
|
export declare class BaseApi extends Controller {
|
|
22
|
-
protected buildAuthEndpoint<Input extends BaseModel, CommandReturnType,
|
|
23
|
+
protected buildAuthEndpoint<Input extends BaseModel, CommandReturnType, ViewFunction extends ((crt: CommandReturnType, input: Input) => unknown) | undefined, EndpointReturnType extends InferReturnType<ViewFunction, CommandReturnType>>({ request, inputConstructor, command, returnCode, view, getLogger, }: BuildAuthEndpointOptions<Input, CommandReturnType, ViewFunction>): Promise<EndpointReturnType>;
|
|
23
24
|
}
|
|
24
25
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseApi.js","sourceRoot":"","sources":["../../src/endpoints/BaseApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,+BAAkC;AAElC,mCAAmC;AASnC,SAAS,UAAU,CAAI,MAAe;IACpC,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,OAAQ,MAAsB,CAAC,MAAM,KAAK,UAAU,CACrD,CAAC;AACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseApi.js","sourceRoot":"","sources":["../../src/endpoints/BaseApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,+BAAkC;AAElC,mCAAmC;AASnC,SAAS,UAAU,CAAI,MAAe;IACpC,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,OAAQ,MAAsB,CAAC,MAAM,KAAK,UAAU,CACrD,CAAC;AACJ,CAAC;AA+BD,MAAa,OAAQ,SAAQ,iBAAU;IACrB,iBAAiB,CAO/B,EACA,OAAO,EACP,gBAAgB,EAChB,OAAO,EACP,UAAU,GAAG,GAAG,EAChB,IAAI,EACJ,SAAS,GAKV;;YACC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;YACvC,MAAM,OAAO,GAAG,GAAG,IAAA,kBAAS,EAAC,IAAI,CAAC,IAAI,IAAA,kBAAS,EAAC,MAAM,CAAC,EAAE,CAAC;YAC1D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAE3B,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAE3C,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,sBAAsB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YAEzD,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;YAE7C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,qBAAqB,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;YAE7D,2EAA2E;YAC3E,IAAI,IAAI,EAAE;gBACR,OAAO,IAAI,CAAC,eAAe,EAAE,KAAK,CAAuB,CAAC;aAC3D;YAED,gFAAgF;YAChF,IAAI,UAAU,CAAqB,eAAe,CAAC,EAAE;gBACnD,OAAO,eAAe,CAAC,MAAM,EAAE,CAAC;aACjC;YAED,+CAA+C;YAC/C,OAAO,eAAqC,CAAC;QAC/C,CAAC;KAAA;CACF;AA9CD,0BA8CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alanszp/express",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.3.2",
|
|
4
4
|
"description": "Alan's express utils and middlewares.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"typescript": "^4.3.4"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@alanszp/audit": "^16.
|
|
44
|
-
"@alanszp/jwt": "^16.
|
|
45
|
-
"@alanszp/logger": "^16.
|
|
46
|
-
"@alanszp/shared-context": "^16.
|
|
43
|
+
"@alanszp/audit": "^16.3.2",
|
|
44
|
+
"@alanszp/jwt": "^16.3.2",
|
|
45
|
+
"@alanszp/logger": "^16.3.2",
|
|
46
|
+
"@alanszp/shared-context": "^16.3.2",
|
|
47
47
|
"@babel/core": "^7.23.9",
|
|
48
48
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
49
49
|
"body-parser": "^1.20.2",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"newrelic": "^11.18.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "4c34e99d4b526da169e604c8cab07c9a98c83b2b"
|
|
55
55
|
}
|