@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/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();
|
|
@@ -1076,13 +1129,13 @@ CREATE TABLE IF NOT EXISTS api_keys (
|
|
|
1076
1129
|
CREATE TABLE IF NOT EXISTS events (
|
|
1077
1130
|
_id TEXT PRIMARY KEY,
|
|
1078
1131
|
type TEXT NOT NULL CHECK (type IN ('create', 'update', 'delete')),
|
|
1079
|
-
timestamp
|
|
1132
|
+
timestamp BIGINT NOT NULL,
|
|
1080
1133
|
fileId TEXT NOT NULL,
|
|
1081
1134
|
status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'processing', 'processed', 'failed')),
|
|
1082
1135
|
retryCount INTEGER NOT NULL DEFAULT 0,
|
|
1083
1136
|
lastError TEXT,
|
|
1084
|
-
lockedAt
|
|
1085
|
-
nextRetryAt
|
|
1137
|
+
lockedAt BIGINT,
|
|
1138
|
+
nextRetryAt BIGINT,
|
|
1086
1139
|
userOpHash TEXT,
|
|
1087
1140
|
pendingPayload TEXT,
|
|
1088
1141
|
portalAddress TEXT
|
|
@@ -1103,8 +1156,8 @@ CREATE TABLE IF NOT EXISTS folders (
|
|
|
1103
1156
|
contentIPFSHash TEXT NOT NULL,
|
|
1104
1157
|
isDeleted INTEGER NOT NULL DEFAULT 0,
|
|
1105
1158
|
lastTransactionHash TEXT,
|
|
1106
|
-
lastTransactionBlockNumber
|
|
1107
|
-
lastTransactionBlockTimestamp
|
|
1159
|
+
lastTransactionBlockNumber BIGINT NOT NULL,
|
|
1160
|
+
lastTransactionBlockTimestamp BIGINT NOT NULL,
|
|
1108
1161
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
1109
1162
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
1110
1163
|
);
|