@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.
Files changed (191) hide show
  1. package/dist/card-metadata-updater.js +7 -1
  2. package/dist/card-metadata-updater.js.map +1 -1
  3. package/dist/command-handler.d.ts +4 -0
  4. package/dist/command-handler.js +22 -8
  5. package/dist/command-handler.js.map +1 -1
  6. package/dist/command-manager.d.ts +24 -1
  7. package/dist/command-manager.js +31 -7
  8. package/dist/command-manager.js.map +1 -1
  9. package/dist/commands/create.d.ts +1 -1
  10. package/dist/commands/create.js +34 -36
  11. package/dist/commands/create.js.map +1 -1
  12. package/dist/commands/export.d.ts +11 -2
  13. package/dist/commands/export.js +54 -41
  14. package/dist/commands/export.js.map +1 -1
  15. package/dist/commands/fetch.d.ts +8 -0
  16. package/dist/commands/fetch.js +101 -23
  17. package/dist/commands/fetch.js.map +1 -1
  18. package/dist/commands/import.d.ts +14 -3
  19. package/dist/commands/import.js +27 -10
  20. package/dist/commands/import.js.map +1 -1
  21. package/dist/commands/move.js +0 -1
  22. package/dist/commands/move.js.map +1 -1
  23. package/dist/commands/remove.d.ts +11 -2
  24. package/dist/commands/remove.js +15 -5
  25. package/dist/commands/remove.js.map +1 -1
  26. package/dist/commands/rename.d.ts +4 -9
  27. package/dist/commands/rename.js +37 -101
  28. package/dist/commands/rename.js.map +1 -1
  29. package/dist/commands/show.d.ts +20 -12
  30. package/dist/commands/show.js +79 -57
  31. package/dist/commands/show.js.map +1 -1
  32. package/dist/commands/transition.d.ts +9 -2
  33. package/dist/commands/transition.js +25 -17
  34. package/dist/commands/transition.js.map +1 -1
  35. package/dist/commands/update.d.ts +16 -12
  36. package/dist/commands/update.js +19 -17
  37. package/dist/commands/update.js.map +1 -1
  38. package/dist/commands/validate.d.ts +17 -9
  39. package/dist/commands/validate.js +94 -35
  40. package/dist/commands/validate.js.map +1 -1
  41. package/dist/containers/card-container.d.ts +7 -5
  42. package/dist/containers/card-container.js +30 -5
  43. package/dist/containers/card-container.js.map +1 -1
  44. package/dist/containers/project/calculation-engine.d.ts +7 -4
  45. package/dist/containers/project/calculation-engine.js +61 -66
  46. package/dist/containers/project/calculation-engine.js.map +1 -1
  47. package/dist/containers/project/project-paths.d.ts +7 -4
  48. package/dist/containers/project/project-paths.js +22 -12
  49. package/dist/containers/project/project-paths.js.map +1 -1
  50. package/dist/containers/project/resource-cache.d.ts +169 -0
  51. package/dist/containers/project/resource-cache.js +509 -0
  52. package/dist/containers/project/resource-cache.js.map +1 -0
  53. package/dist/containers/project/resource-handler.d.ts +129 -0
  54. package/dist/containers/project/resource-handler.js +206 -0
  55. package/dist/containers/project/resource-handler.js.map +1 -0
  56. package/dist/containers/project.d.ts +46 -152
  57. package/dist/containers/project.js +179 -409
  58. package/dist/containers/project.js.map +1 -1
  59. package/dist/containers/template.d.ts +8 -2
  60. package/dist/containers/template.js +24 -19
  61. package/dist/containers/template.js.map +1 -1
  62. package/dist/interfaces/command-options.d.ts +3 -1
  63. package/dist/interfaces/folder-content-interfaces.d.ts +5 -3
  64. package/dist/interfaces/folder-content-interfaces.js +3 -3
  65. package/dist/interfaces/folder-content-interfaces.js.map +1 -1
  66. package/dist/interfaces/project-interfaces.d.ts +7 -9
  67. package/dist/interfaces/project-interfaces.js.map +1 -1
  68. package/dist/interfaces/resource-interfaces.d.ts +14 -1
  69. package/dist/interfaces/resource-interfaces.js.map +1 -1
  70. package/dist/macros/graph/index.js +12 -26
  71. package/dist/macros/graph/index.js.map +1 -1
  72. package/dist/macros/index.d.ts +1 -1
  73. package/dist/macros/index.js +2 -2
  74. package/dist/macros/index.js.map +1 -1
  75. package/dist/macros/report/index.js +3 -6
  76. package/dist/macros/report/index.js.map +1 -1
  77. package/dist/module-manager.d.ts +16 -3
  78. package/dist/module-manager.js +51 -19
  79. package/dist/module-manager.js.map +1 -1
  80. package/dist/project-settings.d.ts +21 -3
  81. package/dist/project-settings.js +91 -14
  82. package/dist/project-settings.js.map +1 -1
  83. package/dist/resources/calculation-resource.d.ts +4 -3
  84. package/dist/resources/calculation-resource.js +11 -5
  85. package/dist/resources/calculation-resource.js.map +1 -1
  86. package/dist/resources/card-type-resource.d.ts +6 -1
  87. package/dist/resources/card-type-resource.js +34 -23
  88. package/dist/resources/card-type-resource.js.map +1 -1
  89. package/dist/resources/create-defaults.d.ts +3 -2
  90. package/dist/resources/create-defaults.js +3 -2
  91. package/dist/resources/create-defaults.js.map +1 -1
  92. package/dist/resources/field-type-resource.d.ts +4 -1
  93. package/dist/resources/field-type-resource.js +22 -23
  94. package/dist/resources/field-type-resource.js.map +1 -1
  95. package/dist/resources/file-resource.d.ts +5 -9
  96. package/dist/resources/file-resource.js +6 -11
  97. package/dist/resources/file-resource.js.map +1 -1
  98. package/dist/resources/folder-resource.d.ts +29 -32
  99. package/dist/resources/folder-resource.js +59 -78
  100. package/dist/resources/folder-resource.js.map +1 -1
  101. package/dist/resources/graph-model-resource.d.ts +4 -1
  102. package/dist/resources/graph-model-resource.js +11 -4
  103. package/dist/resources/graph-model-resource.js.map +1 -1
  104. package/dist/resources/graph-view-resource.d.ts +5 -2
  105. package/dist/resources/graph-view-resource.js +7 -3
  106. package/dist/resources/graph-view-resource.js.map +1 -1
  107. package/dist/resources/link-type-resource.d.ts +5 -2
  108. package/dist/resources/link-type-resource.js +5 -2
  109. package/dist/resources/link-type-resource.js.map +1 -1
  110. package/dist/resources/report-resource.d.ts +6 -7
  111. package/dist/resources/report-resource.js +14 -23
  112. package/dist/resources/report-resource.js.map +1 -1
  113. package/dist/resources/resource-object.d.ts +94 -8
  114. package/dist/resources/resource-object.js +212 -109
  115. package/dist/resources/resource-object.js.map +1 -1
  116. package/dist/resources/template-resource.d.ts +7 -3
  117. package/dist/resources/template-resource.js +10 -3
  118. package/dist/resources/template-resource.js.map +1 -1
  119. package/dist/resources/workflow-resource.d.ts +5 -2
  120. package/dist/resources/workflow-resource.js +18 -22
  121. package/dist/resources/workflow-resource.js.map +1 -1
  122. package/dist/utils/card-utils.d.ts +2 -2
  123. package/dist/utils/card-utils.js +1 -1
  124. package/dist/utils/clingo-fact-builder.d.ts +25 -14
  125. package/dist/utils/clingo-fact-builder.js +27 -5
  126. package/dist/utils/clingo-fact-builder.js.map +1 -1
  127. package/dist/utils/clingo-facts.js +3 -4
  128. package/dist/utils/clingo-facts.js.map +1 -1
  129. package/dist/utils/configuration-logger.d.ts +91 -0
  130. package/dist/utils/configuration-logger.js +151 -0
  131. package/dist/utils/configuration-logger.js.map +1 -0
  132. package/dist/utils/constants.d.ts +1 -1
  133. package/dist/utils/constants.js +5 -3
  134. package/dist/utils/constants.js.map +1 -1
  135. package/dist/utils/resource-utils.d.ts +1 -0
  136. package/dist/utils/resource-utils.js +2 -1
  137. package/dist/utils/resource-utils.js.map +1 -1
  138. package/package.json +9 -9
  139. package/src/card-metadata-updater.ts +6 -2
  140. package/src/command-handler.ts +39 -12
  141. package/src/command-manager.ts +33 -21
  142. package/src/commands/create.ts +43 -78
  143. package/src/commands/export.ts +63 -52
  144. package/src/commands/fetch.ts +143 -34
  145. package/src/commands/import.ts +37 -15
  146. package/src/commands/move.ts +0 -1
  147. package/src/commands/remove.ts +20 -7
  148. package/src/commands/rename.ts +58 -149
  149. package/src/commands/show.ts +123 -80
  150. package/src/commands/transition.ts +26 -28
  151. package/src/commands/update.ts +25 -22
  152. package/src/commands/validate.ts +104 -67
  153. package/src/containers/card-container.ts +37 -5
  154. package/src/containers/project/calculation-engine.ts +61 -93
  155. package/src/containers/project/project-paths.ts +29 -13
  156. package/src/containers/project/resource-cache.ts +651 -0
  157. package/src/containers/project/resource-handler.ts +265 -0
  158. package/src/containers/project.ts +250 -527
  159. package/src/containers/template.ts +28 -23
  160. package/src/interfaces/command-options.ts +3 -1
  161. package/src/interfaces/folder-content-interfaces.ts +7 -6
  162. package/src/interfaces/project-interfaces.ts +12 -11
  163. package/src/interfaces/resource-interfaces.ts +18 -3
  164. package/src/macros/graph/index.ts +26 -47
  165. package/src/macros/index.ts +2 -2
  166. package/src/macros/report/index.ts +3 -9
  167. package/src/module-manager.ts +74 -17
  168. package/src/project-settings.ts +96 -14
  169. package/src/resources/calculation-resource.ts +18 -18
  170. package/src/resources/card-type-resource.ts +50 -50
  171. package/src/resources/create-defaults.ts +3 -2
  172. package/src/resources/field-type-resource.ts +41 -55
  173. package/src/resources/file-resource.ts +10 -36
  174. package/src/resources/folder-resource.ts +69 -120
  175. package/src/resources/graph-model-resource.ts +20 -22
  176. package/src/resources/graph-view-resource.ts +15 -17
  177. package/src/resources/link-type-resource.ts +10 -13
  178. package/src/resources/report-resource.ts +21 -43
  179. package/src/resources/resource-object.ts +263 -149
  180. package/src/resources/template-resource.ts +17 -16
  181. package/src/resources/workflow-resource.ts +25 -44
  182. package/src/utils/card-utils.ts +2 -2
  183. package/src/utils/clingo-fact-builder.ts +28 -16
  184. package/src/utils/clingo-facts.ts +3 -4
  185. package/src/utils/configuration-logger.ts +206 -0
  186. package/src/utils/constants.ts +5 -3
  187. package/src/utils/resource-utils.ts +2 -1
  188. package/dist/containers/project/resource-collector.d.ts +0 -110
  189. package/dist/containers/project/resource-collector.js +0 -344
  190. package/dist/containers/project/resource-collector.js.map +0 -1
  191. package/src/containers/project/resource-collector.ts +0 -404
@@ -0,0 +1,151 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2025
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/>.
13
+ */
14
+ import { readFile, rename } from 'node:fs/promises';
15
+ import { join } from 'node:path';
16
+ import { getChildLogger } from './log-utils.js';
17
+ import { ProjectPaths } from '../containers/project/project-paths.js';
18
+ import { writeFileSafe, pathExists } from './file-utils.js';
19
+ /**
20
+ * Enum for configuration change operation types.
21
+ */
22
+ export var ConfigurationOperation;
23
+ (function (ConfigurationOperation) {
24
+ ConfigurationOperation["MODULE_ADD"] = "module_add";
25
+ ConfigurationOperation["MODULE_REMOVE"] = "module_remove";
26
+ ConfigurationOperation["PROJECT_RENAME"] = "project_rename";
27
+ ConfigurationOperation["RESOURCE_CREATE"] = "resource_create";
28
+ ConfigurationOperation["RESOURCE_DELETE"] = "resource_delete";
29
+ ConfigurationOperation["RESOURCE_RENAME"] = "resource_rename";
30
+ ConfigurationOperation["RESOURCE_UPDATE"] = "resource_update";
31
+ })(ConfigurationOperation || (ConfigurationOperation = {}));
32
+ /**
33
+ * Logger for tracking configuration changes that affect project structure.
34
+ */
35
+ export class ConfigurationLogger {
36
+ /**
37
+ * Path to the configuration log file.
38
+ * @param projectPath Path to the project root
39
+ * @returns Path to the log file
40
+ */
41
+ static logFile(projectPath) {
42
+ const paths = new ProjectPaths(projectPath);
43
+ return paths.configurationChangesLog;
44
+ }
45
+ /**
46
+ * Clears all log entries.
47
+ * @param projectPath Path to the project root
48
+ * @note Use with caution.
49
+ */
50
+ static async clearLog(projectPath) {
51
+ const logFile = ConfigurationLogger.logFile(projectPath);
52
+ await writeFileSafe(logFile, '', 'utf-8');
53
+ const logger = getChildLogger({ module: 'ConfigurationLogger' });
54
+ logger.info('Configuration log cleared');
55
+ }
56
+ /**
57
+ * Create a versioned snapshot of the current migration log.
58
+ * Renames current migrationLog.jsonl to migrationLog_<version>.jsonl
59
+ * @param projectPath Path to the project root
60
+ * @param version Version identifier (e.g., "1.0.0", "v2")
61
+ * @returns Path to the versioned log file
62
+ */
63
+ static async createVersion(projectPath, version) {
64
+ const paths = new ProjectPaths(projectPath);
65
+ const currentLogPath = paths.configurationChangesLog;
66
+ const versionedLogPath = join(paths.migrationLogFolder, `migrationLog_${version}.jsonl`);
67
+ // Only create version if current log exists and has content
68
+ if (!pathExists(currentLogPath)) {
69
+ throw new Error('No current migration log exists to version');
70
+ }
71
+ const content = await readFile(currentLogPath, 'utf-8');
72
+ if (!content.trim()) {
73
+ throw new Error('Current migration log is empty');
74
+ }
75
+ // Rename current to versioned
76
+ await rename(currentLogPath, versionedLogPath);
77
+ const logger = getChildLogger({ module: 'ConfigurationLogger' });
78
+ logger.info(`Created migration to version: ${version} at ${versionedLogPath}`);
79
+ return versionedLogPath;
80
+ }
81
+ /**
82
+ * Reads all configuration log entries using JSON Lines format.
83
+ * @param projectPath Path to the project root
84
+ * @returns Array of log entries
85
+ */
86
+ static async entries(projectPath) {
87
+ const logFile = ConfigurationLogger.logFile(projectPath);
88
+ const logger = getChildLogger({ module: 'ConfigurationLogger' });
89
+ try {
90
+ const content = await readFile(logFile, 'utf-8');
91
+ const lines = content
92
+ .trim()
93
+ .split('\n')
94
+ .filter((line) => line.trim());
95
+ const entries = [];
96
+ for (const line of lines) {
97
+ try {
98
+ const entry = JSON.parse(line);
99
+ if (entry.timestamp && entry.operation && entry.target) {
100
+ entries.push(entry);
101
+ }
102
+ }
103
+ catch {
104
+ logger.error(`Invalid configuration line: ${line}`);
105
+ }
106
+ }
107
+ return entries;
108
+ }
109
+ catch (error) {
110
+ logger.error({ error }, `Failed to read configuration log`);
111
+ return [];
112
+ }
113
+ }
114
+ /**
115
+ * Check if a configuration log exists for the given project path.
116
+ * @param projectPath Path to the project root
117
+ * @returns True if log file exists
118
+ */
119
+ static hasLog(projectPath) {
120
+ const logPath = new ProjectPaths(projectPath).configurationChangesLog;
121
+ return pathExists(logPath);
122
+ }
123
+ /**
124
+ * Log a configuration change operation.
125
+ * @note This is designed to be called AFTER the operation succeeds.
126
+ * @param projectPath Path to the project root
127
+ * @param operation The type of operation
128
+ * @param target The target of the operation
129
+ * @param options Additional options for the log entry
130
+ */
131
+ static async log(projectPath, operation, target, options) {
132
+ const logFile = ConfigurationLogger.logFile(projectPath);
133
+ const logger = getChildLogger({ module: 'ConfigurationLogger' });
134
+ try {
135
+ const entry = {
136
+ timestamp: new Date().toISOString(),
137
+ operation,
138
+ target,
139
+ parameters: options?.parameters,
140
+ };
141
+ await writeFileSafe(logFile, JSON.stringify(entry) + '\n', {
142
+ flag: 'a',
143
+ });
144
+ logger.debug(`Logged ${operation} operation for target: ${target}`);
145
+ }
146
+ catch (error) {
147
+ logger.error({ error, operation, target }, `Configuration logging failed`);
148
+ }
149
+ }
150
+ }
151
+ //# sourceMappingURL=configuration-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration-logger.js","sourceRoot":"","sources":["../../src/utils/configuration-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;EAYE;AAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAN,IAAY,sBAQX;AARD,WAAY,sBAAsB;IAChC,mDAAyB,CAAA;IACzB,yDAA+B,CAAA;IAC/B,2DAAiC,CAAA;IACjC,6DAAmC,CAAA;IACnC,6DAAmC,CAAA;IACnC,6DAAmC,CAAA;IACnC,6DAAmC,CAAA;AACrC,CAAC,EARW,sBAAsB,KAAtB,sBAAsB,QAQjC;AAwBD;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;;;OAIG;IACI,MAAM,CAAC,OAAO,CAAC,WAAmB;QACvC,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,WAAW,CAAC,CAAC;QAC5C,OAAO,KAAK,CAAC,uBAAuB,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,WA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;IACI,MAAM,CAAC,KAAK,CAAC,GAAG,CACrB,WAAmB,EACnB,SAAiC,EACjC,MAAc,EACd,OAAiC;QAEjC,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,cAAc,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC;QAEjE,IAAI,CAAC;YACH,MAAM,KAAK,GAA0B;gBACnC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,SAAS;gBACT,MAAM;gBACN,UAAU,EAAE,OAAO,EAAE,UAAU;aAChC,CAAC;YAEF,MAAM,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE;gBACzD,IAAI,EAAE,GAAG;aACV,CAAC,CAAC;YAEH,MAAM,CAAC,KAAK,CAAC,UAAU,SAAS,0BAA0B,MAAM,EAAE,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CACV,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,EAC5B,8BAA8B,CAC/B,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -24,7 +24,7 @@ export declare const VALID_FOLDER_RESOURCE_FILES: string[];
24
24
  /**
25
25
  * These are field names that are non-custom fields that present in metadata
26
26
  */
27
- export declare const PREDEFINED_FIELDS: ("title" | "cardType" | "workflowState" | "rank" | "lastTransitioned" | "lastUpdated" | "templateCardKey")[];
27
+ export declare const PREDEFINED_FIELDS: ("cardType" | "labels" | "lastTransitioned" | "lastUpdated" | "links" | "rank" | "templateCardKey" | "title" | "workflowState")[];
28
28
  /**
29
29
  * Checks if the given value is a predefined field.
30
30
  * @param value The field name to check.
@@ -34,13 +34,15 @@ export const VALID_FOLDER_RESOURCE_FILES = [
34
34
  * These are field names that are non-custom fields that present in metadata
35
35
  */
36
36
  export const PREDEFINED_FIELDS = [
37
- 'rank',
38
37
  'cardType',
39
- 'title',
40
- 'workflowState',
38
+ 'labels',
41
39
  'lastUpdated',
42
40
  'lastTransitioned',
41
+ 'links',
42
+ 'rank',
43
43
  'templateCardKey',
44
+ 'title',
45
+ 'workflowState',
44
46
  ];
45
47
  /**
46
48
  * Checks if the given value is a predefined field.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAIF,wDAAwD;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,SAAS;AAE9C,wCAAwC;AACxC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,mBAAmB;AACnB,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAE3B;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,gBAAgB;IAChB,cAAc;IACd,sBAAsB;IACtB,aAAa;IACb,UAAU;IACV,gBAAgB;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM;IACN,UAAU;IACV,OAAO;IACP,eAAe;IACf,aAAa;IACb,kBAAkB;IAClB,iBAAiB;CACyB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAa;IAEb,OAAQ,iBAA8B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAIF,wDAAwD;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,SAAS;AAE9C,wCAAwC;AACxC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,mBAAmB;AACnB,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAE3B;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,gBAAgB;IAChB,cAAc;IACd,sBAAsB;IACtB,aAAa;IACb,UAAU;IACV,gBAAgB;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,UAAU;IACV,QAAQ;IACR,aAAa;IACb,kBAAkB;IAClB,OAAO;IACP,MAAM;IACN,iBAAiB;IACjB,OAAO;IACP,eAAe;CAC2B,CAAC;AAE7C;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAa;IAEb,OAAQ,iBAA8B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC"}
@@ -27,6 +27,7 @@ export declare function resourceName(resourceName: string, strict?: boolean): Re
27
27
  * Converts resource name to path.
28
28
  * @param project Project
29
29
  * @param resourceName Name of the resource (e.g. <prefix>/<type>/<name>)
30
+ * @param extension Extension of resource. By default '.json'.
30
31
  * @returns path to resource metadata file
31
32
  */
32
33
  export declare function resourceNameToPath(project: Project, resourceName: ResourceName, extension?: string): string;
@@ -68,6 +68,7 @@ export function resourceName(resourceName, strict = false) {
68
68
  * Converts resource name to path.
69
69
  * @param project Project
70
70
  * @param resourceName Name of the resource (e.g. <prefix>/<type>/<name>)
71
+ * @param extension Extension of resource. By default '.json'.
71
72
  * @returns path to resource metadata file
72
73
  */
73
74
  export function resourceNameToPath(project, resourceName, extension = '.json') {
@@ -153,7 +154,7 @@ export function resourceNameToString(resourceName) {
153
154
  resourceName.type) {
154
155
  throw new Error(`Not a valid resource name. Prefix is missing.`);
155
156
  }
156
- return resourceName.prefix && resourceName.type && resourceName.prefix
157
+ return resourceName.prefix && resourceName.type && resourceName.identifier
157
158
  ? `${resourceName.prefix}/${resourceName.type}/${resourceName.identifier}`
158
159
  : `${resourceName.identifier}`;
159
160
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resource-utils.js","sourceRoot":"","sources":["../../src/utils/resource-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;EAOE;AAEF,OAAO;AACP,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAYjD,iCAAiC;AACjC,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,sCAAsC;AACtC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,qBAAqB,GAAG;IAC5B,aAAa;IACb,YAAY;IACZ,SAAS;IACT,WAAW;CACZ,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AACD,uDAAuD;AACvD,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,UAAU,KAAK,mBAAmB,CAAC;AAC5C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,YAAoB,EACpB,SAAkB,KAAK;IAEvB,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,yDAAyD;IACzD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QAC7C,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,SAAS,YAAY,8BAA8B,CAAC,CAAC;QACvE,CAAC;QACD,OAAO;YACL,MAAM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AK,EAAE,EACxB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IACD,IACE,YAAY,CAAC,MAAM,KAAK,EAAE;QAC1B,YAAY,CAAC,UAAU;QACvB,YAAY,CAAC,IAAI,EACjB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,IAAI,IAAI,YAAY,CAAC,UAAU;QACxE,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,IAAI,IAAI,YAAY,CAAC,UAAU,EAAE;QAC1E,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC;AACnC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cyberismo/data-handler",
3
3
  "description": "Command handler for cards and web service",
4
- "version": "0.0.15",
4
+ "version": "0.0.17",
5
5
  "author": "sami.merila@cyberismo.com",
6
6
  "license": "AGPL-3.0",
7
7
  "homepage": "https://github.com/CyberismoCom/cyberismo",
@@ -20,7 +20,7 @@
20
20
  "@types/js-yaml": "^4.0.9",
21
21
  "@types/jsdom": "^21.1.7",
22
22
  "@types/json-schema": "^7.0.15",
23
- "@types/sinon": "^17.0.4",
23
+ "@types/sinon": "^21.0.0",
24
24
  "c8": "^10.1.3",
25
25
  "pino-pretty": "^13.1.2",
26
26
  "sinon": "^21.0.0"
@@ -38,16 +38,16 @@
38
38
  "jsdom": "^27.0.0",
39
39
  "json-schema": "^0.4.0",
40
40
  "jsonschema": "^1.5.0",
41
- "mime-types": "^3.0.1",
42
- "pino": "^9.9.5",
43
- "simple-git": "^3.28.0",
41
+ "mime-types": "^3.0.2",
42
+ "pino": "^10.1.0",
43
+ "simple-git": "^3.29.0",
44
44
  "string-pixel-width": "^1.11.0",
45
45
  "tslib": "^2.6.2",
46
- "vega": "^6.1.2",
47
- "vega-lite": "^6.3.1",
46
+ "vega": "^6.2.0",
47
+ "vega-lite": "^6.4.1",
48
48
  "write-json-file": "^7.0.0",
49
- "@cyberismo/assets": "0.0.15",
50
- "@cyberismo/node-clingo": "1.3.0"
49
+ "@cyberismo/assets": "0.0.17",
50
+ "@cyberismo/node-clingo": "1.3.3"
51
51
  },
52
52
  "type": "module",
53
53
  "files": [
@@ -13,7 +13,6 @@
13
13
  */
14
14
 
15
15
  import type { CardMetadata } from './interfaces/project-interfaces.js';
16
- import type { FieldType } from './interfaces/resource-interfaces.js';
17
16
  import { FieldTypeResource } from './resources/field-type-resource.js';
18
17
  import { getChildLogger } from './utils/log-utils.js';
19
18
  import type { Project } from './containers/project.js';
@@ -91,7 +90,12 @@ export class CardMetadataUpdater {
91
90
  return result;
92
91
  }
93
92
 
94
- const fieldType = await project.resource<FieldType>(change.field);
93
+ let fieldType;
94
+ try {
95
+ fieldType = project.resources.byType(change.field, 'fieldTypes').show();
96
+ } catch {
97
+ fieldType = undefined;
98
+ }
95
99
  if (!fieldType) {
96
100
  result.success = false;
97
101
  result.errors.push(
@@ -15,11 +15,13 @@ import { join, resolve } from 'node:path';
15
15
  import { execFileSync } from 'node:child_process';
16
16
  import { readFileSync } from 'node:fs';
17
17
 
18
+ import { SCHEMA_VERSION } from '@cyberismo/assets';
18
19
  import type {
19
20
  Card,
20
21
  CardAttachment,
21
22
  CardListContainer,
22
23
  Credentials,
24
+ HubSetting,
23
25
  ModuleContent,
24
26
  ModuleSettingFromHub,
25
27
  ProjectMetadata,
@@ -28,13 +30,14 @@ import type {
28
30
  } from './interfaces/project-interfaces.js';
29
31
  import type {
30
32
  DataType,
31
- ResourceContent,
33
+ AnyResourceContent,
32
34
  } from './interfaces/resource-interfaces.js';
33
35
  import type {
34
36
  AddCommandOptions,
35
37
  AllCommandOptions,
36
38
  CalcCommandOptions,
37
39
  ExportCommandOptions,
40
+ ImportCommandOptions,
38
41
  ReportCommandOptions,
39
42
  ShowCommandOptions,
40
43
  StartCommandOptions,
@@ -43,7 +46,8 @@ import type {
43
46
 
44
47
  import type { requestStatus } from './interfaces/request-status-interfaces.js';
45
48
 
46
- import { Create, Validate } from './commands/index.js';
49
+ import { Create } from './commands/create.js';
50
+ import { Validate } from './commands/validate.js';
47
51
  import { CommandManager } from './command-manager.js';
48
52
  import type { UpdateOperations } from './resources/resource-object.js';
49
53
  import { Project } from './containers/project.js';
@@ -178,6 +182,12 @@ export class Commands {
178
182
  if (!this.commands) {
179
183
  throw new Error('Cannot get instance of CommandManager');
180
184
  }
185
+
186
+ // Check schema version and log warning if there's a mismatch
187
+ const versionCheck = this.commands.checkSchemaVersion();
188
+ if (!versionCheck.isCompatible) {
189
+ console.error(versionCheck.message);
190
+ }
181
191
  }
182
192
 
183
193
  // Handles actual command. Sets returns values correctly.
@@ -306,6 +316,7 @@ export class Commands {
306
316
  branch,
307
317
  useCredentials && useCredentials === 'true' ? true : false,
308
318
  credentials,
319
+ (options as ImportCommandOptions).skipMigrationLog,
309
320
  );
310
321
  }
311
322
  if (target === 'csv') {
@@ -439,6 +450,13 @@ export class Commands {
439
450
  return { statusCode: 200 };
440
451
  }
441
452
 
453
+ /**
454
+ * Returns the current schema version.
455
+ */
456
+ public getSchemaVersion(): number {
457
+ return SCHEMA_VERSION;
458
+ }
459
+
442
460
  /**
443
461
  * Returns project path, if running operation within project folder.
444
462
  * @param path Initial path from where the project path search is started.
@@ -594,12 +612,18 @@ export class Commands {
594
612
  branch?: string,
595
613
  useCredentials?: boolean,
596
614
  credentials?: Credentials,
615
+ skipMigrationLog = false,
597
616
  ) {
598
- return this.commands?.importCmd.importModule(source, this.projectPath, {
599
- branch: branch,
600
- private: useCredentials,
601
- credentials,
602
- });
617
+ return this.commands?.importCmd.importModule(
618
+ source,
619
+ this.projectPath,
620
+ {
621
+ branch: branch,
622
+ private: useCredentials,
623
+ credentials,
624
+ },
625
+ skipMigrationLog,
626
+ );
603
627
  }
604
628
 
605
629
  // Imports cards from a CSV file to a project.
@@ -706,10 +730,11 @@ export class Commands {
706
730
  | Card
707
731
  | CardAttachment[]
708
732
  | CardListContainer[]
733
+ | HubSetting[]
709
734
  | ModuleContent
710
735
  | ModuleSettingFromHub[]
711
736
  | ProjectMetadata
712
- | ResourceContent
737
+ | AnyResourceContent
713
738
  | string[]
714
739
  | undefined
715
740
  >;
@@ -764,12 +789,13 @@ export class Commands {
764
789
  promise = this.commands!.showCmd.showModule(detail);
765
790
  break;
766
791
  case 'hubs':
792
+ promise = this.commands!.showCmd.showHubs();
793
+ break;
794
+ case 'modules':
767
795
  return {
768
796
  statusCode: 200,
769
- payload: this.commands!.showCmd.showHubs(),
797
+ payload: this.commands!.showCmd.showModules(),
770
798
  };
771
- case 'modules':
772
- promise = this.commands!.showCmd.showModules();
773
799
  break;
774
800
  case 'project':
775
801
  promise = this.commands!.showCmd.showProject();
@@ -787,7 +813,8 @@ export class Commands {
787
813
  // Starts the Cyberismo app by running npm start in the app project folder
788
814
  private async startApp(forceStart: boolean = false): Promise<requestStatus> {
789
815
  // __dirname when running cards ends with /tools/data-handler/dist - use that to navigate to app path
790
- const baseDir = import.meta.dirname;
816
+ const baseDir =
817
+ import.meta.dirname ?? new URL('.', import.meta.url).pathname;
791
818
  const appPath = resolve(baseDir, '../../app');
792
819
 
793
820
  // since current working directory changes, we need to resolve the project path
@@ -10,21 +10,19 @@
10
10
  License along with this program. If not, see <https://www.gnu.org/licenses/>.
11
11
  */
12
12
 
13
- import {
14
- Calculate,
15
- Create,
16
- Edit,
17
- Export,
18
- Fetch,
19
- Import,
20
- Move,
21
- Remove,
22
- Rename,
23
- Show,
24
- Transition,
25
- Update,
26
- Validate,
27
- } from './commands/index.js';
13
+ import { Calculate } from './commands/calculate.js';
14
+ import { Create } from './commands/create.js';
15
+ import { Edit } from './commands/edit.js';
16
+ import { Export } from './commands/export.js';
17
+ import { Fetch } from './commands/fetch.js';
18
+ import { Import } from './commands/import.js';
19
+ import { Move } from './commands/move.js';
20
+ import { Remove } from './commands/remove.js';
21
+ import { Rename } from './commands/rename.js';
22
+ import { Show } from './commands/show.js';
23
+ import { Transition } from './commands/transition.js';
24
+ import { Update } from './commands/update.js';
25
+ import { Validate } from './commands/validate.js';
28
26
  import { Project } from './containers/project.js';
29
27
  import { ProjectPaths } from './containers/project/project-paths.js';
30
28
  import pino, { type Level, type TransportTargetOptions } from 'pino';
@@ -32,6 +30,7 @@ import { setLogger } from './utils/log-utils.js';
32
30
 
33
31
  export interface CommandManagerOptions {
34
32
  watchResourceChanges?: boolean;
33
+ autoSaveConfiguration?: boolean;
35
34
  logLevel?: Level;
36
35
  }
37
36
 
@@ -57,30 +56,43 @@ export class CommandManager {
57
56
  private pathHandler: ProjectPaths;
58
57
 
59
58
  constructor(path: string, options?: CommandManagerOptions) {
60
- this.project = new Project(path, options?.watchResourceChanges);
59
+ this.project = new Project(path, {
60
+ autoSave: options?.autoSaveConfiguration,
61
+ watchResourceChanges: options?.watchResourceChanges,
62
+ });
61
63
  this.validateCmd = Validate.getInstance();
62
64
 
63
65
  this.calculateCmd = new Calculate(this.project);
64
- this.showCmd = new Show(this.project);
66
+ this.fetchCmd = new Fetch(this.project);
67
+ this.showCmd = new Show(this.project, this.fetchCmd);
65
68
  this.createCmd = new Create(this.project);
66
69
  this.editCmd = new Edit(this.project);
67
70
  this.exportCmd = new Export(this.project, this.showCmd);
68
- this.fetchCmd = new Fetch(this.project);
69
- this.importCmd = new Import(this.project, this.createCmd);
71
+ this.importCmd = new Import(this.project, this.createCmd, this.fetchCmd);
70
72
  this.moveCmd = new Move(this.project);
71
- this.removeCmd = new Remove(this.project);
73
+ this.removeCmd = new Remove(this.project, this.fetchCmd);
72
74
  this.renameCmd = new Rename(this.project);
73
75
  this.transitionCmd = new Transition(this.project);
74
76
  this.updateCmd = new Update(this.project);
75
77
  this.pathHandler = new ProjectPaths(path);
76
78
  }
77
79
 
80
+ /**
81
+ * Checks the schema version compatibility.
82
+ * @returns
83
+ * isCompatible - true if compatible; false otherwise
84
+ * message - optional message related to compatibility.
85
+ */
86
+ public checkSchemaVersion(): { isCompatible: boolean; message?: string } {
87
+ return this.project.configuration.checkSchemaVersion();
88
+ }
89
+
78
90
  /**
79
91
  * Some commands needs initialization that cannot be performed inside constructor.
80
92
  * Add such calls here.
81
93
  */
82
94
  public async initialize() {
83
- this.project.collectModuleResources();
95
+ this.project.resources.changedModules();
84
96
  await this.project.populateCaches();
85
97
  }
86
98