@silmaril-security/sdk 0.11.3 → 0.11.4
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 +4 -0
- package/README.md +11 -4
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -35,10 +35,10 @@ This SDK is distributed as an npm package.
|
|
|
35
35
|
npm install @silmaril-security/sdk
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Pin version 0.11.
|
|
38
|
+
Pin version 0.11.4 for reproducible installs:
|
|
39
39
|
|
|
40
40
|
```sh
|
|
41
|
-
npm install @silmaril-security/sdk@0.11.
|
|
41
|
+
npm install @silmaril-security/sdk@0.11.4
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Requires Node 20 or later.
|
|
@@ -203,11 +203,16 @@ Events that belong to one conversation are not independent. Send them with
|
|
|
203
203
|
ordered individual `classify()` calls that share `metadata.conversationId`, and
|
|
204
204
|
wait for each call before sending the next event for that conversation.
|
|
205
205
|
|
|
206
|
-
Pass a `signal` to cancel one call without touching its siblings
|
|
206
|
+
Pass a `signal` to cancel one call without touching its siblings. In Node's
|
|
207
|
+
HTTP server, listen for the outgoing response closing before it finishes:
|
|
207
208
|
|
|
208
209
|
```ts
|
|
209
210
|
const controller = new AbortController();
|
|
210
|
-
|
|
211
|
+
const abortIfDisconnected = () => {
|
|
212
|
+
if (!response.writableFinished) controller.abort();
|
|
213
|
+
};
|
|
214
|
+
response.once("close", abortIfDisconnected);
|
|
215
|
+
if (response.destroyed) abortIfDisconnected();
|
|
211
216
|
|
|
212
217
|
try {
|
|
213
218
|
const result = await fw.classify(userInput, {
|
|
@@ -220,6 +225,8 @@ try {
|
|
|
220
225
|
return; // caller went away
|
|
221
226
|
}
|
|
222
227
|
throw err;
|
|
228
|
+
} finally {
|
|
229
|
+
response.off("close", abortIfDisconnected);
|
|
223
230
|
}
|
|
224
231
|
```
|
|
225
232
|
|
package/dist/index.cjs
CHANGED