// Type definitions for microservice-utilities 0.3 // Project: https://github.com/Cimpress-MCP/microservice-utilities.js // Definitions by: Daan Boerlage // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 /** * Authorizer */ export interface AuthorizerConfiguration { jwkKeyListUrl: string; authorizerContextResolver?: string; } export interface AuthorizerPolicy { principalId: string; policyDocument: object; } export class Authorizer { constructor(logFunction: (msg: any) => void, configuration: AuthorizerConfiguration); getPolicy(request: object): Promise; } /** * PlatformClient */ export interface PlatformClientConfiguration { client: object; } /* tslint:disable:no-unnecessary-generics */ export interface PlatformClientResponse { data?: T; status: number; statusText: string; headers: any; config: object; request?: any; } export class PlatformClient { constructor(logFunction: (msg: any) => void, tokenResolverFunction?: () => Promise, configuration?: PlatformClientConfiguration) get(url: string, headers?: { [s: string]: string; }, type?: string): Promise>; post(url: string, data: object, headers?: { [s: string]: string; }): Promise>; put(url: string, data: object, headers?: { [s: string]: string; }): Promise>; patch(url: string, data: object, headers?: { [s: string]: string; }): Promise>; delete (url: string, headers?: { [s: string]: string; }): Promise>; head(url: string, headers?: { [s: string]: string; }): Promise>; options(url: string, headers?: { [s: string]: string; }): Promise>; } /* tslint:enable:no-unnecessary-generics */ /** * RequestLogger */ export interface RequestLoggerConfiguration { logFunction?: (msg: any) => void; extendErrorObjects?: boolean; jsonSpace?: number; } export class RequestLogger { constructor(configuration?: RequestLoggerConfiguration); log(msg: any): void; } /** * ServiceTokenProvider */ export interface ServiceTokenProviderConfiguration { clientId: string; encryptedClientSecret: string; audience: string; tokenEndpoint: string; } export class ServiceTokenProvider { constructor(httpClient: object, kmsClient: object, configuration?: ServiceTokenProviderConfiguration); getToken(): Promise; getTokenWithoutCache(): Promise; }