@tachybase/plugin-field-sequence 0.23.8
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/.turbo/turbo-build.log +12 -0
- package/README.md +9 -0
- package/README.zh-CN.md +9 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/SequenceFieldProvider.d.ts +2 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +19 -0
- package/dist/client/locale/index.d.ts +3 -0
- package/dist/client/sequence.d.ts +259 -0
- package/dist/externalVersion.js +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +24 -0
- package/dist/locale/es-ES.json +24 -0
- package/dist/locale/fr-FR.json +24 -0
- package/dist/locale/ko_KR.json +24 -0
- package/dist/locale/pt-BR.json +24 -0
- package/dist/locale/zh-CN.json +25 -0
- package/dist/node_modules/cron-parser/LICENSE +21 -0
- package/dist/node_modules/cron-parser/lib/date.js +252 -0
- package/dist/node_modules/cron-parser/lib/expression.js +1002 -0
- package/dist/node_modules/cron-parser/lib/field_compactor.js +70 -0
- package/dist/node_modules/cron-parser/lib/field_stringify.js +58 -0
- package/dist/node_modules/cron-parser/lib/parser.js +1 -0
- package/dist/node_modules/cron-parser/package.json +1 -0
- package/dist/node_modules/cron-parser/types/common.d.ts +131 -0
- package/dist/node_modules/cron-parser/types/index.d.ts +45 -0
- package/dist/node_modules/cron-parser/types/ts3/index.d.ts +28 -0
- package/dist/server/Plugin.d.ts +8 -0
- package/dist/server/Plugin.js +124 -0
- package/dist/server/collections/sequences.d.ts +2 -0
- package/dist/server/collections/sequences.js +87 -0
- package/dist/server/fields/field-sequence.d.ts +38 -0
- package/dist/server/fields/field-sequence.js +386 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +39 -0
- package/dist/server/migrations/20221207022250-sequence-field-key.d.ts +6 -0
- package/dist/server/migrations/20221207022250-sequence-field-key.js +85 -0
- package/package.json +36 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,85 @@
|
|
|
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 sequence_field_key_exports = {};
|
|
19
|
+
__export(sequence_field_key_exports, {
|
|
20
|
+
default: () => sequence_field_key_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(sequence_field_key_exports);
|
|
23
|
+
var import_server = require("@tachybase/server");
|
|
24
|
+
class sequence_field_key_default extends import_server.Migration {
|
|
25
|
+
appVersion = "<0.8.1-alpha.2";
|
|
26
|
+
async up() {
|
|
27
|
+
const match = await this.app.version.satisfies("<=0.8.0-alpha.13");
|
|
28
|
+
if (!match) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const { db } = this.context;
|
|
32
|
+
const fieldRepo = db.getRepository("fields");
|
|
33
|
+
if (!fieldRepo) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const pluginRepo = db.getRepository("applicationPlugins");
|
|
37
|
+
await db.sequelize.transaction(async (transaction) => {
|
|
38
|
+
const seqPlugin = await pluginRepo.findOne({
|
|
39
|
+
filter: {
|
|
40
|
+
name: "field-sequence"
|
|
41
|
+
},
|
|
42
|
+
transaction
|
|
43
|
+
});
|
|
44
|
+
if (!seqPlugin) {
|
|
45
|
+
await pluginRepo.create({
|
|
46
|
+
values: {
|
|
47
|
+
name: "field-sequence",
|
|
48
|
+
version: "0.8.0-alpha.13",
|
|
49
|
+
enabled: true,
|
|
50
|
+
installed: true,
|
|
51
|
+
builtIn: true
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const fields = await fieldRepo.find({
|
|
56
|
+
filter: {
|
|
57
|
+
type: "sequence"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
await fields.reduce(
|
|
61
|
+
(promise, field) => promise.then(async () => {
|
|
62
|
+
const options = field.get("options");
|
|
63
|
+
const fieldName = field.get("name");
|
|
64
|
+
const collectionName = field.get("collectionName");
|
|
65
|
+
field.set("patterns", options.patterns);
|
|
66
|
+
await field.save({ transaction });
|
|
67
|
+
const repo = db.getRepository(collectionName);
|
|
68
|
+
const item = await repo.findOne({
|
|
69
|
+
sort: ["-createdAt"],
|
|
70
|
+
transaction
|
|
71
|
+
});
|
|
72
|
+
if (!item) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const collection = db.getCollection(collectionName);
|
|
76
|
+
const memField = collection.getField(fieldName);
|
|
77
|
+
await memField.update(item, { transaction });
|
|
78
|
+
}),
|
|
79
|
+
Promise.resolve()
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
async down() {
|
|
84
|
+
}
|
|
85
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tachybase/plugin-field-sequence",
|
|
3
|
+
"displayName": "Collection field: Sequence",
|
|
4
|
+
"version": "0.23.8",
|
|
5
|
+
"description": "Automatically generate codes based on configured rules, supporting combinations of dates, numbers, and text.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"Collection fields"
|
|
8
|
+
],
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"main": "./dist/server/index.js",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"antd": "5.22.5",
|
|
13
|
+
"cron-parser": "4.9.0",
|
|
14
|
+
"dayjs": "1.11.13",
|
|
15
|
+
"lodash": "4.17.21",
|
|
16
|
+
"react": "~18.3.1",
|
|
17
|
+
"react-i18next": "^15.2.0",
|
|
18
|
+
"react-js-cron": "^3.2.0",
|
|
19
|
+
"@tachybase/components": "0.23.8",
|
|
20
|
+
"@tachybase/schema": "0.23.8"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@tachybase/actions": "0.23.8",
|
|
24
|
+
"@tachybase/server": "0.23.8",
|
|
25
|
+
"@tachybase/test": "0.23.8",
|
|
26
|
+
"@tachybase/utils": "0.23.8",
|
|
27
|
+
"@tachybase/database": "0.23.8",
|
|
28
|
+
"@tachybase/client": "0.23.8",
|
|
29
|
+
"@tachybase/module-collection": "0.23.8"
|
|
30
|
+
},
|
|
31
|
+
"description.zh-CN": "根据配置的规则自动生成编码,支持日期、数字、文本的组合。",
|
|
32
|
+
"displayName.zh-CN": "数据表字段:自动编码",
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tachybase-build --no-dts @tachybase/plugin-field-sequence"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|