@nocobase/plugin-verification 0.9.1-alpha.2 → 0.9.2-alpha.1

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.
@@ -4,41 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _ = require(".");
9
-
10
8
  function tencentcloud() {
11
9
  const data = _interopRequireWildcard(require("tencentcloud-sdk-nodejs"));
12
-
13
10
  tencentcloud = function tencentcloud() {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
-
22
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
24
17
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
25
-
26
18
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
27
-
28
19
  // 导入对应产品模块的client models。
29
20
  const smsClient = tencentcloud().sms.v20210111.Client;
30
-
31
21
  class _default extends _.Provider {
32
22
  constructor(plugin, options) {
33
23
  super(plugin, options);
34
24
  this.client = void 0;
35
25
  const _this$options = this.options,
36
- secretId = _this$options.secretId,
37
- secretKey = _this$options.secretKey,
38
- region = _this$options.region,
39
- endpoint = _this$options.endpoint;
26
+ secretId = _this$options.secretId,
27
+ secretKey = _this$options.secretKey,
28
+ region = _this$options.region,
29
+ endpoint = _this$options.endpoint;
40
30
  /* 实例化要请求产品(以sms为例)的client对象 */
41
-
42
31
  this.client = new smsClient({
43
32
  credential: {
44
33
  secretId,
@@ -52,15 +41,13 @@ class _default extends _.Provider {
52
41
  }
53
42
  });
54
43
  }
55
-
56
44
  send(phoneNumbers, data) {
57
45
  var _this = this;
58
-
59
46
  return _asyncToGenerator(function* () {
60
47
  const _this$options2 = _this.options,
61
- SignName = _this$options2.SignName,
62
- TemplateId = _this$options2.TemplateId,
63
- SmsSdkAppId = _this$options2.SmsSdkAppId;
48
+ SignName = _this$options2.SignName,
49
+ TemplateId = _this$options2.TemplateId,
50
+ SmsSdkAppId = _this$options2.SmsSdkAppId;
64
51
  const result = yield _this.client.SendSms({
65
52
  PhoneNumberSet: [phoneNumbers],
66
53
  SignName,
@@ -70,25 +57,19 @@ class _default extends _.Provider {
70
57
  });
71
58
  const errCode = result.SendStatusSet[0].Code;
72
59
  const error = new Error(`${errCode}:${result.SendStatusSet[0].Message}`);
73
-
74
60
  switch (errCode) {
75
61
  case 'Ok':
76
62
  return result.RequestId;
77
-
78
63
  case 'InvalidParameterValue.IncorrectPhoneNumber':
79
64
  error.name = 'InvalidReceiver';
80
-
81
65
  case 'LimitExceeded.DeliveryFrequencyLimit':
82
66
  case 'LimitExceeded.PhoneNumberDailyLimit':
83
67
  case 'LimitExceeded.PhoneNumberThirtySecondLimit':
84
68
  case 'LimitExceeded.PhoneNumberOneHourLimit':
85
69
  error.name = 'RateLimit';
86
70
  }
87
-
88
71
  throw error;
89
72
  })();
90
73
  }
91
-
92
74
  }
93
-
94
75
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-verification",
3
- "version": "0.9.1-alpha.2",
3
+ "version": "0.9.2-alpha.1",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "./lib/index.js",
@@ -9,14 +9,14 @@
9
9
  "@alicloud/dysmsapi20170525": "2.0.17",
10
10
  "@alicloud/openapi-client": "0.4.1",
11
11
  "@alicloud/tea-util": "1.4.4",
12
- "@nocobase/actions": "0.9.1-alpha.2",
13
- "@nocobase/resourcer": "0.9.1-alpha.2",
14
- "@nocobase/server": "0.9.1-alpha.2",
15
- "@nocobase/utils": "0.9.1-alpha.2",
12
+ "@nocobase/actions": "0.9.2-alpha.1",
13
+ "@nocobase/resourcer": "0.9.2-alpha.1",
14
+ "@nocobase/server": "0.9.2-alpha.1",
15
+ "@nocobase/utils": "0.9.2-alpha.1",
16
16
  "tencentcloud-sdk-nodejs": "^4.0.525"
17
17
  },
18
18
  "devDependencies": {
19
- "@nocobase/test": "0.9.1-alpha.2"
19
+ "@nocobase/test": "0.9.2-alpha.1"
20
20
  },
21
- "gitHead": "d588a68eca4feed4642a4cb317301011266fe5c9"
21
+ "gitHead": "a4f103eb0144f07205aff7b2a6be8ea6aa1330df"
22
22
  }
@@ -0,0 +1,20 @@
1
+ export default {
2
+ 'Verification': 'Verificação',
3
+ 'Verification providers': 'Provedores de verificação',
4
+ 'Provider type': 'Tipo de provedor',
5
+
6
+ // aliyun sms
7
+ 'Aliyun SMS': 'Serviço de Mensagem de Texto Aliyun',
8
+ 'Access Key ID': 'ID da chave de acesso',
9
+ 'Access Key Secret': 'Chave secreta de acesso',
10
+ 'Endpoint': 'Ponto de extremidade',
11
+ 'Sign': 'Assinatura',
12
+ 'Template code': 'Código do modelo',
13
+
14
+ 'Secret Id': 'ID secreto',
15
+ 'Secret Key': 'Chave secreta',
16
+ 'Region': 'Região',
17
+ 'Sign name': 'Conteúdo de assinatura de SMS',
18
+ 'Sms sdk app id': 'ID do aplicativo de SMS',
19
+ 'Template Id': 'ID do modelo de SMS'
20
+ };
@@ -1,38 +1,38 @@
1
1
  export default {
2
- namespace: 'verification',
2
+ namespace: 'verification.verificationData',
3
3
  duplicator: 'optional',
4
4
  name: 'verifications',
5
5
  fields: [
6
6
  {
7
7
  type: 'uuid',
8
8
  name: 'id',
9
- primaryKey: true
9
+ primaryKey: true,
10
10
  },
11
11
  {
12
12
  type: 'string',
13
- name: 'type'
13
+ name: 'type',
14
14
  },
15
15
  {
16
16
  type: 'string',
17
- name: 'receiver'
17
+ name: 'receiver',
18
18
  },
19
19
  {
20
20
  type: 'integer',
21
21
  name: 'status',
22
- defaultValue: 0
22
+ defaultValue: 0,
23
23
  },
24
24
  {
25
25
  type: 'date',
26
- name: 'expiresAt'
26
+ name: 'expiresAt',
27
27
  },
28
28
  {
29
29
  type: 'string',
30
- name: 'content'
30
+ name: 'content',
31
31
  },
32
32
  {
33
33
  type: 'belongsTo',
34
34
  name: 'provider',
35
35
  target: 'verifications_providers',
36
- }
37
- ]
36
+ },
37
+ ],
38
38
  };
@@ -1,12 +1,12 @@
1
1
  export default {
2
- namespace: 'verification',
2
+ namespace: 'verification.verificationProviders',
3
3
  duplicator: 'optional',
4
4
  name: 'verifications_providers',
5
5
  fields: [
6
6
  {
7
7
  type: 'string',
8
8
  name: 'id',
9
- primaryKey: true
9
+ primaryKey: true,
10
10
  },
11
11
  {
12
12
  type: 'string',
@@ -14,15 +14,15 @@ export default {
14
14
  },
15
15
  {
16
16
  type: 'string',
17
- name: 'type'
17
+ name: 'type',
18
18
  },
19
19
  {
20
20
  type: 'jsonb',
21
- name: 'options'
21
+ name: 'options',
22
22
  },
23
23
  {
24
24
  type: 'radio',
25
- name: 'default'
26
- }
27
- ]
25
+ name: 'default',
26
+ },
27
+ ],
28
28
  };