@hasna/shortlinks 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/local.d.ts DELETED
@@ -1,27 +0,0 @@
1
- export interface LocalSetupPlan {
2
- domain: string;
3
- targetHost: string;
4
- port: number;
5
- hostsEntry: string;
6
- caddySnippet: string;
7
- certPath: string;
8
- keyPath: string;
9
- machinesCommand: string;
10
- sudoRequired: boolean;
11
- }
12
- export declare function createLocalSetupPlan(input: {
13
- domain: string;
14
- port?: number;
15
- targetHost?: string;
16
- certDir?: string;
17
- }): LocalSetupPlan;
18
- export declare function registerMachinesDns(input: {
19
- domain: string;
20
- port?: number;
21
- targetHost?: string;
22
- }): {
23
- command: string;
24
- status: number | null;
25
- stdout: string;
26
- stderr: string;
27
- };
package/dist/machine.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function getMachineId(): string;
@@ -1 +0,0 @@
1
- export declare const PG_MIGRATIONS: string[];
@@ -1,38 +0,0 @@
1
- import type { AddDomainInput, Click, ClickInput, CreateLinkInput, Domain, Link, LinkStats } from "./types.js";
2
- type PgAdapterLike = {
3
- get(sql: string, ...params: unknown[]): Promise<any>;
4
- all(sql: string, ...params: unknown[]): Promise<any[]>;
5
- run(sql: string, ...params: unknown[]): Promise<unknown>;
6
- close?: () => Promise<void>;
7
- };
8
- export declare class PgShortlinksStore {
9
- private readonly pg;
10
- constructor(pg: PgAdapterLike);
11
- static fromConnectionString(connectionString: string): Promise<PgShortlinksStore>;
12
- static fromCloud(service?: string): Promise<PgShortlinksStore>;
13
- close(): Promise<void>;
14
- addDomain(input: AddDomainInput): Promise<Domain>;
15
- listDomains(): Promise<Domain[]>;
16
- getDomain(hostnameOrId: string): Promise<Domain | null>;
17
- getDefaultDomain(): Promise<Domain | null>;
18
- createLink(input: CreateLinkInput): Promise<Link>;
19
- listLinks(options?: {
20
- domain?: string;
21
- activeOnly?: boolean;
22
- limit?: number;
23
- }): Promise<Link[]>;
24
- getLink(domainOrSlug: string, maybeSlug?: string): Promise<Link | null>;
25
- totalStats(): Promise<{
26
- domains: number;
27
- links: number;
28
- clicks: number;
29
- }>;
30
- resolve(hostname: string, slug: string): Promise<Link | null>;
31
- setLinkActive(domainOrSlug: string, maybeSlugOrActive: string | boolean, maybeActive?: boolean): Promise<Link>;
32
- deleteLink(domainOrSlug: string, maybeSlug?: string): Promise<Link>;
33
- recordClick(link: Link, input?: ClickInput): Promise<Click>;
34
- getStats(domainOrSlug: string, maybeSlug?: string): Promise<LinkStats>;
35
- private hashIp;
36
- private generateAvailableSlug;
37
- }
38
- export {};
package/dist/server.d.ts DELETED
@@ -1,25 +0,0 @@
1
- import type { ClickInput, Link } from "./types.js";
2
- export interface ShortlinksRuntimeStore {
3
- totalStats(): {
4
- domains: number;
5
- links: number;
6
- clicks: number;
7
- } | Promise<{
8
- domains: number;
9
- links: number;
10
- clicks: number;
11
- }>;
12
- resolve(hostname: string, slug: string): Link | null | Promise<Link | null>;
13
- recordClick(link: Link, input?: ClickInput): unknown | Promise<unknown>;
14
- }
15
- export interface ShortlinksHandlerOptions {
16
- store?: ShortlinksRuntimeStore;
17
- dbPath?: string;
18
- defaultHost?: string;
19
- redirectStatus?: 301 | 302 | 307 | 308;
20
- }
21
- export declare function createShortlinksHandler(options?: ShortlinksHandlerOptions): (request: Request) => Response | Promise<Response>;
22
- export declare function serveShortlinks(options?: ShortlinksHandlerOptions & {
23
- host?: string;
24
- port?: number;
25
- }): Bun.Server<undefined>;