@aeriajs/types 0.0.63 → 0.0.64

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.
@@ -11,5 +11,6 @@ export declare enum ACError {
11
11
  OwnershipError = "OWNERSHIP_ERROR",
12
12
  ResourceNotFound = "RESOURCE_NOT_FOUND",
13
13
  InsecureOperator = "INSECURE_OPERATOR",
14
- MalformedInput = "MALFORMED_INPUT"
14
+ MalformedInput = "MALFORMED_INPUT",
15
+ UnknownError = "UNKNOWN_INPUT"
15
16
  }
@@ -13,4 +13,5 @@ var ACError;
13
13
  ACError["ResourceNotFound"] = "RESOURCE_NOT_FOUND";
14
14
  ACError["InsecureOperator"] = "INSECURE_OPERATOR";
15
15
  ACError["MalformedInput"] = "MALFORMED_INPUT";
16
+ ACError["UnknownError"] = "UNKNOWN_INPUT";
16
17
  })(ACError || (exports.ACError = ACError = {}));
@@ -10,5 +10,6 @@ export var ACError = /* @__PURE__ */ ((ACError2) => {
10
10
  ACError2["ResourceNotFound"] = "RESOURCE_NOT_FOUND";
11
11
  ACError2["InsecureOperator"] = "INSECURE_OPERATOR";
12
12
  ACError2["MalformedInput"] = "MALFORMED_INPUT";
13
+ ACError2["UnknownError"] = "UNKNOWN_INPUT";
13
14
  return ACError2;
14
15
  })(ACError || {});
@@ -5,6 +5,7 @@ import type { Property } from './property.js';
5
5
  import type { UserRole } from './token.js';
6
6
  export type ContractBase = {
7
7
  builtin?: boolean;
8
+ streamed?: boolean;
8
9
  };
9
10
  export type ContractRoles = {
10
11
  roles?: readonly UserRole[] | boolean | 'unauthenticated' | 'unauthenticated-only';
@@ -35,7 +35,7 @@ export type What<TDocument> = ({
35
35
  } & Omit<PackReferences<TDocument>, '_id'>) extends infer Document ? {
36
36
  [P in keyof Document]: Document[P] | null;
37
37
  } : never;
38
- export type Projection<TDocument> = keyof TDocument | '_id' extends infer DocumentProp ? TDocument extends string ? DocumentProp[] : string[] : never;
38
+ export type Projection<TDocument> = keyof TDocument | '_id' extends infer DocumentProp ? DocumentProp extends string ? DocumentProp[] : string[] : never;
39
39
  export type QuerySort<TDocument> = Partial<Record<keyof WithId<TDocument>, 1 | -1>>;
40
40
  export type CollectionDocument<TDocument> = TDocument;
41
41
  export type CountPayload<TDocument extends CollectionDocument<OptionalId<any>>> = {
package/dist/http.d.ts CHANGED
@@ -18,17 +18,18 @@ export declare enum HTTPStatus {
18
18
  }
19
19
  export type RouteUri = `/${string}`;
20
20
  export type RequestMethod = (typeof REQUEST_METHODS)[number];
21
- export type GenericRequest = {
22
- url: string;
23
- method: RequestMethod;
24
- headers: Record<string, string | string[] | undefined>;
25
- body?: string;
26
- query: Record<string, any>;
21
+ export type GenericRequest = Omit<IncomingMessage, 'url' | 'method'> & {
22
+ readonly url: string;
23
+ readonly method: RequestMethod;
24
+ readonly body?: string;
25
+ readonly fragments: string[];
27
26
  payload: Record<string, any>;
28
- fragments: string[];
29
- nodeRequest: IncomingMessage;
27
+ query: Record<string, any>;
28
+ };
29
+ export declare const STREAMED_RESPONSE: unique symbol;
30
+ export type GenericResponse = ServerResponse & {
31
+ [STREAMED_RESPONSE]?: boolean;
30
32
  };
31
- export type GenericResponse = ServerResponse;
32
33
  type ExtractCode<TRouteResponse> = TRouteResponse extends Result.Error<EndpointError<infer PCode>> ? PCode : never;
33
34
  type ExtractHTTPStatus<TRouteResponse> = TRouteResponse extends Result.Error<EndpointError<any, unknown, infer PHTTPStatus>> ? PHTTPStatus : never;
34
35
  export type WithACErrors<TRouteResponse> = Result.Either<ExtractError<TRouteResponse> | StrictEndpointError<ExtractCode<TRouteResponse> | ACError.AuthenticationError | ACError.AuthorizationError | RateLimitingError.LimitReached | RateLimitingError.Unauthenticated, unknown, ExtractHTTPStatus<TRouteResponse> | HTTPStatus.Unauthorized | HTTPStatus.TooManyRequests>, ExtractResult<TRouteResponse>>;
package/dist/http.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HTTPStatus = exports.REQUEST_METHODS = void 0;
3
+ exports.STREAMED_RESPONSE = exports.HTTPStatus = exports.REQUEST_METHODS = void 0;
4
4
  exports.REQUEST_METHODS = [
5
5
  'GET',
6
6
  'HEAD',
@@ -23,3 +23,4 @@ var HTTPStatus;
23
23
  HTTPStatus[HTTPStatus["TooManyRequests"] = 429] = "TooManyRequests";
24
24
  HTTPStatus[HTTPStatus["InternalServerError"] = 500] = "InternalServerError";
25
25
  })(HTTPStatus || (exports.HTTPStatus = HTTPStatus = {}));
26
+ exports.STREAMED_RESPONSE = Symbol('StreamedResponse');
package/dist/http.mjs CHANGED
@@ -21,3 +21,4 @@ export var HTTPStatus = /* @__PURE__ */ ((HTTPStatus2) => {
21
21
  HTTPStatus2[HTTPStatus2["InternalServerError"] = 500] = "InternalServerError";
22
22
  return HTTPStatus2;
23
23
  })(HTTPStatus || {});
24
+ export const STREAMED_RESPONSE = Symbol("StreamedResponse");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/types",
3
- "version": "0.0.63",
3
+ "version": "0.0.64",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",