Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cloudrail-si

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudrail-si - npm Package Compare versions

Comparing version 2.10.1 to 2.11.0

services/OneDriveBusiness.js

6

changelog.md
# CloudRail SI Node.JS SDK changelog
* **2.11.0**
* Added OneDrive for Business as a new service to the Cloud Storage interface
* Bugfixes to OneDrive and Dropbox concerning files and folders with special characters
* Fixed an issue where Box would return maximally 100 children of a folder
* Added a function to retrieve children in chunks to all Cloud Storage services
* **2.10.1**

@@ -4,0 +10,0 @@ * Heroku has been added as a new service implementing Profile.

@@ -116,5 +116,15 @@ "use strict";

};
Helper.safeAscii = function (str) {
return str.toString().replace(/[\u007f-\uffff]/g, function (c) { return '\\u' + ('000' + c.charCodeAt(0).toString(16)).slice(-4); });
};
Helper.makeRequest = function (urlString, headers, body, method) {
var urlParsed = url.parse(urlString, true);
var request = urlParsed.protocol === "http:" ? http : https;
if (headers) {
for (var _i = 0, _a = Object.keys(headers); _i < _a.length; _i++) {
var headerName = _a[_i];
if (headers[headerName])
headers[headerName] = Helper.safeAscii(headers[headerName]);
}
}
var options = {

@@ -121,0 +131,0 @@ hostname: urlParsed.hostname,

2

index.js

@@ -46,2 +46,3 @@ "use strict";

var Heroku_1 = require("./services/Heroku");
var OneDriveBusiness_1 = require("./services/OneDriveBusiness");
module.exports = {

@@ -68,2 +69,3 @@ "services": {

"OneDrive": OneDrive_1.OneDrive,
"OneDriveBusiness": OneDriveBusiness_1.OneDriveBusiness,
"PayPal": PayPal_1.PayPal,

@@ -70,0 +72,0 @@ "Rackspace": Rackspace_1.Rackspace,

5

package.json

@@ -28,2 +28,3 @@ {

"OneDrive",
"OneDriveBusiness",
"PayPal",

@@ -39,3 +40,3 @@ "Rackspace",

],
"description": "The CloudRail SI SDK for Node.JS, a simple, universal, unified API for the most popular cloud services. Supports: AmazonS3, Box, Backblaze, Dropbox, Egnyte, Facebook, Foursquare, GitHub, GoogleDrive, GooglePlaces, GooglePlus, Heroku, Instagram, LinkedIn, MailJet, MicrosoftAzure, MicrosoftLive, Nexmo, OneDrive, PayPal, Rackspace, SendGrid, Slack, Stripe, Twilio, Twitter, Yahoo, Yelp",
"description": "The CloudRail SI SDK for Node.JS, a simple, universal, unified API for the most popular cloud services. Supports: AmazonS3, Box, Backblaze, Dropbox, Egnyte, Facebook, Foursquare, GitHub, GoogleDrive, GooglePlaces, GooglePlus, Heroku, Instagram, LinkedIn, MailJet, MicrosoftAzure, MicrosoftLive, Nexmo, OneDrive, OneDriveBusiness, PayPal, Rackspace, SendGrid, Slack, Stripe, Twilio, Twitter, Yahoo, Yelp",
"engines": {

@@ -45,3 +46,3 @@ "node": ">=4.0.0"

"engineStrict": true,
"version": "2.10.1",
"version": "2.11.0",
"main": "index.js",

@@ -48,0 +49,0 @@ "typings": "index.d.ts",

@@ -34,3 +34,3 @@ <p align="center">

--- | ---
Cloud Storage | Dropbox, Google Drive, OneDrive, Box, Egnyte
Cloud Storage | Dropbox, Google Drive, OneDrive, OneDrive Business, Box, Egnyte
Business Cloud Storage | Amazon S3, Microsoft Azure, Rackspace, Backblaze

@@ -50,2 +50,3 @@ Social Profile | Facebook, GitHub, Google+, LinkedIn, Slack, Twitter, Windows Live, Yahoo, Instagram

* Microsoft OneDrive
* Microsoft OneDrive for Business
* Egnyte

@@ -71,2 +72,3 @@

// let cs = new cloudrail.services.OneDrive(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");
// let cs = new cloudrail.services.OneDriveBusiness(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");
// let cs = new cloudrail.services.GoogleDrive(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");

@@ -73,0 +75,0 @@ let cs = new cloudrail.services.Dropbox(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");

@@ -15,3 +15,3 @@ "use strict";

var size = -1;
if (Helper_1.Helper.isArray(container) || Helper_1.Helper.isString(container))
if (Helper_1.Helper.isArray(container) || Helper_1.Helper.isString(container) || Helper_1.Helper.isData(container))
size = container.length;

@@ -18,0 +18,0 @@ else if (Helper_1.Helper.isObject(container))

@@ -250,9 +250,13 @@ "use strict";

["callFunc", "resolvePath", "$P0", "$L0", "$P2"],
["create", "$L2", "Object"],
["string.concat", "$L3", "https://api.box.com/2.0/folders/", "$L0.id", "/items?fields=name,size,type,modified_at"],
["set", "$L2.url", "$L3"],
["set", "$L2.method", "GET"],
["create", "$L2.requestHeaders", "Object"],
["string.concat", "$L2.requestHeaders.Authorization", "Bearer ", "$S0.access_token"],
["http.requestCall", "$L5", "$L2"],
["create", "$L21", "Number", 500],
["create", "$L1", "Number", 0],
["create", "$L2", "Number", 0],
["create", "$P1", "Array"],
["create", "$L20", "Object"],
["string.concat", "$L3", "https://api.box.com/2.0/folders/", "$L0.id", "/items?fields=name,size,type,modified_at&limit=", "$L21", "&offset=", "$L1"],
["set", "$L20.url", "$L3"],
["set", "$L20.method", "GET"],
["create", "$L20.requestHeaders", "Object"],
["string.concat", "$L20.requestHeaders.Authorization", "Bearer ", "$S0.access_token"],
["http.requestCall", "$L5", "$L20"],
["callFunc", "checkHttpErrors", "$P0", "$L5", "children metadata retrieval", 200],

@@ -262,3 +266,30 @@ ["json.parse", "$L4", "$L5.responseBody"],

["set", "$L7", 0],
["if<than", "$L7", "$L6", 5],
["get", "$L8", "$L4.entries", "$L7"],
["callFunc", "makeMeta", "$P0", "$L9", "$L8", "$P2"],
["push", "$P1", "$L9"],
["math.add", "$L7", "$L7", 1],
["jumpRel", -6],
["if==than", "$L2", 0, 1],
["set", "$L2", "$L4.total_count"],
["math.add", "$L1", "$L1", "$L21"],
["if<than", "$L1", "$L2", 1],
["jumpRel", -22]
],
"getChildrenPage": [
["callFunc", "validatePath", "$P0", "$P2"],
["callFunc", "checkAuthentication", "$P0"],
["callFunc", "resolvePath", "$P0", "$L0", "$P2"],
["create", "$P1", "Array"],
["create", "$L20", "Object"],
["string.concat", "$L3", "https://api.box.com/2.0/folders/", "$L0.id", "/items?fields=name,size,type,modified_at&limit=", "$P4", "&offset=", "$P3"],
["set", "$L20.url", "$L3"],
["set", "$L20.method", "GET"],
["create", "$L20.requestHeaders", "Object"],
["string.concat", "$L20.requestHeaders.Authorization", "Bearer ", "$S0.access_token"],
["http.requestCall", "$L5", "$L20"],
["callFunc", "checkHttpErrors", "$P0", "$L5", "children metadata retrieval", 200],
["json.parse", "$L4", "$L5.responseBody"],
["size", "$L6", "$L4.entries"],
["set", "$L7", 0],
["if<than", "$L7", "$L6", 5],

@@ -687,2 +718,17 @@ ["get", "$L8", "$L4.entries", "$L7"],

};
Box.prototype.getChildrenPage = function (path, offset, limit, callback) {
Statistics_1.Statistics.addCall("Box", "getChildrenPage");
var ip = new Interpreter_1.Interpreter(new Sandbox_1.Sandbox(SERVICE_CODE, this.persistentStorage, this.instanceDependencyStorage));
ip.callFunction("getChildrenPage", this.interpreterStorage, null, path, offset, limit).then(function () {
Helper_1.Helper.checkSandboxError(ip);
}).then(function () {
var res;
res = ip.getParameter(1);
if (callback != null && typeof callback === "function")
callback(undefined, res);
}, function (err) {
if (callback != null && typeof callback === "function")
callback(err);
});
};
Box.prototype.getUserLogin = function (callback) {

@@ -689,0 +735,0 @@ Statistics_1.Statistics.addCall("Box", "getUserLogin");

@@ -8,2 +8,8 @@ "use strict";

var SERVICE_CODE = {
"init": [
["create", "$P0.paginationCache", "Object"],
["create", "$P0.paginationCache.offset", "Number", 0],
["create", "$P0.paginationCache.path", "String", "grgerfefrgerhggerger"],
["create", "$P0.paginationCache.metaCache", "Array"]
],
"CloudStorage:getUserLogin": [

@@ -136,2 +142,50 @@ ["callFunc", "User:about", "$P0"],

],
"getChildrenPage": [
["callFunc", "validatePath", "$P0", "$P2"],
["if==than", "$P2", "/", 1],
["set", "$P2", ""],
["callFunc", "checkAuthentication", "$P0"],
["create", "$P1", "Array"],
["if!=than", "$P0.paginationCache.path", "$P2", 11],
["jumpRel", 1],
["if<than", "$P3", "$P0.paginationCache.offset", 9],
["set", "$P0.paginationCache.path", "$P2"],
["set", "$P0.P0.paginationCache.offset", 0],
["create", "$P0.paginationCache.metaCache", "Array"],
["create", "$L0", "Object"],
["set", "$L0.path", "$P2"],
["callFunc", "standardJSONRequest", "$P0", "$L1", "$L0", "https://api.dropboxapi.com/2/files/list_folder"],
["callFunc", "processRawMeta", "$P0", "$P0.paginationCache.metaCache", "$L1"],
["set", "$P0.paginationCache.cursor", "$L1.cursor"],
["jumpRel", -12],
["create", "$L0", "Number"],
["size", "$L0", "$P0.paginationCache.metaCache"],
["math.add", "$L0", "$L0", "$P0.paginationCache.offset"],
["if<than", "$P3", "$L0", 13],
["math.multiply", "$L1", "$P0.paginationCache.offset", -1],
["math.add", "$L1", "$L1", "$P3"],
["size", "$L0", "$P1"],
["if<than", "$L0", "$P4", 9],
["get", "$L2", "$P0.paginationCache.metaCache", "$L1"],
["push", "$P1", "$L2"],
["math.add", "$L1", "$L1", 1],
["size", "$L3", "$P0.paginationCache.metaCache"],
["if==than", "$L3", "$L1", 3],
["size", "$L4", "$P0.paginationCache.metaCache"],
["math.add", "$P3", "$L4", "$P0.paginationCache.offset"],
["jumpRel", 2],
["jumpRel", -11],
["return"],
["if==than", "$P0.paginationCache.cursor", null, 1],
["return"],
["create", "$L0", "Object"],
["set", "$L0.cursor", "$P0.paginationCache.cursor"],
["callFunc", "standardJSONRequest", "$P0", "$L1", "$L0", "https://api.dropboxapi.com/2/files/list_folder/continue"],
["size", "$L2", "$P0.paginationCache.metaCache"],
["math.add", "$P0.paginationCache.offset", "$P0.paginationCache.offset", "$L2"],
["create", "$P0.paginationCache.metaCache", "Array"],
["callFunc", "processRawMeta", "$P0", "$P0.paginationCache.metaCache", "$L1"],
["set", "$P0.paginationCache.cursor", "$L1.cursor"],
["jumpRel", -41]
],
"CloudStorage:exists": [

@@ -627,2 +681,17 @@ ["callFunc", "validatePath", "$P0", "$P2"],

};
Dropbox.prototype.getChildrenPage = function (path, offset, limit, callback) {
Statistics_1.Statistics.addCall("Dropbox", "getChildrenPage");
var ip = new Interpreter_1.Interpreter(new Sandbox_1.Sandbox(SERVICE_CODE, this.persistentStorage, this.instanceDependencyStorage));
ip.callFunction("getChildrenPage", this.interpreterStorage, null, path, offset, limit).then(function () {
Helper_1.Helper.checkSandboxError(ip);
}).then(function () {
var res;
res = ip.getParameter(1);
if (callback != null && typeof callback === "function")
callback(undefined, res);
}, function (err) {
if (callback != null && typeof callback === "function")
callback(err);
});
};
Dropbox.prototype.getUserLogin = function (callback) {

@@ -629,0 +698,0 @@ Statistics_1.Statistics.addCall("Dropbox", "getUserLogin");

@@ -162,2 +162,37 @@ "use strict";

],
"getChildrenPage": [
["callFunc", "validatePath", "$P0", "$P2"],
["callFunc", "checkAuthentication", "$P0"],
["callFunc", "encodePath", "$P0", "$L12", "$P2"],
["create", "$L2", "Object"],
["string.concat", "$L2.url", "https://", "$P0.domain", ".egnyte.com/pubapi/v1/fs", "$L12", "?offset=", "$P3", "&count=", "$P4"],
["set", "$L2.method", "GET"],
["create", "$L2.requestHeaders", "Object"],
["string.concat", "$L2.requestHeaders.Authorization", "Bearer ", "$S0.access_token"],
["http.requestCall", "$L3", "$L2"],
["callFunc", "validateResponse", "$P0", "$L3"],
["json.parse", "$L4", "$L3.responseBody"],
["if==than", "$L4.is_folder", 0, 2],
["create", "$L5", "Error", "Only folders have children, the given path points to a file", "IllegalArgument"],
["throwError", "$L5"],
["create", "$P1", "Array"],
["if!=than", "$L4.folders", null, 8],
["size", "$L5", "$L4.folders"],
["set", "$L6", 0],
["if<than", "$L6", "$L5", 5],
["get", "$L7", "$L4.folders", "$L6"],
["callFunc", "extractMeta", "$P0", "$L8", "$L7"],
["push", "$P1", "$L8"],
["math.add", "$L6", "$L6", 1],
["jumpRel", -6],
["if!=than", "$L4.files", null, 8],
["size", "$L5", "$L4.files"],
["set", "$L6", 0],
["if<than", "$L6", "$L5", 5],
["get", "$L7", "$L4.files", "$L6"],
["callFunc", "extractMeta", "$P0", "$L8", "$L7"],
["push", "$P1", "$L8"],
["math.add", "$L6", "$L6", 1],
["jumpRel", -6]
],
"CloudStorage:exists": [

@@ -526,2 +561,17 @@ ["callFunc", "validatePath", "$P0", "$P2"],

};
Egnyte.prototype.getChildrenPage = function (path, offset, limit, callback) {
Statistics_1.Statistics.addCall("Egnyte", "getChildrenPage");
var ip = new Interpreter_1.Interpreter(new Sandbox_1.Sandbox(SERVICE_CODE, this.persistentStorage, this.instanceDependencyStorage));
ip.callFunction("getChildrenPage", this.interpreterStorage, null, path, offset, limit).then(function () {
Helper_1.Helper.checkSandboxError(ip);
}).then(function () {
var res;
res = ip.getParameter(1);
if (callback != null && typeof callback === "function")
callback(undefined, res);
}, function (err) {
if (callback != null && typeof callback === "function")
callback(err);
});
};
Egnyte.prototype.getUserLogin = function (callback) {

@@ -528,0 +578,0 @@ Statistics_1.Statistics.addCall("Egnyte", "getUserLogin");

@@ -8,2 +8,8 @@ "use strict";

var SERVICE_CODE = {
"init": [
["create", "$P0.paginationCache", "Object"],
["create", "$P0.paginationCache.offset", "Number", 0],
["create", "$P0.paginationCache.path", "String", "grgerfefrgerhggerger"],
["create", "$P0.paginationCache.metaCache", "Array"]
],
"CloudStorage:getUserLogin": [

@@ -95,6 +101,9 @@ ["callFunc", "User:about", "$P0"],

["callFunc", "resolvePath", "$P0", "$L5", "$L1"],
["create", "$L16", "Object"],
["callFunc", "getRawMetadataByID", "$P0", "$L16", "$L4"],
["set", "$L16", "$L16.parents.0"],
["create", "$L6", "Object"],
["set", "$L6.method", "PUT"],
["set", "$L6.method", "PATCH"],
["create", "$L7", "String"],
["string.concat", "$L7", "https://www.googleapis.com/drive/v2/files/", "$L4"],
["string.concat", "$L7", "https://www.googleapis.com/drive/v3/files/", "$L4", "?addParents=", "$L5", "&removeParents=", "$L16"],
["set", "$L6.url", "$L7"],

@@ -108,8 +117,3 @@ ["create", "$L8", "Object"],

["create", "$L10", "Object"],
["set", "$L10.title", "$L3"],
["create", "$L11", "Array"],
["set", "$L10.parents", "$L11"],
["create", "$L12", "Object"],
["set", "$L12.id", "$L5"],
["push", "$L11", "$L12"],
["set", "$L10.name", "$L3"],
["create", "$L13", "String"],

@@ -131,3 +135,3 @@ ["json.stringify", "$L13", "$L10"],

["create", "$L2", "String"],
["string.concat", "$L2", "https://www.googleapis.com/drive/v2/files/", "$L0"],
["string.concat", "$L2", "https://www.googleapis.com/drive/v3/files/", "$L0"],
["set", "$L1.url", "$L2"],

@@ -173,3 +177,3 @@ ["create", "$L3", "Object"],

["create", "$L8", "String"],
["string.concat", "$L8", "https://www.googleapis.com/drive/v2/files/", "$L4", "/copy"],
["string.concat", "$L8", "https://www.googleapis.com/drive/v3/files/", "$L4", "/copy"],
["set", "$L7.url", "$L8"],

@@ -183,7 +187,7 @@ ["create", "$L9", "Object"],

["create", "$L11", "Object"],
["set", "$L11.title", "$L3"],
["set", "$L11.name", "$L3"],
["create", "$L12", "Array"],
["set", "$L11.parents", "$L12"],
["create", "$L13", "Object"],
["set", "$L13.id", "$L5"],
["create", "$L13", "String"],
["set", "$L13", "$L5"],
["push", "$L12", "$L13"],

@@ -224,10 +228,10 @@ ["create", "$L14", "String"],

["set", "$L5", "$L6", "Authorization"],
["set", "$L4.url", "https://www.googleapis.com/drive/v2/files"],
["set", "$L4.url", "https://www.googleapis.com/drive/v3/files"],
["create", "$L7", "Object"],
["set", "$L7.title", "$L3"],
["set", "$L7.name", "$L3"],
["set", "$L7.mimeType", "application/vnd.google-apps.folder"],
["create", "$L8", "Array"],
["set", "$L7.parents", "$L8"],
["create", "$L9", "Object"],
["set", "$L9.id", "$L2"],
["create", "$L9", "String"],
["set", "$L9", "$L2"],
["push", "$L8", "$L9"],

@@ -268,22 +272,10 @@ ["create", "$L10", "String"],

["create", "$L2", "Array"],
["set", "$L2", "$L1.items"],
["set", "$L2", "$L1"],
["create", "$L3", "Number"],
["size", "$L3", "$L2"],
["create", "$L4", "Number", 0],
["if<than", "$L4", "$L3", 22],
["if<than", "$L4", "$L3", 10],
["create", "$L5", "Object"],
["get", "$L5", "$L2", "$L4"],
["create", "$L7", "CloudMetaData"],
["set", "$L7.name", "$L5.title"],
["if!=than", "$L5.fileSize", null, 1],
["math.add", "$L7.size", "$L5.fileSize", 0],
["if!=than", "$L5.imageMediaMetadata", null, 4],
["get", "$L8", "$L5.imageMediaMetadata.height"],
["get", "$L9", "$L5.imageMediaMetadata.width"],
["create", "$L11", "ImageMetaData", "$L8", "$L9"],
["set", "$L7.imageMetaData", "$L4"],
["if==than", "$L5.mimeType", "application/vnd.google-apps.folder", 2],
["set", "$L7.Folder", 1],
["jumpRel", 1],
["set", "$L7.Folder", 0],
["callFunc", "makeMetaData", "$P0", "$L7", "$L5", "$P2"],
["if==than", "$P2", "/", 2],

@@ -295,5 +287,96 @@ ["string.concat", "$L7.path", "/", "$L7.name"],

["math.add", "$L4", "$L4", 1],
["jumpRel", -23],
["jumpRel", -11],
["set", "$P1", "$L10"]
],
"getChildrenPage": [
["callFunc", "validatePath", "$P0", "$P2"],
["callFunc", "checkAuthentication", "$P0"],
["create", "$L0", "String"],
["callFunc", "resolvePath", "$P0", "$L0", "$P2"],
["create", "$P1", "Array"],
["if!=than", "$P0.paginationCache.path", "$P2", 34],
["jumpRel", 1],
["if<than", "$P3", "$P0.paginationCache.offset", 32],
["set", "$P0.paginationCache.path", "$P2"],
["set", "$P0.P0.paginationCache.offset", 0],
["create", "$P0.paginationCache.metaCache", "Array"],
["create", "$L1", "String", "https://www.googleapis.com/drive/v3/files?fields=files(id%2CmimeType%2Cname%2Csize%2Ctrashed)%2Ckind%2CnextPageToken&q="],
["create", "$L2", "String"],
["string.concat", "$L2", "'", "$L0", "'", " in parents"],
["string.urlEncode", "$L2", "$L2"],
["string.concat", "$L1", "$L1", "$L2"],
["create", "$L2", "Object"],
["set", "$L2.url", "$L1"],
["set", "$L2.method", "GET"],
["create", "$L3", "Object"],
["create", "$L4", "String"],
["string.concat", "$L4", "Bearer ", "$S0.accessToken"],
["set", "$L3", "$L4", "Authorization"],
["set", "$L2.requestHeaders", "$L3"],
["create", "$L5", "Object"],
["http.requestCall", "$L5", "$L2"],
["callFunc", "validateResponse", "$P0", "$L5"],
["create", "$L6", "Object"],
["json.parse", "$L6", "$L5.responseBody"],
["create", "$L7", "Number"],
["size", "$L8", "$L6.files"],
["if<than", "$L7", "$L8", 6],
["get", "$L9", "$L6.files", "$L7"],
["if==than", "$L9.trashed", 0, 2],
["callFunc", "makeMetaData", "$P0", "$L10", "$L9", "$P2"],
["push", "$P0.paginationCache.metaCache", "$L10"],
["math.add", "$L7", "$L7", 1],
["jumpRel", -7],
["set", "$P0.paginationCache.cursor", "$L6.nextPageToken"],
["jumpRel", -35],
["create", "$L0", "Number"],
["size", "$L0", "$P0.paginationCache.metaCache"],
["math.add", "$L0", "$L0", "$P0.paginationCache.offset"],
["if<than", "$P3", "$L0", 14],
["math.multiply", "$L1", "$P0.paginationCache.offset", -1],
["math.add", "$L1", "$L1", "$P3"],
["size", "$L0", "$P1"],
["if<than", "$L0", "$P4", 9],
["get", "$L2", "$P0.paginationCache.metaCache", "$L1"],
["push", "$P1", "$L2"],
["math.add", "$L1", "$L1", 1],
["size", "$L3", "$P0.paginationCache.metaCache"],
["if==than", "$L3", "$L1", 3],
["size", "$L4", "$P0.paginationCache.metaCache"],
["math.add", "$P3", "$L4", "$P0.paginationCache.offset"],
["jumpRel", 2],
["jumpRel", -11],
["return"],
["if==than", "$P0.paginationCache.cursor", null, 1],
["return"],
["size", "$L2", "$P0.paginationCache.metaCache"],
["math.add", "$P0.paginationCache.offset", "$P0.paginationCache.offset", "$L2"],
["create", "$P0.paginationCache.metaCache", "Array"],
["create", "$L1", "String", "https://www.googleapis.com/drive/v3/files?fields=files(id%2CmimeType%2Cname%2Csize%2Ctrashed)%2Ckind%2CnextPageToken&pageToken="],
["string.concat", "$L1", "$L1", "$P0.paginationCache.cursor"],
["create", "$L2", "Object"],
["set", "$L2.url", "$L1"],
["set", "$L2.method", "GET"],
["create", "$L3", "Object"],
["create", "$L4", "String"],
["string.concat", "$L4", "Bearer ", "$S0.accessToken"],
["set", "$L3", "$L4", "Authorization"],
["set", "$L2.requestHeaders", "$L3"],
["create", "$L5", "Object"],
["http.requestCall", "$L5", "$L2"],
["callFunc", "validateResponse", "$P0", "$L5"],
["create", "$L6", "Object"],
["json.parse", "$L6", "$L5.responseBody"],
["create", "$L7", "Number"],
["size", "$L8", "$L6.files"],
["if<than", "$L7", "$L8", 6],
["get", "$L9", "$L6.files", "$L7"],
["if==than", "$L9.trashed", 0, 2],
["callFunc", "makeMetaData", "$P0", "$L10", "$L9", "$P2"],
["push", "$P0.paginationCache.metaCache", "$L10"],
["math.add", "$L7", "$L7", 1],
["jumpRel", -7],
["set", "$P0.paginationCache.cursor", "$L6.nextPageToken"],
["jumpRel", -84]
],
"uploadGD": [

@@ -471,7 +554,7 @@ ["callFunc", "validatePath", "$P0", "$P1"],

["callFunc", "getRawMetadataByID", "$P0", "$L2", "$L0"],
["set", "$P1", "$L2.alternateLink"]
["set", "$P1", "$L2.webViewLink"]
],
"resolvePath": [
["if==than", "$P2", "/", 2],
["set", "$P1", "root"],
["set", "$P1", "$S0.rootID"],
["return"],

@@ -540,6 +623,9 @@ ["create", "$L0", "Number"],

["create", "$L1", "String"],
["string.concat", "$L1", "title = '", "$P2", "'"],
["string.concat", "$L1", "name = '", "$P2", "'"],
["string.urlEncode", "$L1", "$L1"],
["create", "$L10", "String"],
["string.concat", "$L10", "&files(createdTime,imageMediaMetadata(height,width),mimeType,modifiedTime,name,parents,size,trashed,id),kind"],
["string.urlEncode", "$L10", "$L10"],
["create", "$L2", "String"],
["string.concat", "$L2", "https://www.googleapis.com/drive/v2/files?q=", "$L1"],
["string.concat", "$L2", "https://www.googleapis.com/drive/v3/files?q=", "$L1", "&fields=files(createdTime%2CimageMediaMetadata(height%2Cwidth)%2CmimeType%2CmodifiedTime%2Cname%2Cparents%2Csize%2Ctrashed%2Cid)%2Ckind"],
["set", "$L0.url", "$L2"],

@@ -559,7 +645,7 @@ ["create", "$L3", "Object"],

["create", "$L8", "Number"],
["size", "$L8", "$L6.items"],
["size", "$L8", "$L6.files"],
["if<than", "$L7", "$L8", 6],
["create", "$L9", "Object"],
["get", "$L9", "$L6.items", "$L7"],
["if==than", "$L9.labels.trashed", 0, 1],
["get", "$L9", "$L6.files", "$L7"],
["if==than", "$L9.trashed", 0, 1],
["push", "$P1", "$L9"],

@@ -585,3 +671,3 @@ ["math.add", "$L7", "$L7", 1],

["if==than", "$L1", "/", 4],
["if==than", "$L5.isRoot", 1, 2],
["if==than", "$L5", "$S0.rootID", 2],
["set", "$P1", 1],

@@ -591,4 +677,4 @@ ["return"],

["create", "$L6", "Object"],
["callFunc", "getRawMetadataByID", "$P0", "$L6", "$L5.id"],
["if==than", "$L6.title", "$L1", 5],
["callFunc", "getRawMetadataByID", "$P0", "$L6", "$L5"],
["if==than", "$L6.name", "$L1", 5],
["create", "$L7", "String", "/"],

@@ -604,34 +690,60 @@ ["math.add", "$L2", "$L2", -1],

"getFolderContent": [
["create", "$L0", "String", "https://www.googleapis.com/drive/v2/files?fields=items(id%2CmimeType%2Ctitle%2CfileSize%2Clabels)&q="],
["create", "$L5", "String"],
["string.concat", "$L5", "'", "$P2", "'", " in parents"],
["string.urlEncode", "$L5", "$L5"],
["string.concat", "$L0", "$L0", "$L5"],
["create", "$L1", "Object"],
["set", "$L1.url", "$L0"],
["set", "$L1.method", "GET"],
["create", "$P1", "Array"],
["if==than", "$L0", null, 6],
["create", "$L1", "String", "https://www.googleapis.com/drive/v3/files?fields=files(id%2CmimeType%2Cname%2Csize%2Ctrashed)%2Ckind%2CnextPageToken&q="],
["create", "$L2", "String"],
["string.concat", "$L2", "'", "$P2", "'", " in parents"],
["string.urlEncode", "$L2", "$L2"],
["string.concat", "$L1", "$L1", "$L2"],
["jumpRel", 2],
["create", "$L1", "String", "https://www.googleapis.com/drive/v3/files?fields=files(id%2CmimeType%2Cname%2Csize%2Ctrashed)%2Ckind%2CnextPageToken&pageToken="],
["string.concat", "$L1", "$L1", "$L0"],
["create", "$L2", "Object"],
["create", "$L3", "String"],
["string.concat", "$L3", "Bearer ", "$S0.accessToken"],
["set", "$L2", "$L3", "Authorization"],
["set", "$L1.requestHeaders", "$L2"],
["create", "$L4", "Object"],
["http.requestCall", "$L4", "$L1"],
["callFunc", "validateResponse", "$P0", "$L4"],
["set", "$L2.url", "$L1"],
["set", "$L2.method", "GET"],
["create", "$L3", "Object"],
["create", "$L4", "String"],
["string.concat", "$L4", "Bearer ", "$S0.accessToken"],
["set", "$L3", "$L4", "Authorization"],
["set", "$L2.requestHeaders", "$L3"],
["create", "$L5", "Object"],
["json.parse", "$L5", "$L4.responseBody"],
["create", "$L6", "Array"],
["http.requestCall", "$L5", "$L2"],
["callFunc", "validateResponse", "$P0", "$L5"],
["create", "$L6", "Object"],
["json.parse", "$L6", "$L5.responseBody"],
["create", "$L7", "Number"],
["create", "$L8", "Number"],
["size", "$L8", "$L5.items"],
["size", "$L8", "$L6.files"],
["if<than", "$L7", "$L8", 6],
["create", "$L9", "Object"],
["get", "$L9", "$L5.items", "$L7"],
["if==than", "$L9.labels.trashed", 0, 1],
["push", "$L6", "$L9"],
["get", "$L9", "$L6.files", "$L7"],
["if==than", "$L9.trashed", 0, 1],
["push", "$P1", "$L9"],
["math.add", "$L7", "$L7", 1],
["jumpRel", -7],
["set", "$L5.items", "$L6"],
["set", "$P1", "$L5"]
["if==than", "$L6.nextPageToken", null, 1],
["return"],
["jumpRel", -35]
],
"makeMetaData": [
["create", "$P1", "CloudMetaData"],
["set", "$P1.Name", "$P2.name"],
["if!=than", "$P2.modifiedTime", null, 2],
["create", "$L1", "Date", "$P2.modifiedTime"],
["set", "$P1.modifiedAt", "$L1.time"],
["if!=than", "$P2.size", null, 1],
["math.add", "$P1.Size", "$P2.size", 0],
["if==than", "$P2.mimeType", "application/vnd.google-apps.folder", 2],
["set", "$P1.Folder", 1],
["jumpRel", 1],
["set", "$P1.Folder", 0],
["if!=than", "$P2.imageMediaMetadata", null, 4],
["get", "$L2", "$P2.imageMediaMetadata.height"],
["get", "$L3", "$P2.imageMediaMetadata.width"],
["create", "$L4", "ImageMetaData", "$L2", "$L3"],
["set", "$P1.imageMetaData", "$L4"],
["if==than", "$P3", "/", 2],
["string.concat", "$P1.path", "/", "$P1.name"],
["jumpRel", 1],
["string.concat", "$P1.path", "$P3", "/", "$P1.name"]
],
"getMetadataByID": [

@@ -641,8 +753,8 @@ ["create", "$L0", "Object"],

["create", "$P1", "CloudMetaData"],
["set", "$P1.Name", "$L0.title"],
["if!=than", "$L0.modifiedDate", null, 2],
["create", "$L1", "Date", "$L0.modifiedDate"],
["set", "$P1.Name", "$L0.name"],
["if!=than", "$L0.modifiedTime", null, 2],
["create", "$L1", "Date", "$L0.modifiedTime"],
["set", "$P1.modifiedAt", "$L1.time"],
["if!=than", "$L0.fileSize", null, 1],
["math.add", "$P1.Size", "$L0.fileSize", 0],
["if!=than", "$L0.size", null, 1],
["math.add", "$P1.Size", "$L0.size", 0],
["if==than", "$L0.mimeType", "application/vnd.google-apps.folder", 2],

@@ -661,3 +773,3 @@ ["set", "$P1.Folder", 1],

["create", "$L1", "String"],
["string.concat", "$L1", "https://www.googleapis.com/drive/v2/files/", "$P2"],
["string.concat", "$L1", "https://www.googleapis.com/drive/v3/files/", "$P2", "?fields=modifiedTime%2CwebViewLink%2CthumbnailLink%2CmimeType%2CcreatedTime%2Cid%2CimageMediaMetadata(height%2Cwidth)%2Ckind%2Cname%2Cparents%2Cproperties%2Csize%2Ctrashed"],
["create", "$L2", "Object"],

@@ -679,2 +791,3 @@ ["create", "$L3", "String"],

["callFunc", "authenticate", "$P0", "accessToken"],
["callFunc", "getRootID", "$P0", "$L2"],
["return"],

@@ -684,3 +797,4 @@ ["create", "$L1", "Date"],

["if<than", "$L1", "$L0", 1],
["callFunc", "authenticate", "$P0", "refreshToken"]
["callFunc", "authenticate", "$P0", "refreshToken"],
["callFunc", "getRootID", "$P0", "$L2"]
],

@@ -775,3 +889,3 @@ "authenticate": [

["create", "$L3", "Array"],
["set", "$L3", "$L2.items"],
["set", "$L3", "$L2"],
["create", "$L4", "Array"],

@@ -786,5 +900,5 @@ ["create", "$L5", "Number"],

["create", "$L8", "String"],
["string.concat", "$L8", "$P2", "/", "$L7.title"],
["string.concat", "$L8", "$P2", "/", "$L7.name"],
["create", "$L9", "String"],
["string.concat", "$L9", "$P1", "/", "$L7.title"],
["string.concat", "$L9", "$P1", "/", "$L7.name"],
["callFunc", "copyFolder", "$P0", "$L9", "$L8"],

@@ -858,2 +972,23 @@ ["jumpRel", 1],

["set", "$P1", "$L0"]
],
"getRootID": [
["create", "$L0", "String", "https://www.googleapis.com/drive/v3/files/root"],
["create", "$L5", "String"],
["string.concat", "$L5", ""],
["string.concat", "$L0", "$L0", "$L5"],
["create", "$L1", "Object"],
["set", "$L1.url", "$L0"],
["set", "$L1.method", "GET"],
["create", "$L2", "Object"],
["create", "$L3", "String"],
["string.concat", "$L3", "Bearer ", "$S0.accessToken"],
["set", "$L2", "$L3", "Authorization"],
["set", "$L1.requestHeaders", "$L2"],
["create", "$L4", "Object"],
["http.requestCall", "$L4", "$L1"],
["callFunc", "validateResponse", "$P0", "$L4"],
["create", "$L5", "Object"],
["json.parse", "$L5", "$L4.responseBody"],
["set", "$S0.rootID", "$L5.id"],
["set", "$P1", "$L5.id"]
]

@@ -993,2 +1128,17 @@ };

};
GoogleDrive.prototype.getChildrenPage = function (path, offset, limit, callback) {
Statistics_1.Statistics.addCall("GoogleDrive", "getChildrenPage");
var ip = new Interpreter_1.Interpreter(new Sandbox_1.Sandbox(SERVICE_CODE, this.persistentStorage, this.instanceDependencyStorage));
ip.callFunction("getChildrenPage", this.interpreterStorage, null, path, offset, limit).then(function () {
Helper_1.Helper.checkSandboxError(ip);
}).then(function () {
var res;
res = ip.getParameter(1);
if (callback != null && typeof callback === "function")
callback(undefined, res);
}, function (err) {
if (callback != null && typeof callback === "function")
callback(err);
});
};
GoogleDrive.prototype.getUserLogin = function (callback) {

@@ -995,0 +1145,0 @@ Statistics_1.Statistics.addCall("GoogleDrive", "getUserLogin");

@@ -39,3 +39,7 @@ "use strict";

"init": [
["string.urlEncode", "$P0.redirectUri", "$P0.redirectUri"]
["string.urlEncode", "$P0.redirectUri", "$P0.redirectUri"],
["create", "$P0.paginationCache", "Object"],
["create", "$P0.paginationCache.offset", "Number", 0],
["create", "$P0.paginationCache.path", "String", "grgerfefrgerhggerger"],
["create", "$P0.paginationCache.metaCache", "Array"]
],

@@ -100,4 +104,3 @@ "uploadSC": [

["json.stringify", "$L5", "$L2"],
["size", "$L19", "$L5"],
["string.concat", "$L7.Content-Length", "$L19"],
["callFunc", "byteLength", "$P0", "$L7.Content-Length", "$L5"],
["stream.stringToStream", "$L6", "$L5"],

@@ -162,4 +165,3 @@ ["set", "$L0.url", "$L1"],

["json.stringify", "$L5", "$L2"],
["size", "$L19", "$L5"],
["string.concat", "$L7.Content-Length", "$L19"],
["callFunc", "byteLength", "$P0", "$L7.Content-Length", "$L5"],
["stream.stringToStream", "$L6", "$L5"],

@@ -203,4 +205,3 @@ ["set", "$L0.url", "$L1"],

["json.stringify", "$L6", "$L5"],
["size", "$L19", "$L6"],
["string.concat", "$L4.Content-Length", "$L19"],
["callFunc", "byteLength", "$P0", "$L4.Content-Length", "$L6"],
["stream.stringToStream", "$L7", "$L6"],

@@ -284,2 +285,58 @@ ["set", "$L0.url", "$L1"],

],
"getChildrenPage": [
["callFunc", "validatePath", "$P0", "$P2"],
["callFunc", "checkAuth", "$P0", "$L30"],
["create", "$P1", "Array"],
["if!=than", "$P0.paginationCache.path", "$P2", 18],
["jumpRel", 1],
["if<than", "$P3", "$P0.paginationCache.offset", 16],
["set", "$P0.paginationCache.path", "$P2"],
["set", "$P0.P0.paginationCache.offset", 0],
["create", "$P0.paginationCache.metaCache", "Array"],
["create", "$L0", "Object"],
["create", "$L1", "String"],
["string.urlEncode", "$L28", "$P2"],
["string.concat", "$L1", "https://api.onedrive.com/v1.0/drive/root:", "$L28"],
["string.concat", "$L1", "$L1", ":/children?access_token=", "$L30"],
["set", "$L0.url", "$L1"],
["set", "$L0.method", "GET"],
["http.requestCall", "$L2", "$L0"],
["callFunc", "validateResponse", "$P0", "$L2"],
["json.parse", "$L3", "$L2.responseBody"],
["callFunc", "processRawMeta", "$P0", "$P0.paginationCache.metaCache", "$L3.value", "$P2"],
["get", "$P0.paginationCache.cursor", "$L3", "@odata.nextLink"],
["jumpRel", -19],
["create", "$L0", "Number"],
["size", "$L0", "$P0.paginationCache.metaCache"],
["math.add", "$L0", "$L0", "$P0.paginationCache.offset"],
["if<than", "$P3", "$L0", 14],
["math.multiply", "$L1", "$P0.paginationCache.offset", -1],
["math.add", "$L1", "$L1", "$P3"],
["size", "$L0", "$P1"],
["if<than", "$L0", "$P4", 9],
["get", "$L2", "$P0.paginationCache.metaCache", "$L1"],
["push", "$P1", "$L2"],
["math.add", "$L1", "$L1", 1],
["size", "$L3", "$P0.paginationCache.metaCache"],
["if==than", "$L3", "$L1", 3],
["size", "$L4", "$P0.paginationCache.metaCache"],
["math.add", "$P3", "$L4", "$P0.paginationCache.offset"],
["jumpRel", 2],
["jumpRel", -11],
["return"],
["if==than", "$P0.paginationCache.cursor", null, 1],
["return"],
["create", "$L0", "Object"],
["set", "$L0.url", "$P0.paginationCache.cursor"],
["set", "$L0.method", "GET"],
["http.requestCall", "$L1", "$L0"],
["callFunc", "validateResponse", "$P0", "$L1"],
["json.parse", "$L2", "$L1.responseBody"],
["size", "$L3", "$P0.paginationCache.metaCache"],
["math.add", "$P0.paginationCache.offset", "$P0.paginationCache.offset", "$L3"],
["create", "$P0.paginationCache.metaCache", "Array"],
["callFunc", "processRawMeta", "$P0", "$P0.paginationCache.metaCache", "$L2.value", "$P2"],
["get", "$P0.paginationCache.cursor", "$L2", "@odata.nextLink"],
["jumpRel", -51]
],
"getAllocation": [

@@ -334,2 +391,30 @@ ["callFunc", "checkAuth", "$P0", "$L10"],

],
"processRawMeta": [
["size", "$L0", "$P2"],
["create", "$L1", "Number", 0],
["if<than", "$L1", "$L0", 23],
["get", "$L10", "$P2", "$L1"],
["create", "$L9", "CloudMetaData"],
["set", "$L9.Name", "$L10.name"],
["set", "$L9.Size", "$L10.size"],
["if!=than", "$L10.lastModifiedDateTime", null, 2],
["create", "$L20", "Date", "$L10.lastModifiedDateTime"],
["set", "$L9.modifiedAt", "$L20.time"],
["if!=than", "$L10.image", null, 4],
["get", "$L11", "$L10.image.height"],
["get", "$L12", "$L10.image.width"],
["create", "$L13", "ImageMetaData", "$L11", "$L12"],
["set", "$L10.ImageMetaData", "$L13"],
["if==than", "$L10.folder", null, 2],
["set", "$L9.Folder", 0],
["jumpRel", 1],
["set", "$L9.Folder", 1],
["if==than", "$P3", "/", 2],
["string.concat", "$L9.Path", "$P3", "$L9.Name"],
["jumpRel", 1],
["string.concat", "$L9.Path", "$P3", "/", "$L9.Name"],
["push", "$P1", "$L9"],
["math.add", "$L1", "$L1", 1],
["jumpRel", -24]
],
"exists": [

@@ -544,4 +629,3 @@ ["callFunc", "validatePath", "$P0", "$P2"],

["stream.stringToStream", "$L7", "$L6"],
["size", "$L19", "$L6"],
["string.concat", "$L2.Content-Length", "$L19"],
["callFunc", "byteLength", "$P0", "$L2.Content-Length", "$L6"],
["set", "$L0.url", "$L1"],

@@ -624,4 +708,3 @@ ["set", "$L0.method", "POST"],

["set", "$L4", "application/x-www-form-urlencoded", "Content-Type"],
["size", "$L19", "$L2"],
["string.concat", "$L4.Content-Length", "$L19"],
["callFunc", "byteLength", "$P0", "$L4.Content-Length", "$L2"],
["create", "$L5", "Object"],

@@ -643,2 +726,8 @@ ["set", "$L5.url", "https://login.live.com/oauth20_token.srf"],

["set", "$P1", "$L8.access_token"]
],
"byteLength": [
["stream.stringToStream", "$P1", "$P2"],
["stream.streamToData", "$P1", "$P1"],
["size", "$P1", "$P1"],
["string.concat", "$P1", "$P1"]
]

@@ -778,2 +867,17 @@ };

};
OneDrive.prototype.getChildrenPage = function (path, offset, limit, callback) {
Statistics_1.Statistics.addCall("OneDrive", "getChildrenPage");
var ip = new Interpreter_1.Interpreter(new Sandbox_1.Sandbox(SERVICE_CODE, this.persistentStorage, this.instanceDependencyStorage));
ip.callFunction("getChildrenPage", this.interpreterStorage, null, path, offset, limit).then(function () {
Helper_1.Helper.checkSandboxError(ip);
}).then(function () {
var res;
res = ip.getParameter(1);
if (callback != null && typeof callback === "function")
callback(undefined, res);
}, function (err) {
if (callback != null && typeof callback === "function")
callback(err);
});
};
OneDrive.prototype.getUserLogin = function (callback) {

@@ -780,0 +884,0 @@ Statistics_1.Statistics.addCall("OneDrive", "getUserLogin");

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc