@things-factory/asset 0.0.0-stage → 10.1.230

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 (122) hide show
  1. package/dist-client/components/asset-documents.d.ts +22 -0
  2. package/dist-client/components/asset-documents.js +190 -0
  3. package/dist-client/components/asset-documents.js.map +1 -0
  4. package/dist-client/grid.d.ts +13 -0
  5. package/dist-client/grid.js +56 -0
  6. package/dist-client/grid.js.map +1 -0
  7. package/dist-client/index.d.ts +1 -0
  8. package/dist-client/index.js +2 -0
  9. package/dist-client/index.js.map +1 -0
  10. package/dist-client/pages/asset-list.d.ts +53 -0
  11. package/dist-client/pages/asset-list.js +171 -0
  12. package/dist-client/pages/asset-list.js.map +1 -0
  13. package/dist-client/pages/asset-reconciliation.d.ts +25 -0
  14. package/dist-client/pages/asset-reconciliation.js +165 -0
  15. package/dist-client/pages/asset-reconciliation.js.map +1 -0
  16. package/dist-client/pages/investee-page.d.ts +47 -0
  17. package/dist-client/pages/investee-page.js +322 -0
  18. package/dist-client/pages/investee-page.js.map +1 -0
  19. package/dist-client/pages/investment-list.d.ts +51 -0
  20. package/dist-client/pages/investment-list.js +134 -0
  21. package/dist-client/pages/investment-list.js.map +1 -0
  22. package/dist-client/route.d.ts +1 -0
  23. package/dist-client/route.js +18 -0
  24. package/dist-client/route.js.map +1 -0
  25. package/dist-client/tsconfig.tsbuildinfo +1 -0
  26. package/dist-client/words.d.ts +25 -0
  27. package/dist-client/words.js +23 -0
  28. package/dist-client/words.js.map +1 -0
  29. package/dist-server/attachment-reader.d.ts +3 -0
  30. package/dist-server/attachment-reader.js +20 -0
  31. package/dist-server/attachment-reader.js.map +1 -0
  32. package/dist-server/index.d.ts +1 -0
  33. package/dist-server/index.js +11 -0
  34. package/dist-server/index.js.map +1 -0
  35. package/dist-server/role-tasks.d.ts +2 -0
  36. package/dist-server/role-tasks.js +13 -0
  37. package/dist-server/role-tasks.js.map +1 -0
  38. package/dist-server/service/asset/asset-mutation.d.ts +5 -0
  39. package/dist-server/service/asset/asset-mutation.js +31 -0
  40. package/dist-server/service/asset/asset-mutation.js.map +1 -0
  41. package/dist-server/service/asset/asset-query.d.ts +19 -0
  42. package/dist-server/service/asset/asset-query.js +108 -0
  43. package/dist-server/service/asset/asset-query.js.map +1 -0
  44. package/dist-server/service/asset/asset-rules.d.ts +87 -0
  45. package/dist-server/service/asset/asset-rules.js +148 -0
  46. package/dist-server/service/asset/asset-rules.js.map +1 -0
  47. package/dist-server/service/asset/asset-service.d.ts +23 -0
  48. package/dist-server/service/asset/asset-service.js +84 -0
  49. package/dist-server/service/asset/asset-service.js.map +1 -0
  50. package/dist-server/service/asset/asset-type.d.ts +48 -0
  51. package/dist-server/service/asset/asset-type.js +182 -0
  52. package/dist-server/service/asset/asset-type.js.map +1 -0
  53. package/dist-server/service/asset/asset.d.ts +38 -0
  54. package/dist-server/service/asset/asset.js +159 -0
  55. package/dist-server/service/asset/asset.js.map +1 -0
  56. package/dist-server/service/asset/index.d.ts +6 -0
  57. package/dist-server/service/asset/index.js +10 -0
  58. package/dist-server/service/asset/index.js.map +1 -0
  59. package/dist-server/service/asset-document/asset-document-resolver.d.ts +32 -0
  60. package/dist-server/service/asset-document/asset-document-resolver.js +94 -0
  61. package/dist-server/service/asset-document/asset-document-resolver.js.map +1 -0
  62. package/dist-server/service/asset-document/asset-document-service.d.ts +34 -0
  63. package/dist-server/service/asset-document/asset-document-service.js +79 -0
  64. package/dist-server/service/asset-document/asset-document-service.js.map +1 -0
  65. package/dist-server/service/asset-document/index.d.ts +4 -0
  66. package/dist-server/service/asset-document/index.js +8 -0
  67. package/dist-server/service/asset-document/index.js.map +1 -0
  68. package/dist-server/service/checks.d.ts +12 -0
  69. package/dist-server/service/checks.js +27 -0
  70. package/dist-server/service/checks.js.map +1 -0
  71. package/dist-server/service/index.d.ts +18 -0
  72. package/dist-server/service/index.js +40 -0
  73. package/dist-server/service/index.js.map +1 -0
  74. package/dist-server/service/investment/index.d.ts +11 -0
  75. package/dist-server/service/investment/index.js +15 -0
  76. package/dist-server/service/investment/index.js.map +1 -0
  77. package/dist-server/service/investment/investee.d.ts +33 -0
  78. package/dist-server/service/investment/investee.js +135 -0
  79. package/dist-server/service/investment/investee.js.map +1 -0
  80. package/dist-server/service/investment/investment-board-seat.d.ts +25 -0
  81. package/dist-server/service/investment/investment-board-seat.js +98 -0
  82. package/dist-server/service/investment/investment-board-seat.js.map +1 -0
  83. package/dist-server/service/investment/investment-filing.d.ts +29 -0
  84. package/dist-server/service/investment/investment-filing.js +113 -0
  85. package/dist-server/service/investment/investment-filing.js.map +1 -0
  86. package/dist-server/service/investment/investment-holding.d.ts +31 -0
  87. package/dist-server/service/investment/investment-holding.js +127 -0
  88. package/dist-server/service/investment/investment-holding.js.map +1 -0
  89. package/dist-server/service/investment/investment-mutation.d.ts +15 -0
  90. package/dist-server/service/investment/investment-mutation.js +112 -0
  91. package/dist-server/service/investment/investment-mutation.js.map +1 -0
  92. package/dist-server/service/investment/investment-query.d.ts +33 -0
  93. package/dist-server/service/investment/investment-query.js +192 -0
  94. package/dist-server/service/investment/investment-query.js.map +1 -0
  95. package/dist-server/service/investment/investment-report.d.ts +37 -0
  96. package/dist-server/service/investment/investment-report.js +152 -0
  97. package/dist-server/service/investment/investment-report.js.map +1 -0
  98. package/dist-server/service/investment/investment-request.d.ts +31 -0
  99. package/dist-server/service/investment/investment-request.js +123 -0
  100. package/dist-server/service/investment/investment-request.js.map +1 -0
  101. package/dist-server/service/investment/investment-rules.d.ts +81 -0
  102. package/dist-server/service/investment/investment-rules.js +121 -0
  103. package/dist-server/service/investment/investment-rules.js.map +1 -0
  104. package/dist-server/service/investment/investment-service.d.ts +34 -0
  105. package/dist-server/service/investment/investment-service.js +280 -0
  106. package/dist-server/service/investment/investment-service.js.map +1 -0
  107. package/dist-server/service/investment/investment-type.d.ts +85 -0
  108. package/dist-server/service/investment/investment-type.js +324 -0
  109. package/dist-server/service/investment/investment-type.js.map +1 -0
  110. package/dist-server/service/patches.d.ts +24 -0
  111. package/dist-server/service/patches.js +63 -0
  112. package/dist-server/service/patches.js.map +1 -0
  113. package/dist-server/tsconfig.tsbuildinfo +1 -0
  114. package/package.json +49 -4
  115. package/things-factory.config.js +11 -0
  116. package/translations/en.json +188 -0
  117. package/translations/es.json +188 -0
  118. package/translations/ja.json +188 -0
  119. package/translations/ko.json +188 -0
  120. package/translations/ms.json +188 -0
  121. package/translations/zh.json +188 -0
  122. package/README.md +0 -3
@@ -0,0 +1,85 @@
1
+ import { Investee } from './investee';
2
+ import { Contribution, HoldingReason, InvestmentReportKind, InvestmentRequestKind } from './investment-rules';
3
+ export declare class InvesteePatch {
4
+ id?: string;
5
+ cuFlag?: string;
6
+ name?: string;
7
+ counterpartyId?: string;
8
+ country?: string;
9
+ registrationNo?: string;
10
+ currency?: string;
11
+ fiscalYearEndMonth?: number;
12
+ reportDueMonths?: number;
13
+ representative?: string;
14
+ active?: boolean;
15
+ description?: string;
16
+ }
17
+ export declare class InvestmentHoldingPatch {
18
+ id?: string;
19
+ cuFlag?: string;
20
+ recordDate?: string;
21
+ ourShares?: number;
22
+ totalShares?: number;
23
+ reason?: HoldingReason;
24
+ contribution?: Contribution;
25
+ amount?: number;
26
+ currency?: string;
27
+ description?: string;
28
+ }
29
+ export declare class InvestmentBoardSeatPatch {
30
+ id?: string;
31
+ cuFlag?: string;
32
+ director?: string;
33
+ appointedOn?: string;
34
+ resignedOn?: string;
35
+ description?: string;
36
+ }
37
+ export declare class InvestmentReportPatch {
38
+ id?: string;
39
+ cuFlag?: string;
40
+ periodFrom?: string;
41
+ periodTo?: string;
42
+ kind?: InvestmentReportKind;
43
+ standard?: string;
44
+ auditor?: string;
45
+ signedOn?: string;
46
+ receivedOn?: string;
47
+ revenue?: number;
48
+ netIncome?: number;
49
+ shareCapital?: number;
50
+ totalEquity?: number;
51
+ totalAssets?: number;
52
+ description?: string;
53
+ }
54
+ export declare class InvestmentRequestPatch {
55
+ id?: string;
56
+ cuFlag?: string;
57
+ kind?: InvestmentRequestKind;
58
+ title?: string;
59
+ receivedOn?: string;
60
+ dueOn?: string;
61
+ sentOn?: string;
62
+ signer?: string;
63
+ items?: string;
64
+ description?: string;
65
+ }
66
+ export declare class InvestmentFilingPatch {
67
+ id?: string;
68
+ cuFlag?: string;
69
+ name?: string;
70
+ law?: string;
71
+ authority?: string;
72
+ dueOn?: string;
73
+ filedOn?: string;
74
+ description?: string;
75
+ }
76
+ export declare class InvesteeList {
77
+ items: Investee[];
78
+ total: number;
79
+ }
80
+ export declare class LateInvestmentReport {
81
+ investeeId: string;
82
+ investeeName: string;
83
+ periodTo: string;
84
+ dueOn: string;
85
+ }
@@ -0,0 +1,324 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LateInvestmentReport = exports.InvesteeList = exports.InvestmentFilingPatch = exports.InvestmentRequestPatch = exports.InvestmentReportPatch = exports.InvestmentBoardSeatPatch = exports.InvestmentHoldingPatch = exports.InvesteePatch = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const investee_1 = require("./investee");
7
+ const investment_rules_1 = require("./investment-rules");
8
+ let InvesteePatch = class InvesteePatch {
9
+ };
10
+ exports.InvesteePatch = InvesteePatch;
11
+ tslib_1.__decorate([
12
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The investee; empty for a new one' }),
13
+ tslib_1.__metadata("design:type", String)
14
+ ], InvesteePatch.prototype, "id", void 0);
15
+ tslib_1.__decorate([
16
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }),
17
+ tslib_1.__metadata("design:type", String)
18
+ ], InvesteePatch.prototype, "cuFlag", void 0);
19
+ tslib_1.__decorate([
20
+ (0, type_graphql_1.Field)({ nullable: true, description: 'What the company is called' }),
21
+ tslib_1.__metadata("design:type", String)
22
+ ], InvesteePatch.prototype, "name", void 0);
23
+ tslib_1.__decorate([
24
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The company as a counterparty' }),
25
+ tslib_1.__metadata("design:type", String)
26
+ ], InvesteePatch.prototype, "counterpartyId", void 0);
27
+ tslib_1.__decorate([
28
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Country of incorporation - ISO 3166 alpha-2' }),
29
+ tslib_1.__metadata("design:type", String)
30
+ ], InvesteePatch.prototype, "country", void 0);
31
+ tslib_1.__decorate([
32
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Registration number there' }),
33
+ tslib_1.__metadata("design:type", String)
34
+ ], InvesteePatch.prototype, "registrationNo", void 0);
35
+ tslib_1.__decorate([
36
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Currency it reports in - ISO 4217' }),
37
+ tslib_1.__metadata("design:type", String)
38
+ ], InvesteePatch.prototype, "currency", void 0);
39
+ tslib_1.__decorate([
40
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'Month its fiscal year ends, 1 to 12' }),
41
+ tslib_1.__metadata("design:type", Number)
42
+ ], InvesteePatch.prototype, "fiscalYearEndMonth", void 0);
43
+ tslib_1.__decorate([
44
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: "Months after the year's end its report is due" }),
45
+ tslib_1.__metadata("design:type", Number)
46
+ ], InvesteePatch.prototype, "reportDueMonths", void 0);
47
+ tslib_1.__decorate([
48
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Who signs for us as its shareholder' }),
49
+ tslib_1.__metadata("design:type", String)
50
+ ], InvesteePatch.prototype, "representative", void 0);
51
+ tslib_1.__decorate([
52
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Whether we still hold its shares' }),
53
+ tslib_1.__metadata("design:type", Boolean)
54
+ ], InvesteePatch.prototype, "active", void 0);
55
+ tslib_1.__decorate([
56
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
57
+ tslib_1.__metadata("design:type", String)
58
+ ], InvesteePatch.prototype, "description", void 0);
59
+ exports.InvesteePatch = InvesteePatch = tslib_1.__decorate([
60
+ (0, type_graphql_1.InputType)({ description: 'A row of the investee grid (cuFlag + for new, M for changed, - for deleted)' })
61
+ ], InvesteePatch);
62
+ let InvestmentHoldingPatch = class InvestmentHoldingPatch {
63
+ };
64
+ exports.InvestmentHoldingPatch = InvestmentHoldingPatch;
65
+ tslib_1.__decorate([
66
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The row; empty for a new one' }),
67
+ tslib_1.__metadata("design:type", String)
68
+ ], InvestmentHoldingPatch.prototype, "id", void 0);
69
+ tslib_1.__decorate([
70
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }),
71
+ tslib_1.__metadata("design:type", String)
72
+ ], InvestmentHoldingPatch.prototype, "cuFlag", void 0);
73
+ tslib_1.__decorate([
74
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The day the holding stood so - YYYY-MM-DD' }),
75
+ tslib_1.__metadata("design:type", String)
76
+ ], InvestmentHoldingPatch.prototype, "recordDate", void 0);
77
+ tslib_1.__decorate([
78
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'Our shares' }),
79
+ tslib_1.__metadata("design:type", Number)
80
+ ], InvestmentHoldingPatch.prototype, "ourShares", void 0);
81
+ tslib_1.__decorate([
82
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: "All the company's shares" }),
83
+ tslib_1.__metadata("design:type", Number)
84
+ ], InvestmentHoldingPatch.prototype, "totalShares", void 0);
85
+ tslib_1.__decorate([
86
+ (0, type_graphql_1.Field)(type => investment_rules_1.HoldingReason, { nullable: true, description: 'Why it changed' }),
87
+ tslib_1.__metadata("design:type", String)
88
+ ], InvestmentHoldingPatch.prototype, "reason", void 0);
89
+ tslib_1.__decorate([
90
+ (0, type_graphql_1.Field)(type => investment_rules_1.Contribution, { nullable: true, description: 'What we gave for shares taken' }),
91
+ tslib_1.__metadata("design:type", String)
92
+ ], InvestmentHoldingPatch.prototype, "contribution", void 0);
93
+ tslib_1.__decorate([
94
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'What the shares taken were valued at' }),
95
+ tslib_1.__metadata("design:type", Number)
96
+ ], InvestmentHoldingPatch.prototype, "amount", void 0);
97
+ tslib_1.__decorate([
98
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Currency of the amount' }),
99
+ tslib_1.__metadata("design:type", String)
100
+ ], InvestmentHoldingPatch.prototype, "currency", void 0);
101
+ tslib_1.__decorate([
102
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
103
+ tslib_1.__metadata("design:type", String)
104
+ ], InvestmentHoldingPatch.prototype, "description", void 0);
105
+ exports.InvestmentHoldingPatch = InvestmentHoldingPatch = tslib_1.__decorate([
106
+ (0, type_graphql_1.InputType)({ description: 'A row of the holding grid of an investee' })
107
+ ], InvestmentHoldingPatch);
108
+ let InvestmentBoardSeatPatch = class InvestmentBoardSeatPatch {
109
+ };
110
+ exports.InvestmentBoardSeatPatch = InvestmentBoardSeatPatch;
111
+ tslib_1.__decorate([
112
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The row; empty for a new one' }),
113
+ tslib_1.__metadata("design:type", String)
114
+ ], InvestmentBoardSeatPatch.prototype, "id", void 0);
115
+ tslib_1.__decorate([
116
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }),
117
+ tslib_1.__metadata("design:type", String)
118
+ ], InvestmentBoardSeatPatch.prototype, "cuFlag", void 0);
119
+ tslib_1.__decorate([
120
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Who sits on the board' }),
121
+ tslib_1.__metadata("design:type", String)
122
+ ], InvestmentBoardSeatPatch.prototype, "director", void 0);
123
+ tslib_1.__decorate([
124
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Day appointed - YYYY-MM-DD' }),
125
+ tslib_1.__metadata("design:type", String)
126
+ ], InvestmentBoardSeatPatch.prototype, "appointedOn", void 0);
127
+ tslib_1.__decorate([
128
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Day left - YYYY-MM-DD' }),
129
+ tslib_1.__metadata("design:type", String)
130
+ ], InvestmentBoardSeatPatch.prototype, "resignedOn", void 0);
131
+ tslib_1.__decorate([
132
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
133
+ tslib_1.__metadata("design:type", String)
134
+ ], InvestmentBoardSeatPatch.prototype, "description", void 0);
135
+ exports.InvestmentBoardSeatPatch = InvestmentBoardSeatPatch = tslib_1.__decorate([
136
+ (0, type_graphql_1.InputType)({ description: 'A row of the board seat grid of an investee' })
137
+ ], InvestmentBoardSeatPatch);
138
+ let InvestmentReportPatch = class InvestmentReportPatch {
139
+ };
140
+ exports.InvestmentReportPatch = InvestmentReportPatch;
141
+ tslib_1.__decorate([
142
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The row; empty for a new one' }),
143
+ tslib_1.__metadata("design:type", String)
144
+ ], InvestmentReportPatch.prototype, "id", void 0);
145
+ tslib_1.__decorate([
146
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }),
147
+ tslib_1.__metadata("design:type", String)
148
+ ], InvestmentReportPatch.prototype, "cuFlag", void 0);
149
+ tslib_1.__decorate([
150
+ (0, type_graphql_1.Field)({ nullable: true, description: 'First day covered - YYYY-MM-DD' }),
151
+ tslib_1.__metadata("design:type", String)
152
+ ], InvestmentReportPatch.prototype, "periodFrom", void 0);
153
+ tslib_1.__decorate([
154
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Last day covered - YYYY-MM-DD' }),
155
+ tslib_1.__metadata("design:type", String)
156
+ ], InvestmentReportPatch.prototype, "periodTo", void 0);
157
+ tslib_1.__decorate([
158
+ (0, type_graphql_1.Field)(type => investment_rules_1.InvestmentReportKind, { nullable: true, description: 'Audited, interim or management' }),
159
+ tslib_1.__metadata("design:type", String)
160
+ ], InvestmentReportPatch.prototype, "kind", void 0);
161
+ tslib_1.__decorate([
162
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Accounting standard' }),
163
+ tslib_1.__metadata("design:type", String)
164
+ ], InvestmentReportPatch.prototype, "standard", void 0);
165
+ tslib_1.__decorate([
166
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Auditor' }),
167
+ tslib_1.__metadata("design:type", String)
168
+ ], InvestmentReportPatch.prototype, "auditor", void 0);
169
+ tslib_1.__decorate([
170
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Day signed - YYYY-MM-DD' }),
171
+ tslib_1.__metadata("design:type", String)
172
+ ], InvestmentReportPatch.prototype, "signedOn", void 0);
173
+ tslib_1.__decorate([
174
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Day received - YYYY-MM-DD' }),
175
+ tslib_1.__metadata("design:type", String)
176
+ ], InvestmentReportPatch.prototype, "receivedOn", void 0);
177
+ tslib_1.__decorate([
178
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'Revenue' }),
179
+ tslib_1.__metadata("design:type", Number)
180
+ ], InvestmentReportPatch.prototype, "revenue", void 0);
181
+ tslib_1.__decorate([
182
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'Net income' }),
183
+ tslib_1.__metadata("design:type", Number)
184
+ ], InvestmentReportPatch.prototype, "netIncome", void 0);
185
+ tslib_1.__decorate([
186
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'Share capital' }),
187
+ tslib_1.__metadata("design:type", Number)
188
+ ], InvestmentReportPatch.prototype, "shareCapital", void 0);
189
+ tslib_1.__decorate([
190
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'Total equity' }),
191
+ tslib_1.__metadata("design:type", Number)
192
+ ], InvestmentReportPatch.prototype, "totalEquity", void 0);
193
+ tslib_1.__decorate([
194
+ (0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'Total assets' }),
195
+ tslib_1.__metadata("design:type", Number)
196
+ ], InvestmentReportPatch.prototype, "totalAssets", void 0);
197
+ tslib_1.__decorate([
198
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
199
+ tslib_1.__metadata("design:type", String)
200
+ ], InvestmentReportPatch.prototype, "description", void 0);
201
+ exports.InvestmentReportPatch = InvestmentReportPatch = tslib_1.__decorate([
202
+ (0, type_graphql_1.InputType)({ description: 'A row of the report grid of an investee' })
203
+ ], InvestmentReportPatch);
204
+ let InvestmentRequestPatch = class InvestmentRequestPatch {
205
+ };
206
+ exports.InvestmentRequestPatch = InvestmentRequestPatch;
207
+ tslib_1.__decorate([
208
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The row; empty for a new one' }),
209
+ tslib_1.__metadata("design:type", String)
210
+ ], InvestmentRequestPatch.prototype, "id", void 0);
211
+ tslib_1.__decorate([
212
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }),
213
+ tslib_1.__metadata("design:type", String)
214
+ ], InvestmentRequestPatch.prototype, "cuFlag", void 0);
215
+ tslib_1.__decorate([
216
+ (0, type_graphql_1.Field)(type => investment_rules_1.InvestmentRequestKind, { nullable: true, description: 'What is asked' }),
217
+ tslib_1.__metadata("design:type", String)
218
+ ], InvestmentRequestPatch.prototype, "kind", void 0);
219
+ tslib_1.__decorate([
220
+ (0, type_graphql_1.Field)({ nullable: true, description: 'What it is about' }),
221
+ tslib_1.__metadata("design:type", String)
222
+ ], InvestmentRequestPatch.prototype, "title", void 0);
223
+ tslib_1.__decorate([
224
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Day received - YYYY-MM-DD' }),
225
+ tslib_1.__metadata("design:type", String)
226
+ ], InvestmentRequestPatch.prototype, "receivedOn", void 0);
227
+ tslib_1.__decorate([
228
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Day due - YYYY-MM-DD' }),
229
+ tslib_1.__metadata("design:type", String)
230
+ ], InvestmentRequestPatch.prototype, "dueOn", void 0);
231
+ tslib_1.__decorate([
232
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Day our answer was sent - YYYY-MM-DD' }),
233
+ tslib_1.__metadata("design:type", String)
234
+ ], InvestmentRequestPatch.prototype, "sentOn", void 0);
235
+ tslib_1.__decorate([
236
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Who signed for us' }),
237
+ tslib_1.__metadata("design:type", String)
238
+ ], InvestmentRequestPatch.prototype, "signer", void 0);
239
+ tslib_1.__decorate([
240
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Items and our answers, one per line' }),
241
+ tslib_1.__metadata("design:type", String)
242
+ ], InvestmentRequestPatch.prototype, "items", void 0);
243
+ tslib_1.__decorate([
244
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
245
+ tslib_1.__metadata("design:type", String)
246
+ ], InvestmentRequestPatch.prototype, "description", void 0);
247
+ exports.InvestmentRequestPatch = InvestmentRequestPatch = tslib_1.__decorate([
248
+ (0, type_graphql_1.InputType)({ description: 'A row of the request grid of an investee' })
249
+ ], InvestmentRequestPatch);
250
+ let InvestmentFilingPatch = class InvestmentFilingPatch {
251
+ };
252
+ exports.InvestmentFilingPatch = InvestmentFilingPatch;
253
+ tslib_1.__decorate([
254
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The row; empty for a new one' }),
255
+ tslib_1.__metadata("design:type", String)
256
+ ], InvestmentFilingPatch.prototype, "id", void 0);
257
+ tslib_1.__decorate([
258
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }),
259
+ tslib_1.__metadata("design:type", String)
260
+ ], InvestmentFilingPatch.prototype, "cuFlag", void 0);
261
+ tslib_1.__decorate([
262
+ (0, type_graphql_1.Field)({ nullable: true, description: 'What is to be filed' }),
263
+ tslib_1.__metadata("design:type", String)
264
+ ], InvestmentFilingPatch.prototype, "name", void 0);
265
+ tslib_1.__decorate([
266
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The law that asks for it' }),
267
+ tslib_1.__metadata("design:type", String)
268
+ ], InvestmentFilingPatch.prototype, "law", void 0);
269
+ tslib_1.__decorate([
270
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Where it is filed' }),
271
+ tslib_1.__metadata("design:type", String)
272
+ ], InvestmentFilingPatch.prototype, "authority", void 0);
273
+ tslib_1.__decorate([
274
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Day due - YYYY-MM-DD' }),
275
+ tslib_1.__metadata("design:type", String)
276
+ ], InvestmentFilingPatch.prototype, "dueOn", void 0);
277
+ tslib_1.__decorate([
278
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Day filed - YYYY-MM-DD' }),
279
+ tslib_1.__metadata("design:type", String)
280
+ ], InvestmentFilingPatch.prototype, "filedOn", void 0);
281
+ tslib_1.__decorate([
282
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
283
+ tslib_1.__metadata("design:type", String)
284
+ ], InvestmentFilingPatch.prototype, "description", void 0);
285
+ exports.InvestmentFilingPatch = InvestmentFilingPatch = tslib_1.__decorate([
286
+ (0, type_graphql_1.InputType)({ description: 'A row of the filing grid of an investee' })
287
+ ], InvestmentFilingPatch);
288
+ let InvesteeList = class InvesteeList {
289
+ };
290
+ exports.InvesteeList = InvesteeList;
291
+ tslib_1.__decorate([
292
+ (0, type_graphql_1.Field)(type => [investee_1.Investee], { description: 'Investees on the page' }),
293
+ tslib_1.__metadata("design:type", Array)
294
+ ], InvesteeList.prototype, "items", void 0);
295
+ tslib_1.__decorate([
296
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Number of investees matching the list parameters' }),
297
+ tslib_1.__metadata("design:type", Number)
298
+ ], InvesteeList.prototype, "total", void 0);
299
+ exports.InvesteeList = InvesteeList = tslib_1.__decorate([
300
+ (0, type_graphql_1.ObjectType)({ description: 'A page of investees' })
301
+ ], InvesteeList);
302
+ let LateInvestmentReport = class LateInvestmentReport {
303
+ };
304
+ exports.LateInvestmentReport = LateInvestmentReport;
305
+ tslib_1.__decorate([
306
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'The investee' }),
307
+ tslib_1.__metadata("design:type", String)
308
+ ], LateInvestmentReport.prototype, "investeeId", void 0);
309
+ tslib_1.__decorate([
310
+ (0, type_graphql_1.Field)({ description: 'The investee' }),
311
+ tslib_1.__metadata("design:type", String)
312
+ ], LateInvestmentReport.prototype, "investeeName", void 0);
313
+ tslib_1.__decorate([
314
+ (0, type_graphql_1.Field)({ description: 'The last day of the year the report covers' }),
315
+ tslib_1.__metadata("design:type", String)
316
+ ], LateInvestmentReport.prototype, "periodTo", void 0);
317
+ tslib_1.__decorate([
318
+ (0, type_graphql_1.Field)({ description: 'The day it was due' }),
319
+ tslib_1.__metadata("design:type", String)
320
+ ], LateInvestmentReport.prototype, "dueOn", void 0);
321
+ exports.LateInvestmentReport = LateInvestmentReport = tslib_1.__decorate([
322
+ (0, type_graphql_1.ObjectType)({ description: "An investee's report that is late - the year it covers and the day it was due" })
323
+ ], LateInvestmentReport);
324
+ //# sourceMappingURL=investment-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"investment-type.js","sourceRoot":"","sources":["../../../server/service/investment/investment-type.ts"],"names":[],"mappings":";;;;AAAA,+CAA2E;AAE3E,yCAAqC;AACrC,yDAA6G;AAGtG,IAAM,aAAa,GAAnB,MAAM,aAAa;CAazB,CAAA;AAbY,sCAAa;AACiE;IAAxF,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;;yCAAY;AAClB;IAAjF,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;;6CAAgB;AAC3B;IAArE,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE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AAoB;IADhC,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+EAA+E,EAAE,CAAC;GAChG,oBAAoB,CAKhC","sourcesContent":["import { Field, Float, ID, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { Investee } from './investee'\nimport { Contribution, HoldingReason, InvestmentReportKind, InvestmentRequestKind } from './investment-rules'\n\n@InputType({ description: 'A row of the investee grid (cuFlag + for new, M for changed, - for deleted)' })\nexport class InvesteePatch {\n @Field(type => ID, { nullable: true, description: 'The investee; empty for a new one' }) id?: string\n @Field({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }) cuFlag?: string\n @Field({ nullable: true, description: 'What the company is called' }) name?: string\n @Field({ nullable: true, description: 'The company as a counterparty' }) counterpartyId?: string\n @Field({ nullable: true, description: 'Country of incorporation - ISO 3166 alpha-2' }) country?: string\n @Field({ nullable: true, description: 'Registration number there' }) registrationNo?: string\n @Field({ nullable: true, description: 'Currency it reports in - ISO 4217' }) currency?: string\n @Field(type => Int, { nullable: true, description: 'Month its fiscal year ends, 1 to 12' }) fiscalYearEndMonth?: number\n @Field(type => Int, { nullable: true, description: \"Months after the year's end its report is due\" }) reportDueMonths?: number\n @Field({ nullable: true, description: 'Who signs for us as its shareholder' }) representative?: string\n @Field({ nullable: true, description: 'Whether we still hold its shares' }) active?: boolean\n @Field({ nullable: true, description: 'Notes' }) description?: string\n}\n\n@InputType({ description: 'A row of the holding grid of an investee' })\nexport class InvestmentHoldingPatch {\n @Field(type => ID, { nullable: true, description: 'The row; empty for a new one' }) id?: string\n @Field({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }) cuFlag?: string\n @Field({ nullable: true, description: 'The day the holding stood so - YYYY-MM-DD' }) recordDate?: string\n @Field(type => Float, { nullable: true, description: 'Our shares' }) ourShares?: number\n @Field(type => Float, { nullable: true, description: \"All the company's shares\" }) totalShares?: number\n @Field(type => HoldingReason, { nullable: true, description: 'Why it changed' }) reason?: HoldingReason\n @Field(type => Contribution, { nullable: true, description: 'What we gave for shares taken' }) contribution?: Contribution\n @Field(type => Float, { nullable: true, description: 'What the shares taken were valued at' }) amount?: number\n @Field({ nullable: true, description: 'Currency of the amount' }) currency?: string\n @Field({ nullable: true, description: 'Notes' }) description?: string\n}\n\n@InputType({ description: 'A row of the board seat grid of an investee' })\nexport class InvestmentBoardSeatPatch {\n @Field(type => ID, { nullable: true, description: 'The row; empty for a new one' }) id?: string\n @Field({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }) cuFlag?: string\n @Field({ nullable: true, description: 'Who sits on the board' }) director?: string\n @Field({ nullable: true, description: 'Day appointed - YYYY-MM-DD' }) appointedOn?: string\n @Field({ nullable: true, description: 'Day left - YYYY-MM-DD' }) resignedOn?: string\n @Field({ nullable: true, description: 'Notes' }) description?: string\n}\n\n@InputType({ description: 'A row of the report grid of an investee' })\nexport class InvestmentReportPatch {\n @Field(type => ID, { nullable: true, description: 'The row; empty for a new one' }) id?: string\n @Field({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }) cuFlag?: string\n @Field({ nullable: true, description: 'First day covered - YYYY-MM-DD' }) periodFrom?: string\n @Field({ nullable: true, description: 'Last day covered - YYYY-MM-DD' }) periodTo?: string\n @Field(type => InvestmentReportKind, { nullable: true, description: 'Audited, interim or management' }) kind?: InvestmentReportKind\n @Field({ nullable: true, description: 'Accounting standard' }) standard?: string\n @Field({ nullable: true, description: 'Auditor' }) auditor?: string\n @Field({ nullable: true, description: 'Day signed - YYYY-MM-DD' }) signedOn?: string\n @Field({ nullable: true, description: 'Day received - YYYY-MM-DD' }) receivedOn?: string\n @Field(type => Float, { nullable: true, description: 'Revenue' }) revenue?: number\n @Field(type => Float, { nullable: true, description: 'Net income' }) netIncome?: number\n @Field(type => Float, { nullable: true, description: 'Share capital' }) shareCapital?: number\n @Field(type => Float, { nullable: true, description: 'Total equity' }) totalEquity?: number\n @Field(type => Float, { nullable: true, description: 'Total assets' }) totalAssets?: number\n @Field({ nullable: true, description: 'Notes' }) description?: string\n}\n\n@InputType({ description: 'A row of the request grid of an investee' })\nexport class InvestmentRequestPatch {\n @Field(type => ID, { nullable: true, description: 'The row; empty for a new one' }) id?: string\n @Field({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }) cuFlag?: string\n @Field(type => InvestmentRequestKind, { nullable: true, description: 'What is asked' }) kind?: InvestmentRequestKind\n @Field({ nullable: true, description: 'What it is about' }) title?: string\n @Field({ nullable: true, description: 'Day received - YYYY-MM-DD' }) receivedOn?: string\n @Field({ nullable: true, description: 'Day due - YYYY-MM-DD' }) dueOn?: string\n @Field({ nullable: true, description: 'Day our answer was sent - YYYY-MM-DD' }) sentOn?: string\n @Field({ nullable: true, description: 'Who signed for us' }) signer?: string\n @Field({ nullable: true, description: 'Items and our answers, one per line' }) items?: string\n @Field({ nullable: true, description: 'Notes' }) description?: string\n}\n\n@InputType({ description: 'A row of the filing grid of an investee' })\nexport class InvestmentFilingPatch {\n @Field(type => ID, { nullable: true, description: 'The row; empty for a new one' }) id?: string\n @Field({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }) cuFlag?: string\n @Field({ nullable: true, description: 'What is to be filed' }) name?: string\n @Field({ nullable: true, description: 'The law that asks for it' }) law?: string\n @Field({ nullable: true, description: 'Where it is filed' }) authority?: string\n @Field({ nullable: true, description: 'Day due - YYYY-MM-DD' }) dueOn?: string\n @Field({ nullable: true, description: 'Day filed - YYYY-MM-DD' }) filedOn?: string\n @Field({ nullable: true, description: 'Notes' }) description?: string\n}\n\n@ObjectType({ description: 'A page of investees' })\nexport class InvesteeList {\n @Field(type => [Investee], { description: 'Investees on the page' }) items: Investee[]\n @Field(type => Int, { description: 'Number of investees matching the list parameters' }) total: number\n}\n\n@ObjectType({ description: \"An investee's report that is late - the year it covers and the day it was due\" })\nexport class LateInvestmentReport {\n @Field(type => ID, { description: 'The investee' }) investeeId: string\n @Field({ description: 'The investee' }) investeeName: string\n @Field({ description: 'The last day of the year the report covers' }) periodTo: string\n @Field({ description: 'The day it was due' }) dueOn: string\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { EntityManager, EntityTarget } from 'typeorm';
3
+ /** A grid row as the screens send it: `+` (or no id) a new row, `M` a changed one, `-` a deleted one. */
4
+ export type Patch = {
5
+ id?: string | null;
6
+ cuFlag?: string | null;
7
+ [field: string]: any;
8
+ };
9
+ /**
10
+ * Apply grid rows to one entity of a domain - the register's grids all save the same way. `rowOf` turns a patch (and the
11
+ * row it changes) into the fields to write and refuses what is wrong; deleting is soft. `parent` keeps a child grid to
12
+ * the rows of its parent. Every row is of the domain, or nothing is written.
13
+ */
14
+ export declare function applyPatches<T extends {
15
+ id: string;
16
+ }>(tx: EntityManager, target: EntityTarget<T>, domain: Domain, user: any, patches: Patch[], rowOf: (patch: Patch, old?: T) => Partial<T> | Promise<Partial<T>>, missing: string, parent?: Record<string, any>): Promise<T[]>;
17
+ /** A day as `YYYY-MM-DD`, or null when blank; anything else is refused with the field's code. */
18
+ export declare function dayOf(value: any, code: string, required?: boolean): string | null;
19
+ /** Words trimmed, or null when blank. */
20
+ export declare const textOf: (value: any) => string | null;
21
+ /** A number of zero or more, or null when blank. */
22
+ export declare function amountOf(value: any, code: string): number | null;
23
+ /** The fields of a patch to write: all of them for a new row, the ones it carries otherwise. */
24
+ export declare const touched: (patch: Patch, field: string, old?: unknown) => boolean;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.touched = exports.textOf = void 0;
4
+ exports.applyPatches = applyPatches;
5
+ exports.dayOf = dayOf;
6
+ exports.amountOf = amountOf;
7
+ const shell_1 = require("@things-factory/shell");
8
+ const typeorm_1 = require("typeorm");
9
+ const asset_rules_1 = require("./asset/asset-rules");
10
+ /**
11
+ * Apply grid rows to one entity of a domain - the register's grids all save the same way. `rowOf` turns a patch (and the
12
+ * row it changes) into the fields to write and refuses what is wrong; deleting is soft. `parent` keeps a child grid to
13
+ * the rows of its parent. Every row is of the domain, or nothing is written.
14
+ */
15
+ async function applyPatches(tx, target, domain, user, patches, rowOf, missing, parent) {
16
+ const repository = tx.getRepository(target);
17
+ const scope = { domain: { id: domain.id }, ...(parent ?? {}) };
18
+ const deletes = patches.filter(one => one.cuFlag === '-' && one.id).map(one => one.id);
19
+ if (deletes.length) {
20
+ const owned = await repository.find({ where: { ...scope, id: (0, typeorm_1.In)(deletes) }, select: ['id'] });
21
+ if (owned.length !== deletes.length)
22
+ throw new shell_1.Refusal(missing, {}, 'A row was not found - reload and try again');
23
+ await repository.softDelete({ id: (0, typeorm_1.In)(deletes) });
24
+ }
25
+ const saved = [];
26
+ for (const patch of patches.filter(one => one.cuFlag !== '-')) {
27
+ const isNew = !patch.id || patch.cuFlag === '+';
28
+ const old = isNew ? undefined : await repository.findOne({ where: { ...scope, id: patch.id } });
29
+ if (!isNew && !old)
30
+ throw new shell_1.Refusal(missing, {}, 'A row was not found - reload and try again');
31
+ const row = await rowOf(patch, old ?? undefined);
32
+ saved.push(await repository.save({ ...(old ?? {}), ...row, domain, ...(old ? {} : { creator: user }), updater: user }));
33
+ }
34
+ return saved;
35
+ }
36
+ /** A day as `YYYY-MM-DD`, or null when blank; anything else is refused with the field's code. */
37
+ function dayOf(value, code, required = false) {
38
+ const text = String(value ?? '').trim().slice(0, 10);
39
+ if (!text) {
40
+ if (required)
41
+ throw new shell_1.Refusal(code, {}, 'Write the day as YYYY-MM-DD');
42
+ return null;
43
+ }
44
+ if (!asset_rules_1.DATE.test(text) || Number.isNaN(Date.parse(text)))
45
+ throw new shell_1.Refusal(code, { value: text }, `'${text}' is not a day (YYYY-MM-DD)`);
46
+ return text;
47
+ }
48
+ /** Words trimmed, or null when blank. */
49
+ const textOf = (value) => String(value ?? '').trim() || null;
50
+ exports.textOf = textOf;
51
+ /** A number of zero or more, or null when blank. */
52
+ function amountOf(value, code) {
53
+ if (value === null || value === undefined || value === '')
54
+ return null;
55
+ const amount = Number(value);
56
+ if (!Number.isFinite(amount) || amount < 0)
57
+ throw new shell_1.Refusal(code, { value }, 'The amount is zero or more');
58
+ return amount;
59
+ }
60
+ /** The fields of a patch to write: all of them for a new row, the ones it carries otherwise. */
61
+ const touched = (patch, field, old) => !old || patch[field] !== undefined;
62
+ exports.touched = touched;
63
+ //# sourceMappingURL=patches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patches.js","sourceRoot":"","sources":["../../server/service/patches.ts"],"names":[],"mappings":";;;AAaA,oCA2BC;AAGD,sBAQC;AAMD,4BAKC;AA9DD,iDAAuD;AACvD,qCAAyD;AAEzD,qDAA0C;AAK1C;;;;GAIG;AACI,KAAK,UAAU,YAAY,CAChC,EAAiB,EACjB,MAAuB,EACvB,MAAc,EACd,IAAS,EACT,OAAgB,EAChB,KAAkE,EAClE,OAAe,EACf,MAA4B;IAE5B,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;IAC3C,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,EAAS,CAAA;IACrE,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAG,CAAC,CAAA;IACvF,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,IAAA,YAAE,EAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,IAAI,CAAQ,EAAE,CAAC,CAAA;QACpG,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;YAAE,MAAM,IAAI,eA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,EAAE,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,CAAA;AAA5F,QAAA,OAAO,WAAqF","sourcesContent":["import { Domain, Refusal } from '@things-factory/shell'\nimport { EntityManager, EntityTarget, In } from 'typeorm'\n\nimport { DATE } from './asset/asset-rules'\n\n/** A grid row as the screens send it: `+` (or no id) a new row, `M` a changed one, `-` a deleted one. */\nexport type Patch = { id?: string | null; cuFlag?: string | null; [field: string]: any }\n\n/**\n * Apply grid rows to one entity of a domain - the register's grids all save the same way. `rowOf` turns a patch (and the\n * row it changes) into the fields to write and refuses what is wrong; deleting is soft. `parent` keeps a child grid to\n * the rows of its parent. Every row is of the domain, or nothing is written.\n */\nexport async function applyPatches<T extends { id: string }>(\n tx: EntityManager,\n target: EntityTarget<T>,\n domain: Domain,\n user: any,\n patches: Patch[],\n rowOf: (patch: Patch, old?: T) => Partial<T> | Promise<Partial<T>>,\n missing: string,\n parent?: Record<string, any>\n): Promise<T[]> {\n const repository = tx.getRepository(target)\n const scope = { domain: { id: domain.id }, ...(parent ?? {}) } as any\n const deletes = patches.filter(one => one.cuFlag === '-' && one.id).map(one => one.id!)\n if (deletes.length) {\n const owned = await repository.find({ where: { ...scope, id: In(deletes) }, select: ['id'] as any })\n if (owned.length !== deletes.length) throw new Refusal(missing, {}, 'A row was not found - reload and try again')\n await repository.softDelete({ id: In(deletes) } as any)\n }\n const saved: T[] = []\n for (const patch of patches.filter(one => one.cuFlag !== '-')) {\n const isNew = !patch.id || patch.cuFlag === '+'\n const old = isNew ? undefined : await repository.findOne({ where: { ...scope, id: patch.id } })\n if (!isNew && !old) throw new Refusal(missing, {}, 'A row was not found - reload and try again')\n const row = await rowOf(patch, old ?? undefined)\n saved.push(await repository.save({ ...(old ?? {}), ...row, domain, ...(old ? {} : { creator: user }), updater: user } as any))\n }\n return saved\n}\n\n/** A day as `YYYY-MM-DD`, or null when blank; anything else is refused with the field's code. */\nexport function dayOf(value: any, code: string, required = false): string | null {\n const text = String(value ?? '').trim().slice(0, 10)\n if (!text) {\n if (required) throw new Refusal(code, {}, 'Write the day as YYYY-MM-DD')\n return null\n }\n if (!DATE.test(text) || Number.isNaN(Date.parse(text))) throw new Refusal(code, { value: text }, `'${text}' is not a day (YYYY-MM-DD)`)\n return text\n}\n\n/** Words trimmed, or null when blank. */\nexport const textOf = (value: any): string | null => String(value ?? '').trim() || null\n\n/** A number of zero or more, or null when blank. */\nexport function amountOf(value: any, code: string): number | null {\n if (value === null || value === undefined || value === '') return null\n const amount = Number(value)\n if (!Number.isFinite(amount) || amount < 0) throw new Refusal(code, { value }, 'The amount is zero or more')\n return amount\n}\n\n/** The fields of a patch to write: all of them for a new row, the ones it carries otherwise. */\nexport const touched = (patch: Patch, field: string, old?: unknown) => !old || patch[field] !== undefined\n"]}