@h3ravel/shared 0.7.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @h3ravel/shared
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: convert Request params and query from a method to a property and add Request headers
8
+
9
+ ## 0.7.1
10
+
11
+ ### Patch Changes
12
+
13
+ - chore: add download count to readme
14
+
3
15
  ## 0.7.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { H3Event, Middleware, MiddlewareOptions } from 'h3';
2
+ import { TypedHeaders, ResponseHeaderMap } from 'fetchdts';
2
3
 
3
4
  interface IServiceProvider {
4
5
  /**
@@ -117,12 +118,17 @@ interface IRequest {
117
118
  * Gets route parameters.
118
119
  * @returns An object containing route parameters.
119
120
  */
120
- params<T = Record<string, string>>(): T;
121
+ params: NonNullable<H3Event["context"]["params"]>;
121
122
  /**
122
123
  * Gets query parameters.
123
124
  * @returns An object containing query parameters.
124
125
  */
125
- query<T = Record<string, string>>(): T;
126
+ query: Record<string, any>;
127
+ /**
128
+ * Gets the request headers.
129
+ * @returns An object containing request headers.
130
+ */
131
+ headers: TypedHeaders<Record<keyof ResponseHeaderMap, string>>;
126
132
  /**
127
133
  * Gets the underlying event object or a specific property of it.
128
134
  * @param key - Optional key to access a nested property of the event.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { H3Event, Middleware, MiddlewareOptions } from 'h3';
2
+ import { TypedHeaders, ResponseHeaderMap } from 'fetchdts';
2
3
 
3
4
  interface IServiceProvider {
4
5
  /**
@@ -117,12 +118,17 @@ interface IRequest {
117
118
  * Gets route parameters.
118
119
  * @returns An object containing route parameters.
119
120
  */
120
- params<T = Record<string, string>>(): T;
121
+ params: NonNullable<H3Event["context"]["params"]>;
121
122
  /**
122
123
  * Gets query parameters.
123
124
  * @returns An object containing query parameters.
124
125
  */
125
- query<T = Record<string, string>>(): T;
126
+ query: Record<string, any>;
127
+ /**
128
+ * Gets the request headers.
129
+ * @returns An object containing request headers.
130
+ */
131
+ headers: TypedHeaders<Record<keyof ResponseHeaderMap, string>>;
126
132
  /**
127
133
  * Gets the underlying event object or a specific property of it.
128
134
  * @param key - Optional key to access a nested property of the event.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/shared",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Shared Utilities.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,6 +21,11 @@
21
21
  "dependencies": {
22
22
  "h3": "^2.0.0-beta.1"
23
23
  },
24
+ "devDependencies": {
25
+ "fetchdts": "^0.1.6",
26
+ "install": "^0.13.0",
27
+ "pnpm": "^10.14.0"
28
+ },
24
29
  "scripts": {
25
30
  "build": "tsup",
26
31
  "barrel": "barrelsby --directory src --delete --singleQuotes",
@@ -1,4 +1,5 @@
1
1
  import { DotNestedKeys, DotNestedValue } from './ObjContract'
2
+ import type { ResponseHeaderMap, TypedHeaders } from 'fetchdts'
2
3
 
3
4
  import type { H3Event } from 'h3'
4
5
 
@@ -24,13 +25,19 @@ export interface IRequest {
24
25
  * Gets route parameters.
25
26
  * @returns An object containing route parameters.
26
27
  */
27
- params<T = Record<string, string>> (): T;
28
+ params: NonNullable<H3Event["context"]["params"]>;
28
29
 
29
30
  /**
30
31
  * Gets query parameters.
31
32
  * @returns An object containing query parameters.
32
33
  */
33
- query<T = Record<string, string>> (): T;
34
+ query: Record<string, any>;
35
+
36
+ /**
37
+ * Gets the request headers.
38
+ * @returns An object containing request headers.
39
+ */
40
+ headers: TypedHeaders<Record<keyof ResponseHeaderMap, string>>;
34
41
 
35
42
  /**
36
43
  * Gets the underlying event object or a specific property of it.