Skip to content

Commit b4cdde9

Browse files
authored
Merge branch 'master' into 18178-buddee
2 parents 724b2cc + 43c37a6 commit b4cdde9

File tree

385 files changed

+6495
-986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+6495
-986
lines changed

components/apimage/apimage.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/aws/.upm/store.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":2,"languages":{"nodejs-npm":{"guessedImports":["aws-sdk","axios","shortid"],"guessedImportsHash":"08190b61ee0169fd35ea81dce6f4754d"}}}
1+
{"version":2, "languages":{"nodejs-npm":{"guessedImports":["aws-sdk", "axios", "shortid"], "guessedImportsHash":"08190b61ee0169fd35ea81dce6f4754d"}}}

components/aws/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/aws",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Pipedream Aws Components",
55
"main": "aws.app.mjs",
66
"keywords": [
@@ -34,6 +34,7 @@
3434
"@pipedream/platform": "^3.1.0",
3535
"adm-zip": "^0.5.10",
3636
"dedent": "^1.5.1",
37+
"file-type": "^21.0.0",
3738
"mailparser": "^3.6.6",
3839
"mailparser-mit": "^1.0.0",
3940
"nanoid": "^5.0.4",
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { Readable } from "stream";
2+
import { fileTypeFromBuffer } from "file-type";
3+
4+
export default {
5+
props: {
6+
includeLink: {
7+
label: "Include Link",
8+
type: "boolean",
9+
description: "Upload file to your File Stash and emit temporary download link to the file. See [the docs](https://pipedream.com/docs/connect/components/files) to learn more about working with files in Pipedream.",
10+
default: false,
11+
optional: true,
12+
},
13+
dir: {
14+
type: "dir",
15+
accessMode: "write",
16+
optional: true,
17+
},
18+
},
19+
methods: {
20+
async streamToBuffer(stream) {
21+
const chunks = [];
22+
for await (const chunk of stream) {
23+
chunks.push(chunk);
24+
}
25+
return Buffer.concat(chunks);
26+
},
27+
async stashFile(item) {
28+
const { Body } = await this.getObject({
29+
Bucket: item.bucket.name,
30+
Key: item.object.key.replace(/\+/g, " "),
31+
});
32+
const filepath = `${item.bucket.name}/${item.object.key}`;
33+
const buffer = await this.streamToBuffer(Body);
34+
const type = await fileTypeFromBuffer(buffer);
35+
// Upload the attachment to the configured directory (File Stash) so it
36+
// can be accessed later.
37+
const file = await this.dir.open(filepath).fromReadableStream(
38+
Readable.from(buffer),
39+
type?.mime,
40+
buffer.length,
41+
);
42+
// Return file details and temporary download link:
43+
// { path, get_url, s3Key, type }
44+
return await file.withoutPutUrl().withGetUrl();
45+
},
46+
async processEvent(event) {
47+
const { Message: rawMessage } = event.body;
48+
const {
49+
Records: s3Events = [],
50+
Event: eventType,
51+
} = JSON.parse(rawMessage);
52+
53+
if (eventType === "s3:TestEvent") {
54+
console.log("Received initial test event. Skipping...");
55+
return;
56+
}
57+
58+
for (const s3Event of s3Events) {
59+
const meta = this.generateMeta(s3Event);
60+
let { s3: item } = s3Event;
61+
if (this.includeLink) {
62+
item.file = await this.stashFile(item);
63+
}
64+
this.$emit(item, meta);
65+
}
66+
},
67+
},
68+
};

components/aws/sources/s3-new-file/s3-new-file.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import base from "../common/s3.mjs";
2+
import includeLink from "../common/include-link.mjs";
23

34
export default {
45
...base,
56
type: "source",
67
key: "aws-s3-new-file",
78
name: "New S3 File",
89
description: "Emit new event when a file is added to an S3 bucket",
9-
version: "0.1.4",
10+
version: "0.2.0",
1011
dedupe: "unique",
12+
props: {
13+
...base.props,
14+
...includeLink.props,
15+
},
1116
methods: {
1217
...base.methods,
18+
...includeLink.methods,
1319
getEvents() {
1420
return [
1521
"s3:ObjectCreated:*",

components/aws/sources/s3-restored-file/s3-restored-file.mjs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
import base from "../common/s3.mjs";
2+
import includeLink from "../common/include-link.mjs";
23

34
export default {
45
...base,
56
type: "source",
67
key: "aws-s3-restored-file",
78
name: "New Restored S3 File",
8-
description: "Emit new event when an file is restored into a S3 bucket",
9-
version: "0.1.4",
9+
description: "Emit new event when a file is restored into an S3 bucket",
10+
version: "0.2.0",
1011
dedupe: "unique",
1112
props: {
13+
info: {
14+
type: "alert",
15+
alertType: "info",
16+
content: "Allows receipt of notifications for event initiation and completion when restoring objects from the **S3 Glacier Flexible Retrieval** storage class, **S3 Glacier Deep Archive** storage class, **S3 Intelligent-Tiering Archive Access tier**, and **S3 Intelligent-Tiering Deep Archive Access tier**.",
17+
},
1218
...base.props,
1319
detectRestoreInitiation: {
1420
type: "boolean",
1521
label: "Detect Restore Initiation",
1622
description: "When enabled, this event source will also emit events whenever a restore is initiated",
1723
default: false,
1824
},
25+
...includeLink.props,
1926
},
2027
methods: {
2128
...base.methods,
29+
...includeLink.methods,
2230
getEvents() {
2331
return [
2432
this.detectRestoreInitiation
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import app from "../../billbee.app.mjs";
2+
3+
export default {
4+
key: "billbee-add-shipment-to-order",
5+
name: "Add Shipment To Order",
6+
description: "Add a shipment to an existing order. [See the documentation](https://app.billbee.io//swagger/ui/index#/Orders/OrderApi_AddShipment)",
7+
type: "action",
8+
version: "0.0.1",
9+
props: {
10+
app,
11+
orderId: {
12+
propDefinition: [
13+
app,
14+
"orderId",
15+
],
16+
},
17+
shippingProviderId: {
18+
propDefinition: [
19+
app,
20+
"shippingProviderId",
21+
],
22+
},
23+
shippingProviderProductId: {
24+
label: "Shipping Provider Product ID",
25+
description: "The ID of the shipping provider product/service",
26+
propDefinition: [
27+
app,
28+
"shipment",
29+
({
30+
orderId, shippingProviderId,
31+
}) => ({
32+
orderId,
33+
shippingProviderId,
34+
mapper: ({ ShippingProviderProductId: value }) => value,
35+
}),
36+
],
37+
},
38+
shippingId: {
39+
label: "Shipping ID",
40+
description: "The ID of the shipment",
41+
propDefinition: [
42+
app,
43+
"shipment",
44+
({
45+
orderId, shippingProviderId,
46+
}) => ({
47+
orderId,
48+
shippingProviderId,
49+
mapper: ({ ShippingId: value }) => value,
50+
}),
51+
],
52+
},
53+
carrierId: {
54+
propDefinition: [
55+
app,
56+
"carrierId",
57+
],
58+
},
59+
shipmentType: {
60+
propDefinition: [
61+
app,
62+
"shipmentType",
63+
],
64+
},
65+
comment: {
66+
type: "string",
67+
label: "Comment",
68+
description: "Additional comment for the shipment",
69+
optional: true,
70+
},
71+
},
72+
async run({ $ }) {
73+
const {
74+
app,
75+
orderId,
76+
shippingProviderId,
77+
shippingProviderProductId,
78+
comment,
79+
shippingId,
80+
carrierId,
81+
shipmentType,
82+
} = this;
83+
84+
await app.addShipmentToOrder({
85+
$,
86+
orderId,
87+
data: {
88+
ShippingProviderId: shippingProviderId,
89+
ShippingProviderProductId: shippingProviderProductId,
90+
Comment: comment,
91+
ShippingId: shippingId,
92+
CarrierId: carrierId,
93+
ShipmentType: shipmentType,
94+
},
95+
});
96+
97+
$.export("$summary", `Successfully added shipment to order \`${orderId}\``);
98+
99+
return {
100+
success: true,
101+
};
102+
},
103+
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import app from "../../billbee.app.mjs";
2+
3+
export default {
4+
key: "billbee-change-order-state",
5+
name: "Change Order State",
6+
description: "Change the state of an order. [See the documentation](https://app.billbee.io//swagger/ui/index#/Orders/OrderApi_UpdateState)",
7+
type: "action",
8+
version: "0.0.1",
9+
props: {
10+
app,
11+
orderId: {
12+
propDefinition: [
13+
app,
14+
"orderId",
15+
],
16+
},
17+
newStateId: {
18+
type: "string",
19+
label: "New Order State",
20+
description: "The new state for the order",
21+
optional: false,
22+
propDefinition: [
23+
app,
24+
"orderStateId",
25+
],
26+
},
27+
},
28+
async run({ $ }) {
29+
const {
30+
app,
31+
orderId,
32+
newStateId,
33+
} = this;
34+
35+
await app.changeOrderState({
36+
$,
37+
orderId,
38+
data: {
39+
NewStateId: parseInt(newStateId),
40+
},
41+
});
42+
43+
$.export("$summary", "Successfully changed order state");
44+
45+
return {
46+
success: true,
47+
};
48+
},
49+
};
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import app from "../../billbee.app.mjs";
2+
3+
export default {
4+
key: "billbee-create-invoice-for-order",
5+
name: "Create Invoice For Order",
6+
description: "Create an invoice for an existing order. [See the documentation](https://app.billbee.io//swagger/ui/index#/Orders/OrderApi_CreateInvoice)",
7+
type: "action",
8+
version: "0.0.1",
9+
props: {
10+
app,
11+
orderId: {
12+
propDefinition: [
13+
app,
14+
"orderId",
15+
],
16+
},
17+
templateId: {
18+
type: "string",
19+
label: "Template ID",
20+
description: "The ID of the invoice template to use",
21+
optional: true,
22+
},
23+
includeInvoicePdf: {
24+
type: "boolean",
25+
label: "Include Invoice PDF",
26+
description: "If true, the PDF is included in the response as base64 encoded string",
27+
optional: true,
28+
},
29+
sendToCloudId: {
30+
label: "Send To Cloud ID",
31+
propDefinition: [
32+
app,
33+
"cloudStorageId",
34+
],
35+
},
36+
},
37+
async run({ $ }) {
38+
const {
39+
app,
40+
orderId,
41+
templateId,
42+
includeInvoicePdf,
43+
sendToCloudId,
44+
} = this;
45+
46+
await app.createInvoiceForOrder({
47+
$,
48+
orderId,
49+
data: {
50+
TemplateId: templateId,
51+
IncludeInvoicePdf: includeInvoicePdf,
52+
SendToCloudId: sendToCloudId,
53+
},
54+
});
55+
56+
$.export("$summary", `Successfully created invoice for order \`${orderId}\``);
57+
58+
return {
59+
success: true,
60+
};
61+
},
62+
};

0 commit comments

Comments
 (0)