abap-adt-api
Version:
Interface to Abap Developer Tools webservice
42 lines • 2.62 kB
TypeScript
import { strnumOptions, X2jOptions } from "fast-xml-parser";
import * as t from "io-ts";
export { encode as encodeEntity } from "html-entities";
export declare const isObject: <T extends Object>(x: unknown) => x is T;
export declare const isArray: <T = unknown>(x: unknown) => x is T[];
export declare const isString: (x: unknown) => x is string;
export declare const isNumber: (x: unknown) => x is number;
export declare const isNativeError: (e: unknown) => e is Error;
export declare const isUndefined: (x: unknown) => x is undefined;
export declare function JSON2AbapXML(original: any, root?: string): string;
export declare const xmlArrayType: <C extends t.Mixed>(x: C) => t.UnionC<[t.ArrayC<C>, C, t.UndefinedC]>;
export declare const extractXmlArray: <T>(x: T | T[] | undefined) => T[];
export declare function xmlNode(xml: any, ...path: string[]): any;
export declare function xmlFlatArray<T>(xml: any, ...path: string[]): T[];
export declare function xmlArray<T>(xml: any, ...path: string[]): T[];
export declare const xmlRoot: (o: any) => any;
export declare const stripNs: (x: any) => any;
type StripAttrPrefix<T extends string> = T extends `@_${infer B}` ? B : never;
type attribKeys<T, K = keyof T> = K extends keyof T & `@_${infer _}` ? K : never;
type attribValues<T> = {
[P in attribKeys<T> as StripAttrPrefix<P>]: T[P];
};
export declare const xmlNodeAttr: (n: any) => any;
export declare const typedNodeAttr: <T = unknown>(n: T) => attribValues<T>;
export declare const bar: "pip";
export declare const numberParseOptions: strnumOptions;
export declare const fullParse: (xml: string, options?: X2jOptions) => any;
export declare const parse: (xml: string, options?: X2jOptions) => any;
export declare function toInt(x?: string): number;
export declare const parseSapDate: (d: string) => number | Date;
export declare const toSapDate: (d: Date) => number;
export declare const parseJsonDate: (d: string) => Date;
export declare function btoa(s: string): string;
export declare function parts(whole: any, pattern: RegExp): string[];
export declare const followUrl: (base: string, extra: string) => string;
export declare const boolFromAbap: (x: any) => boolean;
export declare function formatQS(raw: any): string;
export declare const toXmlAttributes: (o: any, prefix: string) => string;
export type Clean<T> = Pick<T, keyof T>;
export declare const orUndefined: <T extends t.Mixed>(x: T) => t.UnionC<[t.UndefinedC, T]>;
export declare function mixed<R extends t.Props, O extends t.Props>(required: R, optional: O): t.IntersectionC<[t.TypeC<R>, t.PartialC<O>]>;
//# sourceMappingURL=utilities.d.ts.map