-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0f596e
commit b8f0c70
Showing
2 changed files
with
11 additions
and
5 deletions.
There are no files selected for viewing
10 changes: 8 additions & 2 deletions
10
packages/modules/packages/node/packages/memory/src/NodeHelper/attachToNewNode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
import type { ModuleIdentifier } from '@xyo-network/module-model' | ||
import type { NodeInstance } from '@xyo-network/node-model' | ||
import { NodeConfigSchema, type NodeInstance } from '@xyo-network/node-model' | ||
|
||
import type { MemoryNodeParams } from '../MemoryNode.ts' | ||
import { MemoryNode } from '../MemoryNode.ts' | ||
import { attachToExistingNode } from './attachToExistingNode.ts' | ||
|
||
export const attachToNewNode = async (source: NodeInstance, id: ModuleIdentifier, destinationParams: MemoryNodeParams): Promise<NodeInstance> => { | ||
const DEFAULT_NODE_PARAMS = { config: { schema: NodeConfigSchema } } | ||
|
||
export const attachToNewNode = async ( | ||
source: NodeInstance, | ||
id: ModuleIdentifier, | ||
destinationParams: MemoryNodeParams = DEFAULT_NODE_PARAMS, | ||
): Promise<NodeInstance> => { | ||
const destination = await MemoryNode.create(destinationParams) | ||
return await attachToExistingNode(source, id, destination) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters