Skip to content

platform/repository

Documentation

Overview

Classes

Repository

getResource()

Retrieves a resource (file) object from the repository by its path.

ts
static getResource(path: string): Resource;
ParameterTypeDescription
pathstringThe absolute path to the resource.

Returns

  • Type: Resource
  • Description: A Resource instance wrapping the native repository object.

createResource()

Creates a new resource (file) with content provided as a string.

ts
static createResource(path: string, content: string, contentType: string): Resource;
ParameterTypeDescription
pathstringThe absolute path where the resource should be created.
contentstringThe string content for the resource.
contentTypestringThe MIME type of the content (e.g., "text/plain").

Returns

  • Type: Resource
  • Description: The newly created Resource instance.

createResourceNative()

Creates a new resource (file) with content provided as a native byte array.

ts
static createResourceNative(path: string, content: any, contentType: string): Resource;
ParameterTypeDescription
pathstringThe absolute path where the resource should be created.
contentanyThe native byte array content.
contentTypestringThe MIME type of the content.

Returns

  • Type: Resource
  • Description: The newly created Resource instance.

updateResource()

Updates the content of an existing resource using a string.

ts
static updateResource(path: string, content: string): Resource;
ParameterTypeDescription
pathstringThe absolute path to the resource to update.
contentstringThe new string content.

Returns

  • Type: Resource
  • Description: The updated Resource instance.

updateResourceNative()

Updates the content of an existing resource using a native byte array.

ts
static updateResourceNative(path: string, content: any): Resource;
ParameterTypeDescription
pathstringThe absolute path to the resource to update.
contentanyThe new native byte array content.

Returns

  • Type: Resource
  • Description: The updated Resource instance.

deleteResource()

Deletes the resource (file) at the specified path.

ts
static deleteResource(path: string): void;
ParameterTypeDescription
pathstringThe absolute path of the resource to delete.

Returns

  • Type: void
  • Description:

getCollection()

Retrieves a collection (folder) object from the repository by its path.

ts
static getCollection(path: string): Collection;
ParameterTypeDescription
pathstringThe absolute path to the collection.

Returns

  • Type: Collection
  • Description: A Collection instance wrapping the native repository object.

createCollection()

Creates a new collection (folder) at the specified path.

ts
static createCollection(path: string): Collection;
ParameterTypeDescription
pathstringThe absolute path where the collection should be created.

Returns

  • Type: Collection
  • Description: The newly created Collection instance.

deleteCollection()

Deletes the collection (folder) at the specified path.

ts
static deleteCollection(path: string): void;
ParameterTypeDescription
pathstringThe absolute path of the collection to delete.

Returns

  • Type: void
  • Description:

find()

Searches the repository starting from a given path for resources matching a glob pattern.

ts
static find(path: string, pattern: string): void;
ParameterTypeDescription
pathstringThe starting path for the search.
patternstringThe glob pattern to match resource names against (e.g., "*.js").

Returns

  • Type: void
  • Description: An array of repository paths (strings) that match the search criteria.

Resource

getName()

Gets the name of the resource (file name).

ts
getName(): string;

Returns

  • Type: string
  • Description: The name.

getPath()

Gets the full repository path of the resource.

ts
getPath(): string;

Returns

  • Type: string
  • Description: The repository path.

getParent()

Gets the parent collection (folder) of this resource.

ts
getParent(): Collection;

Returns

  • Type: Collection
  • Description: The parent Collection instance.

getInformation()

Gets detailed metadata about the resource.

ts
getInformation(): EntityInformation;

Returns

  • Type: EntityInformation
  • Description: The metadata object.

create()

Creates the resource if it does not already exist.

ts
create(): void;

Returns

  • Type: void
  • Description:

delete()

Deletes the resource from the repository.

ts
delete(): void;

Returns

  • Type: void
  • Description:

renameTo()

Renames the resource within its current collection.

ts
renameTo(name: string): void;
ParameterTypeDescription
namestringThe new name for the resource.

Returns

  • Type: void
  • Description:

moveTo()

Moves the resource to a new path.

ts
moveTo(path: string): void;
ParameterTypeDescription
pathstringThe new absolute path for the resource.

Returns

  • Type: void
  • Description:

copyTo()

Copies the resource to a new path.

ts
copyTo(path: string): void;
ParameterTypeDescription
pathstringThe new absolute path for the copied resource.

Returns

  • Type: void
  • Description:

exists()

Checks if the resource currently exists in the repository.

ts
exists(): boolean;

Returns

  • Type: boolean
  • Description: True if the resource exists, false otherwise.

isEmpty()

Checks if the resource (file) is empty (has zero size).

ts
isEmpty(): boolean;

Returns

  • Type: boolean
  • Description: True if the content is empty, false otherwise.

getText()

Gets the content of the resource as a text string.

ts
getText(): string;

Returns

  • Type: string
  • Description: The text content.

getContent()

Gets the content of the resource as a JavaScript-friendly byte array.

ts
getContent(): void;

Returns

  • Type: void
  • Description: The content bytes.

getContentNative()

Gets the content of the resource as its native Java byte array representation.

ts
getContentNative(): void;

Returns

  • Type: void
  • Description: The content bytes.

setText()

Sets the content of the resource using a text string. The string is converted to a byte array before saving.

ts
setText(text: string): void;
ParameterTypeDescription
textstringThe new text content.

Returns

  • Type: void
  • Description:

setContent()

Sets the content of the resource using a JavaScript byte array. The array is converted to a native byte array before saving.

ts
setContent(content: any): void;
ParameterTypeDescription
contentanyThe new content bytes.

Returns

  • Type: void
  • Description:

setContentNative()

Sets the content of the resource using a native Java byte array.

ts
setContentNative(content: any): void;
ParameterTypeDescription
contentanyThe new native content bytes.

Returns

  • Type: void
  • Description:

isBinary()

Checks if the resource content is determined to be binary.

ts
isBinary(): boolean;

Returns

  • Type: boolean
  • Description: True if binary, false if text.

getContentType()

Gets the content type (MIME type) of the resource.

ts
getContentType(): string;

Returns

  • Type: string
  • Description: The content type string.

Collection

getName()

Gets the name of the collection (folder name).

ts
getName(): string;

Returns

  • Type: string
  • Description: The name.

getPath()

Gets the full repository path of the collection.

ts
getPath(): string;

Returns

  • Type: string
  • Description: The repository path.

getParent()

Gets the parent collection (folder) of this collection.

ts
getParent(): Collection;

Returns

  • Type: Collection
  • Description: The parent Collection instance.

getInformation()

Gets detailed metadata about the collection.

ts
getInformation(): EntityInformation;

Returns

  • Type: EntityInformation
  • Description: The metadata object.

create()

Creates the collection if it does not already exist.

ts
create(): void;

Returns

  • Type: void
  • Description:

delete()

Deletes the collection from the repository.

ts
delete(): void;

Returns

  • Type: void
  • Description:

renameTo()

Renames the collection within its current parent.

ts
renameTo(name: string): void;
ParameterTypeDescription
namestringThe new name for the collection.

Returns

  • Type: void
  • Description:

moveTo()

Moves the collection to a new path.

ts
moveTo(path: string): void;
ParameterTypeDescription
pathstringThe new absolute path for the collection.

Returns

  • Type: void
  • Description:

copyTo()

Copies the collection to a new path.

ts
copyTo(path: string): void;
ParameterTypeDescription
pathstringThe new absolute path for the copied collection.

Returns

  • Type: void
  • Description:

exists()

Checks if the collection currently exists in the repository.

ts
exists(): boolean;

Returns

  • Type: boolean
  • Description: True if the collection exists, false otherwise.

isEmpty()

Checks if the collection is empty (contains no files or sub-directories).

ts
isEmpty(): boolean;

Returns

  • Type: boolean
  • Description: True if empty, false otherwise.

getCollectionsNames()

Gets the names of all sub-collections (folders) within this collection.

ts
getCollectionsNames(): void;

Returns

  • Type: void
  • Description: An array of sub-collection names.

createCollection()

Creates a new sub-collection (folder) within this collection.

ts
createCollection(name: string): Collection;
ParameterTypeDescription
namestringThe name of the new sub-collection.

Returns

  • Type: Collection
  • Description: The newly created Collection instance.

getCollection()

Gets a specific sub-collection by name.

ts
getCollection(name: string): Collection;
ParameterTypeDescription
namestringThe name of the sub-collection.

Returns

  • Type: Collection
  • Description: The child Collection instance.

removeCollection()

Removes a sub-collection by name.

ts
removeCollection(name: string): void;
ParameterTypeDescription
namestringThe name of the sub-collection to remove.

Returns

  • Type: void
  • Description:

getResourcesNames()

Gets the names of all resources (files) within this collection.

ts
getResourcesNames(): void;

Returns

  • Type: void
  • Description: An array of resource names.

getResource()

Gets a specific resource (file) by name.

ts
getResource(name: string): Resource;
ParameterTypeDescription
namestringThe name of the resource.

Returns

  • Type: Resource
  • Description: The child Resource instance.

removeResource()

Removes a resource (file) by name.

ts
removeResource(name: string): void;
ParameterTypeDescription
namestringThe name of the resource to remove.

Returns

  • Type: void
  • Description:

createResource()

Creates a new resource (file) within this collection.

ts
createResource(name: string, content: string): Resource;
ParameterTypeDescription
namestringThe name of the new resource.
contentstringThe string content for the resource.

Returns

  • Type: Resource
  • Description: The newly created Resource instance.

EntityInformation

getName()

Gets the name of the entity (resource or collection).

ts
getName(): string;

Returns

  • Type: string
  • Description: The name.

getPath()

Gets the full repository path of the entity.

ts
getPath(): string;

Returns

  • Type: string
  • Description: The repository path.

getPermissions()

Gets the access permissions for the entity (typically an integer bitmask).

ts
getPermissions(): number;

Returns

  • Type: number
  • Description: The permissions value.

getSize()

Gets the size of the resource content in bytes (0 for a collection).

ts
getSize(): number;

Returns

  • Type: number
  • Description: The size in bytes.

getCreatedBy()

Gets the user who created the entity.

ts
getCreatedBy(): string;

Returns

  • Type: string
  • Description: The creator's name.

getCreatedAt()

Gets the creation timestamp.

ts
getCreatedAt(): Date;

Returns

  • Type: Date
  • Description: The creation date and time.

getModifiedBy()

Gets the user who last modified the entity.

ts
getModifiedBy(): string;

Returns

  • Type: string
  • Description: The modifier's name.

getModifiedAt()

Gets the last modification timestamp.

ts
getModifiedAt(): Date;

Returns

  • Type: Date
  • Description: The modification date and time.