eventmodeler 0.3.0 → 0.3.1

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/index.js CHANGED
@@ -91,7 +91,7 @@ COMMANDS:
91
91
  map fields --flow <source→target> --json|--xml <mappings>
92
92
  Set field mappings on a flow
93
93
 
94
- update field --command|--event|--read-model|--screen|--processor <name> --field <name> [--optional true|false] [--generated true|false]
94
+ update field --command|--event|--read-model|--screen|--processor <name> --field <name> [--optional true|false] [--generated true|false] [--user-input true|false (screen only)]
95
95
  Update field properties
96
96
 
97
97
  create state-change-slice --xml <data>
@@ -421,10 +421,16 @@ async function main() {
421
421
  const fieldArg = getNamedArg(filteredArgs, '--field');
422
422
  const optionalArg = getNamedArg(filteredArgs, '--optional');
423
423
  const generatedArg = getNamedArg(filteredArgs, '--generated');
424
+ const userInputArg = getNamedArg(filteredArgs, '--user-input');
424
425
  const typeArg = getNamedArg(filteredArgs, '--type');
425
426
  if (!fieldArg) {
426
427
  console.error('Error: --field is required');
427
- console.error('Usage: eventmodeler update field --command|--event|--read-model|--screen|--processor <name> --field <field-name> [--optional true|false] [--generated true|false]');
428
+ console.error('Usage: eventmodeler update field --command|--event|--read-model|--screen|--processor <name> --field <field-name> [--optional true|false] [--generated true|false] [--user-input true|false (screen only)]');
429
+ process.exit(1);
430
+ }
431
+ // --user-input is only valid for screens
432
+ if (userInputArg !== undefined && !screenArg) {
433
+ console.error('Error: --user-input can only be used with --screen');
428
434
  process.exit(1);
429
435
  }
430
436
  const updates = {};
@@ -434,11 +440,14 @@ async function main() {
434
440
  if (generatedArg !== undefined) {
435
441
  updates.generated = generatedArg === 'true';
436
442
  }
443
+ if (userInputArg !== undefined) {
444
+ updates.userInput = userInputArg === 'true';
445
+ }
437
446
  if (typeArg !== undefined) {
438
447
  updates.type = typeArg;
439
448
  }
440
449
  if (Object.keys(updates).length === 0) {
441
- console.error('Error: Must specify at least one update (--optional, --generated, or --type)');
450
+ console.error('Error: Must specify at least one update (--optional, --generated, --user-input, or --type)');
442
451
  process.exit(1);
443
452
  }
444
453
  updateField(model, filePath, { command: commandArg, event: eventArg, readModel: readModelArg, screen: screenArg, processor: processorArg }, fieldArg, updates);
@@ -36,6 +36,7 @@ function parseXmlInput(input) {
36
36
  isList: getBoolAttr(fieldMatch[1], 'isList'),
37
37
  isGenerated: getBoolAttr(fieldMatch[1], 'isGenerated'),
38
38
  isOptional: getBoolAttr(fieldMatch[1], 'isOptional'),
39
+ isUserInput: getBoolAttr(fieldMatch[1], 'isUserInput'),
39
40
  };
40
41
  // Parse nested subfields for Custom type
41
42
  if (type === 'Custom' && fieldMatch[2]) {
@@ -63,6 +64,7 @@ function createFieldFromInput(input) {
63
64
  isList: input.isList ?? false,
64
65
  isGenerated: input.isGenerated ?? false,
65
66
  isOptional: input.isOptional,
67
+ isUserInput: input.isUserInput,
66
68
  subfields: input.subfields?.map(createFieldFromInput),
67
69
  };
68
70
  }
@@ -2,6 +2,7 @@ import type { EventModel } from '../../types.js';
2
2
  interface UpdateOptions {
3
3
  optional?: boolean;
4
4
  generated?: boolean;
5
+ userInput?: boolean;
5
6
  type?: string;
6
7
  }
7
8
  export declare function updateField(model: EventModel, filePath: string, options: {
@@ -28,6 +28,7 @@ function createUpdatedField(original, updates) {
28
28
  ...original,
29
29
  isOptional: updates.optional !== undefined ? updates.optional : original.isOptional,
30
30
  isGenerated: updates.generated !== undefined ? updates.generated : original.isGenerated,
31
+ isUserInput: updates.userInput !== undefined ? updates.userInput : original.isUserInput,
31
32
  fieldType: updates.type !== undefined ? updates.type : original.fieldType,
32
33
  };
33
34
  }
@@ -185,6 +186,9 @@ function logUpdates(updates) {
185
186
  if (updates.generated !== undefined) {
186
187
  console.log(` isGenerated: ${updates.generated}`);
187
188
  }
189
+ if (updates.userInput !== undefined) {
190
+ console.log(` isUserInput: ${updates.userInput}`);
191
+ }
188
192
  if (updates.type !== undefined) {
189
193
  console.log(` fieldType: ${updates.type}`);
190
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eventmodeler",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "CLI tool for interacting with Event Model files - query, update, and export event models from the terminal",
5
5
  "type": "module",
6
6
  "bin": {