mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
Merge remote-tracking branch 'origin/release/0.10' into feat/add-postgres-and-prepare-others
# Conflicts: # app/package.json # bun.lock
This commit is contained in:
@@ -32,7 +32,7 @@ describe("MediaApi", () => {
|
||||
host,
|
||||
basepath,
|
||||
});
|
||||
expect(api.getFileUploadUrl({ path: "path" })).toBe(`${host}${basepath}/upload/path`);
|
||||
expect(api.getFileUploadUrl({ path: "path" } as any)).toBe(`${host}${basepath}/upload/path`);
|
||||
});
|
||||
|
||||
it("should have correct upload headers", () => {
|
||||
|
||||
@@ -7,8 +7,8 @@ describe("OAuthStrategy", async () => {
|
||||
const strategy = new OAuthStrategy({
|
||||
type: "oidc",
|
||||
client: {
|
||||
client_id: process.env.OAUTH_CLIENT_ID,
|
||||
client_secret: process.env.OAUTH_CLIENT_SECRET,
|
||||
client_id: process.env.OAUTH_CLIENT_ID!,
|
||||
client_secret: process.env.OAUTH_CLIENT_SECRET!,
|
||||
},
|
||||
name: "google",
|
||||
});
|
||||
@@ -19,11 +19,6 @@ describe("OAuthStrategy", async () => {
|
||||
const config = await strategy.getConfig();
|
||||
console.log("config", JSON.stringify(config, null, 2));
|
||||
|
||||
const request = await strategy.request({
|
||||
redirect_uri,
|
||||
state,
|
||||
});
|
||||
|
||||
const server = Bun.serve({
|
||||
fetch: async (req) => {
|
||||
const url = new URL(req.url);
|
||||
@@ -39,6 +34,11 @@ describe("OAuthStrategy", async () => {
|
||||
return new Response("Bun!");
|
||||
},
|
||||
});
|
||||
|
||||
const request = await strategy.request({
|
||||
redirect_uri,
|
||||
state,
|
||||
});
|
||||
console.log("request", request);
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 100000));
|
||||
|
||||
@@ -4,6 +4,9 @@ import Database from "libsql";
|
||||
import { format as sqlFormat } from "sql-formatter";
|
||||
import { type Connection, EntityManager, SqliteLocalConnection } from "../src/data";
|
||||
import type { em as protoEm } from "../src/data/prototype";
|
||||
import { writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { slugify } from "core/utils/strings";
|
||||
|
||||
export function getDummyDatabase(memory: boolean = true): {
|
||||
dummyDb: SqliteDatabase;
|
||||
@@ -71,3 +74,46 @@ export function schemaToEm(s: ReturnType<typeof protoEm>, conn?: Connection): En
|
||||
|
||||
export const assetsPath = `${import.meta.dir}/_assets`;
|
||||
export const assetsTmpPath = `${import.meta.dir}/_assets/tmp`;
|
||||
|
||||
export async function enableFetchLogging() {
|
||||
const originalFetch = global.fetch;
|
||||
|
||||
global.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const response = await originalFetch(input, init);
|
||||
const url = input instanceof URL || typeof input === "string" ? input : input.url;
|
||||
|
||||
// Only clone if it's a supported content type
|
||||
const contentType = response.headers.get("content-type") || "";
|
||||
const isSupported =
|
||||
contentType.includes("json") ||
|
||||
contentType.includes("text") ||
|
||||
contentType.includes("xml");
|
||||
|
||||
if (isSupported) {
|
||||
const clonedResponse = response.clone();
|
||||
let extension = "txt";
|
||||
let body: string;
|
||||
|
||||
if (contentType.includes("json")) {
|
||||
body = JSON.stringify(await clonedResponse.json(), null, 2);
|
||||
extension = "json";
|
||||
} else if (contentType.includes("xml")) {
|
||||
body = await clonedResponse.text();
|
||||
extension = "xml";
|
||||
} else {
|
||||
body = await clonedResponse.text();
|
||||
}
|
||||
|
||||
const fileName = `${new Date().getTime()}_${init?.method ?? "GET"}_${slugify(String(url))}.${extension}`;
|
||||
const filePath = join(assetsTmpPath, fileName);
|
||||
|
||||
await writeFile(filePath, body);
|
||||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
|
||||
return () => {
|
||||
global.fetch = originalFetch;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ function makeName(ext: string) {
|
||||
return randomString(10) + "." + ext;
|
||||
}
|
||||
|
||||
/*beforeAll(disableConsoleLog);
|
||||
afterAll(enableConsoleLog);*/
|
||||
beforeAll(disableConsoleLog);
|
||||
afterAll(enableConsoleLog);
|
||||
|
||||
describe("MediaController", () => {
|
||||
test.only("accepts direct", async () => {
|
||||
@@ -56,9 +56,9 @@ describe("MediaController", () => {
|
||||
console.log(result);
|
||||
expect(result.name).toBe(name);
|
||||
|
||||
/*const destFile = Bun.file(assetsTmpPath + "/" + name);
|
||||
const destFile = Bun.file(assetsTmpPath + "/" + name);
|
||||
expect(destFile.exists()).resolves.toBe(true);
|
||||
await destFile.delete();*/
|
||||
await destFile.delete();
|
||||
});
|
||||
|
||||
test("accepts form data", async () => {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import { randomString } from "../../../src/core/utils";
|
||||
import { StorageS3Adapter } from "../../../src/media";
|
||||
|
||||
import { config } from "dotenv";
|
||||
//import { enableFetchLogging } from "../../helper";
|
||||
const dotenvOutput = config({ path: `${import.meta.dir}/../../../.env` });
|
||||
const { R2_ACCESS_KEY, R2_SECRET_ACCESS_KEY, R2_URL, AWS_ACCESS_KEY, AWS_SECRET_KEY, AWS_S3_URL } =
|
||||
dotenvOutput.parsed!;
|
||||
@@ -11,7 +12,17 @@ const { R2_ACCESS_KEY, R2_SECRET_ACCESS_KEY, R2_URL, AWS_ACCESS_KEY, AWS_SECRET_
|
||||
const ALL_TESTS = !!process.env.ALL_TESTS;
|
||||
console.log("ALL_TESTS?", ALL_TESTS);
|
||||
|
||||
describe.skipIf(true)("StorageS3Adapter", async () => {
|
||||
/*
|
||||
// @todo: preparation to mock s3 calls + replace fast-xml-parser
|
||||
let cleanup: () => void;
|
||||
beforeAll(async () => {
|
||||
cleanup = await enableFetchLogging();
|
||||
});
|
||||
afterAll(() => {
|
||||
cleanup();
|
||||
}); */
|
||||
|
||||
describe.skipIf(ALL_TESTS)("StorageS3Adapter", async () => {
|
||||
if (ALL_TESTS) return;
|
||||
|
||||
const versions = [
|
||||
@@ -66,7 +77,7 @@ describe.skipIf(true)("StorageS3Adapter", async () => {
|
||||
|
||||
test.skipIf(disabled("putObject"))("puts an object", async () => {
|
||||
objects = (await adapter.listObjects()).length;
|
||||
expect(await adapter.putObject(filename, file)).toBeString();
|
||||
expect(await adapter.putObject(filename, file as any)).toBeString();
|
||||
});
|
||||
|
||||
test.skipIf(disabled("listObjects"))("lists objects", async () => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { AuthController } from "../../src/auth/api/AuthController";
|
||||
import { em, entity, make, text } from "../../src/data";
|
||||
import { AppAuth, type ModuleBuildContext } from "../../src/modules";
|
||||
import { disableConsoleLog, enableConsoleLog } from "../helper";
|
||||
// @ts-ignore
|
||||
import { makeCtx, moduleTestSuite } from "./module-test-suite";
|
||||
|
||||
describe("AppAuth", () => {
|
||||
@@ -22,7 +23,7 @@ describe("AppAuth", () => {
|
||||
|
||||
const config = auth.toJSON();
|
||||
expect(config.jwt).toBeUndefined();
|
||||
expect(config.strategies.password.config).toBeUndefined();
|
||||
expect(config.strategies?.password?.config).toBeUndefined();
|
||||
});
|
||||
|
||||
test("enabling auth: generate secret", async () => {
|
||||
@@ -42,6 +43,7 @@ describe("AppAuth", () => {
|
||||
const auth = new AppAuth(
|
||||
{
|
||||
enabled: true,
|
||||
// @ts-ignore
|
||||
jwt: {
|
||||
secret: "123456",
|
||||
},
|
||||
@@ -75,7 +77,7 @@ describe("AppAuth", () => {
|
||||
|
||||
const { data: users } = await ctx.em.repository("users").findMany();
|
||||
expect(users.length).toBe(1);
|
||||
expect(users[0].email).toBe("some@body.com");
|
||||
expect(users[0]?.email).toBe("some@body.com");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -157,7 +159,7 @@ describe("AppAuth", () => {
|
||||
const authField = make(name, _authFieldProto as any);
|
||||
const field = users.field(name)!;
|
||||
for (const prop of props) {
|
||||
expect(field.config[prop]).toBe(authField.config[prop]);
|
||||
expect(field.config[prop]).toEqual(authField.config[prop]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ describe("ModuleManager", async () => {
|
||||
}).toJSON(),
|
||||
},
|
||||
},
|
||||
});
|
||||
}) as any;
|
||||
//const { version, ...json } = mm.toJSON() as any;
|
||||
|
||||
const c2 = getDummyConnection();
|
||||
@@ -73,7 +73,7 @@ describe("ModuleManager", async () => {
|
||||
}).toJSON(),
|
||||
},
|
||||
},
|
||||
};
|
||||
} as any;
|
||||
//const { version, ...json } = mm.toJSON() as any;
|
||||
|
||||
const { dummyConnection } = getDummyConnection();
|
||||
@@ -90,23 +90,20 @@ describe("ModuleManager", async () => {
|
||||
await mm2.build();
|
||||
|
||||
expect(stripMark(json)).toEqual(stripMark(mm2.configs()));
|
||||
expect(mm2.configs().data.entities.test).toBeDefined();
|
||||
expect(mm2.configs().data.entities.test.fields.content).toBeDefined();
|
||||
expect(mm2.get("data").toJSON().entities.test.fields.content).toBeDefined();
|
||||
expect(mm2.configs().data.entities?.test).toBeDefined();
|
||||
expect(mm2.configs().data.entities?.test?.fields?.content).toBeDefined();
|
||||
expect(mm2.get("data").toJSON().entities?.test?.fields?.content).toBeDefined();
|
||||
});
|
||||
|
||||
test("s4: config given, table exists, version outdated, migrate", async () => {
|
||||
const c = getDummyConnection();
|
||||
const mm = new ModuleManager(c.dummyConnection);
|
||||
await mm.build();
|
||||
const version = mm.version();
|
||||
const json = mm.configs();
|
||||
|
||||
const c2 = getDummyConnection();
|
||||
const db = c2.dummyConnection.kysely;
|
||||
const mm2 = new ModuleManager(c2.dummyConnection, {
|
||||
initial: { version: version - 1, ...json },
|
||||
});
|
||||
const mm2 = new ModuleManager(c2.dummyConnection);
|
||||
await mm2.syncConfigTable();
|
||||
|
||||
await db
|
||||
@@ -171,7 +168,7 @@ describe("ModuleManager", async () => {
|
||||
expect(mm2.configs().data.basepath).toBe("/api/data2");
|
||||
});
|
||||
|
||||
test("blank app, modify config", async () => {
|
||||
/*test("blank app, modify config", async () => {
|
||||
const { dummyConnection } = getDummyConnection();
|
||||
|
||||
const mm = new ModuleManager(dummyConnection);
|
||||
@@ -194,7 +191,7 @@ describe("ModuleManager", async () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
});*/
|
||||
|
||||
test("partial config given", async () => {
|
||||
const { dummyConnection } = getDummyConnection();
|
||||
@@ -212,13 +209,15 @@ describe("ModuleManager", async () => {
|
||||
expect(mm.version()).toBe(CURRENT_VERSION);
|
||||
expect(mm.built()).toBe(true);
|
||||
expect(mm.configs().auth.enabled).toBe(true);
|
||||
expect(mm.configs().data.entities.users).toBeDefined();
|
||||
expect(mm.configs().data.entities?.users).toBeDefined();
|
||||
});
|
||||
|
||||
test("partial config given, but db version exists", async () => {
|
||||
const c = getDummyConnection();
|
||||
const mm = new ModuleManager(c.dummyConnection);
|
||||
await mm.build();
|
||||
console.log("==".repeat(30));
|
||||
console.log("");
|
||||
const json = mm.configs();
|
||||
|
||||
const c2 = getDummyConnection();
|
||||
@@ -265,8 +264,8 @@ describe("ModuleManager", async () => {
|
||||
|
||||
override async build() {
|
||||
//console.log("building FailingModule", this.config);
|
||||
if (this.config.value < 0) {
|
||||
throw new Error("value must be positive");
|
||||
if (this.config.value && this.config.value < 0) {
|
||||
throw new Error("value must be positive, given: " + this.config.value);
|
||||
}
|
||||
this.setBuilt();
|
||||
}
|
||||
@@ -332,6 +331,7 @@ describe("ModuleManager", async () => {
|
||||
// @ts-ignore
|
||||
const f = mm.mutateConfigSafe("failing");
|
||||
|
||||
// @ts-ignore
|
||||
expect(f.set({ value: 2 })).resolves.toBeDefined();
|
||||
expect(mockOnUpdated).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -1,39 +1,44 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { type InitialModuleConfigs, createApp } from "../../../src";
|
||||
|
||||
import type { Kysely } from "kysely";
|
||||
import { type Kysely, sql } from "kysely";
|
||||
import { getDummyConnection } from "../../helper";
|
||||
import v7 from "./samples/v7.json";
|
||||
import v8 from "./samples/v8.json";
|
||||
import v8_2 from "./samples/v8-2.json";
|
||||
|
||||
// app expects migratable config to be present in database
|
||||
async function createVersionedApp(config: InitialModuleConfigs) {
|
||||
async function createVersionedApp(config: InitialModuleConfigs | any) {
|
||||
const { dummyConnection } = getDummyConnection();
|
||||
|
||||
if (!("version" in config)) throw new Error("config must have a version");
|
||||
const { version, ...rest } = config;
|
||||
|
||||
const app = createApp({ connection: dummyConnection });
|
||||
await app.build();
|
||||
const db = dummyConnection.kysely as Kysely<any>;
|
||||
await sql`CREATE TABLE "__bknd" (
|
||||
"id" integer not null primary key autoincrement,
|
||||
"version" integer,
|
||||
"type" text,
|
||||
"json" text,
|
||||
"created_at" datetime,
|
||||
"updated_at" datetime
|
||||
)`.execute(db);
|
||||
|
||||
const qb = app.modules.ctx().connection.kysely as Kysely<any>;
|
||||
const current = await qb
|
||||
.selectFrom("__bknd")
|
||||
.selectAll()
|
||||
.where("type", "=", "config")
|
||||
.executeTakeFirst();
|
||||
|
||||
await qb
|
||||
.updateTable("__bknd")
|
||||
.set("json", JSON.stringify(rest))
|
||||
.set("version", 7)
|
||||
.where("id", "=", current!.id)
|
||||
await db
|
||||
.insertInto("__bknd")
|
||||
.values({
|
||||
version,
|
||||
type: "config",
|
||||
created_at: new Date().toISOString(),
|
||||
json: JSON.stringify(rest),
|
||||
})
|
||||
.execute();
|
||||
|
||||
const app2 = createApp({
|
||||
const app = createApp({
|
||||
connection: dummyConnection,
|
||||
});
|
||||
await app2.build();
|
||||
return app2;
|
||||
await app.build();
|
||||
return app;
|
||||
}
|
||||
|
||||
describe("Migrations", () => {
|
||||
@@ -46,8 +51,8 @@ describe("Migrations", () => {
|
||||
|
||||
const app = await createVersionedApp(v7);
|
||||
|
||||
expect(app.version()).toBe(8);
|
||||
expect(app.toJSON(true).auth.strategies.password.enabled).toBe(true);
|
||||
expect(app.version()).toBeGreaterThan(7);
|
||||
expect(app.toJSON(true).auth.strategies?.password?.enabled).toBe(true);
|
||||
|
||||
const req = await app.server.request("/api/auth/password/register", {
|
||||
method: "POST",
|
||||
@@ -60,7 +65,17 @@ describe("Migrations", () => {
|
||||
}),
|
||||
});
|
||||
expect(req.ok).toBe(true);
|
||||
const res = await req.json();
|
||||
const res = (await req.json()) as any;
|
||||
expect(res.user.email).toBe("test@test.com");
|
||||
});
|
||||
|
||||
test("migration from 8 to 9", async () => {
|
||||
expect(v8.version).toBe(8);
|
||||
|
||||
const app = await createVersionedApp(v8);
|
||||
|
||||
expect(app.version()).toBeGreaterThan(8);
|
||||
// @ts-expect-error
|
||||
expect(app.toJSON(true).server.admin).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
709
app/__test__/modules/migrations/samples/v8-2.json
Normal file
709
app/__test__/modules/migrations/samples/v8-2.json
Normal file
@@ -0,0 +1,709 @@
|
||||
{
|
||||
"version": 8,
|
||||
"server": {
|
||||
"admin": {
|
||||
"basepath": "",
|
||||
"color_scheme": "light",
|
||||
"logo_return_path": "/"
|
||||
},
|
||||
"cors": {
|
||||
"origin": "*",
|
||||
"allow_methods": ["GET", "POST", "PATCH", "PUT", "DELETE"],
|
||||
"allow_headers": [
|
||||
"Content-Type",
|
||||
"Content-Length",
|
||||
"Authorization",
|
||||
"Accept"
|
||||
]
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"basepath": "/api/data",
|
||||
"entities": {
|
||||
"products": {
|
||||
"type": "regular",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": true,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"brand": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": true,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"currency": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"price": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"required": true,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"price_compare": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": ["table"]
|
||||
}
|
||||
},
|
||||
"url": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"html_config": {
|
||||
"element": "input"
|
||||
},
|
||||
"required": true,
|
||||
"fillable": true,
|
||||
"hidden": ["table"]
|
||||
}
|
||||
},
|
||||
"created_at": {
|
||||
"type": "date",
|
||||
"config": {
|
||||
"type": "date",
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": ["table"]
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"html_config": {
|
||||
"element": "textarea",
|
||||
"props": {
|
||||
"rows": 4
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": ["table"]
|
||||
}
|
||||
},
|
||||
"images": {
|
||||
"type": "media",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": ["update"],
|
||||
"hidden": false,
|
||||
"mime_types": [],
|
||||
"virtual": true,
|
||||
"entity": "products"
|
||||
}
|
||||
},
|
||||
"identifier": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"type": "jsonschema",
|
||||
"config": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "string"
|
||||
},
|
||||
"gender": {
|
||||
"type": "string"
|
||||
},
|
||||
"ai_description": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": ["string", "number"]
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": ["table"]
|
||||
}
|
||||
},
|
||||
"_likes": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"default_value": 0,
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "id",
|
||||
"sort_dir": "desc"
|
||||
}
|
||||
},
|
||||
"media": {
|
||||
"type": "system",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"path": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": true,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"folder": {
|
||||
"type": "boolean",
|
||||
"config": {
|
||||
"default_value": false,
|
||||
"hidden": true,
|
||||
"fillable": ["create"],
|
||||
"required": false
|
||||
}
|
||||
},
|
||||
"mime_type": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"size": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"scope": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"hidden": true,
|
||||
"fillable": ["create"],
|
||||
"required": false
|
||||
}
|
||||
},
|
||||
"etag": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"modified_at": {
|
||||
"type": "date",
|
||||
"config": {
|
||||
"type": "datetime",
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"reference": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"entity_id": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"type": "json",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"temporary": {
|
||||
"type": "boolean",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "id",
|
||||
"sort_dir": "desc"
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"type": "system",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"email": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": true,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"strategy": {
|
||||
"type": "enum",
|
||||
"config": {
|
||||
"options": {
|
||||
"type": "strings",
|
||||
"values": ["password"]
|
||||
},
|
||||
"required": true,
|
||||
"fillable": ["create"],
|
||||
"hidden": ["read", "table", "update", "form"]
|
||||
}
|
||||
},
|
||||
"strategy_value": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"fillable": ["create"],
|
||||
"hidden": ["read", "table", "update", "form"],
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"role": {
|
||||
"type": "enum",
|
||||
"config": {
|
||||
"options": {
|
||||
"type": "strings",
|
||||
"values": ["guest", "admin"]
|
||||
},
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"username": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"_boards": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"default_value": 0,
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "id",
|
||||
"sort_dir": "desc"
|
||||
}
|
||||
},
|
||||
"product_likes": {
|
||||
"type": "regular",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"created_at": {
|
||||
"type": "date",
|
||||
"config": {
|
||||
"type": "datetime",
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"users_id": {
|
||||
"type": "relation",
|
||||
"config": {
|
||||
"label": "User",
|
||||
"required": true,
|
||||
"reference": "users",
|
||||
"target": "users",
|
||||
"target_field": "id",
|
||||
"fillable": true,
|
||||
"hidden": false,
|
||||
"on_delete": "set null"
|
||||
}
|
||||
},
|
||||
"products_id": {
|
||||
"type": "relation",
|
||||
"config": {
|
||||
"label": "Product",
|
||||
"required": true,
|
||||
"reference": "products",
|
||||
"target": "products",
|
||||
"target_field": "id",
|
||||
"fillable": true,
|
||||
"hidden": false,
|
||||
"on_delete": "set null"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "id",
|
||||
"sort_dir": "desc",
|
||||
"name": "Product Likes"
|
||||
}
|
||||
},
|
||||
"boards": {
|
||||
"type": "regular",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"private": {
|
||||
"type": "boolean",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"users_id": {
|
||||
"type": "relation",
|
||||
"config": {
|
||||
"label": "Users",
|
||||
"required": true,
|
||||
"reference": "users",
|
||||
"target": "users",
|
||||
"target_field": "id",
|
||||
"fillable": true,
|
||||
"hidden": false,
|
||||
"on_delete": "set null"
|
||||
}
|
||||
},
|
||||
"images": {
|
||||
"type": "media",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": ["update"],
|
||||
"hidden": false,
|
||||
"mime_types": [],
|
||||
"virtual": true,
|
||||
"entity": "boards",
|
||||
"max_items": 5
|
||||
}
|
||||
},
|
||||
"cover": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"default_value": 0,
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"_products": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"default_value": 0,
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "id",
|
||||
"sort_dir": "desc"
|
||||
}
|
||||
},
|
||||
"boards_products": {
|
||||
"type": "generated",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"boards_id": {
|
||||
"type": "relation",
|
||||
"config": {
|
||||
"required": true,
|
||||
"reference": "boards",
|
||||
"target": "boards",
|
||||
"target_field": "id",
|
||||
"fillable": true,
|
||||
"hidden": false,
|
||||
"on_delete": "set null"
|
||||
}
|
||||
},
|
||||
"products_id": {
|
||||
"type": "relation",
|
||||
"config": {
|
||||
"required": true,
|
||||
"reference": "products",
|
||||
"target": "products",
|
||||
"target_field": "id",
|
||||
"fillable": true,
|
||||
"hidden": false,
|
||||
"on_delete": "set null"
|
||||
}
|
||||
},
|
||||
"manual": {
|
||||
"type": "boolean",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "id",
|
||||
"sort_dir": "desc"
|
||||
}
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"poly_products_media_images": {
|
||||
"type": "poly",
|
||||
"source": "products",
|
||||
"target": "media",
|
||||
"config": {
|
||||
"mappedBy": "images"
|
||||
}
|
||||
},
|
||||
"n1_product_likes_users": {
|
||||
"type": "n:1",
|
||||
"source": "product_likes",
|
||||
"target": "users",
|
||||
"config": {
|
||||
"mappedBy": "",
|
||||
"inversedBy": "",
|
||||
"required": true,
|
||||
"with_limit": 5
|
||||
}
|
||||
},
|
||||
"n1_product_likes_products": {
|
||||
"type": "n:1",
|
||||
"source": "product_likes",
|
||||
"target": "products",
|
||||
"config": {
|
||||
"mappedBy": "",
|
||||
"inversedBy": "",
|
||||
"required": true,
|
||||
"with_limit": 5
|
||||
}
|
||||
},
|
||||
"n1_boards_users": {
|
||||
"type": "n:1",
|
||||
"source": "boards",
|
||||
"target": "users",
|
||||
"config": {
|
||||
"mappedBy": "",
|
||||
"inversedBy": "",
|
||||
"required": true,
|
||||
"with_limit": 5
|
||||
}
|
||||
},
|
||||
"poly_boards_media_images": {
|
||||
"type": "poly",
|
||||
"source": "boards",
|
||||
"target": "media",
|
||||
"config": {
|
||||
"mappedBy": "images",
|
||||
"targetCardinality": 5
|
||||
}
|
||||
},
|
||||
"mn_boards_products_boards_products,boards_products": {
|
||||
"type": "m:n",
|
||||
"source": "boards",
|
||||
"target": "products",
|
||||
"config": {}
|
||||
}
|
||||
},
|
||||
"indices": {
|
||||
"idx_unique_media_path": {
|
||||
"entity": "media",
|
||||
"fields": ["path"],
|
||||
"unique": true
|
||||
},
|
||||
"idx_media_reference": {
|
||||
"entity": "media",
|
||||
"fields": ["reference"],
|
||||
"unique": false
|
||||
},
|
||||
"idx_unique_users_email": {
|
||||
"entity": "users",
|
||||
"fields": ["email"],
|
||||
"unique": true
|
||||
},
|
||||
"idx_users_strategy": {
|
||||
"entity": "users",
|
||||
"fields": ["strategy"],
|
||||
"unique": false
|
||||
},
|
||||
"idx_users_strategy_value": {
|
||||
"entity": "users",
|
||||
"fields": ["strategy_value"],
|
||||
"unique": false
|
||||
},
|
||||
"idx_product_likes_unique_products_id_users_id": {
|
||||
"entity": "product_likes",
|
||||
"fields": ["products_id", "users_id"],
|
||||
"unique": true
|
||||
},
|
||||
"idx_boards_products_unique_boards_id_products_id": {
|
||||
"entity": "boards_products",
|
||||
"fields": ["boards_id", "products_id"],
|
||||
"unique": true
|
||||
},
|
||||
"idx_media_entity_id": {
|
||||
"entity": "media",
|
||||
"fields": ["entity_id"],
|
||||
"unique": false
|
||||
},
|
||||
"idx_products_identifier": {
|
||||
"entity": "products",
|
||||
"fields": ["identifier"],
|
||||
"unique": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"auth": {
|
||||
"enabled": true,
|
||||
"basepath": "/api/auth",
|
||||
"entity_name": "users",
|
||||
"allow_register": true,
|
||||
"jwt": {
|
||||
"secret": "2wY76Z$JQg(3t?Wn8g,^ZqZhlmjNx<@uQjI!7i^XZBF11Xa1>zZK2??Y[D|]cc%k",
|
||||
"alg": "HS256",
|
||||
"fields": ["id", "email", "role"]
|
||||
},
|
||||
"cookie": {
|
||||
"path": "/",
|
||||
"sameSite": "lax",
|
||||
"secure": true,
|
||||
"httpOnly": true,
|
||||
"expires": 604800,
|
||||
"renew": true,
|
||||
"pathSuccess": "/",
|
||||
"pathLoggedOut": "/"
|
||||
},
|
||||
"strategies": {
|
||||
"password": {
|
||||
"enabled": true,
|
||||
"type": "password",
|
||||
"config": {
|
||||
"hashing": "sha256"
|
||||
}
|
||||
}
|
||||
},
|
||||
"roles": {
|
||||
"guest": {
|
||||
"is_default": true,
|
||||
"permissions": ["system.access.api", "data.entity.read"]
|
||||
},
|
||||
"admin": {
|
||||
"implicit_allow": true
|
||||
}
|
||||
},
|
||||
"guard": {
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"media": {
|
||||
"enabled": true,
|
||||
"basepath": "/api/media",
|
||||
"entity_name": "media",
|
||||
"storage": {},
|
||||
"adapter": {
|
||||
"type": "s3",
|
||||
"config": {
|
||||
"access_key": "123",
|
||||
"secret_access_key": "123",
|
||||
"url": "https://123.r2.cloudflarestorage.com/enly"
|
||||
}
|
||||
}
|
||||
},
|
||||
"flows": {
|
||||
"basepath": "/api/flows",
|
||||
"flows": {}
|
||||
}
|
||||
}
|
||||
598
app/__test__/modules/migrations/samples/v8.json
Normal file
598
app/__test__/modules/migrations/samples/v8.json
Normal file
@@ -0,0 +1,598 @@
|
||||
{
|
||||
"version": 8,
|
||||
"server": {
|
||||
"admin": {
|
||||
"basepath": "",
|
||||
"logo_return_path": "/",
|
||||
"color_scheme": "dark"
|
||||
},
|
||||
"cors": {
|
||||
"origin": "*",
|
||||
"allow_methods": ["GET", "POST", "PATCH", "PUT", "DELETE"],
|
||||
"allow_headers": [
|
||||
"Content-Type",
|
||||
"Content-Length",
|
||||
"Authorization",
|
||||
"Accept"
|
||||
]
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"basepath": "/api/data",
|
||||
"entities": {
|
||||
"posts": {
|
||||
"type": "regular",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": true,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"slug": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"html_config": {
|
||||
"element": "input"
|
||||
},
|
||||
"pattern": "^[a-z\\-\\_0-9]+$",
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false,
|
||||
"label": "Slug"
|
||||
}
|
||||
},
|
||||
"content": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"html_config": {
|
||||
"element": "textarea",
|
||||
"props": {
|
||||
"rows": 5
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": ["form"]
|
||||
}
|
||||
},
|
||||
"active": {
|
||||
"type": "boolean",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"images": {
|
||||
"type": "media",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": ["update"],
|
||||
"hidden": false,
|
||||
"mime_types": [],
|
||||
"virtual": true,
|
||||
"entity": "posts"
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"type": "jsonschema",
|
||||
"config": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"ui_schema": {
|
||||
"ui:options": {
|
||||
"orderable": false
|
||||
}
|
||||
},
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"users_id": {
|
||||
"type": "relation",
|
||||
"config": {
|
||||
"label": "Users",
|
||||
"required": false,
|
||||
"reference": "users",
|
||||
"target": "users",
|
||||
"target_field": "id",
|
||||
"fillable": true,
|
||||
"hidden": false,
|
||||
"on_delete": "set null"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "title",
|
||||
"sort_dir": "desc"
|
||||
}
|
||||
},
|
||||
"comments": {
|
||||
"type": "regular",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"content": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"created_at": {
|
||||
"type": "date",
|
||||
"config": {
|
||||
"type": "date",
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"posts_id": {
|
||||
"type": "relation",
|
||||
"config": {
|
||||
"label": "Posts",
|
||||
"required": true,
|
||||
"reference": "posts",
|
||||
"target": "posts",
|
||||
"target_field": "id",
|
||||
"fillable": true,
|
||||
"hidden": false,
|
||||
"on_delete": "set null"
|
||||
}
|
||||
},
|
||||
"users_id": {
|
||||
"type": "relation",
|
||||
"config": {
|
||||
"label": "Users",
|
||||
"required": true,
|
||||
"reference": "users",
|
||||
"target": "users",
|
||||
"target_field": "id",
|
||||
"fillable": true,
|
||||
"hidden": false,
|
||||
"on_delete": "set null"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "id",
|
||||
"sort_dir": "asc"
|
||||
}
|
||||
},
|
||||
"media": {
|
||||
"type": "system",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"path": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": true,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"folder": {
|
||||
"type": "boolean",
|
||||
"config": {
|
||||
"default_value": false,
|
||||
"hidden": true,
|
||||
"fillable": ["create"],
|
||||
"required": false
|
||||
}
|
||||
},
|
||||
"mime_type": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"size": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"scope": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"hidden": true,
|
||||
"fillable": ["create"],
|
||||
"required": false
|
||||
}
|
||||
},
|
||||
"etag": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"modified_at": {
|
||||
"type": "date",
|
||||
"config": {
|
||||
"type": "datetime",
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"reference": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"entity_id": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"type": "json",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "id",
|
||||
"sort_dir": "asc"
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"type": "system",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"email": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": true,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"strategy": {
|
||||
"type": "enum",
|
||||
"config": {
|
||||
"options": {
|
||||
"type": "strings",
|
||||
"values": ["password", "google"]
|
||||
},
|
||||
"required": true,
|
||||
"fillable": ["create"],
|
||||
"hidden": ["update", "form"]
|
||||
}
|
||||
},
|
||||
"strategy_value": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"fillable": ["create"],
|
||||
"hidden": ["read", "table", "update", "form"],
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"role": {
|
||||
"type": "enum",
|
||||
"config": {
|
||||
"options": {
|
||||
"type": "strings",
|
||||
"values": ["guest", "admin", "editor"]
|
||||
},
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"avatar": {
|
||||
"type": "media",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": ["update"],
|
||||
"hidden": false,
|
||||
"mime_types": [],
|
||||
"virtual": true,
|
||||
"entity": "users",
|
||||
"max_items": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "id",
|
||||
"sort_dir": "asc"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "regular",
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "primary",
|
||||
"config": {
|
||||
"fillable": false,
|
||||
"required": false,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"type": "text",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
"number": {
|
||||
"type": "number",
|
||||
"config": {
|
||||
"required": false,
|
||||
"fillable": true,
|
||||
"hidden": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort_field": "id",
|
||||
"sort_dir": "asc"
|
||||
}
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"n1_comments_posts": {
|
||||
"type": "n:1",
|
||||
"source": "comments",
|
||||
"target": "posts",
|
||||
"config": {
|
||||
"required": true,
|
||||
"with_limit": 5
|
||||
}
|
||||
},
|
||||
"poly_posts_media_images": {
|
||||
"type": "poly",
|
||||
"source": "posts",
|
||||
"target": "media",
|
||||
"config": {
|
||||
"mappedBy": "images"
|
||||
}
|
||||
},
|
||||
"n1_posts_users": {
|
||||
"type": "n:1",
|
||||
"source": "posts",
|
||||
"target": "users",
|
||||
"config": {
|
||||
"with_limit": 5
|
||||
}
|
||||
},
|
||||
"n1_comments_users": {
|
||||
"type": "n:1",
|
||||
"source": "comments",
|
||||
"target": "users",
|
||||
"config": {
|
||||
"required": true,
|
||||
"with_limit": 5
|
||||
}
|
||||
},
|
||||
"poly_users_media_avatar": {
|
||||
"type": "poly",
|
||||
"source": "users",
|
||||
"target": "media",
|
||||
"config": {
|
||||
"mappedBy": "avatar",
|
||||
"targetCardinality": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"indices": {
|
||||
"idx_unique_media_path": {
|
||||
"entity": "media",
|
||||
"fields": ["path"],
|
||||
"unique": true
|
||||
},
|
||||
"idx_unique_users_email": {
|
||||
"entity": "users",
|
||||
"fields": ["email"],
|
||||
"unique": true
|
||||
},
|
||||
"idx_users_strategy": {
|
||||
"entity": "users",
|
||||
"fields": ["strategy"],
|
||||
"unique": false
|
||||
},
|
||||
"idx_users_strategy_value": {
|
||||
"entity": "users",
|
||||
"fields": ["strategy_value"],
|
||||
"unique": false
|
||||
},
|
||||
"idx_media_reference": {
|
||||
"entity": "media",
|
||||
"fields": ["reference"],
|
||||
"unique": false
|
||||
},
|
||||
"idx_media_entity_id": {
|
||||
"entity": "media",
|
||||
"fields": ["entity_id"],
|
||||
"unique": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"auth": {
|
||||
"enabled": true,
|
||||
"basepath": "/api/auth",
|
||||
"entity_name": "users",
|
||||
"jwt": {
|
||||
"secret": "A%3jk*wD!Zruj123123123j$Wm8qS8m8qS8",
|
||||
"alg": "HS256",
|
||||
"fields": ["id", "email", "role"],
|
||||
"issuer": "showoff"
|
||||
},
|
||||
"guard": {
|
||||
"enabled": true
|
||||
},
|
||||
"strategies": {
|
||||
"password": {
|
||||
"enabled": true,
|
||||
"type": "password",
|
||||
"config": {
|
||||
"hashing": "sha256"
|
||||
}
|
||||
},
|
||||
"google": {
|
||||
"enabled": true,
|
||||
"type": "oauth",
|
||||
"config": {
|
||||
"type": "oidc",
|
||||
"client": {
|
||||
"client_id": "545948917277-123ieuifrag.apps.googleusercontent.com",
|
||||
"client_secret": "123-123hTTZfDDGPDPp"
|
||||
},
|
||||
"name": "google"
|
||||
}
|
||||
}
|
||||
},
|
||||
"roles": {
|
||||
"guest": {
|
||||
"permissions": [
|
||||
"data.entity.read",
|
||||
"system.access.api",
|
||||
"system.config.read"
|
||||
],
|
||||
"is_default": true
|
||||
},
|
||||
"admin": {
|
||||
"is_default": false,
|
||||
"implicit_allow": true
|
||||
},
|
||||
"editor": {
|
||||
"permissions": [
|
||||
"system.access.admin",
|
||||
"system.config.read",
|
||||
"system.schema.read",
|
||||
"system.config.read.secrets",
|
||||
"system.access.api",
|
||||
"data.entity.read",
|
||||
"data.entity.update",
|
||||
"data.entity.delete",
|
||||
"data.entity.create"
|
||||
]
|
||||
}
|
||||
},
|
||||
"allow_register": true,
|
||||
"cookie": {
|
||||
"path": "/",
|
||||
"sameSite": "lax",
|
||||
"secure": true,
|
||||
"httpOnly": true,
|
||||
"expires": 604800,
|
||||
"renew": true,
|
||||
"pathSuccess": "/",
|
||||
"pathLoggedOut": "/"
|
||||
}
|
||||
},
|
||||
"media": {
|
||||
"enabled": true,
|
||||
"basepath": "/api/media",
|
||||
"entity_name": "media",
|
||||
"storage": {},
|
||||
"adapter": {
|
||||
"type": "s3",
|
||||
"config": {
|
||||
"access_key": "123",
|
||||
"secret_access_key": "123",
|
||||
"url": "https://123.r2.cloudflarestorage.com/bknd-123"
|
||||
}
|
||||
}
|
||||
},
|
||||
"flows": {
|
||||
"basepath": "/api/flows",
|
||||
"flows": {
|
||||
"test": {
|
||||
"trigger": {
|
||||
"type": "http",
|
||||
"config": {
|
||||
"mode": "sync",
|
||||
"method": "GET",
|
||||
"response_type": "html",
|
||||
"path": "/json-posts"
|
||||
}
|
||||
},
|
||||
"tasks": {
|
||||
"fetching": {
|
||||
"type": "fetch",
|
||||
"params": {
|
||||
"method": "GET",
|
||||
"headers": [],
|
||||
"url": "https://jsonplaceholder.typicode.com/posts"
|
||||
}
|
||||
},
|
||||
"render": {
|
||||
"type": "render",
|
||||
"params": {
|
||||
"render": "<h1>Posts</h1>\n<ul>\n {% for post in fetching.output %}\n <li>{{ post.title }}</li>\n {% endfor %}\n</ul>"
|
||||
}
|
||||
}
|
||||
},
|
||||
"connections": {
|
||||
"5cce66b5-57c6-4541-88ac-b298794c6c52": {
|
||||
"source": "fetching",
|
||||
"target": "render",
|
||||
"config": {
|
||||
"condition": {
|
||||
"type": "success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"start_task": "fetching",
|
||||
"responding_task": "render"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user