@things-factory/id-rule 0.0.0-stage → 10.1.199
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/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +7 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/editors/grist-code-input-popup.d.ts +24 -0
- package/dist-client/editors/grist-code-input-popup.js +202 -0
- package/dist-client/editors/grist-code-input-popup.js.map +1 -0
- package/dist-client/editors/grist-code-input.d.ts +12 -0
- package/dist-client/editors/grist-code-input.js +118 -0
- package/dist-client/editors/grist-code-input.js.map +1 -0
- package/dist-client/index.d.ts +0 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/constants/index.d.ts +1 -0
- package/dist-server/constants/index.js +5 -0
- package/dist-server/constants/index.js.map +1 -0
- package/dist-server/constants/sequence-type.d.ts +3 -0
- package/dist-server/constants/sequence-type.js +7 -0
- package/dist-server/constants/sequence-type.js.map +1 -0
- package/dist-server/controllers/id-generator.d.ts +13 -0
- package/dist-server/controllers/id-generator.js +61 -0
- package/dist-server/controllers/id-generator.js.map +1 -0
- package/dist-server/controllers/index.d.ts +1 -0
- package/dist-server/controllers/index.js +5 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/index.d.ts +5 -0
- package/dist-server/index.js +9 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/migrations/index.d.ts +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/routes.d.ts +1 -0
- package/dist-server/routes.js +25 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/doc-number/doc-number-mutation.d.ts +9 -0
- package/dist-server/service/doc-number/doc-number-mutation.js +135 -0
- package/dist-server/service/doc-number/doc-number-mutation.js.map +1 -0
- package/dist-server/service/doc-number/doc-number-query.d.ts +13 -0
- package/dist-server/service/doc-number/doc-number-query.js +170 -0
- package/dist-server/service/doc-number/doc-number-query.js.map +1 -0
- package/dist-server/service/doc-number/doc-number-type.d.ts +41 -0
- package/dist-server/service/doc-number/doc-number-type.js +161 -0
- package/dist-server/service/doc-number/doc-number-type.js.map +1 -0
- package/dist-server/service/doc-number/doc-number.d.ts +29 -0
- package/dist-server/service/doc-number/doc-number.js +175 -0
- package/dist-server/service/doc-number/doc-number.js.map +1 -0
- package/dist-server/service/doc-number/index.d.ts +5 -0
- package/dist-server/service/doc-number/index.js +9 -0
- package/dist-server/service/doc-number/index.js.map +1 -0
- package/dist-server/service/id-rule/id-rule-mutation.d.ts +10 -0
- package/dist-server/service/id-rule/id-rule-mutation.js +50 -0
- package/dist-server/service/id-rule/id-rule-mutation.js.map +1 -0
- package/dist-server/service/id-rule/id-rule-query.d.ts +6 -0
- package/dist-server/service/id-rule/id-rule-query.js +41 -0
- package/dist-server/service/id-rule/id-rule-query.js.map +1 -0
- package/dist-server/service/id-rule/id-rule-types.d.ts +8 -0
- package/dist-server/service/id-rule/id-rule-types.js +34 -0
- package/dist-server/service/id-rule/id-rule-types.js.map +1 -0
- package/dist-server/service/id-rule/id-rule.d.ts +10 -0
- package/dist-server/service/id-rule/id-rule.js +50 -0
- package/dist-server/service/id-rule/id-rule.js.map +1 -0
- package/dist-server/service/id-rule/index.d.ts +5 -0
- package/dist-server/service/id-rule/index.js +9 -0
- package/dist-server/service/id-rule/index.js.map +1 -0
- package/dist-server/service/index.d.ts +8 -0
- package/dist-server/service/index.js +18 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/sequence/index.d.ts +4 -0
- package/dist-server/service/sequence/index.js +8 -0
- package/dist-server/service/sequence/index.js.map +1 -0
- package/dist-server/service/sequence/sequence-mutation.d.ts +4 -0
- package/dist-server/service/sequence/sequence-mutation.js +59 -0
- package/dist-server/service/sequence/sequence-mutation.js.map +1 -0
- package/dist-server/service/sequence/sequence.d.ts +12 -0
- package/dist-server/service/sequence/sequence.js +64 -0
- package/dist-server/service/sequence/sequence.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +35 -4
- package/tests/open-doors.test.ts +41 -0
- package/things-factory.config.js +5 -0
- package/translations/en.json +22 -0
- package/translations/es.json +22 -0
- package/translations/ja.json +22 -0
- package/translations/ko.json +22 -0
- package/translations/ms.json +22 -0
- package/translations/zh.json +22 -0
- package/README.md +0 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base';
|
|
2
|
+
import { Domain } from '@things-factory/shell';
|
|
3
|
+
export declare class DocNumber {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
code: string;
|
|
6
|
+
description: string;
|
|
7
|
+
prefix?: string;
|
|
8
|
+
suffix?: string;
|
|
9
|
+
startNo?: number;
|
|
10
|
+
endNo?: number;
|
|
11
|
+
currentNo?: number;
|
|
12
|
+
updateInterval?: string;
|
|
13
|
+
useDbSeqFlag?: boolean;
|
|
14
|
+
seqName?: string;
|
|
15
|
+
seqDigitNum: number;
|
|
16
|
+
separator?: string;
|
|
17
|
+
expression?: string;
|
|
18
|
+
lastDocNumber?: string;
|
|
19
|
+
activeFlag?: boolean;
|
|
20
|
+
domain: Domain;
|
|
21
|
+
domainId: string;
|
|
22
|
+
creator?: User;
|
|
23
|
+
creatorId?: string;
|
|
24
|
+
updater?: User;
|
|
25
|
+
updaterId?: string;
|
|
26
|
+
createdAt?: Date;
|
|
27
|
+
updatedAt?: Date;
|
|
28
|
+
updateExpression(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocNumber = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
|
+
const shell_1 = require("@things-factory/shell");
|
|
9
|
+
let DocNumber = class DocNumber {
|
|
10
|
+
updateExpression() {
|
|
11
|
+
if (!this.expression || this.expression.length == 0) {
|
|
12
|
+
if (!this.startNo || this.startNo < 1) {
|
|
13
|
+
this.startNo = 1;
|
|
14
|
+
}
|
|
15
|
+
if (!this.endNo || this.endNo <= 1) {
|
|
16
|
+
let maxNo = '';
|
|
17
|
+
for (let i = 0; i < this.seqDigitNum; i++) {
|
|
18
|
+
maxNo = maxNo + '9';
|
|
19
|
+
}
|
|
20
|
+
this.endNo = Number(maxNo);
|
|
21
|
+
}
|
|
22
|
+
let expr = '';
|
|
23
|
+
if (this.prefix) {
|
|
24
|
+
expr = this.prefix;
|
|
25
|
+
if (this.separator) {
|
|
26
|
+
expr += this.separator;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (this.updateInterval && this.updateInterval != 'NONE') {
|
|
30
|
+
expr += '${' + this.updateInterval + '}';
|
|
31
|
+
if (this.separator) {
|
|
32
|
+
expr += this.separator;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
expr += '${SEQ}';
|
|
36
|
+
if (this.suffix) {
|
|
37
|
+
if (this.separator) {
|
|
38
|
+
expr += this.separator;
|
|
39
|
+
}
|
|
40
|
+
expr += this.suffix;
|
|
41
|
+
}
|
|
42
|
+
this.expression = expr;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.DocNumber = DocNumber;
|
|
47
|
+
tslib_1.__decorate([
|
|
48
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
49
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
50
|
+
tslib_1.__metadata("design:type", String)
|
|
51
|
+
], DocNumber.prototype, "id", void 0);
|
|
52
|
+
tslib_1.__decorate([
|
|
53
|
+
(0, typeorm_1.Column)(),
|
|
54
|
+
(0, type_graphql_1.Field)(),
|
|
55
|
+
tslib_1.__metadata("design:type", String)
|
|
56
|
+
], DocNumber.prototype, "code", void 0);
|
|
57
|
+
tslib_1.__decorate([
|
|
58
|
+
(0, typeorm_1.Column)(),
|
|
59
|
+
(0, type_graphql_1.Field)(),
|
|
60
|
+
tslib_1.__metadata("design:type", String)
|
|
61
|
+
], DocNumber.prototype, "description", void 0);
|
|
62
|
+
tslib_1.__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
64
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
65
|
+
tslib_1.__metadata("design:type", String)
|
|
66
|
+
], DocNumber.prototype, "prefix", void 0);
|
|
67
|
+
tslib_1.__decorate([
|
|
68
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
69
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
70
|
+
tslib_1.__metadata("design:type", String)
|
|
71
|
+
], DocNumber.prototype, "suffix", void 0);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, typeorm_1.Column)({ type: 'integer', nullable: true }),
|
|
74
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
75
|
+
tslib_1.__metadata("design:type", Number)
|
|
76
|
+
], DocNumber.prototype, "startNo", void 0);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, typeorm_1.Column)({ type: 'integer', nullable: true }),
|
|
79
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
80
|
+
tslib_1.__metadata("design:type", Number)
|
|
81
|
+
], DocNumber.prototype, "endNo", void 0);
|
|
82
|
+
tslib_1.__decorate([
|
|
83
|
+
(0, typeorm_1.Column)({ type: 'integer', nullable: true }),
|
|
84
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
85
|
+
tslib_1.__metadata("design:type", Number)
|
|
86
|
+
], DocNumber.prototype, "currentNo", void 0);
|
|
87
|
+
tslib_1.__decorate([
|
|
88
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
89
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
90
|
+
tslib_1.__metadata("design:type", String)
|
|
91
|
+
], DocNumber.prototype, "updateInterval", void 0);
|
|
92
|
+
tslib_1.__decorate([
|
|
93
|
+
(0, typeorm_1.Column)({ nullable: true, default: false }),
|
|
94
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
95
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
96
|
+
], DocNumber.prototype, "useDbSeqFlag", void 0);
|
|
97
|
+
tslib_1.__decorate([
|
|
98
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
99
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
100
|
+
tslib_1.__metadata("design:type", String)
|
|
101
|
+
], DocNumber.prototype, "seqName", void 0);
|
|
102
|
+
tslib_1.__decorate([
|
|
103
|
+
(0, typeorm_1.Column)({ type: 'integer', nullable: false }),
|
|
104
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: false }),
|
|
105
|
+
tslib_1.__metadata("design:type", Number)
|
|
106
|
+
], DocNumber.prototype, "seqDigitNum", void 0);
|
|
107
|
+
tslib_1.__decorate([
|
|
108
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
109
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
110
|
+
tslib_1.__metadata("design:type", String)
|
|
111
|
+
], DocNumber.prototype, "separator", void 0);
|
|
112
|
+
tslib_1.__decorate([
|
|
113
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
114
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
115
|
+
tslib_1.__metadata("design:type", String)
|
|
116
|
+
], DocNumber.prototype, "expression", void 0);
|
|
117
|
+
tslib_1.__decorate([
|
|
118
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
119
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
120
|
+
tslib_1.__metadata("design:type", String)
|
|
121
|
+
], DocNumber.prototype, "lastDocNumber", void 0);
|
|
122
|
+
tslib_1.__decorate([
|
|
123
|
+
(0, typeorm_1.Column)({ type: 'boolean', nullable: true, default: false }),
|
|
124
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
125
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
126
|
+
], DocNumber.prototype, "activeFlag", void 0);
|
|
127
|
+
tslib_1.__decorate([
|
|
128
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain, { createForeignKeyConstraints: false, nullable: false }),
|
|
129
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
|
130
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
131
|
+
], DocNumber.prototype, "domain", void 0);
|
|
132
|
+
tslib_1.__decorate([
|
|
133
|
+
(0, typeorm_1.RelationId)((docNumber) => docNumber.domain),
|
|
134
|
+
tslib_1.__metadata("design:type", String)
|
|
135
|
+
], DocNumber.prototype, "domainId", void 0);
|
|
136
|
+
tslib_1.__decorate([
|
|
137
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { createForeignKeyConstraints: false, nullable: true }),
|
|
138
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
139
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
140
|
+
], DocNumber.prototype, "creator", void 0);
|
|
141
|
+
tslib_1.__decorate([
|
|
142
|
+
(0, typeorm_1.RelationId)((docNumber) => docNumber.creator),
|
|
143
|
+
tslib_1.__metadata("design:type", String)
|
|
144
|
+
], DocNumber.prototype, "creatorId", void 0);
|
|
145
|
+
tslib_1.__decorate([
|
|
146
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { createForeignKeyConstraints: false, nullable: true }),
|
|
147
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
148
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
149
|
+
], DocNumber.prototype, "updater", void 0);
|
|
150
|
+
tslib_1.__decorate([
|
|
151
|
+
(0, typeorm_1.RelationId)((docNumber) => docNumber.updater),
|
|
152
|
+
tslib_1.__metadata("design:type", String)
|
|
153
|
+
], DocNumber.prototype, "updaterId", void 0);
|
|
154
|
+
tslib_1.__decorate([
|
|
155
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
156
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
157
|
+
tslib_1.__metadata("design:type", Date)
|
|
158
|
+
], DocNumber.prototype, "createdAt", void 0);
|
|
159
|
+
tslib_1.__decorate([
|
|
160
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
161
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
162
|
+
tslib_1.__metadata("design:type", Date)
|
|
163
|
+
], DocNumber.prototype, "updatedAt", void 0);
|
|
164
|
+
tslib_1.__decorate([
|
|
165
|
+
(0, typeorm_1.BeforeInsert)(),
|
|
166
|
+
tslib_1.__metadata("design:type", Function),
|
|
167
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
168
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
169
|
+
], DocNumber.prototype, "updateExpression", null);
|
|
170
|
+
exports.DocNumber = DocNumber = tslib_1.__decorate([
|
|
171
|
+
(0, typeorm_1.Entity)('doc_numbers'),
|
|
172
|
+
(0, typeorm_1.Index)('ix_doc_number_0', (docNumber) => [docNumber.domain, docNumber.code], { unique: true }),
|
|
173
|
+
(0, type_graphql_1.ObjectType)({ description: 'Entity for DocNumber' })
|
|
174
|
+
], DocNumber);
|
|
175
|
+
//# sourceMappingURL=doc-number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-number.js","sourceRoot":"","sources":["../../../server/service/doc-number/doc-number.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAyD;AAEzD,yDAAgD;AAChD,iDAA8C;AAKvC,IAAM,SAAS,GAAf,MAAM,SAAS;IA+FpB,gBAAgB;QACd,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAA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AC;sCACd,IAAI;4CAAA;AAGhB;IADC,IAAA,sBAAY,GAAE;;;;iDA6Cd;oBA3IU,SAAS;IAHrB,IAAA,gBAAM,EAAC,aAAa,CAAC;IACrB,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,SAAoB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACxG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;GACvC,SAAS,CA4IrB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn,\n BeforeInsert\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\n@Entity('doc_numbers')\n@Index('ix_doc_number_0', (docNumber: DocNumber) => [docNumber.domain, docNumber.code], { unique: true })\n@ObjectType({ description: 'Entity for DocNumber' })\nexport class DocNumber {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column()\n @Field()\n code: string\n\n @Column()\n @Field()\n description: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n prefix?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n suffix?: string\n\n @Column({ type: 'integer', nullable: true })\n @Field(type => Int, { nullable: true })\n startNo?: number\n\n @Column({ type: 'integer', nullable: true })\n @Field(type => Int, { nullable: true })\n endNo?: number\n\n @Column({ type: 'integer', nullable: true })\n @Field(type => Int, { nullable: true })\n currentNo?: number\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updateInterval?: string\n\n @Column({ nullable: true, default: false })\n @Field({ nullable: true })\n useDbSeqFlag?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n seqName?: string\n\n @Column({ type: 'integer', nullable: false })\n @Field(type => Int, { nullable: false })\n seqDigitNum: number\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n separator?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n expression?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n lastDocNumber?: string\n\n @Column({ type: 'boolean', nullable: true, default: false })\n @Field({ nullable: true })\n activeFlag?: boolean\n\n @ManyToOne(type => Domain, { createForeignKeyConstraints: false, nullable: false })\n @Field({ nullable: false })\n domain: Domain\n\n @RelationId((docNumber: DocNumber) => docNumber.domain)\n domainId: string\n\n @ManyToOne(type => User, { createForeignKeyConstraints: false, nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((docNumber: DocNumber) => docNumber.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { createForeignKeyConstraints: false, nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((docNumber: DocNumber) => docNumber.updater)\n updaterId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @BeforeInsert()\n updateExpression() {\n if (!this.expression || this.expression.length == 0) {\n if (!this.startNo || this.startNo < 1) {\n this.startNo = 1\n }\n\n if (!this.endNo || this.endNo <= 1) {\n let maxNo = ''\n for (let i = 0; i < this.seqDigitNum; i++) {\n maxNo = maxNo + '9'\n }\n this.endNo = Number(maxNo)\n }\n\n let expr = ''\n\n if (this.prefix) {\n expr = this.prefix\n\n if (this.separator) {\n expr += this.separator\n }\n }\n\n if (this.updateInterval && this.updateInterval != 'NONE') {\n expr += '${' + this.updateInterval + '}'\n\n if (this.separator) {\n expr += this.separator\n }\n }\n\n expr += '${SEQ}'\n\n if (this.suffix) {\n if (this.separator) {\n expr += this.separator\n }\n\n expr += this.suffix\n }\n\n this.expression = expr\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DocNumber } from './doc-number';
|
|
2
|
+
import { DocNumberQuery } from './doc-number-query';
|
|
3
|
+
import { DocNumberMutation } from './doc-number-mutation';
|
|
4
|
+
export declare const entities: (typeof DocNumber)[];
|
|
5
|
+
export declare const resolvers: (typeof DocNumberQuery | typeof DocNumberMutation)[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const doc_number_1 = require("./doc-number");
|
|
5
|
+
const doc_number_query_1 = require("./doc-number-query");
|
|
6
|
+
const doc_number_mutation_1 = require("./doc-number-mutation");
|
|
7
|
+
exports.entities = [doc_number_1.DocNumber];
|
|
8
|
+
exports.resolvers = [doc_number_query_1.DocNumberQuery, doc_number_mutation_1.DocNumberMutation];
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/doc-number/index.ts"],"names":[],"mappings":";;;AACA,6CAAwC;AACxC,yDAAmD;AACnD,+DAAyD;AAE5C,QAAA,QAAQ,GAAG,CAAC,sBAAS,CAAC,CAAA;AACtB,QAAA,SAAS,GAAG,CAAC,iCAAc,EAAE,uCAAiB,CAAC,CAAA","sourcesContent":["\nimport { DocNumber } from './doc-number'\nimport { DocNumberQuery } from './doc-number-query'\nimport { DocNumberMutation } from './doc-number-mutation'\n\nexport const entities = [DocNumber]\nexport const resolvers = [DocNumberQuery, DocNumberMutation]\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IdRule } from './id-rule';
|
|
2
|
+
import { IdRulePatch, NewIdRule } from './id-rule-types';
|
|
3
|
+
export declare class IdRuleMutation {
|
|
4
|
+
createIdRule(idRule: NewIdRule, context: any): Promise<{
|
|
5
|
+
domain: any;
|
|
6
|
+
type: string;
|
|
7
|
+
rule: string;
|
|
8
|
+
} & IdRule>;
|
|
9
|
+
updateIdRule(type: string, patch: IdRulePatch, context: any): Promise<IdRule>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdRuleMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
|
+
const id_rule_1 = require("./id-rule");
|
|
8
|
+
const id_rule_types_1 = require("./id-rule-types");
|
|
9
|
+
let IdRuleMutation = class IdRuleMutation {
|
|
10
|
+
async createIdRule(idRule, context) {
|
|
11
|
+
return await (0, shell_1.getRepository)(id_rule_1.IdRule).save({
|
|
12
|
+
...idRule,
|
|
13
|
+
domain: context.state.domain
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async updateIdRule(type, patch, context) {
|
|
17
|
+
const repository = (0, shell_1.getRepository)(id_rule_1.IdRule);
|
|
18
|
+
const idRule = await repository.findOne({
|
|
19
|
+
where: { type: type, domain: { id: context.state.domain.id } }
|
|
20
|
+
});
|
|
21
|
+
return await repository.save({
|
|
22
|
+
...idRule,
|
|
23
|
+
...patch
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.IdRuleMutation = IdRuleMutation;
|
|
28
|
+
tslib_1.__decorate([
|
|
29
|
+
(0, type_graphql_1.Directive)('@privilege(category: "id-rule", privilege: "mutation", domainOwnerGranted: true)'),
|
|
30
|
+
(0, type_graphql_1.Mutation)(returns => id_rule_1.IdRule),
|
|
31
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('idRule')),
|
|
32
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
33
|
+
tslib_1.__metadata("design:type", Function),
|
|
34
|
+
tslib_1.__metadata("design:paramtypes", [id_rule_types_1.NewIdRule, Object]),
|
|
35
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
36
|
+
], IdRuleMutation.prototype, "createIdRule", null);
|
|
37
|
+
tslib_1.__decorate([
|
|
38
|
+
(0, type_graphql_1.Directive)('@privilege(category: "id-rule", privilege: "mutation", domainOwnerGranted: true)'),
|
|
39
|
+
(0, type_graphql_1.Mutation)(returns => id_rule_1.IdRule),
|
|
40
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('type')),
|
|
41
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
42
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
43
|
+
tslib_1.__metadata("design:type", Function),
|
|
44
|
+
tslib_1.__metadata("design:paramtypes", [String, id_rule_types_1.IdRulePatch, Object]),
|
|
45
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
46
|
+
], IdRuleMutation.prototype, "updateIdRule", null);
|
|
47
|
+
exports.IdRuleMutation = IdRuleMutation = tslib_1.__decorate([
|
|
48
|
+
(0, type_graphql_1.Resolver)(id_rule_1.IdRule)
|
|
49
|
+
], IdRuleMutation);
|
|
50
|
+
//# sourceMappingURL=id-rule-mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id-rule-mutation.js","sourceRoot":"","sources":["../../../server/service/id-rule/id-rule-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,iDAAqD;AAErD,uCAAkC;AAClC,mDAAwD;AAGjD,IAAM,cAAc,GAApB,MAAM,cAAc;IAGnB,AAAN,KAAK,CAAC,YAAY,CAAgB,MAAiB,EAAS,OAAY;QACtE,OAAO,MAAM,IAAA,qBAAa,EAAC,gBAAM,CAAC,CAAC,IAAI,CAAC;YACtC,GAAG,MAAM;YACT,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;SAC7B,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,YAAY,CACH,IAAY,EACX,KAAkB,EACzB,OAAY;QAEnB,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,gBAAM,CAAC,CAAA;QACxC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACtC,KAAK,EAAE,EAAE,IAAI,EAAE,IAAW,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE;SACtE,CAAC,CAAA;QAEF,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC;YAC3B,GAAG,MAAM;YACT,GAAG,KAAK;SACT,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA3BY,wCAAc;AAGnB;IAFL,IAAA,wBAAS,EAAC,kFAAkF,CAAC;IAC7F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,gBAAM,CAAC;IACR,mBAAA,IAAA,kBAAG,EAAC,QAAQ,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,yBAAS;;kDAKlD;AAIK;IAFL,IAAA,wBAAS,EAAC,kFAAkF,CAAC;IAC7F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,gBAAM,CAAC;IAEzB,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IACX,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;qDADe,2BAAW;;kDAYjC;yBA1BU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,gBAAM,CAAC;GACJ,cAAc,CA2B1B","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { IdRule } from './id-rule'\nimport { IdRulePatch, NewIdRule } from './id-rule-types'\n\n@Resolver(IdRule)\nexport class IdRuleMutation {\n @Directive('@privilege(category: \"id-rule\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => IdRule)\n async createIdRule(@Arg('idRule') idRule: NewIdRule, @Ctx() context: any) {\n return await getRepository(IdRule).save({\n ...idRule,\n domain: context.state.domain\n })\n }\n\n @Directive('@privilege(category: \"id-rule\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => IdRule)\n async updateIdRule(\n @Arg('type') type: string,\n @Arg('patch') patch: IdRulePatch,\n @Ctx() context: any\n ): Promise<IdRule> {\n const repository = getRepository(IdRule)\n const idRule = await repository.findOne({\n where: { type: type as any, domain: { id: context.state.domain.id } }\n })\n\n return await repository.save({\n ...idRule,\n ...patch\n })\n }\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdRuleQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
|
+
const id_rule_1 = require("./id-rule");
|
|
8
|
+
let IdRuleQuery = class IdRuleQuery {
|
|
9
|
+
async idRule(type, context) {
|
|
10
|
+
const rule = await (0, shell_1.getRepository)(id_rule_1.IdRule).findOne({
|
|
11
|
+
where: {
|
|
12
|
+
domain: { id: context.state.domain.id },
|
|
13
|
+
type: type
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return rule;
|
|
17
|
+
}
|
|
18
|
+
async domain(idRule) {
|
|
19
|
+
return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: idRule.domainId });
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.IdRuleQuery = IdRuleQuery;
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, type_graphql_1.Query)(returns => id_rule_1.IdRule, { nullable: true }),
|
|
25
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('type')),
|
|
26
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
27
|
+
tslib_1.__metadata("design:type", Function),
|
|
28
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
29
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
30
|
+
], IdRuleQuery.prototype, "idRule", null);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
33
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
34
|
+
tslib_1.__metadata("design:type", Function),
|
|
35
|
+
tslib_1.__metadata("design:paramtypes", [id_rule_1.IdRule]),
|
|
36
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
37
|
+
], IdRuleQuery.prototype, "domain", null);
|
|
38
|
+
exports.IdRuleQuery = IdRuleQuery = tslib_1.__decorate([
|
|
39
|
+
(0, type_graphql_1.Resolver)(id_rule_1.IdRule)
|
|
40
|
+
], IdRuleQuery);
|
|
41
|
+
//# sourceMappingURL=id-rule-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id-rule-query.js","sourceRoot":"","sources":["../../../server/service/id-rule/id-rule-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA6E;AAE7E,iDAA6D;AAE7D,uCAAkC;AAG3B,IAAM,WAAW,GAAjB,MAAM,WAAW;IAEhB,AAAN,KAAK,CAAC,MAAM,CAAc,IAAY,EAAS,OAAY;QACzD,MAAM,IAAI,GAAG,MAAM,IAAA,qBAAa,EAAC,gBAAM,CAAC,CAAC,OAAO,CAAC;YAC/C,KAAK,EAAE;gBACL,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE;gBACvC,IAAI,EAAE,IAAW;aAClB;SACF,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAS,MAAc;QACjC,OAAO,MAAM,IAAA,qBAAa,EAAC,cAAM,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;IACvE,CAAC;CACF,CAAA;AAjBY,kCAAW;AAEhB;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,gBAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/B,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yCAS7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAS,gBAAM;;yCAElC;sBAhBU,WAAW;IADvB,IAAA,uBAAQ,EAAC,gBAAM,CAAC;GACJ,WAAW,CAiBvB","sourcesContent":["import { Arg, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { Domain, getRepository } from '@things-factory/shell'\n\nimport { IdRule } from './id-rule'\n\n@Resolver(IdRule)\nexport class IdRuleQuery {\n @Query(returns => IdRule, { nullable: true })\n async idRule(@Arg('type') type: string, @Ctx() context: any): Promise<IdRule> {\n const rule = await getRepository(IdRule).findOne({\n where: {\n domain: { id: context.state.domain.id },\n type: type as any\n }\n })\n\n return rule\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() idRule: IdRule) {\n return await getRepository(Domain).findOneBy({ id: idRule.domainId })\n }\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NewIdRule = exports.IdRulePatch = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
let IdRulePatch = class IdRulePatch {
|
|
7
|
+
};
|
|
8
|
+
exports.IdRulePatch = IdRulePatch;
|
|
9
|
+
tslib_1.__decorate([
|
|
10
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
11
|
+
tslib_1.__metadata("design:type", String)
|
|
12
|
+
], IdRulePatch.prototype, "type", void 0);
|
|
13
|
+
tslib_1.__decorate([
|
|
14
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
15
|
+
tslib_1.__metadata("design:type", String)
|
|
16
|
+
], IdRulePatch.prototype, "rule", void 0);
|
|
17
|
+
exports.IdRulePatch = IdRulePatch = tslib_1.__decorate([
|
|
18
|
+
(0, type_graphql_1.InputType)()
|
|
19
|
+
], IdRulePatch);
|
|
20
|
+
let NewIdRule = class NewIdRule {
|
|
21
|
+
};
|
|
22
|
+
exports.NewIdRule = NewIdRule;
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, type_graphql_1.Field)(),
|
|
25
|
+
tslib_1.__metadata("design:type", String)
|
|
26
|
+
], NewIdRule.prototype, "type", void 0);
|
|
27
|
+
tslib_1.__decorate([
|
|
28
|
+
(0, type_graphql_1.Field)(),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], NewIdRule.prototype, "rule", void 0);
|
|
31
|
+
exports.NewIdRule = NewIdRule = tslib_1.__decorate([
|
|
32
|
+
(0, type_graphql_1.InputType)()
|
|
33
|
+
], NewIdRule);
|
|
34
|
+
//# sourceMappingURL=id-rule-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id-rule-types.js","sourceRoot":"","sources":["../../../server/service/id-rule/id-rule-types.ts"],"names":[],"mappings":";;;;AAAA,+CAA+C;AAIxC,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AANY,kCAAW;AAEtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACb;sBALF,WAAW;IADvB,IAAA,wBAAS,GAAE;GACC,WAAW,CAMvB;AAGM,IAAM,SAAS,GAAf,MAAM,SAAS;CAMrB,CAAA;AANY,8BAAS;AAEpB;IADC,IAAA,oBAAK,GAAE;;uCACI;AAGZ;IADC,IAAA,oBAAK,GAAE;;uCACI;oBALD,SAAS;IADrB,IAAA,wBAAS,GAAE;GACC,SAAS,CAMrB","sourcesContent":["import { Field, InputType } from 'type-graphql'\n\n\n@InputType()\nexport class IdRulePatch {\n @Field({ nullable: true })\n type?: string\n\n @Field({ nullable: true })\n rule?: string\n}\n\n@InputType()\nexport class NewIdRule {\n @Field()\n type: string\n\n @Field()\n rule: string\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdRule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
let IdRule = class IdRule {
|
|
9
|
+
};
|
|
10
|
+
exports.IdRule = IdRule;
|
|
11
|
+
tslib_1.__decorate([
|
|
12
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
13
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
14
|
+
tslib_1.__metadata("design:type", String)
|
|
15
|
+
], IdRule.prototype, "id", void 0);
|
|
16
|
+
tslib_1.__decorate([
|
|
17
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
18
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
|
19
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
20
|
+
], IdRule.prototype, "domain", void 0);
|
|
21
|
+
tslib_1.__decorate([
|
|
22
|
+
(0, typeorm_1.RelationId)((idRule) => idRule.domain),
|
|
23
|
+
tslib_1.__metadata("design:type", String)
|
|
24
|
+
], IdRule.prototype, "domainId", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, typeorm_1.Column)(),
|
|
27
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
28
|
+
tslib_1.__metadata("design:type", String)
|
|
29
|
+
], IdRule.prototype, "type", void 0);
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
(0, typeorm_1.Column)(),
|
|
32
|
+
(0, type_graphql_1.Field)(),
|
|
33
|
+
tslib_1.__metadata("design:type", String)
|
|
34
|
+
], IdRule.prototype, "rule", void 0);
|
|
35
|
+
tslib_1.__decorate([
|
|
36
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
37
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
38
|
+
tslib_1.__metadata("design:type", Date)
|
|
39
|
+
], IdRule.prototype, "createdAt", void 0);
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
42
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
43
|
+
tslib_1.__metadata("design:type", Date)
|
|
44
|
+
], IdRule.prototype, "updatedAt", void 0);
|
|
45
|
+
exports.IdRule = IdRule = tslib_1.__decorate([
|
|
46
|
+
(0, typeorm_1.Entity)(),
|
|
47
|
+
(0, typeorm_1.Index)('ix_id_rule_1', (idRule) => [idRule.domain]),
|
|
48
|
+
(0, type_graphql_1.ObjectType)()
|
|
49
|
+
], IdRule);
|
|
50
|
+
//# sourceMappingURL=id-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id-rule.js","sourceRoot":"","sources":["../../../server/service/id-rule/id-rule.ts"],"names":[],"mappings":";;;;AAAA,+CAIqB;AACrB,qCASgB;AAEhB,iDAA8C;AAKvC,IAAM,MAAM,GAAZ,MAAM,MAAM;CA2BlB,CAAA;AA3BY,wBAAM;AAGR;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;kCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;sCACd,cAAM;sCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;;wCAC9B;AAIhB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oCACd;AAIZ;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;oCACI;AAIZ;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACf,IAAI;yCAAA;AAIf;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACf,IAAI;yCAAA;iBA1BJ,MAAM;IAHlB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAA,yBAAU,GAAE;GACA,MAAM,CA2BlB","sourcesContent":["import {\n Field,\n ID,\n ObjectType\n} from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { Domain } from '@things-factory/shell'\n\n@Entity()\n@Index('ix_id_rule_1', (idRule: IdRule) => [idRule.domain])\n@ObjectType()\nexport class IdRule {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain: Domain\n\n @RelationId((idRule: IdRule) => idRule.domain)\n domainId: string\n\n @Column()\n @Field({ nullable: true })\n type: string\n\n @Column()\n @Field()\n rule: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt: Date\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IdRule } from './id-rule';
|
|
2
|
+
import { IdRuleMutation } from './id-rule-mutation';
|
|
3
|
+
import { IdRuleQuery } from './id-rule-query';
|
|
4
|
+
export declare const entities: (typeof IdRule)[];
|
|
5
|
+
export declare const resolvers: (typeof IdRuleMutation | typeof IdRuleQuery)[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const id_rule_1 = require("./id-rule");
|
|
5
|
+
const id_rule_mutation_1 = require("./id-rule-mutation");
|
|
6
|
+
const id_rule_query_1 = require("./id-rule-query");
|
|
7
|
+
exports.entities = [id_rule_1.IdRule];
|
|
8
|
+
exports.resolvers = [id_rule_query_1.IdRuleQuery, id_rule_mutation_1.IdRuleMutation];
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/id-rule/index.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAClC,yDAAmD;AACnD,mDAA6C;AAEhC,QAAA,QAAQ,GAAG,CAAC,gBAAM,CAAC,CAAA;AACnB,QAAA,SAAS,GAAG,CAAC,2BAAW,EAAE,iCAAc,CAAC,CAAA","sourcesContent":["import { IdRule } from './id-rule'\nimport { IdRuleMutation } from './id-rule-mutation'\nimport { IdRuleQuery } from './id-rule-query'\n\nexport const entities = [IdRule]\nexport const resolvers = [IdRuleQuery, IdRuleMutation]\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './id-rule/id-rule';
|
|
2
|
+
export * from './id-rule/id-rule-types';
|
|
3
|
+
export * from './sequence/sequence';
|
|
4
|
+
export * from './doc-number/doc-number';
|
|
5
|
+
export declare const entities: (typeof import("./id-rule/id-rule").IdRule | typeof import("./sequence/sequence").Sequence | typeof import("./doc-number/doc-number").DocNumber)[];
|
|
6
|
+
export declare const schema: {
|
|
7
|
+
resolverClasses: (typeof import("./id-rule/id-rule-mutation").IdRuleMutation | typeof import("./id-rule/id-rule-query").IdRuleQuery | typeof import("./sequence/sequence-mutation").SequenceMutation | typeof import("./doc-number/doc-number-query").DocNumberQuery | typeof import("./doc-number/doc-number-mutation").DocNumberMutation)[];
|
|
8
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = exports.entities = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const id_rule_1 = require("./id-rule");
|
|
6
|
+
const sequence_1 = require("./sequence");
|
|
7
|
+
const doc_number_1 = require("./doc-number");
|
|
8
|
+
/* EXPORT ENTITY TYPES */
|
|
9
|
+
tslib_1.__exportStar(require("./id-rule/id-rule"), exports);
|
|
10
|
+
/* EXPORT TYPES */
|
|
11
|
+
tslib_1.__exportStar(require("./id-rule/id-rule-types"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./sequence/sequence"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./doc-number/doc-number"), exports);
|
|
14
|
+
exports.entities = [...id_rule_1.entities, ...sequence_1.entities, ...doc_number_1.entities];
|
|
15
|
+
exports.schema = {
|
|
16
|
+
resolverClasses: [...id_rule_1.resolvers, ...sequence_1.resolvers, ...doc_number_1.resolvers]
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,uCAAoF;AACpF,yCAAyF;AACzF,6CAA6F;AAE7F,yBAAyB;AACzB,4DAAiC;AACjC,kBAAkB;AAClB,kEAAuC;AACvC,8DAAmC;AACnC,kEAAuC;AAE1B,QAAA,QAAQ,GAAG,CAAC,GAAG,kBAAc,EAAE,GAAG,mBAAgB,EAAE,GAAG,qBAAiB,CAAC,CAAA;AAEzE,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE,CAAC,GAAG,mBAAe,EAAE,GAAG,oBAAiB,EAAE,GAAG,sBAAkB,CAAC;CACnF,CAAA","sourcesContent":["import { entities as IdRuleEntities, resolvers as IdRuleResolvers } from './id-rule'\nimport { entities as SequenceEntities, resolvers as SequenceResolvers } from './sequence'\nimport { entities as DocNumberEntities, resolvers as DocNumberResolvers } from './doc-number'\n\n/* EXPORT ENTITY TYPES */\nexport * from './id-rule/id-rule'\n/* EXPORT TYPES */\nexport * from './id-rule/id-rule-types'\nexport * from './sequence/sequence'\nexport * from './doc-number/doc-number'\n\nexport const entities = [...IdRuleEntities, ...SequenceEntities, ...DocNumberEntities]\n\nexport const schema = {\n resolverClasses: [...IdRuleResolvers, ...SequenceResolvers, ...DocNumberResolvers]\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const sequence_1 = require("./sequence");
|
|
5
|
+
const sequence_mutation_1 = require("./sequence-mutation");
|
|
6
|
+
exports.entities = [sequence_1.Sequence];
|
|
7
|
+
exports.resolvers = [sequence_mutation_1.SequenceMutation];
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/sequence/index.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,2DAAsD;AAEzC,QAAA,QAAQ,GAAG,CAAC,mBAAQ,CAAC,CAAA;AACrB,QAAA,SAAS,GAAG,CAAC,oCAAgB,CAAC,CAAA","sourcesContent":["import { Sequence } from './sequence'\nimport { SequenceMutation } from './sequence-mutation'\n\nexport const entities = [Sequence]\nexport const resolvers = [SequenceMutation]\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SequenceMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
const sequence_1 = require("./sequence");
|
|
9
|
+
let SequenceMutation = class SequenceMutation {
|
|
10
|
+
async upsertSequence(type, counter, bizplaceId, context) {
|
|
11
|
+
const { domain } = context.state;
|
|
12
|
+
const seqRepo = (0, shell_1.getRepository)(sequence_1.Sequence);
|
|
13
|
+
const now = new Date();
|
|
14
|
+
const expiresAt = new Date(now.setMonth(now.getMonth() + 12));
|
|
15
|
+
const patternObj = {
|
|
16
|
+
type,
|
|
17
|
+
date: new Date().toISOString().split('T')[0],
|
|
18
|
+
bizplaceId
|
|
19
|
+
};
|
|
20
|
+
const pattern = JSON.stringify(patternObj);
|
|
21
|
+
const foundSeq = await seqRepo.findOne({
|
|
22
|
+
where: { pattern, type: constants_1.SEQUENCE_TYPE.PRODUCT_LABEL_COUNTER, domain: { id: domain.id } }
|
|
23
|
+
});
|
|
24
|
+
if (foundSeq) {
|
|
25
|
+
await seqRepo.update({ id: foundSeq.id }, {
|
|
26
|
+
pattern,
|
|
27
|
+
seq: counter ? foundSeq.seq + counter : foundSeq.seq + 1,
|
|
28
|
+
expiresAt,
|
|
29
|
+
updatedAt: now
|
|
30
|
+
});
|
|
31
|
+
return await seqRepo.findOneBy({ id: foundSeq.id });
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return await seqRepo.save({
|
|
35
|
+
domain,
|
|
36
|
+
pattern,
|
|
37
|
+
seq: counter || 1,
|
|
38
|
+
expiresAt,
|
|
39
|
+
type: constants_1.SEQUENCE_TYPE.PRODUCT_LABEL_COUNTER
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.SequenceMutation = SequenceMutation;
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, type_graphql_1.Directive)('@privilege(category: "id-rule", privilege: "mutation", domainOwnerGranted: true)'),
|
|
47
|
+
(0, type_graphql_1.Mutation)(returns => sequence_1.Sequence),
|
|
48
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('type')),
|
|
49
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('counter')),
|
|
50
|
+
tslib_1.__param(2, (0, type_graphql_1.Arg)('bizplaceId')),
|
|
51
|
+
tslib_1.__param(3, (0, type_graphql_1.Ctx)()),
|
|
52
|
+
tslib_1.__metadata("design:type", Function),
|
|
53
|
+
tslib_1.__metadata("design:paramtypes", [String, Number, String, Object]),
|
|
54
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
55
|
+
], SequenceMutation.prototype, "upsertSequence", null);
|
|
56
|
+
exports.SequenceMutation = SequenceMutation = tslib_1.__decorate([
|
|
57
|
+
(0, type_graphql_1.Resolver)(sequence_1.Sequence)
|
|
58
|
+
], SequenceMutation);
|
|
59
|
+
//# sourceMappingURL=sequence-mutation.js.map
|