refactor(jslib): ♻️ config obj instead of positional args in api
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
parent
a5603ecd66
commit
6003eebbe8
|
@ -27,9 +27,12 @@ export class UpEndApi {
|
|||
private queryOnceLRU = new LRU<string, UpListing>({ max: 128 });
|
||||
private inFlightRequests: { [key: string]: Promise<UpListing> | null } = {};
|
||||
|
||||
constructor(instanceUrl = "", wasmExtensions?: UpEndWasmExtensions) {
|
||||
this.setInstanceUrl(instanceUrl);
|
||||
this.wasmExtensions = wasmExtensions;
|
||||
constructor(config: {
|
||||
instanceUrl?: string;
|
||||
wasmExtensions?: UpEndWasmExtensions;
|
||||
}) {
|
||||
this.setInstanceUrl(config.instanceUrl || "http://localhost:8093");
|
||||
this.wasmExtensions = config.wasmExtensions;
|
||||
}
|
||||
|
||||
public setInstanceUrl(apiUrl: string) {
|
||||
|
|
|
@ -1,18 +1,6 @@
|
|||
import type { IEntry, IValue, ListingResult } from "./types";
|
||||
export { UpEndApi } from "./api";
|
||||
|
||||
// export function listingAsOrdered(listing: ListingResult): OrderedListing {
|
||||
// const entries = Object.entries(listing) as [Address, IEntry][];
|
||||
// return entries
|
||||
// .sort(([_, a], [__, b]) =>
|
||||
// String(a.value.c).localeCompare(String(b.value.c))
|
||||
// )
|
||||
// .sort(([_, a], [__, b]) =>
|
||||
// String(a.value.t).localeCompare(String(b.value.t))
|
||||
// )
|
||||
// .sort(([_, a], [__, b]) => a.attribute.localeCompare(b.attribute));
|
||||
// }
|
||||
|
||||
export class UpListing {
|
||||
public readonly entries: UpEntry[];
|
||||
private _objects: { [key: string]: UpObject } = {};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@upnd/upend",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"description": "Client library to interact with the UpEnd system.",
|
||||
"scripts": {
|
||||
"build": "tsc --build --verbose",
|
||||
|
|
|
@ -3,4 +3,4 @@ import { UpEndWasmExtensionsWeb } from "@upnd/upend/wasm/web";
|
|||
import wasmURL from "@upnd/upend/node_modules/@upnd/wasm-web/upend_wasm_bg.wasm?url";
|
||||
|
||||
const wasm = new UpEndWasmExtensionsWeb(wasmURL);
|
||||
export default new UpEndApi("/", wasm);
|
||||
export default new UpEndApi({ instanceUrl: "/", wasmExtensions: wasm });
|
||||
|
|
Loading…
Reference in New Issue