@fileverse/api 0.0.5 → 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.
@@ -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] ?? void 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();