@pubinfo-nightly/module-auth 2025.12.9 → 2025.12.26

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.
@@ -1,4 +1,4 @@
1
- import { RouteLocationRaw } from '../../../node_modules/.pnpm/vue-router@4.5.1_vue@3.5.17_typescript@5.8.3_/node_modules/vue-router';
1
+ import type { RouteLocationRaw } from 'vue-router';
2
2
  export type Recordable = Record<string, any>;
3
3
  export type Fn<T = any, K = any> = (params?: Recordable & T) => Promise<K> | K;
4
4
  export type FnApi<T = any> = (params: Recordable & T, baseURL: string) => Promise<any>;
@@ -1,11 +1,11 @@
1
- export declare const PageAuth: import('../../../../node_modules/.pnpm/vue@3.5.17_typescript@5.8.3/node_modules/vue').DefineComponent<import('../../../../node_modules/.pnpm/vue@3.5.17_typescript@5.8.3/node_modules/vue').ExtractPropTypes<{
1
+ export declare const PageAuth: import("vue").DefineComponent<globalThis.ExtractPropTypes<{
2
2
  type: StringConstructor;
3
3
  redirectTo: FunctionConstructor;
4
4
  authenticate: FunctionConstructor;
5
- }>, () => import('../../../../node_modules/.pnpm/vue@3.5.17_typescript@5.8.3/node_modules/vue').VNode<import('../../../../node_modules/.pnpm/vue@3.5.17_typescript@5.8.3/node_modules/vue').RendererNode, import('../../../../node_modules/.pnpm/vue@3.5.17_typescript@5.8.3/node_modules/vue').RendererElement, {
5
+ }>, () => globalThis.VNode<import("vue").RendererNode, import("vue").RendererElement, {
6
6
  [key: string]: any;
7
- }>, {}, {}, {}, import('../../../../node_modules/.pnpm/vue@3.5.17_typescript@5.8.3/node_modules/vue').ComponentOptionsMixin, import('../../../../node_modules/.pnpm/vue@3.5.17_typescript@5.8.3/node_modules/vue').ComponentOptionsMixin, {}, string, import('../../../../node_modules/.pnpm/vue@3.5.17_typescript@5.8.3/node_modules/vue').PublicProps, Readonly<import('../../../../node_modules/.pnpm/vue@3.5.17_typescript@5.8.3/node_modules/vue').ExtractPropTypes<{
7
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<globalThis.ExtractPropTypes<{
8
8
  type: StringConstructor;
9
9
  redirectTo: FunctionConstructor;
10
10
  authenticate: FunctionConstructor;
11
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import('../../../../node_modules/.pnpm/vue@3.5.17_typescript@5.8.3/node_modules/vue').ComponentProvideOptions, true, {}, any>;
11
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,4 +1,4 @@
1
- import { ProviderOptions, ProviderUserOptions } from '../interface';
1
+ import type { ProviderOptions, ProviderUserOptions } from '../interface';
2
2
  export interface FourAOptions extends ProviderUserOptions {
3
3
  /** `client_id` */
4
4
  clientId?: string;
@@ -1,21 +1,19 @@
1
- function i(e) {
2
- const { clientId: t, redirectUri: r } = e;
3
- return {
4
- id: "4A",
5
- name: "4A登录",
6
- type: "oauth",
7
- signIn: {
8
- url: "http://134.108.76.137:7001/index",
9
- params: {
10
- response_type: "code",
11
- client_id: t,
12
- redirect_uri: r
13
- }
14
- },
15
- authenticate: "/bs/loginBy4a",
16
- ...e
17
- };
1
+ function FourA(e) {
2
+ let { clientId: t, redirectUri: n } = e;
3
+ return {
4
+ id: "4A",
5
+ name: "4A登录",
6
+ type: "oauth",
7
+ signIn: {
8
+ url: "http://134.108.76.137:7001/index",
9
+ params: {
10
+ response_type: "code",
11
+ client_id: t,
12
+ redirect_uri: n
13
+ }
14
+ },
15
+ authenticate: "/bs/loginBy4a",
16
+ ...e
17
+ };
18
18
  }
19
- export {
20
- i as default
21
- };
19
+ export { FourA as default };
@@ -1,4 +1,4 @@
1
- import { ProviderOptions, ProviderUserOptions } from '../interface';
1
+ import type { ProviderOptions, ProviderUserOptions } from '../interface';
2
2
  export interface CredentialsOptions extends ProviderUserOptions {
3
3
  }
4
4
  /**
@@ -1,11 +1,9 @@
1
- function t(e) {
2
- return {
3
- id: "credentials",
4
- name: "凭证登录",
5
- type: "custom",
6
- ...e
7
- };
1
+ function Credentials(e) {
2
+ return {
3
+ id: "credentials",
4
+ name: "凭证登录",
5
+ type: "custom",
6
+ ...e
7
+ };
8
8
  }
9
- export {
10
- t as default
11
- };
9
+ export { Credentials as default };
@@ -1,4 +1,4 @@
1
- import { ProviderOptions, ProviderUserOptions } from '../interface';
1
+ import type { ProviderOptions, ProviderUserOptions } from '../interface';
2
2
  export interface DingZJOptions extends ProviderUserOptions {
3
3
  /**
4
4
  * 登录方式
@@ -1,49 +1,44 @@
1
- function g(e) {
2
- const { clientId: i, redirectUri: n } = e, a = {
3
- /** 跳转外部页面 */
4
- redirect: {
5
- url: "https://openplatform-pro.ding.zj.gov.cn/oauth2/auth.htm",
6
- params: {
7
- response_type: "code",
8
- client_id: i,
9
- redirect_uri: n,
10
- scope: "get_user_info",
11
- authType: "QRCODE"
12
- }
13
- },
14
- /** 内嵌二维码 */
15
- embed: {
16
- url: "https://login-pro.ding.zj.gov.cn/oauth2/auth.htm",
17
- params: {
18
- response_type: "code",
19
- client_id: i,
20
- redirect_uri: n,
21
- scope: "get_user_info",
22
- authType: "QRCODE",
23
- embedMode: "true"
24
- }
25
- }
26
- }, o = (c, t) => {
27
- if (!document.getElementById(t.id))
28
- throw new Error(`未找到id为${t.id}的DOM元素`);
29
- const r = document.createElement("iframe");
30
- r.src = c, r.width = "200", r.height = "200", document.appendChild(r), window.addEventListener("message", (s) => {
31
- if (t.redirectUri) {
32
- const d = new URL(t.redirectUri);
33
- d.search = new URLSearchParams(s.data).toString(), window.location.href = d.toString();
34
- }
35
- });
36
- };
37
- return {
38
- id: "ding-zj",
39
- name: "浙政钉登录",
40
- type: "oauth",
41
- signIn: a[e.mode],
42
- authenticate: "/bs/loginByDingZJ",
43
- initQRCode: e.mode === "embed" ? o : void 0,
44
- ...e
45
- };
1
+ function DingZJ(e) {
2
+ let { clientId: t, redirectUri: n } = e;
3
+ return {
4
+ id: "ding-zj",
5
+ name: "浙政钉登录",
6
+ type: "oauth",
7
+ signIn: {
8
+ redirect: {
9
+ url: "https://openplatform-pro.ding.zj.gov.cn/oauth2/auth.htm",
10
+ params: {
11
+ response_type: "code",
12
+ client_id: t,
13
+ redirect_uri: n,
14
+ scope: "get_user_info",
15
+ authType: "QRCODE"
16
+ }
17
+ },
18
+ embed: {
19
+ url: "https://login-pro.ding.zj.gov.cn/oauth2/auth.htm",
20
+ params: {
21
+ response_type: "code",
22
+ client_id: t,
23
+ redirect_uri: n,
24
+ scope: "get_user_info",
25
+ authType: "QRCODE",
26
+ embedMode: "true"
27
+ }
28
+ }
29
+ }[e.mode],
30
+ authenticate: "/bs/loginByDingZJ",
31
+ initQRCode: e.mode === "embed" ? (e, t) => {
32
+ if (!document.getElementById(t.id)) throw Error(`未找到id为${t.id}的DOM元素`);
33
+ let n = document.createElement("iframe");
34
+ n.src = e, n.width = "200", n.height = "200", document.appendChild(n), window.addEventListener("message", (e) => {
35
+ if (t.redirectUri) {
36
+ let n = new URL(t.redirectUri);
37
+ n.search = new URLSearchParams(e.data).toString(), window.location.href = n.toString();
38
+ }
39
+ });
40
+ } : void 0,
41
+ ...e
42
+ };
46
43
  }
47
- export {
48
- g as default
49
- };
44
+ export { DingZJ as default };
@@ -1,4 +1,4 @@
1
- import { ProviderOptions, ProviderUserOptions } from '../interface';
1
+ import type { ProviderOptions, ProviderUserOptions } from '@/interface';
2
2
  export interface SsoOptions extends ProviderUserOptions {
3
3
  /**
4
4
  * 登录类型,根据调用 `/app/oauth/generateCode` 接口时传递的 `grantType` 参数值判断:
@@ -1,23 +1,18 @@
1
- function o(t = {}) {
2
- const { loginType: e = "defaultOauth2" } = t;
3
- return {
4
- id: "sso",
5
- name: "SSO统一账号登录",
6
- type: "custom",
7
- authenticate: async (a, n) => await (await fetch(
8
- `${n}/auth/ssoLogin`,
9
- {
10
- headers: { "Content-Type": "application/json" },
11
- method: "POST",
12
- body: JSON.stringify({
13
- ...a,
14
- loginType: e
15
- })
16
- }
17
- )).json(),
18
- ...t
19
- };
1
+ function Sso(e = {}) {
2
+ let { loginType: t = "defaultOauth2" } = e;
3
+ return {
4
+ id: "sso",
5
+ name: "SSO统一账号登录",
6
+ type: "custom",
7
+ authenticate: async (e, n) => await (await fetch(`${n}/auth/ssoLogin`, {
8
+ headers: { "Content-Type": "application/json" },
9
+ method: "POST",
10
+ body: JSON.stringify({
11
+ ...e,
12
+ loginType: t
13
+ })
14
+ })).json(),
15
+ ...e
16
+ };
20
17
  }
21
- export {
22
- o as default
23
- };
18
+ export { Sso as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo-nightly/module-auth",
3
3
  "type": "module",
4
- "version": "2025.12.09",
4
+ "version": "2025.12.26",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -23,10 +23,10 @@
23
23
  "node": "^20.19.0 || >=22.12.0"
24
24
  },
25
25
  "peerDependencies": {
26
- "pubinfo-nightly": "2025.12.09"
26
+ "pubinfo-nightly": "2025.12.26"
27
27
  },
28
28
  "devDependencies": {
29
- "pubinfo-nightly": "2025.12.09"
29
+ "pubinfo-nightly": "2025.12.26"
30
30
  },
31
31
  "scripts": {
32
32
  "dev": "pubinfo build --watch",