@cyberismo/data-handler 0.0.13 → 0.0.15
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 +1 -3
- package/dist/card-metadata-updater.js.map +1 -1
- package/dist/command-handler.js +13 -17
- package/dist/command-handler.js.map +1 -1
- package/dist/command-manager.d.ts +1 -1
- package/dist/command-manager.js +4 -3
- package/dist/command-manager.js.map +1 -1
- package/dist/commands/create.d.ts +3 -3
- package/dist/commands/create.js +20 -81
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/edit.d.ts +12 -25
- package/dist/commands/edit.js +25 -74
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/export.js +4 -17
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/fetch.js +2 -1
- package/dist/commands/fetch.js.map +1 -1
- package/dist/commands/import.js +3 -5
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/move.d.ts +1 -2
- package/dist/commands/move.js +108 -146
- package/dist/commands/move.js.map +1 -1
- package/dist/commands/remove.js +15 -49
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/rename.d.ts +1 -0
- package/dist/commands/rename.js +13 -7
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/show.d.ts +7 -25
- package/dist/commands/show.js +39 -113
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/transition.js +27 -30
- package/dist/commands/transition.js.map +1 -1
- package/dist/commands/update.d.ts +5 -3
- package/dist/commands/update.js +19 -5
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.d.ts +3 -3
- package/dist/commands/validate.js +20 -27
- 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 +6 -0
- package/dist/containers/project/calculation-engine.js +36 -29
- 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/resource-collector.d.ts +24 -1
- package/dist/containers/project/resource-collector.js +8 -1
- package/dist/containers/project/resource-collector.js.map +1 -1
- package/dist/containers/project.d.ts +119 -84
- package/dist/containers/project.js +423 -253
- package/dist/containers/project.js.map +1 -1
- package/dist/containers/template.d.ts +15 -31
- package/dist/containers/template.js +97 -104
- 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 +12 -5
- package/dist/interfaces/folder-content-interfaces.js +5 -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 +16 -10
- package/dist/interfaces/project-interfaces.js +10 -8
- package/dist/interfaces/project-interfaces.js.map +1 -1
- package/dist/interfaces/resource-interfaces.d.ts +21 -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 +2 -2
- 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/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.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.js +4 -4
- package/dist/module-manager.js.map +1 -1
- package/dist/project-settings.js.map +1 -1
- package/dist/resources/calculation-resource.d.ts +43 -0
- package/dist/resources/calculation-resource.js +75 -0
- package/dist/resources/calculation-resource.js.map +1 -0
- package/dist/resources/card-type-resource.d.ts +4 -21
- package/dist/resources/card-type-resource.js +13 -44
- package/dist/resources/card-type-resource.js.map +1 -1
- package/dist/resources/create-defaults.d.ts +13 -6
- package/dist/resources/create-defaults.js +19 -5
- package/dist/resources/create-defaults.js.map +1 -1
- package/dist/resources/field-type-resource.d.ts +4 -21
- package/dist/resources/field-type-resource.js +14 -38
- package/dist/resources/field-type-resource.js.map +1 -1
- package/dist/resources/file-resource.d.ts +12 -29
- package/dist/resources/file-resource.js +19 -287
- package/dist/resources/file-resource.js.map +1 -1
- package/dist/resources/folder-resource.d.ts +32 -51
- package/dist/resources/folder-resource.js +68 -96
- package/dist/resources/folder-resource.js.map +1 -1
- package/dist/resources/graph-model-resource.d.ts +5 -33
- package/dist/resources/graph-model-resource.js +8 -61
- package/dist/resources/graph-model-resource.js.map +1 -1
- package/dist/resources/graph-view-resource.d.ts +5 -28
- package/dist/resources/graph-view-resource.js +6 -45
- package/dist/resources/graph-view-resource.js.map +1 -1
- package/dist/resources/link-type-resource.d.ts +4 -21
- package/dist/resources/link-type-resource.js +6 -31
- package/dist/resources/link-type-resource.js.map +1 -1
- package/dist/resources/report-resource.d.ts +5 -17
- package/dist/resources/report-resource.js +6 -44
- package/dist/resources/report-resource.js.map +1 -1
- package/dist/resources/resource-object.d.ts +58 -23
- package/dist/resources/resource-object.js +307 -26
- package/dist/resources/resource-object.js.map +1 -1
- package/dist/resources/template-resource.d.ts +4 -15
- package/dist/resources/template-resource.js +10 -25
- package/dist/resources/template-resource.js.map +1 -1
- package/dist/resources/workflow-resource.d.ts +4 -23
- package/dist/resources/workflow-resource.js +12 -38
- 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-facts.js +11 -3
- 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 +5 -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/error-utils.d.ts +34 -0
- package/dist/utils/error-utils.js +56 -0
- package/dist/utils/error-utils.js.map +1 -0
- package/dist/utils/log-utils.d.ts +0 -27
- package/dist/utils/log-utils.js +0 -58
- package/dist/utils/log-utils.js.map +1 -1
- package/dist/utils/user-preferences.js +6 -3
- package/dist/utils/user-preferences.js.map +1 -1
- package/package.json +5 -5
- package/src/card-metadata-updater.ts +3 -5
- package/src/command-handler.ts +14 -19
- package/src/command-manager.ts +4 -3
- package/src/commands/create.ts +28 -112
- package/src/commands/edit.ts +27 -118
- package/src/commands/export.ts +8 -29
- package/src/commands/fetch.ts +2 -1
- package/src/commands/import.ts +4 -6
- package/src/commands/move.ts +144 -179
- package/src/commands/remove.ts +12 -54
- package/src/commands/rename.ts +22 -7
- package/src/commands/show.ts +51 -156
- package/src/commands/transition.ts +30 -33
- package/src/commands/update.ts +27 -9
- package/src/commands/validate.ts +22 -37
- package/src/containers/card-container.ts +200 -360
- package/src/containers/project/calculation-engine.ts +43 -33
- package/src/containers/project/card-cache.ts +497 -0
- package/src/containers/project/resource-collector.ts +9 -1
- package/src/containers/project.ts +533 -328
- package/src/containers/template.ts +109 -127
- package/src/index.ts +1 -0
- package/src/interfaces/folder-content-interfaces.ts +23 -5
- package/src/interfaces/macros.ts +2 -0
- package/src/interfaces/project-interfaces.ts +19 -10
- package/src/interfaces/resource-interfaces.ts +22 -24
- package/src/macros/createCards/index.ts +1 -12
- package/src/macros/createCards/types.ts +46 -0
- package/src/macros/graph/index.ts +3 -7
- 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/percentage/index.ts +1 -7
- package/src/macros/percentage/types.ts +32 -0
- package/src/macros/report/index.ts +1 -4
- 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 +5 -5
- package/src/project-settings.ts +1 -1
- package/src/resources/calculation-resource.ts +101 -0
- package/src/resources/card-type-resource.ts +24 -59
- package/src/resources/create-defaults.ts +21 -5
- package/src/resources/field-type-resource.ts +22 -51
- package/src/resources/file-resource.ts +27 -403
- package/src/resources/folder-resource.ts +99 -125
- package/src/resources/graph-model-resource.ts +17 -74
- package/src/resources/graph-view-resource.ts +14 -54
- package/src/resources/link-type-resource.ts +13 -40
- package/src/resources/report-resource.ts +17 -57
- package/src/resources/resource-object.ts +454 -39
- package/src/resources/template-resource.ts +16 -29
- package/src/resources/workflow-resource.ts +26 -50
- package/src/utils/card-utils.ts +217 -31
- package/src/utils/clingo-facts.ts +13 -3
- package/src/utils/clingo-parser.ts +1 -1
- package/src/utils/constants.ts +7 -0
- package/src/utils/csv.ts +1 -1
- package/src/utils/error-utils.ts +62 -0
- package/src/utils/log-utils.ts +0 -68
- package/src/utils/user-preferences.ts +7 -3
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
// node
|
|
15
15
|
import { basename, join, resolve, sep } from 'node:path';
|
|
16
|
-
import { copyFile, mkdir, readdir, rm, writeFile } from 'node:fs/promises';
|
|
17
16
|
import { type Dirent, readdirSync } from 'node:fs';
|
|
17
|
+
import { copyFile, mkdir, rm, writeFile } from 'node:fs/promises';
|
|
18
18
|
|
|
19
19
|
// Base class
|
|
20
20
|
import { CardContainer } from './card-container.js';
|
|
@@ -23,8 +23,6 @@ import {
|
|
|
23
23
|
type Card,
|
|
24
24
|
type CardAttachment,
|
|
25
25
|
CardNameRegEx,
|
|
26
|
-
type FetchCardDetails,
|
|
27
|
-
type FileContentType,
|
|
28
26
|
type Resource,
|
|
29
27
|
} from '../interfaces/project-interfaces.js';
|
|
30
28
|
import type { CardType, Workflow } from '../interfaces/resource-interfaces.js';
|
|
@@ -38,14 +36,18 @@ import {
|
|
|
38
36
|
sortItems,
|
|
39
37
|
} from '../utils/lexorank.js';
|
|
40
38
|
import { getChildLogger } from '../utils/log-utils.js';
|
|
41
|
-
import {
|
|
39
|
+
import { isModulePath } from '../utils/card-utils.js';
|
|
42
40
|
import { Project } from './project.js';
|
|
43
41
|
import { resourceName } from '../utils/resource-utils.js';
|
|
44
42
|
|
|
43
|
+
import { ROOT } from '../utils/constants.js';
|
|
44
|
+
|
|
45
45
|
// creates template instance based on a project path and name
|
|
46
46
|
export class Template extends CardContainer {
|
|
47
|
+
private templateName: string;
|
|
47
48
|
private templatePath: string;
|
|
48
49
|
private templateCardsPath: string;
|
|
50
|
+
private fullTemplateName: string; // Full template name from resource (e.g., 'test/templates/page')
|
|
49
51
|
private project: Project;
|
|
50
52
|
private get logger() {
|
|
51
53
|
return getChildLogger({
|
|
@@ -56,9 +58,10 @@ export class Template extends CardContainer {
|
|
|
56
58
|
constructor(project: Project, template: Resource) {
|
|
57
59
|
// Templates might come from modules. Remove module name from template name.
|
|
58
60
|
const templateName = stripExtension(basename(template.name));
|
|
59
|
-
super(template.path
|
|
61
|
+
super(template.path, project.projectPrefix, templateName);
|
|
62
|
+
this.templateName = templateName;
|
|
63
|
+
this.fullTemplateName = template.name;
|
|
60
64
|
|
|
61
|
-
// prevent constructing a new project object, if one is passed to this class.
|
|
62
65
|
this.project = project;
|
|
63
66
|
// optimization - if template.path is set - use it
|
|
64
67
|
this.templatePath =
|
|
@@ -68,30 +71,6 @@ export class Template extends CardContainer {
|
|
|
68
71
|
this.templateCardsPath = join(this.templatePath, 'c');
|
|
69
72
|
}
|
|
70
73
|
|
|
71
|
-
// Fetches project top level cards only.
|
|
72
|
-
// Top level cards are those that have parent as 'root'.
|
|
73
|
-
// todo: This should be in 'project' or 'card-container'
|
|
74
|
-
private async rootLevelProjectCards(): Promise<Card[]> {
|
|
75
|
-
const entries = (
|
|
76
|
-
await readdir(this.project.paths.cardRootFolder, {
|
|
77
|
-
withFileTypes: true,
|
|
78
|
-
})
|
|
79
|
-
).filter((entry) => entry.isDirectory() && CardNameRegEx.test(entry.name));
|
|
80
|
-
const cardPromises = entries.map(async (entry) => {
|
|
81
|
-
const currentPath = join(entry.parentPath, entry.name);
|
|
82
|
-
return {
|
|
83
|
-
key: entry.name,
|
|
84
|
-
path: currentPath,
|
|
85
|
-
metadata: await readJsonFile(
|
|
86
|
-
join(currentPath, CardContainer.cardMetadataFile),
|
|
87
|
-
),
|
|
88
|
-
children: [],
|
|
89
|
-
attachments: [],
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
return Promise.all(cardPromises);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
74
|
// Creates card(s) as project cards from template.
|
|
96
75
|
private async doCreateCards(
|
|
97
76
|
cards: Card[],
|
|
@@ -110,13 +89,13 @@ export class Template extends CardContainer {
|
|
|
110
89
|
|
|
111
90
|
// Handle ranking for parent cards
|
|
112
91
|
const parentCards = sortItems(
|
|
113
|
-
cards.filter((c) => c.parent ===
|
|
92
|
+
cards.filter((c) => c.parent === ROOT),
|
|
114
93
|
(c) => c?.metadata?.rank || '',
|
|
115
94
|
);
|
|
116
95
|
|
|
117
96
|
const futureSiblings = parentCard
|
|
118
|
-
? parentCard.children
|
|
119
|
-
:
|
|
97
|
+
? this.project.cardKeysToCards(parentCard.children)
|
|
98
|
+
: this.rootLevelProjectCards();
|
|
120
99
|
|
|
121
100
|
let latestRank =
|
|
122
101
|
sortItems(
|
|
@@ -165,6 +144,24 @@ export class Template extends CardContainer {
|
|
|
165
144
|
}
|
|
166
145
|
|
|
167
146
|
card.key = templateIDMap.get(card.key) || card.key;
|
|
147
|
+
|
|
148
|
+
// Set parent field based on template hierarchy and creation location
|
|
149
|
+
// Store the original template parent before key remapping
|
|
150
|
+
const originalParentKey = card.parent;
|
|
151
|
+
|
|
152
|
+
if (parentCard) {
|
|
153
|
+
if (!originalParentKey || originalParentKey === ROOT) {
|
|
154
|
+
card.parent = parentCard.key;
|
|
155
|
+
} else {
|
|
156
|
+
card.parent = templateIDMap.get(originalParentKey) || parentCard.key;
|
|
157
|
+
}
|
|
158
|
+
} else {
|
|
159
|
+
if (!originalParentKey || originalParentKey === ROOT) {
|
|
160
|
+
card.parent = ROOT;
|
|
161
|
+
} else {
|
|
162
|
+
card.parent = templateIDMap.get(originalParentKey) || ROOT;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
168
165
|
};
|
|
169
166
|
|
|
170
167
|
// Process attachments
|
|
@@ -203,16 +200,14 @@ export class Template extends CardContainer {
|
|
|
203
200
|
const processMetadata = async (card: Card, parentCards: Card[]) => {
|
|
204
201
|
if (!card.metadata) return card;
|
|
205
202
|
|
|
206
|
-
const cardType =
|
|
207
|
-
card.metadata.cardType || '',
|
|
208
|
-
);
|
|
203
|
+
const cardType = this.project.resource<CardType>(card.metadata?.cardType);
|
|
209
204
|
if (!cardType) {
|
|
210
205
|
throw new Error(
|
|
211
|
-
`Card type '${card.metadata
|
|
206
|
+
`Card type '${card.metadata?.cardType}' of card ${card.key} cannot be found`,
|
|
212
207
|
);
|
|
213
208
|
}
|
|
214
209
|
|
|
215
|
-
const workflow =
|
|
210
|
+
const workflow = this.project.resource<Workflow>(cardType.workflow);
|
|
216
211
|
if (!workflow) {
|
|
217
212
|
throw new Error(`Workflow '${cardType.workflow}' cannot be found`);
|
|
218
213
|
}
|
|
@@ -256,8 +251,10 @@ export class Template extends CardContainer {
|
|
|
256
251
|
const templatesFolder = this.templateFolder();
|
|
257
252
|
|
|
258
253
|
// Process all cards in parallel
|
|
254
|
+
// Create deep copies to avoid mutating the cached template cards
|
|
259
255
|
const processedCards = await Promise.all(
|
|
260
|
-
cards.map(async (
|
|
256
|
+
cards.map(async (originalCard) => {
|
|
257
|
+
const card: Card = structuredClone(originalCard);
|
|
261
258
|
// Update paths and keys
|
|
262
259
|
updateCardPaths(card, templateIDMap, templatesFolder);
|
|
263
260
|
|
|
@@ -280,16 +277,25 @@ export class Template extends CardContainer {
|
|
|
280
277
|
return processedCard;
|
|
281
278
|
}),
|
|
282
279
|
);
|
|
280
|
+
await this.project.handleNewCards(processedCards);
|
|
283
281
|
return processedCards;
|
|
284
282
|
} catch (error) {
|
|
285
283
|
await this.removeCards(templateIDMap);
|
|
286
|
-
|
|
287
|
-
throw new Error(`Failed to create cards: ${error.message}`);
|
|
288
|
-
}
|
|
284
|
+
this.logger.error({ error }, 'Failed to create cards');
|
|
289
285
|
throw error;
|
|
290
286
|
}
|
|
291
287
|
}
|
|
292
288
|
|
|
289
|
+
// Helper method to find a card.
|
|
290
|
+
private findCardDirect(cardKey: string): Card {
|
|
291
|
+
const allCards = this.cards();
|
|
292
|
+
const result = allCards.find((card) => card.key === cardKey);
|
|
293
|
+
if (!result) {
|
|
294
|
+
throw new Error(`Card '${cardKey}' is not part of template`);
|
|
295
|
+
}
|
|
296
|
+
return result;
|
|
297
|
+
}
|
|
298
|
+
|
|
293
299
|
// fetches path to module.
|
|
294
300
|
private moduleTemplatePath(templateName: string): string {
|
|
295
301
|
// If template path has already been deduced, return it.
|
|
@@ -313,6 +319,7 @@ export class Template extends CardContainer {
|
|
|
313
319
|
);
|
|
314
320
|
const exists = pathExists(templateFolderInModule);
|
|
315
321
|
if (exists) {
|
|
322
|
+
this.templatePath = templateFolderInModule;
|
|
316
323
|
return templateFolderInModule;
|
|
317
324
|
}
|
|
318
325
|
}
|
|
@@ -320,16 +327,14 @@ export class Template extends CardContainer {
|
|
|
320
327
|
}
|
|
321
328
|
|
|
322
329
|
// Removes cards
|
|
330
|
+
// Helper for doCreateCards; not intended for any other use.
|
|
323
331
|
private async removeCards(cardMap: Map<string, string>) {
|
|
324
|
-
const
|
|
332
|
+
const cards: Card[] = [];
|
|
325
333
|
// Find all cards that need to be removed.
|
|
326
334
|
cardMap.forEach((createdCard) => {
|
|
327
|
-
|
|
335
|
+
const card = this.project.findCard(createdCard);
|
|
336
|
+
cards.push(card);
|
|
328
337
|
});
|
|
329
|
-
// Remove empty results.
|
|
330
|
-
const cards = (await Promise.all(tasks)).filter(
|
|
331
|
-
(item) => item !== undefined,
|
|
332
|
-
);
|
|
333
338
|
// Delete card folders.
|
|
334
339
|
const deleteAll: Promise<void>[] = [];
|
|
335
340
|
cards.forEach((card) => {
|
|
@@ -338,6 +343,14 @@ export class Template extends CardContainer {
|
|
|
338
343
|
await Promise.all(deleteAll);
|
|
339
344
|
}
|
|
340
345
|
|
|
346
|
+
// Fetches project top level cards only.
|
|
347
|
+
private rootLevelProjectCards(): Card[] {
|
|
348
|
+
const allProjectCards = this.project.cards(
|
|
349
|
+
this.project.paths.cardRootFolder,
|
|
350
|
+
);
|
|
351
|
+
return allProjectCards.filter((card) => card.parent === ROOT);
|
|
352
|
+
}
|
|
353
|
+
|
|
341
354
|
// Set path to template location.
|
|
342
355
|
private setTemplatePath(templateName: string): string {
|
|
343
356
|
const { prefix, identifier } = resourceName(templateName);
|
|
@@ -384,11 +397,11 @@ export class Template extends CardContainer {
|
|
|
384
397
|
if (!pathExists(this.templateFolder())) {
|
|
385
398
|
throw new Error(`Template '${this.containerName}' does not exist`);
|
|
386
399
|
}
|
|
387
|
-
const cardType =
|
|
400
|
+
const cardType = this.project.resource<CardType>(cardTypeName);
|
|
388
401
|
if (cardType === undefined) {
|
|
389
402
|
throw new Error(`Card type '${cardTypeName}' does not exist`);
|
|
390
403
|
}
|
|
391
|
-
if (parentCard && !this.
|
|
404
|
+
if (parentCard && !this.hasTemplateCard(parentCard.key)) {
|
|
392
405
|
throw new Error(
|
|
393
406
|
`Card '${parentCard.key}' does not exist in template '${this.containerName}'`,
|
|
394
407
|
);
|
|
@@ -401,8 +414,8 @@ export class Template extends CardContainer {
|
|
|
401
414
|
: join(this.templateCardsPath, newCardKey);
|
|
402
415
|
|
|
403
416
|
const templateCards = parentCard
|
|
404
|
-
? parentCard.children
|
|
405
|
-
:
|
|
417
|
+
? this.project.cardKeysToCards(parentCard.children)
|
|
418
|
+
: this.cards();
|
|
406
419
|
const defaultContent = DefaultContent.card(cardType, templateCards);
|
|
407
420
|
|
|
408
421
|
await mkdir(templateCardToCreate, { recursive: true });
|
|
@@ -413,12 +426,13 @@ export class Template extends CardContainer {
|
|
|
413
426
|
children: [],
|
|
414
427
|
attachments: [],
|
|
415
428
|
content: '',
|
|
429
|
+
parent: parentCard ? parentCard.key : ROOT,
|
|
416
430
|
};
|
|
417
431
|
await this.saveCard(defaultCard);
|
|
432
|
+
await this.project.handleNewCards([defaultCard]);
|
|
418
433
|
} catch (error) {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
434
|
+
this.logger.error({ error });
|
|
435
|
+
throw error;
|
|
422
436
|
}
|
|
423
437
|
return newCardKey;
|
|
424
438
|
}
|
|
@@ -427,8 +441,8 @@ export class Template extends CardContainer {
|
|
|
427
441
|
* Return all attachment in the template.
|
|
428
442
|
* @returns all attachments in the template.
|
|
429
443
|
*/
|
|
430
|
-
public
|
|
431
|
-
return
|
|
444
|
+
public attachments(): CardAttachment[] {
|
|
445
|
+
return this.project.attachmentsByPath(this.templateCardsPath);
|
|
432
446
|
}
|
|
433
447
|
|
|
434
448
|
/**
|
|
@@ -436,58 +450,37 @@ export class Template extends CardContainer {
|
|
|
436
450
|
* @param cardKey card key
|
|
437
451
|
* @returns path to card's attachment folder.
|
|
438
452
|
*/
|
|
439
|
-
public
|
|
440
|
-
const pathToCard =
|
|
441
|
-
if (!pathToCard) {
|
|
442
|
-
throw new Error(`Template card '${cardKey}' not found`);
|
|
443
|
-
}
|
|
453
|
+
public cardAttachmentFolder(cardKey: string): string {
|
|
454
|
+
const pathToCard = this.project.findCard(cardKey)?.path;
|
|
444
455
|
return join(pathToCard, 'a');
|
|
445
456
|
}
|
|
446
457
|
|
|
447
|
-
/**
|
|
448
|
-
* Returns details (as defined by cardDetails) of a card.
|
|
449
|
-
* @param cardKey card key (project prefix and a number, e.g. test_1)
|
|
450
|
-
* @param cardDetails which card details are returned.
|
|
451
|
-
* @returns Card details, or undefined if the card cannot be found.
|
|
452
|
-
*/
|
|
453
|
-
public async cardDetailsById(
|
|
454
|
-
cardKey: string,
|
|
455
|
-
cardDetails: FetchCardDetails,
|
|
456
|
-
): Promise<Card | undefined> {
|
|
457
|
-
return super.findCard(this.templateCardsPath, cardKey, cardDetails);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
458
|
/**
|
|
461
459
|
* returns path to card's folder.
|
|
462
460
|
* @param cardKey card key
|
|
463
461
|
* @returns path to card's folder.
|
|
464
462
|
*/
|
|
465
|
-
public
|
|
466
|
-
const found =
|
|
463
|
+
public cardFolder(cardKey: string): string {
|
|
464
|
+
const found = this.findCardDirect(cardKey);
|
|
467
465
|
return found ? found.path : '';
|
|
468
466
|
}
|
|
469
467
|
|
|
470
468
|
/**
|
|
471
|
-
* Returns all cards in the template.
|
|
469
|
+
* Returns all cards in the template.
|
|
472
470
|
* @param placeHolderPath This is not used. Needed to be compatible with base class.
|
|
473
|
-
* @param details Optional. Which details are returned for each card. If missing, default value will be used.
|
|
474
471
|
* @returns Template cards in the template.
|
|
475
472
|
*/
|
|
476
|
-
public
|
|
477
|
-
placeHolderPath?: string,
|
|
478
|
-
details?: FetchCardDetails,
|
|
479
|
-
): Promise<Card[]> {
|
|
473
|
+
public cards(placeHolderPath?: string): Card[] {
|
|
480
474
|
if (placeHolderPath) {
|
|
481
475
|
this.logger.warn('A non-used variable was used in the cards method');
|
|
482
476
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
return super.cards(this.templateCardsPath, cardDetails);
|
|
477
|
+
|
|
478
|
+
// Filter cards from the project's card cache that belong to this template.
|
|
479
|
+
const allCards = [...this.project.cardsCache.getCards()];
|
|
480
|
+
return allCards.filter(
|
|
481
|
+
(card) =>
|
|
482
|
+
card.location !== 'project' && card.location === this.fullTemplateName,
|
|
483
|
+
);
|
|
491
484
|
}
|
|
492
485
|
|
|
493
486
|
/**
|
|
@@ -496,13 +489,7 @@ export class Template extends CardContainer {
|
|
|
496
489
|
* @returns array of created card keys
|
|
497
490
|
*/
|
|
498
491
|
public async createCards(parentCard?: Card): Promise<Card[]> {
|
|
499
|
-
const cards =
|
|
500
|
-
content: true,
|
|
501
|
-
contentType: 'adoc',
|
|
502
|
-
metadata: true,
|
|
503
|
-
attachments: true,
|
|
504
|
-
parent: true,
|
|
505
|
-
});
|
|
492
|
+
const cards = this.cards();
|
|
506
493
|
if (cards.length === 0) {
|
|
507
494
|
throw new Error(
|
|
508
495
|
`No cards in template '${this.containerName}'. Please add template cards with 'add' command first.`,
|
|
@@ -514,13 +501,9 @@ export class Template extends CardContainer {
|
|
|
514
501
|
/**
|
|
515
502
|
* Returns specific card.
|
|
516
503
|
* @param cardKey Card key to find from template.
|
|
517
|
-
* @param details Card details to include in return value.
|
|
518
504
|
* @returns specific card details
|
|
519
505
|
*/
|
|
520
|
-
public
|
|
521
|
-
cardKey: string,
|
|
522
|
-
details: FetchCardDetails = {},
|
|
523
|
-
): Promise<Card | undefined> {
|
|
506
|
+
public findCard(cardKey: string): Card {
|
|
524
507
|
const cardPrefix = cardKey.split('_').at(0);
|
|
525
508
|
const moduleCardFromProject =
|
|
526
509
|
this.basePath.includes('local') &&
|
|
@@ -530,9 +513,10 @@ export class Template extends CardContainer {
|
|
|
530
513
|
this.project.projectPrefix === cardPrefix;
|
|
531
514
|
// If the result is impossible, return undefined.
|
|
532
515
|
if (moduleCardFromProject || projectCardFromModule) {
|
|
533
|
-
|
|
516
|
+
throw new Error(`Card '${cardKey}' is not part of template`);
|
|
534
517
|
}
|
|
535
|
-
|
|
518
|
+
|
|
519
|
+
return this.findCardDirect(cardKey);
|
|
536
520
|
}
|
|
537
521
|
|
|
538
522
|
/**
|
|
@@ -540,8 +524,8 @@ export class Template extends CardContainer {
|
|
|
540
524
|
* @param cardKey Card key to find from template.
|
|
541
525
|
* @return true if card with a given card key exists in the template, false otherwise.
|
|
542
526
|
*/
|
|
543
|
-
public
|
|
544
|
-
return
|
|
527
|
+
public hasTemplateCard(cardKey: string): boolean {
|
|
528
|
+
return this.project.hasTemplateCard(cardKey);
|
|
545
529
|
}
|
|
546
530
|
|
|
547
531
|
/**
|
|
@@ -553,11 +537,25 @@ export class Template extends CardContainer {
|
|
|
553
537
|
}
|
|
554
538
|
|
|
555
539
|
/**
|
|
556
|
-
* Returns an array of all the cards in the
|
|
557
|
-
* @returns all cards in the
|
|
540
|
+
* Returns an array of all the cards in the template.
|
|
541
|
+
* @returns all cards in the template.
|
|
558
542
|
*/
|
|
559
|
-
public
|
|
560
|
-
|
|
543
|
+
public listCards(): Card[] {
|
|
544
|
+
// Construct the full template name to match what's stored in cache
|
|
545
|
+
const fullTemplateName = isModulePath(this.basePath)
|
|
546
|
+
? `${this.basePath.split(`${sep}modules${sep}`)[1].split(`${sep}templates`)[0]}/templates/${this.templateName}`
|
|
547
|
+
: `${this.project.projectPrefix}/templates/${this.templateName}`;
|
|
548
|
+
|
|
549
|
+
const templateCards = Array.from(this.project.cardsCache.getCards()).filter(
|
|
550
|
+
(cachedCard) => {
|
|
551
|
+
if (cachedCard.location === 'project') {
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
const storedTemplateName = cachedCard.location;
|
|
555
|
+
return storedTemplateName === fullTemplateName;
|
|
556
|
+
},
|
|
557
|
+
);
|
|
558
|
+
return templateCards;
|
|
561
559
|
}
|
|
562
560
|
|
|
563
561
|
/**
|
|
@@ -568,14 +566,6 @@ export class Template extends CardContainer {
|
|
|
568
566
|
return this.templateCardsPath;
|
|
569
567
|
}
|
|
570
568
|
|
|
571
|
-
/**
|
|
572
|
-
* Path to template configuration json file.
|
|
573
|
-
* @returns path to the template's configuration file.
|
|
574
|
-
*/
|
|
575
|
-
public templateConfigurationFilePath(): string {
|
|
576
|
-
return join(this.templatePath, '..', this.containerName + '.json');
|
|
577
|
-
}
|
|
578
|
-
|
|
579
569
|
/**
|
|
580
570
|
* Returns path to 'templates' folder.
|
|
581
571
|
* @returns path to the project's folder that contains templates.
|
|
@@ -583,12 +573,4 @@ export class Template extends CardContainer {
|
|
|
583
573
|
public templateFolder(): string {
|
|
584
574
|
return this.templatePath;
|
|
585
575
|
}
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Show cards of a template with hierarchy structure.
|
|
589
|
-
* @returns an array of all template cards with proper parent-child relationships.
|
|
590
|
-
*/
|
|
591
|
-
public async showTemplateCards(): Promise<Card[]> {
|
|
592
|
-
return this.showCards(this.templateCardsPath);
|
|
593
|
-
}
|
|
594
576
|
}
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from './command-handler.js';
|
|
21
21
|
import { Validate } from './commands/validate.js';
|
|
22
22
|
export * from './interfaces/project-interfaces.js';
|
|
23
|
+
export * from './interfaces/macros.js';
|
|
23
24
|
import { requestStatus } from './interfaces/request-status-interfaces.js';
|
|
24
25
|
import { UpdateOperations } from './resources/resource-object.js';
|
|
25
26
|
export type {
|
|
@@ -15,25 +15,35 @@ import type { Schema } from 'jsonschema';
|
|
|
15
15
|
|
|
16
16
|
// All file mappings for lookup (filename -> property name)
|
|
17
17
|
export const ALL_FILE_MAPPINGS = {
|
|
18
|
+
'calculation.lp': 'calculation',
|
|
18
19
|
'index.adoc.hbs': 'contentTemplate',
|
|
19
|
-
'query.lp.hbs': 'queryTemplate',
|
|
20
|
-
'parameterSchema.json': 'schema',
|
|
21
20
|
'model.lp': 'model',
|
|
21
|
+
'parameterSchema.json': 'schema',
|
|
22
|
+
'query.lp.hbs': 'queryTemplate',
|
|
22
23
|
'view.lp.hbs': 'viewTemplate',
|
|
23
24
|
} as const;
|
|
24
25
|
|
|
25
26
|
// Reverse mappings from property names to filenames
|
|
26
27
|
export const REVERSE_FILE_MAPPINGS = {
|
|
28
|
+
calculation: 'calculation.lp',
|
|
27
29
|
contentTemplate: 'index.adoc.hbs',
|
|
30
|
+
model: 'model.lp',
|
|
28
31
|
queryTemplate: 'query.lp.hbs',
|
|
29
32
|
schema: 'parameterSchema.json',
|
|
30
|
-
model: 'model.lp',
|
|
31
33
|
viewTemplate: 'view.lp.hbs',
|
|
32
34
|
} as const;
|
|
33
35
|
|
|
36
|
+
// Union type of all valid content property names
|
|
37
|
+
export type ContentPropertyName = keyof typeof REVERSE_FILE_MAPPINGS;
|
|
38
|
+
|
|
39
|
+
// Content interface for Calculation resources
|
|
40
|
+
export interface CalculationContent {
|
|
41
|
+
calculation: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
// Content interface for Graph Model resources
|
|
35
45
|
export interface GraphModelContent {
|
|
36
|
-
model
|
|
46
|
+
model: string;
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
// Content interface for Graph View resources
|
|
@@ -48,6 +58,12 @@ export interface ReportContent {
|
|
|
48
58
|
schema?: Schema;
|
|
49
59
|
}
|
|
50
60
|
|
|
61
|
+
export type FolderResourceContent =
|
|
62
|
+
| CalculationContent
|
|
63
|
+
| GraphModelContent
|
|
64
|
+
| GraphViewContent
|
|
65
|
+
| ReportContent;
|
|
66
|
+
|
|
51
67
|
/**
|
|
52
68
|
* Get filename with property name
|
|
53
69
|
* @param propertyName Property name.
|
|
@@ -64,6 +80,8 @@ export function filename(propertyName: string): string | undefined {
|
|
|
64
80
|
* @param filename Filename.
|
|
65
81
|
* @returns property name that matches filename
|
|
66
82
|
*/
|
|
67
|
-
export function propertyName(
|
|
83
|
+
export function propertyName(
|
|
84
|
+
filename: string,
|
|
85
|
+
): ContentPropertyName | undefined {
|
|
68
86
|
return ALL_FILE_MAPPINGS[filename as keyof typeof ALL_FILE_MAPPINGS];
|
|
69
87
|
}
|
package/src/interfaces/macros.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
7
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
8
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
9
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
10
|
+
See the GNU Affero General Public License for more details.
|
|
11
|
+
You should have received a copy of the GNU Affero General Public
|
|
12
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
13
|
*/
|
|
12
14
|
|
|
13
15
|
import type { Link, TemplateConfiguration } from './resource-interfaces.js';
|
|
@@ -19,8 +21,14 @@ export interface Card {
|
|
|
19
21
|
content?: string;
|
|
20
22
|
metadata?: CardMetadata;
|
|
21
23
|
parent?: string;
|
|
22
|
-
children:
|
|
24
|
+
children: string[];
|
|
23
25
|
attachments: CardAttachment[];
|
|
26
|
+
calculations?: unknown[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Single card, but childrenCards as Card array
|
|
30
|
+
export interface CardWithChildrenCards extends Card {
|
|
31
|
+
childrenCards: CardWithChildrenCards[];
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
// Attachment details
|
|
@@ -205,6 +213,7 @@ export interface ModuleSettingOptions {
|
|
|
205
213
|
// Resources that are possible to remove.
|
|
206
214
|
export type RemovableResourceTypes =
|
|
207
215
|
| 'attachment'
|
|
216
|
+
| 'calculation'
|
|
208
217
|
| 'card'
|
|
209
218
|
| 'cardType'
|
|
210
219
|
| 'fieldType'
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import type {
|
|
15
|
+
CalculationContent,
|
|
15
16
|
GraphModelContent,
|
|
16
17
|
GraphViewContent,
|
|
17
18
|
ReportContent,
|
|
@@ -27,6 +28,15 @@ import type {
|
|
|
27
28
|
export interface CalculationMetadata extends ResourceBaseMetadata {
|
|
28
29
|
calculation: string;
|
|
29
30
|
}
|
|
31
|
+
export interface Calculation extends CalculationMetadata {
|
|
32
|
+
content: CalculationContent;
|
|
33
|
+
}
|
|
34
|
+
export type CalculationContentPropertyName = 'calculation';
|
|
35
|
+
export interface CalculationContentUpdateKey {
|
|
36
|
+
key: 'content';
|
|
37
|
+
subKey: CalculationContentPropertyName;
|
|
38
|
+
}
|
|
39
|
+
export type CalculationUpdateKey = string | CalculationContentUpdateKey;
|
|
30
40
|
|
|
31
41
|
// Card type content.
|
|
32
42
|
export interface CardType extends ResourceBaseMetadata {
|
|
@@ -36,12 +46,6 @@ export interface CardType extends ResourceBaseMetadata {
|
|
|
36
46
|
optionallyVisibleFields: string[];
|
|
37
47
|
}
|
|
38
48
|
|
|
39
|
-
// Base content update key interface
|
|
40
|
-
export interface ContentUpdateKey {
|
|
41
|
-
key: 'content';
|
|
42
|
-
subKey: string; // Resource-specific types should narrow this
|
|
43
|
-
}
|
|
44
|
-
|
|
45
49
|
// Custom field
|
|
46
50
|
// todo: merge with FieldType.
|
|
47
51
|
export interface CustomField {
|
|
@@ -85,11 +89,6 @@ export interface GraphModel extends GraphModelMetadata {
|
|
|
85
89
|
content: GraphModelContent;
|
|
86
90
|
}
|
|
87
91
|
export type GraphModelContentPropertyName = 'model';
|
|
88
|
-
export interface GraphModelContentUpdateKey {
|
|
89
|
-
key: 'content';
|
|
90
|
-
subKey: GraphModelContentPropertyName;
|
|
91
|
-
}
|
|
92
|
-
export type GraphModelUpdateKey = string | GraphModelContentUpdateKey;
|
|
93
92
|
|
|
94
93
|
// Graph view content.
|
|
95
94
|
export interface GraphViewMetadata extends ResourceBaseMetadata {
|
|
@@ -99,11 +98,6 @@ export type GraphViewContentPropertyName = 'viewTemplate';
|
|
|
99
98
|
export interface GraphView extends GraphViewMetadata {
|
|
100
99
|
content: GraphViewContent;
|
|
101
100
|
}
|
|
102
|
-
export interface GraphViewContentUpdateKey {
|
|
103
|
-
key: 'content';
|
|
104
|
-
subKey: GraphViewContentPropertyName;
|
|
105
|
-
}
|
|
106
|
-
export type GraphViewUpdateKey = string | GraphViewContentUpdateKey;
|
|
107
101
|
|
|
108
102
|
// Link content.
|
|
109
103
|
export interface Link {
|
|
@@ -122,7 +116,7 @@ export interface LinkType extends ResourceBaseMetadata {
|
|
|
122
116
|
}
|
|
123
117
|
|
|
124
118
|
// Report resource.
|
|
125
|
-
export interface Report extends
|
|
119
|
+
export interface Report extends ReportMetadata {
|
|
126
120
|
content: ReportContent;
|
|
127
121
|
}
|
|
128
122
|
|
|
@@ -131,11 +125,6 @@ export type ReportContentPropertyName =
|
|
|
131
125
|
| 'contentTemplate'
|
|
132
126
|
| 'queryTemplate'
|
|
133
127
|
| 'schema';
|
|
134
|
-
export interface ReportContentUpdateKey {
|
|
135
|
-
key: 'content';
|
|
136
|
-
subKey: ReportContentPropertyName;
|
|
137
|
-
}
|
|
138
|
-
export type ReportUpdateKey = string | ReportContentUpdateKey;
|
|
139
128
|
|
|
140
129
|
// Metadata for report
|
|
141
130
|
export interface ReportMetadata extends ResourceBaseMetadata {
|
|
@@ -172,9 +161,18 @@ export interface TemplateConfiguration extends TemplateMetadata {
|
|
|
172
161
|
export interface TemplateMetadata extends ResourceBaseMetadata {
|
|
173
162
|
category?: string;
|
|
174
163
|
}
|
|
164
|
+
type ContentUpdateKey = { key: 'content'; subKey: string };
|
|
165
|
+
type PropertyUpdateKey<K extends string = string> = {
|
|
166
|
+
key: Exclude<K, 'content'>;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export type UpdateKey<K extends string = string> =
|
|
170
|
+
| ContentUpdateKey
|
|
171
|
+
| PropertyUpdateKey<K>;
|
|
175
172
|
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
export function isContentKey(key: UpdateKey): key is ContentUpdateKey {
|
|
174
|
+
return key.key === 'content';
|
|
175
|
+
}
|
|
178
176
|
|
|
179
177
|
// Workflow's json file content.
|
|
180
178
|
export interface Workflow extends ResourceBaseMetadata {
|