import { ISPService , ILibsOptions } from "./ISPService" ; import { ISPField , ISPLists } from "../common/SPEntities" ; export default class SPServiceMock implements ISPService { private _includeDelay ? : boolean ; private _delayTimeout ? : number ; constructor ( includeDelay ? , delayTimeout ? ) { this . _includeDelay = includeDelay ; this . _delayTimeout = delayTimeout || 500 ; } public getListItems ( filterText , listId , internalColumnName , field , keyInternalColumnName ? , webUrl ? ) { throw new Error ( "Method not implemented." ) ; } public getField = async ( listId , internalColumnName , webUrl ? ) : Promise < ISPField | undefined > => { return ; } ; /**
    * The mock lists to present to the local workbench
    */ private static _lists : ISPLists = { value : [ { Id : '8dc80f2e-0e01-43ee-b59e-fbbca2d1f35e' , Title : 'Mock List One' , BaseTemplate : '109' } , { Id : '772a30d4-2d62-42da-aa48-c2a37971d693' , Title : 'Mock List Two' , BaseTemplate : '109' } , { Id : '16c0d1c6-b467-4823-a37b-c308cf730366' , Title : 'Mock List Three' , BaseTemplate : '109' } ] } ; public getLibs ( options ? ) { return new Promise < ISPLists > ( async ( resolve ) => { if ( this . _includeDelay === true ) { await this . sleep ( this . _delayTimeout ) ; } resolve ( SPServiceMock . _lists ) ; } ) ; } param ms private sleep ( ms ) { return new Promise ( resolve => setTimeout ( resolve , ms ) ) ; } }