@cyberismo/data-handler 0.0.16 → 0.0.18

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 (94) hide show
  1. package/dist/command-handler.js +5 -7
  2. package/dist/command-handler.js.map +1 -1
  3. package/dist/command-manager.js +4 -4
  4. package/dist/command-manager.js.map +1 -1
  5. package/dist/commands/create.js +1 -1
  6. package/dist/commands/create.js.map +1 -1
  7. package/dist/commands/fetch.d.ts +8 -0
  8. package/dist/commands/fetch.js +101 -23
  9. package/dist/commands/fetch.js.map +1 -1
  10. package/dist/commands/import.d.ts +5 -2
  11. package/dist/commands/import.js +12 -3
  12. package/dist/commands/import.js.map +1 -1
  13. package/dist/commands/remove.d.ts +3 -1
  14. package/dist/commands/remove.js +7 -1
  15. package/dist/commands/remove.js.map +1 -1
  16. package/dist/commands/rename.js +5 -0
  17. package/dist/commands/rename.js.map +1 -1
  18. package/dist/commands/show.d.ts +4 -2
  19. package/dist/commands/show.js +8 -2
  20. package/dist/commands/show.js.map +1 -1
  21. package/dist/commands/validate.js +3 -5
  22. package/dist/commands/validate.js.map +1 -1
  23. package/dist/containers/card-container.d.ts +7 -5
  24. package/dist/containers/card-container.js +30 -5
  25. package/dist/containers/card-container.js.map +1 -1
  26. package/dist/containers/project/project-paths.d.ts +2 -0
  27. package/dist/containers/project/project-paths.js +6 -0
  28. package/dist/containers/project/project-paths.js.map +1 -1
  29. package/dist/containers/project/resource-cache.js +9 -7
  30. package/dist/containers/project/resource-cache.js.map +1 -1
  31. package/dist/containers/project.d.ts +11 -2
  32. package/dist/containers/project.js +54 -8
  33. package/dist/containers/project.js.map +1 -1
  34. package/dist/containers/template.js +4 -4
  35. package/dist/containers/template.js.map +1 -1
  36. package/dist/interfaces/command-options.d.ts +3 -1
  37. package/dist/interfaces/project-interfaces.d.ts +5 -5
  38. package/dist/interfaces/project-interfaces.js.map +1 -1
  39. package/dist/project-settings.d.ts +5 -0
  40. package/dist/project-settings.js +12 -0
  41. package/dist/project-settings.js.map +1 -1
  42. package/dist/resources/card-type-resource.d.ts +6 -2
  43. package/dist/resources/card-type-resource.js +68 -86
  44. package/dist/resources/card-type-resource.js.map +1 -1
  45. package/dist/resources/field-type-resource.d.ts +5 -1
  46. package/dist/resources/field-type-resource.js +49 -54
  47. package/dist/resources/field-type-resource.js.map +1 -1
  48. package/dist/resources/file-resource.d.ts +14 -1
  49. package/dist/resources/file-resource.js +29 -0
  50. package/dist/resources/file-resource.js.map +1 -1
  51. package/dist/resources/link-type-resource.d.ts +5 -1
  52. package/dist/resources/link-type-resource.js +28 -30
  53. package/dist/resources/link-type-resource.js.map +1 -1
  54. package/dist/resources/resource-object.d.ts +1 -0
  55. package/dist/resources/resource-object.js +52 -1
  56. package/dist/resources/resource-object.js.map +1 -1
  57. package/dist/resources/template-resource.js +5 -26
  58. package/dist/resources/template-resource.js.map +1 -1
  59. package/dist/resources/workflow-resource.d.ts +1 -1
  60. package/dist/resources/workflow-resource.js +79 -76
  61. package/dist/resources/workflow-resource.js.map +1 -1
  62. package/dist/utils/configuration-logger.d.ts +91 -0
  63. package/dist/utils/configuration-logger.js +151 -0
  64. package/dist/utils/configuration-logger.js.map +1 -0
  65. package/dist/utils/constants.d.ts +1 -1
  66. package/dist/utils/constants.js +5 -3
  67. package/dist/utils/constants.js.map +1 -1
  68. package/package.json +4 -4
  69. package/src/command-handler.ts +17 -9
  70. package/src/command-manager.ts +4 -4
  71. package/src/commands/create.ts +1 -1
  72. package/src/commands/fetch.ts +143 -34
  73. package/src/commands/import.ts +13 -1
  74. package/src/commands/remove.ts +10 -1
  75. package/src/commands/rename.ts +15 -0
  76. package/src/commands/show.ts +11 -3
  77. package/src/commands/validate.ts +3 -7
  78. package/src/containers/card-container.ts +37 -5
  79. package/src/containers/project/project-paths.ts +8 -0
  80. package/src/containers/project/resource-cache.ts +12 -9
  81. package/src/containers/project.ts +76 -9
  82. package/src/containers/template.ts +4 -4
  83. package/src/interfaces/command-options.ts +3 -1
  84. package/src/interfaces/project-interfaces.ts +5 -5
  85. package/src/project-settings.ts +13 -0
  86. package/src/resources/card-type-resource.ts +91 -109
  87. package/src/resources/field-type-resource.ts +60 -64
  88. package/src/resources/file-resource.ts +43 -1
  89. package/src/resources/link-type-resource.ts +32 -36
  90. package/src/resources/resource-object.ts +73 -1
  91. package/src/resources/template-resource.ts +6 -26
  92. package/src/resources/workflow-resource.ts +102 -93
  93. package/src/utils/configuration-logger.ts +206 -0
  94. package/src/utils/constants.ts +5 -3
@@ -0,0 +1,91 @@
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
+ /**
15
+ * Enum for configuration change operation types.
16
+ */
17
+ export declare enum ConfigurationOperation {
18
+ MODULE_ADD = "module_add",
19
+ MODULE_REMOVE = "module_remove",
20
+ PROJECT_RENAME = "project_rename",
21
+ RESOURCE_CREATE = "resource_create",
22
+ RESOURCE_DELETE = "resource_delete",
23
+ RESOURCE_RENAME = "resource_rename",
24
+ RESOURCE_UPDATE = "resource_update"
25
+ }
26
+ /**
27
+ * Individual log entry representing a single configuration change.
28
+ * @param timestamp Timestamp when the operation occurred (ISO string)
29
+ * @param operation Type of operation performed
30
+ * @param target Target of the operation
31
+ * @param parameters Additional parameters specific to the operation
32
+ */
33
+ export interface ConfigurationLogEntry {
34
+ timestamp: string;
35
+ operation: ConfigurationOperation;
36
+ target: string;
37
+ parameters?: Record<string, unknown>;
38
+ }
39
+ /**
40
+ * Options for logging configuration changes.
41
+ * @param parameters Additional parameters to store with the operation
42
+ */
43
+ export interface ConfigurationLogOptions {
44
+ parameters?: Record<string, unknown>;
45
+ }
46
+ /**
47
+ * Logger for tracking configuration changes that affect project structure.
48
+ */
49
+ export declare class ConfigurationLogger {
50
+ /**
51
+ * Path to the configuration log file.
52
+ * @param projectPath Path to the project root
53
+ * @returns Path to the log file
54
+ */
55
+ static logFile(projectPath: string): string;
56
+ /**
57
+ * Clears all log entries.
58
+ * @param projectPath Path to the project root
59
+ * @note Use with caution.
60
+ */
61
+ static clearLog(projectPath: string): Promise<void>;
62
+ /**
63
+ * Create a versioned snapshot of the current migration log.
64
+ * Renames current migrationLog.jsonl to migrationLog_<version>.jsonl
65
+ * @param projectPath Path to the project root
66
+ * @param version Version identifier (e.g., "1.0.0", "v2")
67
+ * @returns Path to the versioned log file
68
+ */
69
+ static createVersion(projectPath: string, version: string): Promise<string>;
70
+ /**
71
+ * Reads all configuration log entries using JSON Lines format.
72
+ * @param projectPath Path to the project root
73
+ * @returns Array of log entries
74
+ */
75
+ static entries(projectPath: string): Promise<ConfigurationLogEntry[]>;
76
+ /**
77
+ * Check if a configuration log exists for the given project path.
78
+ * @param projectPath Path to the project root
79
+ * @returns True if log file exists
80
+ */
81
+ static hasLog(projectPath: string): boolean;
82
+ /**
83
+ * Log a configuration change operation.
84
+ * @note This is designed to be called AFTER the operation succeeds.
85
+ * @param projectPath Path to the project root
86
+ * @param operation The type of operation
87
+ * @param target The target of the operation
88
+ * @param options Additional options for the log entry
89
+ */
90
+ static log(projectPath: string, operation: ConfigurationOperation, target: string, options?: ConfigurationLogOptions): Promise<void>;
91
+ }
@@ -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;;;;O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AC;IACH,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,WAAmB;QACtC,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,WAAW,CAAC,CAAC,uBAAuB,CAAC;QACtE,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;OAOG;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"}
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.16",
4
+ "version": "0.0.18",
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"
@@ -46,8 +46,8 @@
46
46
  "vega": "^6.2.0",
47
47
  "vega-lite": "^6.4.1",
48
48
  "write-json-file": "^7.0.0",
49
- "@cyberismo/assets": "0.0.16",
50
- "@cyberismo/node-clingo": "1.3.1"
49
+ "@cyberismo/assets": "0.0.18",
50
+ "@cyberismo/node-clingo": "1.3.3"
51
51
  },
52
52
  "type": "module",
53
53
  "files": [
@@ -21,6 +21,7 @@ import type {
21
21
  CardAttachment,
22
22
  CardListContainer,
23
23
  Credentials,
24
+ HubSetting,
24
25
  ModuleContent,
25
26
  ModuleSettingFromHub,
26
27
  ProjectMetadata,
@@ -36,6 +37,7 @@ import type {
36
37
  AllCommandOptions,
37
38
  CalcCommandOptions,
38
39
  ExportCommandOptions,
40
+ ImportCommandOptions,
39
41
  ReportCommandOptions,
40
42
  ShowCommandOptions,
41
43
  StartCommandOptions,
@@ -314,6 +316,7 @@ export class Commands {
314
316
  branch,
315
317
  useCredentials && useCredentials === 'true' ? true : false,
316
318
  credentials,
319
+ (options as ImportCommandOptions).skipMigrationLog,
317
320
  );
318
321
  }
319
322
  if (target === 'csv') {
@@ -609,12 +612,18 @@ export class Commands {
609
612
  branch?: string,
610
613
  useCredentials?: boolean,
611
614
  credentials?: Credentials,
615
+ skipMigrationLog = false,
612
616
  ) {
613
- return this.commands?.importCmd.importModule(source, this.projectPath, {
614
- branch: branch,
615
- private: useCredentials,
616
- credentials,
617
- });
617
+ return this.commands?.importCmd.importModule(
618
+ source,
619
+ this.projectPath,
620
+ {
621
+ branch: branch,
622
+ private: useCredentials,
623
+ credentials,
624
+ },
625
+ skipMigrationLog,
626
+ );
618
627
  }
619
628
 
620
629
  // Imports cards from a CSV file to a project.
@@ -721,6 +730,7 @@ export class Commands {
721
730
  | Card
722
731
  | CardAttachment[]
723
732
  | CardListContainer[]
733
+ | HubSetting[]
724
734
  | ModuleContent
725
735
  | ModuleSettingFromHub[]
726
736
  | ProjectMetadata
@@ -779,10 +789,8 @@ export class Commands {
779
789
  promise = this.commands!.showCmd.showModule(detail);
780
790
  break;
781
791
  case 'hubs':
782
- return {
783
- statusCode: 200,
784
- payload: this.commands!.showCmd.showHubs(),
785
- };
792
+ promise = this.commands!.showCmd.showHubs();
793
+ break;
786
794
  case 'modules':
787
795
  return {
788
796
  statusCode: 200,
@@ -63,14 +63,14 @@ export class CommandManager {
63
63
  this.validateCmd = Validate.getInstance();
64
64
 
65
65
  this.calculateCmd = new Calculate(this.project);
66
- this.showCmd = new Show(this.project);
66
+ this.fetchCmd = new Fetch(this.project);
67
+ this.showCmd = new Show(this.project, this.fetchCmd);
67
68
  this.createCmd = new Create(this.project);
68
69
  this.editCmd = new Edit(this.project);
69
70
  this.exportCmd = new Export(this.project, this.showCmd);
70
- this.fetchCmd = new Fetch(this.project);
71
- this.importCmd = new Import(this.project, this.createCmd);
71
+ this.importCmd = new Import(this.project, this.createCmd, this.fetchCmd);
72
72
  this.moveCmd = new Move(this.project);
73
- this.removeCmd = new Remove(this.project);
73
+ this.removeCmd = new Remove(this.project, this.fetchCmd);
74
74
  this.renameCmd = new Rename(this.project);
75
75
  this.transitionCmd = new Transition(this.project);
76
76
  this.updateCmd = new Update(this.project);
@@ -192,7 +192,7 @@ export class Create {
192
192
  Validate.getInstance().validResourceName(
193
193
  'templates',
194
194
  resourceNameToString(resourceName(templateName)),
195
- this.project.projectPrefixes(),
195
+ this.project.allModulePrefixes(),
196
196
  );
197
197
 
198
198
  await templateResource.validate();