@famir/http-proto 0.0.1 → 0.0.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.
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
# @famir/http-proto
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@famir/http-proto)
|
|
4
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
5
|
+
|
|
6
|
+
HTTP protocol types and validation schemas.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @famir/http-proto
|
|
12
|
+
```
|
package/dist/http-proto.d.ts
CHANGED
|
@@ -17,10 +17,10 @@ export type HttpHeaders = Record<string, HttpHeader | undefined>;
|
|
|
17
17
|
export type HttpStrictHeaders = Record<string, HttpHeader>;
|
|
18
18
|
export type HttpBody = Buffer;
|
|
19
19
|
export type HttpText = string;
|
|
20
|
-
export type HttpJson = NonNullable<unknown>;
|
|
20
|
+
export type HttpJson = NonNullable<object | unknown[]>;
|
|
21
21
|
export type HttpConnection = Record<string, number | string | null | undefined>;
|
|
22
22
|
export type HttpPayload = Record<string, unknown>;
|
|
23
|
-
export type HttpError =
|
|
23
|
+
export type HttpError = [object, string[]];
|
|
24
24
|
export type HttpQueryString = Record<string, unknown>;
|
|
25
25
|
export interface HttpContentType {
|
|
26
26
|
type: string;
|
package/dist/http-proto.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-proto.js","sourceRoot":"","sources":["../src/http-proto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-proto.js","sourceRoot":"","sources":["../src/http-proto.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,eAAe;IACf,uBAAuB;IACvB,wBAAwB;CAChB,CAAA;AAQV,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAAW,CAAU,CAAA;AAQ1D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,oBAAoB,CAAU,CAAA;AAelF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAA"}
|
|
@@ -2,6 +2,8 @@ import { JSONSchemaType } from '@famir/validator';
|
|
|
2
2
|
import { HttpConnection, HttpError, HttpHeader, HttpHeaders, HttpMethod, HttpPayload, HttpType } from './http-proto.js';
|
|
3
3
|
export declare const httpTypeSchema: JSONSchemaType<HttpType>;
|
|
4
4
|
export declare const httpMethodSchema: JSONSchemaType<HttpMethod>;
|
|
5
|
+
export declare const httpRelativeUrlSchema: JSONSchemaType<string>;
|
|
6
|
+
export declare const httpStatusSchema: JSONSchemaType<number>;
|
|
5
7
|
export declare const httpHeaderSchema: JSONSchemaType<HttpHeader>;
|
|
6
8
|
export declare const httpHeadersSchema: JSONSchemaType<HttpHeaders>;
|
|
7
9
|
export declare const httpConnectionSchema: JSONSchemaType<HttpConnection>;
|
|
@@ -7,6 +7,12 @@ export const httpMethodSchema = {
|
|
|
7
7
|
type: 'string',
|
|
8
8
|
enum: [...HTTP_METHODS],
|
|
9
9
|
};
|
|
10
|
+
export const httpRelativeUrlSchema = {
|
|
11
|
+
type: 'string',
|
|
12
|
+
};
|
|
13
|
+
export const httpStatusSchema = {
|
|
14
|
+
type: 'integer',
|
|
15
|
+
};
|
|
10
16
|
export const httpHeaderSchema = {
|
|
11
17
|
type: ['string', 'array'],
|
|
12
18
|
oneOf: [
|
|
@@ -32,7 +38,16 @@ export const httpHeadersSchema = {
|
|
|
32
38
|
export const httpConnectionSchema = {
|
|
33
39
|
type: 'object',
|
|
34
40
|
additionalProperties: {
|
|
35
|
-
anyOf: [
|
|
41
|
+
anyOf: [
|
|
42
|
+
{
|
|
43
|
+
type: 'number',
|
|
44
|
+
nullable: true,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'string',
|
|
48
|
+
nullable: true,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
36
51
|
},
|
|
37
52
|
};
|
|
38
53
|
export const httpPayloadSchema = {
|
|
@@ -41,16 +56,19 @@ export const httpPayloadSchema = {
|
|
|
41
56
|
};
|
|
42
57
|
export const httpErrorSchema = {
|
|
43
58
|
type: 'array',
|
|
44
|
-
minItems: 1,
|
|
45
|
-
maxItems: 10,
|
|
46
59
|
items: [
|
|
47
60
|
{
|
|
48
61
|
type: 'object',
|
|
49
62
|
},
|
|
63
|
+
{
|
|
64
|
+
type: 'array',
|
|
65
|
+
items: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
50
69
|
],
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
},
|
|
70
|
+
minItems: 2,
|
|
71
|
+
maxItems: 2,
|
|
54
72
|
};
|
|
55
73
|
export const httpErrorsSchema = {
|
|
56
74
|
type: 'array',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-proto.schemas.js","sourceRoot":"","sources":["../src/http-proto.schemas.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,UAAU,GAQX,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"http-proto.schemas.js","sourceRoot":"","sources":["../src/http-proto.schemas.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,UAAU,GAQX,MAAM,iBAAiB,CAAA;AAQxB,MAAM,CAAC,MAAM,cAAc,GAA6B;IACtD,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,CAAC,GAAG,UAAU,CAAC;CACb,CAAA;AAQV,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,CAAC,GAAG,YAAY,CAAC;CACf,CAAA;AAQV,MAAM,CAAC,MAAM,qBAAqB,GAA2B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.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@famir/http-proto",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2",
|
|
5
5
|
"description": "Famir http-proto module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"famir",
|
|
@@ -20,22 +20,25 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
|
-
"format": "prettier -w \"src/**/*.ts\"",
|
|
23
|
+
"format": "prettier -w \"src/**/*.ts\" README.md",
|
|
24
24
|
"lint": "eslint \"src/**/*.ts\"",
|
|
25
25
|
"test": "node --test dist/**/*.test.js",
|
|
26
26
|
"build": "tsc -b",
|
|
27
27
|
"clean": "rimraf dist *.tsbuildinfo"
|
|
28
28
|
},
|
|
29
|
-
"files": [
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
30
33
|
"repository": {
|
|
31
34
|
"type": "git",
|
|
32
35
|
"url": "git+https://github.com/bitnoize/famir.git",
|
|
33
|
-
"directory": "packages/
|
|
36
|
+
"directory": "packages/http-proto"
|
|
34
37
|
},
|
|
35
38
|
"bugs": {
|
|
36
39
|
"url": "https://github.com/bitnoize/famir/issues"
|
|
37
40
|
},
|
|
38
|
-
"homepage": "https://fake-mirrors.net",
|
|
41
|
+
"homepage": "https://docs.fake-mirrors.net",
|
|
39
42
|
"dependencies": {
|
|
40
43
|
"@famir/common": "*",
|
|
41
44
|
"@famir/validator": "*"
|