platform/repository
Documentation
- source: platform/repository.ts
Overview
Classes
Repository
getResource()
Retrieves a resource (file) object from the repository by its path.
tsstatic getResource(path: string): Resource;
Parameter Type Description 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.
tsstatic createResource(path: string, content: string, contentType: string): Resource;
Parameter Type Description 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.
tsstatic createResourceNative(path: string, content: any, contentType: string): Resource;
Parameter Type Description 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.
tsstatic updateResource(path: string, content: string): Resource;
Parameter Type Description 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.
tsstatic updateResourceNative(path: string, content: any): Resource;
Parameter Type Description 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.
tsstatic deleteResource(path: string): void;
Parameter Type Description pathstringThe absolute path of the resource to delete. Returns
- Type:
void- Description:
getCollection()
Retrieves a collection (folder) object from the repository by its path.
tsstatic getCollection(path: string): Collection;
Parameter Type Description 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.
tsstatic createCollection(path: string): Collection;
Parameter Type Description 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.
tsstatic deleteCollection(path: string): void;
Parameter Type Description 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.
tsstatic find(path: string, pattern: string): void;
Parameter Type Description 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).
tsgetName(): string;Returns
- Type:
string- Description: The name.
getPath()
Gets the full repository path of the resource.
tsgetPath(): string;Returns
- Type:
string- Description: The repository path.
getParent()
Gets the parent collection (folder) of this resource.
tsgetParent(): Collection;Returns
- Type:
Collection- Description: The parent Collection instance.
getInformation()
Gets detailed metadata about the resource.
tsgetInformation(): EntityInformation;Returns
- Type:
EntityInformation- Description: The metadata object.
create()
Creates the resource if it does not already exist.
tscreate(): void;Returns
- Type:
void- Description:
delete()
Deletes the resource from the repository.
tsdelete(): void;Returns
- Type:
void- Description:
renameTo()
Renames the resource within its current collection.
tsrenameTo(name: string): void;
Parameter Type Description namestringThe new name for the resource. Returns
- Type:
void- Description:
moveTo()
Moves the resource to a new path.
tsmoveTo(path: string): void;
Parameter Type Description pathstringThe new absolute path for the resource. Returns
- Type:
void- Description:
copyTo()
Copies the resource to a new path.
tscopyTo(path: string): void;
Parameter Type Description pathstringThe new absolute path for the copied resource. Returns
- Type:
void- Description:
exists()
Checks if the resource currently exists in the repository.
tsexists(): boolean;Returns
- Type:
boolean- Description: True if the resource exists, false otherwise.
isEmpty()
Checks if the resource (file) is empty (has zero size).
tsisEmpty(): boolean;Returns
- Type:
boolean- Description: True if the content is empty, false otherwise.
getText()
Gets the content of the resource as a text string.
tsgetText(): string;Returns
- Type:
string- Description: The text content.
getContent()
Gets the content of the resource as a JavaScript-friendly byte array.
tsgetContent(): void;Returns
- Type:
void- Description: The content bytes.
getContentNative()
Gets the content of the resource as its native Java byte array representation.
tsgetContentNative(): 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.
tssetText(text: string): void;
Parameter Type Description 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.
tssetContent(content: any): void;
Parameter Type Description contentanyThe new content bytes. Returns
- Type:
void- Description:
setContentNative()
Sets the content of the resource using a native Java byte array.
tssetContentNative(content: any): void;
Parameter Type Description contentanyThe new native content bytes. Returns
- Type:
void- Description:
isBinary()
Checks if the resource content is determined to be binary.
tsisBinary(): boolean;Returns
- Type:
boolean- Description: True if binary, false if text.
getContentType()
Gets the content type (MIME type) of the resource.
tsgetContentType(): string;Returns
- Type:
string- Description: The content type string.
Collection
getName()
Gets the name of the collection (folder name).
tsgetName(): string;Returns
- Type:
string- Description: The name.
getPath()
Gets the full repository path of the collection.
tsgetPath(): string;Returns
- Type:
string- Description: The repository path.
getParent()
Gets the parent collection (folder) of this collection.
tsgetParent(): Collection;Returns
- Type:
Collection- Description: The parent Collection instance.
getInformation()
Gets detailed metadata about the collection.
tsgetInformation(): EntityInformation;Returns
- Type:
EntityInformation- Description: The metadata object.
create()
Creates the collection if it does not already exist.
tscreate(): void;Returns
- Type:
void- Description:
delete()
Deletes the collection from the repository.
tsdelete(): void;Returns
- Type:
void- Description:
renameTo()
Renames the collection within its current parent.
tsrenameTo(name: string): void;
Parameter Type Description namestringThe new name for the collection. Returns
- Type:
void- Description:
moveTo()
Moves the collection to a new path.
tsmoveTo(path: string): void;
Parameter Type Description pathstringThe new absolute path for the collection. Returns
- Type:
void- Description:
copyTo()
Copies the collection to a new path.
tscopyTo(path: string): void;
Parameter Type Description pathstringThe new absolute path for the copied collection. Returns
- Type:
void- Description:
exists()
Checks if the collection currently exists in the repository.
tsexists(): 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).
tsisEmpty(): boolean;Returns
- Type:
boolean- Description: True if empty, false otherwise.
getCollectionsNames()
Gets the names of all sub-collections (folders) within this collection.
tsgetCollectionsNames(): void;Returns
- Type:
void- Description: An array of sub-collection names.
createCollection()
Creates a new sub-collection (folder) within this collection.
tscreateCollection(name: string): Collection;
Parameter Type Description namestringThe name of the new sub-collection. Returns
- Type:
Collection- Description: The newly created Collection instance.
getCollection()
Gets a specific sub-collection by name.
tsgetCollection(name: string): Collection;
Parameter Type Description namestringThe name of the sub-collection. Returns
- Type:
Collection- Description: The child Collection instance.
removeCollection()
Removes a sub-collection by name.
tsremoveCollection(name: string): void;
Parameter Type Description namestringThe name of the sub-collection to remove. Returns
- Type:
void- Description:
getResourcesNames()
Gets the names of all resources (files) within this collection.
tsgetResourcesNames(): void;Returns
- Type:
void- Description: An array of resource names.
getResource()
Gets a specific resource (file) by name.
tsgetResource(name: string): Resource;
Parameter Type Description namestringThe name of the resource. Returns
- Type:
Resource- Description: The child Resource instance.
removeResource()
Removes a resource (file) by name.
tsremoveResource(name: string): void;
Parameter Type Description namestringThe name of the resource to remove. Returns
- Type:
void- Description:
createResource()
Creates a new resource (file) within this collection.
tscreateResource(name: string, content: string): Resource;
Parameter Type Description 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).
tsgetName(): string;Returns
- Type:
string- Description: The name.
getPath()
Gets the full repository path of the entity.
tsgetPath(): string;Returns
- Type:
string- Description: The repository path.
getPermissions()
Gets the access permissions for the entity (typically an integer bitmask).
tsgetPermissions(): number;Returns
- Type:
number- Description: The permissions value.
getSize()
Gets the size of the resource content in bytes (0 for a collection).
tsgetSize(): number;Returns
- Type:
number- Description: The size in bytes.
getCreatedBy()
Gets the user who created the entity.
tsgetCreatedBy(): string;Returns
- Type:
string- Description: The creator's name.
getCreatedAt()
Gets the creation timestamp.
tsgetCreatedAt(): Date;Returns
- Type:
Date- Description: The creation date and time.
getModifiedBy()
Gets the user who last modified the entity.
tsgetModifiedBy(): string;Returns
- Type:
string- Description: The modifier's name.
getModifiedAt()
Gets the last modification timestamp.
tsgetModifiedAt(): Date;Returns
- Type:
Date- Description: The modification date and time.
