@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/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();
|