@hasna/shortlinks 0.1.22 → 0.1.24
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/README.md +40 -20
- package/dist/cli/index.js +2507 -2019
- package/dist/cloudflare.js +141 -4
- package/dist/db/migrations.d.ts +20 -0
- package/dist/generated/storage-kit/health.d.ts +19 -0
- package/dist/generated/storage-kit/index.d.ts +7 -0
- package/dist/generated/storage-kit/migrations.d.ts +47 -0
- package/dist/generated/storage-kit/mode.d.ts +47 -0
- package/dist/generated/storage-kit/pool.d.ts +33 -0
- package/dist/generated/storage-kit/query.d.ts +35 -0
- package/dist/generated/storage-kit/tls.d.ts +25 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +3139 -232
- package/dist/mcp/http.d.ts +16 -0
- package/dist/mcp/index.d.ts +14 -0
- package/dist/mcp/index.js +1493 -0
- package/dist/pg-store.d.ts +20 -2
- package/dist/pg-store.js +913 -0
- package/dist/runtime.d.ts +65 -0
- package/dist/runtime.js +214 -0
- package/dist/sdk/generated.d.ts +178 -0
- package/dist/sdk/index.d.ts +12 -0
- package/dist/sdk/index.js +500 -0
- package/dist/serve/app.d.ts +21 -0
- package/dist/serve/index.d.ts +14 -0
- package/dist/serve/index.js +8817 -0
- package/dist/serve/openapi.d.ts +8 -0
- package/dist/server.js +33 -0
- package/infra/aws-ec2-user-data.sh +32 -31
- package/package.json +29 -7
package/dist/pg-store.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TypedQueryClient } from "./generated/storage-kit/query.js";
|
|
1
2
|
import type { AddDomainInput, Click, ClickInput, CreateLinkInput, Domain, Link, LinkStats } from "./types.js";
|
|
2
3
|
type PgAdapterLike = {
|
|
3
4
|
get(sql: string, ...params: unknown[]): Promise<any>;
|
|
@@ -5,11 +6,23 @@ type PgAdapterLike = {
|
|
|
5
6
|
run(sql: string, ...params: unknown[]): Promise<unknown>;
|
|
6
7
|
close?: () => Promise<void>;
|
|
7
8
|
};
|
|
9
|
+
export interface PgConnectionOptions {
|
|
10
|
+
ssl?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Adapt a vendored storage-kit `TypedQueryClient` (which speaks `$1` positional
|
|
14
|
+
* params) to the `?`-placeholder `PgAdapterLike` the store queries are written
|
|
15
|
+
* against. This lets `shortlinks-serve` reuse the exact same SQL as the CLI while
|
|
16
|
+
* opening its cloud pool through the sanctioned kit (`createCloudPoolFromEnv`).
|
|
17
|
+
*/
|
|
18
|
+
export declare function createKitPgAdapter(client: TypedQueryClient): PgAdapterLike;
|
|
8
19
|
export declare class PgShortlinksStore {
|
|
9
20
|
private readonly pg;
|
|
10
21
|
constructor(pg: PgAdapterLike);
|
|
11
|
-
static fromConnectionString(connectionString: string): Promise<PgShortlinksStore>;
|
|
12
|
-
|
|
22
|
+
static fromConnectionString(connectionString: string, options?: PgConnectionOptions): Promise<PgShortlinksStore>;
|
|
23
|
+
/** Build a store over a vendored storage-kit query client (the serve path). */
|
|
24
|
+
static fromQueryClient(client: TypedQueryClient): PgShortlinksStore;
|
|
25
|
+
static fromEnv(env?: NodeJS.ProcessEnv): Promise<PgShortlinksStore>;
|
|
13
26
|
close(): Promise<void>;
|
|
14
27
|
addDomain(input: AddDomainInput): Promise<Domain>;
|
|
15
28
|
listDomains(): Promise<Domain[]>;
|
|
@@ -35,4 +48,9 @@ export declare class PgShortlinksStore {
|
|
|
35
48
|
private hashIp;
|
|
36
49
|
private generateAvailableSlug;
|
|
37
50
|
}
|
|
51
|
+
export declare function applyPostgresMigrations(connectionString: string, migrations: string[], options?: PgConnectionOptions): Promise<{
|
|
52
|
+
service: "shortlinks";
|
|
53
|
+
applied: number[];
|
|
54
|
+
skipped: number[];
|
|
55
|
+
}>;
|
|
38
56
|
export {};
|