diff --git a/AppScope/app.json5 b/AppScope/app.json5 index 00bf53f..0d3f046 100644 --- a/AppScope/app.json5 +++ b/AppScope/app.json5 @@ -2,8 +2,8 @@ "app": { "bundleName": "com.tencent.cloud.cos", "vendor": "example", - "versionCode": 1010100, - "versionName": "1.1.0", + "versionCode": 1010101, + "versionName": "1.1.1", "icon": "$media:app_icon", "label": "$string:app_name" } diff --git a/README.md b/README.md index 3349442..5299a0f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ ``` bash "dependencies": { ... - "@tencentcloud/cos":"1.1.0" + "@tencentcloud/cos":"1.1.1" } ``` 2. SDK 需要网络权限,用于与 COS 服务器进行通信,请在应用模块下的 module.json5 中添加如下权限声明: diff --git a/cosSdk/BuildProfile.ets b/cosSdk/BuildProfile.ets index cab3453..b844baf 100644 --- a/cosSdk/BuildProfile.ets +++ b/cosSdk/BuildProfile.ets @@ -1,7 +1,7 @@ /** * Use these variables when you tailor your ArkTS code. They must be of the const type. */ -export const HAR_VERSION = '1.1.0'; +export const HAR_VERSION = '1.1.1'; export const BUILD_MODE_NAME = 'release'; export const DEBUG = false; export const TARGET_NAME = 'default'; diff --git a/cosSdk/CHANGELOG.md b/cosSdk/CHANGELOG.md index 34f1625..7db462b 100644 --- a/cosSdk/CHANGELOG.md +++ b/cosSdk/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.1.1 +- 进度回调增加频控 + ## 1.1.0 - 更换http网络库到rcp - http重定向默认不开启 diff --git a/cosSdk/README.md b/cosSdk/README.md index 3349442..5299a0f 100644 --- a/cosSdk/README.md +++ b/cosSdk/README.md @@ -16,7 +16,7 @@ ``` bash "dependencies": { ... - "@tencentcloud/cos":"1.1.0" + "@tencentcloud/cos":"1.1.1" } ``` 2. SDK 需要网络权限,用于与 COS 服务器进行通信,请在应用模块下的 module.json5 中添加如下权限声明: diff --git a/cosSdk/foundation110.har b/cosSdk/foundation110.har deleted file mode 100644 index 993a1b8..0000000 Binary files a/cosSdk/foundation110.har and /dev/null differ diff --git a/cosSdk/foundation111.har b/cosSdk/foundation111.har new file mode 100644 index 0000000..ecbef7e Binary files /dev/null and b/cosSdk/foundation111.har differ diff --git a/cosSdk/oh-package-lock.json5 b/cosSdk/oh-package-lock.json5 index 8431753..9a899ec 100644 --- a/cosSdk/oh-package-lock.json5 +++ b/cosSdk/oh-package-lock.json5 @@ -5,13 +5,13 @@ "lockfileVersion": 3, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "specifiers": { - "@tencentcloud/foundation@foundation110.har": "@tencentcloud/foundation@foundation110.har" + "@tencentcloud/foundation@foundation111.har": "@tencentcloud/foundation@../foundation" }, "packages": { - "@tencentcloud/foundation@foundation110.har": { + "@tencentcloud/foundation@../foundation": { "name": "@tencentcloud/foundation", - "version": "1.1.0", - "resolved": "foundation110.har", + "version": "1.1.1", + "resolved": "../foundation", "registryType": "local" } } diff --git a/cosSdk/oh-package.json5 b/cosSdk/oh-package.json5 index 56614e1..e7e12dc 100644 --- a/cosSdk/oh-package.json5 +++ b/cosSdk/oh-package.json5 @@ -1,6 +1,6 @@ { "name": "@tencentcloud/cos", - "version": "1.1.0", + "version": "1.1.1", "description": "Tencent cloud cos sdk", "main": "Index.ets", "keywords": ["对象存储", "COS", "腾讯云"], @@ -9,7 +9,7 @@ "author": "Cos", "license": "Apache-2.0", "dependencies": { - "@tencentcloud/foundation": "file:./foundation110.har" + "@tencentcloud/foundation": "file:./foundation111.har" // "@tencentcloud/foundation": "file:../foundation" } } \ No newline at end of file diff --git a/cosSdk/src/main/ets/CosXmlBaseService.ets b/cosSdk/src/main/ets/CosXmlBaseService.ets index 8a1c1ed..97adeb4 100644 --- a/cosSdk/src/main/ets/CosXmlBaseService.ets +++ b/cosSdk/src/main/ets/CosXmlBaseService.ets @@ -177,7 +177,7 @@ export class CosXmlBaseService { if (cosXmlRequest instanceof GetObjectRequest) { responseBodyConverter = new ResponseFileConverter(cosXmlRequest.filePath, cosXmlRequest.fileOffset, cosXmlResult, - cosXmlRequest.onProgress); + this.cosXmlServiceConfig.progressGranularity, cosXmlRequest.onProgress); } else if (cosXmlRequest instanceof GetObjectArrayBufferRequest) { responseBodyConverter = new ResponseArrayBufferConverter(cosXmlResult); } else { @@ -196,7 +196,8 @@ export class CosXmlBaseService { cosXmlRequest.getQueries(), cosXmlRequest.isNeedMD5, cosXmlRequest.isSignedInURL, - this.cosXmlServiceConfig.requestConfiguration + this.cosXmlServiceConfig.requestConfiguration, + this.cosXmlServiceConfig.progressGranularity ); qcloudHttpRequest.noSignHeaderKeys = new Set(Array.from(cosXmlRequest.noSignHeaderKeys).concat(Array.from(this.cosXmlServiceConfig.noSignHeaderKeys))); diff --git a/cosSdk/src/main/ets/CosXmlServiceConfig.ets b/cosSdk/src/main/ets/CosXmlServiceConfig.ets index 5ebed49..e29e3a4 100644 --- a/cosSdk/src/main/ets/CosXmlServiceConfig.ets +++ b/cosSdk/src/main/ets/CosXmlServiceConfig.ets @@ -88,6 +88,12 @@ export class CosXmlServiceConfig { */ region: string|undefined; + /** + * 单次网络请求的进度回调的时间颗粒度,默认为200ms + * 主要用于进度回调的频控,防止频率过高导致的anr等问题 + */ + progressGranularity: number = 200; + constructor(region?: string) { this.region = region; } diff --git a/cosSdk/src/main/ets/converter/ResponseFileConverter.ets b/cosSdk/src/main/ets/converter/ResponseFileConverter.ets index 1eb5edb..27b28d0 100644 --- a/cosSdk/src/main/ets/converter/ResponseFileConverter.ets +++ b/cosSdk/src/main/ets/converter/ResponseFileConverter.ets @@ -1,4 +1,4 @@ -import { HttpHeader, HttpProgress, HttpRequest, HttpUtils } from '@tencentcloud/foundation'; +import { HttpHeader, HttpProgress, HttpRequest, HttpUtils, ProgressController } from '@tencentcloud/foundation'; import { CosXmlResult } from '../model/CosXmlResult'; import { CosResponseBodyConverter } from './CosResponseBodyConverter'; import fs from '@ohos.file.fs'; @@ -10,19 +10,19 @@ export class ResponseFileConverter extends CosResponseBodyConverter { private filePath: string; private fileOffset: number = 0; private cosXmlResult: CosXmlResult; - private onProgress?:Callback; + private progressController: ProgressController; private file?: fs.File; // 重试修改range前已经下载的长度 private lastTimeBytes: number = 0; // 已传输的数据长度 private bytesTotal: number = 0; - constructor(filePath: string, fileOffset: number, cosXmlResult: CosXmlResult, onProgress?:Callback) { + constructor(filePath: string, fileOffset: number, cosXmlResult: CosXmlResult, progressGranularity: number, onProgress?:Callback) { super(); this.filePath = filePath; this.fileOffset = fileOffset; this.cosXmlResult = cosXmlResult; - this.onProgress = onProgress; + this.progressController = new ProgressController(onProgress, progressGranularity); } // 拿到header 因为http状态码最后才能拿到 需要跟进content type判断文件写入等 @@ -61,8 +61,8 @@ export class ResponseFileConverter extends CosResponseBodyConverter { this.bytesTotal += fs.writeSync(this.file.fd, arrayBuffer, { offset: this.bytesTotal + this.fileOffset, }) - if (this.onProgress) { - this.onProgress(new HttpProgress(this.bytesTotal, this.contentLength+this.lastTimeBytes)); + if (this.progressController) { + this.progressController.updateProgress(this.bytesTotal, this.contentLength+this.lastTimeBytes); } } diff --git a/cosSdk/src/ohosTest/ets/test/transfer/Download.test.ets b/cosSdk/src/ohosTest/ets/test/transfer/Download.test.ets index e576d93..5ed654a 100644 --- a/cosSdk/src/ohosTest/ets/test/transfer/Download.test.ets +++ b/cosSdk/src/ohosTest/ets/test/transfer/Download.test.ets @@ -110,6 +110,45 @@ export default function downloadTest(cosXmlBaseService: CosXmlBaseService) { } downloadTask.start(); }) + + // it('big_522m', 0, async (done: Function) => { + // let context = TestUtils.getContext(); + // let filePath = context.filesDir + '/big_object'; + // let request = new GetObjectRequest(TestConst.PERSIST_BUCKET, TestConst.PERSIST_BUCKET_BIG_FILE_PATH, filePath); + // let config = new CosXmlServiceConfig(TestConst.PERSIST_BUCKET_REGION); + // config.readTimeout = 15000 * 1000; + // let credentialCallBack: CredentialCallBack|undefined; + // if(cosXmlBaseService){ + // credentialCallBack = cosXmlBaseService.credentialCallBack; + // } else { + // credentialCallBack = CosXmlBaseService.default().credentialCallBack; + // } + // let cosBaseService = new CosXmlBaseService(context, config, credentialCallBack); + // await TestUtils.requestAddCredential(request, TestUtils.getCosXmlBaseService(cosBaseService)); + // let downloadTask = TestUtils.getCosXmlBaseService(cosXmlBaseService).download(request); + // let progressCount = 0; + // downloadTask.onProgress = (progress: HttpProgress)=>{ + // Logger.info(`已下载:${progress.complete},总大小:${progress.target}`) + // progressCount++; + // } + // downloadTask.onResult = { + // onSuccess: async (request: GetObjectRequest, result: CosXmlDownloadTaskResult)=>{ + // Logger.info(`下载成功:`) + // Logger.info(`下载_progressCount:${progressCount}/`) + // Logger.info(result) + // expect(true).assertTrue(); + // done(); + // }, + // onFail: (request: GetObjectRequest, error: CosError)=>{ + // Logger.info(`下载失败:`) + // Logger.info(`下载_progressCount:${progressCount}/`) + // TestUtils.printError(error); + // expect().assertFail(); + // done(); + // } + // } + // downloadTask.start(); + // }) // it('big', 0, async (done: Function) => { // let context = TestUtils.getContext(); // let filePath = context.filesDir + '/522m.zip'; diff --git a/cosSdk/src/ohosTest/ets/test/transfer/Upload.test.ets b/cosSdk/src/ohosTest/ets/test/transfer/Upload.test.ets index 1c6c9f3..2a0e55a 100644 --- a/cosSdk/src/ohosTest/ets/test/transfer/Upload.test.ets +++ b/cosSdk/src/ohosTest/ets/test/transfer/Upload.test.ets @@ -229,19 +229,26 @@ export default function uploadTest(cosXmlBaseService: CosXmlBaseService) { let filePath = FileUtils.getFile(100 * 1024 * 1024,'bigUpload'); let putRequest = new PutObjectRequest(TestConst.PERSIST_BUCKET, `uploadTest/UT/bigUpload`, filePath); await TestUtils.requestAddCredential(putRequest, TestUtils.getCosXmlBaseService(cosXmlBaseService)); - let task: UploadTask = TestUtils.getCosXmlBaseService(cosXmlBaseService).upload(putRequest); + let task: UploadTask = TestUtils.getCosXmlBaseService(cosXmlBaseService).upload( + putRequest, + + ); + let progressCount = 0; task.onProgress = (progress: HttpProgress) => { Logger.info(`bigUpload_onProgress:${progress.complete}/${progress.target}`) + progressCount++; }; task.onResult = { onSuccess: (request, result) => { Logger.info(`bigUpload_success`) + Logger.info(`bigUpload_progressCount:${progressCount}/`) Logger.info(result) expect(true).assertTrue(); done(); }, onFail: (request, error) => { Logger.info(`bigUpload_fail`) + Logger.info(`bigUpload_progressCount:${progressCount}/`) Logger.info(error) expect().assertFail() done(); diff --git a/cosTransferPractice/cosSdk-1.1.0.har b/cosTransferPractice/cosSdk-1.1.0.har deleted file mode 100644 index 4b9ed8c..0000000 Binary files a/cosTransferPractice/cosSdk-1.1.0.har and /dev/null differ diff --git a/cosTransferPractice/cosSdk-1.1.1.har b/cosTransferPractice/cosSdk-1.1.1.har new file mode 100644 index 0000000..9152808 Binary files /dev/null and b/cosTransferPractice/cosSdk-1.1.1.har differ diff --git a/cosTransferPractice/oh-package-lock.json5 b/cosTransferPractice/oh-package-lock.json5 index 86e72e9..8453f20 100644 --- a/cosTransferPractice/oh-package-lock.json5 +++ b/cosTransferPractice/oh-package-lock.json5 @@ -5,23 +5,24 @@ "lockfileVersion": 3, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "specifiers": { - "@tencentcloud/cos@cosSdk-1.1.0.har": "@tencentcloud/cos@cosSdk-1.1.0.har", - "@tencentcloud/foundation@../oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/foundation110.har": "@tencentcloud/foundation@../cosSdk/foundation110.har" + "@tencentcloud/cos@^1.1.1": "@tencentcloud/cos@1.1.1", + "@tencentcloud/foundation@../oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/foundation111.har": "@tencentcloud/foundation@../foundation" }, "packages": { - "@tencentcloud/cos@cosSdk-1.1.0.har": { + "@tencentcloud/cos@1.1.1": { "name": "@tencentcloud/cos", - "version": "1.1.0", - "resolved": "cosSdk-1.1.0.har", - "registryType": "local", + "version": "1.1.1", + "integrity": "sha512-DGZ3O74k24y7ajsdllHbBMiCyzDfA4LbrlXmBYzKWavUu4xLQEkzRHqg7HhSzQiiyfPtPMzOgTJ2HzucUQNkGg==", + "resolved": "https://ohpm.openharmony.cn/ohpm/@tencentcloud/cos/-/cos-1.1.1.har", + "registryType": "ohpm", "dependencies": { - "@tencentcloud/foundation": "file:./foundation110.har" + "@tencentcloud/foundation": "file:./foundation111.har" } }, - "@tencentcloud/foundation@../cosSdk/foundation110.har": { + "@tencentcloud/foundation@../foundation": { "name": "@tencentcloud/foundation", - "version": "1.1.0", - "resolved": "../cosSdk/foundation110.har", + "version": "1.1.1", + "resolved": "../foundation", "registryType": "local" } } diff --git a/cosTransferPractice/oh-package.json5 b/cosTransferPractice/oh-package.json5 index 416aecd..8a54ba3 100644 --- a/cosTransferPractice/oh-package.json5 +++ b/cosTransferPractice/oh-package.json5 @@ -7,8 +7,8 @@ "license": "", "dependencies": { // "@tencentcloud/cos": "file:../cosSdk" - "@tencentcloud/cos": "file:./cosSdk-1.1.0.har" -// "@tencentcloud/cos": "^1.1.0" +// "@tencentcloud/cos": "file:./cosSdk-1.1.1.har" + "@tencentcloud/cos": "^1.1.1" }, "devDependencies": {}, "dynamicDependencies": {} diff --git a/cosTransferPractice/src/main/ets/Const.ets b/cosTransferPractice/src/main/ets/Const.ets index 03d00d8..934ca0d 100644 --- a/cosTransferPractice/src/main/ets/Const.ets +++ b/cosTransferPractice/src/main/ets/Const.ets @@ -9,12 +9,12 @@ export enum CredentialType { export class Const { public static readonly CREDENTIAL_TYPE: CredentialType = CredentialType.STS;// 临时密钥STS和固定密钥CONST - public static readonly STS_CREDENTIAL_URL = "http://x.x.x.x:3000/sts"; + public static readonly STS_CREDENTIAL_URL = "http://*********:3000/sts"; public static readonly CONST_SECRET_ID = "XXXXXXXXXXXXXXXXXXXXXXX"; public static readonly CONST_SECRET_KEY = "XXXXXXXXXXXXXXXXXXXXXXX"; - public static readonly TEST_BUCKET_REGION = "ap-guangzhou"; - public static readonly TEST_BUCKET = "mobile-ut-1253960454"; + public static readonly TEST_BUCKET_REGION = "ap-nanjing"; + public static readonly TEST_BUCKET = "000garenwang-1253960454"; public static readonly TEST_UPLOAD_DIR = "uploadTest/"; - public static readonly TEST_DOWNLOAD_PATH = "do_not_remove/video.mp4"; + public static readonly TEST_DOWNLOAD_PATH = "test_video.mp4"; } \ No newline at end of file diff --git a/foundation/BuildProfile.ets b/foundation/BuildProfile.ets index cab3453..b844baf 100644 --- a/foundation/BuildProfile.ets +++ b/foundation/BuildProfile.ets @@ -1,7 +1,7 @@ /** * Use these variables when you tailor your ArkTS code. They must be of the const type. */ -export const HAR_VERSION = '1.1.0'; +export const HAR_VERSION = '1.1.1'; export const BUILD_MODE_NAME = 'release'; export const DEBUG = false; export const TARGET_NAME = 'default'; diff --git a/foundation/Index.ets b/foundation/Index.ets index cfdfb98..d3fcd03 100644 --- a/foundation/Index.ets +++ b/foundation/Index.ets @@ -7,7 +7,7 @@ export { QCloudCredential} from './src/main/ets/authentation/QCloudCredential' export { CredentialCache} from './src/main/ets/authentation/CredentialCache' export { QCloudSignatureBuilder, CredentialCallBack, SelfSignCallBack} from './src/main/ets/authentation/QCloudSignatureBuilder' export { HttpRequest } from './src/main/ets/net/HttpRequest' -export { HttpProgress } from './src/main/ets/net/HttpProgress' +export { HttpProgress, ProgressController } from './src/main/ets/net/HttpProgress' export { HttpResponse } from './src/main/ets/net/HttpResponse' export { ResponseBodyConverter } from './src/main/ets/net/ResponseBodyConverter' export { RequestBodySerializer, BaseRequestBodyWrapper } from './src/main/ets/net/RequestBodySerializer' diff --git a/foundation/oh-package.json5 b/foundation/oh-package.json5 index acaf30f..a6cd6f3 100644 --- a/foundation/oh-package.json5 +++ b/foundation/oh-package.json5 @@ -1,6 +1,6 @@ { "name": "@tencentcloud/foundation", - "version": "1.1.0", + "version": "1.1.1", "description": "Tencent cloud cos sdk basic library", "main": "Index.ets", "author": "Cos", diff --git a/foundation/src/main/ets/net/HttpProgress.ets b/foundation/src/main/ets/net/HttpProgress.ets index feb7ff4..0f99fb6 100644 --- a/foundation/src/main/ets/net/HttpProgress.ets +++ b/foundation/src/main/ets/net/HttpProgress.ets @@ -7,4 +7,36 @@ export class HttpProgress{ this.target = target; } +} + +/** + * 进度控制器,目前用于频控 + */ +export class ProgressController { + private lastUpdateTime = 0; + private timeGranularity: number | undefined; + private onProgress: Callback | undefined; + + // 时间颗粒度默认为200ms + constructor(onProgress: Callback | undefined, timeGranularity: number | undefined) { + this.onProgress = onProgress; + this.timeGranularity = timeGranularity; + } + + public updateProgress(complete: number, target: number) { + if(this.timeGranularity) { + const now = Date.now(); + const progress = (complete / target) * 100; + if (progress >= 100 || now - this.lastUpdateTime >= this.timeGranularity) { + this.lastUpdateTime = now; + if (this.onProgress) { + this.onProgress(new HttpProgress(complete, target)); + } + } + } else { + if (this.onProgress) { + this.onProgress(new HttpProgress(complete, target)); + } + } + } } \ No newline at end of file diff --git a/foundation/src/main/ets/net/HttpRequest.ets b/foundation/src/main/ets/net/HttpRequest.ets index 93ef0d0..f840b2d 100644 --- a/foundation/src/main/ets/net/HttpRequest.ets +++ b/foundation/src/main/ets/net/HttpRequest.ets @@ -29,11 +29,12 @@ export class HttpRequest { dnsOverHttps?: string; dnsServers?: string[]; requestConfiguration?: rcp.Configuration; + progressGranularity?: number; constructor(method: http.RequestMethod, protocol: string, host: string, port: number, path: string, requestBodySerializer: RequestBodySerializer | undefined, responseBodyConverter: ResponseBodyConverter, headers?: Map, queries?: Map, isNeedMD5?: boolean, - isSignedInURL?: boolean, requestConfiguration?: rcp.Configuration) { + isSignedInURL?: boolean, requestConfiguration?: rcp.Configuration, progressGranularity?: number) { this.method = method; this.protocol = protocol; this.host = host; @@ -47,7 +48,8 @@ export class HttpRequest { this.noSignQueryKeys = new Set(); this.isNeedMD5 = isNeedMD5 || false; this.isSignedInURL = isSignedInURL || false; - this.requestConfiguration = requestConfiguration + this.requestConfiguration = requestConfiguration; + this.progressGranularity = progressGranularity; } addHeader(key: string, value: string): void { diff --git a/foundation/src/main/ets/net/QCloudHttpRequest.ets b/foundation/src/main/ets/net/QCloudHttpRequest.ets index 4a74fc0..2eb810c 100644 --- a/foundation/src/main/ets/net/QCloudHttpRequest.ets +++ b/foundation/src/main/ets/net/QCloudHttpRequest.ets @@ -17,8 +17,8 @@ export class QCloudHttpRequest extends HttpRequest { constructor(method: http.RequestMethod, protocol: string, host: string, port: number, path: string, requestBodySerializer: RequestBodySerializer | undefined, responseBodyConverter: ResponseBodyConverter, headers?: Map, queries?: Map, isNeedMD5?: boolean, - isSignedInURL?: boolean, requestConfiguration?: rcp.Configuration) { + isSignedInURL?: boolean, requestConfiguration?: rcp.Configuration, progressGranularity?: number) { super(method, protocol, host, port, path, requestBodySerializer, responseBodyConverter, headers, queries, isNeedMD5, - isSignedInURL, requestConfiguration); + isSignedInURL, requestConfiguration, progressGranularity); } } \ No newline at end of file diff --git a/foundation/src/main/ets/task/QCloudTaskManager.ets b/foundation/src/main/ets/task/QCloudTaskManager.ets index bb300ca..0ee09f5 100644 --- a/foundation/src/main/ets/task/QCloudTaskManager.ets +++ b/foundation/src/main/ets/task/QCloudTaskManager.ets @@ -29,15 +29,15 @@ export class QCloudTaskManager{ this.requestQueue.customConcurrentCount = count; } - public addDownloadTask(task:QCloudHTTPTask){ + public addDownloadTask(task:QCloudTask){ this.downloadQueue.addTask(task); } - public addUploadTask(task:QCloudHTTPTask){ + public addUploadTask(task:QCloudTask){ this.uploadQueue.addTask(task); } - public addRequestTask(task:QCloudHTTPTask){ + public addRequestTask(task:QCloudTask){ this.requestQueue.addTask(task); } diff --git a/foundation/src/main/ets/task/http/QCloudHTTPTask.ets b/foundation/src/main/ets/task/http/QCloudHTTPTask.ets index c28c7a8..ac56eaa 100644 --- a/foundation/src/main/ets/task/http/QCloudHTTPTask.ets +++ b/foundation/src/main/ets/task/http/QCloudHTTPTask.ets @@ -68,6 +68,7 @@ export class QCloudHTTPTask extends QCloudTask { this.requestData.content = this.httpRequest.buildBody(); this.requestData.method = this.httpRequest.method; this.requestData.requestConfiguration = this.httpRequest.buildRequestConfiguration(); + this.requestData.progressGranularity = this.httpRequest.progressGranularity; this.requestData.taskId = this.taskId; return true; } diff --git a/foundation/src/main/ets/task/http/QCloudRequestData.ets b/foundation/src/main/ets/task/http/QCloudRequestData.ets index 19ca79e..3ca7fc6 100644 --- a/foundation/src/main/ets/task/http/QCloudRequestData.ets +++ b/foundation/src/main/ets/task/http/QCloudRequestData.ets @@ -9,4 +9,5 @@ export class QCloudRequestData extends Object{ public cookies?: rcp.RequestCookies public transferRange?: rcp.TransferRange | rcp.TransferRange[] public requestConfiguration?: rcp.Configuration + public progressGranularity?: number } \ No newline at end of file diff --git a/foundation/src/main/ets/task/http/TaskHTTPExecuteFunc.ets b/foundation/src/main/ets/task/http/TaskHTTPExecuteFunc.ets index 37ad657..ff66caa 100644 --- a/foundation/src/main/ets/task/http/TaskHTTPExecuteFunc.ets +++ b/foundation/src/main/ets/task/http/TaskHTTPExecuteFunc.ets @@ -3,7 +3,7 @@ import { QCloudTransferData } from '../base/QCloudTransferData'; import emitter from '@ohos.events.emitter'; import http from '@ohos.net.http'; import { QCloudRequestData } from './QCloudRequestData'; -import { HttpProgress } from '../../net/HttpProgress'; +import { HttpProgress, ProgressController } from '../../net/HttpProgress'; import { QCloudLogger } from '../../logger/QCloudLogger'; import { HashMap } from '@kit.ArkTS'; import { rcp } from '@kit.RemoteCommunicationKit'; @@ -63,20 +63,21 @@ export function TaskHTTPExecuteFunc(qcloudRequestData: QCloudRequestData) { } } + const progressController = new ProgressController((progress: HttpProgress) => { + SendEvent(new QCloudTransferData(QCloudEventType.dataProgress, progress, null)); + }, qcloudRequestData.progressGranularity); const customHttpEventsHandler: rcp.HttpEventsHandler = { onDataReceive: (incomingData: ArrayBuffer) => { SendEvent(new QCloudTransferData(QCloudEventType.dataReceive, incomingData, null)); }, onUploadProgress: (totalSize: number, transferredSize: number) => { if (qcloudRequestData.method == http.RequestMethod.PUT) { - SendEvent(new QCloudTransferData(QCloudEventType.dataProgress, new HttpProgress(transferredSize, totalSize), - null)); + progressController.updateProgress(transferredSize, totalSize); } }, onDownloadProgress: (totalSize: number, transferredSize: number) => { if (qcloudRequestData.method == http.RequestMethod.GET) { - SendEvent(new QCloudTransferData(QCloudEventType.dataProgress, new HttpProgress(transferredSize, totalSize), - null)); + progressController.updateProgress(transferredSize, totalSize); } }, onHeaderReceive: (headers: rcp.ResponseHeaders) => { diff --git a/oh-package.json5 b/oh-package.json5 index 29342ed..f9d2307 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -1,7 +1,7 @@ { "modelVersion": "5.0.0", "name": "tencentcloud_cos_sdk", - "version": "1.1.0", + "version": "1.1.1", "description": "Please describe the basic information.", "main": "", "author": "", diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/BuildProfile.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/BuildProfile.ets similarity index 93% rename from oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/BuildProfile.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/BuildProfile.ets index cab3453..b844baf 100644 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/BuildProfile.ets +++ b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/BuildProfile.ets @@ -1,7 +1,7 @@ /** * Use these variables when you tailor your ArkTS code. They must be of the const type. */ -export const HAR_VERSION = '1.1.0'; +export const HAR_VERSION = '1.1.1'; export const BUILD_MODE_NAME = 'release'; export const DEBUG = false; export const TARGET_NAME = 'default'; diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/CHANGELOG.md b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/CHANGELOG.md similarity index 73% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/CHANGELOG.md rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/CHANGELOG.md index 34f1625..7db462b 100644 --- a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/CHANGELOG.md +++ b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.1.1 +- 进度回调增加频控 + ## 1.1.0 - 更换http网络库到rcp - http重定向默认不开启 diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/Index.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/Index.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/Index.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/Index.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/LICENSE b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/LICENSE similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/LICENSE rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/LICENSE diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/README.md b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/README.md similarity index 99% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/README.md rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/README.md index 3349442..5299a0f 100644 --- a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/README.md +++ b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/README.md @@ -16,7 +16,7 @@ ``` bash "dependencies": { ... - "@tencentcloud/cos":"1.1.0" + "@tencentcloud/cos":"1.1.1" } ``` 2. SDK 需要网络权限,用于与 COS 服务器进行通信,请在应用模块下的 module.json5 中添加如下权限声明: diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/ResourceTable.txt b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/ResourceTable.txt similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/ResourceTable.txt rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/ResourceTable.txt diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/build-profile.json5 b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/build-profile.json5 similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/build-profile.json5 rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/build-profile.json5 diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/consumer-rules.txt b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/consumer-rules.txt similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/consumer-rules.txt rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/consumer-rules.txt diff --git a/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/foundation111.har b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/foundation111.har new file mode 100644 index 0000000..ecbef7e Binary files /dev/null and b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/foundation111.har differ diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/hvigorfile.ts b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/hvigorfile.ts similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/hvigorfile.ts rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/hvigorfile.ts diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/obfuscation-rules.txt b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/obfuscation-rules.txt similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/obfuscation-rules.txt rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/obfuscation-rules.txt diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/obfuscation.txt b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/obfuscation.txt similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/obfuscation.txt rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/obfuscation.txt diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/oh-package-lock.json5 b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/oh-package-lock.json5 similarity index 56% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/oh-package-lock.json5 rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/oh-package-lock.json5 index 8431753..9a899ec 100644 --- a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/oh-package-lock.json5 +++ b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/oh-package-lock.json5 @@ -5,13 +5,13 @@ "lockfileVersion": 3, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "specifiers": { - "@tencentcloud/foundation@foundation110.har": "@tencentcloud/foundation@foundation110.har" + "@tencentcloud/foundation@foundation111.har": "@tencentcloud/foundation@../foundation" }, "packages": { - "@tencentcloud/foundation@foundation110.har": { + "@tencentcloud/foundation@../foundation": { "name": "@tencentcloud/foundation", - "version": "1.1.0", - "resolved": "foundation110.har", + "version": "1.1.1", + "resolved": "../foundation", "registryType": "local" } } diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/oh-package.json5 b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/oh-package.json5 similarity index 75% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/oh-package.json5 rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/oh-package.json5 index e2ce08e..4aebdab 100644 --- a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/oh-package.json5 +++ b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/oh-package.json5 @@ -1 +1 @@ -{"name":"@tencentcloud/cos","version":"1.1.0","description":"Tencent cloud cos sdk","main":"Index.ets","keywords":["对象存储","COS","腾讯云"],"repository":"https://github.com/TencentCloud/cos-sdk-harmony","homepage":"https://cloud.tencent.com/document/product/436/112125","author":"Cos","license":"Apache-2.0","dependencies":{"@tencentcloud/foundation":"file:./foundation110.har"},"metadata":{"sourceRoots":["./src/main"],"debug":false},"compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":false} +{"name":"@tencentcloud/cos","version":"1.1.1","description":"Tencent cloud cos sdk","main":"Index.ets","keywords":["对象存储","COS","腾讯云"],"repository":"https://github.com/TencentCloud/cos-sdk-harmony","homepage":"https://cloud.tencent.com/document/product/436/112125","author":"Cos","license":"Apache-2.0","dependencies":{"@tencentcloud/foundation":"file:./foundation111.har"},"metadata":{"sourceRoots":["./src/main"],"debug":false},"compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":false} diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlBaseService.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlBaseService.ets similarity index 98% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlBaseService.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlBaseService.ets index 8a1c1ed..97adeb4 100644 --- a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlBaseService.ets +++ b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlBaseService.ets @@ -177,7 +177,7 @@ export class CosXmlBaseService { if (cosXmlRequest instanceof GetObjectRequest) { responseBodyConverter = new ResponseFileConverter(cosXmlRequest.filePath, cosXmlRequest.fileOffset, cosXmlResult, - cosXmlRequest.onProgress); + this.cosXmlServiceConfig.progressGranularity, cosXmlRequest.onProgress); } else if (cosXmlRequest instanceof GetObjectArrayBufferRequest) { responseBodyConverter = new ResponseArrayBufferConverter(cosXmlResult); } else { @@ -196,7 +196,8 @@ export class CosXmlBaseService { cosXmlRequest.getQueries(), cosXmlRequest.isNeedMD5, cosXmlRequest.isSignedInURL, - this.cosXmlServiceConfig.requestConfiguration + this.cosXmlServiceConfig.requestConfiguration, + this.cosXmlServiceConfig.progressGranularity ); qcloudHttpRequest.noSignHeaderKeys = new Set(Array.from(cosXmlRequest.noSignHeaderKeys).concat(Array.from(this.cosXmlServiceConfig.noSignHeaderKeys))); diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlServiceConfig.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlServiceConfig.ets similarity index 93% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlServiceConfig.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlServiceConfig.ets index 5ebed49..e29e3a4 100644 --- a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlServiceConfig.ets +++ b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/CosXmlServiceConfig.ets @@ -88,6 +88,12 @@ export class CosXmlServiceConfig { */ region: string|undefined; + /** + * 单次网络请求的进度回调的时间颗粒度,默认为200ms + * 主要用于进度回调的频控,防止频率过高导致的anr等问题 + */ + progressGranularity: number = 200; + constructor(region?: string) { this.region = region; } diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/common/Constants.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/common/Constants.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/common/Constants.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/common/Constants.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/common/Range.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/common/Range.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/common/Range.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/common/Range.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/converter/CosResponseBodyConverter.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/converter/CosResponseBodyConverter.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/converter/CosResponseBodyConverter.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/converter/CosResponseBodyConverter.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseArrayBufferConverter.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseArrayBufferConverter.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseArrayBufferConverter.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseArrayBufferConverter.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseCosXmlConverter.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseCosXmlConverter.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseCosXmlConverter.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseCosXmlConverter.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseFileConverter.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseFileConverter.ets similarity index 88% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseFileConverter.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseFileConverter.ets index 1eb5edb..27b28d0 100644 --- a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseFileConverter.ets +++ b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/converter/ResponseFileConverter.ets @@ -1,4 +1,4 @@ -import { HttpHeader, HttpProgress, HttpRequest, HttpUtils } from '@tencentcloud/foundation'; +import { HttpHeader, HttpProgress, HttpRequest, HttpUtils, ProgressController } from '@tencentcloud/foundation'; import { CosXmlResult } from '../model/CosXmlResult'; import { CosResponseBodyConverter } from './CosResponseBodyConverter'; import fs from '@ohos.file.fs'; @@ -10,19 +10,19 @@ export class ResponseFileConverter extends CosResponseBodyConverter { private filePath: string; private fileOffset: number = 0; private cosXmlResult: CosXmlResult; - private onProgress?:Callback; + private progressController: ProgressController; private file?: fs.File; // 重试修改range前已经下载的长度 private lastTimeBytes: number = 0; // 已传输的数据长度 private bytesTotal: number = 0; - constructor(filePath: string, fileOffset: number, cosXmlResult: CosXmlResult, onProgress?:Callback) { + constructor(filePath: string, fileOffset: number, cosXmlResult: CosXmlResult, progressGranularity: number, onProgress?:Callback) { super(); this.filePath = filePath; this.fileOffset = fileOffset; this.cosXmlResult = cosXmlResult; - this.onProgress = onProgress; + this.progressController = new ProgressController(onProgress, progressGranularity); } // 拿到header 因为http状态码最后才能拿到 需要跟进content type判断文件写入等 @@ -61,8 +61,8 @@ export class ResponseFileConverter extends CosResponseBodyConverter { this.bytesTotal += fs.writeSync(this.file.fd, arrayBuffer, { offset: this.bytesTotal + this.fileOffset, }) - if (this.onProgress) { - this.onProgress(new HttpProgress(this.bytesTotal, this.contentLength+this.lastTimeBytes)); + if (this.progressController) { + this.progressController.updateProgress(this.bytesTotal, this.contentLength+this.lastTimeBytes); } } diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosClientError.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosClientError.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosClientError.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosClientError.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosError.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosError.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosError.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosError.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosErrorCode.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosErrorCode.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosErrorCode.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosErrorCode.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosInvalidArgumentError.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosInvalidArgumentError.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosInvalidArgumentError.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosInvalidArgumentError.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosServiceError.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosServiceError.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosServiceError.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosServiceError.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosTransferPauseError.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosTransferPauseError.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/error/CosTransferPauseError.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/error/CosTransferPauseError.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/CosXmlRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/CosXmlRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/CosXmlRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/CosXmlRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/CosXmlResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/CosXmlResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/CosXmlResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/CosXmlResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/AbortMultiUploadRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/AbortMultiUploadRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/AbortMultiUploadRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/AbortMultiUploadRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/AbortMultiUploadResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/AbortMultiUploadResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/AbortMultiUploadResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/AbortMultiUploadResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/CompleteMultiUploadRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/CompleteMultiUploadRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/CompleteMultiUploadRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/CompleteMultiUploadRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/CompleteMultiUploadResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/CompleteMultiUploadResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/CompleteMultiUploadResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/CompleteMultiUploadResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/DeleteObjectRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/DeleteObjectRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/DeleteObjectRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/DeleteObjectRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/DeleteObjectResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/DeleteObjectResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/DeleteObjectResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/DeleteObjectResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectArrayBufferRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectArrayBufferRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectArrayBufferRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectArrayBufferRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectArrayBufferResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectArrayBufferResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectArrayBufferResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectArrayBufferResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/GetObjectResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/HeadObjectRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/HeadObjectRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/HeadObjectRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/HeadObjectRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/HeadObjectResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/HeadObjectResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/HeadObjectResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/HeadObjectResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/InitMultipartUploadRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/InitMultipartUploadRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/InitMultipartUploadRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/InitMultipartUploadRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/InitMultipartUploadResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/InitMultipartUploadResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/InitMultipartUploadResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/InitMultipartUploadResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ListPartsRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ListPartsRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ListPartsRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ListPartsRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ListPartsResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ListPartsResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ListPartsResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ListPartsResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ObjectRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ObjectRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ObjectRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/ObjectRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PresignedUrlRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PresignedUrlRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PresignedUrlRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PresignedUrlRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PresignedUrlResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PresignedUrlResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PresignedUrlResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PresignedUrlResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PutObjectRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PutObjectRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PutObjectRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PutObjectRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PutObjectResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PutObjectResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PutObjectResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/PutObjectResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/TransferRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/TransferRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/TransferRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/TransferRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/UploadPartRequest.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/UploadPartRequest.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/UploadPartRequest.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/UploadPartRequest.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/UploadPartResult.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/UploadPartResult.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/object/UploadPartResult.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/object/UploadPartResult.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/ImageInfo.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/ImageInfo.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/ImageInfo.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/ImageInfo.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicObject.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicObject.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicObject.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicObject.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicOperations.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicOperations.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicOperations.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicOperations.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicOriginalInfo.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicOriginalInfo.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicOriginalInfo.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/model/pic/PicOriginalInfo.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/transfer/DownloadTask.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/transfer/DownloadTask.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/transfer/DownloadTask.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/transfer/DownloadTask.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/transfer/TransferConfig.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/transfer/TransferConfig.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/transfer/TransferConfig.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/transfer/TransferConfig.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/transfer/TransferTask.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/transfer/TransferTask.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/transfer/TransferTask.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/transfer/TransferTask.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/transfer/UploadTask.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/transfer/UploadTask.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/transfer/UploadTask.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/transfer/UploadTask.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/util/CosErrorUtils.ets b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/util/CosErrorUtils.ets similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/ets/util/CosErrorUtils.ets rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/ets/util/CosErrorUtils.ets diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/module.json b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/module.json similarity index 92% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/module.json rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/module.json index 7dc524c..9d6fe7b 100644 --- a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/module.json +++ b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/module.json @@ -1,8 +1,8 @@ { "app": { "bundleName": "com.tencent.cloud.cos", - "versionCode": 1010100, - "versionName": "1.1.0", + "versionCode": 1010101, + "versionName": "1.1.1", "minAPIVersion": 50000012, "targetAPIVersion": 50000012, "apiReleaseType": "Release", diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/resources/base/element/string.json b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/resources/base/element/string.json similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/resources/base/element/string.json rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/resources/base/element/string.json diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/resources/en_US/element/string.json b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/resources/en_US/element/string.json similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/resources/en_US/element/string.json rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/resources/en_US/element/string.json diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/resources/zh_CN/element/string.json b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/resources/zh_CN/element/string.json similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/main/resources/zh_CN/element/string.json rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/main/resources/zh_CN/element/string.json diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/mock/mock-config.json5 b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/mock/mock-config.json5 similarity index 100% rename from oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/src/mock/mock-config.json5 rename to oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos/src/mock/mock-config.json5 diff --git a/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/foundation b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/foundation new file mode 120000 index 0000000..38b469e --- /dev/null +++ b/oh_modules/.ohpm/@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/foundation @@ -0,0 +1 @@ +../../../../../foundation \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/BuildProfile.ets b/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/BuildProfile.ets deleted file mode 100644 index cab3453..0000000 --- a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/BuildProfile.ets +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Use these variables when you tailor your ArkTS code. They must be of the const type. - */ -export const HAR_VERSION = '1.1.0'; -export const BUILD_MODE_NAME = 'release'; -export const DEBUG = false; -export const TARGET_NAME = 'default'; - -/** - * BuildProfile Class is used only for compatibility purposes. - */ -export default class BuildProfile { - static readonly HAR_VERSION = HAR_VERSION; - static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; - static readonly DEBUG = DEBUG; - static readonly TARGET_NAME = TARGET_NAME; -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/foundation110.har b/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/foundation110.har deleted file mode 100644 index 993a1b8..0000000 Binary files a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/cos/foundation110.har and /dev/null differ diff --git a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/foundation b/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/foundation deleted file mode 120000 index 6d85764..0000000 --- a/oh_modules/.ohpm/@tencentcloud+cos@yl4bdbzq7tz3mcdptfdy5sccjw8+yruuj7kq+neywlg=/oh_modules/@tencentcloud/foundation +++ /dev/null @@ -1 +0,0 @@ -../../../@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/Index.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/Index.ets deleted file mode 100644 index cfdfb98..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/Index.ets +++ /dev/null @@ -1,27 +0,0 @@ -export { QCloudTask, QCloudPriority, QCloudEventType } from './src/main/ets/task/base/QCloudTask'; -export { QCloudHTTPTask } from './src/main/ets/task/http/QCloudHTTPTask'; -export { QCloudTaskManager } from './src/main/ets/task/QCloudTaskManager'; -export { QCloudHttpRequest } from './src/main/ets/net/QCloudHttpRequest' -export { QCloudLogger } from './src/main/ets/logger/QCloudLogger' -export { QCloudCredential} from './src/main/ets/authentation/QCloudCredential' -export { CredentialCache} from './src/main/ets/authentation/CredentialCache' -export { QCloudSignatureBuilder, CredentialCallBack, SelfSignCallBack} from './src/main/ets/authentation/QCloudSignatureBuilder' -export { HttpRequest } from './src/main/ets/net/HttpRequest' -export { HttpProgress } from './src/main/ets/net/HttpProgress' -export { HttpResponse } from './src/main/ets/net/HttpResponse' -export { ResponseBodyConverter } from './src/main/ets/net/ResponseBodyConverter' -export { RequestBodySerializer, BaseRequestBodyWrapper } from './src/main/ets/net/RequestBodySerializer' -export { RequestFileBodyWrapper } from './src/main/ets/net/RequestFileBodyWrapper' -export { HttpHeader, ContentType } from './src/main/ets/net/HttpConstants' -export { HttpUtils } from './src/main/ets/util/HttpUtils' -export { XmlUtils } from './src/main/ets/util/XmlUtils' -export { CryptoUtil } from './src/main/ets/util/CryptoUtil' -export { StringUtils } from './src/main/ets/util/StringUtils' -export { RetryHandler } from './src/main/ets/retry/RetryHandler' -export { QCloudAuthenticationError } from './src/main/ets/error/QCloudAuthenticationError' -export { QCloudUserCancelError } from './src/main/ets/error/QCloudUserCancelError' -export { QCloudNetError } from './src/main/ets/error/QCloudNetError' -export { QCloudTaskError } from './src/main/ets/error/QCloudTaskError' -export { QCloudTransferData } from './src/main/ets/task/base/QCloudTransferData' -export { TaskHTTPExecuteFunc } from './src/main/ets/task/http/TaskHTTPExecuteFunc' -export { LoggerOptions } from './src/main/ets/logger//LoggerOptions' diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/ResourceTable.txt b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/ResourceTable.txt deleted file mode 100644 index 95b3741..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/ResourceTable.txt +++ /dev/null @@ -1 +0,0 @@ -string page_show 0x03000000 \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/build-profile.json5 b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/build-profile.json5 deleted file mode 100644 index e6773f9..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/build-profile.json5 +++ /dev/null @@ -1,31 +0,0 @@ -{ - "apiType": "stageMode", - "buildOption": { - }, - "buildOptionSet": [ - { - "name": "release", - "arkOptions": { - "obfuscation": { - "ruleOptions": { - "enable": false, - "files": [ - "./obfuscation-rules.txt" - ] - }, - "consumerFiles": [ - "./consumer-rules.txt" - ] - } - }, - }, - ], - "targets": [ - { - "name": "default" - }, - { - "name": "ohosTest" - } - ] -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/consumer-rules.txt b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/consumer-rules.txt deleted file mode 100644 index e69de29..0000000 diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/hvigorfile.ts b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/hvigorfile.ts deleted file mode 100644 index 4218707..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/hvigorfile.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { harTasks } from '@ohos/hvigor-ohos-plugin'; - -export default { - system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ - plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/obfuscation-rules.txt b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/obfuscation-rules.txt deleted file mode 100644 index 985b2ae..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/obfuscation-rules.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Define project specific obfuscation rules here. -# You can include the obfuscation configuration files in the current module's build-profile.json5. -# -# For more details, see -# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md - -# Obfuscation options: -# -disable-obfuscation: disable all obfuscations -# -enable-property-obfuscation: obfuscate the property names -# -enable-toplevel-obfuscation: obfuscate the names in the global scope -# -compact: remove unnecessary blank spaces and all line feeds -# -remove-log: remove all console.* statements -# -print-namecache: print the name cache that contains the mapping from the old names to new names -# -apply-namecache: reuse the given cache file - -# Keep options: -# -keep-property-name: specifies property names that you want to keep -# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/obfuscation.txt b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/obfuscation.txt deleted file mode 100644 index e69de29..0000000 diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/oh-package-lock.json5 b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/oh-package-lock.json5 deleted file mode 100644 index 22f9d34..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/oh-package-lock.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - "meta": { - "stableOrder": true - }, - "lockfileVersion": 3, - "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", - "specifiers": {}, - "packages": {} -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/oh-package.json5 b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/oh-package.json5 deleted file mode 100644 index 9210c49..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/oh-package.json5 +++ /dev/null @@ -1 +0,0 @@ -{"name":"@tencentcloud/foundation","version":"1.1.0","description":"Tencent cloud cos sdk basic library","main":"Index.ets","author":"Cos","license":"Apache-2.0","devDependencies":{},"dynamicDependencies":{},"metadata":{"sourceRoots":["./src/main"],"debug":false},"compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":false} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/CredentialCache.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/CredentialCache.ets deleted file mode 100644 index 059f6c1..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/CredentialCache.ets +++ /dev/null @@ -1,29 +0,0 @@ -import { QCloudCredential } from './QCloudCredential'; - -export class CredentialCache { - - credential:QCloudCredential | null = null; - - private static instance: CredentialCache | undefined; - public static singleCache(): CredentialCache { - if (!CredentialCache.instance) { - CredentialCache.instance = new CredentialCache(); - } - return CredentialCache.instance; - } - - clearCredential(){ - CredentialCache.singleCache().credential = null; - } - - cacheCredential(credential:QCloudCredential){ - CredentialCache.singleCache().credential = credential; - } - - getCredential():QCloudCredential|null{ - if (CredentialCache.singleCache().credential?.valid()) { - return CredentialCache.singleCache().credential; - } - return null; - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudAuthentationCreator.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudAuthentationCreator.ets deleted file mode 100644 index 11c6079..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudAuthentationCreator.ets +++ /dev/null @@ -1,172 +0,0 @@ -import { QCloudCredential } from './QCloudCredential'; -import { ArrayList} from '@kit.ArkTS'; -import { CryptoUtil } from '../util/CryptoUtil'; -import { QCloudSignature } from './QCloudSignature'; -import { QCloudHttpRequest } from '../net/QCloudHttpRequest'; -import { http } from '@kit.NetworkKit'; - -function camSafeUrlEncode(str:string) { - return encodeURIComponent(str) - .replace(/!/g, '%21') - .replace(/'/g, '%27') - .replace(/\(/g, '%28') - .replace(/\)/g, '%29') - .replace(/\*/g, '%2A'); -} - -function getSignParams(headers:Map,noSign:Set,isHeader:boolean):Map { - let tempHeaders = new Map(); - let lowerCaseNoSign = new Set(Array.from(noSign, value => value.toLowerCase())); - for (const item of headers.keys()) { - let key = item.toLowerCase(); - if (isHeader){ - if (!lowerCaseNoSign.has(key) && !key.includes('x-cos-')) { - tempHeaders.set(item,headers.get(item)!); - } - }else{ - if (!lowerCaseNoSign.has(key)) { - tempHeaders.set(item,headers.get(item)!); - } - } - } - return tempHeaders; -}; - -function getObjectKeys(obj: Map): string[] { - let list:string[] = []; - for (let key of obj.keys()) { - list.push(camSafeUrlEncode(key).toLowerCase()); - } - - list.sort((a:string, b:string) => { - let aV = a.toLowerCase(); - let bV = b.toLowerCase(); - return aV === bV ? 0 : aV > bV ? 1 : -1; - }); - - return list; -} - -function obj2str(obj: Map, lowerCaseKey: boolean): string { - let val: string; - let list: string[] = []; - for (const key of obj.keys()) { - val = obj.get(key) === undefined || obj.get(key) === null ? '' : '' + obj.get(key); - let tkey = lowerCaseKey ? camSafeUrlEncode(key).toLowerCase() : camSafeUrlEncode(key); - val = camSafeUrlEncode(val) || ''; - list.push(tkey + '=' + val); - } - list.sort((a:string, b:string) => { - let aV = a.toLowerCase(); - let bV = b.toLowerCase(); - return aV === bV ? 0 : aV > bV ? 1 : -1; - }); - return list.join('&'); -} - -export class QCloudAuthentationCreator{ - - private credential:QCloudCredential; - - public tokenName:string = "x-cos-security-token"; - - excloudSignedList?:ArrayList; - - constructor(credential:QCloudCredential) { - this.credential = credential; - } - - getCredential(){ - return this.credential; - } - - setTokenName(tokenName:string){ - this.tokenName = tokenName; - } - - async buildSignature(httpRequest:QCloudHttpRequest): Promise { - - if (!this.credential || !this.credential.secretID || !this.credential.secretKey) { - return new QCloudSignature(); - } - if (this.credential.token) { - if (httpRequest.isSignedInURL) { - httpRequest.addQuery(this.tokenName,this.credential.token); - }else{ - httpRequest.addHeader(this.tokenName,this.credential.token); - } - } - const SecretId = this.credential.secretID; - const SecretKey = this.credential.secretKey; - const method = httpRequest?.method.toLowerCase(); - const queryParams:Map = httpRequest?.queries || new Map(); - const headerParams:Map = httpRequest?.headers || new Map(); - - - let now = new Date().getTime()/1000; - if (this.credential.startDate) { - now = this.credential.startDate.getTime()/1000; - } - - let exp = now + 1800; - - if (this.credential.expirationDate) { - exp = this.credential.expirationDate.getTime()/1000; - } - - const qSignAlgorithm = 'sha1'; - const qAk = SecretId; - const qSignTime = Math.floor(now) + ';' + Math.floor(exp); - const qKeyTime = Math.floor(now) + ';' + Math.floor(exp); - - let headers = getSignParams(headerParams!,httpRequest.noSignHeaderKeys,true); - let queries = getSignParams(queryParams!,httpRequest.noSignQueryKeys,false); - - if (this.credential.token ) { - if (httpRequest.isSignedInURL) { - queries.set(this.tokenName,this.credential.token); - }else{ - headers.set(this.tokenName,this.credential.token); - } - } - - const qHeaderList = getObjectKeys(headers).join(';').toLowerCase(); - const qUrlParamList = getObjectKeys(queries).join(';').toLowerCase(); - - // 签名算法说明文档:https://www.qcloud.com/document/product/436/7778 - // 步骤一:计算 SignKey - const signKey = await CryptoUtil.qcloudHmacSha1(qKeyTime, SecretKey); - - let path = httpRequest.path; - if (path.length > 0 && path.substring(0,1) != '/') { - path = '/' + path; - } - if (path.includes("?")) { - path = path.split("?")[0] - } - path = decodeURI(path); - // 步骤二:构成 FormatString - const formatString = [method, path, obj2str(queries, true), obj2str(headers, true), ''].join('\n'); - - // 步骤三:计算 StringToSign - const stringToSign = ['sha1', qSignTime, await CryptoUtil.qlcoudSha1(formatString), ''].join('\n'); - - // 步骤四:计算 Signature - const qSignature = await CryptoUtil.qcloudHmacSha1(stringToSign, signKey); - - // 步骤五:构造 Authorization - const authorization = [ - 'q-sign-algorithm=' + qSignAlgorithm, - 'q-ak=' + qAk, - 'q-sign-time=' + qSignTime, - 'q-key-time=' + qKeyTime, - 'q-header-list=' + qHeaderList, - 'q-url-param-list=' + qUrlParamList, - 'q-signature=' + qSignature, - ].join('&'); - - let signature = new QCloudSignature(authorization,this.credential.token); - signature.tokenName = this.tokenName; - return signature; - } -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudCredential.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudCredential.ets deleted file mode 100644 index 6e67c1d..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudCredential.ets +++ /dev/null @@ -1,43 +0,0 @@ - -export class QCloudCredential { - - /** - * 开发者拥有的项目身份识别 ID,用以身份认证 - */ - secretID?:string; - - /** - * 开发者拥有的项目身份密钥。可以为永久密钥,也可以是临时密钥(参考CAM系统)。 - */ - secretKey?:string; - - /** - * 签名有效期的起始时间。默认是设备的本地时间,如果传入起始时间,那么将以起始时间去计算签名。 - */ - startDate?:Date; - - /** - * 签名有效期截止的时间。没有设置的话,默认是起始时间加30分钟。 - */ - expirationDate?:Date; - - /** - * 当您使用了CAM系统获取临时密钥的时候,请设置改值,代表回话的ID。 - */ - token?:string; - - public valid():boolean{ - - if (!this.expirationDate) { - return true; - } - - let date = new Date() - - // 提前60刷新 - if (date.getTime() >= this.expirationDate.getTime() - (60 * 1000)) { - return false; - } - return true; - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudSignature.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudSignature.ets deleted file mode 100644 index 8f78dab..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudSignature.ets +++ /dev/null @@ -1,22 +0,0 @@ -/** - 访问腾讯云的服务需要对请求进行签名,以确定访问的用户身份,同时也保障访问的安全性。该类为腾讯云签名的抽象类。他代表了一个用于访问腾讯云服务的签名信息。 - 需要您注意的是,签名信息是有有效期的。而您在创建签名信息的时候,也请您赋值相应的有效期。 - 这个有效期在您进行签名的时候已经指定了,请确保此处的有效期和您进行签名的时候保持一致。否则将会产生不能访问腾讯云服务的问题。 - */ - -export class QCloudSignature{ - - - token?:string; - - tokenName?:string; - /** - 签名字符串,经过签名算法计算之后的字符串。 - */ - authorization?:string; - - constructor(authorization?:string,token?:string) { - this.authorization = authorization; - this.token = token; - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudSignatureBuilder.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudSignatureBuilder.ets deleted file mode 100644 index caf54b9..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/authentation/QCloudSignatureBuilder.ets +++ /dev/null @@ -1,46 +0,0 @@ -import { QCloudAuthenticationError } from '../error/QCloudAuthenticationError'; -import { QCloudLogger } from '../logger/QCloudLogger'; -import { HttpRequest } from '../net/HttpRequest'; -import { QCloudHttpRequest } from '../net/QCloudHttpRequest'; -import { CredentialCache } from './CredentialCache'; -import { QCloudAuthentationCreator } from './QCloudAuthentationCreator'; -import { QCloudCredential } from './QCloudCredential'; -import { QCloudSignature } from './QCloudSignature'; - -export type SelfSignCallBack = (reqeust:HttpRequest) => Promise; - -export type CredentialCallBack = (reqeust:HttpRequest) => Promise; - -export class QCloudSignatureBuilder{ - public static async signatureBuild(request:QCloudHttpRequest):Promise{ - return new Promise( async (resolve,reject)=>{ - let credential:QCloudCredential|null = null; - // 凭证获取优先级:常量凭证>缓存凭证>回调获取 - if (request.credential){ - credential = request.credential; - }else if (CredentialCache.singleCache().getCredential() != null && CredentialCache.singleCache().getCredential() != undefined){ - credential = CredentialCache.singleCache().getCredential()!; - }else if(request.credentialCallBack){ - QCloudLogger.log("Credential_buildRequestData" + ":" + "getNewCredentialCallBack") - try { - setTimeout(()=>{reject(new QCloudAuthenticationError(Error("timeout getting temporary key")))}, 20 * 1000); - credential = await request.credentialCallBack(request); - CredentialCache.singleCache().cacheCredential(credential) - } catch (e) { - reject(new QCloudAuthenticationError(e)) - } - } - if(credential){ - try { - let creator = new QCloudAuthentationCreator(credential); - let signature = await creator.buildSignature(request) - resolve(signature); - } catch (e) { - reject(new QCloudAuthenticationError(e)) - } - } else { - resolve(null); - } - }) - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudAuthenticationError.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudAuthenticationError.ets deleted file mode 100644 index 8c29e77..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudAuthenticationError.ets +++ /dev/null @@ -1,10 +0,0 @@ -/** - * 凭证验证error - */ -export class QCloudAuthenticationError extends Error { - public error: object; - constructor(error: object) { - super(); - this.error = error; - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudNetError.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudNetError.ets deleted file mode 100644 index aaca997..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudNetError.ets +++ /dev/null @@ -1,10 +0,0 @@ -/** - * 网络error - */ -export class QCloudNetError extends Error { - public netError: object; - constructor(netError: object) { - super(); - this.netError = netError; - } -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudTaskError.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudTaskError.ets deleted file mode 100644 index a4789e7..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudTaskError.ets +++ /dev/null @@ -1,10 +0,0 @@ -/** - * 任务error - */ -export class QCloudTaskError extends Error { - public taskError: object; - constructor(taskError: object) { - super(); - this.taskError = taskError; - } -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudUserCancelError.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudUserCancelError.ets deleted file mode 100644 index 001cc8b..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/error/QCloudUserCancelError.ets +++ /dev/null @@ -1,8 +0,0 @@ -/** - * 用户取消error - */ -export class QCloudUserCancelError extends Error { - constructor() { - super("user cancel"); - } -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/logger/LoggerOptions.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/logger/LoggerOptions.ets deleted file mode 100644 index 4d73d79..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/logger/LoggerOptions.ets +++ /dev/null @@ -1,8 +0,0 @@ -export class LoggerOptions { - tag?: string - domain?: number - close?: boolean - isHilog?: boolean - showLogLocation?: boolean - logSize?: number -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/logger/QCloudLogger.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/logger/QCloudLogger.ets deleted file mode 100644 index 60d0097..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/logger/QCloudLogger.ets +++ /dev/null @@ -1,209 +0,0 @@ -import hilog from '@ohos.hilog' -import { LoggerOptions } from './LoggerOptions' - -export class QCloudLogger { - private static mTag?: string = "QCloudLog" - private static mDomain?: number = 0x0369 //日志对应的领域标识,范围是0x0~0xFFFF - private static mHilog?: boolean = true //默认是用hilog进行打印 - private static mShowLogLocation?: boolean = false //展示点击的位置 - private static mLogSize = 1024 //打印的最大长度,默认是1024 - private static mClose?: boolean = true - - static setClose(close: boolean) { - QCloudLogger.mClose = close - } - - /* - * 初始化tag、domain等属性 - * */ - static init(options: LoggerOptions) { - const tag: string | undefined = options.tag //日志输出Tag - const domain: number | undefined = options.domain //日志对应的领域标识,范围是0x0~0xFFFF - const close: boolean | undefined = options.close //是否关闭日志 - const isHilog: boolean | undefined = options.isHilog //是否是hilog打印 - const showLogLocation: boolean | undefined = options.showLogLocation //是否展示日志位置 - const logSize: number | undefined = options.logSize //日志输出大小 - if (tag != undefined) { - QCloudLogger.mTag = tag - } - if (domain != undefined) { - QCloudLogger.mDomain = domain - } - if (close != undefined) { - QCloudLogger.mClose = close - } - if (isHilog != undefined) { - QCloudLogger.mHilog = isHilog - } - if (showLogLocation != undefined) { - QCloudLogger.mShowLogLocation = showLogLocation - } - if (logSize != undefined) { - QCloudLogger.mLogSize = logSize - } - - } - - //需要先调用isLoggable确认某个domain、tag和日志级别是否被禁止打印日志 - static isLoggable(level: hilog.LogLevel): boolean { - return hilog.isLoggable(QCloudLogger.mDomain, QCloudLogger.mTag, level) - } - - /* -* debug日志 -* */ - static debug(message: string | object, tag?: string) { - QCloudLogger.logLevel(hilog.LogLevel.DEBUG, tag, message) - } - - /* -* info日志 -* */ - static info(message: string | object, tag?: string) { - QCloudLogger.logLevel(hilog.LogLevel.INFO, tag, message) - } - - /* -* error日志,不带标签 -* */ - static error(message: string | object, tag?: string) { - QCloudLogger.logLevel(hilog.LogLevel.ERROR, tag, message) - } - - - /* -* warn日志 -* */ - static warn(message: string | object, tag?: string) { - QCloudLogger.logLevel(hilog.LogLevel.WARN, tag, message) - } - - /* -* fatal日志 -* */ - static fatal(message: string, tag?: string) { - QCloudLogger.logLevel(hilog.LogLevel.FATAL, tag, message) - } - - /* -* console形式打印log日志,只支持console -* */ - static log(message: string | object, tag?: string | undefined) { - QCloudLogger.logLevel(hilog.LogLevel.INFO, tag, message) - } - - /* - *统一输出日志 - * */ - private static logLevel(level: hilog.LogLevel, tag?: string, message: string | object = "") { - //如果关闭状态,则不打印日志 - if (QCloudLogger.mClose) { - return - } - - //未传递时 - if (tag == undefined) { - tag = QCloudLogger.mTag - } - - const content = QCloudLogger.getMessage(level, tag, message) //最终的内容展示 - - const len = content.length / QCloudLogger.mLogSize - for (let i = 0; i < len; i++) { - let con = content.substring(i * QCloudLogger.mLogSize, (i + 1) * QCloudLogger.mLogSize) - if (i != 0) { - con = "|" + con - } - //打印日志 - if (QCloudLogger.mHilog) { - //使用hilog - switch (level) { - case hilog.LogLevel.INFO: //info - hilog.info(QCloudLogger.mDomain, tag, con) - break - case hilog.LogLevel.WARN: //WARN - hilog.warn(QCloudLogger.mDomain, tag, con) - break - case hilog.LogLevel.DEBUG: //DEBUG - hilog.debug(QCloudLogger.mDomain, tag, con) - break - case hilog.LogLevel.ERROR: //ERROR - hilog.error(QCloudLogger.mDomain, tag, con) - break - case hilog.LogLevel.FATAL: //FATAL - hilog.fatal(QCloudLogger.mDomain, tag, con) - break - } - } else { - //使用console - switch (level) { - case hilog.LogLevel.INFO: //info - console.info(con) - break - case hilog.LogLevel.WARN: //WARN - console.warn(con) - break - case hilog.LogLevel.DEBUG: //DEBUG - console.debug(con) - break - case hilog.LogLevel.ERROR: //ERROR - console.error(con) - break - case hilog.LogLevel.FATAL: //FATAL - console.log(con) - break - } - } - - } - - } - - /** - * 获取输出位置 - * */ - static getMessage(level: hilog.LogLevel, tag: string = "", message: string | object): string { - let log = "┌───────" + tag + "────────────────────────────────────────────────────────────────────────────────" - log = log.substring(0, log.length - tag.length) + "\n" - - try { - if (QCloudLogger.mShowLogLocation && level == hilog.LogLevel.ERROR) { - //展示位置 - const stackTrace = new Error().stack - const traceArray = stackTrace!.split('\n') - const trace = traceArray[traceArray.length-2] - log = log + "|" + trace - } - - let type = typeof message - if (type == "object") { - //是对象 - message = QCloudLogger.getObjectToJson(message) - } else if (type == "string") { - //判断是否包含大括号 - const content = message + "" - if (content.startsWith("{") && content.endsWith("}")) { - //对象 - const obj: object = JSON.parse(message.toString()) - message = QCloudLogger.getObjectToJson(obj) - } else { - message = content - } - } - log = log + "\n| " + message - } catch (e) { - - } - log = log + "\n└───────────────────────────────────────────────────────────────────────────────────────" - return log - } - - /* - *对象转Json - * */ - private static getObjectToJson(message: string | object): string { - const json = JSON.stringify(message, null, 2) - const endMessage = json.replace(/\n/g, "\n| ") - return endMessage - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HarmonyHttpClientImpl.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HarmonyHttpClientImpl.ets deleted file mode 100644 index 9517d3c..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HarmonyHttpClientImpl.ets +++ /dev/null @@ -1,17 +0,0 @@ -// /** -// * 鸿蒙自带网络端 实现 -// */ -// import { HarmonyProxy } from './HarmonyProxy'; -// import { NetworkClient } from './NetworkClient'; -// import { NetworkProxy } from './NetworkProxy'; -// -// export class HarmonyHttpClientImpl extends NetworkClient { -// constructor(enableDebugLog?: boolean, readTimeout?: number, connectTimeout?: number, -// dnsOverHttps?: string | undefined, dnsServers?: string[] | undefined) { -// super(enableDebugLog, readTimeout, connectTimeout, dnsOverHttps, dnsServers); -// } -// -// getNetworkProxy(): NetworkProxy { -// return new HarmonyProxy(); -// } -// } \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HarmonyProxy.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HarmonyProxy.ets deleted file mode 100644 index 1116602..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HarmonyProxy.ets +++ /dev/null @@ -1,20 +0,0 @@ -// /** -// * 网络端 鸿蒙执行代理实现 -// */ -// import { HttpRequest } from './HttpRequest'; -// import { NetworkProxy } from './NetworkProxy'; -// import http from '@ohos.net.http'; -// import { HttpResult } from './HttpResult'; -// import { taskpool } from '@kit.ArkTS'; -// import { QCloudEventType } from '../task/base/QCloudTask'; -// import { QCloudTransferData } from '../task/base/QCloudTransferData'; -// import { QCloudRequestData } from '../task/http/QCloudRequestData'; -// import { HttpProgress } from './HttpProgress'; -// import { QCloudLogger } from '../logger/QCloudLogger'; -// -// export class HarmonyProxy extends NetworkProxy { -// executeHttpRequest(qcloudRequestData: QCloudRequestData) { -// let httpRequest = http.createHttp(); -// -// } -// } \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpConstants.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpConstants.ets deleted file mode 100644 index af0c07e..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpConstants.ets +++ /dev/null @@ -1,27 +0,0 @@ -/** - * http常量定义 - */ -export class HttpHeader { - public static readonly USER_AGENT = "User-Agent"; - public static readonly CONTENT_TYPE = "Content-Type"; - public static readonly RESPONSE_CONTENT_TYPE = "content-type"; - public static readonly AUTHORIZATION = "Authorization"; - public static readonly CONTENT_LENGTH = "content-length"; - public static readonly CONTENT_MD5 = "Content-MD5"; - public static readonly RANGE = "Range"; - public static readonly CONTENT_RANGE = "content-range"; - public static readonly HOST = "Host"; - - public static readonly X_COS_REQUEST_ID = "x-cos-request-id"; - public static readonly X_COS_TRACE_ID = "x-cos-trace-id"; - public static readonly ETAG = "etag"; - -} - -export class ContentType { - public static readonly XML = "application/xml"; - public static readonly OCTET_STREAM = "application/octet-stream"; - public static readonly JSON = "application/json"; - public static readonly TEXT_PLAIN = "text/plain"; - public static readonly X_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"; -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpProgress.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpProgress.ets deleted file mode 100644 index feb7ff4..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpProgress.ets +++ /dev/null @@ -1,10 +0,0 @@ -export class HttpProgress{ - public complete:number; - public target:number; - - constructor(complete: number, target: number) { - this.complete = complete; - this.target = target; - } - -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpRequest.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpRequest.ets deleted file mode 100644 index 93ef0d0..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpRequest.ets +++ /dev/null @@ -1,205 +0,0 @@ -import http from '@ohos.net.http'; -import { CryptoUtil } from '../util/CryptoUtil'; -import { HttpHeader } from './HttpConstants'; -import { RequestBodySerializer } from './RequestBodySerializer'; - -import { ResponseBodyConverter } from './ResponseBodyConverter'; -import { rpc } from '@kit.IPCKit'; -import { rcp } from '@kit.RemoteCommunicationKit'; - -/** - * http请求类 - */ -export class HttpRequest { - method: http.RequestMethod; - protocol: string; - host: string; - port: number; - path: string; - headers: Map; - queries: Map; - noSignHeaderKeys: Set; - noSignQueryKeys: Set; - isSignedInURL: boolean = false; - isNeedMD5: boolean = false; - requestBodySerializer: RequestBodySerializer | undefined; - responseBodyConverter: ResponseBodyConverter; - readTimeout: number = 60000; // 单位毫秒(ms) - connectTimeout: number = 60000; // 单位毫秒(ms) - dnsOverHttps?: string; - dnsServers?: string[]; - requestConfiguration?: rcp.Configuration; - - constructor(method: http.RequestMethod, protocol: string, host: string, port: number, path: string, - requestBodySerializer: RequestBodySerializer | undefined, responseBodyConverter: ResponseBodyConverter, - headers?: Map, queries?: Map, isNeedMD5?: boolean, - isSignedInURL?: boolean, requestConfiguration?: rcp.Configuration) { - this.method = method; - this.protocol = protocol; - this.host = host; - this.port = port; - this.path = path; - this.requestBodySerializer = requestBodySerializer; - this.responseBodyConverter = responseBodyConverter; - this.headers = headers || new Map(); - this.queries = queries || new Map(); - this.noSignHeaderKeys = new Set(); - this.noSignQueryKeys = new Set(); - this.isNeedMD5 = isNeedMD5 || false; - this.isSignedInURL = isSignedInURL || false; - this.requestConfiguration = requestConfiguration - } - - addHeader(key: string, value: string): void { - this.headers.set(key, value); - } - - shouldRetry(error: Error) { - return true; - } - - removeHeader(key: string): void { - this.headers.delete(key); - } - - getHeader(key: string): string | undefined { - return this.headers.get(key); - } - - addQuery(key: string, value?: string): void { - this.queries.set(key, value); - } - - removeQuery(key: string): void { - this.queries.delete(key); - } - - getQuery(key: string): string | undefined { - return this.queries.get(key); - } - - addNoSignHeaderKey(key: string): void { - this.noSignHeaderKeys.add(key); - } - - addNoSignQueryKey(key: string): void { - this.noSignQueryKeys.add(key); - } - - setUserAgent(userAgent: string): void { - this.headers.set(HttpHeader.USER_AGENT, userAgent); - } - - async prepareRequestData() { - let buffer = this.requestBodySerializer?.body(); - if (this.isNeedMD5 && buffer && buffer instanceof ArrayBuffer) { - let md5 = await CryptoUtil.qcloudMd5ArrayBuffer(buffer); - this.addHeader(HttpHeader.CONTENT_MD5, md5); - } - - this.addHeader(HttpHeader.HOST, this.host); - - let contentType = this.requestBodySerializer?.contentType() - let contentLength = this.requestBodySerializer?.contentLength() - if (!this.headers.get(HttpHeader.CONTENT_TYPE) && contentType) { - this.addHeader(HttpHeader.CONTENT_TYPE, contentType); - } - - if (contentLength) { - this.addHeader(HttpHeader.CONTENT_LENGTH, contentLength.toString()); - } else { - this.addHeader(HttpHeader.CONTENT_LENGTH, "0"); - } - } - - - /** - * 生成URL - * @returns URL - */ - buildURL(): string { - let url = `${this.protocol}://${this.host}${this.port == -1 ? "" : `:${this.port}`}/${this.path}`; - if (this.queries.size > 0) { - url += '?'; - for (const q of this.queries) { - if (q[1]) { - url += `${q[0]}=${encodeURIComponent(q[1])}&`; - } else { - url += `${q[0]}&`; - } - } - // Remove the trailing '&' - url = url.slice(0, -1); - } - return url; - } - - buildBody(): rcp.RequestContent { - let body = this.requestBodySerializer?.body() - let headers: Record = {}; - this.headers.forEach((value, key) => { - if (key) { - headers[key] = value; - } - }) - if (body instanceof ArrayBuffer && body.byteLength == 0) { - body = undefined; - } - return body as rcp.RawDataContent; - } - - buildHeader(): rcp.RequestHeaders { - let headers: rcp.RequestHeaders = {}; - this.headers.forEach((value, key) => { - if (key) { - headers[key] = value; - } - }) - return headers; - } - - buildRequestConfiguration(): rcp.Configuration { - if (this.requestConfiguration) { - return this.requestConfiguration; - } - - const requestConfig: rcp.Configuration = { - transfer: { - autoRedirect: false, - timeout: { - connectMs: this.connectTimeout, - transferMs: this.readTimeout - }, - } - } - - if (this.dnsServers) { - if (!requestConfig.dns) { - requestConfig.dns = {}; - } - let customDnsServers: rcp.DnsServers = this.dnsServers.map(item => { - let ipItem: rcp.IpAndPort = { ip: item } - return ipItem; - }) - requestConfig.dns.dnsRules = customDnsServers; - } - - - if (this.dnsOverHttps) { - if (!requestConfig.dns) { - requestConfig.dns = {}; - } - let dohConfig: rcp.DnsOverHttpsConfiguration = { - url: this.dnsOverHttps, - skipCertificatesValidation: true - }; - requestConfig.dns.dnsOverHttps = dohConfig; - } - return requestConfig; - } - - reset() { - this.removeHeader(HttpHeader.AUTHORIZATION); - this.responseBodyConverter.reset(this); - } -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpResponse.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpResponse.ets deleted file mode 100644 index 2ff5353..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpResponse.ets +++ /dev/null @@ -1,7 +0,0 @@ -// http响应 -export class HttpResponse{ - public httpCode?:number; - public headers?:Record; - public content?: T; - -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpResult.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpResult.ets deleted file mode 100644 index c917f3b..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/HttpResult.ets +++ /dev/null @@ -1,3 +0,0 @@ -// 腾讯云网络请求结果,包括具体的业务实体 -export class HttpResult { -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/NetworkClient.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/NetworkClient.ets deleted file mode 100644 index e9e46cf..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/NetworkClient.ets +++ /dev/null @@ -1,30 +0,0 @@ -// /** -// * 网络端 抽象类 -// */ -// import { NetworkProxy } from './NetworkProxy'; -// -// export abstract class NetworkClient { -// // 网络client配置:日志开关、dns等, 后续复杂后考虑改为构建模式 -// protected enableDebugLog: boolean = false; -// protected readTimeout: number = 30 * 1000; -// protected connectTimeout: number = 15 * 1000; -// protected dnsOverHttps: string | undefined; -// protected dnsServers: Array | undefined; -// -// constructor(enableDebugLog?: boolean, readTimeout?: number, connectTimeout?: number, dnsOverHttps?: string | undefined, -// dnsServers?: Array | undefined) { -// if(enableDebugLog){ -// this.enableDebugLog = enableDebugLog; -// } -// if(readTimeout){ -// this.readTimeout = readTimeout; -// } -// if(connectTimeout){ -// this.connectTimeout = connectTimeout; -// } -// this.dnsOverHttps = dnsOverHttps; -// this.dnsServers = dnsServers; -// } -// -// abstract getNetworkProxy(): NetworkProxy; -// } \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/NetworkProxy.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/NetworkProxy.ets deleted file mode 100644 index c81105b..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/NetworkProxy.ets +++ /dev/null @@ -1,13 +0,0 @@ -// import { HttpRequest } from './HttpRequest'; -// import { HttpResult } from './HttpResult'; -// import http from '@ohos.net.http'; -// import { QCloudRequestData } from '../task/http/QCloudRequestData'; -// -// /** -// * 网络端 执行代理 -// */ -// export abstract class NetworkProxy { -// abstract executeHttpRequest(qcloudRequestData: QCloudRequestData); -// // abstract convertResponse(httpRequest: HttpRequest, response: http.HttpResponse): HttpResult; -// // abstract cancel(); -// } \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/QCloudHttpClient.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/QCloudHttpClient.ets deleted file mode 100644 index b5f6acf..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/QCloudHttpClient.ets +++ /dev/null @@ -1,37 +0,0 @@ -// /** -// * 网络端 对外 -// */ -// import { QCloudSignatureBuilder } from '../authentation/QCloudSignatureBuilder'; -// import { QCloudHTTPTask } from '../task/http/QCloudHTTPTask'; -// import { QCloudRequestData } from '../task/http/QCloudRequestData'; -// import { HarmonyHttpClientImpl } from './HarmonyHttpClientImpl'; -// import { NetworkClient } from './NetworkClient'; -// import { QCloudHttpRequest } from './QCloudHttpRequest'; -// -// export class QCloudHttpClient { -// private static K_CLIENT_ID = 33333; -// public static readonly HTTP_LOG_TAG = "QCloudHttp"; -// private static clientMap: Map = new Map(); -// -// public static executeHttpRequest(qcloudRequestData: QCloudRequestData){ -// // if(qcloudRequestData.networkClientId){ -// // QCloudHttpClient.clientMap.get(qcloudRequestData.networkClientId)?.getNetworkProxy().executeHttpRequest(qcloudRequestData); -// // } -// let harmonyHttpClientImpl = new HarmonyHttpClientImpl(); -// harmonyHttpClientImpl.getNetworkProxy().executeHttpRequest(qcloudRequestData); -// } -// -// clientId: string; -// harmonyHttpClientImpl: HarmonyHttpClientImpl; -// -// constructor(enableDebugLog?: boolean, readTimeout?: number, connectTimeout?: number, -// dnsOverHttps?: string | undefined, dnsServers?: string[] | undefined) { -// this.harmonyHttpClientImpl = new HarmonyHttpClientImpl(enableDebugLog, readTimeout, connectTimeout, dnsOverHttps, dnsServers); -// this.clientId = (QCloudHttpClient.K_CLIENT_ID ++).toString(); -// QCloudHttpClient.clientMap.set(this.clientId, this.harmonyHttpClientImpl); -// } -// -// // public resolveRequest(request: QCloudHttpRequest, signatureBuilder?:QCloudSignatureBuilder): QCloudHTTPTask { -// // return new QCloudHTTPTask(request, this.clientId, signatureBuilder); -// // } -// } \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/QCloudHttpRequest.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/QCloudHttpRequest.ets deleted file mode 100644 index 4a74fc0..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/QCloudHttpRequest.ets +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 腾讯云网络请求类,封装了签名等操作 - */ -import { HttpRequest } from './HttpRequest'; -import http from '@ohos.net.http'; -import { ResponseBodyConverter } from './ResponseBodyConverter'; -import { RequestBodySerializer } from './RequestBodySerializer'; -import { QCloudCredential } from '../authentation/QCloudCredential'; -import { CredentialCallBack, SelfSignCallBack } from '../authentation/QCloudSignatureBuilder'; -import { rcp } from '@kit.RemoteCommunicationKit'; - -export class QCloudHttpRequest extends HttpRequest { - credential?: QCloudCredential; - credentialCallBack?: CredentialCallBack; - selfSignCallBack?: SelfSignCallBack; - - constructor(method: http.RequestMethod, protocol: string, host: string, port: number, path: string, - requestBodySerializer: RequestBodySerializer | undefined, responseBodyConverter: ResponseBodyConverter, - headers?: Map, queries?: Map, isNeedMD5?: boolean, - isSignedInURL?: boolean, requestConfiguration?: rcp.Configuration) { - super(method, protocol, host, port, path, requestBodySerializer, responseBodyConverter, headers, queries, isNeedMD5, - isSignedInURL, requestConfiguration); - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/RequestBodySerializer.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/RequestBodySerializer.ets deleted file mode 100644 index a3b3653..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/RequestBodySerializer.ets +++ /dev/null @@ -1,42 +0,0 @@ -import { XmlUtils } from '../util/XmlUtils'; -import { ContentType } from './HttpConstants'; - -export abstract class RequestBodySerializer { - public abstract body(): string | ArrayBuffer | undefined; - public abstract contentType(): string; - public abstract contentLength(): number; - public static wrap(contentType: string, body: string | ArrayBuffer | undefined): RequestBodySerializer { - return new BaseRequestBodyWrapper(contentType, body); - } -} - -export class BaseRequestBodyWrapper extends RequestBodySerializer { - bodyw: string | ArrayBuffer | undefined = undefined; - contentTypew: string; - - constructor(contentType: string, body: string | ArrayBuffer | undefined) { - super(); - this.bodyw = body; - this.contentTypew = contentType; - } - - contentType(): string { - return this.contentTypew; - } - - contentLength(): number { - if (this.bodyw instanceof ArrayBuffer) { - return this.bodyw.byteLength; - } - - if (typeof this.bodyw == 'string') { - return this.bodyw.length; - } - - return 0; - } - - body(): string | ArrayBuffer | undefined { - return this.bodyw; - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/RequestFileBodyWrapper.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/RequestFileBodyWrapper.ets deleted file mode 100644 index c38c5db..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/RequestFileBodyWrapper.ets +++ /dev/null @@ -1,43 +0,0 @@ -import fs, { ReadOptions } from '@ohos.file.fs'; -import { ContentType } from './HttpConstants'; - -import { RequestBodySerializer } from './RequestBodySerializer'; - -export class RequestFileBodyWrapper extends RequestBodySerializer { - filePath :string; - offset :number = 0; - length :number = 0; - constructor(file: string, offset: number, length: number) { - super(); - this.filePath = file; - this.offset = offset; - this.length = length; - } - - body(): ArrayBuffer { - let file = fs.openSync(this.filePath,0); - let state = fs.statSync(file.fd); - if (this.length == 0) { - this.length = state.size; - this.offset = 0; - } - - let arrayBuffer = new ArrayBuffer(this.length); - let option: ReadOptions = { - offset: this.offset, - length: this.length - }; - fs.readSync(file.fd,arrayBuffer,option); - fs.closeSync(file); - return arrayBuffer; - } - - contentType(): string { - return ContentType.OCTET_STREAM; - } - - contentLength(): number { - return this.length; - } - -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/ResponseBodyConverter.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/ResponseBodyConverter.ets deleted file mode 100644 index 4bf55e1..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/net/ResponseBodyConverter.ets +++ /dev/null @@ -1,48 +0,0 @@ -import util from '@ohos.util'; -import { HttpRequest } from './HttpRequest'; - -export abstract class ResponseBodyConverter { - abstract headersReceive(header: Record); - abstract convertPart(arrayBuffer: ArrayBuffer); - abstract convertEnd(httpCode: number): T; - - reset(request:HttpRequest){ - - } - - protected concatenateArrayBuffers(...buffers: ArrayBuffer[]): ArrayBuffer { - let totalLength = 0; - for (const buffer of buffers) { - totalLength += buffer.byteLength; - } - - const result = new Uint8Array(totalLength); - let offset = 0; - for (const buffer of buffers) { - result.set(new Uint8Array(buffer), offset); - offset += buffer.byteLength; - } - - return result.buffer; - } - - protected arrayBufferToString(buffer: ArrayBuffer): string { - let textDecoder = util.TextDecoder.create('utf-8') - return textDecoder.decodeWithStream(new Uint8Array(buffer)) - } -} - -// export class ResponseStringConverter extends ResponseBodyConverter { -// headersReceive(header: Record): void { -// } -// buffers: ArrayBuffer[] = []; -// convertPart(arrayBuffer: ArrayBuffer): void { -// this.buffers.push(arrayBuffer); -// } -// -// convertEnd(httpCode: number): string { -// const combinedBuffer = this.concatenateArrayBuffers(...this.buffers); -// const result = this.arrayBufferToString(combinedBuffer); -// return result; -// } -// } \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/retry/RetryHandler.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/retry/RetryHandler.ets deleted file mode 100644 index df0c5c8..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/retry/RetryHandler.ets +++ /dev/null @@ -1,30 +0,0 @@ -export class RetryHandler{ - private currentTryCount:number = 0; - maxCount:number = 0; - sleep:number = 0; - - static defaultHandler(){ - return new RetryHandler(3,1); - } - - constructor(count:number,sleep:number) { - this.maxCount = count; - this.sleep = sleep; - } - - reset(){ - this.currentTryCount = 0; - } - - shouldRetry():boolean{ - if (this.currentTryCount>=this.maxCount){ - return false; - } - this.currentTryCount ++; - return true; - } - - copy():RetryHandler{ - return new RetryHandler(this.maxCount,this.sleep); - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/QCloudTaskManager.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/QCloudTaskManager.ets deleted file mode 100644 index bb300ca..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/QCloudTaskManager.ets +++ /dev/null @@ -1,70 +0,0 @@ -import { CredentialCallBack, QCloudSignatureBuilder } from '../authentation/QCloudSignatureBuilder'; -import { QCloudQueue } from './queue/QCloudQueue' -import { QCloudTask } from './base/QCloudTask'; -import { QCloudHTTPTask } from './http/QCloudHTTPTask'; - -export class QCloudTaskManager{ - - downloadQueue:QCloudQueue = new QCloudQueue('downloadQueue'); - uploadQueue:QCloudQueue = new QCloudQueue('uploadQueue'); - requestQueue:QCloudQueue = new QCloudQueue('requestQueue'); - private static service: QCloudTaskManager; - - public static manager(): QCloudTaskManager { - if (!QCloudTaskManager.service) { - QCloudTaskManager.service = new QCloudTaskManager(); - } - return QCloudTaskManager.service; - } - - setDownloadConcurrentCount(count:number){ - this.downloadQueue.customConcurrentCount = count; - } - - setUploadConcurrentCount(count:number){ - this.uploadQueue.customConcurrentCount = count; - } - - setRequestConcurrentCount(count:number){ - this.requestQueue.customConcurrentCount = count; - } - - public addDownloadTask(task:QCloudHTTPTask){ - this.downloadQueue.addTask(task); - } - - public addUploadTask(task:QCloudHTTPTask){ - this.uploadQueue.addTask(task); - } - - public addRequestTask(task:QCloudHTTPTask){ - this.requestQueue.addTask(task); - } - - public getRunningTask(taskId:number):QCloudTask|null{ - let queues: QCloudQueue[]= [this.downloadQueue,this.uploadQueue,this.requestQueue]; - for (let queue of queues) { - let task:QCloudTask|null = queue.getRunningTask(taskId); - if (task) { - return task; - } - } - return null; - } - - public cancel(taskId:number){ - let queues: QCloudQueue[]= [this.downloadQueue,this.uploadQueue,this.requestQueue]; - for (let queue of queues) { - if (queue.cancelTask(taskId)) { - break; - } - } - } - - public cancelAll(){ - let queues: QCloudQueue[]= [this.downloadQueue,this.uploadQueue,this.requestQueue]; - for (let queue of queues) { - queue.cancelAll(); - } - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/base/QCloudTask.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/base/QCloudTask.ets deleted file mode 100644 index 0b5b0c9..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/base/QCloudTask.ets +++ /dev/null @@ -1,84 +0,0 @@ -import { taskpool } from '@kit.ArkTS'; -import { QCloudLogger } from '../../logger/QCloudLogger'; -import { QCloudQueue } from '../queue/QCloudQueue'; - -import { QCloudTransferData } from './QCloudTransferData'; -import emitter from '@ohos.events.emitter'; -import { QCloudRequestData } from '../http/QCloudRequestData'; -import { RetryHandler } from '../../retry/RetryHandler'; - -export enum QCloudEventType { - netError = 'netError', - taskError = 'taskError', - cancel = 'cancel', - finish = 'finish', - headerReceive = 'headerReceive', - dataProgress = 'dataProgress', - dataReceive = 'dataReceive', // - dataEnd = 'dataEnd' // 结束 -} -export enum QCloudPriority {High = 0, Normal = 1, Low = 2 } -export enum QCloudTaskState {Init = 0,Waiting = 1, Process = 2, Cancel = 3,Finish = 4} - -export class QCloudTask { - - private static K_TASK_ID = 33333; - public static K_CANCEL_EVENT_BASE = 1000000; - mainFunc:Function; - runOnQueue?:QCloudQueue; - priority:QCloudPriority; - state = QCloudTaskState.Init; - taskId:number; - hTask?:taskpool.Task; - retry = RetryHandler.defaultHandler(); - - constructor(mainFunc:Function) { - this.mainFunc = mainFunc; - this.taskId = QCloudTask.K_TASK_ID ++; - this.priority = QCloudPriority.Normal; - this.state = QCloudTaskState.Init; - - let event: emitter.InnerEvent = { - eventId: this.taskId - }; - emitter.on(event, (eventData: emitter.EventData): void => { - let data = eventData.data; - this.runOnQueue?.taskReceiveData(this.taskId,data!["data"] as QCloudTransferData) - }); - } - - getRequestData():object{ - return new QCloudRequestData(); - } - - /*构建请求数据*/ - async buildRequestData(){ - return true; - } - /**/ - async executeTask(){ - await this.buildRequestData(); - } - - shouldRetry(error:Error):boolean{ - if (!this.retry.shouldRetry()) { - return false; - } - return true; - } - - cancel(){ - // 任务未开始,只需在manager等待队列中删除即可。 - if (this.state != QCloudTaskState.Process) { - return; - } - } - - reset(){ - this.state = QCloudTaskState.Waiting; - } - - public onTaskReceiveData(data:QCloudTransferData){ - QCloudLogger.info(`QCloudCOSFoundation:task_onTaskReceiveData:${this.taskId}_${data}`); - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/base/QCloudTransferData.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/base/QCloudTransferData.ets deleted file mode 100644 index 14a7ff7..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/base/QCloudTransferData.ets +++ /dev/null @@ -1,13 +0,0 @@ -import { QCloudEventType } from './QCloudTask'; - -export class QCloudTransferData { - eventType?:QCloudEventType; - error: Error|null; - result:object|number|null; - constructor(eventType:QCloudEventType,result:object|number|null,error:Error|null) { - this.eventType = eventType; - this.error = error; - this.result = result; - } -} - diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/http/QCloudHTTPTask.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/http/QCloudHTTPTask.ets deleted file mode 100644 index c28c7a8..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/http/QCloudHTTPTask.ets +++ /dev/null @@ -1,200 +0,0 @@ -import { QCloudEventType, QCloudTask } from '../base/QCloudTask'; -import { QCloudTransferData } from '../base/QCloudTransferData'; -import { QCloudRequestData } from './QCloudRequestData'; -import { HttpRequest } from '../../net/HttpRequest'; -import { QCloudSignatureBuilder } from '../../authentation/QCloudSignatureBuilder'; -import emitter from '@ohos.events.emitter'; -import { Callback } from '@ohos.base'; -import { HttpProgress } from '../../net/HttpProgress'; -import { HttpResponse } from '../../net/HttpResponse'; -import { TaskHTTPExecuteFunc } from './TaskHTTPExecuteFunc'; -import { QCloudUserCancelError } from '../../error/QCloudUserCancelError'; -import { QCloudNetError } from '../../error/QCloudNetError'; -import { QCloudTaskError } from '../../error/QCloudTaskError'; -import { QCloudHttpRequest } from '../../net/QCloudHttpRequest'; -import { QCloudAuthenticationError } from '../../error/QCloudAuthenticationError'; -import { QCloudLogger } from '../../logger/QCloudLogger'; -import { HttpHeader } from '../../net/HttpConstants'; - -export class QCloudHTTPTask extends QCloudTask { - private readonly TAG = "HTTP"; - httpRequest:QCloudHttpRequest; - - requestData:QCloudRequestData; - private httpResponse: HttpResponse|undefined; - - onHeaderReceive: Callback> | undefined; - onProgress: Callback | undefined; - onSuccess: Callback> | undefined; - onFailure: Callback | undefined; - - constructor(httpRequest:QCloudHttpRequest) { - super(TaskHTTPExecuteFunc); - this.httpRequest = httpRequest; - this.requestData = new QCloudRequestData(); - } - - async buildRequestData():Promise{ - await this.httpRequest.prepareRequestData(); - let url = this.httpRequest?.buildURL(); - - // 请求如果已经签名则不再本地或者服务端签名 - if(!this.httpRequest.headers.has(HttpHeader.AUTHORIZATION) || this.httpRequest.headers.get(HttpHeader.AUTHORIZATION)!.length == 0){ - // 客户端签名 - let signature = await QCloudSignatureBuilder.signatureBuild(this.httpRequest); - if (signature){ - if (!this.httpRequest.isSignedInURL) { - this.httpRequest.addHeader(HttpHeader.AUTHORIZATION,signature.authorization!); - }else{ - if (url.includes("?")) { - url += `&${signature.authorization}`; - }else{ - url += `?${signature.authorization}`; - } - if (signature.token && signature.token.length > 0) { - url += `&${signature.tokenName}=${signature.token}`; - } - } - } - - // 服务端签名 - if(this.httpRequest.selfSignCallBack){ - this.httpRequest.selfSignCallBack(this.httpRequest); - } - } - - this.requestData.url = url; - this.requestData.headers = this.httpRequest.buildHeader(); - this.requestData.content = this.httpRequest.buildBody(); - this.requestData.method = this.httpRequest.method; - this.requestData.requestConfiguration = this.httpRequest.buildRequestConfiguration(); - this.requestData.taskId = this.taskId; - return true; - } - - public onTaskReceiveData(data: QCloudTransferData): void { - if (data.eventType == QCloudEventType.netError) { - if(data.error){ - QCloudLogger.info(new QCloudNetError(data.error), this.TAG+"_err"); - } - if (this.onFailure) { - this.onFailure(new QCloudNetError(data.error) as Error); - return; - } - } - - if (data.eventType == QCloudEventType.taskError) { - if (this.onFailure) { - if(data.error instanceof QCloudAuthenticationError){ - // task执行过程中可能会抛QCloudAuthenticationError,需要单独抛出 - this.onFailure(data.error as Error); - } else { - this.onFailure(new QCloudTaskError(data.error) as Error); - } - return; - } - } - - if (data.eventType == QCloudEventType.cancel) { - if (this.onFailure) { - this.onFailure(new QCloudUserCancelError() as Error); - return; - } - } - - if (data.eventType == QCloudEventType.finish) { - try { - QCloudLogger.info((data.result as number).toString(), this.TAG+"_httpCode"); - let t = this.httpRequest.responseBodyConverter.convertEnd(data.result as number); - if (this.onSuccess) { - if(this.httpResponse){ - this.httpResponse.httpCode = data.result as number; - this.httpResponse.content = t; - } - } - } catch (err) { - if (this.onFailure) { - this.onFailure(err); - return; - } - } - if (this.onSuccess && this.httpResponse) { - this.onSuccess(this.httpResponse); - return; - } - } - - if (data.eventType == QCloudEventType.headerReceive) { - if(data.result){ - QCloudLogger.info(data.result as Record, this.TAG+"_headersReceive"); - } - try { - this.httpResponse = new HttpResponse() - if(this.httpResponse){ - this.httpResponse.headers = data.result as Record; - } - this.httpRequest.responseBodyConverter.headersReceive(data.result as Record) - } catch (err) { - if (this.onFailure) { - this.onFailure(err); - return; - } - } - if (this.onHeaderReceive) { - this.onHeaderReceive(data.result as Record); - } - } - - if (data.eventType == QCloudEventType.dataReceive) { - try { - this.httpRequest.responseBodyConverter.convertPart(data.result as ArrayBuffer) - } catch (err) { - if (this.onFailure) { - this.onFailure(err); - return; - } - } - } - - if (data.eventType == QCloudEventType.dataEnd) { - QCloudLogger.info("dataEnd !", this.TAG+"_dataEnd"); - } - - if (data.eventType == QCloudEventType.dataProgress) { - if (this.onProgress) { - let httpProgress: HttpProgress = data.result as HttpProgress; - this.onProgress(httpProgress); - } - } - } - - public getRequestData():QCloudRequestData { - if(this.requestData) { - QCloudLogger.info(this.requestData.url!, this.TAG + "_url"); - QCloudLogger.info(this.requestData.requestConfiguration!, this.TAG + "_request"); - } - return this.requestData; - } - - public cancel(){ - super.cancel(); - let event: emitter.InnerEvent = { - eventId: this.taskId + QCloudTask.K_CANCEL_EVENT_BASE, - priority: emitter.EventPriority.HIGH - }; - emitter.emit(event); - } - - - shouldRetry(error:Error):boolean{ - if (!super.shouldRetry(error)) { - return false; - } - return this.httpRequest.shouldRetry(error); - } - - public reset(): void { - super.reset(); - this.httpRequest.reset(); - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/http/QCloudRequestData.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/http/QCloudRequestData.ets deleted file mode 100644 index 19ca79e..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/http/QCloudRequestData.ets +++ /dev/null @@ -1,12 +0,0 @@ -import { rcp } from '@kit.RemoteCommunicationKit'; - -export class QCloudRequestData extends Object{ - public taskId:number = 0; - public url?:rcp.URLOrString; - public method?: rcp.HttpMethod - public headers?: rcp.RequestHeaders - public content?: rcp.RequestContent - public cookies?: rcp.RequestCookies - public transferRange?: rcp.TransferRange | rcp.TransferRange[] - public requestConfiguration?: rcp.Configuration -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/http/TaskHTTPExecuteFunc.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/http/TaskHTTPExecuteFunc.ets deleted file mode 100644 index 37ad657..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/http/TaskHTTPExecuteFunc.ets +++ /dev/null @@ -1,125 +0,0 @@ -import { QCloudEventType, QCloudTask } from '../base/QCloudTask'; -import { QCloudTransferData } from '../base/QCloudTransferData'; -import emitter from '@ohos.events.emitter'; -import http from '@ohos.net.http'; -import { QCloudRequestData } from './QCloudRequestData'; -import { HttpProgress } from '../../net/HttpProgress'; -import { QCloudLogger } from '../../logger/QCloudLogger'; -import { HashMap } from '@kit.ArkTS'; -import { rcp } from '@kit.RemoteCommunicationKit'; -import { BusinessError } from '@kit.BasicServicesKit'; - -enum SendEventOrder {} - -@Concurrent -export function TaskHTTPExecuteFunc(qcloudRequestData: QCloudRequestData) { - - let resultMap = new HashMap(); - let sendSet = new Set(); - - let event: emitter.InnerEvent = { - eventId: qcloudRequestData.taskId, - priority: emitter.EventPriority.HIGH - }; - - let cancelEvent: emitter.InnerEvent = { - eventId: qcloudRequestData.taskId + 1000000 - }; - emitter.once(cancelEvent, (eventData: emitter.EventData): void => { - session.cancel() - SendEvent(new QCloudTransferData(QCloudEventType.cancel, null, null)) - dealloc(); - }); - - let SendEvent = (data: QCloudTransferData) => { - let eventData: emitter.EventData = { - data: { - "taskId": qcloudRequestData.taskId, - "data": data, - } - }; - emitter.emit(event, eventData); - } - - let SendOrderEvent = (data: QCloudTransferData, order: number, totalCount: number) => { - resultMap.set(order, data); - for (let index = 0; index <= totalCount; index++) { - if (sendSet.has(index)) { - continue; - } - - let sendData = resultMap.get(index); - if (!sendData) { - break; - } - let eventData: emitter.EventData = { - data: { - "taskId": qcloudRequestData.taskId, - "data": sendData, - } - }; - emitter.emit(event, eventData); - sendSet.add(index); - } - } - - const customHttpEventsHandler: rcp.HttpEventsHandler = { - onDataReceive: (incomingData: ArrayBuffer) => { - SendEvent(new QCloudTransferData(QCloudEventType.dataReceive, incomingData, null)); - }, - onUploadProgress: (totalSize: number, transferredSize: number) => { - if (qcloudRequestData.method == http.RequestMethod.PUT) { - SendEvent(new QCloudTransferData(QCloudEventType.dataProgress, new HttpProgress(transferredSize, totalSize), - null)); - } - }, - onDownloadProgress: (totalSize: number, transferredSize: number) => { - if (qcloudRequestData.method == http.RequestMethod.GET) { - SendEvent(new QCloudTransferData(QCloudEventType.dataProgress, new HttpProgress(transferredSize, totalSize), - null)); - } - }, - onHeaderReceive: (headers: rcp.ResponseHeaders) => { - SendOrderEvent(new QCloudTransferData(QCloudEventType.headerReceive, headers, null), 0, 3); - }, - onDataEnd: () => { - SendOrderEvent(new QCloudTransferData(QCloudEventType.dataEnd, null, null), 1, 3); - }, - onCanceled: () => { - }, - }; - - let requestConfig = qcloudRequestData.requestConfiguration; - if (requestConfig?.tracing) { - requestConfig.tracing.httpEventsHandler = customHttpEventsHandler - } else { - const tracingConfig: rcp.TracingConfiguration = { - httpEventsHandler: customHttpEventsHandler - }; - requestConfig!.tracing = tracingConfig; - } - - const session = rcp.createSession({ - requestConfiguration: requestConfig - }); - - let req = new rcp.Request(qcloudRequestData.url!, qcloudRequestData.method); - req.headers = qcloudRequestData.headers; - if (qcloudRequestData?.content) { - req.content = qcloudRequestData.content - } - - session.fetch(req).then((response) => { - SendOrderEvent(new QCloudTransferData(QCloudEventType.finish, response.statusCode, null), 2, 3); - dealloc(); - }).catch((err: BusinessError) => { - SendEvent(new QCloudTransferData(QCloudEventType.netError, null, err)); - dealloc(); - }); - - let dealloc = () => { - resultMap.clear(); - sendSet.clear(); - session.close(); - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/queue/QCloudQueue.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/queue/QCloudQueue.ets deleted file mode 100644 index df268f0..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/task/queue/QCloudQueue.ets +++ /dev/null @@ -1,193 +0,0 @@ -import { LinkedList, taskpool } from '@kit.ArkTS' -import { QCloudLogger } from '../../logger/QCloudLogger'; -import { QCloudEventType, QCloudPriority, QCloudTask, QCloudTaskState } from '../base/QCloudTask' -import { QCloudTransferData } from '../base/QCloudTransferData'; -import { TaskHTTPExecuteFunc } from '../http/TaskHTTPExecuteFunc'; -import { QCloudTaskManager } from '../QCloudTaskManager'; - - -export class QCloudQueue { - - queueTag:string = 'queue'; - public maxConcurrentCount = 8; - public customConcurrentCount = 4; - - private runingTaskQueue:LinkedList; - - private heighWaitTaskQueue:LinkedList; - private normalWaitTaskQueue:LinkedList; - private lowWaitTaskQueue:LinkedList; - - constructor(tag?:string) { - if (tag) { - this.queueTag = tag; - } - this.runingTaskQueue = new LinkedList(); - this.heighWaitTaskQueue = new LinkedList(); - this.normalWaitTaskQueue = new LinkedList(); - this.lowWaitTaskQueue = new LinkedList(); - } - - private _logState(){ - QCloudLogger.log(`${this.queueTag}_state:runningCount:${this.runingTaskQueue.length},heighWaitCount:${this.heighWaitTaskQueue.length},normalWaitCount:${this.normalWaitTaskQueue.length},lowWaitCount:${this.lowWaitTaskQueue.length},customConcurrentCount:${this.customConcurrentCount}`,'cos_sdk_task_manager_log'); - } - - public addTask(task:QCloudTask){ - task.state = QCloudTaskState.Waiting; - if (task.priority == QCloudPriority.High) { - this.heighWaitTaskQueue?.add(task); - } - if (task.priority == QCloudPriority.Normal) { - this.normalWaitTaskQueue?.add(task); - } - if (task.priority == QCloudPriority.Low) { - this.lowWaitTaskQueue?.add(task); - } - QCloudLogger.log(`addTask:${task.taskId}`,'cos_sdk_task_manager_log'); - this._logState(); - this.startTask(); - task.runOnQueue = this; - } - - public cancelTask(taskId:number):boolean{ - let RemoveTask = (list: LinkedList): boolean => { - for (let i = 0; i < list.length; i++) { - let task = list.get(i); - if (task.taskId == taskId) { - task.state = QCloudTaskState.Cancel; - list.remove(task); - return true; - } - } - return false; - } - let result :boolean = RemoveTask(this.heighWaitTaskQueue); - if (!result) { - result = RemoveTask(this.normalWaitTaskQueue); - } - if (!result) { - result = RemoveTask(this.lowWaitTaskQueue); - } - if (!result) { - this.cancelRunningTask(taskId); - } - if (result) { - QCloudLogger.log(`cancelTask:${taskId}`,'cos_sdk_task_manager_log'); - } - this._logState(); - this.startTask(); - return result; - } - - private cancelRunningTask(taskId:number){ - for (let i = 0; i < this.runingTaskQueue.length; i++) { - let task = this.runingTaskQueue.get(i); - if (task.taskId == taskId) { - task.cancel(); - return; - } - } - } - - public cancelAll(){ - this.heighWaitTaskQueue.forEach((value)=>{value.state = QCloudTaskState.Cancel}) - this.normalWaitTaskQueue.forEach((value)=>{value.state = QCloudTaskState.Cancel}) - this.lowWaitTaskQueue.forEach((value)=>{value.state = QCloudTaskState.Cancel}) - - this.heighWaitTaskQueue.clear(); - this.normalWaitTaskQueue.clear(); - this.lowWaitTaskQueue.clear(); - - for (const task of this.runingTaskQueue) { - task.cancel(); - } - QCloudLogger.log(`cancelAll`,'cos_sdk_task_manager_log'); - this._logState(); - } - - private async startTask(){ - if (this.heighWaitTaskQueue.length == 0 && this.lowWaitTaskQueue.length == 0 && this.normalWaitTaskQueue.length == 0){ - return; - } - if (this.customConcurrentCount > 0 && this.runingTaskQueue.length >= this.customConcurrentCount) { - return; - } - let RuningTask = async (queue: LinkedList): Promise => { - let task = queue.getFirst(); - this.runingTaskQueue.add(task); - queue.remove(task); - try { - await task.executeTask(); - } catch (e) { - // 执行任务之前,构建异常,直接结束 - task.state = QCloudTaskState.Finish; - task.onTaskReceiveData(new QCloudTransferData(QCloudEventType.taskError,null,e)) - this.runingTaskQueue.remove(task); - return; - } - try { - let hTask = new taskpool.Task(TaskHTTPExecuteFunc,task.getRequestData()); - // task.hTask = hTask; - taskpool.execute(hTask); - QCloudLogger.log(`startTask:${task.taskId}`,'cos_sdk_task_manager_log'); - this._logState(); - task.state = QCloudTaskState.Process; - } catch (e) { - this.taskReceiveData(task.taskId,new QCloudTransferData(QCloudEventType.taskError,null,e)); - } - } - - if (this.heighWaitTaskQueue.length>0) { - RuningTask(this.heighWaitTaskQueue); - }else if (this.normalWaitTaskQueue.length>0) { - RuningTask(this.normalWaitTaskQueue); - }else if (this.lowWaitTaskQueue.length>0) { - RuningTask(this.lowWaitTaskQueue); - } - } - - public taskReceiveData(taskId:number,data:QCloudTransferData){ - let task = this.getRunningTask(taskId); - if (!task) { - return; - } - - if ((data.error && task.shouldRetry(data.error)) || - ((data.eventType === QCloudEventType.netError || (data.eventType === QCloudEventType.finish && (data.result as number) >= 500)) && task.retry.shouldRetry())){ - setTimeout(()=>{ - if (task) { - this.runingTaskQueue.remove(task); - task.reset(); - this.heighWaitTaskQueue.add(task); - QCloudLogger.log(`retryTask:${task.taskId}`,'cos_sdk_task_manager_log'); - this._logState(); - this.startTask() - } - },task.retry.sleep); - }else{ - if (data.eventType == QCloudEventType.finish || data.eventType == QCloudEventType.taskError || data.eventType == QCloudEventType.cancel) { - if (data.eventType == QCloudEventType.cancel) { - task.state = QCloudTaskState.Cancel; - } - if (data.eventType == QCloudEventType.finish || data.eventType == QCloudEventType.taskError) { - task.state = QCloudTaskState.Finish; - } - QCloudLogger.log(`removeTask:${task.taskId}`,'cos_sdk_task_manager_log'); - task.onTaskReceiveData(data); - this.runingTaskQueue.remove(task); - this.startTask(); - }else{ - task.onTaskReceiveData(data); - } - } - } - - public getRunningTask(taskId:number) : QCloudTask|null{ - for (const task of this.runingTaskQueue) { - if (taskId == task.taskId) { - return task; - } - } - return null; - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/CryptoUtil.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/CryptoUtil.ets deleted file mode 100644 index 514b8e0..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/CryptoUtil.ets +++ /dev/null @@ -1,70 +0,0 @@ -import cryptoFramework from '@ohos.security.cryptoFramework'; -import buffer from '@ohos.buffer'; -import { StringUtils } from './StringUtils'; - -export class CryptoUtil{ - - static async qlcoudSha1(str:string):Promise{ - return CryptoUtil.qlcoudSha1Uint8Array(new Uint8Array(buffer.from(str, 'utf-8').buffer)) - } - - static async qlcoudSha1Uint8Array(array:Uint8Array):Promise{ - let mdAlgName = "SHA1"; // 摘要算法名 - let md = cryptoFramework.createMd(mdAlgName); - // 假设信息总共43字节,根据utf-8解码后,也是43字节 - let messageData = array; - let updateLength = 20; // 假设以20字节为单位进行分段update,实际并无要求 - for (let i = 0; i < messageData.length; i += updateLength) { - let updateMessage = messageData.subarray(i, i + updateLength); - let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage }; - await md.update(updateMessageBlob); - } - let mdOutput = await md.digest(); - return StringUtils.uint8Array2String(mdOutput.data); - } - - static async qcloudHmacSha1(str:string,secret:string):Promise { - return CryptoUtil.qcloudHmacSha1Uint8Array(new Uint8Array(buffer.from(str, 'utf-8').buffer),secret); - } - - static async qcloudHmacSha1Uint8Array(array:Uint8Array,secret:string):Promise { - let keyData = new Uint8Array(buffer.from(secret, 'utf-8').buffer); - let symKeyBlob: cryptoFramework.DataBlob = { data: keyData }; - let aesGenerator = cryptoFramework.createSymKeyGenerator('HMAC'); - let key = await aesGenerator.convertKey(symKeyBlob); - let macAlgName = "SHA1"; // 摘要算法名 - let mac = cryptoFramework.createMac(macAlgName); - let messageData = array; - let updateLength = 1024 * 1024; // 假设以20字节为单位进行分段update,实际并无要求 - await mac.init(key); - for (let i = 0; i < messageData.length; i += updateLength) { - let updateMessage = messageData.subarray(i, i + updateLength); - let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage }; - await mac.update(updateMessageBlob); - } - let macOutput = await mac.doFinal(); - return StringUtils.uint8Array2String(macOutput.data); - } - - static async qcloudMd5Str(str:string):Promise { - return CryptoUtil.qcloudMd5ArrayBuffer(buffer.from(str, 'utf-8').buffer); - } - - static async qcloudMd5ArrayBuffer(array:ArrayBuffer):Promise { - let mdAlgName = "MD5"; // 摘要算法名 - let md = cryptoFramework.createMd(mdAlgName); - let _buffer = new Uint8Array(array); - // 假设信息总共43字节,根据utf-8解码后,也是43字节 - let messageData = _buffer; - let updateLength = 1024 * 1024; // 假设以20字节为单位进行分段update,实际并无要求 - for (let i = 0; i < messageData.length; i += updateLength) { - let updateMessage = messageData.subarray(i, i + updateLength); - let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage }; - await md.update(updateMessageBlob); - } - let mdOutput = await md.digest(); - let buffer1 = buffer.from(mdOutput.data); - return buffer1.toString("base64"); - } - -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/HttpUtils.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/HttpUtils.ets deleted file mode 100644 index 820b8fd..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/HttpUtils.ets +++ /dev/null @@ -1,19 +0,0 @@ -export class HttpUtils{ - public static parseContentRange(contentRange: string|undefined): number[] | undefined { - if (!contentRange) { - return undefined; - } - const lastBlankIndex = contentRange.lastIndexOf(" "); - const acrossIndex = contentRange.indexOf("-"); - const slashIndex = contentRange.indexOf("/"); - if (lastBlankIndex === -1 || acrossIndex === -1 || slashIndex === -1) { - return undefined; - } - - const start = Number(contentRange.substring(lastBlankIndex + 1, acrossIndex)); - const end = Number(contentRange.substring(acrossIndex + 1, slashIndex)); - const max = Number(contentRange.substring(slashIndex + 1)); - - return [start, end, max]; - } -} \ No newline at end of file diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/StringUtils.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/StringUtils.ets deleted file mode 100644 index 9b3899f..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/StringUtils.ets +++ /dev/null @@ -1,51 +0,0 @@ -import util from '@ohos.util'; - -export class StringUtils { - - /** - * Uint8Array 转 String - * @param input - */ - static uint8Array2String(input: Uint8Array):string { - if (!input) { - return ""; - } - let result = ''; - for (const item of input) { - result += `${item.toString(16).padStart(2, '0')}`; - } - return result; - } - /** - * ArrayBuffer 转 String - * @param input - * @returns - */ - static arrayBuffer2String(input: ArrayBuffer) :string{ - let textDecoder = util.TextDecoder.create('utf-8') - return textDecoder.decodeWithStream(new Uint8Array(input)) - } - - static parseInt(obj:string|number|undefined):number{ - if (typeof obj === 'string') { - return parseInt(obj); - } - if (typeof obj === 'number') { - return obj; - } - return 0; - } - - static parseBool(obj:string|number|boolean|undefined):boolean{ - if (typeof obj == 'string') { - return obj.toLowerCase() == 'true'; - } - if (typeof obj === 'number') { - return obj > 0; - } - if (typeof obj === 'boolean') { - return obj; - } - return obj !== undefined && obj !== null; - } -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/XmlUtils.ets b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/XmlUtils.ets deleted file mode 100644 index 9c374e3..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/ets/util/XmlUtils.ets +++ /dev/null @@ -1,161 +0,0 @@ -import convertxml from '@ohos.convertxml'; -import xml from '@ohos.xml'; -import util from '@ohos.util'; -import { List } from '@kit.ArkTS'; -import { QCloudLogger } from '../logger/QCloudLogger'; - -export class XmlUtils { - - static lowerCamel(name:string){ - let tempName = name; - if (tempName.length > 0) { - let first = tempName.substring(0, 1); - tempName = first.toLowerCase() + tempName.substring(1); - } - return tempName; - } - - static upperCamel(name:string){ - let tempName = name; - if (tempName.length > 0) { - let first = tempName.substring(0, 1); - tempName = first.toUpperCase() + tempName.substring(1); - } - return tempName; - } - - static obj2xml(obj:object,upperlCamel?:boolean):string|null{ - if (Array.isArray(obj)) { - QCloudLogger.warn("Array type does not support conversion to xml"); - return null - } - - try { - let arrayBuffer: ArrayBuffer = new ArrayBuffer(JSON.stringify(obj).length * 2); // 创建一个2048字节的缓冲区 - let thatSer: xml.XmlSerializer = new xml.XmlSerializer(arrayBuffer); // 基于Arraybuffer构造XmlSerializer对象 - - thatSer = XmlUtils.createXmlElement('',obj,thatSer,upperlCamel||true); - - let view: Uint8Array = new Uint8Array(arrayBuffer); // 使用Uint8Array读取arrayBuffer的数据 - let textDecoder: util.TextDecoder = util.TextDecoder.create(); // 调用util模块的TextDecoder类 - let res: string = textDecoder.decodeWithStream(view).trim(); // 对view解码 - return res - } catch (e) { - return null - } - } - - private static createXmlElement(key:string,obj: object,thatSer:xml.XmlSerializer,upperlCamel:boolean): xml.XmlSerializer{ - - if (typeof obj == 'string') { - thatSer.setText(obj); - }else if (typeof obj == 'number') { - let num:number = obj; - thatSer.setText(num.toString()); - }else if (typeof obj == 'boolean') { - let num:boolean = obj; - thatSer.setText(num?'true':'false'); - }else if (obj instanceof List) { - let array:List = obj; - for (const item of array) { - key = upperlCamel?XmlUtils.upperCamel(key):key; - thatSer.startElement(key); - thatSer = XmlUtils.createXmlElement(key,item,thatSer,upperlCamel); - thatSer.endElement(); - } - }else{ - for (const _itemKey of Object.keys(obj)) { - let _key = upperlCamel?XmlUtils.upperCamel(_itemKey):_itemKey; - let value:object = obj[_itemKey]; - if (value) { - if (value instanceof List ||value instanceof Array ){ - thatSer = XmlUtils.createXmlElement(_key,value,thatSer,upperlCamel); - }else{ - thatSer.startElement(_key); - thatSer = XmlUtils.createXmlElement(_key,value,thatSer,upperlCamel); - thatSer.endElement(); - } - }else{ - thatSer.startElement(_key); - thatSer.endElement(); - } - } - } - - return thatSer; - } - - static xml2obj(xml: string,lCamel?:boolean): object|null { - try { - let conv = new convertxml.ConvertXML() - let result: object = conv.convertToJSObject(xml); - let model = XmlUtils.getElementValue(result['_elements'][0],null,true,lCamel||true); - return model; - } catch (e) { - return null; - } - } - - private static getElementValue(element: object,pObj:object|null,root:boolean,lCamel:boolean): object|null { - let name:string = element['_name']; - if (name) { - name = lCamel?XmlUtils.lowerCamel(name):name; - } - let type: string = element['_type']; - if (type == 'text') { - return element['_text']; - } - - if (!Object.keys(element).includes('_elements')) { - return null; - } - - let elements:List = element['_elements']; - let obj = pObj; - if (!obj) { - obj = new Object(); - } - - if (type == 'element') { - for (const _element of elements) { - let _name: string = _element['_name']; - if (!_name) { - let value= XmlUtils.getElementValue(_element,obj,false,lCamel); - if (!root) { - return value; - } - obj[name] = value; - return obj; - }else{ - _name = lCamel?XmlUtils.lowerCamel(_name):_name; - let value= XmlUtils.getElementValue(_element,null,false,lCamel); - if (value) { - if (obj[_name]) { - if (Array.isArray(obj[_name]) || obj[_name] instanceof List) { - let array:List = obj[_name]; - array.add(value); - obj[_name] = array; - }else{ - let array = new List(); - array.add(obj[_name]); - array.add(value); - obj[_name] = array; - } - }else{ - obj[_name] = value; - } - }else{ - obj[_name] = null; - } - } - } - } - - if (root) { - let rObj:object = new Object(); - rObj[name] = obj; - return rObj; - } - return obj; - } -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/module.json b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/module.json deleted file mode 100644 index afb4f2a..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "app": { - "bundleName": "com.tencent.cloud.cos", - "versionCode": 1010100, - "versionName": "1.1.0", - "minAPIVersion": 50000012, - "targetAPIVersion": 50000012, - "apiReleaseType": "Release", - "compileSdkVersion": "5.0.0.71", - "compileSdkType": "HarmonyOS", - "appEnvironments": [], - "bundleType": "app" - }, - "module": { - "name": "foundation", - "type": "har", - "deviceTypes": [ - "default", - "tablet", - "2in1" - ], - "requestPermissions": [ - { - "name": "ohos.permission.INTERNET", - "usedScene": { - "when": "always" - } - } - ], - "packageName": "@tencentcloud/foundation", - "installationFree": false, - "virtualMachine": "ark12.0.2.0", - "compileMode": "esmodule", - "dependencies": [] - } -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/resources/base/element/string.json b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/resources/base/element/string.json deleted file mode 100644 index f51a9c8..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "page_show", - "value": "page from package" - } - ] -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/resources/en_US/element/string.json b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/resources/en_US/element/string.json deleted file mode 100644 index f51a9c8..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/resources/en_US/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "page_show", - "value": "page from package" - } - ] -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/resources/zh_CN/element/string.json b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/resources/zh_CN/element/string.json deleted file mode 100644 index f51a9c8..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/main/resources/zh_CN/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "page_show", - "value": "page from package" - } - ] -} diff --git a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/mock/mock-config.json5 b/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/mock/mock-config.json5 deleted file mode 100644 index 7a73a41..0000000 --- a/oh_modules/.ohpm/@tencentcloud+foundation@+z60my2zrzacmmd+ymgftrlhsfups7v9tic7zpvyc6i=/oh_modules/@tencentcloud/foundation/src/mock/mock-config.json5 +++ /dev/null @@ -1,2 +0,0 @@ -{ -} \ No newline at end of file diff --git a/oh_modules/.ohpm/oh_modules/@tencentcloud/cos b/oh_modules/.ohpm/oh_modules/@tencentcloud/cos index 87772fa..872f4f3 120000 --- a/oh_modules/.ohpm/oh_modules/@tencentcloud/cos +++ b/oh_modules/.ohpm/oh_modules/@tencentcloud/cos @@ -1 +1 @@ -../../@tencentcloud+cos@1.0.0/oh_modules/@tencentcloud/cos \ No newline at end of file +../../@tencentcloud+cos@1.1.1/oh_modules/@tencentcloud/cos \ No newline at end of file