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
@@ -0,0 +1,90 @@
import everstox from "../../everstox.app.mjs";
import { ConfigurationError } from "@pipedream/platform";
import { parseJsonProp } from "../../common/utils.mjs";

export default {
key: "everstox-create-fulfillment-update-request",
name: "Create Fulfillment Update Request",
description:
"Creates a new fulfillment update request for a specific fulfillment."
+ " The fulfillment must be in `in_fulfillment` state."
+ " Use this to modify items, quantities, prices, addresses, or priority on an active fulfillment."
Comment thread
michelle0927 marked this conversation as resolved.
+ " `fulfillment_items` must include at least one item with a valid SKU; `price_set` quantities must sum to the item quantity."
+ " Address fields `first_name`/`last_name` or `company` are conditionally required (at least one set must be present)."
+ " [See the documentation](https://api.everstox.com/api/v1/ui/#/Fulfillment-updates/district_core.api.shops.fulfillments.fulfillments.Fulfillments.create_fulfillment_update_request)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
props: {
everstox,
fulfillmentId: {
type: "string",
label: "Fulfillment ID",
description: "The UUID of the fulfillment to update, for example 550e8400-e29b-41d4-a716-446655440000. Obtain this from the fulfillment object you want to modify. Must be in in_fulfillment state.",
},
fulfillmentItems: {
type: "string",
label: "Fulfillment Items",
description: "JSON array of fulfillment items to update. Must contain at least one item."
+ " Omit `id` when adding a new item; include it when updating an existing one."
+ " Each item requires a `product.sku` and a `price_set` with at least one entry."
+ " Example: `[{\"id\": \"550e8400-e29b-41d4-a716-446655440000\", \"quantity\": 2, \"product\": {\"sku\": \"PROD-001\"}, \"price_set\": [{\"quantity\": 2, \"currency\": \"EUR\", \"price_net_after_discount\": \"19.99\", \"tax_amount\": \"3.80\", \"tax_rate\": \"0.19\"}]}]`",
optional: true,
},
shippingAddress: {
type: "string",
label: "Shipping Address",
Comment thread
michelle0927 marked this conversation as resolved.
description: "JSON object with the complete shipping address."
+ " Required fields: `country_code` (ISO 2-letter, e.g. `\"DE\"`), `country` (full country name, e.g. `\"Germany\"`), `city`, `zip`, `address_1`,"
+ " and at least one of `first_name`/`last_name` or `company`."
+ " Optional: `address_2`, `title`, `phone`, `province_code`, `address_type` (`private` or `business`)."
+ " Example: `{\"first_name\": \"John\", \"last_name\": \"Doe\", \"country_code\": \"DE\", \"country\": \"Germany\", \"city\": \"Berlin\", \"zip\": \"10115\", \"address_1\": \"Musterstra\\u00dfe 1\", \"address_type\": \"private\"}`",
optional: true,
},
billingAddress: {
type: "string",
label: "Billing Address",
Comment thread
michelle0927 marked this conversation as resolved.
description: "JSON object with the complete billing address."
+ " Required fields: `country_code` (ISO 2-letter, e.g. `\"DE\"`), `country` (full country name, e.g. `\"Germany\"`), `city`, `zip`, `address_1`,"
+ " and at least one of `first_name`/`last_name` or `company`."
+ " Optional: `address_2`, `title`, `phone`, `VAT_number`, `address_type` (`private` or `business`)."
+ " Example: `{\"first_name\": \"John\", \"last_name\": \"Doe\", \"country_code\": \"DE\", \"country\": \"Germany\", \"city\": \"Berlin\", \"zip\": \"10115\", \"address_1\": \"Musterstra\\u00dfe 1\", \"address_type\": \"private\"}`",
optional: true,
},
fulfillmentPriority: {
type: "integer",
label: "Fulfillment Priority",
description: "Priority level for the fulfillment. Must be between 1 (highest) and 99 (lowest).",
Comment thread
michelle0927 marked this conversation as resolved.
optional: true,
min: 1,
max: 99,
},
},
async run({ $ }) {
if (!this.fulfillmentItems
&& !this.shippingAddress
&& !this.billingAddress
&& !this.fulfillmentPriority) {
throw new ConfigurationError("At least one of `fulfillmentItems`, `shippingAddress`, `billingAddress`, or `fulfillmentPriority` must be provided.");
}

const response = await this.everstox.createFulfillmentUpdateRequest({
$,
fulfillmentId: this.fulfillmentId,
data: {
fulfillment_items: parseJsonProp(this.fulfillmentItems, "fulfillmentItems"),
shipping_address: parseJsonProp(this.shippingAddress, "shippingAddress"),
billing_address: parseJsonProp(this.billingAddress, "billingAddress"),
fulfillment_priority: this.fulfillmentPriority,
},
});

$.export("$summary", `Successfully created fulfillment update request for fulfillment \`${this.fulfillmentId}\``);

return response;
},
};
2 changes: 1 addition & 1 deletion components/everstox/actions/get-order/get-order.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "everstox-get-order",
name: "Get Order",
description: "Get an order from Everstox. [See the documentation](https://api.everstox.com/api/v1/ui/#/Order/district_core.api.shops.orders.orders.Orders.get)",
version: "0.0.2",
version: "0.0.3",
type: "action",
annotations: {
destructiveHint: false,
Expand Down
2 changes: 1 addition & 1 deletion components/everstox/actions/get-return/get-return.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "everstox-get-return",
name: "Get Return",
description: "Get a return from Everstox. [See the documentation](https://api.everstox.com/api/v1/ui/#/Returns%20V2/district_core.api.shops.returns_v2.returns_v2.ReturnsV2.get)",
version: "0.0.2",
version: "0.0.3",
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: "everstox-list-order-id-options",
name: "List Order ID Options",
description: "Retrieves available options for the Order ID field.",
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: "everstox-list-order-number-options",
name: "List Order Number Options",
description: "Retrieves available options for the Order Number field.",
version: "0.0.1",
version: "0.0.2",
type: "action",
annotations: {
destructiveHint: false,
Expand Down
164 changes: 164 additions & 0 deletions components/everstox/actions/list-products/list-products.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
import constants from "../../common/constants.mjs";
import everstox from "../../everstox.app.mjs";

export default {
key: "everstox-list-products",
name: "List Products",
description: "List products in an Everstox shop. Use this to browse or audit the product catalog, check inventory by SKU or name, or filter by warehouse. Results default to 10 per page — use `limit` and `offset` together to paginate through large catalogs. [See the documentation](https://api.everstox.com/api/v1/ui/#/Product/district_core.api.shops.products.products.Products.index)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
everstox,
search: {
type: "string",
label: "Search",
description: "Search for name or SKU",
optional: true,
},
sku: {
type: "string[]",
label: "SKUs",
description: "Filter products by SKU. If the number of SKUs exceeds 10, `exact_search` is enforced",
optional: true,
},
name: {
type: "string",
label: "Name",
description: "Filter products by name",
optional: true,
},
gtin: {
type: "string",
label: "GTIN",
description: "Filter products by GTIN — returns products with at least one unit whose GTIN contains this value",
optional: true,
},
customAttributeKey: {
type: "string",
label: "Custom Attribute Key",
description: "Filter products by custom attribute key — returns products with at least one custom attribute whose key contains this value",
optional: true,
},
customAttributeValue: {
type: "string",
label: "Custom Attribute Value",
description: "Filter products by custom attribute value — returns products with at least one custom attribute whose value contains this value",
optional: true,
},
status: {
type: "string",
label: "Status",
description: "Filter products by status (default `all`)",
options: constants.STATUS_OPTIONS,
optional: true,
},
bundleProduct: {
type: "boolean",
label: "Bundle Product",
description: "Filter for bundle products",
optional: true,
},
exactSearch: {
type: "boolean",
label: "Exact Search",
description: "If true, searches for exact SKU and name matches (default `true`)",
optional: true,
},
stockRunwayLte: {
type: "integer",
label: "Stock Runway Less Than or Equal To",
description: "Filter for stocks with runway lower than or equal to the number of days provided",
optional: true,
},
stockRunwayLt: {
type: "integer",
label: "Stock Runway Less Than",
description: "Filter for stocks with runway lower than the number of days provided",
optional: true,
},
stockRunwayGte: {
type: "integer",
label: "Stock Runway Greater Than or Equal To",
description: "Filter for stocks with runway greater than or equal to the number of days provided",
optional: true,
},
warehouseIds: {
propDefinition: [
everstox,
"warehouseIds",
],
optional: true,
},
orderBy: {
type: "string",
label: "Order By",
description: "Fields to order the result set by",
optional: true,
},
fields: {
type: "string",
label: "Fields",
description: "Fields to include in the response",
optional: true,
},
fieldSet: {
type: "string",
label: "Field Set",
description: "`full` includes all sub-entities (default); `minimal` returns essential fields optimized for performance",
options: constants.FIELD_SET_OPTIONS,
optional: true,
},
limit: {
type: "integer",
label: "Limit",
description: "The number of products to return (default 10)",
min: 1,
Comment thread
michelle0927 marked this conversation as resolved.
default: 10,
optional: true,
},
offset: {
type: "integer",
label: "Offset",
description: "The number of products to skip before starting to collect the result set",
min: 0,
optional: true,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
},
},
async run({ $ }) {
const response = await this.everstox.listProducts({
$,
params: {
search: this.search,
sku: this.sku,
name: this.name,
gtin: this.gtin,
custom_attribute_key: this.customAttributeKey,
custom_attribute_value: this.customAttributeValue,
status: this.status,
bundle_product: this.bundleProduct,
exact_search: this.exactSearch,
stock_runway_lte: this.stockRunwayLte,
stock_runway_lt: this.stockRunwayLt,
stock_runway_gte: this.stockRunwayGte,
warehouse_ids: this.warehouseIds,
order_by: this.orderBy,
fields: this.fields,
field_set: this.fieldSet,
limit: this.limit,
offset: this.offset,
},
});

const count = response.items?.length ?? 0;
$.export("$summary", `Successfully retrieved ${count} product${count === 1
? ""
: "s"}`);

return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "everstox-list-return-id-options",
name: "List Return ID Options",
description: "Retrieves available options for the Return ID field.",
version: "0.0.1",
version: "0.0.2",
type: "action",
annotations: {
destructiveHint: false,
Expand Down
2 changes: 1 addition & 1 deletion components/everstox/actions/list-returns/list-returns.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "everstox-list-returns",
name: "List Returns",
description: "List returns from Everstox. [See the documentation](https://api.everstox.com/api/v1/ui/#/Returns%20V2/district_core.api.shops.returns_v2.returns_v2.ReturnsV2.index)",
version: "0.0.2",
version: "0.0.3",
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: "everstox-list-warehouse-ids-options",
name: "List Warehouse IDs Options",
description: "Retrieves available options for the Warehouse IDs field.",
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 @@ -5,7 +5,7 @@ export default {
key: "everstox-search-orders",
name: "Search Orders by Order Number",
description: "Search orders from Everstox. [See the documentation](https://api.everstox.com/api/v1/ui/#/Order/district_core.api.shops.orders.orders.Orders.index)",
version: "0.0.1",
version: "0.0.2",
type: "action",
annotations: {
destructiveHint: false,
Expand Down
13 changes: 13 additions & 0 deletions components/everstox/common/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,24 @@ const CANCELLATION_STATE_OPTIONS = [
"completed",
];

const STATUS_OPTIONS = [
"all",
"active",
"inactive",
];

const FIELD_SET_OPTIONS = [
"full",
"minimal",
];

export default {
LIMIT,
ORDER_BY_OPTIONS,
FULFILLMENT_STATE_OPTIONS,
FULFILLMENT_STATEGROUP_OPTIONS,
STATEGROUP_OPTIONS,
CANCELLATION_STATE_OPTIONS,
STATUS_OPTIONS,
FIELD_SET_OPTIONS,
};
15 changes: 15 additions & 0 deletions components/everstox/common/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ConfigurationError } from "@pipedream/platform";

export const parseJsonProp = (json, propName) => {
if (!json) {
return undefined;
}
if (typeof json === "string") {
try {
return JSON.parse(json);
} catch (error) {
throw new ConfigurationError(`Invalid JSON string for property ${propName}: ${json}`);
}
}
Comment thread
michelle0927 marked this conversation as resolved.
return json;
};
Loading
Loading