@domain-first/project-structure 8.7.1 → 8.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/287.js +1275 -981
- package/dist/561.js +19 -3
- package/dist/780.js +9 -2
- package/dist/agent-cli.d.ts +35 -4
- package/dist/agent-requests.d.ts +22 -0
- package/dist/backend-module-move.d.ts +16 -0
- package/dist/config-file.d.ts +38 -18
- package/dist/graph.cjs +9 -2
- package/dist/implementation-options-schema.d.ts +19 -9
- package/dist/in-memory-db.d.ts +4 -0
- package/dist/index.cjs +1635 -1318
- package/dist/init.cjs +53 -40
- package/dist/integration-tests.d.ts +39 -0
- package/dist/integration-tests.spec.d.ts +1 -0
- package/dist/integration.cjs +1635 -1318
- package/dist/lint.cjs +9 -2
- package/dist/react.cjs +1635 -1318
- package/dist/upgrade-steps.d.ts +19 -4
- package/dist/upgrade.cjs +9 -2
- package/dist/use-cases/prompt-implementation-type.d.ts +2 -0
- package/package.json +1 -1
- package/skills/df-ps-implement/SKILL.md +2 -1
- package/skills/df-ps-scaffold/SKILL.md +1 -0
- package/skills/df-ps-scaffold/references/agent-mode.md +1 -1
- package/skills/df-ps-scaffold/references/agent-operations.md +2 -2
- package/skills/df-ps-scaffold/references/generators.md +26 -1
- package/skills/df-ps-scaffold/references/units/aggregate.md +2 -1
- package/skills/df-ps-scaffold/references/units/command-query.md +2 -1
- package/skills/df-ps-scaffold/references/units/implementation.md +1 -1
- package/skills/df-ps-scaffold/references/units/port.md +1 -0
- package/skills/df-ps-scaffold/references/units/services.md +3 -2
package/dist/init.cjs
CHANGED
|
@@ -275,10 +275,17 @@ const implementation_options_schema_implementationKinds = [
|
|
|
275
275
|
'ports'
|
|
276
276
|
];
|
|
277
277
|
const implementation_options_schema_implementationLabelSchema = external_zod_default().string().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/);
|
|
278
|
-
const
|
|
278
|
+
const implementationGroupSchema = external_zod_default().object({
|
|
279
279
|
primary: external_zod_default().array(implementation_options_schema_implementationLabelSchema).default([]),
|
|
280
280
|
test: external_zod_default().array(implementation_options_schema_implementationLabelSchema).default([])
|
|
281
|
-
}).strict()
|
|
281
|
+
}).strict();
|
|
282
|
+
const implementationOptionsSchema = external_zod_default().object({
|
|
283
|
+
...Object.fromEntries(implementation_options_schema_implementationKinds.map((kind)=>[
|
|
284
|
+
kind,
|
|
285
|
+
implementationGroupSchema.optional()
|
|
286
|
+
])),
|
|
287
|
+
integrationTests: external_zod_default().array(implementation_options_schema_implementationLabelSchema).optional()
|
|
288
|
+
}).strict();
|
|
282
289
|
class project_root_ProjectRoot {
|
|
283
290
|
path;
|
|
284
291
|
constructor(){
|
|
@@ -631,6 +638,7 @@ const save_pending_changes_savePendingChanges = async ()=>{
|
|
|
631
638
|
writePendingChanges();
|
|
632
639
|
return true;
|
|
633
640
|
};
|
|
641
|
+
const context_dependencies_crossContextImplementation = 'cross-context';
|
|
634
642
|
new Map([
|
|
635
643
|
[
|
|
636
644
|
'prisma',
|
|
@@ -645,6 +653,7 @@ const wiring_relativeImport = (fromFile, toFile)=>{
|
|
|
645
653
|
const relativePath = external_node_path_default().relative(external_node_path_default().dirname(fromFile), toFile).replace(/\.ts$/, '').split(external_node_path_default().sep).join('/');
|
|
646
654
|
return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;
|
|
647
655
|
};
|
|
656
|
+
const inMemoryImplementationType = 'in-memory';
|
|
648
657
|
const inMemoryDbService = `type Entry = {
|
|
649
658
|
id: unknown;
|
|
650
659
|
item: any;
|
|
@@ -1149,44 +1158,6 @@ const storybook_addStorybook = async ()=>{
|
|
|
1149
1158
|
})
|
|
1150
1159
|
];
|
|
1151
1160
|
};
|
|
1152
|
-
const defaultEnvBranches = {
|
|
1153
|
-
names: [
|
|
1154
|
-
'test',
|
|
1155
|
-
'development',
|
|
1156
|
-
'production'
|
|
1157
|
-
],
|
|
1158
|
-
test: 'test'
|
|
1159
|
-
};
|
|
1160
|
-
const wire_branches_envBranches = ()=>{
|
|
1161
|
-
const configured = config_file_ConfigFile.exists ? config_file_ConfigFile.Instance.data.backend?.envBranches : void 0;
|
|
1162
|
-
const { names, test } = configured ?? defaultEnvBranches;
|
|
1163
|
-
return {
|
|
1164
|
-
names,
|
|
1165
|
-
test,
|
|
1166
|
-
primary: names.filter((name)=>name !== test),
|
|
1167
|
-
custom: Boolean(configured)
|
|
1168
|
-
};
|
|
1169
|
-
};
|
|
1170
|
-
const envBranchedWireSource = ()=>{
|
|
1171
|
-
const { names, custom } = wire_branches_envBranches();
|
|
1172
|
-
if (!custom) return `import { branchedWire } from '@domain-first/wire'
|
|
1173
|
-
|
|
1174
|
-
export const envBranchedWire = branchedWire(() => {
|
|
1175
|
-
return process.env.NODE_ENV ?? 'development' as 'test' | 'development' | 'production'
|
|
1176
|
-
});`;
|
|
1177
|
-
return `import { branchedWire } from '@domain-first/wire'
|
|
1178
|
-
|
|
1179
|
-
export type EnvBranch = ${names.map((name)=>`'${name}'`).join(' | ')}
|
|
1180
|
-
|
|
1181
|
-
/**
|
|
1182
|
-
* The branch this process runs in. Write how it is selected:
|
|
1183
|
-
* until then, this function doesn't compile.
|
|
1184
|
-
*/
|
|
1185
|
-
const currentBranch = (): EnvBranch => {
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
export const envBranchedWire = branchedWire(currentBranch)`;
|
|
1189
|
-
};
|
|
1190
1161
|
new Set([
|
|
1191
1162
|
'node_modules',
|
|
1192
1163
|
'.git',
|
|
@@ -1242,6 +1213,48 @@ const domainModelLayout = (kind)=>{
|
|
|
1242
1213
|
};
|
|
1243
1214
|
};
|
|
1244
1215
|
domainModelLayout('entity'), domainModelLayout('value-object'), serviceLayout('domain'), serviceLayout('application'), serviceLayout('infrastructure'), serviceLayout('presentation'), handlerLayout('command'), handlerLayout('query');
|
|
1216
|
+
new Set([
|
|
1217
|
+
inMemoryImplementationType,
|
|
1218
|
+
context_dependencies_crossContextImplementation
|
|
1219
|
+
]);
|
|
1220
|
+
const defaultEnvBranches = {
|
|
1221
|
+
names: [
|
|
1222
|
+
'test',
|
|
1223
|
+
'development',
|
|
1224
|
+
'production'
|
|
1225
|
+
],
|
|
1226
|
+
test: 'test'
|
|
1227
|
+
};
|
|
1228
|
+
const wire_branches_envBranches = ()=>{
|
|
1229
|
+
const configured = config_file_ConfigFile.exists ? config_file_ConfigFile.Instance.data.backend?.envBranches : void 0;
|
|
1230
|
+
const { names, test } = configured ?? defaultEnvBranches;
|
|
1231
|
+
return {
|
|
1232
|
+
names,
|
|
1233
|
+
test,
|
|
1234
|
+
primary: names.filter((name)=>name !== test),
|
|
1235
|
+
custom: Boolean(configured)
|
|
1236
|
+
};
|
|
1237
|
+
};
|
|
1238
|
+
const envBranchedWireSource = ()=>{
|
|
1239
|
+
const { names, custom } = wire_branches_envBranches();
|
|
1240
|
+
if (!custom) return `import { branchedWire } from '@domain-first/wire'
|
|
1241
|
+
|
|
1242
|
+
export const envBranchedWire = branchedWire(() => {
|
|
1243
|
+
return process.env.NODE_ENV ?? 'development' as 'test' | 'development' | 'production'
|
|
1244
|
+
});`;
|
|
1245
|
+
return `import { branchedWire } from '@domain-first/wire'
|
|
1246
|
+
|
|
1247
|
+
export type EnvBranch = ${names.map((name)=>`'${name}'`).join(' | ')}
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* The branch this process runs in. Write how it is selected:
|
|
1251
|
+
* until then, this function doesn't compile.
|
|
1252
|
+
*/
|
|
1253
|
+
const currentBranch = (): EnvBranch => {
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
export const envBranchedWire = branchedWire(currentBranch)`;
|
|
1257
|
+
};
|
|
1245
1258
|
const configurationSections = [
|
|
1246
1259
|
'project',
|
|
1247
1260
|
'backend',
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type BackendUnit } from './backend-module-move';
|
|
2
|
+
import { File } from './file-system';
|
|
3
|
+
/**
|
|
4
|
+
* Integration specs are generated with the Testcontainers integration and
|
|
5
|
+
* wiring: a spec builds its subject through its wire factory.
|
|
6
|
+
*/
|
|
7
|
+
export declare const integrationSpecsAvailable: () => boolean;
|
|
8
|
+
/** Types that never get an integration spec unless listed by hand. */
|
|
9
|
+
export declare const systemImplementationTypes: Set<string>;
|
|
10
|
+
export declare const integrationTestTypes: () => string[];
|
|
11
|
+
/** Records the types whose implementations get integration specs. */
|
|
12
|
+
export declare const setIntegrationTestTypes: (types: string[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Exports the factory of an implementation from the contract's wire
|
|
15
|
+
* (`const wirePrismaImplementation` → `export const ...`), so a spec can
|
|
16
|
+
* build it without the environment branches. False when the wire has no
|
|
17
|
+
* such factory.
|
|
18
|
+
*/
|
|
19
|
+
export declare const exportImplementationWire: (wireFile: File, label: string) => boolean;
|
|
20
|
+
type SpecSubject = Pick<BackendUnit, 'kind' | 'name' | 'ownerPath'>;
|
|
21
|
+
/**
|
|
22
|
+
* Stages the integration spec of an implementation, or of an
|
|
23
|
+
* infrastructure service without `label`, unless it exists. An
|
|
24
|
+
* implementation's factory gets exported from the contract's wire.
|
|
25
|
+
* Returns the spec file, if staged.
|
|
26
|
+
*/
|
|
27
|
+
export declare const scaffoldIntegrationSpec: (unit: SpecSubject, label?: string) => File | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Whether implementations of this primary type get an integration spec.
|
|
30
|
+
* A listed type does; a newly entered one asks (default yes), and a type
|
|
31
|
+
* saved for future use records the answer.
|
|
32
|
+
*/
|
|
33
|
+
export declare const wantsIntegrationTests: (label: string, { entered, save }: {
|
|
34
|
+
entered: boolean;
|
|
35
|
+
save: boolean;
|
|
36
|
+
}) => Promise<boolean>;
|
|
37
|
+
/** Whether a new infrastructure service gets an integration spec. */
|
|
38
|
+
export declare const wantsServiceIntegrationSpec: () => Promise<boolean>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|