Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions components/adalo/actions/common/base.mjs

This file was deleted.

8 changes: 3 additions & 5 deletions components/adalo/actions/create-record/create-record.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import base from "../common/base.mjs";
import adalo from "../../adalo.app.mjs";

export default {
...base,
key: "adalo-create-record",
name: "Create Record",
description: "Create a new record. [See docs here](https://help.adalo.com/integrations/the-adalo-api/collections)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
...base.props,
adalo,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: Updated props configuration.

The direct reference to the adalo object in the props section enhances the integration with Adalo's API. However, consider improving the handling of the data property to accept an object directly, as previously suggested, to reduce the risk of runtime errors and user input errors.


Approved: Updated run method.

The omission of the collectionId property aligns with the PR objectives to utilize collection_id from $auth. Consider enhancing error handling in this method to improve robustness and provide more informative error messages to the user.

data: {
label: "Data",
description: "The data to create record. E.g. `{ \"Email\": \"string\", \"Username\": \"string\", \"Full Name\": \"string\" }`",
Expand All @@ -18,7 +17,6 @@ export default {
async run({ $ }) {
const response = await this.adalo.createRecord({
$,
collectionId: this.collectionId,
data: JSON.parse(this.data),
});

Expand Down
9 changes: 5 additions & 4 deletions components/adalo/actions/get-records/get-records.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import base from "../common/base.mjs";
import adalo from "../../adalo.app.mjs";

export default {
...base,
key: "adalo-get-records",
name: "Get Records",
description: "Get all records from a collection. [See docs here](https://help.adalo.com/integrations/the-adalo-api/collections)",
version: "0.0.2",
version: "0.0.4",
type: "action",
props: {
adalo,
},
async run({ $ }) {
let resources = [];
let offset = 0;
Expand All @@ -18,7 +20,6 @@ export default {
requestFn: this.adalo.getRecords,
requestArgs: {
$,
collectionId: this.collectionId,
params: {
offset,
},
Expand Down
8 changes: 3 additions & 5 deletions components/adalo/actions/update-record/update-record.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import base from "../common/base.mjs";
import adalo from "../../adalo.app.mjs";

export default {
...base,
key: "adalo-update-record",
name: "Update Record",
description: "Update a record. [See docs here](https://help.adalo.com/integrations/the-adalo-api/collections)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
...base.props,
adalo,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: Updated props configuration.

The direct reference to the adalo object in the props section enhances the integration with Adalo's API. However, consider improving the handling of the data property to accept an object directly, as previously suggested, to reduce the risk of runtime errors and user input errors.


Approved: Updated run method.

The omission of the collectionId property aligns with the PR objectives to utilize collection_id from $auth. Consider enhancing error handling in this method to improve robustness and provide more informative error messages to the user.

recordId: {
label: "Record ID",
description: "The ID of a record",
Expand All @@ -23,7 +22,6 @@ export default {
async run({ $ }) {
const response = await this.adalo.updateRecord({
$,
collectionId: this.collectionId,
recordId: this.recordId,
data: JSON.parse(this.data),
});
Expand Down
26 changes: 11 additions & 15 deletions components/adalo/adalo.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { axios } from "@pipedream/platform";
export default {
type: "app",
app: "adalo",
propDefinitions: {},
methods: {
_collectionId() {
return this.$auth.collection_id;
},
_apiKey() {
return this.$auth.api_key;
},
Expand Down Expand Up @@ -49,30 +51,24 @@ export default {
},
};
},
async getRecords({
collectionId, ...args
} = {}) {
const response = await this._makeRequest({
path: `/collections/${collectionId}`,
getRecords(args = {}) {
return this._makeRequest({
path: `/collections/${this._collectionId()}`,
...args,
});

return response.records;
},
async createRecord({
collectionId, ...args
} = {}) {
createRecord(args = {}) {
return this._makeRequest({
path: `/collections/${collectionId}`,
path: `/collections/${this._collectionId()}`,
method: "post",
...args,
});
},
async updateRecord({
collectionId, recordId, ...args
updateRecord({
recordId, ...args
} = {}) {
return this._makeRequest({
path: `/collections/${collectionId}/${recordId}`,
path: `/collections/${this._collectionId()}/${recordId}`,
method: "put",
...args,
});
Expand Down
4 changes: 2 additions & 2 deletions components/adalo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/adalo",
"version": "0.0.5",
"version": "0.0.6",
"description": "Pipedream Adalo Components",
"main": "adalo.app.mjs",
"keywords": [
Expand All @@ -14,6 +14,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.2.0"
"@pipedream/platform": "^3.0.1"
}
}
13 changes: 3 additions & 10 deletions components/adalo/sources/new-record/new-record.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "adalo-new-record",
name: "New Record",
description: "Emit new event when is created a record.",
version: "0.0.4",
version: "0.0.5",
type: "source",
dedupe: "unique",
props: {
Expand All @@ -16,11 +16,6 @@ export default {
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},
collectionId: {
label: "Collection ID",
description: "The ID the collection",
type: "string",
},
},
methods: {
emitEvent(event) {
Expand All @@ -33,8 +28,7 @@ export default {
},
hooks: {
async deploy() {
const records = await this.adalo.getRecords({
collectionId: this.collectionId,
const { records } = await this.adalo.getRecords({
params: {
limit: 10,
},
Expand All @@ -47,9 +41,8 @@ export default {
let offset = 0;

while (offset >= 0) {
const records = await this.adalo.getRecords({
const { records } = await this.adalo.getRecords({
$,
collectionId: this.collectionId,
params: {
offset,
},
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading