-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create Get New And Updated Files Polling Trigger * Create Upsert File Action * Create Create Folder Action * Create Get File Action * Create Delete File Action
- Loading branch information
Olha Virolainen
authored
Mar 26, 2020
1 parent
49c634e
commit 03e49c7
Showing
33 changed files
with
1,906 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# 0.0.1 (March 2, 2020) | ||
# 1.0.0 (March 26, 2020) | ||
|
||
* Project Init | ||
* Create Get New And Updated Files Polling Trigger | ||
* Create Upsert File Action | ||
* Create Create Folder Action | ||
* Create Get File Action | ||
* Create Delete File Action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { messages } = require('elasticio-node'); | ||
const { Client } = require('../client'); | ||
|
||
exports.getDisks = require('../utils/metadataDrivesProcessor').getDisks; | ||
|
||
exports.process = async function (msg, cfg) { | ||
this.logger.info('Create folder action started'); | ||
this.logger.trace('Input message: %j', msg); | ||
this.logger.trace('Input configuration: %j', cfg); | ||
const { path, name } = msg.body; | ||
const client = new Client(this.logger, cfg); | ||
const id = await client.isExist(path); | ||
if (id === false || id === null || id === undefined) { | ||
this.logger.error('Cant create folder in path: %s. Path is not exist in drive: %s', path, cfg.driveId); | ||
throw new Error(`Error: Path: "${path}" is not exist in drive: ${cfg.driveId}`); | ||
} | ||
const body = await client.createFolder(id, name); | ||
this.logger.trace('Successfully create folder in path: %s', path); | ||
this.logger.trace('Emitting body: %j', body); | ||
this.logger.info('Create folder finished'); | ||
return messages.newMessageWithBody({ result: body }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { messages } = require('elasticio-node'); | ||
|
||
const { Client } = require('../client'); | ||
const { OneDriveDelete } = require('../utils/deleteUtil'); | ||
|
||
exports.process = async function (msg, cfg) { | ||
this.logger.trace('Input message: %j', msg); | ||
this.logger.trace('Input configuration: %j', cfg); | ||
|
||
const client = new Client(this.logger, cfg); | ||
const deleteUtils = new OneDriveDelete(this.logger, client); | ||
|
||
try { | ||
await deleteUtils.deleteObject(msg.body.path); | ||
return messages.newMessageWithBody({ path: msg.body.path }); | ||
} catch (err) { | ||
if (err.message.includes('itemNotFound')) { | ||
return messages.newEmptyMessage(); | ||
} | ||
throw err; | ||
} | ||
}; | ||
|
||
|
||
exports.getDisks = require('../utils/metadataDrivesProcessor').getDisks; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.