@cyberismo/data-handler 0.0.15 → 0.0.17
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 +7 -1
- package/dist/card-metadata-updater.js.map +1 -1
- package/dist/command-handler.d.ts +4 -0
- package/dist/command-handler.js +22 -8
- package/dist/command-handler.js.map +1 -1
- package/dist/command-manager.d.ts +24 -1
- package/dist/command-manager.js +31 -7
- package/dist/command-manager.js.map +1 -1
- package/dist/commands/create.d.ts +1 -1
- package/dist/commands/create.js +34 -36
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/export.d.ts +11 -2
- package/dist/commands/export.js +54 -41
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/fetch.d.ts +8 -0
- package/dist/commands/fetch.js +101 -23
- package/dist/commands/fetch.js.map +1 -1
- package/dist/commands/import.d.ts +14 -3
- package/dist/commands/import.js +27 -10
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/move.js +0 -1
- package/dist/commands/move.js.map +1 -1
- package/dist/commands/remove.d.ts +11 -2
- package/dist/commands/remove.js +15 -5
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/rename.d.ts +4 -9
- package/dist/commands/rename.js +37 -101
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/show.d.ts +20 -12
- package/dist/commands/show.js +79 -57
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/transition.d.ts +9 -2
- package/dist/commands/transition.js +25 -17
- package/dist/commands/transition.js.map +1 -1
- package/dist/commands/update.d.ts +16 -12
- package/dist/commands/update.js +19 -17
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.d.ts +17 -9
- package/dist/commands/validate.js +94 -35
- package/dist/commands/validate.js.map +1 -1
- package/dist/containers/card-container.d.ts +7 -5
- package/dist/containers/card-container.js +30 -5
- package/dist/containers/card-container.js.map +1 -1
- package/dist/containers/project/calculation-engine.d.ts +7 -4
- package/dist/containers/project/calculation-engine.js +61 -66
- package/dist/containers/project/calculation-engine.js.map +1 -1
- package/dist/containers/project/project-paths.d.ts +7 -4
- package/dist/containers/project/project-paths.js +22 -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 +509 -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 +46 -152
- package/dist/containers/project.js +179 -409
- package/dist/containers/project.js.map +1 -1
- package/dist/containers/template.d.ts +8 -2
- package/dist/containers/template.js +24 -19
- package/dist/containers/template.js.map +1 -1
- package/dist/interfaces/command-options.d.ts +3 -1
- package/dist/interfaces/folder-content-interfaces.d.ts +5 -3
- package/dist/interfaces/folder-content-interfaces.js +3 -3
- package/dist/interfaces/folder-content-interfaces.js.map +1 -1
- package/dist/interfaces/project-interfaces.d.ts +7 -9
- package/dist/interfaces/project-interfaces.js.map +1 -1
- package/dist/interfaces/resource-interfaces.d.ts +14 -1
- package/dist/interfaces/resource-interfaces.js.map +1 -1
- package/dist/macros/graph/index.js +12 -26
- package/dist/macros/graph/index.js.map +1 -1
- 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/report/index.js +3 -6
- package/dist/macros/report/index.js.map +1 -1
- package/dist/module-manager.d.ts +16 -3
- package/dist/module-manager.js +51 -19
- package/dist/module-manager.js.map +1 -1
- package/dist/project-settings.d.ts +21 -3
- package/dist/project-settings.js +91 -14
- package/dist/project-settings.js.map +1 -1
- package/dist/resources/calculation-resource.d.ts +4 -3
- package/dist/resources/calculation-resource.js +11 -5
- package/dist/resources/calculation-resource.js.map +1 -1
- package/dist/resources/card-type-resource.d.ts +6 -1
- package/dist/resources/card-type-resource.js +34 -23
- 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 +4 -1
- package/dist/resources/field-type-resource.js +22 -23
- package/dist/resources/field-type-resource.js.map +1 -1
- package/dist/resources/file-resource.d.ts +5 -9
- package/dist/resources/file-resource.js +6 -11
- package/dist/resources/file-resource.js.map +1 -1
- package/dist/resources/folder-resource.d.ts +29 -32
- package/dist/resources/folder-resource.js +59 -78
- package/dist/resources/folder-resource.js.map +1 -1
- package/dist/resources/graph-model-resource.d.ts +4 -1
- package/dist/resources/graph-model-resource.js +11 -4
- package/dist/resources/graph-model-resource.js.map +1 -1
- package/dist/resources/graph-view-resource.d.ts +5 -2
- package/dist/resources/graph-view-resource.js +7 -3
- package/dist/resources/graph-view-resource.js.map +1 -1
- package/dist/resources/link-type-resource.d.ts +5 -2
- package/dist/resources/link-type-resource.js +5 -2
- package/dist/resources/link-type-resource.js.map +1 -1
- package/dist/resources/report-resource.d.ts +6 -7
- package/dist/resources/report-resource.js +14 -23
- package/dist/resources/report-resource.js.map +1 -1
- package/dist/resources/resource-object.d.ts +94 -8
- package/dist/resources/resource-object.js +212 -109
- package/dist/resources/resource-object.js.map +1 -1
- package/dist/resources/template-resource.d.ts +7 -3
- package/dist/resources/template-resource.js +10 -3
- package/dist/resources/template-resource.js.map +1 -1
- package/dist/resources/workflow-resource.d.ts +5 -2
- package/dist/resources/workflow-resource.js +18 -22
- package/dist/resources/workflow-resource.js.map +1 -1
- package/dist/utils/card-utils.d.ts +2 -2
- package/dist/utils/card-utils.js +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 +3 -4
- package/dist/utils/clingo-facts.js.map +1 -1
- package/dist/utils/configuration-logger.d.ts +91 -0
- package/dist/utils/configuration-logger.js +151 -0
- package/dist/utils/configuration-logger.js.map +1 -0
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +5 -3
- package/dist/utils/constants.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 +9 -9
- package/src/card-metadata-updater.ts +6 -2
- package/src/command-handler.ts +39 -12
- package/src/command-manager.ts +33 -21
- package/src/commands/create.ts +43 -78
- package/src/commands/export.ts +63 -52
- package/src/commands/fetch.ts +143 -34
- package/src/commands/import.ts +37 -15
- package/src/commands/move.ts +0 -1
- package/src/commands/remove.ts +20 -7
- package/src/commands/rename.ts +58 -149
- package/src/commands/show.ts +123 -80
- package/src/commands/transition.ts +26 -28
- package/src/commands/update.ts +25 -22
- package/src/commands/validate.ts +104 -67
- package/src/containers/card-container.ts +37 -5
- package/src/containers/project/calculation-engine.ts +61 -93
- package/src/containers/project/project-paths.ts +29 -13
- package/src/containers/project/resource-cache.ts +651 -0
- package/src/containers/project/resource-handler.ts +265 -0
- package/src/containers/project.ts +250 -527
- package/src/containers/template.ts +28 -23
- package/src/interfaces/command-options.ts +3 -1
- package/src/interfaces/folder-content-interfaces.ts +7 -6
- package/src/interfaces/project-interfaces.ts +12 -11
- package/src/interfaces/resource-interfaces.ts +18 -3
- package/src/macros/graph/index.ts +26 -47
- package/src/macros/index.ts +2 -2
- package/src/macros/report/index.ts +3 -9
- package/src/module-manager.ts +74 -17
- package/src/project-settings.ts +96 -14
- package/src/resources/calculation-resource.ts +18 -18
- package/src/resources/card-type-resource.ts +50 -50
- package/src/resources/create-defaults.ts +3 -2
- package/src/resources/field-type-resource.ts +41 -55
- package/src/resources/file-resource.ts +10 -36
- package/src/resources/folder-resource.ts +69 -120
- package/src/resources/graph-model-resource.ts +20 -22
- package/src/resources/graph-view-resource.ts +15 -17
- package/src/resources/link-type-resource.ts +10 -13
- package/src/resources/report-resource.ts +21 -43
- package/src/resources/resource-object.ts +263 -149
- package/src/resources/template-resource.ts +17 -16
- package/src/resources/workflow-resource.ts +25 -44
- package/src/utils/card-utils.ts +2 -2
- package/src/utils/clingo-fact-builder.ts +28 -16
- package/src/utils/clingo-facts.ts +3 -4
- package/src/utils/configuration-logger.ts +206 -0
- package/src/utils/constants.ts +5 -3
- package/src/utils/resource-utils.ts +2 -1
- package/dist/containers/project/resource-collector.d.ts +0 -110
- package/dist/containers/project/resource-collector.js +0 -344
- package/dist/containers/project/resource-collector.js.map +0 -1
- package/src/containers/project/resource-collector.ts +0 -404
|
@@ -27,7 +27,7 @@ import type { Card, Context } from '../../interfaces/project-interfaces.js';
|
|
|
27
27
|
import ClingoParser from '../../utils/clingo-parser.js';
|
|
28
28
|
import { Mutex } from 'async-mutex';
|
|
29
29
|
import Handlebars from 'handlebars';
|
|
30
|
-
import {
|
|
30
|
+
import type { Project } from '../../containers/project.js';
|
|
31
31
|
import { getChildLogger } from '../../utils/log-utils.js';
|
|
32
32
|
import {
|
|
33
33
|
createCardFacts,
|
|
@@ -50,7 +50,6 @@ import type {
|
|
|
50
50
|
TemplateMetadata,
|
|
51
51
|
Workflow,
|
|
52
52
|
} from '../../interfaces/resource-interfaces.js';
|
|
53
|
-
import { CalculationResource } from '../../resources/calculation-resource.js';
|
|
54
53
|
import {
|
|
55
54
|
removeAllPrograms,
|
|
56
55
|
solve,
|
|
@@ -61,7 +60,6 @@ import {
|
|
|
61
60
|
import { generateReportContent } from '../../utils/report.js';
|
|
62
61
|
import { lpFiles, graphvizReport } from '@cyberismo/assets';
|
|
63
62
|
import {
|
|
64
|
-
resourceName,
|
|
65
63
|
type ResourceName,
|
|
66
64
|
resourceNameToString,
|
|
67
65
|
} from '../../utils/resource-utils.js';
|
|
@@ -122,7 +120,7 @@ export class CalculationEngine {
|
|
|
122
120
|
await writeFile(destination, logicProgram);
|
|
123
121
|
}
|
|
124
122
|
|
|
125
|
-
//
|
|
123
|
+
// Wrapper to run onCreation query.
|
|
126
124
|
private async creationQuery(cardKeys: string[], context: Context) {
|
|
127
125
|
if (!cardKeys) return undefined;
|
|
128
126
|
return this.runQuery('onCreation', context, {
|
|
@@ -145,10 +143,10 @@ export class CalculationEngine {
|
|
|
145
143
|
|
|
146
144
|
// Generates logic programs related to modules (and project itself).
|
|
147
145
|
private async generateModules() {
|
|
148
|
-
const modules =
|
|
146
|
+
const modules = this.project.resources.moduleNames();
|
|
149
147
|
let content = '';
|
|
150
148
|
for (const module of await Promise.all(
|
|
151
|
-
modules.map((mod) => this.project.module(mod
|
|
149
|
+
modules.map((mod) => this.project.module(mod)),
|
|
152
150
|
)) {
|
|
153
151
|
if (!module) continue;
|
|
154
152
|
const moduleContent = createModuleFacts(module);
|
|
@@ -161,119 +159,81 @@ export class CalculationEngine {
|
|
|
161
159
|
|
|
162
160
|
// Sets individual CardType programs
|
|
163
161
|
private async setCardTypesPrograms() {
|
|
164
|
-
const cardTypes =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (!cardType) continue;
|
|
170
|
-
|
|
171
|
-
const cardTypeContent = createCardTypeFacts(cardType);
|
|
172
|
-
setProgram(cardType.name, cardTypeContent, [ALL_CATEGORY]);
|
|
162
|
+
const cardTypes = this.project.resources.cardTypes();
|
|
163
|
+
for (const cardType of cardTypes) {
|
|
164
|
+
const ct = cardType.show();
|
|
165
|
+
const cardTypeContent = createCardTypeFacts(ct);
|
|
166
|
+
setProgram(ct.name, cardTypeContent, [ALL_CATEGORY]);
|
|
173
167
|
}
|
|
174
168
|
}
|
|
175
169
|
|
|
176
170
|
// Sets individual FieldType programs
|
|
177
171
|
private async setFieldTypesPrograms() {
|
|
178
|
-
const fieldTypes =
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (!fieldType) continue;
|
|
184
|
-
|
|
185
|
-
const fieldTypeContent = createFieldTypeFacts(fieldType);
|
|
186
|
-
setProgram(fieldType.name, fieldTypeContent, [ALL_CATEGORY]);
|
|
172
|
+
const fieldTypes = this.project.resources.fieldTypes();
|
|
173
|
+
for (const fieldType of fieldTypes) {
|
|
174
|
+
const ft = fieldType.show();
|
|
175
|
+
const fieldTypeContent = createFieldTypeFacts(ft);
|
|
176
|
+
setProgram(ft.name, fieldTypeContent, [ALL_CATEGORY]);
|
|
187
177
|
}
|
|
188
178
|
}
|
|
189
179
|
|
|
190
180
|
// Sets individual LinkType programs
|
|
191
181
|
private async setLinkTypesPrograms() {
|
|
192
|
-
const linkTypes =
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (!linkType) continue;
|
|
198
|
-
|
|
199
|
-
const linkTypeContent = createLinkTypeFacts(linkType);
|
|
200
|
-
setProgram(linkType.name, linkTypeContent, [ALL_CATEGORY]);
|
|
182
|
+
const linkTypes = this.project.resources.linkTypes();
|
|
183
|
+
for (const linkType of linkTypes) {
|
|
184
|
+
const lt = linkType.show();
|
|
185
|
+
const linkTypeContent = createLinkTypeFacts(lt);
|
|
186
|
+
setProgram(lt.name, linkTypeContent, [ALL_CATEGORY]);
|
|
201
187
|
}
|
|
202
188
|
}
|
|
203
189
|
|
|
204
190
|
// Sets individual Workflow programs
|
|
205
191
|
private async setWorkflowsPrograms() {
|
|
206
|
-
const workflows =
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (!workflow) continue;
|
|
212
|
-
|
|
213
|
-
const workflowContent = createWorkflowFacts(workflow);
|
|
214
|
-
setProgram(workflow.name, workflowContent, [ALL_CATEGORY]);
|
|
192
|
+
const workflows = this.project.resources.workflows();
|
|
193
|
+
for (const workflow of workflows) {
|
|
194
|
+
const wf = workflow.show();
|
|
195
|
+
const workflowContent = createWorkflowFacts(wf);
|
|
196
|
+
setProgram(wf.name, workflowContent, [ALL_CATEGORY]);
|
|
215
197
|
}
|
|
216
198
|
}
|
|
217
199
|
|
|
218
200
|
// Sets individual Report programs
|
|
219
201
|
private async setReportsPrograms() {
|
|
220
|
-
const reports =
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (!report) continue;
|
|
226
|
-
|
|
227
|
-
const reportContent = createReportFacts(report);
|
|
228
|
-
setProgram(report.name, reportContent, [ALL_CATEGORY]);
|
|
202
|
+
const reports = this.project.resources.reports();
|
|
203
|
+
for (const report of reports) {
|
|
204
|
+
const rep = report.show();
|
|
205
|
+
const reportContent = createReportFacts(rep);
|
|
206
|
+
setProgram(rep.name, reportContent, [ALL_CATEGORY]);
|
|
229
207
|
}
|
|
230
208
|
}
|
|
231
209
|
|
|
232
210
|
// Sets individual Template programs
|
|
233
211
|
private async setTemplatesPrograms() {
|
|
234
|
-
const templates =
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (!template) continue;
|
|
240
|
-
|
|
241
|
-
const templateContent = createTemplateFacts(template);
|
|
242
|
-
const cards = this.getCards(template.name);
|
|
212
|
+
const templates = this.project.resources.templates();
|
|
213
|
+
for (const template of templates) {
|
|
214
|
+
const tem = template.show();
|
|
215
|
+
const templateContent = createTemplateFacts(tem);
|
|
216
|
+
const cards = this.getCards(tem.name);
|
|
243
217
|
for (const card of cards) {
|
|
244
218
|
const cardContent = await createCardFacts(card, this.project);
|
|
245
219
|
setProgram(card.key, cardContent, [ALL_CATEGORY]);
|
|
246
220
|
}
|
|
247
|
-
setProgram(
|
|
221
|
+
setProgram(tem.name, templateContent, [ALL_CATEGORY]);
|
|
248
222
|
}
|
|
249
223
|
}
|
|
250
224
|
|
|
251
225
|
// Sets individual Calculation programs
|
|
252
226
|
private async setCalculationsPrograms() {
|
|
253
|
-
const calculations =
|
|
254
|
-
|
|
255
|
-
for (const calculationFile of calculations) {
|
|
227
|
+
const calculations = this.project.resources.calculations();
|
|
228
|
+
for (const calculation of calculations) {
|
|
256
229
|
try {
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
);
|
|
261
|
-
if (calculationResource) {
|
|
262
|
-
const resource = await calculationResource.show();
|
|
263
|
-
if (!resource?.content.calculation) {
|
|
264
|
-
this.logger.info(
|
|
265
|
-
`Calculation resource '${resource.name}' does not have calculation file`,
|
|
266
|
-
);
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
|
-
setProgram(calculationFile.name, resource.content.calculation, [
|
|
270
|
-
ALL_CATEGORY,
|
|
271
|
-
]);
|
|
272
|
-
}
|
|
230
|
+
const content = calculation.contentData();
|
|
231
|
+
const calc = calculation.show();
|
|
232
|
+
setProgram(calc.name, content.calculation, [ALL_CATEGORY]);
|
|
273
233
|
} catch (error) {
|
|
274
234
|
this.logger.warn(
|
|
275
235
|
error,
|
|
276
|
-
`Failed to read calculation ${
|
|
236
|
+
`Failed to read calculation ${calculation.data!.name}`,
|
|
277
237
|
);
|
|
278
238
|
}
|
|
279
239
|
}
|
|
@@ -296,6 +256,15 @@ export class CalculationEngine {
|
|
|
296
256
|
return parser.parseInput(data.join('\n'));
|
|
297
257
|
}
|
|
298
258
|
|
|
259
|
+
//
|
|
260
|
+
private queryContent(queryName: QueryName, options?: unknown) {
|
|
261
|
+
const content = lpFiles.queries[queryName];
|
|
262
|
+
const handlebars = Handlebars.create();
|
|
263
|
+
const compiled = handlebars.compile(content);
|
|
264
|
+
return compiled(options || {});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
//
|
|
299
268
|
private async run(query: string, context: Context): Promise<string[]> {
|
|
300
269
|
try {
|
|
301
270
|
const res = await CalculationEngine.mutex.runExclusive(async () => {
|
|
@@ -453,9 +422,12 @@ export class CalculationEngine {
|
|
|
453
422
|
public async resourceLogicProgram(
|
|
454
423
|
resourceName: ResourceName,
|
|
455
424
|
): Promise<string> {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
425
|
+
let resource;
|
|
426
|
+
try {
|
|
427
|
+
resource = this.project.resources.byType(resourceName).data;
|
|
428
|
+
} catch {
|
|
429
|
+
resource = undefined;
|
|
430
|
+
}
|
|
459
431
|
if (!resource) {
|
|
460
432
|
throw new Error(
|
|
461
433
|
`Resource '${resourceNameToString(resourceName)}' does not exist in the project`,
|
|
@@ -482,8 +454,9 @@ export class CalculationEngine {
|
|
|
482
454
|
|
|
483
455
|
/**
|
|
484
456
|
* Runs given logic program and creates a graph using clingraph
|
|
485
|
-
* @param
|
|
486
|
-
* @param
|
|
457
|
+
* @param model Graph model to use.
|
|
458
|
+
* @param view Graph view to use.
|
|
459
|
+
* @param context In which type of context the query is run.
|
|
487
460
|
* @returns a base64 encoded image as a string
|
|
488
461
|
*/
|
|
489
462
|
public async runGraph(model: string, view: string, context: Context) {
|
|
@@ -521,6 +494,7 @@ export class CalculationEngine {
|
|
|
521
494
|
/**
|
|
522
495
|
* Runs a logic program using clingo.
|
|
523
496
|
* @param query Logic program to be run
|
|
497
|
+
* @param context In which type of context the query is run.
|
|
524
498
|
* @returns parsed program output
|
|
525
499
|
*/
|
|
526
500
|
public async runLogicProgram(query: string, context: Context = 'localApp') {
|
|
@@ -528,16 +502,10 @@ export class CalculationEngine {
|
|
|
528
502
|
return this.parseClingoResult(clingoOutput);
|
|
529
503
|
}
|
|
530
504
|
|
|
531
|
-
private queryContent(queryName: QueryName, options?: unknown) {
|
|
532
|
-
const content = lpFiles.queries[queryName];
|
|
533
|
-
const handlebars = Handlebars.create();
|
|
534
|
-
const compiled = handlebars.compile(content);
|
|
535
|
-
return compiled(options || {});
|
|
536
|
-
}
|
|
537
|
-
|
|
538
505
|
/**
|
|
539
506
|
* Runs a pre-defined query.
|
|
540
507
|
* @param queryName Name of the query file without extension
|
|
508
|
+
* @param context In which type of context the query is run.
|
|
541
509
|
* @param options Any object that contains state for handlebars
|
|
542
510
|
* @returns parsed program output
|
|
543
511
|
*/
|
|
@@ -64,6 +64,10 @@ export class ProjectPaths {
|
|
|
64
64
|
return join(this.resourcesFolder, 'cardsConfig.json');
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
public get configurationChangesLog(): string {
|
|
68
|
+
return join(this.migrationLogFolder, 'current', 'migrationLog.jsonl');
|
|
69
|
+
}
|
|
70
|
+
|
|
67
71
|
public get fieldTypesFolder(): string {
|
|
68
72
|
return join(this.resourcesFolder, 'fieldTypes');
|
|
69
73
|
}
|
|
@@ -84,10 +88,22 @@ export class ProjectPaths {
|
|
|
84
88
|
return join(this.path, '.logs', 'cyberismo_data-handler.log');
|
|
85
89
|
}
|
|
86
90
|
|
|
91
|
+
public get migrationLogFolder(): string {
|
|
92
|
+
return join(this.resourcesFolder, 'migrations');
|
|
93
|
+
}
|
|
94
|
+
|
|
87
95
|
public get modulesFolder(): string {
|
|
88
96
|
return join(this.path, '.cards', 'modules');
|
|
89
97
|
}
|
|
90
98
|
|
|
99
|
+
public moduleResourcePath(
|
|
100
|
+
modulePrefix: string,
|
|
101
|
+
resourceType: ResourceFolderType,
|
|
102
|
+
) {
|
|
103
|
+
const moduleRoot = join(this.modulesFolder, modulePrefix);
|
|
104
|
+
return join(moduleRoot, resourceType);
|
|
105
|
+
}
|
|
106
|
+
|
|
91
107
|
public get resourcesFolder(): string {
|
|
92
108
|
return join(this.path, '.cards', 'local');
|
|
93
109
|
}
|
|
@@ -96,6 +112,19 @@ export class ProjectPaths {
|
|
|
96
112
|
return join(this.resourcesFolder, 'reports');
|
|
97
113
|
}
|
|
98
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Return path to a resource type folder.
|
|
117
|
+
* @param resourceType Type of resource
|
|
118
|
+
* @returns path to a resources folder (e.g. '.cards/local/cardTypes')
|
|
119
|
+
*/
|
|
120
|
+
public resourcePath(resourceType: ResourceFolderType): string {
|
|
121
|
+
const resourcePath = this.pathMap.get(resourceType);
|
|
122
|
+
if (!resourcePath) {
|
|
123
|
+
throw new Error(`unknown resourceType: ${resourceType}`);
|
|
124
|
+
}
|
|
125
|
+
return resourcePath;
|
|
126
|
+
}
|
|
127
|
+
|
|
99
128
|
public get tempCardFolder(): string {
|
|
100
129
|
return join(this.tempFolder, 'cards');
|
|
101
130
|
}
|
|
@@ -111,17 +140,4 @@ export class ProjectPaths {
|
|
|
111
140
|
public get workflowsFolder(): string {
|
|
112
141
|
return join(this.resourcesFolder, 'workflows');
|
|
113
142
|
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Return path to a resource type folder.
|
|
117
|
-
* @param resourceType Type of resource
|
|
118
|
-
* @returns path to a resources folder (e.g. '.cards/local/cardTypes')
|
|
119
|
-
*/
|
|
120
|
-
public resourcePath(resourceType: ResourceFolderType): string {
|
|
121
|
-
const resourcePath = this.pathMap.get(resourceType);
|
|
122
|
-
if (!resourcePath) {
|
|
123
|
-
throw new Error(`unknown resourceType: ${resourceType}`);
|
|
124
|
-
}
|
|
125
|
-
return resourcePath;
|
|
126
|
-
}
|
|
127
143
|
}
|