@fileverse/api 0.0.4 → 0.0.6
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/dist/cli/index.js +60 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/index.js +60 -7
- package/dist/commands/index.js.map +1 -1
- package/dist/hono.js +16377 -0
- package/dist/hono.js.map +1 -0
- package/dist/index.js +60 -7
- package/dist/index.js.map +1 -1
- package/dist/worker.js +60 -7
- package/dist/worker.js.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -287,6 +287,58 @@ var init_sql_compat = __esm({
|
|
|
287
287
|
}
|
|
288
288
|
});
|
|
289
289
|
|
|
290
|
+
// src/infra/database/adapters/pg-column-map.ts
|
|
291
|
+
function remapRow(row) {
|
|
292
|
+
const out = {};
|
|
293
|
+
for (const key in row) {
|
|
294
|
+
out[COLUMN_MAP[key] ?? key] = row[key];
|
|
295
|
+
}
|
|
296
|
+
return out;
|
|
297
|
+
}
|
|
298
|
+
function remapRows(rows) {
|
|
299
|
+
return rows.map((row) => remapRow(row));
|
|
300
|
+
}
|
|
301
|
+
var COLUMN_MAP;
|
|
302
|
+
var init_pg_column_map = __esm({
|
|
303
|
+
"src/infra/database/adapters/pg-column-map.ts"() {
|
|
304
|
+
"use strict";
|
|
305
|
+
init_esm_shims();
|
|
306
|
+
COLUMN_MAP = {
|
|
307
|
+
ddocid: "ddocId",
|
|
308
|
+
localversion: "localVersion",
|
|
309
|
+
onchainversion: "onchainVersion",
|
|
310
|
+
syncstatus: "syncStatus",
|
|
311
|
+
createdat: "createdAt",
|
|
312
|
+
updatedat: "updatedAt",
|
|
313
|
+
isdeleted: "isDeleted",
|
|
314
|
+
portaladdress: "portalAddress",
|
|
315
|
+
onchainfileid: "onChainFileId",
|
|
316
|
+
commentkey: "commentKey",
|
|
317
|
+
linkkey: "linkKey",
|
|
318
|
+
linkkeynonce: "linkKeyNonce",
|
|
319
|
+
portalseed: "portalSeed",
|
|
320
|
+
owneraddress: "ownerAddress",
|
|
321
|
+
apikeyseed: "apiKeySeed",
|
|
322
|
+
collaboratoraddress: "collaboratorAddress",
|
|
323
|
+
fileid: "fileId",
|
|
324
|
+
retrycount: "retryCount",
|
|
325
|
+
lasterror: "lastError",
|
|
326
|
+
lockedat: "lockedAt",
|
|
327
|
+
nextretryat: "nextRetryAt",
|
|
328
|
+
userophash: "userOpHash",
|
|
329
|
+
pendingpayload: "pendingPayload",
|
|
330
|
+
folderid: "folderId",
|
|
331
|
+
folderref: "folderRef",
|
|
332
|
+
foldername: "folderName",
|
|
333
|
+
metadataipfshash: "metadataIPFSHash",
|
|
334
|
+
contentipfshash: "contentIPFSHash",
|
|
335
|
+
lasttransactionhash: "lastTransactionHash",
|
|
336
|
+
lasttransactionblocknumber: "lastTransactionBlockNumber",
|
|
337
|
+
lasttransactionblocktimestamp: "lastTransactionBlockTimestamp"
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
|
|
290
342
|
// src/infra/database/adapters/postgres-adapter.ts
|
|
291
343
|
var postgres_adapter_exports = {};
|
|
292
344
|
__export(postgres_adapter_exports, {
|
|
@@ -304,6 +356,7 @@ var init_postgres_adapter = __esm({
|
|
|
304
356
|
"use strict";
|
|
305
357
|
init_esm_shims();
|
|
306
358
|
init_sql_compat();
|
|
359
|
+
init_pg_column_map();
|
|
307
360
|
init_infra();
|
|
308
361
|
pgModule = null;
|
|
309
362
|
PostgresAdapter = class {
|
|
@@ -333,13 +386,13 @@ var init_postgres_adapter = __esm({
|
|
|
333
386
|
const pool = await this.getPool();
|
|
334
387
|
const pgSql = sqliteToPostgres(sql);
|
|
335
388
|
const result = await pool.query(pgSql, params);
|
|
336
|
-
return result.rows;
|
|
389
|
+
return remapRows(result.rows);
|
|
337
390
|
}
|
|
338
391
|
async selectOne(sql, params = []) {
|
|
339
392
|
const pool = await this.getPool();
|
|
340
393
|
const pgSql = sqliteToPostgres(sql);
|
|
341
394
|
const result = await pool.query(pgSql, params);
|
|
342
|
-
return result.rows[0]
|
|
395
|
+
return result.rows[0] ? remapRow(result.rows[0]) : void 0;
|
|
343
396
|
}
|
|
344
397
|
async execute(sql, params = []) {
|
|
345
398
|
const pool = await this.getPool();
|
|
@@ -3541,13 +3594,13 @@ CREATE TABLE IF NOT EXISTS api_keys (
|
|
|
3541
3594
|
CREATE TABLE IF NOT EXISTS events (
|
|
3542
3595
|
_id TEXT PRIMARY KEY,
|
|
3543
3596
|
type TEXT NOT NULL CHECK (type IN ('create', 'update', 'delete')),
|
|
3544
|
-
timestamp
|
|
3597
|
+
timestamp BIGINT NOT NULL,
|
|
3545
3598
|
fileId TEXT NOT NULL,
|
|
3546
3599
|
status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'processing', 'processed', 'failed')),
|
|
3547
3600
|
retryCount INTEGER NOT NULL DEFAULT 0,
|
|
3548
3601
|
lastError TEXT,
|
|
3549
|
-
lockedAt
|
|
3550
|
-
nextRetryAt
|
|
3602
|
+
lockedAt BIGINT,
|
|
3603
|
+
nextRetryAt BIGINT,
|
|
3551
3604
|
userOpHash TEXT,
|
|
3552
3605
|
pendingPayload TEXT,
|
|
3553
3606
|
portalAddress TEXT
|
|
@@ -3568,8 +3621,8 @@ CREATE TABLE IF NOT EXISTS folders (
|
|
|
3568
3621
|
contentIPFSHash TEXT NOT NULL,
|
|
3569
3622
|
isDeleted INTEGER NOT NULL DEFAULT 0,
|
|
3570
3623
|
lastTransactionHash TEXT,
|
|
3571
|
-
lastTransactionBlockNumber
|
|
3572
|
-
lastTransactionBlockTimestamp
|
|
3624
|
+
lastTransactionBlockNumber BIGINT NOT NULL,
|
|
3625
|
+
lastTransactionBlockTimestamp BIGINT NOT NULL,
|
|
3573
3626
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
3574
3627
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
3575
3628
|
);
|