Error Fix and Console Logging format.
This commit is contained in:
+7
-21
@@ -1,7 +1,7 @@
|
||||
const readline = require('readline');
|
||||
const {google} = require('googleapis');
|
||||
const {createStarterConfig, getDefaultConfigPath, writeConfigFile} = require('./config');
|
||||
const {getFirstServiceAccountAuthClient} = require('./auth');
|
||||
const {fetchSpreadsheetTitle} = require('./sheets');
|
||||
|
||||
function createPrompt() {
|
||||
const rl = readline.createInterface({input: process.stdin, output: process.stdout});
|
||||
@@ -82,26 +82,6 @@ async function pauseForEnter(ask) {
|
||||
await ask('Press Enter to close this window...');
|
||||
}
|
||||
|
||||
async function fetchSpreadsheetTitle(context, documentId) {
|
||||
const sheetOptions = {version: 'v4'};
|
||||
if (context.authClient) {
|
||||
sheetOptions.auth = context.authClient;
|
||||
}
|
||||
|
||||
const sheets = google.sheets(sheetOptions);
|
||||
const request = {
|
||||
spreadsheetId: documentId,
|
||||
fields: 'properties/title',
|
||||
};
|
||||
|
||||
if (context.apiKey) {
|
||||
request.key = context.apiKey;
|
||||
}
|
||||
|
||||
const response = await sheets.spreadsheets.get(request);
|
||||
return response.data.properties?.title || documentId;
|
||||
}
|
||||
|
||||
function buildTitleContext(authMode, config) {
|
||||
if (authMode === 'apiKeys' && Array.isArray(config.apiKeys) && config.apiKeys.length > 0) {
|
||||
return {apiKey: config.apiKeys[0].key};
|
||||
@@ -162,6 +142,12 @@ async function runOnboarding() {
|
||||
serviceAccounts: [],
|
||||
documents: [],
|
||||
};
|
||||
Object.defineProperty(config, '__configPath', {
|
||||
value: configPath,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
});
|
||||
|
||||
if (authMode === 'apiKeys') {
|
||||
for (let index = 0; index < credentialCount; index += 1) {
|
||||
|
||||
Reference in New Issue
Block a user