@open-mercato/cli 0.4.8-canary-8502c817af → 0.4.8-develop-4e71d95aba
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/lib/generators/module-registry.js +0 -134
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/testing/integration.js +78 -109
- package/dist/lib/testing/integration.js.map +2 -2
- package/package.json +4 -4
- package/src/lib/generators/__tests__/module-subset.test.ts +1 -57
- package/src/lib/generators/__tests__/scanner.test.ts +1 -2
- package/src/lib/generators/module-registry.ts +0 -121
- package/src/lib/testing/__tests__/integration.test.ts +3 -106
- package/src/lib/testing/integration.ts +85 -137
|
@@ -295,10 +295,6 @@ async function generateModuleRegistry(options) {
|
|
|
295
295
|
const analyticsChecksumFile = path.join(outputDir, "analytics.generated.checksum");
|
|
296
296
|
const transFieldsOutFile = path.join(outputDir, "translations-fields.generated.ts");
|
|
297
297
|
const transFieldsChecksumFile = path.join(outputDir, "translations-fields.generated.checksum");
|
|
298
|
-
const securityMfaProvidersOutFile = path.join(outputDir, "security-mfa-providers.generated.ts");
|
|
299
|
-
const securityMfaProvidersChecksumFile = path.join(outputDir, "security-mfa-providers.generated.checksum");
|
|
300
|
-
const securitySudoOutFile = path.join(outputDir, "security-sudo.generated.ts");
|
|
301
|
-
const securitySudoChecksumFile = path.join(outputDir, "security-sudo.generated.checksum");
|
|
302
298
|
const enrichersOutFile = path.join(outputDir, "enrichers.generated.ts");
|
|
303
299
|
const enrichersChecksumFile = path.join(outputDir, "enrichers.generated.checksum");
|
|
304
300
|
const interceptorsOutFile = path.join(outputDir, "interceptors.generated.ts");
|
|
@@ -311,10 +307,6 @@ async function generateModuleRegistry(options) {
|
|
|
311
307
|
const guardsChecksumFile = path.join(outputDir, "guards.generated.checksum");
|
|
312
308
|
const commandInterceptorsOutFile = path.join(outputDir, "command-interceptors.generated.ts");
|
|
313
309
|
const commandInterceptorsChecksumFile = path.join(outputDir, "command-interceptors.generated.checksum");
|
|
314
|
-
const frontendMiddlewareOutFile = path.join(outputDir, "frontend-middleware.generated.ts");
|
|
315
|
-
const frontendMiddlewareChecksumFile = path.join(outputDir, "frontend-middleware.generated.checksum");
|
|
316
|
-
const backendMiddlewareOutFile = path.join(outputDir, "backend-middleware.generated.ts");
|
|
317
|
-
const backendMiddlewareChecksumFile = path.join(outputDir, "backend-middleware.generated.checksum");
|
|
318
310
|
const enabled = resolver.loadEnabledModules();
|
|
319
311
|
const imports = [];
|
|
320
312
|
const moduleDecls = [];
|
|
@@ -344,10 +336,6 @@ async function generateModuleRegistry(options) {
|
|
|
344
336
|
const analyticsImports = [];
|
|
345
337
|
const transFieldsConfigs = [];
|
|
346
338
|
const transFieldsImports = [];
|
|
347
|
-
const securityMfaProviderConfigs = [];
|
|
348
|
-
const securityMfaProviderImports = [];
|
|
349
|
-
const securitySudoConfigs = [];
|
|
350
|
-
const securitySudoImports = [];
|
|
351
339
|
const enricherConfigs = [];
|
|
352
340
|
const enricherImports = [];
|
|
353
341
|
const interceptorConfigs = [];
|
|
@@ -360,10 +348,6 @@ async function generateModuleRegistry(options) {
|
|
|
360
348
|
const guardImports = [];
|
|
361
349
|
const commandInterceptorConfigs = [];
|
|
362
350
|
const commandInterceptorImports = [];
|
|
363
|
-
const frontendMiddlewareConfigs = [];
|
|
364
|
-
const frontendMiddlewareImports = [];
|
|
365
|
-
const backendMiddlewareConfigs = [];
|
|
366
|
-
const backendMiddlewareImports = [];
|
|
367
351
|
const umesConflictSources = [];
|
|
368
352
|
for (const entry of enabled) {
|
|
369
353
|
const modId = entry.id;
|
|
@@ -615,28 +599,6 @@ async function generateModuleRegistry(options) {
|
|
|
615
599
|
sharedImports: imports,
|
|
616
600
|
configExpr: (n, id) => `{ moduleId: '${id}', fields: (${n}.default ?? ${n}.translatableFields ?? {}) as Record<string, string[]> }`
|
|
617
601
|
});
|
|
618
|
-
processStandaloneConfig({
|
|
619
|
-
roots,
|
|
620
|
-
imps,
|
|
621
|
-
modId,
|
|
622
|
-
importIdRef,
|
|
623
|
-
relativePath: "security.mfa-providers.ts",
|
|
624
|
-
prefix: "SECURITY_MFA_PROVIDERS",
|
|
625
|
-
standaloneImports: securityMfaProviderImports,
|
|
626
|
-
standaloneConfigs: securityMfaProviderConfigs,
|
|
627
|
-
configExpr: (n, id) => `{ moduleId: '${id}', providers: ((${n}.default ?? ${n}.mfaProviders ?? []) as unknown[]) }`
|
|
628
|
-
});
|
|
629
|
-
processStandaloneConfig({
|
|
630
|
-
roots,
|
|
631
|
-
imps,
|
|
632
|
-
modId,
|
|
633
|
-
importIdRef,
|
|
634
|
-
relativePath: "security.sudo.ts",
|
|
635
|
-
prefix: "SECURITY_SUDO",
|
|
636
|
-
standaloneImports: securitySudoImports,
|
|
637
|
-
standaloneConfigs: securitySudoConfigs,
|
|
638
|
-
configExpr: (n, id) => `{ moduleId: '${id}', targets: ((${n}.default ?? ${n}.sudoTargets ?? []) as Array<Record<string, unknown>>) }`
|
|
639
|
-
});
|
|
640
602
|
{
|
|
641
603
|
const resolved = resolveModuleFile(roots, imps, "inbox-actions.ts");
|
|
642
604
|
if (resolved) {
|
|
@@ -670,28 +632,6 @@ async function generateModuleRegistry(options) {
|
|
|
670
632
|
standaloneConfigs: commandInterceptorConfigs,
|
|
671
633
|
configExpr: (n, id) => `{ moduleId: '${id}', interceptors: ((${n} as any).interceptors ?? (${n} as any).default ?? []) }`
|
|
672
634
|
});
|
|
673
|
-
processStandaloneConfig({
|
|
674
|
-
roots,
|
|
675
|
-
imps,
|
|
676
|
-
modId,
|
|
677
|
-
importIdRef,
|
|
678
|
-
relativePath: "frontend/middleware.ts",
|
|
679
|
-
prefix: "FRONTEND_MIDDLEWARE",
|
|
680
|
-
standaloneImports: frontendMiddlewareImports,
|
|
681
|
-
standaloneConfigs: frontendMiddlewareConfigs,
|
|
682
|
-
configExpr: (n, id) => `{ moduleId: '${id}', middleware: ((${n} as any).middleware ?? (${n} as any).default ?? []) }`
|
|
683
|
-
});
|
|
684
|
-
processStandaloneConfig({
|
|
685
|
-
roots,
|
|
686
|
-
imps,
|
|
687
|
-
modId,
|
|
688
|
-
importIdRef,
|
|
689
|
-
relativePath: "backend/middleware.ts",
|
|
690
|
-
prefix: "BACKEND_MIDDLEWARE",
|
|
691
|
-
standaloneImports: backendMiddlewareImports,
|
|
692
|
-
standaloneConfigs: backendMiddlewareConfigs,
|
|
693
|
-
configExpr: (n, id) => `{ moduleId: '${id}', middleware: ((${n} as any).middleware ?? (${n} as any).default ?? []) }`
|
|
694
|
-
});
|
|
695
635
|
{
|
|
696
636
|
const setup = resolveConventionFile(roots, imps, "setup.ts", "SETUP", modId, importIdRef, imports);
|
|
697
637
|
if (setup) setupImportName = setup.importName;
|
|
@@ -1045,34 +985,6 @@ export const allTranslatableEntityTypes = Object.keys(allFields)
|
|
|
1045
985
|
|
|
1046
986
|
// Auto-register on import (side-effect)
|
|
1047
987
|
registerTranslatableFields(allFields)
|
|
1048
|
-
`;
|
|
1049
|
-
const securityMfaProviderEntriesLiteral = securityMfaProviderConfigs.join(",\n ");
|
|
1050
|
-
const securityMfaProviderImportSection = securityMfaProviderImports.join("\n");
|
|
1051
|
-
const securityMfaProvidersOutput = `// AUTO-GENERATED by mercato generate registry
|
|
1052
|
-
${securityMfaProviderImportSection ? `${securityMfaProviderImportSection}
|
|
1053
|
-
` : ""}type SecurityMfaProviderEntry = { moduleId: string; providers: unknown[] }
|
|
1054
|
-
|
|
1055
|
-
export const securityMfaProviderEntries: SecurityMfaProviderEntry[] = [
|
|
1056
|
-
${securityMfaProviderEntriesLiteral ? ` ${securityMfaProviderEntriesLiteral}
|
|
1057
|
-
` : ""}]
|
|
1058
|
-
`;
|
|
1059
|
-
const securitySudoEntriesLiteral = securitySudoConfigs.join(",\n ");
|
|
1060
|
-
const securitySudoImportSection = securitySudoImports.join("\n");
|
|
1061
|
-
const securitySudoOutput = `// AUTO-GENERATED by mercato generate registry
|
|
1062
|
-
import type { SecuritySudoTarget, SecuritySudoTargetEntry } from '@open-mercato/enterprise/modules/security'
|
|
1063
|
-
${securitySudoImportSection ? `
|
|
1064
|
-
${securitySudoImportSection}
|
|
1065
|
-
` : "\n"}
|
|
1066
|
-
type SecuritySudoTargetEntryRaw = { moduleId: string; targets: Array<Record<string, unknown>> }
|
|
1067
|
-
|
|
1068
|
-
const entriesRaw: SecuritySudoTargetEntryRaw[] = [
|
|
1069
|
-
${securitySudoEntriesLiteral ? ` ${securitySudoEntriesLiteral}
|
|
1070
|
-
` : ""}]
|
|
1071
|
-
|
|
1072
|
-
export const securitySudoTargetEntries: SecuritySudoTargetEntry[] = entriesRaw.map((entry) => ({
|
|
1073
|
-
moduleId: entry.moduleId,
|
|
1074
|
-
targets: entry.targets as SecuritySudoTarget[],
|
|
1075
|
-
}))
|
|
1076
988
|
`;
|
|
1077
989
|
const notificationEntriesLiteral = notificationTypes.join(",\n ");
|
|
1078
990
|
const notificationImportSection = notificationImports.join("\n");
|
|
@@ -1357,8 +1269,6 @@ export const allAiTools = aiToolConfigEntries.flatMap(e => e.tools)
|
|
|
1357
1269
|
writeGeneratedFile({ outFile: eventsOutFile, checksumFile: eventsChecksumFile, content: eventsOutput, structureChecksum, result, quiet });
|
|
1358
1270
|
writeGeneratedFile({ outFile: analyticsOutFile, checksumFile: analyticsChecksumFile, content: analyticsOutput, structureChecksum, result, quiet });
|
|
1359
1271
|
writeGeneratedFile({ outFile: transFieldsOutFile, checksumFile: transFieldsChecksumFile, content: transFieldsOutput, structureChecksum, result, quiet });
|
|
1360
|
-
writeGeneratedFile({ outFile: securityMfaProvidersOutFile, checksumFile: securityMfaProvidersChecksumFile, content: securityMfaProvidersOutput, structureChecksum, result, quiet });
|
|
1361
|
-
writeGeneratedFile({ outFile: securitySudoOutFile, checksumFile: securitySudoChecksumFile, content: securitySudoOutput, structureChecksum, result, quiet });
|
|
1362
1272
|
const enricherEntriesLiteral = enricherConfigs.join(",\n ");
|
|
1363
1273
|
const enricherImportSection = enricherImports.join("\n");
|
|
1364
1274
|
const enrichersOutput = `// AUTO-GENERATED by mercato generate registry
|
|
@@ -1458,50 +1368,6 @@ ${commandInterceptorEntriesLiteral ? ` ${commandInterceptorEntriesLiteral}
|
|
|
1458
1368
|
` : ""}]
|
|
1459
1369
|
`;
|
|
1460
1370
|
writeGeneratedFile({ outFile: commandInterceptorsOutFile, checksumFile: commandInterceptorsChecksumFile, content: commandInterceptorsOutput, structureChecksum, result, quiet });
|
|
1461
|
-
const frontendMiddlewareEntriesLiteral = frontendMiddlewareConfigs.join(",\n ");
|
|
1462
|
-
const frontendMiddlewareImportSection = frontendMiddlewareImports.join("\n");
|
|
1463
|
-
const frontendMiddlewareOutput = `// AUTO-GENERATED by mercato generate registry
|
|
1464
|
-
import type { PageMiddlewareRegistryEntry, PageRouteMiddleware } from '@open-mercato/shared/modules/middleware/page'
|
|
1465
|
-
${frontendMiddlewareImportSection ? `
|
|
1466
|
-
${frontendMiddlewareImportSection}
|
|
1467
|
-
` : "\n"}type FrontendMiddlewareEntry = { moduleId: string; middleware: PageRouteMiddleware[] }
|
|
1468
|
-
|
|
1469
|
-
const entriesRaw: FrontendMiddlewareEntry[] = [
|
|
1470
|
-
${frontendMiddlewareEntriesLiteral ? ` ${frontendMiddlewareEntriesLiteral}
|
|
1471
|
-
` : ""}]
|
|
1472
|
-
|
|
1473
|
-
export const frontendMiddlewareEntries: PageMiddlewareRegistryEntry[] = entriesRaw
|
|
1474
|
-
`;
|
|
1475
|
-
writeGeneratedFile({
|
|
1476
|
-
outFile: frontendMiddlewareOutFile,
|
|
1477
|
-
checksumFile: frontendMiddlewareChecksumFile,
|
|
1478
|
-
content: frontendMiddlewareOutput,
|
|
1479
|
-
structureChecksum,
|
|
1480
|
-
result,
|
|
1481
|
-
quiet
|
|
1482
|
-
});
|
|
1483
|
-
const backendMiddlewareEntriesLiteral = backendMiddlewareConfigs.join(",\n ");
|
|
1484
|
-
const backendMiddlewareImportSection = backendMiddlewareImports.join("\n");
|
|
1485
|
-
const backendMiddlewareOutput = `// AUTO-GENERATED by mercato generate registry
|
|
1486
|
-
import type { PageMiddlewareRegistryEntry, PageRouteMiddleware } from '@open-mercato/shared/modules/middleware/page'
|
|
1487
|
-
${backendMiddlewareImportSection ? `
|
|
1488
|
-
${backendMiddlewareImportSection}
|
|
1489
|
-
` : "\n"}type BackendMiddlewareEntry = { moduleId: string; middleware: PageRouteMiddleware[] }
|
|
1490
|
-
|
|
1491
|
-
const entriesRaw: BackendMiddlewareEntry[] = [
|
|
1492
|
-
${backendMiddlewareEntriesLiteral ? ` ${backendMiddlewareEntriesLiteral}
|
|
1493
|
-
` : ""}]
|
|
1494
|
-
|
|
1495
|
-
export const backendMiddlewareEntries: PageMiddlewareRegistryEntry[] = entriesRaw
|
|
1496
|
-
`;
|
|
1497
|
-
writeGeneratedFile({
|
|
1498
|
-
outFile: backendMiddlewareOutFile,
|
|
1499
|
-
checksumFile: backendMiddlewareChecksumFile,
|
|
1500
|
-
content: backendMiddlewareOutput,
|
|
1501
|
-
structureChecksum,
|
|
1502
|
-
result,
|
|
1503
|
-
quiet
|
|
1504
|
-
});
|
|
1505
1371
|
return result;
|
|
1506
1372
|
}
|
|
1507
1373
|
async function generateModuleRegistryCli(options) {
|