zerobucket 0.6.1 → 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/README.md +80 -9
- package/dist/bin.js +984 -5
- package/dist/{client-C7xs1dlr.d.cts → client-XQ22b1l3.d.cts} +36 -4
- package/dist/{client-C7xs1dlr.d.ts → client-XQ22b1l3.d.ts} +36 -4
- package/dist/http.d.cts +1 -1
- package/dist/http.d.ts +1 -1
- package/dist/index.cjs +1211 -221
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +129 -3
- package/dist/index.d.ts +129 -3
- package/dist/index.js +991 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
|
@@ -77,8 +77,30 @@ interface SqliteDatabaseLike {
|
|
|
77
77
|
};
|
|
78
78
|
exec(sql: string): unknown;
|
|
79
79
|
}
|
|
80
|
-
/**
|
|
81
|
-
|
|
80
|
+
/**
|
|
81
|
+
* A `mysql2/promise` connection (or pool connection): both `query()` and `execute()` resolve to
|
|
82
|
+
* `[rowsOrResultHeader, fields]`. Pass one as `connection` to make a call part of YOUR MySQL/MariaDB
|
|
83
|
+
* transaction. Declared structurally so consumers do not need `mysql2` installed to type-check.
|
|
84
|
+
*/
|
|
85
|
+
interface MysqlQueryable {
|
|
86
|
+
query(sql: string, values?: any): Promise<[any, any]>;
|
|
87
|
+
execute(sql: string, values?: any): Promise<[any, any]>;
|
|
88
|
+
}
|
|
89
|
+
/** The slice of a `mysql2/promise` pool connection that the MySQL backend uses. */
|
|
90
|
+
interface MysqlPoolConnectionLike extends MysqlQueryable {
|
|
91
|
+
beginTransaction(): Promise<void>;
|
|
92
|
+
commit(): Promise<void>;
|
|
93
|
+
rollback(): Promise<void>;
|
|
94
|
+
release(): void;
|
|
95
|
+
destroy(): void;
|
|
96
|
+
}
|
|
97
|
+
/** The slice of a `mysql2/promise` Pool that the MySQL backend uses (bring your own via `pool`). */
|
|
98
|
+
interface MysqlPoolLike {
|
|
99
|
+
getConnection(): Promise<MysqlPoolConnectionLike>;
|
|
100
|
+
end(): Promise<void>;
|
|
101
|
+
}
|
|
102
|
+
/** What `connection` accepts: a `pg` client for Postgres, a `better-sqlite3` Database for SQLite, a `mysql2/promise` connection for MySQL/MariaDB. */
|
|
103
|
+
type Connection = Queryable | SqliteDatabaseLike | MysqlQueryable;
|
|
82
104
|
/** The row shape a storage backend persists (after validation and checksumming). */
|
|
83
105
|
interface PreparedRow {
|
|
84
106
|
data: Buffer;
|
|
@@ -314,7 +336,17 @@ interface ZeroBucketOptions<C = unknown> {
|
|
|
314
336
|
* package's SQLiteBackend, so both can share one `.db` file.
|
|
315
337
|
*/
|
|
316
338
|
sqlite?: string;
|
|
317
|
-
/**
|
|
339
|
+
/**
|
|
340
|
+
* Use MySQL or MariaDB instead of PostgreSQL: `mysql://user:password@host:3306/database`
|
|
341
|
+
* (`mariadb://` works too). Needs `npm install mysql2`. Same schema as the Python package's
|
|
342
|
+
* MySQLBackend, so both can share one database. Classic mode only for now (`dedup` is not
|
|
343
|
+
* available for MySQL yet). `maxRetries`, `retryBaseDelayMs`, `poolMaxSize`, `poolTimeoutMs`,
|
|
344
|
+
* `autoMigrate`, `objectStorage` and `onOperation` apply to it too.
|
|
345
|
+
*/
|
|
346
|
+
mysql?: string;
|
|
347
|
+
/** Bring your own `mysql2/promise` Pool for MySQL/MariaDB. It is NOT closed by close(). */
|
|
348
|
+
mysqlPool?: MysqlPoolLike;
|
|
349
|
+
/** Advanced: inject a custom StorageBackend instead of building one from `connectionString` / `pool` / `sqlite` / `mysql`. */
|
|
318
350
|
backend?: StorageBackend;
|
|
319
351
|
/** Max accepted size in bytes. Default 8 MiB. */
|
|
320
352
|
maxBytes?: number;
|
|
@@ -470,4 +502,4 @@ declare function readInput(image: ImageInput, filename: string | undefined, maxB
|
|
|
470
502
|
filename: string | undefined;
|
|
471
503
|
}>;
|
|
472
504
|
|
|
473
|
-
export { type BatchDeleteResult as B, type CallOptions as C, DEFAULT_MAX_BYTES as D, type GetOptions as G, type ImageListOptions as I, type OperationEvent as O, type PreparedRow as P, type Queryable as Q, type StorageBackend as S, type ValidatedContent as V, type WritableLike as W, ZeroBucket as Z, type ObjectStorageLike as a, type StoredRecord as b, type StoredRecordMetadata as c, type StreamOptions$1 as d, type StorageInfo as e, type ImageListEntry as f, type ContentValidator as g, type BatchGetResult as h, type BatchPutResult as i, type BeforeGetHook as j, type BeforePutHook as k, type Connection as l, type Image as m, type ImageInput as n, type ImageMetadata as o,
|
|
505
|
+
export { optimizeImage as A, type BatchDeleteResult as B, type CallOptions as C, DEFAULT_MAX_BYTES as D, readInput as E, type GetOptions as G, type ImageListOptions as I, type MysqlPoolLike as M, type OperationEvent as O, type PreparedRow as P, type Queryable as Q, type StorageBackend as S, type ValidatedContent as V, type WritableLike as W, ZeroBucket as Z, type ObjectStorageLike as a, type StoredRecord as b, type StoredRecordMetadata as c, type StreamOptions$1 as d, type StorageInfo as e, type ImageListEntry as f, type ContentValidator as g, type BatchGetResult as h, type BatchPutResult as i, type BeforeGetHook as j, type BeforePutHook as k, type Connection as l, type Image as m, type ImageInput as n, type ImageMetadata as o, type MysqlPoolConnectionLike as p, type MysqlQueryable as q, ObjectStorage as r, type ObjectStorageOptions as s, type OptimizationResult as t, type OptimizeOptions as u, type PutManyOptions as v, type PutOptions as w, type SqliteDatabaseLike as x, type StreamOptions as y, type ZeroBucketOptions as z };
|
|
@@ -77,8 +77,30 @@ interface SqliteDatabaseLike {
|
|
|
77
77
|
};
|
|
78
78
|
exec(sql: string): unknown;
|
|
79
79
|
}
|
|
80
|
-
/**
|
|
81
|
-
|
|
80
|
+
/**
|
|
81
|
+
* A `mysql2/promise` connection (or pool connection): both `query()` and `execute()` resolve to
|
|
82
|
+
* `[rowsOrResultHeader, fields]`. Pass one as `connection` to make a call part of YOUR MySQL/MariaDB
|
|
83
|
+
* transaction. Declared structurally so consumers do not need `mysql2` installed to type-check.
|
|
84
|
+
*/
|
|
85
|
+
interface MysqlQueryable {
|
|
86
|
+
query(sql: string, values?: any): Promise<[any, any]>;
|
|
87
|
+
execute(sql: string, values?: any): Promise<[any, any]>;
|
|
88
|
+
}
|
|
89
|
+
/** The slice of a `mysql2/promise` pool connection that the MySQL backend uses. */
|
|
90
|
+
interface MysqlPoolConnectionLike extends MysqlQueryable {
|
|
91
|
+
beginTransaction(): Promise<void>;
|
|
92
|
+
commit(): Promise<void>;
|
|
93
|
+
rollback(): Promise<void>;
|
|
94
|
+
release(): void;
|
|
95
|
+
destroy(): void;
|
|
96
|
+
}
|
|
97
|
+
/** The slice of a `mysql2/promise` Pool that the MySQL backend uses (bring your own via `pool`). */
|
|
98
|
+
interface MysqlPoolLike {
|
|
99
|
+
getConnection(): Promise<MysqlPoolConnectionLike>;
|
|
100
|
+
end(): Promise<void>;
|
|
101
|
+
}
|
|
102
|
+
/** What `connection` accepts: a `pg` client for Postgres, a `better-sqlite3` Database for SQLite, a `mysql2/promise` connection for MySQL/MariaDB. */
|
|
103
|
+
type Connection = Queryable | SqliteDatabaseLike | MysqlQueryable;
|
|
82
104
|
/** The row shape a storage backend persists (after validation and checksumming). */
|
|
83
105
|
interface PreparedRow {
|
|
84
106
|
data: Buffer;
|
|
@@ -314,7 +336,17 @@ interface ZeroBucketOptions<C = unknown> {
|
|
|
314
336
|
* package's SQLiteBackend, so both can share one `.db` file.
|
|
315
337
|
*/
|
|
316
338
|
sqlite?: string;
|
|
317
|
-
/**
|
|
339
|
+
/**
|
|
340
|
+
* Use MySQL or MariaDB instead of PostgreSQL: `mysql://user:password@host:3306/database`
|
|
341
|
+
* (`mariadb://` works too). Needs `npm install mysql2`. Same schema as the Python package's
|
|
342
|
+
* MySQLBackend, so both can share one database. Classic mode only for now (`dedup` is not
|
|
343
|
+
* available for MySQL yet). `maxRetries`, `retryBaseDelayMs`, `poolMaxSize`, `poolTimeoutMs`,
|
|
344
|
+
* `autoMigrate`, `objectStorage` and `onOperation` apply to it too.
|
|
345
|
+
*/
|
|
346
|
+
mysql?: string;
|
|
347
|
+
/** Bring your own `mysql2/promise` Pool for MySQL/MariaDB. It is NOT closed by close(). */
|
|
348
|
+
mysqlPool?: MysqlPoolLike;
|
|
349
|
+
/** Advanced: inject a custom StorageBackend instead of building one from `connectionString` / `pool` / `sqlite` / `mysql`. */
|
|
318
350
|
backend?: StorageBackend;
|
|
319
351
|
/** Max accepted size in bytes. Default 8 MiB. */
|
|
320
352
|
maxBytes?: number;
|
|
@@ -470,4 +502,4 @@ declare function readInput(image: ImageInput, filename: string | undefined, maxB
|
|
|
470
502
|
filename: string | undefined;
|
|
471
503
|
}>;
|
|
472
504
|
|
|
473
|
-
export { type BatchDeleteResult as B, type CallOptions as C, DEFAULT_MAX_BYTES as D, type GetOptions as G, type ImageListOptions as I, type OperationEvent as O, type PreparedRow as P, type Queryable as Q, type StorageBackend as S, type ValidatedContent as V, type WritableLike as W, ZeroBucket as Z, type ObjectStorageLike as a, type StoredRecord as b, type StoredRecordMetadata as c, type StreamOptions$1 as d, type StorageInfo as e, type ImageListEntry as f, type ContentValidator as g, type BatchGetResult as h, type BatchPutResult as i, type BeforeGetHook as j, type BeforePutHook as k, type Connection as l, type Image as m, type ImageInput as n, type ImageMetadata as o,
|
|
505
|
+
export { optimizeImage as A, type BatchDeleteResult as B, type CallOptions as C, DEFAULT_MAX_BYTES as D, readInput as E, type GetOptions as G, type ImageListOptions as I, type MysqlPoolLike as M, type OperationEvent as O, type PreparedRow as P, type Queryable as Q, type StorageBackend as S, type ValidatedContent as V, type WritableLike as W, ZeroBucket as Z, type ObjectStorageLike as a, type StoredRecord as b, type StoredRecordMetadata as c, type StreamOptions$1 as d, type StorageInfo as e, type ImageListEntry as f, type ContentValidator as g, type BatchGetResult as h, type BatchPutResult as i, type BeforeGetHook as j, type BeforePutHook as k, type Connection as l, type Image as m, type ImageInput as n, type ImageMetadata as o, type MysqlPoolConnectionLike as p, type MysqlQueryable as q, ObjectStorage as r, type ObjectStorageOptions as s, type OptimizationResult as t, type OptimizeOptions as u, type PutManyOptions as v, type PutOptions as w, type SqliteDatabaseLike as x, type StreamOptions as y, type ZeroBucketOptions as z };
|
package/dist/http.d.cts
CHANGED
package/dist/http.d.ts
CHANGED