Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
@@ -1,12 +1,10 @@
import shopify from "../../shopify.app.mjs";
import common from "./common.mjs";

export default {
...common,
key: "shopify-add-product-to-custom-collection",
name: "Add Products to Custom Collections",
description: "Adds a product or products to a custom collection or collections. [See the documentation](https://shopify.dev/docs/api/admin-rest/2023-01/resources/collect#post-collects)",
version: "0.0.6",
name: "Add Products to Custom Collection",
description: "Adds a product or products to a custom collection. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/collectionAddProductsV2)",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand All @@ -18,15 +16,23 @@ export default {
type: "string[]",
label: "Product IDs",
},
collectionIds: {
collectionId: {
propDefinition: [
shopify,
"collectionId",
],
type: "string[]",
label: "Collection IDs",
description: "IDs of the collections that the product will be added to",
optional: false,
},
},
async run({ $ }) {
const response = await this.shopify.addProductsToCollection({
id: this.collectionId,
productIds: this.productIds,
});
if (response.collectionAddProductsV2.userErrors.length > 0) {
throw new Error(response.collectionAddProductsV2.userErrors[0].message);
}
$.export("$summary", `Added product(s) \`${this.productIds}\` to collection \`${this.collectionId}\``);
return response;
},
};

This file was deleted.

69 changes: 63 additions & 6 deletions components/shopify/actions/add-tags/add-tags.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,72 @@
import shopify from "../../shopify.app.mjs";
import common from "./common.mjs";

export default {
...common,
name: "Add Tags",
version: "0.0.12",
key: "shopify-add-tags",
description: "Add tags. [See the documentation](https://shopify.dev/api/admin-graphql/2022-07/mutations/tagsadd)",
name: "Add Tags",
description: "Add tags. [See the documentation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/tagsAdd)",
version: "0.0.13",
type: "action",
props: {
shopify,
...common.props,
resource: {
type: "string",
label: "Resource Type",
description: "The Shopify Admin API resource type.",
options: [
"Product",
"Customer",
"Order",
"DraftOrder",
"Article",
],
reloadProps: true,
},
gid: {
type: "string",
label: "Resource ID",
description: "The Shopify Admin Resource ID. For example, the ID of a Product, Customer, Order, DraftOrder, or OnlineStoreArticle. Can be found at the end of the URL in Shopify Admin.",
},
tags: {
propDefinition: [
shopify,
"tags",
],
},
},
async additionalProps(existingProps) {
const props = {};
if (!this.resource) {
return props;
}
if (this.resource === "Product") {
props.gid = {
...existingProps.gid,
options: async ({ prevContext }) => {
try {
return await this.shopify.getPropOptions({
resourceFn: this.shopify.listProducts,
resourceKeys: [
"products",
],
prevContext,
});
} catch {
console.log("Unable to fetch product options");
}
},
};
}
return props;
},
async run({ $ }) {
const response = await this.shopify.addTags({
gid: this.gid,
tags: this.tags,
});
if (response.tagsAdd.userErrors.length > 0) {
throw new Error(response.tagsAdd.userErrors[0].message);
}
$.export("$summary", `Added tag(s) \`${this.tags}\` with id \`${response.tagsAdd.node.id}\``);
return response;
},
};
46 changes: 0 additions & 46 deletions components/shopify/actions/add-tags/common.mjs

This file was deleted.

22 changes: 0 additions & 22 deletions components/shopify/actions/common/common.mjs

Choose a reason for hiding this comment

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

I came here to find out why my Shopify Developer App component actions were throwing errors today.

image

Stack trace:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/tmp/__pdg__/dist/code/b59962f1748152b2d77390059ddb245048509bd546e34eda241518ba3149c2af/node_modules/@pipedream/shopify/actions/search-customers/common.mjs' imported from /tmp/__pdg__/dist/code/b59962f1748152b2d77390059ddb245048509bd546e34eda241518ba3149c2af/code/actions/search-customers/search-customers.mjs
    at finalizeResolution (node:internal/modules/esm/resolve:269:11)
    at moduleResolve (node:internal/modules/esm/resolve:937:10)
    at moduleResolveWithNodePath (node:internal/modules/esm/resolve:1173:14)
    at defaultResolve (node:internal/modules/esm/resolve:1216:79)
    at nextResolve (node:internal/modules/esm/hooks:868:28)
    at resolve (file:///var/task/import-hooks.mjs:7:10)
    at nextResolve (node:internal/modules/esm/hooks:868:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:306:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)

From what I can tell, this PR appears to be the issue, as this common.mjs file is a dependency in that component, but it was removed here.

I'm guessing most of the Shopify Developer App actions have a dependency on this common file (see example here), so I think this is probably pretty urgent to resolve.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ const RESOURCE_TYPES = [
label: "Collection",
value: "collection",
},
{
label: "Customer",
value: "customer",
},
{
label: "Draft Order",
value: "draft_order",
},
{
label: "Page",
value: "page",
Expand All @@ -23,10 +15,6 @@ const RESOURCE_TYPES = [
label: "Product",
value: "product",
},
{
label: "Product Image",
value: "product_image",
},
{
label: "Product Variant",
value: "variants",
Expand All @@ -35,10 +23,6 @@ const RESOURCE_TYPES = [
label: "Article",
value: "article",
},
{
label: "Order",
value: "order",
},
];

const METAFIELD_TYPES = {
Expand Down
Loading
Loading