@lsby/net-core-jwt 0.2.0 → 0.5.0

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.
@@ -25,15 +25,17 @@ __export(get_authorization_exports, {
25
25
  module.exports = __toCommonJS(get_authorization_exports);
26
26
  var import_zod = require("zod");
27
27
  var import_net_core = require("@lsby/net-core");
28
- var zod\u7C7B\u578B\u8868\u793A = import_zod.z.object({
28
+ var import_ts_fp_data = require("@lsby/ts-fp-data");
29
+ var \u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0 = import_zod.z.never();
30
+ var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0 = import_zod.z.object({
29
31
  authorization: import_zod.z.string().or(import_zod.z.undefined())
30
32
  });
31
33
  var GetAuthorization\u63D2\u4EF6 = class extends import_net_core.\u63D2\u4EF6 {
32
34
  constructor() {
33
- super(zod\u7C7B\u578B\u8868\u793A, async (req) => {
34
- return {
35
+ super(\u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0, \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0, async (req, _res) => {
36
+ return new import_ts_fp_data.Right({
35
37
  authorization: req.headers.authorization
36
- };
38
+ });
37
39
  });
38
40
  }
39
41
  };
@@ -1,14 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  import { 插件 as __ } from '@lsby/net-core';
3
3
 
4
- declare let zod类型表示: z.ZodObject<{
4
+ declare var 错误类型描述: z.ZodNever;
5
+ declare let 正确类型描述: z.ZodObject<{
5
6
  authorization: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
6
7
  }, "strip", z.ZodTypeAny, {
7
8
  authorization?: string | undefined;
8
9
  }, {
9
10
  authorization?: string | undefined;
10
11
  }>;
11
- declare class GetAuthorization插件 extends __<typeof zod类型表示> {
12
+ declare class GetAuthorization插件 extends __<typeof 错误类型描述, typeof 正确类型描述> {
12
13
  constructor();
13
14
  }
14
15
 
@@ -25,15 +25,17 @@ __export(get_token_exports, {
25
25
  module.exports = __toCommonJS(get_token_exports);
26
26
  var import_zod = require("zod");
27
27
  var import_net_core = require("@lsby/net-core");
28
- var zod\u7C7B\u578B\u8868\u793A = import_zod.z.object({
28
+ var import_ts_fp_data = require("@lsby/ts-fp-data");
29
+ var \u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0 = import_zod.z.never();
30
+ var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0 = import_zod.z.object({
29
31
  token: import_zod.z.string().or(import_zod.z.undefined())
30
32
  });
31
33
  var GetToken\u63D2\u4EF6 = class extends import_net_core.\u63D2\u4EF6 {
32
34
  constructor() {
33
- super(zod\u7C7B\u578B\u8868\u793A, async (req) => {
34
- return {
35
+ super(\u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0, \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0, async (req, _res) => {
36
+ return new import_ts_fp_data.Right({
35
37
  token: req.headers.authorization?.replace("Bearer ", "")
36
- };
38
+ });
37
39
  });
38
40
  }
39
41
  };
@@ -1,14 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  import { 插件 as __ } from '@lsby/net-core';
3
3
 
4
- declare let zod类型表示: z.ZodObject<{
4
+ declare let 错误类型描述: z.ZodNever;
5
+ declare let 正确类型描述: z.ZodObject<{
5
6
  token: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
6
7
  }, "strip", z.ZodTypeAny, {
7
8
  token?: string | undefined;
8
9
  }, {
9
10
  token?: string | undefined;
10
11
  }>;
11
- declare class GetToken插件 extends __<typeof zod类型表示> {
12
+ declare class GetToken插件 extends __<typeof 错误类型描述, typeof 正确类型描述> {
12
13
  constructor();
13
14
  }
14
15
 
@@ -29,26 +29,25 @@ module.exports = __toCommonJS(src_exports);
29
29
  // src/jwt.ts
30
30
  var import_zod = require("zod");
31
31
  var import_net_core = require("@lsby/net-core");
32
+ var import_ts_fp_data = require("@lsby/ts-fp-data");
32
33
  var import_ts_jwt = require("@lsby/ts-jwt");
33
34
  var JWT\u89E3\u6790\u63D2\u4EF6 = class extends import_net_core.\u63D2\u4EF6 {
34
35
  constructor(\u7C7B\u578B\u8868\u793A, jwt\u5B9E\u4F8B) {
35
- super(\u7C7B\u578B\u8868\u793A, async (req, _res) => {
36
+ super(import_zod.z.never(), \u7C7B\u578B\u8868\u793A, async (req, _res) => {
36
37
  var data = jwt\u5B9E\u4F8B.\u89E3\u6790(req.headers.authorization ?? void 0);
37
- return data || {};
38
+ return new import_ts_fp_data.Right(data || {});
38
39
  });
39
40
  }
40
41
  };
41
42
  var JWT\u7B7E\u540D\u63D2\u4EF6 = class extends import_net_core.\u63D2\u4EF6 {
42
43
  constructor(\u7C7B\u578B\u8868\u793A, jwt\u5B9E\u4F8B) {
43
- super(
44
- import_zod.z.object({
45
- signJwt: import_zod.z.function(import_zod.z.tuple([\u7C7B\u578B\u8868\u793A]), import_zod.z.string())
46
- }),
47
- async (_req, _res) => {
48
- var signJwt = (data) => jwt\u5B9E\u4F8B.\u7B7E\u540D(data);
49
- return { signJwt };
50
- }
51
- );
44
+ var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF03 = import_zod.z.object({
45
+ signJwt: import_zod.z.function(import_zod.z.tuple([\u7C7B\u578B\u8868\u793A]), import_zod.z.string())
46
+ });
47
+ super(import_zod.z.never(), \u6B63\u786E\u7C7B\u578B\u63CF\u8FF03, async (_req, _res) => {
48
+ var signJwt = (data) => jwt\u5B9E\u4F8B.\u7B7E\u540D(data);
49
+ return new import_ts_fp_data.Right({ signJwt });
50
+ });
52
51
  }
53
52
  };
54
53
  var JWT\u63D2\u4EF6 = class {
@@ -65,15 +64,17 @@ var JWT\u63D2\u4EF6 = class {
65
64
  // src/get-token.ts
66
65
  var import_zod2 = require("zod");
67
66
  var import_net_core2 = require("@lsby/net-core");
68
- var zod\u7C7B\u578B\u8868\u793A = import_zod2.z.object({
67
+ var import_ts_fp_data2 = require("@lsby/ts-fp-data");
68
+ var \u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0 = import_zod2.z.never();
69
+ var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0 = import_zod2.z.object({
69
70
  token: import_zod2.z.string().or(import_zod2.z.undefined())
70
71
  });
71
72
  var GetToken\u63D2\u4EF6 = class extends import_net_core2.\u63D2\u4EF6 {
72
73
  constructor() {
73
- super(zod\u7C7B\u578B\u8868\u793A, async (req) => {
74
- return {
74
+ super(\u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0, \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0, async (req, _res) => {
75
+ return new import_ts_fp_data2.Right({
75
76
  token: req.headers.authorization?.replace("Bearer ", "")
76
- };
77
+ });
77
78
  });
78
79
  }
79
80
  };
@@ -81,15 +82,17 @@ var GetToken\u63D2\u4EF6 = class extends import_net_core2.\u63D2\u4EF6 {
81
82
  // src/get-authorization.ts
82
83
  var import_zod3 = require("zod");
83
84
  var import_net_core3 = require("@lsby/net-core");
84
- var zod\u7C7B\u578B\u8868\u793A2 = import_zod3.z.object({
85
+ var import_ts_fp_data3 = require("@lsby/ts-fp-data");
86
+ var \u9519\u8BEF\u7C7B\u578B\u63CF\u8FF02 = import_zod3.z.never();
87
+ var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF02 = import_zod3.z.object({
85
88
  authorization: import_zod3.z.string().or(import_zod3.z.undefined())
86
89
  });
87
90
  var GetAuthorization\u63D2\u4EF6 = class extends import_net_core3.\u63D2\u4EF6 {
88
91
  constructor() {
89
- super(zod\u7C7B\u578B\u8868\u793A2, async (req) => {
90
- return {
92
+ super(\u9519\u8BEF\u7C7B\u578B\u63CF\u8FF02, \u6B63\u786E\u7C7B\u578B\u63CF\u8FF02, async (req, _res) => {
93
+ return new import_ts_fp_data3.Right({
91
94
  authorization: req.headers.authorization
92
- };
95
+ });
93
96
  });
94
97
  }
95
98
  };
package/dist/cjs/jwt.cjs CHANGED
@@ -25,26 +25,25 @@ __export(jwt_exports, {
25
25
  module.exports = __toCommonJS(jwt_exports);
26
26
  var import_zod = require("zod");
27
27
  var import_net_core = require("@lsby/net-core");
28
+ var import_ts_fp_data = require("@lsby/ts-fp-data");
28
29
  var import_ts_jwt = require("@lsby/ts-jwt");
29
30
  var JWT\u89E3\u6790\u63D2\u4EF6 = class extends import_net_core.\u63D2\u4EF6 {
30
31
  constructor(\u7C7B\u578B\u8868\u793A, jwt\u5B9E\u4F8B) {
31
- super(\u7C7B\u578B\u8868\u793A, async (req, _res) => {
32
+ super(import_zod.z.never(), \u7C7B\u578B\u8868\u793A, async (req, _res) => {
32
33
  var data = jwt\u5B9E\u4F8B.\u89E3\u6790(req.headers.authorization ?? void 0);
33
- return data || {};
34
+ return new import_ts_fp_data.Right(data || {});
34
35
  });
35
36
  }
36
37
  };
37
38
  var JWT\u7B7E\u540D\u63D2\u4EF6 = class extends import_net_core.\u63D2\u4EF6 {
38
39
  constructor(\u7C7B\u578B\u8868\u793A, jwt\u5B9E\u4F8B) {
39
- super(
40
- import_zod.z.object({
41
- signJwt: import_zod.z.function(import_zod.z.tuple([\u7C7B\u578B\u8868\u793A]), import_zod.z.string())
42
- }),
43
- async (_req, _res) => {
44
- var signJwt = (data) => jwt\u5B9E\u4F8B.\u7B7E\u540D(data);
45
- return { signJwt };
46
- }
47
- );
40
+ var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0 = import_zod.z.object({
41
+ signJwt: import_zod.z.function(import_zod.z.tuple([\u7C7B\u578B\u8868\u793A]), import_zod.z.string())
42
+ });
43
+ super(import_zod.z.never(), \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0, async (_req, _res) => {
44
+ var signJwt = (data) => jwt\u5B9E\u4F8B.\u7B7E\u540D(data);
45
+ return new import_ts_fp_data.Right({ signJwt });
46
+ });
48
47
  }
49
48
  };
50
49
  var JWT\u63D2\u4EF6 = class {
@@ -2,12 +2,13 @@ import { z } from 'zod';
2
2
  import { 插件 as __ } from '@lsby/net-core';
3
3
  import { JWT管理器 as JWT___ } from '@lsby/ts-jwt';
4
4
 
5
- declare class JWT解析插件<解析器类型描述Zod extends z.AnyZodObject> extends __<解析器类型描述Zod> {
5
+ declare class JWT解析插件<解析器类型描述Zod extends z.AnyZodObject> extends __<z.ZodNever, 解析器类型描述Zod> {
6
6
  constructor(类型表示: 解析器类型描述Zod, jwt实例: JWT___<z.infer<typeof 类型表示>>);
7
7
  }
8
- declare class JWT签名插件<解析器类型描述Zod extends z.AnyZodObject> extends __<z.ZodObject<{
8
+ type 签名正确类型<解析器类型描述Zod extends z.AnyZodObject> = z.ZodObject<{
9
9
  signJwt: z.ZodFunction<z.ZodTuple<[解析器类型描述Zod], null>, z.ZodString>;
10
- }>> {
10
+ }>;
11
+ declare class JWT签名插件<解析器类型描述Zod extends z.AnyZodObject> extends __<z.ZodNever, 签名正确类型<解析器类型描述Zod>> {
11
12
  constructor(类型表示: 解析器类型描述Zod, jwt实例: JWT___<z.infer<typeof 类型表示>>);
12
13
  }
13
14
  declare class JWT插件<解析器类型描述Zod extends z.AnyZodObject> {
@@ -1,15 +1,17 @@
1
1
  // src/get-token.ts
2
2
  import { z } from "zod";
3
3
  import { \u63D2\u4EF6 } from "@lsby/net-core";
4
- var zod\u7C7B\u578B\u8868\u793A = z.object({
4
+ import { Right } from "@lsby/ts-fp-data";
5
+ var \u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0 = z.never();
6
+ var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0 = z.object({
5
7
  token: z.string().or(z.undefined())
6
8
  });
7
9
  var GetToken\u63D2\u4EF6 = class extends \u63D2\u4EF6 {
8
10
  constructor() {
9
- super(zod\u7C7B\u578B\u8868\u793A, async (req) => {
10
- return {
11
+ super(\u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0, \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0, async (req, _res) => {
12
+ return new Right({
11
13
  token: req.headers.authorization?.replace("Bearer ", "")
12
- };
14
+ });
13
15
  });
14
16
  }
15
17
  };
@@ -1,15 +1,17 @@
1
1
  // src/get-authorization.ts
2
2
  import { z } from "zod";
3
3
  import { \u63D2\u4EF6 } from "@lsby/net-core";
4
- var zod\u7C7B\u578B\u8868\u793A = z.object({
4
+ import { Right } from "@lsby/ts-fp-data";
5
+ var \u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0 = z.never();
6
+ var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0 = z.object({
5
7
  authorization: z.string().or(z.undefined())
6
8
  });
7
9
  var GetAuthorization\u63D2\u4EF6 = class extends \u63D2\u4EF6 {
8
10
  constructor() {
9
- super(zod\u7C7B\u578B\u8868\u793A, async (req) => {
10
- return {
11
+ super(\u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0, \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0, async (req, _res) => {
12
+ return new Right({
11
13
  authorization: req.headers.authorization
12
- };
14
+ });
13
15
  });
14
16
  }
15
17
  };
@@ -1,26 +1,25 @@
1
1
  // src/jwt.ts
2
2
  import { z } from "zod";
3
3
  import { \u63D2\u4EF6 } from "@lsby/net-core";
4
+ import { Right } from "@lsby/ts-fp-data";
4
5
  import { JWT\u7BA1\u7406\u5668 } from "@lsby/ts-jwt";
5
6
  var JWT\u89E3\u6790\u63D2\u4EF6 = class extends \u63D2\u4EF6 {
6
7
  constructor(\u7C7B\u578B\u8868\u793A, jwt\u5B9E\u4F8B) {
7
- super(\u7C7B\u578B\u8868\u793A, async (req, _res) => {
8
+ super(z.never(), \u7C7B\u578B\u8868\u793A, async (req, _res) => {
8
9
  var data = jwt\u5B9E\u4F8B.\u89E3\u6790(req.headers.authorization ?? void 0);
9
- return data || {};
10
+ return new Right(data || {});
10
11
  });
11
12
  }
12
13
  };
13
14
  var JWT\u7B7E\u540D\u63D2\u4EF6 = class extends \u63D2\u4EF6 {
14
15
  constructor(\u7C7B\u578B\u8868\u793A, jwt\u5B9E\u4F8B) {
15
- super(
16
- z.object({
17
- signJwt: z.function(z.tuple([\u7C7B\u578B\u8868\u793A]), z.string())
18
- }),
19
- async (_req, _res) => {
20
- var signJwt = (data) => jwt\u5B9E\u4F8B.\u7B7E\u540D(data);
21
- return { signJwt };
22
- }
23
- );
16
+ var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0 = z.object({
17
+ signJwt: z.function(z.tuple([\u7C7B\u578B\u8868\u793A]), z.string())
18
+ });
19
+ super(z.never(), \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0, async (_req, _res) => {
20
+ var signJwt = (data) => jwt\u5B9E\u4F8B.\u7B7E\u540D(data);
21
+ return new Right({ signJwt });
22
+ });
24
23
  }
25
24
  };
26
25
  var JWT\u63D2\u4EF6 = class {
@@ -1,14 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  import { 插件 as __ } from '@lsby/net-core';
3
3
 
4
- declare let zod类型表示: z.ZodObject<{
4
+ declare var 错误类型描述: z.ZodNever;
5
+ declare let 正确类型描述: z.ZodObject<{
5
6
  authorization: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
6
7
  }, "strip", z.ZodTypeAny, {
7
8
  authorization?: string | undefined;
8
9
  }, {
9
10
  authorization?: string | undefined;
10
11
  }>;
11
- declare class GetAuthorization插件 extends __<typeof zod类型表示> {
12
+ declare class GetAuthorization插件 extends __<typeof 错误类型描述, typeof 正确类型描述> {
12
13
  constructor();
13
14
  }
14
15
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GetAuthorization插件
3
- } from "./chunk-FJM2GMH2.js";
3
+ } from "./chunk-K56RP4BH.js";
4
4
  export {
5
5
  GetAuthorization\u63D2\u4EF6
6
6
  };
@@ -1,14 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  import { 插件 as __ } from '@lsby/net-core';
3
3
 
4
- declare let zod类型表示: z.ZodObject<{
4
+ declare let 错误类型描述: z.ZodNever;
5
+ declare let 正确类型描述: z.ZodObject<{
5
6
  token: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
6
7
  }, "strip", z.ZodTypeAny, {
7
8
  token?: string | undefined;
8
9
  }, {
9
10
  token?: string | undefined;
10
11
  }>;
11
- declare class GetToken插件 extends __<typeof zod类型表示> {
12
+ declare class GetToken插件 extends __<typeof 错误类型描述, typeof 正确类型描述> {
12
13
  constructor();
13
14
  }
14
15
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GetToken插件
3
- } from "./chunk-SDYIK55N.js";
3
+ } from "./chunk-F5B7LFMB.js";
4
4
  export {
5
5
  GetToken\u63D2\u4EF6
6
6
  };
package/dist/esm/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  GetAuthorization插件
3
- } from "./chunk-FJM2GMH2.js";
3
+ } from "./chunk-K56RP4BH.js";
4
4
  import {
5
5
  GetToken插件
6
- } from "./chunk-SDYIK55N.js";
6
+ } from "./chunk-F5B7LFMB.js";
7
7
  import {
8
8
  JWT插件
9
- } from "./chunk-ERC6C4HS.js";
9
+ } from "./chunk-TJU34POC.js";
10
10
  export {
11
11
  GetAuthorization\u63D2\u4EF6,
12
12
  GetToken\u63D2\u4EF6,
package/dist/esm/jwt.d.ts CHANGED
@@ -2,12 +2,13 @@ import { z } from 'zod';
2
2
  import { 插件 as __ } from '@lsby/net-core';
3
3
  import { JWT管理器 as JWT___ } from '@lsby/ts-jwt';
4
4
 
5
- declare class JWT解析插件<解析器类型描述Zod extends z.AnyZodObject> extends __<解析器类型描述Zod> {
5
+ declare class JWT解析插件<解析器类型描述Zod extends z.AnyZodObject> extends __<z.ZodNever, 解析器类型描述Zod> {
6
6
  constructor(类型表示: 解析器类型描述Zod, jwt实例: JWT___<z.infer<typeof 类型表示>>);
7
7
  }
8
- declare class JWT签名插件<解析器类型描述Zod extends z.AnyZodObject> extends __<z.ZodObject<{
8
+ type 签名正确类型<解析器类型描述Zod extends z.AnyZodObject> = z.ZodObject<{
9
9
  signJwt: z.ZodFunction<z.ZodTuple<[解析器类型描述Zod], null>, z.ZodString>;
10
- }>> {
10
+ }>;
11
+ declare class JWT签名插件<解析器类型描述Zod extends z.AnyZodObject> extends __<z.ZodNever, 签名正确类型<解析器类型描述Zod>> {
11
12
  constructor(类型表示: 解析器类型描述Zod, jwt实例: JWT___<z.infer<typeof 类型表示>>);
12
13
  }
13
14
  declare class JWT插件<解析器类型描述Zod extends z.AnyZodObject> {
package/dist/esm/jwt.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JWT插件
3
- } from "./chunk-ERC6C4HS.js";
3
+ } from "./chunk-TJU34POC.js";
4
4
  export {
5
5
  JWT\u63D2\u4EF6
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lsby/net-core-jwt",
3
- "version": "0.2.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "require": "./dist/cjs/index.cjs",
@@ -23,8 +23,8 @@
23
23
  "test:coverage": "npm run check:all && vitest run --coverage && open-cli ./coverage/index.html"
24
24
  },
25
25
  "dependencies": {
26
- "@lsby/ts-jwt": "^0.0.1",
27
- "@lsby/ts-log": "^0.3.0"
26
+ "@lsby/ts-jwt": "^0.0.2",
27
+ "@lsby/ts-log": "^0.3.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@ianvs/prettier-plugin-sort-imports": "^4.2.1",
@@ -40,7 +40,7 @@
40
40
  "vitest": "^2.0.2"
41
41
  },
42
42
  "peerDependencies": {
43
- "@lsby/net-core": "^0.11.0",
43
+ "@lsby/net-core": "^0.13.0",
44
44
  "@lsby/ts-fp-data": "^0.2.5",
45
45
  "zod": "3.24.2"
46
46
  },