@t4h.framework/webhook 0.0.0 → 0.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/CHANGELOG.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @t4h.framework/webhook
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`72e08ff`](https://github.com/tech4humans-brasil/framework/commit/72e08ff86e0ce735ef73ccdf33b0dc01cdb8b6f5)]:
|
|
8
|
+
- @t4h.framework/core@0.12.0
|
|
9
|
+
- @t4h.framework/hmac@0.2.2
|
|
10
|
+
- @t4h.framework/http@0.6.1
|
|
11
|
+
- @t4h.framework/jwks@0.5.2
|
|
12
|
+
|
|
13
|
+
## 0.1.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#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
|
|
18
|
+
activity behind one callback route.
|
|
19
|
+
|
|
20
|
+
**webhook**: `webhook()` sends an outbound request (with `<<callbackUrl>>`
|
|
21
|
+
replaced by the activity callback URL, 60s timeout) through
|
|
22
|
+
`HttpClientRequestClaim` and suspends the workflow until the third party posts
|
|
23
|
+
to that URL. The partner's answer is kept as `callback.dispatch`; the callback
|
|
24
|
+
body is validated against `schema`; `{ wait: false }` returns a handle to wait
|
|
25
|
+
on later. Ships `deriveCallbackToken`/`isCallbackTokenValid` and
|
|
26
|
+
`verifyCallbackAuth` for hosts.
|
|
27
|
+
|
|
28
|
+
**core**: `AsyncActivityCallbackAuth` (hmac, basic, header, bearer, jwt),
|
|
29
|
+
`pending({ auth })`, `advance(payload, bootstrap, context?)` receiving the
|
|
30
|
+
callback method and headers, and the `GetActivityCallbackUrlClaim` hosts must
|
|
31
|
+
provide.
|
|
32
|
+
|
|
33
|
+
**http**: `timeoutInMs` on `HttpClientRequestClaimInput`.
|
|
34
|
+
|
|
35
|
+
**dev**: `POST /projects/:project/workflows/:workflow/runs/:run/activities/:activity/callbacks?token=…`
|
|
36
|
+
replaces the `PATCH …/activities/:id` advance route. Each delivery is stored
|
|
37
|
+
as a pending callback (method + request); the token is derived from the
|
|
38
|
+
activity id, the declared `auth` is verified before the workflow advances.
|
|
39
|
+
|
|
40
|
+
**vite-panel-plugin**: the Inbox advance route follows the new callbacks
|
|
41
|
+
endpoint, with the token in the curl.
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Updated dependencies [[`8e8ffb2`](https://github.com/tech4humans-brasil/framework/commit/8e8ffb2ac0739e2f2a1f0af2ed9ebeffe2964776)]:
|
|
46
|
+
- @t4h.framework/core@0.11.0
|
|
47
|
+
- @t4h.framework/http@0.6.0
|
|
48
|
+
- @t4h.framework/hmac@0.2.1
|
|
49
|
+
- @t4h.framework/jwks@0.5.1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t4h.framework/webhook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
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.
|
|
35
|
-
"@t4h.framework/jwks": "^0.
|
|
34
|
+
"@t4h.framework/hmac": "^0.2.2",
|
|
35
|
+
"@t4h.framework/jwks": "^0.5.2",
|
|
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.12.0",
|
|
40
|
+
"@t4h.framework/http": "^0.6.1",
|
|
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.12.0",
|
|
46
|
+
"@t4h.framework/http": "^0.6.1"
|
|
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"}
|