oblien 2.2.37 → 2.2.38
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 +2 -0
- package/dist/cdn.d.ts +105 -0
- package/dist/cdn.d.ts.map +1 -0
- package/dist/cdn.js +201 -0
- package/dist/cdn.js.map +1 -0
- package/dist/cli/commands/cdn.d.ts +3 -0
- package/dist/cli/commands/cdn.d.ts.map +1 -0
- package/dist/cli/commands/cdn.js +216 -0
- package/dist/cli/commands/cdn.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +17 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +113 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/tunnel.d.ts +1 -0
- package/dist/cli/commands/tunnel.d.ts.map +1 -1
- package/dist/cli/commands/tunnel.js +100 -3
- package/dist/cli/commands/tunnel.js.map +1 -1
- package/dist/cli/index.js +14 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/client.d.ts +5 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +48 -0
- package/dist/mcp/tools.js.map +1 -1
- package/dist/runtime/proxy.d.ts +55 -0
- package/dist/runtime/proxy.d.ts.map +1 -0
- package/dist/runtime/proxy.js +79 -0
- package/dist/runtime/proxy.js.map +1 -0
- package/dist/runtime.d.ts +16 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +18 -0
- package/dist/runtime.js.map +1 -1
- package/dist/server/static.d.ts +81 -0
- package/dist/server/static.d.ts.map +1 -0
- package/dist/server/static.js +465 -0
- package/dist/server/static.js.map +1 -0
- package/dist/types/cdn.d.ts +301 -0
- package/dist/types/cdn.d.ts.map +1 -0
- package/dist/types/cdn.js +10 -0
- package/dist/types/cdn.js.map +1 -0
- package/dist/types/client.d.ts +10 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/docs/cdn.md +119 -0
- package/docs/runtime.md +30 -0
- package/docs/serve.md +84 -0
- package/package.json +1 -1
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/** Scope of a CDN access token. */
|
|
2
|
+
export type CdnTokenScope = 'user' | 'admin';
|
|
3
|
+
/** A logged CDN file record (API plane). */
|
|
4
|
+
export interface CdnFile {
|
|
5
|
+
id: number;
|
|
6
|
+
user_id: string;
|
|
7
|
+
/** Namespace slug this file belongs to, or null for unnamespaced files. */
|
|
8
|
+
namespace?: string | null;
|
|
9
|
+
filename: string;
|
|
10
|
+
original_filename?: string | null;
|
|
11
|
+
original_url?: string | null;
|
|
12
|
+
file_path: string;
|
|
13
|
+
cdn_url: string;
|
|
14
|
+
size: number;
|
|
15
|
+
mime_type: string;
|
|
16
|
+
variants: unknown[];
|
|
17
|
+
metadata: Record<string, unknown>;
|
|
18
|
+
upload_type: 'upload' | 'url';
|
|
19
|
+
is_deleted: boolean;
|
|
20
|
+
deleted_at?: string | null;
|
|
21
|
+
created_at: string;
|
|
22
|
+
updated_at: string;
|
|
23
|
+
}
|
|
24
|
+
/** A single image-variant spec. Provide at least a width or a height. */
|
|
25
|
+
export interface CdnVariantSpec {
|
|
26
|
+
width?: number;
|
|
27
|
+
height?: number;
|
|
28
|
+
fit?: 'cover' | 'contain' | 'fill' | 'inside' | 'outside';
|
|
29
|
+
quality?: number;
|
|
30
|
+
blur?: number;
|
|
31
|
+
format?: 'jpeg' | 'png' | 'webp';
|
|
32
|
+
withoutEnlargement?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Per-request CDN options, carried in the permit `metadata`. The CDN has no
|
|
36
|
+
* server presets — the client chooses exactly which variants to generate for
|
|
37
|
+
* this upload. Omit `variantNames` to get the node's default set; pass
|
|
38
|
+
* `variantNames: []` to skip variants (original only).
|
|
39
|
+
*/
|
|
40
|
+
export interface CdnVariantOptions {
|
|
41
|
+
/** Variant names to generate for this upload. */
|
|
42
|
+
variantNames?: string[];
|
|
43
|
+
/** Per-variant specs keyed by name (usually the same names as `variantNames`). */
|
|
44
|
+
customVariants?: Record<string, CdnVariantSpec>;
|
|
45
|
+
/** Keep the uploaded original (default true). */
|
|
46
|
+
keepOriginal?: boolean;
|
|
47
|
+
/** Which produced variant becomes the top-level `url` (default 'full'). */
|
|
48
|
+
primary?: string;
|
|
49
|
+
/** Re-encode a large original in place. */
|
|
50
|
+
optimizeOriginal?: {
|
|
51
|
+
maxBytes?: number;
|
|
52
|
+
quality?: number;
|
|
53
|
+
format?: 'jpeg' | 'png' | 'webp';
|
|
54
|
+
};
|
|
55
|
+
/** Auto-delete this upload after N seconds (node-owned TTL). */
|
|
56
|
+
ttl?: number;
|
|
57
|
+
/** Auto-delete at this epoch time (seconds or ms). */
|
|
58
|
+
expireAt?: number;
|
|
59
|
+
/** Lower the per-file byte cap for this upload (can only lower it). */
|
|
60
|
+
maxBytes?: number;
|
|
61
|
+
/** Any additional opaque metadata the API stores and echoes back. */
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
}
|
|
64
|
+
export interface CdnTokenParams {
|
|
65
|
+
/**
|
|
66
|
+
* Namespace slug to bind the token (and the uploads it authorizes) to.
|
|
67
|
+
* Namespace-scoped API keys are always forced to their own namespace;
|
|
68
|
+
* admin keys may target any namespace or omit it.
|
|
69
|
+
*/
|
|
70
|
+
namespace?: string;
|
|
71
|
+
/**
|
|
72
|
+
* CDN processing directives (variant plan + TTL/maxBytes) — issued into the
|
|
73
|
+
* permit by the API at mint time and read by the edge from there, never sent
|
|
74
|
+
* on the upload request. See {@link CdnVariantOptions}.
|
|
75
|
+
*/
|
|
76
|
+
variants?: CdnVariantOptions;
|
|
77
|
+
/**
|
|
78
|
+
* Opaque customer metadata: stored with each file and echoed back, never
|
|
79
|
+
* interpreted for processing. (Variant directives go in `variants`.)
|
|
80
|
+
*/
|
|
81
|
+
metadata?: Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
export interface CdnTokenResponse {
|
|
84
|
+
success: boolean;
|
|
85
|
+
/** Short-lived (1 minute) CDN JWT — pass as `Bearer <token>` to the edge. */
|
|
86
|
+
token: string;
|
|
87
|
+
scope: CdnTokenScope;
|
|
88
|
+
permissions: string[];
|
|
89
|
+
/** Namespace the token is bound to, or null. */
|
|
90
|
+
namespace: string | null;
|
|
91
|
+
expiresIn: string;
|
|
92
|
+
message?: string;
|
|
93
|
+
}
|
|
94
|
+
/** A file to upload: its bytes plus a filename and optional content type. */
|
|
95
|
+
export interface CdnUploadInput {
|
|
96
|
+
data: Blob | Buffer | Uint8Array | ArrayBuffer;
|
|
97
|
+
filename: string;
|
|
98
|
+
/** MIME type — defaults to `application/octet-stream` if omitted. */
|
|
99
|
+
contentType?: string;
|
|
100
|
+
}
|
|
101
|
+
export interface CdnUploadParams {
|
|
102
|
+
/** Namespace to attribute the upload to (used to mint the token). */
|
|
103
|
+
namespace?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Reuse a CDN token you already minted (e.g. via {@link CdnTokenResponse}).
|
|
106
|
+
* When omitted, `upload` mints a fresh user token automatically.
|
|
107
|
+
*/
|
|
108
|
+
token?: string;
|
|
109
|
+
/**
|
|
110
|
+
* CDN processing directives (variant plan + TTL/maxBytes) for this upload.
|
|
111
|
+
* Applied only when a token is auto-minted — ignored if you pass your own
|
|
112
|
+
* `token` (bake them in at mint time instead). See {@link CdnVariantOptions}.
|
|
113
|
+
*/
|
|
114
|
+
variants?: CdnVariantOptions;
|
|
115
|
+
/** Opaque customer metadata (stored + echoed, never interpreted). */
|
|
116
|
+
metadata?: Record<string, unknown>;
|
|
117
|
+
}
|
|
118
|
+
export interface CdnUploadVariant {
|
|
119
|
+
variant: string;
|
|
120
|
+
url: string;
|
|
121
|
+
}
|
|
122
|
+
export interface CdnUploadResponse {
|
|
123
|
+
success: boolean;
|
|
124
|
+
/** The node's uuid for this file (also the API record's node_file_id). */
|
|
125
|
+
file_id: string;
|
|
126
|
+
url: string;
|
|
127
|
+
filename: string;
|
|
128
|
+
size: number;
|
|
129
|
+
mime: string;
|
|
130
|
+
variants: CdnUploadVariant[];
|
|
131
|
+
/** Whether the record was durably queued to the API for recording. */
|
|
132
|
+
recorded: boolean;
|
|
133
|
+
/** Present when the upload has a TTL. */
|
|
134
|
+
expires_at?: string | number;
|
|
135
|
+
}
|
|
136
|
+
export interface CdnUploadManyResponse {
|
|
137
|
+
success: boolean;
|
|
138
|
+
files: Array<{
|
|
139
|
+
file_id: string;
|
|
140
|
+
originalFilename?: string;
|
|
141
|
+
url: string;
|
|
142
|
+
filename: string;
|
|
143
|
+
size: number;
|
|
144
|
+
mime: string;
|
|
145
|
+
variants: CdnUploadVariant[];
|
|
146
|
+
expires_at?: string | number;
|
|
147
|
+
}>;
|
|
148
|
+
invalidFiles?: Array<{
|
|
149
|
+
originalFilename: string;
|
|
150
|
+
error: string;
|
|
151
|
+
}>;
|
|
152
|
+
totalCount: number;
|
|
153
|
+
recorded: boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface CdnProcessUrlsParams {
|
|
156
|
+
urls: string[];
|
|
157
|
+
maxBatch?: number;
|
|
158
|
+
concurrency?: number;
|
|
159
|
+
/** Namespace to attribute the processed files to. */
|
|
160
|
+
namespace?: string;
|
|
161
|
+
/** Reuse a minted CDN token instead of auto-minting one. */
|
|
162
|
+
token?: string;
|
|
163
|
+
/**
|
|
164
|
+
* CDN processing directives (baked into the minted token). Applied only when
|
|
165
|
+
* a token is auto-minted. See {@link CdnVariantOptions}.
|
|
166
|
+
*/
|
|
167
|
+
variants?: CdnVariantOptions;
|
|
168
|
+
/** Opaque customer metadata (stored + echoed, never interpreted). */
|
|
169
|
+
metadata?: Record<string, unknown>;
|
|
170
|
+
}
|
|
171
|
+
export interface CdnProcessUrlsResponse {
|
|
172
|
+
success: boolean;
|
|
173
|
+
files: Array<{
|
|
174
|
+
file_id: string;
|
|
175
|
+
originalUrl?: string;
|
|
176
|
+
url: string;
|
|
177
|
+
filename: string;
|
|
178
|
+
size: number;
|
|
179
|
+
mime: string;
|
|
180
|
+
variants: CdnUploadVariant[];
|
|
181
|
+
expires_at?: string | number;
|
|
182
|
+
}>;
|
|
183
|
+
errors?: Array<{
|
|
184
|
+
url: string;
|
|
185
|
+
error: string;
|
|
186
|
+
index?: number;
|
|
187
|
+
}>;
|
|
188
|
+
totalProcessed: number;
|
|
189
|
+
totalErrors: number;
|
|
190
|
+
recorded: boolean;
|
|
191
|
+
}
|
|
192
|
+
export interface CdnLimitsResponse {
|
|
193
|
+
limits: Record<string, number>;
|
|
194
|
+
totalLimit: number;
|
|
195
|
+
maxFiles: number;
|
|
196
|
+
}
|
|
197
|
+
export interface CdnVariantOptionsResponse {
|
|
198
|
+
success: boolean;
|
|
199
|
+
/** The variant set applied when a request specifies none. */
|
|
200
|
+
defaultVariants: Record<string, unknown>;
|
|
201
|
+
/** Schema for the per-request `customVariants` a client may send. */
|
|
202
|
+
customVariantSchema: Record<string, unknown>;
|
|
203
|
+
}
|
|
204
|
+
export interface CdnListParams {
|
|
205
|
+
page?: number;
|
|
206
|
+
limit?: number;
|
|
207
|
+
/** Filter to a single namespace (namespace keys are pinned to their own). */
|
|
208
|
+
namespace?: string;
|
|
209
|
+
include_deleted?: boolean;
|
|
210
|
+
upload_type?: 'upload' | 'url';
|
|
211
|
+
sort_by?: 'created_at' | 'size' | 'filename';
|
|
212
|
+
sort_order?: 'ASC' | 'DESC';
|
|
213
|
+
}
|
|
214
|
+
export interface CdnPagination {
|
|
215
|
+
page: number;
|
|
216
|
+
limit: number;
|
|
217
|
+
total: number;
|
|
218
|
+
totalPages: number;
|
|
219
|
+
hasMore: boolean;
|
|
220
|
+
}
|
|
221
|
+
export interface CdnListResponse {
|
|
222
|
+
success: boolean;
|
|
223
|
+
data: {
|
|
224
|
+
files: CdnFile[];
|
|
225
|
+
pagination: CdnPagination;
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
export interface CdnStatsParams {
|
|
229
|
+
/** Restrict the stats to a single namespace. */
|
|
230
|
+
namespace?: string;
|
|
231
|
+
}
|
|
232
|
+
export interface CdnStats {
|
|
233
|
+
totalFiles: number;
|
|
234
|
+
totalSize: number;
|
|
235
|
+
activeFiles: number;
|
|
236
|
+
activeSize: number;
|
|
237
|
+
uploadedFiles: number;
|
|
238
|
+
urlFiles: number;
|
|
239
|
+
}
|
|
240
|
+
export interface CdnStatsResponse {
|
|
241
|
+
success: boolean;
|
|
242
|
+
data: CdnStats;
|
|
243
|
+
}
|
|
244
|
+
export interface CdnUsageParams {
|
|
245
|
+
/** Restrict to a single namespace (namespace keys are pinned to their own). */
|
|
246
|
+
namespace?: string;
|
|
247
|
+
/** Month to report ingest for, 'YYYY-MM'. Defaults to the current month. */
|
|
248
|
+
period?: string;
|
|
249
|
+
}
|
|
250
|
+
export interface CdnUsageResponse {
|
|
251
|
+
success: boolean;
|
|
252
|
+
data: {
|
|
253
|
+
namespace: string | null;
|
|
254
|
+
period: string;
|
|
255
|
+
/** Bytes/files UPLOADED in the month (counts even if later deleted). */
|
|
256
|
+
ingest: {
|
|
257
|
+
bytes: number;
|
|
258
|
+
files: number;
|
|
259
|
+
};
|
|
260
|
+
/** Current live footprint (original + variants). */
|
|
261
|
+
active: {
|
|
262
|
+
bytes: number;
|
|
263
|
+
files: number;
|
|
264
|
+
};
|
|
265
|
+
/** Configured caps (present when scoped to one namespace). */
|
|
266
|
+
limits?: {
|
|
267
|
+
cdn_max_bytes: number | null;
|
|
268
|
+
cdn_monthly_bytes: number | null;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
export interface CdnUsageSeriesParams {
|
|
273
|
+
namespace?: string;
|
|
274
|
+
/** Bucket size. Default 'day'. */
|
|
275
|
+
interval?: 'day' | 'month';
|
|
276
|
+
/** Number of days back (interval 'day', default 30, max 366). */
|
|
277
|
+
days?: number;
|
|
278
|
+
/** Number of months back (interval 'month', default 12, max 120). */
|
|
279
|
+
months?: number;
|
|
280
|
+
}
|
|
281
|
+
export interface CdnUsageSeriesResponse {
|
|
282
|
+
success: boolean;
|
|
283
|
+
data: {
|
|
284
|
+
namespace: string | null;
|
|
285
|
+
interval: 'day' | 'month';
|
|
286
|
+
from: string;
|
|
287
|
+
to: string;
|
|
288
|
+
/** Zero-filled ingest per bucket, oldest → newest. */
|
|
289
|
+
series: Array<{
|
|
290
|
+
bucket: string;
|
|
291
|
+
bytes: number;
|
|
292
|
+
files: number;
|
|
293
|
+
}>;
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
export interface CdnFileResponse {
|
|
297
|
+
success: boolean;
|
|
298
|
+
data: CdnFile;
|
|
299
|
+
error?: string;
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=cdn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../../src/types/cdn.ts"],"names":[],"mappings":"AASA,mCAAmC;AACnC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7C,4CAA4C;AAC5C,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAA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;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;QACzC,8DAA8D;QAC9D,MAAM,CAAC,EAAE;YAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;YAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAC;KAC7E,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IAC3B,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,QAAQ,EAAE,KAAK,GAAG,OAAO,CAAC;QAC1B,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,sDAAsD;QACtD,MAAM,EAAE,KAAK,CAAC;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACjE,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// ── CDN ──────────────────────────────────────────────────────────────
|
|
2
|
+
//
|
|
3
|
+
// The CDN has two planes:
|
|
4
|
+
// • API plane (api.oblien.com/cdn/*) — mint tokens, list/stat/manage files
|
|
5
|
+
// • Edge plane (cdn.oblien.com/api/*) — upload files with a minted token
|
|
6
|
+
//
|
|
7
|
+
// Every params interface accepts an optional `namespace` so uploads and
|
|
8
|
+
// listings can be scoped to a namespace, mirroring the rest of the SDK.
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=cdn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn.js","sourceRoot":"","sources":["../../src/types/cdn.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,0BAA0B;AAC1B,+EAA+E;AAC/E,4EAA4E;AAC5E,EAAE;AACF,wEAAwE;AACxE,wEAAwE"}
|
package/dist/types/client.d.ts
CHANGED
|
@@ -4,10 +4,20 @@ export interface OblienApiKeyOptions {
|
|
|
4
4
|
clientSecret: string;
|
|
5
5
|
/** @default 'https://api.oblien.com' */
|
|
6
6
|
baseUrl?: string;
|
|
7
|
+
/**
|
|
8
|
+
* CDN edge base URL (including the `/api` mount) that uploads are sent to.
|
|
9
|
+
* @default 'https://cdn.oblien.com/api'
|
|
10
|
+
*/
|
|
11
|
+
cdnBaseUrl?: string;
|
|
7
12
|
}
|
|
8
13
|
export interface OblienTokenOptions {
|
|
9
14
|
token: string;
|
|
10
15
|
/** @default 'https://api.oblien.com' */
|
|
11
16
|
baseUrl?: string;
|
|
17
|
+
/**
|
|
18
|
+
* CDN edge base URL (including the `/api` mount) that uploads are sent to.
|
|
19
|
+
* @default 'https://cdn.oblien.com/api'
|
|
20
|
+
*/
|
|
21
|
+
cdnBaseUrl?: string;
|
|
12
22
|
}
|
|
13
23
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAErE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAErE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export type { TokenScope, TokenCreateParams, TokenCreateResponse, } from './toke
|
|
|
13
13
|
export type { PushPlatform, PushDeviceStatus, PushTokenStatus, PushDevice, RegisterDeviceParams, PushDeviceListResponse, WorkspacePushToken, CreatedWorkspacePushToken, CreatePushTokenParams, PushTokenListResponse, SendNotificationParams, SendNotificationResponse, } from './notifications.js';
|
|
14
14
|
export type { WebhookEvent, Webhook, WebhookCreateParams, WebhookUpdateParams, WebhookListParams, WebhookListResponse, WebhookEventsResponse, } from './webhooks.js';
|
|
15
15
|
export type { AnalyticsOverview, AnalyticsDomainSummary, AnalyticsHomeSummary, AnalyticsBucket, AnalyticsTimeseriesParams, AnalyticsTimeseriesResponse, AnalyticsGeoEntry, AnalyticsGeoParams, AnalyticsGeoResponse, AnalyticsRequestEntry, AnalyticsRequestsParams, AnalyticsRequestsResponse, AnalyticsStreamTokenResponse, } from './analytics.js';
|
|
16
|
+
export type { CdnTokenScope, CdnFile, CdnTokenParams, CdnTokenResponse, CdnUploadInput, CdnUploadParams, CdnUploadVariant, CdnUploadResponse, CdnUploadManyResponse, CdnProcessUrlsParams, CdnProcessUrlsResponse, CdnLimitsResponse, CdnVariantOptionsResponse, CdnListParams, CdnPagination, CdnListResponse, CdnStatsParams, CdnStats, CdnStatsResponse, CdnFileResponse, } from './cdn.js';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3E,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGlE,YAAY,EACV,cAAc,EACd,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EAEnB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,cAAc,EAEd,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,SAAS,EACT,eAAe,EACf,mBAAmB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pB,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACrB,8BAA8B,EAC9B,gCAAgC,EAChC,iCAAiC,GAClC,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,2BAA2B,EAC3B,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,YAAY,EACZ,OAAO,EACP,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qB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,CAAC;AAGrB,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,YAAY,EACZ,OAAO,EACP,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,aAAa,EACb,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,eAAe,GAChB,MAAM,UAAU,CAAC"}
|
package/docs/cdn.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# CDN
|
|
2
|
+
|
|
3
|
+
Upload files to the Oblien CDN and manage what you've stored. The CDN spans two planes: the **API plane** (`api.oblien.com/cdn/*`) mints short-lived tokens and lists/manages logged files, and the **edge plane** (`cdn.oblien.com`) receives the actual uploads. `client.cdn.upload()` handles both — it mints a token and posts the file for you.
|
|
4
|
+
|
|
5
|
+
Everything is **namespace-aware**: pass `namespace` to scope a token, upload, or listing. Namespace-scoped API keys are automatically pinned to their own namespace by the server; admin keys may target any namespace or omit it (seeing all of their files).
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { readFileSync } from 'node:fs';
|
|
9
|
+
|
|
10
|
+
// One-shot upload (mints a namespace-bound token, then uploads to the edge)
|
|
11
|
+
const { url } = await client.cdn.upload(
|
|
12
|
+
{ data: readFileSync('./logo.png'), filename: 'logo.png', contentType: 'image/png' },
|
|
13
|
+
{ namespace: 'tenant-a' },
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
// Choose exactly which variants to generate for THIS upload (no presets).
|
|
17
|
+
// `variants` are API-issued into the token; `metadata` is opaque customer data.
|
|
18
|
+
const res = await client.cdn.upload(
|
|
19
|
+
{ data: readFileSync('./avatar.png'), filename: 'avatar.png', contentType: 'image/png' },
|
|
20
|
+
{
|
|
21
|
+
namespace: 'tenant-a',
|
|
22
|
+
variants: {
|
|
23
|
+
variantNames: ['large', 'small'],
|
|
24
|
+
customVariants: {
|
|
25
|
+
large: { width: 400, height: 400, fit: 'cover', quality: 90, format: 'jpeg' },
|
|
26
|
+
small: { width: 50, height: 50, fit: 'cover' },
|
|
27
|
+
},
|
|
28
|
+
keepOriginal: false,
|
|
29
|
+
primary: 'large',
|
|
30
|
+
ttl: 3600, // auto-delete after 1h (optional)
|
|
31
|
+
},
|
|
32
|
+
metadata: { userId: 'u_123', purpose: 'avatar' }, // opaque, echoed back
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
// res.variants → [{ variant: 'large', url }, { variant: 'small', url }]
|
|
36
|
+
|
|
37
|
+
// Mint a token yourself (e.g. to hand to a browser uploader) — the variants are
|
|
38
|
+
// baked into the permit at mint time, since the edge reads them from there
|
|
39
|
+
const { token } = await client.cdn.token({
|
|
40
|
+
namespace: 'tenant-a',
|
|
41
|
+
variants: { variantNames: ['thumb'], customVariants: { thumb: { width: 150, height: 150 } } },
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// List / stats, scoped to a namespace
|
|
45
|
+
const { data } = await client.cdn.list({ namespace: 'tenant-a', limit: 20 });
|
|
46
|
+
await client.cdn.stats({ namespace: 'tenant-a' });
|
|
47
|
+
|
|
48
|
+
// Manage a single file
|
|
49
|
+
await client.cdn.get(fileId);
|
|
50
|
+
await client.cdn.delete(fileId); // soft delete
|
|
51
|
+
await client.cdn.restore(fileId);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Methods
|
|
55
|
+
|
|
56
|
+
| Method | Plane | Description |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| `cdn.token({ namespace?, variants?, metadata? })` | API | Mint a USER-scope token (upload + process), valid 1 minute |
|
|
59
|
+
| `cdn.adminToken({ namespace?, variants?, metadata? })` | API | Mint an ADMIN-scope token (full edge access; admin keys only) |
|
|
60
|
+
| `cdn.upload(file, { namespace?, token?, variants?, metadata? })` | edge | Upload one file (auto-mints a token unless one is passed) |
|
|
61
|
+
| `cdn.uploadMany(files, { namespace?, token?, variants?, metadata? })` | edge | Upload several files in one request |
|
|
62
|
+
| `cdn.processUrls({ urls, namespace?, variants?, metadata?, … })` | edge | Ingest and process files from remote URLs |
|
|
63
|
+
| `cdn.getLimits()` / `cdn.getVariantOptions()` | edge | Edge upload limits / default variants + custom-variant schema |
|
|
64
|
+
| `cdn.list({ namespace?, … })` | API | List logged files with pagination |
|
|
65
|
+
| `cdn.stats({ namespace? })` | API | All-time storage statistics |
|
|
66
|
+
| `cdn.usage({ namespace?, period? })` | API | Month usage (ingest + active) + caps |
|
|
67
|
+
| `cdn.usageSeries({ namespace?, interval?, days?, months? })` | API | Windowed ingest series for charts |
|
|
68
|
+
| `cdn.get(fileId)` | API | Fetch a single logged file |
|
|
69
|
+
| `cdn.delete(fileId)` / `cdn.restore(fileId)` | API | Soft-delete / restore a file |
|
|
70
|
+
|
|
71
|
+
A `file` is `{ data, filename, contentType? }` where `data` is a `Blob`, `Buffer`, `Uint8Array`, or `ArrayBuffer`.
|
|
72
|
+
|
|
73
|
+
## Variants (API-issued, per request)
|
|
74
|
+
|
|
75
|
+
There are **no server-side presets**. Each upload decides exactly which variants
|
|
76
|
+
to generate via the dedicated **`variants`** field on the token/upload call
|
|
77
|
+
(distinct from opaque `metadata`). Options (all optional):
|
|
78
|
+
|
|
79
|
+
| Field | Meaning |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `variantNames: string[]` | Which variants to produce. Omit → the node's default set; `[]` → original only. |
|
|
82
|
+
| `customVariants: { [name]: spec }` | Per-variant `spec`: `{ width?, height?, fit?, quality?, blur?, format?, withoutEnlargement? }` (provide width and/or height). |
|
|
83
|
+
| `keepOriginal: boolean` | Keep the uploaded original (default `true`). |
|
|
84
|
+
| `primary: string` | Which produced variant is the top-level `url` (default `'full'`). |
|
|
85
|
+
| `optimizeOriginal: { maxBytes?, quality?, format? }` | Re-encode a large original in place. |
|
|
86
|
+
| `ttl: number` / `expireAt: number` | Auto-delete after N seconds / at an epoch time (the node deletes it and reports back). |
|
|
87
|
+
| `maxBytes: number` | Lower the per-file size cap for this upload. |
|
|
88
|
+
|
|
89
|
+
`variants` is baked into the short-lived token at mint time (the edge reads it
|
|
90
|
+
from the permit), so it applies whether you call `upload()` directly or mint a
|
|
91
|
+
token yourself and hand it to a browser. When you pass your own `token`, set the
|
|
92
|
+
options at the time you minted it — `upload({ token })` ignores `variants`.
|
|
93
|
+
|
|
94
|
+
`metadata` is separate: opaque customer key/values the API stores with each file
|
|
95
|
+
and echoes back, never interpreted for processing.
|
|
96
|
+
|
|
97
|
+
`cdn.getVariantOptions()` returns the current `defaultVariants` set and the
|
|
98
|
+
`customVariantSchema` (field bounds) for discovery.
|
|
99
|
+
|
|
100
|
+
## Configuration
|
|
101
|
+
|
|
102
|
+
Uploads target `https://cdn.oblien.com/api` by default. Override it (e.g. for local development against the CDN service directly) with `cdnBaseUrl`:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const client = new Oblien({ clientId, clientSecret, cdnBaseUrl: 'http://localhost:3240' });
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## CLI
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
oblien cdn upload ./logo.png --namespace tenant-a
|
|
112
|
+
oblien cdn upload ./logo.png --namespace tenant-a --names thumb,medium
|
|
113
|
+
oblien cdn upload ./a.png --variants '{"variantNames":["sq"],"customVariants":{"sq":{"width":200,"height":200}}}'
|
|
114
|
+
oblien cdn upload ./tmp.png --ttl 3600 --meta '{"orderId":"abc123"}' # ttl + opaque metadata
|
|
115
|
+
oblien cdn list --namespace tenant-a --json
|
|
116
|
+
oblien cdn stats --namespace tenant-a
|
|
117
|
+
oblien cdn token --namespace tenant-a --names thumb
|
|
118
|
+
oblien cdn delete 42
|
|
119
|
+
```
|
package/docs/runtime.md
CHANGED
|
@@ -21,6 +21,7 @@ This enables the Runtime API server (if needed), fetches a gateway JWT, and retu
|
|
|
21
21
|
| `rt.search` | Content search (ripgrep) + filename search |
|
|
22
22
|
| `rt.watcher` | Watch directories for real-time file-change events |
|
|
23
23
|
| `rt.ws()` | WebSocket — persistent connection for terminal I/O and watcher events |
|
|
24
|
+
| `rt.proxy(port)` | Reverse-proxy HTTP/WebSocket to a **loopback** service inside the workspace |
|
|
24
25
|
|
|
25
26
|
## Files
|
|
26
27
|
|
|
@@ -50,4 +51,33 @@ const matches = await rt.search.content({ query: 'handleRequest', path: '/app' }
|
|
|
50
51
|
const files = await rt.search.files({ query: 'controller' });
|
|
51
52
|
```
|
|
52
53
|
|
|
54
|
+
## Proxy
|
|
55
|
+
|
|
56
|
+
Reach an HTTP or WebSocket server running on a **loopback port inside the workspace** (e.g. a dev server on `127.0.0.1:3000`) as if you were talking to it directly. Headers, streaming/SSE, and WebSocket upgrades pass through near-natively. For safety the proxy is **loopback-only** — it cannot reach the VM's private network or the internet.
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
// HTTP — returns a raw fetch Response (status, headers, body/stream)
|
|
60
|
+
const res = await rt.proxy(3000).fetch('/api/users?limit=10');
|
|
61
|
+
const users = await res.json();
|
|
62
|
+
|
|
63
|
+
// POST with a body
|
|
64
|
+
await rt.proxy(3000).fetch('/api/users', {
|
|
65
|
+
method: 'POST',
|
|
66
|
+
headers: { 'content-type': 'application/json' },
|
|
67
|
+
body: JSON.stringify({ name: 'ada' }),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Streaming (SSE) passes through untouched
|
|
71
|
+
const stream = await rt.proxy(8080).fetch('/events');
|
|
72
|
+
for await (const chunk of stream.body!) { /* handle chunk */ }
|
|
73
|
+
|
|
74
|
+
// WebSocket
|
|
75
|
+
const ws = rt.proxy(3000).ws('/socket');
|
|
76
|
+
ws.onmessage = (e) => console.log(e.data);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The runtime connection token is attached automatically (via the `Authorization` header for HTTP, and the `token` query param for WebSocket) and is **stripped before the request reaches the in-VM app**, so it never leaks to your code running inside the workspace.
|
|
80
|
+
|
|
81
|
+
**HTTP transport (advanced).** The SDK calls the runtime endpoint `GET|POST|… /proxy<path>` and selects the target with the `X-Oblien-Proxy-Target: <port>` header. Equivalent forms the runtime also accepts: the `x_oblien_target=<port>` query param (used for WebSocket, since browsers can't set headers), or the path form `/proxy/<port>/<path>`. `token` and `x_oblien_target` are reserved query params and are removed before forwarding.
|
|
82
|
+
|
|
53
83
|
**Full reference:** [Runtime API docs](https://oblien.com/docs/runtime-api)
|
package/docs/serve.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Static server
|
|
2
|
+
|
|
3
|
+
Serve a folder over HTTP and put it on the public internet in one step. The
|
|
4
|
+
server is built entirely on Node's `http`/`fs` — **no extra dependencies** — and
|
|
5
|
+
the CLI wires it straight into the [edge tunnel](./edge-tunnel.md), so a
|
|
6
|
+
directory becomes a public HTTPS URL with a single command.
|
|
7
|
+
|
|
8
|
+
## CLI
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
oblien serve # serve ./public
|
|
12
|
+
oblien serve ./dist # serve ./dist
|
|
13
|
+
oblien serve ./dist --slug my-app # pick the public subdomain
|
|
14
|
+
oblien serve ./build --spa # single-page-app fallback
|
|
15
|
+
oblien serve ./site --domain preview.example.com
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`oblien serve` starts a static server on a loopback port and then forwards it
|
|
19
|
+
through the edge exactly like `oblien tunnel <port>` — so every tunnel flag
|
|
20
|
+
works here too:
|
|
21
|
+
|
|
22
|
+
| Flag | Description |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| `--port <n>` | Local port to serve on (default: an OS-assigned free port) |
|
|
25
|
+
| `--slug <slug>` | Custom subdomain slug for the public URL |
|
|
26
|
+
| `--name <name>` | Tunnel display name (default: the folder name) |
|
|
27
|
+
| `--domain <domain>` | Base domain or exact custom hostname (see [edge-tunnel](./edge-tunnel.md)) |
|
|
28
|
+
| `--expires-in <ttl>` | Tunnel token TTL, e.g. `30s`, `5m`, `1h`, `7d` |
|
|
29
|
+
| `--spa` | Serve `index.html` for any unmatched path (client-side routing) |
|
|
30
|
+
| `--no-listing` | Disable auto-generated directory listings |
|
|
31
|
+
| `--index <file>` | Directory index filename (default: `index.html`) |
|
|
32
|
+
|
|
33
|
+
Press `Ctrl+C` to stop — the tunnel disconnects and the local server shuts down.
|
|
34
|
+
|
|
35
|
+
## What the server handles
|
|
36
|
+
|
|
37
|
+
- **Correct MIME types** for common web, font, image, media, and document extensions.
|
|
38
|
+
- **Streamed responses** (`createReadStream`) — large files never buffer in memory.
|
|
39
|
+
- **`Range` requests** — media seeking / resumable downloads return `206 Partial Content`.
|
|
40
|
+
- **Revalidation** — `ETag` + `Last-Modified` yield `304 Not Modified` on conditional requests.
|
|
41
|
+
- **Directory handling** — serves `index.html`, redirects `/dir` → `/dir/`, and renders a clean listing when there's no index (unless `--no-listing`).
|
|
42
|
+
- **SPA fallback** (`--spa`) — unmatched paths return the root `index.html`.
|
|
43
|
+
- **Path-traversal protection** — requests are resolved against the root; anything escaping it lexically is rejected (`403`), and a file whose canonical path (following symlinks) leaves the root is rejected (`404`).
|
|
44
|
+
- **Dotfiles denied by default** — `.git/`, `.env`, and other dot-paths return `404` (the server is often public), except `.well-known/`. Opt in with `allowDotfiles`.
|
|
45
|
+
|
|
46
|
+
## Programmatic use
|
|
47
|
+
|
|
48
|
+
The same server is exported from the SDK, so you can start it yourself and pair
|
|
49
|
+
it with the [`TunnelClient`](./edge-tunnel.md) or use it standalone:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { startStaticServer } from 'oblien';
|
|
53
|
+
|
|
54
|
+
const site = await startStaticServer({
|
|
55
|
+
root: './public',
|
|
56
|
+
spa: true, // optional: index.html fallback
|
|
57
|
+
// port: 8080, // optional: default is an OS-assigned free port
|
|
58
|
+
// host: '127.0.0.1' // optional: default loopback only
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
console.log(`serving on ${site.url}`); // http://127.0.0.1:<port>
|
|
62
|
+
|
|
63
|
+
// ...later
|
|
64
|
+
await site.close();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`startStaticServer(options)` resolves once the server is listening and returns a
|
|
68
|
+
handle: `{ port, host, url, server, close() }`. The `port` is always resolved —
|
|
69
|
+
even when you omit it and let the OS choose. For finer control, `createStaticServer(options)`
|
|
70
|
+
returns a non-listening `http.Server`, and `createStaticHandler(options)` returns a
|
|
71
|
+
raw `(req, res)` handler you can mount on your own server.
|
|
72
|
+
|
|
73
|
+
### Options
|
|
74
|
+
|
|
75
|
+
| Option | Type | Default | Description |
|
|
76
|
+
| --- | --- | --- | --- |
|
|
77
|
+
| `root` | `string` | — | Directory to serve (resolved against cwd) |
|
|
78
|
+
| `host` | `string` | `127.0.0.1` | Interface to bind |
|
|
79
|
+
| `port` | `number` | `0` (auto) | Port to listen on |
|
|
80
|
+
| `index` | `string` | `index.html` | Directory index filename |
|
|
81
|
+
| `listing` | `boolean` | `true` | Render a listing when a directory has no index |
|
|
82
|
+
| `spa` | `boolean` | `false` | Serve the root index for unmatched paths |
|
|
83
|
+
| `allowDotfiles` | `boolean` | `false` | Serve dotfiles/dot-directories (`.well-known/` is always allowed) |
|
|
84
|
+
| `onRequest` | `(info) => void` | — | Per-request hook: `{ method, path, status }` |
|