@t4h.framework/hmac 0.3.7 → 0.3.8
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-hmac/SKILL.md +19 -23
- package/CHANGELOG.md +25 -0
- package/README.md +14 -1
- package/dist/hmac-authorize.d.ts.map +1 -1
- package/dist/hmac-authorize.js +15 -4
- package/dist/hmac-authorize.js.map +1 -1
- package/dist/models/HMACAuthorization.d.ts +1 -1
- package/dist/models/HMACAuthorization.d.ts.map +1 -1
- package/package.json +4 -2
|
@@ -49,8 +49,10 @@ Do **not** assume header parsing, env-variable mapping, or provider-specific pre
|
|
|
49
49
|
import { App, Workflow } from '@t4h.framework/core'
|
|
50
50
|
import { HMACAuthorization } from '@t4h.framework/hmac'
|
|
51
51
|
|
|
52
|
+
import { environments } from './constants/environments.js'
|
|
53
|
+
|
|
52
54
|
const authorization = new HMACAuthorization({
|
|
53
|
-
secret:
|
|
55
|
+
secret: environments.HMAC_SECRET,
|
|
54
56
|
signature: '<signature-from-runtime>',
|
|
55
57
|
rawPayload: '<exact-signed-bytes>',
|
|
56
58
|
signaturePrefix: 'sha256=',
|
|
@@ -88,19 +90,21 @@ Manifest shape (from tests):
|
|
|
88
90
|
|
|
89
91
|
Optional manifest fields are still present as `undefined` when omitted (`toManifest` copies all keys).
|
|
90
92
|
|
|
93
|
+
Declare the secret in the `EnvDesign` in `src/constants/environments.ts`. The context types `secret` as `string`, so declare the entry with `type: String`, not `type: Secret`. This is an exception to the `type: Secret` rule of **framework-core**.
|
|
94
|
+
|
|
91
95
|
---
|
|
92
96
|
|
|
93
97
|
## Context: `HMACAuthorizationContext`
|
|
94
98
|
|
|
95
99
|
| Field | Required | Description |
|
|
96
100
|
|-------|----------|-------------|
|
|
97
|
-
| `secret` | Yes | Shared secret, used as **UTF-8 bytes** for the HMAC key.
|
|
101
|
+
| `secret` | Yes | Shared secret, used as **UTF-8 bytes** for the HMAC key. A secret delivered hex/base64-encoded must be decoded by the caller before it is passed in. |
|
|
98
102
|
| `signature` | Yes | Signature the caller presented. Empty string → handler returns `false`. |
|
|
99
103
|
| `rawPayload` | Yes | The **exact** bytes that were signed. Never re-serialize parsed JSON — key order and whitespace change and the digest will not match. |
|
|
100
|
-
| `algorithm` | No |
|
|
101
|
-
| `signatureFormat` | No | Encoding of `signature`: `hex`, `base64`, `base64url
|
|
104
|
+
| `algorithm` | No | `HMACAlgorithm` key: `SHA1`, `SHA256`, `SHA384` or `SHA512` (not `sha256`). Defaults to `SHA256`. Other values throw. |
|
|
105
|
+
| `signatureFormat` | No | Encoding of `signature`: `hex`, `base64`, `base64url` or `binary`. Defaults to `hex`. Other values throw. |
|
|
102
106
|
| `signaturePrefix` | No | Stripped before comparison, e.g. `sha256=`. If set and absent from `signature` → `false`. |
|
|
103
|
-
| `timestamp` | Conditional |
|
|
107
|
+
| `timestamp` | Conditional | Used with `toleranceInSeconds`. All-digit string → Unix **seconds**; otherwise `Date.parse` (ISO 8601). |
|
|
104
108
|
| `toleranceInSeconds` | No | Enables replay protection. Symmetric window (past **and** future, for clock skew). |
|
|
105
109
|
|
|
106
110
|
---
|
|
@@ -116,12 +120,10 @@ Default export:
|
|
|
116
120
|
Behavior, in order (from `hmac-authorize.ts` and tests):
|
|
117
121
|
|
|
118
122
|
1. Falsy `signature` → **`false`** (no throw).
|
|
119
|
-
2.
|
|
120
|
-
3.
|
|
121
|
-
4.
|
|
122
|
-
5.
|
|
123
|
-
6. If `signaturePrefix` is set and `signature` does not start with it → **`false`**; otherwise strip it.
|
|
124
|
-
7. Compute `crypto.createHmac(algorithm, secret).update(rawPayload).digest()` and compare with `crypto.timingSafeEqual`.
|
|
123
|
+
2. Check the configuration (see **Return values vs errors**).
|
|
124
|
+
3. If `toleranceInSeconds` is set: `timestamp` outside the window or unparseable → **`false`**.
|
|
125
|
+
4. If `signaturePrefix` is set and `signature` does not start with it → **`false`**; otherwise strip it.
|
|
126
|
+
5. Compute `crypto.createHmac(algorithm, secret).update(rawPayload).digest()` and compare with `crypto.timingSafeEqual`.
|
|
125
127
|
|
|
126
128
|
The candidate is decoded from `signatureFormat` into a Buffer before comparing, so **hex casing and base64 padding never cause a false negative**, and a candidate of a different decoded length short-circuits to `false` (`timingSafeEqual` throws on length mismatch).
|
|
127
129
|
|
|
@@ -134,8 +136,6 @@ export enum HMACAlgorithm {
|
|
|
134
136
|
}
|
|
135
137
|
```
|
|
136
138
|
|
|
137
|
-
Pass `algorithm: 'SHA256'`, not `'sha256'` — the lowercase form is the enum *value* and makes the handler throw.
|
|
138
|
-
|
|
139
139
|
---
|
|
140
140
|
|
|
141
141
|
## Examples
|
|
@@ -144,7 +144,7 @@ Pass `algorithm: 'SHA256'`, not `'sha256'` — the lowercase form is the enum *v
|
|
|
144
144
|
|
|
145
145
|
```typescript
|
|
146
146
|
new HMACAuthorization({
|
|
147
|
-
secret:
|
|
147
|
+
secret: environments.HMAC_SECRET,
|
|
148
148
|
signature: request.headers['x-hub-signature-256'], // 'sha256=9f86d0…'
|
|
149
149
|
rawPayload: rawRequestBody, // the untouched body string
|
|
150
150
|
signaturePrefix: 'sha256=',
|
|
@@ -155,7 +155,7 @@ new HMACAuthorization({
|
|
|
155
155
|
|
|
156
156
|
```typescript
|
|
157
157
|
new HMACAuthorization({
|
|
158
|
-
secret:
|
|
158
|
+
secret: environments.HMAC_SECRET,
|
|
159
159
|
signature: parsedSignatureHeader.v1,
|
|
160
160
|
rawPayload: `${timestamp}.${rawRequestBody}`, // timestamp bound INTO the signature
|
|
161
161
|
timestamp,
|
|
@@ -169,7 +169,7 @@ new HMACAuthorization({
|
|
|
169
169
|
|
|
170
170
|
```typescript
|
|
171
171
|
new HMACAuthorization({
|
|
172
|
-
secret:
|
|
172
|
+
secret: environments.HMAC_SECRET,
|
|
173
173
|
signature: base64Signature,
|
|
174
174
|
rawPayload: canonicalPayloadString,
|
|
175
175
|
algorithm: 'SHA512',
|
|
@@ -188,10 +188,7 @@ new HMACAuthorization({
|
|
|
188
188
|
| Wrong secret / tampered payload / wrong algorithm / garbage signature | `false` |
|
|
189
189
|
| `signaturePrefix` set but missing from `signature` | `false` |
|
|
190
190
|
| Timestamp outside tolerance, or not parseable | `false` |
|
|
191
|
-
| Empty `secret` | **Throw** |
|
|
192
|
-
| `algorithm` not a `HMACAlgorithm` key | **Throw** |
|
|
193
|
-
| Unsupported `signatureFormat` | **Throw** |
|
|
194
|
-
| `toleranceInSeconds` without `timestamp` | **Throw** |
|
|
191
|
+
| Empty `secret`, unknown `algorithm` or `signatureFormat`, `toleranceInSeconds` without `timestamp` | **Throw** (`hmac-authorize.ts`) |
|
|
195
192
|
|
|
196
193
|
Design callers so manifest context is complete **before** the handler runs; missing or malformed configuration is a programmer error, not a silent denial.
|
|
197
194
|
|
|
@@ -241,8 +238,7 @@ For workflow orchestration and claims use **framework-core**; for JWKS/JWT verif
|
|
|
241
238
|
3. Attach `new HMACAuthorization(context)` to `Workflow` and/or `App` `authorization` option.
|
|
242
239
|
4. Keep `rawPayload` byte-exact — do not parse and re-stringify JSON.
|
|
243
240
|
5. Set `signaturePrefix` when the provider prefixes the header (`sha256=`).
|
|
244
|
-
6. Set `algorithm` / `signatureFormat` only when they differ from `SHA256` / `hex
|
|
241
|
+
6. Set `algorithm` / `signatureFormat` only when they differ from `SHA256` / `hex`.
|
|
245
242
|
7. Add `timestamp` + `toleranceInSeconds` for replay protection, and bind the timestamp into `rawPayload`.
|
|
246
|
-
8.
|
|
243
|
+
8. `@t4h.framework/core/no-literal-secret-in-authorization` rejects a literal `secret`. Read it from the `EnvDesign` in `src/constants/environments.ts`.
|
|
247
244
|
9. Expect `false` for deny, throws for misconfiguration.
|
|
248
|
-
10. Do not reference APIs absent from `src/` and tests.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @t4h.framework/hmac
|
|
2
2
|
|
|
3
|
+
## 0.3.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#241](https://github.com/tech4humans-brasil/framework/pull/241) [`f6b8454`](https://github.com/tech4humans-brasil/framework/commit/f6b845484d22e7c8e7240fe2e113f1cdea7c8ce3) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Adds seven rules to `@t4h.framework/core/eslint` and turns them on in `configs.recommended`:
|
|
8
|
+
- `no-io-in-workflow` reports `fetch` and calls to network, file, database and mail modules in a workflow and in the `constructor`, `toInput` and `toOutput` of an activity. It also reports `zlib` and `stream` calls there, because they work on the content in memory on each replay.
|
|
9
|
+
- `no-binary-subclass` reports a class that extends `Binary`.
|
|
10
|
+
- `no-framework-activity-in-app` reports `new` and `extends` on an activity of a framework package other than the core.
|
|
11
|
+
- `no-testing-import-in-source` reports an import of a `@t4h.framework/<package>/testing` entry out of a test file.
|
|
12
|
+
- `require-workflow-id` reports a `Workflow` with no `id`.
|
|
13
|
+
- `no-secret-to-string` reports a `Secret` that becomes a string.
|
|
14
|
+
- `no-literal-secret-in-authorization` reports a string literal in the `secret` or `clientSecret` field of an `Authorization`.
|
|
15
|
+
|
|
16
|
+
The package skills now name these rules in place of the text that the rules enforce. The docs and skills give each `Workflow` an `id`, read the HMAC secret from `EnvDesign`, and do not document a custom HTTP activity.
|
|
17
|
+
|
|
18
|
+
- [#243](https://github.com/tech4humans-brasil/framework/pull/243) [`0ffd663`](https://github.com/tech4humans-brasil/framework/commit/0ffd663ce8369edd7b54206cb3216568ad1de471) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The README examples read each value from `environments`, an `EnvDesign` in `src/constants/environments.ts`, and pass each credential as a `Secret`. They no longer use `process.env`, the raw `env` from the core or a literal in a `Secret` field. The jwks README describes the real context fields (`signature`, `rawPayload`) and says that a token that `jwt.verify` rejects throws.
|
|
19
|
+
|
|
20
|
+
- [#240](https://github.com/tech4humans-brasil/framework/pull/240) [`0606115`](https://github.com/tech4humans-brasil/framework/commit/0606115e2e0baa994e9f0ed3559ee54ecac88e44) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The skills do not repeat a rule that a lint rule, `tsc` or a runtime error already enforces. Each such rule is now one line that names the gate. The examples that broke a gate (`process.env`, `as any`, an inline secret, an `EnvDesign` in a workflow file, `ref.output` before `wait()`) are correct now.
|
|
21
|
+
|
|
22
|
+
- [#228](https://github.com/tech4humans-brasil/framework/pull/228) [`d29e1ab`](https://github.com/tech4humans-brasil/framework/commit/d29e1ab29a039b13c3e4b075472bd615566ae75e) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Uses exact types and `unknown` in place of `any`, and checks external data with guards.
|
|
23
|
+
- harness: the fix-issues prompt lists each sensor as `- checkTypes: PASS`. Before, it printed `- 0: [object Object]`.
|
|
24
|
+
- hmac: an algorithm name such as `constructor` throws `Unsupported algorithm`.
|
|
25
|
+
- oidc: a discovery response with no `introspection_endpoint`, or a null introspection body, throws a clear error.
|
|
26
|
+
- `HttpRequestActivity.toOutput` takes `HttpRequestActivityOutput` in place of `any`.
|
|
27
|
+
|
|
3
28
|
## 0.3.7
|
|
4
29
|
|
|
5
30
|
## 0.3.6
|
package/README.md
CHANGED
|
@@ -60,8 +60,10 @@ Note that the timestamp is only checked for freshness. If you want it *bound* to
|
|
|
60
60
|
```typescript
|
|
61
61
|
import { HMACAuthorization } from '@t4h.framework/hmac'
|
|
62
62
|
|
|
63
|
+
import { environments } from './constants/environments.js'
|
|
64
|
+
|
|
63
65
|
const authorization = new HMACAuthorization({
|
|
64
|
-
secret:
|
|
66
|
+
secret: environments.HMAC_SECRET,
|
|
65
67
|
signature: '<signature-from-the-request-header>',
|
|
66
68
|
rawPayload: '<the-exact-request-body>',
|
|
67
69
|
signaturePrefix: 'sha256=',
|
|
@@ -70,4 +72,15 @@ const authorization = new HMACAuthorization({
|
|
|
70
72
|
})
|
|
71
73
|
```
|
|
72
74
|
|
|
75
|
+
Declare `HMAC_SECRET` in the `EnvDesign` in `src/constants/environments.ts` with `type: String`, because the `secret` field is a string:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// src/constants/environments.ts
|
|
79
|
+
import { EnvDesign } from '@t4h.framework/core'
|
|
80
|
+
|
|
81
|
+
export const environments = EnvDesign({
|
|
82
|
+
HMAC_SECRET: { type: String },
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
73
86
|
Wire `authorization` on an `App` or `Workflow` per the core package. The platform loads `@t4h.framework/hmac/authorize` with the manifest context when a protected workflow runs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-authorize.d.ts","sourceRoot":"","sources":["../src/hmac-authorize.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAE7E,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,sBAAsB,WAAW,CAAA;AAE9C,eAAO,MAAM,6BAA6B,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"hmac-authorize.d.ts","sourceRoot":"","sources":["../src/hmac-authorize.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAE7E,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,sBAAsB,WAAW,CAAA;AAE9C,eAAO,MAAM,6BAA6B,QAAQ,CAAA;AAgElD,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,OAAO,CAAC,CAIlB"}
|
package/dist/hmac-authorize.js
CHANGED
|
@@ -16,7 +16,13 @@ const SIGNATURE_FORMATS = [
|
|
|
16
16
|
'base64url',
|
|
17
17
|
'binary',
|
|
18
18
|
];
|
|
19
|
-
|
|
19
|
+
function isAlgorithmKey(key) {
|
|
20
|
+
return Object.hasOwn(HMACAlgorithm, key);
|
|
21
|
+
}
|
|
22
|
+
function isSignatureFormat(format) {
|
|
23
|
+
return SIGNATURE_FORMATS.some(supported => supported === format);
|
|
24
|
+
}
|
|
25
|
+
function verifyHmac(options) {
|
|
20
26
|
const signature = options.signature;
|
|
21
27
|
if (!signature)
|
|
22
28
|
return false;
|
|
@@ -24,11 +30,11 @@ export default async function hmac(options) {
|
|
|
24
30
|
if (!secret)
|
|
25
31
|
throw new Error('Secret is required for payload verification');
|
|
26
32
|
const algorithmKey = options.algorithm ?? HMAC_DEFAULT_ALGORITHM;
|
|
27
|
-
|
|
28
|
-
if (!algorithm)
|
|
33
|
+
if (!isAlgorithmKey(algorithmKey))
|
|
29
34
|
throw new Error(`Unsupported algorithm: ${algorithmKey}`);
|
|
35
|
+
const algorithm = HMACAlgorithm[algorithmKey];
|
|
30
36
|
const signatureFormat = options.signatureFormat ?? HMAC_DEFAULT_SIGNATURE_FORMAT;
|
|
31
|
-
if (!
|
|
37
|
+
if (!isSignatureFormat(signatureFormat))
|
|
32
38
|
throw new Error(`Unsupported signature format: ${signatureFormat}`);
|
|
33
39
|
const toleranceInSeconds = options.toleranceInSeconds;
|
|
34
40
|
if (toleranceInSeconds !== undefined) {
|
|
@@ -48,4 +54,9 @@ export default async function hmac(options) {
|
|
|
48
54
|
.digest();
|
|
49
55
|
return timingSafeCompare(expected, candidate, signatureFormat);
|
|
50
56
|
}
|
|
57
|
+
export default function hmac(options) {
|
|
58
|
+
return new Promise(resolve => {
|
|
59
|
+
resolve(verifyHmac(options));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
51
62
|
//# sourceMappingURL=hmac-authorize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-authorize.js","sourceRoot":"","sources":["../src/hmac-authorize.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAA6B,MAAM,aAAa,CAAA;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO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AM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAErE,MAAM,QAAQ,GAAG,MAAM;SACpB,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC;SAC7B,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;SAC1B,MAAM,EAAE,CAAA;IAEX,OAAO,iBAAiB,CAAC,QAAQ,EAAE,SAAS,EAAE,eAAe,CAAC,CAAA;AAChE,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,OAAiC;IAEjC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -5,7 +5,7 @@ export type HMACAuthorizationContext = {
|
|
|
5
5
|
signature: string;
|
|
6
6
|
rawPayload: string;
|
|
7
7
|
algorithm?: string;
|
|
8
|
-
signatureFormat?: BinaryToTextEncoding | string;
|
|
8
|
+
signatureFormat?: BinaryToTextEncoding | (string & {});
|
|
9
9
|
signaturePrefix?: string;
|
|
10
10
|
timestamp?: string;
|
|
11
11
|
toleranceInSeconds?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HMACAuthorization.d.ts","sourceRoot":"","sources":["../../src/models/HMACAuthorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAE/E,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"HMACAuthorization.d.ts","sourceRoot":"","sources":["../../src/models/HMACAuthorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAE/E,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,oBAAoB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACtD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,yBAAyB,GACnC,qBAAqB,CAAC,wBAAwB,CAAC,CAAA;AAEjD,qBAAa,iBAAkB,SAAQ,aAAa,CAAC,wBAAwB,CAAC;IAChE,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,wBAAwB;IAIvD,UAAU,IAAI,yBAAyB;CAe/C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t4h.framework/hmac",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "HMAC module for the T4H Framework authorization",
|
|
5
5
|
"homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/hmac",
|
|
6
6
|
"bugs": "https://github.com/tech4humans-brasil/framework/issues",
|
|
@@ -36,12 +36,14 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc --project tsconfig.build.json",
|
|
38
38
|
"check-types": "tsc --noEmit",
|
|
39
|
+
"check-package": "publint --strict && attw --pack . --profile esm-only",
|
|
40
|
+
"lint": "eslint . --max-warnings 0",
|
|
39
41
|
"prepublishOnly": "yarn build",
|
|
40
42
|
"test": "vitest run",
|
|
41
43
|
"test:watch": "vitest"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
|
-
"@t4h.framework/core": "^0.
|
|
46
|
+
"@t4h.framework/core": "^0.20.0",
|
|
45
47
|
"typescript": "^5.9.3",
|
|
46
48
|
"vitest": "^4.0.18"
|
|
47
49
|
},
|