@living-architecture/riviere-cli 0.4.5 → 0.5.0
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/bin.js +34 -20
- package/dist/index.js +34 -20
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -22403,23 +22403,28 @@ function createSourceNotFoundError(components, id) {
|
|
|
22403
22403
|
return new ComponentNotFoundError2(id.toString(), suggestions);
|
|
22404
22404
|
}
|
|
22405
22405
|
|
|
22406
|
+
// ../riviere-builder/dist/deduplicate.js
|
|
22407
|
+
function deduplicateStrings(existing, incoming) {
|
|
22408
|
+
const existingSet = new Set(existing);
|
|
22409
|
+
return incoming.filter((item) => !existingSet.has(item));
|
|
22410
|
+
}
|
|
22411
|
+
function deduplicateStateTransitions(existing, incoming) {
|
|
22412
|
+
return incoming.filter((item) => !existing.some((e) => e.from === item.from && e.to === item.to && e.trigger === item.trigger));
|
|
22413
|
+
}
|
|
22414
|
+
|
|
22406
22415
|
// ../riviere-builder/dist/merge-behavior.js
|
|
22416
|
+
function mergeStringArray(existing, incoming) {
|
|
22417
|
+
const base = existing ?? [];
|
|
22418
|
+
return [...base, ...deduplicateStrings(base, incoming)];
|
|
22419
|
+
}
|
|
22407
22420
|
function mergeBehavior(existing, incoming) {
|
|
22408
22421
|
const base = existing ?? {};
|
|
22409
22422
|
return {
|
|
22410
22423
|
...base,
|
|
22411
|
-
...incoming.reads !== void 0 && {
|
|
22412
|
-
|
|
22413
|
-
},
|
|
22414
|
-
...incoming.
|
|
22415
|
-
validates: [...base.validates ?? [], ...incoming.validates]
|
|
22416
|
-
},
|
|
22417
|
-
...incoming.modifies !== void 0 && {
|
|
22418
|
-
modifies: [...base.modifies ?? [], ...incoming.modifies]
|
|
22419
|
-
},
|
|
22420
|
-
...incoming.emits !== void 0 && {
|
|
22421
|
-
emits: [...base.emits ?? [], ...incoming.emits]
|
|
22422
|
-
}
|
|
22424
|
+
...incoming.reads !== void 0 && { reads: mergeStringArray(base.reads, incoming.reads) },
|
|
22425
|
+
...incoming.validates !== void 0 && { validates: mergeStringArray(base.validates, incoming.validates) },
|
|
22426
|
+
...incoming.modifies !== void 0 && { modifies: mergeStringArray(base.modifies, incoming.modifies) },
|
|
22427
|
+
...incoming.emits !== void 0 && { emits: mergeStringArray(base.emits, incoming.emits) }
|
|
22423
22428
|
};
|
|
22424
22429
|
}
|
|
22425
22430
|
|
|
@@ -22861,10 +22866,14 @@ var RiviereBuilder = class _RiviereBuilder {
|
|
|
22861
22866
|
component.entity = enrichment.entity;
|
|
22862
22867
|
}
|
|
22863
22868
|
if (enrichment.stateChanges !== void 0) {
|
|
22864
|
-
|
|
22869
|
+
const existing = component.stateChanges ?? [];
|
|
22870
|
+
const newItems = deduplicateStateTransitions(existing, enrichment.stateChanges);
|
|
22871
|
+
component.stateChanges = [...existing, ...newItems];
|
|
22865
22872
|
}
|
|
22866
22873
|
if (enrichment.businessRules !== void 0) {
|
|
22867
|
-
|
|
22874
|
+
const existing = component.businessRules ?? [];
|
|
22875
|
+
const newItems = deduplicateStrings(existing, enrichment.businessRules);
|
|
22876
|
+
component.businessRules = [...existing, ...newItems];
|
|
22868
22877
|
}
|
|
22869
22878
|
if (enrichment.behavior !== void 0) {
|
|
22870
22879
|
component.behavior = mergeBehavior(component.behavior, enrichment.behavior);
|
|
@@ -23324,7 +23333,11 @@ function addEventComponent(builder, common, options) {
|
|
|
23324
23333
|
if (!options.eventName) {
|
|
23325
23334
|
throw new Error("--event-name is required for Event component");
|
|
23326
23335
|
}
|
|
23327
|
-
const component = builder.addEvent({
|
|
23336
|
+
const component = builder.addEvent({
|
|
23337
|
+
...common,
|
|
23338
|
+
eventName: options.eventName,
|
|
23339
|
+
...options.eventSchema !== void 0 && { eventSchema: options.eventSchema }
|
|
23340
|
+
});
|
|
23328
23341
|
return component.id;
|
|
23329
23342
|
}
|
|
23330
23343
|
function addEventHandlerComponent(builder, common, options) {
|
|
@@ -23337,7 +23350,7 @@ function addEventHandlerComponent(builder, common, options) {
|
|
|
23337
23350
|
});
|
|
23338
23351
|
return component.id;
|
|
23339
23352
|
}
|
|
23340
|
-
var
|
|
23353
|
+
var componentAdders = {
|
|
23341
23354
|
UI: addUIComponent,
|
|
23342
23355
|
API: addAPIComponent,
|
|
23343
23356
|
UseCase: addUseCaseComponent,
|
|
@@ -23362,8 +23375,8 @@ function addComponentToBuilder(builder, componentType, options, sourceLocation)
|
|
|
23362
23375
|
sourceLocation,
|
|
23363
23376
|
...options.description ? { description: options.description } : {}
|
|
23364
23377
|
};
|
|
23365
|
-
const
|
|
23366
|
-
return
|
|
23378
|
+
const adder = componentAdders[componentType];
|
|
23379
|
+
return adder(builder, commonInput, options);
|
|
23367
23380
|
}
|
|
23368
23381
|
function tryAddComponent(builder, componentType, options, sourceLocation) {
|
|
23369
23382
|
try {
|
|
@@ -23420,9 +23433,10 @@ Examples:
|
|
|
23420
23433
|
# Add an Event
|
|
23421
23434
|
$ riviere builder add-component --type Event --name "order-placed" \\
|
|
23422
23435
|
--domain orders --module events --repository ecommerce \\
|
|
23423
|
-
--file-path src/events/OrderPlaced.ts --event-name "order-placed"
|
|
23436
|
+
--file-path src/events/OrderPlaced.ts --event-name "order-placed" \\
|
|
23437
|
+
--event-schema "{ orderId: string, total: number }"
|
|
23424
23438
|
`
|
|
23425
|
-
).requiredOption("--type <type>", "Component type (UI, API, UseCase, DomainOp, Event, EventHandler, Custom)").requiredOption("--name <name>", "Component name").requiredOption("--domain <domain>", "Domain name").requiredOption("--module <module>", "Module name").requiredOption("--repository <url>", "Source repository URL").requiredOption("--file-path <path>", "Source file path").option("--route <route>", "UI route path").option("--api-type <type>", "API type (REST, GraphQL, other)").option("--http-method <method>", "HTTP method").option("--http-path <path>", "HTTP endpoint path").option("--operation-name <name>", "Operation name (DomainOp)").option("--entity <entity>", "Entity name (DomainOp)").option("--event-name <name>", "Event name").option("--subscribed-events <events>", "Comma-separated subscribed event names").option("--custom-type <name>", "Custom type name").option("--custom-property <key:value>", "Custom property (repeatable)", (val, acc) => [...acc, val], []).option("--description <desc>", "Component description").option("--line-number <n>", "Source line number").option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
|
|
23439
|
+
).requiredOption("--type <type>", "Component type (UI, API, UseCase, DomainOp, Event, EventHandler, Custom)").requiredOption("--name <name>", "Component name").requiredOption("--domain <domain>", "Domain name").requiredOption("--module <module>", "Module name").requiredOption("--repository <url>", "Source repository URL").requiredOption("--file-path <path>", "Source file path").option("--route <route>", "UI route path").option("--api-type <type>", "API type (REST, GraphQL, other)").option("--http-method <method>", "HTTP method").option("--http-path <path>", "HTTP endpoint path").option("--operation-name <name>", "Operation name (DomainOp)").option("--entity <entity>", "Entity name (DomainOp)").option("--event-name <name>", "Event name").option("--event-schema <schema>", "Event schema definition").option("--subscribed-events <events>", "Comma-separated subscribed event names").option("--custom-type <name>", "Custom type name").option("--custom-property <key:value>", "Custom property (repeatable)", (val, acc) => [...acc, val], []).option("--description <desc>", "Component description").option("--line-number <n>", "Source line number").option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
|
|
23426
23440
|
if (!isValidComponentType(options.type)) {
|
|
23427
23441
|
console.log(
|
|
23428
23442
|
JSON.stringify(
|
package/dist/index.js
CHANGED
|
@@ -22402,23 +22402,28 @@ function createSourceNotFoundError(components, id) {
|
|
|
22402
22402
|
return new ComponentNotFoundError2(id.toString(), suggestions);
|
|
22403
22403
|
}
|
|
22404
22404
|
|
|
22405
|
+
// ../riviere-builder/dist/deduplicate.js
|
|
22406
|
+
function deduplicateStrings(existing, incoming) {
|
|
22407
|
+
const existingSet = new Set(existing);
|
|
22408
|
+
return incoming.filter((item) => !existingSet.has(item));
|
|
22409
|
+
}
|
|
22410
|
+
function deduplicateStateTransitions(existing, incoming) {
|
|
22411
|
+
return incoming.filter((item) => !existing.some((e) => e.from === item.from && e.to === item.to && e.trigger === item.trigger));
|
|
22412
|
+
}
|
|
22413
|
+
|
|
22405
22414
|
// ../riviere-builder/dist/merge-behavior.js
|
|
22415
|
+
function mergeStringArray(existing, incoming) {
|
|
22416
|
+
const base = existing ?? [];
|
|
22417
|
+
return [...base, ...deduplicateStrings(base, incoming)];
|
|
22418
|
+
}
|
|
22406
22419
|
function mergeBehavior(existing, incoming) {
|
|
22407
22420
|
const base = existing ?? {};
|
|
22408
22421
|
return {
|
|
22409
22422
|
...base,
|
|
22410
|
-
...incoming.reads !== void 0 && {
|
|
22411
|
-
|
|
22412
|
-
},
|
|
22413
|
-
...incoming.
|
|
22414
|
-
validates: [...base.validates ?? [], ...incoming.validates]
|
|
22415
|
-
},
|
|
22416
|
-
...incoming.modifies !== void 0 && {
|
|
22417
|
-
modifies: [...base.modifies ?? [], ...incoming.modifies]
|
|
22418
|
-
},
|
|
22419
|
-
...incoming.emits !== void 0 && {
|
|
22420
|
-
emits: [...base.emits ?? [], ...incoming.emits]
|
|
22421
|
-
}
|
|
22423
|
+
...incoming.reads !== void 0 && { reads: mergeStringArray(base.reads, incoming.reads) },
|
|
22424
|
+
...incoming.validates !== void 0 && { validates: mergeStringArray(base.validates, incoming.validates) },
|
|
22425
|
+
...incoming.modifies !== void 0 && { modifies: mergeStringArray(base.modifies, incoming.modifies) },
|
|
22426
|
+
...incoming.emits !== void 0 && { emits: mergeStringArray(base.emits, incoming.emits) }
|
|
22422
22427
|
};
|
|
22423
22428
|
}
|
|
22424
22429
|
|
|
@@ -22860,10 +22865,14 @@ var RiviereBuilder = class _RiviereBuilder {
|
|
|
22860
22865
|
component.entity = enrichment.entity;
|
|
22861
22866
|
}
|
|
22862
22867
|
if (enrichment.stateChanges !== void 0) {
|
|
22863
|
-
|
|
22868
|
+
const existing = component.stateChanges ?? [];
|
|
22869
|
+
const newItems = deduplicateStateTransitions(existing, enrichment.stateChanges);
|
|
22870
|
+
component.stateChanges = [...existing, ...newItems];
|
|
22864
22871
|
}
|
|
22865
22872
|
if (enrichment.businessRules !== void 0) {
|
|
22866
|
-
|
|
22873
|
+
const existing = component.businessRules ?? [];
|
|
22874
|
+
const newItems = deduplicateStrings(existing, enrichment.businessRules);
|
|
22875
|
+
component.businessRules = [...existing, ...newItems];
|
|
22867
22876
|
}
|
|
22868
22877
|
if (enrichment.behavior !== void 0) {
|
|
22869
22878
|
component.behavior = mergeBehavior(component.behavior, enrichment.behavior);
|
|
@@ -23340,7 +23349,11 @@ function addEventComponent(builder, common, options) {
|
|
|
23340
23349
|
if (!options.eventName) {
|
|
23341
23350
|
throw new Error("--event-name is required for Event component");
|
|
23342
23351
|
}
|
|
23343
|
-
const component = builder.addEvent({
|
|
23352
|
+
const component = builder.addEvent({
|
|
23353
|
+
...common,
|
|
23354
|
+
eventName: options.eventName,
|
|
23355
|
+
...options.eventSchema !== void 0 && { eventSchema: options.eventSchema }
|
|
23356
|
+
});
|
|
23344
23357
|
return component.id;
|
|
23345
23358
|
}
|
|
23346
23359
|
function addEventHandlerComponent(builder, common, options) {
|
|
@@ -23353,7 +23366,7 @@ function addEventHandlerComponent(builder, common, options) {
|
|
|
23353
23366
|
});
|
|
23354
23367
|
return component.id;
|
|
23355
23368
|
}
|
|
23356
|
-
var
|
|
23369
|
+
var componentAdders = {
|
|
23357
23370
|
UI: addUIComponent,
|
|
23358
23371
|
API: addAPIComponent,
|
|
23359
23372
|
UseCase: addUseCaseComponent,
|
|
@@ -23378,8 +23391,8 @@ function addComponentToBuilder(builder, componentType, options, sourceLocation)
|
|
|
23378
23391
|
sourceLocation,
|
|
23379
23392
|
...options.description ? { description: options.description } : {}
|
|
23380
23393
|
};
|
|
23381
|
-
const
|
|
23382
|
-
return
|
|
23394
|
+
const adder = componentAdders[componentType];
|
|
23395
|
+
return adder(builder, commonInput, options);
|
|
23383
23396
|
}
|
|
23384
23397
|
function tryAddComponent(builder, componentType, options, sourceLocation) {
|
|
23385
23398
|
try {
|
|
@@ -23436,9 +23449,10 @@ Examples:
|
|
|
23436
23449
|
# Add an Event
|
|
23437
23450
|
$ riviere builder add-component --type Event --name "order-placed" \\
|
|
23438
23451
|
--domain orders --module events --repository ecommerce \\
|
|
23439
|
-
--file-path src/events/OrderPlaced.ts --event-name "order-placed"
|
|
23452
|
+
--file-path src/events/OrderPlaced.ts --event-name "order-placed" \\
|
|
23453
|
+
--event-schema "{ orderId: string, total: number }"
|
|
23440
23454
|
`
|
|
23441
|
-
).requiredOption("--type <type>", "Component type (UI, API, UseCase, DomainOp, Event, EventHandler, Custom)").requiredOption("--name <name>", "Component name").requiredOption("--domain <domain>", "Domain name").requiredOption("--module <module>", "Module name").requiredOption("--repository <url>", "Source repository URL").requiredOption("--file-path <path>", "Source file path").option("--route <route>", "UI route path").option("--api-type <type>", "API type (REST, GraphQL, other)").option("--http-method <method>", "HTTP method").option("--http-path <path>", "HTTP endpoint path").option("--operation-name <name>", "Operation name (DomainOp)").option("--entity <entity>", "Entity name (DomainOp)").option("--event-name <name>", "Event name").option("--subscribed-events <events>", "Comma-separated subscribed event names").option("--custom-type <name>", "Custom type name").option("--custom-property <key:value>", "Custom property (repeatable)", (val, acc) => [...acc, val], []).option("--description <desc>", "Component description").option("--line-number <n>", "Source line number").option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
|
|
23455
|
+
).requiredOption("--type <type>", "Component type (UI, API, UseCase, DomainOp, Event, EventHandler, Custom)").requiredOption("--name <name>", "Component name").requiredOption("--domain <domain>", "Domain name").requiredOption("--module <module>", "Module name").requiredOption("--repository <url>", "Source repository URL").requiredOption("--file-path <path>", "Source file path").option("--route <route>", "UI route path").option("--api-type <type>", "API type (REST, GraphQL, other)").option("--http-method <method>", "HTTP method").option("--http-path <path>", "HTTP endpoint path").option("--operation-name <name>", "Operation name (DomainOp)").option("--entity <entity>", "Entity name (DomainOp)").option("--event-name <name>", "Event name").option("--event-schema <schema>", "Event schema definition").option("--subscribed-events <events>", "Comma-separated subscribed event names").option("--custom-type <name>", "Custom type name").option("--custom-property <key:value>", "Custom property (repeatable)", (val, acc) => [...acc, val], []).option("--description <desc>", "Component description").option("--line-number <n>", "Source line number").option("--graph <path>", getDefaultGraphPathDescription()).option("--json", "Output result as JSON").action(async (options) => {
|
|
23442
23456
|
if (!isValidComponentType(options.type)) {
|
|
23443
23457
|
console.log(
|
|
23444
23458
|
JSON.stringify(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@living-architecture/riviere-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"commander": "^14.0.2",
|
|
29
|
+
"@living-architecture/riviere-builder": "0.4.0",
|
|
29
30
|
"@living-architecture/riviere-schema": "0.3.5",
|
|
30
|
-
"@living-architecture/riviere-query": "0.3.5"
|
|
31
|
-
"@living-architecture/riviere-builder": "0.3.5"
|
|
31
|
+
"@living-architecture/riviere-query": "0.3.5"
|
|
32
32
|
}
|
|
33
33
|
}
|