import { $REST , List , Helper , SiteManager , SPTypes , Types , Web } from "../@types" ; Web ( ) . getUserEffectivePermissions ( "" ) . execute ( perm => { perm . GetUserEffectivePermissions ; } ) ; List ( "Site Assets" ) . getUserEffectivePermissions ( "" ) . execute ( perm => { perm . GetUserEffectivePermissions ; } ) ; let el = document . querySelector ( "#Element" ) ; let a1 = Helper . SP . CalloutManager . createAction ( { text : "" , onClickCallback : ( ) => { } } ) ; let m = Helper . SP . CalloutManager . createMenuEntries ( [ { text : "" , onClickCallback : ( ) => { } } ] ) ; let a2 = Helper . SP . CalloutManager . createAction ( { text : "" , menuEntries : m } ) ; let c = Helper . SP . CalloutManager . createNewIfNecessary ( { ID : "" , launchPoint : el } ) ; c . addAction ( a1 ) ; c . addAction ( a2 ) ; $REST . Web ( ) . getFileByServerRelativeUrl ( "" ) . getLimitedWebPartManager ( ) . WebParts ( ) . execute ( wpMgr => { } ) ; $REST . Web ( ) . CurrentUser ( ) . execute ( user => { user . LoginName ; } ) ; $REST . Web ( ) . CurrentUser ( ) . query ( { Select : [ "LoginName" ] } ) . execute ( user => { user . LoginName ; } ) ; $REST . Web ( ) . query ( { } ) . execute ( web => { } ) ; $REST . Site ( ) . RootWeb ( ) . execute ( web => { } ) ; $REST . Web ( ) . RoleAssignments ( ) . getByPrincipalId ( 8 ) . RoleDefinitionBindings ( ) . execute ( d => { d . results [ 0 ] . Name ; } ) ; $REST . Web ( ) . Lists ( "Documents" ) . RoleAssignments ( ) . execute ( roles => { roles . results [ 0 ] . PrincipalId ; } ) ; $REST . Web ( ) . Lists ( "Documents" ) . RoleAssignments ( ) . execute ( roles => { } ) ; $REST . Web ( ) . Lists ( ) . getById ( "" ) . RoleAssignments ( ) ; $REST . Web ( ) . Lists ( ) . getByTitle ( "" ) . RoleAssignments ( ) ; $REST . Web ( ) . Lists ( ) . query ( { } ) . execute ( lists => { lists . results [ 0 ] . RoleAssignments . results [ 0 ] . PrincipalId ; } ) ; $REST . Web ( ) . SiteGroups ( ) . execute ( groups => { groups . results [ 0 ] . Id ; } ) ; $REST . Web ( ) . SiteGroups ( "" ) . RoleAssignments ( ) . execute ( roles => { roles . results [ 0 ] . PrincipalId ; } ) ; $REST . HubSites ( ) . getById ( "" ) . execute ( h => { h . Title ; } ) ; $REST . GroupSiteManager ( ) . canUserCreateGroup ( ) . execute ( value => { value ; } ) ; let addAttachments = ( ) => { const upInc = Number ( 100 / this . state . files . length ) . toFixed ( 2 ) ; this . setState ( { uploadInc : upInc , uploadCont : upInc } ) ; let item = List ( "TaskTracker" ) . Items ( this . state . newReqID ) ; const currentFiles = this . state . files ; for ( let i = 0 ; i < currentFiles . length ; i ++ ) { let file = currentFiles [ i ] ; const reader = new FileReader ( ) ; reader . onloadend = ( ) => { item . AttachmentFiles ( ) . add ( file . name , reader . result ) . execute ( info => { const uploadedFiles = this . state . fileCount + 1 ; this . setState ( { fileCount : uploadedFiles } , ( ) => { } ) ; } , true ) ; } ; reader . onerror = ( ) => console . error ( "file reading has failed" ) ; reader . readAsArrayBuffer ( file ) ; } item . done ( ( ) => { } ) ; } ; $REST . Helper . SP . ModalDialog . showWaitScreenWithNoClose ( "" ) ; $REST . Helper . SP . SOD . registerSod ( "gd-sprest" , "/siteassets/gd-sprest.min.js" ) ; $REST . ContextInfo . getWeb ( "/sites/appcatalog" ) . execute ( ctx => { $REST . Web ( "/sites/web" , { requestDigest : ctx . GetContextWebInformation . FormDigestValue } ) . execute ( w => { } ) ; } ) ; $REST . Helper . SP . SOD . registerSod ( "gd-sprest" , $REST . ContextInfo . siteServerRelativeUrl + "/siteassets/gd-sprest" ) ; $REST . Web ( ) . Lists ( ) . execute ( r => { let title = r . results [ 0 ] . Title ; r . next ( ) . execute ( n => { let title = n . results [ 0 ] . Title ; n . next ( ) . execute ( n => { n . results [ 0 ] . Items ( ) . execute ( i => { i . results [ 0 ] . File ( ) ; } ) ; } ) ; } ) ; } ) ; $REST . List ( "" ) . execute ( l => { l . getItemById ( 3 ) . execute ( item => { let file = item . File ; } ) ; } ) ; $REST . Web ( ) . getUserEffectivePermissions ( "" ) . execute ( r => { r . GetUserEffectivePermissions ; } ) ; $REST . Search ( ) . postquery ( { Querytext : "*" , Properties : [ { Name : "GraphQuery" , Value : { StrVal : "ACTOR(ME,action:1013)" } } ] } ) ; $REST . Helper . SPConfig ( { ListCfg : [ { CustomFields : [ { name : "TestField1" , title : "Test Field 1" , type : $REST . Helper . SPCfgFieldType . Text } , { name : "TestField2" , title : "Test Field 2" , type : $REST . Helper . SPCfgFieldType . Text } , { name : "TestField3" , title : "Test Field 3" , type : $REST . Helper . SPCfgFieldType . Text } ] , ListInformation : { BaseTemplate : 100 , Title : "Test List With Spaces" } } ] } ) . install ( ) ;