import { Glossary } from '@bscotch/cl2-string-server-shared'; import { Pathy } from '@bscotch/pathy'; import { GameChangerRumpusMetadata } from './types.cl2.rumpus.js'; import { Bschema, ChangeType, Changes, type Mote, type MoteId, type PackedData, type SchemaId } from './types.js'; interface MoteVisitorDataCtx { /** The data at this point in the heirarchy */ data: any; /** The key in the parent that points to this data. `undefined` at the data root */ key: string | undefined; /** The full pointer, as a split array of strings, to the this data. Empty at the data root */ pointer: string[]; /** The subschema mapping onto this data */ subschema: Bschema; } export interface MoteVisitorCtx { mote: Mote; schema: Bschema; current: MoteVisitorDataCtx; /** `undefined` at the root, otherwise the prior visitor context data */ parent: MoteVisitorCtx | undefined; /** A place for your custom store to accumulate things during visits. Passed by reference. */ store: T; } export declare class Gcdata { data: PackedData; constructor(data: PackedData, options?: { resolveRefsAndOverrides?: boolean; }); get motes(): PackedData['motes']; get schemas(): PackedData['schemas']; visitMoteData(moteId: string | Mote, /** Function to call on every node in the mote data */ visitor: (ctx: MoteVisitorCtx, priorVisitorReturn?: R | undefined) => R): R; visitMoteData(moteId: string | Mote, visitor: (ctx: MoteVisitorCtx, priorVisitorReturn?: R | undefined) => R, store: Store): R; getAncestors(ofMoteId: Mote | string, options?: { /** If true, circularity will cause an early return of the parents rather than throwing. */ ignoreCircularity: boolean; }): Mote[]; getMoteNamePointer(mote: Mote | string | undefined): string | undefined; getMoteName(moteId: Mote | string | undefined): string | undefined; getMote(moteId: Mote | string | MoteId | undefined): Mote | undefined; getSchema(schemaId: string | SchemaId | undefined): Bschema | undefined; listMotes(): Mote[]; listMotesBySchema(...schemaId: (string | SchemaId)[]): Mote[]; static from(gcdataFile: Pathy, options?: { resolveRefsAndOverrides?: boolean; }): Promise; /** * Given a raw packed data object, recurse through to resolve * all references and overrides. */ protected static resolveRefsAndOverrides(data: PackedData): void; } export declare class GameChanger { readonly projectName: string; base: Gcdata; working: Gcdata; protected changes: Changes; glossary?: Glossary; protected constructor(projectName: string); protected get workingData(): PackedData; protected get baseData(): PackedData; get projectSaveDir(): Pathy; /** * Clear diffs for a subset of pointer patterns. This is so that * diff types that are fully represented by other editors can be * cleared, while leaving other changes intact. */ clearMoteChanges(moteId: string, patterns: string[]): void; updateMoteLocation(moteId: string, newParentId: string | undefined, newFolder: string | undefined): void; createMote(schemaId: string, moteId: string): Mote; updateMoteData(moteId: string, dataPath: string, value: any): void; protected createChange(category: 'schemas' | 'motes', id: string, change: { type: ChangeType; pointer?: string; newValue?: any; }): void; writeChanges(): Promise; /** Apply changes to the baseData to get the updated workingData */ protected applyChanges(): void; protected loadChanges(): Promise; protected readCommitsMetadata(): Promise; load(): Promise; loadGlossary(access: { host: string; username: string; password: string; }): Promise; /** * @param path Either the path to a .yyp file (to get the included packed file) or the direct path to a GameChanger snapshot (e.g. a packed file or a base file). */ static from(projectName: string): Promise; static projectSaveDir(projectName: string): Pathy; static projectRumpusGameChangerDir(projectName: string): Pathy; static projectRumpusGameChangerMetadataFile(projectName: string): Pathy; static projectGameChangerChangesFile(projectName: string): Pathy<{ [x: string]: unknown; commitId: string; changes: { message: string; motes: Record | undefined; }>; schemas: Record | undefined; }>; conflicts: { [x: string]: unknown; motes: Record; schemas: Record; }; }; }>; static projectGameChangerChangesFolder(projectName: string): Pathy; static projectGameChangerChangesBackupFolder(projectName: string): Pathy; } export {}; //# sourceMappingURL=GameChanger.d.ts.map