@zlayer/sdk 0.8.0
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/.eslintrc.json +35 -0
- package/.prettierrc +10 -0
- package/README.md +132 -0
- package/dist/index.d.ts +1005 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1227 -0
- package/dist/index.js.map +1 -0
- package/examples/.gitkeep +0 -0
- package/package.json +42 -0
- package/src/index.ts +1565 -0
- package/tsconfig.json +19 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1005 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZLayer SDK for building WASM plugins in TypeScript.
|
|
3
|
+
*
|
|
4
|
+
* This module provides helper functions that wrap the generated WIT bindings
|
|
5
|
+
* for easier access to ZLayer host capabilities including configuration,
|
|
6
|
+
* key-value storage, logging, secrets, and metrics.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The current version of the ZLayer SDK.
|
|
12
|
+
*/
|
|
13
|
+
export declare const VERSION = "0.1.0";
|
|
14
|
+
/**
|
|
15
|
+
* Error thrown when configuration operations fail.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ConfigError extends Error {
|
|
18
|
+
/** The configuration key that caused the error */
|
|
19
|
+
readonly key: string;
|
|
20
|
+
constructor(key: string, message: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when key-value storage operations fail.
|
|
24
|
+
*/
|
|
25
|
+
export declare class KVError extends Error {
|
|
26
|
+
/** The key that caused the error */
|
|
27
|
+
readonly key: string;
|
|
28
|
+
/** The bucket where the error occurred */
|
|
29
|
+
readonly bucket: string;
|
|
30
|
+
/** The error code from the host */
|
|
31
|
+
readonly code: KVErrorCode;
|
|
32
|
+
constructor(bucket: string, key: string, code: KVErrorCode, message: string);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Error codes for key-value operations.
|
|
36
|
+
*/
|
|
37
|
+
export declare enum KVErrorCode {
|
|
38
|
+
/** Key not found */
|
|
39
|
+
NotFound = "not_found",
|
|
40
|
+
/** Value too large */
|
|
41
|
+
ValueTooLarge = "value_too_large",
|
|
42
|
+
/** Storage quota exceeded */
|
|
43
|
+
QuotaExceeded = "quota_exceeded",
|
|
44
|
+
/** Key format invalid */
|
|
45
|
+
InvalidKey = "invalid_key",
|
|
46
|
+
/** Generic storage error */
|
|
47
|
+
Storage = "storage"
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Error thrown when secret operations fail.
|
|
51
|
+
*/
|
|
52
|
+
export declare class SecretError extends Error {
|
|
53
|
+
/** The secret name that caused the error */
|
|
54
|
+
readonly secretName: string;
|
|
55
|
+
constructor(secretName: string, message: string);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Error thrown when a required value is missing.
|
|
59
|
+
*/
|
|
60
|
+
export declare class NotFoundError extends Error {
|
|
61
|
+
/** The identifier that was not found */
|
|
62
|
+
readonly identifier: string;
|
|
63
|
+
constructor(identifier: string, message: string);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Log severity levels matching the WIT interface.
|
|
67
|
+
*/
|
|
68
|
+
export declare enum LogLevel {
|
|
69
|
+
/** Finest-grained debugging information */
|
|
70
|
+
Trace = 0,
|
|
71
|
+
/** Debugging information */
|
|
72
|
+
Debug = 1,
|
|
73
|
+
/** Informational messages */
|
|
74
|
+
Info = 2,
|
|
75
|
+
/** Warning messages */
|
|
76
|
+
Warn = 3,
|
|
77
|
+
/** Error messages */
|
|
78
|
+
Error = 4
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A key-value pair used throughout the SDK.
|
|
82
|
+
*/
|
|
83
|
+
export interface KeyValue {
|
|
84
|
+
key: string;
|
|
85
|
+
value: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* HTTP methods supported by the plugin system.
|
|
89
|
+
*/
|
|
90
|
+
export declare enum HttpMethod {
|
|
91
|
+
Get = "GET",
|
|
92
|
+
Post = "POST",
|
|
93
|
+
Put = "PUT",
|
|
94
|
+
Delete = "DELETE",
|
|
95
|
+
Patch = "PATCH",
|
|
96
|
+
Head = "HEAD",
|
|
97
|
+
Options = "OPTIONS",
|
|
98
|
+
Connect = "CONNECT",
|
|
99
|
+
Trace = "TRACE"
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Semantic version representation.
|
|
103
|
+
*/
|
|
104
|
+
export interface Version {
|
|
105
|
+
major: number;
|
|
106
|
+
minor: number;
|
|
107
|
+
patch: number;
|
|
108
|
+
preRelease?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Plugin information returned by the info() method.
|
|
112
|
+
*/
|
|
113
|
+
export interface PluginInfo {
|
|
114
|
+
/** Unique plugin identifier (e.g., "zlayer:auth-jwt") */
|
|
115
|
+
id: string;
|
|
116
|
+
/** Human-readable name */
|
|
117
|
+
name: string;
|
|
118
|
+
/** Plugin version */
|
|
119
|
+
version: Version;
|
|
120
|
+
/** Brief description of plugin functionality */
|
|
121
|
+
description: string;
|
|
122
|
+
/** Plugin author or organization */
|
|
123
|
+
author: string;
|
|
124
|
+
/** License identifier (e.g., "MIT", "Apache-2.0") */
|
|
125
|
+
license?: string;
|
|
126
|
+
/** Homepage or repository URL */
|
|
127
|
+
homepage?: string;
|
|
128
|
+
/** Additional metadata as key-value pairs */
|
|
129
|
+
metadata?: KeyValue[];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Incoming request to be processed by a plugin.
|
|
133
|
+
*/
|
|
134
|
+
export interface PluginRequest {
|
|
135
|
+
/** Unique request identifier for tracing */
|
|
136
|
+
requestId: string;
|
|
137
|
+
/** Request path (e.g., "/api/users/123") */
|
|
138
|
+
path: string;
|
|
139
|
+
/** HTTP method */
|
|
140
|
+
method: HttpMethod;
|
|
141
|
+
/** Query string (without leading ?) */
|
|
142
|
+
query?: string;
|
|
143
|
+
/** Request headers */
|
|
144
|
+
headers: KeyValue[];
|
|
145
|
+
/** Request body as bytes */
|
|
146
|
+
body: Uint8Array;
|
|
147
|
+
/** Request timestamp in nanoseconds since Unix epoch */
|
|
148
|
+
timestamp: bigint;
|
|
149
|
+
/** Additional context from the host */
|
|
150
|
+
context: KeyValue[];
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Plugin response returned to the host.
|
|
154
|
+
*/
|
|
155
|
+
export interface PluginResponse {
|
|
156
|
+
/** HTTP status code (200, 404, 500, etc.) */
|
|
157
|
+
status: number;
|
|
158
|
+
/** Response headers */
|
|
159
|
+
headers: KeyValue[];
|
|
160
|
+
/** Response body */
|
|
161
|
+
body: Uint8Array;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Result of handling a request.
|
|
165
|
+
*/
|
|
166
|
+
export type HandleResult = {
|
|
167
|
+
type: 'response';
|
|
168
|
+
response: PluginResponse;
|
|
169
|
+
} | {
|
|
170
|
+
type: 'passThrough';
|
|
171
|
+
} | {
|
|
172
|
+
type: 'error';
|
|
173
|
+
message: string;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Plugin capabilities that can be requested.
|
|
177
|
+
*/
|
|
178
|
+
export interface Capabilities {
|
|
179
|
+
config?: boolean;
|
|
180
|
+
keyvalue?: boolean;
|
|
181
|
+
logging?: boolean;
|
|
182
|
+
secrets?: boolean;
|
|
183
|
+
metrics?: boolean;
|
|
184
|
+
httpClient?: boolean;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Plugin initialization error types.
|
|
188
|
+
*/
|
|
189
|
+
export type InitError = {
|
|
190
|
+
type: 'configMissing';
|
|
191
|
+
key: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: 'configInvalid';
|
|
194
|
+
key: string;
|
|
195
|
+
} | {
|
|
196
|
+
type: 'capabilityUnavailable';
|
|
197
|
+
capability: string;
|
|
198
|
+
} | {
|
|
199
|
+
type: 'failed';
|
|
200
|
+
message: string;
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Authentication result from an authenticator plugin.
|
|
204
|
+
*/
|
|
205
|
+
export type AuthResult = {
|
|
206
|
+
type: 'authenticated';
|
|
207
|
+
claims: KeyValue[];
|
|
208
|
+
} | {
|
|
209
|
+
type: 'denied';
|
|
210
|
+
reason: string;
|
|
211
|
+
} | {
|
|
212
|
+
type: 'challenge';
|
|
213
|
+
challenge: string;
|
|
214
|
+
} | {
|
|
215
|
+
type: 'skip';
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Rate limit information.
|
|
219
|
+
*/
|
|
220
|
+
export interface RateLimitInfo {
|
|
221
|
+
/** Requests remaining in current window */
|
|
222
|
+
remaining: bigint;
|
|
223
|
+
/** Total limit for the window */
|
|
224
|
+
limit: bigint;
|
|
225
|
+
/** Time until limit resets (nanoseconds) */
|
|
226
|
+
resetAfter: bigint;
|
|
227
|
+
/** Retry after this duration if denied (nanoseconds) */
|
|
228
|
+
retryAfter?: bigint;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Rate limit decision.
|
|
232
|
+
*/
|
|
233
|
+
export type RateLimitResult = {
|
|
234
|
+
type: 'allowed';
|
|
235
|
+
info: RateLimitInfo;
|
|
236
|
+
} | {
|
|
237
|
+
type: 'denied';
|
|
238
|
+
info: RateLimitInfo;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* The main plugin handler interface that plugins must export.
|
|
242
|
+
*/
|
|
243
|
+
export interface ZLayerPlugin {
|
|
244
|
+
/**
|
|
245
|
+
* Initialize the plugin.
|
|
246
|
+
* Called once when the plugin is loaded.
|
|
247
|
+
* @returns Capabilities the plugin requires, or an error
|
|
248
|
+
*/
|
|
249
|
+
init?(): Capabilities | InitError;
|
|
250
|
+
/**
|
|
251
|
+
* Return plugin metadata.
|
|
252
|
+
* Called after successful initialization.
|
|
253
|
+
*/
|
|
254
|
+
info(): PluginInfo;
|
|
255
|
+
/**
|
|
256
|
+
* Handle an incoming request.
|
|
257
|
+
* @param request The incoming request to process
|
|
258
|
+
* @returns The result of handling the request
|
|
259
|
+
*/
|
|
260
|
+
handle(request: PluginRequest): HandleResult;
|
|
261
|
+
/**
|
|
262
|
+
* Graceful shutdown hook.
|
|
263
|
+
* Called when the plugin is being unloaded.
|
|
264
|
+
*/
|
|
265
|
+
shutdown?(): void;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* A simpler plugin interface for stateless transformations.
|
|
269
|
+
*/
|
|
270
|
+
export interface TransformerPlugin {
|
|
271
|
+
/**
|
|
272
|
+
* Transform request headers before forwarding.
|
|
273
|
+
*/
|
|
274
|
+
transformRequestHeaders?(headers: KeyValue[]): KeyValue[];
|
|
275
|
+
/**
|
|
276
|
+
* Transform response headers before returning.
|
|
277
|
+
*/
|
|
278
|
+
transformResponseHeaders?(headers: KeyValue[]): KeyValue[];
|
|
279
|
+
/**
|
|
280
|
+
* Transform request body before forwarding.
|
|
281
|
+
*/
|
|
282
|
+
transformRequestBody?(body: Uint8Array): Uint8Array;
|
|
283
|
+
/**
|
|
284
|
+
* Transform response body before returning.
|
|
285
|
+
*/
|
|
286
|
+
transformResponseBody?(body: Uint8Array): Uint8Array;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Authentication plugin interface.
|
|
290
|
+
*/
|
|
291
|
+
export interface AuthenticatorPlugin {
|
|
292
|
+
/**
|
|
293
|
+
* Authenticate an incoming request.
|
|
294
|
+
* @param request The request to authenticate
|
|
295
|
+
* @returns Authentication result with identity claims on success
|
|
296
|
+
*/
|
|
297
|
+
authenticate(request: PluginRequest): AuthResult;
|
|
298
|
+
/**
|
|
299
|
+
* Validate a token (e.g., JWT, API key).
|
|
300
|
+
* @param token The token to validate
|
|
301
|
+
* @returns Claims if valid
|
|
302
|
+
* @throws Error if invalid
|
|
303
|
+
*/
|
|
304
|
+
validateToken?(token: string): KeyValue[];
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Rate limiting plugin interface.
|
|
308
|
+
*/
|
|
309
|
+
export interface RateLimiterPlugin {
|
|
310
|
+
/**
|
|
311
|
+
* Check if request should be rate limited.
|
|
312
|
+
* @param request The request to check
|
|
313
|
+
* @returns Rate limit decision
|
|
314
|
+
*/
|
|
315
|
+
check(request: PluginRequest): RateLimitResult;
|
|
316
|
+
/**
|
|
317
|
+
* Get current rate limit status for a key.
|
|
318
|
+
* @param key The rate limit key
|
|
319
|
+
* @returns Current status or undefined if not found
|
|
320
|
+
*/
|
|
321
|
+
status?(key: string): RateLimitInfo | undefined;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Get a configuration value by key.
|
|
325
|
+
*
|
|
326
|
+
* @param key - The configuration key to retrieve
|
|
327
|
+
* @returns The configuration value, or undefined if not found
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* ```typescript
|
|
331
|
+
* const dbHost = getConfig('database.host');
|
|
332
|
+
* if (dbHost) {
|
|
333
|
+
* console.log(`Database host: ${dbHost}`);
|
|
334
|
+
* }
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
export declare function getConfig(key: string): string | undefined;
|
|
338
|
+
/**
|
|
339
|
+
* Get a required configuration value by key.
|
|
340
|
+
* Throws ConfigError if the key does not exist.
|
|
341
|
+
*
|
|
342
|
+
* @param key - The configuration key to retrieve
|
|
343
|
+
* @returns The configuration value
|
|
344
|
+
* @throws {ConfigError} If the configuration key does not exist
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```typescript
|
|
348
|
+
* try {
|
|
349
|
+
* const apiKey = getConfigRequired('api.key');
|
|
350
|
+
* } catch (e) {
|
|
351
|
+
* if (e instanceof ConfigError) {
|
|
352
|
+
* log.error(`Missing config: ${e.key}`);
|
|
353
|
+
* }
|
|
354
|
+
* }
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
export declare function getConfigRequired(key: string): string;
|
|
358
|
+
/**
|
|
359
|
+
* Get a configuration value as a boolean.
|
|
360
|
+
* Recognizes: "true", "false", "1", "0", "yes", "no" (case-insensitive).
|
|
361
|
+
*
|
|
362
|
+
* @param key - The configuration key to retrieve
|
|
363
|
+
* @returns The boolean value, or undefined if not found or not parseable
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```typescript
|
|
367
|
+
* const debugMode = getConfigBool('debug.enabled') ?? false;
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
export declare function getConfigBool(key: string): boolean | undefined;
|
|
371
|
+
/**
|
|
372
|
+
* Get a configuration value as an integer.
|
|
373
|
+
*
|
|
374
|
+
* @param key - The configuration key to retrieve
|
|
375
|
+
* @returns The integer value, or undefined if not found or not parseable
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```typescript
|
|
379
|
+
* const maxRetries = getConfigInt('http.max_retries') ?? 3;
|
|
380
|
+
* ```
|
|
381
|
+
*/
|
|
382
|
+
export declare function getConfigInt(key: string): number | undefined;
|
|
383
|
+
/**
|
|
384
|
+
* Get a configuration value as a float.
|
|
385
|
+
*
|
|
386
|
+
* @param key - The configuration key to retrieve
|
|
387
|
+
* @returns The float value, or undefined if not found or not parseable
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```typescript
|
|
391
|
+
* const timeout = getConfigFloat('http.timeout_seconds') ?? 30.0;
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
394
|
+
export declare function getConfigFloat(key: string): number | undefined;
|
|
395
|
+
/**
|
|
396
|
+
* Get multiple configuration values at once.
|
|
397
|
+
*
|
|
398
|
+
* @param keys - The configuration keys to retrieve
|
|
399
|
+
* @returns A Map of key to value for keys that exist
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* ```typescript
|
|
403
|
+
* const config = getConfigMany(['db.host', 'db.port', 'db.name']);
|
|
404
|
+
* const host = config.get('db.host') ?? 'localhost';
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
export declare function getConfigMany(keys: string[]): Map<string, string>;
|
|
408
|
+
/**
|
|
409
|
+
* Get all configuration keys with a given prefix.
|
|
410
|
+
*
|
|
411
|
+
* @param prefix - The prefix to match (e.g., "database.")
|
|
412
|
+
* @returns A Map of key to value for matching keys
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```typescript
|
|
416
|
+
* const dbConfig = getConfigPrefix('database.');
|
|
417
|
+
* // Returns: Map { 'database.host' => 'localhost', 'database.port' => '5432' }
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
export declare function getConfigPrefix(prefix: string): Map<string, string>;
|
|
421
|
+
/**
|
|
422
|
+
* Check if a configuration key exists.
|
|
423
|
+
*
|
|
424
|
+
* @param key - The configuration key to check
|
|
425
|
+
* @returns true if the key exists, false otherwise
|
|
426
|
+
*/
|
|
427
|
+
export declare function configExists(key: string): boolean;
|
|
428
|
+
/**
|
|
429
|
+
* Get all configuration as a JSON string.
|
|
430
|
+
* Useful for debugging or serialization.
|
|
431
|
+
*
|
|
432
|
+
* @returns JSON string of all configuration
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* ```typescript
|
|
436
|
+
* log.debug(`All config: ${getAllConfig()}`);
|
|
437
|
+
* ```
|
|
438
|
+
*/
|
|
439
|
+
export declare function getAllConfig(): string;
|
|
440
|
+
/**
|
|
441
|
+
* Get a value from key-value storage as bytes.
|
|
442
|
+
*
|
|
443
|
+
* @param bucket - The bucket/namespace
|
|
444
|
+
* @param key - The key to retrieve
|
|
445
|
+
* @returns The value as bytes, or undefined if not found
|
|
446
|
+
*
|
|
447
|
+
* @example
|
|
448
|
+
* ```typescript
|
|
449
|
+
* const data = kvGet('sessions', sessionId);
|
|
450
|
+
* if (data) {
|
|
451
|
+
* const session = JSON.parse(new TextDecoder().decode(data));
|
|
452
|
+
* }
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
export declare function kvGet(bucket: string, key: string): Uint8Array | undefined;
|
|
456
|
+
/**
|
|
457
|
+
* Get a value from key-value storage as a string.
|
|
458
|
+
*
|
|
459
|
+
* @param bucket - The bucket/namespace
|
|
460
|
+
* @param key - The key to retrieve
|
|
461
|
+
* @returns The value as a string, or undefined if not found
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```typescript
|
|
465
|
+
* const username = kvGetString('users', `user:${userId}:name`);
|
|
466
|
+
* ```
|
|
467
|
+
*/
|
|
468
|
+
export declare function kvGetString(bucket: string, key: string): string | undefined;
|
|
469
|
+
/**
|
|
470
|
+
* Get a value from key-value storage as JSON.
|
|
471
|
+
*
|
|
472
|
+
* @param bucket - The bucket/namespace
|
|
473
|
+
* @param key - The key to retrieve
|
|
474
|
+
* @returns The parsed JSON value, or undefined if not found
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```typescript
|
|
478
|
+
* interface User { name: string; email: string; }
|
|
479
|
+
* const user = kvGetJson<User>('users', userId);
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
export declare function kvGetJson<T>(bucket: string, key: string): T | undefined;
|
|
483
|
+
/**
|
|
484
|
+
* Set a value in key-value storage as bytes.
|
|
485
|
+
*
|
|
486
|
+
* @param bucket - The bucket/namespace
|
|
487
|
+
* @param key - The key to set
|
|
488
|
+
* @param value - The value as bytes
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```typescript
|
|
492
|
+
* const encoder = new TextEncoder();
|
|
493
|
+
* kvSet('sessions', sessionId, encoder.encode(JSON.stringify(session)));
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
496
|
+
export declare function kvSet(bucket: string, key: string, value: Uint8Array): void;
|
|
497
|
+
/**
|
|
498
|
+
* Set a value in key-value storage as a string.
|
|
499
|
+
*
|
|
500
|
+
* @param bucket - The bucket/namespace
|
|
501
|
+
* @param key - The key to set
|
|
502
|
+
* @param value - The value as a string
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```typescript
|
|
506
|
+
* kvSetString('users', `user:${userId}:name`, 'John Doe');
|
|
507
|
+
* ```
|
|
508
|
+
*/
|
|
509
|
+
export declare function kvSetString(bucket: string, key: string, value: string): void;
|
|
510
|
+
/**
|
|
511
|
+
* Set a value in key-value storage as JSON.
|
|
512
|
+
*
|
|
513
|
+
* @param bucket - The bucket/namespace
|
|
514
|
+
* @param key - The key to set
|
|
515
|
+
* @param value - The value to serialize as JSON
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```typescript
|
|
519
|
+
* kvSetJson('users', userId, { name: 'John', email: 'john@example.com' });
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
export declare function kvSetJson<T>(bucket: string, key: string, value: T): void;
|
|
523
|
+
/**
|
|
524
|
+
* Set a value in key-value storage with a TTL (time-to-live).
|
|
525
|
+
*
|
|
526
|
+
* @param bucket - The bucket/namespace
|
|
527
|
+
* @param key - The key to set
|
|
528
|
+
* @param value - The value as bytes
|
|
529
|
+
* @param ttlMs - Time-to-live in milliseconds
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```typescript
|
|
533
|
+
* // Cache for 5 minutes
|
|
534
|
+
* kvSetWithTtl('cache', cacheKey, data, 5 * 60 * 1000);
|
|
535
|
+
* ```
|
|
536
|
+
*/
|
|
537
|
+
export declare function kvSetWithTtl(bucket: string, key: string, value: Uint8Array, ttlMs: number): void;
|
|
538
|
+
/**
|
|
539
|
+
* Set a string value in key-value storage with a TTL.
|
|
540
|
+
*
|
|
541
|
+
* @param bucket - The bucket/namespace
|
|
542
|
+
* @param key - The key to set
|
|
543
|
+
* @param value - The value as a string
|
|
544
|
+
* @param ttlMs - Time-to-live in milliseconds
|
|
545
|
+
*/
|
|
546
|
+
export declare function kvSetStringWithTtl(bucket: string, key: string, value: string, ttlMs: number): void;
|
|
547
|
+
/**
|
|
548
|
+
* Delete a key from key-value storage.
|
|
549
|
+
*
|
|
550
|
+
* @param bucket - The bucket/namespace
|
|
551
|
+
* @param key - The key to delete
|
|
552
|
+
* @returns true if the key was deleted, false if it didn't exist
|
|
553
|
+
*
|
|
554
|
+
* @example
|
|
555
|
+
* ```typescript
|
|
556
|
+
* kvDelete('sessions', sessionId);
|
|
557
|
+
* ```
|
|
558
|
+
*/
|
|
559
|
+
export declare function kvDelete(bucket: string, key: string): boolean;
|
|
560
|
+
/**
|
|
561
|
+
* List all keys in a bucket with an optional prefix.
|
|
562
|
+
*
|
|
563
|
+
* @param bucket - The bucket/namespace
|
|
564
|
+
* @param prefix - Optional prefix to filter keys
|
|
565
|
+
* @returns Array of keys matching the prefix
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* ```typescript
|
|
569
|
+
* const userKeys = kvKeys('users', 'user:');
|
|
570
|
+
* // Returns: ['user:1', 'user:2', 'user:3']
|
|
571
|
+
* ```
|
|
572
|
+
*/
|
|
573
|
+
export declare function kvKeys(bucket: string, prefix?: string): string[];
|
|
574
|
+
/**
|
|
575
|
+
* Check if a key exists in key-value storage.
|
|
576
|
+
*
|
|
577
|
+
* @param bucket - The bucket/namespace
|
|
578
|
+
* @param key - The key to check
|
|
579
|
+
* @returns true if the key exists, false otherwise
|
|
580
|
+
*/
|
|
581
|
+
export declare function kvExists(bucket: string, key: string): boolean;
|
|
582
|
+
/**
|
|
583
|
+
* Atomically increment a numeric value in key-value storage.
|
|
584
|
+
*
|
|
585
|
+
* @param bucket - The bucket/namespace
|
|
586
|
+
* @param key - The key to increment
|
|
587
|
+
* @param delta - The amount to increment by (default: 1)
|
|
588
|
+
* @returns The new value after incrementing
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```typescript
|
|
592
|
+
* const newCount = kvIncrement('counters', 'page_views', 1);
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
export declare function kvIncrement(bucket: string, key: string, delta?: number): bigint;
|
|
596
|
+
/**
|
|
597
|
+
* Atomically compare and swap a value in key-value storage.
|
|
598
|
+
*
|
|
599
|
+
* @param bucket - The bucket/namespace
|
|
600
|
+
* @param key - The key to update
|
|
601
|
+
* @param expected - The expected current value (undefined if key shouldn't exist)
|
|
602
|
+
* @param newValue - The new value to set if expected matches
|
|
603
|
+
* @returns true if the swap succeeded, false if current value didn't match
|
|
604
|
+
*
|
|
605
|
+
* @example
|
|
606
|
+
* ```typescript
|
|
607
|
+
* // Optimistic locking
|
|
608
|
+
* const current = kvGet('locks', 'resource');
|
|
609
|
+
* const swapped = kvCompareAndSwap('locks', 'resource', current, newLockValue);
|
|
610
|
+
* if (!swapped) {
|
|
611
|
+
* throw new Error('Resource was modified by another process');
|
|
612
|
+
* }
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
export declare function kvCompareAndSwap(bucket: string, key: string, expected: Uint8Array | undefined, newValue: Uint8Array): boolean;
|
|
616
|
+
/**
|
|
617
|
+
* Logging utilities for emitting structured logs to the host.
|
|
618
|
+
*/
|
|
619
|
+
export declare const log: {
|
|
620
|
+
/**
|
|
621
|
+
* Emit a trace-level log message.
|
|
622
|
+
* Use for finest-grained debugging information.
|
|
623
|
+
*
|
|
624
|
+
* @param msg - The log message
|
|
625
|
+
*/
|
|
626
|
+
trace: (msg: string) => void;
|
|
627
|
+
/**
|
|
628
|
+
* Emit a debug-level log message.
|
|
629
|
+
* Use for debugging information.
|
|
630
|
+
*
|
|
631
|
+
* @param msg - The log message
|
|
632
|
+
*/
|
|
633
|
+
debug: (msg: string) => void;
|
|
634
|
+
/**
|
|
635
|
+
* Emit an info-level log message.
|
|
636
|
+
* Use for informational messages about normal operation.
|
|
637
|
+
*
|
|
638
|
+
* @param msg - The log message
|
|
639
|
+
*/
|
|
640
|
+
info: (msg: string) => void;
|
|
641
|
+
/**
|
|
642
|
+
* Emit a warn-level log message.
|
|
643
|
+
* Use for warning messages about potential issues.
|
|
644
|
+
*
|
|
645
|
+
* @param msg - The log message
|
|
646
|
+
*/
|
|
647
|
+
warn: (msg: string) => void;
|
|
648
|
+
/**
|
|
649
|
+
* Emit an error-level log message.
|
|
650
|
+
* Use for error messages.
|
|
651
|
+
*
|
|
652
|
+
* @param msg - The log message
|
|
653
|
+
*/
|
|
654
|
+
error: (msg: string) => void;
|
|
655
|
+
/**
|
|
656
|
+
* Emit a log message at the specified level.
|
|
657
|
+
*
|
|
658
|
+
* @param level - The log level
|
|
659
|
+
* @param msg - The log message
|
|
660
|
+
*/
|
|
661
|
+
log: (level: LogLevel, msg: string) => void;
|
|
662
|
+
/**
|
|
663
|
+
* Emit a structured log message with key-value fields.
|
|
664
|
+
*
|
|
665
|
+
* @param level - The log level
|
|
666
|
+
* @param msg - The log message
|
|
667
|
+
* @param fields - Additional structured fields
|
|
668
|
+
*
|
|
669
|
+
* @example
|
|
670
|
+
* ```typescript
|
|
671
|
+
* log.structured(LogLevel.Info, 'Request processed', {
|
|
672
|
+
* requestId: '123',
|
|
673
|
+
* duration: '45ms',
|
|
674
|
+
* status: '200',
|
|
675
|
+
* });
|
|
676
|
+
* ```
|
|
677
|
+
*/
|
|
678
|
+
structured: (level: LogLevel, msg: string, fields: Record<string, string>) => void;
|
|
679
|
+
/**
|
|
680
|
+
* Check if a log level is enabled.
|
|
681
|
+
* Useful for avoiding expensive log construction when the level is disabled.
|
|
682
|
+
*
|
|
683
|
+
* @param level - The log level to check
|
|
684
|
+
* @returns true if the level is enabled
|
|
685
|
+
*
|
|
686
|
+
* @example
|
|
687
|
+
* ```typescript
|
|
688
|
+
* if (log.isEnabled(LogLevel.Debug)) {
|
|
689
|
+
* log.debug(`Complex data: ${JSON.stringify(largeObject)}`);
|
|
690
|
+
* }
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
isEnabled: (level: LogLevel) => boolean;
|
|
694
|
+
};
|
|
695
|
+
/**
|
|
696
|
+
* Get a secret by name.
|
|
697
|
+
*
|
|
698
|
+
* @param name - The secret name
|
|
699
|
+
* @returns The secret value, or undefined if not found
|
|
700
|
+
*
|
|
701
|
+
* @example
|
|
702
|
+
* ```typescript
|
|
703
|
+
* const apiKey = getSecret('external_api_key');
|
|
704
|
+
* ```
|
|
705
|
+
*/
|
|
706
|
+
export declare function getSecret(name: string): string | undefined;
|
|
707
|
+
/**
|
|
708
|
+
* Get a required secret by name.
|
|
709
|
+
* Throws SecretError if the secret does not exist.
|
|
710
|
+
*
|
|
711
|
+
* @param name - The secret name
|
|
712
|
+
* @returns The secret value
|
|
713
|
+
* @throws {SecretError} If the secret does not exist
|
|
714
|
+
*
|
|
715
|
+
* @example
|
|
716
|
+
* ```typescript
|
|
717
|
+
* const dbPassword = getSecretRequired('database_password');
|
|
718
|
+
* ```
|
|
719
|
+
*/
|
|
720
|
+
export declare function getSecretRequired(name: string): string;
|
|
721
|
+
/**
|
|
722
|
+
* Check if a secret exists.
|
|
723
|
+
*
|
|
724
|
+
* @param name - The secret name
|
|
725
|
+
* @returns true if the secret exists, false otherwise
|
|
726
|
+
*/
|
|
727
|
+
export declare function secretExists(name: string): boolean;
|
|
728
|
+
/**
|
|
729
|
+
* List all available secret names (not values).
|
|
730
|
+
* Useful for diagnostics without exposing sensitive data.
|
|
731
|
+
*
|
|
732
|
+
* @returns Array of secret names
|
|
733
|
+
*/
|
|
734
|
+
export declare function listSecretNames(): string[];
|
|
735
|
+
/**
|
|
736
|
+
* Metrics utilities for emitting observability data to the host.
|
|
737
|
+
*/
|
|
738
|
+
export declare const metrics: {
|
|
739
|
+
/**
|
|
740
|
+
* Increment a counter metric.
|
|
741
|
+
*
|
|
742
|
+
* @param name - The metric name
|
|
743
|
+
* @param value - The amount to increment by (default: 1)
|
|
744
|
+
*
|
|
745
|
+
* @example
|
|
746
|
+
* ```typescript
|
|
747
|
+
* metrics.counterInc('requests_total');
|
|
748
|
+
* metrics.counterInc('bytes_processed', byteCount);
|
|
749
|
+
* ```
|
|
750
|
+
*/
|
|
751
|
+
counterInc: (name: string, value?: number) => void;
|
|
752
|
+
/**
|
|
753
|
+
* Increment a counter metric with labels.
|
|
754
|
+
*
|
|
755
|
+
* @param name - The metric name
|
|
756
|
+
* @param value - The amount to increment by
|
|
757
|
+
* @param labels - The metric labels
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```typescript
|
|
761
|
+
* metrics.counterIncLabeled('http_requests_total', 1, {
|
|
762
|
+
* method: 'GET',
|
|
763
|
+
* path: '/api/users',
|
|
764
|
+
* status: '200',
|
|
765
|
+
* });
|
|
766
|
+
* ```
|
|
767
|
+
*/
|
|
768
|
+
counterIncLabeled: (name: string, value: number, labels: Record<string, string>) => void;
|
|
769
|
+
/**
|
|
770
|
+
* Set a gauge metric to a value.
|
|
771
|
+
*
|
|
772
|
+
* @param name - The metric name
|
|
773
|
+
* @param value - The value to set
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```typescript
|
|
777
|
+
* metrics.gaugeSet('active_connections', connectionCount);
|
|
778
|
+
* ```
|
|
779
|
+
*/
|
|
780
|
+
gaugeSet: (name: string, value: number) => void;
|
|
781
|
+
/**
|
|
782
|
+
* Set a gauge metric with labels.
|
|
783
|
+
*
|
|
784
|
+
* @param name - The metric name
|
|
785
|
+
* @param value - The value to set
|
|
786
|
+
* @param labels - The metric labels
|
|
787
|
+
*/
|
|
788
|
+
gaugeSetLabeled: (name: string, value: number, labels: Record<string, string>) => void;
|
|
789
|
+
/**
|
|
790
|
+
* Add to a gauge value (can be negative).
|
|
791
|
+
*
|
|
792
|
+
* @param name - The metric name
|
|
793
|
+
* @param delta - The amount to add (can be negative)
|
|
794
|
+
*/
|
|
795
|
+
gaugeAdd: (name: string, delta: number) => void;
|
|
796
|
+
/**
|
|
797
|
+
* Record a histogram observation.
|
|
798
|
+
*
|
|
799
|
+
* @param name - The metric name
|
|
800
|
+
* @param value - The observed value
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* ```typescript
|
|
804
|
+
* metrics.histogramObserve('request_duration_seconds', 0.045);
|
|
805
|
+
* ```
|
|
806
|
+
*/
|
|
807
|
+
histogramObserve: (name: string, value: number) => void;
|
|
808
|
+
/**
|
|
809
|
+
* Record a histogram observation with labels.
|
|
810
|
+
*
|
|
811
|
+
* @param name - The metric name
|
|
812
|
+
* @param value - The observed value
|
|
813
|
+
* @param labels - The metric labels
|
|
814
|
+
*/
|
|
815
|
+
histogramObserveLabeled: (name: string, value: number, labels: Record<string, string>) => void;
|
|
816
|
+
/**
|
|
817
|
+
* Record request duration in milliseconds.
|
|
818
|
+
* Convenience method that converts to nanoseconds.
|
|
819
|
+
*
|
|
820
|
+
* @param name - The metric name
|
|
821
|
+
* @param durationMs - Duration in milliseconds
|
|
822
|
+
*/
|
|
823
|
+
recordDuration: (name: string, durationMs: number) => void;
|
|
824
|
+
/**
|
|
825
|
+
* Record request duration with labels.
|
|
826
|
+
*
|
|
827
|
+
* @param name - The metric name
|
|
828
|
+
* @param durationMs - Duration in milliseconds
|
|
829
|
+
* @param labels - The metric labels
|
|
830
|
+
*/
|
|
831
|
+
recordDurationLabeled: (name: string, durationMs: number, labels: Record<string, string>) => void;
|
|
832
|
+
};
|
|
833
|
+
/**
|
|
834
|
+
* Create a successful response with JSON body.
|
|
835
|
+
*
|
|
836
|
+
* @param data - The data to serialize as JSON
|
|
837
|
+
* @param status - HTTP status code (default: 200)
|
|
838
|
+
* @param headers - Additional headers
|
|
839
|
+
* @returns A PluginResponse
|
|
840
|
+
*
|
|
841
|
+
* @example
|
|
842
|
+
* ```typescript
|
|
843
|
+
* return jsonResponse({ users: ['alice', 'bob'] });
|
|
844
|
+
* return jsonResponse({ error: 'Not found' }, 404);
|
|
845
|
+
* ```
|
|
846
|
+
*/
|
|
847
|
+
export declare function jsonResponse<T>(data: T, status?: number, headers?: Record<string, string>): PluginResponse;
|
|
848
|
+
/**
|
|
849
|
+
* Create a text response.
|
|
850
|
+
*
|
|
851
|
+
* @param text - The response text
|
|
852
|
+
* @param status - HTTP status code (default: 200)
|
|
853
|
+
* @param contentType - Content type (default: text/plain)
|
|
854
|
+
* @returns A PluginResponse
|
|
855
|
+
*/
|
|
856
|
+
export declare function textResponse(text: string, status?: number, contentType?: string): PluginResponse;
|
|
857
|
+
/**
|
|
858
|
+
* Create an HTML response.
|
|
859
|
+
*
|
|
860
|
+
* @param html - The HTML content
|
|
861
|
+
* @param status - HTTP status code (default: 200)
|
|
862
|
+
* @returns A PluginResponse
|
|
863
|
+
*/
|
|
864
|
+
export declare function htmlResponse(html: string, status?: number): PluginResponse;
|
|
865
|
+
/**
|
|
866
|
+
* Create a binary response.
|
|
867
|
+
*
|
|
868
|
+
* @param data - The binary data
|
|
869
|
+
* @param contentType - Content type
|
|
870
|
+
* @param status - HTTP status code (default: 200)
|
|
871
|
+
* @returns A PluginResponse
|
|
872
|
+
*/
|
|
873
|
+
export declare function binaryResponse(data: Uint8Array, contentType: string, status?: number): PluginResponse;
|
|
874
|
+
/**
|
|
875
|
+
* Create an error response.
|
|
876
|
+
*
|
|
877
|
+
* @param message - The error message
|
|
878
|
+
* @param status - HTTP status code (default: 500)
|
|
879
|
+
* @returns A HandleResult with error response
|
|
880
|
+
*/
|
|
881
|
+
export declare function errorResponse(message: string, status?: number): HandleResult;
|
|
882
|
+
/**
|
|
883
|
+
* Create a redirect response.
|
|
884
|
+
*
|
|
885
|
+
* @param location - The URL to redirect to
|
|
886
|
+
* @param status - HTTP status code (default: 302)
|
|
887
|
+
* @returns A PluginResponse
|
|
888
|
+
*/
|
|
889
|
+
export declare function redirectResponse(location: string, status?: number): PluginResponse;
|
|
890
|
+
/**
|
|
891
|
+
* Create a pass-through result.
|
|
892
|
+
* Use this when the plugin doesn't want to handle the request.
|
|
893
|
+
*
|
|
894
|
+
* @returns A HandleResult indicating pass-through
|
|
895
|
+
*/
|
|
896
|
+
export declare function passThrough(): HandleResult;
|
|
897
|
+
/**
|
|
898
|
+
* Get a header value from a request (case-insensitive).
|
|
899
|
+
*
|
|
900
|
+
* @param request - The plugin request
|
|
901
|
+
* @param name - The header name
|
|
902
|
+
* @returns The header value, or undefined if not found
|
|
903
|
+
*/
|
|
904
|
+
export declare function getHeader(request: PluginRequest, name: string): string | undefined;
|
|
905
|
+
/**
|
|
906
|
+
* Get all values for a header (case-insensitive).
|
|
907
|
+
*
|
|
908
|
+
* @param request - The plugin request
|
|
909
|
+
* @param name - The header name
|
|
910
|
+
* @returns Array of header values
|
|
911
|
+
*/
|
|
912
|
+
export declare function getHeaders(request: PluginRequest, name: string): string[];
|
|
913
|
+
/**
|
|
914
|
+
* Parse the request body as JSON.
|
|
915
|
+
*
|
|
916
|
+
* @param request - The plugin request
|
|
917
|
+
* @returns The parsed JSON body
|
|
918
|
+
*/
|
|
919
|
+
export declare function parseJsonBody<T>(request: PluginRequest): T;
|
|
920
|
+
/**
|
|
921
|
+
* Get the request body as a string.
|
|
922
|
+
*
|
|
923
|
+
* @param request - The plugin request
|
|
924
|
+
* @returns The body as a string
|
|
925
|
+
*/
|
|
926
|
+
export declare function getBodyString(request: PluginRequest): string;
|
|
927
|
+
/**
|
|
928
|
+
* Parse query string into a Map.
|
|
929
|
+
*
|
|
930
|
+
* @param request - The plugin request
|
|
931
|
+
* @returns Map of query parameters
|
|
932
|
+
*/
|
|
933
|
+
export declare function parseQuery(request: PluginRequest): Map<string, string>;
|
|
934
|
+
/**
|
|
935
|
+
* Get a context value from a request.
|
|
936
|
+
*
|
|
937
|
+
* @param request - The plugin request
|
|
938
|
+
* @param key - The context key
|
|
939
|
+
* @returns The context value, or undefined if not found
|
|
940
|
+
*/
|
|
941
|
+
export declare function getContext(request: PluginRequest, key: string): string | undefined;
|
|
942
|
+
/**
|
|
943
|
+
* Measure the duration of an async operation and record it as a metric.
|
|
944
|
+
*
|
|
945
|
+
* @param name - The metric name
|
|
946
|
+
* @param fn - The async function to measure
|
|
947
|
+
* @returns The result of the function
|
|
948
|
+
*
|
|
949
|
+
* @example
|
|
950
|
+
* ```typescript
|
|
951
|
+
* const result = await timed('database_query', async () => {
|
|
952
|
+
* return await db.query('SELECT * FROM users');
|
|
953
|
+
* });
|
|
954
|
+
* ```
|
|
955
|
+
*/
|
|
956
|
+
export declare function timed<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
|
957
|
+
/**
|
|
958
|
+
* Measure the duration of a sync operation and record it as a metric.
|
|
959
|
+
*
|
|
960
|
+
* @param name - The metric name
|
|
961
|
+
* @param fn - The function to measure
|
|
962
|
+
* @returns The result of the function
|
|
963
|
+
*/
|
|
964
|
+
export declare function timedSync<T>(name: string, fn: () => T): T;
|
|
965
|
+
/**
|
|
966
|
+
* Create a Version object from a semver string.
|
|
967
|
+
*
|
|
968
|
+
* @param semver - The semver string (e.g., "1.2.3" or "1.2.3-beta.1")
|
|
969
|
+
* @returns A Version object
|
|
970
|
+
*/
|
|
971
|
+
export declare function parseVersion(semver: string): Version;
|
|
972
|
+
/**
|
|
973
|
+
* Format a Version object as a semver string.
|
|
974
|
+
*
|
|
975
|
+
* @param version - The Version object
|
|
976
|
+
* @returns The semver string
|
|
977
|
+
*/
|
|
978
|
+
export declare function formatVersion(version: Version): string;
|
|
979
|
+
/**
|
|
980
|
+
* Register a plugin implementation.
|
|
981
|
+
* This is a convenience function for setting up plugin exports.
|
|
982
|
+
*
|
|
983
|
+
* @param plugin - The plugin implementation
|
|
984
|
+
* @returns The plugin for export
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* ```typescript
|
|
988
|
+
* export default registerPlugin({
|
|
989
|
+
* info() {
|
|
990
|
+
* return {
|
|
991
|
+
* id: 'my-org:my-plugin',
|
|
992
|
+
* name: 'My Plugin',
|
|
993
|
+
* version: { major: 1, minor: 0, patch: 0 },
|
|
994
|
+
* description: 'A sample plugin',
|
|
995
|
+
* author: 'My Org',
|
|
996
|
+
* };
|
|
997
|
+
* },
|
|
998
|
+
* handle(request) {
|
|
999
|
+
* return { type: 'response', response: jsonResponse({ hello: 'world' }) };
|
|
1000
|
+
* },
|
|
1001
|
+
* });
|
|
1002
|
+
* ```
|
|
1003
|
+
*/
|
|
1004
|
+
export declare function registerPlugin(plugin: ZLayerPlugin): ZLayerPlugin;
|
|
1005
|
+
//# sourceMappingURL=index.d.ts.map
|