@molecule/app-webhook-inspector-svelte 0.0.1-stage → 1.1.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/README.md +153 -4
- package/dist/WebhookInspector.svelte +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,11 +1,160 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-11-21T12:47:48.847Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
1
9
|
# @molecule/app-webhook-inspector-svelte
|
|
2
10
|
|
|
3
|
-
|
|
11
|
+
Svelte webhook delivery-log inspector.
|
|
12
|
+
|
|
13
|
+
Exports `WebhookInspector` and the `WebhookDelivery` type.
|
|
14
|
+
|
|
15
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
16
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
17
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```svelte
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { WebhookInspector, type WebhookDelivery } from '@molecule/app-webhook-inspector-svelte'
|
|
24
|
+
|
|
25
|
+
const deliveries: WebhookDelivery[] = [
|
|
26
|
+
{
|
|
27
|
+
id: '1',
|
|
28
|
+
eventType: 'payment.succeeded',
|
|
29
|
+
timestamp: '2 min ago',
|
|
30
|
+
statusCode: 200,
|
|
31
|
+
status: 'success',
|
|
32
|
+
durationMs: 142,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: '2',
|
|
36
|
+
eventType: 'invoice.failed',
|
|
37
|
+
timestamp: '5 min ago',
|
|
38
|
+
statusCode: 500,
|
|
39
|
+
status: 'failure',
|
|
40
|
+
attempt: 2,
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
let selectedId = $state('1')
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<WebhookInspector
|
|
48
|
+
{deliveries}
|
|
49
|
+
{selectedId}
|
|
50
|
+
onSelect={(d) => console.log('selected', d.id)}
|
|
51
|
+
onRetry={(d) => console.log('retry', d.id)}
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Type
|
|
56
|
+
|
|
57
|
+
`feature`
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install @molecule/app-webhook-inspector-svelte @molecule/app-i18n @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## API
|
|
66
|
+
|
|
67
|
+
### Interfaces
|
|
4
68
|
|
|
69
|
+
#### `WebhookDelivery`
|
|
70
|
+
|
|
71
|
+
Shape of a single webhook delivery attempt shown in the inspector.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
interface WebhookDelivery {
|
|
75
|
+
id: string
|
|
76
|
+
/** Event type name (e.g. "payment.succeeded"). */
|
|
77
|
+
eventType: string
|
|
78
|
+
/** ISO timestamp or formatted string (React's `ReactNode`: text, or a snippet rendering a node). */
|
|
79
|
+
timestamp: Snippet | string | number
|
|
80
|
+
/** Response status. */
|
|
81
|
+
statusCode: number
|
|
82
|
+
/** Success / failure / pending. */
|
|
83
|
+
status: 'success' | 'failure' | 'pending'
|
|
84
|
+
/** Latency in ms. */
|
|
85
|
+
durationMs?: number
|
|
86
|
+
/** Request payload (string or JSON). */
|
|
87
|
+
requestBody?: string | unknown
|
|
88
|
+
/** Response body (string or JSON). */
|
|
89
|
+
responseBody?: string | unknown
|
|
90
|
+
/** Optional attempt number. */
|
|
91
|
+
attempt?: number
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### `WebhookInspectorProps`
|
|
96
|
+
|
|
97
|
+
Props for the `WebhookInspector` component.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
interface WebhookInspectorProps {
|
|
101
|
+
/** Deliveries to render. */
|
|
102
|
+
deliveries: WebhookDelivery[]
|
|
103
|
+
/** Called when a delivery is retried. */
|
|
104
|
+
onRetry?: (delivery: WebhookDelivery) => void
|
|
105
|
+
/** Called when a row is selected (for external detail panel). */
|
|
106
|
+
onSelect?: (delivery: WebhookDelivery) => void
|
|
107
|
+
/** Currently selected id. */
|
|
108
|
+
selectedId?: string
|
|
109
|
+
/** Extra classes. */
|
|
110
|
+
className?: string
|
|
111
|
+
}
|
|
5
112
|
```
|
|
6
|
-
|
|
113
|
+
|
|
114
|
+
### Constants
|
|
115
|
+
|
|
116
|
+
#### `WebhookInspector`
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
const WebhookInspector: LegacyComponentType
|
|
7
120
|
```
|
|
8
121
|
|
|
9
|
-
|
|
122
|
+
## Injection Notes
|
|
123
|
+
|
|
124
|
+
### Requirements
|
|
125
|
+
|
|
126
|
+
Peer dependencies:
|
|
127
|
+
|
|
128
|
+
- `@molecule/app-i18n` ^1.0.1
|
|
129
|
+
- `@molecule/app-svelte` ^3.5.0
|
|
130
|
+
- `@molecule/app-ui` ^1.4.0
|
|
131
|
+
- `@molecule/app-ui-svelte` ^1.1.0
|
|
132
|
+
- `svelte` ^5.0.0
|
|
133
|
+
|
|
134
|
+
### Runtime Dependencies
|
|
135
|
+
|
|
136
|
+
- `@molecule/app-i18n`
|
|
137
|
+
- `@molecule/app-svelte`
|
|
138
|
+
- `@molecule/app-ui`
|
|
139
|
+
- `@molecule/app-ui-svelte`
|
|
140
|
+
- `svelte`
|
|
141
|
+
|
|
142
|
+
Presentation-only: fetch and store deliveries yourself and pass them in —
|
|
143
|
+
there is no server contract beyond the `WebhookDelivery` shape, and
|
|
144
|
+
`onRetry` only invokes your callback (the button renders per-row when
|
|
145
|
+
`status === 'failure'`). The 'Retry', 'Request' and 'Response' labels route
|
|
146
|
+
through `t()` under `webhookInspector.*`, translated by the
|
|
147
|
+
`@molecule/app-locales-webhook-inspector` companion bond, and are read
|
|
148
|
+
through the binding's `useTranslation()` inside a `$derived` so a locale
|
|
149
|
+
switch re-renders them. Status pills take their colour from the theme's
|
|
150
|
+
semantic tones (success / error / warning) through the ClassMap, with the
|
|
151
|
+
theme's on-tone text. Rows are native `<details>` elements and `onSelect`
|
|
152
|
+
fires on EVERY toggle — opening and closing alike. Non-string
|
|
153
|
+
request/response bodies render via
|
|
154
|
+
`JSON.stringify(v, null, 2)`. Props (documented on the exported
|
|
155
|
+
`WebhookInspectorProps` interface): deliveries, onRetry, onSelect, selectedId,
|
|
156
|
+
className.
|
|
157
|
+
|
|
158
|
+
## Translations
|
|
10
159
|
|
|
11
|
-
|
|
160
|
+
Translation strings are provided by `@molecule/app-locales-webhook-inspector`.
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
cm.cursorPointer,
|
|
89
89
|
)}
|
|
90
90
|
><span use:reactStyle={{ width: '80px', opacity: '0.7' }}
|
|
91
|
-
>{#if typeof timestamp === 'function'}{@render timestamp()}{:else if timestamp !== ''}{timestamp}{/if}</span
|
|
91
|
+
>{#if typeof timestamp === 'function'}{@render timestamp?.()}{:else if timestamp !== ''}{timestamp}{/if}</span
|
|
92
92
|
><span
|
|
93
93
|
class={cm.cn(cm.bgTone(statusTone(delivery.status)), cm.textOnTone)}
|
|
94
94
|
use:reactStyle={{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-webhook-inspector-svelte",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Webhook delivery log row with request/response JSON panels, status, and retry",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-webhook-inspector-svelte",
|
|
6
6
|
"type": "module",
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
59
59
|
"@molecule/app-i18n": "1.2.2",
|
|
60
60
|
"@molecule/app-icons": "1.0.4",
|
|
61
|
-
"@molecule/app-svelte": "3.
|
|
62
|
-
"@molecule/app-ui": "1.
|
|
63
|
-
"@molecule/app-ui-svelte": "1.1
|
|
61
|
+
"@molecule/app-svelte": "3.13.0",
|
|
62
|
+
"@molecule/app-ui": "1.5.0",
|
|
63
|
+
"@molecule/app-ui-svelte": "1.4.1",
|
|
64
64
|
"@sveltejs/package": "3.0.2",
|
|
65
65
|
"@sveltejs/vite-plugin-svelte": "7.1.2",
|
|
66
66
|
"@types/node": "26.6.5",
|
|
67
|
-
"jsdom": "
|
|
67
|
+
"jsdom": "31.0.1",
|
|
68
68
|
"svelte": "5.57.2",
|
|
69
69
|
"svelte-check": "4.7.7",
|
|
70
70
|
"typescript": "6.0.3",
|