@acorex-platform/module-identifier-management-server 0.0.15
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/contracts/src/entities/identifier-rule/identifier-rule.entity.d.ts +2 -0
- package/contracts/src/entities/identifier-rule/identifier-rule.entity.js +148 -0
- package/contracts/src/entities/identifier-rule/identifier-rule.entity.js.map +1 -0
- package/contracts/src/entities/identifier-rule/identifier-rule.types.d.ts +4 -0
- package/contracts/src/entities/identifier-rule/identifier-rule.types.js +5 -0
- package/contracts/src/entities/identifier-rule/identifier-rule.types.js.map +1 -0
- package/contracts/src/entities/identifier-rule/index.d.ts +2 -0
- package/contracts/src/entities/identifier-rule/index.js +6 -0
- package/contracts/src/entities/identifier-rule/index.js.map +1 -0
- package/contracts/src/entities/index.d.ts +1 -0
- package/contracts/src/entities/index.js +5 -0
- package/contracts/src/entities/index.js.map +1 -0
- package/contracts/src/identifier-rule.types.d.ts +2 -0
- package/contracts/src/identifier-rule.types.js +8 -0
- package/contracts/src/identifier-rule.types.js.map +1 -0
- package/contracts/src/index.d.ts +6 -0
- package/contracts/src/index.js +14 -0
- package/contracts/src/index.js.map +1 -0
- package/contracts/src/menu.keys.d.ts +4 -0
- package/contracts/src/menu.keys.js +8 -0
- package/contracts/src/menu.keys.js.map +1 -0
- package/contracts/src/permission.keys.d.ts +6 -0
- package/contracts/src/permission.keys.js +10 -0
- package/contracts/src/permission.keys.js.map +1 -0
- package/contracts/src/root-config.d.ts +21 -0
- package/contracts/src/root-config.js +26 -0
- package/contracts/src/root-config.js.map +1 -0
- package/package.json +27 -0
- package/server/src/index.d.ts +3 -0
- package/server/src/index.js +7 -0
- package/server/src/index.js.map +1 -0
- package/server/src/lib/identifier-commit.middleware.d.ts +20 -0
- package/server/src/lib/identifier-commit.middleware.js +91 -0
- package/server/src/lib/identifier-commit.middleware.js.map +1 -0
- package/server/src/lib/identifier-management-server.module.d.ts +2 -0
- package/server/src/lib/identifier-management-server.module.js +31 -0
- package/server/src/lib/identifier-management-server.module.js.map +1 -0
- package/server/src/lib/identifier-management.controller.d.ts +12 -0
- package/server/src/lib/identifier-management.controller.js +82 -0
- package/server/src/lib/identifier-management.controller.js.map +1 -0
- package/server/src/lib/seed/identifier-rule/identifier-mock-code.util.d.ts +14 -0
- package/server/src/lib/seed/identifier-rule/identifier-mock-code.util.js +28 -0
- package/server/src/lib/seed/identifier-rule/identifier-mock-code.util.js.map +1 -0
- package/server/src/lib/seed/identifier-rule/identifier-rule-seed.util.d.ts +12 -0
- package/server/src/lib/seed/identifier-rule/identifier-rule-seed.util.js +60 -0
- package/server/src/lib/seed/identifier-rule/identifier-rule-seed.util.js.map +1 -0
- package/server/src/lib/seed/identifier-rule/index.d.ts +2 -0
- package/server/src/lib/seed/identifier-rule/index.js +6 -0
- package/server/src/lib/seed/identifier-rule/index.js.map +1 -0
- package/server/src/lib/seed/index.d.ts +18 -0
- package/server/src/lib/seed/index.js +20 -0
- package/server/src/lib/seed/index.js.map +1 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.identifierRuleFactory = identifierRuleFactory;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@acorex-platform/framework-shared/core");
|
|
6
|
+
const entity_1 = require("@acorex-platform/framework-shared/entity");
|
|
7
|
+
const root_config_1 = require("../../root-config");
|
|
8
|
+
//#region ---- Identifier rule entity ----
|
|
9
|
+
function identifierRuleFactory() {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
const i18n = `${root_config_1.RootConfig.config.i18n}:entities.identifier-rule`;
|
|
12
|
+
const entityDef = {
|
|
13
|
+
module: root_config_1.RootConfig.module.name,
|
|
14
|
+
name: root_config_1.RootConfig.entities.identifierRule.name,
|
|
15
|
+
title: root_config_1.RootConfig.entities.identifierRule.title,
|
|
16
|
+
icon: root_config_1.RootConfig.entities.identifierRule.icon,
|
|
17
|
+
plugins: [
|
|
18
|
+
{ name: 'clone' },
|
|
19
|
+
{ name: 'disable' },
|
|
20
|
+
{
|
|
21
|
+
name: 'unique-fields',
|
|
22
|
+
options: { fields: 'name', scope: 'global' },
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
formats: {
|
|
26
|
+
individual: root_config_1.RootConfig.entities.identifierRule.title,
|
|
27
|
+
plural: root_config_1.RootConfig.entities.identifierRule.titlePlural,
|
|
28
|
+
searchResult: { title: '{{ title }}', description: '{{ entity }} · {{ pattern }}' },
|
|
29
|
+
},
|
|
30
|
+
groups: [
|
|
31
|
+
{ id: 'basic-info', title: `@${i18n}.groups.basic-info` },
|
|
32
|
+
{ id: 'pattern', title: `@${i18n}.groups.pattern` },
|
|
33
|
+
{ id: 'scope', title: `@${i18n}.groups.scope` },
|
|
34
|
+
],
|
|
35
|
+
properties: [
|
|
36
|
+
{
|
|
37
|
+
name: 'name',
|
|
38
|
+
title: '@general:terms.common.name',
|
|
39
|
+
groupId: 'basic-info',
|
|
40
|
+
schema: {
|
|
41
|
+
dataType: 'string',
|
|
42
|
+
readonly: '{{ !!context.eval("id") }}',
|
|
43
|
+
interface: { type: core_1.AXPWidgetsList.Editors.TextBox },
|
|
44
|
+
},
|
|
45
|
+
validations: [{ rule: 'required' }, { rule: 'variable-name' }],
|
|
46
|
+
options: {
|
|
47
|
+
sort: { enabled: true },
|
|
48
|
+
filter: { inline: { enabled: true }, advance: { enabled: true } },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'title',
|
|
53
|
+
title: '@general:terms.common.title',
|
|
54
|
+
groupId: 'basic-info',
|
|
55
|
+
schema: { dataType: 'string', interface: { type: core_1.AXPWidgetsList.Editors.TextBox } },
|
|
56
|
+
validations: [{ rule: 'required' }],
|
|
57
|
+
options: {
|
|
58
|
+
sort: { enabled: true },
|
|
59
|
+
filter: { inline: { enabled: true }, advance: { enabled: true } },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'entity',
|
|
64
|
+
title: `@${i18n}.fields.entity.title`,
|
|
65
|
+
groupId: 'basic-info',
|
|
66
|
+
schema: { dataType: 'string', interface: { type: core_1.AXPWidgetsList.Editors.TextBox } },
|
|
67
|
+
validations: [{ rule: 'required' }],
|
|
68
|
+
options: {
|
|
69
|
+
filter: { inline: { enabled: true }, advance: { enabled: true } },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'pattern',
|
|
74
|
+
title: `@${i18n}.fields.pattern.title`,
|
|
75
|
+
groupId: 'pattern',
|
|
76
|
+
schema: {
|
|
77
|
+
dataType: 'string',
|
|
78
|
+
interface: {
|
|
79
|
+
type: core_1.AXPWidgetsList.Advanced.CodeEditor,
|
|
80
|
+
options: { language: 'plaintext', lineNumbers: true },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
validations: [{ rule: 'required' }],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'scopeConfig',
|
|
87
|
+
title: `@${i18n}.fields.scope-config.title`,
|
|
88
|
+
groupId: 'scope',
|
|
89
|
+
schema: {
|
|
90
|
+
dataType: 'object',
|
|
91
|
+
interface: {
|
|
92
|
+
type: core_1.AXPWidgetsList.Advanced.CodeEditor,
|
|
93
|
+
options: { language: 'json', lineNumbers: true, placeholder: '{}' },
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
columns: [{ name: 'name' }, { name: 'title' }, { name: 'entity' }, { name: 'pattern' }],
|
|
99
|
+
interfaces: {
|
|
100
|
+
master: {
|
|
101
|
+
create: {
|
|
102
|
+
sections: [{ id: 'basic-info' }, { id: 'pattern' }, { id: 'scope' }],
|
|
103
|
+
properties: [
|
|
104
|
+
{ name: 'name', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
|
|
105
|
+
{ name: 'title', layout: { positions: { lg: { colSpan: 6, order: 2 } } } },
|
|
106
|
+
{ name: 'entity', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
|
|
107
|
+
{ name: 'pattern', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
|
|
108
|
+
{ name: 'scopeConfig', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
update: {
|
|
112
|
+
sections: [{ id: 'basic-info' }, { id: 'pattern' }, { id: 'scope' }],
|
|
113
|
+
properties: [
|
|
114
|
+
{ name: 'name', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
|
|
115
|
+
{ name: 'title', layout: { positions: { lg: { colSpan: 6, order: 2 } } } },
|
|
116
|
+
{ name: 'entity', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
|
|
117
|
+
{ name: 'pattern', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
|
|
118
|
+
{ name: 'scopeConfig', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
single: {
|
|
122
|
+
title: '{{title}}',
|
|
123
|
+
sections: [
|
|
124
|
+
{ id: 'basic-info', layout: { positions: { lg: { colSpan: 12 } } } },
|
|
125
|
+
{ id: 'pattern', layout: { positions: { lg: { colSpan: 12 } } } },
|
|
126
|
+
{ id: 'scope', layout: { positions: { lg: { colSpan: 12 } } } },
|
|
127
|
+
],
|
|
128
|
+
properties: [
|
|
129
|
+
{ name: 'name', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
|
|
130
|
+
{ name: 'title', layout: { positions: { lg: { colSpan: 6, order: 2 } } } },
|
|
131
|
+
{ name: 'entity', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
|
|
132
|
+
{ name: 'pattern', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
|
|
133
|
+
{ name: 'scopeConfig', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
|
|
134
|
+
],
|
|
135
|
+
actions: [(0, entity_1.entityMasterDeleteAction)()],
|
|
136
|
+
},
|
|
137
|
+
list: {
|
|
138
|
+
actions: [...(0, entity_1.entityMasterCrudActions)()],
|
|
139
|
+
views: [(0, entity_1.createAllQueryView)({ sorts: [{ name: 'title', dir: 'asc' }] })],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
return entityDef;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
//# sourceMappingURL=identifier-rule.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-rule.entity.js","sourceRoot":"","sources":["../../../../../../../libs/modules/identifier-management/contracts/src/entities/identifier-rule/identifier-rule.entity.ts"],"names":[],"mappings":";;AAWA,sDAyIC;;AApJD,iEAAwE;AACxE,qEAKkD;AAClD,mDAA+C;AAE/C,0CAA0C;AAE1C,SAAsB,qBAAqB;;QACzC,MAAM,IAAI,GAAG,GAAG,wBAAU,CAAC,MAAM,CAAC,IAAI,2BAA2B,CAAC;QAElE,MAAM,SAAS,GAAc;YAC3B,MAAM,EAAE,wBAAU,CAAC,MAAM,CAAC,IAAI;YAC9B,IAAI,EAAE,wBAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI;YAC7C,KAAK,EAAE,wBAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK;YAC/C,IAAI,EAAE,wBAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI;YAC7C,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,OAAO,EAAE;gBACjB,EAAE,IAAI,EAAE,SAAS,EAAE;gBACnB;oBACE,IAAI,EAAE,eAAe;oBACrB,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE;iBAC7C;aACF;YACD,OAAO,EAAE;gBACP,UAAU,EAAE,wBAAU,CAAC,QAAQ,CAAC,cAAc,CAAC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IAAA,2BAAkB,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;qBACxE;iBACF;aACF;SACF,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC;CAAA;AAED,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-rule.types.js","sourceRoot":"","sources":["../../../../../../../libs/modules/identifier-management/contracts/src/entities/identifier-rule/identifier-rule.types.ts"],"names":[],"mappings":";AACA,gDAAgD;;AAQhD,YAAY"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./identifier-rule.types"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./identifier-rule.entity"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/modules/identifier-management/contracts/src/entities/identifier-rule/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC;AACxC,mEAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './identifier-rule';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/modules/identifier-management/contracts/src/entities/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ---- Identifier rule contracts ----
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.IDENTIFIER_RULE_ENTITY = void 0;
|
|
5
|
+
var core_1 = require("@acorex-platform/framework-shared/core");
|
|
6
|
+
Object.defineProperty(exports, "IDENTIFIER_RULE_ENTITY", { enumerable: true, get: function () { return core_1.IDENTIFIER_RULE_ENTITY; } });
|
|
7
|
+
//#endregion
|
|
8
|
+
//# sourceMappingURL=identifier-rule.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-rule.types.js","sourceRoot":"","sources":["../../../../../libs/modules/identifier-management/contracts/src/identifier-rule.types.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAI7C,+DAAgF;AAAvE,8GAAA,sBAAsB,OAAA;AAE/B,YAAY"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ---- Contracts barrel ----
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.IDENTIFIER_RULE_ENTITY = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
tslib_1.__exportStar(require("./permission.keys"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./menu.keys"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./identifier-rule.types"), exports);
|
|
9
|
+
var identifier_rule_types_1 = require("./identifier-rule.types");
|
|
10
|
+
Object.defineProperty(exports, "IDENTIFIER_RULE_ENTITY", { enumerable: true, get: function () { return identifier_rule_types_1.IDENTIFIER_RULE_ENTITY; } });
|
|
11
|
+
tslib_1.__exportStar(require("./root-config"), exports);
|
|
12
|
+
//#endregion
|
|
13
|
+
tslib_1.__exportStar(require("./entities"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/modules/identifier-management/contracts/src/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;AAEpC,4DAAkC;AAElC,sDAA4B;AAE5B,kEAAwC;AAExC,iEAAiE;AAAxD,+HAAA,sBAAsB,OAAA;AAE/B,wDAA8B;AAE9B,YAAY;AAEZ,qDAA2B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AXPIdentifierManagementMenuKeys = void 0;
|
|
4
|
+
exports.AXPIdentifierManagementMenuKeys = {
|
|
5
|
+
Root: 'IdentifierManagement:Menu',
|
|
6
|
+
IdentifierRules: 'IdentifierManagement:Menu:IdentifierRules',
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=menu.keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/identifier-management/contracts/src/menu.keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,+BAA+B,GAAG;IAC7C,IAAI,EAAE,2BAA2B;IACjC,eAAe,EAAE,2CAA2C;CACpD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AXMPermissionsKeys = void 0;
|
|
4
|
+
exports.AXMPermissionsKeys = {
|
|
5
|
+
IdentifierManagement: {
|
|
6
|
+
Management: 'IdentifierManagement:Permission:Management',
|
|
7
|
+
IdentifierRules: 'IdentifierManagement:Permission:IdentifierRules',
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=permission.keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/identifier-management/contracts/src/permission.keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;IAChC,oBAAoB,EAAE;QACpB,UAAU,EAAE,4CAA4C;QACxD,eAAe,EAAE,iDAAiD;KACnE;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const RootConfig: {
|
|
2
|
+
readonly config: {
|
|
3
|
+
readonly i18n: "identifier-management";
|
|
4
|
+
readonly module: "IdentifierManagement";
|
|
5
|
+
};
|
|
6
|
+
readonly module: {
|
|
7
|
+
readonly module: "identifier-management";
|
|
8
|
+
readonly name: "IdentifierManagement";
|
|
9
|
+
readonly title: "@identifier-management:module.title";
|
|
10
|
+
readonly icon: "fa-light fa-hashtag";
|
|
11
|
+
};
|
|
12
|
+
readonly entities: {
|
|
13
|
+
readonly identifierRule: {
|
|
14
|
+
readonly name: "IdentifierRule";
|
|
15
|
+
readonly source: "IdentifierManagement.IdentifierRule";
|
|
16
|
+
readonly title: "@identifier-management:entities.identifier-rule.title";
|
|
17
|
+
readonly titlePlural: "@identifier-management:entities.identifier-rule.plural";
|
|
18
|
+
readonly icon: "fa-light fa-barcode";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RootConfig = void 0;
|
|
4
|
+
const config = {
|
|
5
|
+
i18n: 'identifier-management',
|
|
6
|
+
module: 'IdentifierManagement',
|
|
7
|
+
};
|
|
8
|
+
exports.RootConfig = {
|
|
9
|
+
config,
|
|
10
|
+
module: {
|
|
11
|
+
module: 'identifier-management',
|
|
12
|
+
name: config.module,
|
|
13
|
+
title: `@${config.i18n}:module.title`,
|
|
14
|
+
icon: 'fa-light fa-hashtag',
|
|
15
|
+
},
|
|
16
|
+
entities: {
|
|
17
|
+
identifierRule: {
|
|
18
|
+
name: 'IdentifierRule',
|
|
19
|
+
source: `${config.module}.IdentifierRule`,
|
|
20
|
+
title: `@${config.i18n}:entities.identifier-rule.title`,
|
|
21
|
+
titlePlural: `@${config.i18n}:entities.identifier-rule.plural`,
|
|
22
|
+
icon: 'fa-light fa-barcode',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=root-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-config.js","sourceRoot":"","sources":["../../../../../libs/modules/identifier-management/contracts/src/root-config.ts"],"names":[],"mappings":";;;AAAA,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,uBAAuB;IAC7B,MAAM,EAAE,sBAAsB;CACtB,CAAC;AAEE,QAAA,UAAU,GAAG;IACxB,MAAM;IACN,MAAM,EAAE;QACN,MAAM,EAAE,uBAAuB;QAC/B,IAAI,EAAE,MAAM,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI,MAAM,CAAC,IAAI,eAAe;QACrC,IAAI,EAAE,qBAAqB;KAC5B;IACD,QAAQ,EAAE;QACR,cAAc,EAAE;YACd,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,iBAAiB;YACzC,KAAK,EAAE,IAAI,MAAM,CAAC,IAAI,iCAAiC;YACvD,WAAW,EAAE,IAAI,MAAM,CAAC,IAAI,kCAAkC;YAC9D,IAAI,EAAE,qBAAqB;SAC5B;KACF;CACO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@acorex-platform/module-identifier-management-server",
|
|
3
|
+
"version": "0.0.15",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./server/src/index.js",
|
|
6
|
+
"types": "./server/src/index.d.ts",
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"@nestjs/common": "^11.0.0",
|
|
9
|
+
"@acorex-platform/framework-server": "0.0.15",
|
|
10
|
+
"@acorex-platform/module-common-server": "0.0.15"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./server/src/index.d.ts",
|
|
16
|
+
"default": "./server/src/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./contracts": {
|
|
19
|
+
"types": "./contracts/src/index.d.ts",
|
|
20
|
+
"default": "./contracts/src/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./seed": {
|
|
23
|
+
"types": "./server/src/lib/seed/index.d.ts",
|
|
24
|
+
"default": "./server/src/lib/seed/index.js"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/identifier-management-server.module"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./lib/identifier-management.controller"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/identifier-commit.middleware"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/modules/identifier-management/server/src/index.ts"],"names":[],"mappings":";;;AAAA,oFAA0D;AAC1D,iFAAuD;AACvD,6EAAmD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AXPEntityOp, EntityStorageContext, EntityStorageMiddleware } from '@acorex-platform/framework-server/core';
|
|
2
|
+
import { BackendIdentifierEngineService } from '@acorex-platform/framework-server/identifier';
|
|
3
|
+
import { DomainDefinitionLoader } from '@acorex-platform/framework-server/domain/abstract';
|
|
4
|
+
import { BackendSessionService } from '@acorex-platform/framework-server/security';
|
|
5
|
+
/**
|
|
6
|
+
* Peeks identifier on create and commits sequence after successful persist.
|
|
7
|
+
* Ported from mock connectivity `identifier-commit.middleware.ts`.
|
|
8
|
+
*/
|
|
9
|
+
export declare class IdentifierCommitMiddleware implements EntityStorageMiddleware {
|
|
10
|
+
private readonly domainLoader;
|
|
11
|
+
private readonly identifierEngine;
|
|
12
|
+
private readonly session;
|
|
13
|
+
readonly target: {
|
|
14
|
+
ops: AXPEntityOp[];
|
|
15
|
+
order: number;
|
|
16
|
+
};
|
|
17
|
+
constructor(domainLoader: DomainDefinitionLoader, identifierEngine: BackendIdentifierEngineService, session: BackendSessionService);
|
|
18
|
+
execute(ctx: EntityStorageContext, next: () => Promise<void>): Promise<void>;
|
|
19
|
+
private resolveIdentifierConfig;
|
|
20
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdentifierCommitMiddleware = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const lodash_1 = require("lodash");
|
|
7
|
+
const identifier_1 = require("@acorex-platform/framework-server/identifier");
|
|
8
|
+
const abstract_1 = require("@acorex-platform/framework-server/domain/abstract");
|
|
9
|
+
const security_1 = require("@acorex-platform/framework-server/security");
|
|
10
|
+
//#region ---- Identifier commit middleware ----
|
|
11
|
+
/**
|
|
12
|
+
* Peeks identifier on create and commits sequence after successful persist.
|
|
13
|
+
* Ported from mock connectivity `identifier-commit.middleware.ts`.
|
|
14
|
+
*/
|
|
15
|
+
let IdentifierCommitMiddleware = class IdentifierCommitMiddleware {
|
|
16
|
+
constructor(domainLoader, identifierEngine, session) {
|
|
17
|
+
this.domainLoader = domainLoader;
|
|
18
|
+
this.identifierEngine = identifierEngine;
|
|
19
|
+
this.session = session;
|
|
20
|
+
this.target = {
|
|
21
|
+
ops: ['create'],
|
|
22
|
+
order: 30,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
execute(ctx, next) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const identifierConfig = yield this.resolveIdentifierConfig(ctx.entityName);
|
|
28
|
+
if (!identifierConfig || !ctx.data || typeof ctx.data !== 'object') {
|
|
29
|
+
yield next();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const data = ctx.data;
|
|
33
|
+
const session = this.session.getSession();
|
|
34
|
+
const identifierRequest = {
|
|
35
|
+
id: identifierConfig.rule,
|
|
36
|
+
tenantId: session === null || session === void 0 ? void 0 : session.tenantId,
|
|
37
|
+
appId: session === null || session === void 0 ? void 0 : session.applicationId,
|
|
38
|
+
};
|
|
39
|
+
const currentValue = (0, lodash_1.get)(data, identifierConfig.field);
|
|
40
|
+
if (!currentValue) {
|
|
41
|
+
const peek = yield this.identifierEngine.peek(identifierRequest);
|
|
42
|
+
(0, lodash_1.set)(data, identifierConfig.field, peek.code);
|
|
43
|
+
ctx.locals.set('identifierToken', peek.commitToken);
|
|
44
|
+
ctx.data = data;
|
|
45
|
+
}
|
|
46
|
+
yield next();
|
|
47
|
+
const token = ctx.locals.get('identifierToken');
|
|
48
|
+
if (token) {
|
|
49
|
+
yield this.identifierEngine.commitWithToken({ token });
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const codeValue = (0, lodash_1.get)(data, identifierConfig.field);
|
|
53
|
+
if (codeValue) {
|
|
54
|
+
try {
|
|
55
|
+
yield this.identifierEngine.commitByCode({
|
|
56
|
+
request: identifierRequest,
|
|
57
|
+
code: String(codeValue),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (_a) {
|
|
61
|
+
/* swallow */
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
resolveIdentifierConfig(entityName) {
|
|
67
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
var _a;
|
|
69
|
+
const def = yield this.domainLoader.loadEntity(entityName).catch(() => null);
|
|
70
|
+
const plugin = (_a = def === null || def === void 0 ? void 0 : def.plugins) === null || _a === void 0 ? void 0 : _a.find((p) => p.name === 'identifier');
|
|
71
|
+
if (!(plugin === null || plugin === void 0 ? void 0 : plugin.options)) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const field = plugin.options['field'];
|
|
75
|
+
const rule = plugin.options['rule'];
|
|
76
|
+
if (typeof field !== 'string' || typeof rule !== 'string') {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
return { field, rule };
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
exports.IdentifierCommitMiddleware = IdentifierCommitMiddleware;
|
|
84
|
+
exports.IdentifierCommitMiddleware = IdentifierCommitMiddleware = tslib_1.__decorate([
|
|
85
|
+
(0, common_1.Injectable)(),
|
|
86
|
+
tslib_1.__metadata("design:paramtypes", [abstract_1.DomainDefinitionLoader,
|
|
87
|
+
identifier_1.BackendIdentifierEngineService,
|
|
88
|
+
security_1.BackendSessionService])
|
|
89
|
+
], IdentifierCommitMiddleware);
|
|
90
|
+
//#endregion
|
|
91
|
+
//# sourceMappingURL=identifier-commit.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-commit.middleware.js","sourceRoot":"","sources":["../../../../../../libs/modules/identifier-management/server/src/lib/identifier-commit.middleware.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,mCAAkC;AAMlC,6EAA8F;AAC9F,gFAA2F;AAC3F,yEAAmF;AAEnF,gDAAgD;AAEhD;;;GAGG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAMrC,YACmB,YAAoC,EACpC,gBAAgD,EAChD,OAA8B;QAF9B,iBAAY,GAAZ,YAAY,CAAwB;QACpC,qBAAgB,GAAhB,gBAAgB,CAAgC;QAChD,YAAO,GAAP,OAAO,CAAuB;QARxC,WAAM,GAAG;YAChB,GAAG,EAAE,CAAC,QAAQ,CAAkB;YAChC,KAAK,EAAE,EAAE;SACV,CAAC;IAMC,CAAC;IAEE,OAAO,CAAC,GAAyB,EAAE,IAAyB;;YAChE,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC5E,IAAI,CAAC,gBAAgB,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACnE,MAAM,IAAI,EAAE,CAAC;gBACb,OAAO;YACT,CAA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B;wBAC1B,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC;qBACxB,CAAC,CAAC;gBACL,CAAC;gBAAC,WAAM,CAAC;oBACP,aAAa;gBACf,CAAC;YACH,CAAC;QACH,CAAC;KAAA;IAEa,uBAAuB,CACnC,UAAkB;;;YAElB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YAC7E,MAAM,MAAM,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;YAClE,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CAAA,EAAE,CAAC;gBACrB,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACtC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC1D,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;KAAA;CACF,CAAA;AAzEY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,mBAAU,GAAE;6CAQsB,iCAAsB;QAClB,2CAA8B;QACvC,gCAAqB;GATtC,0BAA0B,CAyEtC;AAED,YAAY"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdentifierManagementServerModule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const core_1 = require("@acorex-platform/framework-server/core");
|
|
7
|
+
const identifier_1 = require("@acorex-platform/framework-server/identifier");
|
|
8
|
+
const security_1 = require("@acorex-platform/framework-server/security");
|
|
9
|
+
const identifier_commit_middleware_1 = require("./identifier-commit.middleware");
|
|
10
|
+
const identifier_management_controller_1 = require("./identifier-management.controller");
|
|
11
|
+
//#region ---- Identifier management backend module ----
|
|
12
|
+
let IdentifierManagementServerModule = class IdentifierManagementServerModule {
|
|
13
|
+
};
|
|
14
|
+
exports.IdentifierManagementServerModule = IdentifierManagementServerModule;
|
|
15
|
+
exports.IdentifierManagementServerModule = IdentifierManagementServerModule = tslib_1.__decorate([
|
|
16
|
+
(0, common_1.Module)({
|
|
17
|
+
imports: [identifier_1.IdentifierModule.register(), core_1.EntityStorageModule, security_1.SecurityModule],
|
|
18
|
+
controllers: [identifier_management_controller_1.IdentifierManagementController],
|
|
19
|
+
providers: [
|
|
20
|
+
identifier_commit_middleware_1.IdentifierCommitMiddleware,
|
|
21
|
+
{
|
|
22
|
+
provide: core_1.ENTITY_STORAGE_MIDDLEWARE,
|
|
23
|
+
useExisting: identifier_commit_middleware_1.IdentifierCommitMiddleware,
|
|
24
|
+
multi: true,
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
exports: [identifier_1.IdentifierModule, identifier_commit_middleware_1.IdentifierCommitMiddleware, core_1.ENTITY_STORAGE_MIDDLEWARE],
|
|
28
|
+
})
|
|
29
|
+
], IdentifierManagementServerModule);
|
|
30
|
+
//#endregion
|
|
31
|
+
//# sourceMappingURL=identifier-management-server.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-management-server.module.js","sourceRoot":"","sources":["../../../../../../libs/modules/identifier-management/server/src/lib/identifier-management-server.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAuD;AACvD,iEAAwG;AACxG,6EAAgF;AAChF,yEAA4E;AAC5E,iFAA4E;AAC5E,yFAAoF;AAEpF,wDAAwD;AAcjD,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;CAAG,CAAA;AAAnC,4EAAgC;2CAAhC,gCAAgC;IAZ5C,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,6BAAgB,CAAC,QAAQ,EAAE,EAAE,0BAAmB,EAAE,yBAAc,CAAC;QAC3E,WAAW,EAAE,CAAC,iEAA8B,CAAC;QAC7C,SAAS,EAAE;YACT,yDAA0B;YAC1B;gBACE,OAAO,EAAE,gCAAyB;gBAClC,WAAW,EAAE,yDAA0B;gBACvC,KAAK,EAAE,IAAI;aACA;SAAC;QAChB,OAAO,EAAE,CAAC,6BAAgB,EAAE,yDAA0B,EAAE,gCAAyB,CAAC;KACnF,CAAC;GACW,gCAAgC,CAAG;AAEhD,YAAY"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BackendIdentifierEngineService, type BackendCommitByCodeBody, type BackendCommitTokenBody, type BackendIdentifierPeekResult, type BackendIdentifierRequest, type BackendIdentifierResult, type BackendValidateIdentifierBody } from '@acorex-platform/framework-server/identifier';
|
|
2
|
+
export declare class IdentifierManagementController {
|
|
3
|
+
private readonly engine;
|
|
4
|
+
constructor(engine: BackendIdentifierEngineService);
|
|
5
|
+
generate(body: BackendIdentifierRequest): Promise<BackendIdentifierResult>;
|
|
6
|
+
peek(body: BackendIdentifierRequest): Promise<BackendIdentifierPeekResult>;
|
|
7
|
+
validate(body: BackendValidateIdentifierBody): Promise<{
|
|
8
|
+
valid: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
commitWithToken(body: BackendCommitTokenBody): Promise<BackendIdentifierResult>;
|
|
11
|
+
commitByCode(body: BackendCommitByCodeBody): Promise<BackendIdentifierResult>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdentifierManagementController = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
7
|
+
const security_1 = require("@acorex-platform/framework-server/security");
|
|
8
|
+
const identifier_1 = require("@acorex-platform/framework-server/identifier");
|
|
9
|
+
//#region ---- Identifier management REST API ----
|
|
10
|
+
let IdentifierManagementController = class IdentifierManagementController {
|
|
11
|
+
constructor(engine) {
|
|
12
|
+
this.engine = engine;
|
|
13
|
+
}
|
|
14
|
+
generate(body) {
|
|
15
|
+
return this.engine.generate(body);
|
|
16
|
+
}
|
|
17
|
+
peek(body) {
|
|
18
|
+
return this.engine.peek(body);
|
|
19
|
+
}
|
|
20
|
+
validate(body) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const valid = yield this.engine.validate(body);
|
|
23
|
+
return { valid };
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
commitWithToken(body) {
|
|
27
|
+
return this.engine.commitWithToken(body);
|
|
28
|
+
}
|
|
29
|
+
commitByCode(body) {
|
|
30
|
+
return this.engine.commitByCode(body);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.IdentifierManagementController = IdentifierManagementController;
|
|
34
|
+
tslib_1.__decorate([
|
|
35
|
+
(0, common_1.Post)('identifiers/generate'),
|
|
36
|
+
(0, swagger_1.ApiOperation)({ summary: 'Generate identifier' }),
|
|
37
|
+
tslib_1.__param(0, (0, common_1.Body)()),
|
|
38
|
+
tslib_1.__metadata("design:type", Function),
|
|
39
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
40
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
41
|
+
], IdentifierManagementController.prototype, "generate", null);
|
|
42
|
+
tslib_1.__decorate([
|
|
43
|
+
(0, common_1.Post)('identifiers/peek'),
|
|
44
|
+
(0, swagger_1.ApiOperation)({ summary: 'Peek next identifier value' }),
|
|
45
|
+
tslib_1.__param(0, (0, common_1.Body)()),
|
|
46
|
+
tslib_1.__metadata("design:type", Function),
|
|
47
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
48
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
49
|
+
], IdentifierManagementController.prototype, "peek", null);
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
(0, common_1.Post)('identifiers/validate'),
|
|
52
|
+
(0, swagger_1.ApiOperation)({ summary: 'Validate identifier' }),
|
|
53
|
+
tslib_1.__param(0, (0, common_1.Body)()),
|
|
54
|
+
tslib_1.__metadata("design:type", Function),
|
|
55
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
56
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
57
|
+
], IdentifierManagementController.prototype, "validate", null);
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
(0, common_1.Post)('identifiers/commit-token'),
|
|
60
|
+
(0, swagger_1.ApiOperation)({ summary: 'Commit identifier with token' }),
|
|
61
|
+
tslib_1.__param(0, (0, common_1.Body)()),
|
|
62
|
+
tslib_1.__metadata("design:type", Function),
|
|
63
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
64
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
65
|
+
], IdentifierManagementController.prototype, "commitWithToken", null);
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, common_1.Post)('identifiers/commit-by-code'),
|
|
68
|
+
(0, swagger_1.ApiOperation)({ summary: 'Commit identifier by code' }),
|
|
69
|
+
tslib_1.__param(0, (0, common_1.Body)()),
|
|
70
|
+
tslib_1.__metadata("design:type", Function),
|
|
71
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
72
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
73
|
+
], IdentifierManagementController.prototype, "commitByCode", null);
|
|
74
|
+
exports.IdentifierManagementController = IdentifierManagementController = tslib_1.__decorate([
|
|
75
|
+
(0, swagger_1.ApiTags)('identifier-management'),
|
|
76
|
+
(0, swagger_1.ApiBearerAuth)(),
|
|
77
|
+
(0, common_1.UseGuards)(security_1.JwtAuthGuard),
|
|
78
|
+
(0, common_1.Controller)('v1/global/identifier-management'),
|
|
79
|
+
tslib_1.__metadata("design:paramtypes", [identifier_1.BackendIdentifierEngineService])
|
|
80
|
+
], IdentifierManagementController);
|
|
81
|
+
//#endregion
|
|
82
|
+
//# sourceMappingURL=identifier-management.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-management.controller.js","sourceRoot":"","sources":["../../../../../../libs/modules/identifier-management/server/src/lib/identifier-management.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAAmE;AACnE,6CAAuE;AACvE,yEAA0E;AAC1E,6EAQsD;AAEtD,kDAAkD;AAM3C,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACzC,YAA6B,MAAsC;QAAtC,WAAM,GAAN,MAAM,CAAgC;IAAG,CAAC;IAIvE,QAAQ,CAAS,IAA8B;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAID,IAAI,CAAS,IAA8B;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAIK,QAAQ,CAAS,IAAmC;;YACxD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC/C,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;KAAA;IAID,eAAe,CAAS,IAA4B;QAClD,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAID,YAAY,CAAS,IAA6B;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACF,CAAA;AAjCY,wEAA8B;AAKzC;IAFC,IAAA,aAAI,EAAC,sBAAsB,CAAC;IAC5B,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACvC,mBAAA,IAAA,aAAI,GAAE,CAAA;;;;8DAEf;AAID;IAFC,IAAA,aAAI,EAAC,kBAAkB,CAAC;IACxB,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IAClD,mBAAA,IAAA,aAAI,GAAE,CAAA;;;;0DAEX;AAIK;IAFL,IAAA,aAAI,EAAC,sBAAsB,CAAC;IAC5B,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,mBAAA,IAAA,aAAI,GAAE,CAAA;;;;8DAGrB;AAID;IAFC,IAAA,aAAI,EAAC,0BAA0B,CAAC;IAChC,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC;IACzC,mBAAA,IAAA,aAAI,GAAE,CAAA;;;;qEAEtB;AAID;IAFC,IAAA,aAAI,EAAC,4BAA4B,CAAC;IAClC,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACzC,mBAAA,IAAA,aAAI,GAAE,CAAA;;;;kEAEnB;yCAhCU,8BAA8B;IAJ1C,IAAA,iBAAO,EAAC,uBAAuB,CAAC;IAChC,IAAA,uBAAa,GAAE;IACf,IAAA,kBAAS,EAAC,uBAAY,CAAC;IACvB,IAAA,mBAAU,EAAC,iCAAiC,CAAC;6CAEP,2CAA8B;GADxD,8BAA8B,CAiC1C;AAED,YAAY"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface FormatIdentifierMockCodeOptions {
|
|
2
|
+
/** 1-based sequence index within the mock list. */
|
|
3
|
+
seq: number;
|
|
4
|
+
minValue?: number;
|
|
5
|
+
yyyymm?: string;
|
|
6
|
+
yyyy?: string;
|
|
7
|
+
yyyymmdd?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Renders a sample code from an identifier rule pattern for seed/mock data.
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatIdentifierMockCode(pattern: string, options: FormatIdentifierMockCodeOptions): string;
|
|
13
|
+
/** Builds sequential mock codes for a rule pattern. */
|
|
14
|
+
export declare function formatIdentifierMockCodes(pattern: string, count: number, options?: Omit<FormatIdentifierMockCodeOptions, 'seq'>): string[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ---- Identifier mock code formatter ----
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.formatIdentifierMockCode = formatIdentifierMockCode;
|
|
5
|
+
exports.formatIdentifierMockCodes = formatIdentifierMockCodes;
|
|
6
|
+
const DEFAULT_YYYYMM = '202607';
|
|
7
|
+
const DEFAULT_YYYY = '2026';
|
|
8
|
+
const DEFAULT_YYYYMMDD = '20260704';
|
|
9
|
+
/**
|
|
10
|
+
* Renders a sample code from an identifier rule pattern for seed/mock data.
|
|
11
|
+
*/
|
|
12
|
+
function formatIdentifierMockCode(pattern, options) {
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
|
+
const minValue = (_a = options.minValue) !== null && _a !== void 0 ? _a : 1;
|
|
15
|
+
const seqValue = minValue + options.seq - 1;
|
|
16
|
+
let result = pattern;
|
|
17
|
+
result = result.replace(/\{date:YYYYMM\}/g, (_b = options.yyyymm) !== null && _b !== void 0 ? _b : DEFAULT_YYYYMM);
|
|
18
|
+
result = result.replace(/\{date:YYYY\}/g, (_c = options.yyyy) !== null && _c !== void 0 ? _c : DEFAULT_YYYY);
|
|
19
|
+
result = result.replace(/\{date:YYYYMMDD\}/g, (_d = options.yyyymmdd) !== null && _d !== void 0 ? _d : DEFAULT_YYYYMMDD);
|
|
20
|
+
result = result.replace(/\{seq:(\d+)\}/, (_, pad) => String(seqValue).padStart(Number(pad), '0'));
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
/** Builds sequential mock codes for a rule pattern. */
|
|
24
|
+
function formatIdentifierMockCodes(pattern, count, options) {
|
|
25
|
+
return Array.from({ length: count }, (_, index) => formatIdentifierMockCode(pattern, Object.assign(Object.assign({}, options), { seq: index + 1 })));
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//# sourceMappingURL=identifier-mock-code.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-mock-code.util.js","sourceRoot":"","sources":["../../../../../../../../libs/modules/identifier-management/server/src/lib/seed/identifier-rule/identifier-mock-code.util.ts"],"names":[],"mappings":";AAAA,kDAAkD;;AAkBlD,4DAcC;AAGD,8DAQC;AAhCD,MAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAEpC;;GAEG;AACH,SAAgB,wBAAwB,CACtC,OAAe,EACf,OAAwC;;IAExC,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;IAC5C,IAAI,MAAM,GAAG,OAAO,CAAC;IACrB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,cAAc,CAAC,CAAC;IAC9E,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,YAAY,CAAC,CAAC;IACxE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,gBAAgB,CAAC,CAAC;IACpF,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE,GAAW,EAAE,EAAE,CAC1D,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAC5C,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,uDAAuD;AACvD,SAAgB,yBAAyB,CACvC,OAAe,EACf,KAAa,EACb,OAAsD;IAEtD,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAChD,wBAAwB,CAAC,OAAO,kCAAO,OAAO,KAAE,GAAG,EAAE,KAAK,GAAG,CAAC,IAAG,CAClE,CAAC;AACJ,CAAC;AAED,YAAY"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AXPEntitySeedDefinition, type AXPEntitySeedStorage } from '@acorex-platform/module-common-server/seed';
|
|
2
|
+
import { IDENTIFIER_RULE_ENTITY, type AXPIdentifierRule } from '@acorex-platform/module-identifier-management-contracts';
|
|
3
|
+
export { IDENTIFIER_RULE_ENTITY };
|
|
4
|
+
/**
|
|
5
|
+
* Inserts or updates identifier rules keyed by {@link AXPIdentifierRule.name}.
|
|
6
|
+
*/
|
|
7
|
+
export declare function seedIdentifierRuleRows(storage: AXPEntitySeedStorage, rows: readonly AXPIdentifierRule[]): Promise<void>;
|
|
8
|
+
export interface CreateIdentifierRuleSeedDefinitionInput {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly rows: readonly AXPIdentifierRule[];
|
|
11
|
+
}
|
|
12
|
+
export declare function createIdentifierRuleSeedDefinition(input: CreateIdentifierRuleSeedDefinitionInput): AXPEntitySeedDefinition;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IDENTIFIER_RULE_ENTITY = void 0;
|
|
4
|
+
exports.seedIdentifierRuleRows = seedIdentifierRuleRows;
|
|
5
|
+
exports.createIdentifierRuleSeedDefinition = createIdentifierRuleSeedDefinition;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const seed_1 = require("@acorex-platform/module-common-server/seed");
|
|
8
|
+
const module_identifier_management_contracts_1 = require("@acorex-platform/module-identifier-management-contracts");
|
|
9
|
+
Object.defineProperty(exports, "IDENTIFIER_RULE_ENTITY", { enumerable: true, get: function () { return module_identifier_management_contracts_1.IDENTIFIER_RULE_ENTITY; } });
|
|
10
|
+
function ruleStorageKey(row) {
|
|
11
|
+
const name = row['name'];
|
|
12
|
+
if (typeof name === 'string' && name.trim()) {
|
|
13
|
+
return name.trim();
|
|
14
|
+
}
|
|
15
|
+
const id = row['id'];
|
|
16
|
+
if (typeof id === 'string' && id.trim()) {
|
|
17
|
+
return id.trim();
|
|
18
|
+
}
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Inserts or updates identifier rules keyed by {@link AXPIdentifierRule.name}.
|
|
23
|
+
*/
|
|
24
|
+
function seedIdentifierRuleRows(storage, rows) {
|
|
25
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
var _a;
|
|
27
|
+
if (!rows.length) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const existing = yield storage.getAll(module_identifier_management_contracts_1.IDENTIFIER_RULE_ENTITY);
|
|
31
|
+
const existingByKey = new Map();
|
|
32
|
+
for (const row of existing) {
|
|
33
|
+
const key = ruleStorageKey(row);
|
|
34
|
+
if (key) {
|
|
35
|
+
existingByKey.set(key, row);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
for (const row of rows) {
|
|
39
|
+
const payload = Object.assign(Object.assign({}, row), { id: row.name, name: row.name, isDisabled: (_a = row.isDisabled) !== null && _a !== void 0 ? _a : false });
|
|
40
|
+
const existingRow = existingByKey.get(row.name);
|
|
41
|
+
if ((existingRow === null || existingRow === void 0 ? void 0 : existingRow['id']) && typeof existingRow['id'] === 'string') {
|
|
42
|
+
yield storage.updateOne(module_identifier_management_contracts_1.IDENTIFIER_RULE_ENTITY, existingRow['id'], payload);
|
|
43
|
+
}
|
|
44
|
+
else if (!existingByKey.has(row.name)) {
|
|
45
|
+
yield storage.insertOne(module_identifier_management_contracts_1.IDENTIFIER_RULE_ENTITY, payload);
|
|
46
|
+
}
|
|
47
|
+
existingByKey.set(row.name, payload);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function createIdentifierRuleSeedDefinition(input) {
|
|
52
|
+
return (0, seed_1.defineEntitySeed)({
|
|
53
|
+
name: input.name,
|
|
54
|
+
entityName: module_identifier_management_contracts_1.IDENTIFIER_RULE_ENTITY,
|
|
55
|
+
rows: input.rows,
|
|
56
|
+
seed: (storage) => seedIdentifierRuleRows(storage, input.rows),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
//# sourceMappingURL=identifier-rule-seed.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-rule-seed.util.js","sourceRoot":"","sources":["../../../../../../../../libs/modules/identifier-management/server/src/lib/seed/identifier-rule/identifier-rule-seed.util.ts"],"names":[],"mappings":";;;AA6BA,wDAgCC;AAOD,gFASC;;AA7ED,qEAIoD;AACpD,oHAGiE;AAIxD,uGANP,+DAAsB,OAMO;AAE/B,SAAS,cAAc,CAAC,GAA4B;IAClD,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IACrB,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;QACxC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;GAEG;AACH,SAAsB,sBAA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,CAAC;CAAA;AAOD,SAAgB,kCAAkC,CAChD,KAA8C;IAE9C,OAAO,IAAA,uBAAgB,EAAC;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,UAAU,EAAE,+DAAsB;QAClC,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,CAAC,OAA6B,EAAE,EAAE,CAAC,sBAAsB,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC;KACrF,CAAC,CAAC;AACL,CAAC;AAED,YAAY"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./identifier-rule-seed.util"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./identifier-mock-code.util"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/modules/identifier-management/server/src/lib/seed/identifier-rule/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,sEAA4C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface IdentifierManagementSeedContext {
|
|
2
|
+
moduleName: string;
|
|
3
|
+
route: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const identifierManagementSeedContext: {
|
|
6
|
+
moduleName: "IdentifierManagement";
|
|
7
|
+
route: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const identifierManagementSeedData: {
|
|
10
|
+
module: {
|
|
11
|
+
name: "IdentifierManagement";
|
|
12
|
+
title: "@identifier-management:module.title";
|
|
13
|
+
icon: "fa-light fa-hashtag";
|
|
14
|
+
i18n: "identifier-management";
|
|
15
|
+
required: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export * from './identifier-rule';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.identifierManagementSeedData = exports.identifierManagementSeedContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const module_identifier_management_contracts_1 = require("@acorex-platform/module-identifier-management-contracts");
|
|
6
|
+
exports.identifierManagementSeedContext = {
|
|
7
|
+
moduleName: module_identifier_management_contracts_1.RootConfig.module.name,
|
|
8
|
+
route: 'identifier-management',
|
|
9
|
+
};
|
|
10
|
+
exports.identifierManagementSeedData = {
|
|
11
|
+
module: {
|
|
12
|
+
name: module_identifier_management_contracts_1.RootConfig.module.name,
|
|
13
|
+
title: module_identifier_management_contracts_1.RootConfig.module.title,
|
|
14
|
+
icon: module_identifier_management_contracts_1.RootConfig.module.icon,
|
|
15
|
+
i18n: module_identifier_management_contracts_1.RootConfig.config.i18n,
|
|
16
|
+
required: false,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
tslib_1.__exportStar(require("./identifier-rule"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/modules/identifier-management/server/src/lib/seed/index.ts"],"names":[],"mappings":";;;;AAAA,oHAAqF;AAOxE,QAAA,+BAA+B,GAAG;IAC7C,UAAU,EAAE,mDAAU,CAAC,MAAM,CAAC,IAAI;IAClC,KAAK,EAAE,uBAAuB;CAC/B,CAAC;AAEW,QAAA,4BAA4B,GAAG;IAC1C,MAAM,EAAE;QACN,IAAI,EAAE,mDAAU,CAAC,MAAM,CAAC,IAAI;QAC5B,KAAK,EAAE,mDAAU,CAAC,MAAM,CAAC,KAAK;QAC9B,IAAI,EAAE,mDAAU,CAAC,MAAM,CAAC,IAAI;QAC5B,IAAI,EAAE,mDAAU,CAAC,MAAM,CAAC,IAAI;QAC5B,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC;AAEF,4DAAkC"}
|