Fix Release 0.11.1 (#150)

* fix strategy forms handling, add register route and hidden fields

Refactored strategy forms to include hidden fields for type and name. Added a registration route with necessary adjustments to the admin controller and routes. Corrected field handling within relevant forms and components.

* fix admin access permissions and refactor routing structure

display a fixed error for unmet permissions when retrieving the schema. moved auth routes outside of BkndProvider and reorganized remaining routes to include BkndWrapper.

* fix: properly type BkndWrapper

* bump fix release version

* ModuleManager: update diff checking and AppData validation

Revised diff handling includes validation of diffs, reverting changes on failure, and enforcing module constraints with onBeforeUpdate hooks. Introduced `validateDiffs` and backup of stable configs. Applied changes in related modules, tests, and UI layer to align with updated diff logic.

* fix: cli: running from config file were using invalid args

* fix: cli: improve sequence of onBuilt trigger to allow custom routes from cli

* fix e2e tests
This commit is contained in:
dswbx
2025-04-20 09:29:58 +02:00
committed by GitHub
parent 2988e4c3bd
commit 4c11789ea8
29 changed files with 520 additions and 169 deletions

View File

@@ -1,4 +1,5 @@
enum Change {
// biome-ignore lint/suspicious/noConstEnum: <explanation>
export const enum DiffChange {
Add = "a",
Remove = "r",
Edit = "e",
@@ -7,8 +8,8 @@ enum Change {
type Object = object;
type Primitive = string | number | boolean | null | object | any[] | undefined;
interface DiffEntry {
t: Change | string;
export interface DiffEntry {
t: DiffChange | string;
p: (string | number)[];
o: Primitive;
n: Primitive;
@@ -47,7 +48,7 @@ function diff(oldObj: Object, newObj: Object): DiffEntry[] {
if (typeof oldValue !== typeof newValue) {
diffs.push({
t: Change.Edit,
t: DiffChange.Edit,
p: path,
o: oldValue,
n: newValue,
@@ -57,14 +58,14 @@ function diff(oldObj: Object, newObj: Object): DiffEntry[] {
for (let i = 0; i < maxLength; i++) {
if (i >= oldValue.length) {
diffs.push({
t: Change.Add,
t: DiffChange.Add,
p: [...path, i],
o: undefined,
n: newValue[i],
});
} else if (i >= newValue.length) {
diffs.push({
t: Change.Remove,
t: DiffChange.Remove,
p: [...path, i],
o: oldValue[i],
n: undefined,
@@ -80,14 +81,14 @@ function diff(oldObj: Object, newObj: Object): DiffEntry[] {
for (const key of allKeys) {
if (!(key in oldValue)) {
diffs.push({
t: Change.Add,
t: DiffChange.Add,
p: [...path, key],
o: undefined,
n: newValue[key],
});
} else if (!(key in newValue)) {
diffs.push({
t: Change.Remove,
t: DiffChange.Remove,
p: [...path, key],
o: oldValue[key],
n: undefined,
@@ -98,7 +99,7 @@ function diff(oldObj: Object, newObj: Object): DiffEntry[] {
}
} else {
diffs.push({
t: Change.Edit,
t: DiffChange.Edit,
p: path,
o: oldValue,
n: newValue,
@@ -136,9 +137,9 @@ function applyChange(obj: Object, diff: DiffEntry) {
const parent = getParent(obj, path.slice(0, -1));
const key = path[path.length - 1]!;
if (type === Change.Add || type === Change.Edit) {
if (type === DiffChange.Add || type === DiffChange.Edit) {
parent[key] = newValue;
} else if (type === Change.Remove) {
} else if (type === DiffChange.Remove) {
if (Array.isArray(parent)) {
parent.splice(key as number, 1);
} else {
@@ -152,13 +153,13 @@ function revertChange(obj: Object, diff: DiffEntry) {
const parent = getParent(obj, path.slice(0, -1));
const key = path[path.length - 1]!;
if (type === Change.Add) {
if (type === DiffChange.Add) {
if (Array.isArray(parent)) {
parent.splice(key as number, 1);
} else {
delete parent[key];
}
} else if (type === Change.Remove || type === Change.Edit) {
} else if (type === DiffChange.Remove || type === DiffChange.Edit) {
parent[key] = oldValue;
}
}