Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
110 lines
3.5 KiB
JavaScript
Executable File
110 lines
3.5 KiB
JavaScript
Executable File
import { getErrorMap } from "../errors.js";
|
|
import defaultErrorMap from "../locales/en.js";
|
|
export const makeIssue = (params) => {
|
|
const { data, path, errorMaps, issueData } = params;
|
|
const fullPath = [...path, ...(issueData.path || [])];
|
|
const fullIssue = {
|
|
...issueData,
|
|
path: fullPath,
|
|
};
|
|
if (issueData.message !== undefined) {
|
|
return {
|
|
...issueData,
|
|
path: fullPath,
|
|
message: issueData.message,
|
|
};
|
|
}
|
|
let errorMessage = "";
|
|
const maps = errorMaps
|
|
.filter((m) => !!m)
|
|
.slice()
|
|
.reverse();
|
|
for (const map of maps) {
|
|
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
}
|
|
return {
|
|
...issueData,
|
|
path: fullPath,
|
|
message: errorMessage,
|
|
};
|
|
};
|
|
export const EMPTY_PATH = [];
|
|
export function addIssueToContext(ctx, issueData) {
|
|
const overrideMap = getErrorMap();
|
|
const issue = makeIssue({
|
|
issueData: issueData,
|
|
data: ctx.data,
|
|
path: ctx.path,
|
|
errorMaps: [
|
|
ctx.common.contextualErrorMap, // contextual error map is first priority
|
|
ctx.schemaErrorMap, // then schema-bound map if available
|
|
overrideMap, // then global override map
|
|
overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map
|
|
].filter((x) => !!x),
|
|
});
|
|
ctx.common.issues.push(issue);
|
|
}
|
|
export class ParseStatus {
|
|
constructor() {
|
|
this.value = "valid";
|
|
}
|
|
dirty() {
|
|
if (this.value === "valid")
|
|
this.value = "dirty";
|
|
}
|
|
abort() {
|
|
if (this.value !== "aborted")
|
|
this.value = "aborted";
|
|
}
|
|
static mergeArray(status, results) {
|
|
const arrayValue = [];
|
|
for (const s of results) {
|
|
if (s.status === "aborted")
|
|
return INVALID;
|
|
if (s.status === "dirty")
|
|
status.dirty();
|
|
arrayValue.push(s.value);
|
|
}
|
|
return { status: status.value, value: arrayValue };
|
|
}
|
|
static async mergeObjectAsync(status, pairs) {
|
|
const syncPairs = [];
|
|
for (const pair of pairs) {
|
|
const key = await pair.key;
|
|
const value = await pair.value;
|
|
syncPairs.push({
|
|
key,
|
|
value,
|
|
});
|
|
}
|
|
return ParseStatus.mergeObjectSync(status, syncPairs);
|
|
}
|
|
static mergeObjectSync(status, pairs) {
|
|
const finalObject = {};
|
|
for (const pair of pairs) {
|
|
const { key, value } = pair;
|
|
if (key.status === "aborted")
|
|
return INVALID;
|
|
if (value.status === "aborted")
|
|
return INVALID;
|
|
if (key.status === "dirty")
|
|
status.dirty();
|
|
if (value.status === "dirty")
|
|
status.dirty();
|
|
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
finalObject[key.value] = value.value;
|
|
}
|
|
}
|
|
return { status: status.value, value: finalObject };
|
|
}
|
|
}
|
|
export const INVALID = Object.freeze({
|
|
status: "aborted",
|
|
});
|
|
export const DIRTY = (value) => ({ status: "dirty", value });
|
|
export const OK = (value) => ({ status: "valid", value });
|
|
export const isAborted = (x) => x.status === "aborted";
|
|
export const isDirty = (x) => x.status === "dirty";
|
|
export const isValid = (x) => x.status === "valid";
|
|
export const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|