diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/generation/Graph.test.ts b/invokeai/frontend/web/src/features/nodes/util/graph/generation/Graph.test.ts index c3c3ca2348..f2e09adfa1 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/generation/Graph.test.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/generation/Graph.test.ts @@ -545,14 +545,14 @@ describe('Graph', () => { }); describe('metadata utils', () => { - describe('_getMetadataNode', () => { + describe('getMetadataNode', () => { it("should get the metadata node, creating it if it doesn't exist", () => { const g = new Graph(); - const metadata = g._getMetadataNode(); + const metadata = g.getMetadataNode(); expect(metadata.id).toBe('core_metadata'); expect(metadata.type).toBe('core_metadata'); g.upsertMetadata({ test: 'test' }); - const metadata2 = g._getMetadataNode(); + const metadata2 = g.getMetadataNode(); expect(metadata2).toHaveProperty('test'); }); }); @@ -561,14 +561,14 @@ describe('Graph', () => { it('should add metadata to the metadata node', () => { const g = new Graph(); g.upsertMetadata({ test: 'test' }); - const metadata = g._getMetadataNode(); + const metadata = g.getMetadataNode(); expect(metadata).toHaveProperty('test'); }); it('should update metadata on the metadata node', () => { const g = new Graph(); g.upsertMetadata({ test: 'test' }); g.upsertMetadata({ test: 'test2' }); - const metadata = g._getMetadataNode(); + const metadata = g.getMetadataNode(); expect(metadata.test).toBe('test2'); }); }); @@ -578,14 +578,14 @@ describe('Graph', () => { const g = new Graph(); g.upsertMetadata({ test: 'test', test2: 'test2' }); g.removeMetadata(['test']); - const metadata = g._getMetadataNode(); + const metadata = g.getMetadataNode(); expect(metadata).not.toHaveProperty('test'); }); it('should remove multiple metadata from the metadata node', () => { const g = new Graph(); g.upsertMetadata({ test: 'test', test2: 'test2' }); g.removeMetadata(['test', 'test2']); - const metadata = g._getMetadataNode(); + const metadata = g.getMetadataNode(); expect(metadata).not.toHaveProperty('test'); expect(metadata).not.toHaveProperty('test2'); }); @@ -615,7 +615,7 @@ describe('Graph', () => { }); g.upsertMetadata({ test: 'test' }); g.setMetadataReceivingNode(n1); - const metadata = g._getMetadataNode(); + const metadata = g.getMetadataNode(); expect(g.getEdgesFrom(metadata as unknown as AnyInvocation).length).toBe(1); expect(g.getEdgesTo(n1).length).toBe(1); }); diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/generation/Graph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/generation/Graph.ts index db96a5f7d0..d223d1f500 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/generation/Graph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/generation/Graph.ts @@ -356,10 +356,10 @@ export class Graph { //#region Metadata /** - * INTERNAL: Get the metadata node. If it does not exist, it is created. + * Get the metadata node. If it does not exist, it is created. * @returns The metadata node. */ - _getMetadataNode(): S['CoreMetadataInvocation'] { + getMetadataNode(): S['CoreMetadataInvocation'] { try { const node = this.getNode(METADATA) as AnyInvocationIncMetadata; assert(node.type === 'core_metadata'); @@ -378,7 +378,7 @@ export class Graph { * @returns The metadata node. */ upsertMetadata(metadata: Partial): S['CoreMetadataInvocation'] { - const node = this._getMetadataNode(); + const node = this.getMetadataNode(); Object.assign(node, metadata); return node; } @@ -389,7 +389,7 @@ export class Graph { * @returns The metadata node */ removeMetadata(keys: string[]): S['CoreMetadataInvocation'] { - const metadataNode = this._getMetadataNode(); + const metadataNode = this.getMetadataNode(); for (const k of keys) { unset(metadataNode, k); } @@ -417,9 +417,9 @@ export class Graph { */ setMetadataReceivingNode(node: AnyInvocation): void { // @ts-expect-error `Graph` excludes `core_metadata` nodes due to its excessively wide typing - this.deleteEdgesFrom(this._getMetadataNode()); + this.deleteEdgesFrom(this.getMetadataNode()); // @ts-expect-error `Graph` excludes `core_metadata` nodes due to its excessively wide typing - this.addEdge(this._getMetadataNode(), 'metadata', node, 'metadata'); + this.addEdge(this.getMetadataNode(), 'metadata', node, 'metadata'); } //#endregion