This commit is contained in:
Sebastian 2023-05-22 13:12:38 -03:00
parent 984cba226f
commit 76d2524b8b
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
8 changed files with 25 additions and 522 deletions

View File

@ -1,5 +1,9 @@
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.
*/ */
@ -13,5 +17,9 @@ export declare class HttpLibImpl implements HttpRequestLibrary {
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>;
} }

View File

@ -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);
} }

View File

@ -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);

View File

@ -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);
} }

View File

@ -191,7 +191,6 @@ export interface WaitingForRetryNotification {
numDue: number; numDue: number;
} }
export interface ExchangeAddedNotification { export interface ExchangeAddedNotification {
type: NotificationType.ExchangeAdded; type: NotificationType.ExchangeAdded;
} }

View File

@ -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;

File diff suppressed because it is too large Load Diff