@aeriajs/types 0.0.128 → 0.0.129

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/http.d.ts CHANGED
@@ -3,9 +3,13 @@ import type { Result, ExtractError, ExtractResult } from './result.js';
3
3
  import type { EndpointError } from './endpointError.js';
4
4
  import type { ACError } from './accessControl.js';
5
5
  import type { RateLimitingError } from './security.js';
6
- import { type Contract } from './contract.js';
7
- import { type InferProperties, type InferProperty, type PackReferences } from './schema.js';
8
- export declare const REQUEST_METHODS: readonly ["GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS", "PATCH", "TRACE", "SEARCH"];
6
+ export declare const REQUEST_METHODS: string[];
7
+ export declare const METHOD_COLORS: {
8
+ readonly GET: "green";
9
+ readonly PUT: "blue";
10
+ readonly POST: "white";
11
+ readonly DELETE: "red";
12
+ };
9
13
  export declare const HTTPStatus: {
10
14
  readonly Ok: 200;
11
15
  readonly NoContent: 204;
@@ -37,12 +41,4 @@ type ExtractHTTPStatus<TRouteResponse> = TRouteResponse extends EndpointError<st
37
41
  export type NativeError = typeof ACError.AuthenticationError | typeof ACError.AuthorizationError | typeof RateLimitingError.LimitReached | typeof RateLimitingError.Unauthenticated;
38
42
  export type NativeHTTPErrorStatus = typeof HTTPStatus.Unauthorized | typeof HTTPStatus.TooManyRequests;
39
43
  export type WithACErrors<TRouteResponse> = TRouteResponse extends Result.Either<infer InferredError, unknown> ? Result.Either<ExtractError<TRouteResponse> | EndpointError<ExtractCode<InferredError> | NativeError, unknown, ExtractHTTPStatus<InferredError> | NativeHTTPErrorStatus>, ExtractResult<TRouteResponse>> : TRouteResponse | Result.Error<EndpointError<NativeError, unknown, NativeHTTPErrorStatus>>;
40
- export type InferEndpointFunction<TRouteResponse, TRoutePayload> = TRoutePayload extends null ? <T = TRouteResponse>(payload?: unknown) => Promise<WithACErrors<T>> : TRoutePayload extends undefined ? <T = TRouteResponse>() => Promise<WithACErrors<T>> : <T = TRouteResponse>(payload: TRoutePayload) => Promise<WithACErrors<T>>;
41
- export type InferEndpointFromContract<TContract extends Contract> = TContract extends {
42
- response: infer RouteResponse;
43
- } | {
44
- payload: infer RoutePayload;
45
- } | {
46
- query: infer RoutePayload;
47
- } ? InferEndpointFunction<RouteResponse extends {} ? InferProperties<RouteResponse> : unknown, RoutePayload extends {} ? PackReferences<InferProperty<RoutePayload>> : undefined> : never;
48
44
  export {};
package/dist/http.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STREAMED_RESPONSE = exports.HTTPStatus = exports.REQUEST_METHODS = void 0;
3
+ exports.STREAMED_RESPONSE = exports.HTTPStatus = exports.METHOD_COLORS = exports.REQUEST_METHODS = void 0;
4
4
  exports.REQUEST_METHODS = [
5
5
  'GET',
6
6
  'HEAD',
@@ -12,6 +12,12 @@ exports.REQUEST_METHODS = [
12
12
  'TRACE',
13
13
  'SEARCH',
14
14
  ];
15
+ exports.METHOD_COLORS = {
16
+ GET: 'green',
17
+ PUT: 'blue',
18
+ POST: 'white',
19
+ DELETE: 'red',
20
+ };
15
21
  exports.HTTPStatus = {
16
22
  Ok: 200,
17
23
  NoContent: 204,
package/dist/http.mjs CHANGED
@@ -10,6 +10,12 @@ export const REQUEST_METHODS = [
10
10
  "TRACE",
11
11
  "SEARCH"
12
12
  ];
13
+ export const METHOD_COLORS = {
14
+ GET: "green",
15
+ PUT: "blue",
16
+ POST: "white",
17
+ DELETE: "red"
18
+ };
13
19
  export const HTTPStatus = {
14
20
  Ok: 200,
15
21
  NoContent: 204,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/types",
3
- "version": "0.0.128",
3
+ "version": "0.0.129",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",