@aeriajs/common 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.
package/dist/schema.d.ts CHANGED
@@ -7,6 +7,9 @@ export declare const errorSchema: <const TObject extends Property>(object: TObje
7
7
  readonly const: "Error";
8
8
  };
9
9
  readonly error: Property;
10
+ readonly result: {
11
+ readonly const: undefined;
12
+ };
10
13
  };
11
14
  };
12
15
  export declare const resultSchema: <const TObject extends Property>(object: TObject) => {
@@ -15,6 +18,9 @@ export declare const resultSchema: <const TObject extends Property>(object: TObj
15
18
  readonly _tag: {
16
19
  readonly const: "Result";
17
20
  };
21
+ readonly error: {
22
+ readonly const: undefined;
23
+ };
18
24
  readonly result: Property;
19
25
  };
20
26
  };
@@ -27,7 +33,28 @@ export declare const endpointErrorSchema: <const THTTPStatus extends HTTPStatus[
27
33
  readonly _tag: {
28
34
  readonly const: "Error";
29
35
  };
30
- readonly error: Property;
36
+ readonly result: {
37
+ readonly const: undefined;
38
+ };
39
+ readonly error: {
40
+ readonly type: "object";
41
+ readonly required: readonly ["httpStatus", "code"];
42
+ readonly properties: {
43
+ readonly httpStatus: {
44
+ readonly enum: THTTPStatus;
45
+ };
46
+ readonly code: {
47
+ readonly enum: TCode;
48
+ };
49
+ readonly message: {
50
+ readonly type: "string";
51
+ };
52
+ readonly details: {
53
+ readonly type: "object";
54
+ readonly variable: true;
55
+ };
56
+ };
57
+ };
31
58
  };
32
59
  };
33
60
  export declare const genericEndpointErrorSchema: () => {
@@ -36,6 +63,27 @@ export declare const genericEndpointErrorSchema: () => {
36
63
  readonly _tag: {
37
64
  readonly const: "Error";
38
65
  };
39
- readonly error: Property;
66
+ readonly result: {
67
+ readonly const: undefined;
68
+ };
69
+ readonly error: {
70
+ readonly type: "object";
71
+ readonly required: readonly ["httpStatus", "code"];
72
+ readonly properties: {
73
+ readonly httpStatus: {
74
+ readonly type: "number";
75
+ };
76
+ readonly code: {
77
+ readonly type: "string";
78
+ };
79
+ readonly message: {
80
+ readonly type: "string";
81
+ };
82
+ readonly details: {
83
+ readonly type: "object";
84
+ readonly variable: true;
85
+ };
86
+ };
87
+ };
40
88
  };
41
89
  };
package/dist/schema.js CHANGED
@@ -56,6 +56,9 @@ const errorSchema = (object) => {
56
56
  const: 'Error',
57
57
  },
58
58
  error: object,
59
+ result: {
60
+ const: undefined,
61
+ },
59
62
  },
60
63
  };
61
64
  };
@@ -67,58 +70,83 @@ const resultSchema = (object) => {
67
70
  _tag: {
68
71
  const: 'Result',
69
72
  },
73
+ error: {
74
+ const: undefined,
75
+ },
70
76
  result: object,
71
77
  },
72
78
  };
73
79
  };
74
80
  exports.resultSchema = resultSchema;
75
81
  const endpointErrorSchema = (error) => {
76
- return (0, exports.errorSchema)({
82
+ return {
77
83
  type: 'object',
78
- required: [
79
- 'httpStatus',
80
- 'code',
81
- ],
82
84
  properties: {
83
- httpStatus: {
84
- enum: error.httpStatus,
85
- },
86
- code: {
87
- enum: error.code,
85
+ _tag: {
86
+ const: 'Error',
88
87
  },
89
- message: {
90
- type: 'string',
88
+ result: {
89
+ const: undefined,
91
90
  },
92
- details: {
91
+ error: {
93
92
  type: 'object',
94
- variable: true,
93
+ required: [
94
+ 'httpStatus',
95
+ 'code',
96
+ ],
97
+ properties: {
98
+ httpStatus: {
99
+ enum: error.httpStatus,
100
+ },
101
+ code: {
102
+ enum: error.code,
103
+ },
104
+ message: {
105
+ type: 'string',
106
+ },
107
+ details: {
108
+ type: 'object',
109
+ variable: true,
110
+ },
111
+ },
95
112
  },
96
113
  },
97
- });
114
+ };
98
115
  };
99
116
  exports.endpointErrorSchema = endpointErrorSchema;
100
117
  const genericEndpointErrorSchema = () => {
101
- return (0, exports.errorSchema)({
118
+ return {
102
119
  type: 'object',
103
- required: [
104
- 'httpStatus',
105
- 'code',
106
- ],
107
120
  properties: {
108
- httpStatus: {
109
- type: 'number',
110
- },
111
- code: {
112
- type: 'string',
121
+ _tag: {
122
+ const: 'Error',
113
123
  },
114
- message: {
115
- type: 'string',
124
+ result: {
125
+ const: undefined,
116
126
  },
117
- details: {
127
+ error: {
118
128
  type: 'object',
119
- variable: true,
129
+ required: [
130
+ 'httpStatus',
131
+ 'code',
132
+ ],
133
+ properties: {
134
+ httpStatus: {
135
+ type: 'number',
136
+ },
137
+ code: {
138
+ type: 'string',
139
+ },
140
+ message: {
141
+ type: 'string',
142
+ },
143
+ details: {
144
+ type: 'object',
145
+ variable: true,
146
+ },
147
+ },
120
148
  },
121
149
  },
122
- });
150
+ };
123
151
  };
124
152
  exports.genericEndpointErrorSchema = genericEndpointErrorSchema;
package/dist/schema.mjs CHANGED
@@ -52,7 +52,10 @@ export const errorSchema = (object) => {
52
52
  _tag: {
53
53
  const: "Error"
54
54
  },
55
- error: object
55
+ error: object,
56
+ result: {
57
+ const: void 0
58
+ }
56
59
  }
57
60
  };
58
61
  };
@@ -63,55 +66,80 @@ export const resultSchema = (object) => {
63
66
  _tag: {
64
67
  const: "Result"
65
68
  },
69
+ error: {
70
+ const: void 0
71
+ },
66
72
  result: object
67
73
  }
68
74
  };
69
75
  };
70
76
  export const endpointErrorSchema = (error) => {
71
- return errorSchema({
77
+ return {
72
78
  type: "object",
73
- required: [
74
- "httpStatus",
75
- "code"
76
- ],
77
79
  properties: {
78
- httpStatus: {
79
- enum: error.httpStatus
80
- },
81
- code: {
82
- enum: error.code
80
+ _tag: {
81
+ const: "Error"
83
82
  },
84
- message: {
85
- type: "string"
83
+ result: {
84
+ const: void 0
86
85
  },
87
- details: {
86
+ error: {
88
87
  type: "object",
89
- variable: true
88
+ required: [
89
+ "httpStatus",
90
+ "code"
91
+ ],
92
+ properties: {
93
+ httpStatus: {
94
+ enum: error.httpStatus
95
+ },
96
+ code: {
97
+ enum: error.code
98
+ },
99
+ message: {
100
+ type: "string"
101
+ },
102
+ details: {
103
+ type: "object",
104
+ variable: true
105
+ }
106
+ }
90
107
  }
91
108
  }
92
- });
109
+ };
93
110
  };
94
111
  export const genericEndpointErrorSchema = () => {
95
- return errorSchema({
112
+ return {
96
113
  type: "object",
97
- required: [
98
- "httpStatus",
99
- "code"
100
- ],
101
114
  properties: {
102
- httpStatus: {
103
- type: "number"
104
- },
105
- code: {
106
- type: "string"
115
+ _tag: {
116
+ const: "Error"
107
117
  },
108
- message: {
109
- type: "string"
118
+ result: {
119
+ const: void 0
110
120
  },
111
- details: {
121
+ error: {
112
122
  type: "object",
113
- variable: true
123
+ required: [
124
+ "httpStatus",
125
+ "code"
126
+ ],
127
+ properties: {
128
+ httpStatus: {
129
+ type: "number"
130
+ },
131
+ code: {
132
+ type: "string"
133
+ },
134
+ message: {
135
+ type: "string"
136
+ },
137
+ details: {
138
+ type: "object",
139
+ variable: true
140
+ }
141
+ }
114
142
  }
115
143
  }
116
- });
144
+ };
117
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/common",
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",
@@ -31,7 +31,7 @@
31
31
  "bson": "^6.5.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@aeriajs/types": "^0.0.58",
34
+ "@aeriajs/types": "^0.0.59",
35
35
  "bson": "^6.5.0"
36
36
  },
37
37
  "scripts": {