@cyberismo/data-handler 0.0.14 → 0.0.16
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/card-metadata-updater.js +8 -4
- package/dist/card-metadata-updater.js.map +1 -1
- package/dist/command-handler.d.ts +4 -0
- package/dist/command-handler.js +29 -19
- package/dist/command-handler.js.map +1 -1
- package/dist/command-manager.d.ts +25 -2
- package/dist/command-manager.js +30 -5
- package/dist/command-manager.js.map +1 -1
- package/dist/commands/create.d.ts +1 -1
- package/dist/commands/create.js +45 -93
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/edit.d.ts +1 -15
- package/dist/commands/edit.js +15 -89
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/export.d.ts +11 -2
- package/dist/commands/export.js +58 -58
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/import.d.ts +9 -1
- package/dist/commands/import.js +17 -11
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/move.d.ts +1 -2
- package/dist/commands/move.js +107 -146
- package/dist/commands/move.js.map +1 -1
- package/dist/commands/remove.d.ts +8 -1
- package/dist/commands/remove.js +17 -48
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/rename.d.ts +4 -9
- package/dist/commands/rename.js +34 -108
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/show.d.ts +22 -34
- package/dist/commands/show.js +103 -151
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/transition.d.ts +9 -2
- package/dist/commands/transition.js +49 -44
- package/dist/commands/transition.js.map +1 -1
- package/dist/commands/update.d.ts +18 -12
- package/dist/commands/update.js +34 -18
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.d.ts +18 -10
- package/dist/commands/validate.js +101 -47
- package/dist/commands/validate.js.map +1 -1
- package/dist/containers/card-container.d.ts +87 -24
- package/dist/containers/card-container.js +183 -279
- package/dist/containers/card-container.js.map +1 -1
- package/dist/containers/project/calculation-engine.d.ts +13 -4
- package/dist/containers/project/calculation-engine.js +79 -77
- package/dist/containers/project/calculation-engine.js.map +1 -1
- package/dist/containers/project/card-cache.d.ts +146 -0
- package/dist/containers/project/card-cache.js +411 -0
- package/dist/containers/project/card-cache.js.map +1 -0
- package/dist/containers/project/project-paths.d.ts +5 -4
- package/dist/containers/project/project-paths.js +16 -12
- package/dist/containers/project/project-paths.js.map +1 -1
- package/dist/containers/project/resource-cache.d.ts +169 -0
- package/dist/containers/project/resource-cache.js +507 -0
- package/dist/containers/project/resource-cache.js.map +1 -0
- package/dist/containers/project/resource-handler.d.ts +129 -0
- package/dist/containers/project/resource-handler.js +206 -0
- package/dist/containers/project/resource-handler.js.map +1 -0
- package/dist/containers/project.d.ts +114 -195
- package/dist/containers/project.js +425 -535
- package/dist/containers/project.js.map +1 -1
- package/dist/containers/template.d.ts +22 -32
- package/dist/containers/template.js +113 -115
- package/dist/containers/template.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/folder-content-interfaces.d.ts +7 -4
- package/dist/interfaces/folder-content-interfaces.js +3 -3
- package/dist/interfaces/folder-content-interfaces.js.map +1 -1
- package/dist/interfaces/macros.d.ts +1 -0
- package/dist/interfaces/macros.js +1 -1
- package/dist/interfaces/macros.js.map +1 -1
- package/dist/interfaces/project-interfaces.d.ts +7 -5
- package/dist/interfaces/project-interfaces.js.map +1 -1
- package/dist/interfaces/resource-interfaces.d.ts +25 -22
- package/dist/interfaces/resource-interfaces.js +3 -0
- package/dist/interfaces/resource-interfaces.js.map +1 -1
- package/dist/macros/common.d.ts +10 -10
- package/dist/macros/createCards/index.d.ts +0 -13
- package/dist/macros/createCards/index.js.map +1 -1
- package/dist/macros/createCards/types.d.ts +44 -0
- package/dist/macros/createCards/types.js +15 -0
- package/dist/macros/createCards/types.js.map +1 -0
- package/dist/macros/graph/index.d.ts +2 -6
- package/dist/macros/graph/index.js +14 -28
- package/dist/macros/graph/index.js.map +1 -1
- package/dist/macros/graph/types.d.ts +23 -0
- package/dist/macros/graph/types.js +15 -0
- package/dist/macros/graph/types.js.map +1 -0
- package/dist/macros/image/index.d.ts +8 -16
- package/dist/macros/image/index.js +36 -33
- package/dist/macros/image/index.js.map +1 -1
- package/dist/macros/image/types.d.ts +38 -0
- package/dist/macros/image/types.js +15 -0
- package/dist/macros/image/types.js.map +1 -0
- package/dist/macros/include/index.d.ts +1 -6
- package/dist/macros/include/index.js +4 -7
- package/dist/macros/include/index.js.map +1 -1
- package/dist/macros/include/types.d.ts +31 -0
- package/dist/macros/include/types.js +15 -0
- package/dist/macros/include/types.js.map +1 -0
- package/dist/macros/index.d.ts +1 -1
- package/dist/macros/index.js +2 -2
- package/dist/macros/index.js.map +1 -1
- package/dist/macros/percentage/index.d.ts +0 -6
- package/dist/macros/percentage/index.js.map +1 -1
- package/dist/macros/percentage/types.d.ts +31 -0
- package/dist/macros/percentage/types.js +15 -0
- package/dist/macros/percentage/types.js.map +1 -0
- package/dist/macros/report/index.d.ts +0 -3
- package/dist/macros/report/index.js +3 -6
- package/dist/macros/report/index.js.map +1 -1
- package/dist/macros/report/types.d.ts +19 -0
- package/dist/macros/report/types.js +15 -0
- package/dist/macros/report/types.js.map +1 -0
- package/dist/macros/scoreCard/index.d.ts +0 -6
- package/dist/macros/scoreCard/index.js.map +1 -1
- package/dist/macros/scoreCard/types.d.ts +31 -0
- package/dist/macros/scoreCard/types.js +15 -0
- package/dist/macros/scoreCard/types.js.map +1 -0
- package/dist/macros/types.d.ts +25 -0
- package/dist/macros/types.js +2 -0
- package/dist/macros/types.js.map +1 -0
- package/dist/macros/vega/index.d.ts +0 -4
- package/dist/macros/vega/index.js.map +1 -1
- package/dist/macros/vega/types.d.ts +20 -0
- package/dist/macros/vega/types.js +2 -0
- package/dist/macros/vega/types.js.map +1 -0
- package/dist/macros/vegalite/index.d.ts +0 -4
- package/dist/macros/vegalite/index.js.map +1 -1
- package/dist/macros/vegalite/types.d.ts +20 -0
- package/dist/macros/vegalite/types.js +15 -0
- package/dist/macros/vegalite/types.js.map +1 -0
- package/dist/macros/xref/index.d.ts +0 -3
- package/dist/macros/xref/index.js +5 -14
- package/dist/macros/xref/index.js.map +1 -1
- package/dist/macros/xref/types.d.ts +19 -0
- package/dist/macros/xref/types.js +15 -0
- package/dist/macros/xref/types.js.map +1 -0
- package/dist/module-manager.d.ts +16 -3
- package/dist/module-manager.js +55 -23
- package/dist/module-manager.js.map +1 -1
- package/dist/project-settings.d.ts +16 -3
- package/dist/project-settings.js +79 -14
- package/dist/project-settings.js.map +1 -1
- package/dist/resources/calculation-resource.d.ts +6 -33
- package/dist/resources/calculation-resource.js +11 -60
- package/dist/resources/calculation-resource.js.map +1 -1
- package/dist/resources/card-type-resource.d.ts +10 -22
- package/dist/resources/card-type-resource.js +46 -66
- package/dist/resources/card-type-resource.js.map +1 -1
- package/dist/resources/create-defaults.d.ts +3 -2
- package/dist/resources/create-defaults.js +3 -2
- package/dist/resources/create-defaults.js.map +1 -1
- package/dist/resources/field-type-resource.d.ts +8 -22
- package/dist/resources/field-type-resource.js +35 -60
- package/dist/resources/field-type-resource.js.map +1 -1
- package/dist/resources/file-resource.d.ts +14 -35
- package/dist/resources/file-resource.js +22 -301
- package/dist/resources/file-resource.js.map +1 -1
- package/dist/resources/folder-resource.d.ts +44 -66
- package/dist/resources/folder-resource.js +102 -149
- package/dist/resources/folder-resource.js.map +1 -1
- package/dist/resources/graph-model-resource.d.ts +9 -34
- package/dist/resources/graph-model-resource.js +18 -64
- package/dist/resources/graph-model-resource.js.map +1 -1
- package/dist/resources/graph-view-resource.d.ts +9 -29
- package/dist/resources/graph-view-resource.js +13 -48
- package/dist/resources/graph-view-resource.js.map +1 -1
- package/dist/resources/link-type-resource.d.ts +9 -23
- package/dist/resources/link-type-resource.js +11 -33
- package/dist/resources/link-type-resource.js.map +1 -1
- package/dist/resources/report-resource.d.ts +10 -23
- package/dist/resources/report-resource.js +20 -67
- package/dist/resources/report-resource.js.map +1 -1
- package/dist/resources/resource-object.d.ts +143 -23
- package/dist/resources/resource-object.js +369 -48
- package/dist/resources/resource-object.js.map +1 -1
- package/dist/resources/template-resource.d.ts +10 -17
- package/dist/resources/template-resource.js +19 -27
- package/dist/resources/template-resource.js.map +1 -1
- package/dist/resources/workflow-resource.d.ts +9 -25
- package/dist/resources/workflow-resource.js +25 -55
- package/dist/resources/workflow-resource.js.map +1 -1
- package/dist/utils/card-utils.d.ts +69 -19
- package/dist/utils/card-utils.js +179 -30
- package/dist/utils/card-utils.js.map +1 -1
- package/dist/utils/clingo-fact-builder.d.ts +25 -14
- package/dist/utils/clingo-fact-builder.js +27 -5
- package/dist/utils/clingo-fact-builder.js.map +1 -1
- package/dist/utils/clingo-facts.js +14 -7
- package/dist/utils/clingo-facts.js.map +1 -1
- package/dist/utils/clingo-parser.js +1 -1
- package/dist/utils/clingo-parser.js.map +1 -1
- package/dist/utils/constants.d.ts +2 -0
- package/dist/utils/constants.js +4 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/csv.js +1 -1
- package/dist/utils/csv.js.map +1 -1
- package/dist/utils/resource-utils.d.ts +1 -0
- package/dist/utils/resource-utils.js +2 -1
- package/dist/utils/resource-utils.js.map +1 -1
- package/package.json +11 -11
- package/src/card-metadata-updater.ts +9 -7
- package/src/command-handler.ts +35 -23
- package/src/command-manager.ts +32 -19
- package/src/commands/create.ts +59 -160
- package/src/commands/edit.ts +16 -132
- package/src/commands/export.ts +71 -81
- package/src/commands/import.ts +26 -18
- package/src/commands/move.ts +143 -179
- package/src/commands/remove.ts +20 -59
- package/src/commands/rename.ts +45 -156
- package/src/commands/show.ts +153 -211
- package/src/commands/transition.ts +53 -58
- package/src/commands/update.ts +44 -23
- package/src/commands/validate.ts +108 -82
- package/src/containers/card-container.ts +200 -360
- package/src/containers/project/calculation-engine.ts +81 -105
- package/src/containers/project/card-cache.ts +497 -0
- package/src/containers/project/project-paths.ts +21 -13
- package/src/containers/project/resource-cache.ts +648 -0
- package/src/containers/project/resource-handler.ts +265 -0
- package/src/containers/project.ts +551 -693
- package/src/containers/template.ts +129 -142
- package/src/index.ts +1 -0
- package/src/interfaces/folder-content-interfaces.ts +14 -7
- package/src/interfaces/macros.ts +2 -0
- package/src/interfaces/project-interfaces.ts +14 -7
- package/src/interfaces/resource-interfaces.ts +30 -27
- package/src/macros/createCards/index.ts +1 -12
- package/src/macros/createCards/types.ts +46 -0
- package/src/macros/graph/index.ts +27 -52
- package/src/macros/graph/types.ts +24 -0
- package/src/macros/image/index.ts +50 -61
- package/src/macros/image/types.ts +39 -0
- package/src/macros/include/index.ts +6 -15
- package/src/macros/include/types.ts +32 -0
- package/src/macros/index.ts +2 -2
- package/src/macros/percentage/index.ts +1 -7
- package/src/macros/percentage/types.ts +32 -0
- package/src/macros/report/index.ts +4 -13
- package/src/macros/report/types.ts +20 -0
- package/src/macros/scoreCard/index.ts +1 -7
- package/src/macros/scoreCard/types.ts +32 -0
- package/src/macros/types.ts +48 -0
- package/src/macros/vega/index.ts +1 -4
- package/src/macros/vega/types.ts +21 -0
- package/src/macros/vegalite/index.ts +1 -4
- package/src/macros/vegalite/types.ts +22 -0
- package/src/macros/xref/index.ts +6 -20
- package/src/macros/xref/types.ts +20 -0
- package/src/module-manager.ts +79 -22
- package/src/project-settings.ts +84 -15
- package/src/resources/calculation-resource.ts +21 -91
- package/src/resources/card-type-resource.ts +74 -109
- package/src/resources/create-defaults.ts +3 -2
- package/src/resources/field-type-resource.ts +61 -104
- package/src/resources/file-resource.ts +33 -441
- package/src/resources/folder-resource.ts +130 -207
- package/src/resources/graph-model-resource.ts +36 -95
- package/src/resources/graph-view-resource.ts +28 -70
- package/src/resources/link-type-resource.ts +23 -53
- package/src/resources/report-resource.ts +34 -96
- package/src/resources/resource-object.ts +511 -66
- package/src/resources/template-resource.ts +32 -44
- package/src/resources/workflow-resource.ts +42 -85
- package/src/utils/card-utils.ts +217 -31
- package/src/utils/clingo-fact-builder.ts +28 -16
- package/src/utils/clingo-facts.ts +16 -7
- package/src/utils/clingo-parser.ts +1 -1
- package/src/utils/constants.ts +6 -0
- package/src/utils/csv.ts +1 -1
- package/src/utils/resource-utils.ts +2 -1
- package/dist/containers/project/resource-collector.d.ts +0 -87
- package/dist/containers/project/resource-collector.js +0 -337
- package/dist/containers/project/resource-collector.js.map +0 -1
- package/src/containers/project/resource-collector.ts +0 -396
package/src/commands/rename.ts
CHANGED
|
@@ -20,17 +20,6 @@ import type { Card } from '../interfaces/project-interfaces.js';
|
|
|
20
20
|
import { isTemplateCard } from '../utils/card-utils.js';
|
|
21
21
|
import { type Project, ResourcesFrom } from '../containers/project.js';
|
|
22
22
|
import { resourceName } from '../utils/resource-utils.js';
|
|
23
|
-
import { Template } from '../containers/template.js';
|
|
24
|
-
|
|
25
|
-
import { CalculationResource } from '../resources/calculation-resource.js';
|
|
26
|
-
import { CardTypeResource } from '../resources/card-type-resource.js';
|
|
27
|
-
import { FieldTypeResource } from '../resources/field-type-resource.js';
|
|
28
|
-
import { GraphModelResource } from '../resources/graph-model-resource.js';
|
|
29
|
-
import { GraphViewResource } from '../resources/graph-view-resource.js';
|
|
30
|
-
import { LinkTypeResource } from '../resources/link-type-resource.js';
|
|
31
|
-
import { ReportResource } from '../resources/report-resource.js';
|
|
32
|
-
import { TemplateResource } from '../resources/template-resource.js';
|
|
33
|
-
import { WorkflowResource } from '../resources/workflow-resource.js';
|
|
34
23
|
|
|
35
24
|
const FILE_TYPES_WITH_PREFIX_REFERENCES = ['adoc', 'hbs', 'json', 'lp'];
|
|
36
25
|
|
|
@@ -41,6 +30,10 @@ export class Rename {
|
|
|
41
30
|
private from: string = '';
|
|
42
31
|
private to: string = '';
|
|
43
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Creates an instance of Rename command.
|
|
35
|
+
* @param project Project instance to use.
|
|
36
|
+
*/
|
|
44
37
|
constructor(private project: Project) {}
|
|
45
38
|
|
|
46
39
|
// Renames a card and all of its attachments (if it is a project card).
|
|
@@ -183,93 +176,6 @@ export class Rename {
|
|
|
183
176
|
: name;
|
|
184
177
|
}
|
|
185
178
|
|
|
186
|
-
// @todo: merge all update-functions
|
|
187
|
-
// Updates card type's metadata.
|
|
188
|
-
private async updateCardTypeMetadata(cardTypeName: string) {
|
|
189
|
-
const cardType = new CardTypeResource(
|
|
190
|
-
this.project,
|
|
191
|
-
resourceName(cardTypeName),
|
|
192
|
-
);
|
|
193
|
-
return cardType.rename(resourceName(this.updateResourceName(cardTypeName)));
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Rename calculations.
|
|
197
|
-
private async updateCalculation(calculationName: string) {
|
|
198
|
-
const calculation = new CalculationResource(
|
|
199
|
-
this.project,
|
|
200
|
-
resourceName(calculationName),
|
|
201
|
-
);
|
|
202
|
-
return calculation.rename(
|
|
203
|
-
resourceName(this.updateResourceName(calculationName)),
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Updates field type's metadata.
|
|
208
|
-
private async updateFieldTypeMetadata(fieldTypeName: string) {
|
|
209
|
-
const fieldType = new FieldTypeResource(
|
|
210
|
-
this.project,
|
|
211
|
-
resourceName(fieldTypeName),
|
|
212
|
-
);
|
|
213
|
-
return fieldType.rename(
|
|
214
|
-
resourceName(this.updateResourceName(fieldTypeName)),
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Updates graph model's metadata.
|
|
219
|
-
private async updateGraphModelMetadata(graphModelName: string) {
|
|
220
|
-
const graphModel = new GraphModelResource(
|
|
221
|
-
this.project,
|
|
222
|
-
resourceName(graphModelName),
|
|
223
|
-
);
|
|
224
|
-
return graphModel.rename(
|
|
225
|
-
resourceName(this.updateResourceName(graphModelName)),
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Updates graph view's metadata.
|
|
230
|
-
private async updateGraphViewMetadata(graphViewName: string) {
|
|
231
|
-
const graphView = new GraphViewResource(
|
|
232
|
-
this.project,
|
|
233
|
-
resourceName(graphViewName),
|
|
234
|
-
);
|
|
235
|
-
return graphView.rename(
|
|
236
|
-
resourceName(this.updateResourceName(graphViewName)),
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// Updates link type's metadata.
|
|
241
|
-
private async updateLinkTypeMetadata(linkTypeName: string) {
|
|
242
|
-
const linkType = new LinkTypeResource(
|
|
243
|
-
this.project,
|
|
244
|
-
resourceName(linkTypeName),
|
|
245
|
-
);
|
|
246
|
-
return linkType.rename(resourceName(this.updateResourceName(linkTypeName)));
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// Updates reports' metadata.
|
|
250
|
-
private async updateReport(reportName: string) {
|
|
251
|
-
const report = new ReportResource(this.project, resourceName(reportName));
|
|
252
|
-
return report.rename(resourceName(this.updateResourceName(reportName)));
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// Rename templates.
|
|
256
|
-
private async updateTemplate(templateName: string) {
|
|
257
|
-
const template = new TemplateResource(
|
|
258
|
-
this.project,
|
|
259
|
-
resourceName(templateName),
|
|
260
|
-
);
|
|
261
|
-
return template.rename(resourceName(this.updateResourceName(templateName)));
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Rename workflows.
|
|
265
|
-
private async updateWorkflowMetadata(workflowName: string) {
|
|
266
|
-
const workflow = new WorkflowResource(
|
|
267
|
-
this.project,
|
|
268
|
-
resourceName(workflowName),
|
|
269
|
-
);
|
|
270
|
-
return workflow.rename(resourceName(this.updateResourceName(workflowName)));
|
|
271
|
-
}
|
|
272
|
-
|
|
273
179
|
/**
|
|
274
180
|
* Renames project prefix.
|
|
275
181
|
* @throws if trying to use empty 'to'
|
|
@@ -280,11 +186,6 @@ export class Rename {
|
|
|
280
186
|
if (!to) {
|
|
281
187
|
throw new Error(`Input validation error: empty 'to' is not allowed`);
|
|
282
188
|
}
|
|
283
|
-
const cardContent = {
|
|
284
|
-
metadata: true,
|
|
285
|
-
attachments: true,
|
|
286
|
-
content: true,
|
|
287
|
-
};
|
|
288
189
|
|
|
289
190
|
this.from = this.project.configuration.cardKeyPrefix;
|
|
290
191
|
this.to = to;
|
|
@@ -299,79 +200,67 @@ export class Rename {
|
|
|
299
200
|
await this.project.configuration.setCardPrefix(to);
|
|
300
201
|
console.info(`Rename: New prefix: '${this.project.projectPrefix}'`);
|
|
301
202
|
// Update the resources collection, since project prefix has changed.
|
|
302
|
-
this.project.
|
|
203
|
+
this.project.resources.changed();
|
|
303
204
|
|
|
304
205
|
// Rename local resources.
|
|
305
|
-
// It is better to rename the resources in this order: card types, field types, then
|
|
206
|
+
// It is better to rename the resources in this order: card types, workflows, field types, then the rest
|
|
306
207
|
|
|
307
208
|
// Rename all card types and custom fields in them.
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
209
|
+
for (const cardType of this.project.resources.cardTypes(
|
|
210
|
+
ResourcesFrom.localOnly,
|
|
211
|
+
)) {
|
|
212
|
+
const name = this.updateResourceName(cardType.data?.name || '');
|
|
213
|
+
await cardType.rename(resourceName(name));
|
|
311
214
|
}
|
|
312
215
|
console.info('Updated card types');
|
|
313
216
|
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
217
|
+
for (const workflow of this.project.resources.workflows(
|
|
218
|
+
ResourcesFrom.localOnly,
|
|
219
|
+
)) {
|
|
220
|
+
const name = this.updateResourceName(workflow.data?.name || '');
|
|
221
|
+
await workflow.rename(resourceName(name));
|
|
317
222
|
}
|
|
318
223
|
console.info('Updated workflows');
|
|
319
224
|
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
225
|
+
for (const fieldType of this.project.resources.fieldTypes(
|
|
226
|
+
ResourcesFrom.localOnly,
|
|
227
|
+
)) {
|
|
228
|
+
const name = this.updateResourceName(fieldType.data?.name || '');
|
|
229
|
+
await fieldType.rename(resourceName(name));
|
|
323
230
|
}
|
|
324
231
|
console.info('Updated field types');
|
|
325
232
|
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
const reports = await this.project.reports(ResourcesFrom.localOnly);
|
|
345
|
-
for (const report of reports) {
|
|
346
|
-
await this.updateReport(report.name);
|
|
347
|
-
}
|
|
348
|
-
console.info('Updated reports');
|
|
349
|
-
|
|
350
|
-
let templates = await this.project.templates(ResourcesFrom.localOnly);
|
|
351
|
-
for (const template of templates) {
|
|
352
|
-
await this.updateTemplate(template.name);
|
|
233
|
+
const restOfResourceTypes = [
|
|
234
|
+
'graphModels',
|
|
235
|
+
'graphViews',
|
|
236
|
+
'linkTypes',
|
|
237
|
+
'reports',
|
|
238
|
+
'templates',
|
|
239
|
+
'calculations',
|
|
240
|
+
] as const;
|
|
241
|
+
|
|
242
|
+
for (const resourceType of restOfResourceTypes) {
|
|
243
|
+
for (const resource of this.project.resources.resourceTypes(
|
|
244
|
+
resourceType,
|
|
245
|
+
ResourcesFrom.localOnly,
|
|
246
|
+
)) {
|
|
247
|
+
const name = this.updateResourceName(resource.data?.name || '');
|
|
248
|
+
await resource.rename(resourceName(name));
|
|
249
|
+
}
|
|
353
250
|
}
|
|
354
|
-
console.info('Updated templates');
|
|
355
251
|
|
|
356
|
-
|
|
252
|
+
// Rename all local template cards. This must be done after calculations have been renamed.
|
|
253
|
+
for (const template of this.project.resources.templates(
|
|
357
254
|
ResourcesFrom.localOnly,
|
|
358
|
-
)
|
|
359
|
-
|
|
360
|
-
await this.
|
|
361
|
-
}
|
|
362
|
-
console.info('Updated calculations');
|
|
363
|
-
|
|
364
|
-
// Rename all local template cards.
|
|
365
|
-
templates = await this.project.templates(ResourcesFrom.localOnly);
|
|
366
|
-
for (const template of templates) {
|
|
367
|
-
const templateObject = new Template(this.project, template);
|
|
368
|
-
await this.renameCards(await templateObject.cards('', cardContent));
|
|
255
|
+
)) {
|
|
256
|
+
const templateObject = template.templateObject();
|
|
257
|
+
await this.renameCards(templateObject.cards());
|
|
369
258
|
}
|
|
370
259
|
console.info('Renamed template cards and updated the content');
|
|
371
260
|
|
|
372
261
|
// Rename all project cards.
|
|
373
262
|
await this.renameCards(
|
|
374
|
-
|
|
263
|
+
this.project.cards(this.project.paths.cardRootFolder),
|
|
375
264
|
);
|
|
376
265
|
console.info('Renamed project cards and updated the content');
|
|
377
266
|
|
|
@@ -381,7 +270,7 @@ export class Rename {
|
|
|
381
270
|
console.info('Renamed all remaining references in .cards folder');
|
|
382
271
|
|
|
383
272
|
// It is best that the resources are re-collected after all the renaming has occurred.
|
|
384
|
-
this.project.
|
|
273
|
+
this.project.resources.changed();
|
|
385
274
|
console.info('Collected renamed resources');
|
|
386
275
|
|
|
387
276
|
return this.project.calculationEngine.generate();
|