@t4h.framework/http 0.6.3 → 0.7.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/.ai/skills/framework-http/SKILL.md +15 -6
- package/CHANGELOG.md +67 -0
- package/dist/activities/AbstractHttpRequestActivity.d.ts +29 -5
- package/dist/activities/AbstractHttpRequestActivity.d.ts.map +1 -1
- package/dist/activities/AbstractHttpRequestActivity.js +26 -8
- package/dist/activities/AbstractHttpRequestActivity.js.map +1 -1
- package/dist/http.d.ts +2 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +2 -0
- package/dist/http.js.map +1 -1
- package/dist/models/HttpBodyRef.d.ts +5 -0
- package/dist/models/HttpBodyRef.d.ts.map +1 -0
- package/dist/models/HttpBodyRef.js +4 -0
- package/dist/models/HttpBodyRef.js.map +1 -0
- package/dist/models/HttpBodyUpload.d.ts +33 -0
- package/dist/models/HttpBodyUpload.d.ts.map +1 -0
- package/dist/models/HttpBodyUpload.js +95 -0
- package/dist/models/HttpBodyUpload.js.map +1 -0
- package/dist/models/HttpClient.d.ts +2 -6
- package/dist/models/HttpClient.d.ts.map +1 -1
- package/dist/models/OAuth2.d.ts +3 -3
- package/dist/models/OAuth2.d.ts.map +1 -1
- package/dist/models/OAuth2.js +10 -5
- package/dist/models/OAuth2.js.map +1 -1
- package/dist/models/OAuth2GrantClientCredentials.d.ts +2 -1
- package/dist/models/OAuth2GrantClientCredentials.d.ts.map +1 -1
- package/dist/models/OAuth2GrantClientCredentials.js +2 -1
- package/dist/models/OAuth2GrantClientCredentials.js.map +1 -1
- package/dist/models/OAuth2GrantResourceOwnerPassword.d.ts +3 -2
- package/dist/models/OAuth2GrantResourceOwnerPassword.d.ts.map +1 -1
- package/dist/models/OAuth2GrantResourceOwnerPassword.js +3 -2
- package/dist/models/OAuth2GrantResourceOwnerPassword.js.map +1 -1
- package/dist/tools/resolve-body-refs.d.ts +3 -0
- package/dist/tools/resolve-body-refs.d.ts.map +1 -0
- package/dist/tools/resolve-body-refs.js +18 -0
- package/dist/tools/resolve-body-refs.js.map +1 -0
- package/package.json +7 -7
|
@@ -154,10 +154,10 @@ await http.post('https://api.example.com/users', {
|
|
|
154
154
|
const api = http.extend({ baseUrl: 'https://api.example.com' })
|
|
155
155
|
const list = await api.get('/users')
|
|
156
156
|
|
|
157
|
-
// Instance with default auth
|
|
157
|
+
// Instance with default auth (password is a Secret from the EnvDesign)
|
|
158
158
|
const client = new HttpClient({
|
|
159
159
|
baseUrl: 'https://api.example.com',
|
|
160
|
-
auth: { username: 'user', password:
|
|
160
|
+
auth: { username: 'user', password: environments.API_PASSWORD },
|
|
161
161
|
})
|
|
162
162
|
```
|
|
163
163
|
|
|
@@ -213,14 +213,23 @@ Serializable shape: `{ binary: ... }` via `toSerializable` / `fromSerializable`.
|
|
|
213
213
|
|
|
214
214
|
## Authentication
|
|
215
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
|
+
|
|
216
218
|
### Basic (inline)
|
|
217
219
|
|
|
218
220
|
```typescript
|
|
219
221
|
await http.get('https://api.example.com/data', {
|
|
220
|
-
auth: { username: 'user', password:
|
|
222
|
+
auth: { username: 'user', password: environments.API_PASSWORD },
|
|
221
223
|
})
|
|
222
224
|
```
|
|
223
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
|
+
|
|
224
233
|
### Custom HttpAuth
|
|
225
234
|
|
|
226
235
|
Subclass `HttpAuth` (extends `SerializableClass`), implement `getAuthorizationHeader()`, and optional `toSerializable` / `fromSerializable` for workflow persistence.
|
|
@@ -233,7 +242,7 @@ import { http, OAuth2ClientCredentials } from '@t4h.framework/http'
|
|
|
233
242
|
const auth = new OAuth2ClientCredentials({
|
|
234
243
|
tokenUrl: 'https://auth.example.com/token',
|
|
235
244
|
clientId: 'my-client-id',
|
|
236
|
-
clientSecret:
|
|
245
|
+
clientSecret: environments.OAUTH_CLIENT_SECRET, // Secret
|
|
237
246
|
})
|
|
238
247
|
|
|
239
248
|
await http.get('https://api.example.com/data', { auth })
|
|
@@ -247,9 +256,9 @@ import { OAuth2GrantResourceOwnerPassword } from '@t4h.framework/http'
|
|
|
247
256
|
const auth = new OAuth2GrantResourceOwnerPassword({
|
|
248
257
|
tokenUrl: 'https://auth.example.com/token',
|
|
249
258
|
clientId: 'my-client-id',
|
|
250
|
-
clientSecret:
|
|
259
|
+
clientSecret: environments.OAUTH_CLIENT_SECRET, // Secret
|
|
251
260
|
username: 'user',
|
|
252
|
-
password:
|
|
261
|
+
password: environments.OAUTH_PASSWORD, // Secret
|
|
253
262
|
})
|
|
254
263
|
```
|
|
255
264
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,72 @@
|
|
|
1
1
|
# @t4h.framework/http
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#181](https://github.com/tech4humans-brasil/framework/pull/181) [`9449e4e`](https://github.com/tech4humans-brasil/framework/commit/9449e4e9889f42dea1d52418140f47d25dff0535) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - A credential is a `Secret`, never a string. An env entry declared with
|
|
8
|
+
`type: Secret` hands the workflow the name of the variable; the host binds the
|
|
9
|
+
value where the activity runs, so no input, output or history record holds it.
|
|
10
|
+
|
|
11
|
+
**Breaking**: every field that carries a credential now accepts only a
|
|
12
|
+
`Secret`. Declare the entry with `type: Secret` in your `EnvDesign` and pass it
|
|
13
|
+
whole; `tsc` points at each remaining string.
|
|
14
|
+
|
|
15
|
+
**core**: `Secret` (a `SerializableClass` whose `toString`, `valueOf` and
|
|
16
|
+
`toJSON` throw), `Secret.resolve` and `Secret.read` for hosts, `Secret.FORMAT`
|
|
17
|
+
for the manifest. `EnvDesign` accepts `type: Secret`, refuses a `defaultValue`
|
|
18
|
+
on a secret entry and throws when a `String` entry receives a secret.
|
|
19
|
+
`AsyncActivityCallbackAuth` carries a `Secret` in `secret`, `password`, `token`
|
|
20
|
+
and `value`.
|
|
21
|
+
|
|
22
|
+
**http**: `auth` accepts `{ username, password }`, `{ bearer }` or
|
|
23
|
+
`{ header, value }` besides an `HttpAuth`, all with a `Secret`, and the
|
|
24
|
+
activity writes the header on the host. `clientSecret` and `password` of the
|
|
25
|
+
OAuth2 grants are a `Secret`.
|
|
26
|
+
|
|
27
|
+
**smtp**, **sftp**, **orm**: `connectionString` is a `Secret`. The
|
|
28
|
+
`SftpConnectionString` and `ORMConnectionString` aliases are gone.
|
|
29
|
+
|
|
30
|
+
**hmac**: the callback authorizer reads the secret through `Secret.read`.
|
|
31
|
+
|
|
32
|
+
**dev**: the codec writes a `Secret` by name and binds the env value only where
|
|
33
|
+
an activity runs, reading the input back from the database as the runtime does.
|
|
34
|
+
The SFTP and SMTP claims read the value on connect.
|
|
35
|
+
|
|
36
|
+
**webhook**: documents the `Secret` in `auth`.
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [[`9449e4e`](https://github.com/tech4humans-brasil/framework/commit/9449e4e9889f42dea1d52418140f47d25dff0535), [`9449e4e`](https://github.com/tech4humans-brasil/framework/commit/9449e4e9889f42dea1d52418140f47d25dff0535), [`9449e4e`](https://github.com/tech4humans-brasil/framework/commit/9449e4e9889f42dea1d52418140f47d25dff0535)]:
|
|
41
|
+
- @t4h.framework/core@0.15.0
|
|
42
|
+
- @t4h.framework/fs@0.10.0
|
|
43
|
+
- @t4h.framework/cache@0.6.5
|
|
44
|
+
|
|
45
|
+
## 0.6.4
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- [#175](https://github.com/tech4humans-brasil/framework/pull/175) [`6e6d3de`](https://github.com/tech4humans-brasil/framework/commit/6e6d3de20895bae1b6faf1bdc32aa4f7c136ef0f) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Adds `HttpBodyRef`, a value in a JSON body resolved when the request is made,
|
|
50
|
+
and a raw `{ binary }` request body.
|
|
51
|
+
|
|
52
|
+
The body of a request is the activity's input, and inputs are persisted. That
|
|
53
|
+
makes two common attachment shapes traps. An encoded file writes the whole file
|
|
54
|
+
into the history, once per request. And a pre-signed URL expires: between
|
|
55
|
+
persisting the input and the request going out there is a queue with no bound
|
|
56
|
+
on how long it holds a message, so a URL minted beforehand can arrive expired.
|
|
57
|
+
|
|
58
|
+
`HttpBodyRef` keeps both out of the history — what is persisted is what the
|
|
59
|
+
subclass serializes, the recipe rather than the result. It is the body
|
|
60
|
+
counterpart of `HttpAuth`, which for the same reason stores how to get a token
|
|
61
|
+
and never the token. `HttpBodyUpload` is the ready-made case: it asks an
|
|
62
|
+
endpoint for a signed destination, uploads the `Binary`, and resolves to the
|
|
63
|
+
URL, configured by data so one class covers any mint-then-upload flow.
|
|
64
|
+
|
|
65
|
+
A `{ binary }` body streams from storage to the wire instead of being buffered.
|
|
66
|
+
|
|
67
|
+
- Updated dependencies [[`7cd75e4`](https://github.com/tech4humans-brasil/framework/commit/7cd75e4f557d9f5fbe3e486d5a3981186fa38797)]:
|
|
68
|
+
- @t4h.framework/fs@0.9.5
|
|
69
|
+
|
|
3
70
|
## 0.6.3
|
|
4
71
|
|
|
5
72
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SyncActivity, Binary, type Serializable } from '@t4h.framework/core';
|
|
1
|
+
import { SyncActivity, Binary, type Serializable, 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';
|
|
@@ -17,15 +17,35 @@ export type HttpBody = {
|
|
|
17
17
|
json: Serializable;
|
|
18
18
|
text?: never;
|
|
19
19
|
form?: never;
|
|
20
|
+
binary?: never;
|
|
20
21
|
} | {
|
|
21
22
|
json?: never;
|
|
22
23
|
text: string;
|
|
23
24
|
form?: never;
|
|
25
|
+
binary?: never;
|
|
24
26
|
} | {
|
|
25
27
|
json?: never;
|
|
26
28
|
text?: never;
|
|
27
29
|
form: HttpRequestActivityInputBodyFormData;
|
|
30
|
+
binary?: never;
|
|
31
|
+
} | {
|
|
32
|
+
json?: never;
|
|
33
|
+
text?: never;
|
|
34
|
+
form?: never;
|
|
35
|
+
binary: Binary;
|
|
36
|
+
};
|
|
37
|
+
export type HttpRequestBasicAuth = {
|
|
38
|
+
username: string;
|
|
39
|
+
password: Secret;
|
|
40
|
+
};
|
|
41
|
+
export type HttpRequestBearerAuth = {
|
|
42
|
+
bearer: Secret;
|
|
28
43
|
};
|
|
44
|
+
export type HttpRequestHeaderAuth = {
|
|
45
|
+
header: string;
|
|
46
|
+
value: Secret;
|
|
47
|
+
};
|
|
48
|
+
export type HttpRequestAuth = HttpAuth | HttpRequestBasicAuth | HttpRequestBearerAuth | HttpRequestHeaderAuth;
|
|
29
49
|
export type HttpRequestActivityInput = {
|
|
30
50
|
url: string;
|
|
31
51
|
baseUrl?: string;
|
|
@@ -33,10 +53,7 @@ export type HttpRequestActivityInput = {
|
|
|
33
53
|
body?: HttpBody;
|
|
34
54
|
headers?: Record<string, string | string[] | undefined>;
|
|
35
55
|
retry?: boolean | HttpRequestActivityInputRetryOptions;
|
|
36
|
-
auth?:
|
|
37
|
-
username: string;
|
|
38
|
-
password: string;
|
|
39
|
-
};
|
|
56
|
+
auth?: HttpRequestAuth;
|
|
40
57
|
redirect?: 'follow' | 'manual' | number;
|
|
41
58
|
};
|
|
42
59
|
export type HttpRequestActivityOutput = {
|
|
@@ -51,6 +68,7 @@ export declare abstract class AbstractHttpRequestActivity<TArgs extends readonly
|
|
|
51
68
|
protected abstract toHttpOutput(output: HttpRequestActivityOutput): TSerializableOutput | Promise<TSerializableOutput>;
|
|
52
69
|
static append(form: FormData, input: HttpRequestActivityInputBodyFormData, currentKey?: string): Promise<FormData>;
|
|
53
70
|
protected static getFormData(input: HttpRequestActivityInputBodyFormData): Promise<FormData>;
|
|
71
|
+
protected static getAuthHeaders(auth: HttpRequestAuth | undefined): Promise<Record<string, string>>;
|
|
54
72
|
protected static getContent(body: HttpRequestActivityInput['body']): Promise<{
|
|
55
73
|
body: undefined;
|
|
56
74
|
headers: undefined;
|
|
@@ -63,6 +81,12 @@ export declare abstract class AbstractHttpRequestActivity<TArgs extends readonly
|
|
|
63
81
|
} | {
|
|
64
82
|
body: FormData;
|
|
65
83
|
headers?: undefined;
|
|
84
|
+
} | {
|
|
85
|
+
body: import("node:stream").Readable;
|
|
86
|
+
headers: {
|
|
87
|
+
'Content-Type': string;
|
|
88
|
+
'Content-Length': string;
|
|
89
|
+
};
|
|
66
90
|
}>;
|
|
67
91
|
run(input: TInput): Promise<TSerializableOutput>;
|
|
68
92
|
}
|
|
@@ -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,
|
|
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,O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AAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,CAAC;IACjE,OAAO,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,CAG3B;IAEF,SAAS,CAAC,QAAQ,CAAC,WAAW,CAC5B,KAAK,EAAE,MAAM,GACZ,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAE/D,SAAS,CAAC,QAAQ,CAAC,YAAY,CAC7B,MAAM,EAAE,yBAAyB,GAChC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;WAEjC,MAAM,CACxB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,oCAAoC,EAC3C,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,QAAQ,CAAC;qBA4BG,WAAW,CAChC,KAAK,EAAE,oCAAoC,GAC1C,OAAO,CAAC,QAAQ,CAAC;qBAMG,cAAc,CACnC,IAAI,EAAE,eAAe,GAAG,SAAS,GAChC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;qBAkBX,UAAU,CAAC,IAAI,EAAE,wBAAwB,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;IAkD3D,GAAG,CAAC,KAAK,EAAE,MAAM;CAsC/B"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { buffer } from 'node:stream/consumers';
|
|
2
2
|
import { URL } from 'node:url';
|
|
3
|
-
import { SyncActivity, Binary, Claim, } from '@t4h.framework/core';
|
|
3
|
+
import { SyncActivity, Binary, Secret, Claim, } from '@t4h.framework/core';
|
|
4
4
|
import { FileSystemClaim } from '@t4h.framework/fs';
|
|
5
5
|
import mime from 'mime';
|
|
6
6
|
import { uuidv7 } from 'uuidv7';
|
|
7
7
|
import { Body } from '../models/Body.js';
|
|
8
8
|
import { HttpAuth } from '../models/HttpAuth.js';
|
|
9
9
|
import { HttpClientRequestClaim } from '../models/HttpClientRequestClaim.js';
|
|
10
|
+
import { resolveBodyRefs } from '../tools/resolve-body-refs.js';
|
|
10
11
|
import { withDefaultUserAgent } from '../tools/with-default-user-agent.js';
|
|
11
12
|
const CLAIMS_KEY = Symbol('http-request-activity-claims');
|
|
12
13
|
export class AbstractHttpRequestActivity extends SyncActivity {
|
|
@@ -38,6 +39,20 @@ export class AbstractHttpRequestActivity extends SyncActivity {
|
|
|
38
39
|
await this.append(formData, input);
|
|
39
40
|
return formData;
|
|
40
41
|
}
|
|
42
|
+
static async getAuthHeaders(auth) {
|
|
43
|
+
if (!auth)
|
|
44
|
+
return {};
|
|
45
|
+
if (auth instanceof HttpAuth)
|
|
46
|
+
return { Authorization: await auth.getAuthorizationHeader() };
|
|
47
|
+
if ('bearer' in auth)
|
|
48
|
+
return { Authorization: `Bearer ${Secret.read(auth.bearer)}` };
|
|
49
|
+
if ('header' in auth)
|
|
50
|
+
return { [auth.header]: Secret.read(auth.value) };
|
|
51
|
+
const credentials = `${auth.username}:${Secret.read(auth.password)}`;
|
|
52
|
+
return {
|
|
53
|
+
Authorization: `Basic ${Buffer.from(credentials).toString('base64')}`,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
41
56
|
static async getContent(body) {
|
|
42
57
|
if (typeof body !== 'object')
|
|
43
58
|
return {
|
|
@@ -45,7 +60,7 @@ export class AbstractHttpRequestActivity extends SyncActivity {
|
|
|
45
60
|
headers: undefined,
|
|
46
61
|
};
|
|
47
62
|
if (body.json !== undefined) {
|
|
48
|
-
const json = JSON.stringify(body.json);
|
|
63
|
+
const json = JSON.stringify(await resolveBodyRefs(body.json));
|
|
49
64
|
const buffer = Buffer.from(json);
|
|
50
65
|
return {
|
|
51
66
|
body: buffer,
|
|
@@ -69,16 +84,19 @@ export class AbstractHttpRequestActivity extends SyncActivity {
|
|
|
69
84
|
const form = await this.getFormData(body.form);
|
|
70
85
|
return { body: form };
|
|
71
86
|
}
|
|
87
|
+
if (body.binary !== undefined)
|
|
88
|
+
return {
|
|
89
|
+
body: await body.binary.stream(),
|
|
90
|
+
headers: {
|
|
91
|
+
'Content-Type': body.binary.contentType,
|
|
92
|
+
'Content-Length': body.binary.contentLength.toString(),
|
|
93
|
+
},
|
|
94
|
+
};
|
|
72
95
|
throw new Error('Invalid body');
|
|
73
96
|
}
|
|
74
97
|
async run(input) {
|
|
75
98
|
const httpInput = await this.toHttpInput(input);
|
|
76
|
-
const headers =
|
|
77
|
-
if (httpInput.auth)
|
|
78
|
-
if (httpInput.auth instanceof HttpAuth)
|
|
79
|
-
headers.Authorization = await httpInput.auth.getAuthorizationHeader();
|
|
80
|
-
else
|
|
81
|
-
headers.Authorization = `Basic ${Buffer.from(`${httpInput.auth.username}:${httpInput.auth.password}`).toString('base64')}`;
|
|
99
|
+
const headers = await AbstractHttpRequestActivity.getAuthHeaders(httpInput.auth);
|
|
82
100
|
const content = await AbstractHttpRequestActivity.getContent(httpInput.body);
|
|
83
101
|
const response = await this[CLAIMS_KEY].http.request({
|
|
84
102
|
url: new URL(httpInput.url, httpInput.baseUrl),
|
|
@@ -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,EAEN,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,oBAAoB,EAAE,MAAM,qCAAqC,CAA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G,OAAO;aACX,CAAC;SACH,CAAC,CAAA;QAEF,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QAEpD,MAAM,GAAG,GACP,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QAE1E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,KAAK,CAC5C,GAAG,MAAM,EAAE,wCAAwC,GAAG,EAAE,EACxD,QAAQ,CAAC,IAAI,CACd,CAAA;QAED,OAAO,IAAI,CAAC,YAAY,CAAC;YACvB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,IAAI,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC;SACvB,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/http.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './activities/AbstractHttpRequestActivity.js';
|
|
2
2
|
export * from './activities/HttpRequestActivity.js';
|
|
3
3
|
export * from './models/Body.js';
|
|
4
|
+
export * from './models/HttpBodyRef.js';
|
|
5
|
+
export * from './models/HttpBodyUpload.js';
|
|
4
6
|
export * from './models/HttpAuth.js';
|
|
5
7
|
export * from './models/HttpClient.js';
|
|
6
8
|
export * from './models/HttpClientRequestClaim.js';
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAA;AAC3D,cAAc,qCAAqC,CAAA;AACnD,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oCAAoC,CAAA;AAClD,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0CAA0C,CAAA;AACxD,cAAc,8CAA8C,CAAA"}
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAA;AAC3D,cAAc,qCAAqC,CAAA;AACnD,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oCAAoC,CAAA;AAClD,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0CAA0C,CAAA;AACxD,cAAc,8CAA8C,CAAA"}
|
package/dist/http.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './activities/AbstractHttpRequestActivity.js';
|
|
2
2
|
export * from './activities/HttpRequestActivity.js';
|
|
3
3
|
export * from './models/Body.js';
|
|
4
|
+
export * from './models/HttpBodyRef.js';
|
|
5
|
+
export * from './models/HttpBodyUpload.js';
|
|
4
6
|
export * from './models/HttpAuth.js';
|
|
5
7
|
export * from './models/HttpClient.js';
|
|
6
8
|
export * from './models/HttpClientRequestClaim.js';
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAA;AAC3D,cAAc,qCAAqC,CAAA;AACnD,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oCAAoC,CAAA;AAClD,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0CAA0C,CAAA;AACxD,cAAc,8CAA8C,CAAA"}
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAA;AAC3D,cAAc,qCAAqC,CAAA;AACnD,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oCAAoC,CAAA;AAClD,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0CAA0C,CAAA;AACxD,cAAc,8CAA8C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpBodyRef.d.ts","sourceRoot":"","sources":["../../src/models/HttpBodyRef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAE1E,8BAAsB,WAAW,CAC/B,CAAC,SAAS,YAAY,GAAG,MAAM,CAC/B,SAAQ,iBAAiB;aACT,OAAO,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpBodyRef.js","sourceRoot":"","sources":["../../src/models/HttpBodyRef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,qBAAqB,CAAA;AAE1E,MAAM,OAAgB,WAEpB,SAAQ,iBAAiB;CAE1B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Binary, type Deserializer, type PromiseLikeType, type Serializable, type Serializer } from '@t4h.framework/core';
|
|
2
|
+
import { HttpBodyRef } from './HttpBodyRef.js';
|
|
3
|
+
import type { HttpMethod } from '../activities/AbstractHttpRequestActivity.js';
|
|
4
|
+
export type HttpBodyUploadConfig = {
|
|
5
|
+
signer: {
|
|
6
|
+
url: string;
|
|
7
|
+
method?: HttpMethod;
|
|
8
|
+
json?: Serializable;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
urlPath?: string;
|
|
12
|
+
upload?: {
|
|
13
|
+
method?: HttpMethod;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type HttpBodyUploadSerialized = {
|
|
18
|
+
binary: Serializable;
|
|
19
|
+
config: HttpBodyUploadConfig;
|
|
20
|
+
};
|
|
21
|
+
export declare class HttpBodyUpload extends HttpBodyRef<string> {
|
|
22
|
+
readonly binary: Binary;
|
|
23
|
+
readonly config: HttpBodyUploadConfig;
|
|
24
|
+
private readonly claims;
|
|
25
|
+
constructor(binary: Binary, config: HttpBodyUploadConfig);
|
|
26
|
+
toSerializable(serializer: Serializer): Promise<HttpBodyUploadSerialized>;
|
|
27
|
+
protected fromSerializable(serialized: PromiseLikeType<ReturnType<this['toSerializable']>>, deserializer: Deserializer): Promise<void>;
|
|
28
|
+
resolve(): Promise<string>;
|
|
29
|
+
private toSignedUrl;
|
|
30
|
+
private upload;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=HttpBodyUpload.d.ts.map
|
|
@@ -0,0 +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,qBAAa,cAAe,SAAQ,WAAW,CAAC,MAAM,CAAC;aAInC,MAAM,EAAE,MAAM;aACd,MAAM,EAAE,oBAAoB;IAJ9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8C;gBAGnD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,oBAAoB;IAKjC,cAAc,CACzB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,wBAAwB,CAAC;cAOpB,gBAAgB,CAC9B,UAAU,EAAE,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAC/D,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC;IAOH,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;YAQzB,WAAW;YAoDX,MAAM;CA0BrB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Claim, } from '@t4h.framework/core';
|
|
2
|
+
import { HttpBodyRef } from './HttpBodyRef.js';
|
|
3
|
+
import { HttpClientRequestClaim } from './HttpClientRequestClaim.js';
|
|
4
|
+
import { withDefaultUserAgent } from '../tools/with-default-user-agent.js';
|
|
5
|
+
const SIGNER_ERROR_BODY_LIMIT = 512;
|
|
6
|
+
function pick(value, path) {
|
|
7
|
+
return path.split('.').reduce((current, key) => {
|
|
8
|
+
if (current === null)
|
|
9
|
+
return undefined;
|
|
10
|
+
if (typeof current !== 'object')
|
|
11
|
+
return undefined;
|
|
12
|
+
return current[key];
|
|
13
|
+
}, value);
|
|
14
|
+
}
|
|
15
|
+
export class HttpBodyUpload extends HttpBodyRef {
|
|
16
|
+
binary;
|
|
17
|
+
config;
|
|
18
|
+
claims = new Claim({ http: HttpClientRequestClaim });
|
|
19
|
+
constructor(binary, config) {
|
|
20
|
+
super();
|
|
21
|
+
this.binary = binary;
|
|
22
|
+
this.config = config;
|
|
23
|
+
}
|
|
24
|
+
async toSerializable(serializer) {
|
|
25
|
+
return {
|
|
26
|
+
binary: await serializer(this.binary),
|
|
27
|
+
config: this.config,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
async fromSerializable(serialized, deserializer) {
|
|
31
|
+
const binary = await deserializer(serialized.binary);
|
|
32
|
+
Object.defineProperty(this, 'binary', { value: binary });
|
|
33
|
+
Object.defineProperty(this, 'config', { value: serialized.config });
|
|
34
|
+
}
|
|
35
|
+
async resolve() {
|
|
36
|
+
const url = await this.toSignedUrl();
|
|
37
|
+
await this.upload(url);
|
|
38
|
+
return url;
|
|
39
|
+
}
|
|
40
|
+
async toSignedUrl() {
|
|
41
|
+
const { signer } = this.config;
|
|
42
|
+
const body = signer.json === undefined
|
|
43
|
+
? undefined
|
|
44
|
+
: Buffer.from(JSON.stringify(signer.json));
|
|
45
|
+
const response = await this.claims.http.request({
|
|
46
|
+
url: new URL(signer.url),
|
|
47
|
+
method: signer.method ?? 'POST',
|
|
48
|
+
body,
|
|
49
|
+
redirect: 'follow',
|
|
50
|
+
retry: true,
|
|
51
|
+
headers: withDefaultUserAgent({
|
|
52
|
+
...(body && {
|
|
53
|
+
'Content-Type': 'application/json',
|
|
54
|
+
'Content-Length': body.byteLength.toString(),
|
|
55
|
+
}),
|
|
56
|
+
Accept: 'application/json',
|
|
57
|
+
...signer.headers,
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
const text = Buffer.concat(await response.body.toArray()).toString('utf-8');
|
|
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)}`);
|
|
63
|
+
const path = this.config.urlPath ?? 'url';
|
|
64
|
+
let url;
|
|
65
|
+
try {
|
|
66
|
+
url = pick(JSON.parse(text), path);
|
|
67
|
+
}
|
|
68
|
+
catch (cause) {
|
|
69
|
+
throw new Error(`Signed upload request to ${signer.url} returned a body that is not valid JSON: ${text.slice(0, SIGNER_ERROR_BODY_LIMIT)}`, { cause });
|
|
70
|
+
}
|
|
71
|
+
if (typeof url !== 'string' || !url)
|
|
72
|
+
throw new Error(`Signed upload request to ${signer.url} returned no URL at "${path}": ${text.slice(0, SIGNER_ERROR_BODY_LIMIT)}`);
|
|
73
|
+
return url;
|
|
74
|
+
}
|
|
75
|
+
async upload(url) {
|
|
76
|
+
const { upload } = this.config;
|
|
77
|
+
const response = await this.claims.http.request({
|
|
78
|
+
url: new URL(url),
|
|
79
|
+
method: upload?.method ?? 'PUT',
|
|
80
|
+
body: await this.binary.stream(),
|
|
81
|
+
redirect: 'follow',
|
|
82
|
+
retry: true,
|
|
83
|
+
headers: withDefaultUserAgent({
|
|
84
|
+
'Content-Type': this.binary.contentType,
|
|
85
|
+
'Content-Length': this.binary.contentLength.toString(),
|
|
86
|
+
...upload?.headers,
|
|
87
|
+
}),
|
|
88
|
+
});
|
|
89
|
+
if (response.status < 200 || response.status >= 300) {
|
|
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)}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=HttpBodyUpload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpBodyUpload.js","sourceRoot":"","sources":["../../src/models/HttpBodyUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAMN,MAAM,qBAAqB,CAAA;AAE5B,O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E,oBAAoB,CAAC;gBAC5B,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;gBACvC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE;gBACtD,GAAG,MAAM,EAAE,OAAO;aACnB,CAAC;SACH,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;YACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAChE,OAAO,CACR,CAAA;YAED,MAAM,IAAI,KAAK,CACb,+CAA+C,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,uBAAuB,CAAC,EAAE,CAC5G,CAAA;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { HttpBody, HttpRequestActivityInput } from '../activities/AbstractHttpRequestActivity.js';
|
|
1
|
+
import type { HttpBody, HttpRequestActivityInput, HttpRequestAuth } from '../activities/AbstractHttpRequestActivity.js';
|
|
3
2
|
export interface HttpClientConfig {
|
|
4
3
|
baseUrl?: string;
|
|
5
|
-
auth?:
|
|
6
|
-
username: string;
|
|
7
|
-
password: string;
|
|
8
|
-
};
|
|
4
|
+
auth?: HttpRequestAuth;
|
|
9
5
|
}
|
|
10
6
|
export declare class HttpClient {
|
|
11
7
|
readonly config: HttpClientConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../src/models/HttpClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../src/models/HttpClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,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@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CacheClaim } from '@t4h.framework/cache';
|
|
2
|
-
import { Claim, type PromiseLikeType } from '@t4h.framework/core';
|
|
2
|
+
import { Claim, type Deserializer, type PromiseLikeType, type Serializer } from '@t4h.framework/core';
|
|
3
3
|
import { HttpAuth } from './HttpAuth.js';
|
|
4
4
|
import { HttpClientRequestClaim } from './HttpClientRequestClaim.js';
|
|
5
5
|
export type OAuth2Token = {
|
|
@@ -19,8 +19,8 @@ export declare abstract class OAuth2<TConfig extends OAuth2Config> extends HttpA
|
|
|
19
19
|
cache: typeof CacheClaim;
|
|
20
20
|
}>;
|
|
21
21
|
protected get tokenCacheKey(): string;
|
|
22
|
-
toSerializable(): TConfig
|
|
23
|
-
protected fromSerializable(serializable: PromiseLikeType<
|
|
22
|
+
toSerializable(serializer: Serializer): Promise<TConfig>;
|
|
23
|
+
protected fromSerializable(serializable: PromiseLikeType<ReturnType<this['toSerializable']>>, deserializer: Deserializer): Promise<void>;
|
|
24
24
|
constructor(config: TConfig);
|
|
25
25
|
protected abstract toTokenBody(): Record<string, string>;
|
|
26
26
|
private toTokenError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2.d.ts","sourceRoot":"","sources":["../../src/models/OAuth2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"OAuth2.d.ts","sourceRoot":"","sources":["../../src/models/OAuth2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EACL,KAAK,EAEL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAGpE,MAAM,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
|
+
import { Claim, Secret, } from '@t4h.framework/core';
|
|
3
3
|
import { HttpAuth } from './HttpAuth.js';
|
|
4
4
|
import { HttpClientRequestClaim } from './HttpClientRequestClaim.js';
|
|
5
5
|
import { withDefaultUserAgent } from '../tools/with-default-user-agent.js';
|
|
@@ -13,12 +13,17 @@ export class OAuth2 extends HttpAuth {
|
|
|
13
13
|
get tokenCacheKey() {
|
|
14
14
|
return `oauth2:token:${this.config.clientId}`;
|
|
15
15
|
}
|
|
16
|
-
toSerializable() {
|
|
17
|
-
|
|
16
|
+
async toSerializable(serializer) {
|
|
17
|
+
const entries = await Promise.all(Object.entries(this.config).map(async ([key, value]) => [
|
|
18
|
+
key,
|
|
19
|
+
value instanceof Secret ? await serializer(value) : value,
|
|
20
|
+
]));
|
|
21
|
+
return Object.fromEntries(entries);
|
|
18
22
|
}
|
|
19
|
-
fromSerializable(serializable) {
|
|
23
|
+
async fromSerializable(serializable, deserializer) {
|
|
24
|
+
const entries = await Promise.all(Object.entries(serializable).map(async ([key, value]) => [key, await deserializer(value)]));
|
|
20
25
|
Object.defineProperty(this, 'config', {
|
|
21
|
-
value:
|
|
26
|
+
value: Object.fromEntries(entries),
|
|
22
27
|
writable: false,
|
|
23
28
|
});
|
|
24
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2.js","sourceRoot":"","sources":["../../src/models/OAuth2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"OAuth2.js","sourceRoot":"","sources":["../../src/models/OAuth2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EACL,KAAK,EACL,MAAM,GAIP,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BA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,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,7 +1,8 @@
|
|
|
1
|
+
import { Secret } from '@t4h.framework/core';
|
|
1
2
|
import { OAuth2, type OAuth2Config } from './OAuth2.js';
|
|
2
3
|
export type OAuth2ClientCredentialsConfig = OAuth2Config & {
|
|
3
4
|
clientId: string;
|
|
4
|
-
clientSecret:
|
|
5
|
+
clientSecret: Secret;
|
|
5
6
|
};
|
|
6
7
|
export declare class OAuth2ClientCredentials extends OAuth2<OAuth2ClientCredentialsConfig> {
|
|
7
8
|
protected toTokenBody(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2GrantClientCredentials.d.ts","sourceRoot":"","sources":["../../src/models/OAuth2GrantClientCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAEvD,MAAM,MAAM,6BAA6B,GAAG,YAAY,GAAG;IACzD,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,qBAAa,uBAAwB,SAAQ,MAAM,CAAC,6BAA6B,CAAC;IAChF,SAAS,CAAC,WAAW;;;;;CAOtB"}
|
|
1
|
+
{"version":3,"file":"OAuth2GrantClientCredentials.d.ts","sourceRoot":"","sources":["../../src/models/OAuth2GrantClientCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAEvD,MAAM,MAAM,6BAA6B,GAAG,YAAY,GAAG;IACzD,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,qBAAa,uBAAwB,SAAQ,MAAM,CAAC,6BAA6B,CAAC;IAChF,SAAS,CAAC,WAAW;;;;;CAOtB"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Secret } from '@t4h.framework/core';
|
|
1
2
|
import { OAuth2 } from './OAuth2.js';
|
|
2
3
|
export class OAuth2ClientCredentials extends OAuth2 {
|
|
3
4
|
toTokenBody() {
|
|
4
5
|
return {
|
|
5
6
|
grant_type: 'client_credentials',
|
|
6
7
|
client_id: this.config.clientId,
|
|
7
|
-
client_secret: this.config.clientSecret,
|
|
8
|
+
client_secret: Secret.read(this.config.clientSecret),
|
|
8
9
|
};
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2GrantClientCredentials.js","sourceRoot":"","sources":["../../src/models/OAuth2GrantClientCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AAOvD,MAAM,OAAO,uBAAwB,SAAQ,MAAqC;IACtE,WAAW;QACnB,OAAO;YACL,UAAU,EAAE,oBAAoB;YAChC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC/B,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;
|
|
1
|
+
{"version":3,"file":"OAuth2GrantClientCredentials.js","sourceRoot":"","sources":["../../src/models/OAuth2GrantClientCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AAOvD,MAAM,OAAO,uBAAwB,SAAQ,MAAqC;IACtE,WAAW;QACnB,OAAO;YACL,UAAU,EAAE,oBAAoB;YAChC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC/B,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;SACrD,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { Secret } from '@t4h.framework/core';
|
|
1
2
|
import { OAuth2, type OAuth2Config } from './OAuth2.js';
|
|
2
3
|
export type OAuth2GrantResourceOwnerPasswordConfig = OAuth2Config & {
|
|
3
4
|
clientId: string;
|
|
4
|
-
clientSecret:
|
|
5
|
+
clientSecret: Secret;
|
|
5
6
|
username: string;
|
|
6
|
-
password:
|
|
7
|
+
password: Secret;
|
|
7
8
|
};
|
|
8
9
|
export declare class OAuth2GrantResourceOwnerPassword extends OAuth2<OAuth2GrantResourceOwnerPasswordConfig> {
|
|
9
10
|
protected toTokenBody(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2GrantResourceOwnerPassword.d.ts","sourceRoot":"","sources":["../../src/models/OAuth2GrantResourceOwnerPassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAEvD,MAAM,MAAM,sCAAsC,GAAG,YAAY,GAAG;IAClE,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,qBAAa,gCAAiC,SAAQ,MAAM,CAAC,sCAAsC,CAAC;IAClG,SAAS,CAAC,WAAW;;;;;;;CAStB"}
|
|
1
|
+
{"version":3,"file":"OAuth2GrantResourceOwnerPassword.d.ts","sourceRoot":"","sources":["../../src/models/OAuth2GrantResourceOwnerPassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAEvD,MAAM,MAAM,sCAAsC,GAAG,YAAY,GAAG;IAClE,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,qBAAa,gCAAiC,SAAQ,MAAM,CAAC,sCAAsC,CAAC;IAClG,SAAS,CAAC,WAAW;;;;;;;CAStB"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { Secret } from '@t4h.framework/core';
|
|
1
2
|
import { OAuth2 } from './OAuth2.js';
|
|
2
3
|
export class OAuth2GrantResourceOwnerPassword extends OAuth2 {
|
|
3
4
|
toTokenBody() {
|
|
4
5
|
return {
|
|
5
6
|
grant_type: 'password',
|
|
6
7
|
client_id: this.config.clientId,
|
|
7
|
-
client_secret: this.config.clientSecret,
|
|
8
|
+
client_secret: Secret.read(this.config.clientSecret),
|
|
8
9
|
username: this.config.username,
|
|
9
|
-
password: this.config.password,
|
|
10
|
+
password: Secret.read(this.config.password),
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2GrantResourceOwnerPassword.js","sourceRoot":"","sources":["../../src/models/OAuth2GrantResourceOwnerPassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AASvD,MAAM,OAAO,gCAAiC,SAAQ,MAA8C;IACxF,WAAW;QACnB,OAAO;YACL,UAAU,EAAE,UAAU;YACtB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC/B,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;
|
|
1
|
+
{"version":3,"file":"OAuth2GrantResourceOwnerPassword.js","sourceRoot":"","sources":["../../src/models/OAuth2GrantResourceOwnerPassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AASvD,MAAM,OAAO,gCAAiC,SAAQ,MAA8C;IACxF,WAAW;QACnB,OAAO;YACL,UAAU,EAAE,UAAU;YACtB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC/B,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YACpD,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC9B,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;SAC5C,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +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;AAIvD,wBAAsB,eAAe,CACnC,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,YAAY,CAAC,CAkBvB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HttpBodyRef } from '../models/HttpBodyRef.js';
|
|
2
|
+
export async function resolveBodyRefs(value) {
|
|
3
|
+
if (value instanceof HttpBodyRef)
|
|
4
|
+
return await value.resolve();
|
|
5
|
+
if (Array.isArray(value))
|
|
6
|
+
return await Promise.all(value.map(item => resolveBodyRefs(item)));
|
|
7
|
+
if (value === null)
|
|
8
|
+
return value;
|
|
9
|
+
if (typeof value !== 'object')
|
|
10
|
+
return value;
|
|
11
|
+
if (value.constructor !== Object)
|
|
12
|
+
return value;
|
|
13
|
+
const out = {};
|
|
14
|
+
for (const [key, item] of Object.entries(value))
|
|
15
|
+
out[key] = await resolveBodyRefs(item);
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=resolve-body-refs.js.map
|
|
@@ -0,0 +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,YAAY,WAAW;QAAE,OAAO,MAAM,KAAK,CAAC,OAAO,EAAE,CAAA;IAE9D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACtB,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.7.0",
|
|
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",
|
|
@@ -38,18 +38,18 @@
|
|
|
38
38
|
"uuidv7": "^1.1.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@t4h.framework/cache": "^0.6.
|
|
42
|
-
"@t4h.framework/core": "^0.
|
|
43
|
-
"@t4h.framework/fs": "^0.
|
|
41
|
+
"@t4h.framework/cache": "^0.6.5",
|
|
42
|
+
"@t4h.framework/core": "^0.15.0",
|
|
43
|
+
"@t4h.framework/fs": "^0.10.0",
|
|
44
44
|
"@types/type-is": "^1.6.7",
|
|
45
45
|
"@vitest/coverage-v8": "^4.0.18",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"vitest": "^4.0.18"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@t4h.framework/cache": "^0.6.
|
|
51
|
-
"@t4h.framework/core": "^0.
|
|
52
|
-
"@t4h.framework/fs": "^0.
|
|
50
|
+
"@t4h.framework/cache": "^0.6.5",
|
|
51
|
+
"@t4h.framework/core": "^0.15.0",
|
|
52
|
+
"@t4h.framework/fs": "^0.10.0"
|
|
53
53
|
},
|
|
54
54
|
"packageManager": "yarn@4.12.0",
|
|
55
55
|
"engines": {
|