@ehrenkind/shopify-lib 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +19 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -7
- package/dist/index.d.ts +22 -7
- package/dist/index.mjs +19 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -41,6 +41,10 @@ type MetaobjectFieldDefinition$1 = {
|
|
|
41
41
|
type: string;
|
|
42
42
|
description?: string;
|
|
43
43
|
required?: boolean;
|
|
44
|
+
validations?: Array<{
|
|
45
|
+
name: string;
|
|
46
|
+
value: string;
|
|
47
|
+
}>;
|
|
44
48
|
};
|
|
45
49
|
type CreateMetaobjectDefinitionInput = {
|
|
46
50
|
type: string;
|
|
@@ -1470,6 +1474,8 @@ type CashRoundingAdjustment = {
|
|
|
1470
1474
|
/**
|
|
1471
1475
|
* A list of products with publishing and pricing information.
|
|
1472
1476
|
* A catalog can be associated with a specific context, such as a [`Market`](https://shopify.dev/api/admin-graphql/current/objects/market), [`CompanyLocation`](https://shopify.dev/api/admin-graphql/current/objects/companylocation), or [`App`](https://shopify.dev/api/admin-graphql/current/objects/app).
|
|
1477
|
+
*
|
|
1478
|
+
* Catalogs can optionally include a publication to control product visibility and a price list to customize pricing. When a publication isn't associated with a catalog, product availability is determined by the sales channel.
|
|
1473
1479
|
*/
|
|
1474
1480
|
type Catalog = {
|
|
1475
1481
|
/** A globally-unique ID. */
|
|
@@ -10262,7 +10268,7 @@ type Market = HasMetafieldDefinitions & HasMetafields & Node & {
|
|
|
10262
10268
|
webPresences: MarketWebPresenceConnection;
|
|
10263
10269
|
};
|
|
10264
10270
|
/**
|
|
10265
|
-
* A catalog for managing product availability and pricing for specific [`Market`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Market) contexts. Each catalog links to one or more markets
|
|
10271
|
+
* A catalog for managing product availability and pricing for specific [`Market`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Market) contexts. Each catalog links to one or more markets. The catalog can optionally include a [`Publication`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Publication) to control which [`Product`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Product) objects customers see, and a [`PriceList`](https://shopify.dev/docs/api/admin-graphql/latest/objects/PriceList) for market-specific pricing adjustments. When a publication isn't associated with the catalog, product availability is determined by the sales channel.
|
|
10266
10272
|
*
|
|
10267
10273
|
* Use catalogs to create distinct shopping experiences for different geographic regions or customer segments.
|
|
10268
10274
|
*
|
|
@@ -20169,7 +20175,7 @@ type LeanProductVariantsQuery = {
|
|
|
20169
20175
|
productVariants: {
|
|
20170
20176
|
edges: Array<{
|
|
20171
20177
|
node: (Pick<ProductVariant$1, 'id' | 'title' | 'sku'> & {
|
|
20172
|
-
product: Pick<Product, 'id' | 'title'>;
|
|
20178
|
+
product: Pick<Product, 'id' | 'title' | 'status'>;
|
|
20173
20179
|
});
|
|
20174
20180
|
}>;
|
|
20175
20181
|
pageInfo: Pick<PageInfo, 'hasNextPage' | 'endCursor'>;
|
|
@@ -20261,7 +20267,7 @@ interface GeneratedQueryTypes {
|
|
|
20261
20267
|
return: AllProductVariantsQuery;
|
|
20262
20268
|
variables: AllProductVariantsQueryVariables;
|
|
20263
20269
|
};
|
|
20264
|
-
"#graphql\n query leanProductVariants($first: Int!, $after: String, $queryFilter: String) {\n productVariants(first: $first, after: $after, query: $queryFilter) {\n edges {\n node {
|
|
20270
|
+
"#graphql\n query leanProductVariants($first: Int!, $after: String, $queryFilter: String) {\n productVariants(first: $first, after: $after, query: $queryFilter) {\n edges {\n node {\n id\n title\n sku\n product {\n id\n title\n status\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n ": {
|
|
20265
20271
|
return: LeanProductVariantsQuery;
|
|
20266
20272
|
variables: LeanProductVariantsQueryVariables;
|
|
20267
20273
|
};
|
|
@@ -20594,30 +20600,39 @@ declare const GetLeanProductVariantsReturn: z.ZodArray<z.ZodObject<{
|
|
|
20594
20600
|
variantId: z.ZodString;
|
|
20595
20601
|
variantTitle: z.ZodString;
|
|
20596
20602
|
sku: z.ZodString;
|
|
20603
|
+
status: z.ZodEnum<["ACTIVE", "ARCHIVED", "DRAFT"]>;
|
|
20597
20604
|
}, "strip", z.ZodTypeAny, {
|
|
20605
|
+
status: "ACTIVE" | "ARCHIVED" | "DRAFT";
|
|
20598
20606
|
productId: string;
|
|
20599
20607
|
sku: string;
|
|
20600
20608
|
variantId: string;
|
|
20601
20609
|
productTitle: string;
|
|
20602
20610
|
variantTitle: string;
|
|
20603
20611
|
}, {
|
|
20612
|
+
status: "ACTIVE" | "ARCHIVED" | "DRAFT";
|
|
20604
20613
|
productId: string;
|
|
20605
20614
|
sku: string;
|
|
20606
20615
|
variantId: string;
|
|
20607
20616
|
productTitle: string;
|
|
20608
20617
|
variantTitle: string;
|
|
20609
20618
|
}>, "many">;
|
|
20610
|
-
type
|
|
20619
|
+
type LeanProductVariant = z.infer<typeof GetLeanProductVariantsReturn>[number];
|
|
20620
|
+
type LeanProductVariantsOptions = {
|
|
20621
|
+
/** Filter to only active/draft products (excludes ARCHIVED). Defaults to false. */
|
|
20622
|
+
activeOnly?: boolean;
|
|
20623
|
+
};
|
|
20611
20624
|
/**
|
|
20612
20625
|
* Retrieves a lean list of product variants from Shopify, optionally filtered by SKUs.
|
|
20613
20626
|
* Product variants are mapped to a simpler output structure.
|
|
20614
20627
|
* Variants missing essential properties (e.g., SKU) will be filtered out and logged.
|
|
20615
20628
|
*
|
|
20616
20629
|
* @param {string[]} [skus] - An optional array of SKUs to filter by. If provided, only variants matching these SKUs will be fetched.
|
|
20617
|
-
* @
|
|
20630
|
+
* @param {LeanProductVariantsOptions} [options] - Optional settings.
|
|
20631
|
+
* @param {boolean} [options.activeOnly=false] - If true, excludes ARCHIVED products at query level.
|
|
20632
|
+
* @returns {Promise<LeanProductVariant[]>} A promise that resolves to an array of lean product variant data.
|
|
20618
20633
|
* @throws {Error} If the GraphQL query fails, returns no data, or if the `productVariants` field is missing in the response.
|
|
20619
20634
|
*/
|
|
20620
|
-
declare function getLeanProductVariants(skus?: string[]): Promise<
|
|
20635
|
+
declare function getLeanProductVariants(skus?: string[], options?: LeanProductVariantsOptions): Promise<LeanProductVariant[]>;
|
|
20621
20636
|
|
|
20622
20637
|
declare const GetProductVariantsBySkusReturn: z.ZodArray<z.ZodObject<{
|
|
20623
20638
|
productId: z.ZodString;
|
|
@@ -20818,4 +20833,4 @@ type Metaobject = NonNullable<MetaobjectByHandleQuery['metaobjectByHandle']>;
|
|
|
20818
20833
|
*/
|
|
20819
20834
|
declare function getMetaobjectByHandle(handle: MetaobjectHandleInput): Promise<Metaobject | undefined>;
|
|
20820
20835
|
|
|
20821
|
-
export { type BulkUpdateProductVariantsResult, type CalculateRefundLineItem, type CalculateRefundOptions, type CreateFulfillmentResult, type CreateMetaobjectDefinitionInput, type CreateMetaobjectDefinitionResult, type CreateRefundLineItem, type CreateRefundOptions, type CreateRefundResult, type CreateRefundTransaction, type Customer, type CustomerSegmentMember, type CustomerSegmentMembersResult, type Fulfillment, type FulfillmentLineItem$1 as FulfillmentLineItem, type FulfillmentOrder, type FulfillmentTrackingIds, type FullOrder, type FullOrderByName, type LeanOrder, type LeanOrderByName, type Metaobject, type MetaobjectFieldDefinition$1 as MetaobjectFieldDefinition, type MetaobjectHandleInput, type OrderCancellationInfo, type OrderPaymentDetails, type OrderPreview, type ProductVariant, type ProductVariantBySku, type ProductVariantsBySkusOptions, type RefundMoney, type SegmentAttributeStatistics, ShopifyUserError, type ShopifyUserErrorDetail, type SuggestedRefund, type UpdateFulfillmentTrackingResult, type UpsertMetaobjectInput, type UpsertMetaobjectResult, type VariantUpdateInput, bulkUpdateProductVariants, calculateRefund, cancelOrderById, createFile, createFulfillment, createMetaobjectDefinition, createRefund, deleteCustomerById, deleteFilesByIds, getAllProductVariants, getCustomerSegmentMembers, getCustomersByEmail, getFulfillmentById, getFulfillmentOrdersByOrderId, getFulfillmentTrackingIds, getLeanProductVariants, getMetaobjectByHandle, getOrderById, getOrderByName, getOrderCancellationInfoByName, getOrderPaymentDetailsById, getOrdersByCustomerId, getProductVariantsBySkus, parseGid, updateFulfillmentTracking, upsertMetaobject };
|
|
20836
|
+
export { type BulkUpdateProductVariantsResult, type CalculateRefundLineItem, type CalculateRefundOptions, type CreateFulfillmentResult, type CreateMetaobjectDefinitionInput, type CreateMetaobjectDefinitionResult, type CreateRefundLineItem, type CreateRefundOptions, type CreateRefundResult, type CreateRefundTransaction, type Customer, type CustomerSegmentMember, type CustomerSegmentMembersResult, type Fulfillment, type FulfillmentLineItem$1 as FulfillmentLineItem, type FulfillmentOrder, type FulfillmentTrackingIds, type FullOrder, type FullOrderByName, type LeanOrder, type LeanOrderByName, type LeanProductVariant, type LeanProductVariantsOptions, type Metaobject, type MetaobjectFieldDefinition$1 as MetaobjectFieldDefinition, type MetaobjectHandleInput, type OrderCancellationInfo, type OrderPaymentDetails, type OrderPreview, type ProductVariant, type ProductVariantBySku, type ProductVariantsBySkusOptions, type RefundMoney, type SegmentAttributeStatistics, ShopifyUserError, type ShopifyUserErrorDetail, type SuggestedRefund, type UpdateFulfillmentTrackingResult, type UpsertMetaobjectInput, type UpsertMetaobjectResult, type VariantUpdateInput, bulkUpdateProductVariants, calculateRefund, cancelOrderById, createFile, createFulfillment, createMetaobjectDefinition, createRefund, deleteCustomerById, deleteFilesByIds, getAllProductVariants, getCustomerSegmentMembers, getCustomersByEmail, getFulfillmentById, getFulfillmentOrdersByOrderId, getFulfillmentTrackingIds, getLeanProductVariants, getMetaobjectByHandle, getOrderById, getOrderByName, getOrderCancellationInfoByName, getOrderPaymentDetailsById, getOrdersByCustomerId, getProductVariantsBySkus, parseGid, updateFulfillmentTracking, upsertMetaobject };
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,10 @@ type MetaobjectFieldDefinition$1 = {
|
|
|
41
41
|
type: string;
|
|
42
42
|
description?: string;
|
|
43
43
|
required?: boolean;
|
|
44
|
+
validations?: Array<{
|
|
45
|
+
name: string;
|
|
46
|
+
value: string;
|
|
47
|
+
}>;
|
|
44
48
|
};
|
|
45
49
|
type CreateMetaobjectDefinitionInput = {
|
|
46
50
|
type: string;
|
|
@@ -1470,6 +1474,8 @@ type CashRoundingAdjustment = {
|
|
|
1470
1474
|
/**
|
|
1471
1475
|
* A list of products with publishing and pricing information.
|
|
1472
1476
|
* A catalog can be associated with a specific context, such as a [`Market`](https://shopify.dev/api/admin-graphql/current/objects/market), [`CompanyLocation`](https://shopify.dev/api/admin-graphql/current/objects/companylocation), or [`App`](https://shopify.dev/api/admin-graphql/current/objects/app).
|
|
1477
|
+
*
|
|
1478
|
+
* Catalogs can optionally include a publication to control product visibility and a price list to customize pricing. When a publication isn't associated with a catalog, product availability is determined by the sales channel.
|
|
1473
1479
|
*/
|
|
1474
1480
|
type Catalog = {
|
|
1475
1481
|
/** A globally-unique ID. */
|
|
@@ -10262,7 +10268,7 @@ type Market = HasMetafieldDefinitions & HasMetafields & Node & {
|
|
|
10262
10268
|
webPresences: MarketWebPresenceConnection;
|
|
10263
10269
|
};
|
|
10264
10270
|
/**
|
|
10265
|
-
* A catalog for managing product availability and pricing for specific [`Market`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Market) contexts. Each catalog links to one or more markets
|
|
10271
|
+
* A catalog for managing product availability and pricing for specific [`Market`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Market) contexts. Each catalog links to one or more markets. The catalog can optionally include a [`Publication`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Publication) to control which [`Product`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Product) objects customers see, and a [`PriceList`](https://shopify.dev/docs/api/admin-graphql/latest/objects/PriceList) for market-specific pricing adjustments. When a publication isn't associated with the catalog, product availability is determined by the sales channel.
|
|
10266
10272
|
*
|
|
10267
10273
|
* Use catalogs to create distinct shopping experiences for different geographic regions or customer segments.
|
|
10268
10274
|
*
|
|
@@ -20169,7 +20175,7 @@ type LeanProductVariantsQuery = {
|
|
|
20169
20175
|
productVariants: {
|
|
20170
20176
|
edges: Array<{
|
|
20171
20177
|
node: (Pick<ProductVariant$1, 'id' | 'title' | 'sku'> & {
|
|
20172
|
-
product: Pick<Product, 'id' | 'title'>;
|
|
20178
|
+
product: Pick<Product, 'id' | 'title' | 'status'>;
|
|
20173
20179
|
});
|
|
20174
20180
|
}>;
|
|
20175
20181
|
pageInfo: Pick<PageInfo, 'hasNextPage' | 'endCursor'>;
|
|
@@ -20261,7 +20267,7 @@ interface GeneratedQueryTypes {
|
|
|
20261
20267
|
return: AllProductVariantsQuery;
|
|
20262
20268
|
variables: AllProductVariantsQueryVariables;
|
|
20263
20269
|
};
|
|
20264
|
-
"#graphql\n query leanProductVariants($first: Int!, $after: String, $queryFilter: String) {\n productVariants(first: $first, after: $after, query: $queryFilter) {\n edges {\n node {
|
|
20270
|
+
"#graphql\n query leanProductVariants($first: Int!, $after: String, $queryFilter: String) {\n productVariants(first: $first, after: $after, query: $queryFilter) {\n edges {\n node {\n id\n title\n sku\n product {\n id\n title\n status\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n ": {
|
|
20265
20271
|
return: LeanProductVariantsQuery;
|
|
20266
20272
|
variables: LeanProductVariantsQueryVariables;
|
|
20267
20273
|
};
|
|
@@ -20594,30 +20600,39 @@ declare const GetLeanProductVariantsReturn: z.ZodArray<z.ZodObject<{
|
|
|
20594
20600
|
variantId: z.ZodString;
|
|
20595
20601
|
variantTitle: z.ZodString;
|
|
20596
20602
|
sku: z.ZodString;
|
|
20603
|
+
status: z.ZodEnum<["ACTIVE", "ARCHIVED", "DRAFT"]>;
|
|
20597
20604
|
}, "strip", z.ZodTypeAny, {
|
|
20605
|
+
status: "ACTIVE" | "ARCHIVED" | "DRAFT";
|
|
20598
20606
|
productId: string;
|
|
20599
20607
|
sku: string;
|
|
20600
20608
|
variantId: string;
|
|
20601
20609
|
productTitle: string;
|
|
20602
20610
|
variantTitle: string;
|
|
20603
20611
|
}, {
|
|
20612
|
+
status: "ACTIVE" | "ARCHIVED" | "DRAFT";
|
|
20604
20613
|
productId: string;
|
|
20605
20614
|
sku: string;
|
|
20606
20615
|
variantId: string;
|
|
20607
20616
|
productTitle: string;
|
|
20608
20617
|
variantTitle: string;
|
|
20609
20618
|
}>, "many">;
|
|
20610
|
-
type
|
|
20619
|
+
type LeanProductVariant = z.infer<typeof GetLeanProductVariantsReturn>[number];
|
|
20620
|
+
type LeanProductVariantsOptions = {
|
|
20621
|
+
/** Filter to only active/draft products (excludes ARCHIVED). Defaults to false. */
|
|
20622
|
+
activeOnly?: boolean;
|
|
20623
|
+
};
|
|
20611
20624
|
/**
|
|
20612
20625
|
* Retrieves a lean list of product variants from Shopify, optionally filtered by SKUs.
|
|
20613
20626
|
* Product variants are mapped to a simpler output structure.
|
|
20614
20627
|
* Variants missing essential properties (e.g., SKU) will be filtered out and logged.
|
|
20615
20628
|
*
|
|
20616
20629
|
* @param {string[]} [skus] - An optional array of SKUs to filter by. If provided, only variants matching these SKUs will be fetched.
|
|
20617
|
-
* @
|
|
20630
|
+
* @param {LeanProductVariantsOptions} [options] - Optional settings.
|
|
20631
|
+
* @param {boolean} [options.activeOnly=false] - If true, excludes ARCHIVED products at query level.
|
|
20632
|
+
* @returns {Promise<LeanProductVariant[]>} A promise that resolves to an array of lean product variant data.
|
|
20618
20633
|
* @throws {Error} If the GraphQL query fails, returns no data, or if the `productVariants` field is missing in the response.
|
|
20619
20634
|
*/
|
|
20620
|
-
declare function getLeanProductVariants(skus?: string[]): Promise<
|
|
20635
|
+
declare function getLeanProductVariants(skus?: string[], options?: LeanProductVariantsOptions): Promise<LeanProductVariant[]>;
|
|
20621
20636
|
|
|
20622
20637
|
declare const GetProductVariantsBySkusReturn: z.ZodArray<z.ZodObject<{
|
|
20623
20638
|
productId: z.ZodString;
|
|
@@ -20818,4 +20833,4 @@ type Metaobject = NonNullable<MetaobjectByHandleQuery['metaobjectByHandle']>;
|
|
|
20818
20833
|
*/
|
|
20819
20834
|
declare function getMetaobjectByHandle(handle: MetaobjectHandleInput): Promise<Metaobject | undefined>;
|
|
20820
20835
|
|
|
20821
|
-
export { type BulkUpdateProductVariantsResult, type CalculateRefundLineItem, type CalculateRefundOptions, type CreateFulfillmentResult, type CreateMetaobjectDefinitionInput, type CreateMetaobjectDefinitionResult, type CreateRefundLineItem, type CreateRefundOptions, type CreateRefundResult, type CreateRefundTransaction, type Customer, type CustomerSegmentMember, type CustomerSegmentMembersResult, type Fulfillment, type FulfillmentLineItem$1 as FulfillmentLineItem, type FulfillmentOrder, type FulfillmentTrackingIds, type FullOrder, type FullOrderByName, type LeanOrder, type LeanOrderByName, type Metaobject, type MetaobjectFieldDefinition$1 as MetaobjectFieldDefinition, type MetaobjectHandleInput, type OrderCancellationInfo, type OrderPaymentDetails, type OrderPreview, type ProductVariant, type ProductVariantBySku, type ProductVariantsBySkusOptions, type RefundMoney, type SegmentAttributeStatistics, ShopifyUserError, type ShopifyUserErrorDetail, type SuggestedRefund, type UpdateFulfillmentTrackingResult, type UpsertMetaobjectInput, type UpsertMetaobjectResult, type VariantUpdateInput, bulkUpdateProductVariants, calculateRefund, cancelOrderById, createFile, createFulfillment, createMetaobjectDefinition, createRefund, deleteCustomerById, deleteFilesByIds, getAllProductVariants, getCustomerSegmentMembers, getCustomersByEmail, getFulfillmentById, getFulfillmentOrdersByOrderId, getFulfillmentTrackingIds, getLeanProductVariants, getMetaobjectByHandle, getOrderById, getOrderByName, getOrderCancellationInfoByName, getOrderPaymentDetailsById, getOrdersByCustomerId, getProductVariantsBySkus, parseGid, updateFulfillmentTracking, upsertMetaobject };
|
|
20836
|
+
export { type BulkUpdateProductVariantsResult, type CalculateRefundLineItem, type CalculateRefundOptions, type CreateFulfillmentResult, type CreateMetaobjectDefinitionInput, type CreateMetaobjectDefinitionResult, type CreateRefundLineItem, type CreateRefundOptions, type CreateRefundResult, type CreateRefundTransaction, type Customer, type CustomerSegmentMember, type CustomerSegmentMembersResult, type Fulfillment, type FulfillmentLineItem$1 as FulfillmentLineItem, type FulfillmentOrder, type FulfillmentTrackingIds, type FullOrder, type FullOrderByName, type LeanOrder, type LeanOrderByName, type LeanProductVariant, type LeanProductVariantsOptions, type Metaobject, type MetaobjectFieldDefinition$1 as MetaobjectFieldDefinition, type MetaobjectHandleInput, type OrderCancellationInfo, type OrderPaymentDetails, type OrderPreview, type ProductVariant, type ProductVariantBySku, type ProductVariantsBySkusOptions, type RefundMoney, type SegmentAttributeStatistics, ShopifyUserError, type ShopifyUserErrorDetail, type SuggestedRefund, type UpdateFulfillmentTrackingResult, type UpsertMetaobjectInput, type UpsertMetaobjectResult, type VariantUpdateInput, bulkUpdateProductVariants, calculateRefund, cancelOrderById, createFile, createFulfillment, createMetaobjectDefinition, createRefund, deleteCustomerById, deleteFilesByIds, getAllProductVariants, getCustomerSegmentMembers, getCustomersByEmail, getFulfillmentById, getFulfillmentOrdersByOrderId, getFulfillmentTrackingIds, getLeanProductVariants, getMetaobjectByHandle, getOrderById, getOrderByName, getOrderCancellationInfoByName, getOrderPaymentDetailsById, getOrdersByCustomerId, getProductVariantsBySkus, parseGid, updateFulfillmentTracking, upsertMetaobject };
|
package/dist/index.mjs
CHANGED
|
@@ -1815,35 +1815,46 @@ var GetLeanProductVariantsReturn = z5.array(
|
|
|
1815
1815
|
productTitle: z5.string(),
|
|
1816
1816
|
variantId: z5.string(),
|
|
1817
1817
|
variantTitle: z5.string(),
|
|
1818
|
-
sku: z5.string()
|
|
1818
|
+
sku: z5.string(),
|
|
1819
|
+
status: z5.enum(["ACTIVE", "ARCHIVED", "DRAFT"])
|
|
1819
1820
|
})
|
|
1820
1821
|
);
|
|
1821
|
-
async function getLeanProductVariants(skus) {
|
|
1822
|
+
async function getLeanProductVariants(skus, options) {
|
|
1822
1823
|
const queryGql = gql`#graphql
|
|
1823
1824
|
query leanProductVariants($first: Int!, $after: String, $queryFilter: String) {
|
|
1824
1825
|
productVariants(first: $first, after: $after, query: $queryFilter) {
|
|
1825
1826
|
edges {
|
|
1826
|
-
node {
|
|
1827
|
+
node {
|
|
1827
1828
|
id
|
|
1828
1829
|
title
|
|
1829
1830
|
sku
|
|
1830
1831
|
product {
|
|
1831
1832
|
id
|
|
1832
1833
|
title
|
|
1834
|
+
status
|
|
1833
1835
|
}
|
|
1834
1836
|
}
|
|
1835
1837
|
}
|
|
1836
|
-
pageInfo {
|
|
1838
|
+
pageInfo {
|
|
1837
1839
|
hasNextPage
|
|
1838
1840
|
endCursor
|
|
1839
1841
|
}
|
|
1840
1842
|
}
|
|
1841
1843
|
}
|
|
1842
1844
|
`;
|
|
1843
|
-
const
|
|
1845
|
+
const queryParts = [];
|
|
1844
1846
|
if (skus && skus.length > 0) {
|
|
1845
|
-
|
|
1847
|
+
queryParts.push(skus.map((sku) => `sku:${sku}`).join(" OR "));
|
|
1848
|
+
}
|
|
1849
|
+
if (options?.activeOnly) {
|
|
1850
|
+
queryParts.push("product_status:active,draft");
|
|
1846
1851
|
}
|
|
1852
|
+
const initialVariables = {
|
|
1853
|
+
first: 250,
|
|
1854
|
+
...queryParts.length > 0 && {
|
|
1855
|
+
queryFilter: queryParts.filter(Boolean).join(" AND ")
|
|
1856
|
+
}
|
|
1857
|
+
};
|
|
1847
1858
|
const extractedNodes = await fetchShopifyGraphql({
|
|
1848
1859
|
query: queryGql,
|
|
1849
1860
|
variables: initialVariables,
|
|
@@ -1871,7 +1882,8 @@ async function getLeanProductVariants(skus) {
|
|
|
1871
1882
|
productTitle: v.product.title,
|
|
1872
1883
|
variantId: v.id,
|
|
1873
1884
|
variantTitle: v.title,
|
|
1874
|
-
sku: v.sku
|
|
1885
|
+
sku: v.sku,
|
|
1886
|
+
status: v.product.status
|
|
1875
1887
|
}
|
|
1876
1888
|
];
|
|
1877
1889
|
}
|