UNPKG

spitfirepm

Version:

Client API Tools for Spitfire Project Management

1,065 lines 54.9 kB
/// <reference types="jquery" /> /// <reference types="jquery" /> import { GUID } from "./globals"; import { IUCPermit, QueryFilters, SessionClient, Suggestion, UCPermitSet, UIDisplayConfig, UIDisplayPart } from "./SwaggerClients"; import * as _SwaggerClientExports from "./SwaggerClients"; export declare enum LoggingLevels { None = 0, Normal = 1, Verbose = 2, Debug = 9, VerboseDebug = 92 } export declare enum ValidationMode { none = "0", /** 1,T*,Y* are true, empty, 0,F*,N* are false */ boolean = "1", numeric = "2", positive = "5", integer = "6", positiveinteger = "7", date = "3", futuredate = "4", /** sort of like past date */ untildate = "8", /** non empty, can be combined with other validations */ required = "16", filename = "32" } type PartStorageList = Map<PartContextKey, PartStorageData>; export type CoordinateWithSize = { top: number; left: number; width: number; height: number; }; export type UploadMode = "catalog" | "ContactData" | "ContactPhoto" | "doc" | "SitePhoto" | "template"; export type SFRESTClientOptions = { /** @default 33000 (about 33 seconds) */ BasicPingServerInterval: number; /** @default "about:blank" */ BlankPageURI: string; CatalogFolderRoot: GUID; /** * How long (in milliseconds) should a DV result be cached for reuse * @default 16 minutes */ DVCacheLife: number; /** Adjusts logging; 2 is verbose, 9 is lots * @default None (0) */ LogLevel: LoggingLevels.None; NonPostbackEventID: string; /** * When true PopDoc() will always use new UI */ PopDocForceXBUI: boolean; /** @default '{0}/DocDetail.aspx?id={1}', */ PopDocLegacyURL: string; /** * @abstract PopDocXBURL can use {0} place holder for site path and {1} placeholder for document ID * @default "{0}/wx/#!/document?id={1}" */ PopDocXBURL: string; /** @default '{0}/DocDetail.aspx?add={1}&project={2}{3}' */ PopNewDocLegacyURL: string; /** @default "{0}/wx/#!/document?add={1}&project={2}{3}" */ PopNewDocXBURL: string; PopupWindowLargeCWS: CoordinateWithSize; PopupWindowHelpMenuCWS: CoordinateWithSize; PopupWindowUserSettingsCWS: CoordinateWithSize; PopupWindowViewUserCWS: CoordinateWithSize; PopupWindowTop: number; /** @default '{0}/ProjectDetail.aspx?id={1}' */ ProjectLegacyURL: string; /** @default '{0}/wx/#!/main/projectDashboard?project={1}' */ ProjectXBURL: string; UseClassicCatalog: boolean; SuggestionLimit: number; SuggestionCacheLifespanMs: number; /** @default 999, // about 1 second */ TaskStatePollInterval: number; /** @default 1048000, // about 1 minute */ UploadChunkSize: number; /** in Bytes. Default is about 8MB (Box.com uses 20) Files smaller than this are uploaded in a single request */ UploadDirectLimit: number; /** Use -1 to disable, 1 to enable and 0 (default) to defer to DevMode */ WxEventTraceMode: -1 | 1 | 0; /** matches are ignored, default is to ignore onMouseM* * @default /on(?!MouseM|Destruct)([\w]+)$/gmi, */ WxEventFilter: RegExp; /** When TRUE, Grids on Home (Action Items, Alerts), and Project Dashboard render using original XB logic * @default false .... set with top.sfClient.SetOptions().WxUseXBGrid = true */ WxUseXBGrid: boolean; [key: string]: string | number | RegExp | boolean | CoordinateWithSize | LoggingLevels | NVPair; }; declare class _SessionClientGetWCCShare { APIResult: Promise<WCCData | null> | null; ForNavHash: number | undefined; AsOf: number; IsResolved: boolean; constructor(apiPromise: Promise<WCCData | null>, forPageHash: number); AppliesFor(testHash: number): boolean; Expired(): boolean; } export declare class SFFileUploadContext { /** upload mode */ mode: UploadMode; /** key for a document */ DMK: GUID | undefined; /** key, for an item on the document (requires DMK) */ itemKey: GUID | undefined; /** key for a folder */ cfk: GUID | undefined; /** key for a template (required for mode=template) */ fk: GUID | undefined; /** key, such as for a user/contact (required for mode=ContactPhoto) */ pk: GUID | undefined; /** project */ project: string | undefined; /** data cache key */ fromDS: string | undefined; constructor(mode: UploadMode); } declare class PartStorageData { CFG: UIDisplayPart | null; DataModels: Map<string, DataModelCollection>; RestClient: sfRestClient; _PromiseList: Promise<any>[] | null; protected _InitializationResultPromise: Promise<UIDisplayPart | null> | null; protected _ReferenceKey: PartContextKey; protected _ForPartName: string; /** Use sfApplicationRootPath instead of _SiteURL */ protected static _SiteURL: string; protected static _DMCount: number; CFGLoader(): Promise<UIDisplayPart | null>; static _LoadedParts: PartStorageList; static ClearCache(): void; /** * * @param client sfRestClient * @param partName something like ActionItems or ProjectCA * @param forDocType GUID * @param forProject project ID; if empty client.GetPageProjectKey() is used * @param context * @param usingCfg if supplied, stored, otherwise resolved * @returns * @see RegisterRestoredCFG */ static PartStorageDataFactory(client: sfRestClient, partName: string, forDocType: GUID | undefined, forProject: GUID | undefined, context: string | undefined, usingCfg?: UIDisplayPart): PartStorageData; /** * * @param client * @param lookupName * @param usingCfg * @returns * @see RegisterRestoredLookupCFG */ static PartStorageDataLookupFactory(client: sfRestClient, lookupName: string, usingCfg?: UIDisplayPart): PartStorageData; static GetPartContextKey(partName: string, forDocType: GUID | undefined, forProject: GUID | undefined, context: string | undefined): PartContextKey; GetDataModelBuildContextKey(): string; protected constructor(client: sfRestClient, partName: string, forDocType: GUID | undefined, forProject: GUID | undefined, context: string | undefined); } /** * Options for Query Alias Popup ( QAPopInfo ) */ declare class QAInfoOptions { /** * Title for JQueryUI dialog, eg "Routes that Reference Role: $V"; $V is replace by value text (see ValueCSS) */ DialogTitle: string; /** * Applied to DIV around table. Default is sfUIShowInfo */ DialogCSS: string; /** * Shown if no results. Example: "No route references were found." Default: Nothing to see here... */ EmptyDialogText: string; /** * HTTP GET query that returns JSON; $K is replaced by key from callback */ QueryURL: string; /** * When not empty, used to find value for $V */ ValueCSS: string | undefined; /** * Finds closest element with .sfUIPopQA and its matching .uiQA-xxx and creates options class from CSS -- attributes * * * .sfQA-RoleRouteInfo { * * --dialog-title:"Routes that Reference Role" ; * --dialog-class:sfUIShowInfo; * --dialog-value-class: false * --dialog-empty-text:"No route references were found." ; * --dialogQueryL:"util/jstNodes.ashx/qa/RoleMemberInfo/$K"; * } */ static QAInfoOptionsFromCSSFactory(forElement: JQuery<HTMLElement>): QAInfoOptions | null; /** * * @param fromElement * @param cssName * @param defaultValue Specify if default is not empty string * @returns */ protected static CSSPropertyValueOrEmpty(fromElement: JQuery<HTMLElement>, cssName: string, defaultValue?: string): string; LoadFromDataAttributes(fromElement: JQuery<HTMLElement>): void; constructor(title: string, cssClass: string, emptyText: string, queryURL: string); } export declare class NVPair { [key: string]: any; } export declare class WCCData { [key: string]: any; } export type DataModelRow = Record<string, any>; export type DataModelCollection = DataModelRow[]; export declare class InvokeOptions { ByTask?: boolean | undefined; ByAcct?: boolean | undefined; targetWindow?: string; } export type TableAndFieldInfo = { table: string; field: string; dbf: string; isRO: boolean; isValid: boolean; }; export type PartContextKey = string; export type Permits = number; /** See sfRestClient.PageTypeNames */ export type PageTypeName = number; export type PagePartList = { [key: string]: Permits; }; export interface iRaiseDocSaveFinished { (eventData: SaveEventData, whatChanged: _SwaggerClientExports.DocFieldChange, newChangeStamps?: { [key: string]: number; }): void; } export interface iDocumentModel extends iDocumentModelBase { DocHeaderData: _SwaggerClientExports.DocMasterDetail; CurrentRouteRow: _SwaggerClientExports.DocRoute; CurrentAttachments: _SwaggerClientExports.DocAttachment[]; SaveDocumentPatch: { (deltas: _SwaggerClientExports.IDocFieldChange[], isDone: true | iRaiseDocSaveFinished): Promise<NVPair>; }; getExclusivityMode: { (): number; }; [key: string]: any; } export type SaveEventState = 'queue' | 'saving' | 'done' | 'trouble'; export interface changeStampSet { [key: string]: number; } export type SaveEventData = { state: SaveEventState; pending: number; message: string; createdAt: number; promiseAt?: number; backendPromise?: Promise<NVPair>; priorChangeStamps?: changeStampSet; newChangeStamps?: changeStampSet; }; /** Spitfire PM Client * @example top.sfClient.GetDV(...) * @example Access static methods or shared properties from console: top.staticBase._IconMap */ export declare class sfRestClient { readonly ClientVersion: string; ServerVersion(): string; /** * Helps decode Permit flags */ readonly PermissionFlags: { Read: number; Insert: number; Update: number; Delete: number; Special: number; }; /** For identifying the type of page/dashboard */ readonly PageTypeNames: { HomeDashboard: number; ProjectDashboard: number; Catalog: number; ExecutiveDashboard: number; AdminDashboard: number; ManageDashboard: number; Contacts: number; Report: number; PivotTool: number; Document: number; Unknown: number; Unauthenticated: number; UnauthenticatedLogin: number; UnauthenticatedWizard: number; UnauthenticatedLink: number; /** app root still not redirected to a specific page */ UnauthenticatedDefault: number; UserAccountRecovery: number; DiagUtilities: number; PopupAdminTool: number; RichTextEdit: number; }; /** * Applies removals, then changes, then additions * @param rawData array of Data Model or View Model * @param keyName name of key field in this data model * @param changes (Add,Change,Remote) * @returns merged rawData * @see BuildDataSummary */ ApplyDataChanges(rawData: DataModelCollection, keyName: string, changes: _SwaggerClientExports.DataDifferential): DataModelCollection; /** * Extracts key, etag pairs from a set of data * @param rawData array of Data Models or View Models, must have etag * @param keyName * @returns array of key, etag pairs, suitable for passing to getChange* API endpoints * @see ApplyDataChanges */ BuildDataSummary(rawData: DataModelCollection, keyName: string): _SwaggerClientExports.CurrentDataSummary[]; /** * Async builds a View Model for the rawData, given part context. - use .then() */ BuildViewModelForContext(partName: string, context: string, forDocType: GUID | undefined, rawData: DataModelCollection | DataModelRow): Promise<DataModelCollection>; /** * Updates row visibility on the server and updates the in-memory flags for display of this row * @param partName ProjTeam or ProjectPublicInfo * @param rawData ViewModel containing raw row data */ ToggleRowVisibility(partName: "ProjTeam" | "ProjectPublicInfo" | string, rawData: DataModelRow): Promise<boolean>; /** Writes to console log * @argument msg text to write * @argument level msg is suppressed if logging level is less than specified, default is verbose */ Log(msg: string, level?: LoggingLevels): void; /** * Applies CFG data to raw Data Model, returns promise that resolves when View Model is ready */ protected _ConstructViewModel(thisPart: PartStorageData, rawData: any): Promise<DataModelCollection>; WaitForSessionLoaded(): Promise<void>; /** * async: returns an numerc bit-flag indicating the user's permission level (R=1,I=2,U=4,D=8,S=16) * When the user has admin permissions, these are blended (unless ucModule = WORK) * @param ucModule WORK,SYS, PAGE, PART,LIST * @param ucFunction see xsfUCFunction * @param optionalDTK guid or undefined * @param optionalProject */ CheckPermit(ucModule: string, ucFunction: string, optionalDTK?: string, optionalProject?: string, optionalReference?: string): Promise<Permits>; /** * Resolves list of part names with permissions * @returns object with part names and permission flags */ GetPagePartPermits(forPageName?: PageTypeName, pageKey?: string): Promise<PagePartList>; /** * Returns set of choices for an auto-complete based on the seed value * @param lookupName * @param seedValue 0 or more characters which will limit the suggestions * @param dependsOn 0 to 4 values required by the lookup for context; @see sfRestClient.GatherDependsOnValues to process string * @param limit a reasonable number of suggestions to be returned; zero or negative replaced with option.SuggestionLimit * @returns promise of suggestions. reuses a matching promise from withing about 4 minutes * @description context is provided from GetPageContextValue("dsCacheKey") */ GetLookupSuggestions(lookupName: string, seedValue: string, dependsOn: string | string[] | undefined, limit?: number): Promise<Suggestion[] | null>; /** returns GetPageContextValue("dsCacheKey") */ GetPageDataContext(): string; static readonly suggestionCacheLifespan = 246800; /** maps Suggestion Group key to when expires */ private static RecentSuggestionAsOf; /** maps Suggestion Group key to promise result */ private static RecentSuggestionResultMap; private static RecentDocumentList; /** Returns list of recent documents from server as updated by PopDoc() calls */ GetRecentDocuments(): _SwaggerClientExports.MenuAction[]; /** * Returns a View Model constructured for the result rows matching specified lookup context and filters * @param lookupName * @param filterValues default to {} can include NVPs and zero to 4 dependsOn strings * @returns */ GetLookupResults(lookupName: string, /** * either a string or string array (up to 4 elements); */ filterValues: QueryFilters): Promise<DataModelCollection>; /** removes an exact match from the session DV cache */ ClearDV(displayName: string, keyValue: string, /** * either a string or string array (up to 4 elements) */ dependsOn: string | string[] | undefined): boolean; /** * Get Display Value using DV-Name and key value, with 0 to 4 dependencies. * @param displayName the name of a display value rule (eg sfUser, RoleName, etc) * @param keyValue the primary or most significant key * @param dependsOn optional array of context values (multi-part key); 0 to 4 elements allowed; hint: use 'empty' for an empty value * @param autoVary force bypass of cache * @returns Promise for String */ GetDV(displayName: string, keyValue: string, /** * either a string or string array (up to 4 elements) */ dependsOn?: string | string[] | undefined, /** * when true, a unique value is added to defeat cache */ autoVary?: boolean | undefined): Promise<string | null>; /** * Throttles and batches requests for display values (DVs) to improve performance. * If there are pending DV requests, it adds the new request to a queue and sets up a timer to batch the requests. * Otherwise, it directly calls the `getDisplayableValue` method on the `LookupClient` API. * * @param api - The `LookupClient` API instance to use for making DV requests. * @param dvRequest - The DV request object containing the necessary parameters. * @returns A Promise that resolves to the requested display value, or `null` if the request fails. */ private _ThrottleDVRequests; private _DVRequestQueue; private _DVThrottledResolvers; private _DVRequestTimerHandle; /** * Async Get Part Configuration Data given part name, doc type and context * @param partName DocRoute or ActionItems etc * @param forDocType guid * @param forProject * @param partContext * @returns CFG object */ GetPartCFG(partName: string, forDocType?: GUID, forProject?: string, partContext?: string): Promise<UIDisplayPart | null>; /** * Tell the cfg manager about a CFG that was recovered from local storage * @param partName * @param forDocType * @param forProject * @param partContext * @param recoveredCFG NOT optional, you are responsible for it being current * @returns the cfg object * @see GetPartCFG */ RegisterRestoredCFG(partName: string, forDocType?: GUID, forProject?: string, partContext?: string, recoveredCFG?: UIDisplayPart): UIDisplayPart; /** * Tell the cfg manager about a lookup that was recovered from local storage * @param lookupName * @param recoveredCFG NOT optional, you are responsible for it being current * @returns the cfg object * @see GetPartCFG */ RegisterRestoredLookupCFG(lookupName: string, recoveredCFG: UIDisplayPart): UIDisplayPart; /** * Async Get of Lookup column configuration data * @param lookupName name of required Lookup * @returns UIDisplayPart with relevant UIItems and UIFilters */ GetLookupCFG(lookupName: string): Promise<UIDisplayPart | null>; /** Returns URL for a file */ GetFileURL(fileKey: GUID | _SwaggerClientExports.FileInformation, fn?: string, fileRev?: number, forDownload?: boolean): string; /** Returns URL for a file preview (given size) */ GetFilePreviewURL(fileKey: GUID | _SwaggerClientExports.FileInformation, width: number, height: number, fn?: string, fileRev?: number): string; /** Returns URL for the appropriate icon given a file type * @param fileType jpg, xml, docx, etc. Do not include the leading period * @returns site root relative URL, something like /sfPMS/images/iconname.png */ GetIconURL(fileType: string, iconSizeIgnored?: number): string; /** Returns information about a document process */ GetDocProcessTypeInfo(forDocType: GUID): Promise<_SwaggerClientExports.ProcessDocumentType | undefined>; private static LocalProcessTypeInfo; private static LocalProcessTypeInfoPromise; /** * Displayable size * @param size integer size in bytes * @returns size scaled to KB, MB or GB */ BytesToSizeString(size: number): string; /** Async get of a non-user specific setting (always the same for all users) */ RuleResult(ruleName: string, testValue: string, filterValue: string | undefined, defaultValue: string | number | boolean): Promise<string | number | boolean | null>; /** * Pops up a dialog showing result of a qAlias query * * @param forElement either an JQuery element or QAInfoOptions object * @param queryOptions? if specified, passes Query URL, title and other options * @param resolveKey callback function that resolves $K for the URL * @param onPostback not currently used, typically (t,a)=> __doPostback(t,a); * @returns forElement (which may now have a .dialog) * */ PopQAInfo(forElement: JQuery<HTMLElement>, queryOptions?: QAInfoOptions, resolveKey?: (forElement: JQuery<HTMLElement>) => string, resolveValue?: (forElement: JQuery<HTMLElement>, queryOptions: QAInfoOptions) => string, onPostback?: (eventTarget: string, eventArgs: string) => void): JQuery<HTMLElement>; private AdjustFluidDialog; UpdateFluidDialogs(): void; AutoSizeDialog($D: JQuery<HTMLElement>): JQuery<HTMLElement>; GetFileUploadURL(uploadContext: SFFileUploadContext): string; GetFileChunkUploadURL(uploadContext: SFFileUploadContext): string; private _BuildFileUploadURL; /** Uploads a file of up to Options.UploadDirectLimit Bytes (around 8MB) in a single request, then falls back to 1MB chunks * * @returns promise that resolves on upload complete */ UploadFile(blobFile: File, uploadContext: SFFileUploadContext, progressCallback?: (state: _SwaggerClientExports.XferFilesStatus) => boolean): Promise<_SwaggerClientExports.XferFilesStatus | _SwaggerClientExports.HttpResponseJsonContent>; /** checks with server up to 3 times a second. promise resolves when task has ended or callback returns true; * @param taskKey guid key for task * @param sessionClient optional existing SessionClient * @param progressCallback optional callback for when task status is not 200; if this callback returns true, promise is resolved */ WaitForTask(taskKey: GUID, sessionClient?: SessionClient, progressCallback?: (state: _SwaggerClientExports.HttpResponseJsonContent) => boolean): Promise<_SwaggerClientExports.HttpResponseJsonContent>; ExportCompetitiveBidData(): void; static $CurrentPleaseWaitDialog: JQuery<HTMLDivElement> | null; HeyPleaseWait(): JQuery<HTMLDivElement>; ClearPleaseWaitDialog(): void; /** * Maps .NET placeholders (dn) to webix placeholders (dx) * Important: order matters (eg: dd must be remapped before d, or the d map would be used) */ protected readonly _DateFormatMap: { dn: string; dx: string; }[]; /** * Converts traditional .NET date formats to Webix formats * @param dotNetFormat something like d or m/d/yyyy * See https://support.spitfirepm.com/kba-01132/ and https://docs.webix.com/helpers__date_formatting_methods.html * * test: ["d","t","d t","MMM d, yyyy","MM d, yy","M dd, yyyy","MMM d, yyyy HH:mm:ss","d/m/yyyy","H:mm:ss","h:mm:ss tt"].forEach(test=> console.log(test.padEnd(25),"\t",sfClient.ConvertDotNetDateTimeFormatToWebix(test))) */ ConvertDotNetDateTimeFormatToWebix(dotNetFormat: string): string; /** returns true if the passed value is effectively empty * @see basically the same as Route.helpers.isEmptyValue() */ IsEmptyValue(value: any): boolean; /** * Converts a JSON set into rows of an HTML Table. * @param mydata an array of JSON objects * @returns JQuery<HTMLTableElement> TABLE that has not been inserted into DOM */ MakeTable: (mydata: JSON[]) => JQuery<HTMLTableElement>; /** * Make sure the URL starts with application root path */ MakeSiteRelativeURL(url: string): string; /** scans for IMG tags with class sfUIMakeSrcSiteRelative */ makeResourceURIsSiteRelative($DOM: JQuery<HTMLElement>): void; /** resolves full path (for current theme) and sets sfImg flag */ protected setImgSrc($T: JQuery<HTMLImageElement>): JQuery.jqXHR<any> | JQuery.Promise<string>; protected requestImgPath(imgName: string): JQuery.jqXHR<any> | JQuery.Promise<string>; protected SessionStorageKeyForImageName(imgName: string): string; protected SessionStoragePathForImageName(imgStorageKey: string): string | false; /** * Loads UC Function Keys and corresponding Module/System Names * NOTE: returns a JQueryPromise */ protected LoadUCFunctionMap(): JQueryPromise<any>; protected _LoadIconMap(): void; /** Simple test for an authenticated session * - Use await or .then() */ IsLoggedIn(): Promise<boolean>; /** * Loads or Updates WCC session attributes (api/session/who) * @param bypassCache * @param locationHash when omitted, location.toString is used */ LoadUserSessionInfo(bypassCache?: boolean, newHref?: string): Promise<WCCData>; IsLoginRelatedPage(): boolean; protected static _SessionClientGetWCC: _SessionClientGetWCCShare | null; protected static _SessionClientGetUCFKMap: JQueryXHR | null; private static _MakeFakeWCC; /** applies changes to connection properties * @see SharePageContext */ UpdateWCCData(newWCC: WCCData): WCCData; /** * For each passed URI, If page does not already have a matching SCRIPT element, adds one * @param jsResourceList array of source uri */ LoadDynamicJS(jsResourceList: string[]): void; AssureJQUITools($element: JQuery<HTMLElement>): Promise<boolean>; /** * @param url * @param headScript true to place the script in the head section * @param [useAsync=false] true to load async * @param [context=self] * @returns promise - use .then for code after the script has loaded * */ AddCachedScript(url: string, headScript?: boolean, context?: Window | undefined, useAsync?: boolean): Promise<boolean>; /** * Adds a link to a stylesheet for the page * @param cssRef if includes a slash(/), must be full URL, otherwise site-url/wv.aspx/js/ is prepended * @returns nothing */ AddCSSResource(cssRef: string): void; /** Returns a guid/uuid * @param [fetchCount=3] number of keys to request * @returns something in the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx * */ NewGuid(fetchCount?: number): Promise<GUID>; /** * Opens a new tab with URL specified based on Document Type Key and UI version * @param dtk the guid document type * @param project the project ID to be assigned to the new document * @param options might include &UseID= to specify a key for the new document or &mode=np */ PopNewDoc(dtk: GUID, project: string, options?: string): Promise<Window | null>; /** search supplied object for a key reference */ sfRowKey($For: JQuery<HTMLElement>): GUID; /** * Opens a new tab with location specified based on Document Key and UI version * @param id the guid DocMasterKey for the document to be opened * @comment Adds document to the Recent Document List */ PopDoc(id: GUID | JQuery<HTMLElement>): Promise<Window | null>; /** Adds (or relocates) the specified document to the top of the recent document list * @param dmk guid of the document * @param title text to show in menu, typically result of DocTitleLong */ UpdateRecentDocumentList(dmk: GUID, title: string | null): void; /** * Opens a new dashboard tab with project specified * @param id the project ID without mask */ OpenProject(id: string): Promise<Window | null>; /** switches to the peer tab with Name=Dashboard * @returns self if window.name === Dashboard */ SwitchToDashboardTab(): Promise<Window | null>; /** returns true if url starts with _SiteURL */ IsSiteURL(url: string): boolean; IsRESTErrorResponse(testObject: _SwaggerClientExports.HttpResponseJsonContent | any): boolean; /** * Sets sfRestClient Options * * @returns copy of current options * @example SetOptions( { LogLevel: LoggingLevel.Verbose, DVCacheLife: 22*60000, PopDocForceXBUI: true, PopDocXBURL: "{0}#!/doc/home?id={1}"}); * @example SetOptions().LogLevel = LoggingLevel.Verbose; * * @see GetStringOption @see GetBooleanOption @see GetNumericOption * * */ SetOptions(options?: NVPair): SFRESTClientOptions; GetBooleanOption(optionName: string): boolean; GetNumericOption(optionName: string): number; GetStringOption(optionName: string): string; /** Predefined Default Options * This object is static and shared by all instances of sfRESTClient * */ protected static _Options: SFRESTClientOptions; /** * Builds a query friendly string, also great for hashing or cache keys */ protected _addQueryValue( /** * When true, query string is in form a/b/c, when false Aand priorList contains a ?, then &d1=a&d2=b&d3=c */ asPath: boolean, priorList: string | string[], idx: number, dv: any): string; /** * Builds a query friendly string 1 to 4 inputs by using _addQueryValue */ protected _formatDependsList(asPath: boolean, depends1: string | string[], dep2?: string, dep3?: string, dep4?: string): string; /** * consolidate request components into a single string - dv/displayName/pv/d1/d2/d3 */ protected _getDVRequestString(displayName: string, pv: string | number | boolean, dependsOn: string | string[] | undefined): string; /** * Returns query-suitable string to make HTTP GET defeat cache */ _getVaryByQValue(): string; protected _GetAPIXHR(url: string): JQueryXHR; protected _APIURL(suffix: any): string; /** * For example: http://server.domain.com/sfPMS (does not include ending slash) * @description consumers of this class should use sfApplicationRootPath */ protected readonly _SiteURL: string; /** for example: /sfPMS */ protected readonly _SiteRootURL: string; /** copied to instance vars above */ private static __SiteURL; private static __SiteRootURL; /** returns something like /sfPMS */ protected static ResolveSiteRootURLs(): string; /** * Returns value from object that matches the field/property name */ FieldValueFromRow(rawRow: any, fieldName: string): any; /** * Finds a row using a string key match * @param rawData array of rows * @param keyName required key field name * @param keyValue value of key in desired row * @returns index of row (0-based); undefined if not found */ FindRowIndexByKey(rawData: DataModelCollection, keyName: string, keyValue: string): number | undefined; /** * Builds a string array of values that help define the context of a lookup or evaluation * @param dependsOnList semicolon separated list of related field and constants. eg #DocMasterDetail.Project;=Subtype (# is optional) * @param rawRow primary source of data */ GatherDependsOnValues(dependsOnList: string, rawRow: any): string[] | undefined; /** * Allows a page to update the _WCC context data * @param contextData object of Name-Value pairs, such as {DataPK: keyvalue, DocRevKey: keyvalue, etc: etc} * @returns true if successful usually sychronously */ SharePageContext(contextData: NVPair): Promise<boolean>; /** returns INPUT element(s) inside the data-dbf marked element * @param tableDotField something like DocMasterDetail.ContractType (case sensetive) * */ GetDBFInputElement(tableDotField: string): JQuery<HTMLInputElement> | undefined; /** returns the element with the data-dbf attribute * @param tableDotField something like DocMasterDetail.ContractType (case sensetive) * */ GetDBFElement(tableDotField: string): JQuery<HTMLInputElement> | undefined; /** returns an INPUT element * @param tableDotField something like DocMasterDetail.ContractType (case sensetive) * */ GetInputValue(inputView: any): string | number | undefined; SetInputValue(inputView: any, newValue: string | number | DataModelRow | undefined): void; /** * * @param withClass "fa-fighter-jet czUIMyBtn" (automatically includes clsEnabledImgBtn and fas) * @param withTip tool tip * @param $AppendTo default to status cell; use $(0) or false to prevent DOM insertion * @param withSRC when specified, use just the image name (delete.gif); when string is passed an <IMG> tag is used instead of <i> and the image them/path is resolved * @returns */ CreateButtonElement(withClass: undefined | string, withTip: string | undefined, $AppendTo?: JQuery<HTMLElement>, withSRC?: string): JQuery<HTMLElement>; /** * Returns named value from Web Context (WCC) * * Example: GetPageContext("UserKey"); * * @param key name of a context property * @param defaultValue returned if the requested value is not available * @param silentDefault when true, suppresses console warning about use of default value */ GetPageContextValue(key: string, defaultValue?: any, silentDefault?: boolean): any; /** * Returns named value from Web Context (WCC) * * Example: SetPageContext("UserKey"); * * @param key name of a context property */ SetPageContextValue(key: string, newValue?: any): void; /** returns a references to the WX page document model, including the data and state */ GetPageDocumentModel(): iDocumentModel | undefined; /** returns a references to the page document UI, including header */ GetPowerUXDocumentUI(): iPowerUXDocumentUI | undefined; isWebix(): boolean; /** requires isWebix() to be true */ GetPowerUXRouteHelper(): iRouteHelperService; IsDocExclusiveToMe(): boolean; static IsPowerUXPage(): boolean; IsPowerUXPage(): boolean; IsHomeDashboardPage(): boolean; IsCatalogPage(): boolean; IsDocumentPage(): boolean; IsProjectPage(): boolean; /** @deprecated use IsPageOfType() */ IsPageOfTypeByName(pageWanted: string): boolean; IsPageOfType(pageWanted: string | PageTypeName): boolean; protected IsGlobalInstance(): boolean; ResolvePageTypeName(): PageTypeName; protected ResolveStringPageNametoPageTypeName(pageNameString: string): PageTypeName; /** uses browser location object to resolve page name */ protected ResolvePageName(): string; /** uses URL to find path and query hash * @argument fromHref must be fully qualified */ protected ResolvePageNameFromURL(fromHref: string): string; private static NextHrefIsPending; private static NextHrefIsUnauthenticated; /** asserts a new url to resolve the new page type. Stays in effect until the location hash next changes */ urlChange(newURL: string, newHref: string): void; protected XBVariantOfPageName(classicPageName: PageTypeName): string; /** * applies a mask like xxx-xx-xxxx to a string, each x consumes an input character, all others are copied * @param inputString * @param inputMask * @returns */ CEFormatStringValue(inputString: string, inputMask: string): string; /** finds value of name= in location.search (or location.hash) */ GetPageQueryParameterByName(name: string): string; /** finds value of name= in the supplied string * @argument source the string to be searched for name; delimited by ampersand or # * @argument name the id of the value wanted * @see GetPageQueryParameterByName() calls this method with location.search (or location.hash) */ GetQueryParameterValueByName(source: string, name: string): string; /** Returns the search or hash portion of the page location */ GetPageQueryContent(fromHref?: string): string; /** returns the primary key for this page */ GetPagePK(): string; GetPageProjectKey(pageTypeName?: PageTypeName): string; /** display support panel */ InvokeSupportPanel(): void; /** sets the OS clipboard * @description navigator.clipboard only works for https and localhost */ SetClipboard(text: string): Promise<boolean>; /** * Parses and performs an action * @param actionString often in the form javascript:something(args) * @param rowData optional collection of data * @param options InvokeOptions including targetWindow. targetWindow of H is replaced with hash of action * * Actions Supported * - vPgPopup(...) * - PopDoc(...) and PopNewDoc * - PopTXHistory(...) and PopBFAHistory() * - Nav To (dcmodules and admin tools) */ InvokeAction(actionString: string | _SwaggerClientExports.MenuAction, rowData?: DataModelRow, options?: InvokeOptions): void; private rxIsVPgPop; private rxPopWhat; private rxPopWhatURL; private rxPopWindowName; private rxOfficeLink; /** @returns true if this is a Microsoft Windows OS device */ IsWindowsOS(): boolean; /** @returns true if this is browser can open .Application links */ HasDotNetApplicationExtension(): boolean; /** Creates an exchange token and calls OpenWindowsLinkHelper() */ FollowLinkViaSFLink(targetURL: string, afterOpenArg?: boolean | string | [string, string] | Function, autoCloseDoc?: boolean): void; getAffinityInfo(): { at: string | undefined; ak: string | undefined; }; /** * * @param et token passed to sfLink * @param afterOpenArg boolean/true: closes document page; false/0: posts back default refresh; ['e','a']: posts back e with a; callback function is passed et * @param autoCloseDoc */ OpenWindowsLinkHelper(et: string, afterOpenArg?: boolean | string | [string, string] | Function, autoCloseDoc?: boolean): void; /** Finds $$ markers and other replacable values. * Markers are case sensative */ protected ExpandActionMarkers(rawAction: string, rowData?: DataModelRow): string; /** given a mark name, returns the replacement value * @see ExpandActionMarkers() * @argument markerName such as $$Project or $$PDSKEY * @argument rowData object containing row data - first source for value to replace the marker */ protected GetActionMarkerReplacement(markerName: string, rowData?: DataModelRow): string; /** returns the value of a browser cookie */ getCookie(cookieName: string): string | undefined; /** * Figures out the type of page and the amount of viewable height (without scrolling) * @returns height of top frame */ UsablePageHeight(): number; notificationMsgTimeoutHandle: number | undefined; WasNotificationShown(notificationMsg: string): boolean; MarkNotificationAsShown(notificationMsg: string): void; /** * See DisplayUserNotification() and DisplaySysNotification() * @param templateURL div content source - See DisplayUserNotification() and DisplaySysNotification() * @param notificationText message to display * @param timeOutMS if specified, message auto-clears in this many milliseconds. Which does not count as dismissed. * @returns the DIV containing the message, .data("alreadyshown") = true if already shown. */ DisplayThisNotification(templateURL: string, notificationText?: string, timeOutMS?: number): Promise<JQuery<HTMLElement>>; ClearNotificationMsgTimeoutHandle(): void; /** Use DisplayUserNotification() This method displays a message from the server!!! * @param hashCode help with getting freshest */ DisplaySysNotification(hashCode: string | number, timeOutMS?: number): Promise<JQuery<HTMLElement>>; private lastNotificationCheckPromise; /** Checks backend for a new system notification and displays it */ CheckForSystemNotification(): void; private static lastNotificationCheck; /** Displays a simple user notification, with "dismiss" session memory * @param notificationText The message. Message is skipped if the same exact message has already been dismissed. * @param timeOutMS if specified, message auto-clears in this many milliseconds. Which does not count as dismissed. */ DisplayUserNotification(notificationText?: string, timeOutMS?: number): Promise<JQuery<HTMLElement>>; /** * Opens a Modal dialog with an iFrame and loads pvp.aspx?vpg=your-vpg-id / * @param vpg ReportBrowser,; * @param opts Should begin with an ampersand(&) * @param w * @param h * @param defaultResponse */ VModalPage(vpg: string, opts: string, w: number, h: number, defaultResponse: string | undefined): void; private static GlobalPermitAPIPromise; private static GALastPageHitSent; private GAMonitorPageHit; /** Monitors an event * @argument clientID site id * @argument category Event Name, such as login, search, or view_search_results * @argument action */ GAMonitorEvent(clientID: string, category: string, action: string, label: string, value: number): JQuery.Promise<any, any, any> | undefined; /** Google Analytics Event */ GAEvent(category: string, action: string, label: string, value: number): void; /** Shortcut that calls GAEvent("dialog",action, dialogName,1) */ GADialogEvent(action: string, dialogName: string): void; /** Shortcut that calls GAEvent("dialog",action, viewName,rows) */ GAViewModelEvent(viewName: string, rows: number): void; private ValueHasWildcard; private sfClearACHeighLimit; /** * / Note: this only returns Async Frames, not frames for lookups and other dialog scenarios * @returns */ private sfGetParentIFrame; private sfLimitACHeightInFrame; /** * Enhance an INPUT element with Autocomplete (classic UI) * @param $AC NAME attribute of INPUT or the Input Element * @param lookupName source of autocomplete choices * @param depends1 * @param dep2 * @param dep3 * @param dep4 */ sfAC($AC: string | JQuery<HTMLInputElement>, lookupName: string, depends1: string | string[], dep2?: string, dep3?: string, dep4?: string): void; /** Displays a modal dialog and returns a reference to the dialog for further manipulation * @argument msg the text for the dialog message. Can include html * @argument title optional title * @argument uiAlertIcon if specified, and not false, ui-icon class name (see https://api.jqueryui.com/theming/icons/) */ jqAlert(msg: string, title?: string, uiAlertIcon?: string): JQuery<HTMLDivElement>; /** Opens a jquery ui dialog with an iframe to display the requested url * @param url a same-site url * @param eventId optional - used when dialog is closed * @param eventArg optional - used when dialog is closed * @param eventContext optional - used when dialog is closed * */ ModalDialog(url: string, eventId?: string | undefined, eventArg?: string | undefined, eventContext?: Window | undefined | null): Promise<boolean | undefined> | undefined; protected $LookupDialog: JQuery<HTMLDivElement> | undefined; static $LookupDialogStack: JQuery<HTMLDivElement>[]; protected $LookupFrame: JQuery<HTMLIFrameElement> | undefined; protected ResolveLookupFrame(forDialog?: JQuery<HTMLDivElement> | undefined): JQuery<HTMLIFrameElement> | undefined; SetModalDialogTitle(theDialog: JQuery<HTMLElement> | undefined, titleText: string, ptSize?: string | number | undefined): JQuery<HTMLElement> | undefined; /** Adds a small button * @param btnIcon see */ AddDialogTitleButton($Dialog: JQuery<HTMLElement>, btnID: string, btnText: string, btnIcon?: string): JQuery<HTMLElement>; AddDialogHelpButton($Dialog: JQuery<HTMLElement>, helpURL: string): JQuery<HTMLElement>; RefreshiFrameSrc(): false | undefined; ResizeDialogInFrame(FrameElement: HTMLIFrameElement | undefined, RESTClient: sfRestClient): void; /** Sends the specified message to the server log file using REST API */ LogMessageOnServer(msgText: string): void; GetSFTabCount(tabName?: string): number; /** For Chrome Debug watch */ LiveWatch(): string; protected sfModalDialogClosed(_unusedEl?: any | undefined): void; /** Internal to the class * this is the lookup DIV */ protected sfModelDialogResizedHandler(): void; /** * (OBSOLETE) Resize parent sfDash window * @deprecated sfDash relic: we cannot change the size of the parent window * @param canShrink * @param DesiredWidth * @param DesiredHeight */ protected sfSetParentWindowSize(canShrink: boolean, DesiredWidth: number, DesiredHeight: number): void; private sfLookupHeightChangeTo; private _LookupViewPortAdjustments; private sfLookupWidthChangeTo; /** * Updates internal sizes after the dialog frame size is changed * @param forDialog reference to DIV with jQueryUI dialog widget * @returns */ protected sfModelDialogResized(forDialog: JQuery<HTMLDivElement>): void; protected DialogViewPortAdjustments: { outsidExtraW: number; outsidExtraH: number; vpExtraW: number; vpExtraH: number; frameExtraH: number; }; /** * Applies UI CFG to all rows in a dataset * @param item a single UI Configuration item * @param thisPart Part, including reference to raw data being upscaled to match UI CFG * @param dataModelBuildKey allows thread-safe usage */ _ApplyUICFGtoRawData(item: UIDisplayConfig, thisPart: PartStorageData, dataModelBuildKey: string): void; /** * * @param thisPart instance of PartStorageData * @param dataModelBuildKey unique per vm build * @param index row index into data * @param dataField base field name * @param suffix added to base name (_dv, _ov, _IsInactive, etc) * @param newValue value for the target */ protected _AddDVValueToDataModel(thisPart: PartStorageData, dataModelBuildKey: string, index: number, dataField: string, suffix: string, newValue: string | boolean | null): void; /** typically returns a period for North America */ private static ResolvedIntlFormat; private static InitializeIntlFormats; /** Typically returns a period for North America */ GetDecimalSeparator(): string; /** Typically returns a comma for North America */ GetNumericGroupSeparator(): string; /** returns true if the passed value is a specific number */ IsNumber(n: string | number): boolean; /** Gets val or text from supplied jQuery element and returns its numeric value * * Removes formatting to convert string to value */ GetNumericValueFrom(el: JQuery): number; /** Formats a value and places it into VAL() or TEXT() then cascades change events to self.sfPutEditStoreValue() * returns TRUE if value has changed * This method is critical in cascading QTY*RATE=TOT and allowing any of the three to be changed * @see self.sfPutEditStoreValue() */ SetJQElementValue(el: JQuery, newValue: number, dp?: number): boolean; RoundValue(originalNumber: number, decimals?: number): number; /** Returns a number formatted as a string, support C0-C4, F0-F9, N0-N9, 000 */ FormatNumericValue(newValue: number | string, intoFormat: string): string; /** * @argument sSource string in form name=value;otherKey=othervalue;... * @argument sKey name of value to be replaced or added * @argument sValue string or number or DateRange. String should not contain a semicolon! * @returns sSource updated with sKey=sValue; */ SetNameValuePairInString(sSource: string, sKey: string, sValue: string | _SwaggerClientExports.DateRange | { start: Date; end: Date; } | number): string; /** * @argument sSource string in form name=value;otherKey=othervalue;... * @argument sKey name of value to be returned */ GetNamedValueFromStringAsBoolean(sSource: string, sKey: string, defaultValue?: boolean): boolean; /** * @argument sSource string in form name=value;otherKey=othervalue;... * @argument sKey name of value to be returned */ GetNamedValueFromString(sSource: string, sKey: string, defaultValue?: string): string; /** * Returns a refernce that can be used to create instances of specific API clients * @returns object with exported resources constructorts */ readonly exports: NVPair; /** * Returns a refernce that can be used to invoke static methods on this class * @returns sfRestClient static class */ readonly staticBase: sfRestClient; /** * Creates an instance of the requested API controller with baseURL set appropriately * @param ofTypeName eg ActionItemsClient, DocumentToolsClient, LookupClient * @returns instance */ NewAPIClient(ofTypeName: 'ActionItemsClient' | 'CatalogClient' | 'DocumentToolsClient' | 'ExcelToolsClient' | 'LookupClient' | 'ProjectsClient' |