New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@friggframework/api-module-google-drive

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@friggframework/api-module-google-drive - npm Package Compare versions

Comparing version 0.0.8-canary.664e700.0 to 0.0.8

@@ -109,4 +109,48 @@ const { OAuth2Requester } = require('@friggframework/module-plugin');

}
async getFileUploadSession(headers, metadataBody) {
const options = {
url: this.baseUrl + this.URLs.fileUpload,
query: {
uploadType: 'resumable'
},
headers,
returnFullRes: true,
}
if (metadataBody) {
options.body = metadataBody;
options.headers['Content-Type'] =
'application/json; charset=UTF-8';
// TODO: might require adding Content-Length
}
// if file exists already, this needs to be a _put
return this._post(options);
}
async uploadFileToSession(sessionURI, headers, body) {
const options = {
url: sessionURI,
headers,
body,
returnFullRes: true,
}
return this._put(options)
}
async getUploadSessionStatus(sessionURI) {
const options = {
url: sessionURI,
headers : {
'Content-Range': '*/*'
},
returnFullRes: true,
}
// status of 200 or 201 indicates upload complete
// status of 404 indicates upload session expired
// status of 308 indicates incomplete but resumable upload
// - where the Range header will indicate completed bytes
return this._put(options)
}
}
module.exports = { Api };

@@ -0,1 +1,22 @@

# v0.0.8 (Wed Jun 07 2023)
#### 🐛 Bug Fix
- google drive - auth fixes [#170](https://github.com/friggframework/frigg/pull/170) (michael.webber@lefthook.com [@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
- add helper method that checks status of a file upload session, which is a special case of the content upload request (PUT to session uri) (michael.webber@lefthook.com)
- add methods for resumable file upload (michael.webber@lefthook.com)
- update debug log message to indicate the correct externalId (michael.webber@lefthook.com)
- fixes to credential model and db upsert (michael.webber@lefthook.com)
- Add test for the refresh_token (and access_token) (michael.webber@lefthook.com)
- google auth spec wants the default behavior of getTokenFromCode, even though the AuthHeader style was working. (michael.webber@lefthook.com)
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
#### Authors: 3
- [@MichaelRyanWebber](https://github.com/MichaelRyanWebber)
- Michael Webber (michael.webber@lefthook.com)
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
---
# v0.0.7 (Fri May 26 2023)

@@ -2,0 +23,0 @@

@@ -167,3 +167,3 @@ const { debug, flushDebugLog } = require('@friggframework/logs');

debug(
'Somebody else already created a credential with the same permission ID:',
'Somebody else already created a credential with the same externalId (email address):',
userDetails.emailAddress

@@ -175,3 +175,3 @@ );

debug(
'Multiple credentials found with the same permission ID:',
'Multiple credentials found with the same externalId (email address):',
userDetails.emailAddress

@@ -178,0 +178,0 @@ );

@@ -15,3 +15,2 @@ const mongoose = require('mongoose');

},
expires_at: { type: Number },

@@ -18,0 +17,0 @@ });

{
"name": "@friggframework/api-module-google-drive",
"version": "0.0.8-canary.664e700.0",
"version": "0.0.8",
"prettier": "@friggframework/prettier-config",

@@ -30,3 +30,3 @@ "description": "",

},
"gitHead": "664e7006aa8915a8481e081544e41d8ff490f7c3"
"gitHead": "cf3c5261dbe8294205ea2e6398e4e58700c43eec"
}

@@ -114,2 +114,11 @@ require('dotenv').config();

});
describe('Drive File Upload', () => {
it('should retrieve a upload session id', async () => {
const response = await api.getFileUploadSession();
expect(response).toBeDefined();
expect(response.status).toBeDefined();
expect(response.headers.get('location')).toBeDefined();
});
});
});