@yongdall/numbering 0.6.2 → 0.6.3
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/{NumberingRule-DjKTGF7Q.mjs → NumberingRule-DZRsY1di.mjs} +2 -1
- package/NumberingRule-DZRsY1di.mjs.map +1 -0
- package/index.mjs +2 -2
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/yongdall/migration.mjs +1 -1
- package/yongdall/model.mjs +1 -1
- package/NumberingRule-DjKTGF7Q.mjs.map +0 -1
|
@@ -10,6 +10,7 @@ const NumberingSequence = createModel("numbering.sequence", {
|
|
|
10
10
|
}),
|
|
11
11
|
key: createField("text", {
|
|
12
12
|
nullable: false,
|
|
13
|
+
primary: 2,
|
|
13
14
|
renderer: "string",
|
|
14
15
|
label: "标识模式",
|
|
15
16
|
layout: { colSpan: 6 }
|
|
@@ -101,4 +102,4 @@ const NumberingRule = createModel("numbering.rule", {
|
|
|
101
102
|
|
|
102
103
|
//#endregion
|
|
103
104
|
export { NumberingSequence as n, NumberingRule as t };
|
|
104
|
-
//# sourceMappingURL=NumberingRule-
|
|
105
|
+
//# sourceMappingURL=NumberingRule-DZRsY1di.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberingRule-DZRsY1di.mjs","names":[],"sources":["../../plugins/numbering/models/NumberingRule.mjs"],"sourcesContent":["import { createField, createModel, uuid, now } from '@yongdall/model';\n\nexport const NumberingSequence = createModel('numbering.sequence', {\n\tpatternId: createField('uuid', { nullable: false, primary: 1, uncreatable: true, layout: { hidden: true } }),\n\tkey: createField('text', { nullable: false, primary: 2, renderer: 'string', label: '标识模式', layout: { colSpan: 6 } }),\n\tsequence: createField('i32', { size: 255, nullable: false, default: 0, label: '当前值', layout: { colSpan: 6 } }),\n}, {\n\tlabel: '编号生成序列',\n\tlabelField: 'label',\n\tpermissions: [\n\t\t{ permission: 'system:pattern', fields: ['*'], authorizations: ['options', 'query', 'read'] },\n\t],\n});\nexport const NumberingRule = createModel('numbering.rule', {\n\tid: createField('uuid', { nullable: false, default: uuid, primary: 1, uncreatable: true, layout: { hidden: true } }),\n\tlabel: createField('string', { size: 255, nullable: false, default: '', label: '名称', layout: { colSpan: 6 } }),\n\tpattern: createField('text', { nullable: false, renderer: 'string', label: '模式', layout: { colSpan: 6 } }),\n\tkeyPattern: createField('text', { nullable: false, renderer: 'string', default: '', label: '标识模式', layout: { colSpan: 6 } }),\n\tcreatedAt: createField('timestamp', { nullable: false, creating: now, label: '创建日期', layout: { hidden: true } }),\n\tupdatedAt: createField('timestamp', { nullable: false, updating: now, label: '最后更新日期', layout: { hidden: true } }),\n}, {\n\tlabel: '编号生成规则',\n\tlabelField: 'label',\n\tpermissions: [\n\t\t{ permission: '', fields: ['*'], authorizations: ['options', 'query', 'read'] },\n\t\t{ permission: 'system:numbering', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy'] },\n\t],\n});\n"],"mappings":";;;AAEA,MAAa,oBAAoB,YAAY,sBAAsB;CAClE,WAAW,YAAY,QAAQ;EAAE,UAAU;EAAO,SAAS;EAAG,aAAa;EAAM,QAAQ,EAAE,QAAQ,MAAM;EAAE,CAAC;CAC5G,KAAK,YAAY,QAAQ;EAAE,UAAU;EAAO,SAAS;EAAG,UAAU;EAAU,OAAO;EAAQ,QAAQ,EAAE,SAAS,GAAG;EAAE,CAAC;CACpH,UAAU,YAAY,OAAO;EAAE,MAAM;EAAK,UAAU;EAAO,SAAS;EAAG,OAAO;EAAO,QAAQ,EAAE,SAAS,GAAG;EAAE,CAAC;CAC9G,EAAE;CACF,OAAO;CACP,YAAY;CACZ,aAAa,CACZ;EAAE,YAAY;EAAkB,QAAQ,CAAC,IAAI;EAAE,gBAAgB;GAAC;GAAW;GAAS;GAAO;EAAE,CAC7F;CACD,CAAC;AACF,MAAa,gBAAgB,YAAY,kBAAkB;CAC1D,IAAI,YAAY,QAAQ;EAAE,UAAU;EAAO,SAAS;EAAM,SAAS;EAAG,aAAa;EAAM,QAAQ,EAAE,QAAQ,MAAM;EAAE,CAAC;CACpH,OAAO,YAAY,UAAU;EAAE,MAAM;EAAK,UAAU;EAAO,SAAS;EAAI,OAAO;EAAM,QAAQ,EAAE,SAAS,GAAG;EAAE,CAAC;CAC9G,SAAS,YAAY,QAAQ;EAAE,UAAU;EAAO,UAAU;EAAU,OAAO;EAAM,QAAQ,EAAE,SAAS,GAAG;EAAE,CAAC;CAC1G,YAAY,YAAY,QAAQ;EAAE,UAAU;EAAO,UAAU;EAAU,SAAS;EAAI,OAAO;EAAQ,QAAQ,EAAE,SAAS,GAAG;EAAE,CAAC;CAC5H,WAAW,YAAY,aAAa;EAAE,UAAU;EAAO,UAAU;EAAK,OAAO;EAAQ,QAAQ,EAAE,QAAQ,MAAM;EAAE,CAAC;CAChH,WAAW,YAAY,aAAa;EAAE,UAAU;EAAO,UAAU;EAAK,OAAO;EAAU,QAAQ,EAAE,QAAQ,MAAM;EAAE,CAAC;CAClH,EAAE;CACF,OAAO;CACP,YAAY;CACZ,aAAa,CACZ;EAAE,YAAY;EAAI,QAAQ,CAAC,IAAI;EAAE,gBAAgB;GAAC;GAAW;GAAS;GAAO;EAAE,EAC/E;EAAE,YAAY;EAAoB,QAAQ,CAAC,IAAI;EAAE,gBAAgB;GAAC;GAAW;GAAS;GAAQ;GAAU;GAAU;GAAU;EAAE,CAC9H;CACD,CAAC"}
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as NumberingSequence, t as NumberingRule } from "./NumberingRule-
|
|
1
|
+
import { n as NumberingSequence, t as NumberingRule } from "./NumberingRule-DZRsY1di.mjs";
|
|
2
2
|
import { Query, actions, increment } from "@yongdall/model";
|
|
3
3
|
import { useDatabase } from "@yongdall/connection";
|
|
4
4
|
import { Pattern } from "@yongdall/common";
|
|
@@ -41,7 +41,7 @@ async function generate(id, data) {
|
|
|
41
41
|
patternId: pattern.id,
|
|
42
42
|
key,
|
|
43
43
|
sequence: 1
|
|
44
|
-
}, { sequence: increment(1) }));
|
|
44
|
+
}, null, ["patternId", "key"], { sequence: increment(1) }));
|
|
45
45
|
return Pattern.generate(pattern.pattern, data, seq.sequence);
|
|
46
46
|
}
|
|
47
47
|
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../plugins/numbering/index.mjs"],"sourcesContent":["/** @import { TableValue } from '@yongdall/model' */\nimport { useDatabase } from '@yongdall/connection';\nimport { Pattern } from '@yongdall/common';\nimport { Query, actions, increment } from '@yongdall/model';\nimport { NumberingRule, NumberingSequence } from './models/NumberingRule.mjs';\n\nexport { NumberingRule, NumberingSequence } from './models/NumberingRule.mjs';\n\n/**\n * \n * @param {string} id \n * @returns {Promise<TableValue<NumberingRule>?>}\n */\nasync function find(id) {\n\tconst database = useDatabase(NumberingRule.databaseId);\n\tconst pattern = await database.call(actions.first(new Query(NumberingRule).primary(id)));\n\treturn pattern || null;\n}\n\n\n/**\n * \n * @param {string} id \n * @param {Record<string, any>} data \n */\nexport async function next(id, data) {\n\tconst pattern = await find(id);\n\tif (!pattern) { return null; }\n\tconst key = Pattern.generate(pattern.keyPattern || '', data) || '';\n\tconst database = useDatabase(NumberingRule.databaseId);\n\tconst seq = await database.call(actions.upsert(NumberingSequence, {\n\t\tpatternId: pattern.id,\n\t\tkey,\n\t\tsequence: 1,\n\t}, { sequence: increment(1) }))\n\treturn seq.sequence;\n}\n\n/**\n * \n * @param {string} id \n * @param {Record<string, any>} data \n */\nexport async function generate(id, data) {\n\tconst pattern = await find(id);\n\tif (!pattern) { return null; }\n\tconst key = Pattern.generate(pattern.keyPattern || '', data) || '';\n\tconst database = useDatabase(NumberingRule.databaseId);\n\tconst seq = await database.call(actions.upsert(NumberingSequence, {\n\t\tpatternId: pattern.id, key, sequence: 1,\n\t}, { sequence: increment(1) }));\n\treturn Pattern.generate(pattern.pattern, data, seq.sequence);\n}\n"],"mappings":";;;;;;;;;;;;AAaA,eAAe,KAAK,IAAI;AAGvB,QADgB,MADC,YAAY,cAAc,WAAW,CACvB,KAAK,QAAQ,MAAM,IAAI,MAAM,cAAc,CAAC,QAAQ,GAAG,CAAC,CAAC,IACtE;;;;;;;AASnB,eAAsB,KAAK,IAAI,MAAM;CACpC,MAAM,UAAU,MAAM,KAAK,GAAG;AAC9B,KAAI,CAAC,QAAW,QAAO;CACvB,MAAM,MAAM,QAAQ,SAAS,QAAQ,cAAc,IAAI,KAAK,IAAI;AAOhE,SALY,MADK,YAAY,cAAc,WAAW,CAC3B,KAAK,QAAQ,OAAO,mBAAmB;EACjE,WAAW,QAAQ;EACnB;EACA,UAAU;EACV,EAAE,EAAE,UAAU,UAAU,EAAE,EAAE,CAAC,CAAC,EACpB;;;;;;;AAQZ,eAAsB,SAAS,IAAI,MAAM;CACxC,MAAM,UAAU,MAAM,KAAK,GAAG;AAC9B,KAAI,CAAC,QAAW,QAAO;CACvB,MAAM,MAAM,QAAQ,SAAS,QAAQ,cAAc,IAAI,KAAK,IAAI;CAEhE,MAAM,MAAM,MADK,YAAY,cAAc,WAAW,CAC3B,KAAK,QAAQ,OAAO,mBAAmB;EACjE,WAAW,QAAQ;EAAI;EAAK,UAAU;EACtC,EAAE,EAAE,UAAU,UAAU,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../plugins/numbering/index.mjs"],"sourcesContent":["/** @import { TableValue } from '@yongdall/model' */\nimport { useDatabase } from '@yongdall/connection';\nimport { Pattern } from '@yongdall/common';\nimport { Query, actions, increment } from '@yongdall/model';\nimport { NumberingRule, NumberingSequence } from './models/NumberingRule.mjs';\n\nexport { NumberingRule, NumberingSequence } from './models/NumberingRule.mjs';\n\n/**\n * \n * @param {string} id \n * @returns {Promise<TableValue<NumberingRule>?>}\n */\nasync function find(id) {\n\tconst database = useDatabase(NumberingRule.databaseId);\n\tconst pattern = await database.call(actions.first(new Query(NumberingRule).primary(id)));\n\treturn pattern || null;\n}\n\n\n/**\n * \n * @param {string} id \n * @param {Record<string, any>} data \n */\nexport async function next(id, data) {\n\tconst pattern = await find(id);\n\tif (!pattern) { return null; }\n\tconst key = Pattern.generate(pattern.keyPattern || '', data) || '';\n\tconst database = useDatabase(NumberingRule.databaseId);\n\tconst seq = await database.call(actions.upsert(NumberingSequence, {\n\t\tpatternId: pattern.id,\n\t\tkey,\n\t\tsequence: 1,\n\t}, { sequence: increment(1) }))\n\treturn seq.sequence;\n}\n\n/**\n * \n * @param {string} id \n * @param {Record<string, any>} data \n */\nexport async function generate(id, data) {\n\tconst pattern = await find(id);\n\tif (!pattern) { return null; }\n\tconst key = Pattern.generate(pattern.keyPattern || '', data) || '';\n\tconst database = useDatabase(NumberingRule.databaseId);\n\tconst seq = await database.call(actions.upsert(NumberingSequence, {\n\t\tpatternId: pattern.id, key, sequence: 1,\n\t}, null, ['patternId', 'key'], { sequence: increment(1) }));\n\treturn Pattern.generate(pattern.pattern, data, seq.sequence);\n}\n"],"mappings":";;;;;;;;;;;;AAaA,eAAe,KAAK,IAAI;AAGvB,QADgB,MADC,YAAY,cAAc,WAAW,CACvB,KAAK,QAAQ,MAAM,IAAI,MAAM,cAAc,CAAC,QAAQ,GAAG,CAAC,CAAC,IACtE;;;;;;;AASnB,eAAsB,KAAK,IAAI,MAAM;CACpC,MAAM,UAAU,MAAM,KAAK,GAAG;AAC9B,KAAI,CAAC,QAAW,QAAO;CACvB,MAAM,MAAM,QAAQ,SAAS,QAAQ,cAAc,IAAI,KAAK,IAAI;AAOhE,SALY,MADK,YAAY,cAAc,WAAW,CAC3B,KAAK,QAAQ,OAAO,mBAAmB;EACjE,WAAW,QAAQ;EACnB;EACA,UAAU;EACV,EAAE,EAAE,UAAU,UAAU,EAAE,EAAE,CAAC,CAAC,EACpB;;;;;;;AAQZ,eAAsB,SAAS,IAAI,MAAM;CACxC,MAAM,UAAU,MAAM,KAAK,GAAG;AAC9B,KAAI,CAAC,QAAW,QAAO;CACvB,MAAM,MAAM,QAAQ,SAAS,QAAQ,cAAc,IAAI,KAAK,IAAI;CAEhE,MAAM,MAAM,MADK,YAAY,cAAc,WAAW,CAC3B,KAAK,QAAQ,OAAO,mBAAmB;EACjE,WAAW,QAAQ;EAAI;EAAK,UAAU;EACtC,EAAE,MAAM,CAAC,aAAa,MAAM,EAAE,EAAE,UAAU,UAAU,EAAE,EAAE,CAAC,CAAC;AAC3D,QAAO,QAAQ,SAAS,QAAQ,SAAS,MAAM,IAAI,SAAS"}
|
package/package.json
CHANGED
package/yongdall/migration.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as NumberingSequence, t as NumberingRule } from "../NumberingRule-
|
|
1
|
+
import { n as NumberingSequence, t as NumberingRule } from "../NumberingRule-DZRsY1di.mjs";
|
|
2
2
|
|
|
3
3
|
//#region plugins/numbering/yongdall/migration.mjs
|
|
4
4
|
/** @import { Profile } from '@yongdall/migrate' */
|
package/yongdall/model.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as NumberingSequence, t as NumberingRule } from "../NumberingRule-
|
|
1
|
+
import { n as NumberingSequence, t as NumberingRule } from "../NumberingRule-DZRsY1di.mjs";
|
|
2
2
|
|
|
3
3
|
//#region plugins/numbering/yongdall/model.mjs
|
|
4
4
|
/** @import { ModelProfile } from '@yongdall/core' */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NumberingRule-DjKTGF7Q.mjs","names":[],"sources":["../../plugins/numbering/models/NumberingRule.mjs"],"sourcesContent":["import { createField, createModel, uuid, now } from '@yongdall/model';\n\nexport const NumberingSequence = createModel('numbering.sequence', {\n\tpatternId: createField('uuid', { nullable: false, primary: 1, uncreatable: true, layout: { hidden: true } }),\n\tkey: createField('text', { nullable: false, renderer: 'string', label: '标识模式', layout: { colSpan: 6 } }),\n\tsequence: createField('i32', { size: 255, nullable: false, default: 0, label: '当前值', layout: { colSpan: 6 } }),\n}, {\n\tlabel: '编号生成序列',\n\tlabelField: 'label',\n\tpermissions: [\n\t\t{ permission: 'system:pattern', fields: ['*'], authorizations: ['options', 'query', 'read'] },\n\t],\n});\nexport const NumberingRule = createModel('numbering.rule', {\n\tid: createField('uuid', { nullable: false, default: uuid, primary: 1, uncreatable: true, layout: { hidden: true } }),\n\tlabel: createField('string', { size: 255, nullable: false, default: '', label: '名称', layout: { colSpan: 6 } }),\n\tpattern: createField('text', { nullable: false, renderer: 'string', label: '模式', layout: { colSpan: 6 } }),\n\tkeyPattern: createField('text', { nullable: false, renderer: 'string', default: '', label: '标识模式', layout: { colSpan: 6 } }),\n\tcreatedAt: createField('timestamp', { nullable: false, creating: now, label: '创建日期', layout: { hidden: true } }),\n\tupdatedAt: createField('timestamp', { nullable: false, updating: now, label: '最后更新日期', layout: { hidden: true } }),\n}, {\n\tlabel: '编号生成规则',\n\tlabelField: 'label',\n\tpermissions: [\n\t\t{ permission: '', fields: ['*'], authorizations: ['options', 'query', 'read'] },\n\t\t{ permission: 'system:numbering', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy'] },\n\t],\n});\n"],"mappings":";;;AAEA,MAAa,oBAAoB,YAAY,sBAAsB;CAClE,WAAW,YAAY,QAAQ;EAAE,UAAU;EAAO,SAAS;EAAG,aAAa;EAAM,QAAQ,EAAE,QAAQ,MAAM;EAAE,CAAC;CAC5G,KAAK,YAAY,QAAQ;EAAE,UAAU;EAAO,UAAU;EAAU,OAAO;EAAQ,QAAQ,EAAE,SAAS,GAAG;EAAE,CAAC;CACxG,UAAU,YAAY,OAAO;EAAE,MAAM;EAAK,UAAU;EAAO,SAAS;EAAG,OAAO;EAAO,QAAQ,EAAE,SAAS,GAAG;EAAE,CAAC;CAC9G,EAAE;CACF,OAAO;CACP,YAAY;CACZ,aAAa,CACZ;EAAE,YAAY;EAAkB,QAAQ,CAAC,IAAI;EAAE,gBAAgB;GAAC;GAAW;GAAS;GAAO;EAAE,CAC7F;CACD,CAAC;AACF,MAAa,gBAAgB,YAAY,kBAAkB;CAC1D,IAAI,YAAY,QAAQ;EAAE,UAAU;EAAO,SAAS;EAAM,SAAS;EAAG,aAAa;EAAM,QAAQ,EAAE,QAAQ,MAAM;EAAE,CAAC;CACpH,OAAO,YAAY,UAAU;EAAE,MAAM;EAAK,UAAU;EAAO,SAAS;EAAI,OAAO;EAAM,QAAQ,EAAE,SAAS,GAAG;EAAE,CAAC;CAC9G,SAAS,YAAY,QAAQ;EAAE,UAAU;EAAO,UAAU;EAAU,OAAO;EAAM,QAAQ,EAAE,SAAS,GAAG;EAAE,CAAC;CAC1G,YAAY,YAAY,QAAQ;EAAE,UAAU;EAAO,UAAU;EAAU,SAAS;EAAI,OAAO;EAAQ,QAAQ,EAAE,SAAS,GAAG;EAAE,CAAC;CAC5H,WAAW,YAAY,aAAa;EAAE,UAAU;EAAO,UAAU;EAAK,OAAO;EAAQ,QAAQ,EAAE,QAAQ,MAAM;EAAE,CAAC;CAChH,WAAW,YAAY,aAAa;EAAE,UAAU;EAAO,UAAU;EAAK,OAAO;EAAU,QAAQ,EAAE,QAAQ,MAAM;EAAE,CAAC;CAClH,EAAE;CACF,OAAO;CACP,YAAY;CACZ,aAAa,CACZ;EAAE,YAAY;EAAI,QAAQ,CAAC,IAAI;EAAE,gBAAgB;GAAC;GAAW;GAAS;GAAO;EAAE,EAC/E;EAAE,YAAY;EAAoB,QAAQ,CAAC,IAAI;EAAE,gBAAgB;GAAC;GAAW;GAAS;GAAQ;GAAU;GAAU;GAAU;EAAE,CAC9H;CACD,CAAC"}
|