declare namespace datasources {
  interface IComponentAction {
    [actionName: string]: {
      stamp: number;
      value: any;
    };
  }

  type TStateAction = 'add' | 'remove';

  class Utils {
    static formatValue(value: number | string | Date, format: string): string;
    static formatString(value: string, format: string): string;
    static formatDuration(value: number): string;
    static convertAs(dataType: string, value: string);
    static stringToNumber(value: string): string;
    static entityKeyToJSON(key: string): string;
    static initFramework(): Promise<void>;
    static padNumber(num: string | number): string;
  }
  class Method4D {
    acceptedEvents: {
      [event: string]: boolean;
    };
    constructor(
      methodName: string,
      resultSource: datasources.DataSource,
      paramSources: datasources.DataSource[],
      owenerSource: datasources.DataSource | null,
    );
    static buildMethod(
      component: {
        methodName: string;
        resultingDataSource: Partial<{
          id: string;
          namespace: string;
        }>;
        parameters: {
          name: string;
          namespace?: string;
          isHardCoded?: boolean;
          type?: 'date' | 'string' | 'object' | 'array' | 'number' | 'bool';
        }[];
      },
      associatedData: { namespace: string },
      ownerSource: DataSource | null,
      singleton?: string | null,
    ): Method4D;
    static buildAction(component: { action: string }): string;
    static buildEvents(component: { eventType: string }): {
      [evName: string]: boolean;
    };
    static validEvent(event: string): boolean;
    static replaceDataSources(
      component: { parameters: any },
      elemSource,
      newid: string,
    );
    callServerSide(
      widget: {
        id?: string;
        serverSideRef?: string;
      },
      callerType: string,
      additionalData?: any,
      addOwnerSourceAsParam?: boolean,
      callFuncUrl?: string,
      isAGet: true,
    ): Promise<string>;
    callServerSide(
      widget: {
        id?: string;
        serverSideRef?: string;
      },
      callerType: string,
      additionalData?: any,
      addOwnerSourceAsParam?: boolean,
      callFuncUrl?: string,
      isAGet?: false,
    ): Promise<{
      [refName: string]: IComponentAction;
      __NOTIFICATION?: { message: string; type: string };
      __STATES?: { [stateName: string]: TStateAction };
      __PRIVILEGES?: { stamp: number };
    }>;
    isMemberFunction(): boolean;
  }
}
