@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/worker.js
CHANGED
|
@@ -277,6 +277,58 @@ var init_sql_compat = __esm({
|
|
|
277
277
|
}
|
|
278
278
|
});
|
|
279
279
|
|
|
280
|
+
// src/infra/database/adapters/pg-column-map.ts
|
|
281
|
+
function remapRow(row) {
|
|
282
|
+
const out = {};
|
|
283
|
+
for (const key in row) {
|
|
284
|
+
out[COLUMN_MAP[key] ?? key] = row[key];
|
|
285
|
+
}
|
|
286
|
+
return out;
|
|
287
|
+
}
|
|
288
|
+
function remapRows(rows) {
|
|
289
|
+
return rows.map((row) => remapRow(row));
|
|
290
|
+
}
|
|
291
|
+
var COLUMN_MAP;
|
|
292
|
+
var init_pg_column_map = __esm({
|
|
293
|
+
"src/infra/database/adapters/pg-column-map.ts"() {
|
|
294
|
+
"use strict";
|
|
295
|
+
init_esm_shims();
|
|
296
|
+
COLUMN_MAP = {
|
|
297
|
+
ddocid: "ddocId",
|
|
298
|
+
localversion: "localVersion",
|
|
299
|
+
onchainversion: "onchainVersion",
|
|
300
|
+
syncstatus: "syncStatus",
|
|
301
|
+
createdat: "createdAt",
|
|
302
|
+
updatedat: "updatedAt",
|
|
303
|
+
isdeleted: "isDeleted",
|
|
304
|
+
portaladdress: "portalAddress",
|
|
305
|
+
onchainfileid: "onChainFileId",
|
|
306
|
+
commentkey: "commentKey",
|
|
307
|
+
linkkey: "linkKey",
|
|
308
|
+
linkkeynonce: "linkKeyNonce",
|
|
309
|
+
portalseed: "portalSeed",
|
|
310
|
+
owneraddress: "ownerAddress",
|
|
311
|
+
apikeyseed: "apiKeySeed",
|
|
312
|
+
collaboratoraddress: "collaboratorAddress",
|
|
313
|
+
fileid: "fileId",
|
|
314
|
+
retrycount: "retryCount",
|
|
315
|
+
lasterror: "lastError",
|
|
316
|
+
lockedat: "lockedAt",
|
|
317
|
+
nextretryat: "nextRetryAt",
|
|
318
|
+
userophash: "userOpHash",
|
|
319
|
+
pendingpayload: "pendingPayload",
|
|
320
|
+
folderid: "folderId",
|
|
321
|
+
folderref: "folderRef",
|
|
322
|
+
foldername: "folderName",
|
|
323
|
+
metadataipfshash: "metadataIPFSHash",
|
|
324
|
+
contentipfshash: "contentIPFSHash",
|
|
325
|
+
lasttransactionhash: "lastTransactionHash",
|
|
326
|
+
lasttransactionblocknumber: "lastTransactionBlockNumber",
|
|
327
|
+
lasttransactionblocktimestamp: "lastTransactionBlockTimestamp"
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
|
|
280
332
|
// src/infra/database/adapters/postgres-adapter.ts
|
|
281
333
|
var postgres_adapter_exports = {};
|
|
282
334
|
__export(postgres_adapter_exports, {
|
|
@@ -294,6 +346,7 @@ var init_postgres_adapter = __esm({
|
|
|
294
346
|
"use strict";
|
|
295
347
|
init_esm_shims();
|
|
296
348
|
init_sql_compat();
|
|
349
|
+
init_pg_column_map();
|
|
297
350
|
init_infra();
|
|
298
351
|
pgModule = null;
|
|
299
352
|
PostgresAdapter = class {
|
|
@@ -323,13 +376,13 @@ var init_postgres_adapter = __esm({
|
|
|
323
376
|
const pool = await this.getPool();
|
|
324
377
|
const pgSql = sqliteToPostgres(sql);
|
|
325
378
|
const result = await pool.query(pgSql, params);
|
|
326
|
-
return result.rows;
|
|
379
|
+
return remapRows(result.rows);
|
|
327
380
|
}
|
|
328
381
|
async selectOne(sql, params = []) {
|
|
329
382
|
const pool = await this.getPool();
|
|
330
383
|
const pgSql = sqliteToPostgres(sql);
|
|
331
384
|
const result = await pool.query(pgSql, params);
|
|
332
|
-
return result.rows[0]
|
|
385
|
+
return result.rows[0] ? remapRow(result.rows[0]) : void 0;
|
|
333
386
|
}
|
|
334
387
|
async execute(sql, params = []) {
|
|
335
388
|
const pool = await this.getPool();
|