@things-factory/kpi 9.0.37 → 9.0.39
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-server/service/kpi-value/kpi-value.d.ts +1 -0
- package/dist-server/service/kpi-value/kpi-value.js +14 -1
- package/dist-server/service/kpi-value/kpi-value.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/server/service/kpi-value/kpi-value.ts +13 -1
|
@@ -76,9 +76,20 @@ tslib_1.__decorate([
|
|
|
76
76
|
}),
|
|
77
77
|
tslib_1.__metadata("design:type", Number)
|
|
78
78
|
], KpiValue.prototype, "score", void 0);
|
|
79
|
+
tslib_1.__decorate([
|
|
80
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
81
|
+
(0, type_graphql_1.Field)(type => String, {
|
|
82
|
+
nullable: true,
|
|
83
|
+
description: 'Group key for this value (organization, line, user, project, etc.)'
|
|
84
|
+
}),
|
|
85
|
+
tslib_1.__metadata("design:type", String)
|
|
86
|
+
], KpiValue.prototype, "group", void 0);
|
|
79
87
|
tslib_1.__decorate([
|
|
80
88
|
(0, typeorm_1.ManyToOne)(() => kpi_org_scope_1.KpiOrgScope, { nullable: true }),
|
|
81
|
-
(0, type_graphql_1.Field)(type => kpi_org_scope_1.KpiOrgScope, {
|
|
89
|
+
(0, type_graphql_1.Field)(type => kpi_org_scope_1.KpiOrgScope, {
|
|
90
|
+
nullable: true,
|
|
91
|
+
description: 'Reference to the organization scope mapping for this KPI value.'
|
|
92
|
+
}),
|
|
82
93
|
tslib_1.__metadata("design:type", kpi_org_scope_1.KpiOrgScope)
|
|
83
94
|
], KpiValue.prototype, "kpiOrgScope", void 0);
|
|
84
95
|
tslib_1.__decorate([
|
|
@@ -157,6 +168,8 @@ exports.KpiValue = KpiValue = tslib_1.__decorate([
|
|
|
157
168
|
(0, typeorm_1.Entity)(),
|
|
158
169
|
(0, typeorm_1.Index)('ix_kpi_value_latest', ['domain', 'kpi', 'valueDate', 'kpiOrgScope', 'version'], { unique: true }),
|
|
159
170
|
(0, typeorm_1.Index)('ix_kpi_value_latest_for_query', ['domain', 'kpi', 'valueDate', 'kpiOrgScope'], { unique: false }),
|
|
171
|
+
(0, typeorm_1.Index)('ix_kpi_value_group_kpi', ['domain', 'group', 'kpi', 'valueDate'], { unique: false }),
|
|
172
|
+
(0, typeorm_1.Index)('ix_kpi_value_kpi_group', ['domain', 'kpi', 'group', 'valueDate'], { unique: false }),
|
|
160
173
|
(0, type_graphql_1.ObjectType)({ description: 'Entity for KpiValue' })
|
|
161
174
|
], KpiValue);
|
|
162
175
|
//# sourceMappingURL=kpi-value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-value.js","sourceRoot":"","sources":["../../../server/service/kpi-value/kpi-value.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAAkF;AAElF,yDAAgD;AAChD,iDAA8E;AAC9E,6CAA4C;AAC5C,oCAA+C;AAC/C,kEAA4D;AAE5D,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,kCAAa,CAAA;AACf,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,IAAA,+BAAgB,EAAC,iBAAiB,EAAE;IAClC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,oCAAoC;CAClD,CAAC,CAAA;AAMK,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAgHpB,CAAA;AAhHY,4BAAQ;AAGV;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;;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AK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;sCAC3F,gBAAI;yCAAA;AAId;IAFC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;IACpD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;;2CAC/E;mBA/GP,QAAQ;IAJpB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,qBAAqB,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACxG,IAAA,eAAK,EAAC,+BAA+B,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACxG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CAgHpB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType, Float } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, ScalarObject, json5Transformer } from '@things-factory/shell'\nimport { config } from '@things-factory/env'\nimport { Kpi, KpiPeriodType } from '../kpi/kpi'\nimport { KpiOrgScope } from '../kpi-org-scope/kpi-org-scope'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\nexport enum KpiValueInputType {\n MANUAL = 'MANUAL',\n AUTO = 'AUTO'\n}\n\nregisterEnumType(KpiValueInputType, {\n name: 'KpiValueInputType',\n description: 'Type of the input (Manual or Auto)'\n})\n\n@Entity()\n@Index('ix_kpi_value_latest', ['domain', 'kpi', 'valueDate', 'kpiOrgScope', 'version'], { unique: true })\n@Index('ix_kpi_value_latest_for_query', ['domain', 'kpi', 'valueDate', 'kpiOrgScope'], { unique: false })\n@ObjectType({ description: 'Entity for KpiValue' })\nexport class KpiValue {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for this KPI value record.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true, description: 'Domain (tenant) to which this KPI value belongs.' })\n domain?: Domain\n\n @RelationId((kpiValue: KpiValue) => kpiValue.domain)\n @Field({ nullable: true, description: 'ID of the domain (tenant) for this KPI value.' })\n domainId?: string\n\n @ManyToOne(() => Kpi)\n @Field(type => Kpi, {\n nullable: true,\n description: 'Reference to the KPI definition for which this value is calculated.'\n })\n kpi: Kpi\n\n @RelationId((kpiValue: KpiValue) => kpiValue.kpi)\n @Field({ description: 'ID of the referenced KPI.' })\n kpiId: string\n\n @Column('int')\n @Field(type => Int, { description: 'Version of the KPI definition at the time this value was calculated.' })\n version: number\n\n @Column()\n @Field({\n description:\n 'Date or period for which this KPI value is recorded (e.g., day: YYYY-MM-DD, month: YYYY-MM, quarter: YYYY-Qn, range: YYYY-MM-DD~YYYY-MM-DD).'\n })\n valueDate: string\n\n @Column('float')\n @Field(type => Float, { description: 'The calculated numeric value for this KPI and period.' })\n value: number\n\n @Column('float', { nullable: true })\n @Field(type => Float, {\n nullable: true,\n description: 'Performance score calculated from KPI value using scoreFormula or grades lookup table. Range: 0-1.'\n })\n score?: number\n\n @ManyToOne(() => KpiOrgScope, { nullable: true })\n @Field(type => KpiOrgScope, { nullable: true, description: 'Reference to the organization scope mapping for this KPI value.' })\n kpiOrgScope?: KpiOrgScope\n\n @RelationId((kpiValue: KpiValue) => kpiValue.kpiOrgScope)\n @Field({ nullable: true, description: 'ID of the referenced KPI organization scope.' })\n kpiOrgScopeId?: string\n\n @Column({ nullable: true })\n @Field({\n nullable: true,\n description: 'Indicates whether this value was entered manually or generated automatically.'\n })\n inputType?: KpiValueInputType\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Source of the value (e.g., system, user, external integration).' })\n source?: string\n\n @Column({\n nullable: true,\n type:\n DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'longtext'\n : DATABASE_TYPE == 'oracle'\n ? 'clob'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined,\n transformer: json5Transformer\n })\n @Field(type => ScalarObject, {\n nullable: true,\n description:\n 'Extended or non-numeric information related to this KPI value, stored as JSON5. Can include grade, status, comments, or other metadata.'\n })\n meta?: any\n\n @Column({ default: 'DAY' })\n @Field(type => KpiPeriodType, { description: 'Aggregation period type for this KPI value.' })\n periodType: KpiPeriodType\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI value record was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI value record was last updated.' })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who created this KPI value record.' })\n creator?: User\n\n @RelationId((kpiValue: KpiValue) => kpiValue.creator)\n @Field({ nullable: true, description: 'ID of the user who created this KPI value record.' })\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who last updated this KPI value record.' })\n updater?: User\n\n @RelationId((kpiValue: KpiValue) => kpiValue.updater)\n @Field({ nullable: true, description: 'ID of the user who last updated this KPI value record.' })\n updaterId?: string\n}\n"]}
|
|
1
|
+
{"version":3,"file":"kpi-value.js","sourceRoot":"","sources":["../../../server/service/kpi-value/kpi-value.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAAkF;AAElF,yDAAgD;AAChD,iDAA8E;AAC9E,6CAA4C;AAC5C,oCAA+C;AAC/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EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACxG,IAAA,eAAK,EAAC,+BAA+B,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACxG,IAAA,eAAK,EAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3F,IAAA,eAAK,EAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3F,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CA0HpB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType, Float } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, ScalarObject, json5Transformer } from '@things-factory/shell'\nimport { config } from '@things-factory/env'\nimport { Kpi, KpiPeriodType } from '../kpi/kpi'\nimport { KpiOrgScope } from '../kpi-org-scope/kpi-org-scope'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\nexport enum KpiValueInputType {\n MANUAL = 'MANUAL',\n AUTO = 'AUTO'\n}\n\nregisterEnumType(KpiValueInputType, {\n name: 'KpiValueInputType',\n description: 'Type of the input (Manual or Auto)'\n})\n\n@Entity()\n@Index('ix_kpi_value_latest', ['domain', 'kpi', 'valueDate', 'kpiOrgScope', 'version'], { unique: true })\n@Index('ix_kpi_value_latest_for_query', ['domain', 'kpi', 'valueDate', 'kpiOrgScope'], { unique: false })\n@Index('ix_kpi_value_group_kpi', ['domain', 'group', 'kpi', 'valueDate'], { unique: false })\n@Index('ix_kpi_value_kpi_group', ['domain', 'kpi', 'group', 'valueDate'], { unique: false })\n@ObjectType({ description: 'Entity for KpiValue' })\nexport class KpiValue {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for this KPI value record.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true, description: 'Domain (tenant) to which this KPI value belongs.' })\n domain?: Domain\n\n @RelationId((kpiValue: KpiValue) => kpiValue.domain)\n @Field({ nullable: true, description: 'ID of the domain (tenant) for this KPI value.' })\n domainId?: string\n\n @ManyToOne(() => Kpi)\n @Field(type => Kpi, {\n nullable: true,\n description: 'Reference to the KPI definition for which this value is calculated.'\n })\n kpi: Kpi\n\n @RelationId((kpiValue: KpiValue) => kpiValue.kpi)\n @Field({ description: 'ID of the referenced KPI.' })\n kpiId: string\n\n @Column('int')\n @Field(type => Int, { description: 'Version of the KPI definition at the time this value was calculated.' })\n version: number\n\n @Column()\n @Field({\n description:\n 'Date or period for which this KPI value is recorded (e.g., day: YYYY-MM-DD, month: YYYY-MM, quarter: YYYY-Qn, range: YYYY-MM-DD~YYYY-MM-DD).'\n })\n valueDate: string\n\n @Column('float')\n @Field(type => Float, { description: 'The calculated numeric value for this KPI and period.' })\n value: number\n\n @Column('float', { nullable: true })\n @Field(type => Float, {\n nullable: true,\n description: 'Performance score calculated from KPI value using scoreFormula or grades lookup table. Range: 0-1.'\n })\n score?: number\n\n @Column({ nullable: true })\n @Field(type => String, {\n nullable: true,\n description: 'Group key for this value (organization, line, user, project, etc.)'\n })\n group?: string\n\n @ManyToOne(() => KpiOrgScope, { nullable: true })\n @Field(type => KpiOrgScope, {\n nullable: true,\n description: 'Reference to the organization scope mapping for this KPI value.'\n })\n kpiOrgScope?: KpiOrgScope\n\n @RelationId((kpiValue: KpiValue) => kpiValue.kpiOrgScope)\n @Field({ nullable: true, description: 'ID of the referenced KPI organization scope.' })\n kpiOrgScopeId?: string\n\n @Column({ nullable: true })\n @Field({\n nullable: true,\n description: 'Indicates whether this value was entered manually or generated automatically.'\n })\n inputType?: KpiValueInputType\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Source of the value (e.g., system, user, external integration).' })\n source?: string\n\n @Column({\n nullable: true,\n type:\n DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'longtext'\n : DATABASE_TYPE == 'oracle'\n ? 'clob'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined,\n transformer: json5Transformer\n })\n @Field(type => ScalarObject, {\n nullable: true,\n description:\n 'Extended or non-numeric information related to this KPI value, stored as JSON5. Can include grade, status, comments, or other metadata.'\n })\n meta?: any\n\n @Column({ default: 'DAY' })\n @Field(type => KpiPeriodType, { description: 'Aggregation period type for this KPI value.' })\n periodType: KpiPeriodType\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI value record was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI value record was last updated.' })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who created this KPI value record.' })\n creator?: User\n\n @RelationId((kpiValue: KpiValue) => kpiValue.creator)\n @Field({ nullable: true, description: 'ID of the user who created this KPI value record.' })\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who last updated this KPI value record.' })\n updater?: User\n\n @RelationId((kpiValue: KpiValue) => kpiValue.updater)\n @Field({ nullable: true, description: 'ID of the user who last updated this KPI value record.' })\n updaterId?: string\n}\n"]}
|