11import newFilesInstant from "@pipedream/google_drive/sources/new-files-instant/new-files-instant.mjs" ;
2- import app from "../../google_docs.app.mjs" ;
2+ import googleDrive from "../../google_docs.app.mjs" ;
33import { MY_DRIVE_VALUE } from "@pipedream/google_drive/common/constants.mjs" ;
44
55export default {
66 ...newFilesInstant ,
77 props : {
8- app ,
8+ googleDrive ,
99 db : "$.service.db" ,
1010 http : "$.interface.http" ,
1111 timer : newFilesInstant . props . timer ,
1212 folders : {
1313 propDefinition : [
14- app ,
14+ googleDrive ,
1515 "folderId" ,
1616 ] ,
1717 type : "string[]" ,
@@ -30,7 +30,7 @@ export default {
3030 methods : {
3131 ...newFilesInstant . methods ,
3232 getDriveId ( ) {
33- return app . methods . getDriveId ( MY_DRIVE_VALUE ) ;
33+ return googleDrive . methods . getDriveId ( MY_DRIVE_VALUE ) ;
3434 } ,
3535 shouldProcess ( file ) {
3636 return (
@@ -48,7 +48,7 @@ export default {
4848 async getDocumentsFromFiles ( files , limit ) {
4949 return files . reduce ( async ( acc , file ) => {
5050 const docs = await acc ;
51- const fileInfo = await this . app . getFile ( file . id ) ;
51+ const fileInfo = await this . googleDrive . getFile ( file . id ) ;
5252 return docs . length >= limit
5353 ? docs
5454 : docs . concat ( fileInfo ) ;
@@ -59,13 +59,13 @@ export default {
5959
6060 if ( ! foldersIds ?. length ) {
6161 const opts = this . getDocumentsFromFolderOpts ( "root" ) ;
62- const { files } = await this . app . listFilesInPage ( null , opts ) ;
62+ const { files } = await this . googleDrive . listFilesInPage ( null , opts ) ;
6363 return this . getDocumentsFromFiles ( files , limit ) ;
6464 }
6565
6666 return foldersIds . reduce ( async ( docs , folderId ) => {
6767 const opts = this . getDocumentsFromFolderOpts ( folderId ) ;
68- const { files } = await this . app . listFilesInPage ( null , opts ) ;
68+ const { files } = await this . googleDrive . listFilesInPage ( null , opts ) ;
6969 const nextDocuments = await this . getDocumentsFromFiles ( files , limit ) ;
7070 return ( await docs ) . concat ( nextDocuments ) ;
7171 } , [ ] ) ;
@@ -75,7 +75,7 @@ export default {
7575 if ( ! this . shouldProcess ( file ) ) {
7676 continue ;
7777 }
78- const doc = await this . app . getDocument ( file . id ) ;
78+ const doc = await this . googleDrive . getDocument ( file . id ) ;
7979 this . $emit ( doc , this . generateMeta ( doc ) ) ;
8080 }
8181 } ,
0 commit comments