@kwiz/common
Version:
KWIZ common utilities and helpers for M365 platform
43 lines (42 loc) • 2.05 kB
TypeScript
import { IDictionary } from "../../types/common.types";
import { tnsFieldTypes } from "../../types/ns/ns.common.types";
import { tnsCountryCode } from "../../types/ns/ns.countries.rest";
import { tnsCountryEnum } from "../../types/ns/ns.countries.restlet";
import { nsFieldEX } from "../../types/ns/ns.fieldex.types";
import { insSuiteTalkRestErrorData, tnsField } from "../../types/ns/ns.rest.types";
import { tnsrFieldInfo } from "../../types/ns/ns.restlet.types";
declare const nsEndpointHosts: {
suitetalk: string;
restlets: string;
ui: string;
};
export declare function getNSAccuntUrlPrefix(accountId: string): string;
export declare function getNsHost(accountId: string, host: keyof typeof nsEndpointHosts): string;
export declare function getBundlePage(info: {
/** bundle id */
id: string;
/** bundle org id */
orgId: string;
/** customer's account id */
accountId: string;
/** page type */
type: "install" | "update";
}): string;
/** send in either an AxiosError that has a response.data object, or just the data object itself. */
export declare function nsGetErrorDetails(error: any): insSuiteTalkRestErrorData;
export declare function nsObjectFilter(obj: string): boolean;
export declare function nsIsFeaturedObject(obj: string): boolean;
/** returns the title of the country or empty string if none found */
export declare function NSCountryToText(country: tnsCountryCode | tnsCountryEnum): string;
/** returns the code and enum of the best matching country or null if not found */
export declare function TextToNSCountry(country: string): ({
code: tnsCountryCode;
enum: tnsCountryEnum;
} | null);
export declare function nsFormatDate(date: Date, fieldType: tnsFieldTypes): string;
/** get the REST api fields, and restlet api fields and return a full field exanded info */
export declare function nsExpandFields(restFields: IDictionary<tnsField>, restletFields: {
bodyFields: tnsrFieldInfo[];
sublists?: IDictionary<tnsrFieldInfo[]>;
}): IDictionary<nsFieldEX>;
export {};