@nocobase/plugin-verification 1.7.0-beta.8 → 1.7.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.
Files changed (82) hide show
  1. package/dist/client/83b24f85ae99a175.js +10 -0
  2. package/dist/client/937c9eccebc38607.js +10 -0
  3. package/dist/client/{providerTypes/index.d.ts → VerificationMenu.d.ts} +5 -4
  4. package/dist/client/index.d.ts +7 -0
  5. package/dist/client/index.js +1 -1
  6. package/dist/client/locale/index.d.ts +1 -1
  7. package/dist/client/otp-verification/VerificationCode.d.ts +16 -0
  8. package/dist/client/otp-verification/sms/AdminSettingsForm.d.ts +12 -0
  9. package/dist/client/otp-verification/sms/BindForm.d.ts +11 -0
  10. package/dist/client/otp-verification/sms/VerificationForm.d.ts +11 -0
  11. package/dist/client/otp-verification/sms/index.d.ts +26 -0
  12. package/dist/client/otp-verification/sms/provider-manager.d.ts +19 -0
  13. package/dist/client/{VerificationProviders.d.ts → otp-verification/sms/providers/AliyunSettings.d.ts} +1 -1
  14. package/dist/{server/actions/index.d.ts → client/otp-verification/sms/providers/TencentSettings.d.ts} +2 -3
  15. package/dist/client/schemas/verifiers.d.ts +66 -0
  16. package/dist/client/verification-manager/index.d.ts +32 -0
  17. package/dist/client/{ProviderOptions.d.ts → verifiers/VerifierSelect.d.ts} +1 -2
  18. package/dist/client/verifiers/Verifiers.d.ts +12 -0
  19. package/dist/client/verifiers/verification-types.d.ts +24 -0
  20. package/dist/collections/verificators.d.ts +50 -0
  21. package/dist/collections/verificators.js +70 -0
  22. package/dist/collections/verifiers.d.ts +50 -0
  23. package/dist/collections/verifiers.js +70 -0
  24. package/dist/constants.d.ts +11 -0
  25. package/dist/constants.js +42 -0
  26. package/dist/externalVersion.js +14 -13
  27. package/dist/locale/en-US.json +18 -1
  28. package/dist/locale/zh-CN.json +20 -2
  29. package/dist/node_modules/@alicloud/dysmsapi20170525/dist/client.js +2 -2
  30. package/dist/node_modules/@alicloud/dysmsapi20170525/package.json +1 -1
  31. package/dist/node_modules/@alicloud/openapi-client/dist/client.js +2 -2
  32. package/dist/node_modules/@alicloud/openapi-client/package.json +1 -1
  33. package/dist/node_modules/@alicloud/tea-util/dist/client.js +1 -1
  34. package/dist/node_modules/@alicloud/tea-util/package.json +1 -1
  35. package/dist/node_modules/tencentcloud-sdk-nodejs/package.json +1 -1
  36. package/dist/node_modules/tencentcloud-sdk-nodejs/tencentcloud/index.js +2 -2
  37. package/dist/server/Plugin.d.ts +8 -16
  38. package/dist/server/Plugin.js +68 -71
  39. package/dist/server/actions/verifiers.d.ts +18 -0
  40. package/dist/server/actions/verifiers.js +175 -0
  41. package/dist/server/{actions/verifications.d.ts → collections/otp-records.d.ts} +2 -2
  42. package/dist/server/collections/otp-records.js +75 -0
  43. package/dist/server/collections/users-verificators.d.ts +10 -0
  44. package/dist/server/collections/users-verificators.js +58 -0
  45. package/dist/server/collections/users-verifiers.d.ts +14 -0
  46. package/dist/server/collections/users-verifiers.js +58 -0
  47. package/dist/server/collections/verificators.d.ts +10 -0
  48. package/dist/server/{actions/index.js → collections/verificators.js} +10 -19
  49. package/dist/server/collections/verifiers.d.ts +10 -0
  50. package/dist/server/{providers/index.js → collections/verifiers.js} +10 -15
  51. package/dist/server/constants.d.ts +0 -2
  52. package/dist/server/constants.js +2 -8
  53. package/dist/server/index.d.ts +5 -2
  54. package/dist/server/index.js +12 -5
  55. package/dist/server/migrations/20250111192640-providers2verificators.d.ts +14 -0
  56. package/dist/server/migrations/20250111192640-providers2verificators.js +97 -0
  57. package/dist/server/migrations/20250507220644-fix-verifier-typo.d.ts +14 -0
  58. package/dist/server/migrations/20250507220644-fix-verifier-typo.js +86 -0
  59. package/dist/server/otp-verification/index.d.ts +26 -0
  60. package/dist/server/otp-verification/index.js +152 -0
  61. package/dist/server/otp-verification/sms/index.d.ts +37 -0
  62. package/dist/server/otp-verification/sms/index.js +87 -0
  63. package/dist/server/{providers/Provider.d.ts → otp-verification/sms/providers/index.d.ts} +2 -4
  64. package/dist/server/{providers/Provider.js → otp-verification/sms/providers/index.js} +8 -10
  65. package/dist/server/{providers → otp-verification/sms/providers}/sms-aliyun.d.ts +3 -3
  66. package/dist/server/{providers → otp-verification/sms/providers}/sms-aliyun.js +4 -4
  67. package/dist/server/{providers → otp-verification/sms/providers}/sms-tencent.d.ts +3 -3
  68. package/dist/server/{providers → otp-verification/sms/providers}/sms-tencent.js +4 -4
  69. package/dist/server/otp-verification/sms/resource/sms-otp-providers.d.ts +16 -0
  70. package/dist/server/otp-verification/sms/resource/sms-otp-providers.js +41 -0
  71. package/dist/server/otp-verification/sms/resource/sms-otp.d.ts +18 -0
  72. package/dist/server/otp-verification/sms/resource/sms-otp.js +141 -0
  73. package/dist/server/verification-manager.d.ts +68 -0
  74. package/dist/server/verification-manager.js +223 -0
  75. package/dist/server/verification.d.ts +70 -0
  76. package/dist/server/verification.js +70 -0
  77. package/package.json +8 -6
  78. package/dist/client/7551e1f2e04bca2f.js +0 -10
  79. package/dist/client/providerTypes/sms-aliyun.d.ts +0 -66
  80. package/dist/client/providerTypes/sms-tencent.d.ts +0 -66
  81. package/dist/server/actions/verifications.js +0 -146
  82. package/dist/server/providers/index.d.ts +0 -15
@@ -6,23 +6,15 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { Context } from '@nocobase/actions';
10
- import { HandlerType } from '@nocobase/resourcer';
11
9
  import { Plugin } from '@nocobase/server';
12
- import { Registry } from '@nocobase/utils';
13
- import { Provider } from '.';
14
- export interface Interceptor {
15
- manual?: boolean;
16
- expiresIn?: number;
17
- getReceiver(ctx: any): string;
18
- getCode?(ctx: any): string;
19
- validate?(ctx: Context, receiver: string): boolean | Promise<boolean>;
20
- }
10
+ import { VerificationManager } from './verification-manager';
11
+ import { SMSOTPProviderManager } from './otp-verification/sms';
12
+ import { Counter } from '@nocobase/cache';
21
13
  export default class PluginVerficationServer extends Plugin {
22
- providers: Registry<typeof Provider>;
23
- interceptors: Registry<Interceptor>;
24
- intercept: HandlerType;
25
- install(): Promise<void>;
14
+ verificationManager: VerificationManager;
15
+ smsOTPProviderManager: SMSOTPProviderManager;
16
+ smsOTPCounter: Counter;
17
+ afterAdd(): Promise<void>;
26
18
  load(): Promise<void>;
27
- getDefault(): Promise<any>;
19
+ install(): Promise<void>;
28
20
  }
@@ -39,55 +39,81 @@ __export(Plugin_exports, {
39
39
  default: () => PluginVerficationServer
40
40
  });
41
41
  module.exports = __toCommonJS(Plugin_exports);
42
- var import_path = __toESM(require("path"));
43
- var import_database = require("@nocobase/database");
44
42
  var import_server = require("@nocobase/server");
45
43
  var import_utils = require("@nocobase/utils");
46
44
  var import__ = require(".");
47
- var import_actions2 = __toESM(require("./actions"));
48
- var import_constants = require("./constants");
49
- var import_providers = __toESM(require("./providers"));
45
+ var import_constants = require("../constants");
46
+ var import_verification_manager = require("./verification-manager");
47
+ var import_sms = require("./otp-verification/sms");
48
+ var import_constants2 = require("../constants");
49
+ var import_verifiers = __toESM(require("./actions/verifiers"));
50
+ var import_sms_aliyun = __toESM(require("./otp-verification/sms/providers/sms-aliyun"));
51
+ var import_sms_tencent = __toESM(require("./otp-verification/sms/providers/sms-tencent"));
52
+ var import_sms_otp_providers = __toESM(require("./otp-verification/sms/resource/sms-otp-providers"));
53
+ var import_sms_otp = __toESM(require("./otp-verification/sms/resource/sms-otp"));
50
54
  class PluginVerficationServer extends import_server.Plugin {
51
- providers = new import_utils.Registry();
52
- interceptors = new import_utils.Registry();
53
- intercept = async (context, next) => {
54
- const { resourceName, actionName, values } = context.action.params;
55
- const key = `${resourceName}:${actionName}`;
56
- const interceptor = this.interceptors.get(key);
57
- if (!interceptor) {
58
- return context.throw(400);
59
- }
60
- const receiver = interceptor.getReceiver(context);
61
- const content = interceptor.getCode ? interceptor.getCode(context) : values.code;
62
- if (!receiver || !content) {
63
- return context.throw(400);
64
- }
65
- const VerificationRepo = this.db.getRepository("verifications");
66
- const item = await VerificationRepo.findOne({
67
- filter: {
68
- receiver,
69
- type: key,
70
- content,
71
- expiresAt: {
72
- [import_database.Op.gt]: /* @__PURE__ */ new Date()
55
+ verificationManager = new import_verification_manager.VerificationManager({ db: this.db });
56
+ smsOTPProviderManager = new import_sms.SMSOTPProviderManager();
57
+ smsOTPCounter;
58
+ async afterAdd() {
59
+ this.app.on("afterLoad", async () => {
60
+ this.smsOTPCounter = await this.app.cacheManager.createCounter(
61
+ {
62
+ name: "smsOTPCounter",
63
+ prefix: "sms-otp:attempts"
73
64
  },
74
- status: import_constants.CODE_STATUS_UNUSED
65
+ this.app.lockManager
66
+ );
67
+ });
68
+ }
69
+ async load() {
70
+ this.app.dataSourceManager.use(this.verificationManager.middleware());
71
+ this.app.resourceManager.define(import_sms_otp_providers.default);
72
+ this.app.resourceManager.define(import_sms_otp.default);
73
+ Object.entries(import_verifiers.default).forEach(
74
+ ([action, handler]) => this.app.resourceManager.registerActionHandler(`verifiers:${action}`, handler)
75
+ );
76
+ this.app.acl.allow("verifiers", "listByUser", "loggedIn");
77
+ this.app.acl.allow("verifiers", "listForVerify", "loggedIn");
78
+ this.app.acl.allow("verifiers", "bind", "loggedIn");
79
+ this.app.acl.allow("verifiers", "unbind", "loggedIn");
80
+ this.app.acl.allow("smsOTP", "create", "loggedIn");
81
+ this.app.acl.allow("smsOTP", "publicCreate");
82
+ this.app.acl.registerSnippet({
83
+ name: `pm.${this.name}.verifiers`,
84
+ actions: ["verifiers:*", "smsOTPProviders:*"]
85
+ });
86
+ this.verificationManager.registerVerificationType(import_constants2.SMS_OTP_VERIFICATION_TYPE, {
87
+ title: (0, import_utils.tval)("SMS OTP", { ns: import__.namespace }),
88
+ description: (0, import_utils.tval)("Get one-time codes sent to your phone via SMS to complete authentication requests.", {
89
+ ns: import__.namespace
90
+ }),
91
+ bindingRequired: true,
92
+ verification: import_sms.SMSOTPVerification
93
+ });
94
+ this.verificationManager.addSceneRule(
95
+ (scene, verificationType) => ["auth-sms", "unbind-verifier"].includes(scene) && verificationType === import_constants2.SMS_OTP_VERIFICATION_TYPE
96
+ );
97
+ this.verificationManager.registerAction("verifiers:bind", {
98
+ manual: true,
99
+ getBoundInfoFromCtx: (ctx) => {
100
+ return ctx.action.params.values || {};
75
101
  }
76
102
  });
77
- if (!item) {
78
- return context.throw(400, {
79
- code: "InvalidVerificationCode",
80
- message: context.t("Verification code is invalid", { ns: import__.namespace })
81
- });
82
- }
83
- try {
84
- await next();
85
- } finally {
86
- await item.update({
87
- status: import_constants.CODE_STATUS_USED
88
- });
89
- }
90
- };
103
+ this.verificationManager.registerScene("unbind-verifier", {
104
+ actions: {
105
+ "verifiers:unbind": {}
106
+ }
107
+ });
108
+ this.smsOTPProviderManager.registerProvider(import_constants.PROVIDER_TYPE_SMS_ALIYUN, {
109
+ title: (0, import_utils.tval)("Aliyun SMS", { ns: import__.namespace }),
110
+ provider: import_sms_aliyun.default
111
+ });
112
+ this.smsOTPProviderManager.registerProvider(import_constants.PROVIDER_TYPE_SMS_TENCENT, {
113
+ title: (0, import_utils.tval)("Tencent SMS", { ns: import__.namespace }),
114
+ provider: import_sms_tencent.default
115
+ });
116
+ }
91
117
  async install() {
92
118
  const {
93
119
  DEFAULT_SMS_VERIFY_CODE_PROVIDER,
@@ -122,33 +148,4 @@ class PluginVerficationServer extends import_server.Plugin {
122
148
  });
123
149
  }
124
150
  }
125
- async load() {
126
- const { app, db, options } = this;
127
- await this.importCollections(import_path.default.resolve(__dirname, "collections"));
128
- await (0, import_providers.default)(this);
129
- (0, import_actions2.default)(this);
130
- const self = this;
131
- app.resourceManager.use(async function verificationIntercept(context, next) {
132
- const { resourceName, actionName, values } = context.action.params;
133
- const key = `${resourceName}:${actionName}`;
134
- const interceptor = self.interceptors.get(key);
135
- if (!interceptor || interceptor.manual) {
136
- return next();
137
- }
138
- return self.intercept(context, next);
139
- });
140
- app.acl.allow("verifications", "create", "public");
141
- this.app.acl.registerSnippet({
142
- name: `pm.${this.name}.providers`,
143
- actions: ["verifications_providers:*"]
144
- });
145
- }
146
- async getDefault() {
147
- const providerRepo = this.db.getRepository("verifications_providers");
148
- return providerRepo.findOne({
149
- filter: {
150
- default: true
151
- }
152
- });
153
- }
154
151
  }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Context, Next } from '@nocobase/actions';
10
+ declare const _default: {
11
+ listTypes: (ctx: Context, next: Next) => Promise<void>;
12
+ listByScene: (ctx: Context, next: Next) => Promise<any>;
13
+ listByUser: (ctx: Context, next: Next) => Promise<void>;
14
+ listForVerify: (ctx: Context, next: Next) => Promise<any>;
15
+ bind: (ctx: Context, next: Next) => Promise<never>;
16
+ unbind: (ctx: Context, next: Next) => Promise<never>;
17
+ };
18
+ export default _default;
@@ -0,0 +1,175 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var verifiers_exports = {};
38
+ __export(verifiers_exports, {
39
+ default: () => verifiers_default
40
+ });
41
+ module.exports = __toCommonJS(verifiers_exports);
42
+ var import_package = __toESM(require("../../../package.json"));
43
+ var verifiers_default = {
44
+ listTypes: async (ctx, next) => {
45
+ const plugin = ctx.app.pm.get("verification");
46
+ ctx.body = plugin.verificationManager.listTypes();
47
+ await next();
48
+ },
49
+ listByScene: async (ctx, next) => {
50
+ const { scene } = ctx.action.params || {};
51
+ const plugin = ctx.app.pm.get("verification");
52
+ const verificationTypes = plugin.verificationManager.getVerificationTypesByScene(scene);
53
+ if (!verificationTypes.length) {
54
+ ctx.body = { verifiers: [], availableTypes: [] };
55
+ return next();
56
+ }
57
+ const verifiers = await ctx.db.getRepository("verifiers").find({
58
+ filter: {
59
+ verificationType: verificationTypes.map((item) => item.type)
60
+ }
61
+ });
62
+ ctx.body = {
63
+ verifiers: (verifiers || []).map((item) => ({
64
+ name: item.name,
65
+ title: item.title
66
+ })),
67
+ availableTypes: verificationTypes.map((item) => ({
68
+ name: item.type,
69
+ title: item.title
70
+ }))
71
+ };
72
+ await next();
73
+ },
74
+ listByUser: async (ctx, next) => {
75
+ const plugin = ctx.app.pm.get("verification");
76
+ const verificationTypes = plugin.verificationManager.verificationTypes;
77
+ const bindingRequiredTypes = Array.from(verificationTypes.getEntities()).filter(([, options]) => options.bindingRequired).map(([type]) => type);
78
+ const verifiers = await ctx.db.getRepository("verifiers").find({
79
+ filter: {
80
+ verificationType: bindingRequiredTypes
81
+ }
82
+ });
83
+ const result = [];
84
+ for (const verifier of verifiers) {
85
+ try {
86
+ const verificationType = plugin.verificationManager.verificationTypes.get(verifier.verificationType);
87
+ const Verification = plugin.verificationManager.getVerification(verifier.verificationType);
88
+ const verification = new Verification({ ctx, verifier, options: verifier.options });
89
+ const boundInfo = await verification.getPublicBoundInfo(ctx.auth.user.id);
90
+ result.push({
91
+ ...verifier.dataValues,
92
+ title: verifier.title || verificationType.title,
93
+ description: verifier.description || verificationType.description,
94
+ boundInfo
95
+ });
96
+ } catch (error) {
97
+ ctx.log.error(error);
98
+ }
99
+ }
100
+ ctx.body = result;
101
+ await next();
102
+ },
103
+ listForVerify: async (ctx, next) => {
104
+ const { scene } = ctx.action.params || {};
105
+ const plugin = ctx.app.pm.get("verification");
106
+ const verificationTypes = plugin.verificationManager.getVerificationTypesByScene(scene);
107
+ if (!verificationTypes.length) {
108
+ ctx.body = [];
109
+ return next();
110
+ }
111
+ const verifiers = await ctx.db.getRepository("verifiers").find({
112
+ filter: {
113
+ verificationType: verificationTypes.map((item) => item.type)
114
+ }
115
+ });
116
+ if (!verifiers.length) {
117
+ ctx.body = [];
118
+ return next();
119
+ }
120
+ const result = [];
121
+ for (const verifier of verifiers) {
122
+ const verificationType = plugin.verificationManager.verificationTypes.get(verifier.verificationType);
123
+ const Verification = plugin.verificationManager.getVerification(verifier.verificationType);
124
+ const verification = new Verification({ ctx, verifier, options: verifier.options });
125
+ const publicBoundInfo = await verification.getPublicBoundInfo(ctx.auth.user.id);
126
+ if (!(publicBoundInfo == null ? void 0 : publicBoundInfo.bound)) {
127
+ continue;
128
+ }
129
+ result.push({
130
+ name: verifier.name,
131
+ title: verifier.title,
132
+ verificationType: verifier.verificationType,
133
+ verificationTypeTitle: verificationType == null ? void 0 : verificationType.title,
134
+ boundInfo: publicBoundInfo
135
+ });
136
+ }
137
+ ctx.body = result;
138
+ await next();
139
+ },
140
+ bind: async (ctx, next) => {
141
+ const { verifier: name } = ctx.action.params.values || {};
142
+ const user = ctx.auth.user;
143
+ const verificationPlugin = ctx.app.pm.get("verification");
144
+ const record = await verificationPlugin.verificationManager.getBoundRecord(user.id, name);
145
+ if (record) {
146
+ return ctx.throw(400, ctx.t("You have already bound this verifier", { ns: import_package.default.name }));
147
+ }
148
+ const verifier = await verificationPlugin.verificationManager.getVerifier(name);
149
+ if (!verifier) {
150
+ return ctx.throw(400, ctx.t("Invalid verifier"));
151
+ }
152
+ const Verification = verificationPlugin.verificationManager.getVerification(verifier.verificationType);
153
+ const verification = new Verification({ ctx, verifier, options: verifier.options });
154
+ const { uuid, meta } = await verification.bind(user.id);
155
+ await verifier.addUser(user.id, {
156
+ through: {
157
+ uuid,
158
+ meta
159
+ }
160
+ });
161
+ ctx.body = {};
162
+ await next();
163
+ },
164
+ unbind: async (ctx, next) => {
165
+ const { unbindVerifier: name } = ctx.action.params.values || {};
166
+ const user = ctx.auth.user;
167
+ const verificationPlugin = ctx.app.pm.get("verification");
168
+ const verifier = await verificationPlugin.verificationManager.getVerifier(name);
169
+ if (!verifier) {
170
+ return ctx.throw(400, ctx.t("Invalid verifier"));
171
+ }
172
+ await verifier.removeUser(user.id);
173
+ await next();
174
+ }
175
+ };
@@ -6,5 +6,5 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { Context, Next } from '@nocobase/actions';
10
- export declare function create(context: Context, next: Next): Promise<never>;
9
+ declare const _default: import("@nocobase/database").CollectionOptions;
10
+ export default _default;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var otp_records_exports = {};
28
+ __export(otp_records_exports, {
29
+ default: () => otp_records_default
30
+ });
31
+ module.exports = __toCommonJS(otp_records_exports);
32
+ var import_database = require("@nocobase/database");
33
+ var otp_records_default = (0, import_database.defineCollection)({
34
+ dumpRules: {
35
+ group: "log"
36
+ },
37
+ migrationRules: ["schema-only", "skip"],
38
+ name: "otpRecords",
39
+ shared: true,
40
+ fields: [
41
+ {
42
+ type: "uuid",
43
+ name: "id",
44
+ primaryKey: true
45
+ },
46
+ {
47
+ type: "string",
48
+ name: "action"
49
+ },
50
+ {
51
+ type: "string",
52
+ name: "receiver"
53
+ },
54
+ {
55
+ type: "integer",
56
+ name: "status",
57
+ defaultValue: 0
58
+ },
59
+ {
60
+ type: "unixTimestamp",
61
+ name: "expiresAt",
62
+ accuracy: "millisecond"
63
+ },
64
+ {
65
+ type: "string",
66
+ name: "code"
67
+ },
68
+ {
69
+ type: "belongsTo",
70
+ name: "verifier",
71
+ target: "verifiers",
72
+ targetKey: "name"
73
+ }
74
+ ]
75
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ declare const _default: import("@nocobase/database").CollectionOptions;
10
+ export default _default;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var users_verificators_exports = {};
28
+ __export(users_verificators_exports, {
29
+ default: () => users_verificators_default
30
+ });
31
+ module.exports = __toCommonJS(users_verificators_exports);
32
+ var import_database = require("@nocobase/database");
33
+ var users_verificators_default = (0, import_database.defineCollection)({
34
+ migrationRules: ["skip"],
35
+ name: "usersVerificators",
36
+ createdBy: true,
37
+ updatedBy: true,
38
+ logging: true,
39
+ fields: [
40
+ {
41
+ name: "uuid",
42
+ interface: "input",
43
+ type: "string",
44
+ allowNull: false,
45
+ uiSchema: {
46
+ type: "string",
47
+ title: '{{t("UUID")}}',
48
+ "x-component": "Input",
49
+ required: true
50
+ }
51
+ },
52
+ {
53
+ type: "json",
54
+ name: "meta",
55
+ defaultValue: {}
56
+ }
57
+ ]
58
+ });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ /**
10
+ * Collection for user information of extended authentication methods,
11
+ * such as saml, oicd, oauth, sms, etc.
12
+ */
13
+ declare const _default: import("@nocobase/database").CollectionOptions;
14
+ export default _default;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var users_verifiers_exports = {};
28
+ __export(users_verifiers_exports, {
29
+ default: () => users_verifiers_default
30
+ });
31
+ module.exports = __toCommonJS(users_verifiers_exports);
32
+ var import_database = require("@nocobase/database");
33
+ var users_verifiers_default = (0, import_database.defineCollection)({
34
+ migrationRules: ["schema-only", "overwrite", "skip"],
35
+ name: "usersVerifiers",
36
+ createdBy: true,
37
+ updatedBy: true,
38
+ logging: true,
39
+ fields: [
40
+ {
41
+ name: "uuid",
42
+ interface: "input",
43
+ type: "string",
44
+ allowNull: false,
45
+ uiSchema: {
46
+ type: "string",
47
+ title: '{{t("UUID")}}',
48
+ "x-component": "Input",
49
+ required: true
50
+ }
51
+ },
52
+ {
53
+ type: "json",
54
+ name: "meta",
55
+ defaultValue: {}
56
+ }
57
+ ]
58
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ declare const _default: import("@nocobase/database").CollectionOptions;
10
+ export default _default;
@@ -34,23 +34,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  mod
35
35
  ));
36
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var actions_exports = {};
38
- __export(actions_exports, {
39
- default: () => actions_default
37
+ var verificators_exports = {};
38
+ __export(verificators_exports, {
39
+ default: () => verificators_default
40
+ });
41
+ module.exports = __toCommonJS(verificators_exports);
42
+ var import_database = require("@nocobase/database");
43
+ var import_verificators = __toESM(require("../../collections/verificators"));
44
+ var verificators_default = (0, import_database.defineCollection)({
45
+ migrationRules: ["skip"],
46
+ ...import_verificators.default
40
47
  });
41
- module.exports = __toCommonJS(actions_exports);
42
- var verifications = __toESM(require("./verifications"));
43
- function make(name, mod) {
44
- return Object.keys(mod).reduce(
45
- (result, key) => ({
46
- ...result,
47
- [`${name}:${key}`]: mod[key]
48
- }),
49
- {}
50
- );
51
- }
52
- function actions_default({ app }) {
53
- app.actions({
54
- ...make("verifications", verifications)
55
- });
56
- }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ declare const _default: import("@nocobase/database").CollectionOptions;
10
+ export default _default;