ecwt 0.2.1-beta.3 → 0.2.1-beta.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/bun.lockb +0 -0
- package/dist/main.cjs +1 -1
- package/dist/types/factory.d.ts +2 -2
- package/package.json +7 -7
- package/src/factory.js +1 -1
package/bun.lockb
CHANGED
|
Binary file
|
package/dist/main.cjs
CHANGED
|
@@ -196,7 +196,7 @@ var EcwtFactory = class {
|
|
|
196
196
|
* @param {object} param0.options -
|
|
197
197
|
* @param {string} [param0.options.namespace] Namespace for Redis keys.
|
|
198
198
|
* @param {Buffer} param0.options.key Encryption key, 64 bytes
|
|
199
|
-
* @param {(value:
|
|
199
|
+
* @param {(value: unknown) => D} [param0.options.validator] Validator for token data. Should return validated value or throw an error.
|
|
200
200
|
* @param {Record<string, number>} [param0.options.senml_key_map] Payload object keys mapped for their SenML keys.
|
|
201
201
|
*/
|
|
202
202
|
constructor({
|
package/dist/types/factory.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export class EcwtFactory<D extends Record<string, any> = Record<string, any>> {
|
|
|
10
10
|
* @param {object} param0.options -
|
|
11
11
|
* @param {string} [param0.options.namespace] Namespace for Redis keys.
|
|
12
12
|
* @param {Buffer} param0.options.key Encryption key, 64 bytes
|
|
13
|
-
* @param {(value:
|
|
13
|
+
* @param {(value: unknown) => D} [param0.options.validator] Validator for token data. Should return validated value or throw an error.
|
|
14
14
|
* @param {Record<string, number>} [param0.options.senml_key_map] Payload object keys mapped for their SenML keys.
|
|
15
15
|
*/
|
|
16
16
|
constructor({ redisClient, lruCache, snowflakeFactory, options: { namespace, key, validator, senml_key_map, }, }: {
|
|
@@ -20,7 +20,7 @@ export class EcwtFactory<D extends Record<string, any> = Record<string, any>> {
|
|
|
20
20
|
options: {
|
|
21
21
|
namespace?: string | undefined;
|
|
22
22
|
key: Buffer;
|
|
23
|
-
validator?: ((value:
|
|
23
|
+
validator?: ((value: unknown) => D) | undefined;
|
|
24
24
|
senml_key_map?: Record<string, number> | undefined;
|
|
25
25
|
};
|
|
26
26
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ecwt",
|
|
3
|
-
"version": "0.2.1-beta.
|
|
3
|
+
"version": "0.2.1-beta.4",
|
|
4
4
|
"description": "Encrypted CBOR-encoded Web Token",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"redis": "^4"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@kirick/eslint-config": "^0.1.
|
|
29
|
-
"@types/node": "^
|
|
28
|
+
"@kirick/eslint-config": "^0.1.21",
|
|
29
|
+
"@types/node": "^22.2",
|
|
30
30
|
"eslint": "9.8.0",
|
|
31
|
-
"valibot": "^0.
|
|
31
|
+
"valibot": "^0.37",
|
|
32
32
|
"vitest": "^1.6"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "bun run build:types && bun run build:cjs",
|
|
36
36
|
"build:cjs": "bunx esbuild --bundle --platform=node --format=cjs --packages=external --outfile=dist/main.cjs src/main.js",
|
|
37
|
-
"build:types": "bunx tsc --
|
|
37
|
+
"build:types": "rm -rf dist/esm dist/types ; bunx tsc --emitDeclarationOnly && rm dist/**/*.test.d.ts",
|
|
38
38
|
"lint": "eslint . && bunx tsc --skipLibCheck --noemit",
|
|
39
39
|
"publish:npm": "bun run build && bun run lint && bun run test && npm publish",
|
|
40
|
-
"redis:up": "docker ps | grep test-redis >/dev/null || docker run --rm -d -p
|
|
41
|
-
"test": "
|
|
40
|
+
"redis:up": "docker ps | grep test-redis >/dev/null || docker run --rm -d -p 16379:6379 --name test-redis redis:7-alpine",
|
|
41
|
+
"test": "bun run redis:up && npm run test:vitest && bun test --coverage",
|
|
42
42
|
"test:vitest": "vitest run --no-file-parallelism"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
package/src/factory.js
CHANGED
|
@@ -53,7 +53,7 @@ export class EcwtFactory {
|
|
|
53
53
|
* @param {object} param0.options -
|
|
54
54
|
* @param {string} [param0.options.namespace] Namespace for Redis keys.
|
|
55
55
|
* @param {Buffer} param0.options.key Encryption key, 64 bytes
|
|
56
|
-
* @param {(value:
|
|
56
|
+
* @param {(value: unknown) => D} [param0.options.validator] Validator for token data. Should return validated value or throw an error.
|
|
57
57
|
* @param {Record<string, number>} [param0.options.senml_key_map] Payload object keys mapped for their SenML keys.
|
|
58
58
|
*/
|
|
59
59
|
constructor({
|