@domain-first/project-structure 4.2.2 → 5.0.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.cjs CHANGED
@@ -37,10 +37,8 @@ const moduleKinds = [
37
37
  'application-ports',
38
38
  'application-services',
39
39
  'use-cases',
40
- 'execution-commands',
41
- 'execution-queries',
42
- 'orchestration-commands',
43
- 'orchestration-queries',
40
+ 'commands',
41
+ 'queries',
44
42
  'infrastructure-services',
45
43
  'presentation-services'
46
44
  ];
@@ -49,10 +47,8 @@ const domain = [
49
47
  'domain-services'
50
48
  ];
51
49
  const commandsAndQueries = [
52
- 'execution-commands',
53
- 'execution-queries',
54
- 'orchestration-commands',
55
- 'orchestration-queries'
50
+ 'commands',
51
+ 'queries'
56
52
  ];
57
53
  const infrastructure = [
58
54
  ...domain,
@@ -80,16 +76,11 @@ const defaultDependencies = {
80
76
  'application-services',
81
77
  ...commandsAndQueries
82
78
  ],
83
- 'execution-commands': infrastructure,
84
- 'execution-queries': infrastructure,
85
- 'orchestration-commands': [
86
- ...domain,
87
- 'execution-commands',
88
- 'execution-queries'
79
+ commands: [
80
+ 'infrastructure-services'
89
81
  ],
90
- 'orchestration-queries': [
91
- ...domain,
92
- 'execution-queries'
82
+ queries: [
83
+ 'infrastructure-services'
93
84
  ],
94
85
  'infrastructure-services': infrastructure,
95
86
  'presentation-services': [
@@ -129,10 +120,7 @@ const resolveDependencyRules = (config = {})=>{
129
120
  };
130
121
  const defaultDependencyRules = resolveDependencyRules();
131
122
  const isModuleKind = (value)=>moduleKinds.includes(value);
132
- const wiredModuleKind = (wiringKind, typeFile)=>{
133
- const kind = 'commands' === wiringKind || 'queries' === wiringKind ? `${'execution' === external_node_path_default().basename(external_node_path_default().dirname(typeFile)) ? 'execution' : 'orchestration'}-${wiringKind}` : wiringKind;
134
- return isModuleKind(kind) ? kind : void 0;
135
- };
123
+ const wiredModuleKind = (wiringKind)=>isModuleKind(wiringKind) ? wiringKind : void 0;
136
124
  const external_node_fs_namespaceObject = require("node:fs");
137
125
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
138
126
  const pendingFiles = new Map();
@@ -1476,13 +1464,11 @@ const branchedTypeFiles = {
1476
1464
  commands: (fileBase)=>[
1477
1465
  'application',
1478
1466
  'commands',
1479
- 'execution',
1480
1467
  `${fileBase}.ts`
1481
1468
  ],
1482
1469
  queries: (fileBase)=>[
1483
1470
  'application',
1484
1471
  'queries',
1485
- 'execution',
1486
1472
  `${fileBase}.ts`
1487
1473
  ],
1488
1474
  'application-ports': (fileBase)=>[
@@ -1577,7 +1563,7 @@ const findWiredModules = (contextPath)=>{
1577
1563
  walk(external_node_path_default().join(contextPath, 'wiring'));
1578
1564
  return result.sort((a, b)=>a.typeName.localeCompare(b.typeName));
1579
1565
  };
1580
- const moduleKindOf = (module)=>wiredModuleKind(module.kind, module.typeFile);
1566
+ const moduleKindOf = (module)=>wiredModuleKind(module.kind);
1581
1567
  const layerRule = (consumer, candidate)=>visibleLayers[consumer.implementationsLayer].includes(candidate.layer) && ('infrastructure' !== consumer.implementationsLayer || 'application' !== candidate.layer || 'application-ports' === candidate.kind);
1582
1568
  const wiring_implementationType = (consumer, implementation)=>consumer.branched ? external_node_path_default().basename(external_node_path_default().dirname(implementation.file)) : void 0;
1583
1569
  const isSuggestedFor = (candidate, implementation)=>'infrastructure' === candidate.layer && `-${external_node_path_default().basename(candidate.typeFile, '.ts')}-`.includes(`-${implementation}-`);
@@ -2827,40 +2813,31 @@ const scaffoldNewCommand = async (boundedContextFolder)=>{
2827
2813
  });
2828
2814
  const scaffoldUnitTests = Boolean(ConfigFile.Instance.data.testingLibrary);
2829
2815
  const naming = new UnknownFormatNaming(commandName);
2830
- const commandType = await (0, prompts_namespaceObject.select)({
2831
- choices: [
2832
- 'Execution (with infrastructure implementation)',
2833
- 'Orchestrator (no infrastructure implementation)'
2834
- ],
2835
- message: 'Command type'
2836
- });
2837
- const isOrchestrator = 'Orchestrator (no infrastructure implementation)' === commandType;
2838
2816
  const withWiring = ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire');
2839
- if (!isOrchestrator) {
2840
- const implementationType = await (0, prompts_namespaceObject.input)({
2841
- message: 'Command infrastructure implementation type:',
2842
- default: ConfigFile.Instance.data.defaultPersistenceLayerImplementation
2843
- });
2844
- let addTestImplementation = false;
2845
- let testImplementationType = '';
2846
- addTestImplementation = await (0, prompts_namespaceObject.confirm)({
2847
- message: 'Add a test implementation for Command'
2848
- });
2849
- if (addTestImplementation) testImplementationType = await (0, prompts_namespaceObject.input)({
2850
- message: 'Test Command infrastructure implementation type:',
2851
- default: 'in-memory'
2852
- });
2853
- const implementationTypes = [
2854
- implementationType,
2855
- testImplementationType
2856
- ].filter((x)=>!!x);
2857
- for (const implementation of implementationTypes){
2858
- const formatNaming = new UnknownFormatNaming(implementation);
2859
- const implementationFile = infrastructureFolder.subitem([
2860
- formatNaming.fileName
2861
- ]).createFile(`${formatNaming.fileName}-${naming.fileName}-command.ts`, ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/handlers') ? `
2817
+ const implementationType = await (0, prompts_namespaceObject.input)({
2818
+ message: 'Command infrastructure implementation type:',
2819
+ default: ConfigFile.Instance.data.defaultPersistenceLayerImplementation
2820
+ });
2821
+ let addTestImplementation = false;
2822
+ let testImplementationType = '';
2823
+ addTestImplementation = await (0, prompts_namespaceObject.confirm)({
2824
+ message: 'Add a test implementation for Command'
2825
+ });
2826
+ if (addTestImplementation) testImplementationType = await (0, prompts_namespaceObject.input)({
2827
+ message: 'Test Command infrastructure implementation type:',
2828
+ default: 'in-memory'
2829
+ });
2830
+ const implementationTypes = [
2831
+ implementationType,
2832
+ testImplementationType
2833
+ ].filter((x)=>!!x);
2834
+ for (const implementation of implementationTypes){
2835
+ const formatNaming = new UnknownFormatNaming(implementation);
2836
+ const implementationFile = infrastructureFolder.subitem([
2837
+ formatNaming.fileName
2838
+ ]).createFile(`${formatNaming.fileName}-${naming.fileName}-command.ts`, ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/handlers') ? `
2862
2839
  import { defineHandler } from '@domain-first/handlers'
2863
- import { ${naming.ClassName}Command } from '../../../application/commands/execution/${naming.fileName}-command'
2840
+ import { ${naming.ClassName}Command } from '../../../application/commands/${naming.fileName}-command'
2864
2841
 
2865
2842
  export class ${formatNaming.ClassName}${naming.ClassName}Command extends ${naming.ClassName}Command {
2866
2843
  constructor() {
@@ -2876,7 +2853,7 @@ export class ${formatNaming.ClassName}${naming.ClassName}Command extends ${namin
2876
2853
  })
2877
2854
  }
2878
2855
  `.trim() : `
2879
- import { ${naming.ClassName}Command } from '../../../application/commands/execution/${naming.fileName}-command'
2856
+ import { ${naming.ClassName}Command } from '../../../application/commands/${naming.fileName}-command'
2880
2857
 
2881
2858
  export class ${formatNaming.ClassName}${naming.ClassName}Command extends ${naming.ClassName}Command {
2882
2859
  constructor() {
@@ -2884,11 +2861,9 @@ export class ${formatNaming.ClassName}${naming.ClassName}Command extends ${namin
2884
2861
  }
2885
2862
  }
2886
2863
  `.trim());
2887
- if (!withWiring && usesInMemoryDb(implementation)) injectInMemoryDb(implementationFile, `${formatNaming.ClassName}${naming.ClassName}Command`);
2888
- }
2889
- if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/handlers')) commandsFolder.subitem([
2890
- 'execution'
2891
- ]).createFile(`${naming.fileName}-command.ts`, `
2864
+ if (!withWiring && usesInMemoryDb(implementation)) injectInMemoryDb(implementationFile, `${formatNaming.ClassName}${naming.ClassName}Command`);
2865
+ }
2866
+ if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/handlers')) commandsFolder.createFile(`${naming.fileName}-command.ts`, `
2892
2867
  import type { Handler } from '@domain-first/handlers'
2893
2868
 
2894
2869
  export abstract class ${naming.ClassName}Command {
@@ -2898,20 +2873,16 @@ export abstract class ${naming.ClassName}Command {
2898
2873
  abstract handle: Handler<typeof ${naming.ClassName}Command.inputSchema, typeof ${naming.ClassName}Command.outputSchema>
2899
2874
  }
2900
2875
  `.trim());
2901
- else commandsFolder.subitem([
2902
- 'execution'
2903
- ]).createFile(`${naming.fileName}-command.ts`, `
2876
+ else commandsFolder.createFile(`${naming.fileName}-command.ts`, `
2904
2877
  export abstract class ${naming.ClassName}Command {
2905
2878
 
2906
2879
  }`.trim());
2907
- if (scaffoldUnitTests) {
2908
- const implementationNaming = new UnknownFormatNaming(implementationType);
2909
- const specFile = commandsFolder.subitem([
2910
- 'execution'
2911
- ]).createFile(`${naming.fileName}-command.spec.ts`, `
2880
+ if (scaffoldUnitTests) {
2881
+ const implementationNaming = new UnknownFormatNaming(implementationType);
2882
+ const specFile = commandsFolder.createFile(`${naming.fileName}-command.spec.ts`, `
2912
2883
  import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
2913
2884
  ${withWiring ? `import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
2914
- 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'
2885
+ 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'
2915
2886
 
2916
2887
  type ${naming.ClassName}Command = ${implementationNaming.ClassName}${naming.ClassName}Command`}
2917
2888
 
@@ -2927,15 +2898,15 @@ describe('${naming.withSpaces} command', () => {
2927
2898
  })
2928
2899
  })
2929
2900
  `.trim());
2930
- if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Command`);
2931
- }
2932
- if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) {
2933
- const implementationNaming = new UnknownFormatNaming(implementationType);
2934
- const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
2935
- const wireFile = boundedContextFolder.subitem([
2936
- 'wiring',
2937
- 'commands'
2938
- ]).createFile(`wire-${naming.fileName}-command.ts`, `
2901
+ if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Command`);
2902
+ }
2903
+ if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) {
2904
+ const implementationNaming = new UnknownFormatNaming(implementationType);
2905
+ const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
2906
+ const wireFile = boundedContextFolder.subitem([
2907
+ 'wiring',
2908
+ 'commands'
2909
+ ]).createFile(`wire-${naming.fileName}-command.ts`, `
2939
2910
  import { wireClass } from '@domain-first/wire'
2940
2911
  import { envBranchedWire } from '../../../../shared/wiring/env-branched-wire'
2941
2912
  ${implementationTypes.map((x)=>new UnknownFormatNaming(x)).map(({ ClassName, fileName })=>`import { ${ClassName}${naming.ClassName}Command } from '../../infrastructure/commands/${fileName}/${fileName}-${naming.fileName}-command'`).join('\n')}
@@ -2948,68 +2919,8 @@ export const wire${naming.ClassName}Command = envBranchedWire({
2948
2919
  production: wire${implementationNaming.ClassName}Implementation
2949
2920
  })
2950
2921
  `.trim());
2951
- await wireNewModuleDependencies(boundedContextFolder, wireFile);
2952
- }
2953
- return;
2922
+ await wireNewModuleDependencies(boundedContextFolder, wireFile);
2954
2923
  }
2955
- if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/handlers')) commandsFolder.subitem([
2956
- 'orchestration'
2957
- ]).createFile(`${naming.fileName}-command.ts`, `
2958
- import { defineHandler } from '@domain-first/handlers'
2959
-
2960
- export class ${naming.ClassName}Command {
2961
- constructor() {}
2962
-
2963
- static inputSchema = {}
2964
- static outputSchema = {}
2965
-
2966
- handle = defineHandler({
2967
- inputSchema: ${naming.ClassName}Command.inputSchema,
2968
- outputSchema: ${naming.ClassName}Command.outputSchema,
2969
- handler: async (payload) => {
2970
- return {}
2971
- }
2972
- })
2973
- }
2974
- `.trim());
2975
- else commandsFolder.subitem([
2976
- 'orchestration'
2977
- ]).createFile(`${naming.fileName}-command.ts`, `
2978
- export class ${naming.ClassName}Command {
2979
- constructor() {}
2980
- }`.trim());
2981
- if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) boundedContextFolder.subitem([
2982
- 'wiring',
2983
- 'commands'
2984
- ]).createFile(`wire-${naming.fileName}-command.ts`, `
2985
- import { wireClass } from '@domain-first/wire'
2986
- import { ${naming.ClassName}Command } from '../../application/commands/orchestration/${naming.fileName}-command'
2987
-
2988
- export const wire${naming.ClassName}Command = wireClass(${naming.ClassName}Command, [])
2989
- `.trim());
2990
- if (scaffoldUnitTests) commandsFolder.subitem([
2991
- 'orchestration'
2992
- ]).createFile(`${naming.fileName}-command.spec.ts`, `
2993
- import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
2994
- ${withWiring ? `import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
2995
- import { wire${naming.ClassName}Command } from '../../../wiring/commands/wire-${naming.fileName}-command'` : `import { ${naming.ClassName}Command } from './${naming.fileName}-command'`}
2996
-
2997
- let ${naming.variableName}Command: ${naming.ClassName}Command
2998
-
2999
- beforeEach(() => {
3000
- ${naming.variableName}Command = ${withWiring ? `wire${naming.ClassName}Command()` : `new ${naming.ClassName}Command()`}
3001
- })
3002
-
3003
- describe('${naming.withSpaces} command', () => {
3004
- test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
3005
- expect(${naming.variableName}Command).toBeDefined()
3006
- })
3007
- })
3008
- `.trim());
3009
- if (withWiring) await wireNewModuleDependencies(boundedContextFolder, boundedContextFolder.subitem([
3010
- 'wiring',
3011
- 'commands'
3012
- ]).file(`wire-${naming.fileName}-command.ts`));
3013
2924
  };
3014
2925
  const noAggregate = 'No aggregate';
3015
2926
  const scaffoldNewDomainObject = async (boundedContextFolder, kind)=>{
@@ -3354,42 +3265,33 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
3354
3265
  const queryName = await (0, prompts_namespaceObject.input)({
3355
3266
  message: 'Name: '
3356
3267
  });
3357
- const naming = new UnknownFormatNaming(queryName);
3358
3268
  const scaffoldUnitTests = Boolean(ConfigFile.Instance.data.testingLibrary);
3359
- const queryType = await (0, prompts_namespaceObject.select)({
3360
- choices: [
3361
- 'Execution (with infrastructure implementation)',
3362
- 'Orchestrator (no infrastructure implementation)'
3363
- ],
3364
- message: 'Query type'
3365
- });
3366
- const isOrchestrator = 'Orchestrator (no infrastructure implementation)' === queryType;
3269
+ const naming = new UnknownFormatNaming(queryName);
3367
3270
  const withWiring = ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire');
3368
- if (!isOrchestrator) {
3369
- const implementationType = await (0, prompts_namespaceObject.input)({
3370
- message: 'Query infrastructure implementation type:',
3371
- default: ConfigFile.Instance.data.defaultPersistenceLayerImplementation
3372
- });
3373
- let addTestImplementation = false;
3374
- let testImplementationType = '';
3375
- addTestImplementation = await (0, prompts_namespaceObject.confirm)({
3376
- message: 'Add a test implementation for Query'
3377
- });
3378
- if (addTestImplementation) testImplementationType = await (0, prompts_namespaceObject.input)({
3379
- message: 'Test Query infrastructure implementation type:',
3380
- default: 'in-memory'
3381
- });
3382
- const implementationTypes = [
3383
- implementationType,
3384
- testImplementationType
3385
- ].filter((x)=>!!x);
3386
- for (const implementation of implementationTypes){
3387
- const formatNaming = new UnknownFormatNaming(implementation);
3388
- const implementationFile = infrastructureFolder.subitem([
3389
- formatNaming.fileName
3390
- ]).createFile(`${formatNaming.fileName}-${naming.fileName}-query.ts`, ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/handlers') ? `
3271
+ const implementationType = await (0, prompts_namespaceObject.input)({
3272
+ message: 'Query infrastructure implementation type:',
3273
+ default: ConfigFile.Instance.data.defaultPersistenceLayerImplementation
3274
+ });
3275
+ let addTestImplementation = false;
3276
+ let testImplementationType = '';
3277
+ addTestImplementation = await (0, prompts_namespaceObject.confirm)({
3278
+ message: 'Add a test implementation for Query'
3279
+ });
3280
+ if (addTestImplementation) testImplementationType = await (0, prompts_namespaceObject.input)({
3281
+ message: 'Test Query infrastructure implementation type:',
3282
+ default: 'in-memory'
3283
+ });
3284
+ const implementationTypes = [
3285
+ implementationType,
3286
+ testImplementationType
3287
+ ].filter((x)=>!!x);
3288
+ for (const implementation of implementationTypes){
3289
+ const formatNaming = new UnknownFormatNaming(implementation);
3290
+ const implementationFile = infrastructureFolder.subitem([
3291
+ formatNaming.fileName
3292
+ ]).createFile(`${formatNaming.fileName}-${naming.fileName}-query.ts`, ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/handlers') ? `
3391
3293
  import { defineHandler } from '@domain-first/handlers'
3392
- import { ${naming.ClassName}Query } from '../../../application/queries/execution/${naming.fileName}-query'
3294
+ import { ${naming.ClassName}Query } from '../../../application/queries/${naming.fileName}-query'
3393
3295
 
3394
3296
  export class ${formatNaming.ClassName}${naming.ClassName}Query extends ${naming.ClassName}Query {
3395
3297
  constructor() {
@@ -3405,7 +3307,7 @@ export class ${formatNaming.ClassName}${naming.ClassName}Query extends ${naming.
3405
3307
  })
3406
3308
  }
3407
3309
  `.trim() : `
3408
- import { ${naming.ClassName}Query } from '../../../application/queries/execution/${naming.fileName}-query'
3310
+ import { ${naming.ClassName}Query } from '../../../application/queries/${naming.fileName}-query'
3409
3311
 
3410
3312
  export class ${formatNaming.ClassName}${naming.ClassName}Query extends ${naming.ClassName}Query {
3411
3313
  constructor() {
@@ -3413,11 +3315,9 @@ export class ${formatNaming.ClassName}${naming.ClassName}Query extends ${naming.
3413
3315
  }
3414
3316
  }
3415
3317
  `.trim());
3416
- if (!withWiring && usesInMemoryDb(implementation)) injectInMemoryDb(implementationFile, `${formatNaming.ClassName}${naming.ClassName}Query`);
3417
- }
3418
- if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/handlers')) queriesFolder.subitem([
3419
- 'execution'
3420
- ]).createFile(`${naming.fileName}-query.ts`, `
3318
+ if (!withWiring && usesInMemoryDb(implementation)) injectInMemoryDb(implementationFile, `${formatNaming.ClassName}${naming.ClassName}Query`);
3319
+ }
3320
+ if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/handlers')) queriesFolder.createFile(`${naming.fileName}-query.ts`, `
3421
3321
  import type { Handler } from '@domain-first/handlers'
3422
3322
 
3423
3323
  export abstract class ${naming.ClassName}Query {
@@ -3427,20 +3327,16 @@ export abstract class ${naming.ClassName}Query {
3427
3327
  abstract handle: Handler<typeof ${naming.ClassName}Query.inputSchema, typeof ${naming.ClassName}Query.outputSchema>
3428
3328
  }
3429
3329
  `.trim());
3430
- else queriesFolder.subitem([
3431
- 'execution'
3432
- ]).createFile(`${naming.fileName}-query.ts`, `
3330
+ else queriesFolder.createFile(`${naming.fileName}-query.ts`, `
3433
3331
  export abstract class ${naming.ClassName}Query {
3434
3332
 
3435
3333
  }`.trim());
3436
- if (scaffoldUnitTests) {
3437
- const implementationNaming = new UnknownFormatNaming(implementationType);
3438
- const specFile = queriesFolder.subitem([
3439
- 'execution'
3440
- ]).createFile(`${naming.fileName}-query.spec.ts`, `
3334
+ if (scaffoldUnitTests) {
3335
+ const implementationNaming = new UnknownFormatNaming(implementationType);
3336
+ const specFile = queriesFolder.createFile(`${naming.fileName}-query.spec.ts`, `
3441
3337
  import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
3442
3338
  ${withWiring ? `import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
3443
- 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'
3339
+ 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'
3444
3340
 
3445
3341
  type ${naming.ClassName}Query = ${implementationNaming.ClassName}${naming.ClassName}Query`}
3446
3342
 
@@ -3456,15 +3352,15 @@ describe('${naming.withSpaces} query', () => {
3456
3352
  })
3457
3353
  })
3458
3354
  `.trim());
3459
- if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Query`);
3460
- }
3461
- if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) {
3462
- const implementationNaming = new UnknownFormatNaming(implementationType);
3463
- const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
3464
- const wireFile = boundedContextFolder.subitem([
3465
- 'wiring',
3466
- 'queries'
3467
- ]).createFile(`wire-${naming.fileName}-query.ts`, `
3355
+ if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Query`);
3356
+ }
3357
+ if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) {
3358
+ const implementationNaming = new UnknownFormatNaming(implementationType);
3359
+ const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
3360
+ const wireFile = boundedContextFolder.subitem([
3361
+ 'wiring',
3362
+ 'queries'
3363
+ ]).createFile(`wire-${naming.fileName}-query.ts`, `
3468
3364
  import { wireClass } from '@domain-first/wire'
3469
3365
  import { envBranchedWire } from '../../../../shared/wiring/env-branched-wire'
3470
3366
  ${implementationTypes.map((x)=>new UnknownFormatNaming(x)).map(({ ClassName, fileName })=>`import { ${ClassName}${naming.ClassName}Query } from '../../infrastructure/queries/${fileName}/${fileName}-${naming.fileName}-query'`).join('\n')}
@@ -3477,68 +3373,8 @@ export const wire${naming.ClassName}Query = envBranchedWire({
3477
3373
  production: wire${implementationNaming.ClassName}Implementation
3478
3374
  })
3479
3375
  `.trim());
3480
- await wireNewModuleDependencies(boundedContextFolder, wireFile);
3481
- }
3482
- return;
3376
+ await wireNewModuleDependencies(boundedContextFolder, wireFile);
3483
3377
  }
3484
- if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/handlers')) queriesFolder.subitem([
3485
- 'orchestration'
3486
- ]).createFile(`${naming.fileName}-query.ts`, `
3487
- import { defineHandler } from '@domain-first/handlers'
3488
-
3489
- export class ${naming.ClassName}Query {
3490
- constructor() {}
3491
-
3492
- static inputSchema = {}
3493
- static outputSchema = {}
3494
-
3495
- handle = defineHandler({
3496
- inputSchema: ${naming.ClassName}Query.inputSchema,
3497
- outputSchema: ${naming.ClassName}Query.outputSchema,
3498
- handler: async (payload) => {
3499
- return {}
3500
- }
3501
- })
3502
- }
3503
- `.trim());
3504
- else queriesFolder.subitem([
3505
- 'orchestration'
3506
- ]).createFile(`${naming.fileName}-query.ts`, `
3507
- export class ${naming.ClassName}Query {
3508
- constructor() {}
3509
- }`.trim());
3510
- if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) boundedContextFolder.subitem([
3511
- 'wiring',
3512
- 'queries'
3513
- ]).createFile(`wire-${naming.fileName}-query.ts`, `
3514
- import { wireClass } from '@domain-first/wire'
3515
- import { ${naming.ClassName}Query } from '../../application/queries/orchestration/${naming.fileName}-query'
3516
-
3517
- export const wire${naming.ClassName}Query = wireClass(${naming.ClassName}Query, [])
3518
- `.trim());
3519
- if (scaffoldUnitTests) queriesFolder.subitem([
3520
- 'orchestration'
3521
- ]).createFile(`${naming.fileName}-query.spec.ts`, `
3522
- import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
3523
- ${withWiring ? `import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
3524
- import { wire${naming.ClassName}Query } from '../../../wiring/queries/wire-${naming.fileName}-query'` : `import { ${naming.ClassName}Query } from './${naming.fileName}-query'`}
3525
-
3526
- let ${naming.variableName}Query: ${naming.ClassName}Query
3527
-
3528
- beforeEach(() => {
3529
- ${naming.variableName}Query = ${withWiring ? `wire${naming.ClassName}Query()` : `new ${naming.ClassName}Query()`}
3530
- })
3531
-
3532
- describe('${naming.withSpaces} query', () => {
3533
- test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
3534
- expect(${naming.variableName}Query).toBeDefined()
3535
- })
3536
- })
3537
- `.trim());
3538
- if (withWiring) await wireNewModuleDependencies(boundedContextFolder, boundedContextFolder.subitem([
3539
- 'wiring',
3540
- 'queries'
3541
- ]).file(`wire-${naming.fileName}-query.ts`));
3542
3378
  };
3543
3379
  const scaffoldNewUseCase = async (boundedContextFolder)=>{
3544
3380
  const useCasesFolder = boundedContextFolder.subitem([