@econ-v1/app-sdk 7.4.9 → 7.5.1

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.
@@ -37,6 +37,8 @@ declare module "burger:host" {
37
37
  }
38
38
 
39
39
  declare module "burger:fs" {
40
+ import type { Buffer } from "burger:buffer";
41
+
40
42
  export type PathLike = string;
41
43
  export type Utf8Encoding = "utf8" | "utf-8";
42
44
 
@@ -74,7 +76,8 @@ declare module "burger:fs" {
74
76
  }
75
77
 
76
78
  export function existsSync(path: PathLike): boolean;
77
- export function readFileSync(path: PathLike): Uint8Array;
79
+ /** Binary contents as a `Buffer` viewing the bytes read (Node shape). */
80
+ export function readFileSync(path: PathLike): Buffer;
78
81
  export function readFileSync(path: PathLike, encoding: Utf8Encoding | { encoding: Utf8Encoding }): string;
79
82
  export function writeFileSync(path: PathLike, data: string | Uint8Array): void;
80
83
  export function appendFileSync(path: PathLike, data: string | Uint8Array): void;
@@ -124,7 +127,7 @@ declare module "burger:fs" {
124
127
 
125
128
  export interface FsPromises {
126
129
  exists(path: PathLike): Promise<boolean>;
127
- readFile(path: PathLike): Promise<Uint8Array>;
130
+ readFile(path: PathLike): Promise<Buffer>;
128
131
  readFile(path: PathLike, encoding: Utf8Encoding | { encoding: Utf8Encoding }): Promise<string>;
129
132
  writeFile(path: PathLike, data: string | Uint8Array): Promise<void>;
130
133
  appendFile(path: PathLike, data: string | Uint8Array): Promise<void>;
@@ -300,8 +303,10 @@ declare module "burger:buffer" {
300
303
 
301
304
  /** C5 subset of Node's Buffer. Instances are `Uint8Array`s. */
302
305
  export interface Buffer extends Uint8Array<ArrayBuffer> {
303
- toString(encoding?: BufferEncoding): string;
306
+ toString(encoding?: BufferEncoding, start?: number, end?: number): string;
304
307
  equals(other: Uint8Array): boolean;
308
+ /** Same as `Buffer.compare(this, target)`. */
309
+ compare(target: Uint8Array): -1 | 0 | 1;
305
310
  subarray(start?: number, end?: number): Buffer;
306
311
  slice(start?: number, end?: number): Buffer;
307
312
  }
@@ -309,11 +314,22 @@ declare module "burger:buffer" {
309
314
  export interface BufferConstructor {
310
315
  readonly prototype: Buffer;
311
316
  from(value: string, encoding?: BufferEncoding): Buffer;
312
- from(value: Uint8Array | ArrayBuffer | readonly number[]): Buffer;
317
+ /**
318
+ * A view of `arrayBuffer` (no copy), from `byteOffset` for `length` bytes (default: to its end).
319
+ * A `SharedArrayBuffer` needs the node-app-burger release carrying that fix (newer than 0.3.1);
320
+ * Burger 0.3.1 throws a TypeError on one.
321
+ */
322
+ from(arrayBuffer: ArrayBufferLike, byteOffset?: number, length?: number): Buffer;
323
+ /** A copy of the bytes. */
324
+ from(value: ArrayBufferView | readonly number[]): Buffer;
313
325
  alloc(size: number): Buffer;
314
326
  concat(list: readonly Uint8Array[]): Buffer;
315
327
  isBuffer(value: unknown): value is Buffer;
316
- byteLength(value: string): number;
328
+ /** UTF-8 (or `encoding`) length of a string; `byteLength` of a view or ArrayBuffer. */
329
+ byteLength(value: string, encoding?: BufferEncoding): number;
330
+ byteLength(value: ArrayBufferView | ArrayBuffer): number;
331
+ /** Bytewise (unsigned) order, a shorter prefix first; usable as a `sort` comparator. */
332
+ compare(a: Uint8Array, b: Uint8Array): -1 | 0 | 1;
317
333
  }
318
334
 
319
335
  export const Buffer: BufferConstructor;
@@ -324,23 +340,28 @@ declare module "burger:buffer" {
324
340
  declare module "burger:sqlite" {
325
341
  export type SQLValue = null | number | bigint | string | Uint8Array;
326
342
  export type SQLBinding = SQLValue | boolean | undefined;
343
+ /**
344
+ * Bindings for one execution, as the runtime reads them: several values bind
345
+ * positionally; a single array binds its items positionally; a single plain
346
+ * object binds by name (a single Uint8Array is one blob value).
347
+ */
327
348
  export type SQLParams =
328
349
  | SQLBinding[]
329
- | [SQLBinding[]]
330
- | [Record<string, SQLBinding>];
350
+ | [SQLBinding | SQLBinding[] | Record<string, SQLBinding>];
331
351
 
332
352
  export interface Changes {
333
353
  changes: number;
334
354
  lastInsertRowid: number | bigint;
335
355
  }
336
356
 
337
- export interface Statement<Row = unknown> {
338
- all(...params: SQLParams): Row[];
339
- get(...params: SQLParams): Row | null;
340
- run(...params: SQLParams): Changes;
341
- values(...params: SQLParams): SQLValue[][];
357
+ /** `Params` narrows what each execution accepts, as in `bun:sqlite` (`query<Row, [string]>`). */
358
+ export interface Statement<Row = unknown, Params extends SQLParams = SQLParams> {
359
+ all(...params: Params): Row[];
360
+ get(...params: Params): Row | null;
361
+ run(...params: Params): Changes;
362
+ values(...params: Params): SQLValue[][];
342
363
  /** data-app pack: rows one at a time; the deadline bounds the whole iteration. */
343
- iterate(...params: SQLParams): IterableIterator<Row>;
364
+ iterate(...params: Params): IterableIterator<Row>;
344
365
  [Symbol.iterator](): IterableIterator<Row>;
345
366
  /** data-app pack. */
346
367
  readonly columnNames: string[];
@@ -366,8 +387,8 @@ declare module "burger:sqlite" {
366
387
  constructor(filename?: string, options?: DatabaseOptions);
367
388
  /** data-app pack: the default statement deadline in ms (`undefined`: none). */
368
389
  deadlineMs: number | null | undefined;
369
- query<Row = unknown>(sql: string): Statement<Row>;
370
- prepare<Row = unknown>(sql: string): Statement<Row>;
390
+ query<Row = unknown, Params extends SQLParams = SQLParams>(sql: string): Statement<Row, Params>;
391
+ prepare<Row = unknown, Params extends SQLParams = SQLParams>(sql: string): Statement<Row, Params>;
371
392
  exec(sql: string, ...params: SQLParams): Changes;
372
393
  run(sql: string, ...params: SQLParams): Changes;
373
394
  transaction<Args extends unknown[], Result>(fn: (...args: Args) => Result): (...args: Args) => Result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@econ-v1/app-sdk",
3
- "version": "7.4.9",
3
+ "version": "7.5.1",
4
4
  "description": "TypeScript SDK for building Node mini-app plugins (Bun runtime) on the Lightning-powered marketplace daemon",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": "Node contributors",