Skip to content

Commit

Permalink
add dist
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer committed Sep 7, 2024
1 parent fb0b66c commit 932fa89
Show file tree
Hide file tree
Showing 85 changed files with 3,647 additions and 0 deletions.
346 changes: 346 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

988 changes: 988 additions & 0 deletions dist/sw.js

Large diffs are not rendered by default.

994 changes: 994 additions & 0 deletions dist/swlib.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions dist/types/adblockcss.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export declare function getAdBlockCSSResponse(fullDomain: string, adblockUrl: string): Promise<Response>;
export declare class ByLineTransform {
_buffer: string[];
_lastChunkEndedWithCR: boolean;
decoder: TextDecoder;
transform(chunkArray: Uint8Array, controller: TransformStreamDefaultController): void;
flush(controller: TransformStreamDefaultController): void;
}
export declare class ByLineStream extends TransformStream<Uint8Array, string> {
constructor();
}
//# sourceMappingURL=adblockcss.d.ts.map
1 change: 1 addition & 0 deletions dist/types/adblockcss.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions dist/types/api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Path } from "path-parser";
import { type SWCollections } from "./swmain";
type RouteMatch = Record<string, any>;
declare class APIRouter {
routes: Record<string, Record<string, Path>>;
constructor(paths: Record<string, string | [string, string]>);
match(url: string, method?: string): RouteMatch | {
_route: null;
};
}
declare class API {
router: APIRouter;
collections: SWCollections;
constructor(collections: SWCollections);
get routes(): Record<string, string | [string, string]>;
apiResponse(url: string, request: Request, event: FetchEvent): Promise<Response>;
handleApi(request: Request, params: RouteMatch, event: FetchEvent): Promise<any>;
listAll(filter?: string | null): Promise<{
colls: any[];
}>;
makeResponse(response: Response, status?: number): Response;
}
export { API };
//# sourceMappingURL=api.d.ts.map
1 change: 1 addition & 0 deletions dist/types/api.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

155 changes: 155 additions & 0 deletions dist/types/archivedb.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import { type IDBPDatabase, type IDBPTransaction } from "idb/with-async-ittr";
import { ArchiveResponse } from "./response";
import { type DBStore, type DigestRefCount, type PageEntry, type ResAPIResponse, type ResourceEntry } from "./types";
import { type ArchiveRequest } from "./request";
export type Opts = {
minDedupSize?: number | undefined;
noRefCounts?: unknown;
noFuzzyCheck?: boolean;
noRevisits?: boolean;
pageId?: string;
};
type DBType = {
pages: {
key: string;
value: PageEntry & {
size?: number;
};
indexes: {
url: string;
ts: string;
state: number;
};
};
pageLists: {
key: string;
value: {
pages?: unknown[];
show?: boolean;
title?: string | undefined;
desc?: string | undefined;
slug?: string | undefined;
};
};
curatedPages: {
key: string;
value: PageEntry;
indexes: {
listPages: [string, string];
};
};
resources: {
key: [string, string];
value: ResourceEntry;
indexes: {
pageId: string;
mimeStatusUrl: [string, string, string];
};
};
payload: {
key: string;
value: {
digest: string;
payload: Uint8Array | null;
};
};
digestRef: {
key: string;
value: DigestRefCount | null;
};
};
export declare class ArchiveDB implements DBStore {
name: string;
minDedupSize: number;
version: number;
autoHttpsCheck: boolean;
useRefCounts: boolean;
allowRepeats: boolean;
repeatTracker: RepeatTracker | null;
fuzzyPrefixSearch: boolean;
initing: Promise<void>;
db: IDBPDatabase<DBType> | null;
constructor(name: string, opts?: Opts | undefined);
init(): Promise<void>;
_initDB(db: IDBPDatabase<DBType>, oldV: number, _newV: number | null, _tx?: IDBPTransaction<DBType, (keyof DBType)[], "readwrite" | "versionchange">): void;
clearAll(): Promise<void>;
close(): void;
delete(): Promise<void>;
addPage(page: PageEntry, tx?: IDBPTransaction<DBType, [keyof DBType], "readwrite"> | null): Promise<string>;
addPages(pages: PageEntry[], pagesTable?: keyof DBType, update?: boolean): Promise<void>;
createPageList(data: {
title?: string;
desc?: string;
description?: string;
id?: string;
slug?: string;
}): Promise<string>;
addCuratedPageList(listInfo: Record<string, unknown>, pages: PageEntry[]): Promise<void>;
addCuratedPageLists(pageLists: {
[k: string]: PageEntry[] | undefined;
}[], pageKey?: string, filter?: string): Promise<void>;
convertCuratedPagesToV2(db: IDBPDatabase<DBType & {
pages: {
key: string;
value: {
page?: PageEntry;
} & PageEntry;
};
curatedPages: {
key: string;
value: {
page?: PageEntry;
} & PageEntry;
};
}>): Promise<void>;
getCuratedPagesByList(): Promise<{
pages?: unknown[];
show?: boolean;
title?: string | undefined;
desc?: string | undefined;
slug?: string | undefined;
}[]>;
newPageId(): string;
getAllPages(): Promise<(PageEntry & {
size?: number;
})[]>;
getPages(pages: PageEntry[]): Promise<PageEntry[]>;
getTimestampsByURL(url: string): Promise<string[]>;
getPagesWithState(state: number): Promise<(PageEntry & {
size?: number;
})[]>;
getVerifyInfo(): Promise<{}>;
addVerifyData(_prefix: string | undefined, _id: string, _expected: string, _actual?: string | null, _log?: boolean): Promise<void>;
addVerifyDataList(_prefix: string, _datalist: unknown[]): Promise<void>;
dedupResource(digest: string, payload: Uint8Array | null | undefined, tx: IDBPTransaction<DBType, (keyof DBType)[], "readwrite">, count?: number): Promise<DigestRefCount | null>;
addResources(datas: ResourceEntry[]): Promise<void>;
getFuzzyUrl(result: ResourceEntry): ResourceEntry | null;
addResource(data: ResourceEntry): Promise<boolean>;
getResource(request: ArchiveRequest, _prefix: string, event: FetchEvent, opts?: Opts): Promise<ArchiveResponse | Response | null>;
loadPayload(result: ResourceEntry, _opts: Opts): Promise<AsyncIterable<Uint8Array> | Iterable<Uint8Array> | Uint8Array | null | undefined>;
isSelfRedirect(url: string, result: ResourceEntry | undefined): boolean;
lookupUrl(url: string, ts?: number, opts?: Opts): Promise<ResourceEntry | null>;
lookupQueryPrefix(url: string, opts: Opts): Promise<ResourceEntry | null>;
resJson(res: ResourceEntry): ResAPIResponse;
resourcesByPage(pageId: string): Promise<ResourceEntry[]>;
resourcesByPages2(pageIds: string[]): AsyncGenerator<ResourceEntry, void, unknown>;
resourcesByPages(pageIds: string[]): AsyncGenerator<ResourceEntry, void, unknown>;
matchAny<S extends keyof DBType>(storeName: S, indexName: DBType[S] extends {
indexes: {};
} ? keyof DBType[S]["indexes"] | null : null, sortedKeys: string[], subKey?: number, openBound?: boolean): AsyncGenerator<DBType[S]["value"], void, unknown>;
resourcesByUrlAndMime(url: string, mimes: string, count?: number, prefix?: boolean, fromUrl?: string, fromTs?: string): Promise<ResAPIResponse[]>;
resourcesByMime(mimesStr: string, count?: number, fromMime?: string, fromUrl?: string, fromStatus?: number): Promise<ResAPIResponse[]>;
deletePage(id: string): Promise<{
pageSize: number;
dedupSize: number;
}>;
deletePageResources(pageId: string): Promise<number>;
prefixUpperBound(url: string): string;
getLookupRange(url: string, type: string, fromUrl?: string, fromTs?: string): IDBKeyRange;
}
declare class RepeatTracker {
repeats: Record<string, Record<string, number>>;
getSkipCount(event: FetchEvent, url: string, method: string): number;
}
export {};
//# sourceMappingURL=archivedb.d.ts.map
1 change: 1 addition & 0 deletions dist/types/archivedb.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions dist/types/baseparser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { type ArchiveLoader, type DBStore, type PageEntry } from "./types";
export type ResourceEntry = {
url: string;
ts: number;
digest?: string | null;
status?: number;
mime?: string;
respHeaders?: Record<string, string> | null;
reqHeaders?: Record<string, string> | null;
recordDigest?: string | null;
payload?: Uint8Array | null;
reader?: AsyncIterable<Uint8Array> | Iterable<Uint8Array> | null;
referrer?: string | null;
extraOpts?: Record<string, any> | null;
pageId?: string | null;
origURL?: string | null;
origTS?: number | null;
source?: object;
requestUrl?: string | null;
method?: string | null;
requestBody?: Uint8Array;
loaded?: boolean;
};
declare abstract class BaseParser implements ArchiveLoader {
batchSize: number;
promises: Promise<void>[];
batch: ResourceEntry[];
count: number;
dupeSet: Set<string>;
db: any;
constructor(batchSize?: number);
addPage(page: PageEntry): void;
isBatchFull(): boolean;
addResource(res: ResourceEntry): void;
flush(): void;
finishIndexing(): Promise<void>;
_finishLoad(): void;
abstract load(db: DBStore, progressUpdateCallback?: any, totalLength?: number): Promise<void>;
}
export { BaseParser };
//# sourceMappingURL=baseparser.d.ts.map
1 change: 1 addition & 0 deletions dist/types/baseparser.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions dist/types/blockloaders.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export type ResponseAbort = {
response: Response;
abort: AbortController | null;
};
export type BlockLoaderOpts = {
url: string;
headers?: Record<string, string> | Headers;
extra?: Record<string, any>;
size?: number;
blob?: Blob;
};
export declare function createLoader(opts: BlockLoaderOpts): Promise<BaseLoader>;
export declare abstract class BaseLoader {
canLoadOnDemand: boolean;
headers: Record<string, string> | Headers;
length: number | null;
constructor(canLoadOnDemand: boolean);
abstract doInitialFetch(tryHead: boolean, skipRange: boolean): Promise<ResponseAbort>;
abstract getLength(): Promise<number>;
abstract getRange(offset: number, length: number, streaming: boolean, signal?: AbortSignal | null): Promise<Uint8Array | ReadableStream<Uint8Array>>;
abstract get isValid(): boolean;
}
export declare function getReadableStreamFromIter(stream: AsyncIterable<Uint8Array>): ReadableStream<any>;
export declare function getReadableStreamFromArray(array: Uint8Array): ReadableStream<any>;
//# sourceMappingURL=blockloaders.d.ts.map
1 change: 1 addition & 0 deletions dist/types/blockloaders.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 932fa89

Please sign in to comment.