Skip to content

Commit ea6be31

Browse files
authored
Merge branch 'master' into issue-12998
2 parents de7e522 + c73c341 commit ea6be31

File tree

312 files changed

+8348
-1614
lines changed

Some content is hidden

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

312 files changed

+8348
-1614
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on:
2+
push:
3+
branches:
4+
- platform-1.x
5+
- platform-2.x
6+
7+
jobs:
8+
# See https://pnpm.io/continuous-integration#github-actions
9+
publish:
10+
name: pnpm publish
11+
runs-on: ubuntu-latest
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
steps:
15+
- uses: actions/checkout@v4.1.7
16+
- uses: pnpm/action-setup@v4.0.0
17+
with:
18+
version: 7.33.6
19+
- uses: actions/setup-node@v4.0.3
20+
with:
21+
node-version: 18
22+
registry-url: https://registry.npmjs.org/
23+
cache: 'pnpm'
24+
- name: pnpm install
25+
run: pnpm install -r --no-frozen-lockfile
26+
- name: Compile TypeScript
27+
run: npm run build
28+
# See https://pnpm.io/using-changesets
29+
- name: Setup npmrc for pnpm publish
30+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
31+
- name: pnpm publish (platform)
32+
run: pnpm publish platform --no-git-checks
Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,76 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "_8x8_connect",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
destination: {
8+
type: "string",
9+
label: "Destination",
10+
description: "Destination of the SMS, i.e. `+12124567890`",
11+
},
12+
text: {
13+
type: "string",
14+
label: "Text",
15+
description: "The text of the message",
16+
},
17+
from: {
18+
type: "string",
19+
label: "From",
20+
description: "The initial date of the log, i.e. `2024-08-14T00:00:00`",
21+
},
22+
to: {
23+
type: "string",
24+
label: "To",
25+
description: "The initial date of the log, i.e. `2024-08-15T10:00:00`",
26+
},
27+
jobId: {
28+
type: "string",
29+
label: "Log ID",
30+
description: "The ID of the log",
31+
},
32+
},
533
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
34+
_baseUrl() {
35+
return `${this.$auth.base_url}/api/v1`;
36+
},
37+
async _makeRequest(opts = {}) {
38+
const {
39+
$ = this,
40+
path,
41+
headers,
42+
...otherOpts
43+
} = opts;
44+
return axios($, {
45+
...otherOpts,
46+
url: this._baseUrl() + path,
47+
headers: {
48+
...headers,
49+
Authorization: `Bearer ${this.$auth.api_key}`,
50+
},
51+
});
52+
},
53+
async sendSms(args = {}) {
54+
return this._makeRequest({
55+
method: "post",
56+
path: `/subaccounts/${this.$auth.subaccount_id}/messages`,
57+
...args,
58+
});
59+
},
60+
async requestLog(args = {}) {
61+
return this._makeRequest({
62+
method: "post",
63+
path: `/subaccounts/${this.$auth.subaccount_id}/messages/exports`,
64+
...args,
65+
});
66+
},
67+
async getLog({
68+
jobId, ...args
69+
}) {
70+
return this._makeRequest({
71+
path: `/subaccounts/${this.$auth.subaccount_id}/messages/exports/${jobId}`,
72+
...args,
73+
});
974
},
1075
},
1176
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import app from "../../_8x8_connect.app.mjs";
2+
3+
export default {
4+
key: "_8x8_connect-get-log-result",
5+
name: "Get Log Result",
6+
description: "Check the status of an SMS Logs export job and to get a download link if its generation has succeeded. [See the documentation](https://developer.8x8.com/connect/reference/get-log-export-job-result)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
jobId: {
12+
propDefinition: [
13+
app,
14+
"jobId",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.app.getLog({
20+
$,
21+
jobId: this.jobId,
22+
});
23+
24+
$.export("$summary", `Successfully retrieved the log status: '${response.status}'`);
25+
26+
return response;
27+
},
28+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import app from "../../_8x8_connect.app.mjs";
2+
3+
export default {
4+
key: "_8x8_connect-request-log",
5+
name: "Request Log",
6+
description: "Request an SMS log file. [See the documentation](https://developer.8x8.com/connect/reference/start-log-export-job)",
7+
version: "0.0.4",
8+
type: "action",
9+
props: {
10+
app,
11+
destination: {
12+
propDefinition: [
13+
app,
14+
"destination",
15+
],
16+
optional: true,
17+
},
18+
from: {
19+
propDefinition: [
20+
app,
21+
"from",
22+
],
23+
},
24+
to: {
25+
propDefinition: [
26+
app,
27+
"to",
28+
],
29+
},
30+
},
31+
async run({ $ }) {
32+
const response = await this.app.requestLog({
33+
$,
34+
data: {
35+
phoneNumber: this.destination,
36+
from: this.from,
37+
to: this.to,
38+
},
39+
});
40+
41+
$.export("$summary", `Successfully requested SMS log. You will need the following ID get the request result: '${response.jobId}'`);
42+
43+
return response;
44+
},
45+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import app from "../../_8x8_connect.app.mjs";
2+
3+
export default {
4+
key: "_8x8_connect-send-sms",
5+
name: "Send SMS",
6+
description: "Send a SMS to the specified destination. [See the documentation](https://developer.8x8.com/connect/reference/send-sms-single)",
7+
version: "0.0.2",
8+
type: "action",
9+
props: {
10+
app,
11+
destination: {
12+
propDefinition: [
13+
app,
14+
"destination",
15+
],
16+
},
17+
text: {
18+
propDefinition: [
19+
app,
20+
"text",
21+
],
22+
},
23+
24+
},
25+
async run({ $ }) {
26+
const response = await this.app.sendSms({
27+
$,
28+
data: {
29+
destination: this.destination,
30+
text: this.text,
31+
},
32+
});
33+
34+
$.export("$summary", `Successfully queued SMS for processing. ID: '${response.umid}'`);
35+
36+
return response;
37+
},
38+
};

components/_8x8_connect/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/_8x8_connect",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream 8x8 Connect Components",
55
"main": "_8x8_connect.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.0"
1417
}
15-
}
18+
}
Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,67 @@
1+
import { axios } from "@pipedream/platform";
2+
import { LIMIT } from "./common/constants.mjs";
3+
14
export default {
25
type: "app",
36
app: "activecalculator",
4-
propDefinitions: {},
7+
propDefinitions: {
8+
calculatorIds: {
9+
type: "string[]",
10+
label: "Calculator Ids",
11+
description: "A list of calculator's Ids.",
12+
async options({ page }) {
13+
const { data } = await this.listCalculators({
14+
params: {
15+
limit: LIMIT,
16+
offset: LIMIT * page,
17+
},
18+
});
19+
20+
return data.map(({
21+
id: value, name: label,
22+
}) => ({
23+
label,
24+
value,
25+
}));
26+
},
27+
},
28+
},
529
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
30+
_baseUrl() {
31+
return "https://app.activecalculator.com/api/v1";
32+
},
33+
_headers() {
34+
return {
35+
"x-ac-api-key": `${this.$auth.api_key}`,
36+
};
37+
},
38+
_makeRequest({
39+
$ = this, path, ...opts
40+
}) {
41+
return axios($, {
42+
url: this._baseUrl() + path,
43+
headers: this._headers(),
44+
...opts,
45+
});
46+
},
47+
listCalculators(opts = {}) {
48+
return this._makeRequest({
49+
path: "/calculators",
50+
...opts,
51+
});
52+
},
53+
createWebhook(opts = {}) {
54+
return this._makeRequest({
55+
method: "POST",
56+
path: "/webhooks",
57+
...opts,
58+
});
59+
},
60+
deleteWebhook(webhookId) {
61+
return this._makeRequest({
62+
method: "DELETE",
63+
path: `/webhooks/${webhookId}`,
64+
});
965
},
1066
},
1167
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const LIMIT = 100;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export const parseObject = (obj) => {
2+
if (!obj) return undefined;
3+
4+
if (Array.isArray(obj)) {
5+
return obj.map((item) => {
6+
if (typeof item === "string") {
7+
try {
8+
return JSON.parse(item);
9+
} catch (e) {
10+
return item;
11+
}
12+
}
13+
return item;
14+
});
15+
}
16+
if (typeof obj === "string") {
17+
try {
18+
return JSON.parse(obj);
19+
} catch (e) {
20+
return obj;
21+
}
22+
}
23+
return obj;
24+
};

components/activecalculator/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/activecalculator",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream ActiveCalculator Components",
55
"main": "activecalculator.app.mjs",
66
"keywords": [
@@ -11,5 +11,9 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.0"
1417
}
15-
}
18+
}
19+

0 commit comments

Comments
 (0)