Honestly way too much went into this single commit. I am so sorry future me

This commit is contained in:
Emma
2023-06-09 00:54:00 -06:00
parent cd3f653f3f
commit 42c0004150
67 changed files with 4617 additions and 92 deletions

View File

@@ -0,0 +1,55 @@
import { JSONArray, JSONObject, searchJSON } from "../../lib/JSONSearch/jsonSearch.ts";
export interface ISchema {
name: string;
accolades: any; // TODO - populate with accolades schema type
publicationRules: {
name: string;
isExtensible: boolean;
// overwrites: boolean;
canExtend: boolean;
reviewRequired: boolean;
corrections: {
reviewRequired: boolean;
preserveHistory: boolean;
}
}[]
allowsListBuilding: boolean;
listBuildingRules: any; // TODO - populate with list building rules schema type
schemaProperties: Record<string, any>;
}
// export type searchString = `${/[a-z]/i}`
export class GameSystemSchema<T extends JSONObject | JSONArray> implements ISchema {
name: string;
accolades: any;
publicationRules: {
name: string;
isExtensible: boolean;
// overwrites: boolean;
canExtend: boolean;
reviewRequired: boolean;
corrections: {
reviewRequired: boolean;
preserveHistory: boolean;
};
}[];
allowsListBuilding: boolean;
listBuildingRules: any;
schemaProperties: Record<string, any>;
constructor(schemaJson: ISchema) {
this.name = schemaJson.name;
this.accolades = schemaJson.accolades;
this.publicationRules = schemaJson.publicationRules;
this.allowsListBuilding = schemaJson.allowsListBuilding;
this.listBuildingRules = schemaJson.listBuildingRules;
this.schemaProperties = schemaJson.schemaProperties;
}
search(search: string, values: T) {
return searchJSON(values, search);
}
}