@decaf-ts/for-fabric 0.1.41 → 0.1.42

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.
Files changed (137) hide show
  1. package/dist/for-fabric.cjs +1 -1
  2. package/dist/for-fabric.cjs.map +1 -1
  3. package/dist/for-fabric.js +1 -1
  4. package/dist/for-fabric.js.map +1 -1
  5. package/lib/client/FabricClientAdapter.cjs +7 -1
  6. package/lib/client/FabricClientAdapter.js.map +1 -1
  7. package/lib/contract/BatchContract.cjs +30 -0
  8. package/lib/contract/BatchContract.d.ts +5 -0
  9. package/lib/contract/BatchContract.js.map +1 -0
  10. package/lib/contract/ProductContract.cjs +1 -4
  11. package/lib/contract/ProductContract.d.ts +1 -1
  12. package/lib/contract/ProductContract.js.map +1 -1
  13. package/lib/contract/index.cjs +2 -0
  14. package/lib/contract/index.js.map +1 -1
  15. package/lib/contract/models/Audit.cjs +83 -0
  16. package/lib/contract/models/Audit.d.ts +12 -0
  17. package/lib/contract/models/Audit.js.map +1 -0
  18. package/lib/contract/models/BaseIdentifiedModel.cjs +37 -0
  19. package/lib/contract/models/BaseIdentifiedModel.d.ts +7 -0
  20. package/lib/contract/models/BaseIdentifiedModel.js.map +1 -0
  21. package/lib/contract/models/BaseModel.cjs +42 -0
  22. package/lib/contract/models/BaseModel.d.ts +7 -0
  23. package/lib/contract/models/BaseModel.js.map +1 -0
  24. package/lib/contract/models/Batch.cjs +174 -0
  25. package/lib/contract/models/Batch.d.ts +18 -0
  26. package/lib/contract/models/Batch.js.map +1 -0
  27. package/lib/contract/models/Leaflet.cjs +95 -0
  28. package/lib/contract/models/Leaflet.d.ts +12 -0
  29. package/lib/contract/models/Leaflet.js.map +1 -0
  30. package/lib/contract/models/LeafletFile.cjs +58 -0
  31. package/lib/contract/models/LeafletFile.d.ts +9 -0
  32. package/lib/contract/models/LeafletFile.js.map +1 -0
  33. package/lib/contract/models/Market.cjs +75 -0
  34. package/lib/contract/models/Market.d.ts +12 -0
  35. package/lib/contract/models/Market.js.map +1 -0
  36. package/lib/contract/models/Product.cjs +77 -0
  37. package/lib/contract/models/Product.d.ts +15 -0
  38. package/lib/contract/models/Product.js.map +1 -0
  39. package/lib/contract/models/ProductStrength.cjs +60 -0
  40. package/lib/contract/models/ProductStrength.d.ts +10 -0
  41. package/lib/contract/models/ProductStrength.js.map +1 -0
  42. package/lib/contract/models/constants.cjs +30 -0
  43. package/lib/contract/models/constants.d.ts +24 -0
  44. package/lib/contract/models/constants.js.map +1 -0
  45. package/lib/contract/models/decorators.cjs +54 -0
  46. package/lib/contract/models/decorators.d.ts +8 -0
  47. package/lib/contract/models/decorators.js.map +1 -0
  48. package/lib/contract/models/gtin.cjs +88 -0
  49. package/lib/contract/models/gtin.d.ts +8 -0
  50. package/lib/contract/models/gtin.js.map +1 -0
  51. package/lib/contracts/ContractAdapter.cjs +1 -7
  52. package/lib/contracts/ContractAdapter.d.ts +0 -6
  53. package/lib/contracts/ContractAdapter.js.map +1 -1
  54. package/lib/contracts/FabricContractPaginator.js.map +1 -1
  55. package/lib/contracts/FabricContractRepository.cjs +0 -46
  56. package/lib/contracts/FabricContractRepository.d.ts +1 -1
  57. package/lib/contracts/FabricContractRepository.js.map +1 -1
  58. package/lib/contracts/FabricContractSequence.cjs +93 -58
  59. package/lib/contracts/FabricContractSequence.d.ts +2 -2
  60. package/lib/contracts/FabricContractSequence.js.map +1 -1
  61. package/lib/contracts/crud/serialized-crud-contract.cjs +4 -1
  62. package/lib/contracts/crud/serialized-crud-contract.js.map +1 -1
  63. package/lib/contracts/index.cjs +0 -1
  64. package/lib/contracts/index.d.ts +0 -1
  65. package/lib/contracts/index.js.map +1 -1
  66. package/lib/esm/client/FabricClientAdapter.js +8 -2
  67. package/lib/esm/client/FabricClientAdapter.js.map +1 -1
  68. package/lib/esm/contract/BatchContract.d.ts +5 -0
  69. package/lib/esm/contract/BatchContract.js +27 -0
  70. package/lib/esm/contract/BatchContract.js.map +1 -0
  71. package/lib/esm/contract/ProductContract.d.ts +1 -1
  72. package/lib/esm/contract/ProductContract.js +1 -4
  73. package/lib/esm/contract/ProductContract.js.map +1 -1
  74. package/lib/esm/contract/index.js +2 -0
  75. package/lib/esm/contract/index.js.map +1 -1
  76. package/lib/esm/contract/models/Audit.d.ts +12 -0
  77. package/lib/esm/contract/models/Audit.js +80 -0
  78. package/lib/esm/contract/models/Audit.js.map +1 -0
  79. package/lib/esm/contract/models/BaseIdentifiedModel.d.ts +7 -0
  80. package/lib/esm/contract/models/BaseIdentifiedModel.js +34 -0
  81. package/lib/esm/contract/models/BaseIdentifiedModel.js.map +1 -0
  82. package/lib/esm/contract/models/BaseModel.d.ts +7 -0
  83. package/lib/esm/contract/models/BaseModel.js +39 -0
  84. package/lib/esm/contract/models/BaseModel.js.map +1 -0
  85. package/lib/esm/contract/models/Batch.d.ts +18 -0
  86. package/lib/esm/contract/models/Batch.js +171 -0
  87. package/lib/esm/contract/models/Batch.js.map +1 -0
  88. package/lib/esm/contract/models/Leaflet.d.ts +12 -0
  89. package/lib/esm/contract/models/Leaflet.js +92 -0
  90. package/lib/esm/contract/models/Leaflet.js.map +1 -0
  91. package/lib/esm/contract/models/LeafletFile.d.ts +9 -0
  92. package/lib/esm/contract/models/LeafletFile.js +55 -0
  93. package/lib/esm/contract/models/LeafletFile.js.map +1 -0
  94. package/lib/esm/contract/models/Market.d.ts +12 -0
  95. package/lib/esm/contract/models/Market.js +72 -0
  96. package/lib/esm/contract/models/Market.js.map +1 -0
  97. package/lib/esm/contract/models/Product.d.ts +15 -0
  98. package/lib/esm/contract/models/Product.js +74 -0
  99. package/lib/esm/contract/models/Product.js.map +1 -0
  100. package/lib/esm/contract/models/ProductStrength.d.ts +10 -0
  101. package/lib/esm/contract/models/ProductStrength.js +57 -0
  102. package/lib/esm/contract/models/ProductStrength.js.map +1 -0
  103. package/lib/esm/contract/models/constants.d.ts +24 -0
  104. package/lib/esm/contract/models/constants.js +27 -0
  105. package/lib/esm/contract/models/constants.js.map +1 -0
  106. package/lib/esm/contract/models/decorators.d.ts +8 -0
  107. package/lib/esm/contract/models/decorators.js +48 -0
  108. package/lib/esm/contract/models/decorators.js.map +1 -0
  109. package/lib/esm/contract/models/gtin.d.ts +8 -0
  110. package/lib/esm/contract/models/gtin.js +82 -0
  111. package/lib/esm/contract/models/gtin.js.map +1 -0
  112. package/lib/esm/contracts/ContractAdapter.d.ts +0 -6
  113. package/lib/esm/contracts/ContractAdapter.js +1 -7
  114. package/lib/esm/contracts/ContractAdapter.js.map +1 -1
  115. package/lib/esm/contracts/FabricContractPaginator.js.map +1 -1
  116. package/lib/esm/contracts/FabricContractRepository.d.ts +1 -1
  117. package/lib/esm/contracts/FabricContractRepository.js +1 -47
  118. package/lib/esm/contracts/FabricContractRepository.js.map +1 -1
  119. package/lib/esm/contracts/FabricContractSequence.d.ts +2 -2
  120. package/lib/esm/contracts/FabricContractSequence.js +93 -58
  121. package/lib/esm/contracts/FabricContractSequence.js.map +1 -1
  122. package/lib/esm/contracts/crud/serialized-crud-contract.js +4 -1
  123. package/lib/esm/contracts/crud/serialized-crud-contract.js.map +1 -1
  124. package/lib/esm/contracts/index.d.ts +0 -1
  125. package/lib/esm/contracts/index.js +0 -1
  126. package/lib/esm/contracts/index.js.map +1 -1
  127. package/lib/esm/shared/errors.d.ts +9 -0
  128. package/lib/esm/shared/errors.js +15 -0
  129. package/lib/esm/shared/errors.js.map +1 -1
  130. package/lib/esm/version.d.ts +1 -1
  131. package/lib/esm/version.js +1 -1
  132. package/lib/shared/errors.cjs +19 -1
  133. package/lib/shared/errors.d.ts +9 -0
  134. package/lib/shared/errors.js.map +1 -1
  135. package/lib/version.cjs +1 -1
  136. package/lib/version.d.ts +1 -1
  137. package/package.json +1 -1
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Leaflet = void 0;
13
+ const decorator_validation_1 = require("@decaf-ts/decorator-validation");
14
+ const LeafletFile_1 = require("./LeafletFile.cjs");
15
+ const gtin_1 = require("./gtin.cjs");
16
+ const constants_1 = require("./constants.cjs");
17
+ const core_1 = require("@decaf-ts/core");
18
+ const db_decorators_1 = require("@decaf-ts/db-decorators");
19
+ const Product_1 = require("./Product.cjs");
20
+ const decoration_1 = require("@decaf-ts/decoration");
21
+ const BaseIdentifiedModel_1 = require("./BaseIdentifiedModel.cjs");
22
+ const decorators_1 = require("./decorators.cjs");
23
+ const index_1 = require("./../../shared/index.cjs");
24
+ let Leaflet = class Leaflet extends BaseIdentifiedModel_1.BaseIdentifiedModel {
25
+ constructor(model) {
26
+ super(model);
27
+ }
28
+ };
29
+ exports.Leaflet = Leaflet;
30
+ __decorate([
31
+ (0, decorators_1.audit)(),
32
+ (0, core_1.pk)({ type: "String", generated: false }),
33
+ (0, db_decorators_1.composed)(["productCode", "batchNumber", "lang", "countryMarket"], ":", [
34
+ "batchNumber",
35
+ "countryMarket",
36
+ ]),
37
+ (0, decoration_1.description)("Unique identifier composed of product code, batch number, and language."),
38
+ __metadata("design:type", String)
39
+ ], Leaflet.prototype, "id", void 0);
40
+ __decorate([
41
+ (0, gtin_1.gtin)(),
42
+ (0, core_1.manyToOne)(() => Product_1.Product, { update: core_1.Cascade.CASCADE, delete: core_1.Cascade.CASCADE }, false),
43
+ (0, decorator_validation_1.required)(),
44
+ (0, db_decorators_1.readonly)(),
45
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
46
+ (0, decoration_1.description)("GTIN code of the product associated with this leaflet."),
47
+ __metadata("design:type", String)
48
+ ], Leaflet.prototype, "productCode", void 0);
49
+ __decorate([
50
+ (0, core_1.column)()
51
+ //TODO: Uncomment when implemented in couch and FK relationshipacept composed one
52
+ // @manyToOne(
53
+ // () => Batch,
54
+ // { update: Cascade.CASCADE, delete: Cascade.CASCADE },
55
+ // false
56
+ // )
57
+ ,
58
+ (0, db_decorators_1.readonly)(),
59
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
60
+ (0, decoration_1.description)("Batch number linked to the product, if applicable."),
61
+ __metadata("design:type", String)
62
+ ], Leaflet.prototype, "batchNumber", void 0);
63
+ __decorate([
64
+ (0, core_1.column)(),
65
+ (0, decorator_validation_1.required)(),
66
+ (0, db_decorators_1.readonly)(),
67
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
68
+ (0, decoration_1.description)("Language code of the leaflet (e.g., 'en', 'pt', 'es')."),
69
+ __metadata("design:type", String)
70
+ ], Leaflet.prototype, "lang", void 0);
71
+ __decorate([
72
+ (0, core_1.column)(),
73
+ (0, decorator_validation_1.required)(),
74
+ (0, db_decorators_1.readonly)(),
75
+ __metadata("design:type", String)
76
+ ], Leaflet.prototype, "countryMarket", void 0);
77
+ __decorate([
78
+ (0, core_1.column)(),
79
+ (0, decorator_validation_1.required)(),
80
+ (0, decoration_1.description)("Main XML content of the electronic leaflet."),
81
+ __metadata("design:type", String)
82
+ ], Leaflet.prototype, "xmlFileContent", void 0);
83
+ __decorate([
84
+ (0, core_1.oneToMany)(() => LeafletFile_1.LeafletFile, { update: core_1.Cascade.CASCADE, delete: core_1.Cascade.CASCADE }, false),
85
+ (0, decoration_1.description)("List of additional files linked to the leaflet, such as PDFs or images."),
86
+ __metadata("design:type", Array)
87
+ ], Leaflet.prototype, "otherFilesContent", void 0);
88
+ exports.Leaflet = Leaflet = __decorate([
89
+ (0, decoration_1.description)("Represents a medical leaflet linked to a specific product, batch, and language."),
90
+ (0, decoration_1.uses)(index_1.FabricFlavour),
91
+ (0, core_1.table)(constants_1.TableNames.Leaflet),
92
+ (0, decorator_validation_1.model)(),
93
+ __metadata("design:paramtypes", [Object])
94
+ ], Leaflet);
95
+ //# sourceMappingURL=Leaflet.js.map
@@ -0,0 +1,12 @@
1
+ import type { ModelArg } from "@decaf-ts/decorator-validation";
2
+ import { BaseIdentifiedModel } from "./BaseIdentifiedModel";
3
+ export declare class Leaflet extends BaseIdentifiedModel {
4
+ id: string;
5
+ productCode: string;
6
+ batchNumber?: string;
7
+ lang: string;
8
+ countryMarket: string;
9
+ xmlFileContent: string;
10
+ otherFilesContent: string[];
11
+ constructor(model?: ModelArg<Leaflet>);
12
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Leaflet.js","sourceRoot":"","sources":["../../../src/contract/models/Leaflet.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yEAAiE;AACjE,mDAA4C;AAC5C,qCAA8B;AAC9B,+CAAyC;AACzC,yCASwB;AACxB,2DAA6D;AAC7D,2CAAoC;AACpC,qDAAyD;AACzD,mEAA4D;AAC5D,iDAAqC;AACrC,oDAAmD;AAQ5C,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,yCAAmB;IA+D9C,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF,CAAA;AAlEY,0BAAO;AAUlB;IATC,IAAA,kBAAK,GAAE;IACP,IAAA,SAAE,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACxC,IAAA,wBAAQ,EAAC,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE;QACtE,aAAa;QACb,eAAe;KAChB,CAAC;IACD,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K,CACN;IACA,IAAA,wBAAW,EACV,yEAAyE,CAC1E;;kDAC4B;kBA7DlB,OAAO;IANnB,IAAA,wBAAW,EACV,iFAAiF,CAClF;IACA,IAAA,iBAAI,EAAC,qBAAa,CAAC;IACnB,IAAA,YAAK,EAAC,sBAAU,CAAC,OAAO,CAAC;IACzB,IAAA,4BAAK,GAAE;;GACK,OAAO,CAkEnB"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LeafletFile = void 0;
13
+ const decorator_validation_1 = require("@decaf-ts/decorator-validation");
14
+ const core_1 = require("@decaf-ts/core");
15
+ const constants_1 = require("./constants.cjs");
16
+ const Leaflet_1 = require("./Leaflet.cjs");
17
+ const decoration_1 = require("@decaf-ts/decoration");
18
+ const BaseIdentifiedModel_1 = require("./BaseIdentifiedModel.cjs");
19
+ const db_decorators_1 = require("@decaf-ts/db-decorators");
20
+ const index_1 = require("./../../shared/index.cjs");
21
+ let LeafletFile = class LeafletFile extends BaseIdentifiedModel_1.BaseIdentifiedModel {
22
+ constructor(model) {
23
+ super(model);
24
+ }
25
+ };
26
+ exports.LeafletFile = LeafletFile;
27
+ __decorate([
28
+ (0, core_1.pk)(),
29
+ (0, db_decorators_1.composed)(["productCode", "batchNumber", "lang"], ":", ["batchNumber"]),
30
+ (0, decoration_1.description)("Unique identifier of the leaflet file."),
31
+ __metadata("design:type", String)
32
+ ], LeafletFile.prototype, "id", void 0);
33
+ __decorate([
34
+ (0, core_1.manyToOne)(() => Leaflet_1.Leaflet, { update: core_1.Cascade.NONE, delete: core_1.Cascade.NONE }, false),
35
+ (0, decoration_1.description)("Identifier of the leaflet this file belongs to."),
36
+ __metadata("design:type", String)
37
+ ], LeafletFile.prototype, "leafletId", void 0);
38
+ __decorate([
39
+ (0, core_1.column)(),
40
+ (0, decorator_validation_1.required)(),
41
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
42
+ (0, decoration_1.description)("Name of the file, including its extension."),
43
+ __metadata("design:type", String)
44
+ ], LeafletFile.prototype, "filename", void 0);
45
+ __decorate([
46
+ (0, core_1.column)(),
47
+ (0, decorator_validation_1.required)(),
48
+ (0, decoration_1.description)("Base64-encoded content of the file."),
49
+ __metadata("design:type", String)
50
+ ], LeafletFile.prototype, "fileContent", void 0);
51
+ exports.LeafletFile = LeafletFile = __decorate([
52
+ (0, decoration_1.description)("Represents an additional file associated with a leaflet, such as a PDF or image."),
53
+ (0, decoration_1.uses)(index_1.FabricFlavour),
54
+ (0, core_1.table)(constants_1.TableNames.LeafletFile),
55
+ (0, decorator_validation_1.model)(),
56
+ __metadata("design:paramtypes", [Object])
57
+ ], LeafletFile);
58
+ //# sourceMappingURL=LeafletFile.js.map
@@ -0,0 +1,9 @@
1
+ import type { ModelArg } from "@decaf-ts/decorator-validation";
2
+ import { BaseIdentifiedModel } from "./BaseIdentifiedModel";
3
+ export declare class LeafletFile extends BaseIdentifiedModel {
4
+ id: string;
5
+ leafletId: string;
6
+ filename: string;
7
+ fileContent: string;
8
+ constructor(model?: ModelArg<LeafletFile>);
9
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeafletFile.js","sourceRoot":"","sources":["../../../src/contract/models/LeafletFile.ts"],"names":[],"mappings":";;;;;;;;;;;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length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Market = void 0;
13
+ const decorator_validation_1 = require("@decaf-ts/decorator-validation");
14
+ const constants_1 = require("./constants.cjs");
15
+ const core_1 = require("@decaf-ts/core");
16
+ const db_decorators_1 = require("@decaf-ts/db-decorators");
17
+ const decoration_1 = require("@decaf-ts/decoration");
18
+ const BaseIdentifiedModel_1 = require("./BaseIdentifiedModel.cjs");
19
+ const gtin_1 = require("./gtin.cjs");
20
+ const index_1 = require("./../../shared/index.cjs");
21
+ let Market = class Market extends BaseIdentifiedModel_1.BaseIdentifiedModel {
22
+ constructor(model) {
23
+ super(model);
24
+ }
25
+ };
26
+ exports.Market = Market;
27
+ __decorate([
28
+ (0, core_1.pk)({ type: "String", generated: false }),
29
+ (0, db_decorators_1.composed)(["productCode", "marketId"], ":", true),
30
+ (0, decoration_1.description)("Unique identifier composed of product code and market ID."),
31
+ __metadata("design:type", String)
32
+ ], Market.prototype, "id", void 0);
33
+ __decorate([
34
+ (0, core_1.column)(),
35
+ (0, decorator_validation_1.required)(),
36
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
37
+ (0, decoration_1.description)("Identifier of the market where the product is registered or sold."),
38
+ __metadata("design:type", String)
39
+ ], Market.prototype, "marketId", void 0);
40
+ __decorate([
41
+ (0, core_1.column)(),
42
+ (0, gtin_1.gtin)(),
43
+ (0, decorator_validation_1.required)(),
44
+ __metadata("design:type", String)
45
+ ], Market.prototype, "productCode", void 0);
46
+ __decorate([
47
+ (0, core_1.column)(),
48
+ (0, decorator_validation_1.minlength)(2),
49
+ (0, decorator_validation_1.maxlength)(2),
50
+ (0, decoration_1.description)("Two-letter national code (ISO format) representing the market's country."),
51
+ __metadata("design:type", String)
52
+ ], Market.prototype, "nationalCode", void 0);
53
+ __decorate([
54
+ (0, core_1.column)(),
55
+ (0, decoration_1.description)("Name of the Marketing Authorization Holder (MAH)."),
56
+ __metadata("design:type", String)
57
+ ], Market.prototype, "mahName", void 0);
58
+ __decorate([
59
+ (0, core_1.column)(),
60
+ (0, decoration_1.description)("Name of the legal entity responsible for the product in this market."),
61
+ __metadata("design:type", String)
62
+ ], Market.prototype, "legalEntityName", void 0);
63
+ __decorate([
64
+ (0, core_1.column)(),
65
+ (0, decoration_1.description)("Address of the Marketing Authorization Holder or responsible legal entity."),
66
+ __metadata("design:type", String)
67
+ ], Market.prototype, "mahAddress", void 0);
68
+ exports.Market = Market = __decorate([
69
+ (0, decoration_1.description)("Links a product to a specific market."),
70
+ (0, decoration_1.uses)(index_1.FabricFlavour),
71
+ (0, core_1.table)(constants_1.TableNames.Market),
72
+ (0, decorator_validation_1.model)(),
73
+ __metadata("design:paramtypes", [Object])
74
+ ], Market);
75
+ //# sourceMappingURL=Market.js.map
@@ -0,0 +1,12 @@
1
+ import type { ModelArg } from "@decaf-ts/decorator-validation";
2
+ import { BaseIdentifiedModel } from "./BaseIdentifiedModel";
3
+ export declare class Market extends BaseIdentifiedModel {
4
+ id: string;
5
+ marketId: string;
6
+ productCode: string;
7
+ nationalCode?: string;
8
+ mahName?: string;
9
+ legalEntityName?: string;
10
+ mahAddress?: string;
11
+ constructor(model?: ModelArg<Market>);
12
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Market.js","sourceRoot":"","sources":["../../../src/contract/models/Market.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yEAKwC;A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;IACnB,IAAA,YAAK,EAAC,sBAAU,CAAC,MAAM,CAAC;IACxB,IAAA,4BAAK,GAAE;;GACK,MAAM,CA8ClB"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Product = void 0;
13
+ const decorator_validation_1 = require("@decaf-ts/decorator-validation");
14
+ const core_1 = require("@decaf-ts/core");
15
+ // import {BlockOperations, OperationKeys, readonly} from "@decaf-ts/db-decorators";
16
+ const decoration_1 = require("@decaf-ts/decoration");
17
+ const ProductStrength_1 = require("./ProductStrength.cjs");
18
+ const Market_1 = require("./Market.cjs");
19
+ const BaseIdentifiedModel_1 = require("./BaseIdentifiedModel.cjs");
20
+ const gtin_1 = require("./gtin.cjs");
21
+ const decorators_1 = require("./decorators.cjs");
22
+ const index_1 = require("./../../shared/index.cjs");
23
+ let Product = class Product extends BaseIdentifiedModel_1.BaseIdentifiedModel {
24
+ constructor(args) {
25
+ super(args);
26
+ this.productRecall = false;
27
+ }
28
+ };
29
+ exports.Product = Product;
30
+ __decorate([
31
+ (0, gtin_1.gtin)(),
32
+ (0, decorators_1.audit)(),
33
+ (0, core_1.pk)({ type: String, generated: false }),
34
+ __metadata("design:type", String)
35
+ ], Product.prototype, "productCode", void 0);
36
+ __decorate([
37
+ (0, core_1.column)(),
38
+ (0, decorator_validation_1.required)(),
39
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
40
+ __metadata("design:type", String)
41
+ ], Product.prototype, "inventedName", void 0);
42
+ __decorate([
43
+ (0, core_1.column)(),
44
+ (0, decorator_validation_1.required)(),
45
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
46
+ __metadata("design:type", String)
47
+ ], Product.prototype, "nameMedicinalProduct", void 0);
48
+ __decorate([
49
+ (0, core_1.column)(),
50
+ __metadata("design:type", String)
51
+ ], Product.prototype, "internalMaterialCode", void 0);
52
+ __decorate([
53
+ (0, core_1.column)(),
54
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
55
+ __metadata("design:type", Boolean)
56
+ ], Product.prototype, "productRecall", void 0);
57
+ __decorate([
58
+ (0, core_1.column)(),
59
+ __metadata("design:type", Number)
60
+ ], Product.prototype, "counter", void 0);
61
+ __decorate([
62
+ (0, core_1.oneToMany)(() => ProductStrength_1.ProductStrength, { update: core_1.Cascade.CASCADE, delete: core_1.Cascade.CASCADE }, false),
63
+ __metadata("design:type", Array)
64
+ ], Product.prototype, "strengths", void 0);
65
+ __decorate([
66
+ (0, core_1.oneToMany)(() => Market_1.Market, { update: core_1.Cascade.NONE, delete: core_1.Cascade.NONE }, false),
67
+ __metadata("design:type", Array)
68
+ ], Product.prototype, "markets", void 0);
69
+ exports.Product = Product = __decorate([
70
+ (0, decoration_1.uses)(index_1.FabricFlavour)
71
+ // @BlockOperations([OperationKeys.DELETE])
72
+ ,
73
+ (0, core_1.table)(),
74
+ (0, decorator_validation_1.model)(),
75
+ __metadata("design:paramtypes", [Object])
76
+ ], Product);
77
+ //# sourceMappingURL=Product.js.map
@@ -0,0 +1,15 @@
1
+ import type { ModelArg } from "@decaf-ts/decorator-validation";
2
+ import { ProductStrength } from "./ProductStrength";
3
+ import { Market } from "./Market";
4
+ import { BaseIdentifiedModel } from "./BaseIdentifiedModel";
5
+ export declare class Product extends BaseIdentifiedModel {
6
+ productCode: string;
7
+ inventedName: string;
8
+ nameMedicinalProduct: string;
9
+ internalMaterialCode?: string;
10
+ productRecall: boolean;
11
+ counter?: number;
12
+ strengths: ProductStrength[];
13
+ markets: Market[];
14
+ constructor(args?: ModelArg<Product>);
15
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Product.js","sourceRoot":"","sources":["../../../src/contract/models/Product.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yEAAiE;AACjE,yCAQwB;AACxB,oFAAoF;AACpF,qDAA4C;AAC5C,2DAAoD;AACpD,yCAAkC;AAClC,mEAA4D;AAC5D,qCAA8B;AAE9B,iDAAqC;AACrC,oDAAmD;AAM5C,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,yCAAmB;IA2D9C,YAAY,IAAwB;QAClC,KAAK,CAAC,IAAI,CAAC,CAAC;QAvCd,kBAAa,GAAY,KAAK,CAAC;IAwC/B,CAAC;CACF,CAAA;AA9DY,0BAAO;AAIlB;IAHC,IAAA,WAAI,GAAE;IACN,IAAA,kBAAK,GAAE;IACP,IAAA,SAAE,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;4CAClB;AAKrB;IAHC,IAAA,aAAM,GAAE;IACR,IAAA,+BAAQ,GAAE;IACV,IAAA,YAAK,EAAC,CAAC,qBAAc,CAAC,GAAG,EAAE,qBAAc,CAAC,GAAG,CAAC,CAAC;;6CAC1B;AAKtB;IAHC,IAAA,aAAM,GAAE;IACR,IAAA,+BAAQ,GAAE;IACV,IAAA,YAAK,EAAC,CAAC,qBAAc,CAAC,GAAG,EAAE,qBAAc,CAAC,GAAG,CAAC,CAAC;;qDAClB;AAG9B;IADC,IAAA,aAAM,GAAE;;qDACqB;AAI9B;IAFC,IAAA,aAAM,GAAE;IACR,IAAA,YAAK,EAAC,CAAC,qBAAc,CAAC,GAAG,EAAE,qBAAc,CAAC,GAAG,CAAC,CAAC;;8CACjB;AAsB/B;IADC,IAAA,aAAM,GAAE;;wCACQ;AAOjB;IALC,IAAA,gBAAS,EACR,GAAG,EAAE,CAAC,iCAAe,EACrB,EAAE,MAAM,EAAE,cAAO,CAAC,OAAO,EAAE,MAAM,EAAE,cAAO,CAAC,OAAO,EAAE,EACpD,KAAK,CACN;;0CAC6B;AAO9B;IALC,IAAA,gBAAS,EACR,GAAG,EAAE,CAAC,eAAM,EACZ,EAAE,MAAM,EAAE,cAAO,CAAC,IAAI,EAAE,MAAM,EAAE,cAAO,CAAC,IAAI,EAAE,EAC9C,KAAK,CACN;;wCACkB;kBAzDR,OAAO;IAJnB,IAAA,iBAAI,EAAC,qBAAa,CAAC;IACpB,2CAA2C;;IAC1C,IAAA,YAAK,GAAE;IACP,IAAA,4BAAK,GAAE;;GACK,OAAO,CA8DnB"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ProductStrength = void 0;
13
+ const decorator_validation_1 = require("@decaf-ts/decorator-validation");
14
+ const core_1 = require("@decaf-ts/core");
15
+ const constants_1 = require("./constants.cjs");
16
+ const decoration_1 = require("@decaf-ts/decoration");
17
+ const BaseIdentifiedModel_1 = require("./BaseIdentifiedModel.cjs");
18
+ const index_1 = require("./../../shared/index.cjs");
19
+ let ProductStrength = class ProductStrength extends BaseIdentifiedModel_1.BaseIdentifiedModel {
20
+ constructor(model) {
21
+ super(model);
22
+ }
23
+ };
24
+ exports.ProductStrength = ProductStrength;
25
+ __decorate([
26
+ (0, core_1.pk)({ type: Number, generated: true }),
27
+ (0, decoration_1.description)("Unique identifier of the product strength."),
28
+ __metadata("design:type", Number)
29
+ ], ProductStrength.prototype, "id", void 0);
30
+ __decorate([
31
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
32
+ (0, decoration_1.description)("Product code associated with this strength entry."),
33
+ __metadata("design:type", String)
34
+ ], ProductStrength.prototype, "productCode", void 0);
35
+ __decorate([
36
+ (0, core_1.column)(),
37
+ (0, decorator_validation_1.required)(),
38
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
39
+ (0, decoration_1.description)("Product concentration or dosage (e.g., 500mg, 10%)."),
40
+ __metadata("design:type", String)
41
+ ], ProductStrength.prototype, "strength", void 0);
42
+ __decorate([
43
+ (0, core_1.column)(),
44
+ (0, core_1.index)([core_1.OrderDirection.ASC, core_1.OrderDirection.DSC]),
45
+ (0, decoration_1.description)("Active substance related to this product strength."),
46
+ __metadata("design:type", String)
47
+ ], ProductStrength.prototype, "substance", void 0);
48
+ __decorate([
49
+ (0, core_1.column)(),
50
+ (0, decoration_1.description)("Legal entity name responsible for the product."),
51
+ __metadata("design:type", String)
52
+ ], ProductStrength.prototype, "legalEntityName", void 0);
53
+ exports.ProductStrength = ProductStrength = __decorate([
54
+ (0, decoration_1.uses)(index_1.FabricFlavour),
55
+ (0, core_1.table)(constants_1.TableNames.ProductStrength),
56
+ (0, decorator_validation_1.model)(),
57
+ (0, decoration_1.description)("Represents the product’s strength and composition details."),
58
+ __metadata("design:paramtypes", [Object])
59
+ ], ProductStrength);
60
+ //# sourceMappingURL=ProductStrength.js.map
@@ -0,0 +1,10 @@
1
+ import type { ModelArg } from "@decaf-ts/decorator-validation";
2
+ import { BaseIdentifiedModel } from "./BaseIdentifiedModel";
3
+ export declare class ProductStrength extends BaseIdentifiedModel {
4
+ id: number;
5
+ productCode: string;
6
+ strength: string;
7
+ substance?: string;
8
+ legalEntityName?: string;
9
+ constructor(model?: ModelArg<ProductStrength>);
10
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductStrength.js","sourceRoot":"","sources":["../../../src/contract/models/ProductStrength.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yEAAiE;AACjE,yCAA0E;AAC1E,+CAAyC;AACzC,qDAAyD;AACzD,mEAA4D;AAE5D,oDAAmD;AAM5C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,yCAAmB;IA6BtD,YAAY,KAAiC;QAC3C,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF,CAAA;AAhCY,0CAAe;AAG1B;IAFC,IAAA,SAAE,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrC,IAAA,wBAAW,EAAC,4CAA4C,CAAC;;2CAC9C;AASZ;IAFC,IAAA,YAAK,EAAC,CAAC,qBAAc,CAAC,GAAG,EAAE,qBAAc,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAA,wBAAW,EAAC,mDAAmD,CAAC;;oDAC5C;AAMrB;IAJC,IAAA,aAAM,GAAE;IACR,IAAA,+BAAQ,GAAE;IACV,IAAA,YAAK,EAAC,CAAC,qBAAc,CAAC,GAAG,EAAE,qBAAc,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAA,wBAAW,EAAC,qDAAqD,CAAC;;iDACjD;AAKlB;IAHC,IAAA,aAAM,GAAE;IACR,IAAA,YAAK,EAAC,CAAC,qBAAc,CAAC,GAAG,EAAE,qBAAc,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAA,wBAAW,EAAC,oDAAoD,CAAC;;kDAC/C;AAInB;IAFC,IAAA,aAAM,GAAE;IACR,IAAA,wBAAW,EAAC,gDAAgD,CAAC;;wDACrC;0BA3Bd,eAAe;IAJ3B,IAAA,iBAAI,EAAC,qBAAa,CAAC;IACnB,IAAA,YAAK,EAAC,sBAAU,CAAC,eAAe,CAAC;IACjC,IAAA,4BAAK,GAAE;IACP,IAAA,wBAAW,EAAC,4DAA4D,CAAC;;GAC7D,eAAe,CAgC3B"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuditOperations = exports.TableNames = exports.BatchPattern = exports.DatePattern = void 0;
4
+ exports.DatePattern = "yyyy-MM-dd";
5
+ exports.BatchPattern = /^[a-zA-Z0-9/-]{1,20}$/;
6
+ var TableNames;
7
+ (function (TableNames) {
8
+ TableNames["Audit"] = "audit";
9
+ TableNames["Batch"] = "batch";
10
+ TableNames["GtinOwner"] = "gtin_owner";
11
+ TableNames["Leaflet"] = "leaflet";
12
+ TableNames["LeafletFile"] = "leaflet_file";
13
+ TableNames["Product"] = "product";
14
+ TableNames["Market"] = "market";
15
+ TableNames["ProductStrength"] = "product_strength";
16
+ })(TableNames || (exports.TableNames = TableNames = {}));
17
+ var AuditOperations;
18
+ (function (AuditOperations) {
19
+ AuditOperations["REMOVE"] = "Remove user";
20
+ AuditOperations["ADD"] = "Add user";
21
+ AuditOperations["DEACTIVATE"] = "Deactivate user";
22
+ AuditOperations["LOGIN"] = "Access wallet";
23
+ AuditOperations["SHARED_ENCLAVE_CREATE"] = "Create identity";
24
+ AuditOperations["BREAK_GLASS_RECOVERY"] = "Wallet recovered with the break Glass Recovery Code";
25
+ AuditOperations["AUTHORIZE"] = "Authorize integration user";
26
+ AuditOperations["REVOKE"] = "Revoke integration user";
27
+ AuditOperations["DATA_RECOVERY"] = "Use of the Data Recovery Key";
28
+ AuditOperations["RECOVERY_KEY_COPIED"] = "Copy Data Recovery Key";
29
+ })(AuditOperations || (exports.AuditOperations = AuditOperations = {}));
30
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,24 @@
1
+ export declare const DatePattern = "yyyy-MM-dd";
2
+ export declare const BatchPattern: RegExp;
3
+ export declare enum TableNames {
4
+ Audit = "audit",
5
+ Batch = "batch",
6
+ GtinOwner = "gtin_owner",
7
+ Leaflet = "leaflet",
8
+ LeafletFile = "leaflet_file",
9
+ Product = "product",
10
+ Market = "market",
11
+ ProductStrength = "product_strength"
12
+ }
13
+ export declare enum AuditOperations {
14
+ REMOVE = "Remove user",
15
+ ADD = "Add user",
16
+ DEACTIVATE = "Deactivate user",
17
+ LOGIN = "Access wallet",
18
+ SHARED_ENCLAVE_CREATE = "Create identity",
19
+ BREAK_GLASS_RECOVERY = "Wallet recovered with the break Glass Recovery Code",
20
+ AUTHORIZE = "Authorize integration user",
21
+ REVOKE = "Revoke integration user",
22
+ DATA_RECOVERY = "Use of the Data Recovery Key",
23
+ RECOVERY_KEY_COPIED = "Copy Data Recovery Key"
24
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/contract/models/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,YAAY,CAAC;AAE3B,QAAA,YAAY,GAAG,uBAAuB,CAAC;AAEpD,IAAY,UASX;AATD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,6BAAe,CAAA;IACf,sCAAwB,CAAA;IACxB,iCAAmB,CAAA;IACnB,0CAA4B,CAAA;IAC5B,iCAAmB,CAAA;IACnB,+BAAiB,CAAA;IACjB,kDAAoC,CAAA;AACtC,CAAC,EATW,UAAU,0BAAV,UAAU,QASrB;AAED,IAAY,eAWX;AAXD,WAAY,eAAe;IACzB,yCAAsB,CAAA;IACtB,mCAAgB,CAAA;IAChB,iDAA8B,CAAA;IAC9B,0CAAuB,CAAA;IACvB,4DAAyC,CAAA;IACzC,+FAA4E,CAAA;IAC5E,2DAAwC,CAAA;IACxC,qDAAkC,CAAA;IAClC,iEAA8C,CAAA;IAC9C,iEAA8C,CAAA;AAChD,CAAC,EAXW,eAAe,+BAAf,eAAe,QAW1B"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createAuditHandler = createAuditHandler;
4
+ exports.updateAuditHandler = updateAuditHandler;
5
+ exports.deleteAuditHandler = deleteAuditHandler;
6
+ exports.audit = audit;
7
+ const decorator_validation_1 = require("@decaf-ts/decorator-validation");
8
+ const decoration_1 = require("@decaf-ts/decoration");
9
+ const db_decorators_1 = require("@decaf-ts/db-decorators");
10
+ const Audit_1 = require("./Audit.cjs");
11
+ const core_1 = require("@decaf-ts/core");
12
+ async function createAuditHandler(context, data, key, model) {
13
+ const repo = core_1.Repository.forModel(Audit_1.Audit);
14
+ if (!context.identity || !context.identity.getID)
15
+ throw new db_decorators_1.InternalError(`Lost context apprently. no getId in identity`);
16
+ const toCreate = new Audit_1.Audit({
17
+ userGroup: context.identity.getID(),
18
+ userId: context.identity.getID(),
19
+ action: db_decorators_1.OperationKeys.CREATE,
20
+ diffs: new this.class().compare(model),
21
+ });
22
+ const audit = await repo.create(toCreate, context);
23
+ context.logger.info(`Audit log for ${db_decorators_1.OperationKeys.CREATE} of ${decorator_validation_1.Model.tableName(this.class)} created: ${audit.id}: ${JSON.stringify(audit, undefined, 2)}`);
24
+ }
25
+ async function updateAuditHandler(context, data, key, model, oldModel) {
26
+ if (!context.identity || !context.identity.getID)
27
+ throw new db_decorators_1.InternalError(`Lost context apprently. no getId in identity`);
28
+ const toCreate = new Audit_1.Audit({
29
+ userGroup: context.identity.getID(),
30
+ userId: context.identity.getID(),
31
+ action: db_decorators_1.OperationKeys.UPDATE,
32
+ diffs: model.compare(oldModel),
33
+ });
34
+ const repo = core_1.Repository.forModel(Audit_1.Audit);
35
+ const audit = await repo.create(toCreate, context);
36
+ context.logger.info(`Audit log for ${db_decorators_1.OperationKeys.UPDATE} of ${decorator_validation_1.Model.tableName(this.class)} created: ${JSON.stringify(audit, undefined, 2)}`);
37
+ }
38
+ async function deleteAuditHandler(context, data, key, model) {
39
+ if (!context.identity || !context.identity.getID)
40
+ throw new db_decorators_1.InternalError(`Lost context apprently. no getId in identity`);
41
+ const toCreate = new Audit_1.Audit({
42
+ userGroup: context.identity.getID(),
43
+ userId: context.identity.getID(),
44
+ action: db_decorators_1.OperationKeys.DELETE,
45
+ diffs: model.compare(new this.class()),
46
+ });
47
+ const repo = core_1.Repository.forModel(Audit_1.Audit);
48
+ const audit = await repo.create(toCreate, context);
49
+ context.logger.info(`Audit log for ${db_decorators_1.OperationKeys.DELETE} of ${decorator_validation_1.Model.tableName(this.class)} created: ${JSON.stringify(audit, undefined, 2)}`);
50
+ }
51
+ function audit() {
52
+ return (0, decoration_1.apply)((0, db_decorators_1.afterCreate)(createAuditHandler, {}), (0, db_decorators_1.afterUpdate)(updateAuditHandler, {}), (0, db_decorators_1.afterDelete)(deleteAuditHandler, {}), (0, decoration_1.metadata)("audit", true));
53
+ }
54
+ //# sourceMappingURL=decorators.js.map
@@ -0,0 +1,8 @@
1
+ import { Model } from "@decaf-ts/decorator-validation";
2
+ import { IRepository } from "@decaf-ts/db-decorators";
3
+ import { Repository } from "@decaf-ts/core";
4
+ import { FabricContractContext } from "../../contracts/index";
5
+ export declare function createAuditHandler<M extends Model, R extends Repository<M, any>, V>(this: R, context: FabricContractContext, data: V, key: keyof M, model: M): Promise<void>;
6
+ export declare function updateAuditHandler<M extends Model, R extends IRepository<M, any>, V>(this: R, context: FabricContractContext, data: V, key: keyof M, model: M, oldModel: M): Promise<void>;
7
+ export declare function deleteAuditHandler<M extends Model, R extends IRepository<M, any>, V>(this: R, context: FabricContractContext, data: V, key: keyof M, model: M): Promise<void>;
8
+ export declare function audit(): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor | number) => void;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/contract/models/decorators.ts"],"names":[],"mappings":";;AAcA,gDA2BC;AAED,gDA2BC;AAED,gDA0BC;AA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