@aeriajs/types 0.0.46 → 0.0.48
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/context.d.ts +5 -1
- package/dist/error.d.ts +6 -0
- package/dist/error.js +2 -0
- package/dist/error.mjs +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Collection as MongoCollection } from 'mongodb';
|
|
2
2
|
import type { GenericRequest, GenericResponse } from './http.js';
|
|
3
|
-
import type { Either, Description, PackReferences, SchemaWithId, FunctionPath, Token, ApiConfig, CollectionDocument, CollectionFunctions, RateLimitingParams, RateLimitingErrors, AcceptedRole } from '.';
|
|
3
|
+
import type { Either, EndpointError, Description, PackReferences, SchemaWithId, FunctionPath, Token, ApiConfig, CollectionDocument, CollectionFunctions, RateLimitingParams, RateLimitingErrors, AcceptedRole } from '.';
|
|
4
4
|
export type CollectionModel<TDescription extends Description> = MongoCollection<Omit<PackReferences<SchemaWithId<TDescription>>, '_id'>>;
|
|
5
5
|
type OmitContextParameter<TFunction> = TFunction extends () => any ? TFunction : TFunction extends (payload: undefined, ...args: any[]) => infer Return ? () => Return : TFunction extends (payload: infer Payload, context: Context, ...args: infer Rest) => infer Return ? (payload: Payload, ...args: Rest) => Return : never;
|
|
6
6
|
type RestParameters<TFunction> = TFunction extends (payload: any, context: Context, ...args: infer Rest) => any ? Rest : never;
|
|
@@ -33,6 +33,10 @@ export type RouteContext<TAcceptedRole extends AcceptedRole = null> = {
|
|
|
33
33
|
request: GenericRequest;
|
|
34
34
|
response: GenericResponse;
|
|
35
35
|
log: (message: string, details?: any) => Promise<any>;
|
|
36
|
+
error: (error: EndpointError) => {
|
|
37
|
+
$isError: true;
|
|
38
|
+
error: EndpointError;
|
|
39
|
+
};
|
|
36
40
|
limitRate: (params: RateLimitingParams) => Promise<Either<RateLimitingErrors, {
|
|
37
41
|
hits: number;
|
|
38
42
|
points: number;
|
package/dist/error.d.ts
ADDED
package/dist/error.js
ADDED
package/dist/error.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ __exportStar(require("./context.js"), exports);
|
|
|
22
22
|
__exportStar(require("./contract.js"), exports);
|
|
23
23
|
__exportStar(require("./description.js"), exports);
|
|
24
24
|
__exportStar(require("./either.js"), exports);
|
|
25
|
+
__exportStar(require("./error.js"), exports);
|
|
25
26
|
__exportStar(require("./functions.js"), exports);
|
|
26
27
|
__exportStar(require("./http.js"), exports);
|
|
27
28
|
__exportStar(require("./property.js"), exports);
|
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./context.mjs";
|
|
|
7
7
|
export * from "./contract.mjs";
|
|
8
8
|
export * from "./description.mjs";
|
|
9
9
|
export * from "./either.mjs";
|
|
10
|
+
export * from "./error.mjs";
|
|
10
11
|
export * from "./functions.mjs";
|
|
11
12
|
export * from "./http.mjs";
|
|
12
13
|
export * from "./property.mjs";
|