@domain-first/project-structure 8.5.1 → 8.6.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/README.md CHANGED
@@ -239,7 +239,7 @@ With `@domain-first/handlers-rest`, choose **Presentation → New Handlers-REST
239
239
  src/bounded-contexts/sales/presentation/rest/orders/recent/GET.ts // GET /sales/orders/recent
240
240
  ```
241
241
 
242
- For the context itself, pick **No controller (context root)**: context `social-networks`, an empty path and `get` give `GET /social-networks` in `src/bounded-contexts/social-networks/presentation/rest/GET.ts` (`SocialNetworksGetEndpoint`); path `:id` gives `GET /social-networks/:id`.
242
+ For the context itself, pick the context-root controller **(root) — /social-networks**. It lives in `presentation/rest/(root)/`, a folder that is not part of the route: an empty path and `get` give `GET /social-networks` in `src/bounded-contexts/social-networks/presentation/rest/(root)/GET.ts` (`SocialNetworksGetEndpoint`), path `:id` gives `GET /social-networks/:id`, and path `from-scratch` with `post` gives `POST /social-networks/from-scratch`. A route belongs to one controller, so `(root)/from-scratch` and a controller `from-scratch` exclude each other. Projects with context-root endpoints of 8.5 move them with `npx df-upgrade`.
243
243
 
244
244
  Every endpoint uses the one endpoint generator of the project, `RestEndpointGeneratorPresentationService` in `src/shared-kernel/presentation/services/`. Initialization scaffolds it as a regular Shared Kernel presentation service (class, spec and wire):
245
245
 
package/dist/287.js CHANGED
@@ -3,9 +3,9 @@ import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import { Separator, checkbox as prompts_checkbox, confirm as prompts_confirm, input, search, select as prompts_select } from "@inquirer/prompts";
4
4
  import { styleText } from "node:util";
5
5
  import node_fs from "node:fs";
6
- import { addImport, availableDependencies, compilerOption, findWiredModules, UnknownFormatNaming, readWiredModule, stripJsonComments, addClassMember, hasNeighboringBoundedContext, addBranchedImplementation, addWireDependencies, boundedContextLocation, addConstructorParameters, relativeImport, wireBranches, wireDependencies, implementationType as wiring_implementationType, crossContextImportAllowed, crossContextImplementation, isSuggestedFor } from "./201.js";
7
- import { implementationLabelSchema, withoutOverwrites, domainFirstPackages as config_file_domainFirstPackages, scaffoldBackendRules, branchNameSchema, discardPendingChanges, ConfigFile, filesToOverwrite, Folder, writePendingChanges, File, ProjectRoot } from "./870.js";
8
- import { missingPackages, hasDependency, missingDomainFirstPackages } from "./711.js";
6
+ import { addImport, availableDependencies, findWiredModules, UnknownFormatNaming, readWiredModule, addClassMember, hasNeighboringBoundedContext, addBranchedImplementation, addWireDependencies, boundedContextLocation, addConstructorParameters, relativeImport, wireBranches, wireDependencies, implementationType as wiring_implementationType, crossContextImportAllowed, crossContextImplementation, isSuggestedFor } from "./947.js";
7
+ import { implementationLabelSchema, withoutOverwrites, domainFirstPackages as config_file_domainFirstPackages, scaffoldBackendRules, branchNameSchema, discardPendingChanges, ConfigFile, filesToOverwrite, Folder, writePendingChanges, File, ProjectRoot, compilerOption } from "./780.js";
8
+ import { missingDomainFirstPackages, walk, projectImports, escapeRegExp, pathParameterAsName, hasLegacyRootEndpoints, stageModuleMove, toPosix, rootStaticSegments, openapiExtractorPath, restControllers, hasDependency, openapiExtractor, missingPackages, codeExtension, isPathParameterName } from "./526.js";
9
9
  const moduleId = (module)=>`${boundedContextLocation(module.typeFile)?.name ?? 'shared-kernel'}:${module.typeName}`;
10
10
  const unitId = (unit)=>`${unit.kind}:${unit.aggregate ? `${unit.aggregate}/` : ''}${unit.name}`;
11
11
  const inMemoryImplementationType = 'in-memory';
@@ -480,164 +480,6 @@ const scaffoldReactPage = async (presentationReactFolder)=>{
480
480
  ]).createFile(`${fileName}-page.tsx`, reactPageContent(ClassName));
481
481
  if (usesNext()) scaffoldNextRoute(nestedName, pageFile);
482
482
  };
483
- const openapiExtractorPath = "scripts/extract-open-api-data-from-endpoint.ts";
484
- const rootFolderSegments = (rootFolder)=>rootFolder.split(/[\\/]/).map((segment)=>segment.trim()).filter((segment)=>!!segment && '.' !== segment).map((segment)=>`'${segment}',\n `).join('');
485
- const openapiExtractor = (rootFolder)=>`import path from 'node:path';
486
- import {
487
- type DocNode,
488
- DocPlainText,
489
- TSDocConfiguration,
490
- TSDocParser,
491
- TSDocTagDefinition,
492
- TSDocTagSyntaxKind
493
- } from '@microsoft/tsdoc';
494
- import { Node, Project, type SourceFile, SyntaxKind } from 'ts-morph';
495
-
496
- type BlockTag = \`@\${string}\`;
497
-
498
- type OpenApiDataTags = {
499
- /** Omit to take the summary from the comment text before the first tag. */
500
- summary?: BlockTag;
501
- description?: BlockTag;
502
- };
503
-
504
- type OpenApiData = Partial<{
505
- summary: string;
506
- description: string;
507
- operationId: string;
508
- }>;
509
-
510
- const project = new Project({
511
- tsConfigFilePath: 'tsconfig.json'
512
- });
513
-
514
- const getText = (node: DocNode): string =>
515
- node
516
- .getChildNodes()
517
- .map((child) => {
518
- if (child instanceof DocPlainText) {
519
- return child.text;
520
- }
521
-
522
- return getText(child);
523
- })
524
- .join('');
525
-
526
- const getRawCommentText = (comment: string): string =>
527
- comment
528
- .replace(/^\\/\\*\\*/, '')
529
- .replace(/\\*\\/$/, '')
530
- .split(/\\r?\\n/)
531
- .map((line) => line.replace(/^\\s*\\*\\s?/, ''))
532
- .join('\\n');
533
-
534
- // TSDoc treats an unknown tag as summary content, so every block tag of the
535
- // comment has to be registered for the summary section to end before it.
536
- const parseSummary = (comment: string): string | undefined => {
537
- const configuration = new TSDocConfiguration();
538
- const tagNames = getRawCommentText(comment).matchAll(/(?:^|\\n)\\s*(@\\w+)/g);
539
-
540
- for (const [, tagName] of tagNames) {
541
- if (!configuration.tryGetTagDefinition(tagName)) {
542
- configuration.addTagDefinition(
543
- new TSDocTagDefinition({
544
- tagName,
545
- syntaxKind: TSDocTagSyntaxKind.BlockTag
546
- })
547
- );
548
- }
549
- }
550
-
551
- const { docComment } = new TSDocParser(configuration).parseString(comment);
552
-
553
- return getText(docComment.summarySection).trim() || undefined;
554
- };
555
-
556
- // Parsed by hand rather than through TSDoc, which drops the line breaks.
557
- const getTagText = (comment: string, tag: BlockTag): string | undefined => {
558
- const tagMatch = getRawCommentText(comment).match(
559
- new RegExp(
560
- \`(?:^|\\\\n)\\\\s*\${tag}(?:[ \\\\t]*\\\\n|[ \\\\t]+)([\\\\s\\\\S]*?)(?=\\\\n\\\\s*@\\\\w+|\\\\s*$)\`
561
- )
562
- );
563
-
564
- return tagMatch?.[1].trim() || undefined;
565
- };
566
-
567
- // Endpoints pass their logic as the generator's first argument
568
- // (\`this.endpointGenerator(this.handler.handle, ...)\`), while other injected
569
- // queries only serve as helpers, e.g. guest checks.
570
- const findHandlerClass = (endpointFile: SourceFile) =>
571
- endpointFile
572
- .getDescendantsOfKind(SyntaxKind.CallExpression)
573
- .map((call) => call.getArguments()[0])
574
- .filter(Node.isPropertyAccessExpression)
575
- .find((argument) => argument.getName() === 'handle')
576
- ?.getExpression()
577
- .getType()
578
- .getSymbol()
579
- ?.getDeclarations()
580
- .find(Node.isClassDeclaration);
581
-
582
- // Path parameters (\`:id\`) can't be part of file and folder names
583
- // everywhere (Windows), so endpoints name them \`_id_\` there.
584
- const pathParameterAsName = (segment: string) =>
585
- segment.startsWith(':') ? \`_\${segment.slice(1)}_\` : segment;
586
-
587
- export const createOpenApiDataFromEndpointLogicExtractor = ({
588
- summary: summaryTag,
589
- description: descriptionTag = '@description'
590
- }: OpenApiDataTags = {}) => {
591
- return (routeMetadata: {
592
- method: string;
593
- path: readonly string[];
594
- }): OpenApiData | undefined => {
595
- try {
596
- // The controller, if any, is the first folder of the path:
597
- // context-root endpoints live right in presentation/rest.
598
- const [currentBoundedContext, ...relativePath] = routeMetadata.path;
599
-
600
- if (!currentBoundedContext) {
601
- return undefined;
602
- }
603
-
604
- const endpointFile = project.getSourceFile(
605
- path.join(
606
- ${rootFolderSegments(rootFolder)}'bounded-contexts',
607
- currentBoundedContext,
608
- 'presentation',
609
- 'rest',
610
- ...relativePath.map(pathParameterAsName),
611
- \`\${routeMetadata.method.toUpperCase()}.ts\`
612
- )
613
- );
614
-
615
- if (!endpointFile) {
616
- return undefined;
617
- }
618
-
619
- const declaration = findHandlerClass(endpointFile);
620
- const operationId = declaration?.getName();
621
- const comment = declaration?.getJsDocs().at(-1)?.getText();
622
-
623
- if (!comment) {
624
- return { operationId };
625
- }
626
-
627
- return {
628
- summary: summaryTag
629
- ? getTagText(comment, summaryTag)
630
- : parseSummary(comment),
631
- description: getTagText(comment, descriptionTag),
632
- operationId
633
- };
634
- } catch (e: unknown) {
635
- console.error(e);
636
- return undefined;
637
- }
638
- };
639
- };
640
- `;
641
483
  const addPackageScripts = async (file, additions)=>{
642
484
  const original = file.data;
643
485
  const manifest = JSON.parse(original);
@@ -2182,147 +2024,6 @@ const integrationDescriptions = ()=>integrations.map((integration)=>({
2182
2024
  group: integration.group,
2183
2025
  available: ('backend' !== integration.group || Boolean(ConfigFile.Instance.data.backend)) && (integration.available?.() ?? true)
2184
2026
  }));
2185
- const ignoredFolders = new Set([
2186
- 'node_modules',
2187
- '.git',
2188
- '.next',
2189
- 'dist',
2190
- 'build',
2191
- 'out',
2192
- 'coverage',
2193
- 'storybook-static'
2194
- ]);
2195
- const codeExtension = /\.(?:tsx?|mts|cts|jsx?|mjs|cjs|mdx)$/;
2196
- const escapeRegExp = (value)=>value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
2197
- const walk = (folder)=>{
2198
- if (!node_fs.existsSync(folder)) return [];
2199
- return node_fs.readdirSync(folder, {
2200
- withFileTypes: true
2201
- }).flatMap((entry)=>{
2202
- const entryPath = node_path.join(folder, entry.name);
2203
- if (entry.isDirectory()) return ignoredFolders.has(entry.name) ? [] : walk(entryPath);
2204
- return entry.isFile() ? [
2205
- entryPath
2206
- ] : [];
2207
- });
2208
- };
2209
- const toPosix = (value)=>value.split(node_path.sep).join('/');
2210
- const readAliases = (projectRoot)=>{
2211
- const tsconfig = node_path.join(projectRoot, 'tsconfig.json');
2212
- if (!node_fs.existsSync(tsconfig)) return [];
2213
- try {
2214
- const { compilerOptions = {} } = JSON.parse(stripJsonComments(node_fs.readFileSync(tsconfig, 'utf8')));
2215
- const base = node_path.resolve(projectRoot, compilerOptions.baseUrl ?? '.');
2216
- return Object.entries(compilerOptions.paths ?? {}).filter(([pattern, targets])=>pattern.endsWith('*') && targets[0]?.endsWith('*')).map(([pattern, [target]])=>({
2217
- prefix: pattern.slice(0, -1),
2218
- target: node_path.resolve(base, target.slice(0, -1))
2219
- }));
2220
- } catch {
2221
- return [];
2222
- }
2223
- };
2224
- const specifierPattern = /(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+|\brequire\s*\(\s*|\bmock\s*\(\s*)(['"])([^'"\n]+)\2/g;
2225
- const reExportPattern = /\bexport\s+(?:type\s+)?(?:\*(?:\s+as\s+[\w$]+)?|\{[^}]*\})\s*from\s*(['"])([^'"\n]+)\1/g;
2226
- const importPaths = (file)=>{
2227
- const withoutExtension = file.replace(codeExtension, '');
2228
- return 'index' === node_path.basename(withoutExtension) ? [
2229
- withoutExtension,
2230
- node_path.dirname(withoutExtension)
2231
- ] : [
2232
- withoutExtension
2233
- ];
2234
- };
2235
- const projectImports = (projectRoot)=>{
2236
- const aliases = readAliases(projectRoot);
2237
- const resolve = (specifier, fromFile)=>{
2238
- if (specifier.startsWith('.')) return {
2239
- resolved: node_path.resolve(node_path.dirname(fromFile), specifier),
2240
- alias: void 0
2241
- };
2242
- const alias = aliases.find(({ prefix })=>specifier.startsWith(prefix));
2243
- return alias ? {
2244
- resolved: node_path.resolve(alias.target, specifier.slice(alias.prefix.length)),
2245
- alias
2246
- } : void 0;
2247
- };
2248
- const specifierFor = (fromFile, toPath, alias)=>{
2249
- const aliased = alias && toPosix(node_path.relative(alias.target, toPath));
2250
- if (aliased && !aliased.startsWith('..')) return `${alias.prefix}${aliased}`;
2251
- const relative = toPosix(node_path.relative(node_path.dirname(fromFile), toPath));
2252
- return relative.startsWith('.') ? relative : `./${relative}`;
2253
- };
2254
- const codeFiles = new Map(walk(projectRoot).filter((file)=>codeExtension.test(file)).map((file)=>[
2255
- file,
2256
- node_fs.readFileSync(file, 'utf8')
2257
- ]));
2258
- const importsOf = (file)=>[
2259
- ...(codeFiles.get(file) ?? '').matchAll(specifierPattern)
2260
- ].map(([, , , specifier])=>resolve(specifier, file)?.resolved).filter((resolved)=>!!resolved);
2261
- return {
2262
- resolve,
2263
- specifierFor,
2264
- codeFiles,
2265
- importsOf
2266
- };
2267
- };
2268
- const stageModuleMove = ({ projectRoot, stopAt, moves, movedPath, rename, everyFile = (content)=>content, stopAtFor })=>{
2269
- const stopFor = (file)=>stopAtFor?.(file) ?? stopAt;
2270
- const { resolve, specifierFor, codeFiles } = projectImports(projectRoot);
2271
- const barrels = new Set();
2272
- const isBarrel = (resolved)=>barrels.has(resolved.replace(codeExtension, ''));
2273
- for(let found = true; found;){
2274
- found = false;
2275
- for (const [file, content] of codeFiles){
2276
- if (moves.has(file) || isBarrel(file)) continue;
2277
- const reExportsModule = [
2278
- ...content.matchAll(reExportPattern)
2279
- ].some(([, , specifier])=>{
2280
- const resolution = resolve(specifier, file);
2281
- return !!resolution && (!!movedPath(resolution.resolved) || isBarrel(resolution.resolved));
2282
- });
2283
- if (reExportsModule) {
2284
- for (const importPath of importPaths(file))barrels.add(importPath);
2285
- found = true;
2286
- }
2287
- }
2288
- }
2289
- const rewrite = (content, oldFile, newFile)=>{
2290
- let referencesModule = false;
2291
- const rewritten = content.replace(specifierPattern, (match, keyword, quote, specifier)=>{
2292
- const resolution = resolve(specifier, oldFile);
2293
- if (!resolution) return match;
2294
- const moved = movedPath(resolution.resolved);
2295
- if (moved || isBarrel(resolution.resolved)) referencesModule = true;
2296
- if (!moved && oldFile === newFile) return match;
2297
- const next = specifierFor(newFile, moved ?? resolution.resolved, resolution.alias);
2298
- return `${keyword}${quote}${next}${quote}`;
2299
- });
2300
- const changed = everyFile(rewritten);
2301
- if (!referencesModule && !moves.has(oldFile)) return changed;
2302
- return rename(changed, {
2303
- moved: moves.has(oldFile)
2304
- });
2305
- };
2306
- for (const [file, newFile] of moves)if (!codeFiles.has(file) && newFile !== file) new File(file).moveTo(newFile, stopFor(file));
2307
- const updated = [];
2308
- for (const [file, content] of codeFiles){
2309
- const newFile = moves.get(file);
2310
- const next = rewrite(content, file, newFile ?? file);
2311
- if (newFile && newFile !== file) {
2312
- new File(newFile).data = next;
2313
- new File(file).delete(stopFor(file));
2314
- } else if (next !== content) {
2315
- new File(file).update(next);
2316
- if (!newFile) updated.push(file);
2317
- }
2318
- }
2319
- return {
2320
- moves: [
2321
- ...moves
2322
- ].filter(([from, to])=>from !== to),
2323
- updated
2324
- };
2325
- };
2326
2027
  const serviceLayout = (layer)=>({
2327
2028
  title: `${layer[0].toUpperCase()}${layer.slice(1)} services`,
2328
2029
  core: (ClassName)=>`${ClassName}${layer[0].toUpperCase()}${layer.slice(1)}Service`,
@@ -4269,45 +3970,48 @@ export const ${names.namespace(ClassName)} = errorNamespace('${boundedContextFol
4269
3970
  namespaceFile.addLineIfMissing(errorClass(names.error(`${namespaceNaming.ClassName}${ClassName}`), exportedNamespace(namespaceFile, names.namespace(namespaceNaming.ClassName)), fileName), '\n\n');
4270
3971
  };
4271
3972
  const newController = 'New controller';
4272
- const withoutController = 'No controller (context root)';
4273
- const pathParameterAsName = (segment)=>segment.startsWith(':') ? `_${segment.slice(1)}_` : segment;
4274
- const isPathParameterName = (name)=>name.startsWith(':') || /^_.+_$/.test(name);
3973
+ const rootControllerChoice = 'No controller (context root)';
4275
3974
  const sharedRestFolder = (boundedContextFolder)=>boundedContextFolder.subitem([
4276
3975
  '..',
4277
3976
  '..',
4278
3977
  'presentation',
4279
3978
  'rest'
4280
3979
  ]);
3980
+ const legacyRootEndpointsMessage = (context)=>`${context} keeps its context-root endpoints in the 8.5 layout (presentation/rest/<METHOD>.ts, _param_/). Run npx df-upgrade to move them to presentation/rest/(root)/ first.`;
4281
3981
  const scaffoldNewHandlersRestEndpoint = async (boundedContextFolder)=>{
3982
+ const context = boundedContextFolder.name;
4282
3983
  const restPresentationFolder = boundedContextFolder.subitem([
4283
3984
  'presentation',
4284
3985
  'rest'
4285
3986
  ]);
4286
- const controllers = restPresentationFolder.content.subfolderNames.filter((x)=>!isPathParameterName(x));
3987
+ const controllers = restControllers(boundedContextFolder.path);
3988
+ const rootSegments = rootStaticSegments(boundedContextFolder.path);
4287
3989
  let controllerChoice = await interaction_select({
4288
3990
  key: 'controllerSelection',
4289
3991
  message: 'Controller: ',
4290
3992
  choices: [
3993
+ {
3994
+ value: rootControllerChoice,
3995
+ name: `(root) — /${context}`
3996
+ },
4291
3997
  ...controllers,
4292
- newController,
4293
- withoutController
3998
+ newController
4294
3999
  ]
4295
4000
  });
4001
+ if (controllerChoice === rootControllerChoice && hasLegacyRootEndpoints(boundedContextFolder.path)) throw new RequestError('UPGRADE_REQUIRED', legacyRootEndpointsMessage(context));
4296
4002
  if (controllerChoice === newController) controllerChoice = await interaction_input({
4297
4003
  key: 'controllerName',
4298
4004
  message: 'Name: ',
4299
- validate: (value)=>value.trim() ? isPathParameterName(value) || value.includes('/') ? 'A controller is one static path segment' : true : `Name is required; pick "${withoutController}" for an endpoint at the context root`
4005
+ validate: (value)=>{
4006
+ if (!value.trim()) return 'Name is required; pick "(root)" for an endpoint at the context root';
4007
+ if (isPathParameterName(value) || value.includes('/') || /[()]/.test(value)) return 'A controller is one static path segment';
4008
+ if (value === context) return `"${value}" is the context itself: pick "(root)" for /${context}`;
4009
+ if (rootSegments.includes(value)) return `/${context}/${value} belongs to the context root ((root)/${value}): add the endpoint there`;
4010
+ return true;
4011
+ }
4300
4012
  });
4301
- const controller = controllerChoice === withoutController ? void 0 : controllerChoice;
4013
+ const controller = controllerChoice === rootControllerChoice ? void 0 : controllerChoice;
4302
4014
  const withWiring = ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
4303
- if (controller && !controllers.includes(controller) && withWiring) {
4304
- boundedContextFolder.subitem([
4305
- 'wiring',
4306
- 'presentation',
4307
- 'rest'
4308
- ]).file('index.ts').addLine(`export * from './${controller}'`);
4309
- sharedRestFolder(boundedContextFolder).file('wires.ts').addLine(`export * from '../../bounded-contexts/${boundedContextFolder.name}/wiring/presentation/rest/${controller}'`);
4310
- }
4311
4015
  const method = await interaction_select({
4312
4016
  key: 'method',
4313
4017
  message: 'Method:',
@@ -4324,10 +4028,16 @@ const scaffoldNewHandlersRestEndpoint = async (boundedContextFolder)=>{
4324
4028
  message: 'Relative path (split by "/"):',
4325
4029
  validate: (value)=>{
4326
4030
  const [first] = value.split('/').filter((x)=>!!x);
4327
- return controller || !first || first.startsWith(':') ? true : `Without a controller, the path is empty or starts with a path parameter; "${first}" is a controller`;
4031
+ return controller || !first || first.startsWith(':') || !controllers.includes(first) ? true : `/${context}/${first} belongs to controller "${first}": add the endpoint there`;
4328
4032
  }
4329
4033
  })).split('/').filter((x)=>!!x);
4034
+ const group = controller ?? "(root)";
4330
4035
  const folderSegments = [
4036
+ group,
4037
+ ...routeSegments
4038
+ ];
4039
+ const routePath = [
4040
+ context,
4331
4041
  ...controller ? [
4332
4042
  controller
4333
4043
  ] : [],
@@ -4335,7 +4045,7 @@ const scaffoldNewHandlersRestEndpoint = async (boundedContextFolder)=>{
4335
4045
  ];
4336
4046
  const endpointFolder = restPresentationFolder.subitem(folderSegments.map(pathParameterAsName));
4337
4047
  const nameSegments = [
4338
- controller ?? boundedContextFolder.name,
4048
+ controller ?? context,
4339
4049
  ...routeSegments
4340
4050
  ];
4341
4051
  const nameBase = `${[
@@ -4366,11 +4076,8 @@ export class ${endpointClassName} {
4366
4076
 
4367
4077
  get handle() {
4368
4078
  return this.endpointGenerator(this.handler.handle, {
4369
- route: { method: '${method}', path: [${[
4370
- boundedContextFolder.name,
4371
- ...folderSegments
4372
- ].map((x)=>`'${x}'`).join(', ')}] },
4373
- tags: ['${boundedContextFolder.name}${controller ? `: ${controller}` : ''}'],
4079
+ route: { method: '${method}', path: [${routePath.map((x)=>`'${x}'`).join(', ')}] },
4080
+ tags: ['${context}${controller ? `: ${controller}` : ''}'],
4374
4081
  })
4375
4082
  }
4376
4083
  }
@@ -4380,9 +4087,7 @@ export class ${endpointClassName} {
4380
4087
  'wiring',
4381
4088
  'presentation',
4382
4089
  'rest',
4383
- ...controller ? [
4384
- controller
4385
- ] : []
4090
+ group
4386
4091
  ]);
4387
4092
  const wireNameBase = `wire-${nameBase}`;
4388
4093
  const wireNaming = new UnknownFormatNaming(wireNameBase);
@@ -4402,7 +4107,12 @@ export const wire${endpointClassName} = wireClass(
4402
4107
  )
4403
4108
  `.trim());
4404
4109
  wiringFolder.file('index.ts').addLineIfMissing(`export * from './${wireNaming.fileName}'`);
4405
- if (!controller) sharedRestFolder(boundedContextFolder).file('wires.ts').addLineIfMissing(`export * from '../../bounded-contexts/${boundedContextFolder.name}/wiring/presentation/rest/${wireNaming.fileName}'`);
4110
+ boundedContextFolder.subitem([
4111
+ 'wiring',
4112
+ 'presentation',
4113
+ 'rest'
4114
+ ]).file('index.ts').addLineIfMissing(`export * from './${group}'`);
4115
+ sharedRestFolder(boundedContextFolder).file('wires.ts').addLineIfMissing(`export * from '../../bounded-contexts/${context}/wiring/presentation/rest/${group}'`);
4406
4116
  const restHandlersFile = sharedRestFolder(boundedContextFolder).file('index.ts');
4407
4117
  if (!restHandlersFile.exists) sharedRestFolder(boundedContextFolder).createFile('index.ts', `
4408
4118
  import * as wires from './wires'
@@ -4906,4 +4616,4 @@ export const use${ClassName}UIModel = (widgetProps: Omit<${ClassName}WidgetProps
4906
4616
  break;
4907
4617
  }
4908
4618
  };
4909
- export { RequestError, addIntegration, assertAnswersConsumed, configurationSections, deleteBackendUnitUseCase, deleteReactModuleUseCase, findBackendUnits, findContracts, findReactModules, findRestEndpointGenerator, initializeUseCase, integrationDescriptions, integrationIds, moduleId, moveBackendUnitUseCase, moveReactModuleUseCase, printNextSteps, reactKindTitles, runWithAnswers, savePendingChanges, savedImplementations, scaffoldNewAggregateUseCase, scaffoldNewApplicationPort, scaffoldNewApplicationService, scaffoldNewBoundedContextUseCase, scaffoldNewCommand, scaffoldNewDomainObject, scaffoldNewDomainService, scaffoldNewErrorUseCase, scaffoldNewHandlersRestEndpoint, scaffoldNewImplementation, scaffoldNewInfrastructureService, scaffoldNewPresentationService, scaffoldNewQuery, scaffoldNewUseCase, scaffoldReactPage, scaffoldReactSharedHook, scaffoldReactUIKitComponent, scaffoldReactWidget, systemImplementationChoices, unitId, wireDependency };
4619
+ export { RequestError, addIntegration, assertAnswersConsumed, configurationSections, deleteBackendUnitUseCase, deleteReactModuleUseCase, findBackendUnits, findContracts, findReactModules, findRestEndpointGenerator, initializeUseCase, integrationDescriptions, integrationIds, moduleId, moveBackendUnitUseCase, moveReactModuleUseCase, printNextSteps, reactKindTitles, rootControllerChoice, runWithAnswers, savePendingChanges, savedImplementations, scaffoldNewAggregateUseCase, scaffoldNewApplicationPort, scaffoldNewApplicationService, scaffoldNewBoundedContextUseCase, scaffoldNewCommand, scaffoldNewDomainObject, scaffoldNewDomainService, scaffoldNewErrorUseCase, scaffoldNewHandlersRestEndpoint, scaffoldNewImplementation, scaffoldNewInfrastructureService, scaffoldNewPresentationService, scaffoldNewQuery, scaffoldNewUseCase, scaffoldReactPage, scaffoldReactSharedHook, scaffoldReactUIKitComponent, scaffoldReactWidget, systemImplementationChoices, unitId, wireDependency };
package/dist/38.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import node_fs from "node:fs";
2
2
  import node_path from "node:path";
3
- import { canDependOn, namedImportFiles, isCrossContextImplementation, findWiredModules, moduleKindOf, readWiredModule, crossContextImportAllowed, compilerOption, wiredDependencyNames } from "./201.js";
4
- import { defaultDependencyRules, fileModuleKind } from "./870.js";
3
+ import { namedImportFiles, canDependOn, isCrossContextImplementation, findWiredModules, moduleKindOf, readWiredModule, crossContextImportAllowed, wiredDependencyNames } from "./947.js";
4
+ import { defaultDependencyRules, fileModuleKind, compilerOption } from "./780.js";
5
5
  const readAliases = (projectRoot)=>{
6
6
  const tsconfig = node_path.join(projectRoot, 'tsconfig.json');
7
7
  const paths = compilerOption(tsconfig, 'paths');