@alfresco/adf-content-services
Version:
Alfresco ADF content services
127 lines (126 loc) • 4.9 kB
TypeScript
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { EventEmitter } from '@angular/core';
import { Subject } from 'rxjs';
import { FileUploadCompleteEvent, FileUploadDeleteEvent, FileUploadErrorEvent, FileUploadEvent } from '../events/file.event';
import { FileModel } from '../models/file.model';
import { AppConfigService } from '@alfresco/adf-core';
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
import { NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api';
import { AlfrescoApiService } from '../../services/alfresco-api.service';
import * as i0 from "@angular/core";
export declare class UploadService {
queue: FileModel[];
queueChanged: Subject<FileModel[]>;
fileUpload: Subject<FileUploadEvent>;
fileUploadStarting: Subject<FileUploadEvent>;
fileUploadCancelled: Subject<FileUploadEvent>;
fileUploadProgress: Subject<FileUploadEvent>;
fileUploadAborted: Subject<FileUploadEvent>;
fileUploadError: Subject<FileUploadErrorEvent>;
fileUploadComplete: Subject<FileUploadCompleteEvent>;
fileUploadDeleted: Subject<FileUploadDeleteEvent>;
fileDeleted: Subject<string>;
private cache;
private totalComplete;
private totalAborted;
private totalError;
private excludedFileList;
private excludedFoldersList;
private matchingOptions;
private folderMatchingOptions;
private abortedFile;
private isThumbnailGenerationEnabled;
private _uploadApi;
get uploadApi(): UploadApi;
private _nodesApi;
get nodesApi(): NodesApi;
private _versionsApi;
get versionsApi(): VersionsApi;
protected apiService: AlfrescoApiService;
protected appConfigService: AppConfigService;
protected discoveryApiService: DiscoveryApiService;
constructor();
clearCache(): void;
/**
* Returns the number of concurrent threads for uploading.
*
* @returns Number of concurrent threads (default 1)
*/
getThreadsCount(): number;
/**
* Checks whether the service still has files uploading or awaiting upload.
*
* @returns True if files in the queue are still uploading, false otherwise
*/
isUploading(): boolean;
/**
* Gets the file Queue
*
* @returns Array of files that form the queue
*/
getQueue(): FileModel[];
/**
* Adds files to the uploading queue to be uploaded
*
* @param files One or more separate parameters or an array of files to queue
* @returns Array of files that were not blocked from upload by the ignore list
*/
addToQueue(...files: FileModel[]): FileModel[];
/**
* Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
*
* @param successEmitter Emitter to invoke on file success status change
* @param errorEmitter Emitter to invoke on file error status change
*/
uploadFilesInTheQueue(successEmitter?: EventEmitter<any>, errorEmitter?: EventEmitter<any>): void;
/**
* Cancels uploading of files.
* If the file is smaller than 1 MB the file will be uploaded and then the node deleted
* to prevent having files that were aborted but still uploaded.
*
* @param files One or more separate parameters or an array of files specifying uploads to cancel
*/
cancelUpload(...files: FileModel[]): void;
/** Clears the upload queue */
clearQueue(): void;
/**
* Gets an upload promise for a file.
*
* @param file The target file
* @returns Promise that is resolved if the upload is successful or error otherwise
*/
getUploadPromise(file: FileModel): any;
private getFilesToUpload;
private beginUpload;
private onUploadStarting;
private onUploadProgress;
private onUploadError;
private onUploadComplete;
private onUploadAborted;
private onUploadCancelled;
private onUploadDeleted;
private getAction;
private deleteAbortedNode;
private deleteAbortedNodeVersion;
private isSaveToAbortFile;
private filterElement;
private isParentFolderAllowed;
private isFileNameAllowed;
static ɵfac: i0.ɵɵFactoryDeclaration<UploadService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<UploadService>;
}