@twin.org/web 0.0.1-next.17 → 0.0.1-next.19

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/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/web - Changelog
2
2
 
3
- ## 0.0.1-next.17
3
+ ## 0.0.1-next.19
4
4
 
5
5
  - Initial Release
@@ -16,23 +16,31 @@ Create a new instance of FetchError.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **source**: `string`
19
+ ##### source
20
+
21
+ `string`
20
22
 
21
23
  The source of the error.
22
24
 
23
- **message**: `string`
25
+ ##### message
26
+
27
+ `string`
24
28
 
25
29
  The message as a code.
26
30
 
27
- **httpStatus**: [`HttpStatusCode`](../type-aliases/HttpStatusCode.md)
31
+ ##### httpStatus
32
+
33
+ [`HttpStatusCode`](../type-aliases/HttpStatusCode.md)
28
34
 
29
35
  The http status code.
30
36
 
31
- **properties?**
37
+ ##### properties?
32
38
 
33
39
  Any additional information for the error.
34
40
 
35
- **inner?**: `unknown`
41
+ ##### inner?
42
+
43
+ `unknown`
36
44
 
37
45
  The inner error if we have wrapped another error.
38
46
 
@@ -22,23 +22,33 @@ Perform a fetch request.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **source**: `string`
25
+ ##### source
26
+
27
+ `string`
26
28
 
27
29
  The source for the request.
28
30
 
29
- **url**: `string`
31
+ ##### url
32
+
33
+ `string`
30
34
 
31
35
  The url for the request.
32
36
 
33
- **method**: [`HttpMethod`](../type-aliases/HttpMethod.md)
37
+ ##### method
38
+
39
+ [`HttpMethod`](../type-aliases/HttpMethod.md)
34
40
 
35
41
  The http method.
36
42
 
37
- **body?**: `string` \| `Uint8Array`
43
+ ##### body?
38
44
 
39
45
  Request to send to the endpoint.
40
46
 
41
- **options?**: `Omit`\<[`IFetchOptions`](../interfaces/IFetchOptions.md), `"cacheTtlSeconds"`\>
47
+ `string` | `Uint8Array`
48
+
49
+ ##### options?
50
+
51
+ `Omit`\<[`IFetchOptions`](../interfaces/IFetchOptions.md), `"cacheTtlSeconds"`\>
42
52
 
43
53
  Options for sending the requests.
44
54
 
@@ -64,23 +74,33 @@ Perform a request in json format.
64
74
 
65
75
  #### Parameters
66
76
 
67
- **source**: `string`
77
+ ##### source
78
+
79
+ `string`
68
80
 
69
81
  The source for the request.
70
82
 
71
- **url**: `string`
83
+ ##### url
84
+
85
+ `string`
72
86
 
73
87
  The url for the request.
74
88
 
75
- **method**: [`HttpMethod`](../type-aliases/HttpMethod.md)
89
+ ##### method
90
+
91
+ [`HttpMethod`](../type-aliases/HttpMethod.md)
76
92
 
77
93
  The http method.
78
94
 
79
- **requestData?**: `T`
95
+ ##### requestData?
96
+
97
+ `T`
80
98
 
81
99
  Request to send to the endpoint.
82
100
 
83
- **options?**: [`IFetchOptions`](../interfaces/IFetchOptions.md)
101
+ ##### options?
102
+
103
+ [`IFetchOptions`](../interfaces/IFetchOptions.md)
84
104
 
85
105
  Options for sending the requests.
86
106
 
@@ -104,23 +124,33 @@ Perform a request for binary data.
104
124
 
105
125
  #### Parameters
106
126
 
107
- **source**: `string`
127
+ ##### source
128
+
129
+ `string`
108
130
 
109
131
  The source for the request.
110
132
 
111
- **url**: `string`
133
+ ##### url
134
+
135
+ `string`
112
136
 
113
137
  The url for the request.
114
138
 
115
- **method**: `"GET"` \| `"POST"`
139
+ ##### method
116
140
 
117
141
  The http method.
118
142
 
119
- **requestData?**: `Uint8Array`
143
+ `"GET"` | `"POST"`
144
+
145
+ ##### requestData?
146
+
147
+ `Uint8Array`
120
148
 
121
149
  Request to send to the endpoint.
122
150
 
123
- **options?**: [`IFetchOptions`](../interfaces/IFetchOptions.md)
151
+ ##### options?
152
+
153
+ [`IFetchOptions`](../interfaces/IFetchOptions.md)
124
154
 
125
155
  Options for sending the requests.
126
156
 
@@ -156,7 +186,9 @@ Get a cache entry.
156
186
 
157
187
  #### Parameters
158
188
 
159
- **url**: `string`
189
+ ##### url
190
+
191
+ `string`
160
192
 
161
193
  The url for the request.
162
194
 
@@ -176,7 +208,9 @@ Remove a cache entry.
176
208
 
177
209
  #### Parameters
178
210
 
179
- **url**: `string`
211
+ ##### url
212
+
213
+ `string`
180
214
 
181
215
  The url for the request.
182
216
 
@@ -28,15 +28,21 @@ Encode a token.
28
28
 
29
29
  #### Parameters
30
30
 
31
- **header**: `U`
31
+ ##### header
32
+
33
+ `U`
32
34
 
33
35
  The header to encode.
34
36
 
35
- **payload**: `T`
37
+ ##### payload
38
+
39
+ `T`
36
40
 
37
41
  The payload to encode.
38
42
 
39
- **key**: `Uint8Array`
43
+ ##### key
44
+
45
+ `Uint8Array`
40
46
 
41
47
  The key for signing the token, can be omitted if a signer is provided.
42
48
 
@@ -62,15 +68,21 @@ Encode a token.
62
68
 
63
69
  #### Parameters
64
70
 
65
- **header**: `U`
71
+ ##### header
72
+
73
+ `U`
66
74
 
67
75
  The header to encode.
68
76
 
69
- **payload**: `T`
77
+ ##### payload
78
+
79
+ `T`
70
80
 
71
81
  The payload to encode.
72
82
 
73
- **signer**
83
+ ##### signer
84
+
85
+ (`alg`, `key`, `payload`) => `Promise`\<`Uint8Array`\>
74
86
 
75
87
  Custom signer method.
76
88
 
@@ -84,7 +96,7 @@ The encoded token.
84
96
 
85
97
  ### decode()
86
98
 
87
- > `static` **decode**\<`U`, `T`\>(`token`): `Promise`\<`object`\>
99
+ > `static` **decode**\<`U`, `T`\>(`token`): `Promise`\<\{ `header`: `U`; `payload`: `T`; `signature`: `Uint8Array`; \}\>
88
100
 
89
101
  Decode a token.
90
102
 
@@ -96,33 +108,23 @@ Decode a token.
96
108
 
97
109
  #### Parameters
98
110
 
99
- **token**: `string`
111
+ ##### token
112
+
113
+ `string`
100
114
 
101
115
  The token to decode.
102
116
 
103
117
  #### Returns
104
118
 
105
- `Promise`\<`object`\>
119
+ `Promise`\<\{ `header`: `U`; `payload`: `T`; `signature`: `Uint8Array`; \}\>
106
120
 
107
121
  The decoded payload.
108
122
 
109
- ##### header?
110
-
111
- > `optional` **header**: `U`
112
-
113
- ##### payload?
114
-
115
- > `optional` **payload**: `T`
116
-
117
- ##### signature?
118
-
119
- > `optional` **signature**: `Uint8Array`
120
-
121
123
  ***
122
124
 
123
125
  ### verify()
124
126
 
125
- > `static` **verify**\<`U`, `T`\>(`token`, `key`): `Promise`\<`object`\>
127
+ > `static` **verify**\<`U`, `T`\>(`token`, `key`): `Promise`\<\{ `verified`: `boolean`; `header`: `U`; `payload`: `T`; `signature`: `Uint8Array`; \}\>
126
128
 
127
129
  Verify a token.
128
130
 
@@ -134,41 +136,29 @@ Verify a token.
134
136
 
135
137
  #### Parameters
136
138
 
137
- **token**: `string`
139
+ ##### token
140
+
141
+ `string`
138
142
 
139
143
  The token to verify.
140
144
 
141
- **key**: `Uint8Array`
145
+ ##### key
146
+
147
+ `Uint8Array`
142
148
 
143
149
  The key for verifying the token
144
150
 
145
151
  #### Returns
146
152
 
147
- `Promise`\<`object`\>
153
+ `Promise`\<\{ `verified`: `boolean`; `header`: `U`; `payload`: `T`; `signature`: `Uint8Array`; \}\>
148
154
 
149
155
  The decoded payload.
150
156
 
151
- ##### verified
152
-
153
- > **verified**: `boolean`
154
-
155
- ##### header?
156
-
157
- > `optional` **header**: `U`
158
-
159
- ##### payload?
160
-
161
- > `optional` **payload**: `T`
162
-
163
- ##### signature?
164
-
165
- > `optional` **signature**: `Uint8Array`
166
-
167
157
  ***
168
158
 
169
159
  ### verifyWithVerifier()
170
160
 
171
- > `static` **verifyWithVerifier**\<`U`, `T`\>(`token`, `verifier`): `Promise`\<`object`\>
161
+ > `static` **verifyWithVerifier**\<`U`, `T`\>(`token`, `verifier`): `Promise`\<\{ `verified`: `boolean`; `header`: `U`; `payload`: `T`; `signature`: `Uint8Array`; \}\>
172
162
 
173
163
  Verify a token.
174
164
 
@@ -180,36 +170,24 @@ Verify a token.
180
170
 
181
171
  #### Parameters
182
172
 
183
- **token**: `string`
173
+ ##### token
174
+
175
+ `string`
184
176
 
185
177
  The token to verify.
186
178
 
187
- **verifier**
179
+ ##### verifier
180
+
181
+ (`alg`, `key`, `payload`, `signature`) => `Promise`\<`boolean`\>
188
182
 
189
183
  Custom verification method.
190
184
 
191
185
  #### Returns
192
186
 
193
- `Promise`\<`object`\>
187
+ `Promise`\<\{ `verified`: `boolean`; `header`: `U`; `payload`: `T`; `signature`: `Uint8Array`; \}\>
194
188
 
195
189
  The decoded payload.
196
190
 
197
- ##### verified
198
-
199
- > **verified**: `boolean`
200
-
201
- ##### header?
202
-
203
- > `optional` **header**: `U`
204
-
205
- ##### payload?
206
-
207
- > `optional` **payload**: `T`
208
-
209
- ##### signature?
210
-
211
- > `optional` **signature**: `Uint8Array`
212
-
213
191
  ***
214
192
 
215
193
  ### verifySignature()
@@ -226,23 +204,33 @@ Verify a token by parts.
226
204
 
227
205
  #### Parameters
228
206
 
229
- **header?**: `U`
207
+ ##### header?
208
+
209
+ `U`
230
210
 
231
211
  The header to verify.
232
212
 
233
- **payload?**: `T`
213
+ ##### payload?
214
+
215
+ `T`
234
216
 
235
217
  The payload to verify.
236
218
 
237
- **signature?**: `Uint8Array`
219
+ ##### signature?
220
+
221
+ `Uint8Array`
238
222
 
239
223
  The signature to verify.
240
224
 
241
- **key?**: `Uint8Array`
225
+ ##### key?
226
+
227
+ `Uint8Array`
242
228
 
243
229
  The key for verifying the token, if not provided no verification occurs.
244
230
 
245
- **verifier?**
231
+ ##### verifier?
232
+
233
+ (`alg`, `key`, `payload`, `signature`) => `Promise`\<`boolean`\>
246
234
 
247
235
  Custom verification method.
248
236
 
@@ -262,15 +250,21 @@ The default signer for the JWT.
262
250
 
263
251
  #### Parameters
264
252
 
265
- **alg**: [`JwtAlgorithms`](../type-aliases/JwtAlgorithms.md)
253
+ ##### alg
254
+
255
+ [`JwtAlgorithms`](../type-aliases/JwtAlgorithms.md)
266
256
 
267
257
  The algorithm to use.
268
258
 
269
- **key**: `undefined` \| `Uint8Array`
259
+ ##### key
270
260
 
271
261
  The key to sign with.
272
262
 
273
- **payload**: `Uint8Array`
263
+ `undefined` | `Uint8Array`
264
+
265
+ ##### payload
266
+
267
+ `Uint8Array`
274
268
 
275
269
  The payload to sign.
276
270
 
@@ -290,19 +284,27 @@ The default verifier for the JWT.
290
284
 
291
285
  #### Parameters
292
286
 
293
- **alg**: [`JwtAlgorithms`](../type-aliases/JwtAlgorithms.md)
287
+ ##### alg
288
+
289
+ [`JwtAlgorithms`](../type-aliases/JwtAlgorithms.md)
294
290
 
295
291
  The algorithm to use.
296
292
 
297
- **key**: `undefined` \| `Uint8Array`
293
+ ##### key
298
294
 
299
295
  The key to verify with.
300
296
 
301
- **payload**: `Uint8Array`
297
+ `undefined` | `Uint8Array`
298
+
299
+ ##### payload
300
+
301
+ `Uint8Array`
302
302
 
303
303
  The payload to verify.
304
304
 
305
- **signature**: `Uint8Array`
305
+ ##### signature
306
+
307
+ `Uint8Array`
306
308
 
307
309
  The signature to verify.
308
310
 
@@ -22,7 +22,9 @@ Detect the mime type from a byte array.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **data**: `Uint8Array`
25
+ ##### data
26
+
27
+ `Uint8Array`
26
28
 
27
29
  The data to test.
28
30
 
@@ -42,10 +44,12 @@ Return the default extension for a mime type.
42
44
 
43
45
  #### Parameters
44
46
 
45
- **mimeType**: `undefined` \| `string`
47
+ ##### mimeType
46
48
 
47
49
  The mimetype to get the extension for.
48
50
 
51
+ `undefined` | `string`
52
+
49
53
  #### Returns
50
54
 
51
55
  `undefined` \| `string`
@@ -4,4 +4,4 @@ Model used for Http headers parameter.
4
4
 
5
5
  ## Indexable
6
6
 
7
- \[`key`: `string`\]: `string` \| `string`[]
7
+ \[`key`: `string`\]: `string` \| `string`[]
@@ -4,7 +4,7 @@ The fields in a JSON Web Key.
4
4
 
5
5
  ## Indexable
6
6
 
7
- \[`key`: `string`\]: `unknown`
7
+ \[`key`: `string`\]: `unknown`
8
8
 
9
9
  ## Properties
10
10
 
@@ -4,7 +4,7 @@ The fields in a JSON Web Token header.
4
4
 
5
5
  ## Indexable
6
6
 
7
- \[`key`: `string`\]: `unknown`
7
+ \[`key`: `string`\]: `unknown`
8
8
 
9
9
  ## Properties
10
10
 
@@ -4,7 +4,7 @@ The fields in a JSON Web Token payload.
4
4
 
5
5
  ## Indexable
6
6
 
7
- \[`key`: `string`\]: `unknown`
7
+ \[`key`: `string`\]: `unknown`
8
8
 
9
9
  ## Properties
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/web",
3
- "version": "0.0.1-next.17",
3
+ "version": "0.0.1-next.19",
4
4
  "description": "Contains classes for use with web operations",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,8 +14,8 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/core": "0.0.1-next.17",
18
- "@twin.org/crypto": "0.0.1-next.17",
17
+ "@twin.org/core": "0.0.1-next.19",
18
+ "@twin.org/crypto": "0.0.1-next.19",
19
19
  "@twin.org/nameof": "next"
20
20
  },
21
21
  "main": "./dist/cjs/index.cjs",