@pikku/skills 0.12.50 → 0.12.51

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/skills",
3
- "version": "0.12.50",
3
+ "version": "0.12.51",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pikkujs/pikku.git",
@@ -79,6 +79,16 @@ service's paths and size limit; omitting it does not disable it.
79
79
  function enriches the event with the function id, wire type, trace id and user
80
80
  identity; an `insertInto('audit_log')` of your own gets none of that, and a
81
81
  write inside a transaction that later rolls back records nothing.
82
+ - **Do not reach for `node:os` (`tmpdir()`, `homedir()`) or hand-roll `mkdtemp`
83
+ to get a scratch file.** `node:os` is missing from the Cloudflare Workers
84
+ runtime, so one import fails the whole worker at upload, even if the code path
85
+ never runs there. `TemporaryFileService` (`@pikku/core/services/temporary-file-service`)
86
+ is a **wire service**, not a singleton: build it in `pikkuWireServices` with
87
+ `new TemporaryFileService(singletonServices.logger, tempDir).createInstance()`
88
+ and return the `TemporaryFileInstance`, so each invocation owns its own files.
89
+ Use `writeFile(key, stream)`, `getTempFileAbsolutePath(key)` when a subprocess
90
+ needs a path, and `cleanup()` in a `finally`. Do not construct it in
91
+ `pikkuServices` and close over it in a singleton — pass the instance in per call.
82
92
  - **Do not log an unrevealed secret.** Every logger argument is `Safe<>`-guarded,
83
93
  so a `SecretValue` nested anywhere in the call collapses it to `never` and it
84
94
  stops compiling. That is deliberate — it would have printed `[secret]` anyway.
@@ -155,7 +155,11 @@ public because receivers share the scheme:
155
155
  ```ts
156
156
  const raw = await request.text()
157
157
  if (
158
- !webhookService.verify(secret, request.headers.get('x-pikku-signature')!, raw)
158
+ !(await webhookService.verify(
159
+ secret,
160
+ request.headers.get('x-pikku-signature')!,
161
+ raw
162
+ ))
159
163
  ) {
160
164
  throw new UnauthorizedError()
161
165
  }
@@ -102,7 +102,7 @@ const tokens = await exchangeSlackOAuthCode({
102
102
  ```typescript
103
103
  import { verifySlackSignature } from '@pikku/gateway-slack'
104
104
 
105
- verifySlackSignature(signingSecret, signature, timestamp, body): boolean
105
+ verifySlackSignature(signingSecret, signature, timestamp, body): Promise<boolean>
106
106
  ```
107
107
 
108
108
  **Signature before timestamp** — the two middle arguments are both strings, so
@@ -158,9 +158,10 @@ subscribe to its events as `<source>:<event>`:
158
158
  provider's private key; the stored secret is its PEM public key (Wise).
159
159
  - Anything else (a timestamp in the signed payload, a signature in the body
160
160
  or query, a URL in the signed string) is a function
161
- `(request, secret, services) => boolean`, built from `hmacDigest`,
161
+ `(request, secret, services) => boolean | Promise<boolean>`, built from `hmacDigest`,
162
162
  `verifyHmacSignature`, `verifyPublicKeySignature` and
163
- `timingSafeStringEqual` in `@pikku/core/hmac`.
163
+ `timingSafeStringEqual` in `@pikku/core/hmac` (all but the last are
164
+ async: `await` them).
164
165
 
165
166
  A request with a body that fails is refused with a 401. A bodiless request
166
167
  that fails (a validation token in the query) still reaches