@nattyjs/types 0.0.1-beta.0 → 0.0.1-beta.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/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,265 @@
1
+ interface DecoratorInfo {
2
+ httpMethod: string;
3
+ route: string;
4
+ }
5
+
6
+ interface TypeInfo {
7
+ name: string;
8
+ documentation?: string;
9
+ type?: string;
10
+ }
11
+
12
+ interface ParameterInfo {
13
+ parameters: TypeInfo[];
14
+ returnType: string;
15
+ documentation: string;
16
+ }
17
+ interface MethodInfo extends TypeInfo {
18
+ parameters?: TypeInfo[];
19
+ returnType?: string;
20
+ route?: DecoratorInfo;
21
+ }
22
+
23
+ interface ClassTypeInfo extends TypeInfo {
24
+ filePath?: string;
25
+ constructorParameters?: TypeInfo[];
26
+ methods?: MethodInfo[];
27
+ properties?: TypeInfo[];
28
+ route?: DecoratorInfo;
29
+ }
30
+
31
+ interface BuildOptions {
32
+ mode: string;
33
+ rootDir: string;
34
+ port: number;
35
+ commandName: string;
36
+ }
37
+
38
+ type HttpRequestBodyInfo = {
39
+ Uint8Array?: Uint8Array | Uint8Array[];
40
+ string?: string | string[];
41
+ number?: number | number[];
42
+ boolean?: boolean | boolean[];
43
+ FormData?: FormData;
44
+ ArrayBuffer?: ArrayBuffer;
45
+ Blob?: Blob;
46
+ json?: {
47
+ [key: string]: any;
48
+ } | Array<{
49
+ [key: string]: any;
50
+ }>;
51
+ };
52
+
53
+ interface Cookie {
54
+ name: string;
55
+ value: string;
56
+ domain?: string;
57
+ path?: string;
58
+ expires?: Date | number;
59
+ secure?: boolean;
60
+ httpOnly?: boolean;
61
+ sameSite?: 'Strict' | 'Lax' | 'None' | undefined;
62
+ maxAge?: number;
63
+ }
64
+
65
+ interface HttpRequestInit {
66
+ method?: string;
67
+ url?: string;
68
+ pathName?: string;
69
+ host?: string;
70
+ body?: HttpRequestBodyInfo;
71
+ cookies?: Cookie[];
72
+ headers?: Headers;
73
+ query?: Record<string, string>;
74
+ params?: Record<string, string>;
75
+ }
76
+ interface HttpRequestBodyInit {
77
+ bytes?: Uint8Array;
78
+ string?: string;
79
+ json?: {
80
+ [key: string]: any;
81
+ } | Array<{
82
+ [key: string]: any;
83
+ }>;
84
+ }
85
+
86
+ interface HttpResponseInit {
87
+ body?: any;
88
+ status?: number;
89
+ headers?: HeadersInit;
90
+ cookies?: Cookie[];
91
+ enableContentNegotiation?: boolean;
92
+ }
93
+
94
+ interface NattyTestModule {
95
+ onRequest(request: HttpRequestInit): Promise<any>;
96
+ }
97
+
98
+ interface ProblemDetail {
99
+ type: string;
100
+ title: string;
101
+ detail?: string | number | boolean | {
102
+ [key: string]: any;
103
+ } | Array<{
104
+ [key: string]: any;
105
+ }>;
106
+ }
107
+
108
+ type ExceptionTypeInfo = string | number | boolean | {
109
+ [key: string]: any;
110
+ } | Array<{
111
+ [key: string]: any;
112
+ }> | ProblemDetail;
113
+
114
+ interface RouteConfig {
115
+ controller: Function;
116
+ parameters: Array<{
117
+ name: string;
118
+ type: string;
119
+ }>;
120
+ get: {
121
+ [key: string]: {
122
+ name: string;
123
+ parameters: Array<{
124
+ name: string;
125
+ type: string;
126
+ }>;
127
+ returnType: string;
128
+ };
129
+ };
130
+ post: {
131
+ [key: string]: {
132
+ name: string;
133
+ parameters: Array<{
134
+ name: string;
135
+ type: string;
136
+ }>;
137
+ returnType: string;
138
+ };
139
+ };
140
+ put: {
141
+ [key: string]: {
142
+ name: string;
143
+ parameters: Array<{
144
+ name: string;
145
+ type: string;
146
+ }>;
147
+ returnType: string;
148
+ };
149
+ };
150
+ delete: {
151
+ [key: string]: {
152
+ name: string;
153
+ parameters: Array<{
154
+ name: string;
155
+ type: string;
156
+ }>;
157
+ returnType: string;
158
+ };
159
+ };
160
+ }
161
+
162
+ type TypesInfo = {
163
+ [key: string]: {
164
+ path?: string | any | Function;
165
+ props?: Array<TypeInfo>;
166
+ values?: Array<any>;
167
+ };
168
+ };
169
+
170
+ interface TypeErrorMessage {
171
+ number?: string;
172
+ boolean?: string;
173
+ }
174
+
175
+ interface ErrorMessage {
176
+ typed?: TypeErrorMessage;
177
+ validator?: {
178
+ [key: string]: string;
179
+ };
180
+ }
181
+
182
+ interface ModelBinding {
183
+ errorMessage?: ErrorMessage;
184
+ }
185
+
186
+ interface DecoratorParams {
187
+ target: Function;
188
+ propertyKey?: string;
189
+ descriptor?: PropertyDescriptor;
190
+ }
191
+
192
+ interface ModelConfig {
193
+ tableName?: string;
194
+ }
195
+
196
+ interface DbFieldConfig {
197
+ name?: string;
198
+ type?: number;
199
+ defaultValue?: any;
200
+ isPrimaryKey?: boolean;
201
+ foreignKey?: any;
202
+ oneToMany?: FieldRelationConfig;
203
+ oneToOne?: FieldRelationConfig;
204
+ }
205
+ interface FieldRelationConfig {
206
+ model: any;
207
+ foreignKey: string;
208
+ }
209
+
210
+ interface PropConfig {
211
+ db?: DbFieldConfig;
212
+ }
213
+
214
+ interface PropertyDecoratorConfig {
215
+ decoratorParams: DecoratorParams;
216
+ validatorConfig?: any;
217
+ propConfig?: PropConfig;
218
+ modelConfig?: ModelConfig;
219
+ sanitizerConfig?: {
220
+ name: string;
221
+ config: any;
222
+ sanitizer: Function;
223
+ };
224
+ }
225
+
226
+ interface RouteInfo {
227
+ path: string;
228
+ }
229
+
230
+ interface IExceptionContext {
231
+ error: any;
232
+ request: HttpRequestBodyInit;
233
+ routeInfo: RouteInfo;
234
+ }
235
+
236
+ interface IModelBindingContext {
237
+ instance: any;
238
+ isValid: boolean;
239
+ errors: {
240
+ [key: string]: any;
241
+ };
242
+ }
243
+
244
+ interface IHttpResult {
245
+ getResponse(): HttpResponseInit;
246
+ }
247
+
248
+ interface RequestRouteInfo {
249
+ path: string;
250
+ methodInfo: MethodInfo;
251
+ controller: any;
252
+ parameters: Array<{
253
+ name: string;
254
+ type: string;
255
+ }>;
256
+ configuredRoutePath: string;
257
+ queryParams: {
258
+ [key: string]: any;
259
+ };
260
+ params?: {
261
+ [key: string]: any;
262
+ };
263
+ }
264
+
265
+ export { BuildOptions, ClassTypeInfo, Cookie, DbFieldConfig, DecoratorInfo, DecoratorParams, ExceptionTypeInfo, HttpRequestBodyInfo, HttpRequestBodyInit, HttpRequestInit, HttpResponseInit, IExceptionContext, IHttpResult, IModelBindingContext, MethodInfo, ModelBinding, ModelConfig, NattyTestModule, ParameterInfo, ProblemDetail, PropConfig, PropertyDecoratorConfig, RequestRouteInfo, RouteConfig, TypeInfo, TypesInfo };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+
package/package.json CHANGED
@@ -1,18 +1,14 @@
1
1
  {
2
2
  "name": "@nattyjs/types",
3
- "version": "0.0.1-beta.0",
3
+ "version": "0.0.1-beta.2",
4
4
  "keywords": [],
5
5
  "author": "ajayojha <ojhaajay@outlook.com>",
6
6
  "license": "ISC",
7
7
  "description": "",
8
8
  "main": "./dist/index.d.ts",
9
9
  "types": "./dist/index.d.ts",
10
- "directories": {
11
- "lib": "lib",
12
- "test": "__tests__"
13
- },
14
10
  "files": [
15
- "lib"
11
+ "dist"
16
12
  ],
17
13
  "scripts": {
18
14
  "build": "unbuild"