@molecule/app-http-inspector-angular 0.0.0-stage → 1.1.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/LICENSE +202 -0
- package/README.md +467 -2
- package/dist/http-inspector.component.d.ts +220 -0
- package/dist/http-inspector.component.d.ts.map +1 -0
- package/dist/http-inspector.component.js +555 -0
- package/dist/http-inspector.component.js.map +1 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +49 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +69 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular HTTP request builder + response inspector — the counterpart of
|
|
3
|
+
* `@molecule/app-http-inspector-react`: the same props and the same DOM for the
|
|
4
|
+
* same input.
|
|
5
|
+
*
|
|
6
|
+
* Exports `<HttpInspector>`, `HttpMethod`, `HttpHeader`, `HttpResponse` types.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { Component, signal } from '@angular/core'
|
|
11
|
+
* import { HttpInspector } from '@molecule/app-http-inspector-angular'
|
|
12
|
+
* import type { HttpHeader, HttpMethod, HttpResponse } from '@molecule/app-http-inspector-angular'
|
|
13
|
+
*
|
|
14
|
+
* @Component({
|
|
15
|
+
* selector: 'app-inspector',
|
|
16
|
+
* standalone: true,
|
|
17
|
+
* imports: [HttpInspector],
|
|
18
|
+
* template: `
|
|
19
|
+
* <div
|
|
20
|
+
* mol-http-inspector
|
|
21
|
+
* [method]="method()"
|
|
22
|
+
* (onMethodChange)="method.set($event)"
|
|
23
|
+
* [url]="url()"
|
|
24
|
+
* (onUrlChange)="url.set($event)"
|
|
25
|
+
* [headers]="headers()"
|
|
26
|
+
* (onHeadersChange)="headers.set($event)"
|
|
27
|
+
* [body]="body()"
|
|
28
|
+
* (onBodyChange)="body.set($event)"
|
|
29
|
+
* [onSend]="send"
|
|
30
|
+
* [sending]="sending()"
|
|
31
|
+
* [response]="response()"
|
|
32
|
+
* ></div>
|
|
33
|
+
* `,
|
|
34
|
+
* })
|
|
35
|
+
* export class Inspector {
|
|
36
|
+
* readonly method = signal<HttpMethod>('GET')
|
|
37
|
+
* readonly url = signal('https://api.example.com/v1/users')
|
|
38
|
+
* readonly headers = signal<HttpHeader[]>([])
|
|
39
|
+
* readonly body = signal('')
|
|
40
|
+
* readonly sending = signal(false)
|
|
41
|
+
* readonly response = signal<HttpResponse | null>(null)
|
|
42
|
+
*
|
|
43
|
+
* async send() {
|
|
44
|
+
* this.sending.set(true)
|
|
45
|
+
* try {
|
|
46
|
+
* // YOUR fetch here; then this.response.set(...)
|
|
47
|
+
* } finally {
|
|
48
|
+
* this.sending.set(false)
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* - Fully controlled and transport-agnostic: the component renders the
|
|
56
|
+
* builder UI only — YOUR `onSend` performs the fetch and sets `response`
|
|
57
|
+
* (`HttpResponse` with statusCode/durationMs/body). `sending` disables the
|
|
58
|
+
* Send button.
|
|
59
|
+
* - Requires the Angular binding's i18n provider (`useTranslation()` THROWS
|
|
60
|
+
* without it) and a bonded ClassMap; button/tab labels come from the
|
|
61
|
+
* `@molecule/app-locales-http-inspector` companion bond.
|
|
62
|
+
* - The body editor renders only for methods with bodies (hidden for GET and
|
|
63
|
+
* HEAD).
|
|
64
|
+
* - The response status chip uses fixed severity colors (green/blue/
|
|
65
|
+
* yellow/red) rendered inline — they do not follow the app theme.
|
|
66
|
+
*
|
|
67
|
+
* @module
|
|
68
|
+
*/
|
|
69
|
+
export * from './http-inspector.component.js';
|
|
70
|
+
export * from './types.js';
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of `@molecule/app-http-inspector-angular` — the Angular counterpart of
|
|
3
|
+
* `@molecule/app-http-inspector-react`, same props and DOM.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
/** HTTP method verb for a request. */
|
|
8
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
9
|
+
/** A single HTTP request or response header key/value pair. */
|
|
10
|
+
export interface HttpHeader {
|
|
11
|
+
key: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
/** Parsed HTTP response returned after a request completes. */
|
|
15
|
+
export interface HttpResponse {
|
|
16
|
+
statusCode: number;
|
|
17
|
+
statusText?: string;
|
|
18
|
+
durationMs?: number;
|
|
19
|
+
body: string;
|
|
20
|
+
headers?: HttpHeader[];
|
|
21
|
+
}
|
|
22
|
+
/** Inputs accepted by {@link HttpInspector} — the same props `@molecule/app-http-inspector-react` accepts. */
|
|
23
|
+
export interface HttpInspectorProps {
|
|
24
|
+
/** The request's HTTP method. */
|
|
25
|
+
method: HttpMethod;
|
|
26
|
+
/** Called with the new method when the user picks one. */
|
|
27
|
+
onMethodChange: (method: HttpMethod) => void;
|
|
28
|
+
/** The request URL. */
|
|
29
|
+
url: string;
|
|
30
|
+
/** Called with the new URL as the user types. */
|
|
31
|
+
onUrlChange: (url: string) => void;
|
|
32
|
+
/** The request headers, in render order. */
|
|
33
|
+
headers: HttpHeader[];
|
|
34
|
+
/** Called with the next header list on any header edit. */
|
|
35
|
+
onHeadersChange: (headers: HttpHeader[]) => void;
|
|
36
|
+
/** The request body. */
|
|
37
|
+
body: string;
|
|
38
|
+
/** Called with the new body as the user types. */
|
|
39
|
+
onBodyChange: (body: string) => void;
|
|
40
|
+
/** Sends the request; the app owns the fetch and the response state. */
|
|
41
|
+
onSend: () => void | Promise<void>;
|
|
42
|
+
/** Whether a send is in flight (disables the Send button, shows `Sending…`). */
|
|
43
|
+
sending?: boolean;
|
|
44
|
+
/** The last response to show, or `null`/absent for none. */
|
|
45
|
+
response?: HttpResponse | null;
|
|
46
|
+
/** Extra classes on the outer wrapper. */
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,sCAAsC;AACtC,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;AAEzF,+DAA+D;AAC/D,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;CACvB;AAED,8GAA8G;AAC9G,MAAM,WAAW,kBAAkB;IACjC,iCAAiC;IACjC,MAAM,EAAE,UAAU,CAAA;IAClB,0DAA0D;IAC1D,cAAc,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IAC5C,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,iDAAiD;IACjD,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,4CAA4C;IAC5C,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,2DAA2D;IAC3D,eAAe,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,CAAA;IAChD,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,kDAAkD;IAClD,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,wEAAwE;IACxE,MAAM,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClC,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC9B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-http-inspector-angular",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "HTTP method + URL builder + headers/params/body tabs + response status/timing display",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-http-inspector-angular",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "ngc",
|
|
21
|
+
"dev": "ngc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"molecule",
|
|
27
|
+
"http-inspector",
|
|
28
|
+
"angular"
|
|
29
|
+
],
|
|
30
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
35
|
+
"directory": "packages/app/features/http-inspector-angular"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@angular/common": "^22.0.0",
|
|
46
|
+
"@angular/core": "^22.0.0",
|
|
47
|
+
"@angular/platform-browser": "^22.0.0",
|
|
48
|
+
"@molecule/app-angular": "^3.5.0",
|
|
49
|
+
"@molecule/app-ui": "^1.4.0",
|
|
50
|
+
"@molecule/app-ui-angular": "^1.1.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@angular/common": "22.2.3",
|
|
54
|
+
"@angular/compiler": "22.2.3",
|
|
55
|
+
"@angular/compiler-cli": "22.2.3",
|
|
56
|
+
"@angular/core": "22.2.3",
|
|
57
|
+
"@angular/platform-browser": "22.2.3",
|
|
58
|
+
"@molecule/app-angular": "3.9.0",
|
|
59
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
|
+
"@molecule/app-i18n": "1.2.2",
|
|
61
|
+
"@molecule/app-icons": "1.0.4",
|
|
62
|
+
"@molecule/app-ui": "1.5.0",
|
|
63
|
+
"@molecule/app-ui-angular": "1.3.1",
|
|
64
|
+
"@types/node": "26.6.5",
|
|
65
|
+
"jsdom": "30.1.3",
|
|
66
|
+
"rxjs": "7.8.2",
|
|
67
|
+
"typescript": "6.0.3",
|
|
68
|
+
"vitest": "4.1.12",
|
|
69
|
+
"zone.js": "0.16.3"
|
|
70
|
+
}
|
|
71
|
+
}
|