@h3ravel/contracts 0.28.0
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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/index.cjs +348 -0
- package/dist/index.d.ts +4464 -0
- package/dist/index.js +312 -0
- package/package.json +65 -0
- package/tsconfig.json +8 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { Model } from "@h3ravel/arquebus";
|
|
2
|
+
import { HTTPResponse } from "h3";
|
|
3
|
+
|
|
4
|
+
//#region src/Configuration/IAppBuilder.ts
|
|
5
|
+
var IAppBuilder = class {};
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/Core/IContainer.ts
|
|
9
|
+
/**
|
|
10
|
+
* Interface for the Container contract, defining methods for dependency injection and service resolution.
|
|
11
|
+
*/
|
|
12
|
+
var IContainer = class {
|
|
13
|
+
static hasAnyDecorator(target) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/Core/IApplication.ts
|
|
20
|
+
var IApplication = class extends IContainer {
|
|
21
|
+
context;
|
|
22
|
+
h3Event;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/Core/IController.ts
|
|
27
|
+
/**
|
|
28
|
+
* Defines the contract for all controllers.
|
|
29
|
+
*/
|
|
30
|
+
var IController = class {
|
|
31
|
+
callAction(method, parameters) {}
|
|
32
|
+
getMiddleware() {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/Core/IRegisterer.ts
|
|
39
|
+
var IRegisterer = class {};
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/Core/IServiceProvider.ts
|
|
43
|
+
var IServiceProvider = class {
|
|
44
|
+
/**
|
|
45
|
+
* Unique Identifier for service providers
|
|
46
|
+
*/
|
|
47
|
+
static uid;
|
|
48
|
+
/**
|
|
49
|
+
* Sort order
|
|
50
|
+
*/
|
|
51
|
+
static order;
|
|
52
|
+
/**
|
|
53
|
+
* Sort priority
|
|
54
|
+
*/
|
|
55
|
+
static priority;
|
|
56
|
+
/**
|
|
57
|
+
* Indicate that this service provider only runs in console
|
|
58
|
+
*/
|
|
59
|
+
static runsInConsole;
|
|
60
|
+
/**
|
|
61
|
+
* Indicate that this service provider only runs in console
|
|
62
|
+
*/
|
|
63
|
+
static console;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/Database/IModel.ts
|
|
68
|
+
var IModel = class extends Model {};
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/Events/IDispatcher.ts
|
|
72
|
+
var IDispatcher = class {};
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/Exceptions/IExceptionHandler.ts
|
|
76
|
+
var IExceptionHandler = class {};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/Foundation/CKernel.ts
|
|
80
|
+
var CKernel = class {};
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/Foundation/IBootstraper.ts
|
|
84
|
+
var IBootstraper = class {};
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/Foundation/IKernel.ts
|
|
88
|
+
var IKernel = class {};
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/Http/IParamBag.ts
|
|
92
|
+
/**
|
|
93
|
+
* ParamBag is a container for key/value pairs
|
|
94
|
+
* for H3ravel App.
|
|
95
|
+
*/
|
|
96
|
+
var IParamBag = class {};
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/Http/IFileBag.ts
|
|
100
|
+
/**
|
|
101
|
+
* FileBag is a container for uploaded files
|
|
102
|
+
* for H3ravel App.
|
|
103
|
+
*/
|
|
104
|
+
var IFileBag = class extends IParamBag {};
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/Http/IHeaderBag.ts
|
|
108
|
+
/**
|
|
109
|
+
* HeaderBag — A container for HTTP headers
|
|
110
|
+
* for H3ravel App.
|
|
111
|
+
*/
|
|
112
|
+
var IHeaderBag = class {};
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/Http/IHttpContext.ts
|
|
116
|
+
var IHttpContext = class {
|
|
117
|
+
/**
|
|
118
|
+
* Retrieve an existing HttpContext instance for an event, if any.
|
|
119
|
+
*/
|
|
120
|
+
static get(event) {}
|
|
121
|
+
/**
|
|
122
|
+
* Delete the cached context for a given event (optional cleanup).
|
|
123
|
+
*/
|
|
124
|
+
static forget(event) {}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/Http/IHttpRequest.ts
|
|
129
|
+
var IHttpRequest = class {};
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/Http/IHttpResponse.ts
|
|
133
|
+
/**
|
|
134
|
+
* Interface for the Response contract, defining methods for handling HTTP responses.
|
|
135
|
+
*/
|
|
136
|
+
var IHttpResponse = class {};
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/Http/IInputBag.ts
|
|
140
|
+
/**
|
|
141
|
+
* InputBag is a container for user input values
|
|
142
|
+
* (e.g., query params, body, cookies)
|
|
143
|
+
* for H3ravel App.
|
|
144
|
+
*/
|
|
145
|
+
var InputBag = class extends IParamBag {};
|
|
146
|
+
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/Http/IRequest.ts
|
|
149
|
+
/**
|
|
150
|
+
* Interface for the Request contract, defining methods for handling HTTP request data.
|
|
151
|
+
*/
|
|
152
|
+
var IRequest = class extends IHttpRequest {
|
|
153
|
+
/**
|
|
154
|
+
* Factory method to create a Request instance from an H3Event.
|
|
155
|
+
*/
|
|
156
|
+
static create(event, app) {
|
|
157
|
+
return Promise.resolve({});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Enables support for the _method request parameter to determine the intended HTTP method.
|
|
161
|
+
*
|
|
162
|
+
* Be warned that enabling this feature might lead to CSRF issues in your code.
|
|
163
|
+
* Check that you are using CSRF tokens when required.
|
|
164
|
+
* If the HTTP method parameter override is enabled, an html-form with method "POST" can be altered
|
|
165
|
+
* and used to send a "PUT" or "DELETE" request via the _method request parameter.
|
|
166
|
+
* If these methods are not protected against CSRF, this presents a possible vulnerability.
|
|
167
|
+
*
|
|
168
|
+
* The HTTP method can only be overridden when the real HTTP method is POST.
|
|
169
|
+
*/
|
|
170
|
+
static enableHttpMethodParameterOverride() {}
|
|
171
|
+
/**
|
|
172
|
+
* Checks whether support for the _method request parameter is enabled.
|
|
173
|
+
*/
|
|
174
|
+
static getHttpMethodParameterOverride() {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/Http/IResponse.ts
|
|
181
|
+
/**
|
|
182
|
+
* Interface for the Response contract, defining methods for handling HTTP responses.
|
|
183
|
+
*/
|
|
184
|
+
var IResponse = class extends IHttpResponse {};
|
|
185
|
+
var IResponsable = class extends HTTPResponse {};
|
|
186
|
+
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/Http/IServerBag.ts
|
|
189
|
+
/**
|
|
190
|
+
* ServerBag — a simplified version of Symfony's ServerBag
|
|
191
|
+
* for H3ravel App.
|
|
192
|
+
*
|
|
193
|
+
* Responsible for extracting and normalizing HTTP headers
|
|
194
|
+
* from the incoming request.
|
|
195
|
+
*/
|
|
196
|
+
var IServerBag = class extends IParamBag {};
|
|
197
|
+
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/Http/IUploadedFile.ts
|
|
200
|
+
var IUploadedFile = class {};
|
|
201
|
+
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/Queue/IJob.ts
|
|
204
|
+
var IJob = class {};
|
|
205
|
+
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/Routing/ICallableDispatcher.ts
|
|
208
|
+
var ICallableDispatcher = class {};
|
|
209
|
+
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/Routing/IControllerDispatcher.ts
|
|
212
|
+
var IControllerDispatcher = class {};
|
|
213
|
+
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/Routing/IMiddleware.ts
|
|
216
|
+
/**
|
|
217
|
+
* Defines the contract for all middlewares.
|
|
218
|
+
* Any middleware implementing this must define these methods.
|
|
219
|
+
*/
|
|
220
|
+
var IMiddleware = class {
|
|
221
|
+
options = {};
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/Routing/IPendingResourceRegistration.ts
|
|
226
|
+
var IPendingResourceRegistration = class {};
|
|
227
|
+
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/Routing/IPendingSingletonResourceRegistration.ts
|
|
230
|
+
var IPendingSingletonResourceRegistration = class {};
|
|
231
|
+
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/Routing/IRoute.ts
|
|
234
|
+
var IRoute = class {};
|
|
235
|
+
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/Routing/IRouter.ts
|
|
238
|
+
/**
|
|
239
|
+
* Interface for the Router contract, defining methods for HTTP routing.
|
|
240
|
+
*/
|
|
241
|
+
var IRouter = class {
|
|
242
|
+
/**
|
|
243
|
+
* All of the verbs supported by the router.
|
|
244
|
+
*/
|
|
245
|
+
static verbs;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/Routing/IRouteRegistrar.ts
|
|
250
|
+
var IRouteRegistrar = class {};
|
|
251
|
+
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/Routing/Traits/UrlRoutable.ts
|
|
254
|
+
var UrlRoutable = class {};
|
|
255
|
+
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/Url/IRequestAwareUrl.ts
|
|
258
|
+
/**
|
|
259
|
+
* Contract for request-aware URL helpers
|
|
260
|
+
*/
|
|
261
|
+
var IRequestAwareUrl = class {};
|
|
262
|
+
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/Url/IUrl.ts
|
|
265
|
+
var IUrl = class {
|
|
266
|
+
/**
|
|
267
|
+
* Create a URL from a full URL string
|
|
268
|
+
*/
|
|
269
|
+
static of(url, app) {
|
|
270
|
+
return {};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Create a URL from a path relative to the app URL
|
|
274
|
+
*/
|
|
275
|
+
static to(path, app) {
|
|
276
|
+
return {};
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Create a URL from a named route
|
|
280
|
+
*/
|
|
281
|
+
static route(name, params, app) {
|
|
282
|
+
return {};
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Create a signed URL from a named route
|
|
286
|
+
*/
|
|
287
|
+
static signedRoute(name, params, app) {
|
|
288
|
+
return {};
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Create a temporary signed URL from a named route
|
|
292
|
+
*/
|
|
293
|
+
static temporarySignedRoute(name, params, expiration, app) {
|
|
294
|
+
return {};
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Create a URL from a controller action
|
|
298
|
+
*/
|
|
299
|
+
static action(controller, params, app) {
|
|
300
|
+
return {};
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/Url/IUrlHelpers.ts
|
|
306
|
+
/**
|
|
307
|
+
* The Url Helper Contract
|
|
308
|
+
*/
|
|
309
|
+
var IUrlHelpers = class {};
|
|
310
|
+
|
|
311
|
+
//#endregion
|
|
312
|
+
export { CKernel, IAppBuilder, IApplication, IBootstraper, ICallableDispatcher, IContainer, IController, IControllerDispatcher, IDispatcher, IExceptionHandler, IFileBag, IHeaderBag, IHttpContext, IHttpRequest, IHttpResponse, IJob, IKernel, IMiddleware, IModel, IParamBag, IPendingResourceRegistration, IPendingSingletonResourceRegistration, IRegisterer, IRequest, IRequestAwareUrl, IResponsable, IResponse, IRoute, IRouteRegistrar, IRouter, IServerBag, IServiceProvider, IUploadedFile, IUrl, IUrlHelpers, InputBag, UrlRoutable };
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@h3ravel/contracts",
|
|
3
|
+
"version": "0.28.0",
|
|
4
|
+
"description": "H3ravel Contracts.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./*": "./*"
|
|
15
|
+
},
|
|
16
|
+
"typesVersions": {
|
|
17
|
+
"*": {
|
|
18
|
+
"*": [
|
|
19
|
+
"dist/index.d.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"tsconfig.json"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://h3ravel.toneflix.net",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/h3ravel/framework.git",
|
|
34
|
+
"directory": "packages/contracts"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"h3ravel",
|
|
38
|
+
"modern",
|
|
39
|
+
"web",
|
|
40
|
+
"H3",
|
|
41
|
+
"framework",
|
|
42
|
+
"nodejs",
|
|
43
|
+
"typescript",
|
|
44
|
+
"laravel",
|
|
45
|
+
"contracts"
|
|
46
|
+
],
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"edge.js": "^6.3.0",
|
|
49
|
+
"simple-body-validator": "^1.3.9",
|
|
50
|
+
"@h3ravel/musket": "^0.6.8",
|
|
51
|
+
"@h3ravel/arquebus": "^0.7.3"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"h3": "2.0.1-rc.5"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsdown --config-loader unconfig",
|
|
58
|
+
"dev": "tsx watch src/index.ts",
|
|
59
|
+
"start": "node dist/index.js",
|
|
60
|
+
"lint": "eslint . --ext .ts",
|
|
61
|
+
"test": "jest --passWithNoTests",
|
|
62
|
+
"release:patch": "pnpm build && pnpm version patch && git add . && git commit -m \"version: bump contracts package and publish\" && pnpm publish --tag latest",
|
|
63
|
+
"version-patch": "pnpm version patch"
|
|
64
|
+
}
|
|
65
|
+
}
|