Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "barcode_lookup-batch-barcode-lookup",
name: "Batch Barcode Lookup",
description: "Get multiple products by barcode. [See the documentation](https://www.barcodelookup.com/api-documentation)",
version: "0.0.1",
version: "0.0.2",
type: "action",
annotations: {
destructiveHint: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "barcode_lookup-get-product-by-barcode",
name: "Get Product by Barcode",
description: "Get a product by barcode. [See the documentation](https://www.barcodelookup.com/api-documentation)",
version: "0.0.1",
version: "0.0.2",
type: "action",
annotations: {
destructiveHint: false,
Expand Down
82 changes: 82 additions & 0 deletions components/barcode_lookup/actions/get-products/get-products.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import app from "../../barcode_lookup.app.mjs";

export default {
key: "barcode_lookup-get-products",
name: "Get Products",
description: "Retrieve products details by barcode, MPN, ASIN, or search terms. [See the documentation](https://www.barcodelookup.com/api-documentation#endpoints)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
app,
barcode: {
propDefinition: [
app,
"barcode",
],
},
mpn: {
propDefinition: [
app,
"mpn",
],
},
asin: {
propDefinition: [
app,
"asin",
],
},
title: {
propDefinition: [
app,
"title",
],
},
category: {
propDefinition: [
app,
"category",
],
},
manufacturer: {
propDefinition: [
app,
"manufacturer",
],
},
brand: {
propDefinition: [
app,
"brand",
],
},
search: {
propDefinition: [
app,
"search",
],
},
},
async run({ $ }) {
const response = await this.app.getProducts({
$,
params: {
barcode: this.barcode,
mpn: this.mpn,
asin: this.asin,
title: this.title,
category: this.category,
manufacturer: this.manufacturer,
brand: this.brand,
search: this.search,
},
});
$.export("$summary", "Successfully retrieved " + response.products.length + " products");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import app from "../../barcode_lookup.app.mjs";

export default {
key: "barcode_lookup-get-rate-limits",
name: "Get Rate Limits",
description: "Retrieve the current API rate limits for your account. [See the documentation](https://www.barcodelookup.com/api-documentation#endpoints)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
app,
},
async run({ $ }) {
const response = await this.app.getRateLimits({
$,
});
$.export("$summary", "Successfully retrieved the account rate limits");
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "barcode_lookup-search-products-by-parameters",
name: "Search Products by Parameters",
description: "Search for products by parameters. [See the documentation](https://www.barcodelookup.com/api-documentation)",
version: "0.0.1",
version: "0.0.2",
type: "action",
annotations: {
destructiveHint: false,
Expand Down
107 changes: 69 additions & 38 deletions components/barcode_lookup/barcode_lookup.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,87 @@ import { axios } from "@pipedream/platform";
export default {
type: "app",
app: "barcode_lookup",
propDefinitions: {},
propDefinitions: {
barcode: {
type: "string",
label: "Barcode",
description: "Barcode to search, must be 7, 8, 10, 11, 12, 13 or 14 digits long, i.e.: `865694301167`",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please replace "i.e." with "e.g." in all the prop descriptions, since they're providing example values (not clarifying the actual expression)

optional: true,
},
mpn: {
type: "string",
label: "MPN",
description: "Manufacturer Part Number of the product, i.e: `LXCF9407`",
optional: true,
},
asin: {
type: "string",
label: "ASIN",
description: "Amazon Standard Identification Number of the product, i.e.: `B079L4WR4T`",
optional: true,
},
title: {
type: "string",
label: "Title",
description: "Product title or name, i.e.: `Red Running Shoes`",
optional: true,
},
category: {
type: "string",
label: "Category",
description: "Category or type of the product, i.e.: `Home & Garden > Decor`",
optional: true,
},
manufacturer: {
type: "string",
label: "Manufacturer",
description: "Name of the product manufacturer, i.e.: `Samsung`",
optional: true,
},
brand: {
type: "string",
label: "Brand",
description: "Brand associated with the product, i.e.: `Calvin Klein`",
optional: true,
},
search: {
type: "string",
label: "Search",
description: "General search term for products, i.e.: `Air Jordan Red Shoes Size 40`",
optional: true,
},
},
methods: {
_baseUrl() {
return "https://api.barcodelookup.com/v3";
},
_params(params = {}) {
return {
...params,
key: `${this.$auth.api_key}`,
};
},
_makeRequest({
$ = this, params, path, ...opts
}) {
async _makeRequest(opts = {}) {
const {
$ = this,
path,
params,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
params: this._params(params),
...opts,
params: {
key: `${this.$auth.api_key}`,
...params,
},
});
},
searchProducts(opts = {}) {
async getProducts(args = {}) {
return this._makeRequest({
path: "/products",
...opts,
...args,
});
},
async *paginate({
fn, params = {}, maxResults = null, ...opts
}) {
let hasMore = false;
let count = 0;
let page = 0;

do {
params.page = ++page;
const { products: data } = await fn({
params,
...opts,
});
for (const d of data) {
yield d;

if (maxResults && ++count === maxResults) {
return count;
}
}

hasMore = data?.length;

} while (hasMore);
async getRateLimits(args = {}) {
return this._makeRequest({
path: "/rate-limits",
...args,
});
},
Comment on lines +76 to 87
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Breaking changes: ensure backward compatibility or update all dependents.

The refactor introduces breaking changes:

  1. searchProducts renamed to getProducts
  2. paginate method removed entirely

Multiple existing actions in this PR still reference the old method names and will fail at runtime. Either:

  1. Provide backward-compatible aliases for the old methods
  2. Update all dependent actions in the same PR

As flagged in other files, the following actions need updates:

  • batch-barcode-lookup.mjs (calls searchProducts)
  • get-product-by-barcode.mjs (calls searchProducts)
  • search-products-by-parameters.mjs (calls searchProducts and paginate)

To verify all call sites have been identified, run:


🏁 Script executed:

#!/bin/bash
# Search for calls to the removed/renamed methods
echo "=== Searching for searchProducts calls ==="
rg -n --type=js 'searchProducts' components/barcode_lookup/

echo -e "\n=== Searching for paginate calls ==="
rg -n --type=js '\.paginate\(' components/barcode_lookup/

Length of output: 80


🏁 Script executed:

#!/bin/bash
echo "=== Searching for searchProducts calls in entire repo ==="
rg -n --type js --type mjs 'searchProducts' .

echo -e "\n=== Searching for paginate calls in entire repo ==="
rg -n --type js --type mjs '\.paginate\(' .

Length of output: 166


🏁 Script executed:

#!/bin/bash
echo "=== Searching for searchProducts calls across all files ==="
rg -n 'searchProducts' .

echo -e "\n=== Searching for paginate calls across all files ==="
rg -n '\.paginate\(' .

Length of output: 60675


Update dependent actions after renaming searchProducts/remove paginate
Provide backward-compatible aliases or update the following components/barcode_lookup actions to use getProducts and remove/replace paginate:

  • actions/batch-barcode-lookup.mjs (this.app.searchProducts)
  • actions/get-product-by-barcode.mjs (this.app.searchProducts)
  • actions/search-products-by-parameters.mjs (this.app.searchProducts, this.app.paginate)

},
};
2 changes: 1 addition & 1 deletion components/barcode_lookup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/barcode_lookup",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream Barcode Lookup Components",
"main": "barcode_lookup.app.mjs",
"keywords": [
Expand Down
Loading