Skip to content

Commit 1fa2077

Browse files
committed
revert source changes
1 parent 736411b commit 1fa2077

File tree

2 files changed

+6
-61
lines changed

2 files changed

+6
-61
lines changed
Lines changed: 5 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
2-
import fs from "fs";
32

43
export default {
54
dedupe: "unique",
@@ -34,30 +33,6 @@ export default {
3433
"any",
3534
],
3635
},
37-
downloadEnvelopeDocuments: {
38-
type: "string",
39-
label: "Download Envelope Documents",
40-
description: "Download envelope documents to the `/tmp` directory",
41-
options: [
42-
{
43-
label: "All Documents (PDF)",
44-
value: "combined",
45-
},
46-
{
47-
label: "All Documents (Zip)",
48-
value: "archive",
49-
},
50-
{
51-
label: "Certificate (PDF)",
52-
value: "certificate",
53-
},
54-
{
55-
label: "Portfolio (PDF)",
56-
value: "portfolio",
57-
},
58-
],
59-
optional: true,
60-
},
6136
},
6237
methods: {
6338
_getLastEvent() {
@@ -81,23 +56,6 @@ export default {
8156
ts,
8257
};
8358
},
84-
getFilePath(envelopeId) {
85-
const extension = this.downloadEnvelopeDocuments === "archive"
86-
? "zip"
87-
: "pdf";
88-
return `/tmp/${envelopeId}.${extension}`;
89-
},
90-
async downloadToTmp(baseUri, documentsUri, filePath) {
91-
const content = await this.docusign._makeRequest({
92-
config: {
93-
url: `${baseUri}${documentsUri.slice(1)}/${this.downloadEnvelopeDocuments}`,
94-
responseType: "arraybuffer",
95-
},
96-
});
97-
const rawcontent = content.toString("base64");
98-
const buffer = Buffer.from(rawcontent, "base64");
99-
fs.writeFileSync(filePath, buffer);
100-
},
10159
},
10260
async run(event) {
10361
const { timestamp: ts } = event;
@@ -110,9 +68,6 @@ export default {
11068
from_date: lastEvent,
11169
status: this.status.join(),
11270
};
113-
114-
const newEnvelopes = [];
115-
11671
do {
11772
const {
11873
envelopes = [],
@@ -123,22 +78,12 @@ export default {
12378
params.start_position += endPosition + 1;
12479
}
12580
else done = true;
126-
newEnvelopes.push(...envelopes);
127-
} while (!done);
128-
129-
this._setLastEvent(new Date(ts * 1000).toISOString());
13081

131-
for (const envelope of newEnvelopes) {
132-
if (this.downloadEnvelopeDocuments) {
133-
const filePath = this.getFilePath(envelope.envelopeId);
134-
await this.downloadToTmp(baseUri, envelope.documentsUri, filePath);
135-
envelope.documents = {
136-
filePath,
137-
};
82+
for (const envelope of envelopes) {
83+
const meta = this.generateMeta(envelope);
84+
this.$emit(envelope, meta);
13885
}
139-
console.log(fs.readdirSync("/tmp"));
140-
const meta = this.generateMeta(envelope);
141-
this.$emit(envelope, meta);
142-
}
86+
} while (!done);
87+
this._setLastEvent(new Date(ts * 1000).toISOString());
14388
},
14489
};

components/docusign/sources/new-change-in-envelope-status/new-change-in-envelope-status.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import common from "./common.mjs";
44
export default {
55
...common,
66
key: "docusign-new-change-in-envelope-status",
7-
version: "0.0.2",
7+
version: "0.0.1",
88
name: "New Change in Envelope Status",
99
description: "Emit new event when an envelope's status is updated",
1010
type: "source",

0 commit comments

Comments
 (0)