@domain-first/project-structure 2.7.1 → 2.7.3
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.cjs +141 -77
- package/dist/index.js +141 -77
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -282,23 +282,6 @@ describe('${aggregateNaming.withSpaces}', () => {
|
|
|
282
282
|
if (withRepository) {
|
|
283
283
|
aggregatesFolder.createFile(`${aggregateNaming.fileName}-repository.ts`, `export abstract class ${aggregateNaming.ClassName}Repository { }`);
|
|
284
284
|
barrelFile.addLine(`export * from './${aggregateNaming.fileName}-repository'`);
|
|
285
|
-
if (scaffoldUnitTests) aggregatesFolder.createFile(`${aggregateNaming.fileName}-repository.spec.ts`, `
|
|
286
|
-
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
287
|
-
import { wire${aggregateNaming.ClassName}Repository } from '../../../wiring/repositories/wire-${aggregateNaming.fileName}-repository'
|
|
288
|
-
import type { ${aggregateNaming.ClassName}Repository } from './${aggregateNaming.fileName}-repository'
|
|
289
|
-
|
|
290
|
-
let ${aggregateNaming.variableName}Repository: ${aggregateNaming.ClassName}Repository
|
|
291
|
-
|
|
292
|
-
beforeEach(() => {
|
|
293
|
-
${aggregateNaming.variableName}Repository = wire${aggregateNaming.ClassName}Repository()
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
describe('${aggregateNaming.withSpaces} repository', () => {
|
|
297
|
-
test('can be wired', () => {
|
|
298
|
-
expect(${aggregateNaming.variableName}Repository).toBeDefined()
|
|
299
|
-
})
|
|
300
|
-
})
|
|
301
|
-
`.trim());
|
|
302
285
|
const infrastructureImplementationType = await (0, prompts_namespaceObject.input)({
|
|
303
286
|
message: 'Repository infrastructure implementation type:',
|
|
304
287
|
default: 'prisma'
|
|
@@ -333,6 +316,28 @@ export class ${naming.ClassName}${aggregateNaming.ClassName}Repository implement
|
|
|
333
316
|
|
|
334
317
|
`.trim());
|
|
335
318
|
}
|
|
319
|
+
if (scaffoldUnitTests) {
|
|
320
|
+
const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
|
|
321
|
+
aggregatesFolder.createFile(`${aggregateNaming.fileName}-repository.spec.ts`, `
|
|
322
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
323
|
+
${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? `import { wire${aggregateNaming.ClassName}Repository } from '../../../wiring/repositories/wire-${aggregateNaming.fileName}-repository'
|
|
324
|
+
import type { ${aggregateNaming.ClassName}Repository } from './${aggregateNaming.fileName}-repository'` : `import { ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository } from '../../../infrastructure/repositories/${implementationNaming.fileName}/${implementationNaming.fileName}-${aggregateNaming.fileName}-repository'
|
|
325
|
+
|
|
326
|
+
type ${aggregateNaming.ClassName}Repository = ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository`}
|
|
327
|
+
|
|
328
|
+
let ${aggregateNaming.variableName}Repository: ${aggregateNaming.ClassName}Repository
|
|
329
|
+
|
|
330
|
+
beforeEach(() => {
|
|
331
|
+
${aggregateNaming.variableName}Repository = ${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? `wire${aggregateNaming.ClassName}Repository()` : `new ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository()`}
|
|
332
|
+
})
|
|
333
|
+
|
|
334
|
+
describe('${aggregateNaming.withSpaces} repository', () => {
|
|
335
|
+
test('can be ${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
|
|
336
|
+
expect(${aggregateNaming.variableName}Repository).toBeDefined()
|
|
337
|
+
})
|
|
338
|
+
})
|
|
339
|
+
`.trim());
|
|
340
|
+
}
|
|
336
341
|
if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) {
|
|
337
342
|
const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
|
|
338
343
|
const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
|
|
@@ -366,7 +371,7 @@ const scaffoldNewApplicationPort = async (boundedContextFolder)=>{
|
|
|
366
371
|
});
|
|
367
372
|
const wiringFolder = boundedContextFolder.subitem([
|
|
368
373
|
'wiring',
|
|
369
|
-
'
|
|
374
|
+
'application-ports'
|
|
370
375
|
]);
|
|
371
376
|
const applicationPortsFolder = boundedContextFolder.subitem([
|
|
372
377
|
'application',
|
|
@@ -377,23 +382,6 @@ export abstract class ${naming.ClassName} {
|
|
|
377
382
|
|
|
378
383
|
}
|
|
379
384
|
`.trim());
|
|
380
|
-
if (scaffoldUnitTests) applicationPortsFolder.createFile(`${naming.fileName}.spec.ts`, `
|
|
381
|
-
import { define, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
382
|
-
import { type ${naming.ClassName} } from './${naming.fileName}'
|
|
383
|
-
import { wire${naming.ClassName} } from '../../wiring/ports/wire-${naming.fileName}'
|
|
384
|
-
|
|
385
|
-
let ${naming.variableName}: ${naming.ClassName}
|
|
386
|
-
|
|
387
|
-
beforeEach(() => {
|
|
388
|
-
${naming.variableName} = wire${naming.ClassName}()
|
|
389
|
-
})
|
|
390
|
-
|
|
391
|
-
define('${naming.withSpaces}', () => {
|
|
392
|
-
test('can be wired', () => {
|
|
393
|
-
expect(${naming.variableName}).toBeDefined()
|
|
394
|
-
})
|
|
395
|
-
})
|
|
396
|
-
`.trim());
|
|
397
385
|
const implementationType = await (0, prompts_namespaceObject.input)({
|
|
398
386
|
message: 'Adapter implementation type:',
|
|
399
387
|
default: 'api'
|
|
@@ -426,6 +414,28 @@ export class ${currentNaming.ClassName} extends ${naming.ClassName} {
|
|
|
426
414
|
}
|
|
427
415
|
`);
|
|
428
416
|
}
|
|
417
|
+
if (scaffoldUnitTests) {
|
|
418
|
+
const implementationNaming = new UnknownFormatNaming(implementationType);
|
|
419
|
+
applicationPortsFolder.createFile(`${naming.fileName}.spec.ts`, `
|
|
420
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
421
|
+
${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? `import { type ${naming.ClassName} } from './${naming.fileName}'
|
|
422
|
+
import { wire${naming.ClassName} } from '../../wiring/application-ports/wire-${naming.fileName}'` : `import { ${implementationNaming.ClassName}${naming.ClassName} } from '../../infrastructure/application-adapters/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}'
|
|
423
|
+
|
|
424
|
+
type ${naming.ClassName} = ${implementationNaming.ClassName}${naming.ClassName}`}
|
|
425
|
+
|
|
426
|
+
let ${naming.variableName}: ${naming.ClassName}
|
|
427
|
+
|
|
428
|
+
beforeEach(() => {
|
|
429
|
+
${naming.variableName} = ${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? `wire${naming.ClassName}()` : `new ${implementationNaming.ClassName}${naming.ClassName}()`}
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
describe('${naming.withSpaces}', () => {
|
|
433
|
+
test('can be ${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
|
|
434
|
+
expect(${naming.variableName}).toBeDefined()
|
|
435
|
+
})
|
|
436
|
+
})
|
|
437
|
+
`.trim());
|
|
438
|
+
}
|
|
429
439
|
if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) wiringFolder.createFile(`wire-${naming.fileName}.ts`, `
|
|
430
440
|
import { wireClass } from '@domain-first/wire'
|
|
431
441
|
import { envBranchedWire } from '../../../${'shared' === boundedContextFolder.name ? '' : '../'}shared/wiring/env-branched-wire'
|
|
@@ -544,25 +554,7 @@ const scaffoldNewCommand = async (boundedContextFolder)=>{
|
|
|
544
554
|
message: 'Command type'
|
|
545
555
|
});
|
|
546
556
|
const isOrchestrator = 'Orchestrator (no infrastructure implementation)' === commandType;
|
|
547
|
-
|
|
548
|
-
isOrchestrator ? 'orchestration' : 'execution'
|
|
549
|
-
]).createFile(`${naming.fileName}-command.spec.ts`, `
|
|
550
|
-
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
551
|
-
import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
|
|
552
|
-
import { wire${naming.ClassName}Command } from '../../../wiring/commands/wire-${naming.fileName}-command'
|
|
553
|
-
|
|
554
|
-
let ${naming.variableName}Command: ${naming.ClassName}Command
|
|
555
|
-
|
|
556
|
-
beforeEach(() => {
|
|
557
|
-
${naming.variableName}Command = wire${naming.ClassName}Command()
|
|
558
|
-
})
|
|
559
|
-
|
|
560
|
-
describe('${naming.withSpaces} command', () => {
|
|
561
|
-
test('can be wired', () => {
|
|
562
|
-
expect(${naming.variableName}Command).toBeDefined()
|
|
563
|
-
})
|
|
564
|
-
})
|
|
565
|
-
`.trim());
|
|
557
|
+
const withWiring = ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire');
|
|
566
558
|
if (!isOrchestrator) {
|
|
567
559
|
const implementationType = await (0, prompts_namespaceObject.input)({
|
|
568
560
|
message: 'Command infrastructure implementation type:',
|
|
@@ -603,7 +595,7 @@ export class ${formatNaming.ClassName}${naming.ClassName}Command extends ${namin
|
|
|
603
595
|
})
|
|
604
596
|
}
|
|
605
597
|
`.trim() : `
|
|
606
|
-
import { ${naming.ClassName}Command } from '../../../
|
|
598
|
+
import { ${naming.ClassName}Command } from '../../../application/commands/execution/${naming.fileName}-command'
|
|
607
599
|
|
|
608
600
|
export class ${formatNaming.ClassName}${naming.ClassName}Command extends ${naming.ClassName}Command {
|
|
609
601
|
constructor() {
|
|
@@ -624,10 +616,36 @@ export abstract class ${naming.ClassName}Command {
|
|
|
624
616
|
abstract handle: Handler<typeof ${naming.ClassName}Command.inputSchema, typeof ${naming.ClassName}Command.outputSchema>
|
|
625
617
|
}
|
|
626
618
|
`.trim());
|
|
627
|
-
else commandsFolder.
|
|
619
|
+
else commandsFolder.subitem([
|
|
620
|
+
'execution'
|
|
621
|
+
]).createFile(`${naming.fileName}-command.ts`, `
|
|
628
622
|
export abstract class ${naming.ClassName}Command {
|
|
629
623
|
|
|
630
624
|
}`.trim());
|
|
625
|
+
if (scaffoldUnitTests) {
|
|
626
|
+
const implementationNaming = new UnknownFormatNaming(implementationType);
|
|
627
|
+
commandsFolder.subitem([
|
|
628
|
+
'execution'
|
|
629
|
+
]).createFile(`${naming.fileName}-command.spec.ts`, `
|
|
630
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
631
|
+
${withWiring ? `import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
|
|
632
|
+
import { wire${naming.ClassName}Command } from '../../../wiring/commands/wire-${naming.fileName}-command'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Command } from '../../../infrastructure/commands/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-command'
|
|
633
|
+
|
|
634
|
+
type ${naming.ClassName}Command = ${implementationNaming.ClassName}${naming.ClassName}Command`}
|
|
635
|
+
|
|
636
|
+
let ${naming.variableName}Command: ${naming.ClassName}Command
|
|
637
|
+
|
|
638
|
+
beforeEach(() => {
|
|
639
|
+
${naming.variableName}Command = ${withWiring ? `wire${naming.ClassName}Command()` : `new ${implementationNaming.ClassName}${naming.ClassName}Command()`}
|
|
640
|
+
})
|
|
641
|
+
|
|
642
|
+
describe('${naming.withSpaces} command', () => {
|
|
643
|
+
test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
|
|
644
|
+
expect(${naming.variableName}Command).toBeDefined()
|
|
645
|
+
})
|
|
646
|
+
})
|
|
647
|
+
`.trim());
|
|
648
|
+
}
|
|
631
649
|
if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) {
|
|
632
650
|
const implementationNaming = new UnknownFormatNaming(implementationType);
|
|
633
651
|
const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
|
|
@@ -683,6 +701,25 @@ import { ${naming.ClassName}Command } from '../../application/commands/orchestra
|
|
|
683
701
|
|
|
684
702
|
export const wire${naming.ClassName}Command = wireClass(${naming.ClassName}Command, [])
|
|
685
703
|
`.trim());
|
|
704
|
+
if (scaffoldUnitTests) commandsFolder.subitem([
|
|
705
|
+
'orchestration'
|
|
706
|
+
]).createFile(`${naming.fileName}-command.spec.ts`, `
|
|
707
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
708
|
+
${withWiring ? `import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
|
|
709
|
+
import { wire${naming.ClassName}Command } from '../../../wiring/commands/wire-${naming.fileName}-command'` : `import { ${naming.ClassName}Command } from './${naming.fileName}-command'`}
|
|
710
|
+
|
|
711
|
+
let ${naming.variableName}Command: ${naming.ClassName}Command
|
|
712
|
+
|
|
713
|
+
beforeEach(() => {
|
|
714
|
+
${naming.variableName}Command = ${withWiring ? `wire${naming.ClassName}Command()` : `new ${naming.ClassName}Command()`}
|
|
715
|
+
})
|
|
716
|
+
|
|
717
|
+
describe('${naming.withSpaces} command', () => {
|
|
718
|
+
test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
|
|
719
|
+
expect(${naming.variableName}Command).toBeDefined()
|
|
720
|
+
})
|
|
721
|
+
})
|
|
722
|
+
`.trim());
|
|
686
723
|
};
|
|
687
724
|
const scaffoldNewDomainService = async (boundedContextFolder)=>{
|
|
688
725
|
const portName = await (0, prompts_namespaceObject.input)({
|
|
@@ -998,25 +1035,7 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
|
|
|
998
1035
|
message: 'Query type'
|
|
999
1036
|
});
|
|
1000
1037
|
const isOrchestrator = 'Orchestrator (no infrastructure implementation)' === queryType;
|
|
1001
|
-
|
|
1002
|
-
isOrchestrator ? 'orchestration' : 'execution'
|
|
1003
|
-
]).createFile(`${naming.fileName}-query.spec.ts`, `
|
|
1004
|
-
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
1005
|
-
import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
|
|
1006
|
-
import { wire${naming.ClassName}Query } from '../../../wiring/queries/wire-${naming.fileName}-query'
|
|
1007
|
-
|
|
1008
|
-
let ${naming.variableName}Query: ${naming.ClassName}Query
|
|
1009
|
-
|
|
1010
|
-
beforeEach(() => {
|
|
1011
|
-
${naming.variableName}Query = wire${naming.ClassName}Query()
|
|
1012
|
-
})
|
|
1013
|
-
|
|
1014
|
-
describe('${naming.withSpaces} query', () => {
|
|
1015
|
-
test('can be wired', () => {
|
|
1016
|
-
expect(${naming.variableName}Query).toBeDefined()
|
|
1017
|
-
})
|
|
1018
|
-
})
|
|
1019
|
-
`.trim());
|
|
1038
|
+
const withWiring = ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire');
|
|
1020
1039
|
if (!isOrchestrator) {
|
|
1021
1040
|
const implementationType = await (0, prompts_namespaceObject.input)({
|
|
1022
1041
|
message: 'Query infrastructure implementation type:',
|
|
@@ -1057,7 +1076,7 @@ export class ${formatNaming.ClassName}${naming.ClassName}Query extends ${naming.
|
|
|
1057
1076
|
})
|
|
1058
1077
|
}
|
|
1059
1078
|
`.trim() : `
|
|
1060
|
-
import { ${naming.ClassName}Query } from '../../../
|
|
1079
|
+
import { ${naming.ClassName}Query } from '../../../application/queries/execution/${naming.fileName}-query'
|
|
1061
1080
|
|
|
1062
1081
|
export class ${formatNaming.ClassName}${naming.ClassName}Query extends ${naming.ClassName}Query {
|
|
1063
1082
|
constructor() {
|
|
@@ -1078,10 +1097,36 @@ export abstract class ${naming.ClassName}Query {
|
|
|
1078
1097
|
abstract handle: Handler<typeof ${naming.ClassName}Query.inputSchema, typeof ${naming.ClassName}Query.outputSchema>
|
|
1079
1098
|
}
|
|
1080
1099
|
`.trim());
|
|
1081
|
-
else queriesFolder.
|
|
1100
|
+
else queriesFolder.subitem([
|
|
1101
|
+
'execution'
|
|
1102
|
+
]).createFile(`${naming.fileName}-query.ts`, `
|
|
1082
1103
|
export abstract class ${naming.ClassName}Query {
|
|
1083
1104
|
|
|
1084
1105
|
}`.trim());
|
|
1106
|
+
if (scaffoldUnitTests) {
|
|
1107
|
+
const implementationNaming = new UnknownFormatNaming(implementationType);
|
|
1108
|
+
queriesFolder.subitem([
|
|
1109
|
+
'execution'
|
|
1110
|
+
]).createFile(`${naming.fileName}-query.spec.ts`, `
|
|
1111
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
1112
|
+
${withWiring ? `import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
|
|
1113
|
+
import { wire${naming.ClassName}Query } from '../../../wiring/queries/wire-${naming.fileName}-query'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Query } from '../../../infrastructure/queries/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-query'
|
|
1114
|
+
|
|
1115
|
+
type ${naming.ClassName}Query = ${implementationNaming.ClassName}${naming.ClassName}Query`}
|
|
1116
|
+
|
|
1117
|
+
let ${naming.variableName}Query: ${naming.ClassName}Query
|
|
1118
|
+
|
|
1119
|
+
beforeEach(() => {
|
|
1120
|
+
${naming.variableName}Query = ${withWiring ? `wire${naming.ClassName}Query()` : `new ${implementationNaming.ClassName}${naming.ClassName}Query()`}
|
|
1121
|
+
})
|
|
1122
|
+
|
|
1123
|
+
describe('${naming.withSpaces} query', () => {
|
|
1124
|
+
test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
|
|
1125
|
+
expect(${naming.variableName}Query).toBeDefined()
|
|
1126
|
+
})
|
|
1127
|
+
})
|
|
1128
|
+
`.trim());
|
|
1129
|
+
}
|
|
1085
1130
|
if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) {
|
|
1086
1131
|
const implementationNaming = new UnknownFormatNaming(implementationType);
|
|
1087
1132
|
const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
|
|
@@ -1137,6 +1182,25 @@ import { ${naming.ClassName}Query } from '../../application/queries/orchestratio
|
|
|
1137
1182
|
|
|
1138
1183
|
export const wire${naming.ClassName}Query = wireClass(${naming.ClassName}Query, [])
|
|
1139
1184
|
`.trim());
|
|
1185
|
+
if (scaffoldUnitTests) queriesFolder.subitem([
|
|
1186
|
+
'orchestration'
|
|
1187
|
+
]).createFile(`${naming.fileName}-query.spec.ts`, `
|
|
1188
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
1189
|
+
${withWiring ? `import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
|
|
1190
|
+
import { wire${naming.ClassName}Query } from '../../../wiring/queries/wire-${naming.fileName}-query'` : `import { ${naming.ClassName}Query } from './${naming.fileName}-query'`}
|
|
1191
|
+
|
|
1192
|
+
let ${naming.variableName}Query: ${naming.ClassName}Query
|
|
1193
|
+
|
|
1194
|
+
beforeEach(() => {
|
|
1195
|
+
${naming.variableName}Query = ${withWiring ? `wire${naming.ClassName}Query()` : `new ${naming.ClassName}Query()`}
|
|
1196
|
+
})
|
|
1197
|
+
|
|
1198
|
+
describe('${naming.withSpaces} query', () => {
|
|
1199
|
+
test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
|
|
1200
|
+
expect(${naming.variableName}Query).toBeDefined()
|
|
1201
|
+
})
|
|
1202
|
+
})
|
|
1203
|
+
`.trim());
|
|
1140
1204
|
};
|
|
1141
1205
|
const scaffoldNewUseCase = async (boundedContextFolder)=>{
|
|
1142
1206
|
const useCasesFolder = boundedContextFolder.subitem([
|
package/dist/index.js
CHANGED
|
@@ -252,23 +252,6 @@ describe('${aggregateNaming.withSpaces}', () => {
|
|
|
252
252
|
if (withRepository) {
|
|
253
253
|
aggregatesFolder.createFile(`${aggregateNaming.fileName}-repository.ts`, `export abstract class ${aggregateNaming.ClassName}Repository { }`);
|
|
254
254
|
barrelFile.addLine(`export * from './${aggregateNaming.fileName}-repository'`);
|
|
255
|
-
if (scaffoldUnitTests) aggregatesFolder.createFile(`${aggregateNaming.fileName}-repository.spec.ts`, `
|
|
256
|
-
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
257
|
-
import { wire${aggregateNaming.ClassName}Repository } from '../../../wiring/repositories/wire-${aggregateNaming.fileName}-repository'
|
|
258
|
-
import type { ${aggregateNaming.ClassName}Repository } from './${aggregateNaming.fileName}-repository'
|
|
259
|
-
|
|
260
|
-
let ${aggregateNaming.variableName}Repository: ${aggregateNaming.ClassName}Repository
|
|
261
|
-
|
|
262
|
-
beforeEach(() => {
|
|
263
|
-
${aggregateNaming.variableName}Repository = wire${aggregateNaming.ClassName}Repository()
|
|
264
|
-
})
|
|
265
|
-
|
|
266
|
-
describe('${aggregateNaming.withSpaces} repository', () => {
|
|
267
|
-
test('can be wired', () => {
|
|
268
|
-
expect(${aggregateNaming.variableName}Repository).toBeDefined()
|
|
269
|
-
})
|
|
270
|
-
})
|
|
271
|
-
`.trim());
|
|
272
255
|
const infrastructureImplementationType = await input({
|
|
273
256
|
message: 'Repository infrastructure implementation type:',
|
|
274
257
|
default: 'prisma'
|
|
@@ -303,6 +286,28 @@ export class ${naming.ClassName}${aggregateNaming.ClassName}Repository implement
|
|
|
303
286
|
|
|
304
287
|
`.trim());
|
|
305
288
|
}
|
|
289
|
+
if (scaffoldUnitTests) {
|
|
290
|
+
const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
|
|
291
|
+
aggregatesFolder.createFile(`${aggregateNaming.fileName}-repository.spec.ts`, `
|
|
292
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
293
|
+
${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? `import { wire${aggregateNaming.ClassName}Repository } from '../../../wiring/repositories/wire-${aggregateNaming.fileName}-repository'
|
|
294
|
+
import type { ${aggregateNaming.ClassName}Repository } from './${aggregateNaming.fileName}-repository'` : `import { ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository } from '../../../infrastructure/repositories/${implementationNaming.fileName}/${implementationNaming.fileName}-${aggregateNaming.fileName}-repository'
|
|
295
|
+
|
|
296
|
+
type ${aggregateNaming.ClassName}Repository = ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository`}
|
|
297
|
+
|
|
298
|
+
let ${aggregateNaming.variableName}Repository: ${aggregateNaming.ClassName}Repository
|
|
299
|
+
|
|
300
|
+
beforeEach(() => {
|
|
301
|
+
${aggregateNaming.variableName}Repository = ${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? `wire${aggregateNaming.ClassName}Repository()` : `new ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository()`}
|
|
302
|
+
})
|
|
303
|
+
|
|
304
|
+
describe('${aggregateNaming.withSpaces} repository', () => {
|
|
305
|
+
test('can be ${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
|
|
306
|
+
expect(${aggregateNaming.variableName}Repository).toBeDefined()
|
|
307
|
+
})
|
|
308
|
+
})
|
|
309
|
+
`.trim());
|
|
310
|
+
}
|
|
306
311
|
if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) {
|
|
307
312
|
const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
|
|
308
313
|
const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
|
|
@@ -336,7 +341,7 @@ const scaffoldNewApplicationPort = async (boundedContextFolder)=>{
|
|
|
336
341
|
});
|
|
337
342
|
const wiringFolder = boundedContextFolder.subitem([
|
|
338
343
|
'wiring',
|
|
339
|
-
'
|
|
344
|
+
'application-ports'
|
|
340
345
|
]);
|
|
341
346
|
const applicationPortsFolder = boundedContextFolder.subitem([
|
|
342
347
|
'application',
|
|
@@ -347,23 +352,6 @@ export abstract class ${naming.ClassName} {
|
|
|
347
352
|
|
|
348
353
|
}
|
|
349
354
|
`.trim());
|
|
350
|
-
if (scaffoldUnitTests) applicationPortsFolder.createFile(`${naming.fileName}.spec.ts`, `
|
|
351
|
-
import { define, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
352
|
-
import { type ${naming.ClassName} } from './${naming.fileName}'
|
|
353
|
-
import { wire${naming.ClassName} } from '../../wiring/ports/wire-${naming.fileName}'
|
|
354
|
-
|
|
355
|
-
let ${naming.variableName}: ${naming.ClassName}
|
|
356
|
-
|
|
357
|
-
beforeEach(() => {
|
|
358
|
-
${naming.variableName} = wire${naming.ClassName}()
|
|
359
|
-
})
|
|
360
|
-
|
|
361
|
-
define('${naming.withSpaces}', () => {
|
|
362
|
-
test('can be wired', () => {
|
|
363
|
-
expect(${naming.variableName}).toBeDefined()
|
|
364
|
-
})
|
|
365
|
-
})
|
|
366
|
-
`.trim());
|
|
367
355
|
const implementationType = await input({
|
|
368
356
|
message: 'Adapter implementation type:',
|
|
369
357
|
default: 'api'
|
|
@@ -396,6 +384,28 @@ export class ${currentNaming.ClassName} extends ${naming.ClassName} {
|
|
|
396
384
|
}
|
|
397
385
|
`);
|
|
398
386
|
}
|
|
387
|
+
if (scaffoldUnitTests) {
|
|
388
|
+
const implementationNaming = new UnknownFormatNaming(implementationType);
|
|
389
|
+
applicationPortsFolder.createFile(`${naming.fileName}.spec.ts`, `
|
|
390
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
391
|
+
${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? `import { type ${naming.ClassName} } from './${naming.fileName}'
|
|
392
|
+
import { wire${naming.ClassName} } from '../../wiring/application-ports/wire-${naming.fileName}'` : `import { ${implementationNaming.ClassName}${naming.ClassName} } from '../../infrastructure/application-adapters/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}'
|
|
393
|
+
|
|
394
|
+
type ${naming.ClassName} = ${implementationNaming.ClassName}${naming.ClassName}`}
|
|
395
|
+
|
|
396
|
+
let ${naming.variableName}: ${naming.ClassName}
|
|
397
|
+
|
|
398
|
+
beforeEach(() => {
|
|
399
|
+
${naming.variableName} = ${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? `wire${naming.ClassName}()` : `new ${implementationNaming.ClassName}${naming.ClassName}()`}
|
|
400
|
+
})
|
|
401
|
+
|
|
402
|
+
describe('${naming.withSpaces}', () => {
|
|
403
|
+
test('can be ${ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
|
|
404
|
+
expect(${naming.variableName}).toBeDefined()
|
|
405
|
+
})
|
|
406
|
+
})
|
|
407
|
+
`.trim());
|
|
408
|
+
}
|
|
399
409
|
if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) wiringFolder.createFile(`wire-${naming.fileName}.ts`, `
|
|
400
410
|
import { wireClass } from '@domain-first/wire'
|
|
401
411
|
import { envBranchedWire } from '../../../${'shared' === boundedContextFolder.name ? '' : '../'}shared/wiring/env-branched-wire'
|
|
@@ -514,25 +524,7 @@ const scaffoldNewCommand = async (boundedContextFolder)=>{
|
|
|
514
524
|
message: 'Command type'
|
|
515
525
|
});
|
|
516
526
|
const isOrchestrator = 'Orchestrator (no infrastructure implementation)' === commandType;
|
|
517
|
-
|
|
518
|
-
isOrchestrator ? 'orchestration' : 'execution'
|
|
519
|
-
]).createFile(`${naming.fileName}-command.spec.ts`, `
|
|
520
|
-
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
521
|
-
import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
|
|
522
|
-
import { wire${naming.ClassName}Command } from '../../../wiring/commands/wire-${naming.fileName}-command'
|
|
523
|
-
|
|
524
|
-
let ${naming.variableName}Command: ${naming.ClassName}Command
|
|
525
|
-
|
|
526
|
-
beforeEach(() => {
|
|
527
|
-
${naming.variableName}Command = wire${naming.ClassName}Command()
|
|
528
|
-
})
|
|
529
|
-
|
|
530
|
-
describe('${naming.withSpaces} command', () => {
|
|
531
|
-
test('can be wired', () => {
|
|
532
|
-
expect(${naming.variableName}Command).toBeDefined()
|
|
533
|
-
})
|
|
534
|
-
})
|
|
535
|
-
`.trim());
|
|
527
|
+
const withWiring = ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire');
|
|
536
528
|
if (!isOrchestrator) {
|
|
537
529
|
const implementationType = await input({
|
|
538
530
|
message: 'Command infrastructure implementation type:',
|
|
@@ -573,7 +565,7 @@ export class ${formatNaming.ClassName}${naming.ClassName}Command extends ${namin
|
|
|
573
565
|
})
|
|
574
566
|
}
|
|
575
567
|
`.trim() : `
|
|
576
|
-
import { ${naming.ClassName}Command } from '../../../
|
|
568
|
+
import { ${naming.ClassName}Command } from '../../../application/commands/execution/${naming.fileName}-command'
|
|
577
569
|
|
|
578
570
|
export class ${formatNaming.ClassName}${naming.ClassName}Command extends ${naming.ClassName}Command {
|
|
579
571
|
constructor() {
|
|
@@ -594,10 +586,36 @@ export abstract class ${naming.ClassName}Command {
|
|
|
594
586
|
abstract handle: Handler<typeof ${naming.ClassName}Command.inputSchema, typeof ${naming.ClassName}Command.outputSchema>
|
|
595
587
|
}
|
|
596
588
|
`.trim());
|
|
597
|
-
else commandsFolder.
|
|
589
|
+
else commandsFolder.subitem([
|
|
590
|
+
'execution'
|
|
591
|
+
]).createFile(`${naming.fileName}-command.ts`, `
|
|
598
592
|
export abstract class ${naming.ClassName}Command {
|
|
599
593
|
|
|
600
594
|
}`.trim());
|
|
595
|
+
if (scaffoldUnitTests) {
|
|
596
|
+
const implementationNaming = new UnknownFormatNaming(implementationType);
|
|
597
|
+
commandsFolder.subitem([
|
|
598
|
+
'execution'
|
|
599
|
+
]).createFile(`${naming.fileName}-command.spec.ts`, `
|
|
600
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
601
|
+
${withWiring ? `import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
|
|
602
|
+
import { wire${naming.ClassName}Command } from '../../../wiring/commands/wire-${naming.fileName}-command'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Command } from '../../../infrastructure/commands/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-command'
|
|
603
|
+
|
|
604
|
+
type ${naming.ClassName}Command = ${implementationNaming.ClassName}${naming.ClassName}Command`}
|
|
605
|
+
|
|
606
|
+
let ${naming.variableName}Command: ${naming.ClassName}Command
|
|
607
|
+
|
|
608
|
+
beforeEach(() => {
|
|
609
|
+
${naming.variableName}Command = ${withWiring ? `wire${naming.ClassName}Command()` : `new ${implementationNaming.ClassName}${naming.ClassName}Command()`}
|
|
610
|
+
})
|
|
611
|
+
|
|
612
|
+
describe('${naming.withSpaces} command', () => {
|
|
613
|
+
test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
|
|
614
|
+
expect(${naming.variableName}Command).toBeDefined()
|
|
615
|
+
})
|
|
616
|
+
})
|
|
617
|
+
`.trim());
|
|
618
|
+
}
|
|
601
619
|
if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) {
|
|
602
620
|
const implementationNaming = new UnknownFormatNaming(implementationType);
|
|
603
621
|
const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
|
|
@@ -653,6 +671,25 @@ import { ${naming.ClassName}Command } from '../../application/commands/orchestra
|
|
|
653
671
|
|
|
654
672
|
export const wire${naming.ClassName}Command = wireClass(${naming.ClassName}Command, [])
|
|
655
673
|
`.trim());
|
|
674
|
+
if (scaffoldUnitTests) commandsFolder.subitem([
|
|
675
|
+
'orchestration'
|
|
676
|
+
]).createFile(`${naming.fileName}-command.spec.ts`, `
|
|
677
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
678
|
+
${withWiring ? `import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
|
|
679
|
+
import { wire${naming.ClassName}Command } from '../../../wiring/commands/wire-${naming.fileName}-command'` : `import { ${naming.ClassName}Command } from './${naming.fileName}-command'`}
|
|
680
|
+
|
|
681
|
+
let ${naming.variableName}Command: ${naming.ClassName}Command
|
|
682
|
+
|
|
683
|
+
beforeEach(() => {
|
|
684
|
+
${naming.variableName}Command = ${withWiring ? `wire${naming.ClassName}Command()` : `new ${naming.ClassName}Command()`}
|
|
685
|
+
})
|
|
686
|
+
|
|
687
|
+
describe('${naming.withSpaces} command', () => {
|
|
688
|
+
test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
|
|
689
|
+
expect(${naming.variableName}Command).toBeDefined()
|
|
690
|
+
})
|
|
691
|
+
})
|
|
692
|
+
`.trim());
|
|
656
693
|
};
|
|
657
694
|
const scaffoldNewDomainService = async (boundedContextFolder)=>{
|
|
658
695
|
const portName = await input({
|
|
@@ -968,25 +1005,7 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
|
|
|
968
1005
|
message: 'Query type'
|
|
969
1006
|
});
|
|
970
1007
|
const isOrchestrator = 'Orchestrator (no infrastructure implementation)' === queryType;
|
|
971
|
-
|
|
972
|
-
isOrchestrator ? 'orchestration' : 'execution'
|
|
973
|
-
]).createFile(`${naming.fileName}-query.spec.ts`, `
|
|
974
|
-
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
975
|
-
import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
|
|
976
|
-
import { wire${naming.ClassName}Query } from '../../../wiring/queries/wire-${naming.fileName}-query'
|
|
977
|
-
|
|
978
|
-
let ${naming.variableName}Query: ${naming.ClassName}Query
|
|
979
|
-
|
|
980
|
-
beforeEach(() => {
|
|
981
|
-
${naming.variableName}Query = wire${naming.ClassName}Query()
|
|
982
|
-
})
|
|
983
|
-
|
|
984
|
-
describe('${naming.withSpaces} query', () => {
|
|
985
|
-
test('can be wired', () => {
|
|
986
|
-
expect(${naming.variableName}Query).toBeDefined()
|
|
987
|
-
})
|
|
988
|
-
})
|
|
989
|
-
`.trim());
|
|
1008
|
+
const withWiring = ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire');
|
|
990
1009
|
if (!isOrchestrator) {
|
|
991
1010
|
const implementationType = await input({
|
|
992
1011
|
message: 'Query infrastructure implementation type:',
|
|
@@ -1027,7 +1046,7 @@ export class ${formatNaming.ClassName}${naming.ClassName}Query extends ${naming.
|
|
|
1027
1046
|
})
|
|
1028
1047
|
}
|
|
1029
1048
|
`.trim() : `
|
|
1030
|
-
import { ${naming.ClassName}Query } from '../../../
|
|
1049
|
+
import { ${naming.ClassName}Query } from '../../../application/queries/execution/${naming.fileName}-query'
|
|
1031
1050
|
|
|
1032
1051
|
export class ${formatNaming.ClassName}${naming.ClassName}Query extends ${naming.ClassName}Query {
|
|
1033
1052
|
constructor() {
|
|
@@ -1048,10 +1067,36 @@ export abstract class ${naming.ClassName}Query {
|
|
|
1048
1067
|
abstract handle: Handler<typeof ${naming.ClassName}Query.inputSchema, typeof ${naming.ClassName}Query.outputSchema>
|
|
1049
1068
|
}
|
|
1050
1069
|
`.trim());
|
|
1051
|
-
else queriesFolder.
|
|
1070
|
+
else queriesFolder.subitem([
|
|
1071
|
+
'execution'
|
|
1072
|
+
]).createFile(`${naming.fileName}-query.ts`, `
|
|
1052
1073
|
export abstract class ${naming.ClassName}Query {
|
|
1053
1074
|
|
|
1054
1075
|
}`.trim());
|
|
1076
|
+
if (scaffoldUnitTests) {
|
|
1077
|
+
const implementationNaming = new UnknownFormatNaming(implementationType);
|
|
1078
|
+
queriesFolder.subitem([
|
|
1079
|
+
'execution'
|
|
1080
|
+
]).createFile(`${naming.fileName}-query.spec.ts`, `
|
|
1081
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
1082
|
+
${withWiring ? `import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
|
|
1083
|
+
import { wire${naming.ClassName}Query } from '../../../wiring/queries/wire-${naming.fileName}-query'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Query } from '../../../infrastructure/queries/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-query'
|
|
1084
|
+
|
|
1085
|
+
type ${naming.ClassName}Query = ${implementationNaming.ClassName}${naming.ClassName}Query`}
|
|
1086
|
+
|
|
1087
|
+
let ${naming.variableName}Query: ${naming.ClassName}Query
|
|
1088
|
+
|
|
1089
|
+
beforeEach(() => {
|
|
1090
|
+
${naming.variableName}Query = ${withWiring ? `wire${naming.ClassName}Query()` : `new ${implementationNaming.ClassName}${naming.ClassName}Query()`}
|
|
1091
|
+
})
|
|
1092
|
+
|
|
1093
|
+
describe('${naming.withSpaces} query', () => {
|
|
1094
|
+
test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
|
|
1095
|
+
expect(${naming.variableName}Query).toBeDefined()
|
|
1096
|
+
})
|
|
1097
|
+
})
|
|
1098
|
+
`.trim());
|
|
1099
|
+
}
|
|
1055
1100
|
if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) {
|
|
1056
1101
|
const implementationNaming = new UnknownFormatNaming(implementationType);
|
|
1057
1102
|
const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
|
|
@@ -1107,6 +1152,25 @@ import { ${naming.ClassName}Query } from '../../application/queries/orchestratio
|
|
|
1107
1152
|
|
|
1108
1153
|
export const wire${naming.ClassName}Query = wireClass(${naming.ClassName}Query, [])
|
|
1109
1154
|
`.trim());
|
|
1155
|
+
if (scaffoldUnitTests) queriesFolder.subitem([
|
|
1156
|
+
'orchestration'
|
|
1157
|
+
]).createFile(`${naming.fileName}-query.spec.ts`, `
|
|
1158
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
1159
|
+
${withWiring ? `import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
|
|
1160
|
+
import { wire${naming.ClassName}Query } from '../../../wiring/queries/wire-${naming.fileName}-query'` : `import { ${naming.ClassName}Query } from './${naming.fileName}-query'`}
|
|
1161
|
+
|
|
1162
|
+
let ${naming.variableName}Query: ${naming.ClassName}Query
|
|
1163
|
+
|
|
1164
|
+
beforeEach(() => {
|
|
1165
|
+
${naming.variableName}Query = ${withWiring ? `wire${naming.ClassName}Query()` : `new ${naming.ClassName}Query()`}
|
|
1166
|
+
})
|
|
1167
|
+
|
|
1168
|
+
describe('${naming.withSpaces} query', () => {
|
|
1169
|
+
test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
|
|
1170
|
+
expect(${naming.variableName}Query).toBeDefined()
|
|
1171
|
+
})
|
|
1172
|
+
})
|
|
1173
|
+
`.trim());
|
|
1110
1174
|
};
|
|
1111
1175
|
const scaffoldNewUseCase = async (boundedContextFolder)=>{
|
|
1112
1176
|
const useCasesFolder = boundedContextFolder.subitem([
|