@beignet/cli 0.0.23 → 0.0.25
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 +28 -0
- package/README.md +55 -6
- package/dist/config.d.ts +21 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +51 -0
- package/dist/config.js.map +1 -1
- package/dist/db.d.ts +30 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +201 -1
- package/dist/db.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +109 -0
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +238 -235
- package/dist/inspect.js.map +1 -1
- package/dist/make.js +16 -15
- package/dist/make.js.map +1 -1
- package/dist/provider-audit.d.ts +131 -0
- package/dist/provider-audit.d.ts.map +1 -0
- package/dist/provider-audit.js +1013 -0
- package/dist/provider-audit.js.map +1 -0
- package/dist/templates/base.d.ts.map +1 -1
- package/dist/templates/base.js +3 -2
- package/dist/templates/base.js.map +1 -1
- package/dist/templates/db/mysql.js +2 -2
- package/dist/templates/db/postgres.js +2 -2
- package/dist/templates/db/sqlite.js +2 -2
- 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 +90 -20
- package/dist/templates/server.js.map +1 -1
- package/dist/templates/todos.js +5 -5
- package/package.json +2 -2
- package/skills/app-structure/SKILL.md +22 -4
- package/src/config.ts +99 -0
- package/src/db.ts +316 -1
- package/src/index.ts +180 -1
- package/src/inspect.ts +412 -369
- package/src/make.ts +16 -15
- package/src/provider-audit.ts +1681 -0
- package/src/templates/base.ts +3 -2
- package/src/templates/db/mysql.ts +2 -2
- package/src/templates/db/postgres.ts +2 -2
- package/src/templates/db/sqlite.ts +2 -2
- package/src/templates/index.ts +1 -0
- package/src/templates/server.ts +90 -20
- package/src/templates/todos.ts +5 -5
package/src/make.ts
CHANGED
|
@@ -7188,7 +7188,7 @@ function listUseCaseFile(
|
|
|
7188
7188
|
`list-${names.pluralKebab}.ts`,
|
|
7189
7189
|
);
|
|
7190
7190
|
|
|
7191
|
-
return `import
|
|
7191
|
+
return `import "@beignet/core/server-only";
|
|
7192
7192
|
import { normalizeCursorPage } from "@beignet/core/pagination";
|
|
7193
7193
|
import { useCase } from "${relativeModule(filePath, config.paths.useCaseBuilder)}";
|
|
7194
7194
|
import {
|
|
@@ -7228,7 +7228,7 @@ function createUseCaseFile(
|
|
|
7228
7228
|
`create-${names.singularKebab}.ts`,
|
|
7229
7229
|
);
|
|
7230
7230
|
|
|
7231
|
-
return `import
|
|
7231
|
+
return `import "@beignet/core/server-only";
|
|
7232
7232
|
import { useCase } from "${relativeModule(filePath, config.paths.useCaseBuilder)}";
|
|
7233
7233
|
import {
|
|
7234
7234
|
Create${names.singularPascal}InputSchema,
|
|
@@ -7260,7 +7260,7 @@ function getUseCaseFile(
|
|
|
7260
7260
|
`get-${names.singularKebab}.ts`,
|
|
7261
7261
|
);
|
|
7262
7262
|
|
|
7263
|
-
return `import
|
|
7263
|
+
return `import "@beignet/core/server-only";
|
|
7264
7264
|
import { appError } from "${relativeModule(filePath, resourceSharedErrorsPath(config))}";
|
|
7265
7265
|
import { useCase } from "${relativeModule(filePath, config.paths.useCaseBuilder)}";
|
|
7266
7266
|
import {
|
|
@@ -7295,7 +7295,7 @@ function updateUseCaseFile(
|
|
|
7295
7295
|
`update-${names.singularKebab}.ts`,
|
|
7296
7296
|
);
|
|
7297
7297
|
|
|
7298
|
-
return `import
|
|
7298
|
+
return `import "@beignet/core/server-only";
|
|
7299
7299
|
import { appError } from "${relativeModule(filePath, resourceSharedErrorsPath(config))}";
|
|
7300
7300
|
import { useCase } from "${relativeModule(filePath, config.paths.useCaseBuilder)}";
|
|
7301
7301
|
${options.events ? `import { ${names.singularPascal}Updated } from "../domain/events";\n` : ""}import {
|
|
@@ -7344,7 +7344,7 @@ function deleteUseCaseFile(
|
|
|
7344
7344
|
`delete-${names.singularKebab}.ts`,
|
|
7345
7345
|
);
|
|
7346
7346
|
|
|
7347
|
-
return `import
|
|
7347
|
+
return `import "@beignet/core/server-only";
|
|
7348
7348
|
import { z } from "zod";
|
|
7349
7349
|
import { appError } from "${relativeModule(filePath, resourceSharedErrorsPath(config))}";
|
|
7350
7350
|
import { useCase } from "${relativeModule(filePath, config.paths.useCaseBuilder)}";
|
|
@@ -7454,7 +7454,7 @@ function inMemoryRepositoryFile(
|
|
|
7454
7454
|
return true;`
|
|
7455
7455
|
: `${options.tenant ? `\t\t\tconst existing = ${names.pluralCamel}.get(id);\n\t\t\tif (existing?.tenantId !== filter.tenantId) return false;\n` : ""} return ${names.pluralCamel}.delete(id);`;
|
|
7456
7456
|
|
|
7457
|
-
return `import
|
|
7457
|
+
return `import "@beignet/core/server-only";
|
|
7458
7458
|
import { cursorPageResult } from "@beignet/core/pagination";
|
|
7459
7459
|
import type { ${names.singularPascal}Repository } from "${aliasModule(repositoryPortPath)}";
|
|
7460
7460
|
import { encode${names.singularPascal}Cursor } from "${aliasModule(resourceSchemaFilePath(names, config))}";
|
|
@@ -7833,7 +7833,7 @@ ${options.softDelete ? `\t\t\tconst now = new Date().toISOString();\n\t\t\tconst
|
|
|
7833
7833
|
},
|
|
7834
7834
|
`;
|
|
7835
7835
|
|
|
7836
|
-
return `import
|
|
7836
|
+
return `import "@beignet/core/server-only";
|
|
7837
7837
|
import { cursorPageResult } from "@beignet/core/pagination";
|
|
7838
7838
|
import type { ${dialect.dbTypeName} } from "@beignet/provider-db-drizzle/${dialect.subpath}";
|
|
7839
7839
|
import { ${drizzleImports.join(", ")} } from "drizzle-orm";
|
|
@@ -8068,7 +8068,7 @@ function standaloneUseCaseFile(
|
|
|
8068
8068
|
config: ResolvedBeignetConfig,
|
|
8069
8069
|
filePath: string,
|
|
8070
8070
|
): string {
|
|
8071
|
-
return `import
|
|
8071
|
+
return `import "@beignet/core/server-only";
|
|
8072
8072
|
import { z } from "zod";
|
|
8073
8073
|
import { useCase } from "${relativeModule(filePath, config.paths.useCaseBuilder)}";
|
|
8074
8074
|
|
|
@@ -10101,7 +10101,7 @@ function routeGroupFile(
|
|
|
10101
10101
|
const contractsPath = resourceContractFilePath(names, config);
|
|
10102
10102
|
const useCasesPath = resourceUseCaseIndexPath(names, config);
|
|
10103
10103
|
|
|
10104
|
-
return `import
|
|
10104
|
+
return `import "@beignet/core/server-only";
|
|
10105
10105
|
import { defineRouteGroup } from "@beignet/next";
|
|
10106
10106
|
import type { AppContext } from "${relativeModule(routeFilePath, config.paths.appContext)}";
|
|
10107
10107
|
import {
|
|
@@ -10138,12 +10138,12 @@ function testFile(
|
|
|
10138
10138
|
path.dirname(config.paths.server),
|
|
10139
10139
|
"context.ts",
|
|
10140
10140
|
);
|
|
10141
|
-
const requestTarget =
|
|
10141
|
+
const requestTarget = "app";
|
|
10142
10142
|
|
|
10143
10143
|
return `import { describe, expect, it } from "bun:test";
|
|
10144
10144
|
import { createUseCaseTester } from "@beignet/core/application";
|
|
10145
10145
|
${mode === "resource" ? `import { isAppError } from "@beignet/core/errors";\n` : ""}import { defineRoutes } from "@beignet/web";
|
|
10146
|
-
import { createTestApp
|
|
10146
|
+
import { createTestApp } from "@beignet/web/testing";
|
|
10147
10147
|
import { createInMemoryDevtools } from "@beignet/devtools";
|
|
10148
10148
|
import { createTestContextFactory, createTestPorts } from "@beignet/core/testing";
|
|
10149
10149
|
import { ${options.auth ? "createTestUserActor" : "createTestAnonymousActor"}${options.tenant ? ", createTestTenant" : ""} } from "@beignet/core/ports/testing";
|
|
@@ -10192,13 +10192,15 @@ ${options.tenant ? `\t\t\t{\n\t\t\t\tid: "00000000-0000-4000-8000-000000000104",
|
|
|
10192
10192
|
overrides: {
|
|
10193
10193
|
${names.pluralCamel},
|
|
10194
10194
|
${
|
|
10195
|
-
options.auth
|
|
10195
|
+
options.auth || options.tenant
|
|
10196
10196
|
? `\t\t\t\tauth: {
|
|
10197
10197
|
getSession: async () => ({
|
|
10198
|
-
user: { id: "user_test", name: "Test User" },
|
|
10198
|
+
user: { id: "user_test", name: "Test User"${options.tenant ? `, tenantId: "tenant_test"` : ""} },
|
|
10199
|
+
${options.tenant ? `\t\t\t\t\t\tsession: { tenantId: "tenant_test" },\n` : ""}
|
|
10199
10200
|
}),
|
|
10200
10201
|
},
|
|
10201
|
-
|
|
10202
|
+
${options.auth ? `\t\t\t\tgate: appPorts.gate,\n` : ""}
|
|
10203
|
+
`
|
|
10202
10204
|
: `\t\t\t\tauth: {
|
|
10203
10205
|
getSession: async () => null,
|
|
10204
10206
|
},\n`
|
|
@@ -10348,7 +10350,6 @@ ${
|
|
|
10348
10350
|
routes: defineRoutes<AppContext>([${names.singularCamel}Routes]),
|
|
10349
10351
|
context: appContext,
|
|
10350
10352
|
});
|
|
10351
|
-
${options.tenant ? `\t\tconst requester = createTestRequester(app, {\n\t\t\theaders: { "x-tenant-id": "tenant_test" },\n\t\t});\n` : ""}
|
|
10352
10353
|
const createdViaRoute = await ${requestTarget}.request(create${names.singularPascal}, {
|
|
10353
10354
|
body: { name: "Second ${names.singularPascal}" },
|
|
10354
10355
|
});
|