@t4h.framework/webhook 0.0.0 → 0.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/CHANGELOG.md +39 -0
- package/LICENSE +21 -0
- package/package.json +7 -7
- package/dist/models/WebhookClaim.d.ts +0 -19
- package/dist/models/WebhookClaim.d.ts.map +0 -1
- package/dist/models/WebhookClaim.js +0 -10
- package/dist/models/WebhookClaim.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @t4h.framework/webhook
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#158](https://github.com/tech4humans-brasil/framework/pull/158) [`8e8ffb2`](https://github.com/tech4humans-brasil/framework/commit/8e8ffb2ac0739e2f2a1f0af2ed9ebeffe2964776) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Adds `@t4h.framework/webhook` and unifies the external advance of a pending
|
|
8
|
+
activity behind one callback route.
|
|
9
|
+
|
|
10
|
+
**webhook**: `webhook()` sends an outbound request (with `<<callbackUrl>>`
|
|
11
|
+
replaced by the activity callback URL, 60s timeout) through
|
|
12
|
+
`HttpClientRequestClaim` and suspends the workflow until the third party posts
|
|
13
|
+
to that URL. The partner's answer is kept as `callback.dispatch`; the callback
|
|
14
|
+
body is validated against `schema`; `{ wait: false }` returns a handle to wait
|
|
15
|
+
on later. Ships `deriveCallbackToken`/`isCallbackTokenValid` and
|
|
16
|
+
`verifyCallbackAuth` for hosts.
|
|
17
|
+
|
|
18
|
+
**core**: `AsyncActivityCallbackAuth` (hmac, basic, header, bearer, jwt),
|
|
19
|
+
`pending({ auth })`, `advance(payload, bootstrap, context?)` receiving the
|
|
20
|
+
callback method and headers, and the `GetActivityCallbackUrlClaim` hosts must
|
|
21
|
+
provide.
|
|
22
|
+
|
|
23
|
+
**http**: `timeoutInMs` on `HttpClientRequestClaimInput`.
|
|
24
|
+
|
|
25
|
+
**dev**: `POST /projects/:project/workflows/:workflow/runs/:run/activities/:activity/callbacks?token=…`
|
|
26
|
+
replaces the `PATCH …/activities/:id` advance route. Each delivery is stored
|
|
27
|
+
as a pending callback (method + request); the token is derived from the
|
|
28
|
+
activity id, the declared `auth` is verified before the workflow advances.
|
|
29
|
+
|
|
30
|
+
**vite-panel-plugin**: the Inbox advance route follows the new callbacks
|
|
31
|
+
endpoint, with the token in the curl.
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [[`8e8ffb2`](https://github.com/tech4humans-brasil/framework/commit/8e8ffb2ac0739e2f2a1f0af2ed9ebeffe2964776)]:
|
|
36
|
+
- @t4h.framework/core@0.11.0
|
|
37
|
+
- @t4h.framework/http@0.6.0
|
|
38
|
+
- @t4h.framework/hmac@0.2.1
|
|
39
|
+
- @t4h.framework/jwks@0.5.1
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tech for humans
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t4h.framework/webhook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Webhook module for the T4H Framework",
|
|
5
5
|
"homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/webhook",
|
|
6
6
|
"bugs": "https://github.com/tech4humans-brasil/framework/issues",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"test:watch": "vitest"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@t4h.framework/hmac": "^0.1
|
|
35
|
-
"@t4h.framework/jwks": "^0.
|
|
34
|
+
"@t4h.framework/hmac": "^0.2.1",
|
|
35
|
+
"@t4h.framework/jwks": "^0.5.1",
|
|
36
36
|
"typebox": "^1.1.6"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@t4h.framework/core": "^0.
|
|
40
|
-
"@t4h.framework/http": "^0.
|
|
39
|
+
"@t4h.framework/core": "^0.11.0",
|
|
40
|
+
"@t4h.framework/http": "^0.6.0",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
42
|
"vitest": "^4.0.18"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@t4h.framework/core": "^0.
|
|
46
|
-
"@t4h.framework/http": "^0.
|
|
45
|
+
"@t4h.framework/core": "^0.11.0",
|
|
46
|
+
"@t4h.framework/http": "^0.6.0"
|
|
47
47
|
},
|
|
48
48
|
"packageManager": "yarn@4.12.0",
|
|
49
49
|
"engines": {
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { WebhookRequest } from './WebhookRequest.js';
|
|
2
|
-
export type WebhookClaimDispatchInput = {
|
|
3
|
-
/** Id of the activity that will wait for the callback. */
|
|
4
|
-
activityId: string;
|
|
5
|
-
/** Outbound request; `{{callbackUrl}}` inside it is replaced by `callbackUrl`. */
|
|
6
|
-
request: WebhookRequest;
|
|
7
|
-
callbackUrl: string;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Host side of the outbound half of a webhook. `dispatch` is called from
|
|
11
|
-
* `WebhookActivity.bootstrap`, so in a transactional host it runs inside the
|
|
12
|
-
* activity transaction: defer the HTTP call (outbox, queue) to after the
|
|
13
|
-
* commit, so the third party can never call back before the pending exists.
|
|
14
|
-
* A dispatch that fails must reject the activity with `dispatch_failed`.
|
|
15
|
-
*/
|
|
16
|
-
export declare abstract class WebhookClaim {
|
|
17
|
-
abstract dispatch(input: WebhookClaimDispatchInput): void | Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=WebhookClaim.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookClaim.d.ts","sourceRoot":"","sources":["../../src/models/WebhookClaim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,MAAM,yBAAyB,GAAG;IACtC,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAA;IAClB,kFAAkF;IAClF,OAAO,EAAE,cAAc,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;;;GAMG;AACH,8BAAsB,YAAY;aAChB,QAAQ,CACtB,KAAK,EAAE,yBAAyB,GAC/B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CACxB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Host side of the outbound half of a webhook. `dispatch` is called from
|
|
3
|
-
* `WebhookActivity.bootstrap`, so in a transactional host it runs inside the
|
|
4
|
-
* activity transaction: defer the HTTP call (outbox, queue) to after the
|
|
5
|
-
* commit, so the third party can never call back before the pending exists.
|
|
6
|
-
* A dispatch that fails must reject the activity with `dispatch_failed`.
|
|
7
|
-
*/
|
|
8
|
-
export class WebhookClaim {
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=WebhookClaim.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookClaim.js","sourceRoot":"","sources":["../../src/models/WebhookClaim.ts"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,MAAM,OAAgB,YAAY;CAIjC"}
|