mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
fix adapters, handle entity enum more gracefully
This commit is contained in:
@@ -142,6 +142,7 @@ const adapters = {
|
|||||||
},
|
},
|
||||||
nextjs: {
|
nextjs: {
|
||||||
dir: path.join(basePath, "examples/nextjs"),
|
dir: path.join(basePath, "examples/nextjs"),
|
||||||
|
env: "TEST_TIMEOUT=20000",
|
||||||
clean: async function () {
|
clean: async function () {
|
||||||
const cwd = path.relative(process.cwd(), this.dir);
|
const cwd = path.relative(process.cwd(), this.dir);
|
||||||
await $`cd ${cwd} && rm -rf .nextjs data.db`;
|
await $`cd ${cwd} && rm -rf .nextjs data.db`;
|
||||||
@@ -195,7 +196,8 @@ async function testAdapter(name: keyof typeof adapters) {
|
|||||||
console.log("proc:", proc.pid, "data:", c.cyan(data));
|
console.log("proc:", proc.pid, "data:", c.cyan(data));
|
||||||
//proc.kill();process.exit(0);
|
//proc.kill();process.exit(0);
|
||||||
|
|
||||||
await $`TEST_URL=${data} TEST_ADAPTER=${name} bun run test:e2e`;
|
const add_env = "env" in config && config.env ? config.env : "";
|
||||||
|
await $`TEST_URL=${data} TEST_ADAPTER=${name} ${add_env} bun run test:e2e`;
|
||||||
console.log("DONE!");
|
console.log("DONE!");
|
||||||
|
|
||||||
while (!proc.killed) {
|
while (!proc.killed) {
|
||||||
@@ -205,6 +207,8 @@ async function testAdapter(name: keyof typeof adapters) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// run with: TEST_ADAPTER=astro bun run e2e/adapters.ts
|
||||||
|
// (modify `test:e2e` to `test:e2e:ui` to see the UI)
|
||||||
if (process.env.TEST_ADAPTER) {
|
if (process.env.TEST_ADAPTER) {
|
||||||
await testAdapter(process.env.TEST_ADAPTER as any);
|
await testAdapter(process.env.TEST_ADAPTER as any);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"bin": "./dist/cli/index.js",
|
"bin": "./dist/cli/index.js",
|
||||||
"version": "0.14.0-rc.2",
|
"version": "0.14.0",
|
||||||
"description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.",
|
"description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.",
|
||||||
"homepage": "https://bknd.io",
|
"homepage": "https://bknd.io",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -70,8 +70,7 @@
|
|||||||
"oauth4webapi": "^2.11.1",
|
"oauth4webapi": "^2.11.1",
|
||||||
"object-path-immutable": "^4.1.2",
|
"object-path-immutable": "^4.1.2",
|
||||||
"radix-ui": "^1.1.3",
|
"radix-ui": "^1.1.3",
|
||||||
"swr": "^2.3.3",
|
"swr": "^2.3.3"
|
||||||
"uuid": "^11.1.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.758.0",
|
"@aws-sdk/client-s3": "^3.758.0",
|
||||||
@@ -121,6 +120,7 @@
|
|||||||
"tsc-alias": "^1.8.11",
|
"tsc-alias": "^1.8.11",
|
||||||
"tsup": "^8.4.0",
|
"tsup": "^8.4.0",
|
||||||
"tsx": "^4.19.3",
|
"tsx": "^4.19.3",
|
||||||
|
"uuid": "^11.1.0",
|
||||||
"vite": "^6.3.5",
|
"vite": "^6.3.5",
|
||||||
"vite-tsconfig-paths": "^5.1.4",
|
"vite-tsconfig-paths": "^5.1.4",
|
||||||
"vitest": "^3.0.9",
|
"vitest": "^3.0.9",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { defineConfig, devices } from "@playwright/test";
|
|||||||
const baseUrl = process.env.TEST_URL || "http://localhost:28623";
|
const baseUrl = process.env.TEST_URL || "http://localhost:28623";
|
||||||
const startCommand = process.env.TEST_START_COMMAND || "bun run dev";
|
const startCommand = process.env.TEST_START_COMMAND || "bun run dev";
|
||||||
const autoStart = ["1", "true", undefined].includes(process.env.TEST_AUTO_START);
|
const autoStart = ["1", "true", undefined].includes(process.env.TEST_AUTO_START);
|
||||||
|
const timeout = process.env.TEST_TIMEOUT ? Number.parseInt(process.env.TEST_TIMEOUT) : 5000;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
testMatch: "**/*.e2e-spec.ts",
|
testMatch: "**/*.e2e-spec.ts",
|
||||||
@@ -12,7 +13,7 @@ export default defineConfig({
|
|||||||
retries: process.env.CI ? 2 : 0,
|
retries: process.env.CI ? 2 : 0,
|
||||||
workers: process.env.CI ? 1 : undefined,
|
workers: process.env.CI ? 1 : undefined,
|
||||||
reporter: "html",
|
reporter: "html",
|
||||||
timeout: 20000,
|
timeout,
|
||||||
use: {
|
use: {
|
||||||
baseURL: baseUrl,
|
baseURL: baseUrl,
|
||||||
trace: "on-first-retry",
|
trace: "on-first-retry",
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export function makeConfig<Env extends CloudflareEnv = CloudflareEnv>(
|
|||||||
args?: CfMakeConfigArgs<Env>,
|
args?: CfMakeConfigArgs<Env>,
|
||||||
) {
|
) {
|
||||||
if (!media_registered) {
|
if (!media_registered) {
|
||||||
registerMedia(args as any);
|
registerMedia(args?.env as any);
|
||||||
media_registered = true;
|
media_registered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export class Controller {
|
|||||||
|
|
||||||
protected getEntitiesEnum(em: EntityManager<any>) {
|
protected getEntitiesEnum(em: EntityManager<any>) {
|
||||||
const entities = em.entities.map((e) => e.name);
|
const entities = em.entities.map((e) => e.name);
|
||||||
return entities.length > 0 ? s.string({ enum: entities }) : s.string();
|
// @todo: current workaround to allow strings (sometimes building is not fast enough to get the entities)
|
||||||
|
return entities.length > 0 ? s.anyOf([s.string({ enum: entities }), s.string()]) : s.string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user