@beignet/cli 0.0.33 → 0.0.35
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/CHANGELOG.md +33 -0
- package/README.md +34 -7
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/inspect.js +54 -17
- package/dist/inspect.js.map +1 -1
- package/dist/lint.js +10 -3
- package/dist/lint.js.map +1 -1
- package/dist/make/inbox.d.ts.map +1 -1
- package/dist/make/inbox.js +4 -5
- package/dist/make/inbox.js.map +1 -1
- package/dist/make/payments.d.ts.map +1 -1
- package/dist/make/payments.js +5 -7
- package/dist/make/payments.js.map +1 -1
- package/dist/make/shared.js +1 -1
- package/dist/make/shared.js.map +1 -1
- package/dist/make/tenancy.d.ts.map +1 -1
- package/dist/make/tenancy.js +4 -6
- package/dist/make/tenancy.js.map +1 -1
- package/dist/make.js +8 -9
- package/dist/make.js.map +1 -1
- package/dist/provider-add.d.ts.map +1 -1
- package/dist/provider-add.js +52 -69
- package/dist/provider-add.js.map +1 -1
- package/dist/registry-edits.js +2 -1
- package/dist/registry-edits.js.map +1 -1
- package/dist/schedule.d.ts.map +1 -1
- package/dist/schedule.js +1 -1
- package/dist/schedule.js.map +1 -1
- package/dist/templates/agents.d.ts.map +1 -1
- package/dist/templates/agents.js +2 -0
- package/dist/templates/agents.js.map +1 -1
- package/dist/templates/base.js +3 -3
- package/dist/templates/base.js.map +1 -1
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +1 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/server.d.ts +1 -0
- package/dist/templates/server.d.ts.map +1 -1
- package/dist/templates/server.js +19 -11
- package/dist/templates/server.js.map +1 -1
- package/dist/templates/testing.d.ts.map +1 -1
- package/dist/templates/testing.js +55 -26
- package/dist/templates/testing.js.map +1 -1
- package/dist/templates/todos.d.ts.map +1 -1
- package/dist/templates/todos.js +3 -4
- package/dist/templates/todos.js.map +1 -1
- package/package.json +3 -2
- package/skills/app-structure/SKILL.md +14 -1
- package/src/config.ts +2 -0
- package/src/inspect.ts +87 -21
- package/src/lint.ts +15 -3
- package/src/make/inbox.ts +4 -5
- package/src/make/payments.ts +4 -8
- package/src/make/shared.ts +1 -1
- package/src/make/tenancy.ts +4 -10
- package/src/make.ts +8 -9
- package/src/provider-add.ts +52 -69
- package/src/registry-edits.ts +2 -1
- package/src/schedule.ts +4 -3
- package/src/templates/agents.ts +2 -0
- package/src/templates/base.ts +3 -3
- package/src/templates/index.ts +1 -0
- package/src/templates/server.ts +19 -11
- package/src/templates/testing.ts +55 -26
- package/src/templates/todos.ts +3 -4
- package/src/test-helpers/generated-app.ts +1 -1
package/src/inspect.ts
CHANGED
|
@@ -1519,6 +1519,11 @@ async function inspectCanonicalConformance(
|
|
|
1519
1519
|
reason:
|
|
1520
1520
|
"infra/app-ports.ts should wire concrete app ports for the selected runtime.",
|
|
1521
1521
|
},
|
|
1522
|
+
{
|
|
1523
|
+
file: config.paths.routesBuilder,
|
|
1524
|
+
reason:
|
|
1525
|
+
"lib/routes.ts should bind route declarations to the shared AppContext type.",
|
|
1526
|
+
},
|
|
1522
1527
|
];
|
|
1523
1528
|
|
|
1524
1529
|
if (hasClientSurface) {
|
|
@@ -1657,6 +1662,30 @@ async function inspectCanonicalConformance(
|
|
|
1657
1662
|
}
|
|
1658
1663
|
}
|
|
1659
1664
|
|
|
1665
|
+
if (files.includes(config.paths.routesBuilder)) {
|
|
1666
|
+
const routesBuilderSource = await readCachedSource(
|
|
1667
|
+
targetDir,
|
|
1668
|
+
config.paths.routesBuilder,
|
|
1669
|
+
sourceCache,
|
|
1670
|
+
);
|
|
1671
|
+
if (
|
|
1672
|
+
!importsAppContext(
|
|
1673
|
+
routesBuilderSource,
|
|
1674
|
+
config.paths.routesBuilder,
|
|
1675
|
+
config,
|
|
1676
|
+
files,
|
|
1677
|
+
) ||
|
|
1678
|
+
!/\bcreateRoutes\s*<\s*AppContext\s*>\s*\(\s*\)/.test(routesBuilderSource)
|
|
1679
|
+
) {
|
|
1680
|
+
diagnostics.push({
|
|
1681
|
+
severity: "warning",
|
|
1682
|
+
code: "BEIGNET_ROUTE_BUILDER_CONTEXT",
|
|
1683
|
+
file: config.paths.routesBuilder,
|
|
1684
|
+
message: `${config.paths.routesBuilder} should import AppContext from ${config.paths.appContext} and export route builders from createRoutes<AppContext>().`,
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1660
1689
|
const featureRoutesPath = `${featuresPath}/`;
|
|
1661
1690
|
for (const file of files) {
|
|
1662
1691
|
if (!file.startsWith(featureRoutesPath) || !file.endsWith("/routes.ts")) {
|
|
@@ -1666,21 +1695,20 @@ async function inspectCanonicalConformance(
|
|
|
1666
1695
|
const source = await readCachedSource(targetDir, file, sourceCache);
|
|
1667
1696
|
if (!source.includes("defineRouteGroup")) continue;
|
|
1668
1697
|
|
|
1669
|
-
if (
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
code: "BEIGNET_FEATURE_ROUTE_APP_CONTEXT",
|
|
1698
|
+
if (
|
|
1699
|
+
!importsNamedFromFile(
|
|
1700
|
+
source,
|
|
1673
1701
|
file,
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1702
|
+
config.paths.routesBuilder,
|
|
1703
|
+
"defineRouteGroup",
|
|
1704
|
+
files,
|
|
1705
|
+
)
|
|
1706
|
+
) {
|
|
1679
1707
|
diagnostics.push({
|
|
1680
1708
|
severity: "warning",
|
|
1681
|
-
code: "
|
|
1709
|
+
code: "BEIGNET_FEATURE_ROUTE_BUILDER",
|
|
1682
1710
|
file,
|
|
1683
|
-
message: `${file} should
|
|
1711
|
+
message: `${file} should import { defineRouteGroup } from ${config.paths.routesBuilder} so route groups use the app-bound context type.`,
|
|
1684
1712
|
});
|
|
1685
1713
|
}
|
|
1686
1714
|
}
|
|
@@ -1743,6 +1771,28 @@ function importsAppContext(
|
|
|
1743
1771
|
return false;
|
|
1744
1772
|
}
|
|
1745
1773
|
|
|
1774
|
+
function importsNamedFromFile(
|
|
1775
|
+
source: string,
|
|
1776
|
+
importerFile: string,
|
|
1777
|
+
expectedFile: string,
|
|
1778
|
+
importedName: string,
|
|
1779
|
+
files: string[],
|
|
1780
|
+
): boolean {
|
|
1781
|
+
const importRegex = /import\s+\{([^}]+)\}\s+from\s+["']([^"']+)["']/g;
|
|
1782
|
+
|
|
1783
|
+
for (const match of source.matchAll(importRegex)) {
|
|
1784
|
+
const sourceFile = sourceFileFromImport(match[2], importerFile, files);
|
|
1785
|
+
if (sourceFile !== expectedFile) continue;
|
|
1786
|
+
|
|
1787
|
+
for (const member of match[1].split(",")) {
|
|
1788
|
+
const parsed = parseImportMember(member);
|
|
1789
|
+
if (parsed?.importedName === importedName) return true;
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
return false;
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1746
1796
|
async function inspectAuthzAuditDrift(
|
|
1747
1797
|
targetDir: string,
|
|
1748
1798
|
files: string[],
|
|
@@ -2429,7 +2479,7 @@ async function inspectPaymentsProductionReadiness(
|
|
|
2429
2479
|
code: "BEIGNET_PAYMENTS_STRIPE_MEMORY_PROVIDER",
|
|
2430
2480
|
file: serverProviderFiles(files, config)[0] ?? config.paths.server,
|
|
2431
2481
|
message:
|
|
2432
|
-
"@beignet/provider-payments-stripe is installed and Stripe env/config is present, but server/providers.ts still registers memory payments. Register
|
|
2482
|
+
"@beignet/provider-payments-stripe is installed and Stripe env/config is present, but server/providers.ts still registers memory payments. Register createStripePaymentsProvider() before deploying Stripe-backed billing, or remove the Stripe provider/config until the app is ready to switch.",
|
|
2433
2483
|
});
|
|
2434
2484
|
}
|
|
2435
2485
|
|
|
@@ -2531,7 +2581,8 @@ async function hasStripeMemoryProviderMismatch(
|
|
|
2531
2581
|
return false;
|
|
2532
2582
|
}
|
|
2533
2583
|
if (
|
|
2534
|
-
findProviderEntryIndex(providerEntries, ["
|
|
2584
|
+
findProviderEntryIndex(providerEntries, ["createStripePaymentsProvider"]) >=
|
|
2585
|
+
0
|
|
2535
2586
|
) {
|
|
2536
2587
|
return false;
|
|
2537
2588
|
}
|
|
@@ -3940,10 +3991,27 @@ async function listenedEventNames(
|
|
|
3940
3991
|
if (!listenerPattern.test(file) || isWorkflowTestFile(file)) continue;
|
|
3941
3992
|
|
|
3942
3993
|
const source = await readFile(path.join(targetDir, file), "utf8");
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3994
|
+
const callPattern = /\bdefineListener\s*\(/g;
|
|
3995
|
+
for (const match of source.matchAll(callPattern)) {
|
|
3996
|
+
const openIndex = source.indexOf("(", match.index ?? 0);
|
|
3997
|
+
if (openIndex === -1) continue;
|
|
3998
|
+
|
|
3999
|
+
const closeIndex = matchingDelimiterIndex(source, openIndex, "(", ")");
|
|
4000
|
+
if (closeIndex === -1) continue;
|
|
4001
|
+
|
|
4002
|
+
const args = splitTopLevelArguments(
|
|
4003
|
+
source.slice(openIndex + 1, closeIndex),
|
|
4004
|
+
);
|
|
4005
|
+
const options = args[1]?.trim();
|
|
4006
|
+
if (!options?.startsWith("{") || !options.endsWith("}")) continue;
|
|
4007
|
+
|
|
4008
|
+
const eventProperty = splitTopLevelArguments(options.slice(1, -1)).find(
|
|
4009
|
+
(property) => /^\s*event\s*:/.test(property),
|
|
4010
|
+
);
|
|
4011
|
+
const eventName = /^\s*event\s*:\s*([A-Za-z_$][\w$]*)/.exec(
|
|
4012
|
+
eventProperty ?? "",
|
|
4013
|
+
)?.[1];
|
|
4014
|
+
if (eventName) listened.add(eventName);
|
|
3947
4015
|
}
|
|
3948
4016
|
}
|
|
3949
4017
|
|
|
@@ -4690,7 +4758,7 @@ async function inspectTenantScopeRepositoryDrift(
|
|
|
4690
4758
|
file: portFile,
|
|
4691
4759
|
message: `${portFile} declares tenant-owned repository methods (${rawBoundaries.join(
|
|
4692
4760
|
", ",
|
|
4693
|
-
)}) with raw tenant IDs. Use TenantScope at app-facing repository boundaries and unwrap it with tenantScopeId(scope) inside ${repositoryFile}; keep provider-correlation lookups separate from authorization.`,
|
|
4761
|
+
)}) with raw tenant or workspace IDs. Use TenantScope at app-facing repository boundaries and unwrap it with tenantScopeId(scope) inside ${repositoryFile}; keep provider-correlation lookups separate from authorization.`,
|
|
4694
4762
|
});
|
|
4695
4763
|
continue;
|
|
4696
4764
|
}
|
|
@@ -4832,9 +4900,7 @@ function rawTenantRepositoryMethodBoundaries(
|
|
|
4832
4900
|
for (const method of repositoryMethodSignatures(block)) {
|
|
4833
4901
|
if (isProviderCorrelationMethod(method.name)) continue;
|
|
4834
4902
|
|
|
4835
|
-
const rawColumns = tenantColumnsUsedInSource(method.params, tables)
|
|
4836
|
-
(column) => column.property === "tenantId",
|
|
4837
|
-
);
|
|
4903
|
+
const rawColumns = tenantColumnsUsedInSource(method.params, tables);
|
|
4838
4904
|
if (rawColumns.length === 0) continue;
|
|
4839
4905
|
|
|
4840
4906
|
rawMethods.push(method.name);
|
package/src/lint.ts
CHANGED
|
@@ -1123,6 +1123,8 @@ const serverRuntimePackages = new Set([
|
|
|
1123
1123
|
"@beignet/next",
|
|
1124
1124
|
"@beignet/core/openapi",
|
|
1125
1125
|
"@beignet/core/server",
|
|
1126
|
+
"@beignet/webhooks-github",
|
|
1127
|
+
"@beignet/webhooks-stripe",
|
|
1126
1128
|
]);
|
|
1127
1129
|
|
|
1128
1130
|
function appImportMessage(
|
|
@@ -1185,6 +1187,7 @@ function classifyPath(
|
|
|
1185
1187
|
const layerSegment = featurePath.split("/")[1];
|
|
1186
1188
|
if (layerSegment === "domain") return "domain";
|
|
1187
1189
|
if (layerSegment === "contracts") return "contract";
|
|
1190
|
+
if (layerSegment?.endsWith("-contracts")) return "contract";
|
|
1188
1191
|
if (layerSegment === "routes") return "route";
|
|
1189
1192
|
if (layerSegment === "ports") return "feature-port";
|
|
1190
1193
|
if (layerSegment === "policy") return "policy";
|
|
@@ -1205,13 +1208,22 @@ function classifyPath(
|
|
|
1205
1208
|
if (layerSegment === "client") return "client";
|
|
1206
1209
|
}
|
|
1207
1210
|
|
|
1208
|
-
if (
|
|
1211
|
+
if (
|
|
1212
|
+
directoryPath(config.paths.contracts) !== featuresPath &&
|
|
1213
|
+
isUnder(normalizedPath, directoryPath(config.paths.contracts))
|
|
1214
|
+
) {
|
|
1209
1215
|
return "contract";
|
|
1210
1216
|
}
|
|
1211
|
-
if (
|
|
1217
|
+
if (
|
|
1218
|
+
directoryPath(config.paths.useCases) !== featuresPath &&
|
|
1219
|
+
isUnder(normalizedPath, directoryPath(config.paths.useCases))
|
|
1220
|
+
) {
|
|
1212
1221
|
return "use-case";
|
|
1213
1222
|
}
|
|
1214
|
-
if (
|
|
1223
|
+
if (
|
|
1224
|
+
directoryPath(config.paths.policies) !== featuresPath &&
|
|
1225
|
+
isUnder(normalizedPath, directoryPath(config.paths.policies))
|
|
1226
|
+
) {
|
|
1215
1227
|
return "policy";
|
|
1216
1228
|
}
|
|
1217
1229
|
|
package/src/make/inbox.ts
CHANGED
|
@@ -856,8 +856,7 @@ export function inboxRoutesFile(config: ResolvedBeignetConfig): string {
|
|
|
856
856
|
path.join(config.paths.features, "inbox/use-cases/index.ts"),
|
|
857
857
|
);
|
|
858
858
|
|
|
859
|
-
return `import { defineRouteGroup } from "
|
|
860
|
-
import type { AppContext } from "${aliasModule(config.paths.appContext)}";
|
|
859
|
+
return `import { defineRouteGroup } from "${aliasModule(config.paths.routesBuilder)}";
|
|
861
860
|
import {
|
|
862
861
|
\tlistInbox,
|
|
863
862
|
\tmarkAllRead,
|
|
@@ -871,7 +870,7 @@ import {
|
|
|
871
870
|
\tmarkReadUseCase,
|
|
872
871
|
} from "${useCasesModule}";
|
|
873
872
|
|
|
874
|
-
export const inboxRoutes = defineRouteGroup
|
|
873
|
+
export const inboxRoutes = defineRouteGroup({
|
|
875
874
|
\tname: "inbox",
|
|
876
875
|
\troutes: [
|
|
877
876
|
\t\t{ contract: listInbox, useCase: listInboxUseCase },
|
|
@@ -1114,7 +1113,7 @@ export function inboxTestFile(config: ResolvedBeignetConfig): string {
|
|
|
1114
1113
|
return `import { describe, expect, it } from "@/lib/beignet-test";
|
|
1115
1114
|
import { createUseCaseTester } from "@beignet/core/application";
|
|
1116
1115
|
import { createAnonymousActor } from "@beignet/core/ports";
|
|
1117
|
-
import { createTestUserActor } from "@beignet/core/
|
|
1116
|
+
import { createTestUserActor } from "@beignet/core/testing";
|
|
1118
1117
|
import {
|
|
1119
1118
|
\tcreateTestContextFactory,
|
|
1120
1119
|
\tcreateTestPorts,
|
|
@@ -1295,7 +1294,7 @@ export function inboxChannelTestFile(config: ResolvedBeignetConfig): string {
|
|
|
1295
1294
|
);
|
|
1296
1295
|
|
|
1297
1296
|
return `import { describe, expect, it } from "@/lib/beignet-test";
|
|
1298
|
-
import { createTestSystemActor } from "@beignet/core/
|
|
1297
|
+
import { createTestSystemActor } from "@beignet/core/testing";
|
|
1299
1298
|
import {
|
|
1300
1299
|
\tcreateTestContextFactory,
|
|
1301
1300
|
\tcreateTestPorts,
|
package/src/make/payments.ts
CHANGED
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
planGeneratedFiles,
|
|
32
32
|
type ResourceNames,
|
|
33
33
|
readOptionalFile,
|
|
34
|
-
relativeModule,
|
|
35
34
|
resourceNames,
|
|
36
35
|
resourceSharedErrorsPath,
|
|
37
36
|
seedEntrypointPath,
|
|
@@ -206,7 +205,7 @@ export function makePaymentsNextStepLines(
|
|
|
206
205
|
: [
|
|
207
206
|
"Run your db:seed package script to create the demo billing account.",
|
|
208
207
|
]),
|
|
209
|
-
"Use createMemoryPaymentsProvider() for local development, then swap server/providers.ts to
|
|
208
|
+
"Use createMemoryPaymentsProvider() for local development, then swap server/providers.ts to createStripePaymentsProvider() when STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET are configured.",
|
|
210
209
|
"Billing accounts fall back to the user id today; after beignet make tenancy they become workspace-scoped automatically.",
|
|
211
210
|
"Run your app's test, lint, and typecheck commands, then beignet lint and beignet doctor.",
|
|
212
211
|
];
|
|
@@ -1375,14 +1374,11 @@ export const handlePaymentWebhookUseCase = useCase
|
|
|
1375
1374
|
}
|
|
1376
1375
|
|
|
1377
1376
|
export function billingRoutesFile(config: ResolvedBeignetConfig): string {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
return `import { defineRouteGroup } from "@beignet/next";
|
|
1381
|
-
import type { AppContext } from "${relativeModule(routeFilePath, config.paths.appContext)}";
|
|
1377
|
+
return `import { defineRouteGroup } from "${aliasModule(config.paths.routesBuilder)}";
|
|
1382
1378
|
import * as billingContracts from "@/features/billing/contracts";
|
|
1383
1379
|
import * as billingUseCases from "@/features/billing/use-cases";
|
|
1384
1380
|
|
|
1385
|
-
export const billingRoutes = defineRouteGroup
|
|
1381
|
+
export const billingRoutes = defineRouteGroup({
|
|
1386
1382
|
\tname: "billing",
|
|
1387
1383
|
\troutes: [
|
|
1388
1384
|
\t\t{
|
|
@@ -1407,7 +1403,7 @@ export function billingTestFile(config: ResolvedBeignetConfig): string {
|
|
|
1407
1403
|
import { createUseCaseTester } from "@beignet/core/application";
|
|
1408
1404
|
import { requireEntitlement } from "@beignet/core/entitlements";
|
|
1409
1405
|
import { createAnonymousActor, createTenant } from "@beignet/core/ports";
|
|
1410
|
-
import { createTestUserActor } from "@beignet/core/
|
|
1406
|
+
import { createTestUserActor } from "@beignet/core/testing";
|
|
1411
1407
|
import { createTenantScope, tenantScopeId } from "@beignet/core/tenancy";
|
|
1412
1408
|
import {
|
|
1413
1409
|
\tcreateTestContextFactory,
|
package/src/make/shared.ts
CHANGED
|
@@ -301,7 +301,7 @@ export function eventBusPortWiring(command: string): PortProviderWiring {
|
|
|
301
301
|
portKey: "eventBus",
|
|
302
302
|
portType: "EventBusPort",
|
|
303
303
|
portTypeModule: "@beignet/core/ports",
|
|
304
|
-
providerFactory: "
|
|
304
|
+
providerFactory: "createMemoryEventBusProvider",
|
|
305
305
|
providerModule: "@beignet/provider-event-bus-memory",
|
|
306
306
|
dependency: "@beignet/provider-event-bus-memory",
|
|
307
307
|
};
|
package/src/make/tenancy.ts
CHANGED
|
@@ -2041,13 +2041,7 @@ export const WorkspaceInviteNotification = defineNotification(
|
|
|
2041
2041
|
}
|
|
2042
2042
|
|
|
2043
2043
|
export function tenancyRoutesFile(config: ResolvedBeignetConfig): string {
|
|
2044
|
-
|
|
2045
|
-
config.paths.features,
|
|
2046
|
-
"workspaces/routes.ts",
|
|
2047
|
-
);
|
|
2048
|
-
|
|
2049
|
-
return `import { defineRouteGroup } from "@beignet/next";
|
|
2050
|
-
import type { AppContext } from "${relativeModule(routeFilePath, config.paths.appContext)}";
|
|
2044
|
+
return `import { defineRouteGroup } from "${aliasModule(config.paths.routesBuilder)}";
|
|
2051
2045
|
import * as workspaceContracts from "@/features/workspaces/contracts";
|
|
2052
2046
|
import * as workspaceUseCases from "@/features/workspaces/use-cases";
|
|
2053
2047
|
import { WORKSPACE_COOKIE_NAME } from "@/lib/tenant";
|
|
@@ -2064,7 +2058,7 @@ function workspaceCookie(workspaceId: string): string {
|
|
|
2064
2058
|
\t].join("; ");
|
|
2065
2059
|
}
|
|
2066
2060
|
|
|
2067
|
-
export const workspaceRoutes = defineRouteGroup
|
|
2061
|
+
export const workspaceRoutes = defineRouteGroup({
|
|
2068
2062
|
\tname: "workspaces",
|
|
2069
2063
|
\troutes: [
|
|
2070
2064
|
\t\t{
|
|
@@ -2263,7 +2257,7 @@ export function tenancyContextFactoryFile(
|
|
|
2263
2257
|
import {
|
|
2264
2258
|
\tcreateTestAnonymousActor,
|
|
2265
2259
|
\tcreateTestUserActor,
|
|
2266
|
-
} from "@beignet/core/
|
|
2260
|
+
} from "@beignet/core/testing";
|
|
2267
2261
|
import {
|
|
2268
2262
|
\tcreateTestContextFactory,
|
|
2269
2263
|
\tcreateTestPorts,
|
|
@@ -3134,7 +3128,7 @@ describe("revokeInviteUseCase", () => {
|
|
|
3134
3128
|
|
|
3135
3129
|
export function policyTestFile(): string {
|
|
3136
3130
|
return `import { describe, expect, it } from "@/lib/beignet-test";
|
|
3137
|
-
import { createPolicyTester } from "@beignet/core/
|
|
3131
|
+
import { createPolicyTester } from "@beignet/core/testing";
|
|
3138
3132
|
import { workspacePolicy } from "@/features/workspaces/policy";
|
|
3139
3133
|
import { workspaceFactory } from "./factories/workspace";
|
|
3140
3134
|
|
package/src/make.ts
CHANGED
|
@@ -4501,7 +4501,7 @@ function useCaseTestFile(
|
|
|
4501
4501
|
import { createUseCaseTester } from "@beignet/core/application";
|
|
4502
4502
|
import { createInMemoryDevtools } from "@beignet/devtools";
|
|
4503
4503
|
import { createTestContextFactory, createTestPorts } from "@beignet/core/testing";
|
|
4504
|
-
import { createTestAnonymousActor } from "@beignet/core/
|
|
4504
|
+
import { createTestAnonymousActor } from "@beignet/core/testing";
|
|
4505
4505
|
import type { AppContext } from "${aliasModule(config.paths.appContext)}";
|
|
4506
4506
|
import { appPorts } from "${aliasModule(config.paths.infrastructurePorts)}";
|
|
4507
4507
|
import { ${names.exportName} } from "${relativeModule(filePath, useCaseFilePath(names, config))}";
|
|
@@ -4670,7 +4670,7 @@ function resourcePolicyTestFile(
|
|
|
4670
4670
|
options: ResourceGenerationOptions,
|
|
4671
4671
|
): string {
|
|
4672
4672
|
return `import { describe, expect, it } from "@/lib/beignet-test";
|
|
4673
|
-
import { createPolicyTester } from "@beignet/core/
|
|
4673
|
+
import { createPolicyTester } from "@beignet/core/testing";
|
|
4674
4674
|
import { ${names.singularCamel}Policy } from "../policy";
|
|
4675
4675
|
import type { ${names.singularPascal} } from "../schemas";
|
|
4676
4676
|
|
|
@@ -4871,8 +4871,8 @@ function listenerFile(
|
|
|
4871
4871
|
return `import { defineListener } from "${aliasModule(config.paths.listenersBuilder)}";
|
|
4872
4872
|
import { ${names.event.eventExportName} } from "${relativeModule(filePath, eventFilePath(names.event, config))}";
|
|
4873
4873
|
|
|
4874
|
-
export const ${names.listenerExportName} = defineListener(${names.
|
|
4875
|
-
\
|
|
4874
|
+
export const ${names.listenerExportName} = defineListener("${names.listenerName}", {
|
|
4875
|
+
\tevent: ${names.event.eventExportName},
|
|
4876
4876
|
\tasync handle({ payload, ctx }) {
|
|
4877
4877
|
\t\tctx.ports.logger.info("Listener handled", {
|
|
4878
4878
|
\t\t\tlistenerName: "${names.listenerName}",
|
|
@@ -5249,8 +5249,7 @@ function routeGroupFile(
|
|
|
5249
5249
|
const useCasesPath = resourceUseCaseIndexPath(names, config);
|
|
5250
5250
|
|
|
5251
5251
|
return `import "@beignet/core/server-only";
|
|
5252
|
-
import { defineRouteGroup } from "
|
|
5253
|
-
import type { AppContext } from "${relativeModule(routeFilePath, config.paths.appContext)}";
|
|
5252
|
+
import { defineRouteGroup } from "${relativeModule(routeFilePath, config.paths.routesBuilder)}";
|
|
5254
5253
|
import {
|
|
5255
5254
|
create${names.singularPascal},
|
|
5256
5255
|
${mode === "resource" ? ` delete${names.singularPascal},\n get${names.singularPascal},\n` : ""} list${names.pluralPascal},
|
|
@@ -5260,7 +5259,7 @@ import {
|
|
|
5260
5259
|
${mode === "resource" ? ` delete${names.singularPascal}UseCase,\n get${names.singularPascal}UseCase,\n` : ""} list${names.pluralPascal}UseCase,
|
|
5261
5260
|
${mode === "resource" ? ` update${names.singularPascal}UseCase,\n` : ""}} from "${relativeModule(routeFilePath, useCasesPath)}";
|
|
5262
5261
|
|
|
5263
|
-
export const ${names.singularCamel}Routes = defineRouteGroup
|
|
5262
|
+
export const ${names.singularCamel}Routes = defineRouteGroup({
|
|
5264
5263
|
name: "${names.pluralKebab}",
|
|
5265
5264
|
routes: [
|
|
5266
5265
|
{ contract: list${names.pluralPascal}, useCase: list${names.pluralPascal}UseCase },
|
|
@@ -5289,11 +5288,11 @@ function testFile(
|
|
|
5289
5288
|
|
|
5290
5289
|
return `import { describe, expect, it } from "@/lib/beignet-test";
|
|
5291
5290
|
import { createUseCaseTester } from "@beignet/core/application";
|
|
5292
|
-
${mode === "resource" ? `import { isAppError } from "@beignet/core/errors";\n` : ""}import { defineRoutes } from "@beignet/
|
|
5291
|
+
${mode === "resource" ? `import { isAppError } from "@beignet/core/errors";\n` : ""}import { defineRoutes } from "@beignet/core/server";
|
|
5293
5292
|
import { createTestApp } from "@beignet/web/testing";
|
|
5294
5293
|
import { createInMemoryDevtools } from "@beignet/devtools";
|
|
5295
5294
|
import { createTestContextFactory, createTestPorts } from "@beignet/core/testing";
|
|
5296
|
-
import { ${options.auth ? "createTestUserActor" : "createTestAnonymousActor"}${options.tenant ? ", createTestTenant" : ""} } from "@beignet/core/
|
|
5295
|
+
import { ${options.auth ? "createTestUserActor" : "createTestAnonymousActor"}${options.tenant ? ", createTestTenant" : ""} } from "@beignet/core/testing";
|
|
5297
5296
|
import type { AppContext } from "${aliasModule(config.paths.appContext)}";
|
|
5298
5297
|
import { appPorts } from "${aliasModule(config.paths.infrastructurePorts)}";
|
|
5299
5298
|
import { appContext } from "${aliasModule(serverContextPath)}";
|