Skip to main content

SpaceClient

Defined in: js-api/src/dapi.ts:1233

Client for working with a specific space. Provides methods for managing subspaces, entities (scripts, queries, connections), and files.

Constructors​

Constructor​

new SpaceClient(dart): SpaceClient

Defined in: js-api/src/dapi.ts:1236

Parameters​

ParameterType
dartany

Returns​

SpaceClient

Properties​

PropertyTypeDefined in
dartanyjs-api/src/dapi.ts:1234

Accessors​

children​

Get Signature​

get children(): SpaceChildrenClient

Defined in: js-api/src/dapi.ts:1278

Returns a client for accessing children of this space

Returns​

SpaceChildrenClient


files​

Get Signature​

get files(): SpaceFilesClient

Defined in: js-api/src/dapi.ts:1283

Returns a client for accessing files in this space

Returns​

SpaceFilesClient

Methods​

addEntity()​

addEntity(entityId, link?): Promise<void>

Defined in: js-api/src/dapi.ts:1265

Adds an entity (script, query, connection, or another space) to this space. When link is false (default), the entity is moved from its current location to this space. When link is true, creates a reference without moving - the entity can appear in multiple spaces. Moving a space preserves all its files, nested subspaces, and contained entities.

Parameters​

ParameterTypeDefault valueDescription
entityIdstringundefinedThe unique identifier of the entity to add
linkbooleanfalseIf true, creates a link reference instead of moving the entity (default: false)

Returns​

Promise<void>


addSubspace()​

addSubspace(childSpace, link?): Promise<Project>

Defined in: js-api/src/dapi.ts:1249

Adds a child space (subspace) under this space. The subspace will have its own storage with a namespaced path derived from the parent hierarchy (e.g., 'ParentSpace:ChildSpace:'). You can provide existing space, then based on the link parameter the subspace will be moved or reference will be created.

Parameters​

ParameterTypeDefault valueDescription
childSpacestring | ProjectundefinedThe subspace name or an existing space.
linkbooleanfalseIf true, creates a link reference instead of moving the subspace (default: false). When only the subspace name is provided, this parameter is ignored.

Returns​

Promise<Project>


removeEntity()​

removeEntity(entityId): Promise<void>

Defined in: js-api/src/dapi.ts:1273

Removes an entity from this space. Note: If the entity is linked, only reference will be deleted.

Parameters​

ParameterTypeDescription
entityIdstringEntity.id

Returns​

Promise<void>


subspaceExists()​

subspaceExists(name): Promise<boolean>

Defined in: js-api/src/dapi.ts:1254

Checks if a subspace with the given name exists in the current space.

Parameters​

ParameterType
namestring

Returns​

Promise<boolean>