@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/commands/index.js
CHANGED
|
@@ -1119,6 +1119,58 @@ var init_sql_compat = __esm({
|
|
|
1119
1119
|
}
|
|
1120
1120
|
});
|
|
1121
1121
|
|
|
1122
|
+
// src/infra/database/adapters/pg-column-map.ts
|
|
1123
|
+
function remapRow(row) {
|
|
1124
|
+
const out = {};
|
|
1125
|
+
for (const key in row) {
|
|
1126
|
+
out[COLUMN_MAP[key] ?? key] = row[key];
|
|
1127
|
+
}
|
|
1128
|
+
return out;
|
|
1129
|
+
}
|
|
1130
|
+
function remapRows(rows) {
|
|
1131
|
+
return rows.map((row) => remapRow(row));
|
|
1132
|
+
}
|
|
1133
|
+
var COLUMN_MAP;
|
|
1134
|
+
var init_pg_column_map = __esm({
|
|
1135
|
+
"src/infra/database/adapters/pg-column-map.ts"() {
|
|
1136
|
+
"use strict";
|
|
1137
|
+
init_esm_shims();
|
|
1138
|
+
COLUMN_MAP = {
|
|
1139
|
+
ddocid: "ddocId",
|
|
1140
|
+
localversion: "localVersion",
|
|
1141
|
+
onchainversion: "onchainVersion",
|
|
1142
|
+
syncstatus: "syncStatus",
|
|
1143
|
+
createdat: "createdAt",
|
|
1144
|
+
updatedat: "updatedAt",
|
|
1145
|
+
isdeleted: "isDeleted",
|
|
1146
|
+
portaladdress: "portalAddress",
|
|
1147
|
+
onchainfileid: "onChainFileId",
|
|
1148
|
+
commentkey: "commentKey",
|
|
1149
|
+
linkkey: "linkKey",
|
|
1150
|
+
linkkeynonce: "linkKeyNonce",
|
|
1151
|
+
portalseed: "portalSeed",
|
|
1152
|
+
owneraddress: "ownerAddress",
|
|
1153
|
+
apikeyseed: "apiKeySeed",
|
|
1154
|
+
collaboratoraddress: "collaboratorAddress",
|
|
1155
|
+
fileid: "fileId",
|
|
1156
|
+
retrycount: "retryCount",
|
|
1157
|
+
lasterror: "lastError",
|
|
1158
|
+
lockedat: "lockedAt",
|
|
1159
|
+
nextretryat: "nextRetryAt",
|
|
1160
|
+
userophash: "userOpHash",
|
|
1161
|
+
pendingpayload: "pendingPayload",
|
|
1162
|
+
folderid: "folderId",
|
|
1163
|
+
folderref: "folderRef",
|
|
1164
|
+
foldername: "folderName",
|
|
1165
|
+
metadataipfshash: "metadataIPFSHash",
|
|
1166
|
+
contentipfshash: "contentIPFSHash",
|
|
1167
|
+
lasttransactionhash: "lastTransactionHash",
|
|
1168
|
+
lasttransactionblocknumber: "lastTransactionBlockNumber",
|
|
1169
|
+
lasttransactionblocktimestamp: "lastTransactionBlockTimestamp"
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1122
1174
|
// src/infra/database/adapters/postgres-adapter.ts
|
|
1123
1175
|
var postgres_adapter_exports = {};
|
|
1124
1176
|
__export(postgres_adapter_exports, {
|
|
@@ -1136,6 +1188,7 @@ var init_postgres_adapter = __esm({
|
|
|
1136
1188
|
"use strict";
|
|
1137
1189
|
init_esm_shims();
|
|
1138
1190
|
init_sql_compat();
|
|
1191
|
+
init_pg_column_map();
|
|
1139
1192
|
init_infra();
|
|
1140
1193
|
pgModule = null;
|
|
1141
1194
|
PostgresAdapter = class {
|
|
@@ -1165,13 +1218,13 @@ var init_postgres_adapter = __esm({
|
|
|
1165
1218
|
const pool = await this.getPool();
|
|
1166
1219
|
const pgSql = sqliteToPostgres(sql);
|
|
1167
1220
|
const result = await pool.query(pgSql, params);
|
|
1168
|
-
return result.rows;
|
|
1221
|
+
return remapRows(result.rows);
|
|
1169
1222
|
}
|
|
1170
1223
|
async selectOne(sql, params = []) {
|
|
1171
1224
|
const pool = await this.getPool();
|
|
1172
1225
|
const pgSql = sqliteToPostgres(sql);
|
|
1173
1226
|
const result = await pool.query(pgSql, params);
|
|
1174
|
-
return result.rows[0]
|
|
1227
|
+
return result.rows[0] ? remapRow(result.rows[0]) : void 0;
|
|
1175
1228
|
}
|
|
1176
1229
|
async execute(sql, params = []) {
|
|
1177
1230
|
const pool = await this.getPool();
|
|
@@ -1396,13 +1449,13 @@ CREATE TABLE IF NOT EXISTS api_keys (
|
|
|
1396
1449
|
CREATE TABLE IF NOT EXISTS events (
|
|
1397
1450
|
_id TEXT PRIMARY KEY,
|
|
1398
1451
|
type TEXT NOT NULL CHECK (type IN ('create', 'update', 'delete')),
|
|
1399
|
-
timestamp
|
|
1452
|
+
timestamp BIGINT NOT NULL,
|
|
1400
1453
|
fileId TEXT NOT NULL,
|
|
1401
1454
|
status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'processing', 'processed', 'failed')),
|
|
1402
1455
|
retryCount INTEGER NOT NULL DEFAULT 0,
|
|
1403
1456
|
lastError TEXT,
|
|
1404
|
-
lockedAt
|
|
1405
|
-
nextRetryAt
|
|
1457
|
+
lockedAt BIGINT,
|
|
1458
|
+
nextRetryAt BIGINT,
|
|
1406
1459
|
userOpHash TEXT,
|
|
1407
1460
|
pendingPayload TEXT,
|
|
1408
1461
|
portalAddress TEXT
|
|
@@ -1423,8 +1476,8 @@ CREATE TABLE IF NOT EXISTS folders (
|
|
|
1423
1476
|
contentIPFSHash TEXT NOT NULL,
|
|
1424
1477
|
isDeleted INTEGER NOT NULL DEFAULT 0,
|
|
1425
1478
|
lastTransactionHash TEXT,
|
|
1426
|
-
lastTransactionBlockNumber
|
|
1427
|
-
lastTransactionBlockTimestamp
|
|
1479
|
+
lastTransactionBlockNumber BIGINT NOT NULL,
|
|
1480
|
+
lastTransactionBlockTimestamp BIGINT NOT NULL,
|
|
1428
1481
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
1429
1482
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
1430
1483
|
);
|