* Copyright (c) 2025 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* @file
* @kit AbilityKit
*/
* @since 20
*/
export namespace TestModuleA {
* @since 20
*
*/
export interface TestResult<T> {
success: boolean;
data: T;
timestamp: Date;
metadata: Record<string, any>;
}
* @since 20
*
*/
export enum OperationStatus {
* @since 20
*
*/
PENDING = "pending",
* @since 20
*
*/
RUNNING = "running",
* @since 20
*
*/
FAILED = "failed",
* @since 20
*
*/
CANCELLED = "cancelled"
}
* @since 20
*
*/
export type ValidationRule = {
field: string;
required: boolean;
minLength?: number;
maxLength?: number;
pattern?: RegExp;
customValidator?: (value: any) => boolean;
};
* @since 20
*
*/
export class DataProcessor {
* @since 20
*
*/
private data: any[] = [];
* @since 20
*
*/
constructor(initialData: any[] = []) {
this.data = initialData;
}
* @since 20
*
*/
public getStatus(): OperationStatus {
return this.data.length > 0 ? OperationStatus.COMPLETED : OperationStatus.PENDING;
}
}
}