@riocrypto/common-server 1.0.1007 → 1.0.1008

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.
@@ -4,7 +4,7 @@ declare class GoogleSheetsAPIClient {
4
4
  googleAuth: any;
5
5
  constructor(env: RioEnv);
6
6
  getNextAvailableRow(sheetId: string): Promise<number>;
7
- getSheetValues(sheetId: string, rowData: string[]): Promise<void>;
7
+ appendRowToNextAvailableRow(sheetId: string, rowData: string[]): Promise<void>;
8
8
  }
9
9
  export declare const googleSheetsAPIClient: GoogleSheetsAPIClient;
10
10
  export {};
@@ -48,7 +48,7 @@ class GoogleSheetsAPIClient {
48
48
  return data.length + 1;
49
49
  });
50
50
  }
51
- getSheetValues(sheetId, rowData) {
51
+ appendRowToNextAvailableRow(sheetId, rowData) {
52
52
  return __awaiter(this, void 0, void 0, function* () {
53
53
  const authClientObject = yield this.googleAuth.getClient();
54
54
  const sheets = googleapis_1.google.sheets({ version: "v4", auth: authClientObject });
@@ -56,11 +56,15 @@ class GoogleSheetsAPIClient {
56
56
  if (nextAvailableRow === -1) {
57
57
  throw new Error("Failed to find the next available row.");
58
58
  }
59
- const range = `A${nextAvailableRow}`;
59
+ const startColumnIndex = 1; // Column B (index 1)
60
+ const range = `${String.fromCharCode(65 + startColumnIndex)}${nextAvailableRow}`;
61
+ // Append empty cells for column A (if needed) and the actual data for other columns
62
+ const valuesToAppend = Array(startColumnIndex).fill("");
63
+ valuesToAppend.push(...rowData);
60
64
  yield sheets.spreadsheets.values.append({
61
65
  spreadsheetId: sheetId,
62
66
  range,
63
- valueInputOption: "USER_ENTERED",
67
+ valueInputOption: "RAW",
64
68
  requestBody: {
65
69
  values: [rowData],
66
70
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1007",
3
+ "version": "1.0.1008",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",