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
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import shopify from "../../shopify.app.mjs";

export default {
key: "shopify-add-product-to-custom-collection",
name: "Add Product to Custom Collection",
description: "Adds a product to a custom collection. [See the docs](https://shopify.dev/docs/api/admin-rest/2023-01/resources/collect#post-collects)",
version: "0.0.1",
type: "action",
props: {
shopify,
productId: {
propDefinition: [
shopify,
"productId",
],
},
collectionId: {
propDefinition: [
shopify,
"collectionId",
],
description: "ID of the collection that the product will be added to",
optional: false,
},
},
async run({ $ }) {
const data = {
product_id: this.productId,
collection_id: this.collectionId,
};

const { result } = await this.shopify.createCollect(data);
$.export("$summary", `Added product with ID \`${result.product_id}\` to collection with ID \`${result.collection_id}\``);
return result;
},
};
2 changes: 1 addition & 1 deletion components/shopify/actions/add-tags/add-tags.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import shopify from "../../shopify.app.mjs";

export default {
name: "Add Tags",
version: "0.0.6",
version: "0.0.7",
key: "shopify-add-tags",
description: "Add tags. [See the docs](https://shopify.dev/api/admin-graphql/2022-07/mutations/tagsadd)",
props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import shopify from "../../shopify.app.mjs";

export default {
key: "shopify-create-custom-collection",
name: "Create Custom Collection",
description: "Create a new custom collection. [See the docs](https://shopify.dev/docs/api/admin-rest/2023-01/resources/customcollection#post-custom-collections)",
version: "0.0.1",
type: "action",
props: {
shopify,
title: {
propDefinition: [
shopify,
"title",
],
description: "The name of the custom collection",
},
products: {
propDefinition: [
shopify,
"productId",
],
type: "string[]",
optional: true,
},
imageUrl: {
type: "string",
label: "Image URL",
description: "The source URL that specifies the location of the image",
optional: true,
},
published: {
type: "boolean",
label: "Published",
description: "Whether the custom collection is published to the Online Store channel",
optional: true,
},
metafields: {
propDefinition: [
shopify,
"metafields",
],
},
},
async run({ $ }) {
const collects = this.products?.map((product) => ({
product_id: product,
})) || [];

const data = {
title: this.title,
collects,
image: {
src: this.imageUrl,
},
published: this.published,
metafields: this.shopify.parseArrayOfJSONStrings(this.metafields),
};

const { result } = await this.shopify.createCustomCollection(data);
$.export("$summary", `Created new custom collection \`${result.title}\` with ID \`${result.id}\``);
return result;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "shopify-create-customer",
name: "Create Customer",
description: "Create a new customer. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/customer#[post]/admin/api/2022-01/customers.json)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "shopify-create-metafield",
name: "Create Metafield",
description: "Creates a metafield belonging to a resource. [See the docs](https://shopify.dev/api/admin-rest/2023-01/resources/metafield#post-blogs-blog-id-metafields)",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/shopify/actions/create-order/create-order.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
For full order object details [see the docs](https://shopify.dev/api/admin-rest/2022-01/resources/order#[post]/admin/api/2022-01/orders.json)
or [see examples](https://shopify.dev/api/admin-rest/2022-01/resources/order#[post]/admin/api/#{api_version}/orders.json_examples)
`),
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "shopify-create-product-variant",
name: "Create Product Variant",
description: "Create a new product variant. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/product-variant#[post]/admin/api/2022-01/products/{product_id}/variants.json)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "shopify-create-product",
name: "Create Product",
description: "Create a new product. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/product#[post]/admin/api/2022-01/products.json)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
You can fill in any number of rules by selecting more than one option in each prop.
[See docs](https://shopify.dev/api/admin-rest/2021-10/resources/smartcollection#post-smart-collections)
`),
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "shopify-delete-metafield",
name: "Delete Metafield",
description: "Deletes a metafield belonging to a resource. [See the docs](https://shopify.dev/docs/api/admin-rest/2023-01/resources/metafield#delete-blogs-blog-id-metafields-metafield-id)",
version: "0.0.2",
version: "0.0.3",
type: "action",
async additionalProps() {
const props = await this.getOwnerIdProp(this.ownerResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "shopify-get-metafields",
name: "Get Metafields",
description: "Retrieves a list of metafields that belong to a resource. [See the docs](https://shopify.dev/api/admin-rest/2023-01/resources/metafield#get-metafields?metafield[owner-id]=382285388&metafield[owner-resource]=blog)",
version: "0.0.4",
version: "0.0.5",
type: "action",
async additionalProps() {
return this.getOwnerIdProp(this.ownerResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "shopify-search-customers",
name: "Search for Customers",
description: "Search for a customer or a list of customers. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/customer#[get]/admin/api/2022-01/customers.json)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "shopify-search-product-variant",
name: "Search for Product Variant",
description: "Search for product variants or create one if not found. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/product-variant#top)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "shopify-search-products",
name: "Search for Products",
description: "Search for products. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/product#[get]/admin/api/2022-01/products.json)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down
10 changes: 5 additions & 5 deletions components/shopify/actions/update-customer/update-customer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "shopify-update-customer",
name: "Update Customer",
description: "Update a existing customer. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/customer#[put]/admin/api/2022-01/customers/{customer_id}.json)",
version: "0.0.8",
version: "0.0.9",
type: "action",
props: {
shopify,
Expand Down Expand Up @@ -78,10 +78,10 @@ export default {
],
},
metafields: {
type: "string[]",
label: "Metafields",
description: "An array of objects, each one representing a metafield. If adding a new metafield, the object should contain `key`, `value`, `type`, and `namespace`. Example: `{{ [{ \"key\": \"new\", \"value\": \"newvalue\", \"type\": \"single_line_text_field\", \"namespace\": \"global\" }] }}`. To update an existing metafield, use the `id` and `value`. Example: `{{ [{ \"id\": \"28408051400984\", \"value\": \"updatedvalue\" }] }}`",
optional: true,
propDefinition: [
shopify,
"metafields",
],
},
},
async run({ $ }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "shopify-update-inventory-level",
name: "Update Inventory Level",
description: "Sets the inventory level for an inventory item at a location. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/inventorylevel#[post]/admin/api/2022-01/inventory_levels/set.json)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
shopify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "shopify-update-metafield",
name: "Update Metafield",
description: "Updates a metafield belonging to a resource. [See the docs](https://shopify.dev/api/admin-rest/2023-01/resources/metafield#put-blogs-blog-id-metafields-metafield-id)",
version: "0.0.4",
version: "0.0.5",
type: "action",
async additionalProps() {
const props = await this.getOwnerIdProp(this.ownerResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "shopify-update-product-variant",
name: "Update Product Variant",
description: "Update an existing product variant. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/product-variant#[put]/admin/api/2022-01/variants/{variant_id}.json)",
version: "0.0.8",
version: "0.0.9",
type: "action",
props: {
shopify,
Expand Down Expand Up @@ -47,10 +47,10 @@ export default {
],
},
metafields: {
type: "string[]",
label: "Metafields",
description: "An array of objects, each one representing a metafield. If adding a new metafield, the object should contain `key`, `value`, `type`, and `namespace`. Example: `{{ [{ \"key\": \"new\", \"value\": \"newvalue\", \"type\": \"single_line_text_field\", \"namespace\": \"global\" }] }}`. To update an existing metafield, use the `id` and `value`. Example: `{{ [{ \"id\": \"28408051400984\", \"value\": \"updatedvalue\" }] }}`",
optional: true,
propDefinition: [
shopify,
"metafields",
],
},
},
async run({ $ }) {
Expand Down
10 changes: 5 additions & 5 deletions components/shopify/actions/update-product/update-product.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "shopify-update-product",
name: "Update Product",
description: "Update an existing product. [See the docs](https://shopify.dev/api/admin-rest/2022-01/resources/product#[put]/admin/api/2022-01/products/{product_id}.json)",
version: "0.0.8",
version: "0.0.9",
type: "action",
props: {
shopify,
Expand Down Expand Up @@ -72,10 +72,10 @@ export default {
],
},
metafields: {
type: "string[]",
label: "Metafields",
description: "An array of objects, each one representing a metafield. If adding a new metafield, the object should contain `key`, `value`, `type`, and `namespace`. Example: `{{ [{ \"key\": \"new\", \"value\": \"newvalue\", \"type\": \"single_line_text_field\", \"namespace\": \"global\" }] }}`. To update an existing metafield, use the `id` and `value`. Example: `{{ [{ \"id\": \"28408051400984\", \"value\": \"updatedvalue\" }] }}`",
optional: true,
propDefinition: [
shopify,
"metafields",
],
},
seoTitle: {
type: "string",
Expand Down
2 changes: 1 addition & 1 deletion components/shopify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/shopify",
"version": "0.3.17",
"version": "0.3.18",
"description": "Pipedream Shopify Components",
"main": "shopify.app.mjs",
"keywords": [
Expand Down
16 changes: 16 additions & 0 deletions components/shopify/shopify.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ export default {
return this.getDraftOrderOptions();
},
},
metafields: {
type: "string[]",
label: "Metafields",
description: "An array of objects, each one representing a metafield. If adding a new metafield, the object should contain `key`, `value`, `type`, and `namespace`. Example: `{{ [{ \"key\": \"new\", \"value\": \"newvalue\", \"type\": \"single_line_text_field\", \"namespace\": \"global\" }] }}`. To update an existing metafield, use the `id` and `value`. Example: `{{ [{ \"id\": \"28408051400984\", \"value\": \"updatedvalue\" }] }}`",
optional: true,
},
},
methods: {
getShopId() {
Expand Down Expand Up @@ -674,6 +680,16 @@ export default {
this.getSinceParams(sinceId, useCreatedAt, null, params);
return this.getObjects("product", params);
},
async getCollects(sinceId) {
const params = this.getSinceParams(sinceId, true);
return this.getObjects("collect", params);
},
async createCollect(params) {
return this.resourceAction("collect", "create", params);
},
async createCustomCollection(params) {
return this.resourceAction("customCollection", "create", params);
},
async getProduct(productId, params) {
return this.resourceAction("product", "get", params, productId);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import shopify from "../../shopify.app.mjs";

export default {
name: "New Customer Data Request",
version: "0.0.7",
version: "0.0.8",
key: "shopify-customer-data-request",
description: "Emit new customer data requests for data via a GDPR request.",
type: "source",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "New Abandoned Cart",
type: "source",
description: "Emit new event each time a user abandons their cart.",
version: "0.0.12",
version: "0.0.13",
dedupe: "unique",
props: {
db: "$.service.db",
Expand Down
2 changes: 1 addition & 1 deletion components/shopify/sources/new-article/new-article.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "New Article",
type: "source",
description: "Emit new event for each new article in a blog.",
version: "0.0.12",
version: "0.0.13",
dedupe: "unique",
props: {
db: "$.service.db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Cancelled Order (Instant)",
type: "source",
description: "Emit new event each time a new order is cancelled.",
version: "0.0.11",
version: "0.0.12",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Customer Created (Instant)",
type: "source",
description: "Emit new event for each new customer added to a store.",
version: "0.0.3",
version: "0.0.4",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Draft Order (Instant)",
type: "source",
description: "Emit new event for each new draft order submitted to a store.",
version: "0.0.8",
version: "0.0.9",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
Loading