Updated the SPHelper methods with a proper return type.
This commit is contained in:
parent
7739e6f934
commit
e9aa0e94c0
|
@ -17,6 +17,7 @@ import { IWeb } from "@pnp/sp/webs";
|
|||
import { IUserInfo, IPropertyMappings, IPropertyPair, FileContentType, SyncType, JobStatus } from "./IModel";
|
||||
import { IList } from '@pnp/sp/lists';
|
||||
import { ChoiceFieldFormatType } from '@pnp/sp/fields/types';
|
||||
import { IFileAddResult, IFileInfo } from '@pnp/sp/files';
|
||||
|
||||
const map: any = require('lodash/map');
|
||||
const intersection: any = require('lodash/intersection');
|
||||
|
@ -28,14 +29,15 @@ export interface ISPHelper {
|
|||
getAzurePropertyForUsers: (selectFields: string, filterQuery: string) => Promise<any[]>;
|
||||
getPropertyMappings: () => Promise<any[]>;
|
||||
getPropertyMappingsTemplate: (propertyMappings: IPropertyMappings[]) => Promise<any>;
|
||||
addFilesToFolder: (filename: string, fileContent: any) => void;
|
||||
addFilesToFolder: (filename: string, fileContent: any) => Promise<IFileAddResult>;
|
||||
addDataFilesToFolder: (fileContent: any, filename: string) => Promise<IFileAddResult>;
|
||||
getFileContent: (filepath: string, contentType: FileContentType) => void;
|
||||
createSyncItem: (syncType: SyncType) => Promise<number>;
|
||||
updateSyncItem: (itemid: number, inputJson: string) => void;
|
||||
updateSyncItemStatus: (itemid: number, errMsg: string) => void;
|
||||
getAllJobs: () => void;
|
||||
getAllTemplates: () => void;
|
||||
getAllBulkList: () => void;
|
||||
getAllTemplates: () => Promise<IFileInfo[]>;
|
||||
getAllBulkList: () => Promise<IFileInfo[]>;
|
||||
|
||||
runAzFunction: (httpClient: HttpClient, inputData: any, azFuncUrl: string, itemid: number) => void;
|
||||
}
|
||||
|
@ -145,7 +147,7 @@ export default class SPHelper implements ISPHelper {
|
|||
* Add the template file to a folder with contents.
|
||||
* This is used for creating the template json file.
|
||||
*/
|
||||
public addFilesToFolder = async (fileContent: any, isCSV: boolean) => {
|
||||
public addFilesToFolder = async (fileContent: any, isCSV: boolean): Promise<IFileAddResult> => {
|
||||
let filename = (isCSV) ? this.SyncCSVFileName : this.SyncJSONFileName;
|
||||
await this.checkAndCreateFolder(this.SiteRelativeURL + this.SyncTemplateFilePath);
|
||||
return await this._web.getFolderByServerRelativeUrl(this.SiteRelativeURL + this.SyncTemplateFilePath)
|
||||
|
@ -156,7 +158,7 @@ export default class SPHelper implements ISPHelper {
|
|||
* Add the data file to a folder with contents.
|
||||
* This is used for creating the template json file.
|
||||
*/
|
||||
public addDataFilesToFolder = async (fileContent: any, filename: string) => {
|
||||
public addDataFilesToFolder = async (fileContent: any, filename: string): Promise<IFileAddResult> => {
|
||||
await this.checkAndCreateFolder(this.SiteRelativeURL + this.SyncUploadFilePath);
|
||||
return await this._web.getFolderByServerRelativeUrl(this.SiteRelativeURL + this.SyncUploadFilePath)
|
||||
.files
|
||||
|
@ -240,7 +242,7 @@ export default class SPHelper implements ISPHelper {
|
|||
/**
|
||||
* Get all the templates generated
|
||||
*/
|
||||
public getAllTemplates = async () => {
|
||||
public getAllTemplates = async (): Promise<IFileInfo[]> => {
|
||||
return await this._web.getFolderByServerRelativeUrl(this.SiteRelativeURL + this.SyncTemplateFilePath)
|
||||
.files
|
||||
.select('Name', 'ServerRelativeUrl', 'TimeCreated')
|
||||
|
@ -250,7 +252,7 @@ export default class SPHelper implements ISPHelper {
|
|||
/**
|
||||
* Get all the bulk sync files
|
||||
*/
|
||||
public getAllBulkList = async () => {
|
||||
public getAllBulkList = async (): Promise<IFileInfo[]> => {
|
||||
return await this._web.getFolderByServerRelativeUrl(this.SiteRelativeURL + this.SyncUploadFilePath)
|
||||
.files
|
||||
.select('Name', 'ServerRelativeUrl', 'TimeCreated')
|
||||
|
|
Loading…
Reference in New Issue