pretty
This commit is contained in:
parent
984cba226f
commit
76d2524b8b
2
packages/taler-util/src/compat.d.ts
vendored
2
packages/taler-util/src/compat.d.ts
vendored
@ -19,4 +19,4 @@ export function processArgv(): string[];
|
|||||||
export function readlinePrompt(prompt: string): Promise<string>;
|
export function readlinePrompt(prompt: string): Promise<string>;
|
||||||
export function pathBasename(s: string): string;
|
export function pathBasename(s: string): string;
|
||||||
export function setUnhandledRejectionHandler(h: (e: any) => void): void;
|
export function setUnhandledRejectionHandler(h: (e: any) => void): void;
|
||||||
export function getenv(name: string): string | undefined;
|
export function getenv(name: string): string | undefined;
|
||||||
|
30
packages/taler-util/src/http-impl.node.d.ts
vendored
30
packages/taler-util/src/http-impl.node.d.ts
vendored
@ -1,17 +1,25 @@
|
|||||||
import { HttpLibArgs } from "./http-common.js";
|
import { HttpLibArgs } from "./http-common.js";
|
||||||
import { HttpRequestLibrary, HttpRequestOptions, HttpResponse } from "./http.js";
|
import {
|
||||||
|
HttpRequestLibrary,
|
||||||
|
HttpRequestOptions,
|
||||||
|
HttpResponse,
|
||||||
|
} from "./http.js";
|
||||||
/**
|
/**
|
||||||
* Implementation of the HTTP request library interface for node.
|
* Implementation of the HTTP request library interface for node.
|
||||||
*/
|
*/
|
||||||
export declare class HttpLibImpl implements HttpRequestLibrary {
|
export declare class HttpLibImpl implements HttpRequestLibrary {
|
||||||
private throttle;
|
private throttle;
|
||||||
private throttlingEnabled;
|
private throttlingEnabled;
|
||||||
constructor(args?: HttpLibArgs);
|
constructor(args?: HttpLibArgs);
|
||||||
/**
|
/**
|
||||||
* Set whether requests should be throttled.
|
* Set whether requests should be throttled.
|
||||||
*/
|
*/
|
||||||
setThrottling(enabled: boolean): void;
|
setThrottling(enabled: boolean): void;
|
||||||
fetch(url: string, opt?: HttpRequestOptions): Promise<HttpResponse>;
|
fetch(url: string, opt?: HttpRequestOptions): Promise<HttpResponse>;
|
||||||
get(url: string, opt?: HttpRequestOptions): Promise<HttpResponse>;
|
get(url: string, opt?: HttpRequestOptions): Promise<HttpResponse>;
|
||||||
postJson(url: string, body: any, opt?: HttpRequestOptions): Promise<HttpResponse>;
|
postJson(
|
||||||
|
url: string,
|
||||||
|
body: any,
|
||||||
|
opt?: HttpRequestOptions,
|
||||||
|
): Promise<HttpResponse>;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,8 @@ import * as common from "./http-common.js";
|
|||||||
|
|
||||||
export * from "./http-common.js";
|
export * from "./http-common.js";
|
||||||
|
|
||||||
|
export function createPlatformHttpLib(
|
||||||
export function createPlatformHttpLib(args?: common.HttpLibArgs): common.HttpRequestLibrary {
|
args?: common.HttpLibArgs,
|
||||||
|
): common.HttpRequestLibrary {
|
||||||
return new impl.HttpLibImpl(args);
|
return new impl.HttpLibImpl(args);
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,6 @@ test("iban validation", (t) => {
|
|||||||
t.assert(validateIban("NL71RABO9996666779").type === "invalid");
|
t.assert(validateIban("NL71RABO9996666779").type === "invalid");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test("iban generation", (t) => {
|
test("iban generation", (t) => {
|
||||||
let iban1 = generateIban("DE", 10);
|
let iban1 = generateIban("DE", 10);
|
||||||
console.log("generated IBAN", iban1);
|
console.log("generated IBAN", iban1);
|
||||||
|
@ -276,7 +276,7 @@ export function generateIban(countryCode: string, length: number): string {
|
|||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
const cc = ccZero + (Math.floor(Math.random() * 100) % 10);
|
const cc = ccZero + (Math.floor(Math.random() * 100) % 10);
|
||||||
appendDigit(digits, cc)
|
appendDigit(digits, cc);
|
||||||
ibanSuffix += String.fromCharCode(cc);
|
ibanSuffix += String.fromCharCode(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,6 @@ export interface WaitingForRetryNotification {
|
|||||||
numDue: number;
|
numDue: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface ExchangeAddedNotification {
|
export interface ExchangeAddedNotification {
|
||||||
type: NotificationType.ExchangeAdded;
|
type: NotificationType.ExchangeAdded;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import * as _qjsOsImp from "os";
|
import * as _qjsOsImp from "os";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import * as _qjsStdImp from "std";
|
import * as _qjsStdImp from "std";
|
||||||
|
|
||||||
|
|
||||||
export interface QjsHttpResp {
|
export interface QjsHttpResp {
|
||||||
status: number;
|
status: number;
|
||||||
data: ArrayBuffer;
|
data: ArrayBuffer;
|
||||||
@ -17,7 +15,6 @@ export interface QjsHttpOptions {
|
|||||||
headers?: string[];
|
headers?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface QjsOsLib {
|
export interface QjsOsLib {
|
||||||
fetchHttp(url: string, options?: QjsHttpOptions): Promise<QjsHttpResp>;
|
fetchHttp(url: string, options?: QjsHttpOptions): Promise<QjsHttpResp>;
|
||||||
postMessageToHost(s: string): void;
|
postMessageToHost(s: string): void;
|
||||||
@ -34,4 +31,4 @@ export interface QjsStdLib {
|
|||||||
// This is not the nodejs "os" module, but the qjs "os" module.
|
// This is not the nodejs "os" module, but the qjs "os" module.
|
||||||
export const qjsOs: QjsOsLib = _qjsOsImp as any;
|
export const qjsOs: QjsOsLib = _qjsOsImp as any;
|
||||||
|
|
||||||
export const qjsStd: QjsStdLib = _qjsStdImp as any;
|
export const qjsStd: QjsStdLib = _qjsStdImp as any;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user