@fileverse/api 0.0.5 → 0.0.7
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 +55 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/index.js +55 -2
- package/dist/commands/index.js.map +1 -1
- package/dist/index.js +55 -2
- package/dist/index.js.map +1 -1
- package/dist/worker.js +55 -2
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -559,6 +559,58 @@ var init_sql_compat = __esm({
|
|
|
559
559
|
}
|
|
560
560
|
});
|
|
561
561
|
|
|
562
|
+
// src/infra/database/adapters/pg-column-map.ts
|
|
563
|
+
function remapRow(row) {
|
|
564
|
+
const out = {};
|
|
565
|
+
for (const key in row) {
|
|
566
|
+
out[COLUMN_MAP[key] ?? key] = row[key];
|
|
567
|
+
}
|
|
568
|
+
return out;
|
|
569
|
+
}
|
|
570
|
+
function remapRows(rows) {
|
|
571
|
+
return rows.map((row) => remapRow(row));
|
|
572
|
+
}
|
|
573
|
+
var COLUMN_MAP;
|
|
574
|
+
var init_pg_column_map = __esm({
|
|
575
|
+
"src/infra/database/adapters/pg-column-map.ts"() {
|
|
576
|
+
"use strict";
|
|
577
|
+
init_esm_shims();
|
|
578
|
+
COLUMN_MAP = {
|
|
579
|
+
ddocid: "ddocId",
|
|
580
|
+
localversion: "localVersion",
|
|
581
|
+
onchainversion: "onchainVersion",
|
|
582
|
+
syncstatus: "syncStatus",
|
|
583
|
+
createdat: "createdAt",
|
|
584
|
+
updatedat: "updatedAt",
|
|
585
|
+
isdeleted: "isDeleted",
|
|
586
|
+
portaladdress: "portalAddress",
|
|
587
|
+
onchainfileid: "onChainFileId",
|
|
588
|
+
commentkey: "commentKey",
|
|
589
|
+
linkkey: "linkKey",
|
|
590
|
+
linkkeynonce: "linkKeyNonce",
|
|
591
|
+
portalseed: "portalSeed",
|
|
592
|
+
owneraddress: "ownerAddress",
|
|
593
|
+
apikeyseed: "apiKeySeed",
|
|
594
|
+
collaboratoraddress: "collaboratorAddress",
|
|
595
|
+
fileid: "fileId",
|
|
596
|
+
retrycount: "retryCount",
|
|
597
|
+
lasterror: "lastError",
|
|
598
|
+
lockedat: "lockedAt",
|
|
599
|
+
nextretryat: "nextRetryAt",
|
|
600
|
+
userophash: "userOpHash",
|
|
601
|
+
pendingpayload: "pendingPayload",
|
|
602
|
+
folderid: "folderId",
|
|
603
|
+
folderref: "folderRef",
|
|
604
|
+
foldername: "folderName",
|
|
605
|
+
metadataipfshash: "metadataIPFSHash",
|
|
606
|
+
contentipfshash: "contentIPFSHash",
|
|
607
|
+
lasttransactionhash: "lastTransactionHash",
|
|
608
|
+
lasttransactionblocknumber: "lastTransactionBlockNumber",
|
|
609
|
+
lasttransactionblocktimestamp: "lastTransactionBlockTimestamp"
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
|
|
562
614
|
// src/infra/database/adapters/postgres-adapter.ts
|
|
563
615
|
var postgres_adapter_exports = {};
|
|
564
616
|
__export(postgres_adapter_exports, {
|
|
@@ -576,6 +628,7 @@ var init_postgres_adapter = __esm({
|
|
|
576
628
|
"use strict";
|
|
577
629
|
init_esm_shims();
|
|
578
630
|
init_sql_compat();
|
|
631
|
+
init_pg_column_map();
|
|
579
632
|
init_infra();
|
|
580
633
|
pgModule = null;
|
|
581
634
|
PostgresAdapter = class {
|
|
@@ -605,13 +658,13 @@ var init_postgres_adapter = __esm({
|
|
|
605
658
|
const pool = await this.getPool();
|
|
606
659
|
const pgSql = sqliteToPostgres(sql);
|
|
607
660
|
const result = await pool.query(pgSql, params);
|
|
608
|
-
return result.rows;
|
|
661
|
+
return remapRows(result.rows);
|
|
609
662
|
}
|
|
610
663
|
async selectOne(sql, params = []) {
|
|
611
664
|
const pool = await this.getPool();
|
|
612
665
|
const pgSql = sqliteToPostgres(sql);
|
|
613
666
|
const result = await pool.query(pgSql, params);
|
|
614
|
-
return result.rows[0]
|
|
667
|
+
return result.rows[0] ? remapRow(result.rows[0]) : void 0;
|
|
615
668
|
}
|
|
616
669
|
async execute(sql, params = []) {
|
|
617
670
|
const pool = await this.getPool();
|