@nocobase/plugin-verification 0.13.0-alpha.4 → 0.13.0-alpha.6
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/dist/client/index.js +1 -519
- package/dist/index.js +37 -16
- package/dist/locale/pt-BR.js +22 -4
- package/dist/locale/zh-CN.js +22 -4
- package/dist/node_modules/@alicloud/dysmsapi20170525/dist/client.js +2 -2
- package/dist/node_modules/@alicloud/dysmsapi20170525/package.json +1 -1
- package/dist/node_modules/@alicloud/openapi-client/dist/client.js +1 -1
- package/dist/node_modules/@alicloud/openapi-client/package.json +1 -1
- package/dist/node_modules/@alicloud/tea-util/dist/client.js +1 -1
- package/dist/node_modules/@alicloud/tea-util/package.json +1 -1
- package/dist/node_modules/tencentcloud-sdk-nodejs/package.json +1 -1
- package/dist/node_modules/tencentcloud-sdk-nodejs/tencentcloud/index.js +4 -4
- package/dist/server/Plugin.js +53 -32
- package/dist/server/actions/index.js +33 -26
- package/dist/server/actions/verifications.js +55 -29
- package/dist/server/collections/verifications.js +22 -4
- package/dist/server/collections/verifications_providers.js +22 -4
- package/dist/server/constants.js +32 -7
- package/dist/server/index.js +46 -32
- package/dist/server/locale/index.js +36 -13
- package/dist/server/locale/zh-CN.js +22 -4
- package/dist/server/providers/index.js +42 -17
- package/dist/server/providers/sms-aliyun.js +40 -36
- package/dist/server/providers/sms-tencent.js +35 -28
- package/dist/swagger/index.json +117 -0
- package/package.json +2 -2
- package/dist/swagger/index.js +0 -131
package/dist/server/Plugin.js
CHANGED
|
@@ -1,24 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var Plugin_exports = {};
|
|
29
|
+
__export(Plugin_exports, {
|
|
30
|
+
default: () => VerificationPlugin
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(Plugin_exports);
|
|
33
|
+
var import_path = __toESM(require("path"));
|
|
34
|
+
var import_database = require("@nocobase/database");
|
|
35
|
+
var import_server = require("@nocobase/server");
|
|
36
|
+
var import_utils = require("@nocobase/utils");
|
|
37
|
+
var import__ = require(".");
|
|
38
|
+
var import_actions2 = __toESM(require("./actions"));
|
|
39
|
+
var import_constants = require("./constants");
|
|
40
|
+
var import_locale = require("./locale");
|
|
41
|
+
var import_providers = __toESM(require("./providers"));
|
|
42
|
+
class VerificationPlugin extends import_server.Plugin {
|
|
43
|
+
providers = new import_utils.Registry();
|
|
44
|
+
interceptors = new import_utils.Registry();
|
|
22
45
|
intercept = async (context, next) => {
|
|
23
46
|
const { resourceName, actionName, values } = context.action.params;
|
|
24
47
|
const key = `${resourceName}:${actionName}`;
|
|
@@ -38,22 +61,22 @@ class VerificationPlugin extends server.Plugin {
|
|
|
38
61
|
type: key,
|
|
39
62
|
content,
|
|
40
63
|
expiresAt: {
|
|
41
|
-
[
|
|
64
|
+
[import_database.Op.gt]: /* @__PURE__ */ new Date()
|
|
42
65
|
},
|
|
43
|
-
status:
|
|
66
|
+
status: import_constants.CODE_STATUS_UNUSED
|
|
44
67
|
}
|
|
45
68
|
});
|
|
46
69
|
if (!item) {
|
|
47
70
|
return context.throw(400, {
|
|
48
71
|
code: "InvalidVerificationCode",
|
|
49
|
-
message: context.t("Verification code is invalid", { ns:
|
|
72
|
+
message: context.t("Verification code is invalid", { ns: import__.namespace })
|
|
50
73
|
});
|
|
51
74
|
}
|
|
52
75
|
try {
|
|
53
76
|
await next();
|
|
54
77
|
} finally {
|
|
55
78
|
await item.update({
|
|
56
|
-
status:
|
|
79
|
+
status: import_constants.CODE_STATUS_USED
|
|
57
80
|
});
|
|
58
81
|
}
|
|
59
82
|
};
|
|
@@ -77,7 +100,7 @@ class VerificationPlugin extends server.Plugin {
|
|
|
77
100
|
await ProviderRepo.create({
|
|
78
101
|
values: {
|
|
79
102
|
id: DEFAULT_SMS_VERIFY_CODE_PROVIDER,
|
|
80
|
-
type:
|
|
103
|
+
type: import_constants.PROVIDER_TYPE_SMS_ALIYUN,
|
|
81
104
|
title: "Default SMS sender",
|
|
82
105
|
options: {
|
|
83
106
|
accessKeyId: INIT_ALI_SMS_ACCESS_KEY,
|
|
@@ -93,10 +116,10 @@ class VerificationPlugin extends server.Plugin {
|
|
|
93
116
|
}
|
|
94
117
|
async load() {
|
|
95
118
|
const { app, db, options } = this;
|
|
96
|
-
app.i18n.addResources("zh-CN",
|
|
97
|
-
await this.importCollections(
|
|
98
|
-
|
|
99
|
-
|
|
119
|
+
app.i18n.addResources("zh-CN", import__.namespace, import_locale.zhCN);
|
|
120
|
+
await this.importCollections(import_path.default.resolve(__dirname, "collections"));
|
|
121
|
+
(0, import_providers.default)(this);
|
|
122
|
+
(0, import_actions2.default)(this);
|
|
100
123
|
app.resourcer.use(async (context, next) => {
|
|
101
124
|
const { resourceName, actionName, values } = context.action.params;
|
|
102
125
|
const key = `${resourceName}:${actionName}`;
|
|
@@ -121,5 +144,3 @@ class VerificationPlugin extends server.Plugin {
|
|
|
121
144
|
});
|
|
122
145
|
}
|
|
123
146
|
}
|
|
124
|
-
|
|
125
|
-
module.exports = VerificationPlugin;
|
|
@@ -1,27 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
16
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var actions_exports = {};
|
|
29
|
+
__export(actions_exports, {
|
|
30
|
+
default: () => actions_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(actions_exports);
|
|
33
|
+
var verifications = __toESM(require("./verifications"));
|
|
25
34
|
function make(name, mod) {
|
|
26
35
|
return Object.keys(mod).reduce(
|
|
27
36
|
(result, key) => ({
|
|
@@ -33,8 +42,6 @@ function make(name, mod) {
|
|
|
33
42
|
}
|
|
34
43
|
function actions_default({ app }) {
|
|
35
44
|
app.actions({
|
|
36
|
-
...make("verifications",
|
|
45
|
+
...make("verifications", verifications)
|
|
37
46
|
});
|
|
38
47
|
}
|
|
39
|
-
|
|
40
|
-
module.exports = actions_default;
|
|
@@ -1,19 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var verifications_exports = {};
|
|
29
|
+
__export(verifications_exports, {
|
|
30
|
+
create: () => create
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(verifications_exports);
|
|
33
|
+
var import_actions = __toESM(require("@nocobase/actions"));
|
|
34
|
+
var import_database = require("@nocobase/database");
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
var import_crypto = require("crypto");
|
|
37
|
+
var import_util = require("util");
|
|
38
|
+
var import__ = require("..");
|
|
39
|
+
var import_constants = require("../constants");
|
|
40
|
+
const asyncRandomInt = (0, import_util.promisify)(import_crypto.randomInt);
|
|
17
41
|
async function create(context, next) {
|
|
18
42
|
const plugin = context.app.getPlugin("verification");
|
|
19
43
|
const { values } = context.action.params;
|
|
@@ -30,7 +54,7 @@ async function create(context, next) {
|
|
|
30
54
|
if (!receiver) {
|
|
31
55
|
return context.throw(400, {
|
|
32
56
|
code: "InvalidReceiver",
|
|
33
|
-
message: context.t("Not a valid cellphone number, please re-enter", { ns:
|
|
57
|
+
message: context.t("Not a valid cellphone number, please re-enter", { ns: import__.namespace })
|
|
34
58
|
});
|
|
35
59
|
}
|
|
36
60
|
const VerificationModel = context.db.getModel("verifications");
|
|
@@ -38,17 +62,17 @@ async function create(context, next) {
|
|
|
38
62
|
where: {
|
|
39
63
|
type: values.type,
|
|
40
64
|
receiver,
|
|
41
|
-
status:
|
|
65
|
+
status: import_constants.CODE_STATUS_UNUSED,
|
|
42
66
|
expiresAt: {
|
|
43
|
-
[
|
|
67
|
+
[import_database.Op.gt]: /* @__PURE__ */ new Date()
|
|
44
68
|
}
|
|
45
69
|
}
|
|
46
70
|
});
|
|
47
71
|
if (record) {
|
|
48
|
-
const seconds =
|
|
72
|
+
const seconds = (0, import_dayjs.default)(record.get("expiresAt")).diff((0, import_dayjs.default)(), "seconds");
|
|
49
73
|
return context.throw(429, {
|
|
50
74
|
code: "RateLimit",
|
|
51
|
-
message: context.t("Please don't retry in {{time}} seconds", { time: seconds, ns:
|
|
75
|
+
message: context.t("Please don't retry in {{time}} seconds", { time: seconds, ns: import__.namespace })
|
|
52
76
|
});
|
|
53
77
|
}
|
|
54
78
|
const code = (await asyncRandomInt(999999)).toString(10).padStart(6, "0");
|
|
@@ -69,25 +93,25 @@ async function create(context, next) {
|
|
|
69
93
|
case "InvalidReceiver":
|
|
70
94
|
return context.throw(400, {
|
|
71
95
|
code: "InvalidReceiver",
|
|
72
|
-
message: context.t("Not a valid cellphone number, please re-enter", { ns:
|
|
96
|
+
message: context.t("Not a valid cellphone number, please re-enter", { ns: import__.namespace })
|
|
73
97
|
});
|
|
74
98
|
case "RateLimit":
|
|
75
|
-
return context.throw(429, context.t("You are trying so frequently, please slow down", { ns:
|
|
99
|
+
return context.throw(429, context.t("You are trying so frequently, please slow down", { ns: import__.namespace }));
|
|
76
100
|
default:
|
|
77
101
|
console.error(error);
|
|
78
102
|
return context.throw(
|
|
79
103
|
500,
|
|
80
|
-
context.t("Verification send failed, please try later or contact to administrator", { ns:
|
|
104
|
+
context.t("Verification send failed, please try later or contact to administrator", { ns: import__.namespace })
|
|
81
105
|
);
|
|
82
106
|
}
|
|
83
107
|
}
|
|
84
108
|
const data = {
|
|
85
|
-
id:
|
|
109
|
+
id: (0, import_crypto.randomUUID)(),
|
|
86
110
|
type: values.type,
|
|
87
111
|
receiver,
|
|
88
112
|
content: code,
|
|
89
113
|
expiresAt: Date.now() + (interceptor.expiresIn ?? 60) * 1e3,
|
|
90
|
-
status:
|
|
114
|
+
status: import_constants.CODE_STATUS_UNUSED,
|
|
91
115
|
providerId: providerItem.get("id")
|
|
92
116
|
};
|
|
93
117
|
context.action.mergeParams(
|
|
@@ -98,7 +122,7 @@ async function create(context, next) {
|
|
|
98
122
|
values: "overwrite"
|
|
99
123
|
}
|
|
100
124
|
);
|
|
101
|
-
await
|
|
125
|
+
await import_actions.default.create(context, async () => {
|
|
102
126
|
const { body: result } = context;
|
|
103
127
|
context.body = {
|
|
104
128
|
id: result.id,
|
|
@@ -107,5 +131,7 @@ async function create(context, next) {
|
|
|
107
131
|
return next();
|
|
108
132
|
});
|
|
109
133
|
}
|
|
110
|
-
|
|
111
|
-
exports
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
create
|
|
137
|
+
});
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var verifications_exports = {};
|
|
19
|
+
__export(verifications_exports, {
|
|
20
|
+
default: () => verifications_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(verifications_exports);
|
|
3
23
|
var verifications_default = {
|
|
4
24
|
namespace: "verification.verificationData",
|
|
5
25
|
duplicator: "optional",
|
|
@@ -38,5 +58,3 @@ var verifications_default = {
|
|
|
38
58
|
}
|
|
39
59
|
]
|
|
40
60
|
};
|
|
41
|
-
|
|
42
|
-
module.exports = verifications_default;
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var verifications_providers_exports = {};
|
|
19
|
+
__export(verifications_providers_exports, {
|
|
20
|
+
default: () => verifications_providers_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(verifications_providers_exports);
|
|
3
23
|
var verifications_providers_default = {
|
|
4
24
|
namespace: "verification.verificationProviders",
|
|
5
25
|
duplicator: "optional",
|
|
@@ -28,5 +48,3 @@ var verifications_providers_default = {
|
|
|
28
48
|
}
|
|
29
49
|
]
|
|
30
50
|
};
|
|
31
|
-
|
|
32
|
-
module.exports = verifications_providers_default;
|
package/dist/server/constants.js
CHANGED
|
@@ -1,11 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var constants_exports = {};
|
|
19
|
+
__export(constants_exports, {
|
|
20
|
+
CODE_STATUS_UNUSED: () => CODE_STATUS_UNUSED,
|
|
21
|
+
CODE_STATUS_USED: () => CODE_STATUS_USED,
|
|
22
|
+
PROVIDER_TYPE_SMS_ALIYUN: () => PROVIDER_TYPE_SMS_ALIYUN,
|
|
23
|
+
PROVIDER_TYPE_SMS_TENCENT: () => PROVIDER_TYPE_SMS_TENCENT
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(constants_exports);
|
|
3
26
|
const PROVIDER_TYPE_SMS_ALIYUN = "sms-aliyun";
|
|
4
27
|
const PROVIDER_TYPE_SMS_TENCENT = "sms-tencent";
|
|
5
28
|
const CODE_STATUS_UNUSED = 0;
|
|
6
29
|
const CODE_STATUS_USED = 1;
|
|
7
|
-
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
CODE_STATUS_UNUSED,
|
|
33
|
+
CODE_STATUS_USED,
|
|
34
|
+
PROVIDER_TYPE_SMS_ALIYUN,
|
|
35
|
+
PROVIDER_TYPE_SMS_TENCENT
|
|
36
|
+
});
|
package/dist/server/index.js
CHANGED
|
@@ -1,34 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name2 in all)
|
|
9
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var server_exports = {};
|
|
30
|
+
__export(server_exports, {
|
|
31
|
+
Interceptor: () => import_Plugin.Interceptor,
|
|
32
|
+
Provider: () => import_providers.Provider,
|
|
33
|
+
default: () => import_Plugin.default,
|
|
34
|
+
namespace: () => namespace
|
|
19
35
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
get: function () { return constants[k]; }
|
|
33
|
-
});
|
|
36
|
+
module.exports = __toCommonJS(server_exports);
|
|
37
|
+
var import_package = require("../../package.json");
|
|
38
|
+
__reExport(server_exports, require("./constants"), module.exports);
|
|
39
|
+
var import_providers = require("./providers");
|
|
40
|
+
var import_Plugin = __toESM(require("./Plugin"));
|
|
41
|
+
const namespace = import_package.name;
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
Interceptor,
|
|
45
|
+
Provider,
|
|
46
|
+
namespace,
|
|
47
|
+
...require("./constants")
|
|
34
48
|
});
|
|
@@ -1,14 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var locale_exports = {};
|
|
29
|
+
__export(locale_exports, {
|
|
30
|
+
zhCN: () => import_zh_CN.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(locale_exports);
|
|
33
|
+
var import_zh_CN = __toESM(require("./zh-CN"));
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
zhCN
|
|
14
37
|
});
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var zh_CN_exports = {};
|
|
19
|
+
__export(zh_CN_exports, {
|
|
20
|
+
default: () => zh_CN_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(zh_CN_exports);
|
|
3
23
|
var zh_CN_default = {
|
|
4
24
|
"Verification send failed, please try later or contact to administrator": "\u9A8C\u8BC1\u7801\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u6216\u8054\u7CFB\u7BA1\u7406\u5458",
|
|
5
25
|
"Not a valid cellphone number, please re-enter": "\u4E0D\u662F\u6709\u6548\u7684\u624B\u673A\u53F7\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165",
|
|
@@ -7,5 +27,3 @@ var zh_CN_default = {
|
|
|
7
27
|
"You are trying so frequently, please slow down": "\u60A8\u7684\u64CD\u4F5C\u592A\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
|
|
8
28
|
"Verification code is invalid": "\u65E0\u6548\u7684\u9A8C\u8BC1\u7801"
|
|
9
29
|
};
|
|
10
|
-
|
|
11
|
-
module.exports = zh_CN_default;
|