@t4h.framework/http 0.7.5 → 0.8.1
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/.ai/skills/framework-http/SKILL.md +83 -306
- package/CHANGELOG.md +35 -0
- package/README.md +16 -136
- package/dist/activities/AbstractHttpRequestActivity.d.ts +3 -3
- package/dist/activities/AbstractHttpRequestActivity.d.ts.map +1 -1
- package/dist/activities/AbstractHttpRequestActivity.js +8 -4
- package/dist/activities/AbstractHttpRequestActivity.js.map +1 -1
- package/dist/activities/HttpRequestActivity.d.ts +1 -1
- package/dist/activities/HttpRequestActivity.d.ts.map +1 -1
- package/dist/activities/HttpRequestActivity.js.map +1 -1
- package/dist/errors/HttpError.d.ts.map +1 -1
- package/dist/errors/HttpError.js +0 -2
- package/dist/errors/HttpError.js.map +1 -1
- package/dist/models/HttpBodyUpload.d.ts +1 -1
- package/dist/models/HttpBodyUpload.d.ts.map +1 -1
- package/dist/models/HttpBodyUpload.js +2 -2
- package/dist/models/HttpBodyUpload.js.map +1 -1
- package/dist/models/HttpClientRequestClaim.d.ts +1 -1
- package/dist/models/HttpClientRequestClaim.d.ts.map +1 -1
- package/dist/models/OAuth2.d.ts.map +1 -1
- package/dist/models/OAuth2.js +1 -1
- package/dist/models/OAuth2.js.map +1 -1
- package/dist/tools/resolve-body-refs.d.ts.map +1 -1
- package/dist/tools/resolve-body-refs.js +8 -2
- package/dist/tools/resolve-body-refs.js.map +1 -1
- package/package.json +6 -5
|
@@ -1,346 +1,123 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: framework-http
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
`http`
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Calls external HTTP APIs from T4H Framework workflows with
|
|
5
|
+
@t4h.framework/http: the `http` client and `HttpClient` (get, post, put,
|
|
6
|
+
patch, delete, extend, baseUrl), request bodies (json, text, form, binary,
|
|
7
|
+
HttpBodyUpload, HttpBodyRef), `Response` and `Body`, and authentication
|
|
8
|
+
(Basic, bearer, header, OAuth2ClientCredentials,
|
|
9
|
+
OAuth2GrantResourceOwnerPassword, custom HttpAuth) with `Secret` credentials.
|
|
10
|
+
Use when a workflow calls a REST API, sends a webhook, uploads or downloads a
|
|
11
|
+
file over HTTP, authenticates a request, or when a test mocks
|
|
12
|
+
HttpClientRequestClaim and FileSystemClaim.
|
|
9
13
|
---
|
|
10
14
|
|
|
11
15
|
# @t4h.framework/http
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
Use the `http` client in the workflow. Each call is a durable step: it runs
|
|
18
|
+
once and the workflow reuses the recorded `Response` on replay.
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```typescript
|
|
18
|
-
import {
|
|
19
|
-
http,
|
|
20
|
-
HttpClient,
|
|
21
|
-
HttpClientRequestClaim,
|
|
22
|
-
HttpAuth,
|
|
23
|
-
OAuth2,
|
|
24
|
-
OAuth2ClientCredentials,
|
|
25
|
-
OAuth2GrantResourceOwnerPassword,
|
|
26
|
-
Body,
|
|
27
|
-
Response,
|
|
28
|
-
type HttpClientRequestClaimInput,
|
|
29
|
-
type HttpClientRequestClaimOutput,
|
|
30
|
-
} from '@t4h.framework/http'
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
> Workflows use the **`http` / `HttpClient`** client. The package also exports
|
|
34
|
-
> the underlying `HttpRequestActivity` / `AbstractHttpRequestActivity`, but
|
|
35
|
-
> workflow code never imports, instantiates, or extends them.
|
|
36
|
-
|
|
37
|
-
## Architecture
|
|
38
|
-
|
|
39
|
-
`Workflow` → `http`/`HttpClient` (`History.bind(HttpRequestActivity)`) → `AbstractHttpRequestActivity.run` → `HttpClientRequestClaim.request` + `FileSystemClaim.write` (response → `Body`/`Response`).
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Claims
|
|
44
|
-
|
|
45
|
-
### HttpClientRequestClaim (required for HTTP)
|
|
46
|
-
|
|
47
|
-
Runtime must register an implementation:
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
{ provide: HttpClientRequestClaim, value: new MyHttpClientRequestClaimImpl() }
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Contract:
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
abstract class HttpClientRequestClaim {
|
|
57
|
-
abstract request(
|
|
58
|
-
input: HttpClientRequestClaimInput,
|
|
59
|
-
): HttpClientRequestClaimOutput | Promise<HttpClientRequestClaimOutput>
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// HttpClientRequestClaimInput
|
|
63
|
-
{
|
|
64
|
-
url: URL
|
|
65
|
-
method: HttpMethod // required on claim input
|
|
66
|
-
body: Buffer | FormData | Readable | URLSearchParams | undefined
|
|
67
|
-
headers: Record<string, string | string[] | undefined>
|
|
68
|
-
redirect: 'follow' | 'manual' | number
|
|
69
|
-
retry: boolean | HttpRequestActivityInputRetryOptions
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// HttpClientRequestClaimOutput
|
|
73
|
-
{
|
|
74
|
-
status: number
|
|
75
|
-
headers: Record<string, string | string[] | undefined>
|
|
76
|
-
body: Readable
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
The runtime provides a concrete implementation; workflow tests mock it (see **Testing** below).
|
|
81
|
-
|
|
82
|
-
### FileSystemClaim (required by the HTTP activity)
|
|
83
|
-
|
|
84
|
-
The HTTP activity persists the response body to `fs` (path `\`${uuid}-http-request-activity-response-body.${ext}\``, extension from `content-type` via `mime`, or `.bin`) and returns it wrapped in a `Body`. So any workflow that makes an HTTP call also needs a `FileSystemClaim` provider; tests mock its `write` to return a `Binary`.
|
|
85
|
-
|
|
86
|
-
### CacheClaim (OAuth only)
|
|
87
|
-
|
|
88
|
-
`HttpAuth` / `OAuth2` use `CacheClaim` for token caching. OAuth2 stores tokens at `oauth2:token:${clientId}` with TTL derived from `expires_in` (90% of lifetime).
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## HttpRequestActivityInput
|
|
93
|
-
|
|
94
|
-
Shared by activities and `HttpClient` config (minus `url` / `baseUrl` on client methods):
|
|
95
|
-
|
|
96
|
-
| Field | Type | Default / notes |
|
|
97
|
-
|-------|------|-----------------|
|
|
98
|
-
| `url` | `string` | Resolved with `new URL(url, baseUrl)` |
|
|
99
|
-
| `baseUrl` | `string?` | Optional base for relative paths |
|
|
100
|
-
| `method` | `HttpMethod?` | `'GET'` |
|
|
101
|
-
| `body` | `{ json }` \| `{ text }` \| `{ form }` | See below |
|
|
102
|
-
| `headers` | `Record<...>?` | Merged with body-derived headers; `auth` sets `Authorization` and overrides a custom `Authorization` header. A default `User-Agent` is added when none is given (any casing) |
|
|
103
|
-
| `auth` | `HttpAuth` \| `{ username, password }` | Basic auth object or subclass with `getAuthorizationHeader()` |
|
|
104
|
-
| `retry` | `boolean` \| retry options | `true` |
|
|
105
|
-
| `redirect` | `'follow' \| 'manual' \| number` | `'follow'` |
|
|
106
|
-
|
|
107
|
-
**Body shapes** (handled in `AbstractHttpRequestActivity.getContent`):
|
|
108
|
-
|
|
109
|
-
- `{ json: Serializable }` → `application/json` + `Content-Length`
|
|
110
|
-
- `{ text: string }` → `text/plain` + `Content-Length`
|
|
111
|
-
- `{ form: HttpRequestActivityInputBodyFormData }` → `FormData` (nested keys as `parent[key]`; `Binary` fields get generated filenames; `undefined` / `null` skipped)
|
|
112
|
-
|
|
113
|
-
Invalid body shape throws `Invalid body`.
|
|
114
|
-
|
|
115
|
-
**Form values:** `string | number | boolean | null | undefined | Binary | nested object | readonly array of nested form data`.
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## Making HTTP calls in a workflow
|
|
120
|
-
|
|
121
|
-
Always use the ready **`http` / `HttpClient`** helper — it is what the package
|
|
122
|
-
exports for workflows and it drives the underlying HTTP activity through the
|
|
123
|
-
reconciler for you (replay-safe). Never define, extend, or hand-instantiate an
|
|
124
|
-
activity in workflow code.
|
|
125
|
-
|
|
126
|
-
For a typed result, read the response and map with plain TypeScript:
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
const res = await http.get(`${environments.SERVICE_URL}/data`)
|
|
130
|
-
const data = await res.body.json<MyType>()
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
See **HttpClient and `http`** and **Response and Body** below.
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## HttpClient and `http`
|
|
138
|
-
|
|
139
|
-
`HttpClient` wraps `HttpRequestActivity` via `History.bind`. Calls inside a workflow are **reconciler-driven** (replay-safe); they throw `PushActivity` when history needs a new step.
|
|
20
|
+
## Call an API
|
|
140
21
|
|
|
141
22
|
```typescript
|
|
142
23
|
import { http } from '@t4h.framework/http'
|
|
143
24
|
|
|
144
|
-
|
|
145
|
-
const response = await http.get('https://api.example.com/users')
|
|
146
|
-
const users = await response.body.json()
|
|
25
|
+
const api = http.extend({ baseUrl: environments.SERVICE_URL })
|
|
147
26
|
|
|
148
|
-
|
|
149
|
-
await http.post('https://api.example.com/users', {
|
|
150
|
-
json: { name: 'John', email: 'john@example.com' },
|
|
151
|
-
})
|
|
27
|
+
const response = await api.post('/orders', { json: { id: 1 } })
|
|
152
28
|
|
|
153
|
-
|
|
154
|
-
const api = http.extend({ baseUrl: 'https://api.example.com' })
|
|
155
|
-
const list = await api.get('/users')
|
|
29
|
+
if (response.status !== 201) throw new Error(`Order failed: ${response.status}`)
|
|
156
30
|
|
|
157
|
-
|
|
158
|
-
const client = new HttpClient({
|
|
159
|
-
baseUrl: 'https://api.example.com',
|
|
160
|
-
auth: { username: 'user', password: environments.API_PASSWORD },
|
|
161
|
-
})
|
|
31
|
+
const order = await response.body.json<{ id: string }>()
|
|
162
32
|
```
|
|
163
33
|
|
|
164
|
-
|
|
34
|
+
1. Make one client per API with `http.extend({ baseUrl, auth })`.
|
|
35
|
+
2. Give the body as a tagged object: `{ json }`, `{ text }`, `{ form }` or
|
|
36
|
+
`{ binary }`.
|
|
37
|
+
3. Check `response.status` yourself, then read the body once with
|
|
38
|
+
`json<T>()`, `text()` or `stream()`. Map the data with plain TypeScript.
|
|
165
39
|
|
|
166
|
-
|
|
40
|
+
## Authenticate
|
|
167
41
|
|
|
168
42
|
```typescript
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
await http.post('https://example.com/webhook', {
|
|
174
|
-
json: { status: 'ok' },
|
|
175
|
-
})
|
|
43
|
+
// src/constants/environments.ts
|
|
44
|
+
export const environments = EnvDesign({
|
|
45
|
+
API_TOKEN: { type: Secret },
|
|
46
|
+
OAUTH_SECRET: { type: Secret },
|
|
176
47
|
})
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
---
|
|
180
48
|
|
|
181
|
-
|
|
49
|
+
await http.get(url, { auth: { bearer: environments.API_TOKEN } })
|
|
182
50
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
`Body` (backed by `Binary` from filesystem claim):
|
|
192
|
-
|
|
193
|
-
```typescript
|
|
194
|
-
response.body.contentType
|
|
195
|
-
response.body.contentLength
|
|
196
|
-
await response.body.text()
|
|
197
|
-
await response.body.json<T>() // only if content-type matches */json or */*+json
|
|
198
|
-
await response.body.stream()
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
`body.json()` throws `Invalid content type` for non-JSON types (e.g. `text/plain`, `text/html`).
|
|
202
|
-
|
|
203
|
-
`Body` extends `SerializableClass` (`packages/http/src/models/Body.ts`) and is
|
|
204
|
-
persisted through `FileSystemClaim`, so the `Response`/`Body` returned by the
|
|
205
|
-
`http` client **is replay-safe** — it is serialized between reconciler steps and
|
|
206
|
-
rebuilt on replay. You do **not** need a custom activity to "flatten" the body
|
|
207
|
-
into history; read it with `await res.body.json<T>()` in the workflow and
|
|
208
|
-
transform with plain TypeScript.
|
|
209
|
-
|
|
210
|
-
Serializable shape: `{ binary: ... }` via `toSerializable` / `fromSerializable`.
|
|
211
|
-
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
## Authentication
|
|
215
|
-
|
|
216
|
-
Every credential is a `Secret` from the project's `EnvDesign` (`type: Secret`), never a string — `tsc` rejects a string. The activity writes the header on the host, where the value is read, so neither the workflow nor the recorded input holds it. Do not build `Authorization` in `headers` yourself: a `Secret` throws when interpolated.
|
|
217
|
-
|
|
218
|
-
### Basic (inline)
|
|
219
|
-
|
|
220
|
-
```typescript
|
|
221
|
-
await http.get('https://api.example.com/data', {
|
|
222
|
-
auth: { username: 'user', password: environments.API_PASSWORD },
|
|
223
|
-
})
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### Bearer token / API key header
|
|
227
|
-
|
|
228
|
-
```typescript
|
|
229
|
-
await http.get('https://api.example.com/data', { auth: { bearer: environments.API_TOKEN } })
|
|
230
|
-
await http.get('https://api.example.com/data', { auth: { header: 'X-Api-Key', value: environments.API_KEY } })
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### Custom HttpAuth
|
|
234
|
-
|
|
235
|
-
Subclass `HttpAuth` (extends `SerializableClass`), implement `getAuthorizationHeader()`, and optional `toSerializable` / `fromSerializable` for workflow persistence.
|
|
236
|
-
|
|
237
|
-
### OAuth2 client credentials
|
|
238
|
-
|
|
239
|
-
```typescript
|
|
240
|
-
import { http, OAuth2ClientCredentials } from '@t4h.framework/http'
|
|
241
|
-
|
|
242
|
-
const auth = new OAuth2ClientCredentials({
|
|
243
|
-
tokenUrl: 'https://auth.example.com/token',
|
|
244
|
-
clientId: 'my-client-id',
|
|
245
|
-
clientSecret: environments.OAUTH_CLIENT_SECRET, // Secret
|
|
51
|
+
const api = http.extend({
|
|
52
|
+
baseUrl: 'https://api.example.com',
|
|
53
|
+
auth: new OAuth2ClientCredentials({
|
|
54
|
+
tokenUrl: 'https://auth.example.com/token',
|
|
55
|
+
clientId: 'my-client-id',
|
|
56
|
+
clientSecret: environments.OAUTH_SECRET,
|
|
57
|
+
}),
|
|
246
58
|
})
|
|
247
|
-
|
|
248
|
-
await http.get('https://api.example.com/data', { auth })
|
|
249
59
|
```
|
|
250
60
|
|
|
251
|
-
|
|
61
|
+
Other shapes: `{ username, password }`, `{ header, value }`,
|
|
62
|
+
`OAuth2GrantResourceOwnerPassword`, or a subclass of `HttpAuth`.
|
|
63
|
+
|
|
64
|
+
## Traps
|
|
65
|
+
|
|
66
|
+
- Do not use `fetch`, `node:http` or `axios` in a workflow:
|
|
67
|
+
`no-io-in-workflow` rejects them. Do not construct or extend
|
|
68
|
+
`HttpRequestActivity` or `AbstractHttpRequestActivity`:
|
|
69
|
+
`no-framework-activity-in-app` rejects it. Do not write an activity to
|
|
70
|
+
"flatten" the response: `Response` and `Body` are already replay-safe.
|
|
71
|
+
- Each credential is a `Secret` from the `EnvDesign` in
|
|
72
|
+
`src/constants/environments.ts`. `tsc` rejects a string in `password`,
|
|
73
|
+
`bearer`, `value`, `clientSecret`. Do not build `Authorization` in
|
|
74
|
+
`headers`: a `Secret` throws when interpolated. A `Secret` can be a value in
|
|
75
|
+
`headers` for extra credential headers.
|
|
76
|
+
- A 4xx or 5xx status does not throw.
|
|
77
|
+
- `body.json()` throws `Invalid content type` unless the content type matches
|
|
78
|
+
`*/json` or `*/*+json`. Use `text()` for other types.
|
|
79
|
+
- `extend` exists only on the `http` singleton. The client it returns has no
|
|
80
|
+
`extend`. A per-request `auth` replaces the client `auth`.
|
|
81
|
+
- A url that starts with `/` replaces the path of `baseUrl` (`new URL` rules).
|
|
82
|
+
- `auth` and the body headers replace a custom header with the same name.
|
|
83
|
+
- Do not put a base64 file or a pre-signed URL in a JSON body. Use
|
|
84
|
+
`new HttpBodyUpload(binary, { signer: { url } })` in the body: it uploads
|
|
85
|
+
when the request is sent and resolves to the URL.
|
|
86
|
+
- OAuth2 tokens are cached under `oauth2:token:<clientId>`. Two grants with the
|
|
87
|
+
same `clientId` share one token.
|
|
88
|
+
- The runtime must provide `HttpClientRequestClaim` and `FileSystemClaim` for
|
|
89
|
+
every call, and `CacheClaim` for OAuth2.
|
|
90
|
+
|
|
91
|
+
## Test
|
|
92
|
+
|
|
93
|
+
Run the workflow with `TestWorkflowEnvironment` and mock both claims with
|
|
94
|
+
`mockClaim` from `@t4h.framework/core/testing` (see the
|
|
95
|
+
**framework-workflow-testing** skill):
|
|
252
96
|
|
|
253
97
|
```typescript
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const auth = new OAuth2GrantResourceOwnerPassword({
|
|
257
|
-
tokenUrl: 'https://auth.example.com/token',
|
|
258
|
-
clientId: 'my-client-id',
|
|
259
|
-
clientSecret: environments.OAUTH_CLIENT_SECRET, // Secret
|
|
260
|
-
username: 'user',
|
|
261
|
-
password: environments.OAUTH_PASSWORD, // Secret
|
|
262
|
-
})
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
OAuth2 flow: POST `application/x-www-form-urlencoded` to `tokenUrl` via `HttpClientRequestClaim`; cache token; refresh with `grant_type=refresh_token` when expired if `refresh_token` present; header format `${token_type} ${access_token}`.
|
|
266
|
-
|
|
267
|
-
The token request throws when the response is non-2xx, is not valid JSON, or lacks `access_token`/`token_type`, so a broken token endpoint surfaces at the token step instead of producing an `undefined undefined` `Authorization` header on the next call.
|
|
268
|
-
|
|
269
|
-
Requires `CacheClaim` + `HttpClientRequestClaim` in the runtime.
|
|
270
|
-
|
|
271
|
-
---
|
|
272
|
-
|
|
273
|
-
## Testing
|
|
274
|
-
|
|
275
|
-
Test the **workflow** with `TestWorkflowEnvironment` from
|
|
276
|
-
`@t4h.framework/core/testing`, mocking the two claims the HTTP activity uses:
|
|
277
|
-
`HttpClientRequestClaim` (the network request) and `FileSystemClaim` (where the
|
|
278
|
-
activity persists the response body). See the **framework-workflow-testing** skill
|
|
279
|
-
for the full harness API.
|
|
280
|
-
|
|
281
|
-
```typescript
|
|
282
|
-
import { Readable } from 'node:stream'
|
|
283
|
-
import { Binary } from '@t4h.framework/core'
|
|
284
|
-
import { TestWorkflowEnvironment, mockClaim } from '@t4h.framework/core/testing'
|
|
285
|
-
import { HttpClientRequestClaim } from '@t4h.framework/http'
|
|
286
|
-
import { FileSystemClaim } from '@t4h.framework/fs'
|
|
287
|
-
|
|
288
|
-
// Minimal Binary the FileSystemClaim mock returns from write().
|
|
289
|
-
class MockBinary extends Binary {
|
|
290
|
-
public readonly contentType = 'application/json'
|
|
291
|
-
public readonly contentLength: number
|
|
292
|
-
|
|
293
|
-
constructor(private readonly data: Buffer) {
|
|
294
|
-
super()
|
|
295
|
-
this.contentLength = data.byteLength
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
public stream() {
|
|
299
|
-
return Readable.from(this.data)
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
const body = Buffer.from(JSON.stringify({ ok: true }))
|
|
304
|
-
|
|
305
|
-
// mockImplementation (not mockResolvedValue): replay runs the workflow twice, so
|
|
306
|
-
// each call must hand back a fresh, unconsumed stream.
|
|
307
|
-
const mockRequest = vi.fn().mockImplementation(async () => ({
|
|
98
|
+
const request = vi.fn().mockImplementation(async () => ({
|
|
308
99
|
status: 200,
|
|
309
100
|
headers: { 'content-type': 'application/json' },
|
|
310
101
|
body: Readable.from(body),
|
|
311
102
|
}))
|
|
312
103
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const env = TestWorkflowEnvironment.create({ now: 0 })
|
|
316
|
-
|
|
317
|
-
const output = await env.execute(workflow, input, {
|
|
104
|
+
await env.execute(workflow, input, {
|
|
318
105
|
claims: [
|
|
319
|
-
mockClaim(HttpClientRequestClaim, { request
|
|
320
|
-
mockClaim(FileSystemClaim, { write:
|
|
106
|
+
mockClaim(HttpClientRequestClaim, { request }),
|
|
107
|
+
mockClaim(FileSystemClaim, { write: async () => new JsonBinary(body) }),
|
|
321
108
|
],
|
|
322
|
-
env: { SERVICE_URL: 'https://api.example.com' },
|
|
323
109
|
})
|
|
324
|
-
|
|
325
|
-
// request input carries a URL object
|
|
326
|
-
expect(mockRequest.mock.calls[0][0].url).toEqual(
|
|
327
|
-
new URL('https://api.example.com/data'),
|
|
328
|
-
)
|
|
329
110
|
```
|
|
330
111
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
## Checklist for agents
|
|
112
|
+
Use `mockImplementation`, not `mockResolvedValue`: the replay check calls the
|
|
113
|
+
mock again and needs a new stream. `JsonBinary` is a small `Binary` subclass in
|
|
114
|
+
the test file only (the full example is on the site). The request mock gets
|
|
115
|
+
`url` as a `URL`; assert on `request.mock.calls`.
|
|
336
116
|
|
|
337
|
-
|
|
338
|
-
2. Never call `fetch` directly in workflow code if the step must be replayable — use the package APIs.
|
|
339
|
-
3. Ensure runtime provides **`HttpClientRequestClaim`** and **`FileSystemClaim`** (or pass mocks in tests).
|
|
340
|
-
4. Use **`{ json: ... }`**, **`{ text: ... }`**, or **`{ form: ... }`** for bodies — not raw `Buffer` on activity input.
|
|
341
|
-
5. Read responses with **`await response.body.json()`** or **`text()`**; check `status` explicitly (no automatic throw on 4xx/5xx).
|
|
342
|
-
6. For OAuth, wire **`CacheClaim`** and use exported grant classes only.
|
|
343
|
-
7. Test workflows with **`TestWorkflowEnvironment`** + **`mockClaim`**, mocking **`HttpClientRequestClaim`** and **`FileSystemClaim`**; assert on `mockRequest.mock.calls`.
|
|
344
|
-
8. Do not document or import APIs not exported from `@t4h.framework/http`.
|
|
117
|
+
## Reference
|
|
345
118
|
|
|
346
|
-
|
|
119
|
+
- Overview, claims and testing: https://tech4humans-brasil.github.io/framework/http/
|
|
120
|
+
- Requests, options and uploads: https://tech4humans-brasil.github.io/framework/http/requests
|
|
121
|
+
- Authentication: https://tech4humans-brasil.github.io/framework/http/authentication
|
|
122
|
+
- Responses: https://tech4humans-brasil.github.io/framework/http/responses
|
|
123
|
+
- Types: `node_modules/@t4h.framework/http/dist/http.d.ts`
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @t4h.framework/http
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#257](https://github.com/tech4humans-brasil/framework/pull/257) [`586bfb4`](https://github.com/tech4humans-brasil/framework/commit/586bfb4663f4a478527ee0c8db360603f034d615) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The http docs now hold the full contract: request options, header order, OAuth2 token cache, custom `HttpAuth`, status codes and testing. The README is short and the skill keeps only the traps and links to the site.
|
|
8
|
+
|
|
9
|
+
## 0.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#249](https://github.com/tech4humans-brasil/framework/pull/249) [`9e683b4`](https://github.com/tech4humans-brasil/framework/commit/9e683b4ca955f62b46a7322f427e827a9cf7bcd9) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - `headers` accepts a `Secret` as a value. The activity reads the value of each `Secret` header right before the request, so the history and the panel show only the name of the secret. A `Secret` that the host did not resolve throws before the request, and its name is not sent. `HttpClientRequestClaimInput.headers` still holds only strings, so a host claim does not change.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#241](https://github.com/tech4humans-brasil/framework/pull/241) [`f6b8454`](https://github.com/tech4humans-brasil/framework/commit/f6b845484d22e7c8e7240fe2e113f1cdea7c8ce3) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Adds seven rules to `@t4h.framework/core/eslint` and turns them on in `configs.recommended`:
|
|
18
|
+
- `no-io-in-workflow` reports `fetch` and calls to network, file, database and mail modules in a workflow and in the `constructor`, `toInput` and `toOutput` of an activity. It also reports `zlib` and `stream` calls there, because they work on the content in memory on each replay.
|
|
19
|
+
- `no-binary-subclass` reports a class that extends `Binary`.
|
|
20
|
+
- `no-framework-activity-in-app` reports `new` and `extends` on an activity of a framework package other than the core.
|
|
21
|
+
- `no-testing-import-in-source` reports an import of a `@t4h.framework/<package>/testing` entry out of a test file.
|
|
22
|
+
- `require-workflow-id` reports a `Workflow` with no `id`.
|
|
23
|
+
- `no-secret-to-string` reports a `Secret` that becomes a string.
|
|
24
|
+
- `no-literal-secret-in-authorization` reports a string literal in the `secret` or `clientSecret` field of an `Authorization`.
|
|
25
|
+
|
|
26
|
+
The package skills now name these rules in place of the text that the rules enforce. The docs and skills give each `Workflow` an `id`, read the HMAC secret from `EnvDesign`, and do not document a custom HTTP activity.
|
|
27
|
+
|
|
28
|
+
- [#243](https://github.com/tech4humans-brasil/framework/pull/243) [`0ffd663`](https://github.com/tech4humans-brasil/framework/commit/0ffd663ce8369edd7b54206cb3216568ad1de471) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The README examples read each value from `environments`, an `EnvDesign` in `src/constants/environments.ts`, and pass each credential as a `Secret`. They no longer use `process.env`, the raw `env` from the core or a literal in a `Secret` field. The jwks README describes the real context fields (`signature`, `rawPayload`) and says that a token that `jwt.verify` rejects throws.
|
|
29
|
+
|
|
30
|
+
- [#240](https://github.com/tech4humans-brasil/framework/pull/240) [`0606115`](https://github.com/tech4humans-brasil/framework/commit/0606115e2e0baa994e9f0ed3559ee54ecac88e44) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The skills do not repeat a rule that a lint rule, `tsc` or a runtime error already enforces. Each such rule is now one line that names the gate. The examples that broke a gate (`process.env`, `as any`, an inline secret, an `EnvDesign` in a workflow file, `ref.output` before `wait()`) are correct now.
|
|
31
|
+
|
|
32
|
+
- [#228](https://github.com/tech4humans-brasil/framework/pull/228) [`d29e1ab`](https://github.com/tech4humans-brasil/framework/commit/d29e1ab29a039b13c3e4b075472bd615566ae75e) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Uses exact types and `unknown` in place of `any`, and checks external data with guards.
|
|
33
|
+
- harness: the fix-issues prompt lists each sensor as `- checkTypes: PASS`. Before, it printed `- 0: [object Object]`.
|
|
34
|
+
- hmac: an algorithm name such as `constructor` throws `Unsupported algorithm`.
|
|
35
|
+
- oidc: a discovery response with no `introspection_endpoint`, or a null introspection body, throws a clear error.
|
|
36
|
+
- `HttpRequestActivity.toOutput` takes `HttpRequestActivityOutput` in place of `any`.
|
|
37
|
+
|
|
3
38
|
## 0.7.5
|
|
4
39
|
|
|
5
40
|
## 0.7.4
|
package/README.md
CHANGED
|
@@ -1,153 +1,33 @@
|
|
|
1
1
|
# @t4h.framework/http
|
|
2
2
|
|
|
3
|
-
HTTP
|
|
3
|
+
HTTP client for T4H Framework workflows. Each call is a durable step: it runs
|
|
4
|
+
once, and the workflow reuses the recorded response on replay.
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
+
## Install
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Abstract dependency for performing raw HTTP requests. The runtime must provide a concrete implementation.
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
import { HttpClientRequestClaim } from '@t4h.framework/http'
|
|
13
|
-
|
|
14
|
-
// the runtime provides this:
|
|
15
|
-
// { provide: HttpClientRequestClaim, value: new MyHttpClientRequestClaimImpl() }
|
|
8
|
+
```bash
|
|
9
|
+
npm install @t4h.framework/http
|
|
16
10
|
```
|
|
17
11
|
|
|
18
|
-
|
|
12
|
+
Peer dependencies: `@t4h.framework/core`, `@t4h.framework/fs` and
|
|
13
|
+
`@t4h.framework/cache`.
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
A `SyncActivity` that performs an HTTP request and returns a `Response`. Internally it uses `HttpClientRequestClaim` and `FileSystemClaim` to execute the request and persist the response body.
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
import { HttpRequestActivity } from '@t4h.framework/http'
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### AbstractHttpRequestActivity
|
|
29
|
-
|
|
30
|
-
Base class for building custom HTTP activities. Extend it and implement `toHttpInput` and `toHttpOutput`:
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
import { AbstractHttpRequestActivity } from '@t4h.framework/http'
|
|
34
|
-
import type { HttpRequestActivityInput, HttpRequestActivityOutput } from '@t4h.framework/http'
|
|
35
|
-
import type { Serializable } from '@t4h.framework/core'
|
|
36
|
-
|
|
37
|
-
class MyCustomHttpActivity extends AbstractHttpRequestActivity<
|
|
38
|
-
[url: string],
|
|
39
|
-
{ url: string }
|
|
40
|
-
> {
|
|
41
|
-
public async toInput(url: string) {
|
|
42
|
-
return { url }
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
protected async toHttpInput(input: { url: string }): Promise<HttpRequestActivityInput> {
|
|
46
|
-
return { url: input.url, method: 'GET' }
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
protected async toHttpOutput(output: HttpRequestActivityOutput): Promise<Serializable> {
|
|
50
|
-
return { status: output.status }
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public toOutput(output: { status: number }) {
|
|
54
|
-
return output
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## HttpClient
|
|
60
|
-
|
|
61
|
-
High-level HTTP client that wraps `HttpRequestActivity` behind a simple API. Available as a singleton `http` or instantiated with custom config.
|
|
62
|
-
|
|
63
|
-
### Basic usage
|
|
15
|
+
## Usage
|
|
64
16
|
|
|
65
17
|
```typescript
|
|
18
|
+
import { Workflow } from '@t4h.framework/core'
|
|
66
19
|
import { http } from '@t4h.framework/http'
|
|
67
20
|
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
```
|
|
21
|
+
export const syncUsers = new Workflow({ id: 'sync-users' }, async () => {
|
|
22
|
+
const response = await http.get('https://api.example.com/users')
|
|
71
23
|
|
|
72
|
-
|
|
24
|
+
const users = await response.body.json<{ id: string }[]>()
|
|
73
25
|
|
|
74
|
-
|
|
75
|
-
const response = await http.post('https://api.example.com/users', {
|
|
76
|
-
json: { name: 'John', email: 'john@example.com' },
|
|
26
|
+
return { count: users.length }
|
|
77
27
|
})
|
|
78
28
|
```
|
|
79
29
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
```typescript
|
|
83
|
-
import { http } from '@t4h.framework/http'
|
|
84
|
-
|
|
85
|
-
const api = http.extend({ baseUrl: 'https://api.example.com' })
|
|
86
|
-
|
|
87
|
-
const response = await api.get('/users')
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Available methods
|
|
30
|
+
## Documentation
|
|
91
31
|
|
|
92
|
-
|
|
93
|
-
http
|
|
94
|
-
http.get(url, config?)
|
|
95
|
-
http.post(url, body, config?)
|
|
96
|
-
http.put(url, body, config?)
|
|
97
|
-
http.patch(url, body, config?)
|
|
98
|
-
http.delete(url, config?)
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Authentication
|
|
102
|
-
|
|
103
|
-
### OAuth2 Client Credentials
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
import { http, OAuth2ClientCredentials } from '@t4h.framework/http'
|
|
107
|
-
|
|
108
|
-
const auth = new OAuth2ClientCredentials({
|
|
109
|
-
tokenUrl: 'https://auth.example.com/token',
|
|
110
|
-
clientId: 'my-client-id',
|
|
111
|
-
clientSecret: 'my-client-secret',
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
const response = await http.get('https://api.example.com/data', { auth })
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### OAuth2 Resource Owner Password
|
|
118
|
-
|
|
119
|
-
```typescript
|
|
120
|
-
import { OAuth2GrantResourceOwnerPassword } from '@t4h.framework/http'
|
|
121
|
-
|
|
122
|
-
const auth = new OAuth2GrantResourceOwnerPassword({
|
|
123
|
-
tokenUrl: 'https://auth.example.com/token',
|
|
124
|
-
clientId: 'my-client-id',
|
|
125
|
-
clientSecret: 'my-client-secret',
|
|
126
|
-
username: 'user',
|
|
127
|
-
password: 'pass',
|
|
128
|
-
})
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Basic Auth
|
|
132
|
-
|
|
133
|
-
```typescript
|
|
134
|
-
const response = await http.get('https://api.example.com/data', {
|
|
135
|
-
auth: { username: 'user', password: 'pass' },
|
|
136
|
-
})
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Response
|
|
140
|
-
|
|
141
|
-
The `Response` object provides access to status, headers, and body:
|
|
142
|
-
|
|
143
|
-
```typescript
|
|
144
|
-
const response = await http.get('https://api.example.com/data')
|
|
145
|
-
|
|
146
|
-
response.status // number
|
|
147
|
-
response.headers // Record<string, string | string[] | undefined>
|
|
148
|
-
|
|
149
|
-
await response.body.text() // string
|
|
150
|
-
await response.body.json() // parsed JSON
|
|
151
|
-
response.body.contentType // string
|
|
152
|
-
response.body.contentLength // number
|
|
153
|
-
```
|
|
32
|
+
Request bodies, authentication, responses and testing:
|
|
33
|
+
https://tech4humans-brasil.github.io/framework/http/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SyncActivity, Binary, type Serializable, Secret } from '@t4h.framework/core';
|
|
1
|
+
import { SyncActivity, Binary, type Serializable, type SerializableOrVoid, Secret } from '@t4h.framework/core';
|
|
2
2
|
import { Body } from '../models/Body.js';
|
|
3
3
|
import { HttpAuth } from '../models/HttpAuth.js';
|
|
4
4
|
export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
|
|
@@ -51,7 +51,7 @@ export type HttpRequestActivityInput = {
|
|
|
51
51
|
baseUrl?: string;
|
|
52
52
|
method?: HttpMethod;
|
|
53
53
|
body?: HttpBody;
|
|
54
|
-
headers?: Record<string, string | string[] | undefined>;
|
|
54
|
+
headers?: Record<string, string | string[] | Secret | undefined>;
|
|
55
55
|
retry?: boolean | HttpRequestActivityInputRetryOptions;
|
|
56
56
|
auth?: HttpRequestAuth;
|
|
57
57
|
redirect?: 'follow' | 'manual' | number;
|
|
@@ -62,7 +62,7 @@ export type HttpRequestActivityOutput = {
|
|
|
62
62
|
body: Body;
|
|
63
63
|
};
|
|
64
64
|
declare const CLAIMS_KEY: unique symbol;
|
|
65
|
-
export declare abstract class AbstractHttpRequestActivity<TArgs extends readonly
|
|
65
|
+
export declare abstract class AbstractHttpRequestActivity<TArgs extends readonly unknown[], TInput extends Serializable, TSerializableOutput extends SerializableOrVoid, TOutput> extends SyncActivity<TArgs, TInput, TSerializableOutput, TOutput> {
|
|
66
66
|
private readonly [CLAIMS_KEY];
|
|
67
67
|
protected abstract toHttpInput(input: TInput): HttpRequestActivityInput | Promise<HttpRequestActivityInput>;
|
|
68
68
|
protected abstract toHttpOutput(output: HttpRequestActivityOutput): TSerializableOutput | Promise<TSerializableOutput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractHttpRequestActivity.d.ts","sourceRoot":"","sources":["../../src/activities/AbstractHttpRequestActivity.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,MAAM,EACN,KAAK,YAAY,EACjB,MAAM,EAEP,MAAM,qBAAqB,CAAA;AAK5B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAKhD,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,GACP,OAAO,CAAA;AAEX,MAAM,MAAM,oCAAoC,GAAG;IACjD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,aAAa,CAAC,EAAE,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,oCAAoC,GAAG;IACjD,CAAC,GAAG,EAAE,MAAM,GACR,MAAM,GACN,MAAM,GACN,O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U,CAAA;IACnB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"AbstractHttpRequestActivity.d.ts","sourceRoot":"","sources":["../../src/activities/AbstractHttpRequestActivity.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,MAAM,EAEP,MAAM,qBAAqB,CAAA;AAK5B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAKhD,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,GACP,OAAO,CAAA;AAEX,MAAM,MAAM,oCAAoC,GAAG;IACjD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,aAAa,CAAC,EAAE,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,oCAAoC,GAAG;IACjD,CAAC,GAAG,EAAE,MAAM,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,MAAM,GACN,SAAS,oCAAoC,EAAE,GAC/C,oCAAoC,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,GAClE;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yncActivity {
|
|
|
26
26
|
if (value instanceof Binary)
|
|
27
27
|
form.append(formKey, new Blob([await buffer(await value.stream())], {
|
|
28
28
|
type: value.contentType,
|
|
29
|
-
}), `${uuidv7()}.${mime.getExtension(value.contentType)}`);
|
|
29
|
+
}), `${uuidv7()}.${String(mime.getExtension(value.contentType))}`);
|
|
30
30
|
else
|
|
31
31
|
await this.append(form, value, formKey);
|
|
32
32
|
else
|
|
@@ -98,21 +98,25 @@ export class AbstractHttpRequestActivity extends SyncActivity {
|
|
|
98
98
|
const httpInput = await this.toHttpInput(input);
|
|
99
99
|
const headers = await AbstractHttpRequestActivity.getAuthHeaders(httpInput.auth);
|
|
100
100
|
const content = await AbstractHttpRequestActivity.getContent(httpInput.body);
|
|
101
|
+
const customHeaders = Object.fromEntries(Object.entries(httpInput.headers ?? {}).map(([name, value]) => [
|
|
102
|
+
name,
|
|
103
|
+
value instanceof Secret ? Secret.read(value) : value,
|
|
104
|
+
]));
|
|
101
105
|
const response = await this[CLAIMS_KEY].http.request({
|
|
102
106
|
url: new URL(httpInput.url, httpInput.baseUrl),
|
|
103
107
|
method: httpInput.method ?? 'GET',
|
|
104
|
-
body: content
|
|
108
|
+
body: content.body,
|
|
105
109
|
redirect: httpInput.redirect ?? 'follow',
|
|
106
110
|
retry: httpInput.retry ?? true,
|
|
107
111
|
headers: withDefaultUserAgent({
|
|
108
|
-
...
|
|
112
|
+
...customHeaders,
|
|
109
113
|
...content.headers,
|
|
110
114
|
...headers,
|
|
111
115
|
}),
|
|
112
116
|
});
|
|
113
117
|
const contentType = response.headers['content-type'];
|
|
114
118
|
const ext = typeof contentType === 'string' ? mime.getExtension(contentType) : 'bin';
|
|
115
|
-
const binary = await this[CLAIMS_KEY].fs.write(`${uuidv7()}-http-request-activity-response-body.${ext}`, response.body);
|
|
119
|
+
const binary = await this[CLAIMS_KEY].fs.write(`${uuidv7()}-http-request-activity-response-body.${String(ext)}`, response.body);
|
|
116
120
|
return this.toHttpOutput({
|
|
117
121
|
status: response.status,
|
|
118
122
|
headers: response.headers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractHttpRequestActivity.js","sourceRoot":"","sources":["../../src/activities/AbstractHttpRequestActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,OAAO,EACL,YAAY,EACZ,MAAM,
|
|
1
|
+
{"version":3,"file":"AbstractHttpRequestActivity.js","sourceRoot":"","sources":["../../src/activities/AbstractHttpRequestActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,OAAO,EACL,YAAY,EACZ,MAAM,EAGN,MAAM,EACN,KAAK,GACN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AA0E1E,MAAM,UAAU,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAA;AAEzD,MAAM,OAAgB,2BAKpB,SAAQ,YAAyD;IAChD,CAAC,UAAU,CAAC,GAAG,IAAI,KAAK,CAAC;QACxC,IAAI,EAAE,sBAAsB;QAC5B,EAAE,EAAE,eAAe;KACpB,CAAC,CAAA;IAUK,MAAM,CAAC,KAAK,CAAC,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
@@ -4,7 +4,7 @@ export declare class HttpRequestActivity extends AbstractHttpRequestActivity<[
|
|
|
4
4
|
config: HttpRequestActivityInput
|
|
5
5
|
], HttpRequestActivityInput, HttpRequestActivityOutput, Response> {
|
|
6
6
|
toInput(input: HttpRequestActivityInput): HttpRequestActivityInput;
|
|
7
|
-
toOutput(output:
|
|
7
|
+
toOutput(output: HttpRequestActivityOutput): Response;
|
|
8
8
|
protected toHttpInput(input: HttpRequestActivityInput): HttpRequestActivityInput;
|
|
9
9
|
protected toHttpOutput(output: HttpRequestActivityOutput): HttpRequestActivityOutput;
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpRequestActivity.d.ts","sourceRoot":"","sources":["../../src/activities/HttpRequestActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC/B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,qBAAa,mBAAoB,SAAQ,2BAA2B,CAClE;IAAC,MAAM,EAAE,wBAAwB;CAAC,EAClC,wBAAwB,EACxB,yBAAyB,EACzB,QAAQ,CACT;IACQ,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,wBAAwB;IAIlE,QAAQ,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"HttpRequestActivity.d.ts","sourceRoot":"","sources":["../../src/activities/HttpRequestActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC/B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,qBAAa,mBAAoB,SAAQ,2BAA2B,CAClE;IAAC,MAAM,EAAE,wBAAwB;CAAC,EAClC,wBAAwB,EACxB,yBAAyB,EACzB,QAAQ,CACT;IACQ,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,wBAAwB;IAIlE,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,QAAQ;IAI5D,SAAS,CAAC,WAAW,CACnB,KAAK,EAAE,wBAAwB,GAC9B,wBAAwB;IAI3B,SAAS,CAAC,YAAY,CACpB,MAAM,EAAE,yBAAyB,GAChC,yBAAyB;CAG7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpRequestActivity.js","sourceRoot":"","sources":["../../src/activities/HttpRequestActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,GAG5B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,MAAM,OAAO,mBAAoB,SAAQ,2BAKxC;IACQ,OAAO,CAAC,KAA+B;QAC5C,OAAO,KAAK,CAAA;IACd,CAAC;IAEM,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"HttpRequestActivity.js","sourceRoot":"","sources":["../../src/activities/HttpRequestActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,GAG5B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,MAAM,OAAO,mBAAoB,SAAQ,2BAKxC;IACQ,OAAO,CAAC,KAA+B;QAC5C,OAAO,KAAK,CAAA;IACd,CAAC;IAEM,QAAQ,CAAC,MAAiC;QAC/C,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;IAES,WAAW,CACnB,KAA+B;QAE/B,OAAO,KAAK,CAAA;IACd,CAAC;IAES,YAAY,CACpB,MAAiC;QAEjC,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpError.d.ts","sourceRoot":"","sources":["../../src/errors/HttpError.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAU,S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M,mBAAmB;mBAlCA,MAAM,GAAG,SAAS;yBA3BtB,MAAM;;;;;;;;;;CA6D8B,CAAA;AAChE,eAAO,MAAM,eAAe;mBAnCI,MAAM,GAAG,SAAS;yBA3BtB,MAAM;;;;;;;;;;CA8DsB,CAAA;AACxD,eAAO,MAAM,uBAAuB;mBApCJ,MAAM,GAAG,SAAS;yBA3BtB,MAAM;;;;;;;;;;CA+DsC,CAAA;AACxE,eAAO,MAAM,mBAAmB;mBArCA,MAAM,GAAG,SAAS;yBA3BtB,MAAM;;;;;;;;;;CAgE8B,CAAA"}
|
package/dist/errors/HttpError.js
CHANGED
|
@@ -24,7 +24,6 @@ function create(name, status, defaultMessage = STATUS_CODES[status]) {
|
|
|
24
24
|
Object.defineProperty(CustomHttpError, 'name', { value: `${name}Error` });
|
|
25
25
|
return CustomHttpError;
|
|
26
26
|
}
|
|
27
|
-
// 4xx Client Errors
|
|
28
27
|
export const BadRequestError = create('BadRequest', 400);
|
|
29
28
|
export const UnauthorizedError = create('Unauthorized', 401);
|
|
30
29
|
export const PaymentRequiredError = create('PaymentRequired', 402);
|
|
@@ -44,7 +43,6 @@ export const UnsupportedMediaTypeError = create('UnsupportedMediaType', 415);
|
|
|
44
43
|
export const RangeNotSatisfiableError = create('RangeNotSatisfiable', 416);
|
|
45
44
|
export const UnprocessableEntityError = create('UnprocessableEntity', 422);
|
|
46
45
|
export const TooManyRequestsError = create('TooManyRequests', 429);
|
|
47
|
-
// 5xx Server Errors
|
|
48
46
|
export const InternalServerError = create('InternalServer', 500);
|
|
49
47
|
export const NotImplementedError = create('NotImplemented', 501);
|
|
50
48
|
export const BadGatewayError = create('BadGateway', 502);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpError.js","sourceRoot":"","sources":["../../src/errors/HttpError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,OAAO,SAAU,SAAQ,KAAK;IAEhB;IADlB,Y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AM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA"}
|
|
@@ -18,7 +18,7 @@ type HttpBodyUploadSerialized = {
|
|
|
18
18
|
binary: Serializable;
|
|
19
19
|
config: HttpBodyUploadConfig;
|
|
20
20
|
};
|
|
21
|
-
export declare class HttpBodyUpload extends HttpBodyRef
|
|
21
|
+
export declare class HttpBodyUpload extends HttpBodyRef {
|
|
22
22
|
readonly binary: Binary;
|
|
23
23
|
readonly config: HttpBodyUploadConfig;
|
|
24
24
|
private readonly claims;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpBodyUpload.d.ts","sourceRoot":"","sources":["../../src/models/HttpBodyUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAA;AAK9E,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAA;QACX,MAAM,CAAC,EAAE,UAAU,CAAA;QACnB,IAAI,CAAC,EAAE,YAAY,CAAA;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KACjC,CAAA;IACD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,UAAU,CAAA;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KACjC,CAAA;CACF,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,oBAAoB,CAAA;CAC7B,CAAA;AAYD,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AY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC;IAOH,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;YAQzB,WAAW;YAoDX,MAAM;CA0BrB"}
|
|
@@ -59,7 +59,7 @@ export class HttpBodyUpload extends HttpBodyRef {
|
|
|
59
59
|
});
|
|
60
60
|
const text = Buffer.concat(await response.body.toArray()).toString('utf-8');
|
|
61
61
|
if (response.status < 200 || response.status >= 300)
|
|
62
|
-
throw new Error(`Signed upload request to ${signer.url} failed with status ${response.status}: ${text.slice(0, SIGNER_ERROR_BODY_LIMIT)}`);
|
|
62
|
+
throw new Error(`Signed upload request to ${signer.url} failed with status ${String(response.status)}: ${text.slice(0, SIGNER_ERROR_BODY_LIMIT)}`);
|
|
63
63
|
const path = this.config.urlPath ?? 'url';
|
|
64
64
|
let url;
|
|
65
65
|
try {
|
|
@@ -88,7 +88,7 @@ export class HttpBodyUpload extends HttpBodyRef {
|
|
|
88
88
|
});
|
|
89
89
|
if (response.status < 200 || response.status >= 300) {
|
|
90
90
|
const text = Buffer.concat(await response.body.toArray()).toString('utf-8');
|
|
91
|
-
throw new Error(`Upload to the signed URL failed with status ${response.status}: ${text.slice(0, SIGNER_ERROR_BODY_LIMIT)}`);
|
|
91
|
+
throw new Error(`Upload to the signed URL failed with status ${String(response.status)}: ${text.slice(0, SIGNER_ERROR_BODY_LIMIT)}`);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpBodyUpload.js","sourceRoot":"","sources":["../../src/models/HttpBodyUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAMN,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE1E,M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|
|
|
5
5
|
url: URL;
|
|
6
6
|
method: NonNullable<HttpRequestActivityInput['method']>;
|
|
7
7
|
body: Buffer<ArrayBuffer> | FormData | Readable | URLSearchParams | undefined;
|
|
8
|
-
headers:
|
|
8
|
+
headers: Record<string, string | string[] | undefined>;
|
|
9
9
|
redirect: NonNullable<HttpRequestActivityInput['redirect']>;
|
|
10
10
|
retry: NonNullable<HttpRequestActivityInput['retry']>;
|
|
11
11
|
timeoutInMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClientRequestClaim.d.ts","sourceRoot":"","sources":["../../src/models/HttpClientRequestClaim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAE1D,MAAM,WAAW,2BAA2B;IAC1C,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,WAAW,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAA;IACvD,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,QAAQ,GAAG,QAAQ,GAAG,eAAe,GAAG,SAAS,CAAA;IAC7E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"HttpClientRequestClaim.d.ts","sourceRoot":"","sources":["../../src/models/HttpClientRequestClaim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAE1D,MAAM,WAAW,2BAA2B;IAC1C,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,WAAW,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAA;IACvD,I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,8BAAsB,MAAM,CAAC,OAAO,SAAS,YAAY,CAAE,SAAQ,QAAQ;aAuC7C,MAAM,EAAE,OAAO;IAtC3C,SAAS,CAAC,QAAQ,CAAC,MAAM;;;OAGvB;IAEF,SAAS,KAAK,aAAa,IAAI,MAAM,CAEpC;IAEY,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;cAarD,gBAAgB,CAC9B,YAAY,EAAE,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EACjE,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC;gBAaY,MAAM,EAAE,OAAO;IAI3C,SAAS,CAAC,QAAQ,CAAC,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAExD,OAAO,CAAC,YAAY;YAON,YAAY;cAyCV,OAAO;cAIP,OAAO,CAAC,YAAY,EAAE,MAAM;;sBAlH9B,MAAM;wBACJ,MAAM;oBACV,MAAM;oBACN,MAAM;;cAwHF,QAAQ,CAAC,KAAK,EAAE,WAAW;;sBA3H7B,MAAM;wBACJ,MAAM;oBACV,MAAM;oBACN,MAAM;;cAqIF,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC;IAcnC,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC;CAKvD"}
|
package/dist/models/OAuth2.js
CHANGED
|
@@ -48,7 +48,7 @@ export class OAuth2 extends HttpAuth {
|
|
|
48
48
|
const chunks = await response.body.toArray();
|
|
49
49
|
const text = Buffer.concat(chunks).toString('utf-8');
|
|
50
50
|
if (response.status < 200 || response.status >= 300)
|
|
51
|
-
throw this.toTokenError(`failed with status ${response.status}`, text);
|
|
51
|
+
throw this.toTokenError(`failed with status ${String(response.status)}`, text);
|
|
52
52
|
let token;
|
|
53
53
|
try {
|
|
54
54
|
token = JSON.parse(text);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2.js","sourceRoot":"","sources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G,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE;YACrD,GAAG,EAAE,SAAS;SACf,CAAC,CAAA;QAEF,OAAO,KAAK,CAAA;IACd,CAAC;IAES,KAAK,CAAC,QAAQ;QACtB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CACvC,IAAI,CAAC,aAAa,CACnB,CAAA;QAED,IAAI,CAAC,KAAK;YAAE,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;QAE5D,IAAI,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE;YAAE,OAAO,KAAK,CAAA;QAE9C,IAAI,CAAC,KAAK,CAAC,aAAa;YAAE,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;QAE1E,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IAChD,CAAC;IAEM,KAAK,CAAC,sBAAsB;QACjC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAA;QAEnC,OAAO,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,YAAY,EAAE,CAAA;IACpD,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-body-refs.d.ts","sourceRoot":"","sources":["../../src/tools/resolve-body-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"resolve-body-refs.d.ts","sourceRoot":"","sources":["../../src/tools/resolve-body-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAcvD,wBAAsB,eAAe,CACnC,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,YAAY,CAAC,CAkBvB"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { HttpBodyRef } from '../models/HttpBodyRef.js';
|
|
2
|
+
function isBodyRef(value) {
|
|
3
|
+
return value instanceof HttpBodyRef;
|
|
4
|
+
}
|
|
5
|
+
function isSerializableArray(value) {
|
|
6
|
+
return Array.isArray(value);
|
|
7
|
+
}
|
|
2
8
|
export async function resolveBodyRefs(value) {
|
|
3
|
-
if (value
|
|
9
|
+
if (isBodyRef(value))
|
|
4
10
|
return await value.resolve();
|
|
5
|
-
if (
|
|
11
|
+
if (isSerializableArray(value))
|
|
6
12
|
return await Promise.all(value.map(item => resolveBodyRefs(item)));
|
|
7
13
|
if (value === null)
|
|
8
14
|
return value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-body-refs.js","sourceRoot":"","sources":["../../src/tools/resolve-body-refs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAmB;IAEnB,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"resolve-body-refs.js","sourceRoot":"","sources":["../../src/tools/resolve-body-refs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,SAAS,SAAS,CAAC,KAAmB;IACpC,OAAO,KAAK,YAAY,WAAW,CAAA;AACrC,CAAC;AAED,SAAS,mBAAmB,CAC1B,KAAmB;IAEnB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAmB;IAEnB,IAAI,SAAS,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,KAAK,CAAC,OAAO,EAAE,CAAA;IAElD,IAAI,mBAAmB,CAAC,KAAK,CAAC;QAC5B,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAEpE,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAEhC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAE3C,IAAI,KAAK,CAAC,WAAW,KAAK,MAAM;QAAE,OAAO,KAAK,CAAA;IAE9C,MAAM,GAAG,GAAiC,EAAE,CAAA;IAE5C,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAC7C,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,eAAe,CAAC,IAAoB,CAAC,CAAA;IAExD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t4h.framework/http",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "HTTP module for the T4H Framework",
|
|
5
5
|
"homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/http",
|
|
6
6
|
"bugs": "https://github.com/tech4humans-brasil/framework/issues",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsc --project tsconfig.build.json",
|
|
28
28
|
"check-types": "tsc --noEmit",
|
|
29
|
-
"
|
|
29
|
+
"check-package": "publint --strict && attw --pack . --profile esm-only",
|
|
30
|
+
"lint": "eslint . --max-warnings 0",
|
|
30
31
|
"prepublishOnly": "yarn build",
|
|
31
32
|
"test": "vitest run",
|
|
32
33
|
"test:coverage": "vitest run --coverage",
|
|
@@ -38,9 +39,9 @@
|
|
|
38
39
|
"uuidv7": "^1.1.0"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@t4h.framework/cache": "^0.6.
|
|
42
|
-
"@t4h.framework/core": "^0.
|
|
43
|
-
"@t4h.framework/fs": "^0.
|
|
42
|
+
"@t4h.framework/cache": "^0.6.12",
|
|
43
|
+
"@t4h.framework/core": "^0.21.0",
|
|
44
|
+
"@t4h.framework/fs": "^0.14.0",
|
|
44
45
|
"@types/type-is": "^1.6.7",
|
|
45
46
|
"@vitest/coverage-v8": "^4.0.18",
|
|
46
47
|
"typescript": "^5.9.3",
|