@h3ravel/url 1.0.1 → 1.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 +56 -16
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://h3ravel.toneflix.net" target="_blank">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/h3ravel/assets/refs/heads/main/logo-full.svg" width="200" alt="H3ravel Logo">
|
|
4
|
+
</a>
|
|
5
|
+
<h1 align="center"><a href="https://h3ravel.toneflix.net/guide/urls">H3ravel Url</a></h1>
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
[![Framework][ix]][lx]
|
|
8
|
+
[![URL Package Version][i1]][l1]
|
|
9
|
+
[![Downloads][d1]][l1]
|
|
10
|
+
[![Tests][tei]][tel]
|
|
11
|
+
[![License][lini]][linl]
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
# About H3ravel/url
|
|
16
|
+
|
|
17
|
+
Request-aware URI builder and URL manipulation utilities for [H3ravel](https://h3ravel.toneflix.net) framework.
|
|
4
18
|
|
|
5
19
|
## Installation
|
|
6
20
|
|
|
@@ -21,19 +35,19 @@ npm install @h3ravel/url
|
|
|
21
35
|
### Basic URL Creation
|
|
22
36
|
|
|
23
37
|
```typescript
|
|
24
|
-
import { Url } from '@h3ravel/url'
|
|
38
|
+
import { Url } from '@h3ravel/url';
|
|
25
39
|
|
|
26
40
|
// From string
|
|
27
|
-
const url = Url.of('https://example.com/path')
|
|
41
|
+
const url = Url.of('https://example.com/path');
|
|
28
42
|
|
|
29
43
|
// From path relative to app URL
|
|
30
|
-
const url = Url.to('/users')
|
|
44
|
+
const url = Url.to('/users');
|
|
31
45
|
|
|
32
46
|
// From named route
|
|
33
|
-
const url = Url.route('users.show', { id: 1 })
|
|
47
|
+
const url = Url.route('users.show', { id: 1 });
|
|
34
48
|
|
|
35
49
|
// From controller action
|
|
36
|
-
const url = Url.action('UserController@index')
|
|
50
|
+
const url = Url.action('UserController@index');
|
|
37
51
|
```
|
|
38
52
|
|
|
39
53
|
### Fluent Builder API
|
|
@@ -46,7 +60,7 @@ const url = Url.of('https://example.com')
|
|
|
46
60
|
.withPath('/users')
|
|
47
61
|
.withQuery({ page: 2 })
|
|
48
62
|
.withFragment('section-1')
|
|
49
|
-
.toString()
|
|
63
|
+
.toString();
|
|
50
64
|
// -> "http://test.com:8000/users?page=2#section-1"
|
|
51
65
|
```
|
|
52
66
|
|
|
@@ -54,29 +68,33 @@ const url = Url.of('https://example.com')
|
|
|
54
68
|
|
|
55
69
|
```typescript
|
|
56
70
|
// Get current URL
|
|
57
|
-
url().current()
|
|
71
|
+
url().current();
|
|
58
72
|
|
|
59
73
|
// Get full URL with query string
|
|
60
|
-
url().full()
|
|
74
|
+
url().full();
|
|
61
75
|
|
|
62
76
|
// Get previous URL
|
|
63
|
-
url().previous()
|
|
77
|
+
url().previous();
|
|
64
78
|
|
|
65
79
|
// Get previous path only
|
|
66
|
-
url().previousPath()
|
|
80
|
+
url().previousPath();
|
|
67
81
|
|
|
68
82
|
// Get current query parameters
|
|
69
|
-
url().query()
|
|
83
|
+
url().query();
|
|
70
84
|
```
|
|
71
85
|
|
|
72
86
|
### Signed URLs
|
|
73
87
|
|
|
74
88
|
```typescript
|
|
75
89
|
// Create signed route URL
|
|
76
|
-
const signedUrl = Url.signedRoute('users.show', { id: 1 })
|
|
90
|
+
const signedUrl = Url.signedRoute('users.show', { id: 1 });
|
|
77
91
|
|
|
78
92
|
// Create temporary signed route URL (expires in 5 minutes)
|
|
79
|
-
const tempUrl = Url.temporarySignedRoute(
|
|
93
|
+
const tempUrl = Url.temporarySignedRoute(
|
|
94
|
+
'users.index',
|
|
95
|
+
{},
|
|
96
|
+
Date.now() + 300000
|
|
97
|
+
);
|
|
80
98
|
```
|
|
81
99
|
|
|
82
100
|
## API Reference
|
|
@@ -108,6 +126,28 @@ const tempUrl = Url.temporarySignedRoute('users.index', {}, Date.now() + 300000)
|
|
|
108
126
|
- `previousPath()` - Get previous request path
|
|
109
127
|
- `query()` - Get current query parameters
|
|
110
128
|
|
|
129
|
+
## Contributing
|
|
130
|
+
|
|
131
|
+
Thank you for considering contributing to the H3ravel framework! The [Contribution Guide](https://h3ravel.toneflix.net/contributing) can be found in the H3ravel documentation and will provide you with all the information you need to get started.
|
|
132
|
+
|
|
133
|
+
## Code of Conduct
|
|
134
|
+
|
|
135
|
+
In order to ensure that the H3ravel community is welcoming to all, please review and abide by the [Code of Conduct](#).
|
|
136
|
+
|
|
137
|
+
## Security Vulnerabilities
|
|
138
|
+
|
|
139
|
+
If you discover a security vulnerability within H3ravel, please send an e-mail to Legacy via hamzas.legacy@toneflix.ng. All security vulnerabilities will be promptly addressed.
|
|
140
|
+
|
|
111
141
|
## License
|
|
112
142
|
|
|
113
|
-
MIT
|
|
143
|
+
The H3ravel framework is open-sourced software licensed under the [MIT license](LICENSE).
|
|
144
|
+
|
|
145
|
+
[ix]: https://img.shields.io/npm/v/%40h3ravel%2Fcore?style=flat-square&label=Framework&color=%230970ce
|
|
146
|
+
[lx]: https://www.npmjs.com/package/@h3ravel/core
|
|
147
|
+
[i1]: https://img.shields.io/npm/v/%40h3ravel%2Furl?style=flat-square&label=@h3ravel/url&color=%230970ce
|
|
148
|
+
[l1]: https://www.npmjs.com/package/@h3ravel/url
|
|
149
|
+
[d1]: https://img.shields.io/npm/dt/%40h3ravel%2Furl?style=flat-square&label=Downloads&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40h3ravel%2Furl
|
|
150
|
+
[linl]: https://github.com/h3ravel/framework/blob/main/LICENSE
|
|
151
|
+
[lini]: https://img.shields.io/github/license/h3ravel/framework
|
|
152
|
+
[tel]: https://github.com/h3ravel/framework/actions/workflows/test.yml
|
|
153
|
+
[tei]: https://github.com/h3ravel/framework/actions/workflows/test.yml/badge.svg
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/url",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Request-aware URI builder and URL manipulation utilities for H3ravel.",
|
|
5
|
+
"h3ravel": {
|
|
6
|
+
"providers": [
|
|
7
|
+
"UrlServiceProvider"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
5
10
|
"type": "module",
|
|
6
11
|
"main": "./dist/index.js",
|
|
7
12
|
"types": "./dist/index.d.ts",
|
|
@@ -39,11 +44,11 @@
|
|
|
39
44
|
"builder"
|
|
40
45
|
],
|
|
41
46
|
"dependencies": {
|
|
42
|
-
"@h3ravel/support": "^0.14.
|
|
43
|
-
"@h3ravel/shared": "^0.22.
|
|
47
|
+
"@h3ravel/support": "^0.14.1",
|
|
48
|
+
"@h3ravel/shared": "^0.22.2"
|
|
44
49
|
},
|
|
45
50
|
"peerDependencies": {
|
|
46
|
-
"@h3ravel/core": "^1.
|
|
51
|
+
"@h3ravel/core": "^1.16.0",
|
|
47
52
|
"@h3ravel/http": "^11.3.3"
|
|
48
53
|
},
|
|
49
54
|
"devDependencies": {
|