@domain-first/project-structure 7.0.0 → 7.1.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.
@@ -0,0 +1,53 @@
1
+ import { type MovePlan } from './module-move';
2
+ export type BackendUnitKind = 'aggregate' | 'entity' | 'value-object' | 'domain-service' | 'application-service' | 'infrastructure-service' | 'presentation-service' | 'use-case' | 'command' | 'query' | 'port';
3
+ /**
4
+ * Where a unit lives: a bounded context or the Shared Kernel folder, and
5
+ * for entities and value objects, the aggregate they belong to.
6
+ */
7
+ export type UnitPlace = {
8
+ ownerPath: string;
9
+ name: string;
10
+ aggregate?: string;
11
+ };
12
+ export type BackendUnit = UnitPlace & {
13
+ kind: BackendUnitKind;
14
+ /** Implementation folders, e.g. `prisma`, `in-memory`, `api`. */
15
+ labels: string[];
16
+ };
17
+ type KindLayout = {
18
+ title: string;
19
+ /** The class every other name derives from, e.g. `PlaceOrderUseCase`. */
20
+ core: (ClassName: string) => string;
21
+ /** Files of the unit relative to its owner, in a fixed order. */
22
+ files: (place: UnitPlace, labels: string[]) => string[];
23
+ /** Implementation folders: classes `<Label><Core>` live there. */
24
+ implementations?: string;
25
+ wired: boolean;
26
+ /** Generated in the Shared Kernel too. */
27
+ sharedKernel: boolean;
28
+ };
29
+ export declare const kindLayouts: Record<BackendUnitKind, KindLayout>;
30
+ export declare const aggregatesOf: (ownerPath: string) => string[];
31
+ /**
32
+ * Units generated in a bounded context or the Shared Kernel, found by
33
+ * their file layout, so projects without wiring are covered too.
34
+ */
35
+ export declare const findBackendUnits: (ownerPath: string) => BackendUnit[];
36
+ /**
37
+ * Checks a move before anything is staged; true or the reason it can't
38
+ * be done.
39
+ */
40
+ export declare const validateBackendMove: (unit: BackendUnit, target: UnitPlace, sharedKernelPath: string) => string | true;
41
+ export type BackendMoveResult = {
42
+ violations: [string, string][];
43
+ } | (MovePlan & {
44
+ violations?: undefined;
45
+ });
46
+ /**
47
+ * Stages the move of a unit: its files, the names derived from it in the
48
+ * project, and the imports of it. Nothing is staged when the move would
49
+ * make a file import across a bounded context boundary; those imports
50
+ * are returned instead, with paths after the move.
51
+ */
52
+ export declare const moveBackendUnit: (projectRoot: string, rootFolderPath: string, unit: BackendUnit, target: UnitPlace) => BackendMoveResult;
53
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -15,6 +15,11 @@ export declare const inMemoryDbScaffolded: () => boolean;
15
15
  * enabled in the config and its files are there.
16
16
  */
17
17
  export declare const usesInMemoryDb: (implementationType: string) => boolean;
18
+ /**
19
+ * `user` → `users`, `category` → `categories`, `box` → `boxes`,
20
+ * `quiz` → `quizzes`, `user-data` → `user-data`.
21
+ */
22
+ export declare const plural: (word: string) => string;
18
23
  /**
19
24
  * Adds a section of the type to the in-memory DB, unless it is there,
20
25
  * and returns the section's field name.