@prosopo/detector 3.5.17 → 3.5.19
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/.turbo/turbo-build$colon$cjs.log +3 -7
- package/.turbo/turbo-build$colon$tsc.log +9 -9
- package/.turbo/turbo-build.log +4 -8
- package/CHANGELOG.md +16 -0
- package/dist/cjs/index.cjs +7300 -8317
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7299 -8316
- package/dist/index.js.map +1 -1
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +42 -0
- package/dist/index.test.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import detect, { encryptData } from "./index.js";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
describe("@prosopo/detector bundle contract", () => {
|
|
4
|
+
it("exports the detect entry point as the default export", () => {
|
|
5
|
+
expect(typeof detect).toBe("function");
|
|
6
|
+
});
|
|
7
|
+
it("keeps the detect signature at three parameters", () => {
|
|
8
|
+
expect(detect).toHaveLength(3);
|
|
9
|
+
});
|
|
10
|
+
it("exports encryptData as a single-parameter function", () => {
|
|
11
|
+
expect(typeof encryptData).toBe("function");
|
|
12
|
+
expect(encryptData).toHaveLength(1);
|
|
13
|
+
});
|
|
14
|
+
it("exposes no exports beyond detect and encryptData", async () => {
|
|
15
|
+
const module = await import("./index.js");
|
|
16
|
+
expect(Object.keys(module).sort()).toStrictEqual([
|
|
17
|
+
"default",
|
|
18
|
+
"encryptData",
|
|
19
|
+
]);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
describe("encryptData when web crypto is unavailable", () => {
|
|
23
|
+
it("rejects rather than hanging", async () => {
|
|
24
|
+
await expect(encryptData("payload")).rejects.toThrow();
|
|
25
|
+
});
|
|
26
|
+
it("rejects for the empty string too", async () => {
|
|
27
|
+
await expect(encryptData("")).rejects.toThrow();
|
|
28
|
+
});
|
|
29
|
+
it("settles promptly instead of waiting on a timeout", async () => {
|
|
30
|
+
const settled = await Promise.race([
|
|
31
|
+
encryptData("payload").then(() => "resolved", () => "rejected"),
|
|
32
|
+
new Promise((resolve) => {
|
|
33
|
+
setTimeout(() => resolve("timed-out"), 1000);
|
|
34
|
+
}),
|
|
35
|
+
]);
|
|
36
|
+
expect(settled).toBe("rejected");
|
|
37
|
+
});
|
|
38
|
+
it("rejects with an Error, not a bare string", async () => {
|
|
39
|
+
await expect(encryptData("payload")).rejects.toBeInstanceOf(Error);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAoBA,OAAO,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IAClD,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC/D,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QAUzD,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC7D,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,CAAC,WAAW,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CAA0C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/detector",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.19",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"engines": {
|
|
@@ -20,15 +20,16 @@
|
|
|
20
20
|
"build:cross-env": "vite build --config vite.esm.config.ts",
|
|
21
21
|
"build:tsc": "tsc --build --verbose",
|
|
22
22
|
"build:cjs": "NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV",
|
|
23
|
+
"test": "NODE_ENV=${NODE_ENV:-test}; npx vitest run --config ./vite.test.config.ts",
|
|
23
24
|
"typecheck": "tsc --project tsconfig.types.json"
|
|
24
25
|
},
|
|
25
26
|
"type": "module",
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@prosopo/types": "5.0.
|
|
28
|
+
"@prosopo/types": "5.0.4",
|
|
28
29
|
"dotenv": "16.4.5"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@prosopo/config": "3.3.
|
|
32
|
+
"@prosopo/config": "3.3.8",
|
|
32
33
|
"@types/node": "22.10.2",
|
|
33
34
|
"@vitest/coverage-v8": "4.1.10",
|
|
34
35
|
"concurrently": "9.0.1",
|